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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorYiming Wu <xp8110@outlook.com>2019-03-08 14:12:37 +0300
committerYiming Wu <xp8110@outlook.com>2019-03-08 14:12:37 +0300
commit26fc7ef55f1584bcf9fd262419f1a3f540c186af (patch)
tree5dc5c93434683a8f211ae5e852ac18c793bc0510 /source
parent0ed55524f150003a0121c4e7e5f5c26c52184e00 (diff)
parentcf09a2443cef60cda28c2c2023cb84728e644081 (diff)
Merge branch 'master' into soc-2018-npr
# Conflicts: # release/datafiles/locale # release/scripts/addons # release/scripts/addons_contrib # source/blender/draw/intern/DRW_render.h # source/blender/makesdna/DNA_light_types.h # source/blender/makesdna/DNA_scene_types.h # source/blender/makesrna/intern/rna_scene.c # source/tools
Diffstat (limited to 'source')
-rw-r--r--source/CMakeLists.txt5
-rw-r--r--source/blender/CMakeLists.txt9
-rw-r--r--source/blender/alembic/ABC_alembic.h13
-rw-r--r--source/blender/alembic/CMakeLists.txt9
-rw-r--r--source/blender/alembic/intern/abc_archive.cc9
-rw-r--r--source/blender/alembic/intern/abc_archive.h9
-rw-r--r--source/blender/alembic/intern/abc_camera.cc18
-rw-r--r--source/blender/alembic/intern/abc_camera.h10
-rw-r--r--source/blender/alembic/intern/abc_curves.cc30
-rw-r--r--source/blender/alembic/intern/abc_curves.h22
-rw-r--r--source/blender/alembic/intern/abc_customdata.cc9
-rw-r--r--source/blender/alembic/intern/abc_customdata.h9
-rw-r--r--source/blender/alembic/intern/abc_exporter.cc28
-rw-r--r--source/blender/alembic/intern/abc_exporter.h13
-rw-r--r--source/blender/alembic/intern/abc_hair.cc12
-rw-r--r--source/blender/alembic/intern/abc_hair.h10
-rw-r--r--source/blender/alembic/intern/abc_mball.cc12
-rw-r--r--source/blender/alembic/intern/abc_mball.h10
-rw-r--r--source/blender/alembic/intern/abc_mesh.cc100
-rw-r--r--source/blender/alembic/intern/abc_mesh.h57
-rw-r--r--source/blender/alembic/intern/abc_nurbs.cc14
-rw-r--r--source/blender/alembic/intern/abc_nurbs.h12
-rw-r--r--source/blender/alembic/intern/abc_object.cc10
-rw-r--r--source/blender/alembic/intern/abc_object.h12
-rw-r--r--source/blender/alembic/intern/abc_points.cc11
-rw-r--r--source/blender/alembic/intern/abc_points.h9
-rw-r--r--source/blender/alembic/intern/abc_transform.cc10
-rw-r--r--source/blender/alembic/intern/abc_transform.h10
-rw-r--r--source/blender/alembic/intern/abc_util.cc10
-rw-r--r--source/blender/alembic/intern/abc_util.h12
-rw-r--r--source/blender/alembic/intern/alembic_capi.cc19
-rw-r--r--source/blender/avi/AVI_avi.h14
-rw-r--r--source/blender/avi/CMakeLists.txt11
-rw-r--r--source/blender/avi/intern/avi.c13
-rw-r--r--source/blender/avi/intern/avi_codecs.c12
-rw-r--r--source/blender/avi/intern/avi_endian.c13
-rw-r--r--source/blender/avi/intern/avi_endian.h12
-rw-r--r--source/blender/avi/intern/avi_intern.h12
-rw-r--r--source/blender/avi/intern/avi_mjpeg.c29
-rw-r--r--source/blender/avi/intern/avi_mjpeg.h12
-rw-r--r--source/blender/avi/intern/avi_options.c13
-rw-r--r--source/blender/avi/intern/avi_rgb.c13
-rw-r--r--source/blender/avi/intern/avi_rgb.h12
-rw-r--r--source/blender/avi/intern/avi_rgb32.c13
-rw-r--r--source/blender/avi/intern/avi_rgb32.h12
-rw-r--r--source/blender/blenfont/BLF_api.h15
-rw-r--r--source/blender/blenfont/CMakeLists.txt3
-rw-r--r--source/blender/blenfont/intern/blf.c80
-rw-r--r--source/blender/blenfont/intern/blf_dir.c12
-rw-r--r--source/blender/blenfont/intern/blf_font.c17
-rw-r--r--source/blender/blenfont/intern/blf_font_i18n.c119
-rw-r--r--source/blender/blenfont/intern/blf_font_win32_compat.c8
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c14
-rw-r--r--source/blender/blenfont/intern/blf_internal.h12
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h13
-rw-r--r--source/blender/blenfont/intern/blf_thumbs.c10
-rw-r--r--source/blender/blenfont/intern/blf_util.c11
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h44
-rw-r--r--source/blender/blenkernel/BKE_action.h27
-rw-r--r--source/blender/blenkernel/BKE_addon.h10
-rw-r--r--source/blender/blenkernel/BKE_anim.h21
-rw-r--r--source/blender/blenkernel/BKE_animsys.h29
-rw-r--r--source/blender/blenkernel/BKE_appdir.h8
-rw-r--r--source/blender/blenkernel/BKE_armature.h26
-rw-r--r--source/blender/blenkernel/BKE_autoexec.h10
-rw-r--r--source/blender/blenkernel/BKE_blender.h20
-rw-r--r--source/blender/blenkernel/BKE_blender_copybuffer.h14
-rw-r--r--source/blender/blenkernel/BKE_blender_undo.h12
-rw-r--r--source/blender/blenkernel/BKE_blender_user_menu.h8
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h10
-rw-r--r--source/blender/blenkernel/BKE_blendfile.h12
-rw-r--r--source/blender/blenkernel/BKE_boids.h14
-rw-r--r--source/blender/blenkernel/BKE_bpath.h12
-rw-r--r--source/blender/blenkernel/BKE_brush.h14
-rw-r--r--source/blender/blenkernel/BKE_bvhutils.h18
-rw-r--r--source/blender/blenkernel/BKE_cachefile.h10
-rw-r--r--source/blender/blenkernel/BKE_camera.h24
-rw-r--r--source/blender/blenkernel/BKE_ccg.h12
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h26
-rw-r--r--source/blender/blenkernel/BKE_cloth.h28
-rw-r--r--source/blender/blenkernel/BKE_collection.h19
-rw-r--r--source/blender/blenkernel/BKE_collision.h19
-rw-r--r--source/blender/blenkernel/BKE_colorband.h7
-rw-r--r--source/blender/blenkernel/BKE_colortools.h22
-rw-r--r--source/blender/blenkernel/BKE_constraint.h75
-rw-r--r--source/blender/blenkernel/BKE_context.h54
-rw-r--r--source/blender/blenkernel/BKE_crazyspace.h17
-rw-r--r--source/blender/blenkernel/BKE_curve.h25
-rw-r--r--source/blender/blenkernel/BKE_customdata.h41
-rw-r--r--source/blender/blenkernel/BKE_customdata_file.h8
-rw-r--r--source/blender/blenkernel/BKE_data_transfer.h16
-rw-r--r--source/blender/blenkernel/BKE_deform.h20
-rw-r--r--source/blender/blenkernel/BKE_displist.h26
-rw-r--r--source/blender/blenkernel/BKE_dynamicpaint.h10
-rw-r--r--source/blender/blenkernel/BKE_editlattice.h8
-rw-r--r--source/blender/blenkernel/BKE_editmesh.h22
-rw-r--r--source/blender/blenkernel/BKE_editmesh_bvh.h18
-rw-r--r--source/blender/blenkernel/BKE_editmesh_cache.h8
-rw-r--r--source/blender/blenkernel/BKE_editmesh_tangent.h10
-rw-r--r--source/blender/blenkernel/BKE_effect.h26
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h27
-rw-r--r--source/blender/blenkernel/BKE_fluidsim.h18
-rw-r--r--source/blender/blenkernel/BKE_font.h18
-rw-r--r--source/blender/blenkernel/BKE_freestyle.h14
-rw-r--r--source/blender/blenkernel/BKE_global.h194
-rw-r--r--source/blender/blenkernel/BKE_gpencil.h51
-rw-r--r--source/blender/blenkernel/BKE_gpencil_modifier.h28
-rw-r--r--source/blender/blenkernel/BKE_icons.h14
-rw-r--r--source/blender/blenkernel/BKE_idcode.h19
-rw-r--r--source/blender/blenkernel/BKE_idprop.h13
-rw-r--r--source/blender/blenkernel/BKE_image.h41
-rw-r--r--source/blender/blenkernel/BKE_ipo.h17
-rw-r--r--source/blender/blenkernel/BKE_key.h28
-rw-r--r--source/blender/blenkernel/BKE_keyconfig.h8
-rw-r--r--source/blender/blenkernel/BKE_lattice.h23
-rw-r--r--source/blender/blenkernel/BKE_layer.h54
-rw-r--r--source/blender/blenkernel/BKE_library.h122
-rw-r--r--source/blender/blenkernel/BKE_library_idmap.h16
-rw-r--r--source/blender/blenkernel/BKE_library_override.h12
-rw-r--r--source/blender/blenkernel/BKE_library_query.h12
-rw-r--r--source/blender/blenkernel/BKE_library_remap.h8
-rw-r--r--source/blender/blenkernel/BKE_light.h (renamed from source/blender/blenkernel/BKE_lamp.h)34
-rw-r--r--source/blender/blenkernel/BKE_lightprobe.h16
-rw-r--r--source/blender/blenkernel/BKE_linestyle.h18
-rw-r--r--source/blender/blenkernel/BKE_main.h133
-rw-r--r--source/blender/blenkernel/BKE_mask.h18
-rw-r--r--source/blender/blenkernel/BKE_material.h20
-rw-r--r--source/blender/blenkernel/BKE_mball.h20
-rw-r--r--source/blender/blenkernel/BKE_mball_tessellate.h8
-rw-r--r--source/blender/blenkernel/BKE_mesh.h77
-rw-r--r--source/blender/blenkernel/BKE_mesh_iterators.h20
-rw-r--r--source/blender/blenkernel/BKE_mesh_mapping.h18
-rw-r--r--source/blender/blenkernel/BKE_mesh_remap.h10
-rw-r--r--source/blender/blenkernel/BKE_mesh_runtime.h41
-rw-r--r--source/blender/blenkernel/BKE_mesh_tangent.h8
-rw-r--r--source/blender/blenkernel/BKE_modifier.h57
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h14
-rw-r--r--source/blender/blenkernel/BKE_multires.h28
-rw-r--r--source/blender/blenkernel/BKE_nla.h15
-rw-r--r--source/blender/blenkernel/BKE_node.h52
-rw-r--r--source/blender/blenkernel/BKE_object.h61
-rw-r--r--source/blender/blenkernel/BKE_object_deform.h10
-rw-r--r--source/blender/blenkernel/BKE_object_facemap.h10
-rw-r--r--source/blender/blenkernel/BKE_ocean.h10
-rw-r--r--source/blender/blenkernel/BKE_outliner_treehash.h12
-rw-r--r--source/blender/blenkernel/BKE_packedFile.h16
-rw-r--r--source/blender/blenkernel/BKE_paint.h43
-rw-r--r--source/blender/blenkernel/BKE_particle.h54
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h24
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h16
-rw-r--r--source/blender/blenkernel/BKE_report.h10
-rw-r--r--source/blender/blenkernel/BKE_rigidbody.h16
-rw-r--r--source/blender/blenkernel/BKE_scene.h25
-rw-r--r--source/blender/blenkernel/BKE_screen.h28
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h33
-rw-r--r--source/blender/blenkernel/BKE_shader_fx.h24
-rw-r--r--source/blender/blenkernel/BKE_shrinkwrap.h20
-rw-r--r--source/blender/blenkernel/BKE_smoke.h30
-rw-r--r--source/blender/blenkernel/BKE_softbody.h12
-rw-r--r--source/blender/blenkernel/BKE_sound.h16
-rw-r--r--source/blender/blenkernel/BKE_speaker.h12
-rw-r--r--source/blender/blenkernel/BKE_studiolight.h12
-rw-r--r--source/blender/blenkernel/BKE_subdiv.h75
-rw-r--r--source/blender/blenkernel/BKE_subdiv_ccg.h88
-rw-r--r--source/blender/blenkernel/BKE_subdiv_eval.h12
-rw-r--r--source/blender/blenkernel/BKE_subdiv_foreach.h12
-rw-r--r--source/blender/blenkernel/BKE_subdiv_mesh.h12
-rw-r--r--source/blender/blenkernel/BKE_subsurf.h30
-rw-r--r--source/blender/blenkernel/BKE_suggestions.h12
-rw-r--r--source/blender/blenkernel/BKE_text.h16
-rw-r--r--source/blender/blenkernel/BKE_texture.h21
-rw-r--r--source/blender/blenkernel/BKE_tracking.h28
-rw-r--r--source/blender/blenkernel/BKE_undo_system.h44
-rw-r--r--source/blender/blenkernel/BKE_unit.h17
-rw-r--r--source/blender/blenkernel/BKE_workspace.h12
-rw-r--r--source/blender/blenkernel/BKE_world.h14
-rw-r--r--source/blender/blenkernel/BKE_writeavi.h12
-rw-r--r--source/blender/blenkernel/BKE_writeffmpeg.h12
-rw-r--r--source/blender/blenkernel/CMakeLists.txt24
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c9
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.h16
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_inline.h8
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_intern.h8
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_legacy.c12
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c8
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c8
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_util.c10
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c362
-rw-r--r--source/blender/blenkernel/intern/action.c32
-rw-r--r--source/blender/blenkernel/intern/addon.c19
-rw-r--r--source/blender/blenkernel/intern/anim.c33
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c1399
-rw-r--r--source/blender/blenkernel/intern/appdir.c18
-rw-r--r--source/blender/blenkernel/intern/armature.c57
-rw-r--r--source/blender/blenkernel/intern/armature_update.c12
-rw-r--r--source/blender/blenkernel/intern/autoexec.c10
-rw-r--r--source/blender/blenkernel/intern/blender.c41
-rw-r--r--source/blender/blenkernel/intern/blender_copybuffer.c14
-rw-r--r--source/blender/blenkernel/intern/blender_undo.c10
-rw-r--r--source/blender/blenkernel/intern/blender_user_menu.c8
-rw-r--r--source/blender/blenkernel/intern/blendfile.c59
-rw-r--r--source/blender/blenkernel/intern/boids.c14
-rw-r--r--source/blender/blenkernel/intern/bpath.c29
-rw-r--r--source/blender/blenkernel/intern/brush.c23
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c19
-rw-r--r--source/blender/blenkernel/intern/cachefile.c19
-rw-r--r--source/blender/blenkernel/intern/camera.c93
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c58
-rw-r--r--source/blender/blenkernel/intern/cloth.c19
-rw-r--r--source/blender/blenkernel/intern/collection.c176
-rw-r--r--source/blender/blenkernel/intern/collision.c60
-rw-r--r--source/blender/blenkernel/intern/colorband.c8
-rw-r--r--source/blender/blenkernel/intern/colortools.c29
-rw-r--r--source/blender/blenkernel/intern/constraint.c26
-rw-r--r--source/blender/blenkernel/intern/context.c38
-rw-r--r--source/blender/blenkernel/intern/crazyspace.c24
-rw-r--r--source/blender/blenkernel/intern/curve.c107
-rw-r--r--source/blender/blenkernel/intern/curve_decimate.c8
-rw-r--r--source/blender/blenkernel/intern/customdata.c232
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c8
-rw-r--r--source/blender/blenkernel/intern/data_transfer.c100
-rw-r--r--source/blender/blenkernel/intern/data_transfer_intern.h13
-rw-r--r--source/blender/blenkernel/intern/deform.c46
-rw-r--r--source/blender/blenkernel/intern/displist.c74
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c46
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c14
-rw-r--r--source/blender/blenkernel/intern/editlattice.c8
-rw-r--r--source/blender/blenkernel/intern/editmesh.c18
-rw-r--r--source/blender/blenkernel/intern/editmesh_bvh.c12
-rw-r--r--source/blender/blenkernel/intern/editmesh_cache.c9
-rw-r--r--source/blender/blenkernel/intern/editmesh_tangent.c8
-rw-r--r--source/blender/blenkernel/intern/effect.c43
-rw-r--r--source/blender/blenkernel/intern/fcurve.c64
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c14
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c32
-rw-r--r--source/blender/blenkernel/intern/font.c36
-rw-r--r--source/blender/blenkernel/intern/freestyle.c12
-rw-r--r--source/blender/blenkernel/intern/gpencil.c244
-rw-r--r--source/blender/blenkernel/intern/gpencil_modifier.c14
-rw-r--r--source/blender/blenkernel/intern/icons.c31
-rw-r--r--source/blender/blenkernel/intern/icons_rasterize.c9
-rw-r--r--source/blender/blenkernel/intern/idcode.c73
-rw-r--r--source/blender/blenkernel/intern/idprop.c18
-rw-r--r--source/blender/blenkernel/intern/idprop_utils.c8
-rw-r--r--source/blender/blenkernel/intern/image.c411
-rw-r--r--source/blender/blenkernel/intern/image_gen.c10
-rw-r--r--source/blender/blenkernel/intern/ipo.c72
-rw-r--r--source/blender/blenkernel/intern/key.c55
-rw-r--r--source/blender/blenkernel/intern/keyconfig.c10
-rw-r--r--source/blender/blenkernel/intern/lattice.c28
-rw-r--r--source/blender/blenkernel/intern/layer.c478
-rw-r--r--source/blender/blenkernel/intern/layer_utils.c13
-rw-r--r--source/blender/blenkernel/intern/library.c374
-rw-r--r--source/blender/blenkernel/intern/library_idmap.c49
-rw-r--r--source/blender/blenkernel/intern/library_override.c112
-rw-r--r--source/blender/blenkernel/intern/library_query.c154
-rw-r--r--source/blender/blenkernel/intern/library_remap.c308
-rw-r--r--source/blender/blenkernel/intern/light.c (renamed from source/blender/blenkernel/intern/lamp.c)52
-rw-r--r--source/blender/blenkernel/intern/lightprobe.c18
-rw-r--r--source/blender/blenkernel/intern/linestyle.c18
-rw-r--r--source/blender/blenkernel/intern/main.c261
-rw-r--r--source/blender/blenkernel/intern/mask.c45
-rw-r--r--source/blender/blenkernel/intern/mask_evaluate.c12
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c22
-rw-r--r--source/blender/blenkernel/intern/material.c57
-rw-r--r--source/blender/blenkernel/intern/mball.c37
-rw-r--r--source/blender/blenkernel/intern/mball_tessellate.c25
-rw-r--r--source/blender/blenkernel/intern/mesh.c130
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c117
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.c84
-rw-r--r--source/blender/blenkernel/intern/mesh_iterators.c10
-rw-r--r--source/blender/blenkernel/intern/mesh_mapping.c12
-rw-r--r--source/blender/blenkernel/intern/mesh_merge.c10
-rw-r--r--source/blender/blenkernel/intern/mesh_remap.c18
-rw-r--r--source/blender/blenkernel/intern/mesh_runtime.c17
-rw-r--r--source/blender/blenkernel/intern/mesh_tangent.c14
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c104
-rw-r--r--source/blender/blenkernel/intern/modifier.c58
-rw-r--r--source/blender/blenkernel/intern/movieclip.c123
-rw-r--r--source/blender/blenkernel/intern/multires.c79
-rw-r--r--source/blender/blenkernel/intern/multires_inline.h10
-rw-r--r--source/blender/blenkernel/intern/multires_reshape.c488
-rw-r--r--source/blender/blenkernel/intern/multires_subdiv.c11
-rw-r--r--source/blender/blenkernel/intern/nla.c22
-rw-r--r--source/blender/blenkernel/intern/node.c95
-rw-r--r--source/blender/blenkernel/intern/object.c650
-rw-r--r--source/blender/blenkernel/intern/object_deform.c14
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c275
-rw-r--r--source/blender/blenkernel/intern/object_facemap.c18
-rw-r--r--source/blender/blenkernel/intern/object_update.c117
-rw-r--r--source/blender/blenkernel/intern/ocean.c9
-rw-r--r--source/blender/blenkernel/intern/outliner_treehash.c10
-rw-r--r--source/blender/blenkernel/intern/packedFile.c38
-rw-r--r--source/blender/blenkernel/intern/paint.c46
-rw-r--r--source/blender/blenkernel/intern/paint_toolslots.c12
-rw-r--r--source/blender/blenkernel/intern/particle.c93
-rw-r--r--source/blender/blenkernel/intern/particle_child.c12
-rw-r--r--source/blender/blenkernel/intern/particle_distribute.c30
-rw-r--r--source/blender/blenkernel/intern/particle_system.c143
-rw-r--r--source/blender/blenkernel/intern/pbvh.c31
-rw-r--r--source/blender/blenkernel/intern/pbvh_bmesh.c12
-rw-r--r--source/blender/blenkernel/intern/pbvh_intern.h10
-rw-r--r--source/blender/blenkernel/intern/pointcache.c47
-rw-r--r--source/blender/blenkernel/intern/report.c10
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c45
-rw-r--r--source/blender/blenkernel/intern/scene.c181
-rw-r--r--source/blender/blenkernel/intern/screen.c29
-rw-r--r--source/blender/blenkernel/intern/seqcache.c10
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c167
-rw-r--r--source/blender/blenkernel/intern/seqmodifier.c11
-rw-r--r--source/blender/blenkernel/intern/sequencer.c64
-rw-r--r--source/blender/blenkernel/intern/shader_fx.c11
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c52
-rw-r--r--source/blender/blenkernel/intern/smoke.c130
-rw-r--r--source/blender/blenkernel/intern/softbody.c331
-rw-r--r--source/blender/blenkernel/intern/sound.c28
-rw-r--r--source/blender/blenkernel/intern/speaker.c16
-rw-r--r--source/blender/blenkernel/intern/studiolight.c20
-rw-r--r--source/blender/blenkernel/intern/subdiv.c109
-rw-r--r--source/blender/blenkernel/intern/subdiv_ccg.c231
-rw-r--r--source/blender/blenkernel/intern/subdiv_ccg_mask.c35
-rw-r--r--source/blender/blenkernel/intern/subdiv_ccg_material.c67
-rw-r--r--source/blender/blenkernel/intern/subdiv_converter.c10
-rw-r--r--source/blender/blenkernel/intern/subdiv_converter.h22
-rw-r--r--source/blender/blenkernel/intern/subdiv_converter_mesh.c11
-rw-r--r--source/blender/blenkernel/intern/subdiv_displacement.c10
-rw-r--r--source/blender/blenkernel/intern/subdiv_displacement_multires.c277
-rw-r--r--source/blender/blenkernel/intern/subdiv_eval.c17
-rw-r--r--source/blender/blenkernel/intern/subdiv_foreach.c125
-rw-r--r--source/blender/blenkernel/intern/subdiv_inline.h70
-rw-r--r--source/blender/blenkernel/intern/subdiv_mesh.c252
-rw-r--r--source/blender/blenkernel/intern/subdiv_stats.c19
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c38
-rw-r--r--source/blender/blenkernel/intern/suggestions.c12
-rw-r--r--source/blender/blenkernel/intern/text.c18
-rw-r--r--source/blender/blenkernel/intern/texture.c21
-rw-r--r--source/blender/blenkernel/intern/tracking.c12
-rw-r--r--source/blender/blenkernel/intern/tracking_auto.c12
-rw-r--r--source/blender/blenkernel/intern/tracking_detect.c12
-rw-r--r--source/blender/blenkernel/intern/tracking_plane_tracker.c12
-rw-r--r--source/blender/blenkernel/intern/tracking_region_tracker.c12
-rw-r--r--source/blender/blenkernel/intern/tracking_solver.c12
-rw-r--r--source/blender/blenkernel/intern/tracking_stabilize.c15
-rw-r--r--source/blender/blenkernel/intern/tracking_util.c12
-rw-r--r--source/blender/blenkernel/intern/undo_system.c240
-rw-r--r--source/blender/blenkernel/intern/unit.c177
-rw-r--r--source/blender/blenkernel/intern/workspace.c19
-rw-r--r--source/blender/blenkernel/intern/world.c21
-rw-r--r--source/blender/blenkernel/intern/writeavi.c22
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c11
-rw-r--r--source/blender/blenkernel/nla_private.h104
-rw-r--r--source/blender/blenkernel/particle_private.h11
-rw-r--r--source/blender/blenkernel/tracking_private.h12
-rw-r--r--source/blender/blenlib/BLI_alloca.h8
-rw-r--r--source/blender/blenlib/BLI_args.h14
-rw-r--r--source/blender/blenlib/BLI_array.h16
-rw-r--r--source/blender/blenlib/BLI_array_store.h12
-rw-r--r--source/blender/blenlib/BLI_array_store_utils.h8
-rw-r--r--source/blender/blenlib/BLI_array_utils.h10
-rw-r--r--source/blender/blenlib/BLI_assert.h8
-rw-r--r--source/blender/blenlib/BLI_astar.h24
-rw-r--r--source/blender/blenlib/BLI_bitmap.h10
-rw-r--r--source/blender/blenlib/BLI_bitmap_draw_2d.h8
-rw-r--r--source/blender/blenlib/BLI_blenlib.h12
-rw-r--r--source/blender/blenlib/BLI_boxpack_2d.h12
-rw-r--r--source/blender/blenlib/BLI_buffer.h8
-rw-r--r--source/blender/blenlib/BLI_callbacks.h10
-rw-r--r--source/blender/blenlib/BLI_compiler_attrs.h13
-rw-r--r--source/blender/blenlib/BLI_compiler_compat.h9
-rw-r--r--source/blender/blenlib/BLI_compiler_typecheck.h8
-rw-r--r--source/blender/blenlib/BLI_console.h20
-rw-r--r--source/blender/blenlib/BLI_convexhull_2d.h8
-rw-r--r--source/blender/blenlib/BLI_dial_2d.h8
-rw-r--r--source/blender/blenlib/BLI_dlrbTree.h11
-rw-r--r--source/blender/blenlib/BLI_dynlib.h12
-rw-r--r--source/blender/blenlib/BLI_dynstr.h16
-rw-r--r--source/blender/blenlib/BLI_easing.h10
-rw-r--r--source/blender/blenlib/BLI_edgehash.h11
-rw-r--r--source/blender/blenlib/BLI_endian_switch.h10
-rw-r--r--source/blender/blenlib/BLI_endian_switch_inline.h16
-rw-r--r--source/blender/blenlib/BLI_expr_pylike_eval.h10
-rw-r--r--source/blender/blenlib/BLI_fileops.h14
-rw-r--r--source/blender/blenlib/BLI_fileops_types.h14
-rw-r--r--source/blender/blenlib/BLI_fnmatch.h26
-rw-r--r--source/blender/blenlib/BLI_ghash.h13
-rw-r--r--source/blender/blenlib/BLI_gsqueue.h12
-rw-r--r--source/blender/blenlib/BLI_hash.h16
-rw-r--r--source/blender/blenlib/BLI_hash_md5.h8
-rw-r--r--source/blender/blenlib/BLI_hash_mm2a.h8
-rw-r--r--source/blender/blenlib/BLI_hash_mm3.h8
-rw-r--r--source/blender/blenlib/BLI_heap.h10
-rw-r--r--source/blender/blenlib/BLI_heap_simple.h10
-rw-r--r--source/blender/blenlib/BLI_iterator.h10
-rw-r--r--source/blender/blenlib/BLI_jitter_2d.h12
-rw-r--r--source/blender/blenlib/BLI_kdopbvh.h56
-rw-r--r--source/blender/blenlib/BLI_kdtree.h15
-rw-r--r--source/blender/blenlib/BLI_lasso_2d.h12
-rw-r--r--source/blender/blenlib/BLI_link_utils.h10
-rw-r--r--source/blender/blenlib/BLI_linklist.h14
-rw-r--r--source/blender/blenlib/BLI_linklist_lockfree.h10
-rw-r--r--source/blender/blenlib/BLI_linklist_stack.h10
-rw-r--r--source/blender/blenlib/BLI_listbase.h20
-rw-r--r--source/blender/blenlib/BLI_math.h7
-rw-r--r--source/blender/blenlib/BLI_math_base.h7
-rw-r--r--source/blender/blenlib/BLI_math_bits.h7
-rw-r--r--source/blender/blenlib/BLI_math_color.h7
-rw-r--r--source/blender/blenlib/BLI_math_color_blend.h7
-rw-r--r--source/blender/blenlib/BLI_math_geom.h11
-rw-r--r--source/blender/blenlib/BLI_math_inline.h7
-rw-r--r--source/blender/blenlib/BLI_math_interp.h13
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h7
-rw-r--r--source/blender/blenlib/BLI_math_rotation.h53
-rw-r--r--source/blender/blenlib/BLI_math_solvers.h10
-rw-r--r--source/blender/blenlib/BLI_math_statistics.h10
-rw-r--r--source/blender/blenlib/BLI_math_vector.h22
-rw-r--r--source/blender/blenlib/BLI_memarena.h12
-rw-r--r--source/blender/blenlib/BLI_memiter.h8
-rw-r--r--source/blender/blenlib/BLI_memory_utils.h10
-rw-r--r--source/blender/blenlib/BLI_mempool.h12
-rw-r--r--source/blender/blenlib/BLI_noise.h16
-rw-r--r--source/blender/blenlib/BLI_path_util.h12
-rw-r--r--source/blender/blenlib/BLI_polyfill_2d.h8
-rw-r--r--source/blender/blenlib/BLI_polyfill_2d_beautify.h8
-rw-r--r--source/blender/blenlib/BLI_quadric.h10
-rw-r--r--source/blender/blenlib/BLI_rand.h15
-rw-r--r--source/blender/blenlib/BLI_rect.h13
-rw-r--r--source/blender/blenlib/BLI_scanfill.h33
-rw-r--r--source/blender/blenlib/BLI_smallhash.h12
-rw-r--r--source/blender/blenlib/BLI_sort.h13
-rw-r--r--source/blender/blenlib/BLI_sort_utils.h8
-rw-r--r--source/blender/blenlib/BLI_stack.h11
-rw-r--r--source/blender/blenlib/BLI_strict_flags.h6
-rw-r--r--source/blender/blenlib/BLI_string.h16
-rw-r--r--source/blender/blenlib/BLI_string_cursor_utf8.h10
-rw-r--r--source/blender/blenlib/BLI_string_utf8.h16
-rw-r--r--source/blender/blenlib/BLI_string_utils.h12
-rw-r--r--source/blender/blenlib/BLI_sys_types.h13
-rw-r--r--source/blender/blenlib/BLI_system.h8
-rw-r--r--source/blender/blenlib/BLI_task.h10
-rw-r--r--source/blender/blenlib/BLI_threads.h12
-rw-r--r--source/blender/blenlib/BLI_timecode.h11
-rw-r--r--source/blender/blenlib/BLI_timer.h8
-rw-r--r--source/blender/blenlib/BLI_utildefines.h53
-rw-r--r--source/blender/blenlib/BLI_utildefines_iter.h8
-rw-r--r--source/blender/blenlib/BLI_utildefines_stack.h10
-rw-r--r--source/blender/blenlib/BLI_utildefines_variadic.h8
-rw-r--r--source/blender/blenlib/BLI_uvproject.h10
-rw-r--r--source/blender/blenlib/BLI_vfontdata.h14
-rw-r--r--source/blender/blenlib/BLI_voronoi_2d.h28
-rw-r--r--source/blender/blenlib/BLI_voxel.h12
-rw-r--r--source/blender/blenlib/BLI_winstuff.h17
-rw-r--r--source/blender/blenlib/CMakeLists.txt5
-rw-r--r--source/blender/blenlib/PIL_time.h14
-rw-r--r--source/blender/blenlib/PIL_time_utildefines.h15
-rw-r--r--source/blender/blenlib/intern/BLI_args.c14
-rw-r--r--source/blender/blenlib/intern/BLI_array.c15
-rw-r--r--source/blender/blenlib/intern/BLI_dial_2d.c14
-rw-r--r--source/blender/blenlib/intern/BLI_dynstr.c12
-rw-r--r--source/blender/blenlib/intern/BLI_filelist.c14
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c30
-rw-r--r--source/blender/blenlib/intern/BLI_ghash_utils.c16
-rw-r--r--source/blender/blenlib/intern/BLI_heap.c10
-rw-r--r--source/blender/blenlib/intern/BLI_heap_simple.c8
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c87
-rw-r--r--source/blender/blenlib/intern/BLI_kdtree.c23
-rw-r--r--source/blender/blenlib/intern/BLI_linklist.c12
-rw-r--r--source/blender/blenlib/intern/BLI_linklist_lockfree.c10
-rw-r--r--source/blender/blenlib/intern/BLI_memarena.c89
-rw-r--r--source/blender/blenlib/intern/BLI_memiter.c32
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c164
-rw-r--r--source/blender/blenlib/intern/BLI_timer.c14
-rw-r--r--source/blender/blenlib/intern/DLRB_tree.c24
-rw-r--r--source/blender/blenlib/intern/array_store.c26
-rw-r--r--source/blender/blenlib/intern/array_store_utils.c10
-rw-r--r--source/blender/blenlib/intern/array_utils.c10
-rw-r--r--source/blender/blenlib/intern/astar.c22
-rw-r--r--source/blender/blenlib/intern/bitmap.c10
-rw-r--r--source/blender/blenlib/intern/bitmap_draw_2d.c9
-rw-r--r--source/blender/blenlib/intern/boxpack_2d.c10
-rw-r--r--source/blender/blenlib/intern/buffer.c8
-rw-r--r--source/blender/blenlib/intern/callbacks.c10
-rw-r--r--source/blender/blenlib/intern/convexhull_2d.c8
-rw-r--r--source/blender/blenlib/intern/dynlib.c12
-rw-r--r--source/blender/blenlib/intern/easing.c26
-rw-r--r--source/blender/blenlib/intern/edgehash.c8
-rw-r--r--source/blender/blenlib/intern/endian_switch.c10
-rw-r--r--source/blender/blenlib/intern/expr_pylike_eval.c17
-rw-r--r--source/blender/blenlib/intern/fileops.c14
-rw-r--r--source/blender/blenlib/intern/fnmatch.c4
-rw-r--r--source/blender/blenlib/intern/freetypefont.c26
-rw-r--r--source/blender/blenlib/intern/gsqueue.c12
-rw-r--r--source/blender/blenlib/intern/hash_md5.c65
-rw-r--r--source/blender/blenlib/intern/hash_mm2a.c10
-rw-r--r--source/blender/blenlib/intern/hash_mm3.c11
-rw-r--r--source/blender/blenlib/intern/jitter_2d.c14
-rw-r--r--source/blender/blenlib/intern/lasso_2d.c13
-rw-r--r--source/blender/blenlib/intern/list_sort_impl.h8
-rw-r--r--source/blender/blenlib/intern/listbase.c13
-rw-r--r--source/blender/blenlib/intern/math_base.c7
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c7
-rw-r--r--source/blender/blenlib/intern/math_bits_inline.c7
-rw-r--r--source/blender/blenlib/intern/math_color.c11
-rw-r--r--source/blender/blenlib/intern/math_color_blend_inline.c7
-rw-r--r--source/blender/blenlib/intern/math_color_inline.c7
-rw-r--r--source/blender/blenlib/intern/math_geom.c63
-rw-r--r--source/blender/blenlib/intern/math_geom_inline.c7
-rw-r--r--source/blender/blenlib/intern/math_interp.c21
-rw-r--r--source/blender/blenlib/intern/math_matrix.c40
-rw-r--r--source/blender/blenlib/intern/math_rotation.c87
-rw-r--r--source/blender/blenlib/intern/math_solvers.c10
-rw-r--r--source/blender/blenlib/intern/math_statistics.c12
-rw-r--r--source/blender/blenlib/intern/math_vector.c9
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c91
-rw-r--r--source/blender/blenlib/intern/memory_utils.c10
-rw-r--r--source/blender/blenlib/intern/noise.c28
-rw-r--r--source/blender/blenlib/intern/path_util.c42
-rw-r--r--source/blender/blenlib/intern/polyfill_2d.c32
-rw-r--r--source/blender/blenlib/intern/polyfill_2d_beautify.c15
-rw-r--r--source/blender/blenlib/intern/quadric.c10
-rw-r--r--source/blender/blenlib/intern/rand.c20
-rw-r--r--source/blender/blenlib/intern/rct.c16
-rw-r--r--source/blender/blenlib/intern/scanfill.c33
-rw-r--r--source/blender/blenlib/intern/scanfill_utils.c15
-rw-r--r--source/blender/blenlib/intern/smallhash.c15
-rw-r--r--source/blender/blenlib/intern/sort.c13
-rw-r--r--source/blender/blenlib/intern/sort_utils.c8
-rw-r--r--source/blender/blenlib/intern/stack.c11
-rw-r--r--source/blender/blenlib/intern/storage.c13
-rw-r--r--source/blender/blenlib/intern/string.c20
-rw-r--r--source/blender/blenlib/intern/string_cursor_utf8.c11
-rw-r--r--source/blender/blenlib/intern/string_utf8.c29
-rw-r--r--source/blender/blenlib/intern/string_utils.c12
-rw-r--r--source/blender/blenlib/intern/system.c9
-rw-r--r--source/blender/blenlib/intern/task.c27
-rw-r--r--source/blender/blenlib/intern/threads.c42
-rw-r--r--source/blender/blenlib/intern/time.c12
-rw-r--r--source/blender/blenlib/intern/timecode.c17
-rw-r--r--source/blender/blenlib/intern/uvproject.c8
-rw-r--r--source/blender/blenlib/intern/voronoi_2d.c12
-rw-r--r--source/blender/blenlib/intern/voxel.c15
-rw-r--r--source/blender/blenlib/intern/winstuff.c12
-rw-r--r--source/blender/blenlib/intern/winstuff_dir.c10
-rw-r--r--source/blender/blenloader/BLO_blend_defs.h10
-rw-r--r--source/blender/blenloader/BLO_blend_validate.h34
-rw-r--r--source/blender/blenloader/BLO_readfile.h29
-rw-r--r--source/blender/blenloader/BLO_undofile.h12
-rw-r--r--source/blender/blenloader/BLO_writefile.h18
-rw-r--r--source/blender/blenloader/CMakeLists.txt7
-rw-r--r--source/blender/blenloader/intern/blend_validate.c52
-rw-r--r--source/blender/blenloader/intern/readblenentry.c52
-rw-r--r--source/blender/blenloader/intern/readfile.c1953
-rw-r--r--source/blender/blenloader/intern/readfile.h147
-rw-r--r--source/blender/blenloader/intern/undofile.c13
-rw-r--r--source/blender/blenloader/intern/versioning_250.c258
-rw-r--r--source/blender/blenloader/intern/versioning_260.c240
-rw-r--r--source/blender/blenloader/intern/versioning_270.c187
-rw-r--r--source/blender/blenloader/intern/versioning_280.c487
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c126
-rw-r--r--source/blender/blenloader/intern/versioning_dna.c62
-rw-r--r--source/blender/blenloader/intern/versioning_legacy.c323
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c106
-rw-r--r--source/blender/blenloader/intern/writefile.c156
-rw-r--r--source/blender/blentranslation/BLT_lang.h12
-rw-r--r--source/blender/blentranslation/BLT_translation.h16
-rw-r--r--source/blender/blentranslation/CMakeLists.txt3
-rw-r--r--source/blender/blentranslation/intern/blt_lang.c15
-rw-r--r--source/blender/blentranslation/intern/blt_translation.c19
-rw-r--r--source/blender/blentranslation/msgfmt/CMakeLists.txt5
-rw-r--r--source/blender/blentranslation/msgfmt/msgfmt.c6
-rw-r--r--source/blender/bmesh/CMakeLists.txt13
-rw-r--r--source/blender/bmesh/bmesh.h42
-rw-r--r--source/blender/bmesh/bmesh_class.h18
-rw-r--r--source/blender/bmesh/bmesh_tools.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_callback_generic.c8
-rw-r--r--source/blender/bmesh/intern/bmesh_callback_generic.h8
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c22
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c11
-rw-r--r--source/blender/bmesh/intern/bmesh_core.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_delete.c12
-rw-r--r--source/blender/bmesh/intern/bmesh_delete.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_edgeloop.c8
-rw-r--r--source/blender/bmesh/intern/bmesh_edgeloop.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_error.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_inline.h20
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c14
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.c11
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.h13
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators_inline.h11
-rw-r--r--source/blender/bmesh/intern/bmesh_log.c8
-rw-r--r--source/blender/bmesh/intern/bmesh_log.h8
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.c75
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.h13
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c14
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.h12
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c69
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.h19
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_validate.c10
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_validate.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.c10
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c26
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api.h22
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api_inline.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c26
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.h31
-rw-r--r--source/blender/bmesh/intern/bmesh_operators_private.h12
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c31
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.h11
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon_edgenet.c10
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon_edgenet.h8
-rw-r--r--source/blender/bmesh/intern/bmesh_private.h12
-rw-r--r--source/blender/bmesh/intern/bmesh_query.c49
-rw-r--r--source/blender/bmesh/intern/bmesh_query.h13
-rw-r--r--source/blender/bmesh/intern/bmesh_query_inline.h8
-rw-r--r--source/blender/bmesh/intern/bmesh_structure.c42
-rw-r--r--source/blender/bmesh/intern/bmesh_structure.h13
-rw-r--r--source/blender/bmesh/intern/bmesh_structure_inline.h8
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers.c10
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers.h14
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_impl.c12
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_private.h10
-rw-r--r--source/blender/bmesh/operators/bmo_beautify.c10
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c21
-rw-r--r--source/blender/bmesh/operators/bmo_bisect_plane.c10
-rw-r--r--source/blender/bmesh/operators/bmo_bridge.c10
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c10
-rw-r--r--source/blender/bmesh/operators/bmo_connect_concave.c8
-rw-r--r--source/blender/bmesh/operators/bmo_connect_nonplanar.c10
-rw-r--r--source/blender/bmesh/operators/bmo_connect_pair.c11
-rw-r--r--source/blender/bmesh/operators/bmo_create.c10
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c10
-rw-r--r--source/blender/bmesh/operators/bmo_dupe.c24
-rw-r--r--source/blender/bmesh/operators/bmo_edgenet.c10
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c12
-rw-r--r--source/blender/bmesh/operators/bmo_fill_attribute.c11
-rw-r--r--source/blender/bmesh/operators/bmo_fill_edgeloop.c10
-rw-r--r--source/blender/bmesh/operators/bmo_fill_grid.c10
-rw-r--r--source/blender/bmesh/operators/bmo_fill_holes.c10
-rw-r--r--source/blender/bmesh/operators/bmo_hull.c12
-rw-r--r--source/blender/bmesh/operators/bmo_inset.c11
-rw-r--r--source/blender/bmesh/operators/bmo_join_triangles.c10
-rw-r--r--source/blender/bmesh/operators/bmo_mesh_conv.c10
-rw-r--r--source/blender/bmesh/operators/bmo_mirror.c10
-rw-r--r--source/blender/bmesh/operators/bmo_normals.c12
-rw-r--r--source/blender/bmesh/operators/bmo_offset_edgeloops.c10
-rw-r--r--source/blender/bmesh/operators/bmo_planar_faces.c8
-rw-r--r--source/blender/bmesh/operators/bmo_poke.c10
-rw-r--r--source/blender/bmesh/operators/bmo_primitive.c18
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c120
-rw-r--r--source/blender/bmesh/operators/bmo_rotate_edges.c8
-rw-r--r--source/blender/bmesh/operators/bmo_smooth_laplacian.c10
-rw-r--r--source/blender/bmesh/operators/bmo_split_edges.c10
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c10
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide_edgering.c10
-rw-r--r--source/blender/bmesh/operators/bmo_symmetrize.c10
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c10
-rw-r--r--source/blender/bmesh/operators/bmo_unsubdivide.c10
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c10
-rw-r--r--source/blender/bmesh/operators/bmo_wireframe.c10
-rw-r--r--source/blender/bmesh/tools/bmesh_beautify.c10
-rw-r--r--source/blender/bmesh/tools/bmesh_beautify.h10
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c676
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.h13
-rw-r--r--source/blender/bmesh/tools/bmesh_bisect_plane.c10
-rw-r--r--source/blender/bmesh/tools/bmesh_bisect_plane.h10
-rw-r--r--source/blender/bmesh/tools/bmesh_decimate.h10
-rw-r--r--source/blender/bmesh/tools/bmesh_decimate_collapse.c67
-rw-r--r--source/blender/bmesh/tools/bmesh_decimate_dissolve.c10
-rw-r--r--source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c12
-rw-r--r--source/blender/bmesh/tools/bmesh_edgenet.c11
-rw-r--r--source/blender/bmesh/tools/bmesh_edgenet.h10
-rw-r--r--source/blender/bmesh/tools/bmesh_edgesplit.c11
-rw-r--r--source/blender/bmesh/tools/bmesh_edgesplit.h10
-rw-r--r--source/blender/bmesh/tools/bmesh_intersect.c11
-rw-r--r--source/blender/bmesh/tools/bmesh_intersect.h8
-rw-r--r--source/blender/bmesh/tools/bmesh_path.c9
-rw-r--r--source/blender/bmesh/tools/bmesh_path.h10
-rw-r--r--source/blender/bmesh/tools/bmesh_path_region.c8
-rw-r--r--source/blender/bmesh/tools/bmesh_path_region.h8
-rw-r--r--source/blender/bmesh/tools/bmesh_region_match.c8
-rw-r--r--source/blender/bmesh/tools/bmesh_region_match.h8
-rw-r--r--source/blender/bmesh/tools/bmesh_separate.c8
-rw-r--r--source/blender/bmesh/tools/bmesh_separate.h8
-rw-r--r--source/blender/bmesh/tools/bmesh_triangulate.c11
-rw-r--r--source/blender/bmesh/tools/bmesh_triangulate.h11
-rw-r--r--source/blender/bmesh/tools/bmesh_wireframe.c10
-rw-r--r--source/blender/bmesh/tools/bmesh_wireframe.h11
-rw-r--r--source/blender/collada/AnimationClipExporter.cpp34
-rw-r--r--source/blender/collada/AnimationClipExporter.h6
-rw-r--r--source/blender/collada/AnimationExporter.cpp41
-rw-r--r--source/blender/collada/AnimationExporter.h8
-rw-r--r--source/blender/collada/AnimationImporter.cpp16
-rw-r--r--source/blender/collada/AnimationImporter.h20
-rw-r--r--source/blender/collada/ArmatureExporter.cpp13
-rw-r--r--source/blender/collada/ArmatureExporter.h11
-rw-r--r--source/blender/collada/ArmatureImporter.cpp10
-rw-r--r--source/blender/collada/ArmatureImporter.h10
-rw-r--r--source/blender/collada/BCAnimationCurve.cpp50
-rw-r--r--source/blender/collada/BCAnimationCurve.h40
-rw-r--r--source/blender/collada/BCAnimationSampler.cpp56
-rw-r--r--source/blender/collada/BCAnimationSampler.h83
-rw-r--r--source/blender/collada/BCSampleData.cpp40
-rw-r--r--source/blender/collada/BCSampleData.h42
-rw-r--r--source/blender/collada/BlenderContext.cpp12
-rw-r--r--source/blender/collada/BlenderContext.h12
-rw-r--r--source/blender/collada/CMakeLists.txt29
-rw-r--r--source/blender/collada/CameraExporter.cpp21
-rw-r--r--source/blender/collada/CameraExporter.h11
-rw-r--r--source/blender/collada/ControllerExporter.cpp11
-rw-r--r--source/blender/collada/ControllerExporter.h11
-rw-r--r--source/blender/collada/DocumentExporter.cpp18
-rw-r--r--source/blender/collada/DocumentExporter.h10
-rw-r--r--source/blender/collada/DocumentImporter.cpp46
-rw-r--r--source/blender/collada/DocumentImporter.h14
-rw-r--r--source/blender/collada/EffectExporter.cpp34
-rw-r--r--source/blender/collada/EffectExporter.h13
-rw-r--r--source/blender/collada/ErrorHandler.cpp10
-rw-r--r--source/blender/collada/ErrorHandler.h10
-rw-r--r--source/blender/collada/ExportSettings.cpp10
-rw-r--r--source/blender/collada/ExportSettings.h11
-rw-r--r--source/blender/collada/ExtraHandler.cpp10
-rw-r--r--source/blender/collada/ExtraHandler.h10
-rw-r--r--source/blender/collada/ExtraTags.cpp10
-rw-r--r--source/blender/collada/ExtraTags.h10
-rw-r--r--source/blender/collada/GeometryExporter.cpp142
-rw-r--r--source/blender/collada/GeometryExporter.h13
-rw-r--r--source/blender/collada/ImageExporter.cpp11
-rw-r--r--source/blender/collada/ImageExporter.h11
-rw-r--r--source/blender/collada/ImportSettings.cpp10
-rw-r--r--source/blender/collada/ImportSettings.h10
-rw-r--r--source/blender/collada/InstanceWriter.cpp11
-rw-r--r--source/blender/collada/InstanceWriter.h11
-rw-r--r--source/blender/collada/LightExporter.cpp21
-rw-r--r--source/blender/collada/LightExporter.h15
-rw-r--r--source/blender/collada/MaterialExporter.cpp13
-rw-r--r--source/blender/collada/MaterialExporter.h11
-rw-r--r--source/blender/collada/Materials.cpp46
-rw-r--r--source/blender/collada/Materials.h8
-rw-r--r--source/blender/collada/MeshImporter.cpp25
-rw-r--r--source/blender/collada/MeshImporter.h10
-rw-r--r--source/blender/collada/SceneExporter.cpp14
-rw-r--r--source/blender/collada/SceneExporter.h10
-rw-r--r--source/blender/collada/SkinInfo.cpp10
-rw-r--r--source/blender/collada/SkinInfo.h10
-rw-r--r--source/blender/collada/TransformReader.cpp10
-rw-r--r--source/blender/collada/TransformReader.h10
-rw-r--r--source/blender/collada/TransformWriter.cpp19
-rw-r--r--source/blender/collada/TransformWriter.h11
-rw-r--r--source/blender/collada/collada.cpp10
-rw-r--r--source/blender/collada/collada.h12
-rw-r--r--source/blender/collada/collada_internal.cpp14
-rw-r--r--source/blender/collada/collada_internal.h12
-rw-r--r--source/blender/collada/collada_utils.cpp90
-rw-r--r--source/blender/collada/collada_utils.h22
-rw-r--r--source/blender/compositor/CMakeLists.txt447
-rw-r--r--source/blender/compositor/COM_compositor.h8
-rw-r--r--source/blender/compositor/COM_defines.h14
-rw-r--r--source/blender/compositor/intern/COM_CPUDevice.cpp6
-rw-r--r--source/blender/compositor/intern/COM_CPUDevice.h6
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrder.cpp6
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrder.h6
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp6
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrderHotspot.h6
-rw-r--r--source/blender/compositor/intern/COM_CompositorContext.cpp6
-rw-r--r--source/blender/compositor/intern/COM_CompositorContext.h6
-rw-r--r--source/blender/compositor/intern/COM_Converter.cpp6
-rw-r--r--source/blender/compositor/intern/COM_Converter.h6
-rw-r--r--source/blender/compositor/intern/COM_Debug.cpp5
-rw-r--r--source/blender/compositor/intern/COM_Debug.h5
-rw-r--r--source/blender/compositor/intern/COM_Device.cpp6
-rw-r--r--source/blender/compositor/intern/COM_Device.h6
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cpp6
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.h8
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp6
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.h6
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cpp6
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.h8
-rw-r--r--source/blender/compositor/intern/COM_MemoryProxy.cpp6
-rw-r--r--source/blender/compositor/intern/COM_MemoryProxy.h6
-rw-r--r--source/blender/compositor/intern/COM_Node.cpp6
-rw-r--r--source/blender/compositor/intern/COM_Node.h6
-rw-r--r--source/blender/compositor/intern/COM_NodeConverter.cpp5
-rw-r--r--source/blender/compositor/intern/COM_NodeConverter.h5
-rw-r--r--source/blender/compositor/intern/COM_NodeGraph.cpp5
-rw-r--r--source/blender/compositor/intern/COM_NodeGraph.h5
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.cpp6
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.h8
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.cpp5
-rw-r--r--source/blender/compositor/intern/COM_NodeOperationBuilder.h5
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.cpp12
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.h6
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedOperation.cpp6
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedOperation.h6
-rw-r--r--source/blender/compositor/intern/COM_SocketReader.cpp6
-rw-r--r--source/blender/compositor/intern/COM_SocketReader.h8
-rw-r--r--source/blender/compositor/intern/COM_WorkPackage.cpp6
-rw-r--r--source/blender/compositor/intern/COM_WorkPackage.h6
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.cpp6
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.h6
-rw-r--r--source/blender/compositor/intern/COM_compositor.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_AlphaOverNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_AlphaOverNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_BilateralBlurNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_BilateralBlurNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_BlurNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_BlurNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_BokehBlurNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_BokehBlurNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_BokehImageNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_BokehImageNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_BoxMaskNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_BoxMaskNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_BrightnessNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_BrightnessNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ChannelMatteNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_ChannelMatteNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_ChromaMatteNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_ChromaMatteNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_ColorBalanceNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ColorBalanceNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ColorCorrectionNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ColorCurveNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ColorCurveNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ColorMatteNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_ColorMatteNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_ColorNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ColorNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ColorRampNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ColorRampNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ColorSpillNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ColorSpillNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ColorToBWNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ColorToBWNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_CombineColorNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_CombineColorNode.h7
-rw-r--r--source/blender/compositor/nodes/COM_CompositorNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_CompositorNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_ConvertAlphaNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_CornerPinNode.cpp8
-rw-r--r--source/blender/compositor/nodes/COM_CornerPinNode.h8
-rw-r--r--source/blender/compositor/nodes/COM_CropNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_CropNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_CryptomatteNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_CryptomatteNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_DefocusNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_DefocusNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_DespeckleNode.cpp4
-rw-r--r--source/blender/compositor/nodes/COM_DespeckleNode.h4
-rw-r--r--source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_DifferenceMatteNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_DilateErodeNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_DilateErodeNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_DirectionalBlurNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_DisplaceNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_DisplaceNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_DistanceMatteNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_DistanceMatteNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_EllipseMaskNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_EllipseMaskNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_FilterNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_FilterNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_FlipNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_FlipNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_GammaNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_GammaNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_GlareNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_GlareNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_IDMaskNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_IDMaskNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ImageNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_ImageNode.h7
-rw-r--r--source/blender/compositor/nodes/COM_InpaintNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_InpaintNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_InvertNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_InvertNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_KeyingNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_KeyingNode.h7
-rw-r--r--source/blender/compositor/nodes/COM_KeyingScreenNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_KeyingScreenNode.h7
-rw-r--r--source/blender/compositor/nodes/COM_LensDistortionNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_LensDistortionNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_LuminanceMatteNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_MapRangeNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_MapRangeNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_MapUVNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_MapUVNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_MapValueNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_MapValueNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_MaskNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_MaskNode.h7
-rw-r--r--source/blender/compositor/nodes/COM_MathNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_MathNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_MixNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_MixNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_MovieClipNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_MovieClipNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_MovieDistortionNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_MovieDistortionNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_NormalNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_NormalNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_NormalizeNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_NormalizeNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_OutputFileNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_OutputFileNode.h7
-rw-r--r--source/blender/compositor/nodes/COM_PixelateNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_PixelateNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_RenderLayersNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_RenderLayersNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_RotateNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_RotateNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ScaleNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ScaleNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_SeparateColorNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_SeparateColorNode.h7
-rw-r--r--source/blender/compositor/nodes/COM_SetAlphaNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_SetAlphaNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_SocketProxyNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_SocketProxyNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_SplitViewerNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_SplitViewerNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_Stabilize2dNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_Stabilize2dNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_SunBeamsNode.cpp8
-rw-r--r--source/blender/compositor/nodes/COM_SunBeamsNode.h8
-rw-r--r--source/blender/compositor/nodes/COM_SwitchNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_SwitchNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_SwitchViewNode.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_SwitchViewNode.h5
-rw-r--r--source/blender/compositor/nodes/COM_TextureNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_TextureNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_TimeNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_TimeNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_TonemapNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_TonemapNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_TrackPositionNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_TrackPositionNode.h7
-rw-r--r--source/blender/compositor/nodes/COM_TransformNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_TransformNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_TranslateNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_TranslateNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ValueNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ValueNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_VectorBlurNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_VectorBlurNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_VectorCurveNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_VectorCurveNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ViewLevelsNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ViewLevelsNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ViewerNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ViewerNode.h6
-rw-r--r--source/blender/compositor/nodes/COM_ZCombineNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_ZCombineNode.h6
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverKeyOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverMixedOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_AntiAliasOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_AntiAliasOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_BilateralBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_BilateralBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_BokehBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_BokehBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_BokehImageOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_BokehImageOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_BoxMaskOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_BoxMaskOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_BrightnessOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_BrightnessOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_CalculateMeanOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_CalculateMeanOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ChangeHSVOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ChangeHSVOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ChannelMatteOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_ChannelMatteOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_ChromaMatteOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_ChromaMatteOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorCorrectionOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ColorCurveOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorCurveOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ColorMatteOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_ColorMatteOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_ColorRampOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorRampOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ColorSpillOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_ColorSpillOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ConvertColorProfileOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_ConvertOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ConvertOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionFilterOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_CropOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_CropOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_CryptomatteOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_CryptomatteOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_CurveBaseOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_CurveBaseOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_DespeckleOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_DespeckleOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_DifferenceMatteOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_DilateErodeOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_DilateErodeOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_DirectionalBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_DisplaceOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_DisplaceOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_DisplaceSimpleOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_DotproductOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_DotproductOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp31
-rw-r--r--source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_EllipseMaskOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_EllipseMaskOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_FlipOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_FlipOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GammaCorrectOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GammaCorrectOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GammaOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GammaOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GaussianYBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GlareBaseOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GlareBaseOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GlareFogGlowOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GlareGhostOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GlareGhostOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GlareSimpleStarOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GlareStreaksOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GlareStreaksOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_GlareThresholdOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GlareThresholdOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_IDMaskOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_IDMaskOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ImageOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ImageOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_InpaintOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_InpaintOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_InvertOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_InvertOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_KeyingBlurOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_KeyingBlurOperation.h9
-rw-r--r--source/blender/compositor/operations/COM_KeyingClipOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_KeyingClipOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_KeyingDespillOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_KeyingDespillOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_KeyingOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_KeyingOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_KeyingScreenOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_KeyingScreenOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_LuminanceMatteOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_MapRangeOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MapRangeOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_MapUVOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_MapUVOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_MapValueOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MapValueOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_MixOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MixOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MovieClipAttributeOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_MovieClipOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MovieClipOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_MovieDistortionOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_MovieDistortionOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_MultilayerImageOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_MultilayerImageOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_NormalizeOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_NormalizeOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_PixelateOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_PixelateOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_PlaneCornerPinOperation.h9
-rw-r--r--source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_PlaneTrackOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_PlaneTrackOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_QualityStepHelper.cpp6
-rw-r--r--source/blender/compositor/operations/COM_QualityStepHelper.h6
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersProg.cpp6
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersProg.h6
-rw-r--r--source/blender/compositor/operations/COM_RotateOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_RotateOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_SetAlphaOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_SetAlphaOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_SetColorOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_SetColorOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_SetSamplerOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_SetSamplerOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_SetValueOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_SetValueOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_SetVectorOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_SetVectorOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_SocketProxyOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_SocketProxyOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_SplitOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_SplitOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_SunBeamsOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_SunBeamsOperation.h8
-rw-r--r--source/blender/compositor/operations/COM_TextureOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_TextureOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_TonemapOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_TonemapOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_TrackPositionOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_TrackPositionOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_VectorBlurOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_VectorBlurOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_VectorCurveOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_VectorCurveOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_WrapOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_WrapOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_WriteBufferOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_WriteBufferOperation.h6
-rw-r--r--source/blender/compositor/operations/COM_ZCombineOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ZCombineOperation.h6
-rw-r--r--source/blender/datatoc/CMakeLists.txt3
-rw-r--r--source/blender/datatoc/datatoc.c12
-rw-r--r--source/blender/datatoc/datatoc_icon.c12
-rw-r--r--source/blender/depsgraph/CMakeLists.txt44
-rw-r--r--source/blender/depsgraph/DEG_depsgraph.h20
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_build.h44
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_debug.h11
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_physics.h13
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_query.h29
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder.cc156
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder.h26
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_cycle.cc69
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_cycle.h10
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_map.cc11
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_map.h17
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc775
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.h178
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc177
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc75
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc14
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h14
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc1442
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h234
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h124
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc82
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc231
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc42
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_rna.cc368
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_rna.h98
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_transitive.cc48
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_transitive.h11
-rw-r--r--source/blender/depsgraph/intern/debug/deg_debug.cc60
-rw-r--r--source/blender/depsgraph/intern/debug/deg_debug.h59
-rw-r--r--source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc242
-rw-r--r--source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc23
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc570
-rw-r--r--source/blender/depsgraph/intern/depsgraph.h139
-rw-r--r--source/blender/depsgraph/intern/depsgraph_build.cc109
-rw-r--r--source/blender/depsgraph/intern/depsgraph_debug.cc225
-rw-r--r--source/blender/depsgraph/intern/depsgraph_eval.cc21
-rw-r--r--source/blender/depsgraph/intern/depsgraph_intern.h153
-rw-r--r--source/blender/depsgraph/intern/depsgraph_physics.cc41
-rw-r--r--source/blender/depsgraph/intern/depsgraph_physics.h39
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query.cc55
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_filter.cc62
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_foreach.cc82
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_iter.cc38
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc453
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.h46
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type.cc63
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type.h165
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type_defines.cc217
-rw-r--r--source/blender/depsgraph/intern/depsgraph_types.h325
-rw-r--r--source/blender/depsgraph/intern/depsgraph_update.cc58
-rw-r--r--source/blender/depsgraph/intern/depsgraph_update.h (renamed from source/blender/depsgraph/util/deg_util_function.h)26
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval.cc90
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval.h11
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc291
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h19
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_flush.cc104
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_flush.h11
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_stats.cc36
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_stats.h11
-rw-r--r--source/blender/depsgraph/intern/node/deg_node.cc180
-rw-r--r--source/blender/depsgraph/intern/node/deg_node.h194
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_component.cc (renamed from source/blender/depsgraph/intern/nodes/deg_node_component.cc)192
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_component.h (renamed from source/blender/depsgraph/intern/nodes/deg_node_component.h)112
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_factory.cc46
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_factory.h66
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_factory_impl.h66
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_id.cc (renamed from source/blender/depsgraph/intern/nodes/deg_node_id.cc)108
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_id.h (renamed from source/blender/depsgraph/intern/nodes/deg_node_id.h)52
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_operation.cc209
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_operation.h254
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_time.cc (renamed from source/blender/depsgraph/intern/nodes/deg_node_time.cc)25
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_time.h (renamed from source/blender/depsgraph/intern/nodes/deg_node_time.h)17
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node.cc137
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node.h118
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_operation.cc116
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_operation.h101
-rw-r--r--source/blender/draw/CMakeLists.txt34
-rw-r--r--source/blender/draw/DRW_engine.h38
-rw-r--r--source/blender/draw/engines/basic/basic_engine.c47
-rw-r--r--source/blender/draw/engines/basic/basic_engine.h9
-rw-r--r--source/blender/draw/engines/eevee/eevee_bloom.c16
-rw-r--r--source/blender/draw/engines/eevee/eevee_data.c29
-rw-r--r--source/blender/draw/engines/eevee/eevee_depth_of_field.c30
-rw-r--r--source/blender/draw/engines/eevee/eevee_effects.c13
-rw-r--r--source/blender/draw/engines/eevee/eevee_engine.c53
-rw-r--r--source/blender/draw/engines/eevee/eevee_engine.h9
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.c23
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.h19
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c39
-rw-r--r--source/blender/draw/engines/eevee/eevee_lights.c120
-rw-r--r--source/blender/draw/engines/eevee/eevee_lookdev.c15
-rw-r--r--source/blender/draw/engines/eevee/eevee_lut.h16
-rw-r--r--source/blender/draw/engines/eevee/eevee_materials.c72
-rw-r--r--source/blender/draw/engines/eevee/eevee_mist.c9
-rw-r--r--source/blender/draw/engines/eevee/eevee_motion_blur.c13
-rw-r--r--source/blender/draw/engines/eevee/eevee_occlusion.c10
-rw-r--r--source/blender/draw/engines/eevee/eevee_private.h51
-rw-r--r--source/blender/draw/engines/eevee/eevee_render.c19
-rw-r--r--source/blender/draw/engines/eevee/eevee_screen_raytrace.c11
-rw-r--r--source/blender/draw/engines/eevee/eevee_shaders.c10
-rw-r--r--source/blender/draw/engines/eevee/eevee_subsurface.c14
-rw-r--r--source/blender/draw/engines/eevee/eevee_temporal_sampling.c10
-rw-r--r--source/blender/draw/engines/eevee/eevee_volumes.c41
-rw-r--r--source/blender/draw/engines/eevee/shaders/background_vert.glsl4
-rw-r--r--source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl16
-rw-r--r--source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl2
-rw-r--r--source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl8
-rw-r--r--source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl9
-rw-r--r--source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl15
-rw-r--r--source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_frag.glsl3
-rw-r--r--source/blender/draw/engines/eevee/shaders/lightprobe_geom.glsl4
-rw-r--r--source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_frag.glsl3
-rw-r--r--source/blender/draw/engines/eevee/shaders/lights_lib.glsl (renamed from source/blender/draw/engines/eevee/shaders/lamps_lib.glsl)5
-rw-r--r--source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl13
-rw-r--r--source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl6
-rw-r--r--source/blender/draw/engines/eevee/shaders/ltc_lib.glsl9
-rw-r--r--source/blender/draw/engines/eevee/shaders/prepass_frag.glsl6
-rw-r--r--source/blender/draw/engines/eevee/shaders/shadow_vert.glsl6
-rw-r--r--source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl24
-rw-r--r--source/blender/draw/engines/external/external_engine.c27
-rw-r--r--source/blender/draw/engines/external/external_engine.h9
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_cache_utils.c63
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c50
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c387
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c198
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.h55
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_render.c79
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_shader_fx.c94
-rw-r--r--source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl4
-rw-r--r--source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl3
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl6
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl47
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl5
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl4
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl24
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl24
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl59
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl24
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl41
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl15
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl16
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl365
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_forward_composite_frag.glsl15
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl17
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl6
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl6
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl14
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl2
-rw-r--r--source/blender/draw/engines/workbench/solid_mode.c9
-rw-r--r--source/blender/draw/engines/workbench/transparent_mode.c9
-rw-r--r--source/blender/draw/engines/workbench/workbench_data.c80
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c217
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_aa.c11
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_dof.c434
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_fxaa.c9
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_taa.c11
-rw-r--r--source/blender/draw/engines/workbench/workbench_engine.c11
-rw-r--r--source/blender/draw/engines/workbench/workbench_engine.h9
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c161
-rw-r--r--source/blender/draw/engines/workbench/workbench_materials.c78
-rw-r--r--source/blender/draw/engines/workbench/workbench_private.h93
-rw-r--r--source/blender/draw/engines/workbench/workbench_render.c9
-rw-r--r--source/blender/draw/engines/workbench/workbench_studiolight.c13
-rw-r--r--source/blender/draw/engines/workbench/workbench_volume.c16
-rw-r--r--source/blender/draw/intern/DRW_render.h97
-rw-r--r--source/blender/draw/intern/draw_anim_viz.c106
-rw-r--r--source/blender/draw/intern/draw_armature.c265
-rw-r--r--source/blender/draw/intern/draw_cache.c207
-rw-r--r--source/blender/draw/intern/draw_cache.h32
-rw-r--r--source/blender/draw/intern/draw_cache_impl.h98
-rw-r--r--source/blender/draw/intern/draw_cache_impl_curve.c105
-rw-r--r--source/blender/draw/intern/draw_cache_impl_displist.c117
-rw-r--r--source/blender/draw/intern/draw_cache_impl_lattice.c15
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c3798
-rw-r--r--source/blender/draw/intern/draw_cache_impl_metaball.c27
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c19
-rw-r--r--source/blender/draw/intern/draw_common.c722
-rw-r--r--source/blender/draw/intern/draw_common.h85
-rw-r--r--source/blender/draw/intern/draw_debug.c10
-rw-r--r--source/blender/draw/intern/draw_debug.h9
-rw-r--r--source/blender/draw/intern/draw_hair.c140
-rw-r--r--source/blender/draw/intern/draw_hair_private.h14
-rw-r--r--source/blender/draw/intern/draw_instance_data.c40
-rw-r--r--source/blender/draw/intern/draw_instance_data.h11
-rw-r--r--source/blender/draw/intern/draw_manager.c206
-rw-r--r--source/blender/draw/intern/draw_manager.h46
-rw-r--r--source/blender/draw/intern/draw_manager_data.c205
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c137
-rw-r--r--source/blender/draw/intern/draw_manager_profiling.c12
-rw-r--r--source/blender/draw/intern/draw_manager_profiling.h9
-rw-r--r--source/blender/draw/intern/draw_manager_shader.c23
-rw-r--r--source/blender/draw/intern/draw_manager_text.c30
-rw-r--r--source/blender/draw/intern/draw_manager_text.h7
-rw-r--r--source/blender/draw/intern/draw_manager_texture.c27
-rw-r--r--source/blender/draw/intern/draw_view.c73
-rw-r--r--source/blender/draw/intern/draw_view.h11
-rw-r--r--source/blender/draw/modes/draw_mode_engines.h10
-rw-r--r--source/blender/draw/modes/edit_armature_mode.c48
-rw-r--r--source/blender/draw/modes/edit_curve_mode.c113
-rw-r--r--source/blender/draw/modes/edit_lattice_mode.c88
-rw-r--r--source/blender/draw/modes/edit_mesh_mode.c610
-rw-r--r--source/blender/draw/modes/edit_mesh_mode_intern.h8
-rw-r--r--source/blender/draw/modes/edit_mesh_mode_text.c14
-rw-r--r--source/blender/draw/modes/edit_metaball_mode.c43
-rw-r--r--source/blender/draw/modes/edit_text_mode.c27
-rw-r--r--source/blender/draw/modes/object_mode.c1195
-rw-r--r--source/blender/draw/modes/overlay_mode.c364
-rw-r--r--source/blender/draw/modes/paint_texture_mode.c40
-rw-r--r--source/blender/draw/modes/paint_vertex_mode.c265
-rw-r--r--source/blender/draw/modes/paint_weight_mode.c248
-rw-r--r--source/blender/draw/modes/particle_mode.c24
-rw-r--r--source/blender/draw/modes/pose_mode.c50
-rw-r--r--source/blender/draw/modes/sculpt_mode.c70
-rw-r--r--source/blender/draw/modes/shaders/animviz_mpath_points_vert.glsl5
-rw-r--r--source/blender/draw/modes/shaders/armature_axes_vert.glsl4
-rw-r--r--source/blender/draw/modes/shaders/armature_dof_vert.glsl4
-rw-r--r--source/blender/draw/modes/shaders/armature_envelope_outline_vert.glsl4
-rw-r--r--source/blender/draw/modes/shaders/armature_envelope_solid_vert.glsl4
-rw-r--r--source/blender/draw/modes/shaders/armature_shape_outline_geom.glsl21
-rw-r--r--source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl13
-rw-r--r--source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl12
-rw-r--r--source/blender/draw/modes/shaders/armature_sphere_outline_vert.glsl9
-rw-r--r--source/blender/draw/modes/shaders/armature_sphere_solid_vert.glsl12
-rw-r--r--source/blender/draw/modes/shaders/armature_stick_vert.glsl15
-rw-r--r--source/blender/draw/modes/shaders/common_globals_lib.glsl32
-rw-r--r--source/blender/draw/modes/shaders/common_hair_lib.glsl2
-rw-r--r--source/blender/draw/modes/shaders/common_hair_refine_vert.glsl22
-rw-r--r--source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl18
-rw-r--r--source/blender/draw/modes/shaders/edit_curve_overlay_handle_vert.glsl10
-rw-r--r--source/blender/draw/modes/shaders/edit_curve_overlay_loosevert_vert.glsl16
-rw-r--r--source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl10
-rw-r--r--source/blender/draw/modes/shaders/edit_lattice_overlay_frag.glsl7
-rw-r--r--source/blender/draw/modes/shaders/edit_lattice_overlay_loosevert_vert.glsl6
-rw-r--r--source/blender/draw/modes/shaders/edit_mesh_overlay_common_lib.glsl75
-rw-r--r--source/blender/draw/modes/shaders/edit_mesh_overlay_facedot_frag.glsl19
-rw-r--r--source/blender/draw/modes/shaders/edit_mesh_overlay_facedot_vert.glsl31
-rw-r--r--source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl18
-rw-r--r--source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl164
-rw-r--r--source/blender/draw/modes/shaders/edit_mesh_overlay_geom.glsl60
-rw-r--r--source/blender/draw/modes/shaders/edit_mesh_overlay_geom_edge.glsl119
-rw-r--r--source/blender/draw/modes/shaders/edit_mesh_overlay_geom_tri.glsl211
-rw-r--r--source/blender/draw/modes/shaders/edit_mesh_overlay_points_vert.glsl51
-rw-r--r--source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl150
-rw-r--r--source/blender/draw/modes/shaders/edit_normals_geom.glsl11
-rw-r--r--source/blender/draw/modes/shaders/edit_normals_vert.glsl4
-rw-r--r--source/blender/draw/modes/shaders/object_empty_axes_vert.glsl13
-rw-r--r--source/blender/draw/modes/shaders/object_empty_image_vert.glsl10
-rw-r--r--source/blender/draw/modes/shaders/object_grid_frag.glsl57
-rw-r--r--source/blender/draw/modes/shaders/object_grid_vert.glsl28
-rw-r--r--source/blender/draw/modes/shaders/object_mball_handles_vert.glsl9
-rw-r--r--source/blender/draw/modes/shaders/object_outline_detect_frag.glsl5
-rw-r--r--source/blender/draw/modes/shaders/object_outline_expand_frag.glsl14
-rw-r--r--source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl19
-rw-r--r--source/blender/draw/modes/shaders/object_outline_prepass_vert.glsl5
-rw-r--r--source/blender/draw/modes/shaders/object_particle_prim_vert.glsl9
-rw-r--r--source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl6
-rw-r--r--source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl38
-rw-r--r--source/blender/draw/modes/shaders/overlay_face_wireframe_geom.glsl92
-rw-r--r--source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl81
-rw-r--r--source/blender/draw/modes/shaders/paint_face_vert.glsl6
-rw-r--r--source/blender/draw/modes/shaders/paint_texture_frag.glsl8
-rw-r--r--source/blender/draw/modes/shaders/paint_texture_vert.glsl5
-rw-r--r--source/blender/draw/modes/shaders/paint_vert_frag.glsl5
-rw-r--r--source/blender/draw/modes/shaders/paint_vertex_frag.glsl4
-rw-r--r--source/blender/draw/modes/shaders/paint_vertex_vert.glsl9
-rw-r--r--source/blender/draw/modes/shaders/paint_weight_frag.glsl9
-rw-r--r--source/blender/draw/modes/shaders/paint_weight_vert.glsl5
-rw-r--r--source/blender/draw/modes/shaders/paint_wire_vert.glsl22
-rw-r--r--source/blender/draw/modes/shaders/sculpt_mask_vert.glsl4
-rw-r--r--source/blender/editors/CMakeLists.txt3
-rw-r--r--source/blender/editors/animation/CMakeLists.txt3
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c81
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c91
-rw-r--r--source/blender/editors/animation/anim_deps.c66
-rw-r--r--source/blender/editors/animation/anim_draw.c21
-rw-r--r--source/blender/editors/animation/anim_filter.c173
-rw-r--r--source/blender/editors/animation/anim_intern.h10
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c11
-rw-r--r--source/blender/editors/animation/anim_markers.c152
-rw-r--r--source/blender/editors/animation/anim_ops.c15
-rw-r--r--source/blender/editors/animation/drivers.c17
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c82
-rw-r--r--source/blender/editors/animation/keyframes_draw.c22
-rw-r--r--source/blender/editors/animation/keyframes_edit.c51
-rw-r--r--source/blender/editors/animation/keyframes_general.c19
-rw-r--r--source/blender/editors/animation/keyframing.c508
-rw-r--r--source/blender/editors/animation/keyingsets.c17
-rw-r--r--source/blender/editors/armature/CMakeLists.txt5
-rw-r--r--source/blender/editors/armature/armature_add.c22
-rw-r--r--source/blender/editors/armature/armature_edit.c19
-rw-r--r--source/blender/editors/armature/armature_intern.h47
-rw-r--r--source/blender/editors/armature/armature_naming.c20
-rw-r--r--source/blender/editors/armature/armature_ops.c11
-rw-r--r--source/blender/editors/armature/armature_relations.c31
-rw-r--r--source/blender/editors/armature/armature_select.c26
-rw-r--r--source/blender/editors/armature/armature_skinning.c14
-rw-r--r--source/blender/editors/armature/armature_utils.c21
-rw-r--r--source/blender/editors/armature/editarmature_undo.c29
-rw-r--r--source/blender/editors/armature/meshlaplacian.c22
-rw-r--r--source/blender/editors/armature/meshlaplacian.h9
-rw-r--r--source/blender/editors/armature/pose_edit.c245
-rw-r--r--source/blender/editors/armature/pose_group.c13
-rw-r--r--source/blender/editors/armature/pose_lib.c97
-rw-r--r--source/blender/editors/armature/pose_select.c20
-rw-r--r--source/blender/editors/armature/pose_slide.c78
-rw-r--r--source/blender/editors/armature/pose_transform.c36
-rw-r--r--source/blender/editors/armature/pose_utils.c14
-rw-r--r--source/blender/editors/curve/CMakeLists.txt3
-rw-r--r--source/blender/editors/curve/curve_intern.h15
-rw-r--r--source/blender/editors/curve/curve_ops.c11
-rw-r--r--source/blender/editors/curve/editcurve.c153
-rw-r--r--source/blender/editors/curve/editcurve_add.c18
-rw-r--r--source/blender/editors/curve/editcurve_paint.c13
-rw-r--r--source/blender/editors/curve/editcurve_select.c17
-rw-r--r--source/blender/editors/curve/editcurve_undo.c34
-rw-r--r--source/blender/editors/curve/editfont.c21
-rw-r--r--source/blender/editors/curve/editfont_undo.c13
-rw-r--r--source/blender/editors/datafiles/CMakeLists.txt6
-rw-r--r--source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c8
-rw-r--r--source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c10
-rw-r--r--source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c8
-rw-r--r--source/blender/editors/gizmo_library/gizmo_draw_utils.c14
-rw-r--r--source/blender/editors/gizmo_library/gizmo_geometry.h8
-rw-r--r--source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c8
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_intern.h10
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_presets.c10
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_utils.c11
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c13
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c17
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/blank3d_gizmo.c11
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c13
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c27
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c19
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c14
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c15
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c11
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c8
-rw-r--r--source/blender/editors/gpencil/CMakeLists.txt13
-rw-r--r--source/blender/editors/gpencil/annotate_draw.c46
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c285
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c78
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c10
-rw-r--r--source/blender/editors/gpencil/gpencil_add_monkey.c1560
-rw-r--r--source/blender/editors/gpencil/gpencil_add_stroke.c15
-rw-r--r--source/blender/editors/gpencil/gpencil_armature.c17
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c20
-rw-r--r--source/blender/editors/gpencil/gpencil_convert.c23
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c44
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c883
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c126
-rw-r--r--source/blender/editors/gpencil/gpencil_intern.h223
-rw-r--r--source/blender/editors/gpencil/gpencil_interpolate.c16
-rw-r--r--source/blender/editors/gpencil/gpencil_merge.c18
-rw-r--r--source/blender/editors/gpencil/gpencil_old.c26
-rw-r--r--source/blender/editors/gpencil/gpencil_ops.c41
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c892
-rw-r--r--source/blender/editors/gpencil/gpencil_primitive.c155
-rw-r--r--source/blender/editors/gpencil/gpencil_select.c161
-rw-r--r--source/blender/editors/gpencil/gpencil_undo.c13
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c606
-rw-r--r--source/blender/editors/include/BIF_gl.h12
-rw-r--r--source/blender/editors/include/BIF_glutil.h17
-rw-r--r--source/blender/editors/include/ED_anim_api.h254
-rw-r--r--source/blender/editors/include/ED_armature.h80
-rw-r--r--source/blender/editors/include/ED_buttons.h8
-rw-r--r--source/blender/editors/include/ED_clip.h19
-rw-r--r--source/blender/editors/include/ED_curve.h21
-rw-r--r--source/blender/editors/include/ED_datafiles.h11
-rw-r--r--source/blender/editors/include/ED_fileselect.h17
-rw-r--r--source/blender/editors/include/ED_gizmo_library.h10
-rw-r--r--source/blender/editors/include/ED_gizmo_utils.h8
-rw-r--r--source/blender/editors/include/ED_gpencil.h49
-rw-r--r--source/blender/editors/include/ED_image.h24
-rw-r--r--source/blender/editors/include/ED_info.h12
-rw-r--r--source/blender/editors/include/ED_keyframes_draw.h49
-rw-r--r--source/blender/editors/include/ED_keyframes_edit.h57
-rw-r--r--source/blender/editors/include/ED_keyframing.h55
-rw-r--r--source/blender/editors/include/ED_lattice.h14
-rw-r--r--source/blender/editors/include/ED_logic.h10
-rw-r--r--source/blender/editors/include/ED_markers.h21
-rw-r--r--source/blender/editors/include/ED_mask.h17
-rw-r--r--source/blender/editors/include/ED_mball.h15
-rw-r--r--source/blender/editors/include/ED_mesh.h65
-rw-r--r--source/blender/editors/include/ED_node.h24
-rw-r--r--source/blender/editors/include/ED_numinput.h42
-rw-r--r--source/blender/editors/include/ED_object.h42
-rw-r--r--source/blender/editors/include/ED_outliner.h10
-rw-r--r--source/blender/editors/include/ED_paint.h16
-rw-r--r--source/blender/editors/include/ED_particle.h24
-rw-r--r--source/blender/editors/include/ED_physics.h16
-rw-r--r--source/blender/editors/include/ED_render.h12
-rw-r--r--source/blender/editors/include/ED_scene.h8
-rw-r--r--source/blender/editors/include/ED_screen.h52
-rw-r--r--source/blender/editors/include/ED_screen_types.h29
-rw-r--r--source/blender/editors/include/ED_sculpt.h18
-rw-r--r--source/blender/editors/include/ED_select_utils.h13
-rw-r--r--source/blender/editors/include/ED_sequencer.h10
-rw-r--r--source/blender/editors/include/ED_sound.h11
-rw-r--r--source/blender/editors/include/ED_space_api.h11
-rw-r--r--source/blender/editors/include/ED_text.h14
-rw-r--r--source/blender/editors/include/ED_transform.h31
-rw-r--r--source/blender/editors/include/ED_transform_snap_object_context.h17
-rw-r--r--source/blender/editors/include/ED_transverts.h20
-rw-r--r--source/blender/editors/include/ED_types.h11
-rw-r--r--source/blender/editors/include/ED_undo.h20
-rw-r--r--source/blender/editors/include/ED_userpref.h (renamed from source/blender/depsgraph/util/deg_util_foreach.h)21
-rw-r--r--source/blender/editors/include/ED_util.h25
-rw-r--r--source/blender/editors/include/ED_uvedit.h36
-rw-r--r--source/blender/editors/include/ED_view3d.h57
-rw-r--r--source/blender/editors/include/UI_icons.h23
-rw-r--r--source/blender/editors/include/UI_interface.h589
-rw-r--r--source/blender/editors/include/UI_interface_icons.h18
-rw-r--r--source/blender/editors/include/UI_resources.h27
-rw-r--r--source/blender/editors/include/UI_view2d.h22
-rw-r--r--source/blender/editors/interface/CMakeLists.txt3
-rw-r--r--source/blender/editors/interface/interface.c205
-rw-r--r--source/blender/editors/interface/interface_align.c111
-rw-r--r--source/blender/editors/interface/interface_anim.c20
-rw-r--r--source/blender/editors/interface/interface_context_menu.c47
-rw-r--r--source/blender/editors/interface/interface_draw.c112
-rw-r--r--source/blender/editors/interface/interface_eyedropper.c16
-rw-r--r--source/blender/editors/interface/interface_eyedropper_color.c72
-rw-r--r--source/blender/editors/interface/interface_eyedropper_colorband.c38
-rw-r--r--source/blender/editors/interface/interface_eyedropper_datablock.c35
-rw-r--r--source/blender/editors/interface/interface_eyedropper_depth.c37
-rw-r--r--source/blender/editors/interface/interface_eyedropper_driver.c38
-rw-r--r--source/blender/editors/interface/interface_eyedropper_intern.h8
-rw-r--r--source/blender/editors/interface/interface_handlers.c292
-rw-r--r--source/blender/editors/interface/interface_icons.c45
-rw-r--r--source/blender/editors/interface/interface_icons_event.c12
-rw-r--r--source/blender/editors/interface/interface_intern.h143
-rw-r--r--source/blender/editors/interface/interface_layout.c64
-rw-r--r--source/blender/editors/interface/interface_ops.c53
-rw-r--r--source/blender/editors/interface/interface_panel.c58
-rw-r--r--source/blender/editors/interface/interface_query.c8
-rw-r--r--source/blender/editors/interface/interface_region_color_picker.c96
-rw-r--r--source/blender/editors/interface/interface_region_hud.c19
-rw-r--r--source/blender/editors/interface/interface_region_menu_pie.c13
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.c25
-rw-r--r--source/blender/editors/interface/interface_region_popover.c17
-rw-r--r--source/blender/editors/interface/interface_region_popup.c40
-rw-r--r--source/blender/editors/interface/interface_region_search.c26
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.c12
-rw-r--r--source/blender/editors/interface/interface_regions.c10
-rw-r--r--source/blender/editors/interface/interface_regions_intern.h8
-rw-r--r--source/blender/editors/interface/interface_style.c15
-rw-r--r--source/blender/editors/interface/interface_templates.c132
-rw-r--r--source/blender/editors/interface/interface_utils.c23
-rw-r--r--source/blender/editors/interface/interface_widgets.c67
-rw-r--r--source/blender/editors/interface/resources.c99
-rw-r--r--source/blender/editors/interface/view2d.c69
-rw-r--r--source/blender/editors/interface/view2d_ops.c126
-rw-r--r--source/blender/editors/io/CMakeLists.txt3
-rw-r--r--source/blender/editors/io/io_alembic.c16
-rw-r--r--source/blender/editors/io/io_alembic.h9
-rw-r--r--source/blender/editors/io/io_cache.c13
-rw-r--r--source/blender/editors/io/io_cache.h9
-rw-r--r--source/blender/editors/io/io_collada.c24
-rw-r--r--source/blender/editors/io/io_collada.h11
-rw-r--r--source/blender/editors/io/io_ops.c11
-rw-r--r--source/blender/editors/io/io_ops.h11
-rw-r--r--source/blender/editors/lattice/CMakeLists.txt3
-rw-r--r--source/blender/editors/lattice/editlattice_select.c10
-rw-r--r--source/blender/editors/lattice/editlattice_tools.c18
-rw-r--r--source/blender/editors/lattice/editlattice_undo.c28
-rw-r--r--source/blender/editors/lattice/lattice_intern.h8
-rw-r--r--source/blender/editors/lattice/lattice_ops.c11
-rw-r--r--source/blender/editors/mask/CMakeLists.txt4
-rw-r--r--source/blender/editors/mask/mask_add.c12
-rw-r--r--source/blender/editors/mask/mask_draw.c38
-rw-r--r--source/blender/editors/mask/mask_edit.c12
-rw-r--r--source/blender/editors/mask/mask_editaction.c10
-rw-r--r--source/blender/editors/mask/mask_intern.h14
-rw-r--r--source/blender/editors/mask/mask_ops.c21
-rw-r--r--source/blender/editors/mask/mask_relationships.c12
-rw-r--r--source/blender/editors/mask/mask_select.c123
-rw-r--r--source/blender/editors/mask/mask_shapekey.c12
-rw-r--r--source/blender/editors/mesh/CMakeLists.txt3
-rw-r--r--source/blender/editors/mesh/editface.c13
-rw-r--r--source/blender/editors/mesh/editmesh_add.c25
-rw-r--r--source/blender/editors/mesh/editmesh_add_gizmo.c8
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c519
-rw-r--r--source/blender/editors/mesh/editmesh_bisect.c15
-rw-r--r--source/blender/editors/mesh/editmesh_extrude.c12
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_screw.c18
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin.c16
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c30
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c30
-rw-r--r--source/blender/editors/mesh/editmesh_intersect.c30
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c22
-rw-r--r--source/blender/editors/mesh/editmesh_knife_project.c16
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c24
-rw-r--r--source/blender/editors/mesh/editmesh_path.c17
-rw-r--r--source/blender/editors/mesh/editmesh_polybuild.c54
-rw-r--r--source/blender/editors/mesh/editmesh_preselect_edgering.c8
-rw-r--r--source/blender/editors/mesh/editmesh_preselect_elem.c10
-rw-r--r--source/blender/editors/mesh/editmesh_rip.c20
-rw-r--r--source/blender/editors/mesh/editmesh_rip_edge.c8
-rw-r--r--source/blender/editors/mesh/editmesh_select.c58
-rw-r--r--source/blender/editors/mesh/editmesh_select_similar.c16
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c187
-rw-r--r--source/blender/editors/mesh/editmesh_undo.c37
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c78
-rw-r--r--source/blender/editors/mesh/mesh_data.c100
-rw-r--r--source/blender/editors/mesh/mesh_intern.h17
-rw-r--r--source/blender/editors/mesh/mesh_mirror.c30
-rw-r--r--source/blender/editors/mesh/mesh_ops.c13
-rw-r--r--source/blender/editors/mesh/meshtools.c50
-rw-r--r--source/blender/editors/metaball/CMakeLists.txt3
-rw-r--r--source/blender/editors/metaball/editmball_undo.c26
-rw-r--r--source/blender/editors/metaball/mball_edit.c19
-rw-r--r--source/blender/editors/metaball/mball_intern.h11
-rw-r--r--source/blender/editors/metaball/mball_ops.c11
-rw-r--r--source/blender/editors/object/CMakeLists.txt11
-rw-r--r--source/blender/editors/object/object_add.c357
-rw-r--r--source/blender/editors/object/object_bake.c50
-rw-r--r--source/blender/editors/object/object_bake_api.c64
-rw-r--r--source/blender/editors/object/object_collection.c26
-rw-r--r--source/blender/editors/object/object_constraint.c33
-rw-r--r--source/blender/editors/object/object_data_transfer.c25
-rw-r--r--source/blender/editors/object/object_edit.c425
-rw-r--r--source/blender/editors/object/object_facemap_ops.c25
-rw-r--r--source/blender/editors/object/object_gpencil_modifier.c19
-rw-r--r--source/blender/editors/object/object_hook.c14
-rw-r--r--source/blender/editors/object/object_intern.h19
-rw-r--r--source/blender/editors/object/object_modes.c10
-rw-r--r--source/blender/editors/object/object_modifier.c60
-rw-r--r--source/blender/editors/object/object_ops.c13
-rw-r--r--source/blender/editors/object/object_random.c14
-rw-r--r--source/blender/editors/object/object_relations.c271
-rw-r--r--source/blender/editors/object/object_select.c113
-rw-r--r--source/blender/editors/object/object_shader_fx.c22
-rw-r--r--source/blender/editors/object/object_shapekey.c10
-rw-r--r--source/blender/editors/object/object_transform.c119
-rw-r--r--source/blender/editors/object/object_utils.c8
-rw-r--r--source/blender/editors/object/object_vgroup.c85
-rw-r--r--source/blender/editors/object/object_warp.c8
-rw-r--r--source/blender/editors/physics/CMakeLists.txt3
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c12
-rw-r--r--source/blender/editors/physics/particle_boids.c10
-rw-r--r--source/blender/editors/physics/particle_edit.c80
-rw-r--r--source/blender/editors/physics/particle_edit_undo.c18
-rw-r--r--source/blender/editors/physics/particle_edit_utildefines.h12
-rw-r--r--source/blender/editors/physics/particle_object.c68
-rw-r--r--source/blender/editors/physics/physics_fluid.c31
-rw-r--r--source/blender/editors/physics/physics_intern.h12
-rw-r--r--source/blender/editors/physics/physics_ops.c10
-rw-r--r--source/blender/editors/physics/physics_pointcache.c36
-rw-r--r--source/blender/editors/physics/rigidbody_constraint.c14
-rw-r--r--source/blender/editors/physics/rigidbody_object.c16
-rw-r--r--source/blender/editors/physics/rigidbody_world.c14
-rw-r--r--source/blender/editors/render/CMakeLists.txt3
-rw-r--r--source/blender/editors/render/render_intern.h15
-rw-r--r--source/blender/editors/render/render_internal.c30
-rw-r--r--source/blender/editors/render/render_opengl.c25
-rw-r--r--source/blender/editors/render/render_ops.c10
-rw-r--r--source/blender/editors/render/render_preview.c70
-rw-r--r--source/blender/editors/render/render_shading.c52
-rw-r--r--source/blender/editors/render/render_update.c57
-rw-r--r--source/blender/editors/render/render_view.c11
-rw-r--r--source/blender/editors/scene/CMakeLists.txt3
-rw-r--r--source/blender/editors/scene/scene_edit.c28
-rw-r--r--source/blender/editors/screen/CMakeLists.txt3
-rw-r--r--source/blender/editors/screen/area.c151
-rw-r--r--source/blender/editors/screen/area_utils.c10
-rw-r--r--source/blender/editors/screen/glutil.c71
-rw-r--r--source/blender/editors/screen/screen_context.c79
-rw-r--r--source/blender/editors/screen/screen_draw.c10
-rw-r--r--source/blender/editors/screen/screen_edit.c27
-rw-r--r--source/blender/editors/screen/screen_geometry.c10
-rw-r--r--source/blender/editors/screen/screen_intern.h16
-rw-r--r--source/blender/editors/screen/screen_ops.c192
-rw-r--r--source/blender/editors/screen/screen_user_menu.c22
-rw-r--r--source/blender/editors/screen/screendump.c13
-rw-r--r--source/blender/editors/screen/workspace_edit.c11
-rw-r--r--source/blender/editors/screen/workspace_layout_edit.c28
-rw-r--r--source/blender/editors/sculpt_paint/CMakeLists.txt5
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c29
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve.c10
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve_undo.c14
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c18
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c61
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c15
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c1117
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_undo.c172
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h27
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c18
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c26
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c24
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c19
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c43
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_color_ops.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_color_utils.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_proj.c20
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c108
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c10
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c317
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h16
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c134
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c22
-rw-r--r--source/blender/editors/sound/CMakeLists.txt3
-rw-r--r--source/blender/editors/sound/sound_intern.h11
-rw-r--r--source/blender/editors/sound/sound_ops.c42
-rw-r--r--source/blender/editors/space_action/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_action/action_buttons.c13
-rw-r--r--source/blender/editors/space_action/action_data.c15
-rw-r--r--source/blender/editors/space_action/action_draw.c13
-rw-r--r--source/blender/editors/space_action/action_edit.c58
-rw-r--r--source/blender/editors/space_action/action_intern.h25
-rw-r--r--source/blender/editors/space_action/action_ops.c11
-rw-r--r--source/blender/editors/space_action/action_select.c104
-rw-r--r--source/blender/editors/space_action/space_action.c83
-rw-r--r--source/blender/editors/space_api/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_api/spacetypes.c10
-rw-r--r--source/blender/editors/space_buttons/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c61
-rw-r--r--source/blender/editors/space_buttons/buttons_intern.h17
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c11
-rw-r--r--source/blender/editors/space_buttons/buttons_texture.c24
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c51
-rw-r--r--source/blender/editors/space_clip/CMakeLists.txt6
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c72
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c15
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_ops.c12
-rw-r--r--source/blender/editors/space_clip/clip_draw.c22
-rw-r--r--source/blender/editors/space_clip/clip_editor.c133
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c12
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c17
-rw-r--r--source/blender/editors/space_clip/clip_intern.h14
-rw-r--r--source/blender/editors/space_clip/clip_ops.c12
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c12
-rw-r--r--source/blender/editors/space_clip/clip_utils.c13
-rw-r--r--source/blender/editors/space_clip/space_clip.c31
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c26
-rw-r--r--source/blender/editors/space_clip/tracking_ops_detect.c14
-rw-r--r--source/blender/editors/space_clip/tracking_ops_intern.h14
-rw-r--r--source/blender/editors/space_clip/tracking_ops_orient.c26
-rw-r--r--source/blender/editors/space_clip/tracking_ops_plane.c12
-rw-r--r--source/blender/editors/space_clip/tracking_ops_solve.c12
-rw-r--r--source/blender/editors/space_clip/tracking_ops_stabilize.c12
-rw-r--r--source/blender/editors/space_clip/tracking_ops_track.c13
-rw-r--r--source/blender/editors/space_clip/tracking_ops_utils.c12
-rw-r--r--source/blender/editors/space_clip/tracking_select.c140
-rw-r--r--source/blender/editors/space_console/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_console/console_draw.c11
-rw-r--r--source/blender/editors/space_console/console_intern.h15
-rw-r--r--source/blender/editors/space_console/console_ops.c25
-rw-r--r--source/blender/editors/space_console/space_console.c12
-rw-r--r--source/blender/editors/space_file/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_file/file_draw.c39
-rw-r--r--source/blender/editors/space_file/file_intern.h17
-rw-r--r--source/blender/editors/space_file/file_ops.c110
-rw-r--r--source/blender/editors/space_file/file_panels.c11
-rw-r--r--source/blender/editors/space_file/file_utils.c11
-rw-r--r--source/blender/editors/space_file/filelist.c111
-rw-r--r--source/blender/editors/space_file/filelist.h16
-rw-r--r--source/blender/editors/space_file/filesel.c57
-rw-r--r--source/blender/editors/space_file/fsmenu.c27
-rw-r--r--source/blender/editors/space_file/fsmenu.h13
-rw-r--r--source/blender/editors/space_file/space_file.c29
-rw-r--r--source/blender/editors/space_graph/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c53
-rw-r--r--source/blender/editors/space_graph/graph_draw.c78
-rw-r--r--source/blender/editors/space_graph/graph_edit.c63
-rw-r--r--source/blender/editors/space_graph/graph_intern.h27
-rw-r--r--source/blender/editors/space_graph/graph_ops.c30
-rw-r--r--source/blender/editors/space_graph/graph_select.c95
-rw-r--r--source/blender/editors/space_graph/graph_utils.c21
-rw-r--r--source/blender/editors/space_graph/space_graph.c77
-rw-r--r--source/blender/editors/space_image/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_image/image_buttons.c60
-rw-r--r--source/blender/editors/space_image/image_draw.c124
-rw-r--r--source/blender/editors/space_image/image_edit.c13
-rw-r--r--source/blender/editors/space_image/image_intern.h15
-rw-r--r--source/blender/editors/space_image/image_ops.c238
-rw-r--r--source/blender/editors/space_image/space_image.c89
-rw-r--r--source/blender/editors/space_info/CMakeLists.txt9
-rw-r--r--source/blender/editors/space_info/info_draw.c14
-rw-r--r--source/blender/editors/space_info/info_intern.h15
-rw-r--r--source/blender/editors/space_info/info_ops.c31
-rw-r--r--source/blender/editors/space_info/info_report.c116
-rw-r--r--source/blender/editors/space_info/info_stats.c146
-rw-r--r--source/blender/editors/space_info/space_info.c16
-rw-r--r--source/blender/editors/space_info/textview.c20
-rw-r--r--source/blender/editors/space_info/textview.h13
-rw-r--r--source/blender/editors/space_nla/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c14
-rw-r--r--source/blender/editors/space_nla/nla_channels.c23
-rw-r--r--source/blender/editors/space_nla/nla_draw.c35
-rw-r--r--source/blender/editors/space_nla/nla_edit.c63
-rw-r--r--source/blender/editors/space_nla/nla_intern.h15
-rw-r--r--source/blender/editors/space_nla/nla_ops.c11
-rw-r--r--source/blender/editors/space_nla/nla_select.c45
-rw-r--r--source/blender/editors/space_nla/space_nla.c18
-rw-r--r--source/blender/editors/space_node/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_node/drawnode.c45
-rw-r--r--source/blender/editors/space_node/node_add.c12
-rw-r--r--source/blender/editors/space_node/node_buttons.c17
-rw-r--r--source/blender/editors/space_node/node_draw.c41
-rw-r--r--source/blender/editors/space_node/node_edit.c80
-rw-r--r--source/blender/editors/space_node/node_gizmo.c15
-rw-r--r--source/blender/editors/space_node/node_group.c41
-rw-r--r--source/blender/editors/space_node/node_intern.h20
-rw-r--r--source/blender/editors/space_node/node_ops.c11
-rw-r--r--source/blender/editors/space_node/node_relationships.c30
-rw-r--r--source/blender/editors/space_node/node_select.c157
-rw-r--r--source/blender/editors/space_node/node_templates.c18
-rw-r--r--source/blender/editors/space_node/node_toolbar.c11
-rw-r--r--source/blender/editors/space_node/node_view.c11
-rw-r--r--source/blender/editors/space_node/space_node.c20
-rw-r--r--source/blender/editors/space_outliner/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c594
-rw-r--r--source/blender/editors/space_outliner/outliner_dragdrop.c43
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c271
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c185
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h75
-rw-r--r--source/blender/editors/space_outliner/outliner_ops.c29
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c219
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c211
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c94
-rw-r--r--source/blender/editors/space_outliner/outliner_utils.c29
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c34
-rw-r--r--source/blender/editors/space_script/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_script/script_edit.c28
-rw-r--r--source/blender/editors/space_script/script_intern.h11
-rw-r--r--source/blender/editors/space_script/script_ops.c11
-rw-r--r--source/blender/editors/space_script/space_script.c12
-rw-r--r--source/blender/editors/space_sequencer/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c48
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c66
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c630
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c52
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h35
-rw-r--r--source/blender/editors/space_sequencer/sequencer_modifier.c18
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c11
-rw-r--r--source/blender/editors/space_sequencer/sequencer_preview.c10
-rw-r--r--source/blender/editors/space_sequencer/sequencer_scopes.c13
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c50
-rw-r--r--source/blender/editors/space_sequencer/sequencer_view.c11
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c18
-rw-r--r--source/blender/editors/space_statusbar/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_statusbar/space_statusbar.c8
-rw-r--r--source/blender/editors/space_text/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_text/space_text.c12
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c11
-rw-r--r--source/blender/editors/space_text/text_draw.c40
-rw-r--r--source/blender/editors/space_text/text_format.c12
-rw-r--r--source/blender/editors/space_text/text_format.h41
-rw-r--r--source/blender/editors/space_text/text_format_lua.c8
-rw-r--r--source/blender/editors/space_text/text_format_osl.c8
-rw-r--r--source/blender/editors/space_text/text_format_pov.c8
-rw-r--r--source/blender/editors/space_text/text_format_pov_ini.c8
-rw-r--r--source/blender/editors/space_text/text_format_py.c8
-rw-r--r--source/blender/editors/space_text/text_header.c11
-rw-r--r--source/blender/editors/space_text/text_intern.h13
-rw-r--r--source/blender/editors/space_text/text_ops.c58
-rw-r--r--source/blender/editors/space_text/text_undo.c100
-rw-r--r--source/blender/editors/space_topbar/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_topbar/space_topbar.c12
-rw-r--r--source/blender/editors/space_userpref/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c21
-rw-r--r--source/blender/editors/space_userpref/userpref_intern.h11
-rw-r--r--source/blender/editors/space_userpref/userpref_ops.c65
-rw-r--r--source/blender/editors/space_view3d/CMakeLists.txt13
-rw-r--r--source/blender/editors/space_view3d/drawobject.c192
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c41
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c465
-rw-r--r--source/blender/editors/space_view3d/view3d_camera_control.c51
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c123
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c108
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c198
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c57
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_armature.c11
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_camera.c33
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_empty.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_forcefield.c13
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_light.c (renamed from source/blender/editors/space_view3d/view3d_gizmo_lamp.c)100
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate.c36
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c49
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_preselect.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c67
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c136
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c87
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h34
-rw-r--r--source/blender/editors/space_view3d/view3d_iterators.c19
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c20
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c382
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c34
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c11
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c52
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c197
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c33
-rw-r--r--source/blender/editors/transform/CMakeLists.txt3
-rw-r--r--source/blender/editors/transform/transform.c472
-rw-r--r--source/blender/editors/transform/transform.h689
-rw-r--r--source/blender/editors/transform/transform_constraints.c54
-rw-r--r--source/blender/editors/transform/transform_conversions.c370
-rw-r--r--source/blender/editors/transform/transform_generics.c165
-rw-r--r--source/blender/editors/transform/transform_gizmo_2d.c9
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c106
-rw-r--r--source/blender/editors/transform/transform_gizmo_extrude_3d.c47
-rw-r--r--source/blender/editors/transform/transform_input.c19
-rw-r--r--source/blender/editors/transform/transform_ops.c94
-rw-r--r--source/blender/editors/transform/transform_orientations.c50
-rw-r--r--source/blender/editors/transform/transform_snap.c26
-rw-r--r--source/blender/editors/transform/transform_snap_object.c34
-rw-r--r--source/blender/editors/undo/CMakeLists.txt3
-rw-r--r--source/blender/editors/undo/ed_undo.c120
-rw-r--r--source/blender/editors/undo/memfile_undo.c47
-rw-r--r--source/blender/editors/undo/undo_intern.h8
-rw-r--r--source/blender/editors/undo/undo_system_types.c8
-rw-r--r--source/blender/editors/util/CMakeLists.txt3
-rw-r--r--source/blender/editors/util/ed_transverts.c8
-rw-r--r--source/blender/editors/util/ed_util.c137
-rw-r--r--source/blender/editors/util/gizmo_utils.c8
-rw-r--r--source/blender/editors/util/numinput.c68
-rw-r--r--source/blender/editors/util/select_utils.c21
-rw-r--r--source/blender/editors/uvedit/CMakeLists.txt3
-rw-r--r--source/blender/editors/uvedit/uvedit_buttons.c12
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c132
-rw-r--r--source/blender/editors/uvedit/uvedit_intern.h20
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c122
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c32
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.h12
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c63
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c282
-rw-r--r--source/blender/freestyle/CMakeLists.txt9
-rw-r--r--source/blender/freestyle/FRS_freestyle.h14
-rw-r--r--source/blender/freestyle/intern/application/AppCanvas.cpp8
-rw-r--r--source/blender/freestyle/intern/application/AppCanvas.h8
-rw-r--r--source/blender/freestyle/intern/application/AppConfig.cpp8
-rw-r--r--source/blender/freestyle/intern/application/AppConfig.h12
-rw-r--r--source/blender/freestyle/intern/application/AppView.cpp8
-rw-r--r--source/blender/freestyle/intern/application/AppView.h8
-rw-r--r--source/blender/freestyle/intern/application/Controller.cpp12
-rw-r--r--source/blender/freestyle/intern/application/Controller.h14
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp49
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h12
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp44
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h8
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h8
-rw-r--r--source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp28
-rw-r--r--source/blender/freestyle/intern/geometry/BBox.h12
-rw-r--r--source/blender/freestyle/intern/geometry/Bezier.cpp12
-rw-r--r--source/blender/freestyle/intern/geometry/Bezier.h12
-rw-r--r--source/blender/freestyle/intern/geometry/FastGrid.cpp12
-rw-r--r--source/blender/freestyle/intern/geometry/FastGrid.h12
-rw-r--r--source/blender/freestyle/intern/geometry/FitCurve.cpp14
-rw-r--r--source/blender/freestyle/intern/geometry/FitCurve.h14
-rw-r--r--source/blender/freestyle/intern/geometry/Geom.h14
-rw-r--r--source/blender/freestyle/intern/geometry/GeomCleaner.cpp12
-rw-r--r--source/blender/freestyle/intern/geometry/GeomCleaner.h12
-rw-r--r--source/blender/freestyle/intern/geometry/GeomUtils.cpp14
-rw-r--r--source/blender/freestyle/intern/geometry/GeomUtils.h12
-rw-r--r--source/blender/freestyle/intern/geometry/Grid.cpp12
-rw-r--r--source/blender/freestyle/intern/geometry/Grid.h12
-rw-r--r--source/blender/freestyle/intern/geometry/GridHelpers.cpp12
-rw-r--r--source/blender/freestyle/intern/geometry/GridHelpers.h14
-rw-r--r--source/blender/freestyle/intern/geometry/HashGrid.cpp12
-rw-r--r--source/blender/freestyle/intern/geometry/HashGrid.h12
-rw-r--r--source/blender/freestyle/intern/geometry/Noise.cpp12
-rw-r--r--source/blender/freestyle/intern/geometry/Noise.h12
-rw-r--r--source/blender/freestyle/intern/geometry/Polygon.h12
-rw-r--r--source/blender/freestyle/intern/geometry/SweepLine.h12
-rw-r--r--source/blender/freestyle/intern/geometry/VecMat.h14
-rw-r--r--source/blender/freestyle/intern/geometry/matrix_util.cpp13
-rw-r--r--source/blender/freestyle/intern/geometry/matrix_util.h11
-rw-r--r--source/blender/freestyle/intern/geometry/normal_cycle.cpp11
-rw-r--r--source/blender/freestyle/intern/geometry/normal_cycle.h11
-rw-r--r--source/blender/freestyle/intern/image/GaussianFilter.cpp12
-rw-r--r--source/blender/freestyle/intern/image/GaussianFilter.h12
-rw-r--r--source/blender/freestyle/intern/image/Image.h12
-rw-r--r--source/blender/freestyle/intern/image/ImagePyramid.cpp12
-rw-r--r--source/blender/freestyle/intern/image/ImagePyramid.h12
-rw-r--r--source/blender/freestyle/intern/python/BPy_BBox.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_BBox.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp12
-rw-r--r--source/blender/freestyle/intern/python/BPy_ContextFunctions.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Convert.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Convert.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Freestyle.cpp12
-rw-r--r--source/blender/freestyle/intern/python/BPy_Freestyle.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp10
-rw-r--r--source/blender/freestyle/intern/python/BPy_FrsMaterial.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_FrsNoise.cpp10
-rw-r--r--source/blender/freestyle/intern/python/BPy_FrsNoise.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Id.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Id.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_IntegrationType.cpp12
-rw-r--r--source/blender/freestyle/intern/python/BPy_IntegrationType.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Interface0D.cpp10
-rw-r--r--source/blender/freestyle/intern/python/BPy_Interface0D.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Interface1D.cpp10
-rw-r--r--source/blender/freestyle/intern/python/BPy_Interface1D.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Iterator.cpp10
-rw-r--r--source/blender/freestyle/intern/python/BPy_Iterator.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_MediumType.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_MediumType.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Nature.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Nature.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_Operators.cpp10
-rw-r--r--source/blender/freestyle/intern/python/BPy_Operators.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_SShape.cpp10
-rw-r--r--source/blender/freestyle/intern/python/BPy_SShape.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp12
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeAttribute.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeShader.cpp10
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeShader.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewMap.cpp10
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewMap.h8
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewShape.cpp10
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewShape.h8
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/Director.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Director.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp12
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h8
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp10
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp8
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h8
-rw-r--r--source/blender/freestyle/intern/scene_graph/DrawingStyle.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/FrsMaterial.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/LineRep.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/LineRep.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/Node.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeCamera.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeCamera.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeGroup.cpp14
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeGroup.h14
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeLight.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeLight.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeShape.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeShape.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeTransform.cpp14
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeTransform.h14
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeViewLayer.cpp10
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeViewLayer.h10
-rw-r--r--source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/OrientedLineRep.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/Rep.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/Rep.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/SceneHash.cpp8
-rw-r--r--source/blender/freestyle/intern/scene_graph/SceneHash.h8
-rw-r--r--source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp13
-rw-r--r--source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h13
-rw-r--r--source/blender/freestyle/intern/scene_graph/SceneVisitor.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/SceneVisitor.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/TriangleRep.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/TriangleRep.h12
-rw-r--r--source/blender/freestyle/intern/scene_graph/VertexRep.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/VertexRep.h12
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp13
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h13
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp13
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h13
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h12
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h16
-rw-r--r--source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/BasicStrokeShaders.h16
-rw-r--r--source/blender/freestyle/intern/stroke/Canvas.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/Canvas.h12
-rw-r--r--source/blender/freestyle/intern/stroke/Chain.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/Chain.h12
-rw-r--r--source/blender/freestyle/intern/stroke/ChainingIterators.cpp14
-rw-r--r--source/blender/freestyle/intern/stroke/ChainingIterators.h12
-rw-r--r--source/blender/freestyle/intern/stroke/ContextFunctions.cpp14
-rw-r--r--source/blender/freestyle/intern/stroke/ContextFunctions.h42
-rw-r--r--source/blender/freestyle/intern/stroke/Curve.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/Curve.h12
-rw-r--r--source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h12
-rw-r--r--source/blender/freestyle/intern/stroke/CurveIterators.h12
-rw-r--r--source/blender/freestyle/intern/stroke/Modifiers.h12
-rw-r--r--source/blender/freestyle/intern/stroke/Module.h12
-rw-r--r--source/blender/freestyle/intern/stroke/Operators.cpp13
-rw-r--r--source/blender/freestyle/intern/stroke/Operators.h13
-rw-r--r--source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/PSStrokeRenderer.h12
-rw-r--r--source/blender/freestyle/intern/stroke/Predicates0D.cpp8
-rw-r--r--source/blender/freestyle/intern/stroke/Predicates0D.h13
-rw-r--r--source/blender/freestyle/intern/stroke/Predicates1D.cpp8
-rw-r--r--source/blender/freestyle/intern/stroke/Predicates1D.h13
-rw-r--r--source/blender/freestyle/intern/stroke/QInformationMap.h12
-rw-r--r--source/blender/freestyle/intern/stroke/Stroke.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/Stroke.h21
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h13
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeIO.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeIO.h12
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeIterators.h16
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeLayer.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeLayer.h12
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRenderer.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRenderer.h12
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRep.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRep.h12
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeShader.cpp8
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeShader.h21
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeTesselator.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeTesselator.h12
-rw-r--r--source/blender/freestyle/intern/stroke/StyleModule.h13
-rw-r--r--source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp4
-rw-r--r--source/blender/freestyle/intern/stroke/TextStrokeRenderer.h8
-rw-r--r--source/blender/freestyle/intern/system/BaseIterator.h12
-rw-r--r--source/blender/freestyle/intern/system/BaseObject.cpp14
-rw-r--r--source/blender/freestyle/intern/system/BaseObject.h14
-rw-r--r--source/blender/freestyle/intern/system/Cast.h12
-rw-r--r--source/blender/freestyle/intern/system/Exception.cpp12
-rw-r--r--source/blender/freestyle/intern/system/Exception.h12
-rw-r--r--source/blender/freestyle/intern/system/FreestyleConfig.h12
-rw-r--r--source/blender/freestyle/intern/system/Id.h12
-rw-r--r--source/blender/freestyle/intern/system/Interpreter.h12
-rw-r--r--source/blender/freestyle/intern/system/Iterator.cpp8
-rw-r--r--source/blender/freestyle/intern/system/Iterator.h8
-rw-r--r--source/blender/freestyle/intern/system/PointerSequence.h12
-rw-r--r--source/blender/freestyle/intern/system/Precision.h12
-rw-r--r--source/blender/freestyle/intern/system/ProgressBar.h12
-rw-r--r--source/blender/freestyle/intern/system/PseudoNoise.cpp12
-rw-r--r--source/blender/freestyle/intern/system/PseudoNoise.h12
-rw-r--r--source/blender/freestyle/intern/system/PythonInterpreter.cpp12
-rw-r--r--source/blender/freestyle/intern/system/PythonInterpreter.h14
-rw-r--r--source/blender/freestyle/intern/system/RandGen.cpp16
-rw-r--r--source/blender/freestyle/intern/system/RandGen.h12
-rw-r--r--source/blender/freestyle/intern/system/RenderMonitor.h12
-rw-r--r--source/blender/freestyle/intern/system/StringUtils.cpp12
-rw-r--r--source/blender/freestyle/intern/system/StringUtils.h12
-rw-r--r--source/blender/freestyle/intern/system/TimeStamp.cpp12
-rw-r--r--source/blender/freestyle/intern/system/TimeStamp.h12
-rw-r--r--source/blender/freestyle/intern/system/TimeUtils.h12
-rw-r--r--source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h12
-rw-r--r--source/blender/freestyle/intern/view_map/AutoPtrHelper.h12
-rw-r--r--source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h12
-rw-r--r--source/blender/freestyle/intern/view_map/BoxGrid.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/BoxGrid.h12
-rw-r--r--source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/CulledOccluderSource.h12
-rw-r--r--source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/FEdgeXDetector.h12
-rw-r--r--source/blender/freestyle/intern/view_map/Functions0D.cpp13
-rw-r--r--source/blender/freestyle/intern/view_map/Functions0D.h15
-rw-r--r--source/blender/freestyle/intern/view_map/Functions1D.cpp13
-rw-r--r--source/blender/freestyle/intern/view_map/Functions1D.h15
-rw-r--r--source/blender/freestyle/intern/view_map/GridDensityProvider.h12
-rw-r--r--source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h12
-rw-r--r--source/blender/freestyle/intern/view_map/Interface0D.cpp8
-rw-r--r--source/blender/freestyle/intern/view_map/Interface0D.h16
-rw-r--r--source/blender/freestyle/intern/view_map/Interface1D.cpp8
-rw-r--r--source/blender/freestyle/intern/view_map/Interface1D.h22
-rw-r--r--source/blender/freestyle/intern/view_map/OccluderSource.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/OccluderSource.h12
-rw-r--r--source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.h12
-rw-r--r--source/blender/freestyle/intern/view_map/Silhouette.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/Silhouette.h12
-rw-r--r--source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp22
-rw-r--r--source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h12
-rw-r--r--source/blender/freestyle/intern/view_map/SphericalGrid.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/SphericalGrid.h12
-rw-r--r--source/blender/freestyle/intern/view_map/SteerableViewMap.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/SteerableViewMap.h12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMap.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMap.h12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h14
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapBuilder.h12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapIO.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapIO.h12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapIterators.h12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp12
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapTesselator.h12
-rw-r--r--source/blender/freestyle/intern/winged_edge/Curvature.cpp18
-rw-r--r--source/blender/freestyle/intern/winged_edge/Curvature.h18
-rw-r--r--source/blender/freestyle/intern/winged_edge/Nature.h12
-rw-r--r--source/blender/freestyle/intern/winged_edge/WEdge.cpp12
-rw-r--r--source/blender/freestyle/intern/winged_edge/WEdge.h12
-rw-r--r--source/blender/freestyle/intern/winged_edge/WFillGrid.cpp13
-rw-r--r--source/blender/freestyle/intern/winged_edge/WFillGrid.h13
-rw-r--r--source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp12
-rw-r--r--source/blender/freestyle/intern/winged_edge/WSFillGrid.h12
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdge.cpp12
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdge.h12
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp12
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h12
-rw-r--r--source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp12
-rw-r--r--source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h12
-rw-r--r--source/blender/gpencil_modifiers/CMakeLists.txt18
-rw-r--r--source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h8
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c16
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h18
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c21
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c23
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c23
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c24
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c21
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c18
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c41
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c67
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c19
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c15
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c17
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c14
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c19
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c16
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c12
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c24
-rw-r--r--source/blender/gpu/CMakeLists.txt10
-rw-r--r--source/blender/gpu/GPU_attr_binding.h16
-rw-r--r--source/blender/gpu/GPU_batch.h35
-rw-r--r--source/blender/gpu/GPU_batch_presets.h13
-rw-r--r--source/blender/gpu/GPU_batch_utils.h8
-rw-r--r--source/blender/gpu/GPU_buffers.h17
-rw-r--r--source/blender/gpu/GPU_common.h10
-rw-r--r--source/blender/gpu/GPU_context.h10
-rw-r--r--source/blender/gpu/GPU_debug.h12
-rw-r--r--source/blender/gpu/GPU_draw.h31
-rw-r--r--source/blender/gpu/GPU_element.h10
-rw-r--r--source/blender/gpu/GPU_extensions.h33
-rw-r--r--source/blender/gpu/GPU_framebuffer.h38
-rw-r--r--source/blender/gpu/GPU_glew.h12
-rw-r--r--source/blender/gpu/GPU_immediate.h28
-rw-r--r--source/blender/gpu/GPU_immediate_util.h8
-rw-r--r--source/blender/gpu/GPU_init_exit.h12
-rw-r--r--source/blender/gpu/GPU_legacy_stubs.h12
-rw-r--r--source/blender/gpu/GPU_material.h70
-rw-r--r--source/blender/gpu/GPU_matrix.h12
-rw-r--r--source/blender/gpu/GPU_primitive.h12
-rw-r--r--source/blender/gpu/GPU_select.h11
-rw-r--r--source/blender/gpu/GPU_shader.h78
-rw-r--r--source/blender/gpu/GPU_shader_interface.h22
-rw-r--r--source/blender/gpu/GPU_state.h24
-rw-r--r--source/blender/gpu/GPU_texture.h56
-rw-r--r--source/blender/gpu/GPU_uniformbuffer.h12
-rw-r--r--source/blender/gpu/GPU_vertex_buffer.h43
-rw-r--r--source/blender/gpu/GPU_vertex_format.h24
-rw-r--r--source/blender/gpu/GPU_viewport.h12
-rw-r--r--source/blender/gpu/intern/gpu_attr_binding.c30
-rw-r--r--source/blender/gpu/intern/gpu_attr_binding_private.h16
-rw-r--r--source/blender/gpu/intern/gpu_batch.c33
-rw-r--r--source/blender/gpu/intern/gpu_batch_presets.c12
-rw-r--r--source/blender/gpu/intern/gpu_batch_private.h10
-rw-r--r--source/blender/gpu/intern/gpu_batch_utils.c8
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c516
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c240
-rw-r--r--source/blender/gpu/intern/gpu_codegen.h68
-rw-r--r--source/blender/gpu/intern/gpu_context.cpp14
-rw-r--r--source/blender/gpu/intern/gpu_context_private.h10
-rw-r--r--source/blender/gpu/intern/gpu_debug.c12
-rw-r--r--source/blender/gpu/intern/gpu_draw.c310
-rw-r--r--source/blender/gpu/intern/gpu_element.c14
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c26
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.c39
-rw-r--r--source/blender/gpu/intern/gpu_immediate.c198
-rw-r--r--source/blender/gpu/intern/gpu_immediate_util.c10
-rw-r--r--source/blender/gpu/intern/gpu_init_exit.c12
-rw-r--r--source/blender/gpu/intern/gpu_material.c42
-rw-r--r--source/blender/gpu/intern/gpu_matrix.c15
-rw-r--r--source/blender/gpu/intern/gpu_primitive.c12
-rw-r--r--source/blender/gpu/intern/gpu_primitive_private.h10
-rw-r--r--source/blender/gpu/intern/gpu_private.h8
-rw-r--r--source/blender/gpu/intern/gpu_select.c54
-rw-r--r--source/blender/gpu/intern/gpu_select_pick.c13
-rw-r--r--source/blender/gpu/intern/gpu_select_private.h10
-rw-r--r--source/blender/gpu/intern/gpu_select_sample_query.c14
-rw-r--r--source/blender/gpu/intern/gpu_shader.c998
-rw-r--r--source/blender/gpu/intern/gpu_shader_interface.c48
-rw-r--r--source/blender/gpu/intern/gpu_shader_private.h27
-rw-r--r--source/blender/gpu/intern/gpu_state.c19
-rw-r--r--source/blender/gpu/intern/gpu_texture.c95
-rw-r--r--source/blender/gpu/intern/gpu_uniformbuffer.c32
-rw-r--r--source/blender/gpu/intern/gpu_vertex_buffer.c22
-rw-r--r--source/blender/gpu/intern/gpu_vertex_format.c108
-rw-r--r--source/blender/gpu/intern/gpu_vertex_format_private.h10
-rw-r--r--source/blender/gpu/intern/gpu_viewport.c20
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl6
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl30
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl2
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_vert.glsl5
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_groundline_geom.glsl9
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_groundpoint_vert.glsl7
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_passthrough_vert.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_aa_vert.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_selection_id_vert.glsl30
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl8
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_vert.glsl8
-rw-r--r--source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl25
-rw-r--r--source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl18
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl11
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl11
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_geom.glsl8
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl9
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_objectspace_variying_color_vert.glsl6
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl14
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_screenspace_variying_color_vert.glsl8
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl18
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_instance_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl100
-rw-r--r--source/blender/gpu/shaders/gpu_shader_selection_id_frag.glsl21
-rw-r--r--source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl4
-rw-r--r--source/blender/ikplugin/BIK_api.h18
-rw-r--r--source/blender/ikplugin/CMakeLists.txt5
-rw-r--r--source/blender/ikplugin/intern/ikplugin_api.c13
-rw-r--r--source/blender/ikplugin/intern/ikplugin_api.h12
-rw-r--r--source/blender/ikplugin/intern/iksolver_plugin.c12
-rw-r--r--source/blender/ikplugin/intern/iksolver_plugin.h12
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.cpp14
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.h12
-rw-r--r--source/blender/imbuf/CMakeLists.txt7
-rw-r--r--source/blender/imbuf/IMB_colormanagement.h23
-rw-r--r--source/blender/imbuf/IMB_imbuf.h20
-rw-r--r--source/blender/imbuf/IMB_imbuf_types.h177
-rw-r--r--source/blender/imbuf/IMB_metadata.h36
-rw-r--r--source/blender/imbuf/IMB_moviecache.h12
-rw-r--r--source/blender/imbuf/IMB_thumbs.h12
-rw-r--r--source/blender/imbuf/intern/IMB_allocimbuf.h11
-rw-r--r--source/blender/imbuf/intern/IMB_anim.h15
-rw-r--r--source/blender/imbuf/intern/IMB_colormanagement_intern.h17
-rw-r--r--source/blender/imbuf/intern/IMB_filetype.h10
-rw-r--r--source/blender/imbuf/intern/IMB_filter.h11
-rw-r--r--source/blender/imbuf/intern/IMB_indexer.h11
-rw-r--r--source/blender/imbuf/intern/allocimbuf.c12
-rw-r--r--source/blender/imbuf/intern/anim_movie.c12
-rw-r--r--source/blender/imbuf/intern/bmp.c12
-rw-r--r--source/blender/imbuf/intern/cache.c8
-rw-r--r--source/blender/imbuf/intern/cineon/CMakeLists.txt5
-rw-r--r--source/blender/imbuf/intern/cineon/cineon_dpx.c18
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.c33
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.h35
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.c33
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.h13
-rw-r--r--source/blender/imbuf/intern/cineon/logImageCore.c33
-rw-r--r--source/blender/imbuf/intern/cineon/logImageCore.h49
-rw-r--r--source/blender/imbuf/intern/cineon/logmemfile.c33
-rw-r--r--source/blender/imbuf/intern/cineon/logmemfile.h33
-rw-r--r--source/blender/imbuf/intern/colormanagement.c23
-rw-r--r--source/blender/imbuf/intern/colormanagement_inline.c11
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.cpp10
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.h10
-rw-r--r--source/blender/imbuf/intern/dds/CMakeLists.txt5
-rw-r--r--source/blender/imbuf/intern/dds/Color.h10
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.cpp10
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.h10
-rw-r--r--source/blender/imbuf/intern/dds/Common.h10
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.cpp10
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.h10
-rw-r--r--source/blender/imbuf/intern/dds/FlipDXT.cpp26
-rw-r--r--source/blender/imbuf/intern/dds/FlipDXT.h6
-rw-r--r--source/blender/imbuf/intern/dds/Image.cpp10
-rw-r--r--source/blender/imbuf/intern/dds/Image.h10
-rw-r--r--source/blender/imbuf/intern/dds/PixelFormat.h10
-rw-r--r--source/blender/imbuf/intern/dds/Stream.cpp10
-rw-r--r--source/blender/imbuf/intern/dds/Stream.h10
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.cpp10
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.h10
-rw-r--r--source/blender/imbuf/intern/divers.c13
-rw-r--r--source/blender/imbuf/intern/filetype.c12
-rw-r--r--source/blender/imbuf/intern/filter.c13
-rw-r--r--source/blender/imbuf/intern/imageprocess.c13
-rw-r--r--source/blender/imbuf/intern/imbuf.h12
-rw-r--r--source/blender/imbuf/intern/indexer.c12
-rw-r--r--source/blender/imbuf/intern/iris.c14
-rw-r--r--source/blender/imbuf/intern/jp2.c10
-rw-r--r--source/blender/imbuf/intern/jpeg.c38
-rw-r--r--source/blender/imbuf/intern/metadata.c22
-rw-r--r--source/blender/imbuf/intern/module.c10
-rw-r--r--source/blender/imbuf/intern/moviecache.c12
-rw-r--r--source/blender/imbuf/intern/oiio/CMakeLists.txt5
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.cpp15
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.h12
-rw-r--r--source/blender/imbuf/intern/openexr/CMakeLists.txt5
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp14
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.h12
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_multi.h12
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_stub.cpp12
-rw-r--r--source/blender/imbuf/intern/png.c12
-rw-r--r--source/blender/imbuf/intern/radiance_hdr.c12
-rw-r--r--source/blender/imbuf/intern/readimage.c13
-rw-r--r--source/blender/imbuf/intern/rectop.c13
-rw-r--r--source/blender/imbuf/intern/rotate.c13
-rw-r--r--source/blender/imbuf/intern/scaling.c13
-rw-r--r--source/blender/imbuf/intern/stereoimbuf.c13
-rw-r--r--source/blender/imbuf/intern/targa.c12
-rw-r--r--source/blender/imbuf/intern/thumbs.c25
-rw-r--r--source/blender/imbuf/intern/thumbs_blend.c12
-rw-r--r--source/blender/imbuf/intern/thumbs_font.c10
-rw-r--r--source/blender/imbuf/intern/tiff.c12
-rw-r--r--source/blender/imbuf/intern/util.c36
-rw-r--r--source/blender/imbuf/intern/writeimage.c13
-rw-r--r--source/blender/makesdna/CMakeLists.txt5
-rw-r--r--source/blender/makesdna/DNA_ID.h198
-rw-r--r--source/blender/makesdna/DNA_action_types.h547
-rw-r--r--source/blender/makesdna/DNA_anim_types.h623
-rw-r--r--source/blender/makesdna/DNA_armature_types.h203
-rw-r--r--source/blender/makesdna/DNA_boid_types.h50
-rw-r--r--source/blender/makesdna/DNA_brush_types.h273
-rw-r--r--source/blender/makesdna/DNA_cachefile_types.h27
-rw-r--r--source/blender/makesdna/DNA_camera_types.h59
-rw-r--r--source/blender/makesdna/DNA_cloth_types.h191
-rw-r--r--source/blender/makesdna/DNA_collection_types.h25
-rw-r--r--source/blender/makesdna/DNA_color_types.h90
-rw-r--r--source/blender/makesdna/DNA_constraint_types.h584
-rw-r--r--source/blender/makesdna/DNA_curve_types.h178
-rw-r--r--source/blender/makesdna/DNA_customdata_types.h86
-rw-r--r--source/blender/makesdna/DNA_defs.h10
-rw-r--r--source/blender/makesdna/DNA_documentation.h15
-rw-r--r--source/blender/makesdna/DNA_dynamicpaint_types.h105
-rw-r--r--source/blender/makesdna/DNA_effect_types.h21
-rw-r--r--source/blender/makesdna/DNA_fileglobal_types.h30
-rw-r--r--source/blender/makesdna/DNA_freestyle_types.h44
-rw-r--r--source/blender/makesdna/DNA_genfile.h46
-rw-r--r--source/blender/makesdna/DNA_gpencil_modifier_types.h348
-rw-r--r--source/blender/makesdna/DNA_gpencil_types.h329
-rw-r--r--source/blender/makesdna/DNA_gpu_types.h29
-rw-r--r--source/blender/makesdna/DNA_image_types.h111
-rw-r--r--source/blender/makesdna/DNA_ipo_types.h90
-rw-r--r--source/blender/makesdna/DNA_key_types.h101
-rw-r--r--source/blender/makesdna/DNA_lattice_types.h30
-rw-r--r--source/blender/makesdna/DNA_layer_types.h81
-rw-r--r--source/blender/makesdna/DNA_light_types.h (renamed from source/blender/makesdna/DNA_lamp_types.h)60
-rw-r--r--source/blender/makesdna/DNA_lightprobe_types.h99
-rw-r--r--source/blender/makesdna/DNA_linestyle_types.h92
-rw-r--r--source/blender/makesdna/DNA_listBase.h23
-rw-r--r--source/blender/makesdna/DNA_mask_types.h175
-rw-r--r--source/blender/makesdna/DNA_material_types.h169
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h61
-rw-r--r--source/blender/makesdna/DNA_meshdata_types.h63
-rw-r--r--source/blender/makesdna/DNA_meta_types.h61
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h771
-rw-r--r--source/blender/makesdna/DNA_movieclip_types.h175
-rw-r--r--source/blender/makesdna/DNA_nla_types.h75
-rw-r--r--source/blender/makesdna/DNA_node_types.h449
-rw-r--r--source/blender/makesdna/DNA_object_enums.h8
-rw-r--r--source/blender/makesdna/DNA_object_fluidsim_types.h42
-rw-r--r--source/blender/makesdna/DNA_object_force_types.h411
-rw-r--r--source/blender/makesdna/DNA_object_types.h415
-rw-r--r--source/blender/makesdna/DNA_outliner_types.h25
-rw-r--r--source/blender/makesdna/DNA_packedFile_types.h16
-rw-r--r--source/blender/makesdna/DNA_particle_types.h227
-rw-r--r--source/blender/makesdna/DNA_rigidbody_types.h211
-rw-r--r--source/blender/makesdna/DNA_scene_types.h679
-rw-r--r--source/blender/makesdna/DNA_screen_types.h422
-rw-r--r--source/blender/makesdna/DNA_sdna_types.h70
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h178
-rw-r--r--source/blender/makesdna/DNA_shader_fx_types.h82
-rw-r--r--source/blender/makesdna/DNA_smoke_types.h155
-rw-r--r--source/blender/makesdna/DNA_sound_types.h32
-rw-r--r--source/blender/makesdna/DNA_space_types.h669
-rw-r--r--source/blender/makesdna/DNA_speaker_types.h23
-rw-r--r--source/blender/makesdna/DNA_text_types.h22
-rw-r--r--source/blender/makesdna/DNA_texture_types.h117
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h374
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h614
-rw-r--r--source/blender/makesdna/DNA_vec_types.h15
-rw-r--r--source/blender/makesdna/DNA_vfont_types.h17
-rw-r--r--source/blender/makesdna/DNA_view2d_types.h99
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h233
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h305
-rw-r--r--source/blender/makesdna/DNA_workspace_types.h37
-rw-r--r--source/blender/makesdna/DNA_world_types.h44
-rw-r--r--source/blender/makesdna/intern/CMakeLists.txt16
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c576
-rw-r--r--source/blender/makesdna/intern/dna_rename_defs.h93
-rw-r--r--source/blender/makesdna/intern/dna_utils.c332
-rw-r--r--source/blender/makesdna/intern/dna_utils.h56
-rw-r--r--source/blender/makesdna/intern/makesdna.c602
-rw-r--r--source/blender/makesrna/CMakeLists.txt5
-rw-r--r--source/blender/makesrna/RNA_access.h39
-rw-r--r--source/blender/makesrna/RNA_define.h14
-rw-r--r--source/blender/makesrna/RNA_documentation.h24
-rw-r--r--source/blender/makesrna/RNA_enum_types.h17
-rw-r--r--source/blender/makesrna/RNA_types.h27
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt12
-rw-r--r--source/blender/makesrna/intern/makesrna.c862
-rw-r--r--source/blender/makesrna/intern/rna_ID.c40
-rw-r--r--source/blender/makesrna/intern/rna_access.c163
-rw-r--r--source/blender/makesrna/intern/rna_action.c16
-rw-r--r--source/blender/makesrna/intern/rna_action_api.c11
-rw-r--r--source/blender/makesrna/intern/rna_animation.c60
-rw-r--r--source/blender/makesrna/intern/rna_animation_api.c11
-rw-r--r--source/blender/makesrna/intern/rna_animviz.c118
-rw-r--r--source/blender/makesrna/intern/rna_armature.c114
-rw-r--r--source/blender/makesrna/intern/rna_armature_api.c11
-rw-r--r--source/blender/makesrna/intern/rna_boid.c18
-rw-r--r--source/blender/makesrna/intern/rna_brush.c271
-rw-r--r--source/blender/makesrna/intern/rna_cachefile.c10
-rw-r--r--source/blender/makesrna/intern/rna_camera.c31
-rw-r--r--source/blender/makesrna/intern/rna_camera_api.c10
-rw-r--r--source/blender/makesrna/intern/rna_cloth.c38
-rw-r--r--source/blender/makesrna/intern/rna_collection.c16
-rw-r--r--source/blender/makesrna/intern/rna_color.c41
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c59
-rw-r--r--source/blender/makesrna/intern/rna_context.c12
-rw-r--r--source/blender/makesrna/intern/rna_curve.c56
-rw-r--r--source/blender/makesrna/intern/rna_curve_api.c11
-rw-r--r--source/blender/makesrna/intern/rna_define.c354
-rw-r--r--source/blender/makesrna/intern/rna_depsgraph.c30
-rw-r--r--source/blender/makesrna/intern/rna_dynamicpaint.c43
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c89
-rw-r--r--source/blender/makesrna/intern/rna_fcurve_api.c11
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c20
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c133
-rw-r--r--source/blender/makesrna/intern/rna_gpencil_modifier.c30
-rw-r--r--source/blender/makesrna/intern/rna_image.c51
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c12
-rw-r--r--source/blender/makesrna/intern/rna_internal.h10
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h22
-rw-r--r--source/blender/makesrna/intern/rna_key.c21
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c12
-rw-r--r--source/blender/makesrna/intern/rna_lattice_api.c11
-rw-r--r--source/blender/makesrna/intern/rna_layer.c73
-rw-r--r--source/blender/makesrna/intern/rna_light.c (renamed from source/blender/makesrna/intern/rna_lamp.c)100
-rw-r--r--source/blender/makesrna/intern/rna_lightprobe.c20
-rw-r--r--source/blender/makesrna/intern/rna_linestyle.c60
-rw-r--r--source/blender/makesrna/intern/rna_main.c572
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c94
-rw-r--r--source/blender/makesrna/intern/rna_mask.c28
-rw-r--r--source/blender/makesrna/intern/rna_material.c34
-rw-r--r--source/blender/makesrna/intern/rna_material_api.c11
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c58
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c48
-rw-r--r--source/blender/makesrna/intern/rna_mesh_utils.h10
-rw-r--r--source/blender/makesrna/intern/rna_meta.c14
-rw-r--r--source/blender/makesrna/intern/rna_meta_api.c11
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c234
-rw-r--r--source/blender/makesrna/intern/rna_movieclip.c17
-rw-r--r--source/blender/makesrna/intern/rna_nla.c26
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c168
-rw-r--r--source/blender/makesrna/intern/rna_object.c206
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c19
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c66
-rw-r--r--source/blender/makesrna/intern/rna_packedfile.c12
-rw-r--r--source/blender/makesrna/intern/rna_palette.c8
-rw-r--r--source/blender/makesrna/intern/rna_particle.c182
-rw-r--r--source/blender/makesrna/intern/rna_pose.c69
-rw-r--r--source/blender/makesrna/intern/rna_pose_api.c11
-rw-r--r--source/blender/makesrna/intern/rna_render.c16
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c27
-rw-r--r--source/blender/makesrna/intern/rna_rna.c27
-rw-r--r--source/blender/makesrna/intern/rna_scene.c407
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c29
-rw-r--r--source/blender/makesrna/intern/rna_screen.c69
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c180
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c78
-rw-r--r--source/blender/makesrna/intern/rna_sequencer_api.c14
-rw-r--r--source/blender/makesrna/intern/rna_shader_fx.c19
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c62
-rw-r--r--source/blender/makesrna/intern/rna_sound.c10
-rw-r--r--source/blender/makesrna/intern/rna_sound_api.c10
-rw-r--r--source/blender/makesrna/intern/rna_space.c280
-rw-r--r--source/blender/makesrna/intern/rna_space_api.c10
-rw-r--r--source/blender/makesrna/intern/rna_speaker.c24
-rw-r--r--source/blender/makesrna/intern/rna_test.c10
-rw-r--r--source/blender/makesrna/intern/rna_text.c10
-rw-r--r--source/blender/makesrna/intern/rna_text_api.c10
-rw-r--r--source/blender/makesrna/intern/rna_texture.c72
-rw-r--r--source/blender/makesrna/intern/rna_texture_api.c11
-rw-r--r--source/blender/makesrna/intern/rna_timeline.c10
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c32
-rw-r--r--source/blender/makesrna/intern/rna_ui.c40
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c24
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c1067
-rw-r--r--source/blender/makesrna/intern/rna_vfont.c10
-rw-r--r--source/blender/makesrna/intern/rna_vfont_api.c10
-rw-r--r--source/blender/makesrna/intern/rna_wm.c48
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c145
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo.c29
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo_api.c8
-rw-r--r--source/blender/makesrna/intern/rna_workspace.c14
-rw-r--r--source/blender/makesrna/intern/rna_workspace_api.c8
-rw-r--r--source/blender/makesrna/intern/rna_world.c12
-rw-r--r--source/blender/modifiers/CMakeLists.txt8
-rw-r--r--source/blender/modifiers/MOD_modifiertypes.h10
-rw-r--r--source/blender/modifiers/intern/MOD_armature.c30
-rw-r--r--source/blender/modifiers/intern/MOD_array.c32
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c73
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c63
-rw-r--r--source/blender/modifiers/intern/MOD_build.c20
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c34
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c49
-rw-r--r--source/blender/modifiers/intern/MOD_collision.c33
-rw-r--r--source/blender/modifiers/intern/MOD_correctivesmooth.c28
-rw-r--r--source/blender/modifiers/intern/MOD_curve.c30
-rw-r--r--source/blender/modifiers/intern/MOD_datatransfer.c38
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c40
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c43
-rw-r--r--source/blender/modifiers/intern/MOD_dynamicpaint.c26
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c37
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c40
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim.c19
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c31
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.h16
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c40
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciandeform.c29
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciansmooth.c34
-rw-r--r--source/blender/modifiers/intern/MOD_lattice.c30
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c23
-rw-r--r--source/blender/modifiers/intern/MOD_meshcache.c23
-rw-r--r--source/blender/modifiers/intern/MOD_meshcache_mdd.c16
-rw-r--r--source/blender/modifiers/intern/MOD_meshcache_pc2.c16
-rw-r--r--source/blender/modifiers/intern/MOD_meshcache_util.c11
-rw-r--r--source/blender/modifiers/intern/MOD_meshcache_util.h10
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c41
-rw-r--r--source/blender/modifiers/intern/MOD_meshsequencecache.c15
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c84
-rw-r--r--source/blender/modifiers/intern/MOD_multires.c78
-rw-r--r--source/blender/modifiers/intern/MOD_none.c16
-rw-r--r--source/blender/modifiers/intern/MOD_normal_edit.c46
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c47
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c32
-rw-r--r--source/blender/modifiers/intern/MOD_particlesystem.c62
-rw-r--r--source/blender/modifiers/intern/MOD_remesh.c14
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c30
-rw-r--r--source/blender/modifiers/intern/MOD_shapekey.c19
-rw-r--r--source/blender/modifiers/intern/MOD_shrinkwrap.c43
-rw-r--r--source/blender/modifiers/intern/MOD_simpledeform.c34
-rw-r--r--source/blender/modifiers/intern/MOD_skin.c33
-rw-r--r--source/blender/modifiers/intern/MOD_smoke.c31
-rw-r--r--source/blender/modifiers/intern/MOD_smooth.c33
-rw-r--r--source/blender/modifiers/intern/MOD_softbody.c19
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c138
-rw-r--r--source/blender/modifiers/intern/MOD_subsurf.c49
-rw-r--r--source/blender/modifiers/intern/MOD_surface.c59
-rw-r--r--source/blender/modifiers/intern/MOD_surfacedeform.c77
-rw-r--r--source/blender/modifiers/intern/MOD_triangulate.c50
-rw-r--r--source/blender/modifiers/intern/MOD_util.c33
-rw-r--r--source/blender/modifiers/intern/MOD_util.h10
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c36
-rw-r--r--source/blender/modifiers/intern/MOD_uvwarp.c40
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c34
-rw-r--r--source/blender/modifiers/intern/MOD_wave.c38
-rw-r--r--source/blender/modifiers/intern/MOD_weighted_normal.c40
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c14
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.h15
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgedit.c32
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgmix.c35
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c37
-rw-r--r--source/blender/modifiers/intern/MOD_wireframe.c31
-rw-r--r--source/blender/nodes/CMakeLists.txt117
-rw-r--r--source/blender/nodes/NOD_common.h12
-rw-r--r--source/blender/nodes/NOD_composite.h12
-rw-r--r--source/blender/nodes/NOD_shader.h14
-rw-r--r--source/blender/nodes/NOD_socket.h14
-rw-r--r--source/blender/nodes/NOD_static_types.h434
-rw-r--r--source/blender/nodes/NOD_texture.h12
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c19
-rw-r--r--source/blender/nodes/composite/node_composite_util.c12
-rw-r--r--source/blender/nodes/composite/node_composite_util.h12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bilateralblur.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_blur.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehblur.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehimage.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_boxmask.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_brightness.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channelMatte.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_chromaMatte.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorMatte.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorSpill.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorbalance.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorcorrection.c17
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_common.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_composite.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_cornerpin.c15
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_crop.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_cryptomatte.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_curves.c22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_despeckle.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_dilate.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_directionalblur.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_displace.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_distanceMatte.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_ellipsemask.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_flip.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_gamma.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_glare.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_hueSatVal.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_huecorrect.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_idMask.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c37
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_inpaint.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_invert.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keying.c18
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keyingscreen.c15
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lensdist.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_levels.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lummaMatte.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapRange.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapUV.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapValue.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mask.c13
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_math.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mixrgb.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_movieclip.c15
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_moviedistortion.c17
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normal.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normalize.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_outputFile.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_pixelate.c13
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c15
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_premulkey.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rgb.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rotate.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_scale.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_setalpha.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_splitViewer.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_stabilize2d.c17
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sunbeams.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_switch.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_switchview.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_texture.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_tonemap.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_trackpos.c15
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_transform.c17
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_translate.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_valToRgb.c20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_value.c14
-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.c16
-rw-r--r--source/blender/nodes/intern/node_common.c12
-rw-r--r--source/blender/nodes/intern/node_common.h12
-rw-r--r--source/blender/nodes/intern/node_exec.c12
-rw-r--r--source/blender/nodes/intern/node_exec.h14
-rw-r--r--source/blender/nodes/intern/node_socket.c12
-rw-r--r--source/blender/nodes/intern/node_util.c12
-rw-r--r--source/blender/nodes/intern/node_util.h14
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c145
-rw-r--r--source/blender/nodes/shader/node_shader_util.c12
-rw-r--r--source/blender/nodes/shader/node_shader_util.h12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_add_shader.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_attribute.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_background.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bevel.c14
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_blackbody.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_brightness.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bump.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_camera.c14
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_common.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_curves.c56
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_displacement.c18
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_eevee_specular.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_emission.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_fresnel.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_gamma.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_geometry.c17
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hair_info.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_holdout.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hueSatVal.c21
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_ies_light.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_invert.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_layer_weight.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_light_falloff.c16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_light_path.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mapping.c16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.c14
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mixRgb.c16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mix_shader.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal.c16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal_map.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_object_info.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_light.c (renamed from source/blender/nodes/shader/nodes/node_shader_output_lamp.c)16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_linestyle.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_material.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_world.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_particle_info.c8
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_rgb.c14
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_script.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_shaderToRgb.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_squeeze.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tangent.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_brick.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_checker.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_coord.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_environment.c20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_gradient.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.c26
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_magic.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_noise.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_sky.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_wave.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_uvmap.c10
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_valToRgb.c16
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_value.c14
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vectMath.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vectTransform.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vector_displacement.c18
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_absorption.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_principled.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_scatter.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_wavelength.c12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_wireframe.c12
-rw-r--r--source/blender/nodes/texture/node_texture_tree.c16
-rw-r--r--source/blender/nodes/texture/node_texture_util.c12
-rw-r--r--source/blender/nodes/texture/node_texture_util.h12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_at.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_bricks.c14
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_checker.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_common.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_compose.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_coord.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_curves.c16
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_decompose.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_distance.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_hueSatVal.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_invert.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_math.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_mixRgb.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_output.c14
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_proc.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_rotate.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_scale.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_texture.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_translate.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_valToNor.c12
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_valToRgb.c20
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_viewer.c12
-rw-r--r--source/blender/physics/BPH_mass_spring.h18
-rw-r--r--source/blender/physics/CMakeLists.txt7
-rw-r--r--source/blender/physics/intern/BPH_mass_spring.cpp12
-rw-r--r--source/blender/physics/intern/ConstrainedConjugateGradient.h18
-rw-r--r--source/blender/physics/intern/eigen_utils.h12
-rw-r--r--source/blender/physics/intern/hair_volume.cpp14
-rw-r--r--source/blender/physics/intern/implicit.h12
-rw-r--r--source/blender/physics/intern/implicit_blender.c21
-rw-r--r--source/blender/physics/intern/implicit_eigen.cpp12
-rw-r--r--source/blender/python/BPY_extern.h25
-rw-r--r--source/blender/python/BPY_extern_clog.h8
-rw-r--r--source/blender/python/bmesh/CMakeLists.txt3
-rw-r--r--source/blender/python/bmesh/bmesh_py_api.c20
-rw-r--r--source/blender/python/bmesh/bmesh_py_api.h10
-rw-r--r--source/blender/python/bmesh/bmesh_py_geometry.c12
-rw-r--r--source/blender/python/bmesh/bmesh_py_geometry.h10
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops.c16
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops.h10
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops_call.c14
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops_call.h10
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c54
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.h10
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c14
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.h10
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c16
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.h14
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_select.c12
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_select.h10
-rw-r--r--source/blender/python/bmesh/bmesh_py_utils.c12
-rw-r--r--source/blender/python/bmesh/bmesh_py_utils.h10
-rw-r--r--source/blender/python/generic/CMakeLists.txt3
-rw-r--r--source/blender/python/generic/bgl.c471
-rw-r--r--source/blender/python/generic/bgl.h10
-rw-r--r--source/blender/python/generic/blf_py_api.c12
-rw-r--r--source/blender/python/generic/blf_py_api.h10
-rw-r--r--source/blender/python/generic/bpy_internal_import.c16
-rw-r--r--source/blender/python/generic/bpy_internal_import.h10
-rw-r--r--source/blender/python/generic/bpy_threads.c10
-rw-r--r--source/blender/python/generic/idprop_py_api.c25
-rw-r--r--source/blender/python/generic/idprop_py_api.h12
-rw-r--r--source/blender/python/generic/imbuf_py_api.c14
-rw-r--r--source/blender/python/generic/imbuf_py_api.h8
-rw-r--r--source/blender/python/generic/py_capi_utils.c38
-rw-r--r--source/blender/python/generic/py_capi_utils.h13
-rw-r--r--source/blender/python/generic/python_utildefines.h12
-rw-r--r--source/blender/python/gpu/CMakeLists.txt3
-rw-r--r--source/blender/python/gpu/gpu_py_api.c11
-rw-r--r--source/blender/python/gpu/gpu_py_api.h8
-rw-r--r--source/blender/python/gpu/gpu_py_batch.c13
-rw-r--r--source/blender/python/gpu/gpu_py_batch.h8
-rw-r--r--source/blender/python/gpu/gpu_py_element.c10
-rw-r--r--source/blender/python/gpu/gpu_py_element.h8
-rw-r--r--source/blender/python/gpu/gpu_py_matrix.c12
-rw-r--r--source/blender/python/gpu/gpu_py_matrix.h8
-rw-r--r--source/blender/python/gpu/gpu_py_offscreen.c13
-rw-r--r--source/blender/python/gpu/gpu_py_offscreen.h8
-rw-r--r--source/blender/python/gpu/gpu_py_select.c10
-rw-r--r--source/blender/python/gpu/gpu_py_select.h8
-rw-r--r--source/blender/python/gpu/gpu_py_shader.c25
-rw-r--r--source/blender/python/gpu/gpu_py_shader.h8
-rw-r--r--source/blender/python/gpu/gpu_py_types.c8
-rw-r--r--source/blender/python/gpu/gpu_py_types.h8
-rw-r--r--source/blender/python/gpu/gpu_py_vertex_buffer.c15
-rw-r--r--source/blender/python/gpu/gpu_py_vertex_buffer.h8
-rw-r--r--source/blender/python/gpu/gpu_py_vertex_format.c13
-rw-r--r--source/blender/python/gpu/gpu_py_vertex_format.h8
-rw-r--r--source/blender/python/intern/CMakeLists.txt13
-rw-r--r--source/blender/python/intern/bpy.c11
-rw-r--r--source/blender/python/intern/bpy.h14
-rw-r--r--source/blender/python/intern/bpy_app.c68
-rw-r--r--source/blender/python/intern/bpy_app.h10
-rw-r--r--source/blender/python/intern/bpy_app_alembic.c16
-rw-r--r--source/blender/python/intern/bpy_app_alembic.h12
-rw-r--r--source/blender/python/intern/bpy_app_build_options.c14
-rw-r--r--source/blender/python/intern/bpy_app_build_options.h10
-rw-r--r--source/blender/python/intern/bpy_app_ffmpeg.c14
-rw-r--r--source/blender/python/intern/bpy_app_ffmpeg.h10
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c14
-rw-r--r--source/blender/python/intern/bpy_app_handlers.h10
-rw-r--r--source/blender/python/intern/bpy_app_icons.c10
-rw-r--r--source/blender/python/intern/bpy_app_icons.h8
-rw-r--r--source/blender/python/intern/bpy_app_ocio.c14
-rw-r--r--source/blender/python/intern/bpy_app_ocio.h10
-rw-r--r--source/blender/python/intern/bpy_app_oiio.c14
-rw-r--r--source/blender/python/intern/bpy_app_oiio.h10
-rw-r--r--source/blender/python/intern/bpy_app_opensubdiv.c14
-rw-r--r--source/blender/python/intern/bpy_app_opensubdiv.h10
-rw-r--r--source/blender/python/intern/bpy_app_openvdb.c16
-rw-r--r--source/blender/python/intern/bpy_app_openvdb.h12
-rw-r--r--source/blender/python/intern/bpy_app_sdl.c14
-rw-r--r--source/blender/python/intern/bpy_app_sdl.h10
-rw-r--r--source/blender/python/intern/bpy_app_timers.c10
-rw-r--r--source/blender/python/intern/bpy_app_timers.h8
-rw-r--r--source/blender/python/intern/bpy_app_translations.c27
-rw-r--r--source/blender/python/intern/bpy_app_translations.h10
-rw-r--r--source/blender/python/intern/bpy_capi_utils.c10
-rw-r--r--source/blender/python/intern/bpy_capi_utils.h14
-rw-r--r--source/blender/python/intern/bpy_driver.c19
-rw-r--r--source/blender/python/intern/bpy_driver.h10
-rw-r--r--source/blender/python/intern/bpy_gizmo_wrap.c10
-rw-r--r--source/blender/python/intern/bpy_gizmo_wrap.h10
-rw-r--r--source/blender/python/intern/bpy_interface.c24
-rw-r--r--source/blender/python/intern/bpy_interface_atexit.c10
-rw-r--r--source/blender/python/intern/bpy_intern_string.c10
-rw-r--r--source/blender/python/intern/bpy_intern_string.h10
-rw-r--r--source/blender/python/intern/bpy_library.h10
-rw-r--r--source/blender/python/intern/bpy_library_load.c10
-rw-r--r--source/blender/python/intern/bpy_library_write.c10
-rw-r--r--source/blender/python/intern/bpy_msgbus.c14
-rw-r--r--source/blender/python/intern/bpy_msgbus.h8
-rw-r--r--source/blender/python/intern/bpy_operator.c15
-rw-r--r--source/blender/python/intern/bpy_operator.h10
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c10
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.h10
-rw-r--r--source/blender/python/intern/bpy_path.c10
-rw-r--r--source/blender/python/intern/bpy_path.h10
-rw-r--r--source/blender/python/intern/bpy_props.c38
-rw-r--r--source/blender/python/intern/bpy_props.h10
-rw-r--r--source/blender/python/intern/bpy_rna.c94
-rw-r--r--source/blender/python/intern/bpy_rna.h12
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c188
-rw-r--r--source/blender/python/intern/bpy_rna_anim.h10
-rw-r--r--source/blender/python/intern/bpy_rna_array.c11
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c35
-rw-r--r--source/blender/python/intern/bpy_rna_callback.h10
-rw-r--r--source/blender/python/intern/bpy_rna_driver.c8
-rw-r--r--source/blender/python/intern/bpy_rna_driver.h8
-rw-r--r--source/blender/python/intern/bpy_rna_gizmo.c9
-rw-r--r--source/blender/python/intern/bpy_rna_gizmo.h10
-rw-r--r--source/blender/python/intern/bpy_rna_id_collection.c190
-rw-r--r--source/blender/python/intern/bpy_rna_id_collection.h10
-rw-r--r--source/blender/python/intern/bpy_traceback.c8
-rw-r--r--source/blender/python/intern/bpy_traceback.h8
-rw-r--r--source/blender/python/intern/bpy_utils_previews.c14
-rw-r--r--source/blender/python/intern/bpy_utils_previews.h10
-rw-r--r--source/blender/python/intern/bpy_utils_units.c19
-rw-r--r--source/blender/python/intern/bpy_utils_units.h10
-rw-r--r--source/blender/python/intern/stubs.c11
-rw-r--r--source/blender/python/mathutils/CMakeLists.txt3
-rw-r--r--source/blender/python/mathutils/mathutils.c12
-rw-r--r--source/blender/python/mathutils/mathutils.h10
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c14
-rw-r--r--source/blender/python/mathutils/mathutils_Color.h11
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c14
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.h11
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c22
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.h10
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c14
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.h10
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c18
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.h10
-rw-r--r--source/blender/python/mathutils/mathutils_bvhtree.c31
-rw-r--r--source/blender/python/mathutils/mathutils_bvhtree.h8
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c12
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.h10
-rw-r--r--source/blender/python/mathutils/mathutils_interpolate.c12
-rw-r--r--source/blender/python/mathutils/mathutils_interpolate.h10
-rw-r--r--source/blender/python/mathutils/mathutils_kdtree.c12
-rw-r--r--source/blender/python/mathutils/mathutils_kdtree.h8
-rw-r--r--source/blender/python/mathutils/mathutils_noise.c18
-rw-r--r--source/blender/python/mathutils/mathutils_noise.h10
-rw-r--r--source/blender/python/rna_dump.py2
-rw-r--r--source/blender/python/simple_enum_gen.py6
-rw-r--r--source/blender/render/CMakeLists.txt9
-rw-r--r--source/blender/render/extern/include/RE_bake.h16
-rw-r--r--source/blender/render/extern/include/RE_engine.h35
-rw-r--r--source/blender/render/extern/include/RE_multires_bake.h13
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h23
-rw-r--r--source/blender/render/extern/include/RE_render_ext.h14
-rw-r--r--source/blender/render/extern/include/RE_shader_ext.h16
-rw-r--r--source/blender/render/intern/include/initrender.h12
-rw-r--r--source/blender/render/intern/include/render_result.h22
-rw-r--r--source/blender/render/intern/include/render_types.h20
-rw-r--r--source/blender/render/intern/include/renderpipeline.h12
-rw-r--r--source/blender/render/intern/include/texture.h18
-rw-r--r--source/blender/render/intern/include/zbuf.h15
-rw-r--r--source/blender/render/intern/source/bake_api.c12
-rw-r--r--source/blender/render/intern/source/external_engine.c64
-rw-r--r--source/blender/render/intern/source/imagetexture.c10
-rw-r--r--source/blender/render/intern/source/initrender.c18
-rw-r--r--source/blender/render/intern/source/multires_bake.c13
-rw-r--r--source/blender/render/intern/source/pipeline.c97
-rw-r--r--source/blender/render/intern/source/pointdensity.c20
-rw-r--r--source/blender/render/intern/source/render_result.c131
-rw-r--r--source/blender/render/intern/source/render_texture.c14
-rw-r--r--source/blender/render/intern/source/zbuf.c11
-rw-r--r--source/blender/shader_fx/CMakeLists.txt2
-rw-r--r--source/blender/shader_fx/FX_shader_types.h10
-rw-r--r--source/blender/shader_fx/intern/FX_shader_blur.c11
-rw-r--r--source/blender/shader_fx/intern/FX_shader_colorize.c11
-rw-r--r--source/blender/shader_fx/intern/FX_shader_flip.c12
-rw-r--r--source/blender/shader_fx/intern/FX_shader_glow.c13
-rw-r--r--source/blender/shader_fx/intern/FX_shader_light.c12
-rw-r--r--source/blender/shader_fx/intern/FX_shader_pixel.c11
-rw-r--r--source/blender/shader_fx/intern/FX_shader_rim.c11
-rw-r--r--source/blender/shader_fx/intern/FX_shader_shadow.c12
-rw-r--r--source/blender/shader_fx/intern/FX_shader_swirl.c11
-rw-r--r--source/blender/shader_fx/intern/FX_shader_util.c11
-rw-r--r--source/blender/shader_fx/intern/FX_shader_util.h12
-rw-r--r--source/blender/shader_fx/intern/FX_shader_wave.c11
-rw-r--r--source/blender/windowmanager/CMakeLists.txt5
-rw-r--r--source/blender/windowmanager/WM_api.h96
-rw-r--r--source/blender/windowmanager/WM_keymap.h14
-rw-r--r--source/blender/windowmanager/WM_message.h8
-rw-r--r--source/blender/windowmanager/WM_toolsystem.h31
-rw-r--r--source/blender/windowmanager/WM_types.h25
-rw-r--r--source/blender/windowmanager/gizmo/WM_gizmo_api.h27
-rw-r--r--source/blender/windowmanager/gizmo/WM_gizmo_types.h161
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo.c31
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c47
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c10
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h20
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c162
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c14
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c12
-rw-r--r--source/blender/windowmanager/gizmo/wm_gizmo_fn.h8
-rw-r--r--source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h19
-rw-r--r--source/blender/windowmanager/intern/wm.c35
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c570
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c32
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c19
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c874
-rw-r--r--source/blender/windowmanager/intern/wm_files.c129
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c24
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c20
-rw-r--r--source/blender/windowmanager/intern/wm_gesture_ops.c18
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c43
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c12
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c189
-rw-r--r--source/blender/windowmanager/intern/wm_keymap_utils.c14
-rw-r--r--source/blender/windowmanager/intern/wm_menu_type.c8
-rw-r--r--source/blender/windowmanager/intern/wm_operator_props.c54
-rw-r--r--source/blender/windowmanager/intern/wm_operator_type.c14
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c79
-rw-r--r--source/blender/windowmanager/intern/wm_panel_type.c8
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c52
-rw-r--r--source/blender/windowmanager/intern/wm_stereo.c15
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c10
-rw-r--r--source/blender/windowmanager/intern/wm_toolsystem.c18
-rw-r--r--source/blender/windowmanager/intern/wm_tooltip.c8
-rw-r--r--source/blender/windowmanager/intern/wm_uilist_type.c9
-rw-r--r--source/blender/windowmanager/intern/wm_window.c131
-rw-r--r--source/blender/windowmanager/message_bus/intern/wm_message_bus.c12
-rw-r--r--source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.h8
-rw-r--r--source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c51
-rw-r--r--source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c8
-rw-r--r--source/blender/windowmanager/message_bus/wm_message_bus.h12
-rw-r--r--source/blender/windowmanager/wm.h13
-rw-r--r--source/blender/windowmanager/wm_cursors.h27
-rw-r--r--source/blender/windowmanager/wm_draw.h15
-rw-r--r--source/blender/windowmanager/wm_event_system.h128
-rw-r--r--source/blender/windowmanager/wm_event_types.h16
-rw-r--r--source/blender/windowmanager/wm_files.h11
-rw-r--r--source/blender/windowmanager/wm_window.h18
-rw-r--r--source/creator/CMakeLists.txt35
-rw-r--r--source/creator/buildinfo.c12
-rw-r--r--source/creator/creator.c30
-rw-r--r--source/creator/creator_args.c88
-rw-r--r--source/creator/creator_intern.h9
-rw-r--r--source/creator/creator_signals.c15
3475 files changed, 68382 insertions, 67985 deletions
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index acc354a9d0a..c51858d9d2a 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
if(WITH_LEGACY_OPENGL)
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 0040168d4af..f81905dee15 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(SRC_DNA_INC
@@ -51,16 +46,16 @@ set(SRC_DNA_INC
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_image_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_ipo_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_key_types.h
- ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_lamp_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_lattice_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_layer_types.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_light_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_lightprobe_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_linestyle_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_listBase.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_mask_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_material_types.h
- ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_meshdata_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_mesh_types.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_meshdata_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_meta_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_modifier_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_movieclip_types.h
diff --git a/source/blender/alembic/ABC_alembic.h b/source/blender/alembic/ABC_alembic.h
index 08136fc2f49..bc3a1699044 100644
--- a/source/blender/alembic/ABC_alembic.h
+++ b/source/blender/alembic/ABC_alembic.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_ALEMBIC_H__
@@ -27,12 +25,12 @@
extern "C" {
#endif
-struct bContext;
struct CacheReader;
struct ListBase;
struct Mesh;
struct Object;
struct Scene;
+struct bContext;
typedef struct AbcArchiveHandle AbcArchiveHandle;
@@ -58,6 +56,7 @@ struct AlembicExportParams {
bool normals;
bool vcolors;
bool apply_subdiv;
+ bool curves_as_mesh;
bool flatten_hierarchy;
bool visible_layers_only;
bool renderable_only;
diff --git a/source/blender/alembic/CMakeLists.txt b/source/blender/alembic/CMakeLists.txt
index d3b5e189292..813653b74c0 100644
--- a/source/blender/alembic/CMakeLists.txt
+++ b/source/blender/alembic/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Kevin Dietrich.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -48,8 +43,8 @@ set(INC_SYS
set(SRC
intern/abc_archive.cc
intern/abc_camera.cc
- intern/abc_customdata.cc
intern/abc_curves.cc
+ intern/abc_customdata.cc
intern/abc_exporter.cc
intern/abc_hair.cc
intern/abc_mball.cc
@@ -64,8 +59,8 @@ set(SRC
ABC_alembic.h
intern/abc_archive.h
intern/abc_camera.h
- intern/abc_customdata.h
intern/abc_curves.h
+ intern/abc_customdata.h
intern/abc_exporter.h
intern/abc_hair.h
intern/abc_mball.h
diff --git a/source/blender/alembic/intern/abc_archive.cc b/source/blender/alembic/intern/abc_archive.cc
index bd16196cb78..7bd3e5af66a 100644
--- a/source/blender/alembic/intern/abc_archive.cc
+++ b/source/blender/alembic/intern/abc_archive.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,9 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Kévin Dietrich.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_archive.h"
diff --git a/source/blender/alembic/intern/abc_archive.h b/source/blender/alembic/intern/abc_archive.h
index 5696aed9ef3..ced55f56eac 100644
--- a/source/blender/alembic/intern/abc_archive.h
+++ b/source/blender/alembic/intern/abc_archive.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,9 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Kévin Dietrich.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_ARCHIVE_H__
diff --git a/source/blender/alembic/intern/abc_camera.cc b/source/blender/alembic/intern/abc_camera.cc
index 457bbd2b3af..572e825299b 100644
--- a/source/blender/alembic/intern/abc_camera.cc
+++ b/source/blender/alembic/intern/abc_camera.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_camera.h"
@@ -79,8 +77,8 @@ void AbcCameraWriter::do_write()
m_camera_sample.setVerticalAperture(apperture_y);
m_camera_sample.setHorizontalFilmOffset(apperture_x * cam->shiftx);
m_camera_sample.setVerticalFilmOffset(apperture_y * cam->shifty * film_aspect);
- m_camera_sample.setNearClippingPlane(cam->clipsta);
- m_camera_sample.setFarClippingPlane(cam->clipend);
+ m_camera_sample.setNearClippingPlane(cam->clip_start);
+ m_camera_sample.setFarClippingPlane(cam->clip_end);
if (cam->dof_ob) {
Imath::V3f v(m_object->loc[0] - cam->dof_ob->loc[0],
@@ -165,8 +163,8 @@ void AbcCameraReader::readObjectData(Main *bmain, const ISampleSelector &sample_
bcam->sensor_y = apperture_y * 10;
bcam->shiftx = h_film_offset / apperture_x;
bcam->shifty = v_film_offset / apperture_y / film_aspect;
- bcam->clipsta = max_ff(0.1f, static_cast<float>(cam_sample.getNearClippingPlane()));
- bcam->clipend = static_cast<float>(cam_sample.getFarClippingPlane());
+ bcam->clip_start = max_ff(0.1f, static_cast<float>(cam_sample.getNearClippingPlane()));
+ bcam->clip_end = static_cast<float>(cam_sample.getFarClippingPlane());
bcam->gpu_dof.focus_distance = static_cast<float>(cam_sample.getFocusDistance());
bcam->gpu_dof.fstop = static_cast<float>(cam_sample.getFStop());
diff --git a/source/blender/alembic/intern/abc_camera.h b/source/blender/alembic/intern/abc_camera.h
index dd5dc28d598..a5cd8373dc0 100644
--- a/source/blender/alembic/intern/abc_camera.h
+++ b/source/blender/alembic/intern/abc_camera.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_CAMERA_H__
diff --git a/source/blender/alembic/intern/abc_curves.cc b/source/blender/alembic/intern/abc_curves.cc
index 9501c643e32..28c0ad05c49 100644
--- a/source/blender/alembic/intern/abc_curves.cc
+++ b/source/blender/alembic/intern/abc_curves.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,9 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Kévin Dietrich.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_curves.h"
@@ -194,6 +193,27 @@ void AbcCurveWriter::do_write()
m_schema.set(m_sample);
}
+
+AbcCurveMeshWriter::AbcCurveMeshWriter(Object *ob,
+ AbcTransformWriter *parent,
+ uint32_t time_sampling,
+ ExportSettings &settings)
+ : AbcGenericMeshWriter(ob, parent, time_sampling, settings)
+{}
+
+Mesh *AbcCurveMeshWriter::getEvaluatedMesh(Scene * /*scene_eval*/, Object *ob_eval, bool &r_needsfree)
+{
+ if (ob_eval->runtime.mesh_eval != NULL) {
+ /* Mesh_eval only exists when generative modifiers are in use. */
+ r_needsfree = false;
+ return ob_eval->runtime.mesh_eval;
+ }
+
+ r_needsfree = true;
+ return BKE_mesh_new_nomain_from_curve(ob_eval);
+}
+
+
/* ************************************************************************** */
AbcCurveReader::AbcCurveReader(const Alembic::Abc::IObject &object, ImportSettings &settings)
diff --git a/source/blender/alembic/intern/abc_curves.h b/source/blender/alembic/intern/abc_curves.h
index eb80553620d..e03feceed64 100644
--- a/source/blender/alembic/intern/abc_curves.h
+++ b/source/blender/alembic/intern/abc_curves.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,17 @@
*
* The Original Code is Copyright (C) 2016 Kévin Dietrich.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_CURVES_H__
#define __ABC_CURVES_H__
#include "abc_object.h"
+#include "abc_mesh.h"
struct Curve;
@@ -41,9 +41,21 @@ public:
uint32_t time_sampling,
ExportSettings &settings);
+protected:
void do_write();
};
+class AbcCurveMeshWriter : public AbcGenericMeshWriter {
+public:
+ AbcCurveMeshWriter(Object *ob,
+ AbcTransformWriter *parent,
+ uint32_t time_sampling,
+ ExportSettings &settings);
+
+protected:
+ Mesh *getEvaluatedMesh(Scene *scene_eval, Object *ob_eval, bool &r_needsfree);
+};
+
/* ************************************************************************** */
class AbcCurveReader : public AbcObjectReader {
diff --git a/source/blender/alembic/intern/abc_customdata.cc b/source/blender/alembic/intern/abc_customdata.cc
index 89ee753c618..09875fda6b0 100644
--- a/source/blender/alembic/intern/abc_customdata.cc
+++ b/source/blender/alembic/intern/abc_customdata.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,9 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Kévin Dietrich.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_customdata.h"
diff --git a/source/blender/alembic/intern/abc_customdata.h b/source/blender/alembic/intern/abc_customdata.h
index b3072a2c9f7..88520b47a55 100644
--- a/source/blender/alembic/intern/abc_customdata.h
+++ b/source/blender/alembic/intern/abc_customdata.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,9 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Kévin Dietrich.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_CUSTOMDATA_H__
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index ff1465103eb..3f2ccab203d 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_exporter.h"
@@ -598,7 +596,14 @@ void AbcExporter::createShapeWriter(Object *ob, Object *dupliObParent)
return;
}
- m_shapes.push_back(new AbcNurbsWriter(ob, xform, m_shape_sampling_index, m_settings));
+ AbcObjectWriter *writer;
+ if (m_settings.curves_as_mesh) {
+ writer = new AbcCurveMeshWriter(ob, xform, m_shape_sampling_index, m_settings);
+ }
+ else {
+ writer = new AbcNurbsWriter(ob, xform, m_shape_sampling_index, m_settings);
+ }
+ m_shapes.push_back(writer);
break;
}
case OB_CURVE:
@@ -609,7 +614,14 @@ void AbcExporter::createShapeWriter(Object *ob, Object *dupliObParent)
return;
}
- m_shapes.push_back(new AbcCurveWriter(ob, xform, m_shape_sampling_index, m_settings));
+ AbcObjectWriter *writer;
+ if (m_settings.curves_as_mesh) {
+ writer = new AbcCurveMeshWriter(ob, xform, m_shape_sampling_index, m_settings);
+ }
+ else {
+ writer = new AbcCurveWriter(ob, xform, m_shape_sampling_index, m_settings);
+ }
+ m_shapes.push_back(writer);
break;
}
case OB_CAMERA:
diff --git a/source/blender/alembic/intern/abc_exporter.h b/source/blender/alembic/intern/abc_exporter.h
index 74af85bfef9..d9628317036 100644
--- a/source/blender/alembic/intern/abc_exporter.h
+++ b/source/blender/alembic/intern/abc_exporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_EXPORTER_H__
@@ -34,12 +32,12 @@ class AbcObjectWriter;
class AbcTransformWriter;
class ArchiveWriter;
+struct Base;
struct Depsgraph;
struct Main;
struct Object;
struct Scene;
struct ViewLayer;
-struct Base;
struct ExportSettings {
ExportSettings();
@@ -71,6 +69,7 @@ struct ExportSettings {
bool export_particles;
bool apply_subdiv;
+ bool curves_as_mesh;
bool use_subdiv_schema;
bool export_child_hairs;
bool export_ogawa;
diff --git a/source/blender/alembic/intern/abc_hair.cc b/source/blender/alembic/intern/abc_hair.cc
index efe8ea6e79e..a587e2a2cd1 100644
--- a/source/blender/alembic/intern/abc_hair.cc
+++ b/source/blender/alembic/intern/abc_hair.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_hair.h"
@@ -71,7 +69,7 @@ void AbcHairWriter::do_write()
if (!m_psys) {
return;
}
- Mesh *mesh = mesh_get_eval_final(m_settings.depsgraph, m_settings.scene, m_object, CD_MASK_MESH);
+ Mesh *mesh = mesh_get_eval_final(m_settings.depsgraph, m_settings.scene, m_object, &CD_MASK_MESH);
BKE_mesh_tessface_ensure(mesh);
std::vector<Imath::V3f> verts;
diff --git a/source/blender/alembic/intern/abc_hair.h b/source/blender/alembic/intern/abc_hair.h
index e2dffd4edaf..7b6500196a3 100644
--- a/source/blender/alembic/intern/abc_hair.h
+++ b/source/blender/alembic/intern/abc_hair.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_HAIR_H__
diff --git a/source/blender/alembic/intern/abc_mball.cc b/source/blender/alembic/intern/abc_mball.cc
index c7b2d0c88a5..d31c251f64d 100644
--- a/source/blender/alembic/intern/abc_mball.cc
+++ b/source/blender/alembic/intern/abc_mball.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Sybren A. Stüvel
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_mball.h"
@@ -55,7 +53,7 @@ AbcMBallWriter::AbcMBallWriter(
m_mesh_ob->runtime.curve_cache = (CurveCache *)MEM_callocN(
sizeof(CurveCache),
"CurveCache for AbcMBallWriter");
-
+ /* TODO(Sybren): reimplement metaball writing as subclass of AbcGenericMeshWriter. */
m_mesh_writer = new AbcMeshWriter(m_mesh_ob, parent, time_sampling, settings);
m_mesh_writer->setIsAnimated(m_is_animated);
}
diff --git a/source/blender/alembic/intern/abc_mball.h b/source/blender/alembic/intern/abc_mball.h
index 07cb1908e95..629a584e89e 100644
--- a/source/blender/alembic/intern/abc_mball.h
+++ b/source/blender/alembic/intern/abc_mball.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Sybren A. Stüvel
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_MBALL_H__
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 50698ef728e..e7771827b2b 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_mesh.h"
@@ -38,6 +36,8 @@ extern "C" {
#include "BLI_math_geom.h"
#include "BLI_string.h"
+#include "BKE_animsys.h"
+#include "BKE_key.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_material.h"
@@ -289,10 +289,10 @@ static ModifierData *get_liquid_sim_modifier(Scene *scene, Object *ob)
/* ************************************************************************** */
-AbcMeshWriter::AbcMeshWriter(Object *ob,
- AbcTransformWriter *parent,
- uint32_t time_sampling,
- ExportSettings &settings)
+AbcGenericMeshWriter::AbcGenericMeshWriter(Object *ob,
+ AbcTransformWriter *parent,
+ uint32_t time_sampling,
+ ExportSettings &settings)
: AbcObjectWriter(ob, time_sampling, settings, parent)
{
m_is_animated = isAnimated();
@@ -329,26 +329,32 @@ AbcMeshWriter::AbcMeshWriter(Object *ob,
}
}
-AbcMeshWriter::~AbcMeshWriter()
+AbcGenericMeshWriter::~AbcGenericMeshWriter()
{
if (m_subsurf_mod) {
m_subsurf_mod->mode &= ~eModifierMode_DisableTemporary;
}
}
-bool AbcMeshWriter::isAnimated() const
+bool AbcGenericMeshWriter::isAnimated() const
{
- /* Check if object has shape keys. */
- Mesh *me = static_cast<Mesh *>(m_object->data);
-
- if (me->key) {
+ if (m_object->data != NULL) {
+ AnimData *adt = BKE_animdata_from_id(static_cast<ID*>(m_object->data));
+ /* TODO(Sybren): make this check more strict, as the AnimationData may
+ * actually be empty (no fcurves, drivers, etc.) and thus effectively
+ * have no animation at all. */
+ if (adt != NULL) {
+ return true;
+ }
+ }
+ if (BKE_key_from_object(m_object) != NULL) {
return true;
}
/* Test modifiers. */
ModifierData *md = static_cast<ModifierData *>(m_object->modifiers.first);
-
while (md) {
+
if (md->type != eModifierType_Subsurf) {
return true;
}
@@ -356,15 +362,15 @@ bool AbcMeshWriter::isAnimated() const
md = md->next;
}
- return me->adt != NULL;
+ return false;
}
-void AbcMeshWriter::setIsAnimated(bool is_animated)
+void AbcGenericMeshWriter::setIsAnimated(bool is_animated)
{
m_is_animated = is_animated;
}
-void AbcMeshWriter::do_write()
+void AbcGenericMeshWriter::do_write()
{
/* We have already stored a sample for this object. */
if (!m_first_frame && !m_is_animated)
@@ -389,7 +395,7 @@ void AbcMeshWriter::do_write()
}
}
-void AbcMeshWriter::writeMesh(struct Mesh *mesh)
+void AbcGenericMeshWriter::writeMesh(struct Mesh *mesh)
{
std::vector<Imath::V3f> points, normals;
std::vector<int32_t> poly_verts, loop_counts;
@@ -455,7 +461,7 @@ void AbcMeshWriter::writeMesh(struct Mesh *mesh)
writeArbGeoParams(mesh);
}
-void AbcMeshWriter::writeSubD(struct Mesh *mesh)
+void AbcGenericMeshWriter::writeSubD(struct Mesh *mesh)
{
std::vector<float> crease_sharpness;
std::vector<Imath::V3f> points;
@@ -506,12 +512,12 @@ void AbcMeshWriter::writeSubD(struct Mesh *mesh)
}
template <typename Schema>
-void AbcMeshWriter::writeFaceSets(struct Mesh *me, Schema &schema)
+void AbcGenericMeshWriter::writeFaceSets(struct Mesh *me, Schema &schema)
{
- std::map< std::string, std::vector<int32_t> > geo_groups;
+ std::map< std::string, std::vector<int32_t>> geo_groups;
getGeoGroups(me, geo_groups);
- std::map< std::string, std::vector<int32_t> >::iterator it;
+ std::map< std::string, std::vector<int32_t>>::iterator it;
for (it = geo_groups.begin(); it != geo_groups.end(); ++it) {
OFaceSet face_set = schema.createFaceSet(it->first);
OFaceSetSchema::Sample samp;
@@ -520,17 +526,18 @@ void AbcMeshWriter::writeFaceSets(struct Mesh *me, Schema &schema)
}
}
-Mesh *AbcMeshWriter::getFinalMesh(bool &r_needsfree)
+Mesh *AbcGenericMeshWriter::getFinalMesh(bool &r_needsfree)
{
/* We don't want subdivided mesh data */
if (m_subsurf_mod) {
m_subsurf_mod->mode |= eModifierMode_DisableTemporary;
}
+ r_needsfree = false;
+
Scene *scene = DEG_get_evaluated_scene(m_settings.depsgraph);
Object *ob_eval = DEG_get_evaluated_object(m_settings.depsgraph, m_object);
- struct Mesh *mesh = mesh_get_eval_final(m_settings.depsgraph, scene, ob_eval, CD_MASK_MESH);
- r_needsfree = false;
+ struct Mesh *mesh = getEvaluatedMesh(scene, ob_eval, r_needsfree);
if (m_subsurf_mod) {
m_subsurf_mod->mode &= ~eModifierMode_DisableTemporary;
@@ -547,9 +554,13 @@ Mesh *AbcMeshWriter::getFinalMesh(bool &r_needsfree)
BM_mesh_triangulate(bm, quad_method, ngon_method, tag_only, NULL, NULL, NULL);
- Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0);
+ Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL);
BM_mesh_free(bm);
+ if (r_needsfree) {
+ BKE_id_free(NULL, mesh);
+ }
+
mesh = result;
r_needsfree = true;
}
@@ -564,7 +575,7 @@ Mesh *AbcMeshWriter::getFinalMesh(bool &r_needsfree)
return mesh;
}
-void AbcMeshWriter::writeArbGeoParams(struct Mesh *me)
+void AbcGenericMeshWriter::writeArbGeoParams(struct Mesh *me)
{
if (m_is_liquid) {
/* We don't need anything more for liquid meshes. */
@@ -581,7 +592,7 @@ void AbcMeshWriter::writeArbGeoParams(struct Mesh *me)
}
}
-void AbcMeshWriter::getVelocities(struct Mesh *mesh, std::vector<Imath::V3f> &vels)
+void AbcGenericMeshWriter::getVelocities(struct Mesh *mesh, std::vector<Imath::V3f> &vels)
{
const int totverts = mesh->totvert;
@@ -605,9 +616,9 @@ void AbcMeshWriter::getVelocities(struct Mesh *mesh, std::vector<Imath::V3f> &ve
}
}
-void AbcMeshWriter::getGeoGroups(
+void AbcGenericMeshWriter::getGeoGroups(
struct Mesh *mesh,
- std::map<std::string, std::vector<int32_t> > &geo_groups)
+ std::map<std::string, std::vector<int32_t>> &geo_groups)
{
const int num_poly = mesh->totpoly;
MPoly *polygons = mesh->mpoly;
@@ -647,6 +658,23 @@ void AbcMeshWriter::getGeoGroups(
}
}
+
+AbcMeshWriter::AbcMeshWriter(Object *ob,
+ AbcTransformWriter *parent,
+ uint32_t time_sampling,
+ ExportSettings &settings)
+ : AbcGenericMeshWriter(ob, parent, time_sampling, settings)
+{}
+
+AbcMeshWriter::~AbcMeshWriter()
+{}
+
+Mesh *AbcMeshWriter::getEvaluatedMesh(Scene *scene_eval, Object *ob_eval, bool &UNUSED(r_needsfree))
+{
+ return mesh_get_eval_final(m_settings.depsgraph, scene_eval, ob_eval, &CD_MASK_MESH);
+}
+
+
/* ************************************************************************** */
/* Some helpers for mesh generation */
@@ -654,7 +682,7 @@ namespace utils {
static void build_mat_map(const Main *bmain, std::map<std::string, Material *> &mat_map)
{
- Material *material = static_cast<Material *>(bmain->mat.first);
+ Material *material = static_cast<Material *>(bmain->materials.first);
for (; material; material = static_cast<Material *>(material->id.next)) {
mat_map[material->id.name + 2] = material;
@@ -1031,7 +1059,7 @@ void AbcMeshReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec
m_object->data = mesh;
Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, NULL);
- BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, CD_MASK_MESH, true);
+ BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, &CD_MASK_MESH, true);
if (m_settings->validate_meshes) {
BKE_mesh_validate(mesh, false, false);
@@ -1314,7 +1342,7 @@ void AbcSubDReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec
m_object->data = mesh;
Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, NULL);
- BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, CD_MASK_MESH, true);
+ BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, &CD_MASK_MESH, true);
ISubDSchema::Sample sample;
try {
diff --git a/source/blender/alembic/intern/abc_mesh.h b/source/blender/alembic/intern/abc_mesh.h
index fd6de1001ae..938c292b686 100644
--- a/source/blender/alembic/intern/abc_mesh.h
+++ b/source/blender/alembic/intern/abc_mesh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_MESH_H__
@@ -31,7 +29,9 @@ struct ModifierData;
/* ************************************************************************** */
-class AbcMeshWriter : public AbcObjectWriter {
+/* Writer for Alembic meshes. Does not assume the object is a mesh object. */
+class AbcGenericMeshWriter : public AbcObjectWriter {
+protected:
Alembic::AbcGeom::OPolyMeshSchema m_mesh_schema;
Alembic::AbcGeom::OPolyMeshSchema::Sample m_mesh_sample;
@@ -49,35 +49,26 @@ class AbcMeshWriter : public AbcObjectWriter {
bool m_is_subd;
public:
- AbcMeshWriter(Object *ob,
- AbcTransformWriter *parent,
- uint32_t time_sampling,
- ExportSettings &settings);
+ AbcGenericMeshWriter(Object *ob,
+ AbcTransformWriter *parent,
+ uint32_t time_sampling,
+ ExportSettings &settings);
- ~AbcMeshWriter();
+ ~AbcGenericMeshWriter();
void setIsAnimated(bool is_animated);
-private:
+protected:
virtual void do_write();
+ virtual bool isAnimated() const;
+ virtual Mesh *getEvaluatedMesh(Scene *scene_eval, Object *ob_eval, bool &r_needsfree) = 0;
- bool isAnimated() const;
+ Mesh *getFinalMesh(bool &r_needsfree);
void writeMesh(struct Mesh *mesh);
void writeSubD(struct Mesh *mesh);
- void getMeshInfo(struct Mesh *mesh, std::vector<float> &points,
- std::vector<int32_t> &facePoints,
- std::vector<int32_t> &faceCounts,
- std::vector<int32_t> &creaseIndices,
- std::vector<int32_t> &creaseLengths,
- std::vector<float> &creaseSharpness);
-
- struct Mesh *getFinalMesh(bool &r_needsfree);
-
- void getMaterialIndices(struct Mesh *mesh, std::vector<int32_t> &indices);
-
void writeArbGeoParams(struct Mesh *mesh);
- void getGeoGroups(struct Mesh *mesh, std::map<std::string, std::vector<int32_t> > &geoGroups);
+ void getGeoGroups(struct Mesh *mesh, std::map<std::string, std::vector<int32_t>> &geoGroups);
/* fluid surfaces support */
void getVelocities(struct Mesh *mesh, std::vector<Imath::V3f> &vels);
@@ -86,6 +77,20 @@ private:
void writeFaceSets(struct Mesh *mesh, Schema &schema);
};
+
+class AbcMeshWriter : public AbcGenericMeshWriter {
+public:
+ AbcMeshWriter(Object *ob,
+ AbcTransformWriter *parent,
+ uint32_t time_sampling,
+ ExportSettings &settings);
+
+ ~AbcMeshWriter();
+protected:
+ virtual Mesh *getEvaluatedMesh(Scene *scene_eval, Object *ob_eval, bool &r_needsfree) override;
+};
+
+
/* ************************************************************************** */
class AbcMeshReader : public AbcObjectReader {
diff --git a/source/blender/alembic/intern/abc_nurbs.cc b/source/blender/alembic/intern/abc_nurbs.cc
index fcb2f5c5ec5..b0cc9fc2c6b 100644
--- a/source/blender/alembic/intern/abc_nurbs.cc
+++ b/source/blender/alembic/intern/abc_nurbs.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_nurbs.h"
@@ -209,7 +207,7 @@ bool AbcNurbsReader::valid() const
return false;
}
- std::vector< std::pair<INuPatchSchema, IObject> >::const_iterator it;
+ std::vector<std::pair<INuPatchSchema, IObject>>::const_iterator it;
for (it = m_schemas.begin(); it != m_schemas.end(); ++it) {
const INuPatchSchema &schema = it->first;
@@ -243,7 +241,7 @@ void AbcNurbsReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSele
Curve *cu = static_cast<Curve *>(BKE_curve_add(bmain, "abc_curve", OB_SURF));
cu->actvert = CU_ACT_NONE;
- std::vector< std::pair<INuPatchSchema, IObject> >::iterator it;
+ std::vector<std::pair<INuPatchSchema, IObject>>::iterator it;
for (it = m_schemas.begin(); it != m_schemas.end(); ++it) {
Nurb *nu = static_cast<Nurb *>(MEM_callocN(sizeof(Nurb), "abc_getnurb"));
diff --git a/source/blender/alembic/intern/abc_nurbs.h b/source/blender/alembic/intern/abc_nurbs.h
index 827aa4b365f..89c54ba9c16 100644
--- a/source/blender/alembic/intern/abc_nurbs.h
+++ b/source/blender/alembic/intern/abc_nurbs.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_NURBS_H__
@@ -46,7 +44,7 @@ private:
/* ************************************************************************** */
class AbcNurbsReader : public AbcObjectReader {
- std::vector< std::pair<Alembic::AbcGeom::INuPatchSchema, Alembic::Abc::IObject> > m_schemas;
+ std::vector<std::pair<Alembic::AbcGeom::INuPatchSchema, Alembic::Abc::IObject>> m_schemas;
public:
AbcNurbsReader(const Alembic::Abc::IObject &object, ImportSettings &settings);
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 7e0b1ccfbd4..48aa65717dd 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_object.h"
diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h
index 8794cb61708..d87bfb315d9 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_OBJECT_H__
@@ -49,7 +47,7 @@ protected:
Imath::Box3d m_bounds;
std::vector<AbcObjectWriter *> m_children;
- std::vector< std::pair<std::string, IDProperty *> > m_props;
+ std::vector<std::pair<std::string, IDProperty *>> m_props;
bool m_first_frame;
std::string m_name;
diff --git a/source/blender/alembic/intern/abc_points.cc b/source/blender/alembic/intern/abc_points.cc
index c748139a0e6..d9b78f83ff5 100644
--- a/source/blender/alembic/intern/abc_points.cc
+++ b/source/blender/alembic/intern/abc_points.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,9 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Kévin Dietrich.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_points.h"
@@ -175,7 +174,7 @@ void AbcPointsReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSel
Mesh *mesh = BKE_mesh_add(bmain, m_data_name.c_str());
Mesh *read_mesh = this->read_mesh(mesh, sample_sel, 0, NULL);
- BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, CD_MASK_MESH, true);
+ BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, &CD_MASK_MESH, true);
if (m_settings->validate_meshes) {
BKE_mesh_validate(mesh, false, false);
diff --git a/source/blender/alembic/intern/abc_points.h b/source/blender/alembic/intern/abc_points.h
index e986f9448f4..64c032d6c2f 100644
--- a/source/blender/alembic/intern/abc_points.h
+++ b/source/blender/alembic/intern/abc_points.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,9 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Kévin Dietrich.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_POINTS_H__
diff --git a/source/blender/alembic/intern/abc_transform.cc b/source/blender/alembic/intern/abc_transform.cc
index 81ebfef3e11..83473bd0fe6 100644
--- a/source/blender/alembic/intern/abc_transform.cc
+++ b/source/blender/alembic/intern/abc_transform.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_transform.h"
diff --git a/source/blender/alembic/intern/abc_transform.h b/source/blender/alembic/intern/abc_transform.h
index 12bf9d38007..79d278ce587 100644
--- a/source/blender/alembic/intern/abc_transform.h
+++ b/source/blender/alembic/intern/abc_transform.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_TRANSFORM_H__
diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc
index 90dfbd869f7..8af7fb8b6f6 100644
--- a/source/blender/alembic/intern/abc_util.cc
+++ b/source/blender/alembic/intern/abc_util.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "abc_util.h"
diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h
index fae73ec9d11..a78a787fa14 100644
--- a/source/blender/alembic/intern/abc_util.h
+++ b/source/blender/alembic/intern/abc_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#ifndef __ABC_UTIL_H__
@@ -46,9 +44,9 @@ using Alembic::Abc::chrono_t;
class AbcObjectReader;
struct ImportSettings;
+struct Base;
struct ID;
struct Object;
-struct Base;
std::string get_id_name(const ID * const id);
std::string get_id_name(const Object * const ob);
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index d5431d13d0a..bf10a9498b5 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,10 @@
* 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): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup balembic
*/
#include "../ABC_alembic.h"
@@ -340,7 +338,7 @@ bool ABC_export(
job->settings.scene = scene;
job->settings.depsgraph = DEG_graph_new(scene, job->view_layer, DAG_EVAL_RENDER);
- /* Sybren: for now we only export the active scene layer.
+ /* TODO(Sybren): for now we only export the active scene layer.
* Later in the 2.8 development process this may be replaced by using
* a specific collection for Alembic I/O, which can then be toggled
* between "real" objects and cached Alembic files. */
@@ -353,7 +351,7 @@ bool ABC_export(
job->settings.shutter_open = params->shutter_open;
job->settings.shutter_close = params->shutter_close;
- /* Sybren: For now this is ignored, until we can get selection
+ /* TODO(Sybren): For now this is ignored, until we can get selection
* detection working through Base pointers (instead of ob->flags). */
job->settings.selected_only = params->selected_only;
@@ -364,9 +362,10 @@ bool ABC_export(
job->settings.export_hair = params->export_hair;
job->settings.export_particles = params->export_particles;
job->settings.apply_subdiv = params->apply_subdiv;
+ job->settings.curves_as_mesh = params->curves_as_mesh;
job->settings.flatten_hierarchy = params->flatten_hierarchy;
- /* Sybren: visible_layer & renderable only is ignored for now,
+ /* TODO(Sybren): visible_layer & renderable only is ignored for now,
* to be replaced with collections later in the 2.8 dev process
* (also see note above). */
job->settings.visible_layers_only = params->visible_layers_only;
@@ -799,7 +798,7 @@ static void import_endjob(void *user_data)
* the reader and the creation of the Blender object. */
if (ob == NULL) continue;
- BKE_libblock_free_us(data->bmain, ob);
+ BKE_id_free_us(data->bmain, ob);
}
}
else {
diff --git a/source/blender/avi/AVI_avi.h b/source/blender/avi/AVI_avi.h
index 210195234be..ce1c2ed343b 100644
--- a/source/blender/avi/AVI_avi.h
+++ b/source/blender/avi/AVI_avi.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file AVI_avi.h
- * \ingroup avi
+/** \file
+ * \ingroup avi
*
* \section avi_about About the AVI module
*
@@ -46,7 +37,6 @@
* and functions. You would need the types to be able to include the
* function headers anyway. And, after all, it is someone else's
* code. So we keep it like this.
- *
*/
#ifndef __AVI_AVI_H__
diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt
index d019863faa5..d5d062bb826 100644
--- a/source/blender/avi/CMakeLists.txt
+++ b/source/blender/avi/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -36,18 +31,18 @@ set(INC_SYS
set(SRC
intern/avi.c
- intern/avi_rgb.c
intern/avi_codecs.c
intern/avi_endian.c
intern/avi_mjpeg.c
intern/avi_options.c
+ intern/avi_rgb.c
intern/avi_rgb32.c
AVI_avi.h
- intern/avi_intern.h
- intern/avi_rgb.h
intern/avi_endian.h
+ intern/avi_intern.h
intern/avi_mjpeg.h
+ intern/avi_rgb.h
intern/avi_rgb32.h
)
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c
index 94f409d2753..cc53a7561f4 100644
--- a/source/blender/avi/intern/avi.c
+++ b/source/blender/avi/intern/avi.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/avi/intern/avi.c
- * \ingroup avi
+/** \file
+ * \ingroup avi
*
* This is external code.
*/
diff --git a/source/blender/avi/intern/avi_codecs.c b/source/blender/avi/intern/avi_codecs.c
index f52ec44faab..781519bbe24 100644
--- a/source/blender/avi/intern/avi_codecs.c
+++ b/source/blender/avi/intern/avi_codecs.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/avi/intern/avi_codecs.c
- * \ingroup avi
+/** \file
+ * \ingroup avi
*
* This is external code. Identify and convert different avi-files.
*/
diff --git a/source/blender/avi/intern/avi_endian.c b/source/blender/avi/intern/avi_endian.c
index 9720d83f2c8..7556f7f5c66 100644
--- a/source/blender/avi/intern/avi_endian.c
+++ b/source/blender/avi/intern/avi_endian.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/avi/intern/avi_endian.c
- * \ingroup avi
+/** \file
+ * \ingroup avi
*
* This is external code. Streams bytes to output depending on the
* endianness of the system.
diff --git a/source/blender/avi/intern/avi_endian.h b/source/blender/avi/intern/avi_endian.h
index 8cea283a553..733e6366ae6 100644
--- a/source/blender/avi/intern/avi_endian.h
+++ b/source/blender/avi/intern/avi_endian.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/avi/intern/avi_endian.h
- * \ingroup avi
+/** \file
+ * \ingroup avi
*
* This is external code.
*/
diff --git a/source/blender/avi/intern/avi_intern.h b/source/blender/avi/intern/avi_intern.h
index 6261b8140be..d31e4299ff0 100644
--- a/source/blender/avi/intern/avi_intern.h
+++ b/source/blender/avi/intern/avi_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/avi/intern/avi_intern.h
- * \ingroup avi
+/** \file
+ * \ingroup avi
*/
#ifndef __AVI_INTERN_H__
diff --git a/source/blender/avi/intern/avi_mjpeg.c b/source/blender/avi/intern/avi_mjpeg.c
index 3146aebb0d0..740f0966141 100644
--- a/source/blender/avi/intern/avi_mjpeg.c
+++ b/source/blender/avi/intern/avi_mjpeg.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/avi/intern/avi_mjpeg.c
- * \ingroup avi
+/** \file
+ * \ingroup avi
*
* This is external code. Converts between avi and mpeg/jpeg.
*/
@@ -70,25 +61,25 @@ static void std_huff_tables(j_decompress_ptr dinfo)
{
static const UINT8 bits_dc_luminance[17] =
{ /* 0-base */
- 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
+ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
};
static const UINT8 val_dc_luminance[] =
{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
};
static const UINT8 bits_dc_chrominance[17] =
{ /* 0-base */
- 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
+ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
};
static const UINT8 val_dc_chrominance[] =
{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
};
static const UINT8 bits_ac_luminance[17] =
{ /* 0-base */
- 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d
+ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d,
};
static const UINT8 val_ac_luminance[] =
{
@@ -112,11 +103,11 @@ static void std_huff_tables(j_decompress_ptr dinfo)
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa
+ 0xf9, 0xfa,
};
static const UINT8 bits_ac_chrominance[17] =
{ /* 0-base */
- 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
+ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77,
};
static const UINT8 val_ac_chrominance[] =
{
@@ -140,7 +131,7 @@ static void std_huff_tables(j_decompress_ptr dinfo)
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa
+ 0xf9, 0xfa,
};
add_huff_table(dinfo, &dinfo->dc_huff_tbl_ptrs[0],
diff --git a/source/blender/avi/intern/avi_mjpeg.h b/source/blender/avi/intern/avi_mjpeg.h
index e1e3cdf1fd8..30e46bf1d0c 100644
--- a/source/blender/avi/intern/avi_mjpeg.h
+++ b/source/blender/avi/intern/avi_mjpeg.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/avi/intern/avi_mjpeg.h
- * \ingroup avi
+/** \file
+ * \ingroup avi
*/
#ifndef __AVI_MJPEG_H__
diff --git a/source/blender/avi/intern/avi_options.c b/source/blender/avi/intern/avi_options.c
index d59a8a0118a..a8b0bd68fb1 100644
--- a/source/blender/avi/intern/avi_options.c
+++ b/source/blender/avi/intern/avi_options.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/avi/intern/avi_options.c
- * \ingroup avi
+/** \file
+ * \ingroup avi
*
* This is external code. Sets some compression related options
* (width, height quality, framerate).
diff --git a/source/blender/avi/intern/avi_rgb.c b/source/blender/avi/intern/avi_rgb.c
index 6997a0d8be4..55a79a72bcf 100644
--- a/source/blender/avi/intern/avi_rgb.c
+++ b/source/blender/avi/intern/avi_rgb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/avi/intern/avi_rgb.c
- * \ingroup avi
+/** \file
+ * \ingroup avi
*
* This is external code. Converts rgb-type avi-s.
*/
diff --git a/source/blender/avi/intern/avi_rgb.h b/source/blender/avi/intern/avi_rgb.h
index 67bb4172769..7c8ce590d27 100644
--- a/source/blender/avi/intern/avi_rgb.h
+++ b/source/blender/avi/intern/avi_rgb.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/avi/intern/avi_rgb.h
- * \ingroup avi
+/** \file
+ * \ingroup avi
*/
#ifndef __AVI_RGB_H__
diff --git a/source/blender/avi/intern/avi_rgb32.c b/source/blender/avi/intern/avi_rgb32.c
index f5f48b9eeb4..49270cd3ce0 100644
--- a/source/blender/avi/intern/avi_rgb32.c
+++ b/source/blender/avi/intern/avi_rgb32.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/avi/intern/avi_rgb32.c
- * \ingroup avi
+/** \file
+ * \ingroup avi
*
* This is external code. Converts between rgb32 and avi.
*/
diff --git a/source/blender/avi/intern/avi_rgb32.h b/source/blender/avi/intern/avi_rgb32.h
index a9373a69821..eb4b9ca4e21 100644
--- a/source/blender/avi/intern/avi_rgb32.h
+++ b/source/blender/avi/intern/avi_rgb32.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/avi/intern/avi_rgb32.h
- * \ingroup avi
+/** \file
+ * \ingroup avi
*/
#ifndef __AVI_RGB32_H__
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index 8a3728574f3..ac4ffe0ed5a 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/BLF_api.h
- * \ingroup blf
+/** \file
+ * \ingroup blf
*/
@@ -38,9 +31,9 @@
/* enable this only if needed (unused circa 2016) */
#define BLF_BLUR_ENABLE 0
-struct rctf;
struct ColorManagedDisplay;
struct ResultBLF;
+struct rctf;
int BLF_init(void);
void BLF_exit(void);
@@ -51,6 +44,7 @@ void BLF_batch_reset(void); /* call when changing opengl context. */
void BLF_cache_clear(void);
+/* Loads a font, or returns an already loaded font and increments its reference count. */
int BLF_load(const char *name) ATTR_NONNULL();
int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size) ATTR_NONNULL();
@@ -88,7 +82,6 @@ void BLF_color3fv_alpha(int fontid, const float rgb[3], float alpha);
* | m[1] m[5] m[9] m[13] |
* | m[2] m[6] m[10] m[14] |
* | m[3] m[7] m[11] m[15] |
- *
*/
void BLF_matrix(int fontid, const float m[16]);
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
index 36ad6fe03cf..e8a7750c445 100644
--- a/source/blender/blenfont/CMakeLists.txt
+++ b/source/blender/blenfont/CMakeLists.txt
@@ -16,9 +16,6 @@
#
# The Original Code is Copyright (C) 2008, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 70a7b862830..4f6344ee506 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/intern/blf.c
- * \ingroup blf
+/** \file
+ * \ingroup blf
*
* Main BlenFont (BLF) API, public functions for font handling.
*
@@ -192,38 +185,17 @@ int BLF_default(void)
int BLF_load(const char *name)
{
FontBLF *font;
- char *filename;
int i;
/* check if we already load this font. */
i = blf_search(name);
if (i >= 0) {
- /*font = global_font[i];*/ /*UNUSED*/
+ font = global_font[i];
+ font->reference_count++;
return i;
}
- i = blf_search_available();
- if (i == -1) {
- printf("Too many fonts!!!\n");
- return -1;
- }
-
- filename = blf_dir_search(name);
- if (!filename) {
- printf("Can't find font: %s\n", name);
- return -1;
- }
-
- font = blf_font_new(name, filename);
- MEM_freeN(filename);
-
- if (!font) {
- printf("Can't load font: %s\n", name);
- return -1;
- }
-
- global_font[i] = font;
- return i;
+ return BLF_load_unique(name);
}
int BLF_load_unique(const char *name)
@@ -255,6 +227,7 @@ int BLF_load_unique(const char *name)
return -1;
}
+ font->reference_count = 1;
global_font[i] = font;
return i;
}
@@ -270,7 +243,6 @@ void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size)
int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size)
{
- FontBLF *font;
int i;
i = blf_search(name);
@@ -278,26 +250,7 @@ int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size)
/*font = global_font[i];*/ /*UNUSED*/
return i;
}
-
- i = blf_search_available();
- if (i == -1) {
- printf("Too many fonts!!!\n");
- return -1;
- }
-
- if (!mem_size) {
- printf("Can't load font: %s from memory!!\n", name);
- return -1;
- }
-
- 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;
- return i;
+ return BLF_load_mem_unique(name, mem, mem_size);
}
int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size)
@@ -326,6 +279,7 @@ int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size
return -1;
}
+ font->reference_count = 1;
global_font[i] = font;
return i;
}
@@ -339,8 +293,13 @@ void BLF_unload(const char *name)
font = global_font[i];
if (font && (STREQ(font->name, name))) {
- blf_font_free(font);
- global_font[i] = NULL;
+ BLI_assert(font->reference_count > 0);
+ font->reference_count--;
+
+ if (font->reference_count == 0) {
+ blf_font_free(font);
+ global_font[i] = NULL;
+ }
}
}
}
@@ -349,8 +308,13 @@ void BLF_unload_id(int fontid)
{
FontBLF *font = blf_get(fontid);
if (font) {
- blf_font_free(font);
- global_font[fontid] = NULL;
+ BLI_assert(font->reference_count > 0);
+ font->reference_count--;
+
+ if (font->reference_count == 0) {
+ blf_font_free(font);
+ global_font[fontid] = NULL;
+ }
}
}
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c
index f37ed3cb54f..34d0fe5bba3 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/intern/blf_dir.c
- * \ingroup blf
+/** \file
+ * \ingroup blf
*
* Manage search paths for font files.
*/
@@ -50,8 +44,6 @@
#include "BLI_string.h"
#include "BLI_threads.h"
-#include "BIF_gl.h"
-
#include "BLF_api.h"
#include "blf_internal_types.h"
#include "blf_internal.h"
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index c5d39a05c5d..d26c449dce2 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/intern/blf_font.c
- * \ingroup blf
+/** \file
+ * \ingroup blf
*
* Deals with drawing text to OpenGL or bitmap buffers.
*
@@ -53,9 +46,7 @@
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_threads.h"
-#include "BLI_alloca.h"
-#include "BIF_gl.h"
#include "BLF_api.h"
#include "UI_interface.h"
@@ -191,10 +182,10 @@ void blf_batch_draw(void)
UI_widgetbase_draw_cache_flush();
GPU_texture_bind(g_batch.tex_bind_state, 0);
- GPU_vertbuf_vertex_count_set(g_batch.verts, g_batch.glyph_len);
+ GPU_vertbuf_data_len_set(g_batch.verts, g_batch.glyph_len);
GPU_vertbuf_use(g_batch.verts); /* send data */
- GPUBuiltinShader shader = (g_batch.simple_shader) ? GPU_SHADER_TEXT_SIMPLE : GPU_SHADER_TEXT;
+ eGPUBuiltinShader shader = (g_batch.simple_shader) ? GPU_SHADER_TEXT_SIMPLE : GPU_SHADER_TEXT;
GPU_batch_program_set_builtin(g_batch.batch, shader);
GPU_batch_uniform_1i(g_batch.batch, "glyph", 0);
GPU_batch_draw(g_batch.batch);
diff --git a/source/blender/blenfont/intern/blf_font_i18n.c b/source/blender/blenfont/intern/blf_font_i18n.c
index b6ff7ed865a..2a69d714dc6 100644
--- a/source/blender/blenfont/intern/blf_font_i18n.c
+++ b/source/blender/blenfont/intern/blf_font_i18n.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/intern/blf_font_i18n.c
- * \ingroup blf
+/** \file
+ * \ingroup blf
*
* API for accessing font files.
*/
@@ -37,88 +30,86 @@
#include "MEM_guardedalloc.h"
-#include "BLI_fileops.h"
-#include "BLI_path_util.h"
-#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_appdir.h"
#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_mono_filename[] = "bmonofont-i18n.ttf.gz";
-static unsigned char *unifont_mono_ttf = NULL;
-static int unifont_mono_size = 0;
-#endif /* WITH_INTERNATIONAL */
-
-unsigned char *BLF_get_unifont(int *r_unifont_size)
+
+#include "BLI_fileops.h"
+#include "BLI_string.h"
+
+struct FontBuf {
+ const char *filename;
+ uchar *data;
+ int data_len;
+};
+
+static struct FontBuf unifont_ttf = {"droidsans.ttf.gz"};
+static struct FontBuf unifont_mono_ttf = {"bmonofont-i18n.ttf.gz"};
+
+static void fontbuf_load(struct FontBuf *fb)
{
-#ifdef WITH_INTERNATIONAL
- if (unifont_ttf == NULL) {
- const char * const fontpath = BKE_appdir_folder_id(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);
- }
- else {
- printf("%s: 'fonts' data path not found for international font, continuing\n", __func__);
- }
+ const char *fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts");
+ if (fontpath) {
+ char unifont_path[1024];
+ BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, fb->filename);
+ fb->data = (uchar *)BLI_file_ungzip_to_mem(unifont_path, &fb->data_len);
+
+ }
+ else {
+ printf("%s: 'fonts' data path not found for '%s', continuing\n", __func__, fb->filename);
+ }
+}
+
+static void fontbuf_free(struct FontBuf *fb)
+{
+ MEM_SAFE_FREE(fb->data);
+ fb->data_len = 0;
+}
+
+static uchar *fontbuf_get_mem(struct FontBuf *fb, int *r_size)
+{
+ if (fb->data == NULL) {
+ fontbuf_load(fb);
}
+ *r_size = fb->data_len;
+ return fb->data;
+}
- *r_unifont_size = unifont_size;
+#endif /* WITH_INTERNATIONAL */
- return unifont_ttf;
+
+uchar *BLF_get_unifont(int *r_unifont_size)
+{
+#ifdef WITH_INTERNATIONAL
+ return fontbuf_get_mem(&unifont_ttf, r_unifont_size);
#else
- (void)r_unifont_size;
+ UNUSED_VARS(r_unifont_size);
return NULL;
#endif
}
-void BLF_free_unifont(void)
+uchar *BLF_get_unifont_mono(int *r_unifont_size)
{
#ifdef WITH_INTERNATIONAL
- if (unifont_ttf)
- MEM_freeN(unifont_ttf);
+ return fontbuf_get_mem(&unifont_mono_ttf, r_unifont_size);
#else
+ UNUSED_VARS(r_unifont_size);
+ return NULL;
#endif
}
-unsigned char *BLF_get_unifont_mono(int *r_unifont_size)
+void BLF_free_unifont(void)
{
#ifdef WITH_INTERNATIONAL
- if (unifont_mono_ttf == NULL) {
- const char *fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts");
- if (fontpath) {
- char unifont_path[1024];
-
- BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_mono_filename);
-
- unifont_mono_ttf = (unsigned char *)BLI_file_ungzip_to_mem(unifont_path, &unifont_mono_size);
- }
- else {
- printf("%s: 'fonts' data path not found for international monospace font, continuing\n", __func__);
- }
- }
-
- *r_unifont_size = unifont_mono_size;
-
- return unifont_mono_ttf;
-#else
- (void)r_unifont_size;
- return NULL;
+ fontbuf_free(&unifont_ttf);
#endif
}
void BLF_free_unifont_mono(void)
{
#ifdef WITH_INTERNATIONAL
- if (unifont_mono_ttf)
- MEM_freeN(unifont_mono_ttf);
-#else
+ fontbuf_free(&unifont_mono_ttf);
#endif
}
diff --git a/source/blender/blenfont/intern/blf_font_win32_compat.c b/source/blender/blenfont/intern/blf_font_win32_compat.c
index dd4a443e69f..70a5e3a9ce3 100644
--- a/source/blender/blenfont/intern/blf_font_win32_compat.c
+++ b/source/blender/blenfont/intern/blf_font_win32_compat.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/intern/blf_font_win32_compat.c
- * \ingroup blf
+/** \file
+ * \ingroup blf
*
* Workaround for win32 which needs to use BLI_fopen to access files.
*
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 8fcba1fc2af..27187f2e84d 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/intern/blf_glyph.c
- * \ingroup blf
+/** \file
+ * \ingroup blf
*
* Glyph rendering, texturing and caching. Wraps Freetype and OpenGL functions.
*/
@@ -52,7 +45,6 @@
#include "BLI_rect.h"
#include "BLI_threads.h"
-#include "BIF_gl.h"
#include "BLF_api.h"
#ifndef BLF_STANDALONE
@@ -100,7 +92,7 @@ KerningCacheBLF *blf_kerning_cache_new(FontBLF *font)
/* Cannot fail since it has been added just before. */
GlyphBLF *g_prev = blf_glyph_search(font->glyph_cache, j);
- FT_Vector delta = {.x = 0, .y = 0};
+ FT_Vector delta = { .x = 0, .y = 0, };
if (FT_Get_Kerning(font->face, g_prev->idx, g->idx, kc->mode, &delta) == 0) {
kc->table[i][j] = (int)delta.x >> 6;
}
diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h
index 624f3ae884c..f7eec01470a 100644
--- a/source/blender/blenfont/intern/blf_internal.h
+++ b/source/blender/blenfont/intern/blf_internal.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,24 +15,20 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/intern/blf_internal.h
- * \ingroup blf
+/** \file
+ * \ingroup blf
*/
#ifndef __BLF_INTERNAL_H__
#define __BLF_INTERNAL_H__
-struct ResultBLF;
struct FontBLF;
struct GlyphBLF;
struct GlyphCacheBLF;
+struct ResultBLF;
struct rctf;
void blf_batch_draw_vao_clear(void);
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 265835f4c75..013127b6a47 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/intern/blf_internal_types.h
- * \ingroup blf
+/** \file
+ * \ingroup blf
*/
@@ -194,6 +188,9 @@ typedef struct FontBLF {
/* font name. */
char *name;
+ /* # of times this font was loaded */
+ unsigned int reference_count;
+
/* filename or NULL. */
char *filename;
diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c
index b6f5ffbb092..bbab5110e0e 100644
--- a/source/blender/blenfont/intern/blf_thumbs.c
+++ b/source/blender/blenfont/intern/blf_thumbs.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Thomas Beck
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/intern/blf_thumbs.c
- * \ingroup blf
+/** \file
+ * \ingroup blf
*
* Utility function to generate font preview images.
*
diff --git a/source/blender/blenfont/intern/blf_util.c b/source/blender/blenfont/intern/blf_util.c
index 681553efbbe..d479861b897 100644
--- a/source/blender/blenfont/intern/blf_util.c
+++ b/source/blender/blenfont/intern/blf_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenfont/intern/blf_util.c
- * \ingroup blf
+/** \file
+ * \ingroup blf
*
* Internal utility API for BLF.
*/
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 8c1dc77964a..cd7422415dc 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_DERIVEDMESH_H__
#define __BKE_DERIVEDMESH_H__
-/** \file BKE_DerivedMesh.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Basic design of the DerivedMesh system:
*
@@ -80,22 +72,23 @@
#include "BKE_customdata.h"
#include "BKE_bvhutils.h"
+struct BMEditMesh;
struct CCGElem;
struct CCGKey;
-struct MVert;
+struct CustomData_MeshMasks;
+struct Depsgraph;
struct MEdge;
struct MFace;
-struct Object;
-struct Scene;
-struct Mesh;
struct MLoopNorSpaceArray;
-struct BMEditMesh;
+struct MVert;
+struct Mesh;
struct ModifierData;
-struct Depsgraph;
+struct Object;
struct PBVH;
+struct Scene;
/* number of sub-elements each mesh element has (for interpolation) */
-#define SUB_ELEMS_VERT 0
+// #define SUB_ELEMS_VERT 0 /* UNUSED */
#define SUB_ELEMS_EDGE 2
#define SUB_ELEMS_FACE 50
@@ -356,7 +349,7 @@ void DM_from_template_ex(
DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type,
int numVerts, int numEdges, int numTessFaces,
int numLoops, int numPolys,
- CustomDataMask mask);
+ const struct CustomData_MeshMasks *mask);
void DM_from_template(
DerivedMesh *dm, DerivedMesh *source,
DerivedMeshType type,
@@ -370,10 +363,11 @@ int DM_release(DerivedMesh *dm);
/** utility function to convert a DerivedMesh to a Mesh
*/
-void DM_to_mesh(DerivedMesh *dm, struct Mesh *me, struct Object *ob, CustomDataMask mask, bool take_ownership);
+void DM_to_mesh(DerivedMesh *dm, struct Mesh *me, struct Object *ob,
+ const struct CustomData_MeshMasks *mask, bool take_ownership);
-void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask);
+void DM_set_only_copy(DerivedMesh *dm, const struct CustomData_MeshMasks *mask);
/* adds a vertex/edge/face custom data layer to a DerivedMesh, optionally
* backed by an external data array
@@ -496,27 +490,27 @@ void mesh_get_mapped_verts_coords(struct Mesh *me_eval, float (*r_cos)[3], const
DerivedMesh *mesh_create_derived_render(
struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob, CustomDataMask dataMask);
+ struct Object *ob, const struct CustomData_MeshMasks *dataMask);
/* same as above but wont use render settings */
DerivedMesh *mesh_create_derived(struct Mesh *me, float (*vertCos)[3]);
struct Mesh *editbmesh_get_eval_cage(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *,
- struct BMEditMesh *em, CustomDataMask dataMask);
+ struct BMEditMesh *em, const struct CustomData_MeshMasks *dataMask);
struct Mesh *editbmesh_get_eval_cage_from_orig(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *,
- struct BMEditMesh *em, CustomDataMask dataMask);
+ struct BMEditMesh *em, const struct CustomData_MeshMasks *dataMask);
struct Mesh *editbmesh_get_eval_cage_and_final(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *,
- struct BMEditMesh *em, CustomDataMask dataMask,
+ struct BMEditMesh *em, const struct CustomData_MeshMasks *dataMask,
struct Mesh **r_final);
float (*editbmesh_get_vertex_cos(struct BMEditMesh *em, int *r_numVerts))[3];
bool editbmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, bool has_prev_mesh);
void makeDerivedMesh(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct BMEditMesh *em,
- CustomDataMask dataMask, const bool build_shapekey_layers);
+ const struct CustomData_MeshMasks *dataMask, const bool build_shapekey_layers);
void DM_add_named_tangent_layer_for_uv(
CustomData *uv_data, CustomData *tan_data, int numLoopData,
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index 7f4feb6c2d5..e1fc5e118c4 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,35 +15,26 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
- * Full recode, Joshua Leung, 2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_ACTION_H__
#define __BKE_ACTION_H__
-/** \file BKE_action.h
- * \ingroup bke
- * \brief Blender kernel action and pose functionality.
- * \author Reevan McKay
- * \author Ton Roosendaal (full recode 2005)
- * \author Joshua Leung (full recode 2009)
- * \since may 2001
+/** \file
+ * \ingroup bke
+ * \brief Blender kernel action and pose functionality.
*/
#include "DNA_listBase.h"
/* The following structures are defined in DNA_action_types.h, and DNA_anim_types.h */
+struct FCurve;
+struct Main;
+struct Object;
struct bAction;
struct bActionGroup;
-struct FCurve;
-struct bPose;
struct bItasc;
+struct bPose;
struct bPoseChannel;
-struct Main;
-struct Object;
/* Kernel prototypes */
#ifdef __cplusplus
@@ -90,7 +79,7 @@ typedef enum eAction_TransformFlags {
/* all flags */
ACT_TRANS_ONLY = (ACT_TRANS_LOC | ACT_TRANS_ROT | ACT_TRANS_SCALE),
- ACT_TRANS_ALL = (ACT_TRANS_ONLY | ACT_TRANS_PROP)
+ ACT_TRANS_ALL = (ACT_TRANS_ONLY | ACT_TRANS_PROP),
} eAction_TransformFlags;
/* Return flags indicating which transforms the given object/posechannel has
diff --git a/source/blender/blenkernel/BKE_addon.h b/source/blender/blenkernel/BKE_addon.h
index a463525d644..f88da3ab0e3 100644
--- a/source/blender/blenkernel/BKE_addon.h
+++ b/source/blender/blenkernel/BKE_addon.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* 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 *****
*/
#ifndef __BKE_ADDON_H__
#define __BKE_ADDON_H__
-/** \file BKE_addon.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index 0d8a50c5325..7670d5a04a0 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,24 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_ANIM_H__
#define __BKE_ANIM_H__
-/** \file BKE_anim.h
- * \ingroup bke
- * \author nzc
- * \since March 2001
+/** \file
+ * \ingroup bke
*/
-struct bAnimVizSettings;
-struct bMotionPath;
-struct bPoseChannel;
struct Depsgraph;
struct ListBase;
struct Main;
@@ -43,6 +30,9 @@ struct ParticleSystem;
struct Path;
struct ReportList;
struct Scene;
+struct bAnimVizSettings;
+struct bMotionPath;
+struct bPoseChannel;
/* ---------------------------------------------------- */
/* Animation Visualization */
@@ -76,7 +66,6 @@ int where_on_path(struct Object *ob, float ctime, float vec[4], float dir[3], fl
struct ListBase *object_duplilist(struct Depsgraph *depsgraph, struct Scene *sce, struct Object *ob);
void free_object_duplilist(struct ListBase *lb);
-int count_duplilist(struct Object *ob);
typedef struct DupliObject {
struct DupliObject *next, *prev;
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index f85782d9caa..e9eea162ceb 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,13 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * Contributor(s): Joshua Leung (original author)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_ANIMSYS_H__
#define __BKE_ANIMSYS_H__
-/** \file BKE_animsys.h
- * \ingroup bke
- * \author Joshua Leung
+/** \file
+ * \ingroup bke
*/
struct AnimData;
@@ -40,6 +33,7 @@ struct KS_Path;
struct KeyingSet;
struct ListBase;
struct Main;
+struct NlaKeyframingContext;
struct PathResolvedRNA;
struct PointerRNA;
struct PropertyRNA;
@@ -48,7 +42,6 @@ struct Scene;
struct bAction;
struct bActionGroup;
struct bContext;
-struct NlaKeyframingContext;
/* ************************************* */
/* AnimData API */
@@ -87,7 +80,7 @@ typedef enum eAnimData_MergeCopy_Modes {
ADT_MERGECOPY_SRC_COPY = 1,
/* Use src action (but just reference the existing version) */
- ADT_MERGECOPY_SRC_REF = 2
+ ADT_MERGECOPY_SRC_REF = 2,
} eAnimData_MergeCopy_Modes;
void BKE_animdata_merge_copy(
@@ -154,7 +147,7 @@ char *BKE_animdata_driver_path_hack(struct bContext *C, struct PointerRNA *ptr,
char *base_path);
/* ************************************* */
-/* GPUBatch AnimData API */
+/* Batch AnimData API */
/* Define for callback looper used in BKE_animdata_main_cb */
typedef void (*ID_AnimData_Edit_Callback)(struct ID *id, struct AnimData *adt, void *user_data);
@@ -169,6 +162,9 @@ void BKE_animdata_main_cb(struct Main *bmain, ID_AnimData_Edit_Callback func, vo
/* Loop over all datablocks applying callback to all its F-Curves */
void BKE_fcurves_main_cb(struct Main *bmain, ID_FCurve_Edit_Callback func, void *user_data);
+/* Look over all f-curves of a given ID. */
+void BKE_fcurves_id_cb(struct ID *id, ID_FCurve_Edit_Callback func, void *user_data);
+
/* ************************************* */
// TODO: overrides, remapping, and path-finding api's
@@ -177,7 +173,7 @@ void BKE_fcurves_main_cb(struct Main *bmain, ID_FCurve_Edit_Callback func, void
typedef struct NlaKeyframingContext NlaKeyframingContext;
struct NlaKeyframingContext *BKE_animsys_get_nla_keyframing_context(struct ListBase *cache, struct Depsgraph *depsgraph, struct PointerRNA *ptr, struct AnimData *adt, float ctime);
-bool BKE_animsys_nla_remap_keyframe_value(struct NlaKeyframingContext *context, struct PointerRNA *prop_ptr, struct PropertyRNA *prop, int index, float *r_value);
+bool BKE_animsys_nla_remap_keyframe_values(struct NlaKeyframingContext *context, struct PointerRNA *prop_ptr, struct PropertyRNA *prop, float *values, int count, int index, bool *r_force_all);
void BKE_animsys_free_nla_keyframing_context_cache(struct ListBase *cache);
/* ************************************* */
@@ -186,6 +182,13 @@ void BKE_animsys_free_nla_keyframing_context_cache(struct ListBase *cache);
/* ------------- Main API -------------------- */
/* In general, these ones should be called to do all animation evaluation */
+/* Flags for recalc parameter, indicating which part to recalculate. */
+typedef enum eAnimData_Recalc {
+ ADT_RECALC_DRIVERS = (1 << 0),
+ ADT_RECALC_ANIM = (1 << 1),
+ ADT_RECALC_ALL = (ADT_RECALC_DRIVERS | ADT_RECALC_ANIM),
+} eAnimData_Recalc;
+
/* Evaluation loop for evaluating animation data */
void BKE_animsys_evaluate_animdata(struct Depsgraph *depsgraph, struct Scene *scene, struct ID *id, struct AnimData *adt, float ctime, short recalc);
diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h
index 8496c56a9c7..1dc934ee533 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_APPDIR_H__
#define __BKE_APPDIR_H__
-/** \file BKE_appdir.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
struct ListBase;
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index e7129fc3e7b..09d8cbf933c 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,34 +15,26 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_ARMATURE_H__
#define __BKE_ARMATURE_H__
-/** \file BKE_armature.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
-struct bPose;
struct Bone;
struct Depsgraph;
struct GHash;
+struct ListBase;
struct Main;
-struct bArmature;
-struct bPoseChannel;
-struct bConstraint;
-struct Scene;
struct Object;
struct PoseTree;
-struct ListBase;
+struct Scene;
+struct bArmature;
+struct bConstraint;
+struct bPose;
+struct bPoseChannel;
typedef struct PoseTarget {
struct PoseTarget *next, *prev;
diff --git a/source/blender/blenkernel/BKE_autoexec.h b/source/blender/blenkernel/BKE_autoexec.h
index 7dc1e76ed5c..97fa386d8b3 100644
--- a/source/blender/blenkernel/BKE_autoexec.h
+++ b/source/blender/blenkernel/BKE_autoexec.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* 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): Blender Foundation 2013
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_AUTOEXEC_H__
#define __BKE_AUTOEXEC_H__
-/** \file BKE_autoexec.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
bool BKE_autoexec_match(const char *path);
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 98cf00ef220..1becd3ed086 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_BLENDER_H__
#define __BKE_BLENDER_H__
-/** \file BKE_blender.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
- * \brief Blender util stuff
+/** \file
+ * \ingroup bke
+ * \brief Blender util stuff
*/
#ifdef __cplusplus
@@ -58,10 +48,6 @@ void BKE_blender_userdef_app_template_data_set_and_free(struct UserDef *userdef)
void BKE_blender_userdef_data_free(struct UserDef *userdef, bool clear_fonts);
-/* set this callback when a UI is running */
-void BKE_blender_callback_test_break_set(void (*func)(void));
-int BKE_blender_test_break(void);
-
/* Blenders' own atexit (avoids leaking) */
void BKE_blender_atexit_register(void (*func)(void *user_data), void *user_data);
void BKE_blender_atexit_unregister(void (*func)(void *user_data), const void *user_data);
diff --git a/source/blender/blenkernel/BKE_blender_copybuffer.h b/source/blender/blenkernel/BKE_blender_copybuffer.h
index 02bd96217f6..a98bb6a8c1c 100644
--- a/source/blender/blenkernel/BKE_blender_copybuffer.h
+++ b/source/blender/blenkernel/BKE_blender_copybuffer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,24 +12,22 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_BLENDER_COPYBUFFER_H__
#define __BKE_BLENDER_COPYBUFFER_H__
-/** \file BKE_blender_copybuffer.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
-struct bContext;
-struct ReportList;
-struct Main;
struct ID;
+struct Main;
+struct ReportList;
+struct bContext;
/* copybuffer (wrapper for BKE_blendfile_write_partial) */
void BKE_copybuffer_begin(struct Main *bmain_src);
diff --git a/source/blender/blenkernel/BKE_blender_undo.h b/source/blender/blenkernel/BKE_blender_undo.h
index a96f8af1fdb..1c6463ea2c5 100644
--- a/source/blender/blenkernel/BKE_blender_undo.h
+++ b/source/blender/blenkernel/BKE_blender_undo.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,24 +12,22 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_BLENDER_UNDO_H__
#define __BKE_BLENDER_UNDO_H__
-/** \file BKE_blender_undo.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
-struct bContext;
-struct Scene;
struct Main;
struct MemFileUndoData;
+struct Scene;
+struct bContext;
#define BKE_UNDO_STR_MAX 64
diff --git a/source/blender/blenkernel/BKE_blender_user_menu.h b/source/blender/blenkernel/BKE_blender_user_menu.h
index ff314314646..d7cbb703ab3 100644
--- a/source/blender/blenkernel/BKE_blender_user_menu.h
+++ b/source/blender/blenkernel/BKE_blender_user_menu.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_BLENDER_USER_MENU_H__
#define __BKE_BLENDER_USER_MENU_H__
-/** \file BKE_blender_user_menu.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index bc2212f6091..e82efac3891 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,21 +12,19 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_BLENDER_VERSION_H__
#define __BKE_BLENDER_VERSION_H__
-/** \file BKE_blender_version.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
/* these lines are grep'd, watch out for our not-so-awesome regex
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 40
+#define BLENDER_SUBVERSION 47
/* Several breakages with 280, e.g. collections vs layers */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_blendfile.h b/source/blender/blenkernel/BKE_blendfile.h
index e272fcaa3ec..a665a315bd3 100644
--- a/source/blender/blenkernel/BKE_blendfile.h
+++ b/source/blender/blenkernel/BKE_blendfile.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,27 +12,25 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_BLENDFILE_H__
#define __BKE_BLENDFILE_H__
-/** \file BKE_blendfile.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
-struct bContext;
+struct BlendFileReadParams;
struct ID;
struct Main;
struct MemFile;
struct ReportList;
struct UserDef;
-struct BlendFileReadParams;
+struct bContext;
enum {
BKE_BLENDFILE_READ_FAIL = 0, /* no load */
diff --git a/source/blender/blenkernel/BKE_boids.h b/source/blender/blenkernel/BKE_boids.h
index 24f19951efe..9fff8334d4e 100644
--- a/source/blender/blenkernel/BKE_boids.h
+++ b/source/blender/blenkernel/BKE_boids.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,13 @@
*
* The Original Code is Copyright (C) 2009 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_BOIDS_H__
#define __BKE_BOIDS_H__
-/** \file BKE_boids.h
- * \ingroup bke
- * \since 2009
- * \author Janne Karhu
+/** \file
+ * \ingroup bke
*/
#include "DNA_boid_types.h"
diff --git a/source/blender/blenkernel/BKE_bpath.h b/source/blender/blenkernel/BKE_bpath.h
index 10ee504f244..b80401d1114 100644
--- a/source/blender/blenkernel/BKE_bpath.h
+++ b/source/blender/blenkernel/BKE_bpath.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* 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 *****
*/
-/** \file BKE_bpath.h
- * \ingroup bke
- * \attention Based on ghash, difference is ghash is not a fixed size,
+/** \file
+ * \ingroup bke
+ * \attention Based on ghash, difference is ghash is not a fixed size,
* so for BPath we don't need to malloc
*/
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index 91743bfa567..9360962317c 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,30 +12,28 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_BRUSH_H__
#define __BKE_BRUSH_H__
-/** \file BKE_brush.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* General operations for brushes.
*/
enum eCurveMappingPreset;
-struct bContext;
struct Brush;
-struct Paint;
struct ImBuf;
struct ImagePool;
struct Main;
+struct Material;
+struct Paint;
struct Scene;
struct ToolSettings;
struct UnifiedPaintSettings;
-struct Material;
+struct bContext;
// enum eCurveMappingPreset;
diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h
index 018f535a4cb..d9ff3f1e1de 100644
--- a/source/blender/blenkernel/BKE_bvhutils.h
+++ b/source/blender/blenkernel/BKE_bvhutils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2006 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): André Pinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_BVHUTILS_H__
#define __BKE_BVHUTILS_H__
-/** \file BKE_bvhutils.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BLI_bitmap.h"
@@ -38,11 +30,11 @@
* This header encapsulates necessary code to build a BVH
*/
-struct DerivedMesh;
struct BMEditMesh;
-struct Mesh;
-struct MVert;
+struct DerivedMesh;
struct MFace;
+struct MVert;
+struct Mesh;
typedef struct LinkNode BVHCache;
diff --git a/source/blender/blenkernel/BKE_cachefile.h b/source/blender/blenkernel/BKE_cachefile.h
index 43768b67f8f..1dc00be8a92 100644
--- a/source/blender/blenkernel/BKE_cachefile.h
+++ b/source/blender/blenkernel/BKE_cachefile.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Kevin Dietrich.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_CACHEFILE_H__
#define __BKE_CACHEFILE_H__
-/** \file BKE_cachefile.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h
index d8e2139be83..c998aecacdd 100644
--- a/source/blender/blenkernel/BKE_camera.h
+++ b/source/blender/blenkernel/BKE_camera.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_CAMERA_H__
#define __BKE_CAMERA_H__
-/** \file BKE_camera.h
- * \ingroup bke
- * \brief Camera datablock and utility functions.
+/** \file
+ * \ingroup bke
+ * \brief Camera datablock and utility functions.
*/
#ifdef __cplusplus
extern "C" {
@@ -40,15 +32,15 @@ extern "C" {
struct Camera;
struct Depsgraph;
+struct GPUFXSettings;
struct Main;
struct Object;
struct RegionView3D;
struct RenderData;
struct Scene;
+struct View3D;
struct ViewLayer;
struct rctf;
-struct View3D;
-struct GPUFXSettings;
/* Camera Datablock */
@@ -89,8 +81,8 @@ typedef struct CameraParams {
int sensor_fit;
/* clipping */
- float clipsta;
- float clipend;
+ float clip_start;
+ float clip_end;
/* computed viewplane */
float ycor;
@@ -140,6 +132,8 @@ void BKE_camera_to_gpu_dof(struct Object *camera, struct GPUFXSettings *r_fx_set
struct Object *BKE_camera_multiview_render(struct Scene *scene, struct Object *camera, const char *viewname);
void BKE_camera_multiview_view_matrix(struct RenderData *rd, const struct Object *camera, const bool is_left, float r_viewmat[4][4]);
void BKE_camera_multiview_model_matrix(struct RenderData *rd, const struct Object *camera, const char *viewname, float r_modelmat[4][4]);
+void BKE_camera_multiview_model_matrix_scaled(struct RenderData *rd, const struct Object *camera, const char *viewname, float r_modelmat[4][4]);
+void BKE_camera_multiview_window_matrix(struct RenderData *rd, const struct Object *camera, const char *viewname, float r_winmat[4][4]);
float BKE_camera_multiview_shift_x(struct RenderData *rd, const struct Object *camera, const char *viewname);
void BKE_camera_multiview_params(struct RenderData *rd, struct CameraParams *params, const struct Object *camera, const char *viewname);
bool BKE_camera_multiview_spherical_stereo(struct RenderData *rd, const struct Object *camera);
diff --git a/source/blender/blenkernel/BKE_ccg.h b/source/blender/blenkernel/BKE_ccg.h
index 4d0f6d53820..ec8caaf9f7b 100644
--- a/source/blender/blenkernel/BKE_ccg.h
+++ b/source/blender/blenkernel/BKE_ccg.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2012 by Nicholas Bishop.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_CCG_H__
#define __BKE_CCG_H__
-/** \file BKE_ccg.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
/* defines BLI_INLINE */
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index f2c0b96aa80..e218355447d 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Ben Batt <benbatt@gmail.com>
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_cdderivedmesh.h
- * \ingroup bke
- * \section aboutcdderivedmesh CDDerivedMesh interface
+/** \file
+ * \ingroup bke
+ * \section aboutcdderivedmesh CDDerivedMesh interface
* CDDerivedMesh (CD = Custom Data) is a DerivedMesh backend which stores
* mesh elements (vertices, edges and faces) as layers of custom element data.
*/
@@ -38,10 +30,11 @@
#include "BKE_DerivedMesh.h"
#include "BKE_customdata.h"
-struct DerivedMesh;
struct BMEditMesh;
-struct Mesh;
+struct CustomData_MeshMasks;
+struct DerivedMesh;
struct MLoopNorSpaceArray;
+struct Mesh;
struct Object;
/* creates a new CDDerivedMesh */
@@ -55,7 +48,7 @@ struct DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces,
struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh);
/* creates a CDDerivedMesh from the given Mesh with custom allocation type. */
-struct DerivedMesh *CDDM_from_mesh_ex(struct Mesh *mesh, eCDAllocType alloctype, CustomDataMask mask);
+struct DerivedMesh *CDDM_from_mesh_ex(struct Mesh *mesh, eCDAllocType alloctype, const struct CustomData_MeshMasks *mask);
struct DerivedMesh *CDDM_from_bmesh(struct BMesh *bm, const bool use_mdisps);
@@ -79,11 +72,10 @@ struct DerivedMesh *CDDM_copy(struct DerivedMesh *dm);
* given DerivedMesh and containing the requested numbers of elements.
* elements are initialized to all zeros
*/
-struct DerivedMesh *CDDM_from_template_ex(
- struct DerivedMesh *source,
+struct DerivedMesh *CDDM_from_template_ex(struct DerivedMesh *source,
int numVerts, int numEdges, int numFaces,
int numLoops, int numPolys,
- CustomDataMask mask);
+ const struct CustomData_MeshMasks *mask);
struct DerivedMesh *CDDM_from_template(
struct DerivedMesh *source,
int numVerts, int numEdges, int numFaces,
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h
index 87094e77953..6cfce305a04 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,31 +15,24 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Daniel Genrich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_CLOTH_H__
#define __BKE_CLOTH_H__
-/** \file BKE_cloth.h
- * \ingroup bke
- * \author Daniel Genrich
+/** \file
+ * \ingroup bke
*/
#include <float.h>
#include "BLI_math_inline.h"
-struct Object;
-struct Scene;
-struct Mesh;
-struct MFace;
struct ClothModifierData;
struct CollisionModifierData;
struct Depsgraph;
+struct MFace;
+struct Mesh;
+struct Object;
+struct Scene;
#define DO_INLINE MALWAYS_INLINE
@@ -82,7 +73,6 @@ typedef struct ClothSolverResult {
* rectangular ordered grid for which the original paper is written.
* At some point they need to disappear and we need to determine out
* own connectivity of the mesh based on the actual edges in the mesh.
- *
*/
typedef struct Cloth {
struct ClothVertex *verts; /* The vertices that represent this cloth. */
@@ -153,17 +143,11 @@ typedef struct ClothSpring {
ClothSpring;
// some macro enhancements for vector treatment
-#define VECADDADD(v1,v2,v3) {*(v1)+= *(v2) + *(v3); *(v1+1)+= *(v2+1) + *(v3+1); *(v1+2)+= *(v2+2) + *(v3+2);}
-#define VECSUBADD(v1,v2,v3) {*(v1)-= *(v2) + *(v3); *(v1+1)-= *(v2+1) + *(v3+1); *(v1+2)-= *(v2+2) + *(v3+2);}
-#define VECADDSUB(v1,v2,v3) {*(v1)+= *(v2) - *(v3); *(v1+1)+= *(v2+1) - *(v3+1); *(v1+2)+= *(v2+2) - *(v3+2);}
#define VECSUBADDSS(v1,v2,aS,v3,bS) {*(v1)-= *(v2)*aS + *(v3)*bS; *(v1+1)-= *(v2+1)*aS + *(v3+1)*bS; *(v1+2)-= *(v2+2)*aS + *(v3+2)*bS;}
-#define VECADDSUBSS(v1,v2,aS,v3,bS) {*(v1)+= *(v2)*aS - *(v3)*bS; *(v1+1)+= *(v2+1)*aS - *(v3+1)*bS; *(v1+2)+= *(v2+2)*aS - *(v3+2)*bS;}
#define VECADDSS(v1,v2,aS,v3,bS) {*(v1)= *(v2)*aS + *(v3)*bS; *(v1+1)= *(v2+1)*aS + *(v3+1)*bS; *(v1+2)= *(v2+2)*aS + *(v3+2)*bS;}
#define VECADDS(v1,v2,v3,bS) {*(v1)= *(v2) + *(v3)*bS; *(v1+1)= *(v2+1) + *(v3+1)*bS; *(v1+2)= *(v2+2) + *(v3+2)*bS;}
#define VECSUBMUL(v1,v2,aS) {*(v1)-= *(v2) * aS; *(v1+1)-= *(v2+1) * aS; *(v1+2)-= *(v2+2) * aS;}
#define VECSUBS(v1,v2,v3,bS) {*(v1)= *(v2) - *(v3)*bS; *(v1+1)= *(v2+1) - *(v3+1)*bS; *(v1+2)= *(v2+2) - *(v3+2)*bS;}
-#define VECSUBSB(v1,v2, v3,bS) {*(v1)= (*(v2)- *(v3))*bS; *(v1+1)= (*(v2+1) - *(v3+1))*bS; *(v1+2)= (*(v2+2) - *(v3+2))*bS;}
-#define VECMULS(v1,aS) {*(v1)*= aS; *(v1+1)*= aS; *(v1+2)*= *aS;}
#define VECADDMUL(v1,v2,aS) {*(v1)+= *(v2) * aS; *(v1+1)+= *(v2+1) * aS; *(v1+2)+= *(v2+2) * aS;}
/* SIMULATION FLAGS: goal flags,.. */
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index ea824c63c40..0390078fc7f 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_COLLECTION_H__
#define __BKE_COLLECTION_H__
-/** \file blender/blenkernel/BKE_collection.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BLI_compiler_compat.h"
@@ -38,8 +32,8 @@ extern "C" {
/* Structs */
-struct Base;
struct BLI_Iterator;
+struct Base;
struct Collection;
struct Depsgraph;
struct ID;
@@ -60,11 +54,14 @@ void BKE_collection_free(struct Collection *collection);
bool BKE_collection_delete(struct Main *bmain, struct Collection *collection, bool hierarchy);
struct Collection *BKE_collection_copy(struct Main *bmain, struct Collection *parent, struct Collection *collection);
-struct Collection *BKE_collection_copy_master(struct Main *bmain, struct Collection *collection, const int flag);
void BKE_collection_copy_data(struct Main *bmain, struct Collection *collection_dst, const struct Collection *collection_src, const int flag);
-void BKE_collection_copy_full(struct Main *bmain, struct Collection *collection);
void BKE_collection_make_local(struct Main *bmain, struct Collection *collection, const bool lib_local);
+struct Collection *BKE_collection_duplicate(
+ struct Main *bmain, struct Collection *parent, struct Collection *collection,
+ const bool do_hierarchy, const bool do_objects, const bool do_obdata);
+struct Collection *BKE_collection_copy_master(struct Main *bmain, struct Collection *collection, const int flag);
+
/* Master Collection for Scene */
struct Collection *BKE_collection_master(const struct Scene *scene);
diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h
index 9bd1f5385da..2acef14f766 100644
--- a/source/blender/blenkernel/BKE_collision.h
+++ b/source/blender/blenkernel/BKE_collision.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,12 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Daniel Genrich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_COLLISION_H__
#define __BKE_COLLISION_H__
-/** \file BKE_collision.h
- * \ingroup bke
- * \author Daniel Genrich
+/** \file
+ * \ingroup bke
*/
#include <math.h>
@@ -43,14 +34,14 @@
#include "BLI_kdopbvh.h"
-struct CollisionModifierData;
struct Collection;
+struct CollisionModifierData;
+struct Depsgraph;
struct MFace;
struct MVert;
+struct MVertTri;
struct Object;
struct Scene;
-struct Depsgraph;
-struct MVertTri;
////////////////////////////////////////
// used for collisions in collision.c
diff --git a/source/blender/blenkernel/BKE_colorband.h b/source/blender/blenkernel/BKE_colorband.h
index edb724d2aec..624453a6eff 100644
--- a/source/blender/blenkernel/BKE_colorband.h
+++ b/source/blender/blenkernel/BKE_colorband.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,13 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_COLORBAND_H__
#define __BKE_COLORBAND_H__
-/** \file BKE_colorband.h
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index aa3721d7a14..a5048d513a7 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,23 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifndef __BKE_COLORTOOLS_H__
#define __BKE_COLORTOOLS_H__
-/** \file BKE_colortools.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
struct ColorManagedColorspaceSettings;
struct ColorManagedDisplaySettings;
struct ColorManagedViewSettings;
-struct CurveMapping;
struct CurveMap;
struct CurveMapPoint;
-struct Scopes;
+struct CurveMapping;
struct Histogram;
struct ImBuf;
+struct Scopes;
struct rctf;
void curvemapping_set_defaults(struct CurveMapping *cumap, int tot, float minx, float miny, float maxx, float maxy);
@@ -102,10 +94,12 @@ void BKE_color_managed_display_settings_copy(
const struct ColorManagedDisplaySettings *settings);
/* Initialize view settings to be best suitable for render type of viewing.
- * This will use default view transform from the OCIO configuration. */
+ * This will use default view transform from the OCIO configuration if none
+ * is specified. */
void BKE_color_managed_view_settings_init_render(
struct ColorManagedViewSettings *settings,
- const struct ColorManagedDisplaySettings *display_settings);
+ const struct ColorManagedDisplaySettings *display_settings,
+ const char *view_transform);
/* Initialize view settings which are best suitable for viewing non-render
* images. For example,s movie clips while tracking. */
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index bfcdcb68c4a..99ab5993825 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,23 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): 2007 - Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_CONSTRAINT_H__
#define __BKE_CONSTRAINT_H__
-/** \file BKE_constraint.h
- * \ingroup bke
- * \author Joshua Leung (major recode 2007)
+/** \file
+ * \ingroup bke
*/
+struct Depsgraph;
struct ID;
-struct bConstraint;
-struct bConstraintTarget;
struct ListBase;
struct Object;
struct Scene;
+struct bConstraint;
+struct bConstraintTarget;
struct bPoseChannel;
-struct Depsgraph;
/* ---------------------------------------------------------------------------- */
#ifdef __cplusplus
@@ -49,16 +40,24 @@ extern "C" {
/* special struct for use in constraint evaluation */
typedef struct bConstraintOb {
- struct Depsgraph *depsgraph;/* to get evaluated armature. */
- struct Scene *scene; /* for system time, part of deglobalization, code nicer later with local time (ton) */
- struct Object *ob; /* if pchan, then armature that it comes from, otherwise constraint owner */
- struct bPoseChannel *pchan; /* pose channel that owns the constraints being evaluated */
-
- float matrix[4][4]; /* matrix where constraints are accumulated + solved */
- float startmat[4][4]; /* original matrix (before constraint solving) */
-
- short type; /* type of owner */
- short rotOrder; /* rotation order for constraint owner (as defined in eEulerRotationOrders in BLI_math.h) */
+ /** to get evaluated armature. */
+ struct Depsgraph *depsgraph;
+ /** for system time, part of deglobalization, code nicer later with local time (ton) */
+ struct Scene *scene;
+ /** if pchan, then armature that it comes from, otherwise constraint owner */
+ struct Object *ob;
+ /** pose channel that owns the constraints being evaluated */
+ struct bPoseChannel *pchan;
+
+ /** matrix where constraints are accumulated + solved */
+ float matrix[4][4];
+ /** original matrix (before constraint solving) */
+ float startmat[4][4];
+
+ /** type of owner */
+ short type;
+ /** rotation order for constraint owner (as defined in eEulerRotationOrders in BLI_math.h) */
+ short rotOrder;
} bConstraintOb;
/* ---------------------------------------------------------------------------- */
@@ -83,31 +82,35 @@ typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, bo
*/
typedef struct bConstraintTypeInfo {
/* admin/ident */
- short type; /* CONSTRAINT_TYPE_### */
- short size; /* size in bytes of the struct */
- char name[32]; /* name of constraint in interface */
- char structName[32]; /* name of struct for SDNA */
+ /** CONSTRAINT_TYPE_### */
+ short type;
+ /** size in bytes of the struct */
+ short size;
+ /** name of constraint in interface */
+ char name[32];
+ /** name of struct for SDNA */
+ char structName[32];
/* data management function pointers - special handling */
- /* free any data that is allocated separately (optional) */
+ /** free any data that is allocated separately (optional) */
void (*free_data)(struct bConstraint *con);
- /* run the provided callback function on all the ID-blocks linked to the constraint */
+ /** run the provided callback function on all the ID-blocks linked to the constraint */
void (*id_looper)(struct bConstraint *con, ConstraintIDFunc func, void *userdata);
- /* copy any special data that is allocated separately (optional) */
+ /** copy any special data that is allocated separately (optional) */
void (*copy_data)(struct bConstraint *con, struct bConstraint *src);
- /* set settings for data that will be used for bConstraint.data (memory already allocated using MEM_callocN) */
+ /** set settings for data that will be used for bConstraint.data (memory already allocated using MEM_callocN) */
void (*new_data)(void *cdata);
/* target handling function pointers */
- /* for multi-target constraints: return that list; otherwise make a temporary list (returns number of targets) */
+ /** for multi-target constraints: return that list; otherwise make a temporary list (returns number of targets) */
int (*get_constraint_targets)(struct bConstraint *con, struct ListBase *list);
- /* for single-target constraints only: flush data back to source data, and the free memory used */
+ /** for single-target constraints only: flush data back to source data, and the free memory used */
void (*flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy);
/* evaluation */
- /* set the ct->matrix for the given constraint target (at the given ctime) */
+ /** set the ct->matrix for the given constraint target (at the given ctime) */
void (*get_target_matrix)(struct Depsgraph *depsgraph, struct bConstraint *con, struct bConstraintOb *cob, struct bConstraintTarget *ct, float ctime);
- /* evaluate the constraint for the given time */
+ /** evaluate the constraint for the given time */
void (*evaluate_constraint)(struct bConstraint *con, struct bConstraintOb *cob, struct ListBase *targets);
} bConstraintTypeInfo;
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index f78740fd03a..cf573232bac 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_CONTEXT_H__
#define __BKE_CONTEXT_H__
-/** \file BKE_context.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_listBase.h"
@@ -38,41 +32,41 @@ extern "C" {
#endif
struct ARegion;
-struct bScreen;
+struct Base;
+struct Brush;
struct CacheFile;
struct Collection;
struct Depsgraph;
+struct EditBone;
+struct ID;
+struct Image;
struct LayerCollection;
struct ListBase;
struct Main;
struct Object;
-struct Base;
struct PointerRNA;
+struct RegionView3D;
+struct RenderEngineType;
struct ReportList;
struct Scene;
-struct ViewLayer;
struct ScrArea;
+struct SpaceClip;
+struct SpaceImage;
struct SpaceLink;
-struct View3D;
-struct ViewRender;
-struct RegionView3D;
+struct SpaceText;
struct StructRNA;
-struct ToolSettings;
-struct Image;
struct Text;
-struct EditBone;
-struct bPoseChannel;
-struct bGPdata;
-struct bGPDlayer;
+struct ToolSettings;
+struct View3D;
+struct ViewLayer;
+struct ViewRender;
struct bGPDframe;
-struct Brush;
+struct bGPDlayer;
+struct bGPdata;
+struct bPoseChannel;
+struct bScreen;
struct wmWindow;
struct wmWindowManager;
-struct RenderEngineType;
-struct SpaceText;
-struct SpaceImage;
-struct SpaceClip;
-struct ID;
#include "DNA_object_enums.h"
@@ -168,13 +162,13 @@ struct RegionView3D *CTX_wm_region_view3d(const bContext *C);
struct SpaceText *CTX_wm_space_text(const bContext *C);
struct SpaceImage *CTX_wm_space_image(const bContext *C);
struct SpaceConsole *CTX_wm_space_console(const bContext *C);
-struct SpaceButs *CTX_wm_space_buts(const bContext *C);
+struct SpaceProperties *CTX_wm_space_properties(const bContext *C);
struct SpaceFile *CTX_wm_space_file(const bContext *C);
struct SpaceSeq *CTX_wm_space_seq(const bContext *C);
-struct SpaceOops *CTX_wm_space_outliner(const bContext *C);
+struct SpaceOutliner *CTX_wm_space_outliner(const bContext *C);
struct SpaceNla *CTX_wm_space_nla(const bContext *C);
struct SpaceNode *CTX_wm_space_node(const bContext *C);
-struct SpaceIpo *CTX_wm_space_graph(const bContext *C);
+struct SpaceGraph *CTX_wm_space_graph(const bContext *C);
struct SpaceAction *CTX_wm_space_action(const bContext *C);
struct SpaceInfo *CTX_wm_space_info(const bContext *C);
struct SpaceUserPref *CTX_wm_space_userpref(const bContext *C);
@@ -200,7 +194,7 @@ void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg);
/* data type, needed so we can tell between a NULL pointer and an empty list */
enum {
CTX_DATA_TYPE_POINTER = 0,
- CTX_DATA_TYPE_COLLECTION
+ CTX_DATA_TYPE_COLLECTION,
};
PointerRNA CTX_data_pointer_get(const bContext *C, const char *member);
diff --git a/source/blender/blenkernel/BKE_crazyspace.h b/source/blender/blenkernel/BKE_crazyspace.h
index e9745ed50fa..17b4bfaf58d 100644
--- a/source/blender/blenkernel/BKE_crazyspace.h
+++ b/source/blender/blenkernel/BKE_crazyspace.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_crazyspace.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __BKE_CRAZYSPACE_H__
@@ -34,11 +27,11 @@
#ifdef __cplusplus
extern "C" {
#endif
-struct Scene;
-struct Object;
struct BMEditMesh;
-struct Mesh;
struct Depsgraph;
+struct Mesh;
+struct Object;
+struct Scene;
/* crazyspace.c */
float (*BKE_crazyspace_get_mapped_editverts(
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index ebbdbc7f7a0..f6ceea0d9cc 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,33 +15,26 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_CURVE_H__
#define __BKE_CURVE_H__
-/** \file BKE_curve.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
struct BezTriple;
struct Curve;
-struct EditNurb;
struct Depsgraph;
+struct EditNurb;
struct GHash;
+struct LinkNode;
struct ListBase;
struct Main;
struct Nurb;
struct Object;
-struct Scene;
struct Path;
+struct Scene;
struct TextBox;
struct rctf;
@@ -130,7 +121,8 @@ void BKE_curve_bevelList_free(struct ListBase *bev);
void BKE_curve_bevelList_make(struct Object *ob, struct ListBase *nurbs, bool for_render);
void BKE_curve_bevel_make(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *disp,
- const bool for_render, const bool use_render_resolution);
+ const bool for_render, const bool use_render_resolution,
+ struct LinkNode *ob_cyclic_list);
void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride);
void BKE_curve_forward_diff_tangent_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride);
@@ -244,4 +236,7 @@ void BKE_curve_decimate_nurb(
struct Nurb *nu, const unsigned int resolu,
const float error_sq_max, const unsigned int error_target_len);
+extern void (*BKE_curve_batch_cache_dirty_tag_cb)(struct Curve *cu, int mode);
+extern void (*BKE_curve_batch_cache_free_cb)(struct Curve *cu);
+
#endif /* __BKE_CURVE_H__ */
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 0be8e760cae..4a7e6b22b0c 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Ben Batt <benbatt@gmail.com>
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_customdata.h
- * \ingroup bke
- * \author Ben Batt
- * \brief CustomData interface, see also DNA_customdata_types.h.
+/** \file
+ * \ingroup bke
+ * \brief CustomData interface, see also DNA_customdata_types.h.
*/
#ifndef __BKE_CUSTOMDATA_H__
@@ -44,20 +35,22 @@ extern "C" {
#include "DNA_customdata_types.h"
struct BMesh;
-struct ID;
struct CustomData;
+struct CustomData_MeshMasks;
+struct ID;
typedef uint64_t CustomDataMask;
/*a data type large enough to hold 1 element from any customdata layer type*/
typedef struct {unsigned char data[64]; } CDBlockBytes;
-extern const CustomDataMask CD_MASK_BAREMESH;
-extern const CustomDataMask CD_MASK_MESH;
-extern const CustomDataMask CD_MASK_EDITMESH;
-extern const CustomDataMask CD_MASK_DERIVEDMESH;
-extern const CustomDataMask CD_MASK_BMESH;
-extern const CustomDataMask CD_MASK_FACECORNERS;
-extern const CustomDataMask CD_MASK_EVERYTHING;
+extern const CustomData_MeshMasks CD_MASK_BAREMESH;
+extern const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX;
+extern const CustomData_MeshMasks CD_MASK_MESH;
+extern const CustomData_MeshMasks CD_MASK_EDITMESH;
+extern const CustomData_MeshMasks CD_MASK_DERIVEDMESH;
+extern const CustomData_MeshMasks CD_MASK_BMESH;
+extern const CustomData_MeshMasks CD_MASK_FACECORNERS;
+extern const CustomData_MeshMasks CD_MASK_EVERYTHING;
/* for ORIGINDEX layer type, indicates no original index for this element */
#define ORIGINDEX_NONE -1
@@ -78,12 +71,15 @@ typedef enum eCDAllocType {
#define CD_TYPE_AS_MASK(_type) (CustomDataMask)((CustomDataMask)1 << (CustomDataMask)(_type))
-void customData_mask_layers__print(CustomDataMask mask);
+void customData_mask_layers__print(const struct CustomData_MeshMasks *mask);
typedef void (*cd_interp)(const void **sources, const float *weights, const float *sub_weights, int count, void *dest);
typedef void (*cd_copy)(const void *source, void *dest, int count);
typedef bool (*cd_validate)(void *item, const uint totitems, const bool do_fixes);
+void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src);
+bool CustomData_MeshMasks_are_matching(const CustomData_MeshMasks *mask_ref, const CustomData_MeshMasks *mask_required);
+
/**
* Checks if the layer at physical offset \a layer_n (in data->layers) support math
* the below operations.
@@ -355,6 +351,7 @@ void CustomData_set_layer_stencil_index(struct CustomData *data, int type, int n
/* adds flag to the layer flags */
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag);
+void CustomData_clear_layer_flag(struct CustomData *data, int type, int flag);
void CustomData_bmesh_set_default(struct CustomData *data, void **block);
void CustomData_bmesh_free_block(struct CustomData *data, void **block);
@@ -420,8 +417,8 @@ void CustomData_external_reload(struct CustomData *data,
/* Mesh-to-mesh transfer data. */
-struct MeshPairRemap;
struct CustomDataTransferLayerMap;
+struct MeshPairRemap;
typedef void (*cd_datatransfer_interp)(
const struct CustomDataTransferLayerMap *laymap, void *dest,
diff --git a/source/blender/blenkernel/BKE_customdata_file.h b/source/blender/blenkernel/BKE_customdata_file.h
index d7712c9d6d2..7e44c1d47aa 100644
--- a/source/blender/blenkernel/BKE_customdata_file.h
+++ b/source/blender/blenkernel/BKE_customdata_file.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_CUSTOMDATA_FILE_H__
#define __BKE_CUSTOMDATA_FILE_H__
-/** \file BKE_customdata_file.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#define CDF_TYPE_IMAGE 0
diff --git a/source/blender/blenkernel/BKE_data_transfer.h b/source/blender/blenkernel/BKE_data_transfer.h
index 7d0bb67c54d..8f949e5d985 100644
--- a/source/blender/blenkernel/BKE_data_transfer.h
+++ b/source/blender/blenkernel/BKE_data_transfer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/BKE_data_transfer.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __BKE_DATA_TRANSFER_H__
@@ -40,9 +32,9 @@ extern "C" {
struct Depsgraph;
struct Object;
+struct ReportList;
struct Scene;
struct SpaceTransform;
-struct ReportList;
/* Warning, those def are stored in files (TransferData modifier), *DO NOT* modify those values. */
enum {
@@ -74,7 +66,7 @@ enum {
};
-CustomDataMask BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types);
+void BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types, struct CustomData_MeshMasks *r_data_masks);
bool BKE_object_data_transfer_get_dttypes_capacity(
const int dtdata_types, bool *r_advanced_mixing, bool *r_threshold);
int BKE_object_data_transfer_get_dttypes_item_types(const int dtdata_types);
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index a29f4197299..c387f0f185a 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,31 +15,23 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_DEFORM_H__
#define __BKE_DEFORM_H__
-/** \file BKE_deform.h
- * \ingroup bke
- * \since June 2001
- * \author Reevan McKay et al
- * \brief support for deformation groups and hooks.
+/** \file
+ * \ingroup bke
+ * \brief support for deformation groups and hooks.
*/
-struct Object;
struct ListBase;
-struct bDeformGroup;
struct MDeformVert;
struct MEdge;
struct MLoop;
struct MPoly;
+struct Object;
+struct bDeformGroup;
struct bDeformGroup *BKE_defgroup_new(struct Object *ob, const char *name);
void defgroup_copy_list(struct ListBase *lb1, const struct ListBase *lb2);
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index e6b08a8a063..b4d0cf7e755 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_DISPLIST_H__
#define __BKE_DISPLIST_H__
-/** \file BKE_displist.h
- * \ingroup bke
- * \brief display list (or rather multi purpose list) stuff.
+/** \file
+ * \ingroup bke
+ * \brief display list (or rather multi purpose list) stuff.
*/
#include "DNA_customdata_types.h"
#include "BKE_customdata.h"
@@ -58,9 +50,10 @@ enum {
/* prototypes */
struct Depsgraph;
-struct Mesh;
+struct LinkNode;
struct ListBase;
struct Main;
+struct Mesh;
struct Object;
struct Scene;
@@ -92,12 +85,15 @@ void BKE_displist_make_surf(
struct Mesh **r_final, const bool for_render, const bool for_orco, const bool use_render_resolution);
void BKE_displist_make_curveTypes(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob,
- const bool for_render, const bool for_orco);
+ const bool for_render, const bool for_orco,
+ struct LinkNode *ob_cyclic_list);
void BKE_displist_make_curveTypes_forRender(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *dispbase,
- struct Mesh **r_final, const bool for_orco, const bool use_render_resolution);
+ struct Mesh **r_final, const bool for_orco, const bool use_render_resolution,
+ struct LinkNode *ob_cyclic_list);
void BKE_displist_make_curveTypes_forOrco(
- struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
+ struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *dispbase,
+ struct LinkNode *ob_cyclic_list);
void BKE_displist_make_mball(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
void BKE_displist_make_mball_forRender(
diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h
index d6a9cbb5e17..1cfd8f13c65 100644
--- a/source/blender/blenkernel/BKE_dynamicpaint.h
+++ b/source/blender/blenkernel/BKE_dynamicpaint.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BKE_DYNAMICPAINT_H__
#define __BKE_DYNAMICPAINT_H__
-/** \file BKE_dynamicpaint.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
struct Depsgraph;
diff --git a/source/blender/blenkernel/BKE_editlattice.h b/source/blender/blenkernel/BKE_editlattice.h
index 476cf535e97..b7c392b4f16 100644
--- a/source/blender/blenkernel/BKE_editlattice.h
+++ b/source/blender/blenkernel/BKE_editlattice.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_editlattice.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __BKE_EDITLATTICE_H__
diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h
index de4efaf37b0..34cd3ddf6f6 100644
--- a/source/blender/blenkernel/BKE_editmesh.h
+++ b/source/blender/blenkernel/BKE_editmesh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_EDITMESH_H__
#define __BKE_EDITMESH_H__
-/** \file BKE_editmesh.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* The \link edmesh EDBM module\endlink is for editmode bmesh stuff.
* In contrast, this module is for code shared with blenkernel that's
@@ -34,14 +28,14 @@
#include "BKE_customdata.h"
#include "bmesh.h"
-struct BMesh;
struct BMLoop;
-struct Mesh;
-struct Scene;
-struct DerivedMesh;
-struct MeshStatVis;
+struct BMesh;
struct Depsgraph;
+struct DerivedMesh;
struct EditMeshData;
+struct Mesh;
+struct MeshStatVis;
+struct Scene;
/**
* This structure is used for mesh edit-mode.
@@ -67,7 +61,7 @@ typedef struct BMEditMesh {
struct Mesh *mesh_eval_final, *mesh_eval_cage;
/*derivedmesh stuff*/
- CustomDataMask lastDataMask;
+ CustomData_MeshMasks lastDataMask;
unsigned char (*derivedVertColor)[4];
int derivedVertColorLen;
unsigned char (*derivedFaceColor)[4];
diff --git a/source/blender/blenkernel/BKE_editmesh_bvh.h b/source/blender/blenkernel/BKE_editmesh_bvh.h
index fe21eba429a..10265ed2a36 100644
--- a/source/blender/blenkernel/BKE_editmesh_bvh.h
+++ b/source/blender/blenkernel/BKE_editmesh_bvh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,27 +15,21 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_editmesh_bvh.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __BKE_EDITMESH_BVH_H__
#define __BKE_EDITMESH_BVH_H__
+struct BMBVHTree;
struct BMEditMesh;
-struct BMesh;
struct BMFace;
-struct BMVert;
struct BMLoop;
-struct BMBVHTree;
+struct BMVert;
+struct BMesh;
struct BVHTree;
typedef struct BMBVHTree BMBVHTree;
diff --git a/source/blender/blenkernel/BKE_editmesh_cache.h b/source/blender/blenkernel/BKE_editmesh_cache.h
index aaaa79a0857..22db8b698ab 100644
--- a/source/blender/blenkernel/BKE_editmesh_cache.h
+++ b/source/blender/blenkernel/BKE_editmesh_cache.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_EDITMESH_CACHE_H__
#define __BKE_EDITMESH_CACHE_H__
-/** \file BKE_editmesh_cache.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
struct BMEditMesh;
diff --git a/source/blender/blenkernel/BKE_editmesh_tangent.h b/source/blender/blenkernel/BKE_editmesh_tangent.h
index 9553fbc1a5c..271936a95b8 100644
--- a/source/blender/blenkernel/BKE_editmesh_tangent.h
+++ b/source/blender/blenkernel/BKE_editmesh_tangent.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_EDITMESH_TANGENT_H__
#define __BKE_EDITMESH_TANGENT_H__
-/** \file BKE_editmesh_tangent.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
void BKE_editmesh_loop_tangent_calc(
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index 9ba1bbdee07..dfcb482ec06 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,34 +15,26 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_EFFECT_H__
#define __BKE_EFFECT_H__
-/** \file BKE_effect.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
#include "DNA_modifier_types.h"
#include "BLI_utildefines.h"
-struct Object;
-struct Scene;
-struct ListBase;
struct Collection;
-struct ParticleSimulationData;
+struct Depsgraph;
+struct ListBase;
+struct Object;
struct ParticleData;
struct ParticleKey;
-struct Depsgraph;
+struct ParticleSimulationData;
+struct Scene;
struct ViewLayer;
struct EffectorWeights *BKE_effector_add_weights(struct Collection *collection);
@@ -105,7 +95,6 @@ typedef struct EffectorCache {
/* precalculated for guides */
struct GuideEffectorData *guide_data;
float guide_loc[4], guide_dir[3], guide_radius;
- float velocity[3];
float frame;
int flag;
@@ -121,6 +110,7 @@ typedef struct EffectorRelation {
struct PartDeflect *BKE_partdeflect_new(int type);
+struct PartDeflect *BKE_partdeflect_copy(const struct PartDeflect *pd_src);
void BKE_partdeflect_free(struct PartDeflect *pd);
struct ListBase *BKE_effector_relations_create(
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index f6490930530..d9435534244 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,40 +15,34 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_FCURVE_H__
#define __BKE_FCURVE_H__
-/** \file BKE_fcurve.h
- * \ingroup bke
- * \author Joshua Leung
- * \since 2009
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
-struct FCurve;
-struct FModifier;
struct ChannelDriver;
-struct DriverVar;
struct DriverTarget;
+struct DriverVar;
struct FCM_EnvelopeData;
+struct FCurve;
+struct FModifier;
-struct bContext;
struct AnimData;
-struct bAction;
struct BezTriple;
-struct StructRNA;
struct PathResolvedRNA;
struct PointerRNA;
struct PropertyRNA;
+struct StructRNA;
+struct bAction;
+struct bContext;
#include "DNA_curve_types.h"
@@ -183,7 +175,7 @@ typedef enum eFMI_Requirement_Flags {
FMI_REQUIRES_RUNTIME_CHECK = (1 << 2),
/* Requires to store data shared between time and valua evaluation */
- FMI_REQUIRES_STORAGE = (1 << 3)
+ FMI_REQUIRES_STORAGE = (1 << 3),
} eFMI_Requirement_Flags;
/* Function Prototypes for FModifierTypeInfo's */
@@ -297,6 +289,7 @@ void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2]);
/* evaluate fcurve */
float evaluate_fcurve(struct FCurve *fcu, float evaltime);
+float evaluate_fcurve_only_curve(struct FCurve *fcu, float evaltime);
float evaluate_fcurve_driver(struct PathResolvedRNA *anim_rna, struct FCurve *fcu,
struct ChannelDriver *driver_orig, float evaltime);
/* evaluate fcurve and store value */
diff --git a/source/blender/blenkernel/BKE_fluidsim.h b/source/blender/blenkernel/BKE_fluidsim.h
index 4883f2392b0..cddab25584e 100644
--- a/source/blender/blenkernel/BKE_fluidsim.h
+++ b/source/blender/blenkernel/BKE_fluidsim.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,26 +15,20 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_FLUIDSIM_H__
#define __BKE_FLUIDSIM_H__
-/** \file BKE_fluidsim.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
-struct Object;
-struct Scene;
+struct Depsgraph;
struct FluidsimSettings;
struct MVert;
-struct Depsgraph;
+struct Object;
+struct Scene;
/* old interface */
diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h
index 3f6d67f5ded..009efabbbe6 100644
--- a/source/blender/blenkernel/BKE_font.h
+++ b/source/blender/blenkernel/BKE_font.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_FONT_H__
#define __BKE_FONT_H__
-/** \file BKE_font.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
@@ -37,11 +29,11 @@ extern "C" {
#include <wchar.h>
-struct VFont;
-struct Object;
-struct Curve;
struct CharInfo;
+struct Curve;
struct Main;
+struct Object;
+struct VFont;
struct CharTrans {
float xof, yof;
diff --git a/source/blender/blenkernel/BKE_freestyle.h b/source/blender/blenkernel/BKE_freestyle.h
index 32bd1c1be7d..2f68746164a 100644
--- a/source/blender/blenkernel/BKE_freestyle.h
+++ b/source/blender/blenkernel/BKE_freestyle.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_FREESTYLE_H__
#define __BKE_FREESTYLE_H__
-/** \file BKE_freestyle.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_scene_types.h"
@@ -44,8 +36,8 @@ struct FreestyleModuleConfig;
struct Main;
/* RNA aliases */
-typedef struct FreestyleSettings FreestyleSettings;
typedef struct FreestyleModuleSettings FreestyleModuleSettings;
+typedef struct FreestyleSettings FreestyleSettings;
/* FreestyleConfig */
void BKE_freestyle_config_init(FreestyleConfig *config);
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index b2991679775..f2d4fbc6961 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_GLOBAL_H__
#define __BKE_GLOBAL_H__
-/** \file BKE_global.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
- * \section aboutglobal Global settings
+/** \file
+ * \ingroup bke
+ * \section aboutglobal Global settings
* Global settings, handles, pointers. This is the root for finding
* any data in Blender. This block is not serialized, but built anew
* for every fresh Blender run.
@@ -43,26 +33,25 @@
extern "C" {
#endif
-/* forwards */
struct Main;
typedef struct Global {
- /* active pointers */
+ /** Active pointers. */
struct Main *main;
- /* strings: lastsaved */
+ /** Strings: last saved */
char ima[1024], lib[1024]; /* 1024 = FILE_MAX */
- /* when set: G_MAIN->name contains valid relative base path */
+ /** When set: `G_MAIN->name` contains valid relative base path. */
bool relbase_valid;
bool file_loaded;
bool save_over;
- /* strings of recent opened files */
+ /** Strings of recent opened files. */
struct ListBase recent_files;
- /* has escape been pressed or Ctrl+C pressed in background mode, used for render quit */
+ /** Has escape been pressed or Ctrl+C pressed in background mode, used for render quit. */
bool is_break;
bool background;
@@ -70,55 +59,74 @@ typedef struct Global {
short moving;
- /* to indicate render is busy, prevent renderwindow events etc */
+ /** To indicate render is busy, prevent renderwindow events etc. */
bool is_rendering;
- /* debug value, can be set from the UI and python, used for testing nonstandard features */
+ /**
+ * Debug value, can be set from the UI and python, used for testing nonstandard features.
+ * DO NOT abuse it with generic checks like `if (G.debug_value > 0)`. Do not use it as bitflags.
+ * Only precise specific values should be checked for, to avoid unpredictable side-effects.
+ * Please document here the value(s) you are using (or a range of values reserved to some area).
+ * * -16384 and below: Reserved for python (add-ons) usage.
+ * * -1: Disable faster motion paths computation (since 08/2018).
+ * * 1 - 30: EEVEE debug/stats values (01/2018).
+ * * 101: Enable UI debug drawing of fullscreen area's corner widget (10/2014).
+ * * 527: Old mysterious switch in behavior of MeshDeform modifier (before 04/2010).
+ * * 666: Use quicker batch delete for outliners' delete hierarchy (01/2019).
+ * * 777: Enable UI node panel's sockets polling (11/2011).
+ * * 799: Enable some mysterious new depsgraph behavior (05/2015).
+ * * 1112: Disable new Cloth internal springs hanlding (09/2014).
+ * * 1234: Disable new dyntopo code fixing skinny faces generation (04/2015).
+ * * 16384 and above: Reserved for python (add-ons) usage.
+ */
short debug_value;
- /* saved to the blend file as FileGlobal.globalf,
- * however this is now only used for runtime options */
+ /** Saved to the blend file as #FileGlobal.globalf,
+ * however this is now only used for runtime options. */
int f;
struct {
- /* Logging vars (different loggers may use). */
+ /** Logging vars (different loggers may use). */
int level;
- /* FILE handle or use stderr (we own this so close when done). */
+ /** FILE handle or use stderr (we own this so close when done). */
void *file;
} log;
- /* debug flag, G_DEBUG, G_DEBUG_PYTHON & friends, set python or command line args */
+ /** debug flag, #G_DEBUG, #G_DEBUG_PYTHON & friends, set python or command line args */
int debug;
- /* this variable is written to / read from FileGlobal->fileflags */
+ /** This variable is written to / read from #FileGlobal.fileflags */
int fileflags;
- /* message to use when autoexec fails */
+ /** Message to use when auto execution fails. */
char autoexec_fail[200];
} Global;
/* **************** GLOBAL ********************* */
-/* G.f */
-#define G_RENDER_OGL (1 << 0)
-#define G_SWAP_EXCHANGE (1 << 1)
-/* #define G_RENDER_SHADOW (1 << 3) */ /* temp flag, removed */
-#define G_BACKBUFSEL (1 << 4)
-#define G_PICKSEL (1 << 5)
-
-/* #define G_FACESELECT (1 << 8) use (mesh->editflag & ME_EDIT_PAINT_FACE_SEL) */
-
-#define G_SCRIPT_AUTOEXEC (1 << 13)
-#define G_SCRIPT_OVERRIDE_PREF (1 << 14) /* when this flag is set ignore the userprefs */
-#define G_SCRIPT_AUTOEXEC_FAIL (1 << 15)
-#define G_SCRIPT_AUTOEXEC_FAIL_QUIET (1 << 16)
+/** #Global.f */
+enum {
+ G_FLAG_RENDER_VIEWPORT = (1 << 0),
+ G_FLAG_BACKBUFSEL = (1 << 1),
+ G_FLAG_PICKSEL = (1 << 2),
+ /** Support simulating events (for testing). */
+ G_FLAG_EVENT_SIMULATE = (1 << 3),
+
+ G_FLAG_SCRIPT_AUTOEXEC = (1 << 13),
+ /** When this flag is set ignore the prefs #USER_SCRIPT_AUTOEXEC_DISABLE. */
+ G_FLAG_SCRIPT_OVERRIDE_PREF = (1 << 14),
+ G_FLAG_SCRIPT_AUTOEXEC_FAIL = (1 << 15),
+ G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET = (1 << 16),
+};
-/* #define G_NOFROZEN (1 << 17) also removed */
-/* #define G_GREASEPENCIL (1 << 17) also removed */
+/** Don't overwrite these flags when reading a file. */
+#define G_FLAG_ALL_RUNTIME \
+ (G_FLAG_SCRIPT_AUTOEXEC | G_FLAG_SCRIPT_OVERRIDE_PREF | G_FLAG_EVENT_SIMULATE)
-/* #define G_AUTOMATKEYS (1 << 30) also removed */
+/** Flags to read from blend file. */
+#define G_FLAG_ALL_READFILE 0
-/* G.debug */
+/** #Global.debug */
enum {
G_DEBUG = (1 << 0), /* general debug flag, print more info in unexpected cases */
G_DEBUG_FFMPEG = (1 << 1),
@@ -146,49 +154,40 @@ enum {
G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 19), /* force gpu workarounds bypassing detections. */
};
-#define G_DEBUG_ALL (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \
- G_DEBUG_FREESTYLE | G_DEBUG_DEPSGRAPH | G_DEBUG_GPU_MEM | G_DEBUG_IO | G_DEBUG_GPU_SHADERS)
-
-
-/* G.fileflags */
-
-#define G_AUTOPACK (1 << 0)
-#define G_FILE_COMPRESS (1 << 1)
-
-#define G_FILE_USERPREFS (1 << 9)
-#define G_FILE_NO_UI (1 << 10)
-#ifdef DNA_DEPRECATED_ALLOW
-/* #define G_FILE_GAME_TO_IPO (1 << 11) */ /* deprecated */
-#define G_FILE_GAME_MAT (1 << 12) /* deprecated */
-/* #define G_FILE_DISPLAY_LISTS (1 << 13) */ /* deprecated */
-#define G_FILE_SHOW_PHYSICS (1 << 14) /* deprecated */
-#define G_FILE_GAME_MAT_GLSL (1 << 15) /* deprecated */
-/* #define G_FILE_GLSL_NO_LIGHTS (1 << 16) */ /* deprecated */
-#define G_FILE_GLSL_NO_SHADERS (1 << 17) /* deprecated */
-#define G_FILE_GLSL_NO_SHADOWS (1 << 18) /* deprecated */
-#define G_FILE_GLSL_NO_RAMPS (1 << 19) /* deprecated */
-#define G_FILE_GLSL_NO_NODES (1 << 20) /* deprecated */
-#define G_FILE_GLSL_NO_EXTRA_TEX (1 << 21) /* deprecated */
-#define G_FILE_IGNORE_DEPRECATION_WARNINGS (1 << 22) /* deprecated */
-#endif /* DNA_DEPRECATED_ALLOW */
-
-/* On read, use #FileGlobal.filename instead of the real location on-disk,
- * needed for recovering temp files so relative paths resolve */
-#define G_FILE_RECOVER (1 << 23)
-/* On write, remap relative file paths to the new file location. */
-#define G_FILE_RELATIVE_REMAP (1 << 24)
-/* On write, make backup `.blend1`, `.blend2` ... files, when the users preference is enabled */
-#define G_FILE_HISTORY (1 << 25)
-/* BMesh option to save as older mesh format */
-// #define G_FILE_MESH_COMPAT (1 << 26)
-/* On write, restore paths after editing them (G_FILE_RELATIVE_REMAP) */
-#define G_FILE_SAVE_COPY (1 << 27)
-#define G_FILE_GLSL_NO_ENV_LIGHTING (1 << 28)
-
-#define G_FILE_FLAGS_RUNTIME (G_FILE_NO_UI | G_FILE_RELATIVE_REMAP | G_FILE_SAVE_COPY)
-
-/* ENDIAN_ORDER: indicates what endianness the platform where the file was
- * written had. */
+#define G_DEBUG_ALL \
+ (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \
+ G_DEBUG_FREESTYLE | G_DEBUG_DEPSGRAPH | G_DEBUG_GPU_MEM | G_DEBUG_IO | G_DEBUG_GPU_SHADERS)
+
+
+/** #Global.fileflags */
+enum {
+ G_FILE_AUTOPACK = (1 << 0),
+ G_FILE_COMPRESS = (1 << 1),
+
+ G_FILE_USERPREFS = (1 << 9),
+ G_FILE_NO_UI = (1 << 10),
+
+ /* Bits 11 to 22 (inclusive) are deprecated & need to be cleared */
+
+ /** On read, use #FileGlobal.filename instead of the real location on-disk,
+ * needed for recovering temp files so relative paths resolve */
+ G_FILE_RECOVER = (1 << 23),
+ /** On write, remap relative file paths to the new file location. */
+ G_FILE_RELATIVE_REMAP = (1 << 24),
+ /** On write, make backup `.blend1`, `.blend2` ... files, when the users preference is enabled */
+ G_FILE_HISTORY = (1 << 25),
+ /** BMesh option to save as older mesh format */
+/* #define G_FILE_MESH_COMPAT (1 << 26) */
+ /** On write, restore paths after editing them (G_FILE_RELATIVE_REMAP) */
+ G_FILE_SAVE_COPY = (1 << 27),
+/* #define G_FILE_GLSL_NO_ENV_LIGHTING (1 << 28) */ /* deprecated */
+};
+
+/** Don't overwrite these flags when reading a file. */
+#define G_FILE_FLAG_ALL_RUNTIME \
+ (G_FILE_NO_UI | G_FILE_RELATIVE_REMAP | G_FILE_SAVE_COPY)
+
+/** ENDIAN_ORDER: indicates what endianness the platform where the file was written had. */
#if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
# error Either __BIG_ENDIAN__ or __LITTLE_ENDIAN__ must be defined.
#endif
@@ -202,18 +201,21 @@ enum {
# define ENDIAN_ORDER L_ENDIAN
#endif
-/* G.moving, signals drawing in (3d) window to denote transform */
-#define G_TRANSFORM_OBJ 1
-#define G_TRANSFORM_EDIT 2
-#define G_TRANSFORM_SEQ 4
-#define G_TRANSFORM_FCURVES 8
-#define G_TRANSFORM_WM 16
+/** #Global.moving, signals drawing in (3d) window to denote transform */
+enum {
+ G_TRANSFORM_OBJ = (1 << 0),
+ G_TRANSFORM_EDIT = (1 << 1),
+ G_TRANSFORM_SEQ = (1 << 2),
+ G_TRANSFORM_FCURVES = (1 << 3),
+ G_TRANSFORM_WM = (1 << 4),
+};
-/* Memory is allocated where? blender.c */
+/** Defined in blender.c */
extern Global G;
/**
- * Stupid macro to hide the few *valid* usages of G.main (from startup/exit code e.g.), helps with cleanup task.
+ * Stupid macro to hide the few *valid* usages of `G.main` (from startup/exit code e.g.),
+ * helps with cleanup task.
*/
#define G_MAIN (G).main
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 989bec1957b..eb4101fa2f7 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,41 +15,36 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_GPENCIL_H__
#define __BKE_GPENCIL_H__
- /** \file BKE_gpencil.h
- * \ingroup bke
- * \author Joshua Leung
- */
+/** \file
+ * \ingroup bke
+ */
+struct ArrayGpencilModifierData;
+struct BoundBox;
+struct Brush;
struct CurveMapping;
struct Depsgraph;
struct GpencilModifierData;
-struct ToolSettings;
+struct LatticeGpencilModifierData;
struct ListBase;
-struct bGPdata;
-struct bGPDlayer;
-struct bGPDframe;
-struct bGPDspoint;
-struct bGPDstroke;
-struct Material;
-struct bGPDpalette;
-struct bGPDpalettecolor;
struct Main;
-struct BoundBox;
-struct Brush;
+struct Material;
struct Object;
-struct bDeformGroup;
struct SimplifyGpencilModifierData;
-struct ArrayGpencilModifierData;
-struct LatticeGpencilModifierData;
+struct ToolSettings;
+struct bDeformGroup;
+struct bGPDframe;
+struct bGPDlayer;
+struct bGPDpalette;
+struct bGPDpalettecolor;
+struct bGPDspoint;
+struct bGPDstroke;
+struct bGPdata;
struct MDeformVert;
struct MDeformWeight;
@@ -127,7 +120,7 @@ typedef enum eGP_GetFrame_Mode {
/* Add a new empty/blank frame */
GP_GETFRAME_ADD_NEW = 1,
/* Make a copy of the active frame */
- GP_GETFRAME_ADD_COPY = 2
+ GP_GETFRAME_ADD_COPY = 2,
} eGP_GetFrame_Mode;
struct bGPDframe *BKE_gpencil_layer_getframe(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew);
@@ -167,9 +160,14 @@ void BKE_gpencil_stroke_normal(const struct bGPDstroke *gps, float r_normal[3]);
void BKE_gpencil_simplify_stroke(struct bGPDstroke *gps, float factor);
void BKE_gpencil_simplify_fixed(struct bGPDstroke *gps);
void BKE_gpencil_subdivide(struct bGPDstroke *gps, int level, int flag);
+bool BKE_gpencil_trim_stroke(struct bGPDstroke *gps);
void BKE_gpencil_stroke_2d_flat(
const struct bGPDspoint *points, int totpoints, float(*points2d)[2], int *r_direction);
+void BKE_gpencil_stroke_2d_flat_ref(
+ const struct bGPDspoint *ref_points, int ref_totpoints,
+ const struct bGPDspoint *points, int totpoints,
+ float(*points2d)[2], const float scale, int *r_direction);
void BKE_gpencil_transform(struct bGPdata *gpd, float mat[4][4]);
@@ -181,4 +179,7 @@ bool BKE_gpencil_smooth_stroke_uv(struct bGPDstroke *gps, int point_index, float
void BKE_gpencil_get_range_selected(struct bGPDlayer *gpl, int *r_initframe, int *r_endframe);
float BKE_gpencil_multiframe_falloff_calc(struct bGPDframe *gpf, int actnum, int f_init, int f_end, struct CurveMapping *cur_falloff);
+extern void (*BKE_gpencil_batch_cache_dirty_tag_cb)(struct bGPdata *gpd);
+extern void (*BKE_gpencil_batch_cache_free_cb)(struct bGPdata *gpd);
+
#endif /* __BKE_GPENCIL_H__ */
diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h
index 8acbfac7981..fe95904722f 100644
--- a/source/blender/blenkernel/BKE_gpencil_modifier.h
+++ b/source/blender/blenkernel/BKE_gpencil_modifier.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,40 +12,36 @@
* 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: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_GPENCIL_MODIFIER_H__
#define __BKE_GPENCIL_MODIFIER_H__
-/** \file BKE_gpencil_modifier.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_gpencil_modifier_types.h" /* needed for all enum typdefs */
#include "BLI_compiler_attrs.h"
#include "BKE_customdata.h"
-struct ID;
+struct BMEditMesh;
+struct DepsNodeHandle;
struct Depsgraph;
struct DerivedMesh;
-struct bContext; /* NOTE: bakeModifier() - called from UI - needs to create new datablocks, hence the need for this */
+struct GpencilModifierData;
+struct ID;
+struct ListBase;
+struct Main;
struct Mesh;
+struct ModifierUpdateDepsgraphContext;
struct Object;
struct Scene;
struct ViewLayer;
-struct ListBase;
struct bArmature;
-struct Main;
-struct GpencilModifierData;
-struct BMEditMesh;
-struct DepsNodeHandle;
-struct bGPDlayer;
+struct bContext; /* NOTE: bakeModifier() - called from UI - needs to create new datablocks, hence the need for this */
struct bGPDframe;
+struct bGPDlayer;
struct bGPDstroke;
-struct ModifierUpdateDepsgraphContext;
#define GPENCIL_MODIFIER_ACTIVE(_md, _is_render) \
((((_md)->mode & eGpencilModifierMode_Realtime) && (_is_render == false)) || \
diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h
index 7a5262e0a14..abfcd0f19b7 100644
--- a/source/blender/blenkernel/BKE_icons.h
+++ b/source/blender/blenkernel/BKE_icons.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2006-2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_ICONS_H__
#define __BKE_ICONS_H__
-/** \file BKE_icons.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Resizable Icons for Blender
*/
@@ -78,9 +70,9 @@ struct Icon_Geom {
typedef struct Icon Icon;
+struct ID;
struct ImBuf;
struct PreviewImage;
-struct ID;
struct StudioLight;
struct bGPDlayer;
diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h
index 2400d02a21d..ef8bc5e7f55 100644
--- a/source/blender/blenkernel/BKE_idcode.h
+++ b/source/blender/blenkernel/BKE_idcode.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_IDCODE_H__
#define __BKE_IDCODE_H__
-/** \file BKE_idcode.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
const char *BKE_idcode_to_name(short idcode);
@@ -43,13 +35,8 @@ int BKE_idcode_to_idfilter(const short idcode);
short BKE_idcode_from_idfilter(const int idfilter);
int BKE_idcode_to_index(const short idcode);
+short BKE_idcode_from_index(const int index);
-/**
- * Return an ID code and steps the index forward 1.
- *
- * \param index: start as 0.
- * \return the code, 0 when all codes have been returned.
- */
short BKE_idcode_iter_step(int *index);
#endif
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index 6df31db7b83..c1901d6e15f 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,13 @@
* 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
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_IDPROP_H__
#define __BKE_IDPROP_H__
-/** \file BKE_idprop.h
- * \ingroup bke
- * \author Joseph Eagar
+/** \file
+ * \ingroup bke
*/
#include "DNA_ID.h"
@@ -36,8 +29,8 @@
extern "C" {
#endif
-struct IDProperty;
struct ID;
+struct IDProperty;
typedef union IDPropertyTemplate {
int i;
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 4bcb8e0c15d..cbf692afd70 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,38 +15,32 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_IMAGE_H__
#define __BKE_IMAGE_H__
-/** \file BKE_image.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
-struct Image;
+struct Depsgraph;
+struct ID;
struct ImBuf;
-struct ImbFormatOptions;
-struct anim;
-struct Scene;
-struct Object;
+struct Image;
struct ImageFormatData;
struct ImagePool;
+struct ImbFormatOptions;
struct Main;
-struct ReportList;
+struct Object;
struct RenderResult;
+struct ReportList;
+struct Scene;
struct StampData;
+struct anim;
#define IMA_MAX_SPACE 64
@@ -72,10 +64,12 @@ void BKE_render_result_stamp_info(struct Scene *scene, struct Object *camera,
* The caller is responsible for freeing the allocated memory.
*/
struct StampData *BKE_stamp_info_from_scene_static(struct Scene *scene);
+bool BKE_stamp_is_known_field(const char *field_name);
void BKE_imbuf_stamp_info(struct RenderResult *rr, struct ImBuf *ibuf);
void BKE_stamp_info_from_imbuf(struct RenderResult *rr, struct ImBuf *ibuf);
void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCallback callback, bool noskip);
void BKE_render_result_stamp_data(struct RenderResult *rr, const char *key, const char *value);
+struct StampData *BKE_stamp_data_copy(const struct StampData *stamp_data);
void BKE_stamp_data_free(struct StampData *stamp_data);
void BKE_image_stamp_buf(
struct Scene *scene, struct Object *camera, const struct StampData *stamp_data_template,
@@ -147,7 +141,7 @@ struct RenderResult;
enum {
IMA_GENTYPE_BLANK = 0,
IMA_GENTYPE_GRID = 1,
- IMA_GENTYPE_GRID_COLOR = 2
+ IMA_GENTYPE_GRID_COLOR = 2,
};
/* ima->ok */
@@ -202,6 +196,8 @@ struct Image *BKE_image_add_from_imbuf(struct Main *bmain, struct ImBuf *ibuf, c
void BKE_image_init_imageuser(struct Image *ima, struct ImageUser *iuser);
void BKE_image_signal(struct Main *bmain, struct Image *ima, struct ImageUser *iuser, int signal);
+void BKE_image_walk_id_all_users(struct ID *id, void *customdata,
+ void callback(struct Image *ima, struct ImageUser *iuser, void *customdata));
void BKE_image_walk_all_users(const struct Main *mainp, void *customdata,
void callback(struct Image *ima, struct ImageUser *iuser, void *customdata));
@@ -212,10 +208,13 @@ void BKE_image_verify_viewer_views(const struct RenderData *rd, struct Image *im
/* called on frame change or before render */
void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra);
-void BKE_image_user_check_frame_calc(struct ImageUser *iuser, int cfra);
int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, bool *r_is_in_range);
void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path);
-void BKE_image_update_frame(const struct Main *bmain, int cfra);
+void BKE_image_editors_update_frame(const struct Main *bmain, int cfra);
+
+/* dependency graph update for image user users */
+bool BKE_image_user_id_has_animation(struct ID *id);
+void BKE_image_user_id_eval_animation(struct Depsgraph *depsgrah, struct ID *id);
/* sets index offset for multilayer files */
struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser);
diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h
index 2370908332d..2825c4845ae 100644
--- a/source/blender/blenkernel/BKE_ipo.h
+++ b/source/blender/blenkernel/BKE_ipo.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,20 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): 2008,2009 Joshua Leung (Animation Cleanup, Animation Systme Recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_IPO_H__
#define __BKE_IPO_H__
-/** \file BKE_ipo.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
- * \author Joshua Leung
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
-struct Main;
struct Ipo;
+struct Main;
void do_versions_ipos_to_animato(struct Main *main);
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h
index 73a6f5047b2..d0d558cb829 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,22 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_KEY_H__
#define __BKE_KEY_H__
-/** \file BKE_key.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
+struct Curve;
+struct ID;
struct Key;
struct KeyBlock;
-struct ID;
-struct ListBase;
-struct Curve;
-struct Object;
struct Lattice;
+struct ListBase;
struct Main;
struct Mesh;
+struct Object;
struct WeightsArrayCache;
/* Kernel prototypes */
@@ -66,10 +56,12 @@ float *BKE_key_evaluate_object_ex(
float *BKE_key_evaluate_object(
struct Object *ob, int *r_totelem);
+bool BKE_key_idtype_support(const short id_type);
+
struct Key **BKE_key_from_id_p(struct ID *id);
struct Key *BKE_key_from_id(struct ID *id);
-struct Key **BKE_key_from_object_p(struct Object *ob);
-struct Key *BKE_key_from_object(struct Object *ob);
+struct Key **BKE_key_from_object_p(const struct Object *ob);
+struct Key *BKE_key_from_object(const struct Object *ob);
struct KeyBlock *BKE_keyblock_from_object(struct Object *ob);
struct KeyBlock *BKE_keyblock_from_object_reference(struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_keyconfig.h b/source/blender/blenkernel/BKE_keyconfig.h
index 94d00b19d42..132914e15d3 100644
--- a/source/blender/blenkernel/BKE_keyconfig.h
+++ b/source/blender/blenkernel/BKE_keyconfig.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_KEYCONFIG_H__
#define __BKE_KEYCONFIG_H__
-/** \file BKE_keyconfig.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
/** Based on #BKE_addon_pref_type_init and friends */
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index b2911129525..d7597d61753 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,33 +15,25 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_LATTICE_H__
#define __BKE_LATTICE_H__
-/** \file BKE_lattice.h
- * \ingroup bke
- * \author Ton Roosendaal
- * \since June 2001
+/** \file
+ * \ingroup bke
*/
#include "BLI_compiler_attrs.h"
+struct BPoint;
+struct Depsgraph;
struct Lattice;
+struct MDeformVert;
struct Main;
struct Mesh;
struct Object;
struct Scene;
-struct BPoint;
-struct MDeformVert;
-struct Depsgraph;
struct bGPDstroke;
void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
@@ -119,4 +109,7 @@ enum {
void BKE_lattice_batch_cache_dirty_tag(struct Lattice *lt, int mode);
void BKE_lattice_batch_cache_free(struct Lattice *lt);
+extern void (*BKE_lattice_batch_cache_dirty_tag_cb)(struct Lattice *lt, int mode);
+extern void (*BKE_lattice_batch_cache_free_cb)(struct Lattice *lt);
+
#endif /* __BKE_LATTICE_H__ */
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index 9ac0c56d93f..f10f2f44706 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): Blender Foundation, Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_LAYER_H__
#define __BKE_LAYER_H__
-/** \file blender/blenkernel/BKE_layer.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_collection.h"
@@ -40,8 +34,6 @@ extern "C" {
#define TODO_LAYER_OPERATORS /* collection mamanger and property panel operators */
#define TODO_LAYER /* generic todo */
-#define ROOT_PROP "root"
-
struct Base;
struct Collection;
struct Depsgraph;
@@ -113,16 +105,16 @@ bool BKE_layer_collection_objects_select(
struct ViewLayer *view_layer, struct LayerCollection *lc, bool deselect);
bool BKE_layer_collection_has_selected_objects(
struct ViewLayer *view_layer, struct LayerCollection *lc);
+bool BKE_layer_collection_has_layer_collection(
+ struct LayerCollection *lc_parent, struct LayerCollection *lc_child);
void BKE_base_set_visible(struct Scene *scene, struct ViewLayer *view_layer, struct Base *base, bool extend);
-void BKE_layer_collection_set_visible(struct Scene *scene, struct ViewLayer *view_layer, struct LayerCollection *lc, bool extend);
+bool BKE_layer_collection_isolate(struct Scene *scene, struct ViewLayer *view_layer, struct LayerCollection *lc, bool extend);
+bool BKE_layer_collection_set_visible(struct ViewLayer *view_layer, struct LayerCollection *lc, const bool visible, const bool hierarchy);
/* evaluation */
-void BKE_layer_eval_view_layer(
- struct Depsgraph *depsgraph,
- struct Scene *scene,
- struct ViewLayer *view_layer);
+void BKE_base_eval_flags(struct Base *base);
void BKE_layer_eval_view_layer_indexed(
struct Depsgraph *depsgraph,
@@ -156,10 +148,6 @@ struct ObjectsInModeIteratorData {
struct Base *base_active;
};
-void BKE_view_layer_renderable_objects_iterator_begin(BLI_Iterator *iter, void *data_in);
-void BKE_view_layer_renderable_objects_iterator_next(BLI_Iterator *iter);
-void BKE_view_layer_renderable_objects_iterator_end(BLI_Iterator *iter);
-
void BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void *data_in);
void BKE_view_layer_bases_in_mode_iterator_next(BLI_Iterator *iter);
void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator *iter);
@@ -320,34 +308,6 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter);
ITER_END; \
} ((void)0)
-struct ObjectsRenderableIteratorData {
- struct Scene *scene;
- struct Base base_temp;
- struct Scene scene_temp;
-
- struct {
- struct ViewLayer *view_layer;
- struct Base *base;
- struct Scene *set;
- } iter;
-};
-
-#define FOREACH_OBJECT_RENDERABLE_BEGIN(scene_, _instance) \
-{ \
- struct ObjectsRenderableIteratorData data_ = { \
- .scene = (scene_), \
- }; \
- ITER_BEGIN(BKE_view_layer_renderable_objects_iterator_begin, \
- BKE_view_layer_renderable_objects_iterator_next, \
- BKE_view_layer_renderable_objects_iterator_end, \
- &data_, Object *, _instance)
-
-
-#define FOREACH_OBJECT_RENDERABLE_END \
- ITER_END; \
-} ((void)0)
-
-
/* layer_utils.c */
struct ObjectsInModeParams {
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index a4eb40cbb38..45a60453d2e 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_LIBRARY_H__
#define __BKE_LIBRARY_H__
-/** \file BKE_library.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
@@ -38,17 +28,35 @@ extern "C" {
#include "BLI_compiler_attrs.h"
+/**
+ * Naming: BKE_id_ vs BKE_libblock_
+ *
+ * WARNING: description below is ideal goal, current status of naming does not yet
+ * fully follow it (this is WIP).
+ *
+ * BKE_id_ should be used for rather high-level operations, that involve Main database and
+ * relations with other IDs, and can be considered as 'safe' (as in, in themselves, they leave
+ * affected IDs/Main in a consistent status).
+ *
+ * BKE_libblock_ should be used for lower level operations, that perform some parts of BKE_id_ ones,
+ * but will generally not ensure caller that affected data is in a consistent state
+ * by their own execution alone.
+ *
+ * Consequently, external code should not typically use BKE_libblock_ functions,
+ * except in some specific cases requiring advanced (and potentially dangerous) handling.
+ */
+
struct BlendThumbnail;
struct GHash;
-struct ListBase;
struct ID;
struct ImBuf;
-struct Main;
struct Library;
-struct wmWindowManager;
-struct bContext;
+struct ListBase;
+struct Main;
struct PointerRNA;
struct PropertyRNA;
+struct bContext;
+struct wmWindowManager;
size_t BKE_libblock_get_alloc_info(short type, const char **name);
void *BKE_libblock_alloc_notest(short type) ATTR_WARN_UNUSED_RESULT;
@@ -73,26 +81,44 @@ enum {
* Implies LIB_ID_CREATE_NO_MAIN. */
LIB_ID_CREATE_NO_ALLOCATE = 1 << 2,
- LIB_ID_CREATE_NO_DEG_TAG = 1 << 8, /* Do not tag new ID for update in depsgraph. */
-
- /* Specific options to some ID types or usages, may be ignored by unrelated ID copying functions. */
- LIB_ID_COPY_NO_PROXY_CLEAR = 1 << 16, /* Object only, needed by make_local code. */
- LIB_ID_COPY_NO_PREVIEW = 1 << 17, /* Do not copy preview data, when supported. */
- LIB_ID_COPY_CACHES = 1 << 18, /* Copy runtime data caches. */
- LIB_ID_COPY_NO_ANIMDATA = 1 << 19, /* Don't copy id->adt, used by ID datablock localization routines. */
- LIB_ID_COPY_CD_REFERENCE = 1 << 20, /* Mesh: Reference CD data layers instead of doing real copy. */
-
- /* XXX Hackish/not-so-nice specific behaviors needed for some corner cases.
- * Ideally we should not have those, but we need them for now... */
- LIB_ID_COPY_ACTIONS = 1 << 24, /* EXCEPTION! Deep-copy actions used by animdata of copied ID. */
- LIB_ID_COPY_KEEP_LIB = 1 << 25, /* Keep the library pointer when copying datablock outside of bmain. */
- LIB_ID_COPY_SHAPEKEY = 1 << 26, /* EXCEPTION! Deep-copy shapekeys used by copied obdata ID. */
+ /* Do not tag new ID for update in depsgraph. */
+ LIB_ID_CREATE_NO_DEG_TAG = 1 << 8,
+
+ /* *** Specific options to some ID types or usages. *** */
+ /* *** May be ignored by unrelated ID copying functions. *** */
+ /* Object only, needed by make_local code. */
+ LIB_ID_COPY_NO_PROXY_CLEAR = 1 << 16,
+ /* Do not copy preview data, when supported. */
+ LIB_ID_COPY_NO_PREVIEW = 1 << 17,
+ /* Copy runtime data caches. */
+ LIB_ID_COPY_CACHES = 1 << 18,
+ /* Don't copy id->adt, used by ID datablock localization routines. */
+ LIB_ID_COPY_NO_ANIMDATA = 1 << 19,
+ /* Mesh: Reference CD data layers instead of doing real copy - USE WITH CAUTION! */
+ LIB_ID_COPY_CD_REFERENCE = 1 << 20,
+
+ /* *** XXX Hackish/not-so-nice specific behaviors needed for some corner cases. *** */
+ /* *** Ideally we should not have those, but we need them for now... *** */
+ /* EXCEPTION! Deep-copy actions used by animdata of copied ID. */
+ LIB_ID_COPY_ACTIONS = 1 << 24,
+ /* Keep the library pointer when copying datablock outside of bmain. */
+ LIB_ID_COPY_KEEP_LIB = 1 << 25,
+ /* EXCEPTION! Deep-copy shapekeys used by copied obdata ID. */
+ LIB_ID_COPY_SHAPEKEY = 1 << 26,
+
+ /* *** Helper 'defines' gathering most common flag sets. *** */
+ /* Shapekeys are not real ID's, more like local data to geometry IDs... */
+ LIB_ID_COPY_DEFAULT = LIB_ID_COPY_SHAPEKEY,
+ /* Generate a local copy, outside of bmain, to work on (used by COW e.g.). */
+ LIB_ID_COPY_LOCALIZE = LIB_ID_CREATE_NO_MAIN |
+ LIB_ID_CREATE_NO_USER_REFCOUNT |
+ LIB_ID_CREATE_NO_DEG_TAG |
+ LIB_ID_COPY_NO_PREVIEW |
+ LIB_ID_COPY_CACHES,
};
void BKE_libblock_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, const int flag);
void *BKE_libblock_copy(struct Main *bmain, const struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-/* "Deprecated" old API. */
-void *BKE_libblock_copy_nolib(const struct ID *id, const bool do_action) ATTR_NONNULL();
/* Special version. sued by datablock localization. */
void *BKE_libblock_copy_for_localize(const struct ID *id);
@@ -121,13 +147,16 @@ enum {
LIB_ID_FREE_NO_UI_USER = 1 << 9, /* Do not attempt to remove freed ID from UI data/notifiers/... */
};
+void BKE_libblock_free_datablock(struct ID *id, const int flag) ATTR_NONNULL();
+void BKE_libblock_free_data(struct ID *id, const bool do_id_user) ATTR_NONNULL();
+
void BKE_id_free_ex(struct Main *bmain, void *idv, int flag, const bool use_flag_from_idtag);
void BKE_id_free(struct Main *bmain, void *idv);
-/* Those three naming are bad actually, should be BKE_id_free... (since it goes beyond mere datablock). */
-/* "Deprecated" old API */
-void BKE_libblock_free_ex(struct Main *bmain, void *idv, const bool do_id_user, const bool do_ui_user) ATTR_NONNULL();
-void BKE_libblock_free(struct Main *bmain, void *idv) ATTR_NONNULL();
-void BKE_libblock_free_us(struct Main *bmain, void *idv) ATTR_NONNULL();
+
+void BKE_id_free_us(struct Main *bmain, void *idv) ATTR_NONNULL();
+
+void BKE_id_delete(struct Main *bmain, void *idv) ATTR_NONNULL();
+void BKE_id_multi_tagged_delete(struct Main *bmain) ATTR_NONNULL();
void BKE_libblock_management_main_add(struct Main *bmain, void *idv);
void BKE_libblock_management_main_remove(struct Main *bmain, void *idv);
@@ -135,12 +164,6 @@ void BKE_libblock_management_main_remove(struct Main *bmain, void *idv);
void BKE_libblock_management_usercounts_set(struct Main *bmain, void *idv);
void BKE_libblock_management_usercounts_clear(struct Main *bmain, void *idv);
-/* TODO should be named "BKE_id_delete()". */
-void BKE_libblock_delete(struct Main *bmain, void *idv) ATTR_NONNULL();
-
-void BKE_libblock_free_datablock(struct ID *id, const int flag) ATTR_NONNULL();
-void BKE_libblock_free_data(struct ID *id, const bool do_id_user) ATTR_NONNULL();
-
void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
void id_lib_extern(struct ID *id);
void BKE_library_filepath_set(struct Main *bmain, struct Library *lib, const char *filepath);
@@ -156,14 +179,15 @@ void BKE_id_clear_newpoin(struct ID *id);
void BKE_id_make_local_generic(struct Main *bmain, struct ID *id, const bool id_in_mainlist, const bool lib_local);
bool id_make_local(struct Main *bmain, struct ID *id, const bool test, const bool force_local);
bool id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, struct PropertyRNA *prop);
-bool id_copy(struct Main *bmain, const struct ID *id, struct ID **newid, bool test);
-bool BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, const int flag, const bool test);
+bool BKE_id_copy_is_allowed(const struct ID *id);
+bool BKE_id_copy(struct Main *bmain, const struct ID *id, struct ID **newid);
+bool BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, const int flag);
void BKE_id_swap(struct Main *bmain, struct ID *id_a, struct ID *id_b);
void id_sort_by_name(struct ListBase *lb, struct ID *id);
void BKE_id_expand_local(struct Main *bmain, struct ID *id);
void BKE_id_copy_ensure_local(struct Main *bmain, const struct ID *old_id, struct ID *new_id);
-bool new_id(struct ListBase *lb, struct ID *id, const char *name) ATTR_NONNULL(1, 2);
+bool BKE_id_new_name_validate(struct ListBase *lb, struct ID *id, const char *name) ATTR_NONNULL(1, 2);
void id_clear_lib_data(struct Main *bmain, struct ID *id);
void id_clear_lib_data_ex(struct Main *bmain, struct ID *id, const bool id_in_mainlist);
@@ -179,6 +203,9 @@ void BKE_main_id_clear_newpoins(struct Main *bmain);
void BKE_main_lib_objects_recalc_all(struct Main *bmain);
+/* Only for repairing files via versioning, avoid for general use. */
+void BKE_main_id_repair_duplicate_names_listbase(struct ListBase *lb);
+
#define MAX_ID_FULL_NAME (64 + 64 + 3 + 1) /* 64 is MAX_ID_NAME - 2 */
#define MAX_ID_FULL_NAME_UI (MAX_ID_FULL_NAME + 3) /* Adds 'keycode' two letters at begining. */
void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const struct ID *id);
@@ -200,9 +227,6 @@ bool BKE_id_is_in_global_main(struct ID *id);
void BKE_id_ordered_list(struct ListBase *ordered_lb, const struct ListBase *lb);
void BKE_id_reorder(const struct ListBase *lb, struct ID *id, struct ID *relative, bool after);
-/* use when "" is given to new_id() */
-#define ID_FALLBACK_NAME N_("Untitled")
-
#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->tag & LIB_TAG_DOIT))
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_library_idmap.h b/source/blender/blenkernel/BKE_library_idmap.h
index 971586ea8b7..a2ae4541484 100644
--- a/source/blender/blenkernel/BKE_library_idmap.h
+++ b/source/blender/blenkernel/BKE_library_idmap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,25 +12,25 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_LIBRARY_IDMAP_H__
#define __BKE_LIBRARY_IDMAP_H__
-/** \file BKE_library_idmap.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BLI_compiler_attrs.h"
struct ID;
-struct Main;
struct IDNameLib_Map;
+struct Main;
struct IDNameLib_Map *BKE_main_idmap_create(
- struct Main *bmain)
- ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+ struct Main *bmain,
+ const bool create_valid_ids_set,
+ struct Main *old_bmain)
+ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
void BKE_main_idmap_destroy(
struct IDNameLib_Map *id_typemap)
ATTR_NONNULL();
diff --git a/source/blender/blenkernel/BKE_library_override.h b/source/blender/blenkernel/BKE_library_override.h
index b6642bfa726..9a6700575ae 100644
--- a/source/blender/blenkernel/BKE_library_override.h
+++ b/source/blender/blenkernel/BKE_library_override.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2016 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Bastien Montagne.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_LIBRARY_OVERRIDE_H__
#define __BKE_LIBRARY_OVERRIDE_H__
-/** \file BKE_library_override.h
- * \ingroup bke
- * \since December 2016
- * \author mont29
+/** \file
+ * \ingroup bke
*/
struct ID;
diff --git a/source/blender/blenkernel/BKE_library_query.h b/source/blender/blenkernel/BKE_library_query.h
index dcba5df9a72..511fad5f267 100644
--- a/source/blender/blenkernel/BKE_library_query.h
+++ b/source/blender/blenkernel/BKE_library_query.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2014 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey SHarybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_LIBRARY_QUERY_H__
#define __BKE_LIBRARY_QUERY_H__
-/** \file BKE_library_query.h
- * \ingroup bke
- * \since March 2014
- * \author sergey
+/** \file
+ * \ingroup bke
*/
struct ID;
diff --git a/source/blender/blenkernel/BKE_library_remap.h b/source/blender/blenkernel/BKE_library_remap.h
index 3425ca011b7..efd34b97e8b 100644
--- a/source/blender/blenkernel/BKE_library_remap.h
+++ b/source/blender/blenkernel/BKE_library_remap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_LIBRARY_REMAP_H__
#define __BKE_LIBRARY_REMAP_H__
-/** \file BKE_library_remap.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
diff --git a/source/blender/blenkernel/BKE_lamp.h b/source/blender/blenkernel/BKE_light.h
index aa655c66477..c0bac890364 100644
--- a/source/blender/blenkernel/BKE_lamp.h
+++ b/source/blender/blenkernel/BKE_light.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-#ifndef __BKE_LAMP_H__
-#define __BKE_LAMP_H__
+#ifndef __BKE_LIGHT_H__
+#define __BKE_LIGHT_H__
-/** \file BKE_lamp.h
- * \ingroup bke
- * \brief General operations, lookup, etc. for blender lamps.
+/** \file
+ * \ingroup bke
+ * \brief General operations, lookup, etc. for blender lights.
*/
#ifdef __cplusplus
extern "C" {
@@ -38,17 +30,17 @@ extern "C" {
#include "BLI_compiler_attrs.h"
-struct Lamp;
+struct Light;
struct Main;
struct Scene;
-void BKE_lamp_init(struct Lamp *la);
-struct Lamp *BKE_lamp_add(struct Main *bmain, const char *name) ATTR_WARN_UNUSED_RESULT;
-void BKE_lamp_copy_data(struct Main *bmain, struct Lamp *la_dst, const struct Lamp *la_src, const int flag);
-struct Lamp *BKE_lamp_copy(struct Main *bmain, const struct Lamp *la) ATTR_WARN_UNUSED_RESULT;
-struct Lamp *BKE_lamp_localize(struct Lamp *la) ATTR_WARN_UNUSED_RESULT;
-void BKE_lamp_make_local(struct Main *bmain, struct Lamp *la, const bool lib_local);
-void BKE_lamp_free(struct Lamp *la);
+void BKE_light_init(struct Light *la);
+struct Light *BKE_light_add(struct Main *bmain, const char *name) ATTR_WARN_UNUSED_RESULT;
+void BKE_light_copy_data(struct Main *bmain, struct Light *la_dst, const struct Light *la_src, const int flag);
+struct Light *BKE_light_copy(struct Main *bmain, const struct Light *la) ATTR_WARN_UNUSED_RESULT;
+struct Light *BKE_light_localize(struct Light *la) ATTR_WARN_UNUSED_RESULT;
+void BKE_light_make_local(struct Main *bmain, struct Light *la, const bool lib_local);
+void BKE_light_free(struct Light *la);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/BKE_lightprobe.h b/source/blender/blenkernel/BKE_lightprobe.h
index a769b6653d7..b8750fd5285 100644
--- a/source/blender/blenkernel/BKE_lightprobe.h
+++ b/source/blender/blenkernel/BKE_lightprobe.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,24 +15,18 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_LIGHTPROBE_H__
#define __BKE_LIGHTPROBE_H__
-/** \file BKE_lightprobe.h
- * \ingroup bke
- * \brief General operations for probes.
+/** \file
+ * \ingroup bke
+ * \brief General operations for probes.
*/
-struct Main;
struct LightProbe;
+struct Main;
void BKE_lightprobe_init(struct LightProbe *probe);
void *BKE_lightprobe_add(struct Main *bmain, const char *name);
diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h
index 376a324d25c..68ca15fdf57 100644
--- a/source/blender/blenkernel/BKE_linestyle.h
+++ b/source/blender/blenkernel/BKE_linestyle.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_LINESTYLE_H__
#define __BKE_LINESTYLE_H__
-/** \file BKE_linestyle.h
- * \ingroup bke
- * \brief Blender kernel freestyle line style functionality.
+/** \file
+ * \ingroup bke
+ * \brief Blender kernel freestyle line style functionality.
*/
#include "DNA_linestyle_types.h"
@@ -44,11 +36,11 @@ extern "C" {
#define LS_MODIFIER_TYPE_THICKNESS 3
#define LS_MODIFIER_TYPE_GEOMETRY 4
+struct ColorBand;
struct Main;
struct Object;
-struct ColorBand;
-struct bContext;
struct ViewLayer;
+struct bContext;
void BKE_linestyle_init(struct FreestyleLineStyle *linestyle);
FreestyleLineStyle *BKE_linestyle_new(struct Main *bmain, const char *name);
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index e5a816b92ce..03f9f9a21ea 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,19 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MAIN_H__
#define __BKE_MAIN_H__
-/** \file BKE_main.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
- * \section aboutmain Main struct
+/** \file
+ * \ingroup bke
+ * \section aboutmain Main struct
* Main is the root of the 'database' of a Blender context. All data
* is stuffed into lists, and all these lists are knotted to here. A
* Blender file is not much more but a binary dump of these
* lists. This list of lists is not serialized itself.
*
* Oops... this should be a _types.h file.
- *
*/
#include "DNA_listBase.h"
@@ -49,10 +38,11 @@
extern "C" {
#endif
-struct BlendThumbnail;
struct BLI_mempool;
+struct BlendThumbnail;
struct Depsgraph;
struct GHash;
+struct GSet;
struct ImBuf;
struct Library;
struct MainLock;
@@ -94,40 +84,40 @@ typedef struct Main {
BlendThumbnail *blen_thumb;
struct Library *curlib;
- ListBase scene;
- ListBase library;
- ListBase object;
- ListBase mesh;
- ListBase curve;
- ListBase mball;
- ListBase mat;
- ListBase tex;
- ListBase image;
- ListBase latt;
- ListBase lamp;
- ListBase camera;
- ListBase ipo; // XXX deprecated
- ListBase key;
- ListBase world;
- ListBase screen;
- ListBase vfont;
- ListBase text;
- ListBase speaker;
- ListBase lightprobe;
- ListBase sound;
- ListBase collection;
- ListBase armature;
- ListBase action;
- ListBase nodetree;
- ListBase brush;
- ListBase particle;
+ ListBase scenes;
+ ListBase libraries;
+ ListBase objects;
+ ListBase meshes;
+ ListBase curves;
+ ListBase metaballs;
+ ListBase materials;
+ ListBase textures;
+ ListBase images;
+ ListBase lattices;
+ ListBase lights;
+ ListBase cameras;
+ ListBase ipo; /* Deprecated (only for versioning). */
+ ListBase shapekeys;
+ ListBase worlds;
+ ListBase screens;
+ ListBase fonts;
+ ListBase texts;
+ ListBase speakers;
+ ListBase lightprobes;
+ ListBase sounds;
+ ListBase collections;
+ ListBase armatures;
+ ListBase actions;
+ ListBase nodetrees;
+ ListBase brushes;
+ ListBase particles;
ListBase palettes;
ListBase paintcurves;
- ListBase wm;
- ListBase gpencil;
- ListBase movieclip;
- ListBase mask;
- ListBase linestyle;
+ ListBase wm; /* Singleton (exception). */
+ ListBase gpencils;
+ ListBase movieclips;
+ ListBase masks;
+ ListBase linestyles;
ListBase cachefiles;
ListBase workspaces;
@@ -148,6 +138,47 @@ void BKE_main_unlock(struct Main *bmain);
void BKE_main_relations_create(struct Main *bmain);
void BKE_main_relations_free(struct Main *bmain);
+struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset);
+
+/* *** Generic utils to loop over whole Main database. *** */
+
+#define FOREACH_MAIN_LISTBASE_ID_BEGIN(_lb, _id) \
+ { \
+ ID *_id_next = _lb->first; \
+ for (_id = _id_next; _id != NULL; _id = _id_next) { \
+ _id_next = _id->next;
+
+#define FOREACH_MAIN_LISTBASE_ID_END \
+ } \
+ } ((void)0)
+
+
+#define FOREACH_MAIN_ID_BEGIN(_bmain, _id) \
+ { \
+ ListBase *_lbarray[MAX_LIBARRAY]; \
+ int _i = set_listbasepointers(_bmain, _lbarray); \
+ while (_i--) { \
+ FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[_i], _id)
+
+#define FOREACH_MAIN_ID_END \
+ FOREACH_MAIN_LISTBASE_ID_END; \
+ } \
+ } ((void)0)
+
+/** \param _do_break A boolean, to allow breaking iteration (only used to break by type,
+ * you must also use an explicit `break;` operation if you want to
+ * immediately break from inner by-ID loop).
+ */
+#define FOREACH_MAIN_ID_BREAKABLE_BEGIN(_bmain, _id, _do_break) \
+ { \
+ ListBase *_lbarray[MAX_LIBARRAY]; \
+ int i = set_listbasepointers(_bmain, _lbarray); \
+ while (i-- && !_do_break) { \
+ FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[i], _id) \
+
+#define FOREACH_MAIN_ID_BREAKABLE_END FOREACH_MAIN_ID_END
+
+
struct BlendThumbnail *BKE_main_thumbnail_from_imbuf(struct Main *bmain, struct ImBuf *img);
struct ImBuf *BKE_main_thumbnail_to_imbuf(struct Main *bmain, struct BlendThumbnail *data);
void BKE_main_thumbnail_create(struct Main *bmain);
@@ -168,8 +199,12 @@ int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]);
#define BLEN_THUMB_SIZE 128
-#define BLEN_THUMB_MEMSIZE(_x, _y) (sizeof(BlendThumbnail) + ((size_t)(_x) * (size_t)(_y)) * sizeof(int))
-#define BLEN_THUMB_SAFE_MEMSIZE(_x, _y) ((uint64_t)_x * (uint64_t)_y < (SIZE_MAX / (sizeof(int) * 4)))
+#define BLEN_THUMB_MEMSIZE(_x, _y) \
+ (sizeof(BlendThumbnail) + ((size_t)(_x) * (size_t)(_y)) * sizeof(int))
+/** Protect against buffer overflow vulnerability & negative sizes. */
+#define BLEN_THUMB_MEMSIZE_IS_VALID(_x, _y) \
+ (((_x) > 0 && (_y) > 0) && \
+ ((uint64_t)(_x) * (uint64_t)(_y) < (SIZE_MAX / (sizeof(int) * 4))))
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index 976ee5b2691..4cda424b676 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,24 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MASK_H__
#define __BKE_MASK_H__
-/** \file BKE_mask.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
struct Depsgraph;
-struct ImageUser;
struct Image;
+struct ImageUser;
struct ListBase;
struct Main;
struct Mask;
-struct MaskParent;
struct MaskLayer;
struct MaskLayerShape;
+struct MaskParent;
struct MaskSpline;
struct MaskSplinePoint;
struct MaskSplinePointUW;
@@ -99,7 +91,7 @@ struct BezTriple *BKE_mask_spline_point_next_bezt(struct MaskSpline *spline, str
typedef enum {
MASK_PROJ_NEG = -1,
MASK_PROJ_ANY = 0,
- MASK_PROJ_POS = 1
+ MASK_PROJ_POS = 1,
} eMaskSign;
float BKE_mask_spline_project_co(struct MaskSpline *spline, struct MaskSplinePoint *point,
float start_u, const float co[2], const eMaskSign sign);
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index 890272aae64..1c171ef6e7c 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,22 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MATERIAL_H__
#define __BKE_MATERIAL_H__
-/** \file BKE_material.h
- * \ingroup bke
- * \brief General operations, lookup, etc. for materials.
+/** \file
+ * \ingroup bke
+ * \brief General operations, lookup, etc. for materials.
*/
#ifdef __cplusplus
extern "C" {
#endif
+struct ID;
struct Main;
struct Material;
-struct ID;
struct Object;
struct Scene;
@@ -76,7 +68,7 @@ enum {
BKE_MAT_ASSIGN_EXISTING,
BKE_MAT_ASSIGN_USERPREF,
BKE_MAT_ASSIGN_OBDATA,
- BKE_MAT_ASSIGN_OBJECT
+ BKE_MAT_ASSIGN_OBJECT,
};
struct Material **give_current_material_p(struct Object *ob, short act);
@@ -115,6 +107,8 @@ struct Depsgraph;
void BKE_material_eval(struct Depsgraph *depsgraph, struct Material *material);
+extern struct Material defmaterial;
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h
index a7706915bc5..fc065279aa3 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,20 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MBALL_H__
#define __BKE_MBALL_H__
-/** \file BKE_mball.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
struct BoundBox;
struct Depsgraph;
struct Main;
struct MetaBall;
+struct MetaElem;
struct Object;
struct Scene;
-struct MetaElem;
void BKE_mball_free(struct MetaBall *mb);
void BKE_mball_init(struct MetaBall *mb);
@@ -93,4 +83,8 @@ enum {
void BKE_mball_batch_cache_dirty_tag(struct MetaBall *mb, int mode);
void BKE_mball_batch_cache_free(struct MetaBall *mb);
+extern void (*BKE_mball_batch_cache_dirty_tag_cb)(struct MetaBall *mb, int mode);
+extern void (*BKE_mball_batch_cache_free_cb)(struct MetaBall *mb);
+
+
#endif
diff --git a/source/blender/blenkernel/BKE_mball_tessellate.h b/source/blender/blenkernel/BKE_mball_tessellate.h
index 363bfe09c75..192e81bdf92 100644
--- a/source/blender/blenkernel/BKE_mball_tessellate.h
+++ b/source/blender/blenkernel/BKE_mball_tessellate.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MBALL_TESSELLATE_H__
#define __BKE_MBALL_TESSELLATE_H__
-/** \file BKE_mball_tessellate.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
struct Depsgraph;
struct Main;
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 53c23af73c0..a2613c2c2e3 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,57 +15,52 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): (mar-2001 nzc)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MESH_H__
#define __BKE_MESH_H__
-/** \file BKE_mesh.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
/* defines BLI_INLINE */
#include "BLI_compiler_compat.h"
/* defines CustomDataMask */
-#include "BKE_customdata.h"
+//#include "BKE_customdata.h"
-struct ID;
+struct BLI_Stack;
+struct BMEditMesh;
+struct BMesh;
struct BMeshCreateParams;
struct BMeshFromMeshParams;
struct BMeshToMeshParams;
struct BoundBox;
+struct CustomData;
+struct CustomData_MeshMasks;
struct Depsgraph;
struct EdgeHash;
-struct ListBase;
-struct LinkNode;
-struct BLI_Stack;
-struct MemArena;
-struct BMesh;
+struct ID;
struct KeyBlock;
+struct LinkNode;
+struct ListBase;
+struct MDeformVert;
+struct MDisps;
+struct MEdge;
+struct MFace;
+struct MLoop;
struct MLoopTri;
-struct Main;
-struct Mesh;
-struct ModifierData;
+struct MLoopUV;
struct MPoly;
-struct MLoop;
-struct MFace;
-struct MEdge;
struct MVert;
struct MVertTri;
-struct MDeformVert;
-struct MDisps;
+struct Main;
+struct MemArena;
+struct Mesh;
+struct ModifierData;
struct Object;
-struct CustomData;
-struct Scene;
-struct MLoopUV;
struct ReportList;
-struct BMEditMesh;
+struct Scene;
#ifdef __cplusplus
extern "C" {
@@ -91,10 +84,10 @@ struct BMesh *BKE_mesh_to_bmesh(
const bool add_key_index, const struct BMeshCreateParams *params);
struct Mesh *BKE_mesh_from_bmesh_nomain(struct BMesh *bm, const struct BMeshToMeshParams *params);
-struct Mesh *BKE_mesh_from_bmesh_for_eval_nomain(struct BMesh *bm, const int64_t cd_mask_extra);
+struct Mesh *BKE_mesh_from_bmesh_for_eval_nomain(struct BMesh *bm, const struct CustomData_MeshMasks *cd_mask_extra);
struct Mesh *BKE_mesh_from_editmesh_with_coords_thin_wrap(
- struct BMEditMesh *em, CustomDataMask data_mask, float (*vertexCos)[3]);
+ struct BMEditMesh *em, const struct CustomData_MeshMasks *data_mask, float (*vertexCos)[3]);
int poly_find_loop_from_vert(
const struct MPoly *poly,
@@ -187,7 +180,7 @@ struct Mesh *BKE_mesh_create_derived_for_modifier(
/* Copies a nomain-Mesh into an existing Mesh. */
void BKE_mesh_nomain_to_mesh(struct Mesh *mesh_src, struct Mesh *mesh_dst, struct Object *ob,
- CustomDataMask mask, bool take_ownership);
+ const struct CustomData_MeshMasks *mask, bool take_ownership);
void BKE_mesh_nomain_to_meshkey(struct Mesh *mesh_src, struct Mesh *mesh_dst, struct KeyBlock *kb);
@@ -303,6 +296,7 @@ enum {
MLNOR_SPACEARR_BMLOOP_PTR = 1,
};
+/* Low-level custom normals functions. */
void BKE_lnor_spacearr_init(MLoopNorSpaceArray *lnors_spacearr, const int numLoops, const char data_type);
void BKE_lnor_spacearr_clear(MLoopNorSpaceArray *lnors_spacearr);
void BKE_lnor_spacearr_free(MLoopNorSpaceArray *lnors_spacearr);
@@ -316,11 +310,7 @@ void BKE_lnor_space_add_loop(
void BKE_lnor_space_custom_data_to_normal(MLoopNorSpace *lnor_space, const short clnor_data[2], float r_custom_lnor[3]);
void BKE_lnor_space_custom_normal_to_data(MLoopNorSpace *lnor_space, const float custom_lnor[3], short r_clnor_data[2]);
-bool BKE_mesh_has_custom_loop_normals(struct Mesh *me);
-
-void BKE_mesh_calc_normals_split(struct Mesh *mesh);
-void BKE_mesh_calc_normals_split_ex(struct Mesh *mesh, struct MLoopNorSpaceArray *r_lnors_spacearr);
-
+/* Medium-level custom normals functions. */
void BKE_mesh_normals_loop_split(
const struct MVert *mverts, const int numVerts, struct MEdge *medges, const int numEdges,
struct MLoop *mloops, float (*r_loopnors)[3], const int numLoops,
@@ -343,6 +333,16 @@ void BKE_mesh_normals_loop_to_vertex(
const int numVerts, const struct MLoop *mloops, const int numLoops,
const float (*clnors)[3], float (*r_vert_clnors)[3]);
+/* High-level custom normals functions. */
+bool BKE_mesh_has_custom_loop_normals(struct Mesh *me);
+
+void BKE_mesh_calc_normals_split(struct Mesh *mesh);
+void BKE_mesh_calc_normals_split_ex(struct Mesh *mesh, struct MLoopNorSpaceArray *r_lnors_spacearr);
+
+void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loopnors)[3]);
+void BKE_mesh_set_custom_normals_from_vertices(struct Mesh *mesh, float (*r_custom_vertnors)[3]);
+
+
void BKE_mesh_calc_poly_normal(
const struct MPoly *mpoly, const struct MLoop *loopstart,
const struct MVert *mvarray, float r_no[3]);
@@ -524,6 +524,9 @@ enum {
void BKE_mesh_batch_cache_dirty_tag(struct Mesh *me, int mode);
void BKE_mesh_batch_cache_free(struct Mesh *me);
+extern void (*BKE_mesh_batch_cache_dirty_tag_cb)(struct Mesh *me, int mode);
+extern void (*BKE_mesh_batch_cache_free_cb)(struct Mesh *me);
+
/* Inlines */
diff --git a/source/blender/blenkernel/BKE_mesh_iterators.h b/source/blender/blenkernel/BKE_mesh_iterators.h
index 70c10806350..2afd0ecd358 100644
--- a/source/blender/blenkernel/BKE_mesh_iterators.h
+++ b/source/blender/blenkernel/BKE_mesh_iterators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,27 +12,21 @@
* 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: all of this file.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MESH_ITERATORS_H__
#define __BKE_MESH_ITERATORS_H__
-/** \file BKE_mesh_iterators.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
-struct Mesh;
-struct MVert;
struct MEdge;
-struct MPoly;
struct MLoop;
-struct MLoopUV;
struct MLoopTri;
+struct MLoopUV;
+struct MPoly;
+struct MVert;
+struct Mesh;
typedef enum MeshForeachFlag {
MESH_FOREACH_NOP = 0,
diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h
index 1005a50a214..b81e165870c 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,26 +15,20 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): (mar-2001 nzc)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MESH_MAPPING_H__
#define __BKE_MESH_MAPPING_H__
-/** \file BKE_mesh_mapping.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
-struct MVert;
struct MEdge;
-struct MPoly;
struct MLoop;
-struct MLoopUV;
struct MLoopTri;
+struct MLoopUV;
+struct MPoly;
+struct MVert;
/* map from uv vertex to face (for select linked, stitch, uv suburf) */
diff --git a/source/blender/blenkernel/BKE_mesh_remap.h b/source/blender/blenkernel/BKE_mesh_remap.h
index 7aea856ff34..170ee9f0ccb 100644
--- a/source/blender/blenkernel/BKE_mesh_remap.h
+++ b/source/blender/blenkernel/BKE_mesh_remap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,21 +12,19 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MESH_REMAP_H__
#define __BKE_MESH_REMAP_H__
-/** \file BKE_mesh_remap.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
struct CustomData;
-struct Mesh;
struct MVert;
struct MemArena;
+struct Mesh;
/* Generic ways to map some geometry elements from a source mesh to a dest one. */
diff --git a/source/blender/blenkernel/BKE_mesh_runtime.h b/source/blender/blenkernel/BKE_mesh_runtime.h
index 49e452edc36..d3eb573bc2d 100644
--- a/source/blender/blenkernel/BKE_mesh_runtime.h
+++ b/source/blender/blenkernel/BKE_mesh_runtime.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,32 +15,27 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MESH_RUNTIME_H__
#define __BKE_MESH_RUNTIME_H__
-/** \file BKE_mesh_runtime.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* This file contains access functions for the Mesh.runtime struct.
*/
-#include "BKE_customdata.h" /* for CustomDataMask */
+//#include "BKE_customdata.h" /* for CustomDataMask */
struct ColorBand;
struct CustomData;
+struct CustomData_MeshMasks;
struct Depsgraph;
struct KeyBlock;
-struct Mesh;
struct MLoop;
struct MLoopTri;
struct MVertTri;
+struct Mesh;
struct Object;
struct Scene;
@@ -54,7 +47,7 @@ struct DerivedMesh;
#endif
void BKE_mesh_runtime_reset(struct Mesh *mesh);
-void BKE_mesh_runtime_reset_on_copy(struct Mesh *mesh);
+void BKE_mesh_runtime_reset_on_copy(struct Mesh *mesh, const int flag);
int BKE_mesh_runtime_looptri_len(const struct Mesh *mesh);
void BKE_mesh_runtime_looptri_recalc(struct Mesh *mesh);
const struct MLoopTri *BKE_mesh_runtime_looptri_ensure(struct Mesh *mesh);
@@ -74,50 +67,50 @@ void BKE_mesh_runtime_verttri_from_looptri(
#ifdef USE_DERIVEDMESH
struct DerivedMesh *mesh_get_derived_final(
struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob, CustomDataMask dataMask);
+ struct Object *ob, const struct CustomData_MeshMasks *dataMask);
#endif
struct Mesh *mesh_get_eval_final(
- struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, CustomDataMask dataMask);
+ struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const struct CustomData_MeshMasks *dataMask);
#ifdef USE_DERIVEDMESH
struct DerivedMesh *mesh_get_derived_deform(
struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob, CustomDataMask dataMask);
+ struct Object *ob, const struct CustomData_MeshMasks *dataMask);
#endif
struct Mesh *mesh_get_eval_deform(
struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob, CustomDataMask dataMask);
+ struct Object *ob, const struct CustomData_MeshMasks *dataMask);
struct Mesh *mesh_create_eval_final_render(
struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob, CustomDataMask dataMask);
+ struct Object *ob, const struct CustomData_MeshMasks *dataMask);
#ifdef USE_DERIVEDMESH
struct DerivedMesh *mesh_create_derived_index_render(
struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob, CustomDataMask dataMask, int index);
+ struct Object *ob, const struct CustomData_MeshMasks *dataMask, int index);
#endif
struct Mesh *mesh_create_eval_final_index_render(
struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob, CustomDataMask dataMask, int index);
+ struct Object *ob, const struct CustomData_MeshMasks *dataMask, int index);
#ifdef USE_DERIVEDMESH
struct DerivedMesh *mesh_create_derived_view(
struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob, CustomDataMask dataMask);
+ struct Object *ob, const struct CustomData_MeshMasks *dataMask);
#endif
struct Mesh *mesh_create_eval_final_view(
struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob, CustomDataMask dataMask);
+ struct Object *ob, const struct CustomData_MeshMasks *dataMask);
struct Mesh *mesh_create_eval_no_deform(
struct Depsgraph *depsgraph, struct Scene *scene,
struct Object *ob, float (*vertCos)[3],
- CustomDataMask dataMask);
+ const struct CustomData_MeshMasks *dataMask);
struct Mesh *mesh_create_eval_no_deform_render(
struct Depsgraph *depsgraph, struct Scene *scene,
struct Object *ob, float (*vertCos)[3],
- CustomDataMask dataMask);
+ const struct CustomData_MeshMasks *dataMask);
void BKE_mesh_runtime_eval_to_meshkey(struct Mesh *me_deformed, struct Mesh *me, struct KeyBlock *kb);
diff --git a/source/blender/blenkernel/BKE_mesh_tangent.h b/source/blender/blenkernel/BKE_mesh_tangent.h
index 62d8f3ada84..444e5b3d9e0 100644
--- a/source/blender/blenkernel/BKE_mesh_tangent.h
+++ b/source/blender/blenkernel/BKE_mesh_tangent.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MESH_TANGENT_H__
#define __BKE_MESH_TANGENT_H__
-/** \file BKE_mesh_tangent.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
void BKE_mesh_calc_loop_tangent_single_ex(
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 9504eff7dec..1a1e510b9e1 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,37 +12,32 @@
* 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: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MODIFIER_H__
#define __BKE_MODIFIER_H__
-/** \file BKE_modifier.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_modifier_types.h" /* needed for all enum typdefs */
#include "BLI_compiler_attrs.h"
#include "BKE_customdata.h"
-struct ID;
+struct BMEditMesh;
+struct CustomData_MeshMasks;
+struct DepsNodeHandle;
struct Depsgraph;
struct DerivedMesh;
+struct ID;
+struct ListBase;
+struct Main;
struct Mesh;
+struct ModifierData;
struct Object;
struct Scene;
struct ViewLayer;
-struct ListBase;
struct bArmature;
-struct Main;
-struct ModifierData;
-struct BMEditMesh;
-struct DepsNodeHandle;
typedef enum {
/* Should not be used, only for None modifier type */
@@ -222,23 +215,20 @@ typedef struct ModifierTypeInfo {
*/
void (*initData)(struct ModifierData *md);
- /* Should return a CustomDataMask indicating what data this
+ /* Should add to passed \a r_cddata_masks the data types that this
* modifier needs. If (mask & (1 << (layer type))) != 0, this modifier
- * needs that custom data layer. This function's return value can change
+ * needs that custom data layer. It can change required layers
* depending on the modifier's settings.
*
* Note that this means extra data (e.g. vertex groups) - it is assumed
* that all modifiers need mesh data and deform modifiers need vertex
* coordinates.
*
- * Note that this limits the number of custom data layer types to 32.
- *
- * If this function is not present or it returns 0, it is assumed that
- * no extra data is needed.
+ * If this function is not present, it is assumed that no extra data is needed.
*
* This function is optional.
*/
- CustomDataMask (*requiredDataMask)(struct Object *ob, struct ModifierData *md);
+ void (*requiredDataMask)(struct Object *ob, struct ModifierData *md, struct CustomData_MeshMasks *r_cddata_masks);
/* Free internal modifier data variables, this function should
* not free the md variable itself.
@@ -373,10 +363,10 @@ bool modifiers_isPreview(struct Object *ob);
typedef struct CDMaskLink {
struct CDMaskLink *next;
- CustomDataMask mask;
+ struct CustomData_MeshMasks mask;
} CDMaskLink;
-/* Calculates and returns a linked list of CustomDataMasks indicating the
+/* Calculates and returns a linked list of CustomData_MeshMasks indicating the
* data required by each modifier in the stack pointed to by md for correct
* evaluation, assuming the data indicated by dataMask is required at the
* end of the stack.
@@ -384,9 +374,10 @@ typedef struct CDMaskLink {
struct CDMaskLink *modifiers_calcDataMasks(struct Scene *scene,
struct Object *ob,
struct ModifierData *md,
- CustomDataMask dataMask,
+ const struct CustomData_MeshMasks *dataMask,
int required_mode,
- ModifierData *previewmd, CustomDataMask previewmask);
+ ModifierData *previewmd,
+ const struct CustomData_MeshMasks *previewmask);
struct ModifierData *modifiers_getLastPreview(struct Scene *scene,
struct ModifierData *md,
int required_mode);
@@ -426,16 +417,6 @@ void modwrap_deformVertsEM(
struct BMEditMesh *em, struct Mesh *me,
float (*vertexCos)[3], int numVerts);
-#define applyModifier_DM_wrapper(NEW_FUNC_NAME, OLD_FUNC_NAME) \
- static Mesh *NEW_FUNC_NAME(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh) \
- { \
- DerivedMesh *dm = CDDM_from_mesh_ex(mesh, CD_REFERENCE, CD_MASK_EVERYTHING); \
- DerivedMesh *ndm = OLD_FUNC_NAME(md, ctx, dm); \
- if (ndm != dm) dm->release(dm); \
- DM_to_mesh(ndm, mesh, ctx->object, CD_MASK_EVERYTHING, true); \
- return mesh; \
- }
-
/* wrappers for modifier callbacks that accept Mesh and select the proper implementation
* depending on if the modifier has been ported to Mesh or is still using DerivedMesh
*/
@@ -445,6 +426,6 @@ struct DerivedMesh *modifier_applyModifier_DM_deprecated(
struct DerivedMesh *dm);
struct Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(
- struct Object *ob_eval, bool *r_free_mesh);
+ struct Object *ob_eval, const bool get_cage_mesh);
#endif
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index 5071724d772..b16573425c3 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MOVIECLIP_H__
#define __BKE_MOVIECLIP_H__
-/** \file BKE_movieclip.h
- * \ingroup bke
- * \author Sergey Sharybin
+/** \file
+ * \ingroup bke
*/
struct Depsgraph;
@@ -53,6 +45,8 @@ void BKE_movieclip_reload(struct Main *bmain, struct MovieClip *clip);
void BKE_movieclip_clear_cache(struct MovieClip *clip);
void BKE_movieclip_clear_proxy_cache(struct MovieClip *clip);
+void BKE_movieclip_convert_multilayer_ibuf(struct ImBuf *ibuf);
+
struct ImBuf *BKE_movieclip_get_ibuf(struct MovieClip *clip, struct MovieClipUser *user);
struct ImBuf *BKE_movieclip_get_postprocessed_ibuf(struct MovieClip *clip, struct MovieClipUser *user, int postprocess_flag);
struct ImBuf *BKE_movieclip_get_stable_ibuf(struct MovieClip *clip, struct MovieClipUser *user, float loc[2], float *scale, float *angle, int postprocess_flag);
diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h
index 190ee9e7270..c9c520835bc 100644
--- a/source/blender/blenkernel/BKE_multires.h
+++ b/source/blender/blenkernel/BKE_multires.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2007 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MULTIRES_H__
#define __BKE_MULTIRES_H__
-/** \file BKE_multires.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BLI_compiler_compat.h"
@@ -48,9 +40,9 @@ struct Scene;
struct SubdivCCG;
struct MLoop;
-struct MVert;
-struct MPoly;
struct MLoopTri;
+struct MPoly;
+struct MVert;
/* Delete mesh mdisps and grid paint masks */
void multires_customdata_delete(struct Mesh *me);
@@ -74,7 +66,7 @@ typedef enum {
MULTIRES_USE_LOCAL_MMD = 1,
MULTIRES_USE_RENDER_PARAMS = 2,
MULTIRES_ALLOC_PAINT_MASK = 4,
- MULTIRES_IGNORE_SIMPLIFY = 8
+ MULTIRES_IGNORE_SIMPLIFY = 8,
} MultiresFlags;
struct DerivedMesh *multires_make_derived_from_derived(struct DerivedMesh *dm,
@@ -155,14 +147,16 @@ void BKE_multires_subdiv_mesh_settings_init(
/* For a given partial derivatives of a ptex face get tangent matrix for
* displacement.
- * Corner needs to be known to properly "rotate" partial derivatives.
- */
+ *
+ * Corner needs to be known to properly "rotate" partial derivatives when the
+ * matrix is being constructed for quad. For non-quad the corner is to be set
+ * to 0. */
BLI_INLINE void BKE_multires_construct_tangent_matrix(
float tangent_matrix[3][3],
const float dPdu[3],
const float dPdv[3],
const int corner);
-#endif /* __BKE_MULTIRES_H__ */
-
#include "intern/multires_inline.h"
+
+#endif /* __BKE_MULTIRES_H__ */
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h
index a42819e52a2..45ac86eebf9 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,22 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_NLA_H__
#define __BKE_NLA_H__
-/** \file BKE_nla.h
- * \ingroup bke
- * \author Joshua Leung (full recode)
+/** \file
+ * \ingroup bke
*/
struct AnimData;
struct Main;
struct NlaStrip;
struct NlaTrack;
-struct bAction;
struct Scene;
struct Speaker;
+struct bAction;
struct PointerRNA;
struct PropertyRNA;
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 0368f5befd3..6e6ec31aa6a 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_NODE_H__
#define __BKE_NODE_H__
-/** \file BKE_node.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BLI_compiler_compat.h"
@@ -38,7 +30,7 @@
#include "DNA_listBase.h"
/* for FOREACH_NODETREE_BEGIN */
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
@@ -51,35 +43,35 @@
/* not very important, but the stack solver likes to know a maximum */
#define MAX_SOCKET 512
-struct bContext;
-struct bNode;
-struct bNodeLink;
-struct bNodeSocket;
-struct bNodeStack;
-struct bNodeTree;
-struct bNodeTreeType;
-struct bNodeTreeExec;
-struct bNodeExecContext;
-struct bNodeExecData;
+struct ARegion;
+struct ColorManagedDisplaySettings;
+struct ColorManagedViewSettings;
struct GPUMaterial;
struct GPUNodeStack;
struct ID;
struct ImBuf;
struct ImageFormatData;
struct ListBase;
-struct Main;
-struct uiLayout;
struct MTex;
+struct Main;
struct PointerRNA;
struct RenderData;
struct Scene;
+struct SpaceNode;
struct Tex;
struct ViewRender;
-struct SpaceNode;
-struct ARegion;
-struct ColorManagedViewSettings;
-struct ColorManagedDisplaySettings;
+struct bContext;
+struct bNode;
+struct bNodeExecContext;
+struct bNodeExecData;
struct bNodeInstanceHash;
+struct bNodeLink;
+struct bNodeSocket;
+struct bNodeStack;
+struct bNodeTree;
+struct bNodeTreeExec;
+struct bNodeTreeType;
+struct uiLayout;
/* -------------------------------------------------------------------- */
/** \name Node Type Definitions
@@ -459,7 +451,6 @@ void nodeFreeNode(struct bNodeTree *ntree, struct bNode *node);
void nodeDeleteNode(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node);
struct bNode *BKE_node_copy_ex(struct bNodeTree *ntree, struct bNode *node_src, const int flag);
-struct bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node);
struct bNodeLink *nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock);
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
@@ -671,7 +662,7 @@ struct NodeTreeIterStore {
Scene *scene;
Material *mat;
Tex *tex;
- Lamp *lamp;
+ Light *light;
World *world;
FreestyleLineStyle *linestyle;
};
@@ -1074,4 +1065,7 @@ void BKE_nodetree_shading_params_eval(struct Depsgraph *depsgraph,
struct bNodeTree *ntree_dst,
const struct bNodeTree *ntree_src);
+extern struct bNodeType NodeTypeUndefined;
+extern struct bNodeSocketType NodeSocketTypeUndefined;
+
#endif /* __BKE_NODE_H__ */
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 329be174632..9cd98232375 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,14 @@
* 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: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_OBJECT_H__
#define __BKE_OBJECT_H__
-/** \file BKE_object.h
- * \ingroup bke
- * \brief General operations, lookup, etc. for blender objects.
+/** \file
+ * \ingroup bke
+ * \brief General operations, lookup, etc. for blender objects.
*/
#ifdef __cplusplus
extern "C" {
@@ -36,24 +28,24 @@ extern "C" {
#include "BLI_compiler_attrs.h"
struct Base;
+struct BoundBox;
struct Depsgraph;
struct GpencilModifierData;
-struct Scene;
-struct ShaderFxData;
-struct ViewLayer;
+struct HookGpencilModifierData;
+struct HookModifierData;
struct ID;
-struct Object;
-struct BoundBox;
-struct View3D;
-struct SoftBody;
-struct MovieClip;
struct Main;
struct Mesh;
-struct RigidBodyWorld;
-struct HookModifierData;
struct ModifierData;
-struct HookGpencilModifierData;
+struct MovieClip;
+struct Object;
struct RegionView3D;
+struct RigidBodyWorld;
+struct Scene;
+struct ShaderFxData;
+struct SoftBody;
+struct View3D;
+struct ViewLayer;
#include "DNA_object_enums.h"
@@ -134,6 +126,8 @@ void BKE_object_make_local_ex(struct Main *bmain, struct Object *ob, const bool
bool BKE_object_is_libdata(const struct Object *ob);
bool BKE_object_obdata_is_libdata(const struct Object *ob);
+struct Object *BKE_object_duplicate(struct Main *bmain, const struct Object *ob, const int dupflag);
+
void BKE_object_obdata_size_init(struct Object *ob, const float scale);
void BKE_object_scale_to_mat3(struct Object *ob, float mat[3][3]);
@@ -159,8 +153,6 @@ struct Base **BKE_object_pose_base_array_get(struct ViewLayer *view_layer, struc
void BKE_object_get_parent_matrix(
struct Object *ob, struct Object *par, float parentmat[4][4]);
-void BKE_object_get_parent_matrix_for_dupli(
- struct Object *ob, struct Object *par, float dupli_ctime, int dupli_transflag, float parentmat[4][4]);
void BKE_object_where_is_calc(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_ex(
@@ -168,11 +160,6 @@ void BKE_object_where_is_calc_ex(
struct Object *ob, float r_originmat[3][3]);
void BKE_object_where_is_calc_time(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime);
-void BKE_object_where_is_calc_time_for_dupli(
- struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime, int dupli_transflag);
-void BKE_object_where_is_calc_time_ex(
- struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime, int dupli_transflag,
- struct RigidBodyWorld *rbw, float r_originmat[3][3]);
void BKE_object_where_is_calc_mat4(struct Object *ob, float obmat[4][4]);
/* possibly belong in own moduke? */
@@ -208,7 +195,7 @@ void BKE_object_tfm_restore(struct Object *ob, void *obtfm_pt);
typedef struct ObjectTfmProtectedChannels {
float loc[3], dloc[3];
- float size[3], dscale[3];
+ float scale[3], dscale[3];
float rot[3], drot[3];
float quat[4], dquat[4];
float rotAxis[3], drotAxis[3];
@@ -224,6 +211,9 @@ void BKE_object_tfm_protected_restore(
const ObjectTfmProtectedChannels *obtfm,
const short protectflag);
+void BKE_object_tfm_copy(
+ struct Object *object_dst,
+ const struct Object *object_src);
void BKE_object_eval_reset(
struct Object *ob_eval);
@@ -275,7 +265,7 @@ void BKE_object_data_select_update(
struct Depsgraph *depsgraph,
struct ID *object_data);
-void BKE_object_eval_flush_base_flags(
+void BKE_object_eval_eval_base_flags(
struct Depsgraph *depsgraph,
struct Scene *scene, const int view_layer_index,
struct Object *object, int base_index,
@@ -293,6 +283,8 @@ void BKE_object_handle_update_ex(
const bool do_proxy_update);
void BKE_object_sculpt_modifiers_changed(struct Object *ob);
+void BKE_object_sculpt_data_create(struct Object *ob);
+
int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot);
struct Mesh *BKE_object_get_evaluated_mesh(const struct Depsgraph *depsgraph, struct Object *ob);
@@ -315,10 +307,12 @@ bool BKE_object_is_animated(struct Scene *scene, struct Object *ob);
int BKE_object_is_modified(struct Scene *scene, struct Object *ob);
int BKE_object_is_deform_modified(struct Scene *scene, struct Object *ob);
+int BKE_object_scenes_users_get(struct Main *bmain, struct Object *ob);
+
struct MovieClip *BKE_object_movieclip_get(struct Scene *scene, struct Object *ob, bool use_default);
void BKE_object_runtime_reset(struct Object *object);
-void BKE_object_runtime_reset_on_copy(struct Object *object);
+void BKE_object_runtime_reset_on_copy(struct Object *object, const int flag);
void BKE_object_batch_cache_dirty_tag(struct Object *ob);
@@ -355,7 +349,8 @@ bool BKE_object_modifier_update_subframe(
void BKE_object_type_set_empty_for_versioning(struct Object *ob);
-bool BKE_object_empty_image_is_visible_in_view3d(const struct Object *ob, const struct RegionView3D *rv3d);
+bool BKE_object_empty_image_frame_is_visible_in_view3d(const struct Object *ob, const struct RegionView3D *rv3d);
+bool BKE_object_empty_image_data_is_visible_in_view3d(const struct Object *ob, const struct RegionView3D *rv3d);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/BKE_object_deform.h b/source/blender/blenkernel/BKE_object_deform.h
index c94b142af9f..7c6c0593dfc 100644
--- a/source/blender/blenkernel/BKE_object_deform.h
+++ b/source/blender/blenkernel/BKE_object_deform.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* 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 *****
*/
#ifndef __BKE_OBJECT_DEFORM_H__
#define __BKE_OBJECT_DEFORM_H__
-/** \file BKE_object_deform.h
+/** \file
* \ingroup bke
* \brief Functions for dealing with objects and deform verts,
* used by painting and tools.
@@ -33,9 +27,9 @@
extern "C" {
#endif
-struct Object;
struct ID;
struct MDeformVert;
+struct Object;
struct bDeformGroup;
/* General vgroup operations */
diff --git a/source/blender/blenkernel/BKE_object_facemap.h b/source/blender/blenkernel/BKE_object_facemap.h
index 2607e5aa2dd..3b57b099f4b 100644
--- a/source/blender/blenkernel/BKE_object_facemap.h
+++ b/source/blender/blenkernel/BKE_object_facemap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* 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): Antony Riakiotakis
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_OBJECT_FACEMAP_H__
#define __BKE_OBJECT_FACEMAP_H__
-/** \file BKE_object_facemap.h
+/** \file
* \ingroup bke
* \brief Functions for dealing with object face-maps.
*/
@@ -32,9 +26,9 @@
extern "C" {
#endif
-struct bFaceMap;
struct ListBase;
struct Object;
+struct bFaceMap;
struct bFaceMap *BKE_object_facemap_add(struct Object *ob);
struct bFaceMap *BKE_object_facemap_add_name(struct Object *ob, const char *name);
diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h
index e18a063ff52..9f9314710e8 100644
--- a/source/blender/blenkernel/BKE_ocean.h
+++ b/source/blender/blenkernel/BKE_ocean.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * Contributors: Matt Ebb
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_OCEAN_H__
#define __BKE_OCEAN_H__
-/** \file BKE_ocean.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_outliner_treehash.h b/source/blender/blenkernel/BKE_outliner_treehash.h
index 8a14f8fb041..c20bbbd6ff6 100644
--- a/source/blender/blenkernel/BKE_outliner_treehash.h
+++ b/source/blender/blenkernel/BKE_outliner_treehash.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,16 @@
* 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): Blender Foundation 2013
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_OUTLINER_TREEHASH_H__
#define __BKE_OUTLINER_TREEHASH_H__
-/** \file BKE_outliner_treehash.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
-struct ID;
struct BLI_mempool;
+struct ID;
struct TreeStoreElem;
/* create and fill hashtable with treestore elements */
diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h
index 1056c5d2119..70550003c5d 100644
--- a/source/blender/blenkernel/BKE_packedFile.h
+++ b/source/blender/blenkernel/BKE_packedFile.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,31 +15,23 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_PACKEDFILE_H__
#define __BKE_PACKEDFILE_H__
-/** \file BKE_packedFile.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
#define RET_OK 0
#define RET_ERROR 1
struct ID;
-struct bSound;
struct Image;
struct Main;
struct PackedFile;
struct ReportList;
struct VFont;
+struct bSound;
/* pack */
struct PackedFile *dupPackedFile(const struct PackedFile *pf_src);
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 00425de50e0..cc445413f61 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,53 +15,48 @@
*
* The Original Code is Copyright (C) 2009 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_PAINT_H__
#define __BKE_PAINT_H__
-/** \file BKE_paint.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
-struct bContext;
-struct bToolRef;
-struct BMesh;
struct BMFace;
+struct BMesh;
struct Brush;
struct CurveMapping;
+struct Depsgraph;
struct EnumPropertyItem;
-struct MeshElemMap;
struct GridPaintMask;
-struct Main;
-struct Mesh;
+struct ImagePool;
+struct MFace;
struct MLoop;
struct MLoopTri;
-struct MFace;
struct MVert;
+struct Main;
+struct Mesh;
+struct MeshElemMap;
struct Object;
+struct PBVH;
struct Paint;
struct PaintCurve;
struct Palette;
struct PaletteColor;
-struct PBVH;
struct ReportList;
struct Scene;
-struct ViewLayer;
struct Sculpt;
struct StrokeCache;
struct SubdivCCG;
struct Tex;
-struct ImagePool;
-struct UnifiedPaintSettings;
-struct Depsgraph;
struct ToolSettings;
+struct UnifiedPaintSettings;
+struct ViewLayer;
+struct bContext;
+struct bToolRef;
+struct SubdivCCG;
enum eOverlayFlags;
@@ -99,7 +92,7 @@ typedef enum eOverlayControlFlags {
PAINT_OVERLAY_INVALID_CURVE = (1 << 3),
PAINT_OVERLAY_OVERRIDE_CURSOR = (1 << 4),
PAINT_OVERLAY_OVERRIDE_PRIMARY = (1 << 5),
- PAINT_OVERLAY_OVERRIDE_SECONDARY = (1 << 6)
+ PAINT_OVERLAY_OVERRIDE_SECONDARY = (1 << 6),
} eOverlayControlFlags;
#define PAINT_OVERRIDE_MASK \
@@ -295,8 +288,10 @@ void BKE_sculpt_toolsettings_data_ensure(struct Scene *scene);
struct PBVH *BKE_sculpt_object_pbvh_ensure(struct Depsgraph *depsgraph, struct Object *ob);
+void BKE_sculpt_bvh_update_from_ccg(struct PBVH *pbvh, struct SubdivCCG *subdiv_ccg);
+
enum {
SCULPT_MASK_LAYER_CALC_VERT = (1 << 0),
- SCULPT_MASK_LAYER_CALC_LOOP = (1 << 1)
+ SCULPT_MASK_LAYER_CALC_LOOP = (1 << 1),
};
#endif
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 5a1241f1de2..19036e63a8c 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,16 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Adaptive time step
* Classical SPH
* Copyright 2011-2012 AutoCRC
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_PARTICLE_H__
#define __BKE_PARTICLE_H__
-/** \file BKE_particle.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BLI_utildefines.h"
@@ -41,28 +34,29 @@
#include "BKE_customdata.h"
-struct ParticleSystemModifierData;
-struct ParticleSystem;
struct ParticleKey;
struct ParticleSettings;
+struct ParticleSystem;
+struct ParticleSystemModifierData;
-struct Main;
-struct Object;
-struct Scene;
+struct BVHTreeRay;
+struct BVHTreeRayHit;
+struct CustomData_MeshMasks;
struct Depsgraph;
-struct ModifierData;
-struct MTFace;
+struct Depsgraph;
+struct EdgeHash;
+struct KDTree;
+struct LatticeDeformData;
+struct LinkNode;
struct MCol;
struct MFace;
+struct MTFace;
struct MVert;
-struct LatticeDeformData;
-struct LinkNode;
-struct KDTree;
+struct Main;
+struct ModifierData;
+struct Object;
struct RNG;
-struct BVHTreeRay;
-struct BVHTreeRayHit;
-struct EdgeHash;
-struct Depsgraph;
+struct Scene;
struct ViewLayer;
#define PARTICLE_COLLISION_MAX_COLLISIONS 10
@@ -340,7 +334,7 @@ void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4],
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time);
-CustomDataMask psys_emitter_customdata_mask(struct ParticleSystem *psys);
+void psys_emitter_customdata_mask(struct ParticleSystem *psys, struct CustomData_MeshMasks *r_cddata_masks);
void psys_particle_on_emitter(struct ParticleSystemModifierData *psmd, int distr, int index, int index_dmcache,
float fuv[4], float foffset, float vec[3], float nor[3],
float utan[3], float vtan[3], float orco[3]);
@@ -360,6 +354,8 @@ void psys_reset(struct ParticleSystem *psys, int mode);
void psys_find_parents(struct ParticleSimulationData *sim, const bool use_render_params);
+void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname);
+
void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, const bool use_render_params);
void psys_cache_edit_paths(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra, const bool use_render_params);
void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, const bool editupdate, const bool use_render_params);
@@ -418,6 +414,9 @@ typedef void (*ParticleSystemIDFunc)(struct ParticleSystem *psys, struct ID **id
void BKE_particlesystem_id_loop(struct ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata);
+/* Reset all particle systems in the given object. */
+void BKE_particlesystem_reset_all(struct Object *object);
+
/* ----------- functions needed only inside particlesystem ------------ */
/* particle.c */
void psys_disable_all(struct Object *ob);
@@ -483,11 +482,14 @@ void BKE_particle_settings_eval_reset(
void BKE_particle_system_eval_init(struct Depsgraph *depsgraph,
struct Object *object);
-#endif
-
/* Draw Cache */
enum {
BKE_PARTICLE_BATCH_DIRTY_ALL = 0,
};
void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode);
void BKE_particle_batch_cache_free(struct ParticleSystem *psys);
+
+extern void (*BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode);
+extern void (*BKE_particle_batch_cache_free_cb)(struct ParticleSystem *psys);
+
+#endif /* __BKE_PARTICLE_H__ */
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 47fedb565fc..87d1a6c6915 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,36 +12,34 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_PBVH_H__
#define __BKE_PBVH_H__
-/** \file BKE_pbvh.h
- * \ingroup bke
- * \brief A BVH for high poly meshes.
+/** \file
+ * \ingroup bke
+ * \brief A BVH for high poly meshes.
*/
#include "BLI_bitmap.h"
#include "BLI_ghash.h"
#include "BLI_utildefines.h"
-struct GPUBatch;
+struct BMLog;
+struct BMesh;
+struct CCGDerivedMesh;
struct CCGElem;
struct CCGKey;
-struct CCGDerivedMesh;
struct CustomData;
struct DMFlagMat;
-struct MPoly;
+struct GPUBatch;
struct MLoop;
struct MLoopTri;
+struct MPoly;
struct MVert;
struct PBVH;
struct PBVHNode;
-struct BMesh;
-struct BMLog;
typedef struct PBVH PBVH;
typedef struct PBVHNode PBVHNode;
@@ -108,7 +104,7 @@ bool BKE_pbvh_node_raycast(
bool BKE_pbvh_bmesh_node_raycast_detail(
PBVHNode *node,
const float ray_start[3], const float ray_normal[3],
- float *depth, float *r_detail);
+ float *depth, float *r_edge_length);
/* for orthographic cameras, project the far away ray segment points to the root node so
* we can have better precision. */
@@ -129,7 +125,7 @@ bool BKE_pbvh_node_find_nearest_to_ray(
/* Drawing */
void BKE_pbvh_draw_cb(
- PBVH *bvh, float (*planes)[4], float (*fnors)[3], bool fast, bool only_mask,
+ PBVH *bvh, float (*planes)[4], float (*fnors)[3], bool fast, bool wires, bool only_mask,
void (*draw_fn)(void *user_data, struct GPUBatch *batch), void *user_data);
/* PBVH Access */
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index f13f84e4eb2..6f0145a493d 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton <ideasman42@gmail.com>
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_POINTCACHE_H__
#define __BKE_POINTCACHE_H__
-/** \file BKE_pointcache.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_ID.h"
@@ -89,11 +81,11 @@ struct Object;
struct ParticleKey;
struct ParticleSystem;
struct PointCache;
+struct RigidBodyWorld;
struct Scene;
-struct ViewLayer;
struct SmokeModifierData;
struct SoftBody;
-struct RigidBodyWorld;
+struct ViewLayer;
struct OpenVDBReader;
struct OpenVDBWriter;
diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h
index 2175b54a4a1..c6d350196f3 100644
--- a/source/blender/blenkernel/BKE_report.h
+++ b/source/blender/blenkernel/BKE_report.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_REPORT_H__
#define __BKE_REPORT_H__
-/** \file BKE_report.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index 9a5f3c31264..4c644ee43fc 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,19 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung, Sergej Reich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_rigidbody.h
- * \ingroup blenkernel
- * \brief API for Blender-side Rigid Body stuff
+/** \file
+ * \ingroup blenkernel
+ * \brief API for Blender-side Rigid Body stuff
*/
#ifndef __BKE_RIGIDBODY_H__
#define __BKE_RIGIDBODY_H__
-struct RigidBodyWorld;
struct RigidBodyOb;
+struct RigidBodyWorld;
struct Collection;
struct Depsgraph;
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 208afa4b67a..a0525a4e9f7 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SCENE_H__
#define __BKE_SCENE_H__
-/** \file BKE_scene.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
@@ -44,11 +34,12 @@ struct Main;
struct Object;
struct RenderData;
struct Scene;
-struct ViewLayer;
+struct TransformOrientation;
struct UnitSettings;
+struct View3DCursor;
+struct ViewLayer;
struct ViewRender;
struct WorkSpace;
-struct TransformOrientation;
typedef enum eSceneCopyMethod {
SCE_COPY_NEW = 0,
@@ -211,6 +202,12 @@ struct TransformOrientation *BKE_scene_transform_orientation_find(
int BKE_scene_transform_orientation_get_index(
const struct Scene *scene, const struct TransformOrientation *orientation);
+void BKE_scene_cursor_rot_to_mat3(const struct View3DCursor *cursor, float mat[3][3]);
+void BKE_scene_cursor_mat3_to_rot(struct View3DCursor *cursor, const float mat[3][3], bool use_compat);
+
+void BKE_scene_cursor_rot_to_quat(const struct View3DCursor *cursor, float quat[4]);
+void BKE_scene_cursor_quat_to_rot(struct View3DCursor *cursor, const float quat[4], bool use_compat);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 75d2ed0d0bc..d8881472d65 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,16 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SCREEN_H__
#define __BKE_SCREEN_H__
-/** \file BKE_screen.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
struct ARegion;
+struct GPUFXSettings;
struct Header;
struct ID;
struct ListBase;
@@ -41,25 +32,24 @@ struct Menu;
struct Panel;
struct Scene;
struct ScrArea;
+struct ScrAreaMap;
struct ScrVert;
struct SpaceType;
struct TransformOrientation;
struct View3D;
struct View3DShading;
+struct WorkSpace;
struct bContext;
struct bContextDataResult;
struct bScreen;
struct uiLayout;
struct uiList;
-struct wmKeyConfig;
struct wmGizmoMap;
+struct wmKeyConfig;
+struct wmMsgBus;
struct wmNotifier;
struct wmWindow;
struct wmWindowManager;
-struct WorkSpace;
-struct GPUFXSettings;
-struct wmMsgBus;
-struct ScrAreaMap;
#include "BLI_compiler_attrs.h"
@@ -238,7 +228,7 @@ typedef void (*uiListDrawItemFunc)(
/* Draw the filtering part of an uiList */
typedef void (*uiListDrawFilterFunc)(
- struct uiList *ui_list, struct bContext *C, struct uiLayout *layout, bool reverse);
+ struct uiList *ui_list, struct bContext *C, struct uiLayout *layout);
/* Filter items of an uiList */
typedef void (*uiListFilterItemsFunc)(
@@ -368,4 +358,6 @@ void BKE_screen_remove_double_scredges(struct bScreen *sc);
void BKE_screen_remove_unused_scredges(struct bScreen *sc);
void BKE_screen_remove_unused_scrverts(struct bScreen *sc);
+void BKE_screen_header_alignment_reset(struct bScreen *screen);
+
#endif
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index a850777f3f1..72cdaf97ec3 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,26 +15,20 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SEQUENCER_H__
#define __BKE_SEQUENCER_H__
-/** \file BKE_sequencer.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
-struct bContext;
struct Depsgraph;
-struct StripColorBalance;
struct Editing;
-struct GSet;
-struct GPUOffScreen;
struct GPUFX;
+struct GPUOffScreen;
+struct GSet;
struct ImBuf;
struct Main;
struct Mask;
@@ -45,7 +37,10 @@ struct Scene;
struct Sequence;
struct SequenceModifierData;
struct Stereo3dFormat;
+struct StripColorBalance;
struct StripElem;
+struct TextVars;
+struct bContext;
struct bSound;
struct SeqIndexBuildContext;
@@ -128,7 +123,7 @@ enum {
DO_BOX_WIPE,
DO_CROSS_WIPE,
DO_IRIS_WIPE,
- DO_CLOCK_WIPE
+ DO_CLOCK_WIPE,
};
struct SeqEffectHandle {
@@ -145,7 +140,7 @@ struct SeqEffectHandle {
/* load is called first time after readblenfile in
* get_sequence_effect automatically */
- void (*load)(struct Sequence *seq);
+ void (*load)(struct Sequence *seqconst);
/* duplicate */
void (*copy)(struct Sequence *dst, struct Sequence *src, const int flag);
@@ -301,6 +296,9 @@ void BKE_sequence_effect_speed_rebuild_map(struct Scene *scene, struct Sequence
struct SeqEffectHandle BKE_sequence_get_effect(struct Sequence *seq);
int BKE_sequence_effect_get_num_inputs(int seq_type);
int BKE_sequence_effect_get_supports_mask(int seq_type);
+void BKE_sequencer_text_font_unload(struct TextVars *data, const bool do_id_user);
+void BKE_sequencer_text_font_load(struct TextVars *data, const bool do_id_user);
+
/* **********************************************************************
* Sequencer editing functions
@@ -335,7 +333,8 @@ bool BKE_sequence_base_shuffle_time(ListBase *seqbasep, struct Scene *evil_scene
bool BKE_sequence_base_isolated_sel_check(struct ListBase *seqbase);
void BKE_sequencer_free_imbuf(struct Scene *scene, struct ListBase *seqbasep, bool for_render);
struct Sequence *BKE_sequence_dupli_recursive(
- const struct Scene *scene_src, struct Scene *scene_dst, struct Sequence *seq, int dupe_flag);
+ const struct Scene *scene_src, struct Scene *scene_dst,
+ struct ListBase *new_seq_list, struct Sequence *seq, int dupe_flag);
int BKE_sequence_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str);
bool BKE_sequence_check_depend(struct Sequence *seq, struct Sequence *cur);
@@ -391,7 +390,7 @@ typedef struct SeqLoadInfo {
/* seq_dupli' flags */
-#define SEQ_DUPE_UNIQUE_NAME (1 << 0) /* WARNING: does NOT work when duplicating Meta strips! */
+#define SEQ_DUPE_UNIQUE_NAME (1 << 0)
#define SEQ_DUPE_CONTEXT (1 << 1)
#define SEQ_DUPE_ANIM (1 << 2)
#define SEQ_DUPE_ALL (1 << 3) /* otherwise only selected are copied */
@@ -411,7 +410,7 @@ enum {
SEQ_SIDE_NONE = 0,
SEQ_SIDE_LEFT,
SEQ_SIDE_RIGHT,
- SEQ_SIDE_BOTH
+ SEQ_SIDE_BOTH,
};
int BKE_sequencer_find_next_prev_edit(
struct Scene *scene, int cfra, const short side,
diff --git a/source/blender/blenkernel/BKE_shader_fx.h b/source/blender/blenkernel/BKE_shader_fx.h
index 3306d8256e8..020c682392e 100644
--- a/source/blender/blenkernel/BKE_shader_fx.h
+++ b/source/blender/blenkernel/BKE_shader_fx.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,38 +12,34 @@
* 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: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SHADER_FX_H__
#define __BKE_SHADER_FX_H__
-/** \file BKE_shader_fx.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_shader_fx_types.h" /* needed for all enum typdefs */
#include "BLI_compiler_attrs.h"
#include "BKE_customdata.h"
-struct ID;
+struct DepsNodeHandle;
struct Depsgraph;
struct DerivedMesh;
+struct ID;
+struct ListBase;
+struct Main;
struct Mesh;
+struct ModifierUpdateDepsgraphContext;
struct Object;
struct Scene;
+struct ShaderFxData;
struct ViewLayer;
-struct ListBase;
struct bArmature;
-struct Main;
-struct ShaderFxData;
-struct DepsNodeHandle;
-struct bGPDlayer;
struct bGPDframe;
+struct bGPDlayer;
struct bGPDstroke;
-struct ModifierUpdateDepsgraphContext;
#define SHADER_FX_ACTIVE(_fx, _is_render) (((_fx->mode & eShaderFxMode_Realtime) && (_is_render == false)) || \
((_fx->mode & eShaderFxMode_Render) && (_is_render == true)))
diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h
index 0959e8a72f0..8aec2cc1a21 100644
--- a/source/blender/blenkernel/BKE_shrinkwrap.h
+++ b/source/blender/blenkernel/BKE_shrinkwrap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SHRINKWRAP_H__
#define __BKE_SHRINKWRAP_H__
-/** \file BKE_shrinkwrap.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
/* Shrinkwrap stuff */
@@ -47,13 +39,13 @@
* (So that you don't have to pass an enormous amount of arguments to functions)
*/
-struct Object;
-struct Mesh;
-struct MVert;
+struct BVHTree;
struct MDeformVert;
+struct MVert;
+struct Mesh;
struct ModifierEvalContext;
+struct Object;
struct ShrinkwrapModifierData;
-struct BVHTree;
struct SpaceTransform;
/* Information about boundary edges in the mesh. */
diff --git a/source/blender/blenkernel/BKE_smoke.h b/source/blender/blenkernel/BKE_smoke.h
index deee85c02d4..a3326c433c4 100644
--- a/source/blender/blenkernel/BKE_smoke.h
+++ b/source/blender/blenkernel/BKE_smoke.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,19 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Daniel Genrich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SMOKE_H__
#define __BKE_SMOKE_H__
-/** \file BKE_smoke.h
- * \ingroup bke
- * \author Daniel Genrich
+/** \file
+ * \ingroup bke
*/
+struct Scene;
+struct SmokeDomainSettings;
+struct SmokeModifierData;
+
typedef float (*bresenham_callback)(float *result, float *input, int res[3], int *pixel, float *tRay, float correct);
struct Mesh *smokeModifier_do(
@@ -40,15 +35,18 @@ struct Mesh *smokeModifier_do(
struct Scene *scene,
struct Object *ob, struct Mesh *me);
-void smoke_reallocate_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
-void smoke_reallocate_highres_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
void smokeModifier_free(struct SmokeModifierData *smd);
void smokeModifier_reset(struct SmokeModifierData *smd);
void smokeModifier_reset_turbulence(struct SmokeModifierData *smd);
void smokeModifier_createType(struct SmokeModifierData *smd);
-void smokeModifier_copy(const SmokeModifierData *smd, struct SmokeModifierData *tsmd, const int flag);
+void smokeModifier_copy(const struct SmokeModifierData *smd, struct SmokeModifierData *tsmd, const int flag);
+
+void BKE_smoke_reallocate_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
+void BKE_smoke_reallocate_highres_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
+
+float BKE_smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3]);
+int BKE_smoke_get_data_flags(struct SmokeDomainSettings *sds);
-float smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3]);
-int smoke_get_data_flags(struct SmokeDomainSettings *sds);
+bool BKE_smoke_show_highres(struct Scene *scene, struct SmokeDomainSettings *sds);
#endif /* __BKE_SMOKE_H__ */
diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h
index b173c995727..fee0b790ae4 100644
--- a/source/blender/blenkernel/BKE_softbody.h
+++ b/source/blender/blenkernel/BKE_softbody.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SOFTBODY_H__
#define __BKE_SOFTBODY_H__
-/** \file BKE_softbody.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
struct Depsgraph;
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index 98fb4f47339..ff3293a19b3 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SOUND_H__
#define __BKE_SOUND_H__
-/** \file BKE_sound.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
#define SOUND_WAVE_SAMPLES_PER_SECOND 250
@@ -39,9 +29,9 @@
# include <AUD_Device.h>
#endif
-struct bSound;
struct Main;
struct Sequence;
+struct bSound;
typedef struct SoundWaveform {
int length;
diff --git a/source/blender/blenkernel/BKE_speaker.h b/source/blender/blenkernel/BKE_speaker.h
index 57f4c37f129..dfc96244c52 100644
--- a/source/blender/blenkernel/BKE_speaker.h
+++ b/source/blender/blenkernel/BKE_speaker.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* 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): Jörg Müller.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SPEAKER_H__
#define __BKE_SPEAKER_H__
-/** \file BKE_speaker.h
- * \ingroup bke
- * \brief General operations for speakers.
+/** \file
+ * \ingroup bke
+ * \brief General operations for speakers.
*/
struct Main;
diff --git a/source/blender/blenkernel/BKE_studiolight.h b/source/blender/blenkernel/BKE_studiolight.h
index cbaa25d9b3e..0e7cf818839 100644
--- a/source/blender/blenkernel/BKE_studiolight.h
+++ b/source/blender/blenkernel/BKE_studiolight.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2006-2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_STUDIOLIGHT_H__
#define __BKE_STUDIOLIGHT_H__
-/** \file BKE_studiolight.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Studio lighting for the 3dview
*/
diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h
index 70572d30819..1ade8a0e44d 100644
--- a/source/blender/blenkernel/BKE_subdiv.h
+++ b/source/blender/blenkernel/BKE_subdiv.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_subdiv.h
- * \ingroup bke
- * \since July 2018
- * \author Sergey Sharybin
+/** \file
+ * \ingroup bke
*/
#ifndef __BKE_SUBDIV_H__
@@ -79,6 +71,7 @@ typedef enum eSubdivStatsValue {
SUBDIV_STATS_EVALUATOR_REFINE,
SUBDIV_STATS_SUBDIV_TO_CCG,
SUBDIV_STATS_SUBDIV_TO_CCG_ELEMENTS,
+ SUBDIV_STATS_TOPOLOGY_COMPARE,
NUM_SUBDIV_STATS_VALUES,
} eSubdivStatsValue;
@@ -102,6 +95,8 @@ typedef struct SubdivStats {
double subdiv_to_ccg_time;
/* Time spent on CCG elements evaluation/initialization. */
double subdiv_to_ccg_elements_time;
+ /* Time spent on CCG elements evaluation/initialization. */
+ double topology_compare_time;
};
double values_[NUM_SUBDIV_STATS_VALUES];
};
@@ -150,8 +145,7 @@ typedef struct SubdivDisplacement {
typedef struct Subdiv {
/* Settings this subdivision surface is created for.
*
- * It is read-only after assignment in BKE_subdiv_new_from_FOO().
- */
+ * It is read-only after assignment in BKE_subdiv_new_from_FOO(). */
SubdivSettings settings;
/* Topology refiner includes all the glue logic to feed Blender side
* topology to OpenSubdiv. It can be shared by both evaluator and GL mesh
@@ -167,13 +161,12 @@ typedef struct Subdiv {
/* Cached values, are not supposed to be accessed directly. */
struct {
/* Indexed by base face index, element indicates total number of ptex
- *faces created for preceding base faces.
- */
+ * faces created for preceding base faces. */
int *face_ptex_offset;
} cache_;
} Subdiv;
-/* ================================ HELPERS ================================= */
+/* ========================== CONVERSION HELPERS ============================ */
/* NOTE: uv_smooth is eSubsurfUVSmooth. */
eSubdivFVarLinearInterpolation
@@ -186,15 +179,43 @@ void BKE_subdiv_stats_init(SubdivStats *stats);
void BKE_subdiv_stats_begin(SubdivStats *stats, eSubdivStatsValue value);
void BKE_subdiv_stats_end(SubdivStats *stats, eSubdivStatsValue value);
+void BKE_subdiv_stats_reset(SubdivStats *stats, eSubdivStatsValue value);
+
void BKE_subdiv_stats_print(const SubdivStats *stats);
+/* ================================ SETTINGS ================================ */
+
+void BKE_subdiv_settings_validate_for_mesh(SubdivSettings *settings,
+ const struct Mesh *mesh);
+
+bool BKE_subdiv_settings_equal(const SubdivSettings *settings_a,
+ const SubdivSettings *settings_b);
+
/* ============================== CONSTRUCTION ============================== */
+/* Construct new subdivision surface descriptor, from scratch, using given
+ * settings and topology. */
Subdiv *BKE_subdiv_new_from_converter(const SubdivSettings *settings,
struct OpenSubdiv_Converter *converter);
-
Subdiv *BKE_subdiv_new_from_mesh(const SubdivSettings *settings,
- struct Mesh *mesh);
+ const struct Mesh *mesh);
+
+/* Similar to above, but will not re-create descriptor if it was created for the
+ * same settings and topology.
+ * If settings or topology did change, the existing descriptor is freed and a
+ * new one is created from scratch.
+ *
+ * NOTE: It is allowed to pass NULL as an existing subdivision surface
+ * descriptor. This will create enw descriptor without any extra checks.
+ */
+Subdiv *BKE_subdiv_update_from_converter(
+ Subdiv *subdiv,
+ const SubdivSettings *settings,
+ struct OpenSubdiv_Converter *converter);
+Subdiv *BKE_subdiv_update_from_mesh(
+ Subdiv *subdiv,
+ const SubdivSettings *settings,
+ const struct Mesh *mesh);
void BKE_subdiv_free(Subdiv *subdiv);
@@ -211,7 +232,7 @@ void BKE_subdiv_displacement_detach(Subdiv *subdiv);
int *BKE_subdiv_face_ptex_offset_get(Subdiv *subdiv);
-/* ============================= VARIOUS HELPERS ============================ */
+/* =========================== PTEX FACES AND GRIDS ========================= */
/* For a given (ptex_u, ptex_v) within a ptex face get corresponding
* (grid_u, grid_v) within a grid. */
@@ -219,6 +240,11 @@ BLI_INLINE void BKE_subdiv_ptex_face_uv_to_grid_uv(
const float ptex_u, const float ptex_v,
float *r_grid_u, float *r_grid_v);
+/* Onverse of above. */
+BLI_INLINE void BKE_subdiv_grid_uv_to_ptex_face_uv(
+ const float grid_u, const float grid_v,
+ float *r_ptex_u, float *r_ptex_v);
+
/* For a given subdivision level (which is NOT refinement level) get size of
* CCG grid (number of grid points on a side).
*/
@@ -229,9 +255,16 @@ BLI_INLINE int BKE_subdiv_grid_size_from_level(const int level);
*
* NOTE: Output coordinates are in ptex coordinates. */
BLI_INLINE int BKE_subdiv_rotate_quad_to_corner(
- const float u, const float v,
- float *r_u, float *r_v);
+ const float quad_u, const float quad_v,
+ float *r_corner_u, float *r_corner_v);
-#endif /* __BKE_SUBDIV_H__ */
+/* Converts (u, v) coordinate from within a grid to a quad coordinate in
+ * normalized ptex coordinates. */
+BLI_INLINE void BKE_subdiv_rotate_grid_to_quad(
+ const int corner,
+ const float grid_u, const float grid_v,
+ float *r_quad_u, float *r_quad_v);
#include "intern/subdiv_inline.h"
+
+#endif /* __BKE_SUBDIV_H__ */
diff --git a/source/blender/blenkernel/BKE_subdiv_ccg.h b/source/blender/blenkernel/BKE_subdiv_ccg.h
index 89e0322e37f..822f4906bae 100644
--- a/source/blender/blenkernel/BKE_subdiv_ccg.h
+++ b/source/blender/blenkernel/BKE_subdiv_ccg.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,17 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_subdiv_ccg.h
- * \ingroup bke
- * \since July 2018
- * \author Sergey Sharybin
+/** \file
+ * \ingroup bke
*/
#ifndef __BKE_SUBDIV_CCG_H__
#define __BKE_SUBDIV_CCG_H__
#include "BKE_customdata.h"
+#include "BKE_DerivedMesh.h"
#include "BLI_bitmap.h"
#include "BLI_sys_types.h"
@@ -48,20 +41,41 @@ struct Subdiv;
*/
/* Functor which evaluates mask value at a given (u, v) of given ptex face. */
-typedef struct SubdivCCGMask {
- float (*eval_mask)(struct SubdivCCGMask *mask,
+typedef struct SubdivCCGMaskEvaluator {
+ float (*eval_mask)(struct SubdivCCGMaskEvaluator *mask_evaluator,
const int ptex_face_index,
const float u, const float v);
/* Free the data, not the evaluator itself. */
- void (*free)(struct SubdivCCGMask *mask);
+ void (*free)(struct SubdivCCGMaskEvaluator *mask_evaluator);
void *user_data;
-} SubdivCCGMask;
+} SubdivCCGMaskEvaluator;
/* Return true if mesh has mask and evaluator can be used. */
bool BKE_subdiv_ccg_mask_init_from_paint(
- SubdivCCGMask *mask_evaluator,
+ SubdivCCGMaskEvaluator *mask_evaluator,
+ const struct Mesh *mesh);
+
+/* =============================================================================
+ * Materials.
+ */
+
+/* Functor which evaluates material and flags of a given coarse face. */
+typedef struct SubdivCCGMaterialFlagsEvaluator {
+ DMFlagMat (*eval_material_flags)(
+ struct SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator,
+ const int coarse_face_index);
+
+ /* Free the data, not the evaluator itself. */
+ void (*free)(
+ struct SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator);
+
+ void *user_data;
+} SubdivCCGMaterialFlagsEvaluator;
+
+void BKE_subdiv_ccg_material_flags_init_from_mesh(
+ SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator,
const struct Mesh *mesh);
/* =============================================================================
@@ -73,8 +87,7 @@ typedef struct SubdivToCCGSettings {
* evaluated. This defines how many vertices final mesh will have: every
* regular ptex has resolution^2 vertices. Special (irregular, or ptex
* created for a corner of non-quad polygon) will have resolution of
- * `resolution - 1`.
- */
+ * `resolution - 1`. */
int resolution;
/* Denotes which extra layers to be added to CCG elements. */
bool need_normal;
@@ -86,8 +99,7 @@ typedef struct SubdivCCGFace {
/* Total number of grids in this face.
*
* This 1:1 corresponds to a number of corners (or loops) from a coarse
- * face.
- */
+ * face. */
int num_grids;
/* Index of first grid from this face in SubdivCCG->grids array. */
int start_grid_index;
@@ -99,8 +111,7 @@ typedef struct SubdivCCGAdjacentEdge {
/* Indexed by adjacent face index. */
SubdivCCGFace **faces;
/* Indexed by adjacent face index, then by point index on the edge.
- * points to a grid element.
- */
+ * points to a grid element. */
struct CCGElem ***boundary_elements;
} SubdivCCGAdjacentEdge;
@@ -109,8 +120,7 @@ typedef struct SubdivCCGAdjacentVertex {
int num_adjacent_faces;
/* Indexed by adjacent face index. */
SubdivCCGFace **faces;
- /* Indexed by adjacent face index, points to a grid element.
- */
+ /* Indexed by adjacent face index, points to a grid element. */
struct CCGElem **corner_elements;
} SubdivCCGAdjacentVertex;
@@ -119,37 +129,31 @@ typedef struct SubdivCCG {
/* This is a subdivision surface this CCG was created for.
*
* TODO(sergey): Make sure the whole descriptor is valid, including all the
- * displacement attached to the surface.
- */
+ * displacement attached to the surface. */
struct Subdiv *subdiv;
/* A level at which geometry was subdivided. This is what defines grid
- * resolution. It is NOT the topology refinement level.
- */
+ * resolution. It is NOT the topology refinement level. */
int level;
/* Resolution of grid. All grids have matching resolution, and resolution
- * is same as ptex created for non-quad polygons.
- */
+ * is same as ptex created for non-quad polygons. */
int grid_size;
/* Grids represent limit surface, with displacement applied. Grids are
* corresponding to face-corners of coarse mesh, each grid has
* grid_size^2 elements.
*/
/* Indexed by a grid index, points to a grid data which is stored in
- * grids_storage.
- */
+ * grids_storage. */
struct CCGElem **grids;
/* Flat array of all grids' data. */
unsigned char *grids_storage;
int num_grids;
/* Loose edges, each array element contains grid_size elements
- * corresponding to vertices created by subdividing coarse edges.
- */
+ * corresponding to vertices created by subdividing coarse edges. */
struct CCGElem **edges;
int num_edges;
/* Loose vertices. Every element corresponds to a loose vertex from a coarse
* mesh, every coarse loose vertex corresponds to a single sundivided
- * element.
- */
+ * element. */
struct CCGElem *vertices;
int num_vertices;
/* Denotes which layers present in the elements.
@@ -194,8 +198,7 @@ typedef struct SubdivCCG {
/* Integration with sculpting. */
/* TODO(sergey): Is this really best way to go? Kind of annoying to have
- * such use-related flags in a more or less generic structure.
- */
+ * such use-related flags in a more or less generic structure. */
struct {
/* Corresponds to MULTIRES_COORDS_MODIFIED. */
bool coords;
@@ -211,12 +214,12 @@ typedef struct SubdivCCG {
*
* TODO(sergey): Allow some user-counter or more explicit control over who owns
* the Subdiv. The goal should be to allow viewport GL Mesh and CCG to share
- * same Subsurf without conflicts.
- */
+ * same Subsurf without conflicts. */
struct SubdivCCG *BKE_subdiv_to_ccg(
struct Subdiv *subdiv,
const SubdivToCCGSettings *settings,
- SubdivCCGMask *mask_evaluator);
+ SubdivCCGMaskEvaluator *mask_evaluator,
+ SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator);
/* Destroy CCG representation of subdivision surface. */
void BKE_subdiv_ccg_destroy(SubdivCCG *subdiv_ccg);
@@ -238,6 +241,11 @@ void BKE_subdiv_ccg_key_top_level(
/* Recalculate all normals based on grid element coordinates. */
void BKE_subdiv_ccg_recalc_normals(SubdivCCG *subdiv_ccg);
+/* Update normals of affected faces. */
+void BKE_subdiv_ccg_update_normals(SubdivCCG *subdiv_ccg,
+ struct CCGFace **effected_faces,
+ int num_effected_faces);
+
/* Average grid coordinates and normals along the grid boundatries. */
void BKE_subdiv_ccg_average_grids(SubdivCCG *subdiv_ccg);
diff --git a/source/blender/blenkernel/BKE_subdiv_eval.h b/source/blender/blenkernel/BKE_subdiv_eval.h
index b743c759ace..9a7f17c8b31 100644
--- a/source/blender/blenkernel/BKE_subdiv_eval.h
+++ b/source/blender/blenkernel/BKE_subdiv_eval.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_subdiv_eval.h
- * \ingroup bke
- * \since September 2018
- * \author Sergey Sharybin
+/** \file
+ * \ingroup bke
*/
#ifndef __BKE_SUBDIV_EVAL_H__
diff --git a/source/blender/blenkernel/BKE_subdiv_foreach.h b/source/blender/blenkernel/BKE_subdiv_foreach.h
index d4ef0ee3601..31c40767253 100644
--- a/source/blender/blenkernel/BKE_subdiv_foreach.h
+++ b/source/blender/blenkernel/BKE_subdiv_foreach.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_subdiv_foreach.h
- * \ingroup bke
- * \since September 2018
- * \author Sergey Sharybin
+/** \file
+ * \ingroup bke
*/
#ifndef __BKE_SUBDIV_FOREACH_H__
diff --git a/source/blender/blenkernel/BKE_subdiv_mesh.h b/source/blender/blenkernel/BKE_subdiv_mesh.h
index 6f1ffb2555b..603a1a7ecf4 100644
--- a/source/blender/blenkernel/BKE_subdiv_mesh.h
+++ b/source/blender/blenkernel/BKE_subdiv_mesh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_subdiv_mesh.h
- * \ingroup bke
- * \since September 2018
- * \author Sergey Sharybin
+/** \file
+ * \ingroup bke
*/
#ifndef __BKE_SUBDIV_MESH_H__
diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h
index 6cb09ff8822..8b4fb712d61 100644
--- a/source/blender/blenkernel/BKE_subsurf.h
+++ b/source/blender/blenkernel/BKE_subsurf.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SUBSURF_H__
#define __BKE_SUBSURF_H__
-/** \file BKE_subsurf.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
/* struct DerivedMesh is used directly */
@@ -37,21 +29,20 @@
/* Thread sync primitives used directly. */
#include "BLI_threads.h"
+struct CCGEdge;
struct CCGElem;
+struct CCGFace;
+struct CCGVert;
struct DMFlagMat;
-struct DMGridAdjacency;
struct DerivedMesh;
-struct MeshElemMap;
-struct Mesh;
+struct EdgeHash;
struct MPoly;
+struct Mesh;
+struct MeshElemMap;
struct Object;
struct PBVH;
-struct SubsurfModifierData;
-struct CCGEdge;
-struct CCGFace;
-struct CCGVert;
-struct EdgeHash;
struct PBVH;
+struct SubsurfModifierData;
/**************************** External *****************************/
@@ -62,6 +53,7 @@ typedef enum {
SUBSURF_IN_EDIT_MODE = 8,
SUBSURF_ALLOC_PAINT_MASK = 16,
SUBSURF_USE_GPU_BACKEND = 32,
+ SUBSURF_IGNORE_SIMPLIFY = 64,
} SubsurfFlags;
struct DerivedMesh *subsurf_make_derived_from_derived(
@@ -97,7 +89,7 @@ typedef enum MultiresModifiedFlags {
* have to be updated */
MULTIRES_COORDS_MODIFIED = 1,
/* indicates elements have been hidden or unhidden */
- MULTIRES_HIDDEN_MODIFIED = 2
+ MULTIRES_HIDDEN_MODIFIED = 2,
} MultiresModifiedFlags;
/**************************** Internal *****************************/
diff --git a/source/blender/blenkernel/BKE_suggestions.h b/source/blender/blenkernel/BKE_suggestions.h
index 9d2aab063ab..f1d9e318d9f 100644
--- a/source/blender/blenkernel/BKE_suggestions.h
+++ b/source/blender/blenkernel/BKE_suggestions.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_SUGGESTIONS_H__
#define __BKE_SUGGESTIONS_H__
-/** \file BKE_suggestions.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index e7a8fb1c4a9..75e0310b14c 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_TEXT_H__
#define __BKE_TEXT_H__
-/** \file BKE_text.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
@@ -127,7 +117,7 @@ extern int text_check_identifier_nodigit_unicode(const unsigned int ch);
enum {
TXT_MOVE_LINE_UP = -1,
- TXT_MOVE_LINE_DOWN = 1
+ TXT_MOVE_LINE_DOWN = 1,
};
typedef struct TextUndoBuf {
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index 2f0d62b4b42..bcd56c4f63d 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,42 +15,33 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_TEXTURE_H__
#define __BKE_TEXTURE_H__
-/** \file BKE_texture.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
-struct bNode;
struct Brush;
struct ColorBand;
struct FreestyleLineStyle;
struct ImagePool;
-struct Lamp;
+struct Light;
+struct MTex;
struct Main;
struct Material;
-struct MTex;
-struct OceanTex;
struct ParticleSettings;
struct PointDensity;
struct Tex;
struct TexMapping;
struct TexResult;
struct World;
+struct bNode;
/* in ColorBand struct */
#define MAXCOLORBAND 32
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index 7a70f945194..2d825126a75 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,37 +15,31 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_TRACKING_H__
#define __BKE_TRACKING_H__
-/** \file BKE_tracking.h
- * \ingroup bke
- * \author Sergey Sharybin
+/** \file
+ * \ingroup bke
*/
+struct Camera;
struct Depsgraph;
-struct bGPDlayer;
struct ImBuf;
struct ListBase;
+struct MovieClipUser;
+struct MovieDistortion;
struct MovieReconstructContext;
-struct MovieTrackingTrack;
-struct MovieTrackingMarker;
-struct MovieTrackingPlaneTrack;
-struct MovieTrackingPlaneMarker;
struct MovieTracking;
+struct MovieTrackingMarker;
struct MovieTrackingObject;
-struct MovieClipUser;
-struct MovieDistortion;
-struct Camera;
+struct MovieTrackingPlaneMarker;
+struct MovieTrackingPlaneTrack;
+struct MovieTrackingTrack;
struct Object;
struct Scene;
+struct bGPDlayer;
struct rcti;
/* **** Common functions **** */
diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h
index a75606a17cb..0469486d4e0 100644
--- a/source/blender/blenkernel/BKE_undo_system.h
+++ b/source/blender/blenkernel/BKE_undo_system.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_UNDO_SYSTEM_H__
#define __BKE_UNDO_SYSTEM_H__
-/** \file BKE_undo_system.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
struct Main;
@@ -29,6 +25,7 @@ struct UndoStep;
struct bContext;
/* ID's */
+struct Main;
struct Mesh;
struct Object;
struct Scene;
@@ -49,6 +46,11 @@ UNDO_REF_ID_TYPE(Text);
typedef struct UndoStack {
ListBase steps;
struct UndoStep *step_active;
+ /**
+ * The last memfile state read, used so we can be sure the names from the
+ * library state matches the state an undo step was written in.
+ */
+ struct UndoStep *step_active_memfile;
/**
* Some undo systems require begin/end, see: #UndoType.step_encode_init
@@ -68,24 +70,13 @@ typedef struct UndoStep {
size_t data_size;
/** Users should never see this step (only use for internal consistency). */
bool skip;
+ /** Some situations require the global state to be stored, edge cases when exiting modes. */
+ bool use_memfile_step;
+ /** For use by undo systems that accumulate changes (text editor, painting). */
+ bool is_applied;
/* Over alloc 'type->struct_size'. */
} UndoStep;
-typedef enum eUndoTypeMode {
- /**
- * Each undo step stores a version of the state.
- * This means we can simply load in a previous state at any time.
- */
- BKE_UNDOTYPE_MODE_STORE = 1,
- /**
- * Each undo step is a series of edits.
- * This means to change states we need to apply each edit.
- * It also means the 'step_decode' callback needs to detect the difference between undo and redo.
- * (Currently used for text edit and image & sculpt painting).
- */
- BKE_UNDOTYPE_MODE_ACCUMULATE = 2,
-} eUndoTypeMode;
-
typedef void (*UndoTypeForEachIDRefFn)(void *user_data, struct UndoRefID *id_ref);
typedef struct UndoType {
@@ -108,8 +99,8 @@ typedef struct UndoType {
*/
void (*step_encode_init)(struct bContext *C, UndoStep *us);
- bool (*step_encode)(struct bContext *C, UndoStep *us);
- void (*step_decode)(struct bContext *C, UndoStep *us, int dir);
+ bool (*step_encode)(struct bContext *C, struct Main *bmain, UndoStep *us);
+ void (*step_decode)(struct bContext *C, struct Main *bmain, UndoStep *us, int dir);
/**
* \note When freeing all steps,
@@ -118,7 +109,6 @@ typedef struct UndoType {
void (*step_foreach_ID_ref)(UndoStep *us, UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data);
- eUndoTypeMode mode;
bool use_context;
int step_size;
@@ -132,6 +122,9 @@ extern const UndoType *BKE_UNDOSYS_TYPE_PARTICLE;
extern const UndoType *BKE_UNDOSYS_TYPE_SCULPT;
extern const UndoType *BKE_UNDOSYS_TYPE_TEXT;
+#define BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(ty) \
+ ELEM(ty, BKE_UNDOSYS_TYPE_IMAGE)
+
UndoStack *BKE_undosys_stack_create(void);
void BKE_undosys_stack_destroy(UndoStack *ustack);
void BKE_undosys_stack_clear(UndoStack *ustack);
@@ -164,7 +157,6 @@ bool BKE_undosys_step_redo(UndoStack *ustack, struct bContext *C);
bool BKE_undosys_step_load_data(UndoStack *ustack, struct bContext *C, UndoStep *us);
-bool BKE_undosys_step_undo_compat_only(UndoStack *ustack, struct bContext *C, int step);
void BKE_undosys_step_undo_from_index(UndoStack *ustack, struct bContext *C, int index);
UndoStep *BKE_undosys_step_same_type_next(UndoStep *us);
UndoStep *BKE_undosys_step_same_type_prev(UndoStep *us);
@@ -196,4 +188,6 @@ void BKE_undosys_ID_map_foreach_ID_ref(
struct UndoIDPtrMap *map,
UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data);
+void BKE_undosys_print(UndoStack *ustack);
+
#endif /* __BKE_UNDO_SYSTEM_H__ */
diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h
index 59475d3098a..47fc40e5548 100644
--- a/source/blender/blenkernel/BKE_unit.h
+++ b/source/blender/blenkernel/BKE_unit.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BKE_UNIT_H__
#define __BKE_UNIT_H__
-/** \file BKE_unit.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
@@ -43,10 +37,10 @@ size_t bUnit_AsString2(char *str, int len_max, double value, int prec, int type,
bool bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double scale_pref, int system, int type);
/* return true if the string contains any valid unit for the given type */
-bool bUnit_ContainsUnit(const char *str, int system, int type);
+bool bUnit_ContainsUnit(const char *str, int type);
/* if user does not specify a unit, multiply with this value */
-double bUnit_PreferredUnitScalar(const struct UnitSettings *settings, int type);
+double bUnit_PreferredInputUnitScalar(const struct UnitSettings *settings, int type);
/* make string keyboard-friendly: 10µm --> 10um */
void bUnit_ToUnitAltName(char *str, int len_max, const char *orig_str, int system, int type);
@@ -84,7 +78,8 @@ enum {
B_UNIT_VELOCITY = 7,
B_UNIT_ACCELERATION = 8,
B_UNIT_CAMERA = 9,
- B_UNIT_TYPE_TOT = 10,
+ B_UNIT_POWER = 10,
+ B_UNIT_TYPE_TOT = 11,
};
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h
index 6902fb631e4..717abdaf3fc 100644
--- a/source/blender/blenkernel/BKE_workspace.h
+++ b/source/blender/blenkernel/BKE_workspace.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BKE_workspace.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __BKE_WORKSPACE_H__
@@ -27,12 +23,12 @@
#include "BLI_compiler_attrs.h"
-struct bScreen;
-struct bToolRef;
struct Main;
struct Scene;
struct TransformOrientation;
struct ViewLayer;
+struct bScreen;
+struct bToolRef;
/* -------------------------------------------------------------------- */
/* Create, delete, init */
diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h
index eb0548c682e..3e4d3459c03 100644
--- a/source/blender/blenkernel/BKE_world.h
+++ b/source/blender/blenkernel/BKE_world.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_WORLD_H__
#define __BKE_WORLD_H__
-/** \file BKE_world.h
- * \ingroup bke
- * \since March 2001
- * \author nzc
+/** \file
+ * \ingroup bke
*/
struct Depsgraph;
diff --git a/source/blender/blenkernel/BKE_writeavi.h b/source/blender/blenkernel/BKE_writeavi.h
index 05a6986528e..a4c614eed37 100644
--- a/source/blender/blenkernel/BKE_writeavi.h
+++ b/source/blender/blenkernel/BKE_writeavi.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_WRITEAVI_H__
#define __BKE_WRITEAVI_H__
-/** \file BKE_writeavi.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h
index 0950935fbc8..701f83e59a3 100644
--- a/source/blender/blenkernel/BKE_writeffmpeg.h
+++ b/source/blender/blenkernel/BKE_writeffmpeg.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_WRITEFFMPEG_H__
#define __BKE_WRITEFFMPEG_H__
-/** \file BKE_writeffmpeg.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef WITH_FFMPEG
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 00b64379647..c882be972f5 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -129,13 +124,16 @@ set(SRC
intern/ipo.c
intern/key.c
intern/keyconfig.c
- intern/lamp.c
intern/lattice.c
+ intern/layer.c
+ intern/layer_utils.c
intern/library.c
intern/library_idmap.c
intern/library_override.c
intern/library_query.c
intern/library_remap.c
+ intern/light.c
+ intern/lightprobe.c
intern/linestyle.c
intern/main.c
intern/mask.c
@@ -162,9 +160,9 @@ set(SRC
intern/nla.c
intern/node.c
intern/object.c
- intern/object_facemap.c
intern/object_deform.c
intern/object_dupli.c
+ intern/object_facemap.c
intern/object_update.c
intern/ocean.c
intern/outliner_treehash.c
@@ -178,9 +176,6 @@ set(SRC
intern/pbvh.c
intern/pbvh_bmesh.c
intern/pointcache.c
- intern/layer.c
- intern/layer_utils.c
- intern/lightprobe.c
intern/report.c
intern/rigidbody.c
intern/scene.c
@@ -199,6 +194,7 @@ set(SRC
intern/subdiv.c
intern/subdiv_ccg.c
intern/subdiv_ccg_mask.c
+ intern/subdiv_ccg_material.c
intern/subdiv_converter.c
intern/subdiv_converter_mesh.c
intern/subdiv_displacement.c
@@ -282,13 +278,15 @@ set(SRC
BKE_ipo.h
BKE_key.h
BKE_keyconfig.h
- BKE_lamp.h
BKE_lattice.h
+ BKE_layer.h
BKE_library.h
BKE_library_idmap.h
BKE_library_override.h
BKE_library_query.h
BKE_library_remap.h
+ BKE_light.h
+ BKE_lightprobe.h
BKE_linestyle.h
BKE_main.h
BKE_mask.h
@@ -307,8 +305,8 @@ set(SRC
BKE_nla.h
BKE_node.h
BKE_object.h
- BKE_object_facemap.h
BKE_object_deform.h
+ BKE_object_facemap.h
BKE_ocean.h
BKE_outliner_treehash.h
BKE_packedFile.h
@@ -316,8 +314,6 @@ set(SRC
BKE_particle.h
BKE_pbvh.h
BKE_pointcache.h
- BKE_layer.h
- BKE_lightprobe.h
BKE_report.h
BKE_rigidbody.h
BKE_scene.h
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 6ec1b1b36b9..ef3101a14b5 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/CCGSubSurf.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
@@ -30,7 +26,6 @@
#include "BLI_sys_types.h" // for intptr_t support
#include "BLI_utildefines.h" /* for BLI_assert */
-#include "BLI_math.h"
#include "BKE_ccg.h"
#include "CCGSubSurf.h"
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h
index 8cdbd2a7a98..b6fc9d5178e 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __CCGSUBSURF_H__
#define __CCGSUBSURF_H__
-/** \file blender/blenkernel/intern/CCGSubSurf.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
typedef void* CCGMeshHDL;
@@ -30,10 +26,10 @@ typedef void* CCGVertHDL;
typedef void* CCGEdgeHDL;
typedef void* CCGFaceHDL;
-typedef struct CCGSubSurf CCGSubSurf;
-typedef struct CCGVert CCGVert;
typedef struct CCGEdge CCGEdge;
typedef struct CCGFace CCGFace;
+typedef struct CCGSubSurf CCGSubSurf;
+typedef struct CCGVert CCGVert;
typedef struct CCGMeshIFC {
int vertUserSize, edgeUserSize, faceUserSize;
@@ -71,8 +67,6 @@ typedef enum {
/***/
-#define CCG_OMP_LIMIT 1000000
-
/* TODO(sergey): This actually depends on subsurf level as well. */
#define CCG_TASK_LIMIT 16
@@ -176,9 +170,9 @@ int ccgSubSurf_getNumFinalFaces (const CCGSubSurf *ss);
/***/
-typedef struct _EHashIterator CCGVertIterator;
typedef struct _EHashIterator CCGEdgeIterator;
typedef struct _EHashIterator CCGFaceIterator;
+typedef struct _EHashIterator CCGVertIterator;
void ccgSubSurf_initVertIterator(CCGSubSurf *ss, CCGVertIterator *viter);
void ccgSubSurf_initEdgeIterator(CCGSubSurf *ss, CCGEdgeIterator *eiter);
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_inline.h b/source/blender/blenkernel/intern/CCGSubSurf_inline.h
index 183578c26ce..c62e4056b52 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_inline.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf_inline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/CCGSubSurf_inline.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __CCGSUBSURF_INLINE_H__
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_intern.h b/source/blender/blenkernel/intern/CCGSubSurf_intern.h
index e1cb82d7868..3f3341533b9 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_intern.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/CCGSubSurf_intern.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __CCGSUBSURF_INTERN_H__
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
index 756935b50ba..2e3169ebdde 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/CCGSubSurf_legacy.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
@@ -334,7 +330,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
.effectedF = effectedF,
.numEffectedV = numEffectedV,
.numEffectedE = numEffectedE,
- .numEffectedF = numEffectedF
+ .numEffectedF = numEffectedF,
};
{
@@ -677,7 +673,7 @@ static void ccgSubSurf__calcSubdivLevel(
.numEffectedV = numEffectedV,
.numEffectedE = numEffectedE,
.numEffectedF = numEffectedF,
- .curLvl = curLvl
+ .curLvl = curLvl,
};
{
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
index 004a50205ba..7556af4cb9f 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef WITH_OPENSUBDIV
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
index 0301582b303..e36442bda55 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef WITH_OPENSUBDIV
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_util.c b/source/blender/blenkernel/intern/CCGSubSurf_util.c
index c7ef528c02f..c47a922cc2a 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_util.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/CCGSubSurf_util.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
@@ -41,7 +37,7 @@
static int kHashSizes[] = {
1, 3, 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, 268435459
+ 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459,
};
/* Generic hash functions. */
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index b2fe4ff742e..1fe72ce95a7 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/DerivedMesh.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -36,6 +28,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_cloth_types.h"
+#include "DNA_customdata_types.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
@@ -77,6 +70,8 @@
#include "DEG_depsgraph_query.h"
#include "BKE_shrinkwrap.h"
+#include "CLG_log.h"
+
#ifdef WITH_OPENSUBDIV
# include "DNA_userdef_types.h"
#endif
@@ -92,7 +87,7 @@
# define ASSERT_IS_VALID_MESH(mesh)
#endif
-
+static CLG_LogRef LOG = {"bke.derivedmesh"};
static ThreadRWMutex loops_cache_lock = PTHREAD_RWLOCK_INITIALIZER;
@@ -367,13 +362,13 @@ void DM_from_template_ex(
DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type,
int numVerts, int numEdges, int numTessFaces,
int numLoops, int numPolys,
- CustomDataMask mask)
+ const CustomData_MeshMasks *mask)
{
- CustomData_copy(&source->vertData, &dm->vertData, mask, CD_CALLOC, numVerts);
- CustomData_copy(&source->edgeData, &dm->edgeData, mask, CD_CALLOC, numEdges);
- CustomData_copy(&source->faceData, &dm->faceData, mask, CD_CALLOC, numTessFaces);
- CustomData_copy(&source->loopData, &dm->loopData, mask, CD_CALLOC, numLoops);
- CustomData_copy(&source->polyData, &dm->polyData, mask, CD_CALLOC, numPolys);
+ CustomData_copy(&source->vertData, &dm->vertData, mask->vmask, CD_CALLOC, numVerts);
+ CustomData_copy(&source->edgeData, &dm->edgeData, mask->emask, CD_CALLOC, numEdges);
+ CustomData_copy(&source->faceData, &dm->faceData, mask->fmask, CD_CALLOC, numTessFaces);
+ CustomData_copy(&source->loopData, &dm->loopData, mask->lmask, CD_CALLOC, numLoops);
+ CustomData_copy(&source->polyData, &dm->polyData, mask->pmask, CD_CALLOC, numPolys);
dm->cd_flag = source->cd_flag;
@@ -398,7 +393,7 @@ void DM_from_template(
dm, source, type,
numVerts, numEdges, numTessFaces,
numLoops, numPolys,
- CD_MASK_DERIVEDMESH);
+ &CD_MASK_DERIVEDMESH);
}
int DM_release(DerivedMesh *dm)
@@ -439,8 +434,8 @@ void DM_DupPolys(DerivedMesh *source, DerivedMesh *target)
CustomData_free(&target->loopData, source->numLoopData);
CustomData_free(&target->polyData, source->numPolyData);
- CustomData_copy(&source->loopData, &target->loopData, CD_MASK_DERIVEDMESH, CD_DUPLICATE, source->numLoopData);
- CustomData_copy(&source->polyData, &target->polyData, CD_MASK_DERIVEDMESH, CD_DUPLICATE, source->numPolyData);
+ CustomData_copy(&source->loopData, &target->loopData, CD_MASK_DERIVEDMESH.lmask, CD_DUPLICATE, source->numLoopData);
+ CustomData_copy(&source->polyData, &target->polyData, CD_MASK_DERIVEDMESH.pmask, CD_DUPLICATE, source->numPolyData);
target->numLoopData = source->numLoopData;
target->numPolyData = source->numPolyData;
@@ -467,7 +462,7 @@ void DM_ensure_normals(DerivedMesh *dm)
/**
* Ensure the array is large enough
*
- * /note This function must always be thread-protected by caller. It should only be used by internal code.
+ * \note This function must always be thread-protected by caller. It should only be used by internal code.
*/
void DM_ensure_looptri_data(DerivedMesh *dm)
{
@@ -498,7 +493,7 @@ void DM_ensure_looptri_data(DerivedMesh *dm)
}
}
-void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool take_ownership)
+void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, const CustomData_MeshMasks *mask, bool take_ownership)
{
/* dm might depend on me, so we need to do everything with a local copy */
Mesh tmp = *me;
@@ -532,10 +527,10 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool
totpoly = tmp.totpoly = dm->getNumPolys(dm);
tmp.totface = 0;
- CustomData_copy(&dm->vertData, &tmp.vdata, mask, alloctype, totvert);
- CustomData_copy(&dm->edgeData, &tmp.edata, mask, alloctype, totedge);
- CustomData_copy(&dm->loopData, &tmp.ldata, mask, alloctype, totloop);
- CustomData_copy(&dm->polyData, &tmp.pdata, mask, alloctype, totpoly);
+ CustomData_copy(&dm->vertData, &tmp.vdata, mask->vmask, alloctype, totvert);
+ CustomData_copy(&dm->edgeData, &tmp.edata, mask->emask, alloctype, totedge);
+ CustomData_copy(&dm->loopData, &tmp.ldata, mask->lmask, alloctype, totloop);
+ CustomData_copy(&dm->polyData, &tmp.pdata, mask->pmask, alloctype, totpoly);
tmp.cd_flag = dm->cd_flag;
tmp.runtime.deformed_only = dm->deformedOnly;
@@ -549,9 +544,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool
uid = kb->uid;
}
else {
- printf("%s: error - could not find active shapekey %d!\n",
- __func__, ob->shapenr - 1);
-
+ CLOG_ERROR(&LOG, "could not find active shapekey %d!", ob->shapenr - 1);
uid = INT_MAX;
}
}
@@ -614,7 +607,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool
* which should be fed through the modifier
* stack */
if (tmp.totvert != me->totvert && !did_shapekeys && me->key) {
- printf("%s: YEEK! this should be recoded! Shape key loss!: ID '%s'\n", __func__, tmp.id.name);
+ CLOG_WARN(&LOG, "YEEK! this should be recoded! Shape key loss!: ID '%s'", tmp.id.name);
if (tmp.key && !(tmp.id.tag & LIB_TAG_NO_MAIN)) {
id_us_min(&tmp.key->id);
}
@@ -635,10 +628,10 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool
if (take_ownership) {
if (alloctype == CD_ASSIGN) {
- CustomData_free_typemask(&dm->vertData, dm->numVertData, ~mask);
- CustomData_free_typemask(&dm->edgeData, dm->numEdgeData, ~mask);
- CustomData_free_typemask(&dm->loopData, dm->numLoopData, ~mask);
- CustomData_free_typemask(&dm->polyData, dm->numPolyData, ~mask);
+ CustomData_free_typemask(&dm->vertData, dm->numVertData, ~mask->vmask);
+ CustomData_free_typemask(&dm->edgeData, dm->numEdgeData, ~mask->emask);
+ CustomData_free_typemask(&dm->loopData, dm->numLoopData, ~mask->lmask);
+ CustomData_free_typemask(&dm->polyData, dm->numPolyData, ~mask->pmask);
}
dm->release(dm);
}
@@ -663,31 +656,31 @@ void BKE_mesh_runtime_eval_to_meshkey(Mesh *me_deformed, Mesh *me, KeyBlock *kb)
* zero for the layer type, so only layer types specified by the mask
* will be copied
*/
-void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask)
+void DM_set_only_copy(DerivedMesh *dm, const CustomData_MeshMasks *mask)
{
- CustomData_set_only_copy(&dm->vertData, mask);
- CustomData_set_only_copy(&dm->edgeData, mask);
- CustomData_set_only_copy(&dm->faceData, mask);
+ CustomData_set_only_copy(&dm->vertData, mask->vmask);
+ CustomData_set_only_copy(&dm->edgeData, mask->emask);
+ CustomData_set_only_copy(&dm->faceData, mask->fmask);
/* this wasn't in 2.63 and is disabled for 2.64 because it gives problems with
* weight paint mode when there are modifiers applied, needs further investigation,
* see replies to r50969, Campbell */
#if 0
- CustomData_set_only_copy(&dm->loopData, mask);
- CustomData_set_only_copy(&dm->polyData, mask);
+ CustomData_set_only_copy(&dm->loopData, mask->lmask);
+ CustomData_set_only_copy(&dm->polyData, mask->pmask);
#endif
}
-static void mesh_set_only_copy(Mesh *mesh, CustomDataMask mask)
+static void mesh_set_only_copy(Mesh *mesh, const CustomData_MeshMasks *mask)
{
- CustomData_set_only_copy(&mesh->vdata, mask);
- CustomData_set_only_copy(&mesh->edata, mask);
- CustomData_set_only_copy(&mesh->fdata, mask);
+ CustomData_set_only_copy(&mesh->vdata, mask->vmask);
+ CustomData_set_only_copy(&mesh->edata, mask->emask);
+ CustomData_set_only_copy(&mesh->fdata, mask->fmask);
/* this wasn't in 2.63 and is disabled for 2.64 because it gives problems with
* weight paint mode when there are modifiers applied, needs further investigation,
* see replies to r50969, Campbell */
#if 0
- CustomData_set_only_copy(&mesh->ldata, mask);
- CustomData_set_only_copy(&mesh->pdata, mask);
+ CustomData_set_only_copy(&mesh->ldata, mask->lmask);
+ CustomData_set_only_copy(&mesh->pdata, mask->pmask);
#endif
}
@@ -990,7 +983,7 @@ static Mesh *create_orco_mesh(Object *ob, Mesh *me, BMEditMesh *em, int layer)
int free;
if (em) {
- mesh = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, 0);
+ mesh = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, NULL);
}
else {
mesh = BKE_mesh_copy_for_eval(me, true);
@@ -1107,7 +1100,7 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape
kb->totelem = dm->numVertData;
kb->data = MEM_calloc_arrayN(kb->totelem, 3 * sizeof(float), "kb->data derivedmesh.c");
- fprintf(stderr, "%s: lost a shapekey layer: '%s'! (bmesh internal error)\n", __func__, kb->name);
+ CLOG_ERROR(&LOG, "lost a shapekey layer: '%s'! (bmesh internal error)", kb->name);
}
}
}
@@ -1123,9 +1116,8 @@ static void add_shapekey_layers(Mesh *me_dst, Mesh *me_src, Object *UNUSED(ob))
/* ensure we can use mesh vertex count for derived mesh custom data */
if (me_src->totvert != me_dst->totvert) {
- fprintf(stderr,
- "%s: vertex size mismatch (mesh/eval) '%s' (%d != %d)\n",
- __func__, me_src->id.name + 2, me_src->totvert, me_dst->totvert);
+ CLOG_WARN(&LOG, "vertex size mismatch (mesh/eval) '%s' (%d != %d)",
+ me_src->id.name + 2, me_src->totvert, me_dst->totvert);
return;
}
@@ -1134,9 +1126,8 @@ static void add_shapekey_layers(Mesh *me_dst, Mesh *me_src, Object *UNUSED(ob))
float *array;
if (me_src->totvert != kb->totelem) {
- fprintf(stderr,
- "%s: vertex size mismatch (Mesh '%s':%d != KeyBlock '%s':%d)\n",
- __func__, me_src->id.name + 2, me_src->totvert, kb->name, kb->totelem);
+ CLOG_WARN(&LOG, "vertex size mismatch (Mesh '%s':%d != KeyBlock '%s':%d)",
+ me_src->id.name + 2, me_src->totvert, kb->name, kb->totelem);
array = MEM_calloc_arrayN((size_t)me_src->totvert, sizeof(float[3]), __func__);
}
else {
@@ -1162,7 +1153,7 @@ static void mesh_copy_autosmooth(Mesh *me, Mesh *me_orig)
static void mesh_calc_modifiers(
struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (*inputVertexCos)[3],
int useDeform,
- const bool need_mapping, CustomDataMask dataMask,
+ const bool need_mapping, const CustomData_MeshMasks *dataMask,
const int index, const bool useCache, const bool build_shapekey_layers,
/* return args */
Mesh **r_deform, Mesh **r_final)
@@ -1170,7 +1161,8 @@ static void mesh_calc_modifiers(
ModifierData *firstmd, *md, *previewmd = NULL;
CDMaskLink *datamasks, *curr;
/* XXX Always copying POLYINDEX, else tessellated data are no more valid! */
- CustomDataMask mask, nextmask, previewmask = 0, append_mask = CD_MASK_ORIGINDEX;
+ CustomData_MeshMasks mask, nextmask, previewmask = {0}, append_mask = CD_MASK_BAREMESH_ORIGINDEX;
+
float (*deformedVerts)[3] = NULL;
int numVerts = ((Mesh *)ob->data)->totvert;
const bool useRenderParams = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
@@ -1184,7 +1176,8 @@ static void mesh_calc_modifiers(
/* Generic preview only in object mode! */
const bool do_mod_mcol = (ob->mode == OB_MODE_OBJECT);
- const bool do_loop_normals = (((Mesh *)ob->data)->flag & ME_AUTOSMOOTH) != 0;
+ const bool do_loop_normals = ((((Mesh *)ob->data)->flag & ME_AUTOSMOOTH) != 0 ||
+ (dataMask->lmask & CD_MASK_NORMAL) != 0);
VirtualModifierData virtualModifierData;
@@ -1216,7 +1209,7 @@ static void mesh_calc_modifiers(
previewmd = modifiers_getLastPreview(scene, md, required_mode);
}
- datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode, previewmd, previewmask);
+ datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode, previewmd, &previewmask);
curr = datamasks;
if (r_deform) {
@@ -1346,12 +1339,12 @@ static void mesh_calc_modifiers(
}
/* add an orco layer if needed by this modifier */
- if (mti->requiredDataMask)
- mask = mti->requiredDataMask(ob, md);
- else
- mask = 0;
+ memset(&mask, 0, sizeof(mask));
+ if (mti->requiredDataMask) {
+ mti->requiredDataMask(ob, md, &mask);
+ }
- if (me && (mask & CD_MASK_ORCO)) {
+ if (me && (mask.vmask & CD_MASK_ORCO)) {
add_orco_mesh(ob, NULL, me, me_orco, CD_ORCO);
}
@@ -1391,7 +1384,7 @@ static void mesh_calc_modifiers(
if (curr->next)
nextmask = curr->next->mask;
else
- nextmask = dataMask;
+ nextmask = *dataMask;
/* apply vertex coordinates or build a Mesh as necessary */
if (me) {
@@ -1418,7 +1411,7 @@ static void mesh_calc_modifiers(
* requests it, this way Mirror, Solidify etc will keep ORIGINDEX
* data by using generic DM_copy_vert_data() functions.
*/
- if (need_mapping || (nextmask & CD_MASK_ORIGINDEX)) {
+ if (need_mapping || ((nextmask.vmask | nextmask.emask | nextmask.pmask) & CD_MASK_ORIGINDEX)) {
/* calc */
CustomData_add_layer(&me->vdata, CD_ORIGINDEX, CD_CALLOC, NULL, me->totvert);
CustomData_add_layer(&me->edata, CD_ORIGINDEX, CD_CALLOC, NULL, me->totedge);
@@ -1436,15 +1429,21 @@ static void mesh_calc_modifiers(
mask = curr->mask;
/* needMapping check here fixes bug [#28112], otherwise it's
* possible that it won't be copied */
- mask |= append_mask;
- mesh_set_only_copy(me, mask | (need_mapping ? CD_MASK_ORIGINDEX : 0));
+ CustomData_MeshMasks_update(&mask, &append_mask);
+ if (need_mapping) {
+ mask.vmask |= CD_MASK_ORIGINDEX;
+ mask.emask |= CD_MASK_ORIGINDEX;
+ mask.pmask |= CD_MASK_ORIGINDEX;
+ }
+ mesh_set_only_copy(me, &mask);
/* add cloth rest shape key if needed */
- if (mask & CD_MASK_CLOTH_ORCO)
+ if (mask.vmask & CD_MASK_CLOTH_ORCO) {
add_orco_mesh(ob, NULL, me, me_orco, CD_CLOTH_ORCO);
+ }
/* add an origspace layer if needed */
- if ((curr->mask) & CD_MASK_ORIGSPACE_MLOOP) {
+ if ((curr->mask.lmask) & CD_MASK_ORIGSPACE_MLOOP) {
if (!CustomData_has_layer(&me->ldata, CD_ORIGSPACE_MLOOP)) {
CustomData_add_layer(&me->ldata, CD_ORIGSPACE_MLOOP, CD_CALLOC, NULL, me->totloop);
mesh_init_origspace(me);
@@ -1473,15 +1472,18 @@ static void mesh_calc_modifiers(
}
/* create an orco mesh in parallel */
- if (nextmask & CD_MASK_ORCO) {
+ if (nextmask.vmask & CD_MASK_ORCO) {
if (!me_orco) {
me_orco = create_orco_mesh(ob, ob->data, NULL, CD_ORCO);
}
- nextmask &= ~CD_MASK_ORCO;
- mesh_set_only_copy(me_orco, nextmask | CD_MASK_ORIGINDEX |
- (mti->requiredDataMask ?
- mti->requiredDataMask(ob, md) : 0));
+ nextmask.vmask &= ~CD_MASK_ORCO;
+ CustomData_MeshMasks temp_cddata_masks = {.vmask=CD_MASK_ORIGINDEX, .emask=CD_MASK_ORIGINDEX, .fmask=CD_MASK_ORIGINDEX, .pmask=CD_MASK_ORIGINDEX};
+ if (mti->requiredDataMask != NULL) {
+ mti->requiredDataMask(ob, md, &temp_cddata_masks);
+ }
+ CustomData_MeshMasks_update(&temp_cddata_masks, &nextmask);
+ mesh_set_only_copy(me_orco, &temp_cddata_masks);
me_next = modwrap_applyModifier(md, &mectx_orco, me_orco);
ASSERT_IS_VALID_MESH(me_next);
@@ -1498,13 +1500,16 @@ static void mesh_calc_modifiers(
}
/* create cloth orco mesh in parallel */
- if (nextmask & CD_MASK_CLOTH_ORCO) {
+ if (nextmask.vmask & CD_MASK_CLOTH_ORCO) {
if (!me_orco_cloth) {
me_orco_cloth = create_orco_mesh(ob, ob->data, NULL, CD_CLOTH_ORCO);
}
- nextmask &= ~CD_MASK_CLOTH_ORCO;
- mesh_set_only_copy(me_orco_cloth, nextmask | CD_MASK_ORIGINDEX);
+ nextmask.vmask &= ~CD_MASK_CLOTH_ORCO;
+ nextmask.vmask |= CD_MASK_ORIGINDEX;
+ nextmask.emask |= CD_MASK_ORIGINDEX;
+ nextmask.pmask |= CD_MASK_ORIGINDEX;
+ mesh_set_only_copy(me_orco_cloth, &nextmask);
me_next = modwrap_applyModifier(md, &mectx_orco, me_orco_cloth);
ASSERT_IS_VALID_MESH(me_next);
@@ -1522,8 +1527,9 @@ static void mesh_calc_modifiers(
/* 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_PREVIEW_MLOOPCOL;
+ if (md->type == eModifierType_DynamicPaint) {
+ append_mask.lmask |= CD_MASK_PREVIEW_MLOOPCOL;
+ }
me->runtime.deformed_only = false;
}
@@ -1566,7 +1572,7 @@ static void mesh_calc_modifiers(
}
/* add an orco layer if needed */
- if (dataMask & CD_MASK_ORCO) {
+ if (dataMask->vmask & CD_MASK_ORCO) {
add_orco_mesh(ob, NULL, *r_final, me_orco, CD_ORCO);
if (r_deform && *r_deform)
@@ -1581,7 +1587,7 @@ static void mesh_calc_modifiers(
if (sculpt_dyntopo == false) {
/* watch this! after 2.75a we move to from tessface to looptri (by default) */
- if (dataMask & CD_MASK_MFACE) {
+ if (dataMask->fmask & CD_MASK_MFACE) {
BKE_mesh_tessface_ensure(*r_final);
}
@@ -1623,7 +1629,7 @@ static void mesh_calc_modifiers(
static void mesh_calc_modifiers_dm(
struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (*inputVertexCos)[3],
int useDeform,
- const bool need_mapping, CustomDataMask dataMask,
+ const bool need_mapping, const CustomData_MeshMasks *dataMask,
const int index, const bool useCache, const bool build_shapekey_layers,
/* return args */
DerivedMesh **r_deformdm, DerivedMesh **r_finaldm)
@@ -1636,11 +1642,11 @@ static void mesh_calc_modifiers_dm(
(r_deformdm ? &deform_mesh : NULL), &final_mesh);
if (deform_mesh) {
- *r_deformdm = CDDM_from_mesh_ex(deform_mesh, CD_DUPLICATE, CD_MASK_MESH);
+ *r_deformdm = CDDM_from_mesh_ex(deform_mesh, CD_DUPLICATE, &CD_MASK_MESH);
BKE_id_free(NULL, deform_mesh);
}
- *r_finaldm = CDDM_from_mesh_ex(final_mesh, CD_DUPLICATE, CD_MASK_MESH);
+ *r_finaldm = CDDM_from_mesh_ex(final_mesh, CD_DUPLICATE, &CD_MASK_MESH);
BKE_id_free(NULL, final_mesh);
}
#endif
@@ -1682,13 +1688,13 @@ bool editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, bool has_prev
static void editbmesh_calc_modifiers(
struct Depsgraph *depsgraph, Scene *scene, Object *ob,
- BMEditMesh *em, CustomDataMask dataMask,
+ BMEditMesh *em, const CustomData_MeshMasks *dataMask,
/* return args */
Mesh **r_cage, Mesh **r_final)
{
ModifierData *md;
float (*deformedVerts)[3] = NULL;
- CustomDataMask mask = 0, append_mask = 0;
+ CustomData_MeshMasks mask = {0}, append_mask = CD_MASK_BAREMESH;
int i, numVerts = 0, cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1);
CDMaskLink *datamasks, *curr;
const int required_mode = eModifierMode_Realtime | eModifierMode_Editmode;
@@ -1700,7 +1706,8 @@ static void editbmesh_calc_modifiers(
const ModifierEvalContext mectx_orco = {depsgraph, ob, MOD_APPLY_ORCO};
const ModifierEvalContext mectx_cache = {depsgraph, ob, MOD_APPLY_USECACHE};
- const bool do_loop_normals = (((Mesh *)(ob->data))->flag & ME_AUTOSMOOTH) != 0;
+ const bool do_loop_normals = ((((Mesh *)(ob->data))->flag & ME_AUTOSMOOTH) != 0 ||
+ (dataMask->lmask & CD_MASK_NORMAL) != 0);
modifiers_clearErrors(ob);
@@ -1712,7 +1719,7 @@ static void editbmesh_calc_modifiers(
md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
/* copied from mesh_calc_modifiers */
- datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode, NULL, 0);
+ datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode, NULL, NULL);
curr = datamasks;
@@ -1721,6 +1728,7 @@ static void editbmesh_calc_modifiers(
for (i = 0; md; i++, md = md->next, curr = curr->next) {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+ memset(&mask, 0, sizeof(mask));
if (!editbmesh_modifier_is_enabled(scene, md, me != NULL)) {
continue;
@@ -1728,8 +1736,8 @@ static void editbmesh_calc_modifiers(
/* add an orco layer if needed by this modifier */
if (me && mti->requiredDataMask) {
- mask = mti->requiredDataMask(ob, md);
- if (mask & CD_MASK_ORCO) {
+ mti->requiredDataMask(ob, md, &mask);
+ if (mask.vmask & CD_MASK_ORCO) {
add_orco_mesh(ob, em, me, me_orco, CD_ORCO);
}
}
@@ -1780,7 +1788,7 @@ static void editbmesh_calc_modifiers(
}
else {
- me = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, 0);
+ me = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, NULL);
ASSERT_IS_VALID_MESH(me);
mesh_copy_autosmooth(me, ob->data);
@@ -1792,13 +1800,16 @@ static void editbmesh_calc_modifiers(
/* create an orco derivedmesh in parallel */
mask = curr->mask;
- if (mask & CD_MASK_ORCO) {
+ if (mask.vmask & CD_MASK_ORCO) {
if (!me_orco) {
me_orco = create_orco_mesh(ob, ob->data, em, CD_ORCO);
}
- mask &= ~CD_MASK_ORCO;
- mesh_set_only_copy(me_orco, mask | CD_MASK_ORIGINDEX);
+ mask.vmask &= ~CD_MASK_ORCO;
+ mask.vmask |= CD_MASK_ORIGINDEX;
+ mask.emask |= CD_MASK_ORIGINDEX;
+ mask.pmask |= CD_MASK_ORIGINDEX;
+ mesh_set_only_copy(me_orco, &mask);
me_next = modwrap_applyModifier(md, &mectx_orco, me_orco);
ASSERT_IS_VALID_MESH(me_next);
@@ -1813,12 +1824,15 @@ static void editbmesh_calc_modifiers(
}
/* set the DerivedMesh to only copy needed data */
- mask |= append_mask;
- mask = curr->mask; /* CD_MASK_ORCO may have been cleared above */
+ CustomData_MeshMasks_update(&mask, &append_mask);
+ mask = curr->mask; /* CD_MASK_ORCO may have been cleared above */ /* XXX WHAT? ovewrites mask ??? */
+ mask.vmask |= CD_MASK_ORIGINDEX;
+ mask.emask |= CD_MASK_ORIGINDEX;
+ mask.pmask |= CD_MASK_ORIGINDEX;
- mesh_set_only_copy(me, mask | CD_MASK_ORIGINDEX);
+ mesh_set_only_copy(me, &mask);
- if (mask & CD_MASK_ORIGSPACE_MLOOP) {
+ if (mask.lmask & CD_MASK_ORIGSPACE_MLOOP) {
if (!CustomData_has_layer(&me->ldata, CD_ORIGSPACE_MLOOP)) {
CustomData_add_layer(&me->ldata, CD_ORIGSPACE_MLOOP, CD_CALLOC, NULL, me->totloop);
mesh_init_origspace(me);
@@ -1859,7 +1873,7 @@ static void editbmesh_calc_modifiers(
me_orig->runtime.edit_data->vertexCos = MEM_dupallocN(deformedVerts);
}
*r_cage = BKE_mesh_from_editmesh_with_coords_thin_wrap(
- em, mask,
+ em, &mask,
deformedVerts ? MEM_dupallocN(deformedVerts) : NULL);
mesh_copy_autosmooth(*r_cage, ob->data);
}
@@ -1919,12 +1933,12 @@ static void editbmesh_calc_modifiers(
* 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 (dataMask & CD_MASK_MFACE) {
- if ((*r_final)->edit_btmesh == NULL) {
+ if (dataMask->fmask & CD_MASK_MFACE) {
+ if ((*r_final)->edit_mesh == NULL) {
BKE_mesh_tessface_ensure(*r_final);
}
if (r_cage && *r_cage) {
- if ((*r_cage)->edit_btmesh == NULL) {
+ if ((*r_cage)->edit_mesh == NULL) {
if (*r_cage != *r_final) {
BKE_mesh_tessface_ensure(*r_cage);
}
@@ -1952,7 +1966,7 @@ static void editbmesh_calc_modifiers(
}
/* add an orco layer if needed */
- if (dataMask & CD_MASK_ORCO)
+ if (dataMask->vmask & CD_MASK_ORCO)
add_orco_mesh(ob, em, *r_final, me_orco, CD_ORCO);
if (me_orco) {
@@ -1982,7 +1996,7 @@ static void mesh_finalize_eval(Object *object)
/* Make evaluated mesh to share same edit mesh pointer as original
* and copied meshes.
*/
- mesh_eval->edit_btmesh = mesh->edit_btmesh;
+ mesh_eval->edit_mesh = mesh->edit_mesh;
/* Copy autosmooth settings from original mesh.
* This is not done by BKE_mesh_new_nomain_from_template(), so need to take
* extra care here.
@@ -2024,7 +2038,7 @@ static void mesh_runtime_check_normals_valid(const Mesh *mesh)
}
static void mesh_build_data(
- struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask,
+ struct Depsgraph *depsgraph, Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask,
const bool build_shapekey_layers, const bool need_mapping)
{
BLI_assert(ob->type == OB_MESH);
@@ -2036,10 +2050,14 @@ static void mesh_build_data(
BKE_object_free_derived_caches(ob);
BKE_object_sculpt_modifiers_changed(ob);
+#if 0 /* XXX This is already taken care of in mesh_calc_modifiers()... */
if (need_mapping) {
/* Also add the flag so that it is recorded in lastDataMask. */
- dataMask |= CD_MASK_ORIGINDEX;
+ dataMask->vmask |= CD_MASK_ORIGINDEX;
+ dataMask->emask |= CD_MASK_ORIGINDEX;
+ dataMask->pmask |= CD_MASK_ORIGINDEX;
}
+#endif
mesh_calc_modifiers(
depsgraph, scene, ob, NULL, 1, need_mapping, dataMask, -1, true, build_shapekey_layers,
@@ -2047,12 +2065,16 @@ static void mesh_build_data(
#ifdef USE_DERIVEDMESH
/* TODO(campbell): remove these copies, they are expected in various places over the code. */
- ob->derivedDeform = CDDM_from_mesh_ex(ob->runtime.mesh_deform_eval, CD_REFERENCE, CD_MASK_MESH);
- ob->derivedFinal = CDDM_from_mesh_ex(ob->runtime.mesh_eval, CD_REFERENCE, CD_MASK_MESH);
+ ob->derivedDeform = CDDM_from_mesh_ex(ob->runtime.mesh_deform_eval, CD_REFERENCE, &CD_MASK_MESH);
+ ob->derivedFinal = CDDM_from_mesh_ex(ob->runtime.mesh_eval, CD_REFERENCE, &CD_MASK_MESH);
#endif
BKE_object_boundbox_calc_from_mesh(ob, ob->runtime.mesh_eval);
- BKE_mesh_texspace_copy_from_object(ob->runtime.mesh_eval, ob);
+ /* Only copy texspace from orig mesh if some modifier (hint: smoke sim, see T58492)
+ * did not re-enable that flag (which always get disabled for eval mesh as a start). */
+ if (!(ob->runtime.mesh_eval->texflag & ME_AUTOSPACE)) {
+ BKE_mesh_texspace_copy_from_object(ob->runtime.mesh_eval, ob);
+ }
mesh_finalize_eval(ob);
@@ -2060,7 +2082,7 @@ static void mesh_build_data(
ob->derivedFinal->needsFree = 0;
ob->derivedDeform->needsFree = 0;
#endif
- ob->runtime.last_data_mask = dataMask;
+ ob->runtime.last_data_mask = *dataMask;
ob->runtime.last_need_mapping = need_mapping;
if ((ob->mode & OB_MODE_ALL_SCULPT) && ob->sculpt) {
@@ -2077,7 +2099,7 @@ static void mesh_build_data(
static void editbmesh_build_data(
struct Depsgraph *depsgraph, Scene *scene,
- Object *obedit, BMEditMesh *em, CustomDataMask dataMask)
+ Object *obedit, BMEditMesh *em, CustomData_MeshMasks *dataMask)
{
BLI_assert(em->ob->id.tag & LIB_TAG_COPIED_ON_WRITE);
@@ -2098,16 +2120,17 @@ static void editbmesh_build_data(
BKE_object_boundbox_calc_from_mesh(obedit, em->mesh_eval_final);
- em->lastDataMask = dataMask;
+ em->lastDataMask = *dataMask;
mesh_runtime_check_normals_valid(em->mesh_eval_final);
}
-static CustomDataMask object_get_datamask(const Depsgraph *depsgraph, Object *ob, bool *r_need_mapping)
+static void object_get_datamask(const Depsgraph *depsgraph, Object *ob, CustomData_MeshMasks *r_mask, bool *r_need_mapping)
{
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
Object *actob = view_layer->basact ? DEG_get_original_object(view_layer->basact->object) : NULL;
- CustomDataMask mask = DEG_get_customdata_mask_for_object(depsgraph, ob);
+
+ DEG_get_customdata_mask_for_object(depsgraph, ob, r_mask);
if (r_need_mapping) {
*r_need_mapping = false;
@@ -2123,37 +2146,37 @@ static CustomDataMask object_get_datamask(const Depsgraph *depsgraph, Object *ob
/* check if we need tfaces & mcols due to face select or texture paint */
if ((ob->mode & OB_MODE_TEXTURE_PAINT) || editing) {
- mask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTFACE;
+ r_mask->lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL;
+ r_mask->fmask |= CD_MASK_MTFACE;
}
/* check if we need mcols due to vertex paint or weightpaint */
if (ob->mode & OB_MODE_VERTEX_PAINT) {
- mask |= CD_MASK_MLOOPCOL;
+ r_mask->lmask |= CD_MASK_MLOOPCOL;
}
if (ob->mode & OB_MODE_WEIGHT_PAINT) {
- mask |= CD_MASK_MDEFORMVERT;
+ r_mask->vmask |= CD_MASK_MDEFORMVERT;
}
if (ob->mode & OB_MODE_EDIT)
- mask |= CD_MASK_MVERT_SKIN;
+ r_mask->vmask |= CD_MASK_MVERT_SKIN;
}
-
- return mask;
}
void makeDerivedMesh(
struct Depsgraph *depsgraph, Scene *scene, Object *ob, BMEditMesh *em,
- CustomDataMask dataMask, const bool build_shapekey_layers)
+ const CustomData_MeshMasks *dataMask, const bool build_shapekey_layers)
{
bool need_mapping;
- dataMask |= object_get_datamask(depsgraph, ob, &need_mapping);
+ CustomData_MeshMasks cddata_masks = *dataMask;
+ object_get_datamask(depsgraph, ob, &cddata_masks, &need_mapping);
if (em) {
- editbmesh_build_data(depsgraph, scene, ob, em, dataMask);
+ editbmesh_build_data(depsgraph, scene, ob, em, &cddata_masks);
}
else {
- mesh_build_data(depsgraph, scene, ob, dataMask, build_shapekey_layers, need_mapping);
+ mesh_build_data(depsgraph, scene, ob, &cddata_masks, build_shapekey_layers, need_mapping);
}
}
@@ -2162,27 +2185,27 @@ void makeDerivedMesh(
#ifdef USE_DERIVEDMESH
/* Deprecated DM, use: 'mesh_get_eval_final'. */
DerivedMesh *mesh_get_derived_final(
- struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask)
+ struct Depsgraph *depsgraph, Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
{
/* if there's no derived mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
*/
bool need_mapping;
- dataMask |= object_get_datamask(depsgraph, ob, &need_mapping);
+ CustomData_MeshMasks cddata_masks = *dataMask;
+ object_get_datamask(depsgraph, ob, &cddata_masks, &need_mapping);
if (!ob->derivedFinal ||
- ((dataMask & ob->lastDataMask) != dataMask) ||
+ !CustomData_MeshMasks_are_matching(&(ob->lastDataMask), &cddata_masks) ||
(need_mapping != ob->lastNeedMapping))
{
- mesh_build_data(depsgraph, scene, ob, dataMask, false, need_mapping);
+ mesh_build_data(depsgraph, scene, ob, cddata_masks, false, need_mapping);
}
if (ob->derivedFinal) { BLI_assert(!(ob->derivedFinal->dirty & DM_DIRTY_NORMALS)); }
return ob->derivedFinal;
}
#endif
-Mesh *mesh_get_eval_final(
- struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask)
+Mesh *mesh_get_eval_final(struct Depsgraph *depsgraph, Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
{
/* This function isn't thread-safe and can't be used during evaluation. */
BLI_assert(DEG_debug_is_evaluating(depsgraph) == false);
@@ -2195,13 +2218,15 @@ Mesh *mesh_get_eval_final(
* the data we need, rebuild the derived mesh
*/
bool need_mapping;
- dataMask |= object_get_datamask(depsgraph, ob, &need_mapping);
+ CustomData_MeshMasks cddata_masks = *dataMask;
+ object_get_datamask(depsgraph, ob, &cddata_masks, &need_mapping);
if (!ob->runtime.mesh_eval ||
- ((dataMask & ob->runtime.last_data_mask) != dataMask) ||
+ !CustomData_MeshMasks_are_matching(&(ob->runtime.last_data_mask), &cddata_masks) ||
(need_mapping && !ob->runtime.last_need_mapping))
{
- mesh_build_data(depsgraph, scene, ob, dataMask | ob->runtime.last_data_mask,
+ CustomData_MeshMasks_update(&cddata_masks, &ob->runtime.last_data_mask);
+ mesh_build_data(depsgraph, scene, ob, &cddata_masks,
false, need_mapping || ob->runtime.last_need_mapping);
}
@@ -2211,26 +2236,27 @@ Mesh *mesh_get_eval_final(
#ifdef USE_DERIVEDMESH
/* Deprecated DM, use: 'mesh_get_eval_deform' instead. */
-DerivedMesh *mesh_get_derived_deform(struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask)
+DerivedMesh *mesh_get_derived_deform(struct Depsgraph *depsgraph, Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
{
/* if there's no derived mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
*/
bool need_mapping;
- dataMask |= object_get_datamask(depsgraph, ob, &need_mapping);
+ CustomData_MeshMasks cddata_masks = *dataMask;
+ object_get_datamask(depsgraph, ob, &cddata_masks, &need_mapping);
if (!ob->derivedDeform ||
- ((dataMask & ob->lastDataMask) != dataMask) ||
+ !CustomData_MeshMasks_are_matching(&(ob->lastDataMask), &cddata_masks) ||
(need_mapping != ob->lastNeedMapping))
{
- mesh_build_data(depsgraph, scene, ob, dataMask, false, need_mapping);
+ mesh_build_data(depsgraph, scene, ob, cddata_masks, false, need_mapping);
}
return ob->derivedDeform;
}
#endif
-Mesh *mesh_get_eval_deform(struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask)
+Mesh *mesh_get_eval_deform(struct Depsgraph *depsgraph, Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
{
/* This function isn't thread-safe and can't be used during evaluation. */
BLI_assert(DEG_debug_is_evaluating(depsgraph) == false);
@@ -2244,13 +2270,15 @@ Mesh *mesh_get_eval_deform(struct Depsgraph *depsgraph, Scene *scene, Object *ob
*/
bool need_mapping;
- dataMask |= object_get_datamask(depsgraph, ob, &need_mapping);
+ CustomData_MeshMasks cddata_masks = *dataMask;
+ object_get_datamask(depsgraph, ob, &cddata_masks, &need_mapping);
if (!ob->runtime.mesh_deform_eval ||
- ((dataMask & ob->runtime.last_data_mask) != dataMask) ||
+ !CustomData_MeshMasks_are_matching(&(ob->runtime.last_data_mask), &cddata_masks) ||
(need_mapping && !ob->runtime.last_need_mapping))
{
- mesh_build_data(depsgraph, scene, ob, dataMask | ob->runtime.last_data_mask,
+ CustomData_MeshMasks_update(&cddata_masks, &ob->runtime.last_data_mask);
+ mesh_build_data(depsgraph, scene, ob, &cddata_masks,
false, need_mapping || ob->runtime.last_need_mapping);
}
@@ -2260,7 +2288,8 @@ Mesh *mesh_get_eval_deform(struct Depsgraph *depsgraph, Scene *scene, Object *ob
#ifdef USE_DERIVEDMESH
/* Deprecated, use `mesh_create_eval_final_render` instead. */
-DerivedMesh *mesh_create_derived_render(struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask)
+DerivedMesh *mesh_create_derived_render(
+ struct Depsgraph *depsgraph, Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
{
DerivedMesh *final;
@@ -2271,7 +2300,7 @@ DerivedMesh *mesh_create_derived_render(struct Depsgraph *depsgraph, Scene *scen
return final;
}
#endif
-Mesh *mesh_create_eval_final_render(struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask)
+Mesh *mesh_create_eval_final_render(Depsgraph *depsgraph, Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
{
Mesh *final;
@@ -2284,7 +2313,8 @@ Mesh *mesh_create_eval_final_render(struct Depsgraph *depsgraph, Scene *scene, O
#ifdef USE_DERIVEDMESH
/* Deprecated, use `mesh_create_eval_final_index_render` instead. */
-DerivedMesh *mesh_create_derived_index_render(struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask, int index)
+DerivedMesh *mesh_create_derived_index_render(
+ struct Depsgraph *depsgraph, Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask, int index)
{
DerivedMesh *final;
@@ -2296,8 +2326,8 @@ DerivedMesh *mesh_create_derived_index_render(struct Depsgraph *depsgraph, Scene
}
#endif
Mesh *mesh_create_eval_final_index_render(
- struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob, CustomDataMask dataMask, int index)
+ Depsgraph *depsgraph, Scene *scene,
+ Object *ob, const CustomData_MeshMasks *dataMask, int index)
{
Mesh *final;
@@ -2312,7 +2342,7 @@ Mesh *mesh_create_eval_final_index_render(
/* Deprecated, use `mesh_create_eval_final_view` instead. */
DerivedMesh *mesh_create_derived_view(
struct Depsgraph *depsgraph, Scene *scene,
- Object *ob, CustomDataMask dataMask)
+ Object *ob, const CustomData_MeshMasks *dataMask)
{
DerivedMesh *final;
@@ -2333,8 +2363,8 @@ DerivedMesh *mesh_create_derived_view(
#endif
Mesh *mesh_create_eval_final_view(
- struct Depsgraph *depsgraph, Scene *scene,
- Object *ob, CustomDataMask dataMask)
+ Depsgraph *depsgraph, Scene *scene,
+ Object *ob, const CustomData_MeshMasks *dataMask)
{
Mesh *final;
@@ -2354,8 +2384,8 @@ Mesh *mesh_create_eval_final_view(
}
Mesh *mesh_create_eval_no_deform(
- struct Depsgraph *depsgraph, Scene *scene, Object *ob,
- float (*vertCos)[3], CustomDataMask dataMask)
+ Depsgraph *depsgraph, Scene *scene, Object *ob,
+ float (*vertCos)[3], const CustomData_MeshMasks *dataMask)
{
Mesh *final;
@@ -2367,8 +2397,8 @@ Mesh *mesh_create_eval_no_deform(
}
Mesh *mesh_create_eval_no_deform_render(
- struct Depsgraph *depsgraph, Scene *scene, Object *ob,
- float (*vertCos)[3], CustomDataMask dataMask)
+ Depsgraph *depsgraph, Scene *scene, Object *ob,
+ float (*vertCos)[3], const CustomData_MeshMasks *dataMask)
{
Mesh *final;
@@ -2382,20 +2412,22 @@ Mesh *mesh_create_eval_no_deform_render(
/***/
Mesh *editbmesh_get_eval_cage_and_final(
- struct Depsgraph *depsgraph, Scene *scene, Object *obedit, BMEditMesh *em,
- CustomDataMask dataMask,
+ Depsgraph *depsgraph, Scene *scene, Object *obedit, BMEditMesh *em,
+ const CustomData_MeshMasks *dataMask,
/* return args */
Mesh **r_final)
{
+ CustomData_MeshMasks cddata_masks = *dataMask;
+
/* if there's no derived mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
*/
- dataMask |= object_get_datamask(depsgraph, obedit, NULL);
+ object_get_datamask(depsgraph, obedit, &cddata_masks, NULL);
if (!em->mesh_eval_cage ||
- (em->lastDataMask & dataMask) != dataMask)
+ !CustomData_MeshMasks_are_matching(&(em->lastDataMask), &cddata_masks))
{
- editbmesh_build_data(depsgraph, scene, obedit, em, dataMask);
+ editbmesh_build_data(depsgraph, scene, obedit, em, &cddata_masks);
}
*r_final = em->mesh_eval_final;
@@ -2405,17 +2437,19 @@ Mesh *editbmesh_get_eval_cage_and_final(
Mesh *editbmesh_get_eval_cage(
struct Depsgraph *depsgraph, Scene *scene, Object *obedit, BMEditMesh *em,
- CustomDataMask dataMask)
+ const CustomData_MeshMasks *dataMask)
{
+ CustomData_MeshMasks cddata_masks = *dataMask;
+
/* if there's no derived mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
*/
- dataMask |= object_get_datamask(depsgraph, obedit, NULL);
+ object_get_datamask(depsgraph, obedit, &cddata_masks, NULL);
if (!em->mesh_eval_cage ||
- (em->lastDataMask & dataMask) != dataMask)
+ !CustomData_MeshMasks_are_matching(&(em->lastDataMask), &cddata_masks))
{
- editbmesh_build_data(depsgraph, scene, obedit, em, dataMask);
+ editbmesh_build_data(depsgraph, scene, obedit, em, &cddata_masks);
}
return em->mesh_eval_cage;
@@ -2423,7 +2457,7 @@ Mesh *editbmesh_get_eval_cage(
Mesh *editbmesh_get_eval_cage_from_orig(
struct Depsgraph *depsgraph, Scene *scene, Object *obedit, BMEditMesh *UNUSED(em),
- CustomDataMask dataMask)
+ const CustomData_MeshMasks *dataMask)
{
BLI_assert((obedit->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0);
Scene *scene_eval = (Scene *)DEG_get_evaluated_id(depsgraph, &scene->id);
@@ -2473,7 +2507,7 @@ DMCoNo *mesh_get_mapped_verts_nors(Scene *scene, Object *ob)
if (ob->type != OB_MESH || me->totvert == 0)
return NULL;
- dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
+ dm = mesh_get_derived_final(scene, ob, &CD_MASK_BAREMESH_ORIGINDEX);
if (dm->foreachMappedVert) {
vertexcosnos = MEM_calloc_arrayN(me->totvert, sizeof(DMCoNo), "vertexcosnos map");
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 2810daf5019..9ba3a23df05 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
- * Full recode, Joshua Leung, 2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/action.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -56,11 +49,8 @@
#include "BKE_constraint.h"
#include "BKE_deform.h"
#include "BKE_fcurve.h"
-#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_object.h"
@@ -70,6 +60,10 @@
#include "RNA_access.h"
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"bke.action"};
+
/* *********************** NOTE ON POSE AND ACTION **********************
*
* - Pose is the local (object level) component of armature. The current
@@ -123,7 +117,7 @@ void BKE_action_free(bAction *act)
/**
* Only copy internal data of Action ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -169,7 +163,7 @@ void BKE_action_copy_data(Main *UNUSED(bmain), bAction *act_dst, const bAction *
bAction *BKE_action_copy(Main *bmain, const bAction *act_src)
{
bAction *act_copy;
- BKE_id_copy_ex(bmain, &act_src->id, (ID **)&act_copy, 0, false);
+ BKE_id_copy(bmain, &act_src->id, (ID **)&act_copy);
return act_copy;
}
@@ -801,7 +795,7 @@ void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool do_id_user)
/** Deallocates runtime cache of a pose channel's B-Bone shape. */
void BKE_pose_channel_free_bbone_cache(bPoseChannel *pchan)
{
- bPoseChannelRuntime *runtime = &pchan->runtime;
+ bPoseChannel_Runtime *runtime = &pchan->runtime;
runtime->bbone_segments = 0;
MEM_SAFE_FREE(runtime->bbone_rest_mats);
@@ -1011,7 +1005,7 @@ void framechange_poses_clear_unkeyed(Main *bmain)
/* This needs to be done for each object that has a pose */
/* TODO: proxies may/may not be correctly handled here... (this needs checking) */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
/* we only need to do this on objects with a pose */
if ((pose = ob->pose)) {
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
@@ -1381,16 +1375,15 @@ bool BKE_pose_copy_result(bPose *to, bPose *from)
bPoseChannel *pchanto, *pchanfrom;
if (to == NULL || from == NULL) {
- printf("Pose copy error, pose to:%p from:%p\n", (void *)to, (void *)from); /* debug temp */
+ CLOG_ERROR(&LOG, "Pose copy error, pose to:%p from:%p", (void *)to, (void *)from); /* debug temp */
return false;
}
if (to == from) {
- printf("BKE_pose_copy_result source and target are the same\n");
+ CLOG_ERROR(&LOG, "source and target are the same");
return false;
}
-
for (pchanfrom = from->chanbase.first; pchanfrom; pchanfrom = pchanfrom->next) {
pchanto = BKE_pose_channel_find_name(to, pchanfrom->name);
if (pchanto != NULL) {
@@ -1473,7 +1466,6 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c
/* init animdata, and attach to workob */
workob->adt = &adt;
- adt.recalc = ADT_RECALC_ANIM;
adt.action = act;
/* execute effects of Action on to workob (or it's PoseChannels) */
diff --git a/source/blender/blenkernel/intern/addon.c b/source/blender/blenkernel/intern/addon.c
index 854bf62c061..daeb572ce4a 100644
--- a/source/blender/blenkernel/intern/addon.c
+++ b/source/blender/blenkernel/intern/addon.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/blenkernel/intern/addon.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stddef.h>
@@ -40,9 +34,12 @@
#include "DNA_listBase.h"
#include "DNA_userdef_types.h"
-
#include "MEM_guardedalloc.h"
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"bke.addon"};
+
/* -------------------------------------------------------------------- */
/** \name Add-on New/Free
* \{ */
@@ -109,12 +106,12 @@ bAddonPrefType *BKE_addon_pref_type_find(const char *idname, bool quiet)
}
if (!quiet) {
- printf("search for unknown addon-pref '%s'\n", idname);
+ CLOG_WARN(&LOG, "search for unknown addon-pref '%s'", idname);
}
}
else {
if (!quiet) {
- printf("search for empty addon-pref\n");
+ CLOG_WARN(&LOG, "search for empty addon-pref");
}
}
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 1eea203f078..df424ff9346 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/anim.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
@@ -47,9 +39,7 @@
#include "BKE_anim.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
-#include "BKE_context.h"
#include "BKE_curve.h"
-#include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_main.h"
#include "BKE_object.h"
@@ -63,6 +53,10 @@
#include "GPU_batch.h"
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"bke.anim"};
+
// XXX bad level call...
extern short compare_ak_cfraPtr(void *node, void *data);
extern void agroup_to_keylist(struct AnimData *adt, struct bActionGroup *agrp, struct DLRBT_Tree *keys, int saction_flag);
@@ -81,15 +75,6 @@ void animviz_settings_init(bAnimVizSettings *avs)
if (avs == NULL)
return;
- /* ghosting settings */
- avs->ghost_bc = avs->ghost_ac = 10;
-
- avs->ghost_sf = 1; /* xxx - take from scene instead? */
- avs->ghost_ef = 250; /* xxx - take from scene instead? */
-
- avs->ghost_step = 1;
-
-
/* path settings */
avs->path_bc = avs->path_ac = 10;
@@ -495,7 +480,7 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
}
/* calculate path over requested range */
- printf("Calculating MotionPaths between frames %d - %d (%d frames)\n", sfra, efra, efra - sfra + 1);
+ CLOG_INFO(&LOG, 1, "Calculating MotionPaths between frames %d - %d (%d frames)", sfra, efra, efra - sfra + 1);
for (CFRA = sfra; CFRA <= efra; CFRA++) {
if (current_frame_only) {
/* For current frame, only update tagged. */
@@ -659,7 +644,7 @@ void calc_curvepath(Object *ob, ListBase *nurbs)
}
interp_v3_v3v3(pp->vec, bevp->vec, bevpn->vec, fac2);
- pp->vec[3] = fac1 * bevp->alfa + fac2 * bevpn->alfa;
+ pp->vec[3] = fac1 * bevp->tilt + fac2 * bevpn->tilt;
pp->radius = fac1 * bevp->radius + fac2 * bevpn->radius;
pp->weight = fac1 * bevp->weight + fac2 * bevpn->weight;
interp_qt_qtqt(pp->quat, bevp->quat, bevpn->quat, fac2);
@@ -706,7 +691,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
if (ob == NULL || ob->type != OB_CURVE) return 0;
cu = ob->data;
if (ob->runtime.curve_cache == NULL || ob->runtime.curve_cache->path == NULL || ob->runtime.curve_cache->path->data == NULL) {
- printf("no path!\n");
+ CLOG_WARN(&LOG, "no path!");
return 0;
}
path = ob->runtime.curve_cache->path;
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 579509608c3..33f19caf1cc 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/anim_sys.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -44,11 +36,13 @@
#include "BLI_dynstr.h"
#include "BLI_listbase.h"
#include "BLI_string_utils.h"
+#include "BLI_math_rotation.h"
+#include "BLI_math_vector.h"
#include "BLT_translation.h"
#include "DNA_anim_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -78,6 +72,10 @@
#include "atomic_ops.h"
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"bke.anim_sys"};
+
/* ***************************************** */
/* AnimData API */
@@ -286,8 +284,8 @@ AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const int flag)
/* make a copy of action - at worst, user has to delete copies... */
if (do_action) {
BLI_assert(bmain != NULL);
- BKE_id_copy_ex(bmain, (ID *)dadt->action, (ID **)&dadt->action, 0, false);
- BKE_id_copy_ex(bmain, (ID *)dadt->tmpact, (ID **)&dadt->tmpact, 0, false);
+ BKE_id_copy(bmain, (ID *)dadt->action, (ID **)&dadt->action);
+ BKE_id_copy(bmain, (ID *)dadt->tmpact, (ID **)&dadt->tmpact);
}
else if (do_id_user) {
id_us_plus((ID *)dadt->action);
@@ -361,7 +359,7 @@ void BKE_animdata_merge_copy(
// TODO: we must unset all "tweakmode" flags
if ((src->flag & ADT_NLA_EDIT_ON) || (dst->flag & ADT_NLA_EDIT_ON)) {
- printf("ERROR: Merging AnimData blocks while editing NLA is dangerous as it may cause data corruption\n");
+ CLOG_ERROR(&LOG, "Merging AnimData blocks while editing NLA is dangerous as it may cause data corruption");
return;
}
@@ -448,8 +446,8 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha
/* sanity checks */
if (ELEM(NULL, srcAct, dstAct, basepath)) {
if (G.debug & G_DEBUG) {
- printf("ERROR: action_partition_fcurves_by_basepath(%p, %p, %p) has insufficient info to work with\n",
- (void *)srcAct, (void *)dstAct, (void *)basepath);
+ CLOG_ERROR(&LOG, "srcAct: %p, dstAct: %p, basepath: %p has insufficient info to work with",
+ (void *)srcAct, (void *)dstAct, (void *)basepath);
}
return;
}
@@ -530,7 +528,7 @@ void BKE_animdata_separate_by_basepath(
/* sanity checks */
if (ELEM(NULL, srcID, dstID)) {
if (G.debug & G_DEBUG)
- printf("ERROR: no source or destination ID to separate AnimData with\n");
+ CLOG_ERROR(&LOG, "no source or destination ID to separate AnimData with");
return;
}
@@ -540,7 +538,7 @@ void BKE_animdata_separate_by_basepath(
if (ELEM(NULL, srcAdt, dstAdt)) {
if (G.debug & G_DEBUG)
- printf("ERROR: no AnimData for this pair of ID's\n");
+ CLOG_ERROR(&LOG, "no AnimData for this pair of ID's");
return;
}
@@ -551,8 +549,9 @@ void BKE_animdata_separate_by_basepath(
dstAdt->action = BKE_action_add(bmain, srcAdt->action->id.name + 2);
}
else if (dstAdt->action == srcAdt->action) {
- printf("Argh! Source and Destination share animation! ('%s' and '%s' both use '%s') Making new empty action\n",
- srcID->name, dstID->name, srcAdt->action->id.name);
+ CLOG_WARN(&LOG, "Argh! Source and Destination share animation! "
+ "('%s' and '%s' both use '%s') Making new empty action",
+ srcID->name, dstID->name, srcAdt->action->id.name);
/* TODO: review this... */
id_us_min(&dstAdt->action->id);
@@ -616,7 +615,7 @@ char *BKE_animdata_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *p
* restricts the subspace of options to the 'active' data (a manageable state)
*/
/* TODO: watch out for pinned context? */
- if ((sa) && (sa->spacetype == SPACE_BUTS)) {
+ if ((sa) && (sa->spacetype == SPACE_PROPERTIES)) {
Object *ob = CTX_data_active_object(C);
if (ob && id) {
@@ -707,90 +706,97 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o
}
/* Check RNA-Paths for a list of F-Curves */
-static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
+static bool fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
const char *oldKey, const char *newKey, ListBase *curves, bool verify_paths)
{
FCurve *fcu;
-
- /* we need to check every curve... */
+ bool is_changed = false;
+ /* We need to check every curve. */
for (fcu = curves->first; fcu; fcu = fcu->next) {
- if (fcu->rna_path) {
- const char *old_path = fcu->rna_path;
-
- /* firstly, handle the F-Curve's own path */
- fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths);
-
- /* if path changed and the F-Curve is grouped, check if its group also needs renaming
- * (i.e. F-Curve is first of a bone's F-Curves; hence renaming this should also trigger rename)
- */
- if (fcu->rna_path != old_path) {
- bActionGroup *agrp = fcu->grp;
-
- if ((agrp) && STREQ(oldName, agrp->name)) {
- BLI_strncpy(agrp->name, newName, sizeof(agrp->name));
- }
+ if (fcu->rna_path == NULL) {
+ continue;
+ }
+ const char *old_path = fcu->rna_path;
+ /* Firstly, handle the F-Curve's own path. */
+ fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths);
+ /* if path changed and the F-Curve is grouped, check if its group also needs renaming
+ * (i.e. F-Curve is first of a bone's F-Curves; hence renaming this should also trigger rename) */
+ if (fcu->rna_path != old_path) {
+ bActionGroup *agrp = fcu->grp;
+ is_changed = true;
+ if ((agrp != NULL) && STREQ(oldName, agrp->name)) {
+ BLI_strncpy(agrp->name, newName, sizeof(agrp->name));
}
}
}
+ return is_changed;
}
/* Check RNA-Paths for a list of Drivers */
-static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix, const char *oldName, const char *newName,
+static bool drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix, const char *oldName, const char *newName,
const char *oldKey, const char *newKey, ListBase *curves, bool verify_paths)
{
+ bool is_changed = false;
FCurve *fcu;
-
- /* we need to check every curve - drivers are F-Curves too! */
+ /* We need to check every curve - drivers are F-Curves too. */
for (fcu = curves->first; fcu; fcu = fcu->next) {
/* firstly, handle the F-Curve's own path */
- if (fcu->rna_path)
+ if (fcu->rna_path != NULL) {
+ const char *old_rna_path = fcu->rna_path;
fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths);
-
- /* driver? */
- if (fcu->driver) {
- ChannelDriver *driver = fcu->driver;
- DriverVar *dvar;
-
- /* driver variables */
- for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
- /* only change the used targets, since the others will need fixing manually anyway */
- DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
- {
- /* rename RNA path */
- if (dtar->rna_path && dtar->id)
- dtar->rna_path = rna_path_rename_fix(dtar->id, prefix, oldKey, newKey, dtar->rna_path, verify_paths);
-
- /* also fix the bone-name (if applicable) */
- if (strstr(prefix, "bones")) {
- if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB) && (!ref_id || ((Object *)(dtar->id))->data == ref_id)) &&
- (dtar->pchan_name[0]) && STREQ(oldName, dtar->pchan_name) )
- {
- BLI_strncpy(dtar->pchan_name, newName, sizeof(dtar->pchan_name));
- }
+ is_changed |= (fcu->rna_path != old_rna_path);
+ }
+ if (fcu->driver == NULL) {
+ continue;
+ }
+ ChannelDriver *driver = fcu->driver;
+ DriverVar *dvar;
+ /* driver variables */
+ for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
+ /* only change the used targets, since the others will need fixing manually anyway */
+ DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
+ {
+ /* rename RNA path */
+ if (dtar->rna_path && dtar->id) {
+ const char *old_rna_path = dtar->rna_path;
+ dtar->rna_path = rna_path_rename_fix(dtar->id, prefix, oldKey, newKey, dtar->rna_path, verify_paths);
+ is_changed |= (dtar->rna_path != old_rna_path);
+ }
+ /* also fix the bone-name (if applicable) */
+ if (strstr(prefix, "bones")) {
+ if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB) && (!ref_id || ((Object *)(dtar->id))->data == ref_id)) &&
+ (dtar->pchan_name[0]) && STREQ(oldName, dtar->pchan_name) )
+ {
+ is_changed = true;
+ BLI_strncpy(dtar->pchan_name, newName, sizeof(dtar->pchan_name));
}
}
- DRIVER_TARGETS_LOOPER_END;
}
+ DRIVER_TARGETS_LOOPER_END;
}
}
+ return is_changed;
}
/* Fix all RNA-Paths for Actions linked to NLA Strips */
-static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
+static bool nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName,
const char *oldKey, const char *newKey, ListBase *strips, bool verify_paths)
{
NlaStrip *strip;
-
- /* recursively check strips, fixing only actions... */
+ bool is_changed = false;
+ /* Recursively check strips, fixing only actions. */
for (strip = strips->first; strip; strip = strip->next) {
/* fix strip's action */
- if (strip->act)
- fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldKey, newKey, &strip->act->curves, verify_paths);
- /* ignore own F-Curves, since those are local... */
-
- /* check sub-strips (if metas) */
- nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, oldKey, newKey, &strip->strips, verify_paths);
+ if (strip->act != NULL) {
+ is_changed |= fcurves_path_rename_fix(
+ owner_id, prefix, oldName, newName, oldKey, newKey, &strip->act->curves, verify_paths);
+ }
+ /* Ignore own F-Curves, since those are local. */
+ /* Check sub-strips (if metas) */
+ is_changed |= nlastrips_path_rename_fix(
+ owner_id, prefix, oldName, newName, oldKey, newKey, &strip->strips, verify_paths);
}
+ return is_changed;
}
/* Rename Sub-ID Entities in RNA Paths ----------------------- */
@@ -811,7 +817,7 @@ char *BKE_animsys_fix_rna_path_rename(ID *owner_id, char *old_path, const char *
/* if no action, no need to proceed */
if (ELEM(NULL, owner_id, old_path)) {
- if (G.debug & G_DEBUG) printf("%s: early abort\n", __func__);
+ if (G.debug & G_DEBUG) CLOG_WARN(&LOG, "early abort");
return old_path;
}
@@ -898,14 +904,14 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons
{
NlaTrack *nlt;
char *oldN, *newN;
-
- /* if no AnimData, no need to proceed */
- if (ELEM(NULL, owner_id, adt))
+ /* If no AnimData, no need to proceed. */
+ if (ELEM(NULL, owner_id, adt)) {
return;
-
- /* Name sanitation logic - shared with BKE_action_fix_paths_rename() */
+ }
+ bool is_self_changed = false;
+ /* Name sanitation logic - shared with BKE_action_fix_paths_rename(). */
if ((oldName != NULL) && (newName != NULL)) {
- /* pad the names with [" "] so that only exact matches are made */
+ /* Pad the names with [" "] so that only exact matches are made. */
const size_t name_old_len = strlen(oldName);
const size_t name_new_len = strlen(newName);
char *name_old_esc = BLI_array_alloca(name_old_esc, (name_old_len * 2) + 1);
@@ -920,20 +926,33 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons
oldN = BLI_sprintfN("[%d]", oldSubscript);
newN = BLI_sprintfN("[%d]", newSubscript);
}
-
- /* Active action and temp action */
- if (adt->action)
- fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->action->curves, verify_paths);
- if (adt->tmpact)
- fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->tmpact->curves, verify_paths);
-
+ /* Active action and temp action. */
+ if (adt->action != NULL) {
+ if (fcurves_path_rename_fix(owner_id, prefix, oldName, newName,
+ oldN, newN, &adt->action->curves, verify_paths))
+ {
+ DEG_id_tag_update(&adt->action->id, ID_RECALC_COPY_ON_WRITE);
+ }
+ }
+ if (adt->tmpact) {
+ if (fcurves_path_rename_fix(owner_id, prefix, oldName, newName,
+ oldN, newN, &adt->tmpact->curves, verify_paths))
+ {
+ DEG_id_tag_update(&adt->tmpact->id, ID_RECALC_COPY_ON_WRITE);
+ }
+ }
/* Drivers - Drivers are really F-Curves */
- drivers_path_rename_fix(owner_id, ref_id, prefix, oldName, newName, oldN, newN, &adt->drivers, verify_paths);
-
+ is_self_changed |= drivers_path_rename_fix(
+ owner_id, ref_id, prefix, oldName, newName, oldN, newN, &adt->drivers, verify_paths);
/* NLA Data - Animation Data for Strips */
- for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next)
- nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &nlt->strips, verify_paths);
-
+ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
+ is_self_changed |= nlastrips_path_rename_fix(
+ owner_id, prefix, oldName, newName, oldN, newN, &nlt->strips, verify_paths);
+ }
+ /* Tag owner ID if it */
+ if (is_self_changed) {
+ DEG_id_tag_update(owner_id, ID_RECALC_COPY_ON_WRITE);
+ }
/* free the temp names */
MEM_freeN(oldN);
MEM_freeN(newN);
@@ -1069,6 +1088,15 @@ static void adt_apply_all_fcurves_cb(ID *id, AnimData *adt, void *wrapper_data)
}
}
+void BKE_fcurves_id_cb(ID *id, ID_FCurve_Edit_Callback func, void *user_data)
+{
+ AnimData *adt = BKE_animdata_from_id(id);
+ if (adt != NULL) {
+ AllFCurvesCbWrapper wrapper = {func, user_data};
+ adt_apply_all_fcurves_cb(id, adt, &wrapper);
+ }
+}
+
/* apply the given callback function on all F-Curves attached to data in main database */
void BKE_fcurves_main_cb(Main *bmain, ID_FCurve_Edit_Callback func, void *user_data)
{
@@ -1107,64 +1135,64 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use
} (void)0
/* nodes */
- ANIMDATA_IDS_CB(bmain->nodetree.first);
+ ANIMDATA_IDS_CB(bmain->nodetrees.first);
/* textures */
- ANIMDATA_NODETREE_IDS_CB(bmain->tex.first, Tex);
+ ANIMDATA_NODETREE_IDS_CB(bmain->textures.first, Tex);
- /* lamps */
- ANIMDATA_NODETREE_IDS_CB(bmain->lamp.first, Lamp);
+ /* lights */
+ ANIMDATA_NODETREE_IDS_CB(bmain->lights.first, Light);
/* materials */
- ANIMDATA_NODETREE_IDS_CB(bmain->mat.first, Material);
+ ANIMDATA_NODETREE_IDS_CB(bmain->materials.first, Material);
/* cameras */
- ANIMDATA_IDS_CB(bmain->camera.first);
+ ANIMDATA_IDS_CB(bmain->cameras.first);
/* shapekeys */
- ANIMDATA_IDS_CB(bmain->key.first);
+ ANIMDATA_IDS_CB(bmain->shapekeys.first);
/* metaballs */
- ANIMDATA_IDS_CB(bmain->mball.first);
+ ANIMDATA_IDS_CB(bmain->metaballs.first);
/* curves */
- ANIMDATA_IDS_CB(bmain->curve.first);
+ ANIMDATA_IDS_CB(bmain->curves.first);
/* armatures */
- ANIMDATA_IDS_CB(bmain->armature.first);
+ ANIMDATA_IDS_CB(bmain->armatures.first);
/* lattices */
- ANIMDATA_IDS_CB(bmain->latt.first);
+ ANIMDATA_IDS_CB(bmain->lattices.first);
/* meshes */
- ANIMDATA_IDS_CB(bmain->mesh.first);
+ ANIMDATA_IDS_CB(bmain->meshes.first);
/* particles */
- ANIMDATA_IDS_CB(bmain->particle.first);
+ ANIMDATA_IDS_CB(bmain->particles.first);
/* speakers */
- ANIMDATA_IDS_CB(bmain->speaker.first);
+ ANIMDATA_IDS_CB(bmain->speakers.first);
/* movie clips */
- ANIMDATA_IDS_CB(bmain->movieclip.first);
+ ANIMDATA_IDS_CB(bmain->movieclips.first);
/* objects */
- ANIMDATA_IDS_CB(bmain->object.first);
+ ANIMDATA_IDS_CB(bmain->objects.first);
/* masks */
- ANIMDATA_IDS_CB(bmain->mask.first);
+ ANIMDATA_IDS_CB(bmain->masks.first);
/* worlds */
- ANIMDATA_NODETREE_IDS_CB(bmain->world.first, World);
+ ANIMDATA_NODETREE_IDS_CB(bmain->worlds.first, World);
/* scenes */
- ANIMDATA_NODETREE_IDS_CB(bmain->scene.first, Scene);
+ ANIMDATA_NODETREE_IDS_CB(bmain->scenes.first, Scene);
/* line styles */
- ANIMDATA_IDS_CB(bmain->linestyle.first);
+ ANIMDATA_IDS_CB(bmain->linestyles.first);
/* grease pencil */
- ANIMDATA_IDS_CB(bmain->gpencil.first);
+ ANIMDATA_IDS_CB(bmain->gpencils.first);
/* palettes */
ANIMDATA_IDS_CB(bmain->palettes.first);
@@ -1206,67 +1234,67 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha
} (void)0
/* nodes */
- RENAMEFIX_ANIM_IDS(bmain->nodetree.first);
+ RENAMEFIX_ANIM_IDS(bmain->nodetrees.first);
/* textures */
- RENAMEFIX_ANIM_NODETREE_IDS(bmain->tex.first, Tex);
+ RENAMEFIX_ANIM_NODETREE_IDS(bmain->textures.first, Tex);
- /* lamps */
- RENAMEFIX_ANIM_NODETREE_IDS(bmain->lamp.first, Lamp);
+ /* lights */
+ RENAMEFIX_ANIM_NODETREE_IDS(bmain->lights.first, Light);
/* materials */
- RENAMEFIX_ANIM_NODETREE_IDS(bmain->mat.first, Material);
+ RENAMEFIX_ANIM_NODETREE_IDS(bmain->materials.first, Material);
/* cameras */
- RENAMEFIX_ANIM_IDS(bmain->camera.first);
+ RENAMEFIX_ANIM_IDS(bmain->cameras.first);
/* shapekeys */
- RENAMEFIX_ANIM_IDS(bmain->key.first);
+ RENAMEFIX_ANIM_IDS(bmain->shapekeys.first);
/* metaballs */
- RENAMEFIX_ANIM_IDS(bmain->mball.first);
+ RENAMEFIX_ANIM_IDS(bmain->metaballs.first);
/* curves */
- RENAMEFIX_ANIM_IDS(bmain->curve.first);
+ RENAMEFIX_ANIM_IDS(bmain->curves.first);
/* armatures */
- RENAMEFIX_ANIM_IDS(bmain->armature.first);
+ RENAMEFIX_ANIM_IDS(bmain->armatures.first);
/* lattices */
- RENAMEFIX_ANIM_IDS(bmain->latt.first);
+ RENAMEFIX_ANIM_IDS(bmain->lattices.first);
/* meshes */
- RENAMEFIX_ANIM_IDS(bmain->mesh.first);
+ RENAMEFIX_ANIM_IDS(bmain->meshes.first);
/* particles */
- RENAMEFIX_ANIM_IDS(bmain->particle.first);
+ RENAMEFIX_ANIM_IDS(bmain->particles.first);
/* speakers */
- RENAMEFIX_ANIM_IDS(bmain->speaker.first);
+ RENAMEFIX_ANIM_IDS(bmain->speakers.first);
/* movie clips */
- RENAMEFIX_ANIM_IDS(bmain->movieclip.first);
+ RENAMEFIX_ANIM_IDS(bmain->movieclips.first);
/* objects */
- RENAMEFIX_ANIM_IDS(bmain->object.first);
+ RENAMEFIX_ANIM_IDS(bmain->objects.first);
/* masks */
- RENAMEFIX_ANIM_IDS(bmain->mask.first);
+ RENAMEFIX_ANIM_IDS(bmain->masks.first);
/* worlds */
- RENAMEFIX_ANIM_NODETREE_IDS(bmain->world.first, World);
+ RENAMEFIX_ANIM_NODETREE_IDS(bmain->worlds.first, World);
/* linestyles */
- RENAMEFIX_ANIM_IDS(bmain->linestyle.first);
+ RENAMEFIX_ANIM_IDS(bmain->linestyles.first);
/* grease pencil */
- RENAMEFIX_ANIM_IDS(bmain->gpencil.first);
+ RENAMEFIX_ANIM_IDS(bmain->gpencils.first);
/* cache files */
RENAMEFIX_ANIM_IDS(bmain->cachefiles.first);
/* scenes */
- RENAMEFIX_ANIM_NODETREE_IDS(bmain->scene.first, Scene);
+ RENAMEFIX_ANIM_NODETREE_IDS(bmain->scenes.first, Scene);
}
/* *********************************** */
@@ -1355,20 +1383,20 @@ KS_Path *BKE_keyingset_add_path(KeyingSet *ks, ID *id, const char group_name[],
/* sanity checks */
if (ELEM(NULL, ks, rna_path)) {
- printf("ERROR: no Keying Set and/or RNA Path to add path with\n");
+ CLOG_ERROR(&LOG, "no Keying Set and/or RNA Path to add path with");
return NULL;
}
/* ID is required for all types of KeyingSets */
if (id == NULL) {
- printf("ERROR: No ID provided for Keying Set Path\n");
+ CLOG_ERROR(&LOG, "No ID provided for Keying Set Path");
return NULL;
}
/* don't add if there is already a matching KS_Path in the KeyingSet */
if (BKE_keyingset_find_path(ks, id, group_name, rna_path, array_index, groupmode)) {
if (G.debug & G_DEBUG)
- printf("ERROR: destination already exists in Keying Set\n");
+ CLOG_ERROR(&LOG, "destination already exists in Keying Set");
return NULL;
}
@@ -1491,9 +1519,9 @@ static bool animsys_store_rna_setting(
if (array_len && array_index >= array_len) {
if (G.debug & G_DEBUG) {
- printf("Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d\n",
- (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
- path, array_index, array_len - 1);
+ CLOG_WARN(&LOG, "Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d",
+ (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
+ path, array_index, array_len - 1);
}
}
else {
@@ -1507,9 +1535,9 @@ static bool animsys_store_rna_setting(
/* XXX don't tag as failed yet though, as there are some legit situations (Action Constraint)
* where some channels will not exist, but shouldn't lock up Action */
if (G.debug & G_DEBUG) {
- printf("Animato: Invalid path. ID = '%s', '%s[%d]'\n",
- (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
- path, array_index);
+ CLOG_WARN(&LOG, "Animato: Invalid path. ID = '%s', '%s[%d]'",
+ (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
+ path, array_index);
}
}
}
@@ -1742,7 +1770,7 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime
if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0) {
/* check if driver itself is tagged for recalculation */
/* XXX driver recalc flag is not set yet by depsgraph! */
- if ((driver) && !(driver->flag & DRIVER_FLAG_INVALID) /*&& (driver->flag & DRIVER_FLAG_RECALC)*/) {
+ if ((driver) && !(driver->flag & DRIVER_FLAG_INVALID)) {
/* evaluate this using values set already in other places
* NOTE: for 'layering' option later on, we should check if we should remove old value before adding
* new to only be done when drivers only changed */
@@ -1753,9 +1781,6 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime
ok = animsys_write_rna_setting(&anim_rna, curval);
}
- /* clear recalc flag */
- driver->flag &= ~DRIVER_FLAG_RECALC;
-
/* set error-flag if evaluation failed */
if (ok == 0)
driver->flag |= DRIVER_FLAG_INVALID;
@@ -1888,11 +1913,18 @@ static void nlastrip_evaluate_controls(Depsgraph *depsgraph, NlaStrip *strip, fl
* - we do this after the F-Curves have been evaluated to override the effects of those
* in case the override has been turned off.
*/
- if ((strip->flag & NLASTRIP_FLAG_USR_TIME) == 0)
- strip->strip_time = nlastrip_get_frame(strip, ctime, NLATIME_CONVERT_EVAL);
if ((strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) == 0)
strip->influence = nlastrip_get_influence(strip, ctime);
+ /* Bypass evaluation time computation if time mapping is disabled. */
+ if ((strip->flag & NLASTRIP_FLAG_NO_TIME_MAP) != 0) {
+ strip->strip_time = ctime;
+ return;
+ }
+
+ if ((strip->flag & NLASTRIP_FLAG_USR_TIME) == 0)
+ strip->strip_time = nlastrip_get_frame(strip, ctime, NLATIME_CONVERT_EVAL);
+
/* if user can control the evaluation time (using F-Curves), consider the option which allows this time to be clamped
* to lie within extents of the action-clip, so that a steady changing rate of progress through several cycles of the clip
* can be achieved easily
@@ -1912,7 +1944,7 @@ NlaEvalStrip *nlastrips_ctime_get_strip(Depsgraph *depsgraph, ListBase *list, Li
/* loop over strips, checking if they fall within the range */
for (strip = strips->first; strip; strip = strip->next) {
/* check if current time occurs within this strip */
- if (IN_RANGE_INCL(ctime, strip->start, strip->end)) {
+ if (IN_RANGE_INCL(ctime, strip->start, strip->end) || (strip->flag & NLASTRIP_FLAG_NO_TIME_MAP)) {
/* this strip is active, so try to use it */
estrip = strip;
side = NES_TIME_WITHIN;
@@ -2020,131 +2052,407 @@ NlaEvalStrip *nlastrips_ctime_get_strip(Depsgraph *depsgraph, ListBase *list, Li
/* ---------------------- */
-/* find an NlaEvalChannel that matches the given criteria
- * - ptr and prop are the RNA data to find a match for
- */
-static NlaEvalChannel *nlaevalchan_find_match(ListBase *channels, const PathResolvedRNA *prna)
+/* Initialize a valid mask, allocating memory if necessary. */
+static void nlavalidmask_init(NlaValidMask *mask, int bits)
{
- NlaEvalChannel *nec;
+ if (BLI_BITMAP_SIZE(bits) > sizeof(mask->buffer)) {
+ mask->ptr = BLI_BITMAP_NEW(bits, "NlaValidMask");
+ }
+ else {
+ mask->ptr = mask->buffer;
+ }
+}
- /* sanity check */
- if (channels == NULL)
- return NULL;
+/* Free allocated memory for the mask. */
+static void nlavalidmask_free(NlaValidMask *mask)
+{
+ if (mask->ptr != mask->buffer) {
+ MEM_freeN(mask->ptr);
+ }
+}
- /* loop through existing channels, checking for a channel which affects the same property */
- for (nec = channels->first; nec; nec = nec->next) {
- /* - comparing the PointerRNA's is done by comparing the pointers
- * to the actual struct the property resides in, since that all the
- * other data stored in PointerRNA cannot allow us to definitively
- * identify the data
- */
- if ((nec->rna.ptr.data == prna->ptr.data) && (nec->rna.prop == prna->prop) && ELEM(nec->rna.prop_index, -1, prna->prop_index))
- return nec;
+/* ---------------------- */
+
+/* Hashing functions for NlaEvalChannelKey. */
+static uint nlaevalchan_keyhash(const void *ptr)
+{
+ const NlaEvalChannelKey *key = ptr;
+ uint hash = BLI_ghashutil_ptrhash(key->ptr.data);
+ return hash ^ BLI_ghashutil_ptrhash(key->prop);
+}
+
+static bool nlaevalchan_keycmp(const void *a, const void *b)
+{
+ const NlaEvalChannelKey *A = a;
+ const NlaEvalChannelKey *B = b;
+
+ return ((A->ptr.data != B->ptr.data) ||
+ (A->prop != B->prop));
+}
+
+/* ---------------------- */
+
+/* Allocate a new blending value snapshot for the channel. */
+static NlaEvalChannelSnapshot *nlaevalchan_snapshot_new(NlaEvalChannel *nec)
+{
+ int length = nec->base_snapshot.length;
+
+ size_t byte_size = sizeof(NlaEvalChannelSnapshot) + sizeof(float) * length;
+ NlaEvalChannelSnapshot *nec_snapshot = MEM_callocN(byte_size, "NlaEvalChannelSnapshot");
+
+ nec_snapshot->channel = nec;
+ nec_snapshot->length = length;
+
+ return nec_snapshot;
+}
+
+/* Free a channel's blending value snapshot. */
+static void nlaevalchan_snapshot_free(NlaEvalChannelSnapshot *nec_snapshot)
+{
+ BLI_assert(!nec_snapshot->is_base);
+
+ MEM_freeN(nec_snapshot);
+}
+
+/* Copy all data in the snapshot. */
+static void nlaevalchan_snapshot_copy(NlaEvalChannelSnapshot *dst, const NlaEvalChannelSnapshot *src)
+{
+ BLI_assert(dst->channel == src->channel);
+
+ memcpy(dst->values, src->values, sizeof(float) * dst->length);
+}
+
+/* ---------------------- */
+
+/* Initialize a blending state snapshot structure. */
+static void nlaeval_snapshot_init(NlaEvalSnapshot *snapshot, NlaEvalData *nlaeval, NlaEvalSnapshot *base)
+{
+ snapshot->base = base;
+ snapshot->size = MAX2(16, nlaeval->num_channels);
+ snapshot->channels = MEM_callocN(sizeof(*snapshot->channels) * snapshot->size, "NlaEvalSnapshot::channels");
+}
+
+/* Retrieve the individual channel snapshot. */
+static NlaEvalChannelSnapshot *nlaeval_snapshot_get(NlaEvalSnapshot *snapshot, int index)
+{
+ return (index < snapshot->size) ? snapshot->channels[index] : NULL;
+}
+
+/* Ensure at least this number of slots exists. */
+static void nlaeval_snapshot_ensure_size(NlaEvalSnapshot *snapshot, int size)
+{
+ if (size > snapshot->size) {
+ snapshot->size *= 2;
+ CLAMP_MIN(snapshot->size, size);
+ CLAMP_MIN(snapshot->size, 16);
+
+ size_t byte_size = sizeof(*snapshot->channels) * snapshot->size;
+ snapshot->channels = MEM_recallocN_id(snapshot->channels, byte_size, "NlaEvalSnapshot::channels");
}
+}
- /* not found */
- return NULL;
+/* Retrieve the address of a slot in the blending state snapshot for this channel (may realloc). */
+static NlaEvalChannelSnapshot **nlaeval_snapshot_ensure_slot(NlaEvalSnapshot *snapshot, NlaEvalChannel *nec)
+{
+ nlaeval_snapshot_ensure_size(snapshot, nec->owner->num_channels);
+ return &snapshot->channels[nec->index];
+}
+
+/* Retrieve the blending snapshot for the specified channel, with fallback to base. */
+static NlaEvalChannelSnapshot *nlaeval_snapshot_find_channel(NlaEvalSnapshot *snapshot, NlaEvalChannel *nec)
+{
+ while (snapshot != NULL) {
+ NlaEvalChannelSnapshot *nec_snapshot = nlaeval_snapshot_get(snapshot, nec->index);
+ if (nec_snapshot != NULL) {
+ return nec_snapshot;
+ }
+ snapshot = snapshot->base;
+ }
+
+ return &nec->base_snapshot;
+}
+
+/* Retrieve or create the channel value snapshot, copying from the other snapshot (or default values) */
+static NlaEvalChannelSnapshot *nlaeval_snapshot_ensure_channel(NlaEvalSnapshot *snapshot, NlaEvalChannel *nec)
+{
+ NlaEvalChannelSnapshot **slot = nlaeval_snapshot_ensure_slot(snapshot, nec);
+
+ if (*slot == NULL) {
+ NlaEvalChannelSnapshot *base_snapshot, *nec_snapshot;
+
+ nec_snapshot = nlaevalchan_snapshot_new(nec);
+ base_snapshot = nlaeval_snapshot_find_channel(snapshot->base, nec);
+
+ nlaevalchan_snapshot_copy(nec_snapshot, base_snapshot);
+
+ *slot = nec_snapshot;
+ }
+
+ return *slot;
+}
+
+/* Free all memory owned by this blending snapshot structure. */
+static void nlaeval_snapshot_free_data(NlaEvalSnapshot *snapshot)
+{
+ if (snapshot->channels != NULL) {
+ for (int i = 0; i < snapshot->size; i++) {
+ NlaEvalChannelSnapshot *nec_snapshot = snapshot->channels[i];
+ if (nec_snapshot != NULL) {
+ nlaevalchan_snapshot_free(nec_snapshot);
+ }
+ }
+
+ MEM_freeN(snapshot->channels);
+ }
+
+ snapshot->base = NULL;
+ snapshot->size = 0;
+ snapshot->channels = NULL;
+}
+
+/* ---------------------- */
+
+/* Free memory owned by this evaluation channel. */
+static void nlaevalchan_free_data(NlaEvalChannel *nec)
+{
+ nlavalidmask_free(&nec->valid);
+
+ if (nec->blend_snapshot != NULL) {
+ nlaevalchan_snapshot_free(nec->blend_snapshot);
+ }
}
-/* initialise default value for NlaEvalChannel, so that it doesn't blend things wrong */
-static float nlaevalchan_init_value(PathResolvedRNA *rna)
+/* Initialize a full NLA evaluation state structure. */
+static void nlaeval_init(NlaEvalData *nlaeval)
{
- PointerRNA *ptr = &rna->ptr;
- PropertyRNA *prop = rna->prop;
- int index = rna->prop_index;
+ memset(nlaeval, 0, sizeof(*nlaeval));
+
+ nlaeval->path_hash = BLI_ghash_str_new("NlaEvalData::path_hash");
+ nlaeval->key_hash = BLI_ghash_new(nlaevalchan_keyhash, nlaevalchan_keycmp, "NlaEvalData::key_hash");
+}
+
+static void nlaeval_free(NlaEvalData *nlaeval)
+{
+ /* Delete base snapshot - its channels are part of NlaEvalChannel and shouldn't be freed. */
+ MEM_SAFE_FREE(nlaeval->base_snapshot.channels);
+
+ /* Delete result snapshot. */
+ nlaeval_snapshot_free_data(&nlaeval->eval_snapshot);
+
+ /* Delete channels. */
+ for (NlaEvalChannel *nec = nlaeval->channels.first; nec; nec = nec->next) {
+ nlaevalchan_free_data(nec);
+ }
+
+ BLI_freelistN(&nlaeval->channels);
+ BLI_ghash_free(nlaeval->path_hash, NULL, NULL);
+ BLI_ghash_free(nlaeval->key_hash, NULL, NULL);
+}
+
+/* ---------------------- */
+
+static int nlaevalchan_validate_index(NlaEvalChannel *nec, int index)
+{
+ if (nec->is_array) {
+ if (index >= 0 && index < nec->base_snapshot.length) {
+ return index;
+ }
+
+ return -1;
+ }
+ else {
+ return 0;
+ }
+}
+
+/* Initialise default values for NlaEvalChannel from the property data. */
+static void nlaevalchan_get_default_values(NlaEvalChannel *nec, float *r_values)
+{
+ PointerRNA *ptr = &nec->key.ptr;
+ PropertyRNA *prop = nec->key.prop;
+ int length = nec->base_snapshot.length;
+
+ /* Use unit quaternion for quaternion properties. */
+ if (nec->mix_mode == NEC_MIX_QUATERNION) {
+ unit_qt(r_values);
+ return;
+ }
+ /* Use all zero for Axis-Angle properties. */
+ if (nec->mix_mode == NEC_MIX_AXIS_ANGLE) {
+ zero_v4(r_values);
+ return;
+ }
/* NOTE: while this doesn't work for all RNA properties as default values aren't in fact
* set properly for most of them, at least the common ones (which also happen to get used
* in NLA strips a lot, e.g. scale) are set correctly.
*/
- switch (RNA_property_type(prop)) {
- case PROP_BOOLEAN:
- if (RNA_property_array_check(prop))
- return (float)RNA_property_boolean_get_default_index(ptr, prop, index);
- else
- return (float)RNA_property_boolean_get_default(ptr, prop);
- case PROP_INT:
- if (RNA_property_array_check(prop))
- return (float)RNA_property_int_get_default_index(ptr, prop, index);
- else
- return (float)RNA_property_int_get_default(ptr, prop);
- case PROP_FLOAT:
- if (RNA_property_array_check(prop))
- return RNA_property_float_get_default_index(ptr, prop, index);
- else
- return RNA_property_float_get_default(ptr, prop);
- case PROP_ENUM:
- return (float)RNA_property_enum_get_default(ptr, prop);
- default:
- return 0.0f;
+ if (RNA_property_array_check(prop)) {
+ BLI_assert(length == RNA_property_array_length(ptr, prop));
+ bool *tmp_bool;
+ int *tmp_int;
+
+ switch (RNA_property_type(prop)) {
+ case PROP_BOOLEAN:
+ tmp_bool = MEM_malloc_arrayN(sizeof(*tmp_bool), length, __func__);
+ RNA_property_boolean_get_default_array(ptr, prop, tmp_bool);
+ for (int i = 0; i < length; i++) {
+ r_values[i] = (float)tmp_bool[i];
+ }
+ MEM_freeN(tmp_bool);
+ break;
+ case PROP_INT:
+ tmp_int = MEM_malloc_arrayN(sizeof(*tmp_int), length, __func__);
+ RNA_property_int_get_default_array(ptr, prop, tmp_int);
+ for (int i = 0; i < length; i++) {
+ r_values[i] = (float)tmp_int[i];
+ }
+ MEM_freeN(tmp_int);
+ break;
+ case PROP_FLOAT:
+ RNA_property_float_get_default_array(ptr, prop, r_values);
+ break;
+ default:
+ memset(r_values, 0, sizeof(float) * length);
+ }
+ }
+ else {
+ BLI_assert(length == 1);
+
+ switch (RNA_property_type(prop)) {
+ case PROP_BOOLEAN:
+ *r_values = (float)RNA_property_boolean_get_default(ptr, prop);
+ break;
+ case PROP_INT:
+ *r_values = (float)RNA_property_int_get_default(ptr, prop);
+ break;
+ case PROP_FLOAT:
+ *r_values = RNA_property_float_get_default(ptr, prop);
+ break;
+ case PROP_ENUM:
+ *r_values = (float)RNA_property_enum_get_default(ptr, prop);
+ break;
+ default:
+ *r_values = 0.0f;
+ }
+ }
+
+ /* Ensure multiplicative properties aren't reset to 0. */
+ if (nec->mix_mode == NEC_MIX_MULTIPLY) {
+ for (int i = 0; i < length; i++) {
+ if (r_values[i] == 0.0f) {
+ r_values[i] = 1.0f;
+ }
+ }
}
}
-/* verify that an appropriate NlaEvalChannel for this F-Curve exists */
-static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, FCurve *fcu, bool *newChan)
+static char nlaevalchan_detect_mix_mode(NlaEvalChannelKey *key, int length)
{
- NlaEvalChannel *nec;
- PathResolvedRNA rna;
+ PropertySubType subtype = RNA_property_subtype(key->prop);
- /* sanity checks */
- if (channels == NULL)
- return NULL;
+ if (subtype == PROP_QUATERNION && length == 4) {
+ return NEC_MIX_QUATERNION;
+ }
+ else if (subtype == PROP_AXISANGLE && length == 4) {
+ return NEC_MIX_AXIS_ANGLE;
+ }
+ else if (RNA_property_flag(key->prop) & PROP_PROPORTIONAL) {
+ return NEC_MIX_MULTIPLY;
+ }
+ else {
+ return NEC_MIX_ADD;
+ }
+}
- /* get RNA pointer+property info from F-Curve for more convenient handling */
- if (!animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &rna)) {
- return NULL;
+/* Verify that an appropriate NlaEvalChannel for this property exists. */
+static NlaEvalChannel *nlaevalchan_verify_key(NlaEvalData *nlaeval, const char *path, NlaEvalChannelKey *key)
+{
+ /* Look it up in the key hash. */
+ NlaEvalChannel **p_key_nec;
+ NlaEvalChannelKey **p_key;
+ bool found_key = BLI_ghash_ensure_p_ex(nlaeval->key_hash, key, (void ***)&p_key, (void ***)&p_key_nec);
+
+ if (found_key) {
+ return *p_key_nec;
}
- /* try to find a match */
- nec = nlaevalchan_find_match(channels, &rna);
+ /* Create the channel. */
+ bool is_array = RNA_property_array_check(key->prop);
+ int length = is_array ? RNA_property_array_length(&key->ptr, key->prop) : 1;
- /* allocate a new struct for this if none found */
- if (nec == NULL) {
- nec = MEM_callocN(sizeof(NlaEvalChannel), "NlaEvalChannel");
- BLI_addtail(channels, nec);
+ NlaEvalChannel *nec = MEM_callocN(sizeof(NlaEvalChannel) + sizeof(float) * length, "NlaEvalChannel");
- /* store property links for writing to the property later */
- nec->rna = rna;
+ /* Initialize the channel. */
+ nec->rna_path = path;
+ nec->key = *key;
- /* store parameters for use with write_orig_anim_rna */
- nec->rna_path = fcu->rna_path;
+ nec->owner = nlaeval;
+ nec->index = nlaeval->num_channels++;
+ nec->is_array = is_array;
- /* initialise value using default value of property [#35856] */
- nec->value = nlaevalchan_init_value(&rna);
- *newChan = true;
- }
- else
- *newChan = false;
+ nec->mix_mode = nlaevalchan_detect_mix_mode(key, length);
+
+ nlavalidmask_init(&nec->valid, length);
+
+ nec->base_snapshot.channel = nec;
+ nec->base_snapshot.length = length;
+ nec->base_snapshot.is_base = true;
+
+ nlaevalchan_get_default_values(nec, nec->base_snapshot.values);
+
+ /* Store channel in data structures. */
+ BLI_addtail(&nlaeval->channels, nec);
+
+ *nlaeval_snapshot_ensure_slot(&nlaeval->base_snapshot, nec) = &nec->base_snapshot;
+
+ *p_key_nec = nec;
+ *p_key = &nec->key;
- /* we can now return */
return nec;
}
-static float nla_blend_value(int blendmode, float old_value, float value, float inf);
-
-/* accumulate (i.e. blend) the given value on to the channel it affects */
-static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, float value, bool newChan)
+/* Verify that an appropriate NlaEvalChannel for this path exists. */
+static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, NlaEvalData *nlaeval, const char *path)
{
- NlaStrip *strip = nes->strip;
- short blendmode = strip->blendmode;
- float inf = strip->influence;
+ if (path == NULL) {
+ return NULL;
+ }
- /* for replace blend mode, and if this is the first strip,
- * just replace the value regardless of the influence */
- if (newChan && blendmode == NLASTRIP_MODE_REPLACE) {
- nec->value = value;
- return;
+ /* Lookup the path in the path based hash. */
+ NlaEvalChannel **p_path_nec;
+ bool found_path = BLI_ghash_ensure_p(nlaeval->path_hash, (void *)path, (void ***)&p_path_nec);
+
+ if (found_path) {
+ return *p_path_nec;
}
- /* if this is being performed as part of transition evaluation, incorporate
- * an additional weighting factor for the influence
- */
- if (nes->strip_mode == NES_TIME_TRANSITION_END)
- inf *= nes->strip_time;
+ /* Resolve the property and look it up in the key hash. */
+ NlaEvalChannelKey key;
+
+ if (!RNA_path_resolve_property(ptr, path, &key.ptr, &key.prop)) {
+ /* Report failure to resolve the path. */
+ if (G.debug & G_DEBUG) {
+ CLOG_WARN(&LOG, "Animato: Invalid path. ID = '%s', '%s'",
+ (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", path);
+ }
+
+ /* Cache NULL result. */
+ *p_path_nec = NULL;
+ return NULL;
+ }
+
+ NlaEvalChannel *nec = nlaevalchan_verify_key(nlaeval, path, &key);
+
+ if (nec->rna_path == NULL) {
+ nec->rna_path = path;
+ }
- nec->value = nla_blend_value(blendmode, nec->value, value, inf);
+ return *p_path_nec = nec;
}
+/* ---------------------- */
+
/* accumulate the old and new values of a channel according to mode and influence */
static float nla_blend_value(int blendmode, float old_value, float value, float inf)
{
@@ -2170,6 +2478,10 @@ static float nla_blend_value(int blendmode, float old_value, float value, float
*/
return inf * (old_value * value) + (1 - inf) * old_value;
+ case NLASTRIP_MODE_COMBINE:
+ BLI_assert(!"combine mode");
+ ATTR_FALLTHROUGH;
+
case NLASTRIP_MODE_REPLACE:
default: /* TODO: do we really want to blend by default? it seems more uses might prefer add... */
/* do linear interpolation
@@ -2180,6 +2492,33 @@ static float nla_blend_value(int blendmode, float old_value, float value, float
}
}
+/* accumulate the old and new values of a channel according to mode and influence */
+static float nla_combine_value(int mix_mode, float base_value, float old_value, float value, float inf)
+{
+ /* optimisation: no need to try applying if there is no influence */
+ if (IS_EQF(inf, 0.0f)) {
+ return old_value;
+ }
+
+ /* perform blending */
+ switch (mix_mode) {
+ case NEC_MIX_ADD:
+ case NEC_MIX_AXIS_ANGLE:
+ return old_value + (value - base_value) * inf;
+
+ case NEC_MIX_MULTIPLY:
+ if (base_value == 0.0f) {
+ base_value = 1.0f;
+ }
+ return old_value * powf(value / base_value, inf);
+
+ case NEC_MIX_QUATERNION:
+ default:
+ BLI_assert(!"invalid mix mode");
+ return old_value;
+ }
+}
+
/* compute the value that would blend to the desired target value using nla_blend_value */
static bool nla_invert_blend_value(int blend_mode, float old_value, float target_value, float influence, float *r_value)
{
@@ -2207,6 +2546,10 @@ static bool nla_invert_blend_value(int blend_mode, float old_value, float target
return true;
}
+ case NLASTRIP_MODE_COMBINE:
+ BLI_assert(!"combine mode");
+ ATTR_FALLTHROUGH;
+
case NLASTRIP_MODE_REPLACE:
default:
*r_value = (target_value - old_value) / influence + old_value;
@@ -2214,36 +2557,206 @@ static bool nla_invert_blend_value(int blend_mode, float old_value, float target
}
}
-/* accumulate the results of a temporary buffer with the results of the full-buffer */
-static void nlaevalchan_buffers_accumulate(ListBase *channels, ListBase *tmp_buffer, NlaEvalStrip *nes)
+/* compute the value that would blend to the desired target value using nla_combine_value */
+static bool nla_invert_combine_value(int mix_mode, float base_value, float old_value, float target_value, float influence, float *r_value)
{
- NlaEvalChannel *nec, *necn, *necd;
+ switch (mix_mode) {
+ case NEC_MIX_ADD:
+ case NEC_MIX_AXIS_ANGLE:
+ *r_value = base_value + (target_value - old_value) / influence;
+ return true;
- /* optimize - abort if no channels */
- if (BLI_listbase_is_empty(tmp_buffer))
- return;
+ case NEC_MIX_MULTIPLY:
+ if (base_value == 0.0f) {
+ base_value = 1.0f;
+ }
+ if (old_value == 0.0f) {
+ /* Resolve 0/0 to 1. */
+ if (target_value == 0.0f) {
+ *r_value = base_value;
+ return true;
+ }
+ /* Division by zero. */
+ return false;
+ }
+ else {
+ *r_value = base_value * powf(target_value / old_value, 1.0f / influence);
+ return true;
+ }
- /* accumulate results in tmp_channels buffer to the accumulation buffer */
- for (nec = tmp_buffer->first; nec; nec = necn) {
- /* get pointer to next channel in case we remove the current channel from the temp-buffer */
- necn = nec->next;
+ case NEC_MIX_QUATERNION:
+ default:
+ BLI_assert(!"invalid mix mode");
+ return false;
+ }
+}
- /* try to find an existing matching channel for this setting in the accumulation buffer */
- necd = nlaevalchan_find_match(channels, &nec->rna);
+/* accumulate quaternion channels for Combine mode according to influence */
+static void nla_combine_quaternion(const float old_values[4], const float values[4], float influence, float result[4])
+{
+ float tmp_old[4], tmp_new[4];
- /* if there was a matching channel already in the buffer, accumulate to it,
- * otherwise, add the current channel to the buffer for efficiency
- */
- if (necd)
- nlaevalchan_accumulate(necd, nes, 0, nec->value);
+ normalize_qt_qt(tmp_old, old_values);
+ normalize_qt_qt(tmp_new, values);
+
+ pow_qt_fl_normalized(tmp_new, influence);
+ mul_qt_qtqt(result, tmp_old, tmp_new);
+}
+
+/* invert accumulation of quaternion channels for Combine mode according to influence */
+static void nla_invert_combine_quaternion(const float old_values[4], const float values[4], float influence, float result[4])
+{
+ float tmp_old[4], tmp_new[4];
+
+ normalize_qt_qt(tmp_old, old_values);
+ normalize_qt_qt(tmp_new, values);
+ invert_qt_normalized(tmp_old);
+
+ mul_qt_qtqt(result, tmp_old, tmp_new);
+ pow_qt_fl_normalized(result, 1.0f / influence);
+}
+
+/* Data about the current blend mode. */
+typedef struct NlaBlendData {
+ NlaEvalSnapshot *snapshot;
+ int mode;
+ float influence;
+
+ NlaEvalChannel *blend_queue;
+} NlaBlendData;
+
+/* Queue the channel for deferred blending. */
+static NlaEvalChannelSnapshot *nlaevalchan_queue_blend(NlaBlendData *blend, NlaEvalChannel *nec)
+{
+ if (!nec->in_blend) {
+ if (nec->blend_snapshot == NULL) {
+ nec->blend_snapshot = nlaevalchan_snapshot_new(nec);
+ }
+
+ nec->in_blend = true;
+ nlaevalchan_snapshot_copy(nec->blend_snapshot, &nec->base_snapshot);
+
+ nec->next_blend = blend->blend_queue;
+ blend->blend_queue = nec;
+ }
+
+ return nec->blend_snapshot;
+}
+
+/* Accumulate (i.e. blend) the given value on to the channel it affects. */
+static bool nlaeval_blend_value(NlaBlendData *blend, NlaEvalChannel *nec, int array_index, float value)
+{
+ if (nec == NULL) {
+ return false;
+ }
+
+ int index = nlaevalchan_validate_index(nec, array_index);
+
+ if (index < 0) {
+ if (G.debug & G_DEBUG) {
+ ID *id = nec->key.ptr.id.data;
+ CLOG_WARN(&LOG, "Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d",
+ id ? (id->name + 2) : "<No ID>", nec->rna_path, array_index, nec->base_snapshot.length);
+ }
+
+ return false;
+ }
+
+ if (nec->mix_mode == NEC_MIX_QUATERNION) {
+ /* For quaternion properties, always output all sub-channels. */
+ BLI_bitmap_set_all(nec->valid.ptr, true, 4);
+ }
+ else {
+ BLI_BITMAP_ENABLE(nec->valid.ptr, index);
+ }
+
+ NlaEvalChannelSnapshot *nec_snapshot = nlaeval_snapshot_ensure_channel(blend->snapshot, nec);
+ float *p_value = &nec_snapshot->values[index];
+
+ if (blend->mode == NLASTRIP_MODE_COMBINE) {
+ /* Quaternion blending is deferred until all sub-channel values are known. */
+ if (nec->mix_mode == NEC_MIX_QUATERNION) {
+ NlaEvalChannelSnapshot *blend_snapshot = nlaevalchan_queue_blend(blend, nec);
+
+ blend_snapshot->values[index] = value;
+ }
+ else {
+ float base_value = nec->base_snapshot.values[index];
+
+ *p_value = nla_combine_value(nec->mix_mode, base_value, *p_value, value, blend->influence);
+ }
+ }
+ else {
+ *p_value = nla_blend_value(blend->mode, *p_value, value, blend->influence);
+ }
+
+ return true;
+}
+
+/* Finish deferred quaternion blending. */
+static void nlaeval_blend_flush(NlaBlendData *blend)
+{
+ NlaEvalChannel *nec;
+
+ while ((nec = blend->blend_queue)) {
+ blend->blend_queue = nec->next_blend;
+ nec->in_blend = false;
+
+ NlaEvalChannelSnapshot *nec_snapshot = nlaeval_snapshot_ensure_channel(blend->snapshot, nec);
+ NlaEvalChannelSnapshot *blend_snapshot = nec->blend_snapshot;
+
+ if (nec->mix_mode == NEC_MIX_QUATERNION) {
+ nla_combine_quaternion(nec_snapshot->values, blend_snapshot->values, blend->influence, nec_snapshot->values);
+ }
else {
- BLI_remlink(tmp_buffer, nec);
- BLI_addtail(channels, nec);
+ BLI_assert(!"mix quaternion");
}
}
+}
+
+/* Blend the specified snapshots into the target, and free the input snapshots. */
+static void nlaeval_snapshot_mix_and_free(NlaEvalData *nlaeval, NlaEvalSnapshot *out, NlaEvalSnapshot *in1, NlaEvalSnapshot *in2, float alpha)
+{
+ BLI_assert(in1->base == out && in2->base == out);
+
+ nlaeval_snapshot_ensure_size(out, nlaeval->num_channels);
- /* free temp-channels that haven't been assimilated into the buffer */
- BLI_freelistN(tmp_buffer);
+ for (int i = 0; i < nlaeval->num_channels; i++) {
+ NlaEvalChannelSnapshot *c_in1 = nlaeval_snapshot_get(in1, i);
+ NlaEvalChannelSnapshot *c_in2 = nlaeval_snapshot_get(in2, i);
+
+ if (c_in1 || c_in2) {
+ NlaEvalChannelSnapshot *c_out = out->channels[i];
+
+ /* Steal the entry from one of the input snapshots. */
+ if (c_out == NULL) {
+ if (c_in1 != NULL) {
+ c_out = c_in1;
+ in1->channels[i] = NULL;
+ }
+ else {
+ c_out = c_in2;
+ in2->channels[i] = NULL;
+ }
+ }
+
+ if (c_in1 == NULL) {
+ c_in1 = nlaeval_snapshot_find_channel(in1->base, c_out->channel);
+ }
+ if (c_in2 == NULL) {
+ c_in2 = nlaeval_snapshot_find_channel(in2->base, c_out->channel);
+ }
+
+ out->channels[i] = c_out;
+
+ for (int j = 0; j < c_out->length; j++) {
+ c_out->values[j] = c_in1->values[j] * (1.0f - alpha) + c_in2->values[j] * alpha;
+ }
+ }
+ }
+
+ nlaeval_snapshot_free_data(in1);
+ nlaeval_snapshot_free_data(in2);
}
/* ---------------------- */
@@ -2304,7 +2817,7 @@ static void nlaeval_fmodifiers_split_stacks(ListBase *list1, ListBase *list2)
/* ---------------------- */
/* evaluate action-clip strip */
-static void nlastrip_evaluate_actionclip(PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes)
+static void nlastrip_evaluate_actionclip(PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot)
{
FModifierStackStorage *storage;
ListBase tmp_modifiers = {NULL, NULL};
@@ -2317,7 +2830,7 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, ListBase *channels, Li
return;
if (strip->act == NULL) {
- printf("NLA-Strip Eval Error: Strip '%s' has no Action\n", strip->name);
+ CLOG_ERROR(&LOG, "NLA-Strip Eval Error: Strip '%s' has no Action", strip->name);
return;
}
@@ -2330,11 +2843,15 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, ListBase *channels, Li
storage = evaluate_fmodifiers_storage_new(&tmp_modifiers);
evaltime = evaluate_time_fmodifiers(storage, &tmp_modifiers, NULL, 0.0f, strip->strip_time);
+ NlaBlendData blend = {
+ .snapshot = snapshot,
+ .mode = strip->blendmode,
+ .influence = strip->influence,
+ };
+
/* evaluate all the F-Curves in the action, saving the relevant pointers to data that will need to be used */
for (fcu = strip->act->curves.first; fcu; fcu = fcu->next) {
- NlaEvalChannel *nec;
float value = 0.0f;
- bool newChan;
/* check if this curve should be skipped */
if (fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED))
@@ -2352,15 +2869,16 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, ListBase *channels, Li
*/
evaluate_value_fmodifiers(storage, &tmp_modifiers, fcu, &value, strip->strip_time);
-
/* get an NLA evaluation channel to work with, and accumulate the evaluated value with the value(s)
* stored in this channel if it has been used already
*/
- nec = nlaevalchan_verify(ptr, channels, fcu, &newChan);
- if (nec)
- nlaevalchan_accumulate(nec, nes, value, newChan);
+ NlaEvalChannel *nec = nlaevalchan_verify(ptr, channels, fcu->rna_path);
+
+ nlaeval_blend_value(&blend, nec, fcu->array_index, value);
}
+ nlaeval_blend_flush(&blend);
+
/* free temporary storage */
evaluate_fmodifiers_storage_free(storage);
@@ -2370,10 +2888,10 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, ListBase *channels, Li
/* evaluate transition strip */
static void nlastrip_evaluate_transition(
- Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes)
+ Depsgraph *depsgraph, PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot)
{
- ListBase tmp_channels = {NULL, NULL};
ListBase tmp_modifiers = {NULL, NULL};
+ NlaEvalSnapshot snapshot1, snapshot2;
NlaEvalStrip tmp_nes;
NlaStrip *s1, *s2;
@@ -2410,16 +2928,17 @@ static void nlastrip_evaluate_transition(
/* first strip */
tmp_nes.strip_mode = NES_TIME_TRANSITION_START;
tmp_nes.strip = s1;
- nlastrip_evaluate(depsgraph, ptr, &tmp_channels, &tmp_modifiers, &tmp_nes);
+ nlaeval_snapshot_init(&snapshot1, channels, snapshot);
+ nlastrip_evaluate(depsgraph, ptr, channels, &tmp_modifiers, &tmp_nes, &snapshot1);
/* second strip */
tmp_nes.strip_mode = NES_TIME_TRANSITION_END;
tmp_nes.strip = s2;
- nlastrip_evaluate(depsgraph, ptr, &tmp_channels, &tmp_modifiers, &tmp_nes);
-
+ nlaeval_snapshot_init(&snapshot2, channels, snapshot);
+ nlastrip_evaluate(depsgraph, ptr, channels, &tmp_modifiers, &tmp_nes, &snapshot2);
/* accumulate temp-buffer and full-buffer, using the 'real' strip */
- nlaevalchan_buffers_accumulate(channels, &tmp_channels, nes);
+ nlaeval_snapshot_mix_and_free(channels, snapshot, &snapshot1, &snapshot2, nes->strip_time);
/* unlink this strip's modifiers from the parent's modifiers again */
nlaeval_fmodifiers_split_stacks(&nes->strip->modifiers, modifiers);
@@ -2427,7 +2946,7 @@ static void nlastrip_evaluate_transition(
/* evaluate meta-strip */
static void nlastrip_evaluate_meta(
- Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes)
+ Depsgraph *depsgraph, PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot)
{
ListBase tmp_modifiers = {NULL, NULL};
NlaStrip *strip = nes->strip;
@@ -2453,7 +2972,7 @@ static void nlastrip_evaluate_meta(
* - there's no need to use a temporary buffer (as it causes issues [T40082])
*/
if (tmp_nes) {
- nlastrip_evaluate(depsgraph, ptr, channels, &tmp_modifiers, tmp_nes);
+ nlastrip_evaluate(depsgraph, ptr, channels, &tmp_modifiers, tmp_nes, snapshot);
/* free temp eval-strip */
MEM_freeN(tmp_nes);
@@ -2464,7 +2983,7 @@ static void nlastrip_evaluate_meta(
}
/* evaluates the given evaluation strip */
-void nlastrip_evaluate(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes)
+void nlastrip_evaluate(Depsgraph *depsgraph, PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot)
{
NlaStrip *strip = nes->strip;
@@ -2479,13 +2998,13 @@ void nlastrip_evaluate(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels
/* actions to take depend on the type of strip */
switch (strip->type) {
case NLASTRIP_TYPE_CLIP: /* action-clip */
- nlastrip_evaluate_actionclip(ptr, channels, modifiers, nes);
+ nlastrip_evaluate_actionclip(ptr, channels, modifiers, nes, snapshot);
break;
case NLASTRIP_TYPE_TRANSITION: /* transition */
- nlastrip_evaluate_transition(depsgraph, ptr, channels, modifiers, nes);
+ nlastrip_evaluate_transition(depsgraph, ptr, channels, modifiers, nes, snapshot);
break;
case NLASTRIP_TYPE_META: /* meta */
- nlastrip_evaluate_meta(depsgraph, ptr, channels, modifiers, nes);
+ nlastrip_evaluate_meta(depsgraph, ptr, channels, modifiers, nes, snapshot);
break;
default: /* do nothing */
@@ -2497,10 +3016,8 @@ void nlastrip_evaluate(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels
}
/* write the accumulated settings to */
-void nladata_flush_channels(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels)
+void nladata_flush_channels(Depsgraph *depsgraph, PointerRNA *ptr, NlaEvalData *channels, NlaEvalSnapshot *snapshot)
{
- NlaEvalChannel *nec;
-
/* sanity checks */
if (channels == NULL)
return;
@@ -2508,12 +3025,103 @@ void nladata_flush_channels(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *cha
const bool is_active_depsgraph = DEG_is_active(depsgraph);
/* for each channel with accumulated values, write its value on the property it affects */
- for (nec = channels->first; nec; nec = nec->next) {
- animsys_write_rna_setting(&nec->rna, nec->value);
- if (is_active_depsgraph) {
- animsys_write_orig_anim_rna(ptr, nec->rna_path, nec->rna.prop_index, nec->value);
+ for (NlaEvalChannel *nec = channels->channels.first; nec; nec = nec->next) {
+ NlaEvalChannelSnapshot *nec_snapshot = nlaeval_snapshot_find_channel(snapshot, nec);
+
+ PathResolvedRNA rna = { nec->key.ptr, nec->key.prop, -1 };
+
+ for (int i = 0; i < nec_snapshot->length; i++) {
+ if (BLI_BITMAP_TEST(nec->valid.ptr, i)) {
+ float value = nec_snapshot->values[i];
+ if (nec->is_array) {
+ rna.prop_index = i;
+ }
+ animsys_write_rna_setting(&rna, value);
+ if (is_active_depsgraph) {
+ animsys_write_orig_anim_rna(ptr, nec->rna_path, rna.prop_index, value);
+ }
+ }
+ }
+ }
+}
+
+/* ---------------------- */
+
+static void nla_eval_domain_action(PointerRNA *ptr, NlaEvalData *channels, bAction *act, GSet *touched_actions)
+{
+ if (!BLI_gset_add(touched_actions, act)) {
+ return;
+ }
+
+ for (FCurve *fcu = act->curves.first; fcu; fcu = fcu->next) {
+ /* check if this curve should be skipped */
+ if (fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED))
+ continue;
+ if ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED))
+ continue;
+
+ NlaEvalChannel *nec = nlaevalchan_verify(ptr, channels, fcu->rna_path);
+
+ if (nec != NULL) {
+ /* For quaternion properties, enable all sub-channels. */
+ if (nec->mix_mode == NEC_MIX_QUATERNION) {
+ BLI_bitmap_set_all(nec->valid.ptr, true, 4);
+ continue;
+ }
+
+ int idx = nlaevalchan_validate_index(nec, fcu->array_index);
+
+ if (idx >= 0) {
+ BLI_BITMAP_ENABLE(nec->valid.ptr, idx);
+ }
+ }
+ }
+}
+
+static void nla_eval_domain_strips(PointerRNA *ptr, NlaEvalData *channels, ListBase *strips, GSet *touched_actions)
+{
+ for (NlaStrip *strip = strips->first; strip; strip = strip->next) {
+ /* check strip's action */
+ if (strip->act) {
+ nla_eval_domain_action(ptr, channels, strip->act, touched_actions);
+ }
+
+ /* check sub-strips (if metas) */
+ nla_eval_domain_strips(ptr, channels, &strip->strips, touched_actions);
+ }
+}
+
+/**
+ * Ensure that all channels touched by any of the actions in enabled tracks exist.
+ * This is necessary to ensure that evaluation result depends only on current frame.
+ */
+static void animsys_evaluate_nla_domain(PointerRNA *ptr, NlaEvalData *channels, AnimData *adt)
+{
+ GSet *touched_actions = BLI_gset_ptr_new(__func__);
+
+ if (adt->action) {
+ nla_eval_domain_action(ptr, channels, adt->action, touched_actions);
+ }
+
+ /* NLA Data - Animation Data for Strips */
+ for (NlaTrack *nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
+ /* solo and muting are mutually exclusive... */
+ if (adt->flag & ADT_NLA_SOLO_TRACK) {
+ /* skip if there is a solo track, but this isn't it */
+ if ((nlt->flag & NLATRACK_SOLO) == 0)
+ continue;
+ /* else - mute doesn't matter */
}
+ else {
+ /* no solo tracks - skip track if muted */
+ if (nlt->flag & NLATRACK_MUTED)
+ continue;
+ }
+
+ nla_eval_domain_strips(ptr, channels, &nlt->strips, touched_actions);
}
+
+ BLI_gset_free(touched_actions, NULL);
}
/* ---------------------- */
@@ -2523,8 +3131,9 @@ void nladata_flush_channels(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *cha
*
* \param[out] echannels Evaluation channels with calculated values
* \param[out] r_context If not NULL, data about the currently edited strip is stored here and excluded from value calculation.
+ * \return false if NLA evaluation isn't actually applicable
*/
-static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, PointerRNA *ptr, AnimData *adt, float ctime, NlaKeyframingContext *r_context)
+static bool animsys_evaluate_nla(Depsgraph *depsgraph, NlaEvalData *echannels, PointerRNA *ptr, AnimData *adt, float ctime, NlaKeyframingContext *r_context)
{
NlaTrack *nlt;
short track_index = 0;
@@ -2603,13 +3212,18 @@ static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, Poin
/* Always use the blend mode of the strip in tweak mode, even if not in-place. */
if (nlt && adt->actstrip) {
dummy_strip->blendmode = adt->actstrip->blendmode;
- dummy_strip->extendmode = adt->actstrip->extendmode;
+ dummy_strip->extendmode = NLASTRIP_EXTEND_HOLD;
}
else {
dummy_strip->blendmode = adt->act_blendmode;
dummy_strip->extendmode = adt->act_extendmode;
}
+ /* Unless extendmode is Nothing (might be useful for flattening NLA evaluation), disable range. */
+ if (dummy_strip->extendmode != NLASTRIP_EXTEND_NOTHING) {
+ dummy_strip->flag |= NLASTRIP_FLAG_NO_TIME_MAP;
+ }
+
dummy_strip->influence = adt->act_influence;
/* NOTE: must set this, or else the default setting overrides, and this setting doesn't work */
@@ -2630,35 +3244,28 @@ static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, Poin
/* These setting combinations require no data from strips below, so exit immediately. */
if ((nes == NULL) || (dummy_strip->blendmode == NLASTRIP_MODE_REPLACE && dummy_strip->influence == 1.0f)) {
BLI_freelistN(&estrips);
- return;
+ return true;
}
}
}
else {
/* special case - evaluate as if there isn't any NLA data */
- /* TODO: this is really just a stop-gap measure... */
- if (G.debug & G_DEBUG) printf("NLA Eval: Stopgap for active action on NLA Stack - no strips case\n");
-
- if (r_context == NULL) {
- animsys_evaluate_action(depsgraph, ptr, adt->action, ctime);
- }
-
BLI_freelistN(&estrips);
- return;
+ return false;
}
}
/* only continue if there are strips to evaluate */
if (BLI_listbase_is_empty(&estrips))
- return;
-
+ return true;
/* 2. for each strip, evaluate then accumulate on top of existing channels, but don't set values yet */
for (nes = estrips.first; nes; nes = nes->next)
- nlastrip_evaluate(depsgraph, ptr, echannels, NULL, nes);
+ nlastrip_evaluate(depsgraph, ptr, echannels, NULL, nes, &echannels->eval_snapshot);
/* 3. free temporary evaluation data that's not used elsewhere */
BLI_freelistN(&estrips);
+ return true;
}
/* NLA Evaluation function (mostly for use through do_animdata)
@@ -2667,19 +3274,28 @@ static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, Poin
*/
static void animsys_calculate_nla(Depsgraph *depsgraph, PointerRNA *ptr, AnimData *adt, float ctime)
{
- ListBase echannels = {NULL, NULL};
+ NlaEvalData echannels;
- /* TODO: need to zero out all channels used, otherwise we have problems with threadsafety
- * and also when the user jumps between different times instead of moving sequentially... */
+ nlaeval_init(&echannels);
/* evaluate the NLA stack, obtaining a set of values to flush */
- animsys_evaluate_nla(depsgraph, &echannels, ptr, adt, ctime, NULL);
+ if (animsys_evaluate_nla(depsgraph, &echannels, ptr, adt, ctime, NULL)) {
+ /* reset any channels touched by currently inactive actions to default value */
+ animsys_evaluate_nla_domain(ptr, &echannels, adt);
+
+ /* flush effects of accumulating channels in NLA to the actual data they affect */
+ nladata_flush_channels(depsgraph, ptr, &echannels, &echannels.eval_snapshot);
+ }
+ else {
+ /* special case - evaluate as if there isn't any NLA data */
+ /* TODO: this is really just a stop-gap measure... */
+ if (G.debug & G_DEBUG) CLOG_WARN(&LOG, "NLA Eval: Stopgap for active action on NLA Stack - no strips case");
- /* flush effects of accumulating channels in NLA to the actual data they affect */
- nladata_flush_channels(depsgraph, ptr, &echannels);
+ animsys_evaluate_action(depsgraph, ptr, adt->action, ctime);
+ }
/* free temp data */
- BLI_freelistN(&echannels);
+ nlaeval_free(&echannels);
}
/* ---------------------- */
@@ -2713,6 +3329,7 @@ NlaKeyframingContext *BKE_animsys_get_nla_keyframing_context(
ctx = MEM_callocN(sizeof(*ctx), "NlaKeyframingContext");
ctx->adt = adt;
+ nlaeval_init(&ctx->nla_channels);
animsys_evaluate_nla(depsgraph, &ctx->nla_channels, ptr, adt, ctime, ctx);
BLI_assert(ELEM(ctx->strip.act, NULL, adt->action));
@@ -2723,16 +3340,22 @@ NlaKeyframingContext *BKE_animsys_get_nla_keyframing_context(
}
/**
- * Apply correction from the NLA context to the value about to be keyframed.
+ * Apply correction from the NLA context to the values about to be keyframed.
*
* @param context Context to use (may be NULL).
* @param prop_ptr Property about to be keyframed.
- * @param index Array index within the property.
- * @param[in,out] r_value Value to correct.
- * @return False if correction fails due to a division by zero.
+ * @param[in,out] values Array of property values to adjust.
+ * @param count Number of values in the array.
+ * @param index Index of the element about to be updated, or -1.
+ * @param[out] r_force_all Set to true if all channels must be inserted. May be NULL.
+ * @return False if correction fails due to a division by zero, or null r_force_all when all channels are required.
*/
-bool BKE_animsys_nla_remap_keyframe_value(struct NlaKeyframingContext *context, struct PointerRNA *prop_ptr, struct PropertyRNA *prop, int index, float *r_value)
+bool BKE_animsys_nla_remap_keyframe_values(struct NlaKeyframingContext *context, struct PointerRNA *prop_ptr, struct PropertyRNA *prop, float *values, int count, int index, bool *r_force_all)
{
+ if (r_force_all != NULL) {
+ *r_force_all = false;
+ }
+
/* No context means no correction. */
if (context == NULL || context->strip.act == NULL) {
return true;
@@ -2757,18 +3380,54 @@ bool BKE_animsys_nla_remap_keyframe_value(struct NlaKeyframingContext *context,
}
/* Find the evaluation channel for the NLA stack below current strip. */
- PathResolvedRNA rna = { .ptr = *prop_ptr, .prop = prop, .prop_index = index };
- NlaEvalChannel *nec = nlaevalchan_find_match(&context->nla_channels, &rna);
+ NlaEvalChannelKey key = { .ptr = *prop_ptr, .prop = prop, };
+ NlaEvalData *nlaeval = &context->nla_channels;
+ NlaEvalChannel *nec = nlaevalchan_verify_key(nlaeval, NULL, &key);
- /* Replace strips ignore influence when they are the first to modify this channel. */
- if (nec == NULL && blend_mode == NLASTRIP_MODE_REPLACE) {
- return true;
+ if (nec->base_snapshot.length != count) {
+ BLI_assert(!"invalid value count");
+ return false;
}
- /* Invert the effect of blending modes. */
- float old_value = nec ? nec->value : nlaevalchan_init_value(&rna);
+ /* Invert the blending operation to compute the desired key values. */
+ NlaEvalChannelSnapshot *nec_snapshot = nlaeval_snapshot_find_channel(&nlaeval->eval_snapshot, nec);
+
+ float *old_values = nec_snapshot->values;
+
+ if (blend_mode == NLASTRIP_MODE_COMBINE) {
+ /* Quaternion combine handles all sub-channels as a unit. */
+ if (nec->mix_mode == NEC_MIX_QUATERNION) {
+ if (r_force_all == NULL) {
+ return false;
+ }
+
+ *r_force_all = true;
+
+ nla_invert_combine_quaternion(old_values, values, influence, values);
+ }
+ else {
+ float *base_values = nec->base_snapshot.values;
- return nla_invert_blend_value(blend_mode, old_value, *r_value, influence, r_value);
+ for (int i = 0; i < count; i++) {
+ if (ELEM(index, i, -1)) {
+ if (!nla_invert_combine_value(nec->mix_mode, base_values[i], old_values[i], values[i], influence, &values[i])) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ else {
+ for (int i = 0; i < count; i++) {
+ if (ELEM(index, i, -1)) {
+ if (!nla_invert_blend_value(blend_mode, old_values[i], values[i], influence, &values[i])) {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
}
/**
@@ -2778,7 +3437,7 @@ void BKE_animsys_free_nla_keyframing_context_cache(struct ListBase *cache)
{
for (NlaKeyframingContext *ctx = cache->first; ctx; ctx = ctx->next) {
MEM_SAFE_FREE(ctx->eval_strip);
- BLI_freelistN(&ctx->nla_channels);
+ nlaeval_free(&ctx->nla_channels);
}
BLI_freelistN(cache);
@@ -2857,7 +3516,7 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A
* that overrides 'rough' work in NLA
*/
/* TODO: need to double check that this all works correctly */
- if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM)) {
+ if (recalc & ADT_RECALC_ANIM) {
/* evaluate NLA data */
if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF)) {
/* evaluate NLA-stack
@@ -2868,9 +3527,6 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A
/* evaluate Active Action only */
else if (adt->action)
animsys_evaluate_action_ex(depsgraph, &id_ptr, adt->action, ctime);
-
- /* reset tag */
- adt->recalc &= ~ADT_RECALC_ANIM;
}
/* recalculate drivers
@@ -2878,10 +3534,7 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A
* or be layered on top of existing animation data.
* - Drivers should be in the appropriate order to be evaluated without problems...
*/
- if ((recalc & ADT_RECALC_DRIVERS)
- /* XXX for now, don't check yet, as depsgraph hasn't been updated */
- /* && (adt->recalc & ADT_RECALC_DRIVERS)*/)
- {
+ if (recalc & ADT_RECALC_DRIVERS) {
animsys_evaluate_drivers(&id_ptr, adt, ctime);
}
@@ -2899,9 +3552,6 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A
RNA_property_update_cache_flush(bmain, scene);
RNA_property_update_cache_free();
}
-
- /* clear recalc flag now */
- adt->recalc = 0;
}
/* Evaluation of all ID-blocks with Animation Data blocks - Animation Data Only
@@ -2958,7 +3608,7 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, Scene
* however, if there are some curves, we will need to make sure that their 'ctime' property gets
* set correctly, so this optimization must be skipped in that case...
*/
- if (BLI_listbase_is_empty(&main->action) && BLI_listbase_is_empty(&main->curve)) {
+ if (BLI_listbase_is_empty(&main->actions) && BLI_listbase_is_empty(&main->curves)) {
if (G.debug & G_DEBUG)
printf("\tNo Actions, so no animation needs to be evaluated...\n");
@@ -2966,52 +3616,52 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, Scene
}
/* nodes */
- EVAL_ANIM_IDS(main->nodetree.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->nodetrees.first, ADT_RECALC_ANIM);
/* textures */
- EVAL_ANIM_NODETREE_IDS(main->tex.first, Tex, ADT_RECALC_ANIM);
+ EVAL_ANIM_NODETREE_IDS(main->textures.first, Tex, ADT_RECALC_ANIM);
- /* lamps */
- EVAL_ANIM_NODETREE_IDS(main->lamp.first, Lamp, ADT_RECALC_ANIM);
+ /* lights */
+ EVAL_ANIM_NODETREE_IDS(main->lights.first, Light, ADT_RECALC_ANIM);
/* materials */
- EVAL_ANIM_NODETREE_IDS(main->mat.first, Material, ADT_RECALC_ANIM);
+ EVAL_ANIM_NODETREE_IDS(main->materials.first, Material, ADT_RECALC_ANIM);
/* cameras */
- EVAL_ANIM_IDS(main->camera.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->cameras.first, ADT_RECALC_ANIM);
/* shapekeys */
- EVAL_ANIM_IDS(main->key.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->shapekeys.first, ADT_RECALC_ANIM);
/* metaballs */
- EVAL_ANIM_IDS(main->mball.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->metaballs.first, ADT_RECALC_ANIM);
/* curves */
- EVAL_ANIM_IDS(main->curve.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->curves.first, ADT_RECALC_ANIM);
/* armatures */
- EVAL_ANIM_IDS(main->armature.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->armatures.first, ADT_RECALC_ANIM);
/* lattices */
- EVAL_ANIM_IDS(main->latt.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->lattices.first, ADT_RECALC_ANIM);
/* meshes */
- EVAL_ANIM_IDS(main->mesh.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->meshes.first, ADT_RECALC_ANIM);
/* particles */
- EVAL_ANIM_IDS(main->particle.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->particles.first, ADT_RECALC_ANIM);
/* speakers */
- EVAL_ANIM_IDS(main->speaker.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->speakers.first, ADT_RECALC_ANIM);
/* movie clips */
- EVAL_ANIM_IDS(main->movieclip.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->movieclips.first, ADT_RECALC_ANIM);
/* linestyles */
- EVAL_ANIM_IDS(main->linestyle.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->linestyles.first, ADT_RECALC_ANIM);
/* grease pencil */
- EVAL_ANIM_IDS(main->gpencil.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->gpencils.first, ADT_RECALC_ANIM);
/* palettes */
EVAL_ANIM_IDS(main->palettes.first, ADT_RECALC_ANIM);
@@ -3024,16 +3674,16 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, Scene
* this tagged by Depsgraph on framechange. This optimization means that objects
* linked from other (not-visible) scenes will not need their data calculated.
*/
- EVAL_ANIM_IDS(main->object.first, 0);
+ EVAL_ANIM_IDS(main->objects.first, 0);
/* masks */
- EVAL_ANIM_IDS(main->mask.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_IDS(main->masks.first, ADT_RECALC_ANIM);
/* worlds */
- EVAL_ANIM_NODETREE_IDS(main->world.first, World, ADT_RECALC_ANIM);
+ EVAL_ANIM_NODETREE_IDS(main->worlds.first, World, ADT_RECALC_ANIM);
/* scenes */
- EVAL_ANIM_NODETREE_IDS(main->scene.first, Scene, ADT_RECALC_ANIM);
+ EVAL_ANIM_NODETREE_IDS(main->scenes.first, Scene, ADT_RECALC_ANIM);
}
/* ***************************************** */
@@ -3049,8 +3699,7 @@ void BKE_animsys_eval_animdata(Depsgraph *depsgraph, ID *id)
* which should get handled as part of the dependency graph instead...
*/
DEG_debug_print_eval_time(depsgraph, __func__, id->name, id, ctime);
- short recalc = ADT_RECALC_ANIM;
- BKE_animsys_evaluate_animdata(depsgraph, scene, id, adt, ctime, recalc);
+ BKE_animsys_evaluate_animdata(depsgraph, scene, id, adt, ctime, ADT_RECALC_ANIM);
}
void BKE_animsys_update_driver_array(ID *id)
@@ -3102,7 +3751,7 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph,
if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0) {
/* check if driver itself is tagged for recalculation */
/* XXX driver recalc flag is not set yet by depsgraph! */
- if ((driver_orig) && !(driver_orig->flag & DRIVER_FLAG_INVALID) /*&& (driver_orig->flag & DRIVER_FLAG_RECALC)*/) {
+ if ((driver_orig) && !(driver_orig->flag & DRIVER_FLAG_INVALID)) {
/* evaluate this using values set already in other places
* NOTE: for 'layering' option later on, we should check if we should remove old value before adding
* new to only be done when drivers only changed */
@@ -3110,22 +3759,40 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph,
PathResolvedRNA anim_rna;
if (animsys_store_rna_setting(&id_ptr, fcu->rna_path, fcu->array_index, &anim_rna)) {
+ /* Evaluate driver, and write results to COW-domain destination */
const float ctime = DEG_get_ctime(depsgraph);
const float curval = evaluate_fcurve_driver(&anim_rna, fcu, driver_orig, ctime);
ok = animsys_write_rna_setting(&anim_rna, curval);
+
+ /* Flush results & status codes to original data for UI (T59984) */
if (ok && DEG_is_active(depsgraph)) {
animsys_write_orig_anim_rna(&id_ptr, fcu->rna_path, fcu->array_index, curval);
- }
- }
- //printf("\tnew val = %f\n", fcu->curval);
+ /* curval is displayed in the UI, and flag contains error-status codes */
+ driver_orig->curval = fcu->driver->curval;
+ driver_orig->flag = fcu->driver->flag;
+
+ DriverVar *dvar_orig = driver_orig->variables.first;
+ DriverVar *dvar = fcu->driver->variables.first;
+ for (;
+ dvar_orig && dvar;
+ dvar_orig = dvar_orig->next, dvar = dvar->next)
+ {
+ DriverTarget *dtar_orig = &dvar_orig->targets[0];
+ DriverTarget *dtar = &dvar->targets[0];
+ for (int i = 0; i < MAX_DRIVER_TARGETS; i++, dtar_orig++, dtar++) {
+ dtar_orig->flag = dtar->flag;
+ }
- /* clear recalc flag */
- driver_orig->flag &= ~DRIVER_FLAG_RECALC;
+ dvar_orig->curval = dvar->curval;
+ dvar_orig->flag = dvar->flag;
+ }
+ }
+ }
/* set error-flag if evaluation failed */
if (ok == 0) {
- printf("invalid driver - %s[%d]\n", fcu->rna_path, fcu->array_index);
+ CLOG_ERROR(&LOG, "invalid driver - %s[%d]", fcu->rna_path, fcu->array_index);
driver_orig->flag |= DRIVER_FLAG_INVALID;
}
}
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index fc24ccc9fa0..bc265b6c465 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,11 +12,10 @@
* 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.
- *
*/
-/** \file blender/blenkernel/intern/appdir.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Access to application level directories.
*/
@@ -41,6 +38,8 @@
#include "MEM_guardedalloc.h"
+#include "CLG_log.h"
+
#ifdef WIN32
# include "utf_winfunc.h"
# include "utfconv.h"
@@ -60,6 +59,7 @@
#endif /* WIN32 */
/* local */
+static CLG_LogRef LOG = {"bke.appdir"};
static char bprogname[FILE_MAX]; /* full path to program executable */
static char bprogdir[FILE_MAX]; /* full path to directory in which executable is located */
static char btempdir_base[FILE_MAX]; /* persistent temporary directory */
@@ -273,8 +273,6 @@ static bool get_path_environment(
/**
* Returns the path of a folder within the user-files area.
- *
- *
* \param targetpath: String to return path
* \param folder_name: default name of folder within user area
* \param subfolder_name: optional name of subfolder within folder
@@ -569,7 +567,7 @@ static void where_am_i(char *fullname, const size_t maxlen, const char *name)
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", (int)maxlen, fullname);
+ CLOG_ERROR(&LOG, "path can't be found: \"%.*s\"", (int)maxlen, fullname);
MessageBox(NULL, "path contains invalid characters or is too long (see console)", "Error", MB_OK);
}
MEM_freeN(fullname_16);
@@ -605,7 +603,7 @@ static void where_am_i(char *fullname, const size_t maxlen, const char *name)
#if defined(DEBUG)
if (!STREQ(name, fullname)) {
- printf("guessing '%s' == '%s'\n", name, fullname);
+ CLOG_INFO(&LOG, 2, "guessing '%s' == '%s'", name, fullname);
}
#endif
}
@@ -852,7 +850,7 @@ static void where_is_temp(char *fullname, char *basename, const size_t maxlen, c
BLI_add_slash(fullname);
}
else {
- printf("Warning! Could not generate a temp file name for '%s', falling back to '%s'\n", tmp_name, fullname);
+ CLOG_WARN(&LOG, "Could not generate a temp file name for '%s', falling back to '%s'", tmp_name, fullname);
}
MEM_freeN(tmp_name);
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 6dc49a1cebb..cf7b9981b72 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/armature.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <ctype.h>
@@ -64,8 +58,6 @@
#include "BKE_displist.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_lattice.h"
#include "BKE_main.h"
#include "BKE_object.h"
@@ -77,6 +69,10 @@
#include "atomic_ops.h"
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"bke.armature"};
+
/* **************** Generic Functions, data level *************** */
bArmature *BKE_armature_add(Main *bmain, const char *name)
@@ -87,7 +83,6 @@ bArmature *BKE_armature_add(Main *bmain, const char *name)
arm->deformflag = ARM_DEF_VGROUP | ARM_DEF_ENVELOPE;
arm->flag = ARM_COL_CUSTOM; /* custom bone-group colors */
arm->layer = 1;
- arm->ghostsize = 1;
return arm;
}
@@ -172,7 +167,7 @@ static void copy_bonechildren(
/**
* Only copy internal data of Armature ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -205,7 +200,7 @@ void BKE_armature_copy_data(Main *UNUSED(bmain), bArmature *arm_dst, const bArma
bArmature *BKE_armature_copy(Main *bmain, const bArmature *arm)
{
bArmature *arm_copy;
- BKE_id_copy_ex(bmain, &arm->id, (ID **)&arm_copy, 0, false);
+ BKE_id_copy(bmain, &arm->id, (ID **)&arm_copy);
return arm_copy;
}
@@ -842,7 +837,7 @@ typedef struct ObjectBBoneDeform {
static void allocate_bbone_cache(bPoseChannel *pchan, int segments)
{
- bPoseChannelRuntime *runtime = &pchan->runtime;
+ bPoseChannel_Runtime *runtime = &pchan->runtime;
if (runtime->bbone_segments != segments) {
if (runtime->bbone_segments != 0) {
@@ -850,17 +845,17 @@ static void allocate_bbone_cache(bPoseChannel *pchan, int segments)
}
runtime->bbone_segments = segments;
- runtime->bbone_rest_mats = MEM_malloc_arrayN(sizeof(Mat4), (uint)segments, "bPoseChannelRuntime::bbone_rest_mats");
- runtime->bbone_pose_mats = MEM_malloc_arrayN(sizeof(Mat4), (uint)segments, "bPoseChannelRuntime::bbone_pose_mats");
- runtime->bbone_deform_mats = MEM_malloc_arrayN(sizeof(Mat4), 1 + (uint)segments, "bPoseChannelRuntime::bbone_deform_mats");
- runtime->bbone_dual_quats = MEM_malloc_arrayN(sizeof(DualQuat), (uint)segments, "bPoseChannelRuntime::bbone_dual_quats");
+ runtime->bbone_rest_mats = MEM_malloc_arrayN(sizeof(Mat4), (uint)segments, "bPoseChannel_Runtime::bbone_rest_mats");
+ runtime->bbone_pose_mats = MEM_malloc_arrayN(sizeof(Mat4), (uint)segments, "bPoseChannel_Runtime::bbone_pose_mats");
+ runtime->bbone_deform_mats = MEM_malloc_arrayN(sizeof(Mat4), 1 + (uint)segments, "bPoseChannel_Runtime::bbone_deform_mats");
+ runtime->bbone_dual_quats = MEM_malloc_arrayN(sizeof(DualQuat), (uint)segments, "bPoseChannel_Runtime::bbone_dual_quats");
}
}
/** Compute and cache the B-Bone shape in the channel runtime struct. */
void BKE_pchan_bbone_segments_cache_compute(bPoseChannel *pchan)
{
- bPoseChannelRuntime *runtime = &pchan->runtime;
+ bPoseChannel_Runtime *runtime = &pchan->runtime;
Bone *bone = pchan->bone;
int segments = bone->segments;
@@ -903,8 +898,8 @@ void BKE_pchan_bbone_segments_cache_compute(bPoseChannel *pchan)
/** Copy cached B-Bone segments from one channel to another */
void BKE_pchan_bbone_segments_cache_copy(bPoseChannel *pchan, bPoseChannel *pchan_from)
{
- bPoseChannelRuntime *runtime = &pchan->runtime;
- bPoseChannelRuntime *runtime_from = &pchan_from->runtime;
+ bPoseChannel_Runtime *runtime = &pchan->runtime;
+ bPoseChannel_Runtime *runtime_from = &pchan_from->runtime;
int segments = runtime_from->bbone_segments;
if (segments <= 1) {
@@ -1155,7 +1150,7 @@ void armature_deform_verts(
}
if ((armOb->pose->flag & POSE_RECALC) != 0) {
- printf("ERROR! Trying to evaluate influence of armature '%s' which needs Pose recalc!\n", armOb->id.name);
+ CLOG_ERROR(&LOG, "Trying to evaluate influence of armature '%s' which needs Pose recalc!", armOb->id.name);
BLI_assert(0);
}
@@ -1171,7 +1166,7 @@ void armature_deform_verts(
ObjectBBoneDeform *bbone_deform =
BKE_armature_cached_bbone_deformation_get(armOb);
if (bbone_deform == NULL || bbone_deform->pdef_info_array == NULL) {
- fprintf(stderr,
+ CLOG_ERROR(&LOG,
"Armature does not have bbone cache %s, "
"usually happens due to a dependency cycle.\n",
armOb->id.name + 2);
@@ -1377,9 +1372,7 @@ void armature_deform_verts(
smat = summat;
}
else {
- if (target->type != OB_GPENCIL) {
- mul_v3_fl(vec, armature_weight / contrib);
- }
+ mul_v3_fl(vec, armature_weight / contrib);
add_v3_v3v3(co, vec, co);
}
@@ -2001,7 +1994,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone->layer & layer_protected) {
if (BKE_pose_channel_find_name(frompose, pchan->name) == NULL) {
- printf("failed to sync proxy armature because '%s' is missing pose channel '%s'\n",
+ CLOG_ERROR(&LOG, "failed to sync proxy armature because '%s' is missing pose channel '%s'",
from->id.name, pchan->name);
error = 1;
}
@@ -2474,10 +2467,10 @@ static void boundbox_armature(Object *ob)
BoundBox *bb;
float min[3], max[3];
- if (ob->bb == NULL) {
- ob->bb = MEM_callocN(sizeof(BoundBox), "Armature boundbox");
+ if (ob->runtime.bb == NULL) {
+ ob->runtime.bb = MEM_callocN(sizeof(BoundBox), "Armature boundbox");
}
- bb = ob->bb;
+ bb = ob->runtime.bb;
INIT_MINMAX(min, max);
if (!minmax_armature(ob, min, max)) {
@@ -2494,7 +2487,7 @@ BoundBox *BKE_armature_boundbox_get(Object *ob)
{
boundbox_armature(ob);
- return ob->bb;
+ return ob->runtime.bb;
}
bool BKE_pose_minmax(Object *ob, float r_min[3], float r_max[3], bool use_hidden, bool use_select)
@@ -2641,7 +2634,7 @@ void BKE_armature_cached_bbone_deformation_update(Object *object)
ArmatureBBoneDefmatsData data = {
.pdef_info_array = pdef_info_array,
.dualquats = dualquats,
- .use_quaternion = use_quaternion
+ .use_quaternion = use_quaternion,
};
BLI_task_parallel_listbase(&pose->chanbase,
&data,
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index e155c14ce4a..12f3f5c7354 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -18,16 +16,11 @@
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Defines and code for core node types
*/
-/** \file blender/blenkernel/intern/armature_update.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
@@ -52,7 +45,6 @@
#include "BIK_api.h"
-#include "BKE_main.h"
#include "DEG_depsgraph.h"
diff --git a/source/blender/blenkernel/intern/autoexec.c b/source/blender/blenkernel/intern/autoexec.c
index 708820877d9..1444c2cccbc 100644
--- a/source/blender/blenkernel/intern/autoexec.c
+++ b/source/blender/blenkernel/intern/autoexec.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation 2013
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/autoexec.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Currently just checks if a blend file can be trusted to autoexec,
* may add signing here later.
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 0ba19d5b4da..08d49dee754 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/blender.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Application level startup/shutdown functionality.
*/
@@ -52,12 +44,10 @@
#include "BKE_blendfile.h"
#include "BKE_brush.h"
#include "BKE_cachefile.h"
-#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_image.h"
#include "BKE_layer.h"
-#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_report.h"
@@ -137,9 +127,9 @@ void BKE_blender_globals_init(void)
BKE_blender_version_string(versionstr, sizeof(versionstr), BLENDER_VERSION, BLENDER_SUBVERSION, true, true);
#ifndef WITH_PYTHON_SECURITY /* default */
- G.f |= G_SCRIPT_AUTOEXEC;
+ G.f |= G_FLAG_SCRIPT_AUTOEXEC;
#else
- G.f &= ~G_SCRIPT_AUTOEXEC;
+ G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
#endif
G.log.level = 1;
@@ -315,7 +305,7 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use
DATA_SWAP(app_flag);
/* We could add others. */
- FLAG_SWAP(uiflag, int, USER_QUIT_PROMPT);
+ FLAG_SWAP(uiflag, int, USER_SAVE_PROMPT);
#undef SWAP_TYPELESS
#undef DATA_SWAP
@@ -335,27 +325,6 @@ void BKE_blender_userdef_app_template_data_set_and_free(UserDef *userdef)
MEM_freeN(userdef);
}
-/* ***************** testing for break ************* */
-
-static void (*blender_test_break_cb)(void) = NULL;
-
-void BKE_blender_callback_test_break_set(void (*func)(void))
-{
- blender_test_break_cb = func;
-}
-
-
-int BKE_blender_test_break(void)
-{
- if (!G.background) {
- if (blender_test_break_cb)
- blender_test_break_cb();
- }
-
- return (G.is_break == true);
-}
-
-
/** \name Blender's AtExit
*
* \note Don't use MEM_mallocN so functions can be registered at any time.
diff --git a/source/blender/blenkernel/intern/blender_copybuffer.c b/source/blender/blenkernel/intern/blender_copybuffer.c
index 004aaf2801c..bc935f0b760 100644
--- a/source/blender/blenkernel/intern/blender_copybuffer.c
+++ b/source/blender/blenkernel/intern/blender_copybuffer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/blender_copybuffer.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Used for copy/paste operator, (using a temporary file).
*/
@@ -36,7 +32,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_callbacks.h"
#include "IMB_imbuf.h"
#include "IMB_moviecache.h"
@@ -60,7 +55,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Copy/Paste `.blend`, partial saves.
* \{ */
@@ -103,7 +97,7 @@ bool BKE_copybuffer_read(Main *bmain_dst, const char *libname, ReportList *repor
BKE_main_lib_objects_recalc_all(bmain_dst);
IMB_colormanagement_check_file_config(bmain_dst);
/* Append, rather than linking. */
- Library *lib = BLI_findstring(&bmain_dst->library, libname, offsetof(Library, filepath));
+ Library *lib = BLI_findstring(&bmain_dst->libraries, libname, offsetof(Library, filepath));
BKE_library_make_local(bmain_dst, lib, NULL, true, false);
/* Important we unset, otherwise these object wont
* link into other scenes from this blend file.
@@ -153,7 +147,7 @@ bool BKE_copybuffer_paste(bContext *C, const char *libname, const short flag, Re
IMB_colormanagement_check_file_config(bmain);
/* append, rather than linking */
- lib = BLI_findstring(&bmain->library, libname, offsetof(Library, filepath));
+ lib = BLI_findstring(&bmain->libraries, libname, offsetof(Library, filepath));
BKE_library_make_local(bmain, lib, NULL, true, false);
/* important we unset, otherwise these object wont
diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c
index fac3685f7b1..dd9be07be5d 100644
--- a/source/blender/blenkernel/intern/blender_undo.c
+++ b/source/blender/blenkernel/intern/blender_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/blender_undo.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Blend file undo (known as 'Global Undo').
* DNA level diffing for undo.
@@ -51,7 +47,6 @@
#include "BKE_blendfile.h"
#include "BKE_context.h"
#include "BKE_global.h"
-#include "BKE_library.h"
#include "BKE_main.h"
#include "BLO_undofile.h"
@@ -61,7 +56,6 @@
#include "DEG_depsgraph.h"
/* -------------------------------------------------------------------- */
-
/** \name Global Undo
* \{ */
diff --git a/source/blender/blenkernel/intern/blender_user_menu.c b/source/blender/blenkernel/intern/blender_user_menu.c
index 2c18de70e6d..4db7bea0d73 100644
--- a/source/blender/blenkernel/intern/blender_user_menu.c
+++ b/source/blender/blenkernel/intern/blender_user_menu.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/blender_user_menu.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* User defined menu API.
*/
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index cc42fe71579..455f73c65c0 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/blendfile.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* High level `.blend` file read/write,
* and functions for writing *partial* files (only selected data-blocks).
@@ -69,7 +65,6 @@
#endif
/* -------------------------------------------------------------------- */
-
/** \name High Level `.blend` file read/write.
* \{ */
@@ -87,7 +82,7 @@ static void clean_paths(Main *main)
BKE_bpath_traverse_main(main, clean_paths_visit_cb, BKE_BPATH_TRAVERSE_SKIP_MULTIFILE, NULL);
- for (scene = main->scene.first; scene; scene = scene->id.next) {
+ for (scene = main->scenes.first; scene; scene = scene->id.next) {
BLI_path_native_slash(scene->r.pic);
}
}
@@ -132,7 +127,7 @@ static void setup_app_data(
BKE_report(reports, RPT_WARNING, "Library file, loading empty scene");
mode = LOAD_UI_OFF;
}
- else if (BLI_listbase_is_empty(&bfd->main->screen)) {
+ else if (BLI_listbase_is_empty(&bfd->main->screens)) {
mode = LOAD_UNDO;
}
else if ((G.fileflags & G_FILE_NO_UI) && (is_startup == false)) {
@@ -176,7 +171,7 @@ static void setup_app_data(
/* comes from readfile.c */
SWAP(ListBase, bmain->wm, bfd->main->wm);
SWAP(ListBase, bmain->workspaces, bfd->main->workspaces);
- SWAP(ListBase, bmain->screen, bfd->main->screen);
+ SWAP(ListBase, bmain->screens, bfd->main->screens);
/* we re-use current window and screen */
win = CTX_wm_window(C);
@@ -188,7 +183,7 @@ static void setup_app_data(
track_undo_scene = (mode == LOAD_UNDO && curscreen && curscene && bfd->main->wm.first);
if (curscene == NULL) {
- curscene = bfd->main->scene.first;
+ curscene = bfd->main->scenes.first;
}
/* empty file, we add a scene to make Blender work */
if (curscene == NULL) {
@@ -209,7 +204,7 @@ static void setup_app_data(
}
/* BKE_blender_globals_clear will free G_MAIN, here we can still restore pointers */
- blo_lib_link_restore(bfd->main, CTX_wm_manager(C), curscene, cur_view_layer);
+ blo_lib_link_restore(bmain, bfd->main, CTX_wm_manager(C), curscene, cur_view_layer);
if (win) {
curscene = win->scene;
}
@@ -265,9 +260,6 @@ static void setup_app_data(
CTX_data_scene_set(C, curscene);
}
else {
- /* Keep state from preferences. */
- const int fileflags_skip = G_FILE_FLAGS_RUNTIME;
- G.fileflags = (G.fileflags & fileflags_skip) | (bfd->fileflags & ~fileflags_skip);
CTX_wm_manager_set(C, bmain->wm.first);
CTX_wm_screen_set(C, bfd->curscreen);
CTX_data_scene_set(C, bfd->curscene);
@@ -277,15 +269,19 @@ static void setup_app_data(
curscene = bfd->curscene;
}
+ /* Keep state from preferences. */
+ const int fileflags_keep = G_FILE_FLAG_ALL_RUNTIME;
+ G.fileflags = (G.fileflags & fileflags_keep) | (bfd->fileflags & ~fileflags_keep);
+
/* this can happen when active scene was lib-linked, and doesn't exist anymore */
if (CTX_data_scene(C) == NULL) {
wmWindow *win = CTX_wm_window(C);
/* in case we don't even have a local scene, add one */
- if (!bmain->scene.first)
+ if (!bmain->scenes.first)
BKE_scene_add(bmain, "Empty");
- CTX_data_scene_set(C, bmain->scene.first);
+ CTX_data_scene_set(C, bmain->scenes.first);
win->scene = CTX_data_scene(C);
curscene = CTX_data_scene(C);
}
@@ -295,7 +291,8 @@ static void setup_app_data(
/* special cases, override loaded flags: */
if (G.f != bfd->globalf) {
- const int flags_keep = (G_SWAP_EXCHANGE | G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
+ const int flags_keep = G_FLAG_ALL_RUNTIME;
+ bfd->globalf &= G_FLAG_ALL_READFILE;
bfd->globalf = (bfd->globalf & ~flags_keep) | (G.f & flags_keep);
}
@@ -443,9 +440,9 @@ bool BKE_blendfile_read_from_memfile(
if (bfd) {
/* remove the unused screens and wm */
while (bfd->main->wm.first)
- BKE_libblock_free(bfd->main, bfd->main->wm.first);
- while (bfd->main->screen.first)
- BKE_libblock_free(bfd->main, bfd->main->screen.first);
+ BKE_id_free(bfd->main, bfd->main->wm.first);
+ while (bfd->main->screens.first)
+ BKE_id_free(bfd->main, bfd->main->screens.first);
setup_app_data(C, bfd, "<memory1>", params->is_startup, reports);
}
@@ -463,23 +460,16 @@ bool BKE_blendfile_read_from_memfile(
void BKE_blendfile_read_make_empty(bContext *C)
{
Main *bmain = CTX_data_main(C);
-
- ListBase *lbarray[MAX_LIBARRAY];
ID *id;
- int a;
- a = set_listbasepointers(bmain, lbarray);
- while (a--) {
- id = lbarray[a]->first;
- if (id != NULL) {
- if (ELEM(GS(id->name), ID_SCE, ID_SCR, ID_WM, ID_WS)) {
- continue;
- }
- while ((id = lbarray[a]->first)) {
- BKE_libblock_delete(bmain, id);
- }
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ if (ELEM(GS(id->name), ID_SCE, ID_SCR, ID_WM, ID_WS)) {
+ break; /* Only breaks iter on that ID type, and continues with IDs of next type. */
}
+ BKE_id_delete(bmain, id);
}
+ FOREACH_MAIN_ID_END;
}
/* only read the userdef from a .blend */
@@ -621,7 +611,6 @@ void BKE_blendfile_workspace_config_data_free(WorkspaceConfigFileData *workspace
/* -------------------------------------------------------------------- */
-
/** \name Partial `.blend` file save.
* \{ */
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index ea62748806c..54a8929a7f7 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/boids.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -743,7 +735,7 @@ static boid_rule_cb boid_rules[] = {
//rule_protect,
//rule_hide,
//rule_follow_path,
- //rule_follow_wall
+ //rule_follow_wall,
};
static void set_boid_values(BoidValues *val, BoidSettings *boids, ParticleData *pa)
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index 0ada712a855..e85cb700bce 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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, Alex Fraser
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/bpath.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
/* TODO,
@@ -81,10 +75,14 @@
#include "BKE_bpath.h" /* own include */
+#include "CLG_log.h"
+
#ifndef _MSC_VER
# include "BLI_strict_flags.h"
#endif
+static CLG_LogRef LOG = {"bke.bpath"};
+
static bool checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src)
{
ReportList *reports = (ReportList *)userdata;
@@ -141,7 +139,7 @@ void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *re
const int flag = BKE_BPATH_TRAVERSE_SKIP_LIBRARY;
if (basedir[0] == '\0') {
- printf("%s: basedir='', this is a bug\n", __func__);
+ CLOG_ERROR(&LOG, "basedir='', this is a bug");
return;
}
@@ -185,7 +183,7 @@ void BKE_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *re
const int flag = BKE_BPATH_TRAVERSE_SKIP_LIBRARY;
if (basedir[0] == '\0') {
- printf("%s: basedir='', this is a bug\n", __func__);
+ CLOG_ERROR(&LOG, "basedir='', this is a bug");
return;
}
@@ -413,13 +411,6 @@ static bool rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *a
}
}
-/* fix the image user "ok" tag after updating paths, so ImBufs get loaded */
-static void bpath_traverse_image_user_cb(Image *ima, ImageUser *iuser, void *customdata)
-{
- if (ima == customdata)
- iuser->ok = 1;
-}
-
/* Run visitor function 'visit' on all paths contained in 'id'. */
void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
{
@@ -443,7 +434,6 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
!BKE_image_is_dirty(ima))
{
BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_RELOAD);
- BKE_image_walk_all_users(bmain, ima, bpath_traverse_image_user_cb);
}
}
}
@@ -684,8 +674,7 @@ bool BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pa
const char *base_old = ((char **)pathbase_v)[1];
if (BLI_path_is_rel(base_old)) {
- printf("%s: error, old base path '%s' is not absolute.\n",
- __func__, base_old);
+ CLOG_ERROR(&LOG, "old base path '%s' is not absolute.", base_old);
return false;
}
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index f9ba8765d04..58813c9878d 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/brush.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
@@ -32,13 +26,11 @@
#include "DNA_gpencil_types.h"
#include "BLI_math.h"
-#include "BLI_blenlib.h"
#include "BLI_rand.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_library_remap.h"
@@ -79,6 +71,7 @@ static void brush_defaults(Brush *brush)
brush->size = 35; /* radius of the brush in pixels */
brush->alpha = 0.5f; /* brush strength/intensity probably variable should be renamed? */
brush->autosmooth_factor = 0.0f;
+ brush->topology_rake_factor = 0.0f;
brush->crease_pinch_factor = 0.5f;
brush->sculpt_plane = SCULPT_DISP_DIR_AREA;
brush->plane_offset = 0.0f; /* how far above or below the plane that is found by averaging the faces */
@@ -534,7 +527,7 @@ void BKE_brush_gpencil_presets(bContext *C)
void BKE_brush_update_material(Main *bmain, Material *ma, Brush *exclude_brush)
{
- for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
if ((exclude_brush != NULL) && (brush == exclude_brush)) {
continue;
}
@@ -554,7 +547,7 @@ struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mo
{
Brush *brush;
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->ob_mode & ob_mode)
return brush;
}
@@ -563,7 +556,7 @@ struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mo
/**
* Only copy internal data of Brush ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -597,7 +590,7 @@ void BKE_brush_copy_data(Main *UNUSED(bmain), Brush *brush_dst, const Brush *bru
Brush *BKE_brush_copy(Main *bmain, const Brush *brush)
{
Brush *brush_copy;
- BKE_id_copy_ex(bmain, &brush->id, (ID **)&brush_copy, 0, false);
+ BKE_id_copy(bmain, &brush->id, (ID **)&brush_copy);
return brush_copy;
}
@@ -739,6 +732,8 @@ void BKE_brush_debug_print_state(Brush *br)
BR_TEST(autosmooth_factor, f);
+ BR_TEST(topology_rake_factor, f);
+
BR_TEST(crease_pinch_factor, f);
BR_TEST(plane_trim, f);
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index c264eb8a1d2..a96411d0c00 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Andr Pinto.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/bvhutils.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdio.h>
@@ -387,7 +379,6 @@ static void mesh_edges_spherecast(void *userdata, int index, const BVHTreeRay *r
/* -------------------------------------------------------------------- */
-
/** \name Vertex Builder
* \{ */
@@ -554,7 +545,6 @@ BVHTree *bvhtree_from_mesh_verts_ex(
/* -------------------------------------------------------------------- */
-
/** \name Edge Builder
* \{ */
@@ -739,7 +729,6 @@ BVHTree *bvhtree_from_mesh_edges_ex(
/* -------------------------------------------------------------------- */
-
/** \name Tessellated Face Builder
* \{ */
@@ -835,7 +824,6 @@ BVHTree *bvhtree_from_mesh_faces_ex(
/* -------------------------------------------------------------------- */
-
/** \name LoopTri Face Builder
* \{ */
@@ -1112,6 +1100,8 @@ BVHTree *BKE_bvhtree_from_mesh_get(
data_cp.vert = mesh->mvert;
if (data_cp.cached == false) {
+ /* TODO: a global mutex lock held during the expensive operation of
+ * building the BVH tree is really bad for performance. */
BLI_rw_mutex_lock(&cache_rwlock, THREAD_LOCK_WRITE);
data_cp.cached = bvhcache_find(
mesh->runtime.bvh_cache, type, &data_cp.tree);
@@ -1308,7 +1298,6 @@ void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
/* -------------------------------------------------------------------- */
-
/** \name BVHCache
* \{ */
diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c
index 6fcfe468e98..b4f64087f8c 100644
--- a/source/blender/blenkernel/intern/cachefile.c
+++ b/source/blender/blenkernel/intern/cachefile.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Kevin Dietrich.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/cachefile.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_anim_types.h"
@@ -110,7 +104,7 @@ void BKE_cachefile_free(CacheFile *cache_file)
/**
* Only copy internal data of CacheFile ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -132,7 +126,7 @@ void BKE_cachefile_copy_data(
CacheFile *BKE_cachefile_copy(Main *bmain, const CacheFile *cache_file)
{
CacheFile *cache_file_copy;
- BKE_id_copy_ex(bmain, &cache_file->id, (ID **)&cache_file_copy, 0, false);
+ BKE_id_copy(bmain, &cache_file->id, (ID **)&cache_file_copy);
return cache_file_copy;
}
@@ -184,7 +178,8 @@ void BKE_cachefile_update_frame(
char filename[FILE_MAX];
for (cache_file = bmain->cachefiles.first; cache_file; cache_file = cache_file->id.next) {
- /* Execute drivers only, as animation has already been done. */
+ /* TODO: dependency graph should be updated to do drivers on cachefile.
+ * Execute drivers only, as animation has already been done. */
BKE_animsys_evaluate_animdata(depsgraph, scene, &cache_file->id, cache_file->adt, ctime, ADT_RECALC_DRIVERS);
if (!cache_file->is_sequence) {
@@ -236,7 +231,7 @@ float BKE_cachefile_time_offset(CacheFile *cache_file, const float time, const f
/* TODO(kevin): replace this with some depsgraph mechanism, or something similar. */
void BKE_cachefile_clean(struct Main *bmain, CacheFile *cache_file)
{
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md = modifiers_findByType(ob, eModifierType_MeshSequenceCache);
if (md) {
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index f701538e0f9..cfcf5eeed96 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,17 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/camera.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
#include <stddef.h>
#include "DNA_camera_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
@@ -50,8 +42,6 @@
#include "BKE_object.h"
#include "BKE_layer.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
@@ -69,8 +59,8 @@ void BKE_camera_init(Camera *cam)
cam->lens = 50.0f;
cam->sensor_x = DEFAULT_SENSOR_WIDTH;
cam->sensor_y = DEFAULT_SENSOR_HEIGHT;
- cam->clipsta = 0.1f;
- cam->clipend = 1000.0f;
+ cam->clip_start = 0.1f;
+ cam->clip_end = 1000.0f;
cam->drawsize = 1.0f;
cam->ortho_scale = 6.0;
cam->flag |= CAM_SHOWPASSEPARTOUT;
@@ -99,7 +89,7 @@ void *BKE_camera_add(Main *bmain, const char *name)
/**
* Only copy internal data of Camera ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -113,7 +103,7 @@ void BKE_camera_copy_data(Main *UNUSED(bmain), Camera *cam_dst, const Camera *ca
Camera *BKE_camera_copy(Main *bmain, const Camera *cam)
{
Camera *cam_copy;
- BKE_id_copy_ex(bmain, &cam->id, (ID **)&cam_copy, 0, false);
+ BKE_id_copy(bmain, &cam->id, (ID **)&cam_copy);
return cam_copy;
}
@@ -144,7 +134,7 @@ float BKE_camera_object_dof_distance(Object *ob)
sub_v3_v3v3(dof_dir, ob->obmat[3], cam->dof_ob->obmat[3]);
return fabsf(dot_v3v3(view_dir, dof_dir));
}
- return cam->YF_dofdist;
+ return cam->dof_distance;
}
float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
@@ -182,8 +172,8 @@ void BKE_camera_params_init(CameraParams *params)
params->zoom = 1.0f;
/* fallback for non camera objects */
- params->clipsta = 0.1f;
- params->clipend = 100.0f;
+ params->clip_start = 0.1f;
+ params->clip_end = 100.0f;
}
void BKE_camera_params_from_object(CameraParams *params, const Object *ob)
@@ -207,21 +197,18 @@ void BKE_camera_params_from_object(CameraParams *params, const Object *ob)
params->sensor_y = cam->sensor_y;
params->sensor_fit = cam->sensor_fit;
- params->clipsta = cam->clipsta;
- params->clipend = cam->clipend;
+ params->clip_start = cam->clip_start;
+ params->clip_end = cam->clip_end;
}
else if (ob->type == OB_LAMP) {
- /* lamp object */
- Lamp *la = ob->data;
- float fac = cosf(la->spotsize * 0.5f);
- float phi = acosf(fac);
-
- params->lens = 16.0f * fac / sinf(phi);
+ /* light object */
+ Light *la = ob->data;
+ params->lens = 16.0f / tanf(la->spotsize * 0.5f);
if (params->lens == 0.0f)
params->lens = 35.0f;
- params->clipsta = la->clipsta;
- params->clipend = la->clipend;
+ params->clip_start = la->clipsta;
+ params->clip_end = la->clipend;
}
else {
params->lens = 35.0f;
@@ -232,8 +219,8 @@ void BKE_camera_params_from_view3d(CameraParams *params, Depsgraph *depsgraph, c
{
/* common */
params->lens = v3d->lens;
- params->clipsta = v3d->near;
- params->clipend = v3d->far;
+ params->clip_start = v3d->clip_start;
+ params->clip_end = v3d->clip_end;
if (rv3d->persp == RV3D_CAMOB) {
/* camera view */
@@ -253,8 +240,9 @@ void BKE_camera_params_from_view3d(CameraParams *params, Depsgraph *depsgraph, c
else if (rv3d->persp == RV3D_ORTHO) {
/* orthographic view */
float sensor_size = BKE_camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y);
- params->clipend *= 0.5f; // otherwise too extreme low zbuffer quality
- params->clipsta = -params->clipend;
+ /* Halve, otherwise too extreme low zbuffer quality. */
+ params->clip_end *= 0.5f;
+ params->clip_start = -params->clip_end;
params->is_ortho = true;
/* make sure any changes to this match ED_view3d_radius_to_dist_ortho() */
@@ -283,7 +271,7 @@ void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int win
else {
/* perspective camera */
sensor_size = BKE_camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y);
- pixsize = (sensor_size * params->clipsta) / params->lens;
+ pixsize = (sensor_size * params->clip_start) / params->lens;
}
/* determine sensor fit */
@@ -337,10 +325,10 @@ void BKE_camera_params_compute_matrix(CameraParams *params)
/* compute projection matrix */
if (params->is_ortho)
orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax,
- viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
+ viewplane.ymin, viewplane.ymax, params->clip_start, params->clip_end);
else
perspective_m4(params->winmat, viewplane.xmin, viewplane.xmax,
- viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
+ viewplane.ymin, viewplane.ymax, params->clip_start, params->clip_end);
}
/***************************** Camera View Frame *****************************/
@@ -378,12 +366,12 @@ void BKE_camera_view_frame_ex(
facy = 0.5f * camera->ortho_scale * r_asp[1] * scale[1];
r_shift[0] = camera->shiftx * camera->ortho_scale * scale[0];
r_shift[1] = camera->shifty * camera->ortho_scale * scale[1];
- depth = do_clip ? -((camera->clipsta * scale[2]) + 0.1f) : -drawsize * scale[2];
+ depth = do_clip ? -((camera->clip_start * scale[2]) + 0.1f) : -drawsize * scale[2];
*r_drawsize = 0.5f * camera->ortho_scale;
}
else {
- /* that way it's always visible - clipsta+0.1 */
+ /* that way it's always visible - clip_start+0.1 */
float fac, scale_x, scale_y;
float half_sensor = 0.5f * ((camera->sensor_fit == CAMERA_SENSOR_FIT_VERT) ?
(camera->sensor_y) : (camera->sensor_x));
@@ -393,7 +381,7 @@ void BKE_camera_view_frame_ex(
/* fixed depth, variable size (avoids exceeding clipping range) */
/* r_drawsize shouldn't be used in this case, set to dummy value */
*r_drawsize = 1.0f;
- depth = -(camera->clipsta + 0.1f) * scale[2];
+ depth = -(camera->clip_start + 0.1f) * scale[2];
fac = depth / (camera->lens / (-half_sensor));
scale_x = scale[0] / scale[2];
scale_y = scale[1] / scale[2];
@@ -550,7 +538,7 @@ static bool camera_frame_fit_calc_from_data(
zero_v3(r_co);
madd_v3_v3fl(r_co, cam_axis_x, (dists[2] - dists[0]) * 0.5f + params->shiftx * scale_diff);
madd_v3_v3fl(r_co, cam_axis_y, (dists[1] - dists[3]) * 0.5f + params->shifty * scale_diff);
- madd_v3_v3fl(r_co, cam_axis_z, -(data->dist_to_cam - 1.0f - params->clipsta));
+ madd_v3_v3fl(r_co, cam_axis_z, -(data->dist_to_cam - 1.0f - params->clip_start));
return true;
}
@@ -778,6 +766,12 @@ static bool camera_is_left(const char *viewname)
void BKE_camera_multiview_model_matrix(RenderData *rd, const Object *camera, const char *viewname, float r_modelmat[4][4])
{
+ BKE_camera_multiview_model_matrix_scaled(rd, camera, viewname, r_modelmat);
+ normalize_m4(r_modelmat);
+}
+
+void BKE_camera_multiview_model_matrix_scaled(RenderData *rd, const Object *camera, const char *viewname, float r_modelmat[4][4])
+{
const bool is_multiview = (rd && rd->scemode & R_MULTIVIEW) != 0;
if (!is_multiview) {
@@ -790,7 +784,22 @@ void BKE_camera_multiview_model_matrix(RenderData *rd, const Object *camera, con
const bool is_left = camera_is_left(viewname);
camera_stereo3d_model_matrix(camera, is_left, r_modelmat);
}
- normalize_m4(r_modelmat);
+}
+
+void BKE_camera_multiview_window_matrix(RenderData *rd, const Object *camera, const char *viewname, float r_winmat[4][4])
+{
+ CameraParams params;
+
+ /* Setup parameters */
+ BKE_camera_params_init(&params);
+ BKE_camera_params_from_object(&params, camera);
+ BKE_camera_multiview_params(rd, &params, camera, viewname);
+
+ /* Compute matrix, viewplane, .. */
+ BKE_camera_params_compute_viewplane(&params, rd->xsch, rd->ysch, rd->xasp, rd->yasp);
+ BKE_camera_params_compute_matrix(&params);
+
+ copy_m4_m4(r_winmat, params.winmat);
}
bool BKE_camera_multiview_spherical_stereo(RenderData *rd, const Object *camera)
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 1c3b75b1771..859c5534183 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,33 +15,22 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Ben Batt <benbatt@gmail.com>
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Implementation of CDDerivedMesh.
*
* BKE_cdderivedmesh.h contains the function prototypes for this file.
- *
*/
-/** \file blender/blenkernel/intern/cdderivedmesh.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "atomic_ops.h"
#include "BLI_math.h"
-#include "BLI_edgehash.h"
#include "BLI_utildefines.h"
-#include "BLI_utildefines_stack.h"
#include "BKE_pbvh.h"
#include "BKE_cdderivedmesh.h"
-#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_object.h"
@@ -595,15 +582,16 @@ DerivedMesh *CDDM_new(int numVerts, int numEdges, int numTessFaces, int numLoops
DerivedMesh *CDDM_from_mesh(Mesh *mesh)
{
- return CDDM_from_mesh_ex(mesh, CD_REFERENCE, CD_MASK_MESH);
+ return CDDM_from_mesh_ex(mesh, CD_REFERENCE, &CD_MASK_MESH);
}
-DerivedMesh *CDDM_from_mesh_ex(Mesh *mesh, eCDAllocType alloctype, CustomDataMask mask)
+DerivedMesh *CDDM_from_mesh_ex(Mesh *mesh, eCDAllocType alloctype, const CustomData_MeshMasks *mask)
{
CDDerivedMesh *cddm = cdDM_create(__func__);
DerivedMesh *dm = &cddm->dm;
+ CustomData_MeshMasks cddata_masks = *mask;
- mask &= ~CD_MASK_MDISPS;
+ cddata_masks.lmask &= ~CD_MASK_MDISPS;
/* this does a referenced copy, with an exception for fluidsim */
@@ -621,15 +609,15 @@ DerivedMesh *CDDM_from_mesh_ex(Mesh *mesh, eCDAllocType alloctype, CustomDataMas
}
/* TODO DM_DIRTY_TESS_CDLAYERS ? Maybe not though, since we probably want to switch to looptris ? */
- CustomData_merge(&mesh->vdata, &dm->vertData, mask, alloctype,
+ CustomData_merge(&mesh->vdata, &dm->vertData, cddata_masks.vmask, alloctype,
mesh->totvert);
- CustomData_merge(&mesh->edata, &dm->edgeData, mask, alloctype,
+ CustomData_merge(&mesh->edata, &dm->edgeData, cddata_masks.emask, alloctype,
mesh->totedge);
- CustomData_merge(&mesh->fdata, &dm->faceData, mask | CD_MASK_ORIGINDEX, alloctype,
+ CustomData_merge(&mesh->fdata, &dm->faceData, cddata_masks.fmask | CD_MASK_ORIGINDEX, alloctype,
0 /* mesh->totface */);
- CustomData_merge(&mesh->ldata, &dm->loopData, mask, alloctype,
+ CustomData_merge(&mesh->ldata, &dm->loopData, cddata_masks.lmask, alloctype,
mesh->totloop);
- CustomData_merge(&mesh->pdata, &dm->polyData, mask, alloctype,
+ CustomData_merge(&mesh->pdata, &dm->polyData, cddata_masks.pmask, alloctype,
mesh->totpoly);
cddm->mvert = CustomData_get_layer(&dm->vertData, CD_MVERT);
@@ -780,7 +768,7 @@ static DerivedMesh *cddm_from_bmesh_ex(
int numCol = CustomData_number_of_layers(&bm->ldata, CD_MLOOPCOL);
int numUV = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV);
int *index, add_orig;
- CustomDataMask mask;
+ CustomData_MeshMasks mask = {0};
unsigned int i, j;
const int cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
@@ -792,18 +780,21 @@ static DerivedMesh *cddm_from_bmesh_ex(
/* don't add origindex layer if one already exists */
add_orig = !CustomData_has_layer(&bm->pdata, CD_ORIGINDEX);
- mask = use_mdisps ? CD_MASK_DERIVEDMESH | CD_MASK_MDISPS : CD_MASK_DERIVEDMESH;
+ mask = CD_MASK_DERIVEDMESH;
+ if (use_mdisps) {
+ mask.lmask |= CD_MASK_MDISPS;
+ }
/* don't process shapekeys, we only feed them through the modifier stack as needed,
* e.g. for applying modifiers or the like*/
- mask &= ~CD_MASK_SHAPEKEY;
- CustomData_merge(&bm->vdata, &dm->vertData, mask,
+ mask.vmask &= ~CD_MASK_SHAPEKEY;
+ CustomData_merge(&bm->vdata, &dm->vertData, mask.vmask,
CD_CALLOC, dm->numVertData);
- CustomData_merge(&bm->edata, &dm->edgeData, mask,
+ CustomData_merge(&bm->edata, &dm->edgeData, mask.emask,
CD_CALLOC, dm->numEdgeData);
- CustomData_merge(&bm->ldata, &dm->loopData, mask,
+ CustomData_merge(&bm->ldata, &dm->loopData, mask.lmask,
CD_CALLOC, dm->numLoopData);
- CustomData_merge(&bm->pdata, &dm->polyData, mask,
+ CustomData_merge(&bm->pdata, &dm->polyData, mask.pmask,
CD_CALLOC, dm->numPolyData);
/* add tessellation mface layers */
@@ -987,11 +978,10 @@ DerivedMesh *CDDM_copy(DerivedMesh *source)
/* note, the CD_ORIGINDEX layers are all 0, so if there is a direct
* relationship between mesh data this needs to be set by the caller. */
-DerivedMesh *CDDM_from_template_ex(
- DerivedMesh *source,
+DerivedMesh *CDDM_from_template_ex(DerivedMesh *source,
int numVerts, int numEdges, int numTessFaces,
int numLoops, int numPolys,
- CustomDataMask mask)
+ const CustomData_MeshMasks *mask)
{
CDDerivedMesh *cddm = cdDM_create("CDDM_from_template dest");
DerivedMesh *dm = &cddm->dm;
@@ -1039,7 +1029,7 @@ DerivedMesh *CDDM_from_template(
return CDDM_from_template_ex(
source, numVerts, numEdges, numTessFaces,
numLoops, numPolys,
- CD_MASK_DERIVEDMESH);
+ &CD_MASK_DERIVEDMESH);
}
void CDDM_apply_vert_coords(DerivedMesh *dm, float (*vertCoords)[3])
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 30b5d92bdb7..10f16fc6bcf 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * Contributor(s): Daniel Genrich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/cloth.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -515,8 +509,9 @@ void cloth_free_modifier(ClothModifierData *clmd )
void cloth_free_modifier_extern(ClothModifierData *clmd )
{
Cloth *cloth = NULL;
- if (G.debug_value > 0)
+ if (G.debug & G_DEBUG_SIMDATA) {
printf("cloth_free_modifier_extern\n");
+ }
if ( !clmd )
return;
@@ -524,8 +519,9 @@ void cloth_free_modifier_extern(ClothModifierData *clmd )
cloth = clmd->clothObject;
if ( cloth ) {
- if (G.debug_value > 0)
+ if (G.debug & G_DEBUG_SIMDATA) {
printf("cloth_free_modifier_extern in\n");
+ }
BPH_cloth_solver_free(clmd);
@@ -728,8 +724,9 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, Mesh *mesh, fl
// If we have a clothObject, free it.
if ( clmd->clothObject != NULL ) {
cloth_free_modifier ( clmd );
- if (G.debug_value > 0)
+ if (G.debug & G_DEBUG_SIMDATA) {
printf("cloth_free_modifier cloth_from_object\n");
+ }
}
// Allocate a new cloth object.
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index bd7757a29c6..8a71c0c2e10 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/collection.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <string.h>
@@ -33,13 +27,13 @@
#include "BLI_math_base.h"
#include "BLI_threads.h"
#include "BLT_translation.h"
-#include "BLI_string_utils.h"
#include "BKE_collection.h"
#include "BKE_icons.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_library.h"
+#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_rigidbody.h"
@@ -173,7 +167,7 @@ bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy)
}
}
- BKE_libblock_delete(bmain, collection);
+ BKE_id_delete(bmain, collection);
BKE_main_collection_sync(bmain);
@@ -184,7 +178,7 @@ bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy)
/**
* Only copy internal data of Collection ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -216,29 +210,32 @@ void BKE_collection_copy_data(
}
}
-/**
- * Makes a shallow copy of a Collection
- *
- * Add a new collection in the same level as the old one, copy any nested collections
- * but link the objects to the new collection (as oppose to copy them).
- */
-Collection *BKE_collection_copy(Main *bmain, Collection *parent, Collection *collection)
+static Collection *collection_duplicate_recursive(
+ Main *bmain, Collection *parent, Collection *collection_old,
+ const bool do_hierarchy, const bool do_objects, const bool do_obdata)
{
- /* It's not allowed to copy the master collection. */
- if (collection->flag & COLLECTION_IS_MASTER) {
- BLI_assert("!Master collection can't be copied");
- return NULL;
- }
-
Collection *collection_new;
- BKE_id_copy_ex(bmain, &collection->id, (ID **)&collection_new, 0, false);
- id_us_min(&collection_new->id); /* Copying add one user by default, need to get rid of that one. */
+ bool do_full_process = false;
+ const int object_dupflag = (do_obdata) ? U.dupflag : 0;
+
+ if (!do_hierarchy || collection_old->id.newid == NULL) {
+ BKE_id_copy(bmain, &collection_old->id, (ID **)&collection_new);
+ id_us_min(&collection_new->id); /* Copying add one user by default, need to get rid of that one. */
+
+ if (do_hierarchy) {
+ ID_NEW_SET(collection_old, collection_new);
+ }
+ do_full_process = true;
+ }
+ else {
+ collection_new = (Collection *)collection_old->id.newid;
+ }
- /* Optionally add to parent. */
- if (parent) {
+ /* Optionally add to parent (we always want to do that, even if collection_old had already been duplicated). */
+ if (parent != NULL) {
if (collection_child_add(parent, collection_new, 0, true)) {
/* Put collection right after existing one. */
- CollectionChild *child = collection_find_child(parent, collection);
+ CollectionChild *child = collection_find_child(parent, collection_old);
CollectionChild *child_new = collection_find_child(parent, collection_new);
if (child && child_new) {
@@ -248,6 +245,90 @@ Collection *BKE_collection_copy(Main *bmain, Collection *parent, Collection *col
}
}
+ /* If we are not doing any kind of deep-copy, we can return immediately.
+ * False do_full_process means collection_old had already been duplicated, no need to redo some deep-copy on it. */
+ if (!do_hierarchy || !do_full_process) {
+ return collection_new;
+ }
+
+ if (do_objects) {
+ /* We can loop on collection_old's objects, that list is currently identical the collection_new' objects,
+ * and won't be changed here. */
+ for (CollectionObject *cob = collection_old->gobject.first; cob; cob = cob->next) {
+ Object *ob_old = cob->ob;
+ Object *ob_new = (Object *)ob_old->id.newid;
+
+ if (ob_new == NULL) {
+ ob_new = BKE_object_duplicate(bmain, ob_old, object_dupflag);
+ ID_NEW_SET(ob_old, ob_new);
+ }
+
+ collection_object_add(bmain, collection_new, ob_new, 0, true);
+ collection_object_remove(bmain, collection_new, ob_old, false);
+ }
+ }
+
+ /* We can loop on collection_old's children, that list is currently identical the collection_new' children,
+ * and won't be changed here. */
+ for (CollectionChild *child = collection_old->children.first; child; child = child->next) {
+ Collection *child_collection_old = child->collection;
+
+ collection_duplicate_recursive(bmain, collection_new, child_collection_old, do_hierarchy, do_objects, do_obdata);
+ collection_child_remove(collection_new, child_collection_old);
+ }
+
+ return collection_new;
+}
+
+/**
+ * Makes a standard (aka shallow) ID copy of a Collection.
+ *
+ * Add a new collection in the same level as the old one, link any nested collections
+ * and finally link the objects to the new collection (as opposed to copying them).
+ */
+Collection *BKE_collection_copy(Main *bmain, Collection *parent, Collection *collection)
+{
+ return BKE_collection_duplicate(bmain, parent, collection, false, false, false);
+}
+
+/**
+ * Make either a shallow copy, or deeper duplicate of given collection.
+ *
+ * If \a do_hierarchy and \a do_deep_copy are false, this is a regular (shallow) ID copy.
+ *
+ * \warning If any 'deep copy' behavior is enabled, this functions will clear all \a bmain id.idnew pointers.
+ *
+ * \param do_hierarchy If true, it will recursively make shallow copies of children collections and objects.
+ * \param do_obdata If true, it will also make deep duplicates of objects, using behavior defined in user settings
+ * (U.dupflag). This one does nothing if \a do_hierarchy is not set.
+ */
+Collection *BKE_collection_duplicate(
+ Main *bmain, Collection *parent, Collection *collection,
+ const bool do_hierarchy, const bool do_objects, const bool do_obdata)
+{
+ /* It's not allowed to copy the master collection. */
+ if (collection->flag & COLLECTION_IS_MASTER) {
+ BLI_assert("!Master collection can't be duplicated");
+ return NULL;
+ }
+
+ if (do_hierarchy) {
+ BKE_main_id_tag_all(bmain, LIB_TAG_NEW, false);
+ BKE_main_id_clear_newpoins(bmain);
+ }
+
+ Collection *collection_new = collection_duplicate_recursive(
+ bmain, parent, collection, do_hierarchy, do_objects, do_obdata);
+
+ /* This code will follows into all ID links using an ID tagged with LIB_TAG_NEW.*/
+ BKE_libblock_relink_to_newid(&collection_new->id);
+
+ if (do_hierarchy) {
+ /* Cleanup. */
+ BKE_main_id_tag_all(bmain, LIB_TAG_NEW, false);
+ BKE_main_id_clear_newpoins(bmain);
+ }
+
BKE_main_collection_sync(bmain);
return collection_new;
@@ -262,11 +343,6 @@ Collection *BKE_collection_copy_master(Main *bmain, Collection *collection, cons
return collection_dst;
}
-void BKE_collection_copy_full(Main *UNUSED(bmain), Collection *UNUSED(collection))
-{
- // TODO: implement full scene copy
-}
-
void BKE_collection_make_local(Main *bmain, Collection *collection, const bool lib_local)
{
BKE_id_make_local_generic(bmain, &collection->id, true, lib_local);
@@ -409,8 +485,8 @@ Collection *BKE_collection_master(const Scene *scene)
static bool collection_object_cyclic_check_internal(Object *object, Collection *collection)
{
- if (object->dup_group) {
- Collection *dup_collection = object->dup_group;
+ if (object->instance_collection) {
+ Collection *dup_collection = object->instance_collection;
if ((dup_collection->id.tag & LIB_TAG_DOIT) == 0) {
/* Cycle already exists in collections, let's prevent further crappyness */
return true;
@@ -441,7 +517,7 @@ static bool collection_object_cyclic_check_internal(Object *object, Collection *
bool BKE_collection_object_cyclic_check(Main *bmain, Object *object, Collection *collection)
{
/* first flag all collections */
- BKE_main_id_tag_listbase(&bmain->collection, LIB_TAG_DOIT, true);
+ BKE_main_id_tag_listbase(&bmain->collections, LIB_TAG_DOIT, true);
return collection_object_cyclic_check_internal(object, collection);
}
@@ -472,7 +548,7 @@ Collection *BKE_collection_object_find(Main *bmain, Collection *collection, Obje
if (collection)
collection = collection->id.next;
else
- collection = bmain->collection.first;
+ collection = bmain->collections.first;
while (collection) {
if (BKE_collection_has_object(collection, ob))
@@ -491,9 +567,9 @@ bool BKE_collection_is_empty(Collection *collection)
static bool collection_object_add(Main *bmain, Collection *collection, Object *ob, int flag, const bool add_us)
{
- if (ob->dup_group) {
+ if (ob->instance_collection) {
/* Cyclic dependency check. */
- if (collection_find_child_recursive(ob->dup_group, collection)) {
+ if (collection_find_child_recursive(ob->instance_collection, collection)) {
return false;
}
}
@@ -534,7 +610,7 @@ static bool collection_object_remove(Main *bmain, Collection *collection, Object
BKE_collection_object_cache_free(collection);
if (free_us) {
- BKE_libblock_free_us(bmain, ob);
+ BKE_id_free_us(bmain, ob);
}
else {
id_us_min(&ob->id);
@@ -611,7 +687,9 @@ static bool scene_collections_object_remove(Main *bmain, Scene *scene, Object *o
{
bool removed = false;
- BKE_scene_remove_rigidbody_object(bmain, scene, ob);
+ if (collection_skip == NULL) {
+ BKE_scene_remove_rigidbody_object(bmain, scene, ob);
+ }
FOREACH_SCENE_COLLECTION_BEGIN(scene, collection)
{
@@ -659,11 +737,11 @@ static void collection_object_remove_nulls(Collection *collection)
void BKE_collections_object_remove_nulls(Main *bmain)
{
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
collection_object_remove_nulls(scene->master_collection);
}
- for (Collection *collection = bmain->collection.first; collection; collection = collection->id.next) {
+ for (Collection *collection = bmain->collections.first; collection; collection = collection->id.next) {
collection_object_remove_nulls(collection);
}
}
@@ -707,17 +785,17 @@ void BKE_collections_child_remove_nulls(Main *bmain, Collection *collection)
* otherwise we can miss some cases...
* Also, master collections are not in bmain, so we also need to loop over scenes.
*/
- for (collection = bmain->collection.first; collection != NULL; collection = collection->id.next) {
+ for (collection = bmain->collections.first; collection != NULL; collection = collection->id.next) {
collection_null_children_remove(collection);
}
- for (Scene *scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
collection_null_children_remove(BKE_collection_master(scene));
}
- for (collection = bmain->collection.first; collection != NULL; collection = collection->id.next) {
+ for (collection = bmain->collections.first; collection != NULL; collection = collection->id.next) {
collection_missing_parents_remove(collection);
}
- for (Scene *scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
collection_missing_parents_remove(BKE_collection_master(scene));
}
}
@@ -1123,7 +1201,7 @@ void BKE_scene_collections_iterator_end(struct BLI_Iterator *iter)
}
-/* scene objects iteractor */
+/* scene objects iterator */
typedef struct SceneObjectsIteratorData {
GSet *visited;
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index d868a06d134..a7ba143fc9d 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/collision.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -428,9 +420,9 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3
double tempV1[3], tempV2[3], tempV4[3];
double a, b, c, d, e, f;
- VECSUB ( tempV1, p1, p3 );
- VECSUB ( tempV2, p2, p3 );
- VECSUB ( tempV4, pv, p3 );
+ sub_v3db_v3fl_v3fl(tempV1, p1, p3);
+ sub_v3db_v3fl_v3fl(tempV2, p2, p3);
+ sub_v3db_v3fl_v3fl(tempV4, pv, p3);
a = INPR ( tempV1, tempV1 );
b = INPR ( tempV1, tempV2 );
@@ -930,8 +922,8 @@ static void add_collision_object(ListBase *relations, Object *ob, int level, uns
/* objects in dupli groups, one level only for now */
/* TODO: this doesn't really work, we are not taking into account the
* dupli transforms and can get objects in the list multiple times. */
- if (ob->dup_group && level == 0) {
- Collection *collection= ob->dup_group;
+ if (ob->instance_collection && level == 0) {
+ Collection *collection= ob->instance_collection;
/* add objects */
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object)
@@ -1064,13 +1056,15 @@ static bool cloth_bvh_objcollisions_nearcheck(ClothModifierData * clmd, Collisio
{
*collisions = (CollPair *)MEM_mallocN(sizeof(CollPair) * numresult, "collision array");
- ColDetectData data = {.clmd = clmd,
- .collmd = collmd,
- .overlap = overlap,
- .collisions = *collisions,
- .culling = culling,
- .use_normal = use_normal,
- .collided = false};
+ ColDetectData data = {
+ .clmd = clmd,
+ .collmd = collmd,
+ .overlap = overlap,
+ .collisions = *collisions,
+ .culling = culling,
+ .use_normal = use_normal,
+ .collided = false,
+ };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
@@ -1083,10 +1077,12 @@ static bool cloth_bvh_objcollisions_nearcheck(ClothModifierData * clmd, Collisio
static bool cloth_bvh_selfcollisions_nearcheck(ClothModifierData * clmd, CollPair *collisions,
int numresult, BVHTreeOverlap *overlap)
{
- SelfColDetectData data = {.clmd = clmd,
- .overlap = overlap,
- .collisions = collisions,
- .collided = false};
+ SelfColDetectData data = {
+ .clmd = clmd,
+ .overlap = overlap,
+ .collisions = collisions,
+ .collided = false,
+ };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
@@ -1127,8 +1123,8 @@ static int cloth_bvh_objcollisions_resolve(ClothModifierData * clmd, Object **co
for (i = 0; i < mvert_num; i++) {
// calculate "velocities" (just xnew = xold + v; no dt in v)
if (verts[i].impulse_count) {
- VECADD ( verts[i].tv, verts[i].tv, verts[i].impulse);
- VECADD ( verts[i].dcvel, verts[i].dcvel, verts[i].impulse);
+ add_v3_v3(verts[i].tv, verts[i].impulse);
+ add_v3_v3(verts[i].dcvel, verts[i].impulse);
zero_v3(verts[i].impulse);
verts[i].impulse_count = 0;
@@ -1164,8 +1160,8 @@ static int cloth_bvh_selfcollisions_resolve(ClothModifierData * clmd, CollPair *
for (i = 0; i < mvert_num; i++) {
if (verts[i].impulse_count) {
// VECADDMUL ( verts[i].tv, verts[i].impulse, 1.0f / verts[i].impulse_count );
- VECADD ( verts[i].tv, verts[i].tv, verts[i].impulse);
- VECADD ( verts[i].dcvel, verts[i].dcvel, verts[i].impulse);
+ add_v3_v3(verts[i].tv, verts[i].impulse);
+ add_v3_v3(verts[i].dcvel, verts[i].impulse);
zero_v3(verts[i].impulse);
verts[i].impulse_count = 0;
@@ -1301,7 +1297,7 @@ int cloth_bvh_collision(Depsgraph *depsgraph, Object *ob, ClothModifierData *clm
}
}
- VECADD(verts[i].tx, verts[i].txold, verts[i].tv);
+ add_v3_v3v3(verts[i].tx, verts[i].txold, verts[i].tv);
}
}
@@ -1568,7 +1564,7 @@ void cloth_find_point_contacts(Depsgraph *depsgraph, Object *ob, ClothModifierDa
}
}
- VECADD(verts[i].tx, verts[i].txold, verts[i].tv);
+ add_v3_v3v3(verts[i].tx, verts[i].txold, verts[i].tv);
}
////////////////////////////////////////////////////////////
diff --git a/source/blender/blenkernel/intern/colorband.c b/source/blender/blenkernel/intern/colorband.c
index 7fc1124a422..57c5e8eb0fe 100644
--- a/source/blender/blenkernel/intern/colorband.c
+++ b/source/blender/blenkernel/intern/colorband.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/colorband.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index bc34b24c8f2..8b92c42a286 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/colortools.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -1582,23 +1574,28 @@ void BKE_color_managed_display_settings_copy(ColorManagedDisplaySettings *new_se
void BKE_color_managed_view_settings_init_render(
ColorManagedViewSettings *view_settings,
- const ColorManagedDisplaySettings *display_settings)
+ const ColorManagedDisplaySettings *display_settings,
+ const char *view_transform)
{
struct ColorManagedDisplay *display =
IMB_colormanagement_display_get_named(
display_settings->display_device);
- BLI_strncpy(
- view_settings->view_transform,
- IMB_colormanagement_display_get_default_view_transform_name(display),
- sizeof(view_settings->view_transform));
+
+ if (!view_transform) {
+ view_transform = IMB_colormanagement_display_get_default_view_transform_name(display);
+ }
+
/* TODO(sergey): Find a way to make look query more reliable with non
* default configuration. */
- BLI_strncpy(view_settings->look, "None", sizeof(view_settings->look));
+ STRNCPY(view_settings->view_transform, view_transform);
+ STRNCPY(view_settings->look, "None");
view_settings->flag = 0;
view_settings->gamma = 1.0f;
view_settings->exposure = 0.0f;
view_settings->curve_mapping = NULL;
+
+ IMB_colormanagement_validate_settings(display_settings, view_settings);
}
void BKE_color_managed_view_settings_init_default(
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 57d77f797ee..b22ffce5300 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): 2007, Joshua Leung, major recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/constraint.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -87,6 +79,8 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
+#include "CLG_log.h"
+
#ifdef WITH_PYTHON
# include "BPY_extern.h"
#endif
@@ -101,6 +95,8 @@
/* Constraint Target Macros */
#define VALID_CONS_TARGET(ct) ((ct) && (ct->tar))
+static CLG_LogRef LOG = {"bke.constraint"};
+
/* ************************ Constraints - General Utilities *************************** */
/* These functions here don't act on any specific constraints, and are therefore should/will
* not require any of the special function-pointers afforded by the relevant constraint
@@ -469,7 +465,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
/* derive the rotation from the average normal:
* - code taken from transform_gizmo.c,
- * calc_gizmo_stats, V3D_MANIP_NORMAL case
+ * calc_gizmo_stats, V3D_ORIENT_NORMAL case
*/
/* we need the transpose of the inverse for a normal... */
copy_m3_m4(imat, ob->obmat);
@@ -1094,7 +1090,7 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
float size[3], vec[3];
float totmat[3][3];
- /* Get size property, since ob->size is only the object's own relative size, not its global one */
+ /* Get size property, since ob->scale is only the object's own relative size, not its global one */
mat4_to_size(size, cob->matrix);
/* Clear the object's rotation */
@@ -2059,7 +2055,7 @@ static void pycon_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
/* only execute target calculation if allowed */
#ifdef WITH_PYTHON
- if (G.f & G_SCRIPT_AUTOEXEC)
+ if (G.f & G_FLAG_SCRIPT_AUTOEXEC)
BPY_pyconstraint_target(data, ct);
#endif
}
@@ -2076,7 +2072,7 @@ static void pycon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targe
bPythonConstraint *data = con->data;
/* only evaluate in python if we're allowed to do so */
- if ((G.f & G_SCRIPT_AUTOEXEC) == 0) return;
+ if ((G.f & G_FLAG_SCRIPT_AUTOEXEC) == 0) return;
/* Now, run the actual 'constraint' function, which should only access the matrices */
BPY_pyconstraint_exec(data, cob, targets);
@@ -4706,7 +4702,7 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type)
return constraintsTypeInfo[type];
}
else {
- printf("No valid constraint type-info data available. Type = %i\n", type);
+ CLOG_WARN(&LOG, "No valid constraint type-info data available. Type = %i", type);
}
return NULL;
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 1fb8af59c55..a8e0cbed707 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/context.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <string.h>
@@ -62,10 +56,14 @@
#include "RNA_access.h"
+#include "CLG_log.h"
+
#ifdef WITH_PYTHON
# include "BPY_extern.h"
#endif
+static CLG_LogRef LOG = {"bke.context"};
+
/* struct */
struct bContext {
@@ -255,10 +253,10 @@ static void *ctx_wm_python_context_get(
return result.ptr.data;
}
else {
- printf("PyContext '%s' is a '%s', expected a '%s'\n",
- member,
- RNA_struct_identifier(result.ptr.type),
- RNA_struct_identifier(member_type));
+ CLOG_WARN(&LOG, "PyContext '%s' is a '%s', expected a '%s'",
+ member,
+ RNA_struct_identifier(result.ptr.type),
+ RNA_struct_identifier(member_type));
}
}
}
@@ -413,8 +411,8 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru
return ptr;
}
else {
- printf("%s: warning, member '%s' is '%s', not '%s'\n",
- __func__, member, RNA_struct_identifier(ptr.type), RNA_struct_identifier(type));
+ CLOG_WARN(&LOG, "member '%s' is '%s', not '%s'",
+ member, RNA_struct_identifier(ptr.type), RNA_struct_identifier(type));
}
}
@@ -729,10 +727,10 @@ struct SpaceImage *CTX_wm_space_image(const bContext *C)
return NULL;
}
-struct SpaceButs *CTX_wm_space_buts(const bContext *C)
+struct SpaceProperties *CTX_wm_space_properties(const bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
- if (sa && sa->spacetype == SPACE_BUTS)
+ if (sa && sa->spacetype == SPACE_PROPERTIES)
return sa->spacedata.first;
return NULL;
}
@@ -753,7 +751,7 @@ struct SpaceSeq *CTX_wm_space_seq(const bContext *C)
return NULL;
}
-struct SpaceOops *CTX_wm_space_outliner(const bContext *C)
+struct SpaceOutliner *CTX_wm_space_outliner(const bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if (sa && sa->spacetype == SPACE_OUTLINER)
@@ -777,10 +775,10 @@ struct SpaceNode *CTX_wm_space_node(const bContext *C)
return NULL;
}
-struct SpaceIpo *CTX_wm_space_graph(const bContext *C)
+struct SpaceGraph *CTX_wm_space_graph(const bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
- if (sa && sa->spacetype == SPACE_IPO)
+ if (sa && sa->spacetype == SPACE_GRAPH)
return sa->spacedata.first;
return NULL;
}
@@ -1045,7 +1043,7 @@ static const char *data_mode_strings[] = {
"greasepencil_edit",
"greasepencil_sculpt",
"greasepencil_weight",
- NULL
+ NULL,
};
BLI_STATIC_ASSERT(ARRAY_SIZE(data_mode_strings) == CTX_MODE_NUM + 1, "Must have a string for each context mode")
const char *CTX_data_mode_string(const bContext *C)
diff --git a/source/blender/blenkernel/intern/crazyspace.c b/source/blender/blenkernel/intern/crazyspace.c
index da4f14b5014..3b83d7308a4 100644
--- a/source/blender/blenkernel/intern/crazyspace.c
+++ b/source/blender/blenkernel/intern/crazyspace.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/crazyspace.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -108,18 +100,18 @@ float (*BKE_crazyspace_get_mapped_editverts(
Mesh *me = obedit->data;
Mesh *me_eval;
float (*vertexcos)[3];
- int nverts = me->edit_btmesh->bm->totvert;
+ int nverts = me->edit_mesh->bm->totvert;
/* disable subsurf temporal, get mapped cos, and enable it */
if (modifiers_disable_subsurf_temporary(obedit)) {
/* need to make new derivemesh */
- makeDerivedMesh(depsgraph, scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH, false);
+ makeDerivedMesh(depsgraph, scene, obedit, me->edit_mesh, &CD_MASK_BAREMESH, false);
}
/* now get the cage */
vertexcos = MEM_mallocN(sizeof(*vertexcos) * nverts, "vertexcos map");
- me_eval = editbmesh_get_eval_cage_from_orig(depsgraph, scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH);
+ me_eval = editbmesh_get_eval_cage_from_orig(depsgraph, scene, obedit, me->edit_mesh, &CD_MASK_BAREMESH);
mesh_get_mapped_verts_coords(me_eval, vertexcos, nverts);
@@ -281,12 +273,12 @@ int BKE_crazyspace_get_first_deform_matrices_editbmesh(
if (mti->type == eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
if (!defmats) {
const int required_mode = eModifierMode_Realtime | eModifierMode_Editmode;
- CustomDataMask data_mask = CD_MASK_BAREMESH;
- CDMaskLink *datamasks = modifiers_calcDataMasks(scene, ob, md, data_mask, required_mode, NULL, 0);
+ CustomData_MeshMasks data_mask = CD_MASK_BAREMESH;
+ CDMaskLink *datamasks = modifiers_calcDataMasks(scene, ob, md, &data_mask, required_mode, NULL, NULL);
data_mask = datamasks->mask;
BLI_linklist_free((LinkNode *)datamasks, NULL);
- me = BKE_mesh_from_editmesh_with_coords_thin_wrap(em, data_mask, NULL);
+ me = BKE_mesh_from_editmesh_with_coords_thin_wrap(em, &data_mask, NULL);
deformedVerts = editbmesh_get_vertex_cos(em, &numVerts);
defmats = MEM_mallocN(sizeof(*defmats) * numVerts, "defmats");
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 900c5c27024..2c6392fdf90 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/curve.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -40,6 +32,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
+#include "BLI_linklist.h"
#include "DNA_anim_types.h"
#include "DNA_curve_types.h"
@@ -55,20 +48,21 @@
#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BKE_font.h"
-#include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_material.h"
#include "DEG_depsgraph.h"
+#include "CLG_log.h"
+
/* globals */
/* local */
+static CLG_LogRef LOG = {"bke.curve"};
+
static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], const float v4[3],
short cox, short coy,
float *lambda, float *mu, float vec[3]);
@@ -193,7 +187,7 @@ Curve *BKE_curve_add(Main *bmain, const char *name, int type)
/**
* Only copy internal data of Curve ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -213,7 +207,7 @@ void BKE_curve_copy_data(Main *bmain, Curve *cu_dst, const Curve *cu_src, const
cu_dst->batch_cache = NULL;
if (cu_src->key && (flag & LIB_ID_COPY_SHAPEKEY)) {
- BKE_id_copy_ex(bmain, &cu_src->key->id, (ID **)&cu_dst->key, flag, false);
+ BKE_id_copy_ex(bmain, &cu_src->key->id, (ID **)&cu_dst->key, flag);
}
cu_dst->editnurb = NULL;
@@ -223,7 +217,7 @@ void BKE_curve_copy_data(Main *bmain, Curve *cu_dst, const Curve *cu_src, const
Curve *BKE_curve_copy(Main *bmain, const Curve *cu)
{
Curve *cu_copy;
- BKE_id_copy_ex(bmain, &cu->id, (ID **)&cu_copy, LIB_ID_COPY_SHAPEKEY, false);
+ BKE_id_copy(bmain, &cu->id, (ID **)&cu_copy);
return cu_copy;
}
@@ -326,21 +320,21 @@ void BKE_curve_boundbox_calc(Curve *cu, float r_loc[3], float r_size[3])
BoundBox *BKE_curve_boundbox_get(Object *ob)
{
/* This is Object-level data access, DO NOT touch to Mesh's bb, would be totally thread-unsafe. */
- if (ob->bb == NULL || ob->bb->flag & BOUNDBOX_DIRTY) {
+ if (ob->runtime.bb == NULL || ob->runtime.bb->flag & BOUNDBOX_DIRTY) {
Curve *cu = ob->data;
float min[3], max[3];
INIT_MINMAX(min, max);
BKE_curve_minmax(cu, true, min, max);
- if (ob->bb == NULL) {
- ob->bb = MEM_mallocN(sizeof(*ob->bb), __func__);
+ if (ob->runtime.bb == NULL) {
+ ob->runtime.bb = MEM_mallocN(sizeof(*ob->runtime.bb), __func__);
}
- BKE_boundbox_init_from_minmax(ob->bb, min, max);
- ob->bb->flag &= ~BOUNDBOX_DIRTY;
+ BKE_boundbox_init_from_minmax(ob->runtime.bb, min, max);
+ ob->runtime.bb->flag &= ~BOUNDBOX_DIRTY;
}
- return ob->bb;
+ return ob->runtime.bb;
}
void BKE_curve_texspace_calc(Curve *cu)
@@ -1035,7 +1029,7 @@ static void calcknots(float *knots, const int pnts, const short order, const sho
}
}
else {
- printf("bez nurb curve order is not 3 or 4, should never happen\n");
+ CLOG_ERROR(&LOG, "bez nurb curve order is not 3 or 4, should never happen");
}
break;
default:
@@ -1456,7 +1450,7 @@ void BKE_nurb_makeCurve(
madd_v3_v3fl(coord_fp, bp->vec, *fp);
if (tilt_fp)
- (*tilt_fp) += (*fp) * bp->alfa;
+ (*tilt_fp) += (*fp) * bp->tilt;
if (radius_fp)
(*radius_fp) += (*fp) * bp->radius;
@@ -1743,7 +1737,7 @@ float *BKE_curve_make_orco(Depsgraph *depsgraph, Scene *scene, Object *ob, int *
float *fp, *coord_array;
ListBase disp = {NULL, NULL};
- BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, &disp);
+ BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, &disp, NULL);
numVerts = 0;
for (dl = disp.first; dl; dl = dl->next) {
@@ -1836,7 +1830,8 @@ float *BKE_curve_make_orco(Depsgraph *depsgraph, Scene *scene, Object *ob, int *
void BKE_curve_bevel_make(
Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *disp,
- const bool for_render, const bool use_render_resolution)
+ const bool for_render, const bool use_render_resolution,
+ LinkNode *ob_cyclic_list)
{
DispList *dl, *dlnew;
Curve *bevcu, *cu;
@@ -1856,12 +1851,19 @@ void BKE_curve_bevel_make(
bevcu = cu->bevobj->data;
if (bevcu->ext1 == 0.0f && bevcu->ext2 == 0.0f) {
ListBase bevdisp = {NULL, NULL};
- facx = cu->bevobj->size[0];
- facy = cu->bevobj->size[1];
+ facx = cu->bevobj->scale[0];
+ facy = cu->bevobj->scale[1];
if (for_render) {
- BKE_displist_make_curveTypes_forRender(depsgraph, scene, cu->bevobj, &bevdisp, NULL, false, use_render_resolution);
- dl = bevdisp.first;
+ if (BLI_linklist_index(ob_cyclic_list, cu->bevobj) == -1) {
+ BKE_displist_make_curveTypes_forRender(
+ depsgraph, scene, cu->bevobj, &bevdisp, NULL, false, use_render_resolution,
+ &(LinkNode){ .link = ob, .next = ob_cyclic_list, });
+ dl = bevdisp.first;
+ }
+ else {
+ dl = NULL;
+ }
}
else if (cu->bevobj->runtime.curve_cache) {
dl = cu->bevobj->runtime.curve_cache->disp.first;
@@ -2186,8 +2188,9 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2,
}
-static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *tilt_array, float *radius_array,
- float *weight_array, int resolu, int stride)
+static void tilt_bezpart(
+ BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *tilt_array, float *radius_array,
+ float *weight_array, int resolu, int stride)
{
BezTriple *pprev, *next, *last;
float fac, dfac, t[4];
@@ -2224,12 +2227,12 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
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);
+ *tilt_array = prevbezt->tilt +
+ (bezt->tilt - prevbezt->tilt) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
}
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;
+ *tilt_array = t[0] * pprev->tilt + t[1] * prevbezt->tilt + t[2] * bezt->tilt + t[3] * next->tilt;
}
tilt_array = POINTER_OFFSET(tilt_array, stride);
@@ -2340,7 +2343,7 @@ static void bevel_list_apply_tilt(BevList *bl)
nr = bl->nr;
while (nr--) {
- axis_angle_to_quat(q, bevp1->dir, bevp1->alfa);
+ axis_angle_to_quat(q, bevp1->dir, bevp1->tilt);
mul_qt_qtqt(bevp1->quat, q, bevp1->quat);
normalize_qt(bevp1->quat);
@@ -2624,7 +2627,7 @@ static void make_bevel_list_segment_3D(BevList *bl)
vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
- axis_angle_to_quat(q, bevp1->dir, bevp1->alfa);
+ axis_angle_to_quat(q, bevp1->dir, bevp1->tilt);
mul_qt_qtqt(bevp1->quat, q, bevp1->quat);
normalize_qt(bevp1->quat);
copy_v3_v3(bevp2->dir, bevp1->dir);
@@ -2844,7 +2847,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
while (len--) {
copy_v3_v3(bevp->vec, bp->vec);
- bevp->alfa = bp->alfa;
+ bevp->tilt = bp->tilt;
bevp->radius = bp->radius;
bevp->weight = bp->weight;
bevp->split_tag = true;
@@ -2912,7 +2915,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
if (prevbezt->h2 == HD_VECT && bezt->h1 == HD_VECT) {
copy_v3_v3(bevp->vec, prevbezt->vec[1]);
- bevp->alfa = prevbezt->alfa;
+ bevp->tilt = prevbezt->tilt;
bevp->radius = prevbezt->radius;
bevp->weight = prevbezt->weight;
bevp->split_tag = true;
@@ -2941,8 +2944,8 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
}
/* if both arrays are NULL do nothiong */
- alfa_bezpart(prevbezt, bezt, nu,
- do_tilt ? &bevp->alfa : NULL,
+ tilt_bezpart(prevbezt, bezt, nu,
+ do_tilt ? &bevp->tilt : NULL,
do_radius ? &bevp->radius : NULL,
do_weight ? &bevp->weight : NULL,
resolu, sizeof(BevPoint));
@@ -2994,7 +2997,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
if ((nu->flagu & CU_NURB_CYCLIC) == 0) { /* not cyclic: endpoint */
copy_v3_v3(bevp->vec, prevbezt->vec[1]);
- bevp->alfa = prevbezt->alfa;
+ bevp->tilt = prevbezt->tilt;
bevp->radius = prevbezt->radius;
bevp->weight = prevbezt->weight;
@@ -3025,7 +3028,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
segbevcount = bl->segbevcount;
BKE_nurb_makeCurve(nu, &bevp->vec[0],
- do_tilt ? &bevp->alfa : NULL,
+ do_tilt ? &bevp->tilt : NULL,
do_radius ? &bevp->radius : NULL,
do_weight ? &bevp->weight : NULL,
resolu, sizeof(BevPoint));
@@ -3710,8 +3713,6 @@ static bool tridiagonal_solve_with_limits(float *a, float *b, float *c, float *d
* | | | | | |
* | | | | | |
* |-------t1---------t2--------- ~ --------tN-------------------> time (co 0)
- *
- *
* Mathematical basis:
*
* 1. Handle lengths on either side of each point are connected by a factor
@@ -4480,11 +4481,11 @@ void BKE_nurb_direction_switch(Nurb *nu)
if (bezt1 != bezt2) {
SWAP(char, bezt2->h1, bezt2->h2);
SWAP(char, bezt2->f1, bezt2->f3);
- bezt1->alfa = -bezt1->alfa;
- bezt2->alfa = -bezt2->alfa;
+ bezt1->tilt = -bezt1->tilt;
+ bezt2->tilt = -bezt2->tilt;
}
else {
- bezt1->alfa = -bezt1->alfa;
+ bezt1->tilt = -bezt1->tilt;
}
a--;
bezt1++;
@@ -4499,8 +4500,8 @@ void BKE_nurb_direction_switch(Nurb *nu)
while (bp1 != bp2 && a > 0) {
SWAP(BPoint, *bp1, *bp2);
a--;
- bp1->alfa = -bp1->alfa;
- bp2->alfa = -bp2->alfa;
+ bp1->tilt = -bp1->tilt;
+ bp2->tilt = -bp2->tilt;
bp1++;
bp2--;
}
@@ -4508,7 +4509,7 @@ void BKE_nurb_direction_switch(Nurb *nu)
* but still need to change it's tilt.
*/
if (nu->pntsu & 1) {
- bp1->alfa = -bp1->alfa;
+ bp1->tilt = -bp1->tilt;
}
if (nu->type == CU_NURBS) {
/* no knots for too short paths */
@@ -4666,7 +4667,7 @@ void BKE_curve_nurbs_keyVertexTilts_apply(ListBase *lb, float *key)
BezTriple *bezt = nu->bezt;
for (i = 0; i < nu->pntsu; i++, bezt++) {
- bezt->alfa = key[9];
+ bezt->tilt = key[9];
bezt->radius = key[10];
key += KEYELEM_FLOAT_LEN_BEZTRIPLE;
}
@@ -4675,7 +4676,7 @@ void BKE_curve_nurbs_keyVertexTilts_apply(ListBase *lb, float *key)
BPoint *bp = nu->bp;
for (i = 0; i < nu->pntsu * nu->pntsv; i++, bp++) {
- bp->alfa = key[3];
+ bp->tilt = key[3];
bp->radius = key[4];
key += KEYELEM_FLOAT_LEN_BPOINT;
}
diff --git a/source/blender/blenkernel/intern/curve_decimate.c b/source/blender/blenkernel/intern/curve_decimate.c
index 1a6c4714afd..4ac62578fa4 100644
--- a/source/blender/blenkernel/intern/curve_decimate.c
+++ b/source/blender/blenkernel/intern/curve_decimate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/curve_decimate.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_curve_types.h"
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 1fbeaf67596..c3e45480a57 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,13 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Ben Batt <benbatt@gmail.com>
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Implementation of CustomData.
*
* BKE_customdata.h contains the function prototypes for this file.
- *
*/
-/** \file blender/blenkernel/intern/customdata.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
@@ -52,8 +42,6 @@
#include "BKE_customdata.h"
#include "BKE_customdata_file.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_remap.h"
@@ -61,6 +49,8 @@
#include "bmesh.h"
+#include "CLG_log.h"
+
/* only for customdata_data_transfer_interp_normal_normals */
#include "data_transfer_intern.h"
@@ -70,6 +60,29 @@
/* ensure typemap size is ok */
BLI_STATIC_ASSERT(ARRAY_SIZE(((CustomData *)NULL)->typemap) == CD_NUMTYPES, "size mismatch");
+static CLG_LogRef LOG = {"bke.customdata"};
+
+
+/** Update mask_dst with layers defined in mask_src (equivalent to a bitwise OR). */
+void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
+{
+ mask_dst->vmask |= mask_src->vmask;
+ mask_dst->emask |= mask_src->emask;
+ mask_dst->fmask |= mask_src->fmask;
+ mask_dst->pmask |= mask_src->pmask;
+ mask_dst->lmask |= mask_src->lmask;
+}
+
+/** Return True if all layers set in \a mask_required are also set in \a mask_ref */
+bool CustomData_MeshMasks_are_matching(const CustomData_MeshMasks *mask_ref, const CustomData_MeshMasks *mask_required)
+{
+ return (((mask_required->vmask & mask_ref->vmask) == mask_required->vmask) &&
+ ((mask_required->emask & mask_ref->emask) == mask_required->emask) &&
+ ((mask_required->fmask & mask_ref->fmask) == mask_required->fmask) &&
+ ((mask_required->pmask & mask_ref->pmask) == mask_required->pmask) &&
+ ((mask_required->lmask & mask_ref->lmask) == mask_required->lmask));
+}
+
/********************* Layer type information **********************/
typedef struct LayerTypeInfo {
@@ -622,7 +635,7 @@ static int layerRead_mdisps(CDataFile *cdf, void *data, int count)
d[i].disps = MEM_calloc_arrayN(d[i].totdisp, 3 * sizeof(float), "mdisps read");
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);
+ CLOG_ERROR(&LOG, "failed to read multires displacement %d/%d %d", i, count, d[i].totdisp);
return 0;
}
}
@@ -637,7 +650,7 @@ static int layerWrite_mdisps(CDataFile *cdf, const void *data, int count)
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);
+ CLOG_ERROR(&LOG, "failed to write multires displacement %d/%d %d", i, count, d[i].totdisp);
return 0;
}
}
@@ -1379,59 +1392,83 @@ static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
};
-const CustomDataMask CD_MASK_BAREMESH =
- CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MLOOP | CD_MASK_MPOLY | CD_MASK_BWEIGHT | CD_MASK_FACEMAP;
-const CustomDataMask CD_MASK_MESH =
- CD_MASK_MVERT | CD_MASK_MEDGE |
- CD_MASK_MDEFORMVERT |
- CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_MDISPS |
- CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MPOLY | CD_MASK_MLOOP |
- CD_MASK_RECAST | CD_MASK_PAINT_MASK |
- CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE |
- CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_FACEMAP;
-const CustomDataMask CD_MASK_EDITMESH =
- CD_MASK_MDEFORMVERT | CD_MASK_MLOOPUV |
- CD_MASK_MLOOPCOL | CD_MASK_SHAPE_KEYINDEX |
- CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR |
- CD_MASK_MDISPS | CD_MASK_SHAPEKEY | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
- CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_FACEMAP;
-const CustomDataMask CD_MASK_DERIVEDMESH =
- CD_MASK_MDEFORMVERT |
- CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_CLOTH_ORCO |
- CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_PREVIEW_MLOOPCOL |
- CD_MASK_PROP_STR | CD_MASK_ORIGSPACE | CD_MASK_ORIGSPACE_MLOOP | CD_MASK_ORCO | CD_MASK_TANGENT |
- CD_MASK_PREVIEW_MCOL | CD_MASK_SHAPEKEY | CD_MASK_RECAST |
- CD_MASK_ORIGINDEX | CD_MASK_MVERT_SKIN | CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE |
- CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_FACEMAP;
-const CustomDataMask CD_MASK_BMESH =
- CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL |
- CD_MASK_MDEFORMVERT | CD_MASK_PROP_FLT | CD_MASK_PROP_INT |
- CD_MASK_PROP_STR | CD_MASK_SHAPEKEY | CD_MASK_SHAPE_KEYINDEX | CD_MASK_MDISPS |
- CD_MASK_CREASE | CD_MASK_BWEIGHT | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
- CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE |
- CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_FACEMAP;
+const CustomData_MeshMasks CD_MASK_BAREMESH = {
+ .vmask = CD_MASK_MVERT | CD_MASK_BWEIGHT,
+ .emask = CD_MASK_MEDGE | CD_MASK_BWEIGHT,
+ .fmask = 0,
+ .lmask = CD_MASK_MLOOP,
+ .pmask = CD_MASK_MPOLY | CD_MASK_FACEMAP,
+};
+const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX = {
+ .vmask = CD_MASK_MVERT | CD_MASK_BWEIGHT | CD_MASK_ORIGINDEX,
+ .emask = CD_MASK_MEDGE | CD_MASK_BWEIGHT | CD_MASK_ORIGINDEX,
+ .fmask = 0,
+ .lmask = CD_MASK_MLOOP,
+ .pmask = CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_ORIGINDEX,
+};
+const CustomData_MeshMasks CD_MASK_MESH = {
+ .vmask = (CD_MASK_MVERT | CD_MASK_MDEFORMVERT | CD_MASK_BWEIGHT | CD_MASK_MVERT_SKIN | CD_MASK_PAINT_MASK |
+ CD_MASK_GENERIC_DATA),
+ .emask = (CD_MASK_MEDGE | CD_MASK_BWEIGHT | CD_MASK_FREESTYLE_EDGE | CD_MASK_GENERIC_DATA),
+ .fmask = 0,
+ .lmask = (CD_MASK_MLOOP | CD_MASK_MDISPS | CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_CUSTOMLOOPNORMAL |
+ CD_MASK_GRID_PAINT_MASK | CD_MASK_GENERIC_DATA),
+ .pmask = (CD_MASK_MPOLY | CD_MASK_RECAST | CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | CD_MASK_GENERIC_DATA),
+};
+const CustomData_MeshMasks CD_MASK_EDITMESH = {
+ .vmask = (CD_MASK_MDEFORMVERT | CD_MASK_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_SHAPEKEY |
+ CD_MASK_SHAPE_KEYINDEX | CD_MASK_GENERIC_DATA),
+ .emask = (CD_MASK_GENERIC_DATA),
+ .fmask = 0,
+ .lmask = (CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_GRID_PAINT_MASK |
+ CD_MASK_GENERIC_DATA),
+ .pmask = (CD_MASK_MDISPS | CD_MASK_RECAST | CD_MASK_FACEMAP | CD_MASK_GENERIC_DATA),
+};
+const CustomData_MeshMasks CD_MASK_DERIVEDMESH = {
+ .vmask = (CD_MASK_ORIGINDEX | CD_MASK_MDEFORMVERT | CD_MASK_SHAPEKEY | CD_MASK_MVERT_SKIN |
+ CD_MASK_ORCO | CD_MASK_CLOTH_ORCO | CD_MASK_GENERIC_DATA),
+ .emask = (CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_EDGE | CD_MASK_GENERIC_DATA),
+ .fmask = (CD_MASK_ORIGINDEX | CD_MASK_ORIGSPACE | CD_MASK_PREVIEW_MCOL | CD_MASK_TANGENT),
+ .lmask = (CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_PREVIEW_MLOOPCOL |
+ CD_MASK_ORIGSPACE_MLOOP | CD_MASK_TANGENT | CD_MASK_GENERIC_DATA),
+ .pmask = (CD_MASK_ORIGINDEX | CD_MASK_RECAST | CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | CD_MASK_GENERIC_DATA),
+};
+const CustomData_MeshMasks CD_MASK_BMESH = {
+ .vmask = (CD_MASK_MDEFORMVERT | CD_MASK_BWEIGHT | CD_MASK_MVERT_SKIN | CD_MASK_SHAPEKEY |
+ CD_MASK_SHAPE_KEYINDEX | CD_MASK_PAINT_MASK | CD_MASK_GENERIC_DATA),
+ .emask = (CD_MASK_BWEIGHT | CD_MASK_CREASE | CD_MASK_FREESTYLE_EDGE | CD_MASK_GENERIC_DATA),
+ .fmask = 0,
+ .lmask = (CD_MASK_MDISPS | CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_CUSTOMLOOPNORMAL |
+ CD_MASK_GRID_PAINT_MASK | CD_MASK_GENERIC_DATA),
+ .pmask = (CD_MASK_RECAST | CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | CD_MASK_GENERIC_DATA),
+};
/**
* cover values copied by #BKE_mesh_loops_to_tessdata
*/
-const CustomDataMask CD_MASK_FACECORNERS =
- CD_MASK_MTFACE | CD_MASK_MLOOPUV |
- CD_MASK_MCOL | CD_MASK_MLOOPCOL |
- CD_MASK_PREVIEW_MCOL | CD_MASK_PREVIEW_MLOOPCOL |
- CD_MASK_ORIGSPACE | CD_MASK_ORIGSPACE_MLOOP |
- CD_MASK_TESSLOOPNORMAL | CD_MASK_NORMAL |
- CD_MASK_TANGENT | CD_MASK_MLOOPTANGENT;
-const CustomDataMask CD_MASK_EVERYTHING =
- CD_MASK_MVERT | CD_MASK_MDEFORMVERT | CD_MASK_MEDGE | CD_MASK_MFACE |
- CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_ORIGINDEX | CD_MASK_NORMAL /* | CD_MASK_POLYINDEX */ | CD_MASK_PROP_FLT |
- CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_ORIGSPACE | CD_MASK_ORCO | CD_MASK_MLOOPUV |
- CD_MASK_MLOOPCOL | CD_MASK_TANGENT | CD_MASK_MDISPS | CD_MASK_PREVIEW_MCOL | CD_MASK_CLOTH_ORCO | CD_MASK_RECAST |
- /* BMESH ONLY START */
- CD_MASK_MPOLY | CD_MASK_MLOOP | CD_MASK_SHAPE_KEYINDEX | CD_MASK_SHAPEKEY | CD_MASK_BWEIGHT | CD_MASK_CREASE |
- CD_MASK_ORIGSPACE_MLOOP | CD_MASK_PREVIEW_MLOOPCOL | CD_MASK_BM_ELEM_PYPTR |
- /* BMESH ONLY END */
- CD_MASK_PAINT_MASK | CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN |
- CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE |
- CD_MASK_MLOOPTANGENT | CD_MASK_TESSLOOPNORMAL | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_FACEMAP;
+const CustomData_MeshMasks CD_MASK_FACECORNERS = {
+ .vmask = 0,
+ .emask = 0,
+ .fmask = (CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_PREVIEW_MCOL | CD_MASK_ORIGSPACE |
+ CD_MASK_TESSLOOPNORMAL | CD_MASK_TANGENT),
+ .lmask = (CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_PREVIEW_MLOOPCOL | CD_MASK_ORIGSPACE_MLOOP |
+ CD_MASK_NORMAL | CD_MASK_MLOOPTANGENT),
+ .pmask = 0,
+};
+const CustomData_MeshMasks CD_MASK_EVERYTHING = {
+ .vmask = (CD_MASK_MVERT | CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_NORMAL | CD_MASK_MDEFORMVERT |
+ CD_MASK_BWEIGHT | CD_MASK_MVERT_SKIN | CD_MASK_ORCO | CD_MASK_CLOTH_ORCO | CD_MASK_SHAPEKEY |
+ CD_MASK_SHAPE_KEYINDEX | CD_MASK_PAINT_MASK | CD_MASK_GENERIC_DATA),
+ .emask = (CD_MASK_MEDGE | CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_BWEIGHT | CD_MASK_CREASE |
+ CD_MASK_FREESTYLE_EDGE | CD_MASK_GENERIC_DATA),
+ .fmask = (CD_MASK_MFACE | CD_MASK_ORIGINDEX | CD_MASK_NORMAL | CD_MASK_MTFACE | CD_MASK_MCOL |
+ CD_MASK_ORIGSPACE | CD_MASK_TANGENT | CD_MASK_TESSLOOPNORMAL | CD_MASK_PREVIEW_MCOL |
+ CD_MASK_GENERIC_DATA),
+ .lmask = (CD_MASK_MLOOP | CD_MASK_BM_ELEM_PYPTR | CD_MASK_MDISPS | CD_MASK_NORMAL | CD_MASK_MLOOPUV |
+ CD_MASK_MLOOPCOL | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_MLOOPTANGENT | CD_MASK_PREVIEW_MLOOPCOL |
+ CD_MASK_ORIGSPACE_MLOOP | CD_MASK_GRID_PAINT_MASK | CD_MASK_GENERIC_DATA),
+ .pmask = (CD_MASK_MPOLY | CD_MASK_BM_ELEM_PYPTR | CD_MASK_ORIGINDEX | CD_MASK_NORMAL | CD_MASK_RECAST |
+ CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | CD_MASK_GENERIC_DATA),
+};
static const LayerTypeInfo *layerType_getInfo(int type)
{
@@ -1447,13 +1484,41 @@ static const char *layerType_getName(int type)
return LAYERTYPENAMES[type];
}
-void customData_mask_layers__print(CustomDataMask mask)
+void customData_mask_layers__print(const CustomData_MeshMasks *mask)
{
int i;
- printf("mask=0x%lx:\n", (long unsigned int)mask);
+ printf("verts mask=0x%lx:\n", (long unsigned int)mask->vmask);
for (i = 0; i < CD_NUMTYPES; i++) {
- if (mask & CD_TYPE_AS_MASK(i)) {
+ if (mask->vmask & CD_TYPE_AS_MASK(i)) {
+ printf(" %s\n", layerType_getName(i));
+ }
+ }
+
+ printf("edges mask=0x%lx:\n", (long unsigned int)mask->emask);
+ for (i = 0; i < CD_NUMTYPES; i++) {
+ if (mask->emask & CD_TYPE_AS_MASK(i)) {
+ printf(" %s\n", layerType_getName(i));
+ }
+ }
+
+ printf("faces mask=0x%lx:\n", (long unsigned int)mask->fmask);
+ for (i = 0; i < CD_NUMTYPES; i++) {
+ if (mask->fmask & CD_TYPE_AS_MASK(i)) {
+ printf(" %s\n", layerType_getName(i));
+ }
+ }
+
+ printf("loops mask=0x%lx:\n", (long unsigned int)mask->lmask);
+ for (i = 0; i < CD_NUMTYPES; i++) {
+ if (mask->lmask & CD_TYPE_AS_MASK(i)) {
+ printf(" %s\n", layerType_getName(i));
+ }
+ }
+
+ printf("polys mask=0x%lx:\n", (long unsigned int)mask->pmask);
+ for (i = 0; i < CD_NUMTYPES; i++) {
+ if (mask->pmask & CD_TYPE_AS_MASK(i)) {
printf(" %s\n", layerType_getName(i));
}
}
@@ -1862,6 +1927,17 @@ void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
data->layers[i].flag |= flag;
}
+void CustomData_clear_layer_flag(struct CustomData *data, int type, int flag)
+{
+ const int nflag = ~flag;
+
+ for (int i = 0; i < data->totlayer; ++i) {
+ if (data->layers[i].type == type) {
+ data->layers[i].flag &= nflag;
+ }
+ }
+}
+
static int customData_resize(CustomData *data, int amount)
{
CustomDataLayer *tmp = MEM_calloc_arrayN((data->maxlayer + amount), sizeof(*tmp),
@@ -2243,9 +2319,9 @@ static void CustomData_copy_data_layer(
if (!count || !src_data || !dst_data) {
if (count && !(src_data == NULL && dst_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 *)dst_data);
+ CLOG_WARN(&LOG, "null data for %s type (%p --> %p), skipping",
+ layerType_getName(source->layers[src_i].type),
+ (void *)src_data, (void *)dst_data);
}
return;
}
@@ -3405,7 +3481,7 @@ void CustomData_file_write_prepare(
CustomDataLayer *layer = &data->layers[i];
if (layer->flag & CD_FLAG_NOCOPY) { /* Layers with this flag set are not written to file. */
data->totlayer--;
- /* printf("%s: skipping layer %p (%s)\n", __func__, layer, layer->name); */
+ /* CLOG_WARN(&LOG, "skipping layer %p (%s)", layer, layer->name); */
}
else {
if (UNLIKELY((size_t)j >= write_layers_size)) {
@@ -3658,7 +3734,7 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int
cdf = cdf_create(CDF_TYPE_MESH);
if (!cdf_read_open(cdf, filename)) {
cdf_free(cdf);
- fprintf(stderr, "Failed to read %s layer from %s.\n", layerType_getName(layer->type), filename);
+ CLOG_ERROR(&LOG, "Failed to read %s layer from %s.", layerType_getName(layer->type), filename);
return;
}
@@ -3747,7 +3823,7 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
}
if (!cdf_write_open(cdf, filename)) {
- fprintf(stderr, "Failed to open %s for writing.\n", filename);
+ CLOG_ERROR(&LOG, "Failed to open %s for writing.", filename);
cdf_free(cdf);
return;
}
@@ -3774,7 +3850,7 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
}
if (i != data->totlayer) {
- fprintf(stderr, "Failed to write data to %s.\n", filename);
+ CLOG_ERROR(&LOG, "Failed to write data to %s.", filename);
cdf_write_close(cdf);
cdf_free(cdf);
return;
@@ -3879,7 +3955,7 @@ static void copy_bit_flag(void *dst, const void *src, const size_t data_size, co
COPY_BIT_FLAG(uint64_t, dst, src, flag);
break;
default:
- //printf("ERROR %s: Unknown flags-container size (%zu)\n", __func__, datasize);
+ //CLOG_ERROR(&LOG, "Unknown flags-container size (%zu)", datasize);
break;
}
@@ -3898,7 +3974,7 @@ static bool check_bit_flag(const void *data, const size_t data_size, const uint6
case 8:
return ((*((uint64_t *)data) & ((uint64_t)flag)) != 0);
default:
- //printf("ERROR %s: Unknown flags-container size (%zu)\n", __func__, datasize);
+ //CLOG_ERROR(&LOG, "Unknown flags-container size (%zu)", datasize);
return false;
}
}
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index 3350d8e7b2f..2facb0f1ad8 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/customdata_file.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index 9ee27a29c8b..4c4d57ddbac 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,14 @@
*
* The Original Code is Copyright (C) 2014 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bastien Montagne.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/data_transfer.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "DNA_customdata_types.h"
@@ -37,12 +31,10 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_array.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_data_transfer.h"
#include "BKE_deform.h"
@@ -50,19 +42,18 @@
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_runtime.h"
#include "BKE_mesh_remap.h"
+#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_object_deform.h"
#include "BKE_report.h"
#include "data_transfer_intern.h"
+static CLG_LogRef LOG = {"bke.data_transfer"};
-CustomDataMask BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types)
+void BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types, CustomData_MeshMasks *r_data_masks)
{
- CustomDataMask cddata_mask = 0;
- int i;
-
- for (i = 0; i < DT_TYPE_MAX; i++) {
+ for (int i = 0; i < DT_TYPE_MAX; i++) {
const int dtdata_type = 1 << i;
int cddata_type;
@@ -72,20 +63,30 @@ CustomDataMask BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types
cddata_type = BKE_object_data_transfer_dttype_to_cdtype(dtdata_type);
if (!(cddata_type & CD_FAKE)) {
- cddata_mask |= 1LL << cddata_type;
+ if (DT_DATATYPE_IS_VERT(dtdata_type)) {
+ r_data_masks->vmask |= 1LL << cddata_type;
+ }
+ else if (DT_DATATYPE_IS_EDGE(dtdata_type)) {
+ r_data_masks->emask |= 1LL << cddata_type;
+ }
+ else if (DT_DATATYPE_IS_LOOP(dtdata_type)) {
+ r_data_masks->lmask |= 1LL << cddata_type;
+ }
+ else if (DT_DATATYPE_IS_POLY(dtdata_type)) {
+ r_data_masks->pmask |= 1LL << cddata_type;
+ }
}
else if (cddata_type == CD_FAKE_MDEFORMVERT) {
- cddata_mask |= CD_MASK_MDEFORMVERT; /* Exception for vgroups :/ */
+ r_data_masks->vmask |= CD_MASK_MDEFORMVERT; /* Exception for vgroups :/ */
}
else if (cddata_type == CD_FAKE_UV) {
- cddata_mask |= CD_MASK_MLOOPUV;
+ r_data_masks->lmask |= CD_MASK_MLOOPUV;
}
else if (cddata_type == CD_FAKE_LNOR) {
- cddata_mask |= CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL;
+ r_data_masks->vmask |= CD_MASK_NORMAL;
+ r_data_masks->lmask |= CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL;
}
}
-
- return cddata_mask;
}
/* Check what can do each layer type (if it is actually handled by transferdata, if it supports advanced mixing... */
@@ -256,7 +257,7 @@ int BKE_object_data_transfer_dttype_to_srcdst_index(const int dtdata_type)
static void data_transfer_dtdata_type_preprocess(
Mesh *me_src, Mesh *me_dst,
- const int dtdata_type, const bool dirty_nors_dst)
+ const int dtdata_type, const bool dirty_nors_dst, const bool is_modifier)
{
if (dtdata_type == DT_TYPE_LNOR) {
/* Compute custom normals into regular loop normals, which will be used for the transfer. */
@@ -274,7 +275,9 @@ static void data_transfer_dtdata_type_preprocess(
const bool use_split_nors_dst = (me_dst->flag & ME_AUTOSMOOTH) != 0;
const float split_angle_dst = me_dst->smoothresh;
- BKE_mesh_calc_normals_split(me_src);
+ if (!is_modifier) {
+ BKE_mesh_calc_normals_split(me_src);
+ }
float (*poly_nors_dst)[3];
float (*loop_nors_dst)[3];
@@ -509,12 +512,15 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(
idx_src++;
if (idx_dst < idx_src) {
- if (!use_create) {
- return true;
+ if (use_create) {
+ /* Create as much data layers as necessary! */
+ for (; idx_dst < idx_src; idx_dst++) {
+ CustomData_add_layer(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst);
+ }
}
- /* Create as much data layers as necessary! */
- for (; idx_dst < idx_src; idx_dst++) {
- CustomData_add_layer(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst);
+ else {
+ /* Otherwise, just try to map what we can with existing dst data layers. */
+ idx_src = idx_dst;
}
}
else if (use_delete && idx_dst > idx_src) {
@@ -559,14 +565,14 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(
data_src = CustomData_get_layer_n(cd_src, cddata_type, idx_src);
if ((idx_dst = CustomData_get_named_layer(cd_dst, cddata_type, name)) == -1) {
- if (!use_create) {
- if (r_map) {
- BLI_freelistN(r_map);
- }
- return true;
+ if (use_create) {
+ CustomData_add_layer_named(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst, name);
+ idx_dst = CustomData_get_named_layer(cd_dst, cddata_type, name);
+ }
+ else {
+ /* If we are not allowed to create missing dst data layers, just skip matching src one. */
+ continue;
}
- CustomData_add_layer_named(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst, name);
- idx_dst = CustomData_get_named_layer(cd_dst, cddata_type, name);
}
else if (data_dst_to_delete) {
data_dst_to_delete[idx_dst] = false;
@@ -993,15 +999,15 @@ void BKE_object_data_transfer_layout(
const bool use_create = true; /* We always create needed layers here. */
- CustomDataMask me_src_mask = CD_MASK_BAREMESH;
+ CustomData_MeshMasks me_src_mask = CD_MASK_BAREMESH;
BLI_assert((ob_src != ob_dst) && (ob_src->type == OB_MESH) && (ob_dst->type == OB_MESH));
me_dst = ob_dst->data;
/* Get source evaluated mesh.*/
- me_src_mask |= BKE_object_data_transfer_dttypes_to_cdmask(data_types);
- me_src = mesh_get_eval_final(depsgraph, scene, ob_src, me_src_mask);
+ BKE_object_data_transfer_dttypes_to_cdmask(data_types, &me_src_mask);
+ me_src = mesh_get_eval_final(depsgraph, scene, ob_src, &me_src_mask);
if (!me_src) {
return;
}
@@ -1091,7 +1097,7 @@ bool BKE_object_data_transfer_ex(
const bool use_delete = false; /* We never delete data layers from destination here. */
- CustomDataMask me_src_mask = CD_MASK_BAREMESH;
+ CustomData_MeshMasks me_src_mask = CD_MASK_BAREMESH;
BLI_assert((ob_src != ob_dst) && (ob_src->type == OB_MESH) && (ob_dst->type == OB_MESH));
@@ -1114,17 +1120,17 @@ bool BKE_object_data_transfer_ex(
}
/* Get source evaluated mesh.*/
- me_src_mask |= BKE_object_data_transfer_dttypes_to_cdmask(data_types);
+ BKE_object_data_transfer_dttypes_to_cdmask(data_types, &me_src_mask);
if (is_modifier) {
- me_src = ob_src->runtime.mesh_eval;
+ me_src = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_src, false);
- if (me_src == NULL || (me_src_mask & ~ob_src->runtime.last_data_mask) != 0) {
- printf("Data Transfer: source mesh data is not ready - dependency cycle?\n");
+ if (me_src == NULL || !CustomData_MeshMasks_are_matching(&ob_src->runtime.last_data_mask, &me_src_mask)) {
+ CLOG_WARN(&LOG, "Data Transfer: source mesh data is not ready - dependency cycle?");
return changed;
}
}
else {
- me_src = mesh_get_eval_final(depsgraph, scene, ob_src, me_src_mask);
+ me_src = mesh_get_eval_final(depsgraph, scene, ob_src, &me_src_mask);
}
if (!me_src) {
return changed;
@@ -1149,7 +1155,7 @@ bool BKE_object_data_transfer_ex(
continue;
}
- data_transfer_dtdata_type_preprocess(me_src, me_dst, dtdata_type, dirty_nors_dst);
+ data_transfer_dtdata_type_preprocess(me_src, me_dst, dtdata_type, dirty_nors_dst, is_modifier);
cddata_type = BKE_object_data_transfer_dttype_to_cdtype(dtdata_type);
diff --git a/source/blender/blenkernel/intern/data_transfer_intern.h b/source/blender/blenkernel/intern/data_transfer_intern.h
index 1a543a1deb5..ca8e85c2363 100644
--- a/source/blender/blenkernel/intern/data_transfer_intern.h
+++ b/source/blender/blenkernel/intern/data_transfer_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/data_transfer_intern.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __DATA_TRANSFER_INTERN_H__
@@ -33,8 +26,8 @@
#include "BKE_customdata.h" /* For cd_datatransfer_interp */
-struct CustomDataTransferLayerMap;
struct CustomData;
+struct CustomDataTransferLayerMap;
struct ListBase;
float data_transfer_interp_float_do(
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index e61b8f71ffa..3e6649085dd 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Reevan McKay
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/deform.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -845,7 +837,6 @@ float BKE_defvert_multipaint_collective_weight(
/* -------------------------------------------------------------------- */
-
/** \name Defvert Array functions
* \{ */
@@ -997,7 +988,6 @@ void BKE_defvert_extract_vgroup_to_polyweights(
/* -------------------------------------------------------------------- */
-
/** \name Data Transfer
* \{ */
@@ -1071,12 +1061,15 @@ static bool data_transfer_layersmapping_vgroups_multisrc_to_dst(
idx_src++;
if (idx_dst < idx_src) {
- if (!use_create) {
- return false;
+ if (use_create) {
+ /* Create as much vgroups as necessary! */
+ for (; idx_dst < idx_src; idx_dst++) {
+ BKE_object_defgroup_add(ob_dst);
+ }
}
- /* Create as much vgroups as necessary! */
- for (; idx_dst < idx_src; idx_dst++) {
- BKE_object_defgroup_add(ob_dst);
+ else {
+ /* Otherwise, just try to map what we can with existing dst vgroups. */
+ idx_src = idx_dst;
}
}
else if (use_delete && idx_dst > idx_src) {
@@ -1126,14 +1119,14 @@ static bool data_transfer_layersmapping_vgroups_multisrc_to_dst(
}
if ((idx_dst = defgroup_name_index(ob_dst, dg_src->name)) == -1) {
- if (!use_create) {
- if (r_map) {
- BLI_freelistN(r_map);
- }
- return false;
+ if (use_create) {
+ BKE_object_defgroup_add_name(ob_dst, dg_src->name);
+ idx_dst = ob_dst->actdef - 1;
+ }
+ else {
+ /* If we are not allowed to create missing dst vgroups, just skip matching src one. */
+ continue;
}
- BKE_object_defgroup_add_name(ob_dst, dg_src->name);
- idx_dst = ob_dst->actdef - 1;
}
if (r_map) {
/* At this stage, we **need** a valid CD_MDEFORMVERT layer on dest!
@@ -1195,8 +1188,8 @@ bool data_transfer_layersmapping_vgroups(
idx_src = fromlayers;
if (idx_src >= BLI_listbase_count(&ob_src->defbase)) {
/* This can happen when vgroups are removed from source object...
- * Remapping would be really tricky here, we'd need to go over all objects in Main everytime we delete
- * a vgroup... for now, simpler and safer to abort. */
+ * Remapping would be really tricky here, we'd need to go over all objects in
+ * Main every time we delete a vgroup... for now, simpler and safer to abort. */
return false;
}
}
@@ -1296,7 +1289,6 @@ bool data_transfer_layersmapping_vgroups(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Various utils & helpers.
* \{ */
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index c5c503966c4..f0b7431d989 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/displist.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -47,13 +39,12 @@
#include "BLI_math.h"
#include "BLI_scanfill.h"
#include "BLI_utildefines.h"
+#include "BLI_linklist.h"
-#include "BKE_global.h"
#include "BKE_displist.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_object.h"
#include "BKE_library.h"
-#include "BKE_main.h"
#include "BKE_mball.h"
#include "BKE_mball_tessellate.h"
#include "BKE_mesh.h"
@@ -236,12 +227,16 @@ void BKE_displist_count(ListBase *lb, int *totvert, int *totface, int *tottri)
int vert_tot = 0;
int face_tot = 0;
int tri_tot = 0;
+ bool cyclic_u = dl->flag & DL_CYCL_U;
+ bool cyclic_v = dl->flag & DL_CYCL_V;
switch (dl->type) {
case DL_SURF:
{
+ int segments_u = dl->nr - (cyclic_u == false);
+ int segments_v = dl->parts - (cyclic_v == false);
vert_tot = dl->nr * dl->parts;
- face_tot = (dl->nr - 1) * (dl->parts - 1);
+ face_tot = segments_u * segments_v;
tri_tot = face_tot * 2;
break;
}
@@ -694,7 +689,7 @@ static float displist_calc_taper(Depsgraph *depsgraph, Scene *scene, Object *tap
dl = taperobj->runtime.curve_cache ? taperobj->runtime.curve_cache->disp.first : NULL;
if (dl == NULL) {
- BKE_displist_make_curveTypes(depsgraph, scene, taperobj, false, false);
+ BKE_displist_make_curveTypes(depsgraph, scene, taperobj, false, false, NULL);
dl = taperobj->runtime.curve_cache->disp.first;
}
if (dl) {
@@ -1009,10 +1004,7 @@ static void curve_calc_modifiers_post(
if (modified) {
if (vertCos) {
Mesh *temp_mesh;
- BKE_id_copy_ex(NULL, &modified->id, (ID **)&temp_mesh,
- LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &modified->id, (ID **)&temp_mesh, LIB_ID_COPY_LOCALIZE);
BKE_id_free(NULL, modified);
modified = temp_mesh;
@@ -1055,10 +1047,7 @@ static void curve_calc_modifiers_post(
if (vertCos) {
if (modified) {
Mesh *temp_mesh;
- BKE_id_copy_ex(NULL, &modified->id, (ID **)&temp_mesh,
- LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &modified->id, (ID **)&temp_mesh, LIB_ID_COPY_LOCALIZE);
BKE_id_free(NULL, modified);
modified = temp_mesh;
@@ -1571,8 +1560,9 @@ static void calc_bevfac_mapping(Curve *cu, BevList *bl, Nurb *nu,
static void do_makeDispListCurveTypes(
Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase,
- Mesh **r_final,
- const bool for_render, const bool for_orco, const bool use_render_resolution)
+ const bool for_render, const bool for_orco, const bool use_render_resolution,
+ LinkNode *ob_cyclic_list,
+ Mesh **r_final)
{
Curve *cu = ob->data;
@@ -1610,7 +1600,9 @@ static void do_makeDispListCurveTypes(
BKE_curve_bevelList_make(ob, &nubase, use_render_resolution);
/* If curve has no bevel will return nothing */
- BKE_curve_bevel_make(depsgraph, scene, ob, &dlbev, for_render, use_render_resolution);
+ BKE_curve_bevel_make(
+ depsgraph, scene, ob, &dlbev, for_render, use_render_resolution,
+ ob_cyclic_list);
/* no bevel or extrude, and no width correction? */
if (!dlbev.first && cu->width == 1.0f) {
@@ -1818,7 +1810,8 @@ static void do_makeDispListCurveTypes(
}
void BKE_displist_make_curveTypes(
- Depsgraph *depsgraph, Scene *scene, Object *ob, const bool for_render, const bool for_orco)
+ Depsgraph *depsgraph, Scene *scene, Object *ob, const bool for_render, const bool for_orco,
+ LinkNode *ob_cyclic_list)
{
ListBase *dispbase;
@@ -1836,7 +1829,10 @@ void BKE_displist_make_curveTypes(
dispbase = &(ob->runtime.curve_cache->disp);
- do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, &ob->runtime.mesh_eval, for_render, for_orco, false);
+ do_makeDispListCurveTypes(
+ depsgraph, scene, ob, dispbase, for_render, for_orco, false,
+ ob_cyclic_list,
+ &ob->runtime.mesh_eval);
boundbox_displist_object(ob);
}
@@ -1844,23 +1840,31 @@ void BKE_displist_make_curveTypes(
void BKE_displist_make_curveTypes_forRender(
Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase,
Mesh **r_final, const bool for_orco,
- const bool use_render_resolution)
+ const bool use_render_resolution,
+ LinkNode *ob_cyclic_list)
{
if (ob->runtime.curve_cache == NULL) {
ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve");
}
- do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, r_final, true, for_orco, use_render_resolution);
+ do_makeDispListCurveTypes(
+ depsgraph, scene, ob, dispbase, true, for_orco, use_render_resolution,
+ ob_cyclic_list,
+ r_final);
}
void BKE_displist_make_curveTypes_forOrco(
- Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase)
+ Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase,
+ LinkNode *ob_cyclic_list)
{
if (ob->runtime.curve_cache == NULL) {
ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve");
}
- do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, NULL, 1, 1, 1);
+ do_makeDispListCurveTypes(
+ depsgraph, scene, ob, dispbase, 1, 1, 1,
+ ob_cyclic_list,
+ NULL);
}
void BKE_displist_minmax(ListBase *dispbase, float min[3], float max[3])
@@ -1895,8 +1899,8 @@ static void boundbox_displist_object(Object *ob)
*/
/* object's BB is calculated from final displist */
- if (ob->bb == NULL)
- ob->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
+ if (ob->runtime.bb == NULL)
+ ob->runtime.bb = MEM_callocN(sizeof(BoundBox), "boundbox");
if (ob->runtime.mesh_eval) {
BKE_object_boundbox_calc_from_mesh(ob, ob->runtime.mesh_eval);
@@ -1906,9 +1910,9 @@ static void boundbox_displist_object(Object *ob)
INIT_MINMAX(min, max);
BKE_displist_minmax(&ob->runtime.curve_cache->disp, min, max);
- BKE_boundbox_init_from_minmax(ob->bb, min, max);
+ BKE_boundbox_init_from_minmax(ob->runtime.bb, min, max);
- ob->bb->flag &= ~BOUNDBOX_DIRTY;
+ ob->runtime.bb->flag &= ~BOUNDBOX_DIRTY;
}
}
}
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 590fe559ff0..daadc2e1fad 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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/blenkernel/intern/dynamicpaint.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
@@ -63,7 +57,6 @@
#include "BKE_deform.h"
#include "BKE_dynamicpaint.h"
#include "BKE_effect.h"
-#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_library.h"
#include "BKE_main.h"
@@ -90,11 +83,15 @@
#include "atomic_ops.h"
+#include "CLG_log.h"
+
/* could enable at some point but for now there are far too many conversions */
#ifdef __GNUC__
//# pragma GCC diagnostic ignored "-Wdouble-promotion"
#endif
+static CLG_LogRef LOG = {"bke.dynamicpaint"};
+
/* precalculated gaussian factors for 5x super sampling */
static const float gaussianFactors[5] = {
0.996849f,
@@ -241,6 +238,7 @@ static int setError(DynamicPaintCanvasSettings *canvas, const char *string)
{
/* Add error to canvas ui info label */
BLI_strncpy(canvas->error, string, sizeof(canvas->error));
+ CLOG_STR_ERROR(&LOG, string);
return 0;
}
@@ -1580,7 +1578,7 @@ static void dynamicPaint_setInitialColor(const Scene *scene, DynamicPaintSurface
DynamicPaintSetInitColorData data = {
.surface = surface,
.mloop = mloop, .mlooptri = mlooptri, .mloopuv = mloopuv, .pool = pool,
- .scene_color_manage = scene_color_manage
+ .scene_color_manage = scene_color_manage,
};
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
@@ -1595,7 +1593,7 @@ static void dynamicPaint_setInitialColor(const Scene *scene, DynamicPaintSurface
DynamicPaintSetInitColorData data = {
.surface = surface,
.mlooptri = mlooptri, .mloopuv = mloopuv,
- .scene_color_manage = scene_color_manage
+ .scene_color_manage = scene_color_manage,
};
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
@@ -1756,7 +1754,7 @@ static void dynamicPaint_applySurfaceDisplace(DynamicPaintSurface *surface, Mesh
if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) {
MVert *mvert = result->mvert;
- DynamicPaintModifierApplyData data = {.surface = surface, .mvert = mvert};
+ DynamicPaintModifierApplyData data = { .surface = surface, .mvert = mvert, };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (sData->total_points > 10000);
@@ -1903,7 +1901,7 @@ static Mesh *dynamicPaint_Modifier_apply(
/* paint is stored on dry and wet layers, so mix final color first */
float (*fcolor)[4] = MEM_callocN(sizeof(*fcolor) * sData->total_points, "Temp paint color");
- DynamicPaintModifierApplyData data = {.surface = surface, .fcolor = fcolor};
+ DynamicPaintModifierApplyData data = { .surface = surface, .fcolor = fcolor, };
{
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
@@ -2007,7 +2005,7 @@ static Mesh *dynamicPaint_Modifier_apply(
else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
MVert *mvert = result->mvert;
- DynamicPaintModifierApplyData data = {.surface = surface, .mvert = mvert};
+ DynamicPaintModifierApplyData data = { .surface = surface, .mvert = mvert, };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (sData->total_points > 1000);
@@ -2481,7 +2479,7 @@ static int dynamic_paint_find_neighbour_pixel(
DynamicPaintFindIslandBorderData bdata = {
.vert_to_looptri_map = vert_to_looptri_map,
.w = w, .h = h, .px = px, .py = py,
- .best_index = NOT_FOUND, .best_weight = 1.0f
+ .best_index = NOT_FOUND, .best_weight = 1.0f,
};
float pixel[2];
@@ -2811,7 +2809,7 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
/*
* Start generating the surface
*/
- printf("DynamicPaint: Preparing UV surface of %ix%i pixels and %i tris.\n", w, h, tottri);
+ CLOG_INFO(&LOG, 1, "Preparing UV surface of %ix%i pixels and %i tris.", w, h, tottri);
/* Init data struct */
if (surface->data)
@@ -3236,7 +3234,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
return;
}
- DynamicPaintOutputSurfaceImageData data = {.surface = surface, .ibuf = ibuf};
+ DynamicPaintOutputSurfaceImageData data = { .surface = surface, .ibuf = ibuf, };
switch (surface->type) {
case MOD_DPAINT_SURFACE_T_PAINT:
switch (output_layer) {
@@ -4191,7 +4189,7 @@ static int dynamicPaint_paintMesh(Depsgraph *depsgraph, DynamicPaintSurface *sur
.scene = scene, .timescale = timescale, .c_index = c_index,
.mesh = mesh, .mvert = mvert, .mloop = mloop, .mlooptri = mlooptri,
.brush_radius = brush_radius, .avg_brushNor = avg_brushNor, .brushVelocity = brushVelocity,
- .treeData = &treeData
+ .treeData = &treeData,
};
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
@@ -4449,7 +4447,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
particlesAdded++;
}
if (invalidParticles)
- printf("Warning: Invalid particle(s) found!\n");
+ CLOG_WARN(&LOG, "Invalid particle(s) found!");
/* If no suitable particles were found, exit */
if (particlesAdded < 1) {
@@ -5351,7 +5349,7 @@ static void dynamicPaint_doBorderStep(DynamicPaintSurface *surface)
/* Don't use prevPoint, relying on the condition that neighbors are never border pixels. */
DynamicPaintEffectData data = {
- .surface = surface
+ .surface = surface,
};
ParallelRangeSettings settings;
@@ -5717,7 +5715,7 @@ static void dynamic_paint_generate_bake_data_cb(
/* Prepare surface normal directional scale to easily convert
* brush intersection amount between global and local space */
float scaled_nor[3];
- mul_v3_v3v3(scaled_nor, temp_nor, ob->size);
+ mul_v3_v3v3(scaled_nor, temp_nor, ob->scale);
bData->bNormal[index].normal_scale = len_v3(scaled_nor);
}
mul_mat3_m4_v3(ob->obmat, temp_nor);
@@ -5754,7 +5752,7 @@ static void dynamic_paint_generate_bake_data_cb(
/* Prepare surface normal directional scale to easily convert
* brush intersection amount between global and local space */
float scaled_nor[3];
- mul_v3_v3v3(scaled_nor, temp_nor, ob->size);
+ mul_v3_v3v3(scaled_nor, temp_nor, ob->scale);
bData->bNormal[index].normal_scale = len_v3(scaled_nor);
}
mul_mat3_m4_v3(ob->obmat, temp_nor);
@@ -5907,7 +5905,7 @@ static int dynamicPaint_doStep(
return 0;
if (dynamic_paint_surface_needs_dry_dissolve(surface)) {
- DynamicPaintDissolveDryData data = {.surface = surface, .timescale = timescale};
+ DynamicPaintDissolveDryData data = { .surface = surface, .timescale = timescale, };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (sData->total_points > 1000);
@@ -5963,8 +5961,6 @@ static int dynamicPaint_doStep(
psys_check_enabled(brushObj, brush->psys, for_render))
{
/* Paint a particle system */
- BKE_animsys_evaluate_animdata(depsgraph, scene, &brush->psys->part->id, brush->psys->part->adt,
- BKE_scene_frame_get(scene), ADT_RECALC_ANIM);
dynamicPaint_paintParticles(surface, brush->psys, brush, timescale);
}
/* Object center distance: */
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index faac56ad161..c46691901f0 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/editderivedmesh.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* basic design:
*
@@ -534,7 +526,7 @@ float (*BKE_editmesh_vertexCos_get(struct Depsgraph *depsgraph, BMEditMesh *em,
struct CageUserData data;
float (*cos_cage)[3];
- cage = editbmesh_get_eval_cage(depsgraph, scene, em->ob, em, CD_MASK_BAREMESH);
+ cage = editbmesh_get_eval_cage(depsgraph, scene, em->ob, em, &CD_MASK_BAREMESH);
cos_cage = MEM_callocN(sizeof(*cos_cage) * em->bm->totvert, "bmbvh cos_cage");
/* when initializing cage verts, we only want the first cage coordinate for each vertex,
diff --git a/source/blender/blenkernel/intern/editlattice.c b/source/blender/blenkernel/intern/editlattice.c
index cef3c970c7a..d5b34b27207 100644
--- a/source/blender/blenkernel/intern/editlattice.c
+++ b/source/blender/blenkernel/intern/editlattice.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/editlattice.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/blenkernel/intern/editmesh.c b/source/blender/blenkernel/intern/editmesh.c
index 11f3594da04..c1f5d30cad7 100644
--- a/source/blender/blenkernel/intern/editmesh.c
+++ b/source/blender/blenkernel/intern/editmesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/editmesh.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
@@ -92,12 +84,12 @@ BMEditMesh *BKE_editmesh_from_object(Object *ob)
/* sanity check */
#if 0 /* disable in mutlti-object edit. */
#ifndef NDEBUG
- if (((Mesh *)ob->data)->edit_btmesh) {
- BLI_assert(((Mesh *)ob->data)->edit_btmesh->ob == ob);
+ if (((Mesh *)ob->data)->edit_mesh) {
+ BLI_assert(((Mesh *)ob->data)->edit_mesh->ob == ob);
}
#endif
#endif
- return ((Mesh *)ob->data)->edit_btmesh;
+ return ((Mesh *)ob->data)->edit_mesh;
}
diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c
index c1121d5b1ea..9cb241ed8f0 100644
--- a/source/blender/blenkernel/intern/editmesh_bvh.c
+++ b/source/blender/blenkernel/intern/editmesh_bvh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2010 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/editmesh_bvh.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/blenkernel/intern/editmesh_cache.c b/source/blender/blenkernel/intern/editmesh_cache.c
index 09bf7e9b39b..0c890ad5741 100644
--- a/source/blender/blenkernel/intern/editmesh_cache.c
+++ b/source/blender/blenkernel/intern/editmesh_cache.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/editmesh_cache.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Manage edit mesh cache: #EditMeshData
*/
@@ -28,7 +24,6 @@
#include "DNA_mesh_types.h"
-#include "BLI_math.h"
#include "BKE_editmesh.h"
#include "BKE_editmesh_cache.h" /* own include */
diff --git a/source/blender/blenkernel/intern/editmesh_tangent.c b/source/blender/blenkernel/intern/editmesh_tangent.c
index 4231ad54ea8..b33fc2bb967 100644
--- a/source/blender/blenkernel/intern/editmesh_tangent.c
+++ b/source/blender/blenkernel/intern/editmesh_tangent.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/editmesh_tangent.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BLI_math.h"
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 0c8a47be4b4..d1ad7f10206 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/effect.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stddef.h>
@@ -66,7 +58,6 @@
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_layer.h"
-#include "BKE_library.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_particle.h"
@@ -140,6 +131,18 @@ PartDeflect *BKE_partdeflect_new(int type)
/************************ PARTICLES ***************************/
+PartDeflect *BKE_partdeflect_copy(const struct PartDeflect *pd_src)
+{
+ if (pd_src == NULL) {
+ return NULL;
+ }
+ PartDeflect *pd_dst = MEM_dupallocN(pd_src);
+ if (pd_dst->rng != NULL) {
+ pd_dst->rng = BLI_rng_copy(pd_dst->rng);
+ }
+ return pd_dst;
+}
+
void BKE_partdeflect_free(PartDeflect *pd)
{
if (!pd) {
@@ -168,7 +171,7 @@ static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *ef
Curve *cu = eff->ob->data;
if (cu->flag & CU_PATH) {
if (eff->ob->runtime.curve_cache == NULL || eff->ob->runtime.curve_cache->path == NULL || eff->ob->runtime.curve_cache->path->data == NULL)
- BKE_displist_make_curveTypes(depsgraph, eff->scene, eff->ob, false, false);
+ BKE_displist_make_curveTypes(depsgraph, eff->scene, eff->ob, false, false, NULL);
if (eff->ob->runtime.curve_cache->path && eff->ob->runtime.curve_cache->path->data) {
where_on_path(eff->ob, 0.0, eff->guide_loc, eff->guide_dir, NULL, &eff->guide_radius, NULL);
@@ -184,16 +187,6 @@ static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *ef
}
else if (eff->psys)
psys_update_particle_tree(eff->psys, ctime);
-
- /* Store object velocity */
- if (eff->ob) {
- float old_vel[3];
-
- BKE_object_where_is_calc_time(depsgraph, eff->scene, eff->ob, cfra - 1.0f);
- copy_v3_v3(old_vel, eff->ob->obmat[3]);
- BKE_object_where_is_calc_time(depsgraph, eff->scene, eff->ob, cfra);
- sub_v3_v3v3(eff->velocity, eff->ob->obmat[3], old_vel);
- }
}
static void add_effector_relation(ListBase *relations, Object *ob, ParticleSystem *psys, PartDeflect *pd)
@@ -691,9 +684,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
copy_v3_v3(efd->loc, ob->obmat[3]);
}
- if (real_velocity) {
- copy_v3_v3(efd->vel, eff->velocity);
- }
+ zero_v3(efd->vel);
efd->size = 0.0f;
ret = 1;
@@ -968,7 +959,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
zero_v3(force);
if (pd->f_source) {
float density;
- if ((density = smoke_get_velocity_at(pd->f_source, point->loc, force)) >= 0.0f) {
+ if ((density = BKE_smoke_get_velocity_at(pd->f_source, point->loc, force)) >= 0.0f) {
float influence = strength * efd->falloff;
if (pd->flag & PFIELD_SMOKE_DENSITY) {
influence *= density;
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 2f0c70a4e12..78282ddb2b5 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,12 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/fcurve.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
-
-
#include <math.h>
#include <stdio.h>
#include <stddef.h>
@@ -69,6 +59,8 @@
#include "atomic_ops.h"
+#include "CLG_log.h"
+
#ifdef WITH_PYTHON
#include "BPY_extern.h"
#endif
@@ -80,6 +72,8 @@
static ThreadMutex python_driver_lock = BLI_MUTEX_INITIALIZER;
#endif
+static CLG_LogRef LOG = {"bke.fcurve"};
+
/* ************************** Data-Level Functions ************************* */
/* ---------------------- Freeing --------------------------- */
@@ -436,7 +430,7 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl
* - keyframe to be added would replace one of the existing ones on bounds
*/
if ((arraylen <= 0) || (array == NULL)) {
- printf("Warning: binarysearch_bezt_index() encountered invalid array\n");
+ CLOG_WARN(&LOG, "encountered invalid array");
return 0;
}
else {
@@ -486,10 +480,10 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl
/* print error if loop-limit exceeded */
if (loopbreaker == (maxloop - 1)) {
- printf("Error: binarysearch_bezt_index() was taking too long\n");
+ CLOG_ERROR(&LOG, "search taking too long");
/* include debug info */
- printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
+ CLOG_ERROR(&LOG, "\tround = %d: start = %d, end = %d, arraylen = %d", loopbreaker, start, end, arraylen);
}
/* not found, so return where to place it */
@@ -851,13 +845,13 @@ void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSample
int cfra;
/* sanity checks */
- /* TODO: make these tests report errors using reports not printf's */
+ /* TODO: make these tests report errors using reports not CLOG's */
if (ELEM(NULL, fcu, sample_cb)) {
- printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
+ CLOG_ERROR(&LOG, "No F-Curve with F-Curve Modifiers to Bake");
return;
}
if (start > end) {
- printf("Error: Frame range for Sampled F-Curve creation is inappropriate\n");
+ CLOG_ERROR(&LOG, "Error: Frame range for Sampled F-Curve creation is inappropriate");
return;
}
@@ -1168,7 +1162,7 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
/* error check for missing pointer... */
if (id == NULL) {
if (G.debug & G_DEBUG) {
- printf("Error: driver has an invalid target to use (path = %s)\n", dtar->rna_path);
+ CLOG_ERROR(&LOG, "driver has an invalid target to use (path = %s)", dtar->rna_path);
}
driver->flag |= DRIVER_FLAG_INVALID;
@@ -1201,8 +1195,8 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
else {
/* out of bounds */
if (G.debug & G_DEBUG) {
- printf("Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)",
- id->name, dtar->rna_path, index);
+ CLOG_ERROR(&LOG, "Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)",
+ id->name, dtar->rna_path, index);
}
driver->flag |= DRIVER_FLAG_INVALID;
@@ -1233,7 +1227,7 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
else {
/* path couldn't be resolved */
if (G.debug & G_DEBUG) {
- printf("Driver Evaluation Error: cannot resolve target for %s -> %s\n", id->name, dtar->rna_path);
+ CLOG_ERROR(&LOG, "Driver Evaluation Error: cannot resolve target for %s -> %s", id->name, dtar->rna_path);
}
driver->flag |= DRIVER_FLAG_INVALID;
@@ -1268,7 +1262,7 @@ bool driver_get_variable_property(
/* error check for missing pointer... */
if (id == NULL) {
if (G.debug & G_DEBUG) {
- printf("Error: driver has an invalid target to use (path = %s)\n", dtar->rna_path);
+ CLOG_ERROR(&LOG, "driver has an invalid target to use (path = %s)", dtar->rna_path);
}
driver->flag |= DRIVER_FLAG_INVALID;
@@ -1290,7 +1284,7 @@ bool driver_get_variable_property(
else {
/* path couldn't be resolved */
if (G.debug & G_DEBUG) {
- printf("Driver Evaluation Error: cannot resolve target for %s -> %s\n", id->name, dtar->rna_path);
+ CLOG_ERROR(&LOG, "Driver Evaluation Error: cannot resolve target for %s -> %s", id->name, dtar->rna_path);
}
ptr = PointerRNA_NULL;
@@ -1353,8 +1347,8 @@ static float dvar_eval_rotDiff(ChannelDriver *driver, DriverVar *dvar)
/* make sure we have enough valid targets to use - all or nothing for now... */
if (driver_check_valid_targets(driver, dvar) != 2) {
if (G.debug & G_DEBUG) {
- printf("RotDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)\n",
- valid_targets, dvar->targets[0].id, dvar->targets[1].id);
+ CLOG_WARN(&LOG, "RotDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)",
+ valid_targets, dvar->targets[0].id, dvar->targets[1].id);
}
return 0.0f;
}
@@ -1410,8 +1404,8 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
/* make sure we have enough valid targets to use - all or nothing for now... */
if (valid_targets < dvar->num_targets) {
if (G.debug & G_DEBUG) {
- printf("LocDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)\n",
- valid_targets, dvar->targets[0].id, dvar->targets[1].id);
+ CLOG_WARN(&LOG, "LocDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)",
+ valid_targets, dvar->targets[0].id, dvar->targets[1].id);
}
return 0.0f;
}
@@ -1751,7 +1745,7 @@ void driver_variable_name_validate(DriverVar *dvar)
const char special_char_blacklist[] = {
'~', '`', '!', '@', '#', '$', '%', '^', '&', '*', '+', '=', '-',
'/', '\\', '?', ':', ';', '<', '>', '{', '}', '[', ']', '|',
- ' ', '.', '\t', '\n', '\r'
+ ' ', '.', '\t', '\n', '\r',
};
/* sanity checks */
@@ -1935,14 +1929,14 @@ static bool driver_evaluate_simple_expr(ChannelDriver *driver, ExprPyLike_Parsed
case EXPR_PYLIKE_DIV_BY_ZERO:
case EXPR_PYLIKE_MATH_ERROR:
message = (status == EXPR_PYLIKE_DIV_BY_ZERO) ? "Division by Zero" : "Math Domain Error";
- fprintf(stderr, "\n%s in Driver: '%s'\n", message, driver->expression);
+ CLOG_ERROR(&LOG, "%s in Driver: '%s'", message, driver->expression);
driver->flag |= DRIVER_FLAG_INVALID;
return true;
default:
/* arriving here means a bug, not user error */
- printf("Error: simple driver expression evaluation failed: '%s'\n", driver->expression);
+ CLOG_ERROR(&LOG, "simple driver expression evaluation failed: '%s'", driver->expression);
return false;
}
}
@@ -2801,6 +2795,14 @@ float evaluate_fcurve(FCurve *fcu, float evaltime)
return evaluate_fcurve_ex(fcu, evaltime, 0.0);
}
+float evaluate_fcurve_only_curve(FCurve *fcu, float evaltime)
+{
+ /* Can be used to evaluate the (keyframed) fcurve only.
+ * Also works for driver-fcurves when the driver itself is not relevant.
+ * E.g. when inserting a keyframe in a driver fcurve. */
+ return evaluate_fcurve_ex(fcu, evaltime, 0.0);
+}
+
float evaluate_fcurve_driver(PathResolvedRNA *anim_rna, FCurve *fcu, ChannelDriver *driver_orig, float evaltime)
{
BLI_assert(fcu->driver != NULL);
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index bf1532bab42..2263c5f1a05 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/fluidsim.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -62,7 +54,7 @@ void initElbeemMesh(struct Depsgraph *depsgraph, struct Scene *scene, struct Obj
float *verts;
int *tris;
- mesh = mesh_create_eval_final_index_render(depsgraph, scene, ob, CD_MASK_BAREMESH, modifierIndex);
+ mesh = mesh_create_eval_final_index_render(depsgraph, scene, ob, &CD_MASK_BAREMESH, modifierIndex);
mvert = mesh->mvert;
mloop = mesh->mloop;
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 8fce320800e..d7d68b988e3 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/fmodifier.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <math.h>
@@ -35,6 +29,8 @@
#include "MEM_guardedalloc.h"
+#include "CLG_log.h"
+
#include "DNA_anim_types.h"
#include "BLT_translation.h"
@@ -48,6 +44,8 @@
#include "BKE_fcurve.h"
#include "BKE_idprop.h"
+static CLG_LogRef LOG = {"bke.fmodifier"};
+
/* ******************************** F-Modifiers ********************************* */
/* Forward declarations. */
@@ -342,7 +340,7 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float
break;
}
default:
- printf("Invalid Function-Generator for F-Modifier - %d\n", data->type);
+ CLOG_ERROR(&LOG, "Invalid Function-Generator for F-Modifier - %d", data->type);
break;
}
@@ -504,7 +502,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array
* - keyframe to be added would replace one of the existing ones on bounds
*/
if ((arraylen <= 0) || (array == NULL)) {
- printf("Warning: binarysearch_fcm_envelopedata_index() encountered invalid array\n");
+ CLOG_WARN(&LOG, "encountered invalid array");
return 0;
}
else {
@@ -558,10 +556,10 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array
/* print error if loop-limit exceeded */
if (loopbreaker == (maxloop - 1)) {
- printf("Error: binarysearch_fcm_envelopedata_index() was taking too long\n");
+ CLOG_ERROR(&LOG, "binary search was taking too long");
// include debug info
- printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
+ CLOG_ERROR(&LOG, "\tround = %d: start = %d, end = %d, arraylen = %d", loopbreaker, start, end, arraylen);
}
/* not found, so return where to place it */
@@ -1035,7 +1033,7 @@ const FModifierTypeInfo *get_fmodifier_typeinfo(const int type)
return fmodifiersTypeInfo[type];
}
else {
- printf("No valid F-Curve Modifier type-info data available. Type = %i\n", type);
+ CLOG_ERROR(&LOG, "No valid F-Curve Modifier type-info data available. Type = %i", type);
}
return NULL;
@@ -1069,7 +1067,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu)
if ((modifiers->first) && (type == FMODIFIER_TYPE_CYCLES)) {
/* cycles modifier must be first in stack, so for now, don't add if it can't be */
/* TODO: perhaps there is some better way, but for now, */
- printf("Error: Cannot add 'Cycles' modifier to F-Curve, as 'Cycles' modifier can only be first in stack.\n");
+ CLOG_STR_ERROR(&LOG, "Cannot add 'Cycles' modifier to F-Curve, as 'Cycles' modifier can only be first in stack.");
return NULL;
}
@@ -1183,7 +1181,7 @@ bool remove_fmodifier(ListBase *modifiers, FModifier *fcm)
}
else {
/* XXX this case can probably be removed some day, as it shouldn't happen... */
- printf("remove_fmodifier() - no modifier stack given\n");
+ CLOG_STR_ERROR(&LOG, "no modifier stack given");
MEM_freeN(fcm);
return false;
}
@@ -1498,9 +1496,9 @@ void fcurve_bake_modifiers(FCurve *fcu, int start, int end)
ChannelDriver *driver;
/* sanity checks */
- /* TODO: make these tests report errors using reports not printf's */
+ /* TODO: make these tests report errors using reports not CLOG's */
if (ELEM(NULL, fcu, fcu->modifiers.first)) {
- printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
+ CLOG_ERROR(&LOG, "No F-Curve with F-Curve Modifiers to Bake");
return;
}
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index d796110f185..9b184713f0e 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/font.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -37,6 +29,8 @@
#include <wchar.h>
#include <wctype.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
@@ -62,6 +56,7 @@
#include "BKE_anim.h"
#include "BKE_curve.h"
+static CLG_LogRef LOG = {"bke.data_transfer"};
static ThreadRWMutex vfont_rwlock = BLI_RWLOCK_INITIALIZER;
/* The vfont code */
@@ -140,7 +135,7 @@ void BKE_vfont_builtin_register(void *mem, int size)
static PackedFile *get_builtin_packedfile(void)
{
if (!builtin_font_data) {
- printf("Internal error, builtin font not loaded\n");
+ CLOG_ERROR(&LOG, "Internal error, builtin font not loaded");
return NULL;
}
@@ -195,7 +190,7 @@ static VFontData *vfont_get_data(VFont *vfont)
}
}
if (!pf) {
- printf("Font file doesn't exist: %s\n", vfont->name);
+ CLOG_WARN(&LOG, "Font file doesn't exist: %s", vfont->name);
/* DON'T DO THIS
* missing file shouldn't modify path! - campbell */
@@ -274,7 +269,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
BLI_strncpy(vfont->name, filepath, sizeof(vfont->name));
/* if autopack is on store the packedfile in de font structure */
- if (!is_builtin && (G.fileflags & G_AUTOPACK)) {
+ if (!is_builtin && (G.fileflags & G_FILE_AUTOPACK)) {
vfont->packedfile = pf;
}
@@ -302,7 +297,7 @@ VFont *BKE_vfont_load_exists_ex(struct Main *bmain, const char *filepath, bool *
BLI_path_abs(str, BKE_main_blendfile_path(bmain));
/* first search an identical filepath */
- for (vfont = bmain->vfont.first; vfont; vfont = vfont->id.next) {
+ for (vfont = bmain->fonts.first; vfont; vfont = vfont->id.next) {
BLI_strncpy(strtest, vfont->name, sizeof(vfont->name));
BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &vfont->id));
@@ -347,7 +342,7 @@ VFont *BKE_vfont_builtin_get(void)
{
VFont *vfont;
- for (vfont = G_MAIN->vfont.first; vfont; vfont = vfont->id.next) {
+ for (vfont = G_MAIN->fonts.first; vfont; vfont = vfont->id.next) {
if (BKE_vfont_is_builtin(vfont)) {
return vfont;
}
@@ -862,7 +857,7 @@ makebreak:
(ct->dobreak == 0) &&
(((xof - tb_scale.x) + twidth) > xof_scale + tb_scale.w))
{
- // fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]);
+ // CLOG_WARN(&LOG, "linewidth exceeded: %c%c%c...", mem[i], mem[i+1], mem[i+2]);
for (j = i; j && (mem[j] != '\n') && (chartransdata[j].dobreak == 0); j--) {
bool dobreak = false;
if (mem[j] == ' ' || mem[j] == '-') {
@@ -877,7 +872,7 @@ makebreak:
dobreak = true;
}
else if (chartransdata[j].dobreak) {
- // fprintf(stderr, "word too long: %c%c%c...\n", mem[j], mem[j+1], mem[j+2]);
+ // CLOG_WARN(&LOG, "word too long: %c%c%c...", mem[j], mem[j+1], mem[j+2]);
ct->dobreak = 1;
custrinfo[i + 1].flag |= CU_CHINFO_WRAP;
ct -= 1;
@@ -1225,7 +1220,7 @@ makebreak:
timeofs += distfac * cu->xof; /* not cyclic */
ct = chartransdata;
- for (i = 0; i < slen; i++, ct++) {
+ for (i = 0; i <= slen; i++, ct++) {
float ctime, dtime, vec[4], tvec[4], rotvec[3];
float si, co;
@@ -1268,8 +1263,6 @@ makebreak:
sb->rot = -ct->rot;
}
}
- /* null character is always zero width, no need to iterate over it */
- chartransdata[slen] = chartransdata[slen - 1];
}
}
@@ -1369,7 +1362,7 @@ makebreak:
}
if (ob == NULL || info->mat_nr > (ob->totcol)) {
- /* printf("Error: Illegal material index (%d) in text object, setting to 0\n", info->mat_nr); */
+ /* CLOG_ERROR(&LOG, "Illegal material index (%d) in text object, setting to 0", info->mat_nr); */
info->mat_nr = 0;
}
/* We do not want to see any character for \n or \r */
@@ -1610,7 +1603,6 @@ bool BKE_vfont_to_curve(Object *ob, int mode)
/* -------------------------------------------------------------------- */
-
/** \name VFont Clipboard
* \{ */
diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c
index 57a2d2d4134..10fd2db187d 100644
--- a/source/blender/blenkernel/intern/freestyle.c
+++ b/source/blender/blenkernel/intern/freestyle.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/freestyle.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index d347e10921c..c9cb38fcc4e 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/gpencil.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -34,15 +28,14 @@
#include <stddef.h>
#include <math.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_math_vector.h"
-#include "BLI_math_color.h"
#include "BLI_string_utils.h"
-#include "BLI_rand.h"
-#include "BLI_ghash.h"
#include "BLT_translation.h"
@@ -54,11 +47,9 @@
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
-#include "BKE_context.h"
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_deform.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_colortools.h"
#include "BKE_icons.h"
@@ -69,6 +60,8 @@
#include "DEG_depsgraph.h"
+static CLG_LogRef LOG = {"bke.gpencil"};
+
/* ************************************************** */
/* Draw Engine */
@@ -267,7 +260,7 @@ bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
/* check whether frame was added successfully */
if (state == -1) {
- printf("Error: Frame (%d) existed already for this layer. Using existing frame\n", cframe);
+ CLOG_ERROR(&LOG, "Frame (%d) existed already for this layer. Using existing frame", cframe);
/* free the newly created one, and use the old one instead */
MEM_freeN(gpf);
@@ -418,7 +411,6 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[])
/* GP object specific settings */
ARRAY_SET_ITEMS(gpd->line_color, 0.6f, 0.6f, 0.6f, 0.5f);
- gpd->xray_mode = GP_XRAY_3DSPACE;
gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
/* grid settings */
@@ -617,7 +609,7 @@ bGPDlayer *BKE_gpencil_layer_duplicate(const bGPDlayer *gpl_src)
/**
* Only copy internal data of GreasePencil ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -644,7 +636,7 @@ void BKE_gpencil_copy_data(bGPdata *gpd_dst, const bGPdata *gpd_src, const int U
bGPdata *BKE_gpencil_copy(Main *bmain, const bGPdata *gpd)
{
bGPdata *gpd_copy;
- BKE_id_copy_ex(bmain, &gpd->id, (ID **)&gpd_copy, 0, false);
+ BKE_id_copy(bmain, &gpd->id, (ID **)&gpd_copy);
return gpd_copy;
}
@@ -669,7 +661,7 @@ bGPdata *BKE_gpencil_data_duplicate(Main *bmain, const bGPdata *gpd_src, bool in
}
else {
BLI_assert(bmain != NULL);
- BKE_id_copy_ex(bmain, &gpd_src->id, (ID **)&gpd_dst, 0, false);
+ BKE_id_copy(bmain, &gpd_src->id, (ID **)&gpd_dst);
}
/* Copy internal data (layers, etc.) */
@@ -892,7 +884,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M
gpl->actframe = gpf;
else {
/* unresolved errogenous situation! */
- printf("Error: cannot find appropriate gp-frame\n");
+ CLOG_STR_ERROR(&LOG, "cannot find appropriate gp-frame");
/* gpl->actframe should still be NULL */
}
}
@@ -1119,11 +1111,11 @@ static void boundbox_gpencil(Object *ob)
bGPdata *gpd;
float min[3], max[3];
- if (ob->bb == NULL) {
- ob->bb = MEM_callocN(sizeof(BoundBox), "GPencil boundbox");
+ if (ob->runtime.bb == NULL) {
+ ob->runtime.bb = MEM_callocN(sizeof(BoundBox), "GPencil boundbox");
}
- bb = ob->bb;
+ bb = ob->runtime.bb;
gpd = ob->data;
BKE_gpencil_data_minmax(NULL, gpd, min, max);
@@ -1141,15 +1133,15 @@ BoundBox *BKE_gpencil_boundbox_get(Object *ob)
return NULL;
gpd = ob->data;
- if ((ob->bb) && ((ob->bb->flag & BOUNDBOX_DIRTY) == 0) &&
+ if ((ob->runtime.bb) && ((ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) &&
((gpd->flag & GP_DATA_CACHE_IS_DIRTY) == 0))
{
- return ob->bb;
+ return ob->runtime.bb;
}
boundbox_gpencil(ob);
- return ob->bb;
+ return ob->runtime.bb;
}
/* ************************************************** */
@@ -1209,6 +1201,15 @@ void BKE_gpencil_vgroup_remove(Object *ob, bDeformGroup *defgroup)
if (dw != NULL) {
defvert_remove_group(dvert, dw);
}
+ else {
+ /* reorganize weights in other strokes */
+ for (int g = 0; g < gps->dvert->totweight; g++) {
+ dw = &dvert->dw[g];
+ if ((dw != NULL) && (dw->def_nr > def_nr)) {
+ dw->def_nr--;
+ }
+ }
+ }
}
}
}
@@ -1370,7 +1371,8 @@ bool BKE_gpencil_smooth_stroke_thickness(bGPDstroke *gps, int point_index, float
}
/**
-* Apply smooth for UV rotation to stroke point (use pressure) */
+ * Apply smooth for UV rotation to stroke point (use pressure).
+ */
bool BKE_gpencil_smooth_stroke_uv(bGPDstroke *gps, int point_index, float influence)
{
bGPDspoint *ptb = &gps->points[point_index];
@@ -1563,6 +1565,8 @@ int BKE_gpencil_get_material_index(Object *ob, Material *ma)
/* Get points of stroke always flat to view not affected by camera view or view position */
void BKE_gpencil_stroke_2d_flat(const bGPDspoint *points, int totpoints, float(*points2d)[2], int *r_direction)
{
+ BLI_assert(totpoints >= 2);
+
const bGPDspoint *pt0 = &points[0];
const bGPDspoint *pt1 = &points[1];
const bGPDspoint *pt3 = &points[(int)(totpoints * 0.75)];
@@ -1576,7 +1580,15 @@ void BKE_gpencil_stroke_2d_flat(const bGPDspoint *points, int totpoints, float(*
sub_v3_v3v3(locx, &pt1->x, &pt0->x);
/* point vector at 3/4 */
- sub_v3_v3v3(loc3, &pt3->x, &pt0->x);
+ float v3[3];
+ if (totpoints == 2) {
+ mul_v3_v3fl(v3, &pt3->x, 0.001f);
+ }
+ else {
+ copy_v3_v3(v3, &pt3->x);
+ }
+
+ sub_v3_v3v3(loc3, v3, &pt0->x);
/* vector orthogonal to polygon plane */
cross_v3_v3v3(normal, locx, loc3);
@@ -1604,3 +1616,181 @@ void BKE_gpencil_stroke_2d_flat(const bGPDspoint *points, int totpoints, float(*
*r_direction = (int)locy[2];
}
+/* Get points of stroke always flat to view not affected by camera view or view position
+ * using another stroke as reference
+ */
+void BKE_gpencil_stroke_2d_flat_ref(
+ const bGPDspoint *ref_points, int ref_totpoints,
+ const bGPDspoint *points, int totpoints,
+ float(*points2d)[2], const float scale, int *r_direction)
+{
+ BLI_assert(totpoints >= 2);
+
+ const bGPDspoint *pt0 = &ref_points[0];
+ const bGPDspoint *pt1 = &ref_points[1];
+ const bGPDspoint *pt3 = &ref_points[(int)(ref_totpoints * 0.75)];
+
+ float locx[3];
+ float locy[3];
+ float loc3[3];
+ float normal[3];
+
+ /* local X axis (p0 -> p1) */
+ sub_v3_v3v3(locx, &pt1->x, &pt0->x);
+
+ /* point vector at 3/4 */
+ float v3[3];
+ if (totpoints == 2) {
+ mul_v3_v3fl(v3, &pt3->x, 0.001f);
+ }
+ else {
+ copy_v3_v3(v3, &pt3->x);
+ }
+
+ sub_v3_v3v3(loc3, v3, &pt0->x);
+
+ /* vector orthogonal to polygon plane */
+ cross_v3_v3v3(normal, locx, loc3);
+
+ /* local Y axis (cross to normal/x axis) */
+ cross_v3_v3v3(locy, normal, locx);
+
+ /* Normalize vectors */
+ normalize_v3(locx);
+ normalize_v3(locy);
+
+ /* Get all points in local space */
+ for (int i = 0; i < totpoints; i++) {
+ const bGPDspoint *pt = &points[i];
+ float loc[3];
+ float v1[3];
+ float vn[3] = { 0.0f, 0.0f, 0.0f };
+
+ /* apply scale to extremes of the stroke to get better collision detection
+ * the scale is divided to get more control in the UI parameter
+ */
+ /* first point */
+ if (i == 0) {
+ const bGPDspoint *pt_next = &points[i + 1];
+ sub_v3_v3v3(vn, &pt->x, &pt_next->x);
+ normalize_v3(vn);
+ mul_v3_fl(vn, scale / 10.0f);
+ add_v3_v3v3(v1, &pt->x, vn);
+ }
+ /* last point */
+ else if (i == totpoints - 1) {
+ const bGPDspoint *pt_prev = &points[i - 1];
+ sub_v3_v3v3(vn, &pt->x, &pt_prev->x);
+ normalize_v3(vn);
+ mul_v3_fl(vn, scale / 10.0f);
+ add_v3_v3v3(v1, &pt->x, vn);
+ }
+ else {
+ copy_v3_v3(v1, &pt->x);
+ }
+
+ /* Get local space using first point as origin (ref stroke) */
+ sub_v3_v3v3(loc, v1, &pt0->x);
+
+ points2d[i][0] = dot_v3v3(loc, locx);
+ points2d[i][1] = dot_v3v3(loc, locy);
+ }
+
+ /* Concave (-1), Convex (1), or Autodetect (0)? */
+ *r_direction = (int)locy[2];
+}
+
+/**
+ * Trim stroke to the first intersection or loop
+ * \param gps: Stroke data
+ */
+bool BKE_gpencil_trim_stroke(bGPDstroke *gps)
+{
+ if (gps->totpoints < 4) {
+ return false;
+ }
+ bool intersect = false;
+ int start, end;
+ float point[3];
+ /* loop segments from start until we have an intersection */
+ for (int i = 0; i < gps->totpoints - 2; i++) {
+ start = i;
+ bGPDspoint *a = &gps->points[start];
+ bGPDspoint *b = &gps->points[start + 1];
+ for (int j = start + 2; j < gps->totpoints - 1; j++) {
+ end = j + 1;
+ bGPDspoint *c = &gps->points[j];
+ bGPDspoint *d = &gps->points[end];
+ float pointb[3];
+ /* get intersection */
+ if (isect_line_line_v3(&a->x, &b->x, &c->x, &d->x, point, pointb)) {
+ if (len_v3(point) > 0.0f) {
+ float closest[3];
+ /* check intersection is on both lines */
+ float lambda = closest_to_line_v3(closest, point, &a->x, &b->x);
+ if ((lambda <= 0.0f) || (lambda >= 1.0f)) {
+ continue;
+ }
+ lambda = closest_to_line_v3(closest, point, &c->x, &d->x);
+ if ((lambda <= 0.0f) || (lambda >= 1.0f)) {
+ continue;
+ }
+ else {
+ intersect = true;
+ break;
+ }
+ }
+ }
+ }
+ if (intersect) {
+ break;
+ }
+ }
+
+ /* trim unwanted points */
+ if (intersect) {
+
+ /* save points */
+ bGPDspoint *old_points = MEM_dupallocN(gps->points);
+ MDeformVert *old_dvert = NULL;
+ MDeformVert *dvert_src = NULL;
+
+ if (gps->dvert != NULL) {
+ old_dvert = MEM_dupallocN(gps->dvert);
+ }
+
+ /* resize gps */
+ int newtot = end - start + 1;
+
+ gps->points = MEM_recallocN(gps->points, sizeof(*gps->points) * newtot);
+ if (gps->dvert != NULL) {
+ gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * newtot);
+ }
+
+ for (int i = 0; i < newtot; i++) {
+ int idx = start + i;
+ bGPDspoint *pt_src = &old_points[idx];
+ bGPDspoint *pt_new = &gps->points[i];
+ memcpy(pt_new, pt_src, sizeof(bGPDspoint));
+ if (gps->dvert != NULL) {
+ dvert_src = &old_dvert[idx];
+ MDeformVert *dvert = &gps->dvert[i];
+ memcpy(dvert, dvert_src, sizeof(MDeformVert));
+ if (dvert_src->dw) {
+ memcpy(dvert->dw, dvert_src->dw, sizeof(MDeformWeight));
+ }
+ }
+ if (idx == start || idx == end) {
+ copy_v3_v3(&pt_new->x, point);
+ }
+ }
+
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
+ gps->tot_triangles = 0;
+ gps->totpoints = newtot;
+
+ MEM_SAFE_FREE(old_points);
+ MEM_SAFE_FREE(old_dvert);
+ }
+ return intersect;
+}
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 9d45bfd0649..bd83e93ef00 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
- /** \file blender/blenkernel/intern/gpencil_modifier.c
- * \ingroup bke
- */
-
+/** \file
+ * \ingroup bke
+ */
#include <stdio.h>
@@ -45,7 +38,6 @@
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_gpencil.h"
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 2a348751365..bad1e6620eb 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2006-2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenkernel/intern/icons.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -35,12 +26,14 @@
#include <stdlib.h>
#include <string.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "DNA_brush_types.h"
#include "DNA_collection_types.h"
#include "DNA_gpencil_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -77,6 +70,8 @@ enum {
/* GLOBALS */
+static CLG_LogRef LOG = {"bke.icons"};
+
static GHash *gIcons = NULL;
static int gNextIconId = 1;
@@ -328,7 +323,7 @@ PreviewImage **BKE_previewimg_id_get_p(const ID *id)
ID_PRV_CASE(ID_MA, Material);
ID_PRV_CASE(ID_TE, Tex);
ID_PRV_CASE(ID_WO, World);
- ID_PRV_CASE(ID_LA, Lamp);
+ ID_PRV_CASE(ID_LA, Light);
ID_PRV_CASE(ID_IM, Image);
ID_PRV_CASE(ID_BR, Brush);
ID_PRV_CASE(ID_OB, Object);
@@ -588,7 +583,7 @@ int BKE_icon_id_ensure(struct ID *id)
id->icon_id = get_next_free_id();
if (!id->icon_id) {
- printf("%s: Internal error - not enough IDs\n", __func__);
+ CLOG_ERROR(&LOG, "not enough IDs");
return 0;
}
@@ -633,7 +628,7 @@ int BKE_icon_gplayer_color_ensure(bGPDlayer *gpl)
gpl->runtime.icon_id = get_next_free_id();
if (!gpl->runtime.icon_id) {
- printf("%s: Internal error - not enough IDs\n", __func__);
+ CLOG_ERROR(&LOG, "not enough IDs");
return 0;
}
@@ -665,7 +660,7 @@ int BKE_icon_preview_ensure(ID *id, PreviewImage *preview)
preview->icon_id = get_next_free_id();
if (!preview->icon_id) {
- printf("%s: Internal error - not enough IDs\n", __func__);
+ CLOG_ERROR(&LOG, "not enough IDs");
return 0;
}
@@ -690,7 +685,7 @@ Icon *BKE_icon_get(const int icon_id)
icon = BLI_ghash_lookup(gIcons, POINTER_FROM_INT(icon_id));
if (!icon) {
- printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
+ CLOG_ERROR(&LOG, "no icon for icon ID: %d", icon_id);
return NULL;
}
@@ -704,7 +699,7 @@ void BKE_icon_set(const int icon_id, struct Icon *icon)
void **val_p;
if (BLI_ghash_ensure_p(gIcons, POINTER_FROM_INT(icon_id), &val_p)) {
- printf("%s: Internal error, icon already set: %d\n", __func__, icon_id);
+ CLOG_ERROR(&LOG, "icon already set: %d", icon_id);
return;
}
diff --git a/source/blender/blenkernel/intern/icons_rasterize.c b/source/blender/blenkernel/intern/icons_rasterize.c
index 24576c24953..e4ef73d582c 100644
--- a/source/blender/blenkernel/intern/icons_rasterize.c
+++ b/source/blender/blenkernel/intern/icons_rasterize.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,13 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenkernel/intern/icons_rasterize.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index afc52cbc002..df8de1aa2cf 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* return info about ID types
*/
-/** \file blender/blenkernel/intern/idcode.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
@@ -63,11 +55,12 @@ static IDType idtypes[] = {
{ID_CF, "CacheFile", "cache_files", BLT_I18NCONTEXT_ID_CACHEFILE, IDTYPE_FLAGS_ISLINKABLE},
{ID_GR, "Collection", "collections", BLT_I18NCONTEXT_ID_COLLECTION, IDTYPE_FLAGS_ISLINKABLE},
{ID_CU, "Curve", "curves", BLT_I18NCONTEXT_ID_CURVE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_GD, "GPencil", "grease_pencil", BLT_I18NCONTEXT_ID_GPENCIL, IDTYPE_FLAGS_ISLINKABLE}, /* rename gpencil */
+ {ID_GD, "GPencil", "grease_pencils", BLT_I18NCONTEXT_ID_GPENCIL, IDTYPE_FLAGS_ISLINKABLE}, /* rename gpencil */
+
{ID_IM, "Image", "images", BLT_I18NCONTEXT_ID_IMAGE, IDTYPE_FLAGS_ISLINKABLE},
{ID_IP, "Ipo", "ipos", "", IDTYPE_FLAGS_ISLINKABLE}, /* deprecated */
{ID_KE, "Key", "shape_keys", BLT_I18NCONTEXT_ID_SHAPEKEY, 0 },
- {ID_LA, "Light", "lights", BLT_I18NCONTEXT_ID_LAMP, IDTYPE_FLAGS_ISLINKABLE},
+ {ID_LA, "Light", "lights", BLT_I18NCONTEXT_ID_LIGHT, IDTYPE_FLAGS_ISLINKABLE},
{ID_LI, "Library", "libraries", BLT_I18NCONTEXT_ID_LIBRARY, 0 },
{ID_LS, "FreestyleLineStyle", "linestyles", BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE, IDTYPE_FLAGS_ISLINKABLE},
{ID_LT, "Lattice", "lattices", BLT_I18NCONTEXT_ID_LATTICE, IDTYPE_FLAGS_ISLINKABLE},
@@ -95,10 +88,10 @@ static IDType idtypes[] = {
{ID_WS, "WorkSpace", "workspaces", BLT_I18NCONTEXT_ID_WORKSPACE, IDTYPE_FLAGS_ISLINKABLE},
/** Keep last, not an ID exactly, only include for completeness */
- {ID_ID, "ID", "ids", BLT_I18NCONTEXT_ID_ID, 0 }, /* plural is fake */
+ {ID_LINK_PLACEHOLDER, "Link Placeholder", "link_placeholders", BLT_I18NCONTEXT_ID_ID, 0}, /* plural is fake */
};
-/* -1 for ID_ID */
+/* -1 for ID_LINK_PLACEHOLDER */
BLI_STATIC_ASSERT((ARRAY_SIZE(idtypes) - 1 == MAX_LIBARRAY), "Missing IDType");
static IDType *idtype_from_name(const char *str)
@@ -319,6 +312,58 @@ int BKE_idcode_to_index(const short idcode)
}
/**
+ * Get an idcode from an index (e.g. INDEX_ID_OB -> ID_OB).
+ */
+short BKE_idcode_from_index(const int index)
+{
+#define CASE_IDCODE(_id) case INDEX_ID_##_id: return ID_##_id
+
+ switch (index) {
+ CASE_IDCODE(AC);
+ CASE_IDCODE(AR);
+ CASE_IDCODE(BR);
+ CASE_IDCODE(CA);
+ CASE_IDCODE(CF);
+ CASE_IDCODE(CU);
+ CASE_IDCODE(GD);
+ CASE_IDCODE(GR);
+ CASE_IDCODE(IM);
+ CASE_IDCODE(KE);
+ CASE_IDCODE(IP);
+ CASE_IDCODE(LA);
+ CASE_IDCODE(LI);
+ CASE_IDCODE(LS);
+ CASE_IDCODE(LT);
+ CASE_IDCODE(MA);
+ CASE_IDCODE(MB);
+ CASE_IDCODE(MC);
+ CASE_IDCODE(ME);
+ CASE_IDCODE(MSK);
+ CASE_IDCODE(NT);
+ CASE_IDCODE(OB);
+ CASE_IDCODE(PA);
+ CASE_IDCODE(PAL);
+ CASE_IDCODE(PC);
+ CASE_IDCODE(LP);
+ CASE_IDCODE(SCE);
+ CASE_IDCODE(SCR);
+ CASE_IDCODE(SPK);
+ CASE_IDCODE(SO);
+ CASE_IDCODE(TE);
+ CASE_IDCODE(TXT);
+ CASE_IDCODE(VF);
+ CASE_IDCODE(WM);
+ CASE_IDCODE(WO);
+ CASE_IDCODE(WS);
+ }
+
+ BLI_assert(0);
+ return -1;
+
+#undef CASE_IDCODE
+}
+
+/**
* Convert an idcode into a name (plural).
*
* \param idcode: The code to convert.
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 5ea9f9b20f9..0d77ee21b76 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/idprop.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdio.h>
@@ -40,6 +34,8 @@
#include "BKE_idprop.h"
#include "BKE_library.h"
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "BLI_strict_flags.h"
@@ -52,6 +48,8 @@
*/
#define IDP_ARRAY_REALLOC_LIMIT 200
+static CLG_LogRef LOG = {"bke.idprop"};
+
/*local size table.*/
static size_t idp_size_table[] = {
1, /*strings*/
@@ -62,7 +60,7 @@ static size_t idp_size_table[] = {
0, /*arrays don't have a fixed size*/
sizeof(ListBase), /*Group type*/
sizeof(void *),
- sizeof(double)
+ sizeof(double),
};
@@ -986,7 +984,7 @@ IDProperty *IDP_New(const char type, const IDPropertyTemplate *val, const char *
prop->len = prop->totallen = val->array.len;
break;
}
- printf("%s: bad array type.\n", __func__);
+ CLOG_ERROR(&LOG, "bad array type.");
return NULL;
}
case IDP_STRING:
diff --git a/source/blender/blenkernel/intern/idprop_utils.c b/source/blender/blenkernel/intern/idprop_utils.c
index 449ecee93d9..ab2df928814 100644
--- a/source/blender/blenkernel/intern/idprop_utils.c
+++ b/source/blender/blenkernel/intern/idprop_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/idprop_utils.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdio.h>
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 3efe288dcf4..177601c4746 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2006, full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/image.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -40,6 +34,8 @@
#include <time.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "IMB_colormanagement.h"
@@ -74,8 +70,6 @@
#include "BKE_icons.h"
#include "BKE_image.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_packedFile.h"
#include "BKE_report.h"
@@ -94,12 +88,16 @@
#include "BLI_sys_types.h" // for intptr_t support
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
+
/* for image user iteration */
#include "DNA_node_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
+static CLG_LogRef LOG = {"bke.image"};
static SpinLock image_spin;
/* prototypes */
@@ -383,7 +381,7 @@ static void copy_image_packedfiles(ListBase *lb_dst, const ListBase *lb_src)
/**
* Only copy internal data of Image ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -425,7 +423,7 @@ void BKE_image_copy_data(Main *UNUSED(bmain), Image *ima_dst, const Image *ima_s
Image *BKE_image_copy(Main *bmain, const Image *ima)
{
Image *ima_copy;
- BKE_id_copy_ex(bmain, &ima->id, (ID **)&ima_copy, 0, false);
+ BKE_id_copy(bmain, &ima->id, (ID **)&ima_copy);
return ima_copy;
}
@@ -452,7 +450,7 @@ void BKE_image_merge(Main *bmain, Image *dest, Image *source)
}
BLI_spin_unlock(&image_spin);
- BKE_libblock_free(bmain, source);
+ BKE_id_free(bmain, source);
}
}
@@ -558,7 +556,7 @@ Image *BKE_image_load_exists_ex(Main *bmain, const char *filepath, bool *r_exist
BLI_path_abs(str, BKE_main_blendfile_path_from_global());
/* first search an identical filepath */
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
if (ima->source != IMA_SRC_VIEWER && ima->source != IMA_SRC_GENERATED) {
STRNCPY(strtest, ima->name);
BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &ima->id));
@@ -732,7 +730,7 @@ static void image_memorypack_multiview(Image *ima)
IMB_saveiff(ibuf, iv->filepath, IB_rect | IB_mem);
if (ibuf->encodedbuffer == NULL) {
- printf("memory save for pack error\n");
+ CLOG_STR_ERROR(&LOG, "memory save for pack error");
IMB_freeImBuf(ibuf);
image_free_packedfiles(ima);
return;
@@ -785,7 +783,7 @@ void BKE_image_memorypack(Image *ima)
IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem);
if (ibuf->encodedbuffer == NULL) {
- printf("memory save for pack error\n");
+ CLOG_STR_ERROR(&LOG, "memory save for pack error");
}
else {
ImagePackedFile *imapf;
@@ -914,12 +912,12 @@ void BKE_image_print_memlist(Main *bmain)
Image *ima;
uintptr_t size, totsize = 0;
- for (ima = bmain->image.first; ima; ima = ima->id.next)
+ for (ima = bmain->images.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 = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
size = image_mem_size(ima);
if (size)
@@ -942,14 +940,14 @@ void BKE_image_free_all_textures(Main *bmain)
uintptr_t tot_freed_size = 0;
#endif
- for (ima = bmain->image.first; ima; ima = ima->id.next)
+ for (ima = bmain->images.first; ima; ima = ima->id.next)
ima->id.tag &= ~LIB_TAG_DOIT;
- for (tex = bmain->tex.first; tex; tex = tex->id.next)
+ for (tex = bmain->textures.first; tex; tex = tex->id.next)
if (tex->ima)
tex->ima->id.tag |= LIB_TAG_DOIT;
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
if (ima->cache && (ima->id.tag & LIB_TAG_DOIT)) {
#ifdef CHECK_FREED_SIZE
uintptr_t old_size = image_mem_size(ima);
@@ -989,7 +987,7 @@ void BKE_image_all_free_anim_ibufs(Main *bmain, int cfra)
{
Image *ima;
- for (ima = bmain->image.first; ima; ima = ima->id.next)
+ for (ima = bmain->images.first; ima; ima = ima->id.next)
if (BKE_image_is_animated(ima))
BKE_image_free_anim_ibufs(ima, cfra);
}
@@ -2100,6 +2098,38 @@ struct StampData *BKE_stamp_info_from_scene_static(Scene *scene)
return stamp_data;
}
+static const char *stamp_metadata_fields[] = {
+ "File",
+ "Note",
+ "Date",
+ "Marker",
+ "Time",
+ "Frame",
+ "FrameRange",
+ "Camera",
+ "Lens",
+ "Scene",
+ "Strip",
+ "RenderTime",
+ "Memory",
+ "Hostname",
+ NULL
+};
+
+/* Check whether the given metadata field name translates to a known field of
+ * a stamp. */
+bool BKE_stamp_is_known_field(const char *field_name)
+{
+ int i = 0;
+ while (stamp_metadata_fields[i] != NULL) {
+ if (STREQ(field_name, stamp_metadata_fields[i])) {
+ return true;
+ }
+ i++;
+ }
+ return false;
+}
+
void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCallback callback, bool noskip)
{
if ((callback == NULL) || (stamp_data == NULL)) {
@@ -2111,6 +2141,8 @@ void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCall
callback(data, value_str, stamp_data->member, sizeof(stamp_data->member)); \
} ((void)0)
+ /* TODO(sergey): Use stamp_metadata_fields somehow, or make it more generic
+ * meta information to avoid duplication. */
CALL(file, "File");
CALL(note, "Note");
CALL(date, "Date");
@@ -2149,7 +2181,23 @@ void BKE_render_result_stamp_data(RenderResult *rr, const char *key, const char
BLI_addtail(&stamp_data->custom_fields, field);
}
-void BKE_stamp_data_free(struct StampData *stamp_data)
+StampData *BKE_stamp_data_copy(const StampData *stamp_data)
+{
+ if (stamp_data == NULL) {
+ return NULL;
+ }
+
+ StampData *stamp_datan = MEM_dupallocN(stamp_data);
+ BLI_duplicatelist(&stamp_datan->custom_fields, &stamp_data->custom_fields);
+
+ LISTBASE_FOREACH(StampDataCustomField *, custom_fieldn, &stamp_datan->custom_fields) {
+ custom_fieldn->value = MEM_dupallocN(custom_fieldn->value);
+ }
+
+ return stamp_datan;
+}
+
+void BKE_stamp_data_free(StampData *stamp_data)
{
if (stamp_data == NULL) {
return;
@@ -2183,11 +2231,28 @@ void BKE_imbuf_stamp_info(RenderResult *rr, struct ImBuf *ibuf)
BKE_stamp_info_callback(ibuf, stamp_data, metadata_set_field, false);
}
+static void metadata_copy_custom_fields(
+ const char *field,
+ const char *value,
+ void *rr_v)
+{
+ if (BKE_stamp_is_known_field(field)) {
+ return;
+ }
+ RenderResult *rr = (RenderResult *)rr_v;
+ BKE_render_result_stamp_data(rr, field, value);
+}
+
void BKE_stamp_info_from_imbuf(RenderResult *rr, struct ImBuf *ibuf)
{
+ if (rr->stamp_data == NULL) {
+ rr->stamp_data = MEM_callocN(sizeof(StampData), "RenderResult.stamp_data");
+ }
struct StampData *stamp_data = rr->stamp_data;
IMB_metadata_ensure(&ibuf->metadata);
BKE_stamp_info_callback(ibuf, stamp_data, metadata_get_field, true);
+ /* Copy render engine specific settings. */
+ IMB_metadata_foreach(ibuf, metadata_copy_custom_fields, rr);
}
bool BKE_imbuf_alpha_test(ImBuf *ibuf)
@@ -2505,7 +2570,7 @@ Image *BKE_image_verify_viewer(Main *bmain, int type, const char *name)
{
Image *ima;
- for (ima = bmain->image.first; ima; ima = ima->id.next)
+ for (ima = bmain->images.first; ima; ima = ima->id.next)
if (ima->source == IMA_SRC_VIEWER)
if (ima->type == type)
break;
@@ -2578,62 +2643,148 @@ void BKE_image_verify_viewer_views(const RenderData *rd, Image *ima, ImageUser *
BLI_thread_unlock(LOCK_DRAW_IMAGE);
}
-void BKE_image_walk_all_users(const Main *mainp, void *customdata,
- void callback(Image *ima, ImageUser *iuser, void *customdata))
+static void image_walk_ntree_all_users(bNodeTree *ntree, void *customdata,
+ void callback(Image *ima, ImageUser *iuser, void *customdata))
{
- wmWindowManager *wm;
- wmWindow *win;
- Tex *tex;
-
- /* texture users */
- for (tex = mainp->tex.first; tex; tex = tex->id.next) {
- if (tex->type == TEX_IMAGE && tex->ima) {
- callback(tex->ima, &tex->iuser, customdata);
- }
-
- if (tex->nodetree) {
- bNode *node;
- for (node = tex->nodetree->nodes.first; node; node = node->next) {
+ switch (ntree->type) {
+ case NTREE_SHADER:
+ for (bNode *node = ntree->nodes.first; node; node = node->next) {
+ if (node->id) {
+ if (node->type == SH_NODE_TEX_IMAGE) {
+ NodeTexImage *tex = node->storage;
+ Image *ima = (Image *)node->id;
+ callback(ima, &tex->iuser, customdata);
+ }
+ if (node->type == SH_NODE_TEX_ENVIRONMENT) {
+ NodeTexImage *tex = node->storage;
+ Image *ima = (Image *)node->id;
+ callback(ima, &tex->iuser, customdata);
+ }
+ }
+ }
+ break;
+ case NTREE_TEXTURE:
+ for (bNode *node = ntree->nodes.first; node; node = node->next) {
if (node->id && node->type == TEX_NODE_IMAGE) {
Image *ima = (Image *)node->id;
ImageUser *iuser = node->storage;
callback(ima, iuser, customdata);
}
}
- }
+ break;
+ case NTREE_COMPOSIT:
+ for (bNode *node = ntree->nodes.first; node; node = node->next) {
+ if (node->id && node->type == CMP_NODE_IMAGE) {
+ Image *ima = (Image *)node->id;
+ ImageUser *iuser = node->storage;
+ callback(ima, iuser, customdata);
+ }
+ }
+ break;
}
+}
- for (Camera *cam = mainp->camera.first; cam; cam = cam->id.next) {
- for (CameraBGImage *bgpic = cam->bg_images.first; bgpic; bgpic = bgpic->next) {
- callback(bgpic->ima, &bgpic->iuser, customdata);
+void BKE_image_walk_id_all_users(ID *id, void *customdata,
+ void callback(Image *ima, ImageUser *iuser, void *customdata))
+{
+ switch (GS(id->name)) {
+ case ID_OB:
+ {
+ Object *ob = (Object *)id;
+ if (ob->empty_drawtype == OB_EMPTY_IMAGE && ob->data) {
+ callback(ob->data, ob->iuser, customdata);
+ }
+ break;
}
- }
-
- /* 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) {
- const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
-
- for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- if (sa->spacetype == SPACE_IMAGE) {
- SpaceImage *sima = sa->spacedata.first;
- callback(sima->image, &sima->iuser, customdata);
- }
- else if (sa->spacetype == SPACE_NODE) {
- SpaceNode *snode = sa->spacedata.first;
- if (snode->nodetree && snode->nodetree->type == NTREE_COMPOSIT) {
- bNode *node;
- 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;
- callback(ima, iuser, customdata);
- }
- }
+ case ID_MA:
+ {
+ Material *ma = (Material *)id;
+ if (ma->nodetree && ma->use_nodes) {
+ image_walk_ntree_all_users(ma->nodetree, customdata, callback);
+ }
+ break;
+ }
+ case ID_TE:
+ {
+ Tex *tex = (Tex *)id;
+ if (tex->type == TEX_IMAGE && tex->ima) {
+ callback(tex->ima, &tex->iuser, customdata);
+ }
+ if (tex->nodetree && tex->use_nodes) {
+ image_walk_ntree_all_users(tex->nodetree, customdata, callback);
+ }
+ break;
+ }
+ case ID_NT:
+ {
+ bNodeTree *ntree = (bNodeTree *)id;
+ image_walk_ntree_all_users(ntree, customdata, callback);
+ break;
+ }
+ case ID_CA:
+ {
+ Camera *cam = (Camera *)id;
+ for (CameraBGImage *bgpic = cam->bg_images.first; bgpic; bgpic = bgpic->next) {
+ callback(bgpic->ima, &bgpic->iuser, customdata);
+ }
+ break;
+ }
+ case ID_WM:
+ {
+ wmWindowManager *wm = (wmWindowManager *)id;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
+
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ if (sa->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = sa->spacedata.first;
+ callback(sima->image, &sima->iuser, customdata);
}
}
}
+ break;
+ }
+ case ID_SCE:
+ {
+ Scene *scene = (Scene *)id;
+ if (scene->nodetree && scene->use_nodes) {
+ image_walk_ntree_all_users(scene->nodetree, customdata, callback);
+ }
}
+ default:
+ break;
+ }
+}
+
+void BKE_image_walk_all_users(const Main *mainp, void *customdata,
+ void callback(Image *ima, ImageUser *iuser, void *customdata))
+{
+ for (Scene *scene = mainp->scenes.first; scene; scene = scene->id.next) {
+ BKE_image_walk_id_all_users(&scene->id, customdata, callback);
+ }
+
+ for (Object *ob = mainp->objects.first; ob; ob = ob->id.next) {
+ BKE_image_walk_id_all_users(&ob->id, customdata, callback);
+ }
+
+ for (bNodeTree *ntree = mainp->nodetrees.first; ntree; ntree = ntree->id.next) {
+ BKE_image_walk_id_all_users(&ntree->id, customdata, callback);
+ }
+
+ for (Material *ma = mainp->materials.first; ma; ma = ma->id.next) {
+ BKE_image_walk_id_all_users(&ma->id, customdata, callback);
+ }
+
+ for (Tex *tex = mainp->textures.first; tex; tex = tex->id.next) {
+ BKE_image_walk_id_all_users(&tex->id, customdata, callback);
+ }
+
+ for (Camera *cam = mainp->cameras.first; cam; cam = cam->id.next) {
+ BKE_image_walk_id_all_users(&cam->id, customdata, callback);
+ }
+
+ for (wmWindowManager *wm = mainp->wm.first; wm; wm = wm->id.next) { /* only 1 wm */
+ BKE_image_walk_id_all_users(&wm->id, customdata, callback);
}
}
@@ -2643,6 +2794,19 @@ static void image_tag_frame_recalc(Image *ima, ImageUser *iuser, void *customdat
if (ima == changed_image && BKE_image_is_animated(ima)) {
iuser->flag |= IMA_NEED_FRAME_RECALC;
+ iuser->ok = 1;
+ }
+}
+
+static void image_tag_reload(Image *ima, ImageUser *iuser, void *customdata)
+{
+ Image *changed_image = customdata;
+
+ if (ima == changed_image) {
+ iuser->ok = 1;
+ if (iuser->scene) {
+ image_update_views_format(ima, iuser);
+ }
}
}
@@ -2715,9 +2879,9 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
BKE_image_free_buffers(ima);
ima->ok = 1;
- if (iuser)
- iuser->ok = 1;
-
+ if (iuser) {
+ image_tag_frame_recalc(ima, iuser, ima);
+ }
BKE_image_walk_all_users(bmain, ima, image_tag_frame_recalc);
break;
@@ -2754,12 +2918,9 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
BKE_image_free_buffers(ima);
if (iuser) {
- iuser->ok = 1;
- if (iuser->scene) {
- image_update_views_format(ima, iuser);
- }
+ image_tag_reload(ima, iuser, ima);
}
-
+ BKE_image_walk_all_users(bmain, ima, image_tag_reload);
break;
case IMA_SIGNAL_USER_NEW_IMAGE:
if (iuser) {
@@ -2788,7 +2949,7 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
* this also makes sure all scenes are accounted for. */
{
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->nodetree) {
nodeUpdateID(scene->nodetree, &ima->id);
}
@@ -3078,8 +3239,10 @@ static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr)
IMB_exr_close(ibuf->userdata);
ibuf->userdata = NULL;
- if (ima->rr)
+ if (ima->rr != NULL) {
ima->rr->framenr = framenr;
+ BKE_stamp_info_from_imbuf(ima->rr, ibuf);
+ }
/* set proper views */
image_init_multilayer_multiview(ima, ima->rr);
@@ -3140,7 +3303,7 @@ static ImBuf *load_sequence_single(Image *ima, ImageUser *iuser, int frame, cons
/* XXX temp stuff? */
if (ima->lastframe != frame)
- ima->tpageflag |= IMA_TPAGE_REFRESH;
+ ima->gpuflag |= IMA_GPU_REFRESH;
ima->lastframe = frame;
@@ -3280,6 +3443,8 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f
ibuf->mall = IB_rectfloat;
ibuf->channels = rpass->channels;
+ BKE_imbuf_stamp_info(ima->rr, ibuf);
+
image_initialize_after_load(ima, ibuf);
image_assign_ibuf(ima, ibuf, iuser ? iuser->multi_index : 0, frame);
@@ -3479,7 +3644,7 @@ static ImBuf *load_image_single(
*r_assign = true;
/* make packed file for autopack */
- if ((has_packed == false) && (G.fileflags & G_AUTOPACK)) {
+ if ((has_packed == false) && (G.fileflags & G_FILE_AUTOPACK)) {
ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image Packefile");
BLI_addtail(&ima->packedfiles, imapf);
@@ -3591,6 +3756,8 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
ibuf->flags |= IB_rectfloat;
ibuf->channels = rpass->channels;
+ BKE_imbuf_stamp_info(ima->rr, ibuf);
+
image_assign_ibuf(ima, ibuf, iuser ? iuser->multi_index : IMA_NO_INDEX, 0);
}
}
@@ -3791,6 +3958,15 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
ibuf->flags &= ~IB_zbuffloat;
}
+ /* TODO(sergey): Make this faster by either simply referencing the stamp
+ * or by changing both ImBug and RenderResult to use same data type to
+ * store metadata. */
+ if (ibuf->metadata != NULL) {
+ IMB_metadata_free(ibuf->metadata);
+ ibuf->metadata = NULL;
+ }
+ BKE_imbuf_stamp_info(&rres, ibuf);
+
BLI_thread_unlock(LOCK_COLORMANAGE);
ibuf->dither = dither;
@@ -3860,7 +4036,7 @@ static ImBuf *image_get_cached_ibuf(Image *ima, ImageUser *iuser, int *r_frame,
ibuf = image_get_cached_ibuf_for_index_frame(ima, index, frame);
/* XXX temp stuff? */
if (ima->lastframe != frame)
- ima->tpageflag |= IMA_TPAGE_REFRESH;
+ ima->gpuflag |= IMA_GPU_REFRESH;
ima->lastframe = frame;
}
else if (ima->source == IMA_SRC_SEQUENCE) {
@@ -3870,7 +4046,7 @@ static ImBuf *image_get_cached_ibuf(Image *ima, ImageUser *iuser, int *r_frame,
/* XXX temp stuff? */
if (ima->lastframe != frame) {
- ima->tpageflag |= IMA_TPAGE_REFRESH;
+ ima->gpuflag |= IMA_GPU_REFRESH;
}
ima->lastframe = frame;
@@ -4265,36 +4441,77 @@ void BKE_image_user_frame_calc(ImageUser *iuser, int cfra)
iuser->flag &= ~IMA_USER_FRAME_IN_RANGE;
}
- /* allows image users to handle redraws */
- 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;
}
}
-void BKE_image_user_check_frame_calc(ImageUser *iuser, int cfra)
+/* goes over all ImageUsers, and sets frame numbers if auto-refresh is set */
+static void image_editors_update_frame(struct Image *UNUSED(ima), struct ImageUser *iuser, void *customdata)
{
- if ((iuser->flag & IMA_ANIM_ALWAYS) || (iuser->flag & IMA_NEED_FRAME_RECALC)) {
- BKE_image_user_frame_calc(iuser, cfra);
+ int cfra = *(int *)customdata;
+ if ((iuser->flag & IMA_ANIM_ALWAYS) ||
+ (iuser->flag & IMA_NEED_FRAME_RECALC))
+ {
+ BKE_image_user_frame_calc(iuser, cfra);
iuser->flag &= ~IMA_NEED_FRAME_RECALC;
}
}
-/* goes over all ImageUsers, and sets frame numbers if auto-refresh is set */
-static void image_update_frame(struct Image *UNUSED(ima), struct ImageUser *iuser, void *customdata)
+void BKE_image_editors_update_frame(const Main *bmain, int cfra)
{
- int cfra = *(int *)customdata;
+ /* This only updates images used by the user interface. For others the
+ * dependency graph will call BKE_image_user_id_eval_animation. */
+ wmWindowManager *wm = bmain->wm.first;
+ BKE_image_walk_id_all_users(&wm->id, &cfra, image_editors_update_frame);
+}
- BKE_image_user_check_frame_calc(iuser, cfra);
+static void image_user_id_has_animation(struct Image *ima, struct ImageUser *UNUSED(iuser), void *customdata)
+{
+ if (ima && BKE_image_is_animated(ima)) {
+ *(bool *)customdata = true;
+ }
+}
+
+bool BKE_image_user_id_has_animation(ID *id)
+{
+ bool has_animation = false;
+ BKE_image_walk_id_all_users(id, &has_animation, image_user_id_has_animation);
+ return has_animation;
+}
+
+static void image_user_id_eval_animation(struct Image *ima, struct ImageUser *iuser, void *customdata)
+{
+ if (ima && BKE_image_is_animated(ima)) {
+ Depsgraph *depsgraph = (Depsgraph *)customdata;
+
+ if ((iuser->flag & IMA_ANIM_ALWAYS) ||
+ (iuser->flag & IMA_NEED_FRAME_RECALC) ||
+ (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER))
+ {
+ int framenr = iuser->framenr;
+ float cfra = DEG_get_ctime(depsgraph);
+
+ BKE_image_user_frame_calc(iuser, cfra);
+ iuser->flag &= ~IMA_NEED_FRAME_RECALC;
+
+ if (iuser->framenr != framenr) {
+ /* Note: a single texture and refresh doesn't really work when
+ * multiple image users may use different frames, this is to
+ * be improved with perhaps a GPU texture cache. */
+ ima->gpuflag |= IMA_GPU_REFRESH;
+ }
+ }
+ }
}
-void BKE_image_update_frame(const Main *bmain, int cfra)
+void BKE_image_user_id_eval_animation(Depsgraph *depsgraph, ID *id)
{
- BKE_image_walk_all_users(bmain, &cfra, image_update_frame);
+ /* This is called from the dependency graph to update the image
+ * users in datablocks. It computes the current frame number
+ * and tags the image to be refreshed. */
+ BKE_image_walk_id_all_users(id, depsgraph, image_user_id_eval_animation);
}
void BKE_image_user_file_path(ImageUser *iuser, Image *ima, char *filepath)
@@ -4462,11 +4679,7 @@ bool BKE_image_has_packedfile(Image *ima)
return (BLI_listbase_is_empty(&ima->packedfiles) == false);
}
-/**
- * Checks the image buffer changes (not keyframed values)
- *
- * to see if we need to call #BKE_image_user_check_frame_calc
- */
+/* Checks the image buffer changes with time (not keyframed values). */
bool BKE_image_is_animated(Image *image)
{
return ELEM(image->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE);
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 1f1f4c9d341..2df3495b78e 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Matt Ebb, Campbell Barton, Shuvro Sarker
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/image_gen.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <math.h>
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index aae208dd967..954026ea560 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): 2008,2009 Joshua Leung (IPO System cleanup, Animation System Recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/ipo.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -49,7 +41,7 @@
#include "DNA_anim_types.h"
#include "DNA_constraint_types.h"
#include "DNA_camera_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
@@ -77,12 +69,16 @@
#include "BKE_nla.h"
#include "BKE_sequencer.h"
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#ifdef WIN32
# include "BLI_math_base.h" /* M_PI */
#endif
+static CLG_LogRef LOG = {"bke.ipo"};
+
/* *************************************************** */
/* Old-Data Freeing Tools */
@@ -142,7 +138,7 @@ static AdrBit2Path ob_layer_bits[] = {
{(1 << 16), "layers", 16},
{(1 << 17), "layers", 17},
{(1 << 18), "layers", 18},
- {(1 << 19), "layers", 19}
+ {(1 << 19), "layers", 19},
};
/* ----------------- */
@@ -292,7 +288,7 @@ static const char *pchan_adrcodes_to_paths(int adrcode, int *array_index)
}
/* for debugging only */
- printf("ERROR: unmatched PoseChannel setting (code %d)\n", adrcode);
+ CLOG_ERROR(&LOG, "unmatched PoseChannel setting (code %d)", adrcode);
return NULL;
}
@@ -605,7 +601,7 @@ static const char *camera_adrcodes_to_paths(int adrcode, int *array_index)
case CAM_YF_APERT:
poin = &(ca->YF_aperture); break;
case CAM_YF_FDIST:
- poin = &(ca->YF_dofdist); break;
+ poin = &(ca->dof_distance); break;
#endif // XXX these are not defined in RNA
case CAM_SHIFT_X:
@@ -614,12 +610,12 @@ static const char *camera_adrcodes_to_paths(int adrcode, int *array_index)
return "shift_y";
}
- /* unrecognised adrcode, or not-yet-handled ones! */
+ /* unrecognized adrcode, or not-yet-handled ones! */
return NULL;
}
-/* Lamp Types */
-static const char *lamp_adrcodes_to_paths(int adrcode, int *array_index)
+/* Light Types */
+static const char *light_adrcodes_to_paths(int adrcode, int *array_index)
{
/* set array index like this in-case nothing sets it correctly */
*array_index = 0;
@@ -656,7 +652,7 @@ static const char *lamp_adrcodes_to_paths(int adrcode, int *array_index)
return mtex_adrcodes_to_paths(adrcode, array_index);
}
- /* unrecognised adrcode, or not-yet-handled ones! */
+ /* unrecognized adrcode, or not-yet-handled ones! */
return NULL;
}
@@ -681,7 +677,7 @@ static const char *sound_adrcodes_to_paths(int adrcode, int *array_index)
return "attenuation";
}
- /* unrecognised adrcode, or not-yet-handled ones! */
+ /* unrecognized adrcode, or not-yet-handled ones! */
return NULL;
}
@@ -846,8 +842,8 @@ static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[],
propname = camera_adrcodes_to_paths(adrcode, &dummy_index);
break;
- case ID_LA: /* lamp */
- propname = lamp_adrcodes_to_paths(adrcode, &dummy_index);
+ case ID_LA: /* light */
+ propname = light_adrcodes_to_paths(adrcode, &dummy_index);
break;
case ID_SO: /* sound */
@@ -893,7 +889,7 @@ static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[],
/* TODO... add other blocktypes... */
default:
- printf("IPO2ANIMATO WARNING: No path for blocktype %d, adrcode %d yet\n", blocktype, adrcode);
+ CLOG_WARN(&LOG, "No path for blocktype %d, adrcode %d yet", blocktype, adrcode);
break;
}
@@ -1519,7 +1515,7 @@ static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char
if (ELEM(NULL, id, ipo))
return;
if (adt == NULL) {
- printf("ERROR ipo_to_animdata(): adt invalid\n");
+ CLOG_ERROR(&LOG, "adt invalid");
return;
}
@@ -1686,13 +1682,13 @@ void do_versions_ipos_to_animato(Main *bmain)
ID *id;
if (bmain == NULL) {
- printf("Argh! Main is NULL in do_versions_ipos_to_animato()\n");
+ CLOG_ERROR(&LOG, "Argh! Main is NULL");
return;
}
/* only convert if version is right */
if (bmain->versionfile >= 250) {
- printf("WARNING: Animation data too new to convert (Version %d)\n", bmain->versionfile);
+ CLOG_WARN(&LOG, "Animation data too new to convert (Version %d)", bmain->versionfile);
return;
}
else if (G.debug & G_DEBUG)
@@ -1701,7 +1697,7 @@ void do_versions_ipos_to_animato(Main *bmain)
/* ----------- Animation Attached to Data -------------- */
/* objects */
- for (id = bmain->object.first; id; id = id->next) {
+ for (id = bmain->objects.first; id; id = id->next) {
Object *ob = (Object *)id;
bPoseChannel *pchan;
bConstraint *con;
@@ -1828,7 +1824,7 @@ void do_versions_ipos_to_animato(Main *bmain)
}
/* shapekeys */
- for (id = bmain->key.first; id; id = id->next) {
+ for (id = bmain->shapekeys.first; id; id = id->next) {
Key *key = (Key *)id;
if (G.debug & G_DEBUG) printf("\tconverting key %s\n", id->name + 2);
@@ -1853,7 +1849,7 @@ void do_versions_ipos_to_animato(Main *bmain)
}
/* materials */
- for (id = bmain->mat.first; id; id = id->next) {
+ for (id = bmain->materials.first; id; id = id->next) {
Material *ma = (Material *)id;
if (G.debug & G_DEBUG) printf("\tconverting material %s\n", id->name + 2);
@@ -1875,7 +1871,7 @@ void do_versions_ipos_to_animato(Main *bmain)
}
/* worlds */
- for (id = bmain->world.first; id; id = id->next) {
+ for (id = bmain->worlds.first; id; id = id->next) {
World *wo = (World *)id;
if (G.debug & G_DEBUG) printf("\tconverting world %s\n", id->name + 2);
@@ -1897,7 +1893,7 @@ void do_versions_ipos_to_animato(Main *bmain)
}
/* sequence strips */
- for (id = bmain->scene.first; id; id = id->next) {
+ for (id = bmain->scenes.first; id; id = id->next) {
Scene *scene = (Scene *)id;
Editing *ed = scene->ed;
if (ed && ed->seqbasep) {
@@ -1950,7 +1946,7 @@ void do_versions_ipos_to_animato(Main *bmain)
/* textures */
- for (id = bmain->tex.first; id; id = id->next) {
+ for (id = bmain->textures.first; id; id = id->next) {
Tex *te = (Tex *)id;
if (G.debug & G_DEBUG) printf("\tconverting texture %s\n", id->name + 2);
@@ -1972,7 +1968,7 @@ void do_versions_ipos_to_animato(Main *bmain)
}
/* cameras */
- for (id = bmain->camera.first; id; id = id->next) {
+ for (id = bmain->cameras.first; id; id = id->next) {
Camera *ca = (Camera *)id;
if (G.debug & G_DEBUG) printf("\tconverting camera %s\n", id->name + 2);
@@ -1993,9 +1989,9 @@ void do_versions_ipos_to_animato(Main *bmain)
}
}
- /* lamps */
- for (id = bmain->lamp.first; id; id = id->next) {
- Lamp *la = (Lamp *)id;
+ /* lights */
+ for (id = bmain->lights.first; id; id = id->next) {
+ Light *la = (Light *)id;
if (G.debug & G_DEBUG) printf("\tconverting light %s\n", id->name + 2);
@@ -2004,7 +2000,7 @@ void do_versions_ipos_to_animato(Main *bmain)
/* Add AnimData block */
AnimData *adt = BKE_animdata_add_id(id);
- /* Convert Lamp data... */
+ /* Convert Light data... */
ipo_to_animdata(bmain, id, la->ipo, NULL, NULL, NULL);
if (adt->action)
@@ -2016,7 +2012,7 @@ void do_versions_ipos_to_animato(Main *bmain)
}
/* curves */
- for (id = bmain->curve.first; id; id = id->next) {
+ for (id = bmain->curves.first; id; id = id->next) {
Curve *cu = (Curve *)id;
if (G.debug & G_DEBUG) printf("\tconverting curve %s\n", id->name + 2);
@@ -2049,7 +2045,7 @@ void do_versions_ipos_to_animato(Main *bmain)
*/
/* actions */
- for (id = bmain->action.first; id; id = id->next) {
+ for (id = bmain->actions.first; id; id = id->next) {
bAction *act = (bAction *)id;
if (G.debug & G_DEBUG) printf("\tconverting action %s\n", id->name + 2);
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index dce748e3ea3..f85964f76bc 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/key.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -55,7 +47,6 @@
#include "BKE_curve.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
-#include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
@@ -64,7 +55,6 @@
#include "BKE_editmesh.h"
#include "BKE_scene.h"
-
#include "RNA_access.h"
#define KEY_MODE_DUMMY 0 /* use where mode isn't checked for */
@@ -162,7 +152,7 @@ Key *BKE_key_add(Main *bmain, ID *id) /* common function */
/**
* Only copy internal data of ShapeKey ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -189,7 +179,7 @@ void BKE_key_copy_data(Main *UNUSED(bmain), Key *key_dst, const Key *key_src, co
Key *BKE_key_copy(Main *bmain, const Key *key)
{
Key *key_copy;
- BKE_id_copy_ex(bmain, &key->id, (ID **)&key_copy, 0, false);
+ BKE_id_copy(bmain, &key->id, (ID **)&key_copy);
return key_copy;
}
@@ -525,11 +515,11 @@ 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_mesh && me->edit_mesh->bm->totvert == kb->totelem) {
a = 0;
- co = MEM_mallocN(sizeof(float) * 3 * me->edit_btmesh->bm->totvert, "key_block_get_data");
+ co = MEM_mallocN(sizeof(float) * 3 * me->edit_mesh->bm->totvert, "key_block_get_data");
- BM_ITER_MESH (eve, &iter, me->edit_btmesh->bm, BM_VERTS_OF_MESH) {
+ BM_ITER_MESH (eve, &iter, me->edit_mesh->bm, BM_VERTS_OF_MESH) {
copy_v3_v3(co[a], eve->co);
a++;
}
@@ -1063,8 +1053,8 @@ static float *get_weights_array(Object *ob, char *vgroup, WeightsArrayCache *cac
dvert = me->dvert;
totvert = me->totvert;
- if (me->edit_btmesh && me->edit_btmesh->bm->totvert == totvert)
- em = me->edit_btmesh;
+ if (me->edit_mesh && me->edit_mesh->bm->totvert == totvert)
+ em = me->edit_mesh;
}
else if (ob->type == OB_LATTICE) {
Lattice *lt = ob->data;
@@ -1333,9 +1323,6 @@ float *BKE_key_evaluate_object_ex(
out = (char *)arr;
}
- /* prevent python from screwing this up? anyhoo, the from pointer could be dropped */
- key->from = (ID *)ob->data;
-
if (ob->shapeflag & OB_SHAPE_LOCK) {
/* shape locked, copy the locked shape instead of blending */
KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1);
@@ -1377,6 +1364,18 @@ float *BKE_key_evaluate_object(Object *ob, int *r_totelem)
return BKE_key_evaluate_object_ex(ob, r_totelem, NULL, 0);
}
+bool BKE_key_idtype_support(const short id_type)
+{
+ switch (id_type) {
+ case ID_ME:
+ case ID_CU:
+ case ID_LT:
+ return true;
+ default:
+ return false;
+ }
+}
+
Key **BKE_key_from_id_p(ID *id)
{
switch (GS(id->name)) {
@@ -1416,7 +1415,7 @@ Key *BKE_key_from_id(ID *id)
return NULL;
}
-Key **BKE_key_from_object_p(Object *ob)
+Key **BKE_key_from_object_p(const Object *ob)
{
if (ob == NULL || ob->data == NULL)
return NULL;
@@ -1424,7 +1423,7 @@ Key **BKE_key_from_object_p(Object *ob)
return BKE_key_from_id_p(ob->data);
}
-Key *BKE_key_from_object(Object *ob)
+Key *BKE_key_from_object(const Object *ob)
{
Key **key_p;
key_p = BKE_key_from_object_p(ob);
@@ -1689,7 +1688,7 @@ void BKE_keyblock_update_from_curve(Curve *UNUSED(cu), KeyBlock *kb, ListBase *n
for (int i = 0; i < 3; i++) {
copy_v3_v3(&fp[i * 3], bezt->vec[i]);
}
- fp[9] = bezt->alfa;
+ fp[9] = bezt->tilt;
fp[10] = bezt->radius;
fp += KEYELEM_FLOAT_LEN_BEZTRIPLE;
}
@@ -1697,7 +1696,7 @@ void BKE_keyblock_update_from_curve(Curve *UNUSED(cu), KeyBlock *kb, ListBase *n
else {
for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a; a--, bp++) {
copy_v3_v3(fp, bp->vec);
- fp[3] = bp->alfa;
+ fp[3] = bp->tilt;
fp[4] = bp->radius;
fp += KEYELEM_FLOAT_LEN_BPOINT;
}
@@ -1739,7 +1738,7 @@ void BKE_keyblock_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nu
for (int i = 0; i < 3; i++) {
copy_v3_v3(bezt->vec[i], &fp[i * 3]);
}
- bezt->alfa = fp[9];
+ bezt->tilt = fp[9];
bezt->radius = fp[10];
fp += KEYELEM_FLOAT_LEN_BEZTRIPLE;
}
@@ -1747,7 +1746,7 @@ void BKE_keyblock_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nu
else {
for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a && (tot -= KEYELEM_ELEM_LEN_BPOINT) >= 0; a--, bp++) {
copy_v3_v3(bp->vec, fp);
- bp->alfa = fp[3];
+ bp->tilt = fp[3];
bp->radius = fp[4];
fp += KEYELEM_FLOAT_LEN_BPOINT;
}
diff --git a/source/blender/blenkernel/intern/keyconfig.c b/source/blender/blenkernel/intern/keyconfig.c
index f2db375f3ec..6a37a550bc0 100644
--- a/source/blender/blenkernel/intern/keyconfig.c
+++ b/source/blender/blenkernel/intern/keyconfig.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/keyconfig.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stddef.h>
@@ -126,7 +122,7 @@ void BKE_keyconfig_pref_set_select_mouse(UserDef *userdef, int value, bool overr
wmKeyConfigPref *kpt = BKE_keyconfig_pref_ensure(userdef, WM_KEYCONFIG_STR_DEFAULT);
IDProperty *idprop = IDP_GetPropertyFromGroup(kpt->prop, "select_mouse");
if (!idprop) {
- IDPropertyTemplate tmp = { .i = value };
+ IDPropertyTemplate tmp = { .i = value, };
IDP_AddToGroup(kpt->prop, IDP_New(IDP_INT, &tmp, "select_mouse"));
}
else if (override) {
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 02cec8b692e..b3d1b71b1bd 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/lattice.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdio.h>
@@ -57,8 +49,6 @@
#include "BKE_key.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
@@ -276,7 +266,7 @@ Lattice *BKE_lattice_add(Main *bmain, const char *name)
/**
* Only copy internal data of Lattice ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -287,7 +277,7 @@ void BKE_lattice_copy_data(Main *bmain, Lattice *lt_dst, const Lattice *lt_src,
lt_dst->def = MEM_dupallocN(lt_src->def);
if (lt_src->key && (flag & LIB_ID_COPY_SHAPEKEY)) {
- BKE_id_copy_ex(bmain, &lt_src->key->id, (ID **)&lt_dst->key, flag, false);
+ BKE_id_copy_ex(bmain, &lt_src->key->id, (ID **)&lt_dst->key, flag);
}
if (lt_src->dvert) {
@@ -302,7 +292,7 @@ void BKE_lattice_copy_data(Main *bmain, Lattice *lt_dst, const Lattice *lt_src,
Lattice *BKE_lattice_copy(Main *bmain, const Lattice *lt)
{
Lattice *lt_copy;
- BKE_id_copy_ex(bmain, &lt->id, (ID **)&lt_copy, LIB_ID_COPY_SHAPEKEY, false);
+ BKE_id_copy(bmain, &lt->id, (ID **)&lt_copy);
return lt_copy;
}
@@ -1100,11 +1090,11 @@ static void boundbox_lattice(Object *ob)
Lattice *lt;
float min[3], max[3];
- if (ob->bb == NULL) {
- ob->bb = MEM_callocN(sizeof(BoundBox), "Lattice boundbox");
+ if (ob->runtime.bb == NULL) {
+ ob->runtime.bb = MEM_callocN(sizeof(BoundBox), "Lattice boundbox");
}
- bb = ob->bb;
+ bb = ob->runtime.bb;
lt = ob->data;
INIT_MINMAX(min, max);
@@ -1118,7 +1108,7 @@ BoundBox *BKE_lattice_boundbox_get(Object *ob)
{
boundbox_lattice(ob);
- return ob->bb;
+ return ob->runtime.bb;
}
void BKE_lattice_minmax_dl(Object *ob, Lattice *lt, float min[3], float max[3])
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 28833383029..a5360f34312 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* 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): Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/layer.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <string.h>
-#include "BLI_array.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
@@ -37,7 +30,6 @@
#include "BKE_animsys.h"
#include "BKE_collection.h"
#include "BKE_freestyle.h"
-#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_main.h"
@@ -62,6 +54,14 @@
#include "MEM_guardedalloc.h"
+/* Set of flags which are dependent on a collection settings. */
+static const short g_base_collection_flags = (
+ BASE_VISIBLE |
+ BASE_SELECTABLE |
+ BASE_ENABLED_VIEWPORT |
+ BASE_ENABLED_RENDER |
+ BASE_HOLDOUT |
+ BASE_INDIRECT_ONLY);
/* prototype */
static void object_bases_iterator_next(BLI_Iterator *iter, const int flag);
@@ -611,7 +611,7 @@ int BKE_layer_collection_findindex(ViewLayer *view_layer, const LayerCollection
static short layer_collection_sync(
ViewLayer *view_layer, const ListBase *lb_scene,
ListBase *lb_layer, ListBase *new_object_bases,
- short parent_exclude, short parent_restrict)
+ short parent_exclude, short parent_restrict, short parent_layer_restrict)
{
/* TODO: support recovery after removal of intermediate collections, reordering, ..
* For local edits we can make editing operating do the appropriate thing, but for
@@ -656,15 +656,17 @@ static short layer_collection_sync(
/* Collection restrict is inherited. */
short child_restrict = parent_restrict;
+ short child_layer_restrict = parent_layer_restrict;
if (!(collection->flag & COLLECTION_IS_MASTER)) {
child_restrict |= collection->flag;
+ child_layer_restrict |= lc->flag;
}
/* Sync child collections. */
short child_runtime_flag = layer_collection_sync(
view_layer, &collection->children,
&lc->layer_collections, new_object_bases,
- lc->flag, child_restrict);
+ lc->flag, child_restrict, child_layer_restrict);
/* Layer collection exclude is not inherited. */
if (lc->flag & LAYER_COLLECTION_EXCLUDE) {
@@ -675,6 +677,12 @@ static short layer_collection_sync(
lc->runtime_flag = child_runtime_flag;
}
+ if (((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) &&
+ ((child_layer_restrict & LAYER_COLLECTION_RESTRICT_VIEW) == 0))
+ {
+ lc->runtime_flag |= LAYER_COLLECTION_VISIBLE;
+ }
+
/* Sync objects, except if collection was excluded. */
for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
if (cob->ob == NULL) {
@@ -700,50 +708,32 @@ static short layer_collection_sync(
BLI_addtail(new_object_bases, base);
}
- int object_restrict = base->object->restrictflag;
-
- if (((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) &&
- ((object_restrict & OB_RESTRICT_VIEW) == 0))
- {
- base->flag |= BASE_VISIBLE | BASE_ENABLED | BASE_ENABLED_VIEWPORT;
-
- if (((child_restrict & COLLECTION_RESTRICT_SELECT) == 0) &&
- ((object_restrict & OB_RESTRICT_SELECT) == 0))
- {
- base->flag |= BASE_SELECTABLE;
+ if ((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) {
+ base->flag_from_collection |= BASE_ENABLED_VIEWPORT;
+ if ((child_layer_restrict & LAYER_COLLECTION_RESTRICT_VIEW) == 0) {
+ base->flag_from_collection |= BASE_VISIBLE;
+ if (((child_restrict & COLLECTION_RESTRICT_SELECT) == 0)) {
+ base->flag_from_collection |= BASE_SELECTABLE;
+ }
}
}
- if (((child_restrict & COLLECTION_RESTRICT_RENDER) == 0) &&
- ((object_restrict & OB_RESTRICT_RENDER) == 0))
-
- {
- base->flag |= BASE_ENABLED_RENDER;
- }
-
- /* Update runtime flags used for display and tools. */
- if (base->flag & BASE_VISIBLE) {
- lc->runtime_flag |= LAYER_COLLECTION_HAS_ENABLED_OBJECTS;
- }
-
- if (base->flag & BASE_HIDDEN) {
- base->flag &= ~BASE_VISIBLE;
- view_layer->runtime_flag |= VIEW_LAYER_HAS_HIDE;
- lc->runtime_flag |= LAYER_COLLECTION_HAS_HIDDEN_OBJECTS;
- }
- else if (base->flag & BASE_VISIBLE) {
- lc->runtime_flag |= LAYER_COLLECTION_HAS_VISIBLE_OBJECTS;
+ if ((child_restrict & COLLECTION_RESTRICT_RENDER) == 0) {
+ base->flag_from_collection |= BASE_ENABLED_RENDER;
}
/* Holdout and indirect only */
if (lc->flag & LAYER_COLLECTION_HOLDOUT) {
- base->flag |= BASE_HOLDOUT;
+ base->flag_from_collection |= BASE_HOLDOUT;
}
if (lc->flag & LAYER_COLLECTION_INDIRECT_ONLY) {
- base->flag |= BASE_INDIRECT_ONLY;
+ base->flag_from_collection |= BASE_INDIRECT_ONLY;
}
lc->runtime_flag |= LAYER_COLLECTION_HAS_OBJECTS;
+
+ /* Make sure flags on base are usable right away. */
+ BKE_base_eval_flags(base);
}
runtime_flag |= lc->runtime_flag;
@@ -778,27 +768,20 @@ void BKE_layer_collection_sync(const Scene *scene, ViewLayer *view_layer)
/* Clear visible and selectable flags to be reset. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- base->flag &= ~(BASE_VISIBLE |
- BASE_ENABLED |
- BASE_SELECTABLE |
- BASE_ENABLED_VIEWPORT |
- BASE_ENABLED_RENDER |
- BASE_HOLDOUT |
- BASE_INDIRECT_ONLY);
+ base->flag &= ~g_base_collection_flags;
+ base->flag_from_collection &= ~g_base_collection_flags;
}
- view_layer->runtime_flag = 0;
-
/* Generate new layer connections and object bases when collections changed. */
CollectionChild child = {NULL, NULL, scene->master_collection};
const ListBase collections = {&child, &child};
ListBase new_object_bases = {NULL, NULL};
- const short parent_exclude = 0, parent_restrict = 0;
+ const short parent_exclude = 0, parent_restrict = 0, parent_layer_restrict = 0;
layer_collection_sync(
view_layer, &collections,
&view_layer->layer_collections, &new_object_bases,
- parent_exclude, parent_restrict);
+ parent_exclude, parent_restrict, parent_layer_restrict);
/* Any remaning object bases are to be removed. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
@@ -839,7 +822,7 @@ void BKE_main_collection_sync(const Main *bmain)
/* TODO: optimize for file load so only linked collections get checked? */
- for (const Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (const Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
BKE_scene_collection_sync(scene);
}
}
@@ -849,7 +832,7 @@ void BKE_main_collection_sync_remap(const Main *bmain)
/* On remapping of object or collection pointers free caches. */
/* TODO: try to make this faster */
- for (const Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (const Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
MEM_SAFE_FREE(view_layer->object_bases_array);
@@ -860,7 +843,7 @@ void BKE_main_collection_sync_remap(const Main *bmain)
}
}
- for (Collection *collection = bmain->collection.first; collection; collection = collection->id.next) {
+ for (Collection *collection = bmain->collections.first; collection; collection = collection->id.next) {
BKE_collection_object_cache_free(collection);
DEG_id_tag_update_ex((Main *)bmain, &collection->id, ID_RECALC_COPY_ON_WRITE);
}
@@ -922,7 +905,7 @@ bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerColle
for (CollectionObject *cob = lc->collection->gobject.first; cob; cob = cob->next) {
Base *base = BKE_view_layer_base_find(view_layer, cob->ob);
- if (base && (base->flag & BASE_SELECTED)) {
+ if (base && (base->flag & BASE_SELECTED) && (base->flag & BASE_VISIBLE)) {
return true;
}
}
@@ -937,6 +920,20 @@ bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerColle
return false;
}
+bool BKE_layer_collection_has_layer_collection(LayerCollection *lc_parent, LayerCollection *lc_child)
+{
+ if (lc_parent == lc_child) {
+ return true;
+ }
+
+ for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ if (BKE_layer_collection_has_layer_collection(lc_iter, lc_child)) {
+ return true;
+ }
+ }
+ return false;
+}
+
/* ---------------------------------------------------------------------- */
/* Update after toggling visibility of an object base. */
@@ -958,47 +955,147 @@ void BKE_base_set_visible(Scene *scene, ViewLayer *view_layer, Base *base, bool
BKE_layer_collection_sync(scene, view_layer);
}
-void BKE_layer_collection_set_visible(Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool extend)
+static void layer_collection_flag_set_recursive(LayerCollection *lc, const int flag)
+{
+ lc->flag |= flag;
+ for (LayerCollection *lc_iter = lc->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ layer_collection_flag_set_recursive(lc_iter, flag);
+ }
+}
+
+static void layer_collection_flag_unset_recursive(LayerCollection *lc, const int flag)
{
+ lc->flag &= ~flag;
+ for (LayerCollection *lc_iter = lc->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ layer_collection_flag_unset_recursive(lc_iter, flag);
+ }
+}
+
+/**
+ * Isolate the collection - hide all other collections but this one.
+ * Make sure to show all the direct parents and all children of the layer collection as well.
+ * When extending we simply show the collections and its direct family.
+ *
+ * If the collection or any of its parents is disabled, make it enabled.
+ * Don't change the children disable state though.
+ *
+ * Return whether depsgraph needs update.
+ */
+bool BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool extend)
+{
+ bool depsgraph_need_update = false;
+ LayerCollection *lc_master = view_layer->layer_collections.first;
+
+ if (!ID_IS_LINKED(lc->collection)) {
+ if (lc->collection->flag & COLLECTION_RESTRICT_VIEW) {
+ lc->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
+ depsgraph_need_update = true;
+ }
+ }
+
if (!extend) {
- /* Make only objects from one collection visible. */
- for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- base->flag |= BASE_HIDDEN;
+ /* Hide all collections . */
+ for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ layer_collection_flag_set_recursive(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW);
}
+ }
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(lc->collection, ob)
- {
- Base *base = BLI_ghash_lookup(view_layer->object_bases_hash, ob);
+ /* Make all the direct parents visible. */
+ LayerCollection *lc_parent = lc;
+ for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) {
+ lc_parent = lc_iter;
+ break;
+ }
+ }
- if (base) {
- base->flag &= ~BASE_HIDDEN;
+ while (lc_parent != lc) {
+ if (!ID_IS_LINKED(lc_parent->collection)) {
+ if (lc_parent->collection->flag & COLLECTION_RESTRICT_VIEW) {
+ lc_parent->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
+ depsgraph_need_update = true;
}
}
- FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
-
- BKE_layer_collection_activate(view_layer, lc);
- }
- else {
- /* Toggle visibility of objects from collection. */
- bool hide = (lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS) != 0;
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(lc->collection, ob)
- {
- Base *base = BLI_ghash_lookup(view_layer->object_bases_hash, ob);
+ lc_parent->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
- if (base) {
- if (hide) {
- base->flag |= BASE_HIDDEN;
- }
- else {
- base->flag &= ~BASE_HIDDEN;
- }
+ for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) {
+ lc_parent = lc_iter;
+ break;
}
}
- FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}
+ /* Make all the children visible, but respect their disable state. */
+ layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW);
+
+ BKE_layer_collection_activate(view_layer, lc);
+
BKE_layer_collection_sync(scene, view_layer);
+
+ return depsgraph_need_update;
+}
+
+static void layer_collection_bases_show_recursive(ViewLayer *view_layer, LayerCollection *lc)
+{
+ for (CollectionObject *cob = lc->collection->gobject.first; cob; cob = cob->next) {
+ Base *base = BKE_view_layer_base_find(view_layer, cob->ob);
+ base->flag &= ~BASE_HIDDEN;
+ }
+ for (LayerCollection *lc_iter = lc->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ layer_collection_bases_show_recursive(view_layer, lc_iter);
+ }
+}
+
+static void layer_collection_bases_hide_recursive(ViewLayer *view_layer, LayerCollection *lc)
+{
+ for (CollectionObject *cob = lc->collection->gobject.first; cob; cob = cob->next) {
+ Base *base = BKE_view_layer_base_find(view_layer, cob->ob);
+ base->flag |= BASE_HIDDEN;
+ }
+ for (LayerCollection *lc_iter = lc->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ layer_collection_bases_hide_recursive(view_layer, lc_iter);
+ }
+}
+
+/**
+ * Hide/show all the elements of a collection.
+ * Don't change the collection children enable/disable state, but it may change it for the collection itself.
+ *
+ * Return true if depsgraph needs update.
+ */
+bool BKE_layer_collection_set_visible(ViewLayer *view_layer, LayerCollection *lc, const bool visible, const bool hierarchy)
+{
+ bool depsgraph_changed = false;
+
+ if (visible &&
+ (!ID_IS_LINKED(lc->collection)) &&
+ ((lc->collection->flag & COLLECTION_RESTRICT_VIEW) != 0))
+ {
+ lc->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
+ depsgraph_changed = true;
+ }
+
+ if (hierarchy) {
+ if (visible) {
+ layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW);
+ layer_collection_bases_show_recursive(view_layer, lc);
+ }
+ else {
+ layer_collection_flag_set_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW);
+ layer_collection_bases_hide_recursive(view_layer, lc);
+ }
+ }
+ else {
+ if (visible) {
+ lc->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
+ }
+ else {
+ lc->flag |= LAYER_COLLECTION_RESTRICT_VIEW;
+ }
+ }
+ return depsgraph_changed;
}
/* ---------------------------------------------------------------------- */
@@ -1071,29 +1168,17 @@ typedef struct LayerObjectBaseIteratorData {
Base *base;
} LayerObjectBaseIteratorData;
-static bool object_bases_iterator_is_valid_ex(View3D *v3d, Base *base, const int flag)
+static bool object_bases_iterator_is_valid(View3D *v3d, Base *base, const int flag)
{
- if (v3d != NULL) {
- BLI_assert(v3d->spacetype == SPACE_VIEW3D);
- if ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0) {
- return false;
- }
+ BLI_assert((v3d == NULL) || (v3d->spacetype == SPACE_VIEW3D));
- if (v3d->localvd && ((base->local_view_bits & v3d->local_view_uuid) == 0)) {
- return false;
- }
+ /* Any flag satisfies the condition. */
+ if (flag == ~0) {
+ return (base->flag != 0);
}
- if ((base->flag & flag) == 0) {
- return false;
- }
-
- return true;
-}
-
-static bool object_bases_iterator_is_valid(View3D *v3d, Base *base)
-{
- return object_bases_iterator_is_valid_ex(v3d, base, ~(0));
+ /* Flags may be more than one flag, so we can't check != 0. */
+ return BASE_VISIBLE(v3d, base) && ((base->flag & flag) == flag);
}
static void object_bases_iterator_begin(BLI_Iterator *iter, void *data_in_v, const int flag)
@@ -1116,7 +1201,7 @@ static void object_bases_iterator_begin(BLI_Iterator *iter, void *data_in_v, con
data->v3d = v3d;
data->base = base;
- if (object_bases_iterator_is_valid_ex(v3d, base, flag) == false) {
+ if (object_bases_iterator_is_valid(v3d, base, flag) == false) {
object_bases_iterator_next(iter, flag);
}
else {
@@ -1130,7 +1215,7 @@ static void object_bases_iterator_next(BLI_Iterator *iter, const int flag)
Base *base = data->base->next;
while (base) {
- if (object_bases_iterator_is_valid_ex(data->v3d, base, flag)) {
+ if (object_bases_iterator_is_valid(data->v3d, base, flag)) {
iter->current = base;
data->base = base;
return;
@@ -1176,12 +1261,12 @@ static void objects_iterator_end(BLI_Iterator *iter)
void BKE_view_layer_selected_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
{
- objects_iterator_begin(iter, data_in, BASE_SELECTED);
+ objects_iterator_begin(iter, data_in, BASE_VISIBLE | BASE_SELECTED);
}
void BKE_view_layer_selected_objects_iterator_next(BLI_Iterator *iter)
{
- objects_iterator_next(iter, BASE_SELECTED);
+ objects_iterator_next(iter, BASE_VISIBLE | BASE_SELECTED);
}
void BKE_view_layer_selected_objects_iterator_end(BLI_Iterator *iter)
@@ -1197,12 +1282,12 @@ void BKE_view_layer_selected_objects_iterator_end(BLI_Iterator *iter)
void BKE_view_layer_visible_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
{
- objects_iterator_begin(iter, data_in, BASE_VISIBLE);
+ objects_iterator_begin(iter, data_in, 0);
}
void BKE_view_layer_visible_objects_iterator_next(BLI_Iterator *iter)
{
- objects_iterator_next(iter, BASE_VISIBLE);
+ objects_iterator_next(iter, 0);
}
void BKE_view_layer_visible_objects_iterator_end(BLI_Iterator *iter)
@@ -1218,7 +1303,7 @@ void BKE_view_layer_visible_objects_iterator_end(BLI_Iterator *iter)
void BKE_view_layer_selected_editable_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
{
- objects_iterator_begin(iter, data_in, BASE_SELECTED);
+ objects_iterator_begin(iter, data_in, BASE_VISIBLE | BASE_SELECTED);
if (iter->valid) {
if (BKE_object_is_libdata((Object *)iter->current) == false) {
// First object is valid (selectable and not libdata) -> all good.
@@ -1235,7 +1320,7 @@ void BKE_view_layer_selected_editable_objects_iterator_next(BLI_Iterator *iter)
{
// Search while there are objects and the one we have is not editable (editable = not libdata).
do {
- objects_iterator_next(iter, BASE_SELECTED);
+ objects_iterator_next(iter, BASE_VISIBLE | BASE_SELECTED);
} while (iter->valid && BKE_object_is_libdata((Object *)iter->current) != false);
}
@@ -1252,12 +1337,12 @@ void BKE_view_layer_selected_editable_objects_iterator_end(BLI_Iterator *iter)
void BKE_view_layer_selected_bases_iterator_begin(BLI_Iterator *iter, void *data_in)
{
- objects_iterator_begin(iter, data_in, BASE_SELECTED);
+ objects_iterator_begin(iter, data_in, BASE_VISIBLE | BASE_SELECTED);
}
void BKE_view_layer_selected_bases_iterator_next(BLI_Iterator *iter)
{
- object_bases_iterator_next(iter, BASE_SELECTED);
+ object_bases_iterator_next(iter, BASE_VISIBLE | BASE_SELECTED);
}
void BKE_view_layer_selected_bases_iterator_end(BLI_Iterator *iter)
@@ -1273,12 +1358,12 @@ void BKE_view_layer_selected_bases_iterator_end(BLI_Iterator *iter)
void BKE_view_layer_visible_bases_iterator_begin(BLI_Iterator *iter, void *data_in)
{
- object_bases_iterator_begin(iter, data_in, BASE_VISIBLE);
+ object_bases_iterator_begin(iter, data_in, 0);
}
void BKE_view_layer_visible_bases_iterator_next(BLI_Iterator *iter)
{
- object_bases_iterator_next(iter, BASE_VISIBLE);
+ object_bases_iterator_next(iter, 0);
}
void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter)
@@ -1289,103 +1374,14 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name BKE_view_layer_renderable_objects_iterator
- * \{ */
-
-void BKE_view_layer_renderable_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
-{
- struct ObjectsRenderableIteratorData *data = data_in;
-
- /* Tag objects to prevent going over the same object twice. */
- for (Scene *scene = data->scene; scene; scene = scene->set) {
- for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
- for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- base->object->id.flag |= LIB_TAG_DOIT;
- }
- }
- }
-
- ViewLayer *view_layer = data->scene->view_layers.first;
- data->iter.view_layer = view_layer;
-
- data->base_temp.next = view_layer->object_bases.first;
- data->iter.base = &data->base_temp;
-
- data->iter.set = NULL;
-
- iter->data = data_in;
- BKE_view_layer_renderable_objects_iterator_next(iter);
-}
-
-void BKE_view_layer_renderable_objects_iterator_next(BLI_Iterator *iter)
-{
- /* Set it early in case we need to exit and we are running from within a loop. */
- iter->skip = true;
-
- struct ObjectsRenderableIteratorData *data = iter->data;
- Base *base = data->iter.base->next;
-
- /* There is still a base in the current scene layer. */
- if (base != NULL) {
- Object *ob = base->object;
-
- /* We need to set the iter.base even if the rest fail otherwise
- * we keep checking the exactly same base over and over again. */
- data->iter.base = base;
-
- if (ob->id.flag & LIB_TAG_DOIT) {
- ob->id.flag &= ~LIB_TAG_DOIT;
-
- if ((base->flag & BASE_VISIBLE) != 0) {
- iter->skip = false;
- iter->current = ob;
- }
- }
- return;
- }
-
- /* Time to go to the next scene layer. */
- if (data->iter.set == NULL) {
- while ((data->iter.view_layer = data->iter.view_layer->next)) {
- ViewLayer *view_layer = data->iter.view_layer;
- if (view_layer->flag & VIEW_LAYER_RENDER) {
- data->base_temp.next = view_layer->object_bases.first;
- data->iter.base = &data->base_temp;
- return;
- }
- }
-
- /* Setup the "set" for the next iteration. */
- data->scene_temp.set = data->scene;
- data->iter.set = &data->scene_temp;
- return;
- }
-
- /* Look for an object in the next set. */
- while ((data->iter.set = data->iter.set->set)) {
- ViewLayer *view_layer = BKE_view_layer_default_render(data->iter.set);
- data->base_temp.next = view_layer->object_bases.first;
- data->iter.base = &data->base_temp;
- return;
- }
-
- iter->valid = false;
-}
-
-void BKE_view_layer_renderable_objects_iterator_end(BLI_Iterator *UNUSED(iter))
-{
- /* Do nothing - iter->data was static allocated, we can't free it. */
-}
-
-/** \} */
-
-/* -------------------------------------------------------------------- */
/** \name BKE_view_layer_bases_in_mode_iterator
* \{ */
static bool base_is_in_mode(struct ObjectsInModeIteratorData *data, Base *base)
{
- return (base->object->type == data->object_type) && (base->object->mode & data->object_mode) != 0;
+ return BASE_VISIBLE(data->v3d, base) &&
+ (base->object->type == data->object_type) &&
+ (base->object->mode & data->object_mode) != 0;
}
void BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void *data_in)
@@ -1406,7 +1402,7 @@ void BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void *data_
data->object_type = base->object->type;
}
- if (object_bases_iterator_is_valid(data->v3d, base) == false || !base_is_in_mode(data, base)) {
+ if (!base_is_in_mode(data, base)) {
BKE_view_layer_bases_in_mode_iterator_next(iter);
}
}
@@ -1428,10 +1424,7 @@ void BKE_view_layer_bases_in_mode_iterator_next(BLI_Iterator *iter)
}
while (base) {
- if ((base != data->base_active) &&
- base_is_in_mode(data, base) &&
- object_bases_iterator_is_valid(data->v3d, base))
- {
+ if ((base != data->base_active) && base_is_in_mode(data, base)) {
iter->current = base;
return;
}
@@ -1449,18 +1442,34 @@ void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator *UNUSED(iter))
/* Evaluation */
-void BKE_layer_eval_view_layer(
+/* Applies object's restrict flags on top of flags coming from the collection
+ * and stores those in base->flag. */
+void BKE_base_eval_flags(Base *base)
+{
+ const int object_restrict = base->object->restrictflag;
+ base->flag &= ~g_base_collection_flags;
+ base->flag |= (base->flag_from_collection & g_base_collection_flags);
+ if (object_restrict & OB_RESTRICT_VIEW) {
+ base->flag &= ~(BASE_ENABLED_VIEWPORT | BASE_SELECTABLE);
+ }
+ if (object_restrict & OB_RESTRICT_SELECT) {
+ base->flag &= ~BASE_SELECTABLE;
+ }
+ if (object_restrict & OB_RESTRICT_RENDER) {
+ base->flag &= ~BASE_ENABLED_RENDER;
+ }
+ if (base->flag & BASE_HIDDEN) {
+ base->flag &= ~BASE_VISIBLE;
+ }
+}
+
+static void layer_eval_view_layer(
struct Depsgraph *depsgraph,
struct Scene *UNUSED(scene),
ViewLayer *view_layer)
{
DEG_debug_print_eval(depsgraph, __func__, view_layer->name, view_layer);
- /* Visibility based on depsgraph mode. */
- const eEvaluationMode mode = DEG_get_mode(depsgraph);
- const int base_visible_flag = (mode == DAG_EVAL_VIEWPORT)
- ? BASE_ENABLED_VIEWPORT
- : BASE_ENABLED_RENDER;
/* Create array of bases, for fast index-based lookup. */
const int num_object_bases = BLI_listbase_count(&view_layer->object_bases);
MEM_SAFE_FREE(view_layer->object_bases_array);
@@ -1468,35 +1477,8 @@ void BKE_layer_eval_view_layer(
num_object_bases, sizeof(Base *), "view_layer->object_bases_array");
int base_index = 0;
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- /* Compute visibility for depsgraph evaluation mode. */
- if (base->flag & base_visible_flag) {
- base->flag |= BASE_ENABLED | BASE_VISIBLE;
- if (mode == DAG_EVAL_VIEWPORT && (base->flag & BASE_HIDDEN)) {
- base->flag &= ~BASE_VISIBLE;
- }
- }
- else {
- base->flag &= ~(BASE_ENABLED | BASE_VISIBLE | BASE_SELECTABLE);
- }
- /* If base is not selectabled, clear select. */
- if ((base->flag & BASE_SELECTABLE) == 0) {
- base->flag &= ~BASE_SELECTED;
- }
view_layer->object_bases_array[base_index++] = base;
}
- /* Flush back base flag to the original view layer for editing. */
- if (view_layer == DEG_get_evaluated_view_layer(depsgraph)) {
- ViewLayer *view_layer_orig = DEG_get_input_view_layer(depsgraph);
- Base *base_orig = view_layer_orig->object_bases.first;
- const Base *base_eval = view_layer->object_bases.first;
- while (base_orig != NULL) {
- if (base_orig->flag & base_visible_flag) {
- base_orig->flag = base_eval->flag;
- base_eval = base_eval->next;
- }
- base_orig = base_orig->next;
- }
- }
}
void BKE_layer_eval_view_layer_indexed(
@@ -1507,5 +1489,5 @@ void BKE_layer_eval_view_layer_indexed(
BLI_assert(view_layer_index >= 0);
ViewLayer *view_layer = BLI_findlink(&scene->view_layers, view_layer_index);
BLI_assert(view_layer != NULL);
- BKE_layer_eval_view_layer(depsgraph, scene, view_layer);
+ layer_eval_view_layer(depsgraph, scene, view_layer);
}
diff --git a/source/blender/blenkernel/intern/layer_utils.c b/source/blender/blenkernel/intern/layer_utils.c
index fb25ca3ece4..9614a3ac70a 100644
--- a/source/blender/blenkernel/intern/layer_utils.c
+++ b/source/blender/blenkernel/intern/layer_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/layer_utils.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <string.h>
#include "BLI_array.h"
-#include "BLI_listbase.h"
#include "BKE_collection.h"
#include "BKE_editmesh.h"
@@ -102,7 +97,7 @@ bool BKE_view_layer_filter_edit_mesh_has_uvs(Object *ob, void *UNUSED(user_data)
{
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
if (em != NULL) {
if (CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV) != -1) {
return true;
@@ -116,7 +111,7 @@ bool BKE_view_layer_filter_edit_mesh_has_edges(Object *ob, void *UNUSED(user_dat
{
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
if (em != NULL) {
if (em->bm->totedge != 0) {
return true;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 5c867c075ac..2db67939d42 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/library.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Contains management of ID's and libraries
* allocate and free of all library data
@@ -39,6 +31,8 @@
#include <stddef.h>
#include <assert.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
/* all types are needed here, in order to do memory operations */
@@ -51,7 +45,7 @@
#include "DNA_gpencil_types.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_material_types.h"
@@ -78,9 +72,7 @@
#include "BLI_ghash.h"
#include "BLI_linklist.h"
#include "BLI_memarena.h"
-#include "BLI_mempool.h"
#include "BLI_string_utils.h"
-#include "BLI_threads.h"
#include "BLT_translation.h"
@@ -101,10 +93,9 @@
#include "BKE_idprop.h"
#include "BKE_image.h"
#include "BKE_key.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
-#include "BKE_library_override.h"
#include "BKE_library_query.h"
#include "BKE_library_remap.h"
#include "BKE_linestyle.h"
@@ -121,6 +112,7 @@
#include "BKE_particle.h"
#include "BKE_packedFile.h"
#include "BKE_lightprobe.h"
+#include "BKE_rigidbody.h"
#include "BKE_sound.h"
#include "BKE_speaker.h"
#include "BKE_scene.h"
@@ -143,6 +135,8 @@
# include "PIL_time_utildefines.h"
#endif
+static CLG_LogRef LOG = {"bke.library"};
+
/* GS reads the memory pointed at in a specific ordering.
* only use this definition, makes little and big endian systems
* work fine, in conjunction with MAKE_ID */
@@ -169,8 +163,9 @@ void id_lib_extern(ID *id)
if (id && ID_IS_LINKED(id)) {
BLI_assert(BKE_idcode_is_linkable(GS(id->name)));
if (id->tag & LIB_TAG_INDIRECT) {
- id->tag -= LIB_TAG_INDIRECT;
+ id->tag &= ~LIB_TAG_INDIRECT;
id->tag |= LIB_TAG_EXTERN;
+ id->lib->parent = NULL;
}
}
}
@@ -187,7 +182,7 @@ void id_us_ensure_real(ID *id)
id->tag |= LIB_TAG_EXTRAUSER;
if (id->us <= limit) {
if (id->us < limit || ((id->us == limit) && (id->tag & LIB_TAG_EXTRAUSER_SET))) {
- printf("ID user count error: %s (from '%s')\n", id->name, id->lib ? id->lib->filepath : "[Main]");
+ CLOG_ERROR(&LOG, "ID user count error: %s (from '%s')", id->name, id->lib ? id->lib->filepath : "[Main]");
BLI_assert(0);
}
id->us = limit + 1;
@@ -243,8 +238,8 @@ void id_us_min(ID *id)
const int limit = ID_FAKE_USERS(id);
if (id->us <= limit) {
- printf("ID user decrement error: %s (from '%s'): %d <= %d\n",
- id->name, id->lib ? id->lib->filepath : "[Main]", id->us, limit);
+ CLOG_ERROR(&LOG, "ID user decrement error: %s (from '%s'): %d <= %d",
+ id->name, id->lib ? id->lib->filepath : "[Main]", id->us, limit);
BLI_assert(0);
id->us = limit;
}
@@ -346,8 +341,8 @@ void BKE_id_make_local_generic(Main *bmain, ID *id, const bool id_in_mainlist, c
else {
ID *id_new;
- /* Should not fail in expected usecases, but id_copy does not copy Scene e.g. */
- if (id_copy(bmain, id, &id_new, false)) {
+ /* Should not fail in expected usecases, but a few ID types cannot be copied (LIB, WM, SCR...). */
+ if (BKE_id_copy(bmain, id, &id_new)) {
id_new->us = 0;
/* setting newid is mandatory for complex make_lib_local logic... */
@@ -414,7 +409,7 @@ bool id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local)
if (!test) BKE_lattice_make_local(bmain, (Lattice *)id, lib_local);
return true;
case ID_LA:
- if (!test) BKE_lamp_make_local(bmain, (Lamp *)id, lib_local);
+ if (!test) BKE_light_make_local(bmain, (Light *)id, lib_local);
return true;
case ID_CA:
if (!test) BKE_camera_make_local(bmain, (Camera *)id, lib_local);
@@ -518,30 +513,14 @@ static int id_copy_libmanagement_cb(void *user_data, ID *UNUSED(id_self), ID **i
return IDWALK_RET_NOP;
}
-static void id_copy_clear_runtime_pointers(ID *id, int UNUSED(flag))
+bool BKE_id_copy_is_allowed(const ID *id)
{
- if (id == NULL) {
- return;
- }
- /* TODO(sergey): We might want to do a deep-copy of all the pointers inside.
- * This isn't currently needed, and is quite involved change (to cover all
- * things like batch cache and such). */
- switch ((ID_Type)GS(id->name)) {
- case ID_OB:
- {
- Object *object = (Object *)id;
- BKE_object_runtime_reset_on_copy(object);
- break;
- }
- case ID_ME:
- {
- Mesh *mesh = (Mesh *)id;
- BKE_mesh_runtime_reset_on_copy(mesh);
- break;
- }
- default:
- break;
- }
+#define LIB_ID_TYPES_NOCOPY ID_LI, ID_SCR, ID_WM, /* Not supported */ \
+ ID_IP /* Deprecated */
+
+ return !ELEM(GS(id->name), LIB_ID_TYPES_NOCOPY);
+
+#undef LIB_ID_TYPES_NOCOPY
}
/**
@@ -556,38 +535,29 @@ static void id_copy_clear_runtime_pointers(ID *id, int UNUSED(flag))
* \param id: Source datablock.
* \param r_newid: Pointer to new (copied) ID pointer.
* \param flag: Set of copy options, see DNA_ID.h enum for details (leave to zero for default, full copy).
- * \param test: If set, do not do any copy, just test whether copy is supported.
* \return False when copying that ID type is not supported, true otherwise.
*/
-/* XXX TODO remove test thing, *all* IDs should be copyable that way! */
-bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, const bool test)
+bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag)
{
-#define LIB_ID_TYPES_NOCOPY ID_LI, ID_SCR, ID_WM, /* Not supported */ \
- ID_IP /* Deprecated */
-
- BLI_assert(test || (r_newid != NULL));
- /* Early output is source is NULL. */
- if (id == NULL) {
- return false;
- }
+ BLI_assert(r_newid != NULL);
/* Make sure destination pointer is all good. */
if ((flag & LIB_ID_CREATE_NO_ALLOCATE) == 0) {
- if (r_newid != NULL) {
- *r_newid = NULL;
- }
+ *r_newid = NULL;
}
else {
- if (r_newid != NULL && *r_newid != NULL) {
- /* Allow some garbage non-initialized memory to go in. */
+ if (*r_newid != NULL) {
+ /* Allow some garbage non-initialized memory to go in, and clean it up here. */
const size_t size = BKE_libblock_get_alloc_info(GS(id->name), NULL);
memset(*r_newid, 0, size);
}
}
- if (ELEM(GS(id->name), LIB_ID_TYPES_NOCOPY)) {
+
+ /* Early output is source is NULL. */
+ if (id == NULL) {
return false;
}
- else if (test) {
- return true;
+ if (!BKE_id_copy_is_allowed(id)) {
+ return false;
}
BKE_libblock_copy_ex(bmain, id, r_newid, flag);
@@ -621,7 +591,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, con
BKE_lattice_copy_data(bmain, (Lattice *)*r_newid, (Lattice *)id, flag);
break;
case ID_LA:
- BKE_lamp_copy_data(bmain, (Lamp *)*r_newid, (Lamp *)id, flag);
+ BKE_light_copy_data(bmain, (Light *)*r_newid, (Light *)id, flag);
break;
case ID_SPK:
BKE_speaker_copy_data(bmain, (Speaker *)*r_newid, (Speaker *)id, flag);
@@ -696,7 +666,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, con
}
/* Update ID refcount, remap pointers to self in new ID. */
- struct IDCopyLibManagementData data = {.id_src = id, .id_dst = *r_newid, .flag = flag};
+ struct IDCopyLibManagementData data = {.id_src = id, .id_dst = *r_newid, .flag = flag,};
BKE_library_foreach_ID_link(bmain, *r_newid, id_copy_libmanagement_cb, &data, IDWALK_NOP);
/* Do not make new copy local in case we are copying outside of main...
@@ -709,8 +679,6 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, con
(*r_newid)->lib = id->lib;
}
- id_copy_clear_runtime_pointers(*r_newid, flag);
-
return true;
}
@@ -718,13 +686,13 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, con
* Invokes the appropriate copy method for the block and returns the result in
* newid, unless test. Returns true if the block can be copied.
*/
-bool id_copy(Main *bmain, const ID *id, ID **newid, bool test)
+bool BKE_id_copy(Main *bmain, const ID *id, ID **newid)
{
- return BKE_id_copy_ex(bmain, id, newid, LIB_ID_COPY_SHAPEKEY, test);
+ return BKE_id_copy_ex(bmain, id, newid, LIB_ID_COPY_DEFAULT);
}
/** Does a mere memory swap over the whole IDs data (including type-specific memory).
- * \note Most internal ID data itself is not swapped (only IDProperties are). */
+ * \note Most internal ID data itself is not swapped (only IDProperties are). */
void BKE_id_swap(Main *bmain, ID *id_a, ID *id_b)
{
BLI_assert(GS(id_a->name) == GS(id_b->name));
@@ -748,7 +716,7 @@ void BKE_id_swap(Main *bmain, ID *id_a, ID *id_b)
CASE_SWAP(ID_TE, Tex);
CASE_SWAP(ID_IM, Image);
CASE_SWAP(ID_LT, Lattice);
- CASE_SWAP(ID_LA, Lamp);
+ CASE_SWAP(ID_LA, Light);
CASE_SWAP(ID_LP, LightProbe);
CASE_SWAP(ID_CA, Camera);
CASE_SWAP(ID_KE, Key);
@@ -802,7 +770,7 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
/* if property isn't editable, we're going to have an extra block hanging around until we save */
if (RNA_property_editable(ptr, prop)) {
Main *bmain = CTX_data_main(C);
- if (id_copy(bmain, id, &newid, false) && newid) {
+ if (BKE_id_copy(bmain, id, &newid) && newid) {
/* copy animation actions too */
BKE_animdata_copy_id_action(bmain, id, false);
/* us is 1 by convention with new IDs, but RNA_property_pointer_set
@@ -875,7 +843,7 @@ void BKE_libblock_management_main_add(Main *bmain, void *idv)
ListBase *lb = which_libbase(bmain, GS(id->name));
BKE_main_lock(bmain);
BLI_addtail(lb, id);
- new_id(lb, id, NULL);
+ BKE_id_new_name_validate(lb, id, NULL);
/* alphabetic insertion: is in new_id */
id->tag &= ~(LIB_TAG_NO_MAIN | LIB_TAG_NO_USER_REFCOUNT);
bmain->is_memfile_undo_written = false;
@@ -1001,12 +969,43 @@ void BKE_main_id_flag_all(Main *bmain, const int flag, const bool value)
}
}
+void BKE_main_id_repair_duplicate_names_listbase(ListBase *lb)
+{
+ int lb_len = 0;
+ for (ID *id = lb->first; id; id = id->next) {
+ if (id->lib == NULL) {
+ lb_len += 1;
+ }
+ }
+ if (lb_len <= 1) {
+ return;
+ }
+
+ /* Fill an array because renaming sorts. */
+ ID **id_array = MEM_mallocN(sizeof(*id_array) * lb_len, __func__);
+ GSet *gset = BLI_gset_str_new_ex(__func__, lb_len);
+ int i = 0;
+ for (ID *id = lb->first; id; id = id->next) {
+ if (id->lib == NULL) {
+ id_array[i] = id;
+ i++;
+ }
+ }
+ for (i = 0; i < lb_len; i++) {
+ if (!BLI_gset_add(gset, id_array[i]->name + 2)) {
+ BKE_id_new_name_validate(lb, id_array[i], NULL);
+ }
+ }
+ BLI_gset_free(gset, NULL);
+ MEM_freeN(id_array);
+}
+
void BKE_main_lib_objects_recalc_all(Main *bmain)
{
Object *ob;
/* flag for full recalc */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ID_IS_LINKED(ob)) {
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
}
@@ -1050,7 +1049,7 @@ size_t BKE_libblock_get_alloc_info(short type, const char **name)
CASE_RETURN(ID_TE, Tex);
CASE_RETURN(ID_IM, Image);
CASE_RETURN(ID_LT, Lattice);
- CASE_RETURN(ID_LA, Lamp);
+ CASE_RETURN(ID_LA, Light);
CASE_RETURN(ID_CA, Camera);
CASE_RETURN(ID_IP, Ipo);
CASE_RETURN(ID_KE, Key);
@@ -1126,7 +1125,7 @@ void *BKE_libblock_alloc(Main *bmain, short type, const char *name, const int fl
BKE_main_lock(bmain);
BLI_addtail(lb, id);
- new_id(lb, id, name);
+ BKE_id_new_name_validate(lb, id, name);
bmain->is_memfile_undo_written = false;
/* alphabetic insertion: is in new_id */
BKE_main_unlock(bmain);
@@ -1187,7 +1186,7 @@ void BKE_libblock_init_empty(ID *id)
BKE_lattice_init((Lattice *)id);
break;
case ID_LA:
- BKE_lamp_init((Lamp *)id);
+ BKE_light_init((Light *)id);
break;
case ID_SPK:
BKE_speaker_init((Speaker *)id);
@@ -1309,7 +1308,7 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int fla
/* Grrrrrrrrr... Not adding 'root' nodetrees to bmain.... grrrrrrrrrrrrrrrrrrrr! */
/* This is taken from original ntree copy code, might be weak actually? */
const bool use_nodetree_alloc_exception = ((GS(id->name) == ID_NT) && (bmain != NULL) &&
- (BLI_findindex(&bmain->nodetree, id) < 0));
+ (BLI_findindex(&bmain->nodetrees, id) < 0));
BLI_assert((flag & LIB_ID_CREATE_NO_MAIN) != 0 || bmain != NULL);
BLI_assert((flag & LIB_ID_CREATE_NO_MAIN) != 0 || (flag & LIB_ID_CREATE_NO_ALLOCATE) == 0);
@@ -1382,22 +1381,11 @@ void *BKE_libblock_copy(Main *bmain, const ID *id)
return idn;
}
-void *BKE_libblock_copy_nolib(const ID *id, const bool do_action)
-{
- ID *idn;
-
- BKE_libblock_copy_ex(NULL, id, &idn, LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | (do_action ? LIB_ID_COPY_ACTIONS : 0));
-
- return idn;
-}
-
+/* XXX TODO: get rid of this useless wrapper at some point... */
void *BKE_libblock_copy_for_localize(const ID *id)
{
ID *idn;
- BKE_libblock_copy_ex(NULL, id, &idn, (LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_COPY_ACTIONS |
- LIB_ID_COPY_NO_ANIMDATA));
+ BKE_libblock_copy_ex(NULL, id, &idn, LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_NO_ANIMDATA);
return idn;
}
@@ -1583,14 +1571,14 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name)
#undef MAX_IN_USE
}
-/*
- * Only for local blocks: external en indirect blocks already have a
- * unique ID.
+/**
+ * Ensures given ID has a unique name in given listbase.
+ *
+ * Only for local IDs (linked ones already have a unique ID in their library).
*
- * return true: created a new name
+ * \return true if a new name had to be created.
*/
-
-bool new_id(ListBase *lb, ID *id, const char *tname)
+bool BKE_id_new_name_validate(ListBase *lb, ID *id, const char *tname)
{
bool result;
char name[MAX_ID_NAME - 2];
@@ -1607,8 +1595,8 @@ bool new_id(ListBase *lb, ID *id, const char *tname)
BLI_strncpy(name, tname, sizeof(name));
if (name[0] == '\0') {
- /* disallow empty names */
- BLI_strncpy(name, DATA_(ID_FALLBACK_NAME), sizeof(name));
+ /* Disallow empty names. */
+ BLI_strncpy(name, DATA_(BKE_idcode_to_name(GS(id->name))), sizeof(name));
}
else {
/* disallow non utf8 chars,
@@ -1648,8 +1636,11 @@ void id_clear_lib_data_ex(Main *bmain, ID *id, const bool id_in_mainlist)
id->lib = NULL;
id->tag &= ~(LIB_TAG_INDIRECT | LIB_TAG_EXTERN);
- if (id_in_mainlist)
- new_id(which_libbase(bmain, GS(id->name)), id, NULL);
+ if (id_in_mainlist) {
+ if (BKE_id_new_name_validate(which_libbase(bmain, GS(id->name)), id, NULL)) {
+ bmain->is_memfile_undo_written = false;
+ }
+ }
/* Internal bNodeTree blocks inside datablocks also stores id->lib, make sure this stays in sync. */
if ((ntree = ntreeFromID(id))) {
@@ -1670,19 +1661,14 @@ void id_clear_lib_data(Main *bmain, ID *id)
/* next to indirect usage in read/writefile also in editobject.c scene.c */
void BKE_main_id_clear_newpoins(Main *bmain)
{
- ListBase *lbarray[MAX_LIBARRAY];
ID *id;
- int a;
- a = set_listbasepointers(bmain, lbarray);
- while (a--) {
- id = lbarray[a]->first;
- while (id) {
- id->newid = NULL;
- id->tag &= ~LIB_TAG_NEW;
- id = id->next;
- }
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ id->newid = NULL;
+ id->tag &= ~LIB_TAG_NEW;
}
+ FOREACH_MAIN_ID_END;
}
@@ -1930,9 +1916,6 @@ void BKE_library_make_local(
TIMEIT_VALUE_PRINT(make_local);
#endif
- /* Note: Keeping both version of the code (old one being safer, since it still has checks against unused IDs)
- * for now, we can remove old one once it has been tested for some time in master... */
-#if 1
/* Step 5: proxy 'remapping' hack. */
for (LinkNode *it = copied_ids; it; it = it->next) {
/* Attempt to re-link copied proxy objects. This allows appending of an entire scene
@@ -1947,8 +1930,8 @@ void BKE_library_make_local(
/* Proxies only work when the proxified object is linked-in from a library. */
if (ob->proxy->id.lib == NULL) {
- printf("Warning, proxy object %s will loose its link to %s, because the "
- "proxified object is local.\n", id->newid->name, ob->proxy->id.name);
+ CLOG_WARN(&LOG, "proxy object %s will loose its link to %s, because the "
+ "proxified object is local.", id->newid->name, ob->proxy->id.name);
continue;
}
@@ -1958,14 +1941,14 @@ void BKE_library_make_local(
* referred to from a library. Not checking for local use; if new local proxy
* was not used locally would be a nasty bug! */
if (is_local || is_lib) {
- printf("Warning, made-local proxy object %s will loose its link to %s, "
- "because the linked-in proxy is referenced (is_local=%i, is_lib=%i).\n",
+ CLOG_WARN(&LOG, "made-local proxy object %s will loose its link to %s, "
+ "because the linked-in proxy is referenced (is_local=%i, is_lib=%i).",
id->newid->name, ob->proxy->id.name, is_local, is_lib);
}
else {
/* we can switch the proxy'ing from the linked-in to the made-local proxy.
* BKE_object_make_proxy() shouldn't be used here, as it allocates memory that
- * was already allocated by BKE_object_make_local_ex() (which called BKE_object_copy_ex). */
+ * was already allocated by BKE_object_make_local_ex() (which called BKE_object_copy). */
ob_new->proxy = ob->proxy;
ob_new->proxy_group = ob->proxy_group;
ob_new->proxy_from = ob->proxy_from;
@@ -1980,143 +1963,27 @@ void BKE_library_make_local(
TIMEIT_VALUE_PRINT(make_local);
#endif
-#else
- LinkNode *linked_loop_candidates = NULL;
-
- /* Step 5: remove datablocks that have been copied to be localized and are no more used in the end...
- * Note that we may have to loop more than once here, to tackle dependencies between linked objects... */
- bool do_loop = true;
- while (do_loop) {
- do_loop = false;
- for (LinkNode *it = copied_ids; it; it = it->next) {
- if ((id = it->link) == NULL) {
- continue;
- }
-
- bool is_local = false, is_lib = false;
-
- BKE_library_ID_test_usages(bmain, id, &is_local, &is_lib);
-
- /* Attempt to re-link copied proxy objects. This allows appending of an entire scene
- * from another blend file into this one, even when that blend file contains proxified
- * armatures that have local references. Since the proxified object needs to be linked
- * (not local), this will only work when the "Localize all" checkbox is disabled.
- * TL;DR: this is a dirty hack on top of an already weak feature (proxies). */
- if (GS(id->name) == ID_OB && ((Object *)id)->proxy != NULL) {
- Object *ob = (Object *)id;
- Object *ob_new = (Object *)id->newid;
-
- /* Proxies only work when the proxified object is linked-in from a library. */
- if (ob->proxy->id.lib == NULL) {
- printf("Warning, proxy object %s will loose its link to %s, because the "
- "proxified object is local.\n", id->newid->name, ob->proxy->id.name);
- }
- /* We can only switch the proxy'ing to a made-local proxy if it is no longer
- * referred to from a library. Not checking for local use; if new local proxy
- * was not used locally would be a nasty bug! */
- else if (is_local || is_lib) {
- printf("Warning, made-local proxy object %s will loose its link to %s, "
- "because the linked-in proxy is referenced (is_local=%i, is_lib=%i).\n",
- id->newid->name, ob->proxy->id.name, is_local, is_lib);
- }
- else {
- /* we can switch the proxy'ing from the linked-in to the made-local proxy.
- * BKE_object_make_proxy() shouldn't be used here, as it allocates memory that
- * was already allocated by BKE_object_make_local_ex() (which called BKE_object_copy_ex). */
- ob_new->proxy = ob->proxy;
- ob_new->proxy_group = ob->proxy_group;
- ob_new->proxy_from = ob->proxy_from;
- ob_new->proxy->proxy_from = ob_new;
- ob->proxy = ob->proxy_from = ob->proxy_group = NULL;
- }
- }
-
- if (!is_local) {
- if (!is_lib) { /* Not used at all, we can free it! */
- BLI_assert(!"Unused linked data copy remaining from MakeLibLocal process, should not happen anymore");
- printf("\t%s (from %s)\n", id->name, id->lib->id.name);
- BKE_libblock_free(bmain, id);
- it->link = NULL;
- do_loop = true;
- }
- /* Only used by linked data, potential candidate to ugly lib-only dependency cycles... */
- else if ((id->tag & LIB_TAG_DOIT) == 0) { /* Check TAG_DOIT to avoid adding same ID several times... */
- /* Note that we store the node, not directly ID pointer, that way if it->link is set to NULL
- * later we can skip it in lib-dependency cycles search later. */
- BLI_linklist_prepend_arena(&linked_loop_candidates, it, linklist_mem);
- id->tag |= LIB_TAG_DOIT;
-
- /* Grrrrrrr... those half-datablocks-stuff... grrrrrrrrrrr...
- * Here we have to also tag them as potential candidates, otherwise they would falsy report
- * ID they used as 'directly used' in sixth step. */
- ID *ntree = (ID *)ntreeFromID(id);
- if (ntree != NULL) {
- ntree->tag |= LIB_TAG_DOIT;
- }
- }
- }
- }
- }
-
-#ifdef DEBUG_TIME
- printf("Step 5: Remove linked datablocks that have been copied and ended fully localized: Done.\n");
- TIMEIT_VALUE_PRINT(make_local);
-#endif
-
- /* Step 6: Try to find circle dependencies between indirectly-linked-only datablocks.
- * Those are fake 'usages' that prevent their deletion. See T49775 for nice ugly case. */
- BKE_library_unused_linked_data_set_tag(bmain, false);
- for (LinkNode *it = linked_loop_candidates; it; it = it->next) {
- if (it->link == NULL) {
- continue;
- }
- if ((id = ((LinkNode *)it->link)->link) == NULL) {
- it->link = NULL;
- continue;
- }
-
- /* Note: in theory here we are only handling datablocks forming exclusive linked dependency-cycles-based
- * archipelagos, so no need to check again after we have deleted one, as done in previous step. */
- if (id->tag & LIB_TAG_DOIT) {
- BLI_assert(!"Unused linked data copy remaining from MakeLibLocal process (archipelago case), should not happen anymore");
- /* Object's deletion rely on valid ob->data, but ob->data may have already been freed here...
- * Setting it to NULL may not be 100% correct, but should be safe and do the work. */
- if (GS(id->name) == ID_OB) {
- ((Object *)id)->data = NULL;
- }
-
- /* Note: *in theory* IDs tagged here are fully *outside* of file scope, totally unused, so we can
- * directly wipe them out without caring about clearing their usages.
- * However, this is a highly-risky presumption, and nice crasher in case something goes wrong here.
- * So for 2.78a will keep the safe option, and switch to more efficient one in master later. */
-#if 1
- BKE_libblock_free_ex(bmain, id, false, true);
-#else
- BKE_libblock_unlink(bmain, id, false, false);
- BKE_libblock_free(bmain, id);
-#endif
- ((LinkNode *)it->link)->link = NULL; /* Not strictly necessary, but safer (see T49903)... */
- it->link = NULL;
- }
- }
-
-#ifdef DEBUG_TIME
- printf("Step 6: Try to find circle dependencies between indirectly-linked-only datablocks: Done.\n");
- TIMEIT_VALUE_PRINT(make_local);
-#endif
-
-#endif
-
/* This is probably more of a hack than something we should do here, but...
* Issue is, the whole copying + remapping done in complex cases above may leave pose channels of armatures
* in complete invalid state (more precisely, the bone pointers of the pchans - very crappy cross-datablocks
* relationship), se we tag it to be fully recomputed, but this does not seems to be enough in some cases,
* and evaluation code ends up trying to evaluate a not-yet-updated armature object's deformations.
* Try "make all local" in 04_01_H.lighting.blend from Agent327 without this, e.g. */
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ /* Also, use this object loop to we handle rigid body resetting. */
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->data != NULL && ob->type == OB_ARMATURE && ob->pose != NULL && ob->pose->flag & POSE_RECALC) {
BKE_pose_rebuild(bmain, ob, ob->data, true);
}
+
+ /* If there was ever any rigidbody settings in the object, we reset it. */
+ if (ob->rigidbody_object) {
+ for (Scene *scene_iter = bmain->scenes.first; scene_iter; scene_iter = scene_iter->id.next) {
+ if (scene_iter->rigidbody_world) {
+ BKE_rigidbody_remove_object(bmain, scene_iter, ob);
+ }
+ }
+ BKE_rigidbody_free_object(ob, NULL);
+ }
}
#ifdef DEBUG_TIME
@@ -2147,9 +2014,10 @@ void BLI_libblock_ensure_unique_name(Main *bmain, const char *name)
/* search for id */
idtest = BLI_findstring(lb, name + 2, offsetof(ID, name) + 2);
-
- if (idtest && !new_id(lb, idtest, idtest->name + 2)) {
- id_sort_by_name(lb, idtest);
+ if (idtest != NULL) {
+ /* BKE_id_new_name_validate also takes care of sorting. */
+ BKE_id_new_name_validate(lb, idtest, NULL);
+ bmain->is_memfile_undo_written = false;
}
}
@@ -2159,7 +2027,9 @@ void BLI_libblock_ensure_unique_name(Main *bmain, const char *name)
void BKE_libblock_rename(Main *bmain, ID *id, const char *name)
{
ListBase *lb = which_libbase(bmain, GS(id->name));
- new_id(lb, id, name);
+ if (BKE_id_new_name_validate(lb, id, name)) {
+ bmain->is_memfile_undo_written = false;
+ }
}
/**
diff --git a/source/blender/blenkernel/intern/library_idmap.c b/source/blender/blenkernel/intern/library_idmap.c
index 1cc13b39a97..f03fa63843b 100644
--- a/source/blender/blenkernel/intern/library_idmap.c
+++ b/source/blender/blenkernel/intern/library_idmap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,8 +12,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include <string.h>
@@ -30,12 +26,11 @@
#include "DNA_ID.h"
#include "BKE_idcode.h"
-#include "BKE_library.h"
#include "BKE_library_idmap.h" /* own include */
#include "BKE_main.h"
-/** \file blender/blenkernel/intern/library_idmap.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Utility functions for faster ID lookups.
*/
@@ -71,6 +66,7 @@ struct IDNameLib_TypeMap {
struct IDNameLib_Map {
struct IDNameLib_TypeMap type_maps[MAX_LIBARRAY];
struct Main *bmain;
+ struct GSet *valid_id_pointers;
};
static struct IDNameLib_TypeMap *main_idmap_from_idcode(struct IDNameLib_Map *id_map, short id_type)
@@ -83,7 +79,20 @@ static struct IDNameLib_TypeMap *main_idmap_from_idcode(struct IDNameLib_Map *id
return NULL;
}
-struct IDNameLib_Map *BKE_main_idmap_create(struct Main *bmain)
+/**
+ * Generate mapping from ID type/name to ID pointer for given \a bmain.
+ *
+ * \note When used during undo/redo, there is no guaranty that ID pointers from UI area
+ * are not pointing to freed memory (when some IDs have been deleted). To avoid crashes
+ * in those cases, one can provide the 'old' (aka current) Main databse as reference.
+ * #BKE_main_idmap_lookup_id will then check that given ID does exist in \a old_bmain
+ * before trying to use it.
+ *
+ * \param create_valid_ids_set: If \a true, generate a reference to prevent freed memory accesses.
+ * \param old_bmain: If not NULL, its IDs will be added the valid references set.
+ */
+struct IDNameLib_Map *BKE_main_idmap_create(
+ struct Main *bmain, const bool create_valid_ids_set, struct Main *old_bmain)
{
struct IDNameLib_Map *id_map = MEM_mallocN(sizeof(*id_map), __func__);
@@ -98,6 +107,16 @@ struct IDNameLib_Map *BKE_main_idmap_create(struct Main *bmain)
id_map->bmain = bmain;
+ if (create_valid_ids_set) {
+ id_map->valid_id_pointers = BKE_main_gset_create(bmain, NULL);
+ if (old_bmain != NULL) {
+ id_map->valid_id_pointers = BKE_main_gset_create(old_bmain, id_map->valid_id_pointers);
+ }
+ }
+ else {
+ id_map->valid_id_pointers = NULL;
+ }
+
return id_map;
}
@@ -157,7 +176,15 @@ ID *BKE_main_idmap_lookup(struct IDNameLib_Map *id_map, short id_type, const cha
ID *BKE_main_idmap_lookup_id(struct IDNameLib_Map *id_map, const ID *id)
{
- return BKE_main_idmap_lookup(id_map, GS(id->name), id->name + 2, id->lib);
+ /* When used during undo/redo, this function cannot assume that given id points to valid memory
+ * (i.e. has not been freed), so it has to check that it does exist in 'old' (aka current) Main database.
+ * Otherwise, we cannot provide new ID pointer that way (would crash accessing freed memory
+ * when trying to get ID name).
+ */
+ if (id_map->valid_id_pointers == NULL || BLI_gset_haskey(id_map->valid_id_pointers, id)) {
+ return BKE_main_idmap_lookup(id_map, GS(id->name), id->name + 2, id->lib);
+ }
+ return NULL;
}
void BKE_main_idmap_destroy(struct IDNameLib_Map *id_map)
@@ -171,6 +198,10 @@ void BKE_main_idmap_destroy(struct IDNameLib_Map *id_map)
}
}
+ if (id_map->valid_id_pointers != NULL) {
+ BLI_gset_free(id_map->valid_id_pointers, NULL);
+ }
+
MEM_freeN(id_map);
}
diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c
index 714730b2f52..c54f11934e1 100644
--- a/source/blender/blenkernel/intern/library_override.c
+++ b/source/blender/blenkernel/intern/library_override.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Bastien Montagne.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/library_override.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
@@ -170,7 +164,7 @@ static ID *override_static_create_from(Main *bmain, ID *reference_id)
{
ID *local_id;
- if (!id_copy(bmain, reference_id, (ID **)&local_id, false)) {
+ if (!BKE_id_copy(bmain, reference_id, (ID **)&local_id)) {
return NULL;
}
id_us_min(local_id);
@@ -205,32 +199,28 @@ ID *BKE_override_static_create_from_id(Main *bmain, ID *reference_id)
*/
bool BKE_override_static_create_from_tag(Main *bmain)
{
- ListBase *lbarray[MAX_LIBARRAY];
- int a;
+ ID *reference_id;
bool ret = true;
- const int num_types = a = set_listbasepointers(bmain, lbarray);
- while (a--) {
- for (ID *reference_id = lbarray[a]->first; reference_id != NULL; reference_id = reference_id->next) {
- if ((reference_id->tag & LIB_TAG_DOIT) != 0 && reference_id->lib != NULL) {
- if ((reference_id->newid = override_static_create_from(bmain, reference_id)) == NULL) {
- ret = false;
- }
+ FOREACH_MAIN_ID_BEGIN(bmain, reference_id)
+ {
+ if ((reference_id->tag & LIB_TAG_DOIT) != 0 && reference_id->lib != NULL) {
+ if ((reference_id->newid = override_static_create_from(bmain, reference_id)) == NULL) {
+ ret = false;
}
}
}
+ FOREACH_MAIN_ID_END;
- /* Remapping, we obviously only want to affect local data (and not our own reference pointer to overridden ID). */
- a = num_types;
- while (a--) {
- for (ID *reference_id = lbarray[a]->first; reference_id != NULL; reference_id = reference_id->next) {
- if ((reference_id->tag & LIB_TAG_DOIT) != 0 && reference_id->lib != NULL && reference_id->newid != NULL) {
- ID *local_id = reference_id->newid;
- BKE_libblock_remap(bmain, reference_id, local_id,
- ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_STATIC_OVERRIDE);
- }
+ FOREACH_MAIN_ID_BEGIN(bmain, reference_id)
+ {
+ if ((reference_id->tag & LIB_TAG_DOIT) != 0 && reference_id->lib != NULL && reference_id->newid != NULL) {
+ ID *local_id = reference_id->newid;
+ BKE_libblock_remap(bmain, reference_id, local_id,
+ ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_STATIC_OVERRIDE);
}
}
+ FOREACH_MAIN_ID_END;
return ret;
}
@@ -580,24 +570,18 @@ bool BKE_override_static_operations_create(Main *bmain, ID *local, const bool fo
/** Check all overrides from given \a bmain and create/update overriding operations as needed. */
void BKE_main_override_static_operations_create(Main *bmain, const bool force_auto)
{
- ListBase *lbarray[MAX_LIBARRAY];
- int base_count, i;
-
- base_count = set_listbasepointers(bmain, lbarray);
+ ID *id;
- for (i = 0; i < base_count; i++) {
- ListBase *lb = lbarray[i];
- ID *id;
-
- for (id = lb->first; id; id = id->next) {
- if (force_auto ||
- (ID_IS_STATIC_OVERRIDE_AUTO(id) && (id->tag & LIB_TAG_OVERRIDESTATIC_AUTOREFRESH)))
- {
- BKE_override_static_operations_create(bmain, id, force_auto);
- id->tag &= ~LIB_TAG_OVERRIDESTATIC_AUTOREFRESH;
- }
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ if (force_auto ||
+ (ID_IS_STATIC_OVERRIDE_AUTO(id) && (id->tag & LIB_TAG_OVERRIDESTATIC_AUTOREFRESH)))
+ {
+ BKE_override_static_operations_create(bmain, id, force_auto);
+ id->tag &= ~LIB_TAG_OVERRIDESTATIC_AUTOREFRESH;
}
}
+ FOREACH_MAIN_ID_END;
}
/** Update given override from its reference (re-applying overridden properties). */
@@ -627,7 +611,7 @@ void BKE_override_static_update(Main *bmain, ID *local)
* a (performances) issue here. */
ID *tmp_id;
- id_copy(bmain, local->override_static->reference, &tmp_id, false);
+ BKE_id_copy(bmain, local->override_static->reference, &tmp_id);
if (tmp_id == NULL) {
return;
@@ -649,13 +633,13 @@ void BKE_override_static_update(Main *bmain, ID *local)
/* Again, horribly innefficient in our case, we need something off-Main (aka moar generic nolib copy/free stuff)! */
/* XXX And crashing in complex cases (e.g. because depsgraph uses same data...). */
- BKE_libblock_free_ex(bmain, tmp_id, true, false);
+ BKE_id_free_ex(bmain, tmp_id, LIB_ID_FREE_NO_UI_USER, true);
if (local->override_static->storage) {
/* We know this datablock is not used anywhere besides local->override->storage. */
/* XXX For until we get fully shadow copies, we still need to ensure storage releases
* its usage of any ID pointers it may have. */
- BKE_libblock_free_ex(bmain, local->override_static->storage, true, false);
+ BKE_id_free_ex(bmain, local->override_static->storage, LIB_ID_FREE_NO_UI_USER, true);
local->override_static->storage = NULL;
}
@@ -668,21 +652,15 @@ void BKE_override_static_update(Main *bmain, ID *local)
/** Update all overrides from given \a bmain. */
void BKE_main_override_static_update(Main *bmain)
{
- ListBase *lbarray[MAX_LIBARRAY];
- int base_count, i;
-
- base_count = set_listbasepointers(bmain, lbarray);
+ ID *id;
- for (i = 0; i < base_count; i++) {
- ListBase *lb = lbarray[i];
- ID *id;
-
- for (id = lb->first; id; id = id->next) {
- if (id->override_static != NULL && id->lib == NULL) {
- BKE_override_static_update(bmain, id);
- }
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ if (id->override_static != NULL && id->lib == NULL) {
+ BKE_override_static_update(bmain, id);
}
}
+ FOREACH_MAIN_ID_END;
}
/***********************************************************************************************************************
@@ -733,7 +711,7 @@ ID *BKE_override_static_operations_store_start(Main *bmain, OverrideStaticStorag
/* This would imply change in handling of usercout all over RNA (and possibly all over Blender code).
* Not impossible to do, but would rather see first is extra useless usual user handling is actually
* a (performances) issue here, before doing it. */
- id_copy((Main *)override_storage, local, &storage_id, false);
+ BKE_id_copy((Main *)override_storage, local, &storage_id);
if (storage_id != NULL) {
PointerRNA rnaptr_reference, rnaptr_final, rnaptr_storage;
@@ -744,7 +722,7 @@ ID *BKE_override_static_operations_store_start(Main *bmain, OverrideStaticStorag
if (!RNA_struct_override_store(
bmain, &rnaptr_final, &rnaptr_reference, &rnaptr_storage, local->override_static))
{
- BKE_libblock_free_ex(override_storage, storage_id, true, false);
+ BKE_id_free_ex(override_storage, storage_id, LIB_ID_FREE_NO_UI_USER, true);
storage_id = NULL;
}
}
@@ -771,19 +749,13 @@ void BKE_override_static_operations_store_finalize(OverrideStaticStorage *overri
{
/* We cannot just call BKE_main_free(override_storage), not until we have option to make 'ghost' copies of IDs
* without increasing usercount of used data-blocks... */
- ListBase *lbarray[MAX_LIBARRAY];
- int base_count, i;
-
- base_count = set_listbasepointers(override_storage, lbarray);
-
- for (i = 0; i < base_count; i++) {
- ListBase *lb = lbarray[i];
- ID *id;
+ ID *id;
- while ((id = lb->first)) {
- BKE_libblock_free_ex(override_storage, id, true, false);
- }
+ FOREACH_MAIN_ID_BEGIN(override_storage, id)
+ {
+ BKE_id_free_ex(override_storage, id, LIB_ID_FREE_NO_UI_USER, true);
}
+ FOREACH_MAIN_ID_END;
BKE_main_free(override_storage);
}
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 2134c02b63d..267699b67c1 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/library_query.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
@@ -39,7 +33,7 @@
#include "DNA_constraint_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_material_types.h"
@@ -64,7 +58,6 @@
#include "DNA_world_types.h"
#include "BLI_utildefines.h"
-#include "BLI_listbase.h"
#include "BLI_ghash.h"
#include "BLI_linklist_stack.h"
@@ -82,6 +75,7 @@
#include "BKE_particle.h"
#include "BKE_rigidbody.h"
#include "BKE_sequencer.h"
+#include "BKE_shader_fx.h"
#include "BKE_tracking.h"
#include "BKE_workspace.h"
@@ -96,7 +90,10 @@
if (!((_data)->status & IDWALK_STOP)) { \
const int _flag = (_data)->flag; \
ID *old_id = *(id_pp); \
- const int callback_return = (_data)->callback((_data)->user_data, (_data)->self_id, id_pp, _cb_flag | (_data)->cb_flag); \
+ const int callback_return = (_data)->callback((_data)->user_data, \
+ (_data)->self_id, \
+ id_pp, \
+ (_cb_flag | (_data)->cb_flag) & ~(_data)->cb_flag_clear); \
if (_flag & IDWALK_READONLY) { \
BLI_assert(*(id_pp) == old_id); \
} \
@@ -137,6 +134,7 @@ typedef struct LibraryForeachIDData {
ID *self_id;
int flag;
int cb_flag;
+ int cb_flag_clear;
LibraryIDLinkCallback callback;
void *user_data;
int status;
@@ -146,6 +144,11 @@ typedef struct LibraryForeachIDData {
BLI_LINKSTACK_DECLARE(ids_todo, ID *);
} LibraryForeachIDData;
+static void library_foreach_ID_link(
+ Main *bmain, ID *id,
+ LibraryIDLinkCallback callback, void *user_data, int flag,
+ LibraryForeachIDData *inherit_data);
+
static void library_foreach_idproperty_ID_link(LibraryForeachIDData *data, IDProperty *prop, int flag)
{
if (!prop)
@@ -204,6 +207,15 @@ static void library_foreach_gpencil_modifiersForeachIDLink(
FOREACH_FINALIZE_VOID;
}
+static void library_foreach_shaderfxForeachIDLink(
+ void *user_data, Object *UNUSED(object), ID **id_pointer, int cb_flag)
+{
+ LibraryForeachIDData *data = (LibraryForeachIDData *) user_data;
+ FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pointer, cb_flag);
+
+ FOREACH_FINALIZE_VOID;
+}
+
static void library_foreach_constraintObjectLooper(bConstraint *UNUSED(con), ID **id_pointer,
bool is_reference, void *user_data)
{
@@ -324,18 +336,16 @@ static void library_foreach_ID_as_subdata_link(
}
}
else {
- BKE_library_foreach_ID_link(NULL, id, callback, user_data, flag);
+ library_foreach_ID_link(NULL, id, callback, user_data, flag, data);
}
FOREACH_FINALIZE_VOID;
}
-/**
- * Loop over all of the ID's this datablock links to.
- *
- * \note: May be extended to be recursive in the future.
- */
-void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback callback, void *user_data, int flag)
+static void library_foreach_ID_link(
+ Main *bmain, ID *id,
+ LibraryIDLinkCallback callback, void *user_data, int flag,
+ LibraryForeachIDData *inherit_data)
{
LibraryForeachIDData data;
int i;
@@ -365,7 +375,21 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
for (; id != NULL; id = (flag & IDWALK_RECURSE) ? BLI_LINKSTACK_POP(data.ids_todo) : NULL) {
data.self_id = id;
- data.cb_flag = ID_IS_LINKED(id) ? IDWALK_CB_INDIRECT_USAGE : 0;
+
+ /* inherit_data is non-NULL when this function is called for some sub-data ID
+ * (like root nodetree of a material).
+ * In that case, we do not want to generate those 'generic flags' from our current sub-data ID (the node tree),
+ * but re-use those generated for the 'owner' ID (the material)... */
+ if (inherit_data == NULL) {
+ data.cb_flag = ID_IS_LINKED(id) ? IDWALK_CB_INDIRECT_USAGE : 0;
+ /* When an ID is not in Main database, it should never refcount IDs it is using.
+ * Exceptions: NodeTrees (yeeahhh!) directly used by Materials. */
+ data.cb_flag_clear = (id->tag & LIB_TAG_NO_MAIN) ? IDWALK_CB_USER | IDWALK_CB_USER_ONE : 0;
+ }
+ else {
+ data.cb_flag = inherit_data->cb_flag;
+ data.cb_flag_clear = inherit_data->cb_flag_clear;
+ }
if (bmain != NULL && bmain->relations != NULL && (flag & IDWALK_READONLY)) {
/* Note that this is minor optimization, even in worst cases (like id being an object with lots of
@@ -395,7 +419,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
case ID_LI:
{
Library *lib = (Library *) id;
- CALLBACK_INVOKE(lib->parent, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(lib->parent, IDWALK_CB_NEVER_SELF);
break;
}
case ID_SCE:
@@ -405,7 +429,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
CALLBACK_INVOKE(scene->camera, IDWALK_CB_NOP);
CALLBACK_INVOKE(scene->world, IDWALK_CB_USER);
- CALLBACK_INVOKE(scene->set, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(scene->set, IDWALK_CB_NEVER_SELF);
CALLBACK_INVOKE(scene->clip, IDWALK_CB_USER);
CALLBACK_INVOKE(scene->r.bake.cage_object, IDWALK_CB_NOP);
if (scene->nodetree) {
@@ -416,7 +440,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
Sequence *seq;
SEQP_BEGIN(scene->ed, seq)
{
- CALLBACK_INVOKE(seq->scene, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(seq->scene, IDWALK_CB_NEVER_SELF);
CALLBACK_INVOKE(seq->scene_camera, IDWALK_CB_NOP);
CALLBACK_INVOKE(seq->clip, IDWALK_CB_USER);
CALLBACK_INVOKE(seq->mask, IDWALK_CB_USER);
@@ -425,6 +449,11 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
for (SequenceModifierData *smd = seq->modifiers.first; smd; smd = smd->next) {
CALLBACK_INVOKE(smd->mask_id, IDWALK_CB_USER);
}
+
+ if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) {
+ TextVars *text_data = seq->effectdata;
+ CALLBACK_INVOKE(text_data->text_font, IDWALK_CB_USER);
+ }
} SEQ_END;
}
@@ -493,6 +522,9 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
if (toolsett->gp_paint) {
library_foreach_paint(&data, &toolsett->gp_paint->paint);
}
+
+ CALLBACK_INVOKE(toolsett->gp_sculpt.guide.reference_object, IDWALK_CB_NOP);
+
}
if (scene->rigidbody_world) {
@@ -526,10 +558,10 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
}
data.cb_flag = data_cb_flag;
- CALLBACK_INVOKE(object->parent, IDWALK_CB_NOP);
- CALLBACK_INVOKE(object->track, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(object->parent, IDWALK_CB_NEVER_SELF);
+ CALLBACK_INVOKE(object->track, IDWALK_CB_NEVER_SELF);
/* object->proxy is refcounted, but not object->proxy_group... *sigh* */
- CALLBACK_INVOKE(object->proxy, IDWALK_CB_USER);
+ CALLBACK_INVOKE(object->proxy, IDWALK_CB_NEVER_SELF);
CALLBACK_INVOKE(object->proxy_group, IDWALK_CB_NOP);
/* Special case!
@@ -538,7 +570,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
if (object->proxy_from) {
data.cb_flag = ID_IS_LINKED(object->proxy_from) ? IDWALK_CB_INDIRECT_USAGE : 0;
}
- CALLBACK_INVOKE(object->proxy_from, IDWALK_CB_LOOPBACK);
+ CALLBACK_INVOKE(object->proxy_from, IDWALK_CB_LOOPBACK | IDWALK_CB_NEVER_SELF);
data.cb_flag = data_cb_flag;
CALLBACK_INVOKE(object->poselib, IDWALK_CB_USER);
@@ -550,7 +582,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
data.cb_flag = data_cb_flag;
CALLBACK_INVOKE(object->gpd, IDWALK_CB_USER);
- CALLBACK_INVOKE(object->dup_group, IDWALK_CB_USER);
+ CALLBACK_INVOKE(object->instance_collection, IDWALK_CB_USER);
if (object->pd) {
CALLBACK_INVOKE(object->pd->tex, IDWALK_CB_USER);
@@ -571,20 +603,21 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
}
if (object->rigidbody_constraint) {
- CALLBACK_INVOKE(object->rigidbody_constraint->ob1, IDWALK_CB_NOP);
- CALLBACK_INVOKE(object->rigidbody_constraint->ob2, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(object->rigidbody_constraint->ob1, IDWALK_CB_NEVER_SELF);
+ CALLBACK_INVOKE(object->rigidbody_constraint->ob2, IDWALK_CB_NEVER_SELF);
}
if (object->lodlevels.first) {
LodLevel *level;
for (level = object->lodlevels.first; level; level = level->next) {
- CALLBACK_INVOKE(level->source, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(level->source, IDWALK_CB_NEVER_SELF);
}
}
modifiers_foreachIDLink(object, library_foreach_modifiersForeachIDLink, &data);
BKE_gpencil_modifiers_foreachIDLink(object, library_foreach_gpencil_modifiersForeachIDLink, &data);
BKE_constraints_id_loop(&object->constraints, library_foreach_constraintObjectLooper, &data);
+ BKE_shaderfx_foreachIDLink(object, library_foreach_shaderfxForeachIDLink, &data);
for (psys = object->particlesystem.first; psys; psys = psys->next) {
BKE_particlesystem_id_loop(psys, library_foreach_particlesystemsObjectLooper, &data);
@@ -613,7 +646,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
case ID_ME:
{
Mesh *mesh = (Mesh *) id;
- CALLBACK_INVOKE(mesh->texcomesh, IDWALK_CB_USER);
+ CALLBACK_INVOKE(mesh->texcomesh, IDWALK_CB_NEVER_SELF);
CALLBACK_INVOKE(mesh->key, IDWALK_CB_USER);
for (i = 0; i < mesh->totcol; i++) {
CALLBACK_INVOKE(mesh->mat[i], IDWALK_CB_USER);
@@ -684,7 +717,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
case ID_LA:
{
- Lamp *lamp = (Lamp *) id;
+ Light *lamp = (Light *) id;
if (lamp->nodetree) {
/* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
library_foreach_ID_as_subdata_link((ID **)&lamp->nodetree, callback, user_data, flag, &data);
@@ -747,10 +780,10 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
CALLBACK_INVOKE(cob->ob, IDWALK_CB_USER);
}
for (CollectionChild *child = collection->children.first; child; child = child->next) {
- CALLBACK_INVOKE(child->collection, IDWALK_CB_USER);
+ CALLBACK_INVOKE(child->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_USER);
}
for (CollectionParent *parent = collection->parents.first; parent; parent = parent->next) {
- CALLBACK_INVOKE(parent->collection, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(parent->collection, IDWALK_CB_NEVER_SELF);
}
break;
}
@@ -801,8 +834,8 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
case ID_PA:
{
ParticleSettings *psett = (ParticleSettings *) id;
- CALLBACK_INVOKE(psett->dup_group, IDWALK_CB_NOP);
- CALLBACK_INVOKE(psett->dup_ob, IDWALK_CB_NOP);
+ CALLBACK_INVOKE(psett->instance_collection, IDWALK_CB_USER);
+ CALLBACK_INVOKE(psett->instance_object, IDWALK_CB_NOP);
CALLBACK_INVOKE(psett->bb_ob, IDWALK_CB_NOP);
CALLBACK_INVOKE(psett->collision_group, IDWALK_CB_NOP);
@@ -843,7 +876,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
}
}
- for (ParticleDupliWeight *dw = psett->dupliweights.first; dw; dw = dw->next) {
+ for (ParticleDupliWeight *dw = psett->instance_weights.first; dw; dw = dw->next) {
CALLBACK_INVOKE(dw->ob, IDWALK_CB_NOP);
}
break;
@@ -1020,6 +1053,14 @@ FOREACH_FINALIZE:
#undef FOREACH_CALLBACK_INVOKE
/**
+ * Loop over all of the ID's this datablock links to.
+ */
+void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback callback, void *user_data, int flag)
+{
+ library_foreach_ID_link(bmain, id, callback, user_data, flag, NULL);
+}
+
+/**
* re-usable function, use when replacing ID's
*/
void BKE_library_update_ID_link_user(ID *id_dst, ID *id_src, const int cb_flag)
@@ -1327,38 +1368,35 @@ static int foreach_libblock_used_linked_data_tag_clear_cb(
*/
void BKE_library_unused_linked_data_set_tag(Main *bmain, const bool do_init_tag)
{
- ListBase *lb_array[MAX_LIBARRAY];
+ ID *id;
if (do_init_tag) {
- int i = set_listbasepointers(bmain, lb_array);
-
- while (i--) {
- for (ID *id = lb_array[i]->first; id; id = id->next) {
- if (id->lib && (id->tag & LIB_TAG_INDIRECT) != 0) {
- id->tag |= LIB_TAG_DOIT;
- }
- else {
- id->tag &= ~LIB_TAG_DOIT;
- }
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ if (id->lib && (id->tag & LIB_TAG_INDIRECT) != 0) {
+ id->tag |= LIB_TAG_DOIT;
+ }
+ else {
+ id->tag &= ~LIB_TAG_DOIT;
}
}
+ FOREACH_MAIN_ID_END;
}
- bool do_loop = true;
- while (do_loop) {
- int i = set_listbasepointers(bmain, lb_array);
+ for (bool do_loop = true; do_loop; ) {
+ bool do_break = false;
do_loop = false;
-
- while (i--) {
- for (ID *id = lb_array[i]->first; id; id = id->next) {
- if (id->tag & LIB_TAG_DOIT) {
- /* Unused ID (so far), no need to check it further. */
- continue;
- }
+ FOREACH_MAIN_ID_BREAKABLE_BEGIN(bmain, id, do_break)
+ {
+ if ((id->tag & LIB_TAG_DOIT) == 0) {
BKE_library_foreach_ID_link(
bmain, id, foreach_libblock_used_linked_data_tag_clear_cb, &do_loop, IDWALK_READONLY);
}
+ /* Else it is an unused ID (so far), no need to check it further. */
+ do_break = true;
+ break;
}
+ FOREACH_MAIN_ID_BREAKABLE_END;
}
}
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 458d723c95a..04ccdc729da 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/library_remap.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Contains management of ID's and libraries remap, unlink and free logic.
*/
@@ -31,6 +27,8 @@
#include <stddef.h>
#include <assert.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
/* all types are needed here, in order to do memory operations */
@@ -43,7 +41,7 @@
#include "DNA_gpencil_types.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_material_types.h"
@@ -82,7 +80,7 @@
#include "BKE_image.h"
#include "BKE_ipo.h"
#include "BKE_key.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_lattice.h"
#include "BKE_layer.h"
#include "BKE_library.h"
@@ -119,6 +117,8 @@
#include "BPY_extern.h"
#endif
+static CLG_LogRef LOG = {"bke.library_remap"};
+
static BKE_library_free_window_manager_cb free_windowmanager_cb = NULL;
void BKE_library_callback_free_window_manager_set(BKE_library_free_window_manager_cb func)
@@ -180,6 +180,11 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
}
if (*id_p && (*id_p == old_id)) {
+ /* Better remap to NULL than not remapping at all, then we can handle it as a regular remap-to-NULL case... */
+ if ((cb_flag & IDWALK_CB_NEVER_SELF) && (new_id == id_self)) {
+ new_id = NULL;
+ }
+
const bool is_reference = (cb_flag & IDWALK_CB_STATIC_OVERRIDE_REFERENCE) != 0;
const bool is_indirect = (cb_flag & IDWALK_CB_INDIRECT_USAGE) != 0;
const bool skip_indirect = (id_remap_data->flag & ID_REMAP_SKIP_INDIRECT_USAGE) != 0;
@@ -189,7 +194,8 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
const bool is_obj = (GS(id->name) == ID_OB);
const bool is_obj_proxy = (is_obj && (((Object *)id)->proxy || ((Object *)id)->proxy_group));
const bool is_obj_editmode = (is_obj && BKE_object_is_in_editmode((Object *)id));
- const bool is_never_null = ((cb_flag & IDWALK_CB_NEVER_NULL) && (new_id == NULL) &&
+ const bool is_never_null = ((cb_flag & IDWALK_CB_NEVER_NULL) &&
+ (new_id == NULL) &&
(id_remap_data->flag & ID_REMAP_FORCE_NEVER_NULL_USAGE) == 0);
const bool skip_reference = (id_remap_data->flag & ID_REMAP_SKIP_STATIC_OVERRIDE) != 0;
const bool skip_never_null = (id_remap_data->flag & ID_REMAP_SKIP_NEVER_NULL_USAGE) != 0;
@@ -245,10 +251,19 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
ID_RECALC_COPY_ON_WRITE | ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
}
if (cb_flag & IDWALK_CB_USER) {
- id_us_min(old_id);
- /* We do not want to handle LIB_TAG_INDIRECT/LIB_TAG_EXTERN here. */
- if (new_id)
+ /* NOTE: We don't user-count IDs which are not in the main database.
+ * This is because in certain conditions we can have datablocks in
+ * the main which are referencing datablocks outside of it.
+ * For example, BKE_mesh_new_from_object() called on an evaluated
+ * object will cause such situation.
+ */
+ if ((old_id->tag & LIB_TAG_NO_MAIN) == 0) {
+ id_us_min(old_id);
+ }
+ if (new_id != NULL && (new_id->tag & LIB_TAG_NO_MAIN) == 0) {
+ /* We do not want to handle LIB_TAG_INDIRECT/LIB_TAG_EXTERN here. */
new_id->us++;
+ }
}
else if (cb_flag & IDWALK_CB_USER_ONE) {
id_us_ensure_real(new_id);
@@ -305,14 +320,14 @@ static void libblock_remap_data_postprocess_object_update(Main *bmain, Object *o
BKE_main_collection_sync_remap(bmain);
if (old_ob == NULL) {
- for (Object *ob = bmain->object.first; ob != NULL; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob != NULL; ob = ob->id.next) {
if (ob->type == OB_MBALL && BKE_mball_is_basis(ob)) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
}
}
else {
- for (Object *ob = bmain->object.first; ob != NULL; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob != NULL; ob = ob->id.next) {
if (ob->type == OB_MBALL && BKE_mball_is_basis_for(ob, old_ob)) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
break; /* There is only one basis... */
@@ -389,8 +404,6 @@ ATTR_NONNULL(1) static void libblock_remap_data(
Main *bmain, ID *id, ID *old_id, ID *new_id, const short remap_flags, IDRemap *r_id_remap_data)
{
IDRemap id_remap_data;
- ListBase *lb_array[MAX_LIBARRAY];
- int i;
const int foreach_id_flags = (remap_flags & ID_REMAP_NO_INDIRECT_PROXY_DATA_USAGE) != 0 ? IDWALK_NO_INDIRECT_PROXY_DATA_USAGE : IDWALK_NOP;
if (r_id_remap_data == NULL) {
@@ -415,24 +428,23 @@ ATTR_NONNULL(1) static void libblock_remap_data(
BKE_library_foreach_ID_link(NULL, id, foreach_libblock_remap_callback, (void *)r_id_remap_data, foreach_id_flags);
}
else {
- i = set_listbasepointers(bmain, lb_array);
-
- /* Note that this is a very 'bruteforce' approach, maybe we could use some depsgraph to only process
+ /* Note that this is a very 'brute force' approach, maybe we could use some depsgraph to only process
* objects actually using given old_id... sounds rather unlikely currently, though, so this will do for now. */
+ ID *id_curr;
- while (i--) {
- for (ID *id_curr = lb_array[i]->first; id_curr; id_curr = id_curr->next) {
- if (BKE_library_id_can_use_idtype(id_curr, GS(old_id->name))) {
- /* Note that we cannot skip indirect usages of old_id here (if requested), we still need to check it for
- * the user count handling...
- * XXX No more true (except for debug usage of those skipping counters). */
- r_id_remap_data->id = id_curr;
- libblock_remap_data_preprocess(r_id_remap_data);
- BKE_library_foreach_ID_link(
- NULL, id_curr, foreach_libblock_remap_callback, (void *)r_id_remap_data, foreach_id_flags);
- }
+ FOREACH_MAIN_ID_BEGIN(bmain, id_curr)
+ {
+ if (BKE_library_id_can_use_idtype(id_curr, GS(old_id->name))) {
+ /* Note that we cannot skip indirect usages of old_id here (if requested), we still need to check it for
+ * the user count handling...
+ * XXX No more true (except for debug usage of those skipping counters). */
+ r_id_remap_data->id = id_curr;
+ libblock_remap_data_preprocess(r_id_remap_data);
+ BKE_library_foreach_ID_link(
+ NULL, id_curr, foreach_libblock_remap_callback, (void *)r_id_remap_data, foreach_id_flags);
}
}
+ FOREACH_MAIN_ID_END;
}
/* XXX We may not want to always 'transfer' fakeuser from old to new id... Think for now it's desired behavior
@@ -496,9 +508,9 @@ void BKE_libblock_remap_locked(
}
if (old_id->us - skipped_refcounted < 0) {
- printf("Error in remapping process from '%s' (%p) to '%s' (%p): "
- "wrong user count in old ID after process (summing up to %d)\n",
- old_id->name, old_id, new_id ? new_id->name : "<NULL>", new_id, old_id->us - skipped_refcounted);
+ CLOG_ERROR(&LOG, "Error in remapping process from '%s' (%p) to '%s' (%p): "
+ "wrong user count in old ID after process (summing up to %d)",
+ old_id->name, old_id, new_id ? new_id->name : "<NULL>", new_id, old_id->us - skipped_refcounted);
BLI_assert(0);
}
@@ -524,7 +536,7 @@ void BKE_libblock_remap_locked(
case ID_CU:
case ID_MB:
if (new_id) { /* Only affects us in case obdata was relinked (changed). */
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
libblock_remap_data_postprocess_obdata_relink(bmain, ob, new_id);
}
}
@@ -667,7 +679,7 @@ static int id_relink_to_newid_looper(void *UNUSED(user_data), ID *UNUSED(self_id
/** Similar to libblock_relink_ex, but is remapping IDs to their newid value if non-NULL, in given \a id.
*
- * Very specific usage, not sure we'll keep it on the long run, currently only used in Object duplication code...
+ * Very specific usage, not sure we'll keep it on the long run, currently only used in Object/Collection duplication code...
*/
void BKE_libblock_relink_to_newid(ID *id)
{
@@ -726,7 +738,7 @@ void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag))
BKE_lattice_free((Lattice *)id);
break;
case ID_LA:
- BKE_lamp_free((Lamp *)id);
+ BKE_light_free((Light *)id);
break;
case ID_CA:
BKE_camera_free((Camera *) id);
@@ -807,7 +819,22 @@ void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag))
}
}
-
+/**
+ * Complete ID freeing, extended version for corner cases.
+ * Can override default (and safe!) freeing process, to gain some speed up.
+ *
+ * At that point, given id is assumed to not be used by any other data-block already
+ * (might not be actually true, in case e.g. several inter-related IDs get freed together...).
+ * However, they might still be using (referencing) other IDs, this code takes care of it if
+ * \a LIB_TAG_NO_USER_REFCOUNT is not defined.
+ *
+ * \param bmain: Main database containing the freed ID, can be NULL in case it's a temp ID outside of any Main.
+ * \param idv: Pointer to ID to be freed.
+ * \param flag: Set of \a LIB_ID_FREE_... flags controlling/overriding usual freeing process,
+ * 0 to get default safe behavior.
+ * \param use_flag_from_idtag: Still use freeing info flags from given ID datablock,
+ * even if some overriding ones are passed in \a falg parameter.
+ */
void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_idtag)
{
ID *id = idv;
@@ -846,7 +873,12 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
}
#ifdef WITH_PYTHON
+# ifdef WITH_PYTHON_SAFETY
BPY_id_release(id);
+# endif
+ if (id->py_instance) {
+ BPY_DECREF_RNA_INVALIDATE(id->py_instance);
+ }
#endif
if ((flag & LIB_ID_FREE_NO_USER_REFCOUNT) == 0) {
@@ -856,7 +888,7 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
BKE_libblock_free_datablock(id, flag);
/* avoid notifying on removed data */
- if (bmain) {
+ if ((flag & LIB_ID_FREE_NO_MAIN) == 0) {
BKE_main_lock(bmain);
}
@@ -877,7 +909,7 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
BKE_libblock_free_data(id, (flag & LIB_ID_FREE_NO_USER_REFCOUNT) == 0);
- if (bmain) {
+ if ((flag & LIB_ID_FREE_NO_MAIN) == 0) {
BKE_main_unlock(bmain);
}
@@ -886,69 +918,23 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
}
}
+/**
+ * Complete ID freeing, should be usable in most cases (even for out-of-Main IDs).
+ *
+ * See #BKE_id_free_ex description for full details.
+ *
+ * \param bmain: Main database containing the freed ID, can be NULL in case it's a temp ID outside of any Main.
+ * \param idv: Pointer to ID to be freed.
+ */
void BKE_id_free(Main *bmain, void *idv)
{
BKE_id_free_ex(bmain, idv, 0, true);
}
/**
- * used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c
- *
- * \param do_id_user: if \a true, try to release other ID's 'references' hold by \a idv.
- * (only applies to main database)
- * \param do_ui_user: similar to do_id_user but makes sure UI does not hold references to
- * \a id.
+ * Not really a freeing function by itself, it decrements usercount of given id, and only frees it if it reaches 0.
*/
-void BKE_libblock_free_ex(Main *bmain, void *idv, const bool do_id_user, const bool do_ui_user)
-{
- ID *id = idv;
- short type = GS(id->name);
- ListBase *lb = which_libbase(bmain, type);
-
- DEG_id_type_tag(bmain, type);
-
-#ifdef WITH_PYTHON
-#ifdef WITH_PYTHON_SAFETY
- BPY_id_release(id);
-#endif
- if (id->py_instance) {
- BPY_DECREF_RNA_INVALIDATE(id->py_instance);
- }
-#endif
-
- if (do_id_user) {
- BKE_libblock_relink_ex(bmain, id, NULL, NULL, true);
- }
-
- BKE_libblock_free_datablock(id, 0);
-
- /* avoid notifying on removed data */
- BKE_main_lock(bmain);
-
- if (do_ui_user) {
- if (free_notifier_reference_cb) {
- free_notifier_reference_cb(id);
- }
-
- if (remap_editor_id_reference_cb) {
- remap_editor_id_reference_cb(id, NULL);
- }
- }
-
- BLI_remlink(lb, id);
-
- BKE_libblock_free_data(id, do_id_user);
- BKE_main_unlock(bmain);
-
- MEM_freeN(id);
-}
-
-void BKE_libblock_free(Main *bmain, void *idv)
-{
- BKE_libblock_free_ex(bmain, idv, true, true);
-}
-
-void BKE_libblock_free_us(Main *bmain, void *idv) /* test users */
+void BKE_id_free_us(Main *bmain, void *idv) /* test users */
{
ID *id = idv;
@@ -968,57 +954,151 @@ void BKE_libblock_free_us(Main *bmain, void *idv) /* test users */
if (id->us == 0) {
BKE_libblock_unlink(bmain, id, false, false);
- BKE_libblock_free(bmain, id);
+ BKE_id_free(bmain, id);
}
}
-void BKE_libblock_delete(Main *bmain, void *idv)
+static void id_delete(Main *bmain, const bool do_tagged_deletion)
{
+ const int tag = LIB_TAG_DOIT;
ListBase *lbarray[MAX_LIBARRAY];
+ Link dummy_link = {0};
int base_count, i;
- base_count = set_listbasepointers(bmain, lbarray);
- BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
+ /* Used by batch tagged deletion, when we call BKE_id_free then, id is no more in Main database,
+ * and has already properly unlinked its other IDs usages.
+ * UI users are always cleared in BKE_libblock_remap_locked() call, so we can always skip it. */
+ const int free_flag = LIB_ID_FREE_NO_UI_USER |
+ (do_tagged_deletion ? LIB_ID_FREE_NO_MAIN | LIB_ID_FREE_NO_USER_REFCOUNT : 0);
+ ListBase tagged_deleted_ids = {NULL};
- /* First tag all datablocks directly from target lib.
- * Note that we go forward here, since we want to check dependencies before users (e.g. meshes before objects).
- * Avoids to have to loop twice. */
- for (i = 0; i < base_count; i++) {
- ListBase *lb = lbarray[i];
- ID *id;
+ base_count = set_listbasepointers(bmain, lbarray);
- for (id = lb->first; id; id = id->next) {
- /* Note: in case we delete a library, we also delete all its datablocks! */
- if ((id == (ID *)idv) || (id->lib == (Library *)idv) || (id->tag & LIB_TAG_DOIT)) {
- id->tag |= LIB_TAG_DOIT;
+ BKE_main_lock(bmain);
+ if (do_tagged_deletion) {
+ /* Main idea of batch deletion is to remove all IDs to be deleted from Main database.
+ * This means that we won't have to loop over all deleted IDs to remove usages
+ * of other deleted IDs.
+ * This gives tremendous speed-up when deleting a large amount of IDs from a Main
+ * containing thousands of those.
+ * This also means that we have to be very careful here, as we by-pass many 'common'
+ * processing, hence risking to 'corrupt' at least user counts, if not IDs themselves. */
+ bool keep_looping = true;
+ while (keep_looping) {
+ ID *id, *id_next;
+ ID *last_remapped_id = tagged_deleted_ids.last;
+ keep_looping = false;
+
+ /* First tag and remove from Main all datablocks directly from target lib.
+ * Note that we go forward here, since we want to check dependencies before users
+ * (e.g. meshes before objects). Avoids to have to loop twice. */
+ for (i = 0; i < base_count; i++) {
+ ListBase *lb = lbarray[i];
+
+ for (id = lb->first; id; id = id_next) {
+ id_next = id->next;
+ /* Note: in case we delete a library, we also delete all its datablocks! */
+ if ((id->tag & tag) || (id->lib != NULL && (id->lib->id.tag & tag))) {
+ BLI_remlink(lb, id);
+ BLI_addtail(&tagged_deleted_ids, id);
+ id->tag |= tag | LIB_TAG_NO_MAIN;
+ keep_looping = true;
+ }
+ }
+ }
+ if (last_remapped_id == NULL) {
+ dummy_link.next = tagged_deleted_ids.first;
+ last_remapped_id = (ID *)(&dummy_link);
+ }
+ for (id = last_remapped_id->next; id; id = id->next) {
/* Will tag 'never NULL' users of this ID too.
* Note that we cannot use BKE_libblock_unlink() here, since it would ignore indirect (and proxy!)
* links, this can lead to nasty crashing here in second, actual deleting loop.
* Also, this will also flag users of deleted data that cannot be unlinked
* (object using deleted obdata, etc.), so that they also get deleted. */
- BKE_libblock_remap(bmain, id, NULL, ID_REMAP_FLAG_NEVER_NULL_USAGE | ID_REMAP_FORCE_NEVER_NULL_USAGE);
+ BKE_libblock_remap_locked(
+ bmain, id, NULL,
+ ID_REMAP_FLAG_NEVER_NULL_USAGE | ID_REMAP_FORCE_NEVER_NULL_USAGE);
+ /* Since we removed ID from Main, we also need to unlink its own other IDs usages ourself. */
+ BKE_libblock_relink_ex(bmain, id, NULL, NULL, true);
+ /* This is needed because we may not have remapped usages of that ID by other deleted ones. */
+// id->us = 0; /* Is it actually? */
+ }
+ }
+ }
+ else {
+ /* First tag all datablocks directly from target lib.
+ * Note that we go forward here, since we want to check dependencies before users (e.g. meshes before objects).
+ * Avoids to have to loop twice. */
+ for (i = 0; i < base_count; i++) {
+ ListBase *lb = lbarray[i];
+ ID *id, *id_next;
+
+ for (id = lb->first; id; id = id_next) {
+ id_next = id->next;
+ /* Note: in case we delete a library, we also delete all its datablocks! */
+ if ((id->tag & tag) || (id->lib != NULL && (id->lib->id.tag & tag))) {
+ id->tag |= tag;
+
+ /* Will tag 'never NULL' users of this ID too.
+ * Note that we cannot use BKE_libblock_unlink() here, since it would ignore indirect (and proxy!)
+ * links, this can lead to nasty crashing here in second, actual deleting loop.
+ * Also, this will also flag users of deleted data that cannot be unlinked
+ * (object using deleted obdata, etc.), so that they also get deleted. */
+ BKE_libblock_remap_locked(
+ bmain, id, NULL,
+ ID_REMAP_FLAG_NEVER_NULL_USAGE | ID_REMAP_FORCE_NEVER_NULL_USAGE);
+ }
}
}
}
+ BKE_main_unlock(bmain);
/* In usual reversed order, such that all usage of a given ID, even 'never NULL' ones, have been already cleared
* when we reach it (e.g. Objects being processed before meshes, they'll have already released their 'reference'
* over meshes when we come to freeing obdata). */
- for (i = base_count; i--; ) {
+ for (i = do_tagged_deletion ? 1 : base_count; i--; ) {
ListBase *lb = lbarray[i];
ID *id, *id_next;
- for (id = lb->first; id; id = id_next) {
+ for (id = do_tagged_deletion ? tagged_deleted_ids.first : lb->first; id; id = id_next) {
id_next = id->next;
- if (id->tag & LIB_TAG_DOIT) {
+ if (id->tag & tag) {
if (id->us != 0) {
#ifdef DEBUG_PRINT
printf("%s: deleting %s (%d)\n", __func__, id->name, id->us);
#endif
BLI_assert(id->us == 0);
}
- BKE_libblock_free(bmain, id);
+ BKE_id_free_ex(bmain, id, free_flag, !do_tagged_deletion);
}
}
}
+
+ bmain->is_memfile_undo_written = false;
+}
+
+/**
+ * Properly delete a single ID from given \a bmain database.
+ */
+void BKE_id_delete(Main *bmain, void *idv)
+{
+ BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
+ ((ID *)idv)->tag |= LIB_TAG_DOIT;
+
+ id_delete(bmain, false);
+}
+
+/**
+ * Properly delete all IDs tagged with \a LIB_TAG_DOIT, in given \a bmain database.
+ *
+ * This is more efficient than calling #BKE_id_delete repetitively on a large set of IDs
+ * (several times faster when deleting most of the IDs at once)...
+ *
+ * \warning Considered experimental for now, seems to be working OK but this is
+ * risky code in a complicated area.
+ */
+void BKE_id_multi_tagged_delete(Main *bmain)
+{
+ id_delete(bmain, true);
}
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/light.c
index ff79185d2b4..b1ec5ba6954 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/light.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/lamp.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
@@ -34,7 +26,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
@@ -47,14 +39,12 @@
#include "BKE_animsys.h"
#include "BKE_colortools.h"
#include "BKE_icons.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_node.h"
-void BKE_lamp_init(Lamp *la)
+void BKE_light_init(Light *la)
{
BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(la, id));
@@ -94,33 +84,33 @@ void BKE_lamp_init(Lamp *la)
curvemapping_initialize(la->curfalloff);
}
-Lamp *BKE_lamp_add(Main *bmain, const char *name)
+Light *BKE_light_add(Main *bmain, const char *name)
{
- Lamp *la;
+ Light *la;
la = BKE_libblock_alloc(bmain, ID_LA, name, 0);
- BKE_lamp_init(la);
+ BKE_light_init(la);
return la;
}
/**
- * Only copy internal data of Lamp ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Light ID from source to already allocated/initialized destination.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
* \param flag: Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more).
*/
-void BKE_lamp_copy_data(Main *bmain, Lamp *la_dst, const Lamp *la_src, const int flag)
+void BKE_light_copy_data(Main *bmain, Light *la_dst, const Light *la_src, const int flag)
{
la_dst->curfalloff = curvemapping_copy(la_src->curfalloff);
if (la_src->nodetree) {
/* Note: nodetree is *not* in bmain, however this specific case is handled at lower level
* (see BKE_libblock_copy_ex()). */
- BKE_id_copy_ex(bmain, (ID *)la_src->nodetree, (ID **)&la_dst->nodetree, flag, false);
+ BKE_id_copy_ex(bmain, (ID *)la_src->nodetree, (ID **)&la_dst->nodetree, flag);
}
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
@@ -131,18 +121,18 @@ void BKE_lamp_copy_data(Main *bmain, Lamp *la_dst, const Lamp *la_src, const int
}
}
-Lamp *BKE_lamp_copy(Main *bmain, const Lamp *la)
+Light *BKE_light_copy(Main *bmain, const Light *la)
{
- Lamp *la_copy;
- BKE_id_copy_ex(bmain, &la->id, (ID **)&la_copy, 0, false);
+ Light *la_copy;
+ BKE_id_copy(bmain, &la->id, (ID **)&la_copy);
return la_copy;
}
-Lamp *BKE_lamp_localize(Lamp *la)
+Light *BKE_light_localize(Light *la)
{
/* TODO(bastien): Replace with something like:
*
- * Lamp *la_copy;
+ * Light *la_copy;
* BKE_id_copy_ex(bmain, &la->id, (ID **)&la_copy,
* LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT,
* false);
@@ -150,7 +140,7 @@ Lamp *BKE_lamp_localize(Lamp *la)
*
* NOTE: Only possible once nested node trees are fully converted to that too. */
- Lamp *lan = BKE_libblock_copy_for_localize(&la->id);
+ Light *lan = BKE_libblock_copy_for_localize(&la->id);
lan->curfalloff = curvemapping_copy(la->curfalloff);
@@ -164,18 +154,18 @@ Lamp *BKE_lamp_localize(Lamp *la)
return lan;
}
-void BKE_lamp_make_local(Main *bmain, Lamp *la, const bool lib_local)
+void BKE_light_make_local(Main *bmain, Light *la, const bool lib_local)
{
BKE_id_make_local_generic(bmain, &la->id, true, lib_local);
}
-void BKE_lamp_free(Lamp *la)
+void BKE_light_free(Light *la)
{
BKE_animdata_free((ID *)la, false);
curvemapping_free(la->curfalloff);
- /* is no lib link block, but lamp extension */
+ /* is no lib link block, but light extension */
if (la->nodetree) {
ntreeFreeNestedTree(la->nodetree);
MEM_freeN(la->nodetree);
diff --git a/source/blender/blenkernel/intern/lightprobe.c b/source/blender/blenkernel/intern/lightprobe.c
index 5017827ea9c..1d46f1aa5d3 100644
--- a/source/blender/blenkernel/intern/lightprobe.c
+++ b/source/blender/blenkernel/intern/lightprobe.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,26 +15,18 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/lightprobe.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_object_types.h"
#include "DNA_lightprobe_types.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_animsys.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_lightprobe.h"
#include "BKE_main.h"
@@ -71,7 +61,7 @@ void *BKE_lightprobe_add(Main *bmain, const char *name)
/**
* Only copy internal data of LightProbe ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -86,7 +76,7 @@ void BKE_lightprobe_copy_data(
LightProbe *BKE_lightprobe_copy(Main *bmain, const LightProbe *probe)
{
LightProbe *probe_copy;
- BKE_id_copy_ex(bmain, &probe->id, (ID **)&probe_copy, 0, false);
+ BKE_id_copy(bmain, &probe->id, (ID **)&probe_copy);
return probe_copy;
}
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c
index 31a261fdb4f..4ec9755bec8 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/linestyle.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdio.h>
@@ -156,7 +148,7 @@ void BKE_linestyle_free(FreestyleLineStyle *linestyle)
/**
* Only copy internal data of Linestyle ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -178,7 +170,7 @@ void BKE_linestyle_copy_data(
if (linestyle_src->nodetree) {
/* Note: nodetree is *not* in bmain, however this specific case is handled at lower level
* (see BKE_libblock_copy_ex()). */
- BKE_id_copy_ex(bmain, (ID *)linestyle_src->nodetree, (ID **)&linestyle_dst->nodetree, flag, false);
+ BKE_id_copy_ex(bmain, (ID *)linestyle_src->nodetree, (ID **)&linestyle_dst->nodetree, flag);
}
LineStyleModifier *m;
@@ -203,7 +195,7 @@ void BKE_linestyle_copy_data(
FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, const FreestyleLineStyle *linestyle)
{
FreestyleLineStyle *linestyle_copy;
- BKE_id_copy_ex(bmain, &linestyle->id, (ID **)&linestyle_copy, 0, false);
+ BKE_id_copy(bmain, &linestyle->id, (ID **)&linestyle_copy);
return linestyle_copy;
}
diff --git a/source/blender/blenkernel/intern/main.c b/source/blender/blenkernel/intern/main.c
index e40a1eb9ba8..1f65212135b 100644
--- a/source/blender/blenkernel/intern/main.c
+++ b/source/blender/blenkernel/intern/main.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/main.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
- * Contains management of Main database itself.
+ * Contains management of #Main database itself.
*/
#include <string.h>
@@ -64,61 +56,69 @@ void BKE_main_free(Main *mainvar)
ListBase *lbarray[MAX_LIBARRAY];
int a;
+ /* Since we are removing whole main, no need to bother 'properly' (and slowly) removing each ID from it. */
+ const int free_flag = (LIB_ID_FREE_NO_MAIN |
+ LIB_ID_FREE_NO_UI_USER |
+ LIB_ID_FREE_NO_USER_REFCOUNT |
+ LIB_ID_FREE_NO_DEG_TAG);
+
MEM_SAFE_FREE(mainvar->blen_thumb);
a = set_listbasepointers(mainvar, lbarray);
while (a--) {
ListBase *lb = lbarray[a];
- ID *id;
+ ID *id, *id_next;
- while ( (id = lb->first) ) {
+ for (id = lb->first; id != NULL; id = id_next) {
+ id_next = id->next;
#if 1
- BKE_libblock_free_ex(mainvar, id, false, false);
+ BKE_id_free_ex(mainvar, id, free_flag, false);
#else
/* errors freeing ID's can be hard to track down,
* enable this so valgrind will give the line number in its error log */
switch (a) {
- case 0: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 1: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 2: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 3: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 4: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 5: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 6: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 7: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 8: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 9: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 10: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 11: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 12: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 13: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 14: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 15: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 16: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 17: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 18: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 19: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 20: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 21: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 22: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 23: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 24: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 25: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 26: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 27: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 28: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 29: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 30: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 31: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 32: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 33: BKE_libblock_free_ex(mainvar, id, false, false); break;
- case 34: BKE_libblock_free_ex(mainvar, id, false, false); break;
+ case 0: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 1: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 2: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 3: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 4: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 5: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 6: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 7: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 8: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 9: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 10: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 11: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 12: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 13: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 14: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 15: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 16: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 17: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 18: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 19: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 20: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 21: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 22: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 23: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 24: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 25: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 26: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 27: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 28: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 29: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 30: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 31: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 32: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 33: BKE_id_free_ex(mainvar, id, free_flag, false); break;
+ case 34: BKE_id_free_ex(mainvar, id, free_flag, false); break;
default:
BLI_assert(0);
break;
}
#endif
}
+ BLI_listbase_clear(lb);
}
if (mainvar->relations) {
@@ -141,7 +141,7 @@ void BKE_main_unlock(struct Main *bmain)
}
-static int main_relations_create_cb(void *user_data, ID *id_self, ID **id_pointer, int cb_flag)
+static int main_relations_create_idlink_cb(void *user_data, ID *id_self, ID **id_pointer, int cb_flag)
{
MainIDRelations *rel = user_data;
@@ -177,10 +177,6 @@ static int main_relations_create_cb(void *user_data, ID *id_self, ID **id_pointe
/** Generate the mappings between used IDs and their users, and vice-versa. */
void BKE_main_relations_create(Main *bmain)
{
- ListBase *lbarray[MAX_LIBARRAY];
- ID *id;
- int a;
-
if (bmain->relations != NULL) {
BKE_main_relations_free(bmain);
}
@@ -190,11 +186,12 @@ void BKE_main_relations_create(Main *bmain)
bmain->relations->id_user_to_used = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__);
bmain->relations->entry_pool = BLI_mempool_create(sizeof(MainIDRelationsEntry), 128, 128, BLI_MEMPOOL_NOP);
- for (a = set_listbasepointers(bmain, lbarray); a--; ) {
- for (id = lbarray[a]->first; id; id = id->next) {
- BKE_library_foreach_ID_link(NULL, id, main_relations_create_cb, bmain->relations, IDWALK_READONLY);
- }
+ ID *id;
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ BKE_library_foreach_ID_link(NULL, id, main_relations_create_idlink_cb, bmain->relations, IDWALK_READONLY);
}
+ FOREACH_MAIN_ID_END;
}
void BKE_main_relations_free(Main *bmain)
@@ -213,6 +210,26 @@ void BKE_main_relations_free(Main *bmain)
}
/**
+ * Create a GSet storing all IDs present in given \a bmain, by their pointers.
+ *
+ * \param gset: If not NULL, given GSet will be extended with IDs from given \a bmain, instead of creating a new one.
+ */
+GSet *BKE_main_gset_create(Main *bmain, GSet *gset)
+{
+ if (gset == NULL) {
+ gset = BLI_gset_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__);
+ }
+
+ ID *id;
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ BLI_gset_add(gset, id);
+ }
+ FOREACH_MAIN_ID_END;
+ return gset;
+}
+
+/**
* Generates a raw .blend file thumbnail data from given image.
*
* \param bmain: If not NULL, also store generated data in this Main.
@@ -289,7 +306,7 @@ const char *BKE_main_blendfile_path(const Main *bmain)
}
/**
- * Return filepath of global main (G_MAIN).
+ * Return filepath of global main #G_MAIN.
*
* \warning Usage is not recommended, you should always try to get a valid Main pointer from context...
*/
@@ -305,69 +322,69 @@ ListBase *which_libbase(Main *bmain, short type)
{
switch ((ID_Type)type) {
case ID_SCE:
- return &(bmain->scene);
+ return &(bmain->scenes);
case ID_LI:
- return &(bmain->library);
+ return &(bmain->libraries);
case ID_OB:
- return &(bmain->object);
+ return &(bmain->objects);
case ID_ME:
- return &(bmain->mesh);
+ return &(bmain->meshes);
case ID_CU:
- return &(bmain->curve);
+ return &(bmain->curves);
case ID_MB:
- return &(bmain->mball);
+ return &(bmain->metaballs);
case ID_MA:
- return &(bmain->mat);
+ return &(bmain->materials);
case ID_TE:
- return &(bmain->tex);
+ return &(bmain->textures);
case ID_IM:
- return &(bmain->image);
+ return &(bmain->images);
case ID_LT:
- return &(bmain->latt);
+ return &(bmain->lattices);
case ID_LA:
- return &(bmain->lamp);
+ return &(bmain->lights);
case ID_CA:
- return &(bmain->camera);
+ return &(bmain->cameras);
case ID_IP:
return &(bmain->ipo);
case ID_KE:
- return &(bmain->key);
+ return &(bmain->shapekeys);
case ID_WO:
- return &(bmain->world);
+ return &(bmain->worlds);
case ID_SCR:
- return &(bmain->screen);
+ return &(bmain->screens);
case ID_VF:
- return &(bmain->vfont);
+ return &(bmain->fonts);
case ID_TXT:
- return &(bmain->text);
+ return &(bmain->texts);
case ID_SPK:
- return &(bmain->speaker);
+ return &(bmain->speakers);
case ID_LP:
- return &(bmain->lightprobe);
+ return &(bmain->lightprobes);
case ID_SO:
- return &(bmain->sound);
+ return &(bmain->sounds);
case ID_GR:
- return &(bmain->collection);
+ return &(bmain->collections);
case ID_AR:
- return &(bmain->armature);
+ return &(bmain->armatures);
case ID_AC:
- return &(bmain->action);
+ return &(bmain->actions);
case ID_NT:
- return &(bmain->nodetree);
+ return &(bmain->nodetrees);
case ID_BR:
- return &(bmain->brush);
+ return &(bmain->brushes);
case ID_PA:
- return &(bmain->particle);
+ return &(bmain->particles);
case ID_WM:
return &(bmain->wm);
case ID_GD:
- return &(bmain->gpencil);
+ return &(bmain->gpencils);
case ID_MC:
- return &(bmain->movieclip);
+ return &(bmain->movieclips);
case ID_MSK:
- return &(bmain->mask);
+ return &(bmain->masks);
case ID_LS:
- return &(bmain->linestyle);
+ return &(bmain->linestyles);
case ID_PAL:
return &(bmain->palettes);
case ID_PC:
@@ -381,63 +398,63 @@ ListBase *which_libbase(Main *bmain, short type)
}
/**
- * puts into array *lb pointers to all the ListBase structs in main,
+ * puts into array *lb pointers to all the #ListBase structs in main,
* and returns the number of them as the function result. This is useful for
* generic traversal of all the blocks in a Main (by traversing all the
* lists in turn), without worrying about block types.
*
- * \note MAX_LIBARRAY define should match this code */
+ * \note #MAX_LIBARRAY define should match this code */
int set_listbasepointers(Main *bmain, ListBase **lb)
{
/* BACKWARDS! also watch order of free-ing! (mesh<->mat), first items freed last.
* This is important because freeing data decreases usercounts of other datablocks,
* if this data is its self freed it can crash. */
- lb[INDEX_ID_LI] = &(bmain->library); /* Libraries may be accessed from pretty much any other ID... */
+ lb[INDEX_ID_LI] = &(bmain->libraries); /* Libraries may be accessed from pretty much any other ID... */
lb[INDEX_ID_IP] = &(bmain->ipo);
- lb[INDEX_ID_AC] = &(bmain->action); /* moved here to avoid problems when freeing with animato (aligorith) */
- lb[INDEX_ID_KE] = &(bmain->key);
+ lb[INDEX_ID_AC] = &(bmain->actions); /* moved here to avoid problems when freeing with animato (aligorith) */
+ lb[INDEX_ID_KE] = &(bmain->shapekeys);
lb[INDEX_ID_PAL] = &(bmain->palettes); /* referenced by gpencil, so needs to be before that to avoid crashes */
- lb[INDEX_ID_GD] = &(bmain->gpencil); /* referenced by nodes, objects, view, scene etc, before to free after. */
- lb[INDEX_ID_NT] = &(bmain->nodetree);
- lb[INDEX_ID_IM] = &(bmain->image);
- lb[INDEX_ID_TE] = &(bmain->tex);
- lb[INDEX_ID_MA] = &(bmain->mat);
- lb[INDEX_ID_VF] = &(bmain->vfont);
+ lb[INDEX_ID_GD] = &(bmain->gpencils); /* referenced by nodes, objects, view, scene etc, before to free after. */
+ lb[INDEX_ID_NT] = &(bmain->nodetrees);
+ lb[INDEX_ID_IM] = &(bmain->images);
+ lb[INDEX_ID_TE] = &(bmain->textures);
+ lb[INDEX_ID_MA] = &(bmain->materials);
+ lb[INDEX_ID_VF] = &(bmain->fonts);
/* Important!: When adding a new object type,
* the specific data should be inserted here
*/
- lb[INDEX_ID_AR] = &(bmain->armature);
+ lb[INDEX_ID_AR] = &(bmain->armatures);
lb[INDEX_ID_CF] = &(bmain->cachefiles);
- lb[INDEX_ID_ME] = &(bmain->mesh);
- lb[INDEX_ID_CU] = &(bmain->curve);
- lb[INDEX_ID_MB] = &(bmain->mball);
+ lb[INDEX_ID_ME] = &(bmain->meshes);
+ lb[INDEX_ID_CU] = &(bmain->curves);
+ lb[INDEX_ID_MB] = &(bmain->metaballs);
- lb[INDEX_ID_LT] = &(bmain->latt);
- lb[INDEX_ID_LA] = &(bmain->lamp);
- lb[INDEX_ID_CA] = &(bmain->camera);
+ lb[INDEX_ID_LT] = &(bmain->lattices);
+ lb[INDEX_ID_LA] = &(bmain->lights);
+ lb[INDEX_ID_CA] = &(bmain->cameras);
- lb[INDEX_ID_TXT] = &(bmain->text);
- lb[INDEX_ID_SO] = &(bmain->sound);
- lb[INDEX_ID_GR] = &(bmain->collection);
+ lb[INDEX_ID_TXT] = &(bmain->texts);
+ lb[INDEX_ID_SO] = &(bmain->sounds);
+ lb[INDEX_ID_GR] = &(bmain->collections);
lb[INDEX_ID_PAL] = &(bmain->palettes);
lb[INDEX_ID_PC] = &(bmain->paintcurves);
- lb[INDEX_ID_BR] = &(bmain->brush);
- lb[INDEX_ID_PA] = &(bmain->particle);
- lb[INDEX_ID_SPK] = &(bmain->speaker);
- lb[INDEX_ID_LP] = &(bmain->lightprobe);
-
- lb[INDEX_ID_WO] = &(bmain->world);
- lb[INDEX_ID_MC] = &(bmain->movieclip);
- lb[INDEX_ID_SCR] = &(bmain->screen);
- lb[INDEX_ID_OB] = &(bmain->object);
- lb[INDEX_ID_LS] = &(bmain->linestyle); /* referenced by scenes */
- lb[INDEX_ID_SCE] = &(bmain->scene);
+ lb[INDEX_ID_BR] = &(bmain->brushes);
+ lb[INDEX_ID_PA] = &(bmain->particles);
+ lb[INDEX_ID_SPK] = &(bmain->speakers);
+ lb[INDEX_ID_LP] = &(bmain->lightprobes);
+
+ lb[INDEX_ID_WO] = &(bmain->worlds);
+ lb[INDEX_ID_MC] = &(bmain->movieclips);
+ lb[INDEX_ID_SCR] = &(bmain->screens);
+ lb[INDEX_ID_OB] = &(bmain->objects);
+ lb[INDEX_ID_LS] = &(bmain->linestyles); /* referenced by scenes */
+ lb[INDEX_ID_SCE] = &(bmain->scenes);
lb[INDEX_ID_WS] = &(bmain->workspaces); /* before wm, so it's freed after it! */
lb[INDEX_ID_WM] = &(bmain->wm);
- lb[INDEX_ID_MSK] = &(bmain->mask);
+ lb[INDEX_ID_MSK] = &(bmain->masks);
lb[INDEX_ID_NULL] = NULL;
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 3f6eaffa552..a67f533ded5 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,17 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mask.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stddef.h>
#include <string.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
@@ -63,6 +57,8 @@
#include "DEG_depsgraph_build.h"
+static CLG_LogRef LOG = {"bke.mask"};
+
static struct {
ListBase splines;
struct GHash *id_hash;
@@ -207,6 +203,7 @@ MaskLayer *BKE_mask_layer_copy(const MaskLayer *masklay)
masklay_new->blend = masklay->blend;
masklay_new->blend_flag = masklay->blend_flag;
masklay_new->flag = masklay->flag;
+ masklay_new->falloff = masklay->falloff;
masklay_new->restrictflag = masklay->restrictflag;
for (spline = masklay->splines.first; spline; spline = spline->next) {
@@ -847,7 +844,7 @@ Mask *BKE_mask_copy_nolib(Mask *mask)
/**
* Only copy internal data of Mask ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -866,7 +863,7 @@ void BKE_mask_copy_data(Main *UNUSED(bmain), Mask *mask_dst, const Mask *mask_sr
Mask *BKE_mask_copy(Main *bmain, const Mask *mask)
{
Mask *mask_copy;
- BKE_id_copy_ex(bmain, &mask->id, (ID **)&mask_copy, 0, false);
+ BKE_id_copy(bmain, &mask->id, (ID **)&mask_copy);
return mask_copy;
}
@@ -1426,7 +1423,7 @@ void BKE_mask_evaluate_all_masks(Main *bmain, float ctime, const bool do_newfram
{
Mask *mask;
- for (mask = bmain->mask.first; mask; mask = mask->id.next) {
+ for (mask = bmain->masks.first; mask; mask = mask->id.next) {
BKE_mask_evaluate(mask, ctime, do_newframe);
}
}
@@ -1488,8 +1485,8 @@ void BKE_mask_layer_shape_from_mask(MaskLayer *masklay, MaskLayerShape *masklay_
}
}
else {
- printf("%s: vert mismatch %d != %d (frame %d)\n",
- __func__, masklay_shape->tot_vert, tot, masklay_shape->frame);
+ CLOG_ERROR(&LOG, "vert mismatch %d != %d (frame %d)",
+ masklay_shape->tot_vert, tot, masklay_shape->frame);
}
}
@@ -1510,8 +1507,8 @@ void BKE_mask_layer_shape_to_mask(MaskLayer *masklay, MaskLayerShape *masklay_sh
}
}
else {
- printf("%s: vert mismatch %d != %d (frame %d)\n",
- __func__, masklay_shape->tot_vert, tot, masklay_shape->frame);
+ CLOG_ERROR(&LOG, "vert mismatch %d != %d (frame %d)",
+ masklay_shape->tot_vert, tot, masklay_shape->frame);
}
}
@@ -1549,9 +1546,9 @@ void BKE_mask_layer_shape_to_mask_interp(MaskLayer *masklay,
}
}
else {
- printf("%s: vert mismatch %d != %d != %d (frame %d - %d)\n",
- __func__, masklay_shape_a->tot_vert, masklay_shape_b->tot_vert, tot,
- masklay_shape_a->frame, masklay_shape_b->frame);
+ CLOG_ERROR(&LOG, "vert mismatch %d != %d != %d (frame %d - %d)",
+ masklay_shape_a->tot_vert, masklay_shape_b->tot_vert, tot,
+ masklay_shape_a->frame, masklay_shape_b->frame);
}
}
@@ -1805,8 +1802,8 @@ void BKE_mask_layer_shape_changed_add(MaskLayer *masklay, int index,
masklay_shape->data = data_resized;
}
else {
- printf("%s: vert mismatch %d != %d (frame %d)\n",
- __func__, masklay_shape->tot_vert, tot, masklay_shape->frame);
+ CLOG_ERROR(&LOG, "vert mismatch %d != %d (frame %d)",
+ masklay_shape->tot_vert, tot, masklay_shape->frame);
}
}
}
@@ -1846,8 +1843,8 @@ void BKE_mask_layer_shape_changed_remove(MaskLayer *masklay, int index, int coun
masklay_shape->data = data_resized;
}
else {
- printf("%s: vert mismatch %d != %d (frame %d)\n",
- __func__, masklay_shape->tot_vert - count, tot, masklay_shape->frame);
+ CLOG_ERROR(&LOG, "vert mismatch %d != %d (frame %d)",
+ masklay_shape->tot_vert - count, tot, masklay_shape->frame);
}
}
}
diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c
index 55939f8eadf..4237943717e 100644
--- a/source/blender/blenkernel/intern/mask_evaluate.c
+++ b/source/blender/blenkernel/intern/mask_evaluate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mask_evaluate.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Functions for evaluating the mask beziers into points for the outline and feather.
*/
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index ecdd30edc36..a1405f1243c 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mask_rasterize.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* This module exposes a rasterizer that works as a black box - implementation details are confined to this file,
*
@@ -36,8 +29,6 @@
*
* This file is admittedly a bit confusticated, in quite few areas speed was chosen over readability,
* though it is commented - so shouldn't be so hard to see what's going on.
- *
- *
* Implementation:
*
* To rasterize the mask its converted into geometry that use a ray-cast for each pixel lookup.
@@ -57,8 +48,6 @@
* - initializing the spacial structure doesn't need to be as optimized as pixel lookups are.
* - mask lookups need not be pixel aligned so any sub-pixel values from x/y (0 - 1), can be found.
* (perhaps masks can be used as a vector texture in 3D later on)
- *
- *
* Currently, to build the spacial structure we have to calculate the total number of faces ahead of time.
*
* This is getting a bit complicated with the addition of unfilled splines and end capping -
@@ -68,6 +57,8 @@
* - Campbell
*/
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "DNA_vec_types.h"
@@ -121,6 +112,8 @@
# define FACE_ASSERT(face, vert_max)
#endif
+static CLG_LogRef LOG = {"bke.mask_rasterize"};
+
static void rotate_point_v2(float r_p[2], const float p[2], const float cent[2], const float angle, const float asp[2])
{
const float s = sinf(angle);
@@ -1401,6 +1394,7 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
value = fabsf(value - value_layer);
break;
default: /* same as add */
+ CLOG_ERROR(&LOG, "unhandled blend type: %d", layer->blend);
BLI_assert(0);
value += value_layer;
break;
@@ -1465,7 +1459,7 @@ void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle,
.x_px_ofs = x_inv * 0.5f,
.y_px_ofs = y_inv * 0.5f,
.width = width,
- .buffer = buffer
+ .buffer = buffer,
};
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 7e59d31571b..d821052f2f4 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/material.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -34,6 +26,8 @@
#include <math.h>
#include <stddef.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
@@ -53,19 +47,15 @@
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
-#include "BLI_string.h"
#include "BLI_array_utils.h"
#include "BKE_animsys.h"
#include "BKE_brush.h"
#include "BKE_displist.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_icons.h"
#include "BKE_image.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
@@ -83,6 +73,8 @@
/* used in UI and render */
Material defmaterial;
+static CLG_LogRef LOG = {"bke.material"};
+
/* called on startup, creator.c */
void init_def_material(void)
{
@@ -120,6 +112,7 @@ void BKE_material_init_gpencil_settings(Material *ma)
MaterialGPencilStyle *gp_style = ma->gp_style;
/* set basic settings */
gp_style->stroke_rgba[3] = 1.0f;
+ gp_style->fill_rgba[3] = 1.0f;
gp_style->pattern_gridsize = 0.1f;
gp_style->gradient_radius = 0.5f;
ARRAY_SET_ITEMS(gp_style->mix_rgba, 1.0f, 1.0f, 1.0f, 0.2f);
@@ -129,7 +122,6 @@ void BKE_material_init_gpencil_settings(Material *ma)
gp_style->texture_pixsize = 100.0f;
gp_style->flag |= GP_STYLE_STROKE_SHOW;
- gp_style->flag |= GP_STYLE_FILL_SHOW;
}
}
@@ -139,12 +131,11 @@ void BKE_material_init(Material *ma)
ma->r = ma->g = ma->b = 0.8;
ma->specr = ma->specg = ma->specb = 1.0;
- // ma->alpha = 1.0; /* DEPRECATED */
+ ma->a = 1.0f;
ma->spec = 0.5;
ma->roughness = 0.25f;
- ma->pr_lamp = 3; /* two lamps, is bits */
ma->pr_type = MA_SPHERE;
ma->preview = NULL;
@@ -181,7 +172,7 @@ Material *BKE_material_add_gpencil(Main *bmain, const char *name)
/**
* Only copy internal data of Material ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -192,7 +183,7 @@ void BKE_material_copy_data(Main *bmain, Material *ma_dst, const Material *ma_sr
if (ma_src->nodetree) {
/* Note: nodetree is *not* in bmain, however this specific case is handled at lower level
* (see BKE_libblock_copy_ex()). */
- BKE_id_copy_ex(bmain, (ID *)ma_src->nodetree, (ID **)&ma_dst->nodetree, flag, false);
+ BKE_id_copy_ex(bmain, (ID *)ma_src->nodetree, (ID **)&ma_dst->nodetree, flag);
}
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
@@ -218,7 +209,7 @@ void BKE_material_copy_data(Main *bmain, Material *ma_dst, const Material *ma_sr
Material *BKE_material_copy(Main *bmain, const Material *ma)
{
Material *ma_copy;
- BKE_id_copy_ex(bmain, &ma->id, (ID **)&ma_copy, 0, false);
+ BKE_id_copy(bmain, &ma->id, (ID **)&ma_copy);
return ma_copy;
}
@@ -528,7 +519,7 @@ Material **give_current_material_p(Object *ob, short act)
return NULL;
else if (act <= 0) {
if (act < 0) {
- printf("Negative material index!\n");
+ CLOG_ERROR(&LOG, "Negative material index!");
}
return NULL;
}
@@ -654,7 +645,7 @@ void test_all_objects_materials(Main *bmain, ID *id)
}
BKE_main_lock(bmain);
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->data == id) {
BKE_material_resize_object(bmain, ob, *totcol, false);
}
@@ -942,7 +933,7 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
/* this should never happen and used to crash */
if (ob->actcol <= 0) {
- printf("%s: invalid material index %d, report a bug!\n", __func__, ob->actcol);
+ CLOG_ERROR(&LOG, "invalid material index %d, report a bug!", ob->actcol);
BLI_assert(0);
return false;
}
@@ -981,7 +972,7 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
actcol = ob->actcol;
- for (Object *obt = bmain->object.first; obt; obt = obt->id.next) {
+ for (Object *obt = bmain->objects.first; obt; obt = obt->id.next) {
if (obt->data == ob->data) {
/* Can happen when object material lists are used, see: T52953 */
if (actcol > obt->totcol) {
@@ -1047,7 +1038,7 @@ static int count_texture_nodes_recursive(bNodeTree *nodetree)
if (node->typeinfo->nclass == NODE_CLASS_TEXTURE && node->typeinfo->type == SH_NODE_TEX_IMAGE && node->id) {
tex_nodes++;
}
- else if (node->type == NODE_GROUP) {
+ else if (node->type == NODE_GROUP && node->id) {
/* recurse into the node group and see if it contains any textures */
tex_nodes += count_texture_nodes_recursive((bNodeTree *)node->id);
}
@@ -1063,7 +1054,9 @@ static void fill_texpaint_slots_recursive(bNodeTree *nodetree, bNode *active_nod
if (active_node == node) {
ma->paint_active_slot = *index;
}
+
ma->texpaintslot[*index].ima = (Image *)node->id;
+ ma->texpaintslot[*index].interp = ((NodeTexImage *)node->storage)->interpolation;
/* for new renderer, we need to traverse the treeback in search of a UV node */
bNode *uvnode = nodetree_uv_node_recursive(node);
@@ -1080,7 +1073,7 @@ static void fill_texpaint_slots_recursive(bNodeTree *nodetree, bNode *active_nod
}
(*index)++;
}
- else if (node->type == NODE_GROUP) {
+ else if (node->type == NODE_GROUP && node->id) {
/* recurse into the node group and see if it contains any textures */
fill_texpaint_slots_recursive((bNodeTree *)node->id, active_node, ma, index);
}
@@ -1095,6 +1088,9 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma)
if (!ma)
return;
+ /* COW needed when adding texture slot on an object with no materials. */
+ DEG_id_tag_update(&ma->id, ID_RECALC_SHADING | ID_RECALC_COPY_ON_WRITE);
+
if (ma->texpaintslot) {
MEM_freeN(ma->texpaintslot);
ma->tot_slots = 0;
@@ -1397,7 +1393,10 @@ void copy_matcopybuf(Main *bmain, Material *ma)
memcpy(&matcopybuf, ma, sizeof(Material));
- matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, bmain, false);
+ if (ma->nodetree != NULL) {
+ matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, bmain, false);
+ }
+
matcopybuf.preview = NULL;
BLI_listbase_clear(&matcopybuf.gpumaterial);
/* TODO Duplicate Engine Settings and set runtime to NULL */
@@ -1423,7 +1422,9 @@ void paste_matcopybuf(Main *bmain, Material *ma)
memcpy(ma, &matcopybuf, sizeof(Material));
(ma->id) = id;
- ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false);
+ if (matcopybuf.nodetree != NULL) {
+ ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false);
+ }
}
void BKE_material_eval(struct Depsgraph *depsgraph, Material *material)
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index cff425dbd1b..ae5cbcc4f49 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,11 +15,6 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Jiri Hnidek <jiri.hnidek@vslib.cz>.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* MetaBalls are created from a single Object (with a name without number in it),
* here the DispList and BoundBox also is located.
* All objects with the same name (but with a number in it) are added to this.
@@ -29,8 +22,8 @@
* texture coordinates are patched within the displist
*/
-/** \file blender/blenkernel/intern/mball.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdio.h>
@@ -52,20 +45,19 @@
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_animsys.h"
#include "BKE_curve.h"
#include "BKE_scene.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_displist.h"
#include "BKE_mball.h"
#include "BKE_object.h"
#include "BKE_material.h"
+#include "DEG_depsgraph.h"
+
/* Functions */
/** Free (or release) any data used by this mball (does not free the mball itself). */
@@ -106,7 +98,7 @@ MetaBall *BKE_mball_add(Main *bmain, const char *name)
/**
* Only copy internal data of MetaBall ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -126,7 +118,7 @@ void BKE_mball_copy_data(Main *UNUSED(bmain), MetaBall *mb_dst, const MetaBall *
MetaBall *BKE_mball_copy(Main *bmain, const MetaBall *mb)
{
MetaBall *mb_copy;
- BKE_id_copy_ex(bmain, &mb->id, (ID **)&mb_copy, 0, false);
+ BKE_id_copy(bmain, &mb->id, (ID **)&mb_copy);
return mb_copy;
}
@@ -197,8 +189,10 @@ void BKE_mball_texspace_calc(Object *ob)
int tot;
bool do_it = false;
- if (ob->bb == NULL) ob->bb = MEM_callocN(sizeof(BoundBox), "mb boundbox");
- bb = ob->bb;
+ if (ob->runtime.bb == NULL) {
+ ob->runtime.bb = MEM_callocN(sizeof(BoundBox), "mb boundbox");
+ }
+ bb = ob->runtime.bb;
/* Weird one, this. */
/* INIT_MINMAX(min, max); */
@@ -233,8 +227,8 @@ BoundBox *BKE_mball_boundbox_get(Object *ob)
{
BLI_assert(ob->type == OB_MBALL);
- if (ob->bb != NULL && (ob->bb->flag & BOUNDBOX_DIRTY) == 0) {
- return ob->bb;
+ if (ob->runtime.bb != NULL && (ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) {
+ return ob->runtime.bb;
}
/* This should always only be called with evaluated objects, but currently RNA is a problem here... */
@@ -242,7 +236,7 @@ BoundBox *BKE_mball_boundbox_get(Object *ob)
BKE_mball_texspace_calc(ob);
}
- return ob->bb;
+ return ob->runtime.bb;
}
float *BKE_mball_make_orco(Object *ob, ListBase *dispbase)
@@ -254,7 +248,7 @@ float *BKE_mball_make_orco(Object *ob, ListBase *dispbase)
int a;
/* restore size and loc */
- bb = ob->bb;
+ bb = ob->runtime.bb;
loc[0] = (bb->vec[0][0] + bb->vec[4][0]) / 2.0f;
size[0] = bb->vec[4][0] - loc[0];
loc[1] = (bb->vec[0][1] + bb->vec[2][1]) / 2.0f;
@@ -396,6 +390,7 @@ void BKE_mball_properties_copy(Scene *scene, Object *active_object)
mb->rendersize = active_mball->rendersize;
mb->thresh = active_mball->thresh;
mb->flag = active_mball->flag;
+ DEG_id_tag_update(&mb->id, 0);
}
}
}
@@ -422,7 +417,7 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis)
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
Object *ob = base->object;
- if ((ob->type == OB_MBALL) && !(base->flag & BASE_FROMDUPLI)) {
+ if ((ob->type == OB_MBALL) && !(base->flag & BASE_FROM_DUPLI)) {
if (ob != bob) {
BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.');
diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c
index 5525c41c9dd..df62d8b1041 100644
--- a/source/blender/blenkernel/intern/mball_tessellate.c
+++ b/source/blender/blenkernel/intern/mball_tessellate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Jiri Hnidek <jiri.hnidek@vslib.cz>.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mball_tessellate.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdio.h>
@@ -49,7 +43,6 @@
#include "BKE_global.h"
#include "BKE_displist.h"
-#include "BKE_main.h"
#include "BKE_mball_tessellate.h" /* own include */
#include "BKE_scene.h"
@@ -467,17 +460,17 @@ static char faces[256];
/* edge: LB, LT, LN, LF, RB, RT, RN, RF, BN, BF, TN, TF */
static int corner1[12] = {
- LBN, LTN, LBN, LBF, RBN, RTN, RBN, RBF, LBN, LBF, LTN, LTF
+ LBN, LTN, LBN, LBF, RBN, RTN, RBN, RBF, LBN, LBF, LTN, LTF,
};
static int corner2[12] = {
- LBF, LTF, LTN, LTF, RBF, RTF, RTN, RTF, RBN, RBF, RTN, RTF
+ LBF, LTF, LTN, LTF, RBF, RTF, RTN, RTF, RBN, RBF, RTN, RTF,
};
static int leftface[12] = {
- B, L, L, F, R, T, N, R, N, B, T, F
+ B, L, L, F, R, T, N, R, N, B, T, F,
};
/* face on left when going corner1 to corner2 */
static int rightface[12] = {
- L, T, N, L, B, R, R, F, B, F, N, T
+ L, T, N, L, B, R, R, F, B, F, N, T,
};
/* face on right when going corner1 to corner2 */
@@ -1256,9 +1249,9 @@ void BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob, ListBa
/* don't polygonize metaballs with too high resolution (base mball to small)
* note: Eps was 0.0001f but this was giving problems for blood animation for durian, using 0.00001f */
- if (ob->size[0] > 0.00001f * (process.allbb.max[0] - process.allbb.min[0]) ||
- ob->size[1] > 0.00001f * (process.allbb.max[1] - process.allbb.min[1]) ||
- ob->size[2] > 0.00001f * (process.allbb.max[2] - process.allbb.min[2]))
+ if (ob->scale[0] > 0.00001f * (process.allbb.max[0] - process.allbb.min[0]) ||
+ ob->scale[1] > 0.00001f * (process.allbb.max[1] - process.allbb.min[1]) ||
+ ob->scale[2] > 0.00001f * (process.allbb.max[2] - process.allbb.min[2]))
{
polygonize(&process);
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 121aba43456..592f3a26a12 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mesh.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
@@ -68,7 +62,7 @@ enum {
MESHCMP_POLYMISMATCH,
MESHCMP_EDGEUNKNOWN,
MESHCMP_VERTCOMISMATCH,
- MESHCMP_CDLAYERS_MISMATCH
+ MESHCMP_CDLAYERS_MISMATCH,
};
static const char *cmpcode_to_str(int code)
@@ -337,7 +331,7 @@ static void mesh_ensure_tessellation_customdata(Mesh *me)
void BKE_mesh_ensure_skin_customdata(Mesh *me)
{
- BMesh *bm = me->edit_btmesh ? me->edit_btmesh->bm : NULL;
+ BMesh *bm = me->edit_mesh ? me->edit_mesh->bm : NULL;
MVertSkin *vs;
if (bm) {
@@ -376,7 +370,7 @@ void BKE_mesh_ensure_skin_customdata(Mesh *me)
bool BKE_mesh_ensure_facemap_customdata(struct Mesh *me)
{
- BMesh *bm = me->edit_btmesh ? me->edit_btmesh->bm : NULL;
+ BMesh *bm = me->edit_mesh ? me->edit_mesh->bm : NULL;
bool changed = false;
if (bm) {
if (!CustomData_has_layer(&bm->pdata, CD_FACEMAP)) {
@@ -400,7 +394,7 @@ bool BKE_mesh_ensure_facemap_customdata(struct Mesh *me)
bool BKE_mesh_clear_facemap_customdata(struct Mesh *me)
{
- BMesh *bm = me->edit_btmesh ? me->edit_btmesh->bm : NULL;
+ BMesh *bm = me->edit_mesh ? me->edit_mesh->bm : NULL;
bool changed = false;
if (bm) {
if (CustomData_has_layer(&bm->pdata, CD_FACEMAP)) {
@@ -454,8 +448,8 @@ void BKE_mesh_update_customdata_pointers(Mesh *me, const bool do_ensure_tess_cd)
bool BKE_mesh_has_custom_loop_normals(Mesh *me)
{
- if (me->edit_btmesh) {
- return CustomData_has_layer(&me->edit_btmesh->bm->ldata, CD_CUSTOMLOOPNORMAL);
+ if (me->edit_mesh) {
+ return CustomData_has_layer(&me->edit_mesh->bm->ldata, CD_CUSTOMLOOPNORMAL);
}
else {
return CustomData_has_layer(&me->ldata, CD_CUSTOMLOOPNORMAL);
@@ -478,7 +472,7 @@ void BKE_mesh_free(Mesh *me)
MEM_SAFE_FREE(me->mat);
MEM_SAFE_FREE(me->bb);
MEM_SAFE_FREE(me->mselect);
- MEM_SAFE_FREE(me->edit_btmesh);
+ MEM_SAFE_FREE(me->edit_mesh);
}
static void mesh_tessface_clear_intern(Mesh *mesh, int free_customdata)
@@ -524,7 +518,7 @@ Mesh *BKE_mesh_add(Main *bmain, const char *name)
/**
* Only copy internal data of Mesh ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -532,23 +526,31 @@ Mesh *BKE_mesh_add(Main *bmain, const char *name)
*/
void BKE_mesh_copy_data(Main *bmain, Mesh *me_dst, const Mesh *me_src, const int flag)
{
+ BKE_mesh_runtime_reset_on_copy(me_dst, flag);
+ if ((me_src->id.tag & LIB_TAG_NO_MAIN) == 0) {
+ /* This is a direct copy of a main mesh, so for now it has the same topology. */
+ me_dst->runtime.deformed_only = true;
+ }
+ /* XXX WHAT? Why? Comment, please! And pretty sure this is not valid for regular Mesh copying? */
+ me_dst->runtime.is_original = false;
+
const bool do_tessface = ((me_src->totface != 0) && (me_src->totpoly == 0)); /* only do tessface if we have no polys */
- CustomDataMask mask = CD_MASK_MESH;
+ CustomData_MeshMasks mask = CD_MASK_MESH;
if (me_src->id.tag & LIB_TAG_NO_MAIN) {
/* For copies in depsgraph, keep data like origindex and orco. */
- mask |= CD_MASK_DERIVEDMESH;
+ CustomData_MeshMasks_update(&mask, &CD_MASK_DERIVEDMESH);
}
me_dst->mat = MEM_dupallocN(me_src->mat);
const eCDAllocType alloc_type = (flag & LIB_ID_COPY_CD_REFERENCE) ? CD_REFERENCE : CD_DUPLICATE;
- CustomData_copy(&me_src->vdata, &me_dst->vdata, mask, alloc_type, me_dst->totvert);
- CustomData_copy(&me_src->edata, &me_dst->edata, mask, alloc_type, me_dst->totedge);
- CustomData_copy(&me_src->ldata, &me_dst->ldata, mask, alloc_type, me_dst->totloop);
- CustomData_copy(&me_src->pdata, &me_dst->pdata, mask, alloc_type, me_dst->totpoly);
+ CustomData_copy(&me_src->vdata, &me_dst->vdata, mask.vmask, alloc_type, me_dst->totvert);
+ CustomData_copy(&me_src->edata, &me_dst->edata, mask.emask, alloc_type, me_dst->totedge);
+ CustomData_copy(&me_src->ldata, &me_dst->ldata, mask.lmask, alloc_type, me_dst->totloop);
+ CustomData_copy(&me_src->pdata, &me_dst->pdata, mask.pmask, alloc_type, me_dst->totpoly);
if (do_tessface) {
- CustomData_copy(&me_src->fdata, &me_dst->fdata, mask, alloc_type, me_dst->totface);
+ CustomData_copy(&me_src->fdata, &me_dst->fdata, mask.fmask, alloc_type, me_dst->totface);
}
else {
mesh_tessface_clear_intern(me_dst, false);
@@ -556,29 +558,14 @@ void BKE_mesh_copy_data(Main *bmain, Mesh *me_dst, const Mesh *me_src, const int
BKE_mesh_update_customdata_pointers(me_dst, do_tessface);
- me_dst->edit_btmesh = NULL;
-
- /* Call BKE_mesh_runtime_reset? */
- me_dst->runtime.batch_cache = NULL;
- me_dst->runtime.looptris.array = NULL;
- me_dst->runtime.bvh_cache = NULL;
- me_dst->runtime.shrinkwrap_data = NULL;
-
- if (me_src->id.tag & LIB_TAG_NO_MAIN) {
- me_dst->runtime.deformed_only = me_src->runtime.deformed_only;
- }
- else {
- /* This is a direct copy of a main mesh, so for now it has the same topology. */
- me_dst->runtime.deformed_only = 1;
- }
- me_dst->runtime.is_original = false;
+ me_dst->edit_mesh = NULL;
me_dst->mselect = MEM_dupallocN(me_dst->mselect);
me_dst->bb = MEM_dupallocN(me_dst->bb);
/* TODO Do we want to add flag to prevent this? */
if (me_src->key && (flag & LIB_ID_COPY_SHAPEKEY)) {
- BKE_id_copy_ex(bmain, &me_src->key->id, (ID **)&me_dst->key, flag, false);
+ BKE_id_copy_ex(bmain, &me_src->key->id, (ID **)&me_dst->key, flag);
}
}
@@ -615,9 +602,7 @@ Mesh *BKE_mesh_new_nomain(int verts_len, int edges_len, int tessface_len, int lo
Mesh *mesh = BKE_libblock_alloc(
NULL, ID_ME,
BKE_idcode_to_name(ID_ME),
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG);
+ LIB_ID_COPY_LOCALIZE);
BKE_libblock_init_empty(&mesh->id);
/* don't use CustomData_reset(...); because we dont want to touch customdata */
@@ -644,7 +629,7 @@ static Mesh *mesh_new_nomain_from_template_ex(
const Mesh *me_src,
int verts_len, int edges_len, int tessface_len,
int loops_len, int polys_len,
- CustomDataMask mask)
+ CustomData_MeshMasks mask)
{
/* Only do tessface if we are creating tessfaces or copying from mesh with only tessfaces. */
const bool do_tessface = (tessface_len ||
@@ -663,12 +648,12 @@ static Mesh *mesh_new_nomain_from_template_ex(
me_dst->cd_flag = me_src->cd_flag;
- CustomData_copy(&me_src->vdata, &me_dst->vdata, mask, CD_CALLOC, verts_len);
- CustomData_copy(&me_src->edata, &me_dst->edata, mask, CD_CALLOC, edges_len);
- CustomData_copy(&me_src->ldata, &me_dst->ldata, mask, CD_CALLOC, loops_len);
- CustomData_copy(&me_src->pdata, &me_dst->pdata, mask, CD_CALLOC, polys_len);
+ CustomData_copy(&me_src->vdata, &me_dst->vdata, mask.vmask, CD_CALLOC, verts_len);
+ CustomData_copy(&me_src->edata, &me_dst->edata, mask.emask, CD_CALLOC, edges_len);
+ CustomData_copy(&me_src->ldata, &me_dst->ldata, mask.lmask, CD_CALLOC, loops_len);
+ CustomData_copy(&me_src->pdata, &me_dst->pdata, mask.pmask, CD_CALLOC, polys_len);
if (do_tessface) {
- CustomData_copy(&me_src->fdata, &me_dst->fdata, mask, CD_CALLOC, tessface_len);
+ CustomData_copy(&me_src->fdata, &me_dst->fdata, mask.fmask, CD_CALLOC, tessface_len);
}
else {
mesh_tessface_clear_intern(me_dst, false);
@@ -697,24 +682,21 @@ Mesh *BKE_mesh_new_nomain_from_template(
Mesh *BKE_mesh_copy_for_eval(struct Mesh *source, bool reference)
{
- int flags = (LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW);
+ int flags = LIB_ID_COPY_LOCALIZE;
if (reference) {
flags |= LIB_ID_COPY_CD_REFERENCE;
}
Mesh *result;
- BKE_id_copy_ex(NULL, &source->id, (ID **)&result, flags, false);
+ BKE_id_copy_ex(NULL, &source->id, (ID **)&result, flags);
return result;
}
Mesh *BKE_mesh_copy(Main *bmain, const Mesh *me)
{
Mesh *me_copy;
- BKE_id_copy_ex(bmain, &me->id, (ID **)&me_copy, LIB_ID_COPY_SHAPEKEY, false);
+ BKE_id_copy(bmain, &me->id, (ID **)&me_copy);
return me_copy;
}
@@ -754,7 +736,7 @@ Mesh *BKE_mesh_from_bmesh_nomain(BMesh *bm, const struct BMeshToMeshParams *para
return mesh;
}
-Mesh *BKE_mesh_from_bmesh_for_eval_nomain(BMesh *bm, const int64_t cd_mask_extra)
+Mesh *BKE_mesh_from_bmesh_for_eval_nomain(BMesh *bm, const CustomData_MeshMasks *cd_mask_extra)
{
Mesh *mesh = BKE_id_new_nomain(ID_ME, NULL);
BM_mesh_bm_to_me_for_eval(bm, mesh, cd_mask_extra);
@@ -765,7 +747,7 @@ Mesh *BKE_mesh_from_bmesh_for_eval_nomain(BMesh *bm, const int64_t cd_mask_extra
* TODO(campbell): support mesh with only an edit-mesh which is lazy initialized.
*/
Mesh *BKE_mesh_from_editmesh_with_coords_thin_wrap(
- BMEditMesh *em, CustomDataMask data_mask, float (*vertexCos)[3])
+ BMEditMesh *em, const CustomData_MeshMasks *data_mask, float (*vertexCos)[3])
{
Mesh *me = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, data_mask);
/* Use editmesh directly where possible. */
@@ -791,8 +773,8 @@ bool BKE_mesh_uv_cdlayer_rename_index(
CustomData *ldata, *fdata;
CustomDataLayer *cdlu, *cdlf;
- if (me->edit_btmesh) {
- ldata = &me->edit_btmesh->bm->ldata;
+ if (me->edit_mesh) {
+ ldata = &me->edit_mesh->bm->ldata;
fdata = NULL; /* No tessellated data in BMesh! */
}
else {
@@ -824,8 +806,8 @@ bool BKE_mesh_uv_cdlayer_rename_index(
bool BKE_mesh_uv_cdlayer_rename(Mesh *me, const char *old_name, const char *new_name, bool do_tessface)
{
CustomData *ldata, *fdata;
- if (me->edit_btmesh) {
- ldata = &me->edit_btmesh->bm->ldata;
+ if (me->edit_mesh) {
+ ldata = &me->edit_mesh->bm->ldata;
/* No tessellated data in BMesh! */
fdata = NULL;
do_tessface = false;
@@ -916,7 +898,7 @@ void BKE_mesh_texspace_calc(Mesh *me)
BoundBox *BKE_mesh_boundbox_get(Object *ob)
{
/* This is Object-level data access, DO NOT touch to Mesh's bb, would be totally thread-unsafe. */
- if (ob->bb == NULL || ob->bb->flag & BOUNDBOX_DIRTY) {
+ if (ob->runtime.bb == NULL || ob->runtime.bb->flag & BOUNDBOX_DIRTY) {
Mesh *me = ob->data;
float min[3], max[3];
@@ -926,14 +908,14 @@ BoundBox *BKE_mesh_boundbox_get(Object *ob)
max[0] = max[1] = max[2] = 1.0f;
}
- if (ob->bb == NULL) {
- ob->bb = MEM_mallocN(sizeof(*ob->bb), __func__);
+ if (ob->runtime.bb == NULL) {
+ ob->runtime.bb = MEM_mallocN(sizeof(*ob->runtime.bb), __func__);
}
- BKE_boundbox_init_from_minmax(ob->bb, min, max);
- ob->bb->flag &= ~BOUNDBOX_DIRTY;
+ BKE_boundbox_init_from_minmax(ob->runtime.bb, min, max);
+ ob->runtime.bb->flag &= ~BOUNDBOX_DIRTY;
}
- return ob->bb;
+ return ob->runtime.bb;
}
BoundBox *BKE_mesh_texspace_get(Mesh *me, float r_loc[3], float r_rot[3], float r_size[3])
@@ -1164,8 +1146,8 @@ void BKE_mesh_material_remap(Mesh *me, const unsigned int *remap, unsigned int r
n = remap[n]; \
} ((void)0)
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
BMIter iter;
BMFace *efa;
@@ -1566,8 +1548,8 @@ void BKE_mesh_mselect_active_set(Mesh *me, int index, int type)
void BKE_mesh_count_selected_items(const Mesh *mesh, int r_count[3])
{
r_count[0] = r_count[1] = r_count[2] = 0;
- if (mesh->edit_btmesh) {
- BMesh *bm = mesh->edit_btmesh->bm;
+ if (mesh->edit_mesh) {
+ BMesh *bm = mesh->edit_mesh->bm;
r_count[0] = bm->totvertsel;
r_count[1] = bm->totedgesel;
r_count[2] = bm->totfacesel;
@@ -1932,8 +1914,8 @@ void BKE_mesh_eval_geometry(
DEG_debug_print_eval(depsgraph, __func__, mesh->id.name, mesh);
if (mesh->bb == NULL || (mesh->bb->flag & BOUNDBOX_DIRTY)) {
BKE_mesh_texspace_calc(mesh);
- /* Clear autospace flag in evaluated mesh, so that texspace does not get recomputed when bbox is
- * (e.g. after modifiers, etc.) */
- mesh->texflag &= ~ME_AUTOSPACE;
}
+ /* Clear autospace flag in evaluated mesh, so that texspace does not get recomputed when bbox is
+ * (e.g. after modifiers, etc.) */
+ mesh->texflag &= ~ME_AUTOSPACE;
}
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index 995a67e6659..83a20758ab3 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mesh_convert.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
+#include "CLG_log.h"
#include "MEM_guardedalloc.h"
@@ -40,7 +37,6 @@
#include "BKE_main.h"
#include "BKE_DerivedMesh.h"
-#include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
@@ -68,6 +64,8 @@
# define ASSERT_IS_VALID_MESH(mesh)
#endif
+static CLG_LogRef LOG = {"bke.mesh_convert"};
+
void BKE_mesh_from_metaball(ListBase *lb, Mesh *me)
{
DispList *dl;
@@ -594,7 +592,7 @@ void BKE_mesh_from_nurbs_displist(
else {
me = BKE_mesh_add(bmain, obdata_name);
ob->runtime.mesh_eval = NULL;
- BKE_mesh_nomain_to_mesh(me_eval, me, ob, CD_MASK_MESH, false);
+ BKE_mesh_nomain_to_mesh(me_eval, me, ob, &CD_MASK_MESH, false);
}
me->totcol = cu->totcol;
@@ -616,12 +614,12 @@ void BKE_mesh_from_nurbs_displist(
cu->mat = NULL;
cu->totcol = 0;
- /* Do not decrement ob->data usercount here, it's done at end of func with BKE_libblock_free_us() call. */
+ /* Do not decrement ob->data usercount here, it's done at end of func with BKE_id_free_us() call. */
ob->data = me;
ob->type = OB_MESH;
/* other users */
- ob1 = bmain->object.first;
+ ob1 = bmain->objects.first;
while (ob1) {
if (ob1->data == cu) {
ob1->type = OB_MESH;
@@ -637,11 +635,10 @@ void BKE_mesh_from_nurbs_displist(
/* For temporary objects in BKE_mesh_new_from_object don't remap
* the entire scene with associated depsgraph updates, which are
* problematic for renderers exporting data. */
- id_us_min(&cu->id);
- BKE_libblock_free(bmain, cu);
+ BKE_id_free(NULL, cu);
}
else {
- BKE_libblock_free_us(bmain, cu);
+ BKE_id_free_us(bmain, cu);
}
}
@@ -820,7 +817,7 @@ void BKE_mesh_to_curve(Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene),
/* make new mesh data from the original copy */
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_MESH);
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_MESH);
ListBase nurblist = {NULL, NULL};
BKE_mesh_to_curve_nurblist(me_eval, &nurblist, 0);
@@ -864,8 +861,7 @@ Mesh *BKE_mesh_new_from_object(
/* copies object and modifiers (but not the data) */
Object *tmpobj;
- /* TODO: make it temp copy outside bmain! */
- BKE_id_copy_ex(bmain, &ob->id, (ID **)&tmpobj, LIB_ID_COPY_CACHES | LIB_ID_CREATE_NO_DEG_TAG, false);
+ BKE_id_copy_ex(NULL, &ob->id, (ID **)&tmpobj, LIB_ID_COPY_LOCALIZE);
tmpcu = (Curve *)tmpobj->data;
/* Copy cached display list, it might be needed by the stack evaluation.
@@ -883,10 +879,10 @@ Mesh *BKE_mesh_new_from_object(
/* if getting the original caged mesh, delete object modifiers */
if (cage)
- BKE_object_free_modifiers(tmpobj, 0);
+ BKE_object_free_modifiers(tmpobj, LIB_ID_CREATE_NO_USER_REFCOUNT);
- /* copies the data */
- BKE_id_copy_ex(bmain, ob->data, (ID **)&copycu, LIB_ID_CREATE_NO_DEG_TAG, false);
+ /* copies the data, but *not* the shapekeys. */
+ BKE_id_copy_ex(NULL, ob->data, (ID **)&copycu, LIB_ID_COPY_LOCALIZE);
tmpobj->data = copycu;
/* make sure texture space is calculated for a copy of curve,
@@ -901,7 +897,9 @@ Mesh *BKE_mesh_new_from_object(
copycu->editnurb = tmpcu->editnurb;
/* get updated display list, and convert to a mesh */
- BKE_displist_make_curveTypes_forRender(depsgraph, sce, tmpobj, &dispbase, &me_eval_final, false, render);
+ BKE_displist_make_curveTypes_forRender(
+ depsgraph, sce, tmpobj, &dispbase, &me_eval_final, false, render,
+ NULL);
copycu->editfont = NULL;
copycu->editnurb = NULL;
@@ -911,8 +909,11 @@ Mesh *BKE_mesh_new_from_object(
/* convert object type to mesh */
uv_from_orco = (tmpcu->flag & CU_UV_ORCO) != 0;
BKE_mesh_from_nurbs_displist(bmain, tmpobj, &dispbase, uv_from_orco, tmpcu->id.name + 2, true);
+ /* Function above also frees copycu (aka tmpobj->data), make this obvious here. */
+ copycu = NULL;
tmpmesh = tmpobj->data;
+ id_us_min(&tmpmesh->id); /* Gets one user from its creation in BKE_mesh_from_nurbs_displist(). */
BKE_displist_free(&dispbase);
@@ -920,11 +921,11 @@ Mesh *BKE_mesh_new_from_object(
* if it didn't the curve did not have any segments or otherwise
* would have generated an empty mesh */
if (tmpobj->type != OB_MESH) {
- BKE_libblock_free(bmain, tmpobj);
+ BKE_id_free(NULL, tmpobj);
return NULL;
}
- BKE_libblock_free(bmain, tmpobj);
+ BKE_id_free(NULL, tmpobj);
/* XXX The curve to mesh conversion is convoluted... But essentially, BKE_mesh_from_nurbs_displist()
* already transfers the ownership of materials from the temp copy of the Curve ID to the new
@@ -970,9 +971,9 @@ Mesh *BKE_mesh_new_from_object(
case OB_MESH:
/* copies object and modifiers (but not the data) */
if (cage) {
- /* copies the data */
+ /* copies the data (but *not* the shapekeys). */
Mesh *mesh = ob->data;
- BKE_id_copy_ex(bmain, &mesh->id, (ID **)&tmpmesh, 0, false);
+ BKE_id_copy_ex(bmain, &mesh->id, (ID **)&tmpmesh, 0);
/* XXX BKE_mesh_copy() already handles materials usercount. */
do_mat_id_data_us = false;
}
@@ -980,22 +981,22 @@ Mesh *BKE_mesh_new_from_object(
else {
/* Make a dummy mesh, saves copying */
Mesh *me_eval;
- /* 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 */
+ CustomData_MeshMasks mask = CD_MASK_MESH; /* this seems more suitable, exporter,
+ * for example, needs CD_MASK_MDEFORMVERT */
- if (calc_undeformed)
- mask |= CD_MASK_ORCO;
+ if (calc_undeformed) {
+ mask.vmask |= CD_MASK_ORCO;
+ }
if (render) {
- me_eval = mesh_create_eval_final_render(depsgraph, sce, ob, mask);
+ me_eval = mesh_create_eval_final_render(depsgraph, sce, ob, &mask);
}
else {
- me_eval = mesh_create_eval_final_view(depsgraph, sce, ob, mask);
+ me_eval = mesh_create_eval_final_view(depsgraph, sce, ob, &mask);
}
tmpmesh = BKE_mesh_add(bmain, ((ID *)ob->data)->name + 2);
- BKE_mesh_nomain_to_mesh(me_eval, tmpmesh, ob, mask, true);
+ BKE_mesh_nomain_to_mesh(me_eval, tmpmesh, ob, &mask, true);
/* Copy autosmooth settings from original mesh. */
Mesh *me = (Mesh *)ob->data;
@@ -1088,9 +1089,8 @@ static void add_shapekey_layers(Mesh *mesh_dest, Mesh *mesh_src)
/* ensure we can use mesh vertex count for derived mesh custom data */
if (mesh_src->totvert != mesh_dest->totvert) {
- fprintf(stderr,
- "%s: vertex size mismatch (mesh/dm) '%s' (%d != %d)\n",
- __func__, mesh_src->id.name + 2, mesh_src->totvert, mesh_dest->totvert);
+ CLOG_ERROR(&LOG, "vertex size mismatch (mesh/dm) '%s' (%d != %d)",
+ mesh_src->id.name + 2, mesh_src->totvert, mesh_dest->totvert);
return;
}
@@ -1099,9 +1099,8 @@ static void add_shapekey_layers(Mesh *mesh_dest, Mesh *mesh_src)
float *array;
if (mesh_src->totvert != kb->totelem) {
- fprintf(stderr,
- "%s: vertex size mismatch (Mesh '%s':%d != KeyBlock '%s':%d)\n",
- __func__, mesh_src->id.name + 2, mesh_src->totvert, kb->name, kb->totelem);
+ CLOG_ERROR(&LOG, "vertex size mismatch (Mesh '%s':%d != KeyBlock '%s':%d)",
+ mesh_src->id.name + 2, mesh_src->totvert, kb->name, kb->totelem);
array = MEM_calloc_arrayN((size_t)mesh_src->totvert, 3 * sizeof(float), __func__);
}
else {
@@ -1144,13 +1143,7 @@ Mesh *BKE_mesh_create_derived_for_modifier(
float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts);
mti->deformVerts(md, &mectx, NULL, deformedVerts, numVerts);
- BKE_id_copy_ex(
- NULL, &me->id, (ID **)&result,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &me->id, (ID **)&result, LIB_ID_COPY_LOCALIZE);
BKE_mesh_apply_vert_coords(result, deformedVerts);
if (build_shapekey_layers)
@@ -1160,13 +1153,7 @@ Mesh *BKE_mesh_create_derived_for_modifier(
}
else {
Mesh *mesh_temp;
- BKE_id_copy_ex(
- NULL, &me->id, (ID **)&mesh_temp,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &me->id, (ID **)&mesh_temp, LIB_ID_COPY_LOCALIZE);
if (build_shapekey_layers)
add_shapekey_layers(mesh_temp, me);
@@ -1234,14 +1221,15 @@ static void shapekey_layers_to_keyblocks(Mesh *mesh_src, Mesh *mesh_dst, int act
kb->totelem = mesh_src->totvert;
kb->data = MEM_calloc_arrayN(kb->totelem, 3 * sizeof(float), __func__);
- fprintf(stderr, "%s: lost a shapekey layer: '%s'! (bmesh internal error)\n", __func__, kb->name);
+ CLOG_ERROR(&LOG, "lost a shapekey layer: '%s'! (bmesh internal error)", kb->name);
}
}
}
/* This is a Mesh-based copy of DM_to_mesh() */
-void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob, CustomDataMask mask, bool take_ownership)
+void BKE_mesh_nomain_to_mesh(
+ Mesh *mesh_src, Mesh *mesh_dst, Object *ob, const CustomData_MeshMasks *mask, bool take_ownership)
{
/* mesh_src might depend on mesh_dst, so we need to do everything with a local copy */
/* TODO(Sybren): the above claim came from DM_to_mesh(); check whether it is still true with Mesh */
@@ -1275,10 +1263,10 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob, CustomD
totpoly = tmp.totpoly = mesh_src->totpoly;
tmp.totface = 0;
- CustomData_copy(&mesh_src->vdata, &tmp.vdata, mask, alloctype, totvert);
- CustomData_copy(&mesh_src->edata, &tmp.edata, mask, alloctype, totedge);
- CustomData_copy(&mesh_src->ldata, &tmp.ldata, mask, alloctype, totloop);
- CustomData_copy(&mesh_src->pdata, &tmp.pdata, mask, alloctype, totpoly);
+ CustomData_copy(&mesh_src->vdata, &tmp.vdata, mask->vmask, alloctype, totvert);
+ CustomData_copy(&mesh_src->edata, &tmp.edata, mask->emask, alloctype, totedge);
+ CustomData_copy(&mesh_src->ldata, &tmp.ldata, mask->lmask, alloctype, totloop);
+ CustomData_copy(&mesh_src->pdata, &tmp.pdata, mask->pmask, alloctype, totpoly);
tmp.cd_flag = mesh_src->cd_flag;
tmp.runtime.deformed_only = mesh_src->runtime.deformed_only;
@@ -1292,8 +1280,7 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob, CustomD
uid = kb->uid;
}
else {
- printf("%s: error - could not find active shapekey %d!\n",
- __func__, ob->shapenr - 1);
+ CLOG_ERROR(&LOG, "could not find active shapekey %d!", ob->shapenr - 1);
uid = INT_MAX;
}
@@ -1363,7 +1350,7 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob, CustomD
* which should be fed through the modifier
* stack */
if (tmp.totvert != mesh_dst->totvert && !did_shapekeys && mesh_dst->key) {
- printf("%s: YEEK! this should be recoded! Shape key loss!: ID '%s'\n", __func__, tmp.id.name);
+ CLOG_ERROR(&LOG, "YEEK! this should be recoded! Shape key loss!: ID '%s'", tmp.id.name);
if (tmp.key && !(tmp.id.tag & LIB_TAG_NO_MAIN)) {
id_us_min(&tmp.key->id);
}
@@ -1384,10 +1371,10 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob, CustomD
if (take_ownership) {
if (alloctype == CD_ASSIGN) {
- CustomData_free_typemask(&mesh_src->vdata, mesh_src->totvert, ~mask);
- CustomData_free_typemask(&mesh_src->edata, mesh_src->totedge, ~mask);
- CustomData_free_typemask(&mesh_src->ldata, mesh_src->totloop, ~mask);
- CustomData_free_typemask(&mesh_src->pdata, mesh_src->totpoly, ~mask);
+ CustomData_free_typemask(&mesh_src->vdata, mesh_src->totvert, ~mask->vmask);
+ CustomData_free_typemask(&mesh_src->edata, mesh_src->totedge, ~mask->emask);
+ CustomData_free_typemask(&mesh_src->ldata, mesh_src->totloop, ~mask->lmask);
+ CustomData_free_typemask(&mesh_src->pdata, mesh_src->totpoly, ~mask->pmask);
}
BKE_id_free(NULL, mesh_src);
}
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index c5bcb72165e..a5338b3a6be 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,18 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mesh_evaluate.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Functions to evaluate mesh data.
*/
#include <limits.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
@@ -39,7 +35,6 @@
#include "BLI_utildefines.h"
#include "BLI_memarena.h"
-#include "BLI_mempool.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_bitmap.h"
@@ -68,8 +63,9 @@
# include "PIL_time_utildefines.h"
#endif
-/* -------------------------------------------------------------------- */
+static CLG_LogRef LOG = {"bke.mesh_evaluate"};
+/* -------------------------------------------------------------------- */
/** \name Mesh Normal Calculation
* \{ */
@@ -137,7 +133,7 @@ void BKE_mesh_calc_normals_mapping_ex(
/* if we are not calculating verts and no verts were passes then we have nothing to do */
if ((only_face_normals == true) && (r_polyNors == NULL) && (r_faceNors == NULL)) {
- printf("%s: called with nothing to do\n", __func__);
+ CLOG_WARN(&LOG, "called with nothing to do");
return;
}
@@ -170,7 +166,7 @@ void BKE_mesh_calc_normals_mapping_ex(
}
else {
/* eek, we're not corresponding to polys */
- printf("error in %s: tessellation face indices are incorrect. normals may look bad.\n", __func__);
+ CLOG_ERROR(&LOG, "tessellation face indices are incorrect. normals may look bad.");
}
}
}
@@ -324,7 +320,7 @@ void BKE_mesh_calc_normals_poly(
MeshCalcNormalsData data = {
.mpolys = mpolys, .mloop = mloop, .mverts = mverts,
- .pnors = pnors, .lnors_weighted = lnors_weighted, .vnors = vnors
+ .pnors = pnors, .lnors_weighted = lnors_weighted, .vnors = vnors,
};
/* Compute poly normals, and prepare weighted loop normals. */
@@ -1854,6 +1850,61 @@ void BKE_mesh_normals_loop_custom_from_vertices_set(
mpolys, polynors, numPolys, r_clnors_data, true);
}
+static void mesh_set_custom_normals(Mesh *mesh, float (*r_custom_nors)[3], const bool use_vertices)
+{
+ short (*clnors)[2];
+ const int numloops = mesh->totloop;
+
+ clnors = CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
+ if (clnors != NULL) {
+ memset(clnors, 0, sizeof(*clnors) * (size_t)numloops);
+ }
+ else {
+ clnors = CustomData_add_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL, CD_CALLOC, NULL, numloops);
+ }
+
+ float (*polynors)[3] = CustomData_get_layer(&mesh->pdata, CD_NORMAL);
+ bool free_polynors = false;
+ if (polynors == NULL) {
+ polynors = MEM_mallocN(sizeof(float[3]) * (size_t)mesh->totpoly, __func__);
+ BKE_mesh_calc_normals_poly(
+ mesh->mvert, NULL, mesh->totvert,
+ mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, polynors, false);
+ free_polynors = true;
+ }
+
+ mesh_normals_loop_custom_set(
+ mesh->mvert, mesh->totvert, mesh->medge, mesh->totedge, mesh->mloop, r_custom_nors, mesh->totloop,
+ mesh->mpoly, polynors, mesh->totpoly, clnors, use_vertices);
+
+ if (free_polynors) {
+ MEM_freeN(polynors);
+ }
+}
+
+/**
+ * Higher level functions hiding most of the code needed around call to #BKE_mesh_normals_loop_custom_set().
+ *
+ * \param r_custom_loopnors is not const, since code will replace zero_v3 normals there
+ * with automatically computed vectors.
+ */
+void BKE_mesh_set_custom_normals(Mesh *mesh, float (*r_custom_loopnors)[3])
+{
+ mesh_set_custom_normals(mesh, r_custom_loopnors, false);
+}
+
+/**
+ * Higher level functions hiding most of the code needed around call to #BKE_mesh_normals_loop_custom_from_vertices_set().
+ *
+ * \param r_custom_loopnors is not const, since code will replace zero_v3 normals there
+ * with automatically computed vectors.
+ */
+void BKE_mesh_set_custom_normals_from_vertices(Mesh *mesh, float (*r_custom_vertnors)[3])
+{
+ mesh_set_custom_normals(mesh, r_custom_vertnors, true);
+}
+
+
/**
* Computes average per-vertex normals from given custom loop normals.
*
@@ -1892,7 +1943,6 @@ void BKE_mesh_normals_loop_to_vertex(
/* -------------------------------------------------------------------- */
-
/** \name Polygon Calculations
* \{ */
@@ -1902,7 +1952,6 @@ void BKE_mesh_normals_loop_to_vertex(
* Computes the normal of a planar
* polygon See Graphics Gems for
* computing newell normal.
- *
*/
static void mesh_calc_ngon_normal(
const MPoly *mpoly, const MLoop *loopstart,
@@ -2223,7 +2272,6 @@ void BKE_mesh_poly_edgebitmap_insert(unsigned int *edge_bitmap, const MPoly *mp,
/* -------------------------------------------------------------------- */
-
/** \name Mesh Center Calculation
* \{ */
@@ -2325,7 +2373,6 @@ bool BKE_mesh_center_of_volume(const Mesh *me, float r_cent[3])
/* -------------------------------------------------------------------- */
-
/** \name Mesh Volume Calculation
* \{ */
@@ -2431,7 +2478,6 @@ void BKE_mesh_calc_volume(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name NGon Tessellation (NGon/Tessface Conversion)
* \{ */
@@ -3401,7 +3447,6 @@ void BKE_mesh_polygons_flip(
}
/* -------------------------------------------------------------------- */
-
/** \name Mesh Flag Flushing
* \{ */
@@ -3592,7 +3637,6 @@ void BKE_mesh_flush_select_from_verts(Mesh *me)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Mesh Spatial Calculation
* \{ */
diff --git a/source/blender/blenkernel/intern/mesh_iterators.c b/source/blender/blenkernel/intern/mesh_iterators.c
index 73dcd912f48..053e45cfe84 100644
--- a/source/blender/blenkernel/intern/mesh_iterators.c
+++ b/source/blender/blenkernel/intern/mesh_iterators.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mesh_iterators.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Functions for iterating mesh features.
*/
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c
index d8726644f48..312af598d98 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mesh_mapping.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Functions for accessing mesh connectivity data.
* eg: polys connected to verts, UV's connected to verts.
@@ -45,7 +39,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Mesh Connectivity Mapping
* \{ */
@@ -590,7 +583,6 @@ void BKE_mesh_origindex_map_create_looptri(
/* -------------------------------------------------------------------- */
-
/** \name Mesh loops/poly islands.
* Used currently for UVs and 'smooth groups'.
* \{ */
diff --git a/source/blender/blenkernel/intern/mesh_merge.c b/source/blender/blenkernel/intern/mesh_merge.c
index b88fd5d2a21..0866b52779e 100644
--- a/source/blender/blenkernel/intern/mesh_merge.c
+++ b/source/blender/blenkernel/intern/mesh_merge.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mesh_merge.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <string.h> // for memcpy
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index 85b09848a72..ccb6265b17a 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,18 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mesh_remap.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Functions for mapping data between meshes.
*/
#include <limits.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
@@ -49,9 +47,9 @@
#include "BLI_strict_flags.h"
+static CLG_LogRef LOG = {"bke.mesh"};
/* -------------------------------------------------------------------- */
-
/** \name Some generic helpers.
* \{ */
@@ -614,7 +612,7 @@ void BKE_mesh_remap_calc_verts_from_mesh(
MEM_freeN(weights);
}
else {
- printf("WARNING! Unsupported mesh-to-mesh vertex mapping mode (%d)!\n", mode);
+ CLOG_WARN(&LOG, "Unsupported mesh-to-mesh vertex mapping mode (%d)!", mode);
memset(r_map->items, 0, sizeof(*r_map->items) * (size_t)numverts_dst);
}
@@ -941,7 +939,7 @@ void BKE_mesh_remap_calc_edges_from_mesh(
MEM_freeN(weights);
}
else {
- printf("WARNING! Unsupported mesh-to-mesh edge mapping mode (%d)!\n", mode);
+ CLOG_WARN(&LOG, "Unsupported mesh-to-mesh edge mapping mode (%d)!", mode);
memset(r_map->items, 0, sizeof(*r_map->items) * (size_t)numedges_dst);
}
@@ -2214,7 +2212,7 @@ void BKE_mesh_remap_calc_polys_from_mesh(
BLI_rng_free(rng);
}
else {
- printf("WARNING! Unsupported mesh-to-mesh poly mapping mode (%d)!\n", mode);
+ CLOG_WARN(&LOG, "Unsupported mesh-to-mesh poly mapping mode (%d)!", mode);
memset(r_map->items, 0, sizeof(*r_map->items) * (size_t)numpolys_dst);
}
diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c
index 9e71f5f5156..2f845e32ee7 100644
--- a/source/blender/blenkernel/intern/mesh_runtime.c
+++ b/source/blender/blenkernel/intern/mesh_runtime.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mesh_runtime.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "atomic_ops.h"
@@ -63,9 +55,10 @@ void BKE_mesh_runtime_reset(Mesh *mesh)
/* Clear all pointers which we don't want to be shared on copying the datablock.
* However, keep all the flags which defines what the mesh is (for example, that
* it's deformed only, or that its custom data layers are out of date.) */
-void BKE_mesh_runtime_reset_on_copy(Mesh *mesh)
+void BKE_mesh_runtime_reset_on_copy(Mesh *mesh, const int UNUSED(flag))
{
Mesh_Runtime *runtime = &mesh->runtime;
+
runtime->edit_data = NULL;
runtime->batch_cache = NULL;
runtime->subdiv_ccg = NULL;
@@ -85,7 +78,7 @@ void BKE_mesh_runtime_clear_cache(Mesh *mesh)
/**
* Ensure the array is large enough
*
- * /note This function must always be thread-protected by caller. It should only be used by internal code.
+ * \note This function must always be thread-protected by caller. It should only be used by internal code.
*/
static void mesh_ensure_looptri_data(Mesh *mesh)
{
diff --git a/source/blender/blenkernel/intern/mesh_tangent.c b/source/blender/blenkernel/intern/mesh_tangent.c
index a222c681a5e..0bb399630b8 100644
--- a/source/blender/blenkernel/intern/mesh_tangent.c
+++ b/source/blender/blenkernel/intern/mesh_tangent.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mesh_tangent.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Functions to evaluate mesh tangents.
*/
@@ -38,11 +32,9 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
-#include "BLI_stack.h"
#include "BLI_task.h"
#include "BKE_customdata.h"
-#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_mesh_tangent.h"
#include "BKE_mesh_runtime.h"
@@ -55,7 +47,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Mesh Tangent Calculations (Single Layer)
* \{ */
@@ -204,7 +195,6 @@ void BKE_mesh_calc_loop_tangent_single(Mesh *mesh, const char *uvmap, float (*r_
/* -------------------------------------------------------------------- */
-
/** \name Mesh Tangent Calculations (All Layers)
* \{ */
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 421ecf264ee..a5aa198bc4e 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/mesh_validate.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -31,6 +27,8 @@
#include <string.h>
#include <limits.h>
+#include "CLG_log.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
@@ -42,6 +40,7 @@
#include "BLI_math_base.h"
#include "BLI_math_vector.h"
+#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
@@ -52,6 +51,7 @@
/* loop v/e are unsigned, so using max uint_32 value as invalid marker... */
#define INVALID_LOOP_EDGE_MARKER 4294967295u
+static CLG_LogRef LOG = {"bke.mesh"};
/** \name Internal functions
* \{ */
@@ -195,17 +195,15 @@ static int search_polyloop_cmp(const void *v1, const void *v2)
/* -------------------------------------------------------------------- */
-
/** \name Mesh Validation
* \{ */
-#define PRINT_MSG(...) (void) \
- ( \
- ((do_verbose) ? printf(__VA_ARGS__) : 0))
+#define PRINT_MSG(...) if(do_verbose) CLOG_INFO(&LOG, 1, __VA_ARGS__)
-#define PRINT_ERR(...) (void) \
- (is_valid = false, \
- ((do_verbose) ? printf(__VA_ARGS__) : 0))
+#define PRINT_ERR(...) do { \
+ is_valid = false; \
+ if (do_verbose) { CLOG_ERROR(&LOG, __VA_ARGS__); } \
+ } while(0)
/**
* Validate the mesh, \a do_fixes requires \a mesh to be non-null.
@@ -273,11 +271,11 @@ bool BKE_mesh_validate_arrays(
free_flag.as_flag = 0;
recalc_flag.as_flag = 0;
- PRINT_MSG("%s: verts(%u), edges(%u), loops(%u), polygons(%u)\n",
- __func__, totvert, totedge, totloop, totpoly);
+ PRINT_MSG("verts(%u), edges(%u), loops(%u), polygons(%u)",
+ totvert, totedge, totloop, totpoly);
if (totedge == 0 && totpoly != 0) {
- PRINT_ERR("\tLogical error, %u polygons and 0 edges\n", totpoly);
+ PRINT_ERR("\tLogical error, %u polygons and 0 edges", totpoly);
recalc_flag.edges = do_fixes;
}
@@ -286,7 +284,7 @@ bool BKE_mesh_validate_arrays(
for (j = 0; j < 3; j++) {
if (!isfinite(mv->co[j])) {
- PRINT_ERR("\tVertex %u: has invalid coordinate\n", i);
+ PRINT_ERR("\tVertex %u: has invalid coordinate", i);
if (do_fixes) {
zero_v3(mv->co);
@@ -300,7 +298,7 @@ bool BKE_mesh_validate_arrays(
}
if (fix_normal) {
- PRINT_ERR("\tVertex %u: has zero normal, assuming Z-up normal\n", i);
+ PRINT_ERR("\tVertex %u: has zero normal, assuming Z-up normal", i);
if (do_fixes) {
mv->no[2] = SHRT_MAX;
fix_flag.verts = true;
@@ -312,20 +310,20 @@ bool BKE_mesh_validate_arrays(
bool remove = false;
if (me->v1 == me->v2) {
- PRINT_ERR("\tEdge %u: has matching verts, both %u\n", i, me->v1);
+ PRINT_ERR("\tEdge %u: has matching verts, both %u", i, me->v1);
remove = do_fixes;
}
if (me->v1 >= totvert) {
- PRINT_ERR("\tEdge %u: v1 index out of range, %u\n", i, me->v1);
+ PRINT_ERR("\tEdge %u: v1 index out of range, %u", i, me->v1);
remove = do_fixes;
}
if (me->v2 >= totvert) {
- PRINT_ERR("\tEdge %u: v2 index out of range, %u\n", i, me->v2);
+ PRINT_ERR("\tEdge %u: v2 index out of range, %u", i, me->v2);
remove = do_fixes;
}
if ((me->v1 != me->v2) && BLI_edgehash_haskey(edge_hash, me->v1, me->v2)) {
- PRINT_ERR("\tEdge %u: is a duplicate of %d\n", i,
+ PRINT_ERR("\tEdge %u: is a duplicate of %d", i,
POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, me->v1, me->v2)));
remove = do_fixes;
}
@@ -344,13 +342,13 @@ bool BKE_mesh_validate_arrays(
# define REMOVE_FACE_TAG(_mf) { _mf->v3 = 0; free_flag.faces = do_fixes; } (void)0
# define CHECK_FACE_VERT_INDEX(a, b) \
if (mf->a == mf->b) { \
- PRINT_ERR(" face %u: verts invalid, " STRINGIFY(a) "/" STRINGIFY(b) " both %u\n", i, mf->a); \
+ PRINT_ERR(" face %u: verts invalid, " STRINGIFY(a) "/" STRINGIFY(b) " both %u", i, mf->a); \
remove = do_fixes; \
} (void)0
# define CHECK_FACE_EDGE(a, b) \
if (!BLI_edgehash_haskey(edge_hash, mf->a, mf->b)) { \
PRINT_ERR(" face %u: edge " STRINGIFY(a) "/" STRINGIFY(b) \
- " (%u,%u) is missing edge data\n", i, mf->a, mf->b); \
+ " (%u,%u) is missing edge data", i, mf->a, mf->b); \
recalc_flag.edges = do_fixes; \
} (void)0
@@ -362,7 +360,7 @@ bool BKE_mesh_validate_arrays(
SortFace *sf_prev;
unsigned int totsortface = 0;
- PRINT_ERR("No Polys, only tessellated Faces\n");
+ PRINT_ERR("No Polys, only tessellated Faces");
for (i = 0, mf = mfaces, sf = sort_faces; i < totface; i++, mf++) {
bool remove = false;
@@ -373,7 +371,7 @@ bool BKE_mesh_validate_arrays(
do {
fv[fidx] = *(&(mf->v1) + fidx);
if (fv[fidx] >= totvert) {
- PRINT_ERR("\tFace %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]);
+ PRINT_ERR("\tFace %u: 'v%d' index out of range, %u", i, fidx + 1, fv[fidx]);
remove = do_fixes;
}
} while (fidx--);
@@ -450,12 +448,12 @@ bool BKE_mesh_validate_arrays(
mf_prev = mfaces + sf_prev->index;
if (mf->v4) {
- PRINT_ERR("\tFace %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n",
+ PRINT_ERR("\tFace %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)",
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);
}
else {
- PRINT_ERR("\tFace %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n",
+ PRINT_ERR("\tFace %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)",
sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3,
mf_prev->v1, mf_prev->v2, mf_prev->v3);
}
@@ -503,13 +501,13 @@ bool BKE_mesh_validate_arrays(
if (mp->loopstart < 0 || mp->totloop < 3) {
/* Invalid loop data. */
- PRINT_ERR("\tPoly %u is invalid (loopstart: %d, totloop: %d)\n",
+ PRINT_ERR("\tPoly %u is invalid (loopstart: %d, totloop: %d)",
sp->index, mp->loopstart, mp->totloop);
sp->invalid = true;
}
else if (mp->loopstart + mp->totloop > totloop) {
/* Invalid loop data. */
- PRINT_ERR("\tPoly %u uses loops out of range (loopstart: %d, loopend: %d, max nbr of loops: %u)\n",
+ PRINT_ERR("\tPoly %u uses loops out of range (loopstart: %d, loopend: %d, max nbr of loops: %u)",
sp->index, mp->loopstart, mp->loopstart + mp->totloop - 1, totloop - 1);
sp->invalid = true;
}
@@ -533,11 +531,11 @@ bool BKE_mesh_validate_arrays(
for (j = 0, ml = &mloops[sp->loopstart]; j < mp->totloop; j++, ml++, v++) {
if (ml->v >= totvert) {
/* Invalid vert idx. */
- PRINT_ERR("\tLoop %u has invalid vert reference (%u)\n", sp->loopstart + j, ml->v);
+ PRINT_ERR("\tLoop %u has invalid vert reference (%u)", sp->loopstart + j, ml->v);
sp->invalid = true;
}
else if (mverts[ml->v].flag & ME_VERT_TMP_TAG) {
- PRINT_ERR("\tPoly %u has duplicated vert reference at corner (%u)\n", i, j);
+ PRINT_ERR("\tPoly %u has duplicated vert reference at corner (%u)", i, j);
sp->invalid = true;
}
else {
@@ -555,7 +553,7 @@ bool BKE_mesh_validate_arrays(
v2 = mloops[sp->loopstart + (j + 1) % mp->totloop].v;
if (!BLI_edgehash_haskey(edge_hash, v1, v2)) {
/* Edge not existing. */
- PRINT_ERR("\tPoly %u needs missing edge (%d, %d)\n", sp->index, v1, v2);
+ PRINT_ERR("\tPoly %u needs missing edge (%d, %d)", sp->index, v1, v2);
if (do_fixes)
recalc_flag.edges = true;
else
@@ -568,11 +566,11 @@ bool BKE_mesh_validate_arrays(
int prev_e = ml->e;
ml->e = POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, v1, v2));
fix_flag.loops_edge = true;
- PRINT_ERR("\tLoop %u has invalid edge reference (%d), fixed using edge %u\n",
+ PRINT_ERR("\tLoop %u has invalid edge reference (%d), fixed using edge %u",
sp->loopstart + j, prev_e, ml->e);
}
else {
- PRINT_ERR("\tLoop %u has invalid edge reference (%u)\n", sp->loopstart + j, ml->e);
+ PRINT_ERR("\tLoop %u has invalid edge reference (%u)", sp->loopstart + j, ml->e);
sp->invalid = true;
}
}
@@ -585,11 +583,11 @@ bool BKE_mesh_validate_arrays(
int prev_e = ml->e;
ml->e = POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, v1, v2));
fix_flag.loops_edge = true;
- PRINT_ERR("\tPoly %u has invalid edge reference (%d, is_removed: %d), fixed using edge %u\n",
+ PRINT_ERR("\tPoly %u has invalid edge reference (%d, is_removed: %d), fixed using edge %u",
sp->index, prev_e, IS_REMOVED_EDGE(me), ml->e);
}
else {
- PRINT_ERR("\tPoly %u has invalid edge reference (%u)\n", sp->index, ml->e);
+ PRINT_ERR("\tPoly %u has invalid edge reference (%u)", sp->index, ml->e);
sp->invalid = true;
}
}
@@ -620,11 +618,12 @@ bool BKE_mesh_validate_arrays(
/* Test same polys. */
if ((p1_nv == p2_nv) && (memcmp(p1_v, p2_v, p1_nv * sizeof(*p1_v)) == 0)) {
if (do_verbose) {
+ // TODO: convert list to string
PRINT_ERR("\tPolys %u and %u use same vertices (%d",
prev_sp->index, sp->index, *p1_v);
for (j = 1; j < p1_nv; j++)
PRINT_ERR(", %d", p1_v[j]);
- PRINT_ERR("), considering poly %u as invalid.\n", sp->index);
+ PRINT_ERR("), considering poly %u as invalid.", sp->index);
}
else {
is_valid = false;
@@ -662,7 +661,7 @@ bool BKE_mesh_validate_arrays(
/* Unused loops. */
if (prev_end < sp->loopstart) {
for (j = prev_end, ml = &mloops[prev_end]; j < sp->loopstart; j++, ml++) {
- PRINT_ERR("\tLoop %u is unused.\n", j);
+ PRINT_ERR("\tLoop %u is unused.", j);
if (do_fixes)
REMOVE_LOOP_TAG(ml);
}
@@ -671,7 +670,7 @@ bool BKE_mesh_validate_arrays(
}
/* Multi-used loops. */
else if (prev_end > sp->loopstart) {
- PRINT_ERR("\tPolys %u and %u share loops from %d to %d, considering poly %u as invalid.\n",
+ PRINT_ERR("\tPolys %u and %u share loops from %d to %d, considering poly %u as invalid.",
prev_sp->index, sp->index, sp->loopstart, prev_end, sp->index);
if (do_fixes) {
REMOVE_POLY_TAG((&mpolys[sp->index]));
@@ -690,7 +689,7 @@ bool BKE_mesh_validate_arrays(
/* 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_ERR("\tLoop %u is unused.\n", j);
+ PRINT_ERR("\tLoop %u is unused.", j);
if (do_fixes)
REMOVE_LOOP_TAG(ml);
}
@@ -710,14 +709,14 @@ bool BKE_mesh_validate_arrays(
for (j = 0, dw = dv->dw; j < dv->totweight; j++, dw++) {
/* note, greater than max defgroups is accounted for in our code, but not < 0 */
if (!isfinite(dw->weight)) {
- PRINT_ERR("\tVertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
+ PRINT_ERR("\tVertex deform %u, group %d has weight: %f", i, dw->def_nr, dw->weight);
if (do_fixes) {
dw->weight = 0.0f;
fix_flag.verts_weight = true;
}
}
else if (dw->weight < 0.0f || dw->weight > 1.0f) {
- PRINT_ERR("\tVertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
+ PRINT_ERR("\tVertex deform %u, group %d has weight: %f", i, dw->def_nr, dw->weight);
if (do_fixes) {
CLAMP(dw->weight, 0.0f, 1.0f);
fix_flag.verts_weight = true;
@@ -725,7 +724,7 @@ bool BKE_mesh_validate_arrays(
}
if (dw->def_nr < 0) {
- PRINT_ERR("\tVertex deform %u, has invalid group %d\n", i, dw->def_nr);
+ PRINT_ERR("\tVertex deform %u, has invalid group %d", i, dw->def_nr);
if (do_fixes) {
defvert_remove_group(dv, dw);
fix_flag.verts_weight = true;
@@ -890,12 +889,15 @@ bool BKE_mesh_validate_all_customdata(
bool is_valid = true;
bool is_change_v, is_change_e, is_change_l, is_change_p;
int tot_uvloop, tot_vcolloop;
- CustomDataMask mask = check_meshmask ? CD_MASK_MESH : 0;
+ CustomData_MeshMasks mask = {0};
+ if (check_meshmask) {
+ mask = CD_MASK_MESH;
+ }
- is_valid &= mesh_validate_customdata(vdata, mask, totvert, do_verbose, do_fixes, &is_change_v);
- is_valid &= mesh_validate_customdata(edata, mask, totedge, do_verbose, do_fixes, &is_change_e);
- is_valid &= mesh_validate_customdata(ldata, mask, totloop, do_verbose, do_fixes, &is_change_l);
- is_valid &= mesh_validate_customdata(pdata, mask, totpoly, do_verbose, do_fixes, &is_change_p);
+ is_valid &= mesh_validate_customdata(vdata, mask.vmask, totvert, do_verbose, do_fixes, &is_change_v);
+ is_valid &= mesh_validate_customdata(edata, mask.emask, totedge, do_verbose, do_fixes, &is_change_e);
+ is_valid &= mesh_validate_customdata(ldata, mask.lmask, totloop, do_verbose, do_fixes, &is_change_l);
+ is_valid &= mesh_validate_customdata(pdata, mask.pmask, totpoly, do_verbose, do_fixes, &is_change_p);
tot_uvloop = CustomData_number_of_layers(ldata, CD_MLOOPUV);
tot_vcolloop = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
@@ -934,7 +936,7 @@ bool BKE_mesh_validate(Mesh *me, const bool do_verbose, const bool cddata_check_
bool changed;
if (do_verbose) {
- printf("MESH: %s\n", me->id.name + 2);
+ CLOG_INFO(&LOG, 0, "MESH: %s", me->id.name + 2);
}
is_valid &= BKE_mesh_validate_all_customdata(
@@ -1037,7 +1039,6 @@ bool BKE_mesh_validate_material_indices(Mesh *me)
/* -------------------------------------------------------------------- */
-
/** \name Mesh Stripping (removing invalid data)
* \{ */
@@ -1176,7 +1177,6 @@ void BKE_mesh_strip_loose_edges(Mesh *me)
/* -------------------------------------------------------------------- */
-
/** \name Mesh Edge Calculation
* \{ */
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index f7a2efbe618..189bd8623c4 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,13 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Modifier stack implementation.
*
* BKE_modifier.h contains the function prototypes for this file.
- *
*/
-/** \file blender/blenkernel/intern/modifier.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
@@ -80,6 +68,9 @@
#include "MOD_modifiertypes.h"
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"bke.modifier"};
static ModifierTypeInfo *modifier_types[NUM_MODIFIER_TYPES] = {NULL};
static VirtualModifierData virtualModifierCommonData;
@@ -392,6 +383,7 @@ void modifier_setError(ModifierData *md, const char *_format, ...)
md->error = BLI_strdup(buffer);
+ CLOG_STR_ERROR(&LOG, md->error);
}
/* used for buttons, to find out if the 'draw deformed in editmode' option is
@@ -486,8 +478,8 @@ bool modifier_isEnabled(const struct Scene *scene, ModifierData *md, int require
}
CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData *md,
- CustomDataMask dataMask, int required_mode,
- ModifierData *previewmd, CustomDataMask previewmask)
+ const CustomData_MeshMasks *dataMask, int required_mode,
+ ModifierData *previewmd, const CustomData_MeshMasks *previewmask)
{
CDMaskLink *dataMasks = NULL;
CDMaskLink *curr, *prev;
@@ -500,10 +492,10 @@ CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierDat
if (modifier_isEnabled(scene, md, required_mode)) {
if (mti->requiredDataMask)
- curr->mask = mti->requiredDataMask(ob, md);
+ mti->requiredDataMask(ob, md, &curr->mask);
- if (previewmd == md) {
- curr->mask |= previewmask;
+ if (previewmd == md && previewmask != NULL) {
+ CustomData_MeshMasks_update(&curr->mask, previewmask);
}
}
@@ -520,15 +512,10 @@ CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierDat
*/
for (curr = dataMasks, prev = NULL; curr; prev = curr, curr = curr->next) {
if (prev) {
- CustomDataMask prev_mask = prev->mask;
- CustomDataMask curr_mask = curr->mask;
-
- curr->mask = curr_mask | prev_mask;
+ CustomData_MeshMasks_update(&curr->mask, &prev->mask);
}
else {
- CustomDataMask curr_mask = curr->mask;
-
- curr->mask = curr_mask | dataMask;
+ CustomData_MeshMasks_update(&curr->mask, dataMask);
}
}
@@ -885,13 +872,13 @@ struct DerivedMesh *modifier_applyModifier_DM_deprecated(
Mesh *mesh = NULL;
if (dm != NULL) {
mesh = BKE_id_new_nomain(ID_ME, NULL);
- DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
+ DM_to_mesh(dm, mesh, ctx->object, &CD_MASK_EVERYTHING, false);
}
struct Mesh *new_mesh = mti->applyModifier(md, ctx, mesh);
/* Make a DM that doesn't reference new_mesh so we can free the latter. */
- DerivedMesh *ndm = CDDM_from_mesh_ex(new_mesh, CD_DUPLICATE, CD_MASK_EVERYTHING);
+ DerivedMesh *ndm = CDDM_from_mesh_ex(new_mesh, CD_DUPLICATE, &CD_MASK_EVERYTHING);
if (new_mesh != mesh) {
BKE_id_free(NULL, new_mesh);
@@ -908,23 +895,24 @@ struct DerivedMesh *modifier_applyModifier_DM_deprecated(
* Get evaluated mesh for other evaluated object, which is used as an operand for the modifier,
* e.g. second operand for boolean modifier.
* Note that modifiers in stack always get fully evaluated COW ID pointers, never original ones. Makes things simpler.
+ *
+ * \param get_cage_mesh Return evaluated mesh with only deforming modifiers applied
+ * (i.e. mesh topology remains the same as original one, a.k.a. 'cage' mesh).
*/
-Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(Object *ob_eval, bool *r_free_mesh)
+Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(Object *ob_eval, const bool get_cage_mesh)
{
Mesh *me = NULL;
if ((ob_eval->type == OB_MESH) && (ob_eval->mode & OB_MODE_EDIT)) {
- /* Note: currently we have no equivalent to derived cagemesh or even final dm in BMEditMesh...
- * This is TODO in core depsgraph/modifier stack code still. */
+ /* In EditMode, evaluated mesh is stored in BMEditMesh, not the object... */
BMEditMesh *em = BKE_editmesh_from_object(ob_eval);
if (em != NULL) { /* em might not exist yet in some cases, just after loading a .blend file, see T57878. */
- me = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, 0);
- *r_free_mesh = true;
+ me = (get_cage_mesh && em->mesh_eval_cage != NULL) ? em->mesh_eval_cage : em->mesh_eval_final;
}
}
if (me == NULL) {
- me = ob_eval->runtime.mesh_eval;
- *r_free_mesh = false;
+ me = (get_cage_mesh && ob_eval->runtime.mesh_deform_eval != NULL) ? ob_eval->runtime.mesh_deform_eval :
+ ob_eval->runtime.mesh_eval;
}
return me;
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 7d279342093..bfa4c4ba068 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/movieclip.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -62,7 +55,6 @@
#include "BKE_animsys.h"
#include "BKE_colortools.h"
#include "BKE_library.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_movieclip.h"
#include "BKE_node.h"
@@ -205,6 +197,94 @@ static void get_proxy_fname(const MovieClip *clip,
strcat(name, ".jpg");
}
+#ifdef WITH_OPENEXR
+
+typedef struct MultilayerConvertContext {
+ float *combined_pass;
+ int num_combined_channels;
+} MultilayerConvertContext;
+
+static void *movieclip_convert_multilayer_add_view(
+ void *UNUSED(ctx_v),
+ const char *UNUSED(view_name))
+{
+ return NULL;
+}
+
+static void *movieclip_convert_multilayer_add_layer(
+ void *ctx_v,
+ const char *UNUSED(layer_name))
+{
+ /* Return dummy non-NULL value, we don't use layer handle but need to return
+ * something, so render API invokes the add_pass() callbacks. */
+ return ctx_v;
+}
+
+static void movieclip_convert_multilayer_add_pass(
+ void *UNUSED(layer),
+ void *ctx_v,
+ const char *pass_name,
+ float *rect,
+ int num_channels,
+ const char *chan_id,
+ const char *UNUSED(view_name))
+{
+ /* NOTE: This function must free pass pixels data if it is not used, this
+ * is how IMB_exr_multilayer_convert() is working. */
+ MultilayerConvertContext *ctx = ctx_v;
+ /* If we've found a first combined pass, skip all the rest ones. */
+ if (ctx->combined_pass != NULL) {
+ MEM_freeN(rect);
+ return;
+ }
+ if (STREQ(pass_name, RE_PASSNAME_COMBINED) ||
+ STREQ(chan_id, "RGBA") ||
+ STREQ(chan_id, "RGB"))
+ {
+ ctx->combined_pass = rect;
+ ctx->num_combined_channels = num_channels;
+ }
+ else {
+ MEM_freeN(rect);
+ }
+}
+
+#endif /* WITH_OPENEXR */
+
+/* Will try to make image buffer usable when originating from the multi-layer
+ * source.
+ * Internally finds a first combined pass and uses that as a buffer. Not ideal,
+ * but is better than a complete empty buffer. */
+void BKE_movieclip_convert_multilayer_ibuf(struct ImBuf *ibuf)
+{
+ if (ibuf == NULL) {
+ return;
+ }
+#ifdef WITH_OPENEXR
+ if (ibuf->ftype != IMB_FTYPE_OPENEXR || ibuf->userdata == NULL) {
+ return;
+ }
+ MultilayerConvertContext ctx;
+ ctx.combined_pass = NULL;
+ ctx.num_combined_channels = 0;
+ IMB_exr_multilayer_convert(
+ ibuf->userdata,
+ &ctx,
+ movieclip_convert_multilayer_add_view,
+ movieclip_convert_multilayer_add_layer,
+ movieclip_convert_multilayer_add_pass);
+ if (ctx.combined_pass != NULL) {
+ BLI_assert(ibuf->rect_float == NULL);
+ ibuf->rect_float = ctx.combined_pass;
+ ibuf->channels = ctx.num_combined_channels;
+ ibuf->flags |= IB_rectfloat;
+ ibuf->mall |= IB_rectfloat;
+ }
+ IMB_exr_close(ibuf->userdata);
+ ibuf->userdata = NULL;
+#endif
+}
+
static ImBuf *movieclip_load_sequence_file(MovieClip *clip,
const MovieClipUser *user,
int framenr,
@@ -242,15 +322,7 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip,
/* read ibuf */
ibuf = IMB_loadiffname(name, loadflag, colorspace);
-
-#ifdef WITH_OPENEXR
- if (ibuf) {
- if (ibuf->ftype == IMB_FTYPE_OPENEXR && ibuf->userdata) {
- IMB_exr_close(ibuf->userdata);
- ibuf->userdata = NULL;
- }
- }
-#endif
+ BKE_movieclip_convert_multilayer_ibuf(ibuf);
return ibuf;
}
@@ -693,7 +765,7 @@ MovieClip *BKE_movieclip_file_add_exists_ex(Main *bmain, const char *filepath, b
BLI_path_abs(str, BKE_main_blendfile_path(bmain));
/* first search an identical filepath */
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
BLI_strncpy(strtest, clip->name, sizeof(clip->name));
BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &clip->id));
@@ -947,10 +1019,7 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip,
(user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL);
if (clip->source == MCLIP_SRC_SEQUENCE || use_sequence) {
- ibuf = movieclip_load_sequence_file(clip,
- user,
- framenr,
- flag);
+ ibuf = movieclip_load_sequence_file(clip, user, framenr, flag);
}
else {
ibuf = movieclip_load_movie_file(clip, user, framenr, flag);
@@ -1301,7 +1370,7 @@ void BKE_movieclip_reload(Main *bmain, MovieClip *clip)
*/
{
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->nodetree) {
nodeUpdateID(scene->nodetree, &clip->id);
}
@@ -1510,7 +1579,7 @@ void BKE_movieclip_free(MovieClip *clip)
/**
* Only copy internal data of MovieClip ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -1533,7 +1602,7 @@ void BKE_movieclip_copy_data(Main *UNUSED(bmain), MovieClip *clip_dst, const Mov
MovieClip *BKE_movieclip_copy(Main *bmain, const MovieClip *clip)
{
MovieClip *clip_copy;
- BKE_id_copy_ex(bmain, &clip->id, (ID **)&clip_copy, 0, false);
+ BKE_id_copy(bmain, &clip->id, (ID **)&clip_copy);
return clip_copy;
}
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index d2f307362e6..774fde0af7d 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/multires.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -49,7 +41,6 @@
#include "BKE_pbvh.h"
#include "BKE_ccg.h"
#include "BKE_cdderivedmesh.h"
-#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_runtime.h"
@@ -89,8 +80,8 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
void multires_customdata_delete(Mesh *me)
{
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
/* 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 */
@@ -289,11 +280,12 @@ Mesh *BKE_multires_create_mesh(
Object *ob)
{
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- Mesh *deformed_mesh = mesh_get_eval_deform(depsgraph, scene, ob_eval, CD_MASK_BAREMESH);
+ Mesh *deformed_mesh = mesh_get_eval_deform(depsgraph, scene, ob_eval, &CD_MASK_BAREMESH);
ModifierEvalContext modifier_ctx = {
- .depsgraph = depsgraph,
- .object = ob_eval,
- .flag = MOD_APPLY_USECACHE | MOD_APPLY_IGNORE_SIMPLIFY};
+ .depsgraph = depsgraph,
+ .object = ob_eval,
+ .flag = MOD_APPLY_USECACHE | MOD_APPLY_IGNORE_SIMPLIFY,
+ };
const ModifierTypeInfo *mti = modifierType_getInfo(mmd->modifier.type);
Mesh *result = mti->applyModifier(&mmd->modifier, &modifier_ctx, deformed_mesh);
@@ -478,8 +470,8 @@ void multiresModifier_set_levels_from_disps(MultiresModifierData *mmd, Object *o
Mesh *me = ob->data;
MDisps *mdisp;
- if (me->edit_btmesh)
- mdisp = CustomData_get_layer(&me->edit_btmesh->bm->ldata, CD_MDISPS);
+ if (me->edit_mesh)
+ mdisp = CustomData_get_layer(&me->edit_mesh->bm->ldata, CD_MDISPS);
else
mdisp = CustomData_get_layer(&me->ldata, CD_MDISPS);
@@ -678,10 +670,12 @@ void multiresModifier_del_levels(MultiresModifierData *mmd, Scene *scene, Object
multires_set_tot_level(ob, mmd, lvl);
}
-static DerivedMesh *multires_dm_create_local(Scene *scene, Object *ob, DerivedMesh *dm, int lvl, int totlvl, int simple, bool alloc_paint_mask)
+static DerivedMesh *multires_dm_create_local(
+ Scene *scene, Object *ob, DerivedMesh *dm,
+ int lvl, int totlvl, int simple, bool alloc_paint_mask,
+ int flags)
{
MultiresModifierData mmd = {{NULL}};
- MultiresFlags flags = MULTIRES_USE_LOCAL_MMD;
mmd.lvl = lvl;
mmd.sculptlvl = lvl;
@@ -689,6 +683,7 @@ static DerivedMesh *multires_dm_create_local(Scene *scene, Object *ob, DerivedMe
mmd.totlvl = totlvl;
mmd.simple = simple;
+ flags |= MULTIRES_USE_LOCAL_MMD;
if (alloc_paint_mask)
flags |= MULTIRES_ALLOC_PAINT_MASK;
@@ -699,10 +694,10 @@ static DerivedMesh *subsurf_dm_create_local(
Scene *scene, Object *ob, DerivedMesh *dm,
int lvl,
bool is_simple, bool is_optimal, bool is_plain_uv, bool alloc_paint_mask,
- bool for_render)
+ bool for_render,
+ SubsurfFlags flags)
{
SubsurfModifierData smd = {{NULL}};
- SubsurfFlags flags = 0;
smd.levels = smd.renderLevels = lvl;
smd.quality = 3;
@@ -764,8 +759,8 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Scene *scene, Object
/* generate highest level with displacements */
cddm = CDDM_from_mesh(me);
- DM_set_only_copy(cddm, CD_MASK_BAREMESH);
- dispdm = multires_dm_create_local(scene, ob, cddm, totlvl, totlvl, 0, 0);
+ DM_set_only_copy(cddm, &CD_MASK_BAREMESH);
+ dispdm = multires_dm_create_local(scene, ob, cddm, totlvl, totlvl, 0, 0, MULTIRES_IGNORE_SIMPLIFY);
cddm->release(cddm);
/* copy the new locations of the base verts into the mesh */
@@ -860,8 +855,10 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Scene *scene, Object
/* subdivide the mesh to highest level without displacements */
cddm = CDDM_from_mesh(me);
- DM_set_only_copy(cddm, CD_MASK_BAREMESH);
- origdm = subsurf_dm_create_local(scene, ob, cddm, totlvl, 0, 0, mmd->uv_smooth == SUBSURF_UV_SMOOTH_NONE, 0, false);
+ DM_set_only_copy(cddm, &CD_MASK_BAREMESH);
+ origdm = subsurf_dm_create_local(
+ scene, ob, cddm, totlvl, 0, 0, mmd->uv_smooth == SUBSURF_UV_SMOOTH_NONE,
+ 0, false, SUBSURF_IGNORE_SIMPLIFY);
cddm->release(cddm);
/* calc disps */
@@ -901,12 +898,14 @@ static void multires_subdivide(
/* create subsurf DM from original mesh at high level */
cddm = CDDM_from_mesh(me);
- DM_set_only_copy(cddm, CD_MASK_BAREMESH);
- highdm = subsurf_dm_create_local(scene, ob, cddm, totlvl, simple, 0, mmd->uv_smooth == SUBSURF_UV_SMOOTH_NONE, has_mask, false);
+ DM_set_only_copy(cddm, &CD_MASK_BAREMESH);
+ highdm = subsurf_dm_create_local(
+ NULL, ob, cddm, totlvl, simple, 0, mmd->uv_smooth == SUBSURF_UV_SMOOTH_NONE,
+ has_mask, false, SUBSURF_IGNORE_SIMPLIFY);
ss = ((CCGDerivedMesh *)highdm)->ss;
/* create multires DM from original mesh at low level */
- lowdm = multires_dm_create_local(scene, ob, cddm, lvl, lvl, simple, has_mask);
+ lowdm = multires_dm_create_local(scene, ob, cddm, lvl, lvl, simple, has_mask, MULTIRES_IGNORE_SIMPLIFY);
BLI_assert(lowdm != cddm);
cddm->release(cddm);
@@ -1180,7 +1179,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
.gridOffset = gridOffset,
.gridSize = gridSize,
.dGridSize = dGridSize,
- .dSkip = dSkip
+ .dSkip = dSkip,
};
BLI_task_parallel_range(0, totpoly, &data, multires_disp_run_cb, &settings);
@@ -1221,13 +1220,15 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm, Scene *scene)
/* create subsurf DM from original mesh at high level */
if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform);
else cddm = CDDM_from_mesh(me);
- DM_set_only_copy(cddm, CD_MASK_BAREMESH);
+ DM_set_only_copy(cddm, &CD_MASK_BAREMESH);
- highdm = subsurf_dm_create_local(scene, ob, cddm, totlvl, mmd->simple, 0, mmd->uv_smooth == SUBSURF_UV_SMOOTH_NONE, has_mask, false);
+ highdm = subsurf_dm_create_local(
+ scene, ob, cddm, totlvl, mmd->simple, 0, mmd->uv_smooth == SUBSURF_UV_SMOOTH_NONE,
+ has_mask, false, SUBSURF_IGNORE_SIMPLIFY);
ss = ((CCGDerivedMesh *)highdm)->ss;
/* create multires DM from original mesh and displacements */
- lowdm = multires_dm_create_local(scene, ob, cddm, lvl, totlvl, mmd->simple, has_mask);
+ lowdm = multires_dm_create_local(scene, ob, cddm, lvl, totlvl, mmd->simple, has_mask, MULTIRES_IGNORE_SIMPLIFY);
cddm->release(cddm);
/* gather grid data */
@@ -1283,9 +1284,11 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm, Scene *scene)
if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform);
else cddm = CDDM_from_mesh(me);
- DM_set_only_copy(cddm, CD_MASK_BAREMESH);
+ DM_set_only_copy(cddm, &CD_MASK_BAREMESH);
- subdm = subsurf_dm_create_local(scene, ob, cddm, mmd->totlvl, mmd->simple, 0, mmd->uv_smooth == SUBSURF_UV_SMOOTH_NONE, has_mask, false);
+ subdm = subsurf_dm_create_local(
+ scene, ob, cddm, mmd->totlvl, mmd->simple, 0, mmd->uv_smooth == SUBSURF_UV_SMOOTH_NONE,
+ has_mask, false, SUBSURF_IGNORE_SIMPLIFY);
cddm->release(cddm);
multiresModifier_disp_run(dm, me, NULL, CALC_DISPLACEMENTS, subdm->getGridData(subdm), mmd->totlvl);
@@ -1373,11 +1376,13 @@ DerivedMesh *multires_make_derived_from_derived(DerivedMesh *dm,
if (lvl == 0)
return dm;
+ const int subsurf_flags = ignore_simplify ? SUBSURF_IGNORE_SIMPLIFY : 0;
+
result = subsurf_dm_create_local(scene, ob, dm, lvl,
mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges,
mmd->uv_smooth == SUBSURF_UV_SMOOTH_NONE,
flags & MULTIRES_ALLOC_PAINT_MASK,
- render);
+ render, subsurf_flags);
if (!(flags & MULTIRES_USE_LOCAL_MMD)) {
ccgdm = (CCGDerivedMesh *)result;
diff --git a/source/blender/blenkernel/intern/multires_inline.h b/source/blender/blenkernel/intern/multires_inline.h
index 99b4695fe46..a8d43cc71d5 100644
--- a/source/blender/blenkernel/intern/multires_inline.h
+++ b/source/blender/blenkernel/intern/multires_inline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/multires_inline.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __MULTIRES_INLINE_H__
diff --git a/source/blender/blenkernel/intern/multires_reshape.c b/source/blender/blenkernel/intern/multires_reshape.c
index af3219ca06c..019757cc75a 100644
--- a/source/blender/blenkernel/intern/multires_reshape.c
+++ b/source/blender/blenkernel/intern/multires_reshape.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/multires_reshape.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
@@ -77,6 +71,9 @@ typedef struct MultiresReshapeContext {
GridPaintMask *grid_paint_mask;
int top_grid_size;
int top_level;
+ /* Indexed by coarse face index, returns first ptex face index corresponding
+ * to that coarse face. */
+ int *face_ptex_offset;
} MultiresReshapeContext;
static void multires_reshape_allocate_displacement_grid(
@@ -86,6 +83,9 @@ static void multires_reshape_allocate_displacement_grid(
const int grid_area = grid_size * grid_size;
float (*disps)[3] = MEM_calloc_arrayN(
grid_area, 3 * sizeof(float), "multires disps");
+ if (displacement_grid->disps != NULL) {
+ MEM_freeN(displacement_grid->disps);
+ }
displacement_grid->disps = disps;
displacement_grid->totdisp = grid_area;
displacement_grid->level = level;
@@ -94,7 +94,7 @@ static void multires_reshape_allocate_displacement_grid(
static void multires_reshape_ensure_displacement_grid(
MDisps *displacement_grid, const int level)
{
- if (displacement_grid->disps != NULL) {
+ if (displacement_grid->disps != NULL && displacement_grid->level == level) {
return;
}
multires_reshape_allocate_displacement_grid(
@@ -143,119 +143,64 @@ static void multires_reshape_ensure_grids(Mesh *mesh, const int grid_level)
multires_reshape_ensure_mask_grids(mesh, grid_level);
}
-static void multires_reshape_vertex_copy_to_next(
- MultiresReshapeContext *ctx,
+/* Convert normalized coordinate within a grid to a normalized coordinate within
+ * a ptex face. */
+static void multires_reshape_corner_coord_to_ptex(
const MPoly *coarse_poly,
- const int current_corner,
- const MDisps *current_displacement_grid,
- const GridPaintMask *current_mask_grid,
- const int current_grid_x, const int current_grid_y)
+ const int corner, const float corner_u, const float corner_v,
+ float *r_ptex_face_u, float *r_ptex_face_v)
{
- const int grid_size = ctx->top_grid_size;
- const int next_current_corner = (current_corner + 1) % coarse_poly->totloop;
- const int next_grid_x = 0;
- const int next_grid_y = current_grid_x;
- const int current_index = current_grid_y * grid_size + current_grid_x;
- const int next_index = next_grid_y * grid_size + next_grid_x;
- /* Copy displacement. */
- MDisps *next_displacement_grid = &ctx->mdisps[
- coarse_poly->loopstart + next_current_corner];
- float *next_displacement = next_displacement_grid->disps[next_index];
- copy_v3_v3(next_displacement,
- current_displacement_grid->disps[current_index]);
- SWAP(float, next_displacement[0], next_displacement[1]);
- next_displacement[0] = -next_displacement[0];
- /* Copy mask, if exists. */
- if (current_mask_grid != NULL) {
- GridPaintMask *next_mask_grid = &ctx->grid_paint_mask[
- coarse_poly->loopstart + next_current_corner];
- next_mask_grid->data[next_index] =
- current_mask_grid->data[current_index];
+ if (coarse_poly->totloop == 4) {
+ float grid_u, grid_v;
+ BKE_subdiv_ptex_face_uv_to_grid_uv(
+ corner_u, corner_v, &grid_u, &grid_v);
+ BKE_subdiv_rotate_grid_to_quad(corner, grid_u, grid_v,
+ r_ptex_face_u, r_ptex_face_v);
+ }
+ else {
+ *r_ptex_face_u = corner_u;
+ *r_ptex_face_v = corner_v;
}
}
-static void multires_reshape_vertex_copy_to_prev(
- MultiresReshapeContext *ctx,
+/* NOTE: The tangent vectors are measured in ptex face normalized coordinates,
+ * which is different from grid tangent. */
+static void multires_reshape_sample_surface(
+ Subdiv *subdiv,
const MPoly *coarse_poly,
- const int current_corner,
- const MDisps *current_displacement_grid,
- const GridPaintMask *current_mask_grid,
- const int current_grid_x, const int current_grid_y)
+ const int corner, const float corner_u, const float corner_v,
+ const int ptex_face_index,
+ float r_P[3], float r_dPdu[3], float r_dPdv[3])
{
- const int grid_size = ctx->top_grid_size;
- const int prev_current_corner =
- (current_corner - 1 + coarse_poly->totloop) % coarse_poly->totloop;
- const int prev_grid_x = current_grid_y;
- const int prev_grid_y = 0;
- const int current_index = current_grid_y * grid_size + current_grid_x;
- const int prev_index = prev_grid_y * grid_size + prev_grid_x;
- /* Copy displacement. */
- MDisps *prev_displacement_grid = &ctx->mdisps[
- coarse_poly->loopstart + prev_current_corner];
- float *prev_displacement = prev_displacement_grid->disps[prev_index];
- copy_v3_v3(prev_displacement,
- current_displacement_grid->disps[current_index]);
- SWAP(float, prev_displacement[0], prev_displacement[1]);
- prev_displacement[1] = -prev_displacement[1];
- /* Copy mask, if exists. */
- if (current_mask_grid != NULL) {
- GridPaintMask *prev_mask_grid = &ctx->grid_paint_mask[
- coarse_poly->loopstart + prev_current_corner];
- prev_mask_grid->data[prev_index] =
- current_mask_grid->data[current_index];
- }
+ float ptex_face_u, ptex_face_v;
+ multires_reshape_corner_coord_to_ptex(
+ coarse_poly, corner, corner_u, corner_v,
+ &ptex_face_u, &ptex_face_v);
+ BKE_subdiv_eval_limit_point_and_derivatives(
+ subdiv,
+ ptex_face_index, ptex_face_u, ptex_face_v,
+ r_P, r_dPdu, r_dPdv);
}
-static void copy_boundary_displacement(
- MultiresReshapeContext *ctx,
+static void multires_reshape_tangent_matrix_for_corner(
const MPoly *coarse_poly,
- const int corner,
- const int grid_x, const int grid_y,
- const MDisps *displacement_grid,
- const GridPaintMask *mask_grid)
+ const int coarse_corner,
+ const float dPdu[3], const float dPdv[3],
+ float r_tangent_matrix[3][3])
{
- if (grid_x == 0 && grid_y == 0) {
- for (int i = 0; i < coarse_poly->totloop; i++) {
- const int current_face_corner =
- (corner + i) % coarse_poly->totloop;
- const int grid_index = coarse_poly->loopstart + current_face_corner;
- MDisps *current_displacement_grid = &ctx->mdisps[grid_index];
- GridPaintMask *current_mask_grid =
- mask_grid != NULL ? &ctx->grid_paint_mask[grid_index]
- : NULL;
- multires_reshape_vertex_copy_to_next(
- ctx,
- coarse_poly,
- current_face_corner,
- current_displacement_grid,
- current_mask_grid,
- 0, 0);
- }
- }
- else if (grid_x == 0) {
- multires_reshape_vertex_copy_to_prev(
- ctx,
- coarse_poly,
- corner,
- displacement_grid,
- mask_grid,
- grid_x, grid_y);
- }
- else if (grid_y == 0) {
- multires_reshape_vertex_copy_to_next(
- ctx,
- coarse_poly,
- corner,
- displacement_grid,
- mask_grid,
- grid_x, grid_y);
- }
+ /* For a quad faces we would need to flip the tangent, since they will use
+ * use different coordinates within displacement grid comparent to ptex
+ * face. */
+ const bool is_quad = (coarse_poly->totloop == 4);
+ const int tangent_corner = is_quad ? coarse_corner : 0;
+ BKE_multires_construct_tangent_matrix(
+ r_tangent_matrix, dPdu, dPdv, tangent_corner);
}
static void multires_reshape_vertex_from_final_data(
MultiresReshapeContext *ctx,
const int ptex_face_index,
- const float u, const float v,
+ const float corner_u, const float corner_v,
const int coarse_poly_index,
const int coarse_corner,
const float final_P[3], const float final_mask)
@@ -268,56 +213,39 @@ static void multires_reshape_vertex_from_final_data(
const int loop_index = coarse_poly->loopstart + coarse_corner;
/* Evaluate limit surface. */
float P[3], dPdu[3], dPdv[3];
- BKE_subdiv_eval_limit_point_and_derivatives(
- subdiv, ptex_face_index, u, v, P, dPdu, dPdv);
- /* Get coordinate and corner configuration. */
- float grid_u, grid_v;
- MDisps *displacement_grid;
- GridPaintMask *grid_paint_mask = NULL;
- int face_corner = coarse_corner;
- int grid_corner = 0;
- int grid_index;
- if (coarse_poly->totloop == 4) {
- float corner_u, corner_v;
- face_corner = BKE_subdiv_rotate_quad_to_corner(
- u, v, &corner_u, &corner_v);
- grid_corner = face_corner;
- grid_index = loop_index + face_corner;
- BKE_subdiv_ptex_face_uv_to_grid_uv(
- corner_u, corner_v, &grid_u, &grid_v);
- }
- else {
- grid_index = loop_index;
- BKE_subdiv_ptex_face_uv_to_grid_uv(u, v, &grid_u, &grid_v);
- }
- displacement_grid = &ctx->mdisps[grid_index];
- if (ctx->grid_paint_mask != NULL) {
- grid_paint_mask = &ctx->grid_paint_mask[grid_index];
- BLI_assert(grid_paint_mask->level == displacement_grid->level);
- }
+ multires_reshape_sample_surface(
+ subdiv,
+ coarse_poly,
+ coarse_corner, corner_u, corner_v,
+ ptex_face_index,
+ P, dPdu, dPdv);
+ /* Construct tangent matrix which matches orientation of the current
+ * displacement grid. */
+ float tangent_matrix[3][3], inv_tangent_matrix[3][3];
+ multires_reshape_tangent_matrix_for_corner(coarse_poly, coarse_corner,
+ dPdu, dPdv,
+ tangent_matrix);
+ invert_m3_m3(inv_tangent_matrix, tangent_matrix);
/* Convert object coordinate to a tangent space of displacement grid. */
float D[3];
sub_v3_v3v3(D, final_P, P);
- float tangent_matrix[3][3];
- BKE_multires_construct_tangent_matrix(
- tangent_matrix, dPdu, dPdv, grid_corner);
- float inv_tangent_matrix[3][3];
- invert_m3_m3(inv_tangent_matrix, tangent_matrix);
float tangent_D[3];
mul_v3_m3v3(tangent_D, inv_tangent_matrix, D);
- /* Write tangent displacement. */
+ /* Calculate index of element within the grid. */
+ float grid_u, grid_v;
+ BKE_subdiv_ptex_face_uv_to_grid_uv(corner_u, corner_v, &grid_u, &grid_v);
const int grid_x = (grid_u * (grid_size - 1) + 0.5f);
const int grid_y = (grid_v * (grid_size - 1) + 0.5f);
const int index = grid_y * grid_size + grid_x;
+ /* Write tangent displacement. */
+ MDisps *displacement_grid = &ctx->mdisps[loop_index];
copy_v3_v3(displacement_grid->disps[index], tangent_D);
/* Write mask grid. */
- if (grid_paint_mask != NULL) {
+ if (ctx->grid_paint_mask != NULL) {
+ GridPaintMask *grid_paint_mask = &ctx->grid_paint_mask[loop_index];
+ BLI_assert(grid_paint_mask->level == displacement_grid->level);
grid_paint_mask->data[index] = final_mask;
}
- /* Copy boundary to the next/previous grids */
- copy_boundary_displacement(
- ctx, coarse_poly, face_corner, grid_x, grid_y,
- displacement_grid, grid_paint_mask);
}
/* =============================================================================
@@ -330,8 +258,7 @@ typedef struct MultiresPropagateData {
/* Resolution level up to which displacement is known. */
int reshape_level;
/* Resolution up to which propagation is happening, affecting all the
- * levels in [reshape_level + 1, top_level].
- */
+ * levels in [reshape_level + 1, top_level]. */
int top_level;
/* Grid sizes at the corresponding levels. */
int reshape_grid_size;
@@ -340,8 +267,7 @@ typedef struct MultiresPropagateData {
CCGKey reshape_level_key;
CCGKey top_level_key;
/* Original grid data, before any updates for reshape.
- * Contains data at the reshape_level resolution level.
- */
+ * Contains data at the reshape_level resolution level. */
CCGElem **orig_grids_data;
/* Custom data layers from a coarse mesh. */
MDisps *mdisps;
@@ -468,8 +394,7 @@ static void multires_reshape_propagate_prepare(
multires_reshape_init_level_key(
&data->top_level_key, data, data->top_level);
/* Make a copy of grids before reshaping, so we can calculate deltas
- * later on.
- */
+ * later on. */
multires_reshape_store_original_grids(data);
}
@@ -491,16 +416,14 @@ static void multires_reshape_propagate_prepare_from_mmd(
/* Calculate delta of changed reshape level data layers. Delta goes to a
* grids at top level (meaning, the result grids are only partially filled
- * in).
- */
+ * in). */
static void multires_reshape_calculate_delta(
MultiresPropagateData *data,
CCGElem **delta_grids_data)
{
const int num_grids = data->num_grids;
/* At this point those custom data layers has updated data for the
- * level we are propagating from.
- */
+ * level we are propagating from. */
const MDisps *mdisps = data->mdisps;
const GridPaintMask *grid_paint_mask = data->grid_paint_mask;
CCGKey *reshape_key = &data->reshape_level_key;
@@ -539,8 +462,7 @@ static void multires_reshape_calculate_delta(
/* Makes it so delta is propagated onto all the higher levels, but is also
* that this delta is smoothed in a way that it does not cause artifacts on
- * boundaries.
- */
+ * boundaries. */
typedef struct MultiresPropagateCornerData {
float coord_delta[3];
@@ -678,8 +600,7 @@ static void multires_reshape_propagate_apply_delta(
{
const int num_grids = data->num_grids;
/* At this point those custom data layers has updated data for the
- * level we are propagating from.
- */
+ * level we are propagating from. */
MDisps *mdisps = data->mdisps;
GridPaintMask *grid_paint_mask = data->grid_paint_mask;
CCGKey *orig_key = &data->reshape_level_key;
@@ -689,8 +610,7 @@ static void multires_reshape_propagate_apply_delta(
const int top_grid_size = data->top_grid_size;
const int skip = (top_grid_size - 1) / (orig_grid_size - 1);
/* Restore grid values at the reshape level. Those values are to be changed
- * to the accommodate for the smooth delta.
- */
+ * to the accommodate for the smooth delta. */
for (int grid_index = 0; grid_index < num_grids; grid_index++) {
CCGElem *orig_grid = orig_grids_data[grid_index];
for (int y = 0; y < orig_grid_size; y++) {
@@ -772,6 +692,73 @@ static bool multires_reshape_topology_info(
return true;
}
+/* Will run reshaping for all grid elements which are adjacent to the given
+ * one. This is the way to ensure continuity of displacement stored in the
+ * grids across the inner boundaries of the grids. */
+static void multires_reshape_neighour_boundary_vertices(
+ MultiresReshapeContext *ctx,
+ const int UNUSED(ptex_face_index),
+ const float corner_u, const float corner_v,
+ const int coarse_poly_index,
+ const int coarse_corner,
+ const float final_P[3], const float final_mask)
+{
+ const Mesh *coarse_mesh = ctx->coarse_mesh;
+ const MPoly *coarse_mpoly = coarse_mesh->mpoly;
+ const MPoly *coarse_poly = &coarse_mpoly[coarse_poly_index];
+ const int num_corners = coarse_poly->totloop;
+ const int start_ptex_face_index = ctx->face_ptex_offset[coarse_poly_index];
+ const bool is_quad = (coarse_poly->totloop == 4);
+ if (corner_u == 1.0f && corner_v == 1.0f) {
+ for (int current_corner = 0;
+ current_corner < num_corners;
+ ++current_corner)
+ {
+ if (current_corner == coarse_corner) {
+ continue;
+ }
+ const int current_ptex_face_index =
+ is_quad ? start_ptex_face_index
+ : start_ptex_face_index + current_corner;
+ multires_reshape_vertex_from_final_data(
+ ctx,
+ current_ptex_face_index, 1.0f, 1.0f,
+ coarse_poly_index,
+ current_corner,
+ final_P, final_mask);
+ }
+ }
+ else if (corner_u == 1.0f) {
+ const float next_corner_index = (coarse_corner + 1) % num_corners;
+ const float next_corner_u = corner_v;
+ const float next_corner_v = 1.0f;
+ const int next_ptex_face_index =
+ is_quad ? start_ptex_face_index
+ : start_ptex_face_index + next_corner_index;
+ multires_reshape_vertex_from_final_data(
+ ctx,
+ next_ptex_face_index, next_corner_u, next_corner_v,
+ coarse_poly_index,
+ next_corner_index,
+ final_P, final_mask);
+ }
+ else if (corner_v == 1.0f) {
+ const float prev_corner_index =
+ (coarse_corner + num_corners - 1) % num_corners;
+ const float prev_corner_u = 1.0f;
+ const float prev_corner_v = corner_u;
+ const int prev_ptex_face_index =
+ is_quad ? start_ptex_face_index
+ : start_ptex_face_index + prev_corner_index;
+ multires_reshape_vertex_from_final_data(
+ ctx,
+ prev_ptex_face_index, prev_corner_u, prev_corner_v,
+ coarse_poly_index,
+ prev_corner_index,
+ final_P, final_mask);
+ }
+}
+
static void multires_reshape_vertex(
MultiresReshapeFromDeformedVertsContext *ctx,
const int ptex_face_index,
@@ -781,11 +768,32 @@ static void multires_reshape_vertex(
const int subdiv_vertex_index)
{
const float *final_P = ctx->deformed_verts[subdiv_vertex_index];
+ const Mesh *coarse_mesh = ctx->reshape_ctx.coarse_mesh;
+ const MPoly *coarse_mpoly = coarse_mesh->mpoly;
+ const MPoly *coarse_poly = &coarse_mpoly[coarse_poly_index];
+ const bool is_quad = (coarse_poly->totloop == 4);
+ float corner_u, corner_v;
+ int actual_coarse_corner;
+ if (is_quad) {
+ actual_coarse_corner = BKE_subdiv_rotate_quad_to_corner(
+ u, v, &corner_u, &corner_v);
+ }
+ else {
+ actual_coarse_corner = coarse_corner;
+ corner_u = u;
+ corner_v = v;
+ }
multires_reshape_vertex_from_final_data(
&ctx->reshape_ctx,
- ptex_face_index, u, v,
+ ptex_face_index, corner_u, corner_v,
coarse_poly_index,
- coarse_corner,
+ actual_coarse_corner,
+ final_P, 0.0f);
+ multires_reshape_neighour_boundary_vertices(
+ &ctx->reshape_ctx,
+ ptex_face_index, corner_u, corner_v,
+ coarse_poly_index,
+ actual_coarse_corner,
final_P, 0.0f);
}
@@ -853,7 +861,7 @@ static Subdiv *multires_create_subdiv_for_reshape(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *object_eval = DEG_get_evaluated_object(depsgraph, object);
Mesh *deformed_mesh = mesh_get_eval_deform(
- depsgraph, scene_eval, object_eval, CD_MASK_BAREMESH);
+ depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH);
SubdivSettings subdiv_settings;
BKE_multires_subdiv_settings_init(&subdiv_settings, mmd);
Subdiv *subdiv = BKE_subdiv_new_from_mesh(&subdiv_settings, deformed_mesh);
@@ -880,19 +888,25 @@ static bool multires_reshape_from_vertcos(
* levels.
*
* TODO(sergey): At this point it should be possible to always use
- * mdisps->level.
- */
+ * mdisps->level. */
const int top_level = max_ii(mmd->totlvl, mdisps->level);
/* Make sure displacement grids are ready. */
multires_reshape_ensure_grids(coarse_mesh, top_level);
+ /* Initialize subdivision surface. */
+ Subdiv *subdiv = multires_create_subdiv_for_reshape(depsgraph, object, mmd);
+ if (subdiv == NULL) {
+ return false;
+ }
/* Construct context. */
MultiresReshapeFromDeformedVertsContext reshape_deformed_verts_ctx = {
.reshape_ctx = {
+ .subdiv = subdiv,
.coarse_mesh = coarse_mesh,
.mdisps = mdisps,
.grid_paint_mask = NULL,
.top_grid_size = BKE_subdiv_grid_size_from_level(top_level),
.top_level = top_level,
+ .face_ptex_offset = BKE_subdiv_face_ptex_offset_get(subdiv),
},
.deformed_verts = deformed_verts,
.num_deformed_verts = num_deformed_verts,
@@ -904,12 +918,6 @@ static bool multires_reshape_from_vertcos(
.vertex_every_corner = multires_reshape_vertex_every_corner,
.user_data = &reshape_deformed_verts_ctx,
};
- /* Initialize subdivision surface. */
- Subdiv *subdiv = multires_create_subdiv_for_reshape(depsgraph, object, mmd);
- if (subdiv == NULL) {
- return false;
- }
- reshape_deformed_verts_ctx.reshape_ctx.subdiv = subdiv;
/* Initialize mesh rasterization settings. */
SubdivToMeshSettings mesh_settings;
BKE_multires_subdiv_mesh_settings_init(
@@ -938,8 +946,7 @@ static bool multires_reshape_from_vertcos(
/* Returns truth on success, false otherwise.
*
* This function might fail in cases like source and destination not having
- * matched amount of vertices.
- */
+ * matched amount of vertices. */
bool multiresModifier_reshapeFromObject(
struct Depsgraph *depsgraph,
MultiresModifierData *mmd,
@@ -948,8 +955,7 @@ bool multiresModifier_reshapeFromObject(
{
/* Would be cool to support this eventually, but it is very tricky to match
* vertices order even for meshes, when mixing meshes and other objects it's
- * even more tricky.
- */
+ * even more tricky. */
if (src->type != OB_MESH) {
return false;
}
@@ -959,7 +965,7 @@ bool multiresModifier_reshapeFromObject(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *src_eval = DEG_get_evaluated_object(depsgraph, src);
Mesh *src_mesh_eval = mesh_get_eval_final(
- depsgraph, scene_eval, src_eval, CD_MASK_BAREMESH);
+ depsgraph, scene_eval, src_eval, &CD_MASK_BAREMESH);
int num_deformed_verts;
float (*deformed_verts)[3] = BKE_mesh_vertexCos_get(
src_mesh_eval, &num_deformed_verts);
@@ -992,8 +998,7 @@ bool multiresModifier_reshapeFromDeformModifier(
* simplifications and calculate deformation modifier for the highest
* possible multires level.
* Alternative would be propagate displacement from current level to a
- * higher ones, but that is likely to cause artifacts.
- */
+ * higher ones, but that is likely to cause artifacts. */
multires_reshape_init_mmd_top_level(&highest_mmd, mmd);
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
/* Perform sanity checks and early output. */
@@ -1003,8 +1008,7 @@ bool multiresModifier_reshapeFromDeformModifier(
return false;
}
/* Create mesh for the multires, ignoring any further modifiers (leading
- * deformation modifiers will be applied though).
- */
+ * deformation modifiers will be applied though). */
Mesh *multires_mesh = BKE_multires_create_mesh(
depsgraph, scene_eval, &highest_mmd, object);
int num_deformed_verts;
@@ -1012,9 +1016,10 @@ bool multiresModifier_reshapeFromDeformModifier(
multires_mesh, &num_deformed_verts);
/* Apply deformation modifier on the multires, */
const ModifierEvalContext modifier_ctx = {
- .depsgraph = depsgraph,
- .object = object,
- .flag = MOD_APPLY_USECACHE | MOD_APPLY_IGNORE_SIMPLIFY};
+ .depsgraph = depsgraph,
+ .object = object,
+ .flag = MOD_APPLY_USECACHE | MOD_APPLY_IGNORE_SIMPLIFY,
+ };
modwrap_deformVerts(
md, &modifier_ctx, multires_mesh, deformed_verts,
multires_mesh->totvert);
@@ -1038,77 +1043,40 @@ bool multiresModifier_reshapeFromDeformModifier(
typedef struct ReshapeFromCCGTaskData {
MultiresReshapeContext reshape_ctx;
- int *face_ptex_offset;
const CCGKey *key;
/*const*/ CCGElem **grids;
} ReshapeFromCCGTaskData;
-static void reshape_from_ccg_regular_face(ReshapeFromCCGTaskData *data,
- const MPoly *coarse_poly)
-{
- const CCGKey *key = data->key;
- /*const*/ CCGElem **grids = data->grids;
- const Mesh *coarse_mesh = data->reshape_ctx.coarse_mesh;
- const MPoly *coarse_mpoly = coarse_mesh->mpoly;
- const int key_grid_size = key->grid_size;
- const int key_grid_size_1 = key_grid_size - 1;
- const int resolution = 2 * key_grid_size - 1;
- const float resolution_1_inv = 1.0f / (float)(resolution - 1);
- const int coarse_poly_index = coarse_poly - coarse_mpoly;
- const int ptex_face_index = data->face_ptex_offset[coarse_poly_index];
- for (int y = 0; y < resolution; y++) {
- const float v = y * resolution_1_inv;
- for (int x = 0; x < resolution; x++) {
- const float u = x * resolution_1_inv;
- float corner_u, corner_v;
- float grid_u, grid_v;
- const int face_corner = BKE_subdiv_rotate_quad_to_corner(
- u, v, &corner_u, &corner_v);
- BKE_subdiv_ptex_face_uv_to_grid_uv(
- corner_u, corner_v, &grid_u, &grid_v);
- /*const*/ CCGElem *grid =
- grids[coarse_poly->loopstart + face_corner];
- /*const*/ CCGElem *grid_element = CCG_grid_elem(
- key,
- grid,
- key_grid_size_1 * grid_u,
- key_grid_size_1 * grid_v);
- const float *final_P = CCG_elem_co(key, grid_element);
- float final_mask = 0.0f;
- if (key->has_mask) {
- final_mask = *CCG_elem_mask(key, grid_element);
- }
- multires_reshape_vertex_from_final_data(
- &data->reshape_ctx,
- ptex_face_index,
- u, v,
- coarse_poly_index,
- 0,
- final_P, final_mask);
- }
- }
-}
-
-static void reshape_from_ccg_special_face(ReshapeFromCCGTaskData *data,
- const MPoly *coarse_poly)
+static void reshape_from_ccg_task(
+ void *__restrict userdata,
+ const int coarse_poly_index,
+ const ParallelRangeTLS *__restrict UNUSED(tls))
{
+ ReshapeFromCCGTaskData *data = userdata;
const CCGKey *key = data->key;
/*const*/ CCGElem **grids = data->grids;
const Mesh *coarse_mesh = data->reshape_ctx.coarse_mesh;
const MPoly *coarse_mpoly = coarse_mesh->mpoly;
+ const MPoly *coarse_poly = &coarse_mpoly[coarse_poly_index];
const int key_grid_size = key->grid_size;
const int key_grid_size_1 = key_grid_size - 1;
const int resolution = key_grid_size;
const float resolution_1_inv = 1.0f / (float)(resolution - 1);
- const int coarse_poly_index = coarse_poly - coarse_mpoly;
- const int ptex_face_index = data->face_ptex_offset[coarse_poly_index];
+ const int start_ptex_face_index =
+ data->reshape_ctx.face_ptex_offset[coarse_poly_index];
+ const bool is_quad = (coarse_poly->totloop == 4);
for (int corner = 0; corner < coarse_poly->totloop; corner++) {
for (int y = 0; y < resolution; y++) {
- const float v = y * resolution_1_inv;
+ const float corner_v = y * resolution_1_inv;
for (int x = 0; x < resolution; x++) {
- const float u = x * resolution_1_inv;
+ const float corner_u = x * resolution_1_inv;
+ /* Quad faces consists of a single ptex face. */
+ const int ptex_face_index =
+ is_quad ? start_ptex_face_index
+ : start_ptex_face_index + corner;
float grid_u, grid_v;
- BKE_subdiv_ptex_face_uv_to_grid_uv(u, v, &grid_u, &grid_v);
+ BKE_subdiv_ptex_face_uv_to_grid_uv(
+ corner_u, corner_v, &grid_u, &grid_v);
/*const*/ CCGElem *grid =
grids[coarse_poly->loopstart + corner];
/*const*/ CCGElem *grid_element = CCG_grid_elem(
@@ -1123,8 +1091,8 @@ static void reshape_from_ccg_special_face(ReshapeFromCCGTaskData *data,
}
multires_reshape_vertex_from_final_data(
&data->reshape_ctx,
- ptex_face_index + corner,
- u, v,
+ ptex_face_index,
+ corner_u, corner_v,
coarse_poly_index,
corner,
final_P, final_mask);
@@ -1133,23 +1101,6 @@ static void reshape_from_ccg_special_face(ReshapeFromCCGTaskData *data,
}
}
-static void reshape_from_ccg_task(
- void *__restrict userdata,
- const int coarse_poly_index,
- const ParallelRangeTLS *__restrict UNUSED(tls))
-{
- ReshapeFromCCGTaskData *data = userdata;
- const Mesh *coarse_mesh = data->reshape_ctx.coarse_mesh;
- const MPoly *coarse_mpoly = coarse_mesh->mpoly;
- const MPoly *coarse_poly = &coarse_mpoly[coarse_poly_index];
- if (coarse_poly->totloop == 4) {
- reshape_from_ccg_regular_face(data, coarse_poly);
- }
- else {
- reshape_from_ccg_special_face(data, coarse_poly);
- }
-}
-
bool multiresModifier_reshapeFromCCG(
const int tot_level,
Mesh *coarse_mesh,
@@ -1176,23 +1127,24 @@ bool multiresModifier_reshapeFromCCG(
* levels.
*
* TODO(sergey): At this point it should be possible to always use
- * mdisps->level.
- */
+ * mdisps->level. */
const int top_level = max_ii(tot_level, mdisps->level);
/* Make sure displacement grids are ready. */
multires_reshape_ensure_grids(coarse_mesh, top_level);
/* Construct context. */
ReshapeFromCCGTaskData data = {
- .reshape_ctx = {
- .subdiv = subdiv,
- .coarse_mesh = coarse_mesh,
- .mdisps = mdisps,
- .grid_paint_mask = grid_paint_mask,
- .top_grid_size = BKE_subdiv_grid_size_from_level(top_level),
- .top_level = top_level},
- .face_ptex_offset = BKE_subdiv_face_ptex_offset_get(subdiv),
- .key = &key,
- .grids = subdiv_ccg->grids};
+ .reshape_ctx = {
+ .subdiv = subdiv,
+ .coarse_mesh = coarse_mesh,
+ .mdisps = mdisps,
+ .grid_paint_mask = grid_paint_mask,
+ .top_grid_size = BKE_subdiv_grid_size_from_level(top_level),
+ .top_level = top_level,
+ .face_ptex_offset = BKE_subdiv_face_ptex_offset_get(subdiv),
+ },
+ .key = &key,
+ .grids = subdiv_ccg->grids,
+ };
/* Initialize propagation to higher levels. */
MultiresPropagateData propagate_data;
multires_reshape_propagate_prepare(
diff --git a/source/blender/blenkernel/intern/multires_subdiv.c b/source/blender/blenkernel/intern/multires_subdiv.c
index 150e7192934..3d1a019f427 100644
--- a/source/blender/blenkernel/intern/multires_subdiv.c
+++ b/source/blender/blenkernel/intern/multires_subdiv.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/multires_subdiv.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "MEM_guardedalloc.h"
@@ -34,7 +28,6 @@
#include "BLI_utildefines.h"
-#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index bbbb7e10e3f..a2631840f41 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/nla.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -37,6 +29,8 @@
#include <math.h>
#include <float.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
@@ -66,7 +60,7 @@
#include "RNA_access.h"
#include "nla_private.h"
-
+static CLG_LogRef LOG = {"bke.nla"};
/* *************************************************** */
/* Data Management */
@@ -190,7 +184,7 @@ NlaStrip *BKE_nlastrip_copy(Main *bmain, NlaStrip *strip, const bool use_same_ac
}
else {
/* use a copy of the action instead (user count shouldn't have changed yet) */
- BKE_id_copy_ex(bmain, &strip_d->act->id, (ID **)&strip_d->act, flag, false);
+ BKE_id_copy_ex(bmain, &strip_d->act->id, (ID **)&strip_d->act, flag);
}
}
@@ -1712,7 +1706,7 @@ bool BKE_nla_action_stash(AnimData *adt)
/* sanity check */
if (ELEM(NULL, adt, adt->action)) {
- printf("%s: Invalid argument - %p %p\n", __func__, adt, adt->action);
+ CLOG_ERROR(&LOG, "Invalid argument - %p %p", adt, adt->action);
return false;
}
@@ -1790,7 +1784,7 @@ void BKE_nla_action_pushdown(AnimData *adt)
*/
/* TODO: what about modifiers? */
if (action_has_motion(adt->action) == 0) {
- printf("BKE_nla_action_pushdown(): action has no data\n");
+ CLOG_ERROR(&LOG, "action has no data");
return;
}
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index ea31ad08e61..09b44db02e5 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,14 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/node.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include <stdlib.h>
@@ -38,7 +32,7 @@
#include "DNA_action_types.h"
#include "DNA_anim_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
@@ -59,8 +53,6 @@
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_node.h"
@@ -81,10 +73,11 @@
#define NODE_DEFAULT_MAX_WIDTH 700
/* Fallback types for undefined tree, nodes, sockets */
-bNodeTreeType NodeTreeTypeUndefined;
+static bNodeTreeType NodeTreeTypeUndefined;
bNodeType NodeTypeUndefined;
bNodeSocketType NodeSocketTypeUndefined;
+static CLG_LogRef LOG = {"bke.node"};
static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType *ntype)
{
@@ -527,7 +520,7 @@ void nodeModifySocketType(bNodeTree *ntree, bNode *UNUSED(node), bNodeSocket *so
const char *idname = nodeStaticSocketType(type, subtype);
if (!idname) {
- printf("Error: static node socket type %d undefined\n", type);
+ CLOG_ERROR(&LOG, "static node socket type %d undefined", type);
return;
}
@@ -698,7 +691,7 @@ bNodeSocket *nodeAddStaticSocket(bNodeTree *ntree, bNode *node, int in_out, int
bNodeSocket *sock;
if (!idname) {
- printf("Error: static node socket type %d undefined\n", type);
+ CLOG_ERROR(&LOG, "static node socket type %d undefined", type);
return NULL;
}
@@ -714,7 +707,7 @@ bNodeSocket *nodeInsertStaticSocket(bNodeTree *ntree, bNode *node, int in_out, i
bNodeSocket *sock;
if (!idname) {
- printf("Error: static node socket type %d undefined\n", type);
+ CLOG_ERROR(&LOG, "static node socket type %d undefined", type);
return NULL;
}
@@ -723,10 +716,10 @@ bNodeSocket *nodeInsertStaticSocket(bNodeTree *ntree, bNode *node, int in_out, i
return sock;
}
-static void node_socket_free(bNodeTree *UNUSED(ntree), bNodeSocket *sock, bNode *UNUSED(node))
+static void node_socket_free(bNodeTree *UNUSED(ntree), bNodeSocket *sock, bNode *UNUSED(node), const bool do_id_user)
{
if (sock->prop) {
- IDP_FreeProperty(sock->prop);
+ IDP_FreeProperty_ex(sock->prop, do_id_user);
MEM_freeN(sock->prop);
}
@@ -749,7 +742,7 @@ void nodeRemoveSocket(bNodeTree *ntree, bNode *node, bNodeSocket *sock)
BLI_remlink(&node->inputs, sock);
BLI_remlink(&node->outputs, sock);
- node_socket_free(ntree, sock, node);
+ node_socket_free(ntree, sock, node, true);
MEM_freeN(sock);
node->update |= NODE_UPDATE;
@@ -769,14 +762,14 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node)
for (sock = node->inputs.first; sock; sock = sock_next) {
sock_next = sock->next;
- node_socket_free(ntree, sock, node);
+ node_socket_free(ntree, sock, node, true);
MEM_freeN(sock);
}
BLI_listbase_clear(&node->inputs);
for (sock = node->outputs.first; sock; sock = sock_next) {
sock_next = sock->next;
- node_socket_free(ntree, sock, node);
+ node_socket_free(ntree, sock, node, true);
MEM_freeN(sock);
}
BLI_listbase_clear(&node->outputs);
@@ -931,7 +924,7 @@ bNode *nodeAddStaticNode(const struct bContext *C, bNodeTree *ntree, int type)
}
} NODE_TYPES_END;
if (!idname) {
- printf("Error: static node type %d undefined\n", type);
+ CLOG_ERROR(&LOG, "static node type %d undefined", type);
return NULL;
}
return nodeAddNode(C, ntree, idname);
@@ -1028,11 +1021,6 @@ bNode *BKE_node_copy_ex(bNodeTree *ntree, bNode *node_src, const int flag)
return node_dst;
}
-bNode *nodeCopyNode(bNodeTree *ntree, bNode *node)
-{
- return BKE_node_copy_ex(ntree, node, LIB_ID_CREATE_NO_USER_REFCOUNT);
-}
-
/* also used via rna api, so we check for proper input output direction */
bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, bNode *tonode, bNodeSocket *tosock)
{
@@ -1298,7 +1286,7 @@ bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname)
/**
* Only copy internal data of NodeTree ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -1384,7 +1372,8 @@ void BKE_node_tree_copy_data(Main *UNUSED(bmain), bNodeTree *ntree_dst, const bN
bNodeTree *ntreeCopyTree_ex(const bNodeTree *ntree, Main *bmain, const bool do_id_user)
{
bNodeTree *ntree_copy;
- BKE_id_copy_ex(bmain, (ID *)ntree, (ID **)&ntree_copy, do_id_user ? 0 : LIB_ID_CREATE_NO_USER_REFCOUNT, false);
+ const int flag = do_id_user ? LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN : 0;
+ BKE_id_copy_ex(bmain, (ID *)ntree, (ID **)&ntree_copy, flag);
return ntree_copy;
}
bNodeTree *ntreeCopyTree(Main *bmain, const bNodeTree *ntree)
@@ -1748,19 +1737,22 @@ static void node_free_node_ex(
for (sock = node->inputs.first; sock; sock = nextsock) {
nextsock = sock->next;
- node_socket_free(ntree, sock, node);
+ /* Remember, no ID user refcount management here! */
+ node_socket_free(ntree, sock, node, false);
MEM_freeN(sock);
}
for (sock = node->outputs.first; sock; sock = nextsock) {
nextsock = sock->next;
- node_socket_free(ntree, sock, node);
+ /* Remember, no ID user refcount management here! */
+ node_socket_free(ntree, sock, node, false);
MEM_freeN(sock);
}
BLI_freelistN(&node->internal_links);
if (node->prop) {
- IDP_FreeProperty(node->prop);
+ /* Remember, no ID user refcount management here! */
+ IDP_FreeProperty_ex(node->prop, false);
MEM_freeN(node->prop);
}
@@ -1975,7 +1967,7 @@ bNodeTree *ntreeFromID(const ID *id)
{
switch (GS(id->name)) {
case ID_MA: return ((const Material *)id)->nodetree;
- case ID_LA: return ((const Lamp *)id)->nodetree;
+ case ID_LA: return ((const Light *)id)->nodetree;
case ID_WO: return ((const World *)id)->nodetree;
case ID_TE: return ((const Tex *)id)->nodetree;
case ID_SCE: return ((const Scene *)id)->nodetree;
@@ -2041,11 +2033,8 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
*/
BKE_id_copy_ex(
NULL, &ntree->id, (ID **)&ltree,
- (LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_COPY_NO_PREVIEW |
- LIB_ID_COPY_NO_ANIMDATA),
- false);
+ (LIB_ID_COPY_LOCALIZE |
+ LIB_ID_COPY_NO_ANIMDATA));
for (node = ltree->nodes.first; node; node = node->next) {
if (node->type == NODE_GROUP && node->id) {
@@ -3378,8 +3367,8 @@ static void register_undefined_types(void)
*/
strcpy(NodeTreeTypeUndefined.idname, "NodeTreeUndefined");
- strcpy(NodeTreeTypeUndefined.ui_name, "Undefined");
- strcpy(NodeTreeTypeUndefined.ui_description, "Undefined Node Tree Type");
+ strcpy(NodeTreeTypeUndefined.ui_name, N_("Undefined"));
+ strcpy(NodeTreeTypeUndefined.ui_description, N_("Undefined Node Tree Type"));
node_type_base_custom(&NodeTypeUndefined, "NodeUndefined", "Undefined", 0, 0);
NodeTypeUndefined.poll = node_undefined_poll;
@@ -3563,7 +3552,7 @@ static void registerShaderNodes(void)
register_node_type_sh_uvalongstroke();
register_node_type_sh_eevee_specular();
- register_node_type_sh_output_lamp();
+ register_node_type_sh_output_light();
register_node_type_sh_output_material();
register_node_type_sh_output_world();
register_node_type_sh_output_linestyle();
@@ -3703,13 +3692,13 @@ void free_nodesystem(void)
void BKE_node_tree_iter_init(struct NodeTreeIterStore *ntreeiter, struct Main *bmain)
{
- ntreeiter->ngroup = bmain->nodetree.first;
- ntreeiter->scene = bmain->scene.first;
- ntreeiter->mat = bmain->mat.first;
- ntreeiter->tex = bmain->tex.first;
- ntreeiter->lamp = bmain->lamp.first;
- ntreeiter->world = bmain->world.first;
- ntreeiter->linestyle = bmain->linestyle.first;
+ ntreeiter->ngroup = bmain->nodetrees.first;
+ ntreeiter->scene = bmain->scenes.first;
+ ntreeiter->mat = bmain->materials.first;
+ ntreeiter->tex = bmain->textures.first;
+ ntreeiter->light = bmain->lights.first;
+ ntreeiter->world = bmain->worlds.first;
+ ntreeiter->linestyle = bmain->linestyles.first;
}
bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter,
bNodeTree **r_nodetree, struct ID **r_id)
@@ -3734,10 +3723,10 @@ bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter,
*r_id = (ID *)ntreeiter->tex;
ntreeiter->tex = ntreeiter->tex->id.next;
}
- else if (ntreeiter->lamp) {
- *r_nodetree = ntreeiter->lamp->nodetree;
- *r_id = (ID *)ntreeiter->lamp;
- ntreeiter->lamp = ntreeiter->lamp->id.next;
+ else if (ntreeiter->light) {
+ *r_nodetree = ntreeiter->light->nodetree;
+ *r_id = (ID *)ntreeiter->light;
+ ntreeiter->light = ntreeiter->light->id.next;
}
else if (ntreeiter->world) {
*r_nodetree = ntreeiter->world->nodetree;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 14fafc130f4..bdca469dc8e 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/object.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -34,6 +26,8 @@
#include <math.h>
#include <stdio.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
@@ -44,7 +38,7 @@
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lattice_types.h"
#include "DNA_material_types.h"
#include "DNA_meta_types.h"
@@ -91,7 +85,7 @@
#include "BKE_gpencil_modifier.h"
#include "BKE_icons.h"
#include "BKE_key.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_layer.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
@@ -139,6 +133,8 @@
#include "CCGSubSurf.h"
#include "atomic_ops.h"
+static CLG_LogRef LOG = {"bke.object"};
+
/* Vertex parent modifies original BMesh which is not safe for threading.
* Ideally such a modification should be handled as a separate DAG update
* callback for mesh datablock, but for until it is actually supported use
@@ -155,7 +151,7 @@ void BKE_object_workob_clear(Object *workob)
{
memset(workob, 0, sizeof(Object));
- workob->size[0] = workob->size[1] = workob->size[2] = 1.0f;
+ workob->scale[0] = workob->scale[1] = workob->scale[2] = 1.0f;
workob->dscale[0] = workob->dscale[1] = workob->dscale[2] = 1.0f;
workob->rotmode = ROT_MODE_EUL;
}
@@ -454,10 +450,7 @@ void BKE_object_free_derived_caches(Object *ob)
}
}
- if (ob->bb) {
- MEM_freeN(ob->bb);
- ob->bb = NULL;
- }
+ MEM_SAFE_FREE(ob->runtime.bb);
object_update_from_subsurf_ccg(ob);
BKE_object_free_derived_mesh_caches(ob);
@@ -470,7 +463,7 @@ void BKE_object_free_derived_caches(Object *ob)
ob->data = ob->runtime.mesh_orig;
}
/* Evaluated mesh points to edit mesh, but does not own it. */
- mesh_eval->edit_btmesh = NULL;
+ mesh_eval->edit_mesh = NULL;
BKE_mesh_free(mesh_eval);
BKE_libblock_free_data(&mesh_eval->id, false);
MEM_freeN(mesh_eval);
@@ -542,7 +535,7 @@ void BKE_object_free_caches(Object *object)
* object created by dependency graph, which shares pointers with original
* object. In this case we can not free anything.
*/
- if ((object->base_flag & BASE_FROMDUPLI) == 0) {
+ if ((object->base_flag & BASE_FROM_DUPLI) == 0) {
BKE_object_free_derived_caches(object);
update_flag |= ID_RECALC_GEOMETRY;
}
@@ -570,7 +563,7 @@ void BKE_object_free(Object *ob)
MEM_SAFE_FREE(ob->mat);
MEM_SAFE_FREE(ob->matbits);
MEM_SAFE_FREE(ob->iuser);
- MEM_SAFE_FREE(ob->bb);
+ MEM_SAFE_FREE(ob->runtime.bb);
BLI_freelistN(&ob->defbase);
BLI_freelistN(&ob->fmaps);
@@ -618,7 +611,7 @@ bool BKE_object_is_in_editmode(const Object *ob)
switch (ob->type) {
case OB_MESH:
- return ((Mesh *)ob->data)->edit_btmesh != NULL;
+ return ((Mesh *)ob->data)->edit_mesh != NULL;
case OB_ARMATURE:
return ((bArmature *)ob->data)->edbo != NULL;
case OB_FONT:
@@ -647,7 +640,7 @@ bool BKE_object_data_is_in_editmode(const ID *id)
BLI_assert(OB_DATA_SUPPORT_EDITMODE(type));
switch (type) {
case ID_ME:
- return ((const Mesh *)id)->edit_btmesh != NULL;
+ return ((const Mesh *)id)->edit_mesh != NULL;
case ID_CU:
return (
(((const Curve *)id)->editnurb != NULL) ||
@@ -670,7 +663,7 @@ bool BKE_object_is_in_wpaint_select_vert(const Object *ob)
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
return ((ob->mode & OB_MODE_WEIGHT_PAINT) &&
- (me->edit_btmesh == NULL) &&
+ (me->edit_mesh == NULL) &&
(ME_EDIT_PAINT_SEL_MODE(me) == SCE_SELECT_VERTEX));
}
@@ -756,7 +749,7 @@ bool BKE_object_exists_check(Main *bmain, const Object *obtest)
if (obtest == NULL) return false;
- ob = bmain->object.first;
+ ob = bmain->objects.first;
while (ob) {
if (ob == obtest) return true;
ob = ob->id.next;
@@ -775,14 +768,14 @@ static const char *get_obdata_defname(int type)
case OB_FONT: return DATA_("Text");
case OB_MBALL: return DATA_("Mball");
case OB_CAMERA: return DATA_("Camera");
- case OB_LAMP: return DATA_("Light");
+ case OB_LAMP: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Light");
case OB_LATTICE: return DATA_("Lattice");
case OB_ARMATURE: return DATA_("Armature");
case OB_SPEAKER: return DATA_("Speaker");
case OB_EMPTY: return DATA_("Empty");
case OB_GPENCIL: return DATA_("GPencil");
default:
- printf("get_obdata_defname: Internal error, bad type: %d\n", type);
+ CLOG_ERROR(&LOG, "Internal error, bad type: %d", type);
return DATA_("Empty");
}
}
@@ -800,7 +793,7 @@ void *BKE_object_obdata_add_from_type(Main *bmain, int type, const char *name)
case OB_FONT: return BKE_curve_add(bmain, name, OB_FONT);
case OB_MBALL: return BKE_mball_add(bmain, name);
case OB_CAMERA: return BKE_camera_add(bmain, name);
- case OB_LAMP: return BKE_lamp_add(bmain, name);
+ case OB_LAMP: return BKE_light_add(bmain, name);
case OB_LATTICE: return BKE_lattice_add(bmain, name);
case OB_ARMATURE: return BKE_armature_add(bmain, name);
case OB_SPEAKER: return BKE_speaker_add(bmain, name);
@@ -808,7 +801,7 @@ void *BKE_object_obdata_add_from_type(Main *bmain, int type, const char *name)
case OB_GPENCIL: return BKE_gpencil_data_addnew(bmain, name);
case OB_EMPTY: return NULL;
default:
- printf("%s: Internal error, bad type: %d\n", __func__, type);
+ CLOG_ERROR(&LOG, "Internal error, bad type: %d", type);
return NULL;
}
}
@@ -817,10 +810,9 @@ void BKE_object_init(Object *ob)
{
/* BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(ob, id)); */ /* ob->type is already initialized... */
- ob->col[0] = ob->col[1] = ob->col[2] = 1.0;
- ob->col[3] = 1.0;
+ copy_v4_fl(ob->color, 1.0f);
- ob->size[0] = ob->size[1] = ob->size[2] = 1.0;
+ ob->scale[0] = ob->scale[1] = ob->scale[2] = 1.0;
ob->dscale[0] = ob->dscale[1] = ob->dscale[2] = 1.0;
/* objects should default to having Euler XYZ rotations,
@@ -857,9 +849,7 @@ void BKE_object_init(Object *ob)
ob->upflag = OB_POSZ;
}
- ob->dupon = 1; ob->dupoff = 0;
- ob->dupsta = 1; ob->dupend = 100;
- ob->dupfacesca = 1.0;
+ ob->instance_faces_scale = 1.0;
ob->col_group = 0x01;
ob->col_mask = 0xffff;
@@ -873,8 +863,6 @@ void BKE_object_init(Object *ob)
/* Animation Visualization defaults */
animviz_settings_init(&ob->avs);
-
- ob->display.flag = OB_SHOW_SHADOW;
}
/* more general add: creates minimum required data, but without vertices etc. */
@@ -1144,7 +1132,8 @@ static void copy_object_pose(Object *obn, const Object *ob, const int flag)
{
bPoseChannel *chan;
- /* note: need to clear obn->pose pointer first, so that BKE_pose_copy_data works (otherwise there's a crash) */
+ /* note: need to clear obn->pose pointer first,
+ * so that BKE_pose_copy_data works (otherwise there's a crash) */
obn->pose = NULL;
BKE_pose_copy_data_ex(&obn->pose, ob->pose, flag, true); /* true = copy constraints */
@@ -1239,7 +1228,8 @@ Object **BKE_object_pose_array_get_ex(ViewLayer *view_layer, View3D *v3d, uint *
objects = BKE_view_layer_array_from_objects_in_mode(
view_layer, v3d, r_objects_len, {
.object_mode = OB_MODE_POSE,
- .no_dup_data = unique});
+ .no_dup_data = unique,
+ });
}
else if (ob_pose != NULL) {
*r_objects_len = 1;
@@ -1281,7 +1271,8 @@ Base **BKE_object_pose_base_array_get_ex(ViewLayer *view_layer, View3D *v3d, uin
bases = BKE_view_layer_array_from_bases_in_mode(
view_layer, v3d, r_bases_len, {
.object_mode = OB_MODE_POSE,
- .no_dup_data = unique});
+ .no_dup_data = unique,
+ });
}
else if (base_pose != NULL) {
*r_bases_len = 1;
@@ -1311,12 +1302,12 @@ void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src)
copy_v3_v3(ob_tar->rotAxis, ob_src->rotAxis);
ob_tar->rotAngle = ob_src->rotAngle;
ob_tar->rotmode = ob_src->rotmode;
- copy_v3_v3(ob_tar->size, ob_src->size);
+ copy_v3_v3(ob_tar->scale, ob_src->scale);
}
/**
* Only copy internal data of Object ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -1329,7 +1320,7 @@ void BKE_object_copy_data(Main *bmain, Object *ob_dst, const Object *ob_src, con
ShaderFxData *fx;
/* Do not copy runtime data. */
- BKE_object_runtime_reset(ob_dst);
+ BKE_object_runtime_reset_on_copy(ob_dst, flag);
/* We never handle usercount here for own data. */
const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT;
@@ -1348,7 +1339,7 @@ void BKE_object_copy_data(Main *bmain, Object *ob_dst, const Object *ob_src, con
if (ob_src->iuser) ob_dst->iuser = MEM_dupallocN(ob_src->iuser);
- if (ob_src->bb) ob_dst->bb = MEM_dupallocN(ob_src->bb);
+ if (ob_src->runtime.bb) ob_dst->runtime.bb = MEM_dupallocN(ob_src->runtime.bb);
BLI_listbase_clear(&ob_dst->modifiers);
@@ -1428,7 +1419,7 @@ void BKE_object_copy_data(Main *bmain, Object *ob_dst, const Object *ob_src, con
Object *BKE_object_copy(Main *bmain, const Object *ob)
{
Object *ob_copy;
- BKE_id_copy_ex(bmain, &ob->id, (ID **)&ob_copy, 0, false);
+ BKE_id_copy(bmain, &ob->id, (ID **)&ob_copy);
/* We increase object user count when linking to Collections. */
id_us_min(&ob_copy->id);
@@ -1436,6 +1427,240 @@ Object *BKE_object_copy(Main *bmain, const Object *ob)
return ob_copy;
}
+Object *BKE_object_duplicate(Main *bmain, const Object *ob, const int dupflag)
+{
+ Material ***matarar;
+ ID *id;
+ int a, didit;
+ Object *obn = BKE_object_copy(bmain, ob);
+
+ /* 0 == full linked. */
+ if (dupflag == 0) {
+ return obn;
+ }
+
+#define ID_NEW_REMAP_US(a) if ( (a)->id.newid) { (a) = (void *)(a)->id.newid; (a)->id.us++; }
+#define ID_NEW_REMAP_US2(a) if (((ID *)a)->newid) { (a) = ((ID *)a)->newid; ((ID *)a)->us++; }
+
+ /* duplicates using userflags */
+ if (dupflag & USER_DUP_ACT) {
+ BKE_animdata_copy_id_action(bmain, &obn->id, true);
+ }
+
+ if (dupflag & USER_DUP_MAT) {
+ for (a = 0; a < obn->totcol; a++) {
+ id = (ID *)obn->mat[a];
+ if (id) {
+ ID_NEW_REMAP_US(obn->mat[a])
+ else {
+ obn->mat[a] = ID_NEW_SET(obn->mat[a], BKE_material_copy(bmain, obn->mat[a]));
+ }
+ id_us_min(id);
+
+ if (dupflag & USER_DUP_ACT) {
+ BKE_animdata_copy_id_action(bmain, &obn->mat[a]->id, true);
+ }
+ }
+ }
+ }
+ if (dupflag & USER_DUP_PSYS) {
+ ParticleSystem *psys;
+ for (psys = obn->particlesystem.first; psys; psys = psys->next) {
+ id = (ID *) psys->part;
+ if (id) {
+ ID_NEW_REMAP_US(psys->part)
+ else {
+ psys->part = ID_NEW_SET(psys->part, BKE_particlesettings_copy(bmain, psys->part));
+ }
+
+ if (dupflag & USER_DUP_ACT) {
+ BKE_animdata_copy_id_action(bmain, &psys->part->id, true);
+ }
+
+ id_us_min(id);
+ }
+ }
+ }
+
+ id = obn->data;
+ didit = 0;
+
+ switch (obn->type) {
+ case OB_MESH:
+ if (dupflag & USER_DUP_MESH) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_mesh_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_CURVE:
+ if (dupflag & USER_DUP_CURVE) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_curve_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_SURF:
+ if (dupflag & USER_DUP_SURF) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_curve_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_FONT:
+ if (dupflag & USER_DUP_FONT) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_curve_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_MBALL:
+ if (dupflag & USER_DUP_MBALL) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_mball_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_LAMP:
+ if (dupflag & USER_DUP_LAMP) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_light_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_ARMATURE:
+ DEG_id_tag_update(&obn->id, ID_RECALC_GEOMETRY);
+ if (obn->pose)
+ BKE_pose_tag_recalc(bmain, obn->pose);
+ if (dupflag & USER_DUP_ARM) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_armature_copy(bmain, obn->data));
+ BKE_pose_rebuild(bmain, obn, obn->data, true);
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_LATTICE:
+ if (dupflag != 0) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_lattice_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_CAMERA:
+ if (dupflag != 0) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_camera_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_LIGHTPROBE:
+ if (dupflag != 0) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_lightprobe_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_SPEAKER:
+ if (dupflag != 0) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_speaker_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ case OB_GPENCIL:
+ if (dupflag != 0) {
+ ID_NEW_REMAP_US2(obn->data)
+ else {
+ obn->data = ID_NEW_SET(obn->data, BKE_gpencil_copy(bmain, obn->data));
+ didit = 1;
+ }
+ id_us_min(id);
+ }
+ break;
+ }
+
+ /* Check if obdata is copied. */
+ if (didit) {
+ Key *key = BKE_key_from_object(obn);
+
+ Key *oldkey = BKE_key_from_object(ob);
+ if (oldkey != NULL) {
+ ID_NEW_SET(oldkey, key);
+ }
+
+ if (dupflag & USER_DUP_ACT) {
+ BKE_animdata_copy_id_action(bmain, (ID *)obn->data, true);
+ if (key) {
+ BKE_animdata_copy_id_action(bmain, (ID *)key, true);
+ }
+ }
+
+ if (dupflag & USER_DUP_MAT) {
+ matarar = give_matarar(obn);
+ if (matarar) {
+ for (a = 0; a < obn->totcol; a++) {
+ id = (ID *)(*matarar)[a];
+ if (id) {
+ ID_NEW_REMAP_US((*matarar)[a])
+ else {
+ (*matarar)[a] = ID_NEW_SET((*matarar)[a], BKE_material_copy(bmain, (*matarar)[a]));
+ }
+ id_us_min(id);
+ }
+ }
+ }
+ }
+ }
+
+#undef ID_NEW_REMAP_US
+#undef ID_NEW_REMAP_US2
+
+ BKE_libblock_relink_to_newid(&obn->id);
+
+ /* DAG_relations_tag_update(bmain); */ /* caller must do */
+
+ if (ob->data != NULL) {
+ DEG_id_tag_update_ex(bmain, (ID *)obn->data, ID_RECALC_EDITORS);
+ }
+
+ /* BKE_main_id_clear_newpoins(bmain); */ /* Called must do. */
+
+ return obn;
+}
+
void BKE_object_make_local_ex(Main *bmain, Object *ob, const bool lib_local, const bool clear_proxy)
{
bool is_local = false, is_lib = false;
@@ -1562,7 +1787,7 @@ void BKE_object_make_proxy(Main *bmain, Object *ob, Object *target, Object *cob)
{
/* paranoia checks */
if (ID_IS_LINKED(ob) || !ID_IS_LINKED(target)) {
- printf("cannot make proxy\n");
+ CLOG_ERROR(&LOG, "cannot make proxy");
return;
}
@@ -1582,9 +1807,9 @@ void BKE_object_make_proxy(Main *bmain, Object *ob, Object *target, Object *cob)
if (cob) {
ob->rotmode = target->rotmode;
mul_m4_m4m4(ob->obmat, cob->obmat, target->obmat);
- if (cob->dup_group) { /* should always be true */
+ if (cob->instance_collection) { /* should always be true */
float tvec[3];
- mul_v3_mat3_m4v3(tvec, ob->obmat, cob->dup_group->dupli_ofs);
+ mul_v3_mat3_m4v3(tvec, ob->obmat, cob->instance_collection->instance_offset);
sub_v3_v3(ob->obmat[3], tvec);
}
BKE_object_apply_mat4(ob, ob->obmat, false, true);
@@ -1624,7 +1849,8 @@ void BKE_object_make_proxy(Main *bmain, Object *ob, Object *target, Object *cob)
ob->mat = MEM_dupallocN(target->mat);
ob->matbits = MEM_dupallocN(target->matbits);
for (i = 0; i < target->totcol; i++) {
- /* don't 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]);
}
}
@@ -1669,11 +1895,6 @@ void BKE_object_obdata_size_init(struct Object *ob, const float size)
ob->empty_drawsize *= size;
break;
}
- case OB_GPENCIL:
- {
- ob->empty_drawsize *= size;
- break;
- }
case OB_FONT:
{
Curve *cu = ob->data;
@@ -1688,7 +1909,7 @@ void BKE_object_obdata_size_init(struct Object *ob, const float size)
}
case OB_LAMP:
{
- Lamp *lamp = ob->data;
+ Light *lamp = ob->data;
lamp->dist *= size;
lamp->area_size *= size;
lamp->area_sizey *= size;
@@ -1716,7 +1937,7 @@ void BKE_object_obdata_size_init(struct Object *ob, const float size)
void BKE_object_scale_to_mat3(Object *ob, float mat[3][3])
{
float vec[3];
- mul_v3_v3v3(vec, ob->size, ob->dscale);
+ mul_v3_v3v3(vec, ob->scale, ob->dscale);
size_to_mat3(mat, vec);
}
@@ -1813,7 +2034,7 @@ void BKE_object_tfm_protected_backup(const Object *ob,
TFMCPY3D(loc);
TFMCPY3D(dloc);
- TFMCPY3D(size);
+ TFMCPY3D(scale);
TFMCPY3D(dscale);
TFMCPY3D(rot);
TFMCPY3D(drot);
@@ -1843,7 +2064,7 @@ void BKE_object_tfm_protected_restore(Object *ob,
}
if (protectflag & (OB_LOCK_SCALEX << i)) {
- ob->size[i] = obtfm->size[i];
+ ob->scale[i] = obtfm->scale[i];
ob->dscale[i] = obtfm->dscale[i];
}
@@ -1868,13 +2089,37 @@ void BKE_object_tfm_protected_restore(Object *ob,
}
}
+void BKE_object_tfm_copy(Object *object_dst, const Object *object_src)
+{
+#define TFMCPY(_v) (object_dst->_v = object_src->_v)
+#define TFMCPY3D(_v) copy_v3_v3(object_dst->_v, object_src->_v)
+#define TFMCPY4D(_v) copy_v4_v4(object_dst->_v, object_src->_v)
+
+ TFMCPY3D(loc);
+ TFMCPY3D(dloc);
+ TFMCPY3D(scale);
+ TFMCPY3D(dscale);
+ TFMCPY3D(rot);
+ TFMCPY3D(drot);
+ TFMCPY4D(quat);
+ TFMCPY4D(dquat);
+ TFMCPY3D(rotAxis);
+ TFMCPY3D(drotAxis);
+ TFMCPY(rotAngle);
+ TFMCPY(drotAngle);
+
+#undef TFMCPY
+#undef TFMCPY3D
+#undef TFMCPY4D
+}
+
void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */
{
float smat[3][3];
float rmat[3][3];
/*float q1[4];*/
- /* size */
+ /* scale */
BKE_object_scale_to_mat3(ob, smat);
/* rot */
@@ -1911,8 +2156,7 @@ void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4])
* \param depsgraph: Used for dupli-frame time.
* \return success if \a mat is set.
*/
-static bool ob_parcurve(Object *ob, Object *par,
- float dupli_ctime, int dupli_transflag, float mat[4][4])
+static bool ob_parcurve(Object *ob, Object *par, float mat[4][4])
{
Curve *cu = par->data;
float vec[4], dir[3], quat[4], radius, ctime;
@@ -1932,29 +2176,19 @@ static bool ob_parcurve(Object *ob, Object *par,
return false;
}
- /* catch exceptions: curve paths used as a duplicator */
- if ((dupli_transflag & OB_DUPLINOSPEED) == 0) {
- /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
- * but this will only work if it actually is animated...
- *
- * we divide the curvetime calculated in the previous step by the length of the path, to get a time
- * factor, which then gets clamped to lie within 0.0 - 1.0 range
- */
- if (cu->pathlen) {
- ctime = cu->ctime / cu->pathlen;
- }
- else {
- ctime = cu->ctime;
- }
- CLAMP(ctime, 0.0f, 1.0f);
+ /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
+ * but this will only work if it actually is animated...
+ *
+ * we divide the curvetime calculated in the previous step by the length of the path, to get a time
+ * factor, which then gets clamped to lie within 0.0 - 1.0 range
+ */
+ if (cu->pathlen) {
+ ctime = cu->ctime / cu->pathlen;
}
else {
- ctime = dupli_ctime;
- if (cu->pathlen) {
- ctime /= cu->pathlen;
- }
- CLAMP(ctime, 0.0f, 1.0f);
+ ctime = cu->ctime;
}
+ CLAMP(ctime, 0.0f, 1.0f);
unit_m4(mat);
@@ -1990,7 +2224,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4])
/* Make sure the bone is still valid */
pchan = BKE_pose_channel_find_name(par->pose, ob->parsubstr);
if (!pchan || !pchan->bone) {
- printf("Object %s with Bone parent: bone %s doesn't exist\n", ob->id.name + 2, ob->parsubstr);
+ CLOG_ERROR(&LOG, "Object %s with Bone parent: bone %s doesn't exist", ob->id.name + 2, ob->parsubstr);
unit_m4(mat);
return;
}
@@ -2017,7 +2251,7 @@ static void give_parvert(Object *par, int nr, float vec[3])
if (par->type == OB_MESH) {
Mesh *me = par->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
Mesh *me_eval = (em) ? em->mesh_eval_final : par->runtime.mesh_eval;
if (me_eval) {
@@ -2074,9 +2308,8 @@ static void give_parvert(Object *par, int nr, float vec[3])
}
}
else {
- fprintf(stderr,
- "%s: Evaluated mesh is needed to solve parenting, "
- "object position can be wrong now\n", __func__);
+ CLOG_ERROR(&LOG, "Evaluated mesh is needed to solve parenting, "
+ "object position can be wrong now");
}
}
else if (ELEM(par->type, OB_CURVE, OB_SURF)) {
@@ -2141,9 +2374,7 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4])
}
}
-void BKE_object_get_parent_matrix_for_dupli(Object *ob, Object *par,
- float dupli_ctime, int dupli_transflag,
- float parentmat[4][4])
+void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4])
{
float tmat[4][4];
float vec[3];
@@ -2154,7 +2385,7 @@ void BKE_object_get_parent_matrix_for_dupli(Object *ob, Object *par,
ok = 0;
if (par->type == OB_CURVE) {
if ((((Curve *)par->data)->flag & CU_PATH) &&
- (ob_parcurve(ob, par, dupli_ctime, dupli_transflag, tmat)))
+ (ob_parcurve(ob, par, tmat)))
{
ok = 1;
}
@@ -2184,20 +2415,13 @@ void BKE_object_get_parent_matrix_for_dupli(Object *ob, Object *par,
copy_m4_m4(parentmat, par->obmat);
break;
}
-
-}
-
-void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4])
-{
- BKE_object_get_parent_matrix_for_dupli(ob, par, 0, 0, parentmat);
}
/**
* \param r_originmat: Optional matrix that stores the space the object is in (without its own matrix applied)
*/
-static void solve_parenting(Object *ob, Object *par, float obmat[4][4], float slowmat[4][4],
- float r_originmat[3][3], const bool set_origin,
- float dupli_ctime, int dupli_transflag)
+static void solve_parenting(Object *ob, Object *par, float obmat[4][4],
+ float r_originmat[3][3], const bool set_origin)
{
float totmat[4][4];
float tmat[4][4];
@@ -2205,9 +2429,7 @@ static void solve_parenting(Object *ob, Object *par, float obmat[4][4], float sl
BKE_object_to_mat4(ob, locmat);
- if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat);
-
- BKE_object_get_parent_matrix_for_dupli(ob, par, dupli_ctime, dupli_transflag, totmat);
+ BKE_object_get_parent_matrix(ob, par, totmat);
/* total */
mul_m4_m4m4(tmat, totmat, ob->parentinv);
@@ -2221,59 +2443,24 @@ static void solve_parenting(Object *ob, Object *par, float obmat[4][4], float sl
/* origin, for help line */
if (set_origin) {
if ((ob->partype & PARTYPE) == PARSKEL) {
- copy_v3_v3(ob->orig, par->obmat[3]);
+ copy_v3_v3(ob->runtime.parent_display_origin, par->obmat[3]);
}
else {
- copy_v3_v3(ob->orig, totmat[3]);
+ copy_v3_v3(ob->runtime.parent_display_origin, totmat[3]);
}
}
}
-static bool where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4])
-{
- float *fp1, *fp2;
- float fac1, fac2;
- int a;
-
- /* include framerate */
- fac1 = (1.0f / (1.0f + fabsf(ob->sf)));
- if (fac1 >= 1.0f) return false;
- fac2 = 1.0f - fac1;
-
- fp1 = obmat[0];
- fp2 = slowmat[0];
- for (a = 0; a < 16; a++, fp1++, fp2++) {
- fp1[0] = fac1 * fp1[0] + fac2 * fp2[0];
- }
-
- return true;
-}
-
/* note, scene is the active scene while actual_scene is the scene the object resides in */
-void BKE_object_where_is_calc_time_ex(
- Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime, int dupli_transflag,
+static void object_where_is_calc_ex(
+ Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime,
RigidBodyWorld *rbw, float r_originmat[3][3])
{
- if (ob == NULL) return;
-
- /* execute drivers only, as animation has already been done */
- BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS);
-
if (ob->parent) {
Object *par = ob->parent;
- float slowmat[4][4];
/* calculate parent matrix */
- solve_parenting(ob, par, ob->obmat, slowmat, r_originmat, true,
- ctime, dupli_transflag);
-
- /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around
- * An old-fashioned hack which probably doesn't really cut it anymore
- */
- if (ob->partype & PARSLOW) {
- if (!where_is_object_parslow(ob, ob->obmat, slowmat))
- return;
- }
+ solve_parenting(ob, par, ob->obmat, r_originmat, true);
}
else {
BKE_object_to_mat4(ob, ob->obmat);
@@ -2299,32 +2486,20 @@ void BKE_object_where_is_calc_time_ex(
void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime)
{
- BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, 0, NULL, NULL);
-}
-
-void BKE_object_where_is_calc_time_for_dupli(
- Depsgraph *depsgraph, Scene *scene, struct Object *ob, float ctime, int dupli_transflag)
-{
- BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, dupli_transflag, NULL, NULL);
+ /* Execute drivers and animation. */
+ BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
+ object_where_is_calc_ex(depsgraph, scene, ob, ctime, NULL, NULL);
}
-
/* get object transformation matrix without recalculating dependencies and
* constraints -- assume dependencies are already solved by depsgraph.
* no changes to object and it's parent would be done.
* used for bundles orientation in 3d space relative to parented blender camera */
void BKE_object_where_is_calc_mat4(Object *ob, float obmat[4][4])
{
-
if (ob->parent) {
- float slowmat[4][4];
-
Object *par = ob->parent;
-
- solve_parenting(ob, par, obmat, slowmat, NULL, false, 0.0f, 0);
-
- if (ob->partype & PARSLOW)
- where_is_object_parslow(ob, obmat, slowmat);
+ solve_parenting(ob, par, obmat, NULL, false);
}
else {
BKE_object_to_mat4(ob, obmat);
@@ -2333,11 +2508,13 @@ void BKE_object_where_is_calc_mat4(Object *ob, float obmat[4][4])
void BKE_object_where_is_calc_ex(Depsgraph *depsgraph, Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3])
{
- BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), 0, rbw, r_originmat);
+ float ctime = DEG_get_ctime(depsgraph);
+ object_where_is_calc_ex(depsgraph, scene, ob, ctime, rbw, r_originmat);
}
void BKE_object_where_is_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
- BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), 0, NULL, NULL);
+ float ctime = DEG_get_ctime(depsgraph);
+ object_where_is_calc_ex(depsgraph, scene, ob, ctime, NULL, NULL);
}
/**
@@ -2350,7 +2527,6 @@ void BKE_object_where_is_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
*/
void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *ob, Object *workob)
{
- Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
BKE_object_workob_clear(workob);
unit_m4(workob->obmat);
@@ -2360,17 +2536,17 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o
/* Since this is used while calculating parenting, at this moment ob_eval->parent is still NULL. */
workob->parent = DEG_get_evaluated_object(depsgraph, ob->parent);
- workob->trackflag = ob_eval->trackflag;
- workob->upflag = ob_eval->upflag;
+ workob->trackflag = ob->trackflag;
+ workob->upflag = ob->upflag;
- workob->partype = ob_eval->partype;
- workob->par1 = ob_eval->par1;
- workob->par2 = ob_eval->par2;
- workob->par3 = ob_eval->par3;
+ workob->partype = ob->partype;
+ workob->par1 = ob->par1;
+ workob->par2 = ob->par2;
+ workob->par3 = ob->par3;
- workob->constraints = ob_eval->constraints;
+ workob->constraints = ob->constraints;
- BLI_strncpy(workob->parsubstr, ob_eval->parsubstr, sizeof(workob->parsubstr));
+ BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr));
BKE_object_where_is_calc(depsgraph, scene, workob);
}
@@ -2398,19 +2574,19 @@ void BKE_object_apply_mat4_ex(Object *ob, float mat[4][4], Object *parent, float
mul_m4_m4m4(rmat, imat, mat); /* get the parent relative matrix */
/* same as below, use rmat rather than mat */
- mat4_to_loc_rot_size(ob->loc, rot, ob->size, rmat);
+ mat4_to_loc_rot_size(ob->loc, rot, ob->scale, rmat);
}
else {
- mat4_to_loc_rot_size(ob->loc, rot, ob->size, mat);
+ mat4_to_loc_rot_size(ob->loc, rot, ob->scale, mat);
}
BKE_object_mat3_to_rot(ob, rot, use_compat);
sub_v3_v3(ob->loc, ob->dloc);
- if (ob->dscale[0] != 0.0f) ob->size[0] /= ob->dscale[0];
- if (ob->dscale[1] != 0.0f) ob->size[1] /= ob->dscale[1];
- if (ob->dscale[2] != 0.0f) ob->size[2] /= ob->dscale[2];
+ if (ob->dscale[0] != 0.0f) ob->scale[0] /= ob->dscale[0];
+ if (ob->dscale[1] != 0.0f) ob->scale[1] /= ob->dscale[1];
+ if (ob->dscale[2] != 0.0f) ob->scale[2] /= ob->dscale[2];
/* BKE_object_mat3_to_rot handles delta rotations */
}
@@ -2520,13 +2696,13 @@ void BKE_object_boundbox_calc_from_mesh(struct Object *ob, struct Mesh *me_eval)
zero_v3(max);
}
- if (ob->bb == NULL) {
- ob->bb = MEM_callocN(sizeof(BoundBox), "DM-BoundBox");
+ if (ob->runtime.bb == NULL) {
+ ob->runtime.bb = MEM_callocN(sizeof(BoundBox), "DM-BoundBox");
}
- BKE_boundbox_init_from_minmax(ob->bb, min, max);
+ BKE_boundbox_init_from_minmax(ob->runtime.bb, min, max);
- ob->bb->flag &= ~BOUNDBOX_DIRTY;
+ ob->runtime.bb->flag &= ~BOUNDBOX_DIRTY;
}
void BKE_object_dimensions_get(Object *ob, float vec[3])
@@ -2563,7 +2739,7 @@ void BKE_object_dimensions_set(Object *ob, const float value[3], int axis_mask)
for (int i = 0; i < 3; i++) {
if (((1 << i) & axis_mask) == 0) {
if (len[i] > 0.0f) {
- ob->size[i] = copysignf(value[i] / len[i], ob->size[i]);
+ ob->scale[i] = copysignf(value[i] / len[i], ob->scale[i]);
}
}
}
@@ -2635,8 +2811,8 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
if (changed == false) {
float size[3];
- copy_v3_v3(size, ob->size);
- if ((ob->type == OB_EMPTY) || (ob->type == OB_GPENCIL)) {
+ copy_v3_v3(size, ob->scale);
+ if (ob->type == OB_EMPTY) {
mul_v3_fl(size, ob->empty_drawsize);
}
@@ -2673,31 +2849,52 @@ void BKE_object_empty_draw_type_set(Object *ob, const int value)
}
}
-bool BKE_object_empty_image_is_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
+bool BKE_object_empty_image_frame_is_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
{
- char visibility_flag = ob->empty_image_visibility_flag;
+ const char visibility_flag = ob->empty_image_visibility_flag;
+ if (rv3d->is_persp) {
+ return (visibility_flag & OB_EMPTY_IMAGE_HIDE_PERSPECTIVE) == 0;
+ }
+ else {
+ return (visibility_flag & OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC) == 0;
+ }
+}
+
+bool BKE_object_empty_image_data_is_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
+{
+ /* Caller is expected to check this. */
+ BLI_assert(BKE_object_empty_image_frame_is_visible_in_view3d(ob, rv3d));
+
+ const char visibility_flag = ob->empty_image_visibility_flag;
if ((visibility_flag & (OB_EMPTY_IMAGE_HIDE_BACK | OB_EMPTY_IMAGE_HIDE_FRONT)) != 0) {
- /* TODO: this isn't correct with perspective projection. */
- const float dot = dot_v3v3((float *)&ob->obmat[2], (float *)&rv3d->viewinv[2]);
+ float eps, dot;
+ if (rv3d->is_persp) {
+ /* Note, we could normalize the 'view_dir' then use 'eps'
+ * however the issue with empty objects being visible when viewed from the side
+ * is only noticeable in orthographic views. */
+ float view_dir[3];
+ sub_v3_v3v3(view_dir, rv3d->viewinv[3], ob->obmat[3]);
+ dot = dot_v3v3(ob->obmat[2], view_dir);
+ eps = 0.0f;
+ }
+ else {
+ dot = dot_v3v3(ob->obmat[2], rv3d->viewinv[2]);
+ eps = 1e-5f;
+ }
if (visibility_flag & OB_EMPTY_IMAGE_HIDE_BACK) {
- if (dot < 0.0f) {
+ if (dot < eps) {
return false;
}
}
if (visibility_flag & OB_EMPTY_IMAGE_HIDE_FRONT) {
- if (dot > 0.0f) {
+ if (dot > -eps) {
return false;
}
}
}
- if (rv3d->is_persp) {
- return (visibility_flag & OB_EMPTY_IMAGE_HIDE_PERSPECTIVE) == 0;
- }
- else {
- return (visibility_flag & OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC) == 0;
- }
+ return true;
}
bool BKE_object_minmax_dupli(Depsgraph *depsgraph, Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden)
@@ -2785,16 +2982,25 @@ void BKE_scene_foreach_display_point(
/* copied from DNA_object_types.h */
typedef struct ObTfmBack {
- float loc[3], dloc[3], orig[3];
- float size[3], dscale[3]; /* scale and delta scale */
- float rot[3], drot[3]; /* euler rotation */
- float quat[4], dquat[4]; /* quaternion rotation */
- float rotAxis[3], drotAxis[3]; /* axis angle rotation - axis part */
- float rotAngle, drotAngle; /* axis angle rotation - angle part */
- float obmat[4][4]; /* final worldspace matrix with constraints & animsys applied */
- float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */
- float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */
- float imat[4][4]; /* inverse matrix of 'obmat' for during render, temporally: ipokeys of transform */
+ float loc[3], dloc[3];
+ /** scale and delta scale. */
+ float scale[3], dscale[3];
+ /** euler rotation. */
+ float rot[3], drot[3];
+ /** quaternion rotation. */
+ float quat[4], dquat[4];
+ /** axis angle rotation - axis part. */
+ float rotAxis[3], drotAxis[3];
+ /** axis angle rotation - angle part. */
+ float rotAngle, drotAngle;
+ /** final worldspace matrix with constraints & animsys applied. */
+ float obmat[4][4];
+ /** inverse result of parent, so that object doesn't 'stick' to parent. */
+ float parentinv[4][4];
+ /** inverse result of constraints. doesn't include effect of parent or object local transform. */
+ float constinv[4][4];
+ /** inverse matrix of 'obmat' for during render, temporally: ipokeys of transform. */
+ float imat[4][4];
} ObTfmBack;
void *BKE_object_tfm_backup(Object *ob)
@@ -2802,8 +3008,7 @@ void *BKE_object_tfm_backup(Object *ob)
ObTfmBack *obtfm = MEM_mallocN(sizeof(ObTfmBack), "ObTfmBack");
copy_v3_v3(obtfm->loc, ob->loc);
copy_v3_v3(obtfm->dloc, ob->dloc);
- copy_v3_v3(obtfm->orig, ob->orig);
- copy_v3_v3(obtfm->size, ob->size);
+ copy_v3_v3(obtfm->scale, ob->scale);
copy_v3_v3(obtfm->dscale, ob->dscale);
copy_v3_v3(obtfm->rot, ob->rot);
copy_v3_v3(obtfm->drot, ob->drot);
@@ -2826,8 +3031,7 @@ void BKE_object_tfm_restore(Object *ob, void *obtfm_pt)
ObTfmBack *obtfm = (ObTfmBack *)obtfm_pt;
copy_v3_v3(ob->loc, obtfm->loc);
copy_v3_v3(ob->dloc, obtfm->dloc);
- copy_v3_v3(ob->orig, obtfm->orig);
- copy_v3_v3(ob->size, obtfm->size);
+ copy_v3_v3(ob->scale, obtfm->scale);
copy_v3_v3(ob->dscale, obtfm->dscale);
copy_v3_v3(ob->rot, obtfm->rot);
copy_v3_v3(ob->drot, obtfm->drot);
@@ -2946,6 +3150,13 @@ void BKE_object_handle_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
BKE_object_handle_update_ex(depsgraph, scene, ob, NULL, true);
}
+void BKE_object_sculpt_data_create(Object *ob)
+{
+ BLI_assert((ob->sculpt == NULL) && (ob->mode & OB_MODE_ALL_SCULPT));
+ ob->sculpt = MEM_callocN(sizeof(SculptSession), __func__);
+ ob->sculpt->mode_type = ob->mode;
+}
+
void BKE_object_sculpt_modifiers_changed(Object *ob)
{
SculptSession *ss = ob->sculpt;
@@ -3276,7 +3487,7 @@ bool BKE_object_shapekey_free(Main *bmain, Object *ob)
key = *key_p;
*key_p = NULL;
- BKE_libblock_free_us(bmain, key);
+ BKE_id_free_us(bmain, key);
return false;
}
@@ -3557,6 +3768,18 @@ bool BKE_object_is_animated(Scene *scene, Object *ob)
return false;
}
+/** Return the number of scenes using (instantiating) that object in their collections. */
+int BKE_object_scenes_users_get(Main *bmain, Object *ob)
+{
+ int num_scenes = 0;
+ for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
+ if (BKE_collection_has_object_recursive(BKE_collection_master(scene), ob)) {
+ num_scenes++;
+ }
+ }
+ return num_scenes;
+}
+
MovieClip *BKE_object_movieclip_get(Scene *scene, Object *ob, bool use_default)
{
MovieClip *clip = use_default ? scene->clip : NULL;
@@ -3588,7 +3811,7 @@ void BKE_object_runtime_reset(Object *object)
}
/* Reset all pointers which we don't want to be shared when copying the object. */
-void BKE_object_runtime_reset_on_copy(Object *object)
+void BKE_object_runtime_reset_on_copy(Object *object, const int UNUSED(flag))
{
Object_Runtime *runtime = &object->runtime;
runtime->mesh_eval = NULL;
@@ -3657,8 +3880,8 @@ LinkNode *BKE_object_relational_superset(struct ViewLayer *view_layer, eObjectSe
obrel_list_add(&links, ob);
}
else {
- if ((objectSet == OB_SET_SELECTED && TESTBASELIB_BGMODE(((View3D *)NULL), base)) ||
- (objectSet == OB_SET_VISIBLE && BASE_EDITABLE_BGMODE(((View3D *)NULL), base)))
+ if ((objectSet == OB_SET_SELECTED && BASE_SELECTED_EDITABLE(((View3D *)NULL), base)) ||
+ (objectSet == OB_SET_VISIBLE && BASE_EDITABLE(((View3D *)NULL), base)))
{
Object *ob = base->object;
@@ -3688,7 +3911,7 @@ LinkNode *BKE_object_relational_superset(struct ViewLayer *view_layer, eObjectSe
if (includeFilter & (OB_REL_CHILDREN | OB_REL_CHILDREN_RECURSIVE)) {
Base *local_base;
for (local_base = view_layer->object_bases.first; local_base; local_base = local_base->next) {
- if (BASE_EDITABLE_BGMODE(((View3D *)NULL), local_base)) {
+ if (BASE_EDITABLE(((View3D *)NULL), local_base)) {
Object *child = local_base->object;
if (obrel_list_test(child)) {
@@ -4061,16 +4284,17 @@ bool BKE_object_modifier_update_subframe(
/* was originally ID_RECALC_ALL - TODO - which flags are really needed??? */
/* TODO(sergey): What about animation? */
ob->id.recalc |= ID_RECALC_ALL;
- BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, frame, ADT_RECALC_ANIM);
if (update_mesh) {
+ BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, frame, ADT_RECALC_ANIM);
/* ignore cache clear during subframe updates
* to not mess up cache validity */
object_cacheIgnoreClear(ob, 1);
BKE_object_handle_update(depsgraph, scene, ob);
object_cacheIgnoreClear(ob, 0);
}
- else
+ else {
BKE_object_where_is_calc_time(depsgraph, scene, ob, frame);
+ }
/* for curve following objects, parented curve has to be updated too */
if (ob->type == OB_CURVE) {
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
index 2e751668a40..e0be162024d 100644
--- a/source/blender/blenkernel/intern/object_deform.c
+++ b/source/blender/blenkernel/intern/object_deform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/object_deform.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
@@ -178,8 +174,8 @@ bool BKE_object_defgroup_clear(Object *ob, bDeformGroup *dg, const bool use_sele
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
if (cd_dvert_offset != -1) {
@@ -358,7 +354,7 @@ static void object_defgroup_remove_edit_mode(Object *ob, bDeformGroup *dg)
/* Else, make sure that any groups with higher indices are adjusted accordingly */
else if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
BMIter iter;
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 6cd0f412d06..1f3680eb850 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/object_dupli.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <limits.h>
@@ -128,7 +120,7 @@ static void copy_dupli_context(DupliContext *r_ctx, const DupliContext *ctx, Obj
/* XXX annoying, previously was done by passing an ID* argument, this at least is more explicit */
if (ctx->gen->type == OB_DUPLICOLLECTION)
- r_ctx->collection = ctx->object->dup_group;
+ r_ctx->collection = ctx->object->instance_collection;
r_ctx->object = ob;
if (mat)
@@ -241,7 +233,7 @@ static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChild
DupliContext pctx;
copy_dupli_context(&pctx, ctx, ctx->object, NULL, _base_id);
- /* mballs have a different dupli handling */
+ /* metaballs have a different dupli handling */
if (ob->type != OB_MBALL) {
ob->flag |= OB_DONE; /* doesn't render */
}
@@ -259,7 +251,7 @@ static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChild
DupliContext pctx;
copy_dupli_context(&pctx, ctx, ctx->object, NULL, baseid);
- /* mballs have a different dupli handling */
+ /* metaballs have a different dupli handling */
if (ob->type != OB_MBALL)
ob->flag |= OB_DONE; /* doesn't render */
@@ -279,12 +271,12 @@ static void make_duplis_collection(const DupliContext *ctx)
Collection *collection;
float collection_mat[4][4];
- if (ob->dup_group == NULL) return;
- collection = ob->dup_group;
+ if (ob->instance_collection == NULL) return;
+ collection = ob->instance_collection;
/* combine collection offset and obmat */
unit_m4(collection_mat);
- sub_v3_v3(collection_mat[3], collection->dupli_ofs);
+ sub_v3_v3(collection_mat[3], collection->instance_offset);
mul_m4_m4m4(collection_mat, ob->obmat, collection_mat);
/* don't access 'ob->obmat' from now on. */
@@ -311,78 +303,10 @@ static const DupliGenerator gen_dupli_collection = {
make_duplis_collection /* make_duplis */
};
-/* OB_DUPLIFRAMES */
-static void make_duplis_frames(const DupliContext *ctx)
-{
- Depsgraph *depsgraph = ctx->depsgraph;
- Scene *scene = ctx->scene;
- Object *ob = ctx->object;
- Object copyob;
- int dupend = ob->dupend;
-
- /* dupliframes not supported inside collections */
- if (ctx->collection)
- return;
- /* if we don't have any data/settings which will lead to object movement,
- * don't waste time trying, as it will all look the same...
- */
- if (ob->parent == NULL && BLI_listbase_is_empty(&ob->constraints) && ob->adt == NULL)
- return;
-
- /* make a copy of the object's original data (before any dupli-data overwrites it)
- * as we'll need this to keep track of unkeyed data
- * - this doesn't take into account other data that can be reached from the object,
- * for example it's shapekeys or bones, hence the need for an update flush at the end
- */
- copyob = *ob;
-
- /* duplicate over the required range */
- const int dupli_transflag = (ob->transflag & OB_DUPLINOSPEED);
- for (int frame = ob->dupsta; frame <= dupend; frame++) {
- int ok = 1;
-
- /* - dupoff = how often a frames within the range shouldn't be made into duplis
- * - dupon = the length of each "skipping" block in frames
- */
- if (ob->dupoff) {
- ok = frame - ob->dupsta;
- ok = ok % (ob->dupon + ob->dupoff);
- ok = (ok < ob->dupon);
- }
-
- if (ok) {
- /* WARNING: doing animation updates in this way is not terribly accurate, as the dependencies
- * and/or other objects which may affect this object's transforms are not updated either.
- * However, this has always been the way that this worked (i.e. pre 2.5), so I guess that it'll be fine!
- */
- /* ob-eval will do drivers, so we don't need to do them */
- BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, (float)frame, ADT_RECALC_ANIM);
- BKE_object_where_is_calc_time_for_dupli(depsgraph, scene, ob, (float)frame, dupli_transflag);
-
- make_dupli(ctx, ob, ob->obmat, frame);
- }
- }
-
- /* ob-eval will do drivers, so we don't need to do them */
- const float original_ctime = DEG_get_ctime(depsgraph);
- BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, original_ctime, ADT_RECALC_ANIM);
- BKE_object_where_is_calc_time(depsgraph, scene, ob, original_ctime);
-
- /* but, to make sure unkeyed object transforms are still sane,
- * let's copy object's original data back over
- */
- *ob = copyob;
-}
-
-static const DupliGenerator gen_dupli_frames = {
- OB_DUPLIFRAMES, /* type */
- make_duplis_frames /* make_duplis */
-};
-
/* OB_DUPLIVERTS */
typedef struct VertexDupliData {
Mesh *me_eval;
- BMEditMesh *edit_btmesh;
+ BMEditMesh *edit_mesh;
int totvert;
float (*orco)[3];
bool use_rotation;
@@ -464,9 +388,7 @@ static void make_child_duplis_verts(const DupliContext *ctx, void *userdata, Obj
static void make_duplis_verts(const DupliContext *ctx)
{
- Scene *scene = ctx->scene;
Object *parent = ctx->object;
- bool use_texcoords = (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER);
VertexDupliData vdd;
vdd.ctx = ctx;
@@ -474,25 +396,24 @@ static void make_duplis_verts(const DupliContext *ctx)
/* gather mesh info */
{
- CustomDataMask dm_mask = (use_texcoords ? CD_MASK_BAREMESH | CD_MASK_ORCO : CD_MASK_BAREMESH);
- vdd.edit_btmesh = BKE_editmesh_from_object(parent);
-
- /* We do not need any render-smecific handling anymore, depsgraph takes care of that. */
- if (vdd.edit_btmesh != NULL) {
- /* XXX TODO replace with equivalent of editbmesh_get_eval_cage when available. */
- vdd.me_eval = mesh_get_eval_deform(ctx->depsgraph, scene, parent, dm_mask);
+ vdd.edit_mesh = BKE_editmesh_from_object(parent);
+
+ /* We do not need any render-specific handling anymore, depsgraph takes care of that. */
+ /* NOTE: Do direct access to the evaluated mesh: this function is used
+ * during meta balls evaluation. But even without those all the objects
+ * which are needed for correct instancing are already evaluated. */
+ if (vdd.edit_mesh != NULL) {
+ vdd.me_eval = vdd.edit_mesh->mesh_eval_cage;
}
else {
- vdd.me_eval = mesh_get_eval_final(ctx->depsgraph, scene, parent, dm_mask);
+ vdd.me_eval = parent->runtime.mesh_eval;
}
- if (use_texcoords) {
- vdd.orco = CustomData_get_layer(&vdd.me_eval->vdata, CD_ORCO);
- }
- else {
- vdd.orco = NULL;
+ if (vdd.me_eval == NULL) {
+ return;
}
+ vdd.orco = CustomData_get_layer(&vdd.me_eval->vdata, CD_ORCO);
vdd.totvert = vdd.me_eval->totvert;
}
@@ -524,7 +445,7 @@ static Object *find_family_object(Main *bmain, const char *family, size_t family
ch_utf8[ch_utf8_len] = '\0';
ch_utf8_len += 1; /* compare with null terminator */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (STREQLEN(ob->id.name + 2 + family_len, ch_utf8, ch_utf8_len)) {
if (STREQLEN(ob->id.name + 2, family, family_len)) {
break;
@@ -671,7 +592,6 @@ static void make_child_duplis_faces(const DupliContext *ctx, void *userdata, Obj
float (*orco)[3] = fdd->orco;
MLoopUV *mloopuv = fdd->mloopuv;
int a, totface = fdd->totface;
- bool use_texcoords = (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER);
float child_imat[4][4];
DupliObject *dob;
@@ -687,7 +607,7 @@ static void make_child_duplis_faces(const DupliContext *ctx, void *userdata, Obj
continue;
/* obmat is transform to face */
- get_dupliface_transform(mp, loopstart, mvert, fdd->use_scale, ctx->object->dupfacesca, obmat);
+ get_dupliface_transform(mp, loopstart, mvert, fdd->use_scale, ctx->object->instance_faces_scale, obmat);
/* make offset relative to inst_ob using relative child transform */
mul_mat3_m4_v3(child_imat, obmat[3]);
@@ -710,21 +630,16 @@ static void make_child_duplis_faces(const DupliContext *ctx, void *userdata, Obj
mul_m4_m4m4(space_mat, obmat, inst_ob->imat);
dob = make_dupli(ctx, inst_ob, obmat, a);
- if (use_texcoords) {
- float w = 1.0f / (float)mp->totloop;
- if (orco) {
- int j;
- for (j = 0; j < mp->totloop; j++) {
- madd_v3_v3fl(dob->orco, orco[loopstart[j].v], w);
- }
+ const float w = 1.0f / (float)mp->totloop;
+ if (orco) {
+ for (int j = 0; j < mp->totloop; j++) {
+ madd_v3_v3fl(dob->orco, orco[loopstart[j].v], w);
}
-
- if (mloopuv) {
- int j;
- for (j = 0; j < mp->totloop; j++) {
- madd_v2_v2fl(dob->uv, mloopuv[mp->loopstart + j].uv, w);
- }
+ }
+ if (mloopuv) {
+ for (int j = 0; j < mp->totloop; j++) {
+ madd_v2_v2fl(dob->uv, mloopuv[mp->loopstart + j].uv, w);
}
}
@@ -735,9 +650,7 @@ static void make_child_duplis_faces(const DupliContext *ctx, void *userdata, Obj
static void make_duplis_faces(const DupliContext *ctx)
{
- Scene *scene = ctx->scene;
Object *parent = ctx->object;
- bool use_texcoords = (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER);
FaceDupliData fdd;
fdd.use_scale = ((parent->transflag & OB_DUPLIFACES_SCALE) != 0);
@@ -745,27 +658,26 @@ static void make_duplis_faces(const DupliContext *ctx)
/* gather mesh info */
{
BMEditMesh *em = BKE_editmesh_from_object(parent);
- CustomDataMask dm_mask = (use_texcoords ? CD_MASK_BAREMESH | CD_MASK_ORCO | CD_MASK_MLOOPUV : CD_MASK_BAREMESH);
/* We do not need any render-smecific handling anymore, depsgraph takes care of that. */
+ /* NOTE: Do direct access to the evaluated mesh: this function is used
+ * during meta balls evaluation. But even without those all the objects
+ * which are needed for correct instancing are already evaluated. */
if (em != NULL) {
- /* XXX TODO replace with equivalent of editbmesh_get_eval_cage when available. */
- fdd.me_eval = mesh_get_eval_deform(ctx->depsgraph, scene, parent, dm_mask);
+ fdd.me_eval = em->mesh_eval_cage;
}
else {
- fdd.me_eval = mesh_get_eval_final(ctx->depsgraph, scene, parent, dm_mask);
+ fdd.me_eval = parent->runtime.mesh_eval;
}
- if (use_texcoords) {
- fdd.orco = CustomData_get_layer(&fdd.me_eval->vdata, CD_ORCO);
- const int uv_idx = CustomData_get_render_layer(&fdd.me_eval->ldata, CD_MLOOPUV);
- fdd.mloopuv = CustomData_get_layer_n(&fdd.me_eval->ldata, CD_MLOOPUV, uv_idx);
- }
- else {
- fdd.orco = NULL;
- fdd.mloopuv = NULL;
+ if (fdd.me_eval == NULL) {
+ return;
}
+ fdd.orco = CustomData_get_layer(&fdd.me_eval->vdata, CD_ORCO);
+ const int uv_idx = CustomData_get_render_layer(&fdd.me_eval->ldata, CD_MLOOPUV);
+ fdd.mloopuv = CustomData_get_layer_n(&fdd.me_eval->ldata, CD_MLOOPUV, uv_idx);
+
fdd.totface = fdd.me_eval->totpoly;
fdd.mpoly = fdd.me_eval->mpoly;
fdd.mloop = fdd.me_eval->mloop;
@@ -789,9 +701,8 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
Object *par = ctx->object;
eEvaluationMode mode = DEG_get_mode(ctx->depsgraph);
bool for_render = mode == DAG_EVAL_RENDER;
- bool use_texcoords = for_render;
- Object *ob = NULL, **oblist = NULL, obcopy, *obcopylist = NULL;
+ Object *ob = NULL, **oblist = NULL;
DupliObject *dob;
ParticleDupliWeight *dw;
ParticleSettings *part;
@@ -799,9 +710,8 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
ChildParticle *cpa = NULL;
ParticleKey state;
ParticleCacheKey *cache;
- float ctime, pa_time, scale = 1.0f;
- float tmat[4][4], mat[4][4], pamat[4][4], vec[3], size = 0.0;
- float (*obmat)[4];
+ float ctime, scale = 1.0f;
+ float tmat[4][4], mat[4][4], pamat[4][4], size = 0.0;
int a, b, hair = 0;
int totpart, totchild;
@@ -837,14 +747,14 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
/* 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 (ELEM(part->instance_object, NULL, par))
return;
}
else { /*PART_DRAW_GR */
- if (part->dup_group == NULL)
+ if (part->instance_collection == NULL)
return;
- const ListBase dup_collection_objects = BKE_collection_object_cache_get(part->dup_group);
+ const ListBase dup_collection_objects = BKE_collection_object_cache_get(part->instance_collection);
if (BLI_listbase_is_empty(&dup_collection_objects))
return;
@@ -876,8 +786,8 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
if (part->draw & PART_DRAW_COUNT_GR) {
psys_find_group_weights(part);
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
- FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
+ for (dw = part->instance_weights.first; dw; dw = dw->next) {
+ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object, mode)
{
if (dw->ob == object) {
totcollection += dw->count;
@@ -888,7 +798,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
}
}
else {
- FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
+ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object, mode)
{
(void) object;
totcollection++;
@@ -896,20 +806,16 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END;
}
- /* we also copy the actual objects to restore afterwards, since
- * BKE_object_where_is_calc_time will change the object which breaks transform */
oblist = MEM_callocN((size_t)totcollection * sizeof(Object *), "dupcollection object list");
- obcopylist = MEM_callocN((size_t)totcollection * sizeof(Object), "dupcollection copy list");
if (part->draw & PART_DRAW_COUNT_GR) {
a = 0;
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
- FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
+ for (dw = part->instance_weights.first; dw; dw = dw->next) {
+ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object, mode)
{
if (dw->ob == object) {
for (b = 0; b < dw->count; b++, a++) {
oblist[a] = dw->ob;
- obcopylist[a] = *dw->ob;
}
break;
}
@@ -919,18 +825,16 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
}
else {
a = 0;
- FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
+ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object, mode)
{
oblist[a] = object;
- obcopylist[a] = *object;
a++;
}
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END;
}
}
else {
- ob = part->dup_ob;
- obcopy = *ob;
+ ob = part->instance_object;
}
if (totchild == 0 || part->draw & PART_DRAW_PARENT)
@@ -945,7 +849,6 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
continue;
/* pa_num = pa->num; */ /* UNUSED */
- pa_time = pa->time;
size = pa->size;
}
else {
@@ -953,7 +856,6 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
cpa = &psys->child[a - totpart];
/* pa_num = a; */ /* UNUSED */
- pa_time = psys->particles[cpa->parent].time;
size = psys_get_child_size(psys, cpa, ctime, NULL);
}
@@ -977,10 +879,6 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
b = a % totcollection;
ob = oblist[b];
- obmat = oblist[b]->obmat;
- }
- else {
- obmat = ob->obmat;
}
if (hair) {
@@ -1015,7 +913,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
if (part->ren_as == PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
b = 0;
- FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
+ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object, mode)
{
copy_m4_m4(tmat, oblist[b]->obmat);
@@ -1024,8 +922,8 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
mul_v3_fl(tmat[3], size * scale);
/* collection dupli offset, should apply after everything else */
- if (!is_zero_v3(part->dup_group->dupli_ofs)) {
- sub_v3_v3(tmat[3], part->dup_group->dupli_ofs);
+ if (!is_zero_v3(part->instance_collection->instance_offset)) {
+ sub_v3_v3(tmat[3], part->instance_collection->instance_offset);
}
/* individual particle transform */
@@ -1034,20 +932,19 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
dob = make_dupli(ctx, object, mat, a);
dob->particle_system = psys;
- if (use_texcoords) {
- psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
- }
+ psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
b++;
}
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END;
}
else {
- /* to give ipos in object correct offset */
- BKE_object_where_is_calc_time(ctx->depsgraph, scene, ob, ctime - pa_time);
+ float obmat[4][4];
+ copy_m4_m4(obmat, ob->obmat);
+ float vec[3];
copy_v3_v3(vec, obmat[3]);
- obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f;
+ zero_v3(obmat[3]);
/* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */
if ((part->draw & PART_DRAW_ROTATE_OB) == 0) {
@@ -1087,27 +984,16 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
dob = make_dupli(ctx, ob, mat, a);
dob->particle_system = psys;
- if (use_texcoords)
- psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
+ psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
}
}
- /* restore objects since they were changed in BKE_object_where_is_calc_time */
- if (part->ren_as == PART_DRAW_GR) {
- for (a = 0; a < totcollection; a++)
- *(oblist[a]) = obcopylist[a];
- }
- else
- *ob = obcopy;
-
BLI_rng_free(rng);
}
/* clean up */
if (oblist)
MEM_freeN(oblist);
- if (obcopylist)
- MEM_freeN(obcopylist);
if (psys->lattice_deform_data) {
end_latt_deform(psys->lattice_deform_data);
@@ -1164,9 +1050,6 @@ static const DupliGenerator *get_dupli_generator(const DupliContext *ctx)
if (ctx->object->type == OB_MESH)
return &gen_dupli_faces;
}
- else if (transflag & OB_DUPLIFRAMES) {
- return &gen_dupli_frames;
- }
else if (transflag & OB_DUPLICOLLECTION) {
return &gen_dupli_collection;
}
@@ -1196,33 +1079,3 @@ void free_object_duplilist(ListBase *lb)
BLI_freelistN(lb);
MEM_freeN(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) {
- ParticleSystem *psys = ob->particlesystem.first;
- int pdup = 0;
-
- for (; psys; psys = psys->next)
- pdup += psys->totpart;
-
- if (pdup == 0) {
- Mesh *me = ob->data;
- return me->totvert;
- }
- else
- return pdup;
- }
- }
- }
- else if (ob->transflag & OB_DUPLIFRAMES) {
- int tot = ob->dupend - ob->dupsta;
- tot /= (ob->dupon + ob->dupoff);
- return tot * ob->dupon;
- }
- }
- return 1;
-}
diff --git a/source/blender/blenkernel/intern/object_facemap.c b/source/blender/blenkernel/intern/object_facemap.c
index ef254864d2e..19f0b77342a 100644
--- a/source/blender/blenkernel/intern/object_facemap.c
+++ b/source/blender/blenkernel/intern/object_facemap.c
@@ -1,7 +1,4 @@
-
/*
- * ***** 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
@@ -18,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/object_facemap.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <string.h>
@@ -35,12 +27,10 @@
#include "DNA_mesh_types.h"
#include "BLI_utildefines.h"
-#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_utils.h"
#include "BLI_listbase.h"
-#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_editmesh.h"
#include "BKE_object.h"
@@ -142,8 +132,8 @@ static void object_fmap_remove_edit_mode(Object *ob, bFaceMap *fmap, bool do_sel
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
const int cd_fmap_offset = CustomData_get_offset(&em->bm->pdata, CD_FACEMAP);
if (cd_fmap_offset != -1) {
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index a159e713d01..304c9985f10 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 20014 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/object_update.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_anim_types.h"
@@ -48,13 +42,11 @@
#include "BKE_displist.h"
#include "BKE_editmesh.h"
#include "BKE_effect.h"
-#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_key.h"
-#include "BKE_lamp.h"
+#include "BKE_layer.h"
+#include "BKE_light.h"
#include "BKE_lattice.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mball.h"
#include "BKE_mesh.h"
@@ -115,10 +107,10 @@ void BKE_object_eval_parent(Depsgraph *depsgraph, Object *ob)
/* origin, for help line */
if ((ob->partype & PARTYPE) == PARSKEL) {
- copy_v3_v3(ob->orig, par->obmat[3]);
+ copy_v3_v3(ob->runtime.parent_display_origin, par->obmat[3]);
}
else {
- copy_v3_v3(ob->orig, totmat[3]);
+ copy_v3_v3(ob->runtime.parent_display_origin, totmat[3]);
}
}
@@ -148,7 +140,9 @@ void BKE_object_eval_constraints(Depsgraph *depsgraph,
void BKE_object_eval_transform_final(Depsgraph *depsgraph, Object *ob)
{
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
-
+ /* Make sure inverse matrix is always up to date. This way users of it
+ * do not need to worry about relcalculating it. */
+ invert_m4_m4(ob->imat, ob->obmat);
/* Set negative scale flag in object. */
if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
else ob->transflag &= ~OB_NEG_SCALE;
@@ -159,27 +153,8 @@ void BKE_object_handle_data_update(
Scene *scene,
Object *ob)
{
- ID *data_id = (ID *)ob->data;
- AnimData *adt = BKE_animdata_from_id(data_id);
- Key *key;
- float ctime = BKE_scene_frame_get(scene);
-
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
- /* TODO(sergey): Only used by legacy depsgraph. */
- if (adt) {
- /* evaluate drivers - datalevel */
- /* XXX: for mesh types, should we push this to evaluated mesh instead? */
- BKE_animsys_evaluate_animdata(depsgraph, scene, data_id, adt, ctime, ADT_RECALC_DRIVERS);
- }
-
- /* TODO(sergey): Only used by legacy depsgraph. */
- key = BKE_key_from_object(ob);
- if (key && key->block.first) {
- if (!(ob->shapeflag & OB_SHAPE_LOCK))
- BKE_animsys_evaluate_animdata(depsgraph, scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
- }
-
/* includes all keys and modifiers */
switch (ob->type) {
case OB_MESH:
@@ -187,24 +162,26 @@ void BKE_object_handle_data_update(
#if 0
BMEditMesh *em = (ob->mode & OB_MODE_EDIT) ? BKE_editmesh_from_object(ob) : NULL;
#else
- BMEditMesh *em = (ob->mode & OB_MODE_EDIT) ? ((Mesh *)ob->data)->edit_btmesh : NULL;
+ BMEditMesh *em = (ob->mode & OB_MODE_EDIT) ? ((Mesh *)ob->data)->edit_mesh : NULL;
if (em && em->ob != ob) {
em = NULL;
}
#endif
- uint64_t data_mask = scene->customdata_mask | CD_MASK_BAREMESH;
+ CustomData_MeshMasks cddata_masks = scene->customdata_mask;
+ CustomData_MeshMasks_update(&cddata_masks, &CD_MASK_BAREMESH);
#ifdef WITH_FREESTYLE
/* make sure Freestyle edge/face marks appear in DM for render (see T40315) */
if (DEG_get_mode(depsgraph) != DAG_EVAL_VIEWPORT) {
- data_mask |= CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE;
+ cddata_masks.emask |= CD_MASK_FREESTYLE_EDGE;
+ cddata_masks.pmask |= CD_MASK_FREESTYLE_FACE;
}
#endif
if (em) {
- makeDerivedMesh(depsgraph, scene, ob, em, data_mask, false); /* was CD_MASK_BAREMESH */
+ makeDerivedMesh(depsgraph, scene, ob, em, &cddata_masks, false); /* was CD_MASK_BAREMESH */
}
else {
- makeDerivedMesh(depsgraph, scene, ob, NULL, data_mask, false);
+ makeDerivedMesh(depsgraph, scene, ob, NULL, &cddata_masks, false);
}
break;
}
@@ -227,18 +204,12 @@ void BKE_object_handle_data_update(
case OB_CURVE:
case OB_SURF:
case OB_FONT:
- BKE_displist_make_curveTypes(depsgraph, scene, ob, false, false);
+ BKE_displist_make_curveTypes(depsgraph, scene, ob, false, false, NULL);
break;
case OB_LATTICE:
BKE_lattice_modifiers_calc(depsgraph, scene, ob);
break;
-
- case OB_EMPTY:
- if (ob->empty_drawtype == OB_EMPTY_IMAGE && ob->data)
- if (BKE_image_is_animated(ob->data))
- BKE_image_user_check_frame_calc(ob->iuser, (int)ctime);
- break;
}
/* particles */
@@ -251,8 +222,8 @@ void BKE_object_handle_data_update(
if (psys_check_enabled(ob, psys, use_render_params)) {
/* check use of dupli objects here */
if (psys->part && (psys->part->draw_as == PART_DRAW_REND || use_render_params) &&
- ((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob) ||
- (psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
+ ((psys->part->ren_as == PART_DRAW_OB && psys->part->instance_object) ||
+ (psys->part->ren_as == PART_DRAW_GR && psys->part->instance_collection)))
{
ob->transflag |= OB_DUPLIPARTS;
}
@@ -283,10 +254,10 @@ void BKE_object_eval_boundbox(Depsgraph *depsgraph, Object *object)
Object *ob_orig = DEG_get_original_object(object);
BoundBox *bb = BKE_object_boundbox_get(object);
if (bb != NULL) {
- if (ob_orig->bb == NULL) {
- ob_orig->bb = MEM_mallocN(sizeof(*ob_orig->bb), __func__);
+ if (ob_orig->runtime.bb == NULL) {
+ ob_orig->runtime.bb = MEM_mallocN(sizeof(*ob_orig->runtime.bb), __func__);
}
- *ob_orig->bb = *bb;
+ *ob_orig->runtime.bb = *bb;
}
}
@@ -300,6 +271,7 @@ void BKE_object_synchronize_to_original(Depsgraph *depsgraph, Object *object)
object_orig->base_flag = object->base_flag;
/* Transformation flags. */
copy_m4_m4(object_orig->obmat, object->obmat);
+ copy_m4_m4(object_orig->imat, object->imat);
copy_m4_m4(object_orig->constinv, object->constinv);
object_orig->transflag = object->transflag;
object_orig->flag = object->flag;
@@ -330,8 +302,8 @@ bool BKE_object_eval_proxy_copy(Depsgraph *depsgraph,
invert_m4_m4(imat, obg->obmat);
mul_m4_m4m4(object->obmat, imat, object->proxy_from->obmat);
/* Should always be true. */
- if (obg->dup_group) {
- add_v3_v3(object->obmat[3], obg->dup_group->dupli_ofs);
+ if (obg->instance_collection) {
+ add_v3_v3(object->obmat[3], obg->instance_collection->instance_offset);
}
}
else {
@@ -436,10 +408,10 @@ void BKE_object_data_select_update(Depsgraph *depsgraph, ID *object_data)
}
}
-void BKE_object_eval_flush_base_flags(Depsgraph *depsgraph,
- Scene *scene, const int view_layer_index,
- Object *object, int base_index,
- const bool is_from_set)
+void BKE_object_eval_eval_base_flags(Depsgraph *depsgraph,
+ Scene *scene, const int view_layer_index,
+ Object *object, int base_index,
+ const bool is_from_set)
{
/* TODO(sergey): Avoid list lookup. */
BLI_assert(view_layer_index >= 0);
@@ -453,6 +425,29 @@ void BKE_object_eval_flush_base_flags(Depsgraph *depsgraph,
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
+ /* Visibility based on depsgraph mode. */
+ const eEvaluationMode mode = DEG_get_mode(depsgraph);
+ const int base_enabled_flag = (mode == DAG_EVAL_VIEWPORT)
+ ? BASE_ENABLED_VIEWPORT
+ : BASE_ENABLED_RENDER;
+
+ BKE_base_eval_flags(base);
+
+ /* Compute visibility for depsgraph evaluation mode. */
+ if (base->flag & base_enabled_flag) {
+ /* When rendering, visibility is controlled by the enable/disable option. */
+ if (mode == DAG_EVAL_RENDER) {
+ base->flag |= BASE_VISIBLE;
+ }
+ }
+ else {
+ base->flag &= ~(BASE_VISIBLE | BASE_SELECTABLE);
+ }
+ /* If base is not selectable, clear select. */
+ if ((base->flag & BASE_SELECTABLE) == 0) {
+ base->flag &= ~BASE_SELECTED;
+ }
+
/* Copy flags and settings from base. */
object->base_flag = base->flag;
if (is_from_set) {
@@ -469,4 +464,12 @@ void BKE_object_eval_flush_base_flags(Depsgraph *depsgraph,
BKE_particle_batch_cache_dirty_tag(psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
}
}
+
+ /* Copy base flag back to the original view layer for editing. */
+ if (DEG_is_active(depsgraph) && (view_layer == DEG_get_evaluated_view_layer(depsgraph))) {
+ Base *base_orig = base->base_orig;
+ BLI_assert(base_orig != NULL);
+ BLI_assert(base_orig->object != NULL);
+ base_orig->flag = base->flag;
+ }
}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index adbe1a7f889..9d5488bb8d3 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -18,15 +16,12 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * Contributors: Matt Ebb, Hamed Zaghaghi
* Based on original code by Drew Whitehouse / Houdini Ocean Toolkit
* OpenMP hints by Christian Schnellhammer
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/ocean.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <math.h>
diff --git a/source/blender/blenkernel/intern/outliner_treehash.c b/source/blender/blenkernel/intern/outliner_treehash.c
index fb62645ef43..e524cd0b642 100644
--- a/source/blender/blenkernel/intern/outliner_treehash.c
+++ b/source/blender/blenkernel/intern/outliner_treehash.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation 2013
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file outliner_treehash.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Tree hash for the outliner space.
*/
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 0446b697c68..a039e0544d5 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/packedFile.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -52,9 +44,7 @@
#include "BLI_utildefines.h"
#include "BKE_font.h"
-#include "BKE_global.h"
#include "BKE_image.h"
-#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_packedFile.h"
#include "BKE_report.h"
@@ -128,15 +118,15 @@ 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)
+ for (ima = bmain->images.first; ima; ima = ima->id.next)
if (BKE_image_has_packedfile(ima))
count ++;
- for (vf = bmain->vfont.first; vf; vf = vf->id.next)
+ for (vf = bmain->fonts.first; vf; vf = vf->id.next)
if (vf->packedfile)
count++;
- for (sound = bmain->sound.first; sound; sound = sound->id.next)
+ for (sound = bmain->sounds.first; sound; sound = sound->id.next)
if (sound->packedfile)
count++;
@@ -232,7 +222,7 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
bSound *sound;
int tot = 0;
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
if (BKE_image_has_packedfile(ima) == false && !ID_IS_LINKED(ima)) {
if (ima->source == IMA_SRC_FILE) {
BKE_image_packfiles(reports, ima, ID_BLEND_PATH(bmain, &ima->id));
@@ -245,14 +235,14 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
}
}
- for (vfont = bmain->vfont.first; vfont; vfont = vfont->id.next) {
+ for (vfont = bmain->fonts.first; vfont; vfont = vfont->id.next) {
if (vfont->packedfile == NULL && !ID_IS_LINKED(vfont) && BKE_vfont_is_builtin(vfont) == false) {
vfont->packedfile = newPackedFile(reports, vfont->name, BKE_main_blendfile_path(bmain));
tot ++;
}
}
- for (sound = bmain->sound.first; sound; sound = sound->id.next) {
+ for (sound = bmain->sounds.first; sound; sound = sound->id.next) {
if (sound->packedfile == NULL && !ID_IS_LINKED(sound)) {
sound->packedfile = newPackedFile(reports, sound->name, BKE_main_blendfile_path(bmain));
tot++;
@@ -608,7 +598,7 @@ int unpackLibraries(Main *bmain, ReportList *reports)
char *newname;
int ret_value = RET_ERROR;
- for (lib = bmain->library.first; lib; lib = lib->id.next) {
+ for (lib = bmain->libraries.first; lib; lib = lib->id.next) {
if (lib->packedfile && lib->name[0]) {
newname = unpackFile(reports, BKE_main_blendfile_path(bmain), lib->filepath, lib->filepath, lib->packedfile, PF_WRITE_ORIGINAL);
@@ -633,7 +623,7 @@ void packLibraries(Main *bmain, ReportList *reports)
Library *lib;
/* test for relativenss */
- for (lib = bmain->library.first; lib; lib = lib->id.next)
+ for (lib = bmain->libraries.first; lib; lib = lib->id.next)
if (!BLI_path_is_rel(lib->name))
break;
@@ -642,7 +632,7 @@ void packLibraries(Main *bmain, ReportList *reports)
return;
}
- for (lib = bmain->library.first; lib; lib = lib->id.next)
+ for (lib = bmain->libraries.first; lib; lib = lib->id.next)
if (lib->packedfile == NULL)
lib->packedfile = newPackedFile(reports, lib->name, BKE_main_blendfile_path(bmain));
}
@@ -653,15 +643,15 @@ void unpackAll(Main *bmain, ReportList *reports, int how)
VFont *vf;
bSound *sound;
- for (ima = bmain->image.first; ima; ima = ima->id.next)
+ for (ima = bmain->images.first; ima; ima = ima->id.next)
if (BKE_image_has_packedfile(ima))
unpackImage(bmain, reports, ima, how);
- for (vf = bmain->vfont.first; vf; vf = vf->id.next)
+ for (vf = bmain->fonts.first; vf; vf = vf->id.next)
if (vf->packedfile)
unpackVFont(bmain, reports, vf, how);
- for (sound = bmain->sound.first; sound; sound = sound->id.next)
+ for (sound = bmain->sounds.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 c5bfa41fa0b..be0d176dddc 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/paint.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
@@ -45,9 +37,7 @@
#include "DNA_workspace_types.h"
#include "BLI_bitmap.h"
-#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_string_utils.h"
#include "BLI_math_vector.h"
#include "BLI_listbase.h"
@@ -61,7 +51,6 @@
#include "BKE_main.h"
#include "BKE_context.h"
#include "BKE_crazyspace.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_image.h"
#include "BKE_key.h"
@@ -440,7 +429,7 @@ PaintCurve *BKE_paint_curve_add(Main *bmain, const char *name)
/**
* Only copy internal data of PaintCurve ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -456,7 +445,7 @@ void BKE_paint_curve_copy_data(Main *UNUSED(bmain), PaintCurve *pc_dst, const Pa
PaintCurve *BKE_paint_curve_copy(Main *bmain, const PaintCurve *pc)
{
PaintCurve *pc_copy;
- BKE_id_copy_ex(bmain, &pc->id, (ID **)&pc_copy, 0, false);
+ BKE_id_copy(bmain, &pc->id, (ID **)&pc_copy);
return pc_copy;
}
@@ -523,7 +512,7 @@ Palette *BKE_palette_add(Main *bmain, const char *name)
/**
* Only copy internal data of Palette ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -537,7 +526,7 @@ void BKE_palette_copy_data(Main *UNUSED(bmain), Palette *palette_dst, const Pale
Palette *BKE_palette_copy(Main *bmain, const Palette *palette)
{
Palette *palette_copy;
- BKE_id_copy_ex(bmain, &palette->id, (ID **)&palette_copy, 0, false);
+ BKE_id_copy(bmain, &palette->id, (ID **)&palette_copy);
return palette_copy;
}
@@ -910,7 +899,7 @@ static void sculptsession_bm_to_me_update_data_only(Object *ob, bool reorder)
}
if (reorder)
BM_log_mesh_elems_reorder(ss->bm, ss->bm_log);
- BM_mesh_bm_to_me(NULL, ss->bm, ob->data, (&(struct BMeshToMeshParams){.calc_object_remap = false}));
+ BM_mesh_bm_to_me(NULL, ss->bm, ob->data, (&(struct BMeshToMeshParams){.calc_object_remap = false,}));
}
}
}
@@ -1111,7 +1100,7 @@ void BKE_sculpt_update_mesh_elements(
ss->kb = (mmd == NULL) ? BKE_keyblock_from_object(ob) : NULL;
- Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob_eval, CD_MASK_BAREMESH);
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob_eval, &CD_MASK_BAREMESH);
/* VWPaint require mesh info for loop lookup, so require sculpt mode here */
if (mmd && ob->mode & OB_MODE_SCULPT) {
@@ -1392,7 +1381,16 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
}
PBVH *pbvh = ob->sculpt->pbvh;
if (pbvh != NULL) {
- /* Nothing to do, PBVH is already up to date. */
+ /* NOTE: It is possible that grids were re-allocated due to modifier
+ * stack. Need to update those pointers. */
+ if (BKE_pbvh_type(pbvh) == PBVH_GRIDS) {
+ Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+ Mesh *mesh_eval = object_eval->data;
+ SubdivCCG *subdiv_ccg = mesh_eval->runtime.subdiv_ccg;
+ if (subdiv_ccg != NULL) {
+ BKE_sculpt_bvh_update_from_ccg(pbvh, subdiv_ccg);
+ }
+ }
return pbvh;
}
@@ -1408,7 +1406,7 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
}
else if (ob->type == OB_MESH) {
Mesh *me_eval_deform = mesh_get_eval_deform(
- depsgraph, DEG_get_evaluated_scene(depsgraph), object_eval, CD_MASK_BAREMESH);
+ depsgraph, DEG_get_evaluated_scene(depsgraph), object_eval, &CD_MASK_BAREMESH);
pbvh = build_pbvh_from_regular_mesh(ob, me_eval_deform);
}
}
@@ -1416,3 +1414,9 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
ob->sculpt->pbvh = pbvh;
return pbvh;
}
+
+void BKE_sculpt_bvh_update_from_ccg(PBVH *pbvh, SubdivCCG *subdiv_ccg)
+{
+ BKE_pbvh_grids_update(pbvh, subdiv_ccg->grids, (void **)subdiv_ccg->grid_faces,
+ subdiv_ccg->grid_flag_mats, subdiv_ccg->grid_hidden);
+}
diff --git a/source/blender/blenkernel/intern/paint_toolslots.c b/source/blender/blenkernel/intern/paint_toolslots.c
index 92e42a0a468..24b801ce67f 100644
--- a/source/blender/blenkernel/intern/paint_toolslots.c
+++ b/source/blender/blenkernel/intern/paint_toolslots.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/paint_toolslots.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <limits.h>
@@ -54,7 +50,7 @@ static void paint_toolslots_init(Main *bmain, Paint *paint)
}
const eObjectMode ob_mode = paint->runtime.ob_mode;
BLI_assert(paint->runtime.tool_offset && ob_mode);
- for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->ob_mode & ob_mode) {
const int slot_index = BKE_brush_tool_get(brush, paint);
BKE_paint_toolslots_len_ensure(paint, slot_index + 1);
@@ -68,7 +64,7 @@ static void paint_toolslots_init(Main *bmain, Paint *paint)
void BKE_paint_toolslots_init_from_main(struct Main *bmain)
{
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
paint_toolslots_init(bmain, &ts->imapaint.paint);
paint_toolslots_init(bmain, &ts->sculpt->paint);
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 3b61c47cb43..da2975d8efc 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/particle.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -48,7 +40,6 @@
#include "DNA_dynamicpaint_types.h"
#include "BLI_blenlib.h"
-#include "BLI_noise.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_kdopbvh.h"
@@ -68,7 +59,6 @@
#include "BKE_collection.h"
#include "BKE_colortools.h"
#include "BKE_effect.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_lattice.h"
@@ -77,8 +67,6 @@
#include "BKE_material.h"
#include "BKE_key.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_modifier.h"
#include "BKE_mesh.h"
#include "BKE_cdderivedmesh.h" /* for weight_to_rgb() */
@@ -356,11 +344,11 @@ void psys_find_group_weights(ParticleSettings *part)
/* Find object pointers based on index. If the collection is linked from
* another library linking may not have the object pointers available on
* file load, so we have to retrieve them later. See T49273. */
- const ListBase dup_group_objects = BKE_collection_object_cache_get(part->dup_group);
+ const ListBase instance_collection_objects = BKE_collection_object_cache_get(part->instance_collection);
- for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (ParticleDupliWeight *dw = part->instance_weights.first; dw; dw = dw->next) {
if (dw->ob == NULL) {
- Base *base = BLI_findlink(&dup_group_objects, dw->index);
+ Base *base = BLI_findlink(&instance_collection_objects, dw->index);
if (base != NULL) {
dw->ob = base->object;
}
@@ -372,8 +360,8 @@ void psys_check_group_weights(ParticleSettings *part)
{
ParticleDupliWeight *dw, *tdw;
- if (part->ren_as != PART_DRAW_GR || !part->dup_group) {
- BLI_freelistN(&part->dupliweights);
+ if (part->ren_as != PART_DRAW_GR || !part->instance_collection) {
+ BLI_freelistN(&part->instance_weights);
return;
}
@@ -381,11 +369,11 @@ void psys_check_group_weights(ParticleSettings *part)
psys_find_group_weights(part);
/* Remove NULL objects, that were removed from the collection. */
- dw = part->dupliweights.first;
+ dw = part->instance_weights.first;
while (dw) {
- if (dw->ob == NULL || !BKE_collection_has_object_recursive(part->dup_group, dw->ob)) {
+ if (dw->ob == NULL || !BKE_collection_has_object_recursive(part->instance_collection, dw->ob)) {
tdw = dw->next;
- BLI_freelinkN(&part->dupliweights, dw);
+ BLI_freelinkN(&part->instance_weights, dw);
dw = tdw;
}
else {
@@ -395,9 +383,9 @@ void psys_check_group_weights(ParticleSettings *part)
/* Add new objects in the collection. */
int index = 0;
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->dup_group, object)
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object)
{
- dw = part->dupliweights.first;
+ dw = part->instance_weights.first;
while (dw && dw->ob != object) {
dw = dw->next;
}
@@ -406,7 +394,7 @@ void psys_check_group_weights(ParticleSettings *part)
dw = MEM_callocN(sizeof(ParticleDupliWeight), "ParticleDupliWeight");
dw->ob = object;
dw->count = 1;
- BLI_addtail(&part->dupliweights, dw);
+ BLI_addtail(&part->instance_weights, dw);
}
dw->index = index++;
@@ -415,7 +403,7 @@ void psys_check_group_weights(ParticleSettings *part)
/* Ensure there is an element marked as current. */
int current = 0;
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (dw = part->instance_weights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT) {
current = 1;
break;
@@ -423,7 +411,7 @@ void psys_check_group_weights(ParticleSettings *part)
}
if (!current) {
- dw = part->dupliweights.first;
+ dw = part->instance_weights.first;
if (dw)
dw->flag |= PART_DUPLIW_CURRENT;
}
@@ -465,7 +453,7 @@ void BKE_particlesettings_free(ParticleSettings *part)
MEM_SAFE_FREE(part->effector_weights);
- BLI_freelistN(&part->dupliweights);
+ BLI_freelistN(&part->instance_weights);
boid_free_settings(part->boids);
fluid_free_settings(part->fluid);
@@ -1637,39 +1625,40 @@ static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index),
/* Particles on emitter */
/************************************************/
-CustomDataMask psys_emitter_customdata_mask(ParticleSystem *psys)
+void psys_emitter_customdata_mask(ParticleSystem *psys, CustomData_MeshMasks *r_cddata_masks)
{
- CustomDataMask dataMask = 0;
MTex *mtex;
int i;
if (!psys->part)
- return 0;
+ return;
for (i = 0; i < MAX_MTEX; i++) {
mtex = psys->part->mtex[i];
if (mtex && mtex->mapto && (mtex->texco & TEXCO_UV))
- dataMask |= CD_MASK_MTFACE;
+ r_cddata_masks->fmask |= CD_MASK_MTFACE;
}
if (psys->part->tanfac != 0.0f)
- dataMask |= CD_MASK_MTFACE;
+ r_cddata_masks->fmask |= CD_MASK_MTFACE;
/* ask for vertexgroups if we need them */
for (i = 0; i < PSYS_TOT_VG; i++) {
if (psys->vgroup[i]) {
- dataMask |= CD_MASK_MDEFORMVERT;
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
break;
}
}
/* particles only need this if they are after a non deform modifier, and
* the modifier stack will only create them in that case. */
- dataMask |= CD_MASK_ORIGSPACE_MLOOP | CD_MASK_ORIGINDEX;
-
- dataMask |= CD_MASK_ORCO;
+ r_cddata_masks->lmask |= CD_MASK_ORIGSPACE_MLOOP;
+ /* XXX Check we do need all those? */
+ r_cddata_masks->vmask |= CD_MASK_ORIGINDEX;
+ r_cddata_masks->emask |= CD_MASK_ORIGINDEX;
+ r_cddata_masks->pmask |= CD_MASK_ORIGINDEX;
- return dataMask;
+ r_cddata_masks->vmask |= CD_MASK_ORCO;
}
void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int index, int index_dmcache,
@@ -3074,6 +3063,10 @@ ModifierData *object_add_particle_system(Main *bmain, Scene *scene, Object *ob,
if (!ob || ob->type != OB_MESH)
return NULL;
+ if (name == NULL) {
+ name = DATA_("ParticleSettings");
+ }
+
psys = ob->particlesystem.first;
for (; psys; psys = psys->next)
psys->flag &= ~PSYS_CURRENT;
@@ -3081,20 +3074,12 @@ ModifierData *object_add_particle_system(Main *bmain, Scene *scene, Object *ob,
psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
BLI_addtail(&ob->particlesystem, psys);
+ psys_unique_name(ob, psys, name);
- psys->part = BKE_particlesettings_add(bmain, DATA_("ParticleSettings"));
-
- if (BLI_listbase_count_at_most(&ob->particlesystem, 2) > 1)
- BLI_snprintf(psys->name, sizeof(psys->name), DATA_("ParticleSystem %i"), BLI_listbase_count(&ob->particlesystem));
- else
- BLI_strncpy(psys->name, DATA_("ParticleSystem"), sizeof(psys->name));
+ psys->part = BKE_particlesettings_add(bmain, psys->name);
md = modifier_new(eModifierType_ParticleSystem);
-
- if (name)
- BLI_strncpy_utf8(md->name, name, sizeof(md->name));
- else
- BLI_snprintf(md->name, sizeof(md->name), DATA_("ParticleSystem %i"), BLI_listbase_count(&ob->particlesystem));
+ BLI_strncpy(md->name, psys->name, sizeof(md->name));
modifier_unique_name(&ob->modifiers, md);
psmd = (ParticleSystemModifierData *) md;
@@ -3300,7 +3285,7 @@ void BKE_particlesettings_twist_curve_init(ParticleSettings *part)
/**
* Only copy internal data of ParticleSettings ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -3309,8 +3294,8 @@ void BKE_particlesettings_twist_curve_init(ParticleSettings *part)
void BKE_particlesettings_copy_data(
Main *UNUSED(bmain), ParticleSettings *part_dst, const ParticleSettings *part_src, const int UNUSED(flag))
{
- part_dst->pd = MEM_dupallocN(part_src->pd);
- part_dst->pd2 = MEM_dupallocN(part_src->pd2);
+ part_dst->pd = BKE_partdeflect_copy(part_src->pd);
+ part_dst->pd2 = BKE_partdeflect_copy(part_src->pd2);
part_dst->effector_weights = MEM_dupallocN(part_src->effector_weights);
part_dst->fluid = MEM_dupallocN(part_src->fluid);
@@ -3332,13 +3317,13 @@ void BKE_particlesettings_copy_data(
}
}
- BLI_duplicatelist(&part_dst->dupliweights, &part_src->dupliweights);
+ BLI_duplicatelist(&part_dst->instance_weights, &part_src->instance_weights);
}
ParticleSettings *BKE_particlesettings_copy(Main *bmain, const ParticleSettings *part)
{
ParticleSettings *part_copy;
- BKE_id_copy_ex(bmain, &part->id, (ID **)&part_copy, 0, false);
+ BKE_id_copy(bmain, &part->id, (ID **)&part_copy);
return part_copy;
}
diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c
index 0cba5f5a2fc..e5d25efe3d5 100644
--- a/source/blender/blenkernel/intern/particle_child.c
+++ b/source/blender/blenkernel/intern/particle_child.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/particle_child.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BLI_math.h"
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index bbb8a96dd4d..4485afb09de 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Raul Fernandez Hernandez (Farsthary),
- * Stephen Swhitehorn,
- * Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/particle_distribute.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <string.h>
@@ -868,13 +858,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
mesh = final_mesh;
}
else {
- BKE_id_copy_ex(
- NULL, ob->data, (ID **)&mesh,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, ob->data, (ID **)&mesh, LIB_ID_COPY_LOCALIZE);
}
BKE_mesh_tessface_ensure(mesh);
@@ -920,13 +904,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
if (psys->part->use_modifier_stack)
mesh = final_mesh;
else
- BKE_id_copy_ex(
- NULL, ob->data, (ID **)&mesh,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, ob->data, (ID **)&mesh, LIB_ID_COPY_LOCALIZE);
BKE_mesh_tessface_ensure(mesh);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 8d09215c564..2975eaaf5fc 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,13 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Raul Fernandez Hernandez (Farsthary), Stephen Swhitehorn.
- *
* Adaptive time step
* Classical SPH
* Copyright 2011-2012 AutoCRC
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/particle_system.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -58,25 +49,22 @@
#include "BLI_utildefines.h"
#include "BLI_edgehash.h"
#include "BLI_rand.h"
-#include "BLI_jitter_2d.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_kdtree.h"
#include "BLI_kdopbvh.h"
-#include "BLI_sort.h"
#include "BLI_task.h"
#include "BLI_threads.h"
#include "BLI_linklist.h"
+#include "BLI_string_utils.h"
#include "BKE_animsys.h"
#include "BKE_boids.h"
#include "BKE_collision.h"
#include "BKE_colortools.h"
#include "BKE_effect.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
-#include "BKE_main.h"
#include "BKE_particle.h"
#include "BKE_collection.h"
@@ -199,6 +187,12 @@ void psys_reset(ParticleSystem *psys, int mode)
psys->tot_fluidsprings = psys->alloc_fluidsprings = 0;
}
+void psys_unique_name(Object *object, ParticleSystem *psys, const char *defname)
+{
+ BLI_uniquename(&object->particlesystem, psys, defname, '.',
+ offsetof(ParticleSystem, name), sizeof(psys->name));
+}
+
static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
{
ParticleSystem *psys = sim->psys;
@@ -997,8 +991,6 @@ static void evaluate_emitter_anim(struct Depsgraph *depsgraph, Scene *scene, Obj
if (ob->parent)
evaluate_emitter_anim(depsgraph, scene, ob->parent, cfra);
- /* we have to force RECALC_ANIM here since where_is_objec_time only does drivers */
- BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, cfra, ADT_RECALC_ANIM);
BKE_object_where_is_calc_time(depsgraph, scene, ob, cfra);
}
@@ -1688,7 +1680,8 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
/* 4.0 seems to be a pretty good value */
float interaction_radius = fluid->radius * (fluid->flag & SPH_FAC_RADIUS ? 4.0f * pa->size : 1.0f);
float h = interaction_radius * sphdata->hfac;
- float rest_density = fluid->rest_density * (fluid->flag & SPH_FAC_DENSITY ? 4.77f : 1.f); /* 4.77 is an experimentally determined density factor */
+ /* 4.77 is an experimentally determined density factor */
+ float rest_density = fluid->rest_density * (fluid->flag & SPH_FAC_DENSITY ? 4.77f : 1.f);
float rest_length = fluid->rest_length * (fluid->flag & SPH_FAC_REST_LENGTH ? 2.588f * pa->size : 1.f);
float stiffness = fluid->stiffness_k;
@@ -2657,12 +2650,18 @@ static int collision_response(ParticleSimulationData *sim, ParticleData *pa, Par
ParticleCollisionElement *pce = &col->pce;
PartDeflect *pd = col->hit->pd;
RNG *rng = sim->rng;
- float co[3]; /* point of collision */
- float x = hit->dist/col->original_ray_length; /* location factor of collision between this iteration */
- float f = col->f + x * (1.0f - col->f); /* time factor of collision between timestep */
- float dt1 = (f - col->f) * col->total_time; /* time since previous collision (in seconds) */
- float dt2 = (1.0f - f) * col->total_time; /* time left after collision (in seconds) */
- int through = (BLI_rng_get_float(rng) < pd->pdef_perm) ? 1 : 0; /* did particle pass through the collision surface? */
+ /* point of collision */
+ float co[3];
+ /* location factor of collision between this iteration */
+ float x = hit->dist/col->original_ray_length;
+ /* time factor of collision between timestep */
+ float f = col->f + x * (1.0f - col->f);
+ /* time since previous collision (in seconds) */
+ float dt1 = (f - col->f) * col->total_time;
+ /* time left after collision (in seconds) */
+ float dt2 = (1.0f - f) * col->total_time;
+ /* did particle pass through the collision surface? */
+ int through = (BLI_rng_get_float(rng) < pd->pdef_perm) ? 1 : 0;
/* calculate exact collision location */
interp_v3_v3v3(co, col->co1, col->co2, x);
@@ -2682,10 +2681,14 @@ static int collision_response(ParticleSimulationData *sim, ParticleData *pa, Par
}
/* figure out velocity and other data after collision */
else {
- float v0[3]; /* velocity directly before collision to be modified into velocity directly after collision */
- float v0_nor[3];/* normal component of v0 */
- float v0_tan[3];/* tangential component of v0 */
- float vc_tan[3];/* tangential component of collision surface velocity */
+ /* velocity directly before collision to be modified into velocity directly after collision */
+ float v0[3];
+ /* normal component of v0 */
+ float v0_nor[3];
+ /* tangential component of v0 */
+ float v0_tan[3];
+ /* tangential component of collision surface velocity */
+ float vc_tan[3];
float v0_dot, vc_dot;
float damp = pd->pdef_damp + pd->pdef_rdamp * 2 * (BLI_rng_get_float(rng) - 0.5f);
float frict = pd->pdef_frict + pd->pdef_rfrict * 2 * (BLI_rng_get_float(rng) - 0.5f);
@@ -2728,7 +2731,8 @@ static int collision_response(ParticleSimulationData *sim, ParticleData *pa, Par
madd_v3_v3fl(v1_tan, vr_tan, -0.4);
mul_v3_fl(v1_tan, 1.0f/1.4f); /* 1/(1+0.4) */
- /* rolling friction is around 0.01 of sliding friction (could be made a parameter) */
+ /* rolling friction is around 0.01 of sliding friction
+ * (could be made a parameter) */
mul_v3_fl(v1_tan, 1.0f - 0.01f * frict);
/* surface_velocity is opposite to cm velocity */
@@ -2957,23 +2961,6 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra, cons
}
}
-
- /* particle instance modifier with "path" option need cached paths even if particle system doesn't */
- if (skip) {
- FOREACH_SCENE_OBJECT_BEGIN(sim->scene, ob)
- {
- ModifierData *md = modifiers_findByType(ob, eModifierType_ParticleInstance);
- if (md) {
- ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
- if (pimd->flag & eParticleInstanceFlag_Path && pimd->ob == sim->ob && pimd->psys == (psys - (ParticleSystem*)sim->ob->particlesystem.first)) {
- skip = 0;
- break;
- }
- }
- }
- FOREACH_SCENE_OBJECT_END;
- }
-
if (!skip) {
psys_cache_paths(sim, cfra, use_render_params);
@@ -3185,7 +3172,8 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
}
}
- realloc_roots = false; /* whether hair root info array has to be reallocated */
+ /* whether hair root info array has to be reallocated */
+ realloc_roots = false;
if (psys->hair_in_mesh) {
Mesh *mesh = psys->hair_in_mesh;
if (totpoint != mesh->totvert || totedge != mesh->totedge) {
@@ -3214,13 +3202,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
clmd_effweights = psys->clmd->sim_parms->effector_weights;
psys->clmd->sim_parms->effector_weights = psys->part->effector_weights;
- BKE_id_copy_ex(
- NULL, &psys->hair_in_mesh->id, (ID **)&psys->hair_out_mesh,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &psys->hair_in_mesh->id, (ID **)&psys->hair_out_mesh, LIB_ID_COPY_LOCALIZE);
deformedVerts = BKE_mesh_vertexCos_get(psys->hair_out_mesh, NULL);
clothModifier_do(psys->clmd, sim->depsgraph, sim->scene, sim->ob, psys->hair_in_mesh, deformedVerts);
BKE_mesh_apply_vert_coords(psys->hair_out_mesh, deformedVerts);
@@ -4208,6 +4190,23 @@ static int hair_needs_recalc(ParticleSystem *psys)
return 0;
}
+static ParticleSettings *particle_settings_localize(ParticleSettings *particle_settings)
+{
+ ParticleSettings *particle_settings_local;
+ BKE_id_copy_ex(NULL,
+ (ID *)&particle_settings->id,
+ (ID **)&particle_settings_local,
+ LIB_ID_COPY_LOCALIZE);
+ return particle_settings_local;
+}
+
+static void particle_settings_free_local(ParticleSettings *particle_settings)
+{
+ BKE_libblock_free_datablock(&particle_settings->id, 0);
+ BKE_libblock_free_data(&particle_settings->id, false);
+ MEM_freeN(particle_settings);
+}
+
/* main particle update call, checks that things are ok on the large scale and
* then advances in to actual particle calculations depending on particle type */
void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys, const bool use_render_params)
@@ -4247,9 +4246,6 @@ void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *o
BKE_mesh_tessface_ensure(sim.psmd->mesh_final);
}
- /* execute drivers only, as animation has already been done */
- BKE_animsys_evaluate_animdata(depsgraph, scene, &part->id, part->adt, cfra, ADT_RECALC_DRIVERS);
-
/* to verify if we need to restore object afterwards */
psys->flag &= ~PSYS_OB_ANIM_RESTORE;
@@ -4284,16 +4280,27 @@ void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *o
/* first step is negative so particles get killed and reset */
psys->cfra= 1.0f;
+ ParticleSettings *part_local = part;
+ if ((part->flag & PART_HAIR_REGROW) == 0) {
+ part_local = particle_settings_localize(part);
+ psys->part = part_local;
+ }
+
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)
- BKE_animsys_evaluate_animdata(depsgraph, scene, &part->id, part->adt, hcfra, ADT_RECALC_ANIM);
+ BKE_animsys_evaluate_animdata(depsgraph, scene, &part_local->id, part_local->adt, hcfra, ADT_RECALC_ANIM);
system_step(&sim, hcfra, use_render_params);
psys->cfra = hcfra;
psys->recalc = 0;
save_hair(&sim, hcfra);
}
+ if (part_local != part) {
+ particle_settings_free_local(part_local);
+ psys->part = part;
+ }
+
psys->flag |= PSYS_HAIR_DONE;
psys->recalc = recalc;
}
@@ -4378,6 +4385,9 @@ void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *o
psys_orig->edit->flags |= PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL;
}
+ psys->cfra = cfra;
+ psys->recalc = 0;
+
if (DEG_is_active(depsgraph)) {
if (psys_orig != psys) {
if (psys_orig->edit != NULL &&
@@ -4387,12 +4397,11 @@ void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *o
psys_orig->edit->psmd_eval = psmd;
}
psys_orig->flag = (psys->flag & ~PSYS_SHARED_CACHES);
+ psys_orig->cfra = psys->cfra;
+ psys_orig->recalc = psys->recalc;
}
}
- psys->cfra = cfra;
- psys->recalc = 0;
-
/* save matrix for duplicators, at rendertime the actual dupliobject's matrix is used so don't update! */
invert_m4_m4(psys->imat, ob->obmat);
@@ -4425,6 +4434,18 @@ void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func,
}
}
+void BKE_particlesystem_reset_all(struct Object *object)
+{
+ for (ModifierData *md = object->modifiers.first; md != NULL; md = md->next) {
+ if (md->type != eModifierType_ParticleSystem) {
+ continue;
+ }
+ ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
+ ParticleSystem *psys = psmd->psys;
+ psys->recalc |= ID_RECALC_PSYS_RESET;
+ }
+}
+
/* **** Depsgraph evaluation **** */
void BKE_particle_settings_eval_reset(
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 413f0407c86..7dc772576c5 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,29 +12,27 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/pbvh.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
-#include "DNA_meshdata_types.h"
-
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
#include "BLI_bitmap.h"
#include "BLI_math.h"
-#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_task.h"
+#include "DNA_meshdata_types.h"
+
#include "BKE_pbvh.h"
#include "BKE_ccg.h"
#include "BKE_subsurf.h"
#include "BKE_DerivedMesh.h"
-#include "BKE_global.h"
#include "BKE_mesh.h" /* for BKE_mesh_calc_normals */
#include "BKE_paint.h"
@@ -1117,11 +1113,8 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
case PBVH_GRIDS:
node->draw_buffers =
GPU_pbvh_grid_buffers_build(
- node->prim_indices,
node->totprim,
- bvh->grid_hidden,
- bvh->gridkey.grid_size,
- &bvh->gridkey);
+ bvh->grid_hidden);
break;
case PBVH_FACES:
node->draw_buffers =
@@ -2054,6 +2047,7 @@ struct PBVHNodeDrawCallbackData {
void *user_data;
bool fast;
bool only_mask; /* Only draw nodes that have mask data. */
+ bool wires;
};
static void pbvh_node_draw_cb(PBVHNode *node, void *data_v)
@@ -2061,11 +2055,11 @@ static void pbvh_node_draw_cb(PBVHNode *node, void *data_v)
struct PBVHNodeDrawCallbackData *data = data_v;
if (!(node->flag & PBVH_FullyHidden)) {
- GPUBatch *triangles = GPU_pbvh_buffers_batch_get(node->draw_buffers, data->fast);
+ GPUBatch *batch = GPU_pbvh_buffers_batch_get(node->draw_buffers, data->fast, data->wires);
bool show_mask = GPU_pbvh_buffers_has_mask(node->draw_buffers);
if (!data->only_mask || show_mask) {
- if (triangles != NULL) {
- data->draw_fn(data->user_data, triangles);
+ if (batch != NULL) {
+ data->draw_fn(data->user_data, batch);
}
}
}
@@ -2075,12 +2069,13 @@ static void pbvh_node_draw_cb(PBVHNode *node, void *data_v)
* Version of #BKE_pbvh_draw that runs a callback.
*/
void BKE_pbvh_draw_cb(
- PBVH *bvh, float (*planes)[4], float (*fnors)[3], bool fast, bool only_mask,
+ PBVH *bvh, float (*planes)[4], float (*fnors)[3], bool fast, bool wires, bool only_mask,
void (*draw_fn)(void *user_data, GPUBatch *batch), void *user_data)
{
struct PBVHNodeDrawCallbackData draw_data = {
.only_mask = only_mask,
.fast = fast,
+ .wires = wires,
.draw_fn = draw_fn,
.user_data = user_data,
};
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 3369b05ea60..cd97fcf432e 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/pbvh_bmesh.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "MEM_guardedalloc.h"
@@ -1549,7 +1545,7 @@ bool pbvh_bmesh_node_raycast(
bool BKE_pbvh_bmesh_node_raycast_detail(
PBVHNode *node,
const float ray_start[3], const float ray_normal[3],
- float *depth, float *r_detail)
+ float *depth, float *r_edge_length)
{
if (node->flag & PBVH_FullyHidden)
return 0;
@@ -1588,7 +1584,7 @@ bool BKE_pbvh_bmesh_node_raycast_detail(
float len3 = len_squared_v3v3(v_tri[2]->co, v_tri[0]->co);
/* detail returned will be set to the maximum allowed size, so take max here */
- *r_detail = sqrtf(max_fff(len1, len2, len3));
+ *r_edge_length = sqrtf(max_fff(len1, len2, len3));
}
return hit;
diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h
index ea8bd1933cd..b9610179630 100644
--- a/source/blender/blenkernel/intern/pbvh_intern.h
+++ b/source/blender/blenkernel/intern/pbvh_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __PBVH_INTERN_H__
#define __PBVH_INTERN_H__
-/** \file blender/blenkernel/intern/pbvh_intern.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
/* Axis-aligned bounding box */
@@ -112,7 +108,7 @@ struct PBVHNode {
};
typedef enum {
- PBVH_DYNTOPO_SMOOTH_SHADING = 1
+ PBVH_DYNTOPO_SMOOTH_SHADING = 1,
} PBVHFlags;
typedef struct PBVHBMeshLog PBVHBMeshLog;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 9f9f4703123..ed949e68f13 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Campbell Barton <ideasman42@gmail.com>
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/pointcache.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -34,6 +28,8 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
@@ -48,7 +44,6 @@
#include "DNA_smoke_types.h"
#include "BLI_blenlib.h"
-#include "BLI_threads.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
@@ -124,6 +119,8 @@
/* could be made into a pointcache option */
#define DURIAN_POINTCACHE_LIB_OK 1
+static CLG_LogRef LOG = {"bke.pointcache"};
+
static int ptcache_data_size[] = {
sizeof(unsigned int), // BPHYS_DATA_INDEX
3 * sizeof(float), // BPHYS_DATA_LOCATION
@@ -132,12 +129,12 @@ static int ptcache_data_size[] = {
3 * sizeof(float), // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST
sizeof(float), // BPHYS_DATA_SIZE
3 * sizeof(float), // BPHYS_DATA_TIMES
- sizeof(BoidData) // case BPHYS_DATA_BOIDS
+ sizeof(BoidData), // case BPHYS_DATA_BOIDS
};
static int ptcache_extra_datasize[] = {
0,
- sizeof(ParticleSpring)
+ sizeof(ParticleSpring),
};
/* forward declarations */
@@ -584,7 +581,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
SmokeDomainSettings *sds = smd->domain;
int ret = 0;
- int fluid_fields = smoke_get_data_flags(sds);
+ int fluid_fields = BKE_smoke_get_data_flags(sds);
/* version header */
ptcache_file_write(pf, SMOKE_CACHE_VERSION, 4, sizeof(char));
@@ -702,7 +699,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
unsigned char *obstacles;
float *tmp_array = MEM_callocN(out_len, "Smoke old cache tmp");
- int fluid_fields = smoke_get_data_flags(sds);
+ int fluid_fields = BKE_smoke_get_data_flags(sds);
/* Part part of the new cache header */
sds->active_color[0] = 0.7f;
@@ -771,7 +768,7 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
char version[4];
int ch_res[3];
float ch_dx;
- int fluid_fields = smoke_get_data_flags(sds);
+ int fluid_fields = BKE_smoke_get_data_flags(sds);
int cache_fields = 0;
int active_fields = 0;
int reallocate = 0;
@@ -809,12 +806,12 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
/* reallocate fluid if needed*/
if (reallocate) {
sds->active_fields = active_fields | cache_fields;
- smoke_reallocate_fluid(sds, ch_dx, ch_res, 1);
+ BKE_smoke_reallocate_fluid(sds, ch_dx, ch_res, 1);
sds->dx = ch_dx;
- VECCOPY(sds->res, ch_res);
+ copy_v3_v3_int(sds->res, ch_res);
sds->total_cells = ch_res[0]*ch_res[1]*ch_res[2];
if (sds->flags & MOD_SMOKE_HIGHRES) {
- smoke_reallocate_highres_fluid(sds, ch_dx, ch_res, 1);
+ BKE_smoke_reallocate_highres_fluid(sds, ch_dx, ch_res, 1);
}
}
@@ -963,7 +960,7 @@ static int ptcache_smoke_openvdb_write(struct OpenVDBWriter *writer, void *smoke
OpenVDBWriter_add_meta_v3(writer, "blender/smoke/active_color", sds->active_color);
OpenVDBWriter_add_meta_mat4(writer, "blender/smoke/obmat", sds->obmat);
- int fluid_fields = smoke_get_data_flags(sds);
+ int fluid_fields = BKE_smoke_get_data_flags(sds);
struct OpenVDBFloatGrid *clip_grid = NULL;
@@ -1046,7 +1043,7 @@ static int ptcache_smoke_openvdb_read(struct OpenVDBReader *reader, void *smoke_
SmokeDomainSettings *sds = smd->domain;
- int fluid_fields = smoke_get_data_flags(sds);
+ int fluid_fields = BKE_smoke_get_data_flags(sds);
int active_fields, cache_fields = 0;
int cache_res[3];
float cache_dx;
@@ -1088,13 +1085,13 @@ static int ptcache_smoke_openvdb_read(struct OpenVDBReader *reader, void *smoke_
/* reallocate fluid if needed*/
if (reallocate) {
sds->active_fields = active_fields | cache_fields;
- smoke_reallocate_fluid(sds, cache_dx, cache_res, 1);
+ BKE_smoke_reallocate_fluid(sds, cache_dx, cache_res, 1);
sds->dx = cache_dx;
copy_v3_v3_int(sds->res, cache_res);
sds->total_cells = cache_res[0] * cache_res[1] * cache_res[2];
if (sds->flags & MOD_SMOKE_HIGHRES) {
- smoke_reallocate_highres_fluid(sds, cache_dx, cache_res, 1);
+ BKE_smoke_reallocate_highres_fluid(sds, cache_dx, cache_res, 1);
}
}
@@ -1244,7 +1241,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
/* version header */
ptcache_file_read(pf, version, 1, sizeof(char) * 4);
if (!STREQLEN(version, DPAINT_CACHE_VERSION, 4)) {
- printf("Dynamic Paint: Invalid cache version: '%c%c%c%c'!\n", UNPACK4(version));
+ CLOG_ERROR(&LOG, "Dynamic Paint: Invalid cache version: '%c%c%c%c'!", UNPACK4(version));
return 0;
}
@@ -1790,8 +1787,8 @@ static bool foreach_object_ptcache(Scene *scene,
/* Consider all object in dupli groups to be part of the same object,
* for baking with linking dupligroups. Once we have better overrides
* this can be revisited so users select the local objects directly. */
- if (scene != NULL && (duplis-- > 0) && (object->dup_group != NULL)) {
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(object->dup_group,
+ if (scene != NULL && (duplis-- > 0) && (object->instance_collection != NULL)) {
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(object->instance_collection,
current_object)
{
if (current_object == object) {
@@ -2480,7 +2477,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.debug & G_DEBUG)
printf("Error opening disk cache file for writing\n");
return 0;
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index 9204bc69ee9..e4de75ba42c 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/report.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdarg.h>
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 4e6d6cf0971..745c17c0919 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung, Sergej Reich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file rigidbody.c
- * \ingroup blenkernel
- * \brief Blender-side interface and methods for dealing with Rigid Body simulations
+/** \file
+ * \ingroup blenkernel
+ * \brief Blender-side interface and methods for dealing with Rigid Body simulations
*/
#include <stdio.h>
@@ -37,9 +29,10 @@
#include <math.h>
#include <limits.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#ifdef WITH_BULLET
@@ -57,10 +50,7 @@
#include "BKE_collection.h"
#include "BKE_effect.h"
-#include "BKE_global.h"
#include "BKE_layer.h"
-#include "BKE_library.h"
-#include "BKE_library_query.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
@@ -68,10 +58,19 @@
#include "BKE_pointcache.h"
#include "BKE_rigidbody.h"
#include "BKE_scene.h"
+#ifdef WITH_BULLET
+# include "BKE_global.h"
+# include "BKE_library.h"
+# include "BKE_library_query.h"
+#endif
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
+#ifdef WITH_BULLET
+static CLG_LogRef LOG = {"bke.rigidbody"};
+#endif
+
/* ************************************** */
/* Memory Management */
@@ -290,14 +289,14 @@ static rbCollisionShape *rigidbody_get_shape_convexhull_from_mesh(Object *ob, fl
totvert = (mesh) ? mesh->totvert : 0;
}
else {
- printf("ERROR: cannot make Convex Hull collision shape for non-Mesh object\n");
+ CLOG_ERROR(&LOG, "cannot make Convex Hull collision shape for non-Mesh object");
}
if (totvert) {
shape = RB_shape_new_convex_hull((float *)mvert, sizeof(MVert), totvert, margin, can_embed);
}
else {
- printf("ERROR: no vertices to define Convex Hull collision shape with\n");
+ CLOG_ERROR(&LOG, "no vertices to define Convex Hull collision shape with");
}
return shape;
@@ -332,7 +331,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob)
/* sanity checking - potential case when no data will be present */
if ((totvert == 0) || (tottri == 0)) {
- printf("WARNING: no geometry data converted for Mesh Collision Shape (ob = %s)\n", ob->id.name + 2);
+ CLOG_WARN(&LOG, "no geometry data converted for Mesh Collision Shape (ob = %s)", ob->id.name + 2);
}
else {
rbMeshData *mdata;
@@ -380,7 +379,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob)
}
}
else {
- printf("ERROR: cannot make Triangular Mesh collision shape for non-Mesh object\n");
+ CLOG_ERROR(&LOG, "cannot make Triangular Mesh collision shape for non-Mesh object");
}
return shape;
@@ -1176,7 +1175,7 @@ void BKE_rigidbody_constraints_collection_validate(Scene *scene, RigidBodyWorld
void BKE_rigidbody_main_collection_object_add(Main *bmain, Collection *collection, Object *object)
{
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
RigidBodyWorld *rbw = scene->rigidbody_world;
if (rbw == NULL) {
@@ -1411,6 +1410,8 @@ static void rigidbody_update_sim_ob(Depsgraph *depsgraph, Scene *scene, RigidBod
*/
static void rigidbody_update_simulation(Depsgraph *depsgraph, Scene *scene, RigidBodyWorld *rbw, bool rebuild)
{
+ float ctime = DEG_get_ctime(depsgraph);
+
/* update world */
if (rebuild)
BKE_rigidbody_validate_sim_world(scene, rbw, true);
@@ -1442,7 +1443,7 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph, Scene *scene, Rigi
/* validate that we've got valid object set up here... */
RigidBodyOb *rbo = ob->rigidbody_object;
/* update transformation matrix of the object so we don't get a frame of lag for simple animations */
- BKE_object_where_is_calc(depsgraph, scene, ob);
+ BKE_object_where_is_calc_time(depsgraph, scene, ob, ctime);
/* TODO remove this whole block once we are sure we never get NULL rbo here anymore. */
/* This cannot be done in CoW evaluation context anymore... */
@@ -1496,7 +1497,7 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph, Scene *scene, Rigi
/* validate that we've got valid object set up here... */
RigidBodyCon *rbc = ob->rigidbody_constraint;
/* update transformation matrix of the object so we don't get a frame of lag for simple animations */
- BKE_object_where_is_calc(depsgraph, scene, ob);
+ BKE_object_where_is_calc_time(depsgraph, scene, ob, ctime);
/* TODO remove this whole block once we are sure we never get NULL rbo here anymore. */
/* This cannot be done in CoW evaluation context anymore... */
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 5d37bfd6f30..b2bc578bd3b 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/scene.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -73,7 +65,6 @@
#include "BKE_editmesh.h"
#include "BKE_fcurve.h"
#include "BKE_freestyle.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_icons.h"
#include "BKE_idprop.h"
@@ -236,7 +227,7 @@ void BKE_toolsettings_free(ToolSettings *toolsettings)
/**
* Only copy internal data of Scene ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -273,7 +264,7 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
if (sce_src->nodetree) {
/* Note: nodetree is *not* in bmain, however this specific case is handled at lower level
* (see BKE_libblock_copy_ex()). */
- BKE_id_copy_ex(bmain, (ID *)sce_src->nodetree, (ID **)&sce_dst->nodetree, flag, false);
+ BKE_id_copy_ex(bmain, (ID *)sce_src->nodetree, (ID **)&sce_dst->nodetree, flag);
BKE_libblock_relink_ex(bmain, sce_dst->nodetree, (void *)(&sce_src->id), &sce_dst->id, false);
}
@@ -396,7 +387,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
return sce_copy;
}
else {
- BKE_id_copy_ex(bmain, (ID *)sce, (ID **)&sce_copy, LIB_ID_COPY_ACTIONS, false);
+ BKE_id_copy_ex(bmain, (ID *)sce, (ID **)&sce_copy, LIB_ID_COPY_ACTIONS);
id_us_min(&sce_copy->id);
id_us_ensure_real(&sce_copy->id);
@@ -408,8 +399,11 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
for (FreestyleLineSet *lineset = view_layer_dst->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
if (lineset->linestyle) {
id_us_min(&lineset->linestyle->id);
- /* XXX Not copying anim/actions here? */
- BKE_id_copy_ex(bmain, (ID *)lineset->linestyle, (ID **)&lineset->linestyle, 0, false);
+ BKE_id_copy_ex(
+ bmain,
+ (ID *)lineset->linestyle,
+ (ID **)&lineset->linestyle,
+ LIB_ID_COPY_ACTIONS);
}
}
}
@@ -417,17 +411,13 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
/* Full copy of world (included animations) */
if (sce_copy->world) {
id_us_min(&sce_copy->world->id);
- BKE_id_copy_ex(bmain, (ID *)sce_copy->world, (ID **)&sce_copy->world, LIB_ID_COPY_ACTIONS, false);
+ BKE_id_copy_ex(bmain, (ID *)sce_copy->world, (ID **)&sce_copy->world, LIB_ID_COPY_ACTIONS);
}
- /* Collections */
- BKE_collection_copy_full(bmain, sce_copy->master_collection);
-
/* Full copy of GreasePencil. */
- /* XXX Not copying anim/actions here? */
if (sce_copy->gpd) {
id_us_min(&sce_copy->gpd->id);
- BKE_id_copy_ex(bmain, (ID *)sce_copy->gpd, (ID **)&sce_copy->gpd, 0, false);
+ BKE_id_copy_ex(bmain, (ID *)sce_copy->gpd, (ID **)&sce_copy->gpd, LIB_ID_COPY_ACTIONS);
}
}
else {
@@ -554,7 +544,10 @@ void BKE_scene_init(Scene *sce)
BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(sce, id));
- unit_qt(sce->cursor.rotation);
+
+ sce->cursor.rotation_mode = ROT_MODE_XYZ;
+ sce->cursor.rotation_quaternion[0] = 1.0f;
+ sce->cursor.rotation_axis[1] = 1.0f;
sce->r.mode = R_OSA;
sce->r.cfra = 1;
@@ -715,6 +708,8 @@ void BKE_scene_init(Scene *sce)
CURVE_PRESET_BELL,
CURVEMAP_SLOPE_POSITIVE);
+ sce->toolsettings->gp_sculpt.guide.spacing = 20.0f;
+
sce->physics_settings.gravity[0] = 0.0f;
sce->physics_settings.gravity[1] = 0.0f;
sce->physics_settings.gravity[2] = -9.81f;
@@ -731,7 +726,7 @@ void BKE_scene_init(Scene *sce)
pset->emitterdist = 0.25f;
pset->totrekey = 5;
pset->totaddkey = 5;
- pset->brushtype = PE_BRUSH_NONE;
+ pset->brushtype = PE_BRUSH_COMB;
pset->draw_step = 2;
pset->fade_frames = 2;
pset->selectmode = SCE_SELECT_PATH;
@@ -780,7 +775,8 @@ void BKE_scene_init(Scene *sce)
BKE_color_managed_display_settings_init(&sce->display_settings);
BKE_color_managed_view_settings_init_render(&sce->view_settings,
- &sce->display_settings);
+ &sce->display_settings,
+ "Filmic");
BLI_strncpy(sce->sequencer_colorspace_settings.name, colorspace_name,
sizeof(sce->sequencer_colorspace_settings.name));
@@ -927,12 +923,12 @@ void BKE_scene_init(Scene *sce)
copy_v3_fl(sce->eevee.bloom_color, 1.0f);
sce->eevee.bloom_threshold = 0.8f;
sce->eevee.bloom_knee = 0.5f;
- sce->eevee.bloom_intensity = 0.8f;
+ sce->eevee.bloom_intensity = 0.05f;
sce->eevee.bloom_radius = 6.5f;
- sce->eevee.bloom_clamp = 1.0f;
+ sce->eevee.bloom_clamp = 0.0f;
sce->eevee.motion_blur_samples = 8;
- sce->eevee.motion_blur_shutter = 1.0f;
+ sce->eevee.motion_blur_shutter = 0.5f;
sce->eevee.shadow_method = SHADOW_ESM;
sce->eevee.shadow_cube_size = 512;
@@ -1025,7 +1021,7 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
BKE_scene_validate_setscene(bmain, scene);
/* deselect objects (for dataselect) */
- for (ob = bmain->object.first; ob; ob = ob->id.next)
+ for (ob = bmain->objects.first; ob; ob = ob->id.next)
ob->flag &= ~SELECT;
/* copy layers and flags from bases to objects */
@@ -1124,10 +1120,10 @@ int BKE_scene_base_iter_next(Depsgraph *depsgraph, SceneBaseIter *iter,
else {
if (iter->phase != F_DUPLI) {
if (depsgraph && (*base)->object->transflag & OB_DUPLI) {
- /* collections cannot be duplicated for mballs yet,
+ /* collections cannot be duplicated for metaballs yet,
* this enters eternal loop because of
* makeDispListMBall getting called inside of collection_duplilist */
- if ((*base)->object->dup_group == NULL) {
+ if ((*base)->object->instance_collection == NULL) {
iter->duplilist = object_duplilist(depsgraph, (*scene), (*base)->object);
iter->dupob = iter->duplilist->first;
@@ -1182,7 +1178,7 @@ int BKE_scene_base_iter_next(Depsgraph *depsgraph, SceneBaseIter *iter,
Scene *BKE_scene_find_from_collection(const Main *bmain, const Collection *collection)
{
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
for (ViewLayer *layer = scene->view_layers.first; layer; layer = layer->next) {
if (BKE_view_layer_has_collection(layer, collection)) {
return scene;
@@ -1318,7 +1314,7 @@ bool BKE_scene_validate_setscene(Main *bmain, Scene *sce)
int a, totscene;
if (sce->set == NULL) return true;
- totscene = BLI_listbase_count(&bmain->scene);
+ totscene = BLI_listbase_count(&bmain->scenes);
for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, a++) {
/* more iterations than scenes means we have a cycle */
@@ -1387,19 +1383,19 @@ TransformOrientationSlot *BKE_scene_orientation_slot_get(Scene *scene, int flag)
/**
* Activate a transform orientation in a 3D view based on an enum value.
*
- * \param orientation: If this is #V3D_MANIP_CUSTOM or greater, the custom transform orientation
- * with index \a orientation - #V3D_MANIP_CUSTOM gets activated.
+ * \param orientation: If this is #V3D_ORIENT_CUSTOM or greater, the custom transform orientation
+ * with index \a orientation - #V3D_ORIENT_CUSTOM gets activated.
*/
void BKE_scene_orientation_slot_set_index(TransformOrientationSlot *orient_slot, int orientation)
{
- const bool is_custom = orientation >= V3D_MANIP_CUSTOM;
- orient_slot->type = is_custom ? V3D_MANIP_CUSTOM : orientation;
- orient_slot->index_custom = is_custom ? (orientation - V3D_MANIP_CUSTOM) : -1;
+ const bool is_custom = orientation >= V3D_ORIENT_CUSTOM;
+ orient_slot->type = is_custom ? V3D_ORIENT_CUSTOM : orientation;
+ orient_slot->index_custom = is_custom ? (orientation - V3D_ORIENT_CUSTOM) : -1;
}
int BKE_scene_orientation_slot_get_index(const TransformOrientationSlot *orient_slot)
{
- return (orient_slot->type == V3D_MANIP_CUSTOM) ? (orient_slot->type + orient_slot->index_custom) : orient_slot->type;
+ return (orient_slot->type == V3D_ORIENT_CUSTOM) ? (orient_slot->type + orient_slot->index_custom) : orient_slot->type;
}
/** \} */
@@ -1420,11 +1416,11 @@ int BKE_scene_orientation_slot_get_index(const TransformOrientationSlot *orient_
static void scene_armature_depsgraph_workaround(Main *bmain, Depsgraph *depsgraph)
{
Object *ob;
- if (BLI_listbase_is_empty(&bmain->armature) || !DEG_id_type_updated(depsgraph, ID_OB)) {
+ if (BLI_listbase_is_empty(&bmain->armatures) || !DEG_id_type_updated(depsgraph, ID_OB)) {
return;
}
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
- if (ob->type == OB_ARMATURE && ob->adt && ob->adt->recalc & ADT_RECALC_ANIM) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
+ if (ob->type == OB_ARMATURE && ob->adt) {
if (ob->pose == NULL || (ob->pose->flag & POSE_RECALC)) {
BKE_pose_rebuild(bmain, ob, ob->data, true);
}
@@ -1481,7 +1477,7 @@ static void prepare_mesh_for_viewport_render(
(mesh->id.recalc & ID_RECALC_ALL)))
{
if (check_rendered_viewport_visible(bmain)) {
- BMesh *bm = mesh->edit_btmesh->bm;
+ BMesh *bm = mesh->edit_mesh->bm;
BM_mesh_bm_to_me(
bmain, bm, mesh,
(&(struct BMeshToMeshParams){
@@ -1551,7 +1547,7 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph,
/* Update animated image textures for particles, modifiers, gpu, etc,
* call this at the start so modifiers with textures don't lag 1 frame.
*/
- BKE_image_update_frame(bmain, scene->r.cfra);
+ BKE_image_editors_update_frame(bmain, scene->r.cfra);
BKE_sound_set_cfra(scene->r.cfra);
DEG_graph_relations_update(depsgraph, bmain, scene, view_layer);
/* Update animated cache files for modifiers.
@@ -1829,6 +1825,7 @@ double BKE_scene_unit_scale(const UnitSettings *unit, const int unit_type, doubl
case B_UNIT_LENGTH:
return value * (double)unit->scale_length;
case B_UNIT_AREA:
+ case B_UNIT_POWER:
return value * pow(unit->scale_length, 2);
case B_UNIT_VOLUME:
return value * pow(unit->scale_length, 3);
@@ -2244,7 +2241,7 @@ void BKE_scene_transform_orientation_remove(
TransformOrientationSlot *orient_slot = &scene->orientation_slots[i];
if (orient_slot->index_custom == orientation_index) {
/* could also use orientation_index-- */
- orient_slot->type = V3D_MANIP_GLOBAL;
+ orient_slot->type = V3D_ORIENT_GLOBAL;
orient_slot->index_custom = -1;
}
}
@@ -2268,3 +2265,97 @@ int BKE_scene_transform_orientation_get_index(
}
/** \} */
+
+
+/* -------------------------------------------------------------------- */
+/** \name Scene Cursor Rotation
+ *
+ * Matches #BKE_object_rot_to_mat3 and #BKE_object_mat3_to_rot.
+ * \{ */
+
+void BKE_scene_cursor_rot_to_mat3(const View3DCursor *cursor, float mat[3][3])
+{
+ if (cursor->rotation_mode > 0) {
+ eulO_to_mat3(mat, cursor->rotation_euler, cursor->rotation_mode);
+ }
+ else if (cursor->rotation_mode == ROT_MODE_AXISANGLE) {
+ axis_angle_to_mat3(mat, cursor->rotation_axis, cursor->rotation_angle);
+ }
+ else {
+ float tquat[4];
+ normalize_qt_qt(tquat, cursor->rotation_quaternion);
+ quat_to_mat3(mat, tquat);
+ }
+}
+
+void BKE_scene_cursor_rot_to_quat(const View3DCursor *cursor, float quat[4])
+{
+ if (cursor->rotation_mode > 0) {
+ eulO_to_quat(quat, cursor->rotation_euler, cursor->rotation_mode);
+ }
+ else if (cursor->rotation_mode == ROT_MODE_AXISANGLE) {
+ axis_angle_to_quat(quat, cursor->rotation_axis, cursor->rotation_angle);
+ }
+ else {
+ normalize_qt_qt(quat, cursor->rotation_quaternion);
+ }
+}
+
+void BKE_scene_cursor_mat3_to_rot(View3DCursor *cursor, const float mat[3][3], bool use_compat)
+{
+ BLI_ASSERT_UNIT_M3(mat);
+
+ switch (cursor->rotation_mode) {
+ case ROT_MODE_QUAT:
+ {
+ mat3_normalized_to_quat(cursor->rotation_quaternion, mat);
+ break;
+ }
+ case ROT_MODE_AXISANGLE:
+ {
+ mat3_to_axis_angle(cursor->rotation_axis, &cursor->rotation_angle, mat);
+ break;
+ }
+ default:
+ {
+ if (use_compat) {
+ mat3_to_compatible_eulO(cursor->rotation_euler, cursor->rotation_euler, cursor->rotation_mode, mat);
+ }
+ else {
+ mat3_to_eulO(cursor->rotation_euler, cursor->rotation_mode, mat);
+ }
+ break;
+ }
+ }
+}
+
+void BKE_scene_cursor_quat_to_rot(View3DCursor *cursor, const float quat[4], bool use_compat)
+{
+ BLI_ASSERT_UNIT_QUAT(quat);
+
+ switch (cursor->rotation_mode) {
+ case ROT_MODE_QUAT:
+ {
+ copy_qt_qt(cursor->rotation_quaternion, quat);
+ break;
+ }
+ case ROT_MODE_AXISANGLE:
+ {
+ quat_to_axis_angle(cursor->rotation_axis, &cursor->rotation_angle, quat);
+ break;
+ }
+ default:
+ {
+ if (use_compat) {
+ quat_to_compatible_eulO(cursor->rotation_euler, cursor->rotation_euler, cursor->rotation_mode, quat);
+ }
+ else {
+ quat_to_eulO(cursor->rotation_euler, cursor->rotation_mode, quat);
+ }
+ break;
+ }
+ }
+}
+
+
+/** \} */
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 225f74616cf..7a2b93e6833 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/screen.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef WIN32
@@ -855,3 +847,20 @@ bool BKE_screen_is_used(const bScreen *screen)
{
return (screen->winid != 0);
}
+
+void BKE_screen_header_alignment_reset(bScreen *screen)
+{
+ int alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_HEADER) {
+ if (ELEM(sa->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_PROPERTIES)) {
+ ar->alignment = RGN_ALIGN_TOP;
+ continue;
+ }
+ ar->alignment = alignment;
+ }
+ }
+ }
+ screen->do_refresh = true;
+}
diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c
index 435d9369faa..14d6fb0a17e 100644
--- a/source/blender/blenkernel/intern/seqcache.c
+++ b/source/blender/blenkernel/intern/seqcache.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Peter Schlaile <peter [at] schlaile [dot] de> 2010
- *
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/seqcache.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stddef.h>
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 193db2b623f..6ef3f980c85 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -18,15 +16,12 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * Contributor(s):
* - Blender Foundation, 2003-2009
* - Peter Schlaile <peter [at] schlaile [dot] de> 2005/2006
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/seqeffects.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -37,8 +32,10 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h" /* windows needs for M_PI */
+#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BLI_rect.h"
+#include "BLI_path_util.h"
#include "BLI_string.h"
#include "DNA_scene_types.h"
@@ -47,6 +44,8 @@
#include "DNA_space_types.h"
#include "BKE_fcurve.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
#include "BKE_sequencer.h"
#include "IMB_imbuf_types.h"
@@ -102,7 +101,7 @@ enum {
GlowR = 0,
GlowG = 1,
GlowB = 2,
- GlowA = 3
+ GlowA = 3,
};
static ImBuf *prepare_effect_imbufs(const SeqRenderData *context, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *ibuf3)
@@ -1319,11 +1318,11 @@ BLI_INLINE void apply_blend_function_byte(
rt = out;
while (y--) {
for (x = xo; x > 0; x--) {
- achannel = rt2[3];
- rt2[3] = (unsigned int) achannel * facf0;
+ achannel = rt1[3];
+ rt1[3] = (unsigned int) achannel * facf0;
blend_function(rt, rt1, rt2);
- rt2[3] = achannel;
- rt[3] = rt2[3];
+ rt1[3] = achannel;
+ rt[3] = rt1[3];
rt1 += 4;
rt2 += 4;
rt += 4;
@@ -1333,11 +1332,11 @@ BLI_INLINE void apply_blend_function_byte(
}
y--;
for (x = xo; x > 0; x--) {
- achannel = rt2[3];
- rt2[3] = (unsigned int) achannel * facf1;
+ achannel = rt1[3];
+ rt1[3] = (unsigned int) achannel * facf1;
blend_function(rt, rt1, rt2);
- rt2[3] = achannel;
- rt[3] = rt2[3];
+ rt1[3] = achannel;
+ rt[3] = rt1[3];
rt1 += 4;
rt2 += 4;
rt += 4;
@@ -1358,11 +1357,11 @@ BLI_INLINE void apply_blend_function_float(
rt = out;
while (y--) {
for (x = xo; x > 0; x--) {
- achannel = rt2[3];
- rt2[3] = achannel * facf0;
+ achannel = rt1[3];
+ rt1[3] = achannel * facf0;
blend_function(rt, rt1, rt2);
- rt2[3] = achannel;
- rt[3] = rt2[3];
+ rt1[3] = achannel;
+ rt[3] = rt1[3];
rt1 += 4;
rt2 += 4;
rt += 4;
@@ -1372,11 +1371,11 @@ BLI_INLINE void apply_blend_function_float(
}
y--;
for (x = xo; x > 0; x--) {
- achannel = rt2[3];
- rt2[3] = achannel * facf1;
+ achannel = rt1[3];
+ rt1[3] = achannel * facf1;
blend_function(rt, rt1, rt2);
- rt2[3] = achannel;
- rt[3] = rt2[3];
+ rt1[3] = achannel;
+ rt[3] = rt1[3];
rt1 += 4;
rt2 += 4;
rt += 4;
@@ -3357,6 +3356,7 @@ static ImBuf *do_gaussian_blur_effect(
}
/*********************** text *************************/
+
static void init_text_effect(Sequence *seq)
{
TextVars *data;
@@ -3365,6 +3365,8 @@ static void init_text_effect(Sequence *seq)
MEM_freeN(seq->effectdata);
data = seq->effectdata = MEM_callocN(sizeof(TextVars), "textvars");
+ data->text_font = NULL;
+ data->text_blf_id = -1;
data->text_size = 30;
copy_v4_fl(data->color, 1.0f);
@@ -3377,6 +3379,64 @@ static void init_text_effect(Sequence *seq)
data->align_y = SEQ_TEXT_ALIGN_Y_BOTTOM;
}
+void BKE_sequencer_text_font_unload(TextVars *data, const bool do_id_user)
+{
+ if (data) {
+ /* Unlink the VFont */
+ if (do_id_user && data->text_font != NULL) {
+ id_us_min(&data->text_font->id);
+ data->text_font = NULL;
+ }
+
+ /* Unload the BLF font. */
+ if (data->text_blf_id >= 0) {
+ BLF_unload_id(data->text_blf_id);
+ }
+ }
+}
+
+void BKE_sequencer_text_font_load(TextVars *data, const bool do_id_user)
+{
+ if (data->text_font != NULL) {
+ if (do_id_user) {
+ id_us_plus(&data->text_font->id);
+ }
+
+ char path[FILE_MAX];
+ STRNCPY(path, data->text_font->name);
+ BLI_assert(BLI_thread_is_main());
+ BLI_path_abs(path, BKE_main_blendfile_path_from_global());
+
+ data->text_blf_id = BLF_load(path);
+ }
+}
+
+static void free_text_effect(Sequence *seq, const bool do_id_user)
+{
+ TextVars *data = seq->effectdata;
+ BKE_sequencer_text_font_unload(data, do_id_user);
+
+ if (data) {
+ MEM_freeN(data);
+ seq->effectdata = NULL;
+ }
+}
+
+static void load_text_effect(Sequence *seq)
+{
+ TextVars *data = seq->effectdata;
+ BKE_sequencer_text_font_load(data, false);
+}
+
+static void copy_text_effect(Sequence *dst, Sequence *src, const int flag)
+{
+ dst->effectdata = MEM_dupallocN(src->effectdata);
+ TextVars *data = dst->effectdata;
+
+ data->text_blf_id = -1;
+ BKE_sequencer_text_font_load(data, (flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0);
+}
+
static int num_inputs_text(void)
{
return 0;
@@ -3403,11 +3463,23 @@ static ImBuf *do_text_effect(
int height = out->y;
struct ColorManagedDisplay *display;
const char *display_device;
- const int mono = blf_mono_font_render; // XXX
+ int font = blf_mono_font_render;
int line_height;
int y_ofs, x, y;
float proxy_size_comp;
+ if (data->text_blf_id == SEQ_FONT_NOT_LOADED) {
+ data->text_blf_id = -1;
+
+ if (data->text_font) {
+ data->text_blf_id = BLF_load(data->text_font->name);
+ }
+ }
+
+ if (data->text_blf_id >= 0) {
+ font = data->text_blf_id;
+ }
+
display_device = context->scene->display_settings.display_device;
display = IMB_colormanagement_display_get_named(display_device);
@@ -3423,18 +3495,18 @@ static ImBuf *do_text_effect(
}
/* set before return */
- BLF_size(mono, proxy_size_comp * data->text_size, 72);
+ BLF_size(font, proxy_size_comp * data->text_size, 72);
- BLF_enable(mono, BLF_WORD_WRAP);
+ BLF_enable(font, BLF_WORD_WRAP);
/* use max width to enable newlines only */
- BLF_wordwrap(mono, (data->wrap_width != 0.0f) ? data->wrap_width * width : -1);
+ BLF_wordwrap(font, (data->wrap_width != 0.0f) ? data->wrap_width * width : -1);
- BLF_buffer(mono, out->rect_float, (unsigned char *)out->rect, width, height, out->channels, display);
+ BLF_buffer(font, out->rect_float, (unsigned char *)out->rect, width, height, out->channels, display);
- line_height = BLF_height_max(mono);
+ line_height = BLF_height_max(font);
- y_ofs = -BLF_descender(mono);
+ y_ofs = -BLF_descender(font);
x = (data->loc[0] * width);
y = (data->loc[1] * height) + y_ofs;
@@ -3451,7 +3523,7 @@ static ImBuf *do_text_effect(
rctf rect;
} wrap;
- BLF_boundbox_ex(mono, data->text, sizeof(data->text), &wrap.rect, &wrap.info);
+ BLF_boundbox_ex(font, data->text, sizeof(data->text), &wrap.rect, &wrap.info);
if (data->align == SEQ_TEXT_ALIGN_X_RIGHT) {
x -= BLI_rctf_size_x(&wrap.rect);
@@ -3474,19 +3546,20 @@ static ImBuf *do_text_effect(
/* BLF_SHADOW won't work with buffers, instead use cheap shadow trick */
if (data->flag & SEQ_TEXT_SHADOW) {
int fontx, fonty;
- fontx = BLF_width_max(mono);
+ fontx = BLF_width_max(font);
fonty = line_height;
- BLF_position(mono, x + max_ii(fontx / 25, 1), y + max_ii(fonty / 25, 1), 0.0f);
- BLF_buffer_col(mono, data->shadow_color);
- BLF_draw_buffer(mono, data->text, BLF_DRAW_STR_DUMMY_MAX);
+ BLF_position(font, x + max_ii(fontx / 25, 1), y + max_ii(fonty / 25, 1), 0.0f);
+ BLF_buffer_col(font, data->shadow_color);
+ BLF_draw_buffer(font, data->text, BLF_DRAW_STR_DUMMY_MAX);
}
- BLF_position(mono, x, y, 0.0f);
- BLF_buffer_col(mono, data->color);
- BLF_draw_buffer(mono, data->text, BLF_DRAW_STR_DUMMY_MAX);
- BLF_buffer(mono, NULL, NULL, 0, 0, 0, NULL);
+ BLF_position(font, x, y, 0.0f);
+ BLF_buffer_col(font, data->color);
+ BLF_draw_buffer(font, data->text, BLF_DRAW_STR_DUMMY_MAX);
+
+ BLF_buffer(font, NULL, NULL, 0, 0, 0, NULL);
- BLF_disable(mono, BLF_WORD_WRAP);
+ BLF_disable(font, BLF_WORD_WRAP);
return out;
}
@@ -3733,8 +3806,9 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
case SEQ_TYPE_TEXT:
rval.num_inputs = num_inputs_text;
rval.init = init_text_effect;
- rval.free = free_effect_default;
- rval.copy = copy_effect_default;
+ rval.free = free_text_effect;
+ rval.load = load_text_effect;
+ rval.copy = copy_text_effect;
rval.early_out = early_out_text;
rval.execute = do_text_effect;
break;
@@ -3763,8 +3837,15 @@ struct SeqEffectHandle BKE_sequence_get_blend(Sequence *seq)
struct SeqEffectHandle rval = {false, false, NULL};
if (seq->blend_mode != 0) {
+ if ((seq->flag & SEQ_EFFECT_NOT_LOADED) != 0) {
+ /* load the effect first */
+ rval = get_sequence_effect_impl(seq->type);
+ rval.load(seq);
+ }
+
rval = get_sequence_effect_impl(seq->blend_mode);
if ((seq->flag & SEQ_EFFECT_NOT_LOADED) != 0) {
+ /* now load the blend and unset unloaded flag */
rval.load(seq);
seq->flag &= ~SEQ_EFFECT_NOT_LOADED;
}
diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
index 4a483d439e4..268f554ea88 100644
--- a/source/blender/blenkernel/intern/seqmodifier.c
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/seqmodifier.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stddef.h>
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 40870fb6a0e..f9a1eed0ba7 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -18,15 +16,12 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * Contributor(s):
* - Blender Foundation, 2003-2009
* - Peter Schlaile <peter [at] schlaile [dot] de> 2005/2006
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/sequencer.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stddef.h>
@@ -401,7 +396,13 @@ static void sequence_clipboard_pointers(Main *bmain, Sequence *seq, void (*callb
callback(bmain, (ID **)&seq->clip);
callback(bmain, (ID **)&seq->mask);
callback(bmain, (ID **)&seq->sound);
+
+ if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) {
+ TextVars *text_data = seq->effectdata;
+ callback(bmain, (ID **)&text_data->text_font);
+ }
}
+
/* recursive versions of functions above */
void BKE_sequencer_base_clipboard_pointers_free(ListBase *seqbase)
{
@@ -1069,7 +1070,7 @@ void BKE_sequencer_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) {
+ for (scene_iter = bmain->scenes.first; scene_iter; scene_iter = scene_iter->id.next) {
if (scene_iter != scene && scene_iter->ed) {
BKE_sequencer_base_recursive_apply(&scene_iter->ed->seqbase, clear_scene_in_allseqs_cb, scene);
}
@@ -1957,7 +1958,7 @@ void BKE_sequencer_proxy_rebuild_context(
context = MEM_callocN(sizeof(SeqIndexBuildContext), "seq proxy rebuild context");
- nseq = BKE_sequence_dupli_recursive(scene, scene, seq, 0);
+ nseq = BKE_sequence_dupli_recursive(scene, scene, NULL, seq, 0);
context->tc_flags = nseq->strip->proxy->build_tc_flags;
context->size_flags = nseq->strip->proxy->build_size_flags;
@@ -3474,7 +3475,7 @@ static ImBuf *do_render_strip_uncached(
if (BLI_linklist_index(state->scene_parents, seq->scene) != -1) {
break;
}
- LinkNode scene_parent = {.next = state->scene_parents, .link = seq->scene};
+ LinkNode scene_parent = { .next = state->scene_parents, .link = seq->scene, };
state->scene_parents = &scene_parent;
/* end check */
@@ -5231,14 +5232,14 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
sound = BKE_sound_new_file(bmain, seq_load->path); /* handles relative paths */
if (sound->playback_handle == NULL) {
- BKE_libblock_free(bmain, sound);
+ BKE_id_free(bmain, sound);
return NULL;
}
info = AUD_getInfo(sound->playback_handle);
if (info.specs.channels == AUD_CHANNELS_INVALID) {
- BKE_libblock_free(bmain, sound);
+ BKE_id_free(bmain, sound);
return NULL;
}
@@ -5413,7 +5414,8 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
return seq;
}
-static Sequence *seq_dupli(const Scene *scene_src, Scene *scene_dst, Sequence *seq, int dupe_flag, const int flag)
+static Sequence *seq_dupli(
+ const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Sequence *seq, int dupe_flag, const int flag)
{
Sequence *seqn = MEM_dupallocN(seq);
@@ -5498,9 +5500,18 @@ static Sequence *seq_dupli(const Scene *scene_src, Scene *scene_dst, Sequence *s
BLI_assert(0);
}
+ /* When using SEQ_DUPE_UNIQUE_NAME, it is mandatory to add new sequences in relevant container
+ * (scene or meta's one), *before* checking for unique names. Otherwise the meta's list is empty
+ * and hence we miss all seqs in that meta that have already been duplicated (see T55668).
+ * Note that unique name check itslef could be done at a later step in calling code, once all seqs
+ * have bee duplicated (that was first, simpler solution), but then handling of animation data will
+ * be broken (see T60194). */
+ if (new_seq_list != NULL) {
+ BLI_addtail(new_seq_list, seqn);
+ }
+
if (scene_src == scene_dst) {
if (dupe_flag & SEQ_DUPE_UNIQUE_NAME) {
- /* TODO this is broken in case of Meta strips recursive duplication... Not trivial to fix. */
BKE_sequence_base_unique_name_recursive(&scene_dst->ed->seqbase, seqn);
}
@@ -5534,22 +5545,30 @@ static void seq_new_fix_links_recursive(Sequence *seq)
}
}
-Sequence *BKE_sequence_dupli_recursive(const Scene *scene_src, Scene *scene_dst, Sequence *seq, int dupe_flag)
+static Sequence *sequence_dupli_recursive_do(
+ const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Sequence *seq, const int dupe_flag)
{
Sequence *seqn;
seq->tmp = NULL;
- seqn = seq_dupli(scene_src, scene_dst, seq, dupe_flag, 0);
+ seqn = seq_dupli(scene_src, scene_dst, new_seq_list, seq, dupe_flag, 0);
if (seq->type == SEQ_TYPE_META) {
Sequence *s;
for (s = seq->seqbase.first; s; s = s->next) {
- Sequence *n = BKE_sequence_dupli_recursive(scene_src, scene_dst, s, dupe_flag);
- if (n) {
- BLI_addtail(&seqn->seqbase, n);
- }
+ sequence_dupli_recursive_do(scene_src, scene_dst, &seqn->seqbase, s, dupe_flag);
}
}
+ return seqn;
+}
+
+Sequence *BKE_sequence_dupli_recursive(
+ const Scene *scene_src, Scene *scene_dst,
+ ListBase *new_seq_list, Sequence *seq, int dupe_flag)
+{
+ Sequence *seqn = sequence_dupli_recursive_do(scene_src, scene_dst, new_seq_list, seq, dupe_flag);
+
+ /* This does not need to be in recursive call itself, since it is already recursive... */
seq_new_fix_links_recursive(seqn);
return seqn;
@@ -5568,14 +5587,13 @@ void BKE_sequence_base_dupli_recursive(
for (seq = seqbase->first; seq; seq = seq->next) {
seq->tmp = NULL;
if ((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) {
- seqn = seq_dupli(scene_src, scene_dst, seq, dupe_flag, flag);
+ seqn = seq_dupli(scene_src, scene_dst, nseqbase, seq, dupe_flag, flag);
if (seqn) { /*should never fail */
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_TYPE_META) {
BKE_sequence_base_dupli_recursive(
scene_src, scene_dst, &seqn->seqbase, &seq->seqbase,
@@ -5698,7 +5716,7 @@ static void sequencer_all_free_anim_ibufs(ListBase *seqbase, int cfra)
void BKE_sequencer_all_free_anim_ibufs(Main *bmain, int cfra)
{
BKE_sequencer_cache_cleanup();
- for (Scene *scene = bmain->scene.first;
+ for (Scene *scene = bmain->scenes.first;
scene != NULL;
scene = scene->id.next)
{
diff --git a/source/blender/blenkernel/intern/shader_fx.c b/source/blender/blenkernel/intern/shader_fx.c
index f19b450dece..6bd120f64a9 100644
--- a/source/blender/blenkernel/intern/shader_fx.c
+++ b/source/blender/blenkernel/intern/shader_fx.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/shader_fx.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -45,7 +39,6 @@
#include "DNA_gpencil_types.h"
#include "DNA_shader_fx_types.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_gpencil.h"
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index 06e5cc9e849..4c219fa14f2 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Andr Pinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/shrinkwrap.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <string.h>
@@ -410,7 +402,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
nearest.index = -1;
nearest.dist_sq = FLT_MAX;
- ShrinkwrapCalcCBData data = {.calc = calc, .tree = calc->tree};
+ ShrinkwrapCalcCBData data = { .calc = calc, .tree = calc->tree, };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (calc->numVerts > BKE_MESH_OMP_LIMIT);
@@ -633,7 +625,6 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
/* auxiliary target */
Mesh *auxMesh = NULL;
- bool auxMesh_free;
ShrinkwrapTreeData *aux_tree = NULL;
ShrinkwrapTreeData aux_tree_stack;
SpaceTransform local2aux;
@@ -663,7 +654,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
}
if (calc->aux_target) {
- auxMesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(calc->aux_target, &auxMesh_free);
+ auxMesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(calc->aux_target, false);
if (!auxMesh)
return;
BLI_SPACE_TRANSFORM_SETUP(&local2aux, calc->ob, calc->aux_target);
@@ -676,7 +667,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
/* After successfully build the trees, start projection vertices. */
ShrinkwrapCalcCBData data = {
.calc = calc, .tree = calc->tree, .aux_tree = aux_tree,
- .proj_axis = proj_axis, .local2aux = &local2aux
+ .proj_axis = proj_axis, .local2aux = &local2aux,
};
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
@@ -692,9 +683,6 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
if (aux_tree) {
BKE_shrinkwrap_free_tree(aux_tree);
}
- if (auxMesh != NULL && auxMesh_free) {
- BKE_id_free(NULL, auxMesh);
- }
}
/*
@@ -852,7 +840,7 @@ static bool target_project_solve_point_tri(
x[2] = (dot_v3v3(tmp, r_hit_no) < 0) ? -dist : dist;
/* Solve the equations iteratively. */
- TargetProjectTriData tri_data = { .vtri_co = vtri_co, .vtri_no = vtri_no, .point_co = point_co };
+ TargetProjectTriData tri_data = { .vtri_co = vtri_co, .vtri_no = vtri_no, .point_co = point_co, };
sub_v3_v3v3(tri_data.n0_minus_n2, vtri_no[0], vtri_no[2]);
sub_v3_v3v3(tri_data.n1_minus_n2, vtri_no[1], vtri_no[2]);
@@ -1182,17 +1170,22 @@ static void shrinkwrap_snap_with_side(float r_point_co[3], const float point_co[
/* If exactly on the surface, push out along normal */
if (dist < FLT_EPSILON) {
- madd_v3_v3v3fl(r_point_co, hit_co, hit_no, goal_dist * forcesign);
+ if (forcesnap || goal_dist > 0) {
+ madd_v3_v3v3fl(r_point_co, hit_co, hit_no, goal_dist * forcesign);
+ }
+ else {
+ copy_v3_v3(r_point_co, hit_co);
+ }
}
/* Move to the correct side if needed */
else {
float delta[3];
sub_v3_v3v3(delta, point_co, hit_co);
- float dsign = signf(dot_v3v3(delta, hit_no));
+ float dsign = signf(dot_v3v3(delta, hit_no) * forcesign);
/* If on the wrong side or too close, move to correct */
- if (forcesnap || dsign * forcesign < 0 || dist < goal_dist) {
- interp_v3_v3v3(r_point_co, point_co, hit_co, (dist - goal_dist * dsign * forcesign) / dist);
+ if (forcesnap || dsign * dist < goal_dist) {
+ interp_v3_v3v3(r_point_co, point_co, hit_co, (dist - goal_dist * dsign) / dist);
}
else {
copy_v3_v3(r_point_co, point_co);
@@ -1217,7 +1210,7 @@ void BKE_shrinkwrap_snap_point_to_surface(
switch (mode) {
/* Offsets along the line between point_co and hit_co. */
case MOD_SHRINKWRAP_ON_SURFACE:
- if (goal_dist > 0 && (dist = len_v3v3(point_co, hit_co)) > FLT_EPSILON) {
+ if (goal_dist != 0 && (dist = len_v3v3(point_co, hit_co)) > FLT_EPSILON) {
interp_v3_v3v3(r_point_co, point_co, hit_co, (dist - goal_dist) / dist);
}
else {
@@ -1234,7 +1227,7 @@ void BKE_shrinkwrap_snap_point_to_surface(
break;
case MOD_SHRINKWRAP_OUTSIDE_SURFACE:
- if (goal_dist > 0) {
+ if (goal_dist != 0) {
shrinkwrap_snap_with_side(r_point_co, point_co, hit_co, hit_no, goal_dist, +1, true);
}
else {
@@ -1244,7 +1237,7 @@ void BKE_shrinkwrap_snap_point_to_surface(
/* Offsets along the normal */
case MOD_SHRINKWRAP_ABOVE_SURFACE:
- if (goal_dist > 0) {
+ if (goal_dist != 0) {
BKE_shrinkwrap_compute_smooth_normal(tree, transform, hit_idx, hit_co, hit_no, tmp);
madd_v3_v3v3fl(r_point_co, hit_co, tmp, goal_dist);
}
@@ -1268,7 +1261,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
nearest.dist_sq = FLT_MAX;
/* Find the nearest vertex */
- ShrinkwrapCalcCBData data = {.calc = calc, .tree = calc->tree};
+ ShrinkwrapCalcCBData data = { .calc = calc, .tree = calc->tree, };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (calc->numVerts > BKE_MESH_OMP_LIMIT);
@@ -1289,7 +1282,6 @@ void shrinkwrapModifier_deform(
DerivedMesh *ss_mesh = NULL;
ShrinkwrapCalcData calc = NULL_ShrinkwrapCalcData;
- bool target_free = false;
/* remove loop dependencies on derived meshes (TODO should this be done elsewhere?) */
if (smd->target == ob) smd->target = NULL;
@@ -1307,7 +1299,7 @@ void shrinkwrapModifier_deform(
if (smd->target != NULL) {
Object *ob_target = DEG_get_evaluated_object(ctx->depsgraph, smd->target);
- calc.target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, &target_free);
+ calc.target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false);
/* TODO there might be several "bugs" on non-uniform scales matrixs
* because it will no longer be nearest surface, not sphere projection
@@ -1378,8 +1370,4 @@ void shrinkwrapModifier_deform(
/* free memory */
if (ss_mesh)
ss_mesh->release(ss_mesh);
-
- if (target_free && calc.target) {
- BKE_id_free(NULL, calc.target);
- }
}
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 5f9015ae2ce..4b9dd9ac6e3 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Daniel Genrich
- * Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/smoke.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -42,18 +33,15 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
-#include "BLI_kdtree.h"
#include "BLI_kdopbvh.h"
-#include "BLI_task.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
-#include "BLI_voxel.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_customdata_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
@@ -72,9 +60,7 @@
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_effect.h"
-#include "BKE_global.h"
#include "BKE_library.h"
-#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_modifier.h"
@@ -105,6 +91,10 @@
#ifdef WITH_SMOKE
+#include "BLI_task.h"
+#include "BLI_kdtree.h"
+#include "BLI_voxel.h"
+
static ThreadMutex object_update_lock = BLI_MUTEX_INITIALIZER;
struct Mesh;
@@ -132,13 +122,13 @@ void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha),
int *UNUSED(border_colli), float *UNUSED(burning_rate), float *UNUSED(flame_smoke), float *UNUSED(flame_smoke_color),
float *UNUSED(flame_vorticity), float *UNUSED(flame_ignition_temp), float *UNUSED(flame_max_temp)) {}
struct Mesh *smokeModifier_do(SmokeModifierData *UNUSED(smd), Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *UNUSED(ob), Mesh *UNUSED(me)) { return NULL; }
-float smoke_get_velocity_at(struct Object *UNUSED(ob), float UNUSED(position[3]), float UNUSED(velocity[3])) { return 0.0f; }
+float BKE_smoke_get_velocity_at(struct Object *UNUSED(ob), float UNUSED(position[3]), float UNUSED(velocity[3])) { return 0.0f; }
#endif /* WITH_SMOKE */
#ifdef WITH_SMOKE
-void smoke_reallocate_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
+void BKE_smoke_reallocate_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
{
int use_heat = (sds->active_fields & SM_ACTIVE_HEAT);
int use_fire = (sds->active_fields & SM_ACTIVE_FIRE);
@@ -160,7 +150,7 @@ void smoke_reallocate_fluid(SmokeDomainSettings *sds, float dx, int res[3], int
sds->shadow = MEM_callocN(sizeof(float) * res[0] * res[1] * res[2], "SmokeDomainShadow");
}
-void smoke_reallocate_highres_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
+void BKE_smoke_reallocate_highres_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
{
int use_fire = (sds->active_fields & (SM_ACTIVE_HEAT | SM_ACTIVE_FIRE));
int use_colors = (sds->active_fields & SM_ACTIVE_COLORS);
@@ -235,7 +225,7 @@ static void smoke_set_domain_from_mesh(SmokeDomainSettings *sds, Object *ob, Mes
}
/* apply object scale */
for (i = 0; i < 3; i++) {
- size[i] = fabsf(size[i] * ob->size[i]);
+ size[i] = fabsf(size[i] * ob->scale[i]);
}
copy_v3_v3(sds->global_size, size);
copy_v3_v3(sds->dp0, min);
@@ -249,21 +239,21 @@ static void smoke_set_domain_from_mesh(SmokeDomainSettings *sds, Object *ob, Mes
/* define grid resolutions from longest domain side */
if (size[0] >= MAX2(size[1], size[2])) {
scale = res / size[0];
- sds->scale = size[0] / fabsf(ob->size[0]);
+ sds->scale = size[0] / fabsf(ob->scale[0]);
sds->base_res[0] = res;
sds->base_res[1] = max_ii((int)(size[1] * scale + 0.5f), 4);
sds->base_res[2] = max_ii((int)(size[2] * scale + 0.5f), 4);
}
else if (size[1] >= MAX2(size[0], size[2])) {
scale = res / size[1];
- sds->scale = size[1] / fabsf(ob->size[1]);
+ sds->scale = size[1] / fabsf(ob->scale[1]);
sds->base_res[0] = max_ii((int)(size[0] * scale + 0.5f), 4);
sds->base_res[1] = res;
sds->base_res[2] = max_ii((int)(size[2] * scale + 0.5f), 4);
}
else {
scale = res / size[2];
- sds->scale = size[2] / fabsf(ob->size[2]);
+ sds->scale = size[2] / fabsf(ob->scale[2]);
sds->base_res[0] = max_ii((int)(size[0] * scale + 0.5f), 4);
sds->base_res[1] = max_ii((int)(size[1] * scale + 0.5f), 4);
sds->base_res[2] = res;
@@ -296,21 +286,21 @@ static int smokeModifier_init(SmokeModifierData *smd, Object *ob, int scene_fram
res[0] = res[1] = res[2] = 1; /* use minimum res for adaptive init */
}
else {
- VECCOPY(res, sds->base_res);
+ copy_v3_v3_int(res, sds->base_res);
}
- VECCOPY(sds->res, res);
+ copy_v3_v3_int(sds->res, res);
sds->total_cells = sds->res[0] * sds->res[1] * sds->res[2];
sds->res_min[0] = sds->res_min[1] = sds->res_min[2] = 0;
- VECCOPY(sds->res_max, res);
+ copy_v3_v3_int(sds->res_max, res);
/* allocate fluid */
- smoke_reallocate_fluid(sds, sds->dx, sds->res, 0);
+ BKE_smoke_reallocate_fluid(sds, sds->dx, sds->res, 0);
smd->time = scene_framenr;
/* allocate highres fluid */
if (sds->flags & MOD_SMOKE_HIGHRES) {
- smoke_reallocate_highres_fluid(sds, sds->dx, sds->res, 0);
+ BKE_smoke_reallocate_highres_fluid(sds, sds->dx, sds->res, 0);
}
/* allocate shadow buffer */
if (!sds->shadow)
@@ -537,7 +527,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
smd->domain->flame_smoke_color[1] = 0.7f;
smd->domain->flame_smoke_color[2] = 0.7f;
- smd->domain->viewsettings = MOD_SMOKE_VIEW_SHOWBIG;
+ smd->domain->viewsettings = MOD_SMOKE_VIEW_SHOW_HIGHRES;
smd->domain->effector_weights = BKE_effector_add_weights(NULL);
#ifdef WITH_OPENVDB_BLOSC
@@ -681,6 +671,8 @@ void smokeModifier_copy(const struct SmokeModifierData *smd, struct SmokeModifie
if (sds->coba) {
tsds->coba = MEM_dupallocN(sds->coba);
}
+
+ tsds->clipping = sds->clipping;
}
else if (tsmd->flow) {
SmokeFlowSettings *tsfs = tsmd->flow;
@@ -723,28 +715,28 @@ void smokeModifier_copy(const struct SmokeModifierData *smd, struct SmokeModifie
static void smoke_calc_transparency(SmokeDomainSettings *sds, ViewLayer *view_layer);
static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct);
-static int get_lamp(ViewLayer *view_layer, float *light)
+static int get_light(ViewLayer *view_layer, float *light)
{
Base *base_tmp = NULL;
- int found_lamp = 0;
+ int found_light = 0;
// try to find a lamp, preferably local
for (base_tmp = FIRSTBASE(view_layer); base_tmp; base_tmp = base_tmp->next) {
if (base_tmp->object->type == OB_LAMP) {
- Lamp *la = base_tmp->object->data;
+ Light *la = base_tmp->object->data;
if (la->type == LA_LOCAL) {
copy_v3_v3(light, base_tmp->object->obmat[3]);
return 1;
}
- else if (!found_lamp) {
+ else if (!found_light) {
copy_v3_v3(light, base_tmp->object->obmat[3]);
- found_lamp = 1;
+ found_light = 1;
}
}
}
- return found_lamp;
+ return found_light;
}
/**********************************************************
@@ -881,7 +873,7 @@ static void obstacles_from_mesh(
normal_float_to_short_v3(mvert[i].no, n);
/* vert velocity */
- VECADD(co, mvert[i].co, sds->shift);
+ add_v3fl_v3fl_v3i(co, mvert[i].co, sds->shift);
if (has_velocity)
{
sub_v3_v3v3(&vert_vel[i * 3], co, &scs->verts_old[i * 3]);
@@ -896,7 +888,7 @@ static void obstacles_from_mesh(
.tree = &treeData, .obstacle_map = obstacle_map,
.has_velocity = has_velocity, .vert_vel = vert_vel,
.velocityX = velocityX, .velocityY = velocityY, .velocityZ = velocityZ,
- .num_obstacles = num_obstacles
+ .num_obstacles = num_obstacles,
};
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
@@ -1254,8 +1246,7 @@ static void emit_from_particles_task_cb(
1.0f : (1.0f - (nearest.dist - data->solid) / data->smooth);
/* Uses particle velocity as initial velocity for smoke */
if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (sfs->psys->part->phystype != PART_PHYS_NO)) {
- VECADDFAC(&em->velocity[index * 3], &em->velocity[index * 3],
- &data->particle_vel[nearest.index * 3], sfs->vel_multi);
+ madd_v3_v3fl(&em->velocity[index * 3], &data->particle_vel[nearest.index * 3], sfs->vel_multi);
}
}
}
@@ -1414,7 +1405,7 @@ static void emit_from_particles(
/* Uses particle velocity as initial velocity for smoke */
if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO))
{
- VECADDFAC(&em->velocity[index * 3], &em->velocity[index * 3], &particle_vel[p * 3], sfs->vel_multi);
+ madd_v3_v3fl(&em->velocity[index * 3], &particle_vel[p * 3], sfs->vel_multi);
}
} // particles loop
}
@@ -1736,7 +1727,7 @@ static void emit_from_mesh(Object *flow_ob, SmokeDomainSettings *sds, SmokeFlowS
/* vert velocity */
if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY) {
float co[3];
- VECADD(co, mvert[i].co, sds->shift);
+ add_v3fl_v3fl_v3i(co, mvert[i].co, sds->shift);
if (has_velocity) {
sub_v3_v3v3(&vert_vel[i * 3], co, &sfs->verts_old[i * 3]);
mul_v3_fl(&vert_vel[i * 3], sds->dx / dt);
@@ -1939,9 +1930,9 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
struct FLUID_3D *fluid_old = sds->fluid;
struct WTURBULENCE *turb_old = sds->wt;
/* allocate new fluid data */
- smoke_reallocate_fluid(sds, sds->dx, res, 0);
+ BKE_smoke_reallocate_fluid(sds, sds->dx, res, 0);
if (sds->flags & MOD_SMOKE_HIGHRES) {
- smoke_reallocate_highres_fluid(sds, sds->dx, res, 0);
+ BKE_smoke_reallocate_highres_fluid(sds, sds->dx, res, 0);
}
/* copy values from old fluid to new */
@@ -2052,9 +2043,9 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
smoke_turbulence_free(turb_old);
/* set new domain dimensions */
- VECCOPY(sds->res_min, min);
- VECCOPY(sds->res_max, max);
- VECCOPY(sds->res, res);
+ copy_v3_v3_int(sds->res_min, min);
+ copy_v3_v3_int(sds->res_max, max);
+ copy_v3_v3_int(sds->res, res);
sds->total_cells = total_cells;
}
}
@@ -2150,7 +2141,7 @@ static void update_flowsfluids(
mul_m4_v3(ob->obmat, ob_loc);
- VECSUB(frame_shift_f, ob_loc, sds->prev_loc);
+ sub_v3_v3v3(frame_shift_f, ob_loc, sds->prev_loc);
copy_v3_v3(sds->prev_loc, ob_loc);
/* convert global space shift to local "cell" space */
mul_mat3_m4_v3(sds->imat, frame_shift_f);
@@ -2158,12 +2149,12 @@ static void update_flowsfluids(
frame_shift_f[1] = frame_shift_f[1] / sds->cell_size[1];
frame_shift_f[2] = frame_shift_f[2] / sds->cell_size[2];
/* add to total shift */
- VECADD(sds->shift_f, sds->shift_f, frame_shift_f);
+ add_v3_v3(sds->shift_f, frame_shift_f);
/* convert to integer */
- total_shift[0] = floor(sds->shift_f[0]);
- total_shift[1] = floor(sds->shift_f[1]);
- total_shift[2] = floor(sds->shift_f[2]);
- VECSUB(new_shift, total_shift, sds->shift);
+ total_shift[0] = (int)(floorf(sds->shift_f[0]));
+ total_shift[1] = (int)(floorf(sds->shift_f[1]));
+ total_shift[2] = (int)(floorf(sds->shift_f[2]));
+ sub_v3_v3v3_int(new_shift, total_shift, sds->shift);
copy_v3_v3_int(sds->shift, total_shift);
/* calculate new domain boundary points so that smoke doesn't slide on sub-cell movement */
@@ -2689,8 +2680,8 @@ static Mesh *createDomainGeometry(SmokeDomainSettings *sds, Object *ob)
if (num_verts) {
/* volume bounds */
- VECMADD(min, sds->p0, sds->cell_size, sds->res_min);
- VECMADD(max, sds->p0, sds->cell_size, sds->res_max);
+ madd_v3fl_v3fl_v3fl_v3i(min, sds->p0, sds->cell_size, sds->res_min);
+ madd_v3fl_v3fl_v3fl_v3i(max, sds->p0, sds->cell_size, sds->res_max);
/* set vertices */
/* top slab */
@@ -2729,7 +2720,7 @@ static Mesh *createDomainGeometry(SmokeDomainSettings *sds, Object *ob)
invert_m4_m4(ob->imat, ob->obmat);
mul_m4_v3(ob->obmat, ob_loc);
mul_m4_v3(sds->obmat, ob_cache_loc);
- VECSUB(sds->obj_shift_f, ob_cache_loc, ob_loc);
+ sub_v3_v3v3(sds->obj_shift_f, ob_cache_loc, ob_loc);
/* convert shift to local space and apply to vertices */
mul_mat3_m4_v3(ob->imat, sds->obj_shift_f);
/* apply */
@@ -2899,15 +2890,21 @@ struct Mesh *smokeModifier_do(
BLI_rw_mutex_unlock(smd->domain->fluid_mutex);
/* return generated geometry for adaptive domain */
+ Mesh *result;
if (smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain &&
smd->domain->flags & MOD_SMOKE_ADAPTIVE_DOMAIN &&
smd->domain->base_res[0])
{
- return createDomainGeometry(smd->domain, ob);
+ result = createDomainGeometry(smd->domain, ob);
}
else {
- return BKE_mesh_copy_for_eval(me, false);
+ result = BKE_mesh_copy_for_eval(me, false);
}
+ /* XXX This is really not a nice hack, but until root of the problem is understood,
+ * this should be an acceptable workaround I think.
+ * See T58492 for details on the issue. */
+ result->texflag |= ME_AUTOSPACE;
+ return result;
}
static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct)
@@ -3016,7 +3013,7 @@ static void smoke_calc_transparency(SmokeDomainSettings *sds, ViewLayer *view_la
float *density = smoke_get_density(sds->fluid);
float correct = -7.0f * sds->dx;
- if (!get_lamp(view_layer, light)) return;
+ if (!get_light(view_layer, light)) return;
/* convert light pos to sim cell space */
mul_m4_v3(sds->imat, light);
@@ -3081,7 +3078,7 @@ static void smoke_calc_transparency(SmokeDomainSettings *sds, ViewLayer *view_la
/* get smoke velocity and density at given coordinates
* returns fluid density or -1.0f if outside domain. */
-float smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3])
+float BKE_smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3])
{
SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
zero_v3(velocity);
@@ -3135,7 +3132,7 @@ float smoke_get_velocity_at(struct Object *ob, float position[3], float velocity
return -1.0f;
}
-int smoke_get_data_flags(SmokeDomainSettings *sds)
+int BKE_smoke_get_data_flags(SmokeDomainSettings *sds)
{
int flags = 0;
@@ -3152,3 +3149,14 @@ int smoke_get_data_flags(SmokeDomainSettings *sds)
}
#endif /* WITH_SMOKE */
+
+bool BKE_smoke_show_highres(Scene *scene, SmokeDomainSettings *sds)
+{
+ if ((sds->viewsettings & MOD_SMOKE_VIEW_SHOW_HIGHRES) == 0) {
+ return false;
+ }
+ if (scene->r.mode & R_SIMPLIFY) {
+ return !scene->r.simplify_smoke_ignore_highres;
+ }
+ return true;
+}
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 87687e33f8f..a1e2e0971d1 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/softbody.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -35,7 +27,7 @@
* <pre>
* float mediafrict; friction to env
* float nodemass; softbody mass of *vertex*
- * float grav; softbody amount of gravitaion to apply
+ * float grav; softbody amount of gravitation to apply
*
* float goalspring; softbody goal springs
* float goalfrict; softbody goal springs friction
@@ -52,6 +44,8 @@
#include <stdlib.h>
#include <string.h>
+#include "CLG_log.h"
+
#include "MEM_guardedalloc.h"
/* types */
@@ -87,6 +81,8 @@
#include "PIL_time.h"
+static CLG_LogRef LOG = {"bke.softbody"};
+
/* callbacks for errors and interrupts and some goo */
static int (*SB_localInterruptCallBack)(void) = NULL;
@@ -235,7 +231,7 @@ static float _final_goal(Object *ob, BodyPoint *bp)/*jow_go_for2_5 */
return (f);
}
}
- printf("_final_goal failed! sb or bp ==NULL\n");
+ CLOG_ERROR(&LOG, "sb or bp == NULL");
return f; /*using crude but spot able values some times helps debuggin */
}
@@ -247,7 +243,7 @@ static float _final_mass(Object *ob, BodyPoint *bp)
return(bp->mass*sb->nodemass);
}
}
- printf("_final_mass failed! sb or bp ==NULL\n");
+ CLOG_ERROR(&LOG, "sb or bp == NULL");
return 1.0f;
}
/* helper functions for everything is animateble jow_go_for2_5 ------*/
@@ -654,7 +650,7 @@ static void add_2nd_order_roller(Object *ob, float UNUSED(stiffness), int *count
notthis = bs->v1;
}
else {
- printf("oops we should not get here - add_2nd_order_springs");
+ CLOG_ERROR(&LOG, "oops we should not get here");
}
}
if (bpo) {/* so now we have a 2nd order humpdidump */
@@ -1010,7 +1006,7 @@ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), struct Object
}
else {
/*aye that should be cached*/
- printf("missing cache error\n");
+ CLOG_ERROR(&LOG, "missing cache error");
BLI_ghashIterator_step(ihash);
continue;
}
@@ -1080,7 +1076,7 @@ static int sb_detect_face_pointCached(float face_v1[3], float face_v2[3], float
}
else {
/*aye that should be cached*/
- printf("missing cache error\n");
+ CLOG_ERROR(&LOG, "missing cache error");
BLI_ghashIterator_step(ihash);
continue;
}
@@ -1179,7 +1175,7 @@ static int sb_detect_face_collisionCached(float face_v1[3], float face_v2[3], fl
}
else {
/*aye that should be cached*/
- printf("missing cache error\n");
+ CLOG_ERROR(&LOG, "missing cache error");
BLI_ghashIterator_step(ihash);
continue;
}
@@ -1361,7 +1357,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3], float edge_v2[3], fl
}
else {
/*aye that should be cached*/
- printf("missing cache error\n");
+ CLOG_ERROR(&LOG, "missing cache error");
BLI_ghashIterator_step(ihash);
continue;
}
@@ -1503,16 +1499,6 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
}
}
-
-static void scan_for_ext_spring_forces(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float timenow)
-{
- SoftBody *sb = ob->soft;
-
- ListBase *effectors = BKE_effectors_create(depsgraph, ob, NULL, sb->effector_weights);
- _scan_for_ext_spring_forces(scene, ob, timenow, 0, sb->totspring, effectors);
- BKE_effectors_free(effectors);
-}
-
static void *exec_scan_for_ext_spring_forces(void *data)
{
SB_thread_context *pctx = (SB_thread_context*)data;
@@ -1668,7 +1654,7 @@ static int sb_detect_vertex_collisionCached(
}
else {
/*aye that should be cached*/
- printf("missing cache error\n");
+ CLOG_ERROR(&LOG, "missing cache error");
BLI_ghashIterator_step(ihash);
continue;
}
@@ -1877,7 +1863,7 @@ static void sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, floa
else {
/* TODO make this debug option */
/**/
- printf("bodypoint <bpi> is not attached to spring <*bs> --> sb_spring_force()\n");
+ CLOG_WARN(&LOG, "bodypoint <bpi> is not attached to spring <*bs>");
return;
}
@@ -1932,7 +1918,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
float iks;
int bb, do_selfcollision, do_springcollision, do_aero;
int number_of_points_here = ilast - ifirst;
- SoftBody *sb= ob->soft; /* is supposed to be there */
+ SoftBody *sb = ob->soft; /* is supposed to be there */
BodyPoint *bp;
/* initialize */
@@ -1945,7 +1931,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* --- could be done on object level to squeeze out the last bits of it */
}
else {
- printf("Error expected a SB here\n");
+ CLOG_ERROR(&LOG, "expected a SB here");
return (999);
}
@@ -1988,7 +1974,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
bs = sb->bspring + obp->springs[b-1];
if (( ilast-bb == bs->v2) || ( ilast-bb == bs->v1)) {
attached=1;
- continue;}
+ continue;
+ }
}
if (!attached) {
float f = bstune / (distance) + bstune / (compare * compare) * distance - 2.0f * bstune / compare;
@@ -2187,7 +2174,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
MEM_freeN(sb_threads);
}
-static void softbody_calc_forcesEx(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float forcetime, float timenow)
+static void softbody_calc_forces(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float forcetime, float timenow)
{
/* rule we never alter free variables :bp->vec bp->pos in here !
* this will ruin adaptive stepsize AKA heun! (BM)
@@ -2230,256 +2217,6 @@ static void softbody_calc_forcesEx(struct Depsgraph *depsgraph, Scene *scene, Ob
BKE_effectors_free(effectors);
}
-
-static void softbody_calc_forces(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float forcetime, float timenow)
-{
- /* redirection to the new threaded Version */
- if (!(G.debug_value & 0x10)) { // 16
- softbody_calc_forcesEx(depsgraph, scene, ob, forcetime, timenow);
- return;
- }
- else {
- /* so the following will die */
- /* |||||||||||||||||||||||||| */
- /* VVVVVVVVVVVVVVVVVVVVVVVVVV */
- /*backward compatibility note:
- fixing bug [17428] which forces adaptive step size to tiny steps
- in some situations
- .. keeping G.debug_value==17 0x11 option for old files 'needing' the bug*/
-
- /* rule we never alter free variables :bp->vec bp->pos in here !
- * this will ruin adaptive stepsize AKA heun! (BM)
- */
- SoftBody *sb= ob->soft; /* is supposed to be there */
- BodyPoint *bp;
- /* BodyPoint *bproot; */ /* UNUSED */
- BodySpring *bs;
- float iks, ks, kd, gravity[3] = {0.0f, 0.0f, 0.0f};
- float fieldfactor = -1.0f, windfactor = 0.25f;
- float tune = sb->ballstiff;
- int do_deflector, do_selfcollision, do_springcollision, do_aero;
-
- if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
- copy_v3_v3(gravity, scene->physics_settings.gravity);
- mul_v3_fl(gravity, sb_grav_force_scale(ob)*sb->effector_weights->global_gravity);
- }
-
- /* check conditions for various options */
- do_deflector= query_external_colliders(depsgraph, sb->collision_group);
- do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF));
- do_springcollision=do_deflector && (ob->softflag & OB_SB_EDGES) &&(ob->softflag & OB_SB_EDGECOLL);
- do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES));
-
- iks = 1.0f/(1.0f-sb->inspring)-1.0f ;/* inner spring constants function */
- /* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */
-
- if (do_springcollision || do_aero) scan_for_ext_spring_forces(depsgraph, scene, ob, timenow);
- /* after spring scan because it uses Effoctors too */
- ListBase *effectors = BKE_effectors_create(depsgraph, ob, NULL, ob->soft->effector_weights);
-
- if (do_deflector) {
- float defforce[3];
- do_deflector = sb_detect_aabb_collisionCached(defforce, ob, timenow);
- }
-
- bp = sb->bpoint;
- for (int a = sb->totpoint; a > 0; a--, bp++) {
- /* clear forces accumulator */
- bp->force[0] = bp->force[1] = bp->force[2] = 0.0;
-
- /* naive ball self collision */
- /* needs to be done if goal snaps or not */
- if (do_selfcollision) {
- int attached;
- BodyPoint *obp;
- int c, b;
- float velcenter[3], dvel[3], def[3];
- float distance;
- float compare;
-
- for (c=sb->totpoint, obp= sb->bpoint; c>=a; c--, obp++) {
-
- //if ((bp->octantflag & obp->octantflag) == 0) continue;
-
- compare = (obp->colball + bp->colball);
- sub_v3_v3v3(def, bp->pos, obp->pos);
-
- /* rather check the AABBoxes before ever calculating the real distance */
- /* mathematically it is completely 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 ) {
- /* exclude body points attached with a spring */
- attached = 0;
- for (b=obp->nofsprings;b>0;b--) {
- bs = sb->bspring + obp->springs[b-1];
- if (( sb->totpoint-a == bs->v2) || ( sb->totpoint-a == bs->v1)) {
- attached=1;
- continue;}
- }
- if (!attached) {
- float f = tune / (distance) + tune / (compare * compare) * distance - 2.0f * tune/compare;
-
- mid_v3_v3v3(velcenter, bp->vec, obp->vec);
- sub_v3_v3v3(dvel, velcenter, bp->vec);
- mul_v3_fl(dvel, _final_mass(ob, bp));
-
- madd_v3_v3fl(bp->force, def, f * (1.0f - sb->balldamp));
- madd_v3_v3fl(bp->force, dvel, sb->balldamp);
-
- /* exploit force(a, b) == -force(b, a) part2/2 */
- sub_v3_v3v3(dvel, velcenter, obp->vec);
- mul_v3_fl(dvel, (_final_mass(ob, bp)+_final_mass(ob, obp))/2.0f);
-
- madd_v3_v3fl(obp->force, dvel, sb->balldamp);
- madd_v3_v3fl(obp->force, def, -f * (1.0f - sb->balldamp));
- }
- }
- }
- }
- /* naive ball self collision done */
-
- if (_final_goal(ob, bp) < SOFTGOALSNAP) { /* omit this bp when it snaps */
- float auxvect[3];
- float velgoal[3];
-
- /* do goal stuff */
- if (ob->softflag & OB_SB_GOAL) {
- /* true elastic goal */
- sub_v3_v3v3(auxvect, bp->pos, bp->origT);
- ks = 1.0f / (1.0f- _final_goal(ob, bp) * sb->goalspring) - 1.0f;
- bp->force[0]+= -ks*(auxvect[0]);
- bp->force[1]+= -ks*(auxvect[1]);
- bp->force[2]+= -ks*(auxvect[2]);
-
- /* calculate damping forces generated by goals*/
- sub_v3_v3v3(velgoal, bp->origS, bp->origE);
- kd = sb->goalfrict * sb_fric_force_scale(ob);
- add_v3_v3v3(auxvect, velgoal, bp->vec);
-
- if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */
- bp->force[0]-= kd * (auxvect[0]);
- bp->force[1]-= kd * (auxvect[1]);
- bp->force[2]-= kd * (auxvect[2]);
-
- }
- else {
- bp->force[0]-= kd * (velgoal[0] - bp->vec[0]);
- bp->force[1]-= kd * (velgoal[1] - bp->vec[1]);
- bp->force[2]-= kd * (velgoal[2] - bp->vec[2]);
- }
- }
- /* done goal stuff */
-
-
- /* gravitation */
- madd_v3_v3fl(bp->force, gravity, _final_mass(ob, bp)); /* individual mass of node here */
-
-
- /* particle field & vortex */
- if (effectors) {
- EffectedPoint epoint;
- float force[3] = {0.0f, 0.0f, 0.0f};
- float speed[3] = {0.0f, 0.0f, 0.0f};
- float eval_sb_fric_force_scale = sb_fric_force_scale(ob); /* just for calling function once */
- pd_point_from_soft(scene, bp->pos, bp->vec, sb->bpoint-bp, &epoint);
- BKE_effectors_apply(effectors, NULL, sb->effector_weights, &epoint, force, speed);
-
- /* apply forcefield*/
- mul_v3_fl(force, fieldfactor* eval_sb_fric_force_scale);
- add_v3_v3(bp->force, force);
-
- /* BP friction in moving media */
- kd= sb->mediafrict* eval_sb_fric_force_scale;
- bp->force[0] -= kd * (bp->vec[0] + windfactor*speed[0]/eval_sb_fric_force_scale);
- bp->force[1] -= kd * (bp->vec[1] + windfactor*speed[1]/eval_sb_fric_force_scale);
- bp->force[2] -= kd * (bp->vec[2] + windfactor*speed[2]/eval_sb_fric_force_scale);
- /* now we'll have nice centrifugal effect for vortex */
-
- }
- else {
- /* BP friction in media (not) moving*/
- kd= sb->mediafrict* sb_fric_force_scale(ob);
- /* assume it to be proportional to actual velocity */
- bp->force[0]-= bp->vec[0]*kd;
- bp->force[1]-= bp->vec[1]*kd;
- bp->force[2]-= bp->vec[2]*kd;
- /* friction in media done */
- }
- /* +++cached collision targets */
- bp->choke = 0.0f;
- bp->choke2 = 0.0f;
- bp->loc_flag &= ~SBF_DOFUZZY;
- if (do_deflector) {
- float cfforce[3], defforce[3] ={0.0f, 0.0f, 0.0f}, vel[3] = {0.0f, 0.0f, 0.0f}, facenormal[3], cf = 1.0f, intrusion;
- kd = 1.0f;
-
- if (sb_deflect_face(ob, bp->pos, facenormal, defforce, &cf, timenow, vel, &intrusion)) {
- if (intrusion < 0.0f) {
- if (G.debug_value & 0x01) { // 17 we did check for bit 0x10 before
- /* fixing bug [17428] this forces adaptive step size to tiny steps
- * in some situations .. keeping G.debug_value==17 option for old files 'needing' the bug
- */
- /* bjornmose: uugh.. what an evil hack
- * violation of the 'don't touch bp->pos in here' rule
- * but works nice, like this-->
- * we predict the solution being out of the collider
- * in heun step No1 and leave the heun step No2 adapt to it
- * so we kind of introduced a implicit solver for this case
- */
- madd_v3_v3fl(bp->pos, facenormal, -intrusion);
- }
- else {
-
- sub_v3_v3v3(cfforce, bp->vec, vel);
- madd_v3_v3fl(bp->force, cfforce, -cf * 50.0f);
- }
-
-
- sb->scratch->flag |= SBF_DOFUZZY;
- bp->loc_flag |= SBF_DOFUZZY;
- bp->choke = sb->choke*0.01f;
- }
- else {
- sub_v3_v3v3(cfforce, bp->vec, vel);
- madd_v3_v3fl(bp->force, cfforce, -cf * 50.0f);
- }
- madd_v3_v3fl(bp->force, defforce, kd);
-
- }
-
- }
- /* ---cached collision targets */
-
- /* +++springs */
- if (ob->softflag & OB_SB_EDGES) {
- if (sb->bspring) { /* spring list exists at all ? */
- for (int b = bp->nofsprings; b > 0; b--) {
- bs = sb->bspring + bp->springs[b-1];
- if (do_springcollision || do_aero) {
- add_v3_v3(bp->force, bs->ext_force);
- if (bs->flag & BSF_INTERSECT)
- bp->choke = bs->cf;
-
- }
- // sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, float forcetime)
- // rather remove nl_falgs from code .. will make things a lot cleaner
- sb_spring_force(ob, sb->totpoint-a, bs, iks, forcetime);
- }/* loop springs */
- }/* existing spring list */
- }/*any edges*/
- /* ---springs */
- }/*omit on snap */
- }/*loop all bp's*/
-
-
- /* finally add forces caused by face collision */
- if (ob->softflag & OB_SB_FACECOLL) scan_for_ext_face_forces(ob, timenow);
- BKE_effectors_free(effectors);
- }
-}
-
static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *err, int mid_flags)
{
/* time evolution */
@@ -2584,7 +2321,9 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
}
}
- else { add_v3_v3(bp->pos, dx);}
+ else {
+ add_v3_v3(bp->pos, dx);
+ }
}/*snap*/
/* so while we are looping BPs anyway do statistics on the fly */
minmax_v3v3_v3(aabbmin, aabbmax, bp->pos);
@@ -2885,7 +2624,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
build_bps_springlist(ob); /* yes we need to do it again*/
}
springs_from_mesh(ob); /* write the 'rest'-length of the springs */
- if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);}
+ if (ob->softflag & OB_SB_SELF) { calculate_collision_balls(ob); }
}
@@ -3194,7 +2933,7 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
if (totspring) {
build_bps_springlist(ob); /* link bps to springs */
- if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);}
+ if (ob->softflag & OB_SB_SELF) { calculate_collision_balls(ob); }
}
}
@@ -3596,7 +3335,7 @@ static void softbody_step(struct Depsgraph *depsgraph, Scene *scene, Object *ob,
}/*SOLVER SELECT*/
else {
- printf("softbody no valid solver ID!");
+ CLOG_ERROR(&LOG, "softbody no valid solver ID!");
}/*SOLVER SELECT*/
if (sb->plastic) { apply_spring_memory(ob);}
@@ -3606,6 +3345,16 @@ static void softbody_step(struct Depsgraph *depsgraph, Scene *scene, Object *ob,
}
}
+static void sbStoreLastFrame(struct Depsgraph *depsgraph, Object *object, float framenr)
+{
+ if (!DEG_is_active(depsgraph)) {
+ return;
+ }
+ Object *object_orig = DEG_get_original_object(object);
+ object->soft->last_frame = framenr;
+ object_orig->soft->last_frame = framenr;
+}
+
/* simulates one step. framenr is in frames */
void sbObjectStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], int numVerts)
{
@@ -3677,7 +3426,7 @@ void sbObjectStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float c
BKE_ptcache_validate(cache, framenr);
cache->flag &= ~PTCACHE_REDO_NEEDED;
- sb->last_frame = framenr;
+ sbStoreLastFrame(depsgraph, ob, framenr);
return;
}
@@ -3698,7 +3447,7 @@ void sbObjectStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float c
if (cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED && can_write_cache)
BKE_ptcache_write(&pid, framenr);
- sb->last_frame = framenr;
+ sbStoreLastFrame(depsgraph, ob, framenr);
return;
}
@@ -3733,5 +3482,5 @@ void sbObjectStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float c
BKE_ptcache_validate(cache, framenr);
BKE_ptcache_write(&pid, framenr);
- sb->last_frame = framenr;
+ sbStoreLastFrame(depsgraph, ob, framenr);
}
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 829f0e0ab89..c909f00702d 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/sound.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <string.h>
@@ -99,7 +91,7 @@ bSound *BKE_sound_new_file_exists_ex(struct Main *bmain, const char *filepath, b
BLI_path_abs(str, BKE_main_blendfile_path(bmain));
/* first search an identical filepath */
- for (sound = bmain->sound.first; sound; sound = sound->id.next) {
+ for (sound = bmain->sounds.first; sound; sound = sound->id.next) {
BLI_strncpy(strtest, sound->name, sizeof(sound->name));
BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &sound->id));
@@ -155,7 +147,7 @@ void BKE_sound_free(bSound *sound)
/**
* Only copy internal data of Sound ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -200,7 +192,7 @@ static void sound_sync_callback(void *data, int mode, float time)
struct Main *bmain = (struct Main *)data;
struct Scene *scene;
- scene = bmain->scene.first;
+ scene = bmain->scenes.first;
while (scene) {
if (scene->audio.flag & AUDIO_SYNC) {
if (mode)
@@ -515,7 +507,7 @@ void BKE_sound_update_scene_listener(struct Scene *scene)
void *BKE_sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequence,
int startframe, int endframe, int frameskip)
{
- if (scene != sequence->scene) {
+ if (sequence->scene && scene != sequence->scene) {
const double fps = FPS;
return AUD_Sequence_add(scene->sound_scene, sequence->scene->sound_scene,
startframe / fps, endframe / fps, frameskip / fps);
@@ -614,7 +606,7 @@ void BKE_sound_update_sequencer(struct Main *main, bSound *sound)
{
struct Scene *scene;
- for (scene = main->scene.first; scene; scene = scene->id.next) {
+ for (scene = main->scenes.first; scene; scene = scene->id.next) {
BKE_sequencer_update_sound(scene, sound);
}
}
@@ -694,7 +686,7 @@ void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
}
animation_playing = 0;
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
if (screen->animtimer) {
animation_playing = 1;
break;
@@ -891,8 +883,8 @@ void BKE_sound_update_scene(Main *bmain, Scene *scene)
float quat[4];
/* cheap test to skip looping over all objects (no speakers is a common case) */
- if (!BLI_listbase_is_empty(&bmain->speaker)) {
- BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true);
+ if (!BLI_listbase_is_empty(&bmain->speakers)) {
+ BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
for (base = view_layer->object_bases.first; base; base = base->next) {
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index 7c92844ac2e..25684dbbe22 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Jörg Müller.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/speaker.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "DNA_object_types.h"
@@ -33,8 +27,6 @@
#include "BKE_animsys.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_speaker.h"
@@ -69,7 +61,7 @@ void *BKE_speaker_add(Main *bmain, const char *name)
/**
* Only copy internal data of Speaker ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -83,7 +75,7 @@ void BKE_speaker_copy_data(Main *UNUSED(bmain), Speaker *UNUSED(spk_dst), const
Speaker *BKE_speaker_copy(Main *bmain, const Speaker *spk)
{
Speaker *spk_copy;
- BKE_id_copy_ex(bmain, &spk->id, (ID **)&spk_copy, 0, false);
+ BKE_id_copy(bmain, &spk->id, (ID **)&spk_copy);
return spk_copy;
}
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index ca02fcef746..16bfee755f4 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2006-2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenkernel/intern/studiolight.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_studiolight.h"
@@ -43,7 +34,6 @@
#include "BLI_math.h"
#include "BLI_math_color.h"
#include "BLI_path_util.h"
-#include "BLI_rand.h"
#include "BLI_string.h"
#include "BLI_string_utils.h"
@@ -332,7 +322,7 @@ static void cube_face_uv_to_direction(float r_dir[3], float x, float y, int face
{{ 1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, -1.0f}, { 0.0f, 1.0f, 0.0f}},
{{ 1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}, { 0.0f, -1.0f, 0.0f}},
{{ 1.0f, 0.0f, 0.0f}, {0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, -1.0f}},
- {{-1.0f, 0.0f, 0.0f}, {0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 1.0f}}
+ {{-1.0f, 0.0f, 0.0f}, {0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 1.0f}},
};
copy_v3_fl3(r_dir, x * 2.0f - 1.0f, y * 2.0f - 1.0f, 1.0f);
@@ -732,7 +722,7 @@ static void studiolight_spherical_harmonics_apply_band_factors(StudioLight *sl,
2.0f / 3.0f,
1.0f / 4.0f,
0.0f,
- -1.0f / 24.0f
+ -1.0f / 24.0f,
};
int index = 0, dst_idx = 0;
@@ -861,7 +851,7 @@ static float blinn_specular(
gloss *= 1.0f - wrap;
float shininess = exp2(10.0f * gloss + 1.0f);
- /* Pi is already divided in the lamp power.
+ /* Pi is already divided in the light power.
* normalization_factor = (shininess + 8.0) / (8.0 * M_PI) */
float normalization_factor = shininess * 0.125f + 1.0f;
float spec_light = powf(spec_angle, shininess) * max_ff(NL, 0.0f) * normalization_factor;
diff --git a/source/blender/blenkernel/intern/subdiv.c b/source/blender/blenkernel/intern/subdiv.c
index b2736ed8f37..48a7cb8f8d2 100644
--- a/source/blender/blenkernel/intern/subdiv.c
+++ b/source/blender/blenkernel/intern/subdiv.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,16 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_subdiv.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "BLI_utildefines.h"
@@ -43,6 +38,8 @@
#include "opensubdiv_evaluator_capi.h"
#include "opensubdiv_topology_refiner_capi.h"
+/* ========================== CONVERSION HELPERS ============================ */
+
eSubdivFVarLinearInterpolation
BKE_subdiv_fvar_interpolation_from_uv_smooth(int uv_smooth)
{
@@ -64,6 +61,47 @@ BKE_subdiv_fvar_interpolation_from_uv_smooth(int uv_smooth)
return SUBDIV_FVAR_LINEAR_INTERPOLATION_ALL;
}
+/* ================================ SETTINGS ================================ */
+
+static bool check_mesh_has_non_quad(const Mesh *mesh)
+{
+ for (int poly_index = 0; poly_index < mesh->totpoly; poly_index++) {
+ const MPoly *poly = &mesh->mpoly[poly_index];
+ if (poly->totloop != 4) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void BKE_subdiv_settings_validate_for_mesh(SubdivSettings *settings,
+ const Mesh *mesh)
+{
+ if (settings->level != 1) {
+ return;
+ }
+ if (check_mesh_has_non_quad(mesh)) {
+ settings->level = 2;
+ }
+}
+
+bool BKE_subdiv_settings_equal(const SubdivSettings *settings_a,
+ const SubdivSettings *settings_b)
+{
+ return
+ (settings_a->is_simple == settings_b->is_simple &&
+ settings_a->is_adaptive == settings_b->is_adaptive &&
+ settings_a->level == settings_b->level &&
+ settings_a->vtx_boundary_interpolation ==
+ settings_b->vtx_boundary_interpolation &&
+ settings_a->fvar_linear_interpolation ==
+ settings_b->fvar_linear_interpolation);
+}
+
+/* ============================== CONSTRUCTION ============================== */
+
+/* Creation from scratch. */
+
Subdiv *BKE_subdiv_new_from_converter(const SubdivSettings *settings,
struct OpenSubdiv_Converter *converter)
{
@@ -78,13 +116,11 @@ Subdiv *BKE_subdiv_new_from_converter(const SubdivSettings *settings,
osd_topology_refiner =
openSubdiv_createTopologyRefinerFromConverter(
converter, &topology_refiner_settings);
-
}
else {
/* TODO(sergey): Check whether original geometry had any vertices.
* The thing here is: OpenSubdiv can only deal with faces, but our
- * side of subdiv also deals with loose vertices and edges.
- */
+ * side of subdiv also deals with loose vertices and edges. */
}
Subdiv *subdiv = MEM_callocN(sizeof(Subdiv), "subdiv from converetr");
subdiv->settings = *settings;
@@ -97,7 +133,7 @@ Subdiv *BKE_subdiv_new_from_converter(const SubdivSettings *settings,
}
Subdiv *BKE_subdiv_new_from_mesh(const SubdivSettings *settings,
- struct Mesh *mesh)
+ const Mesh *mesh)
{
if (mesh->totvert == 0) {
return NULL;
@@ -109,6 +145,53 @@ Subdiv *BKE_subdiv_new_from_mesh(const SubdivSettings *settings,
return subdiv;
}
+/* Creation with cached-aware semantic. */
+
+Subdiv *BKE_subdiv_update_from_converter(Subdiv *subdiv,
+ const SubdivSettings *settings,
+ OpenSubdiv_Converter *converter)
+{
+ /* Check if the existing descriptor can be re-used. */
+ bool can_reuse_subdiv = true;
+ if (subdiv != NULL && subdiv->topology_refiner != NULL) {
+ if (!BKE_subdiv_settings_equal(&subdiv->settings, settings)) {
+ can_reuse_subdiv = false;
+ }
+ else {
+ BKE_subdiv_stats_begin(
+ &subdiv->stats, SUBDIV_STATS_TOPOLOGY_COMPARE);
+ can_reuse_subdiv = openSubdiv_topologyRefinerCompareWithConverter(
+ subdiv->topology_refiner, converter);
+ BKE_subdiv_stats_end(
+ &subdiv->stats, SUBDIV_STATS_TOPOLOGY_COMPARE);
+ }
+ }
+ else {
+ can_reuse_subdiv = false;
+ }
+ if (can_reuse_subdiv) {
+ return subdiv;
+ }
+ /* Create new subdiv. */
+ if (subdiv != NULL) {
+ BKE_subdiv_free(subdiv);
+ }
+ return BKE_subdiv_new_from_converter(settings, converter);
+}
+
+Subdiv *BKE_subdiv_update_from_mesh(Subdiv *subdiv,
+ const SubdivSettings *settings,
+ const Mesh *mesh)
+{
+ OpenSubdiv_Converter converter;
+ BKE_subdiv_converter_init_for_mesh(&converter, settings, mesh);
+ subdiv = BKE_subdiv_update_from_converter(subdiv, settings, &converter);
+ BKE_subdiv_converter_free(&converter);
+ return subdiv;
+}
+
+/* Memory release. */
+
void BKE_subdiv_free(Subdiv *subdiv)
{
if (subdiv->evaluator != NULL) {
@@ -124,6 +207,8 @@ void BKE_subdiv_free(Subdiv *subdiv)
MEM_freeN(subdiv);
}
+/* =========================== PTEX FACES AND GRIDS ========================= */
+
int *BKE_subdiv_face_ptex_offset_get(Subdiv *subdiv)
{
if (subdiv->cache_.face_ptex_offset != NULL) {
diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c
index 5d8111197c0..6840e07c129 100644
--- a/source/blender/blenkernel/intern/subdiv_ccg.c
+++ b/source/blender/blenkernel/intern/subdiv_ccg.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_ccg.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_subdiv_ccg.h"
@@ -47,6 +41,19 @@
#include "opensubdiv_topology_refiner_capi.h"
/* =============================================================================
+ * Various forward declarations.
+ */
+
+static void subdiv_ccg_average_all_boundaries_and_corners(
+ SubdivCCG *subdiv_ccg,
+ CCGKey *key);
+
+static void subdiv_ccg_average_inner_face_grids(
+ SubdivCCG *subdiv_ccg,
+ CCGKey *key,
+ SubdivCCGFace *face);
+
+/* =============================================================================
* Generally useful internal helpers.
*/
@@ -92,8 +99,7 @@ static void subdiv_ccg_init_layers(SubdivCCG *subdiv_ccg,
/* Normals.
*
* NOTE: Keep them at the end, matching old CCGDM. Doesn't really matter
- * here, but some other area might in theory depend memory layout.
- */
+ * here, but some other area might in theory depend memory layout. */
if (settings->need_normal) {
subdiv_ccg->has_normal = true;
subdiv_ccg->normal_offset = layer_offset;
@@ -119,8 +125,7 @@ static int topology_refiner_count_face_corners(
}
/* NOTE: Grid size and layer flags are to be filled in before calling this
- * function.
- */
+ * function. */
static void subdiv_ccg_alloc_elements(SubdivCCG *subdiv_ccg, Subdiv *subdiv)
{
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
@@ -171,7 +176,8 @@ typedef struct CCGEvalGridsData {
SubdivCCG *subdiv_ccg;
Subdiv *subdiv;
int *face_ptex_offset;
- SubdivCCGMask *mask_evaluator;
+ SubdivCCGMaskEvaluator *mask_evaluator;
+ SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator;
} CCGEvalGridsData;
static void subdiv_ccg_eval_grid_element(
@@ -208,30 +214,6 @@ static void subdiv_ccg_eval_grid_element(
}
}
-BLI_INLINE void rotate_corner_to_quad(
- const int corner,
- const float u, const float v,
- float *r_u, float *r_v)
-{
- if (corner == 0) {
- *r_u = 0.5f - v * 0.5f;
- *r_v = 0.5f - u * 0.5f;
- }
- else if (corner == 1) {
- *r_u = 0.5f + u * 0.5f;
- *r_v = 0.5f - v * 0.5f;
- }
- else if (corner == 2) {
- *r_u = 0.5f + v * 0.5f;
- *r_v = 0.5f + u * 0.5f;
- }
- else {
- BLI_assert(corner == 3);
- *r_u = 0.5f - u * 0.5f;
- *r_v = 0.5f + v * 0.5f;
- }
-}
-
static void subdiv_ccg_eval_regular_grid(CCGEvalGridsData *data,
const int face_index)
{
@@ -251,7 +233,8 @@ static void subdiv_ccg_eval_regular_grid(CCGEvalGridsData *data,
for (int x = 0; x < grid_size; x++) {
const float grid_u = (float)x * grid_size_1_inv;
float u, v;
- rotate_corner_to_quad(corner, grid_u, grid_v, &u, &v);
+ BKE_subdiv_rotate_grid_to_quad(
+ corner, grid_u, grid_v, &u, &v);
const size_t grid_element_index = (size_t)y * grid_size + x;
const size_t grid_element_offset =
grid_element_index * element_size;
@@ -263,6 +246,10 @@ static void subdiv_ccg_eval_regular_grid(CCGEvalGridsData *data,
}
/* Assign grid's face. */
grid_faces[grid_index] = &faces[face_index];
+ /* Assign material flags. */
+ subdiv_ccg->grid_flag_mats[grid_index] =
+ data->material_flags_evaluator->eval_material_flags(
+ data->material_flags_evaluator, face_index);
}
}
@@ -278,13 +265,13 @@ static void subdiv_ccg_eval_special_grid(CCGEvalGridsData *data,
const SubdivCCGFace *face = &faces[face_index];
for (int corner = 0; corner < face->num_grids; corner++) {
const int grid_index = face->start_grid_index + corner;
+ const int ptex_face_index =
+ data->face_ptex_offset[face_index] + corner;
unsigned char *grid = (unsigned char *)subdiv_ccg->grids[grid_index];
for (int y = 0; y < grid_size; y++) {
const float u = 1.0f - ((float)y * grid_size_1_inv);
for (int x = 0; x < grid_size; x++) {
const float v = 1.0f - ((float)x * grid_size_1_inv);
- const int ptex_face_index =
- data->face_ptex_offset[face_index] + corner;
const size_t grid_element_index = (size_t)y * grid_size + x;
const size_t grid_element_offset =
grid_element_index * element_size;
@@ -296,6 +283,10 @@ static void subdiv_ccg_eval_special_grid(CCGEvalGridsData *data,
}
/* Assign grid's face. */
grid_faces[grid_index] = &faces[face_index];
+ /* Assign material flags. */
+ subdiv_ccg->grid_flag_mats[grid_index] =
+ data->material_flags_evaluator->eval_material_flags(
+ data->material_flags_evaluator, face_index);
}
}
@@ -318,7 +309,8 @@ static void subdiv_ccg_eval_grids_task(
static bool subdiv_ccg_evaluate_grids(
SubdivCCG *subdiv_ccg,
Subdiv *subdiv,
- SubdivCCGMask *mask_evaluator)
+ SubdivCCGMaskEvaluator *mask_evaluator,
+ SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator)
{
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
const int num_faces = topology_refiner->getNumFaces(topology_refiner);
@@ -328,6 +320,7 @@ static bool subdiv_ccg_evaluate_grids(
data.subdiv = subdiv;
data.face_ptex_offset = BKE_subdiv_face_ptex_offset_get(subdiv);
data.mask_evaluator = mask_evaluator;
+ data.material_flags_evaluator = material_flags_evaluator;
/* Threaded grids evaluation. */
ParallelRangeSettings parallel_range_settings;
BLI_parallel_range_settings_defaults(&parallel_range_settings);
@@ -336,8 +329,7 @@ static bool subdiv_ccg_evaluate_grids(
subdiv_ccg_eval_grids_task,
&parallel_range_settings);
/* If displacement is used, need to calculate normals after all final
- * coordinates are known.
- */
+ * coordinates are known. */
if (subdiv->displacement_evaluator != NULL) {
BKE_subdiv_ccg_recalc_normals(subdiv_ccg);
}
@@ -345,8 +337,7 @@ static bool subdiv_ccg_evaluate_grids(
}
/* Initialize face descriptors, assuming memory for them was already
- * allocated.
- */
+ * allocated. */
static void subdiv_ccg_init_faces(SubdivCCG *subdiv_ccg)
{
Subdiv *subdiv = subdiv_ccg->subdiv;
@@ -466,8 +457,7 @@ static void subdiv_ccg_init_faces_edge_neighborhood(SubdivCCG *subdiv_ccg)
topology_refiner->getFaceVertices(
topology_refiner, face_index, face_vertices);
/* Note that order of edges is same as order of MLoops, which also
- * means it's the same as order of grids.
- */
+ * means it's the same as order of grids. */
int *face_edges = static_or_heap_storage_get(
&face_edges_storage, num_face_edges);
topology_refiner->getFaceEdges(
@@ -544,8 +534,7 @@ static void subdiv_ccg_allocate_adjacent_vertices(SubdivCCG *subdiv_ccg,
}
/* Returns storage where corner elements are to be stored. This is a pointer
- * to the actual storage.
- */
+ * to the actual storage. */
static CCGElem **subdiv_ccg_adjacent_vertex_add_face(
SubdivCCGAdjacentVertex *adjacent_vertex,
SubdivCCGFace *face)
@@ -626,7 +615,8 @@ static void subdiv_ccg_init_faces_neighborhood(SubdivCCG *subdiv_ccg)
SubdivCCG *BKE_subdiv_to_ccg(
Subdiv *subdiv,
const SubdivToCCGSettings *settings,
- SubdivCCGMask *mask_evaluator)
+ SubdivCCGMaskEvaluator *mask_evaluator,
+ SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator)
{
BKE_subdiv_stats_begin(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_CCG);
SubdivCCG *subdiv_ccg = MEM_callocN(sizeof(SubdivCCG), "subdiv ccg");
@@ -637,7 +627,9 @@ SubdivCCG *BKE_subdiv_to_ccg(
subdiv_ccg_alloc_elements(subdiv_ccg, subdiv);
subdiv_ccg_init_faces(subdiv_ccg);
subdiv_ccg_init_faces_neighborhood(subdiv_ccg);
- if (!subdiv_ccg_evaluate_grids(subdiv_ccg, subdiv, mask_evaluator)) {
+ if (!subdiv_ccg_evaluate_grids(
+ subdiv_ccg, subdiv, mask_evaluator, material_flags_evaluator))
+ {
BKE_subdiv_ccg_destroy(subdiv_ccg);
BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_CCG);
return NULL;
@@ -659,14 +651,21 @@ Mesh *BKE_subdiv_to_ccg_mesh(
}
}
BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_CCG);
- SubdivCCGMask mask_evaluator;
+ SubdivCCGMaskEvaluator mask_evaluator;
bool has_mask = BKE_subdiv_ccg_mask_init_from_paint(
- &mask_evaluator, coarse_mesh);
+ &mask_evaluator, coarse_mesh);
+ SubdivCCGMaterialFlagsEvaluator material_flags_evaluator;
+ BKE_subdiv_ccg_material_flags_init_from_mesh(
+ &material_flags_evaluator, coarse_mesh);
SubdivCCG *subdiv_ccg = BKE_subdiv_to_ccg(
- subdiv, settings, has_mask ? &mask_evaluator : NULL);
+ subdiv,
+ settings,
+ has_mask ? &mask_evaluator : NULL,
+ &material_flags_evaluator);
if (has_mask) {
mask_evaluator.free(&mask_evaluator);
}
+ material_flags_evaluator.free(&material_flags_evaluator);
if (subdiv_ccg == NULL) {
return NULL;
}
@@ -756,15 +755,13 @@ typedef struct RecalcInnerNormalsTLSData {
*
* {(x, y), {x + 1, y}, {x + 1, y + 1}, {x, y + 1}}
*
- * The result is stored in normals storage from TLS.
- */
+ * The result is stored in normals storage from TLS. */
static void subdiv_ccg_recalc_inner_face_normals(
- RecalcInnerNormalsData *data,
+ SubdivCCG *subdiv_ccg,
+ CCGKey *key,
RecalcInnerNormalsTLSData *tls,
const int grid_index)
{
- SubdivCCG *subdiv_ccg = data->subdiv_ccg;
- CCGKey *key = data->key;
const int grid_size = subdiv_ccg->grid_size;
const int grid_size_1 = grid_size - 1;
CCGElem *grid = subdiv_ccg->grids[grid_index];
@@ -780,13 +777,13 @@ static void subdiv_ccg_recalc_inner_face_normals(
CCG_grid_elem(key, grid, x, y + 1),
CCG_grid_elem(key, grid, x + 1, y + 1),
CCG_grid_elem(key, grid, x + 1, y),
- CCG_grid_elem(key, grid, x, y)
+ CCG_grid_elem(key, grid, x, y),
};
float *co[4] = {
CCG_elem_co(key, grid_elements[0]),
CCG_elem_co(key, grid_elements[1]),
CCG_elem_co(key, grid_elements[2]),
- CCG_elem_co(key, grid_elements[3])
+ CCG_elem_co(key, grid_elements[3]),
};
const int face_index = y * grid_size_1 + x;
float *face_normal = tls->face_normals[face_index];
@@ -797,12 +794,11 @@ static void subdiv_ccg_recalc_inner_face_normals(
/* Average normals at every grid element, using adjacent faces normals. */
static void subdiv_ccg_average_inner_face_normals(
- RecalcInnerNormalsData *data,
+ SubdivCCG *subdiv_ccg,
+ CCGKey *key,
RecalcInnerNormalsTLSData *tls,
const int grid_index)
{
- SubdivCCG *subdiv_ccg = data->subdiv_ccg;
- CCGKey *key = data->key;
const int grid_size = subdiv_ccg->grid_size;
const int grid_size_1 = grid_size - 1;
CCGElem *grid = subdiv_ccg->grids[grid_index];
@@ -847,8 +843,10 @@ static void subdiv_ccg_recalc_inner_normal_task(
{
RecalcInnerNormalsData *data = userdata_v;
RecalcInnerNormalsTLSData *tls = tls_v->userdata_chunk;
- subdiv_ccg_recalc_inner_face_normals(data, tls, grid_index);
- subdiv_ccg_average_inner_face_normals(data, tls, grid_index);
+ subdiv_ccg_recalc_inner_face_normals(
+ data->subdiv_ccg, data->key, tls, grid_index);
+ subdiv_ccg_average_inner_face_normals(
+ data->subdiv_ccg, data->key, tls, grid_index);
}
static void subdiv_ccg_recalc_inner_normal_finalize(
@@ -865,8 +863,8 @@ static void subdiv_ccg_recalc_inner_grid_normals(SubdivCCG *subdiv_ccg)
CCGKey key;
BKE_subdiv_ccg_key_top_level(&key, subdiv_ccg);
RecalcInnerNormalsData data = {
- .subdiv_ccg = subdiv_ccg,
- .key = &key
+ .subdiv_ccg = subdiv_ccg,
+ .key = &key,
};
RecalcInnerNormalsTLSData tls_data = {NULL};
ParallelRangeSettings parallel_range_settings;
@@ -891,6 +889,88 @@ void BKE_subdiv_ccg_recalc_normals(SubdivCCG *subdiv_ccg)
BKE_subdiv_ccg_average_grids(subdiv_ccg);
}
+typedef struct RecalcModifiedInnerNormalsData {
+ SubdivCCG *subdiv_ccg;
+ CCGKey *key;
+ SubdivCCGFace **effected_ccg_faces;
+} RecalcModifiedInnerNormalsData;
+
+static void subdiv_ccg_recalc_modified_inner_normal_task(
+ void *__restrict userdata_v,
+ const int face_index,
+ const ParallelRangeTLS *__restrict tls_v)
+{
+ RecalcModifiedInnerNormalsData *data = userdata_v;
+ SubdivCCG *subdiv_ccg = data->subdiv_ccg;
+ CCGKey *key = data->key;
+ RecalcInnerNormalsTLSData *tls = tls_v->userdata_chunk;
+ SubdivCCGFace **faces = data->effected_ccg_faces;
+ SubdivCCGFace *face = faces[face_index];
+ const int num_face_grids = face->num_grids;
+ for (int i = 0; i < num_face_grids; i++) {
+ const int grid_index = face->start_grid_index + i;
+ subdiv_ccg_recalc_inner_face_normals(
+ data->subdiv_ccg, data->key, tls, grid_index);
+ subdiv_ccg_average_inner_face_normals(
+ data->subdiv_ccg, data->key, tls, grid_index);
+ }
+ subdiv_ccg_average_inner_face_grids(subdiv_ccg, key, face);
+}
+
+static void subdiv_ccg_recalc_modified_inner_normal_finalize(
+ void *__restrict UNUSED(userdata),
+ void *__restrict tls_v)
+{
+ RecalcInnerNormalsTLSData *tls = tls_v;
+ MEM_SAFE_FREE(tls->face_normals);
+}
+
+static void subdiv_ccg_recalc_modified_inner_grid_normals(
+ SubdivCCG *subdiv_ccg,
+ struct CCGFace **effected_faces,
+ int num_effected_faces)
+{
+ CCGKey key;
+ BKE_subdiv_ccg_key_top_level(&key, subdiv_ccg);
+ RecalcModifiedInnerNormalsData data = {
+ .subdiv_ccg = subdiv_ccg,
+ .key = &key,
+ .effected_ccg_faces = (SubdivCCGFace **)effected_faces,
+ };
+ RecalcInnerNormalsTLSData tls_data = {NULL};
+ ParallelRangeSettings parallel_range_settings;
+ BLI_parallel_range_settings_defaults(&parallel_range_settings);
+ parallel_range_settings.userdata_chunk = &tls_data;
+ parallel_range_settings.userdata_chunk_size = sizeof(tls_data);
+ parallel_range_settings.func_finalize =
+ subdiv_ccg_recalc_modified_inner_normal_finalize;
+ BLI_task_parallel_range(0, num_effected_faces,
+ &data,
+ subdiv_ccg_recalc_modified_inner_normal_task,
+ &parallel_range_settings);
+}
+
+void BKE_subdiv_ccg_update_normals(SubdivCCG *subdiv_ccg,
+ struct CCGFace **effected_faces,
+ int num_effected_faces)
+{
+ if (!subdiv_ccg->has_normal) {
+ /* Grids don't have normals, can do early output. */
+ return;
+ }
+ if (num_effected_faces == 0) {
+ /* No faces changed, so nothing to do here. */
+ return;
+ }
+ subdiv_ccg_recalc_modified_inner_grid_normals(
+ subdiv_ccg, effected_faces, num_effected_faces);
+ /* TODO(sergey): Only average elements which are adjacent to modified
+ * faces. */
+ CCGKey key;
+ BKE_subdiv_ccg_key_top_level(&key, subdiv_ccg);
+ subdiv_ccg_average_all_boundaries_and_corners(subdiv_ccg, &key);
+}
+
/* =============================================================================
* Boundary averaging/stitching.
*/
@@ -995,16 +1075,14 @@ static void subdiv_ccg_average_grids_boundary(
/* Incrementall average result to elements of a first adjacent face.
*
* Arguably, this is less precise than accumulating and then diving once,
- * but on another hand this is more stable when coordinates are big.
- */
+ * but on another hand this is more stable when coordinates are big. */
for (int face_index = 1; face_index < num_adjacent_faces; face_index++) {
/* NOTE: We ignore very first and very last elements, they correspond
* to corner vertices, and they can belong to multiple edges.
* The fact, that they can belong to multiple edges means we can't
* safely average them.
* The fact, that they correspond to a corner elements, means they will
- * be handled at the upcoming pass over corner elements.
- */
+ * be handled at the upcoming pass over corner elements. */
for (int i = 1; i < grid_size2 - 1; i++) {
CCGElem *grid_element_0 =
adjacent_edge->boundary_elements[0][i];
@@ -1060,8 +1138,7 @@ static void subdiv_ccg_average_grids_corners(
return;
}
/* Incrementall average result to elements of a first adjacent face.
- * See comment to the boundary averaging.
- */
+ * See comment to the boundary averaging. */
for (int face_index = 1; face_index < num_adjacent_faces; face_index++) {
CCGElem *grid_element_0 =
adjacent_vertex->corner_elements[0];
@@ -1131,8 +1208,7 @@ void BKE_subdiv_ccg_average_grids(SubdivCCG *subdiv_ccg)
ParallelRangeSettings parallel_range_settings;
BLI_parallel_range_settings_defaults(&parallel_range_settings);
/* Average inner boundaries of grids (within one face), across faces
- * from different face-corners.
- */
+ * from different face-corners. */
AverageInnerGridsData inner_data = {
.subdiv_ccg = subdiv_ccg,
.key = &key,
@@ -1182,8 +1258,7 @@ void BKE_subdiv_ccg_average_stitch_faces(SubdivCCG *subdiv_ccg,
subdiv_ccg_stitch_face_inner_grids_task,
&parallel_range_settings);
/* TODO(sergey): Only average elements which are adjacent to modified
- * faces.
- */
+ * faces. */
subdiv_ccg_average_all_boundaries_and_corners(subdiv_ccg, &key);
}
diff --git a/source/blender/blenkernel/intern/subdiv_ccg_mask.c b/source/blender/blenkernel/intern/subdiv_ccg_mask.c
index 0da30fb1bf0..ec9dfd30f16 100644
--- a/source/blender/blenkernel/intern/subdiv_ccg_mask.c
+++ b/source/blender/blenkernel/intern/subdiv_ccg_mask.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_ccg_mask.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_subdiv_ccg.h"
@@ -35,7 +29,6 @@
#include "DNA_object_types.h"
#include "BLI_utildefines.h"
-#include "BLI_math_vector.h"
#include "BKE_customdata.h"
#include "BKE_subdiv.h"
@@ -61,7 +54,7 @@ typedef struct GridPaintMaskData {
} GridPaintMaskData;
static int mask_get_grid_and_coord(
- SubdivCCGMask *mask_evaluator,
+ SubdivCCGMaskEvaluator *mask_evaluator,
const int ptex_face_index, const float u, const float v,
const GridPaintMask **r_mask_grid,
float *grid_u, float *grid_v)
@@ -99,7 +92,7 @@ BLI_INLINE float read_mask_grid(const GridPaintMask *mask_grid,
return mask_grid->data[y * grid_size + x];
}
-static float eval_mask(SubdivCCGMask *mask_evaluator,
+static float eval_mask(SubdivCCGMaskEvaluator *mask_evaluator,
const int ptex_face_index,
const float u, const float v)
{
@@ -112,7 +105,7 @@ static float eval_mask(SubdivCCGMask *mask_evaluator,
return read_mask_grid(mask_grid, grid_u, grid_v);
}
-static void free_mask_data(SubdivCCGMask *mask_evaluator)
+static void free_mask_data(SubdivCCGMaskEvaluator *mask_evaluator)
{
GridPaintMaskData *data = mask_evaluator->user_data;
MEM_freeN(data->ptex_poly_corner);
@@ -133,8 +126,8 @@ static int count_num_ptex_faces(const Mesh *mesh)
return num_ptex_faces;
}
-static void displacement_data_init_mapping(SubdivCCGMask *mask_evaluator,
- const Mesh *mesh)
+static void mask_data_init_mapping(SubdivCCGMaskEvaluator *mask_evaluator,
+ const Mesh *mesh)
{
GridPaintMaskData *data = mask_evaluator->user_data;
const MPoly *mpoly = mesh->mpoly;
@@ -163,24 +156,24 @@ static void displacement_data_init_mapping(SubdivCCGMask *mask_evaluator,
}
}
-static void displacement_init_data(SubdivCCGMask *mask_evaluator,
- const Mesh *mesh)
+static void mask_init_data(SubdivCCGMaskEvaluator *mask_evaluator,
+ const Mesh *mesh)
{
GridPaintMaskData *data = mask_evaluator->user_data;
data->mpoly = mesh->mpoly;
data->grid_paint_mask =
CustomData_get_layer(&mesh->ldata, CD_GRID_PAINT_MASK);
- displacement_data_init_mapping(mask_evaluator, mesh);
+ mask_data_init_mapping(mask_evaluator, mesh);
}
-static void displacement_init_functions(SubdivCCGMask *mask_evaluator)
+static void mask_init_functions(SubdivCCGMaskEvaluator *mask_evaluator)
{
mask_evaluator->eval_mask = eval_mask;
mask_evaluator->free = free_mask_data;
}
bool BKE_subdiv_ccg_mask_init_from_paint(
- SubdivCCGMask *mask_evaluator,
+ SubdivCCGMaskEvaluator *mask_evaluator,
const struct Mesh *mesh)
{
GridPaintMask *grid_paint_mask =
@@ -191,7 +184,7 @@ bool BKE_subdiv_ccg_mask_init_from_paint(
/* Allocate all required memory. */
mask_evaluator->user_data = MEM_callocN(sizeof(GridPaintMaskData),
"mask from grid data");
- displacement_init_data(mask_evaluator, mesh);
- displacement_init_functions(mask_evaluator);
+ mask_init_data(mask_evaluator, mesh);
+ mask_init_functions(mask_evaluator);
return true;
}
diff --git a/source/blender/blenkernel/intern/subdiv_ccg_material.c b/source/blender/blenkernel/intern/subdiv_ccg_material.c
new file mode 100644
index 00000000000..1e086e00e25
--- /dev/null
+++ b/source/blender/blenkernel/intern/subdiv_ccg_material.c
@@ -0,0 +1,67 @@
+/*
+ * 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) 2018 by Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup bke
+ */
+
+#include "BKE_subdiv_ccg.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_mesh_types.h"
+
+typedef struct CCGMaterialFromMeshData {
+ const Mesh *mesh;
+} CCGMaterialFromMeshData;
+
+static DMFlagMat subdiv_ccg_material_flags_eval(
+ SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator,
+ const int coarse_face_index)
+{
+ CCGMaterialFromMeshData *data =
+ (CCGMaterialFromMeshData *)material_flags_evaluator->user_data;
+ const Mesh *mesh = data->mesh;
+ BLI_assert(coarse_face_index < mesh->totpoly);
+ const MPoly *mpoly = mesh->mpoly;
+ const MPoly *poly = &mpoly[coarse_face_index];
+ DMFlagMat material_flags;
+ material_flags.flag = poly->flag;
+ material_flags.mat_nr = poly->mat_nr;
+ return material_flags;
+}
+
+static void subdiv_ccg_material_flags_free(
+ SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator)
+{
+ MEM_freeN(material_flags_evaluator->user_data);
+}
+
+void BKE_subdiv_ccg_material_flags_init_from_mesh(
+ SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator,
+ const Mesh *mesh)
+{
+ CCGMaterialFromMeshData *data = MEM_mallocN(
+ sizeof(CCGMaterialFromMeshData), "ccg material eval");
+ data->mesh = mesh;
+ material_flags_evaluator->eval_material_flags =
+ subdiv_ccg_material_flags_eval;
+ material_flags_evaluator->free = subdiv_ccg_material_flags_free;
+ material_flags_evaluator->user_data = data;
+}
diff --git a/source/blender/blenkernel/intern/subdiv_converter.c b/source/blender/blenkernel/intern/subdiv_converter.c
index b3eab1565d7..7c9410fba72 100644
--- a/source/blender/blenkernel/intern/subdiv_converter.c
+++ b/source/blender/blenkernel/intern/subdiv_converter.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_converter.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "subdiv_converter.h"
diff --git a/source/blender/blenkernel/intern/subdiv_converter.h b/source/blender/blenkernel/intern/subdiv_converter.h
index 17172bc29f7..2cf016659ca 100644
--- a/source/blender/blenkernel/intern/subdiv_converter.h
+++ b/source/blender/blenkernel/intern/subdiv_converter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,24 +15,19 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __SUBDIV_CONVERTER_H__
#define __SUBDIV_CONVERTER_H__
-/** \file blender/blenkernel/intern/subdiv_converter.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_subdiv.h"
/* NOTE: Was initially used to get proper enumerator types, but this makes
- * it tricky to compile without OpenSubdiv.
- */
+ * it tricky to compile without OpenSubdiv. */
/* #include "opensubdiv_converter_capi.h" */
struct Mesh;
@@ -46,21 +39,18 @@ void BKE_subdiv_converter_init_for_mesh(struct OpenSubdiv_Converter *converter,
const struct Mesh *mesh);
/* NOTE: Frees converter data, but not converter itself. This means, that if
- * converter was allocated on heap, it is up to the user to free that memory.
- */
+ * converter was allocated on heap, it is up to the user to free that memory. */
void BKE_subdiv_converter_free(struct OpenSubdiv_Converter *converter);
/* ============================ INTERNAL HELPERS ============================ */
/* TODO(sergey): Find a way to make it OpenSubdiv_VtxBoundaryInterpolation,
- * without breaking compilation without OpenSubdiv.
- */
+ * without breaking compilation without OpenSubdiv. */
int BKE_subdiv_converter_vtx_boundary_interpolation_from_settings(
const SubdivSettings *settings);
/* TODO(sergey): Find a way to make it OpenSubdiv_FVarLinearInterpolation,
- * without breaking compilation without OpenSubdiv.
- */
+ * without breaking compilation without OpenSubdiv. */
int BKE_subdiv_converter_fvar_linear_from_settings(
const SubdivSettings *settings);
diff --git a/source/blender/blenkernel/intern/subdiv_converter_mesh.c b/source/blender/blenkernel/intern/subdiv_converter_mesh.c
index 0dad259b001..8aac77c0bd8 100644
--- a/source/blender/blenkernel/intern/subdiv_converter_mesh.c
+++ b/source/blender/blenkernel/intern/subdiv_converter_mesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_converter_mesh.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "subdiv_converter.h"
@@ -36,7 +30,6 @@
#include "BLI_utildefines.h"
#include "BLI_bitmap.h"
-#include "BLI_math_vector.h"
#include "BKE_customdata.h"
#include "BKE_mesh_mapping.h"
diff --git a/source/blender/blenkernel/intern/subdiv_displacement.c b/source/blender/blenkernel/intern/subdiv_displacement.c
index a6af6f45e59..bd801366ec5 100644
--- a/source/blender/blenkernel/intern/subdiv_displacement.c
+++ b/source/blender/blenkernel/intern/subdiv_displacement.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_displacement.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_subdiv.h"
diff --git a/source/blender/blenkernel/intern/subdiv_displacement_multires.c b/source/blender/blenkernel/intern/subdiv_displacement_multires.c
index d6865e1826f..527b3beae36 100644
--- a/source/blender/blenkernel/intern/subdiv_displacement_multires.c
+++ b/source/blender/blenkernel/intern/subdiv_displacement_multires.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_displacement_multires.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_subdiv.h"
@@ -39,6 +33,7 @@
#include "BKE_customdata.h"
#include "BKE_multires.h"
+#include "BKE_subdiv_eval.h"
#include "MEM_guardedalloc.h"
@@ -48,6 +43,7 @@ typedef struct PolyCornerIndex {
} PolyCornerIndex;
typedef struct MultiresDisplacementData {
+ Subdiv *subdiv;
int grid_size;
/* Mesh is used to read external displacement. */
Mesh *mesh;
@@ -59,6 +55,9 @@ typedef struct MultiresDisplacementData {
* NOTE: For quad polygon this is an index of first corner only, since
* there we only have one ptex. */
PolyCornerIndex *ptex_poly_corner;
+ /* Indexed by coarse face index, returns first ptex face index corresponding
+ * to that coarse face. */
+ int *face_ptex_offset;
/* Sanity check, is used in debug builds.
* Controls that initialize() was called prior to eval_displacement(). */
bool is_initialized;
@@ -98,9 +97,10 @@ static int displacement_get_grid_and_coord(
return corner;
}
-static const MDisps *displacement_get_next_grid(
+static const MDisps *displacement_get_other_grid(
SubdivDisplacement *displacement,
- const int ptex_face_index, const int corner)
+ const int ptex_face_index, const int corner,
+ const int corner_delta)
{
MultiresDisplacementData *data = displacement->user_data;
const PolyCornerIndex *poly_corner =
@@ -108,25 +108,11 @@ static const MDisps *displacement_get_next_grid(
const MPoly *poly = &data->mpoly[poly_corner->poly_index];
const int effective_corner = (poly->totloop == 4) ? corner
: poly_corner->corner;
- const int next_corner = (effective_corner + 1) % poly->totloop;
+ const int next_corner =
+ (effective_corner + corner_delta + poly->totloop) % poly->totloop;
return &data->mdisps[poly->loopstart + next_corner];
}
-static const MDisps *displacement_get_prev_grid(
- SubdivDisplacement *displacement,
- const int ptex_face_index, const int corner)
-{
- MultiresDisplacementData *data = displacement->user_data;
- const PolyCornerIndex *poly_corner =
- &data->ptex_poly_corner[ptex_face_index];
- const MPoly *poly = &data->mpoly[poly_corner->poly_index];
- const int effective_corner = (poly->totloop == 4) ? corner
- : poly_corner->corner;
- const int prev_corner =
- (effective_corner - 1 + poly->totloop) % poly->totloop;
- return &data->mdisps[poly->loopstart + prev_corner];
-}
-
BLI_INLINE eAverageWith read_displacement_grid(
const MDisps *displacement_grid,
const int grid_size,
@@ -152,95 +138,212 @@ BLI_INLINE eAverageWith read_displacement_grid(
return AVERAGE_WITH_NONE;
}
-static void average_with_all(
- SubdivDisplacement *displacement,
+static void average_convert_grid_coord_to_ptex(
+ const MPoly *poly,
+ const int corner, const float grid_u, const float grid_v,
+ float *r_ptex_face_u, float *r_ptex_face_v)
+{
+ if (poly->totloop == 4) {
+ BKE_subdiv_rotate_grid_to_quad(corner, grid_u, grid_v,
+ r_ptex_face_u, r_ptex_face_v);
+ }
+ else {
+ BKE_subdiv_grid_uv_to_ptex_face_uv(
+ grid_u, grid_v,
+ r_ptex_face_u, r_ptex_face_v);
+ }
+}
+
+static void average_construct_tangent_matrix(
+ Subdiv *subdiv,
+ const MPoly *poly,
const int ptex_face_index, const int corner,
- const float UNUSED(grid_u), const float UNUSED(grid_v),
+ const float u, const float v,
+ float r_tangent_matrix[3][3])
+{
+ const bool is_quad = (poly->totloop == 4);
+ const int quad_corner = is_quad ? corner : 0;
+ float dummy_P[3], dPdu[3], dPdv[3];
+ BKE_subdiv_eval_limit_point_and_derivatives(
+ subdiv, ptex_face_index, u, v, dummy_P, dPdu, dPdv);
+ BKE_multires_construct_tangent_matrix(
+ r_tangent_matrix, dPdu, dPdv, quad_corner);
+}
+
+static void average_read_displacement_tangent(
+ MultiresDisplacementData *data,
+ const MDisps *other_displacement_grid,
+ const float grid_u, const float grid_v,
float r_tangent_D[3])
{
+ read_displacement_grid(
+ other_displacement_grid, data->grid_size, grid_u, grid_v,
+ r_tangent_D);
+}
+
+static void average_read_displacement_object(
+ MultiresDisplacementData *data,
+ const MDisps *displacement_grid,
+ const float grid_u, const float grid_v,
+ const int ptex_face_index,
+ const int corner_index,
+ float r_D[3])
+{
+ const PolyCornerIndex *poly_corner =
+ &data->ptex_poly_corner[ptex_face_index];
+ const MPoly *poly = &data->mpoly[poly_corner->poly_index];
+ /* Get (u, v) coordinate within the other ptex face which corresponds to
+ * the grid coordinates. */
+ float u, v;
+ average_convert_grid_coord_to_ptex(
+ poly, corner_index, grid_u, grid_v, &u, &v);
+ /* Construct tangent matrix which corresponds to partial derivatives
+ * calculated for the other ptex face. */
+ float tangent_matrix[3][3];
+ average_construct_tangent_matrix(
+ data->subdiv, poly,
+ ptex_face_index, corner_index, u, v,
+ tangent_matrix);
+ /* Read displacement from other grid in a tangent space. */
+ float tangent_D[3];
+ average_read_displacement_tangent(
+ data, displacement_grid, grid_u, grid_v, tangent_D);
+ /* Convert displacement to object space. */
+ mul_v3_m3v3(r_D, tangent_matrix, tangent_D);
+}
+
+static void average_get_other_ptex_and_corner(
+ MultiresDisplacementData *data,
+ const int ptex_face_index, const int corner,
+ const int corner_delta,
+ int *r_other_ptex_face_index, int *r_other_corner_index)
+{
+ const PolyCornerIndex *poly_corner =
+ &data->ptex_poly_corner[ptex_face_index];
+ const MPoly *poly = &data->mpoly[poly_corner->poly_index];
+ const int num_corners = poly->totloop;
+ const bool is_quad = (num_corners == 4);
+ const int poly_index = poly - data->mpoly;
+ const int start_ptex_face_index = data->face_ptex_offset[poly_index];
+ *r_other_corner_index =
+ (corner + corner_delta + num_corners) % num_corners;
+ *r_other_ptex_face_index =
+ is_quad ? start_ptex_face_index
+ : start_ptex_face_index + *r_other_corner_index;
+}
+
+/* NOTE: Grid coordinates are relatiev to the other grid already. */
+static void average_with_other(SubdivDisplacement *displacement,
+ const int ptex_face_index, const int corner,
+ const float grid_u, const float grid_v,
+ const int corner_delta,
+ float r_D[3])
+{
+ MultiresDisplacementData *data = displacement->user_data;
+ const MDisps *other_displacement_grid = displacement_get_other_grid(
+ displacement, ptex_face_index, corner, corner_delta);
+ int other_ptex_face_index, other_corner_index;
+ average_get_other_ptex_and_corner(
+ data, ptex_face_index, corner, corner_delta,
+ &other_ptex_face_index, &other_corner_index);
+ /* Get displacement in object space. */
+ float other_D[3];
+ average_read_displacement_object(
+ data,
+ other_displacement_grid, grid_u, grid_v,
+ other_ptex_face_index, other_corner_index,
+ other_D);
+ /* Average result with the other displacement vector. */
+ add_v3_v3(r_D, other_D);
+ mul_v3_fl(r_D, 0.5f);
+}
+
+
+static void average_with_all(SubdivDisplacement *displacement,
+ const int ptex_face_index, const int corner,
+ const float UNUSED(grid_u),
+ const float UNUSED(grid_v),
+ float r_D[3])
+{
MultiresDisplacementData *data = displacement->user_data;
const PolyCornerIndex *poly_corner =
&data->ptex_poly_corner[ptex_face_index];
const MPoly *poly = &data->mpoly[poly_corner->poly_index];
- for (int current_corner = 0;
- current_corner < poly->totloop;
- current_corner++)
- {
- if (current_corner == corner) {
- continue;
- }
- const MDisps *displacement_grid =
- &data->mdisps[poly->loopstart + current_corner];
- const float *current_tangent_D = displacement_grid->disps[0];
- r_tangent_D[2] += current_tangent_D[2];
+ const int num_corners = poly->totloop;
+ for (int corner_delta = 1; corner_delta < num_corners; corner_delta++) {
+ average_with_other(
+ displacement, ptex_face_index, corner, 0.0f, 0.0f, corner_delta,
+ r_D);
}
- r_tangent_D[2] /= (float)poly->totloop;
}
static void average_with_next(SubdivDisplacement *displacement,
const int ptex_face_index, const int corner,
const float grid_u, const float UNUSED(grid_v),
- float r_tangent_D[3])
+ float r_D[3])
{
- MultiresDisplacementData *data = displacement->user_data;
- const int grid_size = data->grid_size;
- const MDisps *next_displacement_grid = displacement_get_next_grid(
- displacement, ptex_face_index, corner);
- float next_tangent_D[3];
- read_displacement_grid(next_displacement_grid, grid_size,
- 0.0f, grid_u,
- next_tangent_D);
- r_tangent_D[2] += next_tangent_D[2];
- r_tangent_D[2] *= 0.5f;
+ average_with_other(
+ displacement, ptex_face_index, corner, 0.0f, grid_u, 1, r_D);
}
static void average_with_prev(SubdivDisplacement *displacement,
- const int ptex_face_index, const int corner,
- const float UNUSED(grid_u), const float grid_v,
- float r_tangent_D[3])
+ const int ptex_face_index, const int corner,
+ const float UNUSED(grid_u), const float grid_v,
+ float r_D[3])
{
- MultiresDisplacementData *data = displacement->user_data;
- const int grid_size = data->grid_size;
- const MDisps *prev_displacement_grid = displacement_get_prev_grid(
- displacement, ptex_face_index, corner);
- float prev_tangent_D[3];
- read_displacement_grid(prev_displacement_grid, grid_size,
- grid_v, 0.0f,
- prev_tangent_D);
- r_tangent_D[2] += prev_tangent_D[2];
- r_tangent_D[2] *= 0.5f;
+ average_with_other(
+ displacement, ptex_face_index, corner, grid_v, 0.0f, -1, r_D);
}
static void average_displacement(SubdivDisplacement *displacement,
- const int ptex_face_index, const int corner,
eAverageWith average_with,
+ const int ptex_face_index, const int corner,
const float grid_u, const float grid_v,
- float r_tangent_D[3])
+ float r_D[3])
{
switch (average_with) {
case AVERAGE_WITH_ALL:
average_with_all(displacement,
ptex_face_index, corner,
grid_u, grid_v,
- r_tangent_D);
+ r_D);
break;
case AVERAGE_WITH_PREV:
average_with_prev(displacement,
ptex_face_index, corner,
grid_u, grid_v,
- r_tangent_D);
+ r_D);
break;
case AVERAGE_WITH_NEXT:
average_with_next(displacement,
ptex_face_index, corner,
grid_u, grid_v,
- r_tangent_D);
+ r_D);
break;
case AVERAGE_WITH_NONE:
break;
}
}
+static int displacement_get_face_corner(MultiresDisplacementData *data,
+ const int ptex_face_index,
+ const float u, const float v)
+{
+ const PolyCornerIndex *poly_corner =
+ &data->ptex_poly_corner[ptex_face_index];
+ const MPoly *poly = &data->mpoly[poly_corner->poly_index];
+ const int num_corners = poly->totloop;
+ const bool is_quad = (num_corners == 4);
+ if (is_quad) {
+ float dummy_corner_u, dummy_corner_v;
+ return BKE_subdiv_rotate_quad_to_corner(
+ u, v, &dummy_corner_u, &dummy_corner_v);
+ }
+ else {
+ return poly_corner->corner;
+ }
+}
+
static void initialize(SubdivDisplacement *displacement)
{
MultiresDisplacementData *data = displacement->user_data;
@@ -263,10 +366,11 @@ static void eval_displacement(SubdivDisplacement *displacement,
/* Get displacement in tangent space. */
const MDisps *displacement_grid;
float grid_u, grid_v;
- int corner = displacement_get_grid_and_coord(displacement,
- ptex_face_index, u, v,
- &displacement_grid,
- &grid_u, &grid_v);
+ const int corner_of_quad = displacement_get_grid_and_coord(
+ displacement,
+ ptex_face_index, u, v,
+ &displacement_grid,
+ &grid_u, &grid_v);
/* Read displacement from the current displacement grid and see if any
* averaging is needed. */
float tangent_D[3];
@@ -274,14 +378,19 @@ static void eval_displacement(SubdivDisplacement *displacement,
read_displacement_grid(displacement_grid, grid_size,
grid_u, grid_v,
tangent_D);
- average_displacement(displacement,
- ptex_face_index, corner,
- average_with, grid_u, grid_v,
- tangent_D);
/* Convert it to the object space. */
float tangent_matrix[3][3];
- BKE_multires_construct_tangent_matrix(tangent_matrix, dPdu, dPdv, corner);
+ BKE_multires_construct_tangent_matrix(
+ tangent_matrix, dPdu, dPdv, corner_of_quad);
mul_v3_m3v3(r_D, tangent_matrix, tangent_D);
+ /* For the boundary points of grid average two (or all) neighbor grids. */
+ const int corner = displacement_get_face_corner(
+ data, ptex_face_index, u, v);
+ average_displacement(displacement,
+ average_with,
+ ptex_face_index, corner,
+ grid_u, grid_v,
+ r_D);
}
static void free_displacement(SubdivDisplacement *displacement)
@@ -335,14 +444,17 @@ static void displacement_data_init_mapping(SubdivDisplacement *displacement,
}
static void displacement_init_data(SubdivDisplacement *displacement,
+ Subdiv *subdiv,
Mesh *mesh,
const MultiresModifierData *mmd)
{
MultiresDisplacementData *data = displacement->user_data;
+ data->subdiv = subdiv;
data->grid_size = BKE_subdiv_grid_size_from_level(mmd->totlvl);
data->mesh = mesh;
data->mpoly = mesh->mpoly;
data->mdisps = CustomData_get_layer(&mesh->ldata, CD_MDISPS);
+ data->face_ptex_offset = BKE_subdiv_face_ptex_offset_get(subdiv);
data->is_initialized = false;
displacement_data_init_mapping(displacement, mesh);
}
@@ -361,12 +473,17 @@ void BKE_subdiv_displacement_attach_from_multires(
{
/* Make sure we don't have previously assigned displacement. */
BKE_subdiv_displacement_detach(subdiv);
+ /* It is possible to have mesh without MDISPS layer. Happens when using
+ * dynamic topology. */
+ if (!CustomData_has_layer(&mesh->ldata, CD_MDISPS)) {
+ return;
+ }
/* Allocate all required memory. */
SubdivDisplacement *displacement = MEM_callocN(sizeof(SubdivDisplacement),
"multires displacement");
displacement->user_data = MEM_callocN(sizeof(MultiresDisplacementData),
"multires displacement data");
- displacement_init_data(displacement, mesh, mmd);
+ displacement_init_data(displacement, subdiv, mesh, mmd);
displacement_init_functions(displacement);
/* Finish. */
subdiv->displacement_evaluator = displacement;
diff --git a/source/blender/blenkernel/intern/subdiv_eval.c b/source/blender/blenkernel/intern/subdiv_eval.c
index 7043edc7fc9..7fcedd35e69 100644
--- a/source/blender/blenkernel/intern/subdiv_eval.c
+++ b/source/blender/blenkernel/intern/subdiv_eval.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_eval.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_subdiv_eval.h"
@@ -46,10 +40,10 @@
bool BKE_subdiv_eval_begin(Subdiv *subdiv)
{
+ BKE_subdiv_stats_reset(&subdiv->stats, SUBDIV_STATS_EVALUATOR_CREATE);
if (subdiv->topology_refiner == NULL) {
/* Happens on input mesh with just loose geometry,
- * or when OpenSubdiv is disabled
- */
+ * or when OpenSubdiv is disabled */
return false;
}
else if (subdiv->evaluator == NULL) {
@@ -76,8 +70,7 @@ static void set_coarse_positions(Subdiv *subdiv, const Mesh *mesh)
/* Mark vertices which needs new coordinates. */
/* TODO(sergey): This is annoying to calculate this on every update,
* maybe it's better to cache this mapping. Or make it possible to have
- * OpenSubdiv's vertices match mesh ones?
- */
+ * OpenSubdiv's vertices match mesh ones? */
BLI_bitmap *vertex_used_map =
BLI_BITMAP_NEW(mesh->totvert, "vert used map");
for (int poly_index = 0; poly_index < mesh->totpoly; poly_index++) {
diff --git a/source/blender/blenkernel/intern/subdiv_foreach.c b/source/blender/blenkernel/intern/subdiv_foreach.c
index f049b23a9ef..bb01bfd587a 100644
--- a/source/blender/blenkernel/intern/subdiv_foreach.c
+++ b/source/blender/blenkernel/intern/subdiv_foreach.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_foreach.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_subdiv_foreach.h"
@@ -35,11 +29,10 @@
#include "DNA_meshdata_types.h"
#include "DNA_key_types.h"
-#include "BLI_alloca.h"
#include "BLI_bitmap.h"
-#include "BLI_math_vector.h"
#include "BLI_task.h"
+#include "BKE_customdata.h"
#include "BKE_mesh.h"
#include "BKE_key.h"
#include "BKE_subdiv.h"
@@ -131,6 +124,38 @@ typedef struct SubdivForeachTaskContext {
BLI_bitmap *coarse_edges_used_map;
} SubdivForeachTaskContext;
+/* =============================================================================
+ * Threading helpers.
+ */
+
+static void *subdiv_foreach_tls_alloc(SubdivForeachTaskContext *ctx)
+{
+ const SubdivForeachContext *foreach_context = ctx->foreach_context;
+ void *tls = NULL;
+ if (foreach_context->user_data_tls_size != 0) {
+ tls = MEM_mallocN(foreach_context->user_data_tls_size, "tls");
+ memcpy(tls,
+ foreach_context->user_data_tls,
+ foreach_context->user_data_tls_size);
+ }
+ return tls;
+}
+
+static void subdiv_foreach_tls_free(SubdivForeachTaskContext *ctx, void *tls)
+{
+ if (tls == NULL) {
+ return;
+ }
+ if (ctx->foreach_context != NULL) {
+ ctx->foreach_context->user_data_tls_free(tls);
+ }
+ MEM_freeN(tls);
+}
+
+/* =============================================================================
+ * Initialization.
+ */
+
/* NOTE: Expects edge map to be zeroed. */
static void subdiv_foreach_ctx_count(SubdivForeachTaskContext *ctx)
{
@@ -438,21 +463,15 @@ static void subdiv_foreach_every_corner_vertices_special(
false);
}
-static void subdiv_foreach_every_corner_vertices(SubdivForeachTaskContext *ctx)
+static void subdiv_foreach_every_corner_vertices(
+ SubdivForeachTaskContext *ctx,
+ void *tls)
{
if (ctx->foreach_context->vertex_every_corner == NULL) {
return;
}
- const SubdivForeachContext *foreach_context = ctx->foreach_context;
const Mesh *coarse_mesh = ctx->coarse_mesh;
const MPoly *coarse_mpoly = coarse_mesh->mpoly;
- void *tls = NULL;
- if (foreach_context->user_data_tls_size != 0) {
- tls = MEM_mallocN(foreach_context->user_data_tls_size, "tls");
- memcpy(tls,
- foreach_context->user_data_tls,
- foreach_context->user_data_tls_size);
- }
for (int poly_index = 0; poly_index < coarse_mesh->totpoly; poly_index++) {
const MPoly *coarse_poly = &coarse_mpoly[poly_index];
if (coarse_poly->totloop == 4) {
@@ -462,9 +481,6 @@ static void subdiv_foreach_every_corner_vertices(SubdivForeachTaskContext *ctx)
subdiv_foreach_every_corner_vertices_special(ctx, tls, coarse_poly);
}
}
- if (tls != NULL) {
- MEM_freeN(tls);
- }
}
/* Traverse of edge vertices. They are coming from coarse edges. */
@@ -604,8 +620,8 @@ static void subdiv_foreach_edge_vertices_special_do(
corner,
subdiv_vertex_index);
}
- const int next_ptex_face_index =
- ptex_face_start_index + (corner + 1) % coarse_poly->totloop;
+ const int next_corner = (corner + 1) % coarse_poly->totloop;
+ const int next_ptex_face_index = ptex_face_start_index + next_corner;
for (int vertex_index = 1;
vertex_index < num_vertices_per_ptex_edge - 1;
vertex_index++, subdiv_vertex_index += veretx_delta)
@@ -618,7 +634,7 @@ static void subdiv_foreach_edge_vertices_special_do(
0.0f, v,
coarse_edge_index,
coarse_poly_index,
- corner,
+ next_corner,
subdiv_vertex_index);
}
}
@@ -670,21 +686,15 @@ static void subdiv_foreach_every_edge_vertices_special(
false);
}
-static void subdiv_foreach_every_edge_vertices(SubdivForeachTaskContext *ctx)
+static void subdiv_foreach_every_edge_vertices(
+ SubdivForeachTaskContext *ctx,
+ void *tls)
{
if (ctx->foreach_context->vertex_every_edge == NULL) {
return;
}
- const SubdivForeachContext *foreach_context = ctx->foreach_context;
const Mesh *coarse_mesh = ctx->coarse_mesh;
const MPoly *coarse_mpoly = coarse_mesh->mpoly;
- void *tls = NULL;
- if (foreach_context->user_data_tls_size != 0) {
- tls = MEM_mallocN(foreach_context->user_data_tls_size, "tls");
- memcpy(tls,
- foreach_context->user_data_tls,
- foreach_context->user_data_tls_size);
- }
for (int poly_index = 0; poly_index < coarse_mesh->totpoly; poly_index++) {
const MPoly *coarse_poly = &coarse_mpoly[poly_index];
if (coarse_poly->totloop == 4) {
@@ -694,9 +704,6 @@ static void subdiv_foreach_every_edge_vertices(SubdivForeachTaskContext *ctx)
subdiv_foreach_every_edge_vertices_special(ctx, tls, coarse_poly);
}
}
- if (tls != NULL) {
- MEM_freeN(tls);
- }
}
/* Traversal of inner vertices, they are coming from ptex patches. */
@@ -796,12 +803,6 @@ static void subdiv_foreach_vertices(SubdivForeachTaskContext *ctx,
const Mesh *coarse_mesh = ctx->coarse_mesh;
const MPoly *coarse_mpoly = coarse_mesh->mpoly;
const MPoly *coarse_poly = &coarse_mpoly[poly_index];
- if (ctx->foreach_context->vertex_corner != NULL) {
- subdiv_foreach_corner_vertices(ctx, tls, coarse_poly);
- }
- if (ctx->foreach_context->vertex_edge != NULL) {
- subdiv_foreach_edge_vertices(ctx, tls, coarse_poly);
- }
if (ctx->foreach_context->vertex_inner != NULL) {
subdiv_foreach_inner_vertices(ctx, tls, coarse_poly);
}
@@ -1940,6 +1941,37 @@ static void subdiv_foreach_vertices_of_loose_edges_task(
* Subdivision process entry points.
*/
+static void subdiv_foreach_single_geometry_vertices(
+ SubdivForeachTaskContext *ctx,
+ void *tls)
+{
+ if (ctx->foreach_context->vertex_corner == NULL) {
+ return;
+ }
+ const Mesh *coarse_mesh = ctx->coarse_mesh;
+ const MPoly *coarse_mpoly = coarse_mesh->mpoly;
+ for (int poly_index = 0; poly_index < coarse_mesh->totpoly; poly_index++) {
+ const MPoly *coarse_poly = &coarse_mpoly[poly_index];
+ subdiv_foreach_corner_vertices(ctx, tls, coarse_poly);
+ subdiv_foreach_edge_vertices(ctx, tls, coarse_poly);
+ }
+}
+
+static void subdiv_foreach_single_thread_tasks(SubdivForeachTaskContext *ctx)
+{
+ /* NOTE: In theory, we can try to skip allocation of TLS here, but in
+ * practice if the callbacks used here are not specified then TLS will not
+ * be requested anyway. */
+ void *tls = subdiv_foreach_tls_alloc(ctx);
+ /* Passes to average displacement on the corner vertices
+ * and boundary edges. */
+ subdiv_foreach_every_corner_vertices(ctx, tls);
+ subdiv_foreach_every_edge_vertices(ctx, tls);
+ /* Run callbacks which are supposed to be run once per shared geometry. */
+ subdiv_foreach_single_geometry_vertices(ctx, tls);
+ subdiv_foreach_tls_free(ctx, tls);
+}
+
static void subdiv_foreach_task(
void *__restrict userdata,
const int poly_index,
@@ -1998,11 +2030,8 @@ bool BKE_subdiv_foreach_subdiv_geometry(
return false;
}
}
- /* Single threaded passes to average displacement on the corner vertices
- * and boundary edges.
- */
- subdiv_foreach_every_corner_vertices(&ctx);
- subdiv_foreach_every_edge_vertices(&ctx);
+ /* Run all the code which is not supposed to be run from threads. */
+ subdiv_foreach_single_thread_tasks(&ctx);
/* Threaded traversal of the rest of topology. */
ParallelRangeSettings parallel_range_settings;
BLI_parallel_range_settings_defaults(&parallel_range_settings);
diff --git a/source/blender/blenkernel/intern/subdiv_inline.h b/source/blender/blenkernel/intern/subdiv_inline.h
index 7eebde48bdc..566d54ef72b 100644
--- a/source/blender/blenkernel/intern/subdiv_inline.h
+++ b/source/blender/blenkernel/intern/subdiv_inline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_inline.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __SUBDIV_INLINE_H__
@@ -43,38 +37,70 @@ BLI_INLINE void BKE_subdiv_ptex_face_uv_to_grid_uv(
*r_grid_v = 1.0f - ptex_u;
}
+BLI_INLINE void BKE_subdiv_grid_uv_to_ptex_face_uv(
+ const float grid_u, const float grid_v,
+ float *r_ptex_u, float *r_ptex_v)
+{
+ *r_ptex_u = 1.0f - grid_v;
+ *r_ptex_v = 1.0f - grid_u;
+}
+
BLI_INLINE int BKE_subdiv_grid_size_from_level(const int level)
{
return (1 << (level - 1)) + 1;
}
BLI_INLINE int BKE_subdiv_rotate_quad_to_corner(
- const float u, const float v,
- float *r_u, float *r_v)
+ const float quad_u, const float quad_v,
+ float *r_corner_u, float *r_corner_v)
{
int corner;
- if (u <= 0.5f && v <= 0.5f) {
+ if (quad_u <= 0.5f && quad_v <= 0.5f) {
corner = 0;
- *r_u = 2.0f * u;
- *r_v = 2.0f * v;
+ *r_corner_u = 2.0f * quad_u;
+ *r_corner_v = 2.0f * quad_v;
}
- else if (u > 0.5f && v <= 0.5f) {
+ else if (quad_u > 0.5f && quad_v <= 0.5f) {
corner = 1;
- *r_u = 2.0f * v;
- *r_v = 2.0f * (1.0f - u);
+ *r_corner_u = 2.0f * quad_v;
+ *r_corner_v = 2.0f * (1.0f - quad_u);
}
- else if (u > 0.5f && v > 0.5f) {
+ else if (quad_u > 0.5f && quad_v > 0.5f) {
corner = 2;
- *r_u = 2.0f * (1.0f - u);
- *r_v = 2.0f * (1.0f - v);
+ *r_corner_u = 2.0f * (1.0f - quad_u);
+ *r_corner_v = 2.0f * (1.0f - quad_v);
}
else {
- BLI_assert(u <= 0.5f && v >= 0.5f);
+ BLI_assert(quad_u <= 0.5f && quad_v >= 0.5f);
corner = 3;
- *r_u = 2.0f * (1.0f - v);
- *r_v = 2.0f * u;
+ *r_corner_u = 2.0f * (1.0f - quad_v);
+ *r_corner_v = 2.0f * quad_u;
}
return corner;
}
+BLI_INLINE void BKE_subdiv_rotate_grid_to_quad(
+ const int corner,
+ const float grid_u, const float grid_v,
+ float *r_quad_u, float *r_quad_v)
+{
+ if (corner == 0) {
+ *r_quad_u = 0.5f - grid_v * 0.5f;
+ *r_quad_v = 0.5f - grid_u * 0.5f;
+ }
+ else if (corner == 1) {
+ *r_quad_u = 0.5f + grid_u * 0.5f;
+ *r_quad_v = 0.5f - grid_v * 0.5f;
+ }
+ else if (corner == 2) {
+ *r_quad_u = 0.5f + grid_v * 0.5f;
+ *r_quad_v = 0.5f + grid_u * 0.5f;
+ }
+ else {
+ BLI_assert(corner == 3);
+ *r_quad_u = 0.5f - grid_u * 0.5f;
+ *r_quad_v = 0.5f + grid_v * 0.5f;
+ }
+}
+
#endif /* __SUBDIV_INLINE_H__ */
diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c
index 4d1b436ca16..8ac120ec79d 100644
--- a/source/blender/blenkernel/intern/subdiv_mesh.c
+++ b/source/blender/blenkernel/intern/subdiv_mesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_mesh.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_subdiv_mesh.h"
@@ -36,10 +30,9 @@
#include "DNA_key_types.h"
#include "BLI_alloca.h"
-#include "BLI_bitmap.h"
#include "BLI_math_vector.h"
-#include "BLI_task.h"
+#include "BKE_customdata.h"
#include "BKE_mesh.h"
#include "BKE_key.h"
#include "BKE_subdiv.h"
@@ -65,6 +58,24 @@ typedef struct SubdivMeshContext {
/* UV layers interpolation. */
int num_uv_layers;
MLoopUV *uv_layers[MAX_MTFACE];
+ /* Accumulated values.
+ *
+ * Averaging is happening for vertices along the coarse edges and corners.
+ * This is needed for both displacement and normals.
+ *
+ * Displacement is being accumulated to a verticies coordinates, since those
+ * are not needed during traversal of edge/corner vertices.
+ *
+ * For normals we are using dedicated array, since we can not use same
+ * vertices (normals are `short`, which will cause a lot of precision
+ * issues). */
+ float (*accumulated_normals)[3];
+ /* Per-subdivided vertex counter of averaged values. */
+ int *accumulated_counters;
+ /* Denotes whether normals can be evaluated from a limit surface. One case
+ * when it's not possible is when displacement is used. */
+ bool can_evaluate_normals;
+ bool have_displacement;
} SubdivMeshContext;
static void subdiv_mesh_ctx_cache_uv_layers(SubdivMeshContext *ctx)
@@ -94,6 +105,30 @@ static void subdiv_mesh_ctx_cache_custom_data_layers(SubdivMeshContext *ctx)
subdiv_mesh_ctx_cache_uv_layers(ctx);
}
+static void subdiv_mesh_prepare_accumulator(
+ SubdivMeshContext *ctx, int num_vertices)
+{
+ if (!ctx->can_evaluate_normals && !ctx->have_displacement) {
+ return;
+ }
+ /* TODO(sergey): Technically, this is overallocating, we don't need memory
+ * for an inner subdivision vertices. */
+ ctx->accumulated_normals = MEM_calloc_arrayN(
+ sizeof(*ctx->accumulated_normals),
+ num_vertices,
+ "subdiv accumulated normals");
+ ctx->accumulated_counters = MEM_calloc_arrayN(
+ sizeof(*ctx->accumulated_counters),
+ num_vertices,
+ "subdiv accumulated counters");
+}
+
+static void subdiv_mesh_context_free(SubdivMeshContext *ctx)
+{
+ MEM_SAFE_FREE(ctx->accumulated_normals);
+ MEM_SAFE_FREE(ctx->accumulated_counters);
+}
+
/* =============================================================================
* Loop custom data copy helpers.
*/
@@ -120,8 +155,7 @@ static void loops_of_ptex_get(
/* Loop which look in the (opposite) V direction of the current
* ptex face.
*
- * TODO(sergey): Get rid of using module on every iteration.
- */
+ * TODO(sergey): Get rid of using module on every iteration. */
const int last_ptex_loop_index =
coarse_poly->loopstart +
(ptex_of_poly_index + coarse_poly->totloop - 1) %
@@ -143,14 +177,12 @@ static void loops_of_ptex_get(
*/
/* TODO(sergey): Somehow de-duplicate with loops storage, without too much
- * exception cases all over the code.
- */
+ * exception cases all over the code. */
typedef struct VerticesForInterpolation {
/* This field points to a vertex data which is to be used for interpolation.
* The idea is to avoid unnecessary allocations for regular faces, where
- * we can simply
- */
+ * we can simply use corner verticies. */
const CustomData *vertex_data;
/* Vertices data calculated for ptex corners. There are always 4 elements
* in this custom data, aligned the following way:
@@ -160,13 +192,11 @@ typedef struct VerticesForInterpolation {
* index 2 -> uv (1, 1)
* index 3 -> uv (1, 0)
*
- * Is allocated for non-regular faces (triangles and n-gons).
- */
+ * Is allocated for non-regular faces (triangles and n-gons). */
CustomData vertex_data_storage;
bool vertex_data_storage_allocated;
/* Infices within vertex_data to interpolate for. The indices are aligned
- * with uv coordinates in a similar way as indices in loop_data_storage.
- */
+ * with uv coordinates in a similar way as indices in loop_data_storage. */
int vertex_indices[4];
} VerticesForInterpolation;
@@ -195,7 +225,7 @@ static void vertex_interpolation_init(
/* Allocate storage for loops corresponding to ptex corners. */
CustomData_copy(&ctx->coarse_mesh->vdata,
&vertex_interpolation->vertex_data_storage,
- CD_MASK_EVERYTHING,
+ CD_MASK_EVERYTHING.vmask,
CD_CALLOC,
4);
/* Initialize indices. */
@@ -205,8 +235,7 @@ static void vertex_interpolation_init(
vertex_interpolation->vertex_indices[3] = 3;
vertex_interpolation->vertex_data_storage_allocated = true;
/* Interpolate center of poly right away, it stays unchanged for all
- * ptex faces.
- */
+ * ptex faces. */
const float weight = 1.0f / (float)coarse_poly->totloop;
float *weights = BLI_array_alloca(weights, coarse_poly->totloop);
int *indices = BLI_array_alloca(indices, coarse_poly->totloop);
@@ -249,8 +278,7 @@ static void vertex_interpolation_from_corner(
* middle points.
*
* TODO(sergey): Re-use one of interpolation results from previous
- * iteration.
- */
+ * iteration. */
const float weights[2] = {0.5f, 0.5f};
const int first_loop_index = loops_of_ptex.first_loop - coarse_mloop;
const int last_loop_index = loops_of_ptex.last_loop - coarse_mloop;
@@ -291,8 +319,7 @@ static void vertex_interpolation_end(
typedef struct LoopsForInterpolation {
/* This field points to a loop data which is to be used for interpolation.
* The idea is to avoid unnecessary allocations for regular faces, where
- * we can simply
- */
+ * we can simply interpolate corner verticies. */
const CustomData *loop_data;
/* Loops data calculated for ptex corners. There are always 4 elements
* in this custom data, aligned the following way:
@@ -302,13 +329,11 @@ typedef struct LoopsForInterpolation {
* index 2 -> uv (1, 1)
* index 3 -> uv (1, 0)
*
- * Is allocated for non-regular faces (triangles and n-gons).
- */
+ * Is allocated for non-regular faces (triangles and n-gons). */
CustomData loop_data_storage;
bool loop_data_storage_allocated;
/* Infices within loop_data to interpolate for. The indices are aligned with
- * uv coordinates in a similar way as indices in loop_data_storage.
- */
+ * uv coordinates in a similar way as indices in loop_data_storage. */
int loop_indices[4];
} LoopsForInterpolation;
@@ -331,7 +356,7 @@ static void loop_interpolation_init(
/* Allocate storage for loops corresponding to ptex corners. */
CustomData_copy(&ctx->coarse_mesh->ldata,
&loop_interpolation->loop_data_storage,
- CD_MASK_EVERYTHING,
+ CD_MASK_EVERYTHING.lmask,
CD_CALLOC,
4);
/* Initialize indices. */
@@ -341,8 +366,7 @@ static void loop_interpolation_init(
loop_interpolation->loop_indices[3] = 3;
loop_interpolation->loop_data_storage_allocated = true;
/* Interpolate center of poly right away, it stays unchanged for all
- * ptex faces.
- */
+ * ptex faces. */
const float weight = 1.0f / (float)coarse_poly->totloop;
float *weights = BLI_array_alloca(weights, coarse_poly->totloop);
int *indices = BLI_array_alloca(indices, coarse_poly->totloop);
@@ -385,13 +409,14 @@ static void loop_interpolation_from_corner(
* middle points.
*
* TODO(sergey): Re-use one of interpolation results from previous
- * iteration.
- */
+ * iteration. */
const float weights[2] = {0.5f, 0.5f};
- const int first_indices[2] = {
- loops_of_ptex.first_loop - coarse_mloop,
- (loops_of_ptex.first_loop + 1 - coarse_mloop) %
- coarse_poly->totloop};
+ const int base_loop_index = coarse_poly->loopstart;
+ const int first_loop_index = loops_of_ptex.first_loop - coarse_mloop;
+ const int second_loop_index =
+ base_loop_index +
+ (first_loop_index - base_loop_index + 1) % coarse_poly->totloop;
+ const int first_indices[2] = {first_loop_index, second_loop_index};
const int last_indices[2] = {
loops_of_ptex.last_loop - coarse_mloop,
loops_of_ptex.first_loop - coarse_mloop};
@@ -465,27 +490,34 @@ static void eval_final_point_and_vertex_normal(
}
/* =============================================================================
- * Displacement helpers
+ * Accumulation helpers.
*/
-static void subdiv_accumulate_vertex_displacement(
- Subdiv *subdiv,
+static void subdiv_accumulate_vertex_normal_and_displacement(
+ SubdivMeshContext *ctx,
const int ptex_face_index,
const float u, const float v,
MVert *subdiv_vert)
{
+ Subdiv *subdiv = ctx->subdiv;
+ const int subdiv_vertex_index = subdiv_vert - ctx->subdiv_mesh->mvert;
float dummy_P[3], dPdu[3], dPdv[3], D[3];
BKE_subdiv_eval_limit_point_and_derivatives(
subdiv, ptex_face_index, u, v, dummy_P, dPdu, dPdv);
- BKE_subdiv_eval_displacement(subdiv,
- ptex_face_index, u, v,
- dPdu, dPdv,
- D);
- add_v3_v3(subdiv_vert->co, D);
- if (subdiv_vert->flag & ME_VERT_TMP_TAG) {
- mul_v3_fl(subdiv_vert->co, 0.5f);
+ /* Accumulate normal. */
+ if (ctx->can_evaluate_normals) {
+ float N[3];
+ cross_v3_v3v3(N, dPdu, dPdv);
+ normalize_v3(N);
+ add_v3_v3(ctx->accumulated_normals[subdiv_vertex_index], N);
+ }
+ /* Accumulate displacement if needed. */
+ if (ctx->have_displacement) {
+ BKE_subdiv_eval_displacement(
+ subdiv, ptex_face_index, u, v, dPdu, dPdv, D);
+ add_v3_v3(subdiv_vert->co, D);
}
- subdiv_vert->flag |= ME_VERT_TMP_TAG;
+ ++ctx->accumulated_counters[subdiv_vertex_index];
}
/* =============================================================================
@@ -508,6 +540,7 @@ static bool subdiv_mesh_topology_info(
num_loops,
num_polygons);
subdiv_mesh_ctx_cache_custom_data_layers(subdiv_context);
+ subdiv_mesh_prepare_accumulator(subdiv_context, num_vertices);
return true;
}
@@ -524,7 +557,6 @@ static void subdiv_vertex_data_copy(
Mesh *subdiv_mesh = ctx->subdiv_mesh;
const int coarse_vertex_index = coarse_vertex - coarse_mesh->mvert;
const int subdiv_vertex_index = subdiv_vertex - subdiv_mesh->mvert;
- subdiv_vertex->flag &= ~ME_VERT_TMP_TAG;
CustomData_copy_data(&coarse_mesh->vdata,
&ctx->subdiv_mesh->vdata,
coarse_vertex_index,
@@ -543,7 +575,6 @@ static void subdiv_vertex_data_interpolate(
u * (1.0f - v),
u * v,
(1.0f - u) * v};
- subdiv_vertex->flag &= ~ME_VERT_TMP_TAG;
CustomData_interp(vertex_interpolation->vertex_data,
&ctx->subdiv_mesh->vdata,
vertex_interpolation->vertex_indices,
@@ -562,19 +593,29 @@ static void evaluate_vertex_and_apply_displacement_copy(
const MVert *coarse_vert,
MVert *subdiv_vert)
{
+ const int subdiv_vertex_index = subdiv_vert - ctx->subdiv_mesh->mvert;
+ const float inv_num_accumulated =
+ 1.0f / ctx->accumulated_counters[subdiv_vertex_index];
/* Displacement is accumulated in subdiv vertex position.
- * need to back it up before copying data from original vertex.
- */
- float D[3];
- copy_v3_v3(D, subdiv_vert->co);
+ * Needs to be backed up before copying data from original vertex. */
+ float D[3] = {0.0f, 0.0f, 0.0f};
+ if (ctx->have_displacement) {
+ copy_v3_v3(D, subdiv_vert->co);
+ mul_v3_fl(D, inv_num_accumulated);
+ }
+ /* Copy custom data and evaluate position. */
subdiv_vertex_data_copy(ctx, coarse_vert, subdiv_vert);
- BKE_subdiv_eval_limit_point_and_short_normal(
- ctx->subdiv,
- ptex_face_index,
- u, v,
- subdiv_vert->co, subdiv_vert->no);
+ BKE_subdiv_eval_limit_point(
+ ctx->subdiv, ptex_face_index, u, v, subdiv_vert->co);
/* Apply displacement. */
add_v3_v3(subdiv_vert->co, D);
+ /* Copy normal from accumulated storage. */
+ if (ctx->can_evaluate_normals) {
+ float N[3];
+ copy_v3_v3(N, ctx->accumulated_normals[subdiv_vertex_index]);
+ normalize_v3(N);
+ normal_float_to_short_v3(subdiv_vert->no, N);
+ }
}
static void evaluate_vertex_and_apply_displacement_interpolate(
@@ -584,22 +625,31 @@ static void evaluate_vertex_and_apply_displacement_interpolate(
VerticesForInterpolation *vertex_interpolation,
MVert *subdiv_vert)
{
+ const int subdiv_vertex_index = subdiv_vert - ctx->subdiv_mesh->mvert;
+ const float inv_num_accumulated =
+ 1.0f / ctx->accumulated_counters[subdiv_vertex_index];
/* Displacement is accumulated in subdiv vertex position.
- * need to back it up before copying data from original vertex.
- */
- float D[3];
- copy_v3_v3(D, subdiv_vert->co);
- subdiv_vertex_data_interpolate(ctx,
- subdiv_vert,
- vertex_interpolation,
- u, v);
- BKE_subdiv_eval_limit_point_and_short_normal(
- ctx->subdiv,
- ptex_face_index,
- u, v,
- subdiv_vert->co, subdiv_vert->no);
+ * Needs to be backed up before copying data from original vertex. */
+ float D[3] = {0.0f, 0.0f, 0.0f};
+ if (ctx->have_displacement) {
+ copy_v3_v3(D, subdiv_vert->co);
+ mul_v3_fl(D, inv_num_accumulated);
+ }
+ /* Interpolate custom data and evaluate position. */
+ subdiv_vertex_data_interpolate(
+ ctx, subdiv_vert, vertex_interpolation, u, v);
+ BKE_subdiv_eval_limit_point(
+ ctx->subdiv, ptex_face_index, u, v, subdiv_vert->co);
/* Apply displacement. */
add_v3_v3(subdiv_vert->co, D);
+ /* Copy normal from accumulated storage. */
+ if (ctx->can_evaluate_normals) {
+ float N[3];
+ copy_v3_v3(N, ctx->accumulated_normals[subdiv_vertex_index]);
+ mul_v3_fl(N, inv_num_accumulated);
+ normalize_v3(N);
+ normal_float_to_short_v3(subdiv_vert->no, N);
+ }
}
static void subdiv_mesh_vertex_every_corner_or_edge(
@@ -610,12 +660,11 @@ static void subdiv_mesh_vertex_every_corner_or_edge(
const int subdiv_vertex_index)
{
SubdivMeshContext *ctx = foreach_context->user_data;
- Subdiv *subdiv = ctx->subdiv;
Mesh *subdiv_mesh = ctx->subdiv_mesh;
MVert *subdiv_mvert = subdiv_mesh->mvert;
MVert *subdiv_vert = &subdiv_mvert[subdiv_vertex_index];
- subdiv_accumulate_vertex_displacement(
- subdiv, ptex_face_index, u, v, subdiv_vert);
+ subdiv_accumulate_vertex_normal_and_displacement(
+ ctx, ptex_face_index, u, v, subdiv_vert);
}
static void subdiv_mesh_vertex_every_corner(
@@ -969,8 +1018,7 @@ static void subdiv_mesh_vertex_loose(
/* Get neighbor edges of the given one.
* - neighbors[0] is an edge adjacent to edge->v1.
- * - neighbors[1] is an edge adjacent to edge->v1.
- */
+ * - neighbors[1] is an edge adjacent to edge->v2. */
static void find_edge_neighbors(const SubdivMeshContext *ctx,
const MEdge *edge,
const MEdge *neighbors[2])
@@ -979,6 +1027,7 @@ static void find_edge_neighbors(const SubdivMeshContext *ctx,
const MEdge *coarse_medge = coarse_mesh->medge;
neighbors[0] = NULL;
neighbors[1] = NULL;
+ int neighbor_counters[2] = {0, 0};
for (int edge_index = 0; edge_index < coarse_mesh->totedge; edge_index++) {
const MEdge *current_edge = &coarse_medge[edge_index];
if (current_edge == edge) {
@@ -986,11 +1035,22 @@ static void find_edge_neighbors(const SubdivMeshContext *ctx,
}
if (ELEM(edge->v1, current_edge->v1, current_edge->v2)) {
neighbors[0] = current_edge;
+ ++neighbor_counters[0];
}
if (ELEM(edge->v2, current_edge->v1, current_edge->v2)) {
neighbors[1] = current_edge;
+ ++neighbor_counters[1];
}
}
+ /* Vertices which has more than one neighbor are considered infinitely
+ * sharp. This is also how topology factory treats vertices of a surface
+ * which are adjacent to a loose edge. */
+ if (neighbor_counters[0] > 1) {
+ neighbors[0] = NULL;
+ }
+ if (neighbor_counters[1] > 1) {
+ neighbors[1] = NULL;
+ }
}
static void points_for_loose_edges_interpolation_get(
@@ -1064,6 +1124,9 @@ static void subdiv_mesh_vertex_of_loose_edge_interpolate(
coarse_vertex_indices,
interpolation_weights, NULL,
2, subdiv_vertex_index);
+ if (ctx->vert_origindex != NULL) {
+ ctx->vert_origindex[subdiv_vertex_index] = ORIGINDEX_NONE;
+ }
}
}
@@ -1089,7 +1152,6 @@ static void subdiv_mesh_vertex_of_loose_edge(
/* Perform interpolation. */
float weights[4];
key_curve_position_weights(u, weights, KEY_BSPLINE);
-
/* Interpolate custom data. */
subdiv_mesh_vertex_of_loose_edge_interpolate(
ctx, coarse_edge, u, subdiv_vertex_index);
@@ -1115,14 +1177,16 @@ static void subdiv_mesh_vertex_of_loose_edge(
* Initialization.
*/
-static void setup_foreach_callbacks(SubdivForeachContext *foreach_context,
- const Subdiv *subdiv)
+static void setup_foreach_callbacks(const SubdivMeshContext *subdiv_context,
+ SubdivForeachContext *foreach_context)
{
memset(foreach_context, 0, sizeof(*foreach_context));
/* General information. */
foreach_context->topology_info = subdiv_mesh_topology_info;
- /* Every boundary geometry. Used for dispalcement averaging. */
- if (subdiv->displacement_evaluator != NULL) {
+ /* Every boundary geometry. Used for dispalcement and normals averaging. */
+ if (subdiv_context->can_evaluate_normals ||
+ subdiv_context->have_displacement)
+ {
foreach_context->vertex_every_corner = subdiv_mesh_vertex_every_corner;
foreach_context->vertex_every_edge = subdiv_mesh_vertex_every_edge;
}
@@ -1159,8 +1223,7 @@ Mesh *BKE_subdiv_to_mesh(
* - OpenSubdiv is disabled.
* - Something totally bad happened, and OpenSubdiv rejected our
* topology.
- * In either way, we can't safely continue.
- */
+ * In either way, we can't safely continue. */
if (coarse_mesh->totpoly) {
BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_MESH);
return NULL;
@@ -1171,25 +1234,28 @@ Mesh *BKE_subdiv_to_mesh(
subdiv_context.settings = settings;
subdiv_context.coarse_mesh = coarse_mesh;
subdiv_context.subdiv = subdiv;
+ subdiv_context.have_displacement =
+ (subdiv->displacement_evaluator != NULL);
+ subdiv_context.can_evaluate_normals = !subdiv_context.have_displacement;
/* Multi-threaded traversal/evaluation. */
BKE_subdiv_stats_begin(&subdiv->stats,
SUBDIV_STATS_SUBDIV_TO_MESH_GEOMETRY);
SubdivForeachContext foreach_context;
- setup_foreach_callbacks(&foreach_context, subdiv);
+ setup_foreach_callbacks(&subdiv_context, &foreach_context);
SubdivMeshTLS tls = {0};
foreach_context.user_data = &subdiv_context;
foreach_context.user_data_tls_size = sizeof(SubdivMeshTLS);
foreach_context.user_data_tls = &tls;
- BKE_subdiv_foreach_subdiv_geometry(subdiv,
- &foreach_context,
- settings,
- coarse_mesh);
+ BKE_subdiv_foreach_subdiv_geometry(
+ subdiv, &foreach_context, settings, coarse_mesh);
BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_MESH_GEOMETRY);
Mesh *result = subdiv_context.subdiv_mesh;
// BKE_mesh_validate(result, true, true);
BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_MESH);
- if (subdiv->displacement_evaluator != NULL) {
+ if (!subdiv_context.can_evaluate_normals) {
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
}
+ /* Free used memoty. */
+ subdiv_mesh_context_free(&subdiv_context);
return result;
}
diff --git a/source/blender/blenkernel/intern/subdiv_stats.c b/source/blender/blenkernel/intern/subdiv_stats.c
index a0cd1d909b7..8ea9e90ff75 100644
--- a/source/blender/blenkernel/intern/subdiv_stats.c
+++ b/source/blender/blenkernel/intern/subdiv_stats.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subdiv_stats.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include "BKE_subdiv.h"
@@ -42,6 +36,7 @@ void BKE_subdiv_stats_init(SubdivStats *stats)
stats->evaluator_refine_time = 0.0;
stats->subdiv_to_ccg_time = 0.0;
stats->subdiv_to_ccg_elements_time = 0.0;
+ stats->topology_compare_time = 0.0;
}
void BKE_subdiv_stats_begin(SubdivStats *stats, eSubdivStatsValue value)
@@ -55,6 +50,11 @@ void BKE_subdiv_stats_end(SubdivStats *stats, eSubdivStatsValue value)
PIL_check_seconds_timer() - stats->begin_timestamp_[value];
}
+void BKE_subdiv_stats_reset(SubdivStats *stats, eSubdivStatsValue value)
+{
+ stats->values_[value] = 0.0;
+}
+
void BKE_subdiv_stats_print(const SubdivStats *stats)
{
#define STATS_PRINT_TIME(stats, value, description) \
@@ -87,6 +87,9 @@ void BKE_subdiv_stats_print(const SubdivStats *stats)
STATS_PRINT_TIME(stats,
subdiv_to_ccg_elements_time,
" Elements time");
+ STATS_PRINT_TIME(stats,
+ topology_compare_time,
+ "Topology comparison time");
#undef STATS_PRINT_TIME
}
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index bba3e97cad7..9690e847b38 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/subsurf_ccg.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
@@ -64,7 +56,6 @@
#include "BKE_pbvh.h"
#include "BKE_ccg.h"
#include "BKE_cdderivedmesh.h"
-#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_modifier.h"
@@ -126,7 +117,7 @@ typedef enum {
CCG_CALC_NORMALS = 4,
/* add an extra four bytes for a mask layer */
CCG_ALLOC_MASK = 8,
- CCG_SIMPLE_SUBDIV = 16
+ CCG_SIMPLE_SUBDIV = 16,
} CCGFlags;
static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels,
@@ -2873,17 +2864,20 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
float (*vertCos)[3],
SubsurfFlags flags)
{
- int useSimple = (smd->subdivType == ME_SIMPLE_SUBSURF) ? CCG_SIMPLE_SUBDIV : 0;
- CCGFlags useAging = (smd->flags & eSubsurfModifierFlag_DebugIncr) ? CCG_USE_AGING : 0;
- int useSubsurfUv = (smd->uv_smooth != SUBSURF_UV_SMOOTH_NONE);
- int drawInteriorEdges = !(smd->flags & eSubsurfModifierFlag_ControlEdges);
+ const int useSimple = (smd->subdivType == ME_SIMPLE_SUBSURF) ? CCG_SIMPLE_SUBDIV : 0;
+ const CCGFlags useAging = (smd->flags & eSubsurfModifierFlag_DebugIncr) ? CCG_USE_AGING : 0;
+ const int useSubsurfUv = (smd->uv_smooth != SUBSURF_UV_SMOOTH_NONE);
+ const int drawInteriorEdges = !(smd->flags & eSubsurfModifierFlag_ControlEdges);
+ const bool use_gpu_backend = subsurf_use_gpu_backend(flags);
+ const bool ignore_simplify = (flags & SUBSURF_IGNORE_SIMPLIFY);
CCGDerivedMesh *result;
- bool use_gpu_backend = subsurf_use_gpu_backend(flags);
/* note: editmode calculation can only run once per
* modifier stack evaluation (uses freed cache) [#36299] */
if (flags & SUBSURF_FOR_EDIT_MODE) {
- int levels = (scene != NULL) ? get_render_subsurf_level(&scene->r, smd->levels, false) : smd->levels;
+ int levels = (scene != NULL && !ignore_simplify)
+ ? get_render_subsurf_level(&scene->r, smd->levels, false)
+ : smd->levels;
/* TODO(sergey): Same as emCache below. */
if ((flags & SUBSURF_IN_EDIT_MODE) && smd->mCache) {
@@ -2904,7 +2898,9 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
else if (flags & SUBSURF_USE_RENDER_PARAMS) {
/* Do not use cache in render mode. */
CCGSubSurf *ss;
- int levels = (scene != NULL) ? get_render_subsurf_level(&scene->r, smd->renderLevels, true) : smd->renderLevels;
+ int levels = (scene != NULL && !ignore_simplify)
+ ? get_render_subsurf_level(&scene->r, smd->renderLevels, true)
+ : smd->renderLevels;
if (levels == 0)
return dm;
@@ -2920,7 +2916,9 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
}
else {
int useIncremental = (smd->flags & eSubsurfModifierFlag_Incremental);
- int levels = (scene != NULL) ? get_render_subsurf_level(&scene->r, smd->levels, false) : smd->levels;
+ int levels = (scene != NULL && !ignore_simplify)
+ ? get_render_subsurf_level(&scene->r, smd->levels, false)
+ : smd->levels;
CCGSubSurf *ss;
/* It is quite possible there is a much better place to do this. It
diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c
index 2e48599a113..f3f919d0048 100644
--- a/source/blender/blenkernel/intern/suggestions.c
+++ b/source/blender/blenkernel/intern/suggestions.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Ian Thompson.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/suggestions.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 39388ebeb4f..a340fadc0ea 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/text.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h> /* abort */
@@ -56,7 +48,6 @@
#include "DNA_node_types.h"
#include "DNA_material_types.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_text.h"
@@ -115,7 +106,6 @@
* of the data to allow undo and redo
* to simply check the code at the current
* undo position
- *
*/
@@ -469,7 +459,7 @@ Text *BKE_text_load(Main *bmain, const char *file, const char *relpath)
/**
* Only copy internal data of Text ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -506,7 +496,7 @@ void BKE_text_copy_data(Main *UNUSED(bmain), Text *ta_dst, const Text *ta_src, c
Text *BKE_text_copy(Main *bmain, const Text *ta)
{
Text *ta_copy;
- BKE_id_copy_ex(bmain, &ta->id, (ID **)&ta_copy, 0, false);
+ BKE_id_copy(bmain, &ta->id, (ID **)&ta_copy);
return ta_copy;
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 3d180bd7856..e3ce946c5cf 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/texture.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -57,8 +49,6 @@
#include "BKE_colorband.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_image.h"
#include "BKE_material.h"
#include "BKE_texture.h"
@@ -309,7 +299,6 @@ void BKE_texture_mtex_default(MTex *mtex)
mtex->size[1] = 1.0;
mtex->size[2] = 1.0;
mtex->tex = NULL;
- mtex->texflag = MTEX_3TAP_BUMP | MTEX_BUMP_OBJECTSPACE | MTEX_MAPTO_BOUNDS;
mtex->colormodel = 0;
mtex->r = 1.0;
mtex->g = 0.0;
@@ -422,7 +411,7 @@ MTex *BKE_texture_mtex_add_id(ID *id, int slot)
/**
* Only copy internal data of Texture ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -443,7 +432,7 @@ void BKE_texture_copy_data(Main *bmain, Tex *tex_dst, const Tex *tex_src, const
}
/* Note: nodetree is *not* in bmain, however this specific case is handled at lower level
* (see BKE_libblock_copy_ex()). */
- BKE_id_copy_ex(bmain, (ID *)tex_src->nodetree, (ID **)&tex_dst->nodetree, flag, false);
+ BKE_id_copy_ex(bmain, (ID *)tex_src->nodetree, (ID **)&tex_dst->nodetree, flag);
}
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
@@ -457,7 +446,7 @@ void BKE_texture_copy_data(Main *bmain, Tex *tex_dst, const Tex *tex_src, const
Tex *BKE_texture_copy(Main *bmain, const Tex *tex)
{
Tex *tex_copy;
- BKE_id_copy_ex(bmain, &tex->id, (ID **)&tex_copy, 0, false);
+ BKE_id_copy(bmain, &tex->id, (ID **)&tex_copy);
return tex_copy;
}
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 70f217aa6c2..79102742927 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- * Keir Mierle
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/tracking.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stddef.h>
diff --git a/source/blender/blenkernel/intern/tracking_auto.c b/source/blender/blenkernel/intern/tracking_auto.c
index 1cb474e6202..38124ddf97c 100644
--- a/source/blender/blenkernel/intern/tracking_auto.c
+++ b/source/blender/blenkernel/intern/tracking_auto.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- * Keir Mierle
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/tracking_auto.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
diff --git a/source/blender/blenkernel/intern/tracking_detect.c b/source/blender/blenkernel/intern/tracking_detect.c
index 6df51b5441a..237adc80890 100644
--- a/source/blender/blenkernel/intern/tracking_detect.c
+++ b/source/blender/blenkernel/intern/tracking_detect.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- * Keir Mierle
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/tracking_detect.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* This file contains blender-side implementation of feature detection.
*/
diff --git a/source/blender/blenkernel/intern/tracking_plane_tracker.c b/source/blender/blenkernel/intern/tracking_plane_tracker.c
index 975c7b71978..0ac8763e866 100644
--- a/source/blender/blenkernel/intern/tracking_plane_tracker.c
+++ b/source/blender/blenkernel/intern/tracking_plane_tracker.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- * Keir Mierle
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/tracking_plane_tracker.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* This file contains implementation of plane tracker.
*/
diff --git a/source/blender/blenkernel/intern/tracking_region_tracker.c b/source/blender/blenkernel/intern/tracking_region_tracker.c
index dcc61f409fc..f6e07e8b459 100644
--- a/source/blender/blenkernel/intern/tracking_region_tracker.c
+++ b/source/blender/blenkernel/intern/tracking_region_tracker.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- * Keir Mierle
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/tracking_region_tracker.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* This file contains implementation of blender-side region tracker
* which is used for 2D feature tracking.
diff --git a/source/blender/blenkernel/intern/tracking_solver.c b/source/blender/blenkernel/intern/tracking_solver.c
index a5d35449229..51bd4c3c871 100644
--- a/source/blender/blenkernel/intern/tracking_solver.c
+++ b/source/blender/blenkernel/intern/tracking_solver.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- * Keir Mierle
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/tracking_solver.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* This file contains blender-side implementation of camera solver.
*/
diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c
index aae9985bc24..5e7f2421428 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- * Keir Mierle
- * Ichthyostega
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/tracking_stabilize.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* This file contains implementation of 2D image stabilization.
*/
@@ -1598,7 +1589,7 @@ ImBuf *BKE_tracking_stabilize_frame(MovieClip *clip,
TrackingStabilizeFrameInterpolationData data = {
.ibuf = ibuf, .tmpibuf = tmpibuf, .mat = mat,
- .interpolation = interpolation
+ .interpolation = interpolation,
};
ParallelRangeSettings settings;
diff --git a/source/blender/blenkernel/intern/tracking_util.c b/source/blender/blenkernel/intern/tracking_util.c
index 621e0cc6a2e..f2f3e1d56b5 100644
--- a/source/blender/blenkernel/intern/tracking_util.c
+++ b/source/blender/blenkernel/intern/tracking_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- * Keir Mierle
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/tracking_util.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* This file contains implementation of function which are used
* by multiple tracking files but which should not be public.
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index abc53bf031a..c9d629c4e19 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/undo_system.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* Used by ED_undo.h, internal implementation.
*/
@@ -32,14 +28,12 @@
#include "BLI_sys_types.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
-#include "BLI_sort_utils.h"
#include "DNA_listBase.h"
#include "DNA_windowmanager_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
-#include "BKE_library.h"
#include "BKE_library_override.h"
#include "BKE_main.h"
#include "BKE_undo_system.h"
@@ -54,6 +48,10 @@
/** Make sure all ID's created at the point we add an undo step that uses ID's. */
#define WITH_GLOBAL_UNDO_ENSURE_UPDATED
+/** Make sure we don't apply edits ontop of a newer memfile state, see: T56163.
+ * \note Keep an eye on this, could solve differently. */
+#define WITH_GLOBAL_UNDO_CORRECT_ORDER
+
/** We only need this locally. */
static CLG_LogRef LOG = {"bke.undosys"};
@@ -144,18 +142,22 @@ static void undosys_id_ref_resolve(void *user_data, UndoRefID *id_ref)
}
}
-static bool undosys_step_encode(bContext *C, UndoStep *us)
+static bool undosys_step_encode(bContext *C, Main *bmain, UndoStack *ustack, UndoStep *us)
{
CLOG_INFO(&LOG, 2, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
UNDO_NESTED_CHECK_BEGIN;
- bool ok = us->type->step_encode(C, us);
+ bool ok = us->type->step_encode(C, bmain, us);
UNDO_NESTED_CHECK_END;
if (ok) {
if (us->type->step_foreach_ID_ref != NULL) {
/* Don't use from context yet because sometimes context is fake and not all members are filled in. */
- Main *bmain = G.main;
us->type->step_foreach_ID_ref(us, undosys_id_ref_store, bmain);
}
+#ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
+ if (us->type == BKE_UNDOSYS_TYPE_MEMFILE) {
+ ustack->step_active_memfile = us;
+ }
+#endif
}
if (ok == false) {
CLOG_INFO(&LOG, 2, "encode callback didn't create undo step");
@@ -163,18 +165,43 @@ static bool undosys_step_encode(bContext *C, UndoStep *us)
return ok;
}
-static void undosys_step_decode(bContext *C, UndoStep *us, int dir)
+static void undosys_step_decode(bContext *C, Main *bmain, UndoStack *ustack, UndoStep *us, int dir)
{
CLOG_INFO(&LOG, 2, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
+
if (us->type->step_foreach_ID_ref) {
+#ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
+ if (us->type != BKE_UNDOSYS_TYPE_MEMFILE) {
+ for (UndoStep *us_iter = us->prev; us_iter; us_iter = us_iter->prev) {
+ if (us_iter->type == BKE_UNDOSYS_TYPE_MEMFILE) {
+ if (us_iter == ustack->step_active_memfile) {
+ /* Common case, we're already using the last memfile state. */
+ }
+ else {
+ /* Load the previous memfile state so any ID's referenced in this
+ * undo step will be correctly resolved, see: T56163. */
+ undosys_step_decode(C, bmain, ustack, us_iter, dir);
+ /* May have been freed on memfile read. */
+ bmain = G.main;
+ }
+ break;
+ }
+ }
+ }
+#endif
/* Don't use from context yet because sometimes context is fake and not all members are filled in. */
- Main *bmain = G.main;
us->type->step_foreach_ID_ref(us, undosys_id_ref_resolve, bmain);
}
UNDO_NESTED_CHECK_BEGIN;
- us->type->step_decode(C, us, dir);
+ us->type->step_decode(C, bmain, us, dir);
UNDO_NESTED_CHECK_END;
+
+#ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
+ if (us->type == BKE_UNDOSYS_TYPE_MEMFILE) {
+ ustack->step_active_memfile = us;
+ }
+#endif
}
static void undosys_step_free_and_unlink(UndoStack *ustack, UndoStep *us)
@@ -186,6 +213,12 @@ static void undosys_step_free_and_unlink(UndoStack *ustack, UndoStep *us)
BLI_remlink(&ustack->steps, us);
MEM_freeN(us);
+
+#ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
+ if (ustack->step_active_memfile == us) {
+ ustack->step_active_memfile = NULL;
+ }
+#endif
}
/** \} */
@@ -253,6 +286,35 @@ void BKE_undosys_stack_clear_active(UndoStack *ustack)
}
}
+/* Caller is responsible for handling active. */
+static void undosys_stack_clear_all_last(UndoStack *ustack, UndoStep *us)
+{
+ if (us) {
+ bool is_not_empty = true;
+ UndoStep *us_iter;
+ do {
+ us_iter = ustack->steps.last;
+ BLI_assert(us_iter != ustack->step_active);
+ undosys_step_free_and_unlink(ustack, us_iter);
+ undosys_stack_validate(ustack, is_not_empty);
+ } while ((us != us_iter));
+ }
+}
+
+static void undosys_stack_clear_all_first(UndoStack *ustack, UndoStep *us)
+{
+ if (us) {
+ bool is_not_empty = true;
+ UndoStep *us_iter;
+ do {
+ us_iter = ustack->steps.first;
+ BLI_assert(us_iter != ustack->step_active);
+ undosys_step_free_and_unlink(ustack, us_iter);
+ undosys_stack_validate(ustack, is_not_empty);
+ } while ((us != us_iter));
+ }
+}
+
static bool undosys_stack_push_main(UndoStack *ustack, const char *name, struct Main *bmain)
{
UNDO_NESTED_ASSERT(false);
@@ -275,7 +337,7 @@ void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain)
void BKE_undosys_stack_init_from_context(UndoStack *ustack, bContext *C)
{
const UndoType *ut = BKE_undosys_type_from_context(C);
- if ((ut != NULL) && (ut != BKE_UNDOSYS_TYPE_MEMFILE) && (ut->mode == BKE_UNDOTYPE_MODE_STORE)) {
+ if ((ut != NULL) && (ut != BKE_UNDOSYS_TYPE_MEMFILE)) {
BKE_undosys_step_push_with_type(ustack, C, "original mode", ut);
}
}
@@ -364,11 +426,7 @@ void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size
}
#endif
/* Free from first to last, free functions may update de-duplication info (see #MemFileUndoStep). */
- while (ustack->steps.first != us) {
- UndoStep *us_first = ustack->steps.first;
- BLI_assert(us_first != ustack->step_active);
- undosys_step_free_and_unlink(ustack, us_first);
- }
+ undosys_stack_clear_all_first(ustack, us->prev);
#ifdef WITH_GLOBAL_UNDO_KEEP_ONE
if (us_exclude) {
@@ -387,6 +445,11 @@ UndoStep *BKE_undosys_step_push_init_with_type(UndoStack *ustack, bContext *C, c
BLI_assert(ustack->step_init == NULL);
if (ut->step_encode_init) {
undosys_stack_validate(ustack, false);
+
+ if (ustack->step_active) {
+ undosys_stack_clear_all_last(ustack, ustack->step_active->next);
+ }
+
UndoStep *us = MEM_callocN(ut->step_size, __func__);
CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, name, ut->name);
if (name != NULL) {
@@ -443,43 +506,62 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack, bContext *C, const char
#ifdef WITH_GLOBAL_UNDO_ENSURE_UPDATED
if (ut->step_foreach_ID_ref != NULL) {
- Main *bmain = G.main;
- if (bmain->is_memfile_undo_written == false) {
- const char *name_internal = "MemFile Internal";
+ if (G_MAIN->is_memfile_undo_written == false) {
+ const char *name_internal = "MemFile Internal (pre)";
/* Don't let 'step_init' cause issues when adding memfile undo step. */
void *step_init = ustack->step_init;
ustack->step_init = NULL;
- const bool ok = undosys_stack_push_main(ustack, name_internal, bmain);
+ const bool ok = undosys_stack_push_main(ustack, name_internal, G_MAIN);
/* Restore 'step_init'. */
ustack->step_init = step_init;
if (ok) {
UndoStep *us = ustack->steps.last;
BLI_assert(STREQ(us->name, name_internal));
us->skip = true;
+#ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
+ ustack->step_active_memfile = us;
+#endif
}
}
}
#endif
- UndoStep *us = ustack->step_init ? ustack->step_init : MEM_callocN(ut->step_size, __func__);
- ustack->step_init = NULL;
- if (us->name[0] == '\0') {
- BLI_strncpy(us->name, name, sizeof(us->name));
- }
- us->type = ut;
- /* initialized, not added yet. */
+ bool use_memfile_step = false;
+ {
+ UndoStep *us = ustack->step_init ? ustack->step_init : MEM_callocN(ut->step_size, __func__);
+ ustack->step_init = NULL;
+ if (us->name[0] == '\0') {
+ BLI_strncpy(us->name, name, sizeof(us->name));
+ }
+ us->type = ut;
+ /* initialized, not added yet. */
- if (undosys_step_encode(C, us)) {
+ if (!undosys_step_encode(C, G_MAIN, ustack, us)) {
+ MEM_freeN(us);
+ undosys_stack_validate(ustack, true);
+ return false;
+ }
ustack->step_active = us;
BLI_addtail(&ustack->steps, us);
- undosys_stack_validate(ustack, true);
- return true;
- }
- else {
- MEM_freeN(us);
- undosys_stack_validate(ustack, true);
- return false;
+ use_memfile_step = us->use_memfile_step;
+ }
+
+ if (use_memfile_step) {
+ const char *name_internal = "MemFile Internal (post)";
+ const bool ok = undosys_stack_push_main(ustack, name_internal, G_MAIN);
+ if (ok) {
+ UndoStep *us = ustack->steps.last;
+ BLI_assert(STREQ(us->name, name_internal));
+ us->skip = true;
+#ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
+ ustack->step_active_memfile = us;
+#endif
+ ustack->step_active = us;
+ }
}
+
+ undosys_stack_validate(ustack, true);
+ return true;
}
bool BKE_undosys_step_push(UndoStack *ustack, bContext *C, const char *name)
@@ -563,14 +645,29 @@ bool BKE_undosys_step_undo_with_data_ex(
undosys_stack_validate(ustack, true);
}
UndoStep *us_prev = us ? us->prev : NULL;
- if (us && us->type->mode == BKE_UNDOTYPE_MODE_STORE) {
+ if (us) {
/* The current state is a copy, we need to load the previous state. */
us = us_prev;
}
if (us != NULL) {
CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
- undosys_step_decode(C, us, -1);
+
+ /* Handle accumulate steps. */
+ if (ustack->step_active) {
+ UndoStep *us_iter = ustack->step_active;
+ while (us_iter != us) {
+ /* TODO:
+ * - skip successive steps that store the same data, eg: memfile steps.
+ * - or steps that include another steps data, eg: a memfile step includes text undo data.
+ */
+ undosys_step_decode(C, G_MAIN, ustack, us_iter, -1);
+ us_iter = us_iter->prev;
+ }
+ }
+
+ undosys_step_decode(C, G_MAIN, ustack, us, -1);
+
ustack->step_active = us_prev;
undosys_stack_validate(ustack, true);
if (use_skip) {
@@ -611,7 +708,17 @@ bool BKE_undosys_step_redo_with_data_ex(
if (us != NULL) {
CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
- undosys_step_decode(C, us, 1);
+
+ /* Handle accumulate steps. */
+ if (ustack->step_active && ustack->step_active->next) {
+ UndoStep *us_iter = ustack->step_active->next;
+ while (us_iter != us) {
+ undosys_step_decode(C, G_MAIN, ustack, us_iter, 1);
+ us_iter = us_iter->next;
+ }
+ }
+
+ undosys_step_decode(C, G_MAIN, ustack, us, 1);
ustack->step_active = us_next;
if (use_skip) {
if (ustack->step_active && ustack->step_active->skip) {
@@ -661,18 +768,6 @@ bool BKE_undosys_step_load_data(UndoStack *ustack, bContext *C, UndoStep *us)
return ok;
}
-bool BKE_undosys_step_undo_compat_only(UndoStack *ustack, bContext *C, int step)
-{
- if (step == 0) {
- return BKE_undosys_step_undo_with_data(ustack, C, ustack->step_active);
- }
- else if (step == 1) {
- return BKE_undosys_step_undo(ustack, C);
- }
- else {
- return BKE_undosys_step_redo(ustack, C);
- }
-}
/**
* Similar to #WM_operatortype_append
*/
@@ -684,8 +779,6 @@ UndoType *BKE_undosys_type_append(void (*undosys_fn)(UndoType *))
undosys_fn(ut);
- BLI_assert(ut->mode != 0);
-
BLI_addtail(&g_undo_types, ut);
return ut;
@@ -707,6 +800,10 @@ void BKE_undosys_type_free_all(void)
* Unfortunately we need this for a handful of places.
*/
+/* Disable for now since it accesses freed memory.
+ * The pointer can only be a key, we can't read it's contents. */
+#define USE_LIB_SKIP
+
static void UNUSED_FUNCTION(BKE_undosys_foreach_ID_ref(
UndoStack *ustack, UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data))
{
@@ -813,9 +910,11 @@ void BKE_undosys_ID_map_destroy(UndoIDPtrMap *idpmap)
void BKE_undosys_ID_map_add(UndoIDPtrMap *map, ID *id)
{
uint index;
+#ifdef USE_LIB_SKIP
if (id->lib != NULL) {
return;
}
+#endif
if (undosys_ID_map_lookup_index(map, id, &index)) {
return; /* exists. */
@@ -875,7 +974,11 @@ ID *BKE_undosys_ID_map_lookup_with_prev(const UndoIDPtrMap *map, ID *id_src, ID
return id_prev_match[1];
}
else {
+#ifdef USE_LIB_SKIP
+ ID *id_dst = BKE_undosys_ID_map_lookup(map, id_src);
+#else
ID *id_dst = (id_src->lib == NULL) ? BKE_undosys_ID_map_lookup(map, id_src) : id_src;
+#endif
id_prev_match[0] = id_src;
id_prev_match[1] = id_dst;
return id_dst;
@@ -883,3 +986,28 @@ ID *BKE_undosys_ID_map_lookup_with_prev(const UndoIDPtrMap *map, ID *id_src, ID
}
/** \} */
+
+
+/* -------------------------------------------------------------------- */
+/** \name Debug Helpers
+ * \{ */
+
+void BKE_undosys_print(UndoStack *ustack)
+{
+ printf("Undo %d Steps (*: active, #=applied, M=memfile-active, S=skip)\n",
+ BLI_listbase_count(&ustack->steps));
+ int index = 0;
+ for (UndoStep *us = ustack->steps.first; us; us = us->next) {
+ printf("[%c%c%c%c] %3d type='%s', name='%s'\n",
+ (us == ustack->step_active) ? '*' : ' ',
+ us->is_applied ? '#' : ' ',
+ (us == ustack->step_active_memfile) ? 'M' : ' ',
+ us->skip ? 'S' : ' ',
+ index,
+ us->type->name,
+ us->name);
+ index++;
+ }
+}
+
+/** \} */
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 5527cb5d39a..2d2db5fea1e 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/blenkernel/intern/unit.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#include <stdlib.h>
@@ -86,29 +80,44 @@
/* define a single unit */
typedef struct bUnitDef {
const char *name;
- const char *name_plural; /* abused a bit for the display name */
- const char *name_short; /* this is used for display*/
- const char *name_alt; /* keyboard-friendly ASCII-only version of name_short, can be NULL */
+ /** abused a bit for the display name */
+ const char *name_plural;
+ /** this is used for display*/
+ const char *name_short;
+ /** keyboard-friendly ASCII-only version of name_short, can be NULL */
+ const char *name_alt;
/* if name_short has non-ASCII chars, name_alt should be present */
- const char *name_display; /* can be NULL */
- const char *identifier; /* when NULL, a transformed version of the name will be taken */
+ /** can be NULL */
+ const char *name_display;
+ /** when NULL, a transformed version of the name will be taken */
+ const char *identifier;
double scalar;
- double bias; /* not used yet, needed for converting temperature */
+ /** not used yet, needed for converting temperature */
+ double bias;
int flag;
} bUnitDef;
-#define B_UNIT_DEF_NONE 0
-#define B_UNIT_DEF_SUPPRESS 1 /* Use for units that are not used enough to be translated into for common use */
-#define B_UNIT_DEF_TENTH 2 /* Display a unit even if its value is 0.1, eg 0.1mm instead of 100um */
+enum {
+ B_UNIT_DEF_NONE = 0,
+ /** Use for units that are not used enough to be translated into for common use */
+ B_UNIT_DEF_SUPPRESS = 1,
+ /** Display a unit even if its value is 0.1, eg 0.1mm instead of 100um */
+ B_UNIT_DEF_TENTH = 2,
+ /** Short unit name is case sensitive, for example to distinguish mW and MW */
+ B_UNIT_DEF_CASE_SENSITIVE = 4,
+};
/* define a single unit */
typedef struct bUnitCollection {
const struct bUnitDef *units;
- int base_unit; /* basic unit index (when user doesn't specify unit explicitly) */
- int flag; /* options for this system */
- int length; /* to quickly find the last item */
+ /** basic unit index (when user doesn't specify unit explicitly) */
+ int base_unit;
+ /** options for this system */
+ int flag;
+ /** to quickly find the last item */
+ int length;
} bUnitCollection;
#define UNIT_COLLECTION_LENGTH(def) (sizeof(def) / sizeof(bUnitDef) - 1)
@@ -135,7 +144,7 @@ static struct bUnitDef buMetricLenDef[] = {
{"nanometer", "Nanometers", "nm", NULL, 0.000000001, 0.0, B_UNIT_DEF_NONE},
{"picometer", "Picometers", "pm", NULL, 0.000000000001, 0.0, B_UNIT_DEF_NONE},
#endif
- NULL_UNIT
+ NULL_UNIT,
};
static const struct bUnitCollection buMetricLenCollection = {buMetricLenDef, 3, 0, UNIT_COLLECTION_LENGTH(buMetricLenDef)};
@@ -147,7 +156,7 @@ static struct bUnitDef buImperialLenDef[] = {
{"foot", "feet", "'", "ft", "Feet", "FEET", UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"inch", "inches", "\"", "in", "Inches", "INCHES", UN_SC_IN, 0.0, B_UNIT_DEF_NONE},
{"thou", "thou", "thou", "mil", "Thou", "THOU", UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, /* plural for thou has no 's' */
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buImperialLenCollection = {buImperialLenDef, 4, 0, UNIT_COLLECTION_LENGTH(buImperialLenDef)};
@@ -161,7 +170,7 @@ static struct bUnitDef buMetricAreaDef[] = {
{"square centimeter", "square centimeters", "cm²", "cm2", "Square Centimeters", NULL, UN_SC_CM * UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
{"square millimeter", "square millimeters", "mm²", "mm2", "Square Millimeters", NULL, UN_SC_MM * UN_SC_MM, 0.0, B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
{"square micrometer", "square micrometers", "µm²", "um2", "Square Micrometers", NULL, UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buMetricAreaCollection = {buMetricAreaDef, 3, 0, UNIT_COLLECTION_LENGTH(buMetricAreaDef)};
@@ -172,8 +181,8 @@ static struct bUnitDef buImperialAreaDef[] = {
{"square yard", "square yards", "sq yd", NULL, "Square Yards", NULL, UN_SC_YD * UN_SC_YD, 0.0, B_UNIT_DEF_NONE},
{"square foot", "square feet", "sq ft", NULL, "Square Feet", NULL, UN_SC_FT * UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"square inch", "square inches", "sq in", NULL, "Square Inches", NULL, UN_SC_IN * UN_SC_IN, 0.0, B_UNIT_DEF_NONE},
- {"square thou", "square thous", "sq mil", NULL, "Square Thous", NULL, UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE},
- NULL_UNIT
+ {"square thou", "square thou", "sq mil", NULL, "Square Thou", NULL, UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE},
+ NULL_UNIT,
};
static struct bUnitCollection buImperialAreaCollection = {buImperialAreaDef, 4, 0, UNIT_COLLECTION_LENGTH(buImperialAreaDef)};
@@ -187,7 +196,7 @@ static struct bUnitDef buMetricVolDef[] = {
{"cubic centimeter", "cubic centimeters", "cm³", "cm3", "Cubic Centimeters", NULL, UN_SC_CM * UN_SC_CM * UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
{"cubic millimeter", "cubic millimeters", "mm³", "mm3", "Cubic Millimeters", NULL, UN_SC_MM * UN_SC_MM * UN_SC_MM, 0.0, B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
{"cubic micrometer", "cubic micrometers", "µm³", "um3", "Cubic Micrometers", NULL, UN_SC_UM * UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buMetricVolCollection = {buMetricVolDef, 3, 0, UNIT_COLLECTION_LENGTH(buMetricVolDef)};
@@ -198,8 +207,8 @@ static struct bUnitDef buImperialVolDef[] = {
{"cubic yard", "cubic yards", "cu yd", NULL, "Cubic Yards", NULL, UN_SC_YD * UN_SC_YD * UN_SC_YD, 0.0, B_UNIT_DEF_NONE},
{"cubic foot", "cubic feet", "cu ft", NULL, "Cubic Feet", NULL, UN_SC_FT * UN_SC_FT * UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"cubic inch", "cubic inches", "cu in", NULL, "Cubic Inches", NULL, UN_SC_IN * UN_SC_IN * UN_SC_IN, 0.0, B_UNIT_DEF_NONE},
- {"cubic thou", "cubic thous", "cu mil", NULL, "Cubic Thous", NULL, UN_SC_MIL * UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE},
- NULL_UNIT
+ {"cubic thou", "cubic thou", "cu mil", NULL, "Cubic Thou", NULL, UN_SC_MIL * UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE},
+ NULL_UNIT,
};
static struct bUnitCollection buImperialVolCollection = {buImperialVolDef, 4, 0, UNIT_COLLECTION_LENGTH(buImperialVolDef)};
@@ -212,7 +221,7 @@ static struct bUnitDef buMetricMassDef[] = {
{"dekagram", "dekagrams", "dag", NULL, "10 Grams", "DEKAGRAMS", UN_SC_DAG, 0.0, B_UNIT_DEF_SUPPRESS},
{"gram", "grams", "g", NULL, "Grams", "GRAMS", UN_SC_G, 0.0, B_UNIT_DEF_NONE},
{"milligram", "milligrams", "mg", NULL, "Milligrams", "MILLIGRAMS", UN_SC_MG, 0.0, B_UNIT_DEF_NONE},
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buMetricMassCollection = {buMetricMassDef, 2, 0, UNIT_COLLECTION_LENGTH(buMetricMassDef)};
@@ -222,7 +231,7 @@ static struct bUnitDef buImperialMassDef[] = {
{"stone", "stones", "st", NULL, "Stones", "STONES", UN_SC_ST, 0.0, B_UNIT_DEF_NONE},
{"pound", "pounds", "lb", NULL, "Pounds", "POUNDS", UN_SC_LB, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"ounce", "ounces", "oz", NULL, "Ounces", "OUNCES", UN_SC_OZ, 0.0, B_UNIT_DEF_NONE},
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buImperialMassCollection = {buImperialMassDef, 3, 0, UNIT_COLLECTION_LENGTH(buImperialMassDef)};
@@ -233,27 +242,27 @@ static struct bUnitCollection buImperialMassCollection = {buImperialMassDef, 3,
static struct bUnitDef buMetricVelDef[] = {
{"meter per second", "meters per second", "m/s", NULL, "Meters per second", NULL, UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"kilometer per hour", "kilometers per hour", "km/h", NULL, "Kilometers per hour", NULL, UN_SC_KM / 3600.0f, 0.0, B_UNIT_DEF_SUPPRESS},
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buMetricVelCollection = {buMetricVelDef, 0, 0, UNIT_COLLECTION_LENGTH(buMetricVelDef)};
static struct bUnitDef buImperialVelDef[] = {
{"foot per second", "feet per second", "ft/s", "fps", "Feet per second", NULL, UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"mile per hour", "miles per hour", "mph", NULL, "Miles per hour", NULL, UN_SC_MI / 3600.0f, 0.0, B_UNIT_DEF_SUPPRESS},
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buImperialVelCollection = {buImperialVelDef, 0, 0, UNIT_COLLECTION_LENGTH(buImperialVelDef)};
/* Acceleration */
static struct bUnitDef buMetricAclDef[] = {
{"meter per second squared", "meters per second squared", "m/s²", "m/s2", "Meters per second squared", NULL, UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buMetricAclCollection = {buMetricAclDef, 0, 0, UNIT_COLLECTION_LENGTH(buMetricAclDef)};
static struct bUnitDef buImperialAclDef[] = {
{"foot per second squared", "feet per second squared", "ft/s²", "ft/s2", "Feet per second squared", NULL, UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buImperialAclCollection = {buImperialAclDef, 0, 0, UNIT_COLLECTION_LENGTH(buImperialAclDef)};
@@ -266,7 +275,7 @@ static struct bUnitDef buNaturalTimeDef[] = {
{"second", "seconds", "sec", "s", "Seconds", "SECONDS", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"millisecond", "milliseconds", "ms", NULL, "Milliseconds", "MILLISECONDS", 0.001, 0.0, B_UNIT_DEF_NONE},
{"microsecond", "microseconds", "µs", "us", "Microseconds", "MICROSECONDS", 0.000001, 0.0, B_UNIT_DEF_NONE},
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buNaturalTimeCollection = {buNaturalTimeDef, 3, 0, UNIT_COLLECTION_LENGTH(buNaturalTimeDef)};
@@ -278,7 +287,7 @@ static struct bUnitDef buNaturalRotDef[] = {
{"arcsecond", "arcseconds", "\"", NULL, "Arcseconds", "ARCSECONDS", (M_PI / 180.0) / 3600.0, 0.0, B_UNIT_DEF_SUPPRESS},
{"radian", "radians", "r", NULL, "Radians", "RADIANS", 1.0, 0.0, B_UNIT_DEF_NONE},
// {"turn", "turns", "t", NULL, "Turns", NULL, 1.0 / (M_PI * 2.0), 0.0, B_UNIT_DEF_NONE},
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buNaturalRotCollection = {buNaturalRotDef, 0, 0, UNIT_COLLECTION_LENGTH(buNaturalRotDef)};
@@ -289,17 +298,30 @@ static struct bUnitDef buCameraLenDef[] = {
{"centimeter", "centimeters", "cm", NULL, "Centimeters", NULL, UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},
{"millimeter", "millimeters", "mm", NULL, "Millimeters", NULL, UN_SC_M, 0.0, B_UNIT_DEF_NONE},
{"micrometer", "micrometers", "µm", "um", "Micrometers", NULL, UN_SC_MM, 0.0, B_UNIT_DEF_SUPPRESS},
- NULL_UNIT
+ NULL_UNIT,
};
static struct bUnitCollection buCameraLenCollection = {buCameraLenDef, 3, 0, UNIT_COLLECTION_LENGTH(buCameraLenDef)};
+/* (Light) Power */
+static struct bUnitDef buPowerDef[] = {
+ {"gigawatt", "gigawatts", "GW", NULL, "Gigawatts", NULL, 1e9f, 0.0, B_UNIT_DEF_NONE},
+ {"megawatt", "megawatts", "MW", NULL, "Megawatts", NULL, 1e6f, 0.0, B_UNIT_DEF_CASE_SENSITIVE},
+ {"kilowatt", "kilowatts", "kW", NULL, "Kilowatts", NULL, 1e3f, 0.0, B_UNIT_DEF_SUPPRESS},
+ {"watt", "watts", "W", NULL, "Watts", NULL, 1.0f, 0.0, B_UNIT_DEF_NONE}, /* base unit */
+ {"milliwatt", "milliwatts", "mW", NULL, "Milliwatts", NULL, 1e-3f, 0.0, B_UNIT_DEF_CASE_SENSITIVE},
+ {"microwatt", "microwatts", "µW", "uW", "Microwatts", NULL, 1e-6f, 0.0, B_UNIT_DEF_NONE},
+ {"nanowatt", "nanowatts", "nW", NULL, "Nanowatts", NULL, 1e-9f, 0.0, B_UNIT_DEF_NONE},
+ NULL_UNIT,
+};
+static struct bUnitCollection buPowerCollection = {buPowerDef, 3, 0, UNIT_COLLECTION_LENGTH(buPowerDef)};
+
#define UNIT_SYSTEM_TOT (((sizeof(bUnitSystems) / B_UNIT_TYPE_TOT) / sizeof(void *)) - 1)
static const struct bUnitCollection *bUnitSystems[][B_UNIT_TYPE_TOT] = {
- {NULL, NULL, NULL, NULL, NULL, &buNaturalRotCollection, &buNaturalTimeCollection, NULL, NULL, NULL},
- {NULL, &buMetricLenCollection, &buMetricAreaCollection, &buMetricVolCollection, &buMetricMassCollection, &buNaturalRotCollection, &buNaturalTimeCollection, &buMetricVelCollection, &buMetricAclCollection, &buCameraLenCollection}, /* metric */
- {NULL, &buImperialLenCollection, &buImperialAreaCollection, &buImperialVolCollection, &buImperialMassCollection, &buNaturalRotCollection, &buNaturalTimeCollection, &buImperialVelCollection, &buImperialAclCollection, &buCameraLenCollection}, /* imperial */
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
+ {NULL, NULL, NULL, NULL, NULL, &buNaturalRotCollection, &buNaturalTimeCollection, NULL, NULL, NULL, NULL},
+ {NULL, &buMetricLenCollection, &buMetricAreaCollection, &buMetricVolCollection, &buMetricMassCollection, &buNaturalRotCollection, &buNaturalTimeCollection, &buMetricVelCollection, &buMetricAclCollection, &buCameraLenCollection, &buPowerCollection}, /* metric */
+ {NULL, &buImperialLenCollection, &buImperialAreaCollection, &buImperialVolCollection, &buImperialMassCollection, &buNaturalRotCollection, &buNaturalTimeCollection, &buImperialVelCollection, &buImperialAclCollection, &buCameraLenCollection, &buPowerCollection}, /* imperial */
+ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
};
@@ -484,7 +506,7 @@ static bool is_valid_unit_collection(const bUnitCollection *usys)
return usys != NULL && usys->units[0].name != NULL;
}
-static const bUnitDef *get_preferred_unit_if_used(int type, PreferredUnits units)
+static const bUnitDef *get_preferred_display_unit_if_used(int type, PreferredUnits units)
{
const bUnitCollection *usys = unit_get_system(units.system, type);
if (!is_valid_unit_collection(usys)) return NULL;
@@ -525,7 +547,7 @@ static size_t unit_as_string_main(
usys = &buDummyCollection;
}
else {
- main_unit = get_preferred_unit_if_used(type, units);
+ main_unit = get_preferred_display_unit_if_used(type, units);
}
if (split && unit_should_be_split(type)) {
@@ -560,11 +582,16 @@ BLI_INLINE bool isalpha_or_utf8(const int ch)
return (ch >= 128 || isalpha(ch));
}
-static const char *unit_find_str(const char *str, const char *substr)
+static const char *unit_find_str(const char *str, const char *substr, bool case_sensitive)
{
if (substr && substr[0] != '\0') {
while (true) {
- const char *str_found = strstr(str, substr);
+ /* Unit detection is case insensitive. */
+ const char *str_found;
+ if (case_sensitive)
+ str_found = strstr(str, substr);
+ else
+ str_found = BLI_strcasestr(str, substr);
if (str_found) {
/* Previous char cannot be a letter. */
@@ -595,10 +622,9 @@ static const char *unit_find_str(const char *str, const char *substr)
/* Note that numbers are added within brackets
* ") " - is used to detect numbers we added so we can detect if commas need to be added
*
- * "1m1cm+2mm" - Original value
- * "1*1#1*0.01#+2*0.001#" - Replace numbers
- * "1*1+1*0.01 +2*0.001 " - Add add signs if ( + - * / | & ~ < > ^ ! = % ) not found in between
- *
+ * "1m1cm+2mm" - Original value
+ * "1*1#1*0.01#+2*0.001#" - Replace numbers
+ * "1*1+1*0.01 +2*0.001 " - Add add signs if ( + - * / | & ~ < > ^ ! = % ) not found in between
*/
/* not too strict, (+ - * /) are most common */
@@ -625,11 +651,11 @@ static bool ch_is_op(char op)
}
static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pref, const bUnitDef *unit,
- const char *replace_str)
+ const char *replace_str, bool case_sensitive)
{
char *str_found;
- if ((len_max > 0) && (str_found = (char *)unit_find_str(str, replace_str))) {
+ if ((len_max > 0) && (str_found = (char *)unit_find_str(str, replace_str, case_sensitive))) {
/* XXX - investigate, does not respect len_max properly */
int len, len_num, len_name, len_move, found_ofs;
@@ -675,20 +701,22 @@ static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pr
static int unit_replace(char *str, int len_max, char *str_tmp, double scale_pref, const bUnitDef *unit)
{
+ const bool case_sensitive = (unit->flag & B_UNIT_DEF_CASE_SENSITIVE) != 0;
int ofs = 0;
- ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name_short);
- ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name_plural);
- ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name_alt);
- ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name);
+ ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name_short, case_sensitive);
+ ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name_plural, false);
+ ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name_alt, case_sensitive);
+ ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name, false);
return ofs;
}
static bool unit_find(const char *str, const bUnitDef *unit)
{
- if (unit_find_str(str, unit->name_short)) return true;
- if (unit_find_str(str, unit->name_plural)) return true;
- if (unit_find_str(str, unit->name_alt)) return true;
- if (unit_find_str(str, unit->name)) return true;
+ const bool case_sensitive = (unit->flag & B_UNIT_DEF_CASE_SENSITIVE) != 0;
+ if (unit_find_str(str, unit->name_short, case_sensitive)) return true;
+ if (unit_find_str(str, unit->name_plural, false)) return true;
+ if (unit_find_str(str, unit->name_alt, case_sensitive)) return true;
+ if (unit_find_str(str, unit->name, false)) return true;
return false;
}
@@ -721,25 +749,27 @@ static const bUnitDef *unit_detect_from_str(const bUnitCollection *usys, const c
return unit;
}
-bool bUnit_ContainsUnit(const char *str, int system, int type)
+bool bUnit_ContainsUnit(const char *str, int type)
{
- const bUnitCollection *usys = unit_get_system(system, type);
- if (!is_valid_unit_collection(usys)) return false;
+ for (int system = 0; system < UNIT_SYSTEM_TOT; system++) {
+ const bUnitCollection *usys = unit_get_system(system, type);
+ if (!is_valid_unit_collection(usys)) continue;
- for (int i = 0; i < usys->length; i++) {
- if (unit_find(str, usys->units + i)) {
- return true;
+ for (int i = 0; i < usys->length; i++) {
+ if (unit_find(str, usys->units + i)) {
+ return true;
+ }
}
}
return false;
}
-double bUnit_PreferredUnitScalar(const struct UnitSettings *settings, int type)
+double bUnit_PreferredInputUnitScalar(const struct UnitSettings *settings, int type)
{
PreferredUnits units = preferred_units_from_UnitSettings(settings);
- const bUnitDef *unit = get_preferred_unit_if_used(type, units);
- if (unit == NULL) return 1.0;
- else return unit->scalar;
+ const bUnitDef *unit = get_preferred_display_unit_if_used(type, units);
+ if (unit) return unit->scalar;
+ else return bUnit_BaseScalar(units.system, type);
}
/* make a copy of the string that replaces the units with numbers
@@ -767,9 +797,6 @@ bool bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sc
char str_tmp[TEMP_STR_SIZE];
bool changed = false;
- /* make lowercase */
- BLI_str_tolower_ascii(str, len_max);
-
/* Try to find a default unit from current or previous string. */
default_unit = unit_detect_from_str(usys, str, str_prev);
@@ -857,7 +884,8 @@ void bUnit_ToUnitAltName(char *str, int len_max, const char *orig_str, int syste
/* find and substitute all units */
for (unit = usys->units; unit->name; unit++) {
if (len_max > 0 && unit->name_alt) {
- const char *found = unit_find_str(orig_str, unit->name_short);
+ const bool case_sensitive = (unit->flag & B_UNIT_DEF_CASE_SENSITIVE) != 0;
+ const char *found = unit_find_str(orig_str, unit->name_short, case_sensitive);
if (found) {
int offset = (int)(found - orig_str);
int len_name = 0;
@@ -905,7 +933,8 @@ double bUnit_ClosestScalar(double value, int system, int type)
double bUnit_BaseScalar(int system, int type)
{
const bUnitCollection *usys = unit_get_system(system, type);
- return unit_default(usys)->scalar;
+ if (usys) return unit_default(usys)->scalar;
+ else return 1.0;
}
/* external access */
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 0b1f9d8bd24..c2bded42bc1 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/workspace.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
/* allow accessing private members of DNA_workspace_types.h */
@@ -30,16 +26,13 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
-#include "BLI_string_utf8.h"
#include "BLI_string_utils.h"
#include "BLI_listbase.h"
-#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_scene.h"
-#include "BKE_screen.h"
#include "BKE_object.h"
#include "BKE_workspace.h"
@@ -150,7 +143,7 @@ WorkSpace *BKE_workspace_add(Main *bmain, const char *name)
/**
* The function that actually frees the workspace data (not workspace itself). It shouldn't be called
- * directly, instead #BKE_workspace_remove should be, which calls this through #BKE_libblock_free then.
+ * directly, instead #BKE_workspace_remove should be, which calls this through #BKE_id_free then.
*
* Should something like a bke_internal.h be added, this should go there!
*/
@@ -173,7 +166,7 @@ void BKE_workspace_free(WorkSpace *workspace)
/**
* Remove \a workspace by freeing itself and its data. This is a higher-level wrapper that
- * calls #BKE_workspace_free (through #BKE_libblock_free) to free the workspace data, and frees
+ * calls #BKE_workspace_free (through #BKE_id_free) to free the workspace data, and frees
* other data-blocks owned by \a workspace and its layouts (currently that is screens only).
*
* Always use this to remove (and free) workspaces. Don't free non-ID workspace members here.
@@ -184,7 +177,7 @@ void BKE_workspace_remove(Main *bmain, WorkSpace *workspace)
layout_next = layout->next;
BKE_workspace_layout_remove(bmain, workspace, layout);
}
- BKE_libblock_free(bmain, workspace);
+ BKE_id_free(bmain, workspace);
}
WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const Main *bmain)
@@ -247,7 +240,7 @@ void BKE_workspace_layout_remove(
WorkSpace *workspace, WorkSpaceLayout *layout)
{
id_us_min(&layout->screen->id);
- BKE_libblock_free(bmain, layout->screen);
+ BKE_id_free(bmain, layout->screen);
BLI_freelinkN(&workspace->layouts, layout);
}
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 319bc3532c2..4cc6ae190e0 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/world.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -44,11 +36,8 @@
#include "BLI_listbase.h"
#include "BKE_animsys.h"
-#include "BKE_global.h"
#include "BKE_icons.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_world.h"
@@ -108,7 +97,7 @@ World *BKE_world_add(Main *bmain, const char *name)
/**
* Only copy internal data of World ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -119,7 +108,7 @@ void BKE_world_copy_data(Main *bmain, World *wrld_dst, const World *wrld_src, co
if (wrld_src->nodetree) {
/* Note: nodetree is *not* in bmain, however this specific case is handled at lower level
* (see BKE_libblock_copy_ex()). */
- BKE_id_copy_ex(bmain, (ID *)wrld_src->nodetree, (ID **)&wrld_dst->nodetree, flag, false);
+ BKE_id_copy_ex(bmain, (ID *)wrld_src->nodetree, (ID **)&wrld_dst->nodetree, flag);
}
BLI_listbase_clear(&wrld_dst->gpumaterial);
@@ -136,7 +125,7 @@ void BKE_world_copy_data(Main *bmain, World *wrld_dst, const World *wrld_src, co
World *BKE_world_copy(Main *bmain, const World *wrld)
{
World *wrld_copy;
- BKE_id_copy_ex(bmain, &wrld->id, (ID **)&wrld_copy, 0, false);
+ BKE_id_copy(bmain, &wrld->id, (ID **)&wrld_copy);
return wrld_copy;
}
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index a1732b79ea3..f46ca79bef7 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robert Wenzlaff
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Functions for writing avi-format files.
* Added interface for generic movie support (ton)
*/
-/** \file blender/blenkernel/intern/writeavi.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -39,13 +30,14 @@
#include "DNA_scene_types.h"
-#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
#include "BKE_report.h"
+#ifdef WITH_AVI
+# include "BLI_blenlib.h"
+
+# include "BKE_main.h"
+#endif
#include "BKE_writeavi.h"
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 27c26a93bf5..982ee3ec01b 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,11 @@
* 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):
- *
* Partial Copyright (c) 2006 Peter Schlaile
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/intern/writeffmpeg.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifdef WITH_FFMPEG
diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h
index 0ab48b5ef2c..522f2374918 100644
--- a/source/blender/blenkernel/nla_private.h
+++ b/source/blender/blenkernel/nla_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/nla_private.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -36,6 +28,8 @@
struct Depsgraph;
#include "RNA_types.h"
+#include "BLI_bitmap.h"
+#include "BLI_ghash.h"
/* --------------- NLA Evaluation DataTypes ----------------------- */
@@ -64,21 +58,91 @@ enum eNlaEvalStrip_StripMode {
NES_TIME_TRANSITION_END,
};
+struct NlaEvalChannel;
+struct NlaEvalData;
+
+/* Unique channel key for GHash. */
+typedef struct NlaEvalChannelKey {
+ struct PointerRNA ptr;
+ struct PropertyRNA *prop;
+} NlaEvalChannelKey;
+
+/* Bitmask of array indices touched by actions. */
+typedef struct NlaValidMask {
+ BLI_bitmap *ptr;
+ BLI_bitmap buffer[sizeof(uint64_t) / sizeof(BLI_bitmap)];
+} NlaValidMask;
+
+/* Set of property values for blending. */
+typedef struct NlaEvalChannelSnapshot {
+ struct NlaEvalChannel *channel;
+
+ int length; /* Number of values in the property. */
+ bool is_base; /* Base snapshot of the channel. */
+
+ float values[]; /* Item values. */
+ /* Memory over-allocated to provide space for values. */
+} NlaEvalChannelSnapshot;
+
+/* NlaEvalChannel->mix_mode */
+enum eNlaEvalChannel_MixMode {
+ NEC_MIX_ADD,
+ NEC_MIX_MULTIPLY,
+ NEC_MIX_QUATERNION,
+ NEC_MIX_AXIS_ANGLE,
+};
-/* temp channel for accumulating data from NLA (avoids needing to clear all values first) */
-// TODO: maybe this will be used as the 'cache' stuff needed for editable values too?
+/* Temp channel for accumulating data from NLA for a single property.
+ * Handles array properties as a unit to allow intelligent blending. */
typedef struct NlaEvalChannel {
struct NlaEvalChannel *next, *prev;
+ struct NlaEvalData *owner;
- /* RNA reference to use with pointer and index */
- PathResolvedRNA rna;
-
- /* Original parameters used to look up the reference for write_orig_anim_rna */
+ /* Original RNA path string and property key. */
const char *rna_path;
+ NlaEvalChannelKey key;
+
+ int index;
+ bool is_array;
+ bool in_blend;
+ char mix_mode;
+
+ struct NlaEvalChannel *next_blend;
+ NlaEvalChannelSnapshot *blend_snapshot;
- float value; /* value of this channel */
+ /* Mask of array items controlled by NLA. */
+ NlaValidMask valid;
+
+ /* Base set of values. */
+ NlaEvalChannelSnapshot base_snapshot;
+ /* Memory over-allocated to provide space for base_snapshot.values. */
} NlaEvalChannel;
+/* Set of values for all channels. */
+typedef struct NlaEvalSnapshot {
+ /* Snapshot this one defaults to. */
+ struct NlaEvalSnapshot *base;
+
+ int size;
+ NlaEvalChannelSnapshot **channels;
+} NlaEvalSnapshot;
+
+/* Set of all channels covered by NLA. */
+typedef struct NlaEvalData {
+ ListBase channels;
+
+ /* Mapping of paths and NlaEvalChannelKeys to channels. */
+ GHash *path_hash;
+ GHash *key_hash;
+
+ /* Base snapshot. */
+ int num_channels;
+ NlaEvalSnapshot base_snapshot;
+
+ /* Evaluation result shapshot. */
+ NlaEvalSnapshot eval_snapshot;
+} NlaEvalData;
+
/* Information about the currently edited strip and ones below it for keyframing. */
typedef struct NlaKeyframingContext {
struct NlaKeyframingContext *next, *prev;
@@ -91,7 +155,7 @@ typedef struct NlaKeyframingContext {
NlaEvalStrip *eval_strip;
/* Evaluated NLA stack below the current strip. */
- ListBase nla_channels;
+ NlaEvalData nla_channels;
} NlaKeyframingContext;
/* --------------- NLA Functions (not to be used as a proper API) ----------------------- */
@@ -103,7 +167,7 @@ float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode);
/* these functions are only defined here to avoid problems with the order in which they get defined... */
NlaEvalStrip *nlastrips_ctime_get_strip(struct Depsgraph *depsgraph, ListBase *list, ListBase *strips, short index, float ctime);
-void nlastrip_evaluate(struct Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes);
-void nladata_flush_channels(struct Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels);
+void nlastrip_evaluate(struct Depsgraph *depsgraph, PointerRNA *ptr, NlaEvalData *channels, ListBase *modifiers, NlaEvalStrip *nes, NlaEvalSnapshot *snapshot);
+void nladata_flush_channels(struct Depsgraph *depsgraph, PointerRNA *ptr, NlaEvalData *channels, NlaEvalSnapshot *snapshot);
#endif /* __NLA_PRIVATE_H__ */
diff --git a/source/blender/blenkernel/particle_private.h b/source/blender/blenkernel/particle_private.h
index 2189527118b..1d460b095f4 100644
--- a/source/blender/blenkernel/particle_private.h
+++ b/source/blender/blenkernel/particle_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/particle_private.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#ifndef __PARTICLE_PRIVATE_H__
diff --git a/source/blender/blenkernel/tracking_private.h b/source/blender/blenkernel/tracking_private.h
index 07236fb2096..43413aef8a0 100644
--- a/source/blender/blenkernel/tracking_private.h
+++ b/source/blender/blenkernel/tracking_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- * Keir Mierle
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenkernel/tracking_private.h
- * \ingroup bke
+/** \file
+ * \ingroup bke
*
* This file contains declarations of function which are used
* by multiple tracking files but which should not be public.
diff --git a/source/blender/blenlib/BLI_alloca.h b/source/blender/blenlib/BLI_alloca.h
index 4fa69a24966..c1630dff5a1 100644
--- a/source/blender/blenlib/BLI_alloca.h
+++ b/source/blender/blenlib/BLI_alloca.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_ALLOCA_H__
#define __BLI_ALLOCA_H__
-/** \file BLI_alloca.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Defines alloca and utility macro BLI_array_alloca
*/
diff --git a/source/blender/blenlib/BLI_args.h b/source/blender/blenlib/BLI_args.h
index 6758fa399a4..e1f54903563 100644
--- a/source/blender/blenlib/BLI_args.h
+++ b/source/blender/blenlib/BLI_args.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_ARGS_H__
#define __BLI_ARGS_H__
-/** \file BLI_args.h
- * \ingroup bli
- * \brief A general argument parsing module.
+/** \file
+ * \ingroup bli
+ * \brief A general argument parsing module.
*/
struct bArgs;
diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h
index 8e94b8197ef..afc09363319 100644
--- a/source/blender/blenlib/BLI_array.h
+++ b/source/blender/blenlib/BLI_array.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_ARRAY_H__
#define __BLI_ARRAY_H__
-/** \file BLI_array.h
- * \ingroup bli
- * \brief A (mainly) macro array library.
+/** \file
+ * \ingroup bli
+ * \brief A (mainly) macro array library.
*/
/* -------------------------------------------------------------------- */
@@ -69,7 +61,6 @@ void _bli_array_grow_func(
/* -------------------------------------------------------------------- */
-
/** \name Public defines
* \{ */
@@ -170,7 +161,6 @@ void _bli_array_grow_func(
/* -------------------------------------------------------------------- */
-
/** \name Generic Array Utils
* other useful defines
* (unrelated to the main array macros)
diff --git a/source/blender/blenlib/BLI_array_store.h b/source/blender/blenlib/BLI_array_store.h
index f4cbc07bf26..5a7d21dd6f6 100644
--- a/source/blender/blenlib/BLI_array_store.h
+++ b/source/blender/blenlib/BLI_array_store.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,18 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_ARRAY_STORE_H__
#define __BLI_ARRAY_STORE_H__
-/** \file BLI_array_store.h
- * \ingroup bli
- * \brief Efficient in-memory storage of multiple similar arrays.
+/** \file
+ * \ingroup bli
+ * \brief Efficient in-memory storage of multiple similar arrays.
*/
-typedef struct BArrayStore BArrayStore;
typedef struct BArrayState BArrayState;
+typedef struct BArrayStore BArrayStore;
BArrayStore *BLI_array_store_create(
unsigned int stride, unsigned int chunk_count);
diff --git a/source/blender/blenlib/BLI_array_store_utils.h b/source/blender/blenlib/BLI_array_store_utils.h
index 6b2a28846f4..b5c11f88ed1 100644
--- a/source/blender/blenlib/BLI_array_store_utils.h
+++ b/source/blender/blenlib/BLI_array_store_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_ARRAY_STORE_UTILS_H__
#define __BLI_ARRAY_STORE_UTILS_H__
-/** \file BLI_array_store_utils.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
struct BArrayStore;
diff --git a/source/blender/blenlib/BLI_array_utils.h b/source/blender/blenlib/BLI_array_utils.h
index da03063b245..9ab2c439cc7 100644
--- a/source/blender/blenlib/BLI_array_utils.h
+++ b/source/blender/blenlib/BLI_array_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_ARRAY_UTILS_H__
#define __BLI_ARRAY_UTILS_H__
-/** \file BLI_array_utils.h
- * \ingroup bli
- * \brief Generic array manipulation API.
+/** \file
+ * \ingroup bli
+ * \brief Generic array manipulation API.
*/
#include "BLI_compiler_typecheck.h"
diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h
index b66b95b21fe..b6d5242ae57 100644
--- a/source/blender/blenlib/BLI_assert.h
+++ b/source/blender/blenlib/BLI_assert.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_ASSERT_H__
#define __BLI_ASSERT_H__
-/** \file BLI_assert.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Defines:
* - #BLI_assert
diff --git a/source/blender/blenlib/BLI_astar.h b/source/blender/blenlib/BLI_astar.h
index 99e0dcd1a27..94a5b6e5d11 100644
--- a/source/blender/blenlib/BLI_astar.h
+++ b/source/blender/blenlib/BLI_astar.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bastien Montagne.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_ASTAR_H__
#define __BLI_ASTAR_H__
-/** \file BLI_astar.h
- * \ingroup bli
- * \brief An implementation of the A* (AStar) algorithm to solve shortest path problem.
+/** \file
+ * \ingroup bli
+ * \brief An implementation of the A* (AStar) algorithm to solve shortest path problem.
*/
#include "BLI_utildefines.h"
@@ -54,9 +46,13 @@ typedef struct BLI_AStarGNode {
typedef struct BLI_AStarSolution {
/* Final 'most useful' data. */
- int steps; /* Number of steps (i.e. walked links) in path (nodes num, including start and end, is steps + 1). */
- int *prev_nodes; /* Store the path, in reversed order (from destination to source node), as indices. */
- BLI_AStarGNLink **prev_links; /* Indices are nodes' ones, as prev_nodes, but they map to relevant link. */
+ /** Number of steps (i.e. walked links) in path
+ * (nodes num, including start and end, is steps + 1). */
+ int steps;
+ /** Store the path, in reversed order (from destination to source node), as indices. */
+ int *prev_nodes;
+ /** Indices are nodes' ones, as prev_nodes, but they map to relevant link. */
+ BLI_AStarGNLink **prev_links;
void *custom_data;
diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h
index c3be39c5bc5..29742fdf789 100644
--- a/source/blender/blenlib/BLI_bitmap.h
+++ b/source/blender/blenlib/BLI_bitmap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2012 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_BITMAP_H__
#define __BLI_BITMAP_H__
-/** \file BLI_bitmap.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
typedef unsigned int BLI_bitmap;
diff --git a/source/blender/blenlib/BLI_bitmap_draw_2d.h b/source/blender/blenlib/BLI_bitmap_draw_2d.h
index 7036196425a..f27ef942a5a 100644
--- a/source/blender/blenlib/BLI_bitmap_draw_2d.h
+++ b/source/blender/blenlib/BLI_bitmap_draw_2d.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_BITMAP_DRAW_2D_H__
#define __BLI_BITMAP_DRAW_2D_H__
-/** \file BLI_bitmap_draw_2d.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
void BLI_bitmap_draw_2d_line_v2v2i(
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h
index 9f0e7392322..309314a4241 100644
--- a/source/blender/blenlib/BLI_blenlib.h
+++ b/source/blender/blenlib/BLI_blenlib.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BLI_blenlib.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* \section aboutbli Blender LIbrary external interface
*
diff --git a/source/blender/blenlib/BLI_boxpack_2d.h b/source/blender/blenlib/BLI_boxpack_2d.h
index d3f1109e18b..dd68e262dcd 100644
--- a/source/blender/blenlib/BLI_boxpack_2d.h
+++ b/source/blender/blenlib/BLI_boxpack_2d.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_BOXPACK_2D_H__
#define __BLI_BOXPACK_2D_H__
-/** \file BLI_boxpack_2d.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
/* Box Packer */
diff --git a/source/blender/blenlib/BLI_buffer.h b/source/blender/blenlib/BLI_buffer.h
index 0d2ef0dc9b3..6c3d5cb4350 100644
--- a/source/blender/blenlib/BLI_buffer.h
+++ b/source/blender/blenlib/BLI_buffer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_BUFFER_H__
#define __BLI_BUFFER_H__
-/** \file BLI_buffer.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
typedef struct {
diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h
index 2bbd82f6db8..8fdc52c59bf 100644
--- a/source/blender/blenlib/BLI_callbacks.h
+++ b/source/blender/blenlib/BLI_callbacks.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,17 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BLI_callbacks.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifndef __BLI_CALLBACKS_H__
#define __BLI_CALLBACKS_H__
-struct Main;
struct ID;
+struct Main;
/**
* Common suffix uses:
diff --git a/source/blender/blenlib/BLI_compiler_attrs.h b/source/blender/blenlib/BLI_compiler_attrs.h
index 09c0426db92..98e0eb09813 100644
--- a/source/blender/blenlib/BLI_compiler_attrs.h
+++ b/source/blender/blenlib/BLI_compiler_attrs.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,13 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_COMPILER_ATTRS_H__
#define __BLI_COMPILER_ATTRS_H__
-/** \file BLI_compiler_attrs.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
/* hint to make sure function result is actually used */
diff --git a/source/blender/blenlib/BLI_compiler_compat.h b/source/blender/blenlib/BLI_compiler_compat.h
index 2b53975a106..974f920f4b3 100644
--- a/source/blender/blenlib/BLI_compiler_compat.h
+++ b/source/blender/blenlib/BLI_compiler_compat.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,21 +12,18 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_COMPILER_COMPAT_H__
#define __BLI_COMPILER_COMPAT_H__
-/** \file BLI_compiler_compat.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Use to help with cross platform portability.
*/
#if defined(_MSC_VER)
-# define __func__ __FUNCTION__
# define alloca _alloca
#endif
diff --git a/source/blender/blenlib/BLI_compiler_typecheck.h b/source/blender/blenlib/BLI_compiler_typecheck.h
index 74638938214..4503848d6ea 100644
--- a/source/blender/blenlib/BLI_compiler_typecheck.h
+++ b/source/blender/blenlib/BLI_compiler_typecheck.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_COMPILER_TYPECHECK_H__
#define __BLI_COMPILER_TYPECHECK_H__
-/** \file BLI_compiler_typecheck.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Type checking macros (often used to ensure valid use of macro args).
* These depend on compiler extensions and c11 in some cases.
diff --git a/source/blender/blenlib/BLI_console.h b/source/blender/blenlib/BLI_console.h
index bf433f78f70..0038ff7ae95 100644
--- a/source/blender/blenlib/BLI_console.h
+++ b/source/blender/blenlib/BLI_console.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,18 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Srrgey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_CONSOLE_H__
#define __BLI_CONSOLE_H__
-/** \file BLI_console.h
- * \ingroup bli
- * \brief Set of utility functions and constants to work with consoles.
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \file
+ * \ingroup bli
+ * \brief Set of utility functions and constants to work with consoles.
*/
/* Format string where one could BLI_snprintf() R, G and B values
@@ -39,4 +37,8 @@
/* Marker which indicates that colored output is finished. */
#define TRUECOLOR_ANSI_COLOR_FINISH "\x1b[0m"
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __BLI_CONSOLE_H__ */
diff --git a/source/blender/blenlib/BLI_convexhull_2d.h b/source/blender/blenlib/BLI_convexhull_2d.h
index 000d28acdde..deda2da662a 100644
--- a/source/blender/blenlib/BLI_convexhull_2d.h
+++ b/source/blender/blenlib/BLI_convexhull_2d.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_CONVEXHULL_2D_H__
#define __BLI_CONVEXHULL_2D_H__
-/** \file BLI_convexhull_2d.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r_points[]);
diff --git a/source/blender/blenlib/BLI_dial_2d.h b/source/blender/blenlib/BLI_dial_2d.h
index 4a265164e10..9703399a2e8 100644
--- a/source/blender/blenlib/BLI_dial_2d.h
+++ b/source/blender/blenlib/BLI_dial_2d.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_DIAL_2D_H__
#define __BLI_DIAL_2D_H__
-/** \file BLI_dial_2d.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* \note dials act similar to old rotation based phones and output an angle.
*
diff --git a/source/blender/blenlib/BLI_dlrbTree.h b/source/blender/blenlib/BLI_dlrbTree.h
index e776f594a84..c310eb0d2dc 100644
--- a/source/blender/blenlib/BLI_dlrbTree.h
+++ b/source/blender/blenlib/BLI_dlrbTree.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,13 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * Contributor(s): Joshua Leung (original author)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_DLRBTREE_H__
#define __BLI_DLRBTREE_H__
-/** \file BLI_dlrbTree.h
- * \ingroup bli
- * \author Joshua Leung
+/** \file
+ * \ingroup bli
*/
/* Double-Linked Red-Black Tree Implementation:
diff --git a/source/blender/blenlib/BLI_dynlib.h b/source/blender/blenlib/BLI_dynlib.h
index 747ce75dd72..3359a70ef11 100644
--- a/source/blender/blenlib/BLI_dynlib.h
+++ b/source/blender/blenlib/BLI_dynlib.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/BLI_dynlib.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifndef __BLI_DYNLIB_H__
diff --git a/source/blender/blenlib/BLI_dynstr.h b/source/blender/blenlib/BLI_dynstr.h
index 796dd225404..0b28a2cb65b 100644
--- a/source/blender/blenlib/BLI_dynstr.h
+++ b/source/blender/blenlib/BLI_dynstr.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,15 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_DYNSTR_H__
#define __BLI_DYNSTR_H__
-/** \file BLI_dynstr.h
- * \ingroup bli
- * \brief A dynamically sized string ADT.
- * \section aboutdynstr Dynamic String
+/** \file
+ * \ingroup bli
+ * \brief A dynamically sized string ADT.
+ * \section aboutdynstr Dynamic String
* This ADT is designed purely for dynamic string creation
* through appending, not for general usage, the intent is
* to build up dynamic strings using a DynStr object, then
diff --git a/source/blender/blenlib/BLI_easing.h b/source/blender/blenlib/BLI_easing.h
index 0f9f73f475e..250eea723f5 100644
--- a/source/blender/blenlib/BLI_easing.h
+++ b/source/blender/blenlib/BLI_easing.h
@@ -1,7 +1,4 @@
/*
- * Copyright © 2001 Robert Penner
- * All rights reserved.
- *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
@@ -26,13 +23,16 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Copyright (c) 2001 Robert Penner
+ * All rights reserved.
*/
#ifndef __BLI_EASING_H__
#define __BLI_EASING_H__
-/** \file BLI_easing.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h
index 38f750dfe04..7016f147616 100644
--- a/source/blender/blenlib/BLI_edgehash.h
+++ b/source/blender/blenlib/BLI_edgehash.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,13 @@
* 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): Daniel Dunbar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_EDGEHASH_H__
#define __BLI_EDGEHASH_H__
-/** \file BLI_edgehash.h
- * \ingroup bli
- * \author Daniel Dunbar
+/** \file
+ * \ingroup bli
*/
#include "BLI_compiler_attrs.h"
diff --git a/source/blender/blenlib/BLI_endian_switch.h b/source/blender/blenlib/BLI_endian_switch.h
index 35242fecf4a..4f878f73077 100644
--- a/source/blender/blenlib/BLI_endian_switch.h
+++ b/source/blender/blenlib/BLI_endian_switch.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BLI_ENDIAN_SWITCH_H__
#define __BLI_ENDIAN_SWITCH_H__
-/** \file BLI_endian_switch.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_compiler_attrs.h"
diff --git a/source/blender/blenlib/BLI_endian_switch_inline.h b/source/blender/blenlib/BLI_endian_switch_inline.h
index 280503e9b93..07468568c5b 100644
--- a/source/blender/blenlib/BLI_endian_switch_inline.h
+++ b/source/blender/blenlib/BLI_endian_switch_inline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,22 +12,18 @@
* 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 *****
*/
+#ifndef __BLI_ENDIAN_SWITCH_INLINE_H__
+#define __BLI_ENDIAN_SWITCH_INLINE_H__
+
/* only include from header */
#ifndef __BLI_ENDIAN_SWITCH_H__
# error "this file isnt to be directly included"
#endif
-#ifndef __BLI_ENDIAN_SWITCH_INLINE_H__
-#define __BLI_ENDIAN_SWITCH_INLINE_H__
-
-/** \file blender/blenlib/BLI_endian_switch_inline.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
/* note: using a temp char to switch endian is a lot slower,
diff --git a/source/blender/blenlib/BLI_expr_pylike_eval.h b/source/blender/blenlib/BLI_expr_pylike_eval.h
index 578e4776038..59540d3c623 100644
--- a/source/blender/blenlib/BLI_expr_pylike_eval.h
+++ b/source/blender/blenlib/BLI_expr_pylike_eval.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation, Alexander Gavrilov
* All rights reserved.
- *
- * Contributor(s): Alexander Gavrilov
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_EXPR_PYLIKE_EVAL_H__
#define __BLI_EXPR_PYLIKE_EVAL_H__
-/** \file BLI_expr_pylike_eval.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index bb23c63bdb3..10cac63ec33 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BLI_fileops.h
- * \ingroup bli
- * \brief File and directory operations.
+/** \file
+ * \ingroup bli
+ * \brief File and directory operations.
* */
#ifndef __BLI_FILEOPS_H__
diff --git a/source/blender/blenlib/BLI_fileops_types.h b/source/blender/blenlib/BLI_fileops_types.h
index 06ffc8e5e79..c17592f45fe 100644
--- a/source/blender/blenlib/BLI_fileops_types.h
+++ b/source/blender/blenlib/BLI_fileops_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_FILEOPS_TYPES_H__
#define __BLI_FILEOPS_TYPES_H__
-/** \file BLI_fileops_types.h
- * \ingroup bli
- * \brief Some types for dealing with directories.
+/** \file
+ * \ingroup bli
+ * \brief Some types for dealing with directories.
*/
#include <sys/stat.h>
diff --git a/source/blender/blenlib/BLI_fnmatch.h b/source/blender/blenlib/BLI_fnmatch.h
index 42033b89f42..675b9b0882d 100644
--- a/source/blender/blenlib/BLI_fnmatch.h
+++ b/source/blender/blenlib/BLI_fnmatch.h
@@ -1,12 +1,8 @@
-/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
- *
- * NOTE: The canonical source of this file is maintained with the GNU C Library.
- * Bugs can be reported to bug-glibc@prep.ai.mit.edu.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
+/*
+ * This program is 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
@@ -15,13 +11,19 @@
*
* 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. */
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
+ *
+ * NOTE: The canonical source of this file is maintained with the GNU C Library.
+ * Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+ */
#ifndef __BLI_FNMATCH_H__
#define __BLI_FNMATCH_H__
-/** \file BLI_fnmatch.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index 7003eb039dd..a3292fbdc5f 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_GHASH_H__
#define __BLI_GHASH_H__
-/** \file BLI_ghash.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* GHash is a hash-map implementation (unordered key, value pairs).
*
@@ -77,7 +71,8 @@ enum {
#ifdef GHASH_INTERNAL_API
/* Internal usage only */
- GHASH_FLAG_IS_GSET = (1 << 16), /* Whether the GHash is actually used as GSet (no value storage). */
+ /* Whether the GHash is actually used as GSet (no value storage). */
+ GHASH_FLAG_IS_GSET = (1 << 16),
#endif
};
diff --git a/source/blender/blenlib/BLI_gsqueue.h b/source/blender/blenlib/BLI_gsqueue.h
index ef0e0f3ab31..ee82d1a8f3c 100644
--- a/source/blender/blenlib/BLI_gsqueue.h
+++ b/source/blender/blenlib/BLI_gsqueue.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_GSQUEUE_H__
#define __BLI_GSQUEUE_H__
-/** \file BLI_gsqueue.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
typedef struct _GSQueue GSQueue;
diff --git a/source/blender/blenlib/BLI_hash.h b/source/blender/blenlib/BLI_hash.h
index f74010479a9..89ff4d90b55 100644
--- a/source/blender/blenlib/BLI_hash.h
+++ b/source/blender/blenlib/BLI_hash.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,19 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_HASH_H__
#define __BLI_HASH_H__
-/** \file BLI_hash.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
BLI_INLINE unsigned int BLI_hash_int_2d(unsigned int kx, unsigned int ky)
{
#define rot(x, k) (((x) << (k)) | ((x) >> (32 - (k))))
@@ -80,4 +80,8 @@ BLI_INLINE void BLI_hash_pointer_to_color(const void *ptr, int *r, int *g, int *
*b = hash & 0x0000ff;
}
+#ifdef __cplusplus
+}
+#endif
+
#endif // __BLI_HASH_H__
diff --git a/source/blender/blenlib/BLI_hash_md5.h b/source/blender/blenlib/BLI_hash_md5.h
index 544ae753793..afda3edc0e5 100644
--- a/source/blender/blenlib/BLI_hash_md5.h
+++ b/source/blender/blenlib/BLI_hash_md5.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_HASH_MD5_H__
#define __BLI_HASH_MD5_H__
-/** \file BLI_hash_md5.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
diff --git a/source/blender/blenlib/BLI_hash_mm2a.h b/source/blender/blenlib/BLI_hash_mm2a.h
index 6beaf50ae8f..4e640f539db 100644
--- a/source/blender/blenlib/BLI_hash_mm2a.h
+++ b/source/blender/blenlib/BLI_hash_mm2a.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_HASH_MM2A_H__
#define __BLI_HASH_MM2A_H__
-/** \file BLI_hash_mm2a.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_sys_types.h"
diff --git a/source/blender/blenlib/BLI_hash_mm3.h b/source/blender/blenlib/BLI_hash_mm3.h
index 93bf963c9a4..3f81503340c 100644
--- a/source/blender/blenlib/BLI_hash_mm3.h
+++ b/source/blender/blenlib/BLI_hash_mm3.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_HASH_MM3_H__
#define __BLI_HASH_MM3_H__
-/** \file BLI_hash_mm3.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_sys_types.h"
diff --git a/source/blender/blenlib/BLI_heap.h b/source/blender/blenlib/BLI_heap.h
index 35c8df3075c..b45d548d9a9 100644
--- a/source/blender/blenlib/BLI_heap.h
+++ b/source/blender/blenlib/BLI_heap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_HEAP_H__
#define __BLI_HEAP_H__
-/** \file BLI_heap.h
- * \ingroup bli
- * \brief A min-heap / priority queue ADT
+/** \file
+ * \ingroup bli
+ * \brief A min-heap / priority queue ADT
*/
struct Heap;
diff --git a/source/blender/blenlib/BLI_heap_simple.h b/source/blender/blenlib/BLI_heap_simple.h
index eed33558d84..a57688e7ea5 100644
--- a/source/blender/blenlib/BLI_heap_simple.h
+++ b/source/blender/blenlib/BLI_heap_simple.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_HEAP_SIMPLE_H__
#define __BLI_HEAP_SIMPLE_H__
-/** \file BLI_heap_simple.h
- * \ingroup bli
- * \brief A min-heap / priority queue ADT
+/** \file
+ * \ingroup bli
+ * \brief A min-heap / priority queue ADT
*/
struct HeapSimple;
diff --git a/source/blender/blenlib/BLI_iterator.h b/source/blender/blenlib/BLI_iterator.h
index d3d375122a1..265af6b7e53 100644
--- a/source/blender/blenlib/BLI_iterator.h
+++ b/source/blender/blenlib/BLI_iterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_ITERATOR_H__
#define __BLI_ITERATOR_H__
-/** \file BLI_iterator.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
typedef struct BLI_Iterator {
diff --git a/source/blender/blenlib/BLI_jitter_2d.h b/source/blender/blenlib/BLI_jitter_2d.h
index e79251fba9f..bc9798c6cda 100644
--- a/source/blender/blenlib/BLI_jitter_2d.h
+++ b/source/blender/blenlib/BLI_jitter_2d.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_JITTER_2D_H__
#define __BLI_JITTER_2D_H__
-/** \file BLI_jitter_2d.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
void BLI_jitter_init(float (*jitarr)[2], int num);
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index e4203a01b17..0c40ce48529 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,14 @@
*
* The Original Code is Copyright (C) 2006 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Daniel Genrich, Andre Pinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_KDOPBVH_H__
#define __BLI_KDOPBVH_H__
-/** \file BLI_kdopbvh.h
- * \ingroup bli
- * \author Daniel Genrich
- * \author Andre Pinto
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
@@ -61,27 +51,41 @@ typedef struct BVHTreeOverlap {
} BVHTreeOverlap;
typedef struct BVHTreeNearest {
- int index; /* the index of the nearest found (untouched if none is found within a dist radius from the given coordinates) */
- float co[3]; /* nearest coordinates (untouched it none is found within a dist radius from the given coordinates) */
- float no[3]; /* normal at nearest coordinates (untouched it none is found within a dist radius from the given coordinates) */
- float dist_sq; /* squared distance to search around */
+ /** The index of the nearest found
+ * (untouched if none is found within a dist radius from the given coordinates) */
+ int index;
+ /** Nearest coordinates
+ * (untouched it none is found within a dist radius from the given coordinates). */
+ float co[3];
+ /** Normal at nearest coordinates
+ * (untouched it none is found within a dist radius from the given coordinates). */
+ float no[3];
+ /** squared distance to search around */
+ float dist_sq;
int flags;
} BVHTreeNearest;
typedef struct BVHTreeRay {
- float origin[3]; /* ray origin */
- float direction[3]; /* ray direction */
- float radius; /* radius around ray */
+ /** ray origin */
+ float origin[3];
+ /** ray direction */
+ float direction[3];
+ /** radius around ray */
+ float radius;
#ifdef USE_KDOPBVH_WATERTIGHT
struct IsectRayPrecalc *isect_precalc;
#endif
} BVHTreeRay;
typedef struct BVHTreeRayHit {
- int index; /* index of the tree node (untouched if no hit is found) */
- float co[3]; /* coordinates of the hit point */
- float no[3]; /* normal on hit point */
- float dist; /* distance to the hit point */
+ /** Index of the tree node (untouched if no hit is found). */
+ int index;
+ /** Coordinates of the hit point. */
+ float co[3];
+ /** Normal on hit point. */
+ float no[3];
+ /** Distance to the hit point. */
+ float dist;
} BVHTreeRayHit;
enum {
@@ -137,7 +141,8 @@ void BLI_bvhtree_update_tree(BVHTree *tree);
int BLI_bvhtree_overlap_thread_num(const BVHTree *tree);
-/* collision/overlap: check two trees if they overlap, alloc's *overlap with length of the int return value */
+/* collision/overlap: check two trees if they overlap,
+ * alloc's *overlap with length of the int return value */
BVHTreeOverlap *BLI_bvhtree_overlap(
const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_tot,
BVHTree_OverlapCallback callback, void *userdata);
@@ -147,7 +152,8 @@ int BLI_bvhtree_get_tree_type(const BVHTree *tree);
float BLI_bvhtree_get_epsilon(const BVHTree *tree);
/* find nearest node to the given coordinates
- * (if nearest is given it will only search nodes where square distance is smaller than nearest->dist) */
+ * (if nearest is given it will only search nodes where
+ * square distance is smaller than nearest->dist) */
int BLI_bvhtree_find_nearest_ex(
BVHTree *tree, const float co[3], BVHTreeNearest *nearest,
BVHTree_NearestPointCallback callback, void *userdata,
diff --git a/source/blender/blenlib/BLI_kdtree.h b/source/blender/blenlib/BLI_kdtree.h
index 689c07e05db..864055127fc 100644
--- a/source/blender/blenlib/BLI_kdtree.h
+++ b/source/blender/blenlib/BLI_kdtree.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,21 +12,14 @@
* 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): Janne Karhu
- * Brecht Van Lommel
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_KDTREE_H__
#define __BLI_KDTREE_H__
-/** \file BLI_kdtree.h
- * \ingroup bli
- * \brief A kd-tree for nearest neighbor search.
- * \author Janne Karhu
- * \author Brecht van Lommel
+/** \file
+ * \ingroup bli
+ * \brief A kd-tree for nearest neighbor search.
*/
#include "BLI_compiler_attrs.h"
diff --git a/source/blender/blenlib/BLI_lasso_2d.h b/source/blender/blenlib/BLI_lasso_2d.h
index 3644224f1d7..c3b4b52b2e6 100644
--- a/source/blender/blenlib/BLI_lasso_2d.h
+++ b/source/blender/blenlib/BLI_lasso_2d.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_LASSO_2D_H__
#define __BLI_LASSO_2D_H__
-/** \file BLI_lasso_2d.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
struct rcti;
diff --git a/source/blender/blenlib/BLI_link_utils.h b/source/blender/blenlib/BLI_link_utils.h
index 7a1a13a6b31..9048b4e4b4a 100644
--- a/source/blender/blenlib/BLI_link_utils.h
+++ b/source/blender/blenlib/BLI_link_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_LINK_UTILS_H__
#define __BLI_LINK_UTILS_H__
-/** \file BLI_link_utils.h
- * \ingroup bli
- * \brief Single link-list utility macros. (header only api).
+/** \file
+ * \ingroup bli
+ * \brief Single link-list utility macros. (header only api).
*
* Use this api when the structure defines its own ``next`` pointer
* and a double linked list such as #ListBase isnt needed.
diff --git a/source/blender/blenlib/BLI_linklist.h b/source/blender/blenlib/BLI_linklist.h
index 214915163c7..3272505e204 100644
--- a/source/blender/blenlib/BLI_linklist.h
+++ b/source/blender/blenlib/BLI_linklist.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,19 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_LINKLIST_H__
#define __BLI_LINKLIST_H__
-/** \file BLI_linklist.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_compiler_attrs.h"
-struct MemArena;
struct BLI_mempool;
+struct MemArena;
typedef void (*LinkNodeFreeFP)(void *link);
typedef void (*LinkNodeApplyFP)(void *link, void *userdata);
diff --git a/source/blender/blenlib/BLI_linklist_lockfree.h b/source/blender/blenlib/BLI_linklist_lockfree.h
index 7e7400361e3..0a191b773b9 100644
--- a/source/blender/blenlib/BLI_linklist_lockfree.h
+++ b/source/blender/blenlib/BLI_linklist_lockfree.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_LINKLIST_LOCKFREE_H__
#define __BLI_LINKLIST_LOCKFREE_H__
-/** \file BLI_linklist_lockfree.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_linklist_stack.h b/source/blender/blenlib/BLI_linklist_stack.h
index b4c6751db52..abc799f31ba 100644
--- a/source/blender/blenlib/BLI_linklist_stack.h
+++ b/source/blender/blenlib/BLI_linklist_stack.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_LINKLIST_STACK_H__
#define __BLI_LINKLIST_STACK_H__
-/** \file BLI_linklist_stack.h
+/** \file
* \ingroup bli
* \brief BLI_LINKSTACK_*** wrapper macros for using a \a LinkNode
* to store a stack of pointers, using a single linked list
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index 34e7a1fa212..cb0d394bd0b 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_LISTBASE_H__
#define __BLI_LISTBASE_H__
-/** \file BLI_listbase.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_compiler_attrs.h"
@@ -133,7 +125,13 @@ if ((lb)->last && (lb_init || (lb_init = (lb)->last))) { \
#define LISTBASE_FOREACH(type, var, list) \
for (type var = (type)((list)->first); \
var != NULL; \
- var = (type)(((Link*)(var))->next))
+ var = (type)(((Link *)(var))->next))
+
+/** A verion of #LISTBASE_FOREACH that supports removing the item we're looping over. */
+#define LISTBASE_FOREACH_MUTABLE(type, var, list) \
+ for (type var = (type)((list)->first), *var##_iter_next; \
+ ((var != NULL) ? ((void)(var##_iter_next = (type)(((Link *)(var))->next)), 1) : 0); \
+ var = var##_iter_next)
#ifdef __cplusplus
}
diff --git a/source/blender/blenlib/BLI_math.h b/source/blender/blenlib/BLI_math.h
index 5bdf8b7791f..c19fb7e0e85 100644
--- a/source/blender/blenlib/BLI_math.h
+++ b/source/blender/blenlib/BLI_math.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,14 +18,13 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_H__
#define __BLI_MATH_H__
-/** \file BLI_math.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* \section mathabbrev Abbreviations
*
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index f455436ce63..01ce35a2279 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,14 +18,13 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_BASE_H__
#define __BLI_MATH_BASE_H__
-/** \file BLI_math_base.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef _MSC_VER
diff --git a/source/blender/blenlib/BLI_math_bits.h b/source/blender/blenlib/BLI_math_bits.h
index 86213dc271f..69768a7a796 100644
--- a/source/blender/blenlib/BLI_math_bits.h
+++ b/source/blender/blenlib/BLI_math_bits.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,14 +13,13 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_BITS_H__
#define __BLI_MATH_BITS_H__
-/** \file BLI_math_bits.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index 7fe890edeec..624f87b88e9 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,14 +18,13 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_COLOR_H__
#define __BLI_MATH_COLOR_H__
-/** \file BLI_math_color.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_math_color_blend.h b/source/blender/blenlib/BLI_math_color_blend.h
index 6ca8cecadbb..f1e44f7314d 100644
--- a/source/blender/blenlib/BLI_math_color_blend.h
+++ b/source/blender/blenlib/BLI_math_color_blend.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,14 +18,13 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_COLOR_BLEND_H__
#define __BLI_MATH_COLOR_BLEND_H__
-/** \file BLI_math_color_blend.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index d5287e8d8aa..4d095ab1900 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,14 +18,13 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_GEOM_H__
#define __BLI_MATH_GEOM_H__
-/** \file BLI_math_geom.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
@@ -113,9 +110,9 @@ float dist_signed_squared_to_corner_v3v3v3(
const float p[3],
const float v1[3], const float v2[3], const float v3[3],
const float axis_ref[3]);
-float dist_squared_to_ray_v3(
+float dist_squared_to_ray_v3_normalized(
const float ray_origin[3], const float ray_direction[3],
- const float co[3], float *r_depth);
+ const float co[3]);
float dist_squared_ray_to_seg_v3(
const float ray_origin[3], const float ray_direction[3],
const float v0[3], const float v1[3],
diff --git a/source/blender/blenlib/BLI_math_inline.h b/source/blender/blenlib/BLI_math_inline.h
index 383abda5b2f..3e32a517471 100644
--- a/source/blender/blenlib/BLI_math_inline.h
+++ b/source/blender/blenlib/BLI_math_inline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,14 +18,13 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_INLINE_H__
#define __BLI_MATH_INLINE_H__
-/** \file BLI_math_inline.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_math_interp.h b/source/blender/blenlib/BLI_math_interp.h
index a3c5ce82630..a32d834f258 100644
--- a/source/blender/blenlib/BLI_math_interp.h
+++ b/source/blender/blenlib/BLI_math_interp.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,13 @@
*
* The Original Code is Copyright (C) 2012 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __BLI_MATH_INTERP_H__
#define __BLI_MATH_INTERP_H__
-/** \file BLI_math_interp.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
void BLI_bicubic_interpolation_fl(const float *buffer, float *output, int width, int height,
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index d4d498590b5..4e897ace95c 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,14 +18,13 @@
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_MATRIX_H__
#define __BLI_MATH_MATRIX_H__
-/** \file BLI_math_matrix.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h
index 2bc82bac8d8..5246d7ad1a9 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,14 +18,13 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_ROTATION_H__
#define __BLI_MATH_ROTATION_H__
-/** \file BLI_math_rotation.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
@@ -80,10 +77,10 @@ void add_qt_qtqt(float q[4], const float a[4], const float b[4], const float t);
void quat_to_mat3(float mat[3][3], const float q[4]);
void quat_to_mat4(float mat[4][4], const float q[4]);
-void mat3_normalized_to_quat(float q[4], float mat[3][3]);
-void mat4_normalized_to_quat(float q[4], float mat[4][4]);
-void mat3_to_quat(float q[4], float mat[3][3]);
-void mat4_to_quat(float q[4], float mat[4][4]);
+void mat3_normalized_to_quat(float q[4], const float mat[3][3]);
+void mat4_normalized_to_quat(float q[4], const float mat[4][4]);
+void mat3_to_quat(float q[4], const float mat[3][3]);
+void mat4_to_quat(float q[4], const float mat[4][4]);
void tri_to_quat_ex(float quat[4], const float v1[3], const float v2[3], const float v3[3],
const float no_orig[3]);
float tri_to_quat(float q[4], const float a[3], const float b[3], const float c[3]);
@@ -104,7 +101,7 @@ float angle_signed_qt(const float q[4]);
float angle_signed_qtqt(const float q1[4], const float q2[4]);
/* TODO: don't what this is, but it's not the same as mat3_to_quat */
-void mat3_to_quat_is_ok(float q[4], float mat[3][3]);
+void mat3_to_quat_is_ok(float q[4], const float mat[3][3]);
/* other */
void print_qt(const char *str, const float q[4]);
@@ -122,10 +119,10 @@ void axis_angle_normalized_to_mat3_ex(float mat[3][3], const float axis[3],
void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], const float angle);
void axis_angle_to_mat4(float R[4][4], const float axis[3], const float angle);
-void mat3_normalized_to_axis_angle(float axis[3], float *angle, float M[3][3]);
-void mat4_normalized_to_axis_angle(float axis[3], float *angle, float M[4][4]);
-void mat3_to_axis_angle(float axis[3], float *angle, float M[3][3]);
-void mat4_to_axis_angle(float axis[3], float *angle, float M[4][4]);
+void mat3_normalized_to_axis_angle(float axis[3], float *angle, const float M[3][3]);
+void mat4_normalized_to_axis_angle(float axis[3], float *angle, const float M[4][4]);
+void mat3_to_axis_angle(float axis[3], float *angle, const float M[3][3]);
+void mat4_to_axis_angle(float axis[3], float *angle, const float M[4][4]);
void quat_to_axis_angle(float axis[3], float *angle, const float q[4]);
void angle_to_mat2(float R[2][2], const float angle);
@@ -145,10 +142,10 @@ void eul_to_quat(float quat[4], const float eul[3]);
void eul_to_mat3(float mat[3][3], const float eul[3]);
void eul_to_mat4(float mat[4][4], const float eul[3]);
-void mat3_normalized_to_eul(float eul[3], float mat[3][3]);
-void mat4_normalized_to_eul(float eul[3], float mat[4][4]);
-void mat3_to_eul(float eul[3], float mat[3][3]);
-void mat4_to_eul(float eul[3], float mat[4][4]);
+void mat3_normalized_to_eul(float eul[3], const float mat[3][3]);
+void mat4_normalized_to_eul(float eul[3], const float mat[4][4]);
+void mat3_to_eul(float eul[3], const float mat[3][3]);
+void mat4_to_eul(float eul[3], const float mat[4][4]);
void quat_to_eul(float eul[3], const float quat[4]);
void mat3_normalized_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]);
@@ -180,18 +177,18 @@ void eulO_to_mat4(float mat[4][4], const float eul[3], const short order);
void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], const short order);
void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order);
-void mat3_normalized_to_eulO(float eul[3], const short order, float mat[3][3]);
-void mat4_normalized_to_eulO(float eul[3], const short order, float mat[4][4]);
-void mat3_to_eulO(float eul[3], const short order, float mat[3][3]);
-void mat4_to_eulO(float eul[3], const short order, float mat[4][4]);
+void mat3_normalized_to_eulO(float eul[3], const short order, const float mat[3][3]);
+void mat4_normalized_to_eulO(float eul[3], const short order, const float mat[4][4]);
+void mat3_to_eulO(float eul[3], const short order, const float mat[3][3]);
+void mat4_to_eulO(float eul[3], const short order, const float mat[4][4]);
void quat_to_eulO(float eul[3], const short order, const float quat[4]);
void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle);
-void mat3_normalized_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[3][3]);
-void mat4_normalized_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[4][4]);
-void mat3_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[3][3]);
-void mat4_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[4][4]);
-void quat_to_compatible_eulO(float eul[3], float old[3], const short order, const float quat[4]);
+void mat3_normalized_to_compatible_eulO(float eul[3], const float old[3], const short order, const float mat[3][3]);
+void mat4_normalized_to_compatible_eulO(float eul[3], const float old[3], const short order, const float mat[4][4]);
+void mat3_to_compatible_eulO(float eul[3], const float old[3], const short order, const float mat[3][3]);
+void mat4_to_compatible_eulO(float eul[3], const float old[3], const short order, const float mat[4][4]);
+void quat_to_compatible_eulO(float eul[3], const float old[3], const short order, const float quat[4]);
void rotate_eulO(float eul[3], const short order, char axis, float angle);
@@ -210,7 +207,7 @@ void normalize_dq(DualQuat *dq, float totw);
void add_weighted_dq_dq(DualQuat *r, const DualQuat *dq, float weight);
void mul_v3m3_dq(float r[3], float R[3][3], DualQuat *dq);
-void mat4_to_dquat(DualQuat *r, float base[4][4], float M[4][4]);
+void mat4_to_dquat(DualQuat *r, const float base[4][4], const float M[4][4]);
void dquat_to_mat4(float R[4][4], const DualQuat *dq);
void quat_apply_track(float quat[4], short axis, short upflag);
diff --git a/source/blender/blenlib/BLI_math_solvers.h b/source/blender/blenlib/BLI_math_solvers.h
index 845d2100133..4e028b34c16 100644
--- a/source/blender/blenlib/BLI_math_solvers.h
+++ b/source/blender/blenlib/BLI_math_solvers.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_SOLVERS_H__
#define __BLI_MATH_SOLVERS_H__
-/** \file BLI_math_solvers.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_math_statistics.h b/source/blender/blenlib/BLI_math_statistics.h
index 40641c05e08..30bbe1f4175 100644
--- a/source/blender/blenlib/BLI_math_statistics.h
+++ b/source/blender/blenlib/BLI_math_statistics.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_STATISTICS_H__
#define __BLI_MATH_STATISTICS_H__
-/** \file BLI_math_statistics.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index a663d08b074..f3908cf7462 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,14 +18,13 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_VECTOR_H__
#define __BLI_MATH_VECTOR_H__
-/** \file BLI_math_vector.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
@@ -78,6 +75,13 @@ MINLINE void zero_v3_int(int r[3]);
MINLINE void copy_v2_v2_int(int r[2], const int a[2]);
MINLINE void copy_v3_v3_int(int r[3], const int a[3]);
MINLINE void copy_v4_v4_int(int r[4], const int a[4]);
+/* double */
+MINLINE void zero_v3_db(double r[3]);
+MINLINE void copy_v2_v2_db(double r[2], const double a[2]);
+MINLINE void copy_v3_v3_db(double r[3], const double a[3]);
+MINLINE void copy_v4_v4_db(double r[4], const double a[4]);
+/* short -> float */
+MINLINE void copy_v3fl_v3s(float r[3], const short a[3]);
/* int <-> float */
MINLINE void copy_v2fl_v2i(float r[2], const int a[2]);
MINLINE void round_v2i_v2fl(int r[2], const float a[2]);
@@ -107,14 +111,20 @@ MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3]);
MINLINE void add_v4_v4(float r[4], const float a[4]);
MINLINE void add_v4_v4v4(float r[4], const float a[4], const float b[4]);
+MINLINE void add_v3fl_v3fl_v3i(float r[3], const float a[3], const int b[3]);
+MINLINE void add_v3fl_v3fl_v3s(float r[3], const float a[3], const short b[3]);
+
MINLINE void sub_v2_v2(float r[2], const float a[2]);
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2]);
MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], const int b[2]);
MINLINE void sub_v3_v3(float r[3], const float a[3]);
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3]);
+MINLINE void sub_v3_v3v3_int(int r[3], const int a[3], const int b[3]);
MINLINE void sub_v4_v4(float r[4], const float a[4]);
MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4]);
+MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float b[3]);
+
MINLINE void mul_v2_fl(float r[2], float f);
MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f);
MINLINE void mul_v3_fl(float r[3], float f);
@@ -145,6 +155,8 @@ MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], cons
MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f);
MINLINE void madd_v4_v4v4(float r[4], const float a[4], const float b[4]);
+MINLINE void madd_v3fl_v3fl_v3fl_v3i(float r[3], const float a[3], const float b[3], const int c[3]);
+
MINLINE void negate_v2(float r[2]);
MINLINE void negate_v2_v2(float r[2], const float a[2]);
MINLINE void negate_v3(float r[3]);
diff --git a/source/blender/blenlib/BLI_memarena.h b/source/blender/blenlib/BLI_memarena.h
index 8793e44397a..a9a5aa33e86 100644
--- a/source/blender/blenlib/BLI_memarena.h
+++ b/source/blender/blenlib/BLI_memarena.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BLI_memarena.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifndef __BLI_MEMARENA_H__
diff --git a/source/blender/blenlib/BLI_memiter.h b/source/blender/blenlib/BLI_memiter.h
index 55eb023313d..da73eeb1167 100644
--- a/source/blender/blenlib/BLI_memiter.h
+++ b/source/blender/blenlib/BLI_memiter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_MEMITER_H__
#define __BLI_MEMITER_H__
-/** \file BLI_memiter.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_memory_utils.h b/source/blender/blenlib/BLI_memory_utils.h
index 32bbdf8a7b5..82c862cc093 100644
--- a/source/blender/blenlib/BLI_memory_utils.h
+++ b/source/blender/blenlib/BLI_memory_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_MEMORY_UTILS_H__
#define __BLI_MEMORY_UTILS_H__
-/** \file BLI_memory_utils.h
- * \ingroup bli
- * \brief Generic memory manipulation API.
+/** \file
+ * \ingroup bli
+ * \brief Generic memory manipulation API.
*/
/* it may be defined already */
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h
index dfa6fdd2625..31bd93544b0 100644
--- a/source/blender/blenlib/BLI_mempool.h
+++ b/source/blender/blenlib/BLI_mempool.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_MEMPOOL_H__
#define __BLI_MEMPOOL_H__
-/** \file BLI_mempool.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_noise.h b/source/blender/blenlib/BLI_noise.h
index 03f2c588f5e..d086c2af608 100644
--- a/source/blender/blenlib/BLI_noise.h
+++ b/source/blender/blenlib/BLI_noise.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __BLI_NOISE_H__
#define __BLI_NOISE_H__
-/** \file BLI_noise.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
@@ -42,7 +33,8 @@ float BLI_hnoise(float noisesize, float x, float y, float z);
float BLI_hnoisep(float noisesize, float x, float y, float z);
float BLI_turbulence(float noisesize, float x, float y, float z, int nr);
float BLI_turbulence1(float noisesize, float x, float y, float z, int nr);
-/* newnoise: generic noise & turbulence functions to replace the above BLI_hnoise/p & BLI_turbulence/1.
+/* newnoise: generic noise & turbulence functions
+ * to replace the above BLI_hnoise/p & BLI_turbulence/1.
* This is done so different noise basis functions can be used */
float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noisebasis);
float BLI_gTurbulence(float noisesize, float x, float y, float z, int oct, int hard, int noisebasis);
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index dcfb2c9cbc9..ac87fd21a92 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_PATH_UTIL_H__
#define __BLI_PATH_UTIL_H__
-/** \file BLI_path_util.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_polyfill_2d.h b/source/blender/blenlib/BLI_polyfill_2d.h
index 0ede111fc42..cf4b280a2fb 100644
--- a/source/blender/blenlib/BLI_polyfill_2d.h
+++ b/source/blender/blenlib/BLI_polyfill_2d.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_POLYFILL_2D_H__
#define __BLI_POLYFILL_2D_H__
-/** \file BLI_polyfill_2d.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
struct MemArena;
diff --git a/source/blender/blenlib/BLI_polyfill_2d_beautify.h b/source/blender/blenlib/BLI_polyfill_2d_beautify.h
index 96b730bee68..bf46431f90b 100644
--- a/source/blender/blenlib/BLI_polyfill_2d_beautify.h
+++ b/source/blender/blenlib/BLI_polyfill_2d_beautify.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_POLYFILL_2D_BEAUTIFY_H__
#define __BLI_POLYFILL_2D_BEAUTIFY_H__
-/** \file BLI_polyfill_2d_beautify.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
struct Heap;
diff --git a/source/blender/blenlib/BLI_quadric.h b/source/blender/blenlib/BLI_quadric.h
index d46a221d108..24fa3c1ca38 100644
--- a/source/blender/blenlib/BLI_quadric.h
+++ b/source/blender/blenlib/BLI_quadric.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Laurence Bourn, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_QUADRIC_H__
#define __BLI_QUADRIC_H__
-/** \file BLI_quadric.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
typedef struct Quadric {
diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h
index f7dea562393..fd078ae3a36 100644
--- a/source/blender/blenlib/BLI_rand.h
+++ b/source/blender/blenlib/BLI_rand.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_RAND_H__
#define __BLI_RAND_H__
-/** \file BLI_rand.h
- * \ingroup bli
- * \brief Random number functions.
+/** \file
+ * \ingroup bli
+ * \brief Random number functions.
*/
/* RNG is an abstract random number generator type that avoids using globals.
@@ -45,6 +37,7 @@ typedef struct RNG_THREAD_ARRAY RNG_THREAD_ARRAY;
struct RNG *BLI_rng_new(unsigned int seed);
struct RNG *BLI_rng_new_srandom(unsigned int seed);
+struct RNG *BLI_rng_copy(struct RNG *rng) ATTR_NONNULL(1);
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1);
void BLI_rng_seed(struct RNG *rng, unsigned int seed) ATTR_NONNULL(1);
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 221d328dd9e..a8d1df8eeb8 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __BLI_RECT_H__
#define __BLI_RECT_H__
-/** \file BLI_rect.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "DNA_vec_types.h"
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index f6b37fa2ec3..ab076dea3b8 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_SCANFILL_H__
#define __BLI_SCANFILL_H__
-/** \file BLI_scanfill.h
- * \ingroup bli
- * \since March 2001
- * \author nzc
- * \brief Filling meshes.
+/** \file
+ * \ingroup bli
*/
struct ScanFillVert;
@@ -71,13 +60,19 @@ typedef struct ScanFillVert {
int i;
unsigned int u;
} tmp;
- float co[3]; /* vertex location */
- float xy[2]; /* 2D projection of vertex location */
- unsigned int keyindex; /* index, caller can use how it likes to match the scanfill result with own data */
+ /** vertex location */
+ float co[3];
+ /** 2D projection of vertex location */
+ float xy[2];
+ /** index, caller can use how it likes to match the scanfill result with own data */
+ unsigned int keyindex;
unsigned short poly_nr;
- unsigned char edge_tot; /* number of edges using this vertex */
- unsigned int f : 4; /* vert status */
- unsigned int user_flag : 4; /* flag callers can use as they like */
+ /** number of edges using this vertex */
+ unsigned char edge_tot;
+ /** vert status */
+ unsigned int f : 4;
+ /** flag callers can use as they like */
+ unsigned int user_flag : 4;
} ScanFillVert;
typedef struct ScanFillEdge {
diff --git a/source/blender/blenlib/BLI_smallhash.h b/source/blender/blenlib/BLI_smallhash.h
index d1bcf4e9dc6..80e58a98b51 100644
--- a/source/blender/blenlib/BLI_smallhash.h
+++ b/source/blender/blenlib/BLI_smallhash.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_SMALLHASH_H__
#define __BLI_SMALLHASH_H__
-/** \file BLI_smallhash.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_compiler_attrs.h"
diff --git a/source/blender/blenlib/BLI_sort.h b/source/blender/blenlib/BLI_sort.h
index cb6b87bda38..1863f7692af 100644
--- a/source/blender/blenlib/BLI_sort.h
+++ b/source/blender/blenlib/BLI_sort.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,13 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Benoit Bolsee,
- * Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_SORT_H__
#define __BLI_SORT_H__
-/** \file BLI_sort.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdlib.h>
diff --git a/source/blender/blenlib/BLI_sort_utils.h b/source/blender/blenlib/BLI_sort_utils.h
index f6bd80b30d3..4ccf8925de2 100644
--- a/source/blender/blenlib/BLI_sort_utils.h
+++ b/source/blender/blenlib/BLI_sort_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,13 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_SORT_UTILS_H__
#define __BLI_SORT_UTILS_H__
-/** \file BLI_sort_utils.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
/**
diff --git a/source/blender/blenlib/BLI_stack.h b/source/blender/blenlib/BLI_stack.h
index d54f2a7bab2..0f4cd7270a5 100644
--- a/source/blender/blenlib/BLI_stack.h
+++ b/source/blender/blenlib/BLI_stack.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,13 @@
* 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): Nicholas Bishop
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __BLI_STACK_H__
#define __BLI_STACK_H__
-/** \file BLI_stack.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_compiler_attrs.h"
diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h
index 86b7285655e..68ae33b068d 100644
--- a/source/blender/blenlib/BLI_strict_flags.h
+++ b/source/blender/blenlib/BLI_strict_flags.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_STRICT_FLAGS_H__
#define __BLI_STRICT_FLAGS_H__
-/** \file BLI_strict_flags.h
+/** \file
* \ingroup bli
* \brief Strict compiler flags for areas of code we want
* to ensure don't do conversions without us knowing about it.
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 2fb8f045841..831626b164b 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_STRING_H__
#define __BLI_STRING_H__
-/** \file BLI_string.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdarg.h>
@@ -119,6 +111,10 @@ int BLI_string_find_split_words(
BLI_snprintf(dst, ARRAY_SIZE(dst), format, __VA_ARGS__)
#define SNPRINTF_RLEN(dst, format, ...) \
BLI_snprintf_rlen(dst, ARRAY_SIZE(dst), format, __VA_ARGS__)
+#define STR_CONCAT(dst, len, suffix) \
+ len += BLI_strncpy_rlen(dst + len, suffix, ARRAY_SIZE(dst) - len)
+#define STR_CONCATF(dst, len, format, ...) \
+ len += BLI_snprintf_rlen(dst + len, ARRAY_SIZE(dst) - len, format, __VA_ARGS__)
/** \} */
#ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h
index e7776aa0f0d..7e8305ceacc 100644
--- a/source/blender/blenlib/BLI_string_cursor_utf8.h
+++ b/source/blender/blenlib/BLI_string_cursor_utf8.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_STRING_CURSOR_UTF8_H__
#define __BLI_STRING_CURSOR_UTF8_H__
-/** \file BLI_string_cursor_utf8.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
typedef enum eStrCursorJumpType {
diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h
index 21542d0d6e1..e370e7d9f72 100644
--- a/source/blender/blenlib/BLI_string_utf8.h
+++ b/source/blender/blenlib/BLI_string_utf8.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_STRING_UTF8_H__
#define __BLI_STRING_UTF8_H__
-/** \file BLI_string_utf8.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
@@ -39,7 +33,8 @@ char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src,
ptrdiff_t BLI_utf8_invalid_byte(const char *str, size_t length) ATTR_NONNULL();
int BLI_utf8_invalid_strip(char *str, size_t length) ATTR_NONNULL();
-int BLI_str_utf8_size(const char *p) ATTR_NONNULL(); /* warning, can return -1 on bad chars */
+/* warning, can return -1 on bad chars */
+int BLI_str_utf8_size(const char *p) ATTR_NONNULL();
int BLI_str_utf8_size_safe(const char *p) ATTR_NONNULL();
/* copied from glib */
unsigned int BLI_str_utf8_as_unicode(const char *p) ATTR_NONNULL();
@@ -64,7 +59,8 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst, const char *__
/* count columns that character/string occupies, based on wcwidth.c */
int BLI_wcwidth(wchar_t ucs);
int BLI_wcswidth(const wchar_t *pwcs, size_t n) ATTR_NONNULL();
-int BLI_str_utf8_char_width(const char *p) ATTR_NONNULL(); /* warning, can return -1 on bad chars */
+/* warning, can return -1 on bad chars */
+int BLI_str_utf8_char_width(const char *p) ATTR_NONNULL();
int BLI_str_utf8_char_width_safe(const char *p) ATTR_NONNULL();
size_t BLI_str_partition_utf8(const char *str, const unsigned int delim[], const char **sep, const char **suf) ATTR_NONNULL();
diff --git a/source/blender/blenlib/BLI_string_utils.h b/source/blender/blenlib/BLI_string_utils.h
index 5701bce51ea..cb299db97d5 100644
--- a/source/blender/blenlib/BLI_string_utils.h
+++ b/source/blender/blenlib/BLI_string_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2017 by the Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_STRING_UTILS_H__
#define __BLI_STRING_UTILS_H__
-/** \file BLI_string_utils.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdarg.h>
diff --git a/source/blender/blenlib/BLI_sys_types.h b/source/blender/blenlib/BLI_sys_types.h
index d9f99b2f067..e2ad1949daa 100644
--- a/source/blender/blenlib/BLI_sys_types.h
+++ b/source/blender/blenlib/BLI_sys_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BLI_sys_types.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* A platform-independent definition of [u]intXX_t
* Plus the accompanying header include for htonl/ntohl
@@ -37,7 +29,6 @@
* - Windows uses __intXX compiler-builtin types. These are signed,
* so we have to flip the signs.
* For these rogue platforms, we make the typedefs ourselves.
- *
*/
#ifndef __BLI_SYS_TYPES_H__
diff --git a/source/blender/blenlib/BLI_system.h b/source/blender/blenlib/BLI_system.h
index 08f34add563..6823eccf97a 100644
--- a/source/blender/blenlib/BLI_system.h
+++ b/source/blender/blenlib/BLI_system.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,8 +12,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_SYSTEM_H__
@@ -23,8 +19,8 @@
#include <stdio.h>
-/** \file BLI_system.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
int BLI_cpu_support_sse2(void);
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h
index 8300f6242db..b5fc909d842 100644
--- a/source/blender/blenlib/BLI_task.h
+++ b/source/blender/blenlib/BLI_task.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,8 +12,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_TASK_H__
@@ -26,8 +22,8 @@
struct Link;
struct ListBase;
-/** \file BLI_task.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
@@ -52,7 +48,7 @@ typedef struct TaskScheduler TaskScheduler;
enum {
TASK_SCHEDULER_AUTO_THREADS = 0,
- TASK_SCHEDULER_SINGLE_THREAD = 1
+ TASK_SCHEDULER_SINGLE_THREAD = 1,
};
TaskScheduler *BLI_task_scheduler_create(int num_threads);
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 631a65ccade..c9c7ee51ea6 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_THREADS_H__
#define __BLI_THREADS_H__
-/** \file BLI_threads.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
extern "C" {
diff --git a/source/blender/blenlib/BLI_timecode.h b/source/blender/blenlib/BLI_timecode.h
index bc85b51791b..80f4a2d1927 100644
--- a/source/blender/blenlib/BLI_timecode.h
+++ b/source/blender/blenlib/BLI_timecode.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,13 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_TIMECODE_H__
#define __BLI_TIMECODE_H__
-/** \file BLI_timecode.h
- * \ingroup BLI
+/** \file
+ * \ingroup BLI
*/
#include "BLI_compiler_attrs.h"
diff --git a/source/blender/blenlib/BLI_timer.h b/source/blender/blenlib/BLI_timer.h
index 8f18d4fb3f4..15797df7bd6 100644
--- a/source/blender/blenlib/BLI_timer.h
+++ b/source/blender/blenlib/BLI_timer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,8 +15,6 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_TIMER_H__
@@ -26,8 +22,8 @@
#include "BLI_sys_types.h"
-/** \file BLI_timer.h
- * \ingroup BLI
+/** \file
+ * \ingroup BLI
*/
/* ret < 0: the timer will be removed.
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index f81bfc2f853..d3b285d0ddf 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_UTILDEFINES_H__
#define __BLI_UTILDEFINES_H__
-/** \file BLI_utildefines.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifdef __cplusplus
@@ -224,45 +216,6 @@ extern "C" {
b = tmp; \
} (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 VECMADD(v1, v2, v3, v4) { \
- *(v1) = *(v2) + *(v3) * (*(v4)); \
- *(v1 + 1) = *(v2 + 1) + *(v3 + 1) * (*(v4 + 1)); \
- *(v1 + 2) = *(v2 + 2) + *(v3 + 2) * (*(v4 + 2)); \
-} (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
-
/* some misc stuff.... */
/* avoid multiple access for supported compilers */
@@ -635,7 +588,7 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size);
/* Expands to an integer constant expression evaluating to a close upper bound
* on the number the number of decimal digits in a value expressible in the
- * integer type given by the argument (if it is a type name) or the the integer
+ * integer type given by the argument (if it is a type name) or the integer
* type of the argument (if it is an expression). The meaning of the resulting
* expression is unspecified for other arguments.
* i.e: DECIMAL_DIGITS_BOUND(uchar) is equal to 3. */
diff --git a/source/blender/blenlib/BLI_utildefines_iter.h b/source/blender/blenlib/BLI_utildefines_iter.h
index 094c1a4b3dc..32310fbdbc8 100644
--- a/source/blender/blenlib/BLI_utildefines_iter.h
+++ b/source/blender/blenlib/BLI_utildefines_iter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_UTILDEFINES_ITER_H__
#define __BLI_UTILDEFINES_ITER_H__
-/** \file BLI_utildefines_iter.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* General looping helpers, use `BLI_FOREACH` prefix.
*/
diff --git a/source/blender/blenlib/BLI_utildefines_stack.h b/source/blender/blenlib/BLI_utildefines_stack.h
index 224add91504..d3ae3b35928 100644
--- a/source/blender/blenlib/BLI_utildefines_stack.h
+++ b/source/blender/blenlib/BLI_utildefines_stack.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,16 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_UTILDEFINES_STACK_H__
#define __BLI_UTILDEFINES_STACK_H__
-/** \file BLI_utildefines_stack.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Macro's for a simple array based stack
- * \note Caller handles alloc & free).
+ * \note Caller handles alloc & free.
*/
/* only validate array-bounds in debug mode */
diff --git a/source/blender/blenlib/BLI_utildefines_variadic.h b/source/blender/blenlib/BLI_utildefines_variadic.h
index 7c15754fd83..3048b814383 100644
--- a/source/blender/blenlib/BLI_utildefines_variadic.h
+++ b/source/blender/blenlib/BLI_utildefines_variadic.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_UTILDEFINES_VARIADIC_H__
#define __BLI_UTILDEFINES_VARIADIC_H__
-/** \file BLI_utildefines_variadic.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
/* --- internal helpers --- */
diff --git a/source/blender/blenlib/BLI_uvproject.h b/source/blender/blenlib/BLI_uvproject.h
index 516a9b8b237..1cb29ae7391 100644
--- a/source/blender/blenlib/BLI_uvproject.h
+++ b/source/blender/blenlib/BLI_uvproject.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,16 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_UVPROJECT_H__
#define __BLI_UVPROJECT_H__
-/** \file BLI_uvproject.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
-struct ProjCameraInfo;
struct Object;
+struct ProjCameraInfo;
/* create uv info from the camera, needs to be freed */
struct ProjCameraInfo *BLI_uvproject_camera_info(struct Object *ob, float rotmat[4][4], float winx, float winy);
diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h
index 892d084f5ee..4d4c7c179e7 100644
--- a/source/blender/blenlib/BLI_vfontdata.h
+++ b/source/blender/blenlib/BLI_vfontdata.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_VFONTDATA_H__
#define __BLI_VFONTDATA_H__
-/** \file BLI_vfontdata.h
- * \ingroup bli
- * \brief A structure to represent vector fonts,
+/** \file
+ * \ingroup bli
+ * \brief A structure to represent vector fonts,
* and to load them from PostScript fonts.
*/
diff --git a/source/blender/blenlib/BLI_voronoi_2d.h b/source/blender/blenlib/BLI_voronoi_2d.h
index 8d1ff2d4c2b..93b4961a9ed 100644
--- a/source/blender/blenlib/BLI_voronoi_2d.h
+++ b/source/blender/blenlib/BLI_voronoi_2d.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,10 +15,6 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_VORONOI_2D_H__
@@ -28,8 +22,8 @@
struct ListBase;
-/** \file BLI_voronoi_2d.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
typedef struct VoronoiSite {
@@ -40,18 +34,24 @@ typedef struct VoronoiSite {
typedef struct VoronoiEdge {
struct VoronoiEdge *next, *prev;
- float start[2], end[2]; /* start and end points */
+ /* start and end points */
+ float start[2], end[2];
/* this fields are used during diagram computation only */
- float direction[2]; /* directional vector, from "start", points to "end", normal of |left, right| */
+ /* directional vector, from "start", points to "end", normal of |left, right| */
+ float direction[2];
- float left[2]; /* point on Voronoi place on the left side of edge */
- float right[2]; /* point on Voronoi place on the right side of edge */
+ /* point on Voronoi place on the left side of edge */
+ float left[2];
+ /* point on Voronoi place on the right side of edge */
+ float right[2];
- float f, g; /* directional coeffitients satisfying equation y = f * x + g (edge lies on this line) */
+ /* directional coeffitients satisfying equation y = f * x + g (edge lies on this line) */
+ float f, g;
- /* some edges consist of two parts, so we add the pointer to another part to connect them at the end of an algorithm */
+ /* some edges consist of two parts,
+ * so we add the pointer to another part to connect them at the end of an algorithm */
struct VoronoiEdge *neighbor;
} VoronoiEdge;
diff --git a/source/blender/blenlib/BLI_voxel.h b/source/blender/blenlib/BLI_voxel.h
index 815d319b6db..6d38109851d 100644
--- a/source/blender/blenlib/BLI_voxel.h
+++ b/source/blender/blenlib/BLI_voxel.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Matt Ebb, Raul Fernandez Hernandez (Farsthary).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_VOXEL_H__
#define __BLI_VOXEL_H__
-/** \file BLI_voxel.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
/** find the index number of a voxel, given x/y/z integer coords and resolution vector */
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h
index cf29a8652df..13ef63bcccb 100644
--- a/source/blender/blenlib/BLI_winstuff.h
+++ b/source/blender/blenlib/BLI_winstuff.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLI_WINSTUFF_H__
#define __BLI_WINSTUFF_H__
-/** \file BLI_winstuff.h
- * \ingroup bli
- * \brief Compatibility-like things for windows.
+/** \file
+ * \ingroup bli
+ * \brief Compatibility-like things for windows.
*/
#ifndef _WIN32
@@ -59,9 +51,6 @@
#undef rct1
#undef rct2
-#define near clipsta
-#define far clipend
-
#undef small
// These definitions are also in BLI_math for simplicity
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 90d24d0b84e..f1aac6cd5b2 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/blenlib/PIL_time.h b/source/blender/blenlib/PIL_time.h
index 077e48772e5..e9843685f72 100644
--- a/source/blender/blenlib/PIL_time.h
+++ b/source/blender/blenlib/PIL_time.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/PIL_time.h
- * \ingroup bli
- * \brief Platform independent time functions.
+/** \file
+ * \ingroup bli
+ * \brief Platform independent time functions.
*/
#ifndef __PIL_TIME_H__
diff --git a/source/blender/blenlib/PIL_time_utildefines.h b/source/blender/blenlib/PIL_time_utildefines.h
index 412cfb3a090..712ad0e30fc 100644
--- a/source/blender/blenlib/PIL_time_utildefines.h
+++ b/source/blender/blenlib/PIL_time_utildefines.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/PIL_time_utildefines.h
- * \ingroup bli
- * \brief Utility defines for timing/benchmarks.
+/** \file
+ * \ingroup bli
+ * \brief Utility defines for timing/benchmarks.
*/
#ifndef __PIL_TIME_UTILDEFINES_H__
diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c
index 4eebcd46374..dbd609d914a 100644
--- a/source/blender/blenlib/intern/BLI_args.c
+++ b/source/blender/blenlib/intern/BLI_args.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_args.c
- * \ingroup bli
- * \brief A general argument parsing module
+/** \file
+ * \ingroup bli
+ * \brief A general argument parsing module
*/
#include <ctype.h> /* for tolower */
diff --git a/source/blender/blenlib/intern/BLI_array.c b/source/blender/blenlib/intern/BLI_array.c
index 0380656a33a..6c22b128f5c 100644
--- a/source/blender/blenlib/intern/BLI_array.c
+++ b/source/blender/blenlib/intern/BLI_array.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_array.c
- * \ingroup bli
- * \brief A (mainly) macro array library.
+/** \file
+ * \ingroup bli
+ * \brief A (mainly) macro array library.
*
* This is an array library, used to manage array (re)allocation.
*
diff --git a/source/blender/blenlib/intern/BLI_dial_2d.c b/source/blender/blenlib/intern/BLI_dial_2d.c
index 1f4c59ac2fb..882d239aa4b 100644
--- a/source/blender/blenlib/intern/BLI_dial_2d.c
+++ b/source/blender/blenlib/intern/BLI_dial_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_dial_2d.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_dial_2d.h"
@@ -66,7 +62,8 @@ float BLI_dial_angle(Dial *dial, const float current_position[2])
sub_v2_v2v2(current_direction, current_position, dial->center);
- /* only update when we have enough precision, by having the mouse adequately away from center */
+ /* only update when we have enough precision,
+ * by having the mouse adequately away from center */
if (len_squared_v2(current_direction) > dial->threshold_squared) {
float angle;
float cosval, sinval;
@@ -86,7 +83,8 @@ float BLI_dial_angle(Dial *dial, const float current_position[2])
angle = atan2f(sinval, cosval);
/* change of sign, we passed the 180 degree threshold. This means we need to add a turn.
- * to distinguish between transition from 0 to -1 and -PI to +PI, use comparison with PI/2 */
+ * to distinguish between transition from 0 to -1 and -PI to +PI,
+ * use comparison with PI/2 */
if ((angle * dial->last_angle < 0.0f) &&
(fabsf(dial->last_angle) > (float)M_PI_2))
{
diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c
index c1f9906cc12..98682101c65 100644
--- a/source/blender/blenlib/intern/BLI_dynstr.c
+++ b/source/blender/blenlib/intern/BLI_dynstr.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* Dynamically sized string ADT
*/
-/** \file blender/blenlib/intern/BLI_dynstr.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdlib.h> /* malloc */
diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c
index 76de52bda66..8cbba2103d3 100644
--- a/source/blender/blenlib/intern/BLI_filelist.c
+++ b/source/blender/blenlib/intern/BLI_filelist.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_filelist.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <sys/types.h>
@@ -179,7 +175,8 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
file->type = file->s.st_mode;
}
else if (FILENAME_IS_CURRPAR(file->relname)) {
- /* Hack around for UNC paths on windows - does not support stat on '\\SERVER\foo\..', sigh... */
+ /* Hack around for UNC paths on windows:
+ * does not support stat on '\\SERVER\foo\..', sigh... */
file->type |= S_IFDIR;
}
dir_ctx->nrfiles++;
@@ -237,7 +234,6 @@ unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **r
/**
* Convert given entry's size into human-readable strings.
- *
*/
void BLI_filelist_entry_size_to_string(
const struct stat *st, const uint64_t sz, const bool compact, char r_size[FILELIST_DIRENTRY_SIZE_LEN])
@@ -270,7 +266,6 @@ void BLI_filelist_entry_size_to_string(
/**
* Convert given entry's modes into human-readable strings.
- *
*/
void BLI_filelist_entry_mode_to_string(
const struct stat *st, const bool UNUSED(compact), char r_mode1[FILELIST_DIRENTRY_MODE_LEN],
@@ -307,7 +302,6 @@ void BLI_filelist_entry_mode_to_string(
/**
* Convert given entry's owner into human-readable strings.
- *
*/
void BLI_filelist_entry_owner_to_string(
const struct stat *st, const bool UNUSED(compact), char r_owner[FILELIST_DIRENTRY_OWNER_LEN])
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 3c5fbf5c6e9..fc432c8c8b7 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_ghash.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* A general (pointer -> pointer) chaining hash table
* for 'Abstract Data Types' (known as an ADT Hash Table).
@@ -62,12 +54,14 @@
*
* \note Also used by: `BLI_edgehash` & `BLI_smallhash`.
*/
-const uint hashsizes[] = {
+extern const uint BLI_ghash_hash_sizes[]; /* Quiet warning, this is only used by smallhash.c */
+const uint BLI_ghash_hash_sizes[] = {
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,
- 268435459
+ 268435459,
};
+#define hashsizes BLI_ghash_hash_sizes
#ifdef GHASH_USE_MODULO_BUCKETS
# define GHASH_MAX_SIZE 27
@@ -242,8 +236,8 @@ static void ghash_buckets_resize(GHash *gh, const uint nbuckets)
buckets_new[bucket_index] = e;
}
#else
- /* No need to recompute hashes in this case, since our mask is just smaller, all items in old bucket i
- * will go in same new bucket (i & new_mask)! */
+ /* No need to recompute hashes in this case, since our mask is just smaller,
+ * all items in old bucket 'i' will go in same new bucket (i & new_mask)! */
const unsigned bucket_index = ghash_bucket_index(gh, i);
BLI_assert(!buckets_old[i] || (bucket_index == ghash_bucket_index(gh, ghash_entryhash(gh, buckets_old[i]))));
Entry *e;
@@ -614,8 +608,9 @@ static Entry *ghash_pop(GHash *gh, GHashIterState *state)
return NULL;
}
- /* Note: using first_bucket_index here allows us to avoid potential huge number of loops over buckets,
- * in case we are popping from a large ghash with few items in it... */
+ /* Note: using first_bucket_index here allows us to avoid potential
+ * huge number of loops over buckets,
+ * in case we are popping from a large ghash with few items in it... */
curr_bucket = ghash_find_next_bucket_index(gh, curr_bucket);
Entry *e = gh->buckets[curr_bucket];
@@ -681,7 +676,8 @@ static GHash *ghash_copy(GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP val
* This means entries in buckets in new copy will be in reversed order!
* This shall not be an issue though, since order should never be assumed in ghash. */
- /* Note: We can use 'i' here, since we are sure that 'gh' and 'gh_new' have the same number of buckets! */
+ /* Note: We can use 'i' here, since we are sure that
+ * 'gh' and 'gh_new' have the same number of buckets! */
e_new->next = gh_new->buckets[i];
gh_new->buckets[i] = e_new;
}
diff --git a/source/blender/blenlib/intern/BLI_ghash_utils.c b/source/blender/blenlib/intern/BLI_ghash_utils.c
index a0d9fefe465..5e271c21830 100644
--- a/source/blender/blenlib/intern/BLI_ghash_utils.c
+++ b/source/blender/blenlib/intern/BLI_ghash_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_ghash_utils.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Helper functions and implementations of standard data types for #GHash
* (not it's implementation).
@@ -203,8 +195,8 @@ bool BLI_ghashutil_paircmp(const void *a, const void *b)
const GHashPair *A = a;
const GHashPair *B = b;
- return (BLI_ghashutil_ptrcmp(A->first, B->first) ||
- BLI_ghashutil_ptrcmp(A->second, B->second));
+ return ((A->first != B->first) ||
+ (A->second != B->second));
}
void BLI_ghashutil_pairfree(void *ptr)
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index c785c1ac012..0e5cfd02939 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Brecht Van Lommel
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_heap.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* A min-heap / priority queue ADT.
*/
diff --git a/source/blender/blenlib/intern/BLI_heap_simple.c b/source/blender/blenlib/intern/BLI_heap_simple.c
index 777b9c61b28..50eb06e5d5d 100644
--- a/source/blender/blenlib/intern/BLI_heap_simple.c
+++ b/source/blender/blenlib/intern/BLI_heap_simple.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_heap_simple.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* A min-heap / priority queue ADT.
*
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 7959ca4c0f2..7199c4126d4 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2006 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Daniel Genrich, Andre Pinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_kdopbvh.c
- * \ingroup bli
- * \brief BVH-tree implementation.
+/** \file
+ * \ingroup bli
+ * \brief BVH-tree implementation.
*
* k-DOP BVH (Discrete Oriented Polytope, Bounding Volume Hierarchy).
* A k-DOP is represented as k/2 pairs of min , max values for k/2 directions (intervals, "slabs").
@@ -83,7 +75,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Struct Definitions
* \{ */
@@ -194,12 +185,11 @@ typedef struct BVHNearestProjectedData {
const float bvhtree_kdop_axes[13][3] = {
{1.0, 0, 0}, {0, 1.0, 0}, {0, 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, 0}, {1.0, 0, 1.0}, {0, 1.0, 1.0}, {1.0, -1.0, 0}, {1.0, 0, -1.0}, {0, 1.0, -1.0}
+ {1.0, 1.0, 0}, {1.0, 0, 1.0}, {0, 1.0, 1.0}, {1.0, -1.0, 0}, {1.0, 0, -1.0}, {0, 1.0, -1.0},
};
/* -------------------------------------------------------------------- */
-
/** \name Utility Functions
* \{ */
@@ -238,7 +228,6 @@ static void node_minmax_init(const BVHTree *tree, BVHNode *node)
/* -------------------------------------------------------------------- */
-
/** \name Balance Utility Functions
* \{ */
@@ -279,7 +268,8 @@ static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode *x, int axis)
}
}
-static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis) /* returns Sortable */
+/* returns Sortable */
+static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis)
{
if ((a[mid])->bv[axis] < (a[lo])->bv[axis]) {
if ((a[hi])->bv[axis] < (a[mid])->bv[axis])
@@ -544,13 +534,16 @@ static void bvhtree_verify(BVHTree *tree)
* This code can be easily reduced
* (basicly this is only method to calculate pow(k, n) in O(1).. and stuff like that) */
typedef struct BVHBuildHelper {
- int tree_type; /* */
- int totleafs; /* */
+ int tree_type;
+ int totleafs;
- int leafs_per_child[32]; /* Min number of leafs that are archievable from a node at depth N */
- int branches_on_level[32]; /* Number of nodes at depth N (tree_type^N) */
+ /** Min number of leafs that are archievable from a node at depth N */
+ int leafs_per_child[32];
+ /** Number of nodes at depth N (tree_type^N) */
+ int branches_on_level[32];
- int remain_leafs; /* Number of leafs that are placed on the level that is not 100% filled */
+ /** Number of leafs that are placed on the level that is not 100% filled */
+ int remain_leafs;
} BVHBuildHelper;
@@ -610,8 +603,6 @@ static int implicit_leafs_index(const BVHBuildHelper *data, const int depth, con
* - No need to store child/parent relations (they are implicit);
* - Any node child always has an index greater than the parent;
* - Brother nodes are sequential in memory;
- *
- *
* Some math relations derived for general implicit trees:
*
* K = tree_type, ( 2 <= K )
@@ -699,17 +690,20 @@ static void non_recursive_bvh_div_nodes_task_cb(
nth_positions[data->tree_type] = parent_leafs_end;
for (k = 1; k < data->tree_type; k++) {
const int child_index = j * data->tree_type + data->tree_offset + k;
- const int child_level_index = child_index - data->first_of_next_level; /* child level index */
+ /* child level index */
+ const int child_level_index = child_index - data->first_of_next_level;
nth_positions[k] = implicit_leafs_index(data->data, data->depth + 1, child_level_index);
}
split_leafs(data->leafs_array, nth_positions, data->tree_type, split_axis);
/* Setup children and totnode counters
- * Not really needed but currently most of BVH code relies on having an explicit children structure */
+ * Not really needed but currently most of BVH code
+ * relies on having an explicit children structure */
for (k = 0; k < data->tree_type; k++) {
const int child_index = j * data->tree_type + data->tree_offset + k;
- const int child_level_index = child_index - data->first_of_next_level; /* child level index */
+ /* child level index */
+ const int child_level_index = child_index - data->first_of_next_level;
const int child_leafs_begin = implicit_leafs_index(data->data, data->depth + 1, child_level_index);
const int child_leafs_end = implicit_leafs_index(data->data, data->depth + 1, child_level_index + 1);
@@ -751,7 +745,9 @@ static void non_recursive_bvh_div_nodes(
int i;
const int tree_type = tree->tree_type;
- const int tree_offset = 2 - tree->tree_type; /* this value is 0 (on binary trees) and negative on the others */
+ /* this value is 0 (on binary trees) and negative on the others */
+ const int tree_offset = 2 - tree->tree_type;
+
const int num_branches = implicit_needed_branches(tree_type, num_leafs);
BVHBuildHelper data;
@@ -785,7 +781,8 @@ static void non_recursive_bvh_div_nodes(
/* Loop tree levels (log N) loops */
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 i_stop = min_ii(first_of_next_level, num_branches + 1); /* index of last branch on this level */
+ /* index of last branch on this level */
+ const int i_stop = min_ii(first_of_next_level, num_branches + 1);
/* Loop all branches on this level */
cb_data.first_of_next_level = first_of_next_level;
@@ -816,7 +813,6 @@ static void non_recursive_bvh_div_nodes(
/* -------------------------------------------------------------------- */
-
/** \name BLI_bvhtree API
* \{ */
@@ -834,7 +830,8 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
/* tree epsilon must be >= FLT_EPSILON
* so that tangent rays can still hit a bounding volume..
- * this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces */
+ * this bug would show up when casting a ray aligned with a kdop-axis
+ * and with an edge of 2 faces */
epsilon = max_ff(FLT_EPSILON, epsilon);
if (tree) {
@@ -897,23 +894,17 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
fail:
- MEM_SAFE_FREE(tree->nodes);
- MEM_SAFE_FREE(tree->nodebv);
- MEM_SAFE_FREE(tree->nodechild);
- MEM_SAFE_FREE(tree->nodearray);
-
- MEM_freeN(tree);
-
+ BLI_bvhtree_free(tree);
return NULL;
}
void BLI_bvhtree_free(BVHTree *tree)
{
if (tree) {
- MEM_freeN(tree->nodes);
- MEM_freeN(tree->nodearray);
- MEM_freeN(tree->nodebv);
- MEM_freeN(tree->nodechild);
+ MEM_SAFE_FREE(tree->nodes);
+ MEM_SAFE_FREE(tree->nodearray);
+ MEM_SAFE_FREE(tree->nodebv);
+ MEM_SAFE_FREE(tree->nodechild);
MEM_freeN(tree);
}
}
@@ -1037,7 +1028,6 @@ float BLI_bvhtree_get_epsilon(const BVHTree *tree)
/* -------------------------------------------------------------------- */
-
/** \name BLI_bvhtree_overlap
* \{ */
@@ -1255,11 +1245,11 @@ BVHTreeOverlap *BLI_bvhtree_overlap(
/* -------------------------------------------------------------------- */
-
/** \name BLI_bvhtree_find_nearest
* \{ */
-/* Determines the nearest point of the given node BV. Returns the squared distance to that point. */
+/* Determines the nearest point of the given node BV.
+ * Returns the squared distance to that point. */
static float calc_nearest_point_squared(const float proj[3], BVHNode *node, float nearest[3])
{
int i;
@@ -1423,7 +1413,6 @@ int BLI_bvhtree_find_nearest(
/* -------------------------------------------------------------------- */
-
/** \name BLI_bvhtree_ray_cast
*
* raycast is done by performing a DFS on the BVHTree and saving the closest hit.
@@ -1719,7 +1708,6 @@ void BLI_bvhtree_ray_cast_all(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name BLI_bvhtree_range_query
*
* Allocs and fills an array with the indexs of node that are on the given spherical range (center, radius).
@@ -1743,7 +1731,8 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
{
if (node->totnode == 0) {
#if 0 /*UNUSED*/
- /* Calculate the node min-coords (if the node was a point then this is the point coordinates) */
+ /* Calculate the node min-coords
+ * (if the node was a point then this is the point coordinates) */
float co[3];
co[0] = node->bv[0];
co[1] = node->bv[2];
@@ -1804,9 +1793,8 @@ int BLI_bvhtree_range_query(
/* -------------------------------------------------------------------- */
-
/** \name BLI_bvhtree_nearest_projected
-* \{ */
+ * \{ */
static void bvhtree_nearest_projected_dfs_recursive(
BVHNearestProjectedData *__restrict data, const BVHNode *node)
@@ -1996,7 +1984,6 @@ int BLI_bvhtree_find_nearest_projected(
/* -------------------------------------------------------------------- */
-
/** \name BLI_bvhtree_walk_dfs
* \{ */
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index 9265c8ee562..ce06324ebca 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Janne Karhu
- * Brecht Van Lommel
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_kdtree.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "MEM_guardedalloc.h"
@@ -61,6 +54,9 @@ struct KDTree {
#define KD_NODE_UNSET ((uint)-1)
+/** When set we know all values are unbalanced, otherwise clear them when re-balancing: see T62210. */
+#define KD_NODE_ROOT_IS_INIT ((uint)-2)
+
/**
* Creates or free a kdtree
*/
@@ -71,7 +67,7 @@ KDTree *BLI_kdtree_new(uint maxsize)
tree = MEM_mallocN(sizeof(KDTree), "KDTree");
tree->nodes = MEM_mallocN(sizeof(KDTreeNode) * maxsize, "KDTreeNode");
tree->totnode = 0;
- tree->root = KD_NODE_UNSET;
+ tree->root = KD_NODE_ROOT_IS_INIT;
#ifdef DEBUG
tree->is_balanced = false;
@@ -163,6 +159,13 @@ static uint kdtree_balance(KDTreeNode *nodes, uint totnode, uint axis, const uin
void BLI_kdtree_balance(KDTree *tree)
{
+ if (tree->root != KD_NODE_ROOT_IS_INIT) {
+ for (uint i = 0; i < tree->totnode; i++) {
+ tree->nodes[i].left = KD_NODE_UNSET;
+ tree->nodes[i].right = KD_NODE_UNSET;
+ }
+ }
+
tree->root = kdtree_balance(tree->nodes, tree->totnode, 0, 0);
#ifdef DEBUG
diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c
index 80d5cbc8cd0..46499279659 100644
--- a/source/blender/blenlib/intern/BLI_linklist.c
+++ b/source/blender/blenlib/intern/BLI_linklist.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* Support for linked lists.
*/
-/** \file blender/blenlib/intern/BLI_linklist.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Routines for working with single linked lists of 'links' - pointers to other data.
*
diff --git a/source/blender/blenlib/intern/BLI_linklist_lockfree.c b/source/blender/blenlib/intern/BLI_linklist_lockfree.c
index ef93ce3619f..d5dca86ae50 100644
--- a/source/blender/blenlib/intern/BLI_linklist_lockfree.c
+++ b/source/blender/blenlib/intern/BLI_linklist_lockfree.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_linklist_lockfree.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c
index 2604dbafdc0..8be64a44d2c 100644
--- a/source/blender/blenlib/intern/BLI_memarena.c
+++ b/source/blender/blenlib/intern/BLI_memarena.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * Efficient memory allocation for lots of similar small chunks.
*/
-/** \file blender/blenlib/intern/BLI_memarena.c
- * \ingroup bli
- * \brief Memory arena ADT.
- * \section aboutmemarena Memory Arena
+/** \file
+ * \ingroup bli
+ * \brief Efficient memory allocation for many small chunks.
+ * \section aboutmemarena Memory Arena
*
* Memory arena's are commonly used when the program
* needs to quickly allocate lots of little bits of data,
@@ -45,17 +36,36 @@
#include "BLI_utildefines.h"
#include "BLI_memarena.h"
-#include "BLI_linklist.h"
#include "BLI_strict_flags.h"
#ifdef WITH_MEM_VALGRIND
# include "valgrind/memcheck.h"
+#else
+# define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) UNUSED_VARS(pool, rzB, is_zeroed)
+# define VALGRIND_DESTROY_MEMPOOL(pool) UNUSED_VARS(pool)
+# define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) UNUSED_VARS(pool, addr, size)
+#endif
+
+/* Clang defines this. */
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
+#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
+# include "sanitizer/asan_interface.h"
+#else
+# define ASAN_POISON_MEMORY_REGION(addr, size) UNUSED_VARS(addr, size)
+# define ASAN_UNPOISON_MEMORY_REGION(addr, size) UNUSED_VARS(addr, size)
#endif
+struct MemBuf {
+ struct MemBuf *next;
+ uchar data[0];
+};
+
struct MemArena {
unsigned char *curbuf;
const char *name;
- LinkNode *bufs;
+ struct MemBuf *bufs;
size_t bufsize, cursize;
size_t align;
@@ -63,6 +73,15 @@ struct MemArena {
bool use_calloc;
};
+static void memarena_buf_free_all(struct MemBuf *mb)
+{
+ while (mb != NULL) {
+ struct MemBuf *mb_next = mb->next;
+ MEM_freeN(mb);
+ mb = mb_next;
+ }
+}
+
MemArena *BLI_memarena_new(const size_t bufsize, const char *name)
{
MemArena *ma = MEM_callocN(sizeof(*ma), "memarena");
@@ -70,9 +89,7 @@ MemArena *BLI_memarena_new(const size_t bufsize, const char *name)
ma->align = 8;
ma->name = name;
-#ifdef WITH_MEM_VALGRIND
VALGRIND_CREATE_MEMPOOL(ma, 0, false);
-#endif
return ma;
}
@@ -89,25 +106,25 @@ void BLI_memarena_use_malloc(MemArena *ma)
void BLI_memarena_use_align(struct MemArena *ma, const size_t align)
{
- /* align should be a power of two */
+ /* Align must be a power of two. */
+ BLI_assert((align & (align - 1)) == 0);
+
ma->align = align;
}
void BLI_memarena_free(MemArena *ma)
{
- BLI_linklist_freeN(ma->bufs);
+ memarena_buf_free_all(ma->bufs);
-#ifdef WITH_MEM_VALGRIND
VALGRIND_DESTROY_MEMPOOL(ma);
-#endif
MEM_freeN(ma);
}
-/* amt must be power of two */
+/** Pad num up by \a amt (must be power of two). */
#define PADUP(num, amt) (((num) + ((amt) - 1)) & ~((amt) - 1))
-/* align alloc'ed memory (needed if align > 8) */
+/** Align alloc'ed memory (needed if `align > 8`). */
static void memarena_curbuf_align(MemArena *ma)
{
unsigned char *tmp;
@@ -121,8 +138,7 @@ void *BLI_memarena_alloc(MemArena *ma, size_t size)
{
void *ptr;
- /* ensure proper alignment by rounding
- * size up to multiple of 8 */
+ /* Ensure proper alignment by rounding size up to multiple of 8. */
size = PADUP(size, ma->align);
if (UNLIKELY(size > ma->cursize)) {
@@ -133,8 +149,13 @@ void *BLI_memarena_alloc(MemArena *ma, size_t size)
ma->cursize = ma->bufsize;
}
- ma->curbuf = (ma->use_calloc ? MEM_callocN : MEM_mallocN)(ma->cursize, ma->name);
- BLI_linklist_prepend(&ma->bufs, ma->curbuf);
+ struct MemBuf *mb = (ma->use_calloc ? MEM_callocN : MEM_mallocN)(sizeof(*mb) + ma->cursize, ma->name);
+ ma->curbuf = mb->data;
+ mb->next = ma->bufs;
+ ma->bufs = mb;
+
+ ASAN_POISON_MEMORY_REGION(ma->curbuf, ma->cursize);
+
memarena_curbuf_align(ma);
}
@@ -142,9 +163,9 @@ void *BLI_memarena_alloc(MemArena *ma, size_t size)
ma->curbuf += size;
ma->cursize -= size;
-#ifdef WITH_MEM_VALGRIND
VALGRIND_MEMPOOL_ALLOC(ma, ptr, size);
-#endif
+
+ ASAN_UNPOISON_MEMORY_REGION(ptr, size);
return ptr;
}
@@ -153,7 +174,7 @@ void *BLI_memarena_calloc(MemArena *ma, size_t size)
{
void *ptr;
- /* no need to use this function call if we're calloc'ing by default */
+ /* No need to use this function call if we're calloc'ing by default. */
BLI_assert(ma->use_calloc == false);
ptr = BLI_memarena_alloc(ma, size);
@@ -173,12 +194,12 @@ void BLI_memarena_clear(MemArena *ma)
size_t curbuf_used;
if (ma->bufs->next) {
- BLI_linklist_freeN(ma->bufs->next);
+ memarena_buf_free_all(ma->bufs->next);
ma->bufs->next = NULL;
}
curbuf_prev = ma->curbuf;
- ma->curbuf = ma->bufs->link;
+ ma->curbuf = ma->bufs->data;
memarena_curbuf_align(ma);
/* restore to original size */
@@ -188,11 +209,9 @@ void BLI_memarena_clear(MemArena *ma)
if (ma->use_calloc) {
memset(ma->curbuf, 0, curbuf_used);
}
+ ASAN_POISON_MEMORY_REGION(ma->curbuf, ma->cursize);
}
-#ifdef WITH_MEM_VALGRIND
VALGRIND_DESTROY_MEMPOOL(ma);
VALGRIND_CREATE_MEMPOOL(ma, 0, false);
-#endif
-
}
diff --git a/source/blender/blenlib/intern/BLI_memiter.c b/source/blender/blenlib/intern/BLI_memiter.c
index 9c5f026f836..df8a1de84e4 100644
--- a/source/blender/blenlib/intern/BLI_memiter.c
+++ b/source/blender/blenlib/intern/BLI_memiter.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_memiter.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Simple, fast memory allocator for allocating many small elements of different sizes
* in fixed size memory chunks,
@@ -52,6 +48,19 @@
#include "BLI_strict_flags.h" /* keep last */
+/* TODO: Valgrind. */
+
+/* Clang defines this. */
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
+#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
+# include "sanitizer/asan_interface.h"
+#else
+# define ASAN_POISON_MEMORY_REGION(addr, size) UNUSED_VARS(addr, size)
+# define ASAN_UNPOISON_MEMORY_REGION(addr, size) UNUSED_VARS(addr, size)
+#endif
+
typedef uintptr_t data_t;
typedef intptr_t offset_t;
@@ -104,6 +113,9 @@ BLI_INLINE uint data_offset_from_size(uint size)
static void memiter_set_rewind_offset(BLI_memiter *mi)
{
BLI_memiter_elem *elem = (BLI_memiter_elem *)mi->data_curr;
+
+ ASAN_UNPOISON_MEMORY_REGION(elem, sizeof(BLI_memiter_elem));
+
elem->size = (offset_t)(((data_t *)mi->tail) - mi->data_curr);
BLI_assert(elem->size < 0);
}
@@ -121,7 +133,6 @@ static void memiter_init(BLI_memiter *mi)
}
/* -------------------------------------------------------------------- */
-
/** \name Public API's
* \{ */
@@ -187,11 +198,16 @@ void *BLI_memiter_alloc(BLI_memiter *mi, uint elem_size)
mi->data_curr = chunk->data;
mi->data_last = chunk->data + (chunk_size - 1);
data_curr_next = mi->data_curr + (1 + data_offset);
+
+ ASAN_POISON_MEMORY_REGION(chunk->data, chunk_size * sizeof(data_t));
}
BLI_assert(data_curr_next <= mi->data_last);
BLI_memiter_elem *elem = (BLI_memiter_elem *)mi->data_curr;
+
+ ASAN_UNPOISON_MEMORY_REGION(elem, sizeof(BLI_memiter_elem) + elem_size);
+
elem->size = (offset_t)elem_size;
mi->data_curr = data_curr_next;
@@ -252,7 +268,6 @@ uint BLI_memiter_count(const BLI_memiter *mi)
/* -------------------------------------------------------------------- */
-
/** \name Helper API's
* \{ */
@@ -286,7 +301,6 @@ void *BLI_memiter_elem_first_size(BLI_memiter *mi, uint *r_size)
/* -------------------------------------------------------------------- */
-
/** \name Iterator API's
*
* \note We could loop over elements until a NULL chunk is found,
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index b2cd7e58696..5acc84da288 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2008 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffery Bantle
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_mempool.c
- * \ingroup bli
- * \author Geoffrey Bantle
+/** \file
+ * \ingroup bli
*
* Simple, fast memory allocator for allocating many elements of the same size.
*
@@ -87,9 +78,6 @@
/* currently totalloc isnt used */
// #define USE_TOTALLOC
-/* when undefined, merge the allocs for BLI_mempool_chunk and its data */
-// #define USE_DATA_PTR
-
/* optimize pool size */
#define USE_CHUNK_POW2
@@ -106,7 +94,8 @@ static bool mempool_debug_memset = false;
*/
typedef struct BLI_freenode {
struct BLI_freenode *next;
- intptr_t freeword; /* used to identify this as a freed node */
+ /** Used to identify this as a freed node. */
+ intptr_t freeword;
} BLI_freenode;
/**
@@ -115,51 +104,48 @@ typedef struct BLI_freenode {
*/
typedef struct BLI_mempool_chunk {
struct BLI_mempool_chunk *next;
-#ifdef USE_DATA_PTR
- void *_data;
-#endif
} BLI_mempool_chunk;
/**
* The mempool, stores and tracks memory \a chunks and elements within those chunks \a free.
*/
struct BLI_mempool {
- BLI_mempool_chunk *chunks; /* single linked list of allocated chunks */
- /* keep a pointer to the last, so we can append new chunks there
- * this is needed for iteration so we can loop over chunks in the order added */
+ /** Single linked list of allocated chunks. */
+ BLI_mempool_chunk *chunks;
+ /** Keep a pointer to the last, so we can append new chunks there
+ * this is needed for iteration so we can loop over chunks in the order added. */
BLI_mempool_chunk *chunk_tail;
- uint esize; /* element size in bytes */
- uint csize; /* chunk size in bytes */
- uint pchunk; /* number of elements per chunk */
+ /** Element size in bytes. */
+ uint esize;
+ /** Chunk size in bytes. */
+ uint csize;
+ /** Number of elements per chunk. */
+ uint pchunk;
uint flag;
/* keeps aligned to 16 bits */
- BLI_freenode *free; /* free element list. Interleaved into chunk datas. */
- uint maxchunks; /* use to know how many chunks to keep for BLI_mempool_clear */
- uint totused; /* number of elements currently in use */
+ /** Free element list. Interleaved into chunk datas. */
+ BLI_freenode *free;
+ /** Use to know how many chunks to keep for #BLI_mempool_clear. */
+ uint maxchunks;
+ /** Number of elements currently in use. */
+ uint totused;
#ifdef USE_TOTALLOC
- uint totalloc; /* number of elements allocated in total */
+ /** Number of elements allocated in total. */
+ uint totalloc;
#endif
};
#define MEMPOOL_ELEM_SIZE_MIN (sizeof(void *) * 2)
-#ifdef USE_DATA_PTR
-# define CHUNK_DATA(chunk) (chunk)->_data
-#else
-# define CHUNK_DATA(chunk) (CHECK_TYPE_INLINE(chunk, BLI_mempool_chunk *), (void *)((chunk) + 1))
-#endif
+#define CHUNK_DATA(chunk) (CHECK_TYPE_INLINE(chunk, BLI_mempool_chunk *), (void *)((chunk) + 1))
#define NODE_STEP_NEXT(node) ((void *)((char *)(node) + esize))
#define NODE_STEP_PREV(node) ((void *)((char *)(node) - esize))
-/* extra bytes implicitly used for every chunk alloc */
-#ifdef USE_DATA_PTR
-# define CHUNK_OVERHEAD (uint)(MEM_SIZE_OVERHEAD + sizeof(BLI_mempool_chunk))
-#else
-# define CHUNK_OVERHEAD (uint)(MEM_SIZE_OVERHEAD)
-#endif
+/** Extra bytes implicitly used for every chunk alloc. */
+#define CHUNK_OVERHEAD (uint)(MEM_SIZE_OVERHEAD + sizeof(BLI_mempool_chunk))
#ifdef USE_CHUNK_POW2
static uint power_of_2_max_u(uint x)
@@ -187,7 +173,6 @@ BLI_INLINE BLI_mempool_chunk *mempool_chunk_find(BLI_mempool_chunk *head, uint i
*
* \note for small pools 1 is a good default, the elements need to be initialized,
* adding overhead on creation which is redundant if they aren't used.
- *
*/
BLI_INLINE uint mempool_maxchunks(const uint totelem, const uint pchunk)
{
@@ -196,15 +181,7 @@ BLI_INLINE uint mempool_maxchunks(const uint totelem, const uint pchunk)
static BLI_mempool_chunk *mempool_chunk_alloc(BLI_mempool *pool)
{
- BLI_mempool_chunk *mpchunk;
-#ifdef USE_DATA_PTR
- mpchunk = MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
- CHUNK_DATA(mpchunk) = MEM_mallocN((size_t)pool->csize, "BLI Mempool Chunk Data");
-#else
- mpchunk = MEM_mallocN(sizeof(BLI_mempool_chunk) + (size_t)pool->csize, "BLI_Mempool Chunk");
-#endif
-
- return mpchunk;
+ return MEM_mallocN(sizeof(BLI_mempool_chunk) + (size_t)pool->csize, "BLI_Mempool Chunk");
}
/**
@@ -212,12 +189,13 @@ static BLI_mempool_chunk *mempool_chunk_alloc(BLI_mempool *pool)
*
* \param pool: The pool to add the chunk into.
* \param mpchunk: The new uninitialized chunk (can be malloc'd)
- * \param lasttail: The last element of the previous chunk
+ * \param last_tail: The last element of the previous chunk
* (used when building free chunks initially)
* \return The last chunk,
*/
-static BLI_freenode *mempool_chunk_add(BLI_mempool *pool, BLI_mempool_chunk *mpchunk,
- BLI_freenode *lasttail)
+static BLI_freenode *mempool_chunk_add(
+ BLI_mempool *pool, BLI_mempool_chunk *mpchunk,
+ BLI_freenode *last_tail)
{
const uint esize = pool->esize;
BLI_freenode *curnode = CHUNK_DATA(mpchunk);
@@ -256,7 +234,7 @@ static BLI_freenode *mempool_chunk_add(BLI_mempool *pool, BLI_mempool_chunk *mpc
}
/* terminate the list (rewind one)
- * will be overwritten if 'curnode' gets passed in again as 'lasttail' */
+ * will be overwritten if 'curnode' gets passed in again as 'last_tail' */
curnode = NODE_STEP_PREV(curnode);
curnode->next = NULL;
@@ -265,8 +243,8 @@ static BLI_freenode *mempool_chunk_add(BLI_mempool *pool, BLI_mempool_chunk *mpc
#endif
/* final pointer in the previously allocated chunk is wrong */
- if (lasttail) {
- lasttail->next = CHUNK_DATA(mpchunk);
+ if (last_tail) {
+ last_tail->next = CHUNK_DATA(mpchunk);
}
return curnode;
@@ -274,10 +252,6 @@ static BLI_freenode *mempool_chunk_add(BLI_mempool *pool, BLI_mempool_chunk *mpc
static void mempool_chunk_free(BLI_mempool_chunk *mpchunk)
{
-
-#ifdef USE_DATA_PTR
- MEM_freeN(CHUNK_DATA(mpchunk));
-#endif
MEM_freeN(mpchunk);
}
@@ -291,11 +265,12 @@ static void mempool_chunk_free_all(BLI_mempool_chunk *mpchunk)
}
}
-BLI_mempool *BLI_mempool_create(uint esize, uint totelem,
- uint pchunk, uint flag)
+BLI_mempool *BLI_mempool_create(
+ uint esize, uint totelem,
+ uint pchunk, uint flag)
{
BLI_mempool *pool;
- BLI_freenode *lasttail = NULL;
+ BLI_freenode *last_tail = NULL;
uint i, maxchunks;
/* allocate the pool structure */
@@ -315,18 +290,24 @@ BLI_mempool *BLI_mempool_create(uint esize, uint totelem,
pool->chunks = NULL;
pool->chunk_tail = NULL;
pool->esize = esize;
- pool->csize = esize * pchunk;
-
- /* Optimize chunk size to powers of 2, accounting for slop-space */
+ /* Optimize chunk size to powers of 2, accounting for slop-space. */
#ifdef USE_CHUNK_POW2
{
- BLI_assert(pool->csize > CHUNK_OVERHEAD);
- pool->csize = power_of_2_max_u(pool->csize) - CHUNK_OVERHEAD;
- pchunk = pool->csize / esize;
+ BLI_assert(power_of_2_max_u(pchunk * esize) > CHUNK_OVERHEAD);
+ pchunk = (power_of_2_max_u(pchunk * esize) - CHUNK_OVERHEAD) / esize;
}
#endif
+ pool->csize = esize * pchunk;
+
+ /* Ensure this is a power of 2, minus the rounding by element size. */
+#if defined(USE_CHUNK_POW2) && !defined(NDEBUG)
+ {
+ uint final_size = (uint)MEM_SIZE_OVERHEAD + (uint)sizeof(BLI_mempool_chunk) + pool->csize;
+ BLI_assert(((uint)power_of_2_max_u(final_size) - final_size) < pool->esize);
+ }
+#endif
pool->pchunk = pchunk;
pool->flag = flag;
@@ -338,10 +319,10 @@ BLI_mempool *BLI_mempool_create(uint esize, uint totelem,
pool->totused = 0;
if (totelem) {
- /* allocate the actual chunks */
+ /* Allocate the actual chunks. */
for (i = 0; i < maxchunks; i++) {
BLI_mempool_chunk *mpchunk = mempool_chunk_alloc(pool);
- lasttail = mempool_chunk_add(pool, mpchunk, lasttail);
+ last_tail = mempool_chunk_add(pool, mpchunk, last_tail);
}
}
@@ -357,7 +338,7 @@ void *BLI_mempool_alloc(BLI_mempool *pool)
BLI_freenode *free_pop;
if (UNLIKELY(pool->free == NULL)) {
- /* need to allocate a new chunk */
+ /* Need to allocate a new chunk. */
BLI_mempool_chunk *mpchunk = mempool_chunk_alloc(pool);
mempool_chunk_add(pool, mpchunk, NULL);
}
@@ -411,7 +392,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
}
}
- /* enable for debugging */
+ /* Enable for debugging. */
if (UNLIKELY(mempool_debug_memset)) {
memset(addr, 255, pool->esize);
}
@@ -419,7 +400,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
#ifndef NDEBUG
- /* this will detect double free's */
+ /* This will detect double free's. */
BLI_assert(newhead->freeword != FREEWORD);
#endif
newhead->freeword = FREEWORD;
@@ -434,7 +415,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
VALGRIND_MEMPOOL_FREE(pool, addr);
#endif
- /* nothing is in use; free all the chunks except the first */
+ /* Nothing is in use; free all the chunks except the first. */
if (UNLIKELY(pool->totused == 0) &&
(pool->chunks->next))
{
@@ -452,7 +433,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
pool->totalloc = pool->pchunk;
#endif
- /* temp alloc so valgrind doesn't complain when setting free'd blocks 'next' */
+ /* Temp alloc so valgrind doesn't complain when setting free'd blocks 'next'. */
#ifdef WITH_MEM_VALGRIND
VALGRIND_MEMPOOL_ALLOC(pool, CHUNK_DATA(first), pool->csize);
#endif
@@ -484,12 +465,12 @@ void *BLI_mempool_findelem(BLI_mempool *pool, uint index)
BLI_assert(pool->flag & BLI_MEMPOOL_ALLOW_ITER);
if (index < pool->totused) {
- /* we could have some faster mem chunk stepping code inline */
+ /* We could have some faster mem chunk stepping code inline. */
BLI_mempool_iter iter;
void *elem;
BLI_mempool_iternew(pool, &iter);
for (elem = BLI_mempool_iterstep(&iter); index-- != 0; elem = BLI_mempool_iterstep(&iter)) {
- /* do nothing */
+ /* pass */
}
return elem;
}
@@ -555,7 +536,7 @@ void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr)
}
/**
- * Initialize a new mempool iterator, \a BLI_MEMPOOL_ALLOW_ITER flag must be set.
+ * Initialize a new mempool iterator, #BLI_MEMPOOL_ALLOW_ITER flag must be set.
*/
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
{
@@ -569,7 +550,7 @@ void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
}
/**
- * Initialize an array of mempool iterators, \a BLI_MEMPOOL_ALLOW_ITER flag must be set.
+ * Initialize an array of mempool iterators, #BLI_MEMPOOL_ALLOW_ITER flag must be set.
*
* This is used in threaded code, to generate as much iterators as needed (each task should have its own),
* such that each iterator goes over its own single chunk, and only getting the next chunk to iterate over has to be
@@ -593,7 +574,8 @@ BLI_mempool_iter *BLI_mempool_iter_threadsafe_create(BLI_mempool *pool, const si
for (size_t i = 1; i < num_iter; i++) {
iter_arr[i] = iter_arr[0];
- *curchunk_threaded_shared = iter_arr[i].curchunk = (*curchunk_threaded_shared) ? (*curchunk_threaded_shared)->next : NULL;
+ *curchunk_threaded_shared = iter_arr[i].curchunk = (
+ (*curchunk_threaded_shared) ? (*curchunk_threaded_shared)->next : NULL);
}
return iter_arr;
@@ -630,7 +612,11 @@ static void *bli_mempool_iternext(BLI_mempool_iter *iter)
if (iter->curchunk == NULL) {
return ret;
}
- if (atomic_cas_ptr((void **)iter->curchunk_threaded_shared, iter->curchunk, iter->curchunk->next) == iter->curchunk) {
+ if (atomic_cas_ptr(
+ (void **)iter->curchunk_threaded_shared,
+ iter->curchunk,
+ iter->curchunk->next) == iter->curchunk)
+ {
break;
}
}
@@ -679,8 +665,14 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
if (iter->curchunk_threaded_shared) {
for (iter->curchunk = *iter->curchunk_threaded_shared;
(iter->curchunk != NULL) &&
- (atomic_cas_ptr((void **)iter->curchunk_threaded_shared, iter->curchunk, iter->curchunk->next) != iter->curchunk);
- iter->curchunk = *iter->curchunk_threaded_shared);
+ (atomic_cas_ptr(
+ (void **)iter->curchunk_threaded_shared,
+ iter->curchunk,
+ iter->curchunk->next) != iter->curchunk);
+ iter->curchunk = *iter->curchunk_threaded_shared)
+ {
+ /* pass. */
+ }
if (UNLIKELY(iter->curchunk == NULL)) {
return (ret->freeword == FREEWORD) ? NULL : ret;
@@ -712,7 +704,7 @@ void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve)
uint maxchunks;
BLI_mempool_chunk *chunks_temp;
- BLI_freenode *lasttail = NULL;
+ BLI_freenode *last_tail = NULL;
#ifdef WITH_MEM_VALGRIND
VALGRIND_DESTROY_MEMPOOL(pool);
@@ -726,7 +718,7 @@ void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve)
maxchunks = mempool_maxchunks((uint)totelem_reserve, pool->pchunk);
}
- /* free all after pool->maxchunks */
+ /* Free all after 'pool->maxchunks'. */
mpchunk = mempool_chunk_find(pool->chunks, maxchunks - 1);
if (mpchunk && mpchunk->next) {
/* terminate */
@@ -753,7 +745,7 @@ void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve)
while ((mpchunk = chunks_temp)) {
chunks_temp = mpchunk->next;
- lasttail = mempool_chunk_add(pool, mpchunk, lasttail);
+ last_tail = mempool_chunk_add(pool, mpchunk, last_tail);
}
}
diff --git a/source/blender/blenlib/intern/BLI_timer.c b/source/blender/blenlib/intern/BLI_timer.c
index fdd89771077..d361a1c563d 100644
--- a/source/blender/blenlib/intern/BLI_timer.c
+++ b/source/blender/blenlib/intern/BLI_timer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/BLI_timer.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_timer.h"
@@ -157,8 +153,8 @@ void BLI_timer_free()
remove_tagged_functions();
}
-struct Main;
struct ID;
+struct Main;
static void remove_non_persistent_functions(struct Main *UNUSED(_1), struct ID *UNUSED(_2), void *UNUSED(_3))
{
LISTBASE_FOREACH(TimedFunction *, timed_func, &GlobalTimer.funcs) {
@@ -168,7 +164,7 @@ static void remove_non_persistent_functions(struct Main *UNUSED(_1), struct ID *
}
}
-static bCallbackFuncStore load_post_callback = {
+static bCallbackFuncStore load_pre_callback = {
NULL, NULL, /* next, prev */
remove_non_persistent_functions, /* func */
NULL, /* arg */
@@ -178,7 +174,7 @@ static bCallbackFuncStore load_post_callback = {
static void ensure_callback_is_registered()
{
if (!GlobalTimer.file_load_cb_registered) {
- BLI_callback_add(&load_post_callback, BLI_CB_EVT_LOAD_POST);
+ BLI_callback_add(&load_pre_callback, BLI_CB_EVT_LOAD_PRE);
GlobalTimer.file_load_cb_registered = true;
}
}
diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c
index e331e070a4a..e74b1016bb1 100644
--- a/source/blender/blenlib/intern/DLRB_tree.c
+++ b/source/blender/blenlib/intern/DLRB_tree.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * Contributor(s): Joshua Leung (original author)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/DLRB_tree.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
@@ -443,7 +437,8 @@ static void insert_check_3(DLRBT_Tree *tree, DLRBT_Node *node)
{
DLRBT_Node *gp = get_grandparent(node);
- /* check that grandparent and node->parent exist (jut in case... really shouldn't happen on a good tree) */
+ /* check that grandparent and node->parent exist
+ * (jut in case... really shouldn't happen on a good tree) */
if (node && node->parent && gp) {
/* a left rotation will switch the roles of node and its parent, assuming that
* the parent is the left child of the grandparent... otherwise, rotation direction
@@ -466,13 +461,13 @@ static void insert_check_3(DLRBT_Tree *tree, DLRBT_Node *node)
/* get 'new' grandparent (i.e. grandparent for old-parent (node)) */
gp = get_grandparent(node);
- /* modify the coloring of the grandparent and parent so that they still satisfy the constraints */
+ /* modify the coloring of the grandparent and parent
+ * so that they still satisfy the constraints */
node->parent->tree_col = DLRBT_BLACK;
gp->tree_col = DLRBT_RED;
- /* if there are several nodes that all form a left chain, do a right rotation to correct this
- * (or a rotation in the opposite direction if they all form a right chain)
- */
+ /* if there are several nodes that all form a left chain, do a right rotation to correct
+ * this (or a rotation in the opposite direction if they all form a right chain) */
if ((node == node->parent->left) && (node->parent == gp->left))
rotate_right(tree, gp);
else //if ((node == node->parent->right) && (node->parent == gp->right))
@@ -502,7 +497,8 @@ void BLI_dlrbTree_insert(DLRBT_Tree *tree, DLRBT_Node *node)
/* ----- */
/* Add the given data to the tree, and return the node added */
-/* NOTE: for duplicates, the update_cb is called (if available), and the existing node is returned */
+/* NOTE: for duplicates, the update_cb is called (if available),
+ * and the existing node is returned */
DLRBT_Node *BLI_dlrbTree_add(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb,
DLRBT_NAlloc_FP new_cb, DLRBT_NUpdate_FP update_cb, void *data)
{
diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c
index 153ba3ea0d0..477d320835e 100644
--- a/source/blender/blenlib/intern/array_store.c
+++ b/source/blender/blenlib/intern/array_store.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,23 +12,17 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/array_store.c
- * \ingroup bli
- * \brief Array storage to minimize duplication.
+/** \file
+ * \ingroup bli
+ * \brief Array storage to minimize duplication.
*
* This is done by splitting arrays into chunks and using copy-on-write (COW),
* to de-duplicate chunks,
* from the users perspective this is an implementation detail.
- *
- *
* Overview
* ========
- *
- *
* Data Structure
* --------------
*
@@ -81,8 +73,6 @@
* All chunks, (reference counted, used by BChunkList).
* These have their headers hashed for reuse so we can quickly check for duplicates.
* </pre>
- *
- *
* De-Duplication
* --------------
*
@@ -473,7 +463,8 @@ static void bchunk_list_ensure_min_size_last(
BLI_mempool_free(bs_mem->chunk_ref, cref);
}
else {
- /* If we always merge small slices, we should _almost_ never end up having very large chunks.
+ /* If we always merge small slices, we should _almost_
+ * never end up having very large chunks.
* Gradual expanding on contracting will cause this.
*
* if we do, the code below works (test by setting 'BCHUNK_SIZE_MAX_MUL = 1.2') */
@@ -1324,8 +1315,8 @@ static BChunkList *bchunk_list_from_data_merge(
BChunk *chunk_found = cref_found->link;
if (bchunk_data_compare(chunk_found, data, data_len, i_prev)) {
- /* may be useful to remove table data, assuming we dont have repeating memory
- * where it would be useful to re-use chunks. */
+ /* may be useful to remove table data, assuming we dont have
+ * repeating memory where it would be useful to re-use chunks. */
i += chunk_found->data_len;
bchunk_list_append(info, bs_mem, chunk_list, chunk_found);
/* chunk_found may be freed! */
@@ -1377,7 +1368,8 @@ static BChunkList *bchunk_list_from_data_merge(
BChunk *chunk = cref->link;
// BLI_assert(bchunk_data_compare(chunk, data, data_len, i_prev));
i_prev += chunk->data_len;
- /* use simple since we assume the references chunks have already been sized correctly. */
+ /* use simple since we assume the references chunks
+ * have already been sized correctly. */
bchunk_list_append_only(bs_mem, chunk_list, chunk);
ASSERT_CHUNKLIST_DATA(chunk_list, data);
cref = cref->next;
diff --git a/source/blender/blenlib/intern/array_store_utils.c b/source/blender/blenlib/intern/array_store_utils.c
index 97e4207328b..d1b936b76f7 100644
--- a/source/blender/blenlib/intern/array_store_utils.c
+++ b/source/blender/blenlib/intern/array_store_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,13 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/array_store_utils.c
- * \ingroup bli
- * \brief Helper functions for BLI_array_store API.
+/** \file
+ * \ingroup bli
+ * \brief Helper functions for BLI_array_store API.
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/blenlib/intern/array_utils.c b/source/blender/blenlib/intern/array_utils.c
index 7b2d35a763c..568f3f9b9ff 100644
--- a/source/blender/blenlib/intern/array_utils.c
+++ b/source/blender/blenlib/intern/array_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,13 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/array_utils.c
- * \ingroup bli
- * \brief Generic array manipulation API.
+/** \file
+ * \ingroup bli
+ * \brief Generic array manipulation API.
*
* \warning Some array operations here are inherently inefficient,
* and only included for the cases where the performance is acceptable.
diff --git a/source/blender/blenlib/intern/astar.c b/source/blender/blenlib/intern/astar.c
index 4a94c385b59..13998bad81d 100644
--- a/source/blender/blenlib/intern/astar.c
+++ b/source/blender/blenlib/intern/astar.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/astar.c
- * \ingroup bli
- * \brief An implementation of the A* (AStar) algorithm to solve shortest path problem.
+/** \file
+ * \ingroup bli
+ * \brief An implementation of the A* (AStar) algorithm to solve shortest path problem.
*
* This library implements the simple A* (AStar) algorithm, an optimized version of
* classical dijkstra shortest path solver. The difference is that each future possible
@@ -51,7 +43,6 @@
#include "BLI_sys_types.h"
#include "BLI_compiler_attrs.h"
-#include "BLI_alloca.h"
#include "BLI_heap_simple.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
@@ -237,7 +228,8 @@ bool BLI_astar_graph_solve(
LinkData *ld;
if (BLI_BITMAP_TEST(done_nodes, node_curr_idx)) {
- /* Might happen, because we always add nodes to heap when evaluating them, without ever removing them. */
+ /* Might happen, because we always add nodes to heap when evaluating them,
+ * without ever removing them. */
continue;
}
@@ -268,8 +260,8 @@ bool BLI_astar_graph_solve(
prev_links[node_next_idx] = link;
g_costs[node_next_idx] = g_cst;
g_steps[node_next_idx] = g_steps[node_curr_idx] + 1;
- /* We might have this node already in heap, but since this 'instance' will be evaluated first,
- * no problem. */
+ /* We might have this node already in heap, but since this 'instance'
+ * will be evaluated first, no problem. */
BLI_heapsimple_insert(
todo_nodes,
f_cost_cb(as_graph, r_solution, link, node_curr_idx, node_next_idx, node_index_dst),
diff --git a/source/blender/blenlib/intern/bitmap.c b/source/blender/blenlib/intern/bitmap.c
index fab8b3dedf6..8cc359ac7f2 100644
--- a/source/blender/blenlib/intern/bitmap.c
+++ b/source/blender/blenlib/intern/bitmap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2012 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/bitmap.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Utility functions for variable size bitmasks.
*/
diff --git a/source/blender/blenlib/intern/bitmap_draw_2d.c b/source/blender/blenlib/intern/bitmap_draw_2d.c
index f2ec75001b4..aa2e93d06a1 100644
--- a/source/blender/blenlib/intern/bitmap_draw_2d.c
+++ b/source/blender/blenlib/intern/bitmap_draw_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/bitmap_draw_2d.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Utility functions for primitive drawing operations.
*/
@@ -168,7 +165,7 @@ static float inv_slope(const int a[2], const int b[2])
/**
* <pre>
* *---*
- * \ /
+ * \ /
* *
* </pre>
*/
diff --git a/source/blender/blenlib/intern/boxpack_2d.c b/source/blender/blenlib/intern/boxpack_2d.c
index 0b83423921f..357fa57b144 100644
--- a/source/blender/blenlib/intern/boxpack_2d.c
+++ b/source/blender/blenlib/intern/boxpack_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/blenlib/intern/boxpack_2d.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdlib.h> /* for qsort */
diff --git a/source/blender/blenlib/intern/buffer.c b/source/blender/blenlib/intern/buffer.c
index a54fc2428fe..50401fe6091 100644
--- a/source/blender/blenlib/intern/buffer.c
+++ b/source/blender/blenlib/intern/buffer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/buffer.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Primitive generic buffer library.
*
diff --git a/source/blender/blenlib/intern/callbacks.c b/source/blender/blenlib/intern/callbacks.c
index 766e3f38f00..0f84cd588a9 100644
--- a/source/blender/blenlib/intern/callbacks.c
+++ b/source/blender/blenlib/intern/callbacks.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2011)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/callbacks.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_utildefines.h"
diff --git a/source/blender/blenlib/intern/convexhull_2d.c b/source/blender/blenlib/intern/convexhull_2d.c
index c4b408ba40f..a59d44037f1 100644
--- a/source/blender/blenlib/intern/convexhull_2d.c
+++ b/source/blender/blenlib/intern/convexhull_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/convexhull_2d.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c
index 33ba18ec409..b172ae7a518 100644
--- a/source/blender/blenlib/intern/dynlib.c
+++ b/source/blender/blenlib/intern/dynlib.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file, with exception of below:
- *
- * Contributor(s): Peter O'Gorman
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/dynlib.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdio.h>
diff --git a/source/blender/blenlib/intern/easing.c b/source/blender/blenlib/intern/easing.c
index 93c3cad904c..07765276537 100644
--- a/source/blender/blenlib/intern/easing.c
+++ b/source/blender/blenlib/intern/easing.c
@@ -1,20 +1,17 @@
/*
- * Copyright © 2001 Robert Penner
- * All rights reserved.
- *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
*
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * * Neither the name of the author nor the names of contributors may be
- * used to endorse or promote products derived from this software without
- * specific prior written permission.
+ * * Neither the name of the author nor the names of contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -26,10 +23,13 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Copyright (c) 2001 Robert Penner
+ * All rights reserved.
*/
-/** \file blender/blenlib/intern/easing.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_math_base.h"
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index 8b83fc7a313..f3d69bc9795 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/edgehash.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* An (edge -> pointer) hash table.
* Using unordered int-pairs as keys.
diff --git a/source/blender/blenlib/intern/endian_switch.c b/source/blender/blenlib/intern/endian_switch.c
index b1dcdffba01..cc2ffa864f5 100644
--- a/source/blender/blenlib/intern/endian_switch.c
+++ b/source/blender/blenlib/intern/endian_switch.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/blenlib/intern/endian_switch.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_sys_types.h"
diff --git a/source/blender/blenlib/intern/expr_pylike_eval.c b/source/blender/blenlib/intern/expr_pylike_eval.c
index 7bcf32dd880..d0027c63c4b 100644
--- a/source/blender/blenlib/intern/expr_pylike_eval.c
+++ b/source/blender/blenlib/intern/expr_pylike_eval.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation, Alexander Gavrilov
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Alexander Gavrilov
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/expr_pylike_eval.c
- * \ingroup bli
- * \author Alexander Gavrilov
- * \since 2018
+/** \file
+ * \ingroup bli
*
* Simple evaluator for a subset of Python expressions that can be
* computed using purely double precision floating point values.
@@ -706,7 +696,8 @@ static bool parse_unary(ExprParseState *state)
return parse_next_token(state);
case TOKEN_ID:
- /* Parameters: search in reverse order in case of duplicate names - the last one should win. */
+ /* Parameters: search in reverse order in case of duplicate names -
+ * the last one should win. */
for (i = state->param_names_len - 1; i >= 0; i--) {
if (STREQ(state->tokenbuf, state->param_names[i])) {
parse_add_op(state, OPCODE_PARAMETER, 1)->arg.ival = i;
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 82ddc5a63f5..2339025307e 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/fileops.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
@@ -515,7 +507,7 @@ enum {
RecursiveOp_Callback_StopRecurs = 1,
/* error occured in callback and recursive walking should stop immediately */
- RecursiveOp_Callback_Error = 2
+ RecursiveOp_Callback_Error = 2,
};
typedef int (*RecursiveOp_Callback)(const char *from, const char *to);
diff --git a/source/blender/blenlib/intern/fnmatch.c b/source/blender/blenlib/intern/fnmatch.c
index 36c1ef394a2..9ba2cdbf2e6 100644
--- a/source/blender/blenlib/intern/fnmatch.c
+++ b/source/blender/blenlib/intern/fnmatch.c
@@ -1,5 +1,5 @@
-/** \file blender/blenlib/intern/fnmatch.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index 77b2949c54c..fba3c825a1c 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,14 @@
*
* The Original Code is written by Rob Haarsma (phase)
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* This code parses the Freetype font outline data to chains of Blender's beziertriples.
* Additional information can be found at the bottom of this file.
*
* Code that uses exotic character maps is present but commented out.
*/
-/** \file blender/blenlib/intern/freetypefont.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <ft2build.h>
@@ -486,7 +479,8 @@ VChar *BLI_vfontchar_from_freetypefont(VFont *vfont, unsigned long character)
}
/* Yeah, this is very bad... But why is this in BLI in the first place, since it uses Nurb data?
- * Anyway, do not feel like duplicating whole Nurb copy code here, so unless someone has a better idea... */
+ * Anyway, do not feel like duplicating whole Nurb copy code here,
+ * so unless someone has a better idea... */
#include "../../blenkernel/BKE_curve.h"
VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int UNUSED(flag))
@@ -513,8 +507,6 @@ VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int UNUSED(flag))
*
* Each arc is described through a series of start, end and control points. Each point of the outline
* has a specific tag which indicates whether it is used to describe a line segment or an arc.
- *
- *
* The following rules are applied to decompose the contour's points into segments and arcs :
*
* # two successive "on" points indicate a line segment joining them.
@@ -545,9 +537,6 @@ VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int UNUSED(flag))
* Two "on" points
* Two "on" points and one "conic" point
* between them
- *
- *
- *
* *
* # __ Two "on" points with two "conic"
* \ - - points between them. The point
@@ -557,10 +546,6 @@ VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int UNUSED(flag))
* -- It does not appear in the point
* list.
* *
- *
- *
- *
- *
* * # on
* * * off
* __---__
@@ -572,8 +557,6 @@ VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int UNUSED(flag))
* Two "on" points
* and two "cubic" point
* between them
- *
- *
* Each glyph's original outline points are located on a grid of indivisible units. The points are stored
* in the font file as 16-bit integer grid coordinates, with the grid origin's being at (0, 0); they thus
* range from -16384 to 16383.
@@ -585,5 +568,4 @@ VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int UNUSED(flag))
* B1=(P0+2*P1)/3
* B2=(P2+2*P1)/3
* B3=P2
- *
*/
diff --git a/source/blender/blenlib/intern/gsqueue.c b/source/blender/blenlib/intern/gsqueue.c
index 4100a390e6f..226e6cd34d5 100644
--- a/source/blender/blenlib/intern/gsqueue.c
+++ b/source/blender/blenlib/intern/gsqueue.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/gsqueue.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* \brief A generic structure queue
* (a queue for fixed length generally small) structures.
diff --git a/source/blender/blenlib/intern/hash_md5.c b/source/blender/blenlib/intern/hash_md5.c
index c73fe7a3ff1..895b558dc82 100644
--- a/source/blender/blenlib/intern/hash_md5.c
+++ b/source/blender/blenlib/intern/hash_md5.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Copyright (C) 1995 Software Foundation, Inc.
*
* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>.
*/
-/** \file blender/blenlib/intern/hash_md5.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Functions to compute MD5 message digest of files or memory blocks
* according to the definition of MD5 in RFC 1321 from April 1992.
@@ -40,9 +35,10 @@
# include <limits.h>
#endif
-/* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type
- * that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but doing that
- * would require that the configure script compile and *run* the resulting executable.
+/* The following contortions are an attempt to use the C preprocessor to determine an unsigned
+ * integral type that is 32 bits wide.
+ * An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but doing that would require
+ * that the configure script compile and *run* the resulting executable.
* Locally running cross-compiled executables is usually not possible.
*/
@@ -94,7 +90,8 @@ struct md5_ctx {
# define SWAP(n) (n)
#endif
-/* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */
+/* This array contains the bytes used to pad the buffer to the next 64-byte boundary.
+ * (RFC 1321, 3.1: Step 1) */
static const unsigned char fillbuf[64] = {0x80, 0 /* , 0, 0, ... */};
/** Initialize structure containing state of computation.
@@ -108,14 +105,16 @@ static void md5_init_ctx(struct md5_ctx *ctx)
ctx->D = 0x10325476;
}
-/** Starting with the result of former calls of this function (or the initialization), this function updates
- * the 'ctx' context for the next 'len' bytes starting at 'buffer'.
- * It is necessary that 'len' is a multiple of 64!!!
+/**
+ * Starting with the result of former calls of this function (or the initialization),
+ * this function updates the 'ctx' context for the next 'len' bytes starting at 'buffer'.
+ * It is necessary that 'len' is a multiple of 64!!!
*/
static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
{
-/* These are the four functions used in the four steps of the MD5 algorithm and defined in the RFC 1321.
- * The first function is a little bit optimized (as found in Colin Plumbs public domain implementation).
+/* These are the four functions used in the four steps of the MD5 algorithm and defined in the
+ * RFC 1321. The first function is a little bit optimized
+ * (as found in Colin Plumbs public domain implementation).
*/
/* #define FF(b, c, d) ((b & c) | (~b & d)) */
#define FF(b, c, d) (d ^ (b & (c ^ d)))
@@ -123,7 +122,8 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
#define FH(b, c, d) (b ^ c ^ d)
#define FI(b, c, d) (c ^ (b | ~d))
-/* It is unfortunate that C does not provide an operator for cyclic rotation. Hope the C compiler is smart enough. */
+/* It is unfortunate that C does not provide an operator for cyclic rotation.
+ * Hope the C compiler is smart enough. */
#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
md5_uint32 correct_words[16];
@@ -143,10 +143,11 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
md5_uint32 C_save = C;
md5_uint32 D_save = D;
- /* First round: using the given function, the context and a constant the next context is computed.
- * Because the algorithms processing unit is a 32-bit word and it is determined to work on words in
- * little endian byte order we perhaps have to change the byte order before the computation.
- * To reduce the work for the next steps we store the swapped words in the array CORRECT_WORDS.
+ /* First round: using the given function, the context and a constant the next context is
+ * computed. Because the algorithms processing unit is a 32-bit word and it is determined
+ * to work on words in little endian byte order we perhaps have to change the byte order
+ * before the computation. To reduce the work for the next steps we store the swapped words
+ * in the array CORRECT_WORDS.
*/
#define OP(a, b, c, d, s, T) \
a += FF(b, c, d) + (*cwp++ = SWAP(*words)) + T; \
@@ -264,8 +265,10 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
#undef CYCLIC
}
-/** Put result from 'ctx' in first 16 bytes of 'resbuf'. The result is always in little endian byte order,
- * so that a byte-wise output yields to the wanted ASCII representation of the message digest.
+/**
+ * Put result from 'ctx' in first 16 bytes of 'resbuf'.
+ * The result is always in little endian byte order,
+ * so that a byte-wise output yields to the wanted ASCII representation of the message digest.
*/
static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf)
{
@@ -282,7 +285,7 @@ static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf)
/** Compute MD5 message digest for bytes read from 'stream'.
* The resulting message digest number will be written into the 16 bytes beginning at 'resblock'.
- * \return Non-zero if an error occurred.
+ * \return Non-zero if an error occurred.
*/
int BLI_hash_md5_stream(FILE *stream, void *resblock)
{
@@ -300,8 +303,9 @@ int BLI_hash_md5_stream(FILE *stream, void *resblock)
/* Iterate over full file contents. */
while (1) {
- /* We read the file in blocks of BLOCKSIZE bytes. One call of the computation function processes
- * the whole buffer so that with the next round of the loop another block can be read.
+ /* We read the file in blocks of BLOCKSIZE bytes.
+ * One call of the computation function processes the whole buffer
+ * so that with the next round of the loop another block can be read.
*/
size_t n;
sum = 0;
@@ -330,7 +334,8 @@ int BLI_hash_md5_stream(FILE *stream, void *resblock)
md5_process_block(buffer, BLOCKSIZE, &ctx);
}
- /* We can copy 64 bytes because the buffer is always big enough. 'fillbuf' contains the needed bits. */
+ /* We can copy 64 bytes because the buffer is always big enough.
+ * 'fillbuf' contains the needed bits. */
memcpy(&buffer[sum], fillbuf, 64);
/* Compute amount of padding bytes needed. Alignment is done to (N + PAD) % 64 == 56.
@@ -373,10 +378,12 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock)
rest = len - blocks;
/* Copy to own buffer. */
memcpy(restbuf, &buffer[blocks], rest);
- /* Append needed fill bytes at end of buffer. We can copy 64 bytes because the buffer is always big enough. */
+ /* Append needed fill bytes at end of buffer.
+ * We can copy 64 bytes because the buffer is always big enough. */
memcpy(&restbuf[rest], fillbuf, 64);
- /* PAD bytes are used for padding to correct alignment. Note that always at least one byte is padded. */
+ /* PAD bytes are used for padding to correct alignment.
+ * Note that always at least one byte is padded. */
pad = rest >= 56 ? 64 + 56 - rest : 56 - rest;
/* Put length of buffer in *bits* in last eight bytes. */
diff --git a/source/blender/blenlib/intern/hash_mm2a.c b/source/blender/blenlib/intern/hash_mm2a.c
index 6fd227232ed..ff604110f2b 100644
--- a/source/blender/blenlib/intern/hash_mm2a.c
+++ b/source/blender/blenlib/intern/hash_mm2a.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Copyright (C) 2014 Blender Foundation.
- *
*/
-/** \file blender/blenlib/intern/hash_mm2a.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Functions to compute Murmur2A hash key.
*
diff --git a/source/blender/blenlib/intern/hash_mm3.c b/source/blender/blenlib/intern/hash_mm3.c
index 105c1f46832..c788a6ae7c8 100644
--- a/source/blender/blenlib/intern/hash_mm3.c
+++ b/source/blender/blenlib/intern/hash_mm3.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Copyright (C) 2018 Blender Foundation.
- *
*/
-/** \file blender/blenlib/intern/hash_mm3.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Functions to compute Murmur3 hash key.
*
@@ -30,7 +24,6 @@
*
* MurmurHash3 was written by Austin Appleby, and is placed in the public
* domain. The author hereby disclaims copyright to this source code.
- *
*/
#include "BLI_compiler_compat.h"
diff --git a/source/blender/blenlib/intern/jitter_2d.c b/source/blender/blenlib/intern/jitter_2d.c
index f1ee85f47c2..0a1ee08776e 100644
--- a/source/blender/blenlib/intern/jitter_2d.c
+++ b/source/blender/blenlib/intern/jitter_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/jitter_2d.c
- * \ingroup bli
- * \brief Jitter offset table
+/** \file
+ * \ingroup bli
+ * \brief Jitter offset table
*/
#include <math.h>
diff --git a/source/blender/blenlib/intern/lasso_2d.c b/source/blender/blenlib/intern/lasso_2d.c
index 663f3ffea22..37d4d6e1d1f 100644
--- a/source/blender/blenlib/intern/lasso_2d.c
+++ b/source/blender/blenlib/intern/lasso_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenlib/intern/lasso_2d.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "DNA_vec_types.h"
diff --git a/source/blender/blenlib/intern/list_sort_impl.h b/source/blender/blenlib/intern/list_sort_impl.h
index 062b4e39647..3da4c5ccd41 100644
--- a/source/blender/blenlib/intern/list_sort_impl.h
+++ b/source/blender/blenlib/intern/list_sort_impl.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/list_sort_impl.h
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Common implementation of linked-list a non-recursive mergesort.
*
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index df1fb1148e6..5fd75643d60 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenlib/intern/listbase.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Manipulations on double-linked list (#ListBase structs).
*
diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c
index 14eba3e61a4..c4b01729a6d 100644
--- a/source/blender/blenlib/intern/math_base.c
+++ b/source/blender/blenlib/intern/math_base.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_base.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_math.h"
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 647ab8aa478..1ad0dc6a22f 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_base_inline.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifndef __MATH_BASE_INLINE_C__
diff --git a/source/blender/blenlib/intern/math_bits_inline.c b/source/blender/blenlib/intern/math_bits_inline.c
index 9b16756134e..d86b2924e17 100644
--- a/source/blender/blenlib/intern/math_bits_inline.c
+++ b/source/blender/blenlib/intern/math_bits_inline.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,11 +13,10 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_bits_inline.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifndef __MATH_BITS_INLINE_C__
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 91d733e9691..dbc5ee11663 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_color.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <assert.h>
@@ -479,7 +476,7 @@ int constrain_rgb(float *r, float *g, float *b)
return 0; /* Color within RGB gamut */
}
-/* ********************************* lift/gamma/gain / ASC-CDL conversion ********************************* */
+/* ********************** lift/gamma/gain / ASC-CDL conversion ********************************* */
void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power)
{
@@ -494,7 +491,7 @@ void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *o
}
}
-/* ******************************************** other ************************************************* */
+/* ************************************* other ************************************************* */
/* Applies an hue offset to a float rgb color */
void rgb_float_set_hue_float_offset(float rgb[3], float hue_offset)
diff --git a/source/blender/blenlib/intern/math_color_blend_inline.c b/source/blender/blenlib/intern/math_color_blend_inline.c
index 1af2a0cd6a2..f3e6ff8b110 100644
--- a/source/blender/blenlib/intern/math_color_blend_inline.c
+++ b/source/blender/blenlib/intern/math_color_blend_inline.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_color_blend_inline.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_math_base.h"
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c
index d8e5d530b25..5396f3a47f6 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_color_inline.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 930c12d3070..a513aca8e46 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_geom.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "MEM_guardedalloc.h"
@@ -557,16 +554,25 @@ float dist_signed_squared_to_corner_v3v3v3(
}
/**
- * return the distance squared of a point to a ray.
+ * Compute the squared distance of a point to a line (defined as ray).
+ * \param ray_origin: A point on the line.
+ * \param ray_direction: Normalized direction of the line.
+ * \param co: Point to which the distance is to be calculated.
*/
-float dist_squared_to_ray_v3(
+float dist_squared_to_ray_v3_normalized(
const float ray_origin[3], const float ray_direction[3],
- const float co[3], float *r_depth)
+ const float co[3])
{
- float dvec[3];
- sub_v3_v3v3(dvec, co, ray_origin);
- *r_depth = dot_v3v3(dvec, ray_direction);
- return len_squared_v3(dvec) - SQUARE(*r_depth);
+ float origin_to_co[3];
+ sub_v3_v3v3(origin_to_co, co, ray_origin);
+
+ float origin_to_proj[3];
+ project_v3_v3v3_normalized(origin_to_proj, origin_to_co, ray_direction);
+
+ float co_projected_on_ray[3];
+ add_v3_v3v3(co_projected_on_ray, ray_origin, origin_to_proj);
+
+ return len_squared_v3v3(co, co_projected_on_ray);
}
@@ -769,7 +775,7 @@ float dist_squared_ray_to_aabb_v3_simple(
/* -------------------------------------------------------------------- */
/** \name dist_squared_to_projected_aabb and helpers
-* \{ */
+ * \{ */
/**
* \param projmat: Projection Matrix (usually perspective
@@ -860,6 +866,10 @@ float dist_squared_to_projected_aabb(
float rtmin, rtmax;
int main_axis;
+ r_axis_closest[0] = false;
+ r_axis_closest[1] = false;
+ r_axis_closest[2] = false;
+
if ((tmax[0] <= tmax[1]) && (tmax[0] <= tmax[2])) {
rtmax = tmax[0];
va[0] = vb[0] = local_bvmax[0];
@@ -1353,7 +1363,7 @@ int isect_line_sphere_v3(const float l1[3], const float l2[3],
const float ldir[3] = {
l2[0] - l1[0],
l2[1] - l1[1],
- l2[2] - l1[2]
+ l2[2] - l1[2],
};
const float a = len_squared_v3(ldir);
@@ -1804,7 +1814,7 @@ bool isect_ray_tri_watertight_v3(
/* Calculate determinant. */
det = u + v + w;
- if (UNLIKELY(det == 0.0f)) {
+ if (UNLIKELY(det == 0.0f || !isfinite(det))) {
return false;
}
else {
@@ -2094,8 +2104,6 @@ bool isect_plane_plane_plane_v3(
/**
* Intersect two planes, return a point on the intersection and a vector
* that runs on the direction of the intersection.
- *
- *
* \note this is a slightly reduced version of #isect_plane_plane_plane_v3
*
* \param plane_a, plane_b: Planes.
@@ -2200,7 +2208,8 @@ bool isect_tri_tri_epsilon_v3(
/* ignore collinear lines, they are either an edge shared between 2 tri's
* (which runs along [co_proj, plane_no], but can be safely ignored).
*
- * or a collinear edge placed away from the ray - which we don't intersect with & can ignore. */
+ * or a collinear edge placed away from the ray -
+ * which we don't intersect with & can ignore. */
if (UNLIKELY(edge_fac == -1.0f)) {
/* pass */
}
@@ -3424,7 +3433,8 @@ void transform_point_by_tri_v3(
* axis where its barycentric weights can be calculated in 2D and its Z offset can
* be re-applied. The weights are applied directly to the targets 3D points and the
* z-depth is used to scale the targets normal as an offset.
- * This saves transforming the target into its Z-Up orientation and back (which could also work) */
+ * This saves transforming the target into its Z-Up orientation and back
+ * (which could also work) */
float no_tar[3], no_src[3];
float mat_src[3][3];
float pt_src_xy[3];
@@ -3631,7 +3641,8 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
while (i_next < n) {
/* Mark Mayer et al algorithm that is used here does not operate well if vertex is close
- * to borders of face. In that case, do simple linear interpolation between the two edge vertices */
+ * to borders of face.
+ * In that case, do simple linear interpolation between the two edge vertices */
/* 'd_next.len' is infact 'd_curr.len', just avoid copy to begin with */
if (UNLIKELY(d_next.len < eps)) {
@@ -3704,7 +3715,8 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
while (i_next < n) {
/* Mark Mayer et al algorithm that is used here does not operate well if vertex is close
- * to borders of face. In that case, do simple linear interpolation between the two edge vertices */
+ * to borders of face. In that case,
+ * do simple linear interpolation between the two edge vertices */
/* 'd_next.len' is infact 'd_curr.len', just avoid copy to begin with */
if (UNLIKELY(d_next.len < eps)) {
@@ -3786,7 +3798,8 @@ void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3
v[2] = 3 * a[2] * t2 + 2 * b[2] * t + v1[2];
}
-/* unfortunately internal calculations have to be done at double precision to achieve correct/stable results. */
+/* unfortunately internal calculations have to be done at double precision
+ * to achieve correct/stable results. */
#define IS_ZERO(x) ((x > (-DBL_EPSILON) && x < DBL_EPSILON) ? 1 : 0)
@@ -4056,7 +4069,8 @@ 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) */
+/* 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][4], float perspmat[4][4], const float x, const float y)
{
if (winmat[2][3] == -1.0f) {
@@ -4550,7 +4564,8 @@ void vcloud_estimate_transform_v3(
if (lloc) copy_v3_v3(lloc, accu_com);
if (rloc) copy_v3_v3(rloc, accu_rcom);
if (lrot || lscale) { /* caller does not want rot nor scale, strange but legal */
- /*so now do some reverse engineering and see if we can split rotation from scale ->Polardecompose*/
+ /* so now do some reverse engineering and see if we can
+ * split rotation from scale -> Polardecompose */
/* build 'projection' matrix */
float m[3][3], mr[3][3], q[3][3], qi[3][3];
float va[3], vb[3], stunt[3];
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c
index e0499e0eaa8..58262b9a364 100644
--- a/source/blender/blenlib/intern/math_geom_inline.c
+++ b/source/blender/blenlib/intern/math_geom_inline.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_geom_inline.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifndef __MATH_GEOM_INLINE_C__
diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c
index b93a7f55821..5b3f6349703 100644
--- a/source/blender/blenlib/intern/math_interp.c
+++ b/source/blender/blenlib/intern/math_interp.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2012 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenlib/intern/math_interp.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <math.h>
@@ -146,7 +137,8 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, const fl
CLAMP(y1, 0, height - 1);
/* normally we could do this */
/* w = P(n-a) * P(b-m); */
- /* except that would call P() 16 times per pixel therefor pow() 64 times, better precalc these */
+ /* except that would call P() 16 times per pixel therefor pow() 64 times,
+ * better precalc these */
w = wx * wy[m + 1];
if (float_output) {
@@ -414,7 +406,8 @@ void BLI_bilinear_interpolation_wrap_char(const unsigned char *buffer, unsigned
/**************************************************************************
* Filtering method based on
- * "Creating raster omnimax images from multiple perspective views using the elliptical weighted average filter"
+ * "Creating raster omnimax images from multiple perspective views
+ * using the elliptical weighted average filter"
* by Ned Greene and Paul S. Heckbert (1986)
***************************************************************************/
@@ -453,7 +446,7 @@ const float EWA_WTS[EWA_MAXIDX + 1] = {
0.0415211f, 0.039974f, 0.0384389f, 0.0369158f, 0.0354046f, 0.0339052f, 0.0324175f, 0.0309415f,
0.029477f, 0.0280239f, 0.0265822f, 0.0251517f, 0.0237324f, 0.0223242f, 0.020927f, 0.0195408f,
0.0181653f, 0.0168006f, 0.0154466f, 0.0141031f, 0.0127701f, 0.0114476f, 0.0101354f, 0.00883339f,
- 0.00754159f, 0.00625989f, 0.00498819f, 0.00372644f, 0.00247454f, 0.00123242f, 0.f
+ 0.00754159f, 0.00625989f, 0.00498819f, 0.00372644f, 0.00247454f, 0.00123242f, 0.f,
};
static void radangle2imp(float a2, float b2, float th, float *A, float *B, float *C, float *F)
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 462d0737016..747d9a1337a 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -19,12 +17,10 @@
* All rights reserved.
*
* The Original Code is: some of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/math_matrix.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
@@ -656,28 +652,31 @@ void mul_v4_m4v3(float r[4], const float M[4][4], const float v[3])
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
{
- BLI_assert(r != a);
+ float t[3];
+ copy_v3_v3(t, a);
- r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2];
- r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2];
- r[2] = M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2];
+ r[0] = M[0][0] * t[0] + M[1][0] * t[1] + M[2][0] * t[2];
+ r[1] = M[0][1] * t[0] + M[1][1] * t[1] + M[2][1] * t[2];
+ r[2] = M[0][2] * t[0] + M[1][2] * t[1] + M[2][2] * t[2];
}
void mul_v3_m3v3_db(double r[3], const double M[3][3], const double a[3])
{
- BLI_assert(r != a);
+ double t[3];
+ copy_v3_v3_db(t, a);
- r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2];
- r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2];
- r[2] = M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2];
+ r[0] = M[0][0] * t[0] + M[1][0] * t[1] + M[2][0] * t[2];
+ r[1] = M[0][1] * t[0] + M[1][1] * t[1] + M[2][1] * t[2];
+ r[2] = M[0][2] * t[0] + M[1][2] * t[1] + M[2][2] * t[2];
}
void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3])
{
- BLI_assert(r != a);
+ float t[3];
+ copy_v3_v3(t, a);
- r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2];
- r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2];
+ r[0] = M[0][0] * t[0] + M[1][0] * t[1] + M[2][0] * t[2];
+ r[1] = M[0][1] * t[0] + M[1][1] * t[1] + M[2][1] * t[2];
}
void mul_m3_v3(const float M[3][3], float r[3])
@@ -1788,11 +1787,13 @@ void blend_m4_m4m4(float out[4][4], const float dst[4][4], const float src[4][4]
*/
void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], const float t)
{
- /* 'Rotation' component ('U' part of polar decomposition, the closest orthogonal matrix to M3 rot/scale
+ /* 'Rotation' component ('U' part of polar decomposition,
+ * the closest orthogonal matrix to M3 rot/scale
* transformation matrix), spherically interpolated. */
float U_A[3][3], U_B[3][3], U[3][3];
float quat_A[4], quat_B[4], quat[4];
- /* 'Scaling' component ('P' part of polar decomposition, i.e. scaling in U-defined space), linearly interpolated. */
+ /* 'Scaling' component ('P' part of polar decomposition, i.e. scaling in U-defined space),
+ * linearly interpolated. */
float P_A[3][3], P_B[3][3], P[3][3];
int i;
@@ -2506,7 +2507,6 @@ void invert_m4_m4_safe(float Ainv[4][4], const float A[4][4])
* (and not translated at all!):
* BLI_space_transform_apply_normal(&data, no);
* BLI_space_transform_invert_normal(&data, no);
- *
*/
/**
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 8e5b3f0000e..53c7d5e6576 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_rotation.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <assert.h>
@@ -197,7 +194,8 @@ void sub_qt_qtqt(float q[4], const float q1[4], const float q2[4])
void pow_qt_fl_normalized(float q[4], const float fac)
{
BLI_ASSERT_UNIT_QUAT(q);
- const float angle = fac * saacos(q[0]); /* quat[0] = cos(0.5 * angle), but now the 0.5 and 2.0 rule out */
+ const float angle = fac * saacos(q[0]); /* quat[0] = cos(0.5 * angle),
+ * but now the 0.5 and 2.0 rule out */
const float co = cosf(angle);
const float si = sinf(angle);
q[0] = co;
@@ -293,7 +291,7 @@ void quat_to_mat4(float m[4][4], const float q[4])
m[3][3] = 1.0f;
}
-void mat3_normalized_to_quat(float q[4], float mat[3][3])
+void mat3_normalized_to_quat(float q[4], const float mat[3][3])
{
double tr, s;
@@ -341,7 +339,7 @@ void mat3_normalized_to_quat(float q[4], float mat[3][3])
normalize_qt(q);
}
-void mat3_to_quat(float q[4], float m[3][3])
+void mat3_to_quat(float q[4], const float m[3][3])
{
float unit_mat[3][3];
@@ -351,7 +349,7 @@ void mat3_to_quat(float q[4], float m[3][3])
mat3_normalized_to_quat(q, unit_mat);
}
-void mat4_normalized_to_quat(float q[4], float m[4][4])
+void mat4_normalized_to_quat(float q[4], const float m[4][4])
{
float mat3[3][3];
@@ -359,7 +357,7 @@ void mat4_normalized_to_quat(float q[4], float m[4][4])
mat3_normalized_to_quat(q, mat3);
}
-void mat4_to_quat(float q[4], float m[4][4])
+void mat4_to_quat(float q[4], const float m[4][4])
{
float mat3[3][3];
@@ -367,7 +365,7 @@ void mat4_to_quat(float q[4], float m[4][4])
mat3_to_quat(q, mat3);
}
-void mat3_to_quat_is_ok(float q[4], float wmat[3][3])
+void mat3_to_quat_is_ok(float q[4], const float wmat[3][3])
{
float mat[3][3], matr[3][3], matn[3][3], q1[4], q2[4], angle, si, co, nor[3];
@@ -940,6 +938,9 @@ void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
axis[0] = q[1] / si;
axis[1] = q[2] / si;
axis[2] = q[3] / si;
+ if (is_zero_v3(axis)) {
+ axis[1] = 1.0f;
+ }
}
/* Axis Angle to Euler Rotation */
@@ -1035,7 +1036,7 @@ void axis_angle_to_mat4(float mat[4][4], const float axis[3], const float angle)
}
/* 3x3 matrix to axis angle */
-void mat3_normalized_to_axis_angle(float axis[3], float *angle, float mat[3][3])
+void mat3_normalized_to_axis_angle(float axis[3], float *angle, const float mat[3][3])
{
float q[4];
@@ -1044,7 +1045,7 @@ void mat3_normalized_to_axis_angle(float axis[3], float *angle, float mat[3][3])
mat3_normalized_to_quat(q, mat);
quat_to_axis_angle(axis, angle, q);
}
-void mat3_to_axis_angle(float axis[3], float *angle, float mat[3][3])
+void mat3_to_axis_angle(float axis[3], float *angle, const float mat[3][3])
{
float q[4];
@@ -1055,7 +1056,7 @@ void mat3_to_axis_angle(float axis[3], float *angle, float mat[3][3])
}
/* 4x4 matrix to axis angle */
-void mat4_normalized_to_axis_angle(float axis[3], float *angle, float mat[4][4])
+void mat4_normalized_to_axis_angle(float axis[3], float *angle, const float mat[4][4])
{
float q[4];
@@ -1066,7 +1067,7 @@ void mat4_normalized_to_axis_angle(float axis[3], float *angle, float mat[4][4])
}
/* 4x4 matrix to axis angle */
-void mat4_to_axis_angle(float axis[3], float *angle, float mat[4][4])
+void mat4_to_axis_angle(float axis[3], float *angle, const float mat[4][4])
{
float q[4];
@@ -1281,7 +1282,7 @@ static void mat3_normalized_to_eul2(const float mat[3][3], float eul1[3], float
}
/* XYZ order */
-void mat3_normalized_to_eul(float eul[3], float mat[3][3])
+void mat3_normalized_to_eul(float eul[3], const float mat[3][3])
{
float eul1[3], eul2[3];
@@ -1295,7 +1296,7 @@ void mat3_normalized_to_eul(float eul[3], float mat[3][3])
copy_v3_v3(eul, eul1);
}
}
-void mat3_to_eul(float eul[3], float mat[3][3])
+void mat3_to_eul(float eul[3], const float mat[3][3])
{
float unit_mat[3][3];
normalize_m3_m3(unit_mat, mat);
@@ -1303,13 +1304,13 @@ void mat3_to_eul(float eul[3], float mat[3][3])
}
/* XYZ order */
-void mat4_normalized_to_eul(float eul[3], float m[4][4])
+void mat4_normalized_to_eul(float eul[3], const float m[4][4])
{
float mat3[3][3];
copy_m3_m4(mat3, m);
mat3_normalized_to_eul(eul, mat3);
}
-void mat4_to_eul(float eul[3], float m[4][4])
+void mat4_to_eul(float eul[3], const float m[4][4])
{
float mat3[3][3];
copy_m3_m4(mat3, m);
@@ -1578,7 +1579,7 @@ void eulO_to_mat3(float M[3][3], const float e[3], const short order)
}
/* returns two euler calculation methods, so we can pick the best */
-static void mat3_normalized_to_eulo2(float mat[3][3], float eul1[3], float eul2[3], const short order)
+static void mat3_normalized_to_eulo2(const float mat[3][3], float eul1[3], float eul2[3], const short order)
{
const RotOrderInfo *R = get_rotation_order_info(order);
short i = R->axis[0], j = R->axis[1], k = R->axis[2];
@@ -1622,7 +1623,7 @@ void eulO_to_mat4(float mat[4][4], const float e[3], const short order)
}
/* Convert 3x3 matrix to Euler angles (in radians). */
-void mat3_normalized_to_eulO(float eul[3], const short order, float m[3][3])
+void mat3_normalized_to_eulO(float eul[3], const short order, const float m[3][3])
{
float eul1[3], eul2[3];
float d1, d2;
@@ -1640,7 +1641,7 @@ void mat3_normalized_to_eulO(float eul[3], const short order, float m[3][3])
copy_v3_v3(eul, eul1);
}
}
-void mat3_to_eulO(float eul[3], const short order, float m[3][3])
+void mat3_to_eulO(float eul[3], const short order, const float m[3][3])
{
float unit_mat[3][3];
normalize_m3_m3(unit_mat, m);
@@ -1648,7 +1649,7 @@ void mat3_to_eulO(float eul[3], const short order, float m[3][3])
}
/* Convert 4x4 matrix to Euler angles (in radians). */
-void mat4_normalized_to_eulO(float eul[3], const short order, float m[4][4])
+void mat4_normalized_to_eulO(float eul[3], const short order, const float m[4][4])
{
float mat3[3][3];
@@ -1657,7 +1658,7 @@ void mat4_normalized_to_eulO(float eul[3], const short order, float m[4][4])
mat3_normalized_to_eulO(eul, order, mat3);
}
-void mat4_to_eulO(float eul[3], const short order, float m[4][4])
+void mat4_to_eulO(float eul[3], const short order, const float m[4][4])
{
float mat3[3][3];
copy_m3_m4(mat3, m);
@@ -1667,7 +1668,8 @@ void mat4_to_eulO(float eul[3], const short order, float m[4][4])
/* uses 2 methods to retrieve eulers, and picks the closest */
-void mat3_normalized_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float mat[3][3])
+void mat3_normalized_to_compatible_eulO(
+ float eul[3], const float oldrot[3], const short order, const float mat[3][3])
{
float eul1[3], eul2[3];
float d1, d2;
@@ -1688,7 +1690,8 @@ void mat3_normalized_to_compatible_eulO(float eul[3], float oldrot[3], const sho
copy_v3_v3(eul, eul1);
}
}
-void mat3_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float mat[3][3])
+void mat3_to_compatible_eulO(
+ float eul[3], const float oldrot[3], const short order, const float mat[3][3])
{
float unit_mat[3][3];
@@ -1696,7 +1699,8 @@ void mat3_to_compatible_eulO(float eul[3], float oldrot[3], const short order, f
mat3_normalized_to_compatible_eulO(eul, oldrot, order, unit_mat);
}
-void mat4_normalized_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float m[4][4])
+void mat4_normalized_to_compatible_eulO(
+ float eul[3], const float oldrot[3], const short order, const float m[4][4])
{
float mat3[3][3];
@@ -1704,7 +1708,8 @@ void mat4_normalized_to_compatible_eulO(float eul[3], float oldrot[3], const sho
copy_m3_m4(mat3, m);
mat3_normalized_to_compatible_eulO(eul, oldrot, order, mat3);
}
-void mat4_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float m[4][4])
+void mat4_to_compatible_eulO(
+ float eul[3], const float oldrot[3], const short order, const float m[4][4])
{
float mat3[3][3];
@@ -1714,7 +1719,8 @@ void mat4_to_compatible_eulO(float eul[3], float oldrot[3], const short order, f
mat3_normalized_to_compatible_eulO(eul, oldrot, order, mat3);
}
-void quat_to_compatible_eulO(float eul[3], float oldrot[3], const short order, const float quat[4])
+void quat_to_compatible_eulO(
+ float eul[3], const float oldrot[3], const short order, const float quat[4])
{
float unit_mat[3][3];
@@ -1798,15 +1804,12 @@ void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
- *
- * \author Ladislav Kavan, kavanl@cs.tcd.ie
- *
* Changes for Blender:
* - renaming, style changes and optimization's
* - added support for scaling
*/
-void mat4_to_dquat(DualQuat *dq, float basemat[4][4], float mat[4][4])
+void mat4_to_dquat(DualQuat *dq, const float basemat[4][4], const float mat[4][4])
{
float *t, *q, dscale[3], scale[3], basequat[4], mat3[3][3];
float baseRS[4][4], baseinv[4][4], baseR[4][4], baseRinv[4][4];
@@ -2011,12 +2014,18 @@ void quat_apply_track(float quat[4], short axis, short upflag)
/* rotations are hard coded to match vec_to_quat */
const float sqrt_1_2 = (float)M_SQRT1_2;
const float quat_track[][4] = {
- {sqrt_1_2, 0.0, -sqrt_1_2, 0.0}, /* pos-y90 */
- {0.5, 0.5, 0.5, 0.5}, /* Quaternion((1,0,0), radians(90)) * Quaternion((0,1,0), radians(90)) */
- {sqrt_1_2, 0.0, 0.0, sqrt_1_2}, /* pos-z90 */
- {sqrt_1_2, 0.0, sqrt_1_2, 0.0}, /* neg-y90 */
- {0.5, -0.5, -0.5, 0.5}, /* Quaternion((1,0,0), radians(-90)) * Quaternion((0,1,0), radians(-90)) */
- {0.0, sqrt_1_2, sqrt_1_2, 0.0} /* no rotation */
+ /* pos-y90 */
+ {sqrt_1_2, 0.0, -sqrt_1_2, 0.0},
+ /* Quaternion((1,0,0), radians(90)) * Quaternion((0,1,0), radians(90)) */
+ {0.5, 0.5, 0.5, 0.5},
+ /* pos-z90 */
+ {sqrt_1_2, 0.0, 0.0, sqrt_1_2},
+ /* neg-y90 */
+ {sqrt_1_2, 0.0, sqrt_1_2, 0.0},
+ /* Quaternion((1,0,0), radians(-90)) * Quaternion((0,1,0), radians(-90)) */
+ {0.5, -0.5, -0.5, 0.5},
+ /* no rotation */
+ {0.0, sqrt_1_2, sqrt_1_2, 0.0},
};
assert(axis >= 0 && axis <= 5);
diff --git a/source/blender/blenlib/intern/math_solvers.c b/source/blender/blenlib/intern/math_solvers.c
index 11345648ce5..efaa98fc4e7 100644
--- a/source/blender/blenlib/intern/math_solvers.c
+++ b/source/blender/blenlib/intern/math_solvers.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_solvers.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/blenlib/intern/math_statistics.c b/source/blender/blenlib/intern/math_statistics.c
index bc565fef6c6..e96638a4618 100644
--- a/source/blender/blenlib/intern/math_statistics.c
+++ b/source/blender/blenlib/intern/math_statistics.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_statistics.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "MEM_guardedalloc.h"
@@ -60,7 +54,7 @@ static void covariance_m_vn_ex_task_cb(
int k;
- /* Covariance matrices are always symetrical, so we can compute only one half of it,
+ /* Covariance matrices are always symmetrical, so we can compute only one half of it,
* and mirror it to the other half (at the end of the func).
*
* This allows using a flat loop of n*n with same results as imbricated one over half the matrix:
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index acb4ee87f69..bf4cd702ea1 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_vector.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_math.h"
@@ -758,7 +755,7 @@ void bisect_v3_v3v3v3(float out[3], const float v1[3], const float v2[3], const
* <pre>
* v
* + ^
- * \ |
+ * \ |
* \|
* + normal: axis of reflection
* /
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index fc3f11fd1be..80bdeec5949 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -20,11 +18,10 @@
*
* The Original Code is: some of this file.
*
- * ***** END GPL LICENSE BLOCK *****
* */
-/** \file blender/blenlib/intern/math_vector_inline.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#ifndef __MATH_VECTOR_INLINE_C__
@@ -68,6 +65,13 @@ MINLINE void copy_v3_v3(float r[3], const float a[3])
r[2] = a[2];
}
+MINLINE void copy_v3fl_v3s(float r[3], const short a[3])
+{
+ r[0] = (float)a[0];
+ r[1] = (float)a[1];
+ r[2] = (float)a[2];
+}
+
MINLINE void copy_v4_v4(float r[4], const float a[4])
{
r[0] = a[0];
@@ -142,12 +146,6 @@ MINLINE void copy_v4_v4_char(char r[4], const char a[4])
}
/* short */
-MINLINE void zero_v3_int(int r[3])
-{
- r[0] = 0;
- r[1] = 0;
- r[2] = 0;
-}
MINLINE void copy_v2_v2_short(short r[2], const short a[2])
{
@@ -171,6 +169,13 @@ MINLINE void copy_v4_v4_short(short r[4], const short a[4])
}
/* int */
+MINLINE void zero_v3_int(int r[3])
+{
+ r[0] = 0;
+ r[1] = 0;
+ r[2] = 0;
+}
+
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
{
r[0] = a[0];
@@ -192,6 +197,35 @@ MINLINE void copy_v4_v4_int(int r[4], const int a[4])
r[3] = a[3];
}
+/* double */
+MINLINE void zero_v3_db(double r[3])
+{
+ r[0] = 0.0;
+ r[1] = 0.0;
+ r[2] = 0.0;
+}
+
+MINLINE void copy_v2_v2_db(double r[2], const double a[2])
+{
+ r[0] = a[0];
+ r[1] = a[1];
+}
+
+MINLINE void copy_v3_v3_db(double r[3], const double a[3])
+{
+ r[0] = a[0];
+ r[1] = a[1];
+ r[2] = a[2];
+}
+
+MINLINE void copy_v4_v4_db(double r[4], const double a[4])
+{
+ r[0] = a[0];
+ r[1] = a[1];
+ r[2] = a[2];
+ r[3] = a[3];
+}
+
/* int <-> float */
MINLINE void round_v2i_v2fl(int r[2], const float a[2])
{
@@ -348,6 +382,20 @@ MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
r[2] = a[2] + b[2];
}
+MINLINE void add_v3fl_v3fl_v3i(float r[3], const float a[3], const int b[3])
+{
+ r[0] = a[0] + (float)b[0];
+ r[1] = a[1] + (float)b[1];
+ r[2] = a[2] + (float)b[2];
+}
+
+MINLINE void add_v3fl_v3fl_v3s(float r[3], const float a[3], const short b[3])
+{
+ r[0] = a[0] + (float)b[0];
+ r[1] = a[1] + (float)b[1];
+ r[2] = a[2] + (float)b[2];
+}
+
MINLINE void add_v4_v4(float r[4], const float a[4])
{
r[0] += a[0];
@@ -396,6 +444,20 @@ MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
r[2] = a[2] - b[2];
}
+MINLINE void sub_v3_v3v3_int(int r[3], const int a[3], const int b[3])
+{
+ r[0] = a[0] - b[0];
+ r[1] = a[1] - b[1];
+ r[2] = a[2] - b[2];
+}
+
+MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float b[3])
+{
+ r[0] = (double)a[0] - (double)b[0];
+ r[1] = (double)a[1] - (double)b[1];
+ r[2] = (double)a[2] - (double)b[2];
+}
+
MINLINE void sub_v4_v4(float r[4], const float a[4])
{
r[0] -= a[0];
@@ -592,6 +654,13 @@ MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], cons
r[2] = a[2] + b[2] * c[2];
}
+MINLINE void madd_v3fl_v3fl_v3fl_v3i(float r[3], const float a[3], const float b[3], const int c[3])
+{
+ r[0] = a[0] + b[0] * (float)c[0];
+ r[1] = a[1] + b[1] * (float)c[1];
+ r[2] = a[2] + b[2] * (float)c[2];
+}
+
MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f)
{
r[0] += a[0] * f;
diff --git a/source/blender/blenlib/intern/memory_utils.c b/source/blender/blenlib/intern/memory_utils.c
index 2ebb8be5bb4..b0cfe709be8 100644
--- a/source/blender/blenlib/intern/memory_utils.c
+++ b/source/blender/blenlib/intern/memory_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,13 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/memory_utils.c
- * \ingroup bli
- * \brief Generic memory manipulation API.
+/** \file
+ * \ingroup bli
+ * \brief Generic memory manipulation API.
*
* This is to extend on existing functions
* such as ``memcpy`` & ``memcmp``.
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index ee2bab11ade..8126bdfb3ef 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenlib/intern/noise.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <math.h>
@@ -154,10 +145,11 @@ static const float hashpntf[768] = {
0.500001, 0.267322, 0.909654, 0.206176, 0.223987, 0.937698, 0.323423,
0.117501, 0.490308, 0.474372, 0.689943, 0.168671, 0.719417, 0.188928,
0.330464, 0.265273, 0.446271, 0.171933, 0.176133, 0.474616, 0.140182,
- 0.114246, 0.905043, 0.713870, 0.555261, 0.951333
+ 0.114246, 0.905043, 0.713870, 0.555261, 0.951333,
};
-const unsigned char hash[512] = {
+extern const unsigned char BLI_noise_hash_uchar_512[512]; /* Quiet warning. */
+const unsigned char BLI_noise_hash_uchar_512[512] = {
0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE, 0x95, 0x2E, 0xDC,
0x3F, 0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC, 0x79, 0x32, 0xD1, 0x59, 0xF4, 0x8, 0x8B, 0x63,
0x89, 0x2F, 0xB8, 0xB4, 0x97, 0x83, 0xF2, 0x8F, 0x18, 0xC7, 0x51, 0x14, 0x65, 0x87, 0x48, 0x20, 0x42, 0xA8, 0x80,
@@ -186,6 +178,7 @@ const unsigned char hash[512] = {
0xE5, 0xAF, 0x53, 0x7, 0xE0, 0x29, 0xA6, 0xC5, 0xE3, 0xF5, 0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E, 0x52, 0x2D,
0x21, 0xAD, 0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, 0x1A, 0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB, 0x5D,
};
+#define hash BLI_noise_hash_uchar_512
static const float hashvectf[768] = {
@@ -288,7 +281,9 @@ static float newPerlin(float x, float y, float z)
{
int A, AA, AB, B, BA, BB;
float u = floor(x), v = floor(y), w = floor(z);
- int X = ((int)u) & 255, Y = ((int)v) & 255, Z = ((int)w) & 255; /* FIND UNIT CUBE THAT CONTAINS POINT */
+ int X = ((int)u) & 255,
+ Y = ((int)v) & 255,
+ Z = ((int)w) & 255; /* FIND UNIT CUBE THAT CONTAINS POINT */
x -= u; /* FIND RELATIVE X,Y,Z */
y -= v; /* OF POINT IN CUBE. */
z -= w;
@@ -495,7 +490,7 @@ static const char g_perlin_data_ub[512 + 2] = {
0xD, 0x60, 0x8A, 0x4, 0x2C, 0x3E, 0x92, 0xE5, 0xAF, 0x53, 0x7, 0xE0,
0x29, 0xA6, 0xC5, 0xE3, 0xF5, 0xF7, 0x4A, 0x41, 0x26, 0x6A, 0x16, 0x5E,
0x52, 0x2D, 0x21, 0xAD, 0xF0, 0x91, 0xFF, 0xEA, 0x54, 0xFA, 0x66, 0x1A,
- 0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB, 0x5D, 0xA2, 0xA0
+ 0x45, 0x39, 0xCF, 0x75, 0xA4, 0x88, 0xFB, 0x5D, 0xA2, 0xA0,
};
@@ -1304,7 +1299,8 @@ static float voronoi_Cr(float x, float y, float z)
}
-/* Signed version of all 6 of the above, just 2x-1, not really correct though (range is potentially (0, sqrt(6)).
+/* Signed version of all 6 of the above, just 2x-1, not really correct though
+ * (range is potentially (0, sqrt(6)).
* Used in the musgrave functions */
static float voronoi_F1S(float x, float y, float z)
{
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 5c9a56e33d2..77b137a9d6d 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* various string, file, list operations.
*/
-/** \file blender/blenlib/intern/path_util.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <ctype.h>
@@ -42,7 +33,6 @@
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
-#include "BLI_string_utf8.h"
#include "BLI_fnmatch.h"
#ifdef WIN32
@@ -331,7 +321,7 @@ bool BLI_filename_make_safe(char *fname)
"con", "prn", "aux", "null",
"com1", "com2", "com3", "com4", "com5", "com6", "com7", "com8", "com9",
"lpt1", "lpt2", "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9",
- NULL
+ NULL,
};
char *lower_fname = BLI_strdup(fname);
const char **iname;
@@ -342,14 +332,16 @@ bool BLI_filename_make_safe(char *fname)
changed = true;
}
- /* Check for forbidden names - not we have to check all combination of upper and lower cases, hence the usage
- * of lower_fname (more efficient than using BLI_strcasestr repeatedly). */
+ /* Check for forbidden names - not we have to check all combination
+ * of upper and lower cases, hence the usage of lower_fname
+ * (more efficient than using BLI_strcasestr repeatedly). */
BLI_str_tolower_ascii(lower_fname, len);
for (iname = invalid_names; *iname; iname++) {
if (strstr(lower_fname, *iname) == lower_fname) {
const size_t iname_len = strlen(*iname);
- /* Only invalid if the whole name is made of the invalid chunk, or it has an (assumed extension) dot
- * just after. This means it will also catch 'valid' names like 'aux.foo.bar', but should be
+ /* Only invalid if the whole name is made of the invalid chunk, or it has an
+ * (assumed extension) dot just after. This means it will also catch 'valid'
+ * names like 'aux.foo.bar', but should be
* good enough for us! */
if ((iname_len == len) || (lower_fname[iname_len] == '.')) {
*fname = '_';
@@ -1048,7 +1040,8 @@ bool BLI_path_abs(char *path, const char *basepath)
BLI_str_replace_char(base + BLI_path_unc_prefix_len(base), '\\', '/');
if (lslash) {
- const int baselen = (int) (lslash - base) + 1; /* length up to and including last "/" */
+ /* length up to and including last "/" */
+ const int baselen = (int) (lslash - base) + 1;
/* use path for temp storage here, we copy back over it right away */
BLI_strncpy(path, tmp + 2, FILE_MAX); /* strip "//" */
@@ -1267,8 +1260,8 @@ void BLI_setenv_if_new(const char *env, const char *val)
}
/**
-* get an env var, result has to be used immediately
-*/
+ * Get an env var, result has to be used immediately.
+ */
const char *BLI_getenv(const char *env)
{
#ifdef _MSC_VER
@@ -1501,7 +1494,8 @@ bool BLI_path_extension_glob_validate(char *ext_fnmatch)
for (size_t i = strlen(ext_fnmatch); i-- > 0; ) {
if (ext_fnmatch[i] == ';') {
- /* Group separator, we truncate here if we only had wildcards so far. Otherwise, all is sound and fine. */
+ /* Group separator, we truncate here if we only had wildcards so far.
+ * Otherwise, all is sound and fine. */
if (only_wildcards) {
ext_fnmatch[i] = '\0';
return true;
@@ -1515,7 +1509,8 @@ bool BLI_path_extension_glob_validate(char *ext_fnmatch)
/* So far, only wildcards in last group of the pattern... */
only_wildcards = true;
}
- /* Only one group in the pattern, so even if its only made of wildcard(s), it is assumed vaid. */
+ /* Only one group in the pattern, so even if its only made of wildcard(s),
+ * it is assumed vaid. */
return false;
}
@@ -1613,7 +1608,8 @@ 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 */
+ /* +1 to include the slash and the last char */
+ BLI_strncpy(dir, string, MIN2(dirlen, lslash + 1));
}
else {
dir[0] = '\0';
diff --git a/source/blender/blenlib/intern/polyfill_2d.c b/source/blender/blenlib/intern/polyfill_2d.c
index 8c0870f0c07..5867cdee8bc 100644
--- a/source/blender/blenlib/intern/polyfill_2d.c
+++ b/source/blender/blenlib/intern/polyfill_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/polyfill_2d.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* An ear clipping algorithm to triangulate single boundary polygons.
*
@@ -89,8 +85,6 @@ typedef signed char eSign;
*
* This is a single purpose KDTree based on BLI_kdtree with some modifications
* to better suit polyfill2d.
- *
- *
* - #KDTreeNode2D is kept small (only 16 bytes),
* by not storing coords in the nodes and using index values rather then pointers
* to reference neg/pos values.
@@ -650,10 +644,13 @@ static PolyIndex *pf_ear_tip_find(
#endif
}
- /* Desperate mode: if no vertex is an ear tip, we are dealing with a degenerate polygon (e.g. nearly collinear).
- * Note that the input was not necessarily degenerate, but we could have made it so by clipping some valid ears.
+ /* Desperate mode: if no vertex is an ear tip,
+ * we are dealing with a degenerate polygon (e.g. nearly collinear).
+ * Note that the input was not necessarily degenerate,
+ * but we could have made it so by clipping some valid ears.
*
- * Idea taken from Martin Held, "FIST: Fast industrial-strength triangulation of polygons", Algorithmica (1998),
+ * Idea taken from Martin Held, "FIST: Fast industrial-strength triangulation of polygons",
+ * Algorithmica (1998),
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.115.291
*
* Return a convex or tangential vertex if one exists.
@@ -736,19 +733,22 @@ static bool pf_ear_tip_check(PolyFill *pf, PolyIndex *pi_ear_tip)
v3 = coords[pi_ear_tip->next->index];
/* Check if any point is inside the triangle formed by previous, current and next vertices.
- * Only consider vertices that are not part of this triangle, or else we'll always find one inside. */
+ * Only consider vertices that are not part of this triangle,
+ * or else we'll always find one inside. */
for (pi_curr = pi_ear_tip->next->next; pi_curr != pi_ear_tip->prev; pi_curr = pi_curr->next) {
- /* Concave vertices can obviously be inside the candidate ear, but so can tangential vertices
- * if they coincide with one of the triangle's vertices. */
+ /* Concave vertices can obviously be inside the candidate ear,
+ * but so can tangential vertices if they coincide with one of the triangle's vertices. */
if (pi_curr->sign != CONVEX) {
const float *v = coords[pi_curr->index];
/* Because the polygon has clockwise winding order,
* the area sign will be positive if the point is strictly inside.
* It will be 0 on the edge, which we want to include as well. */
- /* note: check (v3, v1) first since it fails _far_ more often then the other 2 checks (those fail equally).
- * It's logical - the chance is low that points exist on the same side as the ear we're clipping off. */
+ /* note: check (v3, v1) first since it fails _far_ more often then the other 2 checks
+ * (those fail equally).
+ * It's logical - the chance is low that points exist on the
+ * same side as the ear we're clipping off. */
if ((span_tri_v2_sign(v3, v1, v) != CONCAVE) &&
(span_tri_v2_sign(v1, v2, v) != CONCAVE) &&
(span_tri_v2_sign(v2, v3, v) != CONCAVE))
diff --git a/source/blender/blenlib/intern/polyfill_2d_beautify.c b/source/blender/blenlib/intern/polyfill_2d_beautify.c
index 17f3205aaff..17af81af866 100644
--- a/source/blender/blenlib/intern/polyfill_2d_beautify.c
+++ b/source/blender/blenlib/intern/polyfill_2d_beautify.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/polyfill_2d_beautify.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* This function is to improve the tessellation resulting from polyfill2d,
* creating optimal topology.
@@ -221,8 +217,9 @@ static void polyedge_beauty_cost_update_single(
const uint i = e->base_index;
/* recalculate edge */
const float cost = polyedge_rotate_beauty_calc(coords, edges, e);
- /* We can get cases where both choices generate very small negative costs, which leads to infinite loop.
- * Anyway, costs above that are not worth recomputing, maybe we could even optimize it to a smaller limit?
+ /* We can get cases where both choices generate very small negative costs,
+ * which leads to infinite loop. Anyway, costs above that are not worth recomputing,
+ * maybe we could even optimize it to a smaller limit?
* Actually, FLT_EPSILON is too small in some cases, 1e-6f seems to work OK hopefully?
* See T43578, T49478. */
if (cost < -1e-6f) {
@@ -309,8 +306,6 @@ static void polyedge_rotate(
/**
* The intention is that this calculates the output of #BLI_polyfill_calc
- *
- *
* \note assumes the \a coords form a boundary,
* so any edges running along contiguous (wrapped) indices,
* are ignored since the edges wont share 2 faces.
diff --git a/source/blender/blenlib/intern/quadric.c b/source/blender/blenlib/intern/quadric.c
index c9d27494455..8d5998786f4 100644
--- a/source/blender/blenlib/intern/quadric.c
+++ b/source/blender/blenlib/intern/quadric.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Laurence Bourn, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/quadric.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* \note This isn't fully complete,
* possible there are other useful functions to add here.
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c
index c85b471fb2d..764d0c48f0d 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/rand.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
@@ -54,7 +46,8 @@
#define ADDEND 0xB
#define LOWSEED 0x330E
-extern unsigned char hash[]; // noise.c
+extern unsigned char BLI_noise_hash_uchar_512[512]; /* noise.c */
+#define hash BLI_noise_hash_uchar_512
/**
* Random Number Generator.
@@ -84,6 +77,11 @@ RNG *BLI_rng_new_srandom(unsigned int seed)
return rng;
}
+RNG *BLI_rng_copy(RNG *rng)
+{
+ return MEM_dupallocN(rng);
+}
+
void BLI_rng_free(RNG *rng)
{
MEM_freeN(rng);
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 5b1e378a2da..9b26ad24230 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenlib/intern/rct.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* A minimalist lib for functions doing stuff with rectangle structs.
*/
@@ -179,7 +170,8 @@ bool BLI_rcti_inside_rcti(const rcti *rct_a, const rcti *rct_b)
}
-/* based closely on 'isect_seg_seg_v2_int', but in modified so corner cases are treated as intersections */
+/* based closely on 'isect_seg_seg_v2_int',
+ * but in modified so corner cases are treated as intersections */
static int isect_segments_i(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
{
const double div = (double)((v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]));
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 427a3eb1edb..12e1425837e 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* (uit traces) maart 95
*/
-/** \file blender/blenlib/intern/scanfill.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Triangulate multiple 2D/3D polygon with support for holes,
* use for tessellating curves, fonts and geometry.
@@ -201,7 +193,8 @@ static bool boundisect(PolyFill *pf2, PolyFill *pf1)
}
-static void mergepolysSimp(ScanFillContext *sf_ctx, PolyFill *pf1, PolyFill *pf2) /* add pf2 to pf1 */
+/* add pf2 to pf1 */
+static void mergepolysSimp(ScanFillContext *sf_ctx, PolyFill *pf1, PolyFill *pf2)
{
ScanFillVert *eve;
ScanFillEdge *eed;
@@ -502,7 +495,8 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
eve->f = SF_VERT_NEW; /* flag for connectedges later on */
sc->vert = eve;
sc->edge_first = sc->edge_last = NULL;
- /* if (even->tmp.v == NULL) eve->tmp.u = verts; */ /* Note, debug print only will work for curve polyfill, union is in use for mesh */
+ /* Note, debug print only will work for curve polyfill, union is in use for mesh */
+ /* if (even->tmp.v == NULL) eve->tmp.u = verts; */
sc++;
}
}
@@ -570,7 +564,8 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
maxface = 2 * verts; /* 2*verts: based at a filled circle within a triangle */
}
else {
- maxface = verts - 2; /* when we don't calc any holes, we assume face is a non overlapping loop */
+ /* when we don't calc any holes, we assume face is a non overlapping loop */
+ maxface = verts - 2;
}
sc = scdata;
@@ -593,7 +588,8 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
ed1 = sc->edge_first;
ed2 = ed1->next;
- /* commented out... the ESC here delivers corrupted memory (and doesnt work during grab) */
+ /* commented out... the ESC here delivers corrupted memory
+ * (and doesnt work during grab) */
/* if (callLocalInterruptCallBack()) break; */
if (totface >= maxface) {
/* printf("Fill error: endless loop. Escaped at vert %d, tot: %d.\n", a, verts); */
@@ -634,15 +630,16 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
if (testedgeside(v3->xy, v1->xy, sc1->vert->xy)) {
/* point is in triangle */
- /* because multiple points can be inside triangle (concave holes) */
- /* we continue searching and pick the one with sharpest corner */
-
+ /* Because multiple points can be inside triangle
+ * (concave holes) we continue searching and pick the
+ * one with sharpest corner. */
if (best_sc == NULL) {
/* even without holes we need to keep checking [#35861] */
best_sc = sc1;
}
else {
- /* prevent angle calc for the simple cases only 1 vertex is found */
+ /* Prevent angle calc for the simple cases
+ * only 1 vertex is found. */
if (firsttime == false) {
angle_best_cos = cos_v2v2v2(v2->xy, v1->xy, best_sc->vert->xy);
firsttime = true;
diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c
index ef1df479f13..f0107908787 100644
--- a/source/blender/blenlib/intern/scanfill_utils.c
+++ b/source/blender/blenlib/intern/scanfill_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/blenlib/intern/scanfill_utils.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdio.h>
@@ -214,7 +208,10 @@ static bool scanfill_preprocess_self_isect(
copy_v2_v2(isect->co, pt);
isect->co[2] = eed->v1->co[2];
isect->v = BLI_scanfill_vert_add(sf_ctx, isect->co);
- isect->v->poly_nr = eed->v1->poly_nr; /* NOTE: vert may belong to 2 polys now */
+
+ /* NOTE: vert may belong to 2 polys now */
+ isect->v->poly_nr = eed->v1->poly_nr;
+
VFLAG_SET(isect->v, V_ISISECT);
edge_isect_ls_add(isect_hash, eed, isect);
edge_isect_ls_add(isect_hash, eed_other, isect);
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c
index 56d77abed24..b012ff36bf1 100644
--- a/source/blender/blenlib/intern/smallhash.c
+++ b/source/blender/blenlib/intern/smallhash.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/smallhash.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* A light stack-friendly hash library, it uses stack space for relatively small, fixed size hash tables
* but falls back to heap memory once the stack limits reached (#SMSTACKSIZE).
@@ -87,7 +79,8 @@ BLI_INLINE bool smallhash_val_is_used(const void *val)
#endif
}
-extern const uint hashsizes[];
+extern const uint BLI_ghash_hash_sizes[];
+#define hashsizes BLI_ghash_hash_sizes
BLI_INLINE uint smallhash_key(const uintptr_t key)
{
diff --git a/source/blender/blenlib/intern/sort.c b/source/blender/blenlib/intern/sort.c
index 19fea87fb41..af206975e16 100644
--- a/source/blender/blenlib/intern/sort.c
+++ b/source/blender/blenlib/intern/sort.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Benoit Bolsee,
- * Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/sort.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdlib.h>
diff --git a/source/blender/blenlib/intern/sort_utils.c b/source/blender/blenlib/intern/sort_utils.c
index 2d55e77b98b..7166b7753aa 100644
--- a/source/blender/blenlib/intern/sort_utils.c
+++ b/source/blender/blenlib/intern/sort_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/sort_utils.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Utility functions for sorting common types.
*/
diff --git a/source/blender/blenlib/intern/stack.c b/source/blender/blenlib/intern/stack.c
index 084d692fcf0..4f6f9024fa5 100644
--- a/source/blender/blenlib/intern/stack.c
+++ b/source/blender/blenlib/intern/stack.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Nicholas Bishop
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenlib/intern/stack.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <string.h>
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index cfcc2bc4390..4fb519e7f26 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* Reorganised mar-01 nzc
* Some really low-level file thingies.
*/
-/** \file blender/blenlib/intern/storage.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <sys/types.h>
@@ -74,7 +66,6 @@
#include "BLI_linklist.h"
#include "BLI_string.h"
#include "BLI_fileops.h"
-#include "BLI_fileops_types.h"
#include "BLI_path_util.h"
/**
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index f092d278338..dbec1a3153c 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenlib/intern/string.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
@@ -380,7 +371,8 @@ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict
{
const char *startMatch, *endMatch;
- /* get the starting point (i.e. where prefix starts, and add prefixLen+1 to it to get be after the first " */
+ /* get the starting point (i.e. where prefix starts, and add prefixLen+1
+ * to it to get be after the first " */
startMatch = strstr(str, prefix);
if (startMatch) {
const size_t prefixLen = strlen(prefix);
@@ -438,8 +430,8 @@ char *BLI_str_replaceN(const char *__restrict str, const char *__restrict substr
* copy the text up to this position and advance the current position in the string
*/
if (str != match) {
- /* add the segment of the string from str to match to the buffer, then restore the value at match
- */
+ /* add the segment of the string from str to match to the buffer,
+ * then restore the value at match */
BLI_dynstr_nappend(ds, str, (match - str));
/* now our current position should be set on the start of the match */
diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c
index d293490c846..8048ebe7052 100644
--- a/source/blender/blenlib/intern/string_cursor_utf8.c
+++ b/source/blender/blenlib/intern/string_cursor_utf8.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Campbell Barton.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenlib/intern/string_cursor_utf8.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdio.h>
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 1e2a9629e0f..d4b4bba810c 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -19,16 +17,11 @@
* Code from gutf8.c Copyright (C) 1999 Tom Tromey
* Copyright (C) 2000 Red Hat, Inc.
* All rights reserved.
- *
- * Contributor(s): Campbell Barton.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
- /** \file blender/blenlib/intern/string_utf8.c
- * \ingroup bli
- */
+/** \file
+ * \ingroup bli
+ */
#include <string.h>
#include <wchar.h>
@@ -48,7 +41,8 @@
// #define DEBUG_STRSIZE
/* array copied from glib's gutf8.c, */
-/* Note: last two values (0xfe and 0xff) are forbidden in utf-8, so they are considered 1 byte length too. */
+/* Note: last two values (0xfe and 0xff) are forbidden in utf-8,
+ * so they are considered 1 byte length too. */
static const size_t utf8_skip_data[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -57,7 +51,7 @@ static const size_t utf8_skip_data[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1,
};
/* from libswish3, originally called u8_isvalid(),
@@ -90,8 +84,8 @@ ptrdiff_t BLI_utf8_invalid_byte(const char *str, size_t length)
if ((c & 0xc0) != 0xc0)
goto utf8_error;
- /* Note that since we always increase p (and decrease length) by one byte in main loop, we only add/subtract
- * extra utf8 bytes in code below
+ /* Note that since we always increase p (and decrease length) by one byte in main loop,
+ * we only add/subtract extra utf8 bytes in code below
* (ab number, aka number of bytes remaining in the utf8 sequence after the initial one). */
ab = (int)utf8_skip_data[c] - 1;
if (length <= ab) {
@@ -272,7 +266,8 @@ char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t
size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxncpy)
{
const size_t maxlen = maxncpy - 1;
- const int64_t maxlen_secured = (int64_t)maxlen - 6; /* 6 is max utf8 length of an unicode char. */
+ /* 6 is max utf8 length of an unicode char. */
+ const int64_t maxlen_secured = (int64_t)maxlen - 6;
size_t len = 0;
BLI_assert(maxncpy != 0);
@@ -285,8 +280,8 @@ size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict
len += BLI_str_utf8_from_unicode((uint)*src++, dst + len);
}
- /* We have to be more careful for the last six bytes, to avoid buffer overflow in case utf8-encoded char
- * would be too long for our dst buffer. */
+ /* We have to be more careful for the last six bytes,
+ * to avoid buffer overflow in case utf8-encoded char would be too long for our dst buffer. */
while (*src) {
char t[6];
size_t l = BLI_str_utf8_from_unicode((uint)*src++, t);
diff --git a/source/blender/blenlib/intern/string_utils.c b/source/blender/blenlib/intern/string_utils.c
index ca7894cf115..3e13b0d3a31 100644
--- a/source/blender/blenlib/intern/string_utils.c
+++ b/source/blender/blenlib/intern/string_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2017 by the Blender FOundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenlib/intern/string_utils.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <ctype.h>
@@ -34,7 +27,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_string_utils.h"
diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c
index 82c42c42d9d..2b0dfd045ca 100644
--- a/source/blender/blenlib/intern/system.c
+++ b/source/blender/blenlib/intern/system.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/system.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdio.h>
@@ -33,6 +29,7 @@
/* for backtrace and gethostname/GetComputerName */
#if defined(WIN32)
+# include <intrin.h>
# include <windows.h>
# include <dbghelp.h>
#else
diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c
index 4c6f27ab359..e2feef16049 100644
--- a/source/blender/blenlib/intern/task.c
+++ b/source/blender/blenlib/intern/task.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/task.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* A generic task system which can be used for any task based subsystem.
*/
@@ -364,12 +360,13 @@ static bool task_scheduler_thread_wait_pop(TaskScheduler *scheduler, Task **task
do {
Task *current_task;
- /* Assuming we can only have a void queue in 'exit' case here seems logical (we should only be here after
- * our worker thread has been woken up from a condition_wait(), which only happens after a new task was
- * added to the queue), but it is wrong.
- * Waiting on condition may wake up the thread even if condition is not signaled (spurious wake-ups), and some
- * race condition may also empty the queue **after** condition has been signaled, but **before** awoken thread
- * reaches this point...
+ /* Assuming we can only have a void queue in 'exit' case here seems logical
+ * (we should only be here after our worker thread has been woken up from a
+ * condition_wait(), which only happens after a new task was added to the queue),
+ * but it is wrong.
+ * Waiting on condition may wake up the thread even if condition is not signaled
+ * (spurious wake-ups), and some race condition may also empty the queue **after**
+ * condition has been signaled, but **before** awoken thread reaches this point...
* See http://stackoverflow.com/questions/8594591
*
* So we only abort here if do_exit is set.
@@ -635,7 +632,8 @@ static TaskPool *task_pool_create_ex(TaskScheduler *scheduler,
TaskPool *pool = MEM_mallocN(sizeof(TaskPool), "TaskPool");
#ifndef NDEBUG
- /* Assert we do not try to create a background pool from some parent task - those only work OK from main thread. */
+ /* Assert we do not try to create a background pool from some parent task -
+ * those only work OK from main thread. */
if (is_background) {
const pthread_t thread_id = pthread_self();
int i = scheduler->num_threads;
@@ -730,7 +728,7 @@ TaskPool *BLI_task_pool_create_background(TaskScheduler *scheduler, void *userda
/**
* Similar to BLI_task_pool_create() but does not schedule any tasks for execution
- * for until BLI_task_pool_work_and_wait() is called. This helps reducing therading
+ * for until BLI_task_pool_work_and_wait() is called. This helps reducing threading
* overhead when pushing huge amount of small initial tasks from the main thread.
*/
TaskPool *BLI_task_pool_create_suspended(TaskScheduler *scheduler, void *userdata)
@@ -996,7 +994,6 @@ void BLI_task_pool_delayed_push_end(TaskPool *pool, int thread_id)
* - #BLI_task_parallel_foreach_link (#Link - single linked list)
* - #BLI_task_parallel_foreach_ghash/gset (#GHash/#GSet - hash & set)
* - #BLI_task_parallel_foreach_mempool (#BLI_mempool - iterate over mempools)
- *
*/
/* Allows to avoid using malloc for userdata_chunk in tasks, when small enough. */
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index f8c67705fd7..89574dd395f 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/threads.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <stdlib.h>
@@ -849,6 +841,7 @@ void BLI_threaded_malloc_end(void)
/* **** Special functions to help performance on crazy NUMA setups. **** */
+#if 0 /* UNUSED */
static bool check_is_threadripper2_alike_topology(void)
{
/* NOTE: We hope operating system does not support CPU hotswap to
@@ -866,13 +859,13 @@ static bool check_is_threadripper2_alike_topology(void)
}
if (strstr(cpu_brand, "Threadripper")) {
/* NOTE: We consinder all Threadrippers having similar topology to
- * the second one. This is because we are trying to utilize NUMA node
- * 0 as much as possible. This node does exist on earlier versions of
- * threadripper and setting affinity to it should not have negative
- * effect.
- * This allows us to avoid per-model check, making the code more
- * reliable for the CPUs which are not yet released.
- */
+ * the second one. This is because we are trying to utilize NUMA node
+ * 0 as much as possible. This node does exist on earlier versions of
+ * threadripper and setting affinity to it should not have negative
+ * effect.
+ * This allows us to avoid per-model check, making the code more
+ * reliable for the CPUs which are not yet released.
+ */
if (strstr(cpu_brand, "2990WX") || strstr(cpu_brand, "2950X")) {
is_threadripper2 = true;
}
@@ -896,7 +889,7 @@ static void threadripper_put_process_on_fast_node(void)
if (!is_numa_available) {
return;
}
- /* NOTE: Technically, we can use NUMA nodes 0 and 2 and usning both of
+ /* NOTE: Technically, we can use NUMA nodes 0 and 2 and using both of
* them in the affinity mask will allow OS to schedule threads more
* flexible,possibly increasing overall performance when multiple apps
* are crunching numbers.
@@ -928,17 +921,30 @@ static void threadripper_put_thread_on_fast_node(void)
/* See additional note about NUMA disabled in BIOS above. */
numaAPI_RunThreadOnNode(0);
}
+#endif /* UNUSED */
void BLI_thread_put_process_on_fast_node(void)
{
+ /* Disabled for now since this causes only 16 threads to be used on a
+ * threadripper for computations like sculpting and fluid sim. The problem
+ * is that all threads created as children from this thread will inherit
+ * the NUMA node and so will end up on the same node. This can be fixed
+ * case-by-case by assigning the NUMA node for every child thread, however
+ * this is difficult for external libraries and OpenMP, and out of our
+ * control for plugins like external renderers. */
+#if 0
if (check_is_threadripper2_alike_topology()) {
threadripper_put_process_on_fast_node();
}
+#endif
}
void BLI_thread_put_thread_on_fast_node(void)
{
+ /* Disabled for now, see comment above. */
+#if 0
if (check_is_threadripper2_alike_topology()) {
threadripper_put_thread_on_fast_node();
}
+#endif
}
diff --git a/source/blender/blenlib/intern/time.c b/source/blender/blenlib/intern/time.c
index a2665f96b29..ee90e74ea52 100644
--- a/source/blender/blenlib/intern/time.c
+++ b/source/blender/blenlib/intern/time.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/time.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
diff --git a/source/blender/blenlib/intern/timecode.c b/source/blender/blenlib/intern/timecode.c
index ab7766d2cd6..d87f1037254 100644
--- a/source/blender/blenlib/intern/timecode.c
+++ b/source/blender/blenlib/intern/timecode.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/timecode.c
- * \ingroup blendlib
+/** \file
+ * \ingroup blendlib
*
* Time-Code string formatting
*/
@@ -135,7 +128,8 @@ size_t BLI_timecode_string_from_time(
}
case USER_TIMECODE_SMPTE_MSF:
{
- /* reduced SMPTE format that always shows minutes, seconds, frames. Hours only shown as needed. */
+ /* reduced SMPTE format that always shows minutes, seconds, frames.
+ * Hours only shown as needed. */
if (hours) {
rlen = BLI_snprintf_rlen(str, maxncpy, "%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
}
@@ -165,7 +159,8 @@ size_t BLI_timecode_string_from_time(
}
case USER_TIMECODE_SUBRIP:
{
- /* SubRip, like SMPTE milliseconds but seconds and milliseconds are separated by a comma, not a dot... */
+ /* SubRip, like SMPTE milliseconds but seconds and milliseconds
+ * are separated by a comma, not a dot... */
/* precision of decimal part */
const int ms_dp = (power <= 0) ? (1 - power) : 1;
diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c
index cf6a6366e9a..5ba295cb997 100644
--- a/source/blender/blenlib/intern/uvproject.c
+++ b/source/blender/blenlib/intern/uvproject.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/uvproject.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include <math.h>
diff --git a/source/blender/blenlib/intern/voronoi_2d.c b/source/blender/blenlib/intern/voronoi_2d.c
index 40e98d5914c..cf502a33774 100644
--- a/source/blender/blenlib/intern/voronoi_2d.c
+++ b/source/blender/blenlib/intern/voronoi_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/voronoi_2d.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Fortune's algorithm implemented using explanation and some code snippets from
* http://blog.ivank.net/fortunes-algorithm-and-implementation.html
@@ -41,7 +35,7 @@
enum {
voronoiEventType_Site = 0,
- voronoiEventType_Circle = 1
+ voronoiEventType_Circle = 1,
};
typedef struct VoronoiEvent {
diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c
index 37b7ca37ba5..fbd6fb74ab5 100644
--- a/source/blender/blenlib/intern/voxel.c
+++ b/source/blender/blenlib/intern/voxel.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Matt Ebb, Raul Fernandez Hernandez (Farsthary).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenlib/intern/voxel.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
#include "BLI_utildefines.h"
@@ -63,7 +55,8 @@ BLI_INLINE int FLOORI(float x)
return ((x >= 0.f) || (float)r == x) ? r : (r - 1);
}
-/* clamp function, cannot use the CLAMPIS macro, it sometimes returns unwanted results apparently related to
+/* 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,
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index bf0b28b5cc2..fb16ccb36bd 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* Windows-posix compatibility layer, windows-specific functions.
*/
-/** \file blender/blenlib/intern/winstuff.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*/
diff --git a/source/blender/blenlib/intern/winstuff_dir.c b/source/blender/blenlib/intern/winstuff_dir.c
index 4e2a6976ce4..0b3cf07883d 100644
--- a/source/blender/blenlib/intern/winstuff_dir.c
+++ b/source/blender/blenlib/intern/winstuff_dir.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* 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): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* Windows-posix compatibility layer for opendir/readdir/closedir
*/
-/** \file blender/blenlib/intern/winstuff_dir.c
- * \ingroup bli
+/** \file
+ * \ingroup bli
*
* Posix compatibility functions for windows dealing with DIR
* (opendir, readdir, closedir)
diff --git a/source/blender/blenloader/BLO_blend_defs.h b/source/blender/blenloader/BLO_blend_defs.h
index 6776b1c3338..aefe3a7de08 100644
--- a/source/blender/blenloader/BLO_blend_defs.h
+++ b/source/blender/blenloader/BLO_blend_defs.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLO_BLEND_DEFS_H__
#define __BLO_BLEND_DEFS_H__
-/** \file BLO_blend_defs.h
- * \ingroup blenloader
- * \brief defines for blendfile codes
+/** \file
+ * \ingroup blenloader
+ * \brief defines for blendfile codes
*/
/* INTEGER CODES */
diff --git a/source/blender/blenloader/BLO_blend_validate.h b/source/blender/blenloader/BLO_blend_validate.h
new file mode 100644
index 00000000000..c0c2ceabb7f
--- /dev/null
+++ b/source/blender/blenloader/BLO_blend_validate.h
@@ -0,0 +1,34 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ */
+
+#ifndef __BLO_BLEND_VALIDATE_H__
+#define __BLO_BLEND_VALIDATE_H__
+
+/** \file
+ * \ingroup blenloader
+ * \brief Utils ensuring .blend file (i.e. Main) is in valid state during write and/or read process.
+ */
+
+struct Main;
+struct ReportList;
+
+bool BLO_main_validate_libraries(struct Main *bmain, struct ReportList *reports);
+bool BLO_main_validate_shapekeys(struct Main *bmain, struct ReportList *reports);
+
+#endif
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index 99226b57fe2..c3a1c0e5185 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,39 +15,33 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLO_READFILE_H__
#define __BLO_READFILE_H__
-/** \file BLO_readfile.h
- * \ingroup blenloader
- * \brief external readfile function prototypes.
+/** \file
+ * \ingroup blenloader
+ * \brief external readfile function prototypes.
*/
#ifdef __cplusplus
extern "C" {
#endif
+struct BHead;
struct BlendThumbnail;
-struct bScreen;
+struct FileData;
struct LinkNode;
struct ListBase;
struct Main;
struct MemFile;
struct ReportList;
struct Scene;
-struct ViewLayer;
struct UserDef;
struct View3D;
+struct ViewLayer;
struct bContext;
-struct BHead;
-struct FileData;
+struct bScreen;
struct wmWindowManager;
typedef struct BlendHandle BlendHandle;
@@ -57,7 +49,7 @@ typedef struct BlendHandle BlendHandle;
typedef enum eBlenFileType {
BLENFILETYPE_BLEND = 1,
BLENFILETYPE_PUB = 2,
- BLENFILETYPE_RUNTIME = 3
+ BLENFILETYPE_RUNTIME = 3,
} eBlenFileType;
typedef struct BlendFileData {
@@ -141,8 +133,7 @@ struct Main *BLO_library_link_begin(struct Main *mainvar, BlendHandle **bh, cons
struct ID *BLO_library_link_named_part(struct Main *mainl, BlendHandle **bh, const short idcode, const char *name);
struct ID *BLO_library_link_named_part_ex(
struct Main *mainl, BlendHandle **bh,
- const short idcode, const char *name, const int flag,
- struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, const struct View3D *v3d);
+ const short idcode, const char *name, const int flag);
void BLO_library_link_end(
struct Main *mainl, BlendHandle **bh, int flag,
struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, const struct View3D *v3d);
@@ -153,7 +144,7 @@ void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char
/* internal function but we need to expose it */
void blo_lib_link_restore(
- struct Main *newmain, struct wmWindowManager *curwm,
+ struct Main *oldmain, struct Main *newmain, struct wmWindowManager *curwm,
struct Scene *curscene, struct ViewLayer *cur_render_layer);
typedef void (*BLOExpandDoitCallback) (void *fdhandle, struct Main *mainvar, void *idv);
diff --git a/source/blender/blenloader/BLO_undofile.h b/source/blender/blenloader/BLO_undofile.h
index 59df361c7c1..1b71081547a 100644
--- a/source/blender/blenloader/BLO_undofile.h
+++ b/source/blender/blenloader/BLO_undofile.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* 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 *****
* external writefile function prototypes
*/
#ifndef __BLO_UNDOFILE_H__
#define __BLO_UNDOFILE_H__
-/** \file BLO_undofile.h
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
struct Scene;
diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h
index d615514f081..db9899ea95b 100644
--- a/source/blender/blenloader/BLO_writefile.h
+++ b/source/blender/blenloader/BLO_writefile.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,19 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLO_WRITEFILE_H__
#define __BLO_WRITEFILE_H__
-/** \file BLO_writefile.h
- * \ingroup blenloader
- * \brief external writefile function prototypes.
+/** \file
+ * \ingroup blenloader
+ * \brief external writefile function prototypes.
*/
struct BlendThumbnail;
-struct MemFile;
struct Main;
+struct MemFile;
struct ReportList;
extern bool BLO_write_file(
@@ -44,6 +36,4 @@ extern bool BLO_write_file(
extern bool BLO_write_file_mem(
struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags);
-bool BLO_main_validate_libraries(struct Main *bmain, struct ReportList *reports);
-
#endif
diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index 49987cb860c..b9bec1b97b3 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -59,11 +54,13 @@ set(SRC
intern/versioning_270.c
intern/versioning_280.c
intern/versioning_defaults.c
+ intern/versioning_dna.c
intern/versioning_legacy.c
intern/versioning_userdef.c
intern/writefile.c
BLO_blend_defs.h
+ BLO_blend_validate.h
BLO_readfile.h
BLO_undofile.h
BLO_writefile.h
diff --git a/source/blender/blenloader/intern/blend_validate.c b/source/blender/blenloader/intern/blend_validate.c
index 07d0379553d..f36438417ba 100644
--- a/source/blender/blenloader/intern/blend_validate.c
+++ b/source/blender/blenloader/intern/blend_validate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,14 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenloader/intern/blend_validate.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*
* Utils to check/validate a Main is in sane state, only checks relations between datablocks and libraries for now.
*
* \note Does not *fix* anything, only reports found errors.
- *
*/
#include <string.h> // for strrchr strncmp strstr
@@ -40,19 +32,21 @@
#include "MEM_guardedalloc.h"
#include "DNA_sdna_types.h"
+#include "DNA_key_types.h"
#include "DNA_windowmanager_types.h"
+#include "BKE_key.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
+#include "BLO_blend_validate.h"
#include "BLO_readfile.h"
-#include "BLO_writefile.h"
#include "readfile.h"
-/* Does not fix anything, but checks that all linked data-blocks are still valid (i.e. pointing to the right library). */
-bool BLO_main_validate_libraries(struct Main *bmain, struct ReportList *reports)
+/** Check (but do *not* fix) that all linked data-blocks are still valid (i.e. pointing to the right library). */
+bool BLO_main_validate_libraries(Main *bmain, ReportList *reports)
{
ListBase mainlist;
bool is_valid = true;
@@ -151,3 +145,35 @@ bool BLO_main_validate_libraries(struct Main *bmain, struct ReportList *reports)
return is_valid;
}
+
+/** Check (and fix if needed) that shape key's 'from' pointer is valid. */
+bool BLO_main_validate_shapekeys(Main *bmain, ReportList *reports)
+{
+ ID *id;
+ bool is_valid = true;
+
+ BKE_main_lock(bmain);
+
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ if (!BKE_key_idtype_support(GS(id->name))) {
+ break;
+ }
+ if (id->lib == NULL) {
+ /* We assume lib data is valid... */
+ Key *shapekey = BKE_key_from_id(id);
+ if (shapekey != NULL && shapekey->from != id) {
+ is_valid = false;
+ BKE_reportf(reports, RPT_ERROR,
+ "ID %s uses shapekey %s, but its 'from' pointer is invalid (%p), fixing...",
+ id->name, shapekey->id.name, shapekey->from);
+ shapekey->from = id;
+ }
+ }
+ }
+ FOREACH_MAIN_ID_END;
+
+ BKE_main_unlock(bmain);
+
+ return is_valid;
+}
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index fee648ac5f4..7fcacd8f30e 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* .blend file reading entry point
*/
-/** \file blender/blenloader/intern/readblenentry.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
@@ -41,7 +33,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
-#include "BLI_path_util.h"
#include "BLI_ghash.h"
#include "BLI_linklist.h"
#include "BLI_listbase.h"
@@ -52,7 +43,6 @@
#include "BKE_main.h"
-#include "BKE_library.h" // for BKE_main_free
#include "BKE_idcode.h"
#include "BLO_readfile.h"
@@ -83,7 +73,7 @@ BlendHandle *BLO_blendhandle_from_file(const char *filepath, ReportList *reports
{
BlendHandle *bh;
- bh = (BlendHandle *)blo_openblenderfile(filepath, reports);
+ bh = (BlendHandle *)blo_filedata_from_file(filepath, reports);
return bh;
}
@@ -99,7 +89,7 @@ BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize)
{
BlendHandle *bh;
- bh = (BlendHandle *)blo_openblendermemory(mem, memsize, NULL);
+ bh = (BlendHandle *)blo_filedata_from_memory(mem, memsize, NULL);
return bh;
}
@@ -110,7 +100,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
BHead *bhead;
fprintf(fp, "[\n");
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == ENDB)
break;
else {
@@ -149,9 +139,9 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
BHead *bhead;
int tot = 0;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == ofblocktype) {
- const char *idname = bhead_id_name(fd, bhead);
+ const char *idname = blo_bhead_id_name(fd, bhead);
BLI_linklist_prepend(&names, strdup(idname + 2));
tot++;
@@ -182,9 +172,9 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
PreviewImage *new_prv = NULL;
int tot = 0;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == ofblocktype) {
- const char *idname = bhead_id_name(fd, bhead);
+ const char *idname = blo_bhead_id_name(fd, bhead);
switch (GS(idname)) {
case ID_MA: /* fall through */
case ID_TE: /* fall through */
@@ -213,7 +203,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
uint *rect = NULL;
size_t len = new_prv->w[0] * new_prv->h[0] * sizeof(uint);
new_prv->rect[0] = MEM_callocN(len, __func__);
- bhead = blo_nextbhead(fd, bhead);
+ bhead = blo_bhead_next(fd, bhead);
rect = (uint *)(bhead + 1);
BLI_assert(len == bhead->len);
memcpy(new_prv->rect[0], rect, len);
@@ -230,7 +220,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
uint *rect = NULL;
size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(uint);
new_prv->rect[1] = MEM_callocN(len, __func__);
- bhead = blo_nextbhead(fd, bhead);
+ bhead = blo_bhead_next(fd, bhead);
rect = (uint *)(bhead + 1);
BLI_assert(len == bhead->len);
memcpy(new_prv->rect[1], rect, len);
@@ -263,7 +253,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
}
/**
- * Gets the names of all the linkable datablock types available in a file. (e.g. "Scene", "Mesh", "Lamp", etc.).
+ * Gets the names of all the linkable datablock types available in a file. (e.g. "Scene", "Mesh", "Light", etc.).
*
* \param bh: The blendhandle to access.
* \return A BLI_linklist of strings. The string links should be freed with malloc.
@@ -275,7 +265,7 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
LinkNode *names = NULL;
BHead *bhead;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == ENDB) {
break;
}
@@ -304,7 +294,7 @@ void BLO_blendhandle_close(BlendHandle *bh)
{
FileData *fd = (FileData *)bh;
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
}
/**********/
@@ -325,12 +315,12 @@ BlendFileData *BLO_read_from_file(
BlendFileData *bfd = NULL;
FileData *fd;
- fd = blo_openblenderfile(filepath, reports);
+ fd = blo_filedata_from_file(filepath, reports);
if (fd) {
fd->reports = reports;
fd->skip_flags = skip_flags;
bfd = blo_read_file_internal(fd, filepath);
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
}
return bfd;
@@ -353,12 +343,12 @@ BlendFileData *BLO_read_from_memory(
BlendFileData *bfd = NULL;
FileData *fd;
- fd = blo_openblendermemory(mem, memsize, reports);
+ fd = blo_filedata_from_memory(mem, memsize, reports);
if (fd) {
fd->reports = reports;
fd->skip_flags = skip_flags;
bfd = blo_read_file_internal(fd, "");
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
}
return bfd;
@@ -379,7 +369,7 @@ BlendFileData *BLO_read_from_memfile(
FileData *fd;
ListBase old_mainlist;
- fd = blo_openblendermemfile(memfile, reports);
+ fd = blo_filedata_from_memfile(memfile, reports);
if (fd) {
fd->reports = reports;
fd->skip_flags = skip_flags;
@@ -449,7 +439,7 @@ BlendFileData *BLO_read_from_memfile(
}
/* In any case, we need to move all lib datablocks themselves - those are 'first level data',
* getting rid of them would imply updating spaces & co to prevent invalid pointers access. */
- BLI_movelisttolist(&newmain->library, &oldmain->library);
+ BLI_movelisttolist(&newmain->libraries, &oldmain->libraries);
blo_join_main(&new_mainlist);
}
@@ -460,7 +450,7 @@ BlendFileData *BLO_read_from_memfile(
* will be cleared together with oldmain... */
blo_join_main(&old_mainlist);
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
}
return bfd;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6bd3f65f011..0907b3caf32 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenloader/intern/readfile.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
-
#include "zlib.h"
#include <limits.h>
@@ -78,7 +69,7 @@
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_layer_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_meta_types.h"
#include "DNA_material_types.h"
@@ -130,7 +121,6 @@
#include "BKE_collection.h"
#include "BKE_colortools.h"
#include "BKE_constraint.h"
-#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_effect.h"
#include "BKE_fcurve.h"
@@ -172,9 +162,10 @@
#include "NOD_common.h"
#include "NOD_socket.h"
+#include "BLO_blend_defs.h"
+#include "BLO_blend_validate.h"
#include "BLO_readfile.h"
#include "BLO_undofile.h"
-#include "BLO_blend_defs.h"
#include "RE_engine.h"
@@ -232,6 +223,15 @@
* (added remark: oh, i thought that was solved? will look at that... (ton).
*/
+/**
+ * Delay reading blocks we might not use (especially applies to library linking).
+ * which keeps large arrays in memory from data-blocks we may not even use.
+ *
+ * \note This is disabled when using compression,
+ * while zlib supports seek ist's unusably slow, see: T61880.
+ */
+#define USE_BHEAD_READ_ON_DEMAND
+
/* use GHash for BHead name-based lookups (speeds up linking) */
#define USE_GHASH_BHEAD
@@ -249,6 +249,7 @@
/* local prototypes */
+static void read_libraries(FileData *basefd, ListBase *mainlist);
static void *read_struct(FileData *fd, BHead *bh, const char *blockname);
static void direct_link_modifiers(FileData *fd, ListBase *lb);
static BHead *find_bhead_from_code_name(FileData *fd, const short idcode, const char *name);
@@ -260,6 +261,24 @@ static void expand_scene_collection(FileData *fd, Main *mainvar, SceneCollection
static void direct_link_animdata(FileData *fd, AnimData *adt);
static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt);
+typedef struct BHeadN {
+ struct BHeadN *next, *prev;
+#ifdef USE_BHEAD_READ_ON_DEMAND
+ /** Use to read the data from the file directly into memory as needed. */
+ off_t file_offset;
+ /** When set, the remainder of this allocation is the data, otherwise it needs to be read. */
+ bool has_data;
+#endif
+ struct BHead bhead;
+} BHeadN;
+
+#define BHEADN_FROM_BHEAD(bh) ((BHeadN *)POINTER_OFFSET(bh, -offsetof(BHeadN, bhead)))
+
+/* We could change this in the future, for now it's simplest if only data is delayed
+ * because ID names are used in lookup tables. */
+#define BHEAD_USE_READ_ON_DEMAND(bhead) \
+ ((bhead)->code == DATA)
+
/* this function ensures that reports are printed,
* in the case of libraray linking errors this is important!
*
@@ -292,8 +311,9 @@ static const char *library_parent_filepath(Library *lib)
return lib->parent ? lib->parent->filepath : "<direct>";
}
-
-/* ************** OldNewMap ******************* */
+/* -------------------------------------------------------------------- */
+/** \name OldNewMap API
+ * \{ */
typedef struct OldNew {
const void *oldp;
@@ -470,11 +490,11 @@ static void oldnewmap_free(OldNewMap *onm)
#undef PERTURB_SHIFT
#undef ITER_SLOTS
-/***/
-
-static void read_libraries(FileData *basefd, ListBase *mainlist);
+/** \} */
-/* ************ help functions ***************** */
+/* -------------------------------------------------------------------- */
+/** \name Helper Functions
+ * \{ */
static void add_main_to_main(Main *mainvar, Main *from)
{
@@ -528,15 +548,15 @@ void blo_split_main(ListBase *mainlist, Main *main)
mainlist->first = mainlist->last = main;
main->next = NULL;
- if (BLI_listbase_is_empty(&main->library))
+ if (BLI_listbase_is_empty(&main->libraries))
return;
/* (Library.temp_index -> Main), lookup table */
- const uint lib_main_array_len = BLI_listbase_count(&main->library);
+ const uint lib_main_array_len = BLI_listbase_count(&main->libraries);
Main **lib_main_array = MEM_malloc_arrayN(lib_main_array_len, sizeof(*lib_main_array), __func__);
int i = 0;
- for (Library *lib = main->library.first; lib; lib = lib->id.next, i++) {
+ for (Library *lib = main->libraries.first; lib; lib = lib->id.next, i++) {
Main *libmain = BKE_main_new();
libmain->curlib = lib;
libmain->versionfile = lib->versionfile;
@@ -563,7 +583,7 @@ static void read_file_version(FileData *fd, Main *main)
{
BHead *bhead;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == GLOB) {
FileGlobal *fg = read_struct(fd, bhead, "Global");
if (fg) {
@@ -592,7 +612,7 @@ static void read_file_bhead_idname_map_create(FileData *fd)
int code_prev = ENDB;
uint reserve = 0;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (code_prev != bhead->code) {
code_prev = bhead->code;
is_link = BKE_idcode_is_valid(code_prev) ? BKE_idcode_is_linkable(code_prev) : false;
@@ -607,14 +627,14 @@ static void read_file_bhead_idname_map_create(FileData *fd)
fd->bhead_idname_hash = BLI_ghash_str_new_ex(__func__, reserve);
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (code_prev != bhead->code) {
code_prev = bhead->code;
is_link = BKE_idcode_is_valid(code_prev) ? BKE_idcode_is_linkable(code_prev) : false;
}
if (is_link) {
- BLI_ghash_insert(fd->bhead_idname_hash, (void *)bhead_id_name(fd, bhead), bhead);
+ BLI_ghash_insert(fd->bhead_idname_hash, (void *)blo_bhead_id_name(fd, bhead), bhead);
}
}
}
@@ -662,8 +682,11 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab
return m;
}
+/** \} */
-/* ************ FILE PARSING ****************** */
+/* -------------------------------------------------------------------- */
+/** \name File Parsing
+ * \{ */
static void switch_endian_bh4(BHead4 *bhead)
{
@@ -735,7 +758,7 @@ static BHeadN *get_bhead(FileData *fd)
int readsize;
if (fd) {
- if (!fd->eof) {
+ if (!fd->is_eof) {
/* initializing to zero isn't strictly needed but shuts valgrind up
* since uninitialized memory gets compared */
BHead8 bhead8 = {0};
@@ -768,7 +791,7 @@ static BHeadN *get_bhead(FileData *fd)
}
}
else {
- fd->eof = 1;
+ fd->is_eof = true;
bhead.len = 0;
}
}
@@ -791,33 +814,64 @@ static BHeadN *get_bhead(FileData *fd)
}
}
else {
- fd->eof = 1;
+ fd->is_eof = true;
bhead.len = 0;
}
}
/* make sure people are not trying to pass bad blend files */
- if (bhead.len < 0) fd->eof = 1;
+ if (bhead.len < 0) {
+ fd->is_eof = true;
+ }
/* bhead now contains the (converted) bhead structure. Now read
* the associated data and put everything in a BHeadN (creative naming !)
*/
- if (!fd->eof) {
+ if (fd->is_eof) {
+ /* pass */
+ }
+#ifdef USE_BHEAD_READ_ON_DEMAND
+ else if (fd->seek != NULL && BHEAD_USE_READ_ON_DEMAND(&bhead)) {
+ /* Delay reading bhead content. */
+ new_bhead = MEM_mallocN(sizeof(BHeadN), "new_bhead");
+ if (new_bhead) {
+ new_bhead->next = new_bhead->prev = NULL;
+ new_bhead->file_offset = fd->file_offset;
+ new_bhead->has_data = false;
+ new_bhead->bhead = bhead;
+ off_t seek_new = fd->seek(fd, bhead.len, SEEK_CUR);
+ if (seek_new == -1) {
+ fd->is_eof = true;
+ MEM_freeN(new_bhead);
+ new_bhead = NULL;
+ }
+ BLI_assert(fd->file_offset == seek_new);
+ }
+ else {
+ fd->is_eof = true;
+ }
+ }
+#endif
+ else {
new_bhead = MEM_mallocN(sizeof(BHeadN) + bhead.len, "new_bhead");
if (new_bhead) {
new_bhead->next = new_bhead->prev = NULL;
+#ifdef USE_BHEAD_READ_ON_DEMAND
+ new_bhead->file_offset = 0; /* don't seek. */
+ new_bhead->has_data = true;
+#endif
new_bhead->bhead = bhead;
readsize = fd->read(fd, new_bhead + 1, bhead.len);
if (readsize != bhead.len) {
- fd->eof = 1;
+ fd->is_eof = true;
MEM_freeN(new_bhead);
new_bhead = NULL;
}
}
else {
- fd->eof = 1;
+ fd->is_eof = true;
}
}
}
@@ -827,13 +881,13 @@ static BHeadN *get_bhead(FileData *fd)
* of blocks.
*/
if (new_bhead) {
- BLI_addtail(&fd->listbase, new_bhead);
+ BLI_addtail(&fd->bhead_list, new_bhead);
}
- return(new_bhead);
+ return new_bhead;
}
-BHead *blo_firstbhead(FileData *fd)
+BHead *blo_bhead_first(FileData *fd)
{
BHeadN *new_bhead;
BHead *bhead = NULL;
@@ -841,7 +895,7 @@ BHead *blo_firstbhead(FileData *fd)
/* Rewind the file
* Read in a new block if necessary
*/
- new_bhead = fd->listbase.first;
+ new_bhead = fd->bhead_list.first;
if (new_bhead == NULL) {
new_bhead = get_bhead(fd);
}
@@ -850,18 +904,18 @@ BHead *blo_firstbhead(FileData *fd)
bhead = &new_bhead->bhead;
}
- return(bhead);
+ return bhead;
}
-BHead *blo_prevbhead(FileData *UNUSED(fd), BHead *thisblock)
+BHead *blo_bhead_prev(FileData *UNUSED(fd), BHead *thisblock)
{
- BHeadN *bheadn = (BHeadN *)POINTER_OFFSET(thisblock, -offsetof(BHeadN, bhead));
+ BHeadN *bheadn = BHEADN_FROM_BHEAD(thisblock);
BHeadN *prev = bheadn->prev;
return (prev) ? &prev->bhead : NULL;
}
-BHead *blo_nextbhead(FileData *fd, BHead *thisblock)
+BHead *blo_bhead_next(FileData *fd, BHead *thisblock)
{
BHeadN *new_bhead = NULL;
BHead *bhead = NULL;
@@ -869,7 +923,7 @@ BHead *blo_nextbhead(FileData *fd, BHead *thisblock)
if (thisblock) {
/* bhead is actually a sub part of BHeadN
* We calculate the BHeadN pointer from the BHead pointer below */
- new_bhead = (BHeadN *)POINTER_OFFSET(thisblock, -offsetof(BHeadN, bhead));
+ new_bhead = BHEADN_FROM_BHEAD(thisblock);
/* get the next BHeadN. If it doesn't exist we read in the next one */
new_bhead = new_bhead->next;
@@ -884,11 +938,47 @@ BHead *blo_nextbhead(FileData *fd, BHead *thisblock)
bhead = &new_bhead->bhead;
}
- return(bhead);
+ return bhead;
+}
+
+#ifdef USE_BHEAD_READ_ON_DEMAND
+static bool blo_bhead_read_data(FileData *fd, BHead *thisblock, void *buf)
+{
+ bool success = true;
+ BHeadN *new_bhead = BHEADN_FROM_BHEAD(thisblock);
+ BLI_assert(new_bhead->has_data == false && new_bhead->file_offset != 0);
+ off_t offset_backup = fd->file_offset;
+ if (UNLIKELY(fd->seek(fd, new_bhead->file_offset, SEEK_SET) == -1)) {
+ success = false;
+ }
+ else {
+ if (fd->read(fd, buf, new_bhead->bhead.len) != new_bhead->bhead.len) {
+ success = false;
+ }
+ }
+ if (fd->seek(fd, offset_backup, SEEK_SET) == -1) {
+ success = false;
+ }
+ return success;
+}
+
+static BHead *blo_bhead_read_full(FileData *fd, BHead *thisblock)
+{
+ BHeadN *new_bhead = BHEADN_FROM_BHEAD(thisblock);
+ BHeadN *new_bhead_data = MEM_mallocN(sizeof(BHeadN) + new_bhead->bhead.len, "new_bhead");
+ new_bhead_data->bhead = new_bhead->bhead;
+ new_bhead_data->file_offset = new_bhead->file_offset;
+ new_bhead_data->has_data = true;
+ if (!blo_bhead_read_data(fd, thisblock, new_bhead_data + 1)) {
+ MEM_freeN(new_bhead_data);
+ return NULL;
+ }
+ return &new_bhead_data->bhead;
}
+#endif /* USE_BHEAD_READ_ON_DEMAND */
/* Warning! Caller's responsibility to ensure given bhead **is** and ID one! */
-const char *bhead_id_name(const FileData *fd, const BHead *bhead)
+const char *blo_bhead_id_name(const FileData *fd, const BHead *bhead)
{
return (const char *)POINTER_OFFSET(bhead, sizeof(*bhead) + fd->id_name_offs);
}
@@ -942,13 +1032,30 @@ static void decode_blender_header(FileData *fd)
static bool read_file_dna(FileData *fd, const char **r_error_message)
{
BHead *bhead;
+ int subversion = 0;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
- if (bhead->code == DNA1) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
+ if (bhead->code == GLOB) {
+ /* Before this, the subversion didn't exist in 'FileGlobal' so the subversion
+ * value isn't accessible for the purpose of DNA versioning in this case. */
+ if (fd->fileversion <= 242) {
+ continue;
+ }
+ /* We can't use read_global because this needs 'DNA1' to be decoded,
+ * however the first 4 chars are _always_ the subversion. */
+ FileGlobal *fg = (void *)&bhead[1];
+ BLI_STATIC_ASSERT(offsetof(FileGlobal, subvstr) == 0, "Must be first: subvstr");
+ char num[5];
+ memcpy(num, fg->subvstr, 4);
+ num[4] = 0;
+ subversion = atoi(num);
+ }
+ else if (bhead->code == DNA1) {
const bool do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) != 0;
fd->filesdna = DNA_sdna_from_data(&bhead[1], bhead->len, do_endian_swap, true, r_error_message);
if (fd->filesdna) {
+ blo_do_versions_dna(fd->filesdna, fd->fileversion, subversion);
fd->compflags = DNA_struct_get_compareflags(fd->filesdna, fd->memsdna);
/* used to retrieve ID names from (bhead+1) */
fd->id_name_offs = DNA_elem_offset(fd->filesdna, "ID", "char", "name[]");
@@ -973,7 +1080,7 @@ static int *read_file_thumbnail(FileData *fd)
BHead *bhead;
int *blend_thumb = NULL;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == TEST) {
const bool do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) != 0;
int *data = (int *)(bhead + 1);
@@ -987,10 +1094,9 @@ static int *read_file_thumbnail(FileData *fd)
BLI_endian_switch_int32(&data[1]);
}
- int width = data[0];
- int height = data[1];
-
- if (!BLEN_THUMB_SAFE_MEMSIZE(width, height)) {
+ const int width = data[0];
+ const int height = data[1];
+ if (!BLEN_THUMB_MEMSIZE_IS_VALID(width, height)) {
break;
}
if (bhead->len < BLEN_THUMB_MEMSIZE_FILE(width, height)) {
@@ -1009,6 +1115,36 @@ static int *read_file_thumbnail(FileData *fd)
return blend_thumb;
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name File Data API
+ * \{ */
+
+/* Regular file reading. */
+
+static int fd_read_data_from_file(FileData *filedata, void *buffer, uint size)
+{
+ int readsize = read(filedata->filedes, buffer, size);
+
+ if (readsize < 0) {
+ readsize = EOF;
+ }
+ else {
+ filedata->file_offset += readsize;
+ }
+
+ return (readsize);
+}
+
+static off_t fd_seek_data_from_file(FileData *filedata, off_t offset, int whence)
+{
+ filedata->file_offset = lseek(filedata->filedes, offset, whence);
+ return filedata->file_offset;
+}
+
+/* GZip file reading. */
+
static int fd_read_gzip_from_file(FileData *filedata, void *buffer, uint size)
{
int readsize = gzread(filedata->gzfiledes, buffer, size);
@@ -1017,45 +1153,49 @@ static int fd_read_gzip_from_file(FileData *filedata, void *buffer, uint size)
readsize = EOF;
}
else {
- filedata->seek += readsize;
+ filedata->file_offset += readsize;
}
return (readsize);
}
+/* Memory reading. */
+
static int fd_read_from_memory(FileData *filedata, void *buffer, uint size)
{
/* don't read more bytes then there are available in the buffer */
- int readsize = (int)MIN2(size, (uint)(filedata->buffersize - filedata->seek));
+ int readsize = (int)MIN2(size, (uint)(filedata->buffersize - filedata->file_offset));
- memcpy(buffer, filedata->buffer + filedata->seek, readsize);
- filedata->seek += readsize;
+ memcpy(buffer, filedata->buffer + filedata->file_offset, readsize);
+ filedata->file_offset += readsize;
return (readsize);
}
+/* MemFile reading. */
+
static int fd_read_from_memfile(FileData *filedata, void *buffer, uint size)
{
- static uint seek = (1 << 30); /* the current position */
- static uint offset = 0; /* size of previous chunks */
+ static size_t seek = SIZE_MAX; /* the current position */
+ static size_t offset = 0; /* size of previous chunks */
static MemFileChunk *chunk = NULL;
- uint chunkoffset, readsize, totread;
+ size_t chunkoffset, readsize, totread;
if (size == 0) return 0;
- if (seek != (uint)filedata->seek) {
+ if (seek != (size_t)filedata->file_offset) {
chunk = filedata->memfile->chunks.first;
seek = 0;
while (chunk) {
- if (seek + chunk->size > (uint)filedata->seek) {
+ if (seek + chunk->size > (size_t)filedata->file_offset) {
break;
}
seek += chunk->size;
chunk = chunk->next;
}
offset = seek;
- seek = filedata->seek;
+ seek = filedata->file_offset;
}
if (chunk) {
@@ -1085,7 +1225,7 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, uint size)
memcpy(POINTER_OFFSET(buffer, totread), chunk->buf + chunkoffset, readsize);
totread += readsize;
- filedata->seek += readsize;
+ filedata->file_offset += readsize;
seek += readsize;
} while (totread < size);
@@ -1121,68 +1261,125 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports)
BKE_reportf(reports, RPT_ERROR,
"Failed to read blend file '%s': %s",
fd->relabase, error_message);
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
fd = NULL;
}
}
else {
BKE_reportf(reports, RPT_ERROR, "Failed to read blend file '%s', not a blend file", fd->relabase);
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
fd = NULL;
}
return fd;
}
-/* cannot be called with relative paths anymore! */
-/* on each new library added, it now checks for the current FileData and expands relativeness */
-FileData *blo_openblenderfile(const char *filepath, ReportList *reports)
+static FileData *blo_filedata_from_file_descriptor(const char *filepath, ReportList *reports, int file)
{
- gzFile gzfile;
+ FileDataReadFn *read_fn = NULL;
+ FileDataSeekFn *seek_fn = NULL; /* Optional. */
+
+ gzFile gzfile = (gzFile)Z_NULL;
+
+ char header[7];
+
+ /* Regular file. */
+ errno = 0;
+ if (read(file, header, sizeof(header)) != sizeof(header)) {
+ BKE_reportf(reports, RPT_WARNING, "Unable to read '%s': %s",
+ filepath, errno ? strerror(errno) : TIP_("insufficient content"));
+ return NULL;
+ }
+ else {
+ lseek(file, 0, SEEK_SET);
+ }
+
+ /* Regular file. */
+ if (memcmp(header, "BLENDER", sizeof(header)) == 0) {
+ read_fn = fd_read_data_from_file;
+ seek_fn = fd_seek_data_from_file;
+ }
+
+ /* Gzip file. */
errno = 0;
- gzfile = BLI_gzopen(filepath, "rb");
+ if ((read_fn == NULL) &&
+ /* Check header magic. */
+ (header[0] == 0x1f && header[1] == 0x8b))
+ {
+ gzfile = BLI_gzopen(filepath, "rb");
+ if (gzfile == (gzFile)Z_NULL) {
+ BKE_reportf(reports, RPT_WARNING, "Unable to open '%s': %s",
+ filepath, errno ? strerror(errno) : TIP_("unknown error reading file"));
+ return NULL;
+ }
+ else {
+ /* 'seek_fn' is too slow for gzip, don't set it. */
+ read_fn = fd_read_gzip_from_file;
+ /* Caller must close. */
+ file = -1;
+ }
+ }
+
+ if (read_fn == NULL) {
+ BKE_reportf(reports, RPT_WARNING, "Unrecognized file format '%s'", filepath);
+ return NULL;
+ }
+
+ FileData *fd = filedata_new();
+
+ fd->filedes = file;
+ fd->gzfiledes = gzfile;
- if (gzfile == (gzFile)Z_NULL) {
+ fd->read = read_fn;
+ fd->seek = seek_fn;
+
+ return fd;
+}
+
+static FileData *blo_filedata_from_file_open(const char *filepath, ReportList *reports)
+{
+ errno = 0;
+ const int file = BLI_open(filepath, O_BINARY | O_RDONLY, 0);
+ if (file == -1) {
BKE_reportf(reports, RPT_WARNING, "Unable to open '%s': %s",
filepath, errno ? strerror(errno) : TIP_("unknown error reading file"));
return NULL;
}
- else {
- FileData *fd = filedata_new();
- fd->gzfiledes = gzfile;
- fd->read = fd_read_gzip_from_file;
+ FileData *fd = blo_filedata_from_file_descriptor(filepath, reports, file);
+ if ((fd == NULL) || (fd->filedes == -1)) {
+ close(file);
+ }
+ return fd;
+}
+/* cannot be called with relative paths anymore! */
+/* on each new library added, it now checks for the current FileData and expands relativeness */
+FileData *blo_filedata_from_file(const char *filepath, ReportList *reports)
+{
+ FileData *fd = blo_filedata_from_file_open(filepath, reports);
+ if (fd != NULL) {
/* needed for library_append and read_libraries */
BLI_strncpy(fd->relabase, filepath, sizeof(fd->relabase));
return blo_decode_and_check(fd, reports);
}
+ return NULL;
}
/**
- * Same as blo_openblenderfile(), but does not reads DNA data, only header. Use it for light access
+ * Same as blo_filedata_from_file(), but does not reads DNA data, only header. Use it for light access
* (e.g. thumbnail reading).
*/
-static FileData *blo_openblenderfile_minimal(const char *filepath)
+static FileData *blo_filedata_from_file_minimal(const char *filepath)
{
- gzFile gzfile;
- errno = 0;
- gzfile = BLI_gzopen(filepath, "rb");
-
- if (gzfile != (gzFile)Z_NULL) {
- FileData *fd = filedata_new();
- fd->gzfiledes = gzfile;
- fd->read = fd_read_gzip_from_file;
-
+ FileData *fd = blo_filedata_from_file_open(filepath, NULL);
+ if (fd != NULL) {
decode_blender_header(fd);
-
if (fd->flags & FD_FLAGS_FILE_OK) {
return fd;
}
-
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
}
-
return NULL;
}
@@ -1204,7 +1401,7 @@ static int fd_read_gzip_from_memory(FileData *filedata, void *buffer, uint size)
return 0;
}
- filedata->seek += size;
+ filedata->file_offset += size;
return (size);
}
@@ -1226,7 +1423,7 @@ static int fd_read_gzip_from_memory_init(FileData *fd)
return 1;
}
-FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *reports)
+FileData *blo_filedata_from_memory(const void *mem, int memsize, ReportList *reports)
{
if (!mem || memsize < SIZEOFBLENDERHEADER) {
BKE_report(reports, RPT_WARNING, (mem) ? TIP_("Unable to read") : TIP_("Unable to open"));
@@ -1242,7 +1439,7 @@ FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *report
/* test if gzip */
if (cp[0] == 0x1f && cp[1] == 0x8b) {
if (0 == fd_read_gzip_from_memory_init(fd)) {
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
return NULL;
}
}
@@ -1255,7 +1452,7 @@ FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *report
}
}
-FileData *blo_openblendermemfile(MemFile *memfile, ReportList *reports)
+FileData *blo_filedata_from_memfile(MemFile *memfile, ReportList *reports)
{
if (!memfile) {
BKE_report(reports, RPT_WARNING, "Unable to open blend <memory>");
@@ -1273,7 +1470,7 @@ FileData *blo_openblendermemfile(MemFile *memfile, ReportList *reports)
}
-void blo_freefiledata(FileData *fd)
+void blo_filedata_free(FileData *fd)
{
if (fd) {
if (fd->filedes != -1) {
@@ -1295,8 +1492,18 @@ void blo_freefiledata(FileData *fd)
fd->buffer = NULL;
}
- // Free all BHeadN data blocks
- BLI_freelistN(&fd->listbase);
+ /* Free all BHeadN data blocks */
+#ifndef NDEBUG
+ BLI_freelistN(&fd->bhead_list);
+#else
+ /* Sanity check we're not keeping memory we don't need. */
+ LISTBASE_FOREACH_MUTABLE (BHeadN *, new_bhead, &fd->bhead_list) {
+ if (fd->seek != NULL && BHEAD_USE_READ_ON_DEMAND(&new_bhead->bhead)) {
+ BLI_assert(new_bhead->has_data == 0);
+ }
+ MEM_freeN(new_bhead);
+ }
+#endif
if (fd->filesdna)
DNA_sdna_free(fd->filesdna);
@@ -1332,10 +1539,15 @@ void blo_freefiledata(FileData *fd)
}
}
-/* ************ DIV ****************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Public Utilities
+ * \{ */
/**
- * Check whether given path ends with a blend file compatible extension (.blend, .ble or .blend.gz).
+ * Check whether given path ends with a blend file compatible extension
+ * (`.blend`, `.ble` or `.blend.gz`).
*
* \param str: The path to check.
* \return true is this path ends with a blender file extension.
@@ -1347,11 +1559,12 @@ bool BLO_has_bfile_extension(const char *str)
}
/**
- * Try to explode given path into its 'library components' (i.e. a .blend file, id type/group, and datablock itself).
+ * Try to explode given path into its 'library components'
+ * (i.e. a .blend file, id type/group, and data-block itself).
*
* \param path: the full path to explode.
* \param r_dir: the string that'll contain path up to blend file itself ('library' path).
- * WARNING! Must be FILE_MAX_LIBEXTRA long (it also stores group and name strings)!
+ * WARNING! Must be #FILE_MAX_LIBEXTRA long (it also stores group and name strings)!
* \param r_group: the string that'll contain 'group' part of the path, if any. May be NULL.
* \param r_name: the string that'll contain data's name part of the path, if any. May be NULL.
* \return true if path contains a blend file.
@@ -1420,7 +1633,7 @@ bool BLO_library_path_explode(const char *path, char *r_dir, char **r_group, cha
*
* \param filepath: The path of the file to extract thumbnail from.
* \return The raw thumbnail
- * (MEM-allocated, as stored in file, use BKE_main_thumbnail_to_imbuf() to convert it to ImBuf image).
+ * (MEM-allocated, as stored in file, use BKE_main_thumbnail_to_imbuf() to convert it to ImBuf image).
*/
BlendThumbnail *BLO_thumbnail_from_file(const char *filepath)
{
@@ -1428,18 +1641,15 @@ BlendThumbnail *BLO_thumbnail_from_file(const char *filepath)
BlendThumbnail *data = NULL;
int *fd_data;
- fd = blo_openblenderfile_minimal(filepath);
+ fd = blo_filedata_from_file_minimal(filepath);
fd_data = fd ? read_file_thumbnail(fd) : NULL;
if (fd_data) {
- int width = fd_data[0];
- int height = fd_data[1];
-
- /* Protect against buffer overflow vulnerability. */
- if (BLEN_THUMB_SAFE_MEMSIZE(width, height)) {
+ const int width = fd_data[0];
+ const int height = fd_data[1];
+ if (BLEN_THUMB_MEMSIZE_IS_VALID(width, height)) {
const size_t sz = BLEN_THUMB_MEMSIZE(width, height);
data = MEM_mallocN(sz, __func__);
-
if (data) {
BLI_assert((sz - sizeof(*data)) == (BLEN_THUMB_MEMSIZE_FILE(width, height) - (sizeof(*fd_data) * 2)));
data->width = width;
@@ -1449,12 +1659,16 @@ BlendThumbnail *BLO_thumbnail_from_file(const char *filepath)
}
}
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
return data;
}
-/* ************** OLD POINTERS ******************* */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Old/New Pointer Map
+ * \{ */
static void *newdataadr(FileData *fd, const void *adr) /* only direct databocks */
{
@@ -1541,19 +1755,19 @@ static void *newlibadr_real_us(FileData *fd, const void *lib, const void *adr)
return id;
}
-static void change_idid_adr_fd(FileData *fd, const void *old, void *new)
+static void change_link_placeholder_to_real_ID_pointer_fd(FileData *fd, const void *old, void *new)
{
for (int i = 0; i < fd->libmap->nentries; i++) {
OldNew *entry = &fd->libmap->entries[i];
- if (old == entry->newp && entry->nr == ID_ID) {
+ if (old == entry->newp && entry->nr == ID_LINK_PLACEHOLDER) {
entry->newp = new;
if (new) entry->nr = GS( ((ID *)new)->name);
}
}
}
-static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, void *new)
+static void change_link_placeholder_to_real_ID_pointer(ListBase *mainlist, FileData *basefd, void *old, void *new)
{
Main *mainptr;
@@ -1566,7 +1780,7 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi
fd = basefd;
if (fd) {
- change_idid_adr_fd(fd, old, new);
+ change_link_placeholder_to_real_ID_pointer_fd(fd, old, new);
}
}
}
@@ -1574,20 +1788,23 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi
/* lib linked proxy objects point to our local data, we need
* to clear that pointer before reading the undo memfile since
* the object might be removed, it is set again in reading
- * if the local object still exists */
+ * if the local object still exists.
+ * This is only valid for local proxy objects though, linked ones should not be affected here.
+ */
void blo_clear_proxy_pointers_from_lib(Main *oldmain)
{
- Object *ob = oldmain->object.first;
+ Object *ob = oldmain->objects.first;
for (; ob; ob = ob->id.next) {
- if (ob->id.lib)
+ if (ob->id.lib != NULL && ob->proxy_from != NULL && ob->proxy_from->id.lib == NULL) {
ob->proxy_from = NULL;
+ }
}
}
void blo_make_scene_pointer_map(FileData *fd, Main *oldmain)
{
- Scene *sce = oldmain->scene.first;
+ Scene *sce = oldmain->scenes.first;
fd->scenemap = oldnewmap_new();
@@ -1602,7 +1819,7 @@ void blo_make_scene_pointer_map(FileData *fd, Main *oldmain)
void blo_end_scene_pointer_map(FileData *fd, Main *oldmain)
{
OldNew *entry = fd->scenemap->entries;
- Scene *sce = oldmain->scene.first;
+ Scene *sce = oldmain->scenes.first;
int i;
/* used entries were restored, so we put them to zero */
@@ -1618,8 +1835,8 @@ void blo_end_scene_pointer_map(FileData *fd, Main *oldmain)
void blo_make_image_pointer_map(FileData *fd, Main *oldmain)
{
- Image *ima = oldmain->image.first;
- Scene *sce = oldmain->scene.first;
+ Image *ima = oldmain->images.first;
+ Scene *sce = oldmain->scenes.first;
int a;
fd->imamap = oldnewmap_new();
@@ -1658,8 +1875,8 @@ void blo_make_image_pointer_map(FileData *fd, Main *oldmain)
void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
{
OldNew *entry = fd->imamap->entries;
- Image *ima = oldmain->image.first;
- Scene *sce = oldmain->scene.first;
+ Image *ima = oldmain->images.first;
+ Scene *sce = oldmain->scenes.first;
int i;
/* used entries were restored, so we put them to zero */
@@ -1671,7 +1888,7 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
for (; ima; ima = ima->id.next) {
ima->cache = newimaadr(fd, ima->cache);
if (ima->cache == NULL) {
- ima->tpageflag &= ~IMA_GLBIND_IS_DATA;
+ ima->gpuflag = 0;
for (i = 0; i < TEXTARGET_COUNT; i++) {
ima->gputexture[i] = NULL;
}
@@ -1709,8 +1926,8 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain)
{
- MovieClip *clip = oldmain->movieclip.first;
- Scene *sce = oldmain->scene.first;
+ MovieClip *clip = oldmain->movieclips.first;
+ Scene *sce = oldmain->scenes.first;
fd->movieclipmap = oldnewmap_new();
@@ -1737,8 +1954,8 @@ void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain)
void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain)
{
OldNew *entry = fd->movieclipmap->entries;
- MovieClip *clip = oldmain->movieclip.first;
- Scene *sce = oldmain->scene.first;
+ MovieClip *clip = oldmain->movieclips.first;
+ Scene *sce = oldmain->scenes.first;
int i;
/* used entries were restored, so we put them to zero */
@@ -1764,7 +1981,7 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain)
void blo_make_sound_pointer_map(FileData *fd, Main *oldmain)
{
- bSound *sound = oldmain->sound.first;
+ bSound *sound = oldmain->sounds.first;
fd->soundmap = oldnewmap_new();
@@ -1779,7 +1996,7 @@ void blo_make_sound_pointer_map(FileData *fd, Main *oldmain)
void blo_end_sound_pointer_map(FileData *fd, Main *oldmain)
{
OldNew *entry = fd->soundmap->entries;
- bSound *sound = oldmain->sound.first;
+ bSound *sound = oldmain->sounds.first;
int i;
/* used entries were restored, so we put them to zero */
@@ -1810,7 +2027,7 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain)
fd->packedmap = oldnewmap_new();
- for (ima = oldmain->image.first; ima; ima = ima->id.next) {
+ for (ima = oldmain->images.first; ima; ima = ima->id.next) {
ImagePackedFile *imapf;
if (ima->packedfile)
@@ -1821,15 +2038,15 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain)
insert_packedmap(fd, imapf->packedfile);
}
- for (vfont = oldmain->vfont.first; vfont; vfont = vfont->id.next)
+ for (vfont = oldmain->fonts.first; vfont; vfont = vfont->id.next)
if (vfont->packedfile)
insert_packedmap(fd, vfont->packedfile);
- for (sound = oldmain->sound.first; sound; sound = sound->id.next)
+ for (sound = oldmain->sounds.first; sound; sound = sound->id.next)
if (sound->packedfile)
insert_packedmap(fd, sound->packedfile);
- for (lib = oldmain->library.first; lib; lib = lib->id.next)
+ for (lib = oldmain->libraries.first; lib; lib = lib->id.next)
if (lib->packedfile)
insert_packedmap(fd, lib->packedfile);
@@ -1852,7 +2069,7 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain)
entry->newp = NULL;
}
- for (ima = oldmain->image.first; ima; ima = ima->id.next) {
+ for (ima = oldmain->images.first; ima; ima = ima->id.next) {
ImagePackedFile *imapf;
ima->packedfile = newpackedadr(fd, ima->packedfile);
@@ -1861,13 +2078,13 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain)
imapf->packedfile = newpackedadr(fd, imapf->packedfile);
}
- for (vfont = oldmain->vfont.first; vfont; vfont = vfont->id.next)
+ for (vfont = oldmain->fonts.first; vfont; vfont = vfont->id.next)
vfont->packedfile = newpackedadr(fd, vfont->packedfile);
- for (sound = oldmain->sound.first; sound; sound = sound->id.next)
+ for (sound = oldmain->sounds.first; sound; sound = sound->id.next)
sound->packedfile = newpackedadr(fd, sound->packedfile);
- for (lib = oldmain->library.first; lib; lib = lib->id.next)
+ for (lib = oldmain->libraries.first; lib; lib = lib->id.next)
lib->packedfile = newpackedadr(fd, lib->packedfile);
}
@@ -1890,9 +2107,11 @@ void blo_add_library_pointer_map(ListBase *old_mainlist, FileData *fd)
fd->old_mainlist = old_mainlist;
}
+/** \} */
-/* ********** END OLD POINTERS ****************** */
-/* ********** READ FILE ****************** */
+/* -------------------------------------------------------------------- */
+/** \name DNA Struct Loading
+ * \{ */
static void switch_endian_structs(const struct SDNA *filesdna, BHead *bhead)
{
@@ -1900,7 +2119,7 @@ static void switch_endian_structs(const struct SDNA *filesdna, BHead *bhead)
char *data;
data = (char *)(bhead + 1);
- blocksize = filesdna->typelens[filesdna->structs[bhead->SDNAnr][0]];
+ blocksize = filesdna->types_size[filesdna->structs[bhead->SDNAnr][0]];
nblocks = bhead->nr;
while (nblocks--) {
@@ -1915,20 +2134,63 @@ static void *read_struct(FileData *fd, BHead *bh, const char *blockname)
void *temp = NULL;
if (bh->len) {
+#ifdef USE_BHEAD_READ_ON_DEMAND
+ BHead *bh_orig = bh;
+#endif
+
/* switch is based on file dna */
- if (bh->SDNAnr && (fd->flags & FD_FLAGS_SWITCH_ENDIAN))
+ if (bh->SDNAnr && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
+#ifdef USE_BHEAD_READ_ON_DEMAND
+ if (BHEADN_FROM_BHEAD(bh)->has_data == false) {
+ bh = blo_bhead_read_full(fd, bh);
+ if (UNLIKELY(bh == NULL)) {
+ fd->flags &= ~FD_FLAGS_FILE_OK;
+ return NULL;
+ }
+ }
+#endif
switch_endian_structs(fd->filesdna, bh);
+ }
if (fd->compflags[bh->SDNAnr] != SDNA_CMP_REMOVED) {
if (fd->compflags[bh->SDNAnr] == SDNA_CMP_NOT_EQUAL) {
+#ifdef USE_BHEAD_READ_ON_DEMAND
+ if (BHEADN_FROM_BHEAD(bh)->has_data == false) {
+ bh = blo_bhead_read_full(fd, bh);
+ if (UNLIKELY(bh == NULL)) {
+ fd->flags &= ~FD_FLAGS_FILE_OK;
+ return NULL;
+ }
+ }
+#endif
temp = DNA_struct_reconstruct(fd->memsdna, fd->filesdna, fd->compflags, bh->SDNAnr, bh->nr, (bh + 1));
}
else {
/* SDNA_CMP_EQUAL */
temp = MEM_mallocN(bh->len, blockname);
+#ifdef USE_BHEAD_READ_ON_DEMAND
+ if (BHEADN_FROM_BHEAD(bh)->has_data) {
+ memcpy(temp, (bh + 1), bh->len);
+ }
+ else {
+ /* Instead of allocating the bhead, then copying it,
+ * read the data from the file directly into the memory. */
+ if (UNLIKELY(!blo_bhead_read_data(fd, bh, temp))) {
+ fd->flags &= ~FD_FLAGS_FILE_OK;
+ MEM_freeN(temp);
+ temp = NULL;
+ }
+ }
+#else
memcpy(temp, (bh + 1), bh->len);
+#endif
}
}
+#ifdef USE_BHEAD_READ_ON_DEMAND
+ if (bh_orig != bh) {
+ MEM_freeN(BHEADN_FROM_BHEAD(bh));
+ }
+#endif
}
return temp;
@@ -2003,9 +2265,9 @@ static void test_pointer_array(FileData *fd, void **mat)
* the new dna format.
*/
if (*mat) {
- len = MEM_allocN_len(*mat) / fd->filesdna->pointerlen;
+ len = MEM_allocN_len(*mat) / fd->filesdna->pointer_size;
- if (fd->filesdna->pointerlen == 8 && fd->memsdna->pointerlen == 4) {
+ if (fd->filesdna->pointer_size == 8 && fd->memsdna->pointer_size == 4) {
ipoin = imat = MEM_malloc_arrayN(len, 4, "newmatar");
lpoin = *mat;
@@ -2020,7 +2282,7 @@ static void test_pointer_array(FileData *fd, void **mat)
*mat = imat;
}
- if (fd->filesdna->pointerlen == 4 && fd->memsdna->pointerlen == 8) {
+ if (fd->filesdna->pointer_size == 4 && fd->memsdna->pointer_size == 8) {
lpoin = lmat = MEM_malloc_arrayN(len, 8, "newmatar");
ipoin = *mat;
@@ -2035,7 +2297,11 @@ static void test_pointer_array(FileData *fd, void **mat)
}
}
-/* ************ READ ID Properties *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID Properties
+ * \{ */
static void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd);
static void IDP_LibLinkProperty(IDProperty *prop, FileData *fd);
@@ -2162,8 +2428,9 @@ static void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData
#define IDP_DirectLinkGroup_OrFree(prop, switch_endian, fd) \
_IDP_DirectLinkGroup_OrFree(prop, switch_endian, fd, __func__)
-static void _IDP_DirectLinkGroup_OrFree(IDProperty **prop, int switch_endian, FileData *fd,
- const char *caller_func_id)
+static void _IDP_DirectLinkGroup_OrFree(
+ IDProperty **prop, int switch_endian, FileData *fd,
+ const char *caller_func_id)
{
if (*prop) {
if ((*prop)->type == IDP_GROUP) {
@@ -2215,7 +2482,11 @@ static void IDP_LibLinkProperty(IDProperty *prop, FileData *fd)
}
}
-/* ************ READ IMAGE PREVIEW *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read Image Preview
+ * \{ */
static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_prv)
{
@@ -2236,7 +2507,11 @@ static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_p
return prv;
}
-/* ************ READ ID *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID
+ * \{ */
static void lib_link_id(FileData *fd, Main *main)
{
@@ -2300,7 +2575,11 @@ static void direct_link_id(FileData *fd, ID *id)
}
}
-/* ************ READ CurveMapping *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read CurveMapping
+ * \{ */
/* cuma itself has been read! */
static void direct_link_curvemapping(FileData *fd, CurveMapping *cumap)
@@ -2317,13 +2596,17 @@ static void direct_link_curvemapping(FileData *fd, CurveMapping *cumap)
}
}
-/* ************ READ Brush *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Brush
+ * \{ */
/* library brush linking after fileread */
static void lib_link_brush(FileData *fd, Main *main)
{
/* only link ID pointers */
- for (Brush *brush = main->brush.first; brush; brush = brush->id.next) {
+ for (Brush *brush = main->brushes.first; brush; brush = brush->id.next) {
if (brush->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(brush->id.properties, fd);
@@ -2379,7 +2662,11 @@ static void direct_link_brush(FileData *fd, Brush *brush)
brush->icon_imbuf = NULL;
}
-/* ************ READ Palette *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Palette
+ * \{ */
static void lib_link_palette(FileData *fd, Main *main)
{
@@ -2417,7 +2704,11 @@ static void direct_link_paint_curve(FileData *fd, PaintCurve *pc)
pc->points = newdataadr(fd, pc->points);
}
-/* ************ READ PACKEDFILE *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read PackedFile
+ * \{ */
static PackedFile *direct_link_packedfile(FileData *fd, PackedFile *oldpf)
{
@@ -2430,9 +2721,11 @@ static PackedFile *direct_link_packedfile(FileData *fd, PackedFile *oldpf)
return pf;
}
-/* ************ READ ANIMATION STUFF ***************** */
+/** \} */
-/* Legacy Data Support (for Version Patching) ----------------------------- */
+/* -------------------------------------------------------------------- */
+/** \name Read Animation (legacy for version patching)
+ * \{ */
// XXX deprecated - old animation system
static void lib_link_ipo(FileData *fd, Main *main)
@@ -2501,7 +2794,11 @@ static void lib_link_constraint_channels(FileData *fd, ID *id, ListBase *chanbas
}
}
-/* Data Linking ----------------------------- */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Action
+ * \{ */
static void lib_link_fmodifiers(FileData *fd, ID *id, ListBase *list)
{
@@ -2660,7 +2957,7 @@ static void direct_link_fcurves(FileData *fd, ListBase *list)
static void lib_link_action(FileData *fd, Main *main)
{
- for (bAction *act = main->action.first; act; act = act->id.next) {
+ for (bAction *act = main->actions.first; act; act = act->id.next) {
if (act->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(act->id.properties, fd);
@@ -2863,7 +3160,11 @@ static void direct_link_animdata(FileData *fd, AnimData *adt)
adt->actstrip = newdataadr(fd, adt->actstrip);
}
-/* ************ READ CACHEFILES *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: CacheFiles
+ * \{ */
static void lib_link_cachefiles(FileData *fd, Main *bmain)
{
@@ -2889,7 +3190,11 @@ static void direct_link_cachefile(FileData *fd, CacheFile *cache_file)
direct_link_animdata(fd, cache_file->adt);
}
-/* ************ READ WORKSPACES *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: WorkSpace
+ * \{ */
static void lib_link_workspaces(FileData *fd, Main *bmain)
{
@@ -2963,25 +3268,11 @@ static void lib_link_workspace_instance_hook(FileData *fd, WorkSpaceInstanceHook
BKE_workspace_active_set(hook, newlibadr(fd, id->lib, workspace));
}
+/** \} */
-/* ************ READ MOTION PATHS *************** */
-
-/* direct data for cache */
-static void direct_link_motionpath(FileData *fd, bMotionPath *mpath)
-{
- /* sanity check */
- if (mpath == NULL)
- return;
-
- /* relink points cache */
- mpath->points = newdataadr(fd, mpath->points);
-
- mpath->points_vbo = NULL;
- mpath->batch_line = NULL;
- mpath->batch_points = NULL;
-}
-
-/* ************ READ NODE TREE *************** */
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Node Tree
+ * \{ */
/* Single node tree (also used for material/scene trees), ntree is not NULL */
static void lib_link_ntree(FileData *fd, ID *id, bNodeTree *ntree)
@@ -3021,7 +3312,7 @@ static void lib_link_ntree(FileData *fd, ID *id, bNodeTree *ntree)
static void lib_link_nodetree(FileData *fd, Main *main)
{
/* only link ID pointers */
- for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
+ for (bNodeTree *ntree = main->nodetrees.first; ntree; ntree = ntree->id.next) {
if (ntree->id.tag & LIB_TAG_NEED_LINK) {
lib_link_ntree(fd, &ntree->id, ntree);
@@ -3098,7 +3389,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
* we have set the NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2 flag, so at this point we can do the
* actual group node updates.
*/
- for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
+ for (bNodeTree *ntree = main->nodetrees.first; ntree; ntree = ntree->id.next) {
if (ntree->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2) {
has_old_groups = 1;
}
@@ -3118,7 +3409,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
} FOREACH_NODETREE_END;
}
- for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
+ for (bNodeTree *ntree = main->nodetrees.first; ntree; ntree = ntree->id.next) {
ntree->flag &= ~NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2;
}
}
@@ -3226,7 +3517,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
}
/* verify all group user nodes */
- for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
+ for (bNodeTree *ntree = main->nodetrees.first; ntree; ntree = ntree->id.next) {
ntreeVerifyNodes(main, &ntree->id);
}
@@ -3312,6 +3603,16 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
NodeShaderTexPointDensity *npd = (NodeShaderTexPointDensity *)node->storage;
memset(&npd->pd, 0, sizeof(npd->pd));
}
+ else if (node->type == SH_NODE_TEX_IMAGE) {
+ NodeTexImage *tex = (NodeTexImage *)node->storage;
+ tex->iuser.ok = 1;
+ tex->iuser.scene = NULL;
+ }
+ else if (node->type == SH_NODE_TEX_ENVIRONMENT) {
+ NodeTexEnvironment *tex = (NodeTexEnvironment *)node->storage;
+ tex->iuser.ok = 1;
+ tex->iuser.scene = NULL;
+ }
}
else if (ntree->type == NTREE_COMPOSIT) {
if (ELEM(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
@@ -3324,10 +3625,14 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
}
}
else if (ntree->type == NTREE_TEXTURE) {
- if (node->type == TEX_NODE_CURVE_RGB || node->type == TEX_NODE_CURVE_TIME)
+ 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)
- ((ImageUser *)node->storage)->ok = 1;
+ }
+ else if (node->type == TEX_NODE_IMAGE) {
+ ImageUser *iuser = node->storage;
+ iuser->ok = 1;
+ iuser->scene = NULL;
+ }
}
}
}
@@ -3385,7 +3690,11 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
/* type verification is in lib-link */
}
-/* ************ READ ARMATURE ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Armature
+ * \{ */
/* temp struct used to transport needed info to lib_link_constraint_cb() */
typedef struct tConstraintLinkData {
@@ -3568,7 +3877,7 @@ static void lib_link_bones(FileData *fd, Bone *bone)
static void lib_link_armature(FileData *fd, Main *main)
{
- for (bArmature *arm = main->armature.first; arm; arm = arm->id.next) {
+ for (bArmature *arm = main->armatures.first; arm; arm = arm->id.next) {
if (arm->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(arm->id.properties, fd);
lib_link_animdata(fd, &arm->id, arm->adt);
@@ -3619,11 +3928,15 @@ static void direct_link_armature(FileData *fd, bArmature *arm)
arm->act_edbone = NULL;
}
-/* ************ READ CAMERA ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Camera
+ * \{ */
static void lib_link_camera(FileData *fd, Main *main)
{
- for (Camera *ca = main->camera.first; ca; ca = ca->id.next) {
+ for (Camera *ca = main->cameras.first; ca; ca = ca->id.next) {
if (ca->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(ca->id.properties, fd);
lib_link_animdata(fd, &ca->id, ca->adt);
@@ -3651,15 +3964,19 @@ static void direct_link_camera(FileData *fd, Camera *ca)
for (CameraBGImage *bgpic = ca->bg_images.first; bgpic; bgpic = bgpic->next) {
bgpic->iuser.ok = 1;
+ bgpic->iuser.scene = NULL;
}
}
+/** \} */
-/* ************ READ LAMP ***************** */
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Light
+ * \{ */
-static void lib_link_lamp(FileData *fd, Main *main)
+static void lib_link_light(FileData *fd, Main *main)
{
- for (Lamp *la = main->lamp.first; la; la = la->id.next) {
+ for (Light *la = main->lights.first; la; la = la->id.next) {
if (la->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(la->id.properties, fd);
lib_link_animdata(fd, &la->id, la->adt);
@@ -3676,7 +3993,7 @@ static void lib_link_lamp(FileData *fd, Main *main)
}
}
-static void direct_link_lamp(FileData *fd, Lamp *la)
+static void direct_link_light(FileData *fd, Light *la)
{
la->adt = newdataadr(fd, la->adt);
direct_link_animdata(fd, la->adt);
@@ -3694,7 +4011,11 @@ static void direct_link_lamp(FileData *fd, Lamp *la)
la->preview = direct_link_preview_image(fd, la->preview);
}
-/* ************ READ keys ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Shape Keys
+ * \{ */
void blo_do_versions_key_uidgen(Key *key)
{
@@ -3708,7 +4029,7 @@ void blo_do_versions_key_uidgen(Key *key)
static void lib_link_key(FileData *fd, Main *main)
{
- for (Key *key = main->key.first; key; key = key->id.next) {
+ for (Key *key = main->shapekeys.first; key; key = key->id.next) {
BLI_assert((key->id.tag & LIB_TAG_EXTERN) == 0);
if (key->id.tag & LIB_TAG_NEED_LINK) {
@@ -3771,11 +4092,15 @@ static void direct_link_key(FileData *fd, Key *key)
}
}
-/* ************ READ mball ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Meta Ball
+ * \{ */
static void lib_link_mball(FileData *fd, Main *main)
{
- for (MetaBall *mb = main->mball.first; mb; mb = mb->id.next) {
+ for (MetaBall *mb = main->metaballs.first; mb; mb = mb->id.next) {
if (mb->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(mb->id.properties, fd);
lib_link_animdata(fd, &mb->id, mb->adt);
@@ -3808,11 +4133,15 @@ static void direct_link_mball(FileData *fd, MetaBall *mb)
mb->batch_cache = NULL;
}
-/* ************ READ WORLD ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: World
+ * \{ */
static void lib_link_world(FileData *fd, Main *main)
{
- for (World *wrld = main->world.first; wrld; wrld = wrld->id.next) {
+ for (World *wrld = main->worlds.first; wrld; wrld = wrld->id.next) {
if (wrld->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(wrld->id.properties, fd);
lib_link_animdata(fd, &wrld->id, wrld->adt);
@@ -3847,9 +4176,15 @@ static void direct_link_world(FileData *fd, World *wrld)
/* ************ READ VFONT ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: VFont
+ * \{ */
+
static void lib_link_vfont(FileData *fd, Main *main)
{
- for (VFont *vf = main->vfont.first; vf; vf = vf->id.next) {
+ for (VFont *vf = main->fonts.first; vf; vf = vf->id.next) {
if (vf->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(vf->id.properties, fd);
@@ -3865,11 +4200,15 @@ static void direct_link_vfont(FileData *fd, VFont *vf)
vf->packedfile = direct_link_packedfile(fd, vf->packedfile);
}
-/* ************ READ TEXT ****************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Text
+ * \{ */
static void lib_link_text(FileData *fd, Main *main)
{
- for (Text *text = main->text.first; text; text = text->id.next) {
+ for (Text *text = main->texts.first; text; text = text->id.next) {
if (text->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(text->id.properties, fd);
@@ -3913,11 +4252,15 @@ static void direct_link_text(FileData *fd, Text *text)
id_us_ensure_real(&text->id);
}
-/* ************ READ IMAGE ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Image
+ * \{ */
static void lib_link_image(FileData *fd, Main *main)
{
- for (Image *ima = main->image.first; ima; ima = ima->id.next) {
+ for (Image *ima = main->images.first; ima; ima = ima->id.next) {
if (ima->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(ima->id.properties, fd);
@@ -3938,12 +4281,18 @@ static void direct_link_image(FileData *fd, Image *ima)
/* if not restored, we keep the binded opengl index */
if (!ima->cache) {
- ima->tpageflag &= ~IMA_GLBIND_IS_DATA;
+ ima->gpuflag = 0;
for (int i = 0; i < TEXTARGET_COUNT; i++) {
ima->gputexture[i] = NULL;
}
ima->rr = NULL;
}
+ else {
+ for (int i = 0; i < TEXTARGET_COUNT; i++) {
+ ima->gputexture[i] = newimaadr(fd, ima->gputexture[i]);
+ }
+ ima->rr = newimaadr(fd, ima->rr);
+ }
/* undo system, try to restore render buffers */
link_list(fd, &(ima->renderslots));
@@ -3978,12 +4327,15 @@ static void direct_link_image(FileData *fd, Image *ima)
ima->ok = 1;
}
+/** \} */
-/* ************ READ CURVE ***************** */
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Curve
+ * \{ */
static void lib_link_curve(FileData *fd, Main *main)
{
- for (Curve *cu = main->curve.first; cu; cu = cu->id.next) {
+ for (Curve *cu = main->curves.first; cu; cu = cu->id.next) {
if (cu->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(cu->id.properties, fd);
lib_link_animdata(fd, &cu->id, cu->adt);
@@ -4075,11 +4427,15 @@ static void direct_link_curve(FileData *fd, Curve *cu)
cu->bb = NULL;
}
-/* ************ READ TEX ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Texture
+ * \{ */
static void lib_link_texture(FileData *fd, Main *main)
{
- for (Tex *tex = main->tex.first; tex; tex = tex->id.next) {
+ for (Tex *tex = main->textures.first; tex; tex = tex->id.next) {
if (tex->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(tex->id.properties, fd);
lib_link_animdata(fd, &tex->id, tex->adt);
@@ -4113,15 +4469,18 @@ static void direct_link_texture(FileData *fd, Tex *tex)
tex->preview = direct_link_preview_image(fd, tex->preview);
tex->iuser.ok = 1;
+ tex->iuser.scene = NULL;
}
+/** \} */
-
-/* ************ READ MATERIAL ***************** */
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Material
+ * \{ */
static void lib_link_material(FileData *fd, Main *main)
{
- for (Material *ma = main->mat.first; ma; ma = ma->id.next) {
+ for (Material *ma = main->materials.first; ma; ma = ma->id.next) {
if (ma->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(ma->id.properties, fd);
lib_link_animdata(fd, &ma->id, ma->adt);
@@ -4168,7 +4527,12 @@ static void direct_link_material(FileData *fd, Material *ma)
ma->gp_style = newdataadr(fd, ma->gp_style);
}
-/* ************ READ PARTICLE SETTINGS ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Particle Settings
+ * \{ */
+
/* update this also to writefile.c */
static const char *ptcache_data_struct[] = {
"", // BPHYS_DATA_INDEX
@@ -4178,7 +4542,7 @@ static const char *ptcache_data_struct[] = {
"", // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */
"", // BPHYS_DATA_SIZE:
"", // BPHYS_DATA_TIMES:
- "BoidData" // case BPHYS_DATA_BOIDS:
+ "BoidData", // case BPHYS_DATA_BOIDS:
};
static void direct_link_pointcache_cb(FileData *fd, void *data)
@@ -4257,15 +4621,15 @@ static void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd)
static void lib_link_particlesettings(FileData *fd, Main *main)
{
- for (ParticleSettings *part = main->particle.first; part; part = part->id.next) {
+ for (ParticleSettings *part = main->particles.first; part; part = part->id.next) {
if (part->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(part->id.properties, fd);
lib_link_animdata(fd, &part->id, part->adt);
part->ipo = newlibadr_us(fd, part->id.lib, part->ipo); // XXX deprecated - old animation system
- part->dup_ob = newlibadr(fd, part->id.lib, part->dup_ob);
- part->dup_group = newlibadr(fd, part->id.lib, part->dup_group);
+ part->instance_object = newlibadr(fd, part->id.lib, part->instance_object);
+ part->instance_collection = newlibadr_us(fd, part->id.lib, part->instance_collection);
part->eff_group = newlibadr(fd, part->id.lib, part->eff_group);
part->bb_ob = newlibadr(fd, part->id.lib, part->bb_ob);
part->collision_group = newlibadr(fd, part->id.lib, part->collision_group);
@@ -4280,13 +4644,13 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
part->effector_weights = BKE_effector_add_weights(part->eff_group);
}
- if (part->dupliweights.first && part->dup_group) {
- for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
+ if (part->instance_weights.first && part->instance_collection) {
+ for (ParticleDupliWeight *dw = part->instance_weights.first; dw; dw = dw->next) {
dw->ob = newlibadr(fd, part->id.lib, dw->ob);
}
}
else {
- BLI_listbase_clear(&part->dupliweights);
+ BLI_listbase_clear(&part->instance_weights);
}
if (part->boids) {
@@ -4358,7 +4722,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
if (!part->effector_weights)
part->effector_weights = BKE_effector_add_weights(part->eff_group);
- link_list(fd, &part->dupliweights);
+ link_list(fd, &part->instance_weights);
part->boids = newdataadr(fd, part->boids);
part->fluid = newdataadr(fd, part->fluid);
@@ -4502,13 +4866,17 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
return;
}
-/* ************ READ MESH ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Mesh
+ * \{ */
static void lib_link_mesh(FileData *fd, Main *main)
{
Mesh *me;
- for (me = main->mesh.first; me; me = me->id.next) {
+ for (me = main->meshes.first; me; me = me->id.next) {
if (me->id.tag & LIB_TAG_NEED_LINK) {
int i;
@@ -4533,7 +4901,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
}
}
- for (me = main->mesh.first; me; me = me->id.next) {
+ for (me = main->meshes.first; me; me = me->id.next) {
if (me->id.tag & LIB_TAG_NEED_LINK) {
/*check if we need to convert mfaces to mpolys*/
if (me->totface && !me->totpoly) {
@@ -4705,7 +5073,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
direct_link_customdata(fd, &mesh->pdata, mesh->totpoly);
mesh->bb = NULL;
- mesh->edit_btmesh = NULL;
+ mesh->edit_mesh = NULL;
BKE_mesh_runtime_reset(mesh);
/* happens with old files */
@@ -4767,11 +5135,15 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
}
}
-/* ************ READ LATTICE ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Lattice
+ * \{ */
static void lib_link_latt(FileData *fd, Main *main)
{
- for (Lattice *lt = main->latt.first; lt; lt = lt->id.next) {
+ for (Lattice *lt = main->lattices.first; lt; lt = lt->id.next) {
if (lt->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(lt->id.properties, fd);
lib_link_animdata(fd, &lt->id, lt->adt);
@@ -4798,8 +5170,11 @@ static void direct_link_latt(FileData *fd, Lattice *lt)
direct_link_animdata(fd, lt->adt);
}
+/** \} */
-/* ************ READ OBJECT ***************** */
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Object
+ * \{ */
static void lib_link_modifiers_common(
void *userData, Object *ob, ID **idpoin, int cb_flag)
@@ -4853,7 +5228,7 @@ static void lib_link_object(FileData *fd, Main *main)
{
bool warn = false;
- for (Object *ob = main->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = main->objects.first; ob; ob = ob->id.next) {
if (ob->id.tag & LIB_TAG_NEED_LINK) {
int a;
@@ -4871,10 +5246,10 @@ static void lib_link_object(FileData *fd, Main *main)
/* 2.8x drops support for non-empty dupli instances. */
if (ob->type == OB_EMPTY) {
- ob->dup_group = newlibadr_us(fd, ob->id.lib, ob->dup_group);
+ ob->instance_collection = newlibadr_us(fd, ob->id.lib, ob->instance_collection);
}
else {
- ob->dup_group = NULL;
+ ob->instance_collection = NULL;
ob->transflag &= ~OB_DUPLICOLLECTION;
}
@@ -5010,6 +5385,20 @@ static void lib_link_object(FileData *fd, Main *main)
}
}
+/* direct data for cache */
+static void direct_link_motionpath(FileData *fd, bMotionPath *mpath)
+{
+ /* sanity check */
+ if (mpath == NULL)
+ return;
+
+ /* relink points cache */
+ mpath->points = newdataadr(fd, mpath->points);
+
+ mpath->points_vbo = NULL;
+ mpath->batch_line = NULL;
+ mpath->batch_points = NULL;
+}
static void direct_link_pose(FileData *fd, bPose *pose)
{
@@ -5074,6 +5463,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
SubsurfModifierData *smd = (SubsurfModifierData *)md;
smd->emCache = smd->mCache = NULL;
+ smd->subdiv = NULL;
}
else if (md->type == eModifierType_Armature) {
ArmatureModifierData *amd = (ArmatureModifierData *)md;
@@ -5389,9 +5779,9 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
}
}
}
- else if (md->type == eModifierType_Bevel) {
- BevelModifierData *bmd = (BevelModifierData *)md;
- bmd->clnordata.faceHash = NULL;
+ else if (md->type == eModifierType_Multires) {
+ MultiresModifierData *mmd = (MultiresModifierData *)md;
+ mmd->subdiv = NULL;
}
}
}
@@ -5637,7 +6027,6 @@ static void direct_link_object(FileData *fd, Object *ob)
BKE_object_empty_draw_type_set(ob, ob->empty_drawtype);
}
- ob->bb = NULL;
ob->derivedDeform = NULL;
ob->derivedFinal = NULL;
BKE_object_runtime_reset(ob);
@@ -5646,7 +6035,13 @@ 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);
- ob->sculpt = NULL;
+ if (ob->sculpt) {
+ ob->sculpt = NULL;
+ /* Only create data on undo, otherwise rely on editor mode switching. */
+ if (fd->memfile && (ob->mode & OB_MODE_ALL_SCULPT)) {
+ BKE_object_sculpt_data_create(ob);
+ }
+ }
link_list(fd, &ob->lodlevels);
ob->currentlod = ob->lodlevels.first;
@@ -5662,7 +6057,11 @@ static void direct_link_view_settings(FileData *fd, ColorManagedViewSettings *vi
direct_link_curvemapping(fd, view_settings->curve_mapping);
}
-/* ***************** READ VIEW LAYER *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read View Layer (Collection Data)
+ * \{ */
static void direct_link_layer_collections(FileData *fd, ListBase *lb, bool master)
{
@@ -5749,10 +6148,16 @@ static void lib_link_view_layer(FileData *fd, Library *lib, ViewLayer *view_laye
lib_link_layer_collection(fd, lib, layer_collection, true);
}
+ view_layer->mat_override = newlibadr_us(fd, lib, view_layer->mat_override);
+
IDP_LibLinkProperty(view_layer->id_properties, fd);
}
-/* ***************** READ COLLECTION *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Collection
+ * \{ */
#ifdef USE_COLLECTION_COMPAT_28
static void direct_link_scene_collection(FileData *fd, SceneCollection *sc)
@@ -5833,7 +6238,7 @@ static void lib_link_collection_data(FileData *fd, Library *lib, Collection *col
static void lib_link_collection(FileData *fd, Main *main)
{
- for (Collection *collection = main->collection.first; collection; collection = collection->id.next) {
+ for (Collection *collection = main->collections.first; collection; collection = collection->id.next) {
if (collection->id.tag & LIB_TAG_NEED_LINK) {
collection->id.tag &= ~LIB_TAG_NEED_LINK;
IDP_LibLinkProperty(collection->id.properties, fd);
@@ -5853,7 +6258,11 @@ static void lib_link_collection(FileData *fd, Main *main)
}
}
-/* ************ READ SCENE ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Scene
+ * \{ */
/* patch for missing scene IDs, can't be in do-versions */
static void composite_patch(bNodeTree *ntree, Scene *scene)
@@ -5964,7 +6373,7 @@ static void lib_link_scene(FileData *fd, Main *main)
int totscene = 0;
#endif
- for (Scene *sce = main->scene.first; sce; sce = sce->id.next) {
+ for (Scene *sce = main->scenes.first; sce; sce = sce->id.next) {
if (sce->id.tag & LIB_TAG_NEED_LINK) {
/* Link ID Properties -- and copy this comment EXACTLY for easy finding
* of library blocks that implement this.*/
@@ -6003,6 +6412,8 @@ static void lib_link_scene(FileData *fd, Main *main)
sce->toolsettings->particle.shape_object = newlibadr(fd, sce->id.lib, sce->toolsettings->particle.shape_object);
+ sce->toolsettings->gp_sculpt.guide.reference_object = newlibadr(fd, sce->id.lib, sce->toolsettings->gp_sculpt.guide.reference_object);
+
for (Base *base_legacy_next, *base_legacy = sce->base.first; base_legacy; base_legacy = base_legacy_next) {
base_legacy_next = base_legacy->next;
@@ -6052,6 +6463,10 @@ static void lib_link_scene(FileData *fd, Main *main)
seq->scene_sound = BKE_sound_add_scene_sound_defaults(sce, seq);
}
}
+ if (seq->type == SEQ_TYPE_TEXT) {
+ TextVars *t = seq->effectdata;
+ t->text_font = newlibadr_us(fd, sce->id.lib, t->text_font);
+ }
BLI_listbase_clear(&seq->anims);
lib_link_sequence_modifiers(fd, sce, &seq->modifiers);
@@ -6148,7 +6563,7 @@ static void lib_link_scene(FileData *fd, Main *main)
#ifdef USE_SETSCENE_CHECK
if (need_check_set) {
- for (Scene *sce = main->scene.first; sce; sce = sce->id.next) {
+ for (Scene *sce = main->scenes.first; sce; sce = sce->id.next) {
if (sce->id.tag & LIB_TAG_NEED_LINK) {
sce->id.tag &= ~LIB_TAG_NEED_LINK;
if (!scene_validate_setscene__liblink(sce, totscene)) {
@@ -6235,7 +6650,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->depsgraph_hash = NULL;
sce->fps_info = NULL;
- sce->customdata_mask_modal = 0;
+
+ memset(&sce->customdata_mask, 0, sizeof(sce->customdata_mask));
+ memset(&sce->customdata_mask_modal, 0, sizeof(sce->customdata_mask_modal));
BKE_sound_create_scene(sce);
@@ -6315,6 +6732,11 @@ static void direct_link_scene(FileData *fd, Scene *sce)
s->frameMap = NULL;
}
+ if (seq->type == SEQ_TYPE_TEXT) {
+ TextVars *t = seq->effectdata;
+ t->text_blf_id = SEQ_FONT_NOT_LOADED;
+ }
+
seq->prop = newdataadr(fd, seq->prop);
IDP_DirectLinkGroup_OrFree(&seq->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
@@ -6488,9 +6910,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
if (sce->master_collection) {
sce->master_collection = newdataadr(fd, sce->master_collection);
- direct_link_collection(fd, sce->master_collection);
/* Needed because this is an ID outside of Main. */
- sce->master_collection->id.py_instance = NULL;
+ direct_link_id(fd, &sce->master_collection->id);
+ direct_link_collection(fd, sce->master_collection);
}
/* insert into global old-new map for reading without UI (link_global accesses it again) */
@@ -6532,13 +6954,17 @@ static void direct_link_scene(FileData *fd, Scene *sce)
IDP_DirectLinkGroup_OrFree(&sce->layer_properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
}
-/* ****************** READ GREASE PENCIL ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Grease Pencil
+ * \{ */
/* relink's grease pencil data's refs */
static void lib_link_gpencil(FileData *fd, Main *main)
{
/* Relink all datablock linked by GP datablock */
- for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
+ for (bGPdata *gpd = main->gpencils.first; gpd; gpd = gpd->id.next) {
if (gpd->id.tag & LIB_TAG_NEED_LINK) {
/* Layers */
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
@@ -6576,6 +7002,11 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
gpd->adt = newdataadr(fd, gpd->adt);
direct_link_animdata(fd, gpd->adt);
+ /* init stroke buffer */
+ gpd->runtime.sbuffer = NULL;
+ gpd->runtime.sbuffer_size = 0;
+ gpd->runtime.tot_cp_points = 0;
+
/* relink palettes (old palettes deprecated, only to convert old files) */
link_list(fd, &gpd->palettes);
if (gpd->palettes.first != NULL) {
@@ -6622,7 +7053,11 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
}
}
-/* *********** READ AREA **************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read Screen Area/Region (Screen Data)
+ * \{ */
static void direct_link_panel_list(FileData *fd, ListBase *lb)
{
@@ -6776,8 +7211,8 @@ static void direct_link_area(FileData *fd, ScrArea *area)
blo_do_versions_view3d_split_250(v3d, &sl->regionbase);
}
- else if (sl->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ else if (sl->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = (SpaceGraph *)sl;
sipo->ads = newdataadr(fd, sipo->ads);
BLI_listbase_clear(&sipo->runtime.ghost_curves);
@@ -6788,7 +7223,7 @@ static void direct_link_area(FileData *fd, ScrArea *area)
snla->ads = newdataadr(fd, snla->ads);
}
else if (sl->spacetype == SPACE_OUTLINER) {
- SpaceOops *soops = (SpaceOops *)sl;
+ SpaceOutliner *soops = (SpaceOutliner *)sl;
/* use newdataadr_no_us and do not free old memory avoiding double
* frees and use of freed memory. this could happen because of a
@@ -6799,8 +7234,9 @@ static void direct_link_area(FileData *fd, ScrArea *area)
if (ts) {
TreeStoreElem *elems = newdataadr_no_us(fd, ts->data);
- soops->treestore = BLI_mempool_create(sizeof(TreeStoreElem), ts->usedelem,
- 512, BLI_MEMPOOL_ALLOW_ITER);
+ soops->treestore = BLI_mempool_create(
+ sizeof(TreeStoreElem), ts->usedelem,
+ 512, BLI_MEMPOOL_ALLOW_ITER);
if (ts->usedelem && elems) {
int i;
for (i = 0; i < ts->usedelem; i++) {
@@ -6878,8 +7314,8 @@ static void direct_link_area(FileData *fd, ScrArea *area)
sseq->scopes.histogram_ibuf = NULL;
sseq->compositor = NULL;
}
- else if (sl->spacetype == SPACE_BUTS) {
- SpaceButs *sbuts = (SpaceButs *)sl;
+ else if (sl->spacetype == SPACE_PROPERTIES) {
+ SpaceProperties *sbuts = (SpaceProperties *)sl;
sbuts->path = NULL;
sbuts->texuser = NULL;
@@ -6962,9 +7398,9 @@ static void lib_link_area(FileData *fd, ID *parent_id, ScrArea *area)
}
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ SpaceGraph *sipo = (SpaceGraph *)sl;
bDopeSheet *ads = sipo->ads;
if (ads) {
@@ -6973,9 +7409,9 @@ static void lib_link_area(FileData *fd, ID *parent_id, ScrArea *area)
}
break;
}
- case SPACE_BUTS:
+ case SPACE_PROPERTIES:
{
- SpaceButs *sbuts = (SpaceButs *)sl;
+ SpaceProperties *sbuts = (SpaceProperties *)sl;
sbuts->pinid = newlibadr(fd, parent_id->lib, sbuts->pinid);
if (sbuts->pinid == NULL) {
sbuts->flag &= ~SB_PIN_CONTEXT;
@@ -7052,7 +7488,7 @@ static void lib_link_area(FileData *fd, ID *parent_id, ScrArea *area)
}
case SPACE_OUTLINER:
{
- SpaceOops *so = (SpaceOops *)sl;
+ SpaceOutliner *so = (SpaceOutliner *)sl;
so->search_tse.id = newlibadr(fd, NULL, so->search_tse.id);
if (so->treestore) {
@@ -7155,7 +7591,11 @@ static bool direct_link_area_map(FileData *fd, ScrAreaMap *area_map)
return true;
}
-/* ************ READ WM ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Window Manager
+ * \{ */
static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
{
@@ -7255,13 +7695,17 @@ static void lib_link_windowmanager(FileData *fd, Main *main)
}
}
-/* ****************** READ SCREEN ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Screen
+ * \{ */
/* note: file read without screens option G_FILE_NO_UI;
* check lib pointers in call below */
static void lib_link_screen(FileData *fd, Main *main)
{
- for (bScreen *sc = main->screen.first; sc; sc = sc->id.next) {
+ for (bScreen *sc = main->screens.first; sc; sc = sc->id.next) {
if (sc->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(sc->id.properties, fd);
@@ -7407,7 +7851,9 @@ static void lib_link_window_scene_data_restore(wmWindow *win, Scene *scene, View
v3d->localvd = NULL;
v3d->local_view_uuid = 0;
- for (ARegion *ar = area->regionbase.first; ar; ar = ar->next) {
+ /* Regionbase storage is different depending if the space is active. */
+ ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
+ for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d = ar->regiondata;
if (rv3d->localvd) {
@@ -7438,8 +7884,9 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main
v3d->camera = restore_pointer_by_name(id_map, (ID *)v3d->camera, USER_REAL);
v3d->ob_centre = restore_pointer_by_name(id_map, (ID *)v3d->ob_centre, USER_REAL);
- /* free render engines for now */
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ /* Free render engines for now. */
+ ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+ for (ar = regionbase->first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d = ar->regiondata;
if (rv3d && rv3d->render_engine) {
@@ -7449,8 +7896,8 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main
}
}
}
- else if (sl->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ else if (sl->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = (SpaceGraph *)sl;
bDopeSheet *ads = sipo->ads;
if (ads) {
@@ -7465,8 +7912,8 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main
*/
sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC_COLOR;
}
- else if (sl->spacetype == SPACE_BUTS) {
- SpaceButs *sbuts = (SpaceButs *)sl;
+ else if (sl->spacetype == SPACE_PROPERTIES) {
+ SpaceProperties *sbuts = (SpaceProperties *)sl;
sbuts->pinid = restore_pointer_by_name(id_map, sbuts->pinid, USER_IGNORE);
if (sbuts->pinid == NULL) {
sbuts->flag &= ~SB_PIN_CONTEXT;
@@ -7543,7 +7990,7 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main
SpaceText *st = (SpaceText *)sl;
st->text = restore_pointer_by_name(id_map, (ID *)st->text, USER_REAL);
- if (st->text == NULL) st->text = newmain->text.first;
+ if (st->text == NULL) st->text = newmain->texts.first;
}
else if (sl->spacetype == SPACE_SCRIPT) {
SpaceScript *scpt = (SpaceScript *)sl;
@@ -7556,7 +8003,7 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main
}
}
else if (sl->spacetype == SPACE_OUTLINER) {
- SpaceOops *so = (SpaceOops *)sl;
+ SpaceOutliner *so = (SpaceOutliner *)sl;
so->search_tse.id = restore_pointer_by_name(id_map, so->search_tse.id, USER_IGNORE);
@@ -7638,9 +8085,9 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main
* Used to link a file (without UI) to the current UI.
* Note that it assumes the old pointers in UI are still valid, so old Main is not freed.
*/
-void blo_lib_link_restore(Main *newmain, wmWindowManager *curwm, Scene *curscene, ViewLayer *cur_view_layer)
+void blo_lib_link_restore(Main *oldmain, Main *newmain, wmWindowManager *curwm, Scene *curscene, ViewLayer *cur_view_layer)
{
- struct IDNameLib_Map *id_map = BKE_main_idmap_create(newmain);
+ struct IDNameLib_Map *id_map = BKE_main_idmap_create(newmain, true, oldmain);
for (WorkSpace *workspace = newmain->workspaces.first; workspace; workspace = workspace->id.next) {
ListBase *layouts = BKE_workspace_layouts_get(workspace);
@@ -7667,8 +8114,8 @@ void blo_lib_link_restore(Main *newmain, wmWindowManager *curwm, Scene *curscene
BKE_workspace_active_set(win->workspace_hook, workspace);
/* keep cursor location through undo */
- copy_v3_v3(win->scene->cursor.location, oldscene->cursor.location);
- copy_qt_qt(win->scene->cursor.rotation, oldscene->cursor.rotation);
+ memcpy(&win->scene->cursor, &oldscene->cursor, sizeof(win->scene->cursor));
+
lib_link_window_scene_data_restore(win, win->scene, cur_view_layer);
BLI_assert(win->screen == NULL);
@@ -7722,7 +8169,11 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
return wrong_id;
}
-/* ********** READ LIBRARY *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Library
+ * \{ */
static void direct_link_library(FileData *fd, Library *lib, Main *main)
@@ -7737,10 +8188,10 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
TIP_("Library '%s', '%s' had multiple instances, save and reload!"),
lib->name, lib->filepath);
- change_idid_adr(fd->mainlist, fd, lib, newmain->curlib);
-/* change_idid_adr_fd(fd, lib, newmain->curlib); */
+ change_link_placeholder_to_real_ID_pointer(fd->mainlist, fd, lib, newmain->curlib);
+/* change_link_placeholder_to_real_ID_pointer_fd(fd, lib, newmain->curlib); */
- BLI_remlink(&main->library, lib);
+ BLI_remlink(&main->libraries, lib);
MEM_freeN(lib);
/* Now, since Blender always expect **latest** Main pointer from fd->mainlist to be the active library
@@ -7776,7 +8227,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->libraries.first; lib; lib = lib->id.next) {
id_us_ensure_real(&lib->id);
}
}
@@ -7787,7 +8238,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->libraries.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
@@ -7799,7 +8250,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->libraries.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 (BLI_path_is_rel(lib->name)) { /* if this is relative to begin with? */
@@ -7810,11 +8261,15 @@ static void fix_relpaths_library(const char *basepath, Main *main)
}
}
-/* ************ READ PROBE ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Light Probe
+ * \{ */
static void lib_link_lightprobe(FileData *fd, Main *main)
{
- for (LightProbe *prb = main->lightprobe.first; prb; prb = prb->id.next) {
+ for (LightProbe *prb = main->lightprobes.first; prb; prb = prb->id.next) {
if (prb->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(prb->id.properties, fd);
lib_link_animdata(fd, &prb->id, prb->adt);
@@ -7832,11 +8287,15 @@ static void direct_link_lightprobe(FileData *fd, LightProbe *prb)
direct_link_animdata(fd, prb->adt);
}
-/* ************ READ SPEAKER ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Speaker
+ * \{ */
static void lib_link_speaker(FileData *fd, Main *main)
{
- for (Speaker *spk = main->speaker.first; spk; spk = spk->id.next) {
+ for (Speaker *spk = main->speakers.first; spk; spk = spk->id.next) {
if (spk->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(spk->id.properties, fd);
lib_link_animdata(fd, &spk->id, spk->adt);
@@ -7859,7 +8318,11 @@ static void direct_link_speaker(FileData *fd, Speaker *spk)
#endif
}
-/* ************** READ SOUND ******************* */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Sound
+ * \{ */
static void direct_link_sound(FileData *fd, bSound *sound)
{
@@ -7894,7 +8357,7 @@ static void direct_link_sound(FileData *fd, bSound *sound)
static void lib_link_sound(FileData *fd, Main *main)
{
- for (bSound *sound = main->sound.first; sound; sound = sound->id.next) {
+ for (bSound *sound = main->sounds.first; sound; sound = sound->id.next) {
if (sound->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(sound->id.properties, fd);
@@ -7907,7 +8370,11 @@ static void lib_link_sound(FileData *fd, Main *main)
}
}
-/* ***************** READ MOVIECLIP *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Movie Clip
+ * \{ */
static void direct_link_movieReconstruction(FileData *fd, MovieTrackingReconstruction *reconstruction)
{
@@ -8007,7 +8474,7 @@ static void lib_link_moviePlaneTracks(FileData *fd, MovieClip *clip, ListBase *t
static void lib_link_movieclip(FileData *fd, Main *main)
{
- for (MovieClip *clip = main->movieclip.first; clip; clip = clip->id.next) {
+ for (MovieClip *clip = main->movieclips.first; clip; clip = clip->id.next) {
if (clip->id.tag & LIB_TAG_NEED_LINK) {
MovieTracking *tracking = &clip->tracking;
@@ -8029,7 +8496,11 @@ static void lib_link_movieclip(FileData *fd, Main *main)
}
}
-/* ***************** READ MOVIECLIP *************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Masks
+ * \{ */
static void direct_link_mask(FileData *fd, Mask *mask)
{
@@ -8077,8 +8548,9 @@ static void direct_link_mask(FileData *fd, Mask *mask)
if (masklay_shape->tot_vert) {
if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
- BLI_endian_switch_float_array(masklay_shape->data,
- masklay_shape->tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
+ BLI_endian_switch_float_array(
+ masklay_shape->data,
+ masklay_shape->tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE);
}
}
@@ -8096,7 +8568,7 @@ static void lib_link_mask_parent(FileData *fd, Mask *mask, MaskParent *parent)
static void lib_link_mask(FileData *fd, Main *main)
{
- for (Mask *mask = main->mask.first; mask; mask = mask->id.next) {
+ for (Mask *mask = main->masks.first; mask; mask = mask->id.next) {
if (mask->id.tag & LIB_TAG_NEED_LINK) {
IDP_LibLinkProperty(mask->id.properties, fd);
lib_link_animdata(fd, &mask->id, mask->adt);
@@ -8127,9 +8599,15 @@ static void lib_link_mask(FileData *fd, Main *main)
/* ************ READ LINE STYLE ***************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read ID: Line Style
+ * \{ */
+
static void lib_link_linestyle(FileData *fd, Main *main)
{
- for (FreestyleLineStyle *linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) {
+ for (FreestyleLineStyle *linestyle = main->linestyles.first; linestyle; linestyle = linestyle->id.next) {
if (linestyle->id.tag & LIB_TAG_NEED_LINK) {
LineStyleModifier *m;
@@ -8390,6 +8868,12 @@ static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle)
/* ************** GENERAL & MAIN ******************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read Library Data Block
+ * \{ */
+
static const char *dataname(short id_code)
{
switch (id_code) {
@@ -8436,7 +8920,7 @@ static const char *dataname(short id_code)
static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *allocname)
{
- bhead = blo_nextbhead(fd, bhead);
+ bhead = blo_bhead_next(fd, bhead);
while (bhead && bhead->code == DATA) {
void *data;
@@ -8455,13 +8939,13 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *a
oldnewmap_insert(fd->datamap, bhead->old, data, 0);
}
- bhead = blo_nextbhead(fd, bhead);
+ bhead = blo_bhead_next(fd, bhead);
}
return bhead;
}
-static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short tag, ID **r_id)
+static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const int tag, ID **r_id)
{
/* this routine reads a libblock and its direct data. Use link functions to connect it all
*/
@@ -8475,8 +8959,8 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
* This leads e.g. to desappearing objects in some undo/redo case, see T34446.
* That means we have to carefully check whether current lib or libdata already exits in old main, if it does
* we merely copy it over into new main area, otherwise we have to do a full read of that bhead... */
- if (fd->memfile && ELEM(bhead->code, ID_LI, ID_ID)) {
- const char *idname = bhead_id_name(fd, bhead);
+ if (fd->memfile && ELEM(bhead->code, ID_LI, ID_LINK_PLACEHOLDER)) {
+ const char *idname = blo_bhead_id_name(fd, bhead);
DEBUG_PRINTF("Checking %s...\n", idname);
@@ -8489,17 +8973,17 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
Main *oldmain = fd->old_mainlist->first;
DEBUG_PRINTF("FOUND!\n");
/* In case of a library, we need to re-add its main to fd->mainlist, because if we have later
- * a missing ID_ID, we need to get the correct lib it is linked to!
+ * a missing ID_LINK_PLACEHOLDER, we need to get the correct lib it is linked to!
* Order is crucial, we cannot bulk-add it in BLO_read_from_memfile() like it used to be... */
BLI_remlink(fd->old_mainlist, libmain);
- BLI_remlink_safe(&oldmain->library, libmain->curlib);
+ BLI_remlink_safe(&oldmain->libraries, libmain->curlib);
BLI_addtail(fd->mainlist, libmain);
- BLI_addtail(&main->library, libmain->curlib);
+ BLI_addtail(&main->libraries, libmain->curlib);
if (r_id) {
*r_id = NULL; /* Just in case... */
}
- return blo_nextbhead(fd, bhead);
+ return blo_bhead_next(fd, bhead);
}
DEBUG_PRINTF("nothing...\n");
}
@@ -8513,11 +8997,11 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
oldnewmap_insert(fd->libmap, bhead->old, id, GS(id->name));
}
- /* No need to do anything else for ID_ID, it's assumed already present in its lib's main... */
+ /* No need to do anything else for ID_LINK_PLACEHOLDER, it's assumed already present in its lib's main... */
if (r_id) {
*r_id = NULL; /* Just in case... */
}
- return blo_nextbhead(fd, bhead);
+ return blo_bhead_next(fd, bhead);
}
DEBUG_PRINTF("nothing...\n");
}
@@ -8531,7 +9015,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
/* do after read_struct, for dna reconstruct */
lb = which_libbase(main, idcode);
if (lb) {
- oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); /* for ID_ID check */
+ oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); /* for ID_LINK_PLACEHOLDER check */
BLI_addtail(lb, id);
}
else {
@@ -8545,7 +9029,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
if (r_id)
*r_id = id;
if (!id)
- return blo_nextbhead(fd, bhead);
+ return blo_bhead_next(fd, bhead);
id->lib = main->curlib;
id->us = ID_FAKE_USERS(id);
@@ -8555,11 +9039,11 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
id->recalc = 0;
/* this case cannot be direct_linked: it's just the ID part */
- if (bhead->code == ID_ID) {
+ if (bhead->code == ID_LINK_PLACEHOLDER) {
/* That way, we know which datablock needs do_versions (required currently for linking). */
id->tag = tag | LIB_TAG_NEED_LINK | LIB_TAG_NEW;
- return blo_nextbhead(fd, bhead);
+ return blo_bhead_next(fd, bhead);
}
/* need a name for the mallocN, just for debugging and sane prints on leaks */
@@ -8607,7 +9091,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
direct_link_image(fd, (Image *)id);
break;
case ID_LA:
- direct_link_lamp(fd, (Lamp *)id);
+ direct_link_light(fd, (Light *)id);
break;
case ID_VF:
direct_link_vfont(fd, (VFont *)id);
@@ -8690,12 +9174,18 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short
oldnewmap_clear(fd->datamap);
if (wrong_id) {
- BKE_libblock_free(main, id);
+ BKE_id_free(main, id);
}
return (bhead);
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read Global Data
+ * \{ */
+
/* note, this has to be kept for reading older files... */
/* also version info is written here */
static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
@@ -8736,7 +9226,7 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
fd->globalf = bfd->globalf;
fd->fileflags = bfd->fileflags;
- return blo_nextbhead(fd, bhead);
+ return blo_bhead_next(fd, bhead);
}
/* note, this has to be kept for reading older files... */
@@ -8751,6 +9241,12 @@ static void link_global(FileData *fd, BlendFileData *bfd)
}
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Versioning
+ * \{ */
+
/* initialize userdef with non-UI dependency stuff */
/* other initializers (such as theme color defaults) go to resources.c */
static void do_versions_userdef(FileData *fd, BlendFileData *bfd)
@@ -8765,8 +9261,8 @@ static void do_versions_userdef(FileData *fd, BlendFileData *bfd)
/* themes for Node and Sequence editor were not using grid color, but back. we copy this over then */
for (btheme = user->themes.first; btheme; btheme = btheme->next) {
- copy_v4_v4_char(btheme->tnode.grid, btheme->tnode.back);
- copy_v4_v4_char(btheme->tseq.grid, btheme->tseq.back);
+ copy_v4_v4_char(btheme->space_node.grid, btheme->space_node.back);
+ copy_v4_v4_char(btheme->space_sequencer.grid, btheme->space_sequencer.back);
}
}
@@ -8831,6 +9327,13 @@ static void do_versions_after_linking(Main *main)
do_versions_after_linking_280(main);
}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read Library Data Block (all)
+ * \{ */
+
static void lib_link_all(FileData *fd, Main *main)
{
lib_link_id(fd, main);
@@ -8852,7 +9355,7 @@ static void lib_link_all(FileData *fd, Main *main)
lib_link_ipo(fd, main); /* XXX deprecated... still needs to be maintained for version patches still */
lib_link_key(fd, main);
lib_link_world(fd, main);
- lib_link_lamp(fd, main);
+ lib_link_light(fd, main);
lib_link_latt(fd, main);
lib_link_text(fd, main);
lib_link_camera(fd, main);
@@ -8876,8 +9379,18 @@ static void lib_link_all(FileData *fd, Main *main)
lib_link_workspaces(fd, main);
lib_link_library(fd, main); /* only init users */
+
+ /* We could integrate that to mesh/curve/lattice lib_link, but this is really cheap process,
+ * so simpler to just use it directly in this single call. */
+ BLO_main_validate_shapekeys(main, NULL);
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read User Preferences
+ * \{ */
+
static void direct_link_keymapitem(FileData *fd, wmKeyMapItem *kmi)
{
kmi->properties = newdataadr(fd, kmi->properties);
@@ -8968,9 +9481,15 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
return bhead;
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Read File (Internal)
+ * \{ */
+
BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
{
- BHead *bhead = blo_firstbhead(fd);
+ BHead *bhead = blo_bhead_first(fd);
BlendFileData *bfd;
ListBase mainlist = {NULL, NULL};
@@ -8991,11 +9510,9 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
const int *data = read_file_thumbnail(fd);
if (data) {
- int width = data[0];
- int height = data[1];
-
- /* Protect against buffer overflow vulnerability. */
- if (BLEN_THUMB_SAFE_MEMSIZE(width, height)) {
+ const int width = data[0];
+ const int height = data[1];
+ if (BLEN_THUMB_MEMSIZE_IS_VALID(width, height)) {
const size_t sz = BLEN_THUMB_MEMSIZE(width, height);
bfd->main->blen_thumb = MEM_mallocN(sz, __func__);
@@ -9014,14 +9531,14 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
case DNA1:
case TEST: /* used as preview since 2.5x */
case REND:
- bhead = blo_nextbhead(fd, bhead);
+ bhead = blo_bhead_next(fd, bhead);
break;
case GLOB:
bhead = read_global(bfd, fd, bhead);
break;
case USER:
if (fd->skip_flags & BLO_READ_SKIP_USERDEF) {
- bhead = blo_nextbhead(fd, bhead);
+ bhead = blo_bhead_next(fd, bhead);
}
else {
bhead = read_userdef(bfd, fd, bhead);
@@ -9031,14 +9548,17 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
bhead = NULL;
break;
- case ID_ID:
- /* Always adds to the most recently loaded ID_LI block, see direct_link_library.
- * This is part of the file format definition. */
+ case ID_LINK_PLACEHOLDER:
if (fd->skip_flags & BLO_READ_SKIP_DATA) {
- bhead = blo_nextbhead(fd, bhead);
+ bhead = blo_bhead_next(fd, bhead);
}
else {
- bhead = read_libblock(fd, mainlist.last, bhead, LIB_TAG_READ | LIB_TAG_EXTERN, NULL);
+ /* Add link placeholder to the main of the library it belongs to.
+ * The library is the most recently loaded ID_LI block, according
+ * to the file format definition. So we can use the entry at the
+ * end of mainlist, added in direct_link_library. */
+ Main *libmain = mainlist.last;
+ bhead = read_libblock(fd, libmain, bhead, LIB_TAG_ID_LINK_PLACEHOLDER | LIB_TAG_EXTERN, NULL);
}
break;
/* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
@@ -9048,7 +9568,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
ATTR_FALLTHROUGH;
default:
if (fd->skip_flags & BLO_READ_SKIP_DATA) {
- bhead = blo_nextbhead(fd, bhead);
+ bhead = blo_bhead_next(fd, bhead);
}
else {
bhead = read_libblock(fd, bfd->main, bhead, LIB_TAG_LOCAL, NULL);
@@ -9101,7 +9621,13 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
return bfd;
}
-/* ************* APPEND LIBRARY ************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Library Linking
+ *
+ * Also used for append.
+ * \{ */
struct BHeadSort {
BHead *bhead;
@@ -9123,7 +9649,7 @@ static void sort_bhead_old_map(FileData *fd)
struct BHeadSort *bhs;
int tot = 0;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead))
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead))
tot++;
fd->tot_bheadmap = tot;
@@ -9131,7 +9657,7 @@ static void sort_bhead_old_map(FileData *fd)
bhs = fd->bheadmap = MEM_malloc_arrayN(tot, sizeof(struct BHeadSort), "BHeadSort");
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead), bhs++) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead), bhs++) {
bhs->bhead = bhead;
bhs->old = bhead->old;
}
@@ -9145,7 +9671,7 @@ static BHead *find_previous_lib(FileData *fd, BHead *bhead)
if (fd->memfile)
return NULL;
- for (; bhead; bhead = blo_prevbhead(fd, bhead)) {
+ for (; bhead; bhead = blo_bhead_prev(fd, bhead)) {
if (bhead->code == ID_LI)
break;
}
@@ -9173,7 +9699,7 @@ static BHead *find_bhead(FileData *fd, void *old)
return bhs->bhead;
#if 0
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->old == old)
return bhead;
}
@@ -9196,9 +9722,9 @@ static BHead *find_bhead_from_code_name(FileData *fd, const short idcode, const
#else
BHead *bhead;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == idcode) {
- const char *idname_test = bhead_id_name(fd, bhead);
+ const char *idname_test = blo_bhead_id_name(fd, bhead);
if (STREQ(idname_test + 2, name)) {
return bhead;
}
@@ -9223,90 +9749,102 @@ static BHead *find_bhead_from_idname(FileData *fd, const char *idname)
static ID *is_yet_read(FileData *fd, Main *mainvar, BHead *bhead)
{
- const char *idname = bhead_id_name(fd, bhead);
+ const char *idname = blo_bhead_id_name(fd, bhead);
/* which_libbase can be NULL, intentionally not using idname+2 */
return BLI_findstring(which_libbase(mainvar, GS(idname)), idname, offsetof(ID, name));
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Library Linking (expand pointers)
+ * \{ */
+
static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
{
- BHead *bhead;
FileData *fd = fdhandle;
- ID *id;
- bhead = find_bhead(fd, old);
- if (bhead) {
- /* from another library? */
- if (bhead->code == ID_ID) {
- BHead *bheadlib = find_previous_lib(fd, bhead);
+ BHead *bhead = find_bhead(fd, old);
+ if (bhead == NULL) {
+ return;
+ }
- if (bheadlib) {
- Library *lib = read_struct(fd, bheadlib, "Library");
- Main *ptr = blo_find_main(fd, lib->name, fd->relabase);
+ if (bhead->code == ID_LINK_PLACEHOLDER) {
+ /* Placeholder link to datablock in another library. */
+ BHead *bheadlib = find_previous_lib(fd, bhead);
+ if (bheadlib == NULL) {
+ return;
+ }
- if (ptr->curlib == NULL) {
- const char *idname = bhead_id_name(fd, bhead);
+ Library *lib = read_struct(fd, bheadlib, "Library");
+ Main *libmain = blo_find_main(fd, lib->name, fd->relabase);
- blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB: Data refers to main .blend file: '%s' from %s"),
- idname, mainvar->curlib->filepath);
- return;
- }
- else
- id = is_yet_read(fd, ptr, bhead);
+ if (libmain->curlib == NULL) {
+ const char *idname = blo_bhead_id_name(fd, bhead);
- if (id == NULL) {
- read_libblock(fd, ptr, bhead, LIB_TAG_READ | LIB_TAG_INDIRECT, NULL);
- // commented because this can print way too much
- // if (G.debug & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name);
+ blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB: Data refers to main .blend file: '%s' from %s"),
+ idname, mainvar->curlib->filepath);
+ return;
+ }
- /* for outliner dependency only */
- ptr->curlib->parent = mainvar->curlib;
- }
- else {
- /* The line below was commented by Ton (I assume), when Hos did the merge from the orange branch. rev 6568
- * This line is NEEDED, the case is that you have 3 blend files...
- * user.blend, lib.blend and lib_indirect.blend - if user.blend already references a "tree" from
- * lib_indirect.blend but lib.blend does too, linking in a Scene or Group from lib.blend can result in an
- * empty without the dupli group referenced. Once you save and reload the group would appear. - Campbell */
- /* This crashes files, must look further into it */
-
- /* 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! */
-
- /* Update: previously it was checking for id->tag & LIB_TAG_PRE_EXISTING, however that
- * does not affect file reading. For file reading we may need to insert it into the libmap as well,
- * because you might have two files indirectly linking the same datablock, and in that case
- * we need this in the libmap for the fd of both those files.
- *
- * The crash that this check avoided earlier was because bhead->code wasn't properly passed in, making
- * change_idid_adr not detect the mapping was for an ID_ID datablock. */
- oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);
- change_idid_adr_fd(fd, bhead->old, id);
-
- // commented because this can print way too much
- // if (G.debug & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name);
- }
+ ID *id = is_yet_read(fd, libmain, bhead);
- MEM_freeN(lib);
- }
+ if (id == NULL) {
+ /* ID has not been read yet, add placeholder to the main of the
+ * library it belongs to, so that it will be read later. */
+ read_libblock(fd, libmain, bhead, LIB_TAG_ID_LINK_PLACEHOLDER | LIB_TAG_INDIRECT, NULL);
+ // commented because this can print way too much
+ // if (G.debug & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name);
+
+ /* for outliner dependency only */
+ libmain->curlib->parent = mainvar->curlib;
}
else {
- /* in 2.50+ file identifier for screens is patched, forward compatibility */
- if (bhead->code == ID_SCRN) {
- bhead->code = ID_SCR;
- }
+ /* "id" is either a placeholder or real ID that is already in the
+ * main of the library (A) it belongs to. However it might have been
+ * put there by another library (C) which only updated its own
+ * fd->libmap. In that case we also need to update the fd->libmap
+ * of the current library (B) so we can find it for lookups.
+ *
+ * An example of such a setup is:
+ * (A) tree.blend: contains Tree object.
+ * (B) forest.blend: contains Forest collection linking in Tree from tree.blend.
+ * (C) shot.blend: links in both Tree from tree.blend and Forest from forest.blend.
+ */
+ oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);
- id = is_yet_read(fd, mainvar, bhead);
- if (id == NULL) {
- read_libblock(fd, mainvar, bhead, LIB_TAG_TESTIND, NULL);
- }
- else {
- /* this is actually only needed on UI call? when ID was already read before, and another append
- * happens which invokes same ID... in that case the lookup table needs this entry */
- oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);
- // commented because this can print way too much
- // if (G.debug & G_DEBUG) printf("expand: already read %s\n", id->name);
- }
+ /* If "id" is a real datablock and not a placeholder, we need to
+ * update fd->libmap to replace ID_LINK_PLACEHOLDER with the real
+ * ID_* code.
+ *
+ * When the real ID is read this replacement happens for all
+ * libraries read so far, but not for libraries that have not been
+ * read yet at that point. */
+ change_link_placeholder_to_real_ID_pointer_fd(fd, bhead->old, id);
+
+ // commented because this can print way too much
+ // if (G.debug & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name);
+ }
+
+ MEM_freeN(lib);
+ }
+ else {
+ /* Datablock in same library. */
+ /* In 2.50+ file identifier for screens is patched, forward compatibility. */
+ if (bhead->code == ID_SCRN) {
+ bhead->code = ID_SCR;
+ }
+
+ ID *id = is_yet_read(fd, mainvar, bhead);
+ if (id == NULL) {
+ read_libblock(fd, mainvar, bhead, LIB_TAG_NEED_EXPAND | LIB_TAG_INDIRECT, NULL);
+ }
+ else {
+ /* this is actually only needed on UI call? when ID was already read before, and another append
+ * happens which invokes same ID... in that case the lookup table needs this entry */
+ oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);
+ // commented because this can print way too much
+ // if (G.debug & G_DEBUG) printf("expand: already read %s\n", id->name);
}
}
}
@@ -9482,8 +10020,8 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
{
int a;
- expand_doit(fd, mainvar, part->dup_ob);
- expand_doit(fd, mainvar, part->dup_group);
+ expand_doit(fd, mainvar, part->instance_object);
+ expand_doit(fd, mainvar, part->instance_collection);
expand_doit(fd, mainvar, part->eff_group);
expand_doit(fd, mainvar, part->bb_ob);
expand_doit(fd, mainvar, part->collision_group);
@@ -9529,7 +10067,7 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
}
}
- for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (ParticleDupliWeight *dw = part->instance_weights.first; dw; dw = dw->next) {
expand_doit(fd, mainvar, dw->ob);
}
}
@@ -9629,7 +10167,7 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma)
}
}
-static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)
+static void expand_light(FileData *fd, Main *mainvar, Light *la)
{
expand_doit(fd, mainvar, la->ipo); // XXX deprecated - old animation system
@@ -9851,8 +10389,8 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
if (paf && paf->group)
expand_doit(fd, mainvar, paf->group);
- if (ob->dup_group)
- expand_doit(fd, mainvar, ob->dup_group);
+ if (ob->instance_collection)
+ expand_doit(fd, mainvar, ob->instance_collection);
if (ob->proxy)
expand_doit(fd, mainvar, ob->proxy);
@@ -9979,6 +10517,11 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
if (seq->clip) expand_doit(fd, mainvar, seq->clip);
if (seq->mask) expand_doit(fd, mainvar, seq->mask);
if (seq->sound) expand_doit(fd, mainvar, seq->sound);
+
+ if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) {
+ TextVars *data = seq->effectdata;
+ expand_doit(fd, mainvar, data->text_font);
+ }
} SEQ_END;
}
@@ -10201,7 +10744,7 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
expand_lattice(fd, mainvar, (Lattice *)id);
break;
case ID_LA:
- expand_lamp(fd, mainvar, (Lamp *)id);
+ expand_light(fd, mainvar, (Light *)id);
break;
case ID_KE:
expand_key(fd, mainvar, (Key *)id);
@@ -10271,14 +10814,18 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
}
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Library Linking (helper functions)
+ * \{ */
-/* ***************************** */
static bool object_in_any_scene(Main *bmain, Object *ob)
{
Scene *sce;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (BKE_scene_object_find(sce, ob)) {
return true;
}
@@ -10287,31 +10834,19 @@ static bool object_in_any_scene(Main *bmain, Object *ob)
return false;
}
-static Collection *get_collection_active(
- Main *bmain, Scene *scene, ViewLayer *view_layer, const int flag)
-{
- if (flag & FILE_ACTIVE_COLLECTION) {
- LayerCollection *lc = BKE_layer_collection_get_active(view_layer);
- return lc->collection;
- }
- else {
- return BKE_collection_add(bmain, scene->master_collection, NULL);
- }
-}
-
static void add_loose_objects_to_scene(
Main *mainvar, Main *bmain,
Scene *scene, ViewLayer *view_layer, const View3D *v3d, Library *lib, const short flag)
{
+ Collection *active_collection = NULL;
const bool is_link = (flag & FILE_LINK) != 0;
BLI_assert(scene);
/* Give all objects which are LIB_TAG_INDIRECT a base, or for a collection when *lib has been set. */
- for (Object *ob = mainvar->object.first; ob; ob = ob->id.next) {
- if ((ob->id.tag & LIB_TAG_INDIRECT) && (ob->id.tag & LIB_TAG_PRE_EXISTING) == 0) {
- bool do_it = false;
-
+ for (Object *ob = mainvar->objects.first; ob; ob = ob->id.next) {
+ bool do_it = (ob->id.tag & LIB_TAG_DOIT) != 0;
+ if (do_it || ((ob->id.tag & LIB_TAG_INDIRECT) && (ob->id.tag & LIB_TAG_PRE_EXISTING) == 0)) {
if (!is_link) {
if (ob->id.us == 0) {
do_it = true;
@@ -10324,9 +10859,20 @@ static void add_loose_objects_to_scene(
}
if (do_it) {
+ /* Find or add collection as needed. */
+ if (active_collection == NULL) {
+ if (flag & FILE_ACTIVE_COLLECTION) {
+ LayerCollection *lc = BKE_layer_collection_get_active(view_layer);
+ active_collection = lc->collection;
+ }
+ else {
+ active_collection = BKE_collection_add(bmain, scene->master_collection, NULL);
+ }
+ }
+
CLAMP_MIN(ob->id.us, 0);
+ ob->mode = OB_MODE_OBJECT;
- Collection *active_collection = get_collection_active(bmain, scene, view_layer, FILE_ACTIVE_COLLECTION);
BKE_collection_object_add(bmain, active_collection, ob);
Base *base = BKE_view_layer_base_find(view_layer, ob);
@@ -10337,8 +10883,6 @@ static void add_loose_objects_to_scene(
BKE_scene_object_base_flag_sync_from_base(base);
if (flag & FILE_AUTOSELECT) {
- /* Note that link_object_postprocess() already checks for FILE_AUTOSELECT flag,
- * but it will miss objects from non-instantiated collections... */
if (base->flag & BASE_SELECTABLE) {
base->flag |= BASE_SELECTED;
BKE_scene_object_base_flag_sync_from_base(base);
@@ -10355,43 +10899,68 @@ static void add_loose_objects_to_scene(
static void add_collections_to_scene(
Main *mainvar, Main *bmain,
- Scene *scene, ViewLayer *view_layer, const View3D *v3d, Library *UNUSED(lib), const short flag)
+ Scene *scene, ViewLayer *view_layer, const View3D *v3d, Library *lib, const short flag)
{
- Collection *active_collection = get_collection_active(bmain, scene, view_layer, FILE_ACTIVE_COLLECTION);
+ Collection *active_collection = scene->master_collection;
+ if (flag & FILE_ACTIVE_COLLECTION) {
+ LayerCollection *lc = BKE_layer_collection_get_active(view_layer);
+ active_collection = lc->collection;
+ }
/* Give all objects which are tagged a base. */
- for (Collection *collection = mainvar->collection.first; collection; collection = collection->id.next) {
- if (collection->id.tag & LIB_TAG_DOIT) {
- if (flag & FILE_GROUP_INSTANCE) {
- /* Any indirect collection should not have been tagged. */
- BLI_assert((collection->id.tag & LIB_TAG_INDIRECT) == 0);
-
- /* BKE_object_add(...) messes with the selection. */
- Object *ob = BKE_object_add_only_object(bmain, OB_EMPTY, collection->id.name + 2);
- ob->type = OB_EMPTY;
+ for (Collection *collection = mainvar->collections.first; collection; collection = collection->id.next) {
+ if ((flag & FILE_GROUP_INSTANCE) && (collection->id.tag & LIB_TAG_DOIT)) {
+ /* Any indirect collection should not have been tagged. */
+ BLI_assert((collection->id.tag & LIB_TAG_INDIRECT) == 0);
- BKE_collection_object_add(bmain, active_collection, ob);
- Base *base = BKE_view_layer_base_find(view_layer, ob);
+ /* BKE_object_add(...) messes with the selection. */
+ Object *ob = BKE_object_add_only_object(bmain, OB_EMPTY, collection->id.name + 2);
+ ob->type = OB_EMPTY;
- if (v3d != NULL) {
- base->local_view_bits |= v3d->local_view_uuid;
- }
+ BKE_collection_object_add(bmain, active_collection, ob);
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
- if (base->flag & BASE_SELECTABLE) {
- base->flag |= BASE_SELECTED;
- }
+ if (v3d != NULL) {
+ base->local_view_bits |= v3d->local_view_uuid;
+ }
- BKE_scene_object_base_flag_sync_from_base(base);
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
- view_layer->basact = base;
+ if (base->flag & BASE_SELECTABLE) {
+ base->flag |= BASE_SELECTED;
+ }
- /* Assign the collection. */
- ob->dup_group = collection;
- id_us_plus(&collection->id);
- ob->transflag |= OB_DUPLICOLLECTION;
- copy_v3_v3(ob->loc, scene->cursor.location);
+ BKE_scene_object_base_flag_sync_from_base(base);
+ DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
+ view_layer->basact = base;
+
+ /* Assign the collection. */
+ ob->instance_collection = collection;
+ id_us_plus(&collection->id);
+ ob->transflag |= OB_DUPLICOLLECTION;
+ copy_v3_v3(ob->loc, scene->cursor.location);
+ }
+ /* We do not want to force instantiation of indirectly linked collections... */
+ else if ((collection->id.tag & LIB_TAG_INDIRECT) == 0) {
+ bool do_add_collection = (collection->id.tag & LIB_TAG_DOIT) != 0;
+ if (!do_add_collection) {
+ /* We need to check that objects in that collections are already instantiated in a scene.
+ * Otherwise, it's better to add the collection to the scene's active collection, than to
+ * instantiate its objects in active scene's collection directly. See T61141.
+ * Note that we only check object directly into that collection, not recursively into its children.
+ */
+ for (CollectionObject *coll_ob = collection->gobject.first; coll_ob != NULL; coll_ob = coll_ob->next) {
+ Object *ob = coll_ob->ob;
+ if ((ob->id.tag & LIB_TAG_PRE_EXISTING) == 0 &&
+ (ob->id.tag & LIB_TAG_DOIT) == 0 &&
+ (ob->id.tag & LIB_TAG_INDIRECT) == 0 &&
+ (ob->id.lib == lib) &&
+ (object_in_any_scene(bmain, ob) == 0))
+ {
+ do_add_collection = true;
+ break;
+ }
+ }
}
- else {
+ if (do_add_collection) {
/* Add collection as child of active collection. */
BKE_collection_child_add(bmain, active_collection, collection);
@@ -10402,7 +10971,7 @@ static void add_collections_to_scene(
}
}
-static ID *create_placeholder(Main *mainvar, const short idcode, const char *idname, const short tag)
+static ID *create_placeholder(Main *mainvar, const short idcode, const char *idname, const int tag)
{
ListBase *lb = which_libbase(mainvar, idcode);
ID *ph_id = BKE_libblock_alloc_notest(idcode);
@@ -10438,7 +11007,8 @@ static ID *link_named_part(
id = is_yet_read(fd, mainl, bhead);
if (id == NULL) {
/* not read yet */
- read_libblock(fd, mainl, bhead, force_indirect ? LIB_TAG_TESTIND : LIB_TAG_TESTEXT, &id);
+ const int tag = force_indirect ? LIB_TAG_INDIRECT : LIB_TAG_EXTERN;
+ read_libblock(fd, mainl, bhead, tag | LIB_TAG_NEED_EXPAND, &id);
if (id) {
/* sort by name in list */
@@ -10471,38 +11041,6 @@ static ID *link_named_part(
return id;
}
-static void link_object_postprocess(
- ID *id, Main *bmain, Scene *scene, ViewLayer *view_layer, const View3D *v3d, const int flag)
-{
- if (scene) {
- /* link to scene */
- Base *base;
- Object *ob;
- Collection *collection;
-
- ob = (Object *)id;
- ob->mode = OB_MODE_OBJECT;
-
- collection = get_collection_active(bmain, scene, view_layer, flag);
- BKE_collection_object_add(bmain, collection, ob);
- base = BKE_view_layer_base_find(view_layer, ob);
- BKE_scene_object_base_flag_sync_from_base(base);
-
- /* Link at active local view (view3d if available in context. */
- if (v3d != NULL) {
- base->local_view_bits |= v3d->local_view_uuid;
- }
-
- if (flag & FILE_AUTOSELECT) {
- if (base->flag & BASE_SELECTABLE) {
- base->flag |= BASE_SELECTED;
- BKE_scene_object_base_flag_sync_from_base(base);
- }
- /* do NOT make base active here! screws up GUI stuff, if you want it do it on src/ level */
- }
- }
-}
-
/**
* Simple reader for copy/paste buffers.
*/
@@ -10511,13 +11049,13 @@ void BLO_library_link_copypaste(Main *mainl, BlendHandle *bh)
FileData *fd = (FileData *)(bh);
BHead *bhead;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
ID *id = NULL;
if (bhead->code == ENDB)
break;
if (ELEM(bhead->code, ID_OB, ID_GR)) {
- read_libblock(fd, mainl, bhead, LIB_TAG_TESTIND, &id);
+ read_libblock(fd, mainl, bhead, LIB_TAG_NEED_EXPAND | LIB_TAG_INDIRECT, &id);
}
@@ -10539,13 +11077,13 @@ void BLO_library_link_copypaste(Main *mainl, BlendHandle *bh)
}
static ID *link_named_part_ex(
- Main *mainl, FileData *fd, const short idcode, const char *name, const int flag,
- Main *bmain, Scene *scene, ViewLayer *view_layer, const View3D *v3d)
+ Main *mainl, FileData *fd, const short idcode, const char *name, const int flag)
{
ID *id = link_named_part(mainl, fd, idcode, name, flag);
- if (id && (GS(id->name) == ID_OB)) { /* loose object: give a base */
- link_object_postprocess(id, bmain, scene, view_layer, v3d, flag);
+ if (id && (GS(id->name) == ID_OB)) {
+ /* Tag as loose object needing to be instantiated somewhere... */
+ id->tag |= LIB_TAG_DOIT;
}
else if (id && (GS(id->name) == ID_GR)) {
/* tag as needing to be instantiated or linked */
@@ -10556,12 +11094,12 @@ static ID *link_named_part_ex(
}
/**
- * Link a named datablock from an external blend file.
+ * Link a named data-block from an external blend file.
*
* \param mainl: The main database to link from (not the active one).
* \param bh: The blender file handle.
- * \param idcode: The kind of datablock to link.
- * \param name: The name of the datablock (without the 2 char ID prefix).
+ * \param idcode: The kind of data-block to link.
+ * \param name: The name of the data-block (without the 2 char ID prefix).
* \return the linked ID when found.
*/
ID *BLO_library_link_named_part(Main *mainl, BlendHandle **bh, const short idcode, const char *name)
@@ -10571,13 +11109,13 @@ ID *BLO_library_link_named_part(Main *mainl, BlendHandle **bh, const short idcod
}
/**
- * Link a named datablock from an external blend file.
+ * Link a named data-block from an external blend file.
* Optionally instantiate the object/collection in the scene when the flags are set.
*
* \param mainl: The main database to link from (not the active one).
* \param bh: The blender file handle.
- * \param idcode: The kind of datablock to link.
- * \param name: The name of the datablock (without the 2 char ID prefix).
+ * \param idcode: The kind of data-block to link.
+ * \param name: The name of the data-block (without the 2 char ID prefix).
* \param flag: Options for linking, used for instantiating.
* \param scene: The scene in which to instantiate objects/collections (if NULL, no instantiation is done).
* \param v3d: The active View3D (only to define active layers for instantiated objects & collections, can be NULL).
@@ -10585,53 +11123,10 @@ ID *BLO_library_link_named_part(Main *mainl, BlendHandle **bh, const short idcod
*/
ID *BLO_library_link_named_part_ex(
Main *mainl, BlendHandle **bh,
- const short idcode, const char *name, const int flag,
- Main *bmain, Scene *scene, ViewLayer *view_layer, const View3D *v3d)
+ const short idcode, const char *name, const int flag)
{
FileData *fd = (FileData *)(*bh);
- return link_named_part_ex(mainl, fd, idcode, name, flag, bmain, scene, view_layer, v3d);
-}
-
-static void link_id_part(ReportList *reports, FileData *fd, Main *mainvar, ID *id, ID **r_id)
-{
- BHead *bhead = NULL;
- const bool is_valid = BKE_idcode_is_linkable(GS(id->name)) || ((id->tag & LIB_TAG_EXTERN) == 0);
-
- if (fd) {
- bhead = find_bhead_from_idname(fd, id->name);
- }
-
- id->tag &= ~LIB_TAG_READ;
-
- if (!is_valid) {
- blo_reportf_wrap(
- reports, RPT_ERROR,
- TIP_("LIB: %s: '%s' is directly linked from '%s' (parent '%s'), but is a non-linkable data type"),
- BKE_idcode_to_name(GS(id->name)),
- id->name + 2,
- mainvar->curlib->filepath,
- library_parent_filepath(mainvar->curlib));
- }
-
- if (bhead) {
- id->tag |= LIB_TAG_NEED_EXPAND;
- // printf("read lib block %s\n", id->name);
- read_libblock(fd, mainvar, bhead, id->tag, r_id);
- }
- else {
- blo_reportf_wrap(
- reports, RPT_WARNING,
- TIP_("LIB: %s: '%s' missing from '%s', parent '%s'"),
- BKE_idcode_to_name(GS(id->name)),
- id->name + 2,
- mainvar->curlib->filepath,
- library_parent_filepath(mainvar->curlib));
-
- /* Generate a placeholder for this ID (simplified version of read_libblock actually...). */
- if (r_id) {
- *r_id = is_valid ? create_placeholder(mainvar, GS(id->name), id->name + 2, id->tag) : NULL;
- }
- }
+ return link_named_part_ex(mainl, fd, idcode, name, flag);
}
/* common routine to append/link something from a library */
@@ -10643,7 +11138,7 @@ static Main *library_link_begin(Main *mainvar, FileData **fd, const char *filepa
(*fd)->mainlist = MEM_callocN(sizeof(ListBase), "FileData.mainlist");
/* clear for collection instantiating tag */
- BKE_main_id_tag_listbase(&(mainvar->collection), LIB_TAG_DOIT, false);
+ BKE_main_id_tag_listbase(&(mainvar->collections), LIB_TAG_DOIT, false);
/* make mains */
blo_split_main((*fd)->mainlist, mainvar);
@@ -10769,12 +11264,13 @@ static void library_link_end(
/* printf("library_append_end, scene is NULL (objects wont get bases)\n"); */
}
- /* clear collection instantiating tag */
- BKE_main_id_tag_listbase(&(mainvar->collection), LIB_TAG_DOIT, false);
+ /* Clear objects and collections instantiating tag. */
+ BKE_main_id_tag_listbase(&(mainvar->objects), LIB_TAG_DOIT, false);
+ BKE_main_id_tag_listbase(&(mainvar->collections), LIB_TAG_DOIT, false);
/* patch to prevent switch_endian happens twice */
if ((*fd)->flags & FD_FLAGS_SWITCH_ENDIAN) {
- blo_freefiledata(*fd);
+ blo_filedata_free(*fd);
*fd = NULL;
}
}
@@ -10806,195 +11302,245 @@ void *BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname)
return read_struct(fd, bh, blockname);
}
-/* ************* READ LIBRARY ************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Library Reading
+ * \{ */
-static int mainvar_id_tag_any_check(Main *mainvar, const short tag)
+static int has_linked_ids_to_read(Main *mainvar)
{
ListBase *lbarray[MAX_LIBARRAY];
- int a;
+ int a = set_listbasepointers(mainvar, lbarray);
- a = set_listbasepointers(mainvar, lbarray);
while (a--) {
- ID *id;
-
- for (id = lbarray[a]->first; id; id = id->next) {
- if (id->tag & tag) {
+ for (ID *id = lbarray[a]->first; id; id = id->next) {
+ if (id->tag & LIB_TAG_ID_LINK_PLACEHOLDER) {
return true;
}
}
}
+
return false;
}
-static void read_libraries(FileData *basefd, ListBase *mainlist)
+static void read_library_linked_id(ReportList *reports, FileData *fd, Main *mainvar, ID *id, ID **r_id)
+{
+ BHead *bhead = NULL;
+ const bool is_valid = BKE_idcode_is_linkable(GS(id->name)) || ((id->tag & LIB_TAG_EXTERN) == 0);
+
+ if (fd) {
+ bhead = find_bhead_from_idname(fd, id->name);
+ }
+
+ if (!is_valid) {
+ blo_reportf_wrap(
+ reports, RPT_ERROR,
+ TIP_("LIB: %s: '%s' is directly linked from '%s' (parent '%s'), but is a non-linkable data type"),
+ BKE_idcode_to_name(GS(id->name)),
+ id->name + 2,
+ mainvar->curlib->filepath,
+ library_parent_filepath(mainvar->curlib));
+ }
+
+ id->tag &= ~LIB_TAG_ID_LINK_PLACEHOLDER;
+
+ if (bhead) {
+ id->tag |= LIB_TAG_NEED_EXPAND;
+ // printf("read lib block %s\n", id->name);
+ read_libblock(fd, mainvar, bhead, id->tag, r_id);
+ }
+ else {
+ blo_reportf_wrap(
+ reports, RPT_WARNING,
+ TIP_("LIB: %s: '%s' missing from '%s', parent '%s'"),
+ BKE_idcode_to_name(GS(id->name)),
+ id->name + 2,
+ mainvar->curlib->filepath,
+ library_parent_filepath(mainvar->curlib));
+
+ /* Generate a placeholder for this ID (simplified version of read_libblock actually...). */
+ if (r_id) {
+ *r_id = is_valid ? create_placeholder(mainvar, GS(id->name), id->name + 2, id->tag) : NULL;
+ }
+ }
+}
+
+static void read_library_linked_ids(FileData *basefd, FileData *fd, ListBase *mainlist, Main *mainvar)
{
- Main *mainl = mainlist->first;
- Main *mainptr;
- ListBase *lbarray[MAX_LIBARRAY];
GHash *loaded_ids = BLI_ghash_str_new(__func__);
- int a;
- bool do_it = true;
- /* expander now is callback function */
- BLO_main_expander(expand_doit_library);
+ ListBase *lbarray[MAX_LIBARRAY];
+ int a = set_listbasepointers(mainvar, lbarray);
- while (do_it) {
- do_it = false;
+ while (a--) {
+ ID *id = lbarray[a]->first;
+ ListBase pending_free_ids = {NULL};
+
+ while (id) {
+ ID *id_next = id->next;
+ if (id->tag & LIB_TAG_ID_LINK_PLACEHOLDER) {
+ BLI_remlink(lbarray[a], id);
+
+ /* When playing with lib renaming and such, you may end with cases where
+ * you have more than one linked ID of the same data-block from same
+ * library. This is absolutely horrible, hence we use a ghash to ensure
+ * we go back to a single linked data when loading the file. */
+ ID **realid = NULL;
+ if (!BLI_ghash_ensure_p(loaded_ids, id->name, (void ***)&realid)) {
+ read_library_linked_id(basefd->reports, fd, mainvar, id, realid);
+ }
- /* test 1: read libdata */
- mainptr = mainl->next;
- while (mainptr) {
- if (mainvar_id_tag_any_check(mainptr, LIB_TAG_READ)) {
- // printf("found LIB_TAG_READ %s (%s)\n", mainptr->curlib->id.name, mainptr->curlib->name);
+ /* realid shall never be NULL - unless some source file/lib is broken
+ * (known case: some directly linked shapekey from a missing lib...). */
+ /* BLI_assert(*realid != NULL); */
- FileData *fd = mainptr->curlib->filedata;
+ /* Now that we have a real ID, replace all pointers to placeholders in
+ * fd->libmap with pointers to the real datablocks. We do this for all
+ * libraries since multiple might be referencing this ID. */
+ change_link_placeholder_to_real_ID_pointer(mainlist, basefd, id, *realid);
- if (fd == NULL) {
+ /* We cannot free old lib-ref placeholder ID here anymore, since we use
+ * its name as key in loaded_ids hash. */
+ BLI_addtail(&pending_free_ids, id);
+ }
+ id = id_next;
+ }
- /* printf and reports for now... its important users know this */
+ /* Clear GHash and free link placeholder IDs of the current type. */
+ BLI_ghash_clear(loaded_ids, NULL, NULL);
+ BLI_freelistN(&pending_free_ids);
+ }
- /* if packed file... */
- if (mainptr->curlib->packedfile) {
- PackedFile *pf = mainptr->curlib->packedfile;
+ BLI_ghash_free(loaded_ids, NULL, NULL);
+}
- blo_reportf_wrap(
- basefd->reports, RPT_INFO, TIP_("Read packed library: '%s', parent '%s'"),
- mainptr->curlib->name,
- library_parent_filepath(mainptr->curlib));
- fd = blo_openblendermemory(pf->data, pf->size, basefd->reports);
+static FileData *read_library_file_data(FileData *basefd, ListBase *mainlist, Main *mainl, Main *mainptr)
+{
+ FileData *fd = mainptr->curlib->filedata;
+ if (fd != NULL) {
+ /* File already open. */
+ return fd;
+ }
- /* needed for library_append and read_libraries */
- BLI_strncpy(fd->relabase, mainptr->curlib->filepath, sizeof(fd->relabase));
- }
- else {
- blo_reportf_wrap(
- basefd->reports, RPT_INFO, TIP_("Read library: '%s', '%s', parent '%s'"),
- mainptr->curlib->filepath,
- mainptr->curlib->name,
- library_parent_filepath(mainptr->curlib));
- fd = blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
- }
- /* allow typing in a new lib path */
- if (G.debug_value == -666) {
- while (fd == NULL) {
- char newlib_path[FILE_MAX] = {0};
- printf("Missing library...'\n");
- printf(" current file: %s\n", BKE_main_blendfile_path_from_global());
- printf(" absolute lib: %s\n", mainptr->curlib->filepath);
- printf(" relative lib: %s\n", mainptr->curlib->name);
- printf(" enter a new path:\n");
-
- if (scanf("%1023s", newlib_path) > 0) { /* Warning, keep length in sync with FILE_MAX! */
- BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name));
- BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath));
- BLI_cleanup_path(BKE_main_blendfile_path_from_global(), mainptr->curlib->filepath);
-
- fd = blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
-
- if (fd) {
- fd->mainlist = mainlist;
- printf("found: '%s', party on macuno!\n", mainptr->curlib->filepath);
- }
- }
- }
- }
+ if (mainptr->curlib->packedfile) {
+ /* Read packed file. */
+ PackedFile *pf = mainptr->curlib->packedfile;
+
+ blo_reportf_wrap(
+ basefd->reports, RPT_INFO, TIP_("Read packed library: '%s', parent '%s'"),
+ mainptr->curlib->name,
+ library_parent_filepath(mainptr->curlib));
+ fd = blo_filedata_from_memory(pf->data, pf->size, basefd->reports);
+
+ /* Needed for library_append and read_libraries. */
+ BLI_strncpy(fd->relabase, mainptr->curlib->filepath, sizeof(fd->relabase));
+ }
+ else {
+ /* Read file on disk. */
+ blo_reportf_wrap(
+ basefd->reports, RPT_INFO, TIP_("Read library: '%s', '%s', parent '%s'"),
+ mainptr->curlib->filepath,
+ mainptr->curlib->name,
+ library_parent_filepath(mainptr->curlib));
+ fd = blo_filedata_from_file(mainptr->curlib->filepath, basefd->reports);
+ }
- if (fd) {
- /* share the mainlist, so all libraries are added immediately in a
- * single list. it used to be that all FileData's had their own list,
- * but with indirectly linking this meant we didn't catch duplicate
- * libraries properly */
- fd->mainlist = mainlist;
+ if (fd) {
+ /* Share the mainlist, so all libraries are added immediately in a
+ * single list. It used to be that all FileData's had their own list,
+ * but with indirectly linking this meant we didn't catch duplicate
+ * libraries properly. */
+ fd->mainlist = mainlist;
- fd->reports = basefd->reports;
+ fd->reports = basefd->reports;
- if (fd->libmap)
- oldnewmap_free(fd->libmap);
+ if (fd->libmap)
+ oldnewmap_free(fd->libmap);
- fd->libmap = oldnewmap_new();
+ fd->libmap = oldnewmap_new();
- mainptr->curlib->filedata = fd;
- mainptr->versionfile = fd->fileversion;
+ mainptr->curlib->filedata = fd;
+ mainptr->versionfile = fd->fileversion;
- /* subversion */
- read_file_version(fd, mainptr);
+ /* subversion */
+ read_file_version(fd, mainptr);
#ifdef USE_GHASH_BHEAD
- read_file_bhead_idname_map_create(fd);
+ read_file_bhead_idname_map_create(fd);
#endif
+ }
+ else {
+ mainptr->curlib->filedata = NULL;
+ mainptr->curlib->id.tag |= LIB_TAG_MISSING;
+ /* Set lib version to current main one... Makes assert later happy. */
+ mainptr->versionfile = mainptr->curlib->versionfile = mainl->versionfile;
+ mainptr->subversionfile = mainptr->curlib->subversionfile = mainl->subversionfile;
+ }
- }
- else {
- mainptr->curlib->filedata = NULL;
- mainptr->curlib->id.tag |= LIB_TAG_MISSING;
- /* Set lib version to current main one... Makes assert later happy. */
- mainptr->versionfile = mainptr->curlib->versionfile = mainl->versionfile;
- mainptr->subversionfile = mainptr->curlib->subversionfile = mainl->subversionfile;
- }
+ if (fd == NULL) {
+ blo_reportf_wrap(basefd->reports, RPT_WARNING, TIP_("Cannot find lib '%s'"),
+ mainptr->curlib->filepath);
+ }
- if (fd == NULL) {
- blo_reportf_wrap(basefd->reports, RPT_WARNING, TIP_("Cannot find lib '%s'"),
- mainptr->curlib->filepath);
- }
- }
- if (fd) {
- do_it = true;
- }
- a = set_listbasepointers(mainptr, lbarray);
- while (a--) {
- ID *id = lbarray[a]->first;
- ListBase pending_free_ids = {NULL};
-
- while (id) {
- ID *idn = id->next;
- if (id->tag & LIB_TAG_READ) {
- BLI_remlink(lbarray[a], id);
-
- /* When playing with lib renaming and such, you may end with cases where you have
- * more than one linked ID of the same data-block from same library.
- * This is absolutely horrible, hence we use a ghash to ensure we go back to a single
- * linked data when loading the file... */
- ID **realid = NULL;
- if (!BLI_ghash_ensure_p(loaded_ids, id->name, (void ***)&realid)) {
- link_id_part(basefd->reports, fd, mainptr, id, realid);
- }
+ return fd;
+}
- /* realid shall never be NULL - unless some source file/lib is broken
- * (known case: some directly linked shapekey from a missing lib...). */
- /* BLI_assert(*realid != NULL); */
+static void read_libraries(FileData *basefd, ListBase *mainlist)
+{
+ Main *mainl = mainlist->first;
+ bool do_it = true;
- change_idid_adr(mainlist, basefd, id, *realid);
+ /* Expander is now callback function. */
+ BLO_main_expander(expand_doit_library);
- /* We cannot free old lib-ref placeholder ID here anymore, since we use its name
- * as key in loaded_ids hass. */
- BLI_addtail(&pending_free_ids, id);
- }
- id = idn;
- }
+ /* At this point the base blend file has been read, and each library blend
+ * encountered so far has a main with placeholders for linked datablocks.
+ *
+ * Now we will read the library blend files and replace the placeholders
+ * with actual datablocks. We loop over library mains multiple times in
+ * case a library needs to link additional datablocks from another library
+ * that had been read previously. */
+ while (do_it) {
+ do_it = false;
- /* Clear GHash and free all lib-ref placeholders IDs of that type now. */
- BLI_ghash_clear(loaded_ids, NULL, NULL);
- BLI_freelistN(&pending_free_ids);
+ /* Loop over mains of all library blend files encountered so far. Note
+ * this list gets longer as more indirectly library blends are found. */
+ for (Main *mainptr = mainl->next; mainptr; mainptr = mainptr->next) {
+ /* Does this library have any more linked datablocks we need to read? */
+ if (has_linked_ids_to_read(mainptr)) {
+ // printf("Reading linked datablocks from %s (%s)\n", mainptr->curlib->id.name, mainptr->curlib->name);
+
+ /* Open file if it has not been done yet. */
+ FileData *fd = read_library_file_data(basefd, mainlist, mainl, mainptr);
+
+ if (fd) {
+ do_it = true;
}
+
+ /* Read linked datablocks for each link placeholder, and replace
+ * the placeholder with the real datablock. */
+ read_library_linked_ids(basefd, fd, mainlist, mainptr);
+
+ /* Test if linked datablocks need to read further linked datablocks
+ * and create link placeholders for them. */
BLO_expand_main(fd, mainptr);
}
-
- mainptr = mainptr->next;
}
}
- BLI_ghash_free(loaded_ids, NULL, NULL);
- loaded_ids = NULL;
-
- /* do versions, link, and free */
Main *main_newid = BKE_main_new();
- for (mainptr = mainl->next; mainptr; mainptr = mainptr->next) {
- /* some mains still have to be read, then versionfile is still zero! */
+ for (Main *mainptr = mainl->next; mainptr; mainptr = mainptr->next) {
+ /* Do versioning for newly added linked datablocks. If no datablocks
+ * were read from a library versionfile will still be zero and we can
+ * skip it. */
if (mainptr->versionfile) {
- /* We need to split out IDs already existing, or they will go again through do_versions - bad, very bad! */
+ /* Split out already existing IDs to avoid them going through
+ * do_versions multiple times, which would have bad consequences. */
split_main_newid(mainptr, main_newid);
- if (mainptr->curlib->filedata) // can be zero... with shift+f1 append
+ /* File data can be zero with link/append. */
+ if (mainptr->curlib->filedata)
do_versions(mainptr->curlib->filedata, mainptr->curlib, main_newid);
else
do_versions(basefd, NULL, main_newid);
@@ -11002,11 +11548,16 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
add_main_to_main(mainptr, main_newid);
}
+ /* Lib linking. */
if (mainptr->curlib->filedata)
lib_link_all(mainptr->curlib->filedata, mainptr);
- if (mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata);
+ /* Free file data we no longer need. */
+ if (mainptr->curlib->filedata)
+ blo_filedata_free(mainptr->curlib->filedata);
mainptr->curlib->filedata = NULL;
}
BKE_main_free(main_newid);
}
+
+/** \} */
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index 10f0c7a2942..9e970b9ae5d 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* blenloader readfile private function prototypes
*/
-/** \file blender/blenloader/intern/readfile.h
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
#ifndef __READFILE_H__
@@ -38,52 +30,71 @@
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h" /* for ReportType */
-struct OldNewMap;
+struct Key;
struct MemFile;
-struct ReportList;
struct Object;
+struct OldNewMap;
struct PartEff;
+struct ReportList;
struct View3D;
-struct Key;
+
+enum eFileDataFlag {
+ FD_FLAGS_SWITCH_ENDIAN = 1 << 0,
+ FD_FLAGS_FILE_POINTSIZE_IS_4 = 1 << 1,
+ FD_FLAGS_POINTSIZE_DIFFERS = 1 << 2,
+ FD_FLAGS_FILE_OK = 1 << 3,
+ FD_FLAGS_NOT_MY_BUFFER = 1 << 4,
+ /* XXX Unused in practice (checked once but never set). */
+ FD_FLAGS_NOT_MY_LIBMAP = 1 << 5,
+};
+
+
+
+typedef int (FileDataReadFn)(struct FileData *filedata, void *buffer, unsigned int size);
+typedef off_t (FileDataSeekFn)(struct FileData *filedata, off_t offset, int whence);
typedef struct FileData {
- // linked list of BHeadN's
- ListBase listbase;
- int flags;
- int eof;
+ /** Linked list of BHeadN's. */
+ ListBase bhead_list;
+ enum eFileDataFlag flags;
+ bool is_eof;
int buffersize;
- int seek;
- int (*read)(struct FileData *filedata, void *buffer, unsigned int size);
+ off_t file_offset;
+
+ FileDataReadFn *read;
+ FileDataSeekFn *seek;
+
+ /** Regular file reading. */
+ int filedes;
- // variables needed for reading from memory / stream
+ /** Variables needed for reading from memory / stream. */
const char *buffer;
- // variables needed for reading from memfile (undo)
+ /** Variables needed for reading from memfile (undo). */
struct MemFile *memfile;
- // variables needed for reading from file
- int filedes;
+ /** Variables needed for reading from file. */
gzFile gzfiledes;
+ /** Gzip stream for memory decompression. */
+ z_stream strm;
- // now only in use for library appending
+ /** Now only in use for library appending. */
char relabase[FILE_MAX];
- // variables needed for reading from stream
- char headerdone;
- int inbuffer;
-
- // gzip stream for memory decompression
- z_stream strm;
- // general reading variables
+ /** General reading variables. */
struct SDNA *filesdna;
const struct SDNA *memsdna;
- const char *compflags; /* array of eSDNA_StructCompare */
+ /** Array of #eSDNA_StructCompare. */
+ const char *compflags;
int fileversion;
- int id_name_offs; /* used to retrieve ID names from (bhead+1) */
- int globalf, fileflags; /* for do_versions patching */
+ /** Used to retrieve ID names from (bhead+1). */
+ int id_name_offs;
+ /** For do_versions patching. */
+ int globalf, fileflags;
- eBLOReadSkip skip_flags; /* skip some data-blocks */
+ /** Optionally skip some data-blocks when they're not needed. */
+ eBLOReadSkip skip_flags;
struct OldNewMap *datamap;
struct OldNewMap *globmap;
@@ -97,34 +108,16 @@ typedef struct FileData {
struct BHeadSort *bheadmap;
int tot_bheadmap;
- /* see: USE_GHASH_BHEAD */
+ /** See: #USE_GHASH_BHEAD. */
struct GHash *bhead_idname_hash;
ListBase *mainlist;
- ListBase *old_mainlist; /* Used for undo. */
+ /** Used for undo. */
+ ListBase *old_mainlist;
- /* ick ick, used to return
- * data through streamglue.
- */
- BlendFileData **bfd_r;
struct ReportList *reports;
} FileData;
-typedef struct BHeadN {
- struct BHeadN *next, *prev;
- struct BHead bhead;
-} BHeadN;
-
-/* FileData->flags */
-enum {
- FD_FLAGS_SWITCH_ENDIAN = 1 << 0,
- FD_FLAGS_FILE_POINTSIZE_IS_4 = 1 << 1,
- FD_FLAGS_POINTSIZE_DIFFERS = 1 << 2,
- FD_FLAGS_FILE_OK = 1 << 3,
- FD_FLAGS_NOT_MY_BUFFER = 1 << 4,
- FD_FLAGS_NOT_MY_LIBMAP = 1 << 5, /* XXX Unused in practice (checked once but never set). */
-};
-
#define SIZEOFBLENDERHEADER 12
/***/
@@ -134,35 +127,37 @@ void blo_split_main(ListBase *mainlist, struct Main *main);
BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath);
-FileData *blo_openblenderfile(const char *filepath, struct ReportList *reports);
-FileData *blo_openblendermemory(const void *buffer, int buffersize, struct ReportList *reports);
-FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports);
-
-void blo_clear_proxy_pointers_from_lib(Main *oldmain);
-void blo_make_image_pointer_map(FileData *fd, Main *oldmain);
-void blo_end_image_pointer_map(FileData *fd, Main *oldmain);
-void blo_make_scene_pointer_map(FileData *fd, Main *oldmain);
-void blo_end_scene_pointer_map(FileData *fd, Main *oldmain);
-void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain);
-void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain);
-void blo_make_sound_pointer_map(FileData *fd, Main *oldmain);
-void blo_end_sound_pointer_map(FileData *fd, Main *oldmain);
-void blo_make_packed_pointer_map(FileData *fd, Main *oldmain);
-void blo_end_packed_pointer_map(FileData *fd, Main *oldmain);
+FileData *blo_filedata_from_file(const char *filepath, struct ReportList *reports);
+FileData *blo_filedata_from_memory(const void *buffer, int buffersize, struct ReportList *reports);
+FileData *blo_filedata_from_memfile(struct MemFile *memfile, struct ReportList *reports);
+
+void blo_clear_proxy_pointers_from_lib(struct Main *oldmain);
+void blo_make_image_pointer_map(FileData *fd, struct Main *oldmain);
+void blo_end_image_pointer_map(FileData *fd, struct Main *oldmain);
+void blo_make_scene_pointer_map(FileData *fd, struct Main *oldmain);
+void blo_end_scene_pointer_map(FileData *fd, struct Main *oldmain);
+void blo_make_movieclip_pointer_map(FileData *fd, struct Main *oldmain);
+void blo_end_movieclip_pointer_map(FileData *fd, struct Main *oldmain);
+void blo_make_sound_pointer_map(FileData *fd, struct Main *oldmain);
+void blo_end_sound_pointer_map(FileData *fd, struct Main *oldmain);
+void blo_make_packed_pointer_map(FileData *fd, struct Main *oldmain);
+void blo_end_packed_pointer_map(FileData *fd, struct Main *oldmain);
void blo_add_library_pointer_map(ListBase *old_mainlist, FileData *fd);
-void blo_freefiledata(FileData *fd);
+void blo_filedata_free(FileData *fd);
-BHead *blo_firstbhead(FileData *fd);
-BHead *blo_nextbhead(FileData *fd, BHead *thisblock);
-BHead *blo_prevbhead(FileData *fd, BHead *thisblock);
+BHead *blo_bhead_first(FileData *fd);
+BHead *blo_bhead_next(FileData *fd, BHead *thisblock);
+BHead *blo_bhead_prev(FileData *fd, BHead *thisblock);
-const char *bhead_id_name(const FileData *fd, const BHead *bhead);
+const char *blo_bhead_id_name(const FileData *fd, const BHead *bhead);
/* do versions stuff */
void blo_reportf_wrap(struct ReportList *reports, ReportType type, const char *format, ...) ATTR_PRINTF_FORMAT(3, 4);
+void blo_do_versions_dna(struct SDNA *sdna, const int versionfile, const int subversionfile);
+
void blo_do_versions_oldnewmap_insert(struct OldNewMap *onm, const void *oldaddr, void *newaddr, int nr);
void *blo_do_versions_newlibadr(struct FileData *fd, const void *lib, const void *adr);
void *blo_do_versions_newlibadr_us(struct FileData *fd, const void *lib, const void *adr);
diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c
index 8ee40da13c7..ef5d8963be7 100644
--- a/source/blender/blenloader/intern/undofile.c
+++ b/source/blender/blenloader/intern/undofile.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* 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 *****
* .blend file reading entry point
*/
-/** \file blender/blenloader/intern/undofile.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
#include <stdlib.h>
@@ -53,7 +45,6 @@
#include "BLO_undofile.h"
#include "BLO_readfile.h"
-#include "BKE_library.h"
#include "BKE_main.h"
/* keep last */
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index 4f2417c21d2..d8bd0e8d5b9 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenloader/intern/versioning_250.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
#ifndef WIN32
@@ -46,7 +39,7 @@
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -144,7 +137,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
if (sl) {
/* first channels for ipo action nla... */
switch (sl->spacetype) {
- case SPACE_IPO:
+ case SPACE_GRAPH:
ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
BLI_addtail(lb, ar);
ar->regiontype = RGN_TYPE_CHANNELS;
@@ -242,7 +235,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->alignment = RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
#if 0
- case SPACE_BUTS:
+ case SPACE_PROPERTIES:
/* context UI region */
ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
BLI_addtail(lb, ar);
@@ -272,7 +265,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
case SPACE_OUTLINER:
{
- SpaceOops *soops = (SpaceOops *)sl;
+ SpaceOutliner *soops = (SpaceOutliner *)sl;
memcpy(&ar->v2d, &soops->v2d, sizeof(View2D));
@@ -285,9 +278,9 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
//ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ SpaceGraph *sipo = (SpaceGraph *)sl;
memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D));
/* init mainarea view2d */
@@ -371,9 +364,9 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
break;
}
- case SPACE_BUTS:
+ case SPACE_PROPERTIES:
{
- SpaceButs *sbuts = (SpaceButs *)sl;
+ SpaceProperties *sbuts = (SpaceProperties *)sl;
memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D));
ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
@@ -448,8 +441,8 @@ static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name)
id->flag = LIB_FAKEUSER;
*( (short *)id->name) = ID_GD;
- new_id(lb, id, name);
- /* alphabetic insertion: is in new_id */
+ BKE_id_new_name_validate(lb, id, name);
+ /* alphabetic insertion: is in BKE_id_new_name_validate */
if (G.debug & G_DEBUG)
printf("Converted GPencil to ID: %s\n", id->name + 2);
@@ -466,21 +459,21 @@ static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
if (v3d->gpd) {
- versions_gpencil_add_main(&main->gpencil, (ID *)v3d->gpd, "GPencil View3D");
+ versions_gpencil_add_main(&main->gpencils, (ID *)v3d->gpd, "GPencil View3D");
v3d->gpd = NULL;
}
}
else if (sl->spacetype == SPACE_NODE) {
SpaceNode *snode = (SpaceNode *)sl;
if (snode->gpd) {
- versions_gpencil_add_main(&main->gpencil, (ID *)snode->gpd, "GPencil Node");
+ versions_gpencil_add_main(&main->gpencils, (ID *)snode->gpd, "GPencil Node");
snode->gpd = NULL;
}
}
else if (sl->spacetype == SPACE_SEQ) {
SpaceSeq *sseq = (SpaceSeq *)sl;
if (sseq->gpd) {
- versions_gpencil_add_main(&main->gpencil, (ID *)sseq->gpd, "GPencil Node");
+ versions_gpencil_add_main(&main->gpencils, (ID *)sseq->gpd, "GPencil Node");
sseq->gpd = NULL;
}
}
@@ -505,7 +498,7 @@ static void do_version_mdef_250(Main *main)
ModifierData *md;
MeshDeformModifierData *mmd;
- for (ob = main->object.first; ob; ob = ob->id.next) {
+ for (ob = main->objects.first; ob; ob = ob->id.next) {
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_MeshDeform) {
mmd = (MeshDeformModifierData *)md;
@@ -648,14 +641,14 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bSound *sound;
Sequence *seq;
- for (sound = bmain->sound.first; sound; sound = sound->id.next) {
+ for (sound = bmain->sounds.first; sound; sound = sound->id.next) {
if (sound->newpackedfile) {
sound->packedfile = sound->newpackedfile;
sound->newpackedfile = NULL;
}
}
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->ed && scene->ed->seqbasep) {
SEQ_BEGIN(scene->ed, seq)
{
@@ -679,7 +672,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
do_versions_windowmanager_2_50(screen);
do_versions_gpencil_2_50(bmain, screen);
}
@@ -687,13 +680,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* 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 = bmain->mat.first; ma; ma = ma->id.next) {
+ for (ma = bmain->materials.first; ma; ma = ma->id.next) {
if (ma->nodetree && ma->nodetree->id.name[0] == '\0')
strcpy(ma->nodetree->id.name, "NTShader Nodetree");
}
/* and composite trees */
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
enum { R_PANORAMA = (1 << 10) };
if (sce->nodetree && sce->nodetree->id.name[0] == '\0')
strcpy(sce->nodetree->id.name, "NTCompositing Nodetree");
@@ -714,7 +707,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* and texture trees */
- for (tx = bmain->tex.first; tx; tx = tx->id.next) {
+ for (tx = bmain->textures.first; tx; tx = tx->id.next) {
bNode *node;
if (tx->nodetree) {
@@ -729,7 +722,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* particle draw and render types */
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
if (part->draw_as) {
if (part->draw_as == PART_DRAW_DOT) {
part->ren_as = PART_DRAW_HALO;
@@ -748,7 +741,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* set old pointcaches to have disk cache flag */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
//BKE_ptcache_ids_from_object(&pidlist, ob);
@@ -759,7 +752,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* type was a mixed flag & enum. move the 2d flag elsewhere */
- for (cu = bmain->curve.first; cu; cu = cu->id.next) {
+ for (cu = bmain->curves.first; cu; cu = cu->id.next) {
Nurb *nu;
for (nu = cu->nurb.first; nu; nu = nu->next) {
@@ -777,7 +770,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
//PTCacheID *pid;
//ListBase pidlist;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
//BKE_ptcache_ids_from_object(&pidlist, ob);
//for (pid = pidlist.first; pid; pid = pid->next) {
@@ -811,12 +804,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* texture filter */
- for (tex = bmain->tex.first; tex; tex = tex->id.next) {
+ for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->afmax == 0)
tex->afmax = 8;
}
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
ts = sce->toolsettings;
if (!ts->uv_selectmode || ts->vgroup_weight == 0.0f) {
ts->selectmode = SCE_SELECT_VERTEX;
@@ -837,7 +830,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 2)) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->flag & 8192) // OB_POSEMODE = 8192
ob->mode |= OB_MODE_POSE;
}
@@ -849,11 +842,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ParticleSettings *part;
bool do_gravity = false;
- for (sce = bmain->scene.first; sce; sce = sce->id.next)
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next)
if (sce->unit.scale_length == 0.0f)
sce->unit.scale_length = 1.0f;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
/* fluid-sim stuff */
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
if (fluidmd)
@@ -863,7 +856,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ob->rotmode = ROT_MODE_EUL;
}
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->audio.main == 0.0f)
sce->audio.main = 1.0f;
@@ -875,7 +868,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* Add default gravity to scenes */
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if ((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0 &&
is_zero_v3(sce->physics_settings.gravity))
{
@@ -888,11 +881,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */
if (do_gravity) {
- for (part = bmain->particle.first; part; part = part->id.next)
+ for (part = bmain->particles.first; part; part = part->id.next)
part->effector_weights->global_gravity = part->acc[2] / -9.81f;
}
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
if (do_gravity) {
@@ -925,7 +918,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Object *ob;
/* New variables for axis-angle rotations and/or quaternion rotations were added, and need proper initialization */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
/* new variables for all objects */
ob->quat[0] = 1.0f;
ob->rotAxis[1] = 1.0f;
@@ -954,7 +947,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* shape keys are no longer applied to the mesh itself, but rather
* to the derivedmesh/displist, so here we ensure that the basis
* shape key is always set in the mesh coordinates. */
- for (me = bmain->mesh.first; me; me = me->id.next) {
+ for (me = bmain->meshes.first; me; me = me->id.next) {
if ((key = blo_do_versions_newlibadr(fd, lib, me->key)) && key->refkey) {
data = key->refkey->data;
tot = MIN2(me->totvert, key->refkey->totelem);
@@ -964,7 +957,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (lt = bmain->latt.first; lt; lt = lt->id.next) {
+ for (lt = bmain->lattices.first; lt; lt = lt->id.next) {
if ((key = blo_do_versions_newlibadr(fd, lib, lt->key)) && key->refkey) {
data = key->refkey->data;
tot = MIN2(lt->pntsu * lt->pntsv * lt->pntsw, key->refkey->totelem);
@@ -974,7 +967,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (cu = bmain->curve.first; cu; cu = cu->id.next) {
+ for (cu = bmain->curves.first; cu; cu = cu->id.next) {
if ((key = blo_do_versions_newlibadr(fd, lib, cu->key)) && key->refkey) {
data = key->refkey->data;
@@ -986,7 +979,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
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++;
+ bezt->tilt = *data; data++;
}
}
else if (nu->bp) {
@@ -994,7 +987,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
copy_v3_v3(bp->vec, data); data += 3;
- bp->alfa = *data; data++;
+ bp->tilt = *data; data++;
}
}
}
@@ -1004,7 +997,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) {
{
- Scene *sce = bmain->scene.first;
+ Scene *sce = bmain->scenes.first;
while (sce) {
if (sce->r.frame_step == 0)
sce->r.frame_step = 1;
@@ -1015,7 +1008,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
{
/* ensure all nodes have unique names */
- bNodeTree *ntree = bmain->nodetree.first;
+ bNodeTree *ntree = bmain->nodetrees.first;
while (ntree) {
bNode *node = ntree->nodes.first;
@@ -1029,7 +1022,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
{
- Object *ob = bmain->object.first;
+ Object *ob = bmain->objects.first;
while (ob) {
/* shaded mode disabled for now */
if (ob->dt == OB_MATERIAL)
@@ -1043,7 +1036,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ScrArea *sa;
SpaceLink *sl;
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.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) {
@@ -1058,9 +1051,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* only convert old 2.50 files with color management */
if (bmain->versionfile == 250) {
- Scene *sce = bmain->scene.first;
- Material *ma = bmain->mat.first;
- Tex *tex = bmain->tex.first;
+ Scene *sce = bmain->scenes.first;
+ Material *ma = bmain->materials.first;
+ Tex *tex = bmain->textures.first;
int i, convert = 0;
/* convert to new color management system:
@@ -1101,15 +1094,15 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Mesh *me;
Object *ob;
- for (sce = bmain->scene.first; sce; sce = sce->id.next)
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next)
if (!sce->toolsettings->particle.selectmode)
sce->toolsettings->particle.selectmode = SCE_SELECT_PATH;
if (bmain->versionfile == 250 && bmain->subversionfile > 1) {
- for (me = bmain->mesh.first; me; me = me->id.next)
+ for (me = bmain->meshes.first; me; me = me->id.next)
multires_load_old_250(me);
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType(ob, eModifierType_Multires);
if (mmd) {
@@ -1126,7 +1119,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Object *ob;
/* properly initialize hair clothsim data on old files */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Cloth) {
@@ -1146,7 +1139,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
SpaceLink *sl;
/* remove all preview window in wrong spaces */
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.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) {
@@ -1183,7 +1176,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ScrArea *sa;
SpaceLink *sl;
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.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) {
@@ -1224,7 +1217,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Brush *brush;
/* anim viz changes */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
/* initialize object defaults */
animviz_settings_init(&ob->avs);
@@ -1236,41 +1229,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (arm) { /* XXX - why does this fail in some cases? */
bAnimVizSettings *avs = &ob->pose->avs;
- /* ghosting settings ---------------- */
- /* ranges */
- avs->ghost_bc = avs->ghost_ac = arm->ghostep;
-
- avs->ghost_sf = arm->ghostsf;
- avs->ghost_ef = arm->ghostef;
- if ((avs->ghost_sf == avs->ghost_ef) && (avs->ghost_sf == 0)) {
- avs->ghost_sf = 1;
- avs->ghost_ef = 100;
- }
-
- /* type */
- if (arm->ghostep == 0)
- avs->ghost_type = GHOST_TYPE_NONE;
- else
- avs->ghost_type = arm->ghosttype + 1;
-
- /* stepsize */
- avs->ghost_step = arm->ghostsize;
- if (avs->ghost_step == 0)
- avs->ghost_step = 1;
-
/* path settings --------------------- */
/* ranges */
- avs->path_bc = arm->pathbc;
- avs->path_ac = arm->pathac;
- if ((avs->path_bc == avs->path_ac) && (avs->path_bc == 0))
- avs->path_bc = avs->path_ac = 10;
-
- avs->path_sf = arm->pathsf;
- avs->path_ef = arm->pathef;
- if ((avs->path_sf == avs->path_ef) && (avs->path_sf == 0)) {
- avs->path_sf = 1;
- avs->path_ef = 250;
- }
+ avs->path_bc = 10;
+ avs->path_ac = 10;
+
+ avs->path_sf = 1;
+ avs->path_ef = 250;
/* flags */
if (arm->pathflag & ARM_PATH_FNUMS)
@@ -1289,9 +1254,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
avs->path_type = MOTIONPATH_TYPE_ACFRA;
/* stepsize */
- avs->path_step = arm->pathsize;
- if (avs->path_step == 0)
- avs->path_step = 1;
+ avs->path_step = 1;
}
else
animviz_settings_init(&ob->pose->avs);
@@ -1299,7 +1262,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* brush texture changes */
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
BKE_texture_mtex_default(&brush->mtex);
BKE_texture_mtex_default(&brush->mask_mtex);
}
@@ -1311,7 +1274,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Object *ob;
/* convert degrees to radians for internal use */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
bPoseChannel *pchan;
do_version_constraints_radians_degrees_250(&ob->constraints);
@@ -1337,7 +1300,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ScrArea *sa;
SpaceLink *sl;
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
for (sa = screen->areabase.first; sa; sa = sa->next) {
for (sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *regionbase;
@@ -1366,7 +1329,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Sequence *seq;
/* initialize to sane default so toggling on border shows something */
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.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)
{
@@ -1386,7 +1349,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* particle brush strength factor was changed from int to float */
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
ParticleEditSettings *pset = &sce->toolsettings->particle;
int a;
@@ -1400,7 +1363,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ScrArea *sa;
SpaceLink *sl;
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.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) {
@@ -1432,18 +1395,18 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 251) { /* 2.5.1 had no subversions */
bScreen *sc;
- /* Blender 2.5.2 - subversion 0 introduced a new setting: V3D_RENDER_OVERRIDE.
+ /* Blender 2.5.2 - subversion 0 introduced a new setting: V3D_HIDE_OVERLAYS.
* 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 = bmain->screen.first; sc; sc = sc->id.next) {
+ * Here we clear it for old files so they don't come in with V3D_HIDE_OVERLAYS set,
+ * which would cause cameras, lights, etc to become invisible */
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
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) {
View3D *v3d = (View3D *)sl;
- v3d->flag2 &= ~V3D_RENDER_OVERRIDE;
+ v3d->flag2 &= ~V3D_HIDE_OVERLAYS;
}
}
}
@@ -1456,13 +1419,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Scene *scene;
bNodeTree *ntree;
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->curve)
brush->curve->preset = CURVE_PRESET_SMOOTH;
}
/* properly initialize active flag for fluidsim modifiers */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Fluidsim) {
@@ -1474,7 +1437,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* adjustment to color balance node values */
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->nodetree) {
bNode *node = scene->nodetree->nodes.first;
@@ -1490,7 +1453,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
}
/* check inside node groups too */
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) {
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
bNode *node = ntree->nodes.first;
while (node) {
@@ -1510,7 +1473,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 2)) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next)
+ for (ob = bmain->objects.first; ob; ob = ob->id.next)
blo_do_version_old_trackto_to_constraints(ob);
}
@@ -1518,7 +1481,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bScreen *sc;
/* Image editor scopes */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
@@ -1541,7 +1504,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Tex *tex;
Brush *brush;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1578,10 +1541,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
do_version_mdef_250(bmain);
/* parent type to modifier */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->parent) {
Object *parent = (Object *)blo_do_versions_newlibadr(fd, lib, ob->parent);
if (parent) { /* parent may not be in group */
+ enum { PARCURVE = 1 };
if (parent->type == OB_ARMATURE && ob->partype == PARSKEL) {
ArmatureModifierData *amd;
bArmature *arm = (bArmature *)blo_do_versions_newlibadr(fd, lib, parent->data);
@@ -1613,7 +1577,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* initialize scene active layer */
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
int i;
for (i = 0; i < 20; i++) {
if (scene->lay & (1 << i)) {
@@ -1623,7 +1587,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (tex = bmain->tex.first; tex; tex = tex->id.next) {
+ for (tex = bmain->textures.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)
@@ -1632,12 +1596,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
{
Curve *cu;
- for (cu = bmain->curve.first; cu; cu = cu->id.next) {
+ for (cu = bmain->curves.first; cu; cu = cu->id.next) {
cu->smallcaps_scale = 0.75f;
}
}
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene) {
Sequence *seq;
SEQ_BEGIN(scene->ed, seq)
@@ -1651,7 +1615,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* GSOC 2010 Sculpt - New settings for Brush */
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
/* Sanity Check */
/* infinite number of dabs */
@@ -1727,7 +1691,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* GSOC Sculpt 2010 - Sanity check on Sculpt/Paint settings */
if (bmain->versionfile < 253) {
Scene *sce;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->toolsettings->sculpt_paint_unified_alpha == 0)
sce->toolsettings->sculpt_paint_unified_alpha = 0.5f;
@@ -1742,7 +1706,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 253 || (bmain->versionfile == 253 && bmain->subversionfile < 1)) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
@@ -1762,7 +1726,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* for now just add it to all flow objects in the scene */
{
Object *ob2;
- for (ob2 = bmain->object.first; ob2; ob2 = ob2->id.next) {
+ for (ob2 = bmain->objects.first; ob2; ob2 = ob2->id.next) {
ModifierData *md2;
for (md2 = ob2->modifiers.first; md2; md2 = md2->next) {
if (md2->type == eModifierType_Smoke) {
@@ -1790,12 +1754,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ParticleSettings *part;
bScreen *sc;
- for (br = bmain->brush.first; br; br = br->id.next) {
+ for (br = bmain->brushes.first; br; br = br->id.next) {
if (br->ob_mode == 0)
br->ob_mode = OB_MODE_ALL_PAINT;
}
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
if (part->boids)
part->boids->pitch = 1.0f;
@@ -1803,7 +1767,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
part->kink_amp_clump = 1.f; /* keep old files looking similar */
}
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1834,7 +1798,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Object *ob;
/* ocean res is now squared, reset old ones - will be massive */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Ocean) {
@@ -1852,7 +1816,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Key *key;
/* Fix for sample line scope initializing with no height */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
sa = sc->areabase.first;
while (sa) {
SpaceLink *sl;
@@ -1871,7 +1835,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
* 2.4x would never reveal this to users as a dummy value always ended up getting used
* instead
*/
- for (key = bmain->key.first; key; key = key->id.next) {
+ for (key = bmain->shapekeys.first; key; key = key->id.next) {
KeyBlock *kb;
for (kb = key->block.first; kb; kb = kb->next) {
@@ -1887,13 +1851,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Bone *bone;
Object *ob;
- for (arm = bmain->armature.first; arm; arm = arm->id.next)
+ for (arm = bmain->armatures.first; arm; arm = arm->id.next)
for (bone = arm->bonebase.first; bone; bone = bone->next)
do_version_bone_roll_256(bone);
/* fix for objects which have zero dquat's
* since this is multiplied with the quat rather than added */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (is_zero_v4(ob->dquat)) {
unit_qt(ob->dquat);
}
@@ -1912,7 +1876,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* node sockets are not exposed automatically any more,
* this mimics the old behavior by adding all unlinked sockets to groups.
*/
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) {
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
/* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */
/* first make sure the own_index for new sockets is valid */
@@ -1988,7 +1952,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ParticleSettings *part;
/* redraws flag in SpaceTime has been moved to Screen level */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
if (sc->redraws_flag == 0) {
/* just initialize to default? */
/* XXX: we could also have iterated through areas, and taken them from the first timeline available... */
@@ -1996,13 +1960,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->height == 0)
brush->height = 0.4f;
}
/* replace 'rim material' option for in offset*/
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Solidify) {
@@ -2016,7 +1980,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
/* particle draw color from material */
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
if (part->draw & PART_DRAW_MAT_COL)
part->draw_col = PART_DRAW_COL_MAT;
}
@@ -2025,7 +1989,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 6)) {
Mesh *me;
- for (me = bmain->mesh.first; me; me = me->id.next)
+ for (me = bmain->meshes.first; me; me = me->id.next)
BKE_mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL);
}
@@ -2033,7 +1997,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* update blur area sizes from 0..1 range to 0..100 percentage */
Scene *scene;
bNode *node;
- for (scene = bmain->scene.first; scene; scene = scene->id.next)
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next)
if (scene->nodetree)
for (node = scene->nodetree->nodes.first; node; node = node->next)
if (node->type == CMP_NODE_BLUR) {
@@ -2049,7 +2013,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
* need to make less ugly - possibly an iterator? */
bScreen *screen;
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
ScrArea *sa;
/* add regions */
for (sa = screen->areabase.first; sa; sa = sa->next) {
@@ -2080,7 +2044,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
{
ParticleSettings *part;
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
/* Initialize particle billboard scale */
part->bb_size[0] = part->bb_size[1] = 1.0f;
}
@@ -2092,7 +2056,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Scene *scene;
Sequence *seq;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->r.ffcodecdata.audio_channels = 2;
scene->audio.volume = 1.0f;
SEQ_BEGIN(scene->ed, seq)
@@ -2104,7 +2068,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
{
bScreen *screen;
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
ScrArea *sa;
/* add regions */
@@ -2145,7 +2109,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bAction *act;
FCurve *fcu;
- for (act = bmain->action.first; act; act = act->id.next) {
+ for (act = bmain->actions.first; act; act = act->id.next) {
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
BezTriple *bezt;
uint i = 0;
@@ -2200,7 +2164,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
*/
bNodeTree *ntree;
/* all node trees in bmain->nodetree are considered groups */
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next)
ntree->nodetype = NODE_GROUP;
}
}
@@ -2209,7 +2173,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
{
/* Adaptive time step for particle systems */
ParticleSettings *part;
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
part->courant_target = 0.2f;
part->time_flag &= ~PART_TIME_AUTOSF;
}
diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c
index 65133954359..31be2244d17 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenloader/intern/versioning_260.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
#include "BLI_utildefines.h"
@@ -616,7 +609,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *sce;
bNodeTree *ntree;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.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)
@@ -626,7 +619,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
do_versions_nodetree_image_default_alpha_output(sce->nodetree);
}
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next)
do_versions_nodetree_image_default_alpha_output(ntree);
}
@@ -634,7 +627,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* support old particle dupliobject rotation settings */
ParticleSettings *part;
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
part->draw |= PART_DRAW_ROTATE_OB;
@@ -648,13 +641,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 1)) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ob->collision_boundtype = ob->boundtype;
}
{
Camera *cam;
- for (cam = bmain->camera.first; cam; cam = cam->id.next) {
+ for (cam = bmain->cameras.first; cam; cam = cam->id.next) {
if (cam->sensor_x < 0.01f)
cam->sensor_x = DEFAULT_SENSOR_WIDTH;
@@ -689,17 +682,17 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Material *mat;
bNodeTree *ntree;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree)
do_versions_nodetree_convert_angle(sce->nodetree);
}
- for (mat = bmain->mat.first; mat; mat = mat->id.next) {
+ for (mat = bmain->materials.first; mat; mat = mat->id.next) {
if (mat->nodetree)
do_versions_nodetree_convert_angle(mat->nodetree);
}
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next)
do_versions_nodetree_convert_angle(ntree);
}
@@ -708,7 +701,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
bScreen *sc;
MovieClip *clip;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -732,7 +725,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
MovieTrackingTrack *track;
if (clip->aspx < 1.0f) {
@@ -768,11 +761,11 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *sce;
MovieClip *clip;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
do_versions_image_settings_2_60(sce);
}
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
MovieTrackingSettings *settings = &clip->tracking.settings;
if (settings->default_pattern_size == 0.0f) {
@@ -785,18 +778,18 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
/* convert delta addition into delta scale */
int i;
for (i = 0; i < 3; i++) {
if ( (ob->dsize[i] == 0.0f) || /* simple case, user never touched dsize */
- (ob->size[i] == 0.0f)) /* cant scale the dsize to give a non zero result,
+ (ob->scale[i] == 0.0f)) /* cant scale the dsize to give a non zero result,
* so fallback to 1.0f */
{
ob->dscale[i] = 1.0f;
}
else {
- ob->dscale[i] = (ob->size[i] + ob->dsize[i]) / ob->size[i];
+ ob->dscale[i] = (ob->scale[i] + ob->dsize[i]) / ob->scale[i];
}
}
}
@@ -807,7 +800,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
* at some point this could be removed. */
else if (bmain->versionfile == 260 && bmain->subversionfile == 6) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (is_zero_v3(ob->dscale)) {
copy_vn_fl(ob->dscale, 3, 1.0f);
}
@@ -817,7 +810,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 8)) {
Brush *brush;
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->sculpt_tool == SCULPT_TOOL_ROTATE)
brush->alpha = 1.0f;
}
@@ -829,36 +822,35 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *sce;
Material *mat;
Tex *tex;
- Lamp *lamp;
World *world;
bNodeTree *ntree;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree)
do_versions_nodetree_socket_use_flags_2_62(sce->nodetree);
}
- for (mat = bmain->mat.first; mat; mat = mat->id.next) {
+ for (mat = bmain->materials.first; mat; mat = mat->id.next) {
if (mat->nodetree)
do_versions_nodetree_socket_use_flags_2_62(mat->nodetree);
}
- for (tex = bmain->tex.first; tex; tex = tex->id.next) {
+ for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->nodetree)
do_versions_nodetree_socket_use_flags_2_62(tex->nodetree);
}
- for (lamp = bmain->lamp.first; lamp; lamp = lamp->id.next) {
- if (lamp->nodetree)
- do_versions_nodetree_socket_use_flags_2_62(lamp->nodetree);
+ for (Light *la = bmain->lights.first; la; la = la->id.next) {
+ if (la->nodetree)
+ do_versions_nodetree_socket_use_flags_2_62(la->nodetree);
}
- for (world = bmain->world.first; world; world = world->id.next) {
+ for (world = bmain->worlds.first; world; world = world->id.next) {
if (world->nodetree)
do_versions_nodetree_socket_use_flags_2_62(world->nodetree);
}
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) {
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
do_versions_nodetree_socket_use_flags_2_62(ntree);
}
}
@@ -866,7 +858,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
MovieClip *clip;
Object *ob;
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
MovieTracking *tracking = &clip->tracking;
MovieTrackingObject *tracking_object = tracking->objects.first;
@@ -886,7 +878,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
bConstraint *con;
for (con = ob->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
@@ -905,7 +897,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* convert deprecated sculpt_paint_unified_* fields to
* UnifiedPaintSettings */
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
UnifiedPaintSettings *ups = &ts->unified_paint_settings;
ups->size = ts->sculpt_paint_unified_size;
@@ -920,7 +912,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
/* convert extended ascii to utf-8 for text editor */
Text *text;
- for (text = bmain->text.first; text; text = text->id.next) {
+ for (text = bmain->texts.first; text; text = text->id.next) {
if (!(text->flags & TXT_ISEXT)) {
TextLine *tl;
@@ -938,7 +930,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
/* set new dynamic paint values */
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_DynamicPaint) {
@@ -960,7 +952,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 262) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
@@ -978,7 +970,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
* try to correct it, if rate is 0.0 that's likely not intentional */
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Fluidsim) {
@@ -995,13 +987,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *sce;
bNodeTree *ntree;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree)
do_versions_nodetree_multi_file_output_format_2_62_1(sce, sce->nodetree);
}
/* XXX can't associate with scene for group nodes, image format will stay uninitialized */
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next)
do_versions_nodetree_multi_file_output_format_2_62_1(NULL, ntree);
}
@@ -1009,7 +1001,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile == 262 && bmain->subversionfile == 1) {
{
Mesh *me;
- for (me = bmain->mesh.first; me; me = me->id.next) {
+ for (me = bmain->meshes.first; me; me = me->id.next) {
do_versions_mesh_mloopcol_swap_2_62_1(me);
}
}
@@ -1018,7 +1010,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 2)) {
/* Set new idname of keyingsets from their now "label-only" name. */
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
KeyingSet *ks;
for (ks = scene->keyingsets.first; ks; ks = ks->next) {
if (!ks->idname[0])
@@ -1031,7 +1023,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Object *ob;
ModifierData *md;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Lattice) {
LatticeModifierData *lmd = (LatticeModifierData *)md;
@@ -1045,7 +1037,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Read Viscosity presets from older files */
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Fluidsim) {
@@ -1068,7 +1060,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 263) {
/* Default for old files is to save particle rotations to pointcache */
ParticleSettings *part;
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
part->flag |= PART_ROTATIONS;
}
}
@@ -1078,10 +1070,10 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *sce;
bNodeTree *ntree;
- for (sce = bmain->scene.first; sce; sce = sce->id.next)
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next)
if (sce->nodetree)
do_versions_nodetree_multi_file_output_path_2_63_1(sce->nodetree);
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next)
do_versions_nodetree_multi_file_output_path_2_63_1(ntree);
}
@@ -1093,7 +1085,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
* unified paint settings also have weight. Update unified
* paint settings and brushes with a default weight value. */
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
if (ts) {
ts->unified_paint_settings.weight = ts->vgroup_weight;
@@ -1101,7 +1093,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
brush->weight = 0.5;
}
}
@@ -1109,7 +1101,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 2)) {
bScreen *sc;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1145,14 +1137,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Camera *cam;
Curve *cu;
- for (cam = bmain->camera.first; cam; cam = cam->id.next) {
+ for (cam = bmain->cameras.first; cam; cam = cam->id.next) {
if (cam->flag & CAM_PANORAMA) {
cam->type = CAM_PANO;
cam->flag &= ~CAM_PANORAMA;
}
}
- for (cu = bmain->curve.first; cu; cu = cu->id.next) {
+ for (cu = bmain->curves.first; cu; cu = cu->id.next) {
if (cu->bevfac2 == 0.0f) {
cu->bevfac1 = 0.0f;
cu->bevfac2 = 1.0f;
@@ -1166,13 +1158,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *sce;
bNodeTree *ntree;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) {
do_versions_nodetree_file_output_layers_2_64_5(sce->nodetree);
do_versions_nodetree_image_layer_2_64_5(sce->nodetree);
}
}
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) {
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
do_versions_nodetree_file_output_layers_2_64_5(ntree);
do_versions_nodetree_image_layer_2_64_5(ntree);
}
@@ -1184,38 +1176,37 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *sce;
Material *mat;
Tex *tex;
- Lamp *lamp;
World *world;
bNodeTree *ntree;
- for (sce = bmain->scene.first; sce; sce = sce->id.next)
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next)
if (sce->nodetree)
do_versions_nodetree_frame_2_64_6(sce->nodetree);
- for (mat = bmain->mat.first; mat; mat = mat->id.next)
+ for (mat = bmain->materials.first; mat; mat = mat->id.next)
if (mat->nodetree)
do_versions_nodetree_frame_2_64_6(mat->nodetree);
- for (tex = bmain->tex.first; tex; tex = tex->id.next)
+ for (tex = bmain->textures.first; tex; tex = tex->id.next)
if (tex->nodetree)
do_versions_nodetree_frame_2_64_6(tex->nodetree);
- for (lamp = bmain->lamp.first; lamp; lamp = lamp->id.next)
- if (lamp->nodetree)
- do_versions_nodetree_frame_2_64_6(lamp->nodetree);
+ for (Light *la = bmain->lights.first; la; la = la->id.next)
+ if (la->nodetree)
+ do_versions_nodetree_frame_2_64_6(la->nodetree);
- for (world = bmain->world.first; world; world = world->id.next)
+ for (world = bmain->worlds.first; world; world = world->id.next)
if (world->nodetree)
do_versions_nodetree_frame_2_64_6(world->nodetree);
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next)
do_versions_nodetree_frame_2_64_6(ntree);
}
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 7)) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Smoke) {
@@ -1251,7 +1242,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
Scene *scene;
// composite redesign
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->nodetree) {
if (scene->nodetree->chunksize == 0) {
scene->nodetree->chunksize = 256;
@@ -1277,7 +1268,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
bScreen *sc;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
@@ -1299,7 +1290,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
MovieClip *clip;
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
clip->start_frame = 1;
}
}
@@ -1308,7 +1299,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 11)) {
MovieClip *clip;
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
MovieTrackingTrack *track;
track = clip->tracking.tracks.first;
@@ -1356,7 +1347,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
} FOREACH_NODETREE_END;
/* keep compatibility for dupliobject particle size */
- for (part = bmain->particle.first; part; part = part->id.next)
+ for (part = bmain->particles.first; part; part = part->id.next)
if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR))
if ((part->draw & PART_DRAW_ROTATE_OB) == 0)
part->draw |= PART_DRAW_NO_SCALE_OB;
@@ -1385,7 +1376,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 18)) {
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->ed) {
Sequence *seq;
@@ -1426,7 +1417,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* make scenes which are not using color management have got None as display device,
* so they wouldn't perform linear-to-sRGB conversion on display
*/
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if ((scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) == 0) {
ColorManagedDisplaySettings *display_settings = &scene->display_settings;
@@ -1439,7 +1430,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
if (ima->source == IMA_SRC_VIEWER) {
ima->flag |= IMA_VIEW_AS_RENDER;
}
@@ -1460,7 +1451,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 20)) {
Key *key;
- for (key = bmain->key.first; key; key = key->id.next) {
+ for (key = bmain->shapekeys.first; key; key = key->id.next) {
blo_do_versions_key_uidgen(key);
}
}
@@ -1468,7 +1459,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 21)) {
{
Mesh *me;
- for (me = bmain->mesh.first; me; me = me->id.next) {
+ for (me = bmain->meshes.first; me; me = me->id.next) {
CustomData_update_typemap(&me->vdata);
CustomData_free_layers(&me->vdata, CD_MSTICKY, me->totvert);
}
@@ -1482,7 +1473,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 264) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->pose) {
if (ob->pose->avs.path_step == 0) {
animviz_settings_init(&ob->pose->avs);
@@ -1505,7 +1496,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 264 || (bmain->versionfile == 264 && bmain->subversionfile < 2)) {
MovieClip *clip;
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
MovieTracking *tracking = &clip->tracking;
MovieTrackingObject *tracking_object;
@@ -1526,7 +1517,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Smoke) {
@@ -1565,7 +1556,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
bScreen *sc;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1589,7 +1580,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* set a unwrapping margin and ABF by default */
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->toolsettings->uvcalc_margin == 0.0f) {
scene->toolsettings->uvcalc_margin = 0.001f;
scene->toolsettings->unwrapper = 0;
@@ -1621,7 +1612,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->r.tilex == 0 || scene->r.tiley == 1) {
scene->r.tilex = scene->r.tiley = 64;
}
@@ -1631,7 +1622,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* collision masks */
{
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->col_group == 0) {
ob->col_group = 0x01;
ob->col_mask = 0xff;
@@ -1643,7 +1634,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 264 || (bmain->versionfile == 264 && bmain->subversionfile < 7)) {
MovieClip *clip;
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
MovieTrackingTrack *track;
MovieTrackingObject *object;
@@ -1661,7 +1652,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 265 || (bmain->versionfile == 265 && bmain->subversionfile < 3)) {
bScreen *sc;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1707,7 +1698,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *scene;
Tex *tex;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq)
@@ -1725,7 +1716,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
scene->r.bake_samples = 256;
}
- for (Image *image = bmain->image.first; image; image = image->id.next) {
+ for (Image *image = bmain->images.first; image; image = image->id.next) {
if (image->flag & IMA_DO_PREMUL) {
image->alpha_mode = IMA_ALPHA_STRAIGHT;
}
@@ -1734,7 +1725,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (tex = bmain->tex.first; tex; tex = tex->id.next) {
+ for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->type == TEX_IMAGE && (tex->imaflag & TEX_USEALPHA) == 0) {
Image *image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima);
@@ -1764,7 +1755,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
* for compatibility all textures assumed it to be enabled */
Tex *tex;
- for (tex = bmain->tex.first; tex; tex = tex->id.next)
+ for (tex = bmain->textures.first; tex; tex = tex->id.next)
if (tex->type == TEX_IMAGE)
tex->imaflag |= TEX_USEALPHA;
}
@@ -1772,7 +1763,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (bmain->versionfile < 265 || (bmain->versionfile == 265 && bmain->subversionfile < 7)) {
Curve *cu;
- for (cu = bmain->curve.first; cu; cu = cu->id.next) {
+ for (cu = bmain->curves.first; cu; cu = cu->id.next) {
if (cu->flag & (CU_FRONT | CU_BACK)) {
if (cu->ext1 != 0.0f || cu->ext2 != 0.0f) {
Nurb *nu;
@@ -1806,14 +1797,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (MAIN_VERSION_OLDER(bmain, 265, 9)) {
Mesh *me;
- for (me = bmain->mesh.first; me; me = me->id.next) {
+ for (me = bmain->meshes.first; me; me = me->id.next) {
BKE_mesh_do_versions_cd_flag_init(me);
}
}
if (MAIN_VERSION_OLDER(bmain, 265, 10)) {
Brush *br;
- for (br = bmain->brush.first; br; br = br->id.next) {
+ for (br = bmain->brushes.first; br; br = br->id.next) {
if (br->ob_mode & OB_MODE_TEXTURE_PAINT) {
br->mtex.brush_map_mode = MTEX_MAP_MODE_TILED;
}
@@ -1842,7 +1833,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (MAIN_VERSION_OLDER(bmain, 266, 2)) {
bScreen *sc;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1916,7 +1907,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 266, 4)) {
Brush *brush;
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
BKE_texture_mtex_default(&brush->mask_mtex);
if (brush->ob_mode & OB_MODE_TEXTURE_PAINT) {
@@ -1929,7 +1920,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Brush *brush;
#define BRUSH_TEXTURE_OVERLAY (1 << 21)
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
brush->overlay_flags = 0;
if (brush->flag & BRUSH_TEXTURE_OVERLAY)
brush->overlay_flags |= (BRUSH_OVERLAY_PRIMARY | BRUSH_OVERLAY_CURSOR);
@@ -1941,7 +1932,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
//if (!DNA_struct_elem_find(fd->filesdna, "Brush", "int", "stencil_pos")) {
Brush *brush;
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->stencil_dimension[0] == 0) {
brush->stencil_dimension[0] = 256;
brush->stencil_dimension[1] = 256;
@@ -1971,7 +1962,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
SceneRenderLayer *srl;
FreestyleLineStyle *linestyle;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->r.line_thickness_mode == 0) {
sce->r.line_thickness_mode = R_LINE_THICKNESS_ABSOLUTE;
sce->r.unit_line_thickness = 1.0f;
@@ -2007,7 +1998,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (linestyle = bmain->linestyle.first; linestyle; linestyle = linestyle->id.next) {
+ for (linestyle = bmain->linestyles.first; linestyle; linestyle = linestyle->id.next) {
#if 1
/* disable the Misc panel for now */
if (linestyle->panel == LS_PANEL_MISC) {
@@ -2031,7 +2022,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *scene;
bNodeInstanceKey active_viewer_key = {0};
/* simply pick the first node space and use that for the active viewer key */
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
ScrArea *sa;
for (sa = screen->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -2053,7 +2044,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
break;
}
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* NB: scene->nodetree is a local ID block, has been direct_link'ed */
if (scene->nodetree)
scene->nodetree->active_viewer_key = active_viewer_key;
@@ -2063,7 +2054,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (MAIN_VERSION_OLDER(bmain, 267, 1)) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Smoke) {
@@ -2083,7 +2074,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 268, 1)) {
Brush *brush;
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
brush->spacing = MAX2(1, brush->spacing);
}
}
@@ -2091,7 +2082,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 268, 2)) {
Brush *brush;
#define BRUSH_FIXED (1 << 6)
- for (brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
brush->flag &= ~BRUSH_FIXED;
if (brush->cursor_overlay_alpha < 2)
@@ -2109,7 +2100,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
bScreen *sc;
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
bConstraint *con;
for (con = ob->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) {
@@ -2122,7 +2113,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Smoke) {
@@ -2141,7 +2132,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
*
* We moved this check to the do versions to be sure the value makes any sense.
*/
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -2162,7 +2153,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
ScrArea *sa;
/* add missing (+) expander in node editor */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
for (sa = sc->areabase.first; sa; sa = sa->next) {
ARegion *ar, *arnew;
@@ -2241,11 +2232,11 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *scene;
/* Update files using invalid (outdated) outlinevis Outliner values. */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
for (sa = sc->areabase.first; sa; sa = sa->next) {
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_OUTLINER) {
- SpaceOops *so = (SpaceOops *)sl;
+ SpaceOutliner *so = (SpaceOutliner *)sl;
if (!ELEM(so->outlinevis,
SO_SCENES,
@@ -2262,7 +2253,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingTrack", "float", "weight")) {
MovieClip *clip;
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
MovieTracking *tracking = &clip->tracking;
MovieTrackingObject *tracking_object;
for (tracking_object = tracking->objects.first;
@@ -2283,7 +2274,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "TriangulateModifierData", "int", "quad_method")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Triangulate) {
@@ -2301,7 +2292,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* this can now be turned off */
ToolSettings *ts = scene->toolsettings;
if (ts->sculpt)
@@ -2326,12 +2317,12 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
Scene *scene;
Object *ob;
- Lamp *lamp;
- for (lamp = bmain->lamp.first; lamp; lamp = lamp->id.next)
- lamp->spotsize = DEG2RADF(lamp->spotsize);
+ for (Light *la = bmain->lights.first; la; la = la->id.next) {
+ la->spotsize = DEG2RADF(la->spotsize);
+ }
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
@@ -2346,7 +2337,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq)
{
@@ -2380,7 +2371,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingPlaneTrack", "float", "image_opacity")) {
MovieClip *clip;
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
MovieTrackingPlaneTrack *plane_track;
for (plane_track = clip->tracking.plane_tracks.first;
plane_track;
@@ -2394,7 +2385,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 269, 7)) {
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
Sculpt *sd = scene->toolsettings->sculpt;
if (sd) {
@@ -2402,6 +2393,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
SCULPT_SYMM_X = (1 << 0),
SCULPT_SYMM_Y = (1 << 1),
SCULPT_SYMM_Z = (1 << 2),
+ SCULPT_SYMMETRY_FEATHER = (1 << 6),
};
int symmetry_flags = sd->flags & 7;
@@ -2420,7 +2412,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 269, 8)) {
Curve *cu;
- for (cu = bmain->curve.first; cu; cu = cu->id.next) {
+ for (cu = bmain->curves.first; cu; cu = cu->id.next) {
if (cu->str) {
cu->len_wchar = BLI_strlen_utf8(cu->str);
}
@@ -2430,7 +2422,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 269, 9)) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Build) {
@@ -2446,7 +2438,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 269, 11)) {
bScreen *sc;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *space_link;
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 7e201aaf1d1..3ea9c812d15 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenloader/intern/versioning_270.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
#include "BLI_utildefines.h"
@@ -63,7 +56,6 @@
#include "BKE_colortools.h"
#include "BKE_fcurve.h"
#include "BKE_gpencil.h"
-#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mask.h"
#include "BKE_modifier.h"
@@ -414,7 +406,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "float", "profile")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Bevel) {
@@ -441,7 +433,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
bScreen *screen;
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
ScrArea *area;
for (area = screen->areabase.first; area; area = area->next) {
SpaceLink *space_link;
@@ -459,7 +451,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingSettings", "float", "default_weight")) {
MovieClip *clip;
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
clip->tracking.settings.default_weight = 1.0f;
}
}
@@ -469,7 +461,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Object *ob;
/* Update Transform constraint (another deg -> rad stuff). */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
do_version_constraints_radians_degrees_270_1(&ob->constraints);
if (ob->pose) {
@@ -486,7 +478,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Mesh *me;
/* Mesh smoothresh deg->rad. */
- for (me = bmain->mesh.first; me; me = me->id.next) {
+ for (me = bmain->meshes.first; me; me = me->id.next) {
me->smoothresh = DEG2RADF(me->smoothresh);
}
}
@@ -494,7 +486,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 270, 3)) {
FreestyleLineStyle *linestyle;
- for (linestyle = bmain->linestyle.first; linestyle; linestyle = linestyle->id.next) {
+ for (linestyle = bmain->linestyles.first; linestyle; linestyle = linestyle->id.next) {
linestyle->flag |= LS_NO_SORTING;
linestyle->sort_key = LS_SORT_KEY_DISTANCE_FROM_CAMERA;
linestyle->integration_type = LS_INTEGRATION_MEAN;
@@ -507,7 +499,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
*/
bScreen *sc;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -528,7 +520,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Object *ob;
/* Update Transform constraint (again :|). */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
do_version_constraints_radians_degrees_270_5(&ob->constraints);
if (ob->pose) {
@@ -545,7 +537,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "BakeData", "bake")) {
Scene *sce;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
sce->r.bake.flag = R_BAKE_CLEAR;
sce->r.bake.width = 512;
sce->r.bake.height = 512;
@@ -567,7 +559,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "FreestyleLineStyle", "float", "texstep")) {
FreestyleLineStyle *linestyle;
- for (linestyle = bmain->linestyle.first; linestyle; linestyle = linestyle->id.next) {
+ for (linestyle = bmain->linestyles.first; linestyle; linestyle = linestyle->id.next) {
linestyle->flag |= LS_TEXTURE;
linestyle->texstep = 1.0;
}
@@ -575,7 +567,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
int num_layers = BLI_listbase_count(&scene->r.layers);
scene->r.actlay = min_ff(scene->r.actlay, num_layers - 1);
}
@@ -586,7 +578,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "line_col[4]")) {
Material *mat;
- for (mat = bmain->mat.first; mat; mat = mat->id.next) {
+ for (mat = bmain->materials.first; mat; mat = mat->id.next) {
mat->line_col[0] = mat->line_col[1] = mat->line_col[2] = 0.0f;
mat->line_col[3] = mat->alpha;
}
@@ -594,7 +586,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) {
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->r.preview_start_resolution = 64;
}
}
@@ -603,13 +595,13 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 271, 3)) {
Brush *br;
- for (br = bmain->brush.first; br; br = br->id.next) {
+ for (br = bmain->brushes.first; br; br = br->id.next) {
br->fill_threshold = 0.2f;
}
if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "int", "mat")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
@@ -624,7 +616,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 271, 6)) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
@@ -641,7 +633,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 272, 0)) {
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) {
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->r.preview_start_resolution = 64;
}
}
@@ -649,7 +641,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 272, 1)) {
Brush *br;
- for (br = bmain->brush.first; br; br = br->id.next) {
+ for (br = bmain->brushes.first; br; br = br->id.next) {
if ((br->ob_mode & OB_MODE_SCULPT) && ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK))
br->alpha = 1.0f;
}
@@ -658,7 +650,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 272, 2)) {
if (!DNA_struct_elem_find(fd->filesdna, "Image", "float", "gen_color")) {
Image *image;
- for (image = bmain->image.first; image != NULL; image = image->id.next) {
+ for (image = bmain->images.first; image != NULL; image = image->id.next) {
image->gen_color[3] = 1.0f;
}
}
@@ -667,7 +659,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Object *ob;
/* Update Transform constraint (again :|). */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
do_version_constraints_stretch_to_limits(&ob->constraints);
if (ob->pose) {
@@ -687,7 +679,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Brush *br;
- for (br = bmain->brush.first; br; br = br->id.next) {
+ for (br = bmain->brushes.first; br; br = br->id.next) {
if (br->flag & BRUSH_RAKE) {
br->mtex.brush_angle_mode |= MTEX_ANGLE_RAKE;
br->mask_mtex.brush_angle_mode |= MTEX_ANGLE_RAKE;
@@ -709,7 +701,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "Scene", "DisplaySafeAreas", "safe_areas")) {
Scene *scene;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
copy_v2_fl2(scene->safe_areas.title, 3.5f / 100.0f, 3.5f / 100.0f);
copy_v2_fl2(scene->safe_areas.action, 10.0f / 100.0f, 5.0f / 100.0f);
copy_v2_fl2(scene->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
@@ -720,7 +712,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 273, 3)) {
ParticleSettings *part;
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
if (part->clumpcurve)
part->child_flag |= PART_CHILD_USE_CLUMP_CURVE;
if (part->roughcurve)
@@ -732,7 +724,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) {
Object *ob;
ModifierData *md;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData *)md;
@@ -750,21 +742,21 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "float", "clump_noise_size")) {
ParticleSettings *part;
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
part->clump_noise_size = 1.0f;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "int", "kink_extra_steps")) {
ParticleSettings *part;
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
part->kink_extra_steps = 4;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "MTex", "float", "kinkampfac")) {
ParticleSettings *part;
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
int a;
for (a = 0; a < MAX_MTEX; a++) {
MTex *mtex = part->mtex[a];
@@ -778,7 +770,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "HookModifierData", "char", "flag")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Hook) {
@@ -808,7 +800,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "Camera", "GPUDOFSettings", "gpu_dof")) {
Camera *ca;
- for (ca = bmain->camera.first; ca; ca = ca->id.next) {
+ for (ca = bmain->cameras.first; ca; ca = ca->id.next) {
ca->gpu_dof.fstop = 128.0f;
ca->gpu_dof.focal_length = 1.0f;
ca->gpu_dof.focus_distance = 1.0f;
@@ -819,7 +811,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 273, 8)) {
Object *ob;
- for (ob = bmain->object.first; ob != NULL; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob != NULL; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.last; md != NULL; md = md->prev) {
if (modifier_unique_name(&ob->modifiers, md)) {
@@ -838,7 +830,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
ARegion *ar;
/* Make sure sequencer preview area limits zoom */
- for (scr = bmain->screen.first; scr; scr = scr->id.next) {
+ for (scr = bmain->screens.first; scr; scr = scr->id.next) {
for (sa = scr->areabase.first; sa; sa = sa->next) {
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_SEQ) {
@@ -861,7 +853,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
Object *ob;
ParticleSystem *psys;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
if ((psys->pointcache->flag & PTCACHE_BAKED) == 0) {
psys->recalc |= ID_RECALC_PSYS_RESET;
@@ -873,7 +865,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* hysteresis setted to 10% but not actived */
if (!DNA_struct_elem_find(fd->filesdna, "LodLevel", "int", "obhysteresis")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
LodLevel *level;
for (level = ob->lodlevels.first; level; level = level->next) {
level->obhysteresis = 10;
@@ -891,7 +883,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Camera *cam;
Image *ima;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
Sequence *seq;
BKE_scene_add_render_view(scene, STEREO_LEFT_NAME);
@@ -920,7 +912,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
} SEQ_END;
}
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
ScrArea *sa;
for (sa = screen->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -947,12 +939,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (cam = bmain->camera.first; cam; cam = cam->id.next) {
+ for (cam = bmain->cameras.first; cam; cam = cam->id.next) {
cam->stereo.interocular_distance = 0.065f;
cam->stereo.convergence_distance = 30.0f * 0.065f;
}
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
ima->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Image Stereo 3d Format");
if (ima->packedfile) {
@@ -976,7 +968,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
bScreen *screen;
if (!DNA_struct_elem_find(fd->filesdna, "FileSelectParams", "int", "thumbnail_size")) {
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
ScrArea *sa;
for (sa = screen->areabase.first; sa; sa = sa->next) {
@@ -997,7 +989,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "short", "simplify_subsurf_render")) {
Scene *scene;
- for (scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
scene->r.simplify_subsurf_render = scene->r.simplify_subsurf;
scene->r.simplify_particles_render = scene->r.simplify_particles;
}
@@ -1006,7 +998,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "DecimateModifierData", "float", "defgrp_factor")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Decimate) {
@@ -1021,7 +1013,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 275, 3)) {
Brush *br;
#define BRUSH_TORUS (1 << 1)
- for (br = bmain->brush.first; br; br = br->id.next) {
+ for (br = bmain->brushes.first; br; br = br->id.next) {
br->flag &= ~BRUSH_TORUS;
}
#undef BRUSH_TORUS
@@ -1031,7 +1023,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "custom_scale")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->pose) {
bPoseChannel *pchan;
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
@@ -1044,7 +1036,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
bScreen *screen;
#define RV3D_VIEW_PERSPORTHO 7
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
ScrArea *sa;
for (sa = screen->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1071,11 +1063,10 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
{
- Lamp *lamp;
#define LA_YF_PHOTON 5
- for (lamp = bmain->lamp.first; lamp; lamp = lamp->id.next) {
- if (lamp->type == LA_YF_PHOTON) {
- lamp->type = LA_LOCAL;
+ for (Light *la = bmain->lights.first; la; la = la->id.next) {
+ if (la->type == LA_YF_PHOTON) {
+ la->type = LA_LOCAL;
}
}
#undef LA_YF_PHOTON
@@ -1085,7 +1076,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 276, 3)) {
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "CurveMapping", "mblur_shutter_curve")) {
Scene *scene;
- for (scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
CurveMapping *curve_mapping = &scene->r.mblur_shutter_curve;
curvemapping_set_defaults(curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f);
curvemapping_initialize(curve_mapping);
@@ -1098,7 +1089,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 276, 4)) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
if (ts->gp_sculpt.brush[0].size == 0) {
@@ -1173,7 +1164,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+ for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
bool enabled = false;
/* Ensure that the datablock's onionskinning toggle flag
@@ -1207,13 +1198,13 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 276, 7)) {
Scene *scene;
- for (scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
scene->r.bake.pass_filter = R_BAKE_PASS_FILTER_ALL;
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 277, 1)) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ParticleEditSettings *pset = &scene->toolsettings->particle;
for (int a = 0; a < ARRAY_SIZE(pset->brush); a++) {
if (pset->brush[a].strength > 1.0f) {
@@ -1222,7 +1213,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
@@ -1255,7 +1246,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
CurvePaintSettings *cps = &scene->toolsettings->curve_paint_settings;
if (cps->error_threshold == 0) {
cps->curve_type = CU_BEZIER;
@@ -1266,7 +1257,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq)
@@ -1289,7 +1280,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
/* Adding "Properties" region to DopeSheet */
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
/* handle pushed-back space data first */
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
@@ -1309,12 +1300,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 277, 2)) {
if (!DNA_struct_elem_find(fd->filesdna, "Bone", "float", "scaleIn")) {
- for (bArmature *arm = bmain->armature.first; arm; arm = arm->id.next) {
+ for (bArmature *arm = bmain->armatures.first; arm; arm = arm->id.next) {
do_version_bones_super_bbone(&arm->bonebase);
}
}
if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "scaleIn")) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->pose) {
for (bPoseChannel *pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
/* see do_version_bones_super_bbone()... */
@@ -1334,7 +1325,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (Camera *camera = bmain->camera.first; camera != NULL; camera = camera->id.next) {
+ for (Camera *camera = bmain->cameras.first; camera != NULL; camera = camera->id.next) {
if (camera->stereo.pole_merge_angle_from == 0.0f &&
camera->stereo.pole_merge_angle_to == 0.0f)
{
@@ -1346,7 +1337,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "NormalEditModifierData", "float", "mix_limit")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_NormalEdit) {
@@ -1359,7 +1350,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "BooleanModifierData", "float", "double_threshold")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Boolean) {
@@ -1370,7 +1361,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (Brush *br = bmain->brush.first; br; br = br->id.next) {
+ for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
if (br->sculpt_tool == SCULPT_TOOL_FLATTEN) {
br->flag |= BRUSH_ACCUMULATE;
}
@@ -1379,7 +1370,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "time_scale")) {
Object *ob;
ModifierData *md;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData *)md;
@@ -1399,7 +1390,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 277, 3)) {
/* ------- init of grease pencil initialization --------------- */
if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "bGPDpalettecolor", "*palcolor")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
/* initialize use position for sculpt brushes */
ts->gp_sculpt.flag |= GP_SCULPT_SETT_FLAG_APPLY_POSITION;
@@ -1418,7 +1409,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Convert Grease Pencil to new palettes/brushes
* Loop all strokes and create the palette and all colors
*/
- for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+ for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
if (BLI_listbase_is_empty(&gpd->palettes)) {
/* create palette */
bGPDpalette *palette = BKE_gpencil_palette_addnew(gpd, "GP_Palette");
@@ -1465,7 +1456,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 278, 0)) {
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingTrack", "float", "weight_stab")) {
MovieClip *clip;
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
MovieTracking *tracking = &clip->tracking;
MovieTrackingObject *tracking_object;
for (tracking_object = tracking->objects.first;
@@ -1486,7 +1477,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingStabilization", "int", "tot_rot_track")) {
MovieClip *clip;
- for (clip = bmain->movieclip.first; clip != NULL; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip != NULL; clip = clip->id.next) {
if (clip->tracking.stabilization.rot_track) {
migrate_single_rot_stabilization_track_settings(&clip->tracking.stabilization);
}
@@ -1508,13 +1499,13 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 278, 2)) {
if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "ffmpeg_preset")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* "medium" is the preset FFmpeg uses when no presets are given. */
scene->r.ffcodecdata.ffmpeg_preset = FFM_PRESET_MEDIUM;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "constant_rate_factor")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* fall back to behavior from before we introduced CRF for old files */
scene->r.ffcodecdata.constant_rate_factor = FFM_CRF_NONE;
}
@@ -1524,7 +1515,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Object *ob;
ModifierData *md;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData *)md;
@@ -1540,7 +1531,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 278, 3)) {
- for (Scene *scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
if (scene->toolsettings != NULL) {
ToolSettings *ts = scene->toolsettings;
ParticleEditSettings *pset = &ts->particle;
@@ -1554,7 +1545,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!DNA_struct_elem_find(fd->filesdna, "RigidBodyCon", "float", "spring_stiffness_ang_x")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
RigidBodyCon *rbc = ob->rigidbody_constraint;
if (rbc) {
rbc->spring_stiffness_ang_x = 10.0;
@@ -1569,7 +1560,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* constant detail for sculpting is now a resolution value instead of
* a percentage, we reuse old DNA struct member but convert it */
- for (Scene *scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
if (scene->toolsettings != NULL) {
ToolSettings *ts = scene->toolsettings;
if (ts->sculpt && ts->sculpt->constant_detail != 0.0f) {
@@ -1581,14 +1572,14 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 278, 4)) {
const float sqrt_3 = (float)M_SQRT3;
- for (Brush *br = bmain->brush.first; br; br = br->id.next) {
+ for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
br->fill_threshold /= sqrt_3;
}
/* Custom motion paths */
if (!DNA_struct_elem_find(fd->filesdna, "bMotionPath", "int", "line_thickness")) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
bMotionPath *mpath;
bPoseChannel *pchan;
mpath = ob->mpath;
@@ -1618,7 +1609,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 278, 5)) {
/* Mask primitive adding code was not initializing correctly id_type of its points' parent. */
- for (Mask *mask = bmain->mask.first; mask; mask = mask->id.next) {
+ for (Mask *mask = bmain->masks.first; mask; mask = mask->id.next) {
for (MaskLayer *mlayer = mask->masklayers.first; mlayer; mlayer = mlayer->next) {
for (MaskSpline *mspline = mlayer->splines.first; mspline; mspline = mspline->next) {
int i = 0;
@@ -1656,7 +1647,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "SurfaceDeformModifierData", "float", "mat[4][4]")) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_SurfaceDeform) {
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
@@ -1674,14 +1665,14 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 279, 0)) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->r.im_format.exr_codec == R_IMF_EXR_CODEC_DWAB) {
scene->r.im_format.exr_codec = R_IMF_EXR_CODEC_DWAA;
}
}
/* Fix related to VGroup modifiers creating named defgroup CD layers! See T51520. */
- for (Mesh *me = bmain->mesh.first; me; me = me->id.next) {
+ for (Mesh *me = bmain->meshes.first; me; me = me->id.next) {
CustomData_set_layer_name(&me->vdata, CD_MDEFORMVERT, 0, "");
}
}
@@ -1691,7 +1682,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Object *ob;
ModifierData *md;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData *)md;
@@ -1706,7 +1697,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 279, 4)) {
/* Fix for invalid state of screen due to bug in older versions. */
- for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
if (sa->full && sc->state == SCREENNORMAL) {
sa->full = NULL;
@@ -1715,15 +1706,15 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "falloff_angle")) {
- for (Brush *br = bmain->brush.first; br; br = br->id.next) {
+ for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
br->falloff_angle = DEG2RADF(80);
br->flag &= ~(
- BRUSH_FLAG_DEPRECATED_1 | BRUSH_FLAG_DEPRECATED_2 |
- BRUSH_FLAG_DEPRECATED_3 | BRUSH_FLAG_DEPRECATED_4 |
+ BRUSH_FLAG_DEPRECATED_1 | BRUSH_FLAG_DEPRECATED_6 |
+ BRUSH_FLAG_DEPRECATED_7 | BRUSH_FLAG_DEPRECATED_17 |
BRUSH_FRONTFACE_FALLOFF);
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
for (int i = 0; i < 2; i++) {
VPaint *vp = i ? ts->vpaint : ts->wpaint;
@@ -1738,7 +1729,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Simple deform modifier no longer assumes Z axis (X for bend type).
* Must set previous defaults. */
if (!DNA_struct_elem_find(fd->filesdna, "SimpleDeformModifierData", "char", "deform_axis")) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_SimpleDeform) {
SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md;
@@ -1748,7 +1739,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
int preset = scene->r.ffcodecdata.ffmpeg_preset;
if (preset == FFM_PRESET_NONE || preset >= FFM_PRESET_GOOD) {
continue;
@@ -1766,7 +1757,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "ParticleInstanceModifierData", "float", "particle_amount")) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_ParticleInstance) {
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index a63b7afbcd0..3d9ae899a32 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenloader/intern/versioning_280.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
/* allow readfile to use deprecated functionality */
@@ -35,7 +28,6 @@
#include "BLI_math.h"
#include "BLI_mempool.h"
#include "BLI_string.h"
-#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "DNA_object_types.h"
@@ -44,7 +36,7 @@
#include "DNA_collection_types.h"
#include "DNA_constraint_types.h"
#include "DNA_gpu_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_layer_types.h"
#include "DNA_lightprobe_types.h"
#include "DNA_material_types.h"
@@ -61,6 +53,7 @@
#include "DNA_key_types.h"
#include "DNA_curve_types.h"
#include "DNA_armature_types.h"
+#include "DNA_text_types.h"
#include "BKE_action.h"
#include "BKE_cloth.h"
@@ -120,7 +113,7 @@ static bScreen *screen_parent_find(const bScreen *screen)
static void do_version_workspaces_create_from_screens(Main *bmain)
{
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
const bScreen *screen_parent = screen_parent_find(screen);
WorkSpace *workspace;
if (screen->temp) {
@@ -226,7 +219,7 @@ static void do_version_workspaces_after_lib_link(Main *bmain)
}
}
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
/* Deprecated from now on! */
BLI_freelistN(&screen->scene->transform_spaces);
screen->scene = NULL;
@@ -525,10 +518,6 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene)
if (have_override || need_default_renderlayer) {
ViewLayer *view_layer = BKE_view_layer_add(scene, "Viewport");
- /* Make it first in the list. */
- BLI_remlink(&scene->view_layers, view_layer);
- BLI_addhead(&scene->view_layers, view_layer);
-
/* If we ported all the original render layers, we don't need to make the viewport layer renderable. */
if (!BLI_listbase_is_single(&scene->view_layers)) {
view_layer->flag &= ~VIEW_LAYER_RENDER;
@@ -582,7 +571,7 @@ void do_versions_after_linking_280(Main *bmain)
use_collection_compat_28 = false;
/* Convert group layer visibility flags to hidden nested collection. */
- for (Collection *collection = bmain->collection.first; collection; collection = collection->id.next) {
+ for (Collection *collection = bmain->collections.first; collection; collection = collection->id.next) {
/* Add fake user for all existing groups. */
id_fake_user_set(&collection->id);
@@ -623,18 +612,18 @@ void do_versions_after_linking_280(Main *bmain)
/* We need to assign lib pointer to generated hidden collections *after* all have been created, otherwise we'll
* end up with several datablocks sharing same name/library, which is FORBIDDEN!
* Note: we need this to be recursive, since a child collection may be sorted before its parent in bmain... */
- for (Collection *collection = bmain->collection.first; collection != NULL; collection = collection->id.next) {
+ for (Collection *collection = bmain->collections.first; collection != NULL; collection = collection->id.next) {
do_version_collection_propagate_lib_to_children(collection);
}
/* Convert layers to collections. */
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
do_version_layers_to_collections(bmain, scene);
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
/* same render-layer as do_version_workspaces_after_lib_link will activate,
* so same layer as BKE_view_layer_default_view would return */
ViewLayer *layer = screen->scene->view_layers.first;
@@ -642,7 +631,7 @@ void do_versions_after_linking_280(Main *bmain)
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *space = sa->spacedata.first; space; space = space->next) {
if (space->spacetype == SPACE_OUTLINER) {
- SpaceOops *soutliner = (SpaceOops *)space;
+ SpaceOutliner *soutliner = (SpaceOutliner *)space;
soutliner->outlinevis = SO_VIEW_LAYER;
@@ -675,7 +664,7 @@ void do_versions_after_linking_280(Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 2)) {
/* Cleanup any remaining SceneRenderLayer data for files that were created
* with Blender 2.8 before the SceneRenderLayer > RenderLayer refactor. */
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) {
if (srl->prop) {
IDP_FreeProperty(srl->prop);
@@ -690,7 +679,7 @@ void do_versions_after_linking_280(Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 3)) {
/* Due to several changes to particle RNA and draw code particles from older files may no longer
* be visible. Here we correct this by setting a default draw size for those files. */
- for (Object *object = bmain->object.first; object; object = object->id.next) {
+ for (Object *object = bmain->objects.first; object; object = object->id.next) {
for (ParticleSystem *psys = object->particlesystem.first; psys; psys = psys->next) {
if (psys->part->draw_size == 0.0f) {
psys->part->draw_size = 0.1f;
@@ -700,7 +689,7 @@ void do_versions_after_linking_280(Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 4)) {
- for (Object *object = bmain->object.first; object; object = object->id.next) {
+ for (Object *object = bmain->objects.first; object; object = object->id.next) {
if (object->particlesystem.first) {
object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT;
for (ParticleSystem *psys = object->particlesystem.first; psys; psys = psys->next) {
@@ -719,7 +708,7 @@ void do_versions_after_linking_280(Main *bmain)
}
/* Cleanup deprecated flag from particlesettings data-blocks. */
- for (ParticleSettings *part = bmain->particle.first; part; part = part->id.next) {
+ for (ParticleSettings *part = bmain->particles.first; part; part = part->id.next) {
part->draw &= ~PART_DRAW_EMITTER;
}
}
@@ -727,7 +716,7 @@ void do_versions_after_linking_280(Main *bmain)
/* SpaceTime & SpaceLogic removal/replacing */
if (!MAIN_VERSION_ATLEAST(bmain, 280, 9)) {
const wmWindowManager *wm = bmain->wm.first;
- const Scene *scene = bmain->scene.first;
+ const Scene *scene = bmain->scenes.first;
if (wm != NULL) {
/* Action editors need a scene for creation. First, update active
@@ -747,7 +736,7 @@ void do_versions_after_linking_280(Main *bmain)
}
}
if (scene != NULL) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *area = screen->areabase.first; area; area = area->next) {
if (ELEM(area->butspacetype, SPACE_TIME, SPACE_LOGIC)) {
/* Areas that were already handled won't be handled again */
@@ -763,11 +752,11 @@ void do_versions_after_linking_280(Main *bmain)
#ifdef USE_COLLECTION_COMPAT_28
if (use_collection_compat_28 && !MAIN_VERSION_ATLEAST(bmain, 280, 14)) {
- for (Collection *group = bmain->collection.first; group; group = group->id.next) {
+ for (Collection *group = bmain->collections.first; group; group = group->id.next) {
do_version_group_collection_to_collection(bmain, group);
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
do_version_scene_collection_to_collection(bmain, scene);
}
}
@@ -775,7 +764,7 @@ void do_versions_after_linking_280(Main *bmain)
/* Update Curve object Shape Key data layout to include the Radius property */
if (!MAIN_VERSION_ATLEAST(bmain, 280, 23)) {
- for (Curve *cu = bmain->curve.first; cu; cu = cu->id.next) {
+ for (Curve *cu = bmain->curves.first; cu; cu = cu->id.next) {
if (!cu->key || cu->key->elemsize != sizeof(float[4]))
continue;
@@ -804,7 +793,7 @@ void do_versions_after_linking_280(Main *bmain)
for (int a = 0; a < nu->pntsu; a++, bezt++) {
if ((old_count -= 3) < 0) {
memcpy(newptr, bezt->vec, sizeof(float[3][3]));
- newptr[3][0] = bezt->alfa;
+ newptr[3][0] = bezt->tilt;
}
else {
memcpy(newptr, oldptr, sizeof(float[3][4]));
@@ -822,7 +811,7 @@ void do_versions_after_linking_280(Main *bmain)
for (int a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
if (--old_count < 0) {
copy_v3_v3(newptr[0], bp->vec);
- newptr[1][0] = bp->alfa;
+ newptr[1][0] = bp->tilt;
}
else {
memcpy(newptr, oldptr, sizeof(float[4]));
@@ -843,7 +832,7 @@ void do_versions_after_linking_280(Main *bmain)
/* Move B-Bone custom handle settings from bPoseChannel to Bone. */
if (!MAIN_VERSION_ATLEAST(bmain, 280, 25)) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
bArmature *arm = ob->data;
/* If it is an armature from the same file. */
@@ -876,7 +865,7 @@ void do_versions_after_linking_280(Main *bmain)
/* Tag pose rebuild for all objects that use this armature. */
if (rebuild) {
- for (Object *ob2 = bmain->object.first; ob2; ob2 = ob2->id.next) {
+ for (Object *ob2 = bmain->objects.first; ob2; ob2 = ob2->id.next) {
if (ob2->pose && ob2->data == arm) {
ob2->pose->flag |= POSE_RECALC;
}
@@ -887,7 +876,7 @@ void do_versions_after_linking_280(Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 30)) {
- for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->gpencil_settings != NULL) {
brush->gpencil_tool = brush->gpencil_settings->brush_type;
}
@@ -897,7 +886,7 @@ void do_versions_after_linking_280(Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 38)) {
/* Ensure we get valid rigidbody object/constraint data in relevant collections' objects. */
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
RigidBodyWorld *rbw = scene->rigidbody_world;
if (rbw == NULL) {
@@ -929,20 +918,20 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
use_collection_compat_28 = false;
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->r.gauss = 1.5f;
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 1)) {
- if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "bleedexp")) {
- for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
+ if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "bleedexp")) {
+ for (Light *la = bmain->lights.first; la; la = la->id.next) {
la->bleedexp = 2.5f;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "GPUDOFSettings", "float", "ratio")) {
- for (Camera *ca = bmain->camera.first; ca; ca = ca->id.next) {
+ for (Camera *ca = bmain->cameras.first; ca; ca = ca->id.next) {
ca->gpu_dof.ratio = 1.0f;
}
}
@@ -950,7 +939,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* MTexPoly now removed. */
if (DNA_struct_find(fd->filesdna, "MTexPoly")) {
const int cd_mtexpoly = 15; /* CD_MTEXPOLY, deprecated */
- for (Mesh *me = bmain->mesh.first; me; me = me->id.next) {
+ for (Mesh *me = bmain->meshes.first; me; me = me->id.next) {
/* If we have UV's, so this file will have MTexPoly layers too! */
if (me->mloopuv != NULL) {
CustomData_update_typemap(&me->pdata);
@@ -962,8 +951,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 2)) {
- if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "cascade_max_dist")) {
- for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
+ if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "cascade_max_dist")) {
+ for (Light *la = bmain->lights.first; la; la = la->id.next) {
la->cascade_max_dist = 1000.0f;
la->cascade_count = 4;
la->cascade_exponent = 0.8f;
@@ -971,8 +960,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "contact_dist")) {
- for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
+ if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "contact_dist")) {
+ for (Light *la = bmain->lights.first; la; la = la->id.next) {
la->contact_dist = 0.2f;
la->contact_bias = 0.03f;
la->contact_spread = 0.2f;
@@ -981,7 +970,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "float", "vis_bias")) {
- for (LightProbe *probe = bmain->lightprobe.first; probe; probe = probe->id.next) {
+ for (LightProbe *probe = bmain->lightprobes.first; probe; probe = probe->id.next) {
probe->vis_bias = 1.0f;
probe->vis_blur = 0.2f;
}
@@ -1049,7 +1038,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
(DNA_struct_elem_find(fd->filesdna, "ViewLayer", "FreestyleConfig", "freestyle_config") == false) &&
DNA_struct_elem_find(fd->filesdna, "Scene", "ListBase", "view_layers"))
{
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ViewLayer *view_layer;
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
view_layer->flag |= VIEW_LAYER_FREESTYLE;
@@ -1065,7 +1054,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
/* Grease pencil sculpt and paint cursors */
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "int", "weighttype")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* sculpt brushes */
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
if (gset) {
@@ -1080,7 +1069,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
GP_Sculpt_Data *gp_brush;
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
/* sculpt brushes */
GP_Sculpt_Settings *gset = &ts->gp_sculpt;
@@ -1095,21 +1084,21 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Init grease pencil edit line color */
if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", "line_color[4]")) {
- for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+ for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
ARRAY_SET_ITEMS(gpd->line_color, 0.6f, 0.6f, 0.6f, 0.5f);
}
}
/* Init grease pencil pixel size factor */
- if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "int", "pixfactor")) {
- for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+ if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", "pixfactor")) {
+ for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
}
}
/* Grease pencil multiframe falloff curve */
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "CurveMapping", "cur_falloff")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* sculpt brushes */
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
if ((gset) && (gset->cur_falloff == NULL)) {
@@ -1127,14 +1116,14 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
#ifdef USE_COLLECTION_COMPAT_28
if (use_collection_compat_28 && !MAIN_VERSION_ATLEAST(bmain, 280, 3)) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ViewLayer *view_layer;
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
do_version_view_layer_visibility(view_layer);
}
}
- for (Collection *group = bmain->collection.first; group; group = group->id.next) {
+ for (Collection *group = bmain->collections.first; group; group = group->id.next) {
if (group->view_layer != NULL) {
do_version_view_layer_visibility(group->view_layer);
}
@@ -1145,7 +1134,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 3)) {
/* init grease pencil grids and paper */
if (!DNA_struct_elem_find(fd->filesdna, "gp_paper_opacity", "float", "gpencil_paper_color[3]")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *area = screen->areabase.first; area; area = area->next) {
for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1160,17 +1149,17 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 6)) {
- if (DNA_struct_elem_find(fd->filesdna, "SpaceOops", "int", "filter") == false) {
+ if (DNA_struct_elem_find(fd->filesdna, "SpaceOutliner", "int", "filter") == false) {
bScreen *sc;
ScrArea *sa;
SpaceLink *sl;
/* Update files using invalid (outdated) outlinevis Outliner values. */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
for (sa = sc->areabase.first; sa; sa = sa->next) {
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_OUTLINER) {
- SpaceOops *so = (SpaceOops *)sl;
+ SpaceOutliner *so = (SpaceOutliner *)sl;
if (!ELEM(so->outlinevis,
SO_SCENES,
@@ -1188,12 +1177,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "float", "intensity")) {
- for (LightProbe *probe = bmain->lightprobe.first; probe; probe = probe->id.next) {
+ for (LightProbe *probe = bmain->lightprobes.first; probe; probe = probe->id.next) {
probe->intensity = 1.0f;
}
}
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
bConstraint *con, *con_next;
con = ob->constraints.first;
while (con) {
@@ -1207,7 +1196,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1231,7 +1220,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
* development, we assume any files saved in 2.8 had Eevee set
* as scene render engine. */
if (MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine));
}
}
@@ -1239,7 +1228,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 8)) {
/* Blender Internal removal */
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (STREQ(scene->r.engine, "BLENDER_RENDER") ||
STREQ(scene->r.engine, "BLENDER_GAME"))
{
@@ -1249,7 +1238,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
scene->r.bake_mode = 0;
}
- for (Tex *tex = bmain->tex.first; tex; tex = tex->id.next) {
+ for (Tex *tex = bmain->textures.first; tex; tex = tex->id.next) {
/* Removed envmap, pointdensity, voxeldata, ocean textures. */
if (ELEM(tex->type, 10, 14, 15, 16)) {
tex->type = 0;
@@ -1261,7 +1250,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 11)) {
/* Remove info editor, but only if at the top of the window. */
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
/* Calculate window width/height from screen vertices */
int win_width = 0, win_height = 0;
for (ScrVert *vert = screen->vertbase.first; vert; vert = vert->next) {
@@ -1292,17 +1281,17 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 11)) {
- for (Lamp *lamp = bmain->lamp.first; lamp; lamp = lamp->id.next) {
- if (lamp->mode & (1 << 13)) { /* LA_SHAD_RAY */
- lamp->mode |= LA_SHADOW;
- lamp->mode &= ~(1 << 13);
+ for (Light *la = bmain->lights.first; la; la = la->id.next) {
+ if (la->mode & (1 << 13)) { /* LA_SHAD_RAY */
+ la->mode |= LA_SHADOW;
+ la->mode &= ~(1 << 13);
}
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 12)) {
/* Remove tool property regions. */
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_CLIP)) {
@@ -1324,14 +1313,14 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 13)) {
/* Initialize specular factor. */
- if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "spec_fac")) {
- for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
+ if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "spec_fac")) {
+ for (Light *la = bmain->lights.first; la; la = la->id.next) {
la->spec_fac = 1.0f;
}
}
/* Initialize new view3D options. */
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1348,42 +1337,29 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
-
- if (!DNA_struct_find(fd->filesdna, "View3DCursor")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
- unit_qt(scene->cursor.rotation);
- }
- }
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 14)) {
if (!DNA_struct_elem_find(fd->filesdna, "Scene", "SceneDisplay", "display")) {
/* Initialize new scene.SceneDisplay */
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
copy_v3_v3(scene->display.light_direction, (float[3]){-M_SQRT1_3, -M_SQRT1_3, M_SQRT1_3});
}
}
if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "float", "shadow_shift")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->display.shadow_shift = 0.1;
}
}
- if (!DNA_struct_elem_find(fd->filesdna, "Object", "ObjectDisplay", "display")) {
- /* Initialize new object.ObjectDisplay */
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
- ob->display.flag = OB_SHOW_SHADOW;
- }
- }
-
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "transform_pivot_point")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEDIAN;
}
}
if (!DNA_struct_find(fd->filesdna, "SceneEEVEE")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* First set the default for all the properties. */
scene->eevee.gi_diffuse_bounces = 3;
@@ -1420,12 +1396,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
copy_v3_fl(scene->eevee.bloom_color, 1.0f);
scene->eevee.bloom_threshold = 0.8f;
scene->eevee.bloom_knee = 0.5f;
- scene->eevee.bloom_intensity = 0.8f;
+ scene->eevee.bloom_intensity = 0.05f;
scene->eevee.bloom_radius = 6.5f;
- scene->eevee.bloom_clamp = 1.0f;
+ scene->eevee.bloom_clamp = 0.0f;
scene->eevee.motion_blur_samples = 8;
- scene->eevee.motion_blur_shutter = 1.0f;
+ scene->eevee.motion_blur_shutter = 0.5f;
scene->eevee.shadow_method = SHADOW_ESM;
scene->eevee.shadow_cube_size = 512;
@@ -1590,17 +1566,17 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 15)) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->display.matcap_ssao_distance = 0.2f;
scene->display.matcap_ssao_attenuation = 1.0f;
scene->display.matcap_ssao_samples = 16;
}
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_OUTLINER) {
- SpaceOops *soops = (SpaceOops *)sl;
+ SpaceOutliner *soops = (SpaceOutliner *)sl;
soops->filter_id_type = ID_GR;
soops->outlinevis = SO_VIEW_LAYER;
}
@@ -1608,7 +1584,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
switch (scene->toolsettings->snap_mode) {
case 0: scene->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT; break;
case 1: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VERTEX ; break;
@@ -1629,7 +1605,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
ParticleSettings *part;
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
part->shape_flag = PART_SHAPE_CLOSE_TIP;
part->shape = 0.0f;
part->rad_root = 1.0f;
@@ -1642,7 +1618,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 18)) {
if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "roughness")) {
- for (Material *mat = bmain->mat.first; mat; mat = mat->id.next) {
+ for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
if (mat->use_nodes) {
if (MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
mat->roughness = mat->gloss_mir;
@@ -1657,7 +1633,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
mat->metallic = mat->ray_mirror;
}
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1670,7 +1646,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "xray_alpha")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1685,7 +1661,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
StudioLight *default_matcap = BKE_studiolight_find_default(STUDIOLIGHT_TYPE_MATCAP);
/* when loading the internal file is loaded before the matcaps */
if (default_matcap) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1698,7 +1674,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "wireframe_threshold")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1710,7 +1686,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "cavity_valley_factor")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1723,7 +1699,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "xray_alpha_bone")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1738,7 +1714,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 19)) {
if (!DNA_struct_elem_find(fd->filesdna, "Image", "ListBase", "renderslot")) {
- for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
if (ima->type == IMA_TYPE_R_RESULT) {
for (int i = 0; i < 8; i++) {
RenderSlot *slot = MEM_callocN(sizeof(RenderSlot), "Image Render Slot Init");
@@ -1749,7 +1725,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (!DNA_struct_elem_find(fd->filesdna, "SpaceAction", "char", "mode_prev")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_ACTION) {
@@ -1764,7 +1740,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1782,14 +1758,14 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 21)) {
- for (Scene *sce = bmain->scene.first; sce != NULL; sce = sce->id.next) {
+ for (Scene *sce = bmain->scenes.first; sce != NULL; sce = sce->id.next) {
if (sce->ed != NULL && sce->ed->seqbase.first != NULL) {
do_versions_seq_unique_name_all_strips(sce, &sce->ed->seqbase);
}
}
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "texture_paint_mode_opacity")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1805,8 +1781,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- if (!DNA_struct_elem_find(fd->filesdna, "View3DShadeing", "char", "background_type")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "background_type")) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1819,20 +1795,20 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_cubemap_draw_size")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->eevee.gi_irradiance_draw_size = 0.1f;
scene->eevee.gi_cubemap_draw_size = 0.3f;
}
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->toolsettings->gizmo_flag == 0) {
scene->toolsettings->gizmo_flag = SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "RigidBodyWorld", "RigidBodyWorld_Shared", "*shared")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
RigidBodyWorld *rbw = scene->rigidbody_world;
if (rbw == NULL) {
@@ -1858,7 +1834,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "SoftBody", "SoftBody_Shared", "*shared")) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
SoftBody *sb = ob->soft;
if (sb == NULL) {
continue;
@@ -1877,7 +1853,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "short", "type")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1894,13 +1870,13 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "View3DShading", "shading")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
BKE_screen_view3d_shading_init(&scene->display.shading);
}
}
/* initialize grease pencil view data */
if (!DNA_struct_elem_find(fd->filesdna, "SpaceView3D", "float", "vertex_opacity")) {
- for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1917,13 +1893,13 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 22)) {
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "annotate_v3d_align")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->toolsettings->annotate_v3d_align = GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR;
scene->toolsettings->annotate_thickness = 3;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "bGPDlayer", "short", "line_change")) {
- for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+ for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
gpl->line_change = gpl->thickness;
if ((gpl->thickness < 1) || (gpl->thickness > 10)) {
@@ -1933,7 +1909,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_paper_opacity")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1945,7 +1921,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_grid_opacity")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -1959,7 +1935,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* default loc axis */
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "int", "lock_axis")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* lock axis */
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
if (gset) {
@@ -1970,7 +1946,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Versioning code for Subsurf modifier. */
if (!DNA_struct_elem_find(fd->filesdna, "SubsurfModifier", "short", "uv_smooth")) {
- for (Object *object = bmain->object.first; object != NULL; object = object->id.next) {
+ for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
for (ModifierData *md = object->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Subsurf) {
SubsurfModifierData *smd = (SubsurfModifierData *)md;
@@ -1986,7 +1962,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "SubsurfModifier", "short", "quality")) {
- for (Object *object = bmain->object.first; object != NULL; object = object->id.next) {
+ for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
for (ModifierData *md = object->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Subsurf) {
SubsurfModifierData *smd = (SubsurfModifierData *)md;
@@ -1997,7 +1973,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
/* Versioning code for Multires modifier. */
if (!DNA_struct_elem_find(fd->filesdna, "MultiresModifier", "short", "quality")) {
- for (Object *object = bmain->object.first; object != NULL; object = object->id.next) {
+ for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
for (ModifierData *md = object->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Multires) {
MultiresModifierData *mmd = (MultiresModifierData *)md;
@@ -2014,11 +1990,18 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "short", "bending_model")) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+ ClothModifierData *clmd = NULL;
if (md->type == eModifierType_Cloth) {
- ClothModifierData *clmd = (ClothModifierData *)md;
-
+ clmd = (ClothModifierData *)md;
+ }
+ else if (md->type == eModifierType_ParticleSystem) {
+ ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
+ ParticleSystem *psys = psmd->psys;
+ clmd = psys->clmd;
+ }
+ if (clmd != NULL) {
clmd->sim_parms->bending_model = CLOTH_BENDING_LINEAR;
clmd->sim_parms->tension = clmd->sim_parms->structural;
clmd->sim_parms->compression = clmd->sim_parms->structural;
@@ -2036,7 +2019,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", "float", "era_strength_f")) {
- for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->gpencil_settings != NULL) {
BrushGpencilSettings *gp = brush->gpencil_settings;
if (gp->brush_type == GPAINT_TOOL_ERASE) {
@@ -2047,7 +2030,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData *)md;
@@ -2076,7 +2059,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 24)) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -2095,11 +2078,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
- }
- {
if (!DNA_struct_elem_find(fd->filesdna, "ShrinkwrapModifierData", "char", "shrinkMode")) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Shrinkwrap) {
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
@@ -2111,11 +2092,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
- }
- if (!MAIN_VERSION_ATLEAST(bmain, 280, 24)) {
if (!DNA_struct_elem_find(fd->filesdna, "PartDeflect", "float", "pdef_cfrict")) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->pd) {
ob->pd->pdef_cfrict = 5.0f;
}
@@ -2131,7 +2110,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "xray_alpha_wire")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -2142,7 +2121,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -2156,7 +2135,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 25)) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
UnitSettings *unit = &scene->unit;
if (unit->system != USER_UNIT_NONE) {
unit->length_unit = bUnit_GetBaseUnitOfType(scene->unit.system, B_UNIT_LENGTH);
@@ -2166,15 +2145,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
/* gpencil grid settings */
- for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+ for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
ARRAY_SET_ITEMS(gpd->grid.color, 0.5f, 0.5f, 0.5f); // Color
ARRAY_SET_ITEMS(gpd->grid.scale, 1.0f, 1.0f); // Scale
gpd->grid.lines = GP_DEFAULT_GRID_LINES; // Number of lines
}
}
- {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 29)) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -2188,13 +2167,11 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
- }
- if (!MAIN_VERSION_ATLEAST(bmain, 280, 29)) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_BUTS) {
+ if (sl->spacetype == SPACE_PROPERTIES) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
ARegion *ar = MEM_callocN(sizeof(ARegion), "navigation bar for properties");
ARegion *ar_header = NULL;
@@ -2217,7 +2194,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* grease pencil fade layer opacity */
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_fade_layer")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -2232,7 +2209,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 30)) {
/* grease pencil main material show switches */
- for (Material *mat = bmain->mat.first; mat; mat = mat->id.next) {
+ for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
if (mat->gp_style) {
mat->gp_style->flag |= GP_STYLE_STROKE_SHOW;
mat->gp_style->flag |= GP_STYLE_FILL_SHOW;
@@ -2247,7 +2224,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* sculpt brushes */
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
if (gset) {
@@ -2264,12 +2241,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "overscan")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->eevee.overscan = 3.0f;
}
}
- for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
+ for (Light *la = bmain->lights.first; la; la = la->id.next) {
/* Removed Hemi lights. */
if (!ELEM(la->type, LA_LOCAL, LA_SUN, LA_SPOT, LA_AREA)) {
la->type = LA_SUN;
@@ -2277,25 +2254,25 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "light_threshold")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->eevee.light_threshold = 0.01f;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_irradiance_smoothing")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->eevee.gi_irradiance_smoothing = 0.1f;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_filter_quality")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->eevee.gi_filter_quality = 1.0f;
}
}
- if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "att_dist")) {
- for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
+ if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "att_dist")) {
+ for (Light *la = bmain->lights.first; la; la = la->id.next) {
la->att_dist = la->clipend;
}
}
@@ -2325,7 +2302,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
#define PAINT_BLEND_ALPHA_SUB 19
#define PAINT_BLEND_ALPHA_ADD 20
- for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->ob_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
const char tool_init = brush->vertexpaint_tool;
bool is_blend = false;
@@ -2401,7 +2378,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 34)) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *area = screen->areabase.first; area; area = area->next) {
for (SpaceLink *slink = area->spacedata.first; slink; slink = slink->next) {
if (slink->spacetype == SPACE_USERPREF) {
@@ -2426,7 +2403,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 36)) {
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "curvature_ridge_factor")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -2440,7 +2417,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
/* Rename OpenGL to Workbench. */
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (STREQ(scene->r.engine, "BLENDER_OPENGL")) {
STRNCPY(scene->r.engine, RE_engine_id_BLENDER_WORKBENCH);
}
@@ -2448,7 +2425,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* init Annotations onion skin */
if (!DNA_struct_elem_find(fd->filesdna, "bGPDlayer", "int", "gstep")) {
- for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+ for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
ARRAY_SET_ITEMS(gpl->gcolor_prev, 0.302f, 0.851f, 0.302f);
ARRAY_SET_ITEMS(gpl->gcolor_next, 0.250f, 0.1f, 1.0f);
@@ -2458,7 +2435,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Move studio_light selection to lookdev_light. */
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "lookdev_light[256]")) {
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -2472,7 +2449,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Change Solid mode shadow orientation. */
if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "float", "shadow_focus")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
float *dir = scene->display.light_direction;
SWAP(float, dir[2], dir[1]);
dir[2] = -dir[2];
@@ -2482,10 +2459,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 280, 37)) {
- for (Camera *ca = bmain->camera.first; ca; ca = ca->id.next) {
+ for (Camera *ca = bmain->cameras.first; ca; ca = ca->id.next) {
ca->drawsize *= 2.0f;
}
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->type != OB_EMPTY) {
if (UNLIKELY(ob->transflag & OB_DUPLICOLLECTION)) {
BKE_object_type_set_empty_for_versioning(ob);
@@ -2495,7 +2472,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Grease pencil primitive curve */
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "CurveMapping", "cur_primitive")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
if ((gset) && (gset->cur_primitive == NULL)) {
gset->cur_primitive = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
@@ -2513,7 +2490,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 38)) {
if (DNA_struct_elem_find(fd->filesdna, "Object", "char", "empty_image_visibility_flag")) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
ob->empty_image_visibility_flag ^= (
OB_EMPTY_IMAGE_HIDE_PERSPECTIVE |
OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC |
@@ -2521,7 +2498,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *area = screen->areabase.first; area; area = area->next) {
for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
switch (sl->spacetype) {
@@ -2560,7 +2537,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
case SPACE_OUTLINER:
{
- SpaceOops *so = (SpaceOops *)sl;
+ SpaceOutliner *so = (SpaceOutliner *)sl;
so->filter &= ~(
SO_FILTER_DEPRECATED_1 |
SO_FILTER_DEPRECATED_5 |
@@ -2589,9 +2566,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
SNODE_FLAG_DEPRECATED_11);
break;
}
- case SPACE_BUTS:
+ case SPACE_PROPERTIES:
{
- SpaceButs *sbuts = (SpaceButs *)sl;
+ SpaceProperties *sbuts = (SpaceProperties *)sl;
sbuts->flag &= ~(
SB_FLAG_DEPRECATED_2 |
SB_FLAG_DEPRECATED_3);
@@ -2611,7 +2588,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->r.mode &= ~(
R_MODE_DEPRECATED_1 |
R_MODE_DEPRECATED_2 |
@@ -2664,7 +2641,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- for (World *world = bmain->world.first; world; world = world->id.next) {
+ for (World *world = bmain->worlds.first; world; world = world->id.next) {
world->flag &= ~(
WO_MODE_DEPRECATED_1 |
WO_MODE_DEPRECATED_2 |
@@ -2674,7 +2651,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
WO_MODE_DEPRECATED_7);
}
- for (Image *image = bmain->image.first; image; image = image->id.next) {
+ for (Image *image = bmain->images.first; image; image = image->id.next) {
image->flag &= ~(
IMA_FLAG_DEPRECATED_0 |
IMA_FLAG_DEPRECATED_1 |
@@ -2683,15 +2660,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
IMA_FLAG_DEPRECATED_8 |
IMA_FLAG_DEPRECATED_15 |
IMA_FLAG_DEPRECATED_16);
- image->tpageflag &= ~(
- IMA_TPAGEFLAG_DEPRECATED_0 |
- IMA_TPAGEFLAG_DEPRECATED_1 |
- IMA_TPAGEFLAG_DEPRECATED_2 |
- IMA_TPAGEFLAG_DEPRECATED_4 |
- IMA_TPAGEFLAG_DEPRECATED_5);
}
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
ob->flag &= ~(
OB_FLAG_DEPRECATED_11 |
OB_FLAG_DEPRECATED_12);
@@ -2701,7 +2672,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
ob->shapeflag &= ~OB_SHAPE_FLAG_DEPRECATED_1;
}
- for (Mesh *me = bmain->mesh.first; me; me = me->id.next) {
+ for (Mesh *me = bmain->meshes.first; me; me = me->id.next) {
me->flag &= ~(
ME_FLAG_DEPRECATED_0 |
ME_FLAG_DEPRECATED_1 |
@@ -2712,7 +2683,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
ME_FLAG_DEPRECATED_8);
}
- for (Material *mat = bmain->mat.first; mat; mat = mat->id.next) {
+ for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
mat->blend_flag &= ~(
MA_BL_FLAG_DEPRECATED_2);
}
@@ -2720,13 +2691,13 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 40)) {
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "snap_transform_mode_flag")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->toolsettings->snap_transform_mode_flag =
SCE_SNAP_TRANSFORM_MODE_TRANSLATE;
}
}
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *area = screen->areabase.first; area; area = area->next) {
for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
switch (sl->spacetype) {
@@ -2746,7 +2717,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!DNA_struct_find(fd->filesdna, "TransformOrientationSlot")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
scene->orientation_slots[i].index_custom = -1;
}
@@ -2755,7 +2726,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Grease pencil target weight */
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "float", "weight")) {
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* sculpt brushes */
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
if (gset) {
@@ -2767,14 +2738,24 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ /* Grease pencil cutter/select segment intersection threshold */
+ if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "float", "isect_threshold")) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+ GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
+ if (gset) {
+ gset->isect_threshold = 0.1f;
+ }
+ }
+ }
+
/* Fix anamorphic bokeh eevee rna limits.*/
- for (Camera *ca = bmain->camera.first; ca; ca = ca->id.next) {
+ for (Camera *ca = bmain->cameras.first; ca; ca = ca->id.next) {
if (ca->gpu_dof.ratio < 0.01f) {
ca->gpu_dof.ratio = 0.01f;
}
}
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *area = screen->areabase.first; area; area = area->next) {
for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_USERPREF) {
@@ -2800,6 +2781,124 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 43)) {
+ ListBase *lb = which_libbase(bmain, ID_BR);
+ BKE_main_id_repair_duplicate_names_listbase(lb);
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 44)) {
+ if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "a")) {
+ for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
+ mat->a = 1.0f;
+ }
+ }
+
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+ enum {
+ R_ALPHAKEY = 2,
+ };
+ scene->r.seq_flag &= ~(
+ R_SEQ_DEPRECATED_0 |
+ R_SEQ_DEPRECATED_1 |
+ R_SEQ_DEPRECATED_2);
+ scene->r.color_mgt_flag &= ~R_COLOR_MANAGEMENT_DEPRECATED_1;
+ if (scene->r.alphamode == R_ALPHAKEY) {
+ scene->r.alphamode = R_ADDSKY;
+ }
+ ToolSettings *ts = scene->toolsettings;
+ ts->particle.flag &= ~PE_DEPRECATED_6;
+ if (ts->sculpt != NULL) {
+ ts->sculpt->flags &= ~SCULPT_FLAG_DEPRECATED_6;
+ }
+ }
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 45)) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *area = screen->areabase.first; area; area = area->next) {
+ for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_SEQ) {
+ SpaceSeq *sseq = (SpaceSeq *)sl;
+ sseq->flag |= SEQ_SHOW_MARKER_LINES;
+ }
+ }
+ }
+ }
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 46)) {
+ /* Add wireframe color. */
+ if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "wire_color_type")) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->shading.wire_color_type = V3D_SHADING_SINGLE_COLOR;
+ }
+ }
+ }
+ }
+ }
+
+ if (!DNA_struct_elem_find(fd->filesdna, "View3DCursor", "short", "rotation_mode")) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+ if (is_zero_v3(scene->cursor.rotation_axis)) {
+ scene->cursor.rotation_mode = ROT_MODE_XYZ;
+ scene->cursor.rotation_quaternion[0] = 1.0f;
+ scene->cursor.rotation_axis[1] = 1.0f;
+ }
+ }
+ }
+ }
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 47)) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ ParticleEditSettings *pset = &scene->toolsettings->particle;
+ if (pset->brushtype < 0) {
+ pset->brushtype = PE_BRUSH_COMB;
+ }
+ }
+
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ {
+ enum { PARCURVE = 1, PARKEY = 2, PAR_DEPRECATED = 16};
+ if (ELEM(ob->partype, PARCURVE, PARKEY, PAR_DEPRECATED)) {
+ ob->partype = PAROBJECT;
+ }
+ }
+
+ {
+ enum { OB_WAVE = 21, OB_LIFE = 23, OB_SECTOR = 24};
+ if (ELEM(ob->type, OB_WAVE, OB_LIFE, OB_SECTOR)) {
+ ob->type = OB_EMPTY;
+ }
+ }
+
+ ob->transflag &= ~(
+ OB_TRANSFLAG_DEPRECATED_0 |
+ OB_TRANSFLAG_DEPRECATED_1 |
+ OB_TRANSFLAG_DEPRECATED_3 |
+ OB_TRANSFLAG_DEPRECATED_6 |
+ OB_TRANSFLAG_DEPRECATED_12);
+
+ ob->nlaflag &= ~(OB_ADS_DEPRECATED_1 | OB_ADS_DEPRECATED_2);
+ }
+
+ LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
+ arm->flag &= ~(
+ ARM_FLAG_DEPRECATED_1 |
+ ARM_FLAG_DEPRECATED_5 |
+ ARM_FLAG_DEPRECATED_7 |
+ ARM_FLAG_DEPRECATED_12);
+ }
+
+ LISTBASE_FOREACH (Text *, text, &bmain->texts) {
+ enum { TXT_READONLY = 1 << 8, TXT_FOLLOW = 1 << 9};
+ text->flags &= ~(TXT_READONLY | TXT_FOLLOW);
+ }
+ }
+
{
/* Versioning code until next subversion bump goes here. */
}
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index cc677ad10a0..1f8bf3724db 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenloader/intern/versioning_defaults.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
#include "MEM_guardedalloc.h"
@@ -44,6 +37,7 @@
#include "BKE_appdir.h"
#include "BKE_brush.h"
+#include "BKE_colorband.h"
#include "BKE_colortools.h"
#include "BKE_idprop.h"
#include "BKE_keyconfig.h"
@@ -103,17 +97,50 @@ void BLO_update_defaults_userpref_blend(void)
/* Auto perspective. */
U.uiflag |= USER_AUTOPERSP;
+ /* Init weight paint range. */
+ BKE_colorband_init(&U.coba_weight, true);
+
+ /* Default visible section. */
+ U.userpref = USER_SECTION_INTERFACE;
+
/* Default to left click select. */
BKE_keyconfig_pref_set_select_mouse(&U, 0, true);
}
+
+/**
+ * Rename if the ID doesn't exist.
+ */
+static ID *rename_id_for_versioning(Main *bmain, const short id_type, const char *name_src, const char *name_dst)
+{
+ /* We can ignore libraries */
+ ListBase *lb = which_libbase(bmain, id_type);
+ ID *id = NULL;
+ for (ID *idtest = lb->first; idtest; idtest = idtest->next) {
+ if (idtest->lib == NULL) {
+ if (STREQ(idtest->name + 2, name_src)) {
+ id = idtest;
+ }
+ if (STREQ(idtest->name + 2, name_dst)) {
+ return NULL;
+ }
+ }
+ }
+ if (id != NULL) {
+ BLI_strncpy(id->name + 2, name_dst, sizeof(id->name) - 2);
+ /* We know it's unique, this just sorts. */
+ BLI_libblock_ensure_unique_name(bmain, id->name);
+ }
+ return id;
+}
+
/**
* Update defaults in startup.blend, without having to save and embed the file.
* This function can be emptied each time the startup.blend is updated. */
void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
{
/* For all startup.blend files. */
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
/* Remove all stored panels, we want to use defaults (order, open/closed) as defined by UI code here! */
@@ -137,6 +164,10 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
/* grease pencil settings */
v3d->vertex_opacity = 1.0f;
v3d->gp_flag |= V3D_GP_SHOW_EDIT_LINES;
+ /* Skip startups that use the viewport color by default. */
+ if (v3d->shading.background_type != V3D_SHADING_BACKGROUND_VIEWPORT) {
+ copy_v3_fl(v3d->shading.background_color, 0.05f);
+ }
break;
}
case SPACE_FILE:
@@ -165,12 +196,13 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
WorkSpaceLayout *layout = BKE_workspace_hook_layout_for_workspace_get(win->workspace_hook, workspace);
bScreen *screen = layout->screen;
BLI_strncpy(screen->id.name + 2, workspace->id.name + 2, sizeof(screen->id.name) - 2);
+ BLI_libblock_ensure_unique_name(bmain, screen->id.name);
}
}
{
/* 'UV Editing' should use UV mode. */
- bScreen *screen = BLI_findstring(&bmain->screen, "UV Editing", offsetof(ID, name) + 2);
+ bScreen *screen = BLI_findstring(&bmain->screens, "UV Editing", offsetof(ID, name) + 2);
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_IMAGE) {
@@ -194,7 +226,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
}
}
/* set object in drawing mode */
- for (Object *object = bmain->object.first; object; object = object->id.next) {
+ for (Object *object = bmain->objects.first; object; object = object->id.next) {
if (object->type == OB_GPENCIL) {
bGPdata *gpd = (bGPdata *)object->data;
object->mode = OB_MODE_PAINT_GPENCIL;
@@ -204,7 +236,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
}
/* Be sure curfalloff and primitive are initializated */
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
if (ts->gp_sculpt.cur_falloff == NULL) {
ts->gp_sculpt.cur_falloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
@@ -245,7 +277,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
}
}
- for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
/* Hide channels in timelines. */
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
SpaceAction *saction = (sa->spacetype == SPACE_ACTION) ? sa->spacedata.first : NULL;
@@ -260,14 +292,19 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
}
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine));
scene->r.cfra = 1.0f;
scene->r.displaymode = R_OUTPUT_WINDOW;
- /* AV Sync break physics sim caching, disable until that is fixed. */
- if (!(app_template && STREQ(app_template, "Video_Editing"))) {
+ if (app_template && STREQ(app_template, "Video_Editing")) {
+ /* Filmic is too slow, use default until it is optimized. */
+ STRNCPY(scene->view_settings.view_transform, "Default");
+ STRNCPY(scene->view_settings.look, "None");
+ }
+ else {
+ /* AV Sync break physics sim caching, disable until that is fixed. */
scene->audio.flag &= ~AUDIO_SYNC;
scene->flag &= ~SCE_FRAME_DROP;
}
@@ -282,57 +319,24 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
/* Rename render layers. */
BKE_view_layer_rename(bmain, scene, scene->view_layers.first, "View Layer");
- }
- /* Rename lamp objects. */
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
- if (STREQ(ob->id.name, "OBLamp")) {
- STRNCPY(ob->id.name, "OBLight");
- }
- }
- for (Lamp *lamp = bmain->lamp.first; lamp; lamp = lamp->id.next) {
- if (STREQ(lamp->id.name, "LALamp")) {
- STRNCPY(lamp->id.name, "LALight");
- }
+ /* New EEVEE defaults. */
+ scene->eevee.bloom_intensity = 0.05f;
+ scene->eevee.bloom_clamp = 0.0f;
+ scene->eevee.motion_blur_shutter = 0.5f;
}
- for (Mesh *mesh = bmain->mesh.first; mesh; mesh = mesh->id.next) {
+ /* Rename light objects. */
+ rename_id_for_versioning(bmain, ID_OB, "Light", "Light");
+ rename_id_for_versioning(bmain, ID_LA, "Light", "Light");
+
+ for (Mesh *mesh = bmain->meshes.first; mesh; mesh = mesh->id.next) {
/* Match default for new meshes. */
mesh->smoothresh = DEG2RADF(30);
}
-
- /* Grease Pencil New Eraser Brush */
- Brush *br;
- /* Rename old Hard Eraser */
- br = (Brush *)BKE_libblock_find_name(bmain, ID_BR, "Eraser Hard");
- if (br) {
- strcpy(br->id.name, "BREraser Point");
- }
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
- ToolSettings *ts = scene->toolsettings;
- /* create new hard brush (only create one, but need ToolSettings) */
- br = (Brush *)BKE_libblock_find_name(bmain, ID_BR, "Eraser Hard");
- if (!br) {
- Paint *paint = &ts->gp_paint->paint;
- Brush *old_brush = paint->brush;
-
- br = BKE_brush_add_gpencil(bmain, ts, "Eraser Hard");
- br->size = 30.0f;
- br->gpencil_settings->draw_strength = 1.0f;
- br->gpencil_settings->flag = (GP_BRUSH_ENABLE_CURSOR | GP_BRUSH_DEFAULT_ERASER);
- br->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_HARD;
- br->gpencil_tool = GPAINT_TOOL_ERASE;
- br->gpencil_settings->eraser_mode = GP_BRUSH_ERASER_SOFT;
- br->gpencil_settings->era_strength_f = 100.0f;
- br->gpencil_settings->era_thickness_f = 50.0f;
-
- /* back to default brush */
- BKE_paint_brush_set(paint, old_brush);
- }
- }
}
- for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
@@ -343,7 +347,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
}
}
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
copy_v3_v3(scene->display.light_direction, (float[3]){M_SQRT1_3, M_SQRT1_3, M_SQRT1_3});
copy_v2_fl2(scene->safe_areas.title, 0.1f, 0.05f);
copy_v2_fl2(scene->safe_areas.action, 0.035f, 0.035f);
diff --git a/source/blender/blenloader/intern/versioning_dna.c b/source/blender/blenloader/intern/versioning_dna.c
new file mode 100644
index 00000000000..8032f4c6b51
--- /dev/null
+++ b/source/blender/blenloader/intern/versioning_dna.c
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/** \file
+ * \ingroup blenloader
+ *
+ * Apply edits to DNA at load time to behave as if old files were written with new names.
+ */
+
+#include "BLI_compiler_attrs.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_genfile.h"
+#include "DNA_listBase.h"
+
+#include "BLO_readfile.h"
+#include "readfile.h"
+
+/**
+ * Manipulates SDNA before calling #DNA_struct_get_compareflags,
+ * allowing us to rename structs and struct members.
+ *
+ * - This means older versions of Blender won't have access to this data **USE WITH CARE**.
+ *
+ * - These changes are applied on file load (run-time), similar to versioning for compatibility.
+ *
+ * \attention ONLY USE THIS KIND OF VERSIONING WHEN `dna_rename_defs.h` ISN'T SUFFICIENT.
+ */
+void blo_do_versions_dna(SDNA *sdna, const int versionfile, const int subversionfile)
+{
+#define DNA_VERSION_ATLEAST(ver, subver) \
+ (versionfile > (ver) || (versionfile == (ver) && (subversionfile >= (subver))))
+
+ if (!DNA_VERSION_ATLEAST(280, 2)) {
+ /* Version files created in the 'blender2.8' branch
+ * between October 2016, and November 2017 (>=280.0 and < 280.2). */
+ if (versionfile >= 280) {
+ DNA_sdna_patch_struct(sdna, "SceneLayer", "ViewLayer");
+ DNA_sdna_patch_struct(sdna, "SceneLayerEngineData", "ViewLayerEngineData");
+ DNA_sdna_patch_struct_member(sdna, "FileGlobal", "cur_render_layer", "cur_view_layer");
+ DNA_sdna_patch_struct_member(sdna, "ParticleEditSettings", "scene_layer", "view_layer");
+ DNA_sdna_patch_struct_member(sdna, "Scene", "active_layer", "active_view_layer");
+ DNA_sdna_patch_struct_member(sdna, "Scene", "render_layers", "view_layers");
+ DNA_sdna_patch_struct_member(sdna, "WorkSpace", "render_layer", "view_layer");
+ }
+ }
+
+#undef DNA_VERSION_ATLEAST
+}
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index 6f1954b7e62..5d7905b200e 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenloader/intern/versioning_legacy.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
@@ -51,7 +43,7 @@
#include "DNA_effect_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -487,7 +479,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile == 100) {
/* tex->extend and tex->imageflag have changed: */
- Tex *tex = bmain->tex.first;
+ Tex *tex = bmain->textures.first;
while (tex) {
if (tex->id.tag & LIB_TAG_NEED_LINK) {
@@ -508,7 +500,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 101) {
/* frame mapping */
- Scene *sce = bmain->scene.first;
+ Scene *sce = bmain->scenes.first;
while (sce) {
sce->r.framapto = 100;
sce->r.images = 100;
@@ -519,7 +511,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 103) {
/* new variable in object: colbits */
- Object *ob = bmain->object.first;
+ Object *ob = bmain->objects.first;
int a;
while (ob) {
ob->colbits = 0;
@@ -535,7 +527,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 104) {
/* timeoffs moved */
- Object *ob = bmain->object.first;
+ Object *ob = bmain->objects.first;
while (ob) {
if (ob->transflag & 1) {
ob->transflag -= 1;
@@ -544,20 +536,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- if (bmain->versionfile <= 105) {
- Object *ob = bmain->object.first;
- while (ob) {
- ob->dupon = 1;
- ob->dupoff = 0;
- ob->dupsta = 1;
- ob->dupend = 100;
- ob = ob->id.next;
- }
- }
-
if (bmain->versionfile <= 106) {
/* mcol changed */
- Mesh *me = bmain->mesh.first;
+ Mesh *me = bmain->meshes.first;
while (me) {
if (me->mcol)
vcol_to_fcol(me);
@@ -568,7 +549,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 107) {
Object *ob;
- ob = bmain->object.first;
+ ob = bmain->objects.first;
while (ob) {
if (ob->dt == 0)
ob->dt = OB_SOLID;
@@ -579,7 +560,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 109) {
/* new variable: gridlines */
- bScreen *sc = bmain->screen.first;
+ bScreen *sc = bmain->screens.first;
while (sc) {
ScrArea *sa = sc->areabase.first;
while (sa) {
@@ -600,7 +581,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 134) {
- Tex *tex = bmain->tex.first;
+ Tex *tex = bmain->textures.first;
while (tex) {
if ((tex->rfac == 0.0f) &&
(tex->gfac == 0.0f) &&
@@ -617,7 +598,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 140) {
/* r-g-b-fac in texture */
- Tex *tex = bmain->tex.first;
+ Tex *tex = bmain->textures.first;
while (tex) {
if ((tex->rfac == 0.0f) &&
(tex->gfac == 0.0f) &&
@@ -633,7 +614,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 153) {
- Scene *sce = bmain->scene.first;
+ Scene *sce = bmain->scenes.first;
while (sce) {
if (sce->r.blurfac == 0.0f)
sce->r.blurfac = 1.0f;
@@ -642,7 +623,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 163) {
- Scene *sce = bmain->scene.first;
+ Scene *sce = bmain->scenes.first;
while (sce) {
if (sce->r.frs_sec == 0)
sce->r.frs_sec = 25;
@@ -651,7 +632,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 164) {
- Mesh *me = bmain->mesh.first;
+ Mesh *me = bmain->meshes.first;
while (me) {
me->smoothresh = 30;
me = me->id.next;
@@ -659,7 +640,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 165) {
- Mesh *me = bmain->mesh.first;
+ Mesh *me = bmain->meshes.first;
TFace *tface;
int nr;
char *cp;
@@ -686,7 +667,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 169) {
- Mesh *me = bmain->mesh.first;
+ Mesh *me = bmain->meshes.first;
while (me) {
if (me->subdiv == 0)
me->subdiv = 1;
@@ -695,14 +676,14 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 169) {
- bScreen *sc = bmain->screen.first;
+ bScreen *sc = bmain->screens.first;
while (sc) {
ScrArea *sa = sc->areabase.first;
while (sa) {
SpaceLink *sl = sa->spacedata.first;
while (sl) {
- if (sl->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ if (sl->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = (SpaceGraph *)sl;
sipo->v2d.max[0] = 15000.0;
}
sl = sl->next;
@@ -714,7 +695,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 170) {
- Object *ob = bmain->object.first;
+ Object *ob = bmain->objects.first;
PartEff *paf;
while (ob) {
paf = blo_do_version_give_parteff_245(ob);
@@ -728,7 +709,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 171) {
- bScreen *sc = bmain->screen.first;
+ bScreen *sc = bmain->screens.first;
while (sc) {
ScrArea *sa = sc->areabase.first;
while (sa) {
@@ -748,7 +729,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 173) {
int a, b;
- Mesh *me = bmain->mesh.first;
+ Mesh *me = bmain->meshes.first;
while (me) {
if (me->tface) {
TFace *tface = me->tface;
@@ -766,7 +747,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 204) {
bSound *sound;
- sound = bmain->sound.first;
+ sound = bmain->sounds.first;
while (sound) {
if (sound->volume < 0.01f) {
sound->volume = 1.0f;
@@ -779,7 +760,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bSound *sound;
Mesh *me;
- sound = bmain->sound.first;
+ sound = bmain->sounds.first;
while (sound) {
sound->max_gain = 1.0;
sound->min_gain = 0.0;
@@ -798,7 +779,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
* it a subsurf, and reset the subdiv level because subsurf
* takes a lot more work to calculate.
*/
- for (me = bmain->mesh.first; me; me = me->id.next) {
+ for (me = bmain->meshes.first; me; me = me->id.next) {
enum {
ME_SMESH = (1 << 6),
ME_SUBSURF = (1 << 7),
@@ -825,7 +806,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
* old file vertex colors are undefined, reset them
* to be fully opaque. -zr
*/
- for (me = bmain->mesh.first; me; me = me->id.next) {
+ for (me = bmain->meshes.first; me; me = me->id.next) {
if (me->mcol) {
int i;
@@ -852,7 +833,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 223) {
VFont *vf;
- for (vf = bmain->vfont.first; vf; vf = vf->id.next) {
+ for (vf = bmain->fonts.first; vf; vf = vf->id.next) {
if (STREQ(vf->name + strlen(vf->name) - 6, ".Bfont")) {
strcpy(vf->name, FO_BUILTIN_NAME);
}
@@ -865,7 +846,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Mesh *me;
bScreen *sc;
- for (sound = bmain->sound.first; sound; sound = sound->id.next) {
+ for (sound = bmain->sounds.first; sound; sound = sound->id.next) {
if (sound->packedfile) {
if (sound->newpackedfile == NULL) {
sound->newpackedfile = sound->packedfile;
@@ -874,26 +855,26 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
/* Make sure that old subsurf meshes don't have zero subdivision level for rendering */
- for (me = bmain->mesh.first; me; me = me->id.next) {
+ for (me = bmain->meshes.first; me; me = me->id.next) {
enum { ME_SUBSURF = (1 << 7) };
if ((me->flag & ME_SUBSURF) && (me->subdivr == 0)) {
me->subdivr = me->subdiv;
}
}
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
sce->r.stereomode = 1; // no stereo
}
/* some oldfile patch, moved from set_func_space */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
for (sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_IPO) {
+ if (sl->spacetype == SPACE_GRAPH) {
SpaceSeq *sseq = (SpaceSeq *)sl;
sseq->v2d.keeptot = 0;
}
@@ -910,7 +891,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* As of now, this insures that the transition from the old Track system
* to the new full constraint Track is painless for everyone. - theeth
*/
- ob = bmain->object.first;
+ ob = bmain->objects.first;
while (ob) {
ListBase *list;
@@ -953,13 +934,13 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
ob = ob->id.next;
}
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
sce->audio.mixrate = 48000;
sce->audio.flag |= AUDIO_SCRUB;
}
/* patch for old wrong max view2d settings, allows zooming out more */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
@@ -986,7 +967,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* As of now, this insures that the transition from the old Track system
* to the new full constraint Track is painless for everyone.
*/
- ob = bmain->object.first;
+ ob = bmain->objects.first;
while (ob) {
ListBase *list;
@@ -1026,15 +1007,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
/* convert old mainb values for new button panels */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
for (sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_BUTS) {
- SpaceButs *sbuts = (SpaceButs *)sl;
+ if (sl->spacetype == SPACE_PROPERTIES) {
+ SpaceProperties *sbuts = (SpaceProperties *)sl;
sbuts->v2d.maxzoom = 1.2f;
@@ -1096,7 +1077,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bScreen *sc;
/* new variable blockscale, for panels in any area */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
@@ -1114,7 +1095,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 231) {
- bScreen *sc = bmain->screen.first;
+ bScreen *sc = bmain->screens.first;
/* new bit flags for showing/hiding grid floor and axes */
@@ -1142,8 +1123,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 232) {
- Tex *tex = bmain->tex.first;
- World *wrld = bmain->world.first;
+ Tex *tex = bmain->textures.first;
+ World *wrld = bmain->worlds.first;
bScreen *sc;
while (tex) {
@@ -1180,7 +1161,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* new variable blockscale, for panels in any area, do again because new
* areas didnt initialize it to 0.7 yet
*/
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1197,16 +1178,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 233) {
bScreen *sc;
- Material *ma = bmain->mat.first;
- /* Object *ob = bmain->object.first; */
-
- while (ma) {
- if (ma->pr_lamp == 0)
- ma->pr_lamp = 3;
- ma = ma->id.next;
- }
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1223,7 +1196,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 234) {
bScreen *sc;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1239,8 +1212,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 235) {
- Tex *tex = bmain->tex.first;
- Scene *sce = bmain->scene.first;
+ Tex *tex = bmain->textures.first;
+ Scene *sce = bmain->scenes.first;
Sequence *seq;
Editing *ed;
@@ -1265,7 +1238,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 236) {
Object *ob;
- Camera *cam = bmain->camera.first;
+ Camera *cam = bmain->cameras.first;
while (cam) {
if (cam->ortho_scale == 0.0f) {
@@ -1279,7 +1252,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* set time line var */
/* softbody init new vars */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->soft) {
if (ob->soft->defgoal == 0.0f)
ob->soft->defgoal = 0.7f;
@@ -1309,13 +1282,13 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Bone *bone;
/* armature recode checks */
- for (arm = bmain->armature.first; arm; arm = arm->id.next) {
+ for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
BKE_armature_where_is(arm);
for (bone = arm->bonebase.first; bone; bone = bone->next)
do_version_bone_head_tail_237(bone);
}
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->parent) {
Object *parent = blo_do_versions_newlibadr(fd, lib, ob->parent);
if (parent && parent->type == OB_LATTICE)
@@ -1332,6 +1305,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* new generic xray option */
arm = blo_do_versions_newlibadr(fd, lib, ob->data);
+ enum { ARM_DRAWXRAY = (1 << 1) };
if (arm->flag & ARM_DRAWXRAY) {
ob->dtx |= OB_DRAWXRAY;
}
@@ -1388,7 +1362,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bArmature *arm;
Mesh *me;
Key *key;
- Scene *sce = bmain->scene.first;
+ Scene *sce = bmain->scenes.first;
while (sce) {
if (sce->toolsettings == NULL) {
@@ -1398,7 +1372,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
sce = sce->id.next;
}
- for (lt = bmain->latt.first; lt; lt = lt->id.next) {
+ for (lt = bmain->lattices.first; lt; lt = lt->id.next) {
if (lt->fu == 0.0f && lt->fv == 0.0f && lt->fw == 0.0f) {
calc_lat_fudu(lt->flag, lt->pntsu, &lt->fu, &lt->du);
calc_lat_fudu(lt->flag, lt->pntsv, &lt->fv, &lt->dv);
@@ -1406,7 +1380,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
PartEff *paf;
@@ -1473,12 +1447,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (arm = bmain->armature.first; arm; arm = arm->id.next) {
+ for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
bone_version_238(&arm->bonebase);
arm->deformflag |= ARM_DEF_VGROUP;
}
- for (me = bmain->mesh.first; me; me = me->id.next) {
+ for (me = bmain->meshes.first; me; me = me->id.next) {
if (!me->medge) {
BKE_mesh_calc_edges_legacy(me, true); /* true = use mface->edcode */
}
@@ -1487,7 +1461,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (key = bmain->key.first; key; key = key->id.next) {
+ for (key = bmain->shapekeys.first; key; key = key->id.next) {
KeyBlock *kb;
int index = 1;
@@ -1509,12 +1483,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 239) {
bArmature *arm;
Object *ob;
- Scene *sce = bmain->scene.first;
- Camera *cam = bmain->camera.first;
+ Scene *sce = bmain->scenes.first;
+ Camera *cam = bmain->cameras.first;
int set_passepartout = 0;
/* deformflag is local in modifier now */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.first; md; md = md->next) {
@@ -1530,9 +1504,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
/* updating stepsize for ghost drawing */
- for (arm = bmain->armature.first; arm; arm = arm->id.next) {
- if (arm->ghostsize == 0)
- arm->ghostsize = 1;
+ for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
bone_version_239(&arm->bonebase);
if (arm->layer == 0)
arm->layer = 1;
@@ -1562,17 +1534,17 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 241) {
Object *ob;
Scene *sce;
- Lamp *la;
+ Light *la;
bArmature *arm;
bNodeTree *ntree;
/* updating layers still */
- for (arm = bmain->armature.first; arm; arm = arm->id.next) {
+ for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
bone_version_239(&arm->bonebase);
if (arm->layer == 0)
arm->layer = 1;
}
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->audio.mixrate == 0)
sce->audio.mixrate = 48000;
@@ -1599,15 +1571,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next)
ntree_version_241(ntree);
- for (la = bmain->lamp.first; la; la = la->id.next)
+ for (la = bmain->lights.first; la; la = la->id.next)
if (la->buffers == 0)
la->buffers = 1;
/* for empty drawsize and drawtype */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->empty_drawsize == 0.0f) {
ob->empty_drawtype = OB_ARROWS;
ob->empty_drawsize = 1.0;
@@ -1617,7 +1589,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* during 2.41 images with this name were used for viewer node output, lets fix that */
if (bmain->versionfile == 241) {
Image *ima;
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
if (STREQ(ima->name, "Compositor")) {
strcpy(ima->id.name + 2, "Viewer Node");
strcpy(ima->name, "Viewer Node");
@@ -1640,7 +1612,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bNodeTree *ntree;
int a;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
sa = sc->areabase.first;
while (sa) {
@@ -1657,7 +1629,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
enum {
R_THREADS = (1 << 19),
};
@@ -1673,11 +1645,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
ntree_version_242(sce->nodetree);
}
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next)
ntree_version_242(ntree);
/* add default radius values to old curve points */
- for (cu = bmain->curve.first; cu; cu = cu->id.next) {
+ for (cu = bmain->curves.first; cu; cu = cu->id.next) {
for (nu = cu->nurb.first; nu; nu = nu->next) {
if (nu) {
if (nu->bezt) {
@@ -1696,7 +1668,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
ListBase *list;
list = &ob->constraints;
@@ -1784,15 +1756,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
- for (ma = bmain->mat.first; ma; ma = ma->id.next) {
+ for (ma = bmain->materials.first; ma; ma = ma->id.next) {
if (ma->nodetree)
ntree_version_242(ma->nodetree);
}
- for (me = bmain->mesh.first; me; me = me->id.next)
+ for (me = bmain->meshes.first; me; me = me->id.next)
customdata_version_242(me);
- for (collection = bmain->collection.first; collection; collection = collection->id.next)
+ for (collection = bmain->collections.first; collection; collection = collection->id.next)
if (collection->layer == 0)
collection->layer = (1 << 20) - 1;
@@ -1802,7 +1774,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Tex *tex;
/* Image refactor initialize */
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
ima->source = IMA_SRC_FILE;
ima->type = IMA_TYPE_IMAGE;
@@ -1819,7 +1791,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (tex = bmain->tex.first; tex; tex = tex->id.next) {
+ for (tex = bmain->textures.first; tex; tex = tex->id.next) {
enum {
TEX_ANIMCYCLIC = (1 << 6),
TEX_ANIM5 = (1 << 7),
@@ -1836,19 +1808,19 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
tex->iuser.sfra = tex->sfra;
tex->iuser.cycl = (tex->imaflag & TEX_ANIMCYCLIC) != 0;
}
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree)
do_version_ntree_242_2(sce->nodetree);
}
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next)
do_version_ntree_242_2(ntree);
- for (ma = bmain->mat.first; ma; ma = ma->id.next)
+ for (ma = bmain->materials.first; ma; ma = ma->id.next)
if (ma->nodetree)
do_version_ntree_242_2(ma->nodetree);
}
if (bmain->subversionfile < 4) {
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
sce->r.bake_mode = 1; /* prevent to include render stuff here */
sce->r.bake_filter = 16;
sce->r.bake_flag = R_BAKE_CLEAR;
@@ -1857,7 +1829,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile <= 243) {
- Object *ob = bmain->object.first;
+ Object *ob = bmain->objects.first;
for (; ob; ob = ob->id.next) {
bDeformGroup *curdef;
@@ -1898,7 +1870,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* render layer added, this is not the active layer */
if (bmain->versionfile <= 243 || bmain->subversionfile < 2) {
Mesh *me;
- for (me = bmain->mesh.first; me; me = me->id.next)
+ for (me = bmain->meshes.first; me; me = me->id.next)
customdata_version_243(me);
}
@@ -1909,7 +1881,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile != 244 || bmain->subversionfile < 2) {
/* correct older action editors - incorrect scrolling */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
sa = sc->areabase.first;
while (sa) {
@@ -1936,7 +1908,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Scene *sce;
Object *ob;
Image *ima;
- Lamp *la;
+ Light *la;
Material *ma;
ParticleSettings *part;
Mesh *me;
@@ -1949,7 +1921,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (!(bmain->versionfile == 244 && bmain->subversionfile == 3) &&
((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile == 0)) )
{
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ListBase *list;
list = &ob->constraints;
@@ -2019,13 +1991,13 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile != 245) {
/* repair preview from 242 - 244*/
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
ima->preview = NULL;
}
}
/* add point caches */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->soft && !ob->soft->pointcache)
ob->soft->pointcache = BKE_ptcache_add(&ob->soft->ptcaches);
@@ -2053,7 +2025,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* Copy over old per-level multires vertex data
* into a single vertex array in struct Multires */
- for (me = bmain->mesh.first; me; me = me->id.next) {
+ for (me = bmain->meshes.first; me; me = me->id.next) {
if (me->mr && !me->mr->verts) {
MultiresLevel *lvl = me->mr->levels.last;
if (lvl) {
@@ -2069,7 +2041,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile != 245 || bmain->subversionfile < 1) {
- for (la = bmain->lamp.first; la; la = la->id.next) {
+ for (la = bmain->lights.first; la; la = la->id.next) {
la->falloff_type = LA_FALLOFF_INVLINEAR;
if (la->curfalloff == NULL) {
@@ -2079,18 +2051,18 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (ma = bmain->mat.first; ma; ma = ma->id.next) {
+ for (ma = bmain->materials.first; ma; ma = ma->id.next) {
if (ma->gloss_mir == 0.0f) {
ma->gloss_mir = 1.0f;
}
}
- for (part = bmain->particle.first; part; part = part->id.next) {
+ for (part = bmain->particles.first; part; part = part->id.next) {
if (part->ren_child_nbr == 0)
part->ren_child_nbr = part->child_nbr;
}
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree)
ntree_version_245(fd, lib, sce->nodetree);
@@ -2100,18 +2072,18 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
+ for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next)
ntree_version_245(fd, lib, ntree);
/* fix for temporary flag changes during 245 cycle */
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
if (ima->flag & IMA_OLD_PREMUL) {
ima->flag &= ~IMA_OLD_PREMUL;
ima->alpha_mode = IMA_ALPHA_STRAIGHT;
}
}
- for (tex = bmain->tex.first; tex; tex = tex->id.next) {
+ for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->iuser.flag & IMA_OLD_PREMUL) {
tex->iuser.flag &= ~IMA_OLD_PREMUL;
}
@@ -2128,7 +2100,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Image *ima;
/* initialize 1:1 Aspect */
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
ima->aspx = ima->aspy = 1.0f;
}
}
@@ -2138,10 +2110,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
ModifierData *md;
Object *ob;
- for (arm = bmain->armature.first; arm; arm = arm->id.next)
+ for (arm = bmain->armatures.first; arm; arm = arm->id.next)
arm->deformflag |= ARM_DEF_B_BONE_REST;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.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;
@@ -2152,7 +2124,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 5)) {
/* foreground color needs to be something other then black */
Scene *sce;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.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; /* don't use text alpha yet */
sce->r.bg_stamp[3] = 0.25f; /* make sure the background has full alpha */
@@ -2163,7 +2135,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 6)) {
Scene *sce;
/* fix frs_sec_base */
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->r.frs_sec_base == 0) {
sce->r.frs_sec_base = 1;
}
@@ -2174,7 +2146,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Object *ob;
bPoseChannel *pchan;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->pose) {
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
do_version_constraints_245(&pchan->constraints);
@@ -2204,7 +2176,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Object *ob;
PartEff *paf = NULL;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->soft && ob->soft->keys) {
SoftBody *sb = ob->soft;
int k;
@@ -2311,11 +2283,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* dupliobjects */
if (ob->transflag & OB_DUPLIVERTS) {
- Object *dup = bmain->object.first;
+ Object *dup = bmain->objects.first;
for (; dup; dup = dup->id.next) {
if (ob == blo_do_versions_newlibadr(fd, lib, dup->parent)) {
- part->dup_ob = dup;
+ part->instance_object = dup;
ob->transflag |= OB_DUPLIPARTS;
ob->transflag &= ~OB_DUPLIVERTS;
@@ -2339,7 +2311,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
}
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
ParticleEditSettings *pset = &sce->toolsettings->particle;
int a;
@@ -2348,7 +2320,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
pset->emitterdist = 0.25f;
pset->totrekey = 5;
pset->totaddkey = 5;
- pset->brushtype = PE_BRUSH_NONE;
for (a = 0; a < ARRAY_SIZE(pset->brush); a++) {
pset->brush[a].strength = 50;
@@ -2365,8 +2336,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Object *ob;
/* dupliface scale */
- for (ob = bmain->object.first; ob; ob = ob->id.next)
- ob->dupfacesca = 1.0f;
+ for (ob = bmain->objects.first; ob; ob = ob->id.next)
+ ob->instance_faces_scale = 1.0f;
}
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) {
@@ -2374,7 +2345,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bActionStrip *strip;
/* nla-strips - scale */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
for (strip = ob->nlastrips.first; strip; strip = strip->next) {
float length, actlength, repeat;
@@ -2403,7 +2374,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Scene *sce;
Sequence *seq;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
SEQ_BEGIN (sce->ed, seq)
{
if (seq->blend_mode == 0)
@@ -2414,38 +2385,38 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* fix broken group lengths in id properties */
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 15)) {
- idproperties_fix_group_lengths(bmain->scene);
- idproperties_fix_group_lengths(bmain->library);
- idproperties_fix_group_lengths(bmain->object);
- idproperties_fix_group_lengths(bmain->mesh);
- idproperties_fix_group_lengths(bmain->curve);
- idproperties_fix_group_lengths(bmain->mball);
- idproperties_fix_group_lengths(bmain->mat);
- idproperties_fix_group_lengths(bmain->tex);
- idproperties_fix_group_lengths(bmain->image);
- idproperties_fix_group_lengths(bmain->latt);
- idproperties_fix_group_lengths(bmain->lamp);
- idproperties_fix_group_lengths(bmain->camera);
+ idproperties_fix_group_lengths(bmain->scenes);
+ idproperties_fix_group_lengths(bmain->libraries);
+ idproperties_fix_group_lengths(bmain->objects);
+ idproperties_fix_group_lengths(bmain->meshes);
+ idproperties_fix_group_lengths(bmain->curves);
+ idproperties_fix_group_lengths(bmain->metaballs);
+ idproperties_fix_group_lengths(bmain->materials);
+ idproperties_fix_group_lengths(bmain->textures);
+ idproperties_fix_group_lengths(bmain->images);
+ idproperties_fix_group_lengths(bmain->lattices);
+ idproperties_fix_group_lengths(bmain->lights);
+ idproperties_fix_group_lengths(bmain->cameras);
idproperties_fix_group_lengths(bmain->ipo);
- idproperties_fix_group_lengths(bmain->key);
- idproperties_fix_group_lengths(bmain->world);
- idproperties_fix_group_lengths(bmain->screen);
- idproperties_fix_group_lengths(bmain->vfont);
- idproperties_fix_group_lengths(bmain->text);
- idproperties_fix_group_lengths(bmain->sound);
- idproperties_fix_group_lengths(bmain->collection);
- idproperties_fix_group_lengths(bmain->armature);
- idproperties_fix_group_lengths(bmain->action);
- idproperties_fix_group_lengths(bmain->nodetree);
- idproperties_fix_group_lengths(bmain->brush);
- idproperties_fix_group_lengths(bmain->particle);
+ idproperties_fix_group_lengths(bmain->shapekeys);
+ idproperties_fix_group_lengths(bmain->worlds);
+ idproperties_fix_group_lengths(bmain->screens);
+ idproperties_fix_group_lengths(bmain->fonts);
+ idproperties_fix_group_lengths(bmain->texts);
+ idproperties_fix_group_lengths(bmain->sounds);
+ idproperties_fix_group_lengths(bmain->collections);
+ idproperties_fix_group_lengths(bmain->armatures);
+ idproperties_fix_group_lengths(bmain->actions);
+ idproperties_fix_group_lengths(bmain->nodetrees);
+ idproperties_fix_group_lengths(bmain->brushes);
+ idproperties_fix_group_lengths(bmain->particles);
}
/* convert fluids to modifier */
if (bmain->versionfile < 246 || (bmain->versionfile == 246 && bmain->subversionfile < 1)) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->fluidsimSettings) {
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifier_new(eModifierType_Fluidsim);
BLI_addhead(&ob->modifiers, (ModifierData *)fluidmd);
@@ -2464,7 +2435,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 246 || (bmain->versionfile == 246 && bmain->subversionfile < 1)) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->pd && (ob->pd->forcefield == PFIELD_WIND))
ob->pd->f_noise = 0.0f;
}
@@ -2475,7 +2446,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Curve *cu;
Nurb *nu;
- for (cu = bmain->curve.first; cu; cu = cu->id.next) {
+ for (cu = bmain->curves.first; cu; cu = cu->id.next) {
for (nu = cu->nurb.first; nu; nu = nu->next) {
if (nu) {
nu->radius_interp = 3;
@@ -2497,7 +2468,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Scene *sce;
/* Note, these will need to be added for painting */
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
sce->toolsettings->imapaint.seam_bleed = 2;
sce->toolsettings->imapaint.normal_angle = 80;
}
@@ -2507,7 +2478,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bScreen *sc;
/* adjust default settings for Animation Editors */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
@@ -2523,9 +2494,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
sact->autosnap = SACTSNAP_FRAME;
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ SpaceGraph *sipo = (SpaceGraph *)sl;
sipo->autosnap = SACTSNAP_FRAME;
break;
}
@@ -2544,7 +2515,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* correct introduce of seed for wind force */
if (bmain->versionfile < 249 && bmain->subversionfile < 1) {
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->pd)
ob->pd->seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128;
}
@@ -2552,7 +2523,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
if (bmain->versionfile < 249 && bmain->subversionfile < 2) {
- Scene *sce = bmain->scene.first;
+ Scene *sce = bmain->scenes.first;
Sequence *seq;
Editing *ed;
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index de5a1c8a79e..ef0cd7bc7d5 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,13 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/blenloader/intern/versioning_userdef.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*
* Version patch user preferences.
*/
@@ -56,61 +51,67 @@ static void do_versions_theme(UserDef *userdef, bTheme *btheme)
memcpy(btheme, &U_theme_default, sizeof(*btheme));
}
+#define FROM_DEFAULT_V4_UCHAR(member) \
+ copy_v4_v4_char(btheme->member, U_theme_default.member);
+
if (!USER_VERSION_ATLEAST(280, 25)) {
- copy_v4_v4_char(btheme->tact.anim_preview_range, btheme->tact.anim_active);
- copy_v4_v4_char(btheme->tnla.anim_preview_range, btheme->tnla.anim_active);
- copy_v4_v4_char(btheme->tipo.anim_preview_range, btheme->tact.anim_active);
+ copy_v4_v4_char(btheme->space_action.anim_preview_range, btheme->space_action.anim_active);
+ copy_v4_v4_char(btheme->space_nla.anim_preview_range, btheme->space_nla.anim_active);
+ copy_v4_v4_char(btheme->space_graph.anim_preview_range, btheme->space_action.anim_active);
}
if (!USER_VERSION_ATLEAST(280, 26)) {
- copy_v4_v4_char(btheme->tui.icon_collection, U_theme_default.tui.icon_collection);
- copy_v4_v4_char(btheme->tui.icon_object, U_theme_default.tui.icon_object);
- copy_v4_v4_char(btheme->tui.icon_object_data, U_theme_default.tui.icon_object_data);
- copy_v4_v4_char(btheme->tui.icon_modifier, U_theme_default.tui.icon_modifier);
- copy_v4_v4_char(btheme->tui.icon_shading, U_theme_default.tui.icon_shading);
+ FROM_DEFAULT_V4_UCHAR(tui.icon_collection);
+ FROM_DEFAULT_V4_UCHAR(tui.icon_object);
+ FROM_DEFAULT_V4_UCHAR(tui.icon_object_data);
+ FROM_DEFAULT_V4_UCHAR(tui.icon_modifier);
+ FROM_DEFAULT_V4_UCHAR(tui.icon_shading);
}
if (!USER_VERSION_ATLEAST(280, 27)) {
- copy_v4_v4_char(btheme->tact.shade2, U_theme_default.tact.shade2);
- copy_v4_v4_char(btheme->tact.hilite, U_theme_default.tact.hilite);
- copy_v4_v4_char(btheme->tact.group, U_theme_default.tact.group);
- copy_v4_v4_char(btheme->tact.group_active, U_theme_default.tact.group_active);
- copy_v4_v4_char(btheme->tact.strip_select, U_theme_default.tact.strip_select);
- copy_v4_v4_char(btheme->tact.ds_channel, U_theme_default.tact.ds_channel);
- copy_v4_v4_char(btheme->tact.ds_subchannel, U_theme_default.tact.ds_subchannel);
- copy_v4_v4_char(btheme->tact.keytype_movehold, U_theme_default.tact.keytype_movehold);
- copy_v4_v4_char(btheme->tact.keytype_movehold_select, U_theme_default.tact.keytype_movehold_select);
+ FROM_DEFAULT_V4_UCHAR(space_action.shade2);
+ FROM_DEFAULT_V4_UCHAR(space_action.hilite);
+ FROM_DEFAULT_V4_UCHAR(space_action.group);
+ FROM_DEFAULT_V4_UCHAR(space_action.group_active);
+ FROM_DEFAULT_V4_UCHAR(space_action.strip_select);
+ FROM_DEFAULT_V4_UCHAR(space_action.ds_channel);
+ FROM_DEFAULT_V4_UCHAR(space_action.ds_subchannel);
+ FROM_DEFAULT_V4_UCHAR(space_action.keytype_movehold);
+ FROM_DEFAULT_V4_UCHAR(space_action.keytype_movehold_select);
}
if (!USER_VERSION_ATLEAST(280, 28)) {
- copy_v4_v4_char(btheme->tact.ds_ipoline, U_theme_default.tact.ds_ipoline);
+ FROM_DEFAULT_V4_UCHAR(space_action.ds_ipoline);
}
if (!USER_VERSION_ATLEAST(280, 29)) {
- copy_v4_v4_char(btheme->tbuts.navigation_bar, U_theme_default.ttopbar.header);
+ FROM_DEFAULT_V4_UCHAR(space_properties.navigation_bar);
}
if (!USER_VERSION_ATLEAST(280, 31)) {
- copy_v4_v4_char(btheme->tclip.list_text, U_theme_default.tclip.list_text);
- }
-
- if (!USER_VERSION_ATLEAST(280, 33)) {
- copy_v4_v4_char(btheme->tuserpref.navigation_bar, U_theme_default.tuserpref.navigation_bar);
+ FROM_DEFAULT_V4_UCHAR(space_clip.list_text);
}
if (!USER_VERSION_ATLEAST(280, 36)) {
- copy_v4_v4_char(btheme->tui.wcol_state.inner_changed, U_theme_default.tui.wcol_state.inner_changed);
- copy_v4_v4_char(btheme->tui.wcol_state.inner_changed_sel, U_theme_default.tui.wcol_state.inner_changed_sel);
+ FROM_DEFAULT_V4_UCHAR(tui.wcol_state.inner_changed);
+ FROM_DEFAULT_V4_UCHAR(tui.wcol_state.inner_changed_sel);
}
if (!USER_VERSION_ATLEAST(280, 39)) {
- copy_v4_v4_char(btheme->tclip.metadatabg, U_theme_default.tima.metadatabg);
- copy_v4_v4_char(btheme->tclip.metadatatext, U_theme_default.tima.metadatatext);
+ FROM_DEFAULT_V4_UCHAR(space_clip.metadatabg);
+ FROM_DEFAULT_V4_UCHAR(space_clip.metadatatext);
}
if (!USER_VERSION_ATLEAST(280, 40)) {
- copy_v4_v4_char(btheme->tuserpref.execution_buts, btheme->tuserpref.navigation_bar);
+ FROM_DEFAULT_V4_UCHAR(space_preferences.navigation_bar);
+ copy_v4_v4_char(btheme->space_preferences.execution_buts, btheme->space_preferences.navigation_bar);
+ }
+
+ if (!USER_VERSION_ATLEAST(280, 41)) {
+ FROM_DEFAULT_V4_UCHAR(space_view3d.back);
}
+#undef FROM_DEFAULT_V4_UCHAR
+
#undef USER_VERSION_ATLEAST
}
@@ -149,10 +150,6 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
userdef->menuthreshold1 = 5;
userdef->menuthreshold2 = 2;
}
- if (userdef->tb_leftmouse == 0) {
- userdef->tb_leftmouse = 5;
- userdef->tb_rightmouse = 5;
- }
if (userdef->mixbufsize == 0) userdef->mixbufsize = 2048;
if (userdef->autokey_mode == 0) {
/* 'add/replace' but not on */
@@ -302,10 +299,6 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
BKE_addon_ensure(&userdef->addons, "cycles");
}
- if (!USER_VERSION_ATLEAST(261, 4)) {
- userdef->use_16bit_textures = true;
- }
-
if (!USER_VERSION_ATLEAST(267, 0)) {
/* GL Texture Garbage Collection */
@@ -322,8 +315,6 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
if (userdef->v2d_min_gridsize == 0) {
userdef->v2d_min_gridsize = 35;
}
- if (userdef->dragthreshold == 0)
- userdef->dragthreshold = 5;
if (userdef->widget_unit == 0)
userdef->widget_unit = 20;
if (userdef->anisotropic_filter <= 0)
@@ -463,11 +454,32 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
USER_FLAG_DEPRECATED_4);
userdef->uiflag &= ~(
- USER_UIFLAG_DEPRECATED_8 |
+ USER_HEADER_FROM_PREF |
USER_UIFLAG_DEPRECATED_12 |
USER_UIFLAG_DEPRECATED_22);
}
+ if (!USER_VERSION_ATLEAST(280, 41)) {
+ /* (keep this block even if it becomes empty). */
+
+ if (userdef->pie_tap_timeout == 0) {
+ userdef->pie_tap_timeout = 20;
+ }
+ }
+
+ if (!USER_VERSION_ATLEAST(280, 44)) {
+ userdef->uiflag &= ~(
+ USER_UIFLAG_DEPRECATED_0 | USER_UIFLAG_DEPRECATED_1);
+ userdef->uiflag2 &= ~(
+ USER_UIFLAG2_DEPRECATED_0);
+ userdef->gp_settings &= ~(
+ GP_PAINT_DEPRECATED_0);
+ }
+
+ if (!USER_VERSION_ATLEAST(280, 46)) {
+ userdef->uiflag2 |= USER_EDIT_MODE_SMOOTH_WIRE;
+ }
+
/**
* Include next version bump.
*/
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index c10d1819b7f..5c038d698b4 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blenloader/intern/writefile.c
- * \ingroup blenloader
+/** \file
+ * \ingroup blenloader
*/
@@ -38,7 +31,7 @@
*
* start file:
* <pre>
- * BLENDER_V100 12 bytes (versie 1.00)
+ * BLENDER_V100 12 bytes (version 1.00)
* V = big endian, v = little endian
* _ = 4 byte pointer, - = 8 byte pointer
* </pre>
@@ -58,8 +51,6 @@
* Almost all data in Blender are structures. Each struct saved
* gets a BHead header. With BHead the struct can be linked again
* and compared with StructDNA .
- *
- *
* WRITE
* =====
*
@@ -123,7 +114,7 @@
#include "DNA_fileglobal_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_layer_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_meta_types.h"
@@ -158,7 +149,6 @@
#include "MEM_guardedalloc.h" // MEM_freeN
#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
-#include "BLI_linklist.h"
#include "BLI_mempool.h"
#include "BKE_action.h"
@@ -189,10 +179,11 @@
#endif
-#include "BLO_writefile.h"
+#include "BLO_blend_defs.h"
+#include "BLO_blend_validate.h"
#include "BLO_readfile.h"
#include "BLO_undofile.h"
-#include "BLO_blend_defs.h"
+#include "BLO_writefile.h"
#include "readfile.h"
@@ -226,6 +217,9 @@ struct WriteWrap {
bool (*close)(WriteWrap *ww);
size_t (*write)(WriteWrap *ww, const char *data, size_t data_len);
+ /* Buffer output (we only want when output isn't already buffered). */
+ bool use_buf;
+
/* internal */
union {
int file_handle;
@@ -301,6 +295,7 @@ static void ww_handle_init(eWriteWrapType ww_type, WriteWrap *r_ww)
r_ww->open = ww_open_zlib;
r_ww->close = ww_close_zlib;
r_ww->write = ww_write_zlib;
+ r_ww->use_buf = false;
break;
}
default:
@@ -308,6 +303,7 @@ static void ww_handle_init(eWriteWrapType ww_type, WriteWrap *r_ww)
r_ww->open = ww_open_none;
r_ww->close = ww_close_none;
r_ww->write = ww_write_none;
+ r_ww->use_buf = true;
break;
}
}
@@ -361,7 +357,9 @@ static WriteData *writedata_new(WriteWrap *ww)
wd->ww = ww;
- wd->buf = MEM_mallocN(MYWRITE_BUFFER_SIZE, "wd->buf");
+ if ((ww == NULL) || (ww->use_buf)) {
+ wd->buf = MEM_mallocN(MYWRITE_BUFFER_SIZE, "wd->buf");
+ }
return wd;
}
@@ -389,7 +387,9 @@ static void writedata_do_write(WriteData *wd, const void *mem, int memlen)
static void writedata_free(WriteData *wd)
{
- MEM_freeN(wd->buf);
+ if (wd->buf) {
+ MEM_freeN(wd->buf);
+ }
MEM_freeN(wd);
}
@@ -431,33 +431,38 @@ static void mywrite(WriteData *wd, const void *adr, int len)
wd->write_len += len;
#endif
- /* 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->buf_used_len) {
+ if (wd->buf == NULL) {
+ writedata_do_write(wd, adr, len);
+ }
+ else {
+ /* 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->buf_used_len) {
+ writedata_do_write(wd, wd->buf, wd->buf_used_len);
+ wd->buf_used_len = 0;
+ }
+
+ do {
+ int writelen = MIN2(len, MYWRITE_MAX_CHUNK);
+ writedata_do_write(wd, adr, writelen);
+ adr = (const char *)adr + writelen;
+ len -= writelen;
+ } while (len > 0);
+
+ return;
+ }
+
+ /* if data would overflow buffer, write out the buffer */
+ if (len + wd->buf_used_len > MYWRITE_BUFFER_SIZE - 1) {
writedata_do_write(wd, wd->buf, wd->buf_used_len);
wd->buf_used_len = 0;
}
- do {
- int writelen = MIN2(len, MYWRITE_MAX_CHUNK);
- writedata_do_write(wd, adr, writelen);
- adr = (const char *)adr + writelen;
- len -= writelen;
- } while (len > 0);
-
- return;
+ /* append data at end of buffer */
+ memcpy(&wd->buf[wd->buf_used_len], adr, len);
+ wd->buf_used_len += len;
}
-
- /* if data would overflow buffer, write out the buffer */
- if (len + wd->buf_used_len > MYWRITE_BUFFER_SIZE - 1) {
- writedata_do_write(wd, wd->buf, wd->buf_used_len);
- wd->buf_used_len = 0;
- }
-
- /* append data at end of buffer */
- memcpy(&wd->buf[wd->buf_used_len], adr, len);
- wd->buf_used_len += len;
}
/**
@@ -527,7 +532,7 @@ static void writestruct_at_address_nr(
bh.SDNAnr = struct_nr;
sp = wd->sdna->structs[bh.SDNAnr];
- bh.len = nr * wd->sdna->typelens[sp[0]];
+ bh.len = nr * wd->sdna->types_size[sp[0]];
if (bh.len == 0) {
return;
@@ -1202,7 +1207,7 @@ static void write_renderinfo(WriteData *wd, Main *mainvar)
/* XXX in future, handle multiple windows with multiple screens? */
current_screen_compat(mainvar, false, &curscreen, &curscene, &view_layer);
- for (sce = mainvar->scene.first; sce; sce = sce->id.next) {
+ for (sce = mainvar->scenes.first; sce; sce = sce->id.next) {
if (sce->id.lib == NULL && (sce == curscene || (sce->r.scemode & R_BG_RENDER))) {
data.sfra = sce->r.sfra;
data.efra = sce->r.efra;
@@ -1342,11 +1347,11 @@ static const char *ptcache_data_struct[] = {
"", // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */
"", // BPHYS_DATA_SIZE:
"", // BPHYS_DATA_TIMES:
- "BoidData" // case BPHYS_DATA_BOIDS:
+ "BoidData", // case BPHYS_DATA_BOIDS:
};
static const char *ptcache_extra_struct[] = {
"",
- "ParticleSpring"
+ "ParticleSpring",
};
static void write_pointcaches(WriteData *wd, ListBase *ptcaches)
{
@@ -1411,12 +1416,12 @@ static void write_particlesettings(WriteData *wd, ParticleSettings *part)
write_curvemapping(wd, part->twistcurve);
}
- for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (ParticleDupliWeight *dw = part->instance_weights.first; dw; dw = dw->next) {
/* update indices, but only if dw->ob is set (can be NULL after loading e.g.) */
if (dw->ob != NULL) {
dw->index = 0;
- if (part->dup_group) { /* can be NULL if lining fails or set to None */
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->dup_group, object)
+ if (part->instance_collection) { /* can be NULL if lining fails or set to None */
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object)
{
if (object != dw->ob) {
dw->index++;
@@ -2097,14 +2102,15 @@ static void write_grid_paint_mask(WriteData *wd, int count, GridPaintMask *grid_
}
static void write_customdata(
- WriteData *wd, ID *id, int count, CustomData *data, CustomDataLayer *layers,
+ WriteData *wd, ID *id,
+ int count, CustomData *data, CustomDataLayer *layers, CustomDataMask cddata_mask,
int partial_type, int partial_count)
{
int i;
/* write external customdata (not for undo) */
if (data->external && (wd->use_memfile == false)) {
- CustomData_external_write(data, id, CD_MASK_MESH, count, 0);
+ CustomData_external_write(data, id, cddata_mask, count, 0);
}
writestruct_at_address(wd, DATA, CustomDataLayer, data->totlayer, data->layers, layers);
@@ -2205,12 +2211,12 @@ static void write_mesh(WriteData *wd, Mesh *mesh)
writedata(wd, DATA, sizeof(void *) * mesh->totcol, mesh->mat);
writedata(wd, DATA, sizeof(MSelect) * mesh->totselect, mesh->mselect);
- write_customdata(wd, &mesh->id, mesh->totvert, &mesh->vdata, vlayers, -1, 0);
- write_customdata(wd, &mesh->id, mesh->totedge, &mesh->edata, elayers, -1, 0);
+ write_customdata(wd, &mesh->id, mesh->totvert, &mesh->vdata, vlayers, CD_MASK_MESH.vmask, -1, 0);
+ write_customdata(wd, &mesh->id, mesh->totedge, &mesh->edata, elayers, CD_MASK_MESH.emask, -1, 0);
/* fdata is really a dummy - written so slots align */
- write_customdata(wd, &mesh->id, mesh->totface, &mesh->fdata, flayers, -1, 0);
- write_customdata(wd, &mesh->id, mesh->totloop, &mesh->ldata, llayers, -1, 0);
- write_customdata(wd, &mesh->id, mesh->totpoly, &mesh->pdata, players, -1, 0);
+ write_customdata(wd, &mesh->id, mesh->totface, &mesh->fdata, flayers, CD_MASK_MESH.fmask, -1, 0);
+ write_customdata(wd, &mesh->id, mesh->totloop, &mesh->ldata, llayers, CD_MASK_MESH.lmask, -1, 0);
+ write_customdata(wd, &mesh->id, mesh->totpoly, &mesh->pdata, players, CD_MASK_MESH.pmask, -1, 0);
/* restore pointer */
mesh = old_mesh;
@@ -2364,11 +2370,11 @@ static void write_world(WriteData *wd, World *wrld)
}
}
-static void write_lamp(WriteData *wd, Lamp *la)
+static void write_light(WriteData *wd, Light *la)
{
if (la->id.us > 0 || wd->use_memfile) {
/* write LibData */
- writestruct(wd, ID_LA, Lamp, 1, la);
+ writestruct(wd, ID_LA, Light, 1, la);
write_iddata(wd, &la->id);
if (la->adt) {
@@ -2379,7 +2385,7 @@ static void write_lamp(WriteData *wd, Lamp *la)
write_curvemapping(wd, la->curfalloff);
}
- /* nodetree is integral part of lamps, no libdata */
+ /* Node-tree is integral part of lights, no libdata. */
if (la->nodetree) {
writestruct(wd, DATA, bNodeTree, 1, la->nodetree);
write_nodetree_nolib(wd, la->nodetree);
@@ -2799,12 +2805,12 @@ static void write_uilist(WriteData *wd, uiList *ui_list)
}
}
-static void write_soops(WriteData *wd, SpaceOops *so)
+static void write_soops(WriteData *wd, SpaceOutliner *so)
{
BLI_mempool *ts = so->treestore;
if (ts) {
- SpaceOops so_flat = *so;
+ SpaceOutliner so_flat = *so;
int elems = BLI_mempool_len(ts);
/* linearize mempool to array */
@@ -2825,7 +2831,7 @@ static void write_soops(WriteData *wd, SpaceOops *so)
ts_flat.totelem = elems;
ts_flat.data = data_addr;
- writestruct(wd, DATA, SpaceOops, 1, so);
+ writestruct(wd, DATA, SpaceOutliner, 1, so);
writestruct_at_address(wd, DATA, TreeStore, 1, ts, &ts_flat);
writestruct_at_address(wd, DATA, TreeStoreElem, elems, data_addr, data);
@@ -2834,11 +2840,11 @@ static void write_soops(WriteData *wd, SpaceOops *so)
}
else {
so_flat.treestore = NULL;
- writestruct_at_address(wd, DATA, SpaceOops, 1, so, &so_flat);
+ writestruct_at_address(wd, DATA, SpaceOutliner, 1, so, &so_flat);
}
}
else {
- writestruct(wd, DATA, SpaceOops, 1, so);
+ writestruct(wd, DATA, SpaceOutliner, 1, so);
}
}
@@ -2889,14 +2895,14 @@ static void write_area_regions(WriteData *wd, ScrArea *area)
writestruct(wd, DATA, GPUDOFSettings, 1, v3d->fx_settings.dof);
}
}
- else if (sl->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ else if (sl->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = (SpaceGraph *)sl;
ListBase tmpGhosts = sipo->runtime.ghost_curves;
/* temporarily disable ghost curves when saving */
BLI_listbase_clear(&sipo->runtime.ghost_curves);
- writestruct(wd, DATA, SpaceIpo, 1, sl);
+ writestruct(wd, DATA, SpaceGraph, 1, sl);
if (sipo->ads) {
writestruct(wd, DATA, bDopeSheet, 1, sipo->ads);
}
@@ -2904,8 +2910,8 @@ static void write_area_regions(WriteData *wd, ScrArea *area)
/* reenable ghost curves */
sipo->runtime.ghost_curves = tmpGhosts;
}
- else if (sl->spacetype == SPACE_BUTS) {
- writestruct(wd, DATA, SpaceButs, 1, sl);
+ else if (sl->spacetype == SPACE_PROPERTIES) {
+ writestruct(wd, DATA, SpaceProperties, 1, sl);
}
else if (sl->spacetype == SPACE_FILE) {
SpaceFile *sfile = (SpaceFile *)sl;
@@ -2919,7 +2925,7 @@ static void write_area_regions(WriteData *wd, ScrArea *area)
writestruct(wd, DATA, SpaceSeq, 1, sl);
}
else if (sl->spacetype == SPACE_OUTLINER) {
- SpaceOops *so = (SpaceOops *)sl;
+ SpaceOutliner *so = (SpaceOutliner *)sl;
write_soops(wd, so);
}
else if (sl->spacetype == SPACE_IMAGE) {
@@ -3756,6 +3762,7 @@ static void write_libraries(WriteData *wd, Main *main)
}
}
+ /* Write link placeholders for all direct linked IDs. */
while (a--) {
for (id = lbarray[a]->first; id; id = id->next) {
if (id->us > 0 && (id->tag & LIB_TAG_EXTERN)) {
@@ -3764,7 +3771,7 @@ static void write_libraries(WriteData *wd, Main *main)
"but is flagged as directly linked", id->name, main->curlib->filepath);
BLI_assert(0);
}
- writestruct(wd, ID_ID, ID, 1, id);
+ writestruct(wd, ID_LINK_PLACEHOLDER, ID, 1, id);
}
}
}
@@ -3787,10 +3794,10 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
char subvstr[8];
/* prevent mem checkers from complaining */
- memset(fg.pad, 0, sizeof(fg.pad));
+ memset(fg._pad, 0, sizeof(fg._pad));
memset(fg.filename, 0, sizeof(fg.filename));
memset(fg.build_hash, 0, sizeof(fg.build_hash));
- fg.pad1 = NULL;
+ fg._pad1 = NULL;
current_screen_compat(mainvar, is_undo, &screen, &scene, &view_layer);
@@ -3800,7 +3807,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
fg.cur_view_layer = view_layer;
/* prevent to save this, is not good convention, and feature with concerns... */
- fg.fileflags = (fileflags & ~G_FILE_FLAGS_RUNTIME);
+ fg.fileflags = (fileflags & ~G_FILE_FLAG_ALL_RUNTIME);
fg.globalf = G.f;
BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename));
@@ -3938,7 +3945,7 @@ static bool write_file_handle(
write_camera(wd, (Camera *)id);
break;
case ID_LA:
- write_lamp(wd, (Lamp *)id);
+ write_light(wd, (Light *)id);
break;
case ID_LT:
write_lattice(wd, (Lattice *)id);
@@ -4050,7 +4057,7 @@ static bool write_file_handle(
*
* Note that we *borrow* the pointer to 'DNAstr',
* so writing each time uses the same address and doesn't cause unnecessary undo overhead. */
- writedata(wd, DNA1, wd->sdna->datalen, wd->sdna->data);
+ writedata(wd, DNA1, wd->sdna->data_len, wd->sdna->data);
#ifdef USE_NODE_COMPAT_CUSTOMNODES
/* compatibility data not created on undo */
@@ -4139,6 +4146,7 @@ bool BLO_write_file(
if (G.debug & G_DEBUG_IO && mainvar->lock != NULL) {
BKE_report(reports, RPT_INFO, "Checking sanity of current .blend file *BEFORE* save to disk");
BLO_main_validate_libraries(mainvar, reports);
+ BLO_main_validate_shapekeys(mainvar, reports);
}
/* open temporary file, so we preserve the original in case we crash */
diff --git a/source/blender/blentranslation/BLT_lang.h b/source/blender/blentranslation/BLT_lang.h
index 72b4e5b39bc..3000c2f66a6 100644
--- a/source/blender/blentranslation/BLT_lang.h
+++ b/source/blender/blentranslation/BLT_lang.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blentranslation/BLT_lang.h
- * \ingroup blt
+/** \file
+ * \ingroup blt
*/
#ifndef __BLT_LANG_H__
diff --git a/source/blender/blentranslation/BLT_translation.h b/source/blender/blentranslation/BLT_translation.h
index cf9e3f6a66d..b1375fd74a8 100644
--- a/source/blender/blentranslation/BLT_translation.h
+++ b/source/blender/blentranslation/BLT_translation.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blentranslation/BLT_translation.h
- * \ingroup blt
+/** \file
+ * \ingroup blt
*/
@@ -129,7 +121,7 @@ bool BLT_lang_is_ime_supported(void);
#define BLT_I18NCONTEXT_ID_IMAGE "Image"
/*#define BLT_I18NCONTEXT_ID_IPO "Ipo"*/ /* Deprecated */
#define BLT_I18NCONTEXT_ID_SHAPEKEY "Key"
-#define BLT_I18NCONTEXT_ID_LAMP "Lamp"
+#define BLT_I18NCONTEXT_ID_LIGHT "Light"
#define BLT_I18NCONTEXT_ID_LIBRARY "Library"
#define BLT_I18NCONTEXT_ID_LATTICE "Lattice"
#define BLT_I18NCONTEXT_ID_MATERIAL "Material"
@@ -183,7 +175,7 @@ typedef struct {
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_IMAGE, "id_image"), \
/*BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_IPO, "id_ipo"),*/ \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SHAPEKEY, "id_shapekey"), \
- BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_LAMP, "id_lamp"), \
+ BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_LIGHT, "id_light"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_LIBRARY, "id_library"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_LATTICE, "id_lattice"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_MASK, "id_mask"), \
diff --git a/source/blender/blentranslation/CMakeLists.txt b/source/blender/blentranslation/CMakeLists.txt
index 320a784ea25..fa3f8c47bee 100644
--- a/source/blender/blentranslation/CMakeLists.txt
+++ b/source/blender/blentranslation/CMakeLists.txt
@@ -16,9 +16,6 @@
#
# The Original Code is Copyright (C) 2008, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/blentranslation/intern/blt_lang.c b/source/blender/blentranslation/intern/blt_lang.c
index a36fe245a2a..b7f6fcd0b66 100644
--- a/source/blender/blentranslation/intern/blt_lang.c
+++ b/source/blender/blentranslation/intern/blt_lang.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blentranslation/intern/blt_lang.c
- * \ingroup blt
+/** \file
+ * \ingroup blt
*
* Main internationalization functions to set the locale and query available languages.
*/
@@ -42,8 +36,6 @@
#include "BLT_translation.h"
#include "BLT_lang.h" /* own include */
-#include "BLI_fileops.h"
-#include "BLI_linklist.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
@@ -60,6 +52,9 @@ static void blt_lang_check_ime_supported(void);
#ifdef WITH_INTERNATIONAL
+#include "BLI_fileops.h"
+#include "BLI_linklist.h"
+
#include "boost_locale_wrapper.h"
/* Locale options. */
diff --git a/source/blender/blentranslation/intern/blt_translation.c b/source/blender/blentranslation/intern/blt_translation.c
index 40d384dd0fe..0245a1a0c35 100644
--- a/source/blender/blentranslation/intern/blt_translation.c
+++ b/source/blender/blentranslation/intern/blt_translation.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/blentranslation/intern/blt_translation.c
- * \ingroup blt
+/** \file
+ * \ingroup blt
*
* Manages translation files and provides translation functions.
* (which are optional and can be disabled as a preference).
@@ -38,11 +31,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_fileops.h"
-#include "BLI_path_util.h"
-#include "BLI_string.h"
-#include "BLI_threads.h"
-
#include "DNA_userdef_types.h" /* For user settings. */
#ifdef WITH_PYTHON
@@ -50,7 +38,8 @@
#endif
#ifdef WITH_INTERNATIONAL
-#include "boost_locale_wrapper.h"
+# include "BLI_threads.h"
+# include "boost_locale_wrapper.h"
#endif /* WITH_INTERNATIONAL */
bool BLT_is_default_context(const char *msgctxt)
diff --git a/source/blender/blentranslation/msgfmt/CMakeLists.txt b/source/blender/blentranslation/msgfmt/CMakeLists.txt
index d2cb6f5a03b..48537604157 100644
--- a/source/blender/blentranslation/msgfmt/CMakeLists.txt
+++ b/source/blender/blentranslation/msgfmt/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2017, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Bastien Montagne.
-#
# ***** END GPL LICENSE BLOCK *****
# -----------------------------------------------------------------------------
diff --git a/source/blender/blentranslation/msgfmt/msgfmt.c b/source/blender/blentranslation/msgfmt/msgfmt.c
index a155cce53a5..69d7ecb14a5 100644
--- a/source/blender/blentranslation/msgfmt/msgfmt.c
+++ b/source/blender/blentranslation/msgfmt/msgfmt.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,10 +15,6 @@
*
* The Original Code is Copyright (C) 2017 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
/*
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index e6317762842..631886ac86e 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -86,10 +81,10 @@ set(SRC
intern/bmesh_construct.h
intern/bmesh_core.c
intern/bmesh_core.h
- intern/bmesh_edgeloop.c
- intern/bmesh_edgeloop.h
intern/bmesh_delete.c
intern/bmesh_delete.h
+ intern/bmesh_edgeloop.c
+ intern/bmesh_edgeloop.h
intern/bmesh_inline.h
intern/bmesh_interp.c
intern/bmesh_interp.h
@@ -129,8 +124,8 @@ set(SRC
intern/bmesh_walkers_impl.c
intern/bmesh_walkers_private.h
- intern/bmesh_operator_api.h
intern/bmesh_error.h
+ intern/bmesh_operator_api.h
tools/bmesh_beautify.c
tools/bmesh_beautify.h
@@ -138,10 +133,10 @@ set(SRC
tools/bmesh_bevel.h
tools/bmesh_bisect_plane.c
tools/bmesh_bisect_plane.h
+ tools/bmesh_decimate.h
tools/bmesh_decimate_collapse.c
tools/bmesh_decimate_dissolve.c
tools/bmesh_decimate_unsubdivide.c
- tools/bmesh_decimate.h
tools/bmesh_edgenet.c
tools/bmesh_edgenet.h
tools/bmesh_edgesplit.c
diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h
index 138b8b7c51f..afedf4998a0 100644
--- a/source/blender/bmesh/bmesh.h
+++ b/source/blender/bmesh/bmesh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,23 +12,17 @@
* 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): Geoffrey Bantle, Levi Schooley.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_H__
#define __BMESH_H__
-/** \file blender/bmesh/bmesh.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* \addtogroup bmesh BMesh
*
* \brief BMesh is a non-manifold boundary representation designed to support advanced editing operations.
- *
- *
* \section bm_structure The Structure
*
* BMesh stores topology in four main element structures:
@@ -39,22 +31,16 @@
* - Loops - BMLoop, (stores per-face-vertex data, UV's, vertex-colors, etc)
* - Edges - BMEdge
* - Verts - BMVert
- *
- *
* \subsection bm_header_flags Header Flags
* Each element (vertex/edge/face/loop) in a mesh has an associated bit-field called "header flags".
*
* BMHeader flags should **never** be read or written to by bmesh operators (see Operators below).
*
* Access to header flags is done with ``BM_elem_flag_*()`` functions.
- *
- *
* \subsection bm_faces Faces
*
* Faces in BMesh are stored as a circular linked list of loops. Loops store per-face-vertex data
* (amongst other things outlined later in this document), and define the face boundary.
- *
- *
* \subsection bm_loop The Loop
*
* Loops can be thought of as a *face-corner*, since faces don't reference verts or edges directly.
@@ -70,15 +56,11 @@
* - BMLoop#e - pointer to the edge associated with this loop,
* between verts ``(loop->v, loop->next->v)``
* - BMLoop#f - pointer to the face associated with this loop.
- *
- *
* \subsection bm_two_side_face 2-Sided Faces
*
* There are some situations where you need 2-sided faces (e.g. a face of two vertices).
* This is supported by BMesh, but note that such faces should only be used as intermediary steps,
* and should not end up in the final mesh.
- *
- *
* \subsection bm_edges_and_verts Edges and Vertices
*
* Edges and Vertices in BMesh are primitive structures.
@@ -86,8 +68,6 @@
* \note There can be more than one edge between two vertices in BMesh,
* though the rest of Blender (i.e. DNA and evaluated Mesh) does not support this.
* So it should only occur temporarily during editing operations.
- *
- *
* \subsection bm_queries Queries
*
* The following topological queries are available:
@@ -99,21 +79,15 @@
* These are accessible through the iterator api, which is covered later in this document
*
* See source/blender/bmesh/bmesh_query.h for more misc. queries.
- *
- *
* \section bm_api The BMesh API
*
* One of the goals of the BMesh API is to make it easy and natural to produce highly maintainable code.
* Code duplication, etc are avoided where possible.
- *
- *
* \subsection bm_iter_api Iterator API
*
* Most topological queries in BMesh go through an iterator API (see Queries above).
* These are defined in bmesh_iterators.h.
* If you can, please use the #BM_ITER_MESH, #BM_ITER_ELEM macros in bmesh_iterators.h
- *
- *
* \subsection bm_walker_api Walker API
*
* Topological queries that require a stack (e.g. recursive queries) go through the Walker API,
@@ -124,8 +98,6 @@
* there are additional functions you can use for topological iteration, but their meant for internal bmesh code.
*
* Note that the walker API supports delimiter flags, to allow the caller to flag elements not to walk past.
- *
- *
* \subsection bm_ops Operators
*
* Operators are an integral part of BMesh. Unlike regular blender operators,
@@ -137,8 +109,6 @@
* These slots are identified by name, using strings.
*
* Access to slots is done with ``BMO_slot_***()`` functions.
- *
- *
* \subsection bm_tool_flags Tool Flags
*
* The BMesh API provides a set of flags for faces, edges and vertices, which are private to an operator.
@@ -156,8 +126,6 @@
* They act entirely on the data inside their input slots.
* For example an operator should not check the selected state of an element,
* there are some exceptions to this - some operators check of a face is smooth.
- *
- *
* \subsection bm_slot_types Slot Types
*
* The following slot types are available:
@@ -170,14 +138,10 @@
* - vector - #BMO_OP_SLOT_VEC
* - buffer - #BMO_OP_SLOT_ELEMENT_BUF - a list of verts/edges/faces.
* - map - BMO_OP_SLOT_MAPPING - simple hash map.
- *
- *
* \subsection bm_slot_iter Slot Iterators
*
* Access to element buffers or maps must go through the slot iterator api, defined in bmesh_operators.h.
* Use #BMO_ITER where ever possible.
- *
- *
* \subsection bm_elem_buf Element Buffers
*
* The element buffer slot type is used to feed elements (verts/edges/faces) to operators.
@@ -186,8 +150,6 @@
* then spit out a new one; this allows operators to be chained together.
*
* \note Element buffers may have elements of different types within the same buffer (this is supported by the API.
- *
- *
* \section bm_fname Function Naming Conventions
*
* These conventions should be used throughout the bmesh module.
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 70884454ce5..a9cafb7b13e 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): Geoffrey Bantle, Levi Schooley, Joseph Eagar.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_CLASS_H__
#define __BMESH_CLASS_H__
-/** \file blender/bmesh/bmesh_class.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
/* bmesh data structures */
@@ -32,11 +26,11 @@
/* dissable holes for now, these are ifdef'd because they use more memory and cant be saved in DNA currently */
// #define USE_BMESH_HOLES
-struct BMesh;
-struct BMVert;
struct BMEdge;
-struct BMLoop;
struct BMFace;
+struct BMLoop;
+struct BMVert;
+struct BMesh;
struct MLoopNorSpaceArray;
@@ -265,7 +259,7 @@ enum {
BM_VERT = 1,
BM_EDGE = 2,
BM_LOOP = 4,
- BM_FACE = 8
+ BM_FACE = 8,
};
typedef struct BMLoopNorEditData {
diff --git a/source/blender/bmesh/bmesh_tools.h b/source/blender/bmesh/bmesh_tools.h
index a537c3b872c..d0e91d033fb 100644
--- a/source/blender/bmesh/bmesh_tools.h
+++ b/source/blender/bmesh/bmesh_tools.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_TOOLS_H__
#define __BMESH_TOOLS_H__
-/** \file blender/bmesh/bmesh_tools.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Utility functions that operate directly on the BMesh,
* These can be used by both Modifiers and BMesh-Operators.
diff --git a/source/blender/bmesh/intern/bmesh_callback_generic.c b/source/blender/bmesh/intern/bmesh_callback_generic.c
index 90b2497aa80..07a23cd0471 100644
--- a/source/blender/bmesh/intern/bmesh_callback_generic.c
+++ b/source/blender/bmesh/intern/bmesh_callback_generic.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_callback_generic.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BM element callback functions.
*/
diff --git a/source/blender/bmesh/intern/bmesh_callback_generic.h b/source/blender/bmesh/intern/bmesh_callback_generic.h
index 44495d54edd..d17e7a68ac8 100644
--- a/source/blender/bmesh/intern/bmesh_callback_generic.h
+++ b/source/blender/bmesh/intern/bmesh_callback_generic.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_CALLBACK_GENERIC_H__
#define __BMESH_CALLBACK_GENERIC_H__
-/** \file blender/bmesh/intern/bmesh_callback_generic.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
bool BM_elem_cb_check_hflag_enabled(BMElem *, void *user_data);
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index 68f08025e5a..fba71b20e7c 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_construct.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BM construction functions.
*/
@@ -273,7 +265,7 @@ error:
* Makes an ngon from an unordered list of edges.
* Verts \a v1 and \a v2 define the winding of the new face.
*
- * \a edges are not required to be ordered, simply to to form
+ * \a edges are not required to be ordered, simply to form
* a single closed loop as a whole.
*
* \note While this function will work fine when the edges
@@ -670,10 +662,10 @@ void BM_mesh_copy_init_customdata(BMesh *bm_dst, BMesh *bm_src, const BMAllocTem
allocsize = &bm_mesh_allocsize_default;
}
- CustomData_copy(&bm_src->vdata, &bm_dst->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
- CustomData_copy(&bm_src->edata, &bm_dst->edata, CD_MASK_BMESH, CD_CALLOC, 0);
- CustomData_copy(&bm_src->ldata, &bm_dst->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
- CustomData_copy(&bm_src->pdata, &bm_dst->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
+ CustomData_copy(&bm_src->vdata, &bm_dst->vdata, CD_MASK_BMESH.vmask, CD_CALLOC, 0);
+ CustomData_copy(&bm_src->edata, &bm_dst->edata, CD_MASK_BMESH.emask, CD_CALLOC, 0);
+ CustomData_copy(&bm_src->ldata, &bm_dst->ldata, CD_MASK_BMESH.lmask, CD_CALLOC, 0);
+ CustomData_copy(&bm_src->pdata, &bm_dst->pdata, CD_MASK_BMESH.pmask, CD_CALLOC, 0);
CustomData_bmesh_init_pool(&bm_dst->vdata, allocsize->totvert, BM_VERT);
CustomData_bmesh_init_pool(&bm_dst->edata, allocsize->totedge, BM_EDGE);
diff --git a/source/blender/bmesh/intern/bmesh_construct.h b/source/blender/bmesh/intern/bmesh_construct.h
index 1a2b6e46c39..0dfa0a81b91 100644
--- a/source/blender/bmesh/intern/bmesh_construct.h
+++ b/source/blender/bmesh/intern/bmesh_construct.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_CONSTRUCT_H__
#define __BMESH_CONSTRUCT_H__
-/** \file blender/bmesh/intern/bmesh_construct.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
struct BMAllocTemplate;
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index 1fe0dc15b0c..eead30bcd24 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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_core.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Core BMesh functions for adding, removing BMesh elements.
*/
@@ -38,6 +32,7 @@
#include "DNA_meshdata_types.h"
+#include "BKE_customdata.h"
#include "BKE_mesh.h"
#include "bmesh.h"
diff --git a/source/blender/bmesh/intern/bmesh_core.h b/source/blender/bmesh/intern/bmesh_core.h
index 93bb12fe742..dc20b8afaac 100644
--- a/source/blender/bmesh/intern/bmesh_core.h
+++ b/source/blender/bmesh/intern/bmesh_core.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_CORE_H__
#define __BMESH_CORE_H__
-/** \file blender/bmesh/intern/bmesh_core.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
BMFace *BM_face_copy(
diff --git a/source/blender/bmesh/intern/bmesh_delete.c b/source/blender/bmesh/intern/bmesh_delete.c
index 1869bc49da0..23fe8a31b41 100644
--- a/source/blender/bmesh/intern/bmesh_delete.c
+++ b/source/blender/bmesh/intern/bmesh_delete.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_delete.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BM remove functions.
*/
diff --git a/source/blender/bmesh/intern/bmesh_delete.h b/source/blender/bmesh/intern/bmesh_delete.h
index a876819dd40..616485b242e 100644
--- a/source/blender/bmesh/intern/bmesh_delete.h
+++ b/source/blender/bmesh/intern/bmesh_delete.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_DELETE_H__
#define __BMESH_DELETE_H__
-/** \file blender/bmesh/intern/bmesh_delete.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
void BMO_mesh_delete_oflag_tagged(BMesh *bm, const short oflag, const char htype);
diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c
index 9e107c822ac..7bd86922df2 100644
--- a/source/blender/bmesh/intern/bmesh_edgeloop.c
+++ b/source/blender/bmesh/intern/bmesh_edgeloop.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2013 by Campbell Barton.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_edgeloop.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Generic utility functions for getting edge loops from a mesh.
*/
diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.h b/source/blender/bmesh/intern/bmesh_edgeloop.h
index 68583562888..e21a62bc25f 100644
--- a/source/blender/bmesh/intern/bmesh_edgeloop.h
+++ b/source/blender/bmesh/intern/bmesh_edgeloop.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,18 @@
*
* The Original Code is Copyright (C) 2013 by Campbell Barton.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_EDGELOOP_H__
#define __BMESH_EDGELOOP_H__
-/** \file blender/bmesh/intern/bmesh_edgeloop.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
-struct ListBase;
struct BMEdgeLoopStore;
struct GSet;
+struct ListBase;
/* multiple edgeloops (ListBase) */
int BM_mesh_edgeloops_find(
diff --git a/source/blender/bmesh/intern/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h
index 6cd37011814..0035a43dc1e 100644
--- a/source/blender/bmesh/intern/bmesh_error.h
+++ b/source/blender/bmesh/intern/bmesh_error.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_ERROR_H__
#define __BMESH_ERROR_H__
-/** \file blender/bmesh/intern/bmesh_error.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
/*----------- bmop error system ----------*/
diff --git a/source/blender/bmesh/intern/bmesh_inline.h b/source/blender/bmesh/intern/bmesh_inline.h
index 4b55060875b..39657f1c32e 100644
--- a/source/blender/bmesh/intern/bmesh_inline.h
+++ b/source/blender/bmesh/intern/bmesh_inline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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
+/** \file
+ * \ingroup bmesh
*
* BM Inline functions.
*/
@@ -37,6 +31,7 @@
#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)
+#define BM_elem_flag_merge_ex( ele_a, ele_b, hflag_and)_bm_elem_flag_merge_ex (&(ele_a)->head, &(ele_b)->head, hflag_and)
#define BM_elem_flag_merge_into(ele, ele_a, ele_b)_bm_elem_flag_merge_into (&(ele)->head, &(ele_a)->head, &(ele_b)->head)
ATTR_WARN_UNUSED_RESULT
@@ -77,6 +72,15 @@ 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;
}
+BLI_INLINE void _bm_elem_flag_merge_ex(BMHeader *head_a, BMHeader *head_b, const char hflag_and)
+{
+ if (((head_a->hflag & head_b->hflag) & hflag_and) == 0) {
+ head_a->hflag &= ~hflag_and;
+ head_b->hflag &= ~hflag_and;
+ }
+ _bm_elem_flag_merge(head_a, head_b);
+}
+
BLI_INLINE void _bm_elem_flag_merge_into(BMHeader *head, const BMHeader *head_a, const BMHeader *head_b)
{
head->hflag = head_a->hflag | head_b->hflag;
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 26c62d1086e..655772b49ac 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_interp.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Functions for interpolating data across the surface of a mesh.
*/
@@ -508,7 +500,7 @@ void BM_loop_interp_multires_ex(
.cd_loop_mdisp_offset = cd_loop_mdisp_offset,
.md_dst = md_dst, .f_src_center = f_src_center,
.axis_x = axis_x, .axis_y = axis_y, .v1 = v1, .v4 = v4, .e1 = e1, .e2 = e2,
- .res = res, .d = 1.0f / (float)(res - 1)
+ .res = res, .d = 1.0f / (float)(res - 1),
};
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
diff --git a/source/blender/bmesh/intern/bmesh_interp.h b/source/blender/bmesh/intern/bmesh_interp.h
index dabdd23cf6f..ce6eb2186c5 100644
--- a/source/blender/bmesh/intern/bmesh_interp.h
+++ b/source/blender/bmesh/intern/bmesh_interp.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): Geoffrey Bantle, Levi Schooley.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_INTERP_H__
#define __BMESH_INTERP_H__
-/** \file blender/bmesh/intern/bmesh_interp.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
struct LinkNode;
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index c9b7b80b658..ce275342557 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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_iterators.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Functions to abstract looping over bmesh data structures.
*
@@ -519,7 +513,6 @@ void *bmiter__face_of_vert_step(struct BMIter__face_of_vert *iter)
/*
* LOOP OF VERT CALLBACKS
- *
*/
void bmiter__loop_of_vert_begin(struct BMIter__loop_of_vert *iter)
diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h
index ab066682081..73784dabea8 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.h
+++ b/source/blender/bmesh/intern/bmesh_iterators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_ITERATORS_H__
#define __BMESH_ITERATORS_H__
-/** \file blender/bmesh/intern/bmesh_iterators.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
/**
@@ -36,7 +30,6 @@
* adjacency queries. Tool authors should use
* the iterators provided in this file instead
* of inspecting the structure directly.
- *
*/
#include "BLI_compiler_attrs.h"
@@ -75,7 +68,7 @@ typedef enum BMIterType {
* from the other faces in the radial cycle surrounding the
* input loop's edge.*/
BM_LOOPS_OF_LOOP = 12,
- BM_LOOPS_OF_EDGE = 13
+ BM_LOOPS_OF_EDGE = 13,
} BMIterType;
#define BM_ITYPE_MAX 14
diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.h b/source/blender/bmesh/intern/bmesh_iterators_inline.h
index e7bd6164c27..30740a1bc90 100644
--- a/source/blender/bmesh/intern/bmesh_iterators_inline.h
+++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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_iterators_inline.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh inline iterator functions.
*/
@@ -169,7 +163,6 @@ BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *da
* it with the appropriate function pointers based
* upon its type and then calls BMeshIter_step()
* to return the first element of the iterator.
- *
*/
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *data)
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index f0e82e6ae38..ec7c2237edb 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_log.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* The BMLog is an interface for storing undo/redo steps as a BMesh is
* modified. It only stores changes to the BMesh, not full copies.
diff --git a/source/blender/bmesh/intern/bmesh_log.h b/source/blender/bmesh/intern/bmesh_log.h
index dd1772af068..8643e07c622 100644
--- a/source/blender/bmesh/intern/bmesh_log.h
+++ b/source/blender/bmesh/intern/bmesh_log.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_LOG_H__
#define __BMESH_LOG_H__
-/** \file blender/bmesh/intern/bmesh_log.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
struct BMFace;
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c
index add4529e18d..0c18625924d 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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_marking.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Selection routines for bmesh structures.
* This is actually all old code ripped from
@@ -43,6 +37,9 @@
#include "bmesh.h"
#include "bmesh_structure.h"
+/* For '_FLAG_OVERLAP'. */
+#include "bmesh_private.h"
+
static void recount_totsels(BMesh *bm)
{
const char iter_types[3] = {BM_VERTS_OF_MESH,
@@ -1058,6 +1055,68 @@ GHash *BM_select_history_map_create(BMesh *bm)
return map;
}
+/**
+ * Map arguments may all be the same pointer.
+ */
+void BM_select_history_merge_from_targetmap(
+ BMesh *bm,
+ GHash *vert_map,
+ GHash *edge_map,
+ GHash *face_map,
+ const bool use_chain)
+{
+
+#ifdef DEBUG
+ for (BMEditSelection *ese = bm->selected.first; ese; ese = ese->next) {
+ BLI_assert(BM_ELEM_API_FLAG_TEST(ese->ele, _FLAG_OVERLAP) == 0);
+ }
+#endif
+
+ for (BMEditSelection *ese = bm->selected.first; ese; ese = ese->next) {
+ BM_ELEM_API_FLAG_ENABLE(ese->ele, _FLAG_OVERLAP);
+
+ /* Only loop when (use_chain == true). */
+ GHash *map = NULL;
+ switch (ese->ele->head.htype) {
+ case BM_VERT: map = vert_map; break;
+ case BM_EDGE: map = edge_map; break;
+ case BM_FACE: map = face_map; break;
+ default: BMESH_ASSERT(0); break;
+ }
+ if (map != NULL) {
+ BMElem *ele_dst = ese->ele;
+ while (true) {
+ BMElem *ele_dst_next = BLI_ghash_lookup(map, ele_dst);
+ BLI_assert(ele_dst != ele_dst_next);
+ if (ele_dst_next == NULL) {
+ break;
+ }
+ ele_dst = ele_dst_next;
+ /* Break loop on circular reference (should never happen). */
+ if (UNLIKELY(ele_dst == ese->ele)) {
+ BLI_assert(0);
+ break;
+ }
+ if (use_chain == false) {
+ break;
+ }
+ }
+ ese->ele = ele_dst;
+ }
+ }
+
+ /* Remove overlapping duplicates. */
+ for (BMEditSelection *ese = bm->selected.first, *ese_next; ese; ese = ese_next) {
+ ese_next = ese->next;
+ if (BM_ELEM_API_FLAG_TEST(ese->ele, _FLAG_OVERLAP)) {
+ BM_ELEM_API_FLAG_DISABLE(ese->ele, _FLAG_OVERLAP);
+ }
+ else {
+ BLI_freelinkN(&bm->selected, ese);
+ }
+ }
+}
+
void BM_mesh_elem_hflag_disable_test(
BMesh *bm, const char htype, const char hflag,
const bool respecthide, const bool overwrite, const char hflag_test)
diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h
index 4730af66a74..a7416b484d7 100644
--- a/source/blender/bmesh/intern/bmesh_marking.h
+++ b/source/blender/bmesh/intern/bmesh_marking.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_MARKING_H__
#define __BMESH_MARKING_H__
-/** \file blender/bmesh/intern/bmesh_marking.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
typedef struct BMEditSelection {
@@ -114,6 +108,9 @@ void BM_select_history_clear(BMesh *bm);
bool BM_select_history_active_get(BMesh *bm, struct BMEditSelection *ese);
struct GHash *BM_select_history_map_create(BMesh *bm);
+void BM_select_history_merge_from_targetmap(
+ BMesh *bm, GHash *vert_map, GHash *edge_map, GHash *face_map, const bool use_chain);
+
#define BM_SELECT_HISTORY_BACKUP(bm) { \
ListBase _bm_prev_selected = (bm)->selected; BLI_listbase_clear(&(bm)->selected)
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 50aa3f08fbc..1e2612dd843 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_mesh.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BM mesh level functions.
*/
@@ -352,7 +346,7 @@ static void bm_mesh_edges_calc_vectors(BMesh *bm, float (*edgevec)[3], const flo
BMEdgesCalcVectorsData data = {
.vcos = vcos,
- .edgevec = edgevec
+ .edgevec = edgevec,
};
BM_iter_parallel(bm, BM_EDGES_OF_MESH, mesh_edges_calc_vectors_cb, &data, bm->totedge >= BM_OMP_LIMIT);
@@ -464,7 +458,7 @@ static void bm_mesh_verts_calc_normals(
.fnos = fnos,
.edgevec = edgevec,
.vcos = vcos,
- .vnos = vnos
+ .vnos = vnos,
};
BM_iter_parallel(bm, BM_FACES_OF_MESH, mesh_verts_calc_normals_accum_cb, &data, bm->totface >= BM_OMP_LIMIT);
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index dfd76c6b89f..6f340411b00 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,22 +12,18 @@
* 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): Geoffrey Bantle, Levi Schooley.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_MESH_H__
#define __BMESH_MESH_H__
-/** \file blender/bmesh/intern/bmesh_mesh.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
struct BMAllocTemplate;
-struct MLoopNorSpaceArray;
struct BMLoopNorEditDataArray;
+struct MLoopNorSpaceArray;
void BM_mesh_elem_toolflags_ensure(BMesh *bm);
void BM_mesh_elem_toolflags_clear(BMesh *bm);
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index e9ca659faa7..8254b8a2202 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_mesh_conv.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BM mesh conversion functions.
*
@@ -35,23 +29,17 @@
*
* There are comments in code but this should help explain the general
* intention as to how this works converting from/to bmesh.
- *
- *
* \subsection user_pov User Perspective
*
* - Editmode operations when a shape key-block is active edits only that key-block.
* - The first Basis key-block always matches the Mesh verts.
* - Changing vertex locations of _any_ Basis will apply offsets to those shape keys using this as their Basis.
- *
- *
* \subsection enter_editmode Entering EditMode - #BM_mesh_bm_from_me
*
* - the active key-block is used for BMesh vertex locations on entering edit-mode.
* So obviously the meshes vertex locations remain unchanged and the shape key its self is not being edited directly.
* Simply the #BMVert.co is a initialized from active shape key (when its set).
* - all key-blocks are added as CustomData layers (read code for details).
- *
- *
* \subsection exit_editmode Exiting EditMode - #BM_mesh_bm_to_me
*
* This is where the most confusing code is! Won't attempt to document the details here, for that read the code.
@@ -72,7 +60,6 @@
* are copied back into the mesh.
*
* This has the effect from the users POV of leaving the mesh un-touched, and only editing the active shape key-block.
- *
*/
#include "DNA_mesh_types.h"
@@ -92,7 +79,6 @@
#include "BKE_customdata.h"
#include "BKE_multires.h"
-#include "BKE_global.h" /* ugh - for looping over all objects */
#include "BKE_main.h"
#include "BKE_key.h"
@@ -209,15 +195,15 @@ void BM_mesh_bm_from_me(
BMFace *f, **ftable = NULL;
float (*keyco)[3] = NULL;
int totloops, i;
- const int64_t mask = CD_MASK_BMESH | params->cd_mask_extra;
- const int64_t mask_loop_only = mask & ~CD_MASK_ORIGINDEX;
+ CustomData_MeshMasks mask = CD_MASK_BMESH;
+ CustomData_MeshMasks_update(&mask, &params->cd_mask_extra);
if (!me || !me->totvert) {
if (me && is_new) { /*no verts? still copy customdata layout*/
- CustomData_copy(&me->vdata, &bm->vdata, mask, CD_ASSIGN, 0);
- CustomData_copy(&me->edata, &bm->edata, mask, CD_ASSIGN, 0);
- CustomData_copy(&me->ldata, &bm->ldata, mask_loop_only, CD_ASSIGN, 0);
- CustomData_copy(&me->pdata, &bm->pdata, mask, CD_ASSIGN, 0);
+ CustomData_copy(&me->vdata, &bm->vdata, mask.vmask, CD_ASSIGN, 0);
+ CustomData_copy(&me->edata, &bm->edata, mask.emask, CD_ASSIGN, 0);
+ CustomData_copy(&me->ldata, &bm->ldata, mask.lmask, CD_ASSIGN, 0);
+ CustomData_copy(&me->pdata, &bm->pdata, mask.pmask, CD_ASSIGN, 0);
CustomData_bmesh_init_pool(&bm->vdata, me->totvert, BM_VERT);
CustomData_bmesh_init_pool(&bm->edata, me->totedge, BM_EDGE);
@@ -228,10 +214,10 @@ void BM_mesh_bm_from_me(
}
if (is_new) {
- CustomData_copy(&me->vdata, &bm->vdata, mask, CD_CALLOC, 0);
- CustomData_copy(&me->edata, &bm->edata, mask, CD_CALLOC, 0);
- CustomData_copy(&me->ldata, &bm->ldata, mask_loop_only, CD_CALLOC, 0);
- CustomData_copy(&me->pdata, &bm->pdata, mask, CD_CALLOC, 0);
+ CustomData_copy(&me->vdata, &bm->vdata, mask.vmask, CD_CALLOC, 0);
+ CustomData_copy(&me->edata, &bm->edata, mask.emask, CD_CALLOC, 0);
+ CustomData_copy(&me->ldata, &bm->ldata, mask.lmask, CD_CALLOC, 0);
+ CustomData_copy(&me->pdata, &bm->pdata, mask.pmask, CD_CALLOC, 0);
}
/* -------------------------------------------------------------------- */
@@ -618,11 +604,12 @@ void BM_mesh_bm_to_me(
me->act_face = -1;
{
- const CustomDataMask mask = CD_MASK_MESH | params->cd_mask_extra;
- CustomData_copy(&bm->vdata, &me->vdata, mask, CD_CALLOC, me->totvert);
- CustomData_copy(&bm->edata, &me->edata, mask, CD_CALLOC, me->totedge);
- CustomData_copy(&bm->ldata, &me->ldata, mask, CD_CALLOC, me->totloop);
- CustomData_copy(&bm->pdata, &me->pdata, mask, CD_CALLOC, me->totpoly);
+ CustomData_MeshMasks mask = CD_MASK_MESH;
+ CustomData_MeshMasks_update(&mask, &params->cd_mask_extra);
+ CustomData_copy(&bm->vdata, &me->vdata, mask.vmask, CD_CALLOC, me->totvert);
+ CustomData_copy(&bm->edata, &me->edata, mask.emask, CD_CALLOC, me->totedge);
+ CustomData_copy(&bm->ldata, &me->ldata, mask.lmask, CD_CALLOC, me->totloop);
+ CustomData_copy(&bm->pdata, &me->pdata, mask.pmask, CD_CALLOC, me->totpoly);
}
CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, mvert, me->totvert);
@@ -721,7 +708,7 @@ void BM_mesh_bm_to_me(
ModifierData *md;
BMVert **vertMap = NULL;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if ((ob->parent) && (ob->parent->data == me) && ELEM(ob->partype, PARVERT1, PARVERT3)) {
if (vertMap == NULL) {
@@ -964,11 +951,11 @@ void BM_mesh_bm_to_me(
*
* \note Was `cddm_from_bmesh_ex` in 2.7x, removed `MFace` support.
*/
-void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const int64_t cd_mask_extra)
+void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *cd_mask_extra)
{
/* must be an empty mesh. */
BLI_assert(me->totvert == 0);
- BLI_assert((cd_mask_extra & CD_MASK_SHAPEKEY) == 0);
+ BLI_assert(cd_mask_extra == NULL || (cd_mask_extra->vmask & CD_MASK_SHAPEKEY) == 0);
me->totvert = bm->totvert;
me->totedge = bm->totedge;
@@ -987,11 +974,15 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const int64_t cd_mask_extra)
/* don't process shapekeys, we only feed them through the modifier stack as needed,
* e.g. for applying modifiers or the like*/
- const CustomDataMask mask = (CD_MASK_DERIVEDMESH | cd_mask_extra) & ~CD_MASK_SHAPEKEY;
- CustomData_merge(&bm->vdata, &me->vdata, mask, CD_CALLOC, me->totvert);
- CustomData_merge(&bm->edata, &me->edata, mask, CD_CALLOC, me->totedge);
- CustomData_merge(&bm->ldata, &me->ldata, mask, CD_CALLOC, me->totloop);
- CustomData_merge(&bm->pdata, &me->pdata, mask, CD_CALLOC, me->totpoly);
+ CustomData_MeshMasks mask = CD_MASK_DERIVEDMESH;
+ if (cd_mask_extra != NULL) {
+ CustomData_MeshMasks_update(&mask, cd_mask_extra);
+ }
+ mask.vmask &= ~CD_MASK_SHAPEKEY;
+ CustomData_merge(&bm->vdata, &me->vdata, mask.vmask, CD_CALLOC, me->totvert);
+ CustomData_merge(&bm->edata, &me->edata, mask.emask, CD_CALLOC, me->totedge);
+ CustomData_merge(&bm->ldata, &me->ldata, mask.lmask, CD_CALLOC, me->totloop);
+ CustomData_merge(&bm->pdata, &me->pdata, mask.pmask, CD_CALLOC, me->totpoly);
BKE_mesh_update_customdata_pointers(me, false);
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.h b/source/blender/bmesh/intern/bmesh_mesh_conv.h
index 6b1cbe0950e..30a1e8bffd5 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.h
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,16 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_MESH_CONV_H__
#define __BMESH_MESH_CONV_H__
-/** \file blender/bmesh/intern/bmesh_mesh_conv.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
+struct CustomData_MeshMasks;
struct Main;
struct Mesh;
@@ -47,7 +40,7 @@ struct BMeshFromMeshParams {
uint use_shapekey : 1;
/* define the active shape key (index + 1) */
int active_shapekey;
- int64_t cd_mask_extra;
+ struct CustomData_MeshMasks cd_mask_extra;
};
void BM_mesh_bm_from_me(
BMesh *bm, const struct Mesh *me,
@@ -57,7 +50,7 @@ ATTR_NONNULL(1, 3);
struct BMeshToMeshParams {
/** Update object hook indices & vertex parents. */
uint calc_object_remap : 1;
- int64_t cd_mask_extra;
+ struct CustomData_MeshMasks cd_mask_extra;
};
void BM_mesh_bm_to_me(
struct Main *bmain, BMesh *bm, struct Mesh *me,
@@ -65,7 +58,7 @@ void BM_mesh_bm_to_me(
ATTR_NONNULL(2, 3, 4);
void BM_mesh_bm_to_me_for_eval(
- BMesh *bm, struct Mesh *me, const int64_t cd_mask_extra)
+ BMesh *bm, struct Mesh *me, const struct CustomData_MeshMasks *cd_mask_extra)
ATTR_NONNULL(1, 2);
diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.c b/source/blender/bmesh/intern/bmesh_mesh_validate.c
index 3a6a3543bc8..de0554c0cc2 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_validate.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_validate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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
+/** \file
+ * \ingroup bmesh
*
* BM mesh validation function.
*/
diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.h b/source/blender/bmesh/intern/bmesh_mesh_validate.h
index f89141387d8..32bb4fb023b 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_validate.h
+++ b/source/blender/bmesh/intern/bmesh_mesh_validate.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* 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
+/** \file
+ * \ingroup bmesh
*/
bool BM_mesh_validate(BMesh *bm);
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index 4fa28e81359..bc0a09636f7 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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_mods.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* This file contains functions for locally modifying
* the topology of existing mesh data. (split, join, flip etc).
diff --git a/source/blender/bmesh/intern/bmesh_mods.h b/source/blender/bmesh/intern/bmesh_mods.h
index 330a714418d..87893727192 100644
--- a/source/blender/bmesh/intern/bmesh_mods.h
+++ b/source/blender/bmesh/intern/bmesh_mods.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_MODS_H__
#define __BMESH_MODS_H__
-/** \file blender/bmesh/intern/bmesh_mods.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
bool BM_vert_dissolve(BMesh *bm, BMVert *v);
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index 2cae6fb3823..e7585cc1836 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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_opdefines.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh operator definitions.
*
@@ -51,7 +45,6 @@
* (e.g. vertfaces.out), for three-type slots, use geom. note that you can also
* use more esoteric names (e.g. geom_skirt.out) so long as the comment next to the
* slot definition tells you what types of elements are in it.
- *
*/
#include "BLI_utildefines.h"
@@ -1141,7 +1134,7 @@ static BMO_FlagSet bmo_enum_dissolve_limit_flags[] = {
{BMO_DELIM_SEAM, "SEAM"},
{BMO_DELIM_SHARP, "SHARP"},
{BMO_DELIM_UV, "UV"},
- {0, NULL}
+ {0, NULL},
};
/*
@@ -1743,6 +1736,13 @@ static BMO_FlagSet bmo_enum_bevel_face_strength_type[] = {
{0, NULL},
};
+static BMO_FlagSet bmo_enum_bevel_miter_type[] = {
+ {BEVEL_MITER_SHARP, "SHARP"},
+ {BEVEL_MITER_PATCH, "PATCH"},
+ {BEVEL_MITER_ARC, "ARC"},
+ {0, NULL},
+};
+
/*
* Bevel.
*
@@ -1765,6 +1765,12 @@ static BMOpDefine bmo_bevel_def = {
{"harden_normals", BMO_OP_SLOT_BOOL}, /* harden normals */
{"face_strength_mode", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
bmo_enum_bevel_face_strength_type}, /* whether to set face strength, and which faces to set if so */
+ {"miter_outer", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
+ bmo_enum_bevel_miter_type}, /* outer miter kind */
+ {"miter_inner", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM},
+ bmo_enum_bevel_miter_type}, /* outer miter kind */
+ {"spread", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */
+ {"smoothresh", BMO_OP_SLOT_FLT}, /* for passing mesh's smoothresh, used in hardening */
{{'\0'}},
},
/* slots_out */
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index fd01bec9531..9894252a53a 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_OPERATOR_API_H__
#define __BMESH_OPERATOR_API_H__
-/** \file blender/bmesh/intern/bmesh_operator_api.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
#ifdef __cplusplus
@@ -228,7 +222,11 @@ typedef struct BMOpSlot {
float vec[3];
void **buf;
GHash *ghash;
- BMO_FlagSet *enum_flags;
+ struct {
+ /** Don't clobber (i) when assigning flags, see #eBMOpSlotSubType_Int. */
+ int _i;
+ BMO_FlagSet *flags;
+ } enum_data;
} data;
} BMOpSlot;
@@ -246,7 +244,7 @@ typedef struct BMOpSlot {
((slot >= (op)->slots_out) && (slot < &(op)->slots_out[BMO_OP_MAX_SLOTS])))
/* way more than probably needed, compiler complains if limit hit */
-#define BMO_OP_MAX_SLOTS 16
+#define BMO_OP_MAX_SLOTS 20
/* BMOpDefine->type_flag */
typedef enum {
@@ -360,7 +358,7 @@ enum {
/* A version of 'DEL_FACES' that keeps edges on face boundaries,
* allowing the surrounding edge-loop to be kept from removed face regions. */
DEL_FACES_KEEP_BOUNDARY,
- DEL_ONLYTAGGED
+ DEL_ONLYTAGGED,
};
typedef enum {
@@ -524,7 +522,7 @@ void BMO_slot_buffer_from_all(
*
* f = BMO_iter_new(&oiter, some_operator, "slot_name", BM_FACE);
* for (; f; f = BMO_iter_step(&oiter)) {
- * /do something with the face
+ * // do something with the face
* }
*
* another example, iterating over a mapping:
diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
index a453cfa1769..030b9480e4f 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api_inline.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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_operator_api_inline.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh inline operator functions.
*/
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 4bc09c173f6..2ce03cf5a7d 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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_operators.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh operator access.
*/
@@ -142,7 +136,7 @@ static void bmo_op_slots_init(const BMOSlotType *slot_types, BMOpSlot *slot_args
break;
case BMO_OP_SLOT_INT:
if (ELEM(slot->slot_subtype.intg, BMO_OP_SLOT_SUBTYPE_INT_ENUM, BMO_OP_SLOT_SUBTYPE_INT_FLAG)) {
- slot->data.enum_flags = slot_types[i].enum_flags;
+ slot->data.enum_data.flags = slot_types[i].enum_flags;
}
default:
break;
@@ -545,7 +539,6 @@ void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_nam
*
* Counts the number of elements of a certain type that have a
* specific flag enabled (or disabled if test_for_enabled is false).
- *
*/
static int bmo_mesh_flag_count(
@@ -1618,8 +1611,6 @@ static int BMO_opcode_from_opname_check(const char *opname)
* "delete context=%i geom=%hv",
* DEL_ONLYFACES, BM_ELEM_SELECT);
* \endcode
- *
- *
* **Primitive Types**
* - `b` - boolean (same as int but 1/0 only). #BMO_OP_SLOT_BOOL
* - `i` - int. #BMO_OP_SLOT_INT
@@ -1628,16 +1619,12 @@ static int BMO_opcode_from_opname_check(const char *opname)
* - `m3` - 3x3 matrix of floats. #BMO_OP_SLOT_MAT
* - `m4` - 4x4 matrix of floats. #BMO_OP_SLOT_MAT
* - `v` - 3D vector of floats. #BMO_OP_SLOT_VEC
- *
- *
* **Utility**
*
* Pass an existing slot which is copied to either an input or output slot.
* Taking the operator and slot-name pair of args (BMOperator *, const char *).
* - `s` - slot_in (lower case)
* - `S` - slot_out (upper case)
- *
- *
* **Element Buffer** (#BMO_OP_SLOT_ELEMENT_BUF)
* - `e` - single element vert/edge/face (use with #BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE).
* - `eb` - elem buffer, take an array and a length.
@@ -1851,7 +1838,12 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
BMO_slot_buffer_from_disabled_hflag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
}
else if (type == 'a') {
- BMO_slot_buffer_from_all(bm, op, op->slots_in, slot_name, htype);
+ if ((op->flag & BMO_FLAG_RESPECT_HIDE) == 0) {
+ BMO_slot_buffer_from_all(bm, op, op->slots_in, slot_name, htype);
+ }
+ else {
+ BMO_slot_buffer_from_disabled_hflag(bm, op, op->slots_in, slot_name, htype, BM_ELEM_HIDDEN);
+ }
}
else if (type == 'f') {
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index 365b5eb4681..6c0a6854d8e 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_OPERATORS_H__
#define __BMESH_OPERATORS_H__
-/** \file blender/bmesh/intern/bmesh_operators.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
/*see comments in intern/bmesh_opdefines.c for documentation of specific operators*/
@@ -36,7 +30,7 @@ enum {
SUBD_CORNER_INNERVERT,
SUBD_CORNER_PATH,
SUBD_CORNER_FAN,
- SUBD_CORNER_STRAIGHT_CUT
+ SUBD_CORNER_STRAIGHT_CUT,
};
/* aligned with PROP_SMOOTH and friends */
@@ -53,7 +47,7 @@ enum {
SUBDIV_SELECT_NONE,
SUBDIV_SELECT_ORIG,
SUBDIV_SELECT_INNER,
- SUBDIV_SELECT_LOOPCUT
+ SUBDIV_SELECT_LOOPCUT,
};
/* subdivide_edgering */
@@ -78,7 +72,7 @@ enum {
SIMFACE_COPLANAR,
SIMFACE_SMOOTH,
SIMFACE_FACEMAP,
- SIMFACE_FREESTYLE
+ SIMFACE_FREESTYLE,
};
/* similar edge selection slot values */
@@ -91,7 +85,7 @@ enum {
SIMEDGE_BEVEL,
SIMEDGE_SEAM,
SIMEDGE_SHARP,
- SIMEDGE_FREESTYLE
+ SIMEDGE_FREESTYLE,
};
/* similar vertex selection slot values */
@@ -99,14 +93,14 @@ enum {
SIMVERT_NORMAL = 0,
SIMVERT_FACE,
SIMVERT_VGROUP,
- SIMVERT_EDGE
+ SIMVERT_EDGE,
};
/* Poke face center calculation */
enum {
BMOP_POKE_MEDIAN_WEIGHTED = 0,
BMOP_POKE_MEDIAN,
- BMOP_POKE_BOUNDS
+ BMOP_POKE_BOUNDS,
};
/* Bevel offset_type slot values */
@@ -114,7 +108,7 @@ enum {
BEVEL_AMT_OFFSET,
BEVEL_AMT_WIDTH,
BEVEL_AMT_DEPTH,
- BEVEL_AMT_PERCENT
+ BEVEL_AMT_PERCENT,
};
/* Bevel face_strength_mode values: should match face_str mode enum in DNA_modifer_types.h */
@@ -125,6 +119,13 @@ enum {
BEVEL_FACE_STRENGTH_ALL,
};
+/* Bevel miter slot values */
+enum {
+ BEVEL_MITER_SHARP,
+ BEVEL_MITER_PATCH,
+ BEVEL_MITER_ARC,
+};
+
extern const BMOpDefine *bmo_opdefines[];
extern const int bmo_opdefines_total;
diff --git a/source/blender/bmesh/intern/bmesh_operators_private.h b/source/blender/bmesh/intern/bmesh_operators_private.h
index 8e9edfac1f9..8658f6c233c 100644
--- a/source/blender/bmesh/intern/bmesh_operators_private.h
+++ b/source/blender/bmesh/intern/bmesh_operators_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,21 +12,17 @@
* 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 *****
*/
#ifndef __BMESH_OPERATORS_PRIVATE_H__
#define __BMESH_OPERATORS_PRIVATE_H__
-/** \file blender/bmesh/intern/bmesh_operators_private.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
-struct BMesh;
struct BMOperator;
+struct BMesh;
void bmo_automerge_exec(BMesh *bm, BMOperator *op);
void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op);
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 7a556ce85fd..4b5b75d919b 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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_polygon.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* This file contains code for dealing
* with polygons (normal/area calculation,
@@ -30,6 +24,7 @@
#include "DNA_listBase.h"
#include "DNA_modifier_types.h"
+#include "DNA_meshdata_types.h"
#include "MEM_guardedalloc.h"
@@ -39,7 +34,6 @@
#include "BLI_polyfill_2d.h"
#include "BLI_polyfill_2d_beautify.h"
#include "BLI_linklist.h"
-#include "BLI_edgehash.h"
#include "BLI_heap.h"
#include "bmesh.h"
@@ -262,6 +256,25 @@ float BM_face_calc_area_with_mat3(const BMFace *f, const float mat3[3][3])
}
/**
+ * get the area of UV face
+ */
+float BM_face_calc_area_uv(const BMFace *f, int cd_loop_uv_offset)
+{
+ /* inline 'area_poly_v2' logic, avoid creating a temp array */
+ const BMLoop *l_iter, *l_first;
+
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+ /* The Trapezium Area Rule */
+ float cross = 0.0f;
+ do {
+ const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
+ const MLoopUV *luv_next = BM_ELEM_CD_GET_VOID_P(l_iter->next, cd_loop_uv_offset);
+ cross += (luv_next->uv[0] - luv->uv[0]) * (luv_next->uv[1] + luv->uv[1]);
+ } while ((l_iter = l_iter->next) != l_first);
+ return fabsf(cross * 0.5f);
+}
+
+/**
* compute the perimeter of an ngon
*/
float BM_face_calc_perimeter(const BMFace *f)
diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h
index 2003f2d2503..ff93ce94c77 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.h
+++ b/source/blender/bmesh/intern/bmesh_polygon.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_POLYGON_H__
#define __BMESH_POLYGON_H__
-/** \file blender/bmesh/intern/bmesh_polygon.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
struct Heap;
@@ -45,6 +39,7 @@ float BM_face_calc_normal_vcos(
float BM_face_calc_normal_subset(const BMLoop *l_first, const BMLoop *l_last, float r_no[3]) ATTR_NONNULL();
float BM_face_calc_area(const BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_face_calc_area_with_mat3(const BMFace *f, const float mat3[3][3]) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+float BM_face_calc_area_uv(const BMFace *f, int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_face_calc_perimeter(const BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_face_calc_perimeter_with_mat3(const BMFace *f, const float mat3[3][3]) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BM_face_calc_tangent_edge(const BMFace *f, float r_plane[3]) ATTR_NONNULL();
diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c
index 53874e4ed96..76c0dcc1dfa 100644
--- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c
+++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_polygon_edgenet.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* This file contains functions for splitting faces into isolated regions,
* defined by connected edges.
@@ -34,7 +30,6 @@
#include "BLI_alloca.h"
#include "BLI_utildefines_stack.h"
#include "BLI_linklist_stack.h"
-#include "BLI_sort.h"
#include "BLI_sort_utils.h"
#include "BLI_kdopbvh.h"
@@ -1066,7 +1061,6 @@ static bool test_tagged_and_notface(BMEdge *e, void *fptr)
*
* \note All edges and vertices must have their #BM_ELEM_INTERNAL_TAG flag enabled.
* This function leaves all the flags set as well.
- *
*/
static BMVert *bm_face_split_edgenet_partial_connect(BMesh *bm, BMVert *v_delimit, BMFace *f)
{
diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.h b/source/blender/bmesh/intern/bmesh_polygon_edgenet.h
index bf5cea59e30..7e57f648704 100644
--- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.h
+++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_POLYGON_EDGENET_H__
#define __BMESH_POLYGON_EDGENET_H__
-/** \file blender/bmesh/intern/bmesh_polygon_edgenet.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
bool BM_face_split_edgenet(
diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h
index 61e47a6cbd4..c0f74c50a3a 100644
--- a/source/blender/bmesh/intern/bmesh_private.h
+++ b/source/blender/bmesh/intern/bmesh_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_PRIVATE_H__
#define __BMESH_PRIVATE_H__
-/** \file blender/bmesh/intern/bmesh_private.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Private function prototypes for bmesh public API.
* This file is a grab-bag of functions from various
diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c
index 1f428620075..7a0d1c7ec5a 100644
--- a/source/blender/bmesh/intern/bmesh_query.c
+++ b/source/blender/bmesh/intern/bmesh_query.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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_query.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* This file contains functions for answering common
* Topological and geometric queries about a mesh, such
@@ -383,6 +377,13 @@ BMLoop *BM_vert_find_first_loop(BMVert *v)
{
return v->e ? bmesh_disk_faceloop_find_first(v->e, v) : NULL;
}
+/**
+ * A version of #BM_vert_find_first_loop that ignores hidden loops.
+ */
+BMLoop *BM_vert_find_first_loop_visible(BMVert *v)
+{
+ return v->e ? bmesh_disk_faceloop_find_first_visible(v->e, v) : NULL;
+}
/**
* Returns true if the vertex is used in a given face.
@@ -1678,13 +1679,13 @@ float BM_edge_calc_face_angle(const BMEdge *e)
}
/**
-* \brief BMESH EDGE/FACE ANGLE
-*
-* Calculates the angle between two faces in world space.
-* Assumes the face normals are correct.
-*
-* \return angle in radians
-*/
+ * \brief BMESH EDGE/FACE ANGLE
+ *
+ * Calculates the angle between two faces in world space.
+ * Assumes the face normals are correct.
+ *
+ * \return angle in radians
+ */
float BM_edge_calc_face_angle_with_imat3_ex(const BMEdge *e, const float imat3[3][3], const float fallback)
{
if (BM_edge_is_manifold(e)) {
@@ -2006,6 +2007,24 @@ BMEdge *BM_edge_find_double(BMEdge *e)
}
/**
+ * Only #BMEdge.l access us needed, however when we want the first visible loop,
+ * a utility function is needed.
+ */
+BMLoop *BM_edge_find_first_loop_visible(BMEdge *e)
+{
+ if (e->l != NULL) {
+ BMLoop *l_iter, *l_first;
+ l_iter = l_first = e->l;
+ do {
+ if (!BM_elem_flag_test(l_iter->f, BM_ELEM_HIDDEN)) {
+ return l_iter;
+ }
+ } while ((l_iter = l_iter->radial_next) != l_first);
+ }
+ return NULL;
+}
+
+/**
* Given a set of vertices (varr), find out if
* there is a face with exactly those vertices
* (and only those vertices).
diff --git a/source/blender/bmesh/intern/bmesh_query.h b/source/blender/bmesh/intern/bmesh_query.h
index b4d76b94c24..c04c7f5e97d 100644
--- a/source/blender/bmesh/intern/bmesh_query.h
+++ b/source/blender/bmesh/intern/bmesh_query.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_QUERY_H__
#define __BMESH_QUERY_H__
-/** \file blender/bmesh/intern/bmesh_query.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
bool BM_vert_in_face(BMVert *v, BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
@@ -48,7 +42,10 @@ BMLoop *BM_loop_other_edge_loop(BMLoop *l, BMVert *v) ATTR_WARN_UNUSED_RESULT AT
BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+
BMLoop *BM_vert_find_first_loop(BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+BMLoop *BM_vert_find_first_loop_visible(BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+BMLoop *BM_edge_find_first_loop_visible(BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
bool BM_vert_pair_share_face_check(
BMVert *v_a, BMVert *v_b) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
diff --git a/source/blender/bmesh/intern/bmesh_query_inline.h b/source/blender/bmesh/intern/bmesh_query_inline.h
index 92be3639dce..582aa55b600 100644
--- a/source/blender/bmesh/intern/bmesh_query_inline.h
+++ b/source/blender/bmesh/intern/bmesh_query_inline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_query_inline.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c
index 8f9b4274336..e4bad715b29 100644
--- a/source/blender/bmesh/intern/bmesh_structure.c
+++ b/source/blender/bmesh/intern/bmesh_structure.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_structure.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Low level routines for manipulating the BM structure.
*/
@@ -108,8 +100,6 @@ void bmesh_disk_vert_replace(BMEdge *e, BMVert *v_dst, BMVert *v_src)
* modification of specific cycle types.
*
* The three cycles explicitly stored in the BM data structure are as follows:
- *
- *
* 1: The Disk Cycle - A circle of edges around a vertex
* Base: vertex->edge pointer.
*
@@ -133,8 +123,6 @@ void bmesh_disk_vert_replace(BMEdge *e, BMVert *v_dst, BMVert *v_src)
* - #bmesh_disk_facevert_count
* - #bmesh_disk_faceedge_find_first
* - #bmesh_disk_faceedge_find_next
- *
- *
* 2: The Radial Cycle - A circle of face edges (bmesh_Loop) around an edge
* Base: edge->l->radial structure.
*
@@ -150,8 +138,6 @@ void bmesh_disk_vert_replace(BMEdge *e, BMVert *v_dst, BMVert *v_src)
* - #bmesh_radial_faceloop_find_first
* - #bmesh_radial_faceloop_find_next
* - #bmesh_radial_validate
- *
- *
* 3: The Loop Cycle - A circle of face edges around a polygon.
* Base: polygon->lbase.
*
@@ -161,8 +147,6 @@ void bmesh_disk_vert_replace(BMEdge *e, BMVert *v_dst, BMVert *v_src)
*
* Functions relating to this cycle:
* - bmesh_cycle_XXX family of functions.
- *
- *
* \note the order of elements in all cycles except the loop cycle is undefined. This
* leads to slightly increased seek time for deriving some adjacency relations, however the
* advantage is that no intrinsic properties of the data structures are dependent upon the
@@ -363,6 +347,28 @@ BMLoop *bmesh_disk_faceloop_find_first(const BMEdge *e, const BMVert *v)
return NULL;
}
+/**
+ * A version of #bmesh_disk_faceloop_find_first that ignores hidden faces.
+ */
+BMLoop *bmesh_disk_faceloop_find_first_visible(const BMEdge *e, const BMVert *v)
+{
+ const BMEdge *e_iter = e;
+ do {
+ if (!BM_elem_flag_test(e_iter, BM_ELEM_HIDDEN)) {
+ if (e_iter->l != NULL) {
+ BMLoop *l_iter, *l_first;
+ l_iter = l_first = e_iter->l;
+ do {
+ if (!BM_elem_flag_test(l_iter->f, BM_ELEM_HIDDEN)) {
+ return (l_iter->v == v) ? l_iter : l_iter->next;
+ }
+ } while ((l_iter = l_iter->radial_next) != l_first);
+ }
+ }
+ } while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e);
+ return NULL;
+}
+
BMEdge *bmesh_disk_faceedge_find_next(const BMEdge *e, const BMVert *v)
{
BMEdge *e_find;
diff --git a/source/blender/bmesh/intern/bmesh_structure.h b/source/blender/bmesh/intern/bmesh_structure.h
index 974b276f8b3..8e3ba7b46c0 100644
--- a/source/blender/bmesh/intern/bmesh_structure.h
+++ b/source/blender/bmesh/intern/bmesh_structure.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_STRUCTURE_H__
#define __BMESH_STRUCTURE_H__
-/** \file blender/bmesh/intern/bmesh_structure.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* The lowest level of functionality for manipulating bmesh structures.
* None of these functions should ever be exported to the rest of Blender.
@@ -53,6 +45,7 @@ int bmesh_disk_facevert_count_at_most(const BMVert *v, const int count_max)
int bmesh_disk_facevert_count(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMEdge *bmesh_disk_faceedge_find_first(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMLoop *bmesh_disk_faceloop_find_first(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+BMLoop *bmesh_disk_faceloop_find_first_visible(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMEdge *bmesh_disk_faceedge_find_next(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
/* RADIAL CYCLE MANAGMENT */
diff --git a/source/blender/bmesh/intern/bmesh_structure_inline.h b/source/blender/bmesh/intern/bmesh_structure_inline.h
index 64292194ae7..31c1e6500c9 100644
--- a/source/blender/bmesh/intern/bmesh_structure_inline.h
+++ b/source/blender/bmesh/intern/bmesh_structure_inline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_structure_inline.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh inline operator functions.
*/
diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c
index 44692b760b6..011addc9220 100644
--- a/source/blender/bmesh/intern/bmesh_walkers.c
+++ b/source/blender/bmesh/intern/bmesh_walkers.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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, Levi Schooley.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_walkers.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh Walker API.
*/
diff --git a/source/blender/bmesh/intern/bmesh_walkers.h b/source/blender/bmesh/intern/bmesh_walkers.h
index b2373a069db..fc911957f71 100644
--- a/source/blender/bmesh/intern/bmesh_walkers.h
+++ b/source/blender/bmesh/intern/bmesh_walkers.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_WALKERS_H__
#define __BMESH_WALKERS_H__
-/** \file blender/bmesh/intern/bmesh_walkers.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
/*
@@ -38,7 +32,7 @@ typedef enum {
typedef enum {
BMW_FLAG_NOP = 0,
- BMW_FLAG_TEST_HIDDEN = (1 << 0)
+ BMW_FLAG_TEST_HIDDEN = (1 << 0),
} BMWFlag;
/*Walkers*/
@@ -131,7 +125,7 @@ enum {
/* do not intitialze function pointers and struct size in BMW_init */
BMW_CUSTOM,
- BMW_MAXWALKERS
+ BMW_MAXWALKERS,
};
/* use with BMW_init, so as not to confuse with restrict flags */
diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index 81487b70edc..67e3a86fbe3 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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, Levi Schooley.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_walkers_impl.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh Walker Code.
*/
@@ -603,7 +597,6 @@ static void *bmw_FaceShellWalker_step(BMWalker *walker)
* Similar to shell walker, but visits vertices instead of edges.
*
* Walk from a vertex to all connected vertices.
- *
*/
static void bmw_ConnectedVertexWalker_visitVertex(BMWalker *walker, BMVert *v)
{
@@ -867,7 +860,6 @@ static void *bmw_IslandManifoldWalker_step(BMWalker *walker)
* \{
*
* Starts at a tool-flagged edge and walks over the edge loop
- *
*/
/* utility function to see if an edge is apart of an ngon boundary */
diff --git a/source/blender/bmesh/intern/bmesh_walkers_private.h b/source/blender/bmesh/intern/bmesh_walkers_private.h
index 66d812b45d0..185c18d6777 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_private.h
+++ b/source/blender/bmesh/intern/bmesh_walkers_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_WALKERS_PRIVATE_H__
#define __BMESH_WALKERS_PRIVATE_H__
-/** \file blender/bmesh/intern/bmesh_walkers_private.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh walker API.
*/
diff --git a/source/blender/bmesh/operators/bmo_beautify.c b/source/blender/bmesh/operators/bmo_beautify.c
index 00b2b8a5d1b..4efa3d98262 100644
--- a/source/blender/bmesh/operators/bmo_beautify.c
+++ b/source/blender/bmesh/operators/bmo_beautify.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_beautify.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Beautify the mesh by rotating edges between triangles
* to more attractive positions until no more rotations can be made.
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index 1ef8531397f..19c377d18a9 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_bevel.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Bevel wrapper around #BM_mesh_bevel
*/
@@ -43,10 +37,14 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
const bool clamp_overlap = BMO_slot_bool_get(op->slots_in, "clamp_overlap");
const int material = BMO_slot_int_get(op->slots_in, "material");
const bool loop_slide = BMO_slot_bool_get(op->slots_in, "loop_slide");
- const bool mark_seam = BMO_slot_bool_get(op->slots_in, "mark_seam");
- const bool mark_sharp = BMO_slot_bool_get(op->slots_in, "mark_sharp");
+ const bool mark_seam = BMO_slot_bool_get(op->slots_in, "mark_seam");
+ const bool mark_sharp = BMO_slot_bool_get(op->slots_in, "mark_sharp");
const bool harden_normals = BMO_slot_bool_get(op->slots_in, "harden_normals");
const int face_strength_mode = BMO_slot_int_get(op->slots_in, "face_strength_mode");
+ const int miter_outer = BMO_slot_int_get(op->slots_in, "miter_outer");
+ const int miter_inner = BMO_slot_int_get(op->slots_in, "miter_inner");
+ const float spread = BMO_slot_float_get(op->slots_in, "spread");
+ const float smoothresh = BMO_slot_float_get(op->slots_in, "smoothresh");
if (offset > 0) {
BMOIter siter;
@@ -72,7 +70,8 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
BM_mesh_bevel(
bm, offset, offset_type, seg, profile, vonly, false, clamp_overlap, NULL, -1, material,
- loop_slide, mark_seam, mark_sharp, harden_normals, face_strength_mode);
+ loop_slide, mark_seam, mark_sharp, harden_normals, face_strength_mode,
+ miter_outer, miter_inner, spread, smoothresh);
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_TAG);
diff --git a/source/blender/bmesh/operators/bmo_bisect_plane.c b/source/blender/bmesh/operators/bmo_bisect_plane.c
index ed232e81b82..800f5bac715 100644
--- a/source/blender/bmesh/operators/bmo_bisect_plane.c
+++ b/source/blender/bmesh/operators/bmo_bisect_plane.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_bisect_plane.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Wrapper around #BM_mesh_bisect_plane
*/
diff --git a/source/blender/bmesh/operators/bmo_bridge.c b/source/blender/bmesh/operators/bmo_bridge.c
index 61179d7be70..896c28dd743 100644
--- a/source/blender/bmesh/operators/bmo_bridge.c
+++ b/source/blender/bmesh/operators/bmo_bridge.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_bridge.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Connect verts across faces (splits faces) and bridge tool.
*/
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index 0b5f1bb9ca1..d3cf3f2d945 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_connect.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Connect verts across faces (splits faces).
*/
diff --git a/source/blender/bmesh/operators/bmo_connect_concave.c b/source/blender/bmesh/operators/bmo_connect_concave.c
index d1811ac6a83..7e3278853ce 100644
--- a/source/blender/bmesh/operators/bmo_connect_concave.c
+++ b/source/blender/bmesh/operators/bmo_connect_concave.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_connect_concave.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Connect vertices so all resulting faces are convex.
*
diff --git a/source/blender/bmesh/operators/bmo_connect_nonplanar.c b/source/blender/bmesh/operators/bmo_connect_nonplanar.c
index 67590fe8ef9..102892626f2 100644
--- a/source/blender/bmesh/operators/bmo_connect_nonplanar.c
+++ b/source/blender/bmesh/operators/bmo_connect_nonplanar.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_connect_nonplanar.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Connect verts non-planer faces iteratively (splits faces).
*/
diff --git a/source/blender/bmesh/operators/bmo_connect_pair.c b/source/blender/bmesh/operators/bmo_connect_pair.c
index caf40c71756..41d574aa373 100644
--- a/source/blender/bmesh/operators/bmo_connect_pair.c
+++ b/source/blender/bmesh/operators/bmo_connect_pair.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_connect_pair.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Connect vertex pair across multiple faces (splits faces).
*/
@@ -37,7 +31,6 @@
#include "intern/bmesh_operators_private.h" /* own include */
#include "BLI_mempool.h"
-#include "BLI_listbase.h"
/**
* Method for connecting across many faces.
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index aeaedf6417c..ff4b671784d 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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, Campbell Barton.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_create.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Create faces or edges (Fkey by default).
*/
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 0ad800cbddd..0c249f84cb2 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_dissolve.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Removes isolated geometry regions without creating holes in the mesh.
*/
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
index 9dd4eded002..c5a6a582b96 100644
--- a/source/blender/bmesh/operators/bmo_dupe.c
+++ b/source/blender/bmesh/operators/bmo_dupe.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_dupe.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Duplicate, Split, Split operators.
*/
@@ -383,7 +377,6 @@ void BMO_dupe_from_flag(BMesh *bm, int htype, const char hflag)
*
* \note Lower level uses of this operator may want to use #BM_mesh_separate_faces
* Since it's faster for the 'use_only_faces' case.
- *
*/
void bmo_split_exec(BMesh *bm, BMOperator *op)
{
@@ -557,13 +550,14 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
if (elem_array[i]->head.htype == BM_EDGE) {
BMEdge *e_src = (BMEdge *)elem_array[i];
BMEdge *e_dst = BM_edge_find_double(e_src);
- BM_edge_splice(bm, e_dst, e_src);
- elem_array_len--;
- elem_array[i] = elem_array[elem_array_len];
- }
- else {
- i++;
+ if (e_dst != NULL) {
+ BM_edge_splice(bm, e_dst, e_src);
+ elem_array_len--;
+ elem_array[i] = elem_array[elem_array_len];
+ continue;
+ }
}
+ i++;
}
/* Full copies of faces may cause overlap. */
for (int i = 0; i < elem_array_len; ) {
diff --git a/source/blender/bmesh/operators/bmo_edgenet.c b/source/blender/bmesh/operators/bmo_edgenet.c
index 931ac684b07..b974c2aeb79 100644
--- a/source/blender/bmesh/operators/bmo_edgenet.c
+++ b/source/blender/bmesh/operators/bmo_edgenet.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_edgenet.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Edge-Net for filling in open edge-loops.
*/
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index a13024d8793..d4c49ae2347 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_extrude.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Extrude faces and solidify.
*/
@@ -44,7 +38,7 @@
enum {
EXT_INPUT = 1,
EXT_KEEP = 2,
- EXT_DEL = 4
+ EXT_DEL = 4,
};
#define VERT_MARK 1
diff --git a/source/blender/bmesh/operators/bmo_fill_attribute.c b/source/blender/bmesh/operators/bmo_fill_attribute.c
index dcf2570dff4..b724f6202bd 100644
--- a/source/blender/bmesh/operators/bmo_fill_attribute.c
+++ b/source/blender/bmesh/operators/bmo_fill_attribute.c
@@ -1,7 +1,4 @@
-
/*
- * ***** 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
@@ -15,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_fill_attribute.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Fill in geometry with the attributes of their adjacent data.
*/
diff --git a/source/blender/bmesh/operators/bmo_fill_edgeloop.c b/source/blender/bmesh/operators/bmo_fill_edgeloop.c
index f33a60ccc5c..e82072de90f 100644
--- a/source/blender/bmesh/operators/bmo_fill_edgeloop.c
+++ b/source/blender/bmesh/operators/bmo_fill_edgeloop.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_fill_edgeloop.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Fill discreet edge loop(s) with faces.
*/
diff --git a/source/blender/bmesh/operators/bmo_fill_grid.c b/source/blender/bmesh/operators/bmo_fill_grid.c
index a20555cf0c0..ff9ad5135dd 100644
--- a/source/blender/bmesh/operators/bmo_fill_grid.c
+++ b/source/blender/bmesh/operators/bmo_fill_grid.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_fill_grid.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Fill 2 isolated, open edge loops with a grid of quads.
*/
diff --git a/source/blender/bmesh/operators/bmo_fill_holes.c b/source/blender/bmesh/operators/bmo_fill_holes.c
index 869994a98b9..bf3c4cb1fc7 100644
--- a/source/blender/bmesh/operators/bmo_fill_holes.c
+++ b/source/blender/bmesh/operators/bmo_fill_holes.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_fill_holes.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Fill boundary edge loop(s) with faces.
*/
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c
index ca727de5756..1979cddfa17 100644
--- a/source/blender/bmesh/operators/bmo_hull.c
+++ b/source/blender/bmesh/operators/bmo_hull.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Nicholas Bishop
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_hull.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Create a convex hull using bullet physics library.
*/
@@ -51,7 +45,7 @@ typedef enum {
HULL_FLAG_OUTPUT_GEOM = (1 << 2),
HULL_FLAG_DEL = (1 << 3),
- HULL_FLAG_HOLE = (1 << 4)
+ HULL_FLAG_HOLE = (1 << 4),
} HullFlags;
/* Store hull triangles separate from BMesh faces until the end; this
diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c
index a64c6d74a93..72fce49f41f 100644
--- a/source/blender/bmesh/operators/bmo_inset.c
+++ b/source/blender/bmesh/operators/bmo_inset.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,13 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_inset.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Inset face regions.
* Inset individual faces.
- *
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c
index b1053e6d8c2..7ff7cbbe1ac 100644
--- a/source/blender/bmesh/operators/bmo_join_triangles.c
+++ b/source/blender/bmesh/operators/bmo_join_triangles.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_join_triangles.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Convert triangle to quads.
*
diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c
index cc1f45baf0c..5db189a6748 100644
--- a/source/blender/bmesh/operators/bmo_mesh_conv.c
+++ b/source/blender/bmesh/operators/bmo_mesh_conv.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_mesh_conv.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* This file contains functions
* for converting a Mesh
diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c
index 64f9773714b..e3bf4b00968 100644
--- a/source/blender/bmesh/operators/bmo_mirror.c
+++ b/source/blender/bmesh/operators/bmo_mirror.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_mirror.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Basic mirror, optionally with UVs's.
*/
diff --git a/source/blender/bmesh/operators/bmo_normals.c b/source/blender/bmesh/operators/bmo_normals.c
index 212ff315801..f91f15ee881 100644
--- a/source/blender/bmesh/operators/bmo_normals.c
+++ b/source/blender/bmesh/operators/bmo_normals.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_normals.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* normal recalculation.
*/
@@ -57,7 +51,7 @@ static bool bmo_recalc_normal_loop_filter_cb(const BMLoop *l, void *UNUSED(user_
* +
* |\ <- face
* + +
- * \ \
+ * \ \
* \ \
* \ +--------------+
* \ |
diff --git a/source/blender/bmesh/operators/bmo_offset_edgeloops.c b/source/blender/bmesh/operators/bmo_offset_edgeloops.c
index d54efc27124..9bf48eaeb96 100644
--- a/source/blender/bmesh/operators/bmo_offset_edgeloops.c
+++ b/source/blender/bmesh/operators/bmo_offset_edgeloops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_offset_edgeloops.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Simple edge offset functionality.
*
diff --git a/source/blender/bmesh/operators/bmo_planar_faces.c b/source/blender/bmesh/operators/bmo_planar_faces.c
index a6d92301250..f5a0e6aec74 100644
--- a/source/blender/bmesh/operators/bmo_planar_faces.c
+++ b/source/blender/bmesh/operators/bmo_planar_faces.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_planar_faces.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Iteratively flatten 4+ sided faces.
*/
diff --git a/source/blender/bmesh/operators/bmo_poke.c b/source/blender/bmesh/operators/bmo_poke.c
index ea84a69855d..2d2a13f3207 100644
--- a/source/blender/bmesh/operators/bmo_poke.c
+++ b/source/blender/bmesh/operators/bmo_poke.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Francisco De La Cruz
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_poke.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Pokes a face.
*
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index b4f41790a81..12962dd281c 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_primitive.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Primitive shapes.
*/
@@ -52,7 +46,7 @@ static const float icovert[12][3] = {
{-144.72f, 105.144f, 89.443f},
{55.277f, 170.128f, 89.443f},
{178.885f, 0.0f, 89.443f},
- {0.0f, 0.0f, 200.0f}
+ {0.0f, 0.0f, 200.0f},
};
static const short icoface[20][3] = {
@@ -75,7 +69,7 @@ static const short icoface[20][3] = {
{7, 6, 11},
{8, 7, 11},
{9, 8, 11},
- {10, 9, 11}
+ {10, 9, 11},
};
static const float icouvs[60][2] =
@@ -99,7 +93,7 @@ static const float icouvs[60][2] =
{1.000000f, 0.314921f}, {0.818181f, 0.314921f}, {0.909090f, 0.472382f},
{0.272727f, 0.314921f}, {0.090909f, 0.314921f}, {0.181818f, 0.472382f},
{0.454545f, 0.314921f}, {0.272727f, 0.314921f}, {0.363636f, 0.472382f},
- {0.636363f, 0.314921f}, {0.454545f, 0.314921f}, {0.545454f, 0.472382f}
+ {0.636363f, 0.314921f}, {0.454545f, 0.314921f}, {0.545454f, 0.472382f},
};
@@ -744,7 +738,7 @@ static const float monkeyuvs[] =
0.620420f, 0.565675f, 0.671403f, 0.592656f, 0.484068f, 0.628776f, 0.498072f, 0.552315f,
0.276936f, 0.625067f, 0.092820f, 0.589862f, 0.145041f, 0.562595f, 0.264218f, 0.550140f,
0.391039f, 0.611891f, 0.498072f, 0.552315f, 0.484068f, 0.628776f, 0.434803f, 0.658882f,
- 0.276936f, 0.625067f, 0.264218f, 0.550140f, 0.369913f, 0.610196f, 0.325318f, 0.656224f
+ 0.276936f, 0.625067f, 0.264218f, 0.550140f, 0.369913f, 0.610196f, 0.325318f, 0.656224f,
};
#define VERT_MARK 1
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index 8468227d17e..1432e15185e 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_removedoubles.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Welding and merging functionality.
*/
@@ -31,6 +25,7 @@
#include "BLI_math.h"
#include "BLI_alloca.h"
#include "BLI_kdtree.h"
+#include "BLI_listbase.h"
#include "BLI_utildefines_stack.h"
#include "BLI_stack.h"
@@ -39,7 +34,6 @@
#include "bmesh.h"
#include "intern/bmesh_operators_private.h"
-
static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op, BMOpSlot *slot_targetmap)
{
BMIter liter;
@@ -79,7 +73,7 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op, BMOpSlot
/**
* helper function for bmo_weld_verts_exec so we can use stack memory
*/
-static BMFace *remdoubles_createface(BMesh *bm, BMFace *f, BMOpSlot *slot_targetmap)
+static BMFace *remdoubles_createface(BMesh *bm, BMFace *f, BMOpSlot *slot_targetmap, bool *r_created)
{
BMEdge *e_new;
@@ -95,6 +89,7 @@ static BMFace *remdoubles_createface(BMesh *bm, BMFace *f, BMOpSlot *slot_target
STACK_INIT(loops, f->len);
STACK_INIT(verts, f->len);
+ *r_created = false;
{
#define LOOP_MAP_VERT_INIT(l_init, v_map, is_del) \
@@ -161,20 +156,23 @@ finally:
}
if (STACK_SIZE(edges) >= 3) {
- if (!BM_face_exists(verts, STACK_SIZE(edges))) {
- BMFace *f_new = BM_face_create(bm, verts, edges, STACK_SIZE(edges), f, BM_CREATE_NOP);
- BLI_assert(f_new != f);
-
- if (f_new) {
- uint i = 0;
- BMLoop *l_iter, *l_first;
- l_iter = l_first = BM_FACE_FIRST_LOOP(f_new);
- do {
- BM_elem_attrs_copy(bm, bm, loops[i], l_iter);
- } while ((void)i++, (l_iter = l_iter->next) != l_first);
-
- return f_new;
- }
+ BMFace *f_new = BM_face_exists(verts, STACK_SIZE(verts));
+ if (f_new) {
+ return f_new;
+ }
+ f_new = BM_face_create(bm, verts, edges, STACK_SIZE(edges), f, BM_CREATE_NOP);
+ BLI_assert(f_new != f);
+
+ if (f_new) {
+ uint i = 0;
+ BMLoop *l_iter, *l_first;
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f_new);
+ do {
+ BM_elem_attrs_copy(bm, bm, loops[i], l_iter);
+ } while ((void)i++, (l_iter = l_iter->next) != l_first);
+
+ *r_created = true;
+ return f_new;
}
}
@@ -185,24 +183,38 @@ finally:
/**
* \note with 'targetmap', multiple 'keys' are currently supported, though no callers should be using.
* (because slot maps currently use GHash without the GHASH_FLAG_ALLOW_DUPES flag set)
- *
*/
void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
{
BMIter iter, liter;
- BMVert *v1, *v2;
+ BMVert *v;
BMEdge *e;
BMLoop *l;
BMFace *f;
BMOpSlot *slot_targetmap = BMO_slot_get(op->slots_in, "targetmap");
+ /* Maintain selection history. */
+ const bool has_selected = !BLI_listbase_is_empty(&bm->selected);
+ const bool use_targetmap_all = has_selected;
+ GHash *targetmap_all = NULL;
+ if (use_targetmap_all) {
+ /* Map deleted to keep elem. */
+ targetmap_all = BLI_ghash_ptr_new(__func__);
+ }
+
/* mark merge verts for deletion */
- BM_ITER_MESH (v1, &iter, bm, BM_VERTS_OF_MESH) {
- if ((v2 = BMO_slot_map_elem_get(slot_targetmap, v1))) {
- BMO_vert_flag_enable(bm, v1, ELE_DEL);
+ BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+ BMVert *v_dst = BMO_slot_map_elem_get(slot_targetmap, v);
+ if (v_dst != NULL) {
+ BMO_vert_flag_enable(bm, v, ELE_DEL);
/* merge the vertex flags, else we get randomly selected/unselected verts */
- BM_elem_flag_merge(v1, v2);
+ BM_elem_flag_merge_ex(v, v_dst, BM_ELEM_HIDDEN);
+
+ if (use_targetmap_all) {
+ BLI_assert(v != v_dst);
+ BLI_ghash_insert(targetmap_all, v, v_dst);
+ }
}
}
@@ -213,6 +225,7 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
}
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+ BMVert *v1, *v2;
const bool is_del_v1 = BMO_vert_flag_test_bool(bm, (v1 = e->v1), ELE_DEL);
const bool is_del_v2 = BMO_vert_flag_test_bool(bm, (v2 = e->v2), ELE_DEL);
@@ -231,7 +244,11 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
if (e_new == NULL) {
e_new = BM_edge_create(bm, v1, v2, e, BM_CREATE_NOP);
}
- BM_elem_flag_merge(e_new, e);
+ BM_elem_flag_merge_ex(e_new, e, BM_ELEM_HIDDEN);
+ if (use_targetmap_all) {
+ BLI_assert(e != e_new);
+ BLI_ghash_insert(targetmap_all, e, e_new);
+ }
}
BMO_edge_flag_enable(bm, e, ELE_DEL);
@@ -254,27 +271,52 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
}
if (vert_delete) {
+ bool use_in_place = false;
+ BMFace *f_new = NULL;
BMO_face_flag_enable(bm, f, ELE_DEL);
if (f->len - edge_collapse >= 3) {
- BMFace *f_new = remdoubles_createface(bm, f, slot_targetmap);
-
+ bool created;
+ f_new = remdoubles_createface(bm, f, slot_targetmap, &created);
/* do this so we don't need to return a list of created faces */
if (f_new) {
- bmesh_face_swap_data(f_new, f);
+ if (created) {
+ bmesh_face_swap_data(f_new, f);
- if (bm->use_toolflags) {
- SWAP(BMFlagLayer *, ((BMFace_OFlag *)f)->oflags, ((BMFace_OFlag *)f_new)->oflags);
- }
+ if (bm->use_toolflags) {
+ SWAP(BMFlagLayer *, ((BMFace_OFlag *)f)->oflags, ((BMFace_OFlag *)f_new)->oflags);
+ }
- BMO_face_flag_disable(bm, f, ELE_DEL);
+ BMO_face_flag_disable(bm, f, ELE_DEL);
+ BM_face_kill(bm, f_new);
+ use_in_place = true;
+ }
+ else {
+ BM_elem_flag_merge_ex(f_new, f, BM_ELEM_HIDDEN);
+ }
+ }
+ }
- BM_face_kill(bm, f_new);
+ if ((use_in_place == false) && (f_new != NULL)) {
+ BLI_assert(f != f_new);
+ if (use_targetmap_all) {
+ BLI_ghash_insert(targetmap_all, f, f_new);
+ }
+ if (bm->act_face && (f == bm->act_face)) {
+ bm->act_face = f_new;
}
}
}
}
+ if (has_selected) {
+ BM_select_history_merge_from_targetmap(bm, targetmap_all, targetmap_all, targetmap_all, true);
+ }
+
+ if (use_targetmap_all) {
+ BLI_ghash_free(targetmap_all, NULL, NULL);
+ }
+
BMO_mesh_delete_oflag_context(bm, ELE_DEL, DEL_ONLYTAGGED);
}
diff --git a/source/blender/bmesh/operators/bmo_rotate_edges.c b/source/blender/bmesh/operators/bmo_rotate_edges.c
index 6c5d69ba290..bfc7ba75763 100644
--- a/source/blender/bmesh/operators/bmo_rotate_edges.c
+++ b/source/blender/bmesh/operators/bmo_rotate_edges.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_rotate_edges.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Rotate edges topology that share two faces.
*/
diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
index 9f394aacc1c..acdb49e94e1 100644
--- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c
+++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Alexander Pinzon
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_smooth_laplacian.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Advanced smoothing.
*/
diff --git a/source/blender/bmesh/operators/bmo_split_edges.c b/source/blender/bmesh/operators/bmo_split_edges.c
index f67a9e38fcc..e0728c6539b 100644
--- a/source/blender/bmesh/operators/bmo_split_edges.c
+++ b/source/blender/bmesh/operators/bmo_split_edges.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_split_edges.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Just a wrapper around #BM_mesh_edgesplit
*/
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index 66730f8c837..360b1fea4d2 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_subdivide.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Edge based subdivision with various subdivision patterns.
*/
diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
index ade9b4ce8b7..04a5cf316be 100644
--- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c
+++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_subdivide_edgering.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* This operator is a special edge-ring subdivision tool
* which gives special options for interpolation.
diff --git a/source/blender/bmesh/operators/bmo_symmetrize.c b/source/blender/bmesh/operators/bmo_symmetrize.c
index 2afd2c574f9..0df3759ae8b 100644
--- a/source/blender/bmesh/operators/bmo_symmetrize.c
+++ b/source/blender/bmesh/operators/bmo_symmetrize.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_symmetrize.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Makes the mesh symmetrical by splitting along an axis and duplicating the geometry.
*/
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 8b096e25746..747b1769137 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_triangulate.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Triangulate faces, also defines triangle fill.
*/
diff --git a/source/blender/bmesh/operators/bmo_unsubdivide.c b/source/blender/bmesh/operators/bmo_unsubdivide.c
index ec222b48751..cd95cda3088 100644
--- a/source/blender/bmesh/operators/bmo_unsubdivide.c
+++ b/source/blender/bmesh/operators/bmo_unsubdivide.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_unsubdivide.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Pattern based geometry reduction which has the result similar to undoing
* a subdivide operation.
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index e9ee1e6e552..3e99d5fb814 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmo_utils.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* utility bmesh operators, e.g. transform,
* translate, rotate, scale, etc.
diff --git a/source/blender/bmesh/operators/bmo_wireframe.c b/source/blender/bmesh/operators/bmo_wireframe.c
index ac81dde93c0..dcce9dbfb01 100644
--- a/source/blender/bmesh/operators/bmo_wireframe.c
+++ b/source/blender/bmesh/operators/bmo_wireframe.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/operators/bmo_wireframe.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Creates a solid wireframe from connected faces.
*/
diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c
index 5d535cc7503..aa484a2ef8b 100644
--- a/source/blender/bmesh/tools/bmesh_beautify.c
+++ b/source/blender/bmesh/tools/bmesh_beautify.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/tools/bmesh_beautify.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Beautify the mesh by rotating edges between triangles
* to more attractive positions until no more rotations can be made.
diff --git a/source/blender/bmesh/tools/bmesh_beautify.h b/source/blender/bmesh/tools/bmesh_beautify.h
index 0d6aa23b81d..f967af2bfe7 100644
--- a/source/blender/bmesh/tools/bmesh_beautify.h
+++ b/source/blender/bmesh/tools/bmesh_beautify.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BMESH_BEAUTIFY_H__
#define __BMESH_BEAUTIFY_H__
-/** \file blender/bmesh/tools/bmesh_beautify.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
enum {
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 7149df7dc4e..803a55bf9a8 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,10 @@
* 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,
- * Aleksandr Mokhov,
- * Howard Trickey,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/tools/bmesh_bevel.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Main functions for beveling a BMesh (used by the tool and modifier)
*/
@@ -38,8 +28,6 @@
#include "BLI_array.h"
#include "BLI_alloca.h"
-#include "BLI_gsqueue.h"
-#include "BLI_linklist_stack.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BLI_utildefines.h"
@@ -89,6 +77,7 @@ typedef struct EdgeHalf {
BMFace *fnext; /* face between this edge and next, if any */
struct BoundVert *leftv; /* left boundary vert (looking along edge to end) */
struct BoundVert *rightv; /* right boundary vert, if beveled */
+ int profile_index; /* offset into profile to attach non-beveled edge */
int seg; /* how many segments for the bevel */
float offset_l; /* offset for this edge, on left side */
float offset_r; /* offset for this edge, on right side */
@@ -154,6 +143,8 @@ typedef struct BoundVert {
Profile profile; /* edge profile between this and next BoundVert */
bool any_seam; /* are any of the edges attached here seams? */
bool visited; /* used during delta adjust pass */
+ bool is_arc_start; /* this boundvert begins an arc profile */
+ bool is_patch_start; /* this boundvert begins a patch profile */
int seam_len; /* length of seam starting from current boundvert to next boundvert with ccw ordering */
int sharp_len; /* Same as seam_len but defines length of sharp edges */
// int _pad;
@@ -209,6 +200,7 @@ typedef struct BevelParams {
float offset; /* blender units to offset each side of a beveled edge */
int offset_type; /* how offset is measured; enum defined in bmesh_operators.h */
int seg; /* number of segments in beveled edge profile */
+ float profile; /* user profile setting */
float pro_super_r; /* superellipse parameter for edge profile */
bool vertex_only; /* bevel vertices only */
bool use_weights; /* bevel amount affected by weights on edges or verts */
@@ -222,6 +214,10 @@ typedef struct BevelParams {
int vertex_group; /* vertex group index, maybe set if vertex_only */
int mat_nr; /* if >= 0, material number for bevel; else material comes from adjacent faces */
int face_strength_mode; /* setting face strength if > 0 */
+ int miter_outer; /* what kind of miter pattern to use on reflex angles */
+ int miter_inner; /* what kind of miter pattern to use on non-reflex angles */
+ float spread; /* amount to spread when doing inside miter */
+ float smoothresh; /* mesh's smoothresh, used if hardening */
} BevelParams;
// #pragma GCC diagnostic ignored "-Wpadded"
@@ -305,6 +301,9 @@ static BoundVert *add_new_bound_vert(MemArena *mem_arena, VMesh *vm, const float
ans->adjchain = NULL;
ans->sinratio = 1.0f;
ans->visited = false;
+ ans->any_seam = false;
+ ans->is_arc_start = false;
+ ans->is_patch_start = false;
vm->count++;
return ans;
}
@@ -449,7 +448,7 @@ static BMFace *boundvert_rep_face(BoundVert *v, BMFace **r_fother)
if (v->efirst->fprev != frep)
frep2 = v->efirst->fprev;
}
- else {
+ else if (v->efirst) {
frep = v->efirst->fprev;
if (frep) {
if (v->elast->fnext != frep)
@@ -468,6 +467,18 @@ static BMFace *boundvert_rep_face(BoundVert *v, BMFace **r_fother)
frep = v->elast->fprev;
}
}
+ else if (v->prev->elast) {
+ frep = v->prev->elast->fnext;
+ if (v->next->efirst) {
+ if (frep)
+ frep2 = v->next->efirst->fprev;
+ else
+ frep = v->next->efirst->fprev;
+ }
+ }
+ else {
+ frep = NULL;
+ }
if (r_fother)
*r_fother = frep2;
return frep;
@@ -736,6 +747,36 @@ static bool is_outside_edge(EdgeHalf *e, const float co[3], BMVert **ret_closer_
}
}
+/* Return -1, 0, or 1 as angle from e1 to e2 is <. =, or > 180 degrees */
+static int edges_angle_kind(EdgeHalf *e1, EdgeHalf *e2, BMVert *v)
+{
+ BMVert *v1, *v2;
+ float dir1[3], dir2[3], cross[3], *no, dot;
+
+ v1 = BM_edge_other_vert(e1->e, v);
+ v2 = BM_edge_other_vert(e2->e, v);
+ sub_v3_v3v3(dir1, v->co, v1->co);
+ sub_v3_v3v3(dir2, v->co, v2->co);
+ normalize_v3(dir1);
+ normalize_v3(dir2);
+ /* angles are in [0,pi]. need to compare cross product with normal to see if they are reflex */
+ cross_v3_v3v3(cross, dir1, dir2);
+ normalize_v3(cross);
+ if (e1->fnext)
+ no = e1->fnext->no;
+ else if (e2->fprev)
+ no = e2->fprev->no;
+ else
+ no = v->no;
+ dot = dot_v3v3(cross, no);
+ if (fabsf(dot) < BEVEL_EPSILON_BIG)
+ return 0;
+ else if (dot < 0.0f)
+ return 1;
+ else
+ return -1;
+}
+
/* co should be approximately on the plane between e1 and e2, which share common vert v
* and common face f (which cannot be NULL).
* Is it between those edges, sweeping CCW? */
@@ -810,6 +851,9 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, bool e
if (ang < BEVEL_EPSILON_ANG) {
/* special case: e1 and e2 are parallel; put offset point perp to both, from v.
* need to find a suitable plane.
+ * this code used to just use offset and dir1, but that makes for visible errors
+ * on a circle with > 200 sides, which trips this "nearly perp" code (see T61214).
+ * so use the average of the two, and the offset formula for angle bisector.
* if offsets are different, we're out of luck:
* use the max of the two (so get consistent looking results if the same situation
* arises elsewhere in the object but with opposite roles for e1 and e2 */
@@ -817,10 +861,12 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, bool e
copy_v3_v3(norm_v, f->no);
else
copy_v3_v3(norm_v, v->no);
+ add_v3_v3(dir1, dir2);
cross_v3_v3v3(norm_perp1, dir1, norm_v);
normalize_v3(norm_perp1);
copy_v3_v3(off1a, v->co);
d = max_ff(e1->offset_r, e2->offset_l);
+ d = d / cos(ang / 2.0f);
madd_v3_v3fl(off1a, norm_perp1, d);
copy_v3_v3(meetco, off1a);
}
@@ -1180,6 +1226,16 @@ static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv)
}
copy_v3_v3(pro->plane_co, co1);
}
+ else if (bndv->is_arc_start) {
+ /* assume pro->midco was alredy set */
+ copy_v3_v3(pro->coa, co1);
+ copy_v3_v3(pro->cob, co2);
+ pro->super_r = PRO_CIRCLE_R;
+ zero_v3(pro->plane_co);
+ zero_v3(pro->plane_no);
+ zero_v3(pro->proj_dir);
+ do_linear_interp = false;
+ }
if (do_linear_interp) {
pro->super_r = PRO_LINE_R;
copy_v3_v3(pro->coa, co1);
@@ -1301,8 +1357,8 @@ static bool make_unit_square_map(
add_v3_v3v3(vd, vo, vddir);
/* The cols of m are: {vmid - va, vmid - vb, vmid + vd - va -vb, va + vb - vmid;
- * blender transform matrices are stored such that m[i][*] is ith column;
- * the last elements of each col remain as they are in unity matrix */
+ * blender transform matrices are stored such that m[i][*] is ith column;
+ * the last elements of each col remain as they are in unity matrix. */
sub_v3_v3v3(&r_mat[0][0], vmid, va);
r_mat[0][3] = 0.0f;
sub_v3_v3v3(&r_mat[1][0], vmid, vb);
@@ -1703,11 +1759,38 @@ static void bevel_extend_edge_data(BevVert *bv)
} while (bcur != start);
}
-/*
+/* Mark edges as sharp if they are between a smooth recon face and a new face. */
+static void bevel_edges_sharp_boundary(BMesh *bm, BevelParams *bp)
+{
+ BMIter fiter, liter;
+ BMFace *f, *fother;
+ BMLoop *l, *lother;
+ FKind fkind;
+
+ BM_ITER_MESH(f, &fiter, bm, BM_FACES_OF_MESH) {
+ if (!BM_elem_flag_test(f, BM_ELEM_SMOOTH))
+ continue;
+ if (get_face_kind(bp, f) != F_RECON)
+ continue;
+ BM_ITER_ELEM(l, &liter, f, BM_LOOPS_OF_FACE) {
+ /* cases we care about will have exactly one adjacent face */
+ lother = l->radial_next;
+ fother = lother->f;
+ if (lother != l && fother) {
+ fkind = get_face_kind(bp, lother->f);
+ if (ELEM(fkind, F_EDGE, F_VERT)) {
+ BM_elem_flag_disable(l->e, BM_ELEM_SMOOTH);
+ }
+ }
+ }
+ }
+}
+
+/**
* Harden normals for bevel.
- * The desired effect is that the newly created F_EDGE and F_VERT faces appear smoothly shaded
- * with the the normals at the boundaries with F_RECON faces matching those recon faces.
- * And at boundaries between F_EDGE and F_VERT faces, the normals should match the F_EDGE ones.
+ * The desired effect is that the newly created #F_EDGE and F_VERT faces appear smoothly shaded
+ * with the normals at the boundaries with #F_RECON faces matching those recon faces.
+ * And at boundaries between #F_EDGE and #F_VERT faces, the normals should match the #F_EDGE ones.
* Assumes custom loop normals are in use.
*/
static void bevel_harden_normals(BMesh *bm, BevelParams *bp)
@@ -1725,11 +1808,25 @@ static void bevel_harden_normals(BMesh *bm, BevelParams *bp)
return;
/* recalculate all face and vertex normals; side effect: ensures vertex, edge, face indices */
+ /* I suspect this is not necessary: TODO: test that guess */
BM_mesh_normals_update(bm);
+ cd_clnors_offset = CustomData_get_offset(&bm->ldata, CD_CUSTOMLOOPNORMAL);
+
+ /* If there is not already a custom split normal layer then making one (with BM_lnorspace_update)
+ * will not respect the autosmooth angle between smooth faces. To get that to happen, we have
+ * to mark the sharpen the edges that are only sharp because of the angle test -- otherwise would be smooth.
+ */
+ if (cd_clnors_offset == -1) {
+ BM_edges_sharp_from_angle_set(bm, bp->smoothresh);
+ bevel_edges_sharp_boundary(bm, bp);
+ }
+
/* ensure that bm->lnor_spacearr has properly stored loop normals; side effect: ensures loop indices */
BM_lnorspace_update(bm);
- cd_clnors_offset = CustomData_get_offset(&bm->ldata, CD_CUSTOMLOOPNORMAL);
+
+ if (cd_clnors_offset == -1)
+ cd_clnors_offset = CustomData_get_offset(&bm->ldata, CD_CUSTOMLOOPNORMAL);
BM_ITER_MESH(f, &fiter, bm, BM_FACES_OF_MESH) {
fkind = get_face_kind(bp, f);
@@ -2087,6 +2184,87 @@ static void build_boundary_terminal_edge(BevelParams *bp, BevVert *bv, EdgeHalf
}
}
+/* Helper for build_boundary to handle special miters */
+static void adjust_miter_coords(BevelParams *bp, BevVert *bv, EdgeHalf *emiter)
+{
+ float co1[3], co2[3], co3[3], edge_dir[3], line_p[3];
+ BoundVert *v1, *v2, *v3, *v1prev, *v3next;
+ BMVert *vother;
+ EdgeHalf *emiter_other;
+ int miter_outer = bp->miter_outer;
+
+ v1 = emiter->rightv;
+ if (miter_outer == BEVEL_MITER_PATCH) {
+ v2 = v1->next;
+ v3 = v2->next;
+ }
+ else {
+ BLI_assert(miter_outer == BEVEL_MITER_ARC);
+ v2 = NULL;
+ v3 = v1->next;
+ }
+ v1prev = v1->prev;
+ v3next = v3->next;
+ copy_v3_v3(co2, v1->nv.co);
+ if (v1->is_arc_start)
+ copy_v3_v3(v1->profile.midco, co2);
+
+ /* co1 is intersection of line through co2 in dir of emiter->e
+ * and plane with normal the dir of emiter->e and through v1prev */
+ vother = BM_edge_other_vert(emiter->e, bv->v);
+ sub_v3_v3v3(edge_dir, bv->v->co, vother->co);
+ normalize_v3(edge_dir);
+ float d = bp->offset / (bp->seg / 2.0f); /* a fallback amount to move */
+ madd_v3_v3v3fl(line_p, co2, edge_dir, d);
+ if (!isect_line_plane_v3(co1, co2, line_p, v1prev->nv.co, edge_dir)) {
+ copy_v3_v3(co1, line_p);
+ }
+ adjust_bound_vert(v1, co1);
+
+ /* co3 is similar, but plane is through v3next and line is other side of miter edge */
+ emiter_other = v3->elast; /*v3->efirst;*/
+ vother = BM_edge_other_vert(emiter_other->e, bv->v);
+ sub_v3_v3v3(edge_dir, bv->v->co, vother->co);
+ normalize_v3(edge_dir);
+ madd_v3_v3v3fl(line_p, co2, edge_dir, d);
+ if (!isect_line_plane_v3(co3, co2, line_p, v3next->nv.co, edge_dir)) {
+ copy_v3_v3(co1, line_p);
+ }
+ adjust_bound_vert(v3, co3);
+}
+
+static void adjust_miter_inner_coords(BevelParams *bp, BevVert *bv, EdgeHalf *emiter)
+{
+ BoundVert *v, *vstart, *v3;
+ EdgeHalf *e;
+ BMVert *vother;
+ float edge_dir[3], co[3];
+
+ v = vstart = bv->vmesh->boundstart;
+ do {
+ if (v->is_arc_start) {
+ v3 = v->next;
+ e = v->efirst;
+ if (e != emiter) {
+ copy_v3_v3(co, v->nv.co);
+ vother = BM_edge_other_vert(e->e, bv->v);
+ sub_v3_v3v3(edge_dir, vother->co, bv->v->co);
+ normalize_v3(edge_dir);
+ madd_v3_v3v3fl(v->nv.co, co, edge_dir, bp->spread);
+ e = v3->elast;
+ vother = BM_edge_other_vert(e->e, bv->v);
+ sub_v3_v3v3(edge_dir, vother->co, bv->v->co);
+ normalize_v3(edge_dir);
+ madd_v3_v3v3fl(v3->nv.co, co, edge_dir, bp->spread);
+ }
+ v = v3->next;
+ }
+ else {
+ v = v->next;
+ }
+ } while (v != vstart);
+}
+
/* Make a circular list of BoundVerts for bv, each of which has the coordinates
* of a vertex on the boundary of the beveled vertex bv->v.
* This may adjust some EdgeHalf widths, and there might have to be
@@ -2102,11 +2280,12 @@ static void build_boundary_terminal_edge(BevelParams *bp, BevVert *bv, EdgeHalf
static void build_boundary(BevelParams *bp, BevVert *bv, bool construct)
{
MemArena *mem_arena = bp->mem_arena;
- EdgeHalf *efirst, *e, *e2, *e3, *enip, *eip, *eon;
- BoundVert *v;
+ EdgeHalf *efirst, *e, *e2, *e3, *enip, *eip, *eon, *emiter;
+ BoundVert *v, *v1, *v2, *v3;
VMesh *vm;
float co[3], r;
- int nip, nnip;
+ int nip, nnip, miter_outer, miter_inner;
+ int ang_kind;
/* Current bevel does nothing if only one edge into a vertex */
if (bv->edgecount <= 1)
@@ -2129,6 +2308,13 @@ static void build_boundary(BevelParams *bp, BevVert *bv, bool construct)
return;
}
+ /* Special miters outside only for 3 or more beveled edges */
+ miter_outer = (bv->selcount >= 3) ? bp->miter_outer : BEVEL_MITER_SHARP;
+ miter_inner = bp->miter_inner;
+
+ /* keep track of the first beveled edge of an outside miter (there can be at most 1 per bv */
+ emiter = NULL;
+
/* Here: there is more than one beveled edge.
* We make BoundVerts to connect the sides of the beveled edges.
* Non-beveled edges in between will just join to the appropriate juncture point. */
@@ -2189,13 +2375,115 @@ static void build_boundary(BevelParams *bp, BevVert *bv, bool construct)
for (e3 = e->next; e3 != e2; e3 = e3->next) {
e3->leftv = e3->rightv = v;
}
+ ang_kind = edges_angle_kind(e, e2, bv->v);
+
+ /* Are we doing special mitering?
+ * ang_kind is -1, 0, 1 as angle is <, =, > 180 degrees.
+ * There can only be one outer reflex angle, so only one outer miter,
+ * and emiter will be set to the first edge of such an edge.
+ * A miter kind of BEVEL_MITER_SHARP means no special miter */
+
+ if ((miter_outer != BEVEL_MITER_SHARP && !emiter && ang_kind == 1) ||
+ (miter_inner != BEVEL_MITER_SHARP && ang_kind == -1))
+ {
+ if (ang_kind == 1)
+ emiter = e;
+ /* make one or two more boundverts; for now all will have same co */
+ v1 = v;
+ v1->ebev = NULL;
+ if (ang_kind == 1 && miter_outer == BEVEL_MITER_PATCH)
+ v2 = add_new_bound_vert(mem_arena, vm, co);
+ else
+ v2 = NULL;
+ v3 = add_new_bound_vert(mem_arena, vm, co);
+ v3->ebev = e2;
+ v3->efirst = e2;
+ v3->elast = e2;
+ v3->eon = NULL;
+ e2->leftv = v3;
+ if (ang_kind == 1 && miter_outer == BEVEL_MITER_PATCH) {
+ v1->is_patch_start = true;
+ v2->eon = v1->eon;
+ v2->sinratio = v1->sinratio;
+ v2->ebev = NULL;
+ v1->eon = NULL;
+ v1->sinratio = 1.0f;
+ v1->elast = e;
+ if (e->next == e2) {
+ v2->efirst = NULL;
+ v2->elast = NULL;
+ }
+ else {
+ v2->efirst = e->next;
+ for (e3 = e->next; e3 != e2; e3 = e3->next) {
+ e3->leftv = e3->rightv = v2;
+ v2->elast = e3;
+ }
+ }
+ }
+ else {
+ v1->is_arc_start = true;
+ copy_v3_v3(v1->profile.midco, co);
+ if (e->next == e2) {
+ v1->elast = v1->efirst;
+ }
+ else {
+ int between = nip + nnip;
+ int bet2 = between / 2;
+ bool betodd = (between % 2) == 1;
+ int i = 0;
+ /* Put first half of in-between edges at index 0,
+ * second half at index bp->seg.
+ * If between is odd, put middle one at midindex */
+ for (e3 = e->next; e3 != e2; e3 = e3->next) {
+ v1->elast = e3;
+ if (i < bet2)
+ e3->profile_index = 0;
+ else if (betodd && i == bet2)
+ e3->profile_index = bp->seg / 2;
+ else
+ e3->profile_index = bp->seg;
+ i++;
+ }
+ }
+ }
+ }
}
else {
- adjust_bound_vert(e->rightv, co);
+ ang_kind = edges_angle_kind(e, e2, bv->v);
+ if ((miter_outer != BEVEL_MITER_SHARP && !emiter && ang_kind == 1) ||
+ (miter_inner != BEVEL_MITER_SHARP && ang_kind == -1))
+ {
+ if (ang_kind == 1)
+ emiter = e;
+ v1 = e->rightv;
+ if (ang_kind == 1 && miter_outer == BEVEL_MITER_PATCH) {
+ v2 = v1->next;
+ v3 = v2->next;
+ }
+ else {
+ v2 = NULL;
+ v3 = v1->next;
+ }
+ adjust_bound_vert(v1, co);
+ if (v2)
+ adjust_bound_vert(v2, co);
+ adjust_bound_vert(v3, co);
+ }
+ else {
+ adjust_bound_vert(e->rightv, co);
+ }
}
e = e2;
} while (e != efirst);
+ if (miter_inner != BEVEL_MITER_SHARP) {
+ adjust_miter_inner_coords(bp, bv, emiter);
+ }
+ if (emiter) {
+ adjust_miter_coords(bp, bv, emiter);
+ }
+
calculate_vm_profiles(bp, bv, vm);
if (construct) {
@@ -2537,10 +2825,11 @@ static void adjust_the_cycle_or_chain(BoundVert *vstart, bool iscycle)
static void adjust_offsets(BevelParams *bp)
{
BevVert *bv, *bvcur;
- BoundVert *v, *vanchor, *vchainstart, *vnext;
+ BoundVert *v, *vanchor, *vchainstart, *vchainend, *vnext;
EdgeHalf *enext;
GHashIterator giter;
bool iscycle;
+ int chainlen;
/* find and process chains and cycles of unvisited BoundVerts that have eon set */
GHASH_ITER(giter, bp->vert_hash) {
@@ -2561,14 +2850,21 @@ static void adjust_offsets(BevelParams *bp)
* pairs with the right side of the next edge in the cycle or chain. */
/* first follow paired edges in left->right direction */
- v = vchainstart = vanchor;
+ v = vchainstart = vchainend = vanchor;
iscycle = false;
+ chainlen = 1;
while (v->eon && !v->visited && !iscycle) {
+ v->visited = true;
+ if (!v->efirst)
+ break;
enext = find_other_end_edge_half(bp, v->efirst, &bvcur);
+ if (!enext)
+ break;
BLI_assert(enext != NULL);
vnext = enext->leftv;
v->adjchain = vnext;
- v->visited = true;
+ vchainend = vnext;
+ chainlen++;
if (vnext->visited) {
if (vnext != vchainstart) {
break;
@@ -2583,15 +2879,20 @@ static void adjust_offsets(BevelParams *bp)
v = vchainstart;
bvcur = bv;
do {
+ v->visited = true;
+ if (!v->elast)
+ break;
enext = find_other_end_edge_half(bp, v->elast, &bvcur);
- BLI_assert(enext != NULL);
+ if (!enext)
+ break;
vnext = enext->rightv;
vnext->adjchain = v;
+ chainlen++;
vchainstart = vnext;
- v->visited = true;
v = vnext;
} while (!v->visited && v->eon);
- adjust_the_cycle_or_chain(vchainstart, false);
+ if (chainlen >= 3 && !vchainstart->eon && !vchainend->eon)
+ adjust_the_cycle_or_chain(vchainstart, false);
}
} while ((vanchor = vanchor->next) != bv->vmesh->boundstart);
}
@@ -3262,6 +3563,8 @@ static int tri_corner_test(BevelParams *bp, BevVert *bv)
if (bp->vertex_only)
return -1;
+ if (bv->vmesh->count != 3)
+ return 0;
totang = 0.0f;
for (i = 0; i < bv->edgecount; i++) {
e = &bv->edges[i];
@@ -3325,7 +3628,23 @@ static VMesh *adj_vmesh(BevelParams *bp, BevVert *bv)
float co[3], coa[3], cob[3], dir[3];
BoundVert *bndv;
MemArena *mem_arena = bp->mem_arena;
- float r, fac, fullness;
+ float r, p, fullness;
+ /* best fullness for circles, segs = 2,4,6,8,10 */
+#define CIRCLE_FULLNESS_SEGS 11
+ static const float circle_fullness[CIRCLE_FULLNESS_SEGS] = {
+ 0.0f, /* nsegs ==1 */
+ 0.559f, /* 2 */
+ 0.642f, /* 3 */
+ 0.551f, /* 4 */
+ 0.646f, /* 5 */
+ 0.624f, /* 6 */
+ 0.646f, /* 7 */
+ 0.619f, /* 8 */
+ 0.647f, /* 9 */
+ 0.639f, /* 10 */
+ 0.647f, /* 11 */
+ };
+
n = bv->vmesh->count;
/* Same bevel as that of 3 edges of vert in a cube */
@@ -3357,20 +3676,25 @@ static VMesh *adj_vmesh(BevelParams *bp, BevVert *bv)
mul_v3_fl(co, 1.0f / (float)n);
sub_v3_v3v3(cob, co, coa);
add_v3_v3(cob, co);
+
+ /* An offline optimization process found fullness that let to closest fit to sphere as
+ * a function of r and ns (for case of cube corner) */
r = bp->pro_super_r;
- if (r == 1.0f)
+ p = bp->profile;
+ if (r == PRO_LINE_R) {
fullness = 0.0f;
- else if (r > 1.0f) {
- if (bp->vertex_only)
- fac = 0.25f;
- else if (r == PRO_SQUARE_R)
- fac = -2.0;
- else
- fac = 0.5f;
- fullness = 1.0f - fac / r;
+ }
+ else if (r == PRO_CIRCLE_R && ns > 0 && ns <= CIRCLE_FULLNESS_SEGS) {
+ fullness = circle_fullness[ns - 1];
}
else {
- fullness = r - 1.0f;
+ /* linear regression fit found best linear function, separately for even/odd segs */
+ if (ns % 2 == 0) {
+ fullness = 2.4506f * p - 0.00000300f * ns - 0.6266f;
+ }
+ else {
+ fullness = 2.3635f * p + 0.000152f * ns - 0.6060f;
+ }
}
sub_v3_v3v3(dir, coa, co);
if (len_squared_v3(dir) > BEVEL_EPSILON_SQ)
@@ -3616,10 +3940,11 @@ static void closer_v3_v3v3v3(float r[3], float a[3], float b[3], float v[3])
* We have to move the boundary edges too -- the usual method is to make one profile plane between
* successive BoundVerts, but for the effect we want here, there will be two planes, one on each side
* of the original edge.
+ * At the moment, this is not called for odd number of segments, though code does something if it is.
*/
static VMesh *square_out_adj_vmesh(BevelParams *bp, BevVert *bv)
{
- int n, ns, ns2, odd, i, j, k, ikind, im1, clstride;
+ int n, ns, ns2, odd, i, j, k, ikind, im1, clstride, iprev, akind;
float bndco[3], dir1[3], dir2[3], co1[3], co2[3], meet1[3], meet2[3], v1co[3], v2co[3];
float *on_edge_cur, *on_edge_prev, *p;
float ns2inv, finalfrac, ang;
@@ -3627,6 +3952,7 @@ static VMesh *square_out_adj_vmesh(BevelParams *bp, BevVert *bv)
EdgeHalf *e1, *e2;
VMesh *vm;
float *centerline;
+ bool *cset, v1set, v2set;
n = bv->vmesh->count;
ns = bv->vmesh->seg;
@@ -3636,52 +3962,118 @@ static VMesh *square_out_adj_vmesh(BevelParams *bp, BevVert *bv)
vm = new_adj_vmesh(bp->mem_arena, n, ns, bv->vmesh->boundstart);
clstride = 3 * (ns2 + 1);
centerline = MEM_mallocN(clstride * n * sizeof(float), "bevel");
+ cset = MEM_callocN(n * sizeof(bool), "bevel");
/* find on_edge, place on bndv[i]'s elast where offset line would meet,
- * averaging with position where next sector's offset line would meet */
+ * taking min-distance-to bv->v with position where next sector's offset line would meet */
bndv = vm->boundstart;
for (i = 0; i < n; i++) {
copy_v3_v3(bndco, bndv->nv.co);
e1 = bndv->efirst;
e2 = bndv->elast;
- sub_v3_v3v3(dir1, e1->e->v1->co, e1->e->v2->co);
- sub_v3_v3v3(dir2, e2->e->v1->co, e2->e->v2->co);
- add_v3_v3v3(co1, bndco, dir1);
- add_v3_v3v3(co2, bndco, dir2);
- /* intersect e1 with line through bndv parallel to e2 to get v1co */
- ikind = isect_line_line_v3(e1->e->v1->co, e1->e->v2->co, bndco, co2, meet1, meet2);
-
- if (ikind == 0) {
- /* Placeholder: this should get eliminated by min dist test with adjacent edge */
- mid_v3_v3v3(v1co, e1->e->v1->co, e1->e->v2->co);
- }
- else {
- /* if the lines are skew (ikind == 2), want meet1 which is on e1 */
- copy_v3_v3(v1co, meet1);
- }
- /* intersect e2 with line through bndv parallel to e1 to get v2co */
- ikind = isect_line_line_v3(e2->e->v1->co, e2->e->v2->co, bndco, co1, meet1, meet2);
- if (ikind == 0) {
- mid_v3_v3v3(v2co, e2->e->v1->co, e2->e->v2->co);
- }
- else {
- copy_v3_v3(v2co, meet1);
- }
+ akind = 0;
+ if (e1 && e2)
+ akind = edges_angle_kind(e1, e2, bv->v);
+ if (bndv->is_patch_start) {
+ mid_v3_v3v3(centerline + clstride * i, bndv->nv.co, bndv->next->nv.co);
+ cset[i] = true;
+ bndv = bndv->next;
+ i++;
+ mid_v3_v3v3(centerline + clstride * i, bndv->nv.co, bndv->next->nv.co);
+ cset[i] = true;
+ bndv = bndv->next;
+ i++;
+ /* leave cset[i] where it was - probably false, unless i == n - 1 */
+ }
+ else if (bndv->is_arc_start) {
+ e1 = bndv->efirst;
+ e2 = bndv->next->efirst;
+ copy_v3_v3(centerline + clstride * i, bndv->profile.midco);
+ bndv = bndv->next;
+ cset[i] = true;
+ i++;
+ /* leave cset[i] where it was - probably false, unless i == n - 1 */
+ }
+ else if (akind < 0) {
+ sub_v3_v3v3(dir1, e1->e->v1->co, e1->e->v2->co);
+ sub_v3_v3v3(dir2, e2->e->v1->co, e2->e->v2->co);
+ add_v3_v3v3(co1, bndco, dir1);
+ add_v3_v3v3(co2, bndco, dir2);
+ /* intersect e1 with line through bndv parallel to e2 to get v1co */
+ ikind = isect_line_line_v3(e1->e->v1->co, e1->e->v2->co, bndco, co2, meet1, meet2);
+ if (ikind == 0) {
+ v1set = false;
+ }
+ else {
+ /* if the lines are skew (ikind == 2), want meet1 which is on e1 */
+ copy_v3_v3(v1co, meet1);
+ v1set = true;
+ }
+ /* intersect e2 with line through bndv parallel to e1 to get v2co */
+ ikind = isect_line_line_v3(e2->e->v1->co, e2->e->v2->co, bndco, co1, meet1, meet2);
+ if (ikind == 0) {
+ v2set = false;
+ }
+ else {
+ v2set = true;
+ copy_v3_v3(v2co, meet1);
+ }
- /* want on_edge[i] to be min dist to bv->v of v2co and the v1co of next iteration */
- on_edge_cur = centerline + clstride * i;
- on_edge_prev = centerline + clstride * ((i == 0) ? n - 1 : i - 1);
- if (i == 0) {
- copy_v3_v3(on_edge_cur, v2co);
- copy_v3_v3(on_edge_prev, v1co);
- }
- else if (i == n - 1) {
- closer_v3_v3v3v3(on_edge_cur, on_edge_cur, v2co, bv->v->co);
- closer_v3_v3v3v3(on_edge_prev, on_edge_prev, v1co, bv->v->co);
+ /* want on_edge[i] to be min dist to bv->v of v2co and the v1co of next iteration */
+ on_edge_cur = centerline + clstride * i;
+ iprev = (i == 0) ? n - 1 : i - 1;
+ on_edge_prev = centerline + clstride * iprev;
+ if (v2set) {
+ if (cset[i]) {
+ closer_v3_v3v3v3(on_edge_cur, on_edge_cur, v2co, bv->v->co);
+ }
+ else {
+ copy_v3_v3(on_edge_cur, v2co);
+ cset[i] = true;
+ }
+ }
+ if (v1set) {
+ if (cset[iprev]) {
+ closer_v3_v3v3v3(on_edge_prev, on_edge_prev, v1co, bv->v->co);
+ }
+ else {
+ copy_v3_v3(on_edge_prev, v1co);
+ cset[iprev] = true;
+ }
+ }
}
- else {
- copy_v3_v3(on_edge_cur, v2co);
- closer_v3_v3v3v3(on_edge_prev, on_edge_prev, v1co, bv->v->co);
+ bndv = bndv->next;
+ }
+ /* Maybe not everything was set by the previous loop */
+ bndv = vm->boundstart;
+ for (i = 0; i < n; i++) {
+ if (!cset[i]) {
+ on_edge_cur = centerline + clstride * i;
+ e1 = bndv->next->efirst;
+ copy_v3_v3(co1, bndv->nv.co);
+ copy_v3_v3(co2, bndv->next->nv.co);
+ if (e1) {
+ if (bndv->prev->is_arc_start && bndv->next->is_arc_start) {
+ ikind = isect_line_line_v3(e1->e->v1->co, e1->e->v2->co, co1, co2, meet1, meet2);
+ if (ikind != 0) {
+ copy_v3_v3(on_edge_cur, meet1);
+ cset[i] = true;
+ }
+ }
+ else {
+ if (bndv->prev->is_arc_start) {
+ closest_to_line_segment_v3(on_edge_cur, co1, e1->e->v1->co, e1->e->v2->co);
+ }
+ else {
+ closest_to_line_segment_v3(on_edge_cur, co2, e1->e->v1->co, e1->e->v2->co);
+ }
+ cset[i] = true;
+ }
+ }
+ if (!cset[i]) {
+ mid_v3_v3v3(on_edge_cur, co1, co2);
+ cset[i] = true;
+ }
}
bndv = bndv->next;
}
@@ -3764,6 +4156,7 @@ static VMesh *square_out_adj_vmesh(BevelParams *bp, BevVert *bv)
vmesh_copy_equiv_verts(vm);
MEM_freeN(centerline);
+ MEM_freeN(cset);
return vm;
}
@@ -3847,8 +4240,7 @@ static void bevel_build_rings(BevelParams *bp, BMesh *bm, BevVert *bv)
e = v->efirst;
else
e = v->ebev;
- BLI_assert(e != NULL);
- bme = e->e;
+ bme = e ? e->e : NULL;
/* For odd ns, make polys with lower left corner at (i,j,k) for
* j in [0, ns2-1], k in [0, ns2]. And then the center ngon.
* For even ns,
@@ -3888,7 +4280,7 @@ static void bevel_build_rings(BevelParams *bp, BMesh *bm, BevVert *bv)
else { /* edge bevel */
if (odd) {
if (k == ns2) {
- if (e->is_seam) {
+ if (e && e->is_seam) {
r_f = bev_create_quad_ex(bm, bmv1, bmv2, bmv3, bmv4, f, f, f, f,
NULL, bme, bme, NULL, mat_nr);
}
@@ -3902,7 +4294,9 @@ static void bevel_build_rings(BevelParams *bp, BMesh *bm, BevVert *bv)
}
else {
bme1 = k == ns2 - 1 ? bme : NULL;
- bme3 = j == ns2 - 1 ? v->prev->ebev->e : NULL;
+ bme3 = NULL;
+ if (j == ns2 - 1 && v->prev->ebev)
+ bme3 = v->prev->ebev->e;
bme2 = bme1 != NULL ? bme1 : bme3;
r_f = bev_create_quad_ex(bm, bmv1, bmv2, bmv3, bmv4, f, f, f, f,
NULL, bme1, bme2, bme3, mat_nr);
@@ -4585,6 +4979,8 @@ static BevVert *bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
e->seg = 0;
}
e->is_rev = (bme->v2 == v);
+ e->leftv = e->rightv = NULL;
+ e->profile_index = 0;
}
/* now done with tag flag */
@@ -4711,9 +5107,9 @@ static bool bev_rebuild_polygon(BMesh *bm, BevelParams *bp, BMFace *f)
BoundVert *v, *vstart, *vend;
EdgeHalf *e, *eprev;
VMesh *vm;
- int i, k, n;
+ int i, k, n, kstart, kend;
bool do_rebuild = false;
- bool go_ccw, corner3special, keep;
+ bool go_ccw, corner3special, keep, on_profile_start;
BMVert *bmv;
BMEdge *bme, *bme_new, *bme_prev;
BMFace *f_new, *f_other;
@@ -4760,56 +5156,85 @@ static bool bev_rebuild_polygon(BMesh *bm, BevelParams *bp, BMFace *f)
go_ccw = false;
}
}
+ on_profile_start = false;
if (go_ccw) {
vstart = eprev->rightv;
vend = e->leftv;
+ if (e->profile_index > 0) {
+ vstart = vstart->prev;
+ on_profile_start = true;
+ }
}
else {
vstart = eprev->leftv;
vend = e->rightv;
+ if (eprev->profile_index > 0) {
+ vstart = vstart->next;
+ on_profile_start = true;
+ }
}
BLI_assert(vstart != NULL && vend != NULL);
v = vstart;
- BLI_array_append(vv, v->nv.v);
- BLI_array_append(ee, bme);
- /* check for special case: multisegment 3rd face opposite a beveled edge with no vmesh */
- corner3special = (vm->mesh_kind == M_NONE && v->ebev != e && v->ebev != eprev);
+ if (!on_profile_start) {
+ BLI_array_append(vv, v->nv.v);
+ BLI_array_append(ee, bme);
+ }
while (v != vend) {
+ /* check for special case: multisegment 3rd face opposite a beveled edge with no vmesh */
+ corner3special = (vm->mesh_kind == M_NONE && v->ebev != e && v->ebev != eprev);
if (go_ccw) {
- if (vm->seg > 1) {
- if (vm->mesh_kind == M_ADJ || bp->vertex_only || corner3special) {
- i = v->index;
- for (k = 1; k < vm->seg; k++) {
- bmv = mesh_vert(vm, i, 0, k)->v;
- BLI_array_append(vv, bmv);
- BLI_array_append(ee, bme); /* TODO: maybe better edge here */
- if (corner3special && v->ebev && !v->ebev->is_seam)
- BLI_array_append(vv_fix, bmv);
- }
+ i = v->index;
+ if (on_profile_start) {
+ kstart = e->profile_index;
+ on_profile_start = false;
+ }
+ else {
+ kstart = 1;
+ }
+ if (eprev->rightv == v && eprev->profile_index > 0) {
+ kend = eprev->profile_index;
+ }
+ else {
+ kend = vm->seg;
+ }
+ for (k = kstart; k <= kend; k++) {
+ bmv = mesh_vert(vm, i, 0, k)->v;
+ if (bmv) {
+ BLI_array_append(vv, bmv);
+ BLI_array_append(ee, bme); /* TODO: maybe better edge here */
+ if (corner3special && v->ebev && !v->ebev->is_seam && k != vm->seg)
+ BLI_array_append(vv_fix, bmv);
}
}
v = v->next;
}
else {
/* going cw */
- if (vm->seg > 1) {
- if (vm->mesh_kind == M_ADJ || bp->vertex_only ||
- (vm->mesh_kind == M_NONE && v->ebev != e && v->ebev != eprev))
- {
- i = v->prev->index;
- for (k = vm->seg - 1; k > 0; k--) {
- bmv = mesh_vert(vm, i, 0, k)->v;
- BLI_array_append(vv, bmv);
- BLI_array_append(ee, bme);
- if (corner3special && v->ebev && !v->ebev->is_seam)
- BLI_array_append(vv_fix, bmv);
- }
+ i = v->prev->index;
+ if (on_profile_start) {
+ kstart = eprev->profile_index;
+ on_profile_start = false;
+ }
+ else {
+ kstart = vm->seg - 1;
+ }
+ if (e->rightv == v->prev && e->profile_index > 0) {
+ kend = e->profile_index;
+ }
+ else {
+ kend = 0;
+ }
+ for (k = kstart; k >= kend; k--) {
+ bmv = mesh_vert(vm, i, 0, k)->v;
+ if (bmv) {
+ BLI_array_append(vv, bmv);
+ BLI_array_append(ee, bme);
+ if (corner3special && v->ebev && !v->ebev->is_seam && k != 0)
+ BLI_array_append(vv_fix, bmv);
}
}
v = v->prev;
}
- BLI_array_append(vv, v->nv.v);
- BLI_array_append(ee, bme);
}
do_rebuild = true;
}
@@ -5468,7 +5893,7 @@ static void set_profile_spacing(BevelParams *bp)
* Assume we have a situation like:
*
* a d
- * \ /
+ * \ /
* A \ / C
* \ th1 th2/
* b---------c
@@ -5672,12 +6097,14 @@ static void bevel_limit_offset(BevelParams *bp)
* \warning all tagged edges _must_ be manifold.
*/
void BM_mesh_bevel(
- BMesh *bm, const float offset, const int offset_type,
- const float segments, const float profile,
- const bool vertex_only, const bool use_weights, const bool limit_offset,
- const struct MDeformVert *dvert, const int vertex_group, const int mat,
- const bool loop_slide, const bool mark_seam, const bool mark_sharp,
- const bool harden_normals, const int face_strength_mode)
+ BMesh *bm, const float offset, const int offset_type,
+ const float segments, const float profile,
+ const bool vertex_only, const bool use_weights, const bool limit_offset,
+ const struct MDeformVert *dvert, const int vertex_group, const int mat,
+ const bool loop_slide, const bool mark_seam, const bool mark_sharp,
+ const bool harden_normals, const int face_strength_mode,
+ const int miter_outer, const int miter_inner, const float spread,
+ const float smoothresh)
{
BMIter iter, liter;
BMVert *v, *v_next;
@@ -5691,6 +6118,7 @@ void BM_mesh_bevel(
bp.offset = offset;
bp.offset_type = offset_type;
bp.seg = segments;
+ bp.profile = profile;
bp.pro_super_r = -log(2.0) / log(sqrt(profile)); /* convert to superellipse exponent */
bp.vertex_only = vertex_only;
bp.use_weights = use_weights;
@@ -5704,6 +6132,10 @@ void BM_mesh_bevel(
bp.mark_sharp = mark_sharp;
bp.harden_normals = harden_normals;
bp.face_strength_mode = face_strength_mode;
+ bp.miter_outer = miter_outer;
+ bp.miter_inner = miter_inner;
+ bp.spread = spread;
+ bp.smoothresh = smoothresh;
bp.face_hash = NULL;
if (profile >= 0.950f) { /* r ~ 692, so PRO_SQUARE_R is 1e4 */
diff --git a/source/blender/bmesh/tools/bmesh_bevel.h b/source/blender/bmesh/tools/bmesh_bevel.h
index 2bfa2be8f1c..f45a3bec93a 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.h
+++ b/source/blender/bmesh/tools/bmesh_bevel.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_BEVEL_H__
#define __BMESH_BEVEL_H__
-/** \file blender/bmesh/tools/bmesh_bevel.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
struct MDeformVert;
@@ -34,6 +28,7 @@ void BM_mesh_bevel(
const float profile, const bool vertex_only, const bool use_weights,
const bool limit_offset, const struct MDeformVert *dvert, const int vertex_group,
const int mat, const bool loop_slide, const bool mark_seam, const bool mark_sharp,
- const bool harden_normals, const int face_strength_mode);
+ const bool harden_normals, const int face_strength_mode, const int miter_outer,
+ const int miter_inner, const float spread, const float smoothresh);
#endif /* __BMESH_BEVEL_H__ */
diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c
index b78deaa1d5f..83f5edb01ea 100644
--- a/source/blender/bmesh/tools/bmesh_bisect_plane.c
+++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/tools/bmesh_bisect_plane.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Cut the geometry in half using a plane.
*
diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.h b/source/blender/bmesh/tools/bmesh_bisect_plane.h
index fb99a1c8214..e3e4a737776 100644
--- a/source/blender/bmesh/tools/bmesh_bisect_plane.h
+++ b/source/blender/bmesh/tools/bmesh_bisect_plane.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BMESH_BISECT_PLANE_H__
#define __BMESH_BISECT_PLANE_H__
-/** \file blender/bmesh/tools/bmesh_bisect_plane.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
void BM_mesh_bisect_plane(
diff --git a/source/blender/bmesh/tools/bmesh_decimate.h b/source/blender/bmesh/tools/bmesh_decimate.h
index 42d90cb75e5..fa25b35b912 100644
--- a/source/blender/bmesh/tools/bmesh_decimate.h
+++ b/source/blender/bmesh/tools/bmesh_decimate.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BMESH_DECIMATE_H__
#define __BMESH_DECIMATE_H__
-/** \file blender/bmesh/tools/bmesh_decimate.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
void BM_mesh_decimate_collapse(
diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c
index 3c399f8fe7d..7f6bcf12f84 100644
--- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c
+++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/tools/bmesh_decimate_collapse.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh decimator that uses an edge collapse method.
*/
@@ -37,7 +31,6 @@
#include "BLI_linklist.h"
#include "BLI_alloca.h"
#include "BLI_memarena.h"
-#include "BLI_edgehash.h"
#include "BLI_polyfill_2d.h"
#include "BLI_polyfill_2d_beautify.h"
#include "BLI_utildefines_stack.h"
@@ -58,17 +51,18 @@
/* defines for testing */
#define USE_CUSTOMDATA
#define USE_TRIANGULATE
-#define USE_VERT_NORMAL_INTERP /* has the advantage that flipped faces don't mess up vertex normals */
+/** Has the advantage that flipped faces don't mess up vertex normals. */
+#define USE_VERT_NORMAL_INTERP
-/* if the cost from #BLI_quadric_evaluate is 'noise', fallback to topology */
+/** if the cost from #BLI_quadric_evaluate is 'noise', fallback to topology */
#define USE_TOPOLOGY_FALLBACK
#ifdef USE_TOPOLOGY_FALLBACK
-/* cost is calculated with double precision, it's ok to use a very small epsilon, see T48154. */
+/** cost is calculated with double precision, it's ok to use a very small epsilon, see T48154. */
# define TOPOLOGY_FALLBACK_EPS 1e-12f
#endif
#define BOUNDARY_PRESERVE_WEIGHT 100.0f
-/* Uses double precision, impacts behavior on near-flat surfaces,
+/** Uses double precision, impacts behavior on near-flat surfaces,
* cane give issues with very small faces. 1e-2 is too big, see: T48154. */
#define OPTIMIZE_EPS 1e-8
#define COST_INVALID FLT_MAX
@@ -76,7 +70,7 @@
typedef enum CD_UseFlag {
CD_DO_VERT = (1 << 0),
CD_DO_EDGE = (1 << 1),
- CD_DO_LOOP = (1 << 2)
+ CD_DO_LOOP = (1 << 2),
} CD_UseFlag;
@@ -157,7 +151,8 @@ static void bm_decim_calc_target_co_db(
&vquadrics[BM_elem_index_get(e->v2)]);
if (BLI_quadric_optimize(&q, optimize_co, OPTIMIZE_EPS)) {
- return; /* all is good */
+ /* all is good */
+ return;
}
else {
optimize_co[0] = 0.5 * ((double)e->v1->co[0] + (double)e->v2->co[0]);
@@ -194,9 +189,12 @@ static bool bm_edge_collapse_is_degenerate_flip(BMEdge *e, const float optimize_
float cross_optim[3];
#if 1
- float vec_other[3]; /* line between the two outer verts, re-use for both cross products */
- float vec_exist[3]; /* before collapse */
- float vec_optim[3]; /* after collapse */
+ /* line between the two outer verts, re-use for both cross products */
+ float vec_other[3];
+ /* before collapse */
+ float vec_exist[3];
+ /* after collapse */
+ float vec_optim[3];
sub_v3_v3v3(vec_other, co_prev, co_next);
sub_v3_v3v3(vec_exist, co_prev, v->co);
@@ -369,7 +367,8 @@ static void bm_decim_build_edge_cost(
uint i;
BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
- eheap_table[i] = NULL; /* keep sanity check happy */
+ /* keep sanity check happy */
+ eheap_table[i] = NULL;
bm_decim_build_edge_cost_single(e, vquadrics, vweights, vweight_factor, eheap, eheap_table);
}
}
@@ -722,7 +721,8 @@ static void bm_edge_collapse_loop_customdata(
BLI_assert(l_clear->v == v_clear);
BLI_assert(l_other->v == v_other);
- (void)v_other; /* quiet warnings for release */
+ /* quiet warnings for release */
+ (void)v_other;
/* now we have both corners of the face 'l->f' */
for (side = 0; side < 2; side++) {
@@ -1147,7 +1147,8 @@ static bool bm_decim_edge_collapse(
int e_clear_other[2];
BMVert *v_other = e->v1;
const int v_other_index = BM_elem_index_get(e->v1);
- const int v_clear_index = BM_elem_index_get(e->v2); /* the vert is removed so only store the index */
+ /* the vert is removed so only store the index */
+ const int v_clear_index = BM_elem_index_get(e->v2);
float customdata_fac;
#ifdef USE_VERT_NORMAL_INTERP
@@ -1159,7 +1160,8 @@ static bool bm_decim_edge_collapse(
if (optimize_co_calc) {
/* disallow collapsing which results in degenerate cases */
if (UNLIKELY(bm_edge_collapse_is_degenerate_topology(e))) {
- bm_decim_invalid_edge_cost_single(e, eheap, eheap_table); /* add back with a high cost */
+ /* add back with a high cost */
+ bm_decim_invalid_edge_cost_single(e, eheap, eheap_table);
return false;
}
@@ -1167,7 +1169,8 @@ static bool bm_decim_edge_collapse(
/* check if this would result in an overlapping face */
if (UNLIKELY(bm_edge_collapse_is_degenerate_flip(e, optimize_co))) {
- bm_decim_invalid_edge_cost_single(e, eheap, eheap_table); /* add back with a high cost */
+ /* add back with a high cost */
+ bm_decim_invalid_edge_cost_single(e, eheap, eheap_table);
return false;
}
}
@@ -1203,7 +1206,8 @@ static bool bm_decim_edge_collapse(
vweights[v_other_index] = v_other_weight;
}
- e = NULL; /* paranoid safety check */
+ /* paranoid safety check */
+ e = NULL;
copy_v3_v3(v_other->co, optimize_co);
@@ -1295,9 +1299,12 @@ void BM_mesh_decimate_collapse(
const bool do_triangulate,
const int symmetry_axis, const float symmetry_eps)
{
- Heap *eheap; /* edge heap */
- HeapNode **eheap_table; /* edge index aligned table pointing to the eheap */
- Quadric *vquadrics; /* vert index aligned quadrics */
+ /* edge heap */
+ Heap *eheap;
+ /* edge index aligned table pointing to the eheap */
+ HeapNode **eheap_table;
+ /* vert index aligned quadrics */
+ Quadric *vquadrics;
int tot_edge_orig;
int face_tot_target;
@@ -1359,7 +1366,8 @@ void BM_mesh_decimate_collapse(
// const float value = BLI_heap_node_value(BLI_heap_top(eheap));
BMEdge *e = BLI_heap_pop_min(eheap);
float optimize_co[3];
- BLI_assert(BM_elem_index_get(e) < tot_edge_orig); /* handy to detect corruptions elsewhere */
+ /* handy to detect corruptions elsewhere */
+ BLI_assert(BM_elem_index_get(e) < tot_edge_orig);
/* under normal conditions wont be accessed again,
* but NULL just incase so we don't use freed node */
@@ -1511,5 +1519,6 @@ invalidate:
/* testing only */
// BM_mesh_validate(bm);
- (void)tot_edge_orig; /* quiet release build warning */
+ /* quiet release build warning */
+ (void)tot_edge_orig;
}
diff --git a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
index 72722eab4e6..b61a499cffc 100644
--- a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
+++ b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/tools/bmesh_decimate_dissolve.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh decimator that dissolves flat areas into polygons (ngons).
*/
diff --git a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
index 63000b1b4db..90fca4fe184 100644
--- a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
+++ b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/tools/bmesh_decimate_unsubdivide.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh decimator that uses a grid un-subdivide method.
*/
@@ -168,7 +162,7 @@ static bool bm_vert_dissolve_fan(BMesh *bm, BMVert *v)
enum {
VERT_INDEX_DO_COLLAPSE = -1,
VERT_INDEX_INIT = 0,
- VERT_INDEX_IGNORE = 1
+ VERT_INDEX_IGNORE = 1,
};
// #define USE_WALKER /* gives uneven results, disable for now */
diff --git a/source/blender/bmesh/tools/bmesh_edgenet.c b/source/blender/bmesh/tools/bmesh_edgenet.c
index acc9225424b..528a89a06ab 100644
--- a/source/blender/bmesh/tools/bmesh_edgenet.c
+++ b/source/blender/bmesh/tools/bmesh_edgenet.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,12 @@
* 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 *****
*/
-/** \file blender/bmesh/tools/bmesh_edgenet.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Edgenet Fill.
- *
*/
#include <limits.h>
diff --git a/source/blender/bmesh/tools/bmesh_edgenet.h b/source/blender/bmesh/tools/bmesh_edgenet.h
index 1ad5cadae7c..0a72ded8949 100644
--- a/source/blender/bmesh/tools/bmesh_edgenet.h
+++ b/source/blender/bmesh/tools/bmesh_edgenet.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BMESH_EDGENET_H__
#define __BMESH_EDGENET_H__
-/** \file blender/bmesh/tools/bmesh_edgenet.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
void BM_mesh_edgenet(
diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.c b/source/blender/bmesh/tools/bmesh_edgesplit.c
index b7494fd87bc..198b3efa8cc 100644
--- a/source/blender/bmesh/tools/bmesh_edgesplit.c
+++ b/source/blender/bmesh/tools/bmesh_edgesplit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,12 @@
* 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 *****
*/
-/** \file blender/bmesh/tools/bmesh_edgesplit.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Edge-Split.
- *
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.h b/source/blender/bmesh/tools/bmesh_edgesplit.h
index 26040077f43..f7faeb1fa19 100644
--- a/source/blender/bmesh/tools/bmesh_edgesplit.h
+++ b/source/blender/bmesh/tools/bmesh_edgesplit.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_EDGESPLIT_H__
#define __BMESH_EDGESPLIT_H__
-/** \file blender/bmesh/tools/bmesh_edgesplit.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
void BM_mesh_edgesplit(
diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c
index a90422e9911..4068562d077 100644
--- a/source/blender/bmesh/tools/bmesh_intersect.c
+++ b/source/blender/bmesh/tools/bmesh_intersect.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/tools/bmesh_intersect.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Cut meshes along intersections.
*
@@ -46,7 +42,6 @@
#include "BLI_linklist_stack.h"
#include "BLI_utildefines_stack.h"
#ifndef NDEBUG
-# include "BLI_array_utils.h"
#endif
#include "BLI_kdopbvh.h"
@@ -972,7 +967,7 @@ static int isect_bvhtree_point_v3(
* leaving the resulting edges tagged.
*
* \param test_fn: Return value: -1: skip, 0: tree_a, 1: tree_b (use_self == false)
- * \param boolean_mode -1: no-boolean, 0: intersection... see #BMESH_ISECT_BOOLEAN_ISECT.
+ * \param boolean_mode: -1: no-boolean, 0: intersection... see #BMESH_ISECT_BOOLEAN_ISECT.
* \return true if the mesh is changed (intersections cut or faces removed from boolean).
*/
bool BM_mesh_intersect(
diff --git a/source/blender/bmesh/tools/bmesh_intersect.h b/source/blender/bmesh/tools/bmesh_intersect.h
index 82910a5df80..6e8e1d42161 100644
--- a/source/blender/bmesh/tools/bmesh_intersect.h
+++ b/source/blender/bmesh/tools/bmesh_intersect.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_INTERSECT_H__
#define __BMESH_INTERSECT_H__
-/** \file blender/bmesh/tools/bmesh_intersect.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
bool BM_mesh_intersect(
diff --git a/source/blender/bmesh/tools/bmesh_path.c b/source/blender/bmesh/tools/bmesh_path.c
index e4228eced5f..0ae1f4a57f1 100644
--- a/source/blender/bmesh/tools/bmesh_path.c
+++ b/source/blender/bmesh/tools/bmesh_path.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/tools/bmesh_path.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Find a path between 2 elements.
- *
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/bmesh/tools/bmesh_path.h b/source/blender/bmesh/tools/bmesh_path.h
index fbdd2296121..792ba6c7dce 100644
--- a/source/blender/bmesh/tools/bmesh_path.h
+++ b/source/blender/bmesh/tools/bmesh_path.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_PATH_H__
#define __BMESH_PATH_H__
-/** \file blender/bmesh/tools/bmesh_path.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
struct BMCalcPathParams {
diff --git a/source/blender/bmesh/tools/bmesh_path_region.c b/source/blender/bmesh/tools/bmesh_path_region.c
index d23ea537d82..8eb5b50b2a2 100644
--- a/source/blender/bmesh/tools/bmesh_path_region.c
+++ b/source/blender/bmesh/tools/bmesh_path_region.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/tools/bmesh_path_region.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Find the region defined by the path(s) between 2 elements.
* (path isn't ordered).
diff --git a/source/blender/bmesh/tools/bmesh_path_region.h b/source/blender/bmesh/tools/bmesh_path_region.h
index 06e56a59fb2..f3ed50f91fd 100644
--- a/source/blender/bmesh/tools/bmesh_path_region.h
+++ b/source/blender/bmesh/tools/bmesh_path_region.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_PATH_REGION_H__
#define __BMESH_PATH_REGION_H__
-/** \file blender/bmesh/tools/bmesh_path_region.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
struct LinkNode *BM_mesh_calc_path_region_vert(
diff --git a/source/blender/bmesh/tools/bmesh_region_match.c b/source/blender/bmesh/tools/bmesh_region_match.c
index f75999386e1..8a69dd05a06 100644
--- a/source/blender/bmesh/tools/bmesh_region_match.c
+++ b/source/blender/bmesh/tools/bmesh_region_match.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/tools/bmesh_region_match.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Given a contiguous region of faces,
* find multiple matching regions (based on topology) and return them.
diff --git a/source/blender/bmesh/tools/bmesh_region_match.h b/source/blender/bmesh/tools/bmesh_region_match.h
index 8ef138629b8..1c460bb7ede 100644
--- a/source/blender/bmesh/tools/bmesh_region_match.h
+++ b/source/blender/bmesh/tools/bmesh_region_match.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_REGION_MATCH_H__
#define __BMESH_REGION_MATCH_H__
-/** \file blender/bmesh/tools/bmesh_region_match.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
int BM_mesh_region_match(
diff --git a/source/blender/bmesh/tools/bmesh_separate.c b/source/blender/bmesh/tools/bmesh_separate.c
index b3d0c339885..9e8163c167b 100644
--- a/source/blender/bmesh/tools/bmesh_separate.c
+++ b/source/blender/bmesh/tools/bmesh_separate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/tools/bmesh_separate.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* BMesh separate, disconnects a set of faces from all others,
* so they don't share any vertices/edges with other faces.
diff --git a/source/blender/bmesh/tools/bmesh_separate.h b/source/blender/bmesh/tools/bmesh_separate.h
index 91b2b71c872..711a94c9242 100644
--- a/source/blender/bmesh/tools/bmesh_separate.h
+++ b/source/blender/bmesh/tools/bmesh_separate.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BMESH_SEPARATE_H__
#define __BMESH_SEPARATE_H__
-/** \file blender/bmesh/tools/bmesh_separate.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*/
void BM_mesh_separate_faces(
diff --git a/source/blender/bmesh/tools/bmesh_triangulate.c b/source/blender/bmesh/tools/bmesh_triangulate.c
index a3a3355d20f..034151fa584 100644
--- a/source/blender/bmesh/tools/bmesh_triangulate.c
+++ b/source/blender/bmesh/tools/bmesh_triangulate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,12 @@
* 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
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/tools/bmesh_triangulate.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Triangulate.
- *
*/
#include "DNA_modifier_types.h" /* for MOD_TRIANGULATE_NGON_BEAUTY only */
diff --git a/source/blender/bmesh/tools/bmesh_triangulate.h b/source/blender/bmesh/tools/bmesh_triangulate.h
index 644d7884202..1b312ebadbf 100644
--- a/source/blender/bmesh/tools/bmesh_triangulate.h
+++ b/source/blender/bmesh/tools/bmesh_triangulate.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,12 @@
* 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
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/tools/bmesh_triangulate.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Triangulate.
- *
*/
#ifndef __BMESH_TRIANGULATE_H__
diff --git a/source/blender/bmesh/tools/bmesh_wireframe.c b/source/blender/bmesh/tools/bmesh_wireframe.c
index 22ba5a742cb..e7fbed76e4c 100644
--- a/source/blender/bmesh/tools/bmesh_wireframe.c
+++ b/source/blender/bmesh/tools/bmesh_wireframe.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/bmesh/tools/bmesh_wireframe.c
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Creates a solid wireframe from connected faces.
*/
diff --git a/source/blender/bmesh/tools/bmesh_wireframe.h b/source/blender/bmesh/tools/bmesh_wireframe.h
index 9f40c2320e1..7c71e15beb9 100644
--- a/source/blender/bmesh/tools/bmesh_wireframe.h
+++ b/source/blender/bmesh/tools/bmesh_wireframe.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,12 @@
* 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 *****
*/
-/** \file blender/bmesh/tools/bmesh_wireframe.h
- * \ingroup bmesh
+/** \file
+ * \ingroup bmesh
*
* Wire Frame.
- *
*/
#ifndef __BMESH_WIREFRAME_H__
diff --git a/source/blender/collada/AnimationClipExporter.cpp b/source/blender/collada/AnimationClipExporter.cpp
index a2c4b388b7e..4a4ad6f7fab 100644
--- a/source/blender/collada/AnimationClipExporter.cpp
+++ b/source/blender/collada/AnimationClipExporter.cpp
@@ -1,24 +1,18 @@
/*
-* ***** 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
-*
-* ***** END 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.
+ */
#include "GeometryExporter.h"
#include "AnimationClipExporter.h"
diff --git a/source/blender/collada/AnimationClipExporter.h b/source/blender/collada/AnimationClipExporter.h
index 8a9394ce88a..fd19e8eda5a 100644
--- a/source/blender/collada/AnimationClipExporter.h
+++ b/source/blender/collada/AnimationClipExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,6 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include <stdlib.h>
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 69a25ac7a82..ebb2a9da10c 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file AnimationExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include "GeometryExporter.h"
@@ -148,6 +142,7 @@ void AnimationExporter::exportAnimation(Object *ob, BCAnimationSampler &sampler)
* However Armatures also can have Object animation.
*/
bool export_as_matrix = this->export_settings->export_transformation_type == BC_TRANSFORMATION_TYPE_MATRIX;
+
if (export_as_matrix) {
export_matrix_animation(ob, sampler); // export all transform_curves as one single matrix animation
}
@@ -179,11 +174,11 @@ void AnimationExporter::exportAnimation(Object *ob, BCAnimationSampler &sampler)
* especially when negative scales are involved in the animation.
* And when parent inverse matrices are involved (when exporting
* object hierarchies)
- *
*/
void AnimationExporter::export_curve_animation_set(Object *ob, BCAnimationSampler &sampler, bool export_as_matrix)
{
BCAnimationCurveMap *curves = sampler.get_curves(ob);
+ bool keep_flat_curves = this->export_settings->keep_flat_curves;
BCAnimationCurveMap::iterator it;
for (it = curves->begin(); it != curves->end(); ++it) {
@@ -205,7 +200,7 @@ void AnimationExporter::export_curve_animation_set(Object *ob, BCAnimationSample
continue;
}
- if (!curve.is_animated()) {
+ if (!keep_flat_curves && !curve.is_animated()) {
continue;
}
@@ -222,12 +217,14 @@ void AnimationExporter::export_curve_animation_set(Object *ob, BCAnimationSample
void AnimationExporter::export_matrix_animation(Object *ob, BCAnimationSampler &sampler)
{
+ bool keep_flat_curves = this->export_settings->keep_flat_curves;
+
std::vector<float> frames;
sampler.get_object_frames(frames, ob);
if (frames.size() > 0) {
BCMatrixSampleMap samples;
bool is_animated = sampler.get_object_samples(samples, ob);
- if (is_animated) {
+ if (keep_flat_curves || is_animated) {
bAction *action = bc_getSceneObjectAction(ob);
std::string name = encode_xml(id_name(ob));
std::string action_name = (action == NULL) ? name + "-action" : id_name(action);
@@ -245,13 +242,15 @@ void AnimationExporter::export_matrix_animation(Object *ob, BCAnimationSampler &
//write bone animations in transform matrix sources
void AnimationExporter::export_bone_animations_recursive(Object *ob, Bone *bone, BCAnimationSampler &sampler)
{
+ bool keep_flat_curves = this->export_settings->keep_flat_curves;
+
std::vector<float> frames;
sampler.get_bone_frames(frames, ob, bone);
if (frames.size()) {
BCMatrixSampleMap samples;
bool is_animated = sampler.get_bone_samples(samples, ob, bone);
- if (is_animated) {
+ if (keep_flat_curves || is_animated) {
export_bone_animation(ob, bone, frames, samples);
}
}
@@ -260,14 +259,14 @@ void AnimationExporter::export_bone_animations_recursive(Object *ob, Bone *bone,
export_bone_animations_recursive(ob, child, sampler);
}
-/*
-* In some special cases the exported Curve needs to be replaced
-* by a modified curve (for collada purposes)
-* This method checks if a conversion is necessary and if applicable
-* returns a pointer to the modified BCAnimationCurve.
-* IMPORTANT: the modified curve must be deleted by the caller when no longer needed
-* if no conversion is needed this method returns a NULL;
-*/
+/**
+ * In some special cases the exported Curve needs to be replaced
+ * by a modified curve (for collada purposes)
+ * This method checks if a conversion is necessary and if applicable
+ * returns a pointer to the modified BCAnimationCurve.
+ * IMPORTANT: the modified curve must be deleted by the caller when no longer needed
+ * if no conversion is needed this method returns a NULL;
+ */
BCAnimationCurve *AnimationExporter::get_modified_export_curve(Object *ob, BCAnimationCurve &curve, BCAnimationCurveMap &curves)
{
std::string channel_target = curve.get_channel_target();
@@ -722,7 +721,7 @@ const std::string AnimationExporter::get_collada_name(std::string channel_target
{ "specular_hardness", "specular_hardness" },
{ "alpha", "alpha" },
- /* Lamps */
+ /* Lights */
{ "color", "color" },
{ "fall_off_angle", "falloff_angle" },
{ "spot_size", "falloff_angle" },
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index 969669ef11d..295ec66a4e8 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,6 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BC_ANIMATION_EXPORTER_H__
@@ -36,7 +30,7 @@ extern "C"
#include "DNA_anim_types.h"
#include "DNA_action_types.h"
#include "DNA_curve_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_camera_types.h"
#include "DNA_armature_types.h"
#include "DNA_material_types.h"
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index a4b14d9d175..822e02ad9a3 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory, Sukhitha Jayathilake.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/AnimationImporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include <stddef.h>
@@ -1000,7 +994,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
}
if ((animType->light) != 0) {
- Lamp *lamp = (Lamp *) ob->data;
+ Light *lamp = (Light *) ob->data;
if (!lamp->adt || !lamp->adt->action)
act = verify_adt_action(bmain, (ID *)&lamp->id, 1);
else
@@ -1944,7 +1938,7 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No
job->lay = BKE_scene_base_find(scene, job)->lay = 2;
- mul_v3_fl(job->size, 0.5f);
+ mul_v3_fl(job->scale, 0.5f);
DEG_id_tag_update(&job->id, ID_RECALC_TRANSFORM);
verify_adt_action((ID *)&job->id, 1);
@@ -1961,7 +1955,7 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No
mul_m4_m4m4(mat, ipar, temp);
}
- bc_decompose(mat, job->loc, NULL, job->quat, job->size);
+ bc_decompose(mat, job->loc, NULL, job->quat, job->scale);
if (par_job) {
job->parent = par_job;
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index d6d5ad03a88..e5d431a05c0 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory, Sukhitha Jayathilake.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file AnimationImporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __ANIMATIONIMPORTER_H__
@@ -46,7 +40,7 @@ extern "C" {
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_camera_types.h"
}
@@ -100,7 +94,7 @@ private:
// INANIMATE = 0,
LIGHT_COLOR = 2,
LIGHT_FOA = 4,
- LIGHT_FOE = 8
+ LIGHT_FOE = 8,
};
enum cameraAnim
@@ -111,7 +105,7 @@ private:
CAMERA_YFOV = 8,
CAMERA_YMAG = 16,
CAMERA_ZFAR = 32,
- CAMERA_ZNEAR = 64
+ CAMERA_ZNEAR = 64,
};
enum matAnim
@@ -120,13 +114,13 @@ private:
MATERIAL_SPEC_COLOR = 4,
MATERIAL_DIFF_COLOR = 1 << 3,
MATERIAL_TRANSPARENCY = 1 << 4,
- MATERIAL_IOR = 1 << 5
+ MATERIAL_IOR = 1 << 5,
};
enum AnimationType
{
BC_INANIMATE = 0,
- BC_NODE_TRANSFORM = 1
+ BC_NODE_TRANSFORM = 1,
};
struct AnimMix
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 055ffc39e9a..de4c4794547 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ArmatureExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
@@ -233,7 +226,7 @@ void ArmatureExporter::add_bone_node(
se->writeNodes(*i);
copy_m4_m4((*i)->parentinv, backup_parinv);
- child_objects.erase(i++);
+ i = child_objects.erase(i);
}
else i++;
}
diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h
index 1a8080ad613..d5f808155f4 100644
--- a/source/blender/collada/ArmatureExporter.h
+++ b/source/blender/collada/ArmatureExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ArmatureExporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __ARMATUREEXPORTER_H__
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index cfafa5016ec..018367c81ff 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory, Sukhitha jayathilake.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ArmatureImporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h
index 419861554f4..4715b31fe62 100644
--- a/source/blender/collada/ArmatureImporter.h
+++ b/source/blender/collada/ArmatureImporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ArmatureImporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __ARMATUREIMPORTER_H__
diff --git a/source/blender/collada/BCAnimationCurve.cpp b/source/blender/collada/BCAnimationCurve.cpp
index 97a9c8b75ef..064f3254b11 100644
--- a/source/blender/collada/BCAnimationCurve.cpp
+++ b/source/blender/collada/BCAnimationCurve.cpp
@@ -1,27 +1,21 @@
/*
-* ***** 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) 2008 Blender Foundation.
-* All rights reserved.
-*
-* Contributor(s): Blender Foundation
-*
-* ***** END 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) 2008 Blender Foundation.
+ * All rights reserved.
+ */
#include "BCAnimationCurve.h"
@@ -92,7 +86,7 @@ void BCAnimationCurve::init_pointer_rna(Object *ob)
break;
case BC_ANIMATION_TYPE_LIGHT:
{
- Lamp *lamp = (Lamp *)ob->data;
+ Light *lamp = (Light *)ob->data;
RNA_id_pointer_create(&lamp->id, &id_ptr);
}
break;
@@ -181,7 +175,7 @@ const std::string BCAnimationCurve::get_animation_name(Object *ob) const
case BC_ANIMATION_TYPE_LIGHT:
{
- Lamp *lamp = (Lamp *)ob->data;
+ Light *lamp = (Light *)ob->data;
name = id_name(ob) + "-" + id_name(lamp) + "-light";
}
break;
@@ -404,9 +398,9 @@ bool BCAnimationCurve::add_value_from_matrix(const BCSample &sample, const int f
int array_index = curve_key.get_array_index();
/* transformation curves are feeded directly from the transformation matrix
- * to resolve parent inverse matrix issues with object hierarchies.
- * Maybe this can be unified with the
- */
+ * to resolve parent inverse matrix issues with object hierarchies.
+ * Maybe this can be unified with the
+ */
const std::string channel_target = get_channel_target();
float val = 0;
/* Pick the value from the sample according to the definition of the FCurve */
diff --git a/source/blender/collada/BCAnimationCurve.h b/source/blender/collada/BCAnimationCurve.h
index c575c969e0f..234fecd6833 100644
--- a/source/blender/collada/BCAnimationCurve.h
+++ b/source/blender/collada/BCAnimationCurve.h
@@ -1,27 +1,21 @@
/*
-* ***** 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) 2008 Blender Foundation.
-* All rights reserved.
-*
-* Contributor(s): Blender Foundation
-*
-* ***** END 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) 2008 Blender Foundation.
+ * All rights reserved.
+ */
#ifndef __BC_ANIMATION_CURVE_H__
#define __BC_ANIMATION_CURVE_H__
diff --git a/source/blender/collada/BCAnimationSampler.cpp b/source/blender/collada/BCAnimationSampler.cpp
index 5c0c1b4316d..afc37191e2e 100644
--- a/source/blender/collada/BCAnimationSampler.cpp
+++ b/source/blender/collada/BCAnimationSampler.cpp
@@ -1,27 +1,21 @@
/*
-* ***** 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) 2008 Blender Foundation.
-* All rights reserved.
-*
-* Contributor(s): Blender Foundation
-*
-* ***** END 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) 2008 Blender Foundation.
+ * All rights reserved.
+ */
#include <vector>
#include <map>
@@ -400,17 +394,17 @@ void BCAnimationSampler::generate_transforms(Object *ob, Bone *bone, BCAnimation
generate_transforms(ob, child, curves);
}
-/*
-* Collect all keyframes from all animation curves related to the object
-* The bc_get... functions check for NULL and correct object type
-* The add_keyframes_from() function checks for NULL
-*/
+/**
+ * Collect all keyframes from all animation curves related to the object
+ * The bc_get... functions check for NULL and correct object type
+ * The add_keyframes_from() function checks for NULL
+ */
void BCAnimationSampler::initialize_keyframes(BCFrameSet &frameset, Object *ob)
{
frameset.clear();
add_keyframes_from(bc_getSceneObjectAction(ob), frameset);
add_keyframes_from(bc_getSceneCameraAction(ob), frameset);
- add_keyframes_from(bc_getSceneLampAction(ob), frameset);
+ add_keyframes_from(bc_getSceneLightAction(ob), frameset);
for (int a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a + 1);
@@ -457,12 +451,12 @@ void BCAnimationSampler::initialize_curves(BCAnimationCurveMap &curves, Object *
object_type = BC_ANIMATION_TYPE_CAMERA;
}
else if (ob->type == OB_LAMP) {
- action = bc_getSceneLampAction(ob);
+ action = bc_getSceneLightAction(ob);
object_type = BC_ANIMATION_TYPE_LIGHT;
}
if (action) {
- /* Add lamp action or Camera action */
+ /* Add light action or Camera action */
FCurve *fcu = (FCurve *)action->curves.first;
for (; fcu; fcu = fcu->next) {
BCCurveKey key(object_type, fcu->rna_path, fcu->array_index);
diff --git a/source/blender/collada/BCAnimationSampler.h b/source/blender/collada/BCAnimationSampler.h
index ae0a04a706c..19ccb88fa9e 100644
--- a/source/blender/collada/BCAnimationSampler.h
+++ b/source/blender/collada/BCAnimationSampler.h
@@ -1,27 +1,18 @@
/*
-* ***** 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) 2008 Blender Foundation.
-* All rights reserved.
-*
-* Contributor(s): Blender Foundation
-*
-* ***** END 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.
+ */
#ifndef __BC_ANIMATION_CURVE_CONTAINER_H__
#define __BC_ANIMATION_CURVE_CONTAINER_H__
@@ -65,7 +56,7 @@ public:
if (reference && reference->id.us == 0)
{
Main *bmain = CTX_data_main(mContext);
- BKE_libblock_delete(bmain, &reference->id);
+ BKE_id_delete(bmain, &reference->id);
}
curve_map.clear();
}
@@ -117,28 +108,28 @@ typedef std::map<int, BCSampleFrame> BCSampleFrameMap;
class BCSampleFrameContainer {
/*
- * The BCSampleFrameContainer stores a map of BCSampleFrame objects
- * with the timeline frame as key.
- *
- * Some details on the purpose:
- * An Animation is made of multiple FCurves where each FCurve can
- * have multiple keyframes. When we want to export the animation we
- * also can decide whether we want to export the keyframes or a set
- * of sample frames at equidistant locations (sample period).
- * In any case we must resample first need to resample it fully
- * to resolve things like:
- *
- * - animations by constraints
- * - animations by drivers
- *
- * For this purpose we need to step through the entire animation and
- * then sample each frame that contains at least one keyFrame or
- * sampleFrame. Then for each frame we have to store the transform
- * information for all exported objects in a BCSampleframe
- *
- * The entire set of BCSampleframes is finally collected into
- * a BCSampleframneContainer
- */
+ * The BCSampleFrameContainer stores a map of BCSampleFrame objects
+ * with the timeline frame as key.
+ *
+ * Some details on the purpose:
+ * An Animation is made of multiple FCurves where each FCurve can
+ * have multiple keyframes. When we want to export the animation we
+ * also can decide whether we want to export the keyframes or a set
+ * of sample frames at equidistant locations (sample period).
+ * In any case we must resample first need to resample it fully
+ * to resolve things like:
+ *
+ * - animations by constraints
+ * - animations by drivers
+ *
+ * For this purpose we need to step through the entire animation and
+ * then sample each frame that contains at least one keyFrame or
+ * sampleFrame. Then for each frame we have to store the transform
+ * information for all exported objects in a BCSampleframe
+ *
+ * The entire set of BCSampleframes is finally collected into
+ * a BCSampleframneContainer
+ */
private:
BCSampleFrameMap sample_frames;
diff --git a/source/blender/collada/BCSampleData.cpp b/source/blender/collada/BCSampleData.cpp
index 95898bb5429..936d48ccaca 100644
--- a/source/blender/collada/BCSampleData.cpp
+++ b/source/blender/collada/BCSampleData.cpp
@@ -1,27 +1,21 @@
/*
-* ***** 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) 2008 Blender Foundation.
-* All rights reserved.
-*
-* Contributor(s): Blender Foundation
-*
-* ***** END 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) 2008 Blender Foundation.
+ * All rights reserved.
+ */
#include "BCSampleData.h"
#include "collada_utils.h"
diff --git a/source/blender/collada/BCSampleData.h b/source/blender/collada/BCSampleData.h
index a685cb30fa6..ec7f14f8c3a 100644
--- a/source/blender/collada/BCSampleData.h
+++ b/source/blender/collada/BCSampleData.h
@@ -1,27 +1,21 @@
/*
-* ***** 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) 2008 Blender Foundation.
-* All rights reserved.
-*
-* Contributor(s): Blender Foundation
-*
-* ***** END 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) 2008 Blender Foundation.
+ * All rights reserved.
+ */
#ifndef __BC_SAMPLE_H__
#define __BC_SAMPLE_H__
@@ -37,7 +31,7 @@ extern "C"
#include "DNA_object_types.h"
#include "DNA_armature_types.h"
#include "DNA_material_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_camera_types.h"
}
diff --git a/source/blender/collada/BlenderContext.cpp b/source/blender/collada/BlenderContext.cpp
index 2281b3dd529..8713a8b6a19 100644
--- a/source/blender/collada/BlenderContext.cpp
+++ b/source/blender/collada/BlenderContext.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* 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): Gaia Clary,
- *
- * ***** END GPL LICENSE BLOCK *****
*/
- /** \file CameraExporter.h
- * \ingroup collada
- */
+/** \file
+ * \ingroup collada
+ */
#include "BlenderContext.h"
#include "BKE_scene.h"
diff --git a/source/blender/collada/BlenderContext.h b/source/blender/collada/BlenderContext.h
index e6157a5a7f2..c6c9063e253 100644
--- a/source/blender/collada/BlenderContext.h
+++ b/source/blender/collada/BlenderContext.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* 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): Gaia Clary,
- *
- * ***** END GPL LICENSE BLOCK *****
*/
- /** \file CameraExporter.h
- * \ingroup collada
- */
+/** \file
+ * \ingroup collada
+ */
#ifndef __BLENDERCONTEXT_H__
#define __BLENDERCONTEXT_H__
diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt
index 8c2339497bf..41178b542eb 100644
--- a/source/blender/collada/CMakeLists.txt
+++ b/source/blender/collada/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
remove_strict_flags()
@@ -61,15 +56,15 @@ set(INC_SYS
)
set(SRC
- AnimationImporter.cpp
- AnimationExporter.cpp
AnimationClipExporter.cpp
+ AnimationExporter.cpp
+ AnimationImporter.cpp
ArmatureExporter.cpp
ArmatureImporter.cpp
- BlenderContext.cpp
BCAnimationCurve.cpp
BCAnimationSampler.cpp
BCSampleData.cpp
+ BlenderContext.cpp
CameraExporter.cpp
ControllerExporter.cpp
DocumentExporter.cpp
@@ -77,33 +72,33 @@ set(SRC
EffectExporter.cpp
ErrorHandler.cpp
ExportSettings.cpp
- ImportSettings.cpp
ExtraHandler.cpp
ExtraTags.cpp
GeometryExporter.cpp
ImageExporter.cpp
+ ImportSettings.cpp
InstanceWriter.cpp
LightExporter.cpp
MaterialExporter.cpp
- MeshImporter.cpp
- SkinInfo.cpp
Materials.cpp
+ MeshImporter.cpp
SceneExporter.cpp
+ SkinInfo.cpp
TransformReader.cpp
TransformWriter.cpp
collada.cpp
collada_internal.cpp
collada_utils.cpp
- AnimationImporter.h
- AnimationExporter.h
AnimationClipExporter.h
+ AnimationExporter.h
+ AnimationImporter.h
ArmatureExporter.h
ArmatureImporter.h
- BlenderContext.h
BCAnimationCurve.h
BCAnimationSampler.h
BCSampleData.h
+ BlenderContext.h
CameraExporter.h
ControllerExporter.h
DocumentExporter.h
@@ -111,18 +106,18 @@ set(SRC
EffectExporter.h
ErrorHandler.h
ExportSettings.h
- ImportSettings.h
ExtraHandler.h
ExtraTags.h
GeometryExporter.h
ImageExporter.h
+ ImportSettings.h
InstanceWriter.h
LightExporter.h
MaterialExporter.h
- MeshImporter.h
Materials.h
- SkinInfo.h
+ MeshImporter.h
SceneExporter.h
+ SkinInfo.h
TransformReader.h
TransformWriter.h
collada.h
diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp
index 32bd24f1e0b..618754e1dab 100644
--- a/source/blender/collada/CameraExporter.cpp
+++ b/source/blender/collada/CameraExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/CameraExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
@@ -74,8 +67,8 @@ void CamerasExporter::operator()(Object *ob, Scene *sce)
COLLADASW::PerspectiveOptic persp(mSW);
persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov");
persp.setAspectRatio((float)(sce->r.xsch) / (float)(sce->r.ysch), false, "aspect_ratio");
- persp.setZFar(cam->clipend, false, "zfar");
- persp.setZNear(cam->clipsta, false, "znear");
+ persp.setZFar(cam->clip_end, false, "zfar");
+ persp.setZNear(cam->clip_start, false, "znear");
COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name);
exportBlenderProfile(ccam, cam);
addCamera(ccam);
@@ -88,8 +81,8 @@ void CamerasExporter::operator()(Object *ob, Scene *sce)
COLLADASW::OrthographicOptic ortho(mSW);
ortho.setXMag(cam->ortho_scale / 2, "xmag");
ortho.setAspectRatio((float)(sce->r.xsch) / (float)(sce->r.ysch), false, "aspect_ratio");
- ortho.setZFar(cam->clipend, false, "zfar");
- ortho.setZNear(cam->clipsta, false, "znear");
+ ortho.setZFar(cam->clip_end, false, "zfar");
+ ortho.setZNear(cam->clip_start, false, "znear");
COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
exportBlenderProfile(ccam, cam);
addCamera(ccam);
@@ -101,7 +94,7 @@ bool CamerasExporter::exportBlenderProfile(COLLADASW::Camera &cm,Camera *cam)
{
cm.addExtraTechniqueParameter("blender","shiftx",cam->shiftx);
cm.addExtraTechniqueParameter("blender","shifty",cam->shifty);
- cm.addExtraTechniqueParameter("blender","YF_dofdist",cam->YF_dofdist);
+ cm.addExtraTechniqueParameter("blender","dof_distance",cam->dof_distance);
return true;
}
diff --git a/source/blender/collada/CameraExporter.h b/source/blender/collada/CameraExporter.h
index a0c2d5790c8..b421c8e7bf4 100644
--- a/source/blender/collada/CameraExporter.h
+++ b/source/blender/collada/CameraExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file CameraExporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __CAMERAEXPORTER_H__
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index 61718e405c1..643280cb0cd 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory, Sukhitha Jayathilake
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ControllerExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include "COLLADASWBaseInputElement.h"
diff --git a/source/blender/collada/ControllerExporter.h b/source/blender/collada/ControllerExporter.h
index 309bdbd37f0..31bb60bc3e6 100644
--- a/source/blender/collada/ControllerExporter.h
+++ b/source/blender/collada/ControllerExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory, Sukhitha Jayathilake
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ControllerExporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __CONTROLLEREXPORTER_H__
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 4d0dd7605f9..42056a7d984 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/DocumentExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include <stdlib.h>
@@ -243,12 +237,7 @@ int DocumentExporter::exportCurrentScene()
asset.setUnit(unitname, linearmeasure);
asset.setUpAxisType(COLLADASW::Asset::Z_UP);
- if (U.author[0] != '\0') {
- asset.getContributor().mAuthor = U.author;
- }
- else {
- asset.getContributor().mAuthor = "Blender User";
- }
+ asset.getContributor().mAuthor = "Blender User";
char version_buf[128];
#ifdef WITH_BUILDINFO
BLI_snprintf(version_buf, sizeof(version_buf), "Blender %d.%02d.%d commit date:%s, commit time:%s, hash:%s",
@@ -340,5 +329,4 @@ void DocumentExporter::exportScenes(const char *filename)
* NOTES:
*
* AnimationExporter::sample_animation enables all curves on armature, this is undesirable for a user
- *
*/
diff --git a/source/blender/collada/DocumentExporter.h b/source/blender/collada/DocumentExporter.h
index cb55dbc459e..203c77ed7ab 100644
--- a/source/blender/collada/DocumentExporter.h
+++ b/source/blender/collada/DocumentExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DocumentExporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __DOCUMENTEXPORTER_H__
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index e59483fa93c..97d4f056d0b 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/DocumentImporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
// TODO:
@@ -62,7 +56,7 @@ extern "C" {
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_layer.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_library.h"
#include "BKE_material.h"
#include "BKE_scene.h"
@@ -70,7 +64,7 @@ extern "C" {
#include "BLI_path_util.h"
#include "DNA_camera_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "RNA_access.h"
@@ -297,7 +291,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
COLLADAFW::Transformation::ROTATE,
COLLADAFW::Transformation::SCALE,
COLLADAFW::Transformation::TRANSLATE,
- COLLADAFW::Transformation::MATRIX
+ COLLADAFW::Transformation::MATRIX,
};
Object *ob;
@@ -379,24 +373,24 @@ Object *DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera
Camera *cam = uid_camera_map[cam_uid];
Camera *old_cam = (Camera *)ob->data;
ob->data = cam;
- BKE_libblock_free_us(bmain, old_cam);
+ BKE_id_free_us(bmain, old_cam);
return ob;
}
-Object *DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Scene *sce)
+Object *DocumentImporter::create_light_object(COLLADAFW::InstanceLight *lamp, Scene *sce)
{
const COLLADAFW::UniqueId& lamp_uid = lamp->getInstanciatedObjectId();
- if (uid_lamp_map.find(lamp_uid) == uid_lamp_map.end()) {
+ if (uid_light_map.find(lamp_uid) == uid_light_map.end()) {
fprintf(stderr, "Couldn't find light by UID.\n");
return NULL;
}
Main *bmain = CTX_data_main(mContext);
Object *ob = bc_add_object(bmain, sce, view_layer, OB_LAMP, NULL);
- Lamp *la = uid_lamp_map[lamp_uid];
- Lamp *old_lamp = (Lamp *)ob->data;
+ Light *la = uid_light_map[lamp_uid];
+ Light *old_light = (Light *)ob->data;
ob->data = la;
- BKE_libblock_free_us(bmain, old_lamp);
+ BKE_id_free_us(bmain, old_light);
return ob;
}
@@ -569,9 +563,9 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA
++camera_done;
}
while (lamp_done < lamp.getCount()) {
- ob = create_lamp_object(lamp[lamp_done], sce);
+ ob = create_light_object(lamp[lamp_done], sce);
if (ob == NULL) {
- report_unknown_reference(*node, "instance_lamp");
+ report_unknown_reference(*node, "instance_light");
}
else {
objects_done->push_back(ob);
@@ -843,10 +837,10 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera)
if (et && et->isProfile("blender")) {
et->setData("shiftx",&(cam->shiftx));
et->setData("shifty",&(cam->shifty));
- et->setData("YF_dofdist",&(cam->YF_dofdist));
+ et->setData("dof_distance",&(cam->dof_distance));
}
- cam->clipsta = camera->getNearClippingPlane().getValue();
- cam->clipend = camera->getFarClippingPlane().getValue();
+ cam->clip_start = camera->getNearClippingPlane().getValue();
+ cam->clip_end = camera->getFarClippingPlane().getValue();
COLLADAFW::Camera::CameraType type = camera->getCameraType();
switch (type) {
@@ -989,7 +983,7 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
return true;
Main *bmain = CTX_data_main(mContext);
- Lamp *lamp = NULL;
+ Light *lamp = NULL;
std::string la_id, la_name;
ExtraTags *et = getExtraTags(light->getUniqueId());
@@ -1001,8 +995,8 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
la_id = light->getOriginalId();
la_name = light->getName();
- if (la_name.size()) lamp = (Lamp *)BKE_lamp_add(bmain, (char *)la_name.c_str());
- else lamp = (Lamp *)BKE_lamp_add(bmain, (char *)la_id.c_str());
+ if (la_name.size()) lamp = (Light *)BKE_light_add(bmain, (char *)la_name.c_str());
+ else lamp = (Light *)BKE_light_add(bmain, (char *)la_id.c_str());
if (!lamp) {
fprintf(stderr, "Cannot create light.\n");
@@ -1123,7 +1117,7 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
}
}
- this->uid_lamp_map[light->getUniqueId()] = lamp;
+ this->uid_light_map[light->getUniqueId()] = lamp;
this->FW_object_map[light->getUniqueId()] = light;
return true;
}
diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h
index 2f0fd7efceb..1ba1a9c5388 100644
--- a/source/blender/collada/DocumentImporter.h
+++ b/source/blender/collada/DocumentImporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DocumentImporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __DOCUMENTIMPORTER_H__
@@ -71,7 +65,7 @@ public:
/** these should not be here */
Object* create_camera_object(COLLADAFW::InstanceCamera*, Scene*);
- Object* create_lamp_object(COLLADAFW::InstanceLight*, Scene*);
+ Object* create_light_object(COLLADAFW::InstanceLight*, Scene*);
Object* create_instance_node(Object*, COLLADAFW::Node*, COLLADAFW::Node*, Scene*, bool);
void create_constraints(ExtraTags *et, Object *ob);
std::vector<Object *> *write_node(COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
@@ -162,7 +156,7 @@ private:
std::map<COLLADAFW::UniqueId, Material*> uid_material_map;
std::map<COLLADAFW::UniqueId, Material*> uid_effect_map;
std::map<COLLADAFW::UniqueId, Camera*> uid_camera_map;
- std::map<COLLADAFW::UniqueId, Lamp*> uid_lamp_map;
+ std::map<COLLADAFW::UniqueId, Light*> uid_light_map;
std::map<Material*, TexIndexTextureArrayMap> material_texture_mapping_map;
std::multimap<COLLADAFW::UniqueId, Object*> object_map;
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> node_map;
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index f16392cdc1c..3494cdbada4 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/EffectExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
@@ -105,14 +98,14 @@ void EffectsExporter::set_shader_type(COLLADASW::EffectProfile &ep, Material *ma
void EffectsExporter::set_transparency(COLLADASW::EffectProfile &ep, Material *ma)
{
- if (ma->alpha == 1.0f) {
- return; // have no transparency
+ COLLADASW::ColorOrTexture cot = bc_get_base_color(ma);
+ float transparency = cot.getColor().getAlpha();
+ if (transparency < 1) {
+ // Tod: because we are in A_ONE mode transparency is calculated like this:
+ COLLADASW::ColorOrTexture cot = getcol(1.0f, 1.0f, 1.0f, transparency);
+ ep.setTransparent(cot);
+ ep.setOpaque(COLLADASW::EffectProfile::A_ONE);
}
-
- // Tod: because we are in A_ONE mode transparency is calculated like this:
- COLLADASW::ColorOrTexture cot = getcol(1.0f, 1.0f, 1.0f, ma->alpha);
- ep.setTransparent(cot);
- ep.setOpaque(COLLADASW::EffectProfile::A_ONE);
}
void EffectsExporter::set_diffuse_color(COLLADASW::EffectProfile &ep, Material *ma)
{
@@ -121,11 +114,10 @@ void EffectsExporter::set_diffuse_color(COLLADASW::EffectProfile &ep, Material *
ep.setDiffuse(cot, false, "diffuse");
}
-void EffectsExporter::set_specular_color(COLLADASW::EffectProfile &ep, Material *ma)
+void EffectsExporter::set_reflectivity(COLLADASW::EffectProfile &ep, Material *ma)
{
- bool use_fallback = ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT;
- COLLADASW::ColorOrTexture cot = bc_get_specular_color(ma, use_fallback);
- ep.setSpecular(cot, false, "specular");
+ double reflectivity = bc_get_reflectivity(ma);
+ ep.setReflectivity(reflectivity, false, "specular");
}
void EffectsExporter::set_emission(COLLADASW::EffectProfile &ep, Material *ma)
@@ -189,7 +181,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
set_transparency(ep, ma);
set_diffuse_color(ep, ma);
- set_specular_color(ep, ma);
+ set_reflectivity(ep, ma);
set_emission(ep, ma);
get_images(ma, material_image_map);
diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h
index 462f1548586..3ba642088a1 100644
--- a/source/blender/collada/EffectExporter.h
+++ b/source/blender/collada/EffectExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file EffectExporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __EFFECTEXPORTER_H__
@@ -62,7 +55,7 @@ private:
void set_shader_type(COLLADASW::EffectProfile &ep, Material *ma);
void set_transparency(COLLADASW::EffectProfile &ep, Material *ma);
void set_diffuse_color(COLLADASW::EffectProfile &ep, Material *ma);
- void set_specular_color(COLLADASW::EffectProfile &ep, Material *ma);
+ void set_reflectivity(COLLADASW::EffectProfile &ep, Material *ma);
void set_emission(COLLADASW::EffectProfile &ep, Material *ma);
void get_images(Material *ma, KeyImageMap &uid_image_map);
void create_image_samplers(COLLADASW::EffectProfile &ep, KeyImageMap &uid_image_map, std::string &active_uv);
diff --git a/source/blender/collada/ErrorHandler.cpp b/source/blender/collada/ErrorHandler.cpp
index e708cc9fc8c..0e1647e615f 100644
--- a/source/blender/collada/ErrorHandler.cpp
+++ b/source/blender/collada/ErrorHandler.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ErrorHandler.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include "ErrorHandler.h"
#include <iostream>
diff --git a/source/blender/collada/ErrorHandler.h b/source/blender/collada/ErrorHandler.h
index 2e648f54c4e..f32f1d60a6a 100644
--- a/source/blender/collada/ErrorHandler.h
+++ b/source/blender/collada/ErrorHandler.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ErrorHandler.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include <string>
diff --git a/source/blender/collada/ExportSettings.cpp b/source/blender/collada/ExportSettings.cpp
index 9caede5659a..da3c0de0fdf 100644
--- a/source/blender/collada/ExportSettings.cpp
+++ b/source/blender/collada/ExportSettings.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ExportSettings.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include "ExportSettings.h"
diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
index 3b4397a6093..d0a7a76f6aa 100644
--- a/source/blender/collada/ExportSettings.h
+++ b/source/blender/collada/ExportSettings.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ExportSettings.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __EXPORTSETTINGS_H__
@@ -71,6 +65,7 @@ typedef struct ExportSettings {
int sampling_rate;
bool keep_smooth_curves;
bool keep_keyframes;
+ bool keep_flat_curves;
bool active_uv_only;
BC_export_animation_type export_animation_type;
diff --git a/source/blender/collada/ExtraHandler.cpp b/source/blender/collada/ExtraHandler.cpp
index 5d704bc9abc..48586a2b169 100644
--- a/source/blender/collada/ExtraHandler.cpp
+++ b/source/blender/collada/ExtraHandler.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ExtraHandler.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include <stddef.h>
diff --git a/source/blender/collada/ExtraHandler.h b/source/blender/collada/ExtraHandler.h
index 826557ebaab..4e1e0415714 100644
--- a/source/blender/collada/ExtraHandler.h
+++ b/source/blender/collada/ExtraHandler.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ExtraHandler.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include <string>
diff --git a/source/blender/collada/ExtraTags.cpp b/source/blender/collada/ExtraTags.cpp
index fd249884c3f..829bb40b1f5 100644
--- a/source/blender/collada/ExtraTags.cpp
+++ b/source/blender/collada/ExtraTags.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ExtraTags.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include <stddef.h>
diff --git a/source/blender/collada/ExtraTags.h b/source/blender/collada/ExtraTags.h
index 84857622ee8..e7c574751b9 100644
--- a/source/blender/collada/ExtraTags.h
+++ b/source/blender/collada/ExtraTags.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ExtraTags.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include <string>
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index bb69c3fc653..ba9ba7998e0 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/GeometryExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
@@ -127,11 +120,11 @@ void GeometryExporter::operator()(Object *ob)
// XXX slow
if (ob->totcol) {
for (int a = 0; a < ob->totcol; a++) {
- createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind);
+ create_mesh_primitive_list(a, has_uvs, has_color, ob, me, geom_id, norind);
}
}
else {
- createPolylist(0, has_uvs, has_color, ob, me, geom_id, norind);
+ create_mesh_primitive_list(0, has_uvs, has_color, ob, me, geom_id, norind);
}
}
@@ -212,11 +205,11 @@ void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb)
// XXX slow
if (ob->totcol) {
for (int a = 0; a < ob->totcol; a++) {
- createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind);
+ create_mesh_primitive_list(a, has_uvs, has_color, ob, me, geom_id, norind);
}
}
else {
- createPolylist(0, has_uvs, has_color, ob, me, geom_id, norind);
+ create_mesh_primitive_list(0, has_uvs, has_color, ob, me, geom_id, norind);
}
closeMesh();
@@ -279,6 +272,64 @@ void GeometryExporter::createLooseEdgeList(Object *ob,
}
+static void prepareToAppendValues(bool is_triangulated, COLLADASW::PrimitivesBase &primitive_list, std::vector<unsigned long> &vcount_list)
+{
+ // performs the actual writing
+ if (is_triangulated) {
+ ((COLLADASW::Triangles &)primitive_list).prepareToAppendValues();
+ }
+ else {
+ // sets <vcount>
+ primitive_list.setVCountList(vcount_list);
+ ((COLLADASW::Polylist &)primitive_list).prepareToAppendValues();
+ }
+}
+
+static void finish_and_delete_primitive_List(bool is_triangulated, COLLADASW::PrimitivesBase *primitive_list)
+{
+ if (is_triangulated) {
+ ((COLLADASW::Triangles *)primitive_list)->finish();
+ }
+ else {
+ ((COLLADASW::Polylist *)primitive_list)->finish();
+ }
+ delete primitive_list;
+}
+
+static COLLADASW::PrimitivesBase *create_primitive_list(bool is_triangulated, COLLADASW::StreamWriter *mSW)
+{
+ COLLADASW::PrimitivesBase *primitive_list;
+
+ if (is_triangulated)
+ {
+ primitive_list = new COLLADASW::Triangles(mSW);
+ }
+ else {
+ primitive_list = new COLLADASW::Polylist(mSW);
+ }
+ return primitive_list;
+}
+
+static bool collect_vertex_counts_per_poly(Mesh *me, int material_index, std::vector<unsigned long> &vcount_list)
+{
+ MPoly *mpolys = me->mpoly;
+ int totpolys = me->totpoly;
+ bool is_triangulated = true;
+
+ int i;
+ // Expecting that p->mat_nr is always 0 if the mesh has no materials assigned
+ for (i = 0; i < totpolys; i++) {
+ MPoly *p = &mpolys[i];
+ if (p->mat_nr == material_index) {
+ int vertex_count = p->totloop;
+ vcount_list.push_back(vertex_count);
+ if (vertex_count != 3)
+ is_triangulated = false;
+ }
+ }
+ return is_triangulated;
+}
+
std::string GeometryExporter::makeVertexColorSourceId(std::string& geom_id, char *layer_name)
{
std::string result = getIdBySemantics(geom_id, COLLADASW::InputSemantic::COLOR) + "-" + layer_name;
@@ -286,7 +337,7 @@ std::string GeometryExporter::makeVertexColorSourceId(std::string& geom_id, char
}
// powerful because it handles both cases when there is material and when there's not
-void GeometryExporter::createPolylist(short material_index,
+void GeometryExporter::create_mesh_primitive_list(short material_index,
bool has_uvs,
bool has_color,
Object *ob,
@@ -299,66 +350,52 @@ void GeometryExporter::createPolylist(short material_index,
MLoop *mloops = me->mloop;
int totpolys = me->totpoly;
- // <vcount>
- int i;
- int faces_in_polylist = 0;
std::vector<unsigned long> vcount_list;
- // count faces with this material
- for (i = 0; i < totpolys; i++) {
- MPoly *p = &mpolys[i];
-
- if (p->mat_nr == material_index) {
- faces_in_polylist++;
- vcount_list.push_back(p->totloop);
- }
- }
+ bool is_triangulated = collect_vertex_counts_per_poly(me, material_index, vcount_list);
+ int polygon_count = vcount_list.size();
// no faces using this material
- if (faces_in_polylist == 0) {
+ if (polygon_count == 0) {
fprintf(stderr, "%s: material with index %d is not used.\n", id_name(ob).c_str(), material_index);
return;
}
Material *ma = ob->totcol ? give_current_material(ob, material_index + 1) : NULL;
- COLLADASW::Polylist polylist(mSW);
+ COLLADASW::PrimitivesBase *primitive_list = create_primitive_list(is_triangulated, mSW);
// sets count attribute in <polylist>
- polylist.setCount(faces_in_polylist);
+ primitive_list->setCount(polygon_count);
// sets material name
if (ma) {
std::string material_id = get_material_id(ma);
std::ostringstream ostr;
ostr << translate_id(material_id);
- polylist.setMaterial(ostr.str());
+ primitive_list->setMaterial(ostr.str());
}
- COLLADASW::InputList &til = polylist.getInputList();
+ COLLADASW::Input vertex_input(COLLADASW::InputSemantic::VERTEX, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::VERTEX), 0);
+ COLLADASW::Input normals_input(COLLADASW::InputSemantic::NORMAL, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::NORMAL), 1);
- // creates <input> in <polylist> for vertices
- COLLADASW::Input input1(COLLADASW::InputSemantic::VERTEX, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::VERTEX), 0);
-
- // creates <input> in <polylist> for normals
- COLLADASW::Input input2(COLLADASW::InputSemantic::NORMAL, getUrlBySemantics(geom_id, COLLADASW::InputSemantic::NORMAL), 1);
-
- til.push_back(input1);
- til.push_back(input2);
+ COLLADASW::InputList &til = primitive_list->getInputList();
+ til.push_back(vertex_input);
+ til.push_back(normals_input);
// if mesh has uv coords writes <input> for TEXCOORD
int num_layers = CustomData_number_of_layers(&me->ldata, CD_MLOOPUV);
int active_uv_index = CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV);
- for (i = 0; i < num_layers; i++) {
+ for (int i = 0; i < num_layers; i++) {
int layer_index = CustomData_get_layer_index_n(&me->ldata, CD_MLOOPUV, i);
if (!this->export_settings->active_uv_only || layer_index == active_uv_index) {
// char *name = CustomData_get_layer_name(&me->ldata, CD_MLOOPUV, i);
- COLLADASW::Input input3(COLLADASW::InputSemantic::TEXCOORD,
+ COLLADASW::Input texcoord_input(COLLADASW::InputSemantic::TEXCOORD,
makeUrl(makeTexcoordSourceId(geom_id, i, this->export_settings->active_uv_only)),
2, // this is only until we have optimized UV sets
- (this->export_settings->active_uv_only) ? 0 : layer_index // only_active_uv exported -> we have only one set
+ (this->export_settings->active_uv_only) ? 0 : layer_index-1 //set (0,1,2,...)
);
- til.push_back(input3);
+ til.push_back(texcoord_input);
}
}
@@ -378,15 +415,12 @@ void GeometryExporter::createPolylist(short material_index,
}
}
- // sets <vcount>
- polylist.setVCountList(vcount_list);
-
// performs the actual writing
- polylist.prepareToAppendValues();
+ prepareToAppendValues(is_triangulated, *primitive_list, vcount_list);
// <p>
int texindex = 0;
- for (i = 0; i < totpolys; i++) {
+ for (int i = 0; i < totpolys; i++) {
MPoly *p = &mpolys[i];
int loop_count = p->totloop;
@@ -395,22 +429,23 @@ void GeometryExporter::createPolylist(short material_index,
BCPolygonNormalsIndices normal_indices = norind[i];
for (int j = 0; j < loop_count; j++) {
- polylist.appendValues(l[j].v);
- polylist.appendValues(normal_indices[j]);
+ primitive_list->appendValues(l[j].v);
+ primitive_list->appendValues(normal_indices[j]);
if (has_uvs)
- polylist.appendValues(texindex + j);
+ primitive_list->appendValues(texindex + j);
if (has_color)
- polylist.appendValues(texindex + j);
+ primitive_list->appendValues(texindex + j);
}
}
texindex += loop_count;
}
- polylist.finish();
+ finish_and_delete_primitive_List(is_triangulated, primitive_list);
}
+
// creates <source> for positions
void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
{
@@ -445,7 +480,6 @@ void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
}
-
void GeometryExporter::createVertexColorSource(std::string geom_id, Mesh *me)
{
/* Find number of vertex color layers */
diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h
index bd629946d01..5eba68165d2 100644
--- a/source/blender/collada/GeometryExporter.h
+++ b/source/blender/collada/GeometryExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GeometryExporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __GEOMETRYEXPORTER_H__
@@ -92,7 +85,7 @@ public:
std::string& geom_id);
// powerful because it handles both cases when there is material and when there's not
- void createPolylist(short material_index,
+ void create_mesh_primitive_list(short material_index,
bool has_uvs,
bool has_color,
Object *ob,
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index d7ab16f81e7..b4814abf513 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ImageExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
diff --git a/source/blender/collada/ImageExporter.h b/source/blender/collada/ImageExporter.h
index 7ce312a52b1..7c1046f7943 100644
--- a/source/blender/collada/ImageExporter.h
+++ b/source/blender/collada/ImageExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ImageExporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __IMAGEEXPORTER_H__
diff --git a/source/blender/collada/ImportSettings.cpp b/source/blender/collada/ImportSettings.cpp
index 9483aa1ac76..049ee1d0975 100644
--- a/source/blender/collada/ImportSettings.cpp
+++ b/source/blender/collada/ImportSettings.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Gaia Clary.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/ImportSettings.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include "ImportSettings.h"
diff --git a/source/blender/collada/ImportSettings.h b/source/blender/collada/ImportSettings.h
index fb4277b048f..b8272cf747f 100644
--- a/source/blender/collada/ImportSettings.h
+++ b/source/blender/collada/ImportSettings.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Gaia Clary
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ImportSettings.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __IMPORTSETTINGS_H__
diff --git a/source/blender/collada/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp
index 0c0b1a15653..819f5244ba0 100644
--- a/source/blender/collada/InstanceWriter.cpp
+++ b/source/blender/collada/InstanceWriter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/InstanceWriter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
diff --git a/source/blender/collada/InstanceWriter.h b/source/blender/collada/InstanceWriter.h
index 49ddf091b1c..ea5e9fd58fe 100644
--- a/source/blender/collada/InstanceWriter.h
+++ b/source/blender/collada/InstanceWriter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file InstanceWriter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __INSTANCEWRITER_H__
diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp
index b1f805bfb87..c1822a8e5f3 100644
--- a/source/blender/collada/LightExporter.cpp
+++ b/source/blender/collada/LightExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/LightExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include <string>
@@ -36,7 +29,7 @@
#include "collada_internal.h"
template<class Functor>
-void forEachLampObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
+void forEachLightObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
{
LinkNode *node;
for (node = export_set; node; node = node->next) {
@@ -55,14 +48,14 @@ void LightsExporter::exportLights(Scene *sce)
{
openLibrary();
- forEachLampObjectInExportSet(sce, *this, this->export_settings->export_set);
+ forEachLightObjectInExportSet(sce, *this, this->export_settings->export_set);
closeLibrary();
}
void LightsExporter::operator()(Object *ob)
{
- Lamp *la = (Lamp *)ob->data;
+ Light *la = (Light *)ob->data;
std::string la_id(get_light_id(ob));
std::string la_name(id_name(la));
COLLADASW::Color col(la->r * la->energy, la->g * la->energy, la->b * la->energy);
@@ -112,7 +105,7 @@ void LightsExporter::operator()(Object *ob)
exportBlenderProfile(cla, la);
addLight(cla);
}
- // area lamp is not supported
+ // area light is not supported
// it will be exported as a local lamp
else {
COLLADASW::PointLight cla(mSW, la_id, la_name);
@@ -126,7 +119,7 @@ void LightsExporter::operator()(Object *ob)
}
-bool LightsExporter::exportBlenderProfile(COLLADASW::Light &cla, Lamp *la)
+bool LightsExporter::exportBlenderProfile(COLLADASW::Light &cla, Light *la)
{
cla.addExtraTechniqueParameter("blender", "type", la->type);
cla.addExtraTechniqueParameter("blender", "flag", la->flag);
diff --git a/source/blender/collada/LightExporter.h b/source/blender/collada/LightExporter.h
index 0cfca914ef4..7cd0d2979e5 100644
--- a/source/blender/collada/LightExporter.h
+++ b/source/blender/collada/LightExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file LightExporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __LIGHTEXPORTER_H__
@@ -31,7 +24,7 @@
#include "COLLADASWStreamWriter.h"
#include "COLLADASWLibraryLights.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -44,7 +37,7 @@ public:
void exportLights(Scene *sce);
void operator()(Object *ob);
private:
- bool exportBlenderProfile(COLLADASW::Light &cla, Lamp *la);
+ bool exportBlenderProfile(COLLADASW::Light &cla, Light *la);
const ExportSettings *export_settings;
};
diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp
index 2fa71817ac8..0c2a7a09b21 100644
--- a/source/blender/collada/MaterialExporter.cpp
+++ b/source/blender/collada/MaterialExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,12 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/MaterialExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
-
-
#include "MaterialExporter.h"
#include "COLLADABUUtils.h"
#include "collada_internal.h"
diff --git a/source/blender/collada/MaterialExporter.h b/source/blender/collada/MaterialExporter.h
index 171c05fcea7..debc226c099 100644
--- a/source/blender/collada/MaterialExporter.h
+++ b/source/blender/collada/MaterialExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file MaterialExporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __MATERIALEXPORTER_H__
diff --git a/source/blender/collada/Materials.cpp b/source/blender/collada/Materials.cpp
index 3173c2592c4..d6ed0e2859a 100644
--- a/source/blender/collada/Materials.cpp
+++ b/source/blender/collada/Materials.cpp
@@ -1,24 +1,18 @@
/*
-* ***** 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): Gaia Clary.
-*
-* ***** END 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.
+ */
#include "Materials.h"
@@ -145,15 +139,13 @@ void MaterialNode::set_diffuse(COLLADAFW::ColorOrTexture &cot, std::string label
int locy = -300 * (node_map.size()-2);
if (cot.isColor()) {
COLLADAFW::Color col = cot.getColor();
- material->r = col.getRed();
- material->g = col.getGreen();
- material->b = col.getBlue();
-
bNodeSocket *socket = (bNodeSocket *)BLI_findlink(&shader_node->inputs, BC_PBR_DIFFUSE);
float *fcol = (float *)socket->default_value;
- fcol[0] = col.getRed();
- fcol[1] = col.getGreen();
- fcol[2] = col.getBlue();
+
+ fcol[0] = material->r = col.getRed();
+ fcol[1] = material->g = col.getGreen();
+ fcol[2] = material->b = col.getBlue();
+ fcol[3] = material->a = col.getAlpha();
}
else if (cot.isTexture()) {
bNode *texture_node = add_texture_node(cot, -300, locy, label);
diff --git a/source/blender/collada/Materials.h b/source/blender/collada/Materials.h
index 69f64a6280d..3e6dcf896a7 100644
--- a/source/blender/collada/Materials.h
+++ b/source/blender/collada/Materials.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,6 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __MATERIAL_H__
@@ -40,7 +34,7 @@ extern "C" {
typedef enum BC_pbr_inputs {
BC_PBR_DIFFUSE = 0,
BC_PBR_METALLIC = 4,
- BC_PBR_IOR = 14
+ BC_PBR_IOR = 14,
} BC_pbr_inputs;
typedef std::map<std::string, bNode *> NodeMap;
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index 4dd3f1cc219..306120e464f 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/MeshImporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
@@ -562,7 +556,7 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len)
totedge = mesh->totedge + len;
/* update customdata */
- CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge);
+ CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH.emask, CD_DEFAULT, totedge);
CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge);
if (!CustomData_has_layer(&edata, CD_MEDGE))
@@ -1105,7 +1099,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
BKE_mesh_calc_normals(new_mesh);
id_us_plus(&old_mesh->id); /* Because BKE_mesh_assign_object would have already decreased it... */
- BKE_libblock_free_us(m_bmain, old_mesh);
+ BKE_id_free_us(m_bmain, old_mesh);
COLLADAFW::MaterialBindingArray& mat_array =
geom->getMaterialBindings();
@@ -1123,6 +1117,9 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
}
}
+ // clean up the mesh
+ BKE_mesh_validate((Mesh *)ob->data, false, false);
+
return ob;
}
@@ -1154,13 +1151,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom)
read_vertices(mesh, me);
read_polys(mesh, me);
-
- // must validate before calculating edges
- BKE_mesh_calc_normals(me);
- BKE_mesh_validate(me, false, false);
- // validation does this
- // BKE_mesh_calc_edges(me, false, false);
-
+ BKE_mesh_calc_edges(me, false, false);
// read_lines() must be called after the face edges have been generated.
// Otherwise the loose edges will be silently deleted again.
read_lines(mesh, me);
diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h
index 4583242808b..163ecfce9ea 100644
--- a/source/blender/collada/MeshImporter.h
+++ b/source/blender/collada/MeshImporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file MeshImporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __MESHIMPORTER_H__
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index 3e375b14e44..f09fae73efd 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/SceneExporter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
extern "C" {
@@ -180,8 +174,8 @@ void SceneExporter::writeNodes(Object *ob)
// empty object
else if (ob->type == OB_EMPTY) { // TODO: handle groups (OB_DUPLICOLLECTION
- if ((ob->transflag & OB_DUPLICOLLECTION) == OB_DUPLICOLLECTION && ob->dup_group) {
- Collection *collection = ob->dup_group;
+ if ((ob->transflag & OB_DUPLICOLLECTION) == OB_DUPLICOLLECTION && ob->instance_collection) {
+ Collection *collection = ob->instance_collection;
/* printf("group detected '%s'\n", group->id.name + 2); */
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object)
{
diff --git a/source/blender/collada/SceneExporter.h b/source/blender/collada/SceneExporter.h
index f6525d5438d..033616ac0a4 100644
--- a/source/blender/collada/SceneExporter.h
+++ b/source/blender/collada/SceneExporter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file SceneExporter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __SCENEEXPORTER_H__
diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp
index 317d39c015b..337fa94f476 100644
--- a/source/blender/collada/SkinInfo.cpp
+++ b/source/blender/collada/SkinInfo.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/SkinInfo.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
diff --git a/source/blender/collada/SkinInfo.h b/source/blender/collada/SkinInfo.h
index 39808c546b1..7695547f9b5 100644
--- a/source/blender/collada/SkinInfo.h
+++ b/source/blender/collada/SkinInfo.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file SkinInfo.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __SKININFO_H__
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index 0c2ea9cb7c4..6a557ea8120 100644
--- a/source/blender/collada/TransformReader.cpp
+++ b/source/blender/collada/TransformReader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/TransformReader.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
/* COLLADABU_ASSERT, may be able to remove later */
diff --git a/source/blender/collada/TransformReader.h b/source/blender/collada/TransformReader.h
index 6544aa1c040..36d994c9487 100644
--- a/source/blender/collada/TransformReader.h
+++ b/source/blender/collada/TransformReader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file TransformReader.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __TRANSFORMREADER_H__
diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp
index 4ff9e0af50f..7b5356d2dce 100644
--- a/source/blender/collada/TransformWriter.cpp
+++ b/source/blender/collada/TransformWriter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/TransformWriter.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
@@ -77,11 +70,11 @@ void TransformWriter::add_node_transform_ob(
// factor out scale from obmat
- copy_v3_v3(scale, ob->size);
+ copy_v3_v3(scale, ob->scale);
- ob->size[0] = ob->size[1] = ob->size[2] = 1.0f;
+ ob->scale[0] = ob->scale[1] = ob->scale[2] = 1.0f;
BKE_object_to_mat4(ob, C);
- copy_v3_v3(ob->size, scale);
+ copy_v3_v3(ob->scale, scale);
mul_m4_series(tmat, ob->parent->obmat, ob->parentinv, C);
@@ -98,7 +91,7 @@ void TransformWriter::add_node_transform_ob(
else {
copy_v3_v3(loc, ob->loc);
copy_v3_v3(rot, ob->rot);
- copy_v3_v3(scale, ob->size);
+ copy_v3_v3(scale, ob->scale);
}
add_transform(node, loc, rot, scale);
diff --git a/source/blender/collada/TransformWriter.h b/source/blender/collada/TransformWriter.h
index 2c7fedb9f34..49ed22ef3f8 100644
--- a/source/blender/collada/TransformWriter.h
+++ b/source/blender/collada/TransformWriter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed,
- * Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file TransformWriter.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __TRANSFORMWRITER_H__
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index c6321a4047e..69030bd2f47 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/collada.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index 7882542ca44..2e407c30700 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file collada.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __COLLADA_H__
@@ -40,10 +34,10 @@ extern "C" {
#include "BLI_path_util.h"
#include "RNA_types.h"
-struct bContext;
struct Depsgraph;
struct Scene;
struct ViewLayer;
+struct bContext;
/*
* both return 1 on success, 0 on error
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index 64de0596ac5..637a5dde3ea 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/collada_internal.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
@@ -206,7 +200,7 @@ const unsigned char translate_start_name_map[256] = {
224, 225, 226, 227, 228, 229, 230, 231,
232, 233, 234, 235, 236, 237, 238, 239,
240, 241, 242, 243, 244, 245, 246, 247,
- 248, 249, 250, 251, 252, 253, 254, 255
+ 248, 249, 250, 251, 252, 253, 254, 255,
};
const unsigned char translate_name_map[256] = {
@@ -243,7 +237,7 @@ const unsigned char translate_name_map[256] = {
224, 225, 226, 227, 228, 229, 230, 231,
232, 233, 234, 235, 236, 237, 238, 239,
240, 241, 242, 243, 244, 245, 246, 247,
- 248, 249, 250, 251, 252, 253, 254, 255
+ 248, 249, 250, 251, 252, 253, 254, 255,
};
typedef std::map< std::string, std::vector<std::string> > map_string_list;
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h
index f16e3a7cf4a..23478ae54d6 100644
--- a/source/blender/collada/collada_internal.h
+++ b/source/blender/collada/collada_internal.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file collada_internal.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __COLLADA_INTERNAL_H__
@@ -57,7 +51,7 @@ public:
enum UnitSystem {
None,
Metric,
- Imperial
+ Imperial,
};
// Initialize with Z_UP, since Blender uses right-handed, z-up
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 3716f334d5b..79ad79f6735 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/collada/collada_utils.cpp
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
@@ -196,7 +190,7 @@ std::vector<bAction *> bc_getSceneActions(const bContext *C, Object *ob, bool al
Main *bmain = CTX_data_main(C);
ID *id;
- for (id = (ID *)bmain->action.first; id; id = (ID *)(id->next)) {
+ for (id = (ID *)bmain->actions.first; id; id = (ID *)(id->next)) {
bAction *act = (bAction *)id;
/* XXX This currently creates too many actions.
TODO Need to check if the action is compatible to the given object
@@ -262,19 +256,19 @@ Mesh *bc_get_mesh_copy(
bool apply_modifiers,
bool triangulate)
{
- CustomDataMask mask = CD_MASK_MESH;
+ CustomData_MeshMasks mask = CD_MASK_MESH;
Mesh *tmpmesh = NULL;
if (apply_modifiers) {
#if 0 /* Not supported by new system currently... */
switch (export_mesh_type) {
case BC_MESH_TYPE_VIEW:
{
- dm = mesh_create_derived_view(depsgraph, scene, ob, mask);
+ dm = mesh_create_derived_view(depsgraph, scene, ob, &mask);
break;
}
case BC_MESH_TYPE_RENDER:
{
- dm = mesh_create_derived_render(depsgraph, scene, ob, mask);
+ dm = mesh_create_derived_render(depsgraph, scene, ob, &mask);
break;
}
}
@@ -282,19 +276,14 @@ Mesh *bc_get_mesh_copy(
Depsgraph *depsgraph = blender_context.get_depsgraph();
Scene *scene_eval = blender_context.get_evaluated_scene();
Object *ob_eval = blender_context.get_evaluated_object(ob);
- tmpmesh = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, mask);
+ tmpmesh = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &mask);
#endif
}
else {
tmpmesh = (Mesh *)ob->data;
}
- BKE_id_copy_ex(NULL, &tmpmesh->id, (ID **)&tmpmesh,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &tmpmesh->id, (ID **)&tmpmesh, LIB_ID_COPY_LOCALIZE);
if (triangulate) {
bc_triangulate_mesh(tmpmesh);
@@ -322,12 +311,12 @@ Object *bc_get_assigned_armature(Object *ob)
return ob_arm;
}
-/*
-* Returns the highest selected ancestor
-* returns NULL if no ancestor is selected
-* IMPORTANT: This function expects that all exported objects have set:
-* ob->id.tag & LIB_TAG_DOIT
-*/
+/**
+ * Returns the highest selected ancestor
+ * returns NULL if no ancestor is selected
+ * IMPORTANT: This function expects that all exported objects have set:
+ * ob->id.tag & LIB_TAG_DOIT
+ */
Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob)
{
@@ -527,7 +516,6 @@ void bc_decompose(float mat[4][4], float *loc, float eul[3], float quat[4], floa
*
* Output:
* rot : the calculated result (quaternion)
- *
*/
void bc_rotate_from_reference_quat(float quat_to[4], float quat_from[4], float mat_to[4][4])
{
@@ -982,9 +970,8 @@ bool bc_bone_matrix_local_get(Object *ob, Bone *bone, Matrix &mat, bool for_open
copy_m4_m4(mat, pchan->pose_mat);
/* OPEN_SIM_COMPATIBILITY
- * AFAIK animation to second life is via BVH, but no
- * reason to not have the collada-animation be correct
- */
+ * AFAIK animation to second life is via BVH, but no
+ * reason to not have the collada-animation be correct */
if (for_opensim) {
float temp[4][4];
copy_m4_m4(temp, bone->arm_mat);
@@ -1029,9 +1016,9 @@ bool bc_is_animated(BCMatrixSampleMap &values)
bool bc_has_animations(Object *ob)
{
- /* Check for object,lamp and camera transform animations */
+ /* Check for object, light and camera transform animations */
if ((bc_getSceneObjectAction(ob) && bc_getSceneObjectAction(ob)->curves.first) ||
- (bc_getSceneLampAction(ob) && bc_getSceneLampAction(ob)->curves.first) ||
+ (bc_getSceneLightAction(ob) && bc_getSceneLightAction(ob)->curves.first) ||
(bc_getSceneCameraAction(ob) && bc_getSceneCameraAction(ob)->curves.first))
return true;
@@ -1367,25 +1354,11 @@ bc_node_add_link(ntree, nmap["main"], 0, nmap["out"], 0);
COLLADASW::ColorOrTexture bc_get_base_color(Material *ma)
{
bNode *master_shader = bc_get_master_shader(ma);
- if (master_shader) {
+ if (ma->use_nodes && master_shader) {
return bc_get_base_color(master_shader);
}
else {
- return bc_get_cot(ma->r, ma->g, ma->b, ma->alpha);
- }
-}
-
-COLLADASW::ColorOrTexture bc_get_specular_color(Material *ma, bool use_fallback)
-{
- bNode *master_shader = bc_get_master_shader(ma);
- if (master_shader) {
- return bc_get_specular_color(master_shader);
- }
- else if (use_fallback) {
- return bc_get_cot(ma->specr * ma->spec, ma->specg * ma->spec, ma->specb * ma->spec, 1.0f);
- }
- else {
- return bc_get_cot(0.0, 0.0, 0.0, 1.0); // no specular
+ return bc_get_cot(ma->r, ma->g, ma->b, ma->a);
}
}
@@ -1403,18 +1376,25 @@ COLLADASW::ColorOrTexture bc_get_base_color(bNode *shader)
}
}
-COLLADASW::ColorOrTexture bc_get_specular_color(bNode *shader)
+bool bc_get_reflectivity(bNode *shader, double &reflectivity)
{
bNodeSocket *socket = nodeFindSocket(shader, SOCK_IN, "Specular");
- if (socket)
- {
- bNodeSocketValueRGBA *dcol = (bNodeSocketValueRGBA *)socket->default_value;
- float* col = dcol->value;
- return bc_get_cot(col[0], col[1], col[2], col[3]);
+ if (socket) {
+ bNodeSocketValueFloat *ref = (bNodeSocketValueFloat *)socket->default_value;
+ reflectivity = (double)ref->value;
+ return true;
}
- else {
- return bc_get_cot(0.8, 0.8, 0.8, 1.0); //default white
+ return false;
+}
+
+double bc_get_reflectivity(Material *ma)
+{
+ double reflectivity = ma->spec; // fallback if no socket found
+ bNode *master_shader = bc_get_master_shader(ma);
+ if (ma->use_nodes && master_shader) {
+ bc_get_reflectivity(master_shader, reflectivity);
}
+ return reflectivity;
}
bNode *bc_get_master_shader(Material *ma)
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index 91325ec5fd2..b68da4e8154 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file collada_utils.h
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifndef __COLLADA_UTILS_H__
@@ -45,7 +39,7 @@ extern "C" {
#include "DNA_anim_types.h"
#include "DNA_constraint_types.h"
#include "DNA_mesh_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_camera_types.h"
#include "DNA_customdata_types.h"
@@ -96,13 +90,13 @@ inline bAction *bc_getSceneObjectAction(Object *ob)
return (ob->adt && ob->adt->action) ? ob->adt->action : NULL;
}
-/* Returns Lamp Action or NULL */
-inline bAction *bc_getSceneLampAction(Object *ob)
+/* Returns Light Action or NULL */
+inline bAction *bc_getSceneLightAction(Object *ob)
{
if (ob->type != OB_LAMP)
return NULL;
- Lamp *lamp = (Lamp *)ob->data;
+ Light *lamp = (Light *)ob->data;
return (lamp->adt && lamp->adt->action) ? lamp->adt->action : NULL;
}
@@ -316,8 +310,8 @@ void bc_add_default_shader(bContext *C, Material *ma);
bNode *bc_get_master_shader(Material *ma);
COLLADASW::ColorOrTexture bc_get_cot(float r, float g, float b, float a);
COLLADASW::ColorOrTexture bc_get_base_color(bNode *shader);
+bool bc_get_reflectivity(bNode *shader, double &reflectivity);
+double bc_get_reflectivity(Material *ma);
COLLADASW::ColorOrTexture bc_get_base_color(Material *ma);
-COLLADASW::ColorOrTexture bc_get_specular_color(bNode *shader);
-COLLADASW::ColorOrTexture bc_get_specular_color(Material *ma, bool use_fallback);
#endif
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index 261a1218d2d..306c06c4576 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2011, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jeroen Bakker, Monique Dewanchand, Blender Developers Fund.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -54,126 +49,126 @@ set(SRC
COM_compositor.h
COM_defines.h
- intern/COM_compositor.cpp
- intern/COM_ExecutionSystem.cpp
- intern/COM_ExecutionSystem.h
- intern/COM_NodeConverter.cpp
- intern/COM_NodeConverter.h
- intern/COM_NodeOperationBuilder.cpp
- intern/COM_NodeOperationBuilder.h
- intern/COM_NodeGraph.cpp
- intern/COM_NodeGraph.h
+ intern/COM_CPUDevice.cpp
+ intern/COM_CPUDevice.h
+ intern/COM_ChunkOrder.cpp
+ intern/COM_ChunkOrder.h
+ intern/COM_ChunkOrderHotspot.cpp
+ intern/COM_ChunkOrderHotspot.h
+ intern/COM_CompositorContext.cpp
+ intern/COM_CompositorContext.h
intern/COM_Converter.cpp
intern/COM_Converter.h
+ intern/COM_Debug.cpp
+ intern/COM_Debug.h
+ intern/COM_Device.cpp
+ intern/COM_Device.h
intern/COM_ExecutionGroup.cpp
intern/COM_ExecutionGroup.h
+ intern/COM_ExecutionSystem.cpp
+ intern/COM_ExecutionSystem.h
+ intern/COM_MemoryBuffer.cpp
+ intern/COM_MemoryBuffer.h
+ intern/COM_MemoryProxy.cpp
+ intern/COM_MemoryProxy.h
intern/COM_Node.cpp
intern/COM_Node.h
+ intern/COM_NodeConverter.cpp
+ intern/COM_NodeConverter.h
+ intern/COM_NodeGraph.cpp
+ intern/COM_NodeGraph.h
intern/COM_NodeOperation.cpp
intern/COM_NodeOperation.h
- intern/COM_SocketReader.cpp
- intern/COM_SocketReader.h
- intern/COM_MemoryProxy.cpp
- intern/COM_MemoryProxy.h
- intern/COM_MemoryBuffer.cpp
- intern/COM_MemoryBuffer.h
- intern/COM_WorkScheduler.cpp
- intern/COM_WorkScheduler.h
- intern/COM_WorkPackage.cpp
- intern/COM_WorkPackage.h
- intern/COM_ChunkOrder.cpp
- intern/COM_ChunkOrder.h
- intern/COM_ChunkOrderHotspot.cpp
- intern/COM_ChunkOrderHotspot.h
- intern/COM_Device.cpp
- intern/COM_Device.h
- intern/COM_CPUDevice.cpp
- intern/COM_CPUDevice.h
+ intern/COM_NodeOperationBuilder.cpp
+ intern/COM_NodeOperationBuilder.h
intern/COM_OpenCLDevice.cpp
intern/COM_OpenCLDevice.h
- intern/COM_CompositorContext.cpp
- intern/COM_CompositorContext.h
intern/COM_SingleThreadedOperation.cpp
intern/COM_SingleThreadedOperation.h
- intern/COM_Debug.cpp
- intern/COM_Debug.h
+ intern/COM_SocketReader.cpp
+ intern/COM_SocketReader.h
+ intern/COM_WorkPackage.cpp
+ intern/COM_WorkPackage.h
+ intern/COM_WorkScheduler.cpp
+ intern/COM_WorkScheduler.h
+ intern/COM_compositor.cpp
- operations/COM_QualityStepHelper.h
operations/COM_QualityStepHelper.cpp
+ operations/COM_QualityStepHelper.h
# Internal nodes
nodes/COM_SocketProxyNode.cpp
nodes/COM_SocketProxyNode.h
# input nodes
- nodes/COM_RenderLayersNode.cpp
- nodes/COM_RenderLayersNode.h
- nodes/COM_ImageNode.cpp
- nodes/COM_ImageNode.h
- nodes/COM_TextureNode.cpp
- nodes/COM_TextureNode.h
nodes/COM_BokehImageNode.cpp
nodes/COM_BokehImageNode.h
nodes/COM_ColorNode.cpp
nodes/COM_ColorNode.h
- nodes/COM_ValueNode.cpp
- nodes/COM_ValueNode.h
- nodes/COM_TimeNode.cpp
- nodes/COM_TimeNode.h
- nodes/COM_SwitchNode.cpp
- nodes/COM_SwitchNode.h
- nodes/COM_SwitchViewNode.cpp
- nodes/COM_SwitchViewNode.h
+ nodes/COM_ImageNode.cpp
+ nodes/COM_ImageNode.h
+ nodes/COM_MaskNode.cpp
+ nodes/COM_MaskNode.h
nodes/COM_MovieClipNode.cpp
nodes/COM_MovieClipNode.h
nodes/COM_OutputFileNode.cpp
nodes/COM_OutputFileNode.h
- nodes/COM_MaskNode.cpp
- nodes/COM_MaskNode.h
+ nodes/COM_RenderLayersNode.cpp
+ nodes/COM_RenderLayersNode.h
+ nodes/COM_SwitchNode.cpp
+ nodes/COM_SwitchNode.h
+ nodes/COM_SwitchViewNode.cpp
+ nodes/COM_SwitchViewNode.h
+ nodes/COM_TextureNode.cpp
+ nodes/COM_TextureNode.h
+ nodes/COM_TimeNode.cpp
+ nodes/COM_TimeNode.h
+ nodes/COM_ValueNode.cpp
+ nodes/COM_ValueNode.h
# output nodes
nodes/COM_CompositorNode.cpp
nodes/COM_CompositorNode.h
- nodes/COM_ViewerNode.cpp
- nodes/COM_ViewerNode.h
nodes/COM_SplitViewerNode.cpp
nodes/COM_SplitViewerNode.h
nodes/COM_ViewLevelsNode.cpp
nodes/COM_ViewLevelsNode.h
- operations/COM_CalculateStandardDeviationOperation.cpp
- operations/COM_CalculateStandardDeviationOperation.h
+ nodes/COM_ViewerNode.cpp
+ nodes/COM_ViewerNode.h
operations/COM_CalculateMeanOperation.cpp
operations/COM_CalculateMeanOperation.h
+ operations/COM_CalculateStandardDeviationOperation.cpp
+ operations/COM_CalculateStandardDeviationOperation.h
# distort nodes
- nodes/COM_TranslateNode.cpp
- nodes/COM_TranslateNode.h
- nodes/COM_ScaleNode.cpp
- nodes/COM_ScaleNode.h
- nodes/COM_RotateNode.cpp
- nodes/COM_RotateNode.h
nodes/COM_FlipNode.cpp
nodes/COM_FlipNode.h
+ nodes/COM_RotateNode.cpp
+ nodes/COM_RotateNode.h
+ nodes/COM_ScaleNode.cpp
+ nodes/COM_ScaleNode.h
+ nodes/COM_TranslateNode.cpp
+ nodes/COM_TranslateNode.h
- nodes/COM_MapUVNode.cpp
- nodes/COM_MapUVNode.h
nodes/COM_DisplaceNode.cpp
nodes/COM_DisplaceNode.h
+ nodes/COM_MapUVNode.cpp
+ nodes/COM_MapUVNode.h
- nodes/COM_DifferenceMatteNode.cpp
- nodes/COM_DifferenceMatteNode.h
- nodes/COM_LuminanceMatteNode.cpp
- nodes/COM_LuminanceMatteNode.h
- nodes/COM_DistanceMatteNode.cpp
- nodes/COM_DistanceMatteNode.h
+ nodes/COM_ChannelMatteNode.cpp
+ nodes/COM_ChannelMatteNode.h
nodes/COM_ChromaMatteNode.cpp
nodes/COM_ChromaMatteNode.h
nodes/COM_ColorMatteNode.cpp
nodes/COM_ColorMatteNode.h
- nodes/COM_ChannelMatteNode.cpp
- nodes/COM_ChannelMatteNode.h
+ nodes/COM_DifferenceMatteNode.cpp
+ nodes/COM_DifferenceMatteNode.h
+ nodes/COM_DistanceMatteNode.cpp
+ nodes/COM_DistanceMatteNode.h
nodes/COM_LensDistortionNode.cpp
nodes/COM_LensDistortionNode.h
+ nodes/COM_LuminanceMatteNode.cpp
+ nodes/COM_LuminanceMatteNode.h
nodes/COM_GlareNode.cpp
nodes/COM_GlareNode.h
@@ -198,71 +193,71 @@ set(SRC
operations/COM_CropOperation.cpp
operations/COM_CropOperation.h
- nodes/COM_TransformNode.cpp
- nodes/COM_TransformNode.h
- nodes/COM_Stabilize2dNode.cpp
- nodes/COM_Stabilize2dNode.h
- nodes/COM_MovieDistortionNode.cpp
- nodes/COM_MovieDistortionNode.h
nodes/COM_DefocusNode.cpp
nodes/COM_DefocusNode.h
+ nodes/COM_MovieDistortionNode.cpp
+ nodes/COM_MovieDistortionNode.h
+ nodes/COM_Stabilize2dNode.cpp
+ nodes/COM_Stabilize2dNode.h
+ nodes/COM_TransformNode.cpp
+ nodes/COM_TransformNode.h
# color nodes
- nodes/COM_VectorCurveNode.cpp
- nodes/COM_VectorCurveNode.h
- nodes/COM_ColorCurveNode.cpp
- nodes/COM_ColorCurveNode.h
- nodes/COM_ColorToBWNode.cpp
- nodes/COM_ColorToBWNode.h
- nodes/COM_ColorRampNode.cpp
- nodes/COM_ColorRampNode.h
- nodes/COM_MixNode.cpp
- nodes/COM_MixNode.h
nodes/COM_AlphaOverNode.cpp
nodes/COM_AlphaOverNode.h
- nodes/COM_ZCombineNode.cpp
- nodes/COM_ZCombineNode.h
nodes/COM_BrightnessNode.cpp
nodes/COM_BrightnessNode.h
nodes/COM_ColorBalanceNode.cpp
nodes/COM_ColorBalanceNode.h
- nodes/COM_InvertNode.cpp
- nodes/COM_InvertNode.h
- nodes/COM_GammaNode.cpp
- nodes/COM_GammaNode.h
- nodes/COM_SetAlphaNode.cpp
- nodes/COM_SetAlphaNode.h
+ nodes/COM_ColorCorrectionNode.cpp
+ nodes/COM_ColorCorrectionNode.h
+ nodes/COM_ColorCurveNode.cpp
+ nodes/COM_ColorCurveNode.h
+ nodes/COM_ColorRampNode.cpp
+ nodes/COM_ColorRampNode.h
+ nodes/COM_ColorToBWNode.cpp
+ nodes/COM_ColorToBWNode.h
nodes/COM_ConvertAlphaNode.cpp
nodes/COM_ConvertAlphaNode.h
- nodes/COM_HueSaturationValueNode.cpp
- nodes/COM_HueSaturationValueNode.h
+ nodes/COM_GammaNode.cpp
+ nodes/COM_GammaNode.h
nodes/COM_HueSaturationValueCorrectNode.cpp
nodes/COM_HueSaturationValueCorrectNode.h
- nodes/COM_ColorCorrectionNode.cpp
- nodes/COM_ColorCorrectionNode.h
+ nodes/COM_HueSaturationValueNode.cpp
+ nodes/COM_HueSaturationValueNode.h
+ nodes/COM_InvertNode.cpp
+ nodes/COM_InvertNode.h
+ nodes/COM_MixNode.cpp
+ nodes/COM_MixNode.h
+ nodes/COM_SetAlphaNode.cpp
+ nodes/COM_SetAlphaNode.h
nodes/COM_TonemapNode.cpp
nodes/COM_TonemapNode.h
+ nodes/COM_VectorCurveNode.cpp
+ nodes/COM_VectorCurveNode.h
+ nodes/COM_ZCombineNode.cpp
+ nodes/COM_ZCombineNode.h
operations/COM_TonemapOperation.cpp
operations/COM_TonemapOperation.h
# converter nodes
+ nodes/COM_CombineColorNode.cpp
+ nodes/COM_CombineColorNode.h
nodes/COM_IDMaskNode.cpp
nodes/COM_IDMaskNode.h
nodes/COM_SeparateColorNode.cpp
nodes/COM_SeparateColorNode.h
- nodes/COM_CombineColorNode.cpp
- nodes/COM_CombineColorNode.h
+ nodes/COM_MapRangeNode.cpp
+ nodes/COM_MapRangeNode.h
+ nodes/COM_MapValueNode.cpp
+ nodes/COM_MapValueNode.h
+ nodes/COM_MathNode.cpp
+ nodes/COM_MathNode.h
nodes/COM_NormalNode.cpp
nodes/COM_NormalNode.h
nodes/COM_NormalizeNode.cpp
nodes/COM_NormalizeNode.h
- nodes/COM_MathNode.cpp
- nodes/COM_MathNode.h
- nodes/COM_MapValueNode.cpp
- nodes/COM_MapValueNode.h
- nodes/COM_MapRangeNode.cpp
- nodes/COM_MapRangeNode.h
operations/COM_NormalizeOperation.cpp
operations/COM_NormalizeOperation.h
@@ -282,56 +277,56 @@ set(SRC
operations/COM_VectorBlurOperation.cpp
operations/COM_VectorBlurOperation.h
- nodes/COM_FilterNode.cpp
- nodes/COM_FilterNode.h
- nodes/COM_DespeckleNode.cpp
- nodes/COM_DespeckleNode.h
- nodes/COM_DilateErodeNode.cpp
- nodes/COM_DilateErodeNode.h
- nodes/COM_InpaintNode.cpp
- nodes/COM_InpaintNode.h
nodes/COM_BlurNode.cpp
nodes/COM_BlurNode.h
nodes/COM_BokehBlurNode.cpp
nodes/COM_BokehBlurNode.h
+ nodes/COM_DespeckleNode.cpp
+ nodes/COM_DespeckleNode.h
+ nodes/COM_DilateErodeNode.cpp
+ nodes/COM_DilateErodeNode.h
nodes/COM_DirectionalBlurNode.cpp
nodes/COM_DirectionalBlurNode.h
+ nodes/COM_FilterNode.cpp
+ nodes/COM_FilterNode.h
+ nodes/COM_InpaintNode.cpp
+ nodes/COM_InpaintNode.h
+ operations/COM_BlurBaseOperation.cpp
+ operations/COM_BlurBaseOperation.h
+ operations/COM_BokehBlurOperation.cpp
+ operations/COM_BokehBlurOperation.h
+ operations/COM_DirectionalBlurOperation.cpp
+ operations/COM_DirectionalBlurOperation.h
+ operations/COM_FastGaussianBlurOperation.cpp
+ operations/COM_FastGaussianBlurOperation.h
+ operations/COM_GammaCorrectOperation.cpp
+ operations/COM_GammaCorrectOperation.h
operations/COM_GaussianAlphaXBlurOperation.cpp
operations/COM_GaussianAlphaXBlurOperation.h
operations/COM_GaussianAlphaYBlurOperation.cpp
operations/COM_GaussianAlphaYBlurOperation.h
+ operations/COM_GaussianBokehBlurOperation.cpp
+ operations/COM_GaussianBokehBlurOperation.h
operations/COM_GaussianXBlurOperation.cpp
operations/COM_GaussianXBlurOperation.h
operations/COM_GaussianYBlurOperation.cpp
operations/COM_GaussianYBlurOperation.h
- operations/COM_GaussianBokehBlurOperation.cpp
- operations/COM_GaussianBokehBlurOperation.h
- operations/COM_BokehBlurOperation.cpp
- operations/COM_BokehBlurOperation.h
- operations/COM_VariableSizeBokehBlurOperation.cpp
- operations/COM_VariableSizeBokehBlurOperation.h
- operations/COM_FastGaussianBlurOperation.cpp
- operations/COM_FastGaussianBlurOperation.h
- operations/COM_BlurBaseOperation.cpp
- operations/COM_BlurBaseOperation.h
- operations/COM_DirectionalBlurOperation.cpp
- operations/COM_DirectionalBlurOperation.h
operations/COM_MovieClipAttributeOperation.cpp
operations/COM_MovieClipAttributeOperation.h
operations/COM_MovieDistortionOperation.cpp
operations/COM_MovieDistortionOperation.h
- operations/COM_GammaCorrectOperation.h
- operations/COM_GammaCorrectOperation.cpp
+ operations/COM_VariableSizeBokehBlurOperation.cpp
+ operations/COM_VariableSizeBokehBlurOperation.h
# Matte nodes
nodes/COM_BoxMaskNode.cpp
nodes/COM_BoxMaskNode.h
- nodes/COM_EllipseMaskNode.cpp
- nodes/COM_EllipseMaskNode.h
nodes/COM_ColorSpillNode.cpp
nodes/COM_ColorSpillNode.h
nodes/COM_DoubleEdgeMaskNode.cpp
nodes/COM_DoubleEdgeMaskNode.h
+ nodes/COM_EllipseMaskNode.cpp
+ nodes/COM_EllipseMaskNode.h
operations/COM_DoubleEdgeMaskOperation.cpp
operations/COM_DoubleEdgeMaskOperation.h
@@ -349,193 +344,193 @@ set(SRC
nodes/COM_KeyingNode.cpp
nodes/COM_KeyingNode.h
- operations/COM_KeyingOperation.cpp
- operations/COM_KeyingOperation.h
operations/COM_KeyingBlurOperation.cpp
operations/COM_KeyingBlurOperation.h
- operations/COM_KeyingDespillOperation.cpp
- operations/COM_KeyingDespillOperation.h
operations/COM_KeyingClipOperation.cpp
operations/COM_KeyingClipOperation.h
+ operations/COM_KeyingDespillOperation.cpp
+ operations/COM_KeyingDespillOperation.h
+ operations/COM_KeyingOperation.cpp
+ operations/COM_KeyingOperation.h
operations/COM_ColorSpillOperation.cpp
operations/COM_ColorSpillOperation.h
operations/COM_RenderLayersProg.cpp
operations/COM_RenderLayersProg.h
+ operations/COM_BokehImageOperation.cpp
+ operations/COM_BokehImageOperation.h
operations/COM_ImageOperation.cpp
operations/COM_ImageOperation.h
operations/COM_MultilayerImageOperation.cpp
operations/COM_MultilayerImageOperation.h
operations/COM_TextureOperation.cpp
operations/COM_TextureOperation.h
- operations/COM_BokehImageOperation.cpp
- operations/COM_BokehImageOperation.h
- operations/COM_SocketProxyOperation.h
operations/COM_SocketProxyOperation.cpp
+ operations/COM_SocketProxyOperation.h
- operations/COM_CompositorOperation.h
operations/COM_CompositorOperation.cpp
- operations/COM_OutputFileOperation.h
- operations/COM_OutputFileOperation.cpp
- operations/COM_OutputFileMultiViewOperation.h
+ operations/COM_CompositorOperation.h
+ operations/COM_ConvertDepthToRadiusOperation.cpp
+ operations/COM_ConvertDepthToRadiusOperation.h
operations/COM_OutputFileMultiViewOperation.cpp
- operations/COM_ViewerOperation.h
- operations/COM_ViewerOperation.cpp
- operations/COM_PreviewOperation.h
+ operations/COM_OutputFileMultiViewOperation.h
+ operations/COM_OutputFileOperation.cpp
+ operations/COM_OutputFileOperation.h
operations/COM_PreviewOperation.cpp
- operations/COM_SplitOperation.h
+ operations/COM_PreviewOperation.h
operations/COM_SplitOperation.cpp
- operations/COM_ConvertDepthToRadiusOperation.h
- operations/COM_ConvertDepthToRadiusOperation.cpp
+ operations/COM_SplitOperation.h
+ operations/COM_ViewerOperation.cpp
+ operations/COM_ViewerOperation.h
operations/COM_ZCombineOperation.cpp
operations/COM_ZCombineOperation.h
- operations/COM_ChangeHSVOperation.h
operations/COM_ChangeHSVOperation.cpp
- operations/COM_ColorCurveOperation.h
+ operations/COM_ChangeHSVOperation.h
+ operations/COM_ChannelMatteOperation.cpp
+ operations/COM_ChannelMatteOperation.h
+ operations/COM_ChromaMatteOperation.cpp
+ operations/COM_ChromaMatteOperation.h
operations/COM_ColorCurveOperation.cpp
- operations/COM_ColorRampOperation.h
+ operations/COM_ColorCurveOperation.h
+ operations/COM_ColorMatteOperation.cpp
+ operations/COM_ColorMatteOperation.h
operations/COM_ColorRampOperation.cpp
- operations/COM_VectorCurveOperation.h
- operations/COM_VectorCurveOperation.cpp
- operations/COM_CurveBaseOperation.h
+ operations/COM_ColorRampOperation.h
operations/COM_CurveBaseOperation.cpp
- operations/COM_HueSaturationValueCorrectOperation.cpp
- operations/COM_HueSaturationValueCorrectOperation.h
+ operations/COM_CurveBaseOperation.h
operations/COM_DifferenceMatteOperation.cpp
operations/COM_DifferenceMatteOperation.h
- operations/COM_LuminanceMatteOperation.cpp
- operations/COM_LuminanceMatteOperation.h
operations/COM_DistanceRGBMatteOperation.cpp
operations/COM_DistanceRGBMatteOperation.h
operations/COM_DistanceYCCMatteOperation.cpp
operations/COM_DistanceYCCMatteOperation.h
- operations/COM_ChromaMatteOperation.cpp
- operations/COM_ChromaMatteOperation.h
- operations/COM_ColorMatteOperation.cpp
- operations/COM_ColorMatteOperation.h
- operations/COM_ChannelMatteOperation.cpp
- operations/COM_ChannelMatteOperation.h
+ operations/COM_HueSaturationValueCorrectOperation.cpp
+ operations/COM_HueSaturationValueCorrectOperation.h
+ operations/COM_LuminanceMatteOperation.cpp
+ operations/COM_LuminanceMatteOperation.h
+ operations/COM_VectorCurveOperation.cpp
+ operations/COM_VectorCurveOperation.h
- operations/COM_ReadBufferOperation.cpp
- operations/COM_ReadBufferOperation.h
- operations/COM_WriteBufferOperation.cpp
- operations/COM_WriteBufferOperation.h
- operations/COM_MixOperation.h
- operations/COM_MixOperation.cpp
operations/COM_BrightnessOperation.cpp
operations/COM_BrightnessOperation.h
- operations/COM_GammaOperation.cpp
- operations/COM_GammaOperation.h
operations/COM_ColorCorrectionOperation.cpp
operations/COM_ColorCorrectionOperation.h
- operations/COM_SetValueOperation.h
- operations/COM_SetValueOperation.cpp
- operations/COM_SetColorOperation.h
+ operations/COM_GammaOperation.cpp
+ operations/COM_GammaOperation.h
+ operations/COM_MixOperation.cpp
+ operations/COM_MixOperation.h
+ operations/COM_ReadBufferOperation.cpp
+ operations/COM_ReadBufferOperation.h
operations/COM_SetColorOperation.cpp
- operations/COM_SetVectorOperation.h
+ operations/COM_SetColorOperation.h
+ operations/COM_SetValueOperation.cpp
+ operations/COM_SetValueOperation.h
operations/COM_SetVectorOperation.cpp
+ operations/COM_SetVectorOperation.h
+ operations/COM_WriteBufferOperation.cpp
+ operations/COM_WriteBufferOperation.h
- operations/COM_MathBaseOperation.h
operations/COM_MathBaseOperation.cpp
+ operations/COM_MathBaseOperation.h
- operations/COM_AlphaOverMixedOperation.h
+ operations/COM_AlphaOverKeyOperation.cpp
+ operations/COM_AlphaOverKeyOperation.h
operations/COM_AlphaOverMixedOperation.cpp
- operations/COM_AlphaOverPremultiplyOperation.h
+ operations/COM_AlphaOverMixedOperation.h
operations/COM_AlphaOverPremultiplyOperation.cpp
- operations/COM_AlphaOverKeyOperation.h
- operations/COM_AlphaOverKeyOperation.cpp
+ operations/COM_AlphaOverPremultiplyOperation.h
- operations/COM_ColorBalanceLGGOperation.h
- operations/COM_ColorBalanceLGGOperation.cpp
- operations/COM_ColorBalanceASCCDLOperation.h
operations/COM_ColorBalanceASCCDLOperation.cpp
+ operations/COM_ColorBalanceASCCDLOperation.h
+ operations/COM_ColorBalanceLGGOperation.cpp
+ operations/COM_ColorBalanceLGGOperation.h
operations/COM_InvertOperation.cpp
operations/COM_InvertOperation.h
- operations/COM_SetAlphaOperation.cpp
- operations/COM_SetAlphaOperation.h
- operations/COM_MapValueOperation.cpp
- operations/COM_MapValueOperation.h
operations/COM_MapRangeOperation.cpp
operations/COM_MapRangeOperation.h
+ operations/COM_MapValueOperation.cpp
+ operations/COM_MapValueOperation.h
+ operations/COM_SetAlphaOperation.cpp
+ operations/COM_SetAlphaOperation.h
# Distort operation
- operations/COM_TranslateOperation.h
- operations/COM_TranslateOperation.cpp
- operations/COM_WrapOperation.h
- operations/COM_WrapOperation.cpp
- operations/COM_RotateOperation.h
- operations/COM_RotateOperation.cpp
- operations/COM_ScaleOperation.h
- operations/COM_ScaleOperation.cpp
- operations/COM_MapUVOperation.h
- operations/COM_MapUVOperation.cpp
- operations/COM_DisplaceOperation.h
operations/COM_DisplaceOperation.cpp
- operations/COM_DisplaceSimpleOperation.h
+ operations/COM_DisplaceOperation.h
operations/COM_DisplaceSimpleOperation.cpp
- operations/COM_FlipOperation.h
+ operations/COM_DisplaceSimpleOperation.h
operations/COM_FlipOperation.cpp
- operations/COM_ProjectorLensDistortionOperation.cpp
- operations/COM_ProjectorLensDistortionOperation.h
- operations/COM_ScreenLensDistortionOperation.cpp
- operations/COM_ScreenLensDistortionOperation.h
+ operations/COM_FlipOperation.h
+ operations/COM_MapUVOperation.cpp
+ operations/COM_MapUVOperation.h
+ operations/COM_PlaneCornerPinOperation.cpp
+ operations/COM_PlaneCornerPinOperation.h
operations/COM_PlaneDistortCommonOperation.cpp
operations/COM_PlaneDistortCommonOperation.h
operations/COM_PlaneTrackOperation.cpp
operations/COM_PlaneTrackOperation.h
- operations/COM_PlaneCornerPinOperation.cpp
- operations/COM_PlaneCornerPinOperation.h
+ operations/COM_ProjectorLensDistortionOperation.cpp
+ operations/COM_ProjectorLensDistortionOperation.h
+ operations/COM_RotateOperation.cpp
+ operations/COM_RotateOperation.h
+ operations/COM_ScaleOperation.cpp
+ operations/COM_ScaleOperation.h
+ operations/COM_ScreenLensDistortionOperation.cpp
+ operations/COM_ScreenLensDistortionOperation.h
+ operations/COM_TranslateOperation.cpp
+ operations/COM_TranslateOperation.h
+ operations/COM_WrapOperation.cpp
+ operations/COM_WrapOperation.h
#Filter operations
- operations/COM_ConvolutionFilterOperation.h
- operations/COM_ConvolutionFilterOperation.cpp
- operations/COM_ConvolutionEdgeFilterOperation.h
operations/COM_ConvolutionEdgeFilterOperation.cpp
+ operations/COM_ConvolutionEdgeFilterOperation.h
+ operations/COM_ConvolutionFilterOperation.cpp
+ operations/COM_ConvolutionFilterOperation.h
operations/COM_DespeckleOperation.cpp
operations/COM_DespeckleOperation.h
operations/COM_DilateErodeOperation.cpp
operations/COM_DilateErodeOperation.h
- operations/COM_InpaintOperation.cpp
- operations/COM_InpaintOperation.h
- operations/COM_GlareThresholdOperation.cpp
- operations/COM_GlareThresholdOperation.h
operations/COM_GlareBaseOperation.cpp
operations/COM_GlareBaseOperation.h
+ operations/COM_GlareFogGlowOperation.cpp
+ operations/COM_GlareFogGlowOperation.h
+ operations/COM_GlareGhostOperation.cpp
+ operations/COM_GlareGhostOperation.h
operations/COM_GlareSimpleStarOperation.cpp
operations/COM_GlareSimpleStarOperation.h
operations/COM_GlareStreaksOperation.cpp
operations/COM_GlareStreaksOperation.h
- operations/COM_GlareGhostOperation.cpp
- operations/COM_GlareGhostOperation.h
- operations/COM_GlareFogGlowOperation.cpp
- operations/COM_GlareFogGlowOperation.h
+ operations/COM_GlareThresholdOperation.cpp
+ operations/COM_GlareThresholdOperation.h
+ operations/COM_InpaintOperation.cpp
+ operations/COM_InpaintOperation.h
operations/COM_SetSamplerOperation.cpp
operations/COM_SetSamplerOperation.h
#Convert operations
- operations/COM_IDMaskOperation.cpp
- operations/COM_IDMaskOperation.h
operations/COM_ConvertOperation.cpp
operations/COM_ConvertOperation.h
+ operations/COM_IDMaskOperation.cpp
+ operations/COM_IDMaskOperation.h
operations/COM_DotproductOperation.cpp
operations/COM_DotproductOperation.h
# Matte operation
- operations/COM_BoxMaskOperation.h
operations/COM_BoxMaskOperation.cpp
- operations/COM_EllipseMaskOperation.h
+ operations/COM_BoxMaskOperation.h
operations/COM_EllipseMaskOperation.cpp
+ operations/COM_EllipseMaskOperation.h
- operations/COM_MovieClipOperation.cpp
- operations/COM_MovieClipOperation.h
operations/COM_ConvertColorProfileOperation.cpp
operations/COM_ConvertColorProfileOperation.h
+ operations/COM_MovieClipOperation.cpp
+ operations/COM_MovieClipOperation.h
operations/COM_AntiAliasOperation.cpp
operations/COM_AntiAliasOperation.h
diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h
index b481b4ec100..d81560f6ede 100644
--- a/source/blender/compositor/COM_compositor.h
+++ b/source/blender/compositor/COM_compositor.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COMPOSITOR_H__
@@ -68,8 +64,6 @@ extern "C" {
* The main issue is the type of memory model to use. Blender is used by consumers and professionals.
* Ranging from low-end machines to very high-end machines.
* The system should work on high-end machines and on low-end machines.
- *
- *
* \page executing Executing
* \section prepare Prepare execution
*
diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h
index 34cbaf9db37..926b63de682 100644
--- a/source/blender/compositor/COM_defines.h
+++ b/source/blender/compositor/COM_defines.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DEFINES_H__
@@ -33,7 +29,7 @@ typedef enum DataType {
/** \brief Vector data type */
COM_DT_VECTOR = 2,
/** \brief Color data type */
- COM_DT_COLOR = 4
+ COM_DT_COLOR = 4,
} DataType;
/**
@@ -47,7 +43,7 @@ typedef enum CompositorQuality {
/** \brief Medium quality setting */
COM_QUALITY_MEDIUM = 1,
/** \brief Low quality setting */
- COM_QUALITY_LOW = 2
+ COM_QUALITY_LOW = 2,
} CompositorQuality;
/**
@@ -60,7 +56,7 @@ typedef enum CompositorPriority {
/** \brief Medium quality setting */
COM_PRIORITY_MEDIUM = 1,
/** \brief Low quality setting */
- COM_PRIORITY_LOW = 0
+ COM_PRIORITY_LOW = 0,
} CompositorPriority;
// configurable items
@@ -98,7 +94,7 @@ typedef enum OrderOfChunks {
/** \brief no ordering */
COM_TO_TOP_DOWN = 2,
/** \brief experimental ordering with 9 hotspots */
- COM_TO_RULE_OF_THIRDS = 3
+ COM_TO_RULE_OF_THIRDS = 3,
} OrderOfChunks;
#define COM_ORDER_OF_CHUNKS_DEFAULT COM_TO_CENTER_OUT
diff --git a/source/blender/compositor/intern/COM_CPUDevice.cpp b/source/blender/compositor/intern/COM_CPUDevice.cpp
index 5a4f68bb9b8..102a882876b 100644
--- a/source/blender/compositor/intern/COM_CPUDevice.cpp
+++ b/source/blender/compositor/intern/COM_CPUDevice.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_CPUDevice.h"
diff --git a/source/blender/compositor/intern/COM_CPUDevice.h b/source/blender/compositor/intern/COM_CPUDevice.h
index d3b63f0d079..36016a44252 100644
--- a/source/blender/compositor/intern/COM_CPUDevice.h
+++ b/source/blender/compositor/intern/COM_CPUDevice.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CPUDEVICE_H__
diff --git a/source/blender/compositor/intern/COM_ChunkOrder.cpp b/source/blender/compositor/intern/COM_ChunkOrder.cpp
index f7e24b98800..f26a8af1f5c 100644
--- a/source/blender/compositor/intern/COM_ChunkOrder.cpp
+++ b/source/blender/compositor/intern/COM_ChunkOrder.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ChunkOrder.h"
diff --git a/source/blender/compositor/intern/COM_ChunkOrder.h b/source/blender/compositor/intern/COM_ChunkOrder.h
index 68099ea9516..52c0e0a800a 100644
--- a/source/blender/compositor/intern/COM_ChunkOrder.h
+++ b/source/blender/compositor/intern/COM_ChunkOrder.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CHUNKORDER_H__
diff --git a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
index 2a4c410c647..cf299e8370b 100644
--- a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
+++ b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ChunkOrderHotspot.h"
diff --git a/source/blender/compositor/intern/COM_ChunkOrderHotspot.h b/source/blender/compositor/intern/COM_ChunkOrderHotspot.h
index 7fa21a6c3ac..2b6b646310b 100644
--- a/source/blender/compositor/intern/COM_ChunkOrderHotspot.h
+++ b/source/blender/compositor/intern/COM_ChunkOrderHotspot.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CHUNKORDERHOTSPOT_H__
diff --git a/source/blender/compositor/intern/COM_CompositorContext.cpp b/source/blender/compositor/intern/COM_CompositorContext.cpp
index dde0cf892dc..0715436bf51 100644
--- a/source/blender/compositor/intern/COM_CompositorContext.cpp
+++ b/source/blender/compositor/intern/COM_CompositorContext.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_CompositorContext.h"
diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h
index e084d23f45e..e36dd5ac2aa 100644
--- a/source/blender/compositor/intern/COM_CompositorContext.h
+++ b/source/blender/compositor/intern/COM_CompositorContext.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COMPOSITORCONTEXT_H__
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index cd5f6977feb..c97105da385 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include <string.h>
diff --git a/source/blender/compositor/intern/COM_Converter.h b/source/blender/compositor/intern/COM_Converter.h
index 642f51ee7e5..512bd10f29f 100644
--- a/source/blender/compositor/intern/COM_Converter.h
+++ b/source/blender/compositor/intern/COM_Converter.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CONVERTER_H__
diff --git a/source/blender/compositor/intern/COM_Debug.cpp b/source/blender/compositor/intern/COM_Debug.cpp
index e97ac606118..59acdad000c 100644
--- a/source/blender/compositor/intern/COM_Debug.cpp
+++ b/source/blender/compositor/intern/COM_Debug.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2013, Blender Foundation.
*/
#include "COM_Debug.h"
diff --git a/source/blender/compositor/intern/COM_Debug.h b/source/blender/compositor/intern/COM_Debug.h
index 2afea7c3228..955bcf120cc 100644
--- a/source/blender/compositor/intern/COM_Debug.h
+++ b/source/blender/compositor/intern/COM_Debug.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2013, Blender Foundation.
*/
#ifndef __COM_DEBUG_H__
diff --git a/source/blender/compositor/intern/COM_Device.cpp b/source/blender/compositor/intern/COM_Device.cpp
index 49e729b4cb9..38a22369005 100644
--- a/source/blender/compositor/intern/COM_Device.cpp
+++ b/source/blender/compositor/intern/COM_Device.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_Device.h"
diff --git a/source/blender/compositor/intern/COM_Device.h b/source/blender/compositor/intern/COM_Device.h
index abd0dfa5749..6767a475c82 100644
--- a/source/blender/compositor/intern/COM_Device.h
+++ b/source/blender/compositor/intern/COM_Device.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DEVICE_H__
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index 680e3cac5f7..f636a211ff6 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include <algorithm>
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h
index 8f170aab2fb..c7a371b226a 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.h
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_EXECUTIONGROUP_H__
@@ -54,7 +50,7 @@ typedef enum ChunkExecutionState {
/**
* \brief chunk is executed.
*/
- COM_ES_EXECUTED = 2
+ COM_ES_EXECUTED = 2,
} ChunkExecutionState;
/**
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 85e07850c0a..67e69129246 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ExecutionSystem.h"
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h
index 13e393a4236..476dd3ccc06 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.h
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
class ExecutionGroup;
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index 43c8e7b2aa1..5f3cf83d4b2 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MemoryBuffer.h"
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h
index 17ee17316fb..9f3928cd863 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.h
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
class MemoryBuffer;
@@ -44,7 +40,7 @@ typedef enum MemoryBufferState {
/** \brief memory is available for use, content has been created */
COM_MB_AVAILABLE = 2,
/** \brief chunk is consolidated from other chunks. special state.*/
- COM_MB_TEMPORARILY = 6
+ COM_MB_TEMPORARILY = 6,
} MemoryBufferState;
typedef enum MemoryBufferExtend {
diff --git a/source/blender/compositor/intern/COM_MemoryProxy.cpp b/source/blender/compositor/intern/COM_MemoryProxy.cpp
index ac71c14368a..ab8df14de56 100644
--- a/source/blender/compositor/intern/COM_MemoryProxy.cpp
+++ b/source/blender/compositor/intern/COM_MemoryProxy.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MemoryProxy.h"
diff --git a/source/blender/compositor/intern/COM_MemoryProxy.h b/source/blender/compositor/intern/COM_MemoryProxy.h
index 7da7f871036..6f911a92f42 100644
--- a/source/blender/compositor/intern/COM_MemoryProxy.h
+++ b/source/blender/compositor/intern/COM_MemoryProxy.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
class MemoryProxy;
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index cc23b7dce47..5435c0475c8 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include <string.h>
diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h
index ab70bd6e617..33c86bd2cc1 100644
--- a/source/blender/compositor/intern/COM_Node.h
+++ b/source/blender/compositor/intern/COM_Node.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_NODE_H__
diff --git a/source/blender/compositor/intern/COM_NodeConverter.cpp b/source/blender/compositor/intern/COM_NodeConverter.cpp
index 997c9cbe8f1..c775a9ed49f 100644
--- a/source/blender/compositor/intern/COM_NodeConverter.cpp
+++ b/source/blender/compositor/intern/COM_NodeConverter.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2013, Blender Foundation.
*/
extern "C" {
diff --git a/source/blender/compositor/intern/COM_NodeConverter.h b/source/blender/compositor/intern/COM_NodeConverter.h
index 34e9dcd5abc..c3d9a115435 100644
--- a/source/blender/compositor/intern/COM_NodeConverter.h
+++ b/source/blender/compositor/intern/COM_NodeConverter.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2013, Blender Foundation.
*/
#ifndef __COM_NODECONVERTER_H__
diff --git a/source/blender/compositor/intern/COM_NodeGraph.cpp b/source/blender/compositor/intern/COM_NodeGraph.cpp
index a1959fdecc5..ba0d225fdd7 100644
--- a/source/blender/compositor/intern/COM_NodeGraph.cpp
+++ b/source/blender/compositor/intern/COM_NodeGraph.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2013, Blender Foundation.
*/
#include <cstring>
diff --git a/source/blender/compositor/intern/COM_NodeGraph.h b/source/blender/compositor/intern/COM_NodeGraph.h
index 9df786bdf77..a2da8fec911 100644
--- a/source/blender/compositor/intern/COM_NodeGraph.h
+++ b/source/blender/compositor/intern/COM_NodeGraph.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2013, Blender Foundation.
*/
#ifndef __COM_NODEGRAPH_H__
diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp
index ff880ba3cdb..9f569307581 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include <typeinfo>
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index ad9842caa74..9296b1bfd22 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_NODEOPERATION_H__
@@ -68,7 +64,7 @@ typedef enum InputResizeMode {
/** \brief Fit the width or the height of the input image to the width or height of the working area of the node, image will be larger than the working area */
COM_SC_FIT = NS_CR_FIT,
/** \brief Fit the width and the height of the input image to the width and height of the working area of the node, image will be equally larger than the working area */
- COM_SC_STRETCH = NS_CR_STRETCH
+ COM_SC_STRETCH = NS_CR_STRETCH,
} InputResizeMode;
/**
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
index 65e17d57925..37a1d7c005f 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2013, Blender Foundation.
*/
extern "C" {
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.h b/source/blender/compositor/intern/COM_NodeOperationBuilder.h
index 85cafc508fd..f4ab18b4f31 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.h
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2013, Blender Foundation.
*/
#ifndef __COM_NODEOPERATIONBUILDER_H__
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
index 90711e6583a..fd74c7ebfa4 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_OpenCLDevice.h"
@@ -26,15 +22,15 @@
typedef enum COM_VendorID {NVIDIA = 0x10DE, AMD = 0x1002} COM_VendorID;
const cl_image_format IMAGE_FORMAT_COLOR = {
CL_RGBA,
- CL_FLOAT
+ CL_FLOAT,
};
const cl_image_format IMAGE_FORMAT_VECTOR = {
CL_RGB,
- CL_FLOAT
+ CL_FLOAT,
};
const cl_image_format IMAGE_FORMAT_VALUE = {
CL_R,
- CL_FLOAT
+ CL_FLOAT,
};
OpenCLDevice::OpenCLDevice(cl_context context, cl_device_id device, cl_program program, cl_int vendorId)
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h
index 940ed233ecc..8cd0c31e658 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.h
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
class OpenCLDevice;
diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp
index bf726e154e0..10d9929d2cc 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp
+++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SingleThreadedOperation.h"
diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.h b/source/blender/compositor/intern/COM_SingleThreadedOperation.h
index f5b6565c07e..bafd092a5b1 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedOperation.h
+++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SINGLETHREADEDOPERATION_H__
diff --git a/source/blender/compositor/intern/COM_SocketReader.cpp b/source/blender/compositor/intern/COM_SocketReader.cpp
index 079e93cf52b..93c8a143b86 100644
--- a/source/blender/compositor/intern/COM_SocketReader.cpp
+++ b/source/blender/compositor/intern/COM_SocketReader.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SocketReader.h"
diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h
index ec1c200fd81..dfab1084dae 100644
--- a/source/blender/compositor/intern/COM_SocketReader.h
+++ b/source/blender/compositor/intern/COM_SocketReader.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SOCKETREADER_H__
@@ -32,7 +28,7 @@
typedef enum PixelSampler {
COM_PS_NEAREST = 0,
COM_PS_BILINEAR = 1,
- COM_PS_BICUBIC = 2
+ COM_PS_BICUBIC = 2,
} PixelSampler;
class MemoryBuffer;
diff --git a/source/blender/compositor/intern/COM_WorkPackage.cpp b/source/blender/compositor/intern/COM_WorkPackage.cpp
index 1d0f952274a..9612ba01e2a 100644
--- a/source/blender/compositor/intern/COM_WorkPackage.cpp
+++ b/source/blender/compositor/intern/COM_WorkPackage.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_WorkPackage.h"
diff --git a/source/blender/compositor/intern/COM_WorkPackage.h b/source/blender/compositor/intern/COM_WorkPackage.h
index 0cfabcae4f2..fc2a4167952 100644
--- a/source/blender/compositor/intern/COM_WorkPackage.h
+++ b/source/blender/compositor/intern/COM_WorkPackage.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
class WorkPackage;
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index 75f5ab50014..d5efe849f1b 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include <list>
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.h b/source/blender/compositor/intern/COM_WorkScheduler.h
index 6927127b63d..adac501148e 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.h
+++ b/source/blender/compositor/intern/COM_WorkScheduler.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_WORKSCHEDULER_H__
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp
index 0c92608379d..04fb550cf4b 100644
--- a/source/blender/compositor/intern/COM_compositor.cpp
+++ b/source/blender/compositor/intern/COM_compositor.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
index f6d81a6e473..ba370e38fa6 100644
--- a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
+++ b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_AlphaOverNode.h"
diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.h b/source/blender/compositor/nodes/COM_AlphaOverNode.h
index 86287c42f3f..b064d257c81 100644
--- a/source/blender/compositor/nodes/COM_AlphaOverNode.h
+++ b/source/blender/compositor/nodes/COM_AlphaOverNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ALPHAOVERNODE_H__
diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp
index 75b73ba09a8..6a73b043b0e 100644
--- a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BilateralBlurNode.h"
diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.h b/source/blender/compositor/nodes/COM_BilateralBlurNode.h
index dc3732d4362..6d0120780e1 100644
--- a/source/blender/compositor/nodes/COM_BilateralBlurNode.h
+++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BILATERALBLURNODE_H__
diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp
index b5d509a2db2..92ab468c5c8 100644
--- a/source/blender/compositor/nodes/COM_BlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BlurNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BlurNode.h"
diff --git a/source/blender/compositor/nodes/COM_BlurNode.h b/source/blender/compositor/nodes/COM_BlurNode.h
index 800380ec2c1..a8931f42b42 100644
--- a/source/blender/compositor/nodes/COM_BlurNode.h
+++ b/source/blender/compositor/nodes/COM_BlurNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BLURNODE_H__
diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
index 77e66bb57a5..c20ca9181d1 100644
--- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BokehBlurNode.h"
diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.h b/source/blender/compositor/nodes/COM_BokehBlurNode.h
index 7e82a3209a7..0edb48accf0 100644
--- a/source/blender/compositor/nodes/COM_BokehBlurNode.h
+++ b/source/blender/compositor/nodes/COM_BokehBlurNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BOKEHBLURNODE_H__
diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.cpp b/source/blender/compositor/nodes/COM_BokehImageNode.cpp
index 957cb368cb0..f8527144cc1 100644
--- a/source/blender/compositor/nodes/COM_BokehImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_BokehImageNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BokehImageNode.h"
diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.h b/source/blender/compositor/nodes/COM_BokehImageNode.h
index 6e677e8e757..d84a31a1bc2 100644
--- a/source/blender/compositor/nodes/COM_BokehImageNode.h
+++ b/source/blender/compositor/nodes/COM_BokehImageNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BOKEHIMAGENODE_H__
diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp
index 0b00e62e77d..a161440cba4 100644
--- a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BoxMaskNode.h"
diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.h b/source/blender/compositor/nodes/COM_BoxMaskNode.h
index c4e91222fac..4ba0aac98b6 100644
--- a/source/blender/compositor/nodes/COM_BoxMaskNode.h
+++ b/source/blender/compositor/nodes/COM_BoxMaskNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BOXMASKNODE_H__
diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.cpp b/source/blender/compositor/nodes/COM_BrightnessNode.cpp
index fa2fbb85885..26e6106051a 100644
--- a/source/blender/compositor/nodes/COM_BrightnessNode.cpp
+++ b/source/blender/compositor/nodes/COM_BrightnessNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BrightnessNode.h"
diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.h b/source/blender/compositor/nodes/COM_BrightnessNode.h
index 5e8cf7d10b8..787c735ac7a 100644
--- a/source/blender/compositor/nodes/COM_BrightnessNode.h
+++ b/source/blender/compositor/nodes/COM_BrightnessNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BRIGHTNESSNODE_H__
diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
index 6cf6ff3a739..e7e575b3276 100644
--- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_ChannelMatteNode.h"
diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.h b/source/blender/compositor/nodes/COM_ChannelMatteNode.h
index f26e7f073ff..94d01e40a72 100644
--- a/source/blender/compositor/nodes/COM_ChannelMatteNode.h
+++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_CHANNELMATTENODE_H__
diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
index 80d7614f1d2..5d758628a24 100644
--- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ChromaMatteNode.h"
diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.h b/source/blender/compositor/nodes/COM_ChromaMatteNode.h
index 4b2c2c93308..b86b1aa734c 100644
--- a/source/blender/compositor/nodes/COM_ChromaMatteNode.h
+++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CHROMAMATTENODE_H__
diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
index ae0f0600533..4fab93c07a1 100644
--- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorBalanceNode.h"
diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.h b/source/blender/compositor/nodes/COM_ColorBalanceNode.h
index b1023e4df7b..a5e48ed8e0f 100644
--- a/source/blender/compositor/nodes/COM_ColorBalanceNode.h
+++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORBALANCENODE_H__
diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp
index d5ecf7094b7..6881a047fc5 100644
--- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorCorrectionNode.h"
diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h
index f55fc2b6c85..9f3f1e3a84e 100644
--- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h
+++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORCORRECTIONNODE_H__
diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.cpp b/source/blender/compositor/nodes/COM_ColorCurveNode.cpp
index 96c22be924a..1e77f254c8e 100644
--- a/source/blender/compositor/nodes/COM_ColorCurveNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorCurveNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorCurveNode.h"
diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.h b/source/blender/compositor/nodes/COM_ColorCurveNode.h
index 71f3b3e2e88..fcf3c56698e 100644
--- a/source/blender/compositor/nodes/COM_ColorCurveNode.h
+++ b/source/blender/compositor/nodes/COM_ColorCurveNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORCURVENODE_H__
diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
index 85cd58c7831..e9b9280f5d7 100644
--- a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorMatteNode.h"
diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.h b/source/blender/compositor/nodes/COM_ColorMatteNode.h
index 25d8ef92003..39f142f5fe8 100644
--- a/source/blender/compositor/nodes/COM_ColorMatteNode.h
+++ b/source/blender/compositor/nodes/COM_ColorMatteNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORMATTENODE_H__
diff --git a/source/blender/compositor/nodes/COM_ColorNode.cpp b/source/blender/compositor/nodes/COM_ColorNode.cpp
index 2d4e1eb7e3e..45909515101 100644
--- a/source/blender/compositor/nodes/COM_ColorNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorNode.h"
diff --git a/source/blender/compositor/nodes/COM_ColorNode.h b/source/blender/compositor/nodes/COM_ColorNode.h
index f3599f0a209..d10a150cbf0 100644
--- a/source/blender/compositor/nodes/COM_ColorNode.h
+++ b/source/blender/compositor/nodes/COM_ColorNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORNODE_H__
diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.cpp b/source/blender/compositor/nodes/COM_ColorRampNode.cpp
index f47f1715724..3f9b7095103 100644
--- a/source/blender/compositor/nodes/COM_ColorRampNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorRampNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorRampNode.h"
diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.h b/source/blender/compositor/nodes/COM_ColorRampNode.h
index 84248e6eb40..fe4af608f2c 100644
--- a/source/blender/compositor/nodes/COM_ColorRampNode.h
+++ b/source/blender/compositor/nodes/COM_ColorRampNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORRAMPNODE_H__
diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp
index c282e14aa86..7253c5b4ca5 100644
--- a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorSpillNode.h"
diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.h b/source/blender/compositor/nodes/COM_ColorSpillNode.h
index ba1b3018919..fee2d8fa9e3 100644
--- a/source/blender/compositor/nodes/COM_ColorSpillNode.h
+++ b/source/blender/compositor/nodes/COM_ColorSpillNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORSPILLNODE_H__
diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
index 2be951b92f0..371a4085481 100644
--- a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorToBWNode.h"
diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.h b/source/blender/compositor/nodes/COM_ColorToBWNode.h
index 496398382c4..179dda5092f 100644
--- a/source/blender/compositor/nodes/COM_ColorToBWNode.h
+++ b/source/blender/compositor/nodes/COM_ColorToBWNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORTOBWNODE_H__
diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.cpp b/source/blender/compositor/nodes/COM_CombineColorNode.cpp
index ec5ae64ebd7..4c5cdbc2d9c 100644
--- a/source/blender/compositor/nodes/COM_CombineColorNode.cpp
+++ b/source/blender/compositor/nodes/COM_CombineColorNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Toenne
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_CombineColorNode.h"
diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.h b/source/blender/compositor/nodes/COM_CombineColorNode.h
index 8c1196f2868..870a13b7492 100644
--- a/source/blender/compositor/nodes/COM_CombineColorNode.h
+++ b/source/blender/compositor/nodes/COM_CombineColorNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Toenne
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COMBINECOLORNODE_H__
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp
index f6a3b62b62b..e0a6dc4aaeb 100644
--- a/source/blender/compositor/nodes/COM_CompositorNode.cpp
+++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_CompositorNode.h"
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.h b/source/blender/compositor/nodes/COM_CompositorNode.h
index 22d19b05721..a3a28903405 100644
--- a/source/blender/compositor/nodes/COM_CompositorNode.h
+++ b/source/blender/compositor/nodes/COM_CompositorNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COMPOSITORNODE_H__
diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
index 27bd613a4e9..30856814d5f 100644
--- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
+++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_ConvertAlphaNode.h"
diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h
index 8201a490eac..0de34e1ae88 100644
--- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h
+++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_CONVERTALPHANODE_H__
diff --git a/source/blender/compositor/nodes/COM_CornerPinNode.cpp b/source/blender/compositor/nodes/COM_CornerPinNode.cpp
index 27c2e7fd557..3eefd53e3e8 100644
--- a/source/blender/compositor/nodes/COM_CornerPinNode.cpp
+++ b/source/blender/compositor/nodes/COM_CornerPinNode.cpp
@@ -1,7 +1,4 @@
-/*
- * Copyright 2014, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
+/* 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.
@@ -15,8 +12,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2014, Blender Foundation.
*/
#include "COM_CornerPinNode.h"
diff --git a/source/blender/compositor/nodes/COM_CornerPinNode.h b/source/blender/compositor/nodes/COM_CornerPinNode.h
index 7cf2956a05c..de7b98c598f 100644
--- a/source/blender/compositor/nodes/COM_CornerPinNode.h
+++ b/source/blender/compositor/nodes/COM_CornerPinNode.h
@@ -1,7 +1,4 @@
-/*
- * Copyright 2014, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
+/* 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.
@@ -15,8 +12,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2014, Blender Foundation.
*/
#ifndef __COM_CORNERPINNODE_H__
diff --git a/source/blender/compositor/nodes/COM_CropNode.cpp b/source/blender/compositor/nodes/COM_CropNode.cpp
index 99e77ff0dbe..a7b4090463b 100644
--- a/source/blender/compositor/nodes/COM_CropNode.cpp
+++ b/source/blender/compositor/nodes/COM_CropNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_CropNode.h"
diff --git a/source/blender/compositor/nodes/COM_CropNode.h b/source/blender/compositor/nodes/COM_CropNode.h
index 1247f76f7c7..9e24fc492bc 100644
--- a/source/blender/compositor/nodes/COM_CropNode.h
+++ b/source/blender/compositor/nodes/COM_CropNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CROPNODE_H__
diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp
index 648ea4556ad..ad15911062c 100644
--- a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2018, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Stockner
- * Stefan Werner
+ * Copyright 2018, Blender Foundation.
*/
#include "COM_CryptomatteNode.h"
diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.h b/source/blender/compositor/nodes/COM_CryptomatteNode.h
index f1e446dee20..3a4aa3b94d0 100644
--- a/source/blender/compositor/nodes/COM_CryptomatteNode.h
+++ b/source/blender/compositor/nodes/COM_CryptomatteNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2018, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Stockner
+ * Copyright 2018, Blender Foundation.
*/
#ifndef __COM_CRYPTOMATTENODE_H__
diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cpp b/source/blender/compositor/nodes/COM_DefocusNode.cpp
index f5ff37d41ba..371921ff345 100644
--- a/source/blender/compositor/nodes/COM_DefocusNode.cpp
+++ b/source/blender/compositor/nodes/COM_DefocusNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DefocusNode.h"
diff --git a/source/blender/compositor/nodes/COM_DefocusNode.h b/source/blender/compositor/nodes/COM_DefocusNode.h
index 15843a4ed0b..201cbdac2dc 100644
--- a/source/blender/compositor/nodes/COM_DefocusNode.h
+++ b/source/blender/compositor/nodes/COM_DefocusNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DEFOCUSNODE_H__
diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.cpp b/source/blender/compositor/nodes/COM_DespeckleNode.cpp
index d211050389e..255fc996032 100644
--- a/source/blender/compositor/nodes/COM_DespeckleNode.cpp
+++ b/source/blender/compositor/nodes/COM_DespeckleNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,7 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor: Campbell Barton
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DespeckleNode.h"
diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.h b/source/blender/compositor/nodes/COM_DespeckleNode.h
index 7c91ef2d384..f5071417587 100644
--- a/source/blender/compositor/nodes/COM_DespeckleNode.h
+++ b/source/blender/compositor/nodes/COM_DespeckleNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,7 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor: Campbell Barton
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DESPECKLENODE_H__
diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
index 68bd7df9dbc..0e104b69da7 100644
--- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DifferenceMatteNode.h"
diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h
index 79f1efd9632..ea44a4f86a2 100644
--- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h
+++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DIFFERENCEMATTENODE_H__
diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
index 50ffd16e58c..bab54993eaf 100644
--- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
+++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DilateErodeNode.h"
diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.h b/source/blender/compositor/nodes/COM_DilateErodeNode.h
index c2ebc31eab9..565680c0c86 100644
--- a/source/blender/compositor/nodes/COM_DilateErodeNode.h
+++ b/source/blender/compositor/nodes/COM_DilateErodeNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DILATEERODENODE_H__
diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
index c1c17bdeec6..7e627ac8d41 100644
--- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DirectionalBlurNode.h"
diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h
index cecf8dc880f..63a27aefc4e 100644
--- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h
+++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DIRECTIONALBLURNODE_H__
diff --git a/source/blender/compositor/nodes/COM_DisplaceNode.cpp b/source/blender/compositor/nodes/COM_DisplaceNode.cpp
index 4d8b88d4075..afd3280d44a 100644
--- a/source/blender/compositor/nodes/COM_DisplaceNode.cpp
+++ b/source/blender/compositor/nodes/COM_DisplaceNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DisplaceNode.h"
diff --git a/source/blender/compositor/nodes/COM_DisplaceNode.h b/source/blender/compositor/nodes/COM_DisplaceNode.h
index 305959c9bbc..b162d76209f 100644
--- a/source/blender/compositor/nodes/COM_DisplaceNode.h
+++ b/source/blender/compositor/nodes/COM_DisplaceNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DISPLACENODE_H__
diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
index 306bddcf352..3c1e73da148 100644
--- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DistanceMatteNode.h"
diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.h b/source/blender/compositor/nodes/COM_DistanceMatteNode.h
index 34e7312d519..84a525c58a7 100644
--- a/source/blender/compositor/nodes/COM_DistanceMatteNode.h
+++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DISTANCEMATTENODE_H__
diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp
index 3dc090df28c..9ed9b532bdc 100644
--- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DoubleEdgeMaskNode.h"
diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h
index 156483f9b87..45a10492ba2 100644
--- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h
+++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DOUBLEEDGEMASKNODE_H__
diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp
index 11105f06770..d44ac848864 100644
--- a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_EllipseMaskNode.h"
diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.h b/source/blender/compositor/nodes/COM_EllipseMaskNode.h
index 10d4ba2895a..c4cef996137 100644
--- a/source/blender/compositor/nodes/COM_EllipseMaskNode.h
+++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ELLIPSEMASKNODE_H__
diff --git a/source/blender/compositor/nodes/COM_FilterNode.cpp b/source/blender/compositor/nodes/COM_FilterNode.cpp
index cc201b83a82..14a2bb4fe38 100644
--- a/source/blender/compositor/nodes/COM_FilterNode.cpp
+++ b/source/blender/compositor/nodes/COM_FilterNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_FilterNode.h"
diff --git a/source/blender/compositor/nodes/COM_FilterNode.h b/source/blender/compositor/nodes/COM_FilterNode.h
index 90148211dd3..b1aa0099fbc 100644
--- a/source/blender/compositor/nodes/COM_FilterNode.h
+++ b/source/blender/compositor/nodes/COM_FilterNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_FILTERNODE_H__
diff --git a/source/blender/compositor/nodes/COM_FlipNode.cpp b/source/blender/compositor/nodes/COM_FlipNode.cpp
index b895ab57acb..16473c6586d 100644
--- a/source/blender/compositor/nodes/COM_FlipNode.cpp
+++ b/source/blender/compositor/nodes/COM_FlipNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_FlipNode.h"
diff --git a/source/blender/compositor/nodes/COM_FlipNode.h b/source/blender/compositor/nodes/COM_FlipNode.h
index 316deb8539d..a62482ab7fd 100644
--- a/source/blender/compositor/nodes/COM_FlipNode.h
+++ b/source/blender/compositor/nodes/COM_FlipNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_FLIPNODE_H__
diff --git a/source/blender/compositor/nodes/COM_GammaNode.cpp b/source/blender/compositor/nodes/COM_GammaNode.cpp
index f05754a8422..9ba9a305a3d 100644
--- a/source/blender/compositor/nodes/COM_GammaNode.cpp
+++ b/source/blender/compositor/nodes/COM_GammaNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GammaNode.h"
diff --git a/source/blender/compositor/nodes/COM_GammaNode.h b/source/blender/compositor/nodes/COM_GammaNode.h
index 57a5ef174be..a54623e1b94 100644
--- a/source/blender/compositor/nodes/COM_GammaNode.h
+++ b/source/blender/compositor/nodes/COM_GammaNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GAMMANODE_H__
diff --git a/source/blender/compositor/nodes/COM_GlareNode.cpp b/source/blender/compositor/nodes/COM_GlareNode.cpp
index 9f92478fe39..73e3f6b82c8 100644
--- a/source/blender/compositor/nodes/COM_GlareNode.cpp
+++ b/source/blender/compositor/nodes/COM_GlareNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GlareNode.h"
diff --git a/source/blender/compositor/nodes/COM_GlareNode.h b/source/blender/compositor/nodes/COM_GlareNode.h
index 82ee373cb95..f67a418c8b6 100644
--- a/source/blender/compositor/nodes/COM_GlareNode.h
+++ b/source/blender/compositor/nodes/COM_GlareNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GLARENODE_H__
diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp
index 08ccb2b47d7..b0f87c27d8d 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_HueSaturationValueCorrectNode.h"
diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h
index 3c94b8f7dc3..73be77bbce6 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_HUESATURATIONVALUECORRECTNODE_H__
diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
index a1331f61eb3..33415978818 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_HueSaturationValueNode.h"
diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h
index 78dcc6a8554..3b4231115be 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_HUESATURATIONVALUENODE_H__
diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.cpp b/source/blender/compositor/nodes/COM_IDMaskNode.cpp
index 6a50346b1b3..cac65aacf53 100644
--- a/source/blender/compositor/nodes/COM_IDMaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_IDMaskNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_IDMaskNode.h"
diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.h b/source/blender/compositor/nodes/COM_IDMaskNode.h
index 3849d5155fa..296385f6923 100644
--- a/source/blender/compositor/nodes/COM_IDMaskNode.h
+++ b/source/blender/compositor/nodes/COM_IDMaskNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_IDMASKNODE_H__
diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp
index 53029b037f1..fb3a222cc66 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Tönne
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ImageNode.h"
diff --git a/source/blender/compositor/nodes/COM_ImageNode.h b/source/blender/compositor/nodes/COM_ImageNode.h
index 9e739ce410e..936d5941676 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.h
+++ b/source/blender/compositor/nodes/COM_ImageNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Tönne
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_defines.h"
diff --git a/source/blender/compositor/nodes/COM_InpaintNode.cpp b/source/blender/compositor/nodes/COM_InpaintNode.cpp
index cf1129781a8..84cc7a8118d 100644
--- a/source/blender/compositor/nodes/COM_InpaintNode.cpp
+++ b/source/blender/compositor/nodes/COM_InpaintNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor: Peter Schlaile
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_InpaintNode.h"
diff --git a/source/blender/compositor/nodes/COM_InpaintNode.h b/source/blender/compositor/nodes/COM_InpaintNode.h
index 8f2b9e64040..bbfb462667b 100644
--- a/source/blender/compositor/nodes/COM_InpaintNode.h
+++ b/source/blender/compositor/nodes/COM_InpaintNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor: Peter Schlaile
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_INPAINTNODE_H__
diff --git a/source/blender/compositor/nodes/COM_InvertNode.cpp b/source/blender/compositor/nodes/COM_InvertNode.cpp
index 56a69c7e300..769e0214b3b 100644
--- a/source/blender/compositor/nodes/COM_InvertNode.cpp
+++ b/source/blender/compositor/nodes/COM_InvertNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_InvertNode.h"
diff --git a/source/blender/compositor/nodes/COM_InvertNode.h b/source/blender/compositor/nodes/COM_InvertNode.h
index 9b09e71847e..b15bfca012e 100644
--- a/source/blender/compositor/nodes/COM_InvertNode.h
+++ b/source/blender/compositor/nodes/COM_InvertNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_INVERTNODE_H__
diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp
index 6ab7a763dd5..9050dba676b 100644
--- a/source/blender/compositor/nodes/COM_KeyingNode.cpp
+++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_KeyingNode.h"
diff --git a/source/blender/compositor/nodes/COM_KeyingNode.h b/source/blender/compositor/nodes/COM_KeyingNode.h
index 5fad48c337e..cb752f517bd 100644
--- a/source/blender/compositor/nodes/COM_KeyingNode.h
+++ b/source/blender/compositor/nodes/COM_KeyingNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_Node.h"
diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp
index db0d6ebd18a..562e14a0ec0 100644
--- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp
+++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_KeyingScreenNode.h"
diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.h b/source/blender/compositor/nodes/COM_KeyingScreenNode.h
index 744c80df01e..196ddd6db8d 100644
--- a/source/blender/compositor/nodes/COM_KeyingScreenNode.h
+++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_Node.h"
diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp
index b854ebd5c01..4f8d8589a20 100644
--- a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp
+++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_LensDistortionNode.h"
diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.h b/source/blender/compositor/nodes/COM_LensDistortionNode.h
index f5a10d6ad59..91b962a0faa 100644
--- a/source/blender/compositor/nodes/COM_LensDistortionNode.h
+++ b/source/blender/compositor/nodes/COM_LensDistortionNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_LENSDISTORTIONNODE_H__
diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
index 7bd264fe3f4..a5976ba3127 100644
--- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_LuminanceMatteNode.h"
diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h
index feac63c7957..5412016f10b 100644
--- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h
+++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_LUMINANCEMATTENODE_H__
diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.cpp b/source/blender/compositor/nodes/COM_MapRangeNode.cpp
index 72d36b922f7..7abd6f4a595 100644
--- a/source/blender/compositor/nodes/COM_MapRangeNode.cpp
+++ b/source/blender/compositor/nodes/COM_MapRangeNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
- * Daniel Salazar
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_MapRangeNode.h"
diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.h b/source/blender/compositor/nodes/COM_MapRangeNode.h
index 9248da8c65c..ce9ffa15c1e 100644
--- a/source/blender/compositor/nodes/COM_MapRangeNode.h
+++ b/source/blender/compositor/nodes/COM_MapRangeNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
- * Daniel Salazar
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_MAPRANGENODE_H__
diff --git a/source/blender/compositor/nodes/COM_MapUVNode.cpp b/source/blender/compositor/nodes/COM_MapUVNode.cpp
index a5f7165db44..555fe9e87ae 100644
--- a/source/blender/compositor/nodes/COM_MapUVNode.cpp
+++ b/source/blender/compositor/nodes/COM_MapUVNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MapUVNode.h"
diff --git a/source/blender/compositor/nodes/COM_MapUVNode.h b/source/blender/compositor/nodes/COM_MapUVNode.h
index b53f4658e2e..c751ee2e72c 100644
--- a/source/blender/compositor/nodes/COM_MapUVNode.h
+++ b/source/blender/compositor/nodes/COM_MapUVNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MAPUVNODE_H__
diff --git a/source/blender/compositor/nodes/COM_MapValueNode.cpp b/source/blender/compositor/nodes/COM_MapValueNode.cpp
index 4c8991b3c42..8d0d8e47d7f 100644
--- a/source/blender/compositor/nodes/COM_MapValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_MapValueNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MapValueNode.h"
diff --git a/source/blender/compositor/nodes/COM_MapValueNode.h b/source/blender/compositor/nodes/COM_MapValueNode.h
index 6c865135cc2..65b9708d163 100644
--- a/source/blender/compositor/nodes/COM_MapValueNode.h
+++ b/source/blender/compositor/nodes/COM_MapValueNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MAPVALUENODE_H__
diff --git a/source/blender/compositor/nodes/COM_MaskNode.cpp b/source/blender/compositor/nodes/COM_MaskNode.cpp
index 45888fea3a8..5158103c08a 100644
--- a/source/blender/compositor/nodes/COM_MaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_MaskNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_MaskNode.h"
diff --git a/source/blender/compositor/nodes/COM_MaskNode.h b/source/blender/compositor/nodes/COM_MaskNode.h
index 254fd95b87c..dec6112e8f6 100644
--- a/source/blender/compositor/nodes/COM_MaskNode.h
+++ b/source/blender/compositor/nodes/COM_MaskNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_MASKNODE_H__
diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp
index 0ab6dcad025..06753383dfe 100644
--- a/source/blender/compositor/nodes/COM_MathNode.cpp
+++ b/source/blender/compositor/nodes/COM_MathNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MathNode.h"
diff --git a/source/blender/compositor/nodes/COM_MathNode.h b/source/blender/compositor/nodes/COM_MathNode.h
index 27e9e649310..cf7c9276ba4 100644
--- a/source/blender/compositor/nodes/COM_MathNode.h
+++ b/source/blender/compositor/nodes/COM_MathNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MATHNODE_H__
diff --git a/source/blender/compositor/nodes/COM_MixNode.cpp b/source/blender/compositor/nodes/COM_MixNode.cpp
index 2f2569c5832..4c5888135c7 100644
--- a/source/blender/compositor/nodes/COM_MixNode.cpp
+++ b/source/blender/compositor/nodes/COM_MixNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MixNode.h"
diff --git a/source/blender/compositor/nodes/COM_MixNode.h b/source/blender/compositor/nodes/COM_MixNode.h
index 317202cc5af..5571599e106 100644
--- a/source/blender/compositor/nodes/COM_MixNode.h
+++ b/source/blender/compositor/nodes/COM_MixNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MIXNODE_H__
diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cpp b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
index 60cecfc5881..b79282d37b2 100644
--- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp
+++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MovieClipNode.h"
diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.h b/source/blender/compositor/nodes/COM_MovieClipNode.h
index 604adc99824..5664d472ce6 100644
--- a/source/blender/compositor/nodes/COM_MovieClipNode.h
+++ b/source/blender/compositor/nodes/COM_MovieClipNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MOVIECLIPNODE_H__
diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp b/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
index d862c27456f..5786f8cc385 100644
--- a/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
+++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MovieDistortionNode.h"
diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.h b/source/blender/compositor/nodes/COM_MovieDistortionNode.h
index bd5526106fd..6cba1a1196c 100644
--- a/source/blender/compositor/nodes/COM_MovieDistortionNode.h
+++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MOVIEDISTORTIONNODE_H__
diff --git a/source/blender/compositor/nodes/COM_NormalNode.cpp b/source/blender/compositor/nodes/COM_NormalNode.cpp
index b18e27e1a60..281f43dfec9 100644
--- a/source/blender/compositor/nodes/COM_NormalNode.cpp
+++ b/source/blender/compositor/nodes/COM_NormalNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_NormalNode.h"
diff --git a/source/blender/compositor/nodes/COM_NormalNode.h b/source/blender/compositor/nodes/COM_NormalNode.h
index a13b493328f..5569feb8c7e 100644
--- a/source/blender/compositor/nodes/COM_NormalNode.h
+++ b/source/blender/compositor/nodes/COM_NormalNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_NORMALNODE_H__
diff --git a/source/blender/compositor/nodes/COM_NormalizeNode.cpp b/source/blender/compositor/nodes/COM_NormalizeNode.cpp
index 94891283828..1adfcaddb0e 100644
--- a/source/blender/compositor/nodes/COM_NormalizeNode.cpp
+++ b/source/blender/compositor/nodes/COM_NormalizeNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_NormalizeNode.h"
diff --git a/source/blender/compositor/nodes/COM_NormalizeNode.h b/source/blender/compositor/nodes/COM_NormalizeNode.h
index 5148e21fd56..fa41753e697 100644
--- a/source/blender/compositor/nodes/COM_NormalizeNode.h
+++ b/source/blender/compositor/nodes/COM_NormalizeNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_NORMALIZENODE_H__
diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cpp b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
index d0c553b7568..6adf4f6207d 100644
--- a/source/blender/compositor/nodes/COM_OutputFileNode.cpp
+++ b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Tönne
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_OutputFileNode.h"
diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.h b/source/blender/compositor/nodes/COM_OutputFileNode.h
index 2d259aee567..366528742b8 100644
--- a/source/blender/compositor/nodes/COM_OutputFileNode.h
+++ b/source/blender/compositor/nodes/COM_OutputFileNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Tönne
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_OUTPUTFILENODE_H__
diff --git a/source/blender/compositor/nodes/COM_PixelateNode.cpp b/source/blender/compositor/nodes/COM_PixelateNode.cpp
index 87b18c98cea..0db623866e8 100644
--- a/source/blender/compositor/nodes/COM_PixelateNode.cpp
+++ b/source/blender/compositor/nodes/COM_PixelateNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_PixelateNode.h"
diff --git a/source/blender/compositor/nodes/COM_PixelateNode.h b/source/blender/compositor/nodes/COM_PixelateNode.h
index c0f52351cef..5738988672a 100644
--- a/source/blender/compositor/nodes/COM_PixelateNode.h
+++ b/source/blender/compositor/nodes/COM_PixelateNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_PIXELATENODE_H__
diff --git a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp
index 7e0adccb11c..75bdf851f83 100644
--- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp
+++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2013, Blender Foundation.
*/
#include "COM_PlaneTrackDeformNode.h"
diff --git a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h
index 7af9f313bd1..b11daaf0abf 100644
--- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h
+++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Sergey Sharybin
+ * Copyright 2013, Blender Foundation.
*/
#include "COM_Node.h"
diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
index 59e09b8427b..e1897e09128 100644
--- a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
+++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_RenderLayersNode.h"
diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.h b/source/blender/compositor/nodes/COM_RenderLayersNode.h
index aabb9d00633..50acb7aad42 100644
--- a/source/blender/compositor/nodes/COM_RenderLayersNode.h
+++ b/source/blender/compositor/nodes/COM_RenderLayersNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_Node.h"
diff --git a/source/blender/compositor/nodes/COM_RotateNode.cpp b/source/blender/compositor/nodes/COM_RotateNode.cpp
index a93ce47544a..d097d7b721f 100644
--- a/source/blender/compositor/nodes/COM_RotateNode.cpp
+++ b/source/blender/compositor/nodes/COM_RotateNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_RotateNode.h"
diff --git a/source/blender/compositor/nodes/COM_RotateNode.h b/source/blender/compositor/nodes/COM_RotateNode.h
index 82125d0e461..2190ddd0b01 100644
--- a/source/blender/compositor/nodes/COM_RotateNode.h
+++ b/source/blender/compositor/nodes/COM_RotateNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ROTATENODE_H__
diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp
index f65cfd194b8..61017f1a8e8 100644
--- a/source/blender/compositor/nodes/COM_ScaleNode.cpp
+++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ScaleNode.h"
diff --git a/source/blender/compositor/nodes/COM_ScaleNode.h b/source/blender/compositor/nodes/COM_ScaleNode.h
index eec86bce05d..a58b81ed765 100644
--- a/source/blender/compositor/nodes/COM_ScaleNode.h
+++ b/source/blender/compositor/nodes/COM_ScaleNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SCALENODE_H__
diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.cpp b/source/blender/compositor/nodes/COM_SeparateColorNode.cpp
index 447e256990a..955994ec404 100644
--- a/source/blender/compositor/nodes/COM_SeparateColorNode.cpp
+++ b/source/blender/compositor/nodes/COM_SeparateColorNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Toenne
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SeparateColorNode.h"
diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.h b/source/blender/compositor/nodes/COM_SeparateColorNode.h
index 4373ee9919d..1238b02dfbb 100644
--- a/source/blender/compositor/nodes/COM_SeparateColorNode.h
+++ b/source/blender/compositor/nodes/COM_SeparateColorNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Toenne
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SEPARATECOLORNODE_H__
diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
index 68d0aa7f6d5..024970f296b 100644
--- a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
+++ b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SetAlphaNode.h"
diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.h b/source/blender/compositor/nodes/COM_SetAlphaNode.h
index 224b34a81ce..03d955cc8d3 100644
--- a/source/blender/compositor/nodes/COM_SetAlphaNode.h
+++ b/source/blender/compositor/nodes/COM_SetAlphaNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SETALPHANODE_H__
diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
index 0d02f7f0027..0b6e8b2f3f4 100644
--- a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
+++ b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SocketProxyNode.h"
diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.h b/source/blender/compositor/nodes/COM_SocketProxyNode.h
index 19d025c8144..6e288e59797 100644
--- a/source/blender/compositor/nodes/COM_SocketProxyNode.h
+++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SOCKETPROXYNODE_H__
diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
index 10f6384d06a..a736000ead7 100644
--- a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SplitViewerNode.h"
diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.h b/source/blender/compositor/nodes/COM_SplitViewerNode.h
index ad29a222069..aedb805a36a 100644
--- a/source/blender/compositor/nodes/COM_SplitViewerNode.h
+++ b/source/blender/compositor/nodes/COM_SplitViewerNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SPLITVIEWERNODE_H__
diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
index 124b9492ecd..3dd7656e3f5 100644
--- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
+++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_Stabilize2dNode.h"
diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.h b/source/blender/compositor/nodes/COM_Stabilize2dNode.h
index 8f808ccd94e..a17f1b0a7e1 100644
--- a/source/blender/compositor/nodes/COM_Stabilize2dNode.h
+++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_STABILIZE2DNODE_H__
diff --git a/source/blender/compositor/nodes/COM_SunBeamsNode.cpp b/source/blender/compositor/nodes/COM_SunBeamsNode.cpp
index a86f27c6027..31c8770792c 100644
--- a/source/blender/compositor/nodes/COM_SunBeamsNode.cpp
+++ b/source/blender/compositor/nodes/COM_SunBeamsNode.cpp
@@ -1,7 +1,4 @@
-/*
- * Copyright 2014, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
+/* 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.
@@ -15,8 +12,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2014, Blender Foundation.
*/
#include "COM_SunBeamsNode.h"
diff --git a/source/blender/compositor/nodes/COM_SunBeamsNode.h b/source/blender/compositor/nodes/COM_SunBeamsNode.h
index 9a52919f892..065454f5969 100644
--- a/source/blender/compositor/nodes/COM_SunBeamsNode.h
+++ b/source/blender/compositor/nodes/COM_SunBeamsNode.h
@@ -1,7 +1,4 @@
-/*
- * Copyright 2014, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
+/* 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.
@@ -15,8 +12,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2014, Blender Foundation.
*/
#ifndef __COM_SUNBEAMSNODE_H__
diff --git a/source/blender/compositor/nodes/COM_SwitchNode.cpp b/source/blender/compositor/nodes/COM_SwitchNode.cpp
index 2b58a8a5de8..c106dd8fc59 100644
--- a/source/blender/compositor/nodes/COM_SwitchNode.cpp
+++ b/source/blender/compositor/nodes/COM_SwitchNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SwitchNode.h"
diff --git a/source/blender/compositor/nodes/COM_SwitchNode.h b/source/blender/compositor/nodes/COM_SwitchNode.h
index 220f3a36ed6..7a2387fba66 100644
--- a/source/blender/compositor/nodes/COM_SwitchNode.h
+++ b/source/blender/compositor/nodes/COM_SwitchNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SWITCHNODE_H__
diff --git a/source/blender/compositor/nodes/COM_SwitchViewNode.cpp b/source/blender/compositor/nodes/COM_SwitchViewNode.cpp
index 602df0fb35c..45df513a383 100644
--- a/source/blender/compositor/nodes/COM_SwitchViewNode.cpp
+++ b/source/blender/compositor/nodes/COM_SwitchViewNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2015, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2015, Blender Foundation.
*/
#include "COM_SwitchViewNode.h"
diff --git a/source/blender/compositor/nodes/COM_SwitchViewNode.h b/source/blender/compositor/nodes/COM_SwitchViewNode.h
index affae8ea797..92ae3fafffa 100644
--- a/source/blender/compositor/nodes/COM_SwitchViewNode.h
+++ b/source/blender/compositor/nodes/COM_SwitchViewNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2015, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2015, Blender Foundation.
*/
#ifndef __COM_SWITCHVIEWNODE_H__
diff --git a/source/blender/compositor/nodes/COM_TextureNode.cpp b/source/blender/compositor/nodes/COM_TextureNode.cpp
index 41241fde76b..adf1333e226 100644
--- a/source/blender/compositor/nodes/COM_TextureNode.cpp
+++ b/source/blender/compositor/nodes/COM_TextureNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_TextureNode.h"
diff --git a/source/blender/compositor/nodes/COM_TextureNode.h b/source/blender/compositor/nodes/COM_TextureNode.h
index 7fbb9072ae8..19285d98127 100644
--- a/source/blender/compositor/nodes/COM_TextureNode.h
+++ b/source/blender/compositor/nodes/COM_TextureNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_Node.h"
diff --git a/source/blender/compositor/nodes/COM_TimeNode.cpp b/source/blender/compositor/nodes/COM_TimeNode.cpp
index b4d9668e6ce..8eb7848ba6c 100644
--- a/source/blender/compositor/nodes/COM_TimeNode.cpp
+++ b/source/blender/compositor/nodes/COM_TimeNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_TimeNode.h"
diff --git a/source/blender/compositor/nodes/COM_TimeNode.h b/source/blender/compositor/nodes/COM_TimeNode.h
index f06d546e6c1..5f46a6e0dae 100644
--- a/source/blender/compositor/nodes/COM_TimeNode.h
+++ b/source/blender/compositor/nodes/COM_TimeNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_TIMENODE_H__
diff --git a/source/blender/compositor/nodes/COM_TonemapNode.cpp b/source/blender/compositor/nodes/COM_TonemapNode.cpp
index 981ea98f95b..f6294161cec 100644
--- a/source/blender/compositor/nodes/COM_TonemapNode.cpp
+++ b/source/blender/compositor/nodes/COM_TonemapNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_TonemapNode.h"
diff --git a/source/blender/compositor/nodes/COM_TonemapNode.h b/source/blender/compositor/nodes/COM_TonemapNode.h
index d765303ed13..17392da1eff 100644
--- a/source/blender/compositor/nodes/COM_TonemapNode.h
+++ b/source/blender/compositor/nodes/COM_TonemapNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_TONEMAPNODE_H__
diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.cpp b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
index 45380c56411..7c9cd395890 100644
--- a/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
+++ b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_TrackPositionNode.h"
diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.h b/source/blender/compositor/nodes/COM_TrackPositionNode.h
index aa0c510f65b..8b911fb2397 100644
--- a/source/blender/compositor/nodes/COM_TrackPositionNode.h
+++ b/source/blender/compositor/nodes/COM_TrackPositionNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_Node.h"
diff --git a/source/blender/compositor/nodes/COM_TransformNode.cpp b/source/blender/compositor/nodes/COM_TransformNode.cpp
index 1c034d16744..45c65c04eba 100644
--- a/source/blender/compositor/nodes/COM_TransformNode.cpp
+++ b/source/blender/compositor/nodes/COM_TransformNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_TransformNode.h"
diff --git a/source/blender/compositor/nodes/COM_TransformNode.h b/source/blender/compositor/nodes/COM_TransformNode.h
index 8bbcaa687ec..de6dee271b2 100644
--- a/source/blender/compositor/nodes/COM_TransformNode.h
+++ b/source/blender/compositor/nodes/COM_TransformNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_TRANSFORMNODE_H__
diff --git a/source/blender/compositor/nodes/COM_TranslateNode.cpp b/source/blender/compositor/nodes/COM_TranslateNode.cpp
index ed66d008188..a09f972dfec 100644
--- a/source/blender/compositor/nodes/COM_TranslateNode.cpp
+++ b/source/blender/compositor/nodes/COM_TranslateNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_TranslateNode.h"
diff --git a/source/blender/compositor/nodes/COM_TranslateNode.h b/source/blender/compositor/nodes/COM_TranslateNode.h
index c84605a94cf..9a13906adde 100644
--- a/source/blender/compositor/nodes/COM_TranslateNode.h
+++ b/source/blender/compositor/nodes/COM_TranslateNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_TRANSLATENODE_H__
diff --git a/source/blender/compositor/nodes/COM_ValueNode.cpp b/source/blender/compositor/nodes/COM_ValueNode.cpp
index 26c87f3acb7..207598d0c99 100644
--- a/source/blender/compositor/nodes/COM_ValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_ValueNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ValueNode.h"
diff --git a/source/blender/compositor/nodes/COM_ValueNode.h b/source/blender/compositor/nodes/COM_ValueNode.h
index a7fe54a1a9d..870debf95ab 100644
--- a/source/blender/compositor/nodes/COM_ValueNode.h
+++ b/source/blender/compositor/nodes/COM_ValueNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_VALUENODE_H__
diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp
index 7a685b2ed1e..776fa66acf5 100644
--- a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_VectorBlurNode.h"
diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.h b/source/blender/compositor/nodes/COM_VectorBlurNode.h
index 33aa07bb0eb..9533de11b77 100644
--- a/source/blender/compositor/nodes/COM_VectorBlurNode.h
+++ b/source/blender/compositor/nodes/COM_VectorBlurNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_VECTORBLURNODE_H__
diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.cpp b/source/blender/compositor/nodes/COM_VectorCurveNode.cpp
index fbb367ca374..81dac70b8fc 100644
--- a/source/blender/compositor/nodes/COM_VectorCurveNode.cpp
+++ b/source/blender/compositor/nodes/COM_VectorCurveNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_VectorCurveNode.h"
diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.h b/source/blender/compositor/nodes/COM_VectorCurveNode.h
index 6fea5261290..8495bf51e51 100644
--- a/source/blender/compositor/nodes/COM_VectorCurveNode.h
+++ b/source/blender/compositor/nodes/COM_VectorCurveNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_VECTORCURVENODE_H__
diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
index 02b08131c2f..935ffb6e005 100644
--- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ViewLevelsNode.h"
diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.h b/source/blender/compositor/nodes/COM_ViewLevelsNode.h
index 772c5692fa6..0973e8d0edb 100644
--- a/source/blender/compositor/nodes/COM_ViewLevelsNode.h
+++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_VIEWLEVELSNODE_H__
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cpp b/source/blender/compositor/nodes/COM_ViewerNode.cpp
index 773476f588a..0aae047689d 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ViewerNode.h"
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.h b/source/blender/compositor/nodes/COM_ViewerNode.h
index 1f2a1ef1284..3d6aabe2250 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.h
+++ b/source/blender/compositor/nodes/COM_ViewerNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_VIEWERNODE_H__
diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.cpp b/source/blender/compositor/nodes/COM_ZCombineNode.cpp
index 1bdce3f858e..00b86c0f1e0 100644
--- a/source/blender/compositor/nodes/COM_ZCombineNode.cpp
+++ b/source/blender/compositor/nodes/COM_ZCombineNode.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ZCombineNode.h"
diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.h b/source/blender/compositor/nodes/COM_ZCombineNode.h
index 2b8c75e8cde..d5a7b4d3f1e 100644
--- a/source/blender/compositor/nodes/COM_ZCombineNode.h
+++ b/source/blender/compositor/nodes/COM_ZCombineNode.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ZCOMBINENODE_H__
diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp
index f09b92d2796..8c483f9ff23 100644
--- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_AlphaOverKeyOperation.h"
diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h
index c3eedf4eac3..85b9ceed6be 100644
--- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h
+++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ALPHAOVERKEYOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
index 86dd1f94787..0c7738e6c23 100644
--- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_AlphaOverMixedOperation.h"
diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h
index c522d828822..118aa426404 100644
--- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h
+++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ALPHAOVERMIXEDOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
index 81e71be49fa..f482814481d 100644
--- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_AlphaOverPremultiplyOperation.h"
diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h
index 0a0c973b253..bf0e53c87e4 100644
--- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h
+++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ALPHAOVERPREMULTIPLYOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
index 97ac09d4abb..a33fe6bcdb0 100644
--- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
+++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor(s): Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_AntiAliasOperation.h"
diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.h b/source/blender/compositor/operations/COM_AntiAliasOperation.h
index 9a46044e2a0..d589be8a7dd 100644
--- a/source/blender/compositor/operations/COM_AntiAliasOperation.h
+++ b/source/blender/compositor/operations/COM_AntiAliasOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ANTIALIASOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp
index 3abb1ba183b..f866eac8ae3 100644
--- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BilateralBlurOperation.h"
diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.h b/source/blender/compositor/operations/COM_BilateralBlurOperation.h
index 3948357074b..e0275beca50 100644
--- a/source/blender/compositor/operations/COM_BilateralBlurOperation.h
+++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BILATERALBLUROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
index fc9686e1a32..d1a55de1431 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BlurBaseOperation.h"
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h
index 3f6c4cd7508..a2bac326d59 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.h
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BLURBASEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
index a92a7a85e7e..b6e0779c206 100644
--- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BokehBlurOperation.h"
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.h b/source/blender/compositor/operations/COM_BokehBlurOperation.h
index 04ecabd87df..ec46adee637 100644
--- a/source/blender/compositor/operations/COM_BokehBlurOperation.h
+++ b/source/blender/compositor/operations/COM_BokehBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BOKEHBLUROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cpp b/source/blender/compositor/operations/COM_BokehImageOperation.cpp
index 7dfc6002c2b..6d02f5eb64e 100644
--- a/source/blender/compositor/operations/COM_BokehImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_BokehImageOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BokehImageOperation.h"
diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h
index 510ff6377a0..445dea88cb7 100644
--- a/source/blender/compositor/operations/COM_BokehImageOperation.h
+++ b/source/blender/compositor/operations/COM_BokehImageOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BOKEHIMAGEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp
index c824ab9b005..6328b983489 100644
--- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BoxMaskOperation.h"
diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.h b/source/blender/compositor/operations/COM_BoxMaskOperation.h
index 5b2fd70a69c..f5134de7211 100644
--- a/source/blender/compositor/operations/COM_BoxMaskOperation.h
+++ b/source/blender/compositor/operations/COM_BoxMaskOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BOXMASKOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
index 437722abaa8..dedea363163 100644
--- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp
+++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_BrightnessOperation.h"
diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.h b/source/blender/compositor/operations/COM_BrightnessOperation.h
index 5cfdcf8d7c9..45aa7be48f3 100644
--- a/source/blender/compositor/operations/COM_BrightnessOperation.h
+++ b/source/blender/compositor/operations/COM_BrightnessOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_BRIGHTNESSOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp
index 2a26e067a78..2bc3efc60e4 100644
--- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp
+++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_CalculateMeanOperation.h"
diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.h b/source/blender/compositor/operations/COM_CalculateMeanOperation.h
index 9a539788359..54c09007dc6 100644
--- a/source/blender/compositor/operations/COM_CalculateMeanOperation.h
+++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CALCULATEMEANOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
index fd607a9bfd2..7fa1929889c 100644
--- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
+++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_CalculateStandardDeviationOperation.h"
diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h
index 2a84d306b1a..bc0bd669ebc 100644
--- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h
+++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CALCULATESTANDARDDEVIATIONOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
index e72a64b4d7b..7481a3bebb4 100644
--- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ChangeHSVOperation.h"
diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h
index b32bde291e4..80855cb73a9 100644
--- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h
+++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CHANGEHSVOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
index 97144782967..1e3808a80cc 100644
--- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_ChannelMatteOperation.h"
diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.h b/source/blender/compositor/operations/COM_ChannelMatteOperation.h
index 92050d4ee7a..152dd78a6b3 100644
--- a/source/blender/compositor/operations/COM_ChannelMatteOperation.h
+++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_CHANNELMATTEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
index 41582b51af4..05a184a4b58 100644
--- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ChromaMatteOperation.h"
diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.h b/source/blender/compositor/operations/COM_ChromaMatteOperation.h
index c6495323ec0..7782ed7e1fa 100644
--- a/source/blender/compositor/operations/COM_ChromaMatteOperation.h
+++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CHROMAMATTEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
index 5d9dd7fb9ca..8debf01417e 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorBalanceASCCDLOperation.h"
diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h
index 01f576cead1..1ce0ec71538 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h
+++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORBALANCEASCCDLOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
index f4bc5849ebf..5b048dfe405 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorBalanceLGGOperation.h"
diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h
index 8bed3b05114..2a96f7fdf01 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h
+++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORBALANCELGGOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
index e0ea3def45c..821f1cbb44e 100644
--- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorCorrectionOperation.h"
diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h
index 6c7f7b68faa..7bc85aa6f3e 100644
--- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h
+++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORCORRECTIONOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
index 698c8bc9947..51fbb4ebde4 100644
--- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorCurveOperation.h"
diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.h b/source/blender/compositor/operations/COM_ColorCurveOperation.h
index ac16840a5c0..a1f07fedb50 100644
--- a/source/blender/compositor/operations/COM_ColorCurveOperation.h
+++ b/source/blender/compositor/operations/COM_ColorCurveOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORCURVEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
index c3952187286..fbc8eef0ec9 100644
--- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorMatteOperation.h"
diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.h b/source/blender/compositor/operations/COM_ColorMatteOperation.h
index 0b6e9a8f9d8..5fe92292382 100644
--- a/source/blender/compositor/operations/COM_ColorMatteOperation.h
+++ b/source/blender/compositor/operations/COM_ColorMatteOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORMATTEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.cpp b/source/blender/compositor/operations/COM_ColorRampOperation.cpp
index dd6c80352df..238c22c426f 100644
--- a/source/blender/compositor/operations/COM_ColorRampOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorRampOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorRampOperation.h"
diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.h b/source/blender/compositor/operations/COM_ColorRampOperation.h
index 20fbfd1ea8b..9e313e9d439 100644
--- a/source/blender/compositor/operations/COM_ColorRampOperation.h
+++ b/source/blender/compositor/operations/COM_ColorRampOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORRAMPOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
index 4fbb822fc06..656ec1a7439 100644
--- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp
@@ -1,23 +1,19 @@
/*
- * Copyright 2011, Blender Foundation.
- *
- * This Reader is free software; you can redistribute it and/or
+ * 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 Reader is distributed in the hope that it will be useful,
+ * 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 Reader; if not, write to the Free Software Foundation,
+ * along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ColorSpillOperation.h"
diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.h b/source/blender/compositor/operations/COM_ColorSpillOperation.h
index 75961b94305..6682abdc4ec 100644
--- a/source/blender/compositor/operations/COM_ColorSpillOperation.h
+++ b/source/blender/compositor/operations/COM_ColorSpillOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COLORSPILLOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index 9ad10699286..7d124e41a45 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_CompositorOperation.h"
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h
index 5dc912cb25b..3d195bd3c6c 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.h
+++ b/source/blender/compositor/operations/COM_CompositorOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_COMPOSITOROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
index b357dc1a170..3b04bc41367 100644
--- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ConvertColorProfileOperation.h"
diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h
index 91147e2eb13..86e6971c528 100644
--- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CONVERTCOLORPROFILEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
index 18c7419dcf5..c0c9c413c8b 100644
--- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ConvertDepthToRadiusOperation.h"
diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h
index 4193897078b..2611c082a05 100644
--- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CONVERTDEPTHTORADIUSOPERATION_H__
@@ -70,7 +66,7 @@ public:
void setMaxRadius(float maxRadius) { this->m_maxRadius = maxRadius; }
void setCameraObject(Object *camera) { this->m_cameraObject = camera; }
float determineFocalDistance();
- void setPostBlur(FastGaussianBlurValueOperation *operation) {this->m_blurPostOperation = operation;}
+ void setPostBlur(FastGaussianBlurValueOperation *operation) { this->m_blurPostOperation = operation; }
};
#endif
diff --git a/source/blender/compositor/operations/COM_ConvertOperation.cpp b/source/blender/compositor/operations/COM_ConvertOperation.cpp
index c661420605e..5c32ac7e48e 100644
--- a/source/blender/compositor/operations/COM_ConvertOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ConvertOperation.h"
diff --git a/source/blender/compositor/operations/COM_ConvertOperation.h b/source/blender/compositor/operations/COM_ConvertOperation.h
index 404b6078cb4..f738879b572 100644
--- a/source/blender/compositor/operations/COM_ConvertOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CONVERTOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
index ba4a2c8fad1..b79fea5bfd9 100644
--- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ConvolutionEdgeFilterOperation.h"
diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h
index ae983dbdb47..58073e08acf 100644
--- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h
+++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CONVOLUTIONEDGEFILTEROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
index 7d2440a4781..bc1ecf2bd80 100644
--- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ConvolutionFilterOperation.h"
diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h
index 347ed0183e5..5342e2a7fa8 100644
--- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h
+++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CONVOLUTIONFILTEROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp
index 134e650c4ed..2a78dc3a1f9 100644
--- a/source/blender/compositor/operations/COM_CropOperation.cpp
+++ b/source/blender/compositor/operations/COM_CropOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_CropOperation.h"
diff --git a/source/blender/compositor/operations/COM_CropOperation.h b/source/blender/compositor/operations/COM_CropOperation.h
index 6608c9e14f5..06863f6fd0c 100644
--- a/source/blender/compositor/operations/COM_CropOperation.h
+++ b/source/blender/compositor/operations/COM_CropOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CROPOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.cpp b/source/blender/compositor/operations/COM_CryptomatteOperation.cpp
index 9a1cbdd7a00..bd1c9b31d75 100644
--- a/source/blender/compositor/operations/COM_CryptomatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_CryptomatteOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2018, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,7 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor: Lukas Stockner, Stefan Werner
+ * Copyright 2018, Blender Foundation.
*/
#include "COM_CryptomatteOperation.h"
diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.h b/source/blender/compositor/operations/COM_CryptomatteOperation.h
index 250c5ab8a49..63d566c553f 100644
--- a/source/blender/compositor/operations/COM_CryptomatteOperation.h
+++ b/source/blender/compositor/operations/COM_CryptomatteOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2018, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,7 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor: Lukas Stockner, Stefan Werner
+ * Copyright 2018, Blender Foundation.
*/
#ifndef __COM_CRYPTOMATTEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
index 6310a280b7b..fe83e75442f 100644
--- a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_CurveBaseOperation.h"
diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.h b/source/blender/compositor/operations/COM_CurveBaseOperation.h
index fffd44a3d30..71d5e4a67da 100644
--- a/source/blender/compositor/operations/COM_CurveBaseOperation.h
+++ b/source/blender/compositor/operations/COM_CurveBaseOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_CURVEBASEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.cpp b/source/blender/compositor/operations/COM_DespeckleOperation.cpp
index 1a827aae67e..0ac96ac89e9 100644
--- a/source/blender/compositor/operations/COM_DespeckleOperation.cpp
+++ b/source/blender/compositor/operations/COM_DespeckleOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,7 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor: Campbell Barton
+ * Copyright 2011, Blender Foundation.
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.h b/source/blender/compositor/operations/COM_DespeckleOperation.h
index 4ae0e8525d1..4a4aac41c32 100644
--- a/source/blender/compositor/operations/COM_DespeckleOperation.h
+++ b/source/blender/compositor/operations/COM_DespeckleOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,7 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor: Campbell Barton
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DESPECKLEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
index 4899994cf9e..cb4feaf4918 100644
--- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DifferenceMatteOperation.h"
diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h
index fe3aea8ea2e..09f77a3d793 100644
--- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h
+++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DIFFERENCEMATTEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
index 0853bd6f436..2e2888052b2 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DilateErodeOperation.h"
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h
index a873a009e18..7aa71c80999 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.h
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DILATEERODEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp
index d0d492fe2cd..a9f9ec9f091 100644
--- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DirectionalBlurOperation.h"
diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h
index 17970cab1d6..fa224407d08 100644
--- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h
+++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DIRECTIONALBLUROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
index 8618fba26ac..b44123196f8 100644
--- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DisplaceOperation.h"
diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.h b/source/blender/compositor/operations/COM_DisplaceOperation.h
index 298d48eac79..da652975a1d 100644
--- a/source/blender/compositor/operations/COM_DisplaceOperation.h
+++ b/source/blender/compositor/operations/COM_DisplaceOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DISPLACEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
index 20de1fe2f93..e6edbfcf6e0 100644
--- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_DisplaceSimpleOperation.h"
diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h
index b0573949141..c3e20b4b816 100644
--- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h
+++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_DISPLACESIMPLEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
index f34a948c909..98b49022639 100644
--- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DistanceRGBMatteOperation.h"
diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h
index 7fd3ec15463..418e7fd47d6 100644
--- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h
+++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DISTANCERGBMATTEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp
index d763010fbf2..cc063d27fb5 100644
--- a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DistanceYCCMatteOperation.h"
diff --git a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h
index 704b2e21a14..9c3d9680a1f 100644
--- a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h
+++ b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DISTANCEYCCMATTEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_DotproductOperation.cpp b/source/blender/compositor/operations/COM_DotproductOperation.cpp
index a9eaac977e3..67e1276121f 100644
--- a/source/blender/compositor/operations/COM_DotproductOperation.cpp
+++ b/source/blender/compositor/operations/COM_DotproductOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_DotproductOperation.h"
diff --git a/source/blender/compositor/operations/COM_DotproductOperation.h b/source/blender/compositor/operations/COM_DotproductOperation.h
index 84938bcef99..a568e909f17 100644
--- a/source/blender/compositor/operations/COM_DotproductOperation.h
+++ b/source/blender/compositor/operations/COM_DotproductOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DOTPRODUCTOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
index fdfbd4679f3..5e514796edb 100644
--- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include <stdlib.h>
@@ -28,7 +24,6 @@
#include "MEM_guardedalloc.h"
// this part has been copied from the double edge mask
-// Contributor(s): Peter Larabell.
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;
@@ -1194,7 +1189,8 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float
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
+ // set up inner edge, outer edge, and gradient buffer sizes after border pass
+ isz = rsize[0];
osz = rsize[1];
gsz = rsize[2];
// detect edges in all non-border pixels in the buffer
@@ -1207,24 +1203,31 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float
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
+ // set up inner edge, outer edge, and gradient buffer sizes after border pass
+ isz = rsize[0];
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.
+ // set edge and gradient buffer sizes once again...
+ // the sizes in rsize[] may have been modified
+ // by the do_*EdgeDetection() function.
+ isz = rsize[0];
+ osz = rsize[1];
+ gsz = rsize[2];
- fsz = gsz + isz + osz; // calculate size of pixel index buffer needed
- gbuf = (unsigned short *)MEM_callocN(sizeof(unsigned short) * fsz * 2, "DEM"); // allocate edge/gradient pixel index buffer
+ // calculate size of pixel index buffer needed
+ fsz = gsz + isz + osz;
+ // allocate edge/gradient pixel index buffer
+ gbuf = (unsigned short *)MEM_callocN(sizeof(unsigned short) * fsz * 2, "DEM");
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
+ // free the gradient index buffer
+ MEM_freeN(gbuf);
}
}
diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h
index a11c3306e39..2bb3761805b 100644
--- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h
+++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_DOUBLEEDGEMASKOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
index f620df014f9..d7c0339c0d1 100644
--- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_EllipseMaskOperation.h"
diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.h b/source/blender/compositor/operations/COM_EllipseMaskOperation.h
index ddd50fbafe5..6f5b6e3e25d 100644
--- a/source/blender/compositor/operations/COM_EllipseMaskOperation.h
+++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ELLIPSEMASKOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index f86bdac254d..c7c0fd8e447 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include <limits.h>
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
index e5d3835e8cd..b31e88a545d 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_FASTGAUSSIANBLUROPERATION_H__
@@ -45,7 +41,7 @@ public:
enum {
FAST_GAUSS_OVERLAY_MIN = -1,
FAST_GAUSS_OVERLAY_NONE = 0,
- FAST_GAUSS_OVERLAY_MAX = 1
+ FAST_GAUSS_OVERLAY_MAX = 1,
};
class FastGaussianBlurValueOperation : public NodeOperation {
diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp
index 38d3e10440e..913704bdfc0 100644
--- a/source/blender/compositor/operations/COM_FlipOperation.cpp
+++ b/source/blender/compositor/operations/COM_FlipOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_FlipOperation.h"
diff --git a/source/blender/compositor/operations/COM_FlipOperation.h b/source/blender/compositor/operations/COM_FlipOperation.h
index eac7897c107..1564daf5469 100644
--- a/source/blender/compositor/operations/COM_FlipOperation.h
+++ b/source/blender/compositor/operations/COM_FlipOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_FLIPOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
index d3ddb9a5ec0..8828553b4fd 100644
--- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
+++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GammaCorrectOperation.h"
diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.h b/source/blender/compositor/operations/COM_GammaCorrectOperation.h
index 49a94aeca6f..f982a3f7b18 100644
--- a/source/blender/compositor/operations/COM_GammaCorrectOperation.h
+++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GAMMACORRECTOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GammaOperation.cpp b/source/blender/compositor/operations/COM_GammaOperation.cpp
index d657f42cc39..614daebfed6 100644
--- a/source/blender/compositor/operations/COM_GammaOperation.cpp
+++ b/source/blender/compositor/operations/COM_GammaOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GammaOperation.h"
diff --git a/source/blender/compositor/operations/COM_GammaOperation.h b/source/blender/compositor/operations/COM_GammaOperation.h
index c0ef88b1928..0ec96cfccee 100644
--- a/source/blender/compositor/operations/COM_GammaOperation.h
+++ b/source/blender/compositor/operations/COM_GammaOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GAMMAOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
index 9c0f7de71b6..f9a548e1498 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Campbell Barton
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GaussianAlphaXBlurOperation.h"
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
index 7457bdca28c..530fccad60c 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Campbell Barton
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GAUSSIANALPHAXBLUROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
index 982b2b9f24c..058718c6a97 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Campbell Barton
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GaussianAlphaYBlurOperation.h"
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
index 28d9c026593..cf3670f90ad 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Campbell Barton
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GAUSSIANALPHAYBLUROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
index ff5abaa0016..40a6f52c7a6 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GaussianBokehBlurOperation.h"
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h
index 6be2f60e729..c3d6d30b694 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GAUSSIANBOKEHBLUROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index 88152718524..c8c1db24b08 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GaussianXBlurOperation.h"
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h
index 3a344a1b3fc..ad9d718b86a 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GAUSSIANXBLUROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index c17f427b71a..168dbddf400 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GaussianYBlurOperation.h"
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h
index 6e45f332a2f..9d4e3d62055 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GAUSSIANYBLUROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
index 27cde5a7609..1d98ef65671 100644
--- a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GlareBaseOperation.h"
diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h
index f910adac211..3353b087b3b 100644
--- a/source/blender/compositor/operations/COM_GlareBaseOperation.h
+++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GLAREBASEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
index 63386943514..c74c1899daa 100644
--- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GlareFogGlowOperation.h"
diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.h b/source/blender/compositor/operations/COM_GlareFogGlowOperation.h
index 75428905673..b209e3d4fc6 100644
--- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.h
+++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GLAREFOGGLOWOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
index 7420748f098..852fc6fc6f9 100644
--- a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GlareGhostOperation.h"
diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.h b/source/blender/compositor/operations/COM_GlareGhostOperation.h
index 0378ecd4671..2844ed5f894 100644
--- a/source/blender/compositor/operations/COM_GlareGhostOperation.h
+++ b/source/blender/compositor/operations/COM_GlareGhostOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GLAREGHOSTOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp
index 95d165d7816..f984bdade4d 100644
--- a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GlareSimpleStarOperation.h"
diff --git a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h
index 5fc333f4e3c..3cb66c1212c 100644
--- a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h
+++ b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GLARESIMPLESTAROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp b/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp
index 5d8c9f4ecc9..18be89af75b 100644
--- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GlareStreaksOperation.h"
diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.h b/source/blender/compositor/operations/COM_GlareStreaksOperation.h
index 24f48ed4e48..cb2356123a5 100644
--- a/source/blender/compositor/operations/COM_GlareStreaksOperation.h
+++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GLARESTREAKSOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
index 18dd15d588e..75e0ce57980 100644
--- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_GlareThresholdOperation.h"
diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.h b/source/blender/compositor/operations/COM_GlareThresholdOperation.h
index ae819f45dda..2a38783511f 100644
--- a/source/blender/compositor/operations/COM_GlareThresholdOperation.h
+++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,15 +13,13 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_GLARETHRESHOLDOPERATION_H__
#define __COM_GLARETHRESHOLDOPERATION_H__
#include "COM_NodeOperation.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
class GlareThresholdOperation : public NodeOperation {
private:
diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
index 5b678c6b724..02497725d46 100644
--- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
+++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_HueSaturationValueCorrectOperation.h"
diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h
index 2c5a782e122..9d8b6e0aa7b 100644
--- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h
+++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_HUESATURATIONVALUECORRECTOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cpp b/source/blender/compositor/operations/COM_IDMaskOperation.cpp
index 1d608744a91..ce24cfcca79 100644
--- a/source/blender/compositor/operations/COM_IDMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_IDMaskOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_IDMaskOperation.h"
diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.h b/source/blender/compositor/operations/COM_IDMaskOperation.h
index 16fceb3d52e..f2ca267e80a 100644
--- a/source/blender/compositor/operations/COM_IDMaskOperation.h
+++ b/source/blender/compositor/operations/COM_IDMaskOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_IDMASKOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp
index 9b191d42110..efdd71f7f26 100644
--- a/source/blender/compositor/operations/COM_ImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_ImageOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ImageOperation.h"
diff --git a/source/blender/compositor/operations/COM_ImageOperation.h b/source/blender/compositor/operations/COM_ImageOperation.h
index 6336179e5ab..350c24bfafb 100644
--- a/source/blender/compositor/operations/COM_ImageOperation.h
+++ b/source/blender/compositor/operations/COM_ImageOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp
index 240bce0f586..e0f99d1916d 100644
--- a/source/blender/compositor/operations/COM_InpaintOperation.cpp
+++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor: Peter Schlaile
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/compositor/operations/COM_InpaintOperation.h b/source/blender/compositor/operations/COM_InpaintOperation.h
index 65e5c75198a..3bad383f51e 100644
--- a/source/blender/compositor/operations/COM_InpaintOperation.h
+++ b/source/blender/compositor/operations/COM_InpaintOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor: Peter Schlaile
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_INPAINTOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp
index cdc5eab7ed1..17b86fba076 100644
--- a/source/blender/compositor/operations/COM_InvertOperation.cpp
+++ b/source/blender/compositor/operations/COM_InvertOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_InvertOperation.h"
diff --git a/source/blender/compositor/operations/COM_InvertOperation.h b/source/blender/compositor/operations/COM_InvertOperation.h
index 5608a69e3a3..a5d2d498641 100644
--- a/source/blender/compositor/operations/COM_InvertOperation.h
+++ b/source/blender/compositor/operations/COM_InvertOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_INVERTOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp b/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp
index d9e6d6df41e..71386c20886 100644
--- a/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_KeyingBlurOperation.h"
diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.h b/source/blender/compositor/operations/COM_KeyingBlurOperation.h
index a15f3f697c2..76360d7fd6b 100644
--- a/source/blender/compositor/operations/COM_KeyingBlurOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_KEYINGBLUROPERATION_H__
@@ -37,7 +32,7 @@ protected:
public:
enum BlurAxis {
BLUR_AXIS_X = 0,
- BLUR_AXIS_Y = 1
+ BLUR_AXIS_Y = 1,
};
KeyingBlurOperation();
diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
index fd0788bb96d..f4600c753ba 100644
--- a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_KeyingClipOperation.h"
diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.h b/source/blender/compositor/operations/COM_KeyingClipOperation.h
index a37fc48fc86..6f8922c0124 100644
--- a/source/blender/compositor/operations/COM_KeyingClipOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingClipOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_KEYINGCLIPOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
index 6f707fb4cc0..9b3e89dc1f7 100644
--- a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_KeyingDespillOperation.h"
diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.h b/source/blender/compositor/operations/COM_KeyingDespillOperation.h
index a8514d31733..13f15c12d0c 100644
--- a/source/blender/compositor/operations/COM_KeyingDespillOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_KEYINGDESPILLOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp
index 9486cbb3393..53bb696866a 100644
--- a/source/blender/compositor/operations/COM_KeyingOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_KeyingOperation.h"
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.h b/source/blender/compositor/operations/COM_KeyingOperation.h
index 274cc48bbac..194d6eb0027 100644
--- a/source/blender/compositor/operations/COM_KeyingOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
index 8b842820761..6e5d40c6621 100644
--- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_KeyingScreenOperation.h"
diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.h b/source/blender/compositor/operations/COM_KeyingScreenOperation.h
index ac961c0919d..e11905fbfac 100644
--- a/source/blender/compositor/operations/COM_KeyingScreenOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
index 1f5b20207d1..4b98da47f43 100644
--- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_LuminanceMatteOperation.h"
diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h
index 7341bad4263..890fa6ee3b3 100644
--- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h
+++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_LUMINANCEMATTEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.cpp b/source/blender/compositor/operations/COM_MapRangeOperation.cpp
index 3cdf14ce1e7..e32158132d7 100644
--- a/source/blender/compositor/operations/COM_MapRangeOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapRangeOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
- * Daniel Salazar
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_MapRangeOperation.h"
diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.h b/source/blender/compositor/operations/COM_MapRangeOperation.h
index d8acdcc3e77..7b3d51a1896 100644
--- a/source/blender/compositor/operations/COM_MapRangeOperation.h
+++ b/source/blender/compositor/operations/COM_MapRangeOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
- * Daniel Salazar
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_MAPRANGEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp
index fae35ddbabc..3dbf4db5280 100644
--- a/source/blender/compositor/operations/COM_MapUVOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MapUVOperation.h"
diff --git a/source/blender/compositor/operations/COM_MapUVOperation.h b/source/blender/compositor/operations/COM_MapUVOperation.h
index 847cc93537a..b2235d4de25 100644
--- a/source/blender/compositor/operations/COM_MapUVOperation.h
+++ b/source/blender/compositor/operations/COM_MapUVOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MAPUVOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp
index 81fd6eec203..e8731c0f146 100644
--- a/source/blender/compositor/operations/COM_MapValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MapValueOperation.h"
diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h
index 9df4302fd83..dfea3703d24 100644
--- a/source/blender/compositor/operations/COM_MapValueOperation.h
+++ b/source/blender/compositor/operations/COM_MapValueOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MAPVALUEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp
index b9acec15c32..d2603978ac8 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_MaskOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_MaskOperation.h"
diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h
index b35ae647d97..643705e0535 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.h
+++ b/source/blender/compositor/operations/COM_MaskOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_MASKOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index 3c232475558..5bcb71a8dfc 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MathBaseOperation.h"
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h
index 0132c77ac37..7306a166e87 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.h
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MATHBASEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_MixOperation.cpp b/source/blender/compositor/operations/COM_MixOperation.cpp
index 04d4d4f4b77..abde0fa5547 100644
--- a/source/blender/compositor/operations/COM_MixOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MixOperation.h"
diff --git a/source/blender/compositor/operations/COM_MixOperation.h b/source/blender/compositor/operations/COM_MixOperation.h
index d4a079d4201..c724a54c9a4 100644
--- a/source/blender/compositor/operations/COM_MixOperation.h
+++ b/source/blender/compositor/operations/COM_MixOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MIXOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
index cae3b1dbcb1..db91a8beb1a 100644
--- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MovieClipAttributeOperation.h"
diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h
index fc6c9e0f5c3..3b720ff839a 100644
--- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h
+++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MOVIECLIPATTRIBUTEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
index 849af221451..1f4b947daa5 100644
--- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MovieClipOperation.h"
diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.h b/source/blender/compositor/operations/COM_MovieClipOperation.h
index d46fc007d15..caadb1e0a40 100644
--- a/source/blender/compositor/operations/COM_MovieClipOperation.h
+++ b/source/blender/compositor/operations/COM_MovieClipOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
index dca7cba46a8..e8dc6f41110 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MovieDistortionOperation.h"
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
index 1a7c6b363d3..89c242bf505 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_MOVIEDISTORTIONOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
index 85347ea5053..34c6478d149 100644
--- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Tönne
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_MultilayerImageOperation.h"
diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.h b/source/blender/compositor/operations/COM_MultilayerImageOperation.h
index b6d27623f1d..948301e2be4 100644
--- a/source/blender/compositor/operations/COM_MultilayerImageOperation.h
+++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Tönne
+ * Copyright 2011, Blender Foundation.
*/
diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
index 4c86c83c69d..b32bb42ca62 100644
--- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp
+++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_NormalizeOperation.h"
diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.h b/source/blender/compositor/operations/COM_NormalizeOperation.h
index 9efb5b24fbe..e7803fe3dee 100644
--- a/source/blender/compositor/operations/COM_NormalizeOperation.h
+++ b/source/blender/compositor/operations/COM_NormalizeOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Dalai Felinto
+ * Copyright 2012, Blender Foundation.
*/
#ifndef __COM_NORMALIZEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
index 6529b533361..1a2d5a052cd 100644
--- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2015, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,11 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Tönne
- * Dalai Felinto
+ * Copyright 2015, Blender Foundation.
*/
#include "COM_OutputFileOperation.h"
diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h
index d0f9eff2773..f213bdff51d 100644
--- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h
+++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2015, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,11 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Tönne
- * Dalai Felinto
+ * Copyright 2015, Blender Foundation.
*/
#ifndef __COM_OUTPUTFILEMULTIVIEWOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
index 0397d172ab3..9da3d15883c 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Tönne
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_OutputFileOperation.h"
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h
index 80e7dc21a23..de256e25ce0 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.h
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Lukas Tönne
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_OUTPUTFILEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_PixelateOperation.cpp b/source/blender/compositor/operations/COM_PixelateOperation.cpp
index 779a82366dd..e047f8a38de 100644
--- a/source/blender/compositor/operations/COM_PixelateOperation.cpp
+++ b/source/blender/compositor/operations/COM_PixelateOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_PixelateOperation.h"
diff --git a/source/blender/compositor/operations/COM_PixelateOperation.h b/source/blender/compositor/operations/COM_PixelateOperation.h
index 381c723f7e8..f9846cec2f6 100644
--- a/source/blender/compositor/operations/COM_PixelateOperation.h
+++ b/source/blender/compositor/operations/COM_PixelateOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_PIXELATEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp
index d8288322f37..c1dae48d1c6 100644
--- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp
+++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp
@@ -1,7 +1,4 @@
-/*
- * Copyright 2014, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
+/* 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.
@@ -15,8 +12,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2014, Blender Foundation.
*/
#include "COM_PlaneCornerPinOperation.h"
diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h
index 3a4e837cc4c..fc22d00c0f2 100644
--- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h
+++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h
@@ -1,8 +1,4 @@
-
-/*
- * Copyright 2014, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
+/* 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.
@@ -16,8 +12,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2014, Blender Foundation.
*/
#ifndef __COM_PLANECORNERPINOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp
index 3d36e3dad9f..c7f60d0dac2 100644
--- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp
+++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Sergey Sharybin
- * Lukas Toenne
+ * Copyright 2013, Blender Foundation.
*/
#include "COM_PlaneDistortCommonOperation.h"
diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h
index b96c5a0b80f..216f4ed969d 100644
--- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h
+++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h
@@ -1,7 +1,4 @@
-
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Sergey Sharybin
+ * Copyright 2013, Blender Foundation.
*/
#ifndef __COM_PLANEDISTORTCOMMONOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp b/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp
index 522cd950c76..b134bc9ef9e 100644
--- a/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp
+++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Sergey Sharybin
+ * Copyright 2013, Blender Foundation.
*/
#include "COM_PlaneTrackOperation.h"
diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.h b/source/blender/compositor/operations/COM_PlaneTrackOperation.h
index e9f9719797a..217f6dc92c1 100644
--- a/source/blender/compositor/operations/COM_PlaneTrackOperation.h
+++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.h
@@ -1,7 +1,4 @@
-
/*
- * Copyright 2013, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -16,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Sergey Sharybin
+ * Copyright 2013, Blender Foundation.
*/
#ifndef __COM_PLANETRACKOPERATION_H__
@@ -52,7 +48,7 @@ public:
void setMovieClip(MovieClip *clip) {this->m_movieClip = clip;}
void setTrackingObject(char *object) { BLI_strncpy(this->m_trackingObjectName, object, sizeof(this->m_trackingObjectName)); }
void setPlaneTrackName(char *plane_track) { BLI_strncpy(this->m_planeTrackName, plane_track, sizeof(this->m_planeTrackName)); }
- void setFramenumber(int framenumber) {this->m_framenumber = framenumber;}
+ void setFramenumber(int framenumber) { this->m_framenumber = framenumber; }
};
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp
index b00f92bf404..22215131ce1 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.cpp
+++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_PreviewOperation.h"
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h
index 9884d8ea37e..76b03b09731 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.h
+++ b/source/blender/compositor/operations/COM_PreviewOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_PREVIEWOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
index b5da10f256c..fa02f0f3356 100644
--- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ProjectorLensDistortionOperation.h"
diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h
index 4f6f0c4d087..b37bd2ab182 100644
--- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_PROJECTORLENSDISTORTIONOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.cpp b/source/blender/compositor/operations/COM_QualityStepHelper.cpp
index 6c589a4b68e..f7af97bb80a 100644
--- a/source/blender/compositor/operations/COM_QualityStepHelper.cpp
+++ b/source/blender/compositor/operations/COM_QualityStepHelper.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_QualityStepHelper.h"
diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.h b/source/blender/compositor/operations/COM_QualityStepHelper.h
index 8b424de8526..593124ad0d3 100644
--- a/source/blender/compositor/operations/COM_QualityStepHelper.h
+++ b/source/blender/compositor/operations/COM_QualityStepHelper.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_QUALITYSTEPHELPER_H__
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
index 82b62d8fbb3..0901fe418f8 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ReadBufferOperation.h"
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h
index a0598aec36e..cd15bb12b28 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.h
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_READBUFFEROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
index 58ea2ffe38b..060cf7ae91e 100644
--- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_RenderLayersProg.h"
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.h b/source/blender/compositor/operations/COM_RenderLayersProg.h
index 5d1981eac31..bce3b40b353 100644
--- a/source/blender/compositor/operations/COM_RenderLayersProg.h
+++ b/source/blender/compositor/operations/COM_RenderLayersProg.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp
index de01637501a..bc9fd46e8d7 100644
--- a/source/blender/compositor/operations/COM_RotateOperation.cpp
+++ b/source/blender/compositor/operations/COM_RotateOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_RotateOperation.h"
diff --git a/source/blender/compositor/operations/COM_RotateOperation.h b/source/blender/compositor/operations/COM_RotateOperation.h
index 70eeea351c3..1ab8fbd87a1 100644
--- a/source/blender/compositor/operations/COM_RotateOperation.h
+++ b/source/blender/compositor/operations/COM_RotateOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ROTATEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cpp b/source/blender/compositor/operations/COM_ScaleOperation.cpp
index 61e9543023d..7c0c552c34d 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScaleOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ScaleOperation.h"
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.h b/source/blender/compositor/operations/COM_ScaleOperation.h
index 0409832fa40..d761e441419 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.h
+++ b/source/blender/compositor/operations/COM_ScaleOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SCALEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
index f1746323d78..0d7eb189c90 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ScreenLensDistortionOperation.h"
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
index 654acc177d8..c419378a2a6 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SCREENLENSDISTORTIONOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
index d4f7e7e4f1c..441e0835c95 100644
--- a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SetAlphaOperation.h"
diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.h b/source/blender/compositor/operations/COM_SetAlphaOperation.h
index e059cbc1dc4..38cd5135406 100644
--- a/source/blender/compositor/operations/COM_SetAlphaOperation.h
+++ b/source/blender/compositor/operations/COM_SetAlphaOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SETALPHAOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_SetColorOperation.cpp b/source/blender/compositor/operations/COM_SetColorOperation.cpp
index d83c1728c1c..d80ed6eb1ca 100644
--- a/source/blender/compositor/operations/COM_SetColorOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetColorOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SetColorOperation.h"
diff --git a/source/blender/compositor/operations/COM_SetColorOperation.h b/source/blender/compositor/operations/COM_SetColorOperation.h
index e87c9550ea7..376e4633ac8 100644
--- a/source/blender/compositor/operations/COM_SetColorOperation.h
+++ b/source/blender/compositor/operations/COM_SetColorOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SETCOLOROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp
index bfb567b6435..38039bbf6bb 100644
--- a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SetSamplerOperation.h"
diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.h b/source/blender/compositor/operations/COM_SetSamplerOperation.h
index 90e614b6860..eaa8bbf744d 100644
--- a/source/blender/compositor/operations/COM_SetSamplerOperation.h
+++ b/source/blender/compositor/operations/COM_SetSamplerOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SETSAMPLEROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_SetValueOperation.cpp b/source/blender/compositor/operations/COM_SetValueOperation.cpp
index b1a60bdbf7c..0aa1e2bcbef 100644
--- a/source/blender/compositor/operations/COM_SetValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetValueOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SetValueOperation.h"
diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h
index 8ed10ffe2a2..59bcf28d012 100644
--- a/source/blender/compositor/operations/COM_SetValueOperation.h
+++ b/source/blender/compositor/operations/COM_SetValueOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SETVALUEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cpp b/source/blender/compositor/operations/COM_SetVectorOperation.cpp
index e95c5d09656..29407df55e5 100644
--- a/source/blender/compositor/operations/COM_SetVectorOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetVectorOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SetVectorOperation.h"
diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h
index dc9e6d6230f..c00bd125dff 100644
--- a/source/blender/compositor/operations/COM_SetVectorOperation.h
+++ b/source/blender/compositor/operations/COM_SetVectorOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SETVECTOROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
index ceef752174e..83ed7af1ffb 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SocketProxyOperation.h"
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h b/source/blender/compositor/operations/COM_SocketProxyOperation.h
index 215de59421b..47856031219 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.h
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SOCKETPROXYOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_SplitOperation.cpp b/source/blender/compositor/operations/COM_SplitOperation.cpp
index 330a6b0675d..aebae3c3f19 100644
--- a/source/blender/compositor/operations/COM_SplitOperation.cpp
+++ b/source/blender/compositor/operations/COM_SplitOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_SplitOperation.h"
diff --git a/source/blender/compositor/operations/COM_SplitOperation.h b/source/blender/compositor/operations/COM_SplitOperation.h
index f16b7e92645..34cb7f8f1b7 100644
--- a/source/blender/compositor/operations/COM_SplitOperation.h
+++ b/source/blender/compositor/operations/COM_SplitOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_SPLITOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp
index 10d128d01c3..0da63dd1c7a 100644
--- a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp
+++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp
@@ -1,7 +1,4 @@
-/*
- * Copyright 2014, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
+/* 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.
@@ -15,8 +12,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2014, Blender Foundation.
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.h b/source/blender/compositor/operations/COM_SunBeamsOperation.h
index 99de59aa31b..22c44b706dc 100644
--- a/source/blender/compositor/operations/COM_SunBeamsOperation.h
+++ b/source/blender/compositor/operations/COM_SunBeamsOperation.h
@@ -1,7 +1,4 @@
-/*
- * Copyright 2014, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
+/* 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.
@@ -15,8 +12,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Lukas Toenne
+ * Copyright 2014, Blender Foundation.
*/
#ifndef __COM_SUNBEAMSOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp
index da0c1106105..37d41a2afad 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.cpp
+++ b/source/blender/compositor/operations/COM_TextureOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_TextureOperation.h"
@@ -116,7 +112,7 @@ void TextureBaseOperation::executePixelSampled(float output[4], float x, float y
/* When no interpolation/filtering happens in multitex() foce nearest interpolation.
* We do it here because (a) we can't easily say multitex() that we want nearest
- * interpolaiton and (b) in such configuration multitex() sinply floor's the value
+ * interpolation and (b) in such configuration multitex() sinply floor's the value
* which often produces artifacts.
*/
if (m_texture != NULL && (m_texture->imaflag & TEX_INTERPOL) == 0) {
diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h
index ad35e2311f6..463fe4cc3a0 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.h
+++ b/source/blender/compositor/operations/COM_TextureOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cpp b/source/blender/compositor/operations/COM_TonemapOperation.cpp
index f2db6fac9f0..bc2177eefbe 100644
--- a/source/blender/compositor/operations/COM_TonemapOperation.cpp
+++ b/source/blender/compositor/operations/COM_TonemapOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_TonemapOperation.h"
diff --git a/source/blender/compositor/operations/COM_TonemapOperation.h b/source/blender/compositor/operations/COM_TonemapOperation.h
index 97ce7c1af13..2b4804e4bfd 100644
--- a/source/blender/compositor/operations/COM_TonemapOperation.h
+++ b/source/blender/compositor/operations/COM_TonemapOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_TONEMAPOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
index a7ce85c6f84..dbea46a4d85 100644
--- a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
#include "COM_TrackPositionOperation.h"
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.h b/source/blender/compositor/operations/COM_TrackPositionOperation.h
index 571733bedd8..95d27c3a5e4 100644
--- a/source/blender/compositor/operations/COM_TrackPositionOperation.h
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2012, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Sergey Sharybin
+ * Copyright 2012, Blender Foundation.
*/
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cpp b/source/blender/compositor/operations/COM_TranslateOperation.cpp
index 76efb107385..3e331a75c8d 100644
--- a/source/blender/compositor/operations/COM_TranslateOperation.cpp
+++ b/source/blender/compositor/operations/COM_TranslateOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Thomas Beck (plasmasolutions.de)
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_TranslateOperation.h"
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.h b/source/blender/compositor/operations/COM_TranslateOperation.h
index 175bbcfa599..c8fffaae2d8 100644
--- a/source/blender/compositor/operations/COM_TranslateOperation.h
+++ b/source/blender/compositor/operations/COM_TranslateOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_TRANSLATEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
index ccc701f57ce..1af4c107419 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_VariableSizeBokehBlurOperation.h"
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h
index 2e10007bc67..f586bf73dca 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_VARIABLESIZEBOKEHBLUROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
index 718e1cbddc4..6e408d9860d 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include <string.h>
@@ -33,8 +29,8 @@ extern "C" {
#define PASS_VECTOR_MAX 10000.0f
/* Forward declarations */
-struct ZSpan;
struct DrawBufPixel;
+struct ZSpan;
void zbuf_accumulate_vecblur(
NodeBlurData *nbd, int xsize, int ysize, float *newrect,
const float *imgrect, float *vecbufrect, const float *zbufrect);
diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.h b/source/blender/compositor/operations/COM_VectorBlurOperation.h
index 7dc101c0826..acb08890e91 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.h
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_VECTORBLUROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
index 17539d2910d..2381656a289 100644
--- a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_VectorCurveOperation.h"
diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.h b/source/blender/compositor/operations/COM_VectorCurveOperation.h
index ffa8dee372e..5b704d3504f 100644
--- a/source/blender/compositor/operations/COM_VectorCurveOperation.h
+++ b/source/blender/compositor/operations/COM_VectorCurveOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_VECTORCURVEOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index 563cb819e18..0f6512de61d 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ViewerOperation.h"
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h
index d3079a1c8a2..49a2b0962d1 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_VIEWEROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_WrapOperation.cpp b/source/blender/compositor/operations/COM_WrapOperation.cpp
index 9352dac292b..c43e6961064 100644
--- a/source/blender/compositor/operations/COM_WrapOperation.cpp
+++ b/source/blender/compositor/operations/COM_WrapOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
- * Thomas Beck (plasmasolutions.de)
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_WrapOperation.h"
diff --git a/source/blender/compositor/operations/COM_WrapOperation.h b/source/blender/compositor/operations/COM_WrapOperation.h
index ddc329e2033..2e25cbd552d 100644
--- a/source/blender/compositor/operations/COM_WrapOperation.h
+++ b/source/blender/compositor/operations/COM_WrapOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_WRAPOPERATION_H__
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
index e4d893ef3de..30c1d4525ab 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_WriteBufferOperation.h"
diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h
index 81b7a2ed062..be8a8fb7159 100644
--- a/source/blender/compositor/operations/COM_WriteBufferOperation.h
+++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_WRITEBUFFEROPERATION_H__
diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cpp b/source/blender/compositor/operations/COM_ZCombineOperation.cpp
index 7c82eee2eb6..5c7472acbe8 100644
--- a/source/blender/compositor/operations/COM_ZCombineOperation.cpp
+++ b/source/blender/compositor/operations/COM_ZCombineOperation.cpp
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#include "COM_ZCombineOperation.h"
diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.h b/source/blender/compositor/operations/COM_ZCombineOperation.h
index 44071410f79..9f9ecfa57e9 100644
--- a/source/blender/compositor/operations/COM_ZCombineOperation.h
+++ b/source/blender/compositor/operations/COM_ZCombineOperation.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2011, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,9 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
- * Monique Dewanchand
+ * Copyright 2011, Blender Foundation.
*/
#ifndef __COM_ZCOMBINEOPERATION_H__
diff --git a/source/blender/datatoc/CMakeLists.txt b/source/blender/datatoc/CMakeLists.txt
index 0c68cdeb8e9..d2d91ae8664 100644
--- a/source/blender/datatoc/CMakeLists.txt
+++ b/source/blender/datatoc/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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 *****
diff --git a/source/blender/datatoc/datatoc.c b/source/blender/datatoc/datatoc.c
index ffccca98f99..454c0a5d0e7 100644
--- a/source/blender/datatoc/datatoc.c
+++ b/source/blender/datatoc/datatoc.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/datatoc/datatoc.c
- * \ingroup datatoc
+/** \file
+ * \ingroup datatoc
*/
#include <stdio.h>
diff --git a/source/blender/datatoc/datatoc_icon.c b/source/blender/datatoc/datatoc_icon.c
index e5f82ae09c8..f63686d0136 100644
--- a/source/blender/datatoc/datatoc_icon.c
+++ b/source/blender/datatoc/datatoc_icon.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/datatoc/datatoc_icon.c
- * \ingroup datatoc
+/** \file
+ * \ingroup datatoc
*/
#include <stdio.h>
@@ -50,10 +46,6 @@
# define SEP '/'
#endif
-#if defined(_MSC_VER)
-# define __func__ __FUNCTION__
-#endif
-
/* -------------------------------------------------------------------- */
/* Utility functions */
diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 884f1d272a5..9a619ef560d 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2014, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Joshua Leung, Lukas Toenne
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -52,18 +47,21 @@ set(SRC
intern/builder/deg_builder_relations_keys.cc
intern/builder/deg_builder_relations_rig.cc
intern/builder/deg_builder_relations_view_layer.cc
+ intern/builder/deg_builder_rna.cc
intern/builder/deg_builder_transitive.cc
+ intern/debug/deg_debug.cc
intern/debug/deg_debug_relations_graphviz.cc
intern/debug/deg_debug_stats_gnuplot.cc
intern/eval/deg_eval.cc
intern/eval/deg_eval_copy_on_write.cc
intern/eval/deg_eval_flush.cc
intern/eval/deg_eval_stats.cc
- intern/nodes/deg_node.cc
- intern/nodes/deg_node_component.cc
- intern/nodes/deg_node_id.cc
- intern/nodes/deg_node_operation.cc
- intern/nodes/deg_node_time.cc
+ intern/node/deg_node.cc
+ intern/node/deg_node_component.cc
+ intern/node/deg_node_factory.cc
+ intern/node/deg_node_id.cc
+ intern/node/deg_node_operation.cc
+ intern/node/deg_node_time.cc
intern/depsgraph.cc
intern/depsgraph_build.cc
intern/depsgraph_debug.cc
@@ -74,7 +72,8 @@ set(SRC
intern/depsgraph_query_foreach.cc
intern/depsgraph_query_iter.cc
intern/depsgraph_tag.cc
- intern/depsgraph_type_defines.cc
+ intern/depsgraph_type.cc
+ intern/depsgraph_update.cc
DEG_depsgraph.h
DEG_depsgraph_build.h
@@ -89,22 +88,25 @@ set(SRC
intern/builder/deg_builder_pchanmap.h
intern/builder/deg_builder_relations.h
intern/builder/deg_builder_relations_impl.h
+ intern/builder/deg_builder_rna.h
intern/builder/deg_builder_transitive.h
+ intern/debug/deg_debug.h
intern/eval/deg_eval.h
intern/eval/deg_eval_copy_on_write.h
intern/eval/deg_eval_flush.h
intern/eval/deg_eval_stats.h
- intern/nodes/deg_node.h
- intern/nodes/deg_node_component.h
- intern/nodes/deg_node_id.h
- intern/nodes/deg_node_operation.h
- intern/nodes/deg_node_time.h
+ intern/node/deg_node.h
+ intern/node/deg_node_component.h
+ intern/node/deg_node_factory.h
+ intern/node/deg_node_factory_impl.h
+ intern/node/deg_node_id.h
+ intern/node/deg_node_operation.h
+ intern/node/deg_node_time.h
intern/depsgraph.h
- intern/depsgraph_intern.h
- intern/depsgraph_types.h
-
- util/deg_util_foreach.h
- util/deg_util_function.h
+ intern/depsgraph_physics.h
+ intern/depsgraph_tag.h
+ intern/depsgraph_type.h
+ intern/depsgraph_update.h
)
if(WITH_BOOST)
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index 410f5554069..9770c7d49a3 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/DEG_depsgraph.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Public API for Depsgraph
*
@@ -37,8 +30,6 @@
* to determine the set of operations need to ensure that all data has been
* correctly evaluated in response to changes, based on dependencies and visibility
* of affected data.
- *
- *
* Evaluation Engine
* =================
*
@@ -79,12 +70,10 @@ typedef enum eEvaluationMode {
enum {
/* Regardless to curve->path animation flag path is to be evaluated anyway,
* to meet dependencies with such a things as curve modifier and other guys
- * who're using curve deform, where_on_path and so.
- */
+ * who're using curve deform, where_on_path and so. */
DAG_EVAL_NEED_CURVE_PATH = (1 << 0),
/* A shrinkwrap modifier or constraint targeting this mesh needs information
- * about non-manifold boundary edges for the Target Normal Project mode.
- */
+ * about non-manifold boundary edges for the Target Normal Project mode. */
DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY = (1 << 1),
};
@@ -137,6 +126,7 @@ void DEG_graph_id_tag_update(struct Main *bmain,
/* Mark a particular datablock type as having changing. This does
* not cause any updates but is used by external render engines to detect if for
* example a datablock was removed. */
+void DEG_graph_id_type_tag(struct Depsgraph *depsgraph, short id_type);
void DEG_id_type_tag(struct Main *bmain, short id_type);
void DEG_ids_clear_recalc(struct Main *bmain, Depsgraph *depsgraph);
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index a81dd4c8852..62315391e95 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/DEG_depsgraph_build.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Public API for Depsgraph
*/
@@ -41,8 +34,9 @@ struct Depsgraph;
/* ------------------------------------------------ */
struct CacheFile;
-struct EffectorWeights;
struct Collection;
+struct CustomData_MeshMasks;
+struct EffectorWeights;
struct ID;
struct Main;
struct ModifierData;
@@ -89,12 +83,10 @@ struct DepsNodeHandle;
typedef enum eDepsSceneComponentType {
/* Parameters Component - Default when nothing else fits
- * (i.e. just SDNA property setting).
- */
+ * (i.e. just SDNA property setting). */
DEG_SCENE_COMP_PARAMETERS,
/* Animation Component
- * TODO(sergey): merge in with parameters?
- */
+ * TODO(sergey): merge in with parameters? */
DEG_SCENE_COMP_ANIMATION,
/* Sequencer Component (Scene Only). */
DEG_SCENE_COMP_SEQUENCER,
@@ -102,17 +94,14 @@ typedef enum eDepsSceneComponentType {
typedef enum eDepsObjectComponentType {
/* Parameters Component - Default when nothing else fits
- * (i.e. just SDNA property setting).
- */
+ * (i.e. just SDNA property setting). */
DEG_OB_COMP_PARAMETERS,
/* Generic "Proxy-Inherit" Component.
- * TODO(sergey): Also for instancing of subgraphs?
- */
+ * TODO(sergey): Also for instancing of subgraphs? */
DEG_OB_COMP_PROXY,
/* Animation Component.
*
- * TODO(sergey): merge in with parameters?
- */
+ * TODO(sergey): merge in with parameters? */
DEG_OB_COMP_ANIMATION,
/* Transform Component (Parenting/Constraints) */
DEG_OB_COMP_TRANSFORM,
@@ -155,16 +144,25 @@ void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
struct ID *id,
const char *description);
+/* Special function which is used from modifiers' updateDepsgraph() callback
+ * to indicate that the modifietr needs to know transformation of the object
+ * which that modifier belongs to.
+ * This function will take care of checking which operation is required to
+ * have transformation for the modifier, taking into account possible simulation
+ * solvers. */
+void DEG_add_modifier_to_transform_relation(
+ struct DepsNodeHandle *node_handle,
+ const char *description);
+
/* Adds relations from the given component of a given object to the given node
- * handle AND the component to the point cache component of the node's ID.
- */
+ * handle AND the component to the point cache component of the node's ID. */
void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
struct Object *object,
eDepsObjectComponentType component,
const char *description);
void DEG_add_special_eval_flag(struct DepsNodeHandle *handle, struct ID *id, uint32_t flag);
-void DEG_add_customdata_mask(struct DepsNodeHandle *handle, struct Object *object, uint64_t mask);
+void DEG_add_customdata_mask(struct DepsNodeHandle *handle, struct Object *object, const struct CustomData_MeshMasks *masks);
struct ID *DEG_get_id_from_handle(struct DepsNodeHandle *node_handle);
struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *node_handle);
diff --git a/source/blender/depsgraph/DEG_depsgraph_debug.h b/source/blender/depsgraph/DEG_depsgraph_debug.h
index 7c0f9ef3121..bdf612606f0 100644
--- a/source/blender/depsgraph/DEG_depsgraph_debug.h
+++ b/source/blender/depsgraph/DEG_depsgraph_debug.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Lukas Toenne
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/DEG_depsgraph_debug.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Public API for Querying and Filtering Depsgraph
*/
diff --git a/source/blender/depsgraph/DEG_depsgraph_physics.h b/source/blender/depsgraph/DEG_depsgraph_physics.h
index 642b3cbfc30..d4780a989d8 100644
--- a/source/blender/depsgraph/DEG_depsgraph_physics.h
+++ b/source/blender/depsgraph/DEG_depsgraph_physics.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/DEG_depsgraph_physics.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Physics utilities for effectors and collision.
*/
@@ -32,9 +28,8 @@
#include "DEG_depsgraph.h"
-struct Colllection;
-struct Depsgraph;
struct DepsNodeHandle;
+struct Depsgraph;
struct EffectorWeights;
struct ListBase;
struct Object;
@@ -48,7 +43,7 @@ typedef enum ePhysicsRelationType {
DEG_PHYSICS_COLLISION = 1,
DEG_PHYSICS_SMOKE_COLLISION = 2,
DEG_PHYSICS_DYNAMIC_BRUSH = 3,
- DEG_PHYSICS_RELATIONS_NUM = 4
+ DEG_PHYSICS_RELATIONS_NUM = 4,
} ePhysicsRelationType;
/* Get collision/effector relations from collection or entire scene. These
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index 11a4ebee8c6..11732c55a99 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/DEG_depsgraph_query.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Public API for Querying and Filtering Depsgraph.
*/
@@ -38,8 +31,9 @@
struct ID;
-struct Base;
struct BLI_Iterator;
+struct Base;
+struct CustomData_MeshMasks;
struct Depsgraph;
struct DupliObject;
struct ListBase;
@@ -73,9 +67,10 @@ bool DEG_id_type_any_updated(const struct Depsgraph *depsgraph);
/* Get additional evaluation flags for the given ID. */
uint32_t DEG_get_eval_flags_for_id(const struct Depsgraph *graph, struct ID *id);
-/* Get additional mesh CustomDataMask flags for the given object. */
-uint64_t DEG_get_customdata_mask_for_object(const struct Depsgraph *graph,
- struct Object *object);
+/* Get additional mesh CustomData_MeshMasks flags for the given object. */
+void DEG_get_customdata_mask_for_object(const struct Depsgraph *graph,
+ struct Object *object,
+ struct CustomData_MeshMasks *r_mask);
/* Get scene the despgraph is created for. */
struct Scene *DEG_get_evaluated_scene(const struct Depsgraph *graph);
@@ -129,12 +124,10 @@ typedef struct DEGObjectIterData {
/* Next duplicated object to step into. */
struct DupliObject *dupli_object_next;
/* Corresponds to current object: current iterator object is evaluated from
- * this duplicated object.
- */
+ * this duplicated object. */
struct DupliObject *dupli_object_current;
/* Temporary storage to report fully populated DNA to the render engine or
- * other users of the iterator.
- */
+ * other users of the iterator. */
struct Object temp_dupli_object;
/* **** Iteration over ID nodes **** */
@@ -155,7 +148,7 @@ void DEG_iterator_objects_end(struct BLI_Iterator *iter);
{ \
DEGObjectIterData data_ = { \
graph_, \
- flag_ \
+ flag_, \
}; \
\
ITER_BEGIN(DEG_iterator_objects_begin, \
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc
index ab3ca9f70cf..b6e516ee9b4 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,20 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#include "intern/builder/deg_builder.h"
+#include <cstring>
+
#include "DNA_anim_types.h"
-#include "DNA_object_types.h"
+#include "DNA_layer_types.h"
#include "DNA_ID.h"
+#include "DNA_object_types.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
@@ -43,19 +39,90 @@ extern "C" {
}
#include "intern/depsgraph.h"
-#include "intern/depsgraph_types.h"
+#include "intern/depsgraph_tag.h"
+#include "intern/depsgraph_type.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_operation.h"
#include "DEG_depsgraph.h"
namespace DEG {
+/*******************************************************************************
+ * Base class for builders.
+ */
+
+namespace {
+
+struct VisibilityCheckData {
+ eEvaluationMode eval_mode;
+ bool is_visibility_animated;
+};
+
+void visibility_animated_check_cb(ID * /*id*/, FCurve *fcu, void *user_data)
+{
+ VisibilityCheckData *data =
+ reinterpret_cast<VisibilityCheckData *>(user_data);
+ if (data->is_visibility_animated) {
+ return;
+ }
+ if (data->eval_mode == DAG_EVAL_VIEWPORT) {
+ if (STREQ(fcu->rna_path, "hide_viewport")) {
+ data->is_visibility_animated = true;
+ }
+ }
+ else if (data->eval_mode == DAG_EVAL_RENDER) {
+ if (STREQ(fcu->rna_path, "hide_render")) {
+ data->is_visibility_animated = true;
+ }
+ }
+}
+
+bool is_object_visibility_animated(const Depsgraph *graph, Object *object)
+{
+ AnimData *anim_data = BKE_animdata_from_id(&object->id);
+ if (anim_data == NULL) {
+ return false;
+ }
+ VisibilityCheckData data;
+ data.eval_mode = graph->mode;
+ data.is_visibility_animated = false;
+ BKE_fcurves_id_cb(&object->id, visibility_animated_check_cb, &data);
+ return data.is_visibility_animated;
+}
+
+} // namespace
+
+bool deg_check_base_available_for_build(const Depsgraph *graph, Base *base)
+{
+ const int base_flag = (graph->mode == DAG_EVAL_VIEWPORT) ?
+ BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER;
+ if (base->flag & base_flag) {
+ return true;
+ }
+ if (is_object_visibility_animated(graph, base->object)) {
+ return true;
+ }
+ return false;
+}
+
+DepsgraphBuilder::DepsgraphBuilder(Main *bmain, Depsgraph *graph)
+ : bmain_(bmain),
+ graph_(graph) {
+}
+
+bool DepsgraphBuilder::need_pull_base_into_graph(Base *base)
+{
+ return deg_check_base_available_for_build(graph_, base);
+}
+
+/*******************************************************************************
+ * Builder finalizer.
+ */
+
namespace {
void deg_graph_build_flush_visibility(Depsgraph *graph)
@@ -64,21 +131,21 @@ void deg_graph_build_flush_visibility(Depsgraph *graph)
DEG_NODE_VISITED = (1 << 0),
};
- BLI_Stack *stack = BLI_stack_new(sizeof(OperationDepsNode *),
+ BLI_Stack *stack = BLI_stack_new(sizeof(OperationNode *),
"DEG flush layers stack");
- foreach (IDDepsNode *id_node, graph->id_nodes) {
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ for (IDNode *id_node : graph->id_nodes) {
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
comp_node->affects_directly_visible |= id_node->is_directly_visible;
}
GHASH_FOREACH_END();
}
- foreach (OperationDepsNode *op_node, graph->operations) {
+ for (OperationNode *op_node : graph->operations) {
op_node->custom_flags = 0;
op_node->num_links_pending = 0;
- foreach (DepsRelation *rel, op_node->outlinks) {
- if ((rel->from->type == DEG_NODE_TYPE_OPERATION) &&
- (rel->flag & DEPSREL_FLAG_CYCLIC) == 0)
+ for (Relation *rel : op_node->outlinks) {
+ if ((rel->from->type == NodeType::OPERATION) &&
+ (rel->flag & RELATION_FLAG_CYCLIC) == 0)
{
++op_node->num_links_pending;
}
@@ -89,21 +156,21 @@ void deg_graph_build_flush_visibility(Depsgraph *graph)
}
}
while (!BLI_stack_is_empty(stack)) {
- OperationDepsNode *op_node;
+ OperationNode *op_node;
BLI_stack_pop(stack, &op_node);
/* Flush layers to parents. */
- foreach (DepsRelation *rel, op_node->inlinks) {
- if (rel->from->type == DEG_NODE_TYPE_OPERATION) {
- OperationDepsNode *op_from = (OperationDepsNode *)rel->from;
+ for (Relation *rel : op_node->inlinks) {
+ if (rel->from->type == NodeType::OPERATION) {
+ OperationNode *op_from = (OperationNode *)rel->from;
op_from->owner->affects_directly_visible |=
op_node->owner->affects_directly_visible;
}
}
/* Schedule parent nodes. */
- foreach (DepsRelation *rel, op_node->inlinks) {
- if (rel->from->type == DEG_NODE_TYPE_OPERATION) {
- OperationDepsNode *op_from = (OperationDepsNode *)rel->from;
- if ((rel->flag & DEPSREL_FLAG_CYCLIC) == 0) {
+ for (Relation *rel : op_node->inlinks) {
+ if (rel->from->type == NodeType::OPERATION) {
+ OperationNode *op_from = (OperationNode *)rel->from;
+ if ((rel->flag & RELATION_FLAG_CYCLIC) == 0) {
BLI_assert(op_from->num_links_pending > 0);
--op_from->num_links_pending;
}
@@ -126,40 +193,33 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
/* Make sure dependencies of visible ID datablocks are visible. */
deg_graph_build_flush_visibility(graph);
/* Re-tag IDs for update if it was tagged before the relations
- * update tag.
- */
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ * update tag. */
+ for (IDNode *id_node : graph->id_nodes) {
ID *id = id_node->id_orig;
id_node->finalize_build(graph);
int flag = 0;
- if ((id->recalc & ID_RECALC_ALL)) {
- AnimData *adt = BKE_animdata_from_id(id);
- if (adt != NULL && (adt->recalc & ADT_RECALC_ANIM) != 0) {
- flag |= ID_RECALC_ANIMATION;
- }
- }
/* Tag rebuild if special evaluation flags changed. */
if (id_node->eval_flags != id_node->previous_eval_flags) {
flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
}
/* Tag rebuild if the custom data mask changed. */
- if (id_node->customdata_mask != id_node->previous_customdata_mask) {
+ if (id_node->customdata_masks != id_node->previous_customdata_masks) {
flag |= ID_RECALC_GEOMETRY;
}
if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
flag |= ID_RECALC_COPY_ON_WRITE;
/* This means ID is being added to the dependency graph first
- * time, which is similar to "ob-visible-change"
- */
+ * time, which is similar to "ob-visible-change" */
if (GS(id->name) == ID_OB) {
flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
}
}
if (flag != 0) {
- DEG_graph_id_tag_update(bmain,
- (::Depsgraph *)graph,
- id_node->id_orig,
- flag);
+ graph_id_tag_update(bmain,
+ graph,
+ id_node->id_orig,
+ flag,
+ DEG_UPDATE_SOURCE_RELATIONS);
}
}
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.h b/source/blender/depsgraph/intern/builder/deg_builder.h
index c7ff668504c..2461ca2211f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,35 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
+struct Base;
struct Main;
namespace DEG {
struct Depsgraph;
+class DepsgraphBuilder {
+public:
+ bool need_pull_base_into_graph(struct Base *base);
+
+protected:
+ DepsgraphBuilder(Main *bmain, Depsgraph *graph);
+
+ /* State which never changes, same for the whole builder time. */
+ Main *bmain_;
+ Depsgraph *graph_;
+};
+
+bool deg_check_base_available_for_build(const Depsgraph *graph,
+ Base *base);
void deg_graph_build_finalize(struct Main *bmain, struct Depsgraph *graph);
} // namespace DEG
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
index a8768c899ad..a6d86f5178f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_cycle.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#include "intern/builder/deg_builder_cycle.h"
@@ -36,11 +30,9 @@
#include "BLI_utildefines.h"
#include "BLI_stack.h"
-#include "util/deg_util_foreach.h"
-
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_operation.h"
#include "intern/depsgraph.h"
@@ -48,19 +40,19 @@ namespace DEG {
namespace {
-typedef enum eCyclicCheckVisitedState {
+enum eCyclicCheckVisitedState {
/* Not is not visited at all during traversal. */
NODE_NOT_VISITED = 0,
/* Node has been visited during traversal and not in current stack. */
NODE_VISITED = 1,
/* Node has been visited during traversal and is in current stack. */
NODE_IN_STACK = 2,
-} eCyclicCheckVisitedState;
+};
struct StackEntry {
- OperationDepsNode *node;
+ OperationNode *node;
StackEntry *from;
- DepsRelation *via_relation;
+ Relation *via_relation;
};
struct CyclesSolverState {
@@ -83,28 +75,28 @@ struct CyclesSolverState {
int num_cycles;
};
-BLI_INLINE void set_node_visited_state(DepsNode *node,
+BLI_INLINE void set_node_visited_state(Node *node,
eCyclicCheckVisitedState state)
{
node->custom_flags = (node->custom_flags & ~0x3) | (int)state;
}
-BLI_INLINE eCyclicCheckVisitedState get_node_visited_state(DepsNode *node)
+BLI_INLINE eCyclicCheckVisitedState get_node_visited_state(Node *node)
{
return (eCyclicCheckVisitedState)(node->custom_flags & 0x3);
}
-BLI_INLINE void set_node_num_visited_children(DepsNode *node, int num_children)
+BLI_INLINE void set_node_num_visited_children(Node *node, int num_children)
{
node->custom_flags = (node->custom_flags & 0x3) | (num_children << 2);
}
-BLI_INLINE int get_node_num_visited_children(DepsNode *node)
+BLI_INLINE int get_node_num_visited_children(Node *node)
{
return node->custom_flags >> 2;
}
-void schedule_node_to_stack(CyclesSolverState *state, OperationDepsNode *node)
+void schedule_node_to_stack(CyclesSolverState *state, OperationNode *node)
{
StackEntry entry;
entry.node = node;
@@ -117,10 +109,10 @@ void schedule_node_to_stack(CyclesSolverState *state, OperationDepsNode *node)
/* Schedule leaf nodes (node without input links) for traversal. */
void schedule_leaf_nodes(CyclesSolverState *state)
{
- foreach (OperationDepsNode *node, state->graph->operations) {
+ for (OperationNode *node : state->graph->operations) {
bool has_inlinks = false;
- foreach (DepsRelation *rel, node->inlinks) {
- if (rel->from->type == DEG_NODE_TYPE_OPERATION) {
+ for (Relation *rel : node->inlinks) {
+ if (rel->from->type == NodeType::OPERATION) {
has_inlinks = true;
}
}
@@ -139,7 +131,7 @@ void schedule_leaf_nodes(CyclesSolverState *state)
*/
bool schedule_non_checked_node(CyclesSolverState *state)
{
- foreach (OperationDepsNode *node, state->graph->operations) {
+ for (OperationNode *node : state->graph->operations) {
if (get_node_visited_state(node) == NODE_NOT_VISITED) {
schedule_node_to_stack(state, node);
return true;
@@ -148,16 +140,16 @@ bool schedule_non_checked_node(CyclesSolverState *state)
return false;
}
-bool check_relation_can_murder(DepsRelation *relation)
+bool check_relation_can_murder(Relation *relation)
{
- if (relation->flag & DEPSREL_FLAG_GODMODE) {
+ if (relation->flag & RELATION_FLAG_GODMODE) {
return false;
}
return true;
}
-DepsRelation *select_relation_to_murder(DepsRelation *relation,
- StackEntry *cycle_start_entry)
+Relation *select_relation_to_murder(Relation *relation,
+ StackEntry *cycle_start_entry)
{
/* More or less russian roulette solver, which will make sure only
* specially marked relations are kept alive.
@@ -167,7 +159,7 @@ DepsRelation *select_relation_to_murder(DepsRelation *relation,
return relation;
}
StackEntry *current = cycle_start_entry;
- OperationDepsNode *to_node = (OperationDepsNode *)relation->to;
+ OperationNode *to_node = (OperationNode *)relation->to;
while (current->node != to_node) {
if (check_relation_can_murder(current->via_relation)) {
return current->via_relation;
@@ -183,13 +175,13 @@ void solve_cycles(CyclesSolverState *state)
BLI_Stack *traversal_stack = state->traversal_stack;
while (!BLI_stack_is_empty(traversal_stack)) {
StackEntry *entry = (StackEntry *)BLI_stack_peek(traversal_stack);
- OperationDepsNode *node = entry->node;
+ OperationNode *node = entry->node;
bool all_child_traversed = true;
const int num_visited = get_node_num_visited_children(node);
for (int i = num_visited; i < node->outlinks.size(); ++i) {
- DepsRelation *rel = node->outlinks[i];
- if (rel->to->type == DEG_NODE_TYPE_OPERATION) {
- OperationDepsNode *to = (OperationDepsNode *)rel->to;
+ Relation *rel = node->outlinks[i];
+ if (rel->to->type == NodeType::OPERATION) {
+ OperationNode *to = (OperationNode *)rel->to;
eCyclicCheckVisitedState to_state = get_node_visited_state(to);
if (to_state == NODE_IN_STACK) {
printf("Dependency cycle detected:\n");
@@ -206,9 +198,9 @@ void solve_cycles(CyclesSolverState *state)
current->via_relation->name);
current = current->from;
}
- DepsRelation *sacrificial_relation =
+ Relation *sacrificial_relation =
select_relation_to_murder(rel, entry);
- sacrificial_relation->flag |= DEPSREL_FLAG_CYCLIC;
+ sacrificial_relation->flag |= RELATION_FLAG_CYCLIC;
++state->num_cycles;
}
else if (to_state == NODE_NOT_VISITED) {
@@ -242,8 +234,7 @@ void deg_graph_detect_cycles(Depsgraph *graph)
/* We are not done yet. It is possible to have closed loop cycle,
* for example A -> B -> C -> A. These nodes were not scheduled
* yet (since they all have inlinks), and were not traversed since
- * nobody else points to them.
- */
+ * nobody else points to them. */
while (schedule_non_checked_node(&state)) {
solve_cycles(&state);
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cycle.h b/source/blender/depsgraph/intern/builder/deg_builder_cycle.h
index 386fbd80d19..2fe24d1795a 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_cycle.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_cycle.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_cycle.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.cc b/source/blender/depsgraph/intern/builder/deg_builder_map.cc
index 2d9719b3ad4..cc5ea98ca93 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_map.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_map.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_map.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#include "intern/builder/deg_builder_map.h"
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.h b/source/blender/depsgraph/intern/builder/deg_builder_map.h
index 5ad22a9aa77..193a7837aa6 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_map.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_map.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_map.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
@@ -41,16 +34,14 @@ public:
~BuilderMap();
/* Check whether given ID is already handled by builder (or if it's being
- * handled).
- */
+ * handled). */
bool checkIsBuilt(ID *id);
/* Tag given ID as handled/built. */
void tagBuild(ID *id);
/* Combination of previous two functions, returns truth if ID was already
- * handled, or tags is handled otherwise and return false.
- */
+ * handled, or tags is handled otherwise and return false. */
bool checkIsBuiltAndTag(ID *id);
template<typename T> bool checkIsBuilt(T *datablock) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 29a31ef4f98..dbf6b1d1451 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Based on original depsgraph.c code - Blender Foundation (2005-2013)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_nodes.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Methods for constructing depsgraph's nodes
*/
@@ -53,7 +46,7 @@ extern "C" {
#include "DNA_effect_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_mask_types.h"
#include "DNA_mesh_types.h"
@@ -80,6 +73,7 @@ extern "C" {
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_idcode.h"
+#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_lattice.h"
#include "BKE_mask.h"
@@ -106,15 +100,13 @@ extern "C" {
#include "DEG_depsgraph_build.h"
#include "intern/builder/deg_builder.h"
+#include "intern/depsgraph.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/depsgraph_types.h"
-#include "intern/depsgraph_intern.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/depsgraph_type.h"
namespace DEG {
@@ -139,8 +131,7 @@ void free_copy_on_write_datablock(void *id_info_v)
/* **** General purpose functions **** */
DepsgraphNodeBuilder::DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph)
- : bmain_(bmain),
- graph_(graph),
+ : DepsgraphBuilder(bmain, graph),
scene_(NULL),
view_layer_(NULL),
view_layer_index_(-1),
@@ -157,20 +148,20 @@ DepsgraphNodeBuilder::~DepsgraphNodeBuilder()
}
}
-IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id)
+IDNode *DepsgraphNodeBuilder::add_id_node(ID *id)
{
- IDDepsNode *id_node = NULL;
+ IDNode *id_node = NULL;
ID *id_cow = NULL;
IDComponentsMask previously_visible_components_mask = 0;
uint32_t previous_eval_flags = 0;
- uint64_t previous_customdata_mask = 0;
+ DEGCustomDataMeshMasks previous_customdata_masks;
IDInfo *id_info = (IDInfo *)BLI_ghash_lookup(id_info_hash_, id);
if (id_info != NULL) {
id_cow = id_info->id_cow;
previously_visible_components_mask =
id_info->previously_visible_components_mask;
previous_eval_flags = id_info->previous_eval_flags;
- previous_customdata_mask = id_info->previous_customdata_mask;
+ previous_customdata_masks = id_info->previous_customdata_masks;
/* Tag ID info to not free the CoW ID pointer. */
id_info->id_cow = NULL;
}
@@ -178,54 +169,51 @@ IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id)
id_node->previously_visible_components_mask =
previously_visible_components_mask;
id_node->previous_eval_flags = previous_eval_flags;
- id_node->previous_customdata_mask = previous_customdata_mask;
+ id_node->previous_customdata_masks = previous_customdata_masks;
/* Currently all ID nodes are supposed to have copy-on-write logic.
*
- * NOTE: Zero number of components indicates that ID node was just created.
- */
+ * NOTE: Zero number of components indicates that ID node was just created. */
if (BLI_ghash_len(id_node->components) == 0) {
- ComponentDepsNode *comp_cow =
- id_node->add_component(DEG_NODE_TYPE_COPY_ON_WRITE);
- OperationDepsNode *op_cow = comp_cow->add_operation(
+ ComponentNode *comp_cow =
+ id_node->add_component(NodeType::COPY_ON_WRITE);
+ OperationNode *op_cow = comp_cow->add_operation(
function_bind(deg_evaluate_copy_on_write, _1, id_node),
- DEG_OPCODE_COPY_ON_WRITE,
+ OperationCode::COPY_ON_WRITE,
"", -1);
graph_->operations.push_back(op_cow);
}
return id_node;
}
-IDDepsNode *DepsgraphNodeBuilder::find_id_node(ID *id)
+IDNode *DepsgraphNodeBuilder::find_id_node(ID *id)
{
return graph_->find_id_node(id);
}
-TimeSourceDepsNode *DepsgraphNodeBuilder::add_time_source()
+TimeSourceNode *DepsgraphNodeBuilder::add_time_source()
{
return graph_->add_time_source();
}
-ComponentDepsNode *DepsgraphNodeBuilder::add_component_node(
+ComponentNode *DepsgraphNodeBuilder::add_component_node(
ID *id,
- eDepsNode_Type comp_type,
+ NodeType comp_type,
const char *comp_name)
{
- IDDepsNode *id_node = add_id_node(id);
- ComponentDepsNode *comp_node = id_node->add_component(comp_type, comp_name);
+ IDNode *id_node = add_id_node(id);
+ ComponentNode *comp_node = id_node->add_component(comp_type, comp_name);
comp_node->owner = id_node;
return comp_node;
}
-OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(
- ComponentDepsNode *comp_node,
+OperationNode *DepsgraphNodeBuilder::add_operation_node(
+ ComponentNode *comp_node,
+ OperationCode opcode,
const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
const char *name,
int name_tag)
{
- OperationDepsNode *op_node = comp_node->find_operation(opcode,
- name,
- name_tag);
+ OperationNode *op_node = comp_node->find_operation(opcode, name, name_tag);
if (op_node == NULL) {
op_node = comp_node->add_operation(op, opcode, name, name_tag);
graph_->operations.push_back(op_node);
@@ -241,83 +229,74 @@ OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(
return op_node;
}
-OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(
+OperationNode *DepsgraphNodeBuilder::add_operation_node(
ID *id,
- eDepsNode_Type comp_type,
+ NodeType comp_type,
const char *comp_name,
+ OperationCode opcode,
const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
const char *name,
int name_tag)
{
- ComponentDepsNode *comp_node = add_component_node(id, comp_type, comp_name);
- return add_operation_node(comp_node, op, opcode, name, name_tag);
+ ComponentNode *comp_node = add_component_node(id, comp_type, comp_name);
+ return add_operation_node(comp_node, opcode, op, name, name_tag);
}
-OperationDepsNode *DepsgraphNodeBuilder::add_operation_node(
+OperationNode *DepsgraphNodeBuilder::add_operation_node(
ID *id,
- eDepsNode_Type comp_type,
+ NodeType comp_type,
+ OperationCode opcode,
const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
const char *name,
int name_tag)
{
- return add_operation_node(id,
- comp_type,
- "",
- op,
- opcode,
- name,
- name_tag);
+ return add_operation_node(
+ id, comp_type, "", opcode, op, name, name_tag);
}
-OperationDepsNode *DepsgraphNodeBuilder::ensure_operation_node(
+OperationNode *DepsgraphNodeBuilder::ensure_operation_node(
ID *id,
- eDepsNode_Type comp_type,
+ NodeType comp_type,
+ OperationCode opcode,
const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
const char *name,
int name_tag)
{
- OperationDepsNode *operation =
+ OperationNode *operation =
find_operation_node(id, comp_type, opcode, name, name_tag);
if (operation != NULL) {
return operation;
}
- return add_operation_node(id, comp_type, op, opcode, name, name_tag);
+ return add_operation_node(id, comp_type, opcode, op, name, name_tag);
}
bool DepsgraphNodeBuilder::has_operation_node(ID *id,
- eDepsNode_Type comp_type,
+ NodeType comp_type,
const char *comp_name,
- eDepsOperation_Code opcode,
+ OperationCode opcode,
const char *name,
int name_tag)
{
- return find_operation_node(id,
- comp_type,
- comp_name,
- opcode,
- name,
- name_tag) != NULL;
+ return find_operation_node(
+ id, comp_type, comp_name, opcode, name, name_tag) != NULL;
}
-OperationDepsNode *DepsgraphNodeBuilder::find_operation_node(
+OperationNode *DepsgraphNodeBuilder::find_operation_node(
ID *id,
- eDepsNode_Type comp_type,
+ NodeType comp_type,
const char *comp_name,
- eDepsOperation_Code opcode,
+ OperationCode opcode,
const char *name,
int name_tag)
{
- ComponentDepsNode *comp_node = add_component_node(id, comp_type, comp_name);
+ ComponentNode *comp_node = add_component_node(id, comp_type, comp_name);
return comp_node->find_operation(opcode, name, name_tag);
}
-OperationDepsNode *DepsgraphNodeBuilder::find_operation_node(
+OperationNode *DepsgraphNodeBuilder::find_operation_node(
ID *id,
- eDepsNode_Type comp_type,
- eDepsOperation_Code opcode,
+ NodeType comp_type,
+ OperationCode opcode,
const char *name,
int name_tag)
{
@@ -335,7 +314,7 @@ ID *DepsgraphNodeBuilder::ensure_cow_id(ID *id_orig)
/* ID is already remapped to copy-on-write. */
return id_orig;
}
- IDDepsNode *id_node = add_id_node(id_orig);
+ IDNode *id_node = add_id_node(id_orig);
return id_node->id_cow;
}
@@ -344,10 +323,9 @@ ID *DepsgraphNodeBuilder::ensure_cow_id(ID *id_orig)
void DepsgraphNodeBuilder::begin_build()
{
/* Store existing copy-on-write versions of datablock, so we can re-use
- * them for new ID nodes.
- */
+ * them for new ID nodes. */
id_info_hash_ = BLI_ghash_ptr_new("Depsgraph id hash");
- foreach (IDDepsNode *id_node, graph_->id_nodes) {
+ for (IDNode *id_node : graph_->id_nodes) {
IDInfo *id_info = (IDInfo *)MEM_mallocN(
sizeof(IDInfo), "depsgraph id info");
if (deg_copy_on_write_is_expanded(id_node->id_cow) &&
@@ -361,15 +339,15 @@ void DepsgraphNodeBuilder::begin_build()
id_info->previously_visible_components_mask =
id_node->visible_components_mask;
id_info->previous_eval_flags = id_node->eval_flags;
- id_info->previous_customdata_mask = id_node->customdata_mask;
+ id_info->previous_customdata_masks = id_node->customdata_masks;
BLI_ghash_insert(id_info_hash_, id_node->id_orig, id_info);
id_node->id_cow = NULL;
}
- GSET_FOREACH_BEGIN(OperationDepsNode *, op_node, graph_->entry_tags)
+ GSET_FOREACH_BEGIN(OperationNode *, op_node, graph_->entry_tags)
{
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
SavedEntryTag entry_tag;
entry_tag.id_orig = id_node->id_orig;
@@ -389,23 +367,23 @@ void DepsgraphNodeBuilder::begin_build()
void DepsgraphNodeBuilder::end_build()
{
- foreach (const SavedEntryTag& entry_tag, saved_entry_tags_) {
- IDDepsNode *id_node = find_id_node(entry_tag.id_orig);
+ for (const SavedEntryTag& entry_tag : saved_entry_tags_) {
+ IDNode *id_node = find_id_node(entry_tag.id_orig);
if (id_node == NULL) {
continue;
}
- ComponentDepsNode *comp_node =
+ ComponentNode *comp_node =
id_node->find_component(entry_tag.component_type);
if (comp_node == NULL) {
continue;
}
- OperationDepsNode *op_node = comp_node->find_operation(entry_tag.opcode, entry_tag.name, entry_tag.name_tag);
+ OperationNode *op_node = comp_node->find_operation(
+ entry_tag.opcode, entry_tag.name.c_str(), entry_tag.name_tag);
if (op_node == NULL) {
continue;
}
/* Since the tag is coming from a saved copy of entry tags, this means
- * that originally node was explicitly tagged for user update.
- */
+ * that originally node was explicitly tagged for user update. */
op_node->tag_update(graph_, DEG_UPDATE_SOURCE_USER_EDIT);
}
}
@@ -438,15 +416,14 @@ void DepsgraphNodeBuilder::build_id(ID *id)
*
* If this happened to be affecting visible object, then it is up to
* deg_graph_build_flush_visibility() to ensure visibility of the
- * object is true.
- */
+ * object is true. */
build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, false);
break;
case ID_KE:
build_shapekeys((Key *)id);
break;
case ID_LA:
- build_lamp((Lamp *)id);
+ build_light((Light *)id);
break;
case ID_LP:
build_lightprobe((LightProbe *)id);
@@ -479,8 +456,7 @@ void DepsgraphNodeBuilder::build_id(ID *id)
/* TODO(sergey): Get visibility from a "parent" somehow.
*
* NOTE: Similarly to above, we don't want false-positives on
- * visibility.
- */
+ * visibility. */
build_object_data_geometry_datablock(id, false);
break;
case ID_SPK:
@@ -509,7 +485,7 @@ void DepsgraphNodeBuilder::build_collection(
const bool is_collection_restricted = (collection->flag & restrict_flag);
const bool is_collection_visible =
!is_collection_restricted && is_parent_collection_visible_;
- IDDepsNode *id_node;
+ IDNode *id_node;
if (built_map_.checkIsBuiltAndTag(collection)) {
id_node = find_id_node(&collection->id);
if (is_collection_visible &&
@@ -564,10 +540,9 @@ void DepsgraphNodeBuilder::build_object(int base_index,
const bool has_object = built_map_.checkIsBuiltAndTag(object);
/* Skip rest of components if the ID node was already there. */
if (has_object) {
- IDDepsNode *id_node = find_id_node(&object->id);
+ IDNode *id_node = find_id_node(&object->id);
/* We need to build some extra stuff if object becomes linked
- * directly.
- */
+ * directly. */
if (id_node->linked_state == DEG_ID_LINKED_INDIRECTLY) {
build_object_flags(base_index, object, linked_state);
}
@@ -578,7 +553,7 @@ void DepsgraphNodeBuilder::build_object(int base_index,
return;
}
/* Create ID node for object and begin init. */
- IDDepsNode *id_node = add_id_node(&object->id);
+ IDNode *id_node = add_id_node(&object->id);
Object *object_cow = get_cow_datablock(object);
id_node->linked_state = linked_state;
if (object == scene_->camera) {
@@ -626,17 +601,14 @@ void DepsgraphNodeBuilder::build_object(int base_index,
}
/* Object data. */
build_object_data(object, is_visible);
+ /* Paramaters, used by both drivers/animation and also to inform dependency
+ * from object's data. */
+ build_parameters(&object->id);
/* Build animation data,
*
* Do it now because it's possible object data will affect
* on object's level animation, for example in case of rebuilding
- * pose for proxy.
- */
- OperationDepsNode *op_node = add_operation_node(&object->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_PARAMETERS_EVAL);
- op_node->set_as_exit();
+ * pose for proxy. */
build_animdata(&object->id);
/* Particle systems. */
if (object->particlesystem.first != NULL) {
@@ -652,25 +624,22 @@ void DepsgraphNodeBuilder::build_object(int base_index,
-1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY, is_visible);
}
/* Object dupligroup. */
- if (object->dup_group != NULL) {
+ if (object->instance_collection != NULL) {
const bool is_current_parent_collection_visible =
is_parent_collection_visible_;
is_parent_collection_visible_ = is_visible;
- build_collection(NULL, object->dup_group);
+ build_collection(NULL, object->instance_collection);
is_parent_collection_visible_ = is_current_parent_collection_visible;
- add_operation_node(&object->id,
- DEG_NODE_TYPE_DUPLI,
- NULL,
- DEG_OPCODE_PLACEHOLDER,
- "Dupli");
+ add_operation_node(
+ &object->id, NodeType::DUPLI, OperationCode::DUPLI);
}
/* Syncronization back to original object. */
add_operation_node(&object->id,
- DEG_NODE_TYPE_SYNCHRONIZE,
+ NodeType::SYNCHRONIZATION,
+ OperationCode::SYNCHRONIZE_TO_ORIGINAL,
function_bind(BKE_object_synchronize_to_original,
_1,
- object_cow),
- DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL);
+ object_cow));
}
void DepsgraphNodeBuilder::build_object_flags(
@@ -686,14 +655,14 @@ void DepsgraphNodeBuilder::build_object_flags(
const bool is_from_set = (linked_state == DEG_ID_LINKED_VIA_SET);
/* TODO(sergey): Is this really best component to be used? */
add_operation_node(&object->id,
- DEG_NODE_TYPE_OBJECT_FROM_LAYER,
- function_bind(BKE_object_eval_flush_base_flags,
+ NodeType::OBJECT_FROM_LAYER,
+ OperationCode::OBJECT_BASE_FLAGS,
+ function_bind(BKE_object_eval_eval_base_flags,
_1,
scene_cow,
view_layer_index_,
object_cow, base_index,
- is_from_set),
- DEG_OPCODE_OBJECT_BASE_FLAGS);
+ is_from_set));
}
void DepsgraphNodeBuilder::build_object_data(
@@ -722,7 +691,7 @@ void DepsgraphNodeBuilder::build_object_data(
}
break;
case OB_LAMP:
- build_object_data_lamp(object);
+ build_object_data_light(object);
break;
case OB_CAMERA:
build_object_data_camera(object);
@@ -750,72 +719,64 @@ void DepsgraphNodeBuilder::build_object_data_camera(Object *object)
build_camera(camera);
}
-void DepsgraphNodeBuilder::build_object_data_lamp(Object *object)
+void DepsgraphNodeBuilder::build_object_data_light(Object *object)
{
- Lamp *lamp = (Lamp *)object->data;
- build_lamp(lamp);
+ Light *lamp = (Light *)object->data;
+ build_light(lamp);
}
void DepsgraphNodeBuilder::build_object_data_lightprobe(Object *object)
{
LightProbe *probe = (LightProbe *)object->data;
build_lightprobe(probe);
- add_operation_node(&object->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_LIGHT_PROBE_EVAL);
+ add_operation_node(
+ &object->id, NodeType::PARAMETERS, OperationCode::LIGHT_PROBE_EVAL);
}
void DepsgraphNodeBuilder::build_object_data_speaker(Object *object)
{
Speaker *speaker = (Speaker *)object->data;
build_speaker(speaker);
- add_operation_node(&object->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_SPEAKER_EVAL);
+ add_operation_node(
+ &object->id, NodeType::PARAMETERS, OperationCode::SPEAKER_EVAL);
}
void DepsgraphNodeBuilder::build_object_transform(Object *object)
{
- OperationDepsNode *op_node;
+ OperationNode *op_node;
Object *ob_cow = get_cow_datablock(object);
-
- /* local transforms (from transform channels - loc/rot/scale + deltas) */
- op_node = add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM,
- function_bind(BKE_object_eval_local_transform,
- _1,
- ob_cow),
- DEG_OPCODE_TRANSFORM_LOCAL);
+ /* Transform entry operation. */
+ op_node = add_operation_node(
+ &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_INIT);
op_node->set_as_entry();
-
- /* object parent */
+ /* Local transforms (from transform channels - loc/rot/scale + deltas). */
+ add_operation_node(&object->id, NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_LOCAL,
+ function_bind(BKE_object_eval_local_transform,
+ _1,
+ ob_cow));
+ /* Object parent. */
if (object->parent != NULL) {
- add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM,
- function_bind(BKE_object_eval_parent,
- _1,
- ob_cow),
- DEG_OPCODE_TRANSFORM_PARENT);
+ add_operation_node(&object->id, NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_PARENT,
+ function_bind(BKE_object_eval_parent, _1, ob_cow));
}
-
- /* object constraints */
+ /* Object constraints. */
if (object->constraints.first != NULL) {
build_object_constraints(object);
}
-
/* Rest of transformation update. */
- add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM,
+ add_operation_node(&object->id, NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_EVAL,
function_bind(BKE_object_eval_uber_transform,
_1,
- ob_cow),
- DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL);
-
- /* object transform is done */
- op_node = add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM,
+ ob_cow));
+ /* Object transform is done. */
+ op_node = add_operation_node(&object->id, NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_FINAL,
function_bind(BKE_object_eval_transform_final,
_1,
- ob_cow),
- DEG_OPCODE_TRANSFORM_FINAL);
+ ob_cow));
op_node->set_as_exit();
}
@@ -839,12 +800,12 @@ void DepsgraphNodeBuilder::build_object_transform(Object *object)
void DepsgraphNodeBuilder::build_object_constraints(Object *object)
{
/* create node for constraint stack */
- add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM,
+ add_operation_node(&object->id, NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_CONSTRAINTS,
function_bind(BKE_object_eval_constraints,
_1,
get_cow_datablock(scene_),
- get_cow_datablock(object)),
- DEG_OPCODE_TRANSFORM_CONSTRAINTS);
+ get_cow_datablock(object)));
}
void DepsgraphNodeBuilder::build_object_pointcache(Object *object)
@@ -855,20 +816,23 @@ void DepsgraphNodeBuilder::build_object_pointcache(Object *object)
Scene *scene_cow = get_cow_datablock(scene_);
Object *object_cow = get_cow_datablock(object);
add_operation_node(&object->id,
- DEG_NODE_TYPE_POINT_CACHE,
+ NodeType::POINT_CACHE,
+ OperationCode::POINT_CACHE_RESET,
function_bind(BKE_object_eval_ptcache_reset,
_1,
scene_cow,
- object_cow),
- DEG_OPCODE_POINT_CACHE_RESET);
+ object_cow));
}
/**
- * Build graph nodes for AnimData block
+ * Build graph nodes for AnimData block and any animated images used.
* \param id: ID-Block which hosts the AnimData
*/
void DepsgraphNodeBuilder::build_animdata(ID *id)
{
+ /* Special handling for animated images/sequences. */
+ build_animation_images(id);
+ /* Regular animation. */
AnimData *adt = BKE_animdata_from_id(id);
if (adt == NULL) {
return;
@@ -876,43 +840,35 @@ void DepsgraphNodeBuilder::build_animdata(ID *id)
if (adt->action != NULL) {
build_action(adt->action);
}
- /* animation */
- if (adt->action || adt->nla_tracks.first || adt->drivers.first) {
- (void) add_id_node(id);
- ID *id_cow = get_cow_id(id);
-
- // XXX: Hook up specific update callbacks for special properties which
- // may need it...
-
- /* actions and NLA - as a single unit for now, as it gets complicated to
- * schedule otherwise.
- */
- if ((adt->action) || (adt->nla_tracks.first)) {
- /* create the node */
- add_operation_node(id, DEG_NODE_TYPE_ANIMATION,
- function_bind(BKE_animsys_eval_animdata,
- _1,
- id_cow),
- DEG_OPCODE_ANIMATION,
- id->name);
-
- /* TODO: for each channel affected, we might also want to add some
- * support for running RNA update callbacks on them
- * (which will be needed for proper handling of drivers later)
- */
- }
-
- /* NLA strips contain actions */
- LISTBASE_FOREACH (NlaTrack *, nlt, &adt->nla_tracks) {
- build_animdata_nlastrip_targets(&nlt->strips);
- }
-
- /* drivers */
- int driver_index = 0;
- LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) {
- /* create driver */
- build_driver(id, fcu, driver_index++);
- }
+ /* Make sure ID node exists. */
+ (void) add_id_node(id);
+ ID *id_cow = get_cow_id(id);
+ if (adt->action != NULL || !BLI_listbase_is_empty(&adt->nla_tracks)) {
+ OperationNode *operation_node;
+ /* Explicit entry operation. */
+ operation_node = add_operation_node(
+ id, NodeType::ANIMATION, OperationCode::ANIMATION_ENTRY);
+ operation_node->set_as_entry();
+ /* All the evaluation nodes. */
+ add_operation_node(
+ id,
+ NodeType::ANIMATION,
+ OperationCode::ANIMATION_EVAL,
+ function_bind(BKE_animsys_eval_animdata, _1, id_cow));
+ /* Explicit exit operation. */
+ operation_node = add_operation_node(
+ id, NodeType::ANIMATION, OperationCode::ANIMATION_EXIT);
+ operation_node->set_as_exit();
+ }
+ /* NLA strips contain actions. */
+ LISTBASE_FOREACH (NlaTrack *, nlt, &adt->nla_tracks) {
+ build_animdata_nlastrip_targets(&nlt->strips);
+ }
+ /* Drivers. */
+ int driver_index = 0;
+ LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) {
+ /* create driver */
+ build_driver(id, fcu, driver_index++);
}
}
@@ -928,15 +884,27 @@ void DepsgraphNodeBuilder::build_animdata_nlastrip_targets(ListBase *strips)
}
}
+/**
+ * Build graph nodes to update the current frame in image users.
+ */
+void DepsgraphNodeBuilder::build_animation_images(ID *id)
+{
+ if (BKE_image_user_id_has_animation(id)) {
+ ID *id_cow = get_cow_id(id);
+ add_operation_node(id,
+ NodeType::ANIMATION,
+ OperationCode::IMAGE_ANIMATION,
+ function_bind(BKE_image_user_id_eval_animation, _1, id_cow));
+ }
+}
+
void DepsgraphNodeBuilder::build_action(bAction *action)
{
if (built_map_.checkIsBuiltAndTag(action)) {
return;
}
- add_operation_node(&action->id,
- DEG_NODE_TYPE_ANIMATION,
- NULL,
- DEG_OPCODE_ANIMATION);
+ add_operation_node(
+ &action->id, NodeType::ANIMATION, OperationCode::ANIMATION_EVAL);
}
/**
@@ -956,9 +924,9 @@ void DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcurve, int driver_index
* the animation systems allocates an array so we can do a fast lookup
* with the driver index. */
ensure_operation_node(id,
- DEG_NODE_TYPE_PARAMETERS,
+ NodeType::PARAMETERS,
+ OperationCode::DRIVER,
function_bind(BKE_animsys_eval_driver, _1, id_cow, driver_index, driver_orig),
- DEG_OPCODE_DRIVER,
fcurve->rna_path ? fcurve->rna_path : "",
fcurve->array_index);
build_driver_variables(id, fcurve);
@@ -1008,12 +976,29 @@ void DepsgraphNodeBuilder::build_driver_id_property(ID *id,
}
const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop);
ensure_operation_node(id,
- DEG_NODE_TYPE_PARAMETERS,
+ NodeType::PARAMETERS,
+ OperationCode::ID_PROPERTY,
NULL,
- DEG_OPCODE_ID_PROPERTY,
prop_identifier);
}
+void DepsgraphNodeBuilder::build_parameters(ID *id)
+{
+ (void) add_id_node(id);
+ OperationNode *op_node;
+ /* Explicit entry. */
+ op_node = add_operation_node(
+ id, NodeType::PARAMETERS, OperationCode::PARAMETERS_ENTRY);
+ op_node->set_as_entry();
+ /* Generic evaluation node. */
+ add_operation_node(
+ id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
+ /* Explicit exit operation. */
+ op_node = add_operation_node(
+ id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT);
+ op_node->set_as_exit();
+}
+
/* Recursively build graph for world */
void DepsgraphNodeBuilder::build_world(World *world)
{
@@ -1025,11 +1010,9 @@ void DepsgraphNodeBuilder::build_world(World *world)
World *world_cow = get_cow_datablock(world);
/* Shading update. */
add_operation_node(&world->id,
- DEG_NODE_TYPE_SHADING,
- function_bind(BKE_world_eval,
- _1,
- world_cow),
- DEG_OPCODE_WORLD_UPDATE);
+ NodeType::SHADING,
+ OperationCode::WORLD_UPDATE,
+ function_bind(BKE_world_eval, _1, world_cow));
/* Animation. */
build_animdata(&world->id);
/* World's nodetree. */
@@ -1055,53 +1038,60 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene)
* and/or not affected by the sim for instance).
*
* 3) "Pull Results" - grab the specific transforms applied for a specific
- * object - performed as part of object's transform-stack building.
- */
+ * object - performed as part of object's transform-stack building. */
/* Create nodes --------------------------------------------------------- */
/* XXX: is this the right component, or do we want to use another one
- * instead?
- */
-
- /* init/rebuild operation */
- /*OperationDepsNode *init_node =*/ add_operation_node(
- &scene->id, DEG_NODE_TYPE_TRANSFORM,
- function_bind(BKE_rigidbody_rebuild_sim, _1, scene_cow),
- DEG_OPCODE_RIGIDBODY_REBUILD);
-
- /* do-sim operation */
- // XXX: what happens if we need to split into several groups?
- OperationDepsNode *sim_node = add_operation_node(
- &scene->id, DEG_NODE_TYPE_TRANSFORM,
- function_bind(BKE_rigidbody_eval_simulation, _1, scene_cow),
- DEG_OPCODE_RIGIDBODY_SIM);
-
- /* XXX: For now, the sim node is the only one that really matters here.
- * If any other sims get added later, we may have to remove these hacks...
- */
+ * instead? */
+
+ /* Init/rebuild operation. */
+ add_operation_node(&scene->id, NodeType::TRANSFORM,
+ OperationCode::RIGIDBODY_REBUILD,
+ function_bind(BKE_rigidbody_rebuild_sim, _1, scene_cow));
+ /* Do-sim operation. */
+ OperationNode *sim_node = add_operation_node(
+ &scene->id, NodeType::TRANSFORM,
+ OperationCode::RIGIDBODY_SIM,
+ function_bind(BKE_rigidbody_eval_simulation, _1, scene_cow));
+ sim_node->set_as_entry();
+ sim_node->set_as_exit();
sim_node->owner->entry_operation = sim_node;
- sim_node->owner->exit_operation = sim_node;
-
- /* objects - simulation participants */
- if (rbw->group) {
+ /* Objects - simulation participants. */
+ if (rbw->group != NULL) {
build_collection(NULL, rbw->group);
-
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(rbw->group, object)
{
- if (object->type != OB_MESH)
+ if (object->type != OB_MESH) {
continue;
-
+ }
/* 2) create operation for flushing results */
/* object's transform component - where the rigidbody operation
* lives. */
- add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM,
+ add_operation_node(&object->id,
+ NodeType::TRANSFORM,
+ OperationCode::RIGIDBODY_TRANSFORM_COPY,
function_bind(
BKE_rigidbody_object_sync_transforms,
_1,
scene_cow,
- get_cow_datablock(object)),
- DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY);
+ get_cow_datablock(object)));
+ }
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
+ }
+ /* Constraints. */
+ if (rbw->constraints != NULL) {
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(rbw->constraints, object)
+ {
+ RigidBodyCon *rbc = object->rigidbody_constraint;
+ if (rbc == NULL || rbc->ob1 == NULL || rbc->ob2 == NULL) {
+ /* When either ob1 or ob2 is NULL, the constraint doesn't work. */
+ continue;
+ }
+ /* Make sure indirectly linked objects are fully built. */
+ build_object(-1, object, DEG_ID_LINKED_INDIRECTLY, false);
+ build_object(-1, rbc->ob1, DEG_ID_LINKED_INDIRECTLY, false);
+ build_object(-1, rbc->ob2, DEG_ID_LINKED_INDIRECTLY, false);
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}
@@ -1122,19 +1112,18 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object,
* systems.
* 2) Particle System Eval Operation - This operation node acts as a
* blackbox evaluation step for one particle system referenced by
- * the particle systems stack. All dependencies link to this operation.
- */
+ * the particle systems stack. All dependencies link to this operation. */
/* Component for all particle systems. */
- ComponentDepsNode *psys_comp =
- add_component_node(&object->id, DEG_NODE_TYPE_PARTICLE_SYSTEM);
+ ComponentNode *psys_comp =
+ add_component_node(&object->id, NodeType::PARTICLE_SYSTEM);
Object *ob_cow = get_cow_datablock(object);
- OperationDepsNode *op_node;
+ OperationNode *op_node;
op_node = add_operation_node(psys_comp,
+ OperationCode::PARTICLE_SYSTEM_INIT,
function_bind(BKE_particle_system_eval_init,
_1,
- ob_cow),
- DEG_OPCODE_PARTICLE_SYSTEM_INIT);
+ ob_cow));
op_node->set_as_entry();
/* Build all particle systems. */
LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
@@ -1145,29 +1134,42 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object,
build_particle_settings(part);
/* Particle system evaluation. */
add_operation_node(psys_comp,
+ OperationCode::PARTICLE_SYSTEM_EVAL,
NULL,
- DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
psys->name);
+ /* Keyed particle targets. */
+ if (part->phystype == PART_PHYS_KEYED) {
+ LISTBASE_FOREACH (ParticleTarget *, particle_target, &psys->targets) {
+ if (particle_target->ob == NULL ||
+ particle_target->ob == object)
+ {
+ continue;
+ }
+ build_object(-1,
+ particle_target->ob,
+ DEG_ID_LINKED_INDIRECTLY,
+ is_object_visible);
+ }
+ }
/* Visualization of particle system. */
switch (part->ren_as) {
case PART_DRAW_OB:
- if (part->dup_ob != NULL) {
+ if (part->instance_object != NULL) {
build_object(-1,
- part->dup_ob,
+ part->instance_object,
DEG_ID_LINKED_INDIRECTLY,
is_object_visible);
}
break;
case PART_DRAW_GR:
- if (part->dup_group != NULL) {
- build_collection(NULL, part->dup_group);
+ if (part->instance_collection != NULL) {
+ build_collection(NULL, part->instance_collection);
}
break;
}
}
- op_node = add_operation_node(psys_comp,
- NULL,
- DEG_OPCODE_PARTICLE_SYSTEM_DONE);
+ op_node = add_operation_node(
+ psys_comp, OperationCode::PARTICLE_SYSTEM_DONE);
op_node->set_as_exit();
}
@@ -1183,22 +1185,20 @@ void DepsgraphNodeBuilder::build_particle_settings(
/* Animation data. */
build_animdata(&particle_settings->id);
/* Parameters change. */
- OperationDepsNode *op_node;
+ OperationNode *op_node;
op_node = add_operation_node(&particle_settings->id,
- DEG_NODE_TYPE_PARTICLE_SETTINGS,
- NULL,
- DEG_OPCODE_PARTICLE_SETTINGS_INIT);
+ NodeType::PARTICLE_SETTINGS,
+ OperationCode::PARTICLE_SETTINGS_INIT);
op_node->set_as_entry();
add_operation_node(&particle_settings->id,
- DEG_NODE_TYPE_PARTICLE_SETTINGS,
+ NodeType::PARTICLE_SETTINGS,
+ OperationCode::PARTICLE_SETTINGS_RESET,
function_bind(BKE_particle_settings_eval_reset,
_1,
- particle_settings_cow),
- DEG_OPCODE_PARTICLE_SETTINGS_RESET);
+ particle_settings_cow));
op_node = add_operation_node(&particle_settings->id,
- DEG_NODE_TYPE_PARTICLE_SETTINGS,
- NULL,
- DEG_OPCODE_PARTICLE_SETTINGS_EVAL);
+ NodeType::PARTICLE_SETTINGS,
+ OperationCode::PARTICLE_SETTINGS_EVAL);
op_node->set_as_exit();
/* Texture slots. */
for (int mtex_index = 0; mtex_index < MAX_MTEX; ++mtex_index) {
@@ -1217,10 +1217,19 @@ void DepsgraphNodeBuilder::build_shapekeys(Key *key)
return;
}
build_animdata(&key->id);
- add_operation_node(&key->id,
- DEG_NODE_TYPE_GEOMETRY,
- NULL,
- DEG_OPCODE_GEOMETRY_SHAPEKEY);
+ /* This is an exit operation for the entire key datablock, is what is used
+ * as dependency for modifiers evaluation. */
+ add_operation_node(
+ &key->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_SHAPEKEY);
+ /* Create per-key block properties, allowing tricky inter-dependnecies for
+ * drivers evaluation. */
+ LISTBASE_FOREACH (KeyBlock *, key_block, &key->block) {
+ add_operation_node(&key->id,
+ NodeType::PARAMETERS,
+ OperationCode::PARAMETERS_EVAL,
+ NULL,
+ key_block->name);
+ }
}
/* ObData Geometry Evaluation */
@@ -1229,40 +1238,32 @@ void DepsgraphNodeBuilder::build_object_data_geometry(
Object *object,
bool is_object_visible)
{
- OperationDepsNode *op_node;
+ OperationNode *op_node;
Scene *scene_cow = get_cow_datablock(scene_);
Object *object_cow = get_cow_datablock(object);
- /* Temporary uber-update node, which does everything.
- * It is for the being we're porting old dependencies into the new system.
- * We'll get rid of this node as soon as all the granular update functions
- * are filled in.
- *
- * TODO(sergey): Get rid of this node.
- */
+ /* Entry operation, takes care of initialization, and some other
+ * relations which needs to be run prior actual geometry evaluation. */
+ op_node = add_operation_node(
+ &object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT);
+ op_node->set_as_entry();
+ /* Geometry evaluation. */
op_node = add_operation_node(&object->id,
- DEG_NODE_TYPE_GEOMETRY,
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL,
function_bind(BKE_object_eval_uber_data,
_1,
scene_cow,
- object_cow),
- DEG_OPCODE_GEOMETRY_UBEREVAL);
+ object_cow));
op_node->set_as_exit();
-
- op_node = add_operation_node(&object->id,
- DEG_NODE_TYPE_GEOMETRY,
- NULL,
- DEG_OPCODE_PLACEHOLDER,
- "Eval Init");
- op_node->set_as_entry();
/* Materials. */
if (object->totcol != 0) {
if (object->type == OB_MESH) {
add_operation_node(&object->id,
- DEG_NODE_TYPE_SHADING,
+ NodeType::SHADING,
+ OperationCode::SHADING,
function_bind(BKE_object_eval_update_shading,
_1,
- object_cow),
- DEG_OPCODE_SHADING);
+ object_cow));
}
for (int a = 1; a <= object->totcol; a++) {
Material *ma = give_current_material(object, a);
@@ -1284,7 +1285,7 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(
if (built_map_.checkIsBuiltAndTag(obdata)) {
return;
}
- OperationDepsNode *op_node;
+ OperationNode *op_node;
/* Make sure we've got an ID node before requesting CoW pointer. */
(void) add_id_node((ID *)obdata);
ID *obdata_cow = get_cow_id(obdata);
@@ -1296,45 +1297,38 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(
build_shapekeys(key);
}
/* Nodes for result of obdata's evaluation, and geometry
- * evaluation on object.
- */
+ * evaluation on object. */
const ID_Type id_type = GS(obdata->name);
switch (id_type) {
case ID_ME:
{
op_node = add_operation_node(obdata,
- DEG_NODE_TYPE_GEOMETRY,
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL,
function_bind(BKE_mesh_eval_geometry,
_1,
- (Mesh *)obdata_cow),
- DEG_OPCODE_PLACEHOLDER,
- "Geometry Eval");
+ (Mesh *)obdata_cow));
op_node->set_as_entry();
break;
}
case ID_MB:
{
- op_node = add_operation_node(obdata,
- DEG_NODE_TYPE_GEOMETRY,
- NULL,
- DEG_OPCODE_PLACEHOLDER,
- "Geometry Eval");
+ op_node = add_operation_node(
+ obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL);
op_node->set_as_entry();
break;
}
case ID_CU:
{
op_node = add_operation_node(obdata,
- DEG_NODE_TYPE_GEOMETRY,
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL,
function_bind(BKE_curve_eval_geometry,
_1,
- (Curve *)obdata_cow),
- DEG_OPCODE_PLACEHOLDER,
- "Geometry Eval");
+ (Curve *)obdata_cow));
op_node->set_as_entry();
/* Make sure objects used for bevel.taper are in the graph.
- * NOTE: This objects might be not linked to the scene.
- */
+ * NOTE: This objects might be not linked to the scene. */
Curve *cu = (Curve *)obdata;
if (cu->bevobj != NULL) {
build_object(-1,
@@ -1359,12 +1353,11 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(
case ID_LT:
{
op_node = add_operation_node(obdata,
- DEG_NODE_TYPE_GEOMETRY,
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL,
function_bind(BKE_lattice_eval_geometry,
_1,
- (Lattice *)obdata_cow),
- DEG_OPCODE_PLACEHOLDER,
- "Geometry Eval");
+ (Lattice *)obdata_cow));
op_node->set_as_entry();
break;
}
@@ -1373,12 +1366,11 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(
{
/* GPencil evaluation operations. */
op_node = add_operation_node(obdata,
- DEG_NODE_TYPE_GEOMETRY,
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL,
function_bind(BKE_gpencil_eval_geometry,
_1,
- (bGPdata *)obdata_cow),
- DEG_OPCODE_PLACEHOLDER,
- "Geometry Eval");
+ (bGPdata *)obdata_cow));
op_node->set_as_entry();
break;
}
@@ -1386,21 +1378,19 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(
BLI_assert(!"Should not happen");
break;
}
- op_node = add_operation_node(obdata, DEG_NODE_TYPE_GEOMETRY, NULL,
- DEG_OPCODE_PLACEHOLDER, "Eval Done");
+ op_node = add_operation_node(
+ obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_DONE);
op_node->set_as_exit();
/* Parameters for driver sources. */
- add_operation_node(obdata,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_PARAMETERS_EVAL);
+ add_operation_node(
+ obdata, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
/* Batch cache. */
add_operation_node(obdata,
- DEG_NODE_TYPE_BATCH_CACHE,
+ NodeType::BATCH_CACHE,
+ OperationCode::GEOMETRY_SELECT_UPDATE,
function_bind(BKE_object_data_select_update,
_1,
- obdata_cow),
- DEG_OPCODE_GEOMETRY_SELECT_UPDATE);
+ obdata_cow));
}
void DepsgraphNodeBuilder::build_armature(bArmature *armature)
@@ -1410,11 +1400,8 @@ void DepsgraphNodeBuilder::build_armature(bArmature *armature)
}
build_animdata(&armature->id);
/* Make sure pose is up-to-date with armature updates. */
- add_operation_node(&armature->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_PLACEHOLDER,
- "Armature Eval");
+ add_operation_node(
+ &armature->id, NodeType::PARAMETERS, OperationCode::ARMATURE_EVAL);
}
void DepsgraphNodeBuilder::build_camera(Camera *camera)
@@ -1422,33 +1409,29 @@ void DepsgraphNodeBuilder::build_camera(Camera *camera)
if (built_map_.checkIsBuiltAndTag(camera)) {
return;
}
- OperationDepsNode *op_node;
+ OperationNode *op_node;
build_animdata(&camera->id);
- op_node = add_operation_node(&camera->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_PARAMETERS_EVAL);
+ op_node = add_operation_node(
+ &camera->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
op_node->set_as_exit();
}
-void DepsgraphNodeBuilder::build_lamp(Lamp *lamp)
+void DepsgraphNodeBuilder::build_light(Light *lamp)
{
if (built_map_.checkIsBuiltAndTag(lamp)) {
return;
}
- OperationDepsNode *op_node;
+ OperationNode *op_node;
build_animdata(&lamp->id);
- op_node = add_operation_node(&lamp->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_PARAMETERS_EVAL);
+ op_node = add_operation_node(
+ &lamp->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
/* NOTE: We mark this node as both entry and exit. This way we have a
* node to link all dependencies for shading (which includes relation to the
- * lamp object, and incldues relation from node tree) without adding a
+ * light object, and incldues relation from node tree) without adding a
* dedicated component type. */
op_node->set_as_entry();
op_node->set_as_exit();
- /* lamp's nodetree */
+ /* light's nodetree */
build_nodetree(lamp->nodetree);
}
@@ -1466,20 +1449,17 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree)
/* Animation, */
build_animdata(&ntree->id);
/* Shading update. */
- add_operation_node(&ntree->id,
- DEG_NODE_TYPE_SHADING,
- NULL,
- DEG_OPCODE_MATERIAL_UPDATE);
+ add_operation_node(
+ &ntree->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE);
/* NOTE: We really pass original and CoW node trees here, this is how the
- * callback works. Ideally we need to find a better way for that.
- */
+ * callback works. Ideally we need to find a better way for that. */
add_operation_node(&ntree->id,
- DEG_NODE_TYPE_SHADING_PARAMETERS,
+ NodeType::SHADING_PARAMETERS,
+ OperationCode::MATERIAL_UPDATE,
function_bind(BKE_nodetree_shading_params_eval,
_1,
ntree_cow,
- ntree),
- DEG_OPCODE_MATERIAL_UPDATE);
+ ntree));
/* nodetree's nodes... */
LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) {
ID *id = bnode->id;
@@ -1502,8 +1482,7 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree)
}
else if (id_type == ID_SCE) {
/* Scenes are used by compositor trees, and handled by render
- * pipeline. No need to build dependencies for them here.
- */
+ * pipeline. No need to build dependencies for them here. */
}
else if (id_type == ID_TXT) {
/* Ignore script nodes. */
@@ -1537,11 +1516,11 @@ void DepsgraphNodeBuilder::build_material(Material *material)
Material *material_cow = get_cow_datablock(material);
/* Shading update. */
add_operation_node(&material->id,
- DEG_NODE_TYPE_SHADING,
+ NodeType::SHADING,
+ OperationCode::MATERIAL_UPDATE,
function_bind(BKE_material_eval,
_1,
- material_cow),
- DEG_OPCODE_MATERIAL_UPDATE);
+ material_cow));
/* Material animation. */
build_animdata(&material->id);
/* Material's nodetree. */
@@ -1565,9 +1544,8 @@ void DepsgraphNodeBuilder::build_texture(Tex *texture)
}
}
add_operation_node(&texture->id,
- DEG_NODE_TYPE_GENERIC_DATABLOCK,
- NULL,
- DEG_OPCODE_GENERIC_DATABLOCK_UPDATE);
+ NodeType::GENERIC_DATABLOCK,
+ OperationCode::GENERIC_DATABLOCK_UPDATE);
}
void DepsgraphNodeBuilder::build_image(Image *image) {
@@ -1575,9 +1553,8 @@ void DepsgraphNodeBuilder::build_image(Image *image) {
return;
}
add_operation_node(&image->id,
- DEG_NODE_TYPE_GENERIC_DATABLOCK,
- NULL,
- DEG_OPCODE_GENERIC_DATABLOCK_UPDATE);
+ NodeType::GENERIC_DATABLOCK,
+ OperationCode::GENERIC_DATABLOCK_UPDATE);
}
void DepsgraphNodeBuilder::build_compositor(Scene *scene)
@@ -1585,12 +1562,11 @@ void DepsgraphNodeBuilder::build_compositor(Scene *scene)
/* For now, just a plain wrapper? */
// TODO: create compositing component?
// XXX: component type undefined!
- //graph->get_node(&scene->id, NULL, DEG_NODE_TYPE_COMPOSITING, NULL);
+ //graph->get_node(&scene->id, NULL, NodeType::COMPOSITING, NULL);
/* for now, nodetrees are just parameters; compositing occurs in internals
- * of renderer...
- */
- add_component_node(&scene->id, DEG_NODE_TYPE_PARAMETERS);
+ * of renderer... */
+ add_component_node(&scene->id, NodeType::PARAMETERS);
build_nodetree(scene->nodetree);
}
@@ -1602,12 +1578,10 @@ void DepsgraphNodeBuilder::build_gpencil(bGPdata *gpd)
ID *gpd_id = &gpd->id;
/* TODO(sergey): what about multiple users of same datablock? This should
- * only get added once.
- */
+ * only get added once. */
/* The main reason Grease Pencil is included here is because the animation
- * (and drivers) need to be hosted somewhere.
- */
+ * (and drivers) need to be hosted somewhere. */
build_animdata(gpd_id);
}
@@ -1620,8 +1594,8 @@ void DepsgraphNodeBuilder::build_cachefile(CacheFile *cache_file)
/* Animation, */
build_animdata(cache_file_id);
/* Cache evaluation itself. */
- add_operation_node(cache_file_id, DEG_NODE_TYPE_CACHE, NULL,
- DEG_OPCODE_PLACEHOLDER, "Cache File Update");
+ add_operation_node(
+ cache_file_id, NodeType::CACHE, OperationCode::FILE_CACHE_UPDATE);
}
void DepsgraphNodeBuilder::build_mask(Mask *mask)
@@ -1635,14 +1609,14 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask)
build_animdata(mask_id);
/* Animation based on mask's shapes. */
add_operation_node(mask_id,
- DEG_NODE_TYPE_ANIMATION,
- function_bind(BKE_mask_eval_animation, _1, mask_cow),
- DEG_OPCODE_MASK_ANIMATION);
+ NodeType::ANIMATION,
+ OperationCode::MASK_ANIMATION,
+ function_bind(BKE_mask_eval_animation, _1, mask_cow));
/* Final mask evaluation. */
add_operation_node(mask_id,
- DEG_NODE_TYPE_PARAMETERS,
- function_bind(BKE_mask_eval_update, _1, mask_cow),
- DEG_OPCODE_MASK_EVAL);
+ NodeType::PARAMETERS,
+ OperationCode::MASK_EVAL,
+ function_bind(BKE_mask_eval_update, _1, mask_cow));
}
void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip)
@@ -1656,14 +1630,14 @@ void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip)
build_animdata(clip_id);
/* Movie clip evaluation. */
add_operation_node(clip_id,
- DEG_NODE_TYPE_PARAMETERS,
- function_bind(BKE_movieclip_eval_update, _1, clip_cow),
- DEG_OPCODE_MOVIECLIP_EVAL);
+ NodeType::PARAMETERS,
+ OperationCode::MOVIECLIP_EVAL,
+ function_bind(BKE_movieclip_eval_update, _1, clip_cow));
add_operation_node(clip_id,
- DEG_NODE_TYPE_BATCH_CACHE,
- function_bind(BKE_movieclip_eval_selection_update, _1, clip_cow),
- DEG_OPCODE_MOVIECLIP_SELECT_UPDATE);
+ NodeType::BATCH_CACHE,
+ OperationCode::MOVIECLIP_SELECT_UPDATE,
+ function_bind(BKE_movieclip_eval_selection_update, _1, clip_cow));
}
void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe)
@@ -1672,11 +1646,8 @@ void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe)
return;
}
/* Placeholder so we can add relations and tag ID node for update. */
- add_operation_node(&probe->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_LIGHT_PROBE_EVAL);
-
+ add_operation_node(
+ &probe->id, NodeType::PARAMETERS, OperationCode::LIGHT_PROBE_EVAL);
build_animdata(&probe->id);
}
@@ -1686,10 +1657,8 @@ void DepsgraphNodeBuilder::build_speaker(Speaker *speaker)
return;
}
/* Placeholder so we can add relations and tag ID node for update. */
- add_operation_node(&speaker->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_SPEAKER_EVAL);
+ add_operation_node(
+ &speaker->id, NodeType::PARAMETERS, OperationCode::SPEAKER_EVAL);
build_animdata(&speaker->id);
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index 3357f6cb0a2..d5d1ac2d33a 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,78 +15,74 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Lukas Toenne
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_nodes.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
+#include "intern/builder/deg_builder.h"
#include "intern/builder/deg_builder_map.h"
-#include "intern/depsgraph_types.h"
+#include "intern/depsgraph_type.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
#include "DEG_depsgraph.h"
-#include "intern/nodes/deg_node_id.h"
-
struct Base;
-struct bArmature;
-struct bAction;
struct CacheFile;
struct Camera;
-struct bGPdata;
-struct ListBase;
+struct Collection;
+struct FCurve;
struct GHash;
struct ID;
struct Image;
-struct FCurve;
-struct Collection;
struct Key;
-struct Lamp;
struct LayerCollection;
+struct Light;
struct LightProbe;
+struct ListBase;
+struct MTex;
struct Main;
-struct Material;
struct Mask;
-struct MTex;
+struct Material;
struct MovieClip;
-struct bNodeTree;
struct Object;
struct ParticleSettings;
struct Probe;
-struct bPoseChannel;
-struct bConstraint;
struct Scene;
struct Speaker;
struct Tex;
struct World;
+struct bAction;
+struct bArmature;
+struct bConstraint;
+struct bGPdata;
+struct bNodeTree;
+struct bPoseChannel;
struct PropertyRNA;
namespace DEG {
+struct ComponentNode;
struct Depsgraph;
-struct DepsNode;
-struct IDDepsNode;
-struct TimeSourceDepsNode;
-struct ComponentDepsNode;
-struct OperationDepsNode;
+struct IDNode;
+struct Node;
+struct OperationNode;
+struct TimeSourceNode;
-struct DepsgraphNodeBuilder {
+class DepsgraphNodeBuilder : public DepsgraphBuilder {
+public:
DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph);
~DepsgraphNodeBuilder();
/* For given original ID get ID which is created by CoW system. */
ID *get_cow_id(const ID *id_orig) const;
/* Similar to above, but for the cases when there is no ID node we create
- * one.
- */
+ * one. */
ID *ensure_cow_id(ID *id_orig);
/* Helper wrapper function which wraps get_cow_id with a needed type cast. */
@@ -106,59 +100,59 @@ struct DepsgraphNodeBuilder {
void begin_build();
void end_build();
- IDDepsNode *add_id_node(ID *id);
- IDDepsNode *find_id_node(ID *id);
- TimeSourceDepsNode *add_time_source();
+ IDNode *add_id_node(ID *id);
+ IDNode *find_id_node(ID *id);
+ TimeSourceNode *add_time_source();
- ComponentDepsNode *add_component_node(ID *id,
- eDepsNode_Type comp_type,
- const char *comp_name = "");
+ ComponentNode *add_component_node(ID *id,
+ NodeType comp_type,
+ const char *comp_name = "");
- OperationDepsNode *add_operation_node(ComponentDepsNode *comp_node,
- const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
- const char *name = "",
- int name_tag = -1);
- OperationDepsNode *add_operation_node(ID *id,
- eDepsNode_Type comp_type,
- const char *comp_name,
- const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
- const char *name = "",
- int name_tag = -1);
- OperationDepsNode *add_operation_node(ID *id,
- eDepsNode_Type comp_type,
- const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
- const char *name = "",
- int name_tag = -1);
+ OperationNode *add_operation_node(ComponentNode *comp_node,
+ OperationCode opcode,
+ const DepsEvalOperationCb& op = NULL,
+ const char *name = "",
+ int name_tag = -1);
+ OperationNode *add_operation_node(ID *id,
+ NodeType comp_type,
+ const char *comp_name,
+ OperationCode opcode,
+ const DepsEvalOperationCb& op = NULL,
+ const char *name = "",
+ int name_tag = -1);
+ OperationNode *add_operation_node(ID *id,
+ NodeType comp_type,
+ OperationCode opcode,
+ const DepsEvalOperationCb& op = NULL,
+ const char *name = "",
+ int name_tag = -1);
- OperationDepsNode *ensure_operation_node(ID *id,
- eDepsNode_Type comp_type,
- const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
- const char *name = "",
- int name_tag = -1);
+ OperationNode *ensure_operation_node(ID *id,
+ NodeType comp_type,
+ OperationCode opcode,
+ const DepsEvalOperationCb& op = NULL,
+ const char *name = "",
+ int name_tag = -1);
bool has_operation_node(ID *id,
- eDepsNode_Type comp_type,
+ NodeType comp_type,
const char *comp_name,
- eDepsOperation_Code opcode,
+ OperationCode opcode,
const char *name = "",
int name_tag = -1);
- OperationDepsNode *find_operation_node(ID *id,
- eDepsNode_Type comp_type,
- const char *comp_name,
- eDepsOperation_Code opcode,
- const char *name = "",
+ OperationNode *find_operation_node(ID *id,
+ NodeType comp_type,
+ const char *comp_name,
+ OperationCode opcode,
+ const char *name = "",
int name_tag = -1);
- OperationDepsNode *find_operation_node(ID *id,
- eDepsNode_Type comp_type,
- eDepsOperation_Code opcode,
- const char *name = "",
- int name_tag = -1);
+ OperationNode *find_operation_node(ID *id,
+ NodeType comp_type,
+ OperationCode opcode,
+ const char *name = "",
+ int name_tag = -1);
void build_id(ID *id);
void build_layer_collections(ListBase *lb);
@@ -179,7 +173,7 @@ struct DepsgraphNodeBuilder {
void build_object_data_geometry(Object *object, bool is_object_visible);
void build_object_data_geometry_datablock(ID *obdata,
bool is_object_visible);
- void build_object_data_lamp(Object *object);
+ void build_object_data_light(Object *object);
void build_object_data_lightprobe(Object *object);
void build_object_data_speaker(Object *object);
void build_object_transform(Object *object);
@@ -194,10 +188,12 @@ struct DepsgraphNodeBuilder {
void build_particle_settings(ParticleSettings *part);
void build_animdata(ID *id);
void build_animdata_nlastrip_targets(ListBase *strips);
+ void build_animation_images(ID *id);
void build_action(bAction *action);
void build_driver(ID *id, FCurve *fcurve, int driver_index);
void build_driver_variables(ID *id, FCurve *fcurve);
void build_driver_id_property(ID *id, const char *rna_path);
+ void build_parameters(ID *id);
void build_ik_pose(Object *object,
bPoseChannel *pchan,
bConstraint *con);
@@ -209,7 +205,7 @@ struct DepsgraphNodeBuilder {
void build_armature(bArmature *armature);
void build_shapekeys(Key *key);
void build_camera(Camera *camera);
- void build_lamp(Lamp *lamp);
+ void build_light(Light *lamp);
void build_nodetree(bNodeTree *ntree);
void build_material(Material *ma);
void build_texture(Tex *tex);
@@ -224,31 +220,28 @@ struct DepsgraphNodeBuilder {
void build_speaker(Speaker *speaker);
/* Per-ID information about what was already in the dependency graph.
- * Allows to re-use certain values, to speed up following evaluation.
- */
+ * Allows to re-use certain values, to speed up following evaluation. */
struct IDInfo {
/* Copy-on-written pointer of the corresponding ID. */
ID *id_cow;
/* Mask of visible components from previous state of the
- * dependency graph.
- */
+ * dependency graph. */
IDComponentsMask previously_visible_components_mask;
/* Special evaluation flag mask from the previous depsgraph. */
uint32_t previous_eval_flags;
/* Mesh CustomData mask from the previous depsgraph. */
- uint64_t previous_customdata_mask;
+ DEGCustomDataMeshMasks previous_customdata_masks;
};
protected:
/* Allows to identify an operation which was tagged for update at the time
* relations are being updated. We can not reuse operation node pointer
- * since it will change during dependency graph construction.
- */
+ * since it will change during dependency graph construction. */
struct SavedEntryTag {
ID *id_orig;
- eDepsNode_Type component_type;
- eDepsOperation_Code opcode;
- const char *name;
+ NodeType component_type;
+ OperationCode opcode;
+ string name;
int name_tag;
};
vector<SavedEntryTag> saved_entry_tags_;
@@ -267,30 +260,23 @@ protected:
bool is_reference,
void *user_data);
- /* State which never changes, same for the whole builder time. */
- Main *bmain_;
- Depsgraph *graph_;
-
/* State which demotes currently built entities. */
Scene *scene_;
ViewLayer *view_layer_;
int view_layer_index_;
/* NOTE: Collection are possibly built recursively, so be careful when
- * setting the current state.
- */
+ * setting the current state. */
Collection *collection_;
/* Accumulated flag over the hierarchy opf currently building collections.
* Denotes whether all the hierarchy from parent of collection_ to the
- * very root is visible (aka not restricted.).
- */
+ * very root is visible (aka not restricted.). */
bool is_parent_collection_visible_;
/* Indexed by original ID, values are IDInfo. */
GHash *id_info_hash_;
/* Set of IDs which were already build. Makes it easier to keep track of
- * what was already built and what was not.
- */
+ * what was already built and what was not. */
BuilderMap built_map_;
};
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
index 8c349b7067f..132600f2fdd 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Based on original depsgraph.c code - Blender Foundation (2005-2013)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Methods for constructing depsgraph's nodes
*/
@@ -58,12 +51,10 @@ extern "C" {
#include "intern/builder/deg_builder.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/depsgraph_types.h"
-#include "intern/depsgraph_intern.h"
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/depsgraph_type.h"
namespace DEG {
@@ -79,13 +70,15 @@ void DepsgraphNodeBuilder::build_pose_constraints(
data.is_parent_visible = is_object_visible;
BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data);
/* Create node for constraint stack. */
- add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
+ add_operation_node(&object->id,
+ NodeType::BONE,
+ pchan->name,
+ OperationCode::BONE_CONSTRAINTS,
function_bind(BKE_pose_constraints_evaluate,
_1,
get_cow_datablock(scene_),
get_cow_datablock(object),
- pchan_index),
- DEG_OPCODE_BONE_CONSTRAINTS);
+ pchan_index));
}
/* IK Solver Eval Steps */
@@ -101,8 +94,8 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *object,
return;
}
- if (has_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name,
- DEG_OPCODE_POSE_IK_SOLVER))
+ if (has_operation_node(&object->id, NodeType::EVAL_POSE, rootchan->name,
+ OperationCode::POSE_IK_SOLVER))
{
return;
}
@@ -110,13 +103,15 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *object,
int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan);
BLI_assert(rootchan_index != -1);
/* Operation node for evaluating/running IK Solver. */
- add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name,
+ add_operation_node(&object->id,
+ NodeType::EVAL_POSE,
+ rootchan->name,
+ OperationCode::POSE_IK_SOLVER,
function_bind(BKE_pose_iktree_evaluate,
_1,
get_cow_datablock(scene_),
get_cow_datablock(object),
- rootchan_index),
- DEG_OPCODE_POSE_IK_SOLVER);
+ rootchan_index));
}
/* Spline IK Eval Steps */
@@ -131,17 +126,18 @@ void DepsgraphNodeBuilder::build_splineik_pose(Object *object,
/* Operation node for evaluating/running Spline IK Solver.
* Store the "root bone" of this chain in the solver, so it knows where to
- * start.
- */
+ * start. */
int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan);
BLI_assert(rootchan_index != -1);
- add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name,
+ add_operation_node(&object->id,
+ NodeType::EVAL_POSE,
+ rootchan->name,
+ OperationCode::POSE_SPLINE_IK_SOLVER,
function_bind(BKE_pose_splineik_evaluate,
_1,
get_cow_datablock(scene_),
get_cow_datablock(object),
- rootchan_index),
- DEG_OPCODE_POSE_SPLINE_IK_SOLVER);
+ rootchan_index));
}
/* Pose/Armature Bones Graph */
@@ -150,7 +146,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible)
bArmature *armature = (bArmature *)object->data;
Scene *scene_cow = get_cow_datablock(scene_);
Object *object_cow = get_cow_datablock(object);
- OperationDepsNode *op_node;
+ OperationNode *op_node;
/* Animation and/or drivers linking posebones to base-armature used to
* define them.
*
@@ -158,21 +154,13 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible)
* which ideally should be able to be unique across different
* instances. Eventually, we need some type of proxy/isolation
* mechanism in-between here to ensure that we can use same rig
- * multiple times in same scene.
- */
+ * multiple times in same scene. */
/* Armature. */
build_armature(armature);
/* Rebuild pose if not up to date. */
if (object->pose == NULL || (object->pose->flag & POSE_RECALC)) {
/* By definition, no need to tag depsgraph as dirty from here, so we can pass NULL bmain. */
BKE_pose_rebuild(NULL, object, armature, true);
- /* XXX: Without this animation gets lost in certain circumstances
- * after loading file. Need to investigate further since it does
- * not happen with simple scenes..
- */
- if (object->adt) {
- object->adt->recalc |= ADT_RECALC_ANIM;
- }
}
/* Speed optimization for animation lookups. */
if (object->pose != NULL) {
@@ -199,76 +187,84 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible)
* - Acts to encapsulate the evaluation operations (base matrix + parenting,
* and constraint stack) so that they can be easily found.
* - Everything else which depends on bone-results hook up to the component
- * only so that we can redirect those to point at either the the post-IK/
- * post-constraint/post-matrix steps, as needed.
- */
+ * only so that we can redirect those to point at either the
+ * post-IK/post-constraint/post-matrix steps, as needed. */
/* Pose eval context. */
op_node = add_operation_node(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_INIT,
function_bind(BKE_pose_eval_init,
_1,
scene_cow,
- object_cow),
- DEG_OPCODE_POSE_INIT);
+ object_cow));
op_node->set_as_entry();
op_node = add_operation_node(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_INIT_IK,
function_bind(BKE_pose_eval_init_ik,
_1,
scene_cow,
- object_cow),
- DEG_OPCODE_POSE_INIT_IK);
+ object_cow));
add_operation_node(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_CLEANUP,
function_bind(BKE_pose_eval_cleanup,
_1,
scene_cow,
- object_cow),
- DEG_OPCODE_POSE_CLEANUP);
+ object_cow));
op_node = add_operation_node(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_DONE,
function_bind(BKE_pose_eval_done,
_1,
- object_cow),
- DEG_OPCODE_POSE_DONE);
+ object_cow));
op_node->set_as_exit();
/* Bones. */
int pchan_index = 0;
LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
/* Node for bone evaluation. */
- op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, NULL,
- DEG_OPCODE_BONE_LOCAL);
+ op_node = add_operation_node(&object->id,
+ NodeType::BONE,
+ pchan->name,
+ OperationCode::BONE_LOCAL);
op_node->set_as_entry();
- add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
+ add_operation_node(&object->id,
+ NodeType::BONE,
+ pchan->name,
+ OperationCode::BONE_POSE_PARENT,
function_bind(BKE_pose_eval_bone, _1,
scene_cow,
object_cow,
- pchan_index),
- DEG_OPCODE_BONE_POSE_PARENT);
+ pchan_index));
/* NOTE: Dedicated noop for easier relationship construction. */
- add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
- NULL,
- DEG_OPCODE_BONE_READY);
+ add_operation_node(&object->id,
+ NodeType::BONE,
+ pchan->name,
+ OperationCode::BONE_READY);
- op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
+ op_node = add_operation_node(&object->id,
+ NodeType::BONE,
+ pchan->name,
+ OperationCode::BONE_DONE,
function_bind(BKE_pose_bone_done,
_1,
object_cow,
- pchan_index),
- DEG_OPCODE_BONE_DONE);
+ pchan_index));
/* B-Bone shape computation - the real last step if present. */
if (pchan->bone != NULL && pchan->bone->segments > 1) {
- op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
+ op_node = add_operation_node(&object->id,
+ NodeType::BONE,
+ pchan->name,
+ OperationCode::BONE_SEGMENTS,
function_bind(BKE_pose_eval_bbone_segments, _1,
object_cow,
- pchan_index),
- DEG_OPCODE_BONE_SEGMENTS);
+ pchan_index));
}
op_node->set_as_exit();
@@ -276,9 +272,9 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible)
/* Custom properties. */
if (pchan->prop != NULL) {
add_operation_node(&object->id,
- DEG_NODE_TYPE_PARAMETERS,
+ NodeType::PARAMETERS,
+ OperationCode::PARAMETERS_EVAL,
NULL,
- DEG_OPCODE_PARAMETERS_EVAL,
pchan->name);
}
/* Build constraints. */
@@ -296,8 +292,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible)
* Unsolved Issues:
* - Care is needed to ensure that multi-headed trees work out the same
* as in ik-tree building
- * - Animated chain-lengths are a problem.
- */
+ * - Animated chain-lengths are a problem. */
LISTBASE_FOREACH (bConstraint *, con, &pchan->constraints) {
switch (con->type) {
case CONSTRAINT_TYPE_KINEMATIC:
@@ -328,7 +323,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible)
void DepsgraphNodeBuilder::build_proxy_rig(Object *object)
{
bArmature *armature = (bArmature *)object->data;
- OperationDepsNode *op_node;
+ OperationNode *op_node;
Object *object_cow = get_cow_datablock(object);
/* Sanity check. */
BLI_assert(object->pose != NULL);
@@ -340,62 +335,60 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object)
BKE_pose_update_constraint_flags(object->pose);
}
op_node = add_operation_node(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_INIT,
function_bind(BKE_pose_eval_proxy_init,
_1,
- object_cow),
- DEG_OPCODE_POSE_INIT);
+ object_cow));
op_node->set_as_entry();
int pchan_index = 0;
LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
op_node = add_operation_node(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- NULL,
- DEG_OPCODE_BONE_LOCAL);
+ OperationCode::BONE_LOCAL);
op_node->set_as_entry();
/* Bone is ready for solvers. */
add_operation_node(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- NULL,
- DEG_OPCODE_BONE_READY);
+ OperationCode::BONE_READY);
/* Bone is fully evaluated. */
op_node = add_operation_node(
&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
+ OperationCode::BONE_DONE,
function_bind(BKE_pose_eval_proxy_copy_bone,
_1,
object_cow,
- pchan_index),
- DEG_OPCODE_BONE_DONE);
+ pchan_index));
op_node->set_as_exit();
/* Custom properties. */
if (pchan->prop != NULL) {
add_operation_node(&object->id,
- DEG_NODE_TYPE_PARAMETERS,
+ NodeType::PARAMETERS,
+ OperationCode::PARAMETERS_EVAL,
NULL,
- DEG_OPCODE_PARAMETERS_EVAL,
pchan->name);
}
pchan_index++;
}
op_node = add_operation_node(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_CLEANUP,
function_bind(BKE_pose_eval_proxy_cleanup,
_1,
- object_cow),
- DEG_OPCODE_POSE_CLEANUP);
+ object_cow));
op_node = add_operation_node(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_DONE,
function_bind(BKE_pose_eval_proxy_done,
_1,
- object_cow),
- DEG_OPCODE_POSE_DONE);
+ object_cow));
op_node->set_as_exit();
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
index ce3b2538274..36a9d53d670 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Based on original depsgraph.c code - Blender Foundation (2005-2013)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Methods for constructing depsgraph's nodes
*/
@@ -42,8 +35,9 @@
#include "BLI_string.h"
extern "C" {
-#include "DNA_node_types.h"
+#include "DNA_freestyle_types.h"
#include "DNA_layer_types.h"
+#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -56,12 +50,11 @@ extern "C" {
#include "DEG_depsgraph_build.h"
#include "intern/builder/deg_builder.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/depsgraph_types.h"
-#include "intern/depsgraph_intern.h"
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/depsgraph_type.h"
namespace DEG {
@@ -90,7 +83,8 @@ void DepsgraphNodeBuilder::build_view_layer(
* only one view layer in there. */
view_layer_index_ = 0;
/* Scene ID block. */
- add_id_node(&scene->id);
+ IDNode *id_node = add_id_node(&scene->id);
+ id_node->linked_state = linked_state;
/* Time source. */
add_time_source();
/* Setup currently building context. */
@@ -99,25 +93,23 @@ void DepsgraphNodeBuilder::build_view_layer(
/* Get pointer to a CoW version of scene ID. */
Scene *scene_cow = get_cow_datablock(scene);
/* Scene objects. */
- int select_color = 1;
+ int select_id = 1;
/* NOTE: Base is used for function bindings as-is, so need to pass CoW base,
* but object is expected to be an original one. Hence we go into some
- * tricks here iterating over the view layer.
- */
+ * tricks here iterating over the view layer. */
int base_index = 0;
- const int base_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
- BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER;
- LISTBASE_FOREACH(Base *, base, &view_layer->object_bases) {
+ LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
/* object itself */
- const bool is_object_visible = (base->flag & base_flag);
- if (is_object_visible) {
- build_object(base_index,
- base->object,
- linked_state,
- is_object_visible);
+ if (need_pull_base_into_graph(base)) {
+ /* NOTE: We consider object visible even if it's currently
+ * restricted by the base/restriction flags. Otherwise its drivers
+ * will never be evaluated.
+ *
+ * TODO(sergey): Need to go more granular on visibility checks. */
+ build_object(base_index, base->object, linked_state, true);
++base_index;
}
- base->object->select_color = select_color++;
+ base->object->select_id = select_id++;
}
build_layer_collections(&view_layer->layer_collections);
if (scene->camera != NULL) {
@@ -144,31 +136,34 @@ void DepsgraphNodeBuilder::build_view_layer(
build_cachefile(cachefile);
}
/* Masks. */
- LISTBASE_FOREACH (Mask *, mask, &bmain_->mask) {
+ LISTBASE_FOREACH (Mask *, mask, &bmain_->masks) {
build_mask(mask);
}
/* Movie clips. */
- LISTBASE_FOREACH (MovieClip *, clip, &bmain_->movieclip) {
+ LISTBASE_FOREACH (MovieClip *, clip, &bmain_->movieclips) {
build_movieclip(clip);
}
/* Material override. */
if (view_layer->mat_override != NULL) {
build_material(view_layer->mat_override);
}
+ /* Freestyle collections. */
+ LISTBASE_FOREACH (FreestyleLineSet *, fls, &view_layer->freestyle_config.linesets) {
+ if (fls->group != NULL) {
+ build_collection(NULL, fls->group);
+ }
+ }
/* Collections. */
add_operation_node(&scene->id,
- DEG_NODE_TYPE_LAYER_COLLECTIONS,
+ NodeType::LAYER_COLLECTIONS,
+ OperationCode::VIEW_LAYER_EVAL,
function_bind(BKE_layer_eval_view_layer_indexed,
_1,
scene_cow,
- view_layer_index_),
- DEG_OPCODE_VIEW_LAYER_EVAL);
+ view_layer_index_));
/* Parameters evaluation for scene relations mainly. */
- add_operation_node(&scene->id,
- DEG_NODE_TYPE_PARAMETERS,
- NULL,
- DEG_OPCODE_PLACEHOLDER,
- "Scene Eval");
+ add_operation_node(
+ &scene->id, NodeType::PARAMETERS, OperationCode::SCENE_EVAL);
/* Build all set scenes. */
if (scene->set != NULL) {
ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc
index 59eb7ed8cf1..9316a15c278 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_pchanmap.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#include "intern/builder/deg_builder_pchanmap.h"
@@ -82,8 +75,7 @@ void RootPChanMap::add_bone(const char *bone, const char *root)
{
if (BLI_ghash_haskey(map_, bone)) {
/* Add new entry, but only add the root if it doesn't already
- * exist in there.
- */
+ * exist in there. */
GSet *values = (GSet *)BLI_ghash_lookup(map_, bone);
BLI_gset_add(values, (void *)root);
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h
index 233d8602fce..1fb634a8707 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_pchanmap.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
@@ -54,8 +47,7 @@ protected:
* - Values are "sets" (const char *) - not dynamically allocated.
*
* We don't use the C++ maps here, as it's more convenient to use
- * Blender's GHash and be able to compare by-value instead of by-ref.
- */
+ * Blender's GHash and be able to compare by-value instead of by-ref. */
struct GHash *map_;
};
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index c8822df28e6..161d0a9cd9f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Based on original depsgraph.c code - Blender Foundation (2005-2013)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_relations.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Methods for constructing depsgraph
*/
@@ -53,7 +46,7 @@ extern "C" {
#include "DNA_effect_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_mask_types.h"
#include "DNA_mesh_types.h"
@@ -79,6 +72,7 @@ extern "C" {
#include "BKE_effect.h"
#include "BKE_collision.h"
#include "BKE_fcurve.h"
+#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_material.h"
#include "BKE_mball.h"
@@ -104,18 +98,18 @@ extern "C" {
#include "intern/builder/deg_builder.h"
#include "intern/builder/deg_builder_pchanmap.h"
+#include "intern/debug/deg_debug.h"
+#include "intern/depsgraph_tag.h"
+#include "intern/depsgraph_physics.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/nodes/deg_node_time.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/node/deg_node_time.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/depsgraph_types.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph_type.h"
namespace DEG {
@@ -138,13 +132,11 @@ static bool python_driver_depends_on_time(ChannelDriver *driver)
if (strstr(driver->expression, "frame") != NULL) {
/* Variable `frame` depends on time. */
/* TODO(sergey): This is a bit weak, but not sure about better way of
- * handling this.
- */
+ * handling this. */
return true;
}
/* Possible indirect time relation s should be handled via variable
- * targets.
- */
+ * targets. */
return false;
}
@@ -186,24 +178,23 @@ static bool check_id_has_anim_component(ID *id)
(!BLI_listbase_is_empty(&adt->nla_tracks));
}
-static eDepsOperation_Code bone_target_opcode(ID *target,
- const char *subtarget,
- ID *id,
- const char *component_subdata,
- RootPChanMap *root_map)
+static OperationCode bone_target_opcode(ID *target,
+ const char *subtarget,
+ ID *id,
+ const char *component_subdata,
+ RootPChanMap *root_map)
{
/* Same armature. */
if (target == id) {
/* Using "done" here breaks in-chain deps, while using
* "ready" here breaks most production rigs instead.
* So, we do a compromise here, and only do this when an
- * IK chain conflict may occur.
- */
+ * IK chain conflict may occur. */
if (root_map->has_common_root(component_subdata, subtarget)) {
- return DEG_OPCODE_BONE_READY;
+ return OperationCode::BONE_READY;
}
}
- return DEG_OPCODE_BONE_DONE;
+ return OperationCode::BONE_DONE;
}
static bool bone_has_segments(Object *object, const char *bone_name)
@@ -221,13 +212,13 @@ static bool bone_has_segments(Object *object, const char *bone_name)
DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main *bmain,
Depsgraph *graph)
- : bmain_(bmain),
- graph_(graph),
- scene_(NULL)
+ : DepsgraphBuilder(bmain, graph),
+ scene_(NULL),
+ rna_node_query_(graph)
{
}
-TimeSourceDepsNode *DepsgraphRelationBuilder::get_node(
+TimeSourceNode *DepsgraphRelationBuilder::get_node(
const TimeSourceKey &key) const
{
if (key.id) {
@@ -239,24 +230,24 @@ TimeSourceDepsNode *DepsgraphRelationBuilder::get_node(
}
}
-ComponentDepsNode *DepsgraphRelationBuilder::get_node(
+ComponentNode *DepsgraphRelationBuilder::get_node(
const ComponentKey &key) const
{
- IDDepsNode *id_node = graph_->find_id_node(key.id);
+ IDNode *id_node = graph_->find_id_node(key.id);
if (!id_node) {
fprintf(stderr, "find_node component: Could not find ID %s\n",
(key.id != NULL) ? key.id->name : "<null>");
return NULL;
}
- ComponentDepsNode *node = id_node->find_component(key.type, key.name);
+ ComponentNode *node = id_node->find_component(key.type, key.name);
return node;
}
-OperationDepsNode *DepsgraphRelationBuilder::get_node(
+OperationNode *DepsgraphRelationBuilder::get_node(
const OperationKey &key) const
{
- OperationDepsNode *op_node = find_node(key);
+ OperationNode *op_node = find_node(key);
if (op_node == NULL) {
fprintf(stderr, "find_node_operation: Failed for (%s, '%s')\n",
operationCodeAsString(key.opcode), key.name);
@@ -264,19 +255,19 @@ OperationDepsNode *DepsgraphRelationBuilder::get_node(
return op_node;
}
-DepsNode *DepsgraphRelationBuilder::get_node(const RNAPathKey &key) const
+Node *DepsgraphRelationBuilder::get_node(const RNAPathKey &key)
{
- return graph_->find_node_from_pointer(&key.ptr, key.prop);
+ return rna_node_query_.find_node(&key.ptr, key.prop, key.source);
}
-OperationDepsNode *DepsgraphRelationBuilder::find_node(
+OperationNode *DepsgraphRelationBuilder::find_node(
const OperationKey &key) const
{
- IDDepsNode *id_node = graph_->find_id_node(key.id);
+ IDNode *id_node = graph_->find_id_node(key.id);
if (!id_node) {
return NULL;
}
- ComponentDepsNode *comp_node = id_node->find_component(key.component_type,
+ ComponentNode *comp_node = id_node->find_component(key.component_type,
key.component_name);
if (!comp_node) {
return NULL;
@@ -289,23 +280,54 @@ bool DepsgraphRelationBuilder::has_node(const OperationKey &key) const
return find_node(key) != NULL;
}
-void DepsgraphRelationBuilder::add_customdata_mask(Object *object, uint64_t mask)
+void DepsgraphRelationBuilder::add_modifier_to_transform_relation(
+ const DepsNodeHandle *handle,
+ const char *description)
+{
+ /* Geometry operation, this is where relation will be wired to. */
+ OperationNode *geometry_operation_node =
+ handle->node->get_entry_operation();
+ ComponentNode *geometry_component = geometry_operation_node->owner;
+ BLI_assert(geometry_component->type == NodeType::GEOMETRY);
+ IDNode *id_node = geometry_component->owner;
+ /* Transform operation, the source of the relation. */
+ ComponentNode *transform_component =
+ id_node->find_component(NodeType::TRANSFORM);
+ ID *id = geometry_operation_node->owner->owner->id_orig;
+ BLI_assert(GS(id->name) == ID_OB);
+ Object *object = reinterpret_cast<Object *>(id);
+ OperationNode *transform_operation_node = NULL;
+ if (object->rigidbody_object == NULL) {
+ transform_operation_node = transform_component->get_exit_operation();
+ }
+ else {
+ transform_operation_node = transform_component->get_operation(
+ OperationCode::TRANSFORM_EVAL);
+ }
+ /* Wire up the actual relation. */
+ add_operation_relation(
+ transform_operation_node, geometry_operation_node, description);
+}
+
+void DepsgraphRelationBuilder::add_customdata_mask(
+ Object *object,
+ const DEGCustomDataMeshMasks &customdata_masks)
{
- if (mask != 0 && object != NULL && object->type == OB_MESH) {
- DEG::IDDepsNode *id_node = graph_->find_id_node(&object->id);
+ if (customdata_masks != DEGCustomDataMeshMasks() && object != NULL && object->type == OB_MESH) {
+ DEG::IDNode *id_node = graph_->find_id_node(&object->id);
if (id_node == NULL) {
BLI_assert(!"ID should always be valid");
}
else {
- id_node->customdata_mask |= mask;
+ id_node->customdata_masks |= customdata_masks;
}
}
}
void DepsgraphRelationBuilder::add_special_eval_flag(ID *id, uint32_t flag)
{
- DEG::IDDepsNode *id_node = graph_->find_id_node(id);
+ DEG::IDNode *id_node = graph_->find_id_node(id);
if (id_node == NULL) {
BLI_assert(!"ID should always be valid");
}
@@ -314,16 +336,15 @@ void DepsgraphRelationBuilder::add_special_eval_flag(ID *id, uint32_t flag)
}
}
-DepsRelation *DepsgraphRelationBuilder::add_time_relation(
- TimeSourceDepsNode *timesrc,
- DepsNode *node_to,
+Relation *DepsgraphRelationBuilder::add_time_relation(
+ TimeSourceNode *timesrc,
+ Node *node_to,
const char *description,
- bool check_unique,
int flags)
{
if (timesrc && node_to) {
return graph_->add_new_relation(
- timesrc, node_to, description, check_unique, flags);
+ timesrc, node_to, description, flags);
}
else {
DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
@@ -335,18 +356,16 @@ DepsRelation *DepsgraphRelationBuilder::add_time_relation(
return NULL;
}
-DepsRelation *DepsgraphRelationBuilder::add_operation_relation(
- OperationDepsNode *node_from,
- OperationDepsNode *node_to,
+Relation *DepsgraphRelationBuilder::add_operation_relation(
+ OperationNode *node_from,
+ OperationNode *node_to,
const char *description,
- bool check_unique,
int flags)
{
if (node_from && node_to) {
return graph_->add_new_relation(node_from,
node_to,
description,
- check_unique,
flags);
}
else {
@@ -359,26 +378,26 @@ DepsRelation *DepsgraphRelationBuilder::add_operation_relation(
return NULL;
}
-void DepsgraphRelationBuilder::add_collision_relations(
+void DepsgraphRelationBuilder::add_particle_collision_relations(
const OperationKey &key,
Object *object,
Collection *collection,
const char *name)
{
- ListBase *relations = deg_build_collision_relations(graph_, collection, eModifierType_Collision);
+ ListBase *relations = build_collision_relations(graph_, collection, eModifierType_Collision);
LISTBASE_FOREACH (CollisionRelation *, relation, relations) {
if (relation->ob != object) {
- ComponentKey trf_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey trf_key(&relation->ob->id, NodeType::TRANSFORM);
add_relation(trf_key, key, name);
- ComponentKey coll_key(&relation->ob->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey coll_key(&relation->ob->id, NodeType::GEOMETRY);
add_relation(coll_key, key, name);
}
}
}
-void DepsgraphRelationBuilder::add_forcefield_relations(
+void DepsgraphRelationBuilder::add_particle_forcefield_relations(
const OperationKey &key,
Object *object,
ParticleSystem *psys,
@@ -386,43 +405,54 @@ void DepsgraphRelationBuilder::add_forcefield_relations(
bool add_absorption,
const char *name)
{
- ListBase *relations = deg_build_effector_relations(graph_, eff->group);
+ ListBase *relations = build_effector_relations(graph_, eff->group);
LISTBASE_FOREACH (EffectorRelation *, relation, relations) {
if (relation->ob != object) {
- ComponentKey eff_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM);
+ /* Relation to forcefield object, optionally including geometry. */
+ ComponentKey eff_key(&relation->ob->id, NodeType::TRANSFORM);
add_relation(eff_key, key, name);
+ if (ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, PFIELD_SHAPE_POINTS) ||
+ relation->pd->forcefield == PFIELD_GUIDE)
+ {
+ ComponentKey mod_key(&relation->ob->id, NodeType::GEOMETRY);
+ add_relation(mod_key, key, name);
+ }
+
+ /* Smoke flow relations. */
if (relation->pd->forcefield == PFIELD_SMOKEFLOW && relation->pd->f_source) {
ComponentKey trf_key(&relation->pd->f_source->id,
- DEG_NODE_TYPE_TRANSFORM);
+ NodeType::TRANSFORM);
add_relation(trf_key, key, "Smoke Force Domain");
ComponentKey eff_key(&relation->pd->f_source->id,
- DEG_NODE_TYPE_GEOMETRY);
+ NodeType::GEOMETRY);
add_relation(eff_key, key, "Smoke Force Domain");
}
+
+ /* Absorption forces need collision relation. */
if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) {
- add_collision_relations(key,
- object,
- NULL,
- "Force Absorption");
+ add_particle_collision_relations(key,
+ object,
+ NULL,
+ "Force Absorption");
}
}
+
if (relation->psys) {
if (relation->ob != object) {
ComponentKey eff_key(&relation->ob->id,
- DEG_NODE_TYPE_PARTICLE_SYSTEM);
+ NodeType::PARTICLE_SYSTEM);
add_relation(eff_key, key, name);
/* TODO: remove this when/if EVAL_PARTICLES is sufficient
- * for up to date particles.
- */
- ComponentKey mod_key(&relation->ob->id, DEG_NODE_TYPE_GEOMETRY);
+ * for up to date particles. */
+ ComponentKey mod_key(&relation->ob->id, NodeType::GEOMETRY);
add_relation(mod_key, key, name);
}
else if (relation->psys != psys) {
OperationKey eff_key(&relation->ob->id,
- DEG_NODE_TYPE_PARTICLE_SYSTEM,
- DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
+ NodeType::PARTICLE_SYSTEM,
+ OperationCode::PARTICLE_SYSTEM_EVAL,
relation->psys->name);
add_relation(eff_key, key, name);
}
@@ -466,7 +496,7 @@ void DepsgraphRelationBuilder::build_id(ID *id)
build_shapekeys((Key *)id);
break;
case ID_LA:
- build_lamp((Lamp *)id);
+ build_light((Light *)id);
break;
case ID_LP:
build_lightprobe((LightProbe *)id);
@@ -527,10 +557,10 @@ void DepsgraphRelationBuilder::build_collection(
}
const bool group_done = built_map_.checkIsBuiltAndTag(collection);
OperationKey object_transform_final_key(object != NULL ? &object->id : NULL,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_FINAL);
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_FINAL);
ComponentKey duplicator_key(object != NULL ? &object->id : NULL,
- DEG_NODE_TYPE_DUPLI);
+ NodeType::DUPLI);
if (!group_done) {
LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
build_object(NULL, cob->ob);
@@ -542,17 +572,16 @@ void DepsgraphRelationBuilder::build_collection(
if (object != NULL) {
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(collection, ob, graph_->mode)
{
- ComponentKey dupli_transform_key(&ob->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey dupli_transform_key(&ob->id, NodeType::TRANSFORM);
add_relation(dupli_transform_key,
object_transform_final_key,
"Dupligroup");
/* Hook to special component, to ensure proper visibility/evaluation
- * optimizations.
- */
+ * optimizations. */
add_relation(dupli_transform_key, duplicator_key, "Dupligroup");
- const eDepsNode_Type dupli_geometry_component_type =
- deg_geometry_tag_to_component(&ob->id);
- if (dupli_geometry_component_type != DEG_NODE_TYPE_UNDEFINED) {
+ const NodeType dupli_geometry_component_type =
+ geometry_tag_to_component(&ob->id);
+ if (dupli_geometry_component_type != NodeType::UNDEFINED) {
ComponentKey dupli_geometry_component_key(
&ob->id, dupli_geometry_component_type);
add_relation(dupli_geometry_component_key,
@@ -573,21 +602,20 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
return;
}
/* Object Transforms */
- eDepsOperation_Code base_op = (object->parent) ? DEG_OPCODE_TRANSFORM_PARENT
- : DEG_OPCODE_TRANSFORM_LOCAL;
- OperationKey base_op_key(&object->id, DEG_NODE_TYPE_TRANSFORM, base_op);
- OperationKey local_transform_key(&object->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_LOCAL);
- OperationKey parent_transform_key(&object->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_PARENT);
- OperationKey final_transform_key(&object->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_FINAL);
- OperationKey ob_ubereval_key(&object->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL);
+ OperationCode base_op = (object->parent) ? OperationCode::TRANSFORM_PARENT
+ : OperationCode::TRANSFORM_LOCAL;
+ OperationKey base_op_key(&object->id, NodeType::TRANSFORM, base_op);
+ OperationKey init_transform_key(
+ &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_INIT);
+ OperationKey local_transform_key(
+ &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_LOCAL);
+ OperationKey parent_transform_key(
+ &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_PARENT);
+ OperationKey final_transform_key(
+ &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_FINAL);
+ OperationKey ob_eval_key(
+ &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL);
+ add_relation(init_transform_key, local_transform_key, "Transform Init");
/* Various flags, flushing from bases/collections. */
build_object_flags(base, object);
/* Parenting. */
@@ -628,33 +656,23 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
/* Object constraints. */
if (object->constraints.first != NULL) {
OperationKey constraint_key(&object->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_CONSTRAINTS);
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_CONSTRAINTS);
/* Constraint relations. */
build_constraints(&object->id,
- DEG_NODE_TYPE_TRANSFORM,
+ NodeType::TRANSFORM,
"",
&object->constraints,
NULL);
/* operation order */
add_relation(base_op_key, constraint_key, "ObBase-> Constraint Stack");
add_relation(constraint_key, final_transform_key, "ObConstraints -> Done");
- // XXX
- add_relation(constraint_key, ob_ubereval_key, "Temp Ubereval");
- add_relation(ob_ubereval_key, final_transform_key, "Temp Ubereval");
+ add_relation(constraint_key, ob_eval_key, "Eval");
+ add_relation(ob_eval_key, final_transform_key, "Eval");
}
else {
- /* NOTE: Keep an eye here, we skip some relations here to "streamline"
- * dependencies and avoid transitive relations which causes overhead.
- * But once we get rid of uber eval node this will need reconsideration.
- */
- if (object->rigidbody_object == NULL) {
- /* Rigid body will hook up another node inbetween, so skip
- * relation here to avoid transitive relation.
- */
- add_relation(base_op_key, ob_ubereval_key, "Temp Ubereval");
- }
- add_relation(ob_ubereval_key, final_transform_key, "Temp Ubereval");
+ add_relation(base_op_key, ob_eval_key, "Eval");
+ add_relation(ob_eval_key, final_transform_key, "Eval");
}
/* Animation data */
build_animdata(&object->id);
@@ -667,29 +685,34 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
/* Proxy object to copy from. */
if (object->proxy_from != NULL) {
build_object(NULL, object->proxy_from);
- ComponentKey ob_transform_key(&object->proxy_from->id, DEG_NODE_TYPE_TRANSFORM);
- ComponentKey proxy_transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey ob_transform_key(
+ &object->proxy_from->id, NodeType::TRANSFORM);
+ ComponentKey proxy_transform_key(&object->id, NodeType::TRANSFORM);
add_relation(ob_transform_key, proxy_transform_key, "Proxy Transform");
}
if (object->proxy_group != NULL) {
build_object(NULL, object->proxy_group);
- OperationKey proxy_group_ubereval_key(&object->proxy_group->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL);
- add_relation(proxy_group_ubereval_key, final_transform_key, "Proxy Group Transform");
+ OperationKey proxy_group_eval_key(&object->proxy_group->id,
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_EVAL);
+ add_relation(proxy_group_eval_key,
+ final_transform_key,
+ "Proxy Group Transform");
}
/* Object dupligroup. */
- if (object->dup_group != NULL) {
- build_collection(NULL, object, object->dup_group);
+ if (object->instance_collection != NULL) {
+ build_collection(NULL, object, object->instance_collection);
}
/* Point caches. */
build_object_pointcache(object);
/* Syncronization back to original object. */
OperationKey synchronize_key(&object->id,
- DEG_NODE_TYPE_SYNCHRONIZE,
- DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL);
+ NodeType::SYNCHRONIZATION,
+ OperationCode::SYNCHRONIZE_TO_ORIGINAL);
add_relation(
final_transform_key, synchronize_key, "Synchronize to Original");
+ /* Parameters. */
+ build_parameters(&object->id);
}
void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object)
@@ -698,16 +721,16 @@ void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object)
return;
}
OperationKey view_layer_done_key(&scene_->id,
- DEG_NODE_TYPE_LAYER_COLLECTIONS,
- DEG_OPCODE_VIEW_LAYER_EVAL);
+ NodeType::LAYER_COLLECTIONS,
+ OperationCode::VIEW_LAYER_EVAL);
OperationKey object_flags_key(&object->id,
- DEG_NODE_TYPE_OBJECT_FROM_LAYER,
- DEG_OPCODE_OBJECT_BASE_FLAGS);
+ NodeType::OBJECT_FROM_LAYER,
+ OperationCode::OBJECT_BASE_FLAGS);
add_relation(view_layer_done_key, object_flags_key, "Base flags flush");
/* Syncronization back to original object. */
OperationKey synchronize_key(&object->id,
- DEG_NODE_TYPE_SYNCHRONIZE,
- DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL);
+ NodeType::SYNCHRONIZATION,
+ OperationCode::SYNCHRONIZE_TO_ORIGINAL);
add_relation(
object_flags_key, synchronize_key, "Synchronize to Original");
}
@@ -734,8 +757,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
{
build_object_data_geometry(object);
/* TODO(sergey): Only for until we support granular
- * update of curves.
- */
+ * update of curves. */
if (object->type == OB_FONT) {
Curve *curve = (Curve *)object->data;
if (curve->textoncurve) {
@@ -753,7 +775,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
}
break;
case OB_LAMP:
- build_object_data_lamp(object);
+ build_object_data_light(object);
break;
case OB_CAMERA:
build_object_data_camera(object);
@@ -767,8 +789,8 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
}
Key *key = BKE_key_from_object(object);
if (key != NULL) {
- ComponentKey geometry_key((ID *)object->data, DEG_NODE_TYPE_GEOMETRY);
- ComponentKey key_key(&key->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey geometry_key((ID *)object->data, NodeType::GEOMETRY);
+ ComponentKey key_key(&key->id, NodeType::GEOMETRY);
add_relation(key_key, geometry_key, "Shapekeys");
build_nested_shapekey(&object->id, key);
}
@@ -778,17 +800,17 @@ void DepsgraphRelationBuilder::build_object_data_camera(Object *object)
{
Camera *camera = (Camera *)object->data;
build_camera(camera);
- ComponentKey object_parameters_key(&object->id, DEG_NODE_TYPE_PARAMETERS);
- ComponentKey camera_parameters_key(&camera->id, DEG_NODE_TYPE_PARAMETERS);
+ ComponentKey object_parameters_key(&object->id, NodeType::PARAMETERS);
+ ComponentKey camera_parameters_key(&camera->id, NodeType::PARAMETERS);
add_relation(camera_parameters_key, object_parameters_key, "Camera -> Object");
}
-void DepsgraphRelationBuilder::build_object_data_lamp(Object *object)
+void DepsgraphRelationBuilder::build_object_data_light(Object *object)
{
- Lamp *lamp = (Lamp *)object->data;
- build_lamp(lamp);
- ComponentKey object_parameters_key(&object->id, DEG_NODE_TYPE_PARAMETERS);
- ComponentKey lamp_parameters_key(&lamp->id, DEG_NODE_TYPE_PARAMETERS);
+ Light *lamp = (Light *)object->data;
+ build_light(lamp);
+ ComponentKey lamp_parameters_key(&lamp->id, NodeType::PARAMETERS);
+ ComponentKey object_parameters_key(&object->id, NodeType::PARAMETERS);
add_relation(lamp_parameters_key, object_parameters_key, "Light -> Object");
}
@@ -797,11 +819,11 @@ void DepsgraphRelationBuilder::build_object_data_lightprobe(Object *object)
LightProbe *probe = (LightProbe *)object->data;
build_lightprobe(probe);
OperationKey probe_key(&probe->id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_LIGHT_PROBE_EVAL);
+ NodeType::PARAMETERS,
+ OperationCode::LIGHT_PROBE_EVAL);
OperationKey object_key(&object->id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_LIGHT_PROBE_EVAL);
+ NodeType::PARAMETERS,
+ OperationCode::LIGHT_PROBE_EVAL);
add_relation(probe_key, object_key, "LightProbe Update");
}
@@ -810,55 +832,58 @@ void DepsgraphRelationBuilder::build_object_data_speaker(Object *object)
Speaker *speaker = (Speaker *)object->data;
build_speaker(speaker);
OperationKey probe_key(&speaker->id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_SPEAKER_EVAL);
+ NodeType::PARAMETERS,
+ OperationCode::SPEAKER_EVAL);
OperationKey object_key(&object->id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_SPEAKER_EVAL);
+ NodeType::PARAMETERS,
+ OperationCode::SPEAKER_EVAL);
add_relation(probe_key, object_key, "Speaker Update");
}
void DepsgraphRelationBuilder::build_object_parent(Object *object)
{
- /* XXX: for now, need to use the component key (not just direct to the parent op),
- * or else the matrix doesn't get reset/
- */
- // XXX: @sergey - it would be good if we got that backwards flushing working
- // when tagging for updates.
- //OperationKey ob_key(&object->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_TRANSFORM_PARENT);
- ComponentKey ob_key(&object->id, DEG_NODE_TYPE_TRANSFORM);
-
- /* type-specific links */
+ Object *parent = object->parent;
+ ID *parent_id = &object->parent->id;
+ ComponentKey ob_key(&object->id, NodeType::TRANSFORM);
+ /* Type-specific links/ */
switch (object->partype) {
- case PARSKEL: /* Armature Deform (Virtual Modifier) */
+ /* Armature Deform (Virtual Modifier) */
+ case PARSKEL:
{
- ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey parent_key(parent_id, NodeType::TRANSFORM);
add_relation(parent_key, ob_key, "Armature Deform Parent");
break;
}
- case PARVERT1: /* Vertex Parent */
+ /* Vertex Parent */
+ case PARVERT1:
case PARVERT3:
{
- ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey parent_key(parent_id, NodeType::GEOMETRY);
add_relation(parent_key, ob_key, "Vertex Parent");
-
- /* XXX not sure what this is for or how you could be done properly - lukas */
- add_customdata_mask(object->parent, CD_MASK_ORIGINDEX);
-
- ComponentKey transform_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM);
+ /* Original index is used for optimizations of lookups for subdiv
+ * only meshes.
+ * TODO(sergey): This optimization got lost at 2.8, so either verify
+ * we can get rid of this mask here, or bring the optimization
+ * back. */
+ add_customdata_mask(object->parent,
+ DEGCustomDataMeshMasks::MaskVert(CD_MASK_ORIGINDEX) |
+ DEGCustomDataMeshMasks::MaskEdge(CD_MASK_ORIGINDEX) |
+ DEGCustomDataMeshMasks::MaskFace(CD_MASK_ORIGINDEX) |
+ DEGCustomDataMeshMasks::MaskPoly(CD_MASK_ORIGINDEX));
+ ComponentKey transform_key(parent_id, NodeType::TRANSFORM);
add_relation(transform_key, ob_key, "Vertex Parent TFM");
break;
}
- case PARBONE: /* Bone Parent */
+ /* Bone Parent */
+ case PARBONE:
{
- ComponentKey parent_bone_key(&object->parent->id,
- DEG_NODE_TYPE_BONE,
- object->parsubstr);
- OperationKey parent_transform_key(&object->parent->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_FINAL);
+ ComponentKey parent_bone_key(
+ parent_id, NodeType::BONE, object->parsubstr);
+ OperationKey parent_transform_key(parent_id,
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_FINAL);
add_relation(parent_bone_key, ob_key, "Bone Parent");
add_relation(parent_transform_key, ob_key, "Armature Parent");
break;
@@ -867,11 +892,9 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object)
default:
{
if (object->parent->type == OB_LATTICE) {
- /* Lattice Deform Parent - Virtual Modifier */
- // XXX: no virtual modifiers should be left!
- ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM);
- ComponentKey geom_key(&object->parent->id, DEG_NODE_TYPE_GEOMETRY);
-
+ /* Lattice Deform Parent - Virtual Modifier. */
+ ComponentKey parent_key(parent_id, NodeType::TRANSFORM);
+ ComponentKey geom_key(parent_id, NodeType::GEOMETRY);
add_relation(parent_key, ob_key, "Lattice Deform Parent");
add_relation(geom_key, ob_key, "Lattice Deform Parent Geom");
}
@@ -879,32 +902,41 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object)
Curve *cu = (Curve *)object->parent->data;
if (cu->flag & CU_PATH) {
- /* Follow Path */
- ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_GEOMETRY);
+ /* Follow Path. */
+ ComponentKey parent_key(parent_id, NodeType::GEOMETRY);
add_relation(parent_key, ob_key, "Curve Follow Parent");
-
- ComponentKey transform_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey transform_key(parent_id, NodeType::TRANSFORM);
add_relation(transform_key, ob_key, "Curve Follow TFM");
}
else {
- /* Standard Parent */
- ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM);
+ /* Standard Parent. */
+ ComponentKey parent_key(parent_id, NodeType::TRANSFORM);
add_relation(parent_key, ob_key, "Curve Parent");
}
}
else {
- /* Standard Parent */
- ComponentKey parent_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM);
+ /* Standard Parent. */
+ ComponentKey parent_key(parent_id, NodeType::TRANSFORM);
add_relation(parent_key, ob_key, "Parent");
}
break;
}
}
+ /* Metaballs are the odd balls here (no pun intended): they will request
+ * instance-list (formerly known as dupli-list) during evaluation. This is
+ * their way of interacting with all instanced surfaces, making a nice
+ * effect when is used form particle system. */
+ if (object->type == OB_MBALL && parent->transflag & OB_DUPLI) {
+ ComponentKey parent_geometry_key(parent_id, NodeType::GEOMETRY);
+ /* NOTE: Metaballs are evaluating geometry only after their transform,
+ * so we onl;y hook up to transform channel here. */
+ add_relation(parent_geometry_key, ob_key, "Parent");
+ }
}
void DepsgraphRelationBuilder::build_object_pointcache(Object *object)
{
- ComponentKey point_cache_key(&object->id, DEG_NODE_TYPE_POINT_CACHE);
+ ComponentKey point_cache_key(&object->id, NodeType::POINT_CACHE);
/* Different point caches are affecting different aspects of life of the
* object. We keep track of those aspects and avoid duplicate relations. */
enum {
@@ -917,34 +949,53 @@ void DepsgraphRelationBuilder::build_object_pointcache(Object *object)
int handled_components = 0;
LISTBASE_FOREACH (PTCacheID *, ptcache_id, &ptcache_id_list) {
/* Check which components needs the point cache. */
- int flag;
+ int flag = -1;
if (ptcache_id->type == PTCACHE_TYPE_RIGIDBODY) {
flag = FLAG_TRANSFORM;
- ComponentKey transform_key(&object->id,
- DEG_NODE_TYPE_TRANSFORM);
+ OperationKey transform_key(&object->id,
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_LOCAL);
add_relation(point_cache_key,
transform_key,
"Point Cache -> Rigid Body");
}
else {
flag = FLAG_GEOMETRY;
- ComponentKey geometry_key(&object->id,
- DEG_NODE_TYPE_GEOMETRY);
- add_relation(point_cache_key,
- geometry_key,
- "Point Cache -> Geometry");
+ OperationKey geometry_key(&object->id,
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL);
+ add_relation(
+ point_cache_key, geometry_key, "Point Cache -> Geometry");
}
+ BLI_assert(flag != -1);
/* Tag that we did handle that component. */
handled_components |= flag;
if (handled_components == FLAG_ALL) {
break;
}
}
+ /* Manual edits to any dependency (or self) should reset the point cache. */
+ if (!BLI_listbase_is_empty(&ptcache_id_list)) {
+ OperationKey transform_init_key(&object->id,
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_INIT);
+ OperationKey geometry_init_key(&object->id,
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL_INIT);
+ add_relation(transform_init_key,
+ point_cache_key,
+ "Transform Local -> Point Cache",
+ RELATION_FLAG_FLUSH_USER_EDIT_ONLY);
+ add_relation(geometry_init_key,
+ point_cache_key,
+ "Geometry Init -> Point Cache",
+ RELATION_FLAG_FLUSH_USER_EDIT_ONLY);
+ }
BLI_freelistN(&ptcache_id_list);
}
void DepsgraphRelationBuilder::build_constraints(ID *id,
- eDepsNode_Type component_type,
+ NodeType component_type,
const char *component_subdata,
ListBase *constraints,
RootPChanMap *root_map)
@@ -953,9 +1004,9 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
id,
component_type,
component_subdata,
- (component_type == DEG_NODE_TYPE_BONE)
- ? DEG_OPCODE_BONE_CONSTRAINTS
- : DEG_OPCODE_TRANSFORM_CONSTRAINTS);
+ (component_type == NodeType::BONE)
+ ? OperationCode::BONE_CONSTRAINTS
+ : OperationCode::TRANSFORM_CONSTRAINTS);
/* Add dependencies for each constraint in turn. */
for (bConstraint *con = (bConstraint *)constraints->first; con; con = con->next) {
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
@@ -964,11 +1015,9 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
continue;
}
/* Special case for camera tracking -- it doesn't use targets to
- * define relations.
- */
+ * define relations. */
/* TODO: we can now represent dependencies in a much richer manner,
- * so review how this is done.
- */
+ * so review how this is done. */
if (ELEM(cti->type,
CONSTRAINT_TYPE_FOLLOWTRACK,
CONSTRAINT_TYPE_CAMERASOLVER,
@@ -984,9 +1033,9 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
}
if (data->depth_ob) {
ComponentKey depth_transform_key(&data->depth_ob->id,
- DEG_NODE_TYPE_TRANSFORM);
+ NodeType::TRANSFORM);
ComponentKey depth_geometry_key(&data->depth_ob->id,
- DEG_NODE_TYPE_GEOMETRY);
+ NodeType::GEOMETRY);
add_relation(depth_transform_key, constraint_op_key, cti->name);
add_relation(depth_geometry_key, constraint_op_key, cti->name);
}
@@ -995,24 +1044,22 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
depends_on_camera = true;
}
if (depends_on_camera && scene_->camera != NULL) {
- ComponentKey camera_key(&scene_->camera->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey camera_key(&scene_->camera->id, NodeType::TRANSFORM);
add_relation(camera_key, constraint_op_key, cti->name);
}
/* TODO(sergey): This is more a TimeSource -> MovieClip ->
- * Constraint dependency chain.
- */
+ * Constraint dependency chain. */
TimeSourceKey time_src_key;
add_relation(time_src_key, constraint_op_key, "TimeSrc -> Animation");
}
else if (cti->type == CONSTRAINT_TYPE_TRANSFORM_CACHE) {
/* TODO(kevin): This is more a TimeSource -> CacheFile -> Constraint
- * dependency chain.
- */
+ * dependency chain. */
TimeSourceKey time_src_key;
add_relation(time_src_key, constraint_op_key, "TimeSrc -> Animation");
bTransformCacheConstraint *data = (bTransformCacheConstraint *)con->data;
if (data->cache_file) {
- ComponentKey cache_key(&data->cache_file->id, DEG_NODE_TYPE_CACHE);
+ ComponentKey cache_key(&data->cache_file->id, NodeType::CACHE);
add_relation(cache_key, constraint_op_key, cti->name);
}
}
@@ -1028,37 +1075,36 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
CONSTRAINT_TYPE_SPLINEIK))
{
/* Ignore IK constraints - these are handled separately
- * (on pose level).
- */
+ * (on pose level). */
}
else if (ELEM(con->type,
CONSTRAINT_TYPE_FOLLOWPATH,
CONSTRAINT_TYPE_CLAMPTO))
{
/* These constraints require path geometry data. */
- ComponentKey target_key(&ct->tar->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey target_key(&ct->tar->id, NodeType::GEOMETRY);
add_relation(target_key, constraint_op_key, cti->name);
ComponentKey target_transform_key(&ct->tar->id,
- DEG_NODE_TYPE_TRANSFORM);
+ NodeType::TRANSFORM);
add_relation(target_transform_key, constraint_op_key, cti->name);
}
else if ((ct->tar->type == OB_ARMATURE) && (ct->subtarget[0])) {
- eDepsOperation_Code opcode;
+ OperationCode opcode;
/* relation to bone */
opcode = bone_target_opcode(&ct->tar->id, ct->subtarget,
id, component_subdata, root_map);
/* Armature constraint always wants the final position and chan_mat. */
if (ELEM(con->type, CONSTRAINT_TYPE_ARMATURE)) {
- opcode = DEG_OPCODE_BONE_DONE;
+ opcode = OperationCode::BONE_DONE;
}
/* if needs bbone shape, reference the segment computation */
if (BKE_constraint_target_uses_bbone(con, ct) &&
bone_has_segments(ct->tar, ct->subtarget))
{
- opcode = DEG_OPCODE_BONE_SEGMENTS;
+ opcode = OperationCode::BONE_SEGMENTS;
}
OperationKey target_key(&ct->tar->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
ct->subtarget,
opcode);
add_relation(target_key, constraint_op_key, cti->name);
@@ -1067,25 +1113,33 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
(ct->subtarget[0]))
{
/* Vertex group. */
- /* NOTE: for now, we don't need to represent vertex groups
- * separately.
- */
- ComponentKey target_key(&ct->tar->id, DEG_NODE_TYPE_GEOMETRY);
- add_relation(target_key, constraint_op_key, cti->name);
- add_customdata_mask(ct->tar, CD_MASK_MDEFORMVERT);
+ /* NOTE: Vertex group is likely to be used to get vertices
+ * in a world space. This requires to know both geometry
+ * and transformation of the target object. */
+ ComponentKey target_transform_key(
+ &ct->tar->id, NodeType::TRANSFORM);
+ ComponentKey target_geometry_key(
+ &ct->tar->id, NodeType::GEOMETRY);
+ add_relation(
+ target_transform_key, constraint_op_key, cti->name);
+ add_relation(
+ target_geometry_key, constraint_op_key, cti->name);
+ add_customdata_mask(ct->tar, DEGCustomDataMeshMasks::MaskVert(CD_MASK_MDEFORMVERT));
}
else if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) {
bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data;
/* Constraints which requires the target object surface. */
- ComponentKey target_key(&ct->tar->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey target_key(&ct->tar->id, NodeType::GEOMETRY);
add_relation(target_key, constraint_op_key, cti->name);
/* Add dependency on normal layers if necessary. */
if (ct->tar->type == OB_MESH && scon->shrinkType != MOD_SHRINKWRAP_NEAREST_VERTEX) {
bool track = (scon->flag & CON_SHRINKWRAP_TRACK_NORMAL) != 0;
if (track || BKE_shrinkwrap_needs_normals(scon->shrinkType, scon->shrinkMode)) {
- add_customdata_mask(ct->tar, CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL);
+ add_customdata_mask(ct->tar,
+ DEGCustomDataMeshMasks::MaskVert(CD_MASK_NORMAL) |
+ DEGCustomDataMeshMasks::MaskLoop(CD_MASK_CUSTOMLOOPNORMAL));
}
if (scon->shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) {
add_special_eval_flag(&ct->tar->id, DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY);
@@ -1093,10 +1147,9 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
}
/* NOTE: obdata eval now doesn't necessarily depend on the
- * object's transform.
- */
+ * object's transform. */
ComponentKey target_transform_key(&ct->tar->id,
- DEG_NODE_TYPE_TRANSFORM);
+ NodeType::TRANSFORM);
add_relation(target_transform_key, constraint_op_key, cti->name);
}
else {
@@ -1109,34 +1162,32 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
* case, it's just transform -> bone.
* - If however it is a real self targeting case, just
* make it depend on the previous constraint (or the
- * pre-constraint state).
- */
+ * pre-constraint state). */
if ((ct->tar->type == OB_ARMATURE) &&
- (component_type == DEG_NODE_TYPE_BONE))
+ (component_type == NodeType::BONE))
{
OperationKey target_key(&ct->tar->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_FINAL);
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_FINAL);
add_relation(target_key, constraint_op_key, cti->name);
}
else {
OperationKey target_key(&ct->tar->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_LOCAL);
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_LOCAL);
add_relation(target_key, constraint_op_key, cti->name);
}
}
else {
/* Normal object dependency. */
OperationKey target_key(&ct->tar->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_FINAL);
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_FINAL);
add_relation(target_key, constraint_op_key, cti->name);
}
}
/* Constraints which needs world's matrix for transform.
- * TODO(sergey): More constraints here?
- */
+ * TODO(sergey): More constraints here? */
if (ELEM(con->type,
CONSTRAINT_TYPE_ROTLIKE,
CONSTRAINT_TYPE_SIZELIKE,
@@ -1145,7 +1196,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
{
/* TODO(sergey): Add used space check. */
ComponentKey target_transform_key(&ct->tar->id,
- DEG_NODE_TYPE_TRANSFORM);
+ NodeType::TRANSFORM);
add_relation(target_transform_key, constraint_op_key, cti->name);
}
}
@@ -1158,6 +1209,8 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
void DepsgraphRelationBuilder::build_animdata(ID *id)
{
+ /* Images. */
+ build_animation_images(id);
/* Animation curves and NLA. */
build_animdata_curves(id);
/* Drivers. */
@@ -1173,106 +1226,114 @@ void DepsgraphRelationBuilder::build_animdata_curves(ID *id)
if (adt->action != NULL) {
build_action(adt->action);
}
- if (adt->action == NULL && adt->nla_tracks.first == NULL) {
+ if (adt->action == NULL && BLI_listbase_is_empty(&adt->nla_tracks)) {
return;
}
- /* Wire up dependency to time source. */
- ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION);
+ /* Ensure evaluation order from entry to exit. */
+ OperationKey animation_entry_key(
+ id, NodeType::ANIMATION, OperationCode::ANIMATION_ENTRY);
+ OperationKey animation_eval_key(
+ id, NodeType::ANIMATION, OperationCode::ANIMATION_EVAL);
+ OperationKey animation_exit_key(
+ id, NodeType::ANIMATION, OperationCode::ANIMATION_EXIT);
+ add_relation(animation_entry_key, animation_eval_key, "Init -> Eval");
+ add_relation(animation_eval_key, animation_exit_key, "Eval -> Exit");
+ /* Wire up dependency from action. */
+ ComponentKey adt_key(id, NodeType::ANIMATION);
/* Relation from action itself. */
if (adt->action != NULL) {
- ComponentKey action_key(&adt->action->id, DEG_NODE_TYPE_ANIMATION);
+ ComponentKey action_key(&adt->action->id, NodeType::ANIMATION);
add_relation(action_key, adt_key, "Action -> Animation");
}
/* Get source operations. */
- DepsNode *node_from = get_node(adt_key);
+ Node *node_from = get_node(adt_key);
BLI_assert(node_from != NULL);
if (node_from == NULL) {
return;
}
- OperationDepsNode *operation_from = node_from->get_exit_operation();
+ OperationNode *operation_from = node_from->get_exit_operation();
BLI_assert(operation_from != NULL);
/* Build relations from animation operation to properties it changes. */
if (adt->action != NULL) {
- build_animdata_curves_targets(id, adt_key,
- operation_from,
- &adt->action->curves);
+ build_animdata_curves_targets(
+ id, adt_key, operation_from, &adt->action->curves);
}
LISTBASE_FOREACH(NlaTrack *, nlt, &adt->nla_tracks) {
- build_animdata_nlastrip_targets(id, adt_key,
- operation_from,
- &nlt->strips);
+ build_animdata_nlastrip_targets(
+ id, adt_key, operation_from, &nlt->strips);
}
}
void DepsgraphRelationBuilder::build_animdata_curves_targets(
ID *id, ComponentKey &adt_key,
- OperationDepsNode *operation_from,
+ OperationNode *operation_from,
ListBase *curves)
{
/* Iterate over all curves and build relations. */
PointerRNA id_ptr;
RNA_id_pointer_create(id, &id_ptr);
- LISTBASE_FOREACH(FCurve *, fcu, curves) {
+ LISTBASE_FOREACH (FCurve *, fcu, curves) {
PointerRNA ptr;
PropertyRNA *prop;
int index;
- if (!RNA_path_resolve_full(&id_ptr, fcu->rna_path,
- &ptr, &prop, &index))
+ if (!RNA_path_resolve_full(
+ &id_ptr, fcu->rna_path, &ptr, &prop, &index))
{
continue;
}
- DepsNode *node_to = graph_->find_node_from_pointer(&ptr, prop);
+ Node *node_to = rna_node_query_.find_node(
+ &ptr, prop, RNAPointerSource::ENTRY);
if (node_to == NULL) {
continue;
}
- OperationDepsNode *operation_to = node_to->get_entry_operation();
+ OperationNode *operation_to = node_to->get_entry_operation();
/* NOTE: Special case for bones, avoid relation from animation to
* each of the bones. Bone evaluation could only start from pose
- * init anyway.
- */
- if (operation_to->opcode == DEG_OPCODE_BONE_LOCAL) {
- OperationKey pose_init_key(id,
- DEG_NODE_TYPE_EVAL_POSE,
- DEG_OPCODE_POSE_INIT);
- add_relation(adt_key, pose_init_key, "Animation -> Prop", true);
+ * init anyway. */
+ if (operation_to->opcode == OperationCode::BONE_LOCAL) {
+ OperationKey pose_init_key(
+ id, NodeType::EVAL_POSE, OperationCode::POSE_INIT);
+ add_relation(adt_key,
+ pose_init_key,
+ "Animation -> Prop",
+ RELATION_CHECK_BEFORE_ADD);
continue;
}
graph_->add_new_relation(operation_from, operation_to,
"Animation -> Prop",
- true);
+ RELATION_CHECK_BEFORE_ADD);
/* It is possible that animation is writing to a nested ID datablock,
- * need to make sure animation is evaluated after target ID is copied.
- */
- const IDDepsNode *id_node_from = operation_from->owner->owner;
- const IDDepsNode *id_node_to = operation_to->owner->owner;
+ * need to make sure animation is evaluated after target ID is copied. */
+ const IDNode *id_node_from = operation_from->owner->owner;
+ const IDNode *id_node_to = operation_to->owner->owner;
if (id_node_from != id_node_to) {
- ComponentKey cow_key(id_node_to->id_orig,
- DEG_NODE_TYPE_COPY_ON_WRITE);
- add_relation(cow_key, adt_key, "Target CoW -> Animation", true);
+ ComponentKey cow_key(id_node_to->id_orig, NodeType::COPY_ON_WRITE);
+ add_relation(cow_key,
+ adt_key,
+ "Animated CoW -> Animation",
+ RELATION_CHECK_BEFORE_ADD);
}
}
}
void DepsgraphRelationBuilder::build_animdata_nlastrip_targets(
ID *id, ComponentKey &adt_key,
- OperationDepsNode *operation_from,
+ OperationNode *operation_from,
ListBase *strips)
{
- LISTBASE_FOREACH(NlaStrip *, strip, strips) {
+ LISTBASE_FOREACH (NlaStrip *, strip, strips) {
if (strip->act != NULL) {
build_action(strip->act);
- ComponentKey action_key(&strip->act->id, DEG_NODE_TYPE_ANIMATION);
+ ComponentKey action_key(&strip->act->id, NodeType::ANIMATION);
add_relation(action_key, adt_key, "Action -> Animation");
- build_animdata_curves_targets(id, adt_key,
- operation_from,
- &strip->act->curves);
+ build_animdata_curves_targets(
+ id, adt_key, operation_from, &strip->act->curves);
}
else if (strip->strips.first != NULL) {
- build_animdata_nlastrip_targets(id, adt_key,
- operation_from,
- &strip->strips);
+ build_animdata_nlastrip_targets(
+ id, adt_key, operation_from, &strip->strips);
}
}
}
@@ -1283,11 +1344,11 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id)
if (adt == NULL) {
return;
}
- ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION);
+ ComponentKey adt_key(id, NodeType::ANIMATION);
LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) {
OperationKey driver_key(id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_DRIVER,
+ NodeType::PARAMETERS,
+ OperationCode::DRIVER,
fcu->rna_path ? fcu->rna_path : "",
fcu->array_index);
@@ -1303,8 +1364,7 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id)
* - We do relation from next array index to a previous one, so we don't
* have to deal with array index 0.
*
- * TODO(sergey): Avoid liner lookup somehow.
- */
+ * TODO(sergey): Avoid liner lookup somehow. */
if (fcu->array_index > 0) {
FCurve *fcu_prev = NULL;
LISTBASE_FOREACH (FCurve *, fcu_candidate, &adt->drivers) {
@@ -1326,13 +1386,13 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id)
}
if (fcu_prev != NULL) {
OperationKey prev_driver_key(id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_DRIVER,
+ NodeType::PARAMETERS,
+ OperationCode::DRIVER,
fcu_prev->rna_path ? fcu_prev->rna_path : "",
fcu_prev->array_index);
OperationKey driver_key(id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_DRIVER,
+ NodeType::PARAMETERS,
+ OperationCode::DRIVER,
fcu->rna_path ? fcu->rna_path : "",
fcu->array_index);
add_relation(prev_driver_key, driver_key, "Driver Order");
@@ -1346,13 +1406,25 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id)
}
}
+void DepsgraphRelationBuilder::build_animation_images(ID *id)
+{
+ /* TODO: can we check for existance of node for performance? */
+ if (BKE_image_user_id_has_animation(id)) {
+ OperationKey image_animation_key(id,
+ NodeType::ANIMATION,
+ OperationCode::IMAGE_ANIMATION);
+ TimeSourceKey time_src_key;
+ add_relation(time_src_key, image_animation_key, "TimeSrc -> Image Animation");
+ }
+}
+
void DepsgraphRelationBuilder::build_action(bAction *action)
{
if (built_map_.checkIsBuiltAndTag(action)) {
return;
}
TimeSourceKey time_src_key;
- ComponentKey animation_key(&action->id, DEG_NODE_TYPE_ANIMATION);
+ ComponentKey animation_key(&action->id, NodeType::ANIMATION);
add_relation(time_src_key, animation_key, "TimeSrc -> Animation");
}
@@ -1360,20 +1432,18 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
{
ChannelDriver *driver = fcu->driver;
OperationKey driver_key(id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_DRIVER,
+ NodeType::PARAMETERS,
+ OperationCode::DRIVER,
fcu->rna_path ? fcu->rna_path : "",
fcu->array_index);
/* Driver -> data components (for interleaved evaluation
- * bones/constraints/modifiers).
- */
+ * bones/constraints/modifiers). */
build_driver_data(id, fcu);
/* Loop over variables to get the target relationships. */
build_driver_variables(id, fcu);
/* It's quite tricky to detect if the driver actually depends on time or
* not, so for now we'll be quite conservative here about optimization and
- * consider all python drivers to be depending on time.
- */
+ * consider all python drivers to be depending on time. */
if ((driver->type == DRIVER_TYPE_PYTHON) &&
python_driver_depends_on_time(driver))
{
@@ -1385,24 +1455,21 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
{
OperationKey driver_key(id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_DRIVER,
+ NodeType::PARAMETERS,
+ OperationCode::DRIVER,
fcu->rna_path ? fcu->rna_path : "",
fcu->array_index);
const char *rna_path = fcu->rna_path ? fcu->rna_path : "";
- const RNAPathKey self_key(id, rna_path);
if (GS(id->name) == ID_AR && strstr(rna_path, "bones[")) {
/* Drivers on armature-level bone settings (i.e. bbone stuff),
- * which will affect the evaluation of corresponding pose bones.
- */
- IDDepsNode *arm_node = graph_->find_id_node(id);
+ * which will affect the evaluation of corresponding pose bones. */
+ IDNode *arm_node = graph_->find_id_node(id);
char *bone_name = BLI_str_quoted_substrN(rna_path, "bones[");
if (arm_node != NULL && bone_name != NULL) {
/* Find objects which use this, and make their eval callbacks
- * depend on this.
- */
- foreach (DepsRelation *rel, arm_node->outlinks) {
- IDDepsNode *to_node = (IDDepsNode *)rel->to;
+ * depend on this. */
+ for (Relation *rel : arm_node->outlinks) {
+ IDNode *to_node = (IDNode *)rel->to;
/* We only care about objects with pose data which use this. */
if (GS(to_node->id_orig->name) == ID_OB) {
Object *object = (Object *)to_node->id_orig;
@@ -1411,9 +1478,9 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
bone_name);
if (pchan != NULL) {
OperationKey bone_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_LOCAL);
+ OperationCode::BONE_LOCAL);
add_relation(driver_key,
bone_key,
"Arm Bone -> Driver -> Bone");
@@ -1431,20 +1498,19 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
}
}
else if (rna_path != NULL && rna_path[0] != '\0') {
- RNAPathKey target_key(id, rna_path);
- if (RNA_pointer_is_null(&target_key.ptr)) {
+ RNAPathKey property_entry_key(id, rna_path, RNAPointerSource::ENTRY);
+ if (RNA_pointer_is_null(&property_entry_key.ptr)) {
/* TODO(sergey): This would only mean that driver is broken.
* so we can't create relation anyway. However, we need to avoid
* adding drivers which are known to be buggy to a dependency
- * graph, in order to save computational power.
- */
+ * graph, in order to save computational power. */
return;
}
- add_relation(driver_key, target_key, "Driver -> Target");
+ add_relation(
+ driver_key, property_entry_key, "Driver -> Driven Property");
/* Similar to the case with f-curves, driver might drive a nested
* datablock, which means driver execution should wait for that
- * datablock to be copied.
- */
+ * datablock to be copied. */
{
PointerRNA id_ptr;
PointerRNA ptr;
@@ -1452,23 +1518,24 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
if (RNA_path_resolve_full(&id_ptr, fcu->rna_path, &ptr, NULL, NULL)) {
if (id_ptr.id.data != ptr.id.data) {
ComponentKey cow_key((ID *)ptr.id.data,
- DEG_NODE_TYPE_COPY_ON_WRITE);
+ NodeType::COPY_ON_WRITE);
add_relation(cow_key,
driver_key,
- "Target CoW -> Driver",
- true);
+ "Driven CoW -> Driver",
+ RELATION_CHECK_BEFORE_ADD);
}
}
}
- if (target_key.prop != NULL &&
- RNA_property_is_idprop(target_key.prop))
+ if (property_entry_key.prop != NULL &&
+ RNA_property_is_idprop(property_entry_key.prop))
{
+ RNAPathKey property_exit_key(id, rna_path, RNAPointerSource::EXIT);
OperationKey parameters_key(id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_PARAMETERS_EVAL);
- add_relation(target_key,
+ NodeType::PARAMETERS,
+ OperationCode::PARAMETERS_EVAL);
+ add_relation(property_exit_key,
parameters_key,
- "Driver Target -> Properties");
+ "Driven Property -> Properties");
}
}
}
@@ -1477,13 +1544,12 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
{
ChannelDriver *driver = fcu->driver;
OperationKey driver_key(id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_DRIVER,
+ NodeType::PARAMETERS,
+ OperationCode::DRIVER,
fcu->rna_path ? fcu->rna_path : "",
fcu->array_index);
const char *rna_path = fcu->rna_path ? fcu->rna_path : "";
- const RNAPathKey self_key(id, rna_path);
-
+ const RNAPathKey self_key(id, rna_path, RNAPointerSource::ENTRY);
LISTBASE_FOREACH (DriverVar *, dvar, &driver->variables) {
/* Only used targets. */
DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
@@ -1492,6 +1558,7 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
continue;
}
build_id(dtar->id);
+ build_driver_id_property(dtar->id, dtar->rna_path);
/* Initialize relations coming to proxy_from. */
Object *proxy_from = NULL;
if ((GS(dtar->id->name) == ID_OB) &&
@@ -1513,9 +1580,9 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
continue;
}
OperationKey variable_key(dtar->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
target_pchan->name,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
if (is_same_bone_dependency(variable_key, self_key)) {
continue;
}
@@ -1526,32 +1593,36 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
if (dtar->id == id) {
/* Ignore input dependency if we're driving properties of
* the same ID, otherwise we'll be ending up in a cyclic
- * dependency here.
- */
+ * dependency here. */
continue;
}
OperationKey target_key(dtar->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_FINAL);
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_FINAL);
add_relation(target_key, driver_key, "Target -> Driver");
}
else if (dtar->rna_path != NULL && dtar->rna_path[0] != '\0') {
- RNAPathKey variable_key(dtar->id, dtar->rna_path);
- if (RNA_pointer_is_null(&variable_key.ptr)) {
+ RNAPathKey variable_exit_key(
+ dtar->id, dtar->rna_path, RNAPointerSource::EXIT);
+ if (RNA_pointer_is_null(&variable_exit_key.ptr)) {
continue;
}
- if (is_same_bone_dependency(variable_key, self_key) ||
- is_same_nodetree_node_dependency(variable_key, self_key) ||
- is_same_shapekey_dependency(variable_key, self_key))
+ if (is_same_bone_dependency(variable_exit_key, self_key) ||
+ is_same_nodetree_node_dependency(variable_exit_key, self_key))
{
continue;
}
- add_relation(variable_key, driver_key, "RNA Target -> Driver");
+ add_relation(variable_exit_key,
+ driver_key,
+ "RNA Target -> Driver");
if (proxy_from != NULL) {
RNAPathKey proxy_from_variable_key(&proxy_from->id,
- dtar->rna_path);
+ dtar->rna_path,
+ RNAPointerSource::EXIT);
+ RNAPathKey variable_entry_key(
+ dtar->id, dtar->rna_path, RNAPointerSource::ENTRY);
add_relation(proxy_from_variable_key,
- variable_key,
+ variable_entry_key,
"Proxy From -> Variable");
}
}
@@ -1564,6 +1635,52 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
}
}
+void DepsgraphRelationBuilder::build_driver_id_property(ID *id,
+ const char *rna_path)
+{
+ if (id == NULL || rna_path == NULL) {
+ return;
+ }
+ PointerRNA id_ptr, ptr;
+ PropertyRNA *prop;
+ RNA_id_pointer_create(id, &id_ptr);
+ if (!RNA_path_resolve_full(&id_ptr, rna_path, &ptr, &prop, NULL)) {
+ return;
+ }
+ if (prop == NULL) {
+ return;
+ }
+ if (!RNA_property_is_idprop(prop)) {
+ return;
+ }
+ const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop);
+ OperationKey id_property_key(id,
+ NodeType::PARAMETERS,
+ OperationCode::ID_PROPERTY,
+ prop_identifier);
+ OperationKey parameters_exit_key(id,
+ NodeType::PARAMETERS,
+ OperationCode::PARAMETERS_EXIT);
+ add_relation(id_property_key,
+ parameters_exit_key,
+ "ID Property -> Done",
+ RELATION_CHECK_BEFORE_ADD);
+}
+
+void DepsgraphRelationBuilder::build_parameters(ID *id)
+{
+ OperationKey parameters_entry_key(
+ id, NodeType::PARAMETERS, OperationCode::PARAMETERS_ENTRY);
+ OperationKey parameters_eval_key(
+ id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL);
+ OperationKey parameters_exit_key(
+ id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT);
+ add_relation(
+ parameters_entry_key, parameters_eval_key, "Entry -> Eval");
+ add_relation(
+ parameters_eval_key, parameters_exit_key, "Entry -> Exit");
+}
+
void DepsgraphRelationBuilder::build_world(World *world)
{
if (built_map_.checkIsBuiltAndTag(world)) {
@@ -1575,11 +1692,11 @@ void DepsgraphRelationBuilder::build_world(World *world)
if (world->nodetree != NULL) {
build_nodetree(world->nodetree);
OperationKey ntree_key(&world->nodetree->id,
- DEG_NODE_TYPE_SHADING,
- DEG_OPCODE_MATERIAL_UPDATE);
+ NodeType::SHADING,
+ OperationCode::MATERIAL_UPDATE);
OperationKey world_key(&world->id,
- DEG_NODE_TYPE_SHADING,
- DEG_OPCODE_WORLD_UPDATE);
+ NodeType::SHADING,
+ OperationCode::WORLD_UPDATE);
add_relation(ntree_key, world_key, "World's NTree");
build_nested_nodetree(&world->id, world->nodetree);
}
@@ -1588,114 +1705,115 @@ void DepsgraphRelationBuilder::build_world(World *world)
void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
{
RigidBodyWorld *rbw = scene->rigidbody_world;
-
- OperationKey init_key(&scene->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_REBUILD);
- OperationKey sim_key(&scene->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_SIM);
-
- /* rel between the two sim-nodes */
- add_relation(init_key, sim_key, "Rigidbody [Init -> SimStep]");
-
- /* set up dependencies between these operations and other builtin nodes --------------- */
-
- /* effectors */
- ListBase *relations = deg_build_effector_relations(graph_, rbw->effector_weights->group);
+ OperationKey rb_init_key(&scene->id,
+ NodeType::TRANSFORM,
+ OperationCode::RIGIDBODY_REBUILD);
+ OperationKey rb_simulate_key(&scene->id,
+ NodeType::TRANSFORM,
+ OperationCode::RIGIDBODY_SIM);
+ /* Simulation depends on time. */
+ TimeSourceKey time_src_key;
+ add_relation(time_src_key, rb_init_key, "TimeSrc -> Rigidbody Init");
+ /* Simulation should always be run after initialization. */
+ /* NOTE: It is possible in theory to have dependency cycle which involves
+ * this relation. We never want it to be killed. */
+ add_relation(rb_init_key,
+ rb_simulate_key,
+ "Rigidbody [Init -> SimStep]",
+ RELATION_FLAG_GODMODE);
+ /* Effectors should be evaluated at the time simulation is being
+ * initialized.
+ * TODO(sergey): Verify that it indeed goes to initialization and not to a
+ * simulation. */
+ ListBase *relations = build_effector_relations(graph_, rbw->effector_weights->group);
LISTBASE_FOREACH (EffectorRelation *, relation, relations) {
- ComponentKey eff_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM);
- add_relation(eff_key, init_key, "RigidBody Field");
- // FIXME add relations so pointache is marked as outdated when effectors are modified
+ ComponentKey effector_transform_key(
+ &relation->ob->id, NodeType::TRANSFORM);
+ add_relation(effector_transform_key, rb_init_key, "RigidBody Field");
}
-
- /* time dependency */
- TimeSourceKey time_src_key;
- add_relation(time_src_key, init_key, "TimeSrc -> Rigidbody Reset/Rebuild (Optional)");
-
- /* objects - simulation participants */
- if (rbw->group) {
+ /* Objects. */
+ if (rbw->group != NULL) {
build_collection(NULL, NULL, rbw->group);
-
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(rbw->group, object)
{
if (object->type != OB_MESH) {
continue;
}
-
- /* hook up evaluation order...
- * 1) flushing rigidbody results follows base transforms being applied
- * 2) rigidbody flushing can only be performed after simulation has been run
- *
- * 3) simulation needs to know base transforms to figure out what to do
- * XXX: there's probably a difference between passive and active
- * - passive don't change, so may need to know full transform...
- */
- OperationKey rbo_key(&object->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY);
-
- eDepsOperation_Code trans_opcode = object->parent ? DEG_OPCODE_TRANSFORM_PARENT : DEG_OPCODE_TRANSFORM_LOCAL;
- OperationKey trans_op(&object->id, DEG_NODE_TYPE_TRANSFORM, trans_opcode);
-
- add_relation(sim_key, rbo_key, "Rigidbody Sim Eval -> RBO Sync");
-
- /* Geometry must be known to create the rigid body. RBO_MESH_BASE uses the non-evaluated
- * mesh, so then the evaluation is unnecessary. */
- if (object->rigidbody_object != NULL && object->rigidbody_object->mesh_source != RBO_MESH_BASE) {
- ComponentKey geom_key(&object->id, DEG_NODE_TYPE_GEOMETRY);
- add_relation(geom_key, init_key, "Object Geom Eval -> Rigidbody Rebuild");
- }
-
- /* if constraints exist, those depend on the result of the rigidbody sim
- * - This allows constraints to modify the result of the sim (i.e. clamping)
- * while still allowing the sim to depend on some changes to the objects.
- * Also, since constraints are hooked up to the final nodes, this link
- * means that we can also fit in there too...
- * - Later, it might be good to include a constraint in the stack allowing us
- * to control whether rigidbody eval gets interleaved into the constraint stack
- */
- if (object->constraints.first) {
- OperationKey constraint_key(&object->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_CONSTRAINTS);
- add_relation(rbo_key, constraint_key, "RBO Sync -> Ob Constraints");
- }
- else {
- /* Final object transform depends on rigidbody.
- *
- * NOTE: Currently we consider final here an ubereval node.
- * If it is gone we'll need to reconsider relation here.
- */
- OperationKey uber_key(&object->id,
- DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL);
- add_relation(rbo_key, uber_key, "RBO Sync -> Uber (Temp)");
+ OperationKey rb_transform_copy_key(
+ &object->id,
+ NodeType::TRANSFORM,
+ OperationCode::RIGIDBODY_TRANSFORM_COPY);
+ /* Rigid body synchronization depends on the actual simulation. */
+ add_relation(rb_simulate_key,
+ rb_transform_copy_key,
+ "Rigidbody Sim Eval -> RBO Sync");
+ /* Simulation uses object transformation after parenting and solving
+ * contraints. */
+ OperationKey object_transform_eval_key(
+ &object->id,
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_EVAL);
+ add_relation(object_transform_eval_key,
+ rb_simulate_key,
+ "Object Transform -> Rigidbody Sim Eval");
+ /* Geometry must be known to create the rigid body. RBO_MESH_BASE
+ * uses the non-evaluated mesh, so then the evaluation is
+ * unnecessary. */
+ if (object->rigidbody_object != NULL &&
+ object->rigidbody_object->mesh_source != RBO_MESH_BASE)
+ {
+ /* NOTE: We prefer this relation to be never killed, to avoid
+ * access partially evaluated mesh from solver. */
+ ComponentKey object_geometry_key(
+ &object->id, NodeType::GEOMETRY);
+ add_relation(object_geometry_key,
+ rb_simulate_key,
+ "Object Geom Eval -> Rigidbody Rebuild",
+ RELATION_FLAG_GODMODE);
}
-
- /* Needed to get correct base values. */
- add_relation(trans_op, sim_key, "Base Ob Transform -> Rigidbody Sim Eval");
+ /* Final transform is whetever solver gave to us. */
+ OperationKey object_transform_final_key(
+ &object->id,
+ NodeType::TRANSFORM,
+ OperationCode::TRANSFORM_FINAL);
+ add_relation(rb_transform_copy_key,
+ object_transform_final_key,
+ "Rigidbody Sync -> Transform Final");
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}
-
- /* constraints */
- if (rbw->constraints) {
+ /* Constraints. */
+ if (rbw->constraints != NULL) {
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(rbw->constraints, object)
{
RigidBodyCon *rbc = object->rigidbody_constraint;
if (rbc == NULL || rbc->ob1 == NULL || rbc->ob2 == NULL) {
- /* When either ob1 or ob2 is NULL, the constraint doesn't work. */
+ /* When either ob1 or ob2 is NULL, the constraint doesn't
+ * work. */
continue;
}
-
- /* final result of the constraint object's transform controls how the
- * constraint affects the physics sim for these objects
- */
- ComponentKey trans_key(&object->id, DEG_NODE_TYPE_TRANSFORM);
- OperationKey ob1_key(&rbc->ob1->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY);
- OperationKey ob2_key(&rbc->ob2->id, DEG_NODE_TYPE_TRANSFORM, DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY);
-
- /* - constrained-objects sync depends on the constraint-holder */
- add_relation(trans_key, ob1_key, "RigidBodyConstraint -> RBC.Object_1");
- add_relation(trans_key, ob2_key, "RigidBodyConstraint -> RBC.Object_2");
-
- /* - ensure that sim depends on this constraint's transform */
- add_relation(trans_key, sim_key, "RigidBodyConstraint Transform -> RB Simulation");
+ /* Make sure indirectly linked objects are fully built. */
+ build_object(NULL, object);
+ build_object(NULL, rbc->ob1);
+ build_object(NULL, rbc->ob2);
+ /* final result of the constraint object's transform controls how
+ * the constraint affects the physics sim for these objects. */
+ ComponentKey trans_key(&object->id, NodeType::TRANSFORM);
+ OperationKey ob1_key(&rbc->ob1->id,
+ NodeType::TRANSFORM,
+ OperationCode::RIGIDBODY_TRANSFORM_COPY);
+ OperationKey ob2_key(&rbc->ob2->id,
+ NodeType::TRANSFORM,
+ OperationCode::RIGIDBODY_TRANSFORM_COPY);
+ /* Constrained-objects sync depends on the constraint-holder. */
+ add_relation(
+ trans_key, ob1_key, "RigidBodyConstraint -> RBC.Object_1");
+ add_relation(
+ trans_key, ob2_key, "RigidBodyConstraint -> RBC.Object_2");
+ /* Ensure that sim depends on this constraint's transform. */
+ add_relation(trans_key,
+ rb_simulate_key,
+ "RigidBodyConstraint Transform -> RB Simulation");
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}
@@ -1705,72 +1823,71 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object)
{
TimeSourceKey time_src_key;
OperationKey obdata_ubereval_key(&object->id,
- DEG_NODE_TYPE_GEOMETRY,
- DEG_OPCODE_GEOMETRY_UBEREVAL);
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL);
OperationKey eval_init_key(&object->id,
- DEG_NODE_TYPE_PARTICLE_SYSTEM,
- DEG_OPCODE_PARTICLE_SYSTEM_INIT);
+ NodeType::PARTICLE_SYSTEM,
+ OperationCode::PARTICLE_SYSTEM_INIT);
OperationKey eval_done_key(&object->id,
- DEG_NODE_TYPE_PARTICLE_SYSTEM,
- DEG_OPCODE_PARTICLE_SYSTEM_DONE);
- ComponentKey eval_key(&object->id, DEG_NODE_TYPE_PARTICLE_SYSTEM);
+ NodeType::PARTICLE_SYSTEM,
+ OperationCode::PARTICLE_SYSTEM_DONE);
+ ComponentKey eval_key(&object->id, NodeType::PARTICLE_SYSTEM);
if (BKE_ptcache_object_has(scene_, object, 0)) {
- ComponentKey point_cache_key(&object->id, DEG_NODE_TYPE_POINT_CACHE);
- add_relation(eval_key, point_cache_key, "Particle Point Cache");
+ ComponentKey point_cache_key(&object->id, NodeType::POINT_CACHE);
+ add_relation(eval_key,
+ point_cache_key,
+ "Particle Point Cache",
+ RELATION_FLAG_FLUSH_USER_EDIT_ONLY);
}
/* Particle systems. */
LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
ParticleSettings *part = psys->part;
-
/* Build particle settings relations.
- *
- * NOTE: The call itself ensures settings are only build once.
- */
+ * NOTE: The call itself ensures settings are only build once. */
build_particle_settings(part);
-
/* This particle system. */
OperationKey psys_key(&object->id,
- DEG_NODE_TYPE_PARTICLE_SYSTEM,
- DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
+ NodeType::PARTICLE_SYSTEM,
+ OperationCode::PARTICLE_SYSTEM_EVAL,
psys->name);
-
/* Update particle system when settings changes. */
OperationKey particle_settings_key(&part->id,
- DEG_NODE_TYPE_PARTICLE_SETTINGS,
- DEG_OPCODE_PARTICLE_SETTINGS_EVAL);
- add_relation(particle_settings_key, eval_init_key, "Particle Settings Change");
+ NodeType::PARTICLE_SETTINGS,
+ OperationCode::PARTICLE_SETTINGS_EVAL);
+ add_relation(particle_settings_key,
+ eval_init_key,
+ "Particle Settings Change");
add_relation(eval_init_key, psys_key, "Init -> PSys");
add_relation(psys_key, eval_done_key, "PSys -> Done");
/* TODO(sergey): Currently particle update is just a placeholder,
* hook it to the ubereval node so particle system is getting updated
- * on playback.
- */
+ * on playback. */
add_relation(psys_key, obdata_ubereval_key, "PSys -> UberEval");
- /* Collisions */
+ /* Collisions. */
if (part->type != PART_HAIR) {
- add_collision_relations(psys_key,
- object,
- part->collision_group,
- "Particle Collision");
+ add_particle_collision_relations(psys_key,
+ object,
+ part->collision_group,
+ "Particle Collision");
}
else if ((psys->flag & PSYS_HAIR_DYNAMICS) &&
- psys->clmd != NULL &&
- psys->clmd->coll_parms != NULL)
+ psys->clmd != NULL &&
+ psys->clmd->coll_parms != NULL)
{
- add_collision_relations(psys_key,
- object,
- psys->clmd->coll_parms->group,
- "Hair Collision");
+ add_particle_collision_relations(psys_key,
+ object,
+ psys->clmd->coll_parms->group,
+ "Hair Collision");
}
/* Effectors. */
- add_forcefield_relations(psys_key,
- object,
- psys,
- part->effector_weights,
- part->type == PART_HAIR,
- "Particle Field");
+ add_particle_forcefield_relations(psys_key,
+ object,
+ psys,
+ part->effector_weights,
+ part->type == PART_HAIR,
+ "Particle Field");
/* Boids .*/
- if (part->boids) {
+ if (part->boids != NULL) {
LISTBASE_FOREACH (BoidState *, state, &part->boids->states) {
LISTBASE_FOREACH (BoidRule *, rule, &state->rules) {
Object *ruleob = NULL;
@@ -1780,28 +1897,46 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object)
else if (rule->type == eBoidRuleType_FollowLeader) {
ruleob = ((BoidRuleFollowLeader *)rule)->ob;
}
- if (ruleob) {
+ if (ruleob != NULL) {
ComponentKey ruleob_key(&ruleob->id,
- DEG_NODE_TYPE_TRANSFORM);
+ NodeType::TRANSFORM);
add_relation(ruleob_key, psys_key, "Boid Rule");
}
}
}
}
+ /* Keyed particle targets. */
+ if (part->phystype == PART_PHYS_KEYED) {
+ LISTBASE_FOREACH (ParticleTarget *, particle_target, &psys->targets) {
+ if (particle_target->ob == NULL ||
+ particle_target->ob == object)
+ {
+ continue;
+ }
+ /* Make sure target object is pulled into the graph. */
+ build_object(NULL, particle_target->ob);
+ /* Use geometry component, since that's where particles are
+ * actually evaluated. */
+ ComponentKey target_key(&particle_target->ob->id,
+ NodeType::GEOMETRY);
+ add_relation(target_key, psys_key, "Keyed Target");
+ }
+ }
+ /* Visualization. */
switch (part->ren_as) {
case PART_DRAW_OB:
- if (part->dup_ob != NULL) {
+ if (part->instance_object != NULL) {
/* Make sure object's relations are all built. */
- build_object(NULL, part->dup_ob);
+ build_object(NULL, part->instance_object);
/* Build relation for the particle visualization. */
build_particle_system_visualization_object(
- object, psys, part->dup_ob);
+ object, psys, part->instance_object);
}
break;
case PART_DRAW_GR:
- if (part->dup_group != NULL) {
- build_collection(NULL, NULL, part->dup_group);
- LISTBASE_FOREACH (CollectionObject *, go, &part->dup_group->gobject) {
+ if (part->instance_collection != NULL) {
+ build_collection(NULL, NULL, part->instance_collection);
+ LISTBASE_FOREACH (CollectionObject *, go, &part->instance_collection->gobject) {
build_particle_system_visualization_object(
object, psys, go->ob);
}
@@ -1809,14 +1944,12 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object)
break;
}
}
-
/* Particle depends on the object transform, so that channel is to be ready
* first.
*
* TODO(sergey): This relation should be altered once real granular update
- * is implemented.
- */
- ComponentKey transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM);
+ * is implemented. */
+ ComponentKey transform_key(&object->id, NodeType::TRANSFORM);
add_relation(transform_key, obdata_ubereval_key, "Particle Eval");
}
@@ -1828,15 +1961,15 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part)
/* Animation data relations. */
build_animdata(&part->id);
OperationKey particle_settings_init_key(&part->id,
- DEG_NODE_TYPE_PARTICLE_SETTINGS,
- DEG_OPCODE_PARTICLE_SETTINGS_INIT);
+ NodeType::PARTICLE_SETTINGS,
+ OperationCode::PARTICLE_SETTINGS_INIT);
OperationKey particle_settings_eval_key(&part->id,
- DEG_NODE_TYPE_PARTICLE_SETTINGS,
- DEG_OPCODE_PARTICLE_SETTINGS_EVAL);
+ NodeType::PARTICLE_SETTINGS,
+ OperationCode::PARTICLE_SETTINGS_EVAL);
OperationKey particle_settings_reset_key(
&part->id,
- DEG_NODE_TYPE_PARTICLE_SETTINGS,
- DEG_OPCODE_PARTICLE_SETTINGS_RESET);
+ NodeType::PARTICLE_SETTINGS,
+ OperationCode::PARTICLE_SETTINGS_RESET);
add_relation(particle_settings_init_key,
particle_settings_eval_key,
"Particle Settings Init Order");
@@ -1851,14 +1984,22 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part)
}
build_texture(mtex->tex);
ComponentKey texture_key(&mtex->tex->id,
- DEG_NODE_TYPE_GENERIC_DATABLOCK);
+ NodeType::GENERIC_DATABLOCK);
add_relation(texture_key,
particle_settings_reset_key,
"Particle Texture",
- DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY);
+ RELATION_FLAG_FLUSH_USER_EDIT_ONLY);
+ /* TODO(sergey): Consider moving texture space handling to an own
+ * function. */
+ if (mtex->texco == TEXCO_OBJECT && mtex->object != NULL) {
+ ComponentKey object_key(&mtex->object->id, NodeType::TRANSFORM);
+ add_relation(object_key,
+ particle_settings_eval_key,
+ "Particle Texture Space");
+ }
}
if (check_id_has_anim_component(&part->id)) {
- ComponentKey animation_key(&part->id, DEG_NODE_TYPE_ANIMATION);
+ ComponentKey animation_key(&part->id, NodeType::ANIMATION);
add_relation(animation_key,
particle_settings_eval_key,
"Particle Settings Animation");
@@ -1871,16 +2012,16 @@ void DepsgraphRelationBuilder::build_particle_system_visualization_object(
Object *draw_object)
{
OperationKey psys_key(&object->id,
- DEG_NODE_TYPE_PARTICLE_SYSTEM,
- DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
+ NodeType::PARTICLE_SYSTEM,
+ OperationCode::PARTICLE_SYSTEM_EVAL,
psys->name);
OperationKey obdata_ubereval_key(&object->id,
- DEG_NODE_TYPE_GEOMETRY,
- DEG_OPCODE_GEOMETRY_UBEREVAL);
- ComponentKey dup_ob_key(&draw_object->id, DEG_NODE_TYPE_TRANSFORM);
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL);
+ ComponentKey dup_ob_key(&draw_object->id, NodeType::TRANSFORM);
add_relation(dup_ob_key, psys_key, "Particle Object Visualization");
if (draw_object->type == OB_MBALL) {
- ComponentKey dup_geometry_key(&draw_object->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey dup_geometry_key(&draw_object->id, NodeType::GEOMETRY);
add_relation(obdata_ubereval_key,
dup_geometry_key,
"Particle MBall Visualization");
@@ -1893,8 +2034,17 @@ void DepsgraphRelationBuilder::build_shapekeys(Key *key)
if (built_map_.checkIsBuiltAndTag(key)) {
return;
}
- /* attach animdata to geometry */
+ /* Attach animdata to geometry. */
build_animdata(&key->id);
+ /* Connect all blocks properties to the final result evaluation. */
+ ComponentKey geometry_key(&key->id, NodeType::GEOMETRY);
+ LISTBASE_FOREACH (KeyBlock *, key_block, &key->block) {
+ OperationKey key_block_key(&key->id,
+ NodeType::PARAMETERS,
+ OperationCode::PARAMETERS_EVAL,
+ key_block->name);
+ add_relation(key_block_key, geometry_key, "Key Block Properties");
+ }
}
/**
@@ -1915,35 +2065,31 @@ void DepsgraphRelationBuilder::build_shapekeys(Key *key)
* and also for the links coming from the shapekey datablocks
* - Animation/Drivers affecting the parameters of the geometry are made to
* trigger updates on the obdata geometry component, which then trigger
- * downstream re-evaluation of the individual instances of this geometry.
- */
+ * downstream re-evaluation of the individual instances of this geometry. */
void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
{
ID *obdata = (ID *)object->data;
/* Init operation of object-level geometry evaluation. */
OperationKey geom_init_key(&object->id,
- DEG_NODE_TYPE_GEOMETRY,
- DEG_OPCODE_PLACEHOLDER,
- "Eval Init");
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL_INIT);
/* Get nodes for result of obdata's evaluation, and geometry evaluation
- * on object.
- */
- ComponentKey obdata_geom_key(obdata, DEG_NODE_TYPE_GEOMETRY);
- ComponentKey geom_key(&object->id, DEG_NODE_TYPE_GEOMETRY);
+ * on object. */
+ ComponentKey obdata_geom_key(obdata, NodeType::GEOMETRY);
+ ComponentKey geom_key(&object->id, NodeType::GEOMETRY);
/* Link components to each other. */
add_relation(obdata_geom_key, geom_key, "Object Geometry Base Data");
OperationKey obdata_ubereval_key(&object->id,
- DEG_NODE_TYPE_GEOMETRY,
- DEG_OPCODE_GEOMETRY_UBEREVAL);
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL);
/* Special case: modifiers evaluation queries scene for various things like
* data mask to be used. We add relation here to ensure object is never
- * evaluated prior to Scene's CoW is ready.
- */
+ * evaluated prior to Scene's CoW is ready. */
OperationKey scene_key(&scene_->id,
- DEG_NODE_TYPE_LAYER_COLLECTIONS,
- DEG_OPCODE_VIEW_LAYER_EVAL);
- DepsRelation *rel = add_relation(scene_key, obdata_ubereval_key, "CoW Relation");
- rel->flag |= DEPSREL_FLAG_NO_FLUSH;
+ NodeType::LAYER_COLLECTIONS,
+ OperationCode::VIEW_LAYER_EVAL);
+ Relation *rel = add_relation(scene_key, obdata_ubereval_key, "CoW Relation");
+ rel->flag |= RELATION_FLAG_NO_FLUSH;
/* Modifiers */
if (object->modifiers.first != NULL) {
ModifierUpdateDepsgraphContext ctx = {};
@@ -1962,12 +2108,12 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
}
}
}
- /* Grease Pencil Modifiers */
+ /* Grease Pencil Modifiers. */
if (object->greasepencil_modifiers.first != NULL) {
ModifierUpdateDepsgraphContext ctx = {};
ctx.scene = scene_;
ctx.object = object;
- LISTBASE_FOREACH(GpencilModifierData *, md, &object->greasepencil_modifiers) {
+ LISTBASE_FOREACH (GpencilModifierData *, md, &object->greasepencil_modifiers) {
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifierType_getInfo((GpencilModifierType)md->type);
if (mti->updateDepsgraph) {
DepsNodeHandle handle = create_node_handle(obdata_ubereval_key);
@@ -1980,12 +2126,12 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
}
}
}
- /* Shader FX */
+ /* Shader FX. */
if (object->shader_fx.first != NULL) {
ModifierUpdateDepsgraphContext ctx = {};
ctx.scene = scene_;
ctx.object = object;
- LISTBASE_FOREACH(ShaderFxData *, fx, &object->shader_fx) {
+ LISTBASE_FOREACH (ShaderFxData *, fx, &object->shader_fx) {
const ShaderFxTypeInfo *fxi = BKE_shaderfxType_getInfo((ShaderFxType)fx->type);
if (fxi->updateDepsgraph) {
DepsNodeHandle handle = create_node_handle(obdata_ubereval_key);
@@ -2007,11 +2153,11 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
if (object->type == OB_MESH) {
OperationKey material_key(&ma->id,
- DEG_NODE_TYPE_SHADING,
- DEG_OPCODE_MATERIAL_UPDATE);
+ NodeType::SHADING,
+ OperationCode::MATERIAL_UPDATE);
OperationKey shading_key(&object->id,
- DEG_NODE_TYPE_SHADING,
- DEG_OPCODE_SHADING);
+ NodeType::SHADING,
+ OperationCode::SHADING);
add_relation(material_key, shading_key, "Material Update");
}
}
@@ -2021,39 +2167,36 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
if (ELEM(object->type, OB_MESH, OB_CURVE, OB_LATTICE)) {
// add geometry collider relations
}
- /* Make sure uber update is the last in the dependencies.
- *
- * TODO(sergey): Get rid of this node.
- */
+ /* Make sure uber update is the last in the dependencies. */
if (object->type != OB_ARMATURE) {
/* Armatures does no longer require uber node. */
OperationKey obdata_ubereval_key(&object->id,
- DEG_NODE_TYPE_GEOMETRY,
- DEG_OPCODE_GEOMETRY_UBEREVAL);
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL);
add_relation(geom_init_key,
obdata_ubereval_key,
"Object Geometry UberEval");
if (object->totcol != 0 && object->type == OB_MESH) {
- ComponentKey object_shading_key(&object->id, DEG_NODE_TYPE_SHADING);
- DepsRelation *rel = add_relation(obdata_ubereval_key,
- object_shading_key,
- "Object Geometry batch Update");
- rel->flag |= DEPSREL_FLAG_NO_FLUSH;
+ ComponentKey object_shading_key(&object->id, NodeType::SHADING);
+ Relation *rel = add_relation(obdata_ubereval_key,
+ object_shading_key,
+ "Object Geometry batch Update");
+ rel->flag |= RELATION_FLAG_NO_FLUSH;
}
}
if (object->type == OB_MBALL) {
Object *mom = BKE_mball_basis_find(scene_, object);
- ComponentKey mom_geom_key(&mom->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey mom_geom_key(&mom->id, NodeType::GEOMETRY);
/* motherball - mom depends on children! */
if (mom == object) {
ComponentKey mom_transform_key(&mom->id,
- DEG_NODE_TYPE_TRANSFORM);
+ NodeType::TRANSFORM);
add_relation(mom_transform_key,
mom_geom_key,
"Metaball Motherball Transform -> Geometry");
}
else {
- ComponentKey transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey transform_key(&object->id, NodeType::TRANSFORM);
add_relation(geom_key, mom_geom_key, "Metaball Motherball");
add_relation(transform_key, mom_geom_key, "Metaball Motherball");
}
@@ -2064,13 +2207,12 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
* This relation is similar to what dag_object_time_update_flags()
* was doing for mesh objects with particle system.
*
- * Ideally we need to get rid of this relation.
- */
+ * Ideally we need to get rid of this relation. */
if (object_particles_depends_on_time(object)) {
TimeSourceKey time_key;
OperationKey obdata_ubereval_key(&object->id,
- DEG_NODE_TYPE_GEOMETRY,
- DEG_OPCODE_GEOMETRY_UBEREVAL);
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL);
add_relation(time_key, obdata_ubereval_key, "Legacy particle time");
}
/* Object data datablock. */
@@ -2080,17 +2222,17 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
if (key->adt != NULL) {
if (key->adt->action || key->adt->nla_tracks.first) {
ComponentKey obdata_key((ID *)object->data,
- DEG_NODE_TYPE_GEOMETRY);
- ComponentKey adt_key(&key->id, DEG_NODE_TYPE_ANIMATION);
+ NodeType::GEOMETRY);
+ ComponentKey adt_key(&key->id, NodeType::ANIMATION);
add_relation(adt_key, obdata_key, "Animation");
}
}
}
/* Syncronization back to original object. */
- ComponentKey final_geometry_jey(&object->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey final_geometry_jey(&object->id, NodeType::GEOMETRY);
OperationKey synchronize_key(&object->id,
- DEG_NODE_TYPE_SYNCHRONIZE,
- DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL);
+ NodeType::SYNCHRONIZATION,
+ OperationCode::SYNCHRONIZE_TO_ORIGINAL);
add_relation(
final_geometry_jey, synchronize_key, "Synchronize to Original");
}
@@ -2108,14 +2250,11 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
build_shapekeys(key);
}
/* Link object data evaluation node to exit operation. */
- OperationKey obdata_geom_eval_key(obdata,
- DEG_NODE_TYPE_GEOMETRY,
- DEG_OPCODE_PLACEHOLDER,
- "Geometry Eval");
+ OperationKey obdata_geom_eval_key(
+ obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL);
OperationKey obdata_geom_done_key(obdata,
- DEG_NODE_TYPE_GEOMETRY,
- DEG_OPCODE_PLACEHOLDER,
- "Eval Done");
+ NodeType::GEOMETRY,
+ OperationCode::GEOMETRY_EVAL_DONE);
add_relation(obdata_geom_eval_key,
obdata_geom_done_key,
"ObData Geom Eval Done");
@@ -2131,12 +2270,12 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
Curve *cu = (Curve *)obdata;
if (cu->bevobj != NULL) {
ComponentKey bevob_geom_key(&cu->bevobj->id,
- DEG_NODE_TYPE_GEOMETRY);
+ NodeType::GEOMETRY);
add_relation(bevob_geom_key,
obdata_geom_eval_key,
"Curve Bevel Geometry");
ComponentKey bevob_key(&cu->bevobj->id,
- DEG_NODE_TYPE_TRANSFORM);
+ NodeType::TRANSFORM);
add_relation(bevob_key,
obdata_geom_eval_key,
"Curve Bevel Transform");
@@ -2144,13 +2283,13 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
}
if (cu->taperobj != NULL) {
ComponentKey taperob_key(&cu->taperobj->id,
- DEG_NODE_TYPE_GEOMETRY);
+ NodeType::GEOMETRY);
add_relation(taperob_key, obdata_geom_eval_key, "Curve Taper");
build_object(NULL, cu->taperobj);
}
if (cu->textoncurve != NULL) {
ComponentKey textoncurve_key(&cu->textoncurve->id,
- DEG_NODE_TYPE_GEOMETRY);
+ NodeType::GEOMETRY);
add_relation(textoncurve_key,
obdata_geom_eval_key,
"Text on Curve");
@@ -2167,24 +2306,22 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
/* Geometry cache needs to be recalculated on frame change
* (e.g. to fix crashes after scrubbing the timeline when
* onion skinning is enabled, since the ghosts need to be
- * re-added to the cache once scrubbing ends)
- */
+ * re-added to the cache once scrubbing ends). */
TimeSourceKey time_key;
- ComponentKey geometry_key(obdata, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey geometry_key(obdata, NodeType::GEOMETRY);
add_relation(time_key,
geometry_key,
"GP Frame Change");
/* Geometry cache also needs to be recalculated when Material
* settings change (e.g. when fill.opacity changes on/off,
- * we need to rebuild the bGPDstroke->triangles caches)
- */
+ * we need to rebuild the bGPDstroke->triangles caches). */
for (int i = 0; i < gpd->totcol; i++) {
Material *ma = gpd->mat[i];
if ((ma != NULL) && (ma->gp_style != NULL)) {
OperationKey material_key(&ma->id,
- DEG_NODE_TYPE_SHADING,
- DEG_OPCODE_MATERIAL_UPDATE);
+ NodeType::SHADING,
+ OperationCode::MATERIAL_UPDATE);
add_relation(material_key,
geometry_key,
"Material -> GP Data");
@@ -2212,23 +2349,23 @@ void DepsgraphRelationBuilder::build_camera(Camera *camera)
return;
}
if (camera->dof_ob != NULL) {
- ComponentKey camera_parameters_key(&camera->id, DEG_NODE_TYPE_PARAMETERS);
- ComponentKey dof_ob_key(&camera->dof_ob->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey camera_parameters_key(&camera->id, NodeType::PARAMETERS);
+ ComponentKey dof_ob_key(&camera->dof_ob->id, NodeType::TRANSFORM);
add_relation(dof_ob_key, camera_parameters_key, "Camera DOF");
}
}
-/* Lamps */
-void DepsgraphRelationBuilder::build_lamp(Lamp *lamp)
+/* Lights */
+void DepsgraphRelationBuilder::build_light(Light *lamp)
{
if (built_map_.checkIsBuiltAndTag(lamp)) {
return;
}
- /* lamp's nodetree */
+ /* light's nodetree */
if (lamp->nodetree != NULL) {
build_nodetree(lamp->nodetree);
- ComponentKey lamp_parameters_key(&lamp->id, DEG_NODE_TYPE_PARAMETERS);
- ComponentKey nodetree_key(&lamp->nodetree->id, DEG_NODE_TYPE_SHADING);
+ ComponentKey lamp_parameters_key(&lamp->id, NodeType::PARAMETERS);
+ ComponentKey nodetree_key(&lamp->nodetree->id, NodeType::SHADING);
add_relation(nodetree_key, lamp_parameters_key, "NTree->Light Parameters");
build_nested_nodetree(&lamp->id, lamp->nodetree);
}
@@ -2243,7 +2380,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
return;
}
build_animdata(&ntree->id);
- ComponentKey shading_key(&ntree->id, DEG_NODE_TYPE_SHADING);
+ ComponentKey shading_key(&ntree->id, NodeType::SHADING);
/* nodetree's nodes... */
LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) {
ID *id = bnode->id;
@@ -2265,8 +2402,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
}
else if (id_type == ID_SCE) {
/* Scenes are used by compositor trees, and handled by render
- * pipeline. No need to build dependencies for them here.
- */
+ * pipeline. No need to build dependencies for them here. */
}
else if (id_type == ID_TXT) {
/* Ignore script nodes. */
@@ -2281,7 +2417,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
bNodeTree *group_ntree = (bNodeTree *)id;
build_nodetree(group_ntree);
ComponentKey group_shading_key(&group_ntree->id,
- DEG_NODE_TYPE_SHADING);
+ NodeType::SHADING);
add_relation(group_shading_key, shading_key, "Group Node");
}
else {
@@ -2290,15 +2426,15 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
}
OperationKey shading_update_key(&ntree->id,
- DEG_NODE_TYPE_SHADING,
- DEG_OPCODE_MATERIAL_UPDATE);
+ NodeType::SHADING,
+ OperationCode::MATERIAL_UPDATE);
OperationKey shading_parameters_key(&ntree->id,
- DEG_NODE_TYPE_SHADING_PARAMETERS,
- DEG_OPCODE_MATERIAL_UPDATE);
+ NodeType::SHADING_PARAMETERS,
+ OperationCode::MATERIAL_UPDATE);
add_relation(shading_parameters_key, shading_update_key, "NTree Shading Parameters");
if (check_id_has_anim_component(&ntree->id)) {
- ComponentKey animation_key(&ntree->id, DEG_NODE_TYPE_ANIMATION);
+ ComponentKey animation_key(&ntree->id, NodeType::ANIMATION);
add_relation(animation_key, shading_parameters_key, "NTree Shading Parameters");
}
}
@@ -2315,11 +2451,11 @@ void DepsgraphRelationBuilder::build_material(Material *material)
if (material->nodetree != NULL) {
build_nodetree(material->nodetree);
OperationKey ntree_key(&material->nodetree->id,
- DEG_NODE_TYPE_SHADING,
- DEG_OPCODE_MATERIAL_UPDATE);
+ NodeType::SHADING,
+ OperationCode::MATERIAL_UPDATE);
OperationKey material_key(&material->id,
- DEG_NODE_TYPE_SHADING,
- DEG_OPCODE_MATERIAL_UPDATE);
+ NodeType::SHADING,
+ OperationCode::MATERIAL_UPDATE);
add_relation(ntree_key, material_key, "Material's NTree");
build_nested_nodetree(&material->id, material->nodetree);
}
@@ -2337,9 +2473,9 @@ void DepsgraphRelationBuilder::build_texture(Tex *texture)
build_nodetree(texture->nodetree);
build_nested_nodetree(&texture->id, texture->nodetree);
if (check_id_has_anim_component(&texture->id)) {
- ComponentKey animation_key(&texture->id, DEG_NODE_TYPE_ANIMATION);
+ ComponentKey animation_key(&texture->id, NodeType::ANIMATION);
ComponentKey datablock_key(&texture->id,
- DEG_NODE_TYPE_GENERIC_DATABLOCK);
+ NodeType::GENERIC_DATABLOCK);
add_relation(animation_key, datablock_key, "Datablock Animation");
}
}
@@ -2380,12 +2516,12 @@ void DepsgraphRelationBuilder::build_mask(Mask *mask)
build_animdata(mask_id);
/* Own mask animation. */
OperationKey mask_animation_key(mask_id,
- DEG_NODE_TYPE_ANIMATION,
- DEG_OPCODE_MASK_ANIMATION);
+ NodeType::ANIMATION,
+ OperationCode::MASK_ANIMATION);
TimeSourceKey time_src_key;
add_relation(time_src_key, mask_animation_key, "TimeSrc -> Mask Animation");
/* Final mask evaluation. */
- ComponentKey parameters_key(mask_id, DEG_NODE_TYPE_PARAMETERS);
+ ComponentKey parameters_key(mask_id, NodeType::PARAMETERS);
add_relation(mask_animation_key, parameters_key, "Mask Animation -> Mask Eval");
}
@@ -2416,7 +2552,7 @@ void DepsgraphRelationBuilder::build_speaker(Speaker *speaker)
void DepsgraphRelationBuilder::build_copy_on_write_relations()
{
- foreach (IDDepsNode *id_node, graph_->id_nodes) {
+ for (IDNode *id_node : graph_->id_nodes) {
build_copy_on_write_relations(id_node);
}
}
@@ -2429,11 +2565,11 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations()
void DepsgraphRelationBuilder::build_nested_datablock(ID *owner, ID *id)
{
OperationKey owner_copy_on_write_key(owner,
- DEG_NODE_TYPE_COPY_ON_WRITE,
- DEG_OPCODE_COPY_ON_WRITE);
+ NodeType::COPY_ON_WRITE,
+ OperationCode::COPY_ON_WRITE);
OperationKey id_copy_on_write_key(id,
- DEG_NODE_TYPE_COPY_ON_WRITE,
- DEG_OPCODE_COPY_ON_WRITE);
+ NodeType::COPY_ON_WRITE,
+ OperationCode::COPY_ON_WRITE);
add_relation(id_copy_on_write_key,
owner_copy_on_write_key,
"Eval Order");
@@ -2456,24 +2592,24 @@ void DepsgraphRelationBuilder::build_nested_shapekey(ID *owner, Key *key)
build_nested_datablock(owner, &key->id);
}
-void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node)
+void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node)
{
ID *id_orig = id_node->id_orig;
const ID_Type id_type = GS(id_orig->name);
TimeSourceKey time_source_key;
OperationKey copy_on_write_key(id_orig,
- DEG_NODE_TYPE_COPY_ON_WRITE,
- DEG_OPCODE_COPY_ON_WRITE);
+ NodeType::COPY_ON_WRITE,
+ OperationCode::COPY_ON_WRITE);
/* XXX: This is a quick hack to make Alt-A to work. */
// add_relation(time_source_key, copy_on_write_key, "Fluxgate capacitor hack");
/* Resat of code is using rather low level trickery, so need to get some
* explicit pointers. */
- DepsNode *node_cow = find_node(copy_on_write_key);
- OperationDepsNode *op_cow = node_cow->get_exit_operation();
+ Node *node_cow = find_node(copy_on_write_key);
+ OperationNode *op_cow = node_cow->get_exit_operation();
/* Plug any other components to this one. */
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
- if (comp_node->type == DEG_NODE_TYPE_COPY_ON_WRITE) {
+ if (comp_node->type == NodeType::COPY_ON_WRITE) {
/* Copy-on-write component never depends on itself. */
continue;
}
@@ -2481,13 +2617,13 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node
/* Component explicitly requests to not add relation. */
continue;
}
- int rel_flag = (DEPSREL_FLAG_NO_FLUSH | DEPSREL_FLAG_GODMODE);
- if (id_type == ID_ME && comp_node->type == DEG_NODE_TYPE_GEOMETRY) {
- rel_flag &= ~DEPSREL_FLAG_NO_FLUSH;
+ int rel_flag = (RELATION_FLAG_NO_FLUSH | RELATION_FLAG_GODMODE);
+ if (id_type == ID_ME && comp_node->type == NodeType::GEOMETRY) {
+ rel_flag &= ~RELATION_FLAG_NO_FLUSH;
}
/* materials need update grease pencil objects */
if (id_type == ID_MA) {
- rel_flag &= ~DEPSREL_FLAG_NO_FLUSH;
+ rel_flag &= ~RELATION_FLAG_NO_FLUSH;
}
/* Notes on exceptions:
* - Parameters component is where drivers are living. Changing any
@@ -2506,49 +2642,59 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node
* - Action is allowed to flush as well, this way it's possible to
* keep current tagging in animation editors (which tags action for
* CoW update when it's changed) but yet guarantee evaluation order
- * with objects which are using that action.
- */
- if (comp_node->type == DEG_NODE_TYPE_PARAMETERS ||
- comp_node->type == DEG_NODE_TYPE_LAYER_COLLECTIONS ||
- (comp_node->type == DEG_NODE_TYPE_ANIMATION && id_type == ID_AC))
+ * with objects which are using that action. */
+ if (comp_node->type == NodeType::PARAMETERS ||
+ comp_node->type == NodeType::LAYER_COLLECTIONS)
{
- rel_flag &= ~DEPSREL_FLAG_NO_FLUSH;
+ rel_flag &= ~RELATION_FLAG_NO_FLUSH;
+ }
+ if (comp_node->type == NodeType::ANIMATION && id_type == ID_AC) {
+ rel_flag &= ~RELATION_FLAG_NO_FLUSH;
+ /* NOTE: We only allow flush on user edits. If the action block is
+ * just brought into the dependency graph it is either due to
+ * initial graph construction or due to some property got animated.
+ * In first case all the related datablocks will be tagged for an
+ * update as well. In the second case it is up to the editing
+ * function to tag changed datablock.
+ *
+ * This logic allows to preserve unkeyed changes on file load and on
+ * undo. */
+ rel_flag |= RELATION_FLAG_FLUSH_USER_EDIT_ONLY;
}
/* All entry operations of each component should wait for a proper
- * copy of ID.
- */
- OperationDepsNode *op_entry = comp_node->get_entry_operation();
+ * copy of ID. */
+ OperationNode *op_entry = comp_node->get_entry_operation();
if (op_entry != NULL) {
- DepsRelation *rel = graph_->add_new_relation(
+ Relation *rel = graph_->add_new_relation(
op_cow, op_entry, "CoW Dependency");
rel->flag |= rel_flag;
}
/* All dangling operations should also be executed after copy-on-write. */
- GHASH_FOREACH_BEGIN(OperationDepsNode *, op_node, comp_node->operations_map)
+ GHASH_FOREACH_BEGIN(OperationNode *, op_node, comp_node->operations_map)
{
if (op_node == op_entry) {
continue;
}
if (op_node->inlinks.size() == 0) {
- DepsRelation *rel = graph_->add_new_relation(
+ Relation *rel = graph_->add_new_relation(
op_cow, op_node, "CoW Dependency");
rel->flag |= rel_flag;
}
else {
bool has_same_comp_dependency = false;
- foreach (DepsRelation *rel_current, op_node->inlinks) {
- if (rel_current->from->type != DEG_NODE_TYPE_OPERATION) {
+ for (Relation *rel_current : op_node->inlinks) {
+ if (rel_current->from->type != NodeType::OPERATION) {
continue;
}
- OperationDepsNode *op_node_from =
- (OperationDepsNode *)rel_current->from;
+ OperationNode *op_node_from =
+ (OperationNode *)rel_current->from;
if (op_node_from->owner == op_node->owner) {
has_same_comp_dependency = true;
break;
}
}
if (!has_same_comp_dependency) {
- DepsRelation *rel = graph_->add_new_relation(
+ Relation *rel = graph_->add_new_relation(
op_cow, op_node, "CoW Dependency");
rel->flag |= rel_flag;
}
@@ -2561,25 +2707,23 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node
* component of it's Mesh. This is because pointers are all known
* already so remapping will happen all correct. And then If some object
* evaluation step needs geometry, it will have transitive dependency
- * to Mesh copy-on-write already.
- */
+ * to Mesh copy-on-write already. */
}
GHASH_FOREACH_END();
/* TODO(sergey): This solves crash for now, but causes too many
- * updates potentially.
- */
+ * updates potentially. */
if (GS(id_orig->name) == ID_OB) {
Object *object = (Object *)id_orig;
ID *object_data_id = (ID *)object->data;
if (object_data_id != NULL) {
if (deg_copy_on_write_is_needed(object_data_id)) {
OperationKey data_copy_on_write_key(object_data_id,
- DEG_NODE_TYPE_COPY_ON_WRITE,
- DEG_OPCODE_COPY_ON_WRITE);
+ NodeType::COPY_ON_WRITE,
+ OperationCode::COPY_ON_WRITE);
add_relation(data_copy_on_write_key,
copy_on_write_key,
"Eval Order",
- DEPSREL_FLAG_GODMODE);
+ RELATION_FLAG_GODMODE);
}
}
else {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 928834cbef7..250593eeda0 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Lukas Toenne
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_relations.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
@@ -33,7 +26,7 @@
#include <cstdio>
#include <cstring>
-#include "intern/depsgraph_types.h"
+#include "intern/depsgraph_type.h"
#include "DNA_ID.h"
@@ -43,60 +36,61 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
+#include "intern/builder/deg_builder.h"
#include "intern/builder/deg_builder_map.h"
+#include "intern/builder/deg_builder_rna.h"
#include "intern/depsgraph.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_operation.h"
struct Base;
-struct bArmature;
-struct bAction;
-struct bGPdata;
struct CacheFile;
struct Camera;
-struct ListBase;
+struct Collection;
+struct EffectorWeights;
+struct FCurve;
struct GHash;
struct ID;
-struct FCurve;
-struct Collection;
struct Key;
-struct Lamp;
struct LayerCollection;
+struct Light;
struct LightProbe;
+struct ListBase;
+struct MTex;
struct Main;
struct Mask;
struct Material;
-struct MTex;
struct ModifierData;
struct MovieClip;
-struct bNodeTree;
struct Object;
-struct bPoseChannel;
-struct bConstraint;
-struct ParticleSystem;
struct ParticleSettings;
+struct ParticleSystem;
struct Scene;
struct Speaker;
-struct ViewLayer;
struct Tex;
+struct ViewLayer;
struct World;
-struct EffectorWeights;
+struct bAction;
+struct bArmature;
+struct bConstraint;
+struct bGPdata;
+struct bNodeTree;
+struct bPoseChannel;
struct PropertyRNA;
namespace DEG {
-struct Depsgraph;
-struct DepsNode;
+struct ComponentNode;
struct DepsNodeHandle;
-struct DepsRelation;
-struct RootDepsNode;
-struct IDDepsNode;
-struct TimeSourceDepsNode;
-struct ComponentDepsNode;
-struct OperationDepsNode;
+struct Depsgraph;
+struct IDNode;
+struct Node;
+struct OperationNode;
+struct Relation;
struct RootPChanMap;
+struct TimeSourceNode;
struct TimeSourceKey
{
@@ -111,12 +105,12 @@ struct TimeSourceKey
struct ComponentKey
{
ComponentKey();
- ComponentKey(ID *id, eDepsNode_Type type, const char *name = "");
+ ComponentKey(ID *id, NodeType type, const char *name = "");
string identifier() const;
ID *id;
- eDepsNode_Type type;
+ NodeType type;
const char *name;
};
@@ -124,93 +118,94 @@ struct OperationKey
{
OperationKey();
OperationKey(ID *id,
- eDepsNode_Type component_type,
+ NodeType component_type,
const char *name,
int name_tag = -1);
OperationKey(ID *id,
- eDepsNode_Type component_type,
+ NodeType component_type,
const char *component_name,
const char *name,
int name_tag);
OperationKey(ID *id,
- eDepsNode_Type component_type,
- eDepsOperation_Code opcode);
+ NodeType component_type,
+ OperationCode opcode);
OperationKey(ID *id,
- eDepsNode_Type component_type,
+ NodeType component_type,
const char *component_name,
- eDepsOperation_Code opcode);
+ OperationCode opcode);
OperationKey(ID *id,
- eDepsNode_Type component_type,
- eDepsOperation_Code opcode,
+ NodeType component_type,
+ OperationCode opcode,
const char *name,
int name_tag = -1);
OperationKey(ID *id,
- eDepsNode_Type component_type,
+ NodeType component_type,
const char *component_name,
- eDepsOperation_Code opcode,
+ OperationCode opcode,
const char *name,
int name_tag = -1);
string identifier() const;
ID *id;
- eDepsNode_Type component_type;
+ NodeType component_type;
const char *component_name;
- eDepsOperation_Code opcode;
+ OperationCode opcode;
const char *name;
int name_tag;
};
struct RNAPathKey
{
- /* NOTE: see depsgraph_build.cpp for implementation */
- RNAPathKey(ID *id, const char *path);
-
- RNAPathKey(ID *id, const PointerRNA &ptr, PropertyRNA *prop);
+ RNAPathKey(ID *id, const char *path, RNAPointerSource source);
+ RNAPathKey(ID *id,
+ const PointerRNA &ptr,
+ PropertyRNA *prop,
+ RNAPointerSource source);
string identifier() const;
ID *id;
PointerRNA ptr;
PropertyRNA *prop;
+ RNAPointerSource source;
};
-struct DepsgraphRelationBuilder
+class DepsgraphRelationBuilder : public DepsgraphBuilder
{
+public:
DepsgraphRelationBuilder(Main *bmain, Depsgraph *graph);
void begin_build();
template <typename KeyFrom, typename KeyTo>
- DepsRelation *add_relation(const KeyFrom& key_from,
- const KeyTo& key_to,
- const char *description,
- bool check_unique = false,
- int flags = 0);
-
- template <typename KeyFrom, typename KeyTo>
- DepsRelation *add_relation(const KeyFrom& key_from,
- const KeyTo& key_to,
- const char *description,
- eDepsRelation_Flag flag);
+ Relation *add_relation(const KeyFrom& key_from,
+ const KeyTo& key_to,
+ const char *description,
+ int flags = 0);
template <typename KeyTo>
- DepsRelation *add_relation(const TimeSourceKey& key_from,
- const KeyTo& key_to,
- const char *description,
- bool check_unique = false,
- int flags = 0);
+ Relation *add_relation(const TimeSourceKey& key_from,
+ const KeyTo& key_to,
+ const char *description,
+ int flags = 0);
template <typename KeyType>
- DepsRelation *add_node_handle_relation(const KeyType& key_from,
- const DepsNodeHandle *handle,
- const char *description,
- bool check_unique = false,
- int flags = 0);
-
- void add_customdata_mask(Object *object, uint64_t mask);
+ Relation *add_node_handle_relation(const KeyType& key_from,
+ const DepsNodeHandle *handle,
+ const char *description,
+ int flags = 0);
+
+ /* Adds relation from proper transformation opertation to the modifier.
+ * Takes care of checking for possible physics solvers modifying position
+ * of this object. */
+ void add_modifier_to_transform_relation(const DepsNodeHandle *handle,
+ const char *description);
+
+ void add_customdata_mask(Object *object,
+ const DEGCustomDataMeshMasks &customdata_masks);
void add_special_eval_flag(ID *object, uint32_t flag);
void build_id(ID *id);
@@ -225,13 +220,13 @@ struct DepsgraphRelationBuilder
void build_object_data_camera(Object *object);
void build_object_data_geometry(Object *object);
void build_object_data_geometry_datablock(ID *obdata);
- void build_object_data_lamp(Object *object);
+ void build_object_data_light(Object *object);
void build_object_data_lightprobe(Object *object);
void build_object_data_speaker(Object *object);
void build_object_parent(Object *object);
void build_object_pointcache(Object *object);
void build_constraints(ID *id,
- eDepsNode_Type component_type,
+ NodeType component_type,
const char *component_subdata,
ListBase *constraints,
RootPChanMap *root_map);
@@ -239,17 +234,20 @@ struct DepsgraphRelationBuilder
void build_animdata_curves(ID *id);
void build_animdata_curves_targets(ID *id,
ComponentKey &adt_key,
- OperationDepsNode *operation_from,
+ OperationNode *operation_from,
ListBase *curves);
void build_animdata_nlastrip_targets(ID *id,
ComponentKey &adt_key,
- OperationDepsNode *operation_from,
+ OperationNode *operation_from,
ListBase *strips);
void build_animdata_drivers(ID *id);
+ void build_animation_images(ID *id);
void build_action(bAction *action);
void build_driver(ID *id, FCurve *fcurve);
void build_driver_data(ID *id, FCurve *fcurve);
void build_driver_variables(ID *id, FCurve *fcurve);
+ void build_driver_id_property(ID *id, const char *rna_path);
+ void build_parameters(ID *id);
void build_world(World *world);
void build_rigidbody(Scene *scene);
void build_particle_systems(Object *object);
@@ -270,7 +268,7 @@ struct DepsgraphRelationBuilder
void build_shapekeys(Key *key);
void build_armature(bArmature *armature);
void build_camera(Camera *camera);
- void build_lamp(Lamp *lamp);
+ void build_light(Light *lamp);
void build_nodetree(bNodeTree *ntree);
void build_material(Material *ma);
void build_texture(Tex *tex);
@@ -286,43 +284,41 @@ struct DepsgraphRelationBuilder
void build_nested_nodetree(ID *owner, bNodeTree *ntree);
void build_nested_shapekey(ID *owner, Key *key);
- void add_collision_relations(const OperationKey &key,
- Object *object,
- Collection *collection,
- const char *name);
- void add_forcefield_relations(const OperationKey &key,
- Object *object,
- ParticleSystem *psys,
- EffectorWeights *eff,
- bool add_absorption, const char *name);
+ void add_particle_collision_relations(const OperationKey &key,
+ Object *object,
+ Collection *collection,
+ const char *name);
+ void add_particle_forcefield_relations(const OperationKey &key,
+ Object *object,
+ ParticleSystem *psys,
+ EffectorWeights *eff,
+ bool add_absorption, const char *name);
void build_copy_on_write_relations();
- void build_copy_on_write_relations(IDDepsNode *id_node);
+ void build_copy_on_write_relations(IDNode *id_node);
template <typename KeyType>
- OperationDepsNode *find_operation_node(const KeyType &key);
+ OperationNode *find_operation_node(const KeyType &key);
Depsgraph *getGraph();
protected:
- TimeSourceDepsNode *get_node(const TimeSourceKey &key) const;
- ComponentDepsNode *get_node(const ComponentKey &key) const;
- OperationDepsNode *get_node(const OperationKey &key) const;
- DepsNode *get_node(const RNAPathKey &key) const;
+ TimeSourceNode *get_node(const TimeSourceKey &key) const;
+ ComponentNode *get_node(const ComponentKey &key) const;
+ OperationNode *get_node(const OperationKey &key) const;
+ Node *get_node(const RNAPathKey &key);
- OperationDepsNode *find_node(const OperationKey &key) const;
+ OperationNode *find_node(const OperationKey &key) const;
bool has_node(const OperationKey &key) const;
- DepsRelation *add_time_relation(TimeSourceDepsNode *timesrc,
- DepsNode *node_to,
- const char *description,
- bool check_unique = false,
- int flags = 0);
- DepsRelation *add_operation_relation(OperationDepsNode *node_from,
- OperationDepsNode *node_to,
- const char *description,
- bool check_unique = false,
- int flags = 0);
+ Relation *add_time_relation(TimeSourceNode *timesrc,
+ Node *node_to,
+ const char *description,
+ int flags = 0);
+ Relation *add_operation_relation(OperationNode *node_from,
+ OperationNode *node_to,
+ const char *description,
+ int flags = 0);
template <typename KeyType>
DepsNodeHandle create_node_handle(const KeyType& key,
@@ -334,25 +330,16 @@ protected:
*
* This is used by drivers relations builder to avoid possible fake
* dependency cycle when one bone property drives another property of the
- * same bone.
- */
+ * same bone. */
template <typename KeyFrom, typename KeyTo>
bool is_same_bone_dependency(const KeyFrom& key_from, const KeyTo& key_to);
/* Similar to above, but used to check whether driver is using node from
- * the same node tree as a driver variable.
- */
+ * the same node tree as a driver variable. */
template <typename KeyFrom, typename KeyTo>
bool is_same_nodetree_node_dependency(const KeyFrom& key_from,
const KeyTo& key_to);
- /* Similar to above, but used to check whether driver is using key from
- * the same key datablock as a driver variable.
- */
- template <typename KeyFrom, typename KeyTo>
- bool is_same_shapekey_dependency(const KeyFrom& key_from,
- const KeyTo& key_to);
-
private:
struct BuilderWalkUserData {
DepsgraphRelationBuilder *builder;
@@ -368,20 +355,17 @@ private:
bool is_reference,
void *user_data);
- /* State which never changes, same for the whole builder time. */
- Main *bmain_;
- Depsgraph *graph_;
-
/* State which demotes currently built entities. */
Scene *scene_;
BuilderMap built_map_;
+ RNANodeQuery rna_node_query_;
};
struct DepsNodeHandle
{
DepsNodeHandle(DepsgraphRelationBuilder *builder,
- OperationDepsNode *node,
+ OperationNode *node,
const char *default_name = "")
: builder(builder),
node(node),
@@ -391,7 +375,7 @@ struct DepsNodeHandle
}
DepsgraphRelationBuilder *builder;
- OperationDepsNode *node;
+ OperationNode *node;
const char *default_name;
};
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h
index 726393f39b9..613e8f86baf 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,15 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Lukas Toenne
- * Contributor(s): Sergey SHarybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_relations_impl.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
-#include "intern/nodes/deg_node_id.h"
+#include "intern/node/deg_node_id.h"
extern "C" {
#include "DNA_ID.h"
@@ -39,26 +32,24 @@ extern "C" {
namespace DEG {
template <typename KeyType>
-OperationDepsNode *DepsgraphRelationBuilder::find_operation_node(const KeyType& key)
+OperationNode *DepsgraphRelationBuilder::find_operation_node(const KeyType& key)
{
- DepsNode *node = get_node(key);
+ Node *node = get_node(key);
return node != NULL ? node->get_exit_operation() : NULL;
}
template <typename KeyFrom, typename KeyTo>
-DepsRelation *DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from,
- const KeyTo &key_to,
- const char *description,
- bool check_unique,
- int flags)
+Relation *DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from,
+ const KeyTo &key_to,
+ const char *description,
+ int flags)
{
- DepsNode *node_from = get_node(key_from);
- DepsNode *node_to = get_node(key_to);
- OperationDepsNode *op_from = node_from ? node_from->get_exit_operation() : NULL;
- OperationDepsNode *op_to = node_to ? node_to->get_entry_operation() : NULL;
+ Node *node_from = get_node(key_from);
+ Node *node_to = get_node(key_to);
+ OperationNode *op_from = node_from ? node_from->get_exit_operation() : NULL;
+ OperationNode *op_to = node_to ? node_to->get_entry_operation() : NULL;
if (op_from && op_to) {
- return add_operation_relation(
- op_from, op_to, description, check_unique, flags);
+ return add_operation_relation(op_from, op_to, description, flags);
}
else {
if (!op_from) {
@@ -83,49 +74,35 @@ DepsRelation *DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from,
return NULL;
}
-template <typename KeyFrom, typename KeyTo>
-DepsRelation *DepsgraphRelationBuilder::add_relation(
- const KeyFrom& key_from,
- const KeyTo& key_to,
- const char *description,
- eDepsRelation_Flag flag)
-{
- return add_relation(
- key_from, key_to, description, false, static_cast<int>(flag));
-}
-
template <typename KeyTo>
-DepsRelation *DepsgraphRelationBuilder::add_relation(
+Relation *DepsgraphRelationBuilder::add_relation(
const TimeSourceKey &key_from,
const KeyTo &key_to,
const char *description,
- bool check_unique,
int flags)
{
- TimeSourceDepsNode *time_from = get_node(key_from);
- DepsNode *node_to = get_node(key_to);
- OperationDepsNode *op_to = node_to ? node_to->get_entry_operation() : NULL;
+ TimeSourceNode *time_from = get_node(key_from);
+ Node *node_to = get_node(key_to);
+ OperationNode *op_to = node_to ? node_to->get_entry_operation() : NULL;
if (time_from != NULL && op_to != NULL) {
return add_time_relation(
- time_from, op_to, description, check_unique, flags);
+ time_from, op_to, description, flags);
}
return NULL;
}
template <typename KeyType>
-DepsRelation *DepsgraphRelationBuilder::add_node_handle_relation(
+Relation *DepsgraphRelationBuilder::add_node_handle_relation(
const KeyType &key_from,
const DepsNodeHandle *handle,
const char *description,
- bool check_unique,
int flags)
{
- DepsNode *node_from = get_node(key_from);
- OperationDepsNode *op_from = node_from ? node_from->get_exit_operation() : NULL;
- OperationDepsNode *op_to = handle->node->get_entry_operation();
+ Node *node_from = get_node(key_from);
+ OperationNode *op_from = node_from ? node_from->get_exit_operation() : NULL;
+ OperationNode *op_to = handle->node->get_entry_operation();
if (op_from != NULL && op_to != NULL) {
- return add_operation_relation(
- op_from, op_to, description, check_unique, flags);
+ return add_operation_relation(op_from, op_to, description, flags);
}
else {
if (!op_from) {
@@ -157,13 +134,13 @@ bool DepsgraphRelationBuilder::is_same_bone_dependency(const KeyFrom& key_from,
const KeyTo& key_to)
{
/* Get operations for requested keys. */
- DepsNode *node_from = get_node(key_from);
- DepsNode *node_to = get_node(key_to);
+ Node *node_from = get_node(key_from);
+ Node *node_to = get_node(key_to);
if (node_from == NULL || node_to == NULL) {
return false;
}
- OperationDepsNode *op_from = node_from->get_exit_operation();
- OperationDepsNode *op_to = node_to->get_entry_operation();
+ OperationNode *op_from = node_from->get_exit_operation();
+ OperationNode *op_to = node_to->get_entry_operation();
if (op_from == NULL || op_to == NULL) {
return false;
}
@@ -172,13 +149,13 @@ bool DepsgraphRelationBuilder::is_same_bone_dependency(const KeyFrom& key_from,
return false;
}
/* We are only interested in relations like BONE_DONE -> BONE_LOCAL... */
- if (!(op_from->opcode == DEG_OPCODE_BONE_DONE &&
- op_to->opcode == DEG_OPCODE_BONE_LOCAL))
+ if (!(op_from->opcode == OperationCode::BONE_DONE &&
+ op_to->opcode == OperationCode::BONE_LOCAL))
{
return false;
}
/* ... BUT, we also need to check if it's same bone. */
- if (!STREQ(op_from->owner->name, op_to->owner->name)) {
+ if (op_from->owner->name != op_to->owner->name) {
return false;
}
return true;
@@ -190,13 +167,13 @@ bool DepsgraphRelationBuilder::is_same_nodetree_node_dependency(
const KeyTo& key_to)
{
/* Get operations for requested keys. */
- DepsNode *node_from = get_node(key_from);
- DepsNode *node_to = get_node(key_to);
+ Node *node_from = get_node(key_from);
+ Node *node_to = get_node(key_to);
if (node_from == NULL || node_to == NULL) {
return false;
}
- OperationDepsNode *op_from = node_from->get_exit_operation();
- OperationDepsNode *op_to = node_to->get_entry_operation();
+ OperationNode *op_from = node_from->get_exit_operation();
+ OperationNode *op_to = node_to->get_entry_operation();
if (op_from == NULL || op_to == NULL) {
return false;
}
@@ -209,39 +186,12 @@ bool DepsgraphRelationBuilder::is_same_nodetree_node_dependency(
return false;
}
/* We are only interested in relations like BONE_DONE -> BONE_LOCAL... */
- if (!(op_from->opcode == DEG_OPCODE_PARAMETERS_EVAL &&
- op_to->opcode == DEG_OPCODE_PARAMETERS_EVAL))
+ if (!(op_from->opcode == OperationCode::PARAMETERS_EVAL &&
+ op_to->opcode == OperationCode::PARAMETERS_EVAL))
{
return false;
}
return true;
}
-template <typename KeyFrom, typename KeyTo>
-bool DepsgraphRelationBuilder::is_same_shapekey_dependency(
- const KeyFrom& key_from,
- const KeyTo& key_to)
-{
- /* Get operations for requested keys. */
- DepsNode *node_from = get_node(key_from);
- DepsNode *node_to = get_node(key_to);
- if (node_from == NULL || node_to == NULL) {
- return false;
- }
- OperationDepsNode *op_from = node_from->get_exit_operation();
- OperationDepsNode *op_to = node_to->get_entry_operation();
- if (op_from == NULL || op_to == NULL) {
- return false;
- }
- /* Check if this is actually a shape key datablock. */
- if (GS(op_from->owner->owner->id_orig->name) != ID_KE) {
- return false;
- }
- /* Different key data blocks. */
- if (op_from->owner->owner != op_to->owner->owner) {
- return false;
- }
- return true;
-}
-
} // namespace DEG
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
index 3aae358dda3..22ff10d3b70 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Based on original depsgraph.c code - Blender Foundation (2005-2013)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Methods for constructing depsgraph
*/
@@ -34,7 +27,7 @@
namespace DEG {
-/////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
// Time source.
TimeSourceKey::TimeSourceKey()
@@ -52,17 +45,17 @@ string TimeSourceKey::identifier() const
return string("TimeSourceKey");
}
-/////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
// Component.
ComponentKey::ComponentKey()
: id(NULL),
- type(DEG_NODE_TYPE_UNDEFINED),
+ type(NodeType::UNDEFINED),
name("")
{
}
-ComponentKey::ComponentKey(ID *id, eDepsNode_Type type, const char *name)
+ComponentKey::ComponentKey(ID *id, NodeType type, const char *name)
: id(id),
type(type),
name(name)
@@ -82,49 +75,49 @@ string ComponentKey::identifier() const
return result;
}
-/////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
// Operation.
OperationKey::OperationKey()
: id(NULL),
- component_type(DEG_NODE_TYPE_UNDEFINED),
+ component_type(NodeType::UNDEFINED),
component_name(""),
- opcode(DEG_OPCODE_OPERATION),
+ opcode(OperationCode::OPERATION),
name(""),
name_tag(-1)
{
}
OperationKey::OperationKey(ID *id,
- eDepsNode_Type component_type,
+ NodeType component_type,
const char *name,
int name_tag)
: id(id),
component_type(component_type),
component_name(""),
- opcode(DEG_OPCODE_OPERATION),
+ opcode(OperationCode::OPERATION),
name(name),
name_tag(name_tag)
{
}
OperationKey::OperationKey(ID *id,
- eDepsNode_Type component_type,
+ NodeType component_type,
const char *component_name,
const char *name,
int name_tag)
: id(id),
component_type(component_type),
component_name(component_name),
- opcode(DEG_OPCODE_OPERATION),
+ opcode(OperationCode::OPERATION),
name(name),
name_tag(name_tag)
{
}
OperationKey::OperationKey(ID *id,
- eDepsNode_Type component_type,
- eDepsOperation_Code opcode)
+ NodeType component_type,
+ OperationCode opcode)
: id(id),
component_type(component_type),
component_name(""),
@@ -135,9 +128,9 @@ OperationKey::OperationKey(ID *id,
}
OperationKey::OperationKey(ID *id,
- eDepsNode_Type component_type,
+ NodeType component_type,
const char *component_name,
- eDepsOperation_Code opcode)
+ OperationCode opcode)
: id(id),
component_type(component_type),
component_name(component_name),
@@ -148,8 +141,8 @@ OperationKey::OperationKey(ID *id,
}
OperationKey::OperationKey(ID *id,
- eDepsNode_Type component_type,
- eDepsOperation_Code opcode,
+ NodeType component_type,
+ OperationCode opcode,
const char *name,
int name_tag)
: id(id),
@@ -162,9 +155,9 @@ OperationKey::OperationKey(ID *id,
}
OperationKey::OperationKey(ID *id,
- eDepsNode_Type component_type,
+ NodeType component_type,
const char *component_name,
- eDepsOperation_Code opcode,
+ OperationCode opcode,
const char *name,
int name_tag)
: id(id),
@@ -189,30 +182,35 @@ string OperationKey::identifier() const
return result;
}
-/////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
// RNA path.
-RNAPathKey::RNAPathKey(ID *id, const PointerRNA &ptr, PropertyRNA *prop)
+RNAPathKey::RNAPathKey(ID *id, const char *path, RNAPointerSource source)
: id(id),
- ptr(ptr),
- prop(prop)
+ source(source)
{
-}
-
-RNAPathKey::RNAPathKey(ID *id, const char *path)
- : id(id)
-{
- /* create ID pointer for root of path lookup */
+ /* Create ID pointer for root of path lookup. */
PointerRNA id_ptr;
RNA_id_pointer_create(id, &id_ptr);
- /* try to resolve path... */
+ /* Try to resolve path. */
int index;
- if (!RNA_path_resolve_full(&id_ptr, path, &this->ptr, &this->prop, &index)) {
- this->ptr = PointerRNA_NULL;
- this->prop = NULL;
+ if (!RNA_path_resolve_full(&id_ptr, path, &ptr, &prop, &index)) {
+ ptr = PointerRNA_NULL;
+ prop = NULL;
}
}
+RNAPathKey::RNAPathKey(ID *id,
+ const PointerRNA &ptr,
+ PropertyRNA *prop,
+ RNAPointerSource source)
+ : id(id),
+ ptr(ptr),
+ prop(prop),
+ source(source)
+{
+}
+
string RNAPathKey::identifier() const
{
const char *id_name = (id) ? id->name : "<No ID>";
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
index efedf847515..fe88b532dca 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Based on original depsgraph.c code - Blender Foundation (2005-2013)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Methods for constructing depsgraph
*/
@@ -59,15 +52,12 @@ extern "C" {
#include "intern/builder/deg_builder.h"
#include "intern/builder/deg_builder_pchanmap.h"
+#include "intern/debug/deg_debug.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_operation.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-
-#include "intern/depsgraph_intern.h"
-#include "intern/depsgraph_types.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph_type.h"
namespace DEG {
@@ -84,51 +74,51 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
return;
}
OperationKey pchan_local_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_LOCAL);
+ OperationCode::BONE_LOCAL);
OperationKey init_ik_key(
- &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK);
+ &object->id, NodeType::EVAL_POSE, OperationCode::POSE_INIT_IK);
OperationKey solver_key(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
+ NodeType::EVAL_POSE,
rootchan->name,
- DEG_OPCODE_POSE_IK_SOLVER);
+ OperationCode::POSE_IK_SOLVER);
OperationKey pose_cleanup_key(
- &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_CLEANUP);
+ &object->id, NodeType::EVAL_POSE, OperationCode::POSE_CLEANUP);
add_relation(pchan_local_key, init_ik_key, "IK Constraint -> Init IK Tree");
add_relation(init_ik_key, solver_key, "Init IK -> IK Solver");
/* Never cleanup before solver is run. */
add_relation(solver_key,
pose_cleanup_key,
"IK Solver -> Cleanup",
- DEPSREL_FLAG_GODMODE);
+ RELATION_FLAG_GODMODE);
/* IK target */
/* TODO(sergey): This should get handled as part of the constraint code. */
if (data->tar != NULL) {
- /* TODO(sergey): For until we'll store partial matricies in the
+ /* TODO(sergey): For until we'll store partial matrices in the
* depsgraph, we create dependency between target object and pose eval
* component.
*
* This way we ensuring the whole subtree is updated from scratch
- * without need of intermediate matricies. This is an overkill, but good
+ * without need of intermediate matrices. This is an overkill, but good
* enough for testing IK solver. */
- ComponentKey pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE);
+ ComponentKey pose_key(&object->id, NodeType::EVAL_POSE);
if ((data->tar->type == OB_ARMATURE) && (data->subtarget[0])) {
/* TODO(sergey): This is only for until granular update stores
* intermediate result. */
if (data->tar != object) {
/* Different armature - can just read the results. */
ComponentKey target_key(
- &data->tar->id, DEG_NODE_TYPE_BONE, data->subtarget);
+ &data->tar->id, NodeType::BONE, data->subtarget);
add_relation(target_key, pose_key, con->name);
}
else {
/* Same armature - we'll use the ready state only, just in case
* this bone is in the chain we're solving. */
OperationKey target_key(&data->tar->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
data->subtarget,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
add_relation(target_key, solver_key, con->name);
}
}
@@ -138,13 +128,13 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
/* Vertex group target. */
/* NOTE: for now, we don't need to represent vertex groups
* separately. */
- ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey target_key(&data->tar->id, NodeType::GEOMETRY);
add_relation(target_key, solver_key, con->name);
- add_customdata_mask(data->tar, CD_MASK_MDEFORMVERT);
+ add_customdata_mask(data->tar, DEGCustomDataMeshMasks::MaskVert(CD_MASK_MDEFORMVERT));
}
else {
/* Standard Object Target. */
- ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey target_key(&data->tar->id, NodeType::TRANSFORM);
add_relation(target_key, pose_key, con->name);
}
if (data->tar == object && data->subtarget[0]) {
@@ -158,7 +148,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
if (data->poletar != NULL) {
if ((data->poletar->type == OB_ARMATURE) && (data->polesubtarget[0])) {
ComponentKey target_key(&data->poletar->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
data->polesubtarget);
add_relation(target_key, solver_key, con->name);
}
@@ -168,12 +158,12 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
/* Vertex group target. */
/* NOTE: for now, we don't need to represent vertex groups
* separately. */
- ComponentKey target_key(&data->poletar->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey target_key(&data->poletar->id, NodeType::GEOMETRY);
add_relation(target_key, solver_key, con->name);
- add_customdata_mask(data->poletar, CD_MASK_MDEFORMVERT);
+ add_customdata_mask(data->poletar, DEGCustomDataMeshMasks::MaskVert(CD_MASK_MDEFORMVERT));
}
else {
- ComponentKey target_key(&data->poletar->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey target_key(&data->poletar->id, NodeType::TRANSFORM);
add_relation(target_key, solver_key, con->name);
}
}
@@ -189,8 +179,8 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
parchan = pchan->parent;
}
root_map->add_bone(parchan->name, rootchan->name);
- OperationKey parchan_transforms_key(&object->id, DEG_NODE_TYPE_BONE,
- parchan->name, DEG_OPCODE_BONE_READY);
+ OperationKey parchan_transforms_key(&object->id, NodeType::BONE,
+ parchan->name, OperationCode::BONE_READY);
add_relation(parchan_transforms_key, solver_key, "IK Solver Owner");
/* Walk to the chain's root. */
int segcount = 0;
@@ -201,21 +191,21 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
* with IK solver results. */
if (parchan != pchan) {
OperationKey parent_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
parchan->name,
- DEG_OPCODE_BONE_READY);
+ OperationCode::BONE_READY);
add_relation(parent_key, solver_key, "IK Chain Parent");
OperationKey bone_done_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
parchan->name,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
add_relation(solver_key, bone_done_key, "IK Chain Result");
}
else {
OperationKey final_transforms_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
parchan->name,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
add_relation(solver_key, final_transforms_key, "IK Solver Result");
}
parchan->flag |= POSE_DONE;
@@ -234,7 +224,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
parchan = parchan->parent;
}
OperationKey pose_done_key(
- &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE);
+ &object->id, NodeType::EVAL_POSE, OperationCode::POSE_DONE);
add_relation(solver_key, pose_done_key, "PoseEval Result-Bone Link");
}
@@ -247,18 +237,18 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object,
bSplineIKConstraint *data = (bSplineIKConstraint *)con->data;
bPoseChannel *rootchan = BKE_armature_splineik_solver_find_root(pchan, data);
OperationKey transforms_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_READY);
+ OperationCode::BONE_READY);
OperationKey init_ik_key(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
- DEG_OPCODE_POSE_INIT_IK);
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_INIT_IK);
OperationKey solver_key(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
+ NodeType::EVAL_POSE,
rootchan->name,
- DEG_OPCODE_POSE_SPLINE_IK_SOLVER);
+ OperationCode::POSE_SPLINE_IK_SOLVER);
OperationKey pose_cleanup_key(
- &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_CLEANUP);
+ &object->id, NodeType::EVAL_POSE, OperationCode::POSE_CLEANUP);
/* Solver depends on initialization. */
add_relation(init_ik_key, solver_key, "Init IK -> IK Solver");
/* Never cleanup before solver is run. */
@@ -267,22 +257,21 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object,
add_relation(transforms_key,
solver_key,
"Spline IK Solver Owner",
- DEPSREL_FLAG_GODMODE);
+ RELATION_FLAG_GODMODE);
/* Attach path dependency to solver. */
if (data->tar != NULL) {
/* TODO(sergey): For until we'll store partial matricies in the
* depsgraph, we create dependency between target object and pose eval
- * component. See IK pose for a bit more information.
- */
+ * component. See IK pose for a bit more information. */
/* TODO: the bigggest point here is that we need the curve PATH and not
* just the general geometry. */
- ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_GEOMETRY);
- ComponentKey pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE);
+ ComponentKey target_key(&data->tar->id, NodeType::GEOMETRY);
+ ComponentKey pose_key(&object->id, NodeType::EVAL_POSE);
add_relation(target_key, pose_key, "Curve.Path -> Spline IK");
}
pchan->flag |= POSE_DONE;
OperationKey final_transforms_key(
- &object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_DONE);
+ &object->id, NodeType::BONE, pchan->name, OperationCode::BONE_DONE);
add_relation(solver_key, final_transforms_key, "Spline IK Result");
root_map->add_bone(pchan->name, rootchan->name);
/* Walk to the chain's root/ */
@@ -297,21 +286,21 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object,
* the result with IK solver results. */
if (parchan != pchan) {
OperationKey parent_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
parchan->name,
- DEG_OPCODE_BONE_READY);
+ OperationCode::BONE_READY);
add_relation(parent_key, solver_key, "Spline IK Solver Update");
OperationKey bone_done_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
parchan->name,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
add_relation(solver_key, bone_done_key, "IK Chain Result");
}
parchan->flag |= POSE_DONE;
OperationKey final_transforms_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
parchan->name,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
add_relation(
solver_key, final_transforms_key, "Spline IK Solver Result");
root_map->add_bone(parchan->name, rootchan->name);
@@ -323,7 +312,7 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object,
}
}
OperationKey pose_done_key(
- &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE);
+ &object->id, NodeType::EVAL_POSE, OperationCode::POSE_DONE);
add_relation(solver_key, pose_done_key, "PoseEval Result-Bone Link");
}
@@ -334,15 +323,15 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
bArmature *armature = (bArmature *)object->data;
// TODO: selection status?
/* Attach links between pose operations. */
- ComponentKey local_transform(&object->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey local_transform(&object->id, NodeType::TRANSFORM);
OperationKey pose_init_key(
- &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT);
+ &object->id, NodeType::EVAL_POSE, OperationCode::POSE_INIT);
OperationKey pose_init_ik_key(
- &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK);
+ &object->id, NodeType::EVAL_POSE, OperationCode::POSE_INIT_IK);
OperationKey pose_cleanup_key(
- &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_CLEANUP);
+ &object->id, NodeType::EVAL_POSE, OperationCode::POSE_CLEANUP);
OperationKey pose_done_key(
- &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE);
+ &object->id, NodeType::EVAL_POSE, OperationCode::POSE_DONE);
add_relation(
local_transform, pose_init_key, "Local Transform -> Pose Init");
add_relation(pose_init_key, pose_init_ik_key, "Pose Init -> Pose Init IK");
@@ -351,9 +340,8 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
/* Make sure pose is up-to-date with armature updates. */
build_armature(armature);
OperationKey armature_key(&armature->id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_PLACEHOLDER,
- "Armature Eval");
+ NodeType::PARAMETERS,
+ OperationCode::ARMATURE_EVAL);
add_relation(armature_key, pose_init_key, "Data dependency");
/* IK Solvers.
*
@@ -401,50 +389,50 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
if (pose_depends_on_local_transform) {
/* TODO(sergey): Once partial updates are possible use relation between
* object transform and solver itself in it's build function. */
- ComponentKey pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE);
- ComponentKey local_transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey pose_key(&object->id, NodeType::EVAL_POSE);
+ ComponentKey local_transform_key(&object->id, NodeType::TRANSFORM);
add_relation(local_transform_key, pose_key, "Local Transforms");
}
/* Links between operations for each bone. */
LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
OperationKey bone_local_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_LOCAL);
+ OperationCode::BONE_LOCAL);
OperationKey bone_pose_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_POSE_PARENT);
+ OperationCode::BONE_POSE_PARENT);
OperationKey bone_ready_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_READY);
+ OperationCode::BONE_READY);
OperationKey bone_done_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
pchan->flag &= ~POSE_DONE;
/* Pose init to bone local. */
add_relation(pose_init_key,
bone_local_key,
"Pose Init - Bone Local",
- DEPSREL_FLAG_GODMODE);
+ RELATION_FLAG_GODMODE);
/* Local to pose parenting operation. */
add_relation(bone_local_key, bone_pose_key, "Bone Local - Bone Pose");
/* Parent relation. */
if (pchan->parent != NULL) {
- eDepsOperation_Code parent_key_opcode;
+ OperationCode parent_key_opcode;
/* NOTE: this difference in handling allows us to prevent lockups
* while ensuring correct poses for separate chains. */
if (root_map.has_common_root(pchan->name, pchan->parent->name)) {
- parent_key_opcode = DEG_OPCODE_BONE_READY;
+ parent_key_opcode = OperationCode::BONE_READY;
}
else {
- parent_key_opcode = DEG_OPCODE_BONE_DONE;
+ parent_key_opcode = OperationCode::BONE_DONE;
}
OperationKey parent_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->parent->name,
parent_key_opcode);
add_relation(
@@ -459,15 +447,15 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
&pchan->constraints, constraint_walk, &data);
/* Constraints stack and constraint dependencies. */
build_constraints(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
&pchan->constraints,
&root_map);
/* Pose -> constraints. */
OperationKey constraints_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_CONSTRAINTS);
+ OperationCode::BONE_CONSTRAINTS);
add_relation(bone_pose_key, constraints_key, "Constraints Stack");
/* Constraints -> ready/ */
/* TODO(sergey): When constraint stack is exploded, this step should
@@ -487,9 +475,9 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
/* B-Bone shape is the real final step after Done if present. */
if (pchan->bone != NULL && pchan->bone->segments > 1) {
OperationKey bone_segments_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_SEGMENTS);
+ OperationCode::BONE_SEGMENTS);
/* B-Bone shape depends on the final position of the bone. */
add_relation(bone_done_key,
bone_segments_key,
@@ -499,18 +487,18 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
BKE_pchan_bbone_handles_get(pchan, &prev, &next);
if (prev) {
OperationKey prev_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
prev->name,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
add_relation(prev_key,
bone_segments_key,
"Prev Handle -> B-Bone Segments");
}
if (next) {
OperationKey next_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
next->name,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
add_relation(next_key,
bone_segments_key,
"Next Handle -> B-Bone Segments");
@@ -519,7 +507,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
add_relation(bone_segments_key,
pose_done_key,
"PoseEval Result-Bone Link",
- DEPSREL_FLAG_GODMODE);
+ RELATION_FLAG_GODMODE);
add_relation(bone_segments_key,
pose_cleanup_key,
"Cleanup dependency");
@@ -547,30 +535,30 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object)
Object *proxy_from = object->proxy_from;
build_armature(armature);
OperationKey pose_init_key(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
- DEG_OPCODE_POSE_INIT);
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_INIT);
OperationKey pose_done_key(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
- DEG_OPCODE_POSE_DONE);
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_DONE);
OperationKey pose_cleanup_key(&object->id,
- DEG_NODE_TYPE_EVAL_POSE,
- DEG_OPCODE_POSE_CLEANUP);
+ NodeType::EVAL_POSE,
+ OperationCode::POSE_CLEANUP);
LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
OperationKey bone_local_key(&object->id,
- DEG_NODE_TYPE_BONE, pchan->name,
- DEG_OPCODE_BONE_LOCAL);
+ NodeType::BONE, pchan->name,
+ OperationCode::BONE_LOCAL);
OperationKey bone_ready_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_READY);
+ OperationCode::BONE_READY);
OperationKey bone_done_key(&object->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
OperationKey from_bone_done_key(&proxy_from->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_DONE);
+ OperationCode::BONE_DONE);
add_relation(pose_init_key, bone_local_key, "Pose Init -> Bone Local");
add_relation(bone_local_key, bone_ready_key, "Local -> Ready");
add_relation(bone_ready_key, bone_done_key, "Ready -> Done");
@@ -579,18 +567,17 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object)
add_relation(bone_done_key,
pose_done_key,
"Bone Done -> Pose Done",
- DEPSREL_FLAG_GODMODE);
-
+ RELATION_FLAG_GODMODE);
/* Make sure bone in the proxy is not done before it's FROM is done. */
if (pchan->bone && pchan->bone->segments > 1) {
OperationKey from_bone_segments_key(&proxy_from->id,
- DEG_NODE_TYPE_BONE,
+ NodeType::BONE,
pchan->name,
- DEG_OPCODE_BONE_SEGMENTS);
+ OperationCode::BONE_SEGMENTS);
add_relation(from_bone_segments_key,
bone_done_key,
"Bone Segments -> Bone Done",
- DEPSREL_FLAG_GODMODE);
+ RELATION_FLAG_GODMODE);
}
else {
add_relation(from_bone_done_key,
@@ -600,12 +587,12 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object)
if (pchan->prop != NULL) {
OperationKey bone_parameters(&object->id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_PARAMETERS_EVAL,
+ NodeType::PARAMETERS,
+ OperationCode::PARAMETERS_EVAL,
pchan->name);
OperationKey from_bone_parameters(&proxy_from->id,
- DEG_NODE_TYPE_PARAMETERS,
- DEG_OPCODE_PARAMETERS_EVAL,
+ NodeType::PARAMETERS,
+ OperationCode::PARAMETERS_EVAL,
pchan->name);
add_relation(from_bone_parameters,
bone_parameters,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
index f77d47874a2..622bb4a8a02 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Based on original depsgraph.c code - Blender Foundation (2005-2013)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Methods for constructing depsgraph
*/
@@ -57,15 +50,12 @@ extern "C" {
#include "intern/builder/deg_builder.h"
#include "intern/builder/deg_builder_pchanmap.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/depsgraph_types.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph_type.h"
namespace DEG {
@@ -92,13 +82,9 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la
/* Scene objects. */
/* NOTE: Nodes builder requires us to pass CoW base because it's being
* passed to the evaluation functions. During relations builder we only
- * do NULL-pointer check of the base, so it's fine to pass original one.
- */
- const int base_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
- BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER;
+ * do NULL-pointer check of the base, so it's fine to pass original one. */
LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
- const bool is_object_visible = (base->flag & base_flag);
- if (is_object_visible) {
+ if (need_pull_base_into_graph(base)) {
build_object(base, base->object);
}
}
@@ -125,17 +111,23 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la
build_compositor(scene);
}
/* Masks. */
- LISTBASE_FOREACH (Mask *, mask, &bmain_->mask) {
+ LISTBASE_FOREACH (Mask *, mask, &bmain_->masks) {
build_mask(mask);
}
/* Movie clips. */
- LISTBASE_FOREACH (MovieClip *, clip, &bmain_->movieclip) {
+ LISTBASE_FOREACH (MovieClip *, clip, &bmain_->movieclips) {
build_movieclip(clip);
}
/* Material override. */
if (view_layer->mat_override != NULL) {
build_material(view_layer->mat_override);
}
+ /* Freestyle collections. */
+ LISTBASE_FOREACH (FreestyleLineSet *, fls, &view_layer->freestyle_config.linesets) {
+ if (fls->group != NULL) {
+ build_collection(NULL, NULL, fls->group);
+ }
+ }
/* Build all set scenes. */
if (scene->set != NULL) {
ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
new file mode 100644
index 00000000000..fdf78cf624e
--- /dev/null
+++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
@@ -0,0 +1,368 @@
+/*
+ * 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) 2019 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#include "intern/builder/deg_builder_rna.h"
+
+#include <cstring>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
+#include "BLI_listbase.h"
+
+extern "C" {
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_key_types.h"
+#include "DNA_object_types.h"
+#include "DNA_sequence_types.h"
+}
+
+#include "BKE_constraint.h"
+
+#include "RNA_access.h"
+
+#include "intern/depsgraph.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
+
+namespace DEG {
+
+/* ********************************* ID Data ******************************** */
+
+class RNANodeQueryIDData {
+public:
+ explicit RNANodeQueryIDData(const ID *id)
+ : id_(id),
+ contraint_to_pchan_map_(NULL) {
+ }
+
+ ~RNANodeQueryIDData() {
+ if (contraint_to_pchan_map_ != NULL) {
+ BLI_ghash_free(contraint_to_pchan_map_, NULL, NULL);
+ }
+ }
+
+ const bPoseChannel *get_pchan_for_constraint(const bConstraint *constraint)
+ {
+ ensure_constraint_to_pchan_map();
+ return static_cast<bPoseChannel *>(
+ BLI_ghash_lookup(contraint_to_pchan_map_, constraint));
+ }
+
+ void ensure_constraint_to_pchan_map()
+ {
+ if (contraint_to_pchan_map_ != NULL) {
+ return;
+ }
+ BLI_assert(GS(id_->name) == ID_OB);
+ const Object *object = reinterpret_cast<const Object *>(id_);
+ contraint_to_pchan_map_ =
+ BLI_ghash_ptr_new("id data pchan constraint map");
+ if (object->pose != NULL) {
+ LISTBASE_FOREACH (
+ const bPoseChannel *, pchan, &object->pose->chanbase)
+ {
+ LISTBASE_FOREACH (
+ const bConstraint *, constraint, &pchan->constraints)
+ {
+ BLI_ghash_insert(contraint_to_pchan_map_,
+ const_cast<bConstraint *>(constraint),
+ const_cast<bPoseChannel *>(pchan));
+ }
+ }
+ }
+ }
+
+protected:
+ /* ID this data corresponds to. */
+ const ID *id_;
+
+ /* indexed by bConstraint*, returns pose channel which contains that
+ * constraint. */
+ GHash *contraint_to_pchan_map_;
+};
+
+/* ***************************** Node Identifier **************************** */
+
+RNANodeIdentifier::RNANodeIdentifier()
+ : id(NULL),
+ type(NodeType::UNDEFINED),
+ component_name(""),
+ operation_code(OperationCode::OPERATION),
+ operation_name(),
+ operation_name_tag(-1)
+{
+}
+
+bool RNANodeIdentifier::is_valid() const
+{
+ return id != NULL &&
+ type != NodeType::UNDEFINED;
+}
+
+/* ********************************** Query ********************************* */
+
+namespace {
+
+void ghash_id_data_free_func(void *value)
+{
+ RNANodeQueryIDData *id_data = static_cast<RNANodeQueryIDData *>(value);
+ OBJECT_GUARDED_DELETE(id_data, RNANodeQueryIDData);
+}
+
+} // namespace
+
+RNANodeQuery::RNANodeQuery(Depsgraph *depsgraph)
+ : depsgraph_(depsgraph),
+ id_data_map_(BLI_ghash_ptr_new("rna node query id data hash"))
+{
+}
+
+RNANodeQuery::~RNANodeQuery()
+{
+ BLI_ghash_free(id_data_map_, NULL, ghash_id_data_free_func);
+}
+
+Node *RNANodeQuery::find_node(const PointerRNA *ptr,
+ const PropertyRNA *prop,
+ RNAPointerSource source)
+{
+ const RNANodeIdentifier node_identifier = construct_node_identifier(
+ ptr, prop, source);
+ if (!node_identifier.is_valid()) {
+ return NULL;
+ }
+ IDNode *id_node = depsgraph_->find_id_node(node_identifier.id);
+ if (id_node == NULL) {
+ return NULL;
+ }
+ ComponentNode *comp_node = id_node->find_component(
+ node_identifier.type, node_identifier.component_name);
+ if (comp_node == NULL) {
+ return NULL;
+ }
+ if (node_identifier.operation_code == OperationCode::OPERATION) {
+ return comp_node;
+ }
+ return comp_node->find_operation(node_identifier.operation_code,
+ node_identifier.operation_name,
+ node_identifier.operation_name_tag);
+}
+
+RNANodeIdentifier RNANodeQuery::construct_node_identifier(
+ const PointerRNA *ptr,
+ const PropertyRNA *prop,
+ RNAPointerSource /*source*/)
+{
+ RNANodeIdentifier node_identifier;
+ if (ptr->type == NULL) {
+ return node_identifier;
+ }
+ /* Set default values for returns. */
+ node_identifier.id = static_cast<ID *>(ptr->id.data);
+ node_identifier.component_name = "";
+ node_identifier.operation_code = OperationCode::OPERATION;
+ node_identifier.operation_name = "";
+ node_identifier.operation_name_tag = -1;
+ /* Handling of commonly known scenarios. */
+ if (ptr->type == &RNA_PoseBone) {
+ const bPoseChannel *pchan =
+ static_cast<const bPoseChannel *>(ptr->data);
+ if (prop != NULL && RNA_property_is_idprop(prop)) {
+ node_identifier.type = NodeType::PARAMETERS;
+ node_identifier.operation_code = OperationCode::ID_PROPERTY;
+ node_identifier.operation_name =
+ RNA_property_identifier(
+ reinterpret_cast<const PropertyRNA *>(prop));
+ node_identifier.operation_name_tag = -1;
+ }
+ else {
+ /* Bone - generally, we just want the bone component. */
+ node_identifier.type = NodeType::BONE;
+ node_identifier.component_name = pchan->name;
+ /* But B-Bone properties should connect to the actual operation. */
+ if (!ELEM(NULL, pchan->bone, prop) && pchan->bone->segments > 1 &&
+ STRPREFIX(RNA_property_identifier(prop), "bbone_"))
+ {
+ node_identifier.operation_code = OperationCode::BONE_SEGMENTS;
+ }
+ }
+ return node_identifier;
+ }
+ else if (ptr->type == &RNA_Bone) {
+ const Bone *bone = static_cast<const Bone *>(ptr->data);
+ /* Armature-level bone, but it ends up going to bone component
+ * anyway. */
+ // NOTE: the ID in this case will end up being bArmature.
+ node_identifier.type = NodeType::BONE;
+ node_identifier.component_name = bone->name;
+ return node_identifier;
+ }
+ else if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
+ const Object *object = static_cast<const Object *>(ptr->id.data);
+ const bConstraint *constraint =
+ static_cast<const bConstraint *>(ptr->data);
+ RNANodeQueryIDData *id_data = ensure_id_data(&object->id);
+ /* Check whether is object or bone constraint. */
+ /* NOTE: Currently none of the area can address transform of an object
+ * at a given constraint, but for rigging one might use constraint
+ * influence to be used to drive some corrective shape keys or so. */
+ const bPoseChannel *pchan =
+ id_data->get_pchan_for_constraint(constraint);
+ if (pchan == NULL) {
+ node_identifier.type = NodeType::TRANSFORM;
+ node_identifier.operation_code = OperationCode::TRANSFORM_LOCAL;
+ }
+ else {
+ node_identifier.type = NodeType::BONE;
+ node_identifier.operation_code = OperationCode::BONE_LOCAL;
+ node_identifier.component_name = pchan->name;
+ }
+ return node_identifier;
+ }
+ else if (ELEM(ptr->type, &RNA_ConstraintTarget, &RNA_ConstraintTargetBone)) {
+ Object *object = (Object *)ptr->id.data;
+ bConstraintTarget *tgt = (bConstraintTarget *)ptr->data;
+ /* Check whether is object or bone constraint. */
+ bPoseChannel *pchan = NULL;
+ bConstraint *con = BKE_constraint_find_from_target(object, tgt, &pchan);
+ if (con != NULL) {
+ if (pchan != NULL) {
+ node_identifier.type = NodeType::BONE;
+ node_identifier.operation_code = OperationCode::BONE_LOCAL;
+ node_identifier.component_name = pchan->name;
+ }
+ else {
+ node_identifier.type = NodeType::TRANSFORM;
+ node_identifier.operation_code = OperationCode::TRANSFORM_LOCAL;
+ }
+ return node_identifier;
+ }
+ }
+ else if (RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
+ node_identifier.type = NodeType::GEOMETRY;
+ return node_identifier;
+ }
+ else if (ptr->type == &RNA_Object) {
+ /* Transforms props? */
+ if (prop != NULL) {
+ const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop);
+ /* TODO(sergey): How to optimize this? */
+ if (strstr(prop_identifier, "location") ||
+ strstr(prop_identifier, "rotation") ||
+ strstr(prop_identifier, "scale") ||
+ strstr(prop_identifier, "matrix_"))
+ {
+ node_identifier.type = NodeType::TRANSFORM;
+ return node_identifier;
+ }
+ else if (strstr(prop_identifier, "data")) {
+ /* We access object.data, most likely a geometry.
+ * Might be a bone tho. */
+ node_identifier.type = NodeType::GEOMETRY;
+ return node_identifier;
+ }
+ else if (STREQ(prop_identifier, "hide_viewport") ||
+ STREQ(prop_identifier, "hide_render"))
+ {
+ node_identifier.type = NodeType::OBJECT_FROM_LAYER;
+ return node_identifier;
+ }
+ }
+ }
+ else if (ptr->type == &RNA_ShapeKey) {
+ KeyBlock *key_block = static_cast<KeyBlock *>(ptr->data);
+ node_identifier.id = static_cast<ID *>(ptr->id.data);
+ node_identifier.type = NodeType::PARAMETERS;
+ node_identifier.operation_code = OperationCode::PARAMETERS_EVAL;
+ node_identifier.operation_name = key_block->name;
+ return node_identifier;
+ }
+ else if (ptr->type == &RNA_Key) {
+ node_identifier.id = static_cast<ID *>(ptr->id.data);
+ node_identifier.type = NodeType::GEOMETRY;
+ return node_identifier;
+ }
+ else if (RNA_struct_is_a(ptr->type, &RNA_Sequence)) {
+ const Sequence *seq = static_cast<Sequence *>(ptr->data);
+ /* Sequencer strip */
+ node_identifier.type = NodeType::SEQUENCER;
+ node_identifier.component_name = seq->name;
+ return node_identifier;
+ }
+ else if (RNA_struct_is_a(ptr->type, &RNA_NodeSocket)) {
+ node_identifier.type = NodeType::SHADING;
+ return node_identifier;
+ }
+ else if (RNA_struct_is_a(ptr->type, &RNA_ShaderNode)) {
+ node_identifier.type = NodeType::SHADING;
+ return node_identifier;
+ }
+ else if (ELEM(ptr->type, &RNA_Curve, &RNA_TextCurve)) {
+ node_identifier.id = (ID *)ptr->id.data;
+ node_identifier.type = NodeType::GEOMETRY;
+ return node_identifier;
+ }
+ else if (ELEM(ptr->type, &RNA_BezierSplinePoint, &RNA_SplinePoint)) {
+ node_identifier.id = (ID *)ptr->id.data;
+ node_identifier.type = NodeType::GEOMETRY;
+ return node_identifier;
+ }
+ if (prop != NULL) {
+ /* All unknown data effectively falls under "parameter evaluation". */
+ if (RNA_property_is_idprop(prop)) {
+ node_identifier.type = NodeType::PARAMETERS;
+ node_identifier.operation_code = OperationCode::ID_PROPERTY;
+ node_identifier.operation_name =
+ RNA_property_identifier((PropertyRNA *)prop);
+ node_identifier.operation_name_tag = -1;
+ }
+ else {
+ node_identifier.type = NodeType::PARAMETERS;
+ node_identifier.operation_code = OperationCode::PARAMETERS_EVAL;
+ node_identifier.operation_name = "";
+ node_identifier.operation_name_tag = -1;
+ }
+ return node_identifier;
+ }
+ return node_identifier;
+}
+
+RNANodeQueryIDData *RNANodeQuery::ensure_id_data(const ID *id)
+{
+ RNANodeQueryIDData **id_data_ptr;
+ if (!BLI_ghash_ensure_p(id_data_map_,
+ const_cast<ID *>(id),
+ reinterpret_cast<void***>(&id_data_ptr)))
+ {
+ *id_data_ptr = OBJECT_GUARDED_NEW(RNANodeQueryIDData, id);
+ }
+ return *id_data_ptr;
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.h b/source/blender/depsgraph/intern/builder/deg_builder_rna.h
new file mode 100644
index 00000000000..a328124d6ec
--- /dev/null
+++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.h
@@ -0,0 +1,98 @@
+/*
+ * 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) 2019 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_operation.h"
+
+struct GHash;
+struct ID;
+struct PointerRNA;
+struct PropertyRNA;
+
+namespace DEG {
+
+struct Depsgraph;
+struct Node;
+struct RNANodeQueryIDData;
+
+/* For queries which gives operation node or key defines whether we are
+ * interested in a result of the given property or whether we are linking some
+ * dependency to that property. */
+enum class RNAPointerSource {
+ /* Query will return pointer to an entry operation of component which is
+ * responsible for evaluation of the given property. */
+ ENTRY,
+ /* Query will return pointer to an exit operation of component which is
+ * responsible for evaluation of the given property.
+ * More precisely, it will return operation at which the property is known
+ * to be evaluated. */
+ EXIT,
+};
+
+/* A helper structure which wraps all fields needed to find a node inside of
+ * the dependency graph. */
+class RNANodeIdentifier {
+public:
+ RNANodeIdentifier();
+
+ /* Check whether this identifier is valid and usable. */
+ bool is_valid() const;
+
+ ID *id;
+ NodeType type;
+ const char *component_name;
+ OperationCode operation_code;
+ const char *operation_name;
+ int operation_name_tag;
+};
+
+/* Helper class which performs optimized lookups of a node within a given
+ * dependency graph which satisfies given RNA pointer or RAN path. */
+class RNANodeQuery {
+public:
+ RNANodeQuery(Depsgraph *depsgraph);
+ ~RNANodeQuery();
+
+ Node *find_node(const PointerRNA *ptr,
+ const PropertyRNA *prop,
+ RNAPointerSource source);
+
+protected:
+ Depsgraph *depsgraph_;
+
+ /* Indexed by an ID, returns RNANodeQueryIDData associated with that ID. */
+ GHash *id_data_map_;
+
+ /* Construct identifier of the node which correspods given configuration
+ * of RNA property. */
+ RNANodeIdentifier construct_node_identifier(const PointerRNA *ptr,
+ const PropertyRNA *prop,
+ RNAPointerSource source);
+
+ /* Make sure ID data exists for the given ID, and returns it. */
+ RNANodeQueryIDData *ensure_id_data(const ID *id);
+};
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc b/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc
index a39b18f2f0a..2aa716fc87c 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,22 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Lukas Toenne,
- * Sergey Sharybin,
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_transitive.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#include "intern/builder/deg_builder_transitive.h"
#include "MEM_guardedalloc.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_operation.h"
#include "intern/depsgraph.h"
-#include "intern/depsgraph_intern.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/debug/deg_debug.h"
namespace DEG {
@@ -63,17 +54,16 @@ enum {
OP_REACHABLE = 2,
};
-static void deg_graph_tag_paths_recursive(DepsNode *node)
+static void deg_graph_tag_paths_recursive(Node *node)
{
if (node->custom_flags & OP_VISITED) {
return;
}
node->custom_flags |= OP_VISITED;
- foreach (DepsRelation *rel, node->inlinks) {
+ for (Relation *rel : node->inlinks) {
deg_graph_tag_paths_recursive(rel->from);
/* Do this only in inlinks loop, so the target node does not get
- * flagged.
- */
+ * flagged. */
rel->from->custom_flags |= OP_REACHABLE;
}
}
@@ -81,36 +71,34 @@ static void deg_graph_tag_paths_recursive(DepsNode *node)
void deg_graph_transitive_reduction(Depsgraph *graph)
{
int num_removed_relations = 0;
- foreach (OperationDepsNode *target, graph->operations) {
+ for (OperationNode *target : graph->operations) {
/* Clear tags. */
- foreach (OperationDepsNode *node, graph->operations) {
+ for (OperationNode *node : graph->operations) {
node->custom_flags = 0;
}
/* Mark nodes from which we can reach the target
* start with children, so the target node and direct children are not
- * flagged.
- */
+ * flagged. */
target->custom_flags |= OP_VISITED;
- foreach (DepsRelation *rel, target->inlinks) {
+ for (Relation *rel : target->inlinks) {
deg_graph_tag_paths_recursive(rel->from);
}
/* Remove redundant paths to the target. */
- for (DepsNode::Relations::const_iterator it_rel = target->inlinks.begin();
+ for (Node::Relations::const_iterator it_rel = target->inlinks.begin();
it_rel != target->inlinks.end();
)
{
- DepsRelation *rel = *it_rel;
- if (rel->from->type == DEG_NODE_TYPE_TIMESOURCE) {
+ Relation *rel = *it_rel;
+ if (rel->from->type == NodeType::TIMESOURCE) {
/* HACK: time source nodes don't get "custom_flags" flag
* set/cleared. */
/* TODO: there will be other types in future, so iterators above
- * need modifying.
- */
+ * need modifying. */
++it_rel;
}
else if (rel->from->custom_flags & OP_REACHABLE) {
rel->unlink();
- OBJECT_GUARDED_DELETE(rel, DepsRelation);
+ OBJECT_GUARDED_DELETE(rel, Relation);
++num_removed_relations;
}
else {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_transitive.h b/source/blender/depsgraph/intern/builder/deg_builder_transitive.h
index be9d7c3ca9c..43068886809 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_transitive.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_transitive.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Lukas Toenne
- * Sergey Sharybin,
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/builder/deg_builder_transitive.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
diff --git a/source/blender/depsgraph/intern/debug/deg_debug.cc b/source/blender/depsgraph/intern/debug/deg_debug.cc
new file mode 100644
index 00000000000..a6c4b59e7df
--- /dev/null
+++ b/source/blender/depsgraph/intern/debug/deg_debug.cc
@@ -0,0 +1,60 @@
+/*
+ * 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) 2013 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#include "intern/debug/deg_debug.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_console.h"
+#include "BLI_hash.h"
+#include "BLI_string.h"
+
+#include "BKE_global.h"
+
+namespace DEG {
+
+bool terminal_do_color(void)
+{
+ return (G.debug & G_DEBUG_DEPSGRAPH_PRETTY) != 0;
+}
+
+string color_for_pointer(const void *pointer)
+{
+ if (!terminal_do_color()) {
+ return "";
+ }
+ int r, g, b;
+ BLI_hash_pointer_to_color(pointer, &r, &g, &b);
+ char buffer[64];
+ BLI_snprintf(buffer, sizeof(buffer), TRUECOLOR_ANSI_COLOR_FORMAT, r, g, b);
+ return string(buffer);
+}
+
+string color_end(void)
+{
+ if (!terminal_do_color()) {
+ return "";
+ }
+ return string(TRUECOLOR_ANSI_COLOR_FINISH);
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/debug/deg_debug.h b/source/blender/depsgraph/intern/debug/deg_debug.h
new file mode 100644
index 00000000000..1cdcba9b8fd
--- /dev/null
+++ b/source/blender/depsgraph/intern/debug/deg_debug.h
@@ -0,0 +1,59 @@
+/*
+ * 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) 2013 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "intern/depsgraph_type.h"
+
+#include "BKE_global.h"
+
+#include "DEG_depsgraph_debug.h"
+
+namespace DEG {
+
+#define DEG_DEBUG_PRINTF(depsgraph, type, ...) \
+ do { \
+ if (DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_ ## type) { \
+ DEG_debug_print_begin(depsgraph); \
+ fprintf(stdout, __VA_ARGS__); \
+ } \
+ } while (0)
+
+#define DEG_GLOBAL_DEBUG_PRINTF(type, ...) \
+ do { \
+ if (G.debug & G_DEBUG_DEPSGRAPH_ ## type) { \
+ fprintf(stdout, __VA_ARGS__); \
+ } \
+ } while (0)
+
+#define DEG_ERROR_PRINTF(...) \
+ do { \
+ fprintf(stderr, __VA_ARGS__); \
+ fflush(stderr); \
+ } while (0)
+
+bool terminal_do_color(void);
+string color_for_pointer(const void *pointer);
+string color_end(void);
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
index d8a24292aa6..34f68528059 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,16 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Lukas Toenne
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Implementation of tools for debugging the depsgraph
*/
+#include <cstdarg>
+
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
@@ -40,11 +35,11 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_debug.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_time.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/node/deg_node_time.h"
/* ****************** */
/* Graphviz Debugging */
@@ -82,36 +77,36 @@ static const char *deg_debug_colors_light[] = {
#ifdef COLOR_SCHEME_NODE_TYPE
static const int deg_debug_node_type_color_map[][2] = {
- {DEG_NODE_TYPE_TIMESOURCE, 0},
- {DEG_NODE_TYPE_ID_REF, 1},
+ {NodeType::TIMESOURCE, 0},
+ {NodeType::ID_REF, 1},
/* Outer Types */
- {DEG_NODE_TYPE_PARAMETERS, 2},
- {DEG_NODE_TYPE_PROXY, 3},
- {DEG_NODE_TYPE_ANIMATION, 4},
- {DEG_NODE_TYPE_TRANSFORM, 5},
- {DEG_NODE_TYPE_GEOMETRY, 6},
- {DEG_NODE_TYPE_SEQUENCER, 7},
- {DEG_NODE_TYPE_SHADING, 8},
- {DEG_NODE_TYPE_SHADING_PARAMETERS, 9},
- {DEG_NODE_TYPE_CACHE, 10},
- {DEG_NODE_TYPE_POINT_CACHE, 11},
- {DEG_NODE_TYPE_LAYER_COLLECTIONS, 12},
- {DEG_NODE_TYPE_COPY_ON_WRITE, 13},
- {-1, 0}
+ {NodeType::PARAMETERS, 2},
+ {NodeType::PROXY, 3},
+ {NodeType::ANIMATION, 4},
+ {NodeType::TRANSFORM, 5},
+ {NodeType::GEOMETRY, 6},
+ {NodeType::SEQUENCER, 7},
+ {NodeType::SHADING, 8},
+ {NodeType::SHADING_PARAMETERS, 9},
+ {NodeType::CACHE, 10},
+ {NodeType::POINT_CACHE, 11},
+ {NodeType::LAYER_COLLECTIONS, 12},
+ {NodeType::COPY_ON_WRITE, 13},
+ {-1, 0},
};
#endif
-static int deg_debug_node_color_index(const DepsNode *node)
+static int deg_debug_node_color_index(const Node *node)
{
#ifdef COLOR_SCHEME_NODE_CLASS
/* Some special types. */
switch (node->type) {
- case DEG_NODE_TYPE_ID_REF:
+ case NodeType::ID_REF:
return 5;
- case DEG_NODE_TYPE_OPERATION:
+ case NodeType::OPERATION:
{
- OperationDepsNode *op_node = (OperationDepsNode *)node;
+ OperationNode *op_node = (OperationNode *)node;
if (op_node->is_noop())
return 8;
break;
@@ -122,9 +117,9 @@ static int deg_debug_node_color_index(const DepsNode *node)
}
/* Do others based on class. */
switch (node->get_class()) {
- case DEG_NODE_CLASS_OPERATION:
+ case NodeClass::OPERATION:
return 4;
- case DEG_NODE_CLASS_COMPONENT:
+ case NodeClass::COMPONENT:
return 1;
default:
return 9;
@@ -185,7 +180,7 @@ static void deg_debug_graphviz_legend(const DebugContext &ctx)
#ifdef COLOR_SCHEME_NODE_TYPE
const int (*pair)[2];
for (pair = deg_debug_node_type_color_map; (*pair)[0] >= 0; ++pair) {
- DepsNodeFactory *nti = deg_type_get_factory((eDepsNode_Type)(*pair)[0]);
+ DepsNodeFactory *nti = type_get_factory((NodeType)(*pair)[0]);
deg_debug_graphviz_legend_color(ctx,
nti->tname().c_str(),
deg_debug_colors_light[(*pair)[1] % deg_debug_max_colors]);
@@ -200,15 +195,15 @@ static void deg_debug_graphviz_legend(const DebugContext &ctx)
}
static void deg_debug_graphviz_node_color(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
const char *color_default = "black";
const char *color_modified = "orangered4";
const char *color_update = "dodgerblue3";
const char *color = color_default;
if (ctx.show_tags) {
- if (node->get_class() == DEG_NODE_CLASS_OPERATION) {
- OperationDepsNode *op_node = (OperationDepsNode *)node;
+ if (node->get_class() == NodeClass::OPERATION) {
+ OperationNode *op_node = (OperationNode *)node;
if (op_node->flag & DEPSOP_FLAG_DIRECTLY_MODIFIED) {
color = color_modified;
}
@@ -221,15 +216,15 @@ static void deg_debug_graphviz_node_color(const DebugContext &ctx,
}
static void deg_debug_graphviz_node_penwidth(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
float penwidth_default = 1.0f;
float penwidth_modified = 4.0f;
float penwidth_update = 4.0f;
float penwidth = penwidth_default;
if (ctx.show_tags) {
- if (node->get_class() == DEG_NODE_CLASS_OPERATION) {
- OperationDepsNode *op_node = (OperationDepsNode *)node;
+ if (node->get_class() == NodeClass::OPERATION) {
+ OperationNode *op_node = (OperationNode *)node;
if (op_node->flag & DEPSOP_FLAG_DIRECTLY_MODIFIED) {
penwidth = penwidth_modified;
}
@@ -242,7 +237,7 @@ static void deg_debug_graphviz_node_penwidth(const DebugContext &ctx,
}
static void deg_debug_graphviz_node_fillcolor(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
const char *defaultcolor = "gainsboro";
int color_index = deg_debug_node_color_index(node);
@@ -251,49 +246,49 @@ static void deg_debug_graphviz_node_fillcolor(const DebugContext &ctx,
}
static void deg_debug_graphviz_relation_color(const DebugContext &ctx,
- const DepsRelation *rel)
+ const Relation *rel)
{
const char *color_default = "black";
const char *color_cyclic = "red4"; /* The color of crime scene. */
const char *color_godmode = "blue4"; /* The color of beautiful sky. */
const char *color = color_default;
- if (rel->flag & DEPSREL_FLAG_CYCLIC) {
+ if (rel->flag & RELATION_FLAG_CYCLIC) {
color = color_cyclic;
}
- else if (rel->flag & DEPSREL_FLAG_GODMODE) {
+ else if (rel->flag & RELATION_FLAG_GODMODE) {
color = color_godmode;
}
deg_debug_fprintf(ctx, "%s", color);
}
static void deg_debug_graphviz_relation_style(const DebugContext &ctx,
- const DepsRelation *rel)
+ const Relation *rel)
{
const char *style_default = "solid";
const char *style_no_flush = "dashed";
const char *style_flush_user_only = "dotted";
const char *style = style_default;
- if (rel->flag & DEPSREL_FLAG_NO_FLUSH) {
+ if (rel->flag & RELATION_FLAG_NO_FLUSH) {
style = style_no_flush;
}
- if (rel->flag & DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY) {
+ if (rel->flag & RELATION_FLAG_FLUSH_USER_EDIT_ONLY) {
style = style_flush_user_only;
}
deg_debug_fprintf(ctx, "%s", style);
}
static void deg_debug_graphviz_relation_arrowhead(const DebugContext &ctx,
- const DepsRelation *rel)
+ const Relation *rel)
{
const char *shape_default = "normal";
const char *shape_no_cow = "box";
const char *shape = shape_default;
- if (rel->from->get_class() == DEG_NODE_CLASS_OPERATION &&
- rel->to->get_class() == DEG_NODE_CLASS_OPERATION)
+ if (rel->from->get_class() == NodeClass::OPERATION &&
+ rel->to->get_class() == NodeClass::OPERATION)
{
- OperationDepsNode *op_from = (OperationDepsNode *)rel->from;
- OperationDepsNode *op_to = (OperationDepsNode *)rel->to;
- if (op_from->owner->type == DEG_NODE_TYPE_COPY_ON_WRITE &&
+ OperationNode *op_from = (OperationNode *)rel->from;
+ OperationNode *op_to = (OperationNode *)rel->to;
+ if (op_from->owner->type == NodeType::COPY_ON_WRITE &&
!op_to->owner->need_tag_cow_before_update())
{
shape = shape_no_cow;
@@ -302,32 +297,32 @@ static void deg_debug_graphviz_relation_arrowhead(const DebugContext &ctx,
deg_debug_fprintf(ctx, "%s", shape);
}
-static void deg_debug_graphviz_node_style(const DebugContext &ctx, const DepsNode *node)
+static void deg_debug_graphviz_node_style(const DebugContext &ctx, const Node *node)
{
const char *base_style = "filled"; /* default style */
if (ctx.show_tags) {
- if (node->get_class() == DEG_NODE_CLASS_OPERATION) {
- OperationDepsNode *op_node = (OperationDepsNode *)node;
+ if (node->get_class() == NodeClass::OPERATION) {
+ OperationNode *op_node = (OperationNode *)node;
if (op_node->flag & (DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE)) {
base_style = "striped";
}
}
}
switch (node->get_class()) {
- case DEG_NODE_CLASS_GENERIC:
+ case NodeClass::GENERIC:
deg_debug_fprintf(ctx, "\"%s\"", base_style);
break;
- case DEG_NODE_CLASS_COMPONENT:
+ case NodeClass::COMPONENT:
deg_debug_fprintf(ctx, "\"%s\"", base_style);
break;
- case DEG_NODE_CLASS_OPERATION:
+ case NodeClass::OPERATION:
deg_debug_fprintf(ctx, "\"%s,rounded\"", base_style);
break;
}
}
static void deg_debug_graphviz_node_single(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
const char *shape = "box";
string name = node->identifier();
@@ -348,7 +343,7 @@ static void deg_debug_graphviz_node_single(const DebugContext &ctx,
}
static void deg_debug_graphviz_node_cluster_begin(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
string name = node->identifier();
deg_debug_fprintf(ctx, "// %s\n", name.c_str());
@@ -383,18 +378,18 @@ static void deg_debug_graphviz_graph_relations(const DebugContext &ctx,
const Depsgraph *graph);
static void deg_debug_graphviz_node(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
switch (node->type) {
- case DEG_NODE_TYPE_ID_REF:
+ case NodeType::ID_REF:
{
- const IDDepsNode *id_node = (const IDDepsNode *)node;
+ const IDNode *id_node = (const IDNode *)node;
if (BLI_ghash_len(id_node->components) == 0) {
deg_debug_graphviz_node_single(ctx, node);
}
else {
deg_debug_graphviz_node_cluster_begin(ctx, node);
- GHASH_FOREACH_BEGIN(const ComponentDepsNode *, comp, id_node->components)
+ GHASH_FOREACH_BEGIN(const ComponentNode *, comp, id_node->components)
{
deg_debug_graphviz_node(ctx, comp);
}
@@ -403,32 +398,32 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
}
break;
}
- case DEG_NODE_TYPE_PARAMETERS:
- case DEG_NODE_TYPE_ANIMATION:
- case DEG_NODE_TYPE_TRANSFORM:
- case DEG_NODE_TYPE_PROXY:
- case DEG_NODE_TYPE_GEOMETRY:
- case DEG_NODE_TYPE_SEQUENCER:
- case DEG_NODE_TYPE_EVAL_POSE:
- case DEG_NODE_TYPE_BONE:
- case DEG_NODE_TYPE_SHADING:
- case DEG_NODE_TYPE_SHADING_PARAMETERS:
- case DEG_NODE_TYPE_CACHE:
- case DEG_NODE_TYPE_POINT_CACHE:
- case DEG_NODE_TYPE_LAYER_COLLECTIONS:
- case DEG_NODE_TYPE_PARTICLE_SYSTEM:
- case DEG_NODE_TYPE_PARTICLE_SETTINGS:
- case DEG_NODE_TYPE_COPY_ON_WRITE:
- case DEG_NODE_TYPE_OBJECT_FROM_LAYER:
- case DEG_NODE_TYPE_BATCH_CACHE:
- case DEG_NODE_TYPE_DUPLI:
- case DEG_NODE_TYPE_SYNCHRONIZE:
- case DEG_NODE_TYPE_GENERIC_DATABLOCK:
+ case NodeType::PARAMETERS:
+ case NodeType::ANIMATION:
+ case NodeType::TRANSFORM:
+ case NodeType::PROXY:
+ case NodeType::GEOMETRY:
+ case NodeType::SEQUENCER:
+ case NodeType::EVAL_POSE:
+ case NodeType::BONE:
+ case NodeType::SHADING:
+ case NodeType::SHADING_PARAMETERS:
+ case NodeType::CACHE:
+ case NodeType::POINT_CACHE:
+ case NodeType::LAYER_COLLECTIONS:
+ case NodeType::PARTICLE_SYSTEM:
+ case NodeType::PARTICLE_SETTINGS:
+ case NodeType::COPY_ON_WRITE:
+ case NodeType::OBJECT_FROM_LAYER:
+ case NodeType::BATCH_CACHE:
+ case NodeType::DUPLI:
+ case NodeType::SYNCHRONIZATION:
+ case NodeType::GENERIC_DATABLOCK:
{
- ComponentDepsNode *comp_node = (ComponentDepsNode *)node;
+ ComponentNode *comp_node = (ComponentNode *)node;
if (!comp_node->operations.empty()) {
deg_debug_graphviz_node_cluster_begin(ctx, node);
- foreach (DepsNode *op_node, comp_node->operations) {
+ for (Node *op_node : comp_node->operations) {
deg_debug_graphviz_node(ctx, op_node);
}
deg_debug_graphviz_node_cluster_end(ctx);
@@ -438,34 +433,34 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
}
break;
}
- case DEG_NODE_TYPE_UNDEFINED:
- case DEG_NODE_TYPE_TIMESOURCE:
- case DEG_NODE_TYPE_OPERATION:
+ case NodeType::UNDEFINED:
+ case NodeType::TIMESOURCE:
+ case NodeType::OPERATION:
deg_debug_graphviz_node_single(ctx, node);
break;
- case NUM_DEG_NODE_TYPES:
+ case NodeType::NUM_TYPES:
break;
}
}
-static bool deg_debug_graphviz_is_cluster(const DepsNode *node)
+static bool deg_debug_graphviz_is_cluster(const Node *node)
{
switch (node->type) {
- case DEG_NODE_TYPE_ID_REF:
+ case NodeType::ID_REF:
{
- const IDDepsNode *id_node = (const IDDepsNode *)node;
+ const IDNode *id_node = (const IDNode *)node;
return BLI_ghash_len(id_node->components) > 0;
}
- case DEG_NODE_TYPE_PARAMETERS:
- case DEG_NODE_TYPE_ANIMATION:
- case DEG_NODE_TYPE_TRANSFORM:
- case DEG_NODE_TYPE_PROXY:
- case DEG_NODE_TYPE_GEOMETRY:
- case DEG_NODE_TYPE_SEQUENCER:
- case DEG_NODE_TYPE_EVAL_POSE:
- case DEG_NODE_TYPE_BONE:
+ case NodeType::PARAMETERS:
+ case NodeType::ANIMATION:
+ case NodeType::TRANSFORM:
+ case NodeType::PROXY:
+ case NodeType::GEOMETRY:
+ case NodeType::SEQUENCER:
+ case NodeType::EVAL_POSE:
+ case NodeType::BONE:
{
- ComponentDepsNode *comp_node = (ComponentDepsNode *)node;
+ ComponentNode *comp_node = (ComponentNode *)node;
return !comp_node->operations.empty();
}
default:
@@ -473,20 +468,20 @@ static bool deg_debug_graphviz_is_cluster(const DepsNode *node)
}
}
-static bool deg_debug_graphviz_is_owner(const DepsNode *node,
- const DepsNode *other)
+static bool deg_debug_graphviz_is_owner(const Node *node,
+ const Node *other)
{
switch (node->get_class()) {
- case DEG_NODE_CLASS_COMPONENT:
+ case NodeClass::COMPONENT:
{
- ComponentDepsNode *comp_node = (ComponentDepsNode *)node;
+ ComponentNode *comp_node = (ComponentNode *)node;
if (comp_node->owner == other)
return true;
break;
}
- case DEG_NODE_CLASS_OPERATION:
+ case NodeClass::OPERATION:
{
- OperationDepsNode *op_node = (OperationDepsNode *)node;
+ OperationNode *op_node = (OperationNode *)node;
if (op_node->owner == other)
return true;
else if (op_node->owner->owner == other)
@@ -499,13 +494,13 @@ static bool deg_debug_graphviz_is_owner(const DepsNode *node,
}
static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
- const DepsNode *node)
+ const Node *node)
{
- foreach (DepsRelation *rel, node->inlinks) {
+ for (Relation *rel : node->inlinks) {
float penwidth = 2.0f;
- const DepsNode *tail = rel->to; /* same as node */
- const DepsNode *head = rel->from;
+ const Node *tail = rel->to; /* same as node */
+ const Node *head = rel->from;
deg_debug_fprintf(ctx, "// %s -> %s\n",
head->identifier().c_str(),
tail->identifier().c_str());
@@ -526,8 +521,7 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
deg_debug_fprintf(ctx, ",penwidth=\"%f\"", penwidth);
/* NOTE: edge from node to own cluster is not possible and gives graphviz
* warning, avoid this here by just linking directly to the invisible
- * placeholder node
- */
+ * placeholder node. */
if (deg_debug_graphviz_is_cluster(tail) &&
!deg_debug_graphviz_is_owner(head, tail))
{
@@ -546,10 +540,10 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
static void deg_debug_graphviz_graph_nodes(const DebugContext &ctx,
const Depsgraph *graph)
{
- foreach (DepsNode *node, graph->id_nodes) {
+ for (Node *node : graph->id_nodes) {
deg_debug_graphviz_node(ctx, node);
}
- TimeSourceDepsNode *time_source = graph->find_time_source();
+ TimeSourceNode *time_source = graph->find_time_source();
if (time_source != NULL) {
deg_debug_graphviz_node(ctx, time_source);
}
@@ -558,17 +552,17 @@ static void deg_debug_graphviz_graph_nodes(const DebugContext &ctx,
static void deg_debug_graphviz_graph_relations(const DebugContext &ctx,
const Depsgraph *graph)
{
- foreach (IDDepsNode *id_node, graph->id_nodes) {
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ for (IDNode *id_node : graph->id_nodes) {
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
- foreach (OperationDepsNode *op_node, comp_node->operations) {
+ for (OperationNode *op_node : comp_node->operations) {
deg_debug_graphviz_node_relations(ctx, op_node);
}
}
GHASH_FOREACH_END();
}
- TimeSourceDepsNode *time_source = graph->find_time_source();
+ TimeSourceNode *time_source = graph->find_time_source();
if (time_source != NULL) {
deg_debug_graphviz_node_relations(ctx, time_source);
}
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
index 0ea9f564fb1..41b22c0c23a 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#include "DEG_depsgraph_debug.h"
@@ -37,9 +30,7 @@
#include "BLI_math_base.h"
#include "intern/depsgraph.h"
-#include "intern/nodes/deg_node_id.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node_id.h"
extern "C" {
#include "DNA_ID.h"
@@ -58,7 +49,7 @@ struct DebugContext {
};
struct StatsEntry {
- const IDDepsNode *id_node;
+ const IDNode *id_node;
double time;
};
@@ -75,7 +66,7 @@ static void deg_debug_fprintf(const DebugContext &ctx, const char *fmt, ...)
}
BLI_INLINE double get_node_time(const DebugContext& /*ctx*/,
- const DepsNode *node)
+ const Node *node)
{
// TODO(sergey): Figure out a nice way to define which exact time
// we want to show.
@@ -111,7 +102,7 @@ void write_stats_data(const DebugContext& ctx)
// Fill in array of all stats which are to be displayed.
vector<StatsEntry> stats;
stats.reserve(ctx.graph->id_nodes.size());
- foreach (const IDDepsNode *id_node, ctx.graph->id_nodes) {
+ for (const IDNode *id_node : ctx.graph->id_nodes) {
const double time = get_node_time(ctx, id_node);
if (time == 0.0) {
continue;
@@ -128,7 +119,7 @@ void write_stats_data(const DebugContext& ctx)
std::reverse(stats.begin(), stats.end());
// Print data to the file stream.
deg_debug_fprintf(ctx, "$data << EOD" NL);
- foreach (const StatsEntry& entry, stats) {
+ for (const StatsEntry& entry : stats) {
deg_debug_fprintf(
ctx, "\"[%s] %s\",%f" NL,
gnuplotify_id_code(entry.id_node->id_orig->name).c_str(),
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index dabab482eff..43bdba55360 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,65 +15,49 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Core routines for how the Depsgraph works.
*/
#include "intern/depsgraph.h" /* own include */
+#include <algorithm>
+#include <cstring>
+
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "BLI_console.h"
#include "BLI_hash.h"
#include "BLI_ghash.h"
-#include "BLI_listbase.h"
extern "C" {
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_key_types.h"
-#include "DNA_object_types.h"
-#include "DNA_sequence_types.h"
-
-#include "RNA_access.h"
-
#include "BKE_scene.h"
-#include "BKE_constraint.h"
+#include "BKE_global.h"
}
-#include <algorithm>
-#include <cstring>
-
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_debug.h"
+#include "intern/depsgraph_update.h"
+
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/nodes/deg_node_time.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/node/deg_node_time.h"
-#include "intern/depsgraph_intern.h"
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph_physics.h"
namespace DEG {
-static DEG_EditorUpdateIDCb deg_editor_update_id_cb = NULL;
-static DEG_EditorUpdateSceneCb deg_editor_update_scene_cb = NULL;
-
/* TODO(sergey): Find a better place for this. */
template <typename T>
static void remove_from_vector(vector<T> *vector, const T& value)
@@ -111,248 +93,44 @@ Depsgraph::~Depsgraph()
BLI_ghash_free(id_hash, NULL, NULL);
BLI_gset_free(entry_tags, NULL);
if (time_source != NULL) {
- OBJECT_GUARDED_DELETE(time_source, TimeSourceDepsNode);
+ OBJECT_GUARDED_DELETE(time_source, TimeSourceNode);
}
BLI_spin_end(&lock);
}
-/* Query Conditions from RNA ----------------------- */
-
-static bool pointer_to_component_node_criteria(
- const PointerRNA *ptr,
- const PropertyRNA *prop,
- ID **id,
- eDepsNode_Type *type,
- const char **subdata,
- eDepsOperation_Code *operation_code,
- const char **operation_name,
- int *operation_name_tag)
-{
- if (ptr->type == NULL) {
- return false;
- }
- /* Set default values for returns. */
- *id = (ID *)ptr->id.data;
- *subdata = "";
- *operation_code = DEG_OPCODE_OPERATION;
- *operation_name = "";
- *operation_name_tag = -1;
- /* Handling of commonly known scenarios. */
- if (ptr->type == &RNA_PoseBone) {
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- if (prop != NULL && RNA_property_is_idprop(prop)) {
- *type = DEG_NODE_TYPE_PARAMETERS;
- *operation_code = DEG_OPCODE_ID_PROPERTY;
- *operation_name = RNA_property_identifier((PropertyRNA *)prop);
- *operation_name_tag = -1;
- }
- else {
- /* Bone - generally, we just want the bone component. */
- *type = DEG_NODE_TYPE_BONE;
- *subdata = pchan->name;
- /* But B-Bone properties should connect to the actual operation. */
- if (!ELEM(NULL, pchan->bone, prop) && pchan->bone->segments > 1 &&
- STRPREFIX(RNA_property_identifier(prop), "bbone_"))
- {
- *operation_code = DEG_OPCODE_BONE_SEGMENTS;
- }
- }
- return true;
- }
- else if (ptr->type == &RNA_Bone) {
- Bone *bone = (Bone *)ptr->data;
- /* armature-level bone, but it ends up going to bone component anyway */
- // NOTE: the ID in this case will end up being bArmature.
- *type = DEG_NODE_TYPE_BONE;
- *subdata = bone->name;
- return true;
- }
- else if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
- Object *object = (Object *)ptr->id.data;
- bConstraint *con = (bConstraint *)ptr->data;
- /* Check whether is object or bone constraint. */
- /* NOTE: Currently none of the area can address transform of an object
- * at a given constraint, but for rigging one might use constraint
- * influence to be used to drive some corrective shape keys or so.
- */
- if (BLI_findindex(&object->constraints, con) != -1) {
- *type = DEG_NODE_TYPE_TRANSFORM;
- *operation_code = DEG_OPCODE_TRANSFORM_LOCAL;
- return true;
- }
- else if (object->pose != NULL) {
- LISTBASE_FOREACH(bPoseChannel *, pchan, &object->pose->chanbase) {
- if (BLI_findindex(&pchan->constraints, con) != -1) {
- *type = DEG_NODE_TYPE_BONE;
- *operation_code = DEG_OPCODE_BONE_LOCAL;
- *subdata = pchan->name;
- return true;
- }
- }
- }
- }
- else if (ELEM(ptr->type, &RNA_ConstraintTarget, &RNA_ConstraintTargetBone)) {
- Object *object = (Object *)ptr->id.data;
- bConstraintTarget *tgt = (bConstraintTarget *)ptr->data;
- /* Check whether is object or bone constraint. */
- bPoseChannel *pchan = NULL;
- bConstraint *con = BKE_constraint_find_from_target(object, tgt, &pchan);
- if (con != NULL) {
- if (pchan != NULL) {
- *type = DEG_NODE_TYPE_BONE;
- *operation_code = DEG_OPCODE_BONE_LOCAL;
- *subdata = pchan->name;
- }
- else {
- *type = DEG_NODE_TYPE_TRANSFORM;
- *operation_code = DEG_OPCODE_TRANSFORM_LOCAL;
- }
- return true;
- }
- }
- else if (RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
- *type = DEG_NODE_TYPE_GEOMETRY;
- return true;
- }
- else if (ptr->type == &RNA_Object) {
- /* Transforms props? */
- if (prop != NULL) {
- const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop);
- /* TODO(sergey): How to optimize this? */
- if (strstr(prop_identifier, "location") ||
- strstr(prop_identifier, "rotation") ||
- strstr(prop_identifier, "scale") ||
- strstr(prop_identifier, "matrix_"))
- {
- *type = DEG_NODE_TYPE_TRANSFORM;
- return true;
- }
- else if (strstr(prop_identifier, "data")) {
- /* We access object.data, most likely a geometry.
- * Might be a bone tho..
- */
- *type = DEG_NODE_TYPE_GEOMETRY;
- return true;
- }
- }
- }
- else if (ptr->type == &RNA_ShapeKey) {
- *id = (ID *)ptr->id.data;
- *type = DEG_NODE_TYPE_GEOMETRY;
- return true;
- }
- else if (ptr->type == &RNA_Key) {
- *id = (ID *)ptr->id.data;
- *type = DEG_NODE_TYPE_GEOMETRY;
- return true;
- }
- else if (RNA_struct_is_a(ptr->type, &RNA_Sequence)) {
- Sequence *seq = (Sequence *)ptr->data;
- /* Sequencer strip */
- *type = DEG_NODE_TYPE_SEQUENCER;
- *subdata = seq->name; // xxx?
- return true;
- }
- else if (RNA_struct_is_a(ptr->type, &RNA_NodeSocket)) {
- *type = DEG_NODE_TYPE_SHADING;
- return true;
- }
- else if (RNA_struct_is_a(ptr->type, &RNA_ShaderNode)) {
- *type = DEG_NODE_TYPE_SHADING;
- return true;
- }
- else if (ELEM(ptr->type, &RNA_Curve, &RNA_TextCurve)) {
- *id = (ID *)ptr->id.data;
- *type = DEG_NODE_TYPE_GEOMETRY;
- return true;
- }
- if (prop != NULL) {
- /* All unknown data effectively falls under "parameter evaluation". */
- if (RNA_property_is_idprop(prop)) {
- *type = DEG_NODE_TYPE_PARAMETERS;
- *operation_code = DEG_OPCODE_ID_PROPERTY;
- *operation_name = RNA_property_identifier((PropertyRNA *)prop);
- *operation_name_tag = -1;
- }
- else {
- *type = DEG_NODE_TYPE_PARAMETERS;
- *operation_code = DEG_OPCODE_PARAMETERS_EVAL;
- *operation_name = "";
- *operation_name_tag = -1;
- }
- return true;
- }
- return false;
-}
-
-/* Convenience wrapper to find node given just pointer + property. */
-DepsNode *Depsgraph::find_node_from_pointer(const PointerRNA *ptr,
- const PropertyRNA *prop) const
-{
- ID *id;
- eDepsNode_Type node_type;
- const char *component_name, *operation_name;
- eDepsOperation_Code operation_code;
- int operation_name_tag;
-
- if (pointer_to_component_node_criteria(
- ptr, prop,
- &id, &node_type, &component_name,
- &operation_code, &operation_name, &operation_name_tag))
- {
- IDDepsNode *id_node = find_id_node(id);
- if (id_node == NULL) {
- return NULL;
- }
- ComponentDepsNode *comp_node =
- id_node->find_component(node_type, component_name);
- if (comp_node == NULL) {
- return NULL;
- }
- if (operation_code == DEG_OPCODE_OPERATION) {
- return comp_node;
- }
- return comp_node->find_operation(operation_code,
- operation_name,
- operation_name_tag);
- }
- return NULL;
-}
-
/* Node Management ---------------------------- */
-TimeSourceDepsNode *Depsgraph::add_time_source()
+TimeSourceNode *Depsgraph::add_time_source()
{
if (time_source == NULL) {
- DepsNodeFactory *factory = deg_type_get_factory(DEG_NODE_TYPE_TIMESOURCE);
- time_source = (TimeSourceDepsNode *)factory->create_node(NULL, "", "Time Source");
+ DepsNodeFactory *factory = type_get_factory(NodeType::TIMESOURCE);
+ time_source = (TimeSourceNode *)factory->create_node(NULL, "", "Time Source");
}
return time_source;
}
-TimeSourceDepsNode *Depsgraph::find_time_source() const
+TimeSourceNode *Depsgraph::find_time_source() const
{
return time_source;
}
-IDDepsNode *Depsgraph::find_id_node(const ID *id) const
+IDNode *Depsgraph::find_id_node(const ID *id) const
{
- return reinterpret_cast<IDDepsNode *>(BLI_ghash_lookup(id_hash, id));
+ return reinterpret_cast<IDNode *>(BLI_ghash_lookup(id_hash, id));
}
-IDDepsNode *Depsgraph::add_id_node(ID *id, ID *id_cow_hint)
+IDNode *Depsgraph::add_id_node(ID *id, ID *id_cow_hint)
{
BLI_assert((id->tag & LIB_TAG_COPIED_ON_WRITE) == 0);
- IDDepsNode *id_node = find_id_node(id);
+ IDNode *id_node = find_id_node(id);
if (!id_node) {
- DepsNodeFactory *factory = deg_type_get_factory(DEG_NODE_TYPE_ID_REF);
- id_node = (IDDepsNode *)factory->create_node(id, "", id->name);
+ DepsNodeFactory *factory = type_get_factory(NodeType::ID_REF);
+ id_node = (IDNode *)factory->create_node(id, "", id->name);
id_node->init_copy_on_write(id_cow_hint);
/* Register node in ID hash.
*
* NOTE: We address ID nodes by the original ID pointer they are
- * referencing to.
- */
+ * referencing to. */
BLI_ghash_insert(id_hash, id, id_node);
id_nodes.push_back(id_node);
}
@@ -361,11 +139,10 @@ IDDepsNode *Depsgraph::add_id_node(ID *id, ID *id_cow_hint)
void Depsgraph::clear_id_nodes_conditional(const std::function <bool (ID_Type id_type)>& filter)
{
- foreach (IDDepsNode *id_node, id_nodes) {
+ for (IDNode *id_node : id_nodes) {
if (id_node->id_cow == NULL) {
/* This means builder "stole" ownership of the copy-on-written
- * datablock for her own dirty needs.
- */
+ * datablock for her own dirty needs. */
continue;
}
if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
@@ -386,65 +163,52 @@ void Depsgraph::clear_id_nodes()
clear_id_nodes_conditional([](ID_Type id_type) { return id_type == ID_SCE; });
clear_id_nodes_conditional([](ID_Type id_type) { return id_type != ID_PA; });
- foreach (IDDepsNode *id_node, id_nodes) {
- OBJECT_GUARDED_DELETE(id_node, IDDepsNode);
+ for (IDNode *id_node : id_nodes) {
+ OBJECT_GUARDED_DELETE(id_node, IDNode);
}
/* Clear containers. */
BLI_ghash_clear(id_hash, NULL, NULL);
id_nodes.clear();
/* Clear physics relation caches. */
- deg_clear_physics_relations(this);
+ clear_physics_relations(this);
}
-/* Add new relationship between two nodes. */
-DepsRelation *Depsgraph::add_new_relation(OperationDepsNode *from,
- OperationDepsNode *to,
- const char *description,
- bool check_unique,
- int flags)
+/* Add new relation between two nodes */
+Relation *Depsgraph::add_new_relation(Node *from, Node *to,
+ const char *description,
+ int flags)
{
- DepsRelation *rel = NULL;
- if (check_unique) {
+ Relation *rel = NULL;
+ if (flags & RELATION_CHECK_BEFORE_ADD) {
rel = check_nodes_connected(from, to, description);
}
if (rel != NULL) {
rel->flag |= flags;
return rel;
}
- /* COW nodes can only depend on other COW nodes. */
- BLI_assert(to->owner->type != DEG_NODE_TYPE_COPY_ON_WRITE ||
- from->owner->type == DEG_NODE_TYPE_COPY_ON_WRITE);
- /* Create new relation, and add it to the graph. */
- rel = OBJECT_GUARDED_NEW(DepsRelation, from, to, description);
- rel->flag |= flags;
- return rel;
-}
-/* Add new relation between two nodes */
-DepsRelation *Depsgraph::add_new_relation(DepsNode *from, DepsNode *to,
- const char *description,
- bool check_unique,
- int flags)
-{
- DepsRelation *rel = NULL;
- if (check_unique) {
- rel = check_nodes_connected(from, to, description);
- }
- if (rel != NULL) {
- rel->flag |= flags;
- return rel;
+#ifndef NDEBUG
+ if (from->type == NodeType::OPERATION &&
+ to->type == NodeType::OPERATION)
+ {
+ OperationNode *operation_from = static_cast<OperationNode *>(from);
+ OperationNode *operation_to = static_cast<OperationNode *>(to);
+ BLI_assert(operation_to->owner->type != NodeType::COPY_ON_WRITE ||
+ operation_from->owner->type == NodeType::COPY_ON_WRITE);
}
+#endif
+
/* Create new relation, and add it to the graph. */
- rel = OBJECT_GUARDED_NEW(DepsRelation, from, to, description);
+ rel = OBJECT_GUARDED_NEW(Relation, from, to, description);
rel->flag |= flags;
return rel;
}
-DepsRelation *Depsgraph::check_nodes_connected(const DepsNode *from,
- const DepsNode *to,
- const char *description)
+Relation *Depsgraph::check_nodes_connected(const Node *from,
+ const Node *to,
+ const char *description)
{
- foreach (DepsRelation *rel, from->outlinks) {
+ for (Relation *rel : from->outlinks) {
BLI_assert(rel->from == from);
if (rel->to != to) {
continue;
@@ -460,9 +224,7 @@ DepsRelation *Depsgraph::check_nodes_connected(const DepsNode *from,
/* ************************ */
/* Relationships Management */
-DepsRelation::DepsRelation(DepsNode *from,
- DepsNode *to,
- const char *description)
+Relation::Relation(Node *from, Node *to, const char *description)
: from(from),
to(to),
name(description),
@@ -480,19 +242,18 @@ DepsRelation::DepsRelation(DepsNode *from,
* anyway.
*
* - Unregistering relation is not a cheap operation, so better to have it
- * as an explicit call if we need this.
- */
+ * as an explicit call if we need this. */
from->outlinks.push_back(this);
to->inlinks.push_back(this);
}
-DepsRelation::~DepsRelation()
+Relation::~Relation()
{
/* Sanity check. */
BLI_assert(from != NULL && to != NULL);
}
-void DepsRelation::unlink()
+void Relation::unlink()
{
/* Sanity check. */
BLI_assert(from != NULL && to != NULL);
@@ -503,15 +264,16 @@ void DepsRelation::unlink()
/* Low level tagging -------------------------------------- */
/* Tag a specific node as needing updates. */
-void Depsgraph::add_entry_tag(OperationDepsNode *node)
+void Depsgraph::add_entry_tag(OperationNode *node)
{
/* Sanity check. */
if (node == NULL) {
return;
}
- /* Add to graph-level set of directly modified nodes to start searching from.
- * NOTE: this is necessary since we have several thousand nodes to play with...
- */
+ /* Add to graph-level set of directly modified nodes to start searching
+ * from.
+ * NOTE: this is necessary since we have several thousand nodes to play
+ * with. */
BLI_gset_insert(entry_tags, node);
}
@@ -519,22 +281,21 @@ void Depsgraph::clear_all_nodes()
{
clear_id_nodes();
if (time_source != NULL) {
- OBJECT_GUARDED_DELETE(time_source, TimeSourceDepsNode);
+ OBJECT_GUARDED_DELETE(time_source, TimeSourceNode);
time_source = NULL;
}
}
ID *Depsgraph::get_cow_id(const ID *id_orig) const
{
- IDDepsNode *id_node = find_id_node(id_orig);
+ IDNode *id_node = find_id_node(id_orig);
if (id_node == NULL) {
/* This function is used from places where we expect ID to be either
* already a copy-on-write version or have a corresponding copy-on-write
* version.
*
* We try to enforce that in debug builds, for for release we play a bit
- * safer game here.
- */
+ * safer game here. */
if ((id_orig->tag & LIB_TAG_COPIED_ON_WRITE) == 0) {
/* TODO(sergey): This is nice sanity check to have, but it fails
* in following situations:
@@ -543,8 +304,7 @@ ID *Depsgraph::get_cow_id(const ID *id_orig) const
* shading system and hence can be ignored at construction.
* - Object or mesh has material at a slot which is not used (for
* example, object has material slot by materials are set to
- * object data).
- */
+ * object data). */
// BLI_assert(!"Request for non-existing copy-on-write ID");
}
return (ID *)id_orig;
@@ -552,46 +312,6 @@ ID *Depsgraph::get_cow_id(const ID *id_orig) const
return id_node->id_cow;
}
-void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx, ID *id)
-{
- if (deg_editor_update_id_cb != NULL) {
- deg_editor_update_id_cb(update_ctx, id);
- }
-}
-
-void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
- bool updated)
-{
- if (deg_editor_update_scene_cb != NULL) {
- deg_editor_update_scene_cb(update_ctx, updated);
- }
-}
-
-bool deg_terminal_do_color(void)
-{
- return (G.debug & G_DEBUG_DEPSGRAPH_PRETTY) != 0;
-}
-
-string deg_color_for_pointer(const void *pointer)
-{
- if (!deg_terminal_do_color()) {
- return "";
- }
- int r, g, b;
- BLI_hash_pointer_to_color(pointer, &r, &g, &b);
- char buffer[64];
- BLI_snprintf(buffer, sizeof(buffer), TRUECOLOR_ANSI_COLOR_FORMAT, r, g, b);
- return string(buffer);
-}
-
-string deg_color_end(void)
-{
- if (!deg_terminal_do_color()) {
- return "";
- }
- return string(TRUECOLOR_ANSI_COLOR_FINISH);
-}
-
} // namespace DEG
/* **************** */
@@ -617,22 +337,13 @@ void DEG_graph_free(Depsgraph *graph)
OBJECT_GUARDED_DELETE(deg_depsgraph, Depsgraph);
}
-/* Set callbacks which are being called when depsgraph changes. */
-void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
- DEG_EditorUpdateSceneCb scene_func)
-{
- DEG::deg_editor_update_id_cb = id_func;
- DEG::deg_editor_update_scene_cb = scene_func;
-}
-
bool DEG_is_active(const struct Depsgraph *depsgraph)
{
if (depsgraph == NULL) {
/* Happens for such cases as work object in what_does_obaction(),
* and sine render pipeline parts. Shouldn't really be accepting
* NULL depsgraph, but is quite hard to get proper one in those
- * cases.
- */
+ * cases. */
return false;
}
const DEG::Depsgraph *deg_graph =
@@ -652,150 +363,3 @@ void DEG_make_inactive(struct Depsgraph *depsgraph)
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
deg_graph->is_active = false;
}
-
-/* Evaluation and debug */
-
-bool DEG_debug_is_evaluating(struct Depsgraph *depsgraph)
-{
- DEG::Depsgraph *deg_graph =
- reinterpret_cast<DEG::Depsgraph *>(depsgraph);
- return deg_graph->debug_is_evaluating;
-}
-
-static DEG::string depsgraph_name_for_logging(struct Depsgraph *depsgraph)
-{
- const char *name = DEG_debug_name_get(depsgraph);
- if (name[0] == '\0') {
- return "";
- }
- return "[" + DEG::string(name) + "]: ";
-}
-
-void DEG_debug_print_begin(struct Depsgraph *depsgraph)
-{
- fprintf(stdout, "%s",
- depsgraph_name_for_logging(depsgraph).c_str());
-}
-
-void DEG_debug_print_eval(struct Depsgraph *depsgraph,
- const char *function_name,
- const char *object_name,
- const void *object_address)
-{
- if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
- return;
- }
- fprintf(stdout,
- "%s%s on %s %s(%p)%s\n",
- depsgraph_name_for_logging(depsgraph).c_str(),
- function_name,
- object_name,
- DEG::deg_color_for_pointer(object_address).c_str(),
- object_address,
- DEG::deg_color_end().c_str());
- fflush(stdout);
-}
-
-void DEG_debug_print_eval_subdata(struct Depsgraph *depsgraph,
- const char *function_name,
- const char *object_name,
- const void *object_address,
- const char *subdata_comment,
- const char *subdata_name,
- const void *subdata_address)
-{
- if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
- return;
- }
- fprintf(stdout,
- "%s%s on %s %s(%p)%s %s %s %s(%p)%s\n",
- depsgraph_name_for_logging(depsgraph).c_str(),
- function_name,
- object_name,
- DEG::deg_color_for_pointer(object_address).c_str(),
- object_address,
- DEG::deg_color_end().c_str(),
- subdata_comment,
- subdata_name,
- DEG::deg_color_for_pointer(subdata_address).c_str(),
- subdata_address,
- DEG::deg_color_end().c_str());
- fflush(stdout);
-}
-
-void DEG_debug_print_eval_subdata_index(struct Depsgraph *depsgraph,
- const char *function_name,
- const char *object_name,
- const void *object_address,
- const char *subdata_comment,
- const char *subdata_name,
- const void *subdata_address,
- const int subdata_index)
-{
- if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
- return;
- }
- fprintf(stdout,
- "%s%s on %s %s(%p)%s %s %s[%d] %s(%p)%s\n",
- depsgraph_name_for_logging(depsgraph).c_str(),
- function_name,
- object_name,
- DEG::deg_color_for_pointer(object_address).c_str(),
- object_address,
- DEG::deg_color_end().c_str(),
- subdata_comment,
- subdata_name,
- subdata_index,
- DEG::deg_color_for_pointer(subdata_address).c_str(),
- subdata_address,
- DEG::deg_color_end().c_str());
- fflush(stdout);
-}
-
-void DEG_debug_print_eval_parent_typed(struct Depsgraph *depsgraph,
- const char *function_name,
- const char *object_name,
- const void *object_address,
- const char *parent_comment,
- const char *parent_name,
- const void *parent_address)
-{
- if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
- return;
- }
- fprintf(stdout,
- "%s%s on %s %s(%p) [%s] %s %s %s(%p)%s\n",
- depsgraph_name_for_logging(depsgraph).c_str(),
- function_name,
- object_name,
- DEG::deg_color_for_pointer(object_address).c_str(),
- object_address,
- DEG::deg_color_end().c_str(),
- parent_comment,
- parent_name,
- DEG::deg_color_for_pointer(parent_address).c_str(),
- parent_address,
- DEG::deg_color_end().c_str());
- fflush(stdout);
-}
-
-void DEG_debug_print_eval_time(struct Depsgraph *depsgraph,
- const char *function_name,
- const char *object_name,
- const void *object_address,
- float time)
-{
- if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
- return;
- }
- fprintf(stdout,
- "%s%s on %s %s(%p)%s at time %f\n",
- depsgraph_name_for_logging(depsgraph).c_str(),
- function_name,
- object_name,
- DEG::deg_color_for_pointer(object_address).c_str(),
- object_address,
- DEG::deg_color_end().c_str(),
- time);
- fflush(stdout);
-}
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index f3c4b52828f..de01969e963 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Datatypes for internal use in the Depsgraph
*
@@ -47,60 +40,57 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_physics.h"
-#include "intern/depsgraph_types.h"
+#include "intern/depsgraph_type.h"
-struct ID;
struct GHash;
-struct Main;
struct GSet;
-struct PointerRNA;
-struct PropertyRNA;
+struct ID;
+struct Main;
struct Scene;
struct ViewLayer;
namespace DEG {
-struct DepsNode;
-struct TimeSourceDepsNode;
-struct IDDepsNode;
-struct ComponentDepsNode;
-struct OperationDepsNode;
+struct ComponentNode;
+struct IDNode;
+struct Node;
+struct OperationNode;
+struct TimeSourceNode;
/* *************************** */
/* Relationships Between Nodes */
-/* Settings/Tags on Relationship */
-typedef enum eDepsRelation_Flag {
+/* Settings/Tags on Relationship.
+ * NOTE: Is a bitmask, allowing accumulation. */
+enum RelationFlag {
/* "cyclic" link - when detecting cycles, this relationship was the one
* which triggers a cyclic relationship to exist in the graph. */
- DEPSREL_FLAG_CYCLIC = (1 << 0),
+ RELATION_FLAG_CYCLIC = (1 << 0),
/* Update flush will not go through this relation. */
- DEPSREL_FLAG_NO_FLUSH = (1 << 1),
+ RELATION_FLAG_NO_FLUSH = (1 << 1),
/* Only flush along the relation is update comes from a node which was
* affected by user input. */
- DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY = (1 << 2),
+ RELATION_FLAG_FLUSH_USER_EDIT_ONLY = (1 << 2),
/* The relation can not be killed by the cyclic dependencies solver. */
- DEPSREL_FLAG_GODMODE = (1 << 3),
-} eDepsRelation_Flag;
+ RELATION_FLAG_GODMODE = (1 << 4),
+ /* Relation will check existance before being added. */
+ RELATION_CHECK_BEFORE_ADD = (1 << 5),
+};
/* B depends on A (A -> B) */
-struct DepsRelation {
+struct Relation {
+ Relation(Node *from, Node *to, const char *description);
+ ~Relation();
+
+ void unlink();
+
/* the nodes in the relationship (since this is shared between the nodes) */
- DepsNode *from; /* A */
- DepsNode *to; /* B */
+ Node *from; /* A */
+ Node *to; /* B */
/* relationship attributes */
const char *name; /* label for debugging */
-
- int flag; /* (eDepsRelation_Flag) */
-
- DepsRelation(DepsNode *from,
- DepsNode *to,
- const char *description);
-
- ~DepsRelation();
-
- void unlink();
+ int flag; /* Bitmask of RelationFlag) */
};
/* ********* */
@@ -109,57 +99,37 @@ struct DepsRelation {
/* Dependency Graph object */
struct Depsgraph {
// TODO(sergey): Go away from C++ container and use some native BLI.
- typedef vector<OperationDepsNode *> OperationNodes;
- typedef vector<IDDepsNode *> IDDepsNodes;
+ typedef vector<OperationNode *> OperationNodes;
+ typedef vector<IDNode *> IDDepsNodes;
Depsgraph(Scene *scene,
ViewLayer *view_layer,
eEvaluationMode mode);
~Depsgraph();
- /**
- * Convenience wrapper to find node given just pointer + property.
- *
- * \param ptr: pointer to the data that node will represent
- * \param prop: optional property affected - providing this effectively
- * results in inner nodes being returned
- *
- * \return A node matching the required characteristics if it exists
- * or NULL if no such node exists in the graph
- */
- DepsNode *find_node_from_pointer(const PointerRNA *ptr, const PropertyRNA *prop) const;
-
- TimeSourceDepsNode *add_time_source();
- TimeSourceDepsNode *find_time_source() const;
+ TimeSourceNode *add_time_source();
+ TimeSourceNode *find_time_source() const;
- IDDepsNode *find_id_node(const ID *id) const;
- IDDepsNode *add_id_node(ID *id, ID *id_cow_hint = NULL);
+ IDNode *find_id_node(const ID *id) const;
+ IDNode *add_id_node(ID *id, ID *id_cow_hint = NULL);
void clear_id_nodes();
void clear_id_nodes_conditional(const std::function <bool (ID_Type id_type)>& filter);
/* Add new relationship between two nodes. */
- DepsRelation *add_new_relation(OperationDepsNode *from,
- OperationDepsNode *to,
- const char *description,
- bool check_unique = false,
- int flags = 0);
-
- DepsRelation *add_new_relation(DepsNode *from,
- DepsNode *to,
- const char *description,
- bool check_unique = false,
- int flags = 0);
+ Relation *add_new_relation(Node *from,
+ Node *to,
+ const char *description,
+ int flags = 0);
/* Check whether two nodes are connected by relation with given
* description. Description might be NULL to check ANY relation between
- * given nodes.
- */
- DepsRelation *check_nodes_connected(const DepsNode *from,
- const DepsNode *to,
- const char *description);
+ * given nodes. */
+ Relation *check_nodes_connected(const Node *from,
+ const Node *to,
+ const char *description);
/* Tag a specific node as needing updates. */
- void add_entry_tag(OperationDepsNode *node);
+ void add_entry_tag(OperationNode *node);
/* Clear storage used by all nodes. */
void clear_all_nodes();
@@ -171,19 +141,17 @@ struct Depsgraph {
/* Core Graph Functionality ........... */
- /* <ID : IDDepsNode> mapping from ID blocks to nodes representing these
- * blocks, used for quick lookups.
- */
+ /* <ID : IDNode> mapping from ID blocks to nodes representing these
+ * blocks, used for quick lookups. */
GHash *id_hash;
/* Ordered list of ID nodes, order matches ID allocation order.
* Used for faster iteration, especially for areas which are critical to
- * keep exact order of iteration.
- */
+ * keep exact order of iteration. */
IDDepsNodes id_nodes;
/* Top-level time source node. */
- TimeSourceDepsNode *time_source;
+ TimeSourceNode *time_source;
/* Indicates whether relations needs to be updated. */
bool need_update;
@@ -203,8 +171,7 @@ struct Depsgraph {
OperationNodes operations;
/* Spin lock for threading-critical operations.
- * Mainly used by graph evaluation.
- */
+ * Mainly used by graph evaluation. */
SpinLock lock;
/* Scene, layer, mode this dependency graph is built for. */
@@ -216,8 +183,7 @@ struct Depsgraph {
float ctime;
/* Evaluated version of datablocks we access a lot.
- * Stored here to save us form doing hash lookup.
- */
+ * Stored here to save us form doing hash lookup. */
Scene *scene_cow;
/* Active dependency graph is a dependency graph which is used by the
@@ -226,11 +192,10 @@ struct Depsgraph {
* result and other selective things (object matrix?) to original object.
*
* This way we simplify operators, which don't need to worry about where
- * to read stuff from.
- */
+ * to read stuff from. */
bool is_active;
- /* NITE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */
+ /* NOTE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */
int debug_flags;
string debug_name;
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index 5ff504bc8c6..3cec2b45ea4 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): Based on original depsgraph.c code - Blender Foundation (2005-2013)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph_build.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Methods for constructing depsgraph.
*/
@@ -58,45 +51,44 @@ extern "C" {
#include "builder/deg_builder_relations.h"
#include "builder/deg_builder_transitive.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
+#include "intern/debug/deg_debug.h"
-#include "intern/depsgraph_types.h"
-#include "intern/depsgraph_intern.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph_type.h"
/* ****************** */
/* External Build API */
-static DEG::eDepsNode_Type deg_build_scene_component_type(
+static DEG::NodeType deg_build_scene_component_type(
eDepsSceneComponentType component)
{
switch (component) {
- case DEG_SCENE_COMP_PARAMETERS: return DEG::DEG_NODE_TYPE_PARAMETERS;
- case DEG_SCENE_COMP_ANIMATION: return DEG::DEG_NODE_TYPE_ANIMATION;
- case DEG_SCENE_COMP_SEQUENCER: return DEG::DEG_NODE_TYPE_SEQUENCER;
+ case DEG_SCENE_COMP_PARAMETERS: return DEG::NodeType::PARAMETERS;
+ case DEG_SCENE_COMP_ANIMATION: return DEG::NodeType::ANIMATION;
+ case DEG_SCENE_COMP_SEQUENCER: return DEG::NodeType::SEQUENCER;
}
- return DEG::DEG_NODE_TYPE_UNDEFINED;
+ return DEG::NodeType::UNDEFINED;
}
-static DEG::eDepsNode_Type deg_build_object_component_type(
+static DEG::NodeType deg_build_object_component_type(
eDepsObjectComponentType component)
{
switch (component) {
- case DEG_OB_COMP_PARAMETERS: return DEG::DEG_NODE_TYPE_PARAMETERS;
- case DEG_OB_COMP_PROXY: return DEG::DEG_NODE_TYPE_PROXY;
- case DEG_OB_COMP_ANIMATION: return DEG::DEG_NODE_TYPE_ANIMATION;
- case DEG_OB_COMP_TRANSFORM: return DEG::DEG_NODE_TYPE_TRANSFORM;
- case DEG_OB_COMP_GEOMETRY: return DEG::DEG_NODE_TYPE_GEOMETRY;
- case DEG_OB_COMP_EVAL_POSE: return DEG::DEG_NODE_TYPE_EVAL_POSE;
- case DEG_OB_COMP_BONE: return DEG::DEG_NODE_TYPE_BONE;
- case DEG_OB_COMP_SHADING: return DEG::DEG_NODE_TYPE_SHADING;
- case DEG_OB_COMP_CACHE: return DEG::DEG_NODE_TYPE_CACHE;
+ case DEG_OB_COMP_PARAMETERS: return DEG::NodeType::PARAMETERS;
+ case DEG_OB_COMP_PROXY: return DEG::NodeType::PROXY;
+ case DEG_OB_COMP_ANIMATION: return DEG::NodeType::ANIMATION;
+ case DEG_OB_COMP_TRANSFORM: return DEG::NodeType::TRANSFORM;
+ case DEG_OB_COMP_GEOMETRY: return DEG::NodeType::GEOMETRY;
+ case DEG_OB_COMP_EVAL_POSE: return DEG::NodeType::EVAL_POSE;
+ case DEG_OB_COMP_BONE: return DEG::NodeType::BONE;
+ case DEG_OB_COMP_SHADING: return DEG::NodeType::SHADING;
+ case DEG_OB_COMP_CACHE: return DEG::NodeType::CACHE;
}
- return DEG::DEG_NODE_TYPE_UNDEFINED;
+ return DEG::NodeType::UNDEFINED;
}
static DEG::DepsNodeHandle *get_node_handle(DepsNodeHandle *node_handle)
@@ -109,7 +101,7 @@ void DEG_add_scene_relation(DepsNodeHandle *node_handle,
eDepsSceneComponentType component,
const char *description)
{
- DEG::eDepsNode_Type type = deg_build_scene_component_type(component);
+ DEG::NodeType type = deg_build_scene_component_type(component);
DEG::ComponentKey comp_key(&scene->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key,
@@ -122,7 +114,7 @@ void DEG_add_object_relation(DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
- DEG::eDepsNode_Type type = deg_build_object_component_type(component);
+ DEG::NodeType type = deg_build_object_component_type(component);
DEG::ComponentKey comp_key(&object->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key,
@@ -135,7 +127,7 @@ void DEG_add_object_cache_relation(DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
- DEG::eDepsNode_Type type = deg_build_object_component_type(component);
+ DEG::NodeType type = deg_build_object_component_type(component);
DEG::ComponentKey comp_key(&cache_file->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key,
@@ -149,7 +141,7 @@ void DEG_add_bone_relation(DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
- DEG::eDepsNode_Type type = deg_build_object_component_type(component);
+ DEG::NodeType type = deg_build_object_component_type(component);
DEG::ComponentKey comp_key(&object->id, type, bone_name);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(comp_key,
@@ -162,7 +154,7 @@ void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
eDepsObjectComponentType component,
const char *description)
{
- DEG::eDepsNode_Type type = deg_build_object_component_type(component);
+ DEG::NodeType type = deg_build_object_component_type(component);
DEG::ComponentKey comp_key(&object->id, type);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
DEG::DepsgraphRelationBuilder *relation_builder = deg_node_handle->builder;
@@ -171,11 +163,11 @@ void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
comp_key, deg_node_handle, description);
/* Node deduct point cache component and connect source to it. */
ID *id = DEG_get_id_from_handle(node_handle);
- DEG::ComponentKey point_cache_key(id, DEG::DEG_NODE_TYPE_POINT_CACHE);
- DEG::DepsRelation *rel = relation_builder->add_relation(
+ DEG::ComponentKey point_cache_key(id, DEG::NodeType::POINT_CACHE);
+ DEG::Relation *rel = relation_builder->add_relation(
comp_key, point_cache_key, "Point Cache");
if (rel != NULL) {
- rel->flag |= DEG::DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY;
+ rel->flag |= DEG::RELATION_FLAG_FLUSH_USER_EDIT_ONLY;
}
else {
fprintf(stderr,
@@ -191,14 +183,24 @@ void DEG_add_generic_id_relation(struct DepsNodeHandle *node_handle,
{
DEG::OperationKey operation_key(
id,
- DEG::DEG_NODE_TYPE_GENERIC_DATABLOCK,
- DEG::DEG_OPCODE_GENERIC_DATABLOCK_UPDATE);
+ DEG::NodeType::GENERIC_DATABLOCK,
+ DEG::OperationCode::GENERIC_DATABLOCK_UPDATE);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(operation_key,
deg_node_handle,
description);
}
+void DEG_add_modifier_to_transform_relation(
+ struct DepsNodeHandle *node_handle,
+ const char *description)
+{
+ DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
+ deg_node_handle->builder->add_modifier_to_transform_relation(
+ deg_node_handle,
+ description);
+}
+
void DEG_add_special_eval_flag(struct DepsNodeHandle *node_handle,
ID *id,
uint32_t flag)
@@ -209,10 +211,12 @@ void DEG_add_special_eval_flag(struct DepsNodeHandle *node_handle,
void DEG_add_customdata_mask(struct DepsNodeHandle *node_handle,
struct Object *object,
- uint64_t mask)
+ const CustomData_MeshMasks *masks)
{
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
- deg_node_handle->builder->add_customdata_mask(object, mask);
+ deg_node_handle->builder->add_customdata_mask(
+ object,
+ DEG::DEGCustomDataMeshMasks(masks));
}
struct ID *DEG_get_id_from_handle(struct DepsNodeHandle *node_handle)
@@ -240,7 +244,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
ViewLayer *view_layer)
{
double start_time = 0.0;
- if (G.debug & G_DEBUG_DEPSGRAPH_BUILD) {
+ if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) {
start_time = PIL_check_seconds_timer();
}
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
@@ -256,8 +260,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
DEG::DEG_ID_LINKED_DIRECTLY);
node_builder.end_build();
/* Hook up relationships between operations - to determine evaluation
- * order.
- */
+ * order. */
DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph);
relation_builder.begin_build();
relation_builder.build_view_layer(scene, view_layer);
@@ -267,8 +270,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
/* Simplify the graph by removing redundant relations (to optimize
* traversal later). */
/* TODO: it would be useful to have an option to disable this in cases where
- * it is causing trouble.
- */
+ * it is causing trouble. */
if (G.debug_value == 799) {
DEG::deg_graph_transitive_reduction(deg_graph);
}
@@ -286,7 +288,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
/* Relations are up to date. */
deg_graph->need_update = false;
/* Finish statistics. */
- if (G.debug & G_DEBUG_DEPSGRAPH_BUILD) {
+ if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) {
printf("Depsgraph built in %f seconds.\n",
PIL_check_seconds_timer() - start_time);
}
@@ -303,9 +305,8 @@ void DEG_graph_tag_relations_update(Depsgraph *graph)
* re-create flat array of bases in view layer.
*
* TODO(sergey): Try to make it so we don't flush updates
- * to the whole depsgraph.
- */
- DEG::IDDepsNode *id_node = deg_graph->find_id_node(&deg_graph->scene->id);
+ * to the whole depsgraph. */
+ DEG::IDNode *id_node = deg_graph->find_id_node(&deg_graph->scene->id);
if (id_node != NULL) {
id_node->tag_update(deg_graph, DEG::DEG_UPDATE_SOURCE_RELATIONS);
}
@@ -329,7 +330,7 @@ void DEG_graph_relations_update(Depsgraph *graph,
void DEG_relations_tag_update(Main *bmain)
{
DEG_GLOBAL_DEBUG_PRINTF(TAG, "%s: Tagging relations for update.\n", __func__);
- LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
Depsgraph *depsgraph =
(Depsgraph *)BKE_scene_get_depsgraph(scene,
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc
index 91db054b006..67450d1350f 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cc
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Lukas Toenne
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph_debug.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Implementation of tools for debugging the depsgraph
*/
@@ -44,12 +37,12 @@ extern "C" {
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/depsgraph_types.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_time.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph.h"
+#include "intern/depsgraph_type.h"
+#include "intern/debug/deg_debug.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_time.h"
void DEG_debug_flags_set(Depsgraph *depsgraph, int flags)
{
@@ -94,8 +87,7 @@ bool DEG_debug_compare(const struct Depsgraph *graph1,
*
* Would be cool to make it more robust, but it's good enough
* for now. Also, proper graph check is actually NP-complex
- * problem..
- */
+ * problem. */
return true;
}
@@ -118,49 +110,46 @@ bool DEG_debug_graph_relations_validate(Depsgraph *graph,
bool DEG_debug_consistency_check(Depsgraph *graph)
{
- const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
-
+ const DEG::Depsgraph *deg_graph =
+ reinterpret_cast<const DEG::Depsgraph *>(graph);
/* Validate links exists in both directions. */
- foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
- foreach (DEG::DepsRelation *rel, node->outlinks) {
+ for (DEG::OperationNode *node : deg_graph->operations) {
+ for (DEG::Relation *rel : node->outlinks) {
int counter1 = 0;
- foreach (DEG::DepsRelation *tmp_rel, node->outlinks) {
+ for (DEG::Relation *tmp_rel : node->outlinks) {
if (tmp_rel == rel) {
++counter1;
}
}
-
int counter2 = 0;
- foreach (DEG::DepsRelation *tmp_rel, rel->to->inlinks) {
+ for (DEG::Relation *tmp_rel : rel->to->inlinks) {
if (tmp_rel == rel) {
++counter2;
}
}
-
if (counter1 != counter2) {
- printf("Relation exists in outgoing direction but not in incoming (%d vs. %d).\n",
+ printf("Relation exists in outgoing direction but not in "
+ "incoming (%d vs. %d).\n",
counter1, counter2);
return false;
}
}
}
- foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
- foreach (DEG::DepsRelation *rel, node->inlinks) {
+ for (DEG::OperationNode *node : deg_graph->operations) {
+ for (DEG::Relation *rel : node->inlinks) {
int counter1 = 0;
- foreach (DEG::DepsRelation *tmp_rel, node->inlinks) {
+ for (DEG::Relation *tmp_rel : node->inlinks) {
if (tmp_rel == rel) {
++counter1;
}
}
-
int counter2 = 0;
- foreach (DEG::DepsRelation *tmp_rel, rel->from->outlinks) {
+ for (DEG::Relation *tmp_rel : rel->from->outlinks) {
if (tmp_rel == rel) {
++counter2;
}
}
-
if (counter1 != counter2) {
printf("Relation exists in incoming direction but not in outcoming (%d vs. %d).\n",
counter1, counter2);
@@ -169,20 +158,20 @@ bool DEG_debug_consistency_check(Depsgraph *graph)
}
/* Validate node valency calculated in both directions. */
- foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
+ for (DEG::OperationNode *node : deg_graph->operations) {
node->num_links_pending = 0;
node->custom_flags = 0;
}
- foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
+ for (DEG::OperationNode *node : deg_graph->operations) {
if (node->custom_flags) {
printf("Node %s is twice in the operations!\n",
node->identifier().c_str());
return false;
}
- foreach (DEG::DepsRelation *rel, node->outlinks) {
- if (rel->to->type == DEG::DEG_NODE_TYPE_OPERATION) {
- DEG::OperationDepsNode *to = (DEG::OperationDepsNode *)rel->to;
+ for (DEG::Relation *rel : node->outlinks) {
+ if (rel->to->type == DEG::NodeType::OPERATION) {
+ DEG::OperationNode *to = (DEG::OperationNode *)rel->to;
BLI_assert(to->num_links_pending < to->inlinks.size());
++to->num_links_pending;
}
@@ -190,10 +179,10 @@ bool DEG_debug_consistency_check(Depsgraph *graph)
node->custom_flags = 1;
}
- foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
+ for (DEG::OperationNode *node : deg_graph->operations) {
int num_links_pending = 0;
- foreach (DEG::DepsRelation *rel, node->inlinks) {
- if (rel->from->type == DEG::DEG_NODE_TYPE_OPERATION) {
+ for (DEG::Relation *rel : node->inlinks) {
+ if (rel->from->type == DEG::NodeType::OPERATION) {
++num_links_pending;
}
}
@@ -224,8 +213,7 @@ void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
/* number of operations */
if (r_operations) {
/* All operations should be in this list, allowing us to count the total
- * number of nodes.
- */
+ * number of nodes. */
*r_operations = deg_graph->operations.size();
}
@@ -234,19 +222,19 @@ void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
size_t tot_outer = 0;
size_t tot_rels = 0;
- foreach (DEG::IDDepsNode *id_node, deg_graph->id_nodes) {
+ for (DEG::IDNode *id_node : deg_graph->id_nodes) {
tot_outer++;
- GHASH_FOREACH_BEGIN(DEG::ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(DEG::ComponentNode *, comp_node, id_node->components)
{
tot_outer++;
- foreach (DEG::OperationDepsNode *op_node, comp_node->operations) {
+ for (DEG::OperationNode *op_node : comp_node->operations) {
tot_rels += op_node->inlinks.size();
}
}
GHASH_FOREACH_END();
}
- DEG::TimeSourceDepsNode *time_source = deg_graph->find_time_source();
+ DEG::TimeSourceNode *time_source = deg_graph->find_time_source();
if (time_source != NULL) {
tot_rels += time_source->inlinks.size();
}
@@ -255,3 +243,148 @@ void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
if (r_outer) *r_outer = tot_outer;
}
}
+
+bool DEG_debug_is_evaluating(struct Depsgraph *depsgraph)
+{
+ DEG::Depsgraph *deg_graph =
+ reinterpret_cast<DEG::Depsgraph *>(depsgraph);
+ return deg_graph->debug_is_evaluating;
+}
+
+static DEG::string depsgraph_name_for_logging(struct Depsgraph *depsgraph)
+{
+ const char *name = DEG_debug_name_get(depsgraph);
+ if (name[0] == '\0') {
+ return "";
+ }
+ return "[" + DEG::string(name) + "]: ";
+}
+
+void DEG_debug_print_begin(struct Depsgraph *depsgraph)
+{
+ fprintf(stdout, "%s",
+ depsgraph_name_for_logging(depsgraph).c_str());
+}
+
+void DEG_debug_print_eval(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::color_end().c_str());
+ fflush(stdout);
+}
+
+void DEG_debug_print_eval_subdata(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address,
+ const char *subdata_comment,
+ const char *subdata_name,
+ const void *subdata_address)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p)%s %s %s %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::color_end().c_str(),
+ subdata_comment,
+ subdata_name,
+ DEG::color_for_pointer(subdata_address).c_str(),
+ subdata_address,
+ DEG::color_end().c_str());
+ fflush(stdout);
+}
+
+void DEG_debug_print_eval_subdata_index(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address,
+ const char *subdata_comment,
+ const char *subdata_name,
+ const void *subdata_address,
+ const int subdata_index)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p)%s %s %s[%d] %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::color_end().c_str(),
+ subdata_comment,
+ subdata_name,
+ subdata_index,
+ DEG::color_for_pointer(subdata_address).c_str(),
+ subdata_address,
+ DEG::color_end().c_str());
+ fflush(stdout);
+}
+
+void DEG_debug_print_eval_parent_typed(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address,
+ const char *parent_comment,
+ const char *parent_name,
+ const void *parent_address)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p) [%s] %s %s %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::color_end().c_str(),
+ parent_comment,
+ parent_name,
+ DEG::color_for_pointer(parent_address).c_str(),
+ parent_address,
+ DEG::color_end().c_str());
+ fflush(stdout);
+}
+
+void DEG_debug_print_eval_time(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address,
+ float time)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p)%s at time %f\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::color_for_pointer(object_address).c_str(),
+ object_address,
+ DEG::color_end().c_str(),
+ time);
+ fflush(stdout);
+}
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc
index 49eccd76f38..30370c5ac15 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cc
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph_eval.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Evaluation engine entrypoints for Depsgraph Engine.
*/
@@ -49,9 +42,9 @@ extern "C" {
#include "intern/eval/deg_eval.h"
#include "intern/eval/deg_eval_flush.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/nodes/deg_node_time.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/node/deg_node_time.h"
#include "intern/depsgraph.h"
@@ -61,7 +54,7 @@ void DEG_evaluate_on_refresh(Depsgraph *graph)
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg_graph->ctime = BKE_scene_frame_get(deg_graph->scene);
/* Update time on primary timesource. */
- DEG::TimeSourceDepsNode *tsrc = deg_graph->find_time_source();
+ DEG::TimeSourceNode *tsrc = deg_graph->find_time_source();
tsrc->cfra = deg_graph->ctime;
/* Update time in scene. */
if (deg_graph->scene_cow) {
@@ -78,7 +71,7 @@ void DEG_evaluate_on_framechange(Main *bmain,
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
deg_graph->ctime = ctime;
/* Update time on primary timesource. */
- DEG::TimeSourceDepsNode *tsrc = deg_graph->find_time_source();
+ DEG::TimeSourceNode *tsrc = deg_graph->find_time_source();
tsrc->cfra = ctime;
tsrc->tag_update(deg_graph, DEG::DEG_UPDATE_SOURCE_TIME);
DEG::deg_graph_flush_updates(bmain, deg_graph);
diff --git a/source/blender/depsgraph/intern/depsgraph_intern.h b/source/blender/depsgraph/intern/depsgraph_intern.h
deleted file mode 100644
index 069407e855e..00000000000
--- a/source/blender/depsgraph/intern/depsgraph_intern.h
+++ /dev/null
@@ -1,153 +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) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/depsgraph_intern.h
- * \ingroup depsgraph
- *
- * API's for internal use in the Depsgraph
- * - Also, defines for "Node Type Info"
- */
-
-#pragma once
-
-#include <cstdlib>
-
-#include "MEM_guardedalloc.h"
-
-extern "C" {
-#include "BKE_global.h"
-}
-
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/depsgraph.h"
-
-#include "DEG_depsgraph_debug.h"
-
-struct DEGEditorUpdateContext;
-struct Collection;
-struct ListBase;
-struct Main;
-struct Scene;
-
-namespace DEG {
-
-/* Node Types Handling ================================================= */
-
-/* "Typeinfo" for Node Types ------------------------------------------- */
-
-/* Typeinfo Struct (nti) */
-struct DepsNodeFactory {
- virtual eDepsNode_Type type() const = 0;
- virtual const char *tname() const = 0;
- virtual int id_recalc_tag() const = 0;
-
- virtual DepsNode *create_node(const ID *id,
- const char *subdata,
- const char *name) const = 0;
-};
-
-template <class NodeType>
-struct DepsNodeFactoryImpl : public DepsNodeFactory {
- eDepsNode_Type type() const { return NodeType::typeinfo.type; }
- const char *tname() const { return NodeType::typeinfo.tname; }
- int id_recalc_tag() const { return NodeType::typeinfo.id_recalc_tag; }
-
- DepsNode *create_node(const ID *id, const char *subdata, const char *name) const
- {
- DepsNode *node = OBJECT_GUARDED_NEW(NodeType);
-
- /* populate base node settings */
- node->type = type();
-
- if (name[0] != '\0') {
- /* set name if provided ... */
- node->name = name;
- }
- else {
- /* ... otherwise use default type name */
- node->name = tname();
- }
-
- node->init(id, subdata);
-
- return node;
- }
-};
-
-/* Typeinfo Management -------------------------------------------------- */
-
-/* Register typeinfo */
-void deg_register_node_typeinfo(DepsNodeFactory *factory);
-
-/* Get typeinfo for specified type */
-DepsNodeFactory *deg_type_get_factory(const eDepsNode_Type type);
-
-/* Editors Integration -------------------------------------------------- */
-
-void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx,
- struct ID *id);
-
-void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
- bool updated);
-
-#define DEG_DEBUG_PRINTF(depsgraph, type, ...) \
- do { \
- if (DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_ ## type) { \
- DEG_debug_print_begin(depsgraph); \
- fprintf(stdout, __VA_ARGS__); \
- } \
- } while (0)
-
-#define DEG_GLOBAL_DEBUG_PRINTF(type, ...) \
- do { \
- if (G.debug & G_DEBUG_DEPSGRAPH_ ## type) { \
- fprintf(stdout, __VA_ARGS__); \
- } \
- } while (0)
-
-#define DEG_ERROR_PRINTF(...) \
- do { \
- fprintf(stderr, __VA_ARGS__); \
- fflush(stderr); \
- } while (0)
-
-bool deg_terminal_do_color(void);
-string deg_color_for_pointer(const void *pointer);
-string deg_color_end(void);
-
-/* Physics Utilities -------------------------------------------------- */
-
-struct ListBase *deg_build_effector_relations(Depsgraph *graph, struct Collection *collection);
-struct ListBase *deg_build_collision_relations(Depsgraph *graph, struct Collection *collection, unsigned int modifier_type);
-void deg_clear_physics_relations(Depsgraph *graph);
-
-/* Tagging Utilities -------------------------------------------------------- */
-
-eDepsNode_Type deg_geometry_tag_to_component(const ID *id);
-
-} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_physics.cc b/source/blender/depsgraph/intern/depsgraph_physics.cc
index 88d4c25f726..02265ba0e7a 100644
--- a/source/blender/depsgraph/intern/depsgraph_physics.cc
+++ b/source/blender/depsgraph/intern/depsgraph_physics.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,16 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph_physics.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Physics utilities for effectors and collision.
*/
+#include "intern/depsgraph_physics.h"
+
#include "MEM_guardedalloc.h"
#include "BLI_compiler_compat.h"
@@ -48,7 +46,6 @@ extern "C" {
#include "DEG_depsgraph_query.h"
#include "depsgraph.h"
-#include "depsgraph_intern.h"
/*************************** Evaluation Query API *****************************/
@@ -110,7 +107,7 @@ void DEG_add_collision_relations(DepsNodeHandle *handle,
{
Depsgraph *depsgraph = DEG_get_graph_from_handle(handle);
DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph;
- ListBase *relations = deg_build_collision_relations(
+ ListBase *relations = build_collision_relations(
deg_graph, collection, modifier_type);
LISTBASE_FOREACH (CollisionRelation *, relation, relations) {
Object *ob1 = relation->ob;
@@ -140,7 +137,7 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
Depsgraph *depsgraph = DEG_get_graph_from_handle(handle);
DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph;
ListBase *relations =
- deg_build_effector_relations(deg_graph, effector_weights->group);
+ build_effector_relations(deg_graph, effector_weights->group);
LISTBASE_FOREACH (EffectorRelation *, relation, relations) {
if (relation->ob == object) {
continue;
@@ -148,14 +145,23 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
if (relation->pd->forcefield == skip_forcefield) {
continue;
}
+
+ /* Relation to forcefield object, optionally including geometry.
+ * Use special point cache relations for automatic cache clearing. */
DEG_add_object_pointcache_relation(
handle, relation->ob, DEG_OB_COMP_TRANSFORM, name);
- if (relation->psys) {
+
+ if (relation->psys ||
+ ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, PFIELD_SHAPE_POINTS) ||
+ relation->pd->forcefield == PFIELD_GUIDE)
+ {
/* TODO(sergey): Consider going more granular with more dedicated
* particle system operation. */
DEG_add_object_pointcache_relation(
handle, relation->ob, DEG_OB_COMP_GEOMETRY, name);
}
+
+ /* Smoke flow relations. */
if (relation->pd->forcefield == PFIELD_SMOKEFLOW &&
relation->pd->f_source != NULL)
{
@@ -168,6 +174,8 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
DEG_OB_COMP_GEOMETRY,
"Smoke Force Domain");
}
+
+ /* Absorption forces need collision relation. */
if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) {
DEG_add_collision_relations(handle,
object,
@@ -184,8 +192,7 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
namespace DEG
{
-ListBase *deg_build_effector_relations(Depsgraph *graph,
- Collection *collection)
+ListBase *build_effector_relations(Depsgraph *graph, Collection *collection)
{
GHash *hash = graph->physics_relations[DEG_PHYSICS_EFFECTOR];
if (hash == NULL) {
@@ -204,9 +211,9 @@ ListBase *deg_build_effector_relations(Depsgraph *graph,
return relations;
}
-ListBase *deg_build_collision_relations(Depsgraph *graph,
- Collection *collection,
- unsigned int modifier_type)
+ListBase *build_collision_relations(Depsgraph *graph,
+ Collection *collection,
+ unsigned int modifier_type)
{
const ePhysicsRelationType type = modifier_to_relation_type(modifier_type);
GHash *hash = graph->physics_relations[type];
@@ -240,11 +247,11 @@ void free_collision_relations(void *value)
} // namespace
-void deg_clear_physics_relations(Depsgraph *graph)
+void clear_physics_relations(Depsgraph *graph)
{
for (int i = 0; i < DEG_PHYSICS_RELATIONS_NUM; i++) {
if (graph->physics_relations[i]) {
- ePhysicsRelationType type = (ePhysicsRelationType)i;
+ const ePhysicsRelationType type = (ePhysicsRelationType)i;
switch (type) {
case DEG_PHYSICS_EFFECTOR:
diff --git a/source/blender/depsgraph/intern/depsgraph_physics.h b/source/blender/depsgraph/intern/depsgraph_physics.h
new file mode 100644
index 00000000000..f5d7b9817b5
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_physics.h
@@ -0,0 +1,39 @@
+/*
+ * 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) 2019 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+struct Collection;
+struct ListBase;
+
+namespace DEG {
+
+struct Depsgraph;
+
+ListBase *build_effector_relations(Depsgraph *graph, Collection *collection);
+ListBase *build_collision_relations(Depsgraph *graph,
+ Collection *collection,
+ unsigned int modifier_type);
+void clear_physics_relations(Depsgraph *graph);
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index c6ade6ac4c3..3b7f19e9916 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph_query.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Implementation of Querying API
*/
@@ -36,6 +29,7 @@ extern "C" {
#include <string.h> // XXX: memcpy
#include "BLI_utildefines.h"
+#include "BKE_customdata.h"
#include "BKE_idcode.h"
#include "BKE_main.h"
#include "BLI_listbase.h"
@@ -51,9 +45,9 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
+#include "intern/depsgraph.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/nodes/deg_node_id.h"
+#include "intern/node/deg_node_id.h"
struct Scene *DEG_get_input_scene(const Depsgraph *graph)
{
@@ -107,13 +101,12 @@ uint32_t DEG_get_eval_flags_for_id(const Depsgraph *graph, ID *id)
* after modifying scene graph.
*
* Currently harmless because it's only called for temporary
- * objects which are out of the DAG anyway.
- */
+ * objects which are out of the DAG anyway. */
return 0;
}
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
- const DEG::IDDepsNode *id_node = deg_graph->find_id_node(DEG_get_original_id(id));
+ const DEG::IDNode *id_node = deg_graph->find_id_node(DEG_get_original_id(id));
if (id_node == NULL) {
/* TODO(sergey): Does it mean we need to check set scene? */
return 0;
@@ -122,26 +115,29 @@ uint32_t DEG_get_eval_flags_for_id(const Depsgraph *graph, ID *id)
return id_node->eval_flags;
}
-uint64_t DEG_get_customdata_mask_for_object(const Depsgraph *graph, Object *ob)
+void DEG_get_customdata_mask_for_object(const Depsgraph *graph, Object *ob, CustomData_MeshMasks *r_mask)
{
if (graph == NULL) {
/* Happens when converting objects to mesh from a python script
* after modifying scene graph.
*
* Currently harmless because it's only called for temporary
- * objects which are out of the DAG anyway.
- */
- return 0;
+ * objects which are out of the DAG anyway. */
+ return;
}
const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
- const DEG::IDDepsNode *id_node = deg_graph->find_id_node(DEG_get_original_id(&ob->id));
+ const DEG::IDNode *id_node = deg_graph->find_id_node(DEG_get_original_id(&ob->id));
if (id_node == NULL) {
/* TODO(sergey): Does it mean we need to check set scene? */
- return 0;
+ return;
}
- return id_node->customdata_mask;
+ r_mask->vmask |= id_node->customdata_masks.vert_mask;
+ r_mask->emask |= id_node->customdata_masks.edge_mask;
+ r_mask->fmask |= id_node->customdata_masks.face_mask;
+ r_mask->lmask |= id_node->customdata_masks.loop_mask;
+ r_mask->pmask |= id_node->customdata_masks.poly_mask;
}
Scene *DEG_get_evaluated_scene(const Depsgraph *graph)
@@ -151,8 +147,7 @@ Scene *DEG_get_evaluated_scene(const Depsgraph *graph)
Scene *scene_cow = deg_graph->scene_cow;
/* TODO(sergey): Shall we expand datablock here? Or is it OK to assume
* that calleer is OK with just a pointer in case scene is not updated
- * yet?
- */
+ * yet? */
BLI_assert(scene_cow != NULL && DEG::deg_copy_on_write_is_expanded(&scene_cow->id));
return scene_cow;
}
@@ -188,10 +183,9 @@ ID *DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
}
/* TODO(sergey): This is a duplicate of Depsgraph::get_cow_id(),
* but here we never do assert, since we don't know nature of the
- * incoming ID datablock.
- */
+ * incoming ID datablock. */
const DEG::Depsgraph *deg_graph = (const DEG::Depsgraph *)depsgraph;
- const DEG::IDDepsNode *id_node = deg_graph->find_id_node(id);
+ const DEG::IDNode *id_node = deg_graph->find_id_node(id);
if (id_node == NULL) {
return id;
}
@@ -215,8 +209,7 @@ void DEG_get_evaluated_rna_pointer(const Depsgraph *depsgraph, PointerRNA *ptr,
else if (ptr->type == &RNA_PoseBone) {
/* HACK: Since bone keyframing is quite commonly used,
* speed things up for this case by doing a special lookup
- * for bones
- */
+ * for bones */
const Object *ob_eval = (Object *)cow_id;
bPoseChannel *pchan = (bPoseChannel *)ptr->data;
const bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan->name);
@@ -227,11 +220,9 @@ void DEG_get_evaluated_rna_pointer(const Depsgraph *depsgraph, PointerRNA *ptr,
else {
/* For everything else, try to get RNA Path of the BMain-pointer,
* then use that to look up what the COW-domain one should be
- * given the COW ID pointer as the new lookup point
- */
+ * given the COW ID pointer as the new lookup point */
/* TODO: Find a faster alternative, or implement support for other
- * common types too above (e.g. modifiers)
- */
+ * common types too above (e.g. modifiers) */
char *path = RNA_path_from_ID_to_struct(ptr);
if (path) {
PointerRNA cow_id_ptr;
diff --git a/source/blender/depsgraph/intern/depsgraph_query_filter.cc b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
index 1b44d4229e6..dbfc488d44e 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_filter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_filter.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph_query_filter.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Implementation of Graph Filtering API
*/
@@ -53,18 +46,15 @@ extern "C" {
#include "DEG_depsgraph_query.h"
#include "DEG_depsgraph_debug.h"
-#include "util/deg_util_foreach.h"
-
#include "intern/eval/deg_eval_copy_on_write.h"
#include "intern/depsgraph.h"
-#include "intern/depsgraph_types.h"
-#include "intern/depsgraph_intern.h"
+#include "intern/depsgraph_type.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
/* *************************************************** */
@@ -89,25 +79,25 @@ static void deg_add_retained_id_cb(ID *id, void *user_data)
/* ------------------------------------------- */
-/* Remove relations pointing to the given OperationDepsNode */
-/* TODO: Make this part of OperationDepsNode? */
-static void deg_unlink_opnode(Depsgraph *graph, OperationDepsNode *op_node)
+/* Remove relations pointing to the given OperationNode */
+/* TODO: Make this part of OperationNode? */
+static void deg_unlink_opnode(Depsgraph *graph, OperationNode *op_node)
{
- std::vector<DepsRelation *> all_links;
+ vector<Relation *> all_links;
/* Collect all inlinks to this operation */
- foreach (DepsRelation *rel, op_node->inlinks) {
+ for (Relation *rel : op_node->inlinks) {
all_links.push_back(rel);
}
/* Collect all outlinks from this operation */
- foreach (DepsRelation *rel, op_node->outlinks) {
+ for (Relation *rel : op_node->outlinks) {
all_links.push_back(rel);
}
/* Delete all collected relations */
- foreach (DepsRelation *rel, all_links) {
+ for (Relation *rel : all_links) {
rel->unlink();
- OBJECT_GUARDED_DELETE(rel, DepsRelation);
+ OBJECT_GUARDED_DELETE(rel, Relation);
}
/* Remove from entry tags */
@@ -121,14 +111,13 @@ static void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet *retained_ids)
{
/* 1) First pass over ID nodes + their operations
* - Identify and tag ID's (via "custom_flags = 1") to be removed
- * - Remove all links to/from operations that will be removed
- */
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ * - Remove all links to/from operations that will be removed. */
+ for (IDNode *id_node : graph->id_nodes) {
id_node->custom_flags = !BLI_gset_haskey(retained_ids, (void *)id_node->id_orig);
if (id_node->custom_flags) {
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
- foreach (OperationDepsNode *op_node, comp_node->operations) {
+ for (OperationNode *op_node : comp_node->operations) {
deg_unlink_opnode(graph, op_node);
}
}
@@ -141,8 +130,8 @@ static void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet *retained_ids)
it_opnode != graph->operations.end();
)
{
- OperationDepsNode *op_node = *it_opnode;
- IDDepsNode *id_node = op_node->owner->owner;
+ OperationNode *op_node = *it_opnode;
+ IDNode *id_node = op_node->owner->owner;
if (id_node->custom_flags) {
it_opnode = graph->operations.erase(it_opnode);
}
@@ -155,13 +144,12 @@ static void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet *retained_ids)
*
* This is loosely based on Depsgraph::clear_id_nodes().
* However, we don't worry about the conditional freeing for physics
- * stuff, since it's rarely needed currently.
- */
+ * stuff, since it's rarely needed currently. */
for (Depsgraph::IDDepsNodes::iterator it_id = graph->id_nodes.begin();
it_id != graph->id_nodes.end();
)
{
- IDDepsNode *id_node = *it_id;
+ IDNode *id_node = *it_id;
ID *id = id_node->id_orig;
if (id_node->custom_flags) {
@@ -171,7 +159,7 @@ static void deg_filter_remove_unwanted_ids(Depsgraph *graph, GSet *retained_ids)
BLI_ghash_remove(graph->id_hash, id, NULL, NULL);
it_id = graph->id_nodes.erase(it_id);
- OBJECT_GUARDED_DELETE(id_node, IDDepsNode);
+ OBJECT_GUARDED_DELETE(id_node, IDNode);
}
else {
/* This node has not been marked for deletion. Increment iterator */
@@ -210,7 +198,7 @@ Depsgraph *DEG_graph_filter(const Depsgraph *graph_src, Main *bmain, DEG_FilterQ
GSet *retained_ids = BLI_gset_ptr_new(__func__);
DEG::RetainedIdUserData retained_id_data = {query, retained_ids};
- LISTBASE_FOREACH(DEG_FilterTarget *, target, &query->targets) {
+ LISTBASE_FOREACH (DEG_FilterTarget *, target, &query->targets) {
/* Target Itself */
BLI_gset_add(retained_ids, (void *)target->id);
diff --git a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
index b6138e4e81c..a2ca4be5e33 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph_query_foreach.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Implementation of Querying and Filtering API's
*/
@@ -46,30 +39,27 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
-#include "intern/depsgraph_intern.h"
-
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/depsgraph.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
/* ************************ DEG TRAVERSAL ********************* */
namespace DEG {
-typedef std::deque<OperationDepsNode *> TraversalQueue;
+typedef std::deque<OperationNode *> TraversalQueue;
enum {
DEG_NODE_VISITED = (1 << 0),
};
static void deg_foreach_clear_flags(const Depsgraph *graph)
{
- foreach (OperationDepsNode *op_node, graph->operations) {
+ for (OperationNode *op_node : graph->operations) {
op_node->scheduled = false;
}
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ for (IDNode *id_node : graph->id_nodes) {
id_node->custom_flags = 0;
}
}
@@ -80,20 +70,19 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
void *user_data)
{
/* Start with getting ID node from the graph. */
- IDDepsNode *target_id_node = graph->find_id_node(id);
+ IDNode *target_id_node = graph->find_id_node(id);
if (target_id_node == NULL) {
/* TODO(sergey): Shall we inform or assert here about attempt to start
- * iterating over non-existing ID?
- */
+ * iterating over non-existing ID? */
return;
}
/* Make sure all runtime flags are ready and clear. */
deg_foreach_clear_flags(graph);
/* Start with scheduling all operations from ID node. */
TraversalQueue queue;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, target_id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, target_id_node->components)
{
- foreach (OperationDepsNode *op_node, comp_node->operations) {
+ for (OperationNode *op_node : comp_node->operations) {
queue.push_back(op_node);
op_node->scheduled = true;
}
@@ -103,12 +92,12 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
/* Process the queue. */
while (!queue.empty()) {
/* get next operation node to process. */
- OperationDepsNode *op_node = queue.front();
+ OperationNode *op_node = queue.front();
queue.pop_front();
for (;;) {
/* Check whether we need to inform callee about corresponding ID node. */
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
if ((id_node->custom_flags & DEG_NODE_VISITED) == 0) {
/* TODO(sergey): Is it orig or CoW? */
callback(id_node->id_orig, user_data);
@@ -116,7 +105,7 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
}
/* Schedule outgoing operation nodes. */
if (op_node->outlinks.size() == 1) {
- OperationDepsNode *to_node = (OperationDepsNode *)op_node->outlinks[0]->to;
+ OperationNode *to_node = (OperationNode *)op_node->outlinks[0]->to;
if (to_node->scheduled == false) {
to_node->scheduled = true;
op_node = to_node;
@@ -126,8 +115,8 @@ static void deg_foreach_dependent_ID(const Depsgraph *graph,
}
}
else {
- foreach (DepsRelation *rel, op_node->outlinks) {
- OperationDepsNode *to_node = (OperationDepsNode *)rel->to;
+ for (Relation *rel : op_node->outlinks) {
+ OperationNode *to_node = (OperationNode *)rel->to;
if (to_node->scheduled == false) {
queue.push_front(to_node);
to_node->scheduled = true;
@@ -145,20 +134,19 @@ static void deg_foreach_ancestor_ID(const Depsgraph *graph,
void *user_data)
{
/* Start with getting ID node from the graph. */
- IDDepsNode *target_id_node = graph->find_id_node(id);
+ IDNode *target_id_node = graph->find_id_node(id);
if (target_id_node == NULL) {
/* TODO(sergey): Shall we inform or assert here about attempt to start
- * iterating over non-existing ID?
- */
+ * iterating over non-existing ID? */
return;
}
/* Make sure all runtime flags are ready and clear. */
deg_foreach_clear_flags(graph);
/* Start with scheduling all operations from ID node. */
TraversalQueue queue;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, target_id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, target_id_node->components)
{
- foreach (OperationDepsNode *op_node, comp_node->operations) {
+ for (OperationNode *op_node : comp_node->operations) {
queue.push_back(op_node);
op_node->scheduled = true;
}
@@ -168,12 +156,12 @@ static void deg_foreach_ancestor_ID(const Depsgraph *graph,
/* Process the queue. */
while (!queue.empty()) {
/* get next operation node to process. */
- OperationDepsNode *op_node = queue.front();
+ OperationNode *op_node = queue.front();
queue.pop_front();
for (;;) {
/* Check whether we need to inform callee about corresponding ID node. */
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
if ((id_node->custom_flags & DEG_NODE_VISITED) == 0) {
/* TODO(sergey): Is it orig or CoW? */
callback(id_node->id_orig, user_data);
@@ -181,9 +169,9 @@ static void deg_foreach_ancestor_ID(const Depsgraph *graph,
}
/* Schedule incoming operation nodes. */
if (op_node->inlinks.size() == 1) {
- DepsNode *from = op_node->inlinks[0]->from;
- if (from->get_class() == DEG_NODE_CLASS_OPERATION) {
- OperationDepsNode *from_node = (OperationDepsNode *)from;
+ Node *from = op_node->inlinks[0]->from;
+ if (from->get_class() == NodeClass::OPERATION) {
+ OperationNode *from_node = (OperationNode *)from;
if (from_node->scheduled == false) {
from_node->scheduled = true;
op_node = from_node;
@@ -194,10 +182,10 @@ static void deg_foreach_ancestor_ID(const Depsgraph *graph,
}
}
else {
- foreach (DepsRelation *rel, op_node->inlinks) {
- DepsNode *from = rel->from;
- if (from->get_class() == DEG_NODE_CLASS_OPERATION) {
- OperationDepsNode *from_node = (OperationDepsNode *)from;
+ for (Relation *rel : op_node->inlinks) {
+ Node *from = rel->from;
+ if (from->get_class() == NodeClass::OPERATION) {
+ OperationNode *from_node = (OperationNode *)from;
if (from_node->scheduled == false) {
queue.push_front(from_node);
from_node->scheduled = true;
@@ -213,7 +201,7 @@ static void deg_foreach_ancestor_ID(const Depsgraph *graph,
static void deg_foreach_id(const Depsgraph *depsgraph,
DEGForeachIDCallback callback, void *user_data)
{
- foreach (const IDDepsNode *id_node, depsgraph->id_nodes) {
+ for (const IDNode *id_node : depsgraph->id_nodes) {
callback(id_node->id_orig, user_data);
}
}
diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
index 5b039ce60be..4aaeaf48040 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Dalai Felinto
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph_query_iter.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Implementation of Querying and Filtering API's
*/
@@ -51,10 +44,8 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
-#include "intern/depsgraph_intern.h"
-#include "util/deg_util_foreach.h"
-
-#include "intern/nodes/deg_node_id.h"
+#include "intern/depsgraph.h"
+#include "intern/node/deg_node_id.h"
#ifndef NDEBUG
# include "intern/eval/deg_eval_copy_on_write.h"
@@ -115,7 +106,7 @@ static bool deg_object_hide_original(eEvaluationMode eval_mode, Object *ob, Dupl
* visible otherwise. The better solution eventually would be for objects
* to specify which object they instance, instead of through parenting. */
if (eval_mode == DAG_EVAL_RENDER || dob) {
- const int hide_original_types = OB_DUPLIFRAMES | OB_DUPLIVERTS | OB_DUPLIFACES;
+ const int hide_original_types = OB_DUPLIVERTS | OB_DUPLIFACES;
if (!dob || !(dob->type & hide_original_types)) {
if (ob->parent && (ob->parent->transflag & hide_original_types)) {
@@ -154,8 +145,8 @@ bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
Object *dupli_parent = data->dupli_parent;
Object *temp_dupli_object = &data->temp_dupli_object;
*temp_dupli_object = *dob->ob;
- temp_dupli_object->select_color = dupli_parent->select_color;
- temp_dupli_object->base_flag = dupli_parent->base_flag | BASE_FROMDUPLI;
+ temp_dupli_object->select_id = dupli_parent->select_id;
+ temp_dupli_object->base_flag = dupli_parent->base_flag | BASE_FROM_DUPLI;
temp_dupli_object->base_local_view_bits = dupli_parent->base_local_view_bits;
/* Duplicated elements shouldn't care whether their original collection is visible or not. */
@@ -177,7 +168,7 @@ bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
return false;
}
-void deg_iterator_objects_step(BLI_Iterator *iter, DEG::IDDepsNode *id_node)
+void deg_iterator_objects_step(BLI_Iterator *iter, DEG::IDNode *id_node)
{
/* Set it early in case we need to exit and we are running from within a loop. */
iter->skip = true;
@@ -264,7 +255,7 @@ void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data)
data->eval_mode = DEG_get_mode(depsgraph);
deg_invalidate_iterator_work_data(data);
- DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
+ DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg_iterator_objects_step(iter, id_node);
if (iter->skip) {
@@ -300,7 +291,7 @@ void DEG_iterator_objects_next(BLI_Iterator *iter)
return;
}
- DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
+ DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
deg_iterator_objects_step(iter, id_node);
} while (iter->skip);
}
@@ -310,15 +301,14 @@ void DEG_iterator_objects_end(BLI_Iterator *iter)
DEGObjectIterData *data = (DEGObjectIterData *)iter->data;
if (data != NULL) {
/* Force crash in case the iterator data is referenced and accessed down
- * the line. (T51718)
- */
+ * the line. (T51718) */
deg_invalidate_iterator_work_data(data);
}
}
/* ************************ DEG ID ITERATOR ********************* */
-static void DEG_iterator_ids_step(BLI_Iterator *iter, DEG::IDDepsNode *id_node, bool only_updated)
+static void DEG_iterator_ids_step(BLI_Iterator *iter, DEG::IDNode *id_node, bool only_updated)
{
ID *id_cow = id_node->id_cow;
@@ -358,7 +348,7 @@ void DEG_iterator_ids_begin(BLI_Iterator *iter, DEGIDIterData *data)
data->id_node_index = 0;
data->num_id_nodes = num_id_nodes;
- DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
+ DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
DEG_iterator_ids_step(iter, id_node, data->only_updated);
if (iter->skip) {
@@ -381,7 +371,7 @@ void DEG_iterator_ids_next(BLI_Iterator *iter)
return;
}
- DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
+ DEG::IDNode *id_node = deg_graph->id_nodes[data->id_node_index];
DEG_iterator_ids_step(iter, id_node, data->only_updated);
} while (iter->skip);
}
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 26a12f42bfc..493247e252f 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,16 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/depsgraph_tag.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Core routines for how the Depsgraph works.
*/
+#include "intern/depsgraph_tag.h"
+
#include <stdio.h>
#include <cstring> /* required for memset */
#include <queue>
@@ -51,6 +46,7 @@ extern "C" {
#include "DNA_windowmanager_types.h"
#include "BKE_animsys.h"
+#include "BKE_global.h"
#include "BKE_idcode.h"
#include "BKE_node.h"
#include "BKE_scene.h"
@@ -62,18 +58,19 @@ extern "C" {
} /* extern "C" */
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_debug.h"
#include "DEG_depsgraph_query.h"
#include "intern/builder/deg_builder.h"
+#include "intern/depsgraph.h"
+#include "intern/depsgraph_update.h"
#include "intern/eval/deg_eval_copy_on_write.h"
#include "intern/eval/deg_eval_flush.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-
-#include "intern/depsgraph_intern.h"
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
/* *********************** */
/* Update Tagging/Flushing */
@@ -82,21 +79,24 @@ namespace DEG {
namespace {
-void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag);
-
void depsgraph_geometry_tag_to_component(const ID *id,
- eDepsNode_Type *component_type)
+ NodeType *component_type)
{
- const eDepsNode_Type result = deg_geometry_tag_to_component(id);
- if (result != DEG_NODE_TYPE_UNDEFINED) {
+ const NodeType result = geometry_tag_to_component(id);
+ if (result != NodeType::UNDEFINED) {
*component_type = result;
}
}
+bool is_selectable_data_id_type(const ID_Type id_type)
+{
+ return ELEM(id_type, ID_ME, ID_CU, ID_MB, ID_LT, ID_GD);
+}
+
void depsgraph_select_tag_to_component_opcode(
const ID *id,
- eDepsNode_Type *component_type,
- eDepsOperation_Code *operation_code)
+ NodeType *component_type,
+ OperationCode *operation_code)
{
const ID_Type id_type = GS(id->name);
if (id_type == ID_SCE) {
@@ -107,72 +107,75 @@ void depsgraph_select_tag_to_component_opcode(
*
* TODO(sergey): We can introduce explicit exit operation which
* does nothing and which is only used to cascade flush down the
- * road.
- */
- *component_type = DEG_NODE_TYPE_LAYER_COLLECTIONS;
- *operation_code = DEG_OPCODE_VIEW_LAYER_EVAL;
+ * road. */
+ *component_type = NodeType::LAYER_COLLECTIONS;
+ *operation_code = OperationCode::VIEW_LAYER_EVAL;
}
else if (id_type == ID_OB) {
- *component_type = DEG_NODE_TYPE_OBJECT_FROM_LAYER;
- *operation_code = DEG_OPCODE_OBJECT_BASE_FLAGS;
+ *component_type = NodeType::OBJECT_FROM_LAYER;
+ *operation_code = OperationCode::OBJECT_BASE_FLAGS;
}
else if (id_type == ID_MC) {
- *component_type = DEG_NODE_TYPE_BATCH_CACHE;
- *operation_code = DEG_OPCODE_MOVIECLIP_SELECT_UPDATE;
+ *component_type = NodeType::BATCH_CACHE;
+ *operation_code = OperationCode::MOVIECLIP_SELECT_UPDATE;
+ }
+ else if (is_selectable_data_id_type(id_type)) {
+ *component_type = NodeType::BATCH_CACHE;
+ *operation_code = OperationCode::GEOMETRY_SELECT_UPDATE;
}
else {
- *component_type = DEG_NODE_TYPE_BATCH_CACHE;
- *operation_code = DEG_OPCODE_GEOMETRY_SELECT_UPDATE;
+ *component_type = NodeType::COPY_ON_WRITE;
+ *operation_code = OperationCode::COPY_ON_WRITE;
}
}
void depsgraph_base_flags_tag_to_component_opcode(
const ID *id,
- eDepsNode_Type *component_type,
- eDepsOperation_Code *operation_code)
+ NodeType *component_type,
+ OperationCode *operation_code)
{
const ID_Type id_type = GS(id->name);
if (id_type == ID_SCE) {
- *component_type = DEG_NODE_TYPE_LAYER_COLLECTIONS;
- *operation_code = DEG_OPCODE_VIEW_LAYER_EVAL;
+ *component_type = NodeType::LAYER_COLLECTIONS;
+ *operation_code = OperationCode::VIEW_LAYER_EVAL;
}
else if (id_type == ID_OB) {
- *component_type = DEG_NODE_TYPE_OBJECT_FROM_LAYER;
- *operation_code = DEG_OPCODE_OBJECT_BASE_FLAGS;
+ *component_type = NodeType::OBJECT_FROM_LAYER;
+ *operation_code = OperationCode::OBJECT_BASE_FLAGS;
}
}
-eDepsOperation_Code psysTagToOperationCode(IDRecalcFlag tag)
+OperationCode psysTagToOperationCode(IDRecalcFlag tag)
{
if (tag == ID_RECALC_PSYS_RESET) {
- return DEG_OPCODE_PARTICLE_SETTINGS_RESET;
+ return OperationCode::PARTICLE_SETTINGS_RESET;
}
- return DEG_OPCODE_OPERATION;
+ return OperationCode::OPERATION;
}
void depsgraph_tag_to_component_opcode(const ID *id,
IDRecalcFlag tag,
- eDepsNode_Type *component_type,
- eDepsOperation_Code *operation_code)
+ NodeType *component_type,
+ OperationCode *operation_code)
{
const ID_Type id_type = GS(id->name);
- *component_type = DEG_NODE_TYPE_UNDEFINED;
- *operation_code = DEG_OPCODE_OPERATION;
+ *component_type = NodeType::UNDEFINED;
+ *operation_code = OperationCode::OPERATION;
/* Special case for now, in the future we should get rid of this. */
if (tag == 0) {
- *component_type = DEG_NODE_TYPE_ID_REF;
- *operation_code = DEG_OPCODE_OPERATION;
+ *component_type = NodeType::ID_REF;
+ *operation_code = OperationCode::OPERATION;
return;
}
switch (tag) {
case ID_RECALC_TRANSFORM:
- *component_type = DEG_NODE_TYPE_TRANSFORM;
+ *component_type = NodeType::TRANSFORM;
break;
case ID_RECALC_GEOMETRY:
depsgraph_geometry_tag_to_component(id, component_type);
break;
case ID_RECALC_ANIMATION:
- *component_type = DEG_NODE_TYPE_ANIMATION;
+ *component_type = NodeType::ANIMATION;
break;
case ID_RECALC_PSYS_REDO:
case ID_RECALC_PSYS_RESET:
@@ -183,24 +186,23 @@ void depsgraph_tag_to_component_opcode(const ID *id,
* - For particle settings node we need to use different
* component. Will be nice to get this unified with object,
* but we can survive for now with single exception here.
- * Particles needs reconsideration anyway,
- */
- *component_type = DEG_NODE_TYPE_PARTICLE_SETTINGS;
+ * Particles needs reconsideration anyway, */
+ *component_type = NodeType::PARTICLE_SETTINGS;
*operation_code = psysTagToOperationCode(tag);
}
else {
- *component_type = DEG_NODE_TYPE_PARTICLE_SYSTEM;
+ *component_type = NodeType::PARTICLE_SYSTEM;
}
break;
case ID_RECALC_COPY_ON_WRITE:
- *component_type = DEG_NODE_TYPE_COPY_ON_WRITE;
+ *component_type = NodeType::COPY_ON_WRITE;
break;
case ID_RECALC_SHADING:
if (id_type == ID_NT) {
- *component_type = DEG_NODE_TYPE_SHADING_PARAMETERS;
+ *component_type = NodeType::SHADING_PARAMETERS;
}
else {
- *component_type = DEG_NODE_TYPE_SHADING;
+ *component_type = NodeType::SHADING;
}
break;
case ID_RECALC_SELECT:
@@ -214,12 +216,11 @@ void depsgraph_tag_to_component_opcode(const ID *id,
operation_code);
break;
case ID_RECALC_POINT_CACHE:
- *component_type = DEG_NODE_TYPE_POINT_CACHE;
+ *component_type = NodeType::POINT_CACHE;
break;
case ID_RECALC_EDITORS:
/* There is no such node in depsgraph, this tag is to be handled
- * separately.
- */
+ * separately. */
break;
case ID_RECALC_ALL:
case ID_RECALC_PSYS_ALL:
@@ -228,20 +229,23 @@ void depsgraph_tag_to_component_opcode(const ID *id,
}
}
-void id_tag_update_ntree_special(Main *bmain, Depsgraph *graph, ID *id, int flag)
+void id_tag_update_ntree_special(Main *bmain,
+ Depsgraph *graph,
+ ID *id,
+ int flag,
+ eUpdateSource update_source)
{
bNodeTree *ntree = ntreeFromID(id);
if (ntree == NULL) {
return;
}
- deg_graph_id_tag_update(bmain, graph, &ntree->id, flag);
+ graph_id_tag_update(bmain, graph, &ntree->id, flag, update_source);
}
void depsgraph_update_editors_tag(Main *bmain, Depsgraph *graph, ID *id)
{
/* NOTE: We handle this immediately, without delaying anything, to be
- * sure we don't cause threading issues with OpenGL.
- */
+ * sure we don't cause threading issues with OpenGL. */
/* TODO(sergey): Make sure this works for CoW-ed datablocks as well. */
DEGEditorUpdateContext update_ctx = {NULL};
update_ctx.bmain = bmain;
@@ -252,30 +256,31 @@ void depsgraph_update_editors_tag(Main *bmain, Depsgraph *graph, ID *id)
}
void depsgraph_tag_component(Depsgraph *graph,
- IDDepsNode *id_node,
- eDepsNode_Type component_type,
- eDepsOperation_Code operation_code)
+ IDNode *id_node,
+ NodeType component_type,
+ OperationCode operation_code,
+ eUpdateSource update_source)
{
- ComponentDepsNode *component_node =
+ ComponentNode *component_node =
id_node->find_component(component_type);
if (component_node == NULL) {
return;
}
- if (operation_code == DEG_OPCODE_OPERATION) {
- component_node->tag_update(graph, DEG_UPDATE_SOURCE_USER_EDIT);
+ if (operation_code == OperationCode::OPERATION) {
+ component_node->tag_update(graph, update_source);
}
else {
- OperationDepsNode *operation_node =
+ OperationNode *operation_node =
component_node->find_operation(operation_code);
if (operation_node != NULL) {
- operation_node->tag_update(graph, DEG_UPDATE_SOURCE_USER_EDIT);
+ operation_node->tag_update(graph, update_source);
}
}
/* If component depends on copy-on-write, tag it as well. */
if (component_node->need_tag_cow_before_update()) {
- ComponentDepsNode *cow_comp =
- id_node->find_component(DEG_NODE_TYPE_COPY_ON_WRITE);
- cow_comp->tag_update(graph, DEG_UPDATE_SOURCE_USER_EDIT);
+ ComponentNode *cow_comp =
+ id_node->find_component(NodeType::COPY_ON_WRITE);
+ cow_comp->tag_update(graph, update_source);
id_node->id_orig->recalc |= ID_RECALC_COPY_ON_WRITE;
}
}
@@ -284,12 +289,12 @@ void depsgraph_tag_component(Depsgraph *graph,
*
* Mainly, old code was tagging object with ID_RECALC_GEOMETRY tag to inform
* that object's data datablock changed. Now API expects that ID is given
- * explicitly, but not all areas are aware of this yet.
- */
+ * explicitly, but not all areas are aware of this yet. */
void deg_graph_id_tag_legacy_compat(Main *bmain,
Depsgraph *depsgraph,
ID *id,
- IDRecalcFlag tag)
+ IDRecalcFlag tag,
+ eUpdateSource update_source)
{
if (tag == ID_RECALC_GEOMETRY || tag == 0) {
switch (GS(id->name)) {
@@ -298,20 +303,21 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
Object *object = (Object *)id;
ID *data_id = (ID *)object->data;
if (data_id != NULL) {
- deg_graph_id_tag_update(bmain, depsgraph, data_id, 0);
+ graph_id_tag_update(
+ bmain, depsgraph, data_id, 0, update_source);
}
break;
}
/* TODO(sergey): Shape keys are annoying, maybe we should find a
* way to chain geometry evaluation to them, so we don't need extra
- * tagging here.
- */
+ * tagging here. */
case ID_ME:
{
Mesh *mesh = (Mesh *)id;
ID *key_id = &mesh->key->id;
if (key_id != NULL) {
- deg_graph_id_tag_update(bmain, depsgraph, key_id, 0);
+ graph_id_tag_update(
+ bmain, depsgraph, key_id, 0, update_source);
}
break;
}
@@ -320,7 +326,8 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
Lattice *lattice = (Lattice *)id;
ID *key_id = &lattice->key->id;
if (key_id != NULL) {
- deg_graph_id_tag_update(bmain, depsgraph, key_id, 0);
+ graph_id_tag_update(
+ bmain, depsgraph, key_id, 0, update_source);
}
break;
}
@@ -329,7 +336,8 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
Curve *curve = (Curve *)id;
ID *key_id = &curve->key->id;
if (key_id != NULL) {
- deg_graph_id_tag_update(bmain, depsgraph, key_id, 0);
+ graph_id_tag_update(
+ bmain, depsgraph, key_id, 0, update_source);
}
break;
}
@@ -339,11 +347,12 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
}
}
-static void deg_graph_id_tag_update_single_flag(Main *bmain,
- Depsgraph *graph,
- ID *id,
- IDDepsNode *id_node,
- IDRecalcFlag tag)
+static void graph_id_tag_update_single_flag(Main *bmain,
+ Depsgraph *graph,
+ ID *id,
+ IDNode *id_node,
+ IDRecalcFlag tag,
+ eUpdateSource update_source)
{
if (tag == ID_RECALC_EDITORS) {
if (graph != NULL) {
@@ -352,40 +361,39 @@ static void deg_graph_id_tag_update_single_flag(Main *bmain,
return;
}
/* Get description of what is to be tagged. */
- eDepsNode_Type component_type;
- eDepsOperation_Code operation_code;
+ NodeType component_type;
+ OperationCode operation_code;
depsgraph_tag_to_component_opcode(id,
tag,
&component_type,
&operation_code);
/* Check whether we've got something to tag. */
- if (component_type == DEG_NODE_TYPE_UNDEFINED) {
+ if (component_type == NodeType::UNDEFINED) {
/* Given ID does not support tag. */
/* TODO(sergey): Shall we raise some panic here? */
return;
}
/* Tag ID recalc flag. */
- DepsNodeFactory *factory = deg_type_get_factory(component_type);
+ DepsNodeFactory *factory = type_get_factory(component_type);
BLI_assert(factory != NULL);
id->recalc |= factory->id_recalc_tag();
/* Some sanity checks before moving forward. */
if (id_node == NULL) {
/* Happens when object is tagged for update and not yet in the
- * dependency graph (but will be after relations update).
- */
+ * dependency graph (but will be after relations update). */
return;
}
/* Tag corresponding dependency graph operation for update. */
- if (component_type == DEG_NODE_TYPE_ID_REF) {
- id_node->tag_update(graph, DEG_UPDATE_SOURCE_USER_EDIT);
+ if (component_type == NodeType::ID_REF) {
+ id_node->tag_update(graph, update_source);
}
else {
- depsgraph_tag_component(graph, id_node, component_type, operation_code);
+ depsgraph_tag_component(
+ graph, id_node, component_type, operation_code, update_source);
}
/* TODO(sergey): Get rid of this once all areas are using proper data ID
- * for tagging.
- */
- deg_graph_id_tag_legacy_compat(bmain, graph, id, tag);
+ * for tagging. */
+ deg_graph_id_tag_legacy_compat(bmain, graph, id, tag, update_source);
}
@@ -407,8 +415,7 @@ string stringify_update_bitfield(int flag)
string result = "";
int current_flag = flag;
/* Special cases to avoid ALL flags form being split into
- * individual bits.
- */
+ * individual bits. */
if ((current_flag & ID_RECALC_PSYS_ALL) == ID_RECALC_PSYS_ALL) {
result = stringify_append_bit(result, ID_RECALC_PSYS_ALL);
}
@@ -421,13 +428,27 @@ string stringify_update_bitfield(int flag)
return result;
}
+const char *update_source_as_string(eUpdateSource source)
+{
+ switch (source) {
+ case DEG_UPDATE_SOURCE_TIME: return "TIME";
+ case DEG_UPDATE_SOURCE_USER_EDIT: return "USER_EDIT";
+ case DEG_UPDATE_SOURCE_RELATIONS: return "RELATIONS";
+ case DEG_UPDATE_SOURCE_VISIBILITY: return "VISIBILITY";
+ }
+ BLI_assert(!"Should never happen.");
+ return "UNKNOWN";
+}
+
/* Special tag function which tags all components which needs to be tagged
* for update flag=0.
*
* TODO(sergey): This is something to be avoid in the future, make it more
- * explicit and granular for users to tag what they really need.
- */
-void deg_graph_node_tag_zero(Main *bmain, Depsgraph *graph, IDDepsNode *id_node)
+ * explicit and granular for users to tag what they really need. */
+void deg_graph_node_tag_zero(Main *bmain,
+ Depsgraph *graph,
+ IDNode *id_node,
+ eUpdateSource update_source)
{
if (id_node == NULL) {
return;
@@ -435,102 +456,58 @@ void deg_graph_node_tag_zero(Main *bmain, Depsgraph *graph, IDDepsNode *id_node)
ID *id = id_node->id_orig;
/* TODO(sergey): Which recalc flags to set here? */
id->recalc |= ID_RECALC_ALL & ~(ID_RECALC_PSYS_ALL | ID_RECALC_ANIMATION);
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
- if (comp_node->type == DEG_NODE_TYPE_ANIMATION) {
+ if (comp_node->type == NodeType::ANIMATION) {
continue;
}
- comp_node->tag_update(graph, DEG_UPDATE_SOURCE_USER_EDIT);
+ comp_node->tag_update(graph, update_source);
}
GHASH_FOREACH_END();
- deg_graph_id_tag_legacy_compat(bmain, graph, id, (IDRecalcFlag)0);
-}
-
-void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag)
-{
- const int debug_flags = (graph != NULL)
- ? DEG_debug_flags_get((::Depsgraph *)graph)
- : G.debug;
- if (debug_flags & G_DEBUG_DEPSGRAPH_TAG) {
- printf("%s: id=%s flags=%s\n",
- __func__,
- id->name,
- stringify_update_bitfield(flag).c_str());
- }
- IDDepsNode *id_node = (graph != NULL) ? graph->find_id_node(id)
- : NULL;
- DEG_id_type_tag(bmain, GS(id->name));
- if (flag == 0) {
- deg_graph_node_tag_zero(bmain, graph, id_node);
- }
- id->recalc |= flag;
- int current_flag = flag;
- while (current_flag != 0) {
- IDRecalcFlag tag =
- (IDRecalcFlag)(1 << bitscan_forward_clear_i(&current_flag));
- deg_graph_id_tag_update_single_flag(bmain,
- graph,
- id,
- id_node,
- tag);
- }
- /* Special case for nested node tree datablocks. */
- id_tag_update_ntree_special(bmain, graph, id, flag);
- /* Direct update tags means that something outside of simulated/cached
- * physics did change and that cache is to be invalidated.
- */
- deg_graph_id_tag_update_single_flag(
- bmain, graph, id, id_node, ID_RECALC_POINT_CACHE);
-}
-
-void deg_id_tag_update(Main *bmain, ID *id, int flag)
-{
- deg_graph_id_tag_update(bmain, NULL, id, flag);
- LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
- LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
- Depsgraph *depsgraph =
- (Depsgraph *)BKE_scene_get_depsgraph(scene,
- view_layer,
- false);
- if (depsgraph != NULL) {
- deg_graph_id_tag_update(bmain, depsgraph, id, flag);
- }
- }
- }
+ deg_graph_id_tag_legacy_compat(
+ bmain, graph, id, (IDRecalcFlag)0, update_source);
}
void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
{
- foreach (DEG::IDDepsNode *id_node, graph->id_nodes) {
+ for (DEG::IDNode *id_node : graph->id_nodes) {
if (!id_node->visible_components_mask) {
/* ID has no components which affects anything visible. no meed
- * bother with it to tag or anything.
- */
+ * bother with it to tag or anything. */
continue;
}
if (id_node->visible_components_mask ==
id_node->previously_visible_components_mask)
{
/* The ID was already visible and evaluated, all the subsequent
- * updates and tags are to be done explicitly.
- */
+ * updates and tags are to be done explicitly. */
continue;
}
int flag = 0;
if (!DEG::deg_copy_on_write_is_expanded(id_node->id_cow)) {
flag |= ID_RECALC_COPY_ON_WRITE;
+ /* TODO(sergey): Shouldn't be needed, but currently we are lackign
+ * some flushing of evaluated data to the original one, which makes,
+ * for example, files saved with the rest pose.
+ * Need to solve those issues carefully, for until then we evaluate
+ * animation for datablocks which appears in the graph for the first
+ * time. */
+ flag |= ID_RECALC_ANIMATION;
}
/* We only tag components which needs an update. Tagging everything is
* not a good idea because that might reset particles cache (or any
* other type of cache).
*
- * TODO(sergey): Need to generalize this somehow.
- */
+ * TODO(sergey): Need to generalize this somehow. */
const ID_Type id_type = GS(id_node->id_orig->name);
if (id_type == ID_OB) {
flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
}
- deg_graph_id_tag_update(bmain, graph, id_node->id_orig, flag);
+ graph_id_tag_update(bmain,
+ graph,
+ id_node->id_orig,
+ flag,
+ DEG_UPDATE_SOURCE_VISIBILITY);
if (id_type == ID_SCE) {
/* Make sure collection properties are up to date. */
id_node->tag_update(graph, DEG_UPDATE_SOURCE_VISIBILITY);
@@ -543,8 +520,7 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
* dependency graph is tagged for relations update, it will be fine:
* since dependency graph builder re-schedules entry tags, all the
* tags we request from here will be applied in the updated state of
- * dependency graph.
- */
+ * dependency graph. */
id_node->previously_visible_components_mask =
id_node->visible_components_mask;
}
@@ -552,7 +528,7 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
} /* namespace */
-eDepsNode_Type deg_geometry_tag_to_component(const ID *id)
+NodeType geometry_tag_to_component(const ID *id)
{
const ID_Type id_type = GS(id->name);
switch (id_type) {
@@ -567,27 +543,90 @@ eDepsNode_Type deg_geometry_tag_to_component(const ID *id)
case OB_LATTICE:
case OB_MBALL:
case OB_GPENCIL:
- return DEG_NODE_TYPE_GEOMETRY;
+ return NodeType::GEOMETRY;
case OB_ARMATURE:
- return DEG_NODE_TYPE_EVAL_POSE;
+ return NodeType::EVAL_POSE;
/* TODO(sergey): More cases here? */
}
break;
}
case ID_ME:
- return DEG_NODE_TYPE_GEOMETRY;
+ case ID_CU:
+ case ID_LT:
+ case ID_MB:
+ return NodeType::GEOMETRY;
case ID_PA: /* Particles */
- return DEG_NODE_TYPE_UNDEFINED;
+ return NodeType::UNDEFINED;
case ID_LP:
- return DEG_NODE_TYPE_PARAMETERS;
+ return NodeType::PARAMETERS;
case ID_GD:
- return DEG_NODE_TYPE_GEOMETRY;
+ return NodeType::GEOMETRY;
case ID_PAL: /* Palettes */
- return DEG_NODE_TYPE_PARAMETERS;
+ return NodeType::PARAMETERS;
default:
break;
}
- return DEG_NODE_TYPE_UNDEFINED;
+ return NodeType::UNDEFINED;
+}
+
+void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source)
+{
+ graph_id_tag_update(bmain, NULL, id, flag, update_source);
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
+ Depsgraph *depsgraph =
+ (Depsgraph *)BKE_scene_get_depsgraph(scene,
+ view_layer,
+ false);
+ if (depsgraph != NULL) {
+ graph_id_tag_update(
+ bmain, depsgraph, id, flag, update_source);
+ }
+ }
+ }
+}
+
+void graph_id_tag_update(Main *bmain,
+ Depsgraph *graph,
+ ID *id,
+ int flag,
+ eUpdateSource update_source)
+{
+ const int debug_flags = (graph != NULL)
+ ? DEG_debug_flags_get((::Depsgraph *)graph)
+ : G.debug;
+ if (debug_flags & G_DEBUG_DEPSGRAPH_TAG) {
+ printf("%s: id=%s flags=%s source=%s\n",
+ __func__,
+ id->name,
+ stringify_update_bitfield(flag).c_str(),
+ update_source_as_string(update_source));
+ }
+ IDNode *id_node = (graph != NULL) ? graph->find_id_node(id)
+ : NULL;
+ if (graph != NULL) {
+ DEG_graph_id_type_tag(reinterpret_cast<::Depsgraph*>(graph),
+ GS(id->name));
+ }
+ if (flag == 0) {
+ deg_graph_node_tag_zero(bmain, graph, id_node, update_source);
+ }
+ id->recalc |= flag;
+ int current_flag = flag;
+ while (current_flag != 0) {
+ IDRecalcFlag tag =
+ (IDRecalcFlag)(1 << bitscan_forward_clear_i(&current_flag));
+ graph_id_tag_update_single_flag(
+ bmain, graph, id, id_node, tag, update_source);
+ }
+ /* Special case for nested node tree datablocks. */
+ id_tag_update_ntree_special(bmain, graph, id, flag, update_source);
+ /* Direct update tags means that something outside of simulated/cached
+ * physics did change and that cache is to be invalidated. */
+ if (update_source == DEG_UPDATE_SOURCE_USER_EDIT) {
+ graph_id_tag_update_single_flag(
+ bmain, graph, id, id_node, ID_RECALC_POINT_CACHE, update_source);
+ }
}
} // namespace DEG
@@ -629,7 +668,8 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, int flag)
/* Ideally should not happen, but old depsgraph allowed this. */
return;
}
- DEG::deg_id_tag_update(bmain, id, flag);
+ DEG::id_tag_update(
+ bmain, id, flag, DEG::DEG_UPDATE_SOURCE_USER_EDIT);
}
void DEG_graph_id_tag_update(struct Main *bmain,
@@ -638,34 +678,37 @@ void DEG_graph_id_tag_update(struct Main *bmain,
int flag)
{
DEG::Depsgraph *graph = (DEG::Depsgraph *)depsgraph;
- DEG::deg_graph_id_tag_update(bmain, graph, id, flag);
+ DEG::graph_id_tag_update(
+ bmain, graph, id, flag, DEG::DEG_UPDATE_SOURCE_USER_EDIT);
}
/* Mark a particular datablock type as having changing. */
-void DEG_id_type_tag(Main *bmain, short id_type)
+void DEG_graph_id_type_tag(Depsgraph *depsgraph, short id_type)
{
if (id_type == ID_NT) {
/* Stupid workaround so parent datablocks of nested nodetree get looped
- * over when we loop over tagged datablock types.
- */
- DEG_id_type_tag(bmain, ID_MA);
- DEG_id_type_tag(bmain, ID_TE);
- DEG_id_type_tag(bmain, ID_LA);
- DEG_id_type_tag(bmain, ID_WO);
- DEG_id_type_tag(bmain, ID_SCE);
- }
-
- int id_type_index = BKE_idcode_to_index(id_type);
+ * over when we loop over tagged datablock types. */
+ DEG_graph_id_type_tag(depsgraph, ID_MA);
+ DEG_graph_id_type_tag(depsgraph, ID_TE);
+ DEG_graph_id_type_tag(depsgraph, ID_LA);
+ DEG_graph_id_type_tag(depsgraph, ID_WO);
+ DEG_graph_id_type_tag(depsgraph, ID_SCE);
+ }
+ const int id_type_index = BKE_idcode_to_index(id_type);
+ DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
+ deg_graph->id_type_updated[id_type_index] = 1;
+}
- LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
+void DEG_id_type_tag(Main *bmain, short id_type)
+{
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
Depsgraph *depsgraph =
(Depsgraph *)BKE_scene_get_depsgraph(scene,
view_layer,
false);
if (depsgraph != NULL) {
- DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
- deg_graph->id_type_updated[id_type_index] = 1;
+ DEG_graph_id_type_tag(depsgraph, id_type);
}
}
}
@@ -688,7 +731,7 @@ void DEG_graph_on_visible_update(Main *bmain, Depsgraph *depsgraph)
void DEG_on_visible_update(Main *bmain, const bool UNUSED(do_time))
{
- LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
Depsgraph *depsgraph =
(Depsgraph *)BKE_scene_get_depsgraph(scene,
@@ -702,8 +745,7 @@ void DEG_on_visible_update(Main *bmain, const bool UNUSED(do_time))
}
/* Check if something was changed in the database and inform
- * editors about this.
- */
+ * editors about this. */
void DEG_ids_check_recalc(Main *bmain,
Depsgraph *depsgraph,
Scene *scene,
@@ -729,7 +771,7 @@ static void deg_graph_clear_id_node_func(
* correctly when there are multiple depsgraph with others still using
* the recalc flag. */
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(data_v);
- DEG::IDDepsNode *id_node = deg_graph->id_nodes[i];
+ DEG::IDNode *id_node = deg_graph->id_nodes[i];
id_node->id_cow->recalc &= ~ID_RECALC_ALL;
id_node->id_orig->recalc &= ~ID_RECALC_ALL;
@@ -748,15 +790,11 @@ void DEG_ids_clear_recalc(Main *UNUSED(bmain),
Depsgraph *depsgraph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
-
/* TODO(sergey): Re-implement POST_UPDATE_HANDLER_WORKAROUND using entry_tags
- * and id_tags storage from the new dependency graph.
- */
-
+ * and id_tags storage from the new dependency graph. */
if (!DEG_id_type_any_updated(depsgraph)) {
return;
}
-
/* Go over all ID nodes nodes, clearing tags. */
const int num_id_nodes = deg_graph->id_nodes.size();
ParallelRangeSettings settings;
@@ -766,6 +804,5 @@ void DEG_ids_clear_recalc(Main *UNUSED(bmain),
deg_graph,
deg_graph_clear_id_node_func,
&settings);
-
memset(deg_graph->id_type_updated, 0, sizeof(deg_graph->id_type_updated));
}
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.h b/source/blender/depsgraph/intern/depsgraph_tag.h
new file mode 100644
index 00000000000..e4d1158aa3c
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_tag.h
@@ -0,0 +1,46 @@
+/*
+ * 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) 2019 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#include "intern/node/deg_node.h"
+
+struct ID;
+struct Main;
+
+namespace DEG {
+
+struct Depsgraph;
+
+/* Get type of a node which corresponds to a ID_RECALC_GEOMETRY tag. */
+NodeType geometry_tag_to_component(const ID *id);
+
+/* Tag given ID for an update in all registered dependency graphs. */
+void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source);
+
+/* Tag given ID for an update with in a given dependency graph. */
+void graph_id_tag_update(Main *bmain,
+ Depsgraph *graph,
+ ID *id,
+ int flag,
+ eUpdateSource update_source);
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_type.cc b/source/blender/depsgraph/intern/depsgraph_type.cc
new file mode 100644
index 00000000000..5be2cae10d7
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_type.cc
@@ -0,0 +1,63 @@
+/*
+ * 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) 2013 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ *
+ * Defines and code for core node types.
+ */
+
+#include <cstdlib> // for BLI_assert()
+
+
+#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
+
+#include "DNA_customdata_types.h"
+
+#include "DEG_depsgraph.h"
+
+#include "intern/depsgraph_type.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_operation.h"
+
+/* Register all node types */
+void DEG_register_node_types(void)
+{
+ /* register node types */
+ DEG::deg_register_base_depsnodes();
+ DEG::deg_register_component_depsnodes();
+ DEG::deg_register_operation_depsnodes();
+}
+
+/* Free registry on exit */
+void DEG_free_node_types(void)
+{
+}
+
+DEG::DEGCustomDataMeshMasks::DEGCustomDataMeshMasks(const CustomData_MeshMasks *other) :
+ vert_mask(other->vmask),
+ edge_mask(other->emask),
+ face_mask(other->fmask),
+ loop_mask(other->lmask),
+ poly_mask(other->pmask)
+{
+}
diff --git a/source/blender/depsgraph/intern/depsgraph_type.h b/source/blender/depsgraph/intern/depsgraph_type.h
new file mode 100644
index 00000000000..d34b6d724cb
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_type.h
@@ -0,0 +1,165 @@
+/*
+ * 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) 2013 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ *
+ * Datatypes for internal use in the Depsgraph
+ *
+ * All of these datatypes are only really used within the "core" depsgraph.
+ * In particular, node types declared here form the structure of operations
+ * in the graph.
+ */
+
+#pragma once
+
+#include <functional>
+
+/* TODO(sergey): Ideally we'll just use char* and statically allocated strings
+ * to avoid any possible overhead caused by string (re)allocation/formatting. */
+#include <string>
+#include <vector>
+#include <algorithm>
+
+struct Depsgraph;
+
+struct CustomData_MeshMasks;
+
+namespace DEG {
+
+/* Commonly used types. */
+using std::string;
+using std::vector;
+
+/* Commonly used functions. */
+using std::max;
+using std::to_string;
+
+/* Function bindings. */
+using std::function;
+using namespace std::placeholders;
+#define function_bind std::bind
+
+/* Source of the dependency graph node update tag.
+ *
+ * NOTE: This is a bit mask, so accumulation of sources is possible.
+ *
+ * TODO(sergey): Find a better place for this. */
+enum eUpdateSource {
+ /* Update is caused by a time change. */
+ DEG_UPDATE_SOURCE_TIME = (1 << 0),
+ /* Update caused by user directly or indirectly influencing the node. */
+ DEG_UPDATE_SOURCE_USER_EDIT = (1 << 1),
+ /* Update is happening as a special response for the relations update. */
+ DEG_UPDATE_SOURCE_RELATIONS = (1 << 2),
+ /* Update is happening due to visibility change. */
+ DEG_UPDATE_SOURCE_VISIBILITY = (1 << 3),
+};
+
+/* C++ wrapper around DNA's CustomData_MeshMasks struct. */
+struct DEGCustomDataMeshMasks {
+ uint64_t vert_mask;
+ uint64_t edge_mask;
+ uint64_t face_mask;
+ uint64_t loop_mask;
+ uint64_t poly_mask;
+
+ DEGCustomDataMeshMasks()
+ : vert_mask(0),
+ edge_mask(0),
+ face_mask(0),
+ loop_mask(0),
+ poly_mask(0)
+ {
+ }
+
+ explicit DEGCustomDataMeshMasks(const CustomData_MeshMasks *other);
+
+ DEGCustomDataMeshMasks& operator|=(const DEGCustomDataMeshMasks& other)
+ {
+ this->vert_mask |= other.vert_mask;
+ this->edge_mask |= other.edge_mask;
+ this->face_mask |= other.face_mask;
+ this->loop_mask |= other.loop_mask;
+ this->poly_mask |= other.poly_mask;
+ return *this;
+ }
+
+ DEGCustomDataMeshMasks operator|(const DEGCustomDataMeshMasks& other) const
+ {
+ DEGCustomDataMeshMasks result;
+ result.vert_mask = this->vert_mask | other.vert_mask;
+ result.edge_mask = this->edge_mask | other.edge_mask;
+ result.face_mask = this->face_mask | other.face_mask;
+ result.loop_mask = this->loop_mask | other.loop_mask;
+ result.poly_mask = this->poly_mask | other.poly_mask;
+ return result;
+ }
+
+ bool operator==(const DEGCustomDataMeshMasks& other) const
+ {
+ return (this->vert_mask == other.vert_mask &&
+ this->edge_mask == other.edge_mask &&
+ this->face_mask == other.face_mask &&
+ this->loop_mask == other.loop_mask &&
+ this->poly_mask == other.poly_mask);
+ }
+
+ bool operator!=(const DEGCustomDataMeshMasks& other) const
+ {
+ return !(*this == other);
+ }
+
+ static DEGCustomDataMeshMasks MaskVert(const uint64_t vert_mask)
+ {
+ DEGCustomDataMeshMasks result;
+ result.vert_mask = vert_mask;
+ return result;
+ }
+
+ static DEGCustomDataMeshMasks MaskEdge(const uint64_t edge_mask)
+ {
+ DEGCustomDataMeshMasks result;
+ result.edge_mask = edge_mask;
+ return result;
+ }
+
+ static DEGCustomDataMeshMasks MaskFace(const uint64_t face_mask)
+ {
+ DEGCustomDataMeshMasks result;
+ result.face_mask = face_mask;
+ return result;
+ }
+
+ static DEGCustomDataMeshMasks MaskLoop(const uint64_t loop_mask)
+ {
+ DEGCustomDataMeshMasks result;
+ result.loop_mask = loop_mask;
+ return result;
+ }
+
+ static DEGCustomDataMeshMasks MaskPoly(const uint64_t poly_mask)
+ {
+ DEGCustomDataMeshMasks result;
+ result.poly_mask = poly_mask;
+ return result;
+ }
+};
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
deleted file mode 100644
index a89446ea28f..00000000000
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ /dev/null
@@ -1,217 +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) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/depsgraph_type_defines.cc
- * \ingroup depsgraph
- *
- * Defines and code for core node types.
- */
-
-#include <cstdlib> // for BLI_assert()
-
-
-#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
-
-#include "DEG_depsgraph.h"
-
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-
-#include "intern/depsgraph_intern.h"
-
-namespace DEG {
-
-/* ************ */
-/* External API */
-
-/* Global type registry */
-
-static DepsNodeFactory *depsnode_typeinfo_registry[NUM_DEG_NODE_TYPES] = {NULL};
-
-/* Registration ------------------------------------------- */
-
-/* Register node type */
-void deg_register_node_typeinfo(DepsNodeFactory *factory)
-{
- BLI_assert(factory != NULL);
- depsnode_typeinfo_registry[factory->type()] = factory;
-}
-
-/* Getters ------------------------------------------------- */
-
-/* Get typeinfo for specified type */
-DepsNodeFactory *deg_type_get_factory(const eDepsNode_Type type)
-{
- /* look up type - at worst, it doesn't exist in table yet, and we fail */
- return depsnode_typeinfo_registry[type];
-}
-
-/* Stringified node types ---------------------------------- */
-
-const char *nodeTypeAsString(eDepsNode_Type type)
-{
- switch (type) {
-#define STRINGIFY_TYPE(name) case DEG_NODE_TYPE_##name: return #name
-
- STRINGIFY_TYPE(UNDEFINED);
- STRINGIFY_TYPE(OPERATION);
- /* **** Generic Types **** */
- STRINGIFY_TYPE(TIMESOURCE);
- STRINGIFY_TYPE(ID_REF);
- /* **** Outer Types **** */
- STRINGIFY_TYPE(PARAMETERS);
- STRINGIFY_TYPE(PROXY);
- STRINGIFY_TYPE(ANIMATION);
- STRINGIFY_TYPE(TRANSFORM);
- STRINGIFY_TYPE(GEOMETRY);
- STRINGIFY_TYPE(SEQUENCER);
- STRINGIFY_TYPE(LAYER_COLLECTIONS);
- STRINGIFY_TYPE(COPY_ON_WRITE);
- STRINGIFY_TYPE(OBJECT_FROM_LAYER);
- /* **** Evaluation-Related Outer Types (with Subdata) **** */
- STRINGIFY_TYPE(EVAL_POSE);
- STRINGIFY_TYPE(BONE);
- STRINGIFY_TYPE(PARTICLE_SYSTEM);
- STRINGIFY_TYPE(PARTICLE_SETTINGS);
- STRINGIFY_TYPE(SHADING);
- STRINGIFY_TYPE(SHADING_PARAMETERS);
- STRINGIFY_TYPE(CACHE);
- STRINGIFY_TYPE(POINT_CACHE);
- STRINGIFY_TYPE(BATCH_CACHE);
- /* Duplication. */
- STRINGIFY_TYPE(DUPLI);
- /* Synchronization. */
- STRINGIFY_TYPE(SYNCHRONIZE);
- /* Generic datablock. */
- STRINGIFY_TYPE(GENERIC_DATABLOCK);
-
- /* Total number of meaningful node types. */
- case NUM_DEG_NODE_TYPES: return "SpecialCase";
-#undef STRINGIFY_TYPE
- }
- return "UNKNOWN";
-}
-
-/* Stringified opcodes ------------------------------------- */
-
-const char *operationCodeAsString(eDepsOperation_Code opcode)
-{
- switch (opcode) {
-#define STRINGIFY_OPCODE(name) case DEG_OPCODE_##name: return #name
- /* Generic Operations. */
- STRINGIFY_OPCODE(OPERATION);
- STRINGIFY_OPCODE(ID_PROPERTY);
- STRINGIFY_OPCODE(PARAMETERS_EVAL);
- STRINGIFY_OPCODE(PLACEHOLDER);
- /* Animation, Drivers, etc. */
- STRINGIFY_OPCODE(ANIMATION);
- STRINGIFY_OPCODE(DRIVER);
- /* Object related. */
- STRINGIFY_OPCODE(OBJECT_BASE_FLAGS);
- /* Transform. */
- STRINGIFY_OPCODE(TRANSFORM_LOCAL);
- STRINGIFY_OPCODE(TRANSFORM_PARENT);
- STRINGIFY_OPCODE(TRANSFORM_CONSTRAINTS);
- STRINGIFY_OPCODE(TRANSFORM_FINAL);
- STRINGIFY_OPCODE(TRANSFORM_OBJECT_UBEREVAL);
- /* Rigid body. */
- STRINGIFY_OPCODE(RIGIDBODY_REBUILD);
- STRINGIFY_OPCODE(RIGIDBODY_SIM);
- STRINGIFY_OPCODE(RIGIDBODY_TRANSFORM_COPY);
- /* Geometry. */
- STRINGIFY_OPCODE(GEOMETRY_UBEREVAL);
- STRINGIFY_OPCODE(GEOMETRY_SHAPEKEY);
- /* Object data. */
- STRINGIFY_OPCODE(LIGHT_PROBE_EVAL);
- STRINGIFY_OPCODE(SPEAKER_EVAL);
- /* Pose. */
- STRINGIFY_OPCODE(POSE_INIT);
- STRINGIFY_OPCODE(POSE_INIT_IK);
- STRINGIFY_OPCODE(POSE_CLEANUP);
- STRINGIFY_OPCODE(POSE_DONE);
- STRINGIFY_OPCODE(POSE_IK_SOLVER);
- STRINGIFY_OPCODE(POSE_SPLINE_IK_SOLVER);
- /* Bone. */
- STRINGIFY_OPCODE(BONE_LOCAL);
- STRINGIFY_OPCODE(BONE_POSE_PARENT);
- STRINGIFY_OPCODE(BONE_CONSTRAINTS);
- STRINGIFY_OPCODE(BONE_READY);
- STRINGIFY_OPCODE(BONE_DONE);
- STRINGIFY_OPCODE(BONE_SEGMENTS);
- /* Particle System. */
- STRINGIFY_OPCODE(PARTICLE_SYSTEM_INIT);
- STRINGIFY_OPCODE(PARTICLE_SYSTEM_EVAL);
- STRINGIFY_OPCODE(PARTICLE_SYSTEM_DONE);
- /* Particles Settings. */
- STRINGIFY_OPCODE(PARTICLE_SETTINGS_INIT);
- STRINGIFY_OPCODE(PARTICLE_SETTINGS_EVAL);
- STRINGIFY_OPCODE(PARTICLE_SETTINGS_RESET);
- /* Point Cache. */
- STRINGIFY_OPCODE(POINT_CACHE_RESET);
- /* Batch cache. */
- STRINGIFY_OPCODE(GEOMETRY_SELECT_UPDATE);
- /* Masks. */
- STRINGIFY_OPCODE(MASK_ANIMATION);
- STRINGIFY_OPCODE(MASK_EVAL);
- /* Collections. */
- STRINGIFY_OPCODE(VIEW_LAYER_EVAL);
- /* Copy on write. */
- STRINGIFY_OPCODE(COPY_ON_WRITE);
- /* Shading. */
- STRINGIFY_OPCODE(SHADING);
- STRINGIFY_OPCODE(MATERIAL_UPDATE);
- STRINGIFY_OPCODE(WORLD_UPDATE);
- /* Movie clip. */
- STRINGIFY_OPCODE(MOVIECLIP_EVAL);
- STRINGIFY_OPCODE(MOVIECLIP_SELECT_UPDATE);
- /* Synchronization. */
- STRINGIFY_OPCODE(SYNCHRONIZE_TO_ORIGINAL);
- /* Generic datablock. */
- STRINGIFY_OPCODE(GENERIC_DATABLOCK_UPDATE);
-
- case DEG_NUM_OPCODES: return "SpecialCase";
-#undef STRINGIFY_OPCODE
- }
- return "UNKNOWN";
-}
-
-} // namespace DEG
-
-/* Register all node types */
-void DEG_register_node_types(void)
-{
- /* register node types */
- DEG::deg_register_base_depsnodes();
- DEG::deg_register_component_depsnodes();
- DEG::deg_register_operation_depsnodes();
-}
-
-/* Free registry on exit */
-void DEG_free_node_types(void)
-{
-}
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
deleted file mode 100644
index 5d51e367394..00000000000
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ /dev/null
@@ -1,325 +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) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/depsgraph_types.h
- * \ingroup depsgraph
- *
- * Datatypes for internal use in the Depsgraph
- *
- * All of these datatypes are only really used within the "core" depsgraph.
- * In particular, node types declared here form the structure of operations
- * in the graph.
- */
-
-#pragma once
-
-#include "util/deg_util_function.h"
-
-/* TODO(sergey): Ideally we'll just use char* and statically allocated strings
- * to avoid any possible overhead caused by string (re)allocation/formatting.
- */
-#include <string>
-#include <vector>
-#include <algorithm>
-
-struct bAction;
-struct ChannelDriver;
-struct ModifierData;
-struct PointerRNA;
-struct FCurve;
-struct Depsgraph;
-
-namespace DEG {
-
-/* TODO(sergey): Find a better place for this. */
-using std::string;
-using std::vector;
-using std::max;
-
-/* Evaluation Operation for atomic operation */
-// XXX: move this to another header that can be exposed?
-typedef function<void(struct ::Depsgraph *)> DepsEvalOperationCb;
-
-/* Metatype of Nodes - The general "level" in the graph structure
- * the node serves.
- */
-typedef enum eDepsNode_Class {
- /* Types generally unassociated with user-visible entities,
- * but needed for graph functioning.
- */
- DEG_NODE_CLASS_GENERIC = 0,
- /* [Outer Node] An "aspect" of evaluating/updating an ID-Block, requiring
- * certain types of evaluation behavior.
- */
- DEG_NODE_CLASS_COMPONENT = 1,
- /* [Inner Node] A glorified function-pointer/callback for scheduling up
- * evaluation operations for components, subject to relationship
- * requirements.
- */
- DEG_NODE_CLASS_OPERATION = 2,
-} eDepsNode_Class;
-
-/* Note: We use max comparison to mark an id node that is linked more than once
- * So keep this enum ordered accordingly.
- */
-typedef enum eDepsNode_LinkedState_Type {
- /* Generic indirectly linked id node. */
- DEG_ID_LINKED_INDIRECTLY = 0,
- /* Id node present in the set (background) only. */
- DEG_ID_LINKED_VIA_SET = 1,
- /* Id node directly linked via the ScenLayer. */
- DEG_ID_LINKED_DIRECTLY = 2,
-} eDepsNode_LinkedState_Type;
-
-/* Types of Nodes */
-typedef enum eDepsNode_Type {
- /* Fallback type for invalid return value */
- DEG_NODE_TYPE_UNDEFINED = 0,
- /* Inner Node (Operation) */
- DEG_NODE_TYPE_OPERATION,
-
- /* **** Generic Types **** */
-
- /* Time-Source */
- DEG_NODE_TYPE_TIMESOURCE,
- /* ID-Block reference - used as landmarks/collection point for components,
- * but not usually part of main graph.
- */
- DEG_NODE_TYPE_ID_REF,
-
- /* **** Outer Types **** */
-
- /* Parameters Component - Default when nothing else fits
- * (i.e. just SDNA property setting).
- */
- DEG_NODE_TYPE_PARAMETERS,
- /* Generic "Proxy-Inherit" Component. */
- DEG_NODE_TYPE_PROXY,
- /* Animation Component */
- DEG_NODE_TYPE_ANIMATION,
- /* Transform Component (Parenting/Constraints) */
- DEG_NODE_TYPE_TRANSFORM,
- /* Geometry Component (Mesh/Displist) */
- DEG_NODE_TYPE_GEOMETRY,
- /* Sequencer Component (Scene Only) */
- DEG_NODE_TYPE_SEQUENCER,
- /* Component which contains all operations needed for layer collections
- * evaluation.
- */
- DEG_NODE_TYPE_LAYER_COLLECTIONS,
- /* Entry component of majority of ID nodes: prepares CoW pointers for
- * execution.
- */
- DEG_NODE_TYPE_COPY_ON_WRITE,
- /* Used by all operations which are updating object when something is
- * changed in view layer.
- */
- DEG_NODE_TYPE_OBJECT_FROM_LAYER,
- /* Un-interestying datablock, which is a part of dependency graph, but does
- * not have very distinctive update procedure. */
- DEG_NODE_TYPE_GENERIC_DATABLOCK,
-
- /* **** Evaluation-Related Outer Types (with Subdata) **** */
-
- /* Pose Component - Owner/Container of Bones Eval */
- DEG_NODE_TYPE_EVAL_POSE,
- /* Bone Component - Child/Subcomponent of Pose */
- DEG_NODE_TYPE_BONE,
- /* Particle Systems Component */
- DEG_NODE_TYPE_PARTICLE_SYSTEM,
- DEG_NODE_TYPE_PARTICLE_SETTINGS,
- /* Material Shading Component */
- DEG_NODE_TYPE_SHADING,
- DEG_NODE_TYPE_SHADING_PARAMETERS,
- /* Point cache Component */
- DEG_NODE_TYPE_POINT_CACHE,
- /* Cache Component */
- /* TODO(sergey); Verify that we really need this. */
- DEG_NODE_TYPE_CACHE,
- /* Batch Cache Component - TODO (dfelinto/sergey) rename to make it more generic. */
- DEG_NODE_TYPE_BATCH_CACHE,
- /* Duplication system. Used to force duplicated objects visible when
- * when duplicator is visible.
- */
- DEG_NODE_TYPE_DUPLI,
- /* Synchronization back to original datablock. */
- DEG_NODE_TYPE_SYNCHRONIZE,
-
- /* Total number of meaningful node types. */
- NUM_DEG_NODE_TYPES,
-} eDepsNode_Type;
-const char *nodeTypeAsString(eDepsNode_Type type);
-
-/* Identifiers for common operations (as an enum). */
-typedef enum eDepsOperation_Code {
- /* Generic Operations. -------------------------------------------------- */
-
- /* Placeholder for operations which don't need special mention */
- DEG_OPCODE_OPERATION = 0,
-
- /* Generic parameters evaluation. */
- DEG_OPCODE_ID_PROPERTY,
- DEG_OPCODE_PARAMETERS_EVAL,
-
- // XXX: Placeholder while porting depsgraph code
- DEG_OPCODE_PLACEHOLDER,
-
- /* Animation, Drivers, etc. --------------------------------------------- */
- /* NLA + Action */
- DEG_OPCODE_ANIMATION,
- /* Driver */
- DEG_OPCODE_DRIVER,
-
- /* Object related. ------------------------------------------------------ */
- DEG_OPCODE_OBJECT_BASE_FLAGS,
-
- /* Transform. ----------------------------------------------------------- */
- /* Transform entry point - local transforms only */
- DEG_OPCODE_TRANSFORM_LOCAL,
- /* Parenting */
- DEG_OPCODE_TRANSFORM_PARENT,
- /* Constraints */
- DEG_OPCODE_TRANSFORM_CONSTRAINTS,
- /* Transform exit point */
- DEG_OPCODE_TRANSFORM_FINAL,
- /* Handle object-level updates, mainly proxies hacks and recalc flags. */
- DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL,
-
- /* Rigid body. ---------------------------------------------------------- */
- /* Perform Simulation */
- DEG_OPCODE_RIGIDBODY_REBUILD,
- DEG_OPCODE_RIGIDBODY_SIM,
- /* Copy results to object */
- DEG_OPCODE_RIGIDBODY_TRANSFORM_COPY,
-
- /* Geometry. ------------------------------------------------------------ */
-
- /* Evaluate the whole geometry, including modifiers. */
- DEG_OPCODE_GEOMETRY_UBEREVAL,
- /* Evaluation of a shape key. */
- DEG_OPCODE_GEOMETRY_SHAPEKEY,
-
- /* Object data. --------------------------------------------------------- */
- DEG_OPCODE_LIGHT_PROBE_EVAL,
- DEG_OPCODE_SPEAKER_EVAL,
-
- /* Pose. ---------------------------------------------------------------- */
- /* Init pose, clear flags, etc. */
- DEG_OPCODE_POSE_INIT,
- /* Initialize IK solver related pose stuff. */
- DEG_OPCODE_POSE_INIT_IK,
- /* Pose is evaluated, and runtime data can be freed. */
- DEG_OPCODE_POSE_CLEANUP,
- /* Pose has been fully evaluated and ready to be used by others. */
- DEG_OPCODE_POSE_DONE,
- /* IK/Spline Solvers */
- DEG_OPCODE_POSE_IK_SOLVER,
- DEG_OPCODE_POSE_SPLINE_IK_SOLVER,
-
- /* Bone. ---------------------------------------------------------------- */
- /* Bone local transforms - entry point */
- DEG_OPCODE_BONE_LOCAL,
- /* Pose-space conversion (includes parent + restpose, */
- DEG_OPCODE_BONE_POSE_PARENT,
- /* Constraints */
- DEG_OPCODE_BONE_CONSTRAINTS,
- /* Bone transforms are ready
- *
- * - "READY" This (internal, noop is used to signal that all pre-IK
- * operations are done. Its role is to help mediate situations
- * where cyclic relations may otherwise form (i.e. one bone in
- * chain targeting another in same chain,
- *
- * - "DONE" This noop is used to signal that the bone's final pose
- * transform can be read by others
- */
- // TODO: deform mats could get calculated in the final_transform ops...
- DEG_OPCODE_BONE_READY,
- DEG_OPCODE_BONE_DONE,
- /* B-Bone segment shape computation (after DONE) */
- DEG_OPCODE_BONE_SEGMENTS,
-
- /* Particle System. ----------------------------------------------------- */
- DEG_OPCODE_PARTICLE_SYSTEM_INIT,
- DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
- DEG_OPCODE_PARTICLE_SYSTEM_DONE,
-
- /* Particle Settings. --------------------------------------------------- */
- DEG_OPCODE_PARTICLE_SETTINGS_INIT,
- DEG_OPCODE_PARTICLE_SETTINGS_EVAL,
- DEG_OPCODE_PARTICLE_SETTINGS_RESET,
-
- /* Point Cache. --------------------------------------------------------- */
- DEG_OPCODE_POINT_CACHE_RESET,
-
- /* Collections. --------------------------------------------------------- */
- DEG_OPCODE_VIEW_LAYER_EVAL,
-
- /* Copy on Write. ------------------------------------------------------- */
- DEG_OPCODE_COPY_ON_WRITE,
-
- /* Shading. ------------------------------------------------------------- */
- DEG_OPCODE_SHADING,
- DEG_OPCODE_MATERIAL_UPDATE,
- DEG_OPCODE_WORLD_UPDATE,
-
- /* Batch caches. -------------------------------------------------------- */
- DEG_OPCODE_GEOMETRY_SELECT_UPDATE,
-
- /* Masks. --------------------------------------------------------------- */
- DEG_OPCODE_MASK_ANIMATION,
- DEG_OPCODE_MASK_EVAL,
-
- /* Movie clips. --------------------------------------------------------- */
- DEG_OPCODE_MOVIECLIP_EVAL,
- DEG_OPCODE_MOVIECLIP_SELECT_UPDATE,
-
- /* Synchronization clips. ----------------------------------------------- */
- DEG_OPCODE_SYNCHRONIZE_TO_ORIGINAL,
-
- /* Generic datablock ---------------------------------------------------- */
- DEG_OPCODE_GENERIC_DATABLOCK_UPDATE,
-
- DEG_NUM_OPCODES,
-} eDepsOperation_Code;
-const char *operationCodeAsString(eDepsOperation_Code opcode);
-
-/* Source of the dependency graph node update tag.
- *
- * NOTE: This is a bit mask, so accumulation of sources is possible.
- */
-typedef enum eDepsTag_Source {
- /* Update is caused by a time change. */
- DEG_UPDATE_SOURCE_TIME = (1 << 0),
- /* Update caused by user directly or indirectly influencing the node. */
- DEG_UPDATE_SOURCE_USER_EDIT = (1 << 1),
- /* Update is happening as a special response for the relations update. */
- DEG_UPDATE_SOURCE_RELATIONS = (1 << 2),
- /* Update is happening due to visibility change. */
- DEG_UPDATE_SOURCE_VISIBILITY = (1 << 3),
-} eDepsTag_Source;
-
-} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_update.cc b/source/blender/depsgraph/intern/depsgraph_update.cc
new file mode 100644
index 00000000000..1e09b012c01
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_update.cc
@@ -0,0 +1,58 @@
+/*
+ * 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) 2013 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#include "intern/depsgraph_update.h"
+
+#include "DEG_depsgraph.h"
+
+#include "intern/depsgraph_type.h"
+
+namespace DEG {
+
+static DEG_EditorUpdateIDCb deg_editor_update_id_cb = NULL;
+static DEG_EditorUpdateSceneCb deg_editor_update_scene_cb = NULL;
+
+void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx, ID *id)
+{
+ if (deg_editor_update_id_cb != NULL) {
+ deg_editor_update_id_cb(update_ctx, id);
+ }
+}
+
+void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
+ bool updated)
+{
+ if (deg_editor_update_scene_cb != NULL) {
+ deg_editor_update_scene_cb(update_ctx, updated);
+ }
+}
+
+} // namespace DEG
+
+/* Set callbacks which are being called when depsgraph changes. */
+void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
+ DEG_EditorUpdateSceneCb scene_func)
+{
+ DEG::deg_editor_update_id_cb = id_func;
+ DEG::deg_editor_update_scene_cb = scene_func;
+}
diff --git a/source/blender/depsgraph/util/deg_util_function.h b/source/blender/depsgraph/intern/depsgraph_update.h
index 0ec41412d7b..9f886e0dc25 100644
--- a/source/blender/depsgraph/util/deg_util_function.h
+++ b/source/blender/depsgraph/intern/depsgraph_update.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,27 +13,25 @@
* 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) 2014 Blender Foundation.
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Lukas Toenne
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/util/deg_util_function.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
-#include <functional>
+struct DEGEditorUpdateContext;
+struct ID;
namespace DEG {
-using std::function;
-using namespace std::placeholders;
-#define function_bind std::bind
+void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx,
+ struct ID *id);
+
+void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
+ bool updated);
-} // namespace
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index 02d286c3bd1..d3e52ecdf09 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/eval/deg_eval.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Evaluation engine entrypoints for Depsgraph Engine.
*/
@@ -34,10 +27,13 @@
#include "PIL_time.h"
+#include "BLI_compiler_attrs.h"
#include "BLI_utildefines.h"
#include "BLI_task.h"
#include "BLI_ghash.h"
+#include "BKE_global.h"
+
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -49,15 +45,12 @@
#include "intern/eval/deg_eval_copy_on_write.h"
#include "intern/eval/deg_eval_flush.h"
#include "intern/eval/deg_eval_stats.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/nodes/deg_node_time.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/node/deg_node_time.h"
#include "intern/depsgraph.h"
-#include "intern/depsgraph_intern.h"
-
-#include "util/deg_util_foreach.h"
namespace DEG {
@@ -67,7 +60,7 @@ namespace DEG {
/* Forward declarations. */
static void schedule_children(TaskPool *pool,
Depsgraph *graph,
- OperationDepsNode *node,
+ OperationNode *node,
const int thread_id);
struct DepsgraphEvalState {
@@ -82,7 +75,7 @@ static void deg_task_run_func(TaskPool *pool,
{
void *userdata_v = BLI_task_pool_userdata(pool);
DepsgraphEvalState *state = (DepsgraphEvalState *)userdata_v;
- OperationDepsNode *node = (OperationDepsNode *)taskdata;
+ OperationNode *node = (OperationNode *)taskdata;
/* Sanity checks. */
BLI_assert(!node->is_noop() && "NOOP nodes should not actually be scheduled");
/* Perform operation. */
@@ -104,13 +97,12 @@ typedef struct CalculatePendingData {
Depsgraph *graph;
} CalculatePendingData;
-static bool check_operation_node_visible(OperationDepsNode *op_node)
+static bool check_operation_node_visible(OperationNode *op_node)
{
- const ComponentDepsNode *comp_node = op_node->owner;
+ const ComponentNode *comp_node = op_node->owner;
/* Special exception, copy on write component is to be always evaluated,
- * to keep copied "database" in a consistent state.
- */
- if (comp_node->type == DEG_NODE_TYPE_COPY_ON_WRITE) {
+ * to keep copied "database" in a consistent state. */
+ if (comp_node->type == NodeType::COPY_ON_WRITE) {
return true;
}
return comp_node->affects_directly_visible;
@@ -123,7 +115,7 @@ static void calculate_pending_func(
{
CalculatePendingData *data = (CalculatePendingData *)data_v;
Depsgraph *graph = data->graph;
- OperationDepsNode *node = graph->operations[i];
+ OperationNode *node = graph->operations[i];
/* Update counters, applies for both visible and invisible IDs. */
node->num_links_pending = 0;
node->scheduled = false;
@@ -135,16 +127,15 @@ static void calculate_pending_func(
if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
return;
}
- foreach (DepsRelation *rel, node->inlinks) {
- if (rel->from->type == DEG_NODE_TYPE_OPERATION &&
- (rel->flag & DEPSREL_FLAG_CYCLIC) == 0)
+ for (Relation *rel : node->inlinks) {
+ if (rel->from->type == NodeType::OPERATION &&
+ (rel->flag & RELATION_FLAG_CYCLIC) == 0)
{
- OperationDepsNode *from = (OperationDepsNode *)rel->from;
+ OperationNode *from = (OperationNode *)rel->from;
/* TODO(sergey): This is how old layer system was checking for the
* calculation, but how is it possible that visible object depends
* on an invisible? This is something what is prohibited after
- * deg_graph_build_flush_layers().
- */
+ * deg_graph_build_flush_layers(). */
if (!check_operation_node_visible(from)) {
continue;
}
@@ -177,7 +168,7 @@ static void initialize_execution(DepsgraphEvalState *state, Depsgraph *graph)
const bool do_stats = state->do_stats;
calculate_pending_parents(graph);
/* Clear tags and other things which needs to be clear. */
- foreach (OperationDepsNode *node, graph->operations) {
+ for (OperationNode *node : graph->operations) {
if (do_stats) {
node->stats.reset_current();
}
@@ -189,7 +180,7 @@ static void initialize_execution(DepsgraphEvalState *state, Depsgraph *graph)
* scheduled after a task has been completed.
*/
static void schedule_node(TaskPool *pool, Depsgraph *graph,
- OperationDepsNode *node, bool dec_parents,
+ OperationNode *node, bool dec_parents,
const int thread_id)
{
/* No need to schedule nodes of invisible ID. */
@@ -197,33 +188,30 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph,
return;
}
/* No need to schedule operations which are not tagged for update, they are
- * considered to be up to date.
- */
+ * considered to be up to date. */
if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
return;
}
/* TODO(sergey): This is not strictly speaking safe to read
- * num_links_pending.
- */
+ * num_links_pending. */
if (dec_parents) {
BLI_assert(node->num_links_pending > 0);
atomic_sub_and_fetch_uint32(&node->num_links_pending, 1);
}
/* Cal not schedule operation while its dependencies are not yet
- * evaluated.
- */
+ * evaluated. */
if (node->num_links_pending != 0) {
return;
}
/* During the COW stage only schedule COW nodes. */
DepsgraphEvalState *state = (DepsgraphEvalState *)BLI_task_pool_userdata(pool);
if (state->is_cow_stage) {
- if (node->owner->type != DEG_NODE_TYPE_COPY_ON_WRITE) {
+ if (node->owner->type != NodeType::COPY_ON_WRITE) {
return;
}
}
else {
- BLI_assert(node->scheduled || node->owner->type != DEG_NODE_TYPE_COPY_ON_WRITE);
+ BLI_assert(node->scheduled || node->owner->type != NodeType::COPY_ON_WRITE);
}
/* Actually schedule the node. */
bool is_scheduled = atomic_fetch_and_or_uint8(
@@ -247,19 +235,19 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph,
static void schedule_graph(TaskPool *pool, Depsgraph *graph)
{
- foreach (OperationDepsNode *node, graph->operations) {
+ for (OperationNode *node : graph->operations) {
schedule_node(pool, graph, node, false, 0);
}
}
static void schedule_children(TaskPool *pool,
Depsgraph *graph,
- OperationDepsNode *node,
+ OperationNode *node,
const int thread_id)
{
- foreach (DepsRelation *rel, node->outlinks) {
- OperationDepsNode *child = (OperationDepsNode *)rel->to;
- BLI_assert(child->type == DEG_NODE_TYPE_OPERATION);
+ for (Relation *rel : node->outlinks) {
+ OperationNode *child = (OperationNode *)rel->to;
+ BLI_assert(child->type == NodeType::OPERATION);
if (child->scheduled) {
/* Happens when having cyclic dependencies. */
continue;
@@ -267,7 +255,7 @@ static void schedule_children(TaskPool *pool,
schedule_node(pool,
graph,
child,
- (rel->flag & DEPSREL_FLAG_CYCLIC) == 0,
+ (rel->flag & RELATION_FLAG_CYCLIC) == 0,
thread_id);
}
}
@@ -277,13 +265,12 @@ static void depsgraph_ensure_view_layer(Depsgraph *graph)
/* We update copy-on-write scene in the following cases:
* - It was not expanded yet.
* - It was tagged for update of CoW component.
- * This allows us to have proper view layer pointer.
- */
+ * This allows us to have proper view layer pointer. */
Scene *scene_cow = graph->scene_cow;
if (!deg_copy_on_write_is_expanded(&scene_cow->id) ||
scene_cow->id.recalc & ID_RECALC_COPY_ON_WRITE)
{
- const IDDepsNode *id_node = graph->find_id_node(&graph->scene->id);
+ const IDNode *id_node = graph->find_id_node(&graph->scene->id);
deg_update_copy_on_write_datablock(graph, id_node);
}
}
@@ -335,8 +322,7 @@ void deg_evaluate_on_refresh(Depsgraph *graph)
BLI_task_pool_free(task_pool);
/* Finalize statistics gathering. This is because we only gather single
* operation timing here, without aggregating anything to avoid any extra
- * synchronization.
- */
+ * synchronization. */
if (state.do_stats) {
deg_eval_stats_aggregate(graph);
}
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.h b/source/blender/depsgraph/intern/eval/deg_eval.h
index a8f5f7c145f..5baf13653ca 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/eval/deg_eval.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Evaluation engine entrypoints for Depsgraph Engine.
*/
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index aa028629093..27c5bb89ba9 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 20137Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
/* Enable special; trickery to treat nested owned IDs (such as nodetree of
@@ -66,6 +59,7 @@ extern "C" {
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_modifier_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
@@ -75,7 +69,7 @@ extern "C" {
#ifdef NESTED_ID_NASTY_WORKAROUND
# include "DNA_curve_types.h"
# include "DNA_key_types.h"
-# include "DNA_lamp_types.h"
+# include "DNA_light_types.h"
# include "DNA_lattice_types.h"
# include "DNA_linestyle_types.h"
# include "DNA_material_types.h"
@@ -94,9 +88,10 @@ extern "C" {
}
#include "intern/depsgraph.h"
+#include "intern/builder/deg_builder.h"
#include "intern/builder/deg_builder_nodes.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_id.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_id.h"
namespace DEG {
@@ -108,7 +103,7 @@ namespace {
union NestedIDHackTempStorage {
Curve curve;
FreestyleLineStyle linestyle;
- Lamp lamp;
+ Light lamp;
Lattice lattice;
Material material;
Mesh mesh;
@@ -129,7 +124,7 @@ void nested_id_hack_discard_pointers(ID *id_cow)
}
SPECIAL_CASE(ID_LS, FreestyleLineStyle, nodetree)
- SPECIAL_CASE(ID_LA, Lamp, nodetree)
+ SPECIAL_CASE(ID_LA, Light, nodetree)
SPECIAL_CASE(ID_MA, Material, nodetree)
SPECIAL_CASE(ID_TE, Tex, nodetree)
SPECIAL_CASE(ID_WO, World, nodetree)
@@ -153,7 +148,7 @@ void nested_id_hack_discard_pointers(ID *id_cow)
{
/* Clear the ParticleSettings pointer to prevent doubly-freeing it. */
Object *ob = (Object *)id_cow;
- LISTBASE_FOREACH(ParticleSystem *, psys, &ob->particlesystem) {
+ LISTBASE_FOREACH (ParticleSystem *, psys, &ob->particlesystem) {
psys->part = NULL;
}
break;
@@ -182,7 +177,7 @@ const ID *nested_id_hack_get_discarded_pointers(NestedIDHackTempStorage *storage
}
SPECIAL_CASE(ID_LS, FreestyleLineStyle, nodetree, linestyle)
- SPECIAL_CASE(ID_LA, Lamp, nodetree, lamp)
+ SPECIAL_CASE(ID_LA, Light, nodetree, lamp)
SPECIAL_CASE(ID_MA, Material, nodetree, material)
SPECIAL_CASE(ID_TE, Tex, nodetree, tex)
SPECIAL_CASE(ID_WO, World, nodetree, world)
@@ -223,7 +218,7 @@ void nested_id_hack_restore_pointers(const ID *old_id, ID *new_id)
}
SPECIAL_CASE(ID_LS, FreestyleLineStyle, nodetree)
- SPECIAL_CASE(ID_LA, Lamp, nodetree)
+ SPECIAL_CASE(ID_LA, Light, nodetree)
SPECIAL_CASE(ID_MA, Material, nodetree)
SPECIAL_CASE(ID_SCE, Scene, nodetree)
SPECIAL_CASE(ID_TE, Tex, nodetree)
@@ -261,7 +256,7 @@ void ntree_hack_remap_pointers(const Depsgraph *depsgraph, ID *id_cow)
}
SPECIAL_CASE(ID_LS, FreestyleLineStyle, nodetree, bNodeTree)
- SPECIAL_CASE(ID_LA, Lamp, nodetree, bNodeTree)
+ SPECIAL_CASE(ID_LA, Light, nodetree, bNodeTree)
SPECIAL_CASE(ID_MA, Material, nodetree, bNodeTree)
SPECIAL_CASE(ID_SCE, Scene, nodetree, bNodeTree)
SPECIAL_CASE(ID_TE, Tex, nodetree, bNodeTree)
@@ -282,7 +277,7 @@ struct ValidateData {
bool is_valid;
};
-/* Similar to generic id_copy() but does not require main and assumes pointer
+/* Similar to generic BKE_id_copy() but does not require main and assumes pointer
* is already allocated,
*/
bool id_copy_inplace_no_main(const ID *id, ID *newid)
@@ -297,12 +292,8 @@ bool id_copy_inplace_no_main(const ID *id, ID *newid)
bool result = BKE_id_copy_ex(NULL,
(ID *)id_for_copy,
&newid,
- (LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_ALLOCATE |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_CACHES),
- false);
+ (LIB_ID_COPY_LOCALIZE |
+ LIB_ID_CREATE_NO_ALLOCATE));
#ifdef NESTED_ID_NASTY_WORKAROUND
if (result) {
@@ -329,11 +320,8 @@ bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene)
bool result = BKE_id_copy_ex(NULL,
id_for_copy,
(ID **)&new_scene,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_ALLOCATE |
- LIB_ID_CREATE_NO_DEG_TAG,
- false);
+ LIB_ID_COPY_LOCALIZE |
+ LIB_ID_CREATE_NO_ALLOCATE);
#ifdef NESTED_ID_NASTY_WORKAROUND
if (result) {
@@ -344,11 +332,35 @@ bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene)
return result;
}
+/* For the given scene get view layer which corresponds to an original for the
+ * scene's evaluated one. This depends on how the scene is pulled into the
+ * dependency graph. */
+ViewLayer *get_original_view_layer(const Depsgraph *depsgraph,
+ const IDNode *id_node)
+{
+ if (id_node->linked_state == DEG_ID_LINKED_DIRECTLY) {
+ return depsgraph->view_layer;
+ }
+ else if (id_node->linked_state == DEG_ID_LINKED_VIA_SET) {
+ Scene *scene_orig = reinterpret_cast<Scene *>(id_node->id_orig);
+ return BKE_view_layer_default_render(scene_orig);
+ }
+ /* Is possible to have scene linked indirectly (i.e. via the driver) which
+ * we need to support. Currently there aer issues somewhere else, which
+ * makes testing hard. This is a reported problem, so will eventually be
+ * properly fixed.
+ *
+ * TODO(sergey): Support indirectly linked scene. */
+ return NULL;
+}
+
/* Remove all view layers but the one which corresponds to an input one. */
void scene_remove_unused_view_layers(const Depsgraph *depsgraph,
+ const IDNode *id_node,
Scene *scene_cow)
{
- ViewLayer *view_layer_input = depsgraph->view_layer;
+ const ViewLayer *view_layer_input = get_original_view_layer(
+ depsgraph, id_node);
ViewLayer *view_layer_eval = NULL;
/* Find evaluated view layer. At the same time we free memory used by
* all other of the view layers. */
@@ -373,23 +385,28 @@ void scene_remove_unused_view_layers(const Depsgraph *depsgraph,
scene_cow->view_layers.last = view_layer_eval;
}
-/* Makes it so given view layer only has bases corresponding to a visible
+/* Makes it so given view layer only has bases corresponding to enabled
* objects. */
-void view_layer_remove_invisible_bases(const Depsgraph *depsgraph,
- ViewLayer *view_layer)
+void view_layer_remove_disabled_bases(const Depsgraph *depsgraph,
+ ViewLayer *view_layer)
{
- const int base_visible_flag = (depsgraph->mode == DAG_EVAL_VIEWPORT) ?
- BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER;
- ListBase visible_bases = {NULL, NULL};
- for (Base *base = reinterpret_cast<Base *>(view_layer->object_bases.first),
- *base_next;
- base != NULL;
- base = base_next)
- {
- base_next = base->next;
- const bool is_object_visible = (base->flag & base_visible_flag);
- if (is_object_visible) {
- BLI_addtail(&visible_bases, base);
+ ListBase enabled_bases = {NULL, NULL};
+ LISTBASE_FOREACH_MUTABLE (Base *, base, &view_layer->object_bases) {
+ /* TODO(sergey): Would be cool to optimize this somehow, or make it so
+ * builder tags bases.
+ *
+ * NOTE: The idea of using id's tag and check whether its copied ot not
+ * is not reliable, since object might be indirectly linked into the
+ * graph.
+ *
+ * NOTE: We are using original base since the object which evaluated base
+ * points to is not yet copied. This is dangerous access from evaluated
+ * domain to original one, but this is how the entire copy-on-write works:
+ * it does need to access original for an initial copy. */
+ const bool is_object_enabled =
+ deg_check_base_available_for_build(depsgraph, base->base_orig);
+ if (is_object_enabled) {
+ BLI_addtail(&enabled_bases, base);
}
else {
if (base == view_layer->basact) {
@@ -398,15 +415,37 @@ void view_layer_remove_invisible_bases(const Depsgraph *depsgraph,
MEM_freeN(base);
}
}
- view_layer->object_bases = visible_bases;
+ view_layer->object_bases = enabled_bases;
}
-void scene_cleanup_view_layers(const Depsgraph *depsgraph, Scene *scene_cow)
+void view_layer_update_orig_base_pointers(const ViewLayer *view_layer_orig,
+ ViewLayer *view_layer_eval)
{
- scene_remove_unused_view_layers(depsgraph, scene_cow);
- view_layer_remove_invisible_bases(
- depsgraph,
- reinterpret_cast<ViewLayer *>(scene_cow->view_layers.first));
+ Base *base_orig =
+ reinterpret_cast<Base *>(view_layer_orig->object_bases.first);
+ LISTBASE_FOREACH (Base *, base_eval, &view_layer_eval->object_bases) {
+ base_eval->base_orig = base_orig;
+ base_orig = base_orig->next;
+ }
+}
+
+void scene_setup_view_layers_before_remap(const Depsgraph *depsgraph,
+ const IDNode *id_node,
+ Scene *scene_cow)
+{
+ scene_remove_unused_view_layers(depsgraph, id_node, scene_cow);
+}
+
+void scene_setup_view_layers_after_remap(const Depsgraph *depsgraph,
+ const IDNode *id_node,
+ Scene *scene_cow)
+{
+ const ViewLayer *view_layer_orig = get_original_view_layer(
+ depsgraph, id_node);
+ ViewLayer *view_layer_eval =
+ reinterpret_cast<ViewLayer *>(scene_cow->view_layers.first);
+ view_layer_update_orig_base_pointers(view_layer_orig, view_layer_eval);
+ view_layer_remove_disabled_bases(depsgraph, view_layer_eval);
/* TODO(sergey): Remove objects from collections as well.
* Not a HUGE deal for now, nobody is looking into those CURRENTLY.
* Still not an excuse to have those. */
@@ -446,8 +485,7 @@ struct RemapCallbackUserData {
/* Create placeholder for ID nodes for cases when we need to remap original
* ID to it[s CoW version but we don't have required ID node yet.
*
- * This happens when expansion happens a ta construction time.
- */
+ * This happens when expansion happens a ta construction time. */
DepsgraphNodeBuilder *node_builder;
bool create_placeholders;
};
@@ -472,12 +510,11 @@ int foreach_libblock_remap_callback(void *user_data_v,
*
* TODO(sergey): Ideally we need to tell ID looper to ignore
* those or at least make it more reliable check where the
- * pointer is coming from.
- */
+ * pointer is coming from. */
const ID_Type id_type = GS(id_orig->name);
const ID_Type id_type_self = GS(id_self->name);
if (id_type == ID_OB && id_type_self == ID_SCE) {
- IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
+ IDNode *id_node = depsgraph->find_id_node(id_orig);
if (id_node == NULL) {
id_cow = id_orig;
}
@@ -526,7 +563,7 @@ void update_mball_edit_mode_pointers(const Depsgraph * /*depsgraph*/,
}
void update_lattice_edit_mode_pointers(const Depsgraph * /*depsgraph*/,
- const ID *id_orig, ID *id_cow)
+ const ID *id_orig, ID *id_cow)
{
const Lattice *lt_orig = (const Lattice *)id_orig;
Lattice *lt_cow = (Lattice *)id_cow;
@@ -536,23 +573,22 @@ void update_lattice_edit_mode_pointers(const Depsgraph * /*depsgraph*/,
void update_mesh_edit_mode_pointers(const Depsgraph *depsgraph,
const ID *id_orig, ID *id_cow)
{
- /* For meshes we need to update edit_btmesh to make it to point
+ /* For meshes we need to update edit_mesh to make it to point
* to the CoW version of object.
*
* This is kind of confusing, because actual bmesh is not owned by
* the CoW object, so need to be accurate about using link from
- * edit_btmesh to object.
- */
+ * edit_mesh to object. */
const Mesh *mesh_orig = (const Mesh *)id_orig;
Mesh *mesh_cow = (Mesh *)id_cow;
- if (mesh_orig->edit_btmesh == NULL) {
+ if (mesh_orig->edit_mesh == NULL) {
return;
}
- mesh_cow->edit_btmesh = (BMEditMesh *)MEM_dupallocN(mesh_orig->edit_btmesh);
- mesh_cow->edit_btmesh->ob =
- (Object *)depsgraph->get_cow_id(&mesh_orig->edit_btmesh->ob->id);
- mesh_cow->edit_btmesh->mesh_eval_cage = NULL;
- mesh_cow->edit_btmesh->mesh_eval_final = NULL;
+ mesh_cow->edit_mesh = (BMEditMesh *)MEM_dupallocN(mesh_orig->edit_mesh);
+ mesh_cow->edit_mesh->ob =
+ (Object *)depsgraph->get_cow_id(&mesh_orig->edit_mesh->ob->id);
+ mesh_cow->edit_mesh->mesh_eval_cage = NULL;
+ mesh_cow->edit_mesh->mesh_eval_final = NULL;
}
/* Edit data is stored and owned by original datablocks, copied ones
@@ -597,6 +633,18 @@ void update_particle_system_orig_pointers(const Object *object_orig,
}
}
+void set_particle_system_modifiers_loaded(Object *object_cow)
+{
+ LISTBASE_FOREACH(ModifierData *, md, &object_cow->modifiers) {
+ if (md->type != eModifierType_ParticleSystem) {
+ continue;
+ }
+ ParticleSystemModifierData *psmd =
+ reinterpret_cast<ParticleSystemModifierData*>(md);
+ psmd->flag |= eParticleSystemFlag_file_loaded;
+ }
+}
+
void update_pose_orig_pointers(const bPose *pose_orig, bPose *pose_cow)
{
bPoseChannel *pchan_cow = (bPoseChannel *) pose_cow->chanbase.first;
@@ -613,16 +661,16 @@ void update_pose_orig_pointers(const bPose *pose_orig, bPose *pose_cow)
*
* Only use for the newly created CoW datablocks.
*/
-void update_special_pointers(const Depsgraph *depsgraph,
- const ID *id_orig, ID *id_cow)
+void update_id_after_copy(const Depsgraph *depsgraph,
+ const IDNode *id_node,
+ const ID *id_orig, ID *id_cow)
{
const ID_Type type = GS(id_orig->name);
switch (type) {
case ID_OB:
{
/* Ensure we don't drag someone's else derived mesh to the
- * new copy of the object.
- */
+ * new copy of the object. */
Object *object_cow = (Object *)id_cow;
const Object *object_orig = (const Object *)id_orig;
object_cow->mode = object_orig->mode;
@@ -640,6 +688,7 @@ void update_special_pointers(const Depsgraph *depsgraph,
}
}
update_particle_system_orig_pointers(object_orig, object_cow);
+ set_particle_system_modifiers_loaded(object_cow);
break;
}
case ID_SCE:
@@ -648,6 +697,8 @@ void update_special_pointers(const Depsgraph *depsgraph,
const Scene *scene_orig = (const Scene *)id_orig;
scene_cow->toolsettings = scene_orig->toolsettings;
scene_cow->eevee.light_cache = scene_orig->eevee.light_cache;
+ scene_setup_view_layers_after_remap(
+ depsgraph, id_node, reinterpret_cast<Scene *>(id_cow));
break;
}
default:
@@ -683,7 +734,7 @@ int foreach_libblock_validate_callback(void *user_data,
* NOTE: Expects that CoW datablock is empty.
*/
ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
- const IDDepsNode *id_node,
+ const IDNode *id_node,
DepsgraphNodeBuilder *node_builder,
bool create_placeholders)
{
@@ -691,8 +742,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
ID *id_cow = id_node->id_cow;
const int id_cow_recalc = id_cow->recalc;
/* No need to expand such datablocks, their copied ID is same as original
- * one already.
- */
+ * one already. */
if (!deg_copy_on_write_is_needed(id_orig)) {
return id_cow;
}
@@ -700,44 +750,42 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
id_orig->name, id_orig, id_cow);
/* Sanity checks. */
/* NOTE: Disabled for now, conflicts when re-using evaluated datablock when
- * rebuilding dependencies.
- */
+ * rebuilding dependencies. */
if (check_datablock_expanded(id_cow) && create_placeholders) {
deg_free_copy_on_write_datablock(id_cow);
}
// BLI_assert(check_datablock_expanded(id_cow) == false);
/* Copy data from original ID to a copied version. */
/* TODO(sergey): Avoid doing full ID copy somehow, make Mesh to reference
- * original geometry arrays for until those are modified.
- */
+ * original geometry arrays for until those are modified. */
/* TODO(sergey): We do some trickery with temp bmain and extra ID pointer
* just to be able to use existing API. Ideally we need to replace this with
* in-place copy from existing datablock to a prepared memory.
*
* NOTE: We don't use BKE_main_{new,free} because:
* - We don't want heap-allocations here.
- * - We don't want bmain's content to be freed when main is freed.
- */
+ * - We don't want bmain's content to be freed when main is freed. */
bool done = false;
- /* First we handle special cases which are not covered by id_copy() yet.
+ /* First we handle special cases which are not covered by BKE_id_copy() yet.
* or cases where we want to do something smarter than simple datablock
- * copy.
- */
+ * copy. */
const ID_Type id_type = GS(id_orig->name);
switch (id_type) {
case ID_SCE:
{
done = scene_copy_inplace_no_main((Scene *)id_orig, (Scene *)id_cow);
if (done) {
- scene_cleanup_view_layers(depsgraph, (Scene *)id_cow);
+ /* NOTE: This is important to do before remap, because this
+ * function will make it so less IDs are to be remapped. */
+ scene_setup_view_layers_before_remap(
+ depsgraph, id_node, (Scene *)id_cow);
}
break;
}
case ID_ME:
{
/* TODO(sergey): Ideally we want to handle meshes in a special
- * manner here to avoid initial copy of all the geometry arrays.
- */
+ * manner here to avoid initial copy of all the geometry arrays. */
break;
}
default:
@@ -757,8 +805,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
ntree_hack_remap_pointers(depsgraph, id_cow);
#endif
/* Do it now, so remapping will understand that possibly remapped self ID
- * is not to be remapped again.
- */
+ * is not to be remapped again. */
deg_tag_copy_on_write_id(id_cow, id_orig);
/* Perform remapping of the nodes. */
RemapCallbackUserData user_data = {NULL};
@@ -771,9 +818,8 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
(void *)&user_data,
IDWALK_NOP);
/* Correct or tweak some pointers which are not taken care by foreach
- * from above.
- */
- update_special_pointers(depsgraph, id_orig, id_cow);
+ * from above. */
+ update_id_after_copy(depsgraph, id_node, id_orig, id_cow);
id_cow->recalc = id_orig->recalc | id_cow_recalc;
return id_cow;
}
@@ -784,7 +830,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
DepsgraphNodeBuilder *node_builder,
bool create_placeholders)
{
- DEG::IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
+ DEG::IDNode *id_node = depsgraph->find_id_node(id_orig);
BLI_assert(id_node != NULL);
return deg_expand_copy_on_write_datablock(depsgraph,
id_node,
@@ -793,7 +839,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
}
static void deg_update_copy_on_write_animation(const Depsgraph *depsgraph,
- const IDDepsNode *id_node)
+ const IDNode *id_node)
{
DEG_debug_print_eval((::Depsgraph *)depsgraph,
__func__,
@@ -827,12 +873,13 @@ static void deg_backup_object_runtime(
Mesh *mesh_eval = object->runtime.mesh_eval;
object_runtime_backup->runtime = object->runtime;
BKE_object_runtime_reset(object);
+ /* Keep bbox (for now at least...). */
+ object->runtime.bb = object_runtime_backup->runtime.bb;
/* Object update will override actual object->data to an evaluated version.
* Need to make sure we don't have data set to evaluated one before free
- * anything.
- */
+ * anything. */
if (mesh_eval != NULL && object->data == mesh_eval) {
- object->data = object->runtime.mesh_orig;
+ object->data = object_runtime_backup->runtime.mesh_orig;
}
/* Make a backup of base flags. */
object_runtime_backup->base_flag = object->base_flag;
@@ -844,8 +891,10 @@ static void deg_restore_object_runtime(
const ObjectRuntimeBackup *object_runtime_backup)
{
Mesh *mesh_orig = object->runtime.mesh_orig;
+ BoundBox *bb = object->runtime.bb;
object->runtime = object_runtime_backup->runtime;
object->runtime.mesh_orig = mesh_orig;
+ object->runtime.bb = bb;
if (object->type == OB_MESH && object->runtime.mesh_eval != NULL) {
if (object->id.recalc & ID_RECALC_GEOMETRY) {
/* If geometry is tagged for update it means, that part of
@@ -853,8 +902,7 @@ static void deg_restore_object_runtime(
* have any "persistent" pointers to point to an invalid data.
*
* We restore object's data datablock to an original copy of
- * that datablock.
- */
+ * that datablock. */
object->data = mesh_orig;
/* After that, immediately free the invalidated caches. */
@@ -863,14 +911,12 @@ static void deg_restore_object_runtime(
else {
Mesh *mesh_eval = object->runtime.mesh_eval;
/* Do same thing as object update: override actual object data
- * pointer with evaluated datablock.
- */
+ * pointer with evaluated datablock. */
object->data = mesh_eval;
- /* Evaluated mesh simply copied edit_btmesh pointer from
+ /* Evaluated mesh simply copied edit_mesh pointer from
* original mesh during update, need to make sure no dead
- * pointers are left behind.
- */
- mesh_eval->edit_btmesh = mesh_orig->edit_btmesh;
+ * pointers are left behind. */
+ mesh_eval->edit_mesh = mesh_orig->edit_mesh;
}
}
object->base_flag = object_runtime_backup->base_flag;
@@ -878,7 +924,7 @@ static void deg_restore_object_runtime(
}
ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
- const IDDepsNode *id_node)
+ const IDNode *id_node)
{
const ID *id_orig = id_node->id_orig;
const ID_Type id_type = GS(id_orig->name);
@@ -892,20 +938,17 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
* - Perform full datablock copy.
*
* Note that we never free GPU materials from here since that's not
- * safe for threading and GPU materials are likely to be re-used.
- */
+ * safe for threading and GPU materials are likely to be re-used. */
/* TODO(sergey): Either move this to an utility function or redesign
* Copy-on-Write components in a way that only needed parts are being
- * copied over.
- */
+ * copied over. */
/* TODO(sergey): Wrap GPU material backup and object runtime backup to a
- * generic backup structure.
- */
+ * generic backup structure. */
ListBase gpumaterial_backup;
ListBase *gpumaterial_ptr = NULL;
DrawDataList drawdata_backup;
DrawDataList *drawdata_ptr = NULL;
- ObjectRuntimeBackup object_runtime_backup = {{NULL}};
+ ObjectRuntimeBackup object_runtime_backup = {{0}};
if (check_datablock_expanded(id_cow)) {
switch (id_type) {
case ID_MA:
@@ -928,8 +971,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
*
* These flags CURRENTLY don't need full datablock update,
* everything is done by node tree update function which
- * only copies socket values.
- */
+ * only copies socket values. */
const int ignore_flag = (ID_RECALC_SHADING |
ID_RECALC_ANIMATION |
ID_RECALC_COPY_ON_WRITE);
@@ -978,7 +1020,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
ID *id_orig)
{
- DEG::IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
+ DEG::IDNode *id_node = depsgraph->find_id_node(id_orig);
BLI_assert(id_node != NULL);
return deg_update_copy_on_write_datablock(depsgraph, id_node);
}
@@ -1013,12 +1055,12 @@ void discard_lattice_edit_mode_pointers(ID *id_cow)
void discard_mesh_edit_mode_pointers(ID *id_cow)
{
Mesh *mesh_cow = (Mesh *)id_cow;
- if (mesh_cow->edit_btmesh == NULL) {
+ if (mesh_cow->edit_mesh == NULL) {
return;
}
- BKE_editmesh_free_derivedmesh(mesh_cow->edit_btmesh);
- MEM_freeN(mesh_cow->edit_btmesh);
- mesh_cow->edit_btmesh = NULL;
+ BKE_editmesh_free_derivedmesh(mesh_cow->edit_mesh);
+ MEM_freeN(mesh_cow->edit_mesh);
+ mesh_cow->edit_mesh = NULL;
}
void discard_scene_pointers(ID *id_cow)
@@ -1071,8 +1113,7 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
{
if (!check_datablock_expanded(id_cow)) {
/* Actual content was never copied on top of CoW block, we have
- * nothing to free.
- */
+ * nothing to free. */
return;
}
const ID_Type type = GS(id_cow->name);
@@ -1084,8 +1125,7 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
{
/* TODO(sergey): This workaround is only to prevent free derived
* caches from modifying object->data. This is currently happening
- * due to mesh/curve datablock boundbox tagging dirty.
- */
+ * due to mesh/curve datablock boundbox tagging dirty. */
Object *ob_cow = (Object *)id_cow;
ob_cow->data = NULL;
ob_cow->sculpt = NULL;
@@ -1102,14 +1142,13 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
}
void deg_evaluate_copy_on_write(struct ::Depsgraph *graph,
- const IDDepsNode *id_node)
+ const IDNode *id_node)
{
const DEG::Depsgraph *depsgraph = reinterpret_cast<const DEG::Depsgraph *>(graph);
DEG_debug_print_eval(graph, __func__, id_node->id_orig->name, id_node->id_cow);
if (id_node->id_orig == &depsgraph->scene->id) {
/* NOTE: This is handled by eval_ctx setup routines, which
- * ensures scene and view layer pointers are valid.
- */
+ * ensures scene and view layer pointers are valid. */
return;
}
deg_update_copy_on_write_datablock(depsgraph, id_node);
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
index e9f5bc1e918..c6d44382cc7 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 20137Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
@@ -52,13 +45,13 @@ namespace DEG {
struct Depsgraph;
struct DepsgraphNodeBuilder;
-struct IDDepsNode;
+struct IDNode;
/* Get fully expanded (ready for use) copy-on-write datablock for the given
* original datablock.
*/
ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph,
- const IDDepsNode *id_node,
+ const IDNode *id_node,
DepsgraphNodeBuilder *node_builder = NULL,
bool create_placeholders = false);
ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph,
@@ -70,7 +63,7 @@ ID *deg_expand_copy_on_write_datablock(const struct Depsgraph *depsgraph,
* datablock.
*/
ID *deg_update_copy_on_write_datablock(const struct Depsgraph *depsgraph,
- const IDDepsNode *id_node);
+ const IDNode *id_node);
ID *deg_update_copy_on_write_datablock(const struct Depsgraph *depsgraph,
struct ID *id_orig);
@@ -81,7 +74,7 @@ void deg_free_copy_on_write_datablock(struct ID *id_cow);
* datablock is ready for use by further evaluation routines.
*/
void deg_evaluate_copy_on_write(struct ::Depsgraph *depsgraph,
- const struct IDDepsNode *id_node);
+ const struct IDNode *id_node);
/* Check that given ID is properly expanded and does not have any shallow
* copies inside.
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 5373c142ba6..5498e75ade0 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/eval/deg_eval_flush.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Core routines for how the Depsgraph works.
*/
@@ -52,14 +45,16 @@ extern "C" {
#include "DEG_depsgraph.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
+#include "intern/debug/deg_debug.h"
+#include "intern/depsgraph.h"
+#include "intern/depsgraph_update.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
-#include "intern/depsgraph_intern.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "util/deg_util_foreach.h"
// Invalidate datablock data when update is flushed on it.
//
@@ -85,7 +80,7 @@ enum {
COMPONENT_STATE_DONE = 2,
};
-typedef std::deque<OperationDepsNode *> FlushQueue;
+typedef std::deque<OperationNode *> FlushQueue;
namespace {
@@ -95,7 +90,7 @@ void flush_init_operation_node_func(
const ParallelRangeTLS *__restrict /*tls*/)
{
Depsgraph *graph = (Depsgraph *)data_v;
- OperationDepsNode *node = graph->operations[i];
+ OperationNode *node = graph->operations[i];
node->scheduled = false;
}
@@ -105,9 +100,9 @@ void flush_init_id_node_func(
const ParallelRangeTLS *__restrict /*tls*/)
{
Depsgraph *graph = (Depsgraph *)data_v;
- IDDepsNode *id_node = graph->id_nodes[i];
+ IDNode *id_node = graph->id_nodes[i];
id_node->custom_flags = ID_STATE_NONE;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
comp_node->custom_flags = COMPONENT_STATE_NONE;
GHASH_FOREACH_END();
}
@@ -138,7 +133,7 @@ BLI_INLINE void flush_prepare(Depsgraph *graph)
BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
{
- GSET_FOREACH_BEGIN(OperationDepsNode *, op_node, graph->entry_tags)
+ GSET_FOREACH_BEGIN(OperationNode *, op_node, graph->entry_tags)
{
queue->push_back(op_node);
op_node->scheduled = true;
@@ -149,14 +144,14 @@ BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
GSET_FOREACH_END();
}
-BLI_INLINE void flush_handle_id_node(IDDepsNode *id_node)
+BLI_INLINE void flush_handle_id_node(IDNode *id_node)
{
id_node->custom_flags = ID_STATE_MODIFIED;
}
/* TODO(sergey): We can reduce number of arguments here. */
-BLI_INLINE void flush_handle_component_node(IDDepsNode *id_node,
- ComponentDepsNode *comp_node,
+BLI_INLINE void flush_handle_component_node(IDNode *id_node,
+ ComponentNode *comp_node,
FlushQueue *queue)
{
/* We only handle component once. */
@@ -168,19 +163,18 @@ BLI_INLINE void flush_handle_component_node(IDDepsNode *id_node,
* special component where we don't want all operations to be tagged.
*
* TODO(sergey): Make this a more generic solution. */
- if (comp_node->type != DEG_NODE_TYPE_PARTICLE_SETTINGS &&
- comp_node->type != DEG_NODE_TYPE_PARTICLE_SYSTEM)
+ if (comp_node->type != NodeType::PARTICLE_SETTINGS &&
+ comp_node->type != NodeType::PARTICLE_SYSTEM)
{
- foreach (OperationDepsNode *op, comp_node->operations) {
+ for (OperationNode *op : comp_node->operations) {
op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
}
}
/* when some target changes bone, we might need to re-run the
- * whole IK solver, otherwise result might be unpredictable.
- */
- if (comp_node->type == DEG_NODE_TYPE_BONE) {
- ComponentDepsNode *pose_comp =
- id_node->find_component(DEG_NODE_TYPE_EVAL_POSE);
+ * whole IK solver, otherwise result might be unpredictable. */
+ if (comp_node->type == NodeType::BONE) {
+ ComponentNode *pose_comp =
+ id_node->find_component(NodeType::EVAL_POSE);
BLI_assert(pose_comp != NULL);
if (pose_comp->custom_flags == COMPONENT_STATE_NONE) {
queue->push_front(pose_comp->get_entry_operation());
@@ -195,24 +189,24 @@ BLI_INLINE void flush_handle_component_node(IDDepsNode *id_node,
* return value, so it can start being handled right away, without building too
* much of a queue.
*/
-BLI_INLINE OperationDepsNode *flush_schedule_children(
- OperationDepsNode *op_node,
+BLI_INLINE OperationNode *flush_schedule_children(
+ OperationNode *op_node,
FlushQueue *queue)
{
- OperationDepsNode *result = NULL;
- foreach (DepsRelation *rel, op_node->outlinks) {
+ OperationNode *result = NULL;
+ for (Relation *rel : op_node->outlinks) {
/* Flush is forbidden, completely. */
- if (rel->flag & DEPSREL_FLAG_NO_FLUSH) {
+ if (rel->flag & RELATION_FLAG_NO_FLUSH) {
continue;
}
/* Relation only allows flushes on user changes, but the node was not
* affected by user. */
- if ((rel->flag & DEPSREL_FLAG_FLUSH_USER_EDIT_ONLY) &&
+ if ((rel->flag & RELATION_FLAG_FLUSH_USER_EDIT_ONLY) &&
(op_node->flag & DEPSOP_FLAG_USER_MODIFIED) == 0)
{
continue;
}
- OperationDepsNode *to_node = (OperationDepsNode *)rel->to;
+ OperationNode *to_node = (OperationNode *)rel->to;
/* Always flush flushable flags, so children always know what happened
* to their parents. */
to_node->flag |= (op_node->flag & DEPSOP_FLAG_FLUSH);
@@ -237,36 +231,35 @@ void flush_engine_data_update(ID *id)
if (draw_data_list == NULL) {
return;
}
- LISTBASE_FOREACH(DrawData *, draw_data, draw_data_list) {
+ LISTBASE_FOREACH (DrawData *, draw_data, draw_data_list) {
draw_data->recalc |= id->recalc;
}
}
/* NOTE: It will also accumulate flags from changed components. */
-void flush_editors_id_update(Main *bmain,
- Depsgraph *graph,
+void flush_editors_id_update(Depsgraph *graph,
const DEGEditorUpdateContext *update_ctx)
{
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ for (IDNode *id_node : graph->id_nodes) {
if (id_node->custom_flags != ID_STATE_MODIFIED) {
continue;
}
- DEG_id_type_tag(bmain, GS(id_node->id_orig->name));
+ DEG_graph_id_type_tag(reinterpret_cast<::Depsgraph*>(graph),
+ GS(id_node->id_orig->name));
/* TODO(sergey): Do we need to pass original or evaluated ID here? */
ID *id_orig = id_node->id_orig;
ID *id_cow = id_node->id_cow;
/* Copy tag from original data to CoW storage.
* This is because DEG_id_tag_update() sets tags on original
- * data.
- */
+ * data. */
id_cow->recalc |= (id_orig->recalc & ID_RECALC_ALL);
/* Gather recalc flags from all changed components. */
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
if (comp_node->custom_flags != COMPONENT_STATE_DONE) {
continue;
}
- DepsNodeFactory *factory = deg_type_get_factory(comp_node->type);
+ DepsNodeFactory *factory = type_get_factory(comp_node->type);
BLI_assert(factory != NULL);
id_cow->recalc |= factory->id_recalc_tag();
}
@@ -330,7 +323,7 @@ void invalidate_tagged_evaluated_geometry(ID *id)
void invalidate_tagged_evaluated_data(Depsgraph *graph)
{
#ifdef INVALIDATE_ON_FLUSH
- foreach (IDDepsNode *id_node, graph->id_nodes) {
+ for (IDNode *id_node : graph->id_nodes) {
if (id_node->custom_flags != ID_STATE_MODIFIED) {
continue;
}
@@ -338,7 +331,7 @@ void invalidate_tagged_evaluated_data(Depsgraph *graph)
if (!deg_copy_on_write_is_expanded(id_cow)) {
continue;
}
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
if (comp_node->custom_flags != COMPONENT_STATE_DONE) {
continue;
@@ -388,14 +381,14 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
update_ctx.view_layer = graph->view_layer;
/* Do actual flush. */
while (!queue.empty()) {
- OperationDepsNode *op_node = queue.front();
+ OperationNode *op_node = queue.front();
queue.pop_front();
while (op_node != NULL) {
/* Tag operation as required for update. */
op_node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
/* Inform corresponding ID and component nodes about the change. */
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
flush_handle_id_node(id_node);
flush_handle_component_node(id_node,
comp_node,
@@ -405,10 +398,9 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
}
}
/* Inform editors about all changes. */
- flush_editors_id_update(bmain, graph, &update_ctx);
+ flush_editors_id_update(graph, &update_ctx);
/* Reset evaluation result tagged which is tagged for update to some state
- * which is obvious to catch.
- */
+ * which is obvious to catch. */
invalidate_tagged_evaluated_data(graph);
}
@@ -418,7 +410,7 @@ static void graph_clear_operation_func(
const ParallelRangeTLS *__restrict /*tls*/)
{
Depsgraph *graph = (Depsgraph *)data_v;
- OperationDepsNode *node = graph->operations[i];
+ OperationNode *node = graph->operations[i];
/* Clear node's "pending update" settings. */
node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED |
DEPSOP_FLAG_NEEDS_UPDATE |
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.h b/source/blender/depsgraph/intern/eval/deg_eval_flush.h
index ecd3a5ec660..a4550dd4851 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/eval/deg_eval_flush.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*
* Core routines for how the Depsgraph works.
*/
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_stats.cc b/source/blender/depsgraph/intern/eval/deg_eval_stats.cc
index 52ce744cc0a..0bf525a0e19 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_stats.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_stats.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/eval/deg_eval_stats.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#include "intern/eval/deg_eval_stats.h"
@@ -35,23 +28,20 @@
#include "intern/depsgraph.h"
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
namespace DEG {
void deg_eval_stats_aggregate(Depsgraph *graph)
{
/* Reset current evaluation stats for ID and component nodes.
- * Those are not filled in by the evaluation engine.
- */
- foreach (DepsNode *node, graph->id_nodes) {
- IDDepsNode *id_node = (IDDepsNode *)node;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ * Those are not filled in by the evaluation engine. */
+ for (Node *node : graph->id_nodes) {
+ IDNode *id_node = (IDNode *)node;
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, id_node->components)
{
comp_node->stats.reset_current();
}
@@ -59,9 +49,9 @@ void deg_eval_stats_aggregate(Depsgraph *graph)
id_node->stats.reset_current();
}
/* Now accumulate operation timings to components and IDs. */
- foreach (OperationDepsNode *op_node, graph->operations) {
- ComponentDepsNode *comp_node = op_node->owner;
- IDDepsNode *id_node = comp_node->owner;
+ for (OperationNode *op_node : graph->operations) {
+ ComponentNode *comp_node = op_node->owner;
+ IDNode *id_node = comp_node->owner;
id_node->stats.current_time += op_node->stats.current_time;
comp_node->stats.current_time += op_node->stats.current_time;
}
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_stats.h b/source/blender/depsgraph/intern/eval/deg_eval_stats.h
index 8a7272ac89c..988b42e15ae 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_stats.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval_stats.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/eval/deg_eval_stats.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
diff --git a/source/blender/depsgraph/intern/node/deg_node.cc b/source/blender/depsgraph/intern/node/deg_node.cc
new file mode 100644
index 00000000000..1eaee3d9e5b
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node.cc
@@ -0,0 +1,180 @@
+/*
+ * 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) 2013 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#include "intern/node/deg_node.h"
+
+#include <stdio.h>
+
+#include "BLI_utildefines.h"
+
+#include "intern/depsgraph.h"
+#include "intern/eval/deg_eval_copy_on_write.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_operation.h"
+#include "intern/node/deg_node_time.h"
+
+namespace DEG {
+
+const char *nodeClassAsString(NodeClass node_class)
+{
+ switch (node_class) {
+ case NodeClass::GENERIC: return "GENERIC";
+ case NodeClass::COMPONENT: return "COMPONENT";
+ case NodeClass::OPERATION: return "OPERATION";
+ }
+ BLI_assert(!"Unhandled node class, should never happen.");
+ return "UNKNOWN";
+}
+
+const char *nodeTypeAsString(NodeType type)
+{
+ switch (type) {
+ case NodeType::UNDEFINED: return "UNDEFINED";
+ case NodeType::OPERATION: return "OPERATION";
+ /* **** Generic Types **** */
+ case NodeType::TIMESOURCE: return "TIMESOURCE";
+ case NodeType::ID_REF: return "ID_REF";
+ /* **** Outer Types **** */
+ case NodeType::PARAMETERS: return "PARAMETERS";
+ case NodeType::PROXY: return "PROXY";
+ case NodeType::ANIMATION: return "ANIMATION";
+ case NodeType::TRANSFORM: return "TRANSFORM";
+ case NodeType::GEOMETRY: return "GEOMETRY";
+ case NodeType::SEQUENCER: return "SEQUENCER";
+ case NodeType::LAYER_COLLECTIONS: return "LAYER_COLLECTIONS";
+ case NodeType::COPY_ON_WRITE: return "COPY_ON_WRITE";
+ case NodeType::OBJECT_FROM_LAYER: return "OBJECT_FROM_LAYER";
+ /* **** Evaluation-Related Outer Types (with Subdata) **** */
+ case NodeType::EVAL_POSE: return "EVAL_POSE";
+ case NodeType::BONE: return "BONE";
+ case NodeType::PARTICLE_SYSTEM: return "PARTICLE_SYSTEM";
+ case NodeType::PARTICLE_SETTINGS: return "PARTICLE_SETTINGS";
+ case NodeType::SHADING: return "SHADING";
+ case NodeType::SHADING_PARAMETERS: return "SHADING_PARAMETERS";
+ case NodeType::CACHE: return "CACHE";
+ case NodeType::POINT_CACHE: return "POINT_CACHE";
+ case NodeType::BATCH_CACHE: return "BATCH_CACHE";
+ /* Duplication. */
+ case NodeType::DUPLI: return "DUPLI";
+ /* Synchronization. */
+ case NodeType::SYNCHRONIZATION: return "SYNCHRONIZATION";
+ /* Generic datablock. */
+ case NodeType::GENERIC_DATABLOCK: return "GENERIC_DATABLOCK";
+
+ /* Total number of meaningful node types. */
+ case NodeType::NUM_TYPES: return "SpecialCase";
+ }
+ BLI_assert(!"Unhandled node type, should never happen.");
+ return "UNKNOWN";
+}
+
+/*******************************************************************************
+ * Type information.
+ */
+
+Node::TypeInfo::TypeInfo(NodeType type,
+ const char *type_name,
+ int id_recalc_tag)
+ : type(type),
+ type_name(type_name),
+ id_recalc_tag(id_recalc_tag)
+{
+}
+
+/*******************************************************************************
+ * Evaluation statistics.
+ */
+
+Node::Stats::Stats()
+{
+ reset();
+}
+
+void Node::Stats::reset()
+{
+ current_time = 0.0;
+}
+
+void Node::Stats::reset_current()
+{
+ current_time = 0.0;
+}
+
+/*******************************************************************************
+ * Node itself.
+ */
+
+Node::Node()
+{
+ name = "";
+}
+
+Node::~Node()
+{
+ /* Free links. */
+ /* NOTE: We only free incoming links. This is to avoid double-free of links
+ * when we're trying to free same link from both it's sides. We don't have
+ * dangling links so this is not a problem from memory leaks point of view. */
+ for (Relation *rel : inlinks) {
+ OBJECT_GUARDED_DELETE(rel, Relation);
+ }
+}
+
+
+/* Generic identifier for Depsgraph Nodes. */
+string Node::identifier() const
+{
+ return string(nodeTypeAsString(type)) + " : " + name;
+}
+
+NodeClass Node::get_class() const {
+ if (type == NodeType::OPERATION) {
+ return NodeClass::OPERATION;
+ }
+ else if (type < NodeType::PARAMETERS) {
+ return NodeClass::GENERIC;
+ }
+ else {
+ return NodeClass::COMPONENT;
+ }
+}
+
+/*******************************************************************************
+ * Generic nodes definition.
+ */
+
+DEG_DEPSNODE_DEFINE(TimeSourceNode, NodeType::TIMESOURCE, "Time Source");
+static DepsNodeFactoryImpl<TimeSourceNode> DNTI_TIMESOURCE;
+
+DEG_DEPSNODE_DEFINE(IDNode, NodeType::ID_REF, "ID Node");
+static DepsNodeFactoryImpl<IDNode> DNTI_ID_REF;
+
+void deg_register_base_depsnodes()
+{
+ register_node_typeinfo(&DNTI_TIMESOURCE);
+ register_node_typeinfo(&DNTI_ID_REF);
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h
new file mode 100644
index 00000000000..0677b0edc15
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node.h
@@ -0,0 +1,194 @@
+/*
+ * 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) 2013 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "intern/depsgraph_type.h"
+
+#include "BLI_utildefines.h"
+
+struct GHash;
+struct ID;
+struct Scene;
+
+namespace DEG {
+
+struct Depsgraph;
+struct OperationNode;
+struct Relation;
+
+/* Metatype of Nodes - The general "level" in the graph structure
+ * the node serves. */
+enum class NodeClass {
+ /* Types generally unassociated with user-visible entities,
+ * but needed for graph functioning. */
+ GENERIC = 0,
+ /* [Outer Node] An "aspect" of evaluating/updating an ID-Block, requiring
+ * certain types of evaluation behavior. */
+ COMPONENT = 1,
+ /* [Inner Node] A glorified function-pointer/callback for scheduling up
+ * evaluation operations for components, subject to relationship
+ * requirements. */
+ OPERATION = 2,
+};
+const char *nodeClassAsString(NodeClass node_class);
+
+/* Types of Nodes */
+enum class NodeType {
+ /* Fallback type for invalid return value */
+ UNDEFINED = 0,
+ /* Inner Node (Operation) */
+ OPERATION,
+
+ /* **** Generic Types **** */
+
+ /* Time-Source */
+ TIMESOURCE,
+ /* ID-Block reference - used as landmarks/collection point for components,
+ * but not usually part of main graph. */
+ ID_REF,
+
+ /* **** Outer Types **** */
+
+ /* Parameters Component - Default when nothing else fits
+ * (i.e. just SDNA property setting). */
+ PARAMETERS,
+ /* Generic "Proxy-Inherit" Component. */
+ PROXY,
+ /* Animation Component */
+ ANIMATION,
+ /* Transform Component (Parenting/Constraints) */
+ TRANSFORM,
+ /* Geometry Component (Mesh/Displist) */
+ GEOMETRY,
+ /* Sequencer Component (Scene Only) */
+ SEQUENCER,
+ /* Component which contains all operations needed for layer collections
+ * evaluation. */
+ LAYER_COLLECTIONS,
+ /* Entry component of majority of ID nodes: prepares CoW pointers for
+ * execution. */
+ COPY_ON_WRITE,
+ /* Used by all operations which are updating object when something is
+ * changed in view layer. */
+ OBJECT_FROM_LAYER,
+ /* Un-interestying datablock, which is a part of dependency graph, but does
+ * not have very distinctive update procedure. */
+ GENERIC_DATABLOCK,
+
+ /* **** Evaluation-Related Outer Types (with Subdata) **** */
+
+ /* Pose Component - Owner/Container of Bones Eval */
+ EVAL_POSE,
+ /* Bone Component - Child/Subcomponent of Pose */
+ BONE,
+ /* Particle Systems Component */
+ PARTICLE_SYSTEM,
+ PARTICLE_SETTINGS,
+ /* Material Shading Component */
+ SHADING,
+ SHADING_PARAMETERS,
+ /* Point cache Component */
+ POINT_CACHE,
+ /* Cache Component */
+ /* TODO(sergey); Verify that we really need this. */
+ CACHE,
+ /* Batch Cache Component.
+ * TODO (dfelinto/sergey): rename to make it more generic. */
+ BATCH_CACHE,
+ /* Duplication system. Used to force duplicated objects visible when
+ * when duplicator is visible. */
+ DUPLI,
+ /* Synchronization back to original datablock. */
+ SYNCHRONIZATION,
+
+ /* Total number of meaningful node types. */
+ NUM_TYPES,
+};
+const char *nodeTypeAsString(NodeType type);
+
+/* All nodes in Depsgraph are descended from this. */
+struct Node {
+ /* Helper class for static typeinfo in subclasses. */
+ struct TypeInfo {
+ TypeInfo(NodeType type,
+ const char *type_name,
+ int id_recalc_tag = 0);
+ NodeType type;
+ const char *type_name;
+ int id_recalc_tag;
+ };
+ struct Stats {
+ Stats();
+ /* Reset all the counters. Including all stats needed for average
+ * evaluation time calculation. */
+ void reset();
+ /* Reset counters needed for the current graph evaluation, does not
+ * touch averaging accumulators. */
+ void reset_current();
+ /* Time spend on this node during current graph evaluation. */
+ double current_time;
+ };
+ /* Relationships between nodes
+ * The reason why all depsgraph nodes are descended from this type (apart
+ * from basic serialization benefits - from the typeinfo) is that we can
+ * have relationships between these nodes. */
+ typedef vector<Relation *> Relations;
+
+ string name; /* Identifier - mainly for debugging purposes. */
+ NodeType type; /* Structural type of node. */
+ Relations inlinks; /* Nodes which this one depends on. */
+ Relations outlinks; /* Nodes which depend on this one. */
+ Stats stats; /* Evaluation statistics. */
+
+ /* Generic tags for traversal algorithms and such.
+ *
+ * Actual meaning of values depends on a specific area. Every area is to
+ * clean this before use. */
+ int custom_flags;
+
+ /* Methods. */
+ Node();
+ virtual ~Node();
+
+ virtual string identifier() const;
+
+ virtual void init(const ID * /*id*/, const char * /*subdata*/) {}
+
+ virtual void tag_update(Depsgraph * /*graph*/, eUpdateSource /*source*/) {}
+
+ virtual OperationNode *get_entry_operation() { return NULL; }
+ virtual OperationNode *get_exit_operation() { return NULL; }
+
+ virtual NodeClass get_class() const;
+};
+
+/* Macros for common static typeinfo. */
+#define DEG_DEPSNODE_DECLARE \
+ static const Node::TypeInfo typeinfo
+#define DEG_DEPSNODE_DEFINE(NodeType, type_, tname_) \
+ const Node::TypeInfo NodeType::typeinfo = Node::TypeInfo(type_, tname_)
+
+void deg_register_base_depsnodes();
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc
index 5eb8dc9dd09..06ede835a27 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_component.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,13 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/nodes/deg_node_component.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
-#include "intern/nodes/deg_node_component.h"
+#include "intern/node/deg_node_component.h"
#include <stdio.h>
#include <cstring> /* required for STREQ later on. */
@@ -42,10 +35,9 @@ extern "C" {
#include "BKE_action.h"
} /* extern "C" */
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/depsgraph_intern.h"
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node_id.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_operation.h"
namespace DEG {
@@ -54,21 +46,21 @@ namespace DEG {
/* Standard Component Methods ============================= */
-ComponentDepsNode::OperationIDKey::OperationIDKey()
- : opcode(DEG_OPCODE_OPERATION),
+ComponentNode::OperationIDKey::OperationIDKey()
+ : opcode(OperationCode::OPERATION),
name(""),
name_tag(-1)
{
}
-ComponentDepsNode::OperationIDKey::OperationIDKey(eDepsOperation_Code opcode)
+ComponentNode::OperationIDKey::OperationIDKey(OperationCode opcode)
: opcode(opcode),
name(""),
name_tag(-1)
{
}
-ComponentDepsNode::OperationIDKey::OperationIDKey(eDepsOperation_Code opcode,
+ComponentNode::OperationIDKey::OperationIDKey(OperationCode opcode,
const char *name,
int name_tag)
: opcode(opcode),
@@ -77,14 +69,13 @@ ComponentDepsNode::OperationIDKey::OperationIDKey(eDepsOperation_Code opcode,
{
}
-string ComponentDepsNode::OperationIDKey::identifier() const
+string ComponentNode::OperationIDKey::identifier() const
{
- char codebuf[5];
- BLI_snprintf(codebuf, sizeof(codebuf), "%d", opcode);
- return string("OperationIDKey(") + codebuf + ", " + name + ")";
+ const string codebuf = to_string(static_cast<int>(opcode));
+ return "OperationIDKey(" + codebuf + ", " + name + ")";
}
-bool ComponentDepsNode::OperationIDKey::operator==(
+bool ComponentNode::OperationIDKey::operator==(
const OperationIDKey &other) const
{
return (opcode == other.opcode) &&
@@ -94,35 +85,36 @@ bool ComponentDepsNode::OperationIDKey::operator==(
static unsigned int comp_node_hash_key(const void *key_v)
{
- const ComponentDepsNode::OperationIDKey *key =
- reinterpret_cast<const ComponentDepsNode::OperationIDKey *>(key_v);
- return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(key->opcode),
+ const ComponentNode::OperationIDKey *key =
+ reinterpret_cast<const ComponentNode::OperationIDKey *>(key_v);
+ int opcode_as_int = static_cast<int>(key->opcode);
+ return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(opcode_as_int),
BLI_ghashutil_strhash_p(key->name));
}
static bool comp_node_hash_key_cmp(const void *a, const void *b)
{
- const ComponentDepsNode::OperationIDKey *key_a =
- reinterpret_cast<const ComponentDepsNode::OperationIDKey *>(a);
- const ComponentDepsNode::OperationIDKey *key_b =
- reinterpret_cast<const ComponentDepsNode::OperationIDKey *>(b);
+ const ComponentNode::OperationIDKey *key_a =
+ reinterpret_cast<const ComponentNode::OperationIDKey *>(a);
+ const ComponentNode::OperationIDKey *key_b =
+ reinterpret_cast<const ComponentNode::OperationIDKey *>(b);
return !(*key_a == *key_b);
}
static void comp_node_hash_key_free(void *key_v)
{
- typedef ComponentDepsNode::OperationIDKey OperationIDKey;
+ typedef ComponentNode::OperationIDKey OperationIDKey;
OperationIDKey *key = reinterpret_cast<OperationIDKey *>(key_v);
OBJECT_GUARDED_DELETE(key, OperationIDKey);
}
static void comp_node_hash_value_free(void *value_v)
{
- OperationDepsNode *op_node = reinterpret_cast<OperationDepsNode *>(value_v);
- OBJECT_GUARDED_DELETE(op_node, OperationDepsNode);
+ OperationNode *op_node = reinterpret_cast<OperationNode *>(value_v);
+ OBJECT_GUARDED_DELETE(op_node, OperationNode);
}
-ComponentDepsNode::ComponentDepsNode() :
+ComponentNode::ComponentNode() :
entry_operation(NULL),
exit_operation(NULL),
affects_directly_visible(false)
@@ -133,7 +125,7 @@ ComponentDepsNode::ComponentDepsNode() :
}
/* Initialize 'component' node - from pointer data given */
-void ComponentDepsNode::init(const ID * /*id*/,
+void ComponentNode::init(const ID * /*id*/,
const char * /*subdata*/)
{
/* hook up eval context? */
@@ -141,7 +133,7 @@ void ComponentDepsNode::init(const ID * /*id*/,
}
/* Free 'component' node */
-ComponentDepsNode::~ComponentDepsNode()
+ComponentNode::~ComponentNode()
{
clear_operations();
if (operations_map != NULL) {
@@ -151,31 +143,28 @@ ComponentDepsNode::~ComponentDepsNode()
}
}
-string ComponentDepsNode::identifier() const
+string ComponentNode::identifier() const
{
- string idname = this->owner->name;
-
- char typebuf[16];
- sprintf(typebuf, "(%d)", type);
-
- return string(typebuf) + name + " : " + idname +
+ const string idname = this->owner->name;
+ const string typebuf = "" + to_string(static_cast<int>(type)) + ")";
+ return typebuf + name + " : " + idname +
"( affects_directly_visible: " +
(affects_directly_visible ? "true"
: "false") + ")";
;
}
-OperationDepsNode *ComponentDepsNode::find_operation(OperationIDKey key) const
+OperationNode *ComponentNode::find_operation(OperationIDKey key) const
{
- OperationDepsNode *node = NULL;
+ OperationNode *node = NULL;
if (operations_map != NULL) {
- node = (OperationDepsNode *)BLI_ghash_lookup(operations_map, &key);
+ node = (OperationNode *)BLI_ghash_lookup(operations_map, &key);
}
else {
- foreach (OperationDepsNode *op_node, operations) {
+ for (OperationNode *op_node : operations) {
if (op_node->opcode == key.opcode &&
op_node->name_tag == key.name_tag &&
- STREQ(op_node->name, key.name))
+ STREQ(op_node->name.c_str(), key.name))
{
node = op_node;
break;
@@ -185,7 +174,7 @@ OperationDepsNode *ComponentDepsNode::find_operation(OperationIDKey key) const
return node;
}
-OperationDepsNode *ComponentDepsNode::find_operation(eDepsOperation_Code opcode,
+OperationNode *ComponentNode::find_operation(OperationCode opcode,
const char *name,
int name_tag) const
{
@@ -193,9 +182,9 @@ OperationDepsNode *ComponentDepsNode::find_operation(eDepsOperation_Code opcode,
return find_operation(key);
}
-OperationDepsNode *ComponentDepsNode::get_operation(OperationIDKey key) const
+OperationNode *ComponentNode::get_operation(OperationIDKey key) const
{
- OperationDepsNode *node = find_operation(key);
+ OperationNode *node = find_operation(key);
if (node == NULL) {
fprintf(stderr, "%s: find_operation(%s) failed\n",
this->identifier().c_str(), key.identifier().c_str());
@@ -205,7 +194,7 @@ OperationDepsNode *ComponentDepsNode::get_operation(OperationIDKey key) const
return node;
}
-OperationDepsNode *ComponentDepsNode::get_operation(eDepsOperation_Code opcode,
+OperationNode *ComponentNode::get_operation(OperationCode opcode,
const char *name,
int name_tag) const
{
@@ -213,12 +202,12 @@ OperationDepsNode *ComponentDepsNode::get_operation(eDepsOperation_Code opcode,
return get_operation(key);
}
-bool ComponentDepsNode::has_operation(OperationIDKey key) const
+bool ComponentNode::has_operation(OperationIDKey key) const
{
return find_operation(key) != NULL;
}
-bool ComponentDepsNode::has_operation(eDepsOperation_Code opcode,
+bool ComponentNode::has_operation(OperationCode opcode,
const char *name,
int name_tag) const
{
@@ -226,15 +215,15 @@ bool ComponentDepsNode::has_operation(eDepsOperation_Code opcode,
return has_operation(key);
}
-OperationDepsNode *ComponentDepsNode::add_operation(const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
+OperationNode *ComponentNode::add_operation(const DepsEvalOperationCb& op,
+ OperationCode opcode,
const char *name,
int name_tag)
{
- OperationDepsNode *op_node = find_operation(opcode, name, name_tag);
+ OperationNode *op_node = find_operation(opcode, name, name_tag);
if (!op_node) {
- DepsNodeFactory *factory = deg_type_get_factory(DEG_NODE_TYPE_OPERATION);
- op_node = (OperationDepsNode *)factory->create_node(this->owner->id_orig, "", name);
+ DepsNodeFactory *factory = type_get_factory(NodeType::OPERATION);
+ op_node = (OperationNode *)factory->create_node(this->owner->id_orig, "", name);
/* register opnode in this component's operation set */
OperationIDKey *key = OBJECT_GUARDED_NEW(OperationIDKey, opcode, name, name_tag);
@@ -258,43 +247,43 @@ OperationDepsNode *ComponentDepsNode::add_operation(const DepsEvalOperationCb& o
return op_node;
}
-void ComponentDepsNode::set_entry_operation(OperationDepsNode *op_node)
+void ComponentNode::set_entry_operation(OperationNode *op_node)
{
BLI_assert(entry_operation == NULL);
entry_operation = op_node;
}
-void ComponentDepsNode::set_exit_operation(OperationDepsNode *op_node)
+void ComponentNode::set_exit_operation(OperationNode *op_node)
{
BLI_assert(exit_operation == NULL);
exit_operation = op_node;
}
-void ComponentDepsNode::clear_operations()
+void ComponentNode::clear_operations()
{
if (operations_map != NULL) {
BLI_ghash_clear(operations_map,
comp_node_hash_key_free,
comp_node_hash_value_free);
}
- foreach (OperationDepsNode *op_node, operations) {
- OBJECT_GUARDED_DELETE(op_node, OperationDepsNode);
+ for (OperationNode *op_node : operations) {
+ OBJECT_GUARDED_DELETE(op_node, OperationNode);
}
operations.clear();
}
-void ComponentDepsNode::tag_update(Depsgraph *graph, eDepsTag_Source source)
+void ComponentNode::tag_update(Depsgraph *graph, eUpdateSource source)
{
- OperationDepsNode *entry_op = get_entry_operation();
+ OperationNode *entry_op = get_entry_operation();
if (entry_op != NULL && entry_op->flag & DEPSOP_FLAG_NEEDS_UPDATE) {
return;
}
- foreach (OperationDepsNode *op_node, operations) {
+ for (OperationNode *op_node : operations) {
op_node->tag_update(graph, source);
}
// It is possible that tag happens before finalization.
if (operations_map != NULL) {
- GHASH_FOREACH_BEGIN(OperationDepsNode *, op_node, operations_map)
+ GHASH_FOREACH_BEGIN(OperationNode *, op_node, operations_map)
{
op_node->tag_update(graph, source);
}
@@ -302,15 +291,15 @@ void ComponentDepsNode::tag_update(Depsgraph *graph, eDepsTag_Source source)
}
}
-OperationDepsNode *ComponentDepsNode::get_entry_operation()
+OperationNode *ComponentNode::get_entry_operation()
{
if (entry_operation) {
return entry_operation;
}
else if (operations_map != NULL && BLI_ghash_len(operations_map) == 1) {
- OperationDepsNode *op_node = NULL;
+ OperationNode *op_node = NULL;
/* TODO(sergey): This is somewhat slow. */
- GHASH_FOREACH_BEGIN(OperationDepsNode *, tmp, operations_map)
+ GHASH_FOREACH_BEGIN(OperationNode *, tmp, operations_map)
{
op_node = tmp;
}
@@ -325,15 +314,15 @@ OperationDepsNode *ComponentDepsNode::get_entry_operation()
return NULL;
}
-OperationDepsNode *ComponentDepsNode::get_exit_operation()
+OperationNode *ComponentNode::get_exit_operation()
{
if (exit_operation) {
return exit_operation;
}
else if (operations_map != NULL && BLI_ghash_len(operations_map) == 1) {
- OperationDepsNode *op_node = NULL;
+ OperationNode *op_node = NULL;
/* TODO(sergey): This is somewhat slow. */
- GHASH_FOREACH_BEGIN(OperationDepsNode *, tmp, operations_map)
+ GHASH_FOREACH_BEGIN(OperationNode *, tmp, operations_map)
{
op_node = tmp;
}
@@ -348,10 +337,10 @@ OperationDepsNode *ComponentDepsNode::get_exit_operation()
return NULL;
}
-void ComponentDepsNode::finalize_build(Depsgraph * /*graph*/)
+void ComponentNode::finalize_build(Depsgraph * /*graph*/)
{
operations.reserve(BLI_ghash_len(operations_map));
- GHASH_FOREACH_BEGIN(OperationDepsNode *, op_node, operations_map)
+ GHASH_FOREACH_BEGIN(OperationNode *, op_node, operations_map)
{
operations.push_back(op_node);
}
@@ -365,15 +354,14 @@ void ComponentDepsNode::finalize_build(Depsgraph * /*graph*/)
/* Bone Component ========================================= */
/* Initialize 'bone component' node - from pointer data given */
-void BoneComponentDepsNode::init(const ID *id, const char *subdata)
+void BoneComponentNode::init(const ID *id, const char *subdata)
{
/* generic component-node... */
- ComponentDepsNode::init(id, subdata);
+ ComponentNode::init(id, subdata);
/* name of component comes is bone name */
/* TODO(sergey): This sets name to an empty string because subdata is
- * empty. Is it a bug?
- */
+ * empty. Is it a bug? */
//this->name = subdata;
/* bone-specific node data */
@@ -403,34 +391,34 @@ DEG_COMPONENT_NODE_DEFINE(ShadingParameters, SHADING_PARAMETERS, ID_RECALC_SHADI
DEG_COMPONENT_NODE_DEFINE(Transform, TRANSFORM, ID_RECALC_TRANSFORM);
DEG_COMPONENT_NODE_DEFINE(ObjectFromLayer, OBJECT_FROM_LAYER, 0);
DEG_COMPONENT_NODE_DEFINE(Dupli, DUPLI, 0);
-DEG_COMPONENT_NODE_DEFINE(Synchronize, SYNCHRONIZE, 0);
+DEG_COMPONENT_NODE_DEFINE(Synchronization, SYNCHRONIZATION, 0);
DEG_COMPONENT_NODE_DEFINE(GenericDatablock, GENERIC_DATABLOCK, 0);
/* Node Types Register =================================== */
void deg_register_component_depsnodes()
{
- deg_register_node_typeinfo(&DNTI_ANIMATION);
- deg_register_node_typeinfo(&DNTI_BONE);
- deg_register_node_typeinfo(&DNTI_CACHE);
- deg_register_node_typeinfo(&DNTI_BATCH_CACHE);
- deg_register_node_typeinfo(&DNTI_COPY_ON_WRITE);
- deg_register_node_typeinfo(&DNTI_GEOMETRY);
- deg_register_node_typeinfo(&DNTI_LAYER_COLLECTIONS);
- deg_register_node_typeinfo(&DNTI_PARAMETERS);
- deg_register_node_typeinfo(&DNTI_PARTICLE_SYSTEM);
- deg_register_node_typeinfo(&DNTI_PARTICLE_SETTINGS);
- deg_register_node_typeinfo(&DNTI_POINT_CACHE);
- deg_register_node_typeinfo(&DNTI_PROXY);
- deg_register_node_typeinfo(&DNTI_EVAL_POSE);
- deg_register_node_typeinfo(&DNTI_SEQUENCER);
- deg_register_node_typeinfo(&DNTI_SHADING);
- deg_register_node_typeinfo(&DNTI_SHADING_PARAMETERS);
- deg_register_node_typeinfo(&DNTI_TRANSFORM);
- deg_register_node_typeinfo(&DNTI_OBJECT_FROM_LAYER);
- deg_register_node_typeinfo(&DNTI_DUPLI);
- deg_register_node_typeinfo(&DNTI_SYNCHRONIZE);
- deg_register_node_typeinfo(&DNTI_GENERIC_DATABLOCK);
+ register_node_typeinfo(&DNTI_ANIMATION);
+ register_node_typeinfo(&DNTI_BONE);
+ register_node_typeinfo(&DNTI_CACHE);
+ register_node_typeinfo(&DNTI_BATCH_CACHE);
+ register_node_typeinfo(&DNTI_COPY_ON_WRITE);
+ register_node_typeinfo(&DNTI_GEOMETRY);
+ register_node_typeinfo(&DNTI_LAYER_COLLECTIONS);
+ register_node_typeinfo(&DNTI_PARAMETERS);
+ register_node_typeinfo(&DNTI_PARTICLE_SYSTEM);
+ register_node_typeinfo(&DNTI_PARTICLE_SETTINGS);
+ register_node_typeinfo(&DNTI_POINT_CACHE);
+ register_node_typeinfo(&DNTI_PROXY);
+ register_node_typeinfo(&DNTI_EVAL_POSE);
+ register_node_typeinfo(&DNTI_SEQUENCER);
+ register_node_typeinfo(&DNTI_SHADING);
+ register_node_typeinfo(&DNTI_SHADING_PARAMETERS);
+ register_node_typeinfo(&DNTI_TRANSFORM);
+ register_node_typeinfo(&DNTI_OBJECT_FROM_LAYER);
+ register_node_typeinfo(&DNTI_DUPLI);
+ register_node_typeinfo(&DNTI_SYNCHRONIZATION);
+ register_node_typeinfo(&DNTI_GENERIC_DATABLOCK);
}
} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h
index 151e37f7772..4392a120935 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/node/deg_node_component.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,47 +15,43 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/nodes/deg_node_component.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
-#include "intern/nodes/deg_node.h"
+#include "intern/node/deg_node.h"
+#include "intern/node/deg_node_operation.h"
#include "BLI_utildefines.h"
#include "BLI_string.h"
+struct GHash;
struct ID;
struct bPoseChannel;
-struct GHash;
namespace DEG {
+struct BoneComponentNode;
struct Depsgraph;
-struct OperationDepsNode;
-struct BoneComponentDepsNode;
-struct IDDepsNode;
+struct IDNode;
+struct OperationNode;
/* ID Component - Base type for all components */
-struct ComponentDepsNode : public DepsNode {
+struct ComponentNode : public Node {
/* Key used to look up operations within a component */
struct OperationIDKey
{
- eDepsOperation_Code opcode;
+ OperationCode opcode;
const char *name;
int name_tag;
OperationIDKey();
- OperationIDKey(eDepsOperation_Code opcode);
- OperationIDKey(eDepsOperation_Code opcode,
+ OperationIDKey(OperationCode opcode);
+ OperationIDKey(OperationCode opcode,
const char *name,
int name_tag);
@@ -66,30 +60,29 @@ struct ComponentDepsNode : public DepsNode {
};
/* Typedef for container of operations */
- ComponentDepsNode();
- ~ComponentDepsNode();
+ ComponentNode();
+ ~ComponentNode();
void init(const ID *id, const char *subdata) override;
virtual string identifier() const override;
/* Find an existing operation, if requested operation does not exist
- * NULL will be returned.
- */
- OperationDepsNode *find_operation(OperationIDKey key) const;
- OperationDepsNode *find_operation(eDepsOperation_Code opcode,
+ * NULL will be returned. */
+ OperationNode *find_operation(OperationIDKey key) const;
+ OperationNode *find_operation(OperationCode opcode,
const char *name,
int name_tag) const;
/* Find an existing operation, will throw an assert() if it does not exist. */
- OperationDepsNode *get_operation(OperationIDKey key) const;
- OperationDepsNode *get_operation(eDepsOperation_Code opcode,
+ OperationNode *get_operation(OperationIDKey key) const;
+ OperationNode *get_operation(OperationCode opcode,
const char *name,
int name_tag) const;
/* Check operation exists and return it. */
bool has_operation(OperationIDKey key) const;
- bool has_operation(eDepsOperation_Code opcode,
+ bool has_operation(OperationCode opcode,
const char *name,
int name_tag) const;
@@ -104,82 +97,77 @@ struct ComponentDepsNode : public DepsNode {
* \param optype: Role that operation plays within component
* (i.e. where in eval process)
* \param op: The operation to perform
- * \param name: Identifier for operation - used to find/locate it again
- */
- OperationDepsNode *add_operation(const DepsEvalOperationCb& op,
- eDepsOperation_Code opcode,
+ * \param name: Identifier for operation - used to find/locate it again */
+ OperationNode *add_operation(const DepsEvalOperationCb& op,
+ OperationCode opcode,
const char *name,
int name_tag);
/* Entry/exit operations management.
*
- * Use those instead of direct set since this will perform sanity checks.
- */
- void set_entry_operation(OperationDepsNode *op_node);
- void set_exit_operation(OperationDepsNode *op_node);
+ * Use those instead of direct set since this will perform sanity checks. */
+ void set_entry_operation(OperationNode *op_node);
+ void set_exit_operation(OperationNode *op_node);
void clear_operations();
- virtual void tag_update(Depsgraph *graph, eDepsTag_Source source) override;
+ virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
- virtual OperationDepsNode *get_entry_operation() override;
- virtual OperationDepsNode *get_exit_operation() override;
+ virtual OperationNode *get_entry_operation() override;
+ virtual OperationNode *get_exit_operation() override;
void finalize_build(Depsgraph *graph);
- IDDepsNode *owner;
+ IDNode *owner;
/* ** Inner nodes for this component ** */
/* Operations stored as a hash map, for faster build.
- * This hash map will be freed when graph is fully built.
- */
+ * This hash map will be freed when graph is fully built. */
GHash *operations_map;
/* This is a "normal" list of operations, used by evaluation
- * and other routines after construction.
- */
- vector<OperationDepsNode *> operations;
+ * and other routines after construction. */
+ vector<OperationNode *> operations;
- OperationDepsNode *entry_operation;
- OperationDepsNode *exit_operation;
+ OperationNode *entry_operation;
+ OperationNode *exit_operation;
virtual bool depends_on_cow() { return true; }
/* Denotes whether COW component is to be tagged when this component
- * is tagged for update.
- */
+ * is tagged for update. */
virtual bool need_tag_cow_before_update() { return true; }
/* Denotes whether this component affects (possibly indirectly) on a
- * directly visible object.
- */
+ * directly visible object. */
bool affects_directly_visible;
};
/* ---------------------------------------- */
-#define DEG_COMPONENT_NODE_DEFINE_TYPEINFO(NodeType, type_, tname_, id_recalc_tag) \
- const DepsNode::TypeInfo NodeType::typeinfo = \
- DepsNode::TypeInfo(type_, tname_, id_recalc_tag)
+#define DEG_COMPONENT_NODE_DEFINE_TYPEINFO(\
+ NodeType, type_, type_name_, id_recalc_tag) \
+ const Node::TypeInfo NodeType::typeinfo = \
+ Node::TypeInfo(type_, type_name_, id_recalc_tag)
#define DEG_COMPONENT_NODE_DECLARE DEG_DEPSNODE_DECLARE
#define DEG_COMPONENT_NODE_DEFINE(name, NAME, id_recalc_tag) \
- DEG_COMPONENT_NODE_DEFINE_TYPEINFO(name ## ComponentDepsNode, \
- DEG_NODE_TYPE_ ## NAME, \
+ DEG_COMPONENT_NODE_DEFINE_TYPEINFO(name ## ComponentNode, \
+ NodeType:: NAME, \
#name " Component", \
id_recalc_tag) ; \
- static DepsNodeFactoryImpl<name ## ComponentDepsNode> DNTI_ ## NAME
+ static DepsNodeFactoryImpl<name ## ComponentNode> DNTI_ ## NAME
#define DEG_COMPONENT_NODE_DECLARE_GENERIC(name) \
- struct name ## ComponentDepsNode : public ComponentDepsNode { \
+ struct name ## ComponentNode : public ComponentNode { \
DEG_COMPONENT_NODE_DECLARE; \
}
-#define DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(name) \
- struct name ## ComponentDepsNode : public ComponentDepsNode { \
- DEG_COMPONENT_NODE_DECLARE; \
+#define DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(name) \
+ struct name ## ComponentNode : public ComponentNode { \
+ DEG_COMPONENT_NODE_DECLARE; \
virtual bool need_tag_cow_before_update() { return false; } \
}
@@ -201,11 +189,11 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(ShadingParameters);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Transform);
DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(ObjectFromLayer);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Dupli);
-DEG_COMPONENT_NODE_DECLARE_GENERIC(Synchronize);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Synchronization);
DEG_COMPONENT_NODE_DECLARE_GENERIC(GenericDatablock);
/* Bone Component */
-struct BoneComponentDepsNode : public ComponentDepsNode {
+struct BoneComponentNode : public ComponentNode {
void init(const ID *id, const char *subdata);
struct bPoseChannel *pchan; /* the bone that this component represents */
diff --git a/source/blender/depsgraph/intern/node/deg_node_factory.cc b/source/blender/depsgraph/intern/node/deg_node_factory.cc
new file mode 100644
index 00000000000..e6f2fd1841d
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node_factory.cc
@@ -0,0 +1,46 @@
+/*
+ * 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) 2019 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#include "intern/node/deg_node_factory.h"
+
+namespace DEG {
+
+/* Global type registry */
+static DepsNodeFactory *
+node_typeinfo_registry[static_cast<int>(NodeType::NUM_TYPES)] = {NULL};
+
+void register_node_typeinfo(DepsNodeFactory *factory)
+{
+ BLI_assert(factory != NULL);
+ const int type_as_int = static_cast<int>(factory->type());
+ node_typeinfo_registry[type_as_int] = factory;
+}
+
+DepsNodeFactory *type_get_factory(const NodeType type)
+{
+ /* Look up type - at worst, it doesn't exist in table yet, and we fail. */
+ const int type_as_int = static_cast<int>(type);
+ return node_typeinfo_registry[type_as_int];
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/node/deg_node_factory.h b/source/blender/depsgraph/intern/node/deg_node_factory.h
new file mode 100644
index 00000000000..29a3eebba2b
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node_factory.h
@@ -0,0 +1,66 @@
+/*
+ * 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) 2019 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "MEM_guardedalloc.h"
+
+#include "intern/node/deg_node.h"
+#include "intern/depsgraph_type.h"
+
+struct ID;
+
+namespace DEG {
+
+struct DepsNodeFactory {
+ virtual NodeType type() const = 0;
+ virtual const char *type_name() const = 0;
+
+ virtual int id_recalc_tag() const = 0;
+
+ virtual Node *create_node(const ID *id,
+ const char *subdata,
+ const char *name) const = 0;
+};
+
+template <class ModeObjectType>
+struct DepsNodeFactoryImpl : public DepsNodeFactory {
+ virtual NodeType type() const override;
+ virtual const char *type_name() const override;
+
+ virtual int id_recalc_tag() const override;
+
+ virtual Node *create_node(const ID *id,
+ const char *subdata,
+ const char *name) const override;
+};
+
+/* Register typeinfo */
+void register_node_typeinfo(DepsNodeFactory *factory);
+
+/* Get typeinfo for specified type */
+DepsNodeFactory *type_get_factory(const NodeType type);
+
+} // namespace DEG
+
+#include "intern/node/deg_node_factory_impl.h"
diff --git a/source/blender/depsgraph/intern/node/deg_node_factory_impl.h b/source/blender/depsgraph/intern/node/deg_node_factory_impl.h
new file mode 100644
index 00000000000..f2d478d4c16
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node_factory_impl.h
@@ -0,0 +1,66 @@
+/*
+ * 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) 2019 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "intern/node/deg_node_factory.h"
+
+struct ID;
+
+namespace DEG {
+
+template <class ModeObjectType>
+NodeType DepsNodeFactoryImpl<ModeObjectType>::type() const
+{
+ return ModeObjectType::typeinfo.type;
+}
+
+template <class ModeObjectType>
+const char *DepsNodeFactoryImpl<ModeObjectType>::type_name() const {
+ return ModeObjectType::typeinfo.type_name;
+}
+
+template <class ModeObjectType>
+int DepsNodeFactoryImpl<ModeObjectType>::id_recalc_tag() const {
+ return ModeObjectType::typeinfo.id_recalc_tag;
+}
+
+template <class ModeObjectType>
+Node *DepsNodeFactoryImpl<ModeObjectType>::create_node(
+ const ID *id, const char *subdata, const char *name) const
+{
+ Node *node = OBJECT_GUARDED_NEW(ModeObjectType);
+ /* Populate base node settings. */
+ node->type = type();
+ /* Set name if provided, or use default type name. */
+ if (name[0] != '\0') {
+ node->name = name;
+ }
+ else {
+ node->name = type_name();
+ }
+ node->init(id, subdata);
+ return node;
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_id.cc b/source/blender/depsgraph/intern/node/deg_node_id.cc
index d431e68f904..d391f727d35 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_id.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_id.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,24 +15,20 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/nodes/deg_node_id.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
-#include "intern/nodes/deg_node_id.h"
+#include "intern/node/deg_node_id.h"
#include <stdio.h>
#include <cstring> /* required for STREQ later on. */
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
+#include "BLI_string.h"
extern "C" {
#include "DNA_ID.h"
@@ -47,65 +41,76 @@ extern "C" {
#include "DEG_depsgraph.h"
#include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/nodes/deg_node_time.h"
-#include "intern/depsgraph_intern.h"
-
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_time.h"
namespace DEG {
-IDDepsNode::ComponentIDKey::ComponentIDKey(eDepsNode_Type type,
+const char *linkedStateAsString(eDepsNode_LinkedState_Type linked_state)
+{
+ switch (linked_state) {
+ case DEG_ID_LINKED_INDIRECTLY: return "INDIRECTLY";
+ case DEG_ID_LINKED_VIA_SET: return "VIA_SET";
+ case DEG_ID_LINKED_DIRECTLY: return "DIRECTLY";
+ }
+ BLI_assert(!"Unhandled linked state, should never happen.");
+ return "UNKNOW";
+}
+
+IDNode::ComponentIDKey::ComponentIDKey(NodeType type,
const char *name)
: type(type), name(name)
{
}
-bool IDDepsNode::ComponentIDKey::operator== (const ComponentIDKey &other) const
+bool IDNode::ComponentIDKey::operator== (const ComponentIDKey &other) const
{
return type == other.type &&
- STREQ(name, other.name);
+ STREQ(name, other.name);
}
static unsigned int id_deps_node_hash_key(const void *key_v)
{
- const IDDepsNode::ComponentIDKey *key =
- reinterpret_cast<const IDDepsNode::ComponentIDKey *>(key_v);
- return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(key->type),
+ const IDNode::ComponentIDKey *key =
+ reinterpret_cast<const IDNode::ComponentIDKey *>(key_v);
+ const int type_as_int = static_cast<int>(key->type);
+ return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(type_as_int),
BLI_ghashutil_strhash_p(key->name));
}
static bool id_deps_node_hash_key_cmp(const void *a, const void *b)
{
- const IDDepsNode::ComponentIDKey *key_a =
- reinterpret_cast<const IDDepsNode::ComponentIDKey *>(a);
- const IDDepsNode::ComponentIDKey *key_b =
- reinterpret_cast<const IDDepsNode::ComponentIDKey *>(b);
+ const IDNode::ComponentIDKey *key_a =
+ reinterpret_cast<const IDNode::ComponentIDKey *>(a);
+ const IDNode::ComponentIDKey *key_b =
+ reinterpret_cast<const IDNode::ComponentIDKey *>(b);
return !(*key_a == *key_b);
}
static void id_deps_node_hash_key_free(void *key_v)
{
- typedef IDDepsNode::ComponentIDKey ComponentIDKey;
+ typedef IDNode::ComponentIDKey ComponentIDKey;
ComponentIDKey *key = reinterpret_cast<ComponentIDKey *>(key_v);
OBJECT_GUARDED_DELETE(key, ComponentIDKey);
}
static void id_deps_node_hash_value_free(void *value_v)
{
- ComponentDepsNode *comp_node = reinterpret_cast<ComponentDepsNode *>(value_v);
- OBJECT_GUARDED_DELETE(comp_node, ComponentDepsNode);
+ ComponentNode *comp_node = reinterpret_cast<ComponentNode *>(value_v);
+ OBJECT_GUARDED_DELETE(comp_node, ComponentNode);
}
/* Initialize 'id' node - from pointer data given. */
-void IDDepsNode::init(const ID *id, const char *UNUSED(subdata))
+void IDNode::init(const ID *id, const char *UNUSED(subdata))
{
BLI_assert(id != NULL);
/* Store ID-pointer. */
id_orig = (ID *)id;
eval_flags = 0;
previous_eval_flags = 0;
- customdata_mask = 0;
- previous_customdata_mask = 0;
+ customdata_masks = DEGCustomDataMeshMasks();
+ previous_customdata_masks = DEGCustomDataMeshMasks();
linked_state = DEG_ID_LINKED_INDIRECTLY;
is_directly_visible = true;
is_collection_fully_expanded = false;
@@ -118,12 +123,11 @@ void IDDepsNode::init(const ID *id, const char *UNUSED(subdata))
"Depsgraph id components hash");
}
-void IDDepsNode::init_copy_on_write(ID *id_cow_hint)
+void IDNode::init_copy_on_write(ID *id_cow_hint)
{
/* Create pointer as early as possible, so we can use it for function
* bindings. Rest of data we'll be copying to the new datablock when
- * it is actually needed.
- */
+ * it is actually needed. */
if (id_cow_hint != NULL) {
// BLI_assert(deg_copy_on_write_is_needed(id_orig));
if (deg_copy_on_write_is_needed(id_orig)) {
@@ -145,12 +149,12 @@ void IDDepsNode::init_copy_on_write(ID *id_cow_hint)
}
/* Free 'id' node. */
-IDDepsNode::~IDDepsNode()
+IDNode::~IDNode()
{
destroy();
}
-void IDDepsNode::destroy()
+void IDNode::destroy()
{
if (id_orig == NULL) {
return;
@@ -173,7 +177,7 @@ void IDDepsNode::destroy()
id_orig = NULL;
}
-string IDDepsNode::identifier() const
+string IDNode::identifier() const
{
char orig_ptr[24], cow_ptr[24];
BLI_snprintf(orig_ptr, sizeof(orig_ptr), "%p", id_orig);
@@ -184,20 +188,18 @@ string IDDepsNode::identifier() const
: "false") + ")";
}
-ComponentDepsNode *IDDepsNode::find_component(eDepsNode_Type type,
- const char *name) const
+ComponentNode *IDNode::find_component(NodeType type, const char *name) const
{
ComponentIDKey key(type, name);
- return reinterpret_cast<ComponentDepsNode *>(BLI_ghash_lookup(components, &key));
+ return reinterpret_cast<ComponentNode *>(BLI_ghash_lookup(components, &key));
}
-ComponentDepsNode *IDDepsNode::add_component(eDepsNode_Type type,
- const char *name)
+ComponentNode *IDNode::add_component(NodeType type, const char *name)
{
- ComponentDepsNode *comp_node = find_component(type, name);
+ ComponentNode *comp_node = find_component(type, name);
if (!comp_node) {
- DepsNodeFactory *factory = deg_type_get_factory(type);
- comp_node = (ComponentDepsNode *)factory->create_node(this->id_orig, "", name);
+ DepsNodeFactory *factory = type_get_factory(type);
+ comp_node = (ComponentNode *)factory->create_node(this->id_orig, "", name);
/* Register. */
ComponentIDKey *key = OBJECT_GUARDED_NEW(ComponentIDKey, type, name);
@@ -207,19 +209,19 @@ ComponentDepsNode *IDDepsNode::add_component(eDepsNode_Type type,
return comp_node;
}
-void IDDepsNode::tag_update(Depsgraph *graph, eDepsTag_Source source)
+void IDNode::tag_update(Depsgraph *graph, eUpdateSource source)
{
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, components)
{
comp_node->tag_update(graph, source);
}
GHASH_FOREACH_END();
}
-void IDDepsNode::finalize_build(Depsgraph *graph)
+void IDNode::finalize_build(Depsgraph *graph)
{
/* Finalize build of all components. */
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, components)
{
comp_node->finalize_build(graph);
}
@@ -227,14 +229,14 @@ void IDDepsNode::finalize_build(Depsgraph *graph)
visible_components_mask = get_visible_components_mask();
}
-IDComponentsMask IDDepsNode::get_visible_components_mask() const {
+IDComponentsMask IDNode::get_visible_components_mask() const {
IDComponentsMask result = 0;
- GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, components)
+ GHASH_FOREACH_BEGIN(ComponentNode *, comp_node, components)
{
if (comp_node->affects_directly_visible) {
- const int component_type = comp_node->type;
- BLI_assert(component_type < 64);
- result |= (1ULL << component_type);
+ const int component_type_as_int = static_cast<int>(comp_node->type);
+ BLI_assert(component_type_as_int < 64);
+ result |= (1ULL << component_type_as_int);
}
}
GHASH_FOREACH_END();
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_id.h b/source/blender/depsgraph/intern/node/deg_node_id.h
index a968794e3b2..bbf671790c7 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_id.h
+++ b/source/blender/depsgraph/intern/node/deg_node_id.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,51 +15,56 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file depsgraph/intern/nodes/deg_node_id.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
-#include "intern/nodes/deg_node.h"
+#include "intern/node/deg_node.h"
#include "BLI_sys_types.h"
namespace DEG {
-struct ComponentDepsNode;
+struct ComponentNode;
typedef uint64_t IDComponentsMask;
+/* NOTE: We use max comparison to mark an id node that is linked more than once
+ * So keep this enum ordered accordingly. */
+enum eDepsNode_LinkedState_Type {
+ /* Generic indirectly linked id node. */
+ DEG_ID_LINKED_INDIRECTLY = 0,
+ /* Id node present in the set (background) only. */
+ DEG_ID_LINKED_VIA_SET = 1,
+ /* Id node directly linked via the SceneLayer. */
+ DEG_ID_LINKED_DIRECTLY = 2,
+};
+const char *linkedStateAsString(eDepsNode_LinkedState_Type linked_state);
+
/* ID-Block Reference */
-struct IDDepsNode : public DepsNode {
+struct IDNode : public Node {
struct ComponentIDKey {
- ComponentIDKey(eDepsNode_Type type, const char *name = "");
+ ComponentIDKey(NodeType type, const char *name = "");
bool operator==(const ComponentIDKey &other) const;
- eDepsNode_Type type;
+ NodeType type;
const char *name;
};
virtual void init(const ID *id, const char *subdata) override;
void init_copy_on_write(ID *id_cow_hint = NULL);
- ~IDDepsNode();
+ ~IDNode();
void destroy();
virtual string identifier() const override;
- ComponentDepsNode *find_component(eDepsNode_Type type,
- const char *name = "") const;
- ComponentDepsNode *add_component(eDepsNode_Type type,
- const char *name = "");
+ ComponentNode *find_component(NodeType type, const char *name = "") const;
+ ComponentNode *add_component(NodeType type, const char *name = "");
- virtual void tag_update(Depsgraph *graph, eDepsTag_Source source) override;
+ virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
void finalize_build(Depsgraph *graph);
@@ -76,14 +79,13 @@ struct IDDepsNode : public DepsNode {
/* Additional flags needed for scene evaluation.
* TODO(sergey): Only needed for until really granular updates
- * of all the entities.
- */
+ * of all the entities. */
uint32_t eval_flags;
uint32_t previous_eval_flags;
/* Extra customdata mask which needs to be evaluated for the mesh object. */
- uint64_t customdata_mask;
- uint64_t previous_customdata_mask;
+ DEGCustomDataMeshMasks customdata_masks;
+ DEGCustomDataMeshMasks previous_customdata_masks;
eDepsNode_LinkedState_Type linked_state;
@@ -91,7 +93,7 @@ struct IDDepsNode : public DepsNode {
bool is_directly_visible;
/* For the collection type of ID, denotes whether collection was fully
- * recursed into. */
+ * recursed into. */
bool is_collection_fully_expanded;
IDComponentsMask visible_components_mask;
diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.cc b/source/blender/depsgraph/intern/node/deg_node_operation.cc
new file mode 100644
index 00000000000..893c108dc5a
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node_operation.cc
@@ -0,0 +1,209 @@
+/*
+ * 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) 2013 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#include "intern/node/deg_node_operation.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
+
+#include "intern/depsgraph.h"
+#include "intern/node/deg_node_factory.h"
+#include "intern/node/deg_node_component.h"
+#include "intern/node/deg_node_id.h"
+
+namespace DEG {
+
+const char *operationCodeAsString(OperationCode opcode)
+{
+ switch (opcode) {
+ /* Generic Operations. */
+ case OperationCode::OPERATION: return "OPERATION";
+ case OperationCode::ID_PROPERTY: return "ID_PROPERTY";
+ case OperationCode::PARAMETERS_ENTRY: return "PARAMETERS_ENTRY";
+ case OperationCode::PARAMETERS_EVAL: return "PARAMETERS_EVAL";
+ case OperationCode::PARAMETERS_EXIT: return "PARAMETERS_EXIT";
+ /* Animation, Drivers, etc. */
+ case OperationCode::ANIMATION_ENTRY: return "ANIMATION_ENTRY";
+ case OperationCode::ANIMATION_EVAL: return "ANIMATION_EVAL";
+ case OperationCode::ANIMATION_EXIT: return "ANIMATION_EXIT";
+ case OperationCode::DRIVER: return "DRIVER";
+ /* Scene related. */
+ case OperationCode::SCENE_EVAL: return "SCENE_EVAL";
+ /* Object related. */
+ case OperationCode::OBJECT_BASE_FLAGS: return "OBJECT_BASE_FLAGS";
+ /* Transform. */
+ case OperationCode::TRANSFORM_INIT: return "TRANSFORM_INIT";
+ case OperationCode::TRANSFORM_LOCAL: return "TRANSFORM_LOCAL";
+ case OperationCode::TRANSFORM_PARENT: return "TRANSFORM_PARENT";
+ case OperationCode::TRANSFORM_CONSTRAINTS:
+ return "TRANSFORM_CONSTRAINTS";
+ case OperationCode::TRANSFORM_FINAL: return "TRANSFORM_FINAL";
+ case OperationCode::TRANSFORM_EVAL: return "TRANSFORM_EVAL";
+ /* Rigid body. */
+ case OperationCode::RIGIDBODY_REBUILD: return "RIGIDBODY_REBUILD";
+ case OperationCode::RIGIDBODY_SIM: return "RIGIDBODY_SIM";
+ case OperationCode::RIGIDBODY_TRANSFORM_COPY:
+ return "RIGIDBODY_TRANSFORM_COPY";
+ /* Geometry. */
+ case OperationCode::GEOMETRY_EVAL_INIT: return "GEOMETRY_EVAL_INIT";
+ case OperationCode::GEOMETRY_EVAL: return "GEOMETRY_EVAL";
+ case OperationCode::GEOMETRY_EVAL_DONE: return "GEOMETRY_EVAL_DONE";
+ case OperationCode::GEOMETRY_SHAPEKEY: return "GEOMETRY_SHAPEKEY";
+ /* Object data. */
+ case OperationCode::LIGHT_PROBE_EVAL: return "LIGHT_PROBE_EVAL";
+ case OperationCode::SPEAKER_EVAL: return "SPEAKER_EVAL";
+ case OperationCode::ARMATURE_EVAL: return "ARMATURE_EVAL";
+ /* Pose. */
+ case OperationCode::POSE_INIT: return "POSE_INIT";
+ case OperationCode::POSE_INIT_IK: return "POSE_INIT_IK";
+ case OperationCode::POSE_CLEANUP: return "POSE_CLEANUP";
+ case OperationCode::POSE_DONE: return "POSE_DONE";
+ case OperationCode::POSE_IK_SOLVER: return "POSE_IK_SOLVER";
+ case OperationCode::POSE_SPLINE_IK_SOLVER:
+ return "POSE_SPLINE_IK_SOLVER";
+ /* Bone. */
+ case OperationCode::BONE_LOCAL: return "BONE_LOCAL";
+ case OperationCode::BONE_POSE_PARENT: return "BONE_POSE_PARENT";
+ case OperationCode::BONE_CONSTRAINTS: return "BONE_CONSTRAINTS";
+ case OperationCode::BONE_READY: return "BONE_READY";
+ case OperationCode::BONE_DONE: return "BONE_DONE";
+ case OperationCode::BONE_SEGMENTS: return "BONE_SEGMENTS";
+ /* Particle System. */
+ case OperationCode::PARTICLE_SYSTEM_INIT: return "PARTICLE_SYSTEM_INIT";
+ case OperationCode::PARTICLE_SYSTEM_EVAL: return "PARTICLE_SYSTEM_EVAL";
+ case OperationCode::PARTICLE_SYSTEM_DONE: return "PARTICLE_SYSTEM_DONE";
+ /* Particles Settings. */
+ case OperationCode::PARTICLE_SETTINGS_INIT:
+ return "PARTICLE_SETTINGS_INIT";
+ case OperationCode::PARTICLE_SETTINGS_EVAL:
+ return "PARTICLE_SETTINGS_EVAL";
+ case OperationCode::PARTICLE_SETTINGS_RESET:
+ return "PARTICLE_SETTINGS_RESET";
+ /* Point Cache. */
+ case OperationCode::POINT_CACHE_RESET: return "POINT_CACHE_RESET";
+ /* File cache. */
+ case OperationCode::FILE_CACHE_UPDATE: return "FILE_CACHE_UPDATE";
+ /* Batch cache. */
+ case OperationCode::GEOMETRY_SELECT_UPDATE:
+ return "GEOMETRY_SELECT_UPDATE";
+ /* Masks. */
+ case OperationCode::MASK_ANIMATION: return "MASK_ANIMATION";
+ case OperationCode::MASK_EVAL: return "MASK_EVAL";
+ /* Collections. */
+ case OperationCode::VIEW_LAYER_EVAL: return "VIEW_LAYER_EVAL";
+ /* Copy on write. */
+ case OperationCode::COPY_ON_WRITE: return "COPY_ON_WRITE";
+ /* Shading. */
+ case OperationCode::SHADING: return "SHADING";
+ case OperationCode::MATERIAL_UPDATE: return "MATERIAL_UPDATE";
+ case OperationCode::WORLD_UPDATE: return "WORLD_UPDATE";
+ /* Movie clip. */
+ case OperationCode::MOVIECLIP_EVAL: return "MOVIECLIP_EVAL";
+ case OperationCode::MOVIECLIP_SELECT_UPDATE:
+ return "MOVIECLIP_SELECT_UPDATE";
+ /* Image. */
+ case OperationCode::IMAGE_ANIMATION: return "IMAGE_ANIMATION";
+ /* Synchronization. */
+ case OperationCode::SYNCHRONIZE_TO_ORIGINAL:
+ return "SYNCHRONIZE_TO_ORIGINAL";
+ /* Generic datablock. */
+ case OperationCode::GENERIC_DATABLOCK_UPDATE:
+ return "GENERIC_DATABLOCK_UPDATE";
+ /* instancing/duplication. */
+ case OperationCode::DUPLI: return "DUPLI";
+ }
+ BLI_assert(!"Unhandled operation code, should never happen.");
+ return "UNKNOWN";
+}
+
+OperationNode::OperationNode() :
+ name_tag(-1),
+ flag(0)
+{
+}
+
+OperationNode::~OperationNode()
+{
+}
+
+string OperationNode::identifier() const
+{
+ return string(operationCodeAsString(opcode)) + "(" + name + ")";
+}
+
+/* Full node identifier, including owner name.
+ * used for logging and debug prints. */
+string OperationNode::full_identifier() const
+{
+ string owner_str = "";
+ if (owner->type == NodeType::BONE) {
+ owner_str = string(owner->owner->name) + "." + owner->name;
+ }
+ else {
+ owner_str = owner->owner->name;
+ }
+ return owner_str + "." + identifier();
+}
+
+void OperationNode::tag_update(Depsgraph *graph, eUpdateSource source)
+{
+ if ((flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
+ graph->add_entry_tag(this);
+ }
+ /* Tag for update, but also note that this was the source of an update. */
+ flag |= (DEPSOP_FLAG_NEEDS_UPDATE | DEPSOP_FLAG_DIRECTLY_MODIFIED);
+ switch (source) {
+ case DEG_UPDATE_SOURCE_TIME:
+ case DEG_UPDATE_SOURCE_RELATIONS:
+ case DEG_UPDATE_SOURCE_VISIBILITY:
+ /* Currently nothing. */
+ break;
+ case DEG_UPDATE_SOURCE_USER_EDIT:
+ flag |= DEPSOP_FLAG_USER_MODIFIED;
+ break;
+ }
+}
+
+void OperationNode::set_as_entry()
+{
+ BLI_assert(owner != NULL);
+ owner->set_entry_operation(this);
+}
+
+void OperationNode::set_as_exit()
+{
+ BLI_assert(owner != NULL);
+ owner->set_exit_operation(this);
+}
+
+DEG_DEPSNODE_DEFINE(OperationNode, NodeType::OPERATION, "Operation");
+static DepsNodeFactoryImpl<OperationNode> DNTI_OPERATION;
+
+void deg_register_operation_depsnodes()
+{
+ register_node_typeinfo(&DNTI_OPERATION);
+}
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.h b/source/blender/depsgraph/intern/node/deg_node_operation.h
new file mode 100644
index 00000000000..c6db7b012d7
--- /dev/null
+++ b/source/blender/depsgraph/intern/node/deg_node_operation.h
@@ -0,0 +1,254 @@
+/*
+ * 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) 2013 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "intern/node/deg_node.h"
+
+#include "intern/depsgraph_type.h"
+
+struct Depsgraph;
+struct ID;
+
+namespace DEG {
+
+struct ComponentNode;
+
+/* Evaluation Operation for atomic operation */
+// XXX: move this to another header that can be exposed?
+typedef function<void(struct ::Depsgraph *)> DepsEvalOperationCb;
+
+/* Identifiers for common operations (as an enum). */
+enum class OperationCode {
+ /* Generic Operations. -------------------------------------------------- */
+
+ /* Placeholder for operations which don't need special mention */
+ OPERATION = 0,
+
+ /* Generic parameters evaluation. */
+ ID_PROPERTY,
+ PARAMETERS_ENTRY,
+ PARAMETERS_EVAL,
+ PARAMETERS_EXIT,
+
+ /* Animation, Drivers, etc. --------------------------------------------- */
+ /* NLA + Action */
+ ANIMATION_ENTRY,
+ ANIMATION_EVAL,
+ ANIMATION_EXIT,
+ /* Driver */
+ DRIVER,
+
+ /* Scene related. ------------------------------------------------------- */
+ SCENE_EVAL,
+
+ /* Object related. ------------------------------------------------------ */
+ OBJECT_BASE_FLAGS,
+
+ /* Transform. ----------------------------------------------------------- */
+ /* Transform entry point. */
+ TRANSFORM_INIT,
+ /* Local transforms only */
+ TRANSFORM_LOCAL,
+ /* Parenting */
+ TRANSFORM_PARENT,
+ /* Constraints */
+ TRANSFORM_CONSTRAINTS,
+ /* Handle object-level updates, mainly proxies hacks and recalc flags. */
+ TRANSFORM_EVAL,
+ /* Transform exit point */
+ TRANSFORM_FINAL,
+
+ /* Rigid body. ---------------------------------------------------------- */
+ /* Perform Simulation */
+ RIGIDBODY_REBUILD,
+ RIGIDBODY_SIM,
+ /* Copy results to object */
+ RIGIDBODY_TRANSFORM_COPY,
+
+ /* Geometry. ------------------------------------------------------------ */
+
+ /* Initialize evaluation of the geometry. Is an entry operation of geometry
+ * component. */
+ GEOMETRY_EVAL_INIT,
+ /* Evaluate the whole geometry, including modifiers. */
+ GEOMETRY_EVAL,
+ /* Evaluation of geometry is completely done.. */
+ GEOMETRY_EVAL_DONE,
+ /* Evaluation of a shape key.
+ * NOTE: Currently only for object data datablocks. */
+ GEOMETRY_SHAPEKEY,
+
+ /* Object data. --------------------------------------------------------- */
+ LIGHT_PROBE_EVAL,
+ SPEAKER_EVAL,
+ ARMATURE_EVAL,
+
+ /* Pose. ---------------------------------------------------------------- */
+ /* Init pose, clear flags, etc. */
+ POSE_INIT,
+ /* Initialize IK solver related pose stuff. */
+ POSE_INIT_IK,
+ /* Pose is evaluated, and runtime data can be freed. */
+ POSE_CLEANUP,
+ /* Pose has been fully evaluated and ready to be used by others. */
+ POSE_DONE,
+ /* IK/Spline Solvers */
+ POSE_IK_SOLVER,
+ POSE_SPLINE_IK_SOLVER,
+
+ /* Bone. ---------------------------------------------------------------- */
+ /* Bone local transforms - entry point */
+ BONE_LOCAL,
+ /* Pose-space conversion (includes parent + restpose, */
+ BONE_POSE_PARENT,
+ /* Constraints */
+ BONE_CONSTRAINTS,
+ /* Bone transforms are ready
+ *
+ * - "READY" This (internal, noop is used to signal that all pre-IK
+ * operations are done. Its role is to help mediate situations
+ * where cyclic relations may otherwise form (i.e. one bone in
+ * chain targeting another in same chain,
+ *
+ * - "DONE" This noop is used to signal that the bone's final pose
+ * transform can be read by others. */
+ // TODO: deform mats could get calculated in the final_transform ops...
+ BONE_READY,
+ BONE_DONE,
+ /* B-Bone segment shape computation (after DONE) */
+ BONE_SEGMENTS,
+
+ /* Particle System. ----------------------------------------------------- */
+ PARTICLE_SYSTEM_INIT,
+ PARTICLE_SYSTEM_EVAL,
+ PARTICLE_SYSTEM_DONE,
+
+ /* Particle Settings. --------------------------------------------------- */
+ PARTICLE_SETTINGS_INIT,
+ PARTICLE_SETTINGS_EVAL,
+ PARTICLE_SETTINGS_RESET,
+
+ /* Point Cache. --------------------------------------------------------- */
+ POINT_CACHE_RESET,
+
+ /* File cache. ---------------------------------------------------------- */
+ FILE_CACHE_UPDATE,
+
+ /* Collections. --------------------------------------------------------- */
+ VIEW_LAYER_EVAL,
+
+ /* Copy on Write. ------------------------------------------------------- */
+ COPY_ON_WRITE,
+
+ /* Shading. ------------------------------------------------------------- */
+ SHADING,
+ MATERIAL_UPDATE,
+ WORLD_UPDATE,
+
+ /* Batch caches. -------------------------------------------------------- */
+ GEOMETRY_SELECT_UPDATE,
+
+ /* Masks. --------------------------------------------------------------- */
+ MASK_ANIMATION,
+ MASK_EVAL,
+
+ /* Movie clips. --------------------------------------------------------- */
+ MOVIECLIP_EVAL,
+ MOVIECLIP_SELECT_UPDATE,
+
+ /* Images. -------------------------------------------------------------- */
+ IMAGE_ANIMATION,
+
+ /* Synchronization clips. ----------------------------------------------- */
+ SYNCHRONIZE_TO_ORIGINAL,
+
+ /* Generic datablock ---------------------------------------------------- */
+ GENERIC_DATABLOCK_UPDATE,
+
+ /* Duplication/instancing system. --------------------------------------- */
+ DUPLI,
+};
+const char *operationCodeAsString(OperationCode opcode);
+
+/* Flags for Depsgraph Nodes.
+ * NOTE: IS a bit shifts to allow usage as an accumulated. bitmask.
+ */
+enum OperationFlag {
+ /* Node needs to be updated. */
+ DEPSOP_FLAG_NEEDS_UPDATE = (1 << 0),
+ /* Node was directly modified, causing need for update. */
+ DEPSOP_FLAG_DIRECTLY_MODIFIED = (1 << 1),
+ /* Node was updated due to user input. */
+ DEPSOP_FLAG_USER_MODIFIED = (1 << 2),
+
+ /* Set of flags which gets flushed along the relations. */
+ DEPSOP_FLAG_FLUSH = (DEPSOP_FLAG_USER_MODIFIED),
+};
+
+/* Atomic Operation - Base type for all operations */
+struct OperationNode : public Node {
+ OperationNode();
+ ~OperationNode();
+
+ virtual string identifier() const override;
+ string full_identifier() const;
+
+ virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
+
+ bool is_noop() const { return (bool)evaluate == false; }
+
+ virtual OperationNode *get_entry_operation() override {
+ return this;
+ }
+ virtual OperationNode *get_exit_operation() override {
+ return this;
+ }
+
+ /* Set this operation as component's entry/exit operation. */
+ void set_as_entry();
+ void set_as_exit();
+
+ /* Component that contains the operation. */
+ ComponentNode *owner;
+
+ /* Callback for operation. */
+ DepsEvalOperationCb evaluate;
+
+ /* How many inlinks are we still waiting on before we can be evaluated. */
+ uint32_t num_links_pending;
+ bool scheduled;
+
+ /* Identifier for the operation being performed. */
+ OperationCode opcode;
+ int name_tag;
+
+ /* (OperationFlag) extra settings affecting evaluation. */
+ int flag;
+
+ DEG_DEPSNODE_DECLARE;
+};
+
+void deg_register_operation_depsnodes();
+
+} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_time.cc b/source/blender/depsgraph/intern/node/deg_node_time.cc
index a788b999305..24d99d23c25 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_time.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_time.cc
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,31 +15,24 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/intern/nodes/deg_node_time.cc
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
-#include "intern/nodes/deg_node_time.h"
-
-#include "intern/depsgraph_intern.h"
-#include "util/deg_util_foreach.h"
+#include "intern/node/deg_node_time.h"
#include "DNA_scene_types.h"
+#include "intern/depsgraph.h"
+
namespace DEG {
-void TimeSourceDepsNode::tag_update(Depsgraph *graph,
- eDepsTag_Source /*source*/)
+void TimeSourceNode::tag_update(Depsgraph *graph, eUpdateSource /*source*/)
{
- foreach (DepsRelation *rel, outlinks) {
- DepsNode *node = rel->to;
+ for (Relation *rel : outlinks) {
+ Node *node = rel->to;
node->tag_update(graph, DEG_UPDATE_SOURCE_TIME);
}
}
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_time.h b/source/blender/depsgraph/intern/node/deg_node_time.h
index 7253dc106d4..44b67ebc307 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_time.h
+++ b/source/blender/depsgraph/intern/node/deg_node_time.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,20 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file depsgraph/intern/nodes/deg_node_time.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup depsgraph
*/
#pragma once
-#include "intern/nodes/deg_node.h"
+#include "intern/node/deg_node.h"
namespace DEG {
/* Time Source Node. */
-struct TimeSourceDepsNode : public DepsNode {
+struct TimeSourceNode : public Node {
/* New "current time". */
float cfra;
@@ -44,7 +37,7 @@ struct TimeSourceDepsNode : public DepsNode {
// TODO: evaluate() operation needed
- virtual void tag_update(Depsgraph *graph, eDepsTag_Source source) override;
+ virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
DEG_DEPSNODE_DECLARE;
};
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc b/source/blender/depsgraph/intern/nodes/deg_node.cc
deleted file mode 100644
index 3e2c48e9096..00000000000
--- a/source/blender/depsgraph/intern/nodes/deg_node.cc
+++ /dev/null
@@ -1,137 +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) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/nodes/deg_node.cc
- * \ingroup depsgraph
- */
-
-#include "intern/nodes/deg_node.h"
-
-#include <stdio.h>
-
-#include "BLI_utildefines.h"
-
-#include "intern/eval/deg_eval_copy_on_write.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_id.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/nodes/deg_node_time.h"
-#include "intern/depsgraph_intern.h"
-
-#include "util/deg_util_foreach.h"
-#include "util/deg_util_function.h"
-
-namespace DEG {
-
-/*******************************************************************************
- * Type information.
- */
-
-DepsNode::TypeInfo::TypeInfo(eDepsNode_Type type,
- const char *tname,
- int id_recalc_tag)
- : type(type),
- tname(tname),
- id_recalc_tag(id_recalc_tag)
-{
-}
-
-/*******************************************************************************
- * Evaluation statistics.
- */
-
-DepsNode::Stats::Stats()
-{
- reset();
-}
-
-void DepsNode::Stats::reset()
-{
- current_time = 0.0;
-}
-
-void DepsNode::Stats::reset_current()
-{
- current_time = 0.0;
-}
-
-/*******************************************************************************
- * Node itself.
- */
-
-DepsNode::DepsNode()
-{
- name = "";
-}
-
-DepsNode::~DepsNode()
-{
- /* Free links. */
- /* NOTE: We only free incoming links. This is to avoid double-free of links
- * when we're trying to free same link from both it's sides. We don't have
- * dangling links so this is not a problem from memory leaks point of view.
- */
- foreach (DepsRelation *rel, inlinks) {
- OBJECT_GUARDED_DELETE(rel, DepsRelation);
- }
-}
-
-
-/* Generic identifier for Depsgraph Nodes. */
-string DepsNode::identifier() const
-{
- return string(nodeTypeAsString(type)) + " : " + name;
-}
-
-eDepsNode_Class DepsNode::get_class() const {
- if (type == DEG_NODE_TYPE_OPERATION) {
- return DEG_NODE_CLASS_OPERATION;
- }
- else if (type < DEG_NODE_TYPE_PARAMETERS) {
- return DEG_NODE_CLASS_GENERIC;
- }
- else {
- return DEG_NODE_CLASS_COMPONENT;
- }
-}
-
-/*******************************************************************************
- * Generic nodes definition.
- */
-
-DEG_DEPSNODE_DEFINE(TimeSourceDepsNode, DEG_NODE_TYPE_TIMESOURCE, "Time Source");
-static DepsNodeFactoryImpl<TimeSourceDepsNode> DNTI_TIMESOURCE;
-
-DEG_DEPSNODE_DEFINE(IDDepsNode, DEG_NODE_TYPE_ID_REF, "ID Node");
-static DepsNodeFactoryImpl<IDDepsNode> DNTI_ID_REF;
-
-void deg_register_base_depsnodes()
-{
- deg_register_node_typeinfo(&DNTI_TIMESOURCE);
- deg_register_node_typeinfo(&DNTI_ID_REF);
-}
-
-} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.h b/source/blender/depsgraph/intern/nodes/deg_node.h
deleted file mode 100644
index 7a837d17ceb..00000000000
--- a/source/blender/depsgraph/intern/nodes/deg_node.h
+++ /dev/null
@@ -1,118 +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) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file depsgraph/intern/nodes/deg_node.h
- * \ingroup depsgraph
- */
-
-#pragma once
-
-#include "intern/depsgraph_types.h"
-
-#include "BLI_utildefines.h"
-
-struct ID;
-struct GHash;
-struct Scene;
-
-namespace DEG {
-
-struct Depsgraph;
-struct DepsRelation;
-struct OperationDepsNode;
-
-/* *********************************** */
-/* Base-Defines for Nodes in Depsgraph */
-
-/* All nodes in Depsgraph are descended from this. */
-struct DepsNode {
- /* Helper class for static typeinfo in subclasses. */
- struct TypeInfo {
- TypeInfo(eDepsNode_Type type, const char *tname, int id_recalc_tag = 0);
- eDepsNode_Type type;
- const char *tname;
- int id_recalc_tag;
- };
- struct Stats {
- Stats();
- /* Reset all the counters. Including all stats needed for average
- * evaluation time calculation.
- */
- void reset();
- /* Reset counters needed for the current graph evaluation, does not
- * touch averaging accumulators.
- */
- void reset_current();
- /* Time spend on this node during current graph evaluation. */
- double current_time;
- };
- /* Relationships between nodes
- * The reason why all depsgraph nodes are descended from this type (apart
- * from basic serialization benefits - from the typeinfo) is that we can have
- * relationships between these nodes!
- */
- typedef vector<DepsRelation *> Relations;
-
- const char *name; /* Identifier - mainly for debugging purposes. */
- eDepsNode_Type type; /* Structural type of node. */
- Relations inlinks; /* Nodes which this one depends on. */
- Relations outlinks; /* Nodes which depend on this one. */
- Stats stats; /* Evaluation statistics. */
-
- /* Generic tags for traversal algorithms and such.
- *
- * Actual meaning of values depends on a specific area. Every area is to
- * clean this before use.
- */
- int custom_flags;
-
- /* Methods. */
- DepsNode();
- virtual ~DepsNode();
-
- virtual string identifier() const;
-
- virtual void init(const ID * /*id*/,
- const char * /*subdata*/) {}
-
- virtual void tag_update(Depsgraph * /*graph*/,
- eDepsTag_Source /*source*/) {}
-
- virtual OperationDepsNode *get_entry_operation() { return NULL; }
- virtual OperationDepsNode *get_exit_operation() { return NULL; }
-
- virtual eDepsNode_Class get_class() const;
-};
-
-/* Macros for common static typeinfo. */
-#define DEG_DEPSNODE_DECLARE \
- static const DepsNode::TypeInfo typeinfo
-#define DEG_DEPSNODE_DEFINE(NodeType, type_, tname_) \
- const DepsNode::TypeInfo NodeType::typeinfo = DepsNode::TypeInfo(type_, tname_)
-
-void deg_register_base_depsnodes();
-
-} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_operation.cc b/source/blender/depsgraph/intern/nodes/deg_node_operation.cc
deleted file mode 100644
index f6fee6acf23..00000000000
--- a/source/blender/depsgraph/intern/nodes/deg_node_operation.cc
+++ /dev/null
@@ -1,116 +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) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/nodes/deg_node_operation.cc
- * \ingroup depsgraph
- */
-
-#include "intern/nodes/deg_node_operation.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
-
-#include "intern/depsgraph.h"
-#include "intern/depsgraph_intern.h"
-#include "intern/nodes/deg_node_id.h"
-
-namespace DEG {
-
-/* *********** */
-/* Inner Nodes */
-
-OperationDepsNode::OperationDepsNode() :
- name_tag(-1),
- flag(0)
-{
-}
-
-OperationDepsNode::~OperationDepsNode()
-{
-}
-
-string OperationDepsNode::identifier() const
-{
- return string(operationCodeAsString(opcode)) + "(" + name + ")";
-}
-
-/* Full node identifier, including owner name.
- * used for logging and debug prints.
- */
-string OperationDepsNode::full_identifier() const
-{
- string owner_str = "";
- if (owner->type == DEG_NODE_TYPE_BONE) {
- owner_str = string(owner->owner->name) + "." + owner->name;
- }
- else {
- owner_str = owner->owner->name;
- }
- return owner_str + "." + identifier();
-}
-
-void OperationDepsNode::tag_update(Depsgraph *graph, eDepsTag_Source source)
-{
- if ((flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
- graph->add_entry_tag(this);
- }
- /* Tag for update, but also note that this was the source of an update. */
- flag |= (DEPSOP_FLAG_NEEDS_UPDATE | DEPSOP_FLAG_DIRECTLY_MODIFIED);
- switch (source) {
- case DEG_UPDATE_SOURCE_TIME:
- case DEG_UPDATE_SOURCE_RELATIONS:
- case DEG_UPDATE_SOURCE_VISIBILITY:
- /* Currently nothing. */
- break;
- case DEG_UPDATE_SOURCE_USER_EDIT:
- flag |= DEPSOP_FLAG_USER_MODIFIED;
- break;
- }
-}
-
-void OperationDepsNode::set_as_entry()
-{
- BLI_assert(owner != NULL);
- owner->set_entry_operation(this);
-}
-
-void OperationDepsNode::set_as_exit()
-{
- BLI_assert(owner != NULL);
- owner->set_exit_operation(this);
-}
-
-DEG_DEPSNODE_DEFINE(OperationDepsNode, DEG_NODE_TYPE_OPERATION, "Operation");
-static DepsNodeFactoryImpl<OperationDepsNode> DNTI_OPERATION;
-
-void deg_register_operation_depsnodes()
-{
- deg_register_node_typeinfo(&DNTI_OPERATION);
-}
-
-} // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_operation.h b/source/blender/depsgraph/intern/nodes/deg_node_operation.h
deleted file mode 100644
index 9ba3a0b4864..00000000000
--- a/source/blender/depsgraph/intern/nodes/deg_node_operation.h
+++ /dev/null
@@ -1,101 +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) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Joshua Leung
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/nodes/deg_node_operation.h
- * \ingroup depsgraph
- */
-
-#pragma once
-
-#include "intern/nodes/deg_node.h"
-
-struct ID;
-
-struct Depsgraph;
-
-namespace DEG {
-
-struct ComponentDepsNode;
-
-/* Flags for Depsgraph Nodes. */
-typedef enum eDepsOperation_Flag {
- /* Node needs to be updated. */
- DEPSOP_FLAG_NEEDS_UPDATE = (1 << 0),
- /* Node was directly modified, causing need for update. */
- DEPSOP_FLAG_DIRECTLY_MODIFIED = (1 << 1),
- /* Node was updated due to user input. */
- DEPSOP_FLAG_USER_MODIFIED = (1 << 2),
-
- /* Set of flags which gets flushed along the relations. */
- DEPSOP_FLAG_FLUSH = (DEPSOP_FLAG_USER_MODIFIED)
-} eDepsOperation_Flag;
-
-/* Atomic Operation - Base type for all operations */
-struct OperationDepsNode : public DepsNode {
- OperationDepsNode();
- ~OperationDepsNode();
-
- virtual string identifier() const override;
- string full_identifier() const;
-
- virtual void tag_update(Depsgraph *graph, eDepsTag_Source source) override;
-
- bool is_noop() const { return (bool)evaluate == false; }
-
- virtual OperationDepsNode *get_entry_operation() override {
- return this;
- }
- virtual OperationDepsNode *get_exit_operation() override {
- return this;
- }
-
- /* Set this operation as component's entry/exit operation. */
- void set_as_entry();
- void set_as_exit();
-
- /* Component that contains the operation. */
- ComponentDepsNode *owner;
-
- /* Callback for operation. */
- DepsEvalOperationCb evaluate;
-
- /* How many inlinks are we still waiting on before we can be evaluated. */
- uint32_t num_links_pending;
- bool scheduled;
-
- /* Identifier for the operation being performed. */
- eDepsOperation_Code opcode;
- int name_tag;
-
- /* (eDepsOperation_Flag) extra settings affecting evaluation. */
- int flag;
-
- DEG_DEPSNODE_DECLARE;
-};
-
-void deg_register_operation_depsnodes();
-
-} // namespace DEG
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index 10734ec985e..0503dc61e80 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Blender Institute
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -69,10 +64,10 @@ set(SRC
intern/draw_manager.c
intern/draw_manager_data.c
intern/draw_manager_exec.c
+ intern/draw_manager_profiling.c
intern/draw_manager_shader.c
intern/draw_manager_text.c
intern/draw_manager_texture.c
- intern/draw_manager_profiling.c
intern/draw_view.c
modes/edit_armature_mode.c
modes/edit_curve_mode.c
@@ -85,7 +80,6 @@ set(SRC
modes/overlay_mode.c
modes/paint_texture_mode.c
modes/paint_vertex_mode.c
- modes/paint_weight_mode.c
modes/particle_mode.c
modes/pose_mode.c
modes/sculpt_mode.c
@@ -109,26 +103,27 @@ set(SRC
engines/eevee/eevee_subsurface.c
engines/eevee/eevee_temporal_sampling.c
engines/eevee/eevee_volumes.c
+ engines/workbench/solid_mode.c
+ engines/workbench/transparent_mode.c
engines/workbench/workbench_data.c
- engines/workbench/workbench_engine.c
engines/workbench/workbench_deferred.c
engines/workbench/workbench_effect_aa.c
+ engines/workbench/workbench_effect_dof.c
engines/workbench/workbench_effect_fxaa.c
engines/workbench/workbench_effect_taa.c
+ engines/workbench/workbench_engine.c
engines/workbench/workbench_forward.c
engines/workbench/workbench_materials.c
engines/workbench/workbench_render.c
engines/workbench/workbench_studiolight.c
engines/workbench/workbench_volume.c
- engines/workbench/solid_mode.c
- engines/workbench/transparent_mode.c
engines/external/external_engine.c
- engines/gpencil/gpencil_engine.h
- engines/gpencil/gpencil_engine.c
- engines/gpencil/gpencil_render.c
engines/gpencil/gpencil_cache_utils.c
- engines/gpencil/gpencil_draw_utils.c
engines/gpencil/gpencil_draw_cache_impl.c
+ engines/gpencil/gpencil_draw_utils.c
+ engines/gpencil/gpencil_engine.c
+ engines/gpencil/gpencil_engine.h
+ engines/gpencil/gpencil_render.c
engines/gpencil/gpencil_shader_fx.c
engines/lanpr/lanpr_dpix.c
engines/lanpr/lanpr_engine.c
@@ -146,8 +141,8 @@ set(SRC
intern/draw_hair_private.h
intern/draw_instance_data.h
intern/draw_manager.h
- intern/draw_manager_text.h
intern/draw_manager_profiling.h
+ intern/draw_manager_text.h
intern/draw_view.h
modes/draw_mode_engines.h
modes/edit_mesh_mode_intern.h
@@ -169,7 +164,7 @@ data_to_c_simple(engines/eevee/shaders/default_world_frag.glsl SRC)
data_to_c_simple(engines/eevee/shaders/background_vert.glsl SRC)
data_to_c_simple(engines/eevee/shaders/concentric_samples_lib.glsl SRC)
data_to_c_simple(engines/eevee/shaders/common_uniforms_lib.glsl SRC)
-data_to_c_simple(engines/eevee/shaders/lamps_lib.glsl SRC)
+data_to_c_simple(engines/eevee/shaders/lights_lib.glsl SRC)
data_to_c_simple(engines/eevee/shaders/lightprobe_lib.glsl SRC)
data_to_c_simple(engines/eevee/shaders/lightprobe_filter_glossy_frag.glsl SRC)
data_to_c_simple(engines/eevee/shaders/lightprobe_filter_diffuse_frag.glsl SRC)
@@ -233,6 +228,7 @@ data_to_c_simple(engines/workbench/shaders/workbench_common_lib.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_data_lib.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_deferred_composite_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_deferred_background_frag.glsl SRC)
+data_to_c_simple(engines/workbench/shaders/workbench_effect_dof_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_effect_fxaa_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_effect_taa_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_forward_composite_frag.glsl SRC)
@@ -293,11 +289,7 @@ data_to_c_simple(modes/shaders/armature_dof_vert.glsl SRC)
data_to_c_simple(modes/shaders/edit_mesh_overlay_common_lib.glsl SRC)
data_to_c_simple(modes/shaders/edit_mesh_overlay_frag.glsl SRC)
data_to_c_simple(modes/shaders/edit_mesh_overlay_vert.glsl SRC)
-data_to_c_simple(modes/shaders/edit_mesh_overlay_geom_tri.glsl SRC)
-data_to_c_simple(modes/shaders/edit_mesh_overlay_geom_edge.glsl SRC)
-data_to_c_simple(modes/shaders/edit_mesh_overlay_points_vert.glsl SRC)
-data_to_c_simple(modes/shaders/edit_mesh_overlay_facedot_frag.glsl SRC)
-data_to_c_simple(modes/shaders/edit_mesh_overlay_facedot_vert.glsl SRC)
+data_to_c_simple(modes/shaders/edit_mesh_overlay_geom.glsl SRC)
data_to_c_simple(modes/shaders/edit_mesh_overlay_mix_frag.glsl SRC)
data_to_c_simple(modes/shaders/edit_mesh_overlay_facefill_vert.glsl SRC)
data_to_c_simple(modes/shaders/edit_mesh_overlay_facefill_frag.glsl SRC)
diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index d790cee48bb..e261de3c900 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file DRW_engine.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRW_ENGINE_H__
@@ -29,29 +26,28 @@
#include "BLI_sys_types.h" /* for bool */
struct ARegion;
-struct CollectionEngineSettings;
-struct Depsgraph;
-struct DRWPass;
struct DRWInstanceDataList;
-struct Main;
-struct Material;
-struct Scene;
+struct DRWPass;
+struct Depsgraph;
struct DrawEngineType;
-struct ID;
-struct IDProperty;
-struct bContext;
-struct Object;
-struct ViewLayer;
-struct ViewContext;
-struct ViewportEngineData;
-struct View3D;
-struct rcti;
struct GPUMaterial;
struct GPUOffScreen;
struct GPUViewport;
+struct ID;
+struct IDProperty;
+struct Main;
+struct Material;
+struct Object;
struct RenderEngine;
struct RenderEngineType;
+struct Scene;
+struct View3D;
+struct ViewContext;
+struct ViewLayer;
+struct ViewportEngineData;
struct WorkSpace;
+struct bContext;
+struct rcti;
#include "DNA_object_enums.h"
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c
index 885c449c4e3..2f1708f56be 100644
--- a/source/blender/draw/engines/basic/basic_engine.c
+++ b/source/blender/draw/engines/basic/basic_engine.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file basic_engine.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Simple engine for drawing color and/or depth.
* When we only need simple flat shaders.
@@ -28,9 +25,6 @@
#include "DRW_render.h"
-#include "BKE_icons.h"
-#include "BKE_idprop.h"
-#include "BKE_main.h"
#include "BKE_particle.h"
#include "DNA_particle_types.h"
@@ -63,11 +57,15 @@ typedef struct BASIC_Data {
BASIC_StorageList *stl;
} BASIC_Data;
+typedef struct BASIC_Shaders {
+ /* Depth Pre Pass */
+ struct GPUShader *depth;
+} BASIC_Shaders;
+
/* *********** STATIC *********** */
static struct {
- /* Depth Pre Pass */
- struct GPUShader *depth_sh;
+ BASIC_Shaders sh_data[GPU_SHADER_CFG_LEN];
} e_data = {NULL}; /* Engine data */
typedef struct BASIC_PrivateData {
@@ -80,9 +78,12 @@ typedef struct BASIC_PrivateData {
static void basic_engine_init(void *UNUSED(vedata))
{
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ BASIC_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+
/* Depth prepass */
- if (!e_data.depth_sh) {
- e_data.depth_sh = DRW_shader_create_3D_depth_only();
+ if (!sh_data->depth) {
+ sh_data->depth = DRW_shader_create_3D_depth_only(draw_ctx->sh_cfg);
}
}
@@ -91,6 +92,14 @@ static void basic_cache_init(void *vedata)
BASIC_PassList *psl = ((BASIC_Data *)vedata)->psl;
BASIC_StorageList *stl = ((BASIC_Data *)vedata)->stl;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ BASIC_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+ const RegionView3D *rv3d = draw_ctx->rv3d;
+
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d);
+ }
+
if (!stl->g_data) {
/* Alloc transient pointers */
stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
@@ -99,12 +108,18 @@ static void basic_cache_init(void *vedata)
{
psl->depth_pass = DRW_pass_create(
"Depth Pass", DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE);
- stl->g_data->depth_shgrp = DRW_shgroup_create(e_data.depth_sh, psl->depth_pass);
+ stl->g_data->depth_shgrp = DRW_shgroup_create(sh_data->depth, psl->depth_pass);
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->depth_shgrp, rv3d);
+ }
psl->depth_pass_cull = DRW_pass_create(
"Depth Pass Cull",
DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK);
- stl->g_data->depth_shgrp_cull = DRW_shgroup_create(e_data.depth_sh, psl->depth_pass_cull);
+ stl->g_data->depth_shgrp_cull = DRW_shgroup_create(sh_data->depth, psl->depth_pass_cull);
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->depth_shgrp_cull, rv3d);
+ }
}
}
@@ -212,7 +227,7 @@ RenderEngineType DRW_engine_viewport_basic_type = {
BASIC_ENGINE, N_("Basic"), RE_INTERNAL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&draw_engine_basic_type,
- {NULL, NULL, NULL}
+ {NULL, NULL, NULL},
};
diff --git a/source/blender/draw/engines/basic/basic_engine.h b/source/blender/draw/engines/basic/basic_engine.h
index 0adf99835a2..a32467786de 100644
--- a/source/blender/draw/engines/basic/basic_engine.h
+++ b/source/blender/draw/engines/basic/basic_engine.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file basic_engine.h
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#ifndef __BASIC_ENGINE_H__
diff --git a/source/blender/draw/engines/eevee/eevee_bloom.c b/source/blender/draw/engines/eevee/eevee_bloom.c
index d111c28b256..36ddd68aea9 100644
--- a/source/blender/draw/engines/eevee/eevee_bloom.c
+++ b/source/blender/draw/engines/eevee/eevee_bloom.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,23 +13,17 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_bloom.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Eevee's bloom shader.
*/
#include "DRW_render.h"
-#include "BLI_dynstr.h"
-
-#include "BKE_global.h" /* for G.debug_value */
-
-#include "GPU_extensions.h"
#include "GPU_texture.h"
#include "DEG_depsgraph_query.h"
@@ -227,7 +219,7 @@ void EEVEE_bloom_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *ved
* and do an upsample blur for each new accumulated layer.
* - Finally add accumulation buffer onto the source color buffer.
*
- * [1/1] is original copy resolution (can be half or quater res for performance)
+ * [1/1] is original copy resolution (can be half or quarter res for performance)
*
* [DOWNSAMPLE CHAIN] [UPSAMPLE CHAIN]
*
diff --git a/source/blender/draw/engines/eevee/eevee_data.c b/source/blender/draw/engines/eevee/eevee_data.c
index 636e532555f..78bfb543bb1 100644
--- a/source/blender/draw/engines/eevee/eevee_data.c
+++ b/source/blender/draw/engines/eevee/eevee_data.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_data.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* All specific data handler for Objects, Lights, ViewLayers, ...
*/
@@ -35,7 +32,7 @@ void EEVEE_view_layer_data_free(void *storage)
EEVEE_ViewLayerData *sldata = (EEVEE_ViewLayerData *)storage;
/* Lights */
- MEM_SAFE_FREE(sldata->lamps);
+ MEM_SAFE_FREE(sldata->lights);
DRW_UBO_FREE_SAFE(sldata->light_ubo);
DRW_UBO_FREE_SAFE(sldata->shadow_ubo);
DRW_UBO_FREE_SAFE(sldata->shadow_render_ubo);
@@ -154,32 +151,32 @@ EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_ensure(Object *ob)
NULL);
}
-/* Lamp data. */
+/* Light data. */
-static void eevee_lamp_data_init(DrawData *dd)
+static void eevee_light_data_init(DrawData *dd)
{
- EEVEE_LampEngineData *led = (EEVEE_LampEngineData *)dd;
+ EEVEE_LightEngineData *led = (EEVEE_LightEngineData *)dd;
led->need_update = true;
led->prev_cube_shadow_id = -1;
}
-EEVEE_LampEngineData *EEVEE_lamp_data_get(Object *ob)
+EEVEE_LightEngineData *EEVEE_light_data_get(Object *ob)
{
if (ob->type != OB_LAMP) {
return NULL;
}
- return (EEVEE_LampEngineData *)DRW_drawdata_get(
+ return (EEVEE_LightEngineData *)DRW_drawdata_get(
&ob->id, &draw_engine_eevee_type);
}
-EEVEE_LampEngineData *EEVEE_lamp_data_ensure(Object *ob)
+EEVEE_LightEngineData *EEVEE_light_data_ensure(Object *ob)
{
BLI_assert(ob->type == OB_LAMP);
- return (EEVEE_LampEngineData *)DRW_drawdata_ensure(
+ return (EEVEE_LightEngineData *)DRW_drawdata_ensure(
&ob->id,
&draw_engine_eevee_type,
- sizeof(EEVEE_LampEngineData),
- eevee_lamp_data_init,
+ sizeof(EEVEE_LightEngineData),
+ eevee_light_data_init,
NULL);
}
diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c
index 2c3ce8b65f8..597cb830afb 100644
--- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c
+++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,45 +13,31 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_depth_of_field.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Depth of field post process effect.
*/
#include "DRW_render.h"
-#include "BLI_dynstr.h"
-#include "BLI_rand.h"
-
-#include "DNA_anim_types.h"
#include "DNA_camera_types.h"
-#include "DNA_object_force_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
-#include "BKE_global.h" /* for G.debug_value */
#include "BKE_camera.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_animsys.h"
-#include "BKE_screen.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "eevee_private.h"
-#include "GPU_extensions.h"
#include "GPU_framebuffer.h"
#include "GPU_texture.h"
-#include "ED_screen.h"
-
static struct {
/* Depth Of Field */
struct GPUShader *dof_downsample_sh[2];
@@ -106,12 +90,12 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *v
Camera *cam = (Camera *)camera->data;
/* Retrieve Near and Far distance */
- effects->dof_near_far[0] = -cam->clipsta;
- effects->dof_near_far[1] = -cam->clipend;
+ effects->dof_near_far[0] = -cam->clip_start;
+ effects->dof_near_far[1] = -cam->clip_end;
int buffer_size[2] = {(int)viewport_size[0] / 2, (int)viewport_size[1] / 2};
- GPUTextureFormat down_format = DRW_state_draw_background() ? GPU_R11F_G11F_B10F : GPU_RGBA16F;
+ eGPUTextureFormat down_format = DRW_state_draw_background() ? GPU_R11F_G11F_B10F : GPU_RGBA16F;
effects->dof_down_near = DRW_texture_pool_query_2D(buffer_size[0], buffer_size[1], down_format,
&draw_engine_eevee_type);
@@ -128,7 +112,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *v
});
/* Go full 32bits for rendering and reduce the color artifacts. */
- GPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : GPU_RGBA16F;
+ eGPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : GPU_RGBA16F;
effects->dof_blur = DRW_texture_pool_query_2D(buffer_size[0] * 2, buffer_size[1], fb_format,
&draw_engine_eevee_type);
diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c
index 787957a4a33..0090ab338d2 100644
--- a/source/blender/draw/engines/eevee/eevee_effects.c
+++ b/source/blender/draw/engines/eevee/eevee_effects.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_effects.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Gather all screen space effects technique such as Bloom, Motion Blur, DoF, SSAO, SSR, ...
*/
@@ -29,8 +26,6 @@
#include "BKE_global.h" /* for G.debug_value */
-#include "BLI_string_utils.h"
-
#include "eevee_private.h"
#include "GPU_texture.h"
#include "GPU_extensions.h"
@@ -114,7 +109,7 @@ static void eevee_create_shader_downsample(void)
}
#define SETUP_BUFFER(tex, fb, fb_color) { \
- GPUTextureFormat format = (DRW_state_is_scene_render()) ? GPU_RGBA32F : GPU_RGBA16F; \
+ eGPUTextureFormat format = (DRW_state_is_scene_render()) ? GPU_RGBA32F : GPU_RGBA16F; \
DRW_texture_ensure_fullscreen_2D(&tex, format, DRW_TEX_FILTER | DRW_TEX_MIPMAP); \
GPU_framebuffer_ensure_config(&fb, { \
GPU_ATTACHMENT_TEXTURE(dtxl->depth), \
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c
index 6a2ca982d53..54c1415ca49 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,36 +13,27 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_engine.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "DRW_render.h"
-#include "BLI_dynstr.h"
#include "BLI_rand.h"
#include "BKE_object.h"
#include "BKE_global.h" /* for G.debug_value */
-#include "BKE_screen.h"
#include "DNA_world_types.h"
-#include "ED_screen.h"
-
-#include "GPU_material.h"
-#include "GPU_glew.h"
-
-#include "eevee_engine.h"
#include "eevee_private.h"
-#define EEVEE_ENGINE "BLENDER_EEVEE"
+#include "eevee_engine.h" /* own include */
-extern GlobalsUboStorage ts;
+#define EEVEE_ENGINE "BLENDER_EEVEE"
/* *********** FUNCTIONS *********** */
@@ -66,7 +55,7 @@ static void eevee_engine_init(void *ved)
/* Alloc transient pointers */
stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__);
}
- stl->g_data->use_color_view_settings = USE_SCENE_LIGHT(v3d) || !LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d);
+ stl->g_data->use_color_render_settings = USE_SCENE_LIGHT(v3d) || !LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d);
stl->g_data->background_alpha = DRW_state_draw_background() ? 1.0f : 0.0f;
stl->g_data->valid_double_buffer = (txl->color_double_buffer != NULL);
stl->g_data->valid_taa_history = (txl->taa_history != NULL);
@@ -145,7 +134,7 @@ void EEVEE_cache_populate(void *vedata, Object *ob)
/* do not add any scene light sources to the cache */
}
else if (ob->type == OB_LIGHTPROBE) {
- if ((ob->base_flag & BASE_FROMDUPLI) != 0) {
+ if ((ob->base_flag & BASE_FROM_DUPLI) != 0) {
/* TODO: Special case for dupli objects because we cannot save the object pointer. */
}
else {
@@ -254,7 +243,7 @@ static void eevee_draw_background(void *vedata)
DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
GPU_framebuffer_bind(fbl->main_fb);
- GPUFrameBufferBits clear_bits = GPU_DEPTH_BIT;
+ eGPUFrameBufferBits clear_bits = GPU_DEPTH_BIT;
clear_bits |= (DRW_state_draw_background()) ? 0 : GPU_COLOR_BIT;
clear_bits |= ((stl->effects->enabled_effects & EFFECT_SSS) != 0) ? GPU_STENCIL_BIT : 0;
GPU_framebuffer_clear(fbl->main_fb, clear_bits, clear_col, clear_depth, clear_stencil);
@@ -321,39 +310,39 @@ static void eevee_draw_background(void *vedata)
/* Tonemapping and transfer result to default framebuffer. */
- bool use_view_settings = stl->g_data->use_color_view_settings;
+ bool use_render_settings = stl->g_data->use_color_render_settings;
GPU_framebuffer_bind(dfbl->default_fb);
- DRW_transform_to_display(stl->effects->final_tx, use_view_settings);
+ DRW_transform_to_display(stl->effects->final_tx, true, use_render_settings);
/* Debug : Output buffer to view. */
switch (G.debug_value) {
case 1:
- if (txl->maxzbuffer) DRW_transform_to_display(txl->maxzbuffer, use_view_settings);
+ if (txl->maxzbuffer) DRW_transform_to_display(txl->maxzbuffer, false, false);
break;
case 2:
- if (effects->ssr_pdf_output) DRW_transform_to_display(effects->ssr_pdf_output, use_view_settings);
+ if (effects->ssr_pdf_output) DRW_transform_to_display(effects->ssr_pdf_output, false, false);
break;
case 3:
- if (effects->ssr_normal_input) DRW_transform_to_display(effects->ssr_normal_input, use_view_settings);
+ if (effects->ssr_normal_input) DRW_transform_to_display(effects->ssr_normal_input, false, false);
break;
case 4:
- if (effects->ssr_specrough_input) DRW_transform_to_display(effects->ssr_specrough_input, use_view_settings);
+ if (effects->ssr_specrough_input) DRW_transform_to_display(effects->ssr_specrough_input, false, false);
break;
case 5:
- if (txl->color_double_buffer) DRW_transform_to_display(txl->color_double_buffer, use_view_settings);
+ if (txl->color_double_buffer) DRW_transform_to_display(txl->color_double_buffer, false, false);
break;
case 6:
- if (effects->gtao_horizons_debug) DRW_transform_to_display(effects->gtao_horizons_debug, use_view_settings);
+ if (effects->gtao_horizons_debug) DRW_transform_to_display(effects->gtao_horizons_debug, false, false);
break;
case 7:
- if (effects->gtao_horizons) DRW_transform_to_display(effects->gtao_horizons, use_view_settings);
+ if (effects->gtao_horizons) DRW_transform_to_display(effects->gtao_horizons, false, false);
break;
case 8:
- if (effects->sss_data) DRW_transform_to_display(effects->sss_data, use_view_settings);
+ if (effects->sss_data) DRW_transform_to_display(effects->sss_data, false, false);
break;
case 9:
- if (effects->velocity_tx) DRW_transform_to_display(effects->velocity_tx, use_view_settings);
+ if (effects->velocity_tx) DRW_transform_to_display(effects->velocity_tx, false, false);
break;
default:
break;
@@ -379,7 +368,7 @@ static void eevee_id_object_update(void *UNUSED(vedata), Object *object)
ped->need_update = (ped->dd.recalc & (ID_RECALC_TRANSFORM | ID_RECALC_COPY_ON_WRITE)) != 0;
ped->dd.recalc = 0;
}
- EEVEE_LampEngineData *led = EEVEE_lamp_data_get(object);
+ EEVEE_LightEngineData *led = EEVEE_light_data_get(object);
if (led != NULL && led->dd.recalc != 0) {
led->need_update = true;
led->dd.recalc = 0;
@@ -474,7 +463,7 @@ RenderEngineType DRW_engine_viewport_eevee_type = {
NULL, &DRW_render_to_image, NULL, NULL, NULL, NULL,
&EEVEE_render_update_passes,
&draw_engine_eevee_type,
- {NULL, NULL, NULL}
+ {NULL, NULL, NULL},
};
diff --git a/source/blender/draw/engines/eevee/eevee_engine.h b/source/blender/draw/engines/eevee/eevee_engine.h
index b7de3a055b9..b27d16aa7d8 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.h
+++ b/source/blender/draw/engines/eevee/eevee_engine.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_engine.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __EEVEE_ENGINE_H__
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 38983afa5f3..45ed66859af 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_lightcache.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Eevee's indirect lighting cache.
*/
@@ -28,7 +25,6 @@
#include "DRW_render.h"
#include "BKE_global.h"
-#include "BKE_blender.h"
#include "BLI_threads.h"
@@ -71,7 +67,8 @@
# define IRRADIANCE_FORMAT GPU_RGBA8
#endif
-#define IRRADIANCE_MAX_POOL_LAYER 256 /* OpenGL 3.3 core requirement, can be extended but it's already very big */
+/* OpenGL 3.3 core requirement, can be extended but it's already very big */
+#define IRRADIANCE_MAX_POOL_LAYER 256
#define IRRADIANCE_MAX_POOL_SIZE 1024
#define MAX_IRRADIANCE_SAMPLES \
(IRRADIANCE_MAX_POOL_SIZE / IRRADIANCE_SAMPLE_SIZE_X) * \
@@ -147,7 +144,6 @@ typedef struct EEVEE_LightBake {
} EEVEE_LightBake;
/* -------------------------------------------------------------------- */
-
/** \name Light Cache
* \{ */
@@ -367,7 +363,6 @@ void EEVEE_lightcache_free(LightCache *lcache)
/* -------------------------------------------------------------------- */
-
/** \name Light Bake Context
* \{ */
@@ -400,7 +395,6 @@ static void eevee_lightbake_context_disable(EEVEE_LightBake *lbake)
/* -------------------------------------------------------------------- */
-
/** \name Light Bake Job
* \{ */
@@ -510,8 +504,9 @@ wmJob *EEVEE_lightbake_job_create(
EEVEE_LightBake *lbake = NULL;
/* only one render job at a time */
- if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER))
+ if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
return NULL;
+ }
wmJob *wm_job = WM_jobs_get(wm, win, scene, "Bake Lighting",
WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_LIGHT_BAKE);
@@ -691,7 +686,7 @@ static void eevee_lightbake_cache_create(EEVEE_Data *vedata, EEVEE_LightBake *lb
txl->color = lbake->rt_color;
int viewport_size[2] = {
GPU_texture_width(txl->color),
- GPU_texture_height(txl->color)
+ GPU_texture_height(txl->color),
};
DRW_render_viewport_size_set(viewport_size);
@@ -1187,7 +1182,7 @@ void EEVEE_lightbake_update_world_quick(EEVEE_ViewLayerData *sldata, EEVEE_Data
float filter_quality = scene->eevee.gi_filter_quality;
EEVEE_LightBake lbake = {
- .resource_only = true
+ .resource_only = true,
};
/* Create resources. */
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.h b/source/blender/draw/engines/eevee/eevee_lightcache.h
index 3c6fc73a849..7d2f163055f 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.h
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2018, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2018, Blender Foundation.
*/
-/** \file eevee_lightcache.h
- * \ingroup eevee
+/** \file
+ * \ingroup eevee
*/
#ifndef __EEVEE_LIGHTCACHE_H__
@@ -28,13 +25,13 @@
#include "BLI_sys_types.h" /* for bool */
-struct ViewLayer;
-struct Scene;
-struct SceneEEVEE;
-struct LightCache;
-struct EEVEE_ViewLayerData;
struct EEVEE_Data;
struct EEVEE_LightBake;
+struct EEVEE_ViewLayerData;
+struct LightCache;
+struct Scene;
+struct SceneEEVEE;
+struct ViewLayer;
/* Light Bake */
struct wmJob *EEVEE_lightbake_job_create(
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 0b4341f5cb9..dfd8a048276 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,18 +13,16 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_lightprobes.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "DRW_render.h"
#include "BLI_utildefines.h"
-#include "BLI_string_utils.h"
#include "BLI_rand.h"
#include "DNA_world_types.h"
@@ -41,15 +37,12 @@
#include "GPU_material.h"
#include "GPU_texture.h"
-#include "GPU_glew.h"
#include "DEG_depsgraph_query.h"
-#include "eevee_engine.h"
#include "eevee_lightcache.h"
#include "eevee_private.h"
-#include "ED_screen.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -65,7 +58,6 @@ static struct {
struct GPUVertFormat *format_probe_display_planar;
} e_data = {NULL}; /* Engine data */
-extern GlobalsUboStorage ts;
/* *********** FUNCTIONS *********** */
@@ -76,15 +68,18 @@ bool EEVEE_lightprobes_obj_visibility_cb(bool vis_in, void *user_data)
EEVEE_ObjectEngineData *oed = (EEVEE_ObjectEngineData *)user_data;
/* test disabled if group is NULL */
- if (oed->test_data->collection == NULL)
+ if (oed->test_data->collection == NULL) {
return vis_in;
+ }
- if (oed->test_data->cached == false)
+ if (oed->test_data->cached == false) {
oed->ob_vis_dirty = true;
+ }
/* early out, don't need to compute ob_vis yet. */
- if (vis_in == false)
+ if (vis_in == false) {
return vis_in;
+ }
if (oed->ob_vis_dirty) {
oed->ob_vis_dirty = false;
@@ -316,7 +311,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
Scene *scene = draw_ctx->scene;
World *wo = scene->world;
- float *col = ts.colorBackground;
+ const float *col = G_draw.block.colorBackground;
/* LookDev */
EEVEE_lookdev_cache_init(vedata, &grp, psl->probe_background, wo, pinfo);
@@ -328,7 +323,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
static float error_col[3] = {1.0f, 0.0f, 1.0f};
struct GPUMaterial *gpumat = EEVEE_material_world_lightprobe_get(scene, wo);
- GPUMaterialStatus status = GPU_material_status(gpumat);
+ eGPUMaterialStatus status = GPU_material_status(gpumat);
switch (status) {
case GPU_MAT_SUCCESS:
@@ -407,8 +402,8 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
/* Planar Display */
DRW_shgroup_instance_format(e_data.format_probe_display_planar, {
- {"probe_id", DRW_ATTRIB_INT, 1},
- {"probe_mat", DRW_ATTRIB_FLOAT, 16},
+ {"probe_id", DRW_ATTR_INT, 1},
+ {"probe_mat", DRW_ATTR_FLOAT, 16},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
@@ -742,7 +737,6 @@ void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved
}
/* -------------------------------------------------------------------- */
-
/** \name Rendering
* \{ */
@@ -820,7 +814,7 @@ void EEVEE_lightbake_render_world(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Dat
{
EEVEE_BakeRenderData brdata = {
.vedata = vedata,
- .face_fb = face_fb
+ .face_fb = face_fb,
};
render_cubemap(lightbake_render_world_face, &brdata, (float[3]){0.0f}, 1.0f, 10.0f);
@@ -854,7 +848,7 @@ void EEVEE_lightbake_render_scene(
EEVEE_BakeRenderData brdata = {
.vedata = vedata,
.sldata = sldata,
- .face_fb = face_fb
+ .face_fb = face_fb,
};
render_cubemap(lightbake_render_scene_face, &brdata, pos, near_clip, far_clip);
@@ -898,7 +892,7 @@ static void lightbake_render_scene_reflected(int layer, EEVEE_BakeRenderData *us
sldata->clip_data.clip_planes[0][3] += eplanar->clipsta;
/* Set clipping plane */
DRW_uniformbuffer_update(sldata->clip_ubo, &sldata->clip_data);
- DRW_state_clip_planes_count_set(1);
+ DRW_state_clip_planes_len_set(1);
GPU_framebuffer_bind(fbl->planarref_fb);
GPU_framebuffer_clear_depth(fbl->planarref_fb, 1.0);
@@ -953,7 +947,6 @@ static void eevee_lightbake_render_scene_to_planars(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Filtering
* \{ */
diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c
index b946a49ea14..f4fe088157e 100644
--- a/source/blender/draw/engines/eevee/eevee_lights.c
+++ b/source/blender/draw/engines/eevee/eevee_lights.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_lights.c
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#include "DRW_render.h"
@@ -33,7 +30,6 @@
#include "DEG_depsgraph_query.h"
-#include "eevee_engine.h"
#include "eevee_private.h"
#define SHADOW_CASTER_ALLOC_CHUNK 16
@@ -59,7 +55,7 @@ extern char datatoc_concentric_samples_lib_glsl[];
/* Prototypes */
static void eevee_light_setup(Object *ob, EEVEE_Light *evli);
-static float light_attenuation_radius_get(Lamp *la, float light_threshold);
+static float light_attenuation_radius_get(Light *la, float light_threshold);
/* *********** LIGHT BITS *********** */
static void lightbits_set_single(EEVEE_LightBits *bitf, uint idx, bool val)
@@ -117,8 +113,8 @@ void EEVEE_lights_init(EEVEE_ViewLayerData *sldata)
datatoc_shadow_vert_glsl, NULL, datatoc_shadow_frag_glsl, NULL);
}
- if (!sldata->lamps) {
- sldata->lamps = MEM_callocN(sizeof(EEVEE_LampsInfo), "EEVEE_LampsInfo");
+ if (!sldata->lights) {
+ sldata->lights = MEM_callocN(sizeof(EEVEE_LightsInfo), "EEVEE_LightsInfo");
sldata->light_ubo = DRW_uniformbuffer_create(sizeof(EEVEE_Light) * MAX_LIGHT, NULL);
sldata->shadow_ubo = DRW_uniformbuffer_create(shadow_ubo_size, NULL);
sldata->shadow_render_ubo = DRW_uniformbuffer_create(sizeof(EEVEE_ShadowRender), NULL);
@@ -130,20 +126,20 @@ void EEVEE_lights_init(EEVEE_ViewLayerData *sldata)
sldata->shcasters_buffers[i].count = 0;
}
- sldata->lamps->shcaster_frontbuffer = &sldata->shcasters_buffers[0];
- sldata->lamps->shcaster_backbuffer = &sldata->shcasters_buffers[1];
+ sldata->lights->shcaster_frontbuffer = &sldata->shcasters_buffers[0];
+ sldata->lights->shcaster_backbuffer = &sldata->shcasters_buffers[1];
}
/* Flip buffers */
- SWAP(EEVEE_ShadowCasterBuffer *, sldata->lamps->shcaster_frontbuffer, sldata->lamps->shcaster_backbuffer);
+ SWAP(EEVEE_ShadowCasterBuffer *, sldata->lights->shcaster_frontbuffer, sldata->lights->shcaster_backbuffer);
const int sh_method = scene_eval->eevee.shadow_method;
int sh_cube_size = scene_eval->eevee.shadow_cube_size;
int sh_cascade_size = scene_eval->eevee.shadow_cascade_size;
const bool sh_high_bitdepth = (scene_eval->eevee.flag & SCE_EEVEE_SHADOW_HIGH_BITDEPTH) != 0;
- sldata->lamps->soft_shadows = (scene_eval->eevee.flag & SCE_EEVEE_SHADOW_SOFT) != 0;
+ sldata->lights->soft_shadows = (scene_eval->eevee.flag & SCE_EEVEE_SHADOW_SOFT) != 0;
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
if ((linfo->shadow_cube_size != sh_cube_size) ||
(linfo->shadow_method != sh_method) ||
(linfo->shadow_high_bitdepth != sh_high_bitdepth))
@@ -246,7 +242,7 @@ static DRWPass *eevee_lights_cube_store_pass_get(EEVEE_PassList *psl, EEVEE_View
bool high_blur = shadow_samples_len > 16;
DRWPass **pass = (high_blur) ? &psl->shadow_cube_store_pass : &psl->shadow_cube_store_high_pass;
if (*pass == NULL) {
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
*pass = DRW_pass_create("Shadow Cube Storage Pass", DRW_STATE_WRITE_COLOR);
GPUShader *shader = eevee_lights_get_store_sh(shadow_method, high_blur, false);
DRWShadingGroup *grp = DRW_shgroup_create(shader, *pass);
@@ -263,7 +259,7 @@ static DRWPass *eevee_lights_cascade_store_pass_get(EEVEE_PassList *psl, EEVEE_V
bool high_blur = shadow_samples_len > 16;
DRWPass **pass = (high_blur) ? &psl->shadow_cascade_store_pass : &psl->shadow_cascade_store_high_pass;
if (*pass == NULL) {
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
*pass = DRW_pass_create("Shadow Cascade Storage Pass", DRW_STATE_WRITE_COLOR);
GPUShader *shader = eevee_lights_get_store_sh(shadow_method, high_blur, true);
DRWShadingGroup *grp = DRW_shgroup_create(shader, *pass);
@@ -278,7 +274,7 @@ static DRWPass *eevee_lights_cascade_store_pass_get(EEVEE_PassList *psl, EEVEE_V
void EEVEE_lights_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
{
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
EEVEE_StorageList *stl = vedata->stl;
EEVEE_PassList *psl = vedata->psl;
@@ -336,27 +332,27 @@ void EEVEE_lights_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob)
{
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
const DRWContextState *draw_ctx = DRW_context_state_get();
const float threshold = draw_ctx->scene->eevee.light_threshold;
- /* Step 1 find all lamps in the scene and setup them */
+ /* Step 1 find all lights in the scene and setup them */
if (linfo->num_light >= MAX_LIGHT) {
printf("Too many lights in the scene !!!\n");
}
else {
- Lamp *la = (Lamp *)ob->data;
+ Light *la = (Light *)ob->data;
EEVEE_Light *evli = linfo->light_data + linfo->num_light;
eevee_light_setup(ob, evli);
- /* We do not support shadowmaps for dupli lamps. */
- if ((ob->base_flag & BASE_FROMDUPLI) != 0) {
+ /* We do not support shadowmaps for dupli lights. */
+ if ((ob->base_flag & BASE_FROM_DUPLI) != 0) {
linfo->num_light++;
return;
}
- EEVEE_LampEngineData *led = EEVEE_lamp_data_ensure(ob);
+ EEVEE_LightEngineData *led = EEVEE_light_data_ensure(ob);
/* Save previous shadow id. */
int prev_cube_sh_id = led->prev_cube_shadow_id;
@@ -400,7 +396,7 @@ void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob)
}
led->prev_cube_shadow_id = linfo->cpu_cube_len;
- /* Saving lamp bounds for later. */
+ /* Saving light bounds for later. */
BLI_assert(linfo->cpu_cube_len >= 0 && linfo->cpu_cube_len < MAX_LIGHT);
copy_v3_v3(linfo->shadow_bounds[linfo->cpu_cube_len].center, ob->obmat[3]);
linfo->shadow_bounds[linfo->cpu_cube_len].radius = light_attenuation_radius_get(la, threshold);
@@ -454,22 +450,23 @@ void EEVEE_lights_cache_shcaster_material_add(
DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo);
DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
- if (alpha_threshold != NULL)
+ if (alpha_threshold != NULL) {
DRW_shgroup_uniform_float(grp, "alphaThreshold", alpha_threshold, 1);
+ }
DRW_shgroup_call_object_add(grp, geom, ob);
}
-/* Make that object update shadow casting lamps inside its influence bounding box. */
+/* Make that object update shadow casting lights inside its influence bounding box. */
void EEVEE_lights_cache_shcaster_object_add(EEVEE_ViewLayerData *sldata, Object *ob)
{
- if ((ob->base_flag & BASE_FROMDUPLI) != 0) {
+ if ((ob->base_flag & BASE_FROM_DUPLI) != 0) {
/* TODO: Special case for dupli objects because we cannot save the object pointer. */
return;
}
EEVEE_ObjectEngineData *oedata = EEVEE_object_data_ensure(ob);
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
EEVEE_ShadowCasterBuffer *backbuffer = linfo->shcaster_backbuffer;
EEVEE_ShadowCasterBuffer *frontbuffer = linfo->shcaster_frontbuffer;
int past_id = oedata->shadow_caster_id;
@@ -524,8 +521,8 @@ void EEVEE_lights_cache_shcaster_object_add(EEVEE_ViewLayerData *sldata, Object
void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
{
- EEVEE_LampsInfo *linfo = sldata->lamps;
- GPUTextureFormat shadow_pool_format = GPU_R32F;
+ EEVEE_LightsInfo *linfo = sldata->lights;
+ eGPUTextureFormat shadow_pool_format = GPU_R32F;
sldata->common_data.la_num_light = linfo->num_light;
@@ -590,14 +587,15 @@ void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
GPU_ATTACHMENT_TEXTURE(sldata->shadow_cascade_pool)
});
- /* Update Lamps UBOs. */
+ /* Update Lights UBOs. */
EEVEE_lights_update(sldata, vedata);
}
-float light_attenuation_radius_get(Lamp *la, float light_threshold)
+float light_attenuation_radius_get(Light *la, float light_threshold)
{
- if (la->mode & LA_CUSTOM_ATTENUATION)
+ if (la->mode & LA_CUSTOM_ATTENUATION) {
return la->att_dist;
+ }
/* Compute max light power. */
float power = max_fff(la->r, la->g, la->b);
@@ -609,7 +607,7 @@ float light_attenuation_radius_get(Lamp *la, float light_threshold)
return distance;
}
-static void light_shape_parameters_set(EEVEE_Light *evli, const Lamp *la, float scale[3])
+static void light_shape_parameters_set(EEVEE_Light *evli, const Light *la, float scale[3])
{
if (la->type == LA_SPOT) {
/* Spot size & blend */
@@ -633,7 +631,7 @@ static void light_shape_parameters_set(EEVEE_Light *evli, const Lamp *la, float
}
}
-static float light_shape_power_get(const Lamp *la, const EEVEE_Light *evli)
+static float light_shape_power_get(const Light *la, const EEVEE_Light *evli)
{
float power;
/* Make illumination power constant */
@@ -661,10 +659,10 @@ static float light_shape_power_get(const Lamp *la, const EEVEE_Light *evli)
return power;
}
-/* Update buffer with lamp data */
+/* Update buffer with light data */
static void eevee_light_setup(Object *ob, EEVEE_Light *evli)
{
- Lamp *la = (Lamp *)ob->data;
+ Light *la = (Light *)ob->data;
float mat[4][4], scale[3], power, att_radius;
const DRWContextState *draw_ctx = DRW_context_state_get();
@@ -697,10 +695,10 @@ static void eevee_light_setup(Object *ob, EEVEE_Light *evli)
light_shape_parameters_set(evli, la, scale);
- /* Lamp Type */
- evli->lamptype = (float)la->type;
+ /* Light Type */
+ evli->light_type = (float)la->type;
if ((la->type == LA_AREA) && ELEM(la->area_shape, LA_AREA_DISK, LA_AREA_ELLIPSE)) {
- evli->lamptype = LAMPTYPE_AREA_ELLIPSE;
+ evli->light_type = LAMPTYPE_AREA_ELLIPSE;
}
power = light_shape_power_get(la, evli);
@@ -779,7 +777,7 @@ static void sample_ellipse(
static void shadow_cube_random_position_set(
- EEVEE_Light *evli, Lamp *la,
+ EEVEE_Light *evli, Light *la,
int sample_ofs,
float ws_sample_pos[3])
{
@@ -811,13 +809,13 @@ static void shadow_cube_random_position_set(
add_v3_v3(ws_sample_pos, jitter);
}
-static void eevee_shadow_cube_setup(Object *ob, EEVEE_LampsInfo *linfo, EEVEE_LampEngineData *led, int sample_ofs)
+static void eevee_shadow_cube_setup(Object *ob, EEVEE_LightsInfo *linfo, EEVEE_LightEngineData *led, int sample_ofs)
{
EEVEE_ShadowCubeData *sh_data = &led->data.scd;
EEVEE_Light *evli = linfo->light_data + sh_data->light_id;
EEVEE_Shadow *ubo_data = linfo->shadow_data + sh_data->shadow_id;
EEVEE_ShadowCube *cube_data = linfo->shadow_cube_data + sh_data->cube_id;
- Lamp *la = (Lamp *)ob->data;
+ Light *la = (Light *)ob->data;
copy_v3_v3(cube_data->position, ob->obmat[3]);
@@ -911,17 +909,17 @@ static void frustum_min_bounding_sphere(const float corners[8][3], float r_cente
}
static void eevee_shadow_cascade_setup(
- Object *ob, EEVEE_LampsInfo *linfo, EEVEE_LampEngineData *led,
+ Object *ob, EEVEE_LightsInfo *linfo, EEVEE_LightEngineData *led,
DRWMatrixState *saved_mats, float view_near, float view_far, int sample_ofs)
{
- Lamp *la = (Lamp *)ob->data;
+ Light *la = (Light *)ob->data;
/* Camera Matrices */
float (*persinv)[4] = saved_mats->mat[DRW_MAT_PERSINV];
float (*vp_projmat)[4] = saved_mats->mat[DRW_MAT_WIN];
bool is_persp = DRW_viewport_is_persp_get();
- /* Lamps Matrices */
+ /* Lights Matrices */
int cascade_nbr = la->cascade_count;
EEVEE_ShadowCascadeData *sh_data = &led->data.scad;
@@ -1054,7 +1052,7 @@ static void eevee_shadow_cascade_setup(
{ 1.0f, -1.0f, splits_end_ndc[c]},
{-1.0f, -1.0f, splits_end_ndc[c]},
{-1.0f, 1.0f, splits_end_ndc[c]},
- { 1.0f, 1.0f, splits_end_ndc[c]}
+ { 1.0f, 1.0f, splits_end_ndc[c]},
};
/* Transform them into world space */
@@ -1141,7 +1139,7 @@ void EEVEE_lights_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
{
EEVEE_StorageList *stl = vedata->stl;
EEVEE_EffectsInfo *effects = stl->effects;
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
Object *ob;
int i;
char *flag;
@@ -1157,7 +1155,7 @@ void EEVEE_lights_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
}
else {
/* Search for deleted shadow casters and if shcaster WAS in shadow radius. */
- /* No need to run this if we already update all lamps. */
+ /* No need to run this if we already update all lights. */
EEVEE_LightBits past_bits = {{0}};
EEVEE_LightBits curr_bits = {{0}};
shcaster = backbuffer->shadow_casters;
@@ -1165,7 +1163,7 @@ void EEVEE_lights_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
for (i = 0; i < backbuffer->count; ++i, ++flag, ++shcaster) {
/* If the shadowcaster has been deleted or updated. */
if (*flag != 0) {
- /* Add the lamps that were intersecting with its BBox. */
+ /* Add the lights that were intersecting with its BBox. */
lightbits_or(&past_bits, &shcaster->bits);
}
}
@@ -1194,7 +1192,7 @@ void EEVEE_lights_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
/* Setup shadow cube in UBO and tag for update if necessary. */
for (i = 0; (i < MAX_SHADOW_CUBE) && (ob = linfo->shadow_cube_ref[i]); i++) {
- EEVEE_LampEngineData *led = EEVEE_lamp_data_ensure(ob);
+ EEVEE_LightEngineData *led = EEVEE_light_data_ensure(ob);
eevee_shadow_cube_setup(ob, linfo, led, effects->taa_current_sample - 1);
if (lightbits_get(&update_bits, i) != 0 || linfo->soft_shadows) {
@@ -1211,13 +1209,13 @@ void EEVEE_lights_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
}
}
-/* this refresh lamps shadow buffers */
+/* this refresh lights shadow buffers */
void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
{
EEVEE_PassList *psl = vedata->psl;
EEVEE_StorageList *stl = vedata->stl;
EEVEE_EffectsInfo *effects = stl->effects;
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
const DRWContextState *draw_ctx = DRW_context_state_get();
const float light_threshold = draw_ctx->scene->eevee.light_threshold;
Object *ob;
@@ -1233,16 +1231,16 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
/* Precompute all shadow/view test before rendering and trashing the culling cache. */
bool cube_visible[MAX_SHADOW_CUBE];
for (i = 0; (ob = linfo->shadow_cube_ref[i]) && (i < MAX_SHADOW_CUBE); i++) {
- Lamp *la = (Lamp *)ob->data;
+ Light *la = (Light *)ob->data;
BoundSphere bsphere = {
.center = {ob->obmat[3][0], ob->obmat[3][1], ob->obmat[3][2]},
- .radius = light_attenuation_radius_get(la, light_threshold)
+ .radius = light_attenuation_radius_get(la, light_threshold),
};
cube_visible[i] = DRW_culling_sphere_test(&bsphere);
}
bool cascade_visible[MAX_SHADOW_CASCADE];
for (i = 0; (ob = linfo->shadow_cascade_ref[i]) && (i < MAX_SHADOW_CASCADE); i++) {
- EEVEE_LampEngineData *led = EEVEE_lamp_data_get(ob);
+ EEVEE_LightEngineData *led = EEVEE_light_data_get(ob);
EEVEE_ShadowCascadeData *sh_data = &led->data.scad;
float plane[4];
normalize_m4_m4(sh_data->viewmat, ob->obmat);
@@ -1260,8 +1258,8 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
DRW_stats_group_start("Cube Shadow Maps");
/* Render each shadow to one layer of the array */
for (i = 0; (ob = linfo->shadow_cube_ref[i]) && (i < MAX_SHADOW_CUBE); i++) {
- EEVEE_LampEngineData *led = EEVEE_lamp_data_ensure(ob);
- Lamp *la = (Lamp *)ob->data;
+ EEVEE_LightEngineData *led = EEVEE_light_data_ensure(ob);
+ Light *la = (Light *)ob->data;
if (!led->need_update || !cube_visible[i]) {
continue;
@@ -1373,8 +1371,8 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
continue;
}
- EEVEE_LampEngineData *led = EEVEE_lamp_data_ensure(ob);
- Lamp *la = (Lamp *)ob->data;
+ EEVEE_LightEngineData *led = EEVEE_light_data_ensure(ob);
+ Light *la = (Light *)ob->data;
EEVEE_ShadowCascadeData *evscd = &led->data.scad;
EEVEE_ShadowRender *srd = &linfo->shadow_render_data;
diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c
index aa2f480597b..d954ff3b0e2 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_lookdev.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "DRW_render.h"
@@ -109,7 +106,7 @@ void EEVEE_lookdev_cache_init(
stl->g_data->light_cache = stl->lookdev_lightcache;
static float background_color[4];
- UI_GetThemeColor4fv(TH_HIGH_GRAD, background_color);
+ UI_GetThemeColor4fv(TH_BACK, background_color);
/* XXX: Really quick conversion to avoid washed out background.
* Needs to be addressed properly (color managed using ocio). */
srgb_to_linearrgb_v4(background_color, background_color);
@@ -191,8 +188,8 @@ void EEVEE_lookdev_draw_background(EEVEE_Data *vedata)
params.offsety = 0.0f;
params.shiftx = 0.0f;
params.shifty = 0.0f;
- params.clipsta = 0.001f;
- params.clipend = 20.0f;
+ params.clip_start = 0.001f;
+ params.clip_end = 20.0f;
BKE_camera_params_compute_viewplane(&params, ar->winx, ar->winy, aspect[0], aspect[1]);
BKE_camera_params_compute_matrix(&params);
diff --git a/source/blender/draw/engines/eevee/eevee_lut.h b/source/blender/draw/engines/eevee/eevee_lut.h
index da765b3e53a..e88ffc6ccb9 100644
--- a/source/blender/draw/engines/eevee/eevee_lut.h
+++ b/source/blender/draw/engines/eevee/eevee_lut.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Clement Foucault.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file eevee_lut.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __EEVEE_LUT_H__
@@ -3342,7 +3334,7 @@ static float bsdf_split_sum_ggx[64 * 64 * 2] = {
0.731445f, 0.049774f, 0.725586f, 0.046661f, 0.718262f, 0.043732f, 0.710449f, 0.041077f,
0.702637f, 0.038544f, 0.694336f, 0.036163f, 0.685547f, 0.033966f, 0.676758f, 0.031921f,
0.667480f, 0.030014f, 0.657715f, 0.028229f, 0.647461f, 0.026566f, 0.637207f, 0.025009f,
- 0.626953f, 0.023544f, 0.616699f, 0.022186f, 0.605957f, 0.020920f, 0.594727f, 0.019730f
+ 0.626953f, 0.023544f, 0.616699f, 0.022186f, 0.605957f, 0.020920f, 0.594727f, 0.019730f,
};
static float ltc_disk_integral[64 * 64] = {
@@ -3857,7 +3849,7 @@ static float ltc_disk_integral[64 * 64] = {
0.507937f, 0.523810f, 0.539683f, 0.555556f, 0.571429f, 0.587302f, 0.603175f, 0.619048f,
0.634921f, 0.650794f, 0.666667f, 0.682540f, 0.698413f, 0.714286f, 0.730159f, 0.746032f,
0.761905f, 0.777778f, 0.793651f, 0.809524f, 0.825397f, 0.841270f, 0.857143f, 0.873016f,
- 0.888889f, 0.904762f, 0.920635f, 0.936508f, 0.952381f, 0.968254f, 0.984127f, 1.000000f
+ 0.888889f, 0.904762f, 0.920635f, 0.936508f, 0.952381f, 0.968254f, 0.984127f, 1.000000f,
};
static float btdf_split_sum_ggx[32][64 * 64] = {
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index 00b77eee19b..5a808f2a01f 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_materials.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "DRW_render.h"
@@ -34,7 +31,6 @@
#include "BKE_particle.h"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
-#include "BKE_studiolight.h"
#include "DNA_world_types.h"
#include "DNA_modifier_types.h"
@@ -74,7 +70,7 @@ static struct {
float noise_offsets[3];
} e_data = {NULL}; /* Engine data */
-extern char datatoc_lamps_lib_glsl[];
+extern char datatoc_lights_lib_glsl[];
extern char datatoc_lightprobe_lib_glsl[];
extern char datatoc_ambient_occlusion_lib_glsl[];
extern char datatoc_prepass_frag_glsl[];
@@ -107,9 +103,6 @@ extern char datatoc_volumetric_lib_glsl[];
extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
-extern Material defmaterial;
-extern GlobalsUboStorage ts;
-
/* *********** FUNCTIONS *********** */
#if 0 /* Used only to generate the LUT values */
@@ -512,7 +505,7 @@ static void EEVEE_update_viewvecs(float invproj[4][4], float winmat[4][4], float
{-1.0f, -1.0f, -1.0f, 1.0f},
{ 1.0f, -1.0f, -1.0f, 1.0f},
{-1.0f, 1.0f, -1.0f, 1.0f},
- {-1.0f, -1.0f, 1.0f, 1.0f}
+ {-1.0f, -1.0f, 1.0f, 1.0f},
};
/* convert the view vectors to view space */
@@ -560,7 +553,7 @@ void EEVEE_materials_init(EEVEE_ViewLayerData *sldata, EEVEE_StorageList *stl, E
datatoc_irradiance_lib_glsl,
datatoc_lightprobe_lib_glsl,
datatoc_ltc_lib_glsl,
- datatoc_lamps_lib_glsl,
+ datatoc_lights_lib_glsl,
/* Add one for each Closure */
datatoc_lit_surface_frag_glsl,
datatoc_lit_surface_frag_glsl,
@@ -583,7 +576,7 @@ void EEVEE_materials_init(EEVEE_ViewLayerData *sldata, EEVEE_StorageList *stl, E
datatoc_irradiance_lib_glsl,
datatoc_lightprobe_lib_glsl,
datatoc_ltc_lib_glsl,
- datatoc_lamps_lib_glsl,
+ datatoc_lights_lib_glsl,
datatoc_volumetric_lib_glsl,
datatoc_volumetric_frag_glsl);
@@ -782,8 +775,9 @@ struct GPUMaterial *EEVEE_material_mesh_depth_get(
options |= VAR_MAT_CLIP;
}
- if (is_shadow)
+ if (is_shadow) {
options |= VAR_MAT_SHADOW;
+ }
GPUMaterial *mat = DRW_shader_find_from_material(ma, engine, options, true);
if (mat) {
@@ -961,7 +955,7 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
Scene *scene = draw_ctx->scene;
World *wo = scene->world;
- float *col = ts.colorBackground;
+ const float *col = G_draw.block.colorBackground;
/* LookDev */
EEVEE_lookdev_cache_init(vedata, &grp, psl->background_pass, wo, NULL);
@@ -1123,7 +1117,7 @@ static void material_opaque(
Scene *scene = draw_ctx->scene;
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
bool use_diffuse, use_glossy, use_refract;
float *color_p = &ma->r;
@@ -1162,14 +1156,14 @@ static void material_opaque(
scene, ma, vedata, false, false, use_ssrefract,
use_sss, use_translucency, linfo->shadow_method);
- GPUMaterialStatus status_mat_surface = GPU_material_status(*gpumat);
+ eGPUMaterialStatus status_mat_surface = GPU_material_status(*gpumat);
/* Alpha CLipped : Discard pixel from depth pass, then
* fail the depth test for shading. */
if (ELEM(ma->blend_method, MA_BM_CLIP, MA_BM_HASHED)) {
*gpumat_depth = EEVEE_material_mesh_depth_get(scene, ma, (ma->blend_method == MA_BM_HASHED), false);
- GPUMaterialStatus status_mat_depth = GPU_material_status(*gpumat_depth);
+ eGPUMaterialStatus status_mat_depth = GPU_material_status(*gpumat_depth);
if (status_mat_depth != GPU_MAT_SUCCESS) {
/* Mixing both flags. If depth shader fails, show it to the user by not using
* the surface shader. */
@@ -1324,7 +1318,7 @@ static void material_transparent(
Scene *scene = draw_ctx->scene;
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
const bool use_ssrefract = (
((ma->blend_flag & MA_BL_SS_REFRACTION) != 0) &&
@@ -1483,8 +1477,9 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
shgrp_depth_array[i] = NULL;
shgrp_depth_clip_array[i] = NULL;
- if (ma == NULL)
+ if (ma == NULL) {
ma = &defmaterial;
+ }
switch (ma->blend_method) {
case MA_BM_SOLID:
@@ -1521,21 +1516,27 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
char *auto_layer_names;
int *auto_layer_is_srgb;
int auto_layer_count;
- struct GPUBatch **mat_geom = DRW_cache_object_surface_material_get(
- ob, gpumat_array, materials_len,
- &auto_layer_names,
- &auto_layer_is_srgb,
- &auto_layer_count);
- if (mat_geom) {
+ struct GPUBatch **mat_geom = NULL;
+
+ if (!is_sculpt_mode_draw) {
+ mat_geom = DRW_cache_object_surface_material_get(
+ ob, gpumat_array, materials_len,
+ &auto_layer_names,
+ &auto_layer_is_srgb,
+ &auto_layer_count);
+ }
+
+ if (is_sculpt_mode_draw || mat_geom) {
for (int i = 0; i < materials_len; ++i) {
- if (mat_geom[i] == NULL) {
+ if (!is_sculpt_mode_draw && mat_geom[i] == NULL) {
continue;
}
EEVEE_ObjectEngineData *oedata = NULL;
Material *ma = give_current_material(ob, i + 1);
- if (ma == NULL)
+ if (ma == NULL) {
ma = &defmaterial;
+ }
/* Do not render surface if we are rendering a volume object
* and do not have a surface closure. */
@@ -1547,7 +1548,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
/* XXX TODO rewrite this to include the dupli objects.
* This means we cannot exclude dupli objects from reflections!!! */
- if ((ob->base_flag & BASE_FROMDUPLI) == 0) {
+ if ((ob->base_flag & BASE_FROM_DUPLI) == 0) {
oedata = EEVEE_object_data_ensure(ob);
oedata->ob = ob;
oedata->test_data = &sldata->probes->vis_data;
@@ -1560,6 +1561,11 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
ADD_SHGROUP_CALL_SAFE(shgrp_depth_array[i], ob, ma, mat_geom[i], oedata);
ADD_SHGROUP_CALL_SAFE(shgrp_depth_clip_array[i], ob, ma, mat_geom[i], oedata);
+ /* TODO(fclem): Don't support shadows in sculpt mode. */
+ if (is_sculpt_mode_draw) {
+ break;
+ }
+
char *name = auto_layer_names;
for (int j = 0; j < auto_layer_count; ++j) {
/* TODO don't add these uniform when not needed (default pass shaders). */
@@ -1676,7 +1682,7 @@ void EEVEE_hair_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sldata,
static float half = 0.5f;
static float error_col[3] = {1.0f, 0.0f, 1.0f};
static float compile_col[3] = {0.5f, 0.5f, 0.5f};
- struct GPUMaterial *gpumat = EEVEE_material_hair_get(scene, ma, sldata->lamps->shadow_method);
+ struct GPUMaterial *gpumat = EEVEE_material_hair_get(scene, ma, sldata->lights->shadow_method);
switch (GPU_material_status(gpumat)) {
case GPU_MAT_SUCCESS:
@@ -1713,7 +1719,7 @@ void EEVEE_hair_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sldata,
shgrp = EEVEE_default_shading_group_get(sldata, vedata,
ob, psys, md,
true, false, use_ssr,
- sldata->lamps->shadow_method);
+ sldata->lights->shadow_method);
DRW_shgroup_uniform_vec3(shgrp, "basecol", color_p, 1);
DRW_shgroup_uniform_float(shgrp, "metallic", metal_p, 1);
DRW_shgroup_uniform_float(shgrp, "specular", spec_p, 1);
@@ -1740,7 +1746,7 @@ void EEVEE_materials_cache_finish(EEVEE_Data *vedata)
const View3D *v3d = draw_ctx->v3d;
if (LOOK_DEV_OVERLAY_ENABLED(v3d)) {
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
- EEVEE_LampsInfo *linfo = sldata->lamps;
+ EEVEE_LightsInfo *linfo = sldata->lights;
struct GPUBatch *sphere = DRW_cache_sphere_get();
static float mat1[4][4];
static float color[3] = {0.8f, 0.8f, 0.8f};
diff --git a/source/blender/draw/engines/eevee/eevee_mist.c b/source/blender/draw/engines/eevee/eevee_mist.c
index de9582611ec..315a87776ef 100644
--- a/source/blender/draw/engines/eevee/eevee_mist.c
+++ b/source/blender/draw/engines/eevee/eevee_mist.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_mist.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Implementation of Blender Mist pass.
* IMPORTANT: This is a "post process" of the Z depth so it will lack any transparent objects.
diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c
index d2309d20abb..9ffd2006998 100644
--- a/source/blender/draw/engines/eevee/eevee_motion_blur.c
+++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,29 +13,25 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_motion_blur.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Gather all screen space effects technique such as Bloom, Motion Blur, DoF, SSAO, SSR, ...
*/
#include "DRW_render.h"
-#include "BKE_global.h" /* for G.debug_value */
#include "BKE_camera.h"
#include "BKE_object.h"
#include "BKE_animsys.h"
-#include "BKE_screen.h"
#include "DNA_anim_types.h"
#include "DNA_camera_types.h"
#include "DNA_screen_types.h"
-#include "ED_screen.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
@@ -72,7 +66,6 @@ static void eevee_motion_blur_camera_get_matrix_at_time(
/* Past matrix */
/* FIXME : This is a temporal solution that does not take care of parent animations */
/* Recalc Anim manually */
- BKE_animsys_evaluate_animdata(draw_ctx->depsgraph, scene, &cam_cpy.id, cam_cpy.adt, time, ADT_RECALC_ALL);
BKE_animsys_evaluate_animdata(draw_ctx->depsgraph, scene, &camdata_cpy.id, camdata_cpy.adt, time, ADT_RECALC_ALL);
BKE_object_where_is_calc_time(draw_ctx->depsgraph, scene, &cam_cpy, time);
diff --git a/source/blender/draw/engines/eevee/eevee_occlusion.c b/source/blender/draw/engines/eevee/eevee_occlusion.c
index 3763e13533d..050870292ab 100644
--- a/source/blender/draw/engines/eevee/eevee_occlusion.c
+++ b/source/blender/draw/engines/eevee/eevee_occlusion.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_occlusion.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Implementation of the screen space Ground Truth Ambient Occlusion.
*/
@@ -29,7 +26,6 @@
#include "BLI_string_utils.h"
-#include "DNA_anim_types.h"
#include "DEG_depsgraph_query.h"
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h
index 9fc0a304c0b..07485167fe3 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_private.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __EEVEE_PRIVATE_H__
@@ -28,12 +25,12 @@
#include "DNA_lightprobe_types.h"
-struct Object;
struct EEVEE_BoundSphere;
struct EEVEE_ShadowCasterBuffer;
+struct GPUFrameBuffer;
+struct Object;
struct RenderLayer;
struct RenderResult;
-struct GPUFrameBuffer;
extern struct DrawEngineType draw_engine_eevee_type;
@@ -113,7 +110,7 @@ extern struct DrawEngineType draw_engine_eevee_type;
} \
} ((void)0)
-#define OVERLAY_ENABLED(v3d) ((v3d) && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0)
+#define OVERLAY_ENABLED(v3d) ((v3d) && (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0)
#define LOOK_DEV_MODE_ENABLED(v3d) ((v3d) && (v3d->shading.type == OB_MATERIAL))
#define LOOK_DEV_OVERLAY_ENABLED(v3d) (LOOK_DEV_MODE_ENABLED(v3d) && OVERLAY_ENABLED(v3d) && (v3d->overlay.flag & V3D_OVERLAY_LOOK_DEV))
#define USE_SCENE_LIGHT(v3d) ((!v3d) || (!LOOK_DEV_MODE_ENABLED(v3d)) || ((LOOK_DEV_MODE_ENABLED(v3d) && (v3d->shading.flag & V3D_SHADING_SCENE_LIGHTS))))
@@ -355,10 +352,10 @@ typedef struct EEVEE_Light {
float spotsize, spotblend, radius, shadowid;
float rightvec[3], sizex;
float upvec[3], sizey;
- float forwardvec[3], lamptype;
+ float forwardvec[3], light_type;
} EEVEE_Light;
-/* Special type for elliptic area lamps, matches lamps_lib.glsl */
+/* Special type for elliptic area lights, matches lamps_lib.glsl */
#define LAMPTYPE_AREA_ELLIPSE 100.0f
typedef struct EEVEE_Shadow {
@@ -372,7 +369,8 @@ typedef struct EEVEE_ShadowCube {
} EEVEE_ShadowCube;
typedef struct EEVEE_ShadowCascade {
- float shadowmat[MAX_CASCADE_NUM][4][4]; /* World->Lamp->NDC->Tex : used for sampling the shadow map. */
+ /* World->Light->NDC->Tex : used for sampling the shadow map. */
+ float shadowmat[MAX_CASCADE_NUM][4][4];
float split_start[4];
float split_end[4];
} EEVEE_ShadowCascade;
@@ -407,7 +405,7 @@ typedef struct EEVEE_ShadowCasterBuffer {
} EEVEE_ShadowCasterBuffer;
/* ************ LIGHT DATA ************* */
-typedef struct EEVEE_LampsInfo {
+typedef struct EEVEE_LightsInfo {
int num_light, cache_num_light;
int num_cube_layer, cache_num_cube_layer;
int num_cascade_layer, cache_num_cascade_layer;
@@ -438,15 +436,15 @@ typedef struct EEVEE_LampsInfo {
/* Pointers only. */
struct EEVEE_ShadowCasterBuffer *shcaster_frontbuffer;
struct EEVEE_ShadowCasterBuffer *shcaster_backbuffer;
-} EEVEE_LampsInfo;
+} EEVEE_LightsInfo;
-/* EEVEE_LampsInfo->shadow_casters_flag */
+/* EEVEE_LightsInfo->shadow_casters_flag */
enum {
SHADOW_CASTER_PRUNED = (1 << 0),
SHADOW_CASTER_UPDATED = (1 << 1),
};
-/* EEVEE_LampsInfo->update_flag */
+/* EEVEE_LightsInfo->update_flag */
enum {
LIGHT_UPDATE_SHADOW_CUBE = (1 << 0),
};
@@ -648,7 +646,7 @@ typedef struct EEVEE_CommonUniformBuffer {
int sss_toggle; /* bool */
/* Specular */
int spec_toggle; /* bool */
- /* Lamps */
+ /* Lights */
int la_num_light; /* int */
/* Probes */
int prb_num_planar; /* int */
@@ -678,8 +676,8 @@ typedef struct EEVEE_ClipPlanesUniformBuffer {
/* ************** SCENE LAYER DATA ************** */
typedef struct EEVEE_ViewLayerData {
- /* Lamps */
- struct EEVEE_LampsInfo *lamps;
+ /* Lights */
+ struct EEVEE_LightsInfo *lights;
struct GPUUniformBuffer *light_ubo;
struct GPUUniformBuffer *shadow_ubo;
@@ -729,7 +727,8 @@ typedef struct EEVEE_ShadowCubeData {
typedef struct EEVEE_ShadowCascadeData {
short light_id, shadow_id, cascade_id, layer_id;
- float viewprojmat[MAX_CASCADE_NUM][4][4]; /* World->Lamp->NDC : used for rendering the shadow map. */
+ /* World->Light->NDC : used for rendering the shadow map. */
+ float viewprojmat[MAX_CASCADE_NUM][4][4];
float projmat[MAX_CASCADE_NUM][4][4];
float viewmat[4][4], viewinv[4][4];
float radius[MAX_CASCADE_NUM];
@@ -738,7 +737,7 @@ typedef struct EEVEE_ShadowCascadeData {
/* Theses are the structs stored inside Objects.
* It works with even if the object is in multiple layers
* because we don't get the same "Object *" for each layer. */
-typedef struct EEVEE_LampEngineData {
+typedef struct EEVEE_LightEngineData {
DrawData dd;
bool need_update;
@@ -749,7 +748,7 @@ typedef struct EEVEE_LampEngineData {
struct EEVEE_ShadowCubeData scd;
struct EEVEE_ShadowCascadeData scad;
} data;
-} EEVEE_LampEngineData;
+} EEVEE_LightEngineData;
typedef struct EEVEE_LightProbeEngineData {
DrawData dd;
@@ -816,7 +815,7 @@ typedef struct EEVEE_PrivateData {
float mist_start, mist_inv_dist, mist_falloff;
/* Color Management */
- bool use_color_view_settings;
+ bool use_color_render_settings;
} EEVEE_PrivateData; /* Transient data */
/* eevee_data.c */
@@ -828,8 +827,8 @@ EEVEE_ObjectEngineData *EEVEE_object_data_get(Object *ob);
EEVEE_ObjectEngineData *EEVEE_object_data_ensure(Object *ob);
EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_get(Object *ob);
EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_ensure(Object *ob);
-EEVEE_LampEngineData *EEVEE_lamp_data_get(Object *ob);
-EEVEE_LampEngineData *EEVEE_lamp_data_ensure(Object *ob);
+EEVEE_LightEngineData *EEVEE_light_data_get(Object *ob);
+EEVEE_LightEngineData *EEVEE_light_data_ensure(Object *ob);
EEVEE_WorldEngineData *EEVEE_world_data_get(World *wo);
EEVEE_WorldEngineData *EEVEE_world_data_ensure(World *wo);
@@ -1013,7 +1012,7 @@ static const float texcomat[4][4] = { /* From NDC to TexCo */
{0.5f, 0.0f, 0.0f, 0.0f},
{0.0f, 0.5f, 0.0f, 0.0f},
{0.0f, 0.0f, 0.5f, 0.0f},
- {0.5f, 0.5f, 0.5f, 1.0f}
+ {0.5f, 0.5f, 0.5f, 1.0f},
};
/* Cubemap Matrices */
diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c
index eddebdbec4c..0cf1d31f8b8 100644
--- a/source/blender/draw/engines/eevee/eevee_render.c
+++ b/source/blender/draw/engines/eevee/eevee_render.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_render.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
/**
@@ -33,7 +30,6 @@
#include "DNA_node_types.h"
#include "DNA_object_types.h"
-#include "BKE_camera.h"
#include "BKE_object.h"
#include "BLI_rand.h"
@@ -42,7 +38,6 @@
#include "DEG_depsgraph_query.h"
#include "GPU_framebuffer.h"
-#include "GPU_glew.h"
#include "GPU_state.h"
#include "RE_pipeline.h"
@@ -285,8 +280,9 @@ static void eevee_render_result_normal(
EEVEE_PrivateData *g_data = stl->g_data;
/* Only read the center texel. */
- if (stl->effects->taa_current_sample > 1)
+ if (stl->effects->taa_current_sample > 1) {
return;
+ }
if ((view_layer->passflag & SCE_PASS_NORMAL) != 0) {
RenderPass *rp = RE_pass_find_by_name(rl, RE_PASSNAME_NORMAL, viewname);
@@ -333,8 +329,9 @@ static void eevee_render_result_z(
EEVEE_PrivateData *g_data = stl->g_data;
/* Only read the center texel. */
- if (stl->effects->taa_current_sample > 1)
+ if (stl->effects->taa_current_sample > 1) {
return;
+ }
if ((view_layer->passflag & SCE_PASS_Z) != 0) {
RenderPass *rp = RE_pass_find_by_name(rl, RE_PASSNAME_Z, viewname);
@@ -475,7 +472,7 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl
/* Sort transparents before the loop. */
DRW_pass_sort_shgroup_z(psl->transparent_pass);
- /* Push instances attribs to the GPU. */
+ /* Push instances attributes to the GPU. */
DRW_render_instance_buffer_finish();
/* Need to be called after DRW_render_instance_buffer_finish() */
diff --git a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c
index 13bedc34e05..113cd359b2e 100644
--- a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c
+++ b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_screen_raytrace.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Screen space reflections and refractions techniques.
*/
@@ -156,7 +153,7 @@ int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
int tracing_res[2] = {(int)viewport_size[0] / divisor, (int)viewport_size[1] / divisor};
int size_fs[2] = {(int)viewport_size[0], (int)viewport_size[1]};
const bool high_qual_input = true; /* TODO dither low quality input */
- const GPUTextureFormat format = (high_qual_input) ? GPU_RGBA16F : GPU_RGBA8;
+ const eGPUTextureFormat format = (high_qual_input) ? GPU_RGBA16F : GPU_RGBA8;
/* MRT for the shading pass in order to output needed data for the SSR pass. */
effects->ssr_specrough_input = DRW_texture_pool_query_2D(size_fs[0], size_fs[1], format,
diff --git a/source/blender/draw/engines/eevee/eevee_shaders.c b/source/blender/draw/engines/eevee/eevee_shaders.c
index 29b30e7763e..f6479603a66 100644
--- a/source/blender/draw/engines/eevee/eevee_shaders.c
+++ b/source/blender/draw/engines/eevee/eevee_shaders.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_shaders.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "DRW_render.h"
@@ -97,7 +94,6 @@ extern char datatoc_effect_velocity_resolve_frag_glsl[];
/* Temporal Sampling */
extern char datatoc_effect_temporal_aa_glsl[];
-extern GlobalsUboStorage ts;
/* *********** FUNCTIONS *********** */
diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.c b/source/blender/draw/engines/eevee/eevee_subsurface.c
index 9ecc1fb1b2b..49bea1fb01e 100644
--- a/source/blender/draw/engines/eevee/eevee_subsurface.c
+++ b/source/blender/draw/engines/eevee/eevee_subsurface.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_subsurface.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Screen space subsurface scattering technique.
*/
@@ -80,11 +77,6 @@ int EEVEE_subsurface_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
effects->sss_separate_albedo = (scene_eval->eevee.flag & SCE_EEVEE_SSS_SEPARATE_ALBEDO) != 0;
common_data->sss_jitter_threshold = scene_eval->eevee.sss_jitter_threshold;
- /* Force separate albedo for final render */
- if (DRW_state_is_image_render()) {
- effects->sss_separate_albedo = true;
- }
-
/* Shaders */
if (!e_data.sss_sh[0]) {
eevee_create_shader_subsurface();
diff --git a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
index deac0b89b10..67ac6126148 100644
--- a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
+++ b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_temporal_sampling.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Temporal super sampling technique
*/
@@ -30,7 +27,6 @@
#include "ED_screen.h"
#include "BLI_rand.h"
-#include "BLI_string_utils.h"
#include "DEG_depsgraph_query.h"
diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c
index 4fffa3f285c..cf12863565f 100644
--- a/source/blender/draw/engines/eevee/eevee_volumes.c
+++ b/source/blender/draw/engines/eevee/eevee_volumes.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file eevee_volumes.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Volumetric effects rendering using frostbite approach.
*/
@@ -34,10 +31,9 @@
#include "DNA_smoke_types.h"
#include "DNA_world_types.h"
-#include "BKE_global.h" /* for G.debug_value */
#include "BKE_modifier.h"
#include "BKE_mesh.h"
-#include "BKE_object.h"
+#include "BKE_smoke.h"
#include "ED_screen.h"
@@ -50,11 +46,11 @@
static struct {
char *volumetric_common_lib;
- char *volumetric_common_lamps_lib;
+ char *volumetric_common_lights_lib;
struct GPUShader *volumetric_clear_sh;
struct GPUShader *volumetric_scatter_sh;
- struct GPUShader *volumetric_scatter_with_lamps_sh;
+ struct GPUShader *volumetric_scatter_with_lights_sh;
struct GPUShader *volumetric_integration_sh;
struct GPUShader *volumetric_resolve_sh;
@@ -70,7 +66,7 @@ extern char datatoc_common_uniforms_lib_glsl[];
extern char datatoc_common_view_lib_glsl[];
extern char datatoc_octahedron_lib_glsl[];
extern char datatoc_irradiance_lib_glsl[];
-extern char datatoc_lamps_lib_glsl[];
+extern char datatoc_lights_lib_glsl[];
extern char datatoc_volumetric_frag_glsl[];
extern char datatoc_volumetric_geom_glsl[];
extern char datatoc_volumetric_vert_glsl[];
@@ -88,13 +84,13 @@ static void eevee_create_shader_volumes(void)
datatoc_bsdf_common_lib_glsl,
datatoc_volumetric_lib_glsl);
- e_data.volumetric_common_lamps_lib = BLI_string_joinN(
+ e_data.volumetric_common_lights_lib = BLI_string_joinN(
datatoc_common_view_lib_glsl,
datatoc_common_uniforms_lib_glsl,
datatoc_bsdf_common_lib_glsl,
datatoc_octahedron_lib_glsl,
datatoc_irradiance_lib_glsl,
- datatoc_lamps_lib_glsl,
+ datatoc_lights_lib_glsl,
datatoc_volumetric_lib_glsl);
e_data.volumetric_clear_sh = DRW_shader_create_with_lib(
@@ -108,15 +104,15 @@ static void eevee_create_shader_volumes(void)
datatoc_volumetric_vert_glsl,
datatoc_volumetric_geom_glsl,
datatoc_volumetric_scatter_frag_glsl,
- e_data.volumetric_common_lamps_lib,
+ e_data.volumetric_common_lights_lib,
SHADER_DEFINES
"#define VOLUMETRICS\n"
"#define VOLUME_SHADOW\n");
- e_data.volumetric_scatter_with_lamps_sh = DRW_shader_create_with_lib(
+ e_data.volumetric_scatter_with_lights_sh = DRW_shader_create_with_lib(
datatoc_volumetric_vert_glsl,
datatoc_volumetric_geom_glsl,
datatoc_volumetric_scatter_frag_glsl,
- e_data.volumetric_common_lamps_lib,
+ e_data.volumetric_common_lights_lib,
SHADER_DEFINES
"#define VOLUMETRICS\n"
"#define VOLUME_LIGHTING\n"
@@ -420,7 +416,7 @@ void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
psl->volumetric_objects_ps = DRW_pass_create("Volumetric Properties", DRW_STATE_WRITE_COLOR |
DRW_STATE_ADDITIVE);
- struct GPUShader *scatter_sh = (common_data->vol_use_lights) ? e_data.volumetric_scatter_with_lamps_sh
+ struct GPUShader *scatter_sh = (common_data->vol_use_lights) ? e_data.volumetric_scatter_with_lights_sh
: e_data.volumetric_scatter_sh;
psl->volumetric_scatter_ps = DRW_pass_create("Volumetric Scattering", DRW_STATE_WRITE_COLOR);
grp = DRW_shgroup_empty_tri_batch_create(scatter_sh, psl->volumetric_scatter_ps,
@@ -497,7 +493,7 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved
DRW_shgroup_uniform_vec3(grp, "volumeOrcoSize", texcosize, 1);
/* Smoke Simulation */
- if (((ob->base_flag & BASE_FROMDUPLI) == 0) &&
+ if (((ob->base_flag & BASE_FROM_DUPLI) == 0) &&
(md = modifiers_findByType(ob, eModifierType_Smoke)) &&
(modifier_isEnabled(scene, md, eModifierMode_Realtime)))
{
@@ -512,10 +508,11 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved
const bool show_smoke = ((int)DEG_get_ctime(draw_ctx->depsgraph) >= sds->point_cache[0]->startframe);
if (sds->fluid && show_smoke) {
- if (!sds->wt || !(sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
+ const bool show_highres = BKE_smoke_show_highres(scene, sds);
+ if (!sds->wt || !show_highres) {
GPU_create_smoke(smd, 0);
}
- else if (sds->wt && (sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
+ else if (sds->wt && show_highres) {
GPU_create_smoke(smd, 1);
}
BLI_addtail(&e_data.smoke_domains, BLI_genericNodeN(smd));
@@ -611,11 +608,11 @@ void EEVEE_volumes_free_smoke_textures(void)
void EEVEE_volumes_free(void)
{
MEM_SAFE_FREE(e_data.volumetric_common_lib);
- MEM_SAFE_FREE(e_data.volumetric_common_lamps_lib);
+ MEM_SAFE_FREE(e_data.volumetric_common_lights_lib);
DRW_SHADER_FREE_SAFE(e_data.volumetric_clear_sh);
DRW_SHADER_FREE_SAFE(e_data.volumetric_scatter_sh);
- DRW_SHADER_FREE_SAFE(e_data.volumetric_scatter_with_lamps_sh);
+ DRW_SHADER_FREE_SAFE(e_data.volumetric_scatter_with_lights_sh);
DRW_SHADER_FREE_SAFE(e_data.volumetric_integration_sh);
DRW_SHADER_FREE_SAFE(e_data.volumetric_resolve_sh);
}
diff --git a/source/blender/draw/engines/eevee/shaders/background_vert.glsl b/source/blender/draw/engines/eevee/shaders/background_vert.glsl
index 380d6d96491..8b4bc3382f4 100644
--- a/source/blender/draw/engines/eevee/shaders/background_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/background_vert.glsl
@@ -21,7 +21,7 @@ void main()
worldNormal = viewNormal = normalize(-viewPosition);
#endif
-#ifdef ATTRIB
- pass_attrib(viewPosition);
+#ifdef USE_ATTR
+ pass_attr(viewPosition);
#endif
}
diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
index a54cefc5b85..b7e03b2937e 100644
--- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
@@ -29,7 +29,7 @@ struct LightData {
vec4 spotdata_radius_shadow; /* x : spot size, y : spot blend, z : radius, w: shadow id */
vec4 rightvec_sizex; /* xyz: Normalized up vector, w: area size X or spot scale X */
vec4 upvec_sizey; /* xyz: Normalized right vector, w: area size Y or spot scale Y */
- vec4 forwardvec_type; /* xyz: Normalized forward vector, w: Lamp Type */
+ vec4 forwardvec_type; /* xyz: Normalized forward vector, w: Light Type */
};
/* convenience aliases */
@@ -244,8 +244,9 @@ float line_unit_sphere_intersect_dist(vec3 lineorigin, vec3 linedirection)
float dist = 1e15;
float determinant = b * b - a * c;
- if (determinant >= 0)
+ if (determinant >= 0) {
dist = (sqrt(determinant) - b) / a;
+ }
return dist;
}
@@ -740,16 +741,23 @@ Closure closure_mix(Closure cl1, Closure cl2, float fac)
# endif
# endif
}
+
+ /* When mixing SSR don't blend roughness.
+ *
+ * It makes no sense to mix them really, so we take either one of them and
+ * tone down its specularity (ssr_data.xyz) while keeping its roughness (ssr_data.w).
+ */
if (cl1.ssr_id == outputSsrId) {
- cl.ssr_data = mix(cl1.ssr_data.xyzw, vec4(vec3(0.0), cl1.ssr_data.w), fac); /* do not blend roughness */
+ cl.ssr_data = mix(cl1.ssr_data.xyzw, vec4(vec3(0.0), cl1.ssr_data.w), fac);
cl.ssr_normal = cl1.ssr_normal;
cl.ssr_id = cl1.ssr_id;
}
else {
- cl.ssr_data = mix(vec4(vec3(0.0), cl2.ssr_data.w), cl2.ssr_data.xyzw, fac); /* do not blend roughness */
+ cl.ssr_data = mix(vec4(vec3(0.0), cl2.ssr_data.w), cl2.ssr_data.xyzw, fac);
cl.ssr_normal = cl2.ssr_normal;
cl.ssr_id = cl2.ssr_id;
}
+
cl.opacity = mix(cl1.opacity, cl2.opacity, fac);
cl.radiance = mix(cl1.radiance * cl1.opacity, cl2.radiance * cl2.opacity, fac);
cl.radiance /= max(1e-8, cl.opacity);
diff --git a/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl b/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl
index 9c5a212aead..b8dff694aca 100644
--- a/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl
@@ -27,7 +27,7 @@ layout(std140) uniform common_block {
bool sssToggle;
/* Specular */
bool specToggle;
- /* Lamps */
+ /* Lights */
int laNumLight;
/* Probes */
int prbNumPlanar;
diff --git a/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl
index c3674c8f74c..f06a17a8e44 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl
@@ -164,9 +164,11 @@ vec4 step_blit(void)
/* Combine and apply the brightness response curve. */
m *= max(rq, br - curveThreshold.w) / max(1e-5, br);
- /* Clamp pixel intensity */
- br = max(1e-5, brightness(m));
- m *= 1.0 - max(0.0, br - clampIntensity) / br;
+ /* Clamp pixel intensity if clamping enabled */
+ if (clampIntensity > 0.0) {
+ br = max(1e-5, brightness(m));
+ m *= 1.0 - max(0.0, br - clampIntensity) / br;
+ }
return vec4(m, 1.0);
}
diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl
index 27517ebd86e..067b0786e34 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_dof_frag.glsl
@@ -108,15 +108,17 @@ layout(location = 1) out float fragAlpha;
void main(void)
{
/* Discard to avoid bleeding onto the next layer */
- if (int(gl_FragCoord.x) * edge.x + edge.y > 0)
+ if (int(gl_FragCoord.x) * edge.x + edge.y > 0) {
discard;
+ }
/* Circle Dof */
float dist = length(particlecoord);
/* Ouside of bokeh shape */
- if (dist > 1.0)
+ if (dist > 1.0) {
discard;
+ }
/* Regular Polygon Dof */
if (bokeh_sides.x > 0.0) {
@@ -134,8 +136,9 @@ void main(void)
dist /= r;
/* Ouside of bokeh shape */
- if (dist > 1.0)
+ if (dist > 1.0) {
discard;
+ }
}
fragColor = color;
diff --git a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
index b8a86f8d742..d44cf5e3518 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
@@ -91,8 +91,9 @@ void main()
/* Early out */
/* We can't do discard because we don't clear the render target. */
- if (depth == 1.0)
+ if (depth == 1.0) {
return;
+ }
vec2 uvs = vec2(fullres_texel) / vec2(textureSize(depthBuffer, 0));
@@ -105,16 +106,18 @@ void main()
vec4 speccol_roughness = texelFetch(specroughBuffer, fullres_texel, 0).rgba;
/* Early out */
- if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0)
+ if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0) {
return;
+ }
float roughness = speccol_roughness.a;
float roughnessSquared = max(1e-3, roughness * roughness);
float a2 = roughnessSquared * roughnessSquared;
/* Early out */
- if (roughness > ssrMaxRoughness + 0.2)
+ if (roughness > ssrMaxRoughness + 0.2) {
return;
+ }
vec4 rand = texelFetch(utilTex, ivec3(halfres_texel % LUT_SIZE, 2), 0);
@@ -394,8 +397,9 @@ void main()
float depth = textureLod(depthBuffer, uvs, 0.0).r;
/* Early out */
- if (depth == 1.0)
+ if (depth == 1.0) {
discard;
+ }
/* Using world space */
vec3 viewPosition = get_view_space_from_depth(uvs, depth); /* Needed for viewCameraVec */
@@ -406,8 +410,9 @@ void main()
vec4 speccol_roughness = texelFetch(specroughBuffer, fullres_texel, 0).rgba;
/* Early out */
- if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0)
+ if (dot(speccol_roughness.rgb, vec3(1.0)) == 0.0) {
discard;
+ }
float roughness = speccol_roughness.a;
float roughnessSquared = max(1e-3, roughness * roughness);
diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_frag.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_frag.glsl
index 5a72244cfbe..bd51546eadf 100644
--- a/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_frag.glsl
@@ -9,8 +9,9 @@ void main()
float dist_sqr = dot(quadCoord, quadCoord);
/* Discard outside the circle. */
- if (dist_sqr > 1.0)
+ if (dist_sqr > 1.0) {
discard;
+ }
vec3 view_nor = vec3(quadCoord, sqrt(max(0.0, 1.0 - dist_sqr)));
vec3 world_ref = mat3(ViewMatrixInverse) * reflect(vec3(0.0, 0.0, -1.0), view_nor);
diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_geom.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_geom.glsl
index 2ce37d867b7..996b507239d 100644
--- a/source/blender/draw/engines/eevee/shaders/lightprobe_geom.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lightprobe_geom.glsl
@@ -24,8 +24,8 @@ void main() {
for (int v = 0; v < 3; ++v) {
gl_Position = vPos[v];
worldPosition = x_axis[fFace] * vPos[v].x + y_axis[fFace] * vPos[v].y + maj_axes[fFace];
-#ifdef ATTRIB
- pass_attrib(v);
+#ifdef USE_ATTR
+ pass_attr(v);
#endif
EmitVertex();
}
diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_frag.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_frag.glsl
index fd8eb157aa5..fe0e173ba3d 100644
--- a/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_frag.glsl
@@ -9,8 +9,9 @@ void main()
float dist_sqr = dot(quadCoord, quadCoord);
/* Discard outside the circle. */
- if (dist_sqr > 1.0)
+ if (dist_sqr > 1.0) {
discard;
+ }
vec3 view_nor = vec3(quadCoord, sqrt(max(0.0, 1.0 - dist_sqr)));
vec3 world_nor = mat3(ViewMatrixInverse) * view_nor;
diff --git a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl b/source/blender/draw/engines/eevee/shaders/lights_lib.glsl
index fb18af494b4..e12d76596d3 100644
--- a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lights_lib.glsl
@@ -19,7 +19,7 @@ layout(std140) uniform light_block {
#define SUN 1.0
#define SPOT 2.0
#define AREA_RECT 4.0
-/* Used to define the area lamp shape, doesn't directly correspond to a Blender lamp type. */
+/* Used to define the area light shape, doesn't directly correspond to a Blender light type. */
#define AREA_ELLIPSE 100.0
#if defined(SHADOW_VSM)
@@ -52,8 +52,9 @@ float shadow_test(ShadowSample moments, float dist, ShadowData sd)
{
float p = 0.0;
- if (dist <= moments.x)
+ if (dist <= moments.x) {
p = 1.0;
+ }
float variance = moments.y - (moments.x * moments.x);
variance = max(variance, sd.sh_bias / 10.0);
diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
index 5631957ca31..3d5b8f6f975 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
@@ -194,7 +194,7 @@ void CLOSURE_NAME(
vec4 rand = texelFetch(utilTex, ivec3(ivec2(gl_FragCoord.xy) % LUT_SIZE, 2.0), 0);
/* ---------------------------------------------------------------- */
- /* -------------------- SCENE LAMPS LIGHTING ---------------------- */
+ /* -------------------- SCENE LIGHTS LIGHTING --------------------- */
/* ---------------------------------------------------------------- */
#ifdef CLOSURE_GLOSSY
@@ -217,8 +217,9 @@ void CLOSURE_NAME(
float l_vis = light_visibility(ld, worldPosition, viewPosition, viewNormal, l_vector);
- if (l_vis < 1e-8)
+ if (l_vis < 1e-8) {
continue;
+ }
vec3 l_color_vis = ld.l_color * l_vis;
@@ -240,13 +241,13 @@ void CLOSURE_NAME(
}
#ifdef CLOSURE_GLOSSY
- vec3 brdf_lut_lamps = texture(utilTex, vec3(lut_uv, 1.0)).rgb;
- out_spec *= F_area(f0, brdf_lut_lamps.xy) * brdf_lut_lamps.z;
+ vec3 brdf_lut_lights = texture(utilTex, vec3(lut_uv, 1.0)).rgb;
+ out_spec *= F_area(f0, brdf_lut_lights.xy) * brdf_lut_lights.z;
#endif
#ifdef CLOSURE_CLEARCOAT
- vec3 brdf_lut_lamps_clear = texture(utilTex, vec3(lut_uv_clear, 1.0)).rgb;
- out_spec_clear *= F_area(vec3(0.04), brdf_lut_lamps_clear.xy) * brdf_lut_lamps_clear.z;
+ vec3 brdf_lut_lights_clear = texture(utilTex, vec3(lut_uv_clear, 1.0)).rgb;
+ out_spec_clear *= F_area(vec3(0.04), brdf_lut_lights_clear.xy) * brdf_lut_lights_clear.z;
out_spec += out_spec_clear * C_intensity;
#endif
diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
index a6e6f1fac42..ef7213cd21e 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
@@ -2,7 +2,7 @@
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 ModelViewMatrix;
uniform mat3 WorldNormalMatrix;
-#ifndef ATTRIB
+#ifndef USE_ATTR
uniform mat4 ModelMatrix;
uniform mat3 NormalMatrix;
uniform mat4 ModelMatrixInverse;
@@ -73,7 +73,7 @@ void main()
/* Used for planar reflections */
gl_ClipDistance[0] = dot(vec4(worldPosition, 1.0), ClipPlanes[0]);
-#ifdef ATTRIB
- pass_attrib(pos);
+#ifdef USE_ATTR
+ pass_attr(pos);
#endif
}
diff --git a/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl b/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl
index 11c223a45d6..b042b7fab45 100644
--- a/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl
@@ -93,10 +93,12 @@ vec3 solve_cubic(vec4 coefs)
float x_3d = 2.0 * sqrt(-C_d) * cos(theta + (2.0 / 3.0) * M_PI);
float xs;
- if (x_1d + x_3d < 2.0 * C)
+ if (x_1d + x_3d < 2.0 * C) {
xs = x_1d;
- else
+ }
+ else {
xs = x_3d;
+ }
xsc = vec2(-D, xs + C);
}
@@ -279,8 +281,9 @@ float ltc_evaluate_disk(vec3 N, vec3 V, mat3 Minv, vec3 disk_points[3])
/* Now find front facing ellipse with same solid angle. */
vec3 V3 = normalize(cross(V1, V2));
- if (dot(C, V3) < 0.0)
+ if (dot(C, V3) < 0.0) {
V3 *= -1.0;
+ }
float L = dot(V3, C);
float x0 = dot(V1, C) / L;
diff --git a/source/blender/draw/engines/eevee/shaders/prepass_frag.glsl b/source/blender/draw/engines/eevee/shaders/prepass_frag.glsl
index 6b6ab0c0bcc..bbc49fea6ba 100644
--- a/source/blender/draw/engines/eevee/shaders/prepass_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/prepass_frag.glsl
@@ -75,12 +75,14 @@ void main()
#if defined(USE_ALPHA_HASH)
/* Hashed Alpha Testing */
- if (cl.opacity < hashed_alpha_threshold(worldPosition))
+ if (cl.opacity < hashed_alpha_threshold(worldPosition)) {
discard;
+ }
#elif defined(USE_ALPHA_CLIP)
/* Alpha clip */
- if (cl.opacity <= alphaThreshold)
+ if (cl.opacity <= alphaThreshold) {
discard;
+ }
#endif
#endif
}
diff --git a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
index cfd24ae8d65..2583c7c8765 100644
--- a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
@@ -3,7 +3,7 @@ uniform mat4 ModelViewProjectionMatrix;
#ifdef MESH_SHADER
uniform mat4 ModelViewMatrix;
uniform mat3 WorldNormalMatrix;
-# ifndef ATTRIB
+# ifndef USE_ATTR
uniform mat4 ModelMatrix;
uniform mat3 NormalMatrix;
# endif
@@ -26,8 +26,8 @@ void main() {
worldPosition = (ModelMatrix * vec4(pos, 1.0)).xyz;
viewNormal = normalize(NormalMatrix * nor);
worldNormal = normalize(WorldNormalMatrix * nor);
-#ifdef ATTRIB
- pass_attrib(pos);
+#ifdef USE_ATTR
+ pass_attr(pos);
#endif
#endif
}
diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl b/source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl
index d435bda4f60..72545302fd3 100644
--- a/source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl
+++ b/source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl
@@ -17,20 +17,20 @@ flat out int slice;
void main() {
gl_Layer = slice = int(vPos[0].z);
-#ifdef ATTRIB
- pass_attrib(0);
+#ifdef USE_ATTR
+ pass_attr(0);
#endif
gl_Position = vPos[0].xyww;
EmitVertex();
-#ifdef ATTRIB
- pass_attrib(1);
+#ifdef USE_ATTR
+ pass_attr(1);
#endif
gl_Position = vPos[1].xyww;
EmitVertex();
-#ifdef ATTRIB
- pass_attrib(2);
+#ifdef USE_ATTR
+ pass_attr(2);
#endif
gl_Position = vPos[2].xyww;
EmitVertex();
@@ -46,20 +46,20 @@ void main() {
void main() {
gl_Layer = slice = int(vPos[0].z);
-#ifdef ATTRIB
- pass_attrib(0);
+#ifdef USE_ATTR
+ pass_attr(0);
#endif
gl_Position = vPos[0].xyww;
EmitVertex();
-#ifdef ATTRIB
- pass_attrib(1);
+#ifdef USE_ATTR
+ pass_attr(1);
#endif
gl_Position = vPos[1].xyww;
EmitVertex();
-#ifdef ATTRIB
- pass_attrib(2);
+#ifdef USE_ATTR
+ pass_attr(2);
#endif
gl_Position = vPos[2].xyww;
EmitVertex();
diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c
index b2c30ba723c..0100fa095e6 100644
--- a/source/blender/draw/engines/external/external_engine.c
+++ b/source/blender/draw/engines/external/external_engine.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2017, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2017, Blender Foundation.
*/
-/** \file external_engine.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Base engine for external render engines.
* We use it for depth and non-mesh objects.
@@ -31,19 +28,14 @@
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
-#include "BKE_icons.h"
-#include "BKE_idprop.h"
-#include "BKE_main.h"
-
-#include "ED_view3d.h"
#include "ED_screen.h"
-#include "GPU_glew.h"
#include "GPU_matrix.h"
#include "GPU_shader.h"
#include "GPU_viewport.h"
-#include "external_engine.h"
+#include "external_engine.h" /* own include */
+
/* Shaders */
#define EXTERNAL_ENGINE "BLENDER_EXTERNAL"
@@ -100,7 +92,7 @@ static void external_engine_init(void *UNUSED(vedata))
{
/* Depth prepass */
if (!e_data.depth_sh) {
- e_data.depth_sh = DRW_shader_create_3D_depth_only();
+ e_data.depth_sh = DRW_shader_create_3D_depth_only(GPU_SHADER_CFG_DEFAULT);
}
}
@@ -125,8 +117,9 @@ static void external_cache_populate(void *vedata, Object *ob)
{
EXTERNAL_StorageList *stl = ((EXTERNAL_Data *)vedata)->stl;
- if (!DRW_object_is_renderable(ob))
+ if (!DRW_object_is_renderable(ob)) {
return;
+ }
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
@@ -205,7 +198,7 @@ static void external_engine_free(void)
static const DrawEngineDataSize external_data_size = DRW_VIEWPORT_DATA_SIZE(EXTERNAL_Data);
-DrawEngineType draw_engine_external_type = {
+static DrawEngineType draw_engine_external_type = {
NULL, NULL,
N_("External"),
&external_data_size,
@@ -228,7 +221,7 @@ RenderEngineType DRW_engine_viewport_external_type = {
EXTERNAL_ENGINE, N_("External"), RE_INTERNAL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&draw_engine_external_type,
- {NULL, NULL, NULL}
+ {NULL, NULL, NULL},
};
#undef EXTERNAL_ENGINE
diff --git a/source/blender/draw/engines/external/external_engine.h b/source/blender/draw/engines/external/external_engine.h
index 1789fb67efe..01edea38ab0 100644
--- a/source/blender/draw/engines/external/external_engine.h
+++ b/source/blender/draw/engines/external/external_engine.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2017, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2017, Blender Foundation.
*/
-/** \file external_engine.h
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#ifndef __EXTERNAL_ENGINE_H__
diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
index e733b7e0f1f..cf3025302ef 100644
--- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2017, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Antonio Vazquez
- *
+ * Copyright 2017, Blender Foundation.
*/
-/** \file blender/draw/engines/gpencil/gpencil_cache_utils.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_engine.h"
@@ -32,6 +29,7 @@
#include "DNA_gpencil_types.h"
#include "DNA_view3d_types.h"
+#include "BKE_library.h"
#include "BKE_gpencil.h"
#include "gpencil_engine.h"
@@ -39,7 +37,6 @@
#include "draw_cache_impl.h"
#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_query.h"
/* add a gpencil object to cache to defer drawing */
tGPencilObjectCache *gpencil_object_cache_add(
@@ -49,6 +46,7 @@ tGPencilObjectCache *gpencil_object_cache_add(
const DRWContextState *draw_ctx = DRW_context_state_get();
tGPencilObjectCache *cache_elem = NULL;
RegionView3D *rv3d = draw_ctx->rv3d;
+ View3D *v3d = draw_ctx->v3d;
tGPencilObjectCache *p = NULL;
/* By default a cache is created with one block with a predefined number of free slots,
@@ -69,19 +67,31 @@ tGPencilObjectCache *gpencil_object_cache_add(
cache_elem = &cache_array[*gp_cache_used];
memset(cache_elem, 0, sizeof(*cache_elem));
- Object *ob_orig = (Object *)DEG_get_original_id(&ob->id);
- cache_elem->ob = ob_orig;
- cache_elem->gpd = (bGPdata *)ob_orig->data;
- copy_v3_v3(cache_elem->loc, ob->loc);
+ cache_elem->ob = ob;
+ cache_elem->gpd = (bGPdata *)ob->data;
+ cache_elem->name = BKE_id_to_unique_string_key(&ob->id);
+
+ copy_v3_v3(cache_elem->loc, ob->obmat[3]);
copy_m4_m4(cache_elem->obmat, ob->obmat);
cache_elem->idx = *gp_cache_used;
/* object is duplicated (particle) */
- cache_elem->is_dup_ob = ob->base_flag & BASE_FROMDUPLI;
+ cache_elem->is_dup_ob = ob->base_flag & BASE_FROM_DUPLI;
+ cache_elem->scale = mat4_to_scale(ob->obmat);
/* save FXs */
cache_elem->pixfactor = cache_elem->gpd->pixfactor;
- cache_elem->shader_fx = ob_orig->shader_fx;
+ cache_elem->shader_fx = ob->shader_fx;
+
+ /* save wire mode (object mode is always primary option) */
+ if (ob->dt == OB_WIRE) {
+ cache_elem->shading_type[0] = (int)OB_WIRE;
+ }
+ else {
+ if (v3d) {
+ cache_elem->shading_type[0] = (int)v3d->shading.type;
+ }
+ }
/* shgrp array */
cache_elem->tot_layers = 0;
@@ -94,10 +104,10 @@ tGPencilObjectCache *gpencil_object_cache_add(
float zdepth = 0.0;
if (rv3d) {
if (rv3d->is_persp) {
- zdepth = ED_view3d_calc_zfac(rv3d, ob->loc, NULL);
+ zdepth = ED_view3d_calc_zfac(rv3d, ob->obmat[3], NULL);
}
else {
- zdepth = -dot_v3v3(rv3d->viewinv[2], ob->loc);
+ zdepth = -dot_v3v3(rv3d->viewinv[2], ob->obmat[3]);
}
}
else {
@@ -112,7 +122,7 @@ tGPencilObjectCache *gpencil_object_cache_add(
mul_m4_v3(camera->obmat, vn);
normalize_v3(vn);
plane_from_point_normal_v3(plane_cam, camera->loc, vn);
- zdepth = dist_squared_to_plane_v3(ob->loc, plane_cam);
+ zdepth = dist_squared_to_plane_v3(ob->obmat[3], plane_cam);
}
}
cache_elem->zdepth = zdepth;
@@ -167,8 +177,7 @@ GpencilBatchGroup *gpencil_group_cache_add(
/* get current cache data */
static GpencilBatchCache *gpencil_batch_get_element(Object *ob)
{
- Object *ob_orig = (Object *)DEG_get_original_id(&ob->id);
- return ob_orig->runtime.gpencil_cache;
+ return ob->runtime.gpencil_cache;
}
/* verify if cache is valid */
@@ -190,13 +199,6 @@ static bool gpencil_batch_cache_valid(GpencilBatchCache *cache, bGPdata *gpd, in
gpd->flag &= ~GP_DATA_PYTHON_UPDATED;
valid = false;
}
- else if (DRW_gpencil_onion_active(gpd)) {
- /* if onion, set as dirty always
- * This reduces performance, but avoid any crash in the multiple
- * overlay and multiwindow options and keep all windows working
- */
- valid = false;
- }
else if (cache->is_editmode) {
valid = false;
}
@@ -210,14 +212,13 @@ static bool gpencil_batch_cache_valid(GpencilBatchCache *cache, bGPdata *gpd, in
/* cache init */
static GpencilBatchCache *gpencil_batch_cache_init(Object *ob, int cfra)
{
- Object *ob_orig = (Object *)DEG_get_original_id(&ob->id);
- bGPdata *gpd = (bGPdata *)ob_orig->data;
+ bGPdata *gpd = (bGPdata *)ob->data;
GpencilBatchCache *cache = gpencil_batch_get_element(ob);
if (!cache) {
cache = MEM_callocN(sizeof(*cache), __func__);
- ob_orig->runtime.gpencil_cache = cache;
+ ob->runtime.gpencil_cache = cache;
}
else {
memset(cache, 0, sizeof(*cache));
@@ -273,8 +274,7 @@ static void gpencil_batch_cache_clear(GpencilBatchCache *cache)
/* get cache */
GpencilBatchCache *gpencil_batch_cache_get(Object *ob, int cfra)
{
- Object *ob_orig = (Object *)DEG_get_original_id(&ob->id);
- bGPdata *gpd = (bGPdata *)ob_orig->data;
+ bGPdata *gpd = (bGPdata *)ob->data;
GpencilBatchCache *cache = gpencil_batch_get_element(ob);
if (!gpencil_batch_cache_valid(cache, gpd, cfra)) {
@@ -291,8 +291,7 @@ GpencilBatchCache *gpencil_batch_cache_get(Object *ob, int cfra)
/* set cache as dirty */
void DRW_gpencil_batch_cache_dirty_tag(bGPdata *gpd)
{
- bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&gpd->id);
- gpd_orig->flag |= GP_DATA_CACHE_IS_DIRTY;
+ gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
}
/* free batch cache */
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index d5927ebca9a..4c69965478e 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file draw/engines/gpencil/gpencil_draw_cache_impl.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "BLI_polyfill_2d.h"
@@ -35,14 +29,11 @@
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
-#include "BKE_action.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "DRW_render.h"
-#include "GPU_immediate.h"
-#include "GPU_draw.h"
#include "ED_gpencil.h"
#include "ED_view3d.h"
@@ -390,6 +381,14 @@ GPUBatch *DRW_gpencil_get_buffer_ctrlpoint_geom(bGPdata *gpd)
bGPDcontrolpoint *cps = gpd->runtime.cp_points;
int totpoints = gpd->runtime.tot_cp_points;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ Scene *scene = draw_ctx->scene;
+ ToolSettings *ts = scene->toolsettings;
+
+ if (ts->gp_sculpt.guide.use_guide) {
+ totpoints++;
+ }
+
static GPUVertFormat format = { 0 };
static uint pos_id, color_id, size_id;
if (format.attr_len == 0) {
@@ -415,6 +414,27 @@ GPUBatch *DRW_gpencil_get_buffer_ctrlpoint_geom(bGPdata *gpd)
idx++;
}
+ if (ts->gp_sculpt.guide.use_guide) {
+ float size = 10 * 0.8f;
+ float color[4];
+ float position[3];
+ if (ts->gp_sculpt.guide.reference_point == GP_GUIDE_REF_CUSTOM) {
+ UI_GetThemeColor4fv(TH_GIZMO_PRIMARY, color);
+ copy_v3_v3(position, ts->gp_sculpt.guide.location);
+ }
+ else if (ts->gp_sculpt.guide.reference_point == GP_GUIDE_REF_OBJECT && ts->gp_sculpt.guide.reference_object != NULL) {
+ UI_GetThemeColor4fv(TH_GIZMO_SECONDARY, color);
+ copy_v3_v3(position, ts->gp_sculpt.guide.reference_object->loc);
+ }
+ else {
+ UI_GetThemeColor4fv(TH_REDALERT, color);
+ copy_v3_v3(position, scene->cursor.location);
+ }
+ GPU_vertbuf_attr_set(vbo, pos_id, idx, position);
+ GPU_vertbuf_attr_set(vbo, size_id, idx, &size);
+ GPU_vertbuf_attr_set(vbo, color_id, idx, color);
+ }
+
return GPU_batch_create_ex(GPU_PRIM_POINTS, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
@@ -540,7 +560,7 @@ void DRW_gpencil_get_edit_geom(struct GpencilBatchCacheElem *be, bGPDstroke *gps
be->thickness_id = GPU_vertformat_attr_add(&be->format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
be->vbo = GPU_vertbuf_create_with_format(&be->format);
- GPU_vertbuf_data_alloc(be->vbo, gps->totpoints);
+ GPU_vertbuf_data_alloc(be->vbo, be->tot_vertex);
be->vbo_len = 0;
}
gpencil_vbo_ensure_size(be, gps->totpoints);
@@ -557,7 +577,7 @@ void DRW_gpencil_get_edit_geom(struct GpencilBatchCacheElem *be, bGPDstroke *gps
for (int i = 0; i < gps->totpoints; i++, pt++) {
/* weight paint */
if (is_weight_paint) {
- float weight = (dvert && dvert->dw) ? defvert_find_weight(dvert, vgindex) : 0.0f;
+ float weight = (dvert && dvert->dw && (vgindex > -1)) ? defvert_find_weight(dvert, vgindex) : 0.0f;
float hue = 2.0f * (1.0f - weight) / 3.0f;
hsv_to_rgb(hue, 1.0f, 1.0f, &selectColor[0], &selectColor[1], &selectColor[2]);
selectColor[3] = 1.0f;
@@ -619,7 +639,7 @@ void DRW_gpencil_get_edlin_geom(struct GpencilBatchCacheElem *be, bGPDstroke *gp
be->color_id = GPU_vertformat_attr_add(&be->format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
be->vbo = GPU_vertbuf_create_with_format(&be->format);
- GPU_vertbuf_data_alloc(be->vbo, gps->totpoints);
+ GPU_vertbuf_data_alloc(be->vbo, be->tot_vertex);
be->vbo_len = 0;
}
gpencil_vbo_ensure_size(be, gps->totpoints);
@@ -632,7 +652,7 @@ void DRW_gpencil_get_edlin_geom(struct GpencilBatchCacheElem *be, bGPDstroke *gp
for (int i = 0; i < gps->totpoints; i++, pt++) {
/* weight paint */
if (is_weight_paint) {
- float weight = (dvert && dvert->dw) ? defvert_find_weight(dvert, vgindex) : 0.0f;
+ float weight = (dvert && dvert->dw && (vgindex > -1)) ? defvert_find_weight(dvert, vgindex) : 0.0f;
float hue = 2.0f * (1.0f - weight) / 3.0f;
hsv_to_rgb(hue, 1.0f, 1.0f, &selectColor[0], &selectColor[1], &selectColor[2]);
selectColor[3] = 1.0f;
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index fa16a00183e..a96d293c381 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2017, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,28 +13,26 @@
* 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): Antonio Vazquez
- *
+ * Copyright 2017, Blender Foundation.
*/
-/** \file blender/draw/engines/gpencil/gpencil_draw_utils.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "BLI_polyfill_2d.h"
-#include "DRW_engine.h"
#include "DRW_render.h"
-#include "BKE_brush.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_image.h"
#include "BKE_material.h"
#include "BKE_paint.h"
+#include "BLI_hash.h"
+
#include "ED_gpencil.h"
-#include "ED_view3d.h"
#include "DNA_gpencil_types.h"
#include "DNA_material_types.h"
@@ -55,6 +51,8 @@
#include "gpencil_engine.h"
+#include "UI_resources.h"
+
/* fill type to communicate to shader */
#define SOLID 0
#define GRADIENT 1
@@ -71,14 +69,20 @@ static void gpencil_calc_vertex(
GpencilBatchCache *cache, bGPdata *gpd,
int cfra_eval)
{
+ if (!cache->is_dirty) {
+ return;
+ }
+
Object *ob = cache_ob->ob;
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool main_onion = draw_ctx->v3d != NULL ? (draw_ctx->v3d->gp_flag & V3D_GP_SHOW_ONION_SKIN) : true;
const bool playing = stl->storage->is_playing;
+ const bool overlay = draw_ctx->v3d != NULL ? (bool)((draw_ctx->v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) : true;
const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0) &&
- main_onion && DRW_gpencil_onion_active(gpd) && !playing;
+ overlay && main_onion && DRW_gpencil_onion_active(gpd) && !playing;
const bool time_remap = BKE_gpencil_has_time_modifiers(ob);
+ const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
cache_ob->tot_vertex = 0;
cache_ob->tot_triangles = 0;
@@ -90,9 +94,9 @@ static void gpencil_calc_vertex(
continue;
}
- /* if onion skin need to count all frames of the layer */
- if (is_onion) {
- init_gpf = gpl->actframe;
+ /* if multiedit or onion skin need to count all frames of the layer */
+ if ((is_multiedit) || (is_onion)) {
+ init_gpf = gpl->frames.first;
}
else {
/* verify time modifiers */
@@ -116,7 +120,7 @@ static void gpencil_calc_vertex(
cache_ob->tot_vertex += gps->totpoints + 3;
cache_ob->tot_triangles += gps->totpoints - 1;
}
- if (!is_onion) {
+ if ((!is_multiedit) && (!is_onion)) {
break;
}
}
@@ -125,6 +129,8 @@ static void gpencil_calc_vertex(
cache->b_fill.tot_vertex = cache_ob->tot_triangles * 3;
cache->b_stroke.tot_vertex = cache_ob->tot_vertex;
cache->b_point.tot_vertex = cache_ob->tot_vertex;
+ cache->b_edit.tot_vertex = cache_ob->tot_vertex;
+ cache->b_edlin.tot_vertex = cache_ob->tot_vertex;
/* some modifiers can change the number of points */
int factor = 0;
@@ -138,6 +144,8 @@ static void gpencil_calc_vertex(
cache->b_fill.tot_vertex *= factor;
cache->b_stroke.tot_vertex *= factor;
cache->b_point.tot_vertex *= factor;
+ cache->b_edit.tot_vertex *= factor;
+ cache->b_edlin.tot_vertex *= factor;
}
}
}
@@ -148,8 +156,9 @@ static bool gpencil_can_draw_stroke(
const bool onion, const bool is_mat_preview)
{
/* skip stroke if it doesn't have any valid data */
- if ((gps->points == NULL) || (gps->totpoints < 1) || (gp_style == NULL))
+ if ((gps->points == NULL) || (gps->totpoints < 1) || (gp_style == NULL)) {
return false;
+ }
/* if mat preview render always visible */
if (is_mat_preview) {
@@ -217,7 +226,7 @@ static void gpencil_calc_stroke_fill_uv(
/* recalc the internal geometry caches for fill and uvs */
static void DRW_gpencil_recalc_geometry_caches(
- Object *ob, bGPDlayer *gpl, MaterialGPencilStyle *gp_style, bGPDstroke *gps)
+ Object *ob, bGPDlayer *gpl, MaterialGPencilStyle *gp_style, bGPDstroke *gps)
{
if (gps->flag & GP_STROKE_RECALC_GEOMETRY) {
/* Calculate triangles cache for filling area (must be done only after changes) */
@@ -238,13 +247,119 @@ static void DRW_gpencil_recalc_geometry_caches(
}
}
+static void set_wireframe_color(
+ Object *ob, bGPDlayer *gpl, View3D *v3d,
+ GPENCIL_StorageList *stl,
+ MaterialGPencilStyle *gp_style, int id, const bool is_fill)
+{
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ World *world = draw_ctx->scene->world;
+
+ float color[4];
+ if (((gp_style->stroke_rgba[3] < GPENCIL_ALPHA_OPACITY_THRESH) ||
+ (((gp_style->flag & GP_STYLE_STROKE_SHOW) == 0))) &&
+ (gp_style->fill_rgba[3] >= GPENCIL_ALPHA_OPACITY_THRESH))
+ {
+ copy_v4_v4(color, gp_style->fill_rgba);
+ }
+ else {
+ copy_v4_v4(color, gp_style->stroke_rgba);
+ }
+ float alpha = color[3];
+
+ /* wire color */
+ if ((v3d) && (id > -1)) {
+ const char type = (
+ (stl->shgroups[id].shading_type[0] == OB_WIRE) ?
+ v3d->shading.wire_color_type :
+ v3d->shading.color_type);
+ /* if fill and wire, use background color */
+ if ((is_fill) && (stl->shgroups[id].shading_type[0] == OB_WIRE)) {
+ if (v3d->shading.background_type == V3D_SHADING_BACKGROUND_THEME) {
+ UI_GetThemeColor4fv(TH_BACK, stl->shgroups[id].wire_color);
+ stl->shgroups[id].wire_color[3] = 1.0f;
+ }
+ else if (v3d->shading.background_type == V3D_SHADING_BACKGROUND_WORLD) {
+ color[0] = world->horr;
+ color[1] = world->horg;
+ color[2] = world->horb;
+ color[3] = 1.0f;
+ linearrgb_to_srgb_v4(stl->shgroups[id].wire_color, color);
+ }
+ else {
+ copy_v3_v3(color, v3d->shading.background_color);
+ color[3] = 1.0f;
+ linearrgb_to_srgb_v4(stl->shgroups[id].wire_color, color);
+ }
+ return;
+ }
+
+ /* strokes */
+ switch (type) {
+ case V3D_SHADING_SINGLE_COLOR:
+ {
+ if (stl->shgroups[id].shading_type[0] == OB_WIRE) {
+ UI_GetThemeColor4fv(TH_WIRE, color);
+ }
+ else {
+ copy_v3_v3(color, v3d->shading.single_color);
+ }
+ color[3] = alpha;
+ linearrgb_to_srgb_v4(stl->shgroups[id].wire_color, color);
+ break;
+ }
+ case V3D_SHADING_OBJECT_COLOR:
+ {
+ copy_v4_v4(color, ob->color);
+ color[3] = alpha;
+ linearrgb_to_srgb_v4(stl->shgroups[id].wire_color, color);
+ break;
+ }
+ case V3D_SHADING_RANDOM_COLOR:
+ {
+ uint gpl_hash = 1;
+ uint ob_hash = BLI_ghashutil_strhash_p_murmur(ob->id.name);
+ if (gpl) {
+ gpl_hash = BLI_ghashutil_strhash_p_murmur(gpl->info);
+ }
+
+ float hue = BLI_hash_int_01(ob_hash * gpl_hash);
+ float hsv[3] = { hue, 0.40f, 0.8f };
+ float wire_col[3];
+ hsv_to_rgb_v(hsv, &wire_col[0]);
+
+ stl->shgroups[id].wire_color[0] = wire_col[0];
+ stl->shgroups[id].wire_color[1] = wire_col[1];
+ stl->shgroups[id].wire_color[2] = wire_col[2];
+ stl->shgroups[id].wire_color[3] = alpha;
+ break;
+ }
+ default:
+ {
+ copy_v4_v4(stl->shgroups[id].wire_color, color);
+ break;
+ }
+ }
+ }
+ else {
+ copy_v4_v4(stl->shgroups[id].wire_color, color);
+ }
+
+ /* if solid, the alpha must be set to 1.0 */
+ if (stl->shgroups[id].shading_type[0] == OB_SOLID) {
+ stl->shgroups[id].wire_color[3] = 1.0f;
+ }
+}
+
/* create shading group for filling */
static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(
GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass,
- GPUShader *shader, bGPdata *gpd, bGPDlayer *gpl,
- MaterialGPencilStyle *gp_style, int id)
+ GPUShader *shader, Object *ob, bGPdata *gpd, bGPDlayer *gpl,
+ MaterialGPencilStyle *gp_style, int id, int shading_type[2])
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ View3D *v3d = draw_ctx->v3d;
/* e_data.gpencil_fill_sh */
DRWShadingGroup *grp = DRW_shgroup_create(shader, pass);
@@ -301,7 +416,28 @@ static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(
stl->shgroups[id].texture_flip = gp_style->flag & GP_STYLE_COLOR_FLIP_FILL ? 1 : 0;
DRW_shgroup_uniform_int(grp, "texture_flip", &stl->shgroups[id].texture_flip, 1);
- DRW_shgroup_uniform_int(grp, "xraymode", (const int *) &gpd->xray_mode, 1);
+ stl->shgroups[id].xray_mode = (ob->dtx & OB_DRAWXRAY) ? GP_XRAY_FRONT : GP_XRAY_3DSPACE;
+ DRW_shgroup_uniform_int(grp, "xraymode", &stl->shgroups[id].xray_mode, 1);
+ DRW_shgroup_uniform_int(grp, "drawmode", (const int *) &gpd->draw_mode, 1);
+
+ /* viewport x-ray */
+ DRW_shgroup_uniform_int(grp, "viewport_xray", &stl->storage->is_xray, 1);
+
+ /* shading type */
+ stl->shgroups[id].shading_type[0] = GPENCIL_USE_SOLID(stl) ? (int)OB_RENDER : shading_type[0];
+ if (v3d) {
+ stl->shgroups[id].shading_type[1] = (
+ (stl->shgroups[id].shading_type[0] == OB_WIRE) ?
+ v3d->shading.wire_color_type :
+ v3d->shading.color_type);
+ }
+
+ DRW_shgroup_uniform_int(grp, "shading_type", &stl->shgroups[id].shading_type[0], 2);
+
+ /* wire color */
+ set_wireframe_color(ob, gpl, v3d, stl, gp_style, id, true);
+ DRW_shgroup_uniform_vec4(grp, "wire_color", stl->shgroups[id].wire_color, 1);
+
/* image texture */
if ((gp_style->flag & GP_STYLE_COLOR_TEX_MIX) ||
(gp_style->fill_style & GP_STYLE_FILL_STYLE_TEXTURE))
@@ -319,7 +455,7 @@ static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(
BKE_image_release_ibuf(image, ibuf, NULL);
}
else {
- GPUTexture *texture = GPU_texture_from_blender(gp_style->ima, &iuser, GL_TEXTURE_2D, true, 0.0);
+ GPUTexture *texture = GPU_texture_from_blender(gp_style->ima, &iuser, GL_TEXTURE_2D, true);
DRW_shgroup_uniform_texture(grp, "myTexture", texture);
stl->shgroups[id].texture_clamp = gp_style->flag & GP_STYLE_COLOR_TEX_CLAMP ? 1 : 0;
@@ -352,10 +488,14 @@ bool DRW_gpencil_onion_active(bGPdata *gpd)
/* create shading group for strokes */
DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob,
- bGPdata *gpd, MaterialGPencilStyle *gp_style, int id, bool onion)
+ bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps,
+ MaterialGPencilStyle *gp_style, int id,
+ bool onion, const float scale, const int shading_type[2])
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
const float *viewport_size = DRW_viewport_size_get();
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ View3D *v3d = draw_ctx->v3d;
/* e_data.gpencil_stroke_sh */
DRWShadingGroup *grp = DRW_shgroup_create(shader, pass);
@@ -371,7 +511,7 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
/* object scale and depth */
if ((ob) && (id > -1)) {
- stl->shgroups[id].obj_scale = mat4_to_scale(ob->obmat);
+ stl->shgroups[id].obj_scale = scale;
DRW_shgroup_uniform_float(grp, "objscale", &stl->shgroups[id].obj_scale, 1);
stl->shgroups[id].keep_size = (int)((gpd) && (gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS));
DRW_shgroup_uniform_int(grp, "keep_size", &stl->shgroups[id].keep_size, 1);
@@ -386,6 +526,26 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
}
DRW_shgroup_uniform_int(grp, "color_type", &stl->shgroups[id].color_type, 1);
DRW_shgroup_uniform_float(grp, "pixfactor", &gpd->pixfactor, 1);
+
+ stl->shgroups[id].caps_mode[0] = gps->caps[0];
+ stl->shgroups[id].caps_mode[1] = gps->caps[1];
+ DRW_shgroup_uniform_int(grp, "caps_mode", &stl->shgroups[id].caps_mode[0], 2);
+
+ /* viewport x-ray */
+ DRW_shgroup_uniform_int(grp, "viewport_xray", &stl->storage->is_xray, 1);
+
+ stl->shgroups[id].shading_type[0] = (GPENCIL_USE_SOLID(stl) || onion) ? (int)OB_RENDER : shading_type[0];
+ if (v3d) {
+ stl->shgroups[id].shading_type[1] = (
+ (stl->shgroups[id].shading_type[0] == OB_WIRE) ?
+ v3d->shading.wire_color_type :
+ v3d->shading.color_type);
+ }
+ DRW_shgroup_uniform_int(grp, "shading_type", &stl->shgroups[id].shading_type[0], 2);
+
+ /* wire color */
+ set_wireframe_color(ob, gpl, v3d, stl, gp_style, id, false);
+ DRW_shgroup_uniform_vec4(grp, "wire_color", stl->shgroups[id].wire_color, 1);
}
else {
stl->storage->obj_scale = 1.0f;
@@ -400,10 +560,17 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
else {
DRW_shgroup_uniform_float(grp, "pixfactor", &stl->storage->pixfactor, 1);
}
+ const int zero[2] = { 0, 0 };
+ DRW_shgroup_uniform_int(grp, "caps_mode", &zero[0], 2);
+
+ /* viewport x-ray */
+ DRW_shgroup_uniform_int(grp, "viewport_xray", &stl->storage->is_xray, 1);
+ DRW_shgroup_uniform_int(grp, "shading_type", (const int *)&stl->storage->shade_render, 2);
}
if ((gpd) && (id > -1)) {
- DRW_shgroup_uniform_int(grp, "xraymode", (const int *) &gpd->xray_mode, 1);
+ stl->shgroups[id].xray_mode = (ob->dtx & OB_DRAWXRAY) ? GP_XRAY_FRONT : GP_XRAY_3DSPACE;
+ DRW_shgroup_uniform_int(grp, "xraymode", &stl->shgroups[id].xray_mode, 1);
}
else {
/* for drawing always on predefined z-depth */
@@ -425,7 +592,7 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
BKE_image_release_ibuf(image, ibuf, NULL);
}
else {
- GPUTexture *texture = GPU_texture_from_blender(gp_style->sima, &iuser, GL_TEXTURE_2D, true, 0.0f);
+ GPUTexture *texture = GPU_texture_from_blender(gp_style->sima, &iuser, GL_TEXTURE_2D, true);
DRW_shgroup_uniform_texture(grp, "myTexture", texture);
BKE_image_release_ibuf(image, ibuf, NULL);
@@ -442,10 +609,14 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
/* create shading group for points */
static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob,
- bGPdata *gpd, MaterialGPencilStyle *gp_style, int id, bool onion)
+ bGPdata *gpd, bGPDlayer *gpl,
+ MaterialGPencilStyle *gp_style, int id, bool onion,
+ const float scale, const int shading_type[2])
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
const float *viewport_size = DRW_viewport_size_get();
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ View3D *v3d = draw_ctx->v3d;
/* e_data.gpencil_stroke_sh */
DRWShadingGroup *grp = DRW_shgroup_create(shader, pass);
@@ -460,7 +631,7 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
/* object scale and depth */
if ((ob) && (id > -1)) {
- stl->shgroups[id].obj_scale = mat4_to_scale(ob->obmat);
+ stl->shgroups[id].obj_scale = scale;
DRW_shgroup_uniform_float(grp, "objscale", &stl->shgroups[id].obj_scale, 1);
stl->shgroups[id].keep_size = (int)((gpd) && (gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS));
DRW_shgroup_uniform_int(grp, "keep_size", &stl->shgroups[id].keep_size, 1);
@@ -477,6 +648,23 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
DRW_shgroup_uniform_int(grp, "color_type", &stl->shgroups[id].color_type, 1);
DRW_shgroup_uniform_int(grp, "mode", &stl->shgroups[id].mode, 1);
DRW_shgroup_uniform_float(grp, "pixfactor", &gpd->pixfactor, 1);
+
+ /* viewport x-ray */
+ DRW_shgroup_uniform_int(grp, "viewport_xray", &stl->storage->is_xray, 1);
+
+ stl->shgroups[id].shading_type[0] = (GPENCIL_USE_SOLID(stl) || onion) ? (int)OB_RENDER : shading_type[0];
+ if (v3d) {
+ stl->shgroups[id].shading_type[1] = (
+ (stl->shgroups[id].shading_type[0] == OB_WIRE) ?
+ v3d->shading.wire_color_type :
+ v3d->shading.color_type);
+ }
+ DRW_shgroup_uniform_int(grp, "shading_type", &stl->shgroups[id].shading_type[0], 2);
+
+ /* wire color */
+ set_wireframe_color(ob, gpl, v3d, stl, gp_style, id, false);
+ DRW_shgroup_uniform_vec4(grp, "wire_color", stl->shgroups[id].wire_color, 1);
+
}
else {
stl->storage->obj_scale = 1.0f;
@@ -493,13 +681,17 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
else {
DRW_shgroup_uniform_float(grp, "pixfactor", &stl->storage->pixfactor, 1);
}
+ /* viewport x-ray */
+ DRW_shgroup_uniform_int(grp, "viewport_xray", &stl->storage->is_xray, 1);
+ DRW_shgroup_uniform_int(grp, "shading_type", (const int *)&stl->storage->shade_render, 2);
}
- if (gpd) {
- DRW_shgroup_uniform_int(grp, "xraymode", (const int *)&gpd->xray_mode, 1);
+ if ((gpd) && (id > -1)) {
+ stl->shgroups[id].xray_mode = (ob->dtx & OB_DRAWXRAY) ? GP_XRAY_FRONT : GP_XRAY_3DSPACE;
+ DRW_shgroup_uniform_int(grp, "xraymode", (const int *)&stl->shgroups[id].xray_mode, 1);
}
else {
- /* for drawing always on on predefined z-depth */
+ /* for drawing always on predefined z-depth */
DRW_shgroup_uniform_int(grp, "xraymode", &stl->storage->xray, 1);
}
@@ -518,7 +710,7 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
BKE_image_release_ibuf(image, ibuf, NULL);
}
else {
- GPUTexture *texture = GPU_texture_from_blender(gp_style->sima, &iuser, GL_TEXTURE_2D, true, 0.0f);
+ GPUTexture *texture = GPU_texture_from_blender(gp_style->sima, &iuser, GL_TEXTURE_2D, true);
DRW_shgroup_uniform_texture(grp, "myTexture", texture);
BKE_image_release_ibuf(image, ibuf, NULL);
@@ -650,7 +842,7 @@ static void gpencil_add_stroke_vertexdata(
/* add edit points vertex info */
static void gpencil_add_editpoints_vertexdata(
- GPENCIL_StorageList *UNUSED(stl), GpencilBatchCache *cache, ToolSettings *UNUSED(ts), Object *ob,
+ GpencilBatchCache *cache, Object *ob,
bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
@@ -669,7 +861,7 @@ static void gpencil_add_editpoints_vertexdata(
if (cache->is_dirty) {
if ((obact == ob) &&
- ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
+ ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
(v3d->gp_flag & V3D_GP_SHOW_EDIT_LINES))
{
/* line of the original stroke */
@@ -703,7 +895,7 @@ static void gpencil_add_editpoints_vertexdata(
/* main function to draw strokes */
static void gpencil_draw_strokes(
- GpencilBatchCache *cache, GPENCIL_e_data *e_data, void *vedata, ToolSettings *ts, Object *ob,
+ GpencilBatchCache *cache, GPENCIL_e_data *e_data, void *vedata, Object *ob,
bGPdata *gpd, bGPDlayer *gpl, bGPDframe *src_gpf, bGPDframe *derived_gpf,
const float opacity, const float tintcolor[4],
const bool custonion, tGPencilObjectCache *cache_ob)
@@ -767,7 +959,9 @@ static void gpencil_draw_strokes(
}
/* if the fill has any value, it's considered a fill and is not drawn if simplify fill is enabled */
- if ((stl->storage->simplify_fill) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_REMOVE_FILL_LINE)) {
+ if ((stl->storage->simplify_fill) &&
+ (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_REMOVE_FILL_LINE))
+ {
if ((gp_style->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) ||
(gp_style->fill_style > GP_STYLE_FILL_STYLE_SOLID) ||
(gpl->blend_mode != eGplBlendMode_Normal))
@@ -805,7 +999,9 @@ static void gpencil_draw_strokes(
opacity, tintcolor, false, custonion);
}
/* stroke */
- if ((gp_style->flag & GP_STYLE_STROKE_SHOW) &&
+ /* No fill strokes, must show stroke always */
+ if (((gp_style->flag & GP_STYLE_STROKE_SHOW) ||
+ (gps->flag & GP_STROKE_NOFILL)) &&
((gp_style->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) ||
(gpl->blend_mode == eGplBlendMode_Normal)))
{
@@ -830,7 +1026,7 @@ static void gpencil_draw_strokes(
DRW_shgroup_uniform_vec2(stl->g_data->shgrps_edit_point, "Viewport", viewport_size, 1);
}
- gpencil_add_editpoints_vertexdata(stl, cache, ts, ob, gpd, gpl, derived_gpf, src_gps);
+ gpencil_add_editpoints_vertexdata(cache, ob, gpd, gpl, derived_gpf, src_gps);
}
}
@@ -857,7 +1053,7 @@ static void gpencil_get_onion_alpha(float color[4], bGPdata *gpd)
/* function to draw strokes for onion only */
static void gpencil_draw_onion_strokes(
- GpencilBatchCache *cache, GPENCIL_e_data *UNUSED(e_data), void *vedata, Object *ob,
+ GpencilBatchCache *cache, void *vedata, Object *ob,
bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf,
const float opacity, const float tintcolor[4], const bool custonion)
{
@@ -890,7 +1086,8 @@ static void gpencil_draw_onion_strokes(
/* stroke */
gpencil_add_stroke_vertexdata(
- cache, ob, gpl, gpf, gps, opacity, tintcolor, true, custonion);
+ cache, ob, gpl, gpf, gps, opacity, tintcolor,
+ true, custonion);
stl->storage->shgroup_id++;
}
@@ -898,7 +1095,7 @@ static void gpencil_draw_onion_strokes(
/* draw onion-skinning for a layer */
static void gpencil_draw_onionskins(
- GpencilBatchCache *cache, GPENCIL_e_data *e_data, void *vedata,
+ GpencilBatchCache *cache, void *vedata,
Object *ob, bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf)
{
@@ -970,7 +1167,7 @@ static void gpencil_draw_onionskins(
}
gpencil_get_onion_alpha(color, gpd);
- gpencil_draw_onion_strokes(cache, e_data, vedata, ob, gpd, gpl, gf, color[3], color, colflag);
+ gpencil_draw_onion_strokes(cache, vedata, ob, gpd, gpl, gf, color[3], color, colflag);
}
/* -------------------------------
* 2) Now draw next frames
@@ -1022,7 +1219,7 @@ static void gpencil_draw_onionskins(
}
gpencil_get_onion_alpha(color, gpd);
- gpencil_draw_onion_strokes(cache, e_data, vedata, ob, gpd, gpl, gf, color[3], color, colflag);
+ gpencil_draw_onion_strokes(cache, vedata, ob, gpd, gpl, gf, color[3], color, colflag);
if (last < gf->framenum) {
last = gf->framenum;
}
@@ -1033,7 +1230,7 @@ static void gpencil_draw_onionskins(
if ((last == gpf->framenum) || (gpf->next == NULL)) {
gpencil_get_onion_alpha(color, gpd);
gpencil_draw_onion_strokes(
- cache, e_data, vedata, ob, gpd, gpl,
+ cache, vedata, ob, gpd, gpl,
gpf_loop, color[3], color, colflag);
}
}
@@ -1114,8 +1311,9 @@ void DRW_gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps)
}
else {
/* No triangles needed - Free anything allocated previously */
- if (gps->triangles)
+ if (gps->triangles) {
MEM_freeN(gps->triangles);
+ }
gps->triangles = NULL;
}
@@ -1138,14 +1336,13 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
- const bool overlay = v3d != NULL ? (bool)((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) : true;
+ const bool overlay = v3d != NULL ? (bool)((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) : true;
Brush *brush = BKE_paint_brush(&ts->gp_paint->paint);
bGPdata *gpd_eval = ob->data;
/* need the original to avoid cow overhead while drawing */
bGPdata *gpd = (bGPdata *)DEG_get_original_id(&gpd_eval->id);
MaterialGPencilStyle *gp_style = NULL;
-
float obscale = mat4_to_scale(ob->obmat);
/* use the brush material */
@@ -1172,11 +1369,15 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
if (gpd->runtime.sbuffer_size > 1) {
if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) {
stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_stroke_create(
- e_data, vedata, psl->drawing_pass, e_data->gpencil_stroke_sh, NULL, gpd, gp_style, -1, false);
+ e_data, vedata, psl->drawing_pass, e_data->gpencil_stroke_sh, NULL,
+ gpd, NULL, NULL, gp_style, -1,
+ false, 1.0f, (const int *)stl->storage->shade_render);
}
else {
stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_point_create(
- e_data, vedata, psl->drawing_pass, e_data->gpencil_point_sh, NULL, gpd, gp_style, -1, false);
+ e_data, vedata, psl->drawing_pass, e_data->gpencil_point_sh, NULL,
+ gpd, NULL, gp_style, -1,
+ false, 1.0f, (const int *)stl->storage->shade_render);
}
/* clean previous version of the batch */
@@ -1196,12 +1397,11 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
gpd, lthick);
}
- if (gp_style->flag & GP_STYLE_STROKE_SHOW) {
- DRW_shgroup_call_add(
- stl->g_data->shgrps_drawing_stroke,
- e_data->batch_buffer_stroke,
- stl->storage->unit_matrix);
- }
+ /* buffer strokes, must show stroke always */
+ DRW_shgroup_call_add(
+ stl->g_data->shgrps_drawing_stroke,
+ e_data->batch_buffer_stroke,
+ stl->storage->unit_matrix);
if ((gpd->runtime.sbuffer_size >= 3) &&
(gpd->runtime.sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) &&
@@ -1235,13 +1435,14 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
}
}
- /* control points */
- if ((overlay) && (gpd->runtime.tot_cp_points > 0) &&
- ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) &&
- ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) &&
- ((v3d->gizmo_flag & V3D_GIZMO_HIDE_TOOL) == 0))
- {
+ /* control points for primitives and speed guide */
+ const bool is_cppoint = (gpd->runtime.tot_cp_points > 0);
+ const bool is_speed_guide = (ts->gp_sculpt.guide.use_guide && (draw_ctx->object_mode == OB_MODE_PAINT_GPENCIL));
+ const bool is_show_gizmo = (((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) && ((v3d->gizmo_flag & V3D_GIZMO_HIDE_TOOL) == 0));
+ if ((overlay) && (is_cppoint || is_speed_guide) && (is_show_gizmo) &&
+ ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0))
+ {
DRWShadingGroup *shgrp = DRW_shgroup_create(
e_data->gpencil_edit_point_sh, psl->drawing_pass);
const float *viewport_size = DRW_viewport_size_get();
@@ -1294,6 +1495,7 @@ static void DRW_gpencil_shgroups_create(
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
bGPdata *gpd = (bGPdata *)ob->data;
+ DRWPass *stroke_pass = GPENCIL_3D_DRAWMODE(ob, gpd) ? psl->stroke_pass_3d : psl->stroke_pass_2d;
GpencilBatchGroup *elm = NULL;
DRWShadingGroup *shgrp = NULL;
@@ -1313,6 +1515,7 @@ static void DRW_gpencil_shgroups_create(
for (int i = 0; i < cache->grp_used; i++) {
elm = &cache->grp_cache[i];
array_elm = &cache_ob->shgrp_array[idx];
+ const float scale = cache_ob->scale;
/* save last group when change */
if (gpl_prev == NULL) {
@@ -1351,8 +1554,9 @@ static void DRW_gpencil_shgroups_create(
const int len = elm->vertex_idx - start_stroke;
shgrp = DRW_gpencil_shgroup_stroke_create(
- e_data, vedata, psl->stroke_pass, e_data->gpencil_stroke_sh,
- ob, gpd, gp_style, stl->storage->shgroup_id, elm->onion);
+ e_data, vedata, stroke_pass, e_data->gpencil_stroke_sh,
+ ob, gpd, gpl, gps, gp_style, stl->storage->shgroup_id, elm->onion,
+ scale, cache_ob->shading_type);
DRW_shgroup_call_range_add(
shgrp, cache->b_stroke.batch,
@@ -1368,8 +1572,9 @@ static void DRW_gpencil_shgroups_create(
const int len = elm->vertex_idx - start_point;
shgrp = DRW_gpencil_shgroup_point_create(
- e_data, vedata, psl->stroke_pass, e_data->gpencil_point_sh,
- ob, gpd, gp_style, stl->storage->shgroup_id, elm->onion);
+ e_data, vedata, stroke_pass, e_data->gpencil_point_sh,
+ ob, gpd, gpl, gp_style, stl->storage->shgroup_id, elm->onion,
+ scale, cache_ob->shading_type);
DRW_shgroup_call_range_add(
shgrp, cache->b_point.batch,
@@ -1385,8 +1590,9 @@ static void DRW_gpencil_shgroups_create(
const int len = elm->vertex_idx - start_fill;
shgrp = DRW_gpencil_shgroup_fill_create(
- e_data, vedata, psl->stroke_pass, e_data->gpencil_fill_sh,
- gpd, gpl, gp_style, stl->storage->shgroup_id);
+ e_data, vedata, stroke_pass, e_data->gpencil_fill_sh,
+ ob, gpd, gpl, gp_style, stl->storage->shgroup_id,
+ cache_ob->shading_type);
DRW_shgroup_call_range_add(
shgrp, cache->b_fill.batch,
@@ -1463,11 +1669,9 @@ void DRW_gpencil_populate_multiedit(
const DRWContextState *draw_ctx = DRW_context_state_get();
int cfra_eval = (int)DEG_get_ctime(draw_ctx->depsgraph);
GpencilBatchCache *cache = gpencil_batch_cache_get(ob, cfra_eval);
- Scene *scene = draw_ctx->scene;
- ToolSettings *ts = scene->toolsettings;
/* check if playing animation */
- bool playing = stl->storage->is_playing;
+ const bool playing = stl->storage->is_playing;
/* calc max size of VBOs */
gpencil_calc_vertex(stl, cache_ob, cache, gpd, cfra_eval);
@@ -1475,15 +1679,16 @@ void DRW_gpencil_populate_multiedit(
/* draw strokes */
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* don't draw layer if hidden */
- if (gpl->flag & GP_LAYER_HIDE)
+ if (gpl->flag & GP_LAYER_HIDE) {
continue;
+ }
/* list of frames to draw */
if (!playing) {
for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
if ((gpf == gpl->actframe) || (gpf->flag & GP_FRAME_SELECT)) {
gpencil_draw_strokes(
- cache, e_data, vedata, ts, ob, gpd, gpl, gpf, gpf,
+ cache, e_data, vedata, ob, gpd, gpl, gpf, gpf,
gpl->opacity, gpl->tintcolor, false, cache_ob);
}
}
@@ -1492,7 +1697,7 @@ void DRW_gpencil_populate_multiedit(
gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_USE_PREV);
if (gpf) {
gpencil_draw_strokes(
- cache, e_data, vedata, ts, ob, gpd, gpl, gpf, gpf,
+ cache, e_data, vedata, ob, gpd, gpl, gpf, gpf,
gpl->opacity, gpl->tintcolor, false, cache_ob);
}
}
@@ -1517,18 +1722,16 @@ void DRW_gpencil_populate_datablock(
const ViewLayer *view_layer = DEG_get_evaluated_view_layer(draw_ctx->depsgraph);
Scene *scene = draw_ctx->scene;
- bGPdata *gpd_eval = (bGPdata *)ob->data;
- bGPdata *gpd = (bGPdata *)DEG_get_original_id(&gpd_eval->id);
+ bGPdata *gpd = (bGPdata *)ob->data;
View3D *v3d = draw_ctx->v3d;
int cfra_eval = (int)DEG_get_ctime(draw_ctx->depsgraph);
- ToolSettings *ts = scene->toolsettings;
bGPDframe *derived_gpf = NULL;
const bool main_onion = v3d != NULL ? (v3d->gp_flag & V3D_GP_SHOW_ONION_SKIN) : true;
const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0) &&
main_onion && DRW_gpencil_onion_active(gpd);
- const bool overlay = v3d != NULL ? (bool)((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) : true;
+ const bool overlay = v3d != NULL ? (bool)((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) : true;
const bool time_remap = BKE_gpencil_has_time_modifiers(ob);
float opacity;
@@ -1536,7 +1739,7 @@ void DRW_gpencil_populate_datablock(
bGPDlayer *gpl_active = BKE_gpencil_layer_getactive(gpd);
/* check if playing animation */
- bool playing = stl->storage->is_playing;
+ const bool playing = stl->storage->is_playing;
GpencilBatchCache *cache = gpencil_batch_cache_get(ob, cfra_eval);
@@ -1562,6 +1765,10 @@ void DRW_gpencil_populate_datablock(
continue;
}
+ const bool is_solomode = GPENCIL_PAINT_MODE(gpd) &&
+ (!playing) && (!stl->storage->is_render) &&
+ (gpl->flag & GP_LAYER_SOLO_MODE);
+
/* filter view layer to gp layers in the same view layer (for compo) */
if ((stl->storage->is_render) && (gpl->viewlayername[0] != '\0')) {
if (!STREQ(view_layer->name, gpl->viewlayername)) {
@@ -1578,8 +1785,14 @@ void DRW_gpencil_populate_datablock(
}
gpf = BKE_gpencil_layer_getframe(gpl, remap_cfra, GP_GETFRAME_USE_PREV);
- if (gpf == NULL)
+ if (gpf == NULL) {
+ continue;
+ }
+
+ /* if solo mode, display only frames with keyframe in the current frame */
+ if ((is_solomode) && (gpf->framenum != remap_cfra)) {
continue;
+ }
opacity = gpl->opacity;
/* if pose mode, maybe the overlay to fade geometry is enabled */
@@ -1620,13 +1833,13 @@ void DRW_gpencil_populate_datablock(
if (((!stl->storage->is_render) && (overlay)) ||
((stl->storage->is_render) && (gpd->onion_flag & GP_ONION_GHOST_ALWAYS)))
{
- gpencil_draw_onionskins(cache, e_data, vedata, ob, gpd, gpl, gpf);
+ gpencil_draw_onionskins(cache, vedata, ob, gpd, gpl, gpf);
}
}
}
/* draw normal strokes */
gpencil_draw_strokes(
- cache, e_data, vedata, ts, ob, gpd, gpl, gpf, derived_gpf,
+ cache, e_data, vedata, ob, gpd, gpl, gpf, derived_gpf,
opacity, gpl->tintcolor, false, cache_ob);
}
@@ -1642,18 +1855,24 @@ void DRW_gpencil_populate_datablock(
cache->is_dirty = false;
}
-void DRW_gpencil_populate_particles(GPENCIL_e_data *e_data, void *vedata)
+void DRW_gpencil_populate_particles(GPENCIL_e_data *e_data, GHash *gh_objects, void *vedata)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
/* add particles */
for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
tGPencilObjectCache *cache_ob = &stl->g_data->gp_object_cache[i];
- Object *ob = cache_ob->ob;
if (cache_ob->is_dup_ob) {
- GpencilBatchCache *cache = ob->runtime.gpencil_cache;
- if (cache != NULL) {
- DRW_gpencil_shgroups_create(e_data, vedata, ob, cache, cache_ob);
+ /* reasign duplicate objects because memory for particles is not available
+ * and need to use the original datablock and runtime data */
+ Object *ob = (Object *)BLI_ghash_lookup(gh_objects, cache_ob->name);
+ if (ob) {
+ cache_ob->ob = ob;
+ cache_ob->gpd = (bGPdata *)ob->data;
+ GpencilBatchCache *cache = ob->runtime.gpencil_cache;
+ if (cache != NULL) {
+ DRW_gpencil_shgroups_create(e_data, vedata, ob, cache, cache_ob);
+ }
}
}
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 79724f6a5d2..97b81e3ba1f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2017, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,20 +13,17 @@
* 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): Antonio Vazquez
- *
+ * Copyright 2017, Blender Foundation.
*/
-/** \file blender/draw/engines/gpencil/gpencil_engine.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_engine.h"
#include "DRW_render.h"
-#include "BKE_camera.h"
+#include "BKE_library.h"
#include "BKE_object.h"
-#include "BKE_paint.h"
-#include "BKE_gpencil.h"
#include "BKE_shader_fx.h"
#include "DNA_gpencil_types.h"
@@ -36,18 +31,17 @@
#include "draw_mode_engines.h"
-#include "UI_resources.h"
-
#include "GPU_texture.h"
#include "gpencil_engine.h"
#include "DEG_depsgraph_query.h"
+#include "ED_view3d.h"
#include "ED_screen.h"
-#include "ED_gpencil.h"
-#include "WM_api.h"
+#include "UI_resources.h"
+
extern char datatoc_gpencil_fill_vert_glsl[];
extern char datatoc_gpencil_fill_frag_glsl[];
@@ -108,7 +102,7 @@ static void GPENCIL_create_framebuffers(void *vedata)
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
/* Go full 32bits for rendering */
- GPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : GPU_RGBA16F;
+ eGPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : GPU_RGBA16F;
if (DRW_state_is_fbo()) {
const float *viewport_size = DRW_viewport_size_get();
@@ -254,6 +248,8 @@ void GPENCIL_engine_init(void *vedata)
/* unit matrix */
unit_m4(stl->storage->unit_matrix);
+ stl->storage->shade_render[0] = OB_RENDER;
+ stl->storage->shade_render[1] = 0;
}
stl->storage->multisamples = U.gpencil_multisamples;
@@ -339,13 +335,19 @@ void GPENCIL_cache_init(void *vedata)
stl->g_data->gp_cache_used = 0;
stl->g_data->gp_cache_size = 0;
stl->g_data->gp_object_cache = NULL;
+ stl->g_data->do_instances = false;
{
- /* Stroke pass */
- psl->stroke_pass = DRW_pass_create(
+ /* Stroke pass 2D */
+ psl->stroke_pass_2d = DRW_pass_create(
"GPencil Stroke Pass",
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS | DRW_STATE_BLEND);
stl->storage->shgroup_id = 0;
+ /* Stroke pass 3D */
+ psl->stroke_pass_3d = DRW_pass_create(
+ "GPencil Stroke Pass",
+ DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND);
+ stl->storage->shgroup_id = 0;
/* edit pass */
psl->edit_pass = DRW_pass_create(
@@ -389,6 +391,14 @@ void GPENCIL_cache_init(void *vedata)
stl->storage->simplify_fx = GP_SIMPLIFY_FX(scene, stl->storage->is_playing);
stl->storage->simplify_blend = GP_SIMPLIFY_BLEND(scene, stl->storage->is_playing);
+ /* xray mode */
+ if (v3d) {
+ stl->storage->is_xray = (v3d->shading.flag & V3D_XRAY_FLAG(v3d)) ? 1 : 0;
+ }
+ else {
+ stl->storage->is_xray = 0;
+ }
+
/* save pixsize */
stl->storage->pixsize = DRW_viewport_pixelsize_get();
if ((!DRW_state_is_opengl_render()) && (stl->storage->is_render)) {
@@ -449,6 +459,8 @@ void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeColor", &e_data.input_color_tx);
DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeDepth", &e_data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp, "tonemapping", &stl->storage->tonemapping, 1);
+ DRW_shgroup_uniform_int(mix_shgrp, "do_select", &stl->storage->do_select_outline, 1);
+ DRW_shgroup_uniform_vec4(mix_shgrp, "select_color", stl->storage->select_color, 1);
/* mix pass no blend used to copy between passes. A separated pass is required
* because if mix_pass is used, the acumulation of blend degrade the colors.
@@ -464,6 +476,8 @@ void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, "strokeColor", &e_data.input_color_tx);
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, "strokeDepth", &e_data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp_noblend, "tonemapping", &stl->storage->tonemapping, 1);
+ DRW_shgroup_uniform_int(mix_shgrp_noblend, "do_select", &stl->storage->do_select_outline, 1);
+ DRW_shgroup_uniform_vec4(mix_shgrp_noblend, "select_color", stl->storage->select_color, 1);
/* Painting session pass (used only to speedup while the user is drawing )
* This pass is used to show the snapshot of the current grease pencil strokes captured
@@ -546,6 +560,7 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
/* FX passses */
cache_ob->has_fx = false;
if ((!stl->storage->simplify_fx) &&
+ (!ELEM(cache_ob->shading_type[0], OB_WIRE, OB_SOLID)) &&
(BKE_shaderfx_has_gpencil(ob)))
{
cache_ob->has_fx = true;
@@ -553,7 +568,6 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
DRW_gpencil_fx_prepare(&e_data, vedata, cache_ob);
}
}
-
}
void GPENCIL_cache_populate(void *vedata, Object *ob)
@@ -589,13 +603,17 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
stl->g_data->gp_object_cache, ob,
&stl->g_data->gp_cache_size, &stl->g_data->gp_cache_used);
+ /* enable instance loop */
+ if (!stl->g_data->do_instances) {
+ stl->g_data->do_instances = ob->base_flag & BASE_FROM_DUPLI;
+ }
+
/* load drawing data */
gpencil_add_draw_data(vedata, ob);
}
/* draw current painting strokes
- * (only if region is equal to originated paint region)
- */
+ * (only if region is equal to originated paint region) */
if ((draw_ctx->obact == ob) &&
((gpd->runtime.ar == NULL) || (gpd->runtime.ar == draw_ctx->ar)))
{
@@ -604,7 +622,7 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
/* grid */
if ((v3d) &&
- ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
+ ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
(v3d->gp_flag & V3D_GP_SHOW_GRID) &&
(ob->type == OB_GPENCIL) && (ob == draw_ctx->obact))
{
@@ -635,17 +653,37 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
void GPENCIL_cache_finish(void *vedata)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
+ tGPencilObjectCache *cache_ob = NULL;
+ Object *ob = NULL;
+
+ /* create data for instances */
+ if (stl->g_data->do_instances) {
+ GHash *gh_objects = BLI_ghash_str_new(__func__);
+ /* create hash of real object (non duplicated) */
+ for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
+ cache_ob = &stl->g_data->gp_object_cache[i];
+ if (!cache_ob->is_dup_ob) {
+ ob = cache_ob->ob;
+ char *name = BKE_id_to_unique_string_key(&ob->id);
+ BLI_ghash_insert(gh_objects, name, cache_ob->ob);
+ }
+ }
- /* draw particles */
- DRW_gpencil_populate_particles(&e_data, vedata);
+ /* draw particles */
+ DRW_gpencil_populate_particles(&e_data, gh_objects, vedata);
+
+ /* free hash */
+ BLI_ghash_free(gh_objects, MEM_freeN, NULL);
+ }
if (stl->g_data->session_flag & (GP_DRW_PAINT_IDLE | GP_DRW_PAINT_FILLING)) {
stl->storage->framebuffer_flag |= GP_FRAMEBUFFER_DRAW;
}
- /* create framebuffers */
- GPENCIL_create_framebuffers(vedata);
-
+ /* create framebuffers (only for normal drawing) */
+ if (!DRW_state_is_select()) {
+ GPENCIL_create_framebuffers(vedata);
+ }
}
/* helper function to sort inverse gpencil objects using qsort */
@@ -681,15 +719,22 @@ static void gpencil_prepare_fast_drawing(
static void gpencil_free_obj_runtime(GPENCIL_StorageList *stl)
{
+ if (stl->g_data->gp_object_cache == NULL) {
+ return;
+ }
+
/* reset all cache flags */
for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
tGPencilObjectCache *cache_ob = &stl->g_data->gp_object_cache[i];
- bGPdata *gpd = cache_ob->gpd;
- gpd->flag &= ~GP_DATA_CACHE_IS_DIRTY;
-
- /* free shgrp array */
- cache_ob->tot_layers = 0;
- MEM_SAFE_FREE(cache_ob->shgrp_array);
+ if (cache_ob) {
+ bGPdata *gpd = cache_ob->gpd;
+ gpd->flag &= ~GP_DATA_CACHE_IS_DIRTY;
+
+ /* free shgrp array */
+ cache_ob->tot_layers = 0;
+ MEM_SAFE_FREE(cache_ob->name);
+ MEM_SAFE_FREE(cache_ob->shgrp_array);
+ }
}
/* free the cache itself */
@@ -699,7 +744,7 @@ static void gpencil_free_obj_runtime(GPENCIL_StorageList *stl)
static void gpencil_draw_pass_range(
GPENCIL_FramebufferList *fbl, GPENCIL_StorageList *stl,
GPENCIL_PassList *psl, GPENCIL_TextureList *txl,
- GPUFrameBuffer *fb,
+ GPUFrameBuffer *fb, Object *ob, bGPdata *gpd,
DRWShadingGroup *init_shgrp, DRWShadingGroup *end_shgrp, bool multi)
{
if (init_shgrp == NULL) {
@@ -712,12 +757,54 @@ static void gpencil_draw_pass_range(
}
DRW_draw_pass_subset(
- psl->stroke_pass, init_shgrp, end_shgrp);
+ GPENCIL_3D_DRAWMODE(ob, gpd) ? psl->stroke_pass_3d : psl->stroke_pass_2d,
+ init_shgrp, end_shgrp);
if ((!stl->storage->is_mat_preview) && (multi)) {
MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, fb, txl);
}
+}
+/* draw strokes to use for selection */
+static void drw_gpencil_select_render(GPENCIL_StorageList *stl, GPENCIL_PassList *psl)
+{
+ tGPencilObjectCache *cache_ob;
+ tGPencilObjectCache_shgrp *array_elm = NULL;
+ DRWShadingGroup *init_shgrp = NULL;
+ DRWShadingGroup *end_shgrp = NULL;
+
+ /* Draw all pending objects */
+ if ((stl->g_data->gp_cache_used > 0) &&
+ (stl->g_data->gp_object_cache))
+ {
+ /* sort by zdepth */
+ qsort(stl->g_data->gp_object_cache, stl->g_data->gp_cache_used,
+ sizeof(tGPencilObjectCache), gpencil_object_cache_compare_zdepth);
+
+ for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
+ cache_ob = &stl->g_data->gp_object_cache[i];
+ if (cache_ob) {
+ Object *ob = cache_ob->ob;
+ bGPdata *gpd = cache_ob->gpd;
+ init_shgrp = NULL;
+ if (cache_ob->tot_layers > 0) {
+ for (int e = 0; e < cache_ob->tot_layers; e++) {
+ array_elm = &cache_ob->shgrp_array[e];
+ if (init_shgrp == NULL) {
+ init_shgrp = array_elm->init_shgrp;
+ }
+ end_shgrp = array_elm->end_shgrp;
+ }
+ /* draw group */
+ DRW_draw_pass_subset(
+ GPENCIL_3D_DRAWMODE(ob, gpd) ? psl->stroke_pass_3d : psl->stroke_pass_2d,
+ init_shgrp, end_shgrp);
+ }
+ /* the cache must be dirty for next loop */
+ gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
+ }
+ }
+ }
}
/* draw scene */
@@ -745,10 +832,19 @@ void GPENCIL_draw_scene(void *ved)
const bool is_render = stl->storage->is_render;
bGPdata *gpd_act = (obact) && (obact->type == OB_GPENCIL) ? (bGPdata *)obact->data : NULL;
const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd_act);
+ const bool overlay = v3d != NULL ? (bool)((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) : true;
+
+ /* if the draw is for select, do a basic drawing and return */
+ if (DRW_state_is_select()) {
+ drw_gpencil_select_render(stl, psl);
+ /* free memory */
+ gpencil_free_obj_runtime(stl);
+ return;
+ }
/* paper pass to display a comfortable area to draw over complex scenes with geometry */
if ((!is_render) && (obact) && (obact->type == OB_GPENCIL)) {
- if (((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
+ if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
(v3d->gp_flag & V3D_GP_SHOW_PAPER))
{
DRW_draw_pass(psl->paper_pass);
@@ -771,13 +867,12 @@ void GPENCIL_draw_scene(void *ved)
/* grid pass */
if ((!is_render) && (obact) && (obact->type == OB_GPENCIL)) {
- if (((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
+ if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
(v3d->gp_flag & V3D_GP_SHOW_GRID))
{
DRW_draw_pass(psl->grid_pass);
}
}
-
return;
}
@@ -785,13 +880,13 @@ void GPENCIL_draw_scene(void *ved)
/* Draw all pending objects */
if (stl->g_data->gp_cache_used > 0) {
-
/* sort by zdepth */
qsort(stl->g_data->gp_object_cache, stl->g_data->gp_cache_used,
sizeof(tGPencilObjectCache), gpencil_object_cache_compare_zdepth);
for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
cache_ob = &stl->g_data->gp_object_cache[i];
+ Object *ob = cache_ob->ob;
bGPdata *gpd = cache_ob->gpd;
init_shgrp = NULL;
/* Render stroke in separated framebuffer */
@@ -821,7 +916,7 @@ void GPENCIL_draw_scene(void *ved)
/* draw pending groups */
gpencil_draw_pass_range(
fbl, stl, psl, txl, fbl->temp_fb_a,
- init_shgrp, end_shgrp, is_last);
+ ob, gpd, init_shgrp, end_shgrp, is_last);
/* draw current group in separated texture */
init_shgrp = array_elm->init_shgrp;
@@ -831,7 +926,7 @@ void GPENCIL_draw_scene(void *ved)
GPU_framebuffer_clear_color_depth(fbl->temp_fb_fx, clearcol, 1.0f);
gpencil_draw_pass_range(
fbl, stl, psl, txl, fbl->temp_fb_fx,
- init_shgrp, end_shgrp,
+ ob, gpd, init_shgrp, end_shgrp,
is_last);
/* Blend A texture and FX texture */
@@ -855,12 +950,11 @@ void GPENCIL_draw_scene(void *ved)
/* prepare next group */
init_shgrp = NULL;
}
-
}
/* last group */
gpencil_draw_pass_range(
fbl, stl, psl, txl, fbl->temp_fb_a,
- init_shgrp, end_shgrp,
+ ob, gpd, init_shgrp, end_shgrp,
true);
}
@@ -887,8 +981,28 @@ void GPENCIL_draw_scene(void *ved)
/* tonemapping */
stl->storage->tonemapping = stl->storage->is_render ? 1 : 0;
+ /* active select flag and selection color */
+ stl->storage->do_select_outline = (
+ (overlay) &&
+ (ob->base_flag & BASE_SELECTED) &&
+ (ob->mode == OB_MODE_OBJECT) &&
+ (!is_render) && (!playing) &&
+ (v3d->flag & V3D_SELECT_OUTLINE));
+
+ /* if active object is not object mode, disable for all objects */
+ if ((draw_ctx->obact) && (draw_ctx->obact->mode != OB_MODE_OBJECT)) {
+ stl->storage->do_select_outline = 0;
+ }
+ UI_GetThemeColorShadeAlpha4fv(
+ (ob == draw_ctx->obact) ? TH_ACTIVE : TH_SELECT, 0, -40,
+ stl->storage->select_color);
+
+ /* draw mix pass */
DRW_draw_pass(psl->mix_pass);
+ /* disable select flag */
+ stl->storage->do_select_outline = 0;
+
/* prepare for fast drawing */
if (!is_render) {
if (!playing) {
@@ -907,7 +1021,7 @@ void GPENCIL_draw_scene(void *ved)
}
/* grid pass */
if ((!is_render) && (obact) && (obact->type == OB_GPENCIL)) {
- if (((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
+ if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
(v3d->gp_flag & V3D_GP_SHOW_GRID))
{
DRW_draw_pass(psl->grid_pass);
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 6f2b40136ca..fc45463fa1a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2017, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Antonio Vazquez
- *
+ * Copyright 2017, Blender Foundation.
*/
-/** \file blender/draw/engines/gpencil/gpencil_engine.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __GPENCIL_ENGINE_H__
@@ -28,15 +25,15 @@
#include "GPU_batch.h"
-struct tGPspoint;
-struct bGPDstroke;
-struct ModifierData;
struct GPENCIL_Data;
struct GPENCIL_StorageList;
-struct Object;
struct MaterialGPencilStyle;
+struct ModifierData;
+struct Object;
struct RenderEngine;
struct RenderLayer;
+struct bGPDstroke;
+struct tGPspoint;
#define GPENCIL_CACHE_BLOCK_SIZE 8
#define GPENCIL_MAX_SHGROUPS 65536
@@ -72,6 +69,7 @@ typedef struct tGPencilObjectCache {
struct Object *ob;
struct bGPdata *gpd;
int idx; /*original index, can change after sort */
+ char *name;
/* effects */
bool has_fx;
@@ -92,6 +90,10 @@ typedef struct tGPencilObjectCache {
float obmat[4][4];
float zdepth; /* z-depth value to sort gp object */
bool is_dup_ob; /* flag to tag duplicate objects */
+ float scale;
+
+ /* shading type */
+ int shading_type[2];
/* GPU data size */
int tot_vertex;
@@ -114,7 +116,14 @@ typedef struct GPENCIL_shgroup {
int texture_clamp;
int fill_style;
int keep_size;
+ int caps_mode[2];
float obj_scale;
+ int xray_mode;
+
+ /* color of the wireframe */
+ float wire_color[4];
+ /* shading type and mode */
+ int shading_type[2];
} GPENCIL_shgroup;
typedef struct GPENCIL_Storage {
@@ -130,6 +139,7 @@ typedef struct GPENCIL_Storage {
bool is_playing;
bool is_render;
bool is_mat_preview;
+ int is_xray;
bool reset_cache;
bool buffer_stroke;
bool buffer_fill;
@@ -137,6 +147,8 @@ typedef struct GPENCIL_Storage {
const float *pixsize;
float render_pixsize;
int tonemapping;
+ int do_select_outline;
+ float select_color[4];
short multisamples;
short framebuffer_flag; /* flag what framebuffer need to create */
@@ -158,6 +170,7 @@ typedef struct GPENCIL_Storage {
float view_vecs[2][4]; /* vec4[2] */
float grid_matrix[4][4];
+ int shade_render[2];
Object *camera; /* camera pointer for render mode */
} GPENCIL_Storage;
@@ -175,7 +188,8 @@ typedef struct GPENCIL_StorageList {
} GPENCIL_StorageList;
typedef struct GPENCIL_PassList {
- struct DRWPass *stroke_pass;
+ struct DRWPass *stroke_pass_2d;
+ struct DRWPass *stroke_pass_3d;
struct DRWPass *edit_pass;
struct DRWPass *drawing_pass;
struct DRWPass *mix_pass;
@@ -236,6 +250,7 @@ typedef struct g_data {
struct tGPencilObjectCache *gp_object_cache;
int session_flag;
+ bool do_instances;
} g_data; /* Transient data */
@@ -364,7 +379,10 @@ typedef struct GpencilBatchCache {
/* general drawing functions */
struct DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
struct GPENCIL_e_data *e_data, struct GPENCIL_Data *vedata, struct DRWPass *pass, struct GPUShader *shader,
- struct Object *ob, struct bGPdata *gpd, struct MaterialGPencilStyle *gp_style, int id, bool onion);
+ struct Object *ob, struct bGPdata *gpd,
+ struct bGPDlayer *gpl, struct bGPDstroke *gps,
+ struct MaterialGPencilStyle *gp_style, int id, bool onion,
+ const float scale, const int shading_type[2]);
void DRW_gpencil_populate_datablock(
struct GPENCIL_e_data *e_data, void *vedata,
struct Object *ob, struct tGPencilObjectCache *cache_ob);
@@ -374,7 +392,7 @@ void DRW_gpencil_populate_multiedit(
struct GPENCIL_e_data *e_data, void *vedata,
struct Object *ob, struct tGPencilObjectCache *cache_ob);
void DRW_gpencil_triangulate_stroke_fill(struct Object *ob, struct bGPDstroke *gps);
-void DRW_gpencil_populate_particles(struct GPENCIL_e_data *e_data, void *vedata);
+void DRW_gpencil_populate_particles(struct GPENCIL_e_data *e_data, struct GHash *gh_objects, void *vedata);
void DRW_gpencil_multisample_ensure(struct GPENCIL_Data *vedata, int rect_w, int rect_h);
@@ -416,10 +434,10 @@ void GPENCIL_create_fx_passes(struct GPENCIL_PassList *psl);
void DRW_gpencil_fx_prepare(
struct GPENCIL_e_data *e_data, struct GPENCIL_Data *vedata,
- struct tGPencilObjectCache *cache);
+ struct tGPencilObjectCache *cache_ob);
void DRW_gpencil_fx_draw(
struct GPENCIL_e_data *e_data, struct GPENCIL_Data *vedata,
- struct tGPencilObjectCache *cache);
+ struct tGPencilObjectCache *cache_ob);
/* main functions */
void GPENCIL_engine_init(void *vedata);
@@ -451,4 +469,11 @@ void GPENCIL_render_to_image(void *vedata, struct RenderEngine *engine, struct R
} \
}
+#define GPENCIL_3D_DRAWMODE(ob, gpd) \
+ ((gpd) && (gpd->draw_mode == GP_DRAWMODE_3D) && \
+ ((ob->dtx & OB_DRAWXRAY) == 0))
+
+#define GPENCIL_USE_SOLID(stl) \
+ ((stl) && ((stl->storage->is_render) || (stl->storage->is_mat_preview)))
+
#endif /* __GPENCIL_ENGINE_H__ */
diff --git a/source/blender/draw/engines/gpencil/gpencil_render.c b/source/blender/draw/engines/gpencil/gpencil_render.c
index 1fe008e4d44..2e3cb4b7b26 100644
--- a/source/blender/draw/engines/gpencil/gpencil_render.c
+++ b/source/blender/draw/engines/gpencil/gpencil_render.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2017, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,19 +13,16 @@
* 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): Antonio Vazquez
- *
+ * Copyright 2017, Blender Foundation.
*/
-/** \file blender/draw/engines/gpencil/gpencil_render.c
- * \ingroup draw
- */
+ /** \file
+ * \ingroup draw
+ */
#include "BLI_rect.h"
-#include "DRW_engine.h"
#include "DRW_render.h"
-#include "BKE_camera.h"
#include "BKE_object.h"
#include "DNA_gpencil_types.h"
@@ -40,10 +35,10 @@
#include "gpencil_engine.h"
-/* Get pixel size for render
- * This function uses the same calculation used for viewport, because if use
- * camera pixelsize, the result is not correct.
- */
+ /* Get pixel size for render
+ * This function uses the same calculation used for viewport, because if use
+ * camera pixelsize, the result is not correct.
+ */
static float get_render_pixelsize(float persmat[4][4], int winx, int winy)
{
float v1[3], v2[3];
@@ -78,7 +73,7 @@ void GPENCIL_render_init(GPENCIL_Data *ved, RenderEngine *engine, struct Depsgra
* because there is no viewport. So we need to manually create one
* NOTE : use 32 bit format for precision in render mode.
*/
- /* create multiframe framebuffer for AA */
+ /* create multiframe framebuffer for AA */
if (U.gpencil_multisamples > 0) {
int rect_w = (int)viewport_size[0];
int rect_h = (int)viewport_size[1];
@@ -86,16 +81,16 @@ void GPENCIL_render_init(GPENCIL_Data *ved, RenderEngine *engine, struct Depsgra
}
vedata->render_depth_tx = DRW_texture_pool_query_2D(
- size[0], size[1], GPU_DEPTH_COMPONENT24,
- &draw_engine_gpencil_type);
+ size[0], size[1], GPU_DEPTH_COMPONENT24,
+ &draw_engine_gpencil_type);
vedata->render_color_tx = DRW_texture_pool_query_2D(
- size[0], size[1], GPU_RGBA32F,
- &draw_engine_gpencil_type);
+ size[0], size[1], GPU_RGBA32F,
+ &draw_engine_gpencil_type);
GPU_framebuffer_ensure_config(
- &fbl->main, {
- GPU_ATTACHMENT_TEXTURE(vedata->render_depth_tx),
- GPU_ATTACHMENT_TEXTURE(vedata->render_color_tx)
- });
+ &fbl->main, {
+ GPU_ATTACHMENT_TEXTURE(vedata->render_depth_tx),
+ GPU_ATTACHMENT_TEXTURE(vedata->render_color_tx)
+ });
/* Alloc transient data. */
if (!stl->g_data) {
@@ -237,14 +232,14 @@ static void GPENCIL_render_result_combined(struct RenderLayer *rl, const char *v
}
/* helper to blend pixels */
-static void blend_pixel(float src[4], float dst[4])
+static void blend_pixel(float top_color[4], float bottom_color[4], float dst_color[4])
{
- float alpha = src[3];
+ float alpha = top_color[3];
/* use blend: GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA */
- dst[0] = (src[0] * alpha) + (dst[0] * (1.0f - alpha));
- dst[1] = (src[1] * alpha) + (dst[1] * (1.0f - alpha));
- dst[2] = (src[2] * alpha) + (dst[2] * (1.0f - alpha));
+ dst_color[0] = (top_color[0] * alpha) + (bottom_color[0] * (1.0f - alpha));
+ dst_color[1] = (top_color[1] * alpha) + (bottom_color[1] * (1.0f - alpha));
+ dst_color[2] = (top_color[2] * alpha) + (bottom_color[2] * (1.0f - alpha));
}
/* render grease pencil to image */
@@ -297,10 +292,10 @@ void GPENCIL_render_to_image(void *vedata, RenderEngine *engine, struct RenderLa
GPENCIL_render_result_z(render_layer, viewname, vedata, rect);
/* detach textures */
- if (fbl->main) {
- GPU_framebuffer_texture_detach(fbl->main, ((GPENCIL_Data *)vedata)->render_depth_tx);
- GPU_framebuffer_texture_detach(fbl->main, ((GPENCIL_Data *)vedata)->render_color_tx);
- }
+ if (fbl->main) {
+ GPU_framebuffer_texture_detach(fbl->main, ((GPENCIL_Data *)vedata)->render_depth_tx);
+ GPU_framebuffer_texture_detach(fbl->main, ((GPENCIL_Data *)vedata)->render_color_tx);
+ }
/* merge previous render image with new GP image */
if (src_rect_color_data) {
@@ -312,7 +307,6 @@ void GPENCIL_render_to_image(void *vedata, RenderEngine *engine, struct RenderLa
float *gp_pixel_depth;
float *src_pixel_rgba;
float *src_pixel_depth;
- float tmp[4];
for (int i = 0; i < imgsize; i++) {
gp_pixel_rgba = &gp_rect_color_data[i * 4];
@@ -323,22 +317,29 @@ void GPENCIL_render_to_image(void *vedata, RenderEngine *engine, struct RenderLa
/* check grease pencil render transparency */
if (gp_pixel_rgba[3] > 0.0f) {
- copy_v4_v4(tmp, gp_pixel_rgba);
if (src_pixel_rgba[3] > 0.0f) {
- /* copy source color on back */
- copy_v4_v4(gp_pixel_rgba, src_pixel_rgba);
/* check z-depth */
if (gp_pixel_depth[0] > src_pixel_depth[0]) {
/* copy source z-depth */
gp_pixel_depth[0] = src_pixel_depth[0];
- /* blend gp render */
- blend_pixel(tmp, gp_pixel_rgba);
/* blend object on top */
- blend_pixel(src_pixel_rgba, gp_pixel_rgba);
+ if (src_pixel_rgba[3] < 1.0f) {
+ blend_pixel(src_pixel_rgba, gp_pixel_rgba, gp_pixel_rgba);
+ }
+ else {
+ copy_v4_v4(gp_pixel_rgba, src_pixel_rgba);
+ }
}
else {
/* blend gp render */
- blend_pixel(tmp, gp_pixel_rgba);
+ if (gp_pixel_rgba[3] < 1.0f) {
+ /* premult alpha factor to remove double blend effects */
+ mul_v3_fl(gp_pixel_rgba, 1.0f / gp_pixel_rgba[3]);
+
+ blend_pixel(gp_pixel_rgba, src_pixel_rgba, gp_pixel_rgba);
+
+ gp_pixel_rgba[3] = gp_pixel_rgba[3] > src_pixel_rgba[3] ? gp_pixel_rgba[3] : src_pixel_rgba[3];
+ }
}
}
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
index db080b0626b..e4819f48eb1 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2017, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,30 +13,23 @@
* 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): Antonio Vazquez
- *
+ * Copyright 2017, Blender Foundation.
*/
-/** \file blender/draw/engines/gpencil/gpencil_shader_fx.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DNA_gpencil_types.h"
#include "DNA_shader_fx_types.h"
-#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "DNA_camera_types.h"
#include "BKE_gpencil.h"
-#include "BKE_shader_fx.h"
-#include "DRW_engine.h"
#include "DRW_render.h"
#include "BKE_camera.h"
-#include "ED_view3d.h"
-#include "ED_gpencil.h"
-
#include "gpencil_engine.h"
extern char datatoc_gpencil_fx_blur_frag_glsl[];
@@ -89,13 +80,15 @@ static bool effect_is_active(bGPdata *gpd, ShaderFxData *fx, bool is_render)
static bool get_normal_vector(bGPdata *gpd, float r_point[3], float r_normal[3])
{
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- if (gpl->flag & GP_LAYER_HIDE)
+ if (gpl->flag & GP_LAYER_HIDE) {
continue;
+ }
/* get frame */
bGPDframe *gpf = gpl->actframe;
- if (gpf == NULL)
+ if (gpf == NULL) {
continue;
+ }
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
if (gps->totpoints >= 3) {
bGPDspoint *pt = &gps->points[0];
@@ -164,6 +157,8 @@ static void DRW_gpencil_fx_blur(
View3D *v3d = draw_ctx->v3d;
RegionView3D *rv3d = draw_ctx->rv3d;
DRWShadingGroup *fx_shgrp;
+ bGPdata *gpd = cache->gpd;
+ copy_v3_v3(fxd->runtime.loc, cache->loc);
fxd->blur[0] = fxd->radius[0];
fxd->blur[1] = fxd->radius[1];
@@ -221,9 +216,9 @@ static void DRW_gpencil_fx_blur(
DRW_shgroup_uniform_vec2(fx_shgrp, "Viewport", DRW_viewport_size_get(), 1);
DRW_shgroup_uniform_int(fx_shgrp, "blur", &fxd->blur[0], 2);
- DRW_shgroup_uniform_vec3(fx_shgrp, "loc", &cache->loc[0], 1);
+ DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->runtime.loc, 1);
DRW_shgroup_uniform_float(fx_shgrp, "pixsize", stl->storage->pixsize, 1);
- DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &cache->pixfactor, 1);
+ DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &gpd->pixfactor, 1);
fxd->runtime.fx_sh = fx_shgrp;
}
@@ -332,7 +327,7 @@ static void DRW_gpencil_fx_light(
DRW_shgroup_uniform_float(fx_shgrp, "ambient", &fxd->ambient, 1);
DRW_shgroup_uniform_float(fx_shgrp, "pixsize", stl->storage->pixsize, 1);
- DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &cache->pixfactor, 1);
+ DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &gpd->pixfactor, 1);
fxd->runtime.fx_sh = fx_shgrp;
}
@@ -351,6 +346,7 @@ static void DRW_gpencil_fx_pixel(
GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
DRWShadingGroup *fx_shgrp;
bGPdata *gpd = cache->gpd;
+ copy_v3_v3(fxd->runtime.loc, cache->loc);
fxd->size[2] = (int)fxd->flag & FX_PIXEL_USE_LINES;
@@ -362,7 +358,7 @@ static void DRW_gpencil_fx_pixel(
DRW_shgroup_uniform_int(fx_shgrp, "size", &fxd->size[0], 3);
DRW_shgroup_uniform_vec4(fx_shgrp, "color", &fxd->rgba[0], 1);
- DRW_shgroup_uniform_vec3(fx_shgrp, "loc", &cache->loc[0], 1);
+ DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->runtime.loc, 1);
DRW_shgroup_uniform_float(fx_shgrp, "pixsize", stl->storage->pixsize, 1);
DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &gpd->pixfactor, 1);
@@ -378,12 +374,15 @@ static void DRW_gpencil_fx_rim(
return;
}
RimShaderFxData *fxd = (RimShaderFxData *)fx;
+ bGPdata *gpd = cache->gpd;
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
DRWShadingGroup *fx_shgrp;
GPUBatch *fxquad = DRW_cache_fullscreen_quad_get();
+ copy_v3_v3(fxd->runtime.loc, cache->loc);
+
/* prepare pass */
fx_shgrp = DRW_shgroup_create(
e_data->gpencil_fx_rim_prepare_sh,
@@ -397,9 +396,9 @@ static void DRW_gpencil_fx_rim(
DRW_shgroup_uniform_vec3(fx_shgrp, "rim_color", &fxd->rim_rgb[0], 1);
DRW_shgroup_uniform_vec3(fx_shgrp, "mask_color", &fxd->mask_rgb[0], 1);
- DRW_shgroup_uniform_vec3(fx_shgrp, "loc", &cache->loc[0], 1);
+ DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->runtime.loc, 1);
DRW_shgroup_uniform_float(fx_shgrp, "pixsize", stl->storage->pixsize, 1);
- DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &cache->pixfactor, 1);
+ DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &gpd->pixfactor, 1);
fxd->runtime.fx_sh = fx_shgrp;
@@ -413,9 +412,9 @@ static void DRW_gpencil_fx_rim(
DRW_shgroup_uniform_vec2(fx_shgrp, "Viewport", DRW_viewport_size_get(), 1);
DRW_shgroup_uniform_int(fx_shgrp, "blur", &fxd->blur[0], 2);
- DRW_shgroup_uniform_vec3(fx_shgrp, "loc", &cache->loc[0], 1);
+ DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->runtime.loc, 1);
DRW_shgroup_uniform_float(fx_shgrp, "pixsize", stl->storage->pixsize, 1);
- DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &cache->pixfactor, 1);
+ DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &gpd->pixfactor, 1);
fxd->runtime.fx_sh_b = fx_shgrp;
@@ -452,6 +451,8 @@ static void DRW_gpencil_fx_shadow(
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
DRWShadingGroup *fx_shgrp;
+ bGPdata *gpd = cache->gpd;
+ copy_v3_v3(fxd->runtime.loc, cache->loc);
GPUBatch *fxquad = DRW_cache_fullscreen_quad_get();
/* prepare pass */
@@ -472,7 +473,7 @@ static void DRW_gpencil_fx_shadow(
DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->object->obmat[3], 1);
}
else {
- DRW_shgroup_uniform_vec3(fx_shgrp, "loc", &cache->loc[0], 1);
+ DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->runtime.loc, 1);
}
const int nowave = -1;
@@ -487,7 +488,7 @@ static void DRW_gpencil_fx_shadow(
DRW_shgroup_uniform_float(fx_shgrp, "phase", &fxd->phase, 1);
DRW_shgroup_uniform_float(fx_shgrp, "pixsize", stl->storage->pixsize, 1);
- DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &cache->pixfactor, 1);
+ DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &gpd->pixfactor, 1);
fxd->runtime.fx_sh = fx_shgrp;
@@ -501,9 +502,9 @@ static void DRW_gpencil_fx_shadow(
DRW_shgroup_uniform_vec2(fx_shgrp, "Viewport", DRW_viewport_size_get(), 1);
DRW_shgroup_uniform_int(fx_shgrp, "blur", &fxd->blur[0], 2);
- DRW_shgroup_uniform_vec3(fx_shgrp, "loc", &cache->loc[0], 1);
+ DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->runtime.loc, 1);
DRW_shgroup_uniform_float(fx_shgrp, "pixsize", stl->storage->pixsize, 1);
- DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &cache->pixfactor, 1);
+ DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &gpd->pixfactor, 1);
fxd->runtime.fx_sh_b = fx_shgrp;
@@ -529,6 +530,8 @@ static void DRW_gpencil_fx_glow(
return;
}
GlowShaderFxData *fxd = (GlowShaderFxData *)fx;
+ bGPdata *gpd = cache->gpd;
+ copy_v3_v3(fxd->runtime.loc, cache->loc);
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
@@ -560,9 +563,9 @@ static void DRW_gpencil_fx_glow(
DRW_shgroup_uniform_vec2(fx_shgrp, "Viewport", DRW_viewport_size_get(), 1);
DRW_shgroup_uniform_int(fx_shgrp, "blur", &fxd->blur[0], 2);
- DRW_shgroup_uniform_vec3(fx_shgrp, "loc", &cache->loc[0], 1);
+ DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->runtime.loc, 1);
DRW_shgroup_uniform_float(fx_shgrp, "pixsize", stl->storage->pixsize, 1);
- DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &cache->pixfactor, 1);
+ DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &gpd->pixfactor, 1);
fxd->runtime.fx_sh_b = fx_shgrp;
@@ -598,6 +601,7 @@ static void DRW_gpencil_fx_swirl(
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
DRWShadingGroup *fx_shgrp;
+ bGPdata *gpd = cache->gpd;
fxd->transparent = (int)fxd->flag & FX_SWIRL_MAKE_TRANSPARENT;
@@ -616,7 +620,7 @@ static void DRW_gpencil_fx_swirl(
DRW_shgroup_uniform_int(fx_shgrp, "transparent", &fxd->transparent, 1);
DRW_shgroup_uniform_float(fx_shgrp, "pixsize", stl->storage->pixsize, 1);
- DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &cache->pixfactor, 1);
+ DRW_shgroup_uniform_float(fx_shgrp, "pixfactor", &gpd->pixfactor, 1);
fxd->runtime.fx_sh = fx_shgrp;
}
@@ -739,20 +743,22 @@ void GPENCIL_create_fx_passes(GPENCIL_PassList *psl)
/* prepare fx shading groups */
void DRW_gpencil_fx_prepare(
GPENCIL_e_data *e_data, GPENCIL_Data *vedata,
- tGPencilObjectCache *cache)
+ tGPencilObjectCache *cache_ob)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
- int ob_idx = cache->idx;
+ const bool wiremode = (bool)(cache_ob->shading_type[0] == OB_WIRE);
+
+ int ob_idx = cache_ob->idx;
- if (cache->shader_fx.first == NULL) {
+ if ((wiremode) || (cache_ob->shader_fx.first == NULL)) {
return;
}
/* loop FX */
- for (ShaderFxData *fx = cache->shader_fx.first; fx; fx = fx->next) {
- if (effect_is_active(cache->gpd, fx, stl->storage->is_render)) {
+ for (ShaderFxData *fx = cache_ob->shader_fx.first; fx; fx = fx->next) {
+ if (effect_is_active(cache_ob->gpd, fx, stl->storage->is_render)) {
switch (fx->type) {
case eShaderFxType_Blur:
- DRW_gpencil_fx_blur(fx, ob_idx, e_data, vedata, cache);
+ DRW_gpencil_fx_blur(fx, ob_idx, e_data, vedata, cache_ob);
break;
case eShaderFxType_Colorize:
DRW_gpencil_fx_colorize(fx, e_data, vedata);
@@ -761,22 +767,22 @@ void DRW_gpencil_fx_prepare(
DRW_gpencil_fx_flip(fx, e_data, vedata);
break;
case eShaderFxType_Light:
- DRW_gpencil_fx_light(fx, e_data, vedata, cache);
+ DRW_gpencil_fx_light(fx, e_data, vedata, cache_ob);
break;
case eShaderFxType_Pixel:
- DRW_gpencil_fx_pixel(fx, e_data, vedata, cache);
+ DRW_gpencil_fx_pixel(fx, e_data, vedata, cache_ob);
break;
case eShaderFxType_Rim:
- DRW_gpencil_fx_rim(fx, e_data, vedata, cache);
+ DRW_gpencil_fx_rim(fx, e_data, vedata, cache_ob);
break;
case eShaderFxType_Shadow:
- DRW_gpencil_fx_shadow(fx, e_data, vedata, cache);
+ DRW_gpencil_fx_shadow(fx, e_data, vedata, cache_ob);
break;
case eShaderFxType_Glow:
- DRW_gpencil_fx_glow(fx, e_data, vedata, cache);
+ DRW_gpencil_fx_glow(fx, e_data, vedata, cache_ob);
break;
case eShaderFxType_Swirl:
- DRW_gpencil_fx_swirl(fx, e_data, vedata, cache);
+ DRW_gpencil_fx_swirl(fx, e_data, vedata, cache_ob);
break;
case eShaderFxType_Wave:
DRW_gpencil_fx_wave(fx, e_data, vedata);
@@ -1053,15 +1059,15 @@ static void draw_gpencil_glow_passes(
/* apply all object fx effects */
void DRW_gpencil_fx_draw(
GPENCIL_e_data *e_data,
- GPENCIL_Data *vedata, tGPencilObjectCache *cache)
+ GPENCIL_Data *vedata, tGPencilObjectCache *cache_ob)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
GPENCIL_FramebufferList *fbl = ((GPENCIL_Data *)vedata)->fbl;
/* loop FX modifiers */
- for (ShaderFxData *fx = cache->shader_fx.first; fx; fx = fx->next) {
- if (effect_is_active(cache->gpd, fx, stl->storage->is_render)) {
+ for (ShaderFxData *fx = cache_ob->shader_fx.first; fx; fx = fx->next) {
+ if (effect_is_active(cache_ob->gpd, fx, stl->storage->is_render)) {
switch (fx->type) {
case eShaderFxType_Blur:
diff --git a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
index 33b249ac09b..fb44b18cc86 100644
--- a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
@@ -10,7 +10,7 @@ out vec4 FragColor;
#define MODE_GRAYSCALE 0
#define MODE_SEPIA 1
-#define MODE_BITONE 2
+#define MODE_DUOTONE 2
#define MODE_CUSTOM 3
#define MODE_TRANSPARENT 4
@@ -48,7 +48,7 @@ void main()
outcolor = vec4(Red, Green, Blue, src_pixel.a);
break;
}
- case MODE_BITONE:
+ case MODE_DUOTONE:
{
if (luminance <= factor) {
outcolor = low_color;
diff --git a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl
index 3dbab0297c4..04ab1557d07 100644
--- a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl
@@ -38,6 +38,7 @@ void main()
FragColor = outcolor;
gl_FragDepth = stroke_depth;
- if (outcolor.a < 0.02f)
+ if (outcolor.a < 0.02f) {
discard;
+ }
}
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
index f5696116eea..fdaad9890a0 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
@@ -79,10 +79,12 @@ vec4 get_blend_color(int mode, vec4 src_color, vec4 blend_color)
float linearrgb_to_srgb(float c)
{
- if (c < 0.0031308)
+ if (c < 0.0031308) {
return (c < 0.0) ? 0.0 : c * 12.92;
- else
+ }
+ else {
return 1.055 * pow(c, 1.0 / 2.4) - 0.055;
+ }
}
vec4 tone(vec4 stroke_color)
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
index 1d57cdc4bcf..f0878c8bc89 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
@@ -15,11 +15,16 @@ uniform int texture_mix;
uniform int texture_flip;
uniform float texture_opacity;
uniform int xraymode;
+uniform int drawmode;
uniform float layer_opacity;
uniform sampler2D myTexture;
uniform int texture_clamp;
+uniform int viewport_xray;
+uniform int shading_type[2];
+uniform vec4 wire_color;
+
/* keep this list synchronized with list in gpencil_draw_utils.c */
#define SOLID 0
#define GRADIENT 1
@@ -30,7 +35,15 @@ uniform int texture_clamp;
#define GP_XRAY_FRONT 0
#define GP_XRAY_3DSPACE 1
-#define GP_XRAY_BACK 2
+
+#define GP_DRAWMODE_2D 0
+#define GP_DRAWMODE_3D 1
+
+#define OB_WIRE 2
+#define OB_SOLID 3
+
+#define V3D_SHADING_MATERIAL_COLOR 0
+#define V3D_SHADING_TEXTURE_COLOR 3
in vec4 finalColor;
in vec2 texCoord_interp;
@@ -80,6 +93,11 @@ void main()
vec4 text_color = vec4(tmp_color[0], tmp_color[1], tmp_color[2], tmp_color[3] * texture_opacity);
vec4 chesscolor;
+ /* wireframe with x-ray discard */
+ if ((viewport_xray == 1) && (shading_type[0] == OB_WIRE)) {
+ discard;
+ }
+
/* solid fill */
if (fill_type == SOLID) {
fragColor = finalColor;
@@ -136,12 +154,31 @@ void main()
gl_FragDepth = 0.000001;
}
else if (xraymode == GP_XRAY_3DSPACE) {
- gl_FragDepth = gl_FragCoord.z;
- }
- else if (xraymode == GP_XRAY_BACK) {
- gl_FragDepth = 0.999999;
+ /* if 3D mode, move slightly the fill to avoid z-fighting between stroke and fill on same stroke */
+ if (drawmode == GP_DRAWMODE_3D) {
+ gl_FragDepth = gl_FragCoord.z * 1.0001;
+ }
+ else {
+ gl_FragDepth = gl_FragCoord.z;
+ }
}
else {
gl_FragDepth = 0.000001;
}
+
+ /* if wireframe override colors */
+ if (shading_type[0] == OB_WIRE) {
+ fragColor = wire_color;
+ }
+
+ /* for solid override color */
+ if (shading_type[0] == OB_SOLID) {
+ if ((shading_type[1] != V3D_SHADING_MATERIAL_COLOR) && (shading_type[1] != V3D_SHADING_TEXTURE_COLOR)) {
+ fragColor = wire_color;
+ }
+ if (viewport_xray == 1) {
+ fragColor.a *= 0.5;
+ }
+ }
+
}
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
index db973056110..a1285029e4c 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
@@ -23,9 +23,10 @@ void main()
float dist_squared = dot(centered, centered);
const float rad_squared = 0.25;
- // round point with jaggy edges
- if ((mode != GPENCIL_MODE_BOX) && (dist_squared > rad_squared))
+ /* Round point with jaggy edges. */
+ if ((mode != GPENCIL_MODE_BOX) && (dist_squared > rad_squared)) {
discard;
+ }
vec4 tmp_color = texture2D(myTexture, mTexCoord);
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
index 63f22e0f812..6c22633c521 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
@@ -14,7 +14,6 @@ out vec2 mTexCoord;
#define GP_XRAY_FRONT 0
#define GP_XRAY_3DSPACE 1
-#define GP_XRAY_BACK 2
/* project 3d point to 2d on screen space */
vec2 toScreenSpace(vec4 vertex)
@@ -31,9 +30,6 @@ float getZdepth(vec4 point)
if (xraymode == GP_XRAY_3DSPACE) {
return (point.z / point.w);
}
- if (xraymode == GP_XRAY_BACK) {
- return 0.999999;
- }
/* in front by default */
return 0.000001;
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl
index f870bfbb48d..b367d15f1f9 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl
@@ -5,6 +5,9 @@ uniform float pixsize; /* rv3d->pixsize */
uniform int keep_size;
uniform float objscale;
uniform float pixfactor;
+uniform int viewport_xray;
+uniform int shading_type[2];
+uniform vec4 wire_color;
in vec3 pos;
in vec4 color;
@@ -17,6 +20,12 @@ out vec2 finaluvdata;
#define TRUE 1
+#define OB_WIRE 2
+#define OB_SOLID 3
+
+#define V3D_SHADING_MATERIAL_COLOR 0
+#define V3D_SHADING_TEXTURE_COLOR 3
+
float defaultpixsize = pixsize * (1000.0 / pixfactor);
void main()
@@ -31,6 +40,21 @@ void main()
float size = (ProjectionMatrix[3][3] == 0.0) ? (thickness / (gl_Position.z * defaultpixsize)) : (thickness / defaultpixsize);
finalThickness = max(size * objscale, 4.0); /* minimum 4 pixels */
}
+
+ /* for wireframe override size and color */
+ if (shading_type[0] == OB_WIRE) {
+ finalThickness = 2.0;
+ finalColor = wire_color;
+ }
+ /* for solid override color */
+ if (shading_type[0] == OB_SOLID) {
+ if ((shading_type[1] != V3D_SHADING_MATERIAL_COLOR) && (shading_type[1] != V3D_SHADING_TEXTURE_COLOR)) {
+ finalColor = wire_color;
+ }
+ if (viewport_xray == 1) {
+ finalColor.a *= 0.5;
+ }
+ }
finaluvdata = uvdata;
}
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
index 9a82e871f56..dad482bfa23 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
@@ -3,7 +3,7 @@ uniform sampler2D myTexture;
in vec4 mColor;
in vec2 mTexCoord;
-in float uvfac;
+in vec2 uvfac;
out vec4 fragColor;
@@ -14,13 +14,14 @@ out vec4 fragColor;
#define GPENCIL_COLOR_TEXTURE 1
#define GPENCIL_COLOR_PATTERN 2
+#define ENDCAP 1.0
+
void main()
{
vec4 tColor = vec4(mColor);
- /* if alpha < 0, then encap (only solid mode ) */
- if ((mColor.a < 0) && (color_type == GPENCIL_COLOR_SOLID)) {
- vec2 center = vec2(uvfac, 1.0);
- tColor.a = tColor.a * -1.0;
+ /* if uvfac[1] == 1, then encap */
+ if (uvfac[1] == ENDCAP) {
+ vec2 center = vec2(uvfac[0], 0.5);
float dist = length(mTexCoord - center);
if (dist > 0.50) {
discard;
@@ -30,15 +31,24 @@ void main()
if (color_type == GPENCIL_COLOR_SOLID) {
fragColor = tColor;
}
+
+ /* texture for endcaps */
+ vec4 text_color;
+ if (uvfac[1] == ENDCAP) {
+ text_color = texture2D(myTexture, vec2(mTexCoord.x, mTexCoord.y));
+ }
+ else {
+ text_color = texture2D(myTexture, mTexCoord);
+ }
+
/* texture */
if (color_type == GPENCIL_COLOR_TEXTURE) {
- fragColor = texture2D(myTexture, mTexCoord);
+ fragColor = text_color;
/* mult both alpha factor to use strength factor */
fragColor.a = min(fragColor.a * tColor.a, fragColor.a);
}
/* pattern */
if (color_type == GPENCIL_COLOR_PATTERN) {
- vec4 text_color = texture2D(myTexture, mTexCoord);
fragColor = tColor;
/* mult both alpha factor to use strength factor with color alpha limit */
fragColor.a = min(text_color.a * tColor.a, tColor.a);
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
index 748f69ab21a..a3780a3dd4f 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
@@ -2,6 +2,7 @@ uniform mat4 ModelViewProjectionMatrix;
uniform vec2 Viewport;
uniform int xraymode;
uniform int color_type;
+uniform int caps_mode[2];
layout(lines_adjacency) in;
layout(triangle_strip, max_vertices = 13) out;
@@ -12,17 +13,18 @@ in vec2 finaluvdata[4];
out vec4 mColor;
out vec2 mTexCoord;
-out float uvfac;
+out vec2 uvfac;
#define GP_XRAY_FRONT 0
#define GP_XRAY_3DSPACE 1
-#define GP_XRAY_BACK 2
/* keep this list synchronized with list in gpencil_engine.h */
#define GPENCIL_COLOR_SOLID 0
#define GPENCIL_COLOR_TEXTURE 1
#define GPENCIL_COLOR_PATTERN 2
+#define GPENCIL_FLATCAP 1
+
/* project 3d point to 2d on screen space */
vec2 toScreenSpace(vec4 vertex)
{
@@ -38,9 +40,6 @@ float getZdepth(vec4 point)
if (xraymode == GP_XRAY_3DSPACE) {
return (point.z / point.w);
}
- if (xraymode == GP_XRAY_BACK) {
- return 0.999999;
- }
/* in front by default */
return 0.000001;
@@ -64,7 +63,7 @@ bool is_equal(vec4 p1, vec4 p2)
void main(void)
{
float MiterLimit = 0.75;
- uvfac = 0;
+ uvfac = vec2(0.0, 0.0);
/* receive 4 points */
vec4 P0 = gl_in[0].gl_Position;
@@ -158,26 +157,33 @@ void main(void)
length_b = finalThickness[2];
}
- /* generate the start endcap (alpha < 0 used as endcap flag)*/
- if (is_equal(P0,P2) && (color_type == GPENCIL_COLOR_SOLID)){
- mTexCoord = vec2(2, 1);
- mColor = vec4(finalColor[1].rgb, finalColor[1].a * -1.0) ;
+ /* generate the start endcap */
+ if ((caps_mode[0] != GPENCIL_FLATCAP) && is_equal(P0,P2))
+ {
+ vec4 cap_color = finalColor[1];
+
+ mTexCoord = vec2(2.0, 0.5);
+ mColor = cap_color;
vec2 svn1 = normalize(sp1 - sp2) * length_a * 4.0;
+ uvfac = vec2(0.0, 1.0);
gl_Position = vec4((sp1 + svn1) / Viewport, getZdepth(P1), 1.0);
EmitVertex();
- mTexCoord = vec2(0, 0);
- mColor = vec4(finalColor[1].rgb, finalColor[1].a * -1.0) ;
+ mTexCoord = vec2(0.0, -0.5);
+ mColor = cap_color;
+ uvfac = vec2(0.0, 1.0);
gl_Position = vec4((sp1 - (length_a * 2.0) * miter_a) / Viewport, getZdepth(P1), 1.0);
EmitVertex();
- mTexCoord = vec2(0, 2);
- mColor = vec4(finalColor[1].rgb, finalColor[1].a * -1.0) ;
+ mTexCoord = vec2(0.0, 1.5);
+ mColor = cap_color;
+ uvfac = vec2(0.0, 1.0);
gl_Position = vec4((sp1 + (length_a * 2.0) * miter_a) / Viewport, getZdepth(P1), 1.0);
EmitVertex();
}
/* generate the triangle strip */
+ uvfac = vec2(0.0, 0.0);
mTexCoord = (color_type == GPENCIL_COLOR_SOLID) ? vec2(0, 0) : vec2(finaluvdata[1].x, 0);
mColor = finalColor[1];
gl_Position = vec4((sp1 + length_a * miter_a) / Viewport, getZdepth(P1), 1.0);
@@ -198,23 +204,26 @@ void main(void)
gl_Position = vec4((sp2 - length_b * miter_b) / Viewport, getZdepth(P2), 1.0);
EmitVertex();
- /* generate the end endcap (alpha < 0 used as endcap flag)*/
- if (is_equal(P1,P3) && (color_type == GPENCIL_COLOR_SOLID) && (finaluvdata[2].x > 0)){
- mTexCoord = vec2(finaluvdata[2].x, 2);
- mColor = vec4(finalColor[2].rgb, finalColor[2].a * -1.0) ;
- uvfac = finaluvdata[2].x;
+ /* generate the end endcap */
+ if ((caps_mode[1] != GPENCIL_FLATCAP) && is_equal(P1,P3) && (finaluvdata[2].x > 0))
+ {
+ vec4 cap_color = finalColor[2];
+
+ mTexCoord = vec2(finaluvdata[2].x, 1.5);
+ mColor = cap_color;
+ uvfac = vec2(finaluvdata[2].x, 1.0);
gl_Position = vec4((sp2 + (length_b * 2.0) * miter_b) / Viewport, getZdepth(P2), 1.0);
EmitVertex();
- mTexCoord = vec2(finaluvdata[2].x, 0);
- mColor = vec4(finalColor[2].rgb, finalColor[2].a * -1.0) ;
- uvfac = finaluvdata[2].x;
+ mTexCoord = vec2(finaluvdata[2].x, -0.5);
+ mColor = cap_color;
+ uvfac = vec2(finaluvdata[2].x, 1.0);
gl_Position = vec4((sp2 - (length_b * 2.0) * miter_b) / Viewport, getZdepth(P2), 1.0);
EmitVertex();
- mTexCoord = vec2(finaluvdata[2].x + 2, 1);
- mColor = vec4(finalColor[2].rgb, finalColor[2].a * -1.0) ;
- uvfac = finaluvdata[2].x;
+ mTexCoord = vec2(finaluvdata[2].x + 2, 0.5);
+ mColor = cap_color;
+ uvfac = vec2(finaluvdata[2].x, 1.0);
vec2 svn2 = normalize(sp2 - sp1) * length_b * 4.0;
gl_Position = vec4((sp2 + svn2) / Viewport, getZdepth(P2), 1.0);
EmitVertex();
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl
index 121e244ac8a..3c6768dd483 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl
@@ -5,6 +5,9 @@ uniform float pixsize; /* rv3d->pixsize */
uniform int keep_size;
uniform float objscale;
uniform float pixfactor;
+uniform int viewport_xray;
+uniform int shading_type[2];
+uniform vec4 wire_color;
in vec3 pos;
in vec4 color;
@@ -17,6 +20,12 @@ out vec2 finaluvdata;
#define TRUE 1
+#define OB_WIRE 2
+#define OB_SOLID 3
+
+#define V3D_SHADING_MATERIAL_COLOR 0
+#define V3D_SHADING_TEXTURE_COLOR 3
+
float defaultpixsize = pixsize * (1000.0 / pixfactor);
void main(void)
@@ -32,5 +41,20 @@ void main(void)
finalThickness = max(size * objscale, 1.0);
}
+ /* for wireframe override size and color */
+ if (shading_type[0] == OB_WIRE) {
+ finalThickness = 1.0;
+ finalColor = wire_color;
+ }
+ /* for solid override color */
+ if (shading_type[0] == OB_SOLID) {
+ if ((shading_type[1] != V3D_SHADING_MATERIAL_COLOR) && (shading_type[1] != V3D_SHADING_TEXTURE_COLOR)) {
+ finalColor = wire_color;
+ }
+ if (viewport_xray == 1) {
+ finalColor.a *= 0.5;
+ }
+ }
+
finaluvdata = uvdata;
}
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
index 0983e6c4d87..a68c17031ff 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
@@ -5,21 +5,41 @@ out vec4 FragColor;
uniform sampler2D strokeColor;
uniform sampler2D strokeDepth;
uniform int tonemapping;
+uniform vec4 select_color;
+uniform int do_select;
float srgb_to_linearrgb(float c)
{
- if (c < 0.04045)
+ if (c < 0.04045) {
return (c < 0.0) ? 0.0 : c * (1.0 / 12.92);
- else
+ }
+ else {
return pow((c + 0.055) * (1.0 / 1.055), 2.4);
+ }
}
float linearrgb_to_srgb(float c)
{
- if (c < 0.0031308)
+ if (c < 0.0031308) {
return (c < 0.0) ? 0.0 : c * 12.92;
- else
+ }
+ else {
return 1.055 * pow(c, 1.0 / 2.4) - 0.055;
+ }
+}
+
+bool check_borders(ivec2 uv, int size)
+{
+ for (int x = -size; x <= size; x++) {
+ for (int y = -size; y <= size; y++) {
+ vec4 stroke_color = texelFetch(strokeColor, ivec2(uv.x + x, uv.y + y), 0).rgba;
+ if (stroke_color.a > 0) {
+ return true;
+ }
+ }
+ }
+
+ return false;
}
void main()
@@ -40,6 +60,15 @@ void main()
stroke_color.b = srgb_to_linearrgb(stroke_color.b);
}
- FragColor = stroke_color;
- gl_FragDepth = stroke_depth;
+ FragColor = clamp(stroke_color, 0.0, 1.0);
+ gl_FragDepth = clamp(stroke_depth, 0.0, 1.0);
+
+ if (do_select == 1) {
+ if (stroke_color.a == 0) {
+ if (check_borders(uv, 2)) {
+ FragColor = select_color;
+ gl_FragDepth = 0.000001;
+ }
+ }
+ }
}
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl
index 7b77139fb6c..998517e2e72 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl
@@ -9,8 +9,9 @@ void ssao_factors(
{
cavities = edges = 0.0;
/* early out if there is no need for SSAO */
- if (ssao_factor_cavity == 0.0 && ssao_factor_edge == 0.0)
+ if (ssao_factor_cavity == 0.0 && ssao_factor_edge == 0.0) {
return;
+ }
/* take the normalized ray direction here */
vec3 noise = texture(ssao_jitter, screenco.xy * jitter_tilling).rgb;
@@ -45,8 +46,9 @@ void ssao_factors(
vec2 uvcoords = screenco.xy + dir_jittered * offset;
- if (uvcoords.x > 1.0 || uvcoords.x < 0.0 || uvcoords.y > 1.0 || uvcoords.y < 0.0)
+ if (uvcoords.x > 1.0 || uvcoords.x < 0.0 || uvcoords.y > 1.0 || uvcoords.y < 0.0) {
continue;
+ }
float depth_new = texture(depthBuffer, uvcoords).r;
@@ -56,8 +58,9 @@ void ssao_factors(
/* This trick provide good edge effect even if no neighboor is found. */
vec3 pos_new = get_view_space_from_depth(uvcoords, (is_background) ? depth : depth_new);
- if (is_background)
+ if (is_background) {
pos_new.z -= ssao_distance;
+ }
vec3 dir = pos_new - position;
float len = length(dir);
@@ -68,11 +71,13 @@ void ssao_factors(
float attenuation = 1.0 / (len * (1.0 + len * len * ssao_attenuation));
/* use minor bias here to avoid self shadowing */
- if (f_cavities > -f_bias)
+ if (f_cavities > -f_bias) {
cavities += f_cavities * attenuation;
+ }
- if (f_edge > f_bias)
+ if (f_edge > f_bias) {
edges += f_edge * attenuation;
+ }
}
cavities /= ssao_samples_num;
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl
index 25942b162ee..5f3dbd75b15 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl
@@ -144,10 +144,12 @@ vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped)
float srgb_to_linearrgb(float c)
{
- if (c < 0.04045)
+ if (c < 0.04045) {
return (c < 0.0) ? 0.0 : c * (1.0 / 12.92);
- else
+ }
+ else {
return pow((c + 0.055) * (1.0 / 1.055), 2.4);
+ }
}
vec4 srgb_to_linearrgb(vec4 col_from)
@@ -159,3 +161,13 @@ vec4 srgb_to_linearrgb(vec4 col_from)
col_to.a = col_from.a;
return col_to;
}
+
+vec4 workbench_sample_texture(sampler2D image, vec2 coord, bool srgb, bool nearest_sampling)
+{
+ vec2 tex_size = vec2(textureSize(image, 0).xy);
+ /* TODO(fclem) We could do the same with sampler objects.
+ * But this is a quick workaround instead of messing with the GPUTexture itself. */
+ vec2 uv = nearest_sampling ? (floor(coord * tex_size) + 0.5) / tex_size : coord;
+ vec4 color = texture(image, uv);
+ return (srgb) ? srgb_to_linearrgb(color) : color;
+}
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl
new file mode 100644
index 00000000000..0185e192f5c
--- /dev/null
+++ b/source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl
@@ -0,0 +1,365 @@
+/**
+ * Separable Hexagonal Bokeh Blur by Colin Barré-Brisebois
+ * https://colinbarrebrisebois.com/2017/04/18/hexagonal-bokeh-blur-revisited-part-1-basic-3-pass-version/
+ * Converted and adapted from HLSL to GLSL by Clément Foucault
+ **/
+
+uniform mat4 ProjectionMatrix;
+uniform vec2 invertedViewportSize;
+uniform vec2 nearFar;
+uniform vec3 dofParams;
+uniform float noiseOffset;
+uniform sampler2D inputCocTex;
+uniform sampler2D maxCocTilesTex;
+uniform sampler2D sceneColorTex;
+uniform sampler2D sceneDepthTex;
+uniform sampler2D backgroundTex;
+uniform sampler2D halfResColorTex;
+uniform sampler2D blurTex;
+uniform sampler2D noiseTex;
+
+#define dof_aperturesize dofParams.x
+#define dof_distance dofParams.y
+#define dof_invsensorsize dofParams.z
+
+#define M_PI 3.1415926535897932 /* pi */
+
+float max_v4(vec4 v) { return max(max(v.x, v.y), max(v.z, v.w)); }
+
+#define weighted_sum(a, b, c, d, e, e_sum) ((a) * e.x + (b) * e.y + (c) * e.z + (d) * e.w) / max(1e-6, e_sum);
+
+/* divide by sensor size to get the normalized size */
+#define calculate_coc(zdepth) (dof_aperturesize * (dof_distance / zdepth - 1.0) * dof_invsensorsize)
+
+#define linear_depth(z) ((ProjectionMatrix[3][3] == 0.0) \
+ ? (nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) \
+ : (z * 2.0 - 1.0) * nearFar.y)
+
+
+const float MAX_COC_SIZE = 100.0;
+vec2 encode_coc(float near, float far) { return vec2(near, far) / MAX_COC_SIZE; }
+float decode_coc(vec2 cocs) { return max(cocs.x, cocs.y) * MAX_COC_SIZE; }
+float decode_signed_coc(vec2 cocs) { return ((cocs.x > cocs.y) ? cocs.x : -cocs.y) * MAX_COC_SIZE; }
+
+/**
+ * ----------------- STEP 0 ------------------
+ * Custom Coc aware downsampling. Half res pass.
+ **/
+#ifdef PREPARE
+
+layout(location = 0) out vec4 halfResColor;
+layout(location = 1) out vec2 normalizedCoc;
+
+void main()
+{
+ ivec4 texel = ivec4(gl_FragCoord.xyxy) * 2 + ivec4(0, 0, 1, 1);
+
+ vec4 color1 = texelFetch(sceneColorTex, texel.xy, 0);
+ vec4 color2 = texelFetch(sceneColorTex, texel.zw, 0);
+ vec4 color3 = texelFetch(sceneColorTex, texel.zy, 0);
+ vec4 color4 = texelFetch(sceneColorTex, texel.xw, 0);
+
+ vec4 depths;
+ depths.x = texelFetch(sceneDepthTex, texel.xy, 0).x;
+ depths.y = texelFetch(sceneDepthTex, texel.zw, 0).x;
+ depths.z = texelFetch(sceneDepthTex, texel.zy, 0).x;
+ depths.w = texelFetch(sceneDepthTex, texel.xw, 0).x;
+
+ vec4 zdepths = linear_depth(depths);
+ vec4 cocs_near = calculate_coc(zdepths);
+ vec4 cocs_far = -cocs_near;
+
+ float coc_near = max(max_v4(cocs_near), 0.0);
+ float coc_far = max(max_v4(cocs_far), 0.0);
+
+ /* now we need to write the near-far fields premultiplied by the coc
+ * also use bilateral weighting by each coc values to avoid bleeding. */
+ vec4 near_weights = step(0.0, cocs_near) * clamp(1.0 - abs(coc_near - cocs_near), 0.0, 1.0);
+ vec4 far_weights = step(0.0, cocs_far) * clamp(1.0 - abs(coc_far - cocs_far), 0.0, 1.0);
+
+ /* now write output to weighted buffers. */
+ /* Take far plane pixels in priority. */
+ vec4 w = any(notEqual(far_weights, vec4(0.0))) ? far_weights : near_weights;
+ float tot_weight = dot(w, vec4(1.0));
+ halfResColor = weighted_sum(color1, color2, color3, color4, w, tot_weight);
+ halfResColor = clamp(halfResColor, 0.0, 3.0);
+
+ normalizedCoc = encode_coc(coc_near, coc_far);
+}
+#endif
+
+/**
+ * ----------------- STEP 0.5 ------------------
+ * Custom Coc aware downsampling. Quater res pass.
+ **/
+#ifdef DOWNSAMPLE
+
+layout(location = 0) out vec4 outColor;
+layout(location = 1) out vec2 outCocs;
+
+void main()
+{
+ ivec4 texel = ivec4(gl_FragCoord.xyxy) * 2 + ivec4(0, 0, 1, 1);
+
+ vec4 color1 = texelFetch(sceneColorTex, texel.xy, 0);
+ vec4 color2 = texelFetch(sceneColorTex, texel.zw, 0);
+ vec4 color3 = texelFetch(sceneColorTex, texel.zy, 0);
+ vec4 color4 = texelFetch(sceneColorTex, texel.xw, 0);
+
+ vec4 depths;
+ vec2 cocs1 = texelFetch(inputCocTex, texel.xy, 0).rg;
+ vec2 cocs2 = texelFetch(inputCocTex, texel.zw, 0).rg;
+ vec2 cocs3 = texelFetch(inputCocTex, texel.zy, 0).rg;
+ vec2 cocs4 = texelFetch(inputCocTex, texel.xw, 0).rg;
+
+ vec4 cocs_near = vec4(cocs1.r, cocs2.r, cocs3.r, cocs4.r) * MAX_COC_SIZE;
+ vec4 cocs_far = vec4(cocs1.g, cocs2.g, cocs3.g, cocs4.g) * MAX_COC_SIZE;
+
+ float coc_near = max_v4(cocs_near);
+ float coc_far = max_v4(cocs_far);
+
+ /* now we need to write the near-far fields premultiplied by the coc
+ * also use bilateral weighting by each coc values to avoid bleeding. */
+ vec4 near_weights = step(0.0, cocs_near) * clamp(1.0 - abs(coc_near - cocs_near), 0.0, 1.0);
+ vec4 far_weights = step(0.0, cocs_far) * clamp(1.0 - abs(coc_far - cocs_far), 0.0, 1.0);
+
+ /* now write output to weighted buffers. */
+ vec4 w = any(notEqual(far_weights, vec4(0.0))) ? far_weights : near_weights;
+ float tot_weight = dot(w, vec4(1.0));
+ outColor = weighted_sum(color1, color2, color3, color4, w, tot_weight);
+
+ outCocs = encode_coc(coc_near, coc_far);
+}
+#endif
+
+/**
+ * ----------------- STEP 1 ------------------
+ * Flatten COC buffer using max filter.
+ **/
+#if defined(FLATTEN_VERTICAL) || defined(FLATTEN_HORIZONTAL)
+
+layout(location = 0) out vec2 flattenedCoc;
+
+void main()
+{
+#ifdef FLATTEN_HORIZONTAL
+ ivec2 texel = ivec2(gl_FragCoord.xy) * ivec2(8, 1);
+ vec2 cocs1 = texelFetchOffset(inputCocTex, texel, 0, ivec2(0, 0)).rg;
+ vec2 cocs2 = texelFetchOffset(inputCocTex, texel, 0, ivec2(1, 0)).rg;
+ vec2 cocs3 = texelFetchOffset(inputCocTex, texel, 0, ivec2(2, 0)).rg;
+ vec2 cocs4 = texelFetchOffset(inputCocTex, texel, 0, ivec2(3, 0)).rg;
+ vec2 cocs5 = texelFetchOffset(inputCocTex, texel, 0, ivec2(4, 0)).rg;
+ vec2 cocs6 = texelFetchOffset(inputCocTex, texel, 0, ivec2(5, 0)).rg;
+ vec2 cocs7 = texelFetchOffset(inputCocTex, texel, 0, ivec2(6, 0)).rg;
+ vec2 cocs8 = texelFetchOffset(inputCocTex, texel, 0, ivec2(7, 0)).rg;
+#else /* FLATTEN_VERTICAL */
+ ivec2 texel = ivec2(gl_FragCoord.xy) * ivec2(1, 8);
+ vec2 cocs1 = texelFetchOffset(inputCocTex, texel, 0, ivec2(0, 0)).rg;
+ vec2 cocs2 = texelFetchOffset(inputCocTex, texel, 0, ivec2(0, 1)).rg;
+ vec2 cocs3 = texelFetchOffset(inputCocTex, texel, 0, ivec2(0, 2)).rg;
+ vec2 cocs4 = texelFetchOffset(inputCocTex, texel, 0, ivec2(0, 3)).rg;
+ vec2 cocs5 = texelFetchOffset(inputCocTex, texel, 0, ivec2(0, 4)).rg;
+ vec2 cocs6 = texelFetchOffset(inputCocTex, texel, 0, ivec2(0, 5)).rg;
+ vec2 cocs7 = texelFetchOffset(inputCocTex, texel, 0, ivec2(0, 6)).rg;
+ vec2 cocs8 = texelFetchOffset(inputCocTex, texel, 0, ivec2(0, 7)).rg;
+#endif
+ flattenedCoc = max(max(max(cocs1, cocs2), max(cocs3, cocs4)), max(max(cocs5, cocs6), max(cocs7, cocs8)));
+}
+#endif
+
+/**
+ * ----------------- STEP 1.ax------------------
+ * Dilate COC buffer using min filter.
+ **/
+#if defined(DILATE_VERTICAL) || defined(DILATE_HORIZONTAL)
+
+layout(location = 0) out vec2 dilatedCoc;
+
+void main()
+{
+ vec2 texel_size = 1.0 / vec2(textureSize(inputCocTex, 0));
+ vec2 uv = gl_FragCoord.xy * texel_size;
+#ifdef DILATE_VERTICAL
+ vec2 cocs1 = texture(inputCocTex, uv + texel_size * vec2(-3, 0)).rg;
+ vec2 cocs2 = texture(inputCocTex, uv + texel_size * vec2(-2, 0)).rg;
+ vec2 cocs3 = texture(inputCocTex, uv + texel_size * vec2(-1, 0)).rg;
+ vec2 cocs4 = texture(inputCocTex, uv + texel_size * vec2( 0, 0)).rg;
+ vec2 cocs5 = texture(inputCocTex, uv + texel_size * vec2( 1, 0)).rg;
+ vec2 cocs6 = texture(inputCocTex, uv + texel_size * vec2( 2, 0)).rg;
+ vec2 cocs7 = texture(inputCocTex, uv + texel_size * vec2( 3, 0)).rg;
+#else /* DILATE_HORIZONTAL */
+ vec2 cocs1 = texture(inputCocTex, uv + texel_size * vec2(0, -3)).rg;
+ vec2 cocs2 = texture(inputCocTex, uv + texel_size * vec2(0, -2)).rg;
+ vec2 cocs3 = texture(inputCocTex, uv + texel_size * vec2(0, -1)).rg;
+ vec2 cocs4 = texture(inputCocTex, uv + texel_size * vec2(0, 0)).rg;
+ vec2 cocs5 = texture(inputCocTex, uv + texel_size * vec2(0, 1)).rg;
+ vec2 cocs6 = texture(inputCocTex, uv + texel_size * vec2(0, 2)).rg;
+ vec2 cocs7 = texture(inputCocTex, uv + texel_size * vec2(0, 3)).rg;
+#endif
+ // dilatedCoc = max(max(cocs3, cocs4), max(max(cocs5, cocs6), cocs2));
+ dilatedCoc = max(max(max(cocs1, cocs2), max(cocs3, cocs4)), max(max(cocs5, cocs6), cocs7));
+}
+#endif
+
+/**
+ * ----------------- STEP 2 ------------------
+ * Blur vertically and diagonally.
+ * Outputs vertical blur and combined blur in MRT
+ **/
+#ifdef BLUR1
+layout(location = 0) out vec4 blurColor;
+
+#define NUM_SAMPLES 49
+
+layout(std140) uniform dofSamplesBlock {
+ vec4 samples[NUM_SAMPLES];
+};
+
+vec2 get_random_vector(float offset)
+{
+ /* Interlieved gradient noise by Jorge Jimenez
+ * http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare */
+ float ign = fract(offset + 52.9829189 * fract(0.06711056 * gl_FragCoord.x + 0.00583715 * gl_FragCoord.y));
+ float bn = texelFetch(noiseTex, ivec2(gl_FragCoord.xy) % 64, 0).a;
+ float ang = M_PI * 2.0 * fract(bn + offset);
+ return vec2(cos(ang), sin(ang)) * sqrt(ign);
+ // return noise.rg * sqrt(ign);
+}
+
+void main()
+{
+ vec2 uv = gl_FragCoord.xy * invertedViewportSize * 2.0;
+
+ vec2 size = vec2(textureSize(halfResColorTex, 0).xy);
+ ivec2 texel = ivec2(uv * size);
+
+ vec4 color = vec4(0.0);
+ float tot = 1e-4;
+
+ float coc = decode_coc(texelFetch(inputCocTex, texel, 0).rg);
+ float max_radius = coc;
+ vec2 noise = get_random_vector(noiseOffset) * 0.2 * clamp(max_radius * 0.2 - 4.0, 0.0, 1.0);
+ for (int i = 0; i < NUM_SAMPLES; ++i) {
+ vec2 tc = uv + (noise + samples[i].xy) * invertedViewportSize * max_radius;
+
+ /* decode_signed_coc return biggest coc. */
+ coc = abs(decode_signed_coc(texture(inputCocTex, tc).rg));
+
+ float lod = log2(clamp((coc + min(coc, max_radius)) * 0.5 - 21.0, 0.0, 16.0) * 0.25);
+ vec4 samp = textureLod(halfResColorTex, tc, lod);
+
+ float radius = samples[i].z * max_radius;
+ float weight = abs(coc) * smoothstep(radius - 0.5, radius + 0.5, abs(coc));
+
+ color += samp * weight;
+ tot += weight;
+ }
+
+ blurColor = color / tot;
+}
+#endif
+
+/**
+ * ----------------- STEP 3 ------------------
+ * 3x3 Median Filter
+ * Morgan McGuire and Kyle Whitson
+ * http://graphics.cs.williams.edu
+ *
+ *
+ * Copyright (c) Morgan McGuire and Williams College, 2006
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ **/
+#ifdef BLUR2
+out vec4 finalColor;
+
+void main()
+{
+ /* Half Res pass */
+ vec2 pixel_size = 1.0 / vec2(textureSize(blurTex, 0).xy);
+ vec2 uv = gl_FragCoord.xy * pixel_size.xy;
+ float coc = decode_coc(texture(inputCocTex, uv).rg);
+ /* Only use this filter if coc is > 9.0
+ * since this filter is not weighted by CoC
+ * and can bleed a bit. */
+ float rad = clamp(coc - 9.0, 0.0, 1.0);
+
+#define vec vec4
+#define toVec(x) x.rgba
+
+#define s2(a, b) temp = a; a = min(a, b); b = max(temp, b);
+#define mn3(a, b, c) s2(a, b); s2(a, c);
+#define mx3(a, b, c) s2(b, c); s2(a, c);
+
+#define mnmx3(a, b, c) mx3(a, b, c); s2(a, b); // 3 exchanges
+#define mnmx4(a, b, c, d) s2(a, b); s2(c, d); s2(a, c); s2(b, d); // 4 exchanges
+#define mnmx5(a, b, c, d, e) s2(a, b); s2(c, d); mn3(a, c, e); mx3(b, d, e); // 6 exchanges
+#define mnmx6(a, b, c, d, e, f) s2(a, d); s2(b, e); s2(c, f); mn3(a, b, c); mx3(d, e, f); // 7 exchanges
+
+ vec v[9];
+
+ /* Add the pixels which make up our window to the pixel array. */
+ for(int dX = -1; dX <= 1; ++dX) {
+ for(int dY = -1; dY <= 1; ++dY) {
+ vec2 offset = vec2(float(dX), float(dY));
+ /* If a pixel in the window is located at (x+dX, y+dY), put it at index (dX + R)(2R + 1) + (dY + R) of the
+ * pixel array. This will fill the pixel array, with the top left pixel of the window at pixel[0] and the
+ * bottom right pixel of the window at pixel[N-1]. */
+ v[(dX + 1) * 3 + (dY + 1)] = toVec(texture(blurTex, uv + offset * pixel_size * rad));
+ }
+ }
+
+ vec temp;
+
+ /* Starting with a subset of size 6, remove the min and max each time */
+ mnmx6(v[0], v[1], v[2], v[3], v[4], v[5]);
+ mnmx5(v[1], v[2], v[3], v[4], v[6]);
+ mnmx4(v[2], v[3], v[4], v[7]);
+ mnmx3(v[3], v[4], v[8]);
+ toVec(finalColor) = v[4];
+}
+
+#endif
+
+/**
+ * ----------------- STEP 4 ------------------
+ **/
+#ifdef RESOLVE
+out vec4 finalColor;
+
+void main()
+{
+ /* Fullscreen pass */
+ vec2 pixel_size = 0.5 / vec2(textureSize(halfResColorTex, 0).xy);
+ vec2 uv = gl_FragCoord.xy * pixel_size;
+
+ /* TODO MAKE SURE TO ALIGN SAMPLE POSITION TO AVOID OFFSET IN THE BOKEH */
+ float depth = texelFetch(sceneDepthTex, ivec2(gl_FragCoord.xy), 0).r;
+ float zdepth = linear_depth(depth);
+ float coc = calculate_coc(zdepth);
+
+ finalColor = texture(halfResColorTex, uv);
+ finalColor.a = smoothstep(1.0, 3.0, abs(coc));
+}
+#endif \ No newline at end of file
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_forward_composite_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_forward_composite_frag.glsl
index cb5516ca34f..b1f08cfef15 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_forward_composite_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_forward_composite_frag.glsl
@@ -5,10 +5,13 @@ uniform sampler2D transparentAccum;
uniform sampler2D transparentRevealage;
uniform vec2 invertedViewportSize;
+#ifndef ALPHA_COMPOSITE
layout(std140) uniform world_block {
WorldData world_data;
};
+#endif
+/* TODO: Bypass the whole shader if there is no xray pass and no outline pass. */
void main()
{
ivec2 texel = ivec2(gl_FragCoord.xy);
@@ -19,17 +22,21 @@ void main()
float trans_revealage = trans_accum.a;
trans_accum.a = texelFetch(transparentRevealage, texel, 0).r;
+ vec3 trans_color = trans_accum.rgb / clamp(trans_accum.a, 1e-4, 5e4);
+
+#ifndef ALPHA_COMPOSITE
vec3 bg_color = background_color(world_data, uv_viewport.y);
- /* TODO: Bypass the whole shader if there is no xray pass and no outline pass. */
- vec3 trans_color = trans_accum.rgb / clamp(trans_accum.a, 1e-4, 5e4);
vec3 color = mix(trans_color, bg_color, trans_revealage);
-#ifdef V3D_SHADING_OBJECT_OUTLINE
+# ifdef V3D_SHADING_OBJECT_OUTLINE
uint object_id = texelFetch(objectId, texel, 0).r;
float outline = calculate_object_outline(objectId, texel, object_id);
color = mix(world_data.object_outline_color.rgb, color, outline);
-#endif
+# endif
fragColor = vec4(color, 1.0);
+#else
+ fragColor = vec4(trans_color, 1.0 - trans_revealage);
+#endif
}
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl
index aed86937e0d..b3642b7beb3 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl
@@ -2,6 +2,7 @@
uniform float ImageTransparencyCutoff = 0.1;
uniform sampler2D image;
uniform bool imageSrgb;
+uniform bool imageNearest;
uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrixInverse;
@@ -13,6 +14,11 @@ uniform vec3 materialDiffuseColor;
uniform vec3 materialSpecularColor;
uniform float materialRoughness;
+uniform float shadowMultiplier = 0.5;
+uniform float lightMultiplier = 1.0;
+uniform float shadowShift = 0.1;
+uniform float shadowFocus = 1.0;
+
#ifdef NORMAL_VIEWPORT_PASS_ENABLED
in vec3 normal_viewport;
#endif /* NORMAL_VIEWPORT_PASS_ENABLED */
@@ -35,13 +41,10 @@ void main()
vec4 diffuse_color;
#ifdef V3D_SHADING_TEXTURE_COLOR
- diffuse_color = texture(image, uv_interp);
+ diffuse_color = workbench_sample_texture(image, uv_interp, imageSrgb, imageNearest);
if (diffuse_color.a < ImageTransparencyCutoff) {
discard;
}
- if (imageSrgb) {
- diffuse_color = srgb_to_linearrgb(diffuse_color);
- }
#else
diffuse_color = vec4(materialDiffuseColor, 1.0);
#endif /* V3D_SHADING_TEXTURE_COLOR */
@@ -69,6 +72,12 @@ void main()
nor, I_vs);
#endif
+#ifdef V3D_SHADING_SHADOW
+ float light_factor = -dot(nor, world_data.shadow_direction_vs.xyz);
+ float shadow_mix = smoothstep(shadowFocus, shadowShift, light_factor);
+ shaded_color *= mix(lightMultiplier, shadowMultiplier, shadow_mix);
+#endif
+
/* Based on :
* McGuire and Bavoil, Weighted Blended Order-Independent Transparency, Journal of
* Computer Graphics Techniques (JCGT), vol. 2, no. 2, 122–141, 2013
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
index 2ce816c6484..db51d3da15f 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
@@ -7,6 +7,7 @@ uniform float materialRoughness;
uniform sampler2D image;
uniform float ImageTransparencyCutoff = 0.1;
uniform bool imageSrgb;
+uniform bool imageNearest;
#ifdef NORMAL_VIEWPORT_PASS_ENABLED
in vec3 normal_viewport;
@@ -37,13 +38,10 @@ void main()
vec4 color;
# ifdef V3D_SHADING_TEXTURE_COLOR
- color = texture(image, uv_interp);
+ color = workbench_sample_texture(image, uv_interp, imageSrgb, imageNearest);
if (color.a < ImageTransparencyCutoff) {
discard;
}
- if (imageSrgb) {
- color = srgb_to_linearrgb(color);
- }
# else
color.rgb = materialDiffuseColor;
# endif
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
index 7c5b528c40d..66372f82b89 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
@@ -1,4 +1,5 @@
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
uniform mat4 ModelMatrixInverse;
uniform mat4 ProjectionMatrix;
uniform mat4 ViewProjectionMatrix;
@@ -68,4 +69,9 @@ void main()
normal_viewport = normalize(normal_viewport);
# endif
#endif
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
+
}
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl
index a2f23fbf3dc..00213260df0 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl
@@ -34,7 +34,7 @@ in VertexData {
vec4 backPosition;
} vData[];
-#define DEGENERATE_THRESHOLD 1e-12
+#define DEGENERATE_TRIS_WORKAROUND
#define len_sqr(a) dot(a, a)
@@ -58,14 +58,15 @@ void main()
vec3 n1 = cross(v12, v10);
vec3 n2 = cross(v13, v12);
-#ifdef DEGENERATE_THRESHOLD
+#ifdef DEGENERATE_TRIS_WORKAROUND
/* Check if area is null */
vec2 faces_area = vec2(len_sqr(n1), len_sqr(n2));
- bvec2 degen_faces = lessThan(abs(faces_area), vec2(DEGENERATE_THRESHOLD));
+ bvec2 degen_faces = equal(abs(faces_area), vec2(0.0));
/* Both triangles are degenerate, abort. */
- if (all(degen_faces))
+ if (all(degen_faces)) {
return;
+ }
#endif
vec2 facing = vec2(dot(n1, lightDirection),
@@ -76,7 +77,7 @@ void main()
bvec2 backface = greaterThan(facing, vec2(0.0));
-#ifdef DEGENERATE_THRESHOLD
+#ifdef DEGENERATE_TRIS_WORKAROUND
# ifndef DOUBLE_MANIFOLD
/* If the mesh is known to be manifold and we don't use double count,
* only create an quad if the we encounter a facing geom. */
@@ -92,8 +93,9 @@ void main()
#endif
/* If both faces face the same direction it's not an outline edge. */
- if (backface.x == backface.y)
+ if (backface.x == backface.y) {
return;
+ }
#ifdef USE_INVOC_EXT
if (gl_InvocationID == 0) {
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
index dbc29299fdc..8792c646ec1 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
@@ -26,7 +26,7 @@ void prep_specular(
/* Normalized Blinn shading */
vec4 blinn_specular(vec4 shininess, vec4 spec_angle, vec4 NL)
{
- /* Pi is already divided in the lamp power.
+ /* Pi is already divided in the light power.
* normalization_factor = (shininess + 8.0) / (8.0 * M_PI) */
vec4 normalization_factor = shininess * 0.125 + 1.0;
vec4 spec_light = pow(spec_angle, shininess) * NL * normalization_factor;
diff --git a/source/blender/draw/engines/workbench/solid_mode.c b/source/blender/draw/engines/workbench/solid_mode.c
index 19c8b4f18d1..4e69788457a 100644
--- a/source/blender/draw/engines/workbench/solid_mode.c
+++ b/source/blender/draw/engines/workbench/solid_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file solid_mode.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Simple engine for drawing color and/or depth.
* When we only need simple studio shaders.
diff --git a/source/blender/draw/engines/workbench/transparent_mode.c b/source/blender/draw/engines/workbench/transparent_mode.c
index 1d451a96419..c3b118d4660 100644
--- a/source/blender/draw/engines/workbench/transparent_mode.c
+++ b/source/blender/draw/engines/workbench/transparent_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file transparent_mode.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Simple engine for drawing color and/or depth.
* When we only need simple studio shaders.
diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c
index a4a449c1ee5..38b05133487 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -1,9 +1,33 @@
+/*
+ * 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.
+ *
+ * Copyright 2018, Blender Foundation.
+ */
+
+/** \file
+ * \ingroup draw_engine
+ */
+
#include "workbench_private.h"
#include "DNA_userdef_types.h"
#include "UI_resources.h"
+#include "GPU_batch.h"
+
void workbench_effect_info_init(WORKBENCH_EffectInfo *effect_info)
{
@@ -16,24 +40,27 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
const DRWContextState *draw_ctx = DRW_context_state_get();
const Scene *scene = draw_ctx->scene;
wpd->material_hash = BLI_ghash_ptr_new(__func__);
+ wpd->material_transp_hash = BLI_ghash_ptr_new(__func__);
wpd->preferences = &U;
View3D *v3d = draw_ctx->v3d;
if (!v3d) {
wpd->shading = scene->display.shading;
- wpd->use_color_view_settings = true;
+ wpd->use_color_render_settings = true;
}
else if (v3d->shading.type == OB_RENDER &&
BKE_scene_uses_blender_workbench(scene))
{
wpd->shading = scene->display.shading;
- wpd->use_color_view_settings = true;
+ wpd->use_color_render_settings = true;
}
else {
wpd->shading = v3d->shading;
- wpd->use_color_view_settings = false;
+ wpd->use_color_render_settings = false;
}
+ wpd->use_color_management = BKE_scene_check_color_management_enabled(scene);
+
if (wpd->shading.light == V3D_LIGHTING_MATCAP) {
wpd->studio_light = BKE_studiolight_find(
wpd->shading.matcap, STUDIOLIGHT_TYPE_MATCAP);
@@ -49,6 +76,12 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
wpd->shading.studio_light, STUDIOLIGHT_TYPE_STUDIO);
}
+
+ float shadow_focus = scene->display.shadow_focus;
+ /* Clamp to avoid overshadowing and shading errors. */
+ CLAMP(shadow_focus, 0.0001f, 0.99999f);
+ wpd->shadow_shift = scene->display.shadow_shift;
+ wpd->shadow_focus = 1.0f - shadow_focus * (1.0f - wpd->shadow_shift);
wpd->shadow_multiplier = 1.0 - wpd->shading.shadow_intensity;
WORKBENCH_UBO_World *wd = &wpd->world_data;
@@ -67,13 +100,19 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
copy_v3_v3(wd->background_color_high, v3d->shading.background_color);
}
else if (v3d) {
- UI_GetThemeColor3fv(UI_GetThemeValue(TH_SHOW_BACK_GRAD) ? TH_LOW_GRAD : TH_HIGH_GRAD, wd->background_color_low);
- UI_GetThemeColor3fv(TH_HIGH_GRAD, wd->background_color_high);
+ UI_GetThemeColor3fv(UI_GetThemeValue(TH_SHOW_BACK_GRAD) ? TH_BACK_GRAD : TH_BACK, wd->background_color_low);
+ UI_GetThemeColor3fv(TH_BACK, wd->background_color_high);
/* XXX: Really quick conversion to avoid washed out background.
* Needs to be addressed properly (color managed using ocio). */
- srgb_to_linearrgb_v3_v3(wd->background_color_high, wd->background_color_high);
- srgb_to_linearrgb_v3_v3(wd->background_color_low, wd->background_color_low);
+ if (wpd->use_color_management) {
+ srgb_to_linearrgb_v3_v3(wd->background_color_high, wd->background_color_high);
+ srgb_to_linearrgb_v3_v3(wd->background_color_low, wd->background_color_low);
+ }
+ else {
+ copy_v3_v3(wd->background_color_high, wd->background_color_high);
+ copy_v3_v3(wd->background_color_low, wd->background_color_low);
+ }
}
else {
zero_v3(wd->background_color_low);
@@ -88,6 +127,25 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
wd->curvature_ridge = 0.5f / max_ff(SQUARE(wpd->shading.curvature_ridge_factor), 1e-4f);
wd->curvature_valley = 0.7f / max_ff(SQUARE(wpd->shading.curvature_valley_factor), 1e-4f);
+ /* Will be NULL when rendering. */
+ if (draw_ctx->rv3d != NULL) {
+ RegionView3D *rv3d = draw_ctx->rv3d;
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ wpd->world_clip_planes = rv3d->clip;
+ DRW_state_clip_planes_set_from_rv3d(rv3d);
+ UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, wpd->world_clip_planes_color);
+ if (wpd->use_color_management) {
+ srgb_to_linearrgb_v3_v3(wpd->world_clip_planes_color, wpd->world_clip_planes_color);
+ }
+ else {
+ copy_v3_v3(wpd->world_clip_planes_color, wpd->world_clip_planes_color);
+ }
+ }
+ else {
+ wpd->world_clip_planes = NULL;
+ }
+ }
+
wpd->world_ubo = DRW_uniformbuffer_create(sizeof(WORKBENCH_UBO_World), &wpd->world_data);
/* Cavity settings */
@@ -101,7 +159,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
float viewvecs[3][4] = {
{-1.0f, -1.0f, -1.0f, 1.0f},
{1.0f, -1.0f, -1.0f, 1.0f},
- {-1.0f, 1.0f, -1.0f, 1.0f}
+ {-1.0f, 1.0f, -1.0f, 1.0f},
};
int i;
const float *size = DRW_viewport_size_get();
@@ -129,8 +187,9 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
/* normalized trick see:
* http://www.derschmale.com/2014/01/26/reconstructing-positions-from-the-depth-buffer */
mul_v3_fl(viewvecs[i], 1.0f / viewvecs[i][3]);
- if (is_persp)
+ if (is_persp) {
mul_v3_fl(viewvecs[i], 1.0f / viewvecs[i][2]);
+ }
viewvecs[i][3] = 1.0;
copy_v4_v4(wpd->viewvecs[i], viewvecs[i]);
@@ -175,5 +234,8 @@ void workbench_private_data_get_light_direction(WORKBENCH_PrivateData *wpd, floa
void workbench_private_data_free(WORKBENCH_PrivateData *wpd)
{
BLI_ghash_free(wpd->material_hash, NULL, MEM_freeN);
+ BLI_ghash_free(wpd->material_transp_hash, NULL, MEM_freeN);
DRW_UBO_FREE_SAFE(wpd->world_ubo);
+ DRW_UBO_FREE_SAFE(wpd->dof_ubo);
+ GPU_BATCH_DISCARD_SAFE(wpd->world_clip_planes_batch);
}
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index 2aa588802e7..f886b88828f 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,17 +13,15 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file workbench_deferred.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "workbench_private.h"
-#include "BIF_gl.h"
#include "BLI_alloca.h"
#include "BLI_dynstr.h"
@@ -33,7 +29,6 @@
#include "BLI_rand.h"
#include "BLI_string_utils.h"
-#include "BKE_node.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_particle.h"
@@ -43,7 +38,6 @@
#include "DNA_modifier_types.h"
#include "DNA_node_types.h"
-#include "ED_uvedit.h"
#include "GPU_shader.h"
#include "GPU_texture.h"
@@ -71,7 +65,11 @@ static struct {
struct GPUShader *shadow_pass_manifold_sh;
struct GPUShader *shadow_caps_sh;
struct GPUShader *shadow_caps_manifold_sh;
+ struct GPUShader *oit_resolve_sh;
+ /* TODO(fclem) move everything below to wpd and custom viewlayer data. */
+ struct GPUTexture *oit_accum_tx; /* ref only, not alloced */
+ struct GPUTexture *oit_revealage_tx; /* ref only, not alloced */
struct GPUTexture *ghost_depth_tx; /* ref only, not alloced */
struct GPUTexture *object_id_tx; /* ref only, not alloced */
struct GPUTexture *color_buffer_tx; /* ref only, not alloced */
@@ -90,10 +88,12 @@ static struct {
/* Shaders */
extern char datatoc_common_hair_lib_glsl[];
+extern char datatoc_gpu_shader_cfg_world_clip_lib_glsl[];
extern char datatoc_workbench_prepass_vert_glsl[];
extern char datatoc_workbench_prepass_frag_glsl[];
extern char datatoc_workbench_cavity_frag_glsl[];
+extern char datatoc_workbench_forward_composite_frag_glsl[];
extern char datatoc_workbench_deferred_composite_frag_glsl[];
extern char datatoc_workbench_deferred_background_frag_glsl[];
extern char datatoc_workbench_ghost_resolve_frag_glsl[];
@@ -159,12 +159,15 @@ static char *workbench_build_prepass_vert(bool is_hair)
{
char *str = NULL;
if (!is_hair) {
- return BLI_strdup(datatoc_workbench_prepass_vert_glsl);
+ return BLI_string_joinN(
+ datatoc_gpu_shader_cfg_world_clip_lib_glsl,
+ datatoc_workbench_prepass_vert_glsl);
}
DynStr *ds = BLI_dynstr_new();
BLI_dynstr_append(ds, datatoc_common_hair_lib_glsl);
+ BLI_dynstr_append(ds, datatoc_gpu_shader_cfg_world_clip_lib_glsl);
BLI_dynstr_append(ds, datatoc_workbench_prepass_vert_glsl);
str = BLI_dynstr_get_cstring(ds);
@@ -301,7 +304,7 @@ static float *create_disk_samples(int num_samples, int num_iterations)
static struct GPUTexture *create_jitter_texture(int num_samples)
{
- float jitter[64 * 64][3];
+ float jitter[64 * 64][4];
const float num_samples_inv = 1.0f / num_samples;
for (int i = 0; i < 64 * 64; i++) {
@@ -313,11 +316,12 @@ static struct GPUTexture *create_jitter_texture(int num_samples)
float bn = blue_noise[i][1] - 0.5f;
CLAMP(bn, -0.499f, 0.499f); /* fix fireflies */
jitter[i][2] = bn * num_samples_inv;
+ jitter[i][3] = blue_noise[i][1];
}
UNUSED_VARS(bsdf_split_sum_ggx, btdf_split_sum_ggx, ltc_mag_ggx, ltc_mat_ggx, ltc_disk_integral);
- return DRW_texture_create_2D(64, 64, GPU_RGB16F, DRW_TEX_FILTER | DRW_TEX_WRAP, &jitter[0][0]);
+ return DRW_texture_create_2D(64, 64, GPU_RGBA16F, DRW_TEX_FILTER | DRW_TEX_WRAP, &jitter[0][0]);
}
/* Functions */
@@ -329,6 +333,19 @@ static void workbench_init_object_data(DrawData *dd)
data->shadow_bbox_dirty = true;
}
+static void workbench_init_oit_framebuffer(WORKBENCH_FramebufferList *fbl, DefaultTextureList *dtxl)
+{
+ const float *size = DRW_viewport_size_get();
+ e_data.oit_accum_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_RGBA16F, &draw_engine_workbench_solid);
+ e_data.oit_revealage_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_R16F, &draw_engine_workbench_solid);
+
+ GPU_framebuffer_ensure_config(&fbl->transparent_accum_fb, {
+ GPU_ATTACHMENT_TEXTURE(dtxl->depth),
+ GPU_ATTACHMENT_TEXTURE(e_data.oit_accum_tx),
+ GPU_ATTACHMENT_TEXTURE(e_data.oit_revealage_tx),
+ });
+}
+
void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
{
WORKBENCH_FramebufferList *fbl = vedata->fbl;
@@ -336,6 +353,17 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
WORKBENCH_PassList *psl = vedata->psl;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
const DRWContextState *draw_ctx = DRW_context_state_get();
+ RegionView3D *rv3d = draw_ctx->rv3d;
+ View3D *v3d = draw_ctx->v3d;
+ Scene *scene = draw_ctx->scene;
+ Object *camera;
+
+ if (v3d && rv3d) {
+ camera = (rv3d->persp == RV3D_CAMOB) ? v3d->camera : NULL;
+ }
+ else {
+ camera = scene->camera;
+ }
if (!stl->g_data) {
/* Alloc transient pointers */
@@ -399,12 +427,25 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
WORKBENCH_PrivateData *wpd = stl->g_data;
workbench_private_data_init(wpd);
+ workbench_dof_engine_init(vedata, camera);
+
+ if (OIT_ENABLED(wpd)) {
+ if (e_data.oit_resolve_sh == NULL) {
+ e_data.oit_resolve_sh = DRW_shader_create_fullscreen(
+ datatoc_workbench_forward_composite_frag_glsl,
+ "#define ALPHA_COMPOSITE\n");
+ }
+
+ workbench_forward_choose_shaders(wpd);
+ workbench_forward_outline_shaders_ensure(wpd);
+ }
+
{
const float *viewport_size = DRW_viewport_size_get();
const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
- const GPUTextureFormat nor_tex_format = NORMAL_ENCODING_ENABLED() ? GPU_RG16 : GPU_RGBA32F;
- const GPUTextureFormat comp_tex_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_R11F_G11F_B10F;
- const GPUTextureFormat id_tex_format = OBJECT_ID_PASS_ENABLED(wpd) ? GPU_R32UI : GPU_R8;
+ const eGPUTextureFormat nor_tex_format = NORMAL_ENCODING_ENABLED() ? GPU_RG16 : GPU_RGBA32F;
+ const eGPUTextureFormat comp_tex_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_R11F_G11F_B10F;
+ const eGPUTextureFormat id_tex_format = OBJECT_ID_PASS_ENABLED(wpd) ? GPU_R32UI : GPU_R8;
e_data.object_id_tx = NULL;
e_data.color_buffer_tx = NULL;
@@ -441,7 +482,7 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
GPU_ATTACHMENT_TEXTURE(dtxl->depth),
GPU_ATTACHMENT_TEXTURE(e_data.composite_buffer_tx),
});
- GPU_framebuffer_ensure_config(&fbl->volume_fb, {
+ GPU_framebuffer_ensure_config(&fbl->color_only_fb, {
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(e_data.composite_buffer_tx),
});
@@ -464,7 +505,6 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
}
{
- Scene *scene = draw_ctx->scene;
/* AO Samples Tex */
int num_iterations = workbench_taa_calculate_num_iterations(vedata);
@@ -488,7 +528,7 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
/* Prepass */
{
DRWShadingGroup *grp;
- const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->shading.flag & V3D_SHADING_BACKFACE_CULLING));
+ const bool do_cull = CULL_BACKFACE_ENABLED(wpd);
int state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
psl->prepass_pass = DRW_pass_create("Prepass", (do_cull) ? state | DRW_STATE_CULL_BACK : state);
@@ -507,6 +547,10 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
workbench_aa_create_pass(vedata, &e_data.color_buffer_tx);
}
+ {
+ workbench_dof_create_pass(vedata, &e_data.composite_buffer_tx, e_data.jitter_tx);
+ }
+
if (CAVITY_ENABLED(wpd)) {
int state = DRW_STATE_WRITE_COLOR;
GPUShader *shader = workbench_cavity_shader_get(SSAO_ENABLED(wpd), CURVATURE_ENABLED(wpd));
@@ -566,6 +610,8 @@ void workbench_deferred_engine_free(void)
DRW_SHADER_FREE_SAFE(e_data.background_sh[0]);
DRW_SHADER_FREE_SAFE(e_data.background_sh[1]);
+ DRW_SHADER_FREE_SAFE(e_data.oit_resolve_sh);
+
DRW_SHADER_FREE_SAFE(e_data.shadow_pass_sh);
DRW_SHADER_FREE_SAFE(e_data.shadow_pass_manifold_sh);
DRW_SHADER_FREE_SAFE(e_data.shadow_fail_sh);
@@ -576,6 +622,7 @@ void workbench_deferred_engine_free(void)
workbench_volume_engine_free();
workbench_fxaa_engine_free();
workbench_taa_engine_free();
+ workbench_dof_engine_free();
}
static void workbench_composite_uniforms(WORKBENCH_PrivateData *wpd, DRWShadingGroup *grp)
@@ -633,6 +680,14 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata)
DRW_shgroup_uniform_texture_ref(grp, "objectId", &e_data.object_id_tx);
}
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
+
+ if (draw_ctx->rv3d && (draw_ctx->rv3d->rflag & RV3D_CLIPPING) && draw_ctx->rv3d->clipbb) {
+ GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND);
+ grp = DRW_shgroup_create(shader, psl->background_pass);
+ wpd->world_clip_planes_batch = DRW_draw_background_clipping_batch_from_rv3d(draw_ctx->rv3d);
+ DRW_shgroup_call_add(grp, wpd->world_clip_planes_batch, NULL);
+ DRW_shgroup_uniform_vec4(grp, "color", &wpd->world_clip_planes_color[0], 1);
+ }
}
/* Deferred Mix Pass */
@@ -640,11 +695,6 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata)
workbench_private_data_get_light_direction(wpd, e_data.display.light_direction);
studiolight_update_light(wpd, e_data.display.light_direction);
- float shadow_focus = scene->display.shadow_focus;
- /* Clamp to avoid overshadowing and shading errors. */
- CLAMP(shadow_focus, 0.0001f, 0.99999f);
- shadow_focus = 1.0f - shadow_focus * (1.0f - scene->display.shadow_shift);
-
if (SHADOW_ENABLED(wpd)) {
psl->composite_pass = DRW_pass_create(
"Composite", DRW_STATE_WRITE_COLOR | DRW_STATE_STENCIL_EQUAL | DRW_STATE_DEPTH_GREATER);
@@ -654,7 +704,7 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata)
DRW_shgroup_uniform_float_copy(grp, "lightMultiplier", 1.0f);
DRW_shgroup_uniform_float(grp, "shadowMultiplier", &wpd->shadow_multiplier, 1);
DRW_shgroup_uniform_float_copy(grp, "shadowShift", scene->display.shadow_shift);
- DRW_shgroup_uniform_float_copy(grp, "shadowFocus", shadow_focus);
+ DRW_shgroup_uniform_float_copy(grp, "shadowFocus", wpd->shadow_focus);
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
/* Stencil Shadow passes. */
@@ -694,7 +744,7 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata)
DRW_shgroup_uniform_float(grp, "lightMultiplier", &wpd->shadow_multiplier, 1);
DRW_shgroup_uniform_float(grp, "shadowMultiplier", &wpd->shadow_multiplier, 1);
DRW_shgroup_uniform_float_copy(grp, "shadowShift", scene->display.shadow_shift);
- DRW_shgroup_uniform_float_copy(grp, "shadowFocus", shadow_focus);
+ DRW_shgroup_uniform_float_copy(grp, "shadowFocus", wpd->shadow_focus);
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
#endif
}
@@ -706,10 +756,44 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata)
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
}
}
+
+ /**
+ * Order Independant Transparency.
+ * Similar to workbench forward. Duplicated code to avoid
+ * spaghetti with workbench forward. It would be great if we unify
+ * this in a clean way.
+ **/
+ if (OIT_ENABLED(wpd)) {
+ const bool do_cull = CULL_BACKFACE_ENABLED(wpd);
+ const int cull_state = (do_cull) ? DRW_STATE_CULL_BACK : 0;
+ /* Transparency Accum */
+ {
+ /* Same as forward but here we use depth test to
+ * not bleed through other solid objects. */
+ int state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_OIT | DRW_STATE_DEPTH_LESS | cull_state;
+ psl->transparent_accum_pass = DRW_pass_create("Transparent Accum", state);
+ }
+ /* Depth */
+ {
+ int state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | cull_state;
+ psl->object_outline_pass = DRW_pass_create("Transparent Depth", state);
+ }
+ /* OIT Composite */
+ {
+ int state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND;
+ psl->oit_composite_pass = DRW_pass_create("OIT Composite", state);
+
+ grp = DRW_shgroup_create(e_data.oit_resolve_sh, psl->oit_composite_pass);
+ DRW_shgroup_uniform_texture_ref(grp, "transparentAccum", &e_data.oit_accum_tx);
+ DRW_shgroup_uniform_texture_ref(grp, "transparentRevealage", &e_data.oit_revealage_tx);
+ DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
+ DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
+ }
+ }
}
static WORKBENCH_MaterialData *get_or_create_material_data(
- WORKBENCH_Data *vedata, Object *ob, Material *mat, Image *ima, int color_type)
+ WORKBENCH_Data *vedata, Object *ob, Material *mat, Image *ima, int color_type, int interp)
{
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PassList *psl = vedata->psl;
@@ -725,6 +809,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
material_template.object_id = OBJECT_ID_PASS_ENABLED(wpd) ? engine_object_data->object_id : 1;
material_template.color_type = color_type;
material_template.ima = ima;
+ material_template.interp = interp;
uint hash = workbench_material_get_hash(&material_template, is_ghost);
material = BLI_ghash_lookup(wpd->material_hash, POINTER_FROM_UINT(hash));
@@ -736,8 +821,12 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
workbench_material_copy(material, &material_template);
DRW_shgroup_stencil_mask(material->shgrp, (ob->dtx & OB_DRAWXRAY) ? 0x00 : 0xFF);
DRW_shgroup_uniform_int(material->shgrp, "object_id", &material->object_id, 1);
- workbench_material_shgroup_uniform(wpd, material->shgrp, material, ob, true, true);
-
+ workbench_material_shgroup_uniform(wpd, material->shgrp, material, ob, true, true, interp);
+ if (wpd->world_clip_planes) {
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ RegionView3D *rv3d = draw_ctx->rv3d;
+ DRW_shgroup_world_clip_planes_from_rv3d(material->shgrp, rv3d);
+ }
BLI_ghash_insert(wpd->material_hash, POINTER_FROM_UINT(hash), material);
}
return material;
@@ -764,11 +853,12 @@ static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, Object *o
const int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as;
if (draw_as == PART_DRAW_PATH) {
- Image *image = NULL;
- Material *mat = give_current_material(ob, part->omat);
- ED_object_get_active_image(ob, part->omat, &image, NULL, NULL, NULL);
+ Material *mat;
+ Image *image;
+ int interp;
+ workbench_material_get_image_and_mat(ob, part->omat, &image, &interp, &mat);
int color_type = workbench_material_determine_color_type(wpd, image, ob);
- WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, ob, mat, image, color_type);
+ WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, ob, mat, image, color_type, interp);
struct GPUShader *shader = (color_type != V3D_SHADING_TEXTURE_COLOR) ?
wpd->prepass_solid_hair_sh :
@@ -779,7 +869,7 @@ static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, Object *o
shader);
DRW_shgroup_stencil_mask(shgrp, (ob->dtx & OB_DRAWXRAY) ? 0x00 : 0xFF);
DRW_shgroup_uniform_int(shgrp, "object_id", &material->object_id, 1);
- workbench_material_shgroup_uniform(wpd, shgrp, material, ob, true, true);
+ workbench_material_shgroup_uniform(wpd, shgrp, material, ob, true, true, interp);
}
}
}
@@ -792,15 +882,16 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
- if (!DRW_object_is_renderable(ob))
+ if (!DRW_object_is_renderable(ob)) {
return;
+ }
if (ob->type == OB_MESH) {
workbench_cache_populate_particles(vedata, ob);
}
ModifierData *md;
- if (((ob->base_flag & BASE_FROMDUPLI) == 0) &&
+ if (((ob->base_flag & BASE_FROM_DUPLI) == 0) &&
(md = modifiers_findByType(ob, eModifierType_Smoke)) &&
(modifier_isEnabled(scene, md, eModifierMode_Realtime)) &&
(((SmokeModifierData *)md)->domain != NULL))
@@ -823,17 +914,19 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
const bool use_hide = is_active && DRW_object_use_hide_faces(ob);
const int materials_len = MAX2(1, (is_sculpt_mode ? 1 : ob->totcol));
const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL;
+ bool has_transp_mat = false;
if (!is_sculpt_mode && me && me->mloopuv && TEXTURE_DRAWING_ENABLED(wpd)) {
/* Draw textured */
struct GPUBatch **geom_array = DRW_cache_mesh_surface_texpaint_get(ob);
for (int i = 0; i < materials_len; i++) {
if (geom_array != NULL && geom_array[i] != NULL) {
- Material *mat = give_current_material(ob, i + 1);
+ Material *mat;
Image *image;
- ED_object_get_active_image(ob, i + 1, &image, NULL, NULL, NULL);
+ int interp;
+ workbench_material_get_image_and_mat(ob, i + 1, &image, &interp, &mat);
int color_type = workbench_material_determine_color_type(wpd, image, ob);
- material = get_or_create_material_data(vedata, ob, mat, image, color_type);
+ material = get_or_create_material_data(vedata, ob, mat, image, color_type, interp);
DRW_shgroup_call_object_add(material->shgrp, geom_array[i], ob);
}
}
@@ -841,8 +934,18 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
else if (ELEM(wpd->shading.color_type,
V3D_SHADING_SINGLE_COLOR, V3D_SHADING_OBJECT_COLOR, V3D_SHADING_RANDOM_COLOR))
{
- /* Draw solid color */
- material = get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type);
+ if ((ob->color[3] < 1.0f) &&
+ (wpd->shading.color_type == V3D_SHADING_OBJECT_COLOR))
+ {
+ /* Hack */
+ wpd->shading.xray_alpha = ob->color[3];
+ material = workbench_forward_get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type, 0);
+ has_transp_mat = true;
+ }
+ else {
+ /* Draw solid color */
+ material = get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type, 0);
+ }
if (is_sculpt_mode) {
DRW_shgroup_call_sculpt_add(material->shgrp, ob, ob->obmat);
}
@@ -858,7 +961,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
if (is_sculpt_mode) {
/* Multiple materials are not supported in sculpt mode yet. */
Material *mat = give_current_material(ob, 1);
- material = get_or_create_material_data(vedata, ob, mat, NULL, V3D_SHADING_MATERIAL_COLOR);
+ material = get_or_create_material_data(vedata, ob, mat, NULL, V3D_SHADING_MATERIAL_COLOR, 0);
DRW_shgroup_call_sculpt_add(material->shgrp, ob, ob->obmat);
}
else {
@@ -870,14 +973,22 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
for (int i = 0; i < materials_len; ++i) {
if (geoms != NULL && geoms[i] != NULL) {
Material *mat = give_current_material(ob, i + 1);
- material = get_or_create_material_data(vedata, ob, mat, NULL, V3D_SHADING_MATERIAL_COLOR);
+ if (mat != NULL && mat->a < 1.0f) {
+ /* Hack */
+ wpd->shading.xray_alpha = mat->a;
+ material = workbench_forward_get_or_create_material_data(vedata, ob, mat, NULL, V3D_SHADING_MATERIAL_COLOR, 0);
+ has_transp_mat = true;
+ }
+ else {
+ material = get_or_create_material_data(vedata, ob, mat, NULL, V3D_SHADING_MATERIAL_COLOR, 0);
+ }
DRW_shgroup_call_object_add(material->shgrp, geoms[i], ob);
}
}
}
}
- if (SHADOW_ENABLED(wpd) && (ob->display.flag & OB_SHOW_SHADOW)) {
+ if (SHADOW_ENABLED(wpd) && !(ob->dtx & OB_DRAW_NO_SHADOW_CAST)) {
bool is_manifold;
struct GPUBatch *geom_shadow = DRW_cache_object_edge_detection_get(ob, &is_manifold);
if (geom_shadow) {
@@ -899,7 +1010,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
DRWShadingGroup *grp;
bool use_shadow_pass_technique = !studiolight_camera_in_object_shadow(wpd, ob, engine_object_data);
- if (use_shadow_pass_technique) {
+ if (use_shadow_pass_technique && !has_transp_mat) {
if (is_manifold) {
grp = DRW_shgroup_create(e_data.shadow_pass_manifold_sh, psl->shadow_depth_pass_mani_pass);
}
@@ -1065,11 +1176,26 @@ void workbench_deferred_draw_scene(WORKBENCH_Data *vedata)
GPU_framebuffer_bind(fbl->composite_fb);
DRW_draw_pass(psl->background_pass);
+ if (OIT_ENABLED(wpd) && !DRW_pass_is_empty(psl->transparent_accum_pass)) {
+ DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
+ /* meh, late init to not request buffers we won't use. */
+ workbench_init_oit_framebuffer(fbl, dtxl);
+
+ const float clear_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+ GPU_framebuffer_bind(fbl->transparent_accum_fb);
+ GPU_framebuffer_clear_color(fbl->transparent_accum_fb, clear_color);
+ DRW_draw_pass(psl->transparent_accum_pass);
+
+ GPU_framebuffer_bind(fbl->composite_fb);
+ DRW_draw_pass(psl->oit_composite_pass);
+ }
+
if (wpd->volumes_do) {
- GPU_framebuffer_bind(fbl->volume_fb);
+ GPU_framebuffer_bind(fbl->color_only_fb);
DRW_draw_pass(psl->volume_pass);
}
+ workbench_dof_draw_pass(vedata);
workbench_aa_draw_pass(vedata, e_data.composite_buffer_tx);
}
@@ -1078,6 +1204,7 @@ void workbench_deferred_draw_finish(WORKBENCH_Data *vedata)
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PrivateData *wpd = stl->g_data;
+ /* XXX TODO(fclem) do not discard UBOS after drawing! Store them per viewport. */
workbench_private_data_free(wpd);
workbench_volume_smoke_textures_free(wpd);
}
diff --git a/source/blender/draw/engines/workbench/workbench_effect_aa.c b/source/blender/draw/engines/workbench/workbench_effect_aa.c
index deb9a517f96..226f1746e50 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_aa.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_aa.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file workbench_effect_aa.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "ED_screen.h"
@@ -64,7 +61,7 @@ static void workspace_aa_draw_transform(GPUTexture *tx, WORKBENCH_PrivateData *w
}
else {
/* Display space result for viewport. */
- DRW_transform_to_display(tx, wpd->use_color_view_settings);
+ DRW_transform_to_display(tx, wpd->use_color_render_settings, wpd->use_color_render_settings);
}
}
diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c
new file mode 100644
index 00000000000..b12aa5f90bc
--- /dev/null
+++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c
@@ -0,0 +1,434 @@
+/*
+ * 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.
+ *
+ * Copyright 2016, Blender Foundation.
+ */
+
+/** \file
+ * \ingroup draw_engine
+ */
+
+#include "workbench_private.h"
+
+#include "BKE_camera.h"
+#include "DEG_depsgraph_query.h"
+
+#include "DNA_camera_types.h"
+
+/* *********** STATIC *********** */
+static struct {
+ struct GPUShader *effect_dof_prepare_sh;
+ struct GPUShader *effect_dof_downsample_sh;
+ struct GPUShader *effect_dof_flatten_v_sh;
+ struct GPUShader *effect_dof_flatten_h_sh;
+ struct GPUShader *effect_dof_dilate_v_sh;
+ struct GPUShader *effect_dof_dilate_h_sh;
+ struct GPUShader *effect_dof_blur1_sh;
+ struct GPUShader *effect_dof_blur2_sh;
+ struct GPUShader *effect_dof_resolve_sh;
+} e_data = {NULL};
+
+/* Shaders */
+extern char datatoc_workbench_effect_dof_frag_glsl[];
+
+/* *********** Functions *********** */
+
+/**
+ * Transform [-1..1] square to unit circle.
+ **/
+static void square_to_circle(float x, float y, float *r, float *T)
+{
+ if (x > -y) {
+ if (x > y) {
+ *r = x;
+ *T = (M_PI / 4.0f) * (y / x);
+ }
+ else {
+ *r = y;
+ *T = (M_PI / 4.0f) * (2 - (x / y));
+ }
+ }
+ else {
+ if (x < y) {
+ *r = -x;
+ *T = (M_PI / 4.0f) * (4 + (y / x));
+ }
+ else {
+ *r = -y;
+ if (y != 0) {
+ *T = (M_PI / 4.0f) * (6 - (x / y));
+ }
+ else {
+ *T = 0.0f;
+ }
+ }
+ }
+}
+
+#define KERNEL_RAD 3
+#define SAMP_LEN SQUARE(KERNEL_RAD * 2 + 1)
+
+static void workbench_dof_setup_samples(
+ struct GPUUniformBuffer **ubo, float **data,
+ float bokeh_sides, float bokeh_rotation, float bokeh_ratio)
+{
+ if (*data == NULL) {
+ *data = MEM_callocN(sizeof(float) * 4 * SAMP_LEN, "workbench dof samples");
+ }
+ if (*ubo == NULL) {
+ *ubo = DRW_uniformbuffer_create(sizeof(float) * 4 * SAMP_LEN, NULL);
+ }
+
+ float *samp = *data;
+ for (int i = 0; i <= KERNEL_RAD; ++i) {
+ for (int j = -KERNEL_RAD; j <= KERNEL_RAD; ++j) {
+ for (int k = -KERNEL_RAD; k <= KERNEL_RAD; ++k) {
+ if (abs(j) > i || abs(k) > i) {
+ continue;
+ }
+ if (abs(j) < i && abs(k) < i) {
+ continue;
+ }
+ float x = ((float)j) / KERNEL_RAD;
+ float y = ((float)k) / KERNEL_RAD;
+
+ float r, T;
+ square_to_circle(x, y, &r, &T);
+ samp[2] = r;
+
+ /* Bokeh shape parametrisation */
+ if (bokeh_sides > 1.0f) {
+ float denom = T - (2.0 * M_PI / bokeh_sides) * floorf((bokeh_sides * T + M_PI) / (2.0 * M_PI));
+ r *= cosf(M_PI / bokeh_sides) / cosf(denom);
+ }
+
+ T += bokeh_rotation;
+
+ samp[0] = r * cosf(T) * bokeh_ratio;
+ samp[1] = r * sinf(T);
+ samp += 4;
+ }
+ }
+ }
+
+ DRW_uniformbuffer_update(*ubo, *data);
+}
+
+void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera)
+{
+ WORKBENCH_TextureList *txl = vedata->txl;
+ WORKBENCH_StorageList *stl = vedata->stl;
+ WORKBENCH_PrivateData *wpd = stl->g_data;
+ WORKBENCH_FramebufferList *fbl = vedata->fbl;
+
+ if ((wpd->shading.flag & V3D_SHADING_DEPTH_OF_FIELD) == 0 ||
+ (camera == NULL))
+ {
+ wpd->dof_enabled = false;
+ return;
+ }
+
+ if (e_data.effect_dof_prepare_sh == NULL) {
+ e_data.effect_dof_prepare_sh = DRW_shader_create_fullscreen(
+ datatoc_workbench_effect_dof_frag_glsl,
+ "#define PREPARE\n");
+
+ e_data.effect_dof_downsample_sh = DRW_shader_create_fullscreen(
+ datatoc_workbench_effect_dof_frag_glsl,
+ "#define DOWNSAMPLE\n");
+
+ e_data.effect_dof_flatten_v_sh = DRW_shader_create_fullscreen(
+ datatoc_workbench_effect_dof_frag_glsl,
+ "#define FLATTEN_VERTICAL\n");
+
+ e_data.effect_dof_flatten_h_sh = DRW_shader_create_fullscreen(
+ datatoc_workbench_effect_dof_frag_glsl,
+ "#define FLATTEN_HORIZONTAL\n");
+
+ e_data.effect_dof_dilate_v_sh = DRW_shader_create_fullscreen(
+ datatoc_workbench_effect_dof_frag_glsl,
+ "#define DILATE_VERTICAL\n");
+
+ e_data.effect_dof_dilate_h_sh = DRW_shader_create_fullscreen(
+ datatoc_workbench_effect_dof_frag_glsl,
+ "#define DILATE_HORIZONTAL\n");
+
+ e_data.effect_dof_blur1_sh = DRW_shader_create_fullscreen(
+ datatoc_workbench_effect_dof_frag_glsl,
+ "#define BLUR1\n");
+
+ e_data.effect_dof_blur2_sh = DRW_shader_create_fullscreen(
+ datatoc_workbench_effect_dof_frag_glsl,
+ "#define BLUR2\n");
+
+ e_data.effect_dof_resolve_sh = DRW_shader_create_fullscreen(
+ datatoc_workbench_effect_dof_frag_glsl,
+ "#define RESOLVE\n");
+ }
+
+ const float *full_size = DRW_viewport_size_get();
+ int size[2] = {full_size[0] / 2, full_size[1] / 2};
+#if 0
+ /* NOTE: We Ceil here in order to not miss any edge texel if using a NPO2 texture. */
+ int shrink_h_size[2] = {ceilf(size[0] / 8.0f), size[1]};
+ int shrink_w_size[2] = {shrink_h_size[0], ceilf(size[1] / 8.0f)};
+#endif
+
+ DRW_texture_ensure_2D(&txl->dof_source_tx, size[0], size[1], GPU_R11F_G11F_B10F, DRW_TEX_FILTER | DRW_TEX_MIPMAP);
+ DRW_texture_ensure_2D(&txl->coc_halfres_tx, size[0], size[1], GPU_RG8, DRW_TEX_FILTER | DRW_TEX_MIPMAP);
+ wpd->dof_blur_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_R11F_G11F_B10F, &draw_engine_workbench_solid);
+#if 0
+ wpd->coc_temp_tx = DRW_texture_pool_query_2D(shrink_h_size[0], shrink_h_size[1], GPU_RG8, &draw_engine_workbench_solid);
+ wpd->coc_tiles_tx[0] = DRW_texture_pool_query_2D(shrink_w_size[0], shrink_w_size[1], GPU_RG8, &draw_engine_workbench_solid);
+ wpd->coc_tiles_tx[1] = DRW_texture_pool_query_2D(shrink_w_size[0], shrink_w_size[1], GPU_RG8, &draw_engine_workbench_solid);
+#endif
+
+ GPU_framebuffer_ensure_config(&fbl->dof_downsample_fb, {
+ GPU_ATTACHMENT_NONE,
+ GPU_ATTACHMENT_TEXTURE(txl->dof_source_tx),
+ GPU_ATTACHMENT_TEXTURE(txl->coc_halfres_tx),
+ });
+#if 0
+ GPU_framebuffer_ensure_config(&fbl->dof_coc_tile_h_fb, {
+ GPU_ATTACHMENT_NONE,
+ GPU_ATTACHMENT_TEXTURE(wpd->coc_temp_tx),
+ });
+ GPU_framebuffer_ensure_config(&fbl->dof_coc_tile_v_fb, {
+ GPU_ATTACHMENT_NONE,
+ GPU_ATTACHMENT_TEXTURE(wpd->coc_tiles_tx[0]),
+ });
+ GPU_framebuffer_ensure_config(&fbl->dof_coc_dilate_fb, {
+ GPU_ATTACHMENT_NONE,
+ GPU_ATTACHMENT_TEXTURE(wpd->coc_tiles_tx[1]),
+ });
+#endif
+ GPU_framebuffer_ensure_config(&fbl->dof_blur1_fb, {
+ GPU_ATTACHMENT_NONE,
+ GPU_ATTACHMENT_TEXTURE(wpd->dof_blur_tx),
+ });
+ GPU_framebuffer_ensure_config(&fbl->dof_blur2_fb, {
+ GPU_ATTACHMENT_NONE,
+ GPU_ATTACHMENT_TEXTURE(txl->dof_source_tx),
+ });
+
+ {
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
+ RegionView3D *rv3d = draw_ctx->rv3d;
+ Camera *cam = (Camera *)camera->data;
+
+ /* Parameters */
+ /* TODO UI Options */
+ float fstop = cam->gpu_dof.fstop;
+ float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
+ float focus_dist = BKE_camera_object_dof_distance(camera);
+ float focal_len = cam->lens;
+
+ /* TODO(fclem) deduplicate with eevee */
+
+ /* this is factor that converts to the scene scale. focal length and sensor are expressed in mm
+ * unit.scale_length is how many meters per blender unit we have. We want to convert to blender units though
+ * because the shader reads coordinates in world space, which is in blender units.
+ * Note however that focus_distance is already in blender units and shall not be scaled here (see T48157). */
+ float scale = (scene_eval->unit.system) ? scene_eval->unit.scale_length : 1.0f;
+ float scale_camera = 0.001f / scale;
+ /* we want radius here for the aperture number */
+ float aperture = 0.5f * scale_camera * focal_len / fstop;
+ float focal_len_scaled = scale_camera * focal_len;
+ float sensor_scaled = scale_camera * sensor;
+
+ if (rv3d != NULL) {
+ sensor_scaled *= rv3d->viewcamtexcofac[0];
+ }
+
+ wpd->dof_aperturesize = aperture * fabsf(focal_len_scaled / (focus_dist - focal_len_scaled));
+ wpd->dof_distance = -focus_dist;
+ wpd->dof_invsensorsize = full_size[0] / sensor_scaled;
+
+ wpd->dof_near_far[0] = -cam->clip_start;
+ wpd->dof_near_far[1] = -cam->clip_end;
+
+ float blades = cam->gpu_dof.num_blades;
+ float rotation = cam->gpu_dof.rotation;
+ float ratio = 1.0f / cam->gpu_dof.ratio;
+
+ if (wpd->dof_ubo == NULL ||
+ blades != wpd->dof_blades ||
+ rotation != wpd->dof_rotation ||
+ ratio != wpd->dof_ratio)
+ {
+ wpd->dof_blades = blades;
+ wpd->dof_rotation = rotation;
+ wpd->dof_ratio = ratio;
+ workbench_dof_setup_samples(&wpd->dof_ubo, &stl->dof_ubo_data, blades, rotation, ratio);
+ }
+ }
+
+ wpd->dof_enabled = true;
+}
+
+void workbench_dof_create_pass(WORKBENCH_Data *vedata, GPUTexture **dof_input, GPUTexture *noise_tex)
+{
+ WORKBENCH_PassList *psl = vedata->psl;
+ WORKBENCH_TextureList *txl = vedata->txl;
+ WORKBENCH_StorageList *stl = vedata->stl;
+ WORKBENCH_PrivateData *wpd = stl->g_data;
+ struct GPUBatch *quad = DRW_cache_fullscreen_quad_get();
+
+ if (!wpd->dof_enabled) {
+ return;
+ }
+
+ DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
+
+ psl->dof_down_ps = DRW_pass_create("DoF DownSample", DRW_STATE_WRITE_COLOR);
+ psl->dof_down2_ps = DRW_pass_create("DoF DownSample", DRW_STATE_WRITE_COLOR);
+ psl->dof_flatten_h_ps = DRW_pass_create("DoF Flatten Coc H", DRW_STATE_WRITE_COLOR);
+ psl->dof_flatten_v_ps = DRW_pass_create("DoF Flatten Coc V", DRW_STATE_WRITE_COLOR);
+ psl->dof_dilate_h_ps = DRW_pass_create("DoF Dilate Coc H", DRW_STATE_WRITE_COLOR);
+ psl->dof_dilate_v_ps = DRW_pass_create("DoF Dilate Coc V", DRW_STATE_WRITE_COLOR);
+ psl->dof_blur1_ps = DRW_pass_create("DoF Blur 1", DRW_STATE_WRITE_COLOR);
+ psl->dof_blur2_ps = DRW_pass_create("DoF Blur 2", DRW_STATE_WRITE_COLOR);
+ psl->dof_resolve_ps = DRW_pass_create("DoF Resolve", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND);
+
+ {
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_dof_prepare_sh, psl->dof_down_ps);
+ DRW_shgroup_uniform_texture_ref(grp, "sceneColorTex", dof_input);
+ DRW_shgroup_uniform_texture(grp, "sceneDepthTex", dtxl->depth);
+ DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
+ DRW_shgroup_uniform_vec3(grp, "dofParams", &wpd->dof_aperturesize, 1);
+ DRW_shgroup_uniform_vec2(grp, "nearFar", wpd->dof_near_far, 1);
+ DRW_shgroup_call_add(grp, quad, NULL);
+ }
+
+ {
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_dof_downsample_sh, psl->dof_down2_ps);
+ DRW_shgroup_uniform_texture(grp, "sceneColorTex", txl->dof_source_tx);
+ DRW_shgroup_uniform_texture(grp, "inputCocTex", txl->coc_halfres_tx);
+ DRW_shgroup_call_add(grp, quad, NULL);
+ }
+#if 0
+ {
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_dof_flatten_h_sh, psl->dof_flatten_h_ps);
+ DRW_shgroup_uniform_texture(grp, "inputCocTex", txl->coc_halfres_tx);
+ DRW_shgroup_call_add(grp, quad, NULL);
+ }
+ {
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_dof_flatten_v_sh, psl->dof_flatten_v_ps);
+ DRW_shgroup_uniform_texture(grp, "inputCocTex", wpd->coc_temp_tx);
+ DRW_shgroup_call_add(grp, quad, NULL);
+ }
+ {
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_dof_dilate_v_sh, psl->dof_dilate_v_ps);
+ DRW_shgroup_uniform_texture(grp, "inputCocTex", wpd->coc_tiles_tx[0]);
+ DRW_shgroup_call_add(grp, quad, NULL);
+ }
+ {
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_dof_dilate_h_sh, psl->dof_dilate_h_ps);
+ DRW_shgroup_uniform_texture(grp, "inputCocTex", wpd->coc_tiles_tx[1]);
+ DRW_shgroup_call_add(grp, quad, NULL);
+ }
+#endif
+ {
+ float offset = stl->effects->jitter_index / (float)workbench_taa_calculate_num_iterations(vedata);
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_dof_blur1_sh, psl->dof_blur1_ps);
+ DRW_shgroup_uniform_block(grp, "dofSamplesBlock", wpd->dof_ubo);
+ DRW_shgroup_uniform_texture(grp, "noiseTex", noise_tex);
+ DRW_shgroup_uniform_texture(grp, "inputCocTex", txl->coc_halfres_tx);
+ DRW_shgroup_uniform_texture(grp, "halfResColorTex", txl->dof_source_tx);
+ DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
+ DRW_shgroup_uniform_float_copy(grp, "noiseOffset", offset);
+ DRW_shgroup_call_add(grp, quad, NULL);
+ }
+ {
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_dof_blur2_sh, psl->dof_blur2_ps);
+ DRW_shgroup_uniform_texture(grp, "inputCocTex", txl->coc_halfres_tx);
+ DRW_shgroup_uniform_texture(grp, "blurTex", wpd->dof_blur_tx);
+ DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
+ DRW_shgroup_call_add(grp, quad, NULL);
+ }
+ {
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_dof_resolve_sh, psl->dof_resolve_ps);
+ DRW_shgroup_uniform_texture(grp, "halfResColorTex", txl->dof_source_tx);
+ DRW_shgroup_uniform_texture(grp, "sceneDepthTex", dtxl->depth);
+ DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
+ DRW_shgroup_uniform_vec3(grp, "dofParams", &wpd->dof_aperturesize, 1);
+ DRW_shgroup_uniform_vec2(grp, "nearFar", wpd->dof_near_far, 1);
+ DRW_shgroup_call_add(grp, quad, NULL);
+ }
+}
+
+void workbench_dof_engine_free(void)
+{
+ DRW_SHADER_FREE_SAFE(e_data.effect_dof_prepare_sh);
+ DRW_SHADER_FREE_SAFE(e_data.effect_dof_downsample_sh);
+ DRW_SHADER_FREE_SAFE(e_data.effect_dof_flatten_v_sh);
+ DRW_SHADER_FREE_SAFE(e_data.effect_dof_flatten_h_sh);
+ DRW_SHADER_FREE_SAFE(e_data.effect_dof_dilate_v_sh);
+ DRW_SHADER_FREE_SAFE(e_data.effect_dof_dilate_h_sh);
+ DRW_SHADER_FREE_SAFE(e_data.effect_dof_blur1_sh);
+ DRW_SHADER_FREE_SAFE(e_data.effect_dof_blur2_sh);
+ DRW_SHADER_FREE_SAFE(e_data.effect_dof_resolve_sh);
+}
+
+static void workbench_dof_downsample_level(void *userData, int UNUSED(level))
+{
+ WORKBENCH_PassList *psl = (WORKBENCH_PassList *)userData;
+ DRW_draw_pass(psl->dof_down2_ps);
+}
+
+void workbench_dof_draw_pass(WORKBENCH_Data *vedata)
+{
+ WORKBENCH_FramebufferList *fbl = vedata->fbl;
+ WORKBENCH_StorageList *stl = vedata->stl;
+ WORKBENCH_PassList *psl = vedata->psl;
+ WORKBENCH_PrivateData *wpd = stl->g_data;
+
+ if (!wpd->dof_enabled) {
+ return;
+ }
+
+ DRW_stats_group_start("Depth Of Field");
+
+ GPU_framebuffer_bind(fbl->dof_downsample_fb);
+ DRW_draw_pass(psl->dof_down_ps);
+
+ GPU_framebuffer_recursive_downsample(fbl->dof_downsample_fb, 2, workbench_dof_downsample_level, psl);
+
+#if 0
+ GPU_framebuffer_bind(fbl->dof_coc_tile_h_fb);
+ DRW_draw_pass(psl->dof_flatten_h_ps);
+
+ GPU_framebuffer_bind(fbl->dof_coc_tile_v_fb);
+ DRW_draw_pass(psl->dof_flatten_v_ps);
+
+ GPU_framebuffer_bind(fbl->dof_coc_dilate_fb);
+ DRW_draw_pass(psl->dof_dilate_v_ps);
+
+ GPU_framebuffer_bind(fbl->dof_coc_tile_v_fb);
+ DRW_draw_pass(psl->dof_dilate_h_ps);
+#endif
+
+ GPU_framebuffer_bind(fbl->dof_blur1_fb);
+ DRW_draw_pass(psl->dof_blur1_ps);
+
+ GPU_framebuffer_bind(fbl->dof_blur2_fb);
+ DRW_draw_pass(psl->dof_blur2_ps);
+
+ GPU_framebuffer_bind(fbl->color_only_fb);
+ DRW_draw_pass(psl->dof_resolve_ps);
+
+ DRW_stats_group_end();
+}
diff --git a/source/blender/draw/engines/workbench/workbench_effect_fxaa.c b/source/blender/draw/engines/workbench/workbench_effect_fxaa.c
index 1beb35e6440..6e2ebff854e 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_fxaa.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_fxaa.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file workbench_effect_fxaa.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "workbench_private.h"
diff --git a/source/blender/draw/engines/workbench/workbench_effect_taa.c b/source/blender/draw/engines/workbench/workbench_effect_taa.c
index 4af0158754d..d1f8c0983c6 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_taa.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_taa.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file workbench_effect_taa.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
@@ -171,7 +168,7 @@ DRWPass *workbench_taa_create_pass(WORKBENCH_Data *vedata, GPUTexture **color_bu
int previous_jitter_index = effect_info->jitter_index;
{
- const GPUTextureFormat hist_buffer_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_RGBA8;
+ const eGPUTextureFormat hist_buffer_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_RGBA8;
DRW_texture_ensure_fullscreen_2D(&txl->history_buffer_tx, hist_buffer_format, 0);
DRW_texture_ensure_fullscreen_2D(&txl->depth_buffer_tx, GPU_DEPTH24_STENCIL8, 0);
}
diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c
index 180932b9b64..8aa21e92082 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.c
+++ b/source/blender/draw/engines/workbench/workbench_engine.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file workbench_engine.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Simple engine for drawing color and/or depth.
* When we only need simple flat shaders.
@@ -40,7 +37,7 @@ RenderEngineType DRW_engine_viewport_workbench_type = {
NULL, &DRW_render_to_image, NULL, NULL, NULL, NULL,
&workbench_render_update_passes,
&draw_engine_workbench_solid,
- {NULL, NULL, NULL}
+ {NULL, NULL, NULL},
};
diff --git a/source/blender/draw/engines/workbench/workbench_engine.h b/source/blender/draw/engines/workbench/workbench_engine.h
index a7f168db093..78f70abdaab 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.h
+++ b/source/blender/draw/engines/workbench/workbench_engine.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file workbench_engine.h
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#ifndef __WORKBENCH_ENGINE_H__
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index 6c955ac1fcb..ef9e1682a8b 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file workbench_forward.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "workbench_private.h"
@@ -29,9 +26,9 @@
#include "BLI_alloca.h"
#include "BLI_dynstr.h"
+#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
-#include "BKE_node.h"
#include "BKE_particle.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
@@ -41,12 +38,10 @@
#include "DNA_modifier_types.h"
#include "DNA_node_types.h"
-#include "ED_uvedit.h"
#include "GPU_shader.h"
#include "GPU_texture.h"
-#include "UI_resources.h"
/* *********** STATIC *********** */
static struct {
@@ -66,6 +61,7 @@ static struct {
} e_data = {{NULL}};
/* Shaders */
+extern char datatoc_gpu_shader_cfg_world_clip_lib_glsl[];
extern char datatoc_common_hair_lib_glsl[];
extern char datatoc_workbench_forward_composite_frag_glsl[];
@@ -85,12 +81,15 @@ static char *workbench_build_forward_vert(bool is_hair)
{
char *str = NULL;
if (!is_hair) {
- return BLI_strdup(datatoc_workbench_prepass_vert_glsl);
+ return BLI_string_joinN(
+ datatoc_gpu_shader_cfg_world_clip_lib_glsl,
+ datatoc_workbench_prepass_vert_glsl);
}
DynStr *ds = BLI_dynstr_new();
BLI_dynstr_append(ds, datatoc_common_hair_lib_glsl);
+ BLI_dynstr_append(ds, datatoc_gpu_shader_cfg_world_clip_lib_glsl);
BLI_dynstr_append(ds, datatoc_workbench_prepass_vert_glsl);
str = BLI_dynstr_get_cstring(ds);
@@ -138,8 +137,8 @@ static void workbench_init_object_data(DrawData *dd)
data->object_id = ((e_data.next_object_id++) & 0xff) + 1;
}
-static WORKBENCH_MaterialData *get_or_create_material_data(
- WORKBENCH_Data *vedata, Object *ob, Material *mat, Image *ima, int color_type)
+WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(
+ WORKBENCH_Data *vedata, Object *ob, Material *mat, Image *ima, int color_type, int interp)
{
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PassList *psl = vedata->psl;
@@ -155,9 +154,10 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
material_template.object_id = OBJECT_ID_PASS_ENABLED(wpd) ? engine_object_data->object_id : 1;
material_template.color_type = color_type;
material_template.ima = ima;
+ material_template.interp = interp;
uint hash = workbench_material_get_hash(&material_template, false);
- material = BLI_ghash_lookup(wpd->material_hash, POINTER_FROM_UINT(hash));
+ material = BLI_ghash_lookup(wpd->material_transp_hash, POINTER_FROM_UINT(hash));
if (material == NULL) {
material = MEM_mallocN(sizeof(WORKBENCH_MaterialData), __func__);
@@ -166,7 +166,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
color_type == V3D_SHADING_TEXTURE_COLOR ? wpd->transparent_accum_texture_sh: wpd->transparent_accum_sh,
psl->transparent_accum_pass);
DRW_shgroup_uniform_block(grp, "world_block", wpd->world_ubo);
- DRW_shgroup_uniform_float(grp, "alpha", &wpd->shading.xray_alpha, 1);
+ DRW_shgroup_uniform_float_copy(grp, "alpha", wpd->shading.xray_alpha);
DRW_shgroup_uniform_vec4(grp, "viewvecs[0]", (float *)wpd->viewvecs, 3);
workbench_material_copy(material, &material_template);
if (STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
@@ -176,15 +176,20 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
if (SPECULAR_HIGHLIGHT_ENABLED(wpd) || MATCAP_ENABLED(wpd)) {
DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
}
+ if (SHADOW_ENABLED(wpd)) {
+ DRW_shgroup_uniform_float_copy(grp, "shadowMultiplier", wpd->shadow_multiplier);
+ DRW_shgroup_uniform_float_copy(grp, "shadowShift", wpd->shadow_shift);
+ DRW_shgroup_uniform_float_copy(grp, "shadowFocus", wpd->shadow_focus);
+ }
- workbench_material_shgroup_uniform(wpd, grp, material, ob, false, false);
+ workbench_material_shgroup_uniform(wpd, grp, material, ob, false, false, interp);
material->shgrp = grp;
/* Depth */
if (workbench_material_determine_color_type(wpd, material->ima, ob) == V3D_SHADING_TEXTURE_COLOR) {
material->shgrp_object_outline = DRW_shgroup_create(
e_data.object_outline_texture_sh, psl->object_outline_pass);
- GPUTexture *tex = GPU_texture_from_blender(material->ima, NULL, GL_TEXTURE_2D, false, 0.0f);
+ GPUTexture *tex = GPU_texture_from_blender(material->ima, NULL, GL_TEXTURE_2D, false);
DRW_shgroup_uniform_texture(material->shgrp_object_outline, "image", tex);
}
else {
@@ -193,7 +198,12 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
}
material->object_id = engine_object_data->object_id;
DRW_shgroup_uniform_int(material->shgrp_object_outline, "object_id", &material->object_id, 1);
- BLI_ghash_insert(wpd->material_hash, POINTER_FROM_UINT(hash), material);
+ if (wpd->world_clip_planes) {
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ RegionView3D *rv3d = draw_ctx->rv3d;
+ DRW_shgroup_world_clip_planes_from_rv3d(material->shgrp_object_outline, rv3d);
+ }
+ BLI_ghash_insert(wpd->material_transp_hash, POINTER_FROM_UINT(hash), material);
}
return material;
}
@@ -228,7 +238,7 @@ static GPUShader *ensure_forward_composite_shaders(WORKBENCH_PrivateData *wpd)
return e_data.composite_sh_cache[index];
}
-static void select_forward_shaders(WORKBENCH_PrivateData *wpd)
+void workbench_forward_choose_shaders(WORKBENCH_PrivateData *wpd)
{
wpd->composite_sh = ensure_forward_composite_shaders(wpd);
wpd->transparent_accum_sh = ensure_forward_accum_shaders(wpd, false, false);
@@ -237,6 +247,33 @@ static void select_forward_shaders(WORKBENCH_PrivateData *wpd)
wpd->transparent_accum_texture_hair_sh = ensure_forward_accum_shaders(wpd, true, true);
}
+void workbench_forward_outline_shaders_ensure(WORKBENCH_PrivateData *wpd)
+{
+ if (e_data.object_outline_sh == NULL) {
+ char *defines = workbench_material_build_defines(wpd, false, false);
+ char *defines_texture = workbench_material_build_defines(wpd, true, false);
+ char *defines_hair = workbench_material_build_defines(wpd, false, true);
+ char *forward_vert = workbench_build_forward_vert(false);
+ char *forward_hair_vert = workbench_build_forward_vert(true);
+
+ e_data.object_outline_sh = DRW_shader_create(
+ forward_vert, NULL,
+ datatoc_workbench_forward_depth_frag_glsl, defines);
+ e_data.object_outline_texture_sh = DRW_shader_create(
+ forward_vert, NULL,
+ datatoc_workbench_forward_depth_frag_glsl, defines_texture);
+ e_data.object_outline_hair_sh = DRW_shader_create(
+ forward_hair_vert, NULL,
+ datatoc_workbench_forward_depth_frag_glsl, defines_hair);
+
+ MEM_freeN(forward_hair_vert);
+ MEM_freeN(forward_vert);
+ MEM_freeN(defines);
+ MEM_freeN(defines_texture);
+ MEM_freeN(defines_hair);
+ }
+}
+
/* public functions */
void workbench_forward_engine_init(WORKBENCH_Data *vedata)
{
@@ -260,40 +297,17 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
float light_direction[3];
workbench_private_data_get_light_direction(wpd, light_direction);
- if (!e_data.next_object_id) {
- e_data.next_object_id = 1;
- memset(e_data.composite_sh_cache, 0x00, sizeof(e_data.composite_sh_cache));
- memset(e_data.transparent_accum_sh_cache, 0x00, sizeof(e_data.transparent_accum_sh_cache));
-
- char *defines = workbench_material_build_defines(wpd, false, false);
- char *defines_texture = workbench_material_build_defines(wpd, true, false);
- char *defines_hair = workbench_material_build_defines(wpd, false, true);
- char *forward_vert = workbench_build_forward_vert(false);
- char *forward_hair_vert = workbench_build_forward_vert(true);
- e_data.object_outline_sh = DRW_shader_create(
- forward_vert, NULL,
- datatoc_workbench_forward_depth_frag_glsl, defines);
- e_data.object_outline_texture_sh = DRW_shader_create(
- forward_vert, NULL,
- datatoc_workbench_forward_depth_frag_glsl, defines_texture);
- e_data.object_outline_hair_sh = DRW_shader_create(
- forward_hair_vert, NULL,
- datatoc_workbench_forward_depth_frag_glsl, defines_hair);
-
+ if (!e_data.checker_depth_sh) {
+ workbench_forward_outline_shaders_ensure(wpd);
e_data.checker_depth_sh = DRW_shader_create_fullscreen(
datatoc_workbench_checkerboard_depth_frag_glsl, NULL);
- MEM_freeN(forward_hair_vert);
- MEM_freeN(forward_vert);
- MEM_freeN(defines);
- MEM_freeN(defines_texture);
- MEM_freeN(defines_hair);
}
workbench_volume_engine_init();
workbench_fxaa_engine_init();
workbench_taa_engine_init(vedata);
- select_forward_shaders(wpd);
+ workbench_forward_choose_shaders(wpd);
const float *viewport_size = DRW_viewport_size_get();
const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
@@ -326,7 +340,7 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
});
workbench_volume_cache_init(vedata);
- const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->shading.flag & V3D_SHADING_BACKFACE_CULLING));
+ const bool do_cull = CULL_BACKFACE_ENABLED(wpd);
const int cull_state = (do_cull) ? DRW_STATE_CULL_BACK : 0;
/* Transparency Accum */
@@ -355,6 +369,19 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
}
+ /* TODO(campbell): displays but masks geometry, only use with wire for now. */
+ if ((wpd->shading.type == OB_WIRE) &&
+ (draw_ctx->rv3d && (draw_ctx->rv3d->rflag & RV3D_CLIPPING) && draw_ctx->rv3d->clipbb))
+ {
+ psl->background_pass = DRW_pass_create(
+ "Background", DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL);
+ GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND);
+ grp = DRW_shgroup_create(shader, psl->background_pass);
+ wpd->world_clip_planes_batch = DRW_draw_background_clipping_batch_from_rv3d(draw_ctx->rv3d);
+ DRW_shgroup_call_add(grp, wpd->world_clip_planes_batch, NULL);
+ DRW_shgroup_uniform_vec4(grp, "color", &wpd->world_clip_planes_color[0], 1);
+ }
+
{
workbench_aa_create_pass(vedata, &e_data.transparent_accum_tx);
}
@@ -403,6 +430,7 @@ void workbench_forward_engine_free()
workbench_volume_engine_free();
workbench_fxaa_engine_free();
workbench_taa_engine_free();
+ workbench_dof_engine_free();
}
void workbench_forward_cache_init(WORKBENCH_Data *UNUSED(vedata))
@@ -430,11 +458,12 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O
const int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as;
if (draw_as == PART_DRAW_PATH) {
- Image *image = NULL;
- Material *mat = give_current_material(ob, part->omat);
- ED_object_get_active_image(ob, part->omat, &image, NULL, NULL, NULL);
+ Material *mat;
+ Image *image;
+ int interp;
+ workbench_material_get_image_and_mat(ob, part->omat, &image, &interp, &mat);
int color_type = workbench_material_determine_color_type(wpd, image, ob);
- WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, ob, mat, image, color_type);
+ WORKBENCH_MaterialData *material = workbench_forward_get_or_create_material_data(vedata, ob, mat, image, color_type, interp);
struct GPUShader *shader = (color_type != V3D_SHADING_TEXTURE_COLOR)
? wpd->transparent_accum_hair_sh
@@ -444,7 +473,7 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O
psl->transparent_accum_pass,
shader);
DRW_shgroup_uniform_block(shgrp, "world_block", wpd->world_ubo);
- workbench_material_shgroup_uniform(wpd, shgrp, material, ob, false, false);
+ workbench_material_shgroup_uniform(wpd, shgrp, material, ob, false, false, interp);
DRW_shgroup_uniform_vec4(shgrp, "viewvecs[0]", (float *)wpd->viewvecs, 3);
/* Hairs have lots of layer and can rapidly become the most prominent surface.
* So lower their alpha artificially. */
@@ -473,15 +502,16 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
Scene *scene = draw_ctx->scene;
const bool is_wire = (ob->dt == OB_WIRE);
- if (!DRW_object_is_renderable(ob))
+ if (!DRW_object_is_renderable(ob)) {
return;
+ }
if (ob->type == OB_MESH) {
workbench_forward_cache_populate_particles(vedata, ob);
}
ModifierData *md;
- if (((ob->base_flag & BASE_FROMDUPLI) == 0) &&
+ if (((ob->base_flag & BASE_FROM_DUPLI) == 0) &&
(md = modifiers_findByType(ob, eModifierType_Smoke)) &&
(modifier_isEnabled(scene, md, eModifierMode_Realtime)) &&
(((SmokeModifierData *)md)->domain != NULL))
@@ -509,20 +539,12 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
const int materials_len = MAX2(1, (is_sculpt_mode ? 1 : ob->totcol));
struct GPUBatch **geom_array = DRW_cache_mesh_surface_texpaint_get(ob);
for (int i = 0; i < materials_len; i++) {
- Material *mat = give_current_material(ob, i + 1);
+ Material *mat;
Image *image;
- ED_object_get_active_image(ob, i + 1, &image, NULL, NULL, NULL);
- /* use OB_SOLID when no texture could be determined */
-
- int color_type = wpd->shading.color_type;
- if (color_type == V3D_SHADING_TEXTURE_COLOR) {
- /* use OB_SOLID when no texture could be determined */
- if (image == NULL) {
- color_type = V3D_SHADING_MATERIAL_COLOR;
- }
- }
-
- material = get_or_create_material_data(vedata, ob, mat, image, color_type);
+ int interp;
+ workbench_material_get_image_and_mat(ob, i + 1, &image, &interp, &mat);
+ int color_type = workbench_material_determine_color_type(wpd, image, ob);
+ material = workbench_forward_get_or_create_material_data(vedata, ob, mat, image, color_type, interp);
DRW_shgroup_call_object_add(material->shgrp_object_outline, geom_array[i], ob);
DRW_shgroup_call_object_add(material->shgrp, geom_array[i], ob);
}
@@ -538,7 +560,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
/* No material split needed */
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
- material = get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type);
+ material = workbench_forward_get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type, 0);
if (is_sculpt_mode) {
DRW_shgroup_call_sculpt_add(material->shgrp_object_outline, ob, ob->obmat);
if (!is_wire) {
@@ -569,7 +591,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
}
Material *mat = give_current_material(ob, i + 1);
- material = get_or_create_material_data(vedata, ob, mat, NULL, V3D_SHADING_MATERIAL_COLOR);
+ material = workbench_forward_get_or_create_material_data(vedata, ob, mat, NULL, V3D_SHADING_MATERIAL_COLOR, 0);
if (is_sculpt_mode) {
DRW_shgroup_call_sculpt_add(material->shgrp_object_outline, ob, ob->obmat);
if (!is_wire) {
@@ -640,6 +662,11 @@ void workbench_forward_draw_scene(WORKBENCH_Data *vedata)
DRW_draw_pass(psl->composite_pass);
DRW_draw_pass(psl->volume_pass);
+ /* Only when clipping is enabled. */
+ if (psl->background_pass) {
+ DRW_draw_pass(psl->background_pass);
+ }
+
/* Color correct and Anti aliasing */
workbench_aa_draw_pass(vedata, e_data.composite_buffer_tx);
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c
index faca4b401dc..e721a4ccdb8 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -1,14 +1,39 @@
+/*
+ * 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.
+ *
+ * Copyright 2018, Blender Foundation.
+ */
+/** \file
+ * \ingroup draw_engine
+ */
#include "workbench_private.h"
#include "BIF_gl.h"
#include "BKE_image.h"
+#include "BKE_node.h"
#include "BLI_dynstr.h"
#include "BLI_hash.h"
+#include "DNA_node_types.h"
+
+#include "ED_uvedit.h"
+
#define HSV_SATURATION 0.5
#define HSV_VALUE 0.8
@@ -38,7 +63,7 @@ void workbench_material_update_data(WORKBENCH_PrivateData *wpd, Object *ob, Mate
copy_v3_v3(data->base_color, data->diffuse_color);
}
else if (color_type == V3D_SHADING_OBJECT_COLOR) {
- copy_v3_v3(data->diffuse_color, ob->col);
+ copy_v3_v3(data->diffuse_color, ob->color);
copy_v3_v3(data->base_color, data->diffuse_color);
}
else {
@@ -105,6 +130,9 @@ char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, bool use_text
if (is_hair) {
BLI_dynstr_appendf(ds, "#define HAIR_SHADER\n");
}
+ if (wpd->world_clip_planes != NULL) {
+ BLI_dynstr_appendf(ds, "#define USE_WORLD_CLIP_PLANES\n");
+ }
str = BLI_dynstr_get_cstring(ds);
BLI_dynstr_free(ds);
@@ -149,6 +177,7 @@ int workbench_material_get_composite_shader_index(WORKBENCH_PrivateData *wpd)
SET_FLAG_FROM_TEST(index, wpd->shading.flag & V3D_SHADING_CAVITY, 1 << 3);
SET_FLAG_FROM_TEST(index, wpd->shading.flag & V3D_SHADING_OBJECT_OUTLINE, 1 << 4);
SET_FLAG_FROM_TEST(index, MATDATA_PASS_ENABLED(wpd), 1 << 5);
+ BLI_assert(index < MAX_COMPOSITE_SHADERS);
return index;
}
@@ -163,6 +192,8 @@ int workbench_material_get_prepass_shader_index(
SET_FLAG_FROM_TEST(index, NORMAL_VIEWPORT_PASS_ENABLED(wpd), 1 << 3);
SET_FLAG_FROM_TEST(index, MATCAP_ENABLED(wpd), 1 << 4);
SET_FLAG_FROM_TEST(index, use_textures, 1 << 5);
+ SET_FLAG_FROM_TEST(index, wpd->world_clip_planes != NULL, 1 << 6);
+ BLI_assert(index < MAX_PREPASS_SHADERS);
return index;
}
@@ -174,6 +205,9 @@ int workbench_material_get_accum_shader_index(WORKBENCH_PrivateData *wpd, bool u
index = SPECULAR_HIGHLIGHT_ENABLED(wpd) ? 3 : wpd->shading.light;
SET_FLAG_FROM_TEST(index, use_textures, 1 << 2);
SET_FLAG_FROM_TEST(index, is_hair, 1 << 3);
+ /* 1 bits SHADOWS (only facing factor) */
+ SET_FLAG_FROM_TEST(index, SHADOW_ENABLED(wpd), 1 << 4);
+ BLI_assert(index < MAX_ACCUM_SHADERS);
return index;
}
@@ -186,9 +220,38 @@ int workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd, Image *i
return color_type;
}
+void workbench_material_get_image_and_mat(Object *ob, int mat_nr, Image **r_image, int *r_interp, Material **r_mat)
+{
+ bNode *node;
+ *r_mat = give_current_material(ob, mat_nr);
+ ED_object_get_active_image(ob, mat_nr, r_image, NULL, &node, NULL);
+ if (node && *r_image) {
+ switch (node->type) {
+ case SH_NODE_TEX_IMAGE:
+ {
+ NodeTexImage *storage = node->storage;
+ *r_interp = storage->interpolation;
+ break;
+ }
+ case SH_NODE_TEX_ENVIRONMENT:
+ {
+ NodeTexEnvironment *storage = node->storage;
+ *r_interp = storage->interpolation;
+ break;
+ }
+ default:
+ BLI_assert(!"Node type not supported by workbench");
+ *r_interp = 0;
+ }
+ }
+ else {
+ *r_interp = 0;
+ }
+}
+
void workbench_material_shgroup_uniform(
WORKBENCH_PrivateData *wpd, DRWShadingGroup *grp, WORKBENCH_MaterialData *material, Object *ob,
- const bool use_metallic, const bool deferred)
+ const bool use_metallic, const bool deferred, const int interp)
{
if (deferred && !MATDATA_PASS_ENABLED(wpd)) {
return;
@@ -196,11 +259,13 @@ void workbench_material_shgroup_uniform(
if (workbench_material_determine_color_type(wpd, material->ima, ob) == V3D_SHADING_TEXTURE_COLOR) {
ImBuf *ibuf = BKE_image_acquire_ibuf(material->ima, NULL, NULL);
- const bool do_color_correction = (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0);
+ const bool do_color_correction = wpd->use_color_management &&
+ (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0);
BKE_image_release_ibuf(material->ima, ibuf, NULL);
- GPUTexture *tex = GPU_texture_from_blender(material->ima, NULL, GL_TEXTURE_2D, false, 0.0f);
+ GPUTexture *tex = GPU_texture_from_blender(material->ima, NULL, GL_TEXTURE_2D, false);
DRW_shgroup_uniform_texture(grp, "image", tex);
DRW_shgroup_uniform_bool_copy(grp, "imageSrgb", do_color_correction);
+ DRW_shgroup_uniform_bool_copy(grp, "imageNearest", (interp == SHD_INTERP_CLOSEST));
}
else {
DRW_shgroup_uniform_vec3(grp, "materialDiffuseColor", (use_metallic) ? material->base_color : material->diffuse_color, 1);
@@ -215,6 +280,11 @@ void workbench_material_shgroup_uniform(
}
DRW_shgroup_uniform_float(grp, "materialRoughness", &material->roughness, 1);
}
+
+ if (wpd->world_clip_planes != NULL) {
+ DRW_shgroup_uniform_vec4(grp, "WorldClipPlanes", wpd->world_clip_planes[0], 6);
+ DRW_shgroup_state_enable(grp, DRW_STATE_CLIP_PLANES);
+ }
}
void workbench_material_copy(WORKBENCH_MaterialData *dest_material, const WORKBENCH_MaterialData *source_material)
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index a4dbd9a931e..da6df4c93bd 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file workbench_private.h
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#ifndef __WORKBENCH_PRIVATE_H__
@@ -41,8 +38,8 @@
#define WORKBENCH_ENGINE "BLENDER_WORKBENCH"
#define M_GOLDEN_RATION_CONJUGATE 0.618033988749895
#define MAX_COMPOSITE_SHADERS (1 << 6)
-#define MAX_PREPASS_SHADERS (1 << 6)
-#define MAX_ACCUM_SHADERS (1 << 4)
+#define MAX_PREPASS_SHADERS (1 << 7)
+#define MAX_ACCUM_SHADERS (1 << 5)
#define MAX_CAVITY_SHADERS (1 << 3)
#define TEXTURE_DRAWING_ENABLED(wpd) (wpd->shading.color_type == V3D_SHADING_TEXTURE_COLOR)
@@ -58,6 +55,8 @@
#define CAVITY_ENABLED(wpd) (CURVATURE_ENABLED(wpd) || SSAO_ENABLED(wpd))
#define SHADOW_ENABLED(wpd) (wpd->shading.flag & V3D_SHADING_SHADOW)
#define GHOST_ENABLED(psl) (!DRW_pass_is_empty(psl->ghost_prepass_pass) || !DRW_pass_is_empty(psl->ghost_prepass_hair_pass))
+#define CULL_BACKFACE_ENABLED(wpd) ((wpd->shading.flag & V3D_SHADING_BACKFACE_CULLING) != 0)
+#define OIT_ENABLED(wpd) (ELEM(wpd->shading.color_type, V3D_SHADING_MATERIAL_COLOR, V3D_SHADING_OBJECT_COLOR))
#define IS_NAVIGATING(wpd) ((DRW_context_state_get()->rv3d) && (DRW_context_state_get()->rv3d->rflag & RV3D_NAVIGATING))
#define FXAA_ENABLED(wpd) ((!DRW_state_is_opengl_render()) && \
@@ -89,7 +88,14 @@ typedef struct WORKBENCH_FramebufferList {
struct GPUFrameBuffer *effect_fb;
struct GPUFrameBuffer *effect_taa_fb;
struct GPUFrameBuffer *depth_buffer_fb;
- struct GPUFrameBuffer *volume_fb;
+ struct GPUFrameBuffer *color_only_fb;
+
+ struct GPUFrameBuffer *dof_downsample_fb;
+ struct GPUFrameBuffer *dof_coc_tile_h_fb;
+ struct GPUFrameBuffer *dof_coc_tile_v_fb;
+ struct GPUFrameBuffer *dof_coc_dilate_fb;
+ struct GPUFrameBuffer *dof_blur1_fb;
+ struct GPUFrameBuffer *dof_blur2_fb;
/* Forward render buffers */
struct GPUFrameBuffer *object_outline_fb;
@@ -98,6 +104,8 @@ typedef struct WORKBENCH_FramebufferList {
} WORKBENCH_FramebufferList;
typedef struct WORKBENCH_TextureList {
+ struct GPUTexture *dof_source_tx;
+ struct GPUTexture *coc_halfres_tx;
struct GPUTexture *history_buffer_tx;
struct GPUTexture *depth_buffer_tx;
} WORKBENCH_TextureList;
@@ -105,6 +113,7 @@ typedef struct WORKBENCH_TextureList {
typedef struct WORKBENCH_StorageList {
struct WORKBENCH_PrivateData *g_data;
struct WORKBENCH_EffectInfo *effects;
+ float *dof_ubo_data;
} WORKBENCH_StorageList;
typedef struct WORKBENCH_PassList {
@@ -122,9 +131,20 @@ typedef struct WORKBENCH_PassList {
struct DRWPass *shadow_depth_fail_caps_mani_pass;
struct DRWPass *composite_pass;
struct DRWPass *composite_shadow_pass;
+ struct DRWPass *oit_composite_pass;
struct DRWPass *background_pass;
+ struct DRWPass *background_pass_clip;
struct DRWPass *ghost_resolve_pass;
struct DRWPass *effect_aa_pass;
+ struct DRWPass *dof_down_ps;
+ struct DRWPass *dof_down2_ps;
+ struct DRWPass *dof_flatten_v_ps;
+ struct DRWPass *dof_flatten_h_ps;
+ struct DRWPass *dof_dilate_h_ps;
+ struct DRWPass *dof_dilate_v_ps;
+ struct DRWPass *dof_blur1_ps;
+ struct DRWPass *dof_blur2_ps;
+ struct DRWPass *dof_resolve_ps;
struct DRWPass *volume_pass;
/* forward rendering */
@@ -167,6 +187,7 @@ BLI_STATIC_ASSERT_ALIGN(WORKBENCH_UBO_World, 16)
typedef struct WORKBENCH_PrivateData {
struct GHash *material_hash;
+ struct GHash *material_transp_hash;
struct GPUShader *prepass_solid_sh;
struct GPUShader *prepass_solid_hair_sh;
struct GPUShader *prepass_texture_sh;
@@ -185,17 +206,27 @@ typedef struct WORKBENCH_PrivateData {
struct DRWShadingGroup *depth_shgrp;
WORKBENCH_UBO_World world_data;
float shadow_multiplier;
+ float shadow_shift;
+ float shadow_focus;
float cached_shadow_direction[3];
float shadow_mat[4][4];
float shadow_inv[4][4];
- float shadow_far_plane[4]; /* Far plane of the view frustum. */
- float shadow_near_corners[4][3]; /* Near plane corners in shadow space. */
- float shadow_near_min[3]; /* min and max of shadow_near_corners. allow fast test */
+ /* Far plane of the view frustum. */
+ float shadow_far_plane[4];
+ /* Near plane corners in shadow space. */
+ float shadow_near_corners[4][3];
+ /* min and max of shadow_near_corners. allow fast test */
+ float shadow_near_min[3];
float shadow_near_max[3];
- float shadow_near_sides[2][4]; /* This is a parallelogram, so only 2 normal and distance to the edges. */
+ /* This is a parallelogram, so only 2 normal and distance to the edges. */
+ float shadow_near_sides[2][4];
bool shadow_changed;
bool is_playback;
+ float (*world_clip_planes)[4];
+ struct GPUBatch *world_clip_planes_batch;
+ float world_clip_planes_color[4];
+
/* Volumes */
bool volumes_do;
ListBase smoke_domains;
@@ -206,8 +237,23 @@ typedef struct WORKBENCH_PrivateData {
float ssao_params[4];
float ssao_settings[4];
+ /* Dof */
+ struct GPUTexture *dof_blur_tx;
+ struct GPUTexture *coc_temp_tx;
+ struct GPUTexture *coc_tiles_tx[2];
+ struct GPUUniformBuffer *dof_ubo;
+ float dof_aperturesize;
+ float dof_distance;
+ float dof_invsensorsize;
+ float dof_near_far[2];
+ float dof_blades;
+ float dof_rotation;
+ float dof_ratio;
+ bool dof_enabled;
+
/* Color Management */
- bool use_color_view_settings;
+ bool use_color_management;
+ bool use_color_render_settings;
} WORKBENCH_PrivateData; /* Transient data */
typedef struct WORKBENCH_EffectInfo {
@@ -230,6 +276,7 @@ typedef struct WORKBENCH_MaterialData {
float roughness;
int object_id;
int color_type;
+ int interp;
Image *ima;
/* Linked shgroup for drawing */
@@ -243,7 +290,8 @@ typedef struct WORKBENCH_ObjectData {
/* Shadow direction in local object space. */
float shadow_dir[3], shadow_depth;
- float shadow_min[3], shadow_max[3]; /* Min, max in shadow space */
+ /* Min, max in shadow space */
+ float shadow_min[3], shadow_max[3];
BoundBox shadow_bbox;
bool shadow_bbox_dirty;
@@ -270,6 +318,12 @@ void workbench_forward_cache_init(WORKBENCH_Data *vedata);
void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob);
void workbench_forward_cache_finish(WORKBENCH_Data *vedata);
+/* For OIT in deferred */
+void workbench_forward_outline_shaders_ensure(WORKBENCH_PrivateData *wpd);
+void workbench_forward_choose_shaders(WORKBENCH_PrivateData *wpd);
+WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(
+ WORKBENCH_Data *vedata, Object *ob, Material *mat, Image *ima, int color_type, int interp);
+
/* workbench_effect_aa.c */
void workbench_aa_create_pass(WORKBENCH_Data *vedata, GPUTexture **tx);
void workbench_aa_draw_pass(WORKBENCH_Data *vedata, GPUTexture *tx);
@@ -288,8 +342,15 @@ void workbench_taa_draw_scene_end(WORKBENCH_Data *vedata);
void workbench_taa_view_updated(WORKBENCH_Data *vedata);
int workbench_taa_calculate_num_iterations(WORKBENCH_Data *vedata);
+/* workbench_effect_dof.c */
+void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera);
+void workbench_dof_engine_free(void);
+void workbench_dof_create_pass(WORKBENCH_Data *vedata, GPUTexture **dof_input, GPUTexture *noise_tex);
+void workbench_dof_draw_pass(WORKBENCH_Data *vedata);
+
/* workbench_materials.c */
int workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd, Image *ima, Object *ob);
+void workbench_material_get_image_and_mat(Object *ob, int mat_nr, Image **r_image, int *r_interp, Material **r_mat);
char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, bool use_textures, bool is_hair);
void workbench_material_update_data(WORKBENCH_PrivateData *wpd, Object *ob, Material *mat, WORKBENCH_MaterialData *data);
uint workbench_material_get_hash(WORKBENCH_MaterialData *material_template, bool is_ghost);
@@ -298,7 +359,7 @@ int workbench_material_get_prepass_shader_index(WORKBENCH_PrivateData *wpd, bool
int workbench_material_get_accum_shader_index(WORKBENCH_PrivateData *wpd, bool use_textures, bool is_hair);
void workbench_material_shgroup_uniform(
WORKBENCH_PrivateData *wpd, DRWShadingGroup *grp, WORKBENCH_MaterialData *material, Object *ob,
- const bool use_metallic, const bool deferred);
+ const bool use_metallic, const bool deferred, const int interp);
void workbench_material_copy(WORKBENCH_MaterialData *dest_material, const WORKBENCH_MaterialData *source_material);
/* workbench_studiolight.c */
diff --git a/source/blender/draw/engines/workbench/workbench_render.c b/source/blender/draw/engines/workbench/workbench_render.c
index e8d525585f4..528b4b6b815 100644
--- a/source/blender/draw/engines/workbench/workbench_render.c
+++ b/source/blender/draw/engines/workbench/workbench_render.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file workbench_render.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*
* Render functions for final render output.
*/
diff --git a/source/blender/draw/engines/workbench/workbench_studiolight.c b/source/blender/draw/engines/workbench/workbench_studiolight.c
index 52a0e6045c6..0890f50c0df 100644
--- a/source/blender/draw/engines/workbench/workbench_studiolight.c
+++ b/source/blender/draw/engines/workbench/workbench_studiolight.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,22 +13,19 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file workbench_studiolight.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "BKE_studiolight.h"
-#include "DRW_engine.h"
#include "workbench_private.h"
#include "BKE_object.h"
#include "BLI_math.h"
-#include "BKE_global.h"
void studiolight_update_world(WORKBENCH_PrivateData *wpd, StudioLight *studiolight, WORKBENCH_UBO_World *wd)
{
@@ -273,7 +268,7 @@ bool studiolight_camera_in_object_shadow(WORKBENCH_PrivateData *wpd, Object *ob,
{oed->shadow_min[0], oed->shadow_min[1]},
{oed->shadow_min[0], oed->shadow_max[1]},
{oed->shadow_max[0], oed->shadow_min[1]},
- {oed->shadow_max[0], oed->shadow_max[1]}
+ {oed->shadow_max[0], oed->shadow_max[1]},
};
for (int i = 0; i < 2; ++i) {
diff --git a/source/blender/draw/engines/workbench/workbench_volume.c b/source/blender/draw/engines/workbench/workbench_volume.c
index 408212f6814..fa5ed3408d6 100644
--- a/source/blender/draw/engines/workbench/workbench_volume.c
+++ b/source/blender/draw/engines/workbench/workbench_volume.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2018, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,18 +13,17 @@
* 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): Blender Institute
- *
+ * Copyright 2018, Blender Foundation.
*/
-/** \file workbench_volume.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "workbench_private.h"
-#include "BKE_modifier.h"
#include "BKE_object.h"
+#include "BKE_smoke.h"
#include "BLI_rand.h"
#include "BLI_dynstr.h"
@@ -129,13 +126,14 @@ void workbench_volume_cache_populate(WORKBENCH_Data *vedata, Scene *scene, Objec
}
wpd->volumes_do = true;
+ const bool show_highres = BKE_smoke_show_highres(scene, sds);
if (sds->use_coba) {
GPU_create_smoke_coba_field(smd);
}
- else if (!sds->wt || !(sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
+ else if (!sds->wt || !show_highres) {
GPU_create_smoke(smd, 0);
}
- else if (sds->wt && (sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
+ else if (sds->wt && show_highres) {
GPU_create_smoke(smd, 1);
}
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 2607e7e13b5..6258d393128 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file DRW_render.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
/* This is the Render Functions used by Realtime engines to draw with OpenGL */
@@ -41,7 +38,7 @@
#include "BLT_translation.h"
#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_scene_types.h"
#include "DNA_world_types.h"
@@ -63,28 +60,28 @@
#include "DEG_depsgraph.h"
-struct rcti;
-struct bContext;
+struct DRWTextStore;
+struct DefaultFramebufferList;
+struct DefaultTextureList;
+struct GPUBatch;
struct GPUFrameBuffer;
-struct GPUShader;
struct GPUMaterial;
+struct GPUShader;
struct GPUTexture;
struct GPUUniformBuffer;
+struct LightEngineData;
struct Object;
-struct GPUBatch;
-struct DefaultFramebufferList;
-struct DefaultTextureList;
-struct DRWTextStore;
-struct LampEngineData;
struct ParticleSystem;
struct RenderEngineType;
struct ViewportEngineData;
struct ViewportEngineData_Info;
+struct bContext;
+struct rcti;
-typedef struct DRWUniform DRWUniform;
typedef struct DRWInterface DRWInterface;
typedef struct DRWPass DRWPass;
typedef struct DRWShadingGroup DRWShadingGroup;
+typedef struct DRWUniform DRWUniform;
/* TODO Put it somewhere else? */
typedef struct BoundSphere {
@@ -197,25 +194,23 @@ typedef enum {
/* Textures from DRW_texture_pool_query_* have the options
* DRW_TEX_FILTER for color float textures, and no options
* for depth textures and integer textures. */
-struct GPUTexture *DRW_texture_pool_query_2D(int w, int h, GPUTextureFormat format, DrawEngineType *engine_type);
+struct GPUTexture *DRW_texture_pool_query_2D(int w, int h, eGPUTextureFormat format, DrawEngineType *engine_type);
struct GPUTexture *DRW_texture_create_1D(
- int w, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
+ int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
struct GPUTexture *DRW_texture_create_2D(
- int w, int h, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
-struct GPUTexture *DRW_texture_create_2D_multisample(
- int w, int h, GPUTextureFormat format, int samples, DRWTextureFlag flags, const float *fpixels);
+ int w, int h, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
struct GPUTexture *DRW_texture_create_2D_array(
- int w, int h, int d, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
+ int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
struct GPUTexture *DRW_texture_create_3D(
- int w, int h, int d, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
+ int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
struct GPUTexture *DRW_texture_create_cube(
- int w, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
+ int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
void DRW_texture_ensure_fullscreen_2D(
- struct GPUTexture **tex, GPUTextureFormat format, DRWTextureFlag flags);
+ struct GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags);
void DRW_texture_ensure_2D(
- struct GPUTexture **tex, int w, int h, GPUTextureFormat format, DRWTextureFlag flags);
+ struct GPUTexture **tex, int w, int h, eGPUTextureFormat format, DRWTextureFlag flags);
void DRW_texture_ensure_fullscreen_2D_multisample(
struct GPUTexture **tex, GPUTextureFormat format, int samples, DRWTextureFlag flags);
@@ -242,7 +237,7 @@ void DRW_uniformbuffer_free(struct GPUUniformBuffer *ubo);
} \
} while (0)
-void DRW_transform_to_display(struct GPUTexture *tex, bool use_view_settings);
+void DRW_transform_to_display(struct GPUTexture *tex, bool use_view_transform, bool use_render_settings);
void DRW_transform_none(struct GPUTexture *tex);
void DRW_multisamples_resolve(
struct GPUTexture *src_depth, struct GPUTexture *src_color, bool use_depth);
@@ -254,11 +249,11 @@ struct GPUShader *DRW_shader_create_with_lib(
const char *vert, const char *geom, const char *frag, const char *lib, const char *defines);
struct GPUShader *DRW_shader_create_with_transform_feedback(
const char *vert, const char *geom, const char *defines,
- const GPUShaderTFBType prim_type, const char **varying_names, const int varying_count);
+ const eGPUShaderTFBType prim_type, const char **varying_names, const int varying_count);
struct GPUShader *DRW_shader_create_2D(const char *frag, const char *defines);
struct GPUShader *DRW_shader_create_3D(const char *frag, const char *defines);
struct GPUShader *DRW_shader_create_fullscreen(const char *frag, const char *defines);
-struct GPUShader *DRW_shader_create_3D_depth_only(void);
+struct GPUShader *DRW_shader_create_3D_depth_only(eGPUShaderConfig slot);
struct GPUMaterial *DRW_shader_find_from_world(struct World *wo, const void *engine_type, int options, bool deferred);
struct GPUMaterial *DRW_shader_find_from_material(struct Material *ma, const void *engine_type, int options, bool deferred);
struct GPUMaterial *DRW_shader_create_from_world(
@@ -290,16 +285,20 @@ typedef enum {
DRW_STATE_CULL_FRONT = (1 << 9),
DRW_STATE_WIRE = (1 << 10),
DRW_STATE_POINT = (1 << 11),
- DRW_STATE_OFFSET_POSITIVE = (1 << 12), /* Polygon offset. Does not work with lines and points. */
- DRW_STATE_OFFSET_NEGATIVE = (1 << 13), /* Polygon offset. Does not work with lines and points. */
- /* DRW_STATE_STIPPLE_4 = (1 << 14), */ /* Not used */
+ /** Polygon offset. Does not work with lines and points. */
+ DRW_STATE_OFFSET_POSITIVE = (1 << 12),
+ /** Polygon offset. Does not work with lines and points. */
+ DRW_STATE_OFFSET_NEGATIVE = (1 << 13),
+ DRW_STATE_WIRE_WIDE = (1 << 14),
DRW_STATE_BLEND = (1 << 15),
DRW_STATE_ADDITIVE = (1 << 16),
DRW_STATE_MULTIPLY = (1 << 17),
/* DRW_STATE_TRANSMISSION = (1 << 18), */ /* Not used */
DRW_STATE_CLIP_PLANES = (1 << 19),
- DRW_STATE_ADDITIVE_FULL = (1 << 20), /* Same as DRW_STATE_ADDITIVE but let alpha accumulate without premult. */
- DRW_STATE_BLEND_PREMUL = (1 << 21), /* Use that if color is already premult by alpha. */
+ /** Same as DRW_STATE_ADDITIVE but let alpha accumulate without premult. */
+ DRW_STATE_ADDITIVE_FULL = (1 << 20),
+ /** Use that if color is already premult by alpha. */
+ DRW_STATE_BLEND_PREMUL = (1 << 21),
DRW_STATE_WIRE_SMOOTH = (1 << 22),
DRW_STATE_TRANS_FEEDBACK = (1 << 23),
DRW_STATE_BLEND_OIT = (1 << 24),
@@ -312,23 +311,25 @@ typedef enum {
DRW_STATE_STENCIL_NEQUAL = (1 << 31),
} DRWState;
#define DRW_STATE_DEFAULT (DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL)
+#define DRW_STATE_RASTERIZER_ENABLED (DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_STENCIL | \
+ DRW_STATE_WRITE_STENCIL_SHADOW_PASS | DRW_STATE_WRITE_STENCIL_SHADOW_FAIL)
typedef enum {
- DRW_ATTRIB_INT,
- DRW_ATTRIB_FLOAT,
-} DRWAttribType;
+ DRW_ATTR_INT,
+ DRW_ATTR_FLOAT,
+} eDRWAttrType;
-typedef struct DRWInstanceAttribFormat {
+typedef struct DRWInstanceAttrFormat {
char name[32];
- DRWAttribType type;
+ eDRWAttrType type;
int components;
-} DRWInstanceAttribFormat;
+} DRWInstanceAttrFormat;
-struct GPUVertFormat *DRW_shgroup_instance_format_array(const DRWInstanceAttribFormat attribs[], int arraysize);
+struct GPUVertFormat *DRW_shgroup_instance_format_array(const DRWInstanceAttrFormat attrs[], int arraysize);
#define DRW_shgroup_instance_format(format, ...) do { \
if (format == NULL) { \
- DRWInstanceAttribFormat drw_format[] = __VA_ARGS__;\
- format = DRW_shgroup_instance_format_array(drw_format, (sizeof(drw_format) / sizeof(DRWInstanceAttribFormat))); \
+ DRWInstanceAttrFormat drw_format[] = __VA_ARGS__;\
+ format = DRW_shgroup_instance_format_array(drw_format, (sizeof(drw_format) / sizeof(DRWInstanceAttrFormat))); \
} \
} while (0)
@@ -378,12 +379,13 @@ void DRW_shgroup_call_object_add_ex(
void DRW_shgroup_call_object_add_with_callback(
DRWShadingGroup *shgroup, struct GPUBatch *geom, struct Object *ob, struct Material *ma,
DRWCallVisibilityFn *callback, void *user_data);
-/* Used for drawing a batch with instancing without instance attribs. */
+/* Used for drawing a batch with instancing without instance attributes. */
void DRW_shgroup_call_instances_add(
DRWShadingGroup *shgroup, struct GPUBatch *geom, float (*obmat)[4], uint *count);
void DRW_shgroup_call_object_instances_add(
DRWShadingGroup *shgroup, struct GPUBatch *geom, struct Object *ob, uint *count);
void DRW_shgroup_call_sculpt_add(DRWShadingGroup *shgroup, struct Object *ob, float (*obmat)[4]);
+void DRW_shgroup_call_sculpt_wires_add(DRWShadingGroup *shgroup, struct Object *ob, float (*obmat)[4]);
void DRW_shgroup_call_generate_add(
DRWShadingGroup *shgroup, DRWCallGenerateFn *geometry_fn, void *user_data, float (*obmat)[4]);
void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup *shgroup, const void *attr[], uint attr_len);
@@ -538,8 +540,9 @@ void DRW_state_lock(DRWState state);
void DRW_state_invert_facing(void);
-void DRW_state_clip_planes_count_set(uint plane_len);
+void DRW_state_clip_planes_len_set(uint plane_len);
void DRW_state_clip_planes_reset(void);
+void DRW_state_clip_planes_set_from_rv3d(struct RegionView3D *rv3d);
/* Culling, return true if object is inside view frustum. */
bool DRW_culling_sphere_test(BoundSphere *bsphere);
@@ -584,7 +587,9 @@ typedef struct DRWContextState {
eObjectMode object_mode;
- /* Last resort (some functions take this as an arg so we can't easily avoid).
+ eGPUShaderConfig sh_cfg;
+
+ /** Last resort (some functions take this as an arg so we can't easily avoid).
* May be NULL when used for selection or depth buffer. */
const struct bContext *evil_C;
diff --git a/source/blender/draw/intern/draw_anim_viz.c b/source/blender/draw/intern/draw_anim_viz.c
index 871358f815b..09625b9b47e 100644
--- a/source/blender/draw/intern/draw_anim_viz.c
+++ b/source/blender/draw/intern/draw_anim_viz.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2009/2018 by the Blender Foundation.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/draw/intern/draw_anim_viz.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
@@ -33,20 +27,12 @@
#include "BLI_sys_types.h"
-#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "DNA_object_types.h"
#include "BLI_math.h"
-#include "BLI_dlrbTree.h"
-
-#include "BKE_animsys.h"
-#include "BKE_action.h"
-
-#include "ED_keyframes_draw.h"
#include "UI_resources.h"
@@ -57,15 +43,12 @@
#include "GPU_shader.h"
#include "GPU_immediate.h"
-#include "GPU_matrix.h"
#include "draw_common.h"
#include "draw_manager_text.h"
#include "draw_mode_engines.h"
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-
/* ********************************* Lists ************************************** */
/* All lists are per viewport specific datas.
* They are all free when viewport changes engines
@@ -161,6 +144,33 @@ static void MPATH_cache_init(void *vedata)
}
}
+static void MPATH_get_frame_range_to_draw(
+ bAnimVizSettings *avs, bMotionPath *mpath, int current_frame,
+ int *r_start, int *r_end, int *r_step)
+{
+ int start, end;
+
+ if (avs->path_type == MOTIONPATH_TYPE_ACFRA) {
+ start = current_frame - avs->path_bc;
+ end = current_frame + avs->path_ac + 1;
+ }
+ else {
+ start = avs->path_sf;
+ end = avs->path_ef;
+ }
+
+ if (start > end) {
+ SWAP(int, start, end);
+ }
+
+ CLAMP(start, mpath->start_frame, mpath->end_frame);
+ CLAMP(end, mpath->start_frame, mpath->end_frame);
+
+ *r_start = start;
+ *r_end = end;
+ *r_step = max_ii(avs->path_step, 1);
+}
+
static void MPATH_cache_motion_path(MPATH_PassList *psl,
Object *ob, bPoseChannel *pchan,
bAnimVizSettings *avs, bMotionPath *mpath)
@@ -168,53 +178,18 @@ static void MPATH_cache_motion_path(MPATH_PassList *psl,
const DRWContextState *draw_ctx = DRW_context_state_get();
struct DRWTextStore *dt = DRW_text_cache_ensure();
int txt_flag = DRW_TEXT_CACHE_GLOBALSPACE | DRW_TEXT_CACHE_ASCII;
- int stepsize = avs->path_step;
- int sfra, efra, sind, len;
int cfra = (int)DEG_get_ctime(draw_ctx->depsgraph);
bool sel = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->flag & SELECT);
bool show_keyframes = (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) != 0;
- bMotionPathVert *mpv, *mpv_start;
- /* get frame ranges */
- if (avs->path_type == MOTIONPATH_TYPE_ACFRA) {
- /* With "Around Current", we only choose frames from around
- * the current frame to draw.
- */
- sfra = cfra - avs->path_bc;
- efra = cfra + avs->path_ac + 1;
- }
- else {
- /* Use the current display range */
- sfra = avs->path_sf;
- efra = avs->path_ef;
- }
+ int sfra, efra, stepsize;
+ MPATH_get_frame_range_to_draw(avs, mpath, cfra, &sfra, &efra, &stepsize);
- /* no matter what, we can only show what is in the cache and no more
- * - abort if whole range is past ends of path
- * - otherwise clamp endpoints to extents of path
- */
- if (sfra < mpath->start_frame) {
- /* start clamp */
- sfra = mpath->start_frame;
- }
- if (efra > mpath->end_frame) {
- /* end clamp */
- efra = mpath->end_frame;
- }
-
- if ((sfra > mpath->end_frame) || (efra < mpath->start_frame)) {
- /* whole path is out of bounds */
+ int len = efra - sfra;
+ if (len == 0) {
return;
}
-
- len = efra - sfra;
-
- if ((len <= 0) || (mpath->points == NULL)) {
- return;
- }
-
- sind = sfra - mpath->start_frame;
- mpv_start = (mpath->points + sind);
+ int start_index = sfra - mpath->start_frame;
bool use_custom_col = (mpath->flag & MOTIONPATH_FLAG_CUSTOM) != 0;
@@ -230,29 +205,28 @@ static void MPATH_cache_motion_path(MPATH_PassList *psl,
DRW_shgroup_uniform_bool_copy(shgrp, "selected", sel);
DRW_shgroup_uniform_bool_copy(shgrp, "useCustomColor", use_custom_col);
DRW_shgroup_uniform_vec2(shgrp, "viewportSize", DRW_viewport_size_get(), 1);
- DRW_shgroup_uniform_block(shgrp, "globalsBlock", globals_ubo);
+ DRW_shgroup_uniform_block(shgrp, "globalsBlock", G_draw.block_ubo);
if (use_custom_col) {
DRW_shgroup_uniform_vec3(shgrp, "customColor", mpath->color, 1);
}
/* Only draw the required range. */
- DRW_shgroup_call_range_add(shgrp, mpath_batch_line_get(mpath), NULL, sind, len);
+ DRW_shgroup_call_range_add(shgrp, mpath_batch_line_get(mpath), NULL, start_index, len);
}
/* Draw points. */
DRWShadingGroup *shgrp = DRW_shgroup_create(mpath_points_shader_get(), psl->points);
DRW_shgroup_uniform_int_copy(shgrp, "frameCurrent", cfra);
DRW_shgroup_uniform_int_copy(shgrp, "cacheStart", mpath->start_frame);
- DRW_shgroup_uniform_int_copy(shgrp, "pointSize", mpath->line_thickness);
+ DRW_shgroup_uniform_int_copy(shgrp, "pointSize", max_ii(mpath->line_thickness - 1, 1));
DRW_shgroup_uniform_int_copy(shgrp, "stepSize", stepsize);
- DRW_shgroup_uniform_bool_copy(shgrp, "selected", sel);
DRW_shgroup_uniform_bool_copy(shgrp, "showKeyFrames", show_keyframes);
DRW_shgroup_uniform_bool_copy(shgrp, "useCustomColor", use_custom_col);
- DRW_shgroup_uniform_block(shgrp, "globalsBlock", globals_ubo);
+ DRW_shgroup_uniform_block(shgrp, "globalsBlock", G_draw.block_ubo);
if (use_custom_col) {
DRW_shgroup_uniform_vec3(shgrp, "customColor", mpath->color, 1);
}
/* Only draw the required range. */
- DRW_shgroup_call_range_add(shgrp, mpath_batch_points_get(mpath), NULL, sind, len);
+ DRW_shgroup_call_range_add(shgrp, mpath_batch_points_get(mpath), NULL, start_index, len);
/* Draw frame numbers at each framestep value */
bool show_kf_no = (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) != 0;
@@ -263,6 +237,8 @@ static void MPATH_cache_motion_path(MPATH_PassList *psl,
UI_GetThemeColor3ubv(TH_VERTEX_SELECT, col_kf);
col[3] = col_kf[3] = 255;
+ bMotionPathVert *mpv;
+ bMotionPathVert *mpv_start = mpath->points + start_index;
for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize) {
int frame = sfra + i;
char numstr[32];
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c
index e5a15a9d01d..2ee4ca1a4d8 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,47 +13,33 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file draw_armature.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
-#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "DNA_object_types.h"
#include "DRW_render.h"
-#include "BLI_blenlib.h"
#include "BLI_math.h"
-#include "BLI_dlrbTree.h"
#include "BLI_utildefines.h"
-#include "BKE_animsys.h"
-#include "BKE_action.h"
#include "BKE_armature.h"
-#include "BKE_global.h"
-#include "BKE_modifier.h"
-#include "BKE_nla.h"
-#include "BKE_curve.h"
-#include "BIF_gl.h"
#include "ED_armature.h"
-#include "ED_keyframes_draw.h"
-#include "GPU_select.h"
#include "UI_resources.h"
@@ -128,27 +112,32 @@ static struct {
/* -------------------------------------------------------------------- */
-
/** \name Shader Groups (DRW_shgroup)
* \{ */
/* Octahedral */
static void drw_shgroup_bone_octahedral(
const float (*bone_mat)[4],
- const float bone_color[4], const float hint_color[4], const float outline_color[4])
+ const float bone_color[4], const float hint_color[4], const float outline_color[4],
+ const eGPUShaderConfig sh_cfg)
{
if (g_data.bone_octahedral_outline == NULL) {
struct GPUBatch *geom = DRW_cache_bone_octahedral_wire_get();
- g_data.bone_octahedral_outline = shgroup_instance_bone_shape_outline(g_data.passes.bone_outline, geom);
+ g_data.bone_octahedral_outline = shgroup_instance_bone_shape_outline(
+ g_data.passes.bone_outline, geom, sh_cfg);
}
- if (g_data.bone_octahedral_solid == NULL) {
+ if (g_data.bone_octahedral_solid == NULL &&
+ g_data.passes.bone_solid != NULL)
+ {
struct GPUBatch *geom = DRW_cache_bone_octahedral_get();
- g_data.bone_octahedral_solid = shgroup_instance_bone_shape_solid(g_data.passes.bone_solid, geom,
- g_data.transparent);
+ g_data.bone_octahedral_solid = shgroup_instance_bone_shape_solid(
+ g_data.passes.bone_solid, geom, g_data.transparent, sh_cfg);
}
float final_bonemat[4][4];
mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
- DRW_shgroup_call_dynamic_add(g_data.bone_octahedral_solid, final_bonemat, bone_color, hint_color);
+ if (g_data.bone_octahedral_solid != NULL) {
+ DRW_shgroup_call_dynamic_add(g_data.bone_octahedral_solid, final_bonemat, bone_color, hint_color);
+ }
if (outline_color[3] > 0.0f) {
DRW_shgroup_call_dynamic_add(g_data.bone_octahedral_outline, final_bonemat, outline_color);
}
@@ -157,29 +146,38 @@ static void drw_shgroup_bone_octahedral(
/* Box / B-Bone */
static void drw_shgroup_bone_box(
const float (*bone_mat)[4],
- const float bone_color[4], const float hint_color[4], const float outline_color[4])
+ const float bone_color[4], const float hint_color[4], const float outline_color[4],
+ const eGPUShaderConfig sh_cfg)
{
if (g_data.bone_box_wire == NULL) {
struct GPUBatch *geom = DRW_cache_bone_box_wire_get();
- g_data.bone_box_outline = shgroup_instance_bone_shape_outline(g_data.passes.bone_outline, geom);
+ g_data.bone_box_outline = shgroup_instance_bone_shape_outline(
+ g_data.passes.bone_outline, geom, sh_cfg);
}
- if (g_data.bone_box_solid == NULL) {
+ if (g_data.bone_box_solid == NULL &&
+ g_data.passes.bone_solid != NULL)
+ {
struct GPUBatch *geom = DRW_cache_bone_box_get();
- g_data.bone_box_solid = shgroup_instance_bone_shape_solid(g_data.passes.bone_solid, geom, g_data.transparent);
+ g_data.bone_box_solid = shgroup_instance_bone_shape_solid(
+ g_data.passes.bone_solid, geom, g_data.transparent, sh_cfg);
}
float final_bonemat[4][4];
mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
- DRW_shgroup_call_dynamic_add(g_data.bone_box_solid, final_bonemat, bone_color, hint_color);
+ if (g_data.bone_box_solid != NULL) {
+ DRW_shgroup_call_dynamic_add(g_data.bone_box_solid, final_bonemat, bone_color, hint_color);
+ }
if (outline_color[3] > 0.0f) {
DRW_shgroup_call_dynamic_add(g_data.bone_box_outline, final_bonemat, outline_color);
}
}
/* Wire */
-static void drw_shgroup_bone_wire(const float (*bone_mat)[4], const float color[4])
+static void drw_shgroup_bone_wire(
+ const float (*bone_mat)[4], const float color[4],
+ const eGPUShaderConfig sh_cfg)
{
if (g_data.bone_wire == NULL) {
- g_data.bone_wire = shgroup_dynlines_flat_color(g_data.passes.bone_wire);
+ g_data.bone_wire = shgroup_dynlines_flat_color(g_data.passes.bone_wire, sh_cfg);
}
float head[3], tail[3];
mul_v3_m4v3(head, g_data.ob->obmat, bone_mat[3]);
@@ -193,10 +191,11 @@ static void drw_shgroup_bone_wire(const float (*bone_mat)[4], const float color[
/* Stick */
static void drw_shgroup_bone_stick(
const float (*bone_mat)[4],
- const float col_wire[4], const float col_bone[4], const float col_head[4], const float col_tail[4])
+ const float col_wire[4], const float col_bone[4], const float col_head[4], const float col_tail[4],
+ const eGPUShaderConfig sh_cfg)
{
if (g_data.bone_stick == NULL) {
- g_data.bone_stick = shgroup_instance_bone_stick(g_data.passes.bone_wire);
+ g_data.bone_stick = shgroup_instance_bone_stick(g_data.passes.bone_wire, sh_cfg);
}
float final_bonemat[4][4], tail[4];
mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
@@ -233,18 +232,23 @@ static void drw_shgroup_bone_envelope_distance(
static void drw_shgroup_bone_envelope(
const float (*bone_mat)[4],
const float bone_color[4], const float hint_color[4], const float outline_color[4],
- const float *radius_head, const float *radius_tail)
+ const float *radius_head, const float *radius_tail,
+ const eGPUShaderConfig sh_cfg)
{
if (g_data.bone_point_wire == NULL) {
- g_data.bone_point_wire = shgroup_instance_bone_sphere_outline(g_data.passes.bone_wire);
+ g_data.bone_point_wire = shgroup_instance_bone_sphere_outline(g_data.passes.bone_wire, sh_cfg);
}
- if (g_data.bone_point_solid == NULL) {
- g_data.bone_point_solid = shgroup_instance_bone_sphere_solid(g_data.passes.bone_solid, g_data.transparent);
+ if (g_data.bone_point_solid == NULL &&
+ g_data.passes.bone_solid != NULL)
+ {
+ g_data.bone_point_solid = shgroup_instance_bone_sphere_solid(g_data.passes.bone_solid, g_data.transparent, sh_cfg);
}
if (g_data.bone_envelope_wire == NULL) {
g_data.bone_envelope_wire = shgroup_instance_bone_envelope_outline(g_data.passes.bone_wire);
}
- if (g_data.bone_envelope_solid == NULL) {
+ if (g_data.bone_envelope_solid == NULL &&
+ g_data.passes.bone_solid != NULL)
+ {
g_data.bone_envelope_solid = shgroup_instance_bone_envelope_solid(g_data.passes.bone_solid, g_data.transparent);
/* We can have a lot of overdraw if we don't do this. Also envelope are not subject to
* inverted matrix. */
@@ -265,7 +269,9 @@ static void drw_shgroup_bone_envelope(
tmp[0][0] = tmp[1][1] = tmp[2][2] = tail_sphere[3] / PT_DEFAULT_RAD;
tmp[3][3] = 1.0f;
copy_v3_v3(tmp[3], tail_sphere);
- DRW_shgroup_call_dynamic_add(g_data.bone_point_solid, tmp, bone_color, hint_color);
+ if (g_data.bone_point_solid != NULL) {
+ DRW_shgroup_call_dynamic_add(g_data.bone_point_solid, tmp, bone_color, hint_color);
+ }
if (outline_color[3] > 0.0f) {
DRW_shgroup_call_dynamic_add(g_data.bone_point_wire, tmp, outline_color);
}
@@ -276,7 +282,9 @@ static void drw_shgroup_bone_envelope(
tmp[0][0] = tmp[1][1] = tmp[2][2] = head_sphere[3] / PT_DEFAULT_RAD;
tmp[3][3] = 1.0f;
copy_v3_v3(tmp[3], head_sphere);
- DRW_shgroup_call_dynamic_add(g_data.bone_point_solid, tmp, bone_color, hint_color);
+ if (g_data.bone_point_solid != NULL) {
+ DRW_shgroup_call_dynamic_add(g_data.bone_point_solid, tmp, bone_color, hint_color);
+ }
if (outline_color[3] > 0.0f) {
DRW_shgroup_call_dynamic_add(g_data.bone_point_wire, tmp, outline_color);
}
@@ -294,8 +302,10 @@ static void drw_shgroup_bone_envelope(
copy_v4_v4(tmp_sphere, head_sphere);
interp_v4_v4v4(head_sphere, tail_sphere, head_sphere, fac_head);
interp_v4_v4v4(tail_sphere, tmp_sphere, tail_sphere, fac_tail);
- DRW_shgroup_call_dynamic_add(
- g_data.bone_envelope_solid, head_sphere, tail_sphere, bone_color, hint_color, final_bonemat[0]);
+ if (g_data.bone_envelope_solid != NULL) {
+ DRW_shgroup_call_dynamic_add(
+ g_data.bone_envelope_solid, head_sphere, tail_sphere, bone_color, hint_color, final_bonemat[0]);
+ }
if (outline_color[3] > 0.0f) {
DRW_shgroup_call_dynamic_add(
g_data.bone_envelope_wire, head_sphere, tail_sphere, outline_color, final_bonemat[0]);
@@ -308,7 +318,9 @@ static void drw_shgroup_bone_envelope(
tmp[0][0] = tmp[1][1] = tmp[2][2] = tmp_sphere[3] / PT_DEFAULT_RAD;
tmp[3][3] = 1.0f;
copy_v3_v3(tmp[3], tmp_sphere);
- DRW_shgroup_call_dynamic_add(g_data.bone_point_solid, tmp, bone_color, hint_color);
+ if (g_data.bone_point_solid != NULL) {
+ DRW_shgroup_call_dynamic_add(g_data.bone_point_solid, tmp, bone_color, hint_color);
+ }
if (outline_color[3] > 0.0f) {
DRW_shgroup_call_dynamic_add(g_data.bone_point_wire, tmp, outline_color);
}
@@ -323,7 +335,7 @@ extern void drw_batch_cache_generate_requested(Object *custom);
static void drw_shgroup_bone_custom_solid(
const float (*bone_mat)[4],
const float bone_color[4], const float hint_color[4], const float outline_color[4],
- Object *custom)
+ const eGPUShaderConfig sh_cfg, Object *custom)
{
/* grr, not re-using instances! */
struct GPUBatch *surf = DRW_cache_object_surface_get(custom);
@@ -338,14 +350,15 @@ static void drw_shgroup_bone_custom_solid(
mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
}
- if (surf) {
- DRWShadingGroup *shgrp_geom_solid = shgroup_instance_bone_shape_solid(g_data.passes.bone_solid, surf,
- g_data.transparent);
+ if (surf && g_data.passes.bone_solid != NULL) {
+ DRWShadingGroup *shgrp_geom_solid = shgroup_instance_bone_shape_solid(
+ g_data.passes.bone_solid, surf, g_data.transparent, sh_cfg);
DRW_shgroup_call_dynamic_add(shgrp_geom_solid, final_bonemat, bone_color, hint_color);
}
if (edges && outline_color[3] > 0.0f) {
- DRWShadingGroup *shgrp_geom_wire = shgroup_instance_bone_shape_outline(g_data.passes.bone_outline, edges);
+ DRWShadingGroup *shgrp_geom_wire = shgroup_instance_bone_shape_outline(
+ g_data.passes.bone_outline, edges, sh_cfg);
DRW_shgroup_call_dynamic_add(shgrp_geom_wire, final_bonemat, outline_color);
}
@@ -381,17 +394,22 @@ static void drw_shgroup_bone_custom_wire(
/* Head and tail sphere */
static void drw_shgroup_bone_point(
const float (*bone_mat)[4],
- const float bone_color[4], const float hint_color[4], const float outline_color[4])
+ const float bone_color[4], const float hint_color[4], const float outline_color[4],
+ const eGPUShaderConfig sh_cfg)
{
if (g_data.bone_point_wire == NULL) {
- g_data.bone_point_wire = shgroup_instance_bone_sphere_outline(g_data.passes.bone_wire);
+ g_data.bone_point_wire = shgroup_instance_bone_sphere_outline(g_data.passes.bone_wire, sh_cfg);
}
- if (g_data.bone_point_solid == NULL) {
- g_data.bone_point_solid = shgroup_instance_bone_sphere_solid(g_data.passes.bone_solid, g_data.transparent);
+ if (g_data.bone_point_solid == NULL &&
+ g_data.passes.bone_solid != NULL)
+ {
+ g_data.bone_point_solid = shgroup_instance_bone_sphere_solid(g_data.passes.bone_solid, g_data.transparent, sh_cfg);
}
float final_bonemat[4][4];
mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
- DRW_shgroup_call_dynamic_add(g_data.bone_point_solid, final_bonemat, bone_color, hint_color);
+ if (g_data.bone_point_solid != NULL) {
+ DRW_shgroup_call_dynamic_add(g_data.bone_point_solid, final_bonemat, bone_color, hint_color);
+ }
if (outline_color[3] > 0.0f) {
DRW_shgroup_call_dynamic_add(g_data.bone_point_wire, final_bonemat, outline_color);
}
@@ -469,7 +487,6 @@ static void drw_shgroup_bone_ik_spline_lines(const float start[3], const float e
/* -------------------------------------------------------------------- */
-
/** \name Drawing Theme Helpers
*
* Note, this section is duplicate of code in 'drawarmature.c'.
@@ -513,8 +530,9 @@ static void set_pchan_colorset(Object *ob, bPoseChannel *pchan)
*/
if (pchan->agrp_index) {
grp = (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1));
- if (grp)
+ if (grp) {
color_index = grp->customCol;
+ }
}
}
@@ -735,15 +753,17 @@ static bool set_pchan_color(short colCode, const int boneflag, const short const
/* -------------------------------------------------------------------- */
-
/** \name Drawing Color Helpers
* \{ */
/** See: 'set_pchan_color'*/
static void update_color(const Object *ob, const float const_color[4])
{
+ const bArmature *arm = ob->data;
g_theme.const_color = const_color;
- g_theme.const_wire = ((ob->base_flag & BASE_SELECTED) != 0) ? 1.5f : 0.0f;
+ g_theme.const_wire = (
+ ((ob->base_flag & BASE_SELECTED) ||
+ (arm->drawtype == ARM_WIRE)) ? 1.5f : ((g_data.transparent) ? 1.0f : 0.0f));
#define NO_ALPHA(c) (((c)[3] = 1.0f), (c))
@@ -769,8 +789,9 @@ static const float *get_bone_solid_color(
const EditBone *UNUSED(eBone), const bPoseChannel *pchan, const bArmature *arm,
const int boneflag, const short constflag)
{
- if (g_theme.const_color)
+ if (g_theme.const_color) {
return g_theme.bone_solid_color;
+ }
if (arm->flag & ARM_POSEMODE) {
static float disp_color[4];
@@ -786,8 +807,9 @@ static const float *get_bone_solid_with_consts_color(
const EditBone *eBone, const bPoseChannel *pchan, const bArmature *arm,
const int boneflag, const short constflag)
{
- if (g_theme.const_color)
+ if (g_theme.const_color) {
return g_theme.bone_solid_color;
+ }
const float *col = get_bone_solid_color(eBone, pchan, arm, boneflag, constflag);
@@ -803,12 +825,15 @@ static const float *get_bone_solid_with_consts_color(
static float get_bone_wire_thickness(int boneflag)
{
- if (g_theme.const_color)
+ if (g_theme.const_color) {
return g_theme.const_wire;
- else if (boneflag & (BONE_DRAW_ACTIVE | BONE_SELECTED))
+ }
+ else if (boneflag & (BONE_DRAW_ACTIVE | BONE_SELECTED)) {
return 2.0f;
- else
+ }
+ else {
return 1.0f;
+ }
}
static const float *get_bone_wire_color(
@@ -882,7 +907,6 @@ static const float *get_bone_hint_color(
/* -------------------------------------------------------------------- */
-
/** \name Helper Utils
* \{ */
@@ -1161,7 +1185,7 @@ static void draw_axes(EditBone *eBone, bPoseChannel *pchan)
static void draw_points(
const EditBone *eBone, const bPoseChannel *pchan, const bArmature *arm,
const int boneflag, const short constflag,
- const int select_id)
+ const eGPUShaderConfig sh_cfg, const int select_id)
{
float col_solid_root[4], col_solid_tail[4], col_wire_root[4], col_wire_tail[4];
float col_hint_root[4], col_hint_tail[4];
@@ -1208,10 +1232,10 @@ static void draw_points(
if (is_envelope_draw) {
drw_shgroup_bone_envelope(
eBone->disp_mat, col_solid_root, col_hint_root, col_wire_root,
- &eBone->rad_head, &envelope_ignore);
+ &eBone->rad_head, &envelope_ignore, sh_cfg);
}
else {
- drw_shgroup_bone_point(eBone->disp_mat, col_solid_root, col_hint_root, col_wire_root);
+ drw_shgroup_bone_point(eBone->disp_mat, col_solid_root, col_hint_root, col_wire_root, sh_cfg);
}
}
}
@@ -1221,10 +1245,10 @@ static void draw_points(
if (is_envelope_draw) {
drw_shgroup_bone_envelope(
pchan->disp_mat, col_solid_root, col_hint_root, col_wire_root,
- &bone->rad_head, &envelope_ignore);
+ &bone->rad_head, &envelope_ignore, sh_cfg);
}
else {
- drw_shgroup_bone_point(pchan->disp_mat, col_solid_root, col_hint_root, col_wire_root);
+ drw_shgroup_bone_point(pchan->disp_mat, col_solid_root, col_hint_root, col_wire_root, sh_cfg);
}
}
}
@@ -1239,10 +1263,10 @@ static void draw_points(
const float *rad_tail = eBone ? &eBone->rad_tail : &pchan->bone->rad_tail;
drw_shgroup_bone_envelope(
BONE_VAR(eBone, pchan, disp_mat), col_solid_tail, col_hint_tail, col_wire_tail,
- &envelope_ignore, rad_tail);
+ &envelope_ignore, rad_tail, sh_cfg);
}
else {
- drw_shgroup_bone_point(BONE_VAR(eBone, pchan, disp_tail_mat), col_solid_tail, col_hint_tail, col_wire_tail);
+ drw_shgroup_bone_point(BONE_VAR(eBone, pchan, disp_tail_mat), col_solid_tail, col_hint_tail, col_wire_tail, sh_cfg);
}
if (select_id != -1) {
@@ -1254,14 +1278,13 @@ static void draw_points(
/* -------------------------------------------------------------------- */
-
/** \name Draw Bones
* \{ */
static void draw_bone_custom_shape(
EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
const int boneflag, const short constflag,
- const int select_id)
+ const eGPUShaderConfig sh_cfg, const int select_id)
{
const float *col_solid = get_bone_solid_color(eBone, pchan, arm, boneflag, constflag);
const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
@@ -1273,7 +1296,7 @@ static void draw_bone_custom_shape(
}
if ((boneflag & BONE_DRAWWIRE) == 0) {
- drw_shgroup_bone_custom_solid(disp_mat, col_solid, col_hint, col_wire, pchan->custom);
+ drw_shgroup_bone_custom_solid(disp_mat, col_solid, col_hint, col_wire, sh_cfg, pchan->custom);
}
else {
drw_shgroup_bone_custom_wire(disp_mat, col_wire, pchan->custom);
@@ -1287,7 +1310,7 @@ static void draw_bone_custom_shape(
static void draw_bone_envelope(
EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
const int boneflag, const short constflag,
- const int select_id)
+ const eGPUShaderConfig sh_cfg, const int select_id)
{
const float *col_solid = get_bone_solid_with_consts_color(eBone, pchan, arm, boneflag, constflag);
const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
@@ -1318,18 +1341,19 @@ static void draw_bone_envelope(
drw_shgroup_bone_envelope(
BONE_VAR(eBone, pchan, disp_mat), col_solid, col_hint, col_wire,
- rad_head, rad_tail);
+ rad_head, rad_tail, sh_cfg);
if (select_id != -1) {
DRW_select_load_id(-1);
}
- draw_points(eBone, pchan, arm, boneflag, constflag, select_id);
+ draw_points(eBone, pchan, arm, boneflag, constflag, sh_cfg, select_id);
}
static void draw_bone_line(
EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
- const int boneflag, const short constflag, const int select_id)
+ const int boneflag, const short constflag,
+ const eGPUShaderConfig sh_cfg, const int select_id)
{
const float *col_bone = get_bone_solid_with_consts_color(eBone, pchan, arm, boneflag, constflag);
const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
@@ -1367,20 +1391,20 @@ static void draw_bone_line(
if (select_id == -1) {
/* Not in selection mode, draw everything at once. */
- drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, col_head, col_tail);
+ drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, col_head, col_tail, sh_cfg);
}
else {
/* In selection mode, draw bone, root and tip separately. */
DRW_select_load_id(select_id | BONESEL_BONE);
- drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, no_display, no_display);
+ drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, col_bone, no_display, no_display, sh_cfg);
if (col_head[3] > 0.0f) {
DRW_select_load_id(select_id | BONESEL_ROOT);
- drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, col_head, no_display);
+ drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, col_head, no_display, sh_cfg);
}
DRW_select_load_id(select_id | BONESEL_TIP);
- drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, no_display, col_tail);
+ drw_shgroup_bone_stick(BONE_VAR(eBone, pchan, disp_mat), col_wire, no_display, no_display, col_tail, sh_cfg);
DRW_select_load_id(-1);
}
@@ -1389,7 +1413,7 @@ static void draw_bone_line(
static void draw_bone_wire(
EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
const int boneflag, const short constflag,
- const int select_id)
+ const eGPUShaderConfig sh_cfg, const int select_id)
{
const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
@@ -1402,12 +1426,12 @@ static void draw_bone_wire(
BLI_assert(bbones_mat != NULL);
for (int i = pchan->bone->segments; i--; bbones_mat++) {
- drw_shgroup_bone_wire(bbones_mat->mat, col_wire);
+ drw_shgroup_bone_wire(bbones_mat->mat, col_wire, sh_cfg);
}
}
else if (eBone) {
for (int i = 0; i < eBone->segments; i++) {
- drw_shgroup_bone_wire(eBone->disp_bbone_mat[i], col_wire);
+ drw_shgroup_bone_wire(eBone->disp_bbone_mat[i], col_wire, sh_cfg);
}
}
@@ -1416,14 +1440,14 @@ static void draw_bone_wire(
}
if (eBone) {
- draw_points(eBone, pchan, arm, boneflag, constflag, select_id);
+ draw_points(eBone, pchan, arm, boneflag, constflag, sh_cfg, select_id);
}
}
static void draw_bone_box(
EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
const int boneflag, const short constflag,
- const int select_id)
+ const eGPUShaderConfig sh_cfg, const int select_id)
{
const float *col_solid = get_bone_solid_with_consts_color(eBone, pchan, arm, boneflag, constflag);
const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
@@ -1438,12 +1462,12 @@ static void draw_bone_box(
BLI_assert(bbones_mat != NULL);
for (int i = pchan->bone->segments; i--; bbones_mat++) {
- drw_shgroup_bone_box(bbones_mat->mat, col_solid, col_hint, col_wire);
+ drw_shgroup_bone_box(bbones_mat->mat, col_solid, col_hint, col_wire, sh_cfg);
}
}
else if (eBone) {
for (int i = 0; i < eBone->segments; i++) {
- drw_shgroup_bone_box(eBone->disp_bbone_mat[i], col_solid, col_hint, col_wire);
+ drw_shgroup_bone_box(eBone->disp_bbone_mat[i], col_solid, col_hint, col_wire, sh_cfg);
}
}
@@ -1452,14 +1476,14 @@ static void draw_bone_box(
}
if (eBone) {
- draw_points(eBone, pchan, arm, boneflag, constflag, select_id);
+ draw_points(eBone, pchan, arm, boneflag, constflag, sh_cfg, select_id);
}
}
static void draw_bone_octahedral(
EditBone *eBone, bPoseChannel *pchan, bArmature *arm,
const int boneflag, const short constflag,
- const int select_id)
+ const eGPUShaderConfig sh_cfg, const int select_id)
{
const float *col_solid = get_bone_solid_with_consts_color(eBone, pchan, arm, boneflag, constflag);
const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag);
@@ -1469,20 +1493,19 @@ static void draw_bone_octahedral(
DRW_select_load_id(select_id | BONESEL_BONE);
}
- drw_shgroup_bone_octahedral(BONE_VAR(eBone, pchan, disp_mat), col_solid, col_hint, col_wire);
+ drw_shgroup_bone_octahedral(BONE_VAR(eBone, pchan, disp_mat), col_solid, col_hint, col_wire, sh_cfg);
if (select_id != -1) {
DRW_select_load_id(-1);
}
- draw_points(eBone, pchan, arm, boneflag, constflag, select_id);
+ draw_points(eBone, pchan, arm, boneflag, constflag, sh_cfg, select_id);
}
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Draw Degrees of Freedom
* \{ */
@@ -1559,7 +1582,6 @@ static void draw_bone_dofs(bPoseChannel *pchan)
/* -------------------------------------------------------------------- */
-
/** \name Draw Relationships
* \{ */
@@ -1570,8 +1592,9 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
float *line_start = NULL, *line_end = NULL;
for (con = pchan->constraints.first; con; con = con->next) {
- if (con->enforce == 0.0f)
+ if (con->enforce == 0.0f) {
continue;
+ }
switch (con->type) {
case CONSTRAINT_TYPE_KINEMATIC:
@@ -1580,8 +1603,9 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
int segcount = 0;
/* if only_temp, only draw if it is a temporary ik-chain */
- if (only_temp && !(data->flag & CONSTRAINT_IK_TEMP))
+ if (only_temp && !(data->flag & CONSTRAINT_IK_TEMP)) {
continue;
+ }
/* exclude tip from chain? */
parchan = ((data->flag & CONSTRAINT_IK_TIP) == 0) ? pchan->parent : pchan;
@@ -1599,10 +1623,12 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
if (parchan) {
line_end = parchan->pose_head;
- if (constflag & PCHAN_HAS_TARGET)
+ if (constflag & PCHAN_HAS_TARGET) {
drw_shgroup_bone_ik_lines(line_start, line_end);
- else
+ }
+ else {
drw_shgroup_bone_ik_no_target_lines(line_start, line_end);
+ }
}
break;
}
@@ -1612,8 +1638,9 @@ static void pchan_draw_ik_lines(bPoseChannel *pchan, const bool only_temp, const
int segcount = 0;
/* don't draw if only_temp, as Spline IK chains cannot be temporary */
- if (only_temp)
+ if (only_temp) {
continue;
+ }
parchan = pchan;
line_start = parchan->pose_tail;
@@ -1677,7 +1704,6 @@ static void draw_bone_relations(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Main Draw Loops
* \{ */
@@ -1695,7 +1721,7 @@ static void draw_armature_edit(Object *ob)
const bool show_text = DRW_state_show_text();
const bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0);
- for (eBone = arm->edbo->first, index = ob->select_color; eBone; eBone = eBone->next, index += 0x10000) {
+ for (eBone = arm->edbo->first, index = ob->select_id; eBone; eBone = eBone->next, index += 0x10000) {
if (eBone->layer & arm->layer) {
if ((eBone->flag & BONE_HIDDEN_A) == 0) {
const int select_id = is_select ? index : (uint)-1;
@@ -1717,23 +1743,23 @@ static void draw_armature_edit(Object *ob)
if (arm->drawtype == ARM_ENVELOPE) {
draw_bone_update_disp_matrix_default(eBone, NULL);
- draw_bone_envelope(eBone, NULL, arm, boneflag, constflag, select_id);
+ draw_bone_envelope(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
else if (arm->drawtype == ARM_LINE) {
draw_bone_update_disp_matrix_default(eBone, NULL);
- draw_bone_line(eBone, NULL, arm, boneflag, constflag, select_id);
+ draw_bone_line(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
else if (arm->drawtype == ARM_WIRE) {
draw_bone_update_disp_matrix_bbone(eBone, NULL);
- draw_bone_wire(eBone, NULL, arm, boneflag, constflag, select_id);
+ draw_bone_wire(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
else if (arm->drawtype == ARM_B_BONE) {
draw_bone_update_disp_matrix_bbone(eBone, NULL);
- draw_bone_box(eBone, NULL, arm, boneflag, constflag, select_id);
+ draw_bone_box(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
else {
draw_bone_update_disp_matrix_default(eBone, NULL);
- draw_bone_octahedral(eBone, NULL, arm, boneflag, constflag, select_id);
+ draw_bone_octahedral(eBone, NULL, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
/* Draw names of bone */
@@ -1783,7 +1809,7 @@ static void draw_armature_pose(Object *ob, const float const_color[4])
}
if (arm->flag & ARM_POSEMODE) {
- index = ob->select_color;
+ index = ob->select_id;
}
}
@@ -1820,40 +1846,41 @@ static void draw_armature_pose(Object *ob, const float const_color[4])
}
/* set temporary flag for drawing bone as active, but only if selected */
- if (bone == arm->act_bone)
+ if (bone == arm->act_bone) {
boneflag |= BONE_DRAW_ACTIVE;
+ }
draw_bone_relations(NULL, pchan, arm, boneflag, constflag, show_relations);
if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
draw_bone_update_disp_matrix_custom(pchan);
- draw_bone_custom_shape(NULL, pchan, arm, boneflag, constflag, select_id);
+ draw_bone_custom_shape(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
else if (arm->drawtype == ARM_ENVELOPE) {
draw_bone_update_disp_matrix_default(NULL, pchan);
- draw_bone_envelope(NULL, pchan, arm, boneflag, constflag, select_id);
+ draw_bone_envelope(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
else if (arm->drawtype == ARM_LINE) {
draw_bone_update_disp_matrix_default(NULL, pchan);
- draw_bone_line(NULL, pchan, arm, boneflag, constflag, select_id);
+ draw_bone_line(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
else if (arm->drawtype == ARM_WIRE) {
draw_bone_update_disp_matrix_bbone(NULL, pchan);
- draw_bone_wire(NULL, pchan, arm, boneflag, constflag, select_id);
+ draw_bone_wire(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
else if (arm->drawtype == ARM_B_BONE) {
draw_bone_update_disp_matrix_bbone(NULL, pchan);
- draw_bone_box(NULL, pchan, arm, boneflag, constflag, select_id);
+ draw_bone_box(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
else {
draw_bone_update_disp_matrix_default(NULL, pchan);
- draw_bone_octahedral(NULL, pchan, arm, boneflag, constflag, select_id);
+ draw_bone_octahedral(NULL, pchan, arm, boneflag, constflag, draw_ctx->sh_cfg, select_id);
}
if (!is_pose_select && show_relations &&
(arm->flag & ARM_POSEMODE) &&
(bone->flag & BONE_SELECTED) &&
- ((ob->base_flag & BASE_FROMDUPLI) == 0) &&
+ ((ob->base_flag & BASE_FROM_DUPLI) == 0) &&
(pchan->ikflag & (BONE_IK_XLIMIT | BONE_IK_ZLIMIT)))
{
draw_bone_dofs(pchan);
@@ -1900,12 +1927,12 @@ static void drw_shgroup_armature(Object *ob, DRWArmaturePasses passes, bool tran
memset(&g_color, 0x0, sizeof(g_color));
}
-void DRW_shgroup_armature_object(Object *ob, ViewLayer *view_layer, DRWArmaturePasses passes)
+void DRW_shgroup_armature_object(Object *ob, ViewLayer *view_layer, DRWArmaturePasses passes, bool transp)
{
float *color;
DRW_object_wire_theme_get(ob, view_layer, &color);
passes.bone_envelope = NULL; /* Don't do envelope distance in object mode. */
- drw_shgroup_armature(ob, passes, false);
+ drw_shgroup_armature(ob, passes, transp);
draw_armature_pose(ob, color);
}
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 96e263cdc30..28a897a4c35 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -14,13 +12,10 @@
* 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): Blender Institute
- *
*/
-/** \file draw_cache.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
@@ -37,13 +32,11 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
-#include "BLI_listbase.h"
#include "BKE_object.h"
-#include "BKE_object_deform.h"
+#include "BKE_paint.h"
#include "GPU_batch.h"
-#include "GPU_batch_presets.h"
#include "GPU_batch_utils.h"
#include "MEM_guardedalloc.h"
@@ -60,6 +53,7 @@ static struct DRWShapeCache {
GPUBatch *drw_fullscreen_quad;
GPUBatch *drw_fullscreen_quad_texcoord;
GPUBatch *drw_quad;
+ GPUBatch *drw_quad_wires;
GPUBatch *drw_grid;
GPUBatch *drw_sphere;
GPUBatch *drw_screenspace_circle;
@@ -85,16 +79,16 @@ static struct DRWShapeCache {
GPUBatch *drw_field_vortex;
GPUBatch *drw_field_tube_limit;
GPUBatch *drw_field_cone_limit;
- GPUBatch *drw_lamp;
- GPUBatch *drw_lamp_shadows;
- GPUBatch *drw_lamp_sunrays;
- GPUBatch *drw_lamp_area_square;
- GPUBatch *drw_lamp_area_disk;
- GPUBatch *drw_lamp_hemi;
- GPUBatch *drw_lamp_spot;
- GPUBatch *drw_lamp_spot_volume;
- GPUBatch *drw_lamp_spot_square;
- GPUBatch *drw_lamp_spot_square_volume;
+ GPUBatch *drw_light;
+ GPUBatch *drw_light_shadows;
+ GPUBatch *drw_light_sunrays;
+ GPUBatch *drw_light_area_square;
+ GPUBatch *drw_light_area_disk;
+ GPUBatch *drw_light_hemi;
+ GPUBatch *drw_light_spot;
+ GPUBatch *drw_light_spot_volume;
+ GPUBatch *drw_light_spot_square;
+ GPUBatch *drw_light_spot_square_volume;
GPUBatch *drw_speaker;
GPUBatch *drw_lightprobe_cube;
GPUBatch *drw_lightprobe_planar;
@@ -145,7 +139,6 @@ void DRW_shape_cache_reset(void)
}
/* -------------------------------------------------------------------- */
-
/** \name Helper functions
* \{ */
@@ -332,6 +325,32 @@ GPUBatch *DRW_cache_quad_get(void)
return SHC.drw_quad;
}
+/* Just a regular quad with 4 vertices - wires. */
+GPUBatch *DRW_cache_quad_wires_get(void)
+{
+ if (!SHC.drw_quad_wires) {
+ float pos[4][2] = {{-1.0f, -1.0f}, { 1.0f, -1.0f}, {1.0f, 1.0f}, {-1.0f, 1.0f}};
+
+ /* Position Only 2D format */
+ static GPUVertFormat format = { 0 };
+ static struct { uint pos; } attr_id;
+ if (format.attr_len == 0) {
+ attr_id.pos = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+ }
+
+ GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
+ GPU_vertbuf_data_alloc(vbo, 8);
+
+ for (int i = 0; i < 4; i++) {
+ GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 2, pos[i % 4]);
+ GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 2 + 1, pos[(i + 1) % 4]);
+ }
+
+ SHC.drw_quad_wires = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ }
+ return SHC.drw_quad_wires;
+}
+
/* Grid */
GPUBatch *DRW_cache_grid_get(void)
{
@@ -386,7 +405,6 @@ GPUBatch *DRW_cache_sphere_get(void)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Common
* \{ */
@@ -401,7 +419,7 @@ GPUBatch *DRW_cache_cube_get(void)
{ 1.0f, -1.0f, -1.0f},
{ 1.0f, -1.0f, 1.0f},
{ 1.0f, 1.0f, -1.0f},
- { 1.0f, 1.0f, 1.0f}
+ { 1.0f, 1.0f, 1.0f},
};
const uint indices[36] = {
@@ -449,7 +467,7 @@ GPUBatch *DRW_cache_empty_cube_get(void)
{ 1.0f, -1.0f, -1.0f},
{ 1.0f, -1.0f, 1.0f},
{ 1.0f, 1.0f, -1.0f},
- { 1.0f, 1.0f, 1.0f}
+ { 1.0f, 1.0f, 1.0f},
};
const GLubyte indices[24] = {0, 1, 1, 3, 3, 2, 2, 0, 0, 4, 4, 5, 5, 7, 7, 6, 6, 4, 1, 5, 3, 7, 2, 6};
@@ -667,9 +685,8 @@ GPUBatch *DRW_cache_gpencil_axes_get(void)
/* -------------------------------------------------------------------- */
-
/** \name Common Object API
-* \{ */
+ * \{ */
GPUBatch *DRW_cache_object_all_edges_get(Object *ob)
{
@@ -781,7 +798,6 @@ GPUBatch **DRW_cache_object_surface_material_get(
/* -------------------------------------------------------------------- */
-
/** \name Empties
* \{ */
@@ -980,7 +996,7 @@ GPUBatch *DRW_cache_empty_capsule_body_get(void)
{-1.0f, 0.0f, 1.0f},
{-1.0f, 0.0f, 0.0f},
{ 0.0f, -1.0f, 1.0f},
- { 0.0f, -1.0f, 0.0f}
+ { 0.0f, -1.0f, 0.0f},
};
/* Position Only 3D format */
@@ -1306,14 +1322,13 @@ GPUBatch *DRW_cache_field_cone_limit_get(void)
/** \} */
/* -------------------------------------------------------------------- */
-
-/** \name Lamps
+/** \name Lights
* \{ */
-GPUBatch *DRW_cache_lamp_get(void)
+GPUBatch *DRW_cache_light_get(void)
{
#define NSEGMENTS 8
- if (!SHC.drw_lamp) {
+ if (!SHC.drw_light) {
float v[2];
/* Position Only 3D format */
@@ -1336,16 +1351,16 @@ GPUBatch *DRW_cache_lamp_get(void)
GPU_vertbuf_attr_set(vbo, attr_id.pos, a + 1, v);
}
- SHC.drw_lamp = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ SHC.drw_light = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
- return SHC.drw_lamp;
+ return SHC.drw_light;
#undef NSEGMENTS
}
-GPUBatch *DRW_cache_lamp_shadows_get(void)
+GPUBatch *DRW_cache_light_shadows_get(void)
{
#define NSEGMENTS 10
- if (!SHC.drw_lamp_shadows) {
+ if (!SHC.drw_light_shadows) {
float v[2];
/* Position Only 3D format */
@@ -1368,15 +1383,15 @@ GPUBatch *DRW_cache_lamp_shadows_get(void)
GPU_vertbuf_attr_set(vbo, attr_id.pos, a + 1, v);
}
- SHC.drw_lamp_shadows = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ SHC.drw_light_shadows = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
- return SHC.drw_lamp_shadows;
+ return SHC.drw_light_shadows;
#undef NSEGMENTS
}
-GPUBatch *DRW_cache_lamp_sunrays_get(void)
+GPUBatch *DRW_cache_light_sunrays_get(void)
{
- if (!SHC.drw_lamp_sunrays) {
+ if (!SHC.drw_light_sunrays) {
float v[2], v1[2], v2[2];
/* Position Only 2D format */
@@ -1404,14 +1419,14 @@ GPUBatch *DRW_cache_lamp_sunrays_get(void)
GPU_vertbuf_attr_set(vbo, attr_id.pos, a * 4 + 3, v2);
}
- SHC.drw_lamp_sunrays = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ SHC.drw_light_sunrays = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
- return SHC.drw_lamp_sunrays;
+ return SHC.drw_light_sunrays;
}
-GPUBatch *DRW_cache_lamp_area_square_get(void)
+GPUBatch *DRW_cache_light_area_square_get(void)
{
- if (!SHC.drw_lamp_area_square) {
+ if (!SHC.drw_light_area_square) {
float v1[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
@@ -1438,15 +1453,15 @@ GPUBatch *DRW_cache_lamp_area_square_get(void)
v1[1] = 0.5f;
GPU_vertbuf_attr_set(vbo, attr_id.pos, 7, v1);
- SHC.drw_lamp_area_square = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ SHC.drw_light_area_square = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
- return SHC.drw_lamp_area_square;
+ return SHC.drw_light_area_square;
}
-GPUBatch *DRW_cache_lamp_area_disk_get(void)
+GPUBatch *DRW_cache_light_area_disk_get(void)
{
#define NSEGMENTS 32
- if (!SHC.drw_lamp_area_disk) {
+ if (!SHC.drw_light_area_disk) {
/* Position Only 3D format */
static GPUVertFormat format = { 0 };
static struct { uint pos; } attr_id;
@@ -1468,16 +1483,16 @@ GPUBatch *DRW_cache_lamp_area_disk_get(void)
copy_v3_fl3(v, 0.0f, 0.5f, 0.0f);
GPU_vertbuf_attr_set(vbo, attr_id.pos, (2 * NSEGMENTS) - 1, v);
- SHC.drw_lamp_area_disk = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ SHC.drw_light_area_disk = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
- return SHC.drw_lamp_area_disk;
+ return SHC.drw_light_area_disk;
#undef NSEGMENTS
}
-GPUBatch *DRW_cache_lamp_hemi_get(void)
+GPUBatch *DRW_cache_light_hemi_get(void)
{
#define CIRCLE_RESOL 32
- if (!SHC.drw_lamp_hemi) {
+ if (!SHC.drw_light_hemi) {
float v[3];
int vidx = 0;
@@ -1531,17 +1546,17 @@ GPUBatch *DRW_cache_lamp_hemi_get(void)
}
- SHC.drw_lamp_hemi = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ SHC.drw_light_hemi = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
- return SHC.drw_lamp_hemi;
+ return SHC.drw_light_hemi;
#undef CIRCLE_RESOL
}
-GPUBatch *DRW_cache_lamp_spot_get(void)
+GPUBatch *DRW_cache_light_spot_get(void)
{
#define NSEGMENTS 32
- if (!SHC.drw_lamp_spot) {
+ if (!SHC.drw_light_spot) {
/* a single ring of vertices */
float p[NSEGMENTS][2];
float n[NSEGMENTS][3];
@@ -1600,16 +1615,16 @@ GPUBatch *DRW_cache_lamp_spot_get(void)
GPU_vertbuf_attr_set(vbo, attr_id.n2, i * 4 + 3, neg[(i) % NSEGMENTS]);
}
- SHC.drw_lamp_spot = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ SHC.drw_light_spot = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
- return SHC.drw_lamp_spot;
+ return SHC.drw_light_spot;
#undef NSEGMENTS
}
-GPUBatch *DRW_cache_lamp_spot_volume_get(void)
+GPUBatch *DRW_cache_light_spot_volume_get(void)
{
#define NSEGMENTS 32
- if (!SHC.drw_lamp_spot_volume) {
+ if (!SHC.drw_light_spot_volume) {
/* a single ring of vertices */
float p[NSEGMENTS][2];
for (int i = 0; i < NSEGMENTS; ++i) {
@@ -1645,15 +1660,15 @@ GPUBatch *DRW_cache_lamp_spot_volume_get(void)
GPU_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
- SHC.drw_lamp_spot_volume = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ SHC.drw_light_spot_volume = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
- return SHC.drw_lamp_spot_volume;
+ return SHC.drw_light_spot_volume;
#undef NSEGMENTS
}
-GPUBatch *DRW_cache_lamp_spot_square_get(void)
+GPUBatch *DRW_cache_light_spot_square_get(void)
{
- if (!SHC.drw_lamp_spot_square) {
+ if (!SHC.drw_light_spot_square) {
float p[5][3] = {
{ 0.0f, 0.0f, 0.0f},
{ 1.0f, 1.0f, -1.0f},
@@ -1682,14 +1697,14 @@ GPUBatch *DRW_cache_lamp_spot_square_get(void)
GPU_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, p[((i + 1) % 4) + 1]);
}
- SHC.drw_lamp_spot_square = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ SHC.drw_light_spot_square = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
- return SHC.drw_lamp_spot_square;
+ return SHC.drw_light_spot_square;
}
-GPUBatch *DRW_cache_lamp_spot_square_volume_get(void)
+GPUBatch *DRW_cache_light_spot_square_volume_get(void)
{
- if (!SHC.drw_lamp_spot_square_volume) {
+ if (!SHC.drw_light_spot_square_volume) {
float p[5][3] = {
{ 0.0f, 0.0f, 0.0f},
{ 1.0f, 1.0f, -1.0f},
@@ -1716,15 +1731,14 @@ GPUBatch *DRW_cache_lamp_spot_square_volume_get(void)
GPU_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, p[(i % 4) + 1]);
}
- SHC.drw_lamp_spot_square_volume = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, NULL, GPU_BATCH_OWNS_VBO);
+ SHC.drw_light_spot_square_volume = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
- return SHC.drw_lamp_spot_square_volume;
+ return SHC.drw_light_spot_square_volume;
}
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Speaker
* \{ */
@@ -1788,7 +1802,6 @@ GPUBatch *DRW_cache_speaker_get(void)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Probe
* \{ */
@@ -1929,7 +1942,6 @@ GPUBatch *DRW_cache_lightprobe_planar_get(void)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Armature Bones
* \{ */
@@ -1939,7 +1951,7 @@ static const float bone_octahedral_verts[6][3] = {
{ 0.1f, 0.1f, -0.1f},
{-0.1f, 0.1f, -0.1f},
{-0.1f, 0.1f, 0.1f},
- { 0.0f, 1.0f, 0.0f}
+ { 0.0f, 1.0f, 0.0f},
};
static const float bone_octahedral_smooth_normals[6][3] = {
@@ -1955,7 +1967,7 @@ static const float bone_octahedral_smooth_normals[6][3] = {
{-M_SQRT1_2, 0.0f, -M_SQRT1_2},
{-M_SQRT1_2, 0.0f, M_SQRT1_2},
#endif
- { 0.0f, 1.0f, 0.0f}
+ { 0.0f, 1.0f, 0.0f},
};
#if 0 /* UNUSED */
@@ -1984,7 +1996,7 @@ static const uint bone_octahedral_solid_tris[8][3] = {
{5, 1, 2}, /* top */
{5, 2, 3},
{5, 3, 4},
- {5, 4, 1}
+ {5, 4, 1},
};
/**
@@ -2027,7 +2039,7 @@ static const float bone_octahedral_solid_normals[8][3] = {
{ 0.99388373f, 0.11043154f, -0.00000000f},
{ 0.00000000f, 0.11043154f, -0.99388373f},
{-0.99388373f, 0.11043154f, 0.00000000f},
- { 0.00000000f, 0.11043154f, 0.99388373f}
+ { 0.00000000f, 0.11043154f, 0.99388373f},
};
GPUBatch *DRW_cache_bone_octahedral_get(void)
@@ -2096,7 +2108,7 @@ static const float bone_box_verts[8][3] = {
{ 1.0f, 1.0f, 1.0f},
{ 1.0f, 1.0f, -1.0f},
{-1.0f, 1.0f, -1.0f},
- {-1.0f, 1.0f, 1.0f}
+ {-1.0f, 1.0f, 1.0f},
};
static const float bone_box_smooth_normals[8][3] = {
@@ -2576,7 +2588,7 @@ static void set_bone_axis_vert(
#define S_Y 0.025f
static float x_axis_name[4][2] = {
{ 0.9f * S_X, 1.0f * S_Y}, {-1.0f * S_X, -1.0f * S_Y},
- {-0.9f * S_X, 1.0f * S_Y}, { 1.0f * S_X, -1.0f * S_Y}
+ {-0.9f * S_X, 1.0f * S_Y}, { 1.0f * S_X, -1.0f * S_Y},
};
#define X_LEN (sizeof(x_axis_name) / (sizeof(float) * 2))
#undef S_X
@@ -2587,7 +2599,7 @@ static float x_axis_name[4][2] = {
static float y_axis_name[6][2] = {
{-1.0f * S_X, 1.0f * S_Y}, { 0.0f * S_X, -0.1f * S_Y},
{ 1.0f * S_X, 1.0f * S_Y}, { 0.0f * S_X, -0.1f * S_Y},
- { 0.0f * S_X, -0.1f * S_Y}, { 0.0f * S_X, -1.0f * S_Y}
+ { 0.0f * S_X, -0.1f * S_Y}, { 0.0f * S_X, -1.0f * S_Y},
};
#define Y_LEN (sizeof(y_axis_name) / (sizeof(float) * 2))
#undef S_X
@@ -2600,7 +2612,7 @@ static float z_axis_name[10][2] = {
{ 0.95f * S_X, 1.00f * S_Y}, { 0.95f * S_X, 0.90f * S_Y},
{ 0.95f * S_X, 0.90f * S_Y}, {-1.00f * S_X, -0.90f * S_Y},
{-1.00f * S_X, -0.90f * S_Y}, {-1.00f * S_X, -1.00f * S_Y},
- {-1.00f * S_X, -1.00f * S_Y}, { 1.00f * S_X, -1.00f * S_Y}
+ {-1.00f * S_X, -1.00f * S_Y}, { 1.00f * S_X, -1.00f * S_Y},
};
#define Z_LEN (sizeof(z_axis_name) / (sizeof(float) * 2))
#undef S_X
@@ -2634,7 +2646,7 @@ static float axis_name_shadow[8][2] = {
{-S_X + O_X, S_Y + O_Y}, { S_X + O_X, S_Y + O_Y},
{ S_X + O_X, S_Y + O_Y}, { S_X + O_X, -S_Y + O_Y},
{ S_X + O_X, -S_Y + O_Y}, {-S_X + O_X, -S_Y + O_Y},
- {-S_X + O_X, -S_Y + O_Y}, {-S_X + O_X, S_Y + O_Y}
+ {-S_X + O_X, -S_Y + O_Y}, {-S_X + O_X, S_Y + O_Y},
};
// #define SHADOW_RES (sizeof(axis_name_shadow) / (sizeof(float) * 2))
#define SHADOW_RES 0
@@ -2730,7 +2742,7 @@ static const float staticSine[16] = {
0.406736643076f, 0.5f, 0.587785252292f, 0.669130606359f,
0.743144825477f, 0.809016994375f, 0.866025403784f,
0.913545457643f, 0.951056516295f, 0.978147600734f,
- 0.994521895368f, 1.0f
+ 0.994521895368f, 1.0f,
};
#define set_vert(a, b, quarter) \
@@ -2822,7 +2834,6 @@ GPUBatch *DRW_cache_bone_dof_lines_get(void)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Camera
* \{ */
@@ -2968,7 +2979,6 @@ GPUBatch *DRW_cache_camera_tria_get(void)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Object Mode Helpers
* \{ */
@@ -2998,7 +3008,6 @@ GPUBatch *DRW_cache_single_vert_get(void)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Meshes
* \{ */
@@ -3091,7 +3100,6 @@ void DRW_cache_mesh_sculpt_coords_ensure(Object *ob)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Curve
* \{ */
@@ -3190,7 +3198,6 @@ GPUBatch **DRW_cache_curve_surface_shaded_get(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name MetaBall
* \{ */
@@ -3217,7 +3224,6 @@ GPUBatch **DRW_cache_mball_surface_shaded_get(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Font
* \{ */
@@ -3298,7 +3304,6 @@ GPUBatch **DRW_cache_text_surface_shaded_get(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Surface
* \{ */
@@ -3373,7 +3378,6 @@ GPUBatch **DRW_cache_surf_surface_shaded_get(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Lattice
* \{ */
@@ -3410,7 +3414,6 @@ GPUBatch *DRW_cache_lattice_vert_overlay_get(Object *ob)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Particles
* \{ */
@@ -3620,10 +3623,7 @@ GPUBatch *DRW_cache_cursor_get(bool crosshair_lines)
float x = f10 * cosf(angle);
float y = f10 * sinf(angle);
- if (i % 2 == 0)
- GPU_vertbuf_attr_set(vbo, attr_id.color, v, red);
- else
- GPU_vertbuf_attr_set(vbo, attr_id.color, v, white);
+ GPU_vertbuf_attr_set(vbo, attr_id.color, v, (i % 2 == 0) ? red : white);
GPU_vertbuf_attr_set(vbo, attr_id.pos, v, (const float[2]){x, y});
GPU_indexbuf_add_generic_vert(&elb, v++);
@@ -3681,7 +3681,6 @@ GPUBatch *DRW_cache_cursor_get(bool crosshair_lines)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Batch Cache Impl. common
* \{ */
@@ -3749,16 +3748,26 @@ bool DRW_vbo_requested(GPUVertBuf *vbo)
void drw_batch_cache_generate_requested(Object *ob)
{
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ const ToolSettings *ts = draw_ctx->scene->toolsettings;
+ const int mode = CTX_data_mode_enum_ex(draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode);
+ const bool is_paint_mode = ELEM(mode, CTX_MODE_PAINT_TEXTURE, CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT);
+ const bool use_hide = (
+ (ob->type == OB_MESH) &&
+ ((is_paint_mode && (ob == draw_ctx->obact) &&
+ (BKE_paint_select_face_test(ob) || BKE_paint_select_vert_test(ob))) ||
+ ((mode == CTX_MODE_EDIT_MESH) && BKE_object_is_in_editmode(ob))));
+
struct Mesh *mesh_eval = ob->runtime.mesh_eval;
switch (ob->type) {
case OB_MESH:
- DRW_mesh_batch_cache_create_requested(ob, (Mesh *)ob->data);
+ DRW_mesh_batch_cache_create_requested(ob, (Mesh *)ob->data, ts, is_paint_mode, use_hide);
break;
case OB_CURVE:
case OB_FONT:
case OB_SURF:
if (mesh_eval) {
- DRW_mesh_batch_cache_create_requested(ob, mesh_eval);
+ DRW_mesh_batch_cache_create_requested(ob, mesh_eval, ts, is_paint_mode, use_hide);
}
DRW_curve_batch_cache_create_requested(ob);
break;
diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h
index 1bf083696ca..287d970e298 100644
--- a/source/blender/draw/intern/draw_cache.h
+++ b/source/blender/draw/intern/draw_cache.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file draw_cache.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRAW_CACHE_H__
@@ -42,6 +39,7 @@ struct GPUBatch *DRW_cache_cursor_get(bool crosshair_lines);
struct GPUBatch *DRW_cache_grid_get(void);
struct GPUBatch *DRW_cache_fullscreen_quad_get(void);
struct GPUBatch *DRW_cache_quad_get(void);
+struct GPUBatch *DRW_cache_quad_wires_get(void);
struct GPUBatch *DRW_cache_cube_get(void);
struct GPUBatch *DRW_cache_sphere_get(void);
struct GPUBatch *DRW_cache_single_vert_get(void);
@@ -83,17 +81,17 @@ struct GPUBatch *DRW_cache_field_cone_limit_get(void);
/* Grease Pencil */
struct GPUBatch *DRW_cache_gpencil_axes_get(void);
-/* Lamps */
-struct GPUBatch *DRW_cache_lamp_get(void);
-struct GPUBatch *DRW_cache_lamp_shadows_get(void);
-struct GPUBatch *DRW_cache_lamp_sunrays_get(void);
-struct GPUBatch *DRW_cache_lamp_area_square_get(void);
-struct GPUBatch *DRW_cache_lamp_area_disk_get(void);
-struct GPUBatch *DRW_cache_lamp_hemi_get(void);
-struct GPUBatch *DRW_cache_lamp_spot_get(void);
-struct GPUBatch *DRW_cache_lamp_spot_volume_get(void);
-struct GPUBatch *DRW_cache_lamp_spot_square_get(void);
-struct GPUBatch *DRW_cache_lamp_spot_square_volume_get(void);
+/* Lights */
+struct GPUBatch *DRW_cache_light_get(void);
+struct GPUBatch *DRW_cache_light_shadows_get(void);
+struct GPUBatch *DRW_cache_light_sunrays_get(void);
+struct GPUBatch *DRW_cache_light_area_square_get(void);
+struct GPUBatch *DRW_cache_light_area_disk_get(void);
+struct GPUBatch *DRW_cache_light_hemi_get(void);
+struct GPUBatch *DRW_cache_light_spot_get(void);
+struct GPUBatch *DRW_cache_light_spot_volume_get(void);
+struct GPUBatch *DRW_cache_light_spot_square_get(void);
+struct GPUBatch *DRW_cache_light_spot_square_volume_get(void);
/* Camera */
struct GPUBatch *DRW_cache_camera_get(void);
diff --git a/source/blender/draw/intern/draw_cache_impl.h b/source/blender/draw/intern/draw_cache_impl.h
index 64a1a72ed37..7a8cea23655 100644
--- a/source/blender/draw/intern/draw_cache_impl.h
+++ b/source/blender/draw/intern/draw_cache_impl.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,28 +13,28 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file draw_cache_impl.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRAW_CACHE_IMPL_H__
#define __DRAW_CACHE_IMPL_H__
struct CurveCache;
-struct GPUMaterial;
-struct GPUTexture;
struct GPUBatch;
struct GPUIndexBuf;
+struct GPUMaterial;
+struct GPUTexture;
struct GPUVertBuf;
struct ListBase;
struct ModifierData;
-struct ParticleSystem;
struct PTCacheEdit;
+struct ParticleSystem;
struct SpaceImage;
+struct ToolSettings;
struct Curve;
struct Lattice;
@@ -84,11 +82,12 @@ struct GPUBatch *DRW_metaball_batch_cache_get_wireframes_face(struct Object *ob)
/* DispList */
void DRW_displist_vertbuf_create_pos_and_nor(struct ListBase *lb, struct GPUVertBuf *vbo);
-void DRW_displist_vertbuf_create_pos_and_nor_and_uv_tess(
+void DRW_displist_vertbuf_create_wiredata(struct ListBase *lb, struct GPUVertBuf *vbo);
+void DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv(
struct ListBase *lb, struct GPUVertBuf *vbo_pos_nor, struct GPUVertBuf *vbo_uv);
-void DRW_displist_vertbuf_create_wireframe_data_tess(struct ListBase *lb, struct GPUVertBuf *vbo);
-void DRW_displist_indexbuf_create_triangles_in_order(struct ListBase *lb, struct GPUIndexBuf *vbo);
-void DRW_displist_indexbuf_create_triangles_tess_split_by_material(
+void DRW_displist_indexbuf_create_lines_in_order(struct ListBase *lb, struct GPUIndexBuf *ibo);
+void DRW_displist_indexbuf_create_triangles_in_order(struct ListBase *lb, struct GPUIndexBuf *ibo);
+void DRW_displist_indexbuf_create_triangles_loop_split_by_material(
struct ListBase *lb, struct GPUIndexBuf **ibo_mat, uint mat_len);
/* Lattice */
@@ -97,7 +96,9 @@ struct GPUBatch *DRW_lattice_batch_cache_get_all_verts(struct Lattice *lt);
struct GPUBatch *DRW_lattice_batch_cache_get_edit_verts(struct Lattice *lt);
/* Mesh */
-void DRW_mesh_batch_cache_create_requested(struct Object *ob, struct Mesh *me);
+void DRW_mesh_batch_cache_create_requested(
+ struct Object *ob, struct Mesh *me,
+ const struct ToolSettings *ts, const bool is_paint_mode, const bool use_hide);
struct GPUBatch *DRW_mesh_batch_cache_get_all_verts(struct Mesh *me);
struct GPUBatch *DRW_mesh_batch_cache_get_all_edges(struct Mesh *me);
@@ -114,60 +115,51 @@ struct GPUBatch *DRW_mesh_batch_cache_get_surface_vertpaint(struct Mesh *me);
struct GPUBatch *DRW_mesh_batch_cache_get_surface_weights(struct Mesh *me);
/* edit-mesh drawing */
struct GPUBatch *DRW_mesh_batch_cache_get_edit_triangles(struct Mesh *me);
-struct GPUBatch *DRW_mesh_batch_cache_get_edit_triangles_nor(struct Mesh *me);
-struct GPUBatch *DRW_mesh_batch_cache_get_edit_triangles_lnor(struct Mesh *me);
struct GPUBatch *DRW_mesh_batch_cache_get_edit_vertices(struct Mesh *me);
-struct GPUBatch *DRW_mesh_batch_cache_get_edit_loose_edges(struct Mesh *me);
-struct GPUBatch *DRW_mesh_batch_cache_get_edit_loose_edges_nor(struct Mesh *me);
-struct GPUBatch *DRW_mesh_batch_cache_get_edit_loose_verts(struct Mesh *me);
+struct GPUBatch *DRW_mesh_batch_cache_get_edit_edges(struct Mesh *me);
+struct GPUBatch *DRW_mesh_batch_cache_get_edit_lnors(struct Mesh *me);
struct GPUBatch *DRW_mesh_batch_cache_get_edit_facedots(struct Mesh *me);
/* edit-mesh selection */
-struct GPUBatch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me, bool use_hide, uint select_id_offset);
-struct GPUBatch *DRW_mesh_batch_cache_get_triangles_with_select_mask(struct Mesh *me, bool use_hide);
-struct GPUBatch *DRW_mesh_batch_cache_get_facedots_with_select_id(struct Mesh *me, uint select_id_offset);
-struct GPUBatch *DRW_mesh_batch_cache_get_edges_with_select_id(struct Mesh *me, uint select_id_offset);
-struct GPUBatch *DRW_mesh_batch_cache_get_verts_with_select_id(struct Mesh *me, uint select_id_offset);
+struct GPUBatch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me);
+struct GPUBatch *DRW_mesh_batch_cache_get_facedots_with_select_id(struct Mesh *me);
+struct GPUBatch *DRW_mesh_batch_cache_get_edges_with_select_id(struct Mesh *me);
+struct GPUBatch *DRW_mesh_batch_cache_get_verts_with_select_id(struct Mesh *me);
/* Object mode Wireframe overlays */
struct GPUBatch *DRW_mesh_batch_cache_get_wireframes_face(struct Mesh *me);
+/* edit-mesh UV editor */
+struct GPUBatch *DRW_mesh_batch_cache_get_edituv_faces_strech_area(struct Mesh *me);
+struct GPUBatch *DRW_mesh_batch_cache_get_edituv_faces_strech_angle(struct Mesh *me);
+struct GPUBatch *DRW_mesh_batch_cache_get_edituv_faces(struct Mesh *me);
+struct GPUBatch *DRW_mesh_batch_cache_get_edituv_edges(struct Mesh *me);
+struct GPUBatch *DRW_mesh_batch_cache_get_edituv_verts(struct Mesh *me);
+struct GPUBatch *DRW_mesh_batch_cache_get_edituv_facedots(struct Mesh *me);
+/* For Image UV editor. */
+struct GPUBatch *DRW_mesh_batch_cache_get_uv_edges(struct Mesh *me);
void DRW_mesh_cache_sculpt_coords_ensure(struct Mesh *me);
-enum {
- UVEDIT_EDGES = (1 << 0),
- UVEDIT_DATA = (1 << 1),
- UVEDIT_FACEDOTS = (1 << 2),
- UVEDIT_FACES = (1 << 3),
- UVEDIT_STRETCH_ANGLE = (1 << 4),
- UVEDIT_STRETCH_AREA = (1 << 5),
- UVEDIT_SYNC_SEL = (1 << 6),
-};
-
-/* For Image UV editor. */
-struct GPUBatch *DRW_mesh_batch_cache_get_texpaint_loop_wire(struct Mesh *me);
-void DRW_mesh_cache_uvedit(
- struct Object *me, struct SpaceImage *sima, struct Scene *scene, uchar state,
- struct GPUBatch **faces, struct GPUBatch **edges, struct GPUBatch **verts, struct GPUBatch **facedots);
-
/* Edit mesh bitflags (is this the right place?) */
-
enum {
- VFLAG_VERTEX_ACTIVE = 1 << 0,
- VFLAG_VERTEX_SELECTED = 1 << 1,
- VFLAG_VERTEX_EXISTS = 1 << 2,
- VFLAG_FACE_ACTIVE = 1 << 3,
- VFLAG_FACE_SELECTED = 1 << 4,
- VFLAG_FACE_FREESTYLE = 1 << 5,
+ VFLAG_VERT_ACTIVE = 1 << 0,
+ VFLAG_VERT_SELECTED = 1 << 1,
+ VFLAG_EDGE_ACTIVE = 1 << 2,
+ VFLAG_EDGE_SELECTED = 1 << 3,
+ VFLAG_EDGE_SEAM = 1 << 4,
+ VFLAG_EDGE_SHARP = 1 << 5,
+ VFLAG_EDGE_FREESTYLE = 1 << 6,
/* Beware to not go over 1 << 7 (it's a byte flag)
* (see gpu_shader_edit_mesh_overlay_geom.glsl) */
};
enum {
- VFLAG_EDGE_EXISTS = 1 << 0,
- VFLAG_EDGE_ACTIVE = 1 << 1,
- VFLAG_EDGE_SELECTED = 1 << 2,
- VFLAG_EDGE_SEAM = 1 << 3,
- VFLAG_EDGE_SHARP = 1 << 4,
- VFLAG_EDGE_FREESTYLE = 1 << 5,
+ VFLAG_FACE_ACTIVE = 1 << 0,
+ VFLAG_FACE_SELECTED = 1 << 1,
+ VFLAG_FACE_FREESTYLE = 1 << 2,
+ VFLAG_VERT_UV_SELECT = 1 << 3,
+ VFLAG_VERT_UV_PINNED = 1 << 4,
+ VFLAG_EDGE_UV_SELECT = 1 << 5,
+ VFLAG_FACE_UV_ACTIVE = 1 << 6,
+ VFLAG_FACE_UV_SELECT = 1 << 7,
/* Beware to not go over 1 << 7 (it's a byte flag)
* (see gpu_shader_edit_mesh_overlay_geom.glsl) */
};
diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c
index 27babb8b6f7..ebffedf9454 100644
--- a/source/blender/draw/intern/draw_cache_impl_curve.c
+++ b/source/blender/draw/intern/draw_cache_impl_curve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2017 by Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file draw_cache_impl_curve.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*
* \brief Curve API for render engines
*/
@@ -304,16 +300,16 @@ static int curve_render_data_normal_len_get(const CurveRenderData *rdata)
static void curve_cd_calc_used_gpu_layers(int *cd_layers, struct GPUMaterial **gpumat_array, int gpumat_array_len)
{
- GPUVertexAttribs gattribs = {{{0}}};
+ GPUVertAttrLayers gpu_attrs = {{{0}}};
for (int i = 0; i < gpumat_array_len; i++) {
struct GPUMaterial *gpumat = gpumat_array[i];
if (gpumat == NULL) {
continue;
}
- GPU_material_vertex_attributes(gpumat, &gattribs);
- for (int j = 0; j < gattribs.totlayer; j++) {
- const char *name = gattribs.layer[j].name;
- int type = gattribs.layer[j].type;
+ GPU_material_vertex_attrs(gpumat, &gpu_attrs);
+ for (int j = 0; j < gpu_attrs.totlayer; j++) {
+ const char *name = gpu_attrs.layer[j].name;
+ int type = gpu_attrs.layer[j].type;
/* Curves cannot have named layers.
* Note: We could relax this assumption later. */
@@ -350,15 +346,12 @@ static void curve_cd_calc_used_gpu_layers(int *cd_layers, struct GPUMaterial **g
typedef struct CurveBatchCache {
struct {
GPUVertBuf *pos_nor;
+ GPUVertBuf *edge_fac;
GPUVertBuf *curves_pos;
- } ordered;
-
- struct {
- GPUVertBuf *pos_nor;
- GPUVertBuf *uv;
- GPUVertBuf *wireframe_data;
- } tess;
+ GPUVertBuf *loop_pos_nor;
+ GPUVertBuf *loop_uv;
+ } ordered;
struct {
/* Curve points. Aligned with ordered.pos_nor */
@@ -371,6 +364,7 @@ typedef struct CurveBatchCache {
struct {
GPUIndexBuf *surfaces_tris;
+ GPUIndexBuf *surfaces_lines;
GPUIndexBuf *curves_lines;
/* Edit mode */
GPUIndexBuf *edit_verts_points; /* Only control points. Not handles. */
@@ -379,14 +373,13 @@ typedef struct CurveBatchCache {
struct {
GPUBatch *surfaces;
+ GPUBatch *surfaces_edges;
GPUBatch *curves;
/* control handles and vertices */
GPUBatch *edit_edges;
GPUBatch *edit_verts;
GPUBatch *edit_handles_verts;
GPUBatch *edit_normals;
- /* Triangles for object mode wireframe. */
- GPUBatch *wire_triangles;
} batch;
GPUIndexBuf **surf_per_mat_tris;
@@ -510,10 +503,6 @@ static void curve_batch_cache_clear(Curve *cu)
GPUVertBuf **vbo = (GPUVertBuf **)&cache->ordered;
GPU_VERTBUF_DISCARD_SAFE(vbo[i]);
}
- for (int i = 0; i < sizeof(cache->tess) / sizeof(void *); ++i) {
- GPUVertBuf **vbo = (GPUVertBuf **)&cache->tess;
- GPU_VERTBUF_DISCARD_SAFE(vbo[i]);
- }
for (int i = 0; i < sizeof(cache->edit) / sizeof(void *); ++i) {
GPUVertBuf **vbo = (GPUVertBuf **)&cache->edit;
GPU_VERTBUF_DISCARD_SAFE(vbo[i]);
@@ -544,7 +533,6 @@ void DRW_curve_batch_cache_free(Curve *cu)
}
/* -------------------------------------------------------------------- */
-
/** \name Private Curve Cache API
* \{ */
@@ -663,7 +651,7 @@ static void curve_create_edit_curves_nor(CurveRenderData *rdata, GPUVertBuf *vbo
GPUPackedNormal pnor = GPU_normal_convert_i10_v3(nor);
GPUPackedNormal ptan = GPU_normal_convert_i10_v3(bevp->dir);
- /* Only set attribs for one vertex. */
+ /* Only set attributes for one vertex. */
GPU_vertbuf_attr_set(vbo_curves_nor, attr_id.pos, vbo_len_used, bevp->vec);
GPU_vertbuf_attr_set(vbo_curves_nor, attr_id.rad, vbo_len_used, &bevp->radius);
GPU_vertbuf_attr_set(vbo_curves_nor, attr_id.nor, vbo_len_used, &pnor);
@@ -684,8 +672,8 @@ static void curve_create_edit_curves_nor(CurveRenderData *rdata, GPUVertBuf *vbo
static char beztriple_vflag_get(CurveRenderData *rdata, char flag, char col_id, int v_idx, int nu_id)
{
char vflag = 0;
- SET_FLAG_FROM_TEST(vflag, (flag & SELECT), VFLAG_VERTEX_SELECTED);
- SET_FLAG_FROM_TEST(vflag, (v_idx == rdata->actvert), VFLAG_VERTEX_ACTIVE);
+ SET_FLAG_FROM_TEST(vflag, (flag & SELECT), VFLAG_VERT_SELECTED);
+ SET_FLAG_FROM_TEST(vflag, (v_idx == rdata->actvert), VFLAG_VERT_ACTIVE);
SET_FLAG_FROM_TEST(vflag, (nu_id == rdata->actnu), ACTIVE_NURB);
/* handle color id */
vflag |= col_id << 4; /* << 4 because of EVEN_U_BIT */
@@ -695,8 +683,8 @@ static char beztriple_vflag_get(CurveRenderData *rdata, char flag, char col_id,
static char bpoint_vflag_get(CurveRenderData *rdata, char flag, int v_idx, int nu_id, int u)
{
char vflag = 0;
- SET_FLAG_FROM_TEST(vflag, (flag & SELECT), VFLAG_VERTEX_SELECTED);
- SET_FLAG_FROM_TEST(vflag, (v_idx == rdata->actvert), VFLAG_VERTEX_ACTIVE);
+ SET_FLAG_FROM_TEST(vflag, (flag & SELECT), VFLAG_VERT_SELECTED);
+ SET_FLAG_FROM_TEST(vflag, (v_idx == rdata->actvert), VFLAG_VERT_ACTIVE);
SET_FLAG_FROM_TEST(vflag, (nu_id == rdata->actnu), ACTIVE_NURB);
SET_FLAG_FROM_TEST(vflag, ((u % 2) == 0), EVEN_U_BIT);
vflag |= COLOR_NURB_ULINE_ID << 4; /* << 4 because of EVEN_U_BIT */
@@ -744,8 +732,12 @@ static void curve_create_edit_data_and_handles(
for (Nurb *nu = rdata->nurbs->first; nu; nu = nu->next, nu_id++) {
const BezTriple *bezt = nu->bezt;
const BPoint *bp = nu->bp;
- if (bezt && bezt->hide == false) {
+ if (bezt) {
for (int a = 0; a < nu->pntsu; a++, bezt++) {
+ if (bezt->hide == true) {
+ continue;
+ }
+
if (elbp_verts) {
GPU_indexbuf_add_point_vert(elbp_verts, vbo_len_used + 1);
}
@@ -757,7 +749,7 @@ static void curve_create_edit_data_and_handles(
char vflag[3] = {
beztriple_vflag_get(rdata, bezt->f1, bezt->h1, v_idx, nu_id),
beztriple_vflag_get(rdata, bezt->f2, bezt->h1, v_idx, nu_id),
- beztriple_vflag_get(rdata, bezt->f3, bezt->h2, v_idx, nu_id)
+ beztriple_vflag_get(rdata, bezt->f3, bezt->h2, v_idx, nu_id),
};
for (int j = 0; j < 3; j++) {
GPU_vertbuf_attr_set(vbo_data, attr_id.data, vbo_len_used + j, &vflag[j]);
@@ -775,14 +767,17 @@ static void curve_create_edit_data_and_handles(
else if (bp) {
int pt_len = nu->pntsu * nu->pntsv;
for (int a = 0; a < pt_len; a++, bp++) {
+ if (bp->hide == true) {
+ continue;
+ }
int u = (a % nu->pntsu);
int v = (a / nu->pntsu);
/* Use indexed rendering for bezier.
* Specify all points and use indices to hide/show. */
- if (elbp_verts && bp->hide == false) {
+ if (elbp_verts) {
GPU_indexbuf_add_point_vert(elbp_verts, vbo_len_used);
}
- if (elbp_lines && bp->hide == false) {
+ if (elbp_lines) {
const BPoint *bp_next_u = (u < (nu->pntsu - 1)) ? &nu->bp[a + 1] : NULL;
const BPoint *bp_next_v = (v < (nu->pntsv - 1)) ? &nu->bp[a + nu->pntsu] : NULL;
if (bp_next_u && (bp_next_u->hide == false)) {
@@ -825,7 +820,6 @@ static void curve_create_edit_data_and_handles(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Public Object/Curve API
* \{ */
@@ -883,7 +877,7 @@ GPUBatch **DRW_curve_batch_cache_get_surface_shaded(
GPUBatch *DRW_curve_batch_cache_get_wireframes_face(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
- return DRW_batch_request(&cache->batch.wire_triangles);
+ return DRW_batch_request(&cache->batch.surfaces_edges);
}
/** \} */
@@ -899,7 +893,7 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
Curve *cu = ob->data;
CurveBatchCache *cache = curve_batch_cache_get(cu);
- /* Verify that all surface batches have needed attrib layers. */
+ /* Verify that all surface batches have needed attribute layers. */
/* TODO(fclem): We could be a bit smarter here and only do it per material. */
for (int i = 0; i < cache->mat_len; ++i) {
if ((cache->cd_used & cache->cd_needed) != cache->cd_needed) {
@@ -919,14 +913,15 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
DRW_ibo_request(cache->batch.surfaces, &cache->ibo.surfaces_tris);
DRW_vbo_request(cache->batch.surfaces, &cache->ordered.pos_nor);
}
+ if (DRW_batch_requested(cache->batch.surfaces_edges, GPU_PRIM_LINES)) {
+ DRW_ibo_request(cache->batch.surfaces_edges, &cache->ibo.surfaces_lines);
+ DRW_vbo_request(cache->batch.surfaces_edges, &cache->ordered.pos_nor);
+ DRW_vbo_request(cache->batch.surfaces_edges, &cache->ordered.edge_fac);
+ }
if (DRW_batch_requested(cache->batch.curves, GPU_PRIM_LINE_STRIP)) {
DRW_ibo_request(cache->batch.curves, &cache->ibo.curves_lines);
DRW_vbo_request(cache->batch.curves, &cache->ordered.curves_pos);
}
- if (DRW_batch_requested(cache->batch.wire_triangles, GPU_PRIM_TRIS)) {
- DRW_vbo_request(cache->batch.wire_triangles, &cache->tess.pos_nor);
- DRW_vbo_request(cache->batch.wire_triangles, &cache->tess.wireframe_data);
- }
/* Edit mode */
if (DRW_batch_requested(cache->batch.edit_edges, GPU_PRIM_LINES)) {
@@ -952,20 +947,21 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
DRW_ibo_request(cache->surf_per_mat[i], &cache->surf_per_mat_tris[i]);
}
if (cache->cd_used & CD_MLOOPUV) {
- DRW_vbo_request(cache->surf_per_mat[i], &cache->tess.uv);
+ DRW_vbo_request(cache->surf_per_mat[i], &cache->ordered.loop_uv);
}
- DRW_vbo_request(cache->surf_per_mat[i], &cache->tess.pos_nor);
+ DRW_vbo_request(cache->surf_per_mat[i], &cache->ordered.loop_pos_nor);
}
}
/* Generate MeshRenderData flags */
int mr_flag = 0;
DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.pos_nor, CU_DATATYPE_SURFACE);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.edge_fac, CU_DATATYPE_SURFACE);
DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.curves_pos, CU_DATATYPE_WIRE);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->tess.pos_nor, CU_DATATYPE_SURFACE);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->tess.uv, CU_DATATYPE_SURFACE);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->tess.wireframe_data, CU_DATATYPE_SURFACE);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.loop_pos_nor, CU_DATATYPE_SURFACE);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.loop_uv, CU_DATATYPE_SURFACE);
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.surfaces_tris, CU_DATATYPE_SURFACE);
+ DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.surfaces_lines, CU_DATATYPE_SURFACE);
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.curves_lines, CU_DATATYPE_WIRE);
DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->edit.pos, CU_DATATYPE_OVERLAY);
@@ -988,21 +984,21 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
if (DRW_vbo_requested(cache->ordered.pos_nor)) {
DRW_displist_vertbuf_create_pos_and_nor(lb, cache->ordered.pos_nor);
}
+ if (DRW_vbo_requested(cache->ordered.edge_fac)) {
+ DRW_displist_vertbuf_create_wiredata(lb, cache->ordered.edge_fac);
+ }
if (DRW_vbo_requested(cache->ordered.curves_pos)) {
curve_create_curves_pos(rdata, cache->ordered.curves_pos);
}
- if (DRW_vbo_requested(cache->tess.pos_nor) ||
- DRW_vbo_requested(cache->tess.uv))
+ if (DRW_vbo_requested(cache->ordered.loop_pos_nor) ||
+ DRW_vbo_requested(cache->ordered.loop_uv))
{
- DRW_displist_vertbuf_create_pos_and_nor_and_uv_tess(lb, cache->tess.pos_nor, cache->tess.uv);
- }
- if (DRW_vbo_requested(cache->tess.wireframe_data)) {
- DRW_displist_vertbuf_create_wireframe_data_tess(lb, cache->tess.wireframe_data);
+ DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv(lb, cache->ordered.loop_pos_nor, cache->ordered.loop_uv);
}
if (DRW_ibo_requested(cache->surf_per_mat_tris[0])) {
- DRW_displist_indexbuf_create_triangles_tess_split_by_material(lb, cache->surf_per_mat_tris, cache->mat_len);
+ DRW_displist_indexbuf_create_triangles_loop_split_by_material(lb, cache->surf_per_mat_tris, cache->mat_len);
}
if (DRW_ibo_requested(cache->ibo.curves_lines)) {
@@ -1011,6 +1007,9 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
if (DRW_ibo_requested(cache->ibo.surfaces_tris)) {
DRW_displist_indexbuf_create_triangles_in_order(lb, cache->ibo.surfaces_tris);
}
+ if (DRW_ibo_requested(cache->ibo.surfaces_lines)) {
+ DRW_displist_indexbuf_create_lines_in_order(lb, cache->ibo.surfaces_lines);
+ }
if (DRW_vbo_requested(cache->edit.pos) ||
DRW_vbo_requested(cache->edit.data) ||
diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c
index 6bd698a9cec..63514acf1c2 100644
--- a/source/blender/draw/intern/draw_cache_impl_displist.c
+++ b/source/blender/draw/intern/draw_cache_impl_displist.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,16 @@
*
* The Original Code is Copyright (C) 2017 by Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file draw_cache_impl_displist.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*
* \brief DispList API for render engines
*
* \note DispList may be removed soon! This is a utility for object types that use render.
*/
-#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_utildefines.h"
@@ -40,6 +35,7 @@
#include "BKE_displist.h"
#include "GPU_batch.h"
+#include "GPU_extensions.h"
#include "draw_cache_impl.h" /* own include */
@@ -177,7 +173,7 @@ void DRW_displist_vertbuf_create_pos_and_nor(ListBase *lb, GPUVertBuf *vbo)
if (format.attr_len == 0) {
/* initialize vertex format */
attr_id.pos = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
- attr_id.nor = GPU_vertformat_attr_add(&format, "nor", GPU_COMP_I16, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ attr_id.nor = GPU_vertformat_attr_add(&format, "nor", GPU_COMP_I10, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
}
GPU_vertbuf_init_with_format(vbo, &format);
@@ -195,9 +191,8 @@ void DRW_displist_vertbuf_create_pos_and_nor(ListBase *lb, GPUVertBuf *vbo)
while (vbo_len_used < vbo_end) {
GPU_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, fp_co);
if (fp_no) {
- static short short_no[4];
- normal_float_to_short_v3(short_no, fp_no);
- GPU_vertbuf_attr_set(vbo, attr_id.nor, vbo_len_used, short_no);
+ GPUPackedNormal vnor_pack = GPU_normal_convert_i10_v3(fp_no);
+ GPU_vertbuf_attr_set(vbo, attr_id.nor, vbo_len_used, &vnor_pack);
if (ndata_is_single == false) {
fp_no += 3;
}
@@ -209,6 +204,38 @@ void DRW_displist_vertbuf_create_pos_and_nor(ListBase *lb, GPUVertBuf *vbo)
}
}
+void DRW_displist_vertbuf_create_wiredata(ListBase *lb, GPUVertBuf *vbo)
+{
+ static GPUVertFormat format = { 0 };
+ static struct { uint wd; } attr_id;
+ if (format.attr_len == 0) {
+ /* initialize vertex format */
+ if (!GPU_crappy_amd_driver()) {
+ /* Some AMD drivers strangely crash with a vbo with this format. */
+ attr_id.wd = GPU_vertformat_attr_add(&format, "wd", GPU_COMP_U8, 1, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ }
+ else {
+ attr_id.wd = GPU_vertformat_attr_add(&format, "wd", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
+ }
+ }
+
+ int vbo_len_used = curve_render_surface_vert_len_get(lb);
+
+ GPU_vertbuf_init_with_format(vbo, &format);
+ GPU_vertbuf_data_alloc(vbo, vbo_len_used);
+
+ if (vbo->format.stride == 1) {
+ memset(vbo->data, 0xFF, (size_t)vbo_len_used);
+ }
+ else {
+ GPUVertBufRaw wd_step;
+ GPU_vertbuf_attr_get_raw_data(vbo, attr_id.wd, &wd_step);
+ for (int i = 0; i < vbo_len_used; i++) {
+ *((float *)GPU_vertbuf_raw_step(&wd_step)) = 1.0f;
+ }
+ }
+}
+
void DRW_displist_indexbuf_create_triangles_in_order(ListBase *lb, GPUIndexBuf *ibo)
{
const int tri_len = curve_render_surface_tri_len_get(lb);
@@ -229,7 +256,7 @@ void DRW_displist_indexbuf_create_triangles_in_order(ListBase *lb, GPUIndexBuf *
GPU_indexbuf_build_in_place(&elb, ibo);
}
-void DRW_displist_indexbuf_create_triangles_tess_split_by_material(
+void DRW_displist_indexbuf_create_triangles_loop_split_by_material(
ListBase *lb,
GPUIndexBuf **ibo_mats, uint mat_len)
{
@@ -257,65 +284,39 @@ void DRW_displist_indexbuf_create_triangles_tess_split_by_material(
}
}
-typedef struct DRWDisplistWireThunk {
- uint wd_id, ofs;
- const DispList *dl;
- GPUVertBuf *vbo;
-} DRWDisplistWireThunk;
-
static void set_overlay_wires_tri_indices(void *thunk, uint v1, uint v2, uint v3)
{
- DRWDisplistWireThunk *dwt = (DRWDisplistWireThunk *)thunk;
- uint indices[3] = {v1, v2, v3};
-
- for (int i = 0; i < 3; ++i) {
- /* TODO: Compute sharpness. For now, only tag real egdes. */
- uchar sharpness = 0xFF;
- GPU_vertbuf_attr_set(dwt->vbo, dwt->wd_id, indices[i], &sharpness);
- }
+ GPUIndexBufBuilder *eld = (GPUIndexBufBuilder *)thunk;
+ GPU_indexbuf_add_line_verts(eld, v1, v2);
+ GPU_indexbuf_add_line_verts(eld, v2, v3);
+ GPU_indexbuf_add_line_verts(eld, v3, v1);
}
static void set_overlay_wires_quad_tri_indices(void *thunk, uint v1, uint v2, uint v3)
{
- DRWDisplistWireThunk *dwt = (DRWDisplistWireThunk *)thunk;
- uint indices[3] = {v1, v2, v3};
-
- for (int i = 0; i < 3; ++i) {
- /* TODO: Compute sharpness. For now, only tag real egdes. */
- uchar sharpness = (i == 0) ? 0x00 : 0xFF;
- GPU_vertbuf_attr_set(dwt->vbo, dwt->wd_id, indices[i], &sharpness);
- }
+ GPUIndexBufBuilder *eld = (GPUIndexBufBuilder *)thunk;
+ GPU_indexbuf_add_line_verts(eld, v1, v3);
+ GPU_indexbuf_add_line_verts(eld, v3, v2);
}
-/* TODO reuse the position and normals from other tesselation vertbuf. */
-void DRW_displist_vertbuf_create_wireframe_data_tess(ListBase *lb, GPUVertBuf *vbo)
+void DRW_displist_indexbuf_create_lines_in_order(ListBase *lb, GPUIndexBuf *ibo)
{
- static DRWDisplistWireThunk thunk;
- static GPUVertFormat format = {0};
- if (format.attr_len == 0) {
- thunk.wd_id = GPU_vertformat_attr_add(&format, "wd", GPU_COMP_U8, 1, GPU_FETCH_INT_TO_FLOAT_UNIT);
- GPU_vertformat_triple_load(&format);
- }
-
- GPU_vertbuf_init_with_format(vbo, &format);
- thunk.vbo = vbo;
+ const int tri_len = curve_render_surface_tri_len_get(lb);
+ const int vert_len = curve_render_surface_vert_len_get(lb);
- int vert_len = curve_render_surface_tri_len_get(lb) * 3;
- GPU_vertbuf_data_alloc(thunk.vbo, vert_len);
+ GPUIndexBufBuilder elb;
+ GPU_indexbuf_init(&elb, GPU_PRIM_LINES, tri_len * 3, vert_len);
- thunk.ofs = 0;
+ int ofs = 0;
for (const DispList *dl = lb->first; dl; dl = dl->next) {
- thunk.dl = dl;
- /* TODO consider non-manifold edges correctly. */
- thunk.ofs = displist_indexbufbuilder_tess_set(
- set_overlay_wires_tri_indices,
- set_overlay_wires_quad_tri_indices,
- &thunk, dl, thunk.ofs);
+ displist_indexbufbuilder_set(
+ (SetTriIndicesFn *)set_overlay_wires_tri_indices,
+ (SetTriIndicesFn *)set_overlay_wires_quad_tri_indices,
+ &elb, dl, ofs);
+ ofs += dl_vert_len(dl);
}
- if (thunk.ofs < vert_len) {
- GPU_vertbuf_data_resize(thunk.vbo, thunk.ofs);
- }
+ GPU_indexbuf_build_in_place(&elb, ibo);
}
static void surf_uv_quad(const DispList *dl, const uint quad[4], float r_uv[4][2])
@@ -369,7 +370,7 @@ static void displist_vertbuf_attr_set_tri_pos_nor_uv(
}
}
-void DRW_displist_vertbuf_create_pos_and_nor_and_uv_tess(
+void DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv(
ListBase *lb,
GPUVertBuf *vbo_pos_nor, GPUVertBuf *vbo_uv)
{
diff --git a/source/blender/draw/intern/draw_cache_impl_lattice.c b/source/blender/draw/intern/draw_cache_impl_lattice.c
index 12f80c4e8e9..12763467f8c 100644
--- a/source/blender/draw/intern/draw_cache_impl_lattice.c
+++ b/source/blender/draw/intern/draw_cache_impl_lattice.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2017 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Mike Erwin, Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file draw_cache_impl_lattice.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*
* \brief Lattice API for render engines
*/
@@ -426,6 +420,7 @@ static GPUVertBuf *lattice_batch_cache_get_pos(LatticeRenderData *rdata, Lattice
if (use_weight) {
float w_col[4];
lattice_render_data_weight_col_get(rdata, i, actdef, w_col);
+ w_col[3] = 1.0f;
GPU_vertbuf_attr_set(cache->pos, attr_id.col, i, w_col);
}
@@ -518,10 +513,10 @@ static void lattice_batch_cache_create_overlay_batches(Lattice *lt)
char vflag = 0;
if (bp->f1 & SELECT) {
if (i == rdata->actbp) {
- vflag |= VFLAG_VERTEX_ACTIVE;
+ vflag |= VFLAG_VERT_ACTIVE;
}
else {
- vflag |= VFLAG_VERTEX_SELECTED;
+ vflag |= VFLAG_VERT_SELECTED;
}
}
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 9d9f7c47b14..890181a532a 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2017 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Mike Erwin, Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file draw_cache_impl_mesh.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*
* \brief Mesh API for render engines
*/
@@ -35,7 +29,6 @@
#include "BLI_utildefines.h"
#include "BLI_math_vector.h"
#include "BLI_math_bits.h"
-#include "BLI_math_color.h"
#include "BLI_string.h"
#include "BLI_alloca.h"
#include "BLI_edgehash.h"
@@ -43,7 +36,6 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "BKE_customdata.h"
@@ -54,23 +46,17 @@
#include "BKE_mesh.h"
#include "BKE_mesh_tangent.h"
#include "BKE_mesh_runtime.h"
-#include "BKE_object.h"
#include "BKE_object_deform.h"
-#include "BKE_colorband.h"
-#include "BKE_cdderivedmesh.h"
-#include "DEG_depsgraph_query.h"
#include "bmesh.h"
#include "GPU_batch.h"
-#include "GPU_batch_presets.h"
-#include "GPU_draw.h"
+#include "GPU_extensions.h"
#include "GPU_material.h"
#include "DRW_render.h"
-#include "ED_image.h"
#include "ED_mesh.h"
#include "ED_uvedit.h"
@@ -99,28 +85,27 @@ enum {
};
/* ---------------------------------------------------------------------- */
-
/** \name Mesh/BMesh Interface (direct access to basic data).
* \{ */
static int mesh_render_verts_len_get(Mesh *me)
{
- return me->edit_btmesh ? me->edit_btmesh->bm->totvert : me->totvert;
+ return me->edit_mesh ? me->edit_mesh->bm->totvert : me->totvert;
}
static int mesh_render_edges_len_get(Mesh *me)
{
- return me->edit_btmesh ? me->edit_btmesh->bm->totedge : me->totedge;
+ return me->edit_mesh ? me->edit_mesh->bm->totedge : me->totedge;
}
static int mesh_render_looptri_len_get(Mesh *me)
{
- return me->edit_btmesh ? me->edit_btmesh->tottri : poly_to_tri_count(me->totpoly, me->totloop);
+ return me->edit_mesh ? me->edit_mesh->tottri : poly_to_tri_count(me->totpoly, me->totloop);
}
static int mesh_render_polys_len_get(Mesh *me)
{
- return me->edit_btmesh ? me->edit_btmesh->bm->totface : me->totpoly;
+ return me->edit_mesh ? me->edit_mesh->bm->totface : me->totpoly;
}
static int mesh_render_mat_len_get(Mesh *me)
@@ -130,14 +115,13 @@ static int mesh_render_mat_len_get(Mesh *me)
static int UNUSED_FUNCTION(mesh_render_loops_len_get)(Mesh *me)
{
- return me->edit_btmesh ? me->edit_btmesh->bm->totloop : me->totloop;
+ return me->edit_mesh ? me->edit_mesh->bm->totloop : me->totloop;
}
/** \} */
/* ---------------------------------------------------------------------- */
-
/** \name Mesh/BMesh Interface (indirect, partially cached access to complex data).
* \{ */
@@ -198,6 +182,7 @@ typedef struct MeshRenderData {
BMEditMesh *edit_bmesh;
struct EditMeshData *edit_data;
+ const ToolSettings *toolsettings;
Mesh *me;
@@ -260,6 +245,7 @@ typedef struct MeshRenderData {
BMVert *eve_act;
BMEdge *eed_act;
BMFace *efa_act;
+ BMFace *efa_act_uv;
/* Data created on-demand (usually not for bmesh-based data). */
EdgeAdjacentPolys *edges_adjacent_polys;
@@ -320,6 +306,18 @@ static bool bm_edge_has_visible_face(const BMEdge *e)
return false;
}
+BLI_INLINE bool bm_vert_is_loose_and_visible(const BMVert *v)
+{
+ return (!BM_elem_flag_test(v, BM_ELEM_HIDDEN) &&
+ (v->e == NULL || !bm_vert_has_visible_edge(v)));
+}
+
+BLI_INLINE bool bm_edge_is_loose_and_visible(const BMEdge *e)
+{
+ return (!BM_elem_flag_test(e, BM_ELEM_HIDDEN) &&
+ (e->l == NULL || !bm_edge_has_visible_face(e)));
+}
+
/* Return true is all layers in _b_ are inside _a_. */
static bool mesh_cd_layers_type_overlap(
const uchar av[CD_NUMTYPES], const ushort al[CD_NUMTYPES],
@@ -349,7 +347,7 @@ static void mesh_cd_layers_type_merge(
static void mesh_cd_calc_active_uv_layer(
const Mesh *me, ushort cd_lused[CD_NUMTYPES])
{
- const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
+ const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPUV);
if (layer != -1) {
@@ -360,7 +358,7 @@ static void mesh_cd_calc_active_uv_layer(
static void mesh_cd_calc_active_vcol_layer(
const Mesh *me, ushort cd_lused[CD_NUMTYPES])
{
- const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
+ const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL);
if (layer != -1) {
@@ -372,18 +370,18 @@ static void mesh_cd_calc_used_gpu_layers(
const Mesh *me, uchar cd_vused[CD_NUMTYPES], ushort cd_lused[CD_NUMTYPES],
struct GPUMaterial **gpumat_array, int gpumat_array_len)
{
- const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
+ const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
/* See: DM_vertex_attributes_from_gpu for similar logic */
- GPUVertexAttribs gattribs = {{{0}}};
+ GPUVertAttrLayers gpu_attrs = {{{0}}};
for (int i = 0; i < gpumat_array_len; i++) {
GPUMaterial *gpumat = gpumat_array[i];
if (gpumat) {
- GPU_material_vertex_attributes(gpumat, &gattribs);
- for (int j = 0; j < gattribs.totlayer; j++) {
- const char *name = gattribs.layer[j].name;
- int type = gattribs.layer[j].type;
+ GPU_material_vertex_attrs(gpumat, &gpu_attrs);
+ for (int j = 0; j < gpu_attrs.totlayer; j++) {
+ const char *name = gpu_attrs.layer[j].name;
+ int type = gpu_attrs.layer[j].type;
int layer = -1;
if (type == CD_AUTO_FROM_NAME) {
@@ -434,6 +432,11 @@ static void mesh_cd_calc_used_gpu_layers(
layer = (name[0] != '\0') ?
CustomData_get_named_layer(cd_ldata, CD_MLOOPUV, name) :
CustomData_get_active_layer(cd_ldata, CD_MLOOPUV);
+
+ /* Only fallback to orco (below) when we have no UV layers, see: T56545 */
+ if (layer == -1 && name[0] != '\0') {
+ layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPUV);
+ }
}
if (layer != -1) {
cd_lused[CD_TANGENT] |= (1 << layer);
@@ -498,7 +501,7 @@ static void mesh_cd_extract_auto_layers_names_and_srgb(
Mesh *me, const ushort cd_lused[CD_NUMTYPES],
char **r_auto_layers_names, int **r_auto_layers_srgb, int *r_auto_layers_len)
{
- const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
+ const CustomData *cd_ldata = (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
int uv_len_used = count_bits_i(cd_lused[CD_MLOOPUV]);
int vcol_len_used = count_bits_i(cd_lused[CD_MLOOPCOL]);
@@ -549,10 +552,12 @@ static void mesh_cd_extract_auto_layers_names_and_srgb(
* Although this only impacts the data that's generated, not the materials that display.
*/
static MeshRenderData *mesh_render_data_create_ex(
- Mesh *me, const int types, const uchar cd_vused[CD_NUMTYPES], const ushort cd_lused[CD_NUMTYPES])
+ Mesh *me, const int types, const uchar cd_vused[CD_NUMTYPES], const ushort cd_lused[CD_NUMTYPES],
+ const ToolSettings *ts)
{
MeshRenderData *rdata = MEM_callocN(sizeof(*rdata), __func__);
rdata->types = types;
+ rdata->toolsettings = ts;
rdata->mat_len = mesh_render_mat_len_get(me);
CustomData_reset(&rdata->cd.output.ldata);
@@ -560,8 +565,8 @@ static MeshRenderData *mesh_render_data_create_ex(
const bool is_auto_smooth = (me->flag & ME_AUTOSMOOTH) != 0;
const float split_angle = is_auto_smooth ? me->smoothresh : (float)M_PI;
- if (me->edit_btmesh) {
- BMEditMesh *embm = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *embm = me->edit_mesh;
BMesh *bm = embm->bm;
rdata->edit_bmesh = embm;
@@ -586,6 +591,9 @@ static MeshRenderData *mesh_render_data_create_ex(
if (types & MR_DATATYPE_LOOPTRI) {
rdata->mapped.tri_len = poly_to_tri_count(me_cage->totpoly, me_cage->totloop);
}
+ if (types & MR_DATATYPE_LOOPUV) {
+ rdata->mloopuv = CustomData_get_layer(&me_cage->ldata, CD_MLOOPUV);
+ }
rdata->mapped.v_origindex = CustomData_get_layer(&me_cage->vdata, CD_ORIGINDEX);
rdata->mapped.e_origindex = CustomData_get_layer(&me_cage->edata, CD_ORIGINDEX);
@@ -626,6 +634,7 @@ static MeshRenderData *mesh_render_data_create_ex(
bm_ensure_types |= BM_FACE;
}
if (types & MR_DATATYPE_OVERLAY) {
+ rdata->efa_act_uv = EDBM_uv_active_face_get(embm, false, false);
rdata->efa_act = BM_mesh_active_face_get(bm, false, true);
rdata->eed_act = BM_mesh_active_edge_get(bm);
rdata->eve_act = BM_mesh_active_vert_get(bm);
@@ -672,11 +681,8 @@ static MeshRenderData *mesh_render_data_create_ex(
BLI_assert((bm->elem_table_dirty & BM_VERT) == 0);
for (int i = 0; i < bm->totvert; i++) {
const BMVert *eve = BM_vert_at_index(bm, i);
- if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- /* Loose vert */
- if (eve->e == NULL || !bm_vert_has_visible_edge(eve)) {
- lverts[rdata->loose_vert_len++] = i;
- }
+ if (bm_vert_is_loose_and_visible(eve)) {
+ lverts[rdata->loose_vert_len++] = i;
}
}
rdata->loose_verts = MEM_reallocN(lverts, rdata->loose_vert_len * sizeof(int));
@@ -693,11 +699,8 @@ static MeshRenderData *mesh_render_data_create_ex(
const int v_orig = v_origindex[i];
if (v_orig != ORIGINDEX_NONE) {
BMVert *eve = BM_vert_at_index(bm, v_orig);
- if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- /* Loose vert */
- if (eve->e == NULL || !bm_vert_has_visible_edge(eve)) {
- lverts[rdata->mapped.loose_vert_len++] = i;
- }
+ if (bm_vert_is_loose_and_visible(eve)) {
+ lverts[rdata->mapped.loose_vert_len++] = i;
}
}
}
@@ -715,11 +718,8 @@ static MeshRenderData *mesh_render_data_create_ex(
BLI_assert((bm->elem_table_dirty & BM_EDGE) == 0);
for (int i = 0; i < bm->totedge; i++) {
const BMEdge *eed = BM_edge_at_index(bm, i);
- if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
- /* Loose edge */
- if (eed->l == NULL || !bm_edge_has_visible_face(eed)) {
- ledges[rdata->loose_edge_len++] = i;
- }
+ if (bm_edge_is_loose_and_visible(eed)) {
+ ledges[rdata->loose_edge_len++] = i;
}
}
rdata->loose_edges = MEM_reallocN(ledges, rdata->loose_edge_len * sizeof(int));
@@ -736,11 +736,8 @@ static MeshRenderData *mesh_render_data_create_ex(
const int e_orig = e_origindex[i];
if (e_orig != ORIGINDEX_NONE) {
BMEdge *eed = BM_edge_at_index(bm, e_orig);
- if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
- /* Loose edge */
- if (eed->l == NULL || !bm_edge_has_visible_face(eed)) {
- ledges[rdata->mapped.loose_edge_len++] = i;
- }
+ if (bm_edge_is_loose_and_visible(eed)) {
+ ledges[rdata->mapped.loose_edge_len++] = i;
}
}
}
@@ -797,8 +794,8 @@ static MeshRenderData *mesh_render_data_create_ex(
BLI_assert(cd_vused != NULL && cd_lused != NULL);
- if (me->edit_btmesh) {
- BMesh *bm = me->edit_btmesh->bm;
+ if (me->edit_mesh) {
+ BMesh *bm = me->edit_mesh->bm;
cd_vdata = &bm->vdata;
cd_ldata = &bm->ldata;
}
@@ -828,8 +825,8 @@ static MeshRenderData *mesh_render_data_create_ex(
/* If orco is not available compute it ourselves */
if (!rdata->orco) {
rdata->is_orco_allocated = true;
- if (me->edit_btmesh) {
- BMesh *bm = me->edit_btmesh->bm;
+ if (me->edit_mesh) {
+ BMesh *bm = me->edit_mesh->bm;
rdata->orco = MEM_mallocN(sizeof(*rdata->orco) * rdata->vert_len, "orco mesh");
BLI_assert((bm->elem_table_dirty & BM_VERT) == 0);
for (int i = 0; i < bm->totvert; i++) {
@@ -863,9 +860,9 @@ static MeshRenderData *mesh_render_data_create_ex(
.vcol_len = CustomData_number_of_layers(cd_ldata, CD_MLOOPCOL),
};
- rdata->cd.layers.uv_len = count_bits_i(cd_lused[CD_MLOOPUV]);
+ rdata->cd.layers.uv_len = min_ii(cd_layers_src.uv_len, count_bits_i(cd_lused[CD_MLOOPUV]));
rdata->cd.layers.tangent_len = count_bits_i(cd_lused[CD_TANGENT]);
- rdata->cd.layers.vcol_len = count_bits_i(cd_lused[CD_MLOOPCOL]);
+ rdata->cd.layers.vcol_len = min_ii(cd_layers_src.vcol_len, count_bits_i(cd_lused[CD_MLOOPCOL]));
rdata->cd.layers.uv = MEM_mallocN(sizeof(*rdata->cd.layers.uv) * rdata->cd.layers.uv_len, __func__);
rdata->cd.layers.vcol = MEM_mallocN(sizeof(*rdata->cd.layers.vcol) * rdata->cd.layers.vcol_len, __func__);
@@ -1075,12 +1072,12 @@ static MeshRenderData *mesh_render_data_create_ex(
#define MBC_GET_FINAL_MESH(me) \
/* Hack to show the final result. */ \
const bool _use_em_final = ( \
- (me)->edit_btmesh && \
- (me)->edit_btmesh->mesh_eval_final && \
- ((me)->edit_btmesh->mesh_eval_final->runtime.is_original == false)); \
+ (me)->edit_mesh && \
+ (me)->edit_mesh->mesh_eval_final && \
+ ((me)->edit_mesh->mesh_eval_final->runtime.is_original == false)); \
Mesh _me_fake; \
if (_use_em_final) { \
- _me_fake = *(me)->edit_btmesh->mesh_eval_final; \
+ _me_fake = *(me)->edit_mesh->mesh_eval_final; \
_me_fake.mat = (me)->mat; \
_me_fake.totcol = (me)->totcol; \
(me) = &_me_fake; \
@@ -1122,15 +1119,9 @@ static void mesh_render_data_free(MeshRenderData *rdata)
MEM_freeN(rdata);
}
-static MeshRenderData *mesh_render_data_create(Mesh *me, const int types)
-{
- return mesh_render_data_create_ex(me, types, NULL, NULL);
-}
-
/** \} */
/* ---------------------------------------------------------------------- */
-
/** \name Accessor Functions
* \{ */
@@ -1177,16 +1168,16 @@ static int mesh_render_data_verts_len_get_maybe_mapped(const MeshRenderData *rda
static int UNUSED_FUNCTION(mesh_render_data_loose_verts_len_get)(const MeshRenderData *rdata)
{
- BLI_assert(rdata->types & MR_DATATYPE_OVERLAY);
+ BLI_assert(rdata->types & MR_DATATYPE_LOOSE_VERT);
return rdata->loose_vert_len;
}
static int mesh_render_data_loose_verts_len_get_maybe_mapped(const MeshRenderData *rdata)
{
- BLI_assert(rdata->types & MR_DATATYPE_OVERLAY);
+ BLI_assert(rdata->types & MR_DATATYPE_LOOSE_VERT);
return ((rdata->mapped.use == false) ? rdata->loose_vert_len : rdata->mapped.loose_vert_len);
}
-static int UNUSED_FUNCTION(mesh_render_data_edges_len_get)(const MeshRenderData *rdata)
+static int mesh_render_data_edges_len_get(const MeshRenderData *rdata)
{
BLI_assert(rdata->types & MR_DATATYPE_EDGE);
return rdata->edge_len;
@@ -1199,12 +1190,12 @@ static int mesh_render_data_edges_len_get_maybe_mapped(const MeshRenderData *rda
static int UNUSED_FUNCTION(mesh_render_data_loose_edges_len_get)(const MeshRenderData *rdata)
{
- BLI_assert(rdata->types & MR_DATATYPE_OVERLAY);
+ BLI_assert(rdata->types & MR_DATATYPE_LOOSE_EDGE);
return rdata->loose_edge_len;
}
static int mesh_render_data_loose_edges_len_get_maybe_mapped(const MeshRenderData *rdata)
{
- BLI_assert(rdata->types & MR_DATATYPE_OVERLAY);
+ BLI_assert(rdata->types & MR_DATATYPE_LOOSE_EDGE);
return ((rdata->mapped.use == false) ? rdata->loose_edge_len : rdata->mapped.loose_edge_len);
}
@@ -1231,6 +1222,12 @@ static int mesh_render_data_loops_len_get(const MeshRenderData *rdata)
return rdata->loop_len;
}
+static int mesh_render_data_loops_len_get_maybe_mapped(const MeshRenderData *rdata)
+{
+ BLI_assert(rdata->types & MR_DATATYPE_LOOP);
+ return ((rdata->mapped.use == false) ? rdata->loop_len : rdata->mapped.loop_len);
+}
+
static int mesh_render_data_polys_len_get(const MeshRenderData *rdata)
{
BLI_assert(rdata->types & MR_DATATYPE_POLY);
@@ -1248,7 +1245,7 @@ static int mesh_render_data_polys_len_get_maybe_mapped(const MeshRenderData *rda
/* ---------------------------------------------------------------------- */
/* TODO remove prototype. */
-static void mesh_create_edit_facedots(MeshRenderData *rdata, GPUVertBuf *vbo_pos_nor_data_facedots);
+static void mesh_create_edit_facedots(MeshRenderData *rdata, GPUVertBuf *vbo_facedots_pos_nor_data);
/** \name Internal Cache (Lazy Initialization)
* \{ */
@@ -1472,19 +1469,26 @@ fallback:
/** \} */
/* ---------------------------------------------------------------------- */
-
/** \name Internal Cache Generation
* \{ */
-static uchar mesh_render_data_looptri_flag(MeshRenderData *rdata, const BMFace *efa)
+static uchar mesh_render_data_face_flag(MeshRenderData *rdata, const BMFace *efa, const int cd_ofs)
{
uchar fflag = 0;
- if (efa == rdata->efa_act)
+ if (efa == rdata->efa_act) {
fflag |= VFLAG_FACE_ACTIVE;
-
- if (BM_elem_flag_test(efa, BM_ELEM_SELECT))
+ }
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
fflag |= VFLAG_FACE_SELECTED;
+ }
+
+ if (efa == rdata->efa_act_uv) {
+ fflag |= VFLAG_FACE_UV_ACTIVE;
+ }
+ if ((cd_ofs != -1) && uvedit_face_select_test_ex(rdata->toolsettings, (BMFace *)efa, cd_ofs)) {
+ fflag |= VFLAG_FACE_UV_SELECT;
+ }
#ifdef WITH_FREESTYLE
if (rdata->cd.offset.freestyle_face != -1) {
@@ -1502,19 +1506,44 @@ static void mesh_render_data_edge_flag(
const MeshRenderData *rdata, const BMEdge *eed,
EdgeDrawAttr *eattr)
{
- eattr->e_flag |= VFLAG_EDGE_EXISTS;
+ const ToolSettings *ts = rdata->toolsettings;
+ const bool is_vertex_select_mode = (ts != NULL) && (ts->selectmode & SCE_SELECT_VERTEX) != 0;
+ const bool is_face_only_select_mode = (ts != NULL) && (ts->selectmode == SCE_SELECT_FACE);
- if (eed == rdata->eed_act)
+ if (eed == rdata->eed_act) {
eattr->e_flag |= VFLAG_EDGE_ACTIVE;
-
- if (BM_elem_flag_test(eed, BM_ELEM_SELECT))
+ }
+ if (!is_vertex_select_mode &&
+ BM_elem_flag_test(eed, BM_ELEM_SELECT))
+ {
eattr->e_flag |= VFLAG_EDGE_SELECTED;
-
- if (BM_elem_flag_test(eed, BM_ELEM_SEAM))
+ }
+ if (is_vertex_select_mode &&
+ BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) &&
+ BM_elem_flag_test(eed->v2, BM_ELEM_SELECT))
+ {
+ eattr->e_flag |= VFLAG_EDGE_SELECTED;
+ eattr->e_flag |= VFLAG_VERT_SELECTED;
+ }
+ if (BM_elem_flag_test(eed, BM_ELEM_SEAM)) {
eattr->e_flag |= VFLAG_EDGE_SEAM;
-
- if (!BM_elem_flag_test(eed, BM_ELEM_SMOOTH))
+ }
+ if (!BM_elem_flag_test(eed, BM_ELEM_SMOOTH)) {
eattr->e_flag |= VFLAG_EDGE_SHARP;
+ }
+
+ /* Use active edge color for active face edges because
+ * specular highlights make it hard to see T55456#510873.
+ *
+ * This isn't ideal since it can't be used when mixing edge/face modes
+ * but it's still better then not being able to see the active face. */
+ if (is_face_only_select_mode) {
+ if (rdata->efa_act != NULL) {
+ if (BM_edge_in_face(eed, rdata->efa_act)) {
+ eattr->e_flag |= VFLAG_EDGE_ACTIVE;
+ }
+ }
+ }
/* Use a byte for value range */
if (rdata->cd.offset.crease != -1) {
@@ -1523,7 +1552,6 @@ static void mesh_render_data_edge_flag(
eattr->crease = (uchar)(crease * 255.0f);
}
}
-
/* Use a byte for value range */
if (rdata->cd.offset.bweight != -1) {
float bweight = BM_ELEM_CD_GET_FLOAT(eed, rdata->cd.offset.bweight);
@@ -1531,7 +1559,6 @@ static void mesh_render_data_edge_flag(
eattr->bweight = (uchar)(bweight * 255.0f);
}
}
-
#ifdef WITH_FREESTYLE
if (rdata->cd.offset.freestyle_edge != -1) {
const FreestyleEdge *fed = BM_ELEM_CD_GET_VOID_P(eed, rdata->cd.offset.freestyle_edge);
@@ -1542,286 +1569,30 @@ static void mesh_render_data_edge_flag(
#endif
}
-static uchar mesh_render_data_vertex_flag(MeshRenderData *rdata, const BMVert *eve)
-{
- uchar vflag = VFLAG_VERTEX_EXISTS;
-
- /* Current vertex */
- if (eve == rdata->eve_act)
- vflag |= VFLAG_VERTEX_ACTIVE;
-
- if (BM_elem_flag_test(eve, BM_ELEM_SELECT))
- vflag |= VFLAG_VERTEX_SELECTED;
-
- return vflag;
-}
-
-static void add_edit_tri(
- MeshRenderData *rdata, GPUVertBuf *vbo_pos_nor, GPUVertBuf *vbo_lnor, GPUVertBuf *vbo_data, GPUIndexBufBuilder *elb,
- const uint pos_id, const uint vnor_id, const uint lnor_id, const uint data_id,
- const BMLoop **bm_looptri, const int base_vert_idx)
-{
- uchar fflag;
- uchar vflag;
-
- /* Only draw vertices once. */
- if (elb) {
- for (int i = 0; i < 3; ++i) {
- if (!BM_elem_flag_test(bm_looptri[i]->v, BM_ELEM_TAG)) {
- BM_elem_flag_enable(bm_looptri[i]->v, BM_ELEM_TAG);
- GPU_indexbuf_add_generic_vert(elb, base_vert_idx + i);
- }
- }
- }
-
- if (vbo_pos_nor) {
- /* TODO(sybren): deduplicate this and all the other places it's pasted to in this file. */
- if (rdata->edit_data && rdata->edit_data->vertexCos) {
- for (uint i = 0; i < 3; i++) {
- int vidx = BM_elem_index_get(bm_looptri[i]->v);
- const float *pos = rdata->edit_data->vertexCos[vidx];
- GPU_vertbuf_attr_set(vbo_pos_nor, pos_id, base_vert_idx + i, pos);
- }
- }
- else {
- for (uint i = 0; i < 3; i++) {
- const float *pos = bm_looptri[i]->v->co;
- GPU_vertbuf_attr_set(vbo_pos_nor, pos_id, base_vert_idx + i, pos);
- }
- }
-
- for (uint i = 0; i < 3; i++) {
- GPUPackedNormal vnor = GPU_normal_convert_i10_v3(bm_looptri[i]->v->no);
- GPU_vertbuf_attr_set(vbo_pos_nor, vnor_id, base_vert_idx + i, &vnor);
- }
- }
-
- if (vbo_lnor) {
- float (*lnors)[3] = rdata->loop_normals;
- for (uint i = 0; i < 3; i++) {
- const float *nor = (lnors) ? lnors[BM_elem_index_get(bm_looptri[i])] : bm_looptri[0]->f->no;
- GPUPackedNormal lnor = GPU_normal_convert_i10_v3(nor);
- GPU_vertbuf_attr_set(vbo_lnor, lnor_id, base_vert_idx + i, &lnor);
- }
- }
-
- if (vbo_data) {
- fflag = mesh_render_data_looptri_flag(rdata, bm_looptri[0]->f);
- for (uint i = 0; i < 3; i++) {
- const int i_next = (i + 1) % 3;
- const int i_prev = (i + 2) % 3;
- vflag = mesh_render_data_vertex_flag(rdata, bm_looptri[i]->v);
- /* Opposite edge to the vertex at 'i'. */
- EdgeDrawAttr eattr = {0};
- const bool is_edge_real = (bm_looptri[i_next] == bm_looptri[i_prev]->prev);
- if (is_edge_real) {
- mesh_render_data_edge_flag(rdata, bm_looptri[i_next]->e, &eattr);
- }
- eattr.v_flag = fflag | vflag;
- GPU_vertbuf_attr_set(vbo_data, data_id, base_vert_idx + i, &eattr);
- }
- }
-}
-static bool add_edit_tri_mapped(
- MeshRenderData *rdata, GPUVertBuf *vbo_pos_nor, GPUVertBuf *vbo_lnor, GPUVertBuf *vbo_data, GPUIndexBufBuilder *elb,
- const uint pos_id, const uint vnor_id, const uint lnor_id, const uint data_id,
- BMFace *efa, const MLoopTri *mlt, const float (*poly_normals)[3], const float (*loop_normals)[3], const int base_vert_idx)
-{
- if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
- return false;
- }
-
- BMEditMesh *embm = rdata->edit_bmesh;
- BMesh *bm = embm->bm;
- Mesh *me_cage = embm->mesh_eval_cage;
-
- const MVert *mvert = me_cage->mvert;
- const MEdge *medge = me_cage->medge;
- const MLoop *mloop = me_cage->mloop;
-
- const int *v_origindex = rdata->mapped.v_origindex;
- const int *e_origindex = rdata->mapped.e_origindex;
-
- if (elb) {
- for (int i = 0; i < 3; ++i) {
- const int v_orig = v_origindex[mloop[mlt->tri[i]].v];
- if (v_orig == ORIGINDEX_NONE) {
- continue;
- }
- BMVert *v = BM_vert_at_index(bm, v_orig);
- if (!BM_elem_flag_test(v, BM_ELEM_TAG)) {
- BM_elem_flag_enable(v, BM_ELEM_TAG);
- GPU_indexbuf_add_generic_vert(elb, base_vert_idx + i);
- }
- }
- }
-
- if (vbo_pos_nor) {
- for (uint i = 0; i < 3; i++) {
- const float *pos = mvert[mloop[mlt->tri[i]].v].co;
- GPUPackedNormal vnor = GPU_normal_convert_i10_s3(mvert[mloop[mlt->tri[i]].v].no);
- GPU_vertbuf_attr_set(vbo_pos_nor, pos_id, base_vert_idx + i, pos);
- GPU_vertbuf_attr_set(vbo_pos_nor, vnor_id, base_vert_idx + i, &vnor);
- }
- }
-
- if (vbo_lnor) {
- for (uint i = 0; i < 3; i++) {
- const float *nor = loop_normals ? loop_normals[mlt->tri[i]] : poly_normals[mlt->poly];
- GPUPackedNormal lnor = GPU_normal_convert_i10_v3(nor);
- GPU_vertbuf_attr_set(vbo_lnor, lnor_id, base_vert_idx + i, &lnor);
- }
- }
-
- if (vbo_data) {
- EdgeDrawAttr eattr[3] = {{0}}; /* Importantly VFLAG_VERTEX_EXISTS is not set. */
- uchar fflag = mesh_render_data_looptri_flag(rdata, efa);
- for (uint i = 0; i < 3; i++) {
- const int i_next = (i + 1) % 3;
- const int i_prev = (i + 2) % 3;
- const int v_orig = v_origindex[mloop[mlt->tri[i]].v];
- if (v_orig != ORIGINDEX_NONE) {
- BMVert *v = BM_vert_at_index(bm, v_orig);
- eattr[i].v_flag |= mesh_render_data_vertex_flag(rdata, v);
- }
- /* Opposite edge to the vertex at 'i'. */
- const int e_idx = mloop[mlt->tri[i_next]].e;
- const int e_orig = e_origindex[e_idx];
- if (e_orig != ORIGINDEX_NONE) {
- const MEdge *ed = &medge[e_idx];
- const uint tri_edge[2] = {mloop[mlt->tri[i_prev]].v, mloop[mlt->tri[i_next]].v};
- const bool is_edge_real = (
- ((ed->v1 == tri_edge[0]) && (ed->v2 == tri_edge[1])) ||
- ((ed->v1 == tri_edge[1]) && (ed->v2 == tri_edge[0])));
- if (is_edge_real) {
- BMEdge *eed = BM_edge_at_index(bm, e_orig);
- mesh_render_data_edge_flag(rdata, eed, &eattr[i]);
- /* Set vertex selected if both original verts are selected. */
- if (BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) &&
- BM_elem_flag_test(eed->v2, BM_ELEM_SELECT))
- {
- eattr[i_next].v_flag |= VFLAG_VERTEX_SELECTED;
- eattr[i_prev].v_flag |= VFLAG_VERTEX_SELECTED;
- }
- }
- }
- }
- for (uint i = 0; i < 3; i++) {
- eattr[i].v_flag |= fflag;
- GPU_vertbuf_attr_set(vbo_data, data_id, base_vert_idx + i, &eattr[i]);
- }
- }
-
- return true;
-}
-
-static void add_edit_loose_edge(
- MeshRenderData *rdata, GPUVertBuf *vbo_pos_nor, GPUVertBuf *vbo_data,
- const uint pos_id, const uint vnor_id, const uint data_id,
- const BMEdge *eed, const int base_vert_idx)
+static void mesh_render_data_loop_flag(MeshRenderData *rdata, BMLoop *loop, const int cd_ofs, EdgeDrawAttr *eattr)
{
- if (vbo_pos_nor) {
- /* TODO(sybren): deduplicate this and all the other places it's pasted to in this file. */
- if (rdata->edit_data && rdata->edit_data->vertexCos) {
- for (uint i = 0; i < 2; i++) {
- int vidx = BM_elem_index_get((&eed->v1)[i]);
- const float *pos = rdata->edit_data->vertexCos[vidx];
- GPU_vertbuf_attr_set(vbo_pos_nor, pos_id, base_vert_idx + i, pos);
- }
- }
- else {
- for (int i = 0; i < 2; i++) {
- const float *pos = (&eed->v1)[i]->co;
- GPU_vertbuf_attr_set(vbo_pos_nor, pos_id, base_vert_idx + i, pos);
- }
- }
-
- for (int i = 0; i < 2; i++) {
- GPUPackedNormal vnor = GPU_normal_convert_i10_v3((&eed->v1)[i]->no);
- GPU_vertbuf_attr_set(vbo_pos_nor, vnor_id, base_vert_idx + i, &vnor);
- }
+ if (cd_ofs == -1) {
+ return;
}
-
- if (vbo_data) {
- EdgeDrawAttr eattr = {0};
- mesh_render_data_edge_flag(rdata, eed, &eattr);
- for (int i = 0; i < 2; i++) {
- eattr.v_flag = mesh_render_data_vertex_flag(rdata, (&eed->v1)[i]);
- GPU_vertbuf_attr_set(vbo_data, data_id, base_vert_idx + i, &eattr);
- }
+ MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, cd_ofs);
+ if (luv != NULL && (luv->flag & MLOOPUV_PINNED)) {
+ eattr->v_flag |= VFLAG_VERT_UV_PINNED;
}
-}
-static void add_edit_loose_edge_mapped(
- MeshRenderData *rdata, GPUVertBuf *vbo_pos_nor, GPUVertBuf *vbo_data,
- const uint pos_id, const uint vnor_id, const uint data_id,
- BMEdge *eed, const MVert *mvert, const MEdge *ed, const int base_vert_idx)
-{
- if (vbo_pos_nor) {
- /* TODO(sybren): deduplicate this and all the other places it's pasted to in this file. */
- for (int i = 0; i < 2; i++) {
- const float *pos = mvert[*(&ed->v1 + i)].co;
- GPU_vertbuf_attr_set(vbo_pos_nor, pos_id, base_vert_idx + i, pos);
-
- GPUPackedNormal vnor = GPU_normal_convert_i10_s3(mvert[*(&ed->v1 + i)].no);
- GPU_vertbuf_attr_set(vbo_pos_nor, vnor_id, base_vert_idx + i, &vnor);
- }
+ if (uvedit_uv_select_test_ex(rdata->toolsettings, loop, cd_ofs)) {
+ eattr->v_flag |= VFLAG_VERT_UV_SELECT;
}
-
- if (vbo_data) {
- EdgeDrawAttr eattr = {0};
- mesh_render_data_edge_flag(rdata, eed, &eattr);
- for (int i = 0; i < 2; i++) {
- const int v_orig = rdata->mapped.v_origindex[*(&ed->v1 + i)];
- eattr.v_flag = (v_orig != ORIGINDEX_NONE) ? mesh_render_data_vertex_flag(rdata, (&eed->v1)[i]) : 0;
- GPU_vertbuf_attr_set(vbo_data, data_id, base_vert_idx + i, &eattr);
- }
+ if (uvedit_edge_select_test_ex(rdata->toolsettings, loop, cd_ofs)) {
+ eattr->v_flag |= VFLAG_EDGE_UV_SELECT;
}
}
-static void add_edit_loose_vert(
- MeshRenderData *rdata, GPUVertBuf *vbo_pos_nor, GPUVertBuf *vbo_data,
- const uint pos_id, const uint vnor_id, const uint data_id,
- const BMVert *eve, const int base_vert_idx)
-{
- if (vbo_pos_nor) {
- /* TODO(sybren): deduplicate this and all the other places it's pasted to in this file. */
- if (rdata->edit_data && rdata->edit_data->vertexCos) {
- int vidx = BM_elem_index_get(eve);
- const float *pos = rdata->edit_data->vertexCos[vidx];
- GPU_vertbuf_attr_set(vbo_pos_nor, pos_id, base_vert_idx, pos);
- }
- else {
- const float *pos = eve->co;
- GPU_vertbuf_attr_set(vbo_pos_nor, pos_id, base_vert_idx, pos);
- }
-
- GPUPackedNormal vnor = GPU_normal_convert_i10_v3(eve->no);
- GPU_vertbuf_attr_set(vbo_pos_nor, vnor_id, base_vert_idx, &vnor);
- }
-
- if (vbo_data) {
- uchar vflag[4] = {0, 0, 0, 0};
- vflag[0] = mesh_render_data_vertex_flag(rdata, eve);
- GPU_vertbuf_attr_set(vbo_data, data_id, base_vert_idx, vflag);
- }
-}
-static void add_edit_loose_vert_mapped(
- MeshRenderData *rdata, GPUVertBuf *vbo_pos_nor, GPUVertBuf *vbo_data,
- const uint pos_id, const uint vnor_id, const uint data_id,
- const BMVert *eve, const MVert *mv, const int base_vert_idx)
+static void mesh_render_data_vert_flag(MeshRenderData *rdata, const BMVert *eve, EdgeDrawAttr *eattr)
{
- if (vbo_pos_nor) {
- const float *pos = mv->co;
- GPU_vertbuf_attr_set(vbo_pos_nor, pos_id, base_vert_idx, pos);
-
- GPUPackedNormal vnor = GPU_normal_convert_i10_s3(mv->no);
- GPU_vertbuf_attr_set(vbo_pos_nor, vnor_id, base_vert_idx, &vnor);
+ if (eve == rdata->eve_act) {
+ eattr->e_flag |= VFLAG_VERT_ACTIVE;
}
-
- if (vbo_data) {
- uchar vflag[4] = {0, 0, 0, 0};
- vflag[0] = mesh_render_data_vertex_flag(rdata, eve);
- GPU_vertbuf_attr_set(vbo_data, data_id, base_vert_idx, vflag);
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ eattr->e_flag |= VFLAG_VERT_SELECTED;
}
}
@@ -1832,9 +1603,10 @@ static bool add_edit_facedot(
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY));
float pnor[3], center[3];
- bool selected;
+ int facedot_flag;
if (rdata->edit_bmesh) {
- const BMFace *efa = BM_face_at_index(rdata->edit_bmesh->bm, poly);
+ BMEditMesh *em = rdata->edit_bmesh;
+ const BMFace *efa = BM_face_at_index(em->bm, poly);
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
return false;
}
@@ -1846,7 +1618,7 @@ static bool add_edit_facedot(
BM_face_calc_center_median(efa, center);
copy_v3_v3(pnor, efa->no);
}
- selected = (BM_elem_flag_test(efa, BM_ELEM_SELECT) != 0) ? true : false;
+ facedot_flag = BM_elem_flag_test(efa, BM_ELEM_SELECT) ? ((efa == em->bm->act_face) ? -1 : 1) : 0;
}
else {
MVert *mvert = rdata->mvert;
@@ -1855,12 +1627,12 @@ static bool add_edit_facedot(
BKE_mesh_calc_poly_center(mpoly, mloop, mvert, center);
BKE_mesh_calc_poly_normal(mpoly, mloop, mvert, pnor);
-
- selected = false; /* No selection if not in edit mode */
+ /* No selection if not in edit mode. */
+ facedot_flag = 0;
}
GPUPackedNormal nor = GPU_normal_convert_i10_v3(pnor);
- nor.w = (selected) ? 1 : 0;
+ nor.w = facedot_flag;
GPU_vertbuf_attr_set(vbo, fdot_nor_flag_id, base_vert_idx, &nor);
GPU_vertbuf_attr_set(vbo, fdot_pos_id, base_vert_idx, center);
@@ -1879,7 +1651,7 @@ static bool add_edit_facedot_mapped(
return false;
}
BMEditMesh *em = rdata->edit_bmesh;
- const BMFace *efa = BM_face_at_index(rdata->edit_bmesh->bm, p_orig);
+ const BMFace *efa = BM_face_at_index(em->bm, p_orig);
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
return false;
}
@@ -1896,7 +1668,7 @@ static bool add_edit_facedot_mapped(
BKE_mesh_calc_poly_normal(mp, ml, mvert, pnor);
GPUPackedNormal nor = GPU_normal_convert_i10_v3(pnor);
- nor.w = (BM_elem_flag_test(efa, BM_ELEM_SELECT) != 0) ? 1 : 0;
+ nor.w = BM_elem_flag_test(efa, BM_ELEM_SELECT) ? ((efa == em->bm->act_face) ? -1 : 1) : 0;
GPU_vertbuf_attr_set(vbo, fdot_nor_flag_id, base_vert_idx, &nor);
GPU_vertbuf_attr_set(vbo, fdot_pos_id, base_vert_idx, center);
@@ -1906,7 +1678,6 @@ static bool add_edit_facedot_mapped(
/** \} */
/* ---------------------------------------------------------------------- */
-
/** \name Vertex Group Selection
* \{ */
@@ -1947,7 +1718,7 @@ static bool drw_mesh_weight_state_compare(const struct DRW_MeshWeightState *a, c
}
static void drw_mesh_weight_state_extract(
- Object *ob, Mesh *me, ToolSettings *ts, bool paint_mode,
+ Object *ob, Mesh *me, const ToolSettings *ts, bool paint_mode,
struct DRW_MeshWeightState *wstate)
{
/* Extract complete vertex weight group selection state and mode flags. */
@@ -1982,13 +1753,12 @@ static void drw_mesh_weight_state_extract(
/** \} */
/* ---------------------------------------------------------------------- */
-
/** \name Mesh GPUBatch Cache
* \{ */
typedef struct MeshBatchCache {
- /* In order buffers: All verts only specified once.
- * To be used with a GPUIndexBuf. */
+ /* In order buffers: All verts only specified once
+ * or once per loop. To be used with a GPUIndexBuf. */
struct {
/* Vertex data. */
GPUVertBuf *pos_nor;
@@ -1997,26 +1767,32 @@ typedef struct MeshBatchCache {
GPUVertBuf *loop_pos_nor;
GPUVertBuf *loop_uv_tan;
GPUVertBuf *loop_vcol;
+ GPUVertBuf *loop_edge_fac;
} ordered;
- /* Tesselated: (all verts specified for each triangles).
- * Indices does not match the CPU data structure's. */
- struct {
- GPUVertBuf *pos_nor;
- GPUVertBuf *wireframe_data;
- } tess;
-
/* Edit Mesh Data:
- * Data is also tesselated because of barycentric wireframe rendering. */
+ * Edit cage can be different from final mesh so vertex count
+ * might differ. */
struct {
- GPUVertBuf *pos_nor;
- GPUVertBuf *pos_nor_ledges;
- GPUVertBuf *pos_nor_lverts;
- GPUVertBuf *pos_nor_data_facedots;
- GPUVertBuf *data;
- GPUVertBuf *data_ledges;
- GPUVertBuf *data_lverts;
- GPUVertBuf *lnor;
+ /* TODO(fclem): Reuse ordered.loop_pos_nor and maybe even
+ * ordered.loop_uv_tan when cage match final mesh. */
+ GPUVertBuf *loop_pos_nor;
+ GPUVertBuf *loop_data;
+ GPUVertBuf *loop_lnor;
+ GPUVertBuf *facedots_pos_nor_data;
+ /* UV data without modifier applied.
+ * Vertex count is always the one of the cage. */
+ GPUVertBuf *loop_uv;
+ GPUVertBuf *loop_uv_data;
+ GPUVertBuf *loop_stretch_angle;
+ GPUVertBuf *loop_stretch_area;
+ GPUVertBuf *facedots_uv;
+ GPUVertBuf *facedots_uv_data;
+ /* Selection */
+ GPUVertBuf *loop_vert_idx;
+ GPUVertBuf *loop_edge_idx;
+ GPUVertBuf *loop_face_idx;
+ GPUVertBuf *facedots_idx;
} edit;
/* Index Buffers:
@@ -2030,9 +1806,15 @@ typedef struct MeshBatchCache {
/* Indices to vloops. */
GPUIndexBuf *loops_tris;
GPUIndexBuf *loops_lines;
- /* Contains indices to unique edit vertices to not
- * draw the same vert multiple times (because of tesselation). */
- GPUIndexBuf *edit_verts_points;
+ GPUIndexBuf *loops_line_strips;
+ /* Edit mode. */
+ GPUIndexBuf *edit_loops_points; /* verts */
+ GPUIndexBuf *edit_loops_lines; /* edges */
+ GPUIndexBuf *edit_loops_tris; /* faces */
+ /* Edit UVs */
+ GPUIndexBuf *edituv_loops_points; /* verts */
+ GPUIndexBuf *edituv_loops_line_strips; /* edges */
+ GPUIndexBuf *edituv_loops_tri_fans; /* faces */
} ibo;
struct {
@@ -2042,103 +1824,36 @@ typedef struct MeshBatchCache {
/* Edit mode */
GPUBatch *edit_triangles;
GPUBatch *edit_vertices;
- GPUBatch *edit_loose_edges;
- GPUBatch *edit_loose_verts;
- GPUBatch *edit_triangles_nor;
- GPUBatch *edit_triangles_lnor;
- GPUBatch *edit_loose_edges_nor;
+ GPUBatch *edit_edges;
+ GPUBatch *edit_lnor;
GPUBatch *edit_facedots;
+ /* Edit UVs */
+ GPUBatch *edituv_faces_strech_area;
+ GPUBatch *edituv_faces_strech_angle;
+ GPUBatch *edituv_faces;
+ GPUBatch *edituv_edges;
+ GPUBatch *edituv_verts;
+ GPUBatch *edituv_facedots;
+ /* Edit selection */
+ GPUBatch *edit_selection_verts;
+ GPUBatch *edit_selection_edges;
+ GPUBatch *edit_selection_faces;
+ GPUBatch *edit_selection_facedots;
/* Common display / Other */
GPUBatch *all_verts;
GPUBatch *all_edges;
GPUBatch *loose_edges;
GPUBatch *edge_detection;
+ GPUBatch *wire_edges; /* Individual edges with face normals. */
GPUBatch *wire_loops; /* Loops around faces. */
- GPUBatch *wire_triangles; /* Triangles for object mode wireframe. */
+ GPUBatch *wire_loops_uvs; /* Same as wire_loops but only has uvs. */
} batch;
GPUIndexBuf **surf_per_mat_tris;
GPUBatch **surf_per_mat;
- /* OLD BATCH METHOD, thoses needs to be ported and added in the structs above. */
-
- /* Indices buffers. */
- GPUIndexBuf *edges_in_order;
- GPUIndexBuf *edges_adjacency; /* Store edges with adjacent vertices. */
- GPUIndexBuf *triangles_in_order;
- GPUIndexBuf *ledges_in_order;
-
- GPUBatch *all_triangles;
-
- GPUVertBuf *pos_with_normals;
- GPUVertBuf *pos_with_normals_visible_only;
- GPUVertBuf *pos_with_normals_edit;
- GPUVertBuf *pos_with_normals_visible_only_edit;
- GPUVertBuf *tri_aligned_uv; /* Active UV layer (mloopuv) */
-
- /**
- * Other uses are all positions or loose elements.
- * This stores all visible elements, needed for selection.
- */
- GPUVertBuf *ed_fcenter_pos_with_nor_and_sel;
- GPUVertBuf *ed_edge_pos;
- GPUVertBuf *ed_vert_pos;
-
- GPUBatch *triangles_with_normals;
- GPUBatch *ledges_with_normals;
-
- /* Skip hidden (depending on paint select mode) */
- GPUBatch *triangles_with_weights;
- GPUBatch *triangles_with_vert_colors;
- /* Always skip hidden */
- GPUBatch *triangles_with_select_mask;
- GPUBatch *triangles_with_select_id;
- uint triangles_with_select_id_offset;
-
- GPUBatch *facedot_with_select_id; /* shares vbo with 'edit_facedots' */
- GPUBatch *edges_with_select_id;
- GPUBatch *verts_with_select_id;
-
- uint facedot_with_select_id_offset;
- uint edges_with_select_id_offset;
- uint verts_with_select_id_offset;
-
- GPUBatch *points_with_normals;
- GPUBatch *fancy_edges; /* owns its vertex buffer (not shared) */
-
- GPUBatch *edge_detection;
-
- /* Texture Paint.*/
- /* per-texture batch */
- GPUBatch **texpaint_triangles;
- GPUBatch *texpaint_triangles_single;
-
- GPUBatch *overlay_weight_faces;
- GPUBatch *overlay_weight_verts;
- GPUBatch *overlay_paint_edges;
-
- /* 2D/UV edit */
- GPUVertBuf *edituv_pos;
- GPUVertBuf *edituv_area;
- GPUVertBuf *edituv_angle;
- GPUVertBuf *edituv_data;
-
- GPUIndexBuf *edituv_visible_faces;
- GPUIndexBuf *edituv_visible_edges;
-
- GPUBatch *texpaint_uv_loops;
-
- GPUBatch *edituv_faces_strech_area;
- GPUBatch *edituv_faces_strech_angle;
- GPUBatch *edituv_faces;
- GPUBatch *edituv_edges;
- GPUBatch *edituv_verts;
- GPUBatch *edituv_facedots;
-
- char edituv_state;
-
/* arrays of bool uniform names (and value) that will be use to
- * set srgb conversion for auto attribs.*/
+ * set srgb conversion for auto attributes.*/
char *auto_layer_names;
int *auto_layer_is_srgb;
int auto_layer_len;
@@ -2152,6 +1867,7 @@ typedef struct MeshBatchCache {
int vert_len;
int mat_len;
bool is_editmode;
+ bool is_uvsyncsel;
struct DRW_MeshWeightState weight_state;
@@ -2163,7 +1879,7 @@ typedef struct MeshBatchCache {
/* XXX, only keep for as long as sculpt mode uses shaded drawing. */
bool is_sculpt_points_tag;
- /* Valid only if edges_adjacency is up to date. */
+ /* Valid only if edge_detection is up to date. */
bool is_manifold;
} MeshBatchCache;
@@ -2181,7 +1897,7 @@ static bool mesh_batch_cache_valid(Mesh *me)
return false;
}
- if (cache->is_editmode != (me->edit_btmesh != NULL)) {
+ if (cache->is_editmode != (me->edit_mesh != NULL)) {
return false;
}
@@ -2220,7 +1936,7 @@ static void mesh_batch_cache_init(Mesh *me)
memset(cache, 0, sizeof(*cache));
}
- cache->is_editmode = me->edit_btmesh != NULL;
+ cache->is_editmode = me->edit_mesh != NULL;
if (cache->is_editmode == false) {
cache->edge_len = mesh_render_edges_len_get(me);
@@ -2233,12 +1949,6 @@ static void mesh_batch_cache_init(Mesh *me)
cache->surf_per_mat_tris = MEM_callocN(sizeof(*cache->surf_per_mat_tris) * cache->mat_len, __func__);
cache->surf_per_mat = MEM_callocN(sizeof(*cache->surf_per_mat) * cache->mat_len, __func__);
- /* TODO Might be wiser to alloc in one chunck. */
- for (int i = 0; i < cache->mat_len; ++i) {
- cache->surf_per_mat_tris[i] = MEM_callocN(sizeof(GPUIndexBuf), "GPUIndexBuf");
- cache->surf_per_mat[i] = MEM_callocN(sizeof(GPUBatch), "GPUBatch");
- }
-
cache->is_maybe_dirty = false;
cache->is_dirty = false;
@@ -2285,8 +1995,6 @@ static void mesh_batch_cache_discard_shaded_tri(MeshBatchCache *cache)
}
MEM_SAFE_FREE(cache->surf_per_mat);
- MEM_SAFE_FREE(cache->texpaint_triangles);
-
MEM_SAFE_FREE(cache->auto_layer_names);
MEM_SAFE_FREE(cache->auto_layer_is_srgb);
@@ -2295,45 +2003,21 @@ static void mesh_batch_cache_discard_shaded_tri(MeshBatchCache *cache)
static void mesh_batch_cache_discard_uvedit(MeshBatchCache *cache)
{
- GPU_VERTBUF_DISCARD_SAFE(cache->edituv_pos);
- GPU_VERTBUF_DISCARD_SAFE(cache->edituv_area);
- GPU_VERTBUF_DISCARD_SAFE(cache->edituv_angle);
- GPU_VERTBUF_DISCARD_SAFE(cache->edituv_data);
-
- GPU_INDEXBUF_DISCARD_SAFE(cache->edituv_visible_faces);
- GPU_INDEXBUF_DISCARD_SAFE(cache->edituv_visible_edges);
-
- if (cache->edituv_faces_strech_area) {
- gpu_batch_presets_unregister(cache->edituv_faces_strech_area);
- }
- if (cache->edituv_faces_strech_angle) {
- gpu_batch_presets_unregister(cache->edituv_faces_strech_angle);
- }
- if (cache->edituv_faces) {
- gpu_batch_presets_unregister(cache->edituv_faces);
- }
- if (cache->edituv_edges) {
- gpu_batch_presets_unregister(cache->edituv_edges);
- }
- if (cache->edituv_verts) {
- gpu_batch_presets_unregister(cache->edituv_verts);
- }
- if (cache->edituv_facedots) {
- gpu_batch_presets_unregister(cache->edituv_facedots);
- }
-
- GPU_BATCH_DISCARD_SAFE(cache->edituv_faces_strech_area);
- GPU_BATCH_DISCARD_SAFE(cache->edituv_faces_strech_angle);
- GPU_BATCH_DISCARD_SAFE(cache->edituv_faces);
- GPU_BATCH_DISCARD_SAFE(cache->edituv_edges);
- GPU_BATCH_DISCARD_SAFE(cache->edituv_verts);
- GPU_BATCH_DISCARD_SAFE(cache->edituv_facedots);
-
- gpu_batch_presets_unregister(cache->texpaint_uv_loops);
-
- GPU_BATCH_DISCARD_SAFE(cache->texpaint_uv_loops);
-
- cache->edituv_state = 0;
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.loop_stretch_angle);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.loop_stretch_area);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.loop_uv);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.loop_uv_data);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.facedots_uv);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.facedots_uv_data);
+ GPU_INDEXBUF_DISCARD_SAFE(cache->ibo.edituv_loops_tri_fans);
+ GPU_INDEXBUF_DISCARD_SAFE(cache->ibo.edituv_loops_line_strips);
+ GPU_INDEXBUF_DISCARD_SAFE(cache->ibo.edituv_loops_points);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_faces_strech_area);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_faces_strech_angle);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_faces);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_edges);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_verts);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_facedots);
}
void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode)
@@ -2347,21 +2031,12 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode)
cache->is_maybe_dirty = true;
break;
case BKE_MESH_BATCH_DIRTY_SELECT:
- GPU_VERTBUF_DISCARD_SAFE(cache->edit.data);
- GPU_VERTBUF_DISCARD_SAFE(cache->edit.data_ledges);
- GPU_VERTBUF_DISCARD_SAFE(cache->edit.data_lverts);
- GPU_VERTBUF_DISCARD_SAFE(cache->edit.pos_nor_data_facedots);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.loop_data);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.facedots_pos_nor_data);
GPU_BATCH_DISCARD_SAFE(cache->batch.edit_triangles);
GPU_BATCH_DISCARD_SAFE(cache->batch.edit_vertices);
- GPU_BATCH_DISCARD_SAFE(cache->batch.edit_loose_verts);
- GPU_BATCH_DISCARD_SAFE(cache->batch.edit_loose_edges);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edit_edges);
GPU_BATCH_DISCARD_SAFE(cache->batch.edit_facedots);
- GPU_VERTBUF_DISCARD_SAFE(cache->ed_edge_pos);
- GPU_VERTBUF_DISCARD_SAFE(cache->ed_vert_pos);
- /* Edit mode selection. */
- GPU_BATCH_DISCARD_SAFE(cache->facedot_with_select_id);
- GPU_BATCH_DISCARD_SAFE(cache->edges_with_select_id);
- GPU_BATCH_DISCARD_SAFE(cache->verts_with_select_id);
/* Paint mode selection */
/* TODO only do that in paint mode. */
GPU_VERTBUF_DISCARD_SAFE(cache->ordered.loop_pos_nor);
@@ -2372,9 +2047,6 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode)
GPU_BATCH_DISCARD_SAFE(cache->surf_per_mat[i]);
}
}
- GPU_BATCH_DISCARD_SAFE(cache->overlay_paint_edges);
- GPU_BATCH_DISCARD_SAFE(cache->overlay_weight_faces);
- GPU_BATCH_DISCARD_SAFE(cache->overlay_weight_verts);
/* Because visible UVs depends on edit mode selection, discard everything. */
mesh_batch_cache_discard_uvedit(cache);
break;
@@ -2392,57 +2064,20 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode)
mesh_batch_cache_discard_uvedit(cache);
break;
case BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT:
- /* For now same as above. */
- mesh_batch_cache_discard_uvedit(cache);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.loop_uv_data);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.facedots_uv_data);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_faces_strech_area);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_faces_strech_angle);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_faces);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_edges);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_verts);
+ GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_facedots);
break;
default:
BLI_assert(0);
}
}
-/**
- * This only clear the batches associated to the given vertex buffer.
- **/
-static void mesh_batch_cache_clear_selective(Mesh *me, GPUVertBuf *vert)
-{
- MeshBatchCache *cache = me->runtime.batch_cache;
- if (!cache) {
- return;
- }
-
- BLI_assert(vert != NULL);
-
- if (ELEM(vert, cache->pos_with_normals, cache->pos_with_normals_visible_only,
- cache->pos_with_normals_edit, cache->pos_with_normals_visible_only_edit))
- {
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_normals);
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_weights);
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_vert_colors);
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_select_id);
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_select_mask);
- GPU_BATCH_DISCARD_SAFE(cache->points_with_normals);
- GPU_BATCH_DISCARD_SAFE(cache->ledges_with_normals);
- // if (cache->shaded_triangles) {
- // for (int i = 0; i < cache->mat_len; i++) {
- // GPU_BATCH_DISCARD_SAFE(cache->shaded_triangles[i]);
- // }
- // }
- // MEM_SAFE_FREE(cache->shaded_triangles);
- // if (cache->texpaint_triangles) {
- // for (int i = 0; i < cache->mat_len; i++) {
- // GPU_BATCH_DISCARD_SAFE(cache->texpaint_triangles[i]);
- // }
- // }
- MEM_SAFE_FREE(cache->texpaint_triangles);
- GPU_BATCH_DISCARD_SAFE(cache->texpaint_triangles_single);
- }
- /* TODO: add the other ones if needed. */
- else {
- /* Does not match any vertbuf in the batch cache! */
- BLI_assert(0);
- }
-}
-
static void mesh_batch_cache_clear(Mesh *me)
{
MeshBatchCache *cache = me->runtime.batch_cache;
@@ -2454,10 +2089,6 @@ static void mesh_batch_cache_clear(Mesh *me)
GPUVertBuf **vbo = (GPUVertBuf **)&cache->ordered;
GPU_VERTBUF_DISCARD_SAFE(vbo[i]);
}
- for (int i = 0; i < sizeof(cache->tess) / sizeof(void *); ++i) {
- GPUVertBuf **vbo = (GPUVertBuf **)&cache->tess;
- GPU_VERTBUF_DISCARD_SAFE(vbo[i]);
- }
for (int i = 0; i < sizeof(cache->edit) / sizeof(void *); ++i) {
GPUVertBuf **vbo = (GPUVertBuf **)&cache->edit;
GPU_VERTBUF_DISCARD_SAFE(vbo[i]);
@@ -2471,51 +2102,10 @@ static void mesh_batch_cache_clear(Mesh *me)
GPU_BATCH_DISCARD_SAFE(batch[i]);
}
- GPU_BATCH_DISCARD_SAFE(cache->all_triangles);
-
- GPU_INDEXBUF_DISCARD_SAFE(cache->edges_in_order);
- GPU_INDEXBUF_DISCARD_SAFE(cache->triangles_in_order);
- GPU_INDEXBUF_DISCARD_SAFE(cache->ledges_in_order);
-
- GPU_BATCH_DISCARD_SAFE(cache->overlay_weight_faces);
- GPU_BATCH_DISCARD_SAFE(cache->overlay_weight_verts);
- GPU_BATCH_DISCARD_SAFE(cache->overlay_paint_edges);
-
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_normals);
- GPU_BATCH_DISCARD_SAFE(cache->points_with_normals);
- GPU_BATCH_DISCARD_SAFE(cache->ledges_with_normals);
- GPU_VERTBUF_DISCARD_SAFE(cache->pos_with_normals);
- GPU_VERTBUF_DISCARD_SAFE(cache->pos_with_normals_visible_only);
- GPU_VERTBUF_DISCARD_SAFE(cache->pos_with_normals_edit);
- GPU_VERTBUF_DISCARD_SAFE(cache->pos_with_normals_visible_only_edit);
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_weights);
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_vert_colors);
- GPU_VERTBUF_DISCARD_SAFE(cache->tri_aligned_uv);
- GPU_VERTBUF_DISCARD_SAFE(cache->ed_fcenter_pos_with_nor_and_sel);
- GPU_VERTBUF_DISCARD_SAFE(cache->ed_edge_pos);
- GPU_VERTBUF_DISCARD_SAFE(cache->ed_vert_pos);
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_select_mask);
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_select_id);
- GPU_BATCH_DISCARD_SAFE(cache->facedot_with_select_id);
- GPU_BATCH_DISCARD_SAFE(cache->edges_with_select_id);
- GPU_BATCH_DISCARD_SAFE(cache->verts_with_select_id);
-
- GPU_BATCH_DISCARD_SAFE(cache->fancy_edges);
-
- GPU_INDEXBUF_DISCARD_SAFE(cache->edges_adjacency);
- GPU_BATCH_DISCARD_SAFE(cache->edge_detection);
-
mesh_batch_cache_discard_shaded_tri(cache);
mesh_batch_cache_discard_uvedit(cache);
- if (cache->texpaint_triangles) {
- for (int i = 0; i < cache->mat_len; i++) {
- GPU_BATCH_DISCARD_SAFE(cache->texpaint_triangles[i]);
- }
- }
- MEM_SAFE_FREE(cache->texpaint_triangles);
-
drw_mesh_weight_state_clear(&cache->weight_state);
}
@@ -2527,656 +2117,468 @@ void DRW_mesh_batch_cache_free(Mesh *me)
/* GPUBatch cache usage. */
-static void mesh_create_pos_and_nor_tess(MeshRenderData *rdata, GPUVertBuf *vbo, bool use_hide)
+static void mesh_create_edit_vertex_loops(
+ MeshRenderData *rdata,
+ GPUVertBuf *vbo_pos_nor,
+ GPUVertBuf *vbo_lnor,
+ GPUVertBuf *vbo_uv,
+ GPUVertBuf *vbo_data,
+ GPUVertBuf *vbo_verts,
+ GPUVertBuf *vbo_edges,
+ GPUVertBuf *vbo_faces)
{
- static GPUVertFormat format = { 0 };
- static struct { uint pos, nor; } attr_id;
- if (format.attr_len == 0) {
- attr_id.pos = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
- attr_id.nor = GPU_vertformat_attr_add(&format, "nor", GPU_COMP_I10, 3, GPU_FETCH_INT_TO_FLOAT_UNIT);
- GPU_vertformat_triple_load(&format);
- }
-
- GPU_vertbuf_init_with_format(vbo, &format);
-
- const int tri_len = mesh_render_data_looptri_len_get_maybe_mapped(rdata);
- const int vbo_len_capacity = tri_len * 3;
- int vbo_len_used = 0;
- GPU_vertbuf_data_alloc(vbo, vbo_len_capacity);
-
- GPUVertBufRaw pos_step, nor_step;
- GPU_vertbuf_attr_get_raw_data(vbo, attr_id.pos, &pos_step);
- GPU_vertbuf_attr_get_raw_data(vbo, attr_id.nor, &nor_step);
+#if 0
+ const int vert_len = mesh_render_data_verts_len_get_maybe_mapped(rdata);
+ const int edge_len = mesh_render_data_edges_len_get_maybe_mapped(rdata);
+#endif
+ const int poly_len = mesh_render_data_polys_len_get_maybe_mapped(rdata);
+ const int lvert_len = mesh_render_data_loose_verts_len_get_maybe_mapped(rdata);
+ const int ledge_len = mesh_render_data_loose_edges_len_get_maybe_mapped(rdata);
+ const int loop_len = mesh_render_data_loops_len_get_maybe_mapped(rdata);
+ const int tot_loop_len = loop_len + ledge_len * 2 + lvert_len;
+ float (*lnors)[3] = rdata->loop_normals;
+ uchar fflag;
- if (rdata->mapped.use == false) {
- float (*lnors)[3] = rdata->loop_normals;
- if (rdata->edit_bmesh) {
- GPUPackedNormal *pnors_pack, *vnors_pack;
+ /* Static formats */
+ static struct { GPUVertFormat sel_id, pos_nor, lnor, flag, uv; } format = { 0 };
+ static struct { uint sel_id, pos, nor, lnor, data, uvs; } attr_id;
+ if (format.sel_id.attr_len == 0) {
+ attr_id.sel_id = GPU_vertformat_attr_add(&format.sel_id, "color", GPU_COMP_U32, 1, GPU_FETCH_INT);
+ attr_id.pos = GPU_vertformat_attr_add(&format.pos_nor, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
+ attr_id.nor = GPU_vertformat_attr_add(&format.pos_nor, "vnor", GPU_COMP_I10, 3, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ attr_id.lnor = GPU_vertformat_attr_add(&format.lnor, "lnor", GPU_COMP_I10, 3, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ attr_id.data = GPU_vertformat_attr_add(&format.flag, "data", GPU_COMP_U8, 4, GPU_FETCH_INT);
+ attr_id.uvs = GPU_vertformat_attr_add(&format.uv, "u", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+ GPU_vertformat_alias_add(&format.uv, "pos");
+ GPU_vertformat_alias_add(&format.flag, "flag");
+ }
+
+ GPUVertBufRaw raw_verts, raw_edges, raw_faces, raw_pos, raw_nor, raw_lnor, raw_uv, raw_data;
+ if (DRW_TEST_ASSIGN_VBO(vbo_pos_nor)) {
+ GPU_vertbuf_init_with_format(vbo_pos_nor, &format.pos_nor);
+ GPU_vertbuf_data_alloc(vbo_pos_nor, tot_loop_len);
+ GPU_vertbuf_attr_get_raw_data(vbo_pos_nor, attr_id.pos, &raw_pos);
+ GPU_vertbuf_attr_get_raw_data(vbo_pos_nor, attr_id.nor, &raw_nor);
+ }
+ if (DRW_TEST_ASSIGN_VBO(vbo_lnor)) {
+ GPU_vertbuf_init_with_format(vbo_lnor, &format.lnor);
+ GPU_vertbuf_data_alloc(vbo_lnor, tot_loop_len);
+ GPU_vertbuf_attr_get_raw_data(vbo_lnor, attr_id.lnor, &raw_lnor);
+ }
+ if (DRW_TEST_ASSIGN_VBO(vbo_data)) {
+ GPU_vertbuf_init_with_format(vbo_data, &format.flag);
+ GPU_vertbuf_data_alloc(vbo_data, tot_loop_len);
+ GPU_vertbuf_attr_get_raw_data(vbo_data, attr_id.data, &raw_data);
+ }
+ if (DRW_TEST_ASSIGN_VBO(vbo_uv)) {
+ GPU_vertbuf_init_with_format(vbo_uv, &format.uv);
+ GPU_vertbuf_data_alloc(vbo_uv, tot_loop_len);
+ GPU_vertbuf_attr_get_raw_data(vbo_uv, attr_id.uvs, &raw_uv);
+ }
+ /* Select Idx */
+ if (DRW_TEST_ASSIGN_VBO(vbo_verts)) {
+ GPU_vertbuf_init_with_format(vbo_verts, &format.sel_id);
+ GPU_vertbuf_data_alloc(vbo_verts, tot_loop_len);
+ GPU_vertbuf_attr_get_raw_data(vbo_verts, attr_id.sel_id, &raw_verts);
+ }
+ if (DRW_TEST_ASSIGN_VBO(vbo_edges)) {
+ GPU_vertbuf_init_with_format(vbo_edges, &format.sel_id);
+ GPU_vertbuf_data_alloc(vbo_edges, tot_loop_len);
+ GPU_vertbuf_attr_get_raw_data(vbo_edges, attr_id.sel_id, &raw_edges);
+ }
+ if (DRW_TEST_ASSIGN_VBO(vbo_faces)) {
+ GPU_vertbuf_init_with_format(vbo_faces, &format.sel_id);
+ GPU_vertbuf_data_alloc(vbo_faces, tot_loop_len);
+ GPU_vertbuf_attr_get_raw_data(vbo_faces, attr_id.sel_id, &raw_faces);
+ }
- if (lnors == NULL) {
- mesh_render_data_ensure_poly_normals_pack(rdata);
- mesh_render_data_ensure_vert_normals_pack(rdata);
+ if (rdata->edit_bmesh && rdata->mapped.use == false) {
+ BMesh *bm = rdata->edit_bmesh->bm;
+ BMIter iter_efa, iter_loop, iter_vert;
+ BMFace *efa;
+ BMEdge *eed;
+ BMVert *eve;
+ BMLoop *loop;
+ const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
- pnors_pack = rdata->poly_normals_pack;
- vnors_pack = rdata->vert_normals_pack;
+ /* Face Loops */
+ BM_ITER_MESH (efa, &iter_efa, bm, BM_FACES_OF_MESH) {
+ int fidx = BM_elem_index_get(efa);
+ if (vbo_data) {
+ fflag = mesh_render_data_face_flag(rdata, efa, cd_loop_uv_offset);
}
-
- for (int i = 0; i < tri_len; i++) {
- const BMLoop **bm_looptri = (const BMLoop **)rdata->edit_bmesh->looptris[i];
- const BMFace *bm_face = bm_looptri[0]->f;
-
- /* use_hide always for edit-mode */
- if (BM_elem_flag_test(bm_face, BM_ELEM_HIDDEN)) {
- continue;
+ BM_ITER_ELEM (loop, &iter_loop, efa, BM_LOOPS_OF_FACE) {
+ if (vbo_pos_nor) {
+ GPUPackedNormal *vnor = (GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_nor);
+ *vnor = GPU_normal_convert_i10_v3(loop->v->no);
+ copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), loop->v->co);
}
-
- if (lnors) {
- for (uint t = 0; t < 3; t++) {
- const float *nor = lnors[BM_elem_index_get(bm_looptri[t])];
- *((GPUPackedNormal *)GPU_vertbuf_raw_step(&nor_step)) = GPU_normal_convert_i10_v3(nor);
- }
+ if (vbo_lnor) {
+ const float *nor = (lnors) ? lnors[BM_elem_index_get(loop)] : efa->no;
+ GPUPackedNormal *lnor = (GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_lnor);
+ *lnor = GPU_normal_convert_i10_v3(nor);
}
- else if (BM_elem_flag_test(bm_face, BM_ELEM_SMOOTH)) {
- for (uint t = 0; t < 3; t++) {
- *((GPUPackedNormal *)GPU_vertbuf_raw_step(&nor_step)) = vnors_pack[BM_elem_index_get(bm_looptri[t]->v)];
- }
+ if (vbo_data) {
+ EdgeDrawAttr eattr = { .v_flag = fflag };
+ mesh_render_data_edge_flag(rdata, loop->e, &eattr);
+ mesh_render_data_vert_flag(rdata, loop->v, &eattr);
+ mesh_render_data_loop_flag(rdata, loop, cd_loop_uv_offset, &eattr);
+ memcpy(GPU_vertbuf_raw_step(&raw_data), &eattr, sizeof(EdgeDrawAttr));
}
- else {
- const GPUPackedNormal *snor_pack = &pnors_pack[BM_elem_index_get(bm_face)];
- for (uint t = 0; t < 3; t++) {
- *((GPUPackedNormal *)GPU_vertbuf_raw_step(&nor_step)) = *snor_pack;
- }
+ if (vbo_uv) {
+ MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, cd_loop_uv_offset);
+ copy_v2_v2(GPU_vertbuf_raw_step(&raw_uv), luv->uv);
}
-
- /* TODO(sybren): deduplicate this and all the other places it's pasted to in this file. */
- if (rdata->edit_data && rdata->edit_data->vertexCos) {
- for (uint t = 0; t < 3; t++) {
- int vidx = BM_elem_index_get(bm_looptri[t]->v);
- const float *pos = rdata->edit_data->vertexCos[vidx];
- copy_v3_v3(GPU_vertbuf_raw_step(&pos_step), pos);
- }
+ /* Select Idx */
+ if (vbo_verts) {
+ int vidx = BM_elem_index_get(loop->v);
+ *((uint *)GPU_vertbuf_raw_step(&raw_verts)) = vidx;
}
- else {
- for (uint t = 0; t < 3; t++) {
- copy_v3_v3(GPU_vertbuf_raw_step(&pos_step), bm_looptri[t]->v->co);
- }
+ if (vbo_edges) {
+ int eidx = BM_elem_index_get(loop->e);
+ *((uint *)GPU_vertbuf_raw_step(&raw_edges)) = eidx;
+ }
+ if (vbo_faces) {
+ *((uint *)GPU_vertbuf_raw_step(&raw_faces)) = fidx;
}
}
}
- else {
- if (lnors == NULL) {
- /* Use normals from vertex. */
- mesh_render_data_ensure_poly_normals_pack(rdata);
- }
-
- for (int i = 0; i < tri_len; i++) {
- const MLoopTri *mlt = &rdata->mlooptri[i];
- const MPoly *mp = &rdata->mpoly[mlt->poly];
-
- if (use_hide && (mp->flag & ME_HIDE)) {
- continue;
+ /* Loose edges */
+ for (int e = 0; e < ledge_len; e++) {
+ eed = BM_edge_at_index(bm, rdata->loose_edges[e]);
+ BM_ITER_ELEM (eve, &iter_vert, eed, BM_VERTS_OF_EDGE) {
+ if (vbo_pos_nor) {
+ GPUPackedNormal *vnor = (GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_nor);
+ *vnor = GPU_normal_convert_i10_v3(eve->no);
+ copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), eve->co);
}
-
- const uint vtri[3] = {
- rdata->mloop[mlt->tri[0]].v,
- rdata->mloop[mlt->tri[1]].v,
- rdata->mloop[mlt->tri[2]].v,
- };
-
- if (lnors) {
- for (uint t = 0; t < 3; t++) {
- const float *nor = lnors[mlt->tri[t]];
- *((GPUPackedNormal *)GPU_vertbuf_raw_step(&nor_step)) = GPU_normal_convert_i10_v3(nor);
- }
+ if (vbo_data) {
+ EdgeDrawAttr eattr = { 0 };
+ mesh_render_data_edge_flag(rdata, eed, &eattr);
+ mesh_render_data_vert_flag(rdata, eve, &eattr);
+ memcpy(GPU_vertbuf_raw_step(&raw_data), &eattr, sizeof(EdgeDrawAttr));
}
- else if (mp->flag & ME_SMOOTH) {
- for (uint t = 0; t < 3; t++) {
- const MVert *mv = &rdata->mvert[vtri[t]];
- *((GPUPackedNormal *)GPU_vertbuf_raw_step(&nor_step)) = GPU_normal_convert_i10_s3(mv->no);
- }
+ if (vbo_lnor) {
+ memset(GPU_vertbuf_raw_step(&raw_lnor), 0, sizeof(GPUPackedNormal));
}
- else {
- const GPUPackedNormal *pnors_pack = &rdata->poly_normals_pack[mlt->poly];
- for (uint t = 0; t < 3; t++) {
- *((GPUPackedNormal *)GPU_vertbuf_raw_step(&nor_step)) = *pnors_pack;
- }
+ /* Select Idx */
+ if (vbo_verts) {
+ int vidx = BM_elem_index_get(eve);
+ *((uint *)GPU_vertbuf_raw_step(&raw_verts)) = vidx;
}
-
- for (uint t = 0; t < 3; t++) {
- const MVert *mv = &rdata->mvert[vtri[t]];
- copy_v3_v3(GPU_vertbuf_raw_step(&pos_step), mv->co);
+ if (vbo_edges) {
+ int eidx = BM_elem_index_get(eed);
+ *((uint *)GPU_vertbuf_raw_step(&raw_edges)) = eidx;
}
}
}
+ /* Loose verts */
+ for (int e = 0; e < lvert_len; e++) {
+ eve = BM_vert_at_index(bm, rdata->loose_verts[e]);
+ if (vbo_pos_nor) {
+ GPUPackedNormal *vnor = (GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_nor);
+ *vnor = GPU_normal_convert_i10_v3(eve->no);
+ copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), eve->co);
+ }
+ if (vbo_lnor) {
+ memset(GPU_vertbuf_raw_step(&raw_lnor), 0, sizeof(GPUPackedNormal));
+ }
+ if (vbo_data) {
+ EdgeDrawAttr eattr = { 0 };
+ mesh_render_data_vert_flag(rdata, eve, &eattr);
+ memcpy(GPU_vertbuf_raw_step(&raw_data), &eattr, sizeof(EdgeDrawAttr));
+ }
+ /* Select Idx */
+ if (vbo_verts) {
+ int vidx = BM_elem_index_get(eve);
+ *((uint *)GPU_vertbuf_raw_step(&raw_verts)) = vidx;
+ }
+ }
}
- else {
- /* Note: mapped doesn't support lnors yet. */
+ else if (rdata->mapped.use == true) {
BMesh *bm = rdata->edit_bmesh->bm;
- Mesh *me_cage = rdata->mapped.me_cage;
-
- /* TODO(campbell): unlike non-mapped modes we don't generate these on demand, just use if they exist.
- * this seems like a low priority TODO since mapped meshes typically
- * use the final mesh evaluated mesh for showing faces. */
- const float (*lnors)[3] = CustomData_get_layer(&me_cage->ldata, CD_NORMAL);
-
- /* TODO(campbell): this is quite an expensive operation for something
- * that's not used unless 'normal' display option is enabled. */
- if (!CustomData_has_layer(&me_cage->pdata, CD_NORMAL)) {
- /* TODO(campbell): this is quite an expensive operation for something
- * that's not used unless 'normal' display option is enabled. */
- BKE_mesh_ensure_normals_for_display(me_cage);
- }
- const float (*polynors)[3] = CustomData_get_layer(&me_cage->pdata, CD_NORMAL);
+ const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
+ const MPoly *mpoly = rdata->mapped.me_cage->mpoly;
+ const MEdge *medge = rdata->mapped.me_cage->medge;
const MVert *mvert = rdata->mapped.me_cage->mvert;
const MLoop *mloop = rdata->mapped.me_cage->mloop;
- const MPoly *mpoly = rdata->mapped.me_cage->mpoly;
- const MLoopTri *mlooptri = BKE_mesh_runtime_looptri_ensure(me_cage);
- for (int i = 0; i < tri_len; i++) {
- const MLoopTri *mlt = &mlooptri[i];
- const int p_orig = rdata->mapped.p_origindex[mlt->poly];
- if (p_orig != ORIGINDEX_NONE) {
- /* Assume 'use_hide' */
- BMFace *efa = BM_face_at_index(bm, p_orig);
- if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
- const MPoly *mp = &mpoly[mlt->poly];
- const uint vtri[3] = {
- mloop[mlt->tri[0]].v,
- mloop[mlt->tri[1]].v,
- mloop[mlt->tri[2]].v,
- };
+ const int *v_origindex = rdata->mapped.v_origindex;
+ const int *e_origindex = rdata->mapped.e_origindex;
+ const int *p_origindex = rdata->mapped.p_origindex;
- if (lnors) {
- for (uint t = 0; t < 3; t++) {
- const float *nor = lnors[mlt->tri[t]];
- *((GPUPackedNormal *)GPU_vertbuf_raw_step(&nor_step)) = GPU_normal_convert_i10_v3(nor);
- }
+ /* Face Loops */
+ for (int poly = 0; poly < poly_len; poly++, mpoly++) {
+ const MLoop *l = &mloop[mpoly->loopstart];
+ int fidx = p_origindex[poly];
+ BMFace *efa = NULL;
+ if (vbo_data) {
+ fflag = 0;
+ if (fidx != ORIGINDEX_NONE) {
+ efa = BM_face_at_index(bm, fidx);
+ fflag = mesh_render_data_face_flag(rdata, efa, cd_loop_uv_offset);
+ }
+ }
+ for (int i = 0; i < mpoly->totloop; i++, l++) {
+ if (vbo_pos_nor) {
+ copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), mvert[l->v].co);
+ }
+ if (vbo_lnor || vbo_pos_nor) {
+ GPUPackedNormal vnor = GPU_normal_convert_i10_s3(mvert[l->v].no);
+ if (vbo_pos_nor) {
+ *(GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_nor) = vnor;
}
- else if (mp->flag & ME_SMOOTH) {
- for (uint t = 0; t < 3; t++) {
- const MVert *mv = &mvert[vtri[t]];
- *((GPUPackedNormal *)GPU_vertbuf_raw_step(&nor_step)) = GPU_normal_convert_i10_s3(mv->no);
- }
+ if (vbo_lnor) {
+ /* Mapped does not support lnors yet. */
+ *(GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_lnor) = vnor;
}
- else {
- /* we don't have cached 'rdata->poly_normals_pack'. */
- const GPUPackedNormal pnor = GPU_normal_convert_i10_v3(polynors[mlt->poly]);
- for (uint t = 0; t < 3; t++) {
- *((GPUPackedNormal *)GPU_vertbuf_raw_step(&nor_step)) = pnor;
- }
+ }
+ if (vbo_data) {
+ EdgeDrawAttr eattr = { .v_flag = fflag };
+ int vidx = v_origindex[l->v];
+ int eidx = e_origindex[l->e];
+ if (vidx != ORIGINDEX_NONE) {
+ BMVert *eve = BM_vert_at_index(bm, vidx);
+ mesh_render_data_vert_flag(rdata, eve, &eattr);
}
-
- for (uint t = 0; t < 3; t++) {
- const MVert *mv = &mvert[vtri[t]];
- copy_v3_v3(GPU_vertbuf_raw_step(&pos_step), mv->co);
+ if (eidx != ORIGINDEX_NONE) {
+ BMEdge *eed = BM_edge_at_index(bm, eidx);
+ mesh_render_data_edge_flag(rdata, eed, &eattr);
+ /* TODO find a more efficient way to do that. */
+ BMLoop *loop;
+ BMIter iter_loop;
+ BM_ITER_ELEM (loop, &iter_loop, efa, BM_LOOPS_OF_FACE) {
+ if (loop->e == eed) {
+ mesh_render_data_loop_flag(rdata, loop, cd_loop_uv_offset, &eattr);
+ break;
+ }
+ }
}
+ memcpy(GPU_vertbuf_raw_step(&raw_data), &eattr, sizeof(EdgeDrawAttr));
}
- }
- }
- }
-
- vbo_len_used = GPU_vertbuf_raw_used(&pos_step);
- BLI_assert(vbo_len_used == GPU_vertbuf_raw_used(&nor_step));
-
- if (vbo_len_capacity != vbo_len_used) {
- GPU_vertbuf_data_resize(vbo, vbo_len_used);
- }
-}
-
-static GPUVertBuf *mesh_batch_cache_get_tri_pos_and_normals_ex(
- MeshRenderData *rdata, const bool use_hide,
- GPUVertBuf **r_vbo)
-{
- BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY));
-
- if (*r_vbo == NULL) {
- *r_vbo = GPU_vertbuf_create(GPU_USAGE_STATIC);
- mesh_create_pos_and_nor_tess(rdata, *r_vbo, use_hide);
- }
- return *r_vbo;
-}
-
-static GPUVertBuf *mesh_batch_cache_get_tri_pos_and_normals_edit(
- MeshRenderData *rdata, MeshBatchCache *cache, bool use_hide)
-{
- return mesh_batch_cache_get_tri_pos_and_normals_ex(
- rdata, use_hide,
- use_hide ? &cache->pos_with_normals_visible_only_edit : &cache->pos_with_normals_edit);
-}
-
-/* DEPRECATED Need to be ported */
-static GPUVertBuf *mesh_batch_cache_get_facedot_pos_with_normals_and_flag(
- MeshRenderData *rdata, MeshBatchCache *cache)
-{
- BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY));
-
- if (cache->edit.pos_nor_data_facedots == NULL) {
- cache->edit.pos_nor_data_facedots = GPU_vertbuf_create(GPU_USAGE_STATIC);
- mesh_create_edit_facedots(rdata, cache->edit.pos_nor_data_facedots);
- }
-
- return cache->edit.pos_nor_data_facedots;
-}
-
-static GPUVertBuf *mesh_batch_cache_get_edges_visible(
- MeshRenderData *rdata, MeshBatchCache *cache)
-{
- BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_EDGE));
-
- if (cache->ed_edge_pos == NULL) {
- static GPUVertFormat format = { 0 };
- static struct { uint pos, data; } attr_id;
- if (format.attr_len == 0) {
- attr_id.pos = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
- }
-
- const int vbo_len_capacity = mesh_render_data_edges_len_get_maybe_mapped(rdata) * 2;
- int vidx = 0;
-
- GPUVertBuf *vbo = cache->ed_edge_pos = GPU_vertbuf_create_with_format(&format);
- GPU_vertbuf_data_alloc(vbo, vbo_len_capacity);
-
- if (rdata->mapped.use == false) {
- if (rdata->edit_bmesh) {
- BMesh *bm = rdata->edit_bmesh->bm;
- BMIter iter;
- BMEdge *eed;
-
- BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
- if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
- GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx, eed->v1->co);
- vidx += 1;
- GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx, eed->v2->co);
- vidx += 1;
- }
+ if (vbo_uv) {
+ MLoopUV *luv = &rdata->mloopuv[mpoly->loopstart + i];
+ copy_v2_v2(GPU_vertbuf_raw_step(&raw_uv), luv->uv);
}
- }
- else {
- /* not yet done! */
- BLI_assert(0);
- }
- }
- else {
- BMesh *bm = rdata->edit_bmesh->bm;
- const MVert *mvert = rdata->mapped.me_cage->mvert;
- const MEdge *medge = rdata->mapped.me_cage->medge;
- const int *e_origindex = rdata->mapped.e_origindex;
- for (int i = 0; i < rdata->mapped.edge_len; i++) {
- const int e_orig = e_origindex[i];
- if (e_orig != ORIGINDEX_NONE) {
- BMEdge *eed = BM_edge_at_index(bm, e_orig);
- if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
- const MEdge *ed = &medge[i];
- GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx, mvert[ed->v1].co);
- vidx += 1;
- GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx, mvert[ed->v2].co);
- vidx += 1;
- }
+ /* Select Idx */
+ if (vbo_verts) {
+ int vidx = v_origindex[l->v];
+ *((uint *)GPU_vertbuf_raw_step(&raw_verts)) = vidx;
}
- }
- }
- const int vbo_len_used = vidx;
- if (vbo_len_used != vbo_len_capacity) {
- GPU_vertbuf_data_resize(vbo, vbo_len_used);
- }
- UNUSED_VARS_NDEBUG(vbo_len_used);
- }
-
- return cache->ed_edge_pos;
-}
-
-static GPUVertBuf *mesh_batch_cache_get_verts_visible(
- MeshRenderData *rdata, MeshBatchCache *cache)
-{
- BLI_assert(rdata->types & MR_DATATYPE_VERT);
-
- if (cache->ed_vert_pos == NULL) {
- static GPUVertFormat format = { 0 };
- static struct { uint pos, data; } attr_id;
- if (format.attr_len == 0) {
- attr_id.pos = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
- }
-
- const int vbo_len_capacity = mesh_render_data_verts_len_get_maybe_mapped(rdata);
- uint vidx = 0;
-
- GPUVertBuf *vbo = cache->ed_vert_pos = GPU_vertbuf_create_with_format(&format);
- GPU_vertbuf_data_alloc(vbo, vbo_len_capacity);
- if (rdata->mapped.use == false) {
- if (rdata->edit_bmesh) {
- BMesh *bm = rdata->edit_bmesh->bm;
- BMIter iter;
- BMVert *eve;
-
- BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
- if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx, eve->co);
- vidx += 1;
- }
+ if (vbo_edges) {
+ int eidx = e_origindex[l->e];
+ *((uint *)GPU_vertbuf_raw_step(&raw_edges)) = eidx;
}
- }
- else {
- for (int i = 0; i < vbo_len_capacity; i++) {
- const MVert *mv = &rdata->mvert[i];
- if (!(mv->flag & ME_HIDE)) {
- GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx, mv->co);
- vidx += 1;
- }
+ if (vbo_faces) {
+ *((uint *)GPU_vertbuf_raw_step(&raw_faces)) = fidx;
}
}
}
- else {
- BMesh *bm = rdata->edit_bmesh->bm;
- const MVert *mvert = rdata->mapped.me_cage->mvert;
- const int *v_origindex = rdata->mapped.v_origindex;
- for (int i = 0; i < vbo_len_capacity; i++) {
- const int v_orig = v_origindex[i];
- if (v_orig != ORIGINDEX_NONE) {
- BMVert *eve = BM_vert_at_index(bm, v_orig);
- if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- const MVert *mv = &mvert[i];
- GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx, mv->co);
- vidx += 1;
+ /* Loose edges */
+ for (int j = 0; j < ledge_len; j++) {
+ const int e = rdata->mapped.loose_edges[j];
+ for (int i = 0; i < 2; ++i) {
+ int v = (i == 0) ? medge[e].v1 : medge[e].v2;
+ if (vbo_pos_nor) {
+ GPUPackedNormal vnor = GPU_normal_convert_i10_s3(mvert[v].no);
+ *(GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_nor) = vnor;
+ copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), mvert[v].co);
+ }
+ if (vbo_lnor) {
+ memset(GPU_vertbuf_raw_step(&raw_lnor), 0, sizeof(GPUPackedNormal));
+ }
+ if (vbo_data) {
+ EdgeDrawAttr eattr = { 0 };
+ int vidx = v_origindex[v];
+ int eidx = e_origindex[e];
+ if (vidx != ORIGINDEX_NONE) {
+ BMVert *eve = BM_vert_at_index(bm, vidx);
+ mesh_render_data_vert_flag(rdata, eve, &eattr);
}
+ if (eidx != ORIGINDEX_NONE) {
+ BMEdge *eed = BM_edge_at_index(bm, eidx);
+ mesh_render_data_edge_flag(rdata, eed, &eattr);
+ }
+ memcpy(GPU_vertbuf_raw_step(&raw_data), &eattr, sizeof(EdgeDrawAttr));
}
- }
- }
- const uint vbo_len_used = vidx;
- if (vbo_len_used != vbo_len_capacity) {
- GPU_vertbuf_data_resize(vbo, vbo_len_used);
- }
-
- UNUSED_VARS_NDEBUG(vbo_len_used);
- }
-
- return cache->ed_vert_pos;
-}
-
-static GPUVertBuf *mesh_create_facedot_select_id(
- MeshRenderData *rdata, uint select_id_offset)
-{
- BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY));
-
- GPUVertBuf *vbo;
- {
- static GPUVertFormat format = { 0 };
- static struct { uint pos, col; } attr_id;
- if (format.attr_len == 0) {
- attr_id.col = GPU_vertformat_attr_add(&format, "color", GPU_COMP_I32, 1, GPU_FETCH_INT);
- }
-
- const int vbo_len_capacity = mesh_render_data_polys_len_get(rdata);
- int vidx = 0;
-
- vbo = GPU_vertbuf_create_with_format(&format);
- GPU_vertbuf_data_alloc(vbo, vbo_len_capacity);
- uint select_index = select_id_offset;
-
- if (rdata->edit_bmesh) {
- BMesh *bm = rdata->edit_bmesh->bm;
- BMIter iter;
- BMEdge *efa;
-
- BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
- if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
- int select_id;
- GPU_select_index_get(select_index, &select_id);
- GPU_vertbuf_attr_set(vbo, attr_id.col, vidx, &select_id);
- vidx += 1;
+ /* Select Idx */
+ if (vbo_verts) {
+ int vidx = v_origindex[v];
+ *((uint *)GPU_vertbuf_raw_step(&raw_verts)) = vidx;
+ }
+ if (vbo_edges) {
+ int eidx = e_origindex[e];
+ *((uint *)GPU_vertbuf_raw_step(&raw_edges)) = eidx;
}
- select_index += 1;
}
}
- else {
- /* not yet done! */
- BLI_assert(0);
- }
- const int vbo_len_used = vidx;
- if (vbo_len_used != vbo_len_capacity) {
- GPU_vertbuf_data_resize(vbo, vbo_len_used);
- }
- }
-
- return vbo;
-}
-
-static GPUVertBuf *mesh_create_edges_select_id(
- MeshRenderData *rdata, uint select_id_offset)
-{
- BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_EDGE));
-
- GPUVertBuf *vbo;
- {
- static GPUVertFormat format = { 0 };
- static struct { uint pos, col; } attr_id;
- if (format.attr_len == 0) {
- attr_id.col = GPU_vertformat_attr_add(&format, "color", GPU_COMP_I32, 1, GPU_FETCH_INT);
- }
-
- const int vbo_len_capacity = mesh_render_data_edges_len_get_maybe_mapped(rdata) * 2;
- int vidx = 0;
-
- vbo = GPU_vertbuf_create_with_format(&format);
- GPU_vertbuf_data_alloc(vbo, vbo_len_capacity);
-
- if (rdata->mapped.use == false) {
- uint select_index = select_id_offset;
- if (rdata->edit_bmesh) {
- BMesh *bm = rdata->edit_bmesh->bm;
- BMIter iter;
- BMEdge *eed;
-
- BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
- if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
- int select_id;
- GPU_select_index_get(select_index, &select_id);
- GPU_vertbuf_attr_set(vbo, attr_id.col, vidx, &select_id);
- vidx += 1;
- GPU_vertbuf_attr_set(vbo, attr_id.col, vidx, &select_id);
- vidx += 1;
- }
- select_index += 1;
- }
+ /* Loose verts */
+ for (int i = 0; i < lvert_len; i++) {
+ const int v = rdata->mapped.loose_verts[i];
+ if (vbo_pos_nor) {
+ GPUPackedNormal vnor = GPU_normal_convert_i10_s3(mvert[v].no);
+ *(GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_nor) = vnor;
+ copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), mvert[v].co);
}
- else {
- /* not yet done! */
- BLI_assert(0);
+ if (vbo_lnor) {
+ memset(GPU_vertbuf_raw_step(&raw_lnor), 0, sizeof(GPUPackedNormal));
}
- }
- else {
- BMesh *bm = rdata->edit_bmesh->bm;
- const int *e_origindex = rdata->mapped.e_origindex;
- for (int i = 0; i < rdata->mapped.edge_len; i++) {
- const int e_orig = e_origindex[i];
- if (e_orig != ORIGINDEX_NONE) {
- BMEdge *eed = BM_edge_at_index(bm, e_orig);
- if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
- uint select_index = select_id_offset + e_orig;
- int select_id;
- GPU_select_index_get(select_index, &select_id);
- GPU_vertbuf_attr_set(vbo, attr_id.col, vidx, &select_id);
- vidx += 1;
- GPU_vertbuf_attr_set(vbo, attr_id.col, vidx, &select_id);
- vidx += 1;
- }
+ if (vbo_data) {
+ EdgeDrawAttr eattr = { 0 };
+ int vidx = v_origindex[v];
+ if (vidx != ORIGINDEX_NONE) {
+ BMVert *eve = BM_vert_at_index(bm, vidx);
+ mesh_render_data_vert_flag(rdata, eve, &eattr);
}
+ memcpy(GPU_vertbuf_raw_step(&raw_data), &eattr, sizeof(EdgeDrawAttr));
+ }
+ /* Select Idx */
+ if (vbo_verts) {
+ int vidx = v_origindex[v];
+ *((uint *)GPU_vertbuf_raw_step(&raw_verts)) = vidx;
}
- }
- const int vbo_len_used = vidx;
- if (vbo_len_used != vbo_len_capacity) {
- GPU_vertbuf_data_resize(vbo, vbo_len_used);
}
}
+ else {
+ const MPoly *mpoly = rdata->mpoly;
+ const MVert *mvert = rdata->mvert;
+ const MLoop *mloop = rdata->mloop;
- return vbo;
-}
-
-static GPUVertBuf *mesh_create_verts_select_id(
- MeshRenderData *rdata, uint select_id_offset)
-{
- BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY));
-
- GPUVertBuf *vbo;
- {
- static GPUVertFormat format = { 0 };
- static struct { uint pos, col; } attr_id;
- if (format.attr_len == 0) {
- attr_id.col = GPU_vertformat_attr_add(&format, "color", GPU_COMP_I32, 1, GPU_FETCH_INT);
- }
-
- const int vbo_len_capacity = mesh_render_data_verts_len_get_maybe_mapped(rdata);
- int vidx = 0;
-
- vbo = GPU_vertbuf_create_with_format(&format);
- GPU_vertbuf_data_alloc(vbo, vbo_len_capacity);
-
- if (rdata->mapped.use == false) {
- uint select_index = select_id_offset;
- if (rdata->edit_bmesh) {
- BMesh *bm = rdata->edit_bmesh->bm;
- BMIter iter;
- BMVert *eve;
-
- BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
- if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- int select_id;
- GPU_select_index_get(select_index, &select_id);
- GPU_vertbuf_attr_set(vbo, attr_id.col, vidx, &select_id);
- vidx += 1;
+ const int *v_origindex = CustomData_get_layer(&rdata->me->vdata, CD_ORIGINDEX);
+ const int *e_origindex = CustomData_get_layer(&rdata->me->edata, CD_ORIGINDEX);
+ const int *p_origindex = CustomData_get_layer(&rdata->me->pdata, CD_ORIGINDEX);
+
+ /* Face Loops */
+ for (int poly = 0; poly < poly_len; poly++, mpoly++) {
+ const MLoop *l = &mloop[mpoly->loopstart];
+ int fidx = p_origindex ? p_origindex[poly] : poly;
+ for (int i = 0; i < mpoly->totloop; i++, l++) {
+ if (vbo_pos_nor) {
+ copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), mvert[l->v].co);
+ }
+ if (vbo_lnor || vbo_pos_nor) {
+ GPUPackedNormal vnor = GPU_normal_convert_i10_s3(mvert[l->v].no);
+ if (vbo_pos_nor) {
+ *(GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_nor) = vnor;
}
- select_index += 1;
+ if (vbo_lnor) {
+ /* Mapped does not support lnors yet. */
+ *(GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_lnor) = vnor;
+ }
+ }
+ if (vbo_uv) {
+ MLoopUV *luv = &rdata->mloopuv[mpoly->loopstart + i];
+ copy_v2_v2(GPU_vertbuf_raw_step(&raw_uv), luv->uv);
+ }
+ /* Select Idx */
+ if (vbo_verts) {
+ int vidx = v_origindex ? v_origindex[l->v] : l->v;
+ *((uint *)GPU_vertbuf_raw_step(&raw_verts)) = vidx;
+ }
+ if (vbo_edges) {
+ int eidx = e_origindex ? e_origindex[l->e] : l->e;
+ *((uint *)GPU_vertbuf_raw_step(&raw_edges)) = eidx;
+ }
+ if (vbo_faces) {
+ *((uint *)GPU_vertbuf_raw_step(&raw_faces)) = fidx;
}
}
- else {
- for (int i = 0; i < vbo_len_capacity; i++) {
- const MVert *mv = &rdata->mvert[i];
- if (!(mv->flag & ME_HIDE)) {
- int select_id;
- GPU_select_index_get(select_index, &select_id);
- GPU_vertbuf_attr_set(vbo, attr_id.col, vidx, &select_id);
- vidx += 1;
+ }
+ /* TODO(fclem): Until we find a way to detect
+ * loose verts easily outside of edit mode, this
+ * will remain disabled. */
+#if 0
+ /* Loose edges */
+ for (int e = 0; e < edge_len; e++, medge++) {
+ int eidx = e_origindex[e];
+ if (eidx != ORIGINDEX_NONE && (medge->flag & ME_LOOSEEDGE)) {
+ for (int i = 0; i < 2; ++i) {
+ int vidx = (i == 0) ? medge->v1 : medge->v2;
+ if (vbo_pos) {
+ copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), mvert[vidx].co);
+ }
+ if (vbo_verts) {
+ *((uint *)GPU_vertbuf_raw_step(&raw_verts)) = vidx;
+ }
+ if (vbo_edges) {
+ *((uint *)GPU_vertbuf_raw_step(&raw_edges)) = eidx;
}
- select_index += 1;
}
}
}
- else {
- BMesh *bm = rdata->edit_bmesh->bm;
- const int *v_origindex = rdata->mapped.v_origindex;
- for (int i = 0; i < vbo_len_capacity; i++) {
- const int v_orig = v_origindex[i];
- if (v_orig != ORIGINDEX_NONE) {
- BMVert *eve = BM_vert_at_index(bm, v_orig);
- if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- uint select_index = select_id_offset + v_orig;
- int select_id;
- GPU_select_index_get(select_index, &select_id);
- GPU_vertbuf_attr_set(vbo, attr_id.col, vidx, &select_id);
- vidx += 1;
+ /* Loose verts */
+ for (int v = 0; v < vert_len; v++, mvert++) {
+ int vidx = v_origindex[v];
+ if (vidx != ORIGINDEX_NONE) {
+ MVert *eve = BM_vert_at_index(bm, vidx);
+ if (eve->e == NULL) {
+ if (vbo_pos) {
+ copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), mvert->co);
+ }
+ if (vbo_verts) {
+ *((uint *)GPU_vertbuf_raw_step(&raw_verts)) = vidx;
}
}
}
}
- const int vbo_len_used = vidx;
- if (vbo_len_used != vbo_len_capacity) {
- GPU_vertbuf_data_resize(vbo, vbo_len_used);
- }
+#endif
}
-
- return vbo;
+ /* Don't resize */
}
-static GPUVertBuf *mesh_create_tri_select_id(
- MeshRenderData *rdata, bool use_hide, uint select_id_offset)
+/* TODO: We could use gl_PrimitiveID as index instead of using another VBO. */
+static void mesh_create_edit_facedots_select_id(
+ MeshRenderData *rdata,
+ GPUVertBuf *vbo)
{
- BLI_assert(
- rdata->types &
- (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY));
-
- GPUVertBuf *vbo;
- {
- uint cidx = 0;
-
- static GPUVertFormat format = { 0 };
- static struct { uint col; } attr_id;
- if (format.attr_len == 0) {
- attr_id.col = GPU_vertformat_attr_add(&format, "color", GPU_COMP_I32, 1, GPU_FETCH_INT);
- }
-
- const int tri_len = mesh_render_data_looptri_len_get_maybe_mapped(rdata);
-
- vbo = GPU_vertbuf_create_with_format(&format);
-
- const int vbo_len_capacity = tri_len * 3;
- int vbo_len_used = 0;
- GPU_vertbuf_data_alloc(vbo, vbo_len_capacity);
+ const int poly_len = mesh_render_data_polys_len_get_maybe_mapped(rdata);
+ static GPUVertFormat format = { 0 };
+ static struct { uint idx; } attr_id;
+ if (format.attr_len == 0) {
+ attr_id.idx = GPU_vertformat_attr_add(&format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT);
+ }
- if (rdata->mapped.use == false) {
- if (rdata->edit_bmesh) {
- for (int i = 0; i < tri_len; i++) {
- const BMLoop **ltri = (const BMLoop **)rdata->edit_bmesh->looptris[i];
- /* Assume 'use_hide' */
- if (!BM_elem_flag_test(ltri[0]->f, BM_ELEM_HIDDEN)) {
- const int poly_index = BM_elem_index_get(ltri[0]->f);
- int select_id;
- GPU_select_index_get(poly_index + select_id_offset, &select_id);
- for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- GPU_vertbuf_attr_set(vbo, attr_id.col, cidx++, &select_id);
- }
- }
- }
- }
- else {
- const int *p_origindex = NULL;
- if (rdata->me != NULL) {
- p_origindex = CustomData_get_layer(&rdata->me->pdata, CD_ORIGINDEX);
- }
+ GPUVertBufRaw idx_step;
+ GPU_vertbuf_init_with_format(vbo, &format);
+ GPU_vertbuf_data_alloc(vbo, poly_len);
+ GPU_vertbuf_attr_get_raw_data(vbo, attr_id.idx, &idx_step);
- for (int i = 0; i < tri_len; i++) {
- const MLoopTri *mlt = &rdata->mlooptri[i];
- const int poly_index = mlt->poly;
- if (!(use_hide && (rdata->mpoly[poly_index].flag & ME_HIDE))) {
- int orig_index = p_origindex ? p_origindex[poly_index] : poly_index;
- if (orig_index != ORIGINDEX_NONE) {
- int select_id;
- GPU_select_index_get(orig_index + select_id_offset, &select_id);
- for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- GPU_vertbuf_attr_set(vbo, attr_id.col, cidx++, &select_id);
- }
- }
- }
+ /* Keep in sync with mesh_create_edit_facedots(). */
+ if (rdata->mapped.use == false) {
+ if (rdata->edit_bmesh) {
+ for (int poly = 0; poly < poly_len; poly++) {
+ const BMFace *efa = BM_face_at_index(rdata->edit_bmesh->bm, poly);
+ if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+ *((uint *)GPU_vertbuf_raw_step(&idx_step)) = poly;
}
}
}
else {
- BMesh *bm = rdata->edit_bmesh->bm;
- Mesh *me_cage = rdata->mapped.me_cage;
- const MLoopTri *mlooptri = BKE_mesh_runtime_looptri_ensure(me_cage);
- for (int i = 0; i < tri_len; i++) {
- const MLoopTri *mlt = &mlooptri[i];
- const int p_orig = rdata->mapped.p_origindex[mlt->poly];
- if (p_orig != ORIGINDEX_NONE) {
- /* Assume 'use_hide' */
- BMFace *efa = BM_face_at_index(bm, p_orig);
- if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
- int select_id;
- GPU_select_index_get(select_id_offset + p_orig, &select_id);
- for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- GPU_vertbuf_attr_set(vbo, attr_id.col, cidx++, &select_id);
- }
- }
+ for (int poly = 0; poly < poly_len; poly++) {
+ *((uint *)GPU_vertbuf_raw_step(&idx_step)) = poly;
+ }
+ }
+ }
+ else {
+ const int *p_origindex = rdata->mapped.p_origindex;
+ for (int poly = 0; poly < poly_len; poly++) {
+ const int p_orig = p_origindex[poly];
+ if (p_orig != ORIGINDEX_NONE) {
+ const BMFace *efa = BM_face_at_index(rdata->edit_bmesh->bm, p_orig);
+ if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+ *((uint *)GPU_vertbuf_raw_step(&idx_step)) = poly;
}
}
}
- vbo_len_used = cidx;
+ }
- if (vbo_len_capacity != vbo_len_used) {
- GPU_vertbuf_data_resize(vbo, vbo_len_used);
- }
+ /* Resize & Finish */
+ int facedot_len_used = GPU_vertbuf_raw_used(&idx_step);
+ if (facedot_len_used != poly_len) {
+ GPU_vertbuf_data_resize(vbo, facedot_len_used);
}
- return vbo;
}
static void mesh_create_pos_and_nor(MeshRenderData *rdata, GPUVertBuf *vbo)
@@ -3256,7 +2658,137 @@ static void mesh_create_weights(MeshRenderData *rdata, GPUVertBuf *vbo, DRW_Mesh
GPU_vertbuf_attr_fill(vbo, attr_id.weight, vert_weight);
}
-static void mesh_create_loop_pos_and_nor(MeshRenderData *rdata, GPUVertBuf *vbo, const bool use_face_sel)
+static float mesh_loop_edge_factor_get(
+ const float f_no[3], const float v_co[3], const float v_no[3], const float v_next_co[3])
+{
+ float enor[3], evec[3];
+ sub_v3_v3v3(evec, v_next_co, v_co);
+ cross_v3_v3v3(enor, v_no, evec);
+ normalize_v3(enor);
+ float d = fabsf(dot_v3v3(enor, f_no));
+ /* Rescale to the slider range. */
+ d *= (1.0f / 0.065f);
+ CLAMP(d, 0.0f, 1.0f);
+ return d;
+}
+
+static void vertbuf_raw_step_u8(GPUVertBufRaw *wd_step, const uchar wiredata)
+{
+ *((uchar *)GPU_vertbuf_raw_step(wd_step)) = wiredata;
+}
+
+static void vertbuf_raw_step_u8_to_f32(GPUVertBufRaw *wd_step, const uchar wiredata)
+{
+ *((float *)GPU_vertbuf_raw_step(wd_step)) = wiredata / 255.0f;
+}
+
+static void mesh_create_loop_edge_fac(MeshRenderData *rdata, GPUVertBuf *vbo)
+{
+ static GPUVertFormat format = { 0 };
+ static struct { uint wd; } attr_id;
+ static union { float f; uchar u; } data;
+ static void (*vertbuf_raw_step)(GPUVertBufRaw *, const uchar);
+ if (format.attr_len == 0) {
+ if (!GPU_crappy_amd_driver()) {
+ /* Some AMD drivers strangely crash with a vbo with this format. */
+ attr_id.wd = GPU_vertformat_attr_add(&format, "wd", GPU_COMP_U8, 1, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ vertbuf_raw_step = vertbuf_raw_step_u8;
+ data.u = UCHAR_MAX;
+ }
+ else {
+ attr_id.wd = GPU_vertformat_attr_add(&format, "wd", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
+ vertbuf_raw_step = vertbuf_raw_step_u8_to_f32;
+ data.f = 1.0f;
+ }
+ }
+ const int poly_len = mesh_render_data_polys_len_get(rdata);
+ const int loop_len = mesh_render_data_loops_len_get(rdata);
+ const int edge_len = mesh_render_data_edges_len_get(rdata);
+
+ GPU_vertbuf_init_with_format(vbo, &format);
+ GPU_vertbuf_data_alloc(vbo, loop_len);
+
+ GPUVertBufRaw wd_step;
+ GPU_vertbuf_attr_get_raw_data(vbo, attr_id.wd, &wd_step);
+
+ if (rdata->mapped.use == false) {
+ if (rdata->edit_bmesh) {
+ BMesh *bm = rdata->edit_bmesh->bm;
+ BMIter iter_efa, iter_loop;
+ BMFace *efa;
+ BMLoop *loop;
+ uint f;
+
+ BM_ITER_MESH_INDEX (efa, &iter_efa, bm, BM_FACES_OF_MESH, f) {
+ BM_ITER_ELEM (loop, &iter_loop, efa, BM_LOOPS_OF_FACE) {
+ float ratio = mesh_loop_edge_factor_get(efa->no, loop->v->co, loop->v->no, loop->next->v->co);
+ vertbuf_raw_step(&wd_step, ratio * 255);
+ }
+ }
+ BLI_assert(GPU_vertbuf_raw_used(&wd_step) == loop_len);
+ }
+ else {
+ const MVert *mvert = rdata->mvert;
+ const MPoly *mpoly = rdata->mpoly;
+ const MLoop *mloop = rdata->mloop;
+ MEdge *medge = (MEdge *)rdata->medge;
+ bool use_edge_render = false;
+
+ /* TODO(fclem) We don't need them to be packed. But we need rdata->poly_normals */
+ mesh_render_data_ensure_poly_normals_pack(rdata);
+
+ /* Reset flag */
+ for (int edge = 0; edge < edge_len; ++edge) {
+ /* NOTE: not thread safe. */
+ medge[edge].flag &= ~ME_EDGE_TMP_TAG;
+
+ /* HACK(fclem) Feels like a hack. Detecting the need for edge render. */
+ if ((medge[edge].flag & ME_EDGERENDER) == 0) {
+ use_edge_render = true;
+ }
+ }
+
+ for (int a = 0; a < poly_len; a++, mpoly++) {
+ const float *fnor = rdata->poly_normals[a];
+ for (int b = 0; b < mpoly->totloop; b++) {
+ const MLoop *ml1 = &mloop[mpoly->loopstart + b];
+ const MLoop *ml2 = &mloop[mpoly->loopstart + (b + 1) % mpoly->totloop];
+
+ /* Will only work for edges that have an odd number of faces connected. */
+ MEdge *ed = (MEdge *)rdata->medge + ml1->e;
+ ed->flag ^= ME_EDGE_TMP_TAG;
+
+ if (use_edge_render) {
+ vertbuf_raw_step(&wd_step, (ed->flag & ME_EDGERENDER) ? 255 : 0);
+ }
+ else {
+ float vnor_f[3];
+ normal_short_to_float_v3(vnor_f, mvert[ml1->v].no);
+ float ratio = mesh_loop_edge_factor_get(fnor,
+ mvert[ml1->v].co,
+ vnor_f,
+ mvert[ml2->v].co);
+ vertbuf_raw_step(&wd_step, ratio * 253 + 1);
+ }
+ }
+ }
+ /* Gather non-manifold edges. */
+ for (int l = 0; l < loop_len; l++, mloop++) {
+ MEdge *ed = (MEdge *)rdata->medge + mloop->e;
+ if (ed->flag & ME_EDGE_TMP_TAG) {
+ GPU_vertbuf_attr_set(vbo, attr_id.wd, l, &data);
+ }
+ }
+
+ BLI_assert(loop_len == GPU_vertbuf_raw_used(&wd_step));
+ }
+ }
+ else {
+ BLI_assert(0);
+ }
+}
+
+static void mesh_create_loop_pos_and_nor(MeshRenderData *rdata, GPUVertBuf *vbo)
{
/* TODO deduplicate format creation*/
static GPUVertFormat format = { 0 };
@@ -3325,6 +2857,7 @@ static void mesh_create_loop_pos_and_nor(MeshRenderData *rdata, GPUVertBuf *vbo,
const MLoop *mloop = rdata->mloop + mpoly->loopstart;
const float (*lnors)[3] = (rdata->loop_normals) ? &rdata->loop_normals[mpoly->loopstart] : NULL;
const GPUPackedNormal *fnor = (mpoly->flag & ME_SMOOTH) ? NULL : &rdata->poly_normals_pack[a];
+ const int hide_select_flag = (mpoly->flag & ME_HIDE) ? -1 : ((mpoly->flag & ME_FACE_SEL) ? 1 : 0);
for (int b = 0; b < mpoly->totloop; b++, mloop++) {
copy_v3_v3(GPU_vertbuf_raw_step(&pos_step), mvert[mloop->v].co);
GPUPackedNormal *pnor = (GPUPackedNormal *)GPU_vertbuf_raw_step(&nor_step);
@@ -3337,9 +2870,7 @@ static void mesh_create_loop_pos_and_nor(MeshRenderData *rdata, GPUVertBuf *vbo,
else {
*pnor = GPU_normal_convert_i10_s3(mvert[mloop->v].no);
}
- if (use_face_sel) {
- pnor->w = (mpoly->flag & ME_HIDE) ? -1 : ((mpoly->flag & ME_FACE_SEL) ? 1 : 0);
- }
+ pnor->w = hide_select_flag;
}
}
@@ -3403,15 +2934,15 @@ static void mesh_create_loop_uv_and_tan(MeshRenderData *rdata, GPUVertBuf *vbo)
GPUVertFormat format = { 0 };
for (uint i = 0; i < uv_len; i++) {
- const char *attrib_name = mesh_render_data_uv_layer_uuid_get(rdata, i);
+ const char *attr_name = mesh_render_data_uv_layer_uuid_get(rdata, i);
#if 0 /* these are clamped. Maybe use them as an option in the future */
- uv_id[i] = GPU_vertformat_attr_add(&format, attrib_name, GPU_COMP_I16, 2, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ uv_id[i] = GPU_vertformat_attr_add(&format, attr_name, GPU_COMP_I16, 2, GPU_FETCH_INT_TO_FLOAT_UNIT);
#else
- uv_id[i] = GPU_vertformat_attr_add(&format, attrib_name, GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+ uv_id[i] = GPU_vertformat_attr_add(&format, attr_name, GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
#endif
/* Auto Name */
- attrib_name = mesh_render_data_uv_auto_layer_uuid_get(rdata, i);
- GPU_vertformat_alias_add(&format, attrib_name);
+ attr_name = mesh_render_data_uv_auto_layer_uuid_get(rdata, i);
+ GPU_vertformat_alias_add(&format, attr_name);
if (i == rdata->cd.layers.uv_active) {
GPU_vertformat_alias_add(&format, "u");
@@ -3419,17 +2950,22 @@ static void mesh_create_loop_uv_and_tan(MeshRenderData *rdata, GPUVertBuf *vbo)
}
for (uint i = 0; i < tangent_len; i++) {
- const char *attrib_name = mesh_render_data_tangent_layer_uuid_get(rdata, i);
+ const char *attr_name = mesh_render_data_tangent_layer_uuid_get(rdata, i);
#ifdef USE_COMP_MESH_DATA
- tangent_id[i] = GPU_vertformat_attr_add(&format, attrib_name, GPU_COMP_I16, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ tangent_id[i] = GPU_vertformat_attr_add(&format, attr_name, GPU_COMP_I16, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
#else
- tangent_id[i] = GPU_vertformat_attr_add(&format, attrib_name, GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
+ tangent_id[i] = GPU_vertformat_attr_add(&format, attr_name, GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
#endif
if (i == rdata->cd.layers.tangent_active) {
GPU_vertformat_alias_add(&format, "t");
}
}
+ /* HACK: Create a dummy attribute in case there is no valid UV/tangent layer. */
+ if (layers_combined_len == 0) {
+ GPU_vertformat_attr_add(&format, "dummy", GPU_COMP_U8, 1, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ }
+
GPU_vertbuf_init_with_format(vbo, &format);
GPU_vertbuf_data_alloc(vbo, loops_len);
@@ -3513,12 +3049,12 @@ static void mesh_create_loop_vcol(MeshRenderData *rdata, GPUVertBuf *vbo)
GPUVertFormat format = { 0 };
for (uint i = 0; i < vcol_len; i++) {
- const char *attrib_name = mesh_render_data_vcol_layer_uuid_get(rdata, i);
- vcol_id[i] = GPU_vertformat_attr_add(&format, attrib_name, GPU_COMP_U8, 3, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ const char *attr_name = mesh_render_data_vcol_layer_uuid_get(rdata, i);
+ vcol_id[i] = GPU_vertformat_attr_add(&format, attr_name, GPU_COMP_U8, 3, GPU_FETCH_INT_TO_FLOAT_UNIT);
/* Auto layer */
if (rdata->cd.layers.auto_vcol[i]) {
- attrib_name = mesh_render_data_vcol_auto_layer_uuid_get(rdata, i);
- GPU_vertformat_alias_add(&format, attrib_name);
+ attr_name = mesh_render_data_vcol_auto_layer_uuid_get(rdata, i);
+ GPU_vertformat_alias_add(&format, attr_name);
}
if (i == rdata->cd.layers.vcol_active) {
GPU_vertformat_alias_add(&format, "c");
@@ -3571,268 +3107,24 @@ static void mesh_create_loop_vcol(MeshRenderData *rdata, GPUVertBuf *vbo)
#undef USE_COMP_MESH_DATA
}
-static GPUVertFormat *edit_mesh_pos_nor_format(uint *r_pos_id, uint *r_nor_id)
-{
- static GPUVertFormat format_pos_nor = { 0 };
- static uint pos_id, nor_id;
- if (format_pos_nor.attr_len == 0) {
- pos_id = GPU_vertformat_attr_add(&format_pos_nor, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
- nor_id = GPU_vertformat_attr_add(&format_pos_nor, "vnor", GPU_COMP_I10, 3, GPU_FETCH_INT_TO_FLOAT_UNIT);
- }
- *r_pos_id = pos_id;
- *r_nor_id = nor_id;
- return &format_pos_nor;
-}
-
-static GPUVertFormat *edit_mesh_lnor_format(uint *r_lnor_id)
-{
- static GPUVertFormat format_lnor = { 0 };
- static uint lnor_id;
- if (format_lnor.attr_len == 0) {
- lnor_id = GPU_vertformat_attr_add(&format_lnor, "lnor", GPU_COMP_I10, 3, GPU_FETCH_INT_TO_FLOAT_UNIT);
- }
- *r_lnor_id = lnor_id;
- return &format_lnor;
-}
-
-static GPUVertFormat *edit_mesh_data_format(uint *r_data_id)
-{
- static GPUVertFormat format_flag = { 0 };
- static uint data_id;
- if (format_flag.attr_len == 0) {
- data_id = GPU_vertformat_attr_add(&format_flag, "data", GPU_COMP_U8, 4, GPU_FETCH_INT);
- GPU_vertformat_triple_load(&format_flag);
- }
- *r_data_id = data_id;
- return &format_flag;
-}
-
-static GPUVertFormat *edit_mesh_facedot_format(uint *r_pos_id, uint *r_nor_flag_id)
-{
- static GPUVertFormat format_facedots = { 0 };
- static uint pos_id, nor_flag_id;
- if (format_facedots.attr_len == 0) {
- pos_id = GPU_vertformat_attr_add(&format_facedots, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
- nor_flag_id = GPU_vertformat_attr_add(&format_facedots, "norAndFlag", GPU_COMP_I10, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
- }
- *r_pos_id = pos_id;
- *r_nor_flag_id = nor_flag_id;
- return &format_facedots;
-}
-
-static void mesh_create_edit_tris_and_verts(
- MeshRenderData *rdata,
- GPUVertBuf *vbo_data, GPUVertBuf *vbo_pos_nor, GPUVertBuf *vbo_lnor, GPUIndexBuf *ibo_verts)
-{
- BMesh *bm = rdata->edit_bmesh->bm;
- BMIter iter;
- BMVert *ev;
- const int tri_len = mesh_render_data_looptri_len_get_maybe_mapped(rdata);
- int tri_len_used = 0;
- int points_len = bm->totvert;
- int verts_tri_len = tri_len * 3;
- struct { uint pos, vnor, lnor, data; } attr_id;
- GPUVertFormat *pos_nor_format = edit_mesh_pos_nor_format(&attr_id.pos, &attr_id.vnor);
- GPUVertFormat *data_format = edit_mesh_data_format(&attr_id.data);
- GPUVertFormat *lnor_format = edit_mesh_lnor_format(&attr_id.lnor);
-
- /* Positions & Vert Normals */
- if (DRW_TEST_ASSIGN_VBO(vbo_pos_nor)) {
- GPU_vertbuf_init_with_format(vbo_pos_nor, pos_nor_format);
- GPU_vertbuf_data_alloc(vbo_pos_nor, verts_tri_len);
- }
- /* Overlay data */
- if (DRW_TEST_ASSIGN_VBO(vbo_data)) {
- GPU_vertbuf_init_with_format(vbo_data, data_format);
- GPU_vertbuf_data_alloc(vbo_data, verts_tri_len);
- }
- /* Loop Normals */
- if (DRW_TEST_ASSIGN_VBO(vbo_lnor)) {
- GPU_vertbuf_init_with_format(vbo_lnor, lnor_format);
- GPU_vertbuf_data_alloc(vbo_lnor, verts_tri_len);
- }
- /* Verts IBO */
- GPUIndexBufBuilder elb, *elbp = NULL;
- if (DRW_TEST_ASSIGN_IBO(ibo_verts)) {
- elbp = &elb;
- GPU_indexbuf_init(elbp, GPU_PRIM_POINTS, points_len, verts_tri_len);
- /* Clear tag */
- BM_ITER_MESH(ev, &iter, bm, BM_VERTS_OF_MESH) {
- BM_elem_flag_disable(ev, BM_ELEM_TAG);
- }
- }
-
- if (rdata->mapped.use == false) {
- for (int i = 0; i < tri_len; i++) {
- const BMLoop **bm_looptri = (const BMLoop **)rdata->edit_bmesh->looptris[i];
- if (!BM_elem_flag_test(bm_looptri[0]->f, BM_ELEM_HIDDEN)) {
- add_edit_tri(rdata, vbo_pos_nor, vbo_lnor, vbo_data, elbp,
- attr_id.pos, attr_id.vnor, attr_id.lnor, attr_id.data,
- bm_looptri, tri_len_used);
- tri_len_used += 3;
- }
- }
- }
- else {
- Mesh *me_cage = rdata->mapped.me_cage;
-
- /* TODO(fclem): Maybe move data generation to mesh_render_data_create() */
- const MLoopTri *mlooptri = BKE_mesh_runtime_looptri_ensure(me_cage);
- if (vbo_lnor && !CustomData_has_layer(&me_cage->pdata, CD_NORMAL)) {
- BKE_mesh_ensure_normals_for_display(me_cage);
- }
- const float (*polynors)[3] = CustomData_get_layer(&me_cage->pdata, CD_NORMAL);
- const float (*loopnors)[3] = CustomData_get_layer(&me_cage->ldata, CD_NORMAL);
-
- for (int i = 0; i < tri_len; i++) {
- const MLoopTri *mlt = &mlooptri[i];
- const int p_orig = rdata->mapped.p_origindex[mlt->poly];
- if (p_orig != ORIGINDEX_NONE) {
- BMFace *efa = BM_face_at_index(bm, p_orig);
- if (add_edit_tri_mapped(rdata, vbo_pos_nor, vbo_lnor, vbo_data, elbp,
- attr_id.pos, attr_id.vnor, attr_id.lnor, attr_id.data,
- efa, mlt, polynors, loopnors, tri_len_used))
- {
- tri_len_used += 3;
- }
- }
- }
- }
-
- /* Resize & Finish */
- if (elbp != NULL) {
- GPU_indexbuf_build_in_place(elbp, ibo_verts);
- }
- if (tri_len_used != verts_tri_len) {
- if (vbo_pos_nor != NULL) {
- GPU_vertbuf_data_resize(vbo_pos_nor, tri_len_used);
- }
- if (vbo_lnor != NULL) {
- GPU_vertbuf_data_resize(vbo_lnor, tri_len_used);
- }
- if (vbo_data != NULL) {
- GPU_vertbuf_data_resize(vbo_data, tri_len_used);
- }
- }
-}
-
-static void mesh_create_edit_loose_edges(
- MeshRenderData *rdata,
- GPUVertBuf *vbo_data_ledges, GPUVertBuf *vbo_pos_nor_ledges)
-{
- BMesh *bm = rdata->edit_bmesh->bm;
- const int loose_edge_len = mesh_render_data_loose_edges_len_get_maybe_mapped(rdata);
- const int verts_ledges_len = loose_edge_len * 2;
- int ledges_len_used = 0;
-
- struct { uint pos, vnor, data; } attr_id;
- GPUVertFormat *pos_nor_format = edit_mesh_pos_nor_format(&attr_id.pos, &attr_id.vnor);
- GPUVertFormat *data_format = edit_mesh_data_format(&attr_id.data);
-
- /* Positions & Vert Normals */
- if (DRW_TEST_ASSIGN_VBO(vbo_pos_nor_ledges)) {
- GPU_vertbuf_init_with_format(vbo_pos_nor_ledges, pos_nor_format);
- GPU_vertbuf_data_alloc(vbo_pos_nor_ledges, verts_ledges_len);
- }
- /* Overlay data */
- if (DRW_TEST_ASSIGN_VBO(vbo_data_ledges)) {
- GPU_vertbuf_init_with_format(vbo_data_ledges, data_format);
- GPU_vertbuf_data_alloc(vbo_data_ledges, verts_ledges_len);
- }
-
- if (rdata->mapped.use == false) {
- for (uint i = 0; i < loose_edge_len; i++) {
- const BMEdge *eed = BM_edge_at_index(bm, rdata->loose_edges[i]);
- add_edit_loose_edge(rdata, vbo_pos_nor_ledges, vbo_data_ledges,
- attr_id.pos, attr_id.vnor, attr_id.data,
- eed, ledges_len_used);
- ledges_len_used += 2;
- }
- }
- else {
- Mesh *me_cage = rdata->mapped.me_cage;
- const MVert *mvert = me_cage->mvert;
- const MEdge *medge = me_cage->medge;
- const int *e_origindex = rdata->mapped.e_origindex;
-
- for (uint i_iter = 0; i_iter < loose_edge_len; i_iter++) {
- const int i = rdata->mapped.loose_edges[i_iter];
- const int e_orig = e_origindex[i];
- BMEdge *eed = BM_edge_at_index(bm, e_orig);
- add_edit_loose_edge_mapped(rdata, vbo_pos_nor_ledges, vbo_data_ledges,
- attr_id.pos, attr_id.vnor, attr_id.data,
- eed, mvert, &medge[i], ledges_len_used);
- ledges_len_used += 2;
- }
- }
- BLI_assert(ledges_len_used == verts_ledges_len);
-}
-
-static void mesh_create_edit_loose_verts(
- MeshRenderData *rdata,
- GPUVertBuf *vbo_data_lverts, GPUVertBuf *vbo_pos_nor_lverts)
-{
- BMesh *bm = rdata->edit_bmesh->bm;
- const int loose_verts_len = mesh_render_data_loose_verts_len_get_maybe_mapped(rdata);
- const int verts_lverts_len = loose_verts_len;
- int lverts_len_used = 0;
-
- struct { uint pos, vnor, data; } attr_id;
- GPUVertFormat *pos_nor_format = edit_mesh_pos_nor_format(&attr_id.pos, &attr_id.vnor);
- GPUVertFormat *data_format = edit_mesh_data_format(&attr_id.data);
-
- /* Positions & Vert Normals */
- if (DRW_TEST_ASSIGN_VBO(vbo_pos_nor_lverts)) {
- GPU_vertbuf_init_with_format(vbo_pos_nor_lverts, pos_nor_format);
- GPU_vertbuf_data_alloc(vbo_pos_nor_lverts, verts_lverts_len);
- }
- /* Overlay data */
- if (DRW_TEST_ASSIGN_VBO(vbo_data_lverts)) {
- GPU_vertbuf_init_with_format(vbo_data_lverts, data_format);
- GPU_vertbuf_data_alloc(vbo_data_lverts, verts_lverts_len);
- }
-
- if (rdata->mapped.use == false) {
- for (uint i = 0; i < loose_verts_len; i++) {
- BMVert *eve = BM_vert_at_index(bm, rdata->loose_verts[i]);
- add_edit_loose_vert(rdata, vbo_pos_nor_lverts, vbo_data_lverts,
- attr_id.pos, attr_id.vnor, attr_id.data,
- eve, lverts_len_used);
- lverts_len_used += 1;
- }
- }
- else {
- Mesh *me_cage = rdata->mapped.me_cage;
- const MVert *mvert = me_cage->mvert;
- const int *v_origindex = rdata->mapped.v_origindex;
-
- for (uint i_iter = 0; i_iter < loose_verts_len; i_iter++) {
- const int i = rdata->mapped.loose_verts[i_iter];
- const int v_orig = v_origindex[i];
- BMVert *eve = BM_vert_at_index(bm, v_orig);
- add_edit_loose_vert_mapped(rdata, vbo_pos_nor_lverts, vbo_data_lverts,
- attr_id.pos, attr_id.vnor, attr_id.data,
- eve, &mvert[i], lverts_len_used);
- lverts_len_used += 1;
- }
- }
- BLI_assert(lverts_len_used == verts_lverts_len);
-}
-
static void mesh_create_edit_facedots(
MeshRenderData *rdata,
- GPUVertBuf *vbo_pos_nor_data_facedots)
+ GPUVertBuf *vbo_facedots_pos_nor_data)
{
const int poly_len = mesh_render_data_polys_len_get_maybe_mapped(rdata);
const int verts_facedot_len = poly_len;
int facedot_len_used = 0;
- struct { uint fdot_pos, fdot_nor_flag; } attr_id;
- GPUVertFormat *facedot_format = edit_mesh_facedot_format(&attr_id.fdot_pos, &attr_id.fdot_nor_flag);
+ static struct { uint fdot_pos, fdot_nor_flag; } attr_id;
+ static GPUVertFormat facedot_format = { 0 };
+ if (facedot_format.attr_len == 0) {
+ attr_id.fdot_pos = GPU_vertformat_attr_add(&facedot_format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
+ attr_id.fdot_nor_flag = GPU_vertformat_attr_add(&facedot_format, "norAndFlag", GPU_COMP_I10, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ }
- if (DRW_TEST_ASSIGN_VBO(vbo_pos_nor_data_facedots)) {
- GPU_vertbuf_init_with_format(vbo_pos_nor_data_facedots, facedot_format);
- GPU_vertbuf_data_alloc(vbo_pos_nor_data_facedots, verts_facedot_len);
+ if (DRW_TEST_ASSIGN_VBO(vbo_facedots_pos_nor_data)) {
+ GPU_vertbuf_init_with_format(vbo_facedots_pos_nor_data, &facedot_format);
+ GPU_vertbuf_data_alloc(vbo_facedots_pos_nor_data, verts_facedot_len);
/* TODO(fclem): Maybe move data generation to mesh_render_data_create() */
if (rdata->edit_bmesh) {
if (rdata->edit_data && rdata->edit_data->vertexCos != NULL) {
@@ -3844,7 +3136,7 @@ static void mesh_create_edit_facedots(
if (rdata->mapped.use == false) {
for (int i = 0; i < poly_len; i++) {
- if (add_edit_facedot(rdata, vbo_pos_nor_data_facedots,
+ if (add_edit_facedot(rdata, vbo_facedots_pos_nor_data,
attr_id.fdot_pos, attr_id.fdot_nor_flag,
i, facedot_len_used))
{
@@ -3861,7 +3153,7 @@ static void mesh_create_edit_facedots(
const int *v_origindex = rdata->mapped.v_origindex;
#endif
for (int i = 0; i < poly_len; i++) {
- if (add_edit_facedot_mapped(rdata, vbo_pos_nor_data_facedots,
+ if (add_edit_facedot_mapped(rdata, vbo_facedots_pos_nor_data,
attr_id.fdot_pos, attr_id.fdot_nor_flag,
i, facedot_len_used))
{
@@ -3872,8 +3164,8 @@ static void mesh_create_edit_facedots(
/* Resize & Finish */
if (facedot_len_used != verts_facedot_len) {
- if (vbo_pos_nor_data_facedots != NULL) {
- GPU_vertbuf_data_resize(vbo_pos_nor_data_facedots, facedot_len_used);
+ if (vbo_facedots_pos_nor_data != NULL) {
+ GPU_vertbuf_data_resize(vbo_facedots_pos_nor_data, facedot_len_used);
}
}
}
@@ -3997,149 +3289,6 @@ static void mesh_create_edges_adjacency_lines(
}
#undef NO_EDGE
-static EdgeHash *create_looptri_edge_adjacency_hash(MeshRenderData *rdata, EdgeAdjacentVerts **r_adj_data)
-{
- const int tri_len = mesh_render_data_looptri_len_get(rdata);
- /* Create adjacency info in looptri */
- EdgeHash *eh = BLI_edgehash_new_ex(__func__, tri_len * 3);
- /* TODO allocate less memory (based on edge count) */
- EdgeAdjacentVerts *adj_data = MEM_mallocN(tri_len * 3 * sizeof(EdgeAdjacentVerts), __func__);
- *r_adj_data = adj_data;
- /* Create edges for each pair of triangles sharing an edge. */
- for (int i = 0; i < tri_len; i++) {
- for (int e = 0; e < 3; e++) {
- uint v0, v1, v2;
- if (rdata->edit_bmesh) {
- const BMLoop **bm_looptri = (const BMLoop **)rdata->edit_bmesh->looptris[i];
- if (BM_elem_flag_test(bm_looptri[0]->f, BM_ELEM_HIDDEN)) {
- break;
- }
- v0 = BM_elem_index_get(bm_looptri[e]->v);
- v1 = BM_elem_index_get(bm_looptri[(e + 1) % 3]->v);
- v2 = BM_elem_index_get(bm_looptri[(e + 2) % 3]->v);
- }
- else {
- const MLoop *mloop = rdata->mloop;
- const MLoopTri *mlt = rdata->mlooptri + i;
- v0 = mloop[mlt->tri[e]].v;
- v1 = mloop[mlt->tri[(e + 1) % 3]].v;
- v2 = mloop[mlt->tri[(e + 2) % 3]].v;
- }
-
- EdgeAdjacentVerts **eav;
- bool value_is_init = BLI_edgehash_ensure_p(eh, v1, v2, (void ***)&eav);
- if (!value_is_init) {
- *eav = adj_data++;
- (*eav)->vert_index[0] = v0;
- (*eav)->vert_index[1] = -1;
- }
- else {
- if ((*eav)->vert_index[1] == -1) {
- (*eav)->vert_index[1] = v0;
- }
- else {
- /* Not a manifold edge. */
- }
- }
- }
- }
- return eh;
-}
-
-static void mesh_create_wireframe_data_tess(MeshRenderData *rdata, GPUVertBuf *vbo)
-{
- static uint data_id;
- static GPUVertFormat format = {0};
- if (format.attr_len == 0) {
- data_id = GPU_vertformat_attr_add(&format, "wd", GPU_COMP_U8, 1, GPU_FETCH_INT_TO_FLOAT_UNIT);
- GPU_vertformat_triple_load(&format);
- }
-
- GPU_vertbuf_init_with_format(vbo, &format);
-
- const int tri_len = mesh_render_data_looptri_len_get(rdata);
- int vbo_len_capacity = tri_len * 3;
- GPU_vertbuf_data_alloc(vbo, vbo_len_capacity);
-
- int vidx = 0;
- EdgeHash *eh = NULL;
- EdgeAdjacentVerts *adj_data = NULL;
- eh = create_looptri_edge_adjacency_hash(rdata, &adj_data);
-
- for (int i = 0; i < tri_len; i++) {
- uchar vdata[3] = {0, 0, 0};
-
- const MVert *mvert = rdata->mvert;
- const MEdge *medge = rdata->medge;
- const MLoop *mloop = rdata->mloop;
- const MLoopTri *mlt = rdata->mlooptri + i;
-
- int j, j_next;
- for (j = 2, j_next = 0; j_next < 3; j = j_next++) {
- const MEdge *ed = &medge[mloop[mlt->tri[j]].e];
- const uint tri_edge[2] = {mloop[mlt->tri[j]].v, mloop[mlt->tri[j_next]].v};
-
- if ((((ed->v1 == tri_edge[0]) && (ed->v2 == tri_edge[1])) ||
- ((ed->v1 == tri_edge[1]) && (ed->v2 == tri_edge[0]))))
- {
- /* Real edge. */
- /* Temp Workaround. If a mesh has a subdiv mod we should not
- * compute the edge sharpness. Instead, we just mix both for now. */
- vdata[j] = ((ed->flag & ME_EDGERENDER) != 0) ? 0xFD : 0xFE;
- }
- }
-
- /* If at least one edge is real. */
- if (vdata[0] || vdata[1] || vdata[2]) {
- float fnor[3];
- normal_tri_v3(fnor,
- mvert[mloop[mlt->tri[0]].v].co,
- mvert[mloop[mlt->tri[1]].v].co,
- mvert[mloop[mlt->tri[2]].v].co);
-
- for (int e = 0; e < 3; e++) {
- /* Non-real edge. */
- if (vdata[e] == 0) {
- continue;
- }
- int v0 = mloop[mlt->tri[e]].v;
- int v1 = mloop[mlt->tri[(e + 1) % 3]].v;
- EdgeAdjacentVerts *eav = BLI_edgehash_lookup(eh, v0, v1);
- /* If Non Manifold. */
- if (eav->vert_index[1] == -1) {
- vdata[e] = 0xFF;
- }
- else if (vdata[e] == 0xFD) {
- int v2 = mloop[mlt->tri[(e + 2) % 3]].v;
- /* Select the right opposite vertex */
- v2 = (eav->vert_index[1] == v2) ? eav->vert_index[0] : eav->vert_index[1];
- float fnor_adj[3];
- normal_tri_v3(fnor_adj,
- mvert[v1].co,
- mvert[v0].co,
- mvert[v2].co);
- float fac = dot_v3v3(fnor_adj, fnor);
- fac = fac * fac * 50.0f - 49.0f;
- CLAMP(fac, 0.0f, 0.999f);
- /* Shorten the range to make the non-ME_EDGERENDER fade first.
- * Add one because 0x0 is no edges. */
- vdata[e] = (uchar)(0xDF * fac) + 1;
- if (vdata[e] < 0.999f) {
- /* TODO construct fast face wire index buffer. */
- }
- }
- }
- }
-
- for (int e = 0; e < 3; e++) {
- GPU_vertbuf_attr_set(vbo, data_id, vidx++, &vdata[e]);
- }
- }
-
- BLI_edgehash_free(eh, NULL);
- MEM_freeN(adj_data);
-}
-
static void mesh_create_edges_lines(MeshRenderData *rdata, GPUIndexBuf *ibo, const bool use_hide)
{
const int verts_len = mesh_render_data_verts_len_get_maybe_mapped(rdata);
@@ -4253,6 +3402,72 @@ static void mesh_create_surf_tris(MeshRenderData *rdata, GPUIndexBuf *ibo, const
static void mesh_create_loops_lines(
MeshRenderData *rdata, GPUIndexBuf *ibo, const bool use_hide)
{
+ const int edge_len = mesh_render_data_edges_len_get(rdata);
+ const int loop_len = mesh_render_data_loops_len_get(rdata);
+ const int poly_len = mesh_render_data_polys_len_get(rdata);
+
+ GPUIndexBufBuilder elb;
+ GPU_indexbuf_init(&elb, GPU_PRIM_LINES, edge_len, loop_len);
+
+ if (rdata->mapped.use == false) {
+ if (rdata->edit_bmesh) {
+ BMesh *bm = rdata->edit_bmesh->bm;
+ BMIter iter;
+ BMEdge *bm_edge;
+
+ BM_ITER_MESH (bm_edge, &iter, bm, BM_EDGES_OF_MESH) {
+ /* use_hide always for edit-mode */
+ if (!BM_elem_flag_test(bm_edge, BM_ELEM_HIDDEN) &&
+ bm_edge->l != NULL)
+ {
+ BMLoop *bm_loop1 = BM_vert_find_first_loop_visible(bm_edge->v1);
+ BMLoop *bm_loop2 = BM_vert_find_first_loop_visible(bm_edge->v2);
+ int v1 = BM_elem_index_get(bm_loop1);
+ int v2 = BM_elem_index_get(bm_loop2);
+ if (v1 > v2) {
+ SWAP(int, v1, v2);
+ }
+ GPU_indexbuf_add_line_verts(&elb, v1, v2);
+ }
+ }
+ }
+ else {
+ MLoop *mloop = (MLoop *)rdata->mloop;
+ MEdge *medge = (MEdge *)rdata->medge;
+
+ /* Reset flag */
+ for (int edge = 0; edge < edge_len; ++edge) {
+ /* NOTE: not thread safe. */
+ medge[edge].flag &= ~ME_EDGE_TMP_TAG;
+ }
+
+ for (int poly = 0; poly < poly_len; poly++) {
+ const MPoly *mp = &rdata->mpoly[poly];
+ if (!(use_hide && (mp->flag & ME_HIDE))) {
+ for (int j = 0; j < mp->totloop; j++) {
+ MEdge *ed = (MEdge *)rdata->medge + mloop[mp->loopstart + j].e;
+ if ((ed->flag & ME_EDGE_TMP_TAG) == 0) {
+ ed->flag |= ME_EDGE_TMP_TAG;
+ int v1 = mp->loopstart + j;
+ int v2 = mp->loopstart + (j + 1) % mp->totloop;
+ GPU_indexbuf_add_line_verts(&elb, v1, v2);
+ }
+ }
+ }
+ }
+ }
+ }
+ else {
+ /* Implement ... eventually if needed. */
+ BLI_assert(0);
+ }
+
+ GPU_indexbuf_build_in_place(&elb, ibo);
+}
+
+static void mesh_create_loops_line_strips(
+ MeshRenderData *rdata, GPUIndexBuf *ibo, const bool use_hide)
+{
const int loop_len = mesh_render_data_loops_len_get(rdata);
const int poly_len = mesh_render_data_polys_len_get(rdata);
@@ -4321,9 +3536,7 @@ static void mesh_create_loose_edges_lines(
BMIter eiter;
BMEdge *eed;
BM_ITER_MESH(eed, &eiter, bm, BM_EDGES_OF_MESH) {
- if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) &&
- (eed->l == NULL || !bm_edge_has_visible_face(eed)))
- {
+ if (bm_edge_is_loose_and_visible(eed)) {
GPU_indexbuf_add_line_verts(&elb, BM_elem_index_get(eed->v1), BM_elem_index_get(eed->v2));
}
}
@@ -4374,7 +3587,7 @@ static void mesh_create_loops_tris(
if (BM_elem_flag_test(bm_face, BM_ELEM_HIDDEN)) {
continue;
}
- int mat = (ibo_len > 1) ? bm_face->mat_nr : 0;
+ int mat = min_ii(ibo_len - 1, bm_face->mat_nr);
GPU_indexbuf_add_tri_verts(
&elb[mat],
BM_elem_index_get(bm_looptri[0]),
@@ -4389,7 +3602,7 @@ static void mesh_create_loops_tris(
if (use_hide && (mp->flag & ME_HIDE)) {
continue;
}
- int mat = (ibo_len > 1) ? mp->mat_nr : 0;
+ int mat = min_ii(ibo_len - 1, mp->mat_nr);
GPU_indexbuf_add_tri_verts(&elb[mat], mlt->tri[0], mlt->tri[1], mlt->tri[2]);
}
}
@@ -4407,7 +3620,7 @@ static void mesh_create_loops_tris(
/* Assume 'use_hide' */
BMFace *efa = BM_face_at_index(bm, p_orig);
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
- int mat = (ibo_len > 1) ? efa->mat_nr : 0;
+ int mat = min_ii(ibo_len - 1, efa->mat_nr);
GPU_indexbuf_add_tri_verts(&elb[mat], mlt->tri[0], mlt->tri[1], mlt->tri[2]);
}
}
@@ -4419,11 +3632,281 @@ static void mesh_create_loops_tris(
}
}
+/* Warning! this function is not thread safe!
+ * It writes to MEdge->flag with ME_EDGE_TMP_TAG. */
+static void mesh_create_edit_loops_points_lines(MeshRenderData *rdata, GPUIndexBuf *ibo_verts, GPUIndexBuf *ibo_edges)
+{
+ BMIter iter;
+ int i;
+
+ const int vert_len = mesh_render_data_verts_len_get_maybe_mapped(rdata);
+ const int edge_len = mesh_render_data_edges_len_get_maybe_mapped(rdata);
+ const int loop_len = mesh_render_data_loops_len_get_maybe_mapped(rdata);
+ const int poly_len = mesh_render_data_polys_len_get_maybe_mapped(rdata);
+ const int lvert_len = mesh_render_data_loose_verts_len_get_maybe_mapped(rdata);
+ const int ledge_len = mesh_render_data_loose_edges_len_get_maybe_mapped(rdata);
+ const int tot_loop_len = loop_len + ledge_len * 2 + lvert_len;
+
+ GPUIndexBufBuilder elb_vert, elb_edge;
+ if (DRW_TEST_ASSIGN_IBO(ibo_edges)) {
+ GPU_indexbuf_init(&elb_edge, GPU_PRIM_LINES, edge_len, tot_loop_len);
+ }
+ if (DRW_TEST_ASSIGN_IBO(ibo_verts)) {
+ GPU_indexbuf_init(&elb_vert, GPU_PRIM_POINTS, tot_loop_len, tot_loop_len);
+ }
+
+ int loop_idx = 0;
+ if (rdata->edit_bmesh && (rdata->mapped.use == false)) {
+ BMesh *bm = rdata->edit_bmesh->bm;
+ /* Edges not loose. */
+ if (ibo_edges) {
+ BMEdge *eed;
+ BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+ if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+ BMLoop *l = BM_edge_find_first_loop_visible(eed);
+ if (l != NULL) {
+ int v1 = BM_elem_index_get(eed->l);
+ int v2 = BM_elem_index_get(eed->l->next);
+ GPU_indexbuf_add_line_verts(&elb_edge, v1, v2);
+ }
+ }
+ }
+ }
+ /* Face Loops */
+ if (ibo_verts) {
+ BMVert *eve;
+ BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ BMLoop *l = BM_vert_find_first_loop_visible(eve);
+ if (l != NULL) {
+ int v = BM_elem_index_get(l);
+ GPU_indexbuf_add_generic_vert(&elb_vert, v);
+ }
+ }
+ }
+ }
+ loop_idx = loop_len;
+ /* Loose edges */
+ for (i = 0; i < ledge_len; ++i) {
+ if (ibo_verts) {
+ GPU_indexbuf_add_generic_vert(&elb_vert, loop_idx + 0);
+ GPU_indexbuf_add_generic_vert(&elb_vert, loop_idx + 1);
+ }
+ if (ibo_edges) {
+ GPU_indexbuf_add_line_verts(&elb_edge, loop_idx + 0, loop_idx + 1);
+ }
+ loop_idx += 2;
+ }
+ /* Loose verts */
+ if (ibo_verts) {
+ for (i = 0; i < lvert_len; ++i) {
+ GPU_indexbuf_add_generic_vert(&elb_vert, loop_idx);
+ loop_idx += 1;
+ }
+ }
+ }
+ else if (rdata->mapped.use) {
+ const MPoly *mpoly = rdata->mapped.me_cage->mpoly;
+ MVert *mvert = rdata->mapped.me_cage->mvert;
+ MEdge *medge = rdata->mapped.me_cage->medge;
+ BMesh *bm = rdata->edit_bmesh->bm;
+
+ const int *v_origindex = rdata->mapped.v_origindex;
+ const int *e_origindex = rdata->mapped.e_origindex;
+ const int *p_origindex = rdata->mapped.p_origindex;
+
+ /* Reset flag */
+ for (int edge = 0; edge < edge_len; ++edge) {
+ /* NOTE: not thread safe. */
+ medge[edge].flag &= ~ME_EDGE_TMP_TAG;
+ }
+ for (int vert = 0; vert < vert_len; ++vert) {
+ /* NOTE: not thread safe. */
+ mvert[vert].flag &= ~ME_VERT_TMP_TAG;
+ }
+
+ /* Face Loops */
+ for (int poly = 0; poly < poly_len; poly++, mpoly++) {
+ int fidx = p_origindex[poly];
+ if (fidx != ORIGINDEX_NONE) {
+ BMFace *efa = BM_face_at_index(bm, fidx);
+ if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+ const MLoop *mloop = &rdata->mapped.me_cage->mloop[mpoly->loopstart];
+ for (i = 0; i < mpoly->totloop; ++i, ++mloop) {
+ if (ibo_verts && (v_origindex[mloop->v] != ORIGINDEX_NONE) &&
+ (mvert[mloop->v].flag & ME_VERT_TMP_TAG) == 0)
+ {
+ mvert[mloop->v].flag |= ME_VERT_TMP_TAG;
+ GPU_indexbuf_add_generic_vert(&elb_vert, loop_idx + i);
+ }
+ if (ibo_edges && (e_origindex[mloop->e] != ORIGINDEX_NONE) &&
+ ((medge[mloop->e].flag & ME_EDGE_TMP_TAG) == 0))
+ {
+ medge[mloop->e].flag |= ME_EDGE_TMP_TAG;
+ int v1 = loop_idx + i;
+ int v2 = loop_idx + ((i + 1) % mpoly->totloop);
+ GPU_indexbuf_add_line_verts(&elb_edge, v1, v2);
+ }
+ }
+ }
+ }
+ loop_idx += mpoly->totloop;
+ }
+ /* Loose edges */
+ for (i = 0; i < ledge_len; ++i) {
+ int eidx = e_origindex[rdata->mapped.loose_edges[i]];
+ if (eidx != ORIGINDEX_NONE) {
+ if (ibo_verts) {
+ const MEdge *ed = &medge[rdata->mapped.loose_edges[i]];
+ if (v_origindex[ed->v1] != ORIGINDEX_NONE) {
+ GPU_indexbuf_add_generic_vert(&elb_vert, loop_idx + 0);
+ }
+ if (v_origindex[ed->v2] != ORIGINDEX_NONE) {
+ GPU_indexbuf_add_generic_vert(&elb_vert, loop_idx + 1);
+ }
+ }
+ if (ibo_edges) {
+ GPU_indexbuf_add_line_verts(&elb_edge, loop_idx + 0, loop_idx + 1);
+ }
+ }
+ loop_idx += 2;
+ }
+ /* Loose verts */
+ if (ibo_verts) {
+ for (i = 0; i < lvert_len; ++i) {
+ int vidx = v_origindex[rdata->mapped.loose_verts[i]];
+ if (vidx != ORIGINDEX_NONE) {
+ GPU_indexbuf_add_generic_vert(&elb_vert, loop_idx);
+ }
+ loop_idx += 1;
+ }
+ }
+ }
+ else {
+ const MPoly *mpoly = rdata->mpoly;
+
+ /* Face Loops */
+ for (int poly = 0; poly < poly_len; poly++, mpoly++) {
+ if ((mpoly->flag & ME_HIDE) == 0) {
+ for (i = 0; i < mpoly->totloop; ++i) {
+ if (ibo_verts) {
+ GPU_indexbuf_add_generic_vert(&elb_vert, loop_idx + i);
+ }
+ if (ibo_edges) {
+ int v1 = loop_idx + i;
+ int v2 = loop_idx + ((i + 1) % mpoly->totloop);
+ GPU_indexbuf_add_line_verts(&elb_edge, v1, v2);
+ }
+ }
+ }
+ loop_idx += mpoly->totloop;
+ }
+ /* TODO(fclem): Until we find a way to detect
+ * loose verts easily outside of edit mode, this
+ * will remain disabled. */
+#if 0
+ /* Loose edges */
+ for (int e = 0; e < edge_len; e++, medge++) {
+ if (medge->flag & ME_LOOSEEDGE) {
+ int eidx = e_origindex[e];
+ if (eidx != ORIGINDEX_NONE) {
+ if ((medge->flag & ME_HIDE) == 0) {
+ for (int j = 0; j < 2; ++j) {
+ if (ibo_verts) {
+ GPU_indexbuf_add_generic_vert(&elb_vert, loop_idx + j);
+ }
+ if (ibo_edges) {
+ GPU_indexbuf_add_generic_vert(&elb_edge, loop_idx + j);
+ }
+ }
+ }
+ }
+ loop_idx += 2;
+ }
+ }
+ /* Loose verts */
+ for (int v = 0; v < vert_len; v++, mvert++) {
+ int vidx = v_origindex[v];
+ if (vidx != ORIGINDEX_NONE) {
+ if ((mvert->flag & ME_HIDE) == 0) {
+ if (ibo_verts) {
+ GPU_indexbuf_add_generic_vert(&elb_vert, loop_idx);
+ }
+ if (ibo_edges) {
+ GPU_indexbuf_add_generic_vert(&elb_edge, loop_idx);
+ }
+ }
+ loop_idx += 1;
+ }
+ }
+#endif
+ }
+
+ if (ibo_verts) {
+ GPU_indexbuf_build_in_place(&elb_vert, ibo_verts);
+ }
+ if (ibo_edges) {
+ GPU_indexbuf_build_in_place(&elb_edge, ibo_edges);
+ }
+}
+
+static void mesh_create_edit_loops_tris(MeshRenderData *rdata, GPUIndexBuf *ibo)
+{
+ const int loop_len = mesh_render_data_loops_len_get_maybe_mapped(rdata);
+ const int tri_len = mesh_render_data_looptri_len_get_maybe_mapped(rdata);
+
+ GPUIndexBufBuilder elb;
+ /* TODO alloc minmum necessary. */
+ GPU_indexbuf_init(&elb, GPU_PRIM_TRIS, tri_len, loop_len * 3);
+
+ if (rdata->edit_bmesh && (rdata->mapped.use == false)) {
+ for (int i = 0; i < tri_len; i++) {
+ const BMLoop **bm_looptri = (const BMLoop **)rdata->edit_bmesh->looptris[i];
+ const BMFace *bm_face = bm_looptri[0]->f;
+ /* use_hide always for edit-mode */
+ if (BM_elem_flag_test(bm_face, BM_ELEM_HIDDEN)) {
+ continue;
+ }
+ GPU_indexbuf_add_tri_verts(&elb, BM_elem_index_get(bm_looptri[0]),
+ BM_elem_index_get(bm_looptri[1]),
+ BM_elem_index_get(bm_looptri[2]));
+ }
+ }
+ else if (rdata->mapped.use == true) {
+ BMesh *bm = rdata->edit_bmesh->bm;
+ Mesh *me_cage = rdata->mapped.me_cage;
+
+ const MLoopTri *mlooptri = BKE_mesh_runtime_looptri_ensure(me_cage);
+ for (int i = 0; i < tri_len; i++) {
+ const MLoopTri *mlt = &mlooptri[i];
+ const int p_orig = rdata->mapped.p_origindex[mlt->poly];
+ if (p_orig != ORIGINDEX_NONE) {
+ /* Assume 'use_hide' */
+ BMFace *efa = BM_face_at_index(bm, p_orig);
+ if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+ GPU_indexbuf_add_tri_verts(&elb, mlt->tri[0], mlt->tri[1], mlt->tri[2]);
+ }
+ }
+ }
+ }
+ else {
+ const MLoopTri *mlt = rdata->mlooptri;
+ for (int i = 0; i < tri_len; i++, mlt++) {
+ const MPoly *mpoly = &rdata->mpoly[mlt->poly];
+ /* Assume 'use_hide' */
+ if ((mpoly->flag & ME_HIDE) == 0) {
+ GPU_indexbuf_add_tri_verts(&elb, mlt->tri[0], mlt->tri[1], mlt->tri[2]);
+ }
+ }
+ }
+
+ GPU_indexbuf_build_in_place(&elb, ibo);
+}
+
/** \} */
/* ---------------------------------------------------------------------- */
-
/** \name Public API
* \{ */
@@ -4507,55 +3990,7 @@ GPUBatch *DRW_mesh_batch_cache_get_edge_detection(Mesh *me, bool *r_is_manifold)
GPUBatch *DRW_mesh_batch_cache_get_wireframes_face(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
- return DRW_batch_request(&cache->batch.wire_triangles);
-}
-
-GPUBatch *DRW_mesh_batch_cache_get_edit_triangles(Mesh *me)
-{
- MeshBatchCache *cache = mesh_batch_cache_get(me);
- return DRW_batch_request(&cache->batch.edit_triangles);
-}
-
-GPUBatch *DRW_mesh_batch_cache_get_edit_vertices(Mesh *me)
-{
- MeshBatchCache *cache = mesh_batch_cache_get(me);
- return DRW_batch_request(&cache->batch.edit_vertices);
-}
-
-GPUBatch *DRW_mesh_batch_cache_get_edit_loose_edges(Mesh *me)
-{
- MeshBatchCache *cache = mesh_batch_cache_get(me);
- return DRW_batch_request(&cache->batch.edit_loose_edges);
-}
-
-GPUBatch *DRW_mesh_batch_cache_get_edit_loose_verts(Mesh *me)
-{
- MeshBatchCache *cache = mesh_batch_cache_get(me);
- return DRW_batch_request(&cache->batch.edit_loose_verts);
-}
-
-GPUBatch *DRW_mesh_batch_cache_get_edit_triangles_nor(Mesh *me)
-{
- MeshBatchCache *cache = mesh_batch_cache_get(me);
- return DRW_batch_request(&cache->batch.edit_triangles_nor);
-}
-
-GPUBatch *DRW_mesh_batch_cache_get_edit_triangles_lnor(Mesh *me)
-{
- MeshBatchCache *cache = mesh_batch_cache_get(me);
- return DRW_batch_request(&cache->batch.edit_triangles_lnor);
-}
-
-GPUBatch *DRW_mesh_batch_cache_get_edit_loose_edges_nor(Mesh *me)
-{
- MeshBatchCache *cache = mesh_batch_cache_get(me);
- return DRW_batch_request(&cache->batch.edit_loose_edges_nor);
-}
-
-GPUBatch *DRW_mesh_batch_cache_get_edit_facedots(Mesh *me)
-{
- MeshBatchCache *cache = mesh_batch_cache_get(me);
- return DRW_batch_request(&cache->batch.edit_facedots);
+ return DRW_batch_request(&cache->batch.wire_edges);
}
GPUBatch **DRW_mesh_batch_cache_get_surface_shaded(
@@ -4620,206 +4055,116 @@ GPUBatch *DRW_mesh_batch_cache_get_surface_vertpaint(Mesh *me)
/** \} */
/* ---------------------------------------------------------------------- */
-
-/** \name Edit Mode selection API
+/** \name Edit Mode API
* \{ */
-GPUBatch *DRW_mesh_batch_cache_get_triangles_with_select_id(Mesh *me, bool use_hide, uint select_id_offset)
+GPUBatch *DRW_mesh_batch_cache_get_edit_triangles(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
-
- if (cache->triangles_with_select_id_offset != select_id_offset) {
- cache->triangles_with_select_id_offset = select_id_offset;
- GPU_BATCH_DISCARD_SAFE(cache->triangles_with_select_id);
- }
-
- if (cache->triangles_with_select_id == NULL) {
- const int datatype =
- MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY;
- MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- if (rdata->mapped.supported) {
- rdata->mapped.use = true;
- }
-
- cache->triangles_with_select_id = GPU_batch_create_ex(
- GPU_PRIM_TRIS, mesh_create_tri_select_id(rdata, use_hide, select_id_offset), NULL, GPU_BATCH_OWNS_VBO);
-
- GPUVertBuf *vbo_tris = mesh_batch_cache_get_tri_pos_and_normals_edit(rdata, cache, use_hide);
- GPU_batch_vertbuf_add(cache->triangles_with_select_id, vbo_tris);
-
- mesh_render_data_free(rdata);
- }
-
- return cache->triangles_with_select_id;
+ return DRW_batch_request(&cache->batch.edit_triangles);
}
-/**
- * Same as #DRW_mesh_batch_cache_get_triangles_with_select_id
- * without the ID's, use to mask out geometry, eg - dont select face-dots behind other faces.
- */
-GPUBatch *DRW_mesh_batch_cache_get_triangles_with_select_mask(Mesh *me, bool use_hide)
+GPUBatch *DRW_mesh_batch_cache_get_edit_edges(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
- if (cache->triangles_with_select_mask == NULL) {
- const int datatype =
- MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY;
- MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- if (rdata->mapped.supported) {
- rdata->mapped.use = true;
- }
-
- GPUVertBuf *vbo_tris = mesh_batch_cache_get_tri_pos_and_normals_edit(rdata, cache, use_hide);
-
- cache->triangles_with_select_mask = GPU_batch_create(
- GPU_PRIM_TRIS, vbo_tris, NULL);
-
- mesh_render_data_free(rdata);
- }
-
- return cache->triangles_with_select_mask;
+ return DRW_batch_request(&cache->batch.edit_edges);
}
-
-GPUBatch *DRW_mesh_batch_cache_get_facedots_with_select_id(Mesh *me, uint select_id_offset)
+GPUBatch *DRW_mesh_batch_cache_get_edit_vertices(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
-
- if (cache->facedot_with_select_id_offset != select_id_offset) {
- cache->facedot_with_select_id_offset = select_id_offset;
- GPU_BATCH_DISCARD_SAFE(cache->edges_with_select_id);
- }
-
- if (cache->facedot_with_select_id == NULL) {
- MeshRenderData *rdata = mesh_render_data_create(me, MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY);
-
- /* We only want the 'pos', not the normals or flag.
- * Use since this is almost certainly already created. */
- cache->facedot_with_select_id = GPU_batch_create(
- GPU_PRIM_POINTS, mesh_batch_cache_get_facedot_pos_with_normals_and_flag(rdata, cache), NULL);
-
- GPU_batch_vertbuf_add_ex(
- cache->facedot_with_select_id,
- mesh_create_facedot_select_id(rdata, select_id_offset), true);
-
- mesh_render_data_free(rdata);
- }
-
- return cache->facedot_with_select_id;
+ return DRW_batch_request(&cache->batch.edit_vertices);
}
-GPUBatch *DRW_mesh_batch_cache_get_edges_with_select_id(Mesh *me, uint select_id_offset)
+GPUBatch *DRW_mesh_batch_cache_get_edit_lnors(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
-
- if (cache->edges_with_select_id_offset != select_id_offset) {
- cache->edges_with_select_id_offset = select_id_offset;
- GPU_BATCH_DISCARD_SAFE(cache->edges_with_select_id);
- }
-
- if (cache->edges_with_select_id == NULL) {
- MeshRenderData *rdata = mesh_render_data_create(me, MR_DATATYPE_VERT | MR_DATATYPE_EDGE);
- if (rdata->mapped.supported) {
- rdata->mapped.use = true;
- }
-
- cache->edges_with_select_id = GPU_batch_create(
- GPU_PRIM_LINES, mesh_batch_cache_get_edges_visible(rdata, cache), NULL);
-
- GPU_batch_vertbuf_add_ex(
- cache->edges_with_select_id,
- mesh_create_edges_select_id(rdata, select_id_offset), true);
-
- mesh_render_data_free(rdata);
- }
-
- return cache->edges_with_select_id;
+ return DRW_batch_request(&cache->batch.edit_lnor);
}
-GPUBatch *DRW_mesh_batch_cache_get_verts_with_select_id(Mesh *me, uint select_id_offset)
+GPUBatch *DRW_mesh_batch_cache_get_edit_facedots(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edit_facedots);
+}
- if (cache->verts_with_select_id_offset != select_id_offset) {
- cache->verts_with_select_id_offset = select_id_offset;
- GPU_BATCH_DISCARD_SAFE(cache->verts_with_select_id);
- }
+/** \} */
- if (cache->verts_with_select_id == NULL) {
- MeshRenderData *rdata = mesh_render_data_create(me, MR_DATATYPE_VERT);
- if (rdata->mapped.supported) {
- rdata->mapped.use = true;
- }
+/* ---------------------------------------------------------------------- */
+/** \name Edit Mode selection API
+ * \{ */
- cache->verts_with_select_id = GPU_batch_create(
- GPU_PRIM_POINTS, mesh_batch_cache_get_verts_visible(rdata, cache), NULL);
+GPUBatch *DRW_mesh_batch_cache_get_triangles_with_select_id(Mesh *me)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edit_selection_faces);
+}
- GPU_batch_vertbuf_add_ex(
- cache->verts_with_select_id,
- mesh_create_verts_select_id(rdata, select_id_offset), true);
+GPUBatch *DRW_mesh_batch_cache_get_facedots_with_select_id(Mesh *me)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edit_selection_facedots);
+}
- mesh_render_data_free(rdata);
- }
+GPUBatch *DRW_mesh_batch_cache_get_edges_with_select_id(Mesh *me)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edit_selection_edges);
+}
- return cache->verts_with_select_id;
+GPUBatch *DRW_mesh_batch_cache_get_verts_with_select_id(Mesh *me)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edit_selection_verts);
}
/** \} */
/* ---------------------------------------------------------------------- */
-
/** \name UV Image editor API
* \{ */
-/* TODO port to batch request. Is basically batch.wire_loops. */
-GPUBatch *DRW_mesh_batch_cache_get_texpaint_loop_wire(Mesh *me)
+GPUBatch *DRW_mesh_batch_cache_get_edituv_faces_strech_area(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edituv_faces_strech_area);
+}
- if (cache->texpaint_uv_loops == NULL) {
- /* create batch from DM */
- const int datatype = MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_LOOPUV;
- MeshRenderData *rdata = mesh_render_data_create(me, datatype);
-
- const MLoopUV *mloopuv_base = rdata->mloopuv;
- if (mloopuv_base == NULL) {
- return NULL;
- }
-
- uint vidx = 0;
-
- static GPUVertFormat format = { 0 };
- static struct { uint uv; } attr_id;
- if (format.attr_len == 0) {
- attr_id.uv = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
- }
+GPUBatch *DRW_mesh_batch_cache_get_edituv_faces_strech_angle(Mesh *me)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edituv_faces_strech_angle);
+}
- const uint vert_len = mesh_render_data_loops_len_get(rdata);
- const uint poly_len = mesh_render_data_polys_len_get(rdata);
- const uint idx_len = vert_len + poly_len;
+GPUBatch *DRW_mesh_batch_cache_get_edituv_faces(Mesh *me)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edituv_faces);
+}
- GPUIndexBufBuilder elb;
- GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_LOOP, idx_len, vert_len, true);
+GPUBatch *DRW_mesh_batch_cache_get_edituv_edges(Mesh *me)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edituv_edges);
+}
- GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
- GPU_vertbuf_data_alloc(vbo, vert_len);
+GPUBatch *DRW_mesh_batch_cache_get_edituv_verts(Mesh *me)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edituv_verts);
+}
- const MPoly *mpoly = rdata->mpoly;
- for (int a = 0; a < poly_len; a++, mpoly++) {
- const MLoopUV *mloopuv = mloopuv_base + mpoly->loopstart;
- for (int b = 0; b < mpoly->totloop; b++, mloopuv++) {
- GPU_vertbuf_attr_set(vbo, attr_id.uv, vidx, mloopuv->uv);
- GPU_indexbuf_add_generic_vert(&elb, vidx++);
- }
- GPU_indexbuf_add_primitive_restart(&elb);
- }
+GPUBatch *DRW_mesh_batch_cache_get_edituv_facedots(Mesh *me)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ return DRW_batch_request(&cache->batch.edituv_facedots);
+}
- cache->texpaint_uv_loops = GPU_batch_create_ex(GPU_PRIM_LINE_LOOP,
- vbo, GPU_indexbuf_build(&elb),
- GPU_BATCH_OWNS_VBO | GPU_BATCH_OWNS_INDEX);
- gpu_batch_presets_register(cache->texpaint_uv_loops);
- mesh_render_data_free(rdata);
- }
- return cache->texpaint_uv_loops;
+GPUBatch *DRW_mesh_batch_cache_get_uv_edges(Mesh *me)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ texpaint_request_active_uv(cache, me);
+ return DRW_batch_request(&cache->batch.wire_loops_uvs);
}
GPUBatch *DRW_mesh_batch_cache_get_surface_edges(Mesh *me)
@@ -4831,8 +4176,9 @@ GPUBatch *DRW_mesh_batch_cache_get_surface_edges(Mesh *me)
/**
* Needed for when we draw with shaded data.
*/
-void DRW_mesh_cache_sculpt_coords_ensure(Mesh *me)
+void DRW_mesh_cache_sculpt_coords_ensure(Mesh *UNUSED(me))
{
+#if 0 /* Unused for now */
if (me->runtime.batch_cache) {
MeshBatchCache *cache = mesh_batch_cache_get(me);
if (cache && cache->pos_with_normals && cache->is_sculpt_points_tag) {
@@ -4843,33 +4189,16 @@ void DRW_mesh_cache_sculpt_coords_ensure(Mesh *me)
}
cache->is_sculpt_points_tag = false;
}
-}
-
-static uchar mesh_batch_cache_validate_edituvs(MeshBatchCache *cache, uchar state)
-{
- if ((cache->edituv_state & UVEDIT_SYNC_SEL) != (state & UVEDIT_SYNC_SEL)) {
- mesh_batch_cache_discard_uvedit(cache);
- return state;
- }
- else {
- return ((cache->edituv_state & state) ^ state);
- }
+#endif
}
/* Compute 3D & 2D areas and their sum. */
BLI_INLINE void edit_uv_preprocess_stretch_area(
- float (*tf_uv)[2], BMFace *efa, const float asp[2], const int cd_loop_uv_offset, uint fidx,
+ BMFace *efa, const int cd_loop_uv_offset, uint fidx,
float *totarea, float *totuvarea, float (*faces_areas)[2])
{
- BMLoop *l;
- BMIter liter;
- int i;
- BM_ITER_ELEM_INDEX(l, &liter, efa, BM_LOOPS_OF_FACE, i) {
- MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- mul_v2_v2v2(tf_uv[i], luv->uv, asp);
- }
faces_areas[fidx][0] = BM_face_calc_area(efa);
- faces_areas[fidx][1] = area_poly_v2(tf_uv, efa->len);
+ faces_areas[fidx][1] = BM_face_calc_area_uv(efa, cd_loop_uv_offset);
*totarea += faces_areas[fidx][0];
*totuvarea += faces_areas[fidx][1];
@@ -4890,7 +4219,7 @@ BLI_INLINE float edit_uv_get_stretch_area(float area, float uvarea)
/* Compute face's normalized contour vectors. */
BLI_INLINE void edit_uv_preprocess_stretch_angle(
- float (*auv)[2], float (*av)[3], const int cd_loop_uv_offset, BMFace *efa, float asp[2])
+ float (*auv)[2], float (*av)[3], const int cd_loop_uv_offset, BMFace *efa)
{
BMLoop *l;
BMIter liter;
@@ -4900,7 +4229,6 @@ BLI_INLINE void edit_uv_preprocess_stretch_angle(
MLoopUV *luv_prev = BM_ELEM_CD_GET_VOID_P(l->prev, cd_loop_uv_offset);
sub_v2_v2v2(auv[i], luv_prev->uv, luv->uv);
- mul_v2_v2(auv[i], asp);
normalize_v2(auv[i]);
sub_v3_v3v3(av[i], l->prev->v->co, l->v->co);
@@ -4908,6 +4236,7 @@ BLI_INLINE void edit_uv_preprocess_stretch_angle(
}
}
+#if 0 /* here for reference, this is done in shader now. */
BLI_INLINE float edit_uv_get_loop_stretch_angle(
const float auv0[2], const float auv1[2], const float av0[3], const float av1[3])
{
@@ -4916,62 +4245,33 @@ BLI_INLINE float edit_uv_get_loop_stretch_angle(
float stretch = fabsf(uvang - ang) / (float)M_PI;
return 1.0f - pow2f(1.0f - stretch);
}
-
-#define VERTEX_SELECT (1 << 0)
-#define VERTEX_PINNED (1 << 1)
-#define FACE_SELECT (1 << 2)
-#define FACE_ACTIVE (1 << 3)
-#define EDGE_SELECT (1 << 4)
-
-BLI_INLINE uchar edit_uv_get_face_flag(BMFace *efa, BMFace *efa_act, const int cd_loop_uv_offset, Scene *scene)
-{
- uchar flag = 0;
- flag |= uvedit_face_select_test(scene, efa, cd_loop_uv_offset) ? FACE_SELECT : 0;
- flag |= (efa == efa_act) ? FACE_ACTIVE : 0;
- return flag;
-}
-
-BLI_INLINE uchar edit_uv_get_loop_flag(BMLoop *l, const int cd_loop_uv_offset, Scene *scene)
-{
- MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- uchar flag = 0;
- flag |= uvedit_uv_select_test(scene, l, cd_loop_uv_offset) ? VERTEX_SELECT : 0;
- flag |= uvedit_edge_select_test(scene, l, cd_loop_uv_offset) ? EDGE_SELECT : 0;
- flag |= (luv->flag & MLOOPUV_PINNED) ? VERTEX_PINNED : 0;
- return flag;
-}
+#endif
static struct EditUVFormatIndex {
- uint uvs, area, angle, flag, fdots_uvs, fdots_flag;
+ uint area, angle, uv_adj, flag, fdots_uvs, fdots_flag;
} uv_attr_id = {0};
static void uvedit_fill_buffer_data(
- Object *ob, struct SpaceImage *sima, Scene *scene, uchar state, MeshBatchCache *cache,
- GPUIndexBufBuilder *elb_faces, GPUIndexBufBuilder *elb_edges, GPUVertBuf **facedots_vbo)
+ MeshRenderData *rdata,
+ GPUVertBuf *vbo_area, GPUVertBuf *vbo_angle,
+ GPUVertBuf *vbo_fdots_pos, GPUVertBuf *vbo_fdots_data,
+ GPUIndexBufBuilder *elb_vert,
+ GPUIndexBufBuilder *elb_edge,
+ GPUIndexBufBuilder *elb_face)
{
- Mesh *me = ob->data;
- BMEditMesh *embm = me->edit_btmesh;
- BMesh *bm = embm->bm;
+ BMesh *bm = rdata->edit_bmesh->bm;
BMIter iter, liter;
BMFace *efa;
- BMLoop *l;
- MLoopUV *luv;
- uint vidx, fidx, i;
+ uint vidx, fidx, fdot_idx, i;
+ const int poly_len = mesh_render_data_polys_len_get_maybe_mapped(rdata);
float (*faces_areas)[2] = NULL;
- float asp[2];
float totarea = 0.0f, totuvarea = 0.0f;
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
- Image *ima = sima->image;
- BMFace *efa_act = EDBM_uv_active_face_get(embm, false, false); /* will be set to NULL if hidden */
-
- if (state & (UVEDIT_STRETCH_AREA | UVEDIT_STRETCH_ANGLE)) {
- ED_space_image_get_uv_aspect(sima, &asp[0], &asp[1]);
- }
BLI_buffer_declare_static(vec3f, vec3_buf, BLI_BUFFER_NOP, BM_DEFAULT_NGON_STACK_SIZE);
BLI_buffer_declare_static(vec2f, vec2_buf, BLI_BUFFER_NOP, BM_DEFAULT_NGON_STACK_SIZE);
- if (state & UVEDIT_STRETCH_AREA) {
+ if (vbo_area) {
faces_areas = MEM_mallocN(sizeof(float) * 2 * bm->totface, "EDITUV faces areas");
}
@@ -4979,85 +4279,134 @@ static void uvedit_fill_buffer_data(
fidx = 0;
BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) {
/* Tag hidden faces */
- BM_elem_flag_set(efa, BM_ELEM_TAG, uvedit_face_visible_test(scene, ob, ima, efa));
+ BM_elem_flag_set(efa, BM_ELEM_TAG, uvedit_face_visible_nolocal_ex(rdata->toolsettings, efa));
- if ((state & UVEDIT_STRETCH_AREA) &&
- BM_elem_flag_test(efa, BM_ELEM_TAG))
- {
- const int efa_len = efa->len;
- float (*tf_uv)[2] = (float (*)[2])BLI_buffer_reinit_data(&vec2_buf, vec2f, efa_len);
- edit_uv_preprocess_stretch_area(tf_uv, efa, asp, cd_loop_uv_offset, fidx++,
+ if (vbo_area && BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+ edit_uv_preprocess_stretch_area(efa, cd_loop_uv_offset, fidx++,
&totarea, &totuvarea, faces_areas);
}
}
vidx = 0;
fidx = 0;
- BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) {
- const int efa_len = efa->len;
- float fdot[2] = {0.0f, 0.0f};
- float (*av)[3], (*auv)[2];
- ushort area_stretch;
- /* Skip hidden faces. */
- if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
- continue;
-
- uchar face_flag = edit_uv_get_face_flag(efa, efa_act, cd_loop_uv_offset, scene);
- /* Face preprocess */
- if (state & UVEDIT_STRETCH_AREA) {
- area_stretch = edit_uv_get_stretch_area(faces_areas[fidx][0] / totarea,
- faces_areas[fidx][1] / totuvarea) * 65534.0f;
- }
- if (state & UVEDIT_STRETCH_ANGLE) {
- av = (float (*)[3])BLI_buffer_reinit_data(&vec3_buf, vec3f, efa_len);
- auv = (float (*)[2])BLI_buffer_reinit_data(&vec2_buf, vec2f, efa_len);
- edit_uv_preprocess_stretch_angle(auv, av, cd_loop_uv_offset, efa, asp);
- }
-
- BM_ITER_ELEM_INDEX(l, &liter, efa, BM_LOOPS_OF_FACE, i) {
- luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- uchar flag = face_flag | edit_uv_get_loop_flag(l, cd_loop_uv_offset, scene);
-
- if (state & UVEDIT_STRETCH_AREA) {
- GPU_vertbuf_attr_set(cache->edituv_area, uv_attr_id.area, vidx, &area_stretch);
+ fdot_idx = 0;
+ if (rdata->mapped.use == false && rdata->edit_bmesh) {
+ BMLoop *l;
+ BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) {
+ const bool face_visible = BM_elem_flag_test(efa, BM_ELEM_TAG);
+ const int efa_len = efa->len;
+ float fdot[2] = {0.0f, 0.0f};
+ float (*av)[3], (*auv)[2];
+ ushort area_stretch;
+
+ /* Face preprocess */
+ if (vbo_area) {
+ area_stretch = edit_uv_get_stretch_area(faces_areas[fidx][0] / totarea,
+ faces_areas[fidx][1] / totuvarea) * 65534.0f;
}
- if (state & UVEDIT_STRETCH_ANGLE) {
- ushort angle = 65534.0f * edit_uv_get_loop_stretch_angle(auv[i], auv[(i + 1) % efa_len],
- av[i], av[(i + 1) % efa_len]);
- GPU_vertbuf_attr_set(cache->edituv_angle, uv_attr_id.angle, vidx, &angle);
+ if (vbo_angle) {
+ av = (float (*)[3])BLI_buffer_reinit_data(&vec3_buf, vec3f, efa_len);
+ auv = (float (*)[2])BLI_buffer_reinit_data(&vec2_buf, vec2f, efa_len);
+ edit_uv_preprocess_stretch_angle(auv, av, cd_loop_uv_offset, efa);
}
- if (state & UVEDIT_EDGES) {
- GPU_vertbuf_attr_set(cache->edituv_pos, uv_attr_id.uvs, vidx, luv->uv);
+
+ /* Skip hidden faces. */
+ if (elb_face && face_visible) {
+ for (i = 0; i < efa->len; ++i) {
+ GPU_indexbuf_add_generic_vert(elb_face, vidx + i);
+ GPU_indexbuf_add_generic_vert(elb_vert, vidx + i);
+ GPU_indexbuf_add_line_verts(elb_edge, vidx + i, vidx + (i + 1) % efa->len);
+ }
}
- if (state & UVEDIT_DATA) {
- GPU_vertbuf_attr_set(cache->edituv_data, uv_attr_id.flag, vidx, &flag);
+
+ BM_ITER_ELEM_INDEX(l, &liter, efa, BM_LOOPS_OF_FACE, i) {
+ MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
+ if (vbo_area) {
+ GPU_vertbuf_attr_set(vbo_area, uv_attr_id.area, vidx, &area_stretch);
+ }
+ if (vbo_angle) {
+ int i_next = (i + 1) % efa_len;
+ short suv[4];
+ /* Send uvs to the shader and let it compute the aspect corrected angle. */
+ normal_float_to_short_v2(&suv[0], auv[i]);
+ normal_float_to_short_v2(&suv[2], auv[i_next]);
+ GPU_vertbuf_attr_set(vbo_angle, uv_attr_id.uv_adj, vidx, suv);
+ /* Compute 3D angle here */
+ short angle = 32767.0f * angle_normalized_v3v3(av[i], av[i_next]) / (float)M_PI;
+ GPU_vertbuf_attr_set(vbo_angle, uv_attr_id.angle, vidx, &angle);
+ }
+ if (vbo_fdots_pos) {
+ add_v2_v2(fdot, luv->uv);
+ }
+ vidx++;
}
- if (state & UVEDIT_FACES) {
- GPU_indexbuf_add_generic_vert(elb_faces, vidx);
+
+ if (elb_face && face_visible) {
+ GPU_indexbuf_add_generic_vert(elb_face, vidx - efa->len);
+ GPU_indexbuf_add_primitive_restart(elb_face);
}
- if (state & UVEDIT_EDGES) {
- GPU_indexbuf_add_generic_vert(elb_edges, vidx);
+ if (vbo_fdots_pos && face_visible) {
+ mul_v2_fl(fdot, 1.0f / (float)efa->len);
+ GPU_vertbuf_attr_set(vbo_fdots_pos, uv_attr_id.fdots_uvs, fdot_idx, fdot);
}
-
- if (state & UVEDIT_FACEDOTS) {
- add_v2_v2(fdot, luv->uv);
+ if (vbo_fdots_data && face_visible) {
+ uchar face_flag = mesh_render_data_face_flag(rdata, efa, cd_loop_uv_offset);
+ GPU_vertbuf_attr_set(vbo_fdots_data, uv_attr_id.fdots_flag, fdot_idx, &face_flag);
}
- vidx++;
+ fdot_idx += face_visible ? 1 : 0;
+ fidx++;
}
+ }
+ else {
+ const MPoly *mpoly = rdata->mapped.me_cage->mpoly;
+ // const MEdge *medge = rdata->mapped.me_cage->medge;
+ // const MVert *mvert = rdata->mapped.me_cage->mvert;
+ const MLoop *mloop = rdata->mapped.me_cage->mloop;
- if (state & UVEDIT_FACES) {
- GPU_indexbuf_add_primitive_restart(elb_faces);
- }
- if (state & UVEDIT_EDGES) {
- GPU_indexbuf_add_primitive_restart(elb_edges);
- }
+ const int *v_origindex = rdata->mapped.v_origindex;
+ const int *e_origindex = rdata->mapped.e_origindex;
+ const int *p_origindex = rdata->mapped.p_origindex;
- if (state & UVEDIT_FACEDOTS) {
- mul_v2_fl(fdot, 1.0f / (float)efa->len);
- GPU_vertbuf_attr_set(*facedots_vbo, uv_attr_id.fdots_uvs, fidx, fdot);
- GPU_vertbuf_attr_set(*facedots_vbo, uv_attr_id.fdots_flag, fidx, &face_flag);
+ /* Face Loops */
+ for (int poly = 0; poly < poly_len; poly++, mpoly++) {
+ float fdot[2] = {0.0f, 0.0f};
+ const MLoop *l = &mloop[mpoly->loopstart];
+ int fidx_ori = p_origindex[poly];
+ efa = (fidx_ori != ORIGINDEX_NONE) ? BM_face_at_index(bm, fidx_ori) : NULL;
+ const bool face_visible = efa != NULL && BM_elem_flag_test(efa, BM_ELEM_TAG);
+ if (efa && vbo_fdots_data) {
+ uchar face_flag = mesh_render_data_face_flag(rdata, efa, cd_loop_uv_offset);
+ GPU_vertbuf_attr_set(vbo_fdots_data, uv_attr_id.fdots_flag, fdot_idx, &face_flag);
+ }
+ /* Skip hidden faces. */
+ if (elb_face && face_visible) {
+ for (i = 0; i < mpoly->totloop; ++i) {
+ GPU_indexbuf_add_generic_vert(elb_face, vidx + i);
+ if (e_origindex[l[i].e] != ORIGINDEX_NONE) {
+ GPU_indexbuf_add_line_verts(elb_edge, vidx + i, vidx + (i + 1) % mpoly->totloop);
+ }
+ if (v_origindex[l[i].v] != ORIGINDEX_NONE) {
+ GPU_indexbuf_add_generic_vert(elb_vert, vidx + i);
+ }
+ }
+ GPU_indexbuf_add_generic_vert(elb_face, vidx);
+ GPU_indexbuf_add_primitive_restart(elb_face);
+ }
+ for (i = 0; i < mpoly->totloop; i++, l++) {
+ /* TODO support stretch. */
+ if (vbo_fdots_pos) {
+ MLoopUV *luv = &rdata->mloopuv[mpoly->loopstart + i];
+ add_v2_v2(fdot, luv->uv);
+ }
+ vidx++;
+ }
+ if (vbo_fdots_pos && face_visible) {
+ mul_v2_fl(fdot, 1.0f / mpoly->totloop);
+ GPU_vertbuf_attr_set(vbo_fdots_pos, uv_attr_id.fdots_uvs, fdot_idx, fdot);
+ }
+ fidx++;
+ fdot_idx += face_visible ? 1 : 0;
}
- fidx++;
}
if (faces_areas) {
@@ -5067,199 +4416,85 @@ static void uvedit_fill_buffer_data(
BLI_buffer_free(&vec3_buf);
BLI_buffer_free(&vec2_buf);
- if (vidx == 0) {
- GPU_VERTBUF_DISCARD_SAFE(cache->edituv_area);
- GPU_VERTBUF_DISCARD_SAFE(cache->edituv_angle);
- GPU_VERTBUF_DISCARD_SAFE(cache->edituv_pos);
- GPU_VERTBUF_DISCARD_SAFE(cache->edituv_data);
- GPU_VERTBUF_DISCARD_SAFE(*facedots_vbo);
- }
-
- if (vidx < bm->totloop) {
- if (cache->edituv_area && (state & UVEDIT_STRETCH_AREA)) {
- GPU_vertbuf_data_resize(cache->edituv_area, vidx);
+ if (fdot_idx < poly_len) {
+ if (vbo_fdots_pos) {
+ GPU_vertbuf_data_resize(vbo_fdots_pos, fdot_idx);
}
- if (cache->edituv_angle && (state & UVEDIT_STRETCH_ANGLE)) {
- GPU_vertbuf_data_resize(cache->edituv_angle, vidx);
- }
- if (cache->edituv_pos && (state & UVEDIT_EDGES)) {
- GPU_vertbuf_data_resize(cache->edituv_pos, vidx);
- }
- if (cache->edituv_data && (state & UVEDIT_DATA)) {
- GPU_vertbuf_data_resize(cache->edituv_data, vidx);
- }
- }
- if (fidx < bm->totface) {
- if (*facedots_vbo) {
- GPU_vertbuf_data_resize(*facedots_vbo, fidx);
+ if (vbo_fdots_data) {
+ GPU_vertbuf_data_resize(vbo_fdots_data, fdot_idx);
}
}
}
-static void mesh_batch_cache_create_uvedit_buffers(
- Object *ob, struct SpaceImage *sima, Scene *scene, MeshBatchCache *cache, uchar state)
+static void mesh_create_uvedit_buffers(
+ MeshRenderData *rdata,
+ GPUVertBuf *vbo_area, GPUVertBuf *vbo_angle,
+ GPUVertBuf *vbo_fdots_pos, GPUVertBuf *vbo_fdots_data,
+ GPUIndexBuf *ibo_vert, GPUIndexBuf *ibo_edge, GPUIndexBuf *ibo_face)
{
- GPUVertBuf *facedots_vbo = NULL;
-
- if (state == 0) {
- return;
- }
-
- Mesh *me = ob->data;
- BMEditMesh *embm = me->edit_btmesh;
- BMesh *bm = embm->bm;
-
- static GPUVertFormat format_pos = { 0 };
static GPUVertFormat format_area = { 0 };
static GPUVertFormat format_angle = { 0 };
- static GPUVertFormat format_flag = { 0 };
- static GPUVertFormat format_facedots = { 0 };
+ static GPUVertFormat format_fdots_pos = { 0 };
+ static GPUVertFormat format_fdots_flag = { 0 };
- if (format_pos.attr_len == 0) {
- uv_attr_id.uvs = GPU_vertformat_attr_add(&format_pos, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+ if (format_area.attr_len == 0) {
uv_attr_id.area = GPU_vertformat_attr_add(&format_area, "stretch", GPU_COMP_U16, 1, GPU_FETCH_INT_TO_FLOAT_UNIT);
- uv_attr_id.angle = GPU_vertformat_attr_add(&format_angle, "stretch", GPU_COMP_U16, 1, GPU_FETCH_INT_TO_FLOAT_UNIT);
- uv_attr_id.flag = GPU_vertformat_attr_add(&format_flag, "flag", GPU_COMP_U8, 1, GPU_FETCH_INT);
+ uv_attr_id.angle = GPU_vertformat_attr_add(&format_angle, "angle", GPU_COMP_I16, 1, GPU_FETCH_INT_TO_FLOAT_UNIT);
+ uv_attr_id.uv_adj = GPU_vertformat_attr_add(&format_angle, "uv_adj", GPU_COMP_I16, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
- uv_attr_id.fdots_uvs = GPU_vertformat_attr_add(&format_facedots, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
- uv_attr_id.fdots_flag = GPU_vertformat_attr_add(&format_facedots, "flag", GPU_COMP_U8, 1, GPU_FETCH_INT);
+ uv_attr_id.fdots_flag = GPU_vertformat_attr_add(&format_fdots_flag, "flag", GPU_COMP_U8, 1, GPU_FETCH_INT);
+ uv_attr_id.fdots_uvs = GPU_vertformat_attr_add(&format_fdots_pos, "u", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+ GPU_vertformat_alias_add(&format_fdots_pos, "pos");
}
- const uint vert_len = bm->totloop;
- const uint idx_len = bm->totloop + bm->totface;
- const uint face_len = bm->totface;
+ const int loop_len = mesh_render_data_loops_len_get_maybe_mapped(rdata);
+ const int face_len = mesh_render_data_polys_len_get_maybe_mapped(rdata);
+ const int idx_len = loop_len + face_len * 2;
- if (state & UVEDIT_EDGES) {
- cache->edituv_pos = GPU_vertbuf_create_with_format(&format_pos);
- GPU_vertbuf_data_alloc(cache->edituv_pos, vert_len);
+ if (DRW_TEST_ASSIGN_VBO(vbo_area)) {
+ GPU_vertbuf_init_with_format(vbo_area, &format_area);
+ GPU_vertbuf_data_alloc(vbo_area, loop_len);
}
- if (state & UVEDIT_DATA) {
- cache->edituv_data = GPU_vertbuf_create_with_format(&format_flag);
- GPU_vertbuf_data_alloc(cache->edituv_data, vert_len);
+ if (DRW_TEST_ASSIGN_VBO(vbo_angle)) {
+ GPU_vertbuf_init_with_format(vbo_angle, &format_angle);
+ GPU_vertbuf_data_alloc(vbo_angle, loop_len);
}
- if (state & UVEDIT_STRETCH_AREA) {
- cache->edituv_area = GPU_vertbuf_create_with_format(&format_area);
- GPU_vertbuf_data_alloc(cache->edituv_area, vert_len);
+ if (DRW_TEST_ASSIGN_VBO(vbo_fdots_pos)) {
+ GPU_vertbuf_init_with_format(vbo_fdots_pos, &format_fdots_pos);
+ GPU_vertbuf_data_alloc(vbo_fdots_pos, face_len);
}
- if (state & UVEDIT_STRETCH_ANGLE) {
- cache->edituv_angle = GPU_vertbuf_create_with_format(&format_angle);
- GPU_vertbuf_data_alloc(cache->edituv_angle, vert_len);
+ if (DRW_TEST_ASSIGN_VBO(vbo_fdots_data)) {
+ GPU_vertbuf_init_with_format(vbo_fdots_data, &format_fdots_flag);
+ GPU_vertbuf_data_alloc(vbo_fdots_data, face_len);
}
- if (state & UVEDIT_FACEDOTS) {
- facedots_vbo = GPU_vertbuf_create_with_format(&format_facedots);
- GPU_vertbuf_data_alloc(facedots_vbo, face_len);
- }
-
- /* NOTE: we could use the same index buffer for both primitive type (it's the same indices)
- * but since GPU_PRIM_LINE_LOOP does not exist in vulkan, make it future proof. */
- GPUIndexBufBuilder elb_faces, elb_edges;
- if (state & UVEDIT_EDGES) {
- GPU_indexbuf_init_ex(&elb_edges, GPU_PRIM_LINE_LOOP, idx_len, vert_len, true);
- }
- if (state & UVEDIT_FACES) {
- GPU_indexbuf_init_ex(&elb_faces, GPU_PRIM_TRI_FAN, idx_len, vert_len, true);
- }
-
- uvedit_fill_buffer_data(ob, sima, scene, state, cache, &elb_faces, &elb_edges, &facedots_vbo);
- if (state & UVEDIT_EDGES) {
- cache->edituv_visible_edges = GPU_indexbuf_build(&elb_edges);
+ GPUIndexBufBuilder elb_vert, elb_edge, elb_face;
+ if (DRW_TEST_ASSIGN_IBO(ibo_vert)) {
+ GPU_indexbuf_init_ex(&elb_vert, GPU_PRIM_POINTS, loop_len, loop_len, false);
}
- if (state & UVEDIT_FACES) {
- cache->edituv_visible_faces = GPU_indexbuf_build(&elb_faces);
+ if (DRW_TEST_ASSIGN_IBO(ibo_edge)) {
+ GPU_indexbuf_init_ex(&elb_edge, GPU_PRIM_LINES, loop_len * 2, loop_len, false);
}
- if ((state & UVEDIT_FACEDOTS) && facedots_vbo) {
- cache->edituv_facedots = GPU_batch_create_ex(GPU_PRIM_POINTS, facedots_vbo, NULL, GPU_BATCH_OWNS_VBO);
- gpu_batch_presets_register(cache->edituv_facedots);
+ if (DRW_TEST_ASSIGN_IBO(ibo_face)) {
+ GPU_indexbuf_init_ex(&elb_face, GPU_PRIM_TRI_FAN, idx_len, loop_len, true);
}
- cache->edituv_state |= state;
-}
-
-void DRW_mesh_cache_uvedit(
- Object *ob, struct SpaceImage *sima, Scene *scene, uchar state,
- GPUBatch **faces, GPUBatch **edges, GPUBatch **verts, GPUBatch **facedots)
-{
- Mesh *me = ob->data;
- MeshBatchCache *cache = mesh_batch_cache_get(me);
+ uvedit_fill_buffer_data(rdata,
+ vbo_area, vbo_angle, vbo_fdots_pos, vbo_fdots_data,
+ ibo_vert ? &elb_vert : NULL,
+ ibo_edge ? &elb_edge : NULL,
+ ibo_face ? &elb_face : NULL);
- uchar missing_state = mesh_batch_cache_validate_edituvs(cache, state);
-
- mesh_batch_cache_create_uvedit_buffers(ob, sima, scene, cache, missing_state);
-
- /* Bail out if there is nothing to draw. */
- if (cache->edituv_data == NULL) {
- *faces = *edges = *verts = *facedots = NULL;
- return;
- }
-
- /* Faces */
- if (state & UVEDIT_STRETCH_AREA) {
- if (cache->edituv_faces_strech_area == NULL) {
- cache->edituv_faces_strech_area = GPU_batch_create(GPU_PRIM_TRI_FAN,
- cache->edituv_pos,
- cache->edituv_visible_faces);
- GPU_batch_vertbuf_add_ex(cache->edituv_faces_strech_area,
- cache->edituv_area, false);
- gpu_batch_presets_register(cache->edituv_faces_strech_area);
- }
- *faces = cache->edituv_faces_strech_area;
- }
- else if (state & UVEDIT_STRETCH_ANGLE) {
- if (cache->edituv_faces_strech_angle == NULL) {
- cache->edituv_faces_strech_angle = GPU_batch_create(GPU_PRIM_TRI_FAN,
- cache->edituv_pos,
- cache->edituv_visible_faces);
- GPU_batch_vertbuf_add_ex(cache->edituv_faces_strech_angle,
- cache->edituv_angle, false);
- gpu_batch_presets_register(cache->edituv_faces_strech_angle);
- }
- *faces = cache->edituv_faces_strech_angle;
- }
- else if (state & UVEDIT_FACES) {
- if (cache->edituv_faces == NULL) {
- cache->edituv_faces = GPU_batch_create(GPU_PRIM_TRI_FAN,
- cache->edituv_pos,
- cache->edituv_visible_faces);
- GPU_batch_vertbuf_add_ex(cache->edituv_faces,
- cache->edituv_data, false);
- gpu_batch_presets_register(cache->edituv_faces);
- }
- *faces = cache->edituv_faces;
- }
- else {
- *faces = NULL;
- }
-
- {
- if (cache->edituv_edges == NULL) {
- cache->edituv_edges = GPU_batch_create(GPU_PRIM_LINE_LOOP,
- cache->edituv_pos,
- cache->edituv_visible_edges);
- GPU_batch_vertbuf_add_ex(cache->edituv_edges,
- cache->edituv_data, false);
- gpu_batch_presets_register(cache->edituv_edges);
- }
- *edges = cache->edituv_edges;
+ if (ibo_vert) {
+ GPU_indexbuf_build_in_place(&elb_vert, ibo_vert);
}
- {
- if (cache->edituv_verts == NULL) {
- cache->edituv_verts = GPU_batch_create(GPU_PRIM_POINTS,
- cache->edituv_pos,
- NULL);
- GPU_batch_vertbuf_add_ex(cache->edituv_verts,
- cache->edituv_data, false);
- gpu_batch_presets_register(cache->edituv_verts);
- }
- *verts = cache->edituv_verts;
+ if (ibo_edge) {
+ GPU_indexbuf_build_in_place(&elb_edge, ibo_edge);
}
- if (state & UVEDIT_FACEDOTS) {
- *facedots = cache->edituv_facedots;
- }
- else {
- *facedots = NULL;
+ if (ibo_face) {
+ GPU_indexbuf_build_in_place(&elb_face, ibo_face);
}
}
@@ -5267,41 +4502,27 @@ void DRW_mesh_cache_uvedit(
/* ---------------------------------------------------------------------- */
-
/** \name Grouped batch generation
* \{ */
/* Can be called for any surface type. Mesh *me is the final mesh. */
-void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
+void DRW_mesh_batch_cache_create_requested(
+ Object *ob, Mesh *me,
+ const ToolSettings *ts, const bool is_paint_mode, const bool use_hide)
{
- const DRWContextState *draw_ctx = DRW_context_state_get();
- const int mode = CTX_data_mode_enum_ex(draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode);
- const bool is_paint_mode = ELEM(mode, CTX_MODE_PAINT_TEXTURE, CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT);
- const bool use_hide = (
- (ob->type == OB_MESH) &&
- ((is_paint_mode && (ob == draw_ctx->obact)) ||
- ((mode == CTX_MODE_EDIT_MESH) && BKE_object_is_in_editmode(ob))));
- bool use_face_sel = false;
-
- /* Tex paint face select */
- if (is_paint_mode && (ob->type == OB_MESH) && (draw_ctx->obact == ob)) {
- const Mesh *me_orig = DEG_get_original_object(ob)->data;
- use_face_sel = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
- }
-
MeshBatchCache *cache = mesh_batch_cache_get(me);
/* Check vertex weights. */
- if (cache->batch.surface_weights != 0) {
+ if ((cache->batch.surface_weights != 0) && (ts != NULL)) {
struct DRW_MeshWeightState wstate;
BLI_assert(ob->type == OB_MESH);
- drw_mesh_weight_state_extract(ob, me, draw_ctx->scene->toolsettings, is_paint_mode, &wstate);
+ drw_mesh_weight_state_extract(ob, me, ts, is_paint_mode, &wstate);
mesh_batch_cache_check_vertex_group(cache, &wstate);
drw_mesh_weight_state_copy(&cache->weight_state, &wstate);
drw_mesh_weight_state_clear(&wstate);
}
- /* Verify that all surface batches have needed attrib layers. */
+ /* Verify that all surface batches have needed attribute layers. */
/* TODO(fclem): We could be a bit smarter here and only do it per material. */
bool cd_overlap = mesh_cd_layers_type_overlap(cache->cd_vused, cache->cd_lused,
cache->cd_vneeded, cache->cd_lneeded);
@@ -5338,6 +4559,29 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
memset(cache->cd_lneeded, 0, sizeof(cache->cd_lneeded));
memset(cache->cd_vneeded, 0, sizeof(cache->cd_vneeded));
+ /* Discard UV batches if sync_selection changes */
+ if (ts != NULL) {
+ const bool is_uvsyncsel = (ts->uv_flag & UV_SYNC_SELECTION);
+ if (cache->is_uvsyncsel != is_uvsyncsel) {
+ cache->is_uvsyncsel = is_uvsyncsel;
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.loop_uv_data);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.loop_stretch_angle);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.loop_stretch_area);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.loop_uv);
+ GPU_VERTBUF_DISCARD_SAFE(cache->edit.facedots_uv);
+ GPU_INDEXBUF_DISCARD_SAFE(cache->ibo.edituv_loops_tri_fans);
+ GPU_INDEXBUF_DISCARD_SAFE(cache->ibo.edituv_loops_line_strips);
+ GPU_INDEXBUF_DISCARD_SAFE(cache->ibo.edituv_loops_points);
+ /* We only clear the batches as they may already have been referenced. */
+ GPU_BATCH_CLEAR_SAFE(cache->batch.edituv_faces_strech_area);
+ GPU_BATCH_CLEAR_SAFE(cache->batch.edituv_faces_strech_angle);
+ GPU_BATCH_CLEAR_SAFE(cache->batch.edituv_faces);
+ GPU_BATCH_CLEAR_SAFE(cache->batch.edituv_edges);
+ GPU_BATCH_CLEAR_SAFE(cache->batch.edituv_verts);
+ GPU_BATCH_CLEAR_SAFE(cache->batch.edituv_facedots);
+ }
+ }
+
/* Init batches and request VBOs & IBOs */
if (DRW_batch_requested(cache->batch.surface, GPU_PRIM_TRIS)) {
DRW_ibo_request(cache->batch.surface, &cache->ibo.loops_tris);
@@ -5371,46 +4615,103 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
DRW_vbo_request(cache->batch.surface_weights, &cache->ordered.weights);
}
if (DRW_batch_requested(cache->batch.wire_loops, GPU_PRIM_LINE_STRIP)) {
- DRW_ibo_request(cache->batch.wire_loops, &cache->ibo.loops_lines);
+ DRW_ibo_request(cache->batch.wire_loops, &cache->ibo.loops_line_strips);
DRW_vbo_request(cache->batch.wire_loops, &cache->ordered.loop_pos_nor);
}
- if (DRW_batch_requested(cache->batch.wire_triangles, GPU_PRIM_TRIS)) {
- DRW_vbo_request(cache->batch.wire_triangles, &cache->tess.pos_nor);
- DRW_vbo_request(cache->batch.wire_triangles, &cache->tess.wireframe_data);
+ if (DRW_batch_requested(cache->batch.wire_edges, GPU_PRIM_LINES)) {
+ DRW_ibo_request(cache->batch.wire_edges, &cache->ibo.loops_lines);
+ DRW_vbo_request(cache->batch.wire_edges, &cache->ordered.loop_pos_nor);
+ DRW_vbo_request(cache->batch.wire_edges, &cache->ordered.loop_edge_fac);
+ }
+ if (DRW_batch_requested(cache->batch.wire_loops_uvs, GPU_PRIM_LINE_STRIP)) {
+ DRW_ibo_request(cache->batch.wire_loops_uvs, &cache->ibo.loops_line_strips);
+ /* For paint overlay. Active layer should have been queried. */
+ if (cache->cd_lused[CD_MLOOPUV] != 0) {
+ DRW_vbo_request(cache->batch.wire_loops_uvs, &cache->ordered.loop_uv_tan);
+ }
}
+ /* Edit Mesh */
if (DRW_batch_requested(cache->batch.edit_triangles, GPU_PRIM_TRIS)) {
- DRW_vbo_request(cache->batch.edit_triangles, &cache->edit.pos_nor);
- DRW_vbo_request(cache->batch.edit_triangles, &cache->edit.data);
+ DRW_ibo_request(cache->batch.edit_triangles, &cache->ibo.edit_loops_tris);
+ DRW_vbo_request(cache->batch.edit_triangles, &cache->edit.loop_pos_nor);
+ DRW_vbo_request(cache->batch.edit_triangles, &cache->edit.loop_data);
}
if (DRW_batch_requested(cache->batch.edit_vertices, GPU_PRIM_POINTS)) {
- DRW_ibo_request(cache->batch.edit_vertices, &cache->ibo.edit_verts_points);
- DRW_vbo_request(cache->batch.edit_vertices, &cache->edit.pos_nor);
- DRW_vbo_request(cache->batch.edit_vertices, &cache->edit.data);
+ DRW_ibo_request(cache->batch.edit_vertices, &cache->ibo.edit_loops_points);
+ DRW_vbo_request(cache->batch.edit_vertices, &cache->edit.loop_pos_nor);
+ DRW_vbo_request(cache->batch.edit_vertices, &cache->edit.loop_data);
+ }
+ if (DRW_batch_requested(cache->batch.edit_edges, GPU_PRIM_LINES)) {
+ DRW_ibo_request(cache->batch.edit_edges, &cache->ibo.edit_loops_lines);
+ DRW_vbo_request(cache->batch.edit_edges, &cache->edit.loop_pos_nor);
+ DRW_vbo_request(cache->batch.edit_edges, &cache->edit.loop_data);
}
- if (DRW_batch_requested(cache->batch.edit_loose_edges, GPU_PRIM_LINES)) {
- DRW_vbo_request(cache->batch.edit_loose_edges, &cache->edit.pos_nor_ledges);
- DRW_vbo_request(cache->batch.edit_loose_edges, &cache->edit.data_ledges);
+ if (DRW_batch_requested(cache->batch.edit_lnor, GPU_PRIM_POINTS)) {
+ DRW_ibo_request(cache->batch.edit_lnor, &cache->ibo.edit_loops_tris);
+ DRW_vbo_request(cache->batch.edit_lnor, &cache->edit.loop_pos_nor);
+ DRW_vbo_request(cache->batch.edit_lnor, &cache->edit.loop_lnor);
}
- if (DRW_batch_requested(cache->batch.edit_loose_verts, GPU_PRIM_POINTS)) {
- DRW_vbo_request(cache->batch.edit_loose_verts, &cache->edit.pos_nor_lverts);
- DRW_vbo_request(cache->batch.edit_loose_verts, &cache->edit.data_lverts);
+ if (DRW_batch_requested(cache->batch.edit_facedots, GPU_PRIM_POINTS)) {
+ DRW_vbo_request(cache->batch.edit_facedots, &cache->edit.facedots_pos_nor_data);
}
- if (DRW_batch_requested(cache->batch.edit_triangles_nor, GPU_PRIM_POINTS)) {
- DRW_ibo_request(cache->batch.edit_triangles_nor, &cache->ibo.edit_verts_points);
- DRW_vbo_request(cache->batch.edit_triangles_nor, &cache->edit.pos_nor);
+
+ /* Edit UV */
+ if (DRW_batch_requested(cache->batch.edituv_faces, GPU_PRIM_TRI_FAN)) {
+ DRW_ibo_request(cache->batch.edituv_faces, &cache->ibo.edituv_loops_tri_fans);
+ DRW_vbo_request(cache->batch.edituv_faces, &cache->edit.loop_uv);
+ DRW_vbo_request(cache->batch.edituv_faces, &cache->edit.loop_uv_data);
}
- if (DRW_batch_requested(cache->batch.edit_triangles_lnor, GPU_PRIM_POINTS)) {
- DRW_vbo_request(cache->batch.edit_triangles_lnor, &cache->edit.pos_nor);
- DRW_vbo_request(cache->batch.edit_triangles_lnor, &cache->edit.lnor);
+ if (DRW_batch_requested(cache->batch.edituv_faces_strech_area, GPU_PRIM_TRI_FAN)) {
+ DRW_ibo_request(cache->batch.edituv_faces_strech_area, &cache->ibo.edituv_loops_tri_fans);
+ DRW_vbo_request(cache->batch.edituv_faces_strech_area, &cache->edit.loop_uv);
+ DRW_vbo_request(cache->batch.edituv_faces_strech_area, &cache->edit.loop_uv_data);
+ DRW_vbo_request(cache->batch.edituv_faces_strech_area, &cache->edit.loop_stretch_area);
}
- if (DRW_batch_requested(cache->batch.edit_loose_edges_nor, GPU_PRIM_POINTS)) {
- DRW_vbo_request(cache->batch.edit_loose_edges_nor, &cache->edit.pos_nor_ledges);
+ if (DRW_batch_requested(cache->batch.edituv_faces_strech_angle, GPU_PRIM_TRI_FAN)) {
+ DRW_ibo_request(cache->batch.edituv_faces_strech_angle, &cache->ibo.edituv_loops_tri_fans);
+ DRW_vbo_request(cache->batch.edituv_faces_strech_angle, &cache->edit.loop_uv);
+ DRW_vbo_request(cache->batch.edituv_faces_strech_angle, &cache->edit.loop_uv_data);
+ DRW_vbo_request(cache->batch.edituv_faces_strech_angle, &cache->edit.loop_stretch_angle);
}
- if (DRW_batch_requested(cache->batch.edit_facedots, GPU_PRIM_POINTS)) {
- DRW_vbo_request(cache->batch.edit_facedots, &cache->edit.pos_nor_data_facedots);
+ if (DRW_batch_requested(cache->batch.edituv_edges, GPU_PRIM_LINES)) {
+ DRW_ibo_request(cache->batch.edituv_edges, &cache->ibo.edituv_loops_line_strips);
+ DRW_vbo_request(cache->batch.edituv_edges, &cache->edit.loop_uv);
+ DRW_vbo_request(cache->batch.edituv_edges, &cache->edit.loop_uv_data);
+ }
+ if (DRW_batch_requested(cache->batch.edituv_verts, GPU_PRIM_POINTS)) {
+ DRW_ibo_request(cache->batch.edituv_verts, &cache->ibo.edituv_loops_points);
+ DRW_vbo_request(cache->batch.edituv_verts, &cache->edit.loop_uv);
+ DRW_vbo_request(cache->batch.edituv_verts, &cache->edit.loop_uv_data);
+ }
+ if (DRW_batch_requested(cache->batch.edituv_facedots, GPU_PRIM_POINTS)) {
+ DRW_vbo_request(cache->batch.edituv_facedots, &cache->edit.facedots_uv);
+ DRW_vbo_request(cache->batch.edituv_facedots, &cache->edit.facedots_uv_data);
+ }
+
+ /* Selection */
+ /* TODO reuse ordered.loop_pos_nor if possible. */
+ if (DRW_batch_requested(cache->batch.edit_selection_verts, GPU_PRIM_POINTS)) {
+ DRW_ibo_request(cache->batch.edit_selection_verts, &cache->ibo.edit_loops_points);
+ DRW_vbo_request(cache->batch.edit_selection_verts, &cache->edit.loop_pos_nor);
+ DRW_vbo_request(cache->batch.edit_selection_verts, &cache->edit.loop_vert_idx);
+ }
+ if (DRW_batch_requested(cache->batch.edit_selection_edges, GPU_PRIM_LINES)) {
+ DRW_ibo_request(cache->batch.edit_selection_edges, &cache->ibo.edit_loops_lines);
+ DRW_vbo_request(cache->batch.edit_selection_edges, &cache->edit.loop_pos_nor);
+ DRW_vbo_request(cache->batch.edit_selection_edges, &cache->edit.loop_edge_idx);
+ }
+ if (DRW_batch_requested(cache->batch.edit_selection_faces, GPU_PRIM_TRIS)) {
+ DRW_ibo_request(cache->batch.edit_selection_faces, &cache->ibo.edit_loops_tris);
+ DRW_vbo_request(cache->batch.edit_selection_faces, &cache->edit.loop_pos_nor);
+ DRW_vbo_request(cache->batch.edit_selection_faces, &cache->edit.loop_face_idx);
+ }
+ if (DRW_batch_requested(cache->batch.edit_selection_facedots, GPU_PRIM_POINTS)) {
+ DRW_vbo_request(cache->batch.edit_selection_facedots, &cache->edit.facedots_pos_nor_data);
+ DRW_vbo_request(cache->batch.edit_selection_facedots, &cache->edit.facedots_idx);
}
+ /* Per Material */
for (int i = 0; i < cache->mat_len; ++i) {
if (DRW_batch_requested(cache->surf_per_mat[i], GPU_PRIM_TRIS)) {
if (cache->mat_len > 1) {
@@ -5442,11 +4743,11 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.loop_pos_nor, MR_DATATYPE_VERT | MR_DATATYPE_POLY | MR_DATATYPE_LOOP);
DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.loop_uv_tan, MR_DATATYPE_VERT | MR_DATATYPE_POLY | MR_DATATYPE_LOOP | MR_DATATYPE_SHADING);
DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.loop_vcol, MR_DATATYPE_VERT | MR_DATATYPE_POLY | MR_DATATYPE_LOOP | MR_DATATYPE_SHADING);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->tess.pos_nor, MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI | MR_DATATYPE_POLY);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->tess.wireframe_data, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.loop_edge_fac, MR_DATATYPE_VERT | MR_DATATYPE_POLY | MR_DATATYPE_EDGE | MR_DATATYPE_LOOP);
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.surf_tris, MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_LOOPTRI);
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.loops_tris, MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_LOOPTRI);
- DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.loops_lines, MR_DATATYPE_LOOP | MR_DATATYPE_POLY);
+ DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.loops_lines, MR_DATATYPE_LOOP | MR_DATATYPE_EDGE | MR_DATATYPE_POLY);
+ DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.loops_line_strips, MR_DATATYPE_LOOP | MR_DATATYPE_POLY);
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.edges_lines, MR_DATATYPE_VERT | MR_DATATYPE_EDGE);
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.edges_adj_lines, MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_LOOPTRI);
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.loose_edges_lines, MR_DATATYPE_VERT | MR_DATATYPE_EDGE);
@@ -5454,15 +4755,29 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->surf_per_mat_tris[i], MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_LOOPTRI);
}
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.data, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI | MR_DATATYPE_POLY | MR_DATATYPE_OVERLAY);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.data_ledges, MR_DATATYPE_LOOSE_EDGE | MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOP | MR_DATATYPE_OVERLAY);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.data_lverts, MR_DATATYPE_LOOSE_VERT | MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_OVERLAY);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.pos_nor, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI | MR_DATATYPE_POLY | MR_DATATYPE_OVERLAY);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.pos_nor_ledges, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOSE_EDGE | MR_DATATYPE_LOOP | MR_DATATYPE_OVERLAY);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.pos_nor_lverts, MR_DATATYPE_VERT | MR_DATATYPE_LOOSE_VERT | MR_DATATYPE_OVERLAY);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.pos_nor_data_facedots, MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_OVERLAY);
- DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.lnor, MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI | MR_DATATYPE_OVERLAY);
- DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_edit_flag, cache->ibo.edit_verts_points, MR_DATATYPE_VERT | MR_DATATYPE_POLY | MR_DATATYPE_LOOPTRI);
+ int combined_edit_flag = MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOP | MR_DATATYPE_POLY |
+ MR_DATATYPE_LOOSE_VERT | MR_DATATYPE_LOOSE_EDGE | MR_DATATYPE_OVERLAY;
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.loop_pos_nor, combined_edit_flag);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.loop_lnor, combined_edit_flag);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.loop_data, combined_edit_flag);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.loop_uv_data, combined_edit_flag);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.loop_uv, combined_edit_flag | MR_DATATYPE_LOOPUV);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.loop_vert_idx, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOSE_VERT | MR_DATATYPE_LOOSE_EDGE | MR_DATATYPE_POLY | MR_DATATYPE_LOOP);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.loop_edge_idx, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOSE_VERT | MR_DATATYPE_LOOSE_EDGE | MR_DATATYPE_POLY | MR_DATATYPE_LOOP);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.loop_face_idx, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOSE_VERT | MR_DATATYPE_LOOSE_EDGE | MR_DATATYPE_POLY | MR_DATATYPE_LOOP);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.facedots_idx, MR_DATATYPE_POLY);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.facedots_pos_nor_data, MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_OVERLAY);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.loop_stretch_angle, combined_edit_flag);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.loop_stretch_area, combined_edit_flag);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.facedots_uv, combined_edit_flag | MR_DATATYPE_LOOPUV);
+ DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_edit_flag, cache->edit.facedots_uv_data, combined_edit_flag);
+ DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_edit_flag, cache->ibo.edituv_loops_points, combined_edit_flag);
+ DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_edit_flag, cache->ibo.edituv_loops_line_strips, combined_edit_flag);
+ DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_edit_flag, cache->ibo.edituv_loops_tri_fans, combined_edit_flag);
+ /* TODO: Some of the flags here may not be needed. */
+ DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_edit_flag, cache->ibo.edit_loops_points, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOSE_VERT | MR_DATATYPE_LOOSE_EDGE | MR_DATATYPE_POLY | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI);
+ DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_edit_flag, cache->ibo.edit_loops_lines, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOSE_VERT | MR_DATATYPE_LOOSE_EDGE | MR_DATATYPE_POLY | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI);
+ DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_edit_flag, cache->ibo.edit_loops_tris, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOSE_VERT | MR_DATATYPE_LOOSE_EDGE | MR_DATATYPE_POLY | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI);
Mesh *me_original = me;
MBC_GET_FINAL_MESH(me);
@@ -5471,7 +4786,11 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
mr_flag |= mr_edit_flag;
}
- MeshRenderData *rdata = mesh_render_data_create_ex(me, mr_flag, cache->cd_vused, cache->cd_lused);
+ MeshRenderData *rdata = NULL;
+
+ if (mr_flag != 0) {
+ rdata = mesh_render_data_create_ex(me, mr_flag, cache->cd_vused, cache->cd_lused, ts);
+ }
/* Generate VBOs */
if (DRW_vbo_requested(cache->ordered.pos_nor)) {
@@ -5481,7 +4800,10 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
mesh_create_weights(rdata, cache->ordered.weights, &cache->weight_state);
}
if (DRW_vbo_requested(cache->ordered.loop_pos_nor)) {
- mesh_create_loop_pos_and_nor(rdata, cache->ordered.loop_pos_nor, use_face_sel);
+ mesh_create_loop_pos_and_nor(rdata, cache->ordered.loop_pos_nor);
+ }
+ if (DRW_vbo_requested(cache->ordered.loop_edge_fac)) {
+ mesh_create_loop_edge_fac(rdata, cache->ordered.loop_edge_fac);
}
if (DRW_vbo_requested(cache->ordered.loop_uv_tan)) {
mesh_create_loop_uv_and_tan(rdata, cache->ordered.loop_uv_tan);
@@ -5489,12 +4811,6 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
if (DRW_vbo_requested(cache->ordered.loop_vcol)) {
mesh_create_loop_vcol(rdata, cache->ordered.loop_vcol);
}
- if (DRW_vbo_requested(cache->tess.wireframe_data)) {
- mesh_create_wireframe_data_tess(rdata, cache->tess.wireframe_data);
- }
- if (DRW_vbo_requested(cache->tess.pos_nor)) {
- mesh_create_pos_and_nor_tess(rdata, cache->tess.pos_nor, use_hide);
- }
if (DRW_ibo_requested(cache->ibo.edges_lines)) {
mesh_create_edges_lines(rdata, cache->ibo.edges_lines, use_hide);
}
@@ -5510,6 +4826,9 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
if (DRW_ibo_requested(cache->ibo.loops_lines)) {
mesh_create_loops_lines(rdata, cache->ibo.loops_lines, use_hide);
}
+ if (DRW_ibo_requested(cache->ibo.loops_line_strips)) {
+ mesh_create_loops_line_strips(rdata, cache->ibo.loops_line_strips, use_hide);
+ }
if (DRW_ibo_requested(cache->ibo.loops_tris)) {
mesh_create_loops_tris(rdata, &cache->ibo.loops_tris, 1, use_hide);
}
@@ -5518,36 +4837,91 @@ void DRW_mesh_batch_cache_create_requested(Object *ob, Mesh *me)
}
/* Use original Mesh* to have the correct edit cage. */
- if (me_original != me) {
- mesh_render_data_free(rdata);
- rdata = mesh_render_data_create(me_original, mr_edit_flag);
+ if (me_original != me && mr_edit_flag != 0) {
+ if (rdata) {
+ mesh_render_data_free(rdata);
+ }
+ rdata = mesh_render_data_create_ex(me_original, mr_edit_flag, NULL, NULL, ts);
}
- if (rdata->mapped.supported) {
+ if (rdata && rdata->mapped.supported) {
rdata->mapped.use = true;
}
- if (DRW_vbo_requested(cache->edit.data) ||
- DRW_vbo_requested(cache->edit.pos_nor) ||
- DRW_vbo_requested(cache->edit.lnor) ||
- DRW_ibo_requested(cache->ibo.edit_verts_points))
+ if (DRW_vbo_requested(cache->edit.loop_pos_nor) ||
+ DRW_vbo_requested(cache->edit.loop_lnor) ||
+ DRW_vbo_requested(cache->edit.loop_data) ||
+ DRW_vbo_requested(cache->edit.loop_vert_idx) ||
+ DRW_vbo_requested(cache->edit.loop_edge_idx) ||
+ DRW_vbo_requested(cache->edit.loop_face_idx))
{
- mesh_create_edit_tris_and_verts(
+ mesh_create_edit_vertex_loops(
rdata,
- cache->edit.data, cache->edit.pos_nor,
- cache->edit.lnor, cache->ibo.edit_verts_points);
+ cache->edit.loop_pos_nor,
+ cache->edit.loop_lnor,
+ NULL,
+ cache->edit.loop_data,
+ cache->edit.loop_vert_idx,
+ cache->edit.loop_edge_idx,
+ cache->edit.loop_face_idx);
+ }
+ if (DRW_vbo_requested(cache->edit.facedots_pos_nor_data)) {
+ mesh_create_edit_facedots(rdata, cache->edit.facedots_pos_nor_data);
+ }
+ if (DRW_vbo_requested(cache->edit.facedots_idx)) {
+ mesh_create_edit_facedots_select_id(rdata, cache->edit.facedots_idx);
+ }
+ if (DRW_ibo_requested(cache->ibo.edit_loops_points) ||
+ DRW_ibo_requested(cache->ibo.edit_loops_lines))
+ {
+ mesh_create_edit_loops_points_lines(rdata, cache->ibo.edit_loops_points, cache->ibo.edit_loops_lines);
}
- if (DRW_vbo_requested(cache->edit.data_ledges) || DRW_vbo_requested(cache->edit.pos_nor_ledges)) {
- mesh_create_edit_loose_edges(rdata, cache->edit.data_ledges, cache->edit.pos_nor_ledges);
+ if (DRW_ibo_requested(cache->ibo.edit_loops_tris)) {
+ mesh_create_edit_loops_tris(rdata, cache->ibo.edit_loops_tris);
}
- if (DRW_vbo_requested(cache->edit.data_lverts) || DRW_vbo_requested(cache->edit.pos_nor_lverts)) {
- mesh_create_edit_loose_verts(rdata, cache->edit.data_lverts, cache->edit.pos_nor_lverts);
+
+ /* UV editor */
+ /**
+ * TODO: The code and data structure is ready to support modified UV display
+ * but the selection code for UVs needs to support it first. So for now, only
+ * display the cage in all cases.
+ **/
+ if (rdata && rdata->mapped.supported) {
+ rdata->mapped.use = false;
}
- if (DRW_vbo_requested(cache->edit.pos_nor_data_facedots)) {
- mesh_create_edit_facedots(rdata, cache->edit.pos_nor_data_facedots);
+
+ if (DRW_vbo_requested(cache->edit.loop_uv_data) ||
+ DRW_vbo_requested(cache->edit.loop_uv))
+ {
+ mesh_create_edit_vertex_loops(
+ rdata,
+ NULL,
+ NULL,
+ cache->edit.loop_uv,
+ cache->edit.loop_uv_data,
+ NULL,
+ NULL,
+ NULL);
+ }
+ if (DRW_vbo_requested(cache->edit.loop_stretch_angle) ||
+ DRW_vbo_requested(cache->edit.loop_stretch_area) ||
+ DRW_vbo_requested(cache->edit.facedots_uv) ||
+ DRW_vbo_requested(cache->edit.facedots_uv_data) ||
+ DRW_ibo_requested(cache->ibo.edituv_loops_points) ||
+ DRW_ibo_requested(cache->ibo.edituv_loops_line_strips) ||
+ DRW_ibo_requested(cache->ibo.edituv_loops_tri_fans))
+ {
+ mesh_create_uvedit_buffers(rdata,
+ cache->edit.loop_stretch_area, cache->edit.loop_stretch_angle,
+ cache->edit.facedots_uv, cache->edit.facedots_uv_data,
+ cache->ibo.edituv_loops_points,
+ cache->ibo.edituv_loops_line_strips,
+ cache->ibo.edituv_loops_tri_fans);
}
- mesh_render_data_free(rdata);
+ if (rdata) {
+ mesh_render_data_free(rdata);
+ }
#ifdef DEBUG
/* Make sure all requested batches have been setup. */
diff --git a/source/blender/draw/intern/draw_cache_impl_metaball.c b/source/blender/draw/intern/draw_cache_impl_metaball.c
index b77268fb0a7..811f01aa83a 100644
--- a/source/blender/draw/intern/draw_cache_impl_metaball.c
+++ b/source/blender/draw/intern/draw_cache_impl_metaball.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2017 by Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file draw_cache_impl_metaball.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*
* \brief MetaBall API for render engines
*/
@@ -39,7 +35,6 @@
#include "GPU_batch.h"
-#include "DRW_render.h"
#include "draw_cache_impl.h" /* own include */
@@ -150,7 +145,6 @@ static GPUVertBuf *mball_batch_cache_get_pos_and_normals(Object *ob, MetaBallBat
}
/* -------------------------------------------------------------------- */
-
/** \name Public Object/MetaBall API
* \{ */
@@ -208,14 +202,19 @@ GPUBatch *DRW_metaball_batch_cache_get_wireframes_face(Object *ob)
if (cache->face_wire.batch == NULL) {
ListBase *lb = &ob->runtime.curve_cache->disp;
- GPUVertBuf *vbo_pos_nor = MEM_callocN(sizeof(GPUVertBuf), __func__);
- GPUVertBuf *vbo_wireframe_data = MEM_callocN(sizeof(GPUVertBuf), __func__);
+ GPUVertBuf *vbo_wiredata = MEM_callocN(sizeof(GPUVertBuf), __func__);
+ DRW_displist_vertbuf_create_wiredata(lb, vbo_wiredata);
+
+ GPUIndexBuf *ibo = MEM_callocN(sizeof(GPUIndexBuf), __func__);
+ DRW_displist_indexbuf_create_lines_in_order(lb, ibo);
- DRW_displist_vertbuf_create_pos_and_nor_and_uv_tess(lb, vbo_pos_nor, NULL);
- DRW_displist_vertbuf_create_wireframe_data_tess(lb, vbo_wireframe_data);
+ cache->face_wire.batch = GPU_batch_create_ex(
+ GPU_PRIM_LINES,
+ mball_batch_cache_get_pos_and_normals(ob, cache),
+ ibo,
+ GPU_BATCH_OWNS_INDEX);
- cache->face_wire.batch = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo_pos_nor, NULL, GPU_BATCH_OWNS_VBO);
- GPU_batch_vertbuf_add_ex(cache->face_wire.batch, vbo_wireframe_data, true);
+ GPU_batch_vertbuf_add_ex(cache->face_wire.batch, vbo_wiredata, true);
}
return cache->face_wire.batch;
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index b383fcf4b92..6790a8aa0cc 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2017 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Mike Erwin, Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file draw_cache_impl_particles.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*
* \brief Particle API for render engines
*/
@@ -44,9 +38,7 @@
#include "DNA_particle_types.h"
#include "DNA_customdata_types.h"
-#include "BKE_lattice.h"
#include "BKE_mesh.h"
-#include "BKE_modifier.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
@@ -1176,8 +1168,8 @@ static void particle_batch_cache_ensure_pos_and_seg(
attr_id.ind = GPU_vertformat_attr_add(&format, "ind", GPU_COMP_I32, 1, GPU_FETCH_INT);
if (psmd) {
- uv_id = MEM_mallocN(sizeof(*uv_id) * num_uv_layers, "UV attrib format");
- col_id = MEM_mallocN(sizeof(*col_id) * num_col_layers, "Col attrib format");
+ uv_id = MEM_mallocN(sizeof(*uv_id) * num_uv_layers, "UV attr format");
+ col_id = MEM_mallocN(sizeof(*col_id) * num_col_layers, "Col attr format");
for (int i = 0; i < num_uv_layers; i++) {
const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i);
@@ -1309,8 +1301,9 @@ static void particle_batch_cache_ensure_pos(
if (psys->part->phystype == PART_PHYS_KEYED) {
if (psys->flag & PSYS_KEYED) {
psys_count_keyed_targets(&sim);
- if (psys->totkeyed == 0)
+ if (psys->totkeyed == 0) {
return;
+ }
}
}
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index 36a50dec85e..8c600cd85e8 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_common.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_render.h"
@@ -44,10 +41,7 @@
ARRAY_SET_ITEMS(v4, (float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, (float)a / 255.0f)
/* Colors & Constant */
-GlobalsUboStorage ts;
-struct GPUUniformBuffer *globals_ubo = NULL;
-struct GPUTexture *globals_ramp = NULL;
-struct GPUTexture *globals_weight_ramp = NULL;
+struct DRW_Global G_draw = {0};
static bool weight_ramp_custom = false;
static ColorBand weight_ramp_copy;
@@ -56,114 +50,121 @@ static struct GPUTexture *DRW_create_weight_colorramp_texture(void);
void DRW_globals_update(void)
{
- UI_GetThemeColor4fv(TH_WIRE, ts.colorWire);
- UI_GetThemeColor4fv(TH_WIRE_EDIT, ts.colorWireEdit);
- UI_GetThemeColor4fv(TH_ACTIVE, ts.colorActive);
- UI_GetThemeColor4fv(TH_SELECT, ts.colorSelect);
- UI_GetThemeColor4fv(TH_TRANSFORM, ts.colorTransform);
- UI_COLOR_RGBA_FROM_U8(0x88, 0xFF, 0xFF, 155, ts.colorLibrarySelect);
- UI_COLOR_RGBA_FROM_U8(0x55, 0xCC, 0xCC, 155, ts.colorLibrary);
- UI_GetThemeColor4fv(TH_LAMP, ts.colorLamp);
- UI_GetThemeColor4fv(TH_SPEAKER, ts.colorSpeaker);
- UI_GetThemeColor4fv(TH_CAMERA, ts.colorCamera);
- UI_GetThemeColor4fv(TH_EMPTY, ts.colorEmpty);
- UI_GetThemeColor4fv(TH_VERTEX, ts.colorVertex);
- UI_GetThemeColor4fv(TH_VERTEX_SELECT, ts.colorVertexSelect);
- UI_GetThemeColor4fv(TH_VERTEX_UNREFERENCED, ts.colorVertexUnreferenced);
- UI_COLOR_RGBA_FROM_U8(0xB0, 0x00, 0xB0, 0xFF, ts.colorVertexMissingData);
- UI_GetThemeColor4fv(TH_EDITMESH_ACTIVE, ts.colorEditMeshActive);
- UI_GetThemeColor4fv(TH_EDGE_SELECT, ts.colorEdgeSelect);
-
- UI_GetThemeColor4fv(TH_EDGE_SEAM, ts.colorEdgeSeam);
- UI_GetThemeColor4fv(TH_EDGE_SHARP, ts.colorEdgeSharp);
- UI_GetThemeColor4fv(TH_EDGE_CREASE, ts.colorEdgeCrease);
- UI_GetThemeColor4fv(TH_EDGE_BEVEL, ts.colorEdgeBWeight);
- UI_GetThemeColor4fv(TH_EDGE_FACESEL, ts.colorEdgeFaceSelect);
- UI_GetThemeColor4fv(TH_FACE, ts.colorFace);
- UI_GetThemeColor4fv(TH_FACE_SELECT, ts.colorFaceSelect);
- UI_GetThemeColor4fv(TH_NORMAL, ts.colorNormal);
- UI_GetThemeColor4fv(TH_VNORMAL, ts.colorVNormal);
- UI_GetThemeColor4fv(TH_LNORMAL, ts.colorLNormal);
- UI_GetThemeColor4fv(TH_FACE_DOT, ts.colorFaceDot);
- UI_GetThemeColor4fv(TH_BACK, ts.colorBackground);
+ GlobalsUboStorage *gb = &G_draw.block;
+
+ UI_GetThemeColor4fv(TH_WIRE, gb->colorWire);
+ UI_GetThemeColor4fv(TH_WIRE_EDIT, gb->colorWireEdit);
+ UI_GetThemeColor4fv(TH_ACTIVE, gb->colorActive);
+ UI_GetThemeColor4fv(TH_SELECT, gb->colorSelect);
+ UI_COLOR_RGBA_FROM_U8(0x88, 0xFF, 0xFF, 155, gb->colorLibrarySelect);
+ UI_COLOR_RGBA_FROM_U8(0x55, 0xCC, 0xCC, 155, gb->colorLibrary);
+ UI_GetThemeColor4fv(TH_TRANSFORM, gb->colorTransform);
+ UI_GetThemeColor4fv(TH_LIGHT, gb->colorLight);
+ UI_GetThemeColor4fv(TH_SPEAKER, gb->colorSpeaker);
+ UI_GetThemeColor4fv(TH_CAMERA, gb->colorCamera);
+ UI_GetThemeColor4fv(TH_EMPTY, gb->colorEmpty);
+ UI_GetThemeColor4fv(TH_VERTEX, gb->colorVertex);
+ UI_GetThemeColor4fv(TH_VERTEX_SELECT, gb->colorVertexSelect);
+ UI_GetThemeColor4fv(TH_VERTEX_UNREFERENCED, gb->colorVertexUnreferenced);
+ UI_COLOR_RGBA_FROM_U8(0xB0, 0x00, 0xB0, 0xFF, gb->colorVertexMissingData);
+ UI_GetThemeColor4fv(TH_EDITMESH_ACTIVE, gb->colorEditMeshActive);
+ UI_GetThemeColor4fv(TH_EDGE_SELECT, gb->colorEdgeSelect);
+
+ UI_GetThemeColor4fv(TH_EDGE_SEAM, gb->colorEdgeSeam);
+ UI_GetThemeColor4fv(TH_EDGE_SHARP, gb->colorEdgeSharp);
+ UI_GetThemeColor4fv(TH_EDGE_CREASE, gb->colorEdgeCrease);
+ UI_GetThemeColor4fv(TH_EDGE_BEVEL, gb->colorEdgeBWeight);
+ UI_GetThemeColor4fv(TH_EDGE_FACESEL, gb->colorEdgeFaceSelect);
+ UI_GetThemeColor4fv(TH_FACE, gb->colorFace);
+ UI_GetThemeColor4fv(TH_FACE_SELECT, gb->colorFaceSelect);
+ UI_GetThemeColor4fv(TH_NORMAL, gb->colorNormal);
+ UI_GetThemeColor4fv(TH_VNORMAL, gb->colorVNormal);
+ UI_GetThemeColor4fv(TH_LNORMAL, gb->colorLNormal);
+ UI_GetThemeColor4fv(TH_FACE_DOT, gb->colorFaceDot);
+ UI_GetThemeColor4fv(TH_BACK, gb->colorBackground);
/* Custom median color to slightly affect the edit mesh colors. */
- interp_v4_v4v4(ts.colorEditMeshMiddle, ts.colorVertexSelect, ts.colorWireEdit, 0.35f);
- copy_v3_fl(ts.colorEditMeshMiddle, dot_v3v3(ts.colorEditMeshMiddle, (float[3]){0.3333f, 0.3333f, 0.3333f})); /* Desaturate */
+ interp_v4_v4v4(gb->colorEditMeshMiddle, gb->colorVertexSelect, gb->colorWireEdit, 0.35f);
+ copy_v3_fl(gb->colorEditMeshMiddle, dot_v3v3(gb->colorEditMeshMiddle, (float[3]){0.3333f, 0.3333f, 0.3333f})); /* Desaturate */
+
+ interp_v4_v4v4(gb->colorDupliSelect, gb->colorBackground, gb->colorSelect, 0.5f);
+ /* Was 50% in 2.7x since the background was lighter making it easier to tell the color from black,
+ * with a darker background we need a more faded color. */
+ interp_v4_v4v4(gb->colorDupli, gb->colorBackground, gb->colorWire, 0.3f);
#ifdef WITH_FREESTYLE
- UI_GetThemeColor4fv(TH_FREESTYLE_EDGE_MARK, ts.colorEdgeFreestyle);
- UI_GetThemeColor4fv(TH_FREESTYLE_FACE_MARK, ts.colorFaceFreestyle);
+ UI_GetThemeColor4fv(TH_FREESTYLE_EDGE_MARK, gb->colorEdgeFreestyle);
+ UI_GetThemeColor4fv(TH_FREESTYLE_FACE_MARK, gb->colorFaceFreestyle);
#else
- zero_v4(ts.colorEdgeFreestyle);
- zero_v4(ts.colorFaceFreestyle);
+ zero_v4(gb->colorEdgeFreestyle);
+ zero_v4(gb->colorFaceFreestyle);
#endif
/* Curve */
- UI_GetThemeColor4fv(TH_HANDLE_FREE, ts.colorHandleFree);
- UI_GetThemeColor4fv(TH_HANDLE_AUTO, ts.colorHandleAuto);
- UI_GetThemeColor4fv(TH_HANDLE_VECT, ts.colorHandleVect);
- UI_GetThemeColor4fv(TH_HANDLE_ALIGN, ts.colorHandleAlign);
- UI_GetThemeColor4fv(TH_HANDLE_AUTOCLAMP, ts.colorHandleAutoclamp);
- UI_GetThemeColor4fv(TH_HANDLE_SEL_FREE, ts.colorHandleSelFree);
- UI_GetThemeColor4fv(TH_HANDLE_SEL_AUTO, ts.colorHandleSelAuto);
- UI_GetThemeColor4fv(TH_HANDLE_SEL_VECT, ts.colorHandleSelVect);
- UI_GetThemeColor4fv(TH_HANDLE_SEL_ALIGN, ts.colorHandleSelAlign);
- UI_GetThemeColor4fv(TH_HANDLE_SEL_AUTOCLAMP, ts.colorHandleSelAutoclamp);
- UI_GetThemeColor4fv(TH_NURB_ULINE, ts.colorNurbUline);
- UI_GetThemeColor4fv(TH_NURB_VLINE, ts.colorNurbVline);
- UI_GetThemeColor4fv(TH_NURB_SEL_ULINE, ts.colorNurbSelUline);
- UI_GetThemeColor4fv(TH_NURB_SEL_VLINE, ts.colorNurbSelVline);
- UI_GetThemeColor4fv(TH_ACTIVE_SPLINE, ts.colorActiveSpline);
-
- UI_GetThemeColor4fv(TH_BONE_POSE, ts.colorBonePose);
-
- UI_GetThemeColor4fv(TH_CFRAME, ts.colorCurrentFrame);
+ UI_GetThemeColor4fv(TH_HANDLE_FREE, gb->colorHandleFree);
+ UI_GetThemeColor4fv(TH_HANDLE_AUTO, gb->colorHandleAuto);
+ UI_GetThemeColor4fv(TH_HANDLE_VECT, gb->colorHandleVect);
+ UI_GetThemeColor4fv(TH_HANDLE_ALIGN, gb->colorHandleAlign);
+ UI_GetThemeColor4fv(TH_HANDLE_AUTOCLAMP, gb->colorHandleAutoclamp);
+ UI_GetThemeColor4fv(TH_HANDLE_SEL_FREE, gb->colorHandleSelFree);
+ UI_GetThemeColor4fv(TH_HANDLE_SEL_AUTO, gb->colorHandleSelAuto);
+ UI_GetThemeColor4fv(TH_HANDLE_SEL_VECT, gb->colorHandleSelVect);
+ UI_GetThemeColor4fv(TH_HANDLE_SEL_ALIGN, gb->colorHandleSelAlign);
+ UI_GetThemeColor4fv(TH_HANDLE_SEL_AUTOCLAMP, gb->colorHandleSelAutoclamp);
+ UI_GetThemeColor4fv(TH_NURB_ULINE, gb->colorNurbUline);
+ UI_GetThemeColor4fv(TH_NURB_VLINE, gb->colorNurbVline);
+ UI_GetThemeColor4fv(TH_NURB_SEL_ULINE, gb->colorNurbSelUline);
+ UI_GetThemeColor4fv(TH_NURB_SEL_VLINE, gb->colorNurbSelVline);
+ UI_GetThemeColor4fv(TH_ACTIVE_SPLINE, gb->colorActiveSpline);
+
+ UI_GetThemeColor4fv(TH_BONE_POSE, gb->colorBonePose);
+
+ UI_GetThemeColor4fv(TH_CFRAME, gb->colorCurrentFrame);
/* Grid */
- UI_GetThemeColorShade4fv(TH_GRID, 10, ts.colorGrid);
+ UI_GetThemeColorShade4fv(TH_GRID, 10, gb->colorGrid);
/* emphasise division lines lighter instead of darker, if background is darker than grid */
UI_GetThemeColorShade4fv(
TH_GRID,
- (ts.colorGrid[0] + ts.colorGrid[1] + ts.colorGrid[2] + 0.12f >
- ts.colorBackground[0] + ts.colorBackground[1] + ts.colorBackground[2]) ?
- 20 : -10, ts.colorGridEmphasise);
+ (gb->colorGrid[0] + gb->colorGrid[1] + gb->colorGrid[2] + 0.12f >
+ gb->colorBackground[0] + gb->colorBackground[1] + gb->colorBackground[2]) ?
+ 20 : -10, gb->colorGridEmphasise);
/* Grid Axis */
- UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_X, 0.5f, -10, ts.colorGridAxisX);
- UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_Y, 0.5f, -10, ts.colorGridAxisY);
- UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_Z, 0.5f, -10, ts.colorGridAxisZ);
+ UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_X, 0.5f, -10, gb->colorGridAxisX);
+ UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_Y, 0.5f, -10, gb->colorGridAxisY);
+ UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_Z, 0.5f, -10, gb->colorGridAxisZ);
- UI_GetThemeColorShadeAlpha4fv(TH_TRANSFORM, 0, -80, ts.colorDeselect);
- UI_GetThemeColorShadeAlpha4fv(TH_WIRE, 0, -30, ts.colorOutline);
- UI_GetThemeColorShadeAlpha4fv(TH_LAMP, 0, 255, ts.colorLampNoAlpha);
+ UI_GetThemeColorShadeAlpha4fv(TH_TRANSFORM, 0, -80, gb->colorDeselect);
+ UI_GetThemeColorShadeAlpha4fv(TH_WIRE, 0, -30, gb->colorOutline);
+ UI_GetThemeColorShadeAlpha4fv(TH_LIGHT, 0, 255, gb->colorLightNoAlpha);
- ts.sizeLampCenter = (U.obcenter_dia + 1.5f) * U.pixelsize;
- ts.sizeLampCircle = U.pixelsize * 9.0f;
- ts.sizeLampCircleShadow = ts.sizeLampCircle + U.pixelsize * 3.0f;
+ gb->sizeLightCenter = (U.obcenter_dia + 1.5f) * U.pixelsize;
+ gb->sizeLightCircle = U.pixelsize * 9.0f;
+ gb->sizeLightCircleShadow = gb->sizeLightCircle + U.pixelsize * 3.0f;
/* M_SQRT2 to be at least the same size of the old square */
- ts.sizeVertex = U.pixelsize * (max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f));
- ts.sizeFaceDot = U.pixelsize * UI_GetThemeValuef(TH_FACEDOT_SIZE);
- ts.sizeEdge = U.pixelsize * (1.0f / 2.0f); /* TODO Theme */
- ts.sizeEdgeFix = U.pixelsize * (0.5f + 2.0f * (2.0f * (MAX2(ts.sizeVertex, ts.sizeEdge)) * (float)M_SQRT1_2));
+ gb->sizeVertex = U.pixelsize * (max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f));
+ gb->sizeFaceDot = U.pixelsize * UI_GetThemeValuef(TH_FACEDOT_SIZE);
+ gb->sizeEdge = U.pixelsize * (1.0f / 2.0f); /* TODO Theme */
+ gb->sizeEdgeFix = U.pixelsize * (0.5f + 2.0f * (2.0f * (gb->sizeEdge * (float)M_SQRT1_2)));
/* Color management. */
if (DRW_state_is_image_render()) {
- float *color = ts.UBO_FIRST_COLOR;
+ float *color = gb->UBO_FIRST_COLOR;
do {
/* TODO more accurate transform. */
srgb_to_linearrgb_v4(color, color);
color += 4;
- } while (color != ts.UBO_LAST_COLOR);
+ } while (color != gb->UBO_LAST_COLOR);
}
- if (globals_ubo == NULL) {
- globals_ubo = DRW_uniformbuffer_create(sizeof(GlobalsUboStorage), &ts);
+ if (G_draw.block_ubo == NULL) {
+ G_draw.block_ubo = DRW_uniformbuffer_create(sizeof(GlobalsUboStorage), gb);
}
- DRW_uniformbuffer_update(globals_ubo, &ts);
+ DRW_uniformbuffer_update(G_draw.block_ubo, gb);
- if (!globals_ramp) {
+ if (!G_draw.ramp) {
ColorBand ramp = {0};
float *colors;
int col_size;
@@ -181,7 +182,7 @@ void DRW_globals_update(void)
BKE_colorband_evaluate_table_rgba(&ramp, &colors, &col_size);
- globals_ramp = GPU_texture_create_1D(col_size, GPU_RGBA8, colors, NULL);
+ G_draw.ramp = GPU_texture_create_1D(col_size, GPU_RGBA8, colors, NULL);
MEM_freeN(colors);
}
@@ -192,14 +193,14 @@ void DRW_globals_update(void)
if (weight_ramp_custom != user_weight_ramp ||
(user_weight_ramp && memcmp(&weight_ramp_copy, &U.coba_weight, sizeof(ColorBand)) != 0))
{
- DRW_TEXTURE_FREE_SAFE(globals_weight_ramp);
+ DRW_TEXTURE_FREE_SAFE(G_draw.weight_ramp);
}
- if (globals_weight_ramp == NULL) {
+ if (G_draw.weight_ramp == NULL) {
weight_ramp_custom = user_weight_ramp;
memcpy(&weight_ramp_copy, &U.coba_weight, sizeof(ColorBand));
- globals_weight_ramp = DRW_create_weight_colorramp_texture();
+ G_draw.weight_ramp = DRW_create_weight_colorramp_texture();
}
}
@@ -236,7 +237,7 @@ extern char datatoc_gpu_shader_point_varying_color_frag_glsl[];
extern char datatoc_object_mball_handles_vert_glsl[];
extern char datatoc_object_empty_axes_vert_glsl[];
-static struct {
+typedef struct COMMON_Shaders {
struct GPUShader *shape_outline;
struct GPUShader *shape_solid;
struct GPUShader *bone_axes;
@@ -256,7 +257,9 @@ static struct {
struct GPUShader *empty_axes_sh;
struct GPUShader *mball_handles;
-} g_shaders = {NULL};
+} COMMON_Shaders;
+
+static COMMON_Shaders g_shaders[GPU_SHADER_CFG_LEN] = {{NULL}};
static struct {
struct GPUVertFormat *instance_screenspace;
@@ -287,27 +290,38 @@ void DRW_globals_free(void)
MEM_SAFE_FREE(*format);
}
- struct GPUShader **shader = &g_shaders.shape_outline;
- for (int i = 0; i < sizeof(g_shaders) / sizeof(void *); ++i, ++shader) {
- DRW_SHADER_FREE_SAFE(*shader);
+ for (int j = 0; j < GPU_SHADER_CFG_LEN; j++) {
+ struct GPUShader **shader = &g_shaders[j].shape_outline;
+ for (int i = 0; i < sizeof(g_shaders[j]) / sizeof(void *); ++i, ++shader) {
+ DRW_SHADER_FREE_SAFE(*shader);
+ }
}
}
-DRWShadingGroup *shgroup_dynlines_flat_color(DRWPass *pass)
+void DRW_shgroup_world_clip_planes_from_rv3d(DRWShadingGroup *shgrp, const RegionView3D *rv3d)
+{
+ int world_clip_planes_len = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
+ DRW_shgroup_uniform_vec4(shgrp, "WorldClipPlanes", rv3d->clip[0], world_clip_planes_len);
+ DRW_shgroup_state_enable(shgrp, DRW_STATE_CLIP_PLANES);
+}
+
+DRWShadingGroup *shgroup_dynlines_flat_color(DRWPass *pass, eGPUShaderConfig sh_cfg)
{
- GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_FLAT_COLOR);
+ GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_FLAT_COLOR, sh_cfg);
DRW_shgroup_instance_format(g_formats.dynlines_color, {
- {"pos", DRW_ATTRIB_FLOAT, 3},
- {"color", DRW_ATTRIB_FLOAT, 4}
+ {"pos", DRW_ATTR_FLOAT, 3},
+ {"color", DRW_ATTR_FLOAT, 4},
});
DRWShadingGroup *grp = DRW_shgroup_line_batch_create_with_format(sh, pass, g_formats.dynlines_color);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(DRWPass *pass, float color[4])
+DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(DRWPass *pass, const float color[4])
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
@@ -323,53 +337,63 @@ DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(DRWPass *pass, float colo
return grp;
}
-DRWShadingGroup *shgroup_dynpoints_uniform_color(DRWPass *pass, float color[4], float *size)
+DRWShadingGroup *shgroup_dynpoints_uniform_color(
+ DRWPass *pass, const float color[4], const float *size, eGPUShaderConfig sh_cfg)
{
- GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA);
+ GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, sh_cfg);
DRWShadingGroup *grp = DRW_shgroup_point_batch_create(sh, pass);
DRW_shgroup_uniform_vec4(grp, "color", color, 1);
DRW_shgroup_uniform_float(grp, "size", size, 1);
DRW_shgroup_state_enable(grp, DRW_STATE_POINT);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_groundlines_uniform_color(DRWPass *pass, float color[4])
+DRWShadingGroup *shgroup_groundlines_uniform_color(DRWPass *pass, const float color[4], eGPUShaderConfig sh_cfg)
{
- GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_GROUNDLINE);
+ GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_GROUNDLINE, sh_cfg);
DRWShadingGroup *grp = DRW_shgroup_point_batch_create(sh, pass);
DRW_shgroup_uniform_vec4(grp, "color", color, 1);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_groundpoints_uniform_color(DRWPass *pass, float color[4])
+DRWShadingGroup *shgroup_groundpoints_uniform_color(DRWPass *pass, const float color[4], eGPUShaderConfig sh_cfg)
{
- GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_GROUNDPOINT);
+ GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_GROUNDPOINT, sh_cfg);
DRWShadingGroup *grp = DRW_shgroup_point_batch_create(sh, pass);
DRW_shgroup_uniform_vec4(grp, "color", color, 1);
DRW_shgroup_state_enable(grp, DRW_STATE_POINT);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_instance_screenspace(DRWPass *pass, struct GPUBatch *geom, float *size)
+DRWShadingGroup *shgroup_instance_screenspace(
+ DRWPass *pass, struct GPUBatch *geom, const float *size, eGPUShaderConfig sh_cfg)
{
- GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR);
+ GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR, sh_cfg);
DRW_shgroup_instance_format(g_formats.instance_screenspace, {
- {"world_pos", DRW_ATTRIB_FLOAT, 3},
- {"color", DRW_ATTRIB_FLOAT, 3}
+ {"world_pos", DRW_ATTR_FLOAT, 3},
+ {"color", DRW_ATTR_FLOAT, 3},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh, pass, geom, g_formats.instance_screenspace);
DRW_shgroup_uniform_float(grp, "size", size, 1);
DRW_shgroup_uniform_float(grp, "pixel_size", DRW_viewport_pixelsize_get(), 1);
DRW_shgroup_uniform_vec3(grp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
@@ -379,8 +403,8 @@ DRWShadingGroup *shgroup_instance_solid(DRWPass *pass, struct GPUBatch *geom)
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_OBJECTSPACE_SIMPLE_LIGHTING_VARIYING_COLOR);
DRW_shgroup_instance_format(g_formats.instance_color, {
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16},
- {"color", DRW_ATTRIB_FLOAT, 4}
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
+ {"color", DRW_ATTR_FLOAT, 4},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh, pass, geom, g_formats.instance_color);
@@ -394,8 +418,8 @@ DRWShadingGroup *shgroup_instance_wire(DRWPass *pass, struct GPUBatch *geom)
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_OBJECTSPACE_VARIYING_COLOR);
DRW_shgroup_instance_format(g_formats.instance_color, {
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16},
- {"color", DRW_ATTRIB_FLOAT, 4}
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
+ {"color", DRW_ATTR_FLOAT, 4},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh, pass, geom, g_formats.instance_color);
@@ -403,86 +427,100 @@ DRWShadingGroup *shgroup_instance_wire(DRWPass *pass, struct GPUBatch *geom)
return grp;
}
-DRWShadingGroup *shgroup_instance_screen_aligned(DRWPass *pass, struct GPUBatch *geom)
+DRWShadingGroup *shgroup_instance_screen_aligned(
+ DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg)
{
- GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED);
+ GPUShader *sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED, sh_cfg);
DRW_shgroup_instance_format(g_formats.instance_screen_aligned, {
- {"color", DRW_ATTRIB_FLOAT, 3},
- {"size", DRW_ATTRIB_FLOAT, 1},
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16}
+ {"color", DRW_ATTR_FLOAT, 3},
+ {"size", DRW_ATTR_FLOAT, 1},
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh, pass, geom, g_formats.instance_screen_aligned);
DRW_shgroup_uniform_vec3(grp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct GPUBatch *geom)
+DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg)
{
- GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE);
+ GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE, sh_cfg);
DRW_shgroup_instance_format(g_formats.instance_scaled, {
- {"color", DRW_ATTRIB_FLOAT, 3},
- {"size", DRW_ATTRIB_FLOAT, 3},
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16}
+ {"color", DRW_ATTR_FLOAT, 3},
+ {"size", DRW_ATTR_FLOAT, 3},
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_scaled);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_instance(DRWPass *pass, struct GPUBatch *geom)
+DRWShadingGroup *shgroup_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg)
{
- GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE);
+ GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, sh_cfg);
DRW_shgroup_instance_format(g_formats.instance_sized, {
- {"color", DRW_ATTRIB_FLOAT, 3},
- {"size", DRW_ATTRIB_FLOAT, 1},
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16}
+ {"color", DRW_ATTR_FLOAT, 4},
+ {"size", DRW_ATTR_FLOAT, 1},
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_sized);
- DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f);
-
+ DRW_shgroup_state_disable(grp, DRW_STATE_BLEND);
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, float alpha)
+DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg)
{
- GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE);
+ GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, sh_cfg);
DRW_shgroup_instance_format(g_formats.instance_sized, {
- {"color", DRW_ATTRIB_FLOAT, 4},
- {"size", DRW_ATTRIB_FLOAT, 1},
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16}
+ {"color", DRW_ATTR_FLOAT, 4},
+ {"size", DRW_ATTR_FLOAT, 1},
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_sized);
- DRW_shgroup_uniform_float_copy(grp, "alpha", alpha);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_instance_empty_axes(DRWPass *pass, struct GPUBatch *geom)
+DRWShadingGroup *shgroup_instance_empty_axes(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg)
{
- if (g_shaders.empty_axes_sh == NULL) {
- g_shaders.empty_axes_sh = DRW_shader_create(
- datatoc_object_empty_axes_vert_glsl, NULL,
- datatoc_gpu_shader_flat_color_frag_glsl, NULL);
+ COMMON_Shaders *sh_data = &g_shaders[sh_cfg];
+ if (sh_data->empty_axes_sh == NULL) {
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg];
+ sh_data->empty_axes_sh = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_object_empty_axes_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_flat_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
DRW_shgroup_instance_format(g_formats.instance_sized, {
- {"color", DRW_ATTRIB_FLOAT, 3},
- {"size", DRW_ATTRIB_FLOAT, 1},
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16}
+ {"color", DRW_ATTR_FLOAT, 3},
+ {"size", DRW_ATTR_FLOAT, 1},
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
});
- DRWShadingGroup *grp = DRW_shgroup_instance_create(g_shaders.empty_axes_sh, pass, geom, g_formats.instance_sized);
+ DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_data->empty_axes_sh, pass, geom, g_formats.instance_sized);
DRW_shgroup_uniform_vec3(grp, "screenVecs[0]", DRW_viewport_screenvecs_get(), 2);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
@@ -491,9 +529,9 @@ DRWShadingGroup *shgroup_instance_outline(DRWPass *pass, struct GPUBatch *geom,
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_ID_VARIYING_SIZE);
DRW_shgroup_instance_format(g_formats.instance_outline, {
- {"callId", DRW_ATTRIB_INT, 1},
- {"size", DRW_ATTRIB_FLOAT, 1},
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16}
+ {"callId", DRW_ATTR_INT, 1},
+ {"size", DRW_ATTR_FLOAT, 1},
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_outline);
@@ -502,75 +540,82 @@ DRWShadingGroup *shgroup_instance_outline(DRWPass *pass, struct GPUBatch *geom,
return grp;
}
-DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct GPUBatch *geom)
+DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg)
{
- GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_CAMERA);
+ GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_CAMERA, sh_cfg);
DRW_shgroup_instance_format(g_formats.instance_camera, {
- {"color", DRW_ATTRIB_FLOAT, 3},
- {"corners", DRW_ATTRIB_FLOAT, 8},
- {"depth", DRW_ATTRIB_FLOAT, 1},
- {"tria", DRW_ATTRIB_FLOAT, 4},
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16}
+ {"color", DRW_ATTR_FLOAT, 3},
+ {"corners", DRW_ATTR_FLOAT, 8},
+ {"depth", DRW_ATTR_FLOAT, 1},
+ {"tria", DRW_ATTR_FLOAT, 4},
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_camera);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct GPUBatch *geom)
+DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg)
{
- GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_DISTANCE_LINES);
+ GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_DISTANCE_LINES, sh_cfg);
static float point_size = 4.0f;
DRW_shgroup_instance_format(g_formats.instance_distance_lines, {
- {"color", DRW_ATTRIB_FLOAT, 3},
- {"start", DRW_ATTRIB_FLOAT, 1},
- {"end", DRW_ATTRIB_FLOAT, 1},
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16}
+ {"color", DRW_ATTR_FLOAT, 3},
+ {"start", DRW_ATTR_FLOAT, 1},
+ {"end", DRW_ATTR_FLOAT, 1},
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_distance_lines);
DRW_shgroup_uniform_float(grp, "size", &point_size, 1);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct GPUBatch *geom)
+DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg)
{
- GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR);
+ GPUShader *sh_inst = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR, sh_cfg);
static const int True = true;
static const int False = false;
DRW_shgroup_instance_format(g_formats.instance_spot, {
- {"color", DRW_ATTRIB_FLOAT, 3},
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16}
+ {"color", DRW_ATTR_FLOAT, 3},
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_spot);
DRW_shgroup_uniform_bool(grp, "drawFront", &False, 1);
DRW_shgroup_uniform_bool(grp, "drawBack", &False, 1);
DRW_shgroup_uniform_bool(grp, "drawSilhouette", &True, 1);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
DRWShadingGroup *shgroup_instance_bone_axes(DRWPass *pass)
{
- if (g_shaders.bone_axes == NULL) {
- g_shaders.bone_axes = DRW_shader_create(
- datatoc_armature_axes_vert_glsl, NULL,
- datatoc_gpu_shader_flat_color_frag_glsl, NULL);
+ COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
+ if (sh_data->bone_axes == NULL) {
+ sh_data->bone_axes = DRW_shader_create(
+ datatoc_armature_axes_vert_glsl, NULL,
+ datatoc_gpu_shader_flat_color_frag_glsl, NULL);
}
DRW_shgroup_instance_format(g_formats.instance_color, {
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16},
- {"color", DRW_ATTRIB_FLOAT, 4}
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
+ {"color", DRW_ATTR_FLOAT, 4},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.bone_axes,
+ sh_data->bone_axes,
pass, DRW_cache_bone_arrows_get(),
g_formats.instance_color);
DRW_shgroup_uniform_vec3(grp, "screenVecs[0]", DRW_viewport_screenvecs_get(), 2);
@@ -580,21 +625,22 @@ DRWShadingGroup *shgroup_instance_bone_axes(DRWPass *pass)
DRWShadingGroup *shgroup_instance_bone_envelope_outline(DRWPass *pass)
{
- if (g_shaders.bone_envelope_outline == NULL) {
- g_shaders.bone_envelope_outline = DRW_shader_create(
- datatoc_armature_envelope_outline_vert_glsl, NULL,
- datatoc_gpu_shader_flat_color_frag_glsl, NULL);
+ COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
+ if (sh_data->bone_envelope_outline == NULL) {
+ sh_data->bone_envelope_outline = DRW_shader_create(
+ datatoc_armature_envelope_outline_vert_glsl, NULL,
+ datatoc_gpu_shader_flat_color_frag_glsl, NULL);
}
DRW_shgroup_instance_format(g_formats.instance_bone_envelope_outline, {
- {"headSphere", DRW_ATTRIB_FLOAT, 4},
- {"tailSphere", DRW_ATTRIB_FLOAT, 4},
- {"outlineColorSize", DRW_ATTRIB_FLOAT, 4},
- {"xAxis", DRW_ATTRIB_FLOAT, 3}
+ {"headSphere", DRW_ATTR_FLOAT, 4},
+ {"tailSphere", DRW_ATTR_FLOAT, 4},
+ {"outlineColorSize", DRW_ATTR_FLOAT, 4},
+ {"xAxis", DRW_ATTR_FLOAT, 3},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.bone_envelope_outline,
+ sh_data->bone_envelope_outline,
pass, DRW_cache_bone_envelope_outline_get(),
g_formats.instance_bone_envelope_outline);
DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
@@ -604,20 +650,21 @@ DRWShadingGroup *shgroup_instance_bone_envelope_outline(DRWPass *pass)
DRWShadingGroup *shgroup_instance_bone_envelope_distance(DRWPass *pass)
{
- if (g_shaders.bone_envelope_distance == NULL) {
- g_shaders.bone_envelope_distance = DRW_shader_create(
- datatoc_armature_envelope_solid_vert_glsl, NULL,
- datatoc_armature_envelope_distance_frag_glsl, NULL);
+ COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
+ if (sh_data->bone_envelope_distance == NULL) {
+ sh_data->bone_envelope_distance = DRW_shader_create(
+ datatoc_armature_envelope_solid_vert_glsl, NULL,
+ datatoc_armature_envelope_distance_frag_glsl, NULL);
}
DRW_shgroup_instance_format(g_formats.instance_bone_envelope_distance, {
- {"headSphere", DRW_ATTRIB_FLOAT, 4},
- {"tailSphere", DRW_ATTRIB_FLOAT, 4},
- {"xAxis", DRW_ATTRIB_FLOAT, 3}
+ {"headSphere", DRW_ATTR_FLOAT, 4},
+ {"tailSphere", DRW_ATTR_FLOAT, 4},
+ {"xAxis", DRW_ATTR_FLOAT, 3},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.bone_envelope_distance,
+ sh_data->bone_envelope_distance,
pass, DRW_cache_bone_envelope_solid_get(),
g_formats.instance_bone_envelope_distance);
@@ -626,22 +673,23 @@ DRWShadingGroup *shgroup_instance_bone_envelope_distance(DRWPass *pass)
DRWShadingGroup *shgroup_instance_bone_envelope_solid(DRWPass *pass, bool transp)
{
- if (g_shaders.bone_envelope == NULL) {
- g_shaders.bone_envelope = DRW_shader_create(
- datatoc_armature_envelope_solid_vert_glsl, NULL,
- datatoc_armature_envelope_solid_frag_glsl, "#define SMOOTH_ENVELOPE\n");
+ COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
+ if (sh_data->bone_envelope == NULL) {
+ sh_data->bone_envelope = DRW_shader_create(
+ datatoc_armature_envelope_solid_vert_glsl, NULL,
+ datatoc_armature_envelope_solid_frag_glsl, "#define SMOOTH_ENVELOPE\n");
}
DRW_shgroup_instance_format(g_formats.instance_bone_envelope, {
- {"headSphere", DRW_ATTRIB_FLOAT, 4},
- {"tailSphere", DRW_ATTRIB_FLOAT, 4},
- {"boneColor", DRW_ATTRIB_FLOAT, 3},
- {"stateColor", DRW_ATTRIB_FLOAT, 3},
- {"xAxis", DRW_ATTRIB_FLOAT, 3}
+ {"headSphere", DRW_ATTR_FLOAT, 4},
+ {"tailSphere", DRW_ATTR_FLOAT, 4},
+ {"boneColor", DRW_ATTR_FLOAT, 3},
+ {"stateColor", DRW_ATTR_FLOAT, 3},
+ {"xAxis", DRW_ATTR_FLOAT, 3},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.bone_envelope,
+ sh_data->bone_envelope,
pass, DRW_cache_bone_envelope_solid_get(),
g_formats.instance_bone_envelope);
DRW_shgroup_uniform_float_copy(grp, "alpha", transp ? 0.6f : 1.0f);
@@ -649,164 +697,202 @@ DRWShadingGroup *shgroup_instance_bone_envelope_solid(DRWPass *pass, bool transp
return grp;
}
-DRWShadingGroup *shgroup_instance_mball_handles(DRWPass *pass)
+DRWShadingGroup *shgroup_instance_mball_handles(DRWPass *pass, eGPUShaderConfig sh_cfg)
{
- if (g_shaders.mball_handles == NULL) {
- g_shaders.mball_handles = DRW_shader_create(
- datatoc_object_mball_handles_vert_glsl, NULL,
- datatoc_gpu_shader_flat_color_frag_glsl, NULL);
+ COMMON_Shaders *sh_data = &g_shaders[sh_cfg];
+ if (sh_data->mball_handles == NULL) {
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg];
+ sh_data->mball_handles = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_object_mball_handles_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_flat_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
DRW_shgroup_instance_format(g_formats.instance_mball_handles, {
- {"ScaleTranslationMatrix", DRW_ATTRIB_FLOAT, 12},
- {"radius", DRW_ATTRIB_FLOAT, 1},
- {"color", DRW_ATTRIB_FLOAT, 3}
+ {"ScaleTranslationMatrix", DRW_ATTR_FLOAT, 12},
+ {"radius", DRW_ATTR_FLOAT, 1},
+ {"color", DRW_ATTR_FLOAT, 3},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.mball_handles, pass,
+ sh_data->mball_handles, pass,
DRW_cache_screenspace_circle_get(),
g_formats.instance_mball_handles);
DRW_shgroup_uniform_vec3(grp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
/* Only works with batches with adjacency infos. */
-DRWShadingGroup *shgroup_instance_bone_shape_outline(DRWPass *pass, struct GPUBatch *geom)
+DRWShadingGroup *shgroup_instance_bone_shape_outline(
+ DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg)
{
- if (g_shaders.shape_outline == NULL) {
- g_shaders.shape_outline = DRW_shader_create(
- datatoc_armature_shape_outline_vert_glsl,
- datatoc_armature_shape_outline_geom_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl,
- NULL);
+ COMMON_Shaders *sh_data = &g_shaders[sh_cfg];
+ if (sh_data->shape_outline == NULL) {
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg];
+ sh_data->shape_outline = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_armature_shape_outline_vert_glsl, NULL},
+ .geom = (const char *[]){sh_cfg_data->lib, datatoc_armature_shape_outline_geom_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_flat_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
DRW_shgroup_instance_format(g_formats.instance_bone_outline, {
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16},
- {"outlineColorSize", DRW_ATTRIB_FLOAT, 4}
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
+ {"outlineColorSize", DRW_ATTR_FLOAT, 4},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.shape_outline,
+ sh_data->shape_outline,
pass, geom, g_formats.instance_bone_outline);
DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_instance_bone_shape_solid(DRWPass *pass, struct GPUBatch *geom, bool transp)
+DRWShadingGroup *shgroup_instance_bone_shape_solid(
+ DRWPass *pass, struct GPUBatch *geom, bool transp, eGPUShaderConfig sh_cfg)
{
- if (g_shaders.shape_solid == NULL) {
- g_shaders.shape_solid = DRW_shader_create(
- datatoc_armature_shape_solid_vert_glsl, NULL,
- datatoc_armature_shape_solid_frag_glsl, NULL);
+ COMMON_Shaders *sh_data = &g_shaders[sh_cfg];
+ if (sh_data->shape_solid == NULL) {
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg];
+ sh_data->shape_solid = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_armature_shape_solid_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_armature_shape_solid_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
DRW_shgroup_instance_format(g_formats.instance_bone, {
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16},
- {"boneColor", DRW_ATTRIB_FLOAT, 3},
- {"stateColor", DRW_ATTRIB_FLOAT, 3}
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
+ {"boneColor", DRW_ATTR_FLOAT, 3},
+ {"stateColor", DRW_ATTR_FLOAT, 3},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.shape_solid,
+ sh_data->shape_solid,
pass, geom, g_formats.instance_bone);
DRW_shgroup_uniform_float_copy(grp, "alpha", transp ? 0.6f : 1.0f);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_instance_bone_sphere_solid(DRWPass *pass, bool transp)
+DRWShadingGroup *shgroup_instance_bone_sphere_solid(DRWPass *pass, bool transp, eGPUShaderConfig sh_cfg)
{
- if (g_shaders.bone_sphere == NULL) {
- g_shaders.bone_sphere = DRW_shader_create(
- datatoc_armature_sphere_solid_vert_glsl, NULL,
- datatoc_armature_sphere_solid_frag_glsl, NULL);
+ COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
+ if (sh_data->bone_sphere == NULL) {
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg];
+ sh_data->bone_sphere = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_armature_sphere_solid_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_armature_sphere_solid_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
DRW_shgroup_instance_format(g_formats.instance_bone, {
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16},
- {"boneColor", DRW_ATTRIB_FLOAT, 3},
- {"stateColor", DRW_ATTRIB_FLOAT, 3}
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
+ {"boneColor", DRW_ATTR_FLOAT, 3},
+ {"stateColor", DRW_ATTR_FLOAT, 3},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.bone_sphere,
+ sh_data->bone_sphere,
pass, DRW_cache_bone_point_get(), g_formats.instance_bone);
/* More transparent than the shape to be less distractive. */
DRW_shgroup_uniform_float_copy(grp, "alpha", transp ? 0.4f : 1.0f);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_instance_bone_sphere_outline(DRWPass *pass)
+DRWShadingGroup *shgroup_instance_bone_sphere_outline(DRWPass *pass, eGPUShaderConfig sh_cfg)
{
- if (g_shaders.bone_sphere_outline == NULL) {
- g_shaders.bone_sphere_outline = DRW_shader_create(
- datatoc_armature_sphere_outline_vert_glsl, NULL,
- datatoc_gpu_shader_flat_color_frag_glsl, NULL);
+ COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
+ if (sh_data->bone_sphere_outline == NULL) {
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg];
+ sh_data->bone_sphere_outline = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_armature_sphere_outline_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_flat_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
DRW_shgroup_instance_format(g_formats.instance_bone_outline, {
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16},
- {"outlineColorSize", DRW_ATTRIB_FLOAT, 4}
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
+ {"outlineColorSize", DRW_ATTR_FLOAT, 4},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.bone_sphere_outline,
+ sh_data->bone_sphere_outline,
pass, DRW_cache_bone_point_wire_outline_get(),
g_formats.instance_bone_outline);
DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
-DRWShadingGroup *shgroup_instance_bone_stick(DRWPass *pass)
+DRWShadingGroup *shgroup_instance_bone_stick(DRWPass *pass, eGPUShaderConfig sh_cfg)
{
- if (g_shaders.bone_stick == NULL) {
- g_shaders.bone_stick = DRW_shader_create(
- datatoc_armature_stick_vert_glsl, NULL,
- datatoc_armature_stick_frag_glsl, NULL);
+ COMMON_Shaders *sh_data = &g_shaders[sh_cfg];
+ if (sh_data->bone_stick == NULL) {
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg];
+ sh_data->bone_stick = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_armature_stick_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_armature_stick_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
DRW_shgroup_instance_format(g_formats.instance_bone_stick, {
- {"boneStart", DRW_ATTRIB_FLOAT, 3},
- {"boneEnd", DRW_ATTRIB_FLOAT, 3},
- {"wireColor", DRW_ATTRIB_FLOAT, 4}, /* TODO port theses to uchar color */
- {"boneColor", DRW_ATTRIB_FLOAT, 4},
- {"headColor", DRW_ATTRIB_FLOAT, 4},
- {"tailColor", DRW_ATTRIB_FLOAT, 4}
+ {"boneStart", DRW_ATTR_FLOAT, 3},
+ {"boneEnd", DRW_ATTR_FLOAT, 3},
+ {"wireColor", DRW_ATTR_FLOAT, 4}, /* TODO port theses to uchar color */
+ {"boneColor", DRW_ATTR_FLOAT, 4},
+ {"headColor", DRW_ATTR_FLOAT, 4},
+ {"tailColor", DRW_ATTR_FLOAT, 4},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.bone_stick,
+ sh_data->bone_stick,
pass, DRW_cache_bone_stick_get(),
g_formats.instance_bone_stick);
DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
DRW_shgroup_uniform_float_copy(grp, "stickSize", 5.0f * U.pixelsize);
-
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
struct DRWShadingGroup *shgroup_instance_bone_dof(struct DRWPass *pass, struct GPUBatch *geom)
{
- if (g_shaders.bone_dofs == NULL) {
- g_shaders.bone_dofs = DRW_shader_create(
- datatoc_armature_dof_vert_glsl, NULL,
- datatoc_gpu_shader_flat_color_frag_glsl, NULL);
+ COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
+ if (sh_data->bone_dofs == NULL) {
+ sh_data->bone_dofs = DRW_shader_create(
+ datatoc_armature_dof_vert_glsl, NULL,
+ datatoc_gpu_shader_flat_color_frag_glsl, NULL);
}
DRW_shgroup_instance_format(g_formats.instance_bone_dof, {
- {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16},
- {"color", DRW_ATTRIB_FLOAT, 4},
- {"amin", DRW_ATTRIB_FLOAT, 2},
- {"amax", DRW_ATTRIB_FLOAT, 2},
+ {"InstanceModelMatrix", DRW_ATTR_FLOAT, 16},
+ {"color", DRW_ATTR_FLOAT, 4},
+ {"amin", DRW_ATTR_FLOAT, 2},
+ {"amax", DRW_ATTR_FLOAT, 2},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
- g_shaders.bone_dofs,
+ sh_data->bone_dofs,
pass, geom,
g_formats.instance_bone_dof);
@@ -815,48 +901,51 @@ struct DRWShadingGroup *shgroup_instance_bone_dof(struct DRWPass *pass, struct G
struct GPUShader *mpath_line_shader_get(void)
{
- if (g_shaders.mpath_line_sh == NULL) {
- g_shaders.mpath_line_sh = DRW_shader_create_with_lib(
+ COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
+ if (sh_data->mpath_line_sh == NULL) {
+ sh_data->mpath_line_sh = DRW_shader_create_with_lib(
datatoc_animviz_mpath_lines_vert_glsl,
datatoc_animviz_mpath_lines_geom_glsl,
datatoc_gpu_shader_3D_smooth_color_frag_glsl,
datatoc_common_globals_lib_glsl,
NULL);
}
- return g_shaders.mpath_line_sh;
+ return sh_data->mpath_line_sh;
}
struct GPUShader *mpath_points_shader_get(void)
{
- if (g_shaders.mpath_points_sh == NULL) {
- g_shaders.mpath_points_sh = DRW_shader_create_with_lib(
+ COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
+ if (sh_data->mpath_points_sh == NULL) {
+ sh_data->mpath_points_sh = DRW_shader_create_with_lib(
datatoc_animviz_mpath_points_vert_glsl,
NULL,
datatoc_gpu_shader_point_varying_color_frag_glsl,
datatoc_common_globals_lib_glsl,
NULL);
}
- return g_shaders.mpath_points_sh;
+ return sh_data->mpath_points_sh;
}
struct GPUShader *volume_velocity_shader_get(bool use_needle)
{
+ COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
if (use_needle) {
- if (g_shaders.volume_velocity_needle_sh == NULL) {
- g_shaders.volume_velocity_needle_sh = DRW_shader_create(
+ if (sh_data->volume_velocity_needle_sh == NULL) {
+ sh_data->volume_velocity_needle_sh = DRW_shader_create(
datatoc_volume_velocity_vert_glsl, NULL,
datatoc_gpu_shader_flat_color_frag_glsl, "#define USE_NEEDLE");
}
- return g_shaders.volume_velocity_needle_sh;
+ return sh_data->volume_velocity_needle_sh;
}
else {
- if (g_shaders.volume_velocity_sh == NULL) {
- g_shaders.volume_velocity_sh = DRW_shader_create(
+ if (sh_data->volume_velocity_sh == NULL) {
+ sh_data->volume_velocity_sh = DRW_shader_create(
datatoc_volume_velocity_vert_glsl, NULL,
datatoc_gpu_shader_flat_color_frag_glsl, NULL);
}
- return g_shaders.volume_velocity_sh;
+ return sh_data->volume_velocity_sh;
}
}
@@ -892,7 +981,7 @@ int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color
theme_id = (active) ? TH_ACTIVE : TH_SELECT;
}
else {
- if (ob->type == OB_LAMP) theme_id = TH_LAMP;
+ if (ob->type == OB_LAMP) theme_id = TH_LIGHT;
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;
@@ -902,16 +991,29 @@ int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color
}
if (r_color != NULL) {
- switch (theme_id) {
- case TH_WIRE_EDIT: *r_color = ts.colorWireEdit; break;
- case TH_ACTIVE: *r_color = ts.colorActive; break;
- case TH_SELECT: *r_color = ts.colorSelect; break;
- case TH_TRANSFORM: *r_color = ts.colorTransform; break;
- case TH_SPEAKER: *r_color = ts.colorSpeaker; break;
- case TH_CAMERA: *r_color = ts.colorCamera; break;
- case TH_EMPTY: *r_color = ts.colorEmpty; break;
- case TH_LAMP: *r_color = ts.colorLamp; break;
- default: *r_color = ts.colorWire; break;
+ if (UNLIKELY(ob->base_flag & BASE_FROM_SET)) {
+ *r_color = G_draw.block.colorDupli;
+ }
+ else if (UNLIKELY(ob->base_flag & BASE_FROM_DUPLI)) {
+ switch (theme_id) {
+ case TH_ACTIVE:
+ case TH_SELECT: *r_color = G_draw.block.colorDupliSelect; break;
+ case TH_TRANSFORM: *r_color = G_draw.block.colorTransform; break;
+ default: *r_color = G_draw.block.colorDupli; break;
+ }
+ }
+ else {
+ switch (theme_id) {
+ case TH_WIRE_EDIT: *r_color = G_draw.block.colorWireEdit; break;
+ case TH_ACTIVE: *r_color = G_draw.block.colorActive; break;
+ case TH_SELECT: *r_color = G_draw.block.colorSelect; break;
+ case TH_TRANSFORM: *r_color = G_draw.block.colorTransform; break;
+ case TH_SPEAKER: *r_color = G_draw.block.colorSpeaker; break;
+ case TH_CAMERA: *r_color = G_draw.block.colorCamera; break;
+ case TH_EMPTY: *r_color = G_draw.block.colorEmpty; break;
+ case TH_LIGHT: *r_color = G_draw.block.colorLight; break;
+ default: *r_color = G_draw.block.colorWire; break;
+ }
}
}
@@ -932,7 +1034,7 @@ float *DRW_color_background_blend_get(int theme_id)
case TH_SPEAKER: ret = colors[6]; break;
case TH_CAMERA: ret = colors[7]; break;
case TH_EMPTY: ret = colors[8]; break;
- case TH_LAMP: ret = colors[9]; break;
+ case TH_LIGHT: ret = colors[9]; break;
default: ret = colors[10]; break;
}
diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h
index e0c1a3c0c66..72416ed0889 100644
--- a/source/blender/draw/intern/draw_common.h
+++ b/source/blender/draw/intern/draw_common.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file draw_common.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRAW_COMMON_H__
@@ -30,11 +27,11 @@ struct DRWPass;
struct DRWShadingGroup;
struct GPUBatch;
struct GPUMaterial;
-struct Object;
-struct ViewLayer;
struct ModifierData;
-struct ParticleSystem;
+struct Object;
struct PTCacheEdit;
+struct ParticleSystem;
+struct ViewLayer;
#define UBO_FIRST_COLOR colorWire
#define UBO_LAST_COLOR colorGridAxisZ
@@ -48,10 +45,12 @@ typedef struct GlobalsUboStorage {
float colorWireEdit[4];
float colorActive[4];
float colorSelect[4];
- float colorTransform[4];
+ float colorDupliSelect[4];
+ float colorDupli[4];
float colorLibrarySelect[4];
float colorLibrary[4];
- float colorLamp[4];
+ float colorTransform[4];
+ float colorLight[4];
float colorSpeaker[4];
float colorCamera[4];
float colorEmpty[4];
@@ -77,7 +76,7 @@ typedef struct GlobalsUboStorage {
float colorDeselect[4];
float colorOutline[4];
- float colorLampNoAlpha[4];
+ float colorLightNoAlpha[4];
float colorBackground[4];
float colorEditMeshMiddle[4];
@@ -111,7 +110,7 @@ typedef struct GlobalsUboStorage {
/* NOTE! Put all color before UBO_LAST_COLOR */
/* Pack individual float at the end of the buffer to avoid alignment errors */
- float sizeLampCenter, sizeLampCircle, sizeLampCircleShadow;
+ float sizeLightCenter, sizeLightCircle, sizeLightCircleShadow;
float sizeVertex, sizeEdge, sizeEdgeFix, sizeFaceDot;
float gridDistance, gridResolution, gridSubdivisions, gridScale;
@@ -123,33 +122,35 @@ BLI_STATIC_ASSERT_ALIGN(GlobalsUboStorage, 16)
void DRW_globals_update(void);
void DRW_globals_free(void);
-struct DRWShadingGroup *shgroup_dynlines_flat_color(struct DRWPass *pass);
-struct DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(struct DRWPass *pass, float color[4]);
-struct DRWShadingGroup *shgroup_dynpoints_uniform_color(struct DRWPass *pass, float color[4], float *size);
-struct DRWShadingGroup *shgroup_groundlines_uniform_color(struct DRWPass *pass, float color[4]);
-struct DRWShadingGroup *shgroup_groundpoints_uniform_color(struct DRWPass *pass, float color[4]);
-struct DRWShadingGroup *shgroup_instance_screenspace(struct DRWPass *pass, struct GPUBatch *geom, float *size);
+void DRW_shgroup_world_clip_planes_from_rv3d(struct DRWShadingGroup *shgrp, const RegionView3D *rv3d);
+
+struct DRWShadingGroup *shgroup_dynlines_flat_color(struct DRWPass *pass, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(struct DRWPass *pass, const float color[4]);
+struct DRWShadingGroup *shgroup_dynpoints_uniform_color(struct DRWPass *pass, const float color[4], const float *size, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_groundlines_uniform_color(struct DRWPass *pass, const float color[4], eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_groundpoints_uniform_color(struct DRWPass *pass, const float color[4], eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_instance_screenspace(struct DRWPass *pass, struct GPUBatch *geom, const float *size, eGPUShaderConfig sh_cfg);
struct DRWShadingGroup *shgroup_instance_solid(struct DRWPass *pass, struct GPUBatch *geom);
struct DRWShadingGroup *shgroup_instance_wire(struct DRWPass *pass, struct GPUBatch *geom);
-struct DRWShadingGroup *shgroup_instance_screen_aligned(struct DRWPass *pass, struct GPUBatch *geom);
-struct DRWShadingGroup *shgroup_instance_empty_axes(struct DRWPass *pass, struct GPUBatch *geom);
-struct DRWShadingGroup *shgroup_instance_scaled(struct DRWPass *pass, struct GPUBatch *geom);
-struct DRWShadingGroup *shgroup_instance(struct DRWPass *pass, struct GPUBatch *geom);
-struct DRWShadingGroup *shgroup_instance_alpha(struct DRWPass *pass, struct GPUBatch *geom, float alpha);
+struct DRWShadingGroup *shgroup_instance_screen_aligned(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_instance_empty_axes(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_instance_scaled(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_instance_alpha(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg);
struct DRWShadingGroup *shgroup_instance_outline(struct DRWPass *pass, struct GPUBatch *geom, int *baseid);
-struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct GPUBatch *geom);
-struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct GPUBatch *geom);
-struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct GPUBatch *geom);
-struct DRWShadingGroup *shgroup_instance_mball_handles(struct DRWPass *pass);
+struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_instance_mball_handles(struct DRWPass *pass, eGPUShaderConfig sh_cfg);
struct DRWShadingGroup *shgroup_instance_bone_axes(struct DRWPass *pass);
struct DRWShadingGroup *shgroup_instance_bone_envelope_distance(struct DRWPass *pass);
struct DRWShadingGroup *shgroup_instance_bone_envelope_outline(struct DRWPass *pass);
struct DRWShadingGroup *shgroup_instance_bone_envelope_solid(struct DRWPass *pass, bool transp);
-struct DRWShadingGroup *shgroup_instance_bone_shape_outline(struct DRWPass *pass, struct GPUBatch *geom);
-struct DRWShadingGroup *shgroup_instance_bone_shape_solid(struct DRWPass *pass, struct GPUBatch *geom, bool transp);
-struct DRWShadingGroup *shgroup_instance_bone_sphere_outline(struct DRWPass *pass);
-struct DRWShadingGroup *shgroup_instance_bone_sphere_solid(struct DRWPass *pass, bool transp);
-struct DRWShadingGroup *shgroup_instance_bone_stick(struct DRWPass *pass);
+struct DRWShadingGroup *shgroup_instance_bone_shape_outline(struct DRWPass *pass, struct GPUBatch *geom, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_instance_bone_shape_solid(struct DRWPass *pass, struct GPUBatch *geom, bool transp, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_instance_bone_sphere_outline(struct DRWPass *pass, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_instance_bone_sphere_solid(struct DRWPass *pass, bool transp, eGPUShaderConfig sh_cfg);
+struct DRWShadingGroup *shgroup_instance_bone_stick(struct DRWPass *pass, eGPUShaderConfig sh_cfg);
struct DRWShadingGroup *shgroup_instance_bone_dof(struct DRWPass *pass, struct GPUBatch *geom);
struct GPUShader *mpath_line_shader_get(void);
@@ -174,7 +175,7 @@ typedef struct DRWArmaturePasses {
struct DRWPass *relationship_lines;
} DRWArmaturePasses;
-void DRW_shgroup_armature_object(struct Object *ob, struct ViewLayer *view_layer, struct DRWArmaturePasses passes);
+void DRW_shgroup_armature_object(struct Object *ob, struct ViewLayer *view_layer, struct DRWArmaturePasses passes, bool transp);
void DRW_shgroup_armature_pose(struct Object *ob, struct DRWArmaturePasses passes, bool transp);
void DRW_shgroup_armature_edit(struct Object *ob, struct DRWArmaturePasses passes, bool transp);
@@ -200,4 +201,20 @@ void DRW_hair_free(void);
bool DRW_pose_mode_armature(
struct Object *ob, struct Object *active_ob);
+/* draw_common.c */
+struct DRW_Global {
+ /** If needed, contains all global/Theme colors
+ * Add needed theme colors / values to DRW_globals_update() and update UBO
+ * Not needed for constant color. */
+ GlobalsUboStorage block;
+ /** Define "globalsBlock" uniform for 'block'. */
+ struct GPUUniformBuffer *block_ubo;
+
+ struct GPUTexture *ramp;
+ struct GPUTexture *weight_ramp;
+
+ struct GPUUniformBuffer *view_ubo;
+};
+extern struct DRW_Global G_draw;
+
#endif /* __DRAW_COMMON_H__ */
diff --git a/source/blender/draw/intern/draw_debug.c b/source/blender/draw/intern/draw_debug.c
index 366da92cf50..8c810f1a792 100644
--- a/source/blender/draw/intern/draw_debug.c
+++ b/source/blender/draw/intern/draw_debug.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2018, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2018, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_debug.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*
* \brief Simple API to draw debug shapes in the viewport.
*/
@@ -211,7 +208,6 @@ static void drw_debug_draw_spheres(void)
GPUBatch *draw_batch = GPU_batch_create(GPU_PRIM_LINES, empty_sphere->verts[0], NULL);
GPU_batch_instbuf_set(draw_batch, inst_vbo, true);
GPU_batch_program_set_builtin(draw_batch, GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE);
- GPU_batch_uniform_1f(draw_batch, "alpha", 1.0f);
GPU_batch_draw(draw_batch);
GPU_batch_discard(draw_batch);
diff --git a/source/blender/draw/intern/draw_debug.h b/source/blender/draw/intern/draw_debug.h
index 319d2674279..e7404b17384 100644
--- a/source/blender/draw/intern/draw_debug.h
+++ b/source/blender/draw/intern/draw_debug.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2018, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2018, Blender Foundation.
*/
-/** \file draw_debug.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRAW_DEBUG_H__
diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c
index f6891563dbb..09d0fa06f22 100644
--- a/source/blender/draw/intern/draw_hair.c
+++ b/source/blender/draw/intern/draw_hair.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,12 @@
*
* The Original Code is Copyright (C) 2017 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Mike Erwin, Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file draw_hair.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*
- * \brief Contains procedural GPU hair drawing methods.
+ * \brief Contains procedural GPU hair drawing methods.
*/
#include "DRW_render.h"
@@ -34,34 +28,47 @@
#include "BLI_utildefines.h"
#include "BLI_string_utils.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_particle_types.h"
#include "DNA_customdata_types.h"
#include "BKE_anim.h"
-#include "BKE_mesh.h"
-#include "BKE_particle.h"
-#include "BKE_pointcache.h"
-#include "ED_particle.h"
#include "GPU_batch.h"
#include "GPU_shader.h"
#include "draw_hair_private.h"
+#ifndef __APPLE__
+# define USE_TRANSFORM_FEEDBACK
+#endif
+
typedef enum ParticleRefineShader {
PART_REFINE_CATMULL_ROM = 0,
PART_REFINE_MAX_SHADER,
} ParticleRefineShader;
+#ifndef USE_TRANSFORM_FEEDBACK
+typedef struct ParticleRefineCall {
+ struct ParticleRefineCall *next;
+ GPUVertBuf *vbo;
+ DRWShadingGroup *shgrp;
+ uint vert_len;
+} ParticleRefineCall;
+
+static ParticleRefineCall *g_tf_calls = NULL;
+static int g_tf_id_offset;
+static int g_tf_target_width;
+static int g_tf_target_height;
+#endif
+
static GPUShader *g_refine_shaders[PART_REFINE_MAX_SHADER] = {NULL};
static DRWPass *g_tf_pass; /* XXX can be a problem with multiple DRWManager in the future */
extern char datatoc_common_hair_lib_glsl[];
extern char datatoc_common_hair_refine_vert_glsl[];
+extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
static GPUShader *hair_refine_shader_get(ParticleRefineShader sh)
{
@@ -71,10 +78,17 @@ static GPUShader *hair_refine_shader_get(ParticleRefineShader sh)
char *vert_with_lib = BLI_string_joinN(datatoc_common_hair_lib_glsl, datatoc_common_hair_refine_vert_glsl);
- const char *var_names[1] = {"outData"};
-
+#ifdef USE_TRANSFORM_FEEDBACK
+ const char *var_names[1] = {"finalColor"};
g_refine_shaders[sh] = DRW_shader_create_with_transform_feedback(vert_with_lib, NULL, "#define HAIR_PHASE_SUBDIV\n",
GPU_SHADER_TFB_POINTS, var_names, 1);
+#else
+ g_refine_shaders[sh] = DRW_shader_create(
+ vert_with_lib, NULL,
+ datatoc_gpu_shader_3D_smooth_color_frag_glsl,
+ "#define HAIR_PHASE_SUBDIV\n"
+ "#define TF_WORKAROUND\n");
+#endif
MEM_freeN(vert_with_lib);
@@ -83,7 +97,11 @@ static GPUShader *hair_refine_shader_get(ParticleRefineShader sh)
void DRW_hair_init(void)
{
+#ifdef USE_TRANSFORM_FEEDBACK
g_tf_pass = DRW_pass_create("Update Hair Pass", DRW_STATE_TRANS_FEEDBACK);
+#else
+ g_tf_pass = DRW_pass_create("Update Hair Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_POINT);
+#endif
}
typedef struct DRWHairInstanceData {
@@ -141,7 +159,7 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(
}
}
- if (dupli_parent) {
+ if ((dupli_parent != NULL) && (dupli_object != NULL)) {
DRWHairInstanceData *hair_inst_data = (DRWHairInstanceData *)DRW_drawdata_ensure(
&object->id, (DrawEngineType *)&drw_shgroup_create_hair_procedural_ex,
sizeof(DRWHairInstanceData), NULL, NULL);
@@ -174,8 +192,24 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(
if (need_ft_update) {
int final_points_len = hair_cache->final[subdiv].strands_res * hair_cache->strands_len;
GPUShader *tf_shader = hair_refine_shader_get(PART_REFINE_CATMULL_ROM);
+
+#ifdef USE_TRANSFORM_FEEDBACK
DRWShadingGroup *tf_shgrp = DRW_shgroup_transform_feedback_create(tf_shader, g_tf_pass,
hair_cache->final[subdiv].proc_buf);
+#else
+ DRWShadingGroup *tf_shgrp = DRW_shgroup_create(tf_shader, g_tf_pass);
+
+ ParticleRefineCall *pr_call = MEM_mallocN(sizeof(*pr_call), __func__);
+ pr_call->next = g_tf_calls;
+ pr_call->vbo = hair_cache->final[subdiv].proc_buf;
+ pr_call->shgrp = tf_shgrp;
+ pr_call->vert_len = final_points_len;
+ g_tf_calls = pr_call;
+ DRW_shgroup_uniform_int(tf_shgrp, "targetHeight", &g_tf_target_height, 1);
+ DRW_shgroup_uniform_int(tf_shgrp, "targetWidth", &g_tf_target_width, 1);
+ DRW_shgroup_uniform_int(tf_shgrp, "idOffset", &g_tf_id_offset, 1);
+#endif
+
DRW_shgroup_uniform_texture(tf_shgrp, "hairPointBuffer", hair_cache->point_tex);
DRW_shgroup_uniform_texture(tf_shgrp, "hairStrandBuffer", hair_cache->strand_tex);
DRW_shgroup_uniform_int(tf_shgrp, "hairStrandsRes", &hair_cache->final[subdiv].strands_res, 1);
@@ -203,7 +237,77 @@ DRWShadingGroup *DRW_shgroup_material_hair_create(
void DRW_hair_update(void)
{
+#ifndef USE_TRANSFORM_FEEDBACK
+ /**
+ * Workaround to tranform feedback not working on mac.
+ * On some system it crashes (see T58489) and on some other it renders garbage (see T60171).
+ *
+ * So instead of using transform feedback we render to a texture,
+ * readback the result to system memory and reupload as VBO data.
+ * It is really not ideal performance wise, but it is the simplest
+ * and the most local workaround that still uses the power of the GPU.
+ **/
+
+ if (g_tf_calls == NULL) {
+ return;
+ }
+
+ /* Search ideal buffer size. */
+ uint max_size = 0;
+ for (ParticleRefineCall *pr_call = g_tf_calls; pr_call; pr_call = pr_call->next) {
+ max_size = max_ii(max_size, pr_call->vert_len);
+ }
+
+ /* Create target Texture / Framebuffer */
+ /* Don't use max size as it can be really heavy and fail.
+ * Do chunks of maximum 2048 * 2048 hair points. */
+ int width = 2048;
+ int height = min_ii(width, 1 + max_size / width);
+ GPUTexture *tex = DRW_texture_pool_query_2D(width, height, GPU_RGBA32F, (void *)DRW_hair_update);
+ g_tf_target_height = height;
+ g_tf_target_width = width;
+
+ GPUFrameBuffer *fb = NULL;
+ GPU_framebuffer_ensure_config(&fb, {
+ GPU_ATTACHMENT_NONE,
+ GPU_ATTACHMENT_TEXTURE(tex),
+ });
+
+ float *data = MEM_mallocN(sizeof(float) * 4 * width * height, "tf fallback buffer");
+
+ GPU_framebuffer_bind(fb);
+ while (g_tf_calls != NULL) {
+ ParticleRefineCall *pr_call = g_tf_calls;
+ g_tf_calls = g_tf_calls->next;
+
+ g_tf_id_offset = 0;
+ while (pr_call->vert_len > 0) {
+ int max_read_px_len = min_ii(width * height, pr_call->vert_len);
+
+ DRW_draw_pass_subset(g_tf_pass, pr_call->shgrp, pr_call->shgrp);
+ /* Readback result to main memory. */
+ GPU_framebuffer_read_color(fb, 0, 0, width, height, 4, 0, data);
+ /* Upload back to VBO. */
+ GPU_vertbuf_use(pr_call->vbo);
+ glBufferSubData(GL_ARRAY_BUFFER,
+ sizeof(float) * 4 * g_tf_id_offset,
+ sizeof(float) * 4 * max_read_px_len,
+ data);
+
+ g_tf_id_offset += max_read_px_len;
+ pr_call->vert_len -= max_read_px_len;
+ }
+
+ MEM_freeN(pr_call);
+ }
+
+ MEM_freeN(data);
+ GPU_framebuffer_free(fb);
+#else
+ /* TODO(fclem): replace by compute shader. */
+ /* Just render using transform feedback. */
DRW_draw_pass(g_tf_pass);
+#endif
}
void DRW_hair_free(void)
diff --git a/source/blender/draw/intern/draw_hair_private.h b/source/blender/draw/intern/draw_hair_private.h
index 41f91e02459..c77f236e066 100644
--- a/source/blender/draw/intern/draw_hair_private.h
+++ b/source/blender/draw/intern/draw_hair_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2017 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Mike Erwin, Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file draw_hair_private.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRAW_HAIR_PRIVATE_H__
@@ -35,10 +29,10 @@
#define MAX_THICKRES 2 /* see eHairType */
#define MAX_HAIR_SUBDIV 4 /* see hair_subdiv rna */
-struct Object;
-struct ParticleSystem;
struct ModifierData;
+struct Object;
struct ParticleHairCache;
+struct ParticleSystem;
typedef struct ParticleHairFinalCache {
/* Output of the subdivision stage: vertex buff sized to subdiv level. */
diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c
index dca112c85c6..119ac7c2609 100644
--- a/source/blender/draw/intern/draw_instance_data.c
+++ b/source/blender/draw/intern/draw_instance_data.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_instance_data.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
/**
@@ -87,7 +84,6 @@ struct DRWInstanceDataList {
static ListBase g_idatalists = {NULL, NULL};
/* -------------------------------------------------------------------- */
-
/** \name Instance Buffer Management
* \{ */
@@ -147,8 +143,9 @@ void DRW_batching_buffer_request(
}
int new_id = 0; /* Find insertion point. */
for (; new_id < chunk->alloc_size; ++new_id) {
- if (chunk->bbufs[new_id].format == NULL)
+ if (chunk->bbufs[new_id].format == NULL) {
break;
+ }
}
/* If there is no batch left. Allocate more. */
if (new_id == chunk->alloc_size) {
@@ -188,8 +185,9 @@ void DRW_instancing_buffer_request(
}
int new_id = 0; /* Find insertion point. */
for (; new_id < chunk->alloc_size; ++new_id) {
- if (chunk->ibufs[new_id].format == NULL)
+ if (chunk->ibufs[new_id].format == NULL) {
break;
+ }
}
/* If there is no batch left. Allocate more. */
if (new_id == chunk->alloc_size) {
@@ -283,28 +281,27 @@ void DRW_instance_buffer_finish(DRWInstanceDataList *idatalist)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Instance Data (DRWInstanceData)
* \{ */
-static DRWInstanceData *drw_instance_data_create(DRWInstanceDataList *idatalist, uint attrib_size)
+static DRWInstanceData *drw_instance_data_create(DRWInstanceDataList *idatalist, uint attr_size)
{
DRWInstanceData *idata = MEM_callocN(sizeof(DRWInstanceData), "DRWInstanceData");
idata->next = NULL;
idata->used = true;
- idata->data_size = attrib_size;
+ idata->data_size = attr_size;
idata->mempool = BLI_mempool_create(sizeof(float) * idata->data_size, 0, 16, 0);
- BLI_assert(attrib_size > 0);
+ BLI_assert(attr_size > 0);
/* Push to linked list. */
- if (idatalist->idata_head[attrib_size - 1] == NULL) {
- idatalist->idata_head[attrib_size - 1] = idata;
+ if (idatalist->idata_head[attr_size - 1] == NULL) {
+ idatalist->idata_head[attr_size - 1] = idata;
}
else {
- idatalist->idata_tail[attrib_size - 1]->next = idata;
+ idatalist->idata_tail[attr_size - 1]->next = idata;
}
- idatalist->idata_tail[attrib_size - 1] = idata;
+ idatalist->idata_tail[attr_size - 1] = idata;
return idata;
}
@@ -322,11 +319,11 @@ void *DRW_instance_data_next(DRWInstanceData *idata)
return BLI_mempool_alloc(idata->mempool);
}
-DRWInstanceData *DRW_instance_data_request(DRWInstanceDataList *idatalist, uint attrib_size)
+DRWInstanceData *DRW_instance_data_request(DRWInstanceDataList *idatalist, uint attr_size)
{
- BLI_assert(attrib_size > 0 && attrib_size <= MAX_INSTANCE_DATA_SIZE);
+ BLI_assert(attr_size > 0 && attr_size <= MAX_INSTANCE_DATA_SIZE);
- DRWInstanceData *idata = idatalist->idata_head[attrib_size - 1];
+ DRWInstanceData *idata = idatalist->idata_head[attr_size - 1];
/* Search for an unused data chunk. */
for (; idata; idata = idata->next) {
@@ -336,13 +333,12 @@ DRWInstanceData *DRW_instance_data_request(DRWInstanceDataList *idatalist, uint
}
}
- return drw_instance_data_create(idatalist, attrib_size);
+ return drw_instance_data_create(idatalist, attr_size);
}
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Instance Data List (DRWInstanceDataList)
* \{ */
diff --git a/source/blender/draw/intern/draw_instance_data.h b/source/blender/draw/intern/draw_instance_data.h
index 174f03e3bc7..b6f3988dcef 100644
--- a/source/blender/draw/intern/draw_instance_data.h
+++ b/source/blender/draw/intern/draw_instance_data.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file draw_instance_data.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRAW_INSTANCE_DATA_H__
@@ -40,7 +37,7 @@ struct DRWShadingGroup;
void *DRW_instance_data_next(DRWInstanceData *idata);
DRWInstanceData *DRW_instance_data_request(
- DRWInstanceDataList *idatalist, uint attrib_size);
+ DRWInstanceDataList *idatalist, uint attr_size);
void DRW_batching_buffer_request(
DRWInstanceDataList *idatalist, GPUVertFormat *format, GPUPrimType type, struct DRWShadingGroup *shgroup,
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 830b6e90e72..e5307fa952f 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_manager.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include <stdio.h>
@@ -34,12 +31,15 @@
#include "BLF_api.h"
#include "BKE_colortools.h"
+#include "BKE_curve.h"
#include "BKE_global.h"
+#include "BKE_gpencil.h"
+#include "BKE_lattice.h"
+#include "BKE_mball.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
-#include "BKE_workspace.h"
#include "draw_manager.h"
#include "DNA_camera_types.h"
@@ -50,7 +50,6 @@
#include "ED_space_api.h"
#include "ED_screen.h"
#include "ED_gpencil.h"
-#include "ED_particle.h"
#include "ED_view3d.h"
#include "GPU_draw.h"
@@ -66,7 +65,6 @@
#include "RE_engine.h"
#include "RE_pipeline.h"
-#include "UI_interface.h"
#include "UI_resources.h"
#include "WM_api.h"
@@ -99,11 +97,20 @@ DRWManager DST = {NULL};
static ListBase DRW_engines = {NULL, NULL};
-extern struct GPUUniformBuffer *view_ubo; /* draw_manager_exec.c */
-
static void drw_state_prepare_clean_for_draw(DRWManager *dst)
{
memset(dst, 0x0, offsetof(DRWManager, gl_context));
+
+ /* Maybe not the best place for this. */
+ if (!DST.uniform_names.buffer) {
+ DST.uniform_names.buffer = MEM_callocN(DRW_UNIFORM_BUFFER_NAME, "Name Buffer");
+ DST.uniform_names.buffer_len = DRW_UNIFORM_BUFFER_NAME;
+ }
+ else if (DST.uniform_names.buffer_len > DRW_UNIFORM_BUFFER_NAME) {
+ DST.uniform_names.buffer = MEM_reallocN(DST.uniform_names.buffer, DRW_UNIFORM_BUFFER_NAME);
+ DST.uniform_names.buffer_len = DRW_UNIFORM_BUFFER_NAME;
+ }
+ DST.uniform_names.buffer_ofs = 0;
}
/* This function is used to reset draw manager to a state
@@ -146,7 +153,6 @@ struct DRWTextStore *DRW_text_cache_ensure(void)
/* -------------------------------------------------------------------- */
-
/** \name Settings
* \{ */
@@ -198,9 +204,8 @@ bool DRW_object_use_hide_faces(const struct Object *ob)
switch (ob->mode) {
case OB_MODE_TEXTURE_PAINT:
- case OB_MODE_VERTEX_PAINT:
return (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
-
+ case OB_MODE_VERTEX_PAINT:
case OB_MODE_WEIGHT_PAINT:
return (me->editflag & (ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL)) != 0;
}
@@ -250,12 +255,11 @@ struct DupliObject *DRW_object_get_dupli(const Object *UNUSED(ob))
/* -------------------------------------------------------------------- */
-
/** \name Color Management
* \{ */
/* Use color management profile to draw texture to framebuffer */
-void DRW_transform_to_display(GPUTexture *tex, bool use_view_settings)
+void DRW_transform_to_display(GPUTexture *tex, bool use_view_transform, bool use_render_settings)
{
drw_state_set(DRW_STATE_WRITE_COLOR);
@@ -271,19 +275,26 @@ void DRW_transform_to_display(GPUTexture *tex, bool use_view_settings)
if (!(DST.options.is_image_render && !DST.options.is_scene_render)) {
Scene *scene = DST.draw_ctx.scene;
ColorManagedDisplaySettings *display_settings = &scene->display_settings;
- ColorManagedViewSettings *active_view_settings;
- ColorManagedViewSettings default_view_settings;
- if (use_view_settings) {
- active_view_settings = &scene->view_settings;
+ ColorManagedViewSettings view_settings;
+ if (use_render_settings) {
+ /* Use full render settings, for renders with scene lighting. */
+ view_settings = scene->view_settings;
+ }
+ else if (use_view_transform) {
+ /* Use only view transform + look and nothing else for lookdev without
+ * scene lighting, as exposure depends on scene light intensity. */
+ BKE_color_managed_view_settings_init_render(&view_settings, display_settings, NULL);
+ STRNCPY(view_settings.view_transform, scene->view_settings.view_transform);
+ STRNCPY(view_settings.look, scene->view_settings.look);
}
else {
- BKE_color_managed_view_settings_init_render(
- &default_view_settings,
- display_settings);
- active_view_settings = &default_view_settings;
+ /* For workbench use only default view transform in configuration,
+ * using no scene settings. */
+ BKE_color_managed_view_settings_init_render(&view_settings, display_settings, NULL);
}
+
use_ocio = IMB_colormanagement_setup_glsl_draw_from_space(
- active_view_settings, display_settings, NULL, dither, false);
+ &view_settings, display_settings, NULL, dither, false);
}
if (!use_ocio) {
@@ -353,7 +364,6 @@ void DRW_transform_none(GPUTexture *tex)
/* -------------------------------------------------------------------- */
-
/** \name Multisample Resolve
* \{ */
@@ -425,7 +435,6 @@ void DRW_multisamples_resolve(GPUTexture *src_depth, GPUTexture *src_color, bool
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Viewport (DRW_viewport)
* \{ */
@@ -531,6 +540,11 @@ static void drw_context_state_init(void)
else {
DST.draw_ctx.object_pose = NULL;
}
+
+ DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_DEFAULT;
+ if (DST.draw_ctx.rv3d && DST.draw_ctx.rv3d->rflag & RV3D_CLIPPING) {
+ DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_CLIPPED;
+ }
}
/* It also stores viewport variable to an immutable place: DST
@@ -632,8 +646,8 @@ static void drw_viewport_var_init(void)
DST.RST.bound_ubo_slots = MEM_callocN(sizeof(char) * GPU_max_ubo_binds(), "Bound Ubo Slots");
}
- if (view_ubo == NULL) {
- view_ubo = DRW_uniformbuffer_create(sizeof(ViewUboStorage), NULL);
+ if (G_draw.view_ubo == NULL) {
+ G_draw.view_ubo = DRW_uniformbuffer_create(sizeof(ViewUboStorage), NULL);
}
DST.override_mat = 0;
@@ -790,7 +804,6 @@ void **DRW_view_layer_engine_data_ensure(DrawEngineType *engine_type, void (*cal
/* -------------------------------------------------------------------- */
-
/** \name Draw Data (DRW_drawdata)
* \{ */
@@ -824,8 +837,9 @@ static bool id_type_can_have_drawdata(const short id_type)
static bool id_can_have_drawdata(const ID *id)
{
/* sanity check */
- if (id == NULL)
+ if (id == NULL) {
return false;
+ }
return id_type_can_have_drawdata(GS(id->name));
}
@@ -843,16 +857,18 @@ DrawDataList *DRW_drawdatalist_from_id(ID *id)
IdDdtTemplate *idt = (IdDdtTemplate *)id;
return &idt->drawdata;
}
- else
+ else {
return NULL;
+ }
}
DrawData *DRW_drawdata_get(ID *id, DrawEngineType *engine_type)
{
DrawDataList *drawdata = DRW_drawdatalist_from_id(id);
- if (drawdata == NULL)
+ if (drawdata == NULL) {
return NULL;
+ }
LISTBASE_FOREACH(DrawData *, dd, drawdata) {
if (dd->engine_type == engine_type) {
@@ -880,7 +896,7 @@ DrawData *DRW_drawdata_ensure(
DrawDataList *drawdata = DRW_drawdatalist_from_id(id);
/* Allocate new data. */
- if ((GS(id->name) == ID_OB) && (((Object *)id)->base_flag & BASE_FROMDUPLI) != 0) {
+ if ((GS(id->name) == ID_OB) && (((Object *)id)->base_flag & BASE_FROM_DUPLI) != 0) {
/* NOTE: data is not persistent in this case. It is reset each redraw. */
BLI_assert(free_cb == NULL); /* No callback allowed. */
/* Round to sizeof(float) for DRW_instance_data_request(). */
@@ -912,8 +928,9 @@ void DRW_drawdata_free(ID *id)
{
DrawDataList *drawdata = DRW_drawdatalist_from_id(id);
- if (drawdata == NULL)
+ if (drawdata == NULL) {
return;
+ }
LISTBASE_FOREACH(DrawData *, dd, drawdata) {
if (dd->free != NULL) {
@@ -927,11 +944,12 @@ void DRW_drawdata_free(ID *id)
/* Unlink (but don't free) the drawdata from the DrawDataList if the ID is an OB from dupli. */
static void drw_drawdata_unlink_dupli(ID *id)
{
- if ((GS(id->name) == ID_OB) && (((Object *)id)->base_flag & BASE_FROMDUPLI) != 0) {
+ if ((GS(id->name) == ID_OB) && (((Object *)id)->base_flag & BASE_FROM_DUPLI) != 0) {
DrawDataList *drawdata = DRW_drawdatalist_from_id(id);
- if (drawdata == NULL)
+ if (drawdata == NULL) {
return;
+ }
BLI_listbase_clear((ListBase *)drawdata);
}
@@ -941,7 +959,6 @@ static void drw_drawdata_unlink_dupli(ID *id)
/* -------------------------------------------------------------------- */
-
/** \name Rendering (DRW_engines)
* \{ */
@@ -1083,6 +1100,8 @@ static void drw_engines_draw_scene(void)
PROFILE_END_UPDATE(data->render_time, stime);
}
+ /* Reset state after drawing */
+ DRW_state_reset();
}
static void drw_engines_draw_text(void)
@@ -1206,8 +1225,6 @@ static void drw_engines_enable_from_paint_mode(int mode)
use_drw_engine(&draw_engine_sculpt_type);
break;
case CTX_MODE_PAINT_WEIGHT:
- use_drw_engine(&draw_engine_paint_weight_type);
- break;
case CTX_MODE_PAINT_VERTEX:
use_drw_engine(&draw_engine_paint_vertex_type);
break;
@@ -1265,8 +1282,6 @@ static void drw_engines_enable_from_mode(int mode)
BLI_assert(!"Draw mode invalid");
break;
}
- /* grease pencil */
- use_drw_engine(&draw_engine_gpencil_type);
}
static void drw_engines_enable_from_overlays(int UNUSED(overlay_flag))
@@ -1290,6 +1305,8 @@ static void drw_engines_enable(ViewLayer *view_layer, RenderEngineType *engine_t
const bool use_xray = XRAY_ENABLED(v3d);
drw_engines_enable_from_engine(engine_type, drawtype, use_xray);
+ /* grease pencil */
+ use_drw_engine(&draw_engine_gpencil_type);
if (DRW_state_draw_support()) {
/* Draw paint modes first so that they are drawn below the wireframes. */
@@ -1303,7 +1320,7 @@ static void drw_engines_enable(ViewLayer *view_layer, RenderEngineType *engine_t
if (v3d->shading.type == OB_WIRE) {
drw_engines_enable_from_overlays(v3d->overlay.flag);
}
- /* if gpencil must draw the strokes, but not the object */
+
drw_engines_enable_from_mode(mode);
}
}
@@ -1327,7 +1344,6 @@ static uint DRW_engines_get_hash(void)
}
/* -------------------------------------------------------------------- */
-
/** \name View Update
* \{ */
@@ -1386,7 +1402,6 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Main Draw Loops (DRW_draw)
* \{ */
@@ -1405,7 +1420,7 @@ void DRW_draw_view(const bContext *C)
/* Reset before using it. */
drw_state_prepare_clean_for_draw(&DST);
DST.options.draw_text = (
- (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0 &&
+ (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0 &&
(v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) != 0);
DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, C);
}
@@ -1425,7 +1440,10 @@ void DRW_draw_render_loop_ex(
Scene *scene = DEG_get_evaluated_scene(depsgraph);
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
RegionView3D *rv3d = ar->regiondata;
- bool do_annotations = (((v3d->flag2 & V3D_SHOW_ANNOTATION) != 0) && ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0));
+ const bool do_annotations = (
+ ((v3d->flag2 & V3D_SHOW_ANNOTATION) != 0) &&
+ ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0));
+ const bool do_camera_frame = !DST.options.is_image_render;
DST.draw_ctx.evil_C = evil_C;
DST.viewport = viewport;
@@ -1521,7 +1539,7 @@ void DRW_draw_render_loop_ex(
GPU_framebuffer_bind(DST.default_framebuffer);
if (do_bg_image) {
- ED_view3d_draw_bgpic_test(scene, depsgraph, ar, v3d, false, true);
+ ED_view3d_draw_bgpic_test(scene, depsgraph, ar, v3d, false, do_camera_frame);
}
DRW_draw_callbacks_pre_scene();
@@ -1539,28 +1557,32 @@ void DRW_draw_render_loop_ex(
/* annotations - temporary drawing buffer (3d space) */
/* XXX: Or should we use a proper draw/overlay engine for this case? */
if (do_annotations) {
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
/* XXX: as scene->gpd is not copied for COW yet */
ED_gpencil_draw_view3d_annotations(DEG_get_input_scene(depsgraph), depsgraph, v3d, ar, true);
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
DRW_draw_callbacks_post_scene();
if (DST.draw_ctx.evil_C) {
+ DRW_state_reset();
ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_POST_VIEW);
+ /* Callback can be nasty and do whatever they want with the state.
+ * Don't trust them! */
+ DRW_state_reset();
}
DRW_state_reset();
drw_debug_draw();
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
drw_engines_draw_text();
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
if (DST.draw_ctx.evil_C) {
/* needed so gizmo isn't obscured */
- if (((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
+ if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0))
{
glDisable(GL_DEPTH_TEST);
@@ -1571,36 +1593,36 @@ void DRW_draw_render_loop_ex(
/* annotations - temporary drawing buffer (screenspace) */
/* XXX: Or should we use a proper draw/overlay engine for this case? */
- if (((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
+ if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
(do_annotations))
{
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
/* XXX: as scene->gpd is not copied for COW yet */
ED_gpencil_draw_view3d_annotations(DEG_get_input_scene(depsgraph), depsgraph, v3d, ar, false);
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) {
/* Draw 2D after region info so we can draw on top of the camera passepartout overlay.
* 'DRW_draw_region_info' sets the projection in pixel-space. */
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
DRW_draw_gizmo_2d();
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
}
DRW_stats_reset();
if (do_bg_image) {
- ED_view3d_draw_bgpic_test(scene, depsgraph, ar, v3d, true, true);
+ ED_view3d_draw_bgpic_test(scene, depsgraph, ar, v3d, true, do_camera_frame);
}
if (G.debug_value > 20 && G.debug_value < 30) {
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
rcti rect; /* local coordinate visible rect inside region, to accommodate overlapping ui */
ED_region_visible_rect(DST.draw_ctx.ar, &rect);
DRW_stats_draw(&rect);
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
if (WM_draw_region_get_bound_viewport(ar)) {
@@ -1754,7 +1776,7 @@ void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph
drw_viewport_var_init();
/* set default viewport */
- gpuPushAttrib(GPU_ENABLE_BIT | GPU_VIEWPORT_BIT);
+ gpuPushAttr(GPU_ENABLE_BIT | GPU_VIEWPORT_BIT);
glDisable(GL_SCISSOR_TEST);
glViewport(0, 0, size[0], size[1]);
@@ -1779,7 +1801,7 @@ void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph
glDisable(GL_DEPTH_TEST);
/* Restore Drawing area. */
- gpuPopAttrib();
+ gpuPopAttr();
glEnable(GL_SCISSOR_TEST);
GPU_framebuffer_restore();
@@ -2053,7 +2075,7 @@ void DRW_draw_select_loop(
}
}
if (v3d->overlay.flag & V3D_OVERLAY_BONE_SELECT) {
- if (!(v3d->flag2 & V3D_RENDER_OVERRIDE)) {
+ if (!(v3d->flag2 & V3D_HIDE_OVERLAYS)) {
/* Note: don't use "BKE_object_pose_armature_get" here, it breaks selection. */
Object *obpose = OBPOSE_FROM_OBACT(obact);
if (obpose) {
@@ -2075,11 +2097,17 @@ void DRW_draw_select_loop(
drw_engines_enable_from_mode(obedit_mode);
}
else if (!draw_surface) {
+ /* grease pencil selection */
+ use_drw_engine(&draw_engine_gpencil_type);
+
drw_engines_enable_from_overlays(v3d->overlay.flag);
drw_engines_enable_from_object_mode();
}
else {
drw_engines_enable_basic();
+ /* grease pencil selection */
+ use_drw_engine(&draw_engine_gpencil_type);
+
drw_engines_enable_from_overlays(v3d->overlay.flag);
drw_engines_enable_from_object_mode();
}
@@ -2136,7 +2164,7 @@ void DRW_draw_select_loop(
(object_type_exclude_select & (1 << ob->type)) == 0)
{
if (object_filter_fn != NULL) {
- if (ob->base_flag & BASE_FROMDUPLI) {
+ if (ob->base_flag & BASE_FROM_DUPLI) {
/* pass (use previous filter_exclude value) */
}
else {
@@ -2148,9 +2176,9 @@ void DRW_draw_select_loop(
}
/* This relies on dupli instances being after their instancing object. */
- if ((ob->base_flag & BASE_FROMDUPLI) == 0) {
+ if ((ob->base_flag & BASE_FROM_DUPLI) == 0) {
Object *ob_orig = DEG_get_original_object(ob);
- DRW_select_load_id(ob_orig->select_color);
+ DRW_select_load_id(ob_orig->select_id);
}
DST.dupli_parent = data_.dupli_parent;
DST.dupli_source = data_.dupli_object_current;
@@ -2382,7 +2410,6 @@ void DRW_draw_depth_loop(
/* -------------------------------------------------------------------- */
-
/** \name Draw Manager State (DRW_state)
* \{ */
@@ -2470,7 +2497,7 @@ bool DRW_state_draw_support(void)
View3D *v3d = DST.draw_ctx.v3d;
return (DRW_state_is_scene_render() == false) &&
(v3d != NULL) &&
- ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0);
+ ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0);
}
/**
@@ -2488,7 +2515,6 @@ bool DRW_state_draw_background(void)
/* -------------------------------------------------------------------- */
-
/** \name Context State (DRW_context_state)
* \{ */
@@ -2501,7 +2527,6 @@ const DRWContextState *DRW_context_state_get(void)
/* -------------------------------------------------------------------- */
-
/** \name Init/Exit (DRW_engines)
* \{ */
@@ -2535,7 +2560,6 @@ void DRW_engines_register(void)
DRW_engine_register(&draw_engine_overlay_type);
DRW_engine_register(&draw_engine_paint_texture_type);
DRW_engine_register(&draw_engine_paint_vertex_type);
- DRW_engine_register(&draw_engine_paint_weight_type);
DRW_engine_register(&draw_engine_particle_type);
DRW_engine_register(&draw_engine_pose_type);
DRW_engine_register(&draw_engine_sculpt_type);
@@ -2543,25 +2567,6 @@ void DRW_engines_register(void)
/* setup callbacks */
{
- /* BKE: mball.c */
- extern void *BKE_mball_batch_cache_dirty_tag_cb;
- extern void *BKE_mball_batch_cache_free_cb;
- /* BKE: curve.c */
- extern void *BKE_curve_batch_cache_dirty_tag_cb;
- extern void *BKE_curve_batch_cache_free_cb;
- /* BKE: mesh.c */
- extern void *BKE_mesh_batch_cache_dirty_tag_cb;
- extern void *BKE_mesh_batch_cache_free_cb;
- /* BKE: lattice.c */
- extern void *BKE_lattice_batch_cache_dirty_tag_cb;
- extern void *BKE_lattice_batch_cache_free_cb;
- /* BKE: particle.c */
- extern void *BKE_particle_batch_cache_dirty_tag_cb;
- extern void *BKE_particle_batch_cache_free_cb;
- /* BKE: gpencil.c */
- extern void *BKE_gpencil_batch_cache_dirty_tag_cb;
- extern void *BKE_gpencil_batch_cache_free_cb;
-
BKE_mball_batch_cache_dirty_tag_cb = DRW_mball_batch_cache_dirty_tag;
BKE_mball_batch_cache_free_cb = DRW_mball_batch_cache_free;
@@ -2582,10 +2587,6 @@ void DRW_engines_register(void)
}
}
-extern struct GPUVertFormat *g_pos_format; /* draw_shgroup.c */
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GPUTexture *globals_ramp; /* draw_common.c */
-extern struct GPUTexture *globals_weight_ramp; /* draw_common.c */
void DRW_engines_free(void)
{
DRW_opengl_context_enable();
@@ -2608,10 +2609,10 @@ void DRW_engines_free(void)
}
}
- DRW_UBO_FREE_SAFE(globals_ubo);
- DRW_UBO_FREE_SAFE(view_ubo);
- DRW_TEXTURE_FREE_SAFE(globals_ramp);
- DRW_TEXTURE_FREE_SAFE(globals_weight_ramp);
+ DRW_UBO_FREE_SAFE(G_draw.block_ubo);
+ DRW_UBO_FREE_SAFE(G_draw.view_ubo);
+ DRW_TEXTURE_FREE_SAFE(G_draw.ramp);
+ DRW_TEXTURE_FREE_SAFE(G_draw.weight_ramp);
MEM_SAFE_FREE(g_pos_format);
MEM_SAFE_FREE(DST.RST.bound_texs);
@@ -2619,6 +2620,8 @@ void DRW_engines_free(void)
MEM_SAFE_FREE(DST.RST.bound_ubos);
MEM_SAFE_FREE(DST.RST.bound_ubo_slots);
+ MEM_SAFE_FREE(DST.uniform_names.buffer);
+
DRW_opengl_context_disable();
}
@@ -2707,6 +2710,9 @@ void DRW_opengl_context_disable_ex(bool restore)
void DRW_opengl_context_enable(void)
{
+ if (G.background && DST.gl_context == NULL) {
+ WM_init_opengl(G_MAIN);
+ }
DRW_opengl_context_enable_ex(true);
}
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h
index ce0f961c016..22dfc28e305 100644
--- a/source/blender/draw/intern/draw_manager.h
+++ b/source/blender/draw/intern/draw_manager.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file draw_manager.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
/* Private functions / structs of the draw manager */
@@ -46,6 +43,10 @@
/* Use draw manager to call GPU_select, see: DRW_draw_select_loop */
#define USE_GPU_SELECT
+#define DRW_DEBUG_USE_UNIFORM_NAME 0
+#define DRW_UNIFORM_BUFFER_NAME 64
+#define DRW_UNIFORM_BUFFER_NAME_INC 1024
+
/* ------------ Profiling --------------- */
#define USE_PROFILE
@@ -128,11 +129,16 @@ typedef struct DRWCallState {
} DRWCallState;
typedef enum {
- DRW_CALL_SINGLE, /* A single batch */
- DRW_CALL_RANGE, /* Like single but only draw a range of vertices/indices. */
- DRW_CALL_INSTANCES, /* Draw instances without any instancing attribs. */
- DRW_CALL_GENERATE, /* Uses a callback to draw with any number of batches. */
- DRW_CALL_PROCEDURAL, /* Generate a drawcall without any GPUBatch. */
+ /** A single batch. */
+ DRW_CALL_SINGLE,
+ /** Like single but only draw a range of vertices/indices. */
+ DRW_CALL_RANGE,
+ /** Draw instances without any instancing attributes. */
+ DRW_CALL_INSTANCES,
+ /** Uses a callback to draw with any number of batches. */
+ DRW_CALL_GENERATE,
+ /** Generate a drawcall without any #GPUBatch. */
+ DRW_CALL_PROCEDURAL,
} DRWCallType;
typedef struct DRWCall {
@@ -186,8 +192,6 @@ typedef enum {
DRW_UNIFORM_BLOCK_PERSIST
} DRWUniformType;
-#define MAX_UNIFORM_NAME 13
-
struct DRWUniform {
DRWUniform *next; /* single-linked list */
union {
@@ -197,13 +201,11 @@ struct DRWUniform {
float fvalue;
int ivalue;
};
+ int name_ofs; /* name offset in name buffer. */
int location;
char type; /* DRWUniformType */
char length; /* cannot be more than 16 */
char arraysize; /* cannot be more than 16 too */
-#ifndef NDEBUG
- char name[MAX_UNIFORM_NAME];
-#endif
};
typedef enum {
@@ -265,7 +267,7 @@ struct DRWShadingGroup {
DRWPass *pass_parent; /* backlink to pass we're in */
#ifndef NDEBUG
- char attribs_count;
+ char attrs_count;
#endif
#ifdef USE_GPU_SELECT
GPUVertBuf *inst_selectid;
@@ -362,7 +364,7 @@ typedef struct DRWManager {
/* View dependent uniforms. */
DRWMatrixState original_mat; /* Original rv3d matrices. */
int override_mat; /* Bitflag of which matrices are overridden. */
- int num_clip_planes; /* Number of active clipplanes. */
+ int clip_planes_len; /* Number of active clipplanes. */
bool dirty_mat;
/* keep in sync with viewBlock */
@@ -402,6 +404,12 @@ typedef struct DRWManager {
DRWDebugLine *lines;
DRWDebugSphere *spheres;
} debug;
+
+ struct {
+ char *buffer;
+ uint buffer_len;
+ uint buffer_ofs;
+ } uniform_names;
} DRWManager;
extern DRWManager DST; /* TODO : get rid of this and allow multithreaded rendering */
@@ -419,4 +427,6 @@ void drw_debug_init(void);
void drw_batch_cache_generate_requested(struct Object *ob);
+extern struct GPUVertFormat *g_pos_format;
+
#endif /* __DRAW_MANAGER_H__ */
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index 6584b6953d5..6f9e2cff36c 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,16 +13,16 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_manager_data.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "draw_manager.h"
+#include "BKE_anim.h"
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
@@ -44,10 +42,7 @@
struct GPUVertFormat *g_pos_format = NULL;
-extern struct GPUUniformBuffer *view_ubo; /* draw_manager_exec.c */
-
/* -------------------------------------------------------------------- */
-
/** \name Uniform Buffer Object (DRW_uniformbuffer)
* \{ */
@@ -69,7 +64,6 @@ void DRW_uniformbuffer_free(GPUUniformBuffer *ubo)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Uniforms (DRW_shgroup_uniform)
* \{ */
@@ -122,8 +116,6 @@ static void drw_shgroup_uniform(DRWShadingGroup *shgroup, const char *name,
}
if (location == -1) {
- if (G.debug & G_DEBUG_GPU)
- fprintf(stderr, "Warning: Pass : %s, Uniform '%s' not found!\n", shgroup->pass_parent->name, name);
/* Nice to enable eventually, for now eevee uses uniforms that might not exist. */
// BLI_assert(0);
return;
@@ -134,10 +126,24 @@ static void drw_shgroup_uniform(DRWShadingGroup *shgroup, const char *name,
drw_shgroup_uniform_create_ex(shgroup, location, type, value, length, arraysize);
-#ifndef NDEBUG
- /* Save uniform name to easily identify it when debugging. */
- BLI_strncpy(shgroup->uniforms->name, name, MAX_UNIFORM_NAME);
-#endif
+ /* If location is -2, the uniform has not yet been queried.
+ * We save the name for query just before drawing. */
+ if (location == -2 || DRW_DEBUG_USE_UNIFORM_NAME) {
+ int ofs = DST.uniform_names.buffer_ofs;
+ int max_len = DST.uniform_names.buffer_len - ofs;
+ size_t len = strlen(name) + 1;
+
+ if (len >= max_len) {
+ DST.uniform_names.buffer_len += DRW_UNIFORM_BUFFER_NAME_INC;
+ DST.uniform_names.buffer = MEM_reallocN(DST.uniform_names.buffer, DST.uniform_names.buffer_len);
+ }
+
+ char *dst = DST.uniform_names.buffer + ofs;
+ memcpy(dst, name, len); /* Copies NULL terminator. */
+
+ DST.uniform_names.buffer_ofs += len;
+ shgroup->uniforms->name_ofs = ofs;
+ }
}
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
@@ -256,7 +262,6 @@ void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name,
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Draw Call (DRW_calls)
* \{ */
@@ -305,13 +310,40 @@ static void drw_call_calc_orco(Object *ob, float (*r_orcofacs)[3])
}
}
+static void drw_call_state_update_matflag(DRWCallState *state, DRWShadingGroup *shgroup, Object *ob)
+{
+ uint16_t new_flags = ((state->matflag ^ shgroup->matflag) & shgroup->matflag);
+
+ /* HACK: Here we set the matflags bit to 1 when computing the value
+ * so that it's not recomputed for other drawcalls.
+ * This is the opposite of what draw_matrices_model_prepare() does. */
+ state->matflag |= shgroup->matflag;
+
+ /* Orco factors: We compute this at creation to not have to save the *ob_data */
+ if ((new_flags & DRW_CALL_ORCOTEXFAC) != 0) {
+ drw_call_calc_orco(ob, state->orcotexfac);
+ }
+
+ if ((new_flags & DRW_CALL_OBJECTINFO) != 0) {
+ state->objectinfo[0] = ob ? ob->index : 0;
+ uint random;
+ if (DST.dupli_source) {
+ random = DST.dupli_source->random_id;
+ }
+ else {
+ random = BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
+ }
+ state->objectinfo[1] = random * (1.0f / (float)0xFFFFFFFF);
+ }
+}
+
static DRWCallState *drw_call_state_create(DRWShadingGroup *shgroup, float (*obmat)[4], Object *ob)
{
DRWCallState *state = BLI_mempool_alloc(DST.vmempool->states);
state->flag = 0;
state->cache_id = 0;
state->visibility_cb = NULL;
- state->matflag = shgroup->matflag;
+ state->matflag = 0;
/* Matrices */
if (obmat != NULL) {
@@ -339,27 +371,7 @@ static DRWCallState *drw_call_state_create(DRWShadingGroup *shgroup, float (*obm
state->bsphere.radius = -1.0f;
}
- /* Orco factors: We compute this at creation to not have to save the *ob_data */
- if ((state->matflag & DRW_CALL_ORCOTEXFAC) != 0) {
- drw_call_calc_orco(ob, state->orcotexfac);
- state->matflag &= ~DRW_CALL_ORCOTEXFAC;
- }
-
- if ((state->matflag & DRW_CALL_OBJECTINFO) != 0) {
- state->objectinfo[0] = ob ? ob->index : 0;
- uint random;
-#if 0 /* TODO(fclem) handle dupli objects */
- if (GMS.dob) {
- random = GMS.dob->random_id;
- }
- else
-#endif
- {
- random = BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
- }
- state->objectinfo[1] = random * (1.0f / (float)0xFFFFFFFF);
- state->matflag &= ~DRW_CALL_OBJECTINFO;
- }
+ drw_call_state_update_matflag(state, shgroup, ob);
return state;
}
@@ -371,7 +383,7 @@ static DRWCallState *drw_call_state_object(DRWShadingGroup *shgroup, float (*obm
}
else {
/* If the DRWCallState is reused, add necessary matrices. */
- DST.ob_state->matflag |= shgroup->matflag;
+ drw_call_state_update_matflag(DST.ob_state, shgroup, ob);
}
return DST.ob_state;
@@ -575,7 +587,34 @@ static void sculpt_draw_cb(
if (pbvh) {
BKE_pbvh_draw_cb(
- pbvh, NULL, NULL, fast_mode, false,
+ pbvh, NULL, NULL, fast_mode, false, false,
+ (void (*)(void *, GPUBatch *))draw_fn, shgroup);
+ }
+}
+
+static void sculpt_draw_wires_cb(
+ DRWShadingGroup *shgroup,
+ void (*draw_fn)(DRWShadingGroup *shgroup, GPUBatch *geom),
+ void *user_data)
+{
+ Object *ob = user_data;
+
+ /* XXX should be ensured before but sometime it's not... go figure (see T57040). */
+ PBVH *pbvh = BKE_sculpt_object_pbvh_ensure(DST.draw_ctx.depsgraph, ob);
+
+ const DRWContextState *drwctx = DRW_context_state_get();
+ int fast_mode = 0;
+
+ if (drwctx->evil_C != NULL) {
+ Paint *p = BKE_paint_get_active_from_context(drwctx->evil_C);
+ if (p && (p->flags & PAINT_FAST_NAVIGATE)) {
+ fast_mode = drwctx->rv3d->rflag & RV3D_NAVIGATING;
+ }
+ }
+
+ if (pbvh) {
+ BKE_pbvh_draw_cb(
+ pbvh, NULL, NULL, fast_mode, true, false,
(void (*)(void *, GPUBatch *))draw_fn, shgroup);
}
}
@@ -585,10 +624,15 @@ void DRW_shgroup_call_sculpt_add(DRWShadingGroup *shgroup, Object *ob, float (*o
DRW_shgroup_call_generate_add(shgroup, sculpt_draw_cb, ob, obmat);
}
+void DRW_shgroup_call_sculpt_wires_add(DRWShadingGroup *shgroup, Object *ob, float (*obmat)[4])
+{
+ DRW_shgroup_call_generate_add(shgroup, sculpt_draw_wires_cb, ob, obmat);
+}
+
void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup *shgroup, const void *attr[], uint attr_len)
{
#ifdef USE_GPU_SELECT
- if (G.f & G_PICKSEL) {
+ if (G.f & G_FLAG_PICKSEL) {
if (shgroup->instance_count == shgroup->inst_selectid->vertex_len) {
GPU_vertbuf_data_resize(shgroup->inst_selectid, shgroup->instance_count + 32);
}
@@ -596,7 +640,7 @@ void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup *shgroup, const void *at
}
#endif
- BLI_assert(attr_len == shgroup->attribs_count);
+ BLI_assert(attr_len == shgroup->attrs_count);
UNUSED_VARS_NDEBUG(attr_len);
for (int i = 0; i < attr_len; ++i) {
@@ -612,7 +656,6 @@ void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup *shgroup, const void *at
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Shading Groups (DRW_shgroup)
* \{ */
@@ -627,13 +670,13 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader)
shgroup->override_selectid = -1;
#endif
#ifndef NDEBUG
- shgroup->attribs_count = 0;
+ shgroup->attrs_count = 0;
#endif
int view_ubo_location = GPU_shader_get_uniform_block(shader, "viewBlock");
if (view_ubo_location != -1) {
- drw_shgroup_uniform_create_ex(shgroup, view_ubo_location, DRW_UNIFORM_BLOCK_PERSIST, view_ubo, 0, 1);
+ drw_shgroup_uniform_create_ex(shgroup, view_ubo_location, DRW_UNIFORM_BLOCK_PERSIST, G_draw.view_ubo, 0, 1);
}
else {
/* Only here to support builtin shaders. This should not be used by engines. */
@@ -659,24 +702,33 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader)
shgroup->callid = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_CALLID);
shgroup->matflag = 0;
- if (shgroup->modelinverse > -1)
+ if (shgroup->modelinverse > -1) {
shgroup->matflag |= DRW_CALL_MODELINVERSE;
- if (shgroup->modelview > -1)
+ }
+ if (shgroup->modelview > -1) {
shgroup->matflag |= DRW_CALL_MODELVIEW;
- if (shgroup->modelviewinverse > -1)
+ }
+ if (shgroup->modelviewinverse > -1) {
shgroup->matflag |= DRW_CALL_MODELVIEWINVERSE;
- if (shgroup->modelviewprojection > -1)
+ }
+ if (shgroup->modelviewprojection > -1) {
shgroup->matflag |= DRW_CALL_MODELVIEWPROJECTION;
- if (shgroup->normalview > -1)
+ }
+ if (shgroup->normalview > -1) {
shgroup->matflag |= DRW_CALL_NORMALVIEW;
- if (shgroup->normalworld > -1)
+ }
+ if (shgroup->normalworld > -1) {
shgroup->matflag |= DRW_CALL_NORMALWORLD;
- if (shgroup->orcotexfac > -1)
+ }
+ if (shgroup->orcotexfac > -1) {
shgroup->matflag |= DRW_CALL_ORCOTEXFAC;
- if (shgroup->objectinfo > -1)
+ }
+ if (shgroup->objectinfo > -1) {
shgroup->matflag |= DRW_CALL_OBJECTINFO;
- if (shgroup->eye > -1)
+ }
+ if (shgroup->eye > -1) {
shgroup->matflag |= DRW_CALL_EYEVEC;
+ }
}
static void drw_shgroup_instance_init(
@@ -690,14 +742,14 @@ static void drw_shgroup_instance_init(
shgroup->instance_geom = batch;
#ifndef NDEBUG
- shgroup->attribs_count = format->attr_len;
+ shgroup->attrs_count = format->attr_len;
#endif
DRW_instancing_buffer_request(DST.idatalist, format, batch, shgroup,
&shgroup->instance_geom, &shgroup->instance_vbo);
#ifdef USE_GPU_SELECT
- if (G.f & G_PICKSEL) {
+ if (G.f & G_FLAG_PICKSEL) {
/* Not actually used for rendering but alloced in one chunk.
* Plus we don't have to care about ownership. */
static GPUVertFormat inst_select_format = {0};
@@ -718,7 +770,7 @@ static void drw_shgroup_batching_init(
drw_shgroup_init(shgroup, shader);
#ifndef NDEBUG
- shgroup->attribs_count = (format != NULL) ? format->attr_len : 0;
+ shgroup->attrs_count = (format != NULL) ? format->attr_len : 0;
#endif
BLI_assert(format != NULL);
@@ -734,7 +786,7 @@ static void drw_shgroup_batching_init(
&shgroup->batch_geom, &shgroup->batch_vbo);
#ifdef USE_GPU_SELECT
- if (G.f & G_PICKSEL) {
+ if (G.f & G_FLAG_PICKSEL) {
/* Not actually used for rendering but alloced in one chunk. */
static GPUVertFormat inst_select_format = {0};
if (inst_select_format.attr_len == 0) {
@@ -802,8 +854,7 @@ static DRWShadingGroup *drw_shgroup_material_inputs(DRWShadingGroup *grp, struct
GPUTexture *tex = NULL;
if (input->ima) {
- double time = 0.0; /* TODO make time variable */
- tex = GPU_texture_from_blender(input->ima, input->iuser, GL_TEXTURE_2D, input->image_isdata, time);
+ tex = GPU_texture_from_blender(input->ima, input->iuser, GL_TEXTURE_2D, input->image_isdata);
}
else {
/* Color Ramps */
@@ -824,15 +875,16 @@ static DRWShadingGroup *drw_shgroup_material_inputs(DRWShadingGroup *grp, struct
return grp;
}
-GPUVertFormat *DRW_shgroup_instance_format_array(const DRWInstanceAttribFormat attribs[], int arraysize)
+GPUVertFormat *DRW_shgroup_instance_format_array(const DRWInstanceAttrFormat attrs[], int arraysize)
{
GPUVertFormat *format = MEM_callocN(sizeof(GPUVertFormat), "GPUVertFormat");
for (int i = 0; i < arraysize; ++i) {
- GPU_vertformat_attr_add(format, attribs[i].name,
- (attribs[i].type == DRW_ATTRIB_INT) ? GPU_COMP_I32 : GPU_COMP_F32,
- attribs[i].components,
- (attribs[i].type == DRW_ATTRIB_INT) ? GPU_FETCH_INT : GPU_FETCH_FLOAT);
+ GPU_vertformat_attr_add(
+ format, attrs[i].name,
+ (attrs[i].type == DRW_ATTR_INT) ? GPU_COMP_I32 : GPU_COMP_F32,
+ attrs[i].components,
+ (attrs[i].type == DRW_ATTR_INT) ? GPU_FETCH_INT : GPU_FETCH_FLOAT);
}
return format;
}
@@ -872,7 +924,7 @@ DRWShadingGroup *DRW_shgroup_material_empty_tri_batch_create(
struct GPUMaterial *material, DRWPass *pass, int tri_count)
{
#ifdef USE_GPU_SELECT
- BLI_assert((G.f & G_PICKSEL) == 0);
+ BLI_assert((G.f & G_FLAG_PICKSEL) == 0);
#endif
GPUPass *gpupass = GPU_material_get_pass(material);
DRWShadingGroup *shgroup = drw_shgroup_material_create_ex(gpupass, pass);
@@ -909,7 +961,7 @@ DRWShadingGroup *DRW_shgroup_instance_create(
DRWShadingGroup *DRW_shgroup_point_batch_create(struct GPUShader *shader, DRWPass *pass)
{
- DRW_shgroup_instance_format(g_pos_format, {{"pos", DRW_ATTRIB_FLOAT, 3}});
+ DRW_shgroup_instance_format(g_pos_format, {{"pos", DRW_ATTR_FLOAT, 3}});
DRWShadingGroup *shgroup = drw_shgroup_create_ex(shader, pass);
shgroup->type = DRW_SHG_POINT_BATCH;
@@ -932,18 +984,20 @@ DRWShadingGroup *DRW_shgroup_line_batch_create_with_format(
DRWShadingGroup *DRW_shgroup_line_batch_create(struct GPUShader *shader, DRWPass *pass)
{
- DRW_shgroup_instance_format(g_pos_format, {{"pos", DRW_ATTRIB_FLOAT, 3}});
+ DRW_shgroup_instance_format(g_pos_format, {{"pos", DRW_ATTR_FLOAT, 3}});
return DRW_shgroup_line_batch_create_with_format(shader, pass, g_pos_format);
}
-/* Very special batch. Use this if you position
+/**
+ * Very special batch. Use this if you position
* your vertices with the vertex shader
- * and dont need any VBO attrib */
+ * and dont need any VBO attribute.
+ */
DRWShadingGroup *DRW_shgroup_empty_tri_batch_create(struct GPUShader *shader, DRWPass *pass, int tri_count)
{
#ifdef USE_GPU_SELECT
- BLI_assert((G.f & G_PICKSEL) == 0);
+ BLI_assert((G.f & G_FLAG_PICKSEL) == 0);
#endif
DRWShadingGroup *shgroup = drw_shgroup_create_ex(shader, pass);
@@ -969,13 +1023,15 @@ DRWShadingGroup *DRW_shgroup_transform_feedback_create(struct GPUShader *shader,
return shgroup;
}
-/* Specify an external batch instead of adding each attrib one by one. */
+/**
+ * Specify an external batch instead of adding each attribute one by one.
+ */
void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct GPUBatch *batch)
{
BLI_assert(shgroup->type == DRW_SHG_INSTANCE);
BLI_assert(shgroup->instance_count == 0);
/* You cannot use external instancing batch without a dummy format. */
- BLI_assert(shgroup->attribs_count != 0);
+ BLI_assert(shgroup->attrs_count != 0);
shgroup->type = DRW_SHG_INSTANCE_EXTERNAL;
drw_call_calc_orco(NULL, shgroup->instance_orcofac);
@@ -1052,7 +1108,6 @@ DRWShadingGroup *DRW_shgroup_create_sub(DRWShadingGroup *shgroup)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Passes (DRW_pass)
* \{ */
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index a428fde6f00..2e8ba259a31 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,47 +13,39 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_manager_exec.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "draw_manager.h"
#include "BLI_mempool.h"
-#include "BIF_glutil.h"
#include "BKE_global.h"
-#include "BKE_object.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "intern/gpu_shader_private.h"
#ifdef USE_GPU_SELECT
-# include "ED_view3d.h"
-# include "ED_armature.h"
# include "GPU_select.h"
#endif
#ifdef USE_GPU_SELECT
void DRW_select_load_id(uint id)
{
- BLI_assert(G.f & G_PICKSEL);
+ BLI_assert(G.f & G_FLAG_PICKSEL);
DST.select_id = id;
}
#endif
#define DEBUG_UBO_BINDING
-struct GPUUniformBuffer *view_ubo;
-
/* -------------------------------------------------------------------- */
-
/** \name Draw State (DRW_state)
* \{ */
@@ -107,15 +97,8 @@ void drw_state_set(DRWState state)
/* Raster Discard */
{
- if (CHANGED_ANY(DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR |
- DRW_STATE_WRITE_STENCIL |
- DRW_STATE_WRITE_STENCIL_SHADOW_PASS |
- DRW_STATE_WRITE_STENCIL_SHADOW_FAIL))
- {
- if ((state & (DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR |
- DRW_STATE_WRITE_STENCIL | DRW_STATE_WRITE_STENCIL_SHADOW_PASS |
- DRW_STATE_WRITE_STENCIL_SHADOW_FAIL)) != 0)
- {
+ if (CHANGED_ANY(DRW_STATE_RASTERIZER_ENABLED)) {
+ if ((state & DRW_STATE_RASTERIZER_ENABLED) != 0) {
glDisable(GL_RASTERIZER_DISCARD);
}
else {
@@ -191,15 +174,23 @@ void drw_state_set(DRWState state)
/* Wire Width */
{
- if (CHANGED_ANY(DRW_STATE_WIRE | DRW_STATE_WIRE_SMOOTH)) {
- if ((state & DRW_STATE_WIRE_SMOOTH) != 0) {
+ int test;
+ if (CHANGED_ANY_STORE_VAR(
+ DRW_STATE_WIRE | DRW_STATE_WIRE_WIDE | DRW_STATE_WIRE_SMOOTH,
+ test))
+ {
+ if (test & DRW_STATE_WIRE_WIDE) {
+ GPU_line_width(3.0f);
+ }
+ else if (test & DRW_STATE_WIRE_SMOOTH) {
GPU_line_width(2.0f);
GPU_line_smooth(true);
}
- else if ((state & DRW_STATE_WIRE) != 0) {
+ else if (test & DRW_STATE_WIRE) {
GPU_line_width(1.0f);
}
else {
+ GPU_line_width(1.0f);
GPU_line_smooth(false);
}
}
@@ -270,7 +261,7 @@ void drw_state_set(DRWState state)
int test;
if ((test = CHANGED_TO(DRW_STATE_CLIP_PLANES))) {
if (test == 1) {
- for (int i = 0; i < DST.num_clip_planes; ++i) {
+ for (int i = 0; i < DST.clip_planes_len; ++i) {
glEnable(GL_CLIP_DISTANCE0 + i);
}
}
@@ -436,21 +427,33 @@ void DRW_state_invert_facing(void)
* and if the shaders have support for it (see usage of gl_ClipDistance).
* Be sure to call DRW_state_clip_planes_reset() after you finish drawing.
**/
-void DRW_state_clip_planes_count_set(uint plane_len)
+void DRW_state_clip_planes_len_set(uint plane_len)
{
BLI_assert(plane_len <= MAX_CLIP_PLANES);
- DST.num_clip_planes = plane_len;
+ DST.clip_planes_len = plane_len;
}
void DRW_state_clip_planes_reset(void)
{
- DST.num_clip_planes = 0;
+ DST.clip_planes_len = 0;
+}
+
+void DRW_state_clip_planes_set_from_rv3d(RegionView3D *rv3d)
+{
+ int max_len = 6;
+ int real_len = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : max_len;
+ while (real_len < max_len) {
+ /* Fill in dummy values that wont change results (6 is hard coded in shaders). */
+ copy_v4_v4(rv3d->clip[real_len], rv3d->clip[3]);
+ real_len++;
+ }
+
+ DRW_state_clip_planes_len_set(max_len);
}
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Clipping (DRW_clipping)
* \{ */
@@ -505,8 +508,9 @@ static void draw_frustum_boundbox_calc(const float(*projmat)[4], BoundBox *r_bbo
static void draw_clipping_setup_from_view(void)
{
- if (DST.clipping.updated)
+ if (DST.clipping.updated) {
return;
+ }
float (*viewinv)[4] = DST.view_data.matstate.mat[DRW_MAT_VIEWINV];
float (*projmat)[4] = DST.view_data.matstate.mat[DRW_MAT_WIN];
@@ -532,21 +536,26 @@ static void draw_clipping_setup_from_view(void)
/* Compute clip planes using the world space frustum corners. */
for (int p = 0; p < 6; p++) {
- int q, r;
+ int q, r, s;
switch (p) {
- case 0: q = 1; r = 2; break; /* -X */
- case 1: q = 0; r = 5; break; /* -Y */
- case 2: q = 1; r = 5; break; /* +Z (far) */
- case 3: q = 2; r = 6; break; /* +Y */
- case 4: q = 0; r = 3; break; /* -Z (near) */
- default: q = 4; r = 7; break; /* +X */
+ case 0: q = 1; r = 2; s = 3; break; /* -X */
+ case 1: q = 0; r = 4; s = 5; break; /* -Y */
+ case 2: q = 1; r = 5; s = 6; break; /* +Z (far) */
+ case 3: q = 2; r = 6; s = 7; break; /* +Y */
+ case 4: q = 0; r = 3; s = 7; break; /* -Z (near) */
+ default: q = 4; r = 7; s = 6; break; /* +X */
}
if (DST.frontface == GL_CW) {
- SWAP(int, q, r);
+ SWAP(int, q, s);
}
- normal_tri_v3(DST.clipping.frustum_planes[p], bbox.vec[p], bbox.vec[q], bbox.vec[r]);
- DST.clipping.frustum_planes[p][3] = -dot_v3v3(DST.clipping.frustum_planes[p], bbox.vec[p]);
+ normal_quad_v3(DST.clipping.frustum_planes[p], bbox.vec[p], bbox.vec[q], bbox.vec[r], bbox.vec[s]);
+ /* Increase precision and use the mean of all 4 corners. */
+ DST.clipping.frustum_planes[p][3] = -dot_v3v3(DST.clipping.frustum_planes[p], bbox.vec[p]);
+ DST.clipping.frustum_planes[p][3] += -dot_v3v3(DST.clipping.frustum_planes[p], bbox.vec[q]);
+ DST.clipping.frustum_planes[p][3] += -dot_v3v3(DST.clipping.frustum_planes[p], bbox.vec[r]);
+ DST.clipping.frustum_planes[p][3] += -dot_v3v3(DST.clipping.frustum_planes[p], bbox.vec[s]);
+ DST.clipping.frustum_planes[p][3] *= 0.25f;
}
/* Extract Bounding Sphere */
@@ -663,14 +672,16 @@ bool DRW_culling_sphere_test(BoundSphere *bsphere)
draw_clipping_setup_from_view();
/* Bypass test if radius is negative. */
- if (bsphere->radius < 0.0f)
+ if (bsphere->radius < 0.0f) {
return true;
+ }
/* Do a rough test first: Sphere VS Sphere intersect. */
BoundSphere *frustum_bsphere = &DST.clipping.frustum_bsphere;
float center_dist = len_squared_v3v3(bsphere->center, frustum_bsphere->center);
- if (center_dist > SQUARE(bsphere->radius + frustum_bsphere->radius))
+ if (center_dist > SQUARE(bsphere->radius + frustum_bsphere->radius)) {
return false;
+ }
/* Test against the 6 frustum planes. */
for (int p = 0; p < 6; p++) {
@@ -741,7 +752,6 @@ void DRW_culling_frustum_planes_get(float planes[6][4])
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Draw (DRW_draw)
* \{ */
@@ -991,8 +1001,9 @@ static void release_texture_slots(bool with_persist)
}
else {
for (int i = 0; i < GPU_max_textures(); ++i) {
- if (DST.RST.bound_tex_slots[i] != BIND_PERSIST)
+ if (DST.RST.bound_tex_slots[i] != BIND_PERSIST) {
DST.RST.bound_tex_slots[i] = BIND_NONE;
+ }
}
}
@@ -1008,8 +1019,9 @@ static void release_ubo_slots(bool with_persist)
}
else {
for (int i = 0; i < GPU_max_ubo_binds(); ++i) {
- if (DST.RST.bound_ubo_slots[i] != BIND_PERSIST)
+ if (DST.RST.bound_ubo_slots[i] != BIND_PERSIST) {
DST.RST.bound_ubo_slots[i] = BIND_NONE;
+ }
}
}
@@ -1050,6 +1062,12 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
/* Binding Uniform */
for (DRWUniform *uni = shgroup->uniforms; uni; uni = uni->next) {
+ if (uni->location == -2) {
+ uni->location = GPU_shader_get_uniform_ensure(shgroup->shader, DST.uniform_names.buffer + uni->name_ofs);
+ if (uni->location == -1) {
+ continue;
+ }
+ }
switch (uni->type) {
case DRW_UNIFORM_SHORT_TO_INT:
val = (int)*((short *)uni->pvalue);
@@ -1112,12 +1130,12 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
#ifdef USE_GPU_SELECT
# define GPU_SELECT_LOAD_IF_PICKSEL(_select_id) \
- if (G.f & G_PICKSEL) { \
+ if (G.f & G_FLAG_PICKSEL) { \
GPU_select_load_id(_select_id); \
} ((void)0)
# define GPU_SELECT_LOAD_IF_PICKSEL_CALL(_call) \
- if ((G.f & G_PICKSEL) && (_call)) { \
+ if ((G.f & G_FLAG_PICKSEL) && (_call)) { \
GPU_select_load_id((_call)->select_id); \
} ((void)0)
@@ -1125,7 +1143,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
_start = 0; \
_count = _shgroup->instance_count; \
int *select_id = NULL; \
- if (G.f & G_PICKSEL) { \
+ if (G.f & G_FLAG_PICKSEL) { \
if (_shgroup->override_selectid == -1) { \
/* Hack : get vbo data without actually drawing. */ \
GPUVertBufRaw raw; \
@@ -1256,9 +1274,6 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
if (use_tfeedback) {
GPU_shader_transform_feedback_disable(shgroup->shader);
}
-
- /* TODO: remove, (currently causes alpha issue with sculpt, need to investigate) */
- DRW_state_reset();
}
static void drw_update_view(void)
@@ -1267,7 +1282,7 @@ static void drw_update_view(void)
DST.state_cache_id++;
DST.dirty_mat = false;
- DRW_uniformbuffer_update(view_ubo, &DST.view_data);
+ DRW_uniformbuffer_update(G_draw.view_ubo, &DST.view_data);
/* Catch integer wrap around. */
if (UNLIKELY(DST.state_cache_id == 0)) {
@@ -1290,8 +1305,9 @@ static void drw_update_view(void)
static void drw_draw_pass_ex(DRWPass *pass, DRWShadingGroup *start_group, DRWShadingGroup *end_group)
{
- if (start_group == NULL)
+ if (start_group == NULL) {
return;
+ }
DST.shader = NULL;
@@ -1299,6 +1315,10 @@ static void drw_draw_pass_ex(DRWPass *pass, DRWShadingGroup *start_group, DRWSha
drw_update_view();
+ /* GPU_framebuffer_clear calls can change the state outside the DRW module.
+ * Force reset the affected states to avoid problems later. */
+ drw_state_set(DST.state | DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR);
+
drw_state_set(pass->state);
DRW_stats_query_start(pass->name);
@@ -1332,6 +1352,13 @@ static void drw_draw_pass_ex(DRWPass *pass, DRWShadingGroup *start_group, DRWSha
DST.shader = NULL;
}
+ /* HACK: Rasterized discard can affect clear commands which are not
+ * part of a DRWPass (as of now). So disable rasterized discard here
+ * if it has been enabled. */
+ if ((DST.state & DRW_STATE_RASTERIZER_ENABLED) == 0) {
+ drw_state_set((DST.state & ~DRW_STATE_RASTERIZER_ENABLED) | DRW_STATE_DEFAULT);
+ }
+
DRW_stats_query_end();
}
diff --git a/source/blender/draw/intern/draw_manager_profiling.c b/source/blender/draw/intern/draw_manager_profiling.c
index 7b5ea4445ce..1ce0a92c978 100644
--- a/source/blender/draw/intern/draw_manager_profiling.c
+++ b/source/blender/draw/intern/draw_manager_profiling.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file draw_manager_profiling.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "BLI_rect.h"
@@ -34,13 +31,10 @@
#include "draw_manager.h"
-#include "GPU_glew.h"
#include "GPU_texture.h"
#include "UI_resources.h"
-#include "WM_api.h"
-#include "WM_types.h"
#include "draw_manager_profiling.h"
diff --git a/source/blender/draw/intern/draw_manager_profiling.h b/source/blender/draw/intern/draw_manager_profiling.h
index 233cd3878d2..7fe2280f9b2 100644
--- a/source/blender/draw/intern/draw_manager_profiling.h
+++ b/source/blender/draw/intern/draw_manager_profiling.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file draw_manager_profiling.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRAW_MANAGER_PROFILING_H__
diff --git a/source/blender/draw/intern/draw_manager_shader.c b/source/blender/draw/intern/draw_manager_shader.c
index e8d693aa7c0..54ad98d3189 100644
--- a/source/blender/draw/intern/draw_manager_shader.c
+++ b/source/blender/draw/intern/draw_manager_shader.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,24 +13,20 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_manager_shader.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
-#include "draw_manager.h"
-
+#include "DNA_object_types.h"
#include "DNA_world_types.h"
#include "DNA_material_types.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_string_utils.h"
#include "BLI_threads.h"
-#include "BLI_task.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -45,6 +39,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "draw_manager.h"
+
extern char datatoc_gpu_shader_2D_vert_glsl[];
extern char datatoc_gpu_shader_3D_vert_glsl[];
extern char datatoc_gpu_shader_depth_only_frag_glsl[];
@@ -53,7 +49,6 @@ extern char datatoc_common_fullscreen_vert_glsl[];
#define USE_DEFERRED_COMPILATION 1
/* -------------------------------------------------------------------- */
-
/** \name Deferred Compilation (DRW_deferred)
*
* Since compiling shader can take a long time, we do it in a non blocking
@@ -294,7 +289,7 @@ GPUShader *DRW_shader_create_with_lib(
GPUShader *DRW_shader_create_with_transform_feedback(
const char *vert, const char *geom, const char *defines,
- const GPUShaderTFBType prim_type, const char **varying_names, const int varying_count)
+ const eGPUShaderTFBType prim_type, const char **varying_names, const int varying_count)
{
return GPU_shader_create_ex(vert,
datatoc_gpu_shader_depth_only_frag_glsl,
@@ -317,9 +312,9 @@ GPUShader *DRW_shader_create_fullscreen(const char *frag, const char *defines)
return GPU_shader_create(datatoc_common_fullscreen_vert_glsl, frag, NULL, NULL, defines, __func__);
}
-GPUShader *DRW_shader_create_3D_depth_only(void)
+GPUShader *DRW_shader_create_3D_depth_only(eGPUShaderConfig sh_cfg)
{
- return GPU_shader_get_builtin_shader(GPU_SHADER_3D_DEPTH_ONLY);
+ return GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_DEPTH_ONLY, sh_cfg);
}
GPUMaterial *DRW_shader_find_from_world(World *wo, const void *engine_type, int options, bool deferred)
diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c
index 1a183e14d60..eff3688589c 100644
--- a/source/blender/draw/intern/draw_manager_text.c
+++ b/source/blender/draw/intern/draw_manager_text.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,26 +13,23 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_manager_text.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "MEM_guardedalloc.h"
-#include "BLI_listbase.h"
-#include "BLI_string.h"
+#include "BLI_memiter.h"
#include "BLI_math.h"
-#include "BIF_gl.h"
-
#include "GPU_matrix.h"
#include "ED_screen.h"
#include "ED_view3d.h"
-#include "UI_resources.h"
#include "UI_interface.h"
#include "WM_api.h"
@@ -43,7 +38,6 @@
#include "draw_manager_text.h"
typedef struct ViewCachedString {
- struct ViewCachedString *next, *prev;
float vec[3];
union {
uchar ub[4];
@@ -59,18 +53,19 @@ typedef struct ViewCachedString {
} ViewCachedString;
typedef struct DRWTextStore {
- ListBase list;
+ BLI_memiter *cache_strings;
} DRWTextStore;
DRWTextStore *DRW_text_cache_create(void)
{
DRWTextStore *dt = MEM_callocN(sizeof(*dt), __func__);
+ dt->cache_strings = BLI_memiter_create(1 << 14); /* 16kb */
return dt;
}
void DRW_text_cache_destroy(struct DRWTextStore *dt)
{
- BLI_freelistN(&dt->list);
+ BLI_memiter_destroy(dt->cache_strings);
MEM_freeN(dt);
}
@@ -92,9 +87,7 @@ void DRW_text_cache_add(
alloc_len = str_len + 1;
}
- vos = MEM_mallocN(sizeof(ViewCachedString) + alloc_len, __func__);
-
- BLI_addtail(&dt->list, vos);
+ vos = BLI_memiter_alloc(dt->cache_strings, sizeof(ViewCachedString) + alloc_len);
copy_v3_v3(vos->vec, co);
copy_v4_v4_uchar(vos->col.ub, col);
@@ -119,7 +112,9 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar)
int tot = 0;
/* project first and test */
- for (vos = dt->list.first; vos; vos = vos->next) {
+ BLI_memiter_handle it;
+ BLI_memiter_iter_init(dt->cache_strings, &it);
+ while ((vos = BLI_memiter_iter_step(&it))) {
if (ED_view3d_project_short_ex(
ar,
(vos->flag & DRW_TEXT_CACHE_GLOBALSPACE) ? rv3d->persmat : rv3d->persmatob,
@@ -154,7 +149,8 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar)
BLF_size(font_id, style->widget.points * U.pixelsize, U.dpi);
- for (vos = dt->list.first; vos; vos = vos->next) {
+ BLI_memiter_iter_init(dt->cache_strings, &it);
+ while ((vos = BLI_memiter_iter_step(&it))) {
if (vos->sco[0] != IS_CLIPPED) {
if (col_pack_prev != vos->col.pack) {
BLF_color4ubv(font_id, vos->col.ub);
diff --git a/source/blender/draw/intern/draw_manager_text.h b/source/blender/draw/intern/draw_manager_text.h
index 6798f36e7f4..308d569faa9 100644
--- a/source/blender/draw/intern/draw_manager_text.h
+++ b/source/blender/draw/intern/draw_manager_text.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,10 +13,11 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_manager_text.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRAW_MANAGER_TEXT_H__
diff --git a/source/blender/draw/intern/draw_manager_texture.c b/source/blender/draw/intern/draw_manager_texture.c
index 89e2b958ecc..0a804a9d37f 100644
--- a/source/blender/draw/intern/draw_manager_texture.c
+++ b/source/blender/draw/intern/draw_manager_texture.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,19 +13,18 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_manager_texture.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "draw_manager.h"
#ifndef NDEBUG
/* Maybe gpu_texture.c is a better place for this. */
-static bool drw_texture_format_supports_framebuffer(GPUTextureFormat format)
+static bool drw_texture_format_supports_framebuffer(eGPUTextureFormat format)
{
/* Some formats do not work with framebuffers. */
switch (format) {
@@ -76,7 +73,7 @@ void drw_texture_set_parameters(GPUTexture *tex, DRWTextureFlag flags)
GPU_texture_unbind(tex);
}
-GPUTexture *DRW_texture_create_1D(int w, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
+GPUTexture *DRW_texture_create_1D(int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
GPUTexture *tex = GPU_texture_create_1D(w, format, fpixels, NULL);
drw_texture_set_parameters(tex, flags);
@@ -84,7 +81,7 @@ GPUTexture *DRW_texture_create_1D(int w, GPUTextureFormat format, DRWTextureFlag
return tex;
}
-GPUTexture *DRW_texture_create_2D(int w, int h, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
+GPUTexture *DRW_texture_create_2D(int w, int h, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
GPUTexture *tex = GPU_texture_create_2D(w, h, format, fpixels, NULL);
drw_texture_set_parameters(tex, flags);
@@ -101,7 +98,7 @@ GPUTexture *DRW_texture_create_2D_multisample(int w, int h, GPUTextureFormat for
}
GPUTexture *DRW_texture_create_2D_array(
- int w, int h, int d, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
+ int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
GPUTexture *tex = GPU_texture_create_2D_array(w, h, d, format, fpixels, NULL);
drw_texture_set_parameters(tex, flags);
@@ -110,7 +107,7 @@ GPUTexture *DRW_texture_create_2D_array(
}
GPUTexture *DRW_texture_create_3D(
- int w, int h, int d, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
+ int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
GPUTexture *tex = GPU_texture_create_3D(w, h, d, format, fpixels, NULL);
drw_texture_set_parameters(tex, flags);
@@ -118,7 +115,7 @@ GPUTexture *DRW_texture_create_3D(
return tex;
}
-GPUTexture *DRW_texture_create_cube(int w, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
+GPUTexture *DRW_texture_create_cube(int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
GPUTexture *tex = GPU_texture_create_cube(w, format, fpixels, NULL);
drw_texture_set_parameters(tex, flags);
@@ -126,7 +123,7 @@ GPUTexture *DRW_texture_create_cube(int w, GPUTextureFormat format, DRWTextureFl
return tex;
}
-GPUTexture *DRW_texture_pool_query_2D(int w, int h, GPUTextureFormat format, DrawEngineType *engine_type)
+GPUTexture *DRW_texture_pool_query_2D(int w, int h, eGPUTextureFormat format, DrawEngineType *engine_type)
{
BLI_assert(drw_texture_format_supports_framebuffer(format));
GPUTexture *tex = GPU_viewport_texture_pool_query(DST.viewport, engine_type, w, h, format);
@@ -134,7 +131,7 @@ GPUTexture *DRW_texture_pool_query_2D(int w, int h, GPUTextureFormat format, Dra
return tex;
}
-void DRW_texture_ensure_fullscreen_2D(GPUTexture **tex, GPUTextureFormat format, DRWTextureFlag flags)
+void DRW_texture_ensure_fullscreen_2D(GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags)
{
if (*(tex) == NULL) {
const float *size = DRW_viewport_size_get();
@@ -142,7 +139,7 @@ void DRW_texture_ensure_fullscreen_2D(GPUTexture **tex, GPUTextureFormat format,
}
}
-void DRW_texture_ensure_2D(GPUTexture **tex, int w, int h, GPUTextureFormat format, DRWTextureFlag flags)
+void DRW_texture_ensure_2D(GPUTexture **tex, int w, int h, eGPUTextureFormat format, DRWTextureFlag flags)
{
if (*(tex) == NULL) {
*(tex) = DRW_texture_create_2D(w, h, format, flags, NULL);
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index 4c53049e772..cde63e7408b 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/intern/draw_view.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*
* Contains dynamic drawing using immediate mode
*/
@@ -28,27 +25,21 @@
#include "DNA_brush_types.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
-#include "DNA_world_types.h"
#include "DNA_view3d_types.h"
#include "ED_screen.h"
-#include "ED_transform.h"
#include "ED_view3d.h"
-#include "GPU_draw.h"
#include "GPU_shader.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "UI_resources.h"
-#include "WM_api.h"
#include "WM_types.h"
-#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_paint.h"
-#include "BKE_unit.h"
#include "DRW_render.h"
@@ -95,8 +86,8 @@ void DRW_draw_background(void)
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR_DITHER);
- UI_GetThemeColor3ubv(TH_LOW_GRAD, col_lo);
- UI_GetThemeColor3ubv(TH_HIGH_GRAD, col_hi);
+ UI_GetThemeColor3ubv(TH_BACK_GRAD, col_lo);
+ UI_GetThemeColor3ubv(TH_BACK, col_hi);
immBegin(GPU_PRIM_TRI_FAN, 4);
immAttr3ubv(color, col_lo);
@@ -118,17 +109,52 @@ void DRW_draw_background(void)
}
else {
/* Solid background Color */
- UI_ThemeClearColorAlpha(TH_HIGH_GRAD, 1.0f);
+ UI_ThemeClearColorAlpha(TH_BACK, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
}
+GPUBatch *DRW_draw_background_clipping_batch_from_rv3d(const RegionView3D *rv3d)
+{
+ const BoundBox *bb = rv3d->clipbb;
+ const uint clipping_index[6][4] = {
+ {0, 1, 2, 3},
+ {0, 4, 5, 1},
+ {4, 7, 6, 5},
+ {7, 3, 2, 6},
+ {1, 5, 6, 2},
+ {7, 4, 0, 3},
+ };
+ GPUVertBuf *vbo;
+ GPUIndexBuf *el;
+ GPUIndexBufBuilder elb = {0};
+
+ /* Elements */
+ GPU_indexbuf_init(&elb, GPU_PRIM_TRIS, ARRAY_SIZE(clipping_index) * 2, ARRAY_SIZE(bb->vec));
+ for (int i = 0; i < ARRAY_SIZE(clipping_index); i++) {
+ const uint *idx = clipping_index[i];
+ GPU_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]);
+ GPU_indexbuf_add_tri_verts(&elb, idx[0], idx[2], idx[3]);
+ }
+ el = GPU_indexbuf_build(&elb);
+
+ GPUVertFormat format = {0};
+ uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
+
+ vbo = GPU_vertbuf_create_with_format(&format);
+ GPU_vertbuf_data_alloc(vbo, ARRAY_SIZE(bb->vec));
+ GPU_vertbuf_attr_fill(vbo, pos_id, bb->vec);
+
+ return GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, el, GPU_BATCH_OWNS_VBO | GPU_BATCH_OWNS_INDEX);
+}
+
+
/* **************************** 3D Cursor ******************************** */
static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, ViewLayer *view_layer)
{
View3D *v3d = draw_ctx->v3d;
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) || (v3d->overlay.flag & V3D_OVERLAY_HIDE_CURSOR)) {
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) || (v3d->overlay.flag & V3D_OVERLAY_HIDE_CURSOR)) {
return false;
}
@@ -175,12 +201,18 @@ void DRW_draw_cursor(void)
if (is_cursor_visible(draw_ctx, scene, view_layer)) {
int co[2];
+
+ /* Get cursor data into quaternion form */
const View3DCursor *cursor = &scene->cursor;
+
if (ED_view3d_project_int_global(
ar, cursor->location, co, V3D_PROJ_TEST_NOP | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
RegionView3D *rv3d = ar->regiondata;
+ float cursor_quat[4];
+ BKE_scene_cursor_rot_to_quat(cursor, cursor_quat);
+
/* Draw nice Anti Aliased cursor. */
GPU_line_width(1.0f);
glEnable(GL_BLEND);
@@ -188,7 +220,12 @@ void DRW_draw_cursor(void)
float eps = 1e-5f;
rv3d->viewquat[0] = -rv3d->viewquat[0];
- const bool is_aligned = compare_v4v4(cursor->rotation, rv3d->viewquat, eps);
+ bool is_aligned = compare_v4v4(cursor_quat, rv3d->viewquat, eps);
+ if (is_aligned == false) {
+ float tquat[4];
+ rotation_between_quats_to_quat(tquat, rv3d->viewquat, cursor_quat);
+ is_aligned = tquat[0] - eps < -1.0f;
+ }
rv3d->viewquat[0] = -rv3d->viewquat[0];
/* Draw lines */
@@ -215,7 +252,7 @@ void DRW_draw_cursor(void)
for (int axis = 0; axis < 3; axis++) {
float axis_vec[3] = {0};
axis_vec[axis] = scale;
- mul_qt_v3(cursor->rotation, axis_vec);
+ mul_qt_v3(cursor_quat, axis_vec);
CURSOR_EDGE(axis_vec, axis, +);
CURSOR_EDGE(axis_vec, axis, -);
}
diff --git a/source/blender/draw/intern/draw_view.h b/source/blender/draw/intern/draw_view.h
index 01a342f0ae4..08a8e984c87 100644
--- a/source/blender/draw/intern/draw_view.h
+++ b/source/blender/draw/intern/draw_view.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file draw_view.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRAW_VIEW_H__
@@ -32,4 +29,6 @@ void DRW_draw_cursor(void);
void DRW_draw_gizmo_3d(void);
void DRW_draw_gizmo_2d(void);
+struct GPUBatch *DRW_draw_background_clipping_batch_from_rv3d(const struct RegionView3D *rv3d);
+
#endif /* __DRAW_VIEW_H__ */
diff --git a/source/blender/draw/modes/draw_mode_engines.h b/source/blender/draw/modes/draw_mode_engines.h
index 059724384ea..0d3d5cf7c59 100644
--- a/source/blender/draw/modes/draw_mode_engines.h
+++ b/source/blender/draw/modes/draw_mode_engines.h
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/draw_mode_engines.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __DRAW_MODE_ENGINES_H__
@@ -36,7 +33,6 @@ extern DrawEngineType draw_engine_edit_text_type;
extern DrawEngineType draw_engine_motion_path_type;
extern DrawEngineType draw_engine_paint_texture_type;
extern DrawEngineType draw_engine_paint_vertex_type;
-extern DrawEngineType draw_engine_paint_weight_type;
extern DrawEngineType draw_engine_particle_type;
extern DrawEngineType draw_engine_pose_type;
extern DrawEngineType draw_engine_sculpt_type;
diff --git a/source/blender/draw/modes/edit_armature_mode.c b/source/blender/draw/modes/edit_armature_mode.c
index 02f208900e4..2c47667a4e9 100644
--- a/source/blender/draw/modes/edit_armature_mode.c
+++ b/source/blender/draw/modes/edit_armature_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/edit_armature_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_engine.h"
@@ -30,14 +27,12 @@
#include "DNA_view3d_types.h"
#include "draw_common.h"
-
#include "draw_mode_engines.h"
-extern GlobalsUboStorage ts;
-
/* *********** LISTS *********** */
typedef struct EDIT_ARMATURE_PassList {
struct DRWPass *bone_solid[2];
+ struct DRWPass *bone_transp[2];
struct DRWPass *bone_wire[2];
struct DRWPass *bone_outline[2];
struct DRWPass *bone_envelope[2];
@@ -75,13 +70,13 @@ static void EDIT_ARMATURE_cache_init(void *vedata)
/* Alloc transient pointers */
stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__);
}
- stl->g_data->transparent_bones = (draw_ctx->v3d->overlay.arm_flag & V3D_OVERLAY_ARM_TRANSP_BONES) != 0;
+ stl->g_data->transparent_bones = (draw_ctx->v3d->shading.type == OB_WIRE);
for (int i = 0; i < 2; ++i) {
/* Solid bones */
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK;
- state |= (stl->g_data->transparent_bones) ? DRW_STATE_BLEND : DRW_STATE_WRITE_DEPTH;
- psl->bone_solid[i] = DRW_pass_create("Bone Solid Pass", state);
+ psl->bone_solid[i] = DRW_pass_create("Bone Solid Pass", state | DRW_STATE_WRITE_DEPTH);
+ psl->bone_transp[i] = DRW_pass_create("Bone Transp Pass", state | DRW_STATE_BLEND);
/* Bones Outline */
state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
@@ -116,16 +111,17 @@ static void EDIT_ARMATURE_cache_populate(void *vedata, Object *ob)
EDIT_ARMATURE_StorageList *stl = ((EDIT_ARMATURE_Data *)vedata)->stl;
int ghost = (ob->dtx & OB_DRAWXRAY) ? 1 : 0;
+ bool transp = (stl->g_data->transparent_bones || (ob->dt <= OB_WIRE));
DRWArmaturePasses passes = {
- .bone_solid = psl->bone_solid[ghost],
+ .bone_solid = (transp) ? psl->bone_transp[ghost] : psl->bone_solid[ghost],
.bone_outline = psl->bone_outline[ghost],
.bone_wire = psl->bone_wire[ghost],
.bone_envelope = psl->bone_envelope[ghost],
.bone_axes = psl->bone_axes,
.relationship_lines = psl->relationship[ghost],
};
- DRW_shgroup_armature_edit(ob, passes, stl->g_data->transparent_bones);
+ DRW_shgroup_armature_edit(ob, passes, transp);
}
}
}
@@ -133,23 +129,27 @@ static void EDIT_ARMATURE_cache_populate(void *vedata, Object *ob)
static void EDIT_ARMATURE_draw_scene(void *vedata)
{
EDIT_ARMATURE_PassList *psl = ((EDIT_ARMATURE_Data *)vedata)->psl;
- EDIT_ARMATURE_StorageList *stl = ((EDIT_ARMATURE_Data *)vedata)->stl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
- DRW_draw_pass(psl->bone_envelope[0]);
-
- if (stl->g_data->transparent_bones) {
- /* For performance reason, avoid blending on MS target. */
+ if (DRW_state_is_select()) {
+ DRW_draw_pass(psl->bone_outline[0]);
DRW_draw_pass(psl->bone_solid[0]);
+ DRW_draw_pass(psl->bone_wire[0]);
+ DRW_draw_pass(psl->bone_outline[1]);
+ DRW_draw_pass(psl->bone_solid[1]);
+ DRW_draw_pass(psl->bone_wire[1]);
+ return;
}
- MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
+ DRW_draw_pass(psl->bone_envelope[0]);
- if (!stl->g_data->transparent_bones) {
- DRW_draw_pass(psl->bone_solid[0]);
- }
+ /* For performance reason, avoid blending on MS target. */
+ DRW_draw_pass(psl->bone_transp[0]);
+
+ MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
+ DRW_draw_pass(psl->bone_solid[0]);
DRW_draw_pass(psl->bone_outline[0]);
DRW_draw_pass(psl->bone_wire[0]);
DRW_draw_pass(psl->relationship[0]);
@@ -158,6 +158,7 @@ static void EDIT_ARMATURE_draw_scene(void *vedata)
if (!DRW_pass_is_empty(psl->bone_envelope[1]) ||
!DRW_pass_is_empty(psl->bone_solid[1]) ||
+ !DRW_pass_is_empty(psl->bone_transp[1]) ||
!DRW_pass_is_empty(psl->bone_outline[1]) ||
!DRW_pass_is_empty(psl->bone_wire[1]) ||
!DRW_pass_is_empty(psl->relationship[1]))
@@ -169,6 +170,7 @@ static void EDIT_ARMATURE_draw_scene(void *vedata)
DRW_draw_pass(psl->bone_envelope[1]);
DRW_draw_pass(psl->bone_solid[1]);
+ DRW_draw_pass(psl->bone_transp[1]);
DRW_draw_pass(psl->bone_outline[1]);
DRW_draw_pass(psl->bone_wire[1]);
DRW_draw_pass(psl->relationship[1]);
diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c
index b3cb2cb3d80..c2841549270 100644
--- a/source/blender/draw/modes/edit_curve_mode.c
+++ b/source/blender/draw/modes/edit_curve_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/edit_curve_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_engine.h"
@@ -33,17 +30,13 @@
/* If builtin shaders are needed */
#include "GPU_shader.h"
-#include "GPU_batch.h"
#include "draw_common.h"
-
#include "draw_mode_engines.h"
/* If needed, contains all global/Theme colors
* Add needed theme colors / values to DRW_globals_update() and update UBO
* Not needed for constant color. */
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GlobalsUboStorage ts; /* draw_common.c */
extern char datatoc_common_globals_lib_glsl[];
extern char datatoc_edit_curve_overlay_loosevert_vert_glsl[];
@@ -83,11 +76,16 @@ typedef struct EDIT_CURVE_Data {
/* *********** STATIC *********** */
-static struct {
+
+typedef struct EDIT_CURVE_Shaders {
GPUShader *wire_sh;
GPUShader *wire_normals_sh;
GPUShader *overlay_edge_sh; /* handles and nurbs control cage */
GPUShader *overlay_vert_sh;
+} EDIT_CURVE_Shaders;
+
+static struct {
+ EDIT_CURVE_Shaders sh_data[GPU_SHADER_CFG_LEN];
} e_data = {NULL}; /* Engine data */
typedef struct EDIT_CURVE_PrivateData {
@@ -108,29 +106,44 @@ typedef struct EDIT_CURVE_PrivateData {
* (Optional) */
static void EDIT_CURVE_engine_init(void *UNUSED(vedata))
{
- if (!e_data.wire_sh) {
- e_data.wire_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ EDIT_CURVE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d);
}
- if (!e_data.wire_normals_sh) {
- e_data.wire_normals_sh = DRW_shader_create(
- datatoc_edit_curve_overlay_normals_vert_glsl, NULL,
- datatoc_gpu_shader_uniform_color_frag_glsl, NULL);
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
+
+ if (!sh_data->wire_sh) {
+ sh_data->wire_sh = GPU_shader_get_builtin_shader_with_config(
+ GPU_SHADER_3D_UNIFORM_COLOR, draw_ctx->sh_cfg);
+ }
+
+ if (!sh_data->wire_normals_sh) {
+ sh_data->wire_normals_sh = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_edit_curve_overlay_normals_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
- if (!e_data.overlay_edge_sh) {
- e_data.overlay_edge_sh = DRW_shader_create_with_lib(
- datatoc_edit_curve_overlay_handle_vert_glsl,
- datatoc_edit_curve_overlay_handle_geom_glsl,
- datatoc_gpu_shader_3D_smooth_color_frag_glsl,
- datatoc_common_globals_lib_glsl, NULL);
+ if (!sh_data->overlay_edge_sh) {
+ sh_data->overlay_edge_sh = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_edit_curve_overlay_handle_vert_glsl, NULL},
+ .geom = (const char *[]){sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_edit_curve_overlay_handle_geom_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_3D_smooth_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
- if (!e_data.overlay_vert_sh) {
- e_data.overlay_vert_sh = DRW_shader_create_with_lib(
- datatoc_edit_curve_overlay_loosevert_vert_glsl, NULL,
- datatoc_gpu_shader_point_varying_color_frag_glsl,
- datatoc_common_globals_lib_glsl, NULL);
+ if (!sh_data->overlay_vert_sh) {
+ sh_data->overlay_vert_sh = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_edit_curve_overlay_loosevert_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_point_varying_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
+
}
}
@@ -142,6 +155,8 @@ static void EDIT_CURVE_cache_init(void *vedata)
EDIT_CURVE_StorageList *stl = ((EDIT_CURVE_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
+ const RegionView3D *rv3d = draw_ctx->rv3d;
+ EDIT_CURVE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
if (!stl->g_data) {
/* Alloc transient pointers */
@@ -158,24 +173,33 @@ static void EDIT_CURVE_cache_init(void *vedata)
"Curve Wire",
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE);
- grp = DRW_shgroup_create(e_data.wire_sh, psl->wire_pass);
- DRW_shgroup_uniform_vec4(grp, "color", ts.colorWireEdit, 1);
+ grp = DRW_shgroup_create(sh_data->wire_sh, psl->wire_pass);
+ DRW_shgroup_uniform_vec4(grp, "color", G_draw.block.colorWireEdit, 1);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
+ }
stl->g_data->wire_shgrp = grp;
- grp = DRW_shgroup_create(e_data.wire_normals_sh, psl->wire_pass);
- DRW_shgroup_uniform_vec4(grp, "color", ts.colorWireEdit, 1);
+ grp = DRW_shgroup_create(sh_data->wire_normals_sh, psl->wire_pass);
+ DRW_shgroup_uniform_vec4(grp, "color", G_draw.block.colorWireEdit, 1);
DRW_shgroup_uniform_float_copy(grp, "normalSize", v3d->overlay.normals_length);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
+ }
stl->g_data->wire_normals_shgrp = grp;
psl->overlay_edge_pass = DRW_pass_create(
"Curve Handle Overlay",
DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND);
- grp = DRW_shgroup_create(e_data.overlay_edge_sh, psl->overlay_edge_pass);
- DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo);
+ grp = DRW_shgroup_create(sh_data->overlay_edge_sh, psl->overlay_edge_pass);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
DRW_shgroup_uniform_bool(grp, "showCurveHandles", &stl->g_data->show_handles, 1);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
+ }
stl->g_data->overlay_edge_shgrp = grp;
@@ -183,8 +207,11 @@ static void EDIT_CURVE_cache_init(void *vedata)
"Curve Vert Overlay",
DRW_STATE_WRITE_COLOR | DRW_STATE_POINT);
- grp = DRW_shgroup_create(e_data.overlay_vert_sh, psl->overlay_vert_pass);
- DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo);
+ grp = DRW_shgroup_create(sh_data->overlay_vert_sh, psl->overlay_vert_pass);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
+ }
stl->g_data->overlay_vert_shgrp = grp;
}
}
@@ -252,6 +279,8 @@ static void EDIT_CURVE_draw_scene(void *vedata)
/* Thoses passes don't write to depth and are AA'ed using other tricks. */
DRW_draw_pass(psl->overlay_edge_pass);
DRW_draw_pass(psl->overlay_vert_pass);
+
+ DRW_state_clip_planes_reset();
}
/* Cleanup when destroying the engine.
@@ -259,9 +288,15 @@ static void EDIT_CURVE_draw_scene(void *vedata)
* Mostly used for freeing shaders */
static void EDIT_CURVE_engine_free(void)
{
- DRW_SHADER_FREE_SAFE(e_data.wire_normals_sh);
- DRW_SHADER_FREE_SAFE(e_data.overlay_edge_sh);
- DRW_SHADER_FREE_SAFE(e_data.overlay_vert_sh);
+ for (int sh_data_index = 0; sh_data_index < ARRAY_SIZE(e_data.sh_data); sh_data_index++) {
+ EDIT_CURVE_Shaders *sh_data = &e_data.sh_data[sh_data_index];
+ /* Don't free builtins. */
+ sh_data->wire_sh = NULL;
+ GPUShader **sh_data_as_array = (GPUShader **)sh_data;
+ for (int i = 0; i < (sizeof(EDIT_CURVE_Shaders) / sizeof(GPUShader *)); i++) {
+ DRW_SHADER_FREE_SAFE(sh_data_as_array[i]);
+ }
+ }
}
static const DrawEngineDataSize EDIT_CURVE_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_CURVE_Data);
diff --git a/source/blender/draw/modes/edit_lattice_mode.c b/source/blender/draw/modes/edit_lattice_mode.c
index 1d4d4cd8362..70870292556 100644
--- a/source/blender/draw/modes/edit_lattice_mode.c
+++ b/source/blender/draw/modes/edit_lattice_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/edit_lattice_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_engine.h"
@@ -32,23 +29,13 @@
#include "GPU_shader.h"
#include "draw_common.h"
-
#include "draw_mode_engines.h"
-/* If needed, contains all global/Theme colors
- * Add needed theme colors / values to DRW_globals_update() and update UBO
- * Not needed for constant color. */
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GlobalsUboStorage ts; /* draw_common.c */
-
extern char datatoc_common_globals_lib_glsl[];
+
extern char datatoc_edit_lattice_overlay_loosevert_vert_glsl[];
extern char datatoc_edit_lattice_overlay_frag_glsl[];
-extern char datatoc_gpu_shader_3D_vert_glsl[];
-extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
-extern char datatoc_gpu_shader_point_uniform_color_frag_glsl[];
-
/* *********** LISTS *********** */
/* All lists are per viewport specific datas.
* They are all free when viewport changes engines
@@ -97,6 +84,11 @@ typedef struct EDIT_LATTICE_Data {
EDIT_LATTICE_StorageList *stl;
} EDIT_LATTICE_Data;
+typedef struct EDIT_LATTICE_Shaders {
+ GPUShader *wire;
+ GPUShader *overlay_vert;
+} EDIT_LATTICE_Shaders;
+
/* *********** STATIC *********** */
static struct {
@@ -104,9 +96,8 @@ static struct {
* Add sources to source/blender/draw/modes/shaders
* init in EDIT_LATTICE_engine_init();
* free in EDIT_LATTICE_engine_free(); */
- GPUShader *wire_sh;
- GPUShader *overlay_vert_sh;
+ EDIT_LATTICE_Shaders sh_data[GPU_SHADER_CFG_LEN];
} e_data = {NULL}; /* Engine data */
@@ -145,15 +136,31 @@ static void EDIT_LATTICE_engine_init(void *vedata)
* tex, 2);
*/
- if (!e_data.wire_sh) {
- e_data.wire_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_SMOOTH_COLOR);
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d);
}
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
+
+ if (!sh_data->wire) {
+ sh_data->wire = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_SMOOTH_COLOR, draw_ctx->sh_cfg);
+ }
+
+ if (!sh_data->overlay_vert) {
+ sh_data->overlay_vert = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){
+ sh_cfg_data->lib,
+ datatoc_common_globals_lib_glsl,
+ datatoc_edit_lattice_overlay_loosevert_vert_glsl,
+ NULL},
+ .frag = (const char *[]){
+ datatoc_common_globals_lib_glsl,
+ datatoc_edit_lattice_overlay_frag_glsl,
+ NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
- if (!e_data.overlay_vert_sh) {
- e_data.overlay_vert_sh = DRW_shader_create_with_lib(
- datatoc_edit_lattice_overlay_loosevert_vert_glsl, NULL,
- datatoc_edit_lattice_overlay_frag_glsl,
- datatoc_common_globals_lib_glsl, NULL);
}
}
@@ -164,6 +171,10 @@ static void EDIT_LATTICE_cache_init(void *vedata)
EDIT_LATTICE_PassList *psl = ((EDIT_LATTICE_Data *)vedata)->psl;
EDIT_LATTICE_StorageList *stl = ((EDIT_LATTICE_Data *)vedata)->stl;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ RegionView3D *rv3d = draw_ctx->rv3d;
+ EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+
if (!stl->g_data) {
/* Alloc transient pointers */
stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
@@ -173,14 +184,21 @@ static void EDIT_LATTICE_cache_init(void *vedata)
psl->wire_pass = DRW_pass_create(
"Lattice Wire",
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE);
- stl->g_data->wire_shgrp = DRW_shgroup_create(e_data.wire_sh, psl->wire_pass);
+ stl->g_data->wire_shgrp = DRW_shgroup_create(sh_data->wire, psl->wire_pass);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->wire_shgrp, rv3d);
+ }
psl->vert_pass = DRW_pass_create(
"Lattice Verts",
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_POINT);
- stl->g_data->vert_shgrp = DRW_shgroup_create(e_data.overlay_vert_sh, psl->vert_pass);
+ stl->g_data->vert_shgrp = DRW_shgroup_create(sh_data->overlay_vert, psl->vert_pass);
+ DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", G_draw.block_ubo);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->vert_shgrp, rv3d);
+ }
+
- DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", globals_ubo);
}
}
@@ -255,8 +273,16 @@ static void EDIT_LATTICE_draw_scene(void *vedata)
* Mostly used for freeing shaders */
static void EDIT_LATTICE_engine_free(void)
{
- // Currently built-in, dont free
- DRW_SHADER_FREE_SAFE(e_data.overlay_vert_sh);
+ for (int sh_data_index = 0; sh_data_index < ARRAY_SIZE(e_data.sh_data); sh_data_index++) {
+ EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[sh_data_index];
+ /* Don't free builtins. */
+ sh_data->wire = NULL;
+ GPUShader **sh_data_as_array = (GPUShader **)sh_data;
+ for (int i = 0; i < (sizeof(EDIT_LATTICE_Shaders) / sizeof(GPUShader *)); i++) {
+ DRW_SHADER_FREE_SAFE(sh_data_as_array[i]);
+ }
+ }
+
}
static const DrawEngineDataSize EDIT_LATTICE_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_LATTICE_Data);
diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c
index 569ec59c93d..9afb9ce40a0 100644
--- a/source/blender/draw/modes/edit_mesh_mode.c
+++ b/source/blender/draw/modes/edit_mesh_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,18 +13,17 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/edit_mesh_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_engine.h"
#include "DRW_render.h"
-#include "GPU_shader.h"
+#include "GPU_extensions.h"
#include "DNA_mesh_types.h"
#include "DNA_view3d_types.h"
@@ -41,13 +38,10 @@
#include "BKE_editmesh.h"
#include "BKE_object.h"
-#include "BLI_dynstr.h"
-
-
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GlobalsUboStorage ts; /* draw_common.c */
+#include "BIF_glutil.h"
-extern struct GPUTexture *globals_weight_ramp; /* draw_common.c */
+#include "BLI_dynstr.h"
+#include "BLI_string_utils.h"
extern char datatoc_paint_weight_vert_glsl[];
extern char datatoc_paint_weight_frag_glsl[];
@@ -55,11 +49,7 @@ extern char datatoc_paint_weight_frag_glsl[];
extern char datatoc_edit_mesh_overlay_common_lib_glsl[];
extern char datatoc_edit_mesh_overlay_frag_glsl[];
extern char datatoc_edit_mesh_overlay_vert_glsl[];
-extern char datatoc_edit_mesh_overlay_geom_tri_glsl[];
-extern char datatoc_edit_mesh_overlay_geom_edge_glsl[];
-extern char datatoc_edit_mesh_overlay_points_vert_glsl[];
-extern char datatoc_edit_mesh_overlay_facedot_frag_glsl[];
-extern char datatoc_edit_mesh_overlay_facedot_vert_glsl[];
+extern char datatoc_edit_mesh_overlay_geom_glsl[];
extern char datatoc_edit_mesh_overlay_mix_frag_glsl[];
extern char datatoc_edit_mesh_overlay_facefill_vert_glsl[];
extern char datatoc_edit_mesh_overlay_facefill_frag_glsl[];
@@ -68,6 +58,7 @@ extern char datatoc_edit_normals_geom_glsl[];
extern char datatoc_common_globals_lib_glsl[];
extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
+extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
extern char datatoc_gpu_shader_flat_color_frag_glsl[];
extern char datatoc_gpu_shader_point_varying_color_frag_glsl[];
extern char datatoc_gpu_shader_depth_only_frag_glsl[];
@@ -101,27 +92,33 @@ typedef struct EDIT_MESH_Data {
EDIT_MESH_StorageList *stl;
} EDIT_MESH_Data;
-/* *********** STATIC *********** */
#define MAX_SHADERS 16
-static struct {
+/** Can only contain shaders (freed as array). */
+typedef struct EDIT_MESH_Shaders {
/* weight */
- GPUShader *weight_face_shader;
+ GPUShader *weight_face;
/* Geometry */
- GPUShader *overlay_tri_sh_cache[MAX_SHADERS];
- GPUShader *overlay_loose_edge_sh_cache[MAX_SHADERS];
-
- GPUShader *overlay_vert_sh;
- GPUShader *overlay_lvert_sh;
- GPUShader *overlay_facedot_sh;
- GPUShader *overlay_mix_sh;
- GPUShader *overlay_facefill_sh;
- GPUShader *normals_face_sh;
- GPUShader *normals_loop_sh;
- GPUShader *normals_sh;
- GPUShader *depth_sh;
- GPUShader *ghost_clear_depth_sh;
+ GPUShader *overlay_vert;
+ GPUShader *overlay_edge;
+ GPUShader *overlay_edge_flat;
+ GPUShader *overlay_face;
+ GPUShader *overlay_facedot;
+
+ GPUShader *overlay_mix;
+ GPUShader *overlay_facefill;
+ GPUShader *normals_face;
+ GPUShader *normals_loop;
+ GPUShader *normals;
+ GPUShader *depth;
+ GPUShader *ghost_clear_depth;
+} EDIT_MESH_Shaders;
+
+/* *********** STATIC *********** */
+static struct {
+ EDIT_MESH_Shaders sh_data[GPU_SHADER_CFG_LEN];
+
/* temp buffer texture */
struct GPUTexture *occlude_wire_depth_tx;
struct GPUTexture *occlude_wire_color_tx;
@@ -136,12 +133,10 @@ typedef struct EDIT_MESH_PrivateData {
DRWShadingGroup *vnormals_shgrp;
DRWShadingGroup *lnormals_shgrp;
+ DRWShadingGroup *vert_shgrp;
+ DRWShadingGroup *edge_shgrp;
DRWShadingGroup *face_shgrp;
DRWShadingGroup *face_cage_shgrp;
-
- DRWShadingGroup *verts_shgrp;
- DRWShadingGroup *ledges_shgrp;
- DRWShadingGroup *lverts_shgrp;
DRWShadingGroup *facedot_shgrp;
DRWShadingGroup *facefill_occluded_shgrp;
@@ -152,109 +147,18 @@ typedef struct EDIT_MESH_PrivateData {
bool do_zbufclip;
bool do_faces;
bool do_edges;
- float edge_width_scale;
} EDIT_MESH_PrivateData; /* Transient data */
/* *********** FUNCTIONS *********** */
-static int EDIT_MESH_sh_index(ToolSettings *tsettings, RegionView3D *rv3d, bool supports_fast_mode)
-{
- int result = tsettings->selectmode << 1;
- if (supports_fast_mode) {
- SET_FLAG_FROM_TEST(result, (rv3d->rflag & RV3D_NAVIGATING), 1 << 0);
- }
- return result;
-}
-
-static char *EDIT_MESH_sh_defines(ToolSettings *tsettings, RegionView3D *rv3d, bool anti_alias, bool looseedge)
-{
- const int selectmode = tsettings->selectmode;
- const int fast_mode = rv3d->rflag & RV3D_NAVIGATING;
-
- char *str = NULL;
- DynStr *ds = BLI_dynstr_new();
-
- if (selectmode & SCE_SELECT_VERTEX) {
- BLI_dynstr_append(ds, "#define VERTEX_SELECTION\n");
- }
- if (selectmode & SCE_SELECT_EDGE) {
- BLI_dynstr_append(ds, "#define EDGE_SELECTION\n");
- }
-
- if (selectmode & SCE_SELECT_FACE) {
- BLI_dynstr_append(ds, "#define FACE_SELECTION\n");
- }
-
- if (!fast_mode || looseedge) {
- BLI_dynstr_append(ds, "#define EDGE_FIX\n");
- }
-
- if (anti_alias) {
- BLI_dynstr_append(ds, "#define ANTI_ALIASING\n");
- }
-
- if (!looseedge) {
- BLI_dynstr_append(ds, "#define VERTEX_FACING\n");
- }
-
- str = BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
- return str;
-}
-static char *EDIT_MESH_sh_lib(void)
-{
- char *str = NULL;
- DynStr *ds = BLI_dynstr_new();
-
- BLI_dynstr_append(ds, datatoc_common_globals_lib_glsl);
- BLI_dynstr_append(ds, datatoc_edit_mesh_overlay_common_lib_glsl);
-
- str = BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
- return str;
-}
-
-static GPUShader *EDIT_MESH_ensure_shader(
- ToolSettings *tsettings, RegionView3D *rv3d, bool supports_fast_mode, bool looseedge)
-{
- const int index = EDIT_MESH_sh_index(tsettings, rv3d, supports_fast_mode);
- const int fast_mode = rv3d->rflag & RV3D_NAVIGATING;
- if (looseedge) {
- if (!e_data.overlay_loose_edge_sh_cache[index]) {
- char *defines = EDIT_MESH_sh_defines(tsettings, rv3d, true, true);
- char *lib = EDIT_MESH_sh_lib();
- e_data.overlay_loose_edge_sh_cache[index] = DRW_shader_create_with_lib(
- datatoc_edit_mesh_overlay_vert_glsl,
- datatoc_edit_mesh_overlay_geom_edge_glsl,
- datatoc_edit_mesh_overlay_frag_glsl,
- lib,
- defines);
- MEM_freeN(lib);
- MEM_freeN(defines);
- }
- return e_data.overlay_loose_edge_sh_cache[index];
- }
- else {
- if (!e_data.overlay_tri_sh_cache[index]) {
- char *defines = EDIT_MESH_sh_defines(tsettings, rv3d, true, false);
- char *lib = EDIT_MESH_sh_lib();
- e_data.overlay_tri_sh_cache[index] = DRW_shader_create_with_lib(
- datatoc_edit_mesh_overlay_vert_glsl,
- fast_mode ? NULL : datatoc_edit_mesh_overlay_geom_tri_glsl,
- datatoc_edit_mesh_overlay_frag_glsl,
- lib,
- defines);
- MEM_freeN(lib);
- MEM_freeN(defines);
- }
- return e_data.overlay_tri_sh_cache[index];
- }
-}
static void EDIT_MESH_engine_init(void *vedata)
{
EDIT_MESH_FramebufferList *fbl = ((EDIT_MESH_Data *)vedata)->fbl;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ EDIT_MESH_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+
const float *viewport_size = DRW_viewport_size_get();
const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
@@ -268,138 +172,183 @@ static void EDIT_MESH_engine_init(void *vedata)
GPU_ATTACHMENT_TEXTURE(e_data.occlude_wire_color_tx)
});
- if (!e_data.weight_face_shader) {
- e_data.weight_face_shader = DRW_shader_create_with_lib(
- datatoc_paint_weight_vert_glsl, NULL,
- datatoc_paint_weight_frag_glsl,
- datatoc_common_globals_lib_glsl, NULL);
- }
-
- if (!e_data.overlay_vert_sh) {
- char *lib = EDIT_MESH_sh_lib();
- e_data.overlay_vert_sh = DRW_shader_create_with_lib(
- datatoc_edit_mesh_overlay_points_vert_glsl, NULL,
- datatoc_gpu_shader_point_varying_color_frag_glsl, lib,
- "#define VERTEX_FACING\n");
- e_data.overlay_lvert_sh = DRW_shader_create_with_lib(
- datatoc_edit_mesh_overlay_points_vert_glsl, NULL,
- datatoc_gpu_shader_point_varying_color_frag_glsl, lib,
- NULL);
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d);
+ }
+
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
+
+ if (!sh_data->weight_face) {
+ sh_data->weight_face = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_paint_weight_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_common_globals_lib_glsl, datatoc_paint_weight_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
+
+ char *lib = BLI_string_joinN(sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_edit_mesh_overlay_common_lib_glsl);
+ /* Use geometry shader to draw edge wireframe. This ensure us
+ * the same result accross platforms and more flexibility. But
+ * we pay the cost of running a geometry shader.
+ * In the future we might consider using only the vertex shader
+ * and loading data manually with buffer textures. */
+ const bool use_geom_shader = true;
+ const char *geom_sh_code[] = {lib, datatoc_edit_mesh_overlay_geom_glsl, NULL};
+ if (!use_geom_shader) {
+ geom_sh_code[0] = NULL;
+ }
+ const char *use_geom_def = use_geom_shader ? "#define USE_GEOM_SHADER\n" : "";
+ const char *use_smooth_def = (U.uiflag2 & USER_EDIT_MODE_SMOOTH_WIRE) ? "#define USE_SMOOTH_WIRE\n" : "";
+ sh_data->overlay_face = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){lib, datatoc_edit_mesh_overlay_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_3D_smooth_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, "#define FACE\n", NULL},
+ });
+ sh_data->overlay_edge = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){lib, datatoc_edit_mesh_overlay_vert_glsl, NULL},
+ .frag = (const char *[]){lib, datatoc_edit_mesh_overlay_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, use_geom_def, use_smooth_def, "#define EDGE\n", NULL},
+ .geom = (use_geom_shader) ? geom_sh_code : NULL,
+ });
+ sh_data->overlay_edge_flat = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){lib, datatoc_edit_mesh_overlay_vert_glsl, NULL},
+ .frag = (const char *[]){lib, datatoc_edit_mesh_overlay_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, use_geom_def, use_smooth_def, "#define EDGE\n", "#define FLAT\n", NULL},
+ .geom = (use_geom_shader) ? geom_sh_code : NULL,
+ });
+ sh_data->overlay_vert = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){lib, datatoc_edit_mesh_overlay_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_point_varying_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, "#define VERT\n", NULL},
+ });
+ sh_data->overlay_facedot = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){lib, datatoc_edit_mesh_overlay_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_point_varying_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, "#define FACEDOT\n", NULL},
+ });
+ sh_data->overlay_facefill = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){lib, datatoc_edit_mesh_overlay_facefill_vert_glsl, NULL},
+ .frag = (const char *[]){lib, datatoc_edit_mesh_overlay_facefill_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
MEM_freeN(lib);
- }
- if (!e_data.overlay_facedot_sh) {
- e_data.overlay_facedot_sh = DRW_shader_create_with_lib(
- datatoc_edit_mesh_overlay_facedot_vert_glsl, NULL,
- datatoc_edit_mesh_overlay_facedot_frag_glsl,
- datatoc_common_globals_lib_glsl,
- "#define VERTEX_FACING\n");
- }
- if (!e_data.overlay_mix_sh) {
- e_data.overlay_mix_sh = DRW_shader_create_fullscreen(datatoc_edit_mesh_overlay_mix_frag_glsl, NULL);
- }
- if (!e_data.overlay_facefill_sh) {
- e_data.overlay_facefill_sh = DRW_shader_create_with_lib(
- datatoc_edit_mesh_overlay_facefill_vert_glsl, NULL,
- datatoc_edit_mesh_overlay_facefill_frag_glsl,
- datatoc_common_globals_lib_glsl, NULL);
- }
- if (!e_data.normals_face_sh) {
- e_data.normals_face_sh = DRW_shader_create(
- datatoc_edit_normals_vert_glsl,
- datatoc_edit_normals_geom_glsl,
- datatoc_gpu_shader_uniform_color_frag_glsl,
- "#define FACE_NORMALS\n");
- }
- if (!e_data.normals_loop_sh) {
- e_data.normals_loop_sh = DRW_shader_create(
- datatoc_edit_normals_vert_glsl,
- datatoc_edit_normals_geom_glsl,
- datatoc_gpu_shader_uniform_color_frag_glsl,
- "#define LOOP_NORMALS\n");
- }
- if (!e_data.normals_sh) {
- e_data.normals_sh = DRW_shader_create(
- datatoc_edit_normals_vert_glsl,
- datatoc_edit_normals_geom_glsl,
- datatoc_gpu_shader_uniform_color_frag_glsl, NULL);
- }
- if (!e_data.depth_sh) {
- e_data.depth_sh = DRW_shader_create_3D_depth_only();
- }
- if (!e_data.ghost_clear_depth_sh) {
- e_data.ghost_clear_depth_sh = DRW_shader_create_fullscreen(datatoc_gpu_shader_depth_only_frag_glsl, NULL);
- }
+ sh_data->overlay_mix = DRW_shader_create_fullscreen(datatoc_edit_mesh_overlay_mix_frag_glsl, NULL);
+
+ sh_data->normals_face = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_edit_normals_vert_glsl, NULL},
+ .geom = (const char *[]){sh_cfg_data->lib, datatoc_edit_normals_geom_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, "#define FACE_NORMALS\n", NULL},
+ });
+
+ sh_data->normals_loop = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_edit_normals_vert_glsl, NULL},
+ .geom = (const char *[]){sh_cfg_data->lib, datatoc_edit_normals_geom_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, "#define LOOP_NORMALS\n", NULL},
+ });
+
+ sh_data->normals = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_edit_normals_vert_glsl, NULL},
+ .geom = (const char *[]){sh_cfg_data->lib, datatoc_edit_normals_geom_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
+
+ sh_data->depth = DRW_shader_create_3D_depth_only(draw_ctx->sh_cfg);
+
+ sh_data->ghost_clear_depth = DRW_shader_create_fullscreen(datatoc_gpu_shader_depth_only_frag_glsl, NULL);
+ }
}
static DRWPass *edit_mesh_create_overlay_pass(
- float *face_alpha, float *edge_width_scale, int *data_mask, bool do_edges, bool xray,
+ float *face_alpha, int *data_mask, bool do_edges, bool UNUSED(xray),
DRWState statemod,
- DRWShadingGroup **r_face_shgrp, DRWShadingGroup **r_face_cage_shgrp,
- DRWShadingGroup **r_verts_shgrp, DRWShadingGroup **r_ledges_shgrp,
- DRWShadingGroup **r_lverts_shgrp, DRWShadingGroup **r_facedot_shgrp)
+ DRWShadingGroup **r_face_shgrp, DRWShadingGroup **r_face_cage_shgrp, DRWShadingGroup **r_facedot_shgrp,
+ DRWShadingGroup **r_edge_shgrp, DRWShadingGroup **r_vert_shgrp)
{
- GPUShader *tri_sh, *ledge_sh;
const DRWContextState *draw_ctx = DRW_context_state_get();
RegionView3D *rv3d = draw_ctx->rv3d;
Scene *scene = draw_ctx->scene;
ToolSettings *tsettings = scene->toolsettings;
- const int fast_mode = rv3d->rflag & RV3D_NAVIGATING;
+ EDIT_MESH_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+ const bool select_vert = (tsettings->selectmode & SCE_SELECT_VERTEX) != 0;
+ const bool select_face = (tsettings->selectmode & SCE_SELECT_FACE) != 0;
+ const bool select_edge = (tsettings->selectmode & SCE_SELECT_EDGE) != 0;
+ const bool show_wide_edge = select_edge && !(draw_ctx->v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT);
- ledge_sh = EDIT_MESH_ensure_shader(tsettings, rv3d, false, true);
- tri_sh = EDIT_MESH_ensure_shader(tsettings, rv3d, true, false);
+ float winmat[4][4];
+ float viewdist = rv3d->dist;
+ DRW_viewport_matrix_get(winmat, DRW_MAT_WIN);
+ /* special exception for ortho camera (viewdist isnt used for perspective cameras) */
+ if (rv3d->persp == RV3D_CAMOB && rv3d->is_persp == false) {
+ viewdist = 1.0f / max_ff(fabsf(rv3d->winmat[0][0]), fabsf(rv3d->winmat[1][1]));
+ }
+ const float depth_ofs = bglPolygonOffsetCalc((float *)winmat, viewdist, 1.0f);
DRWPass *pass = DRW_pass_create(
"Edit Mesh Face Overlay Pass",
DRW_STATE_WRITE_COLOR | DRW_STATE_POINT | statemod);
- if ((tsettings->selectmode & SCE_SELECT_VERTEX) != 0) {
- *r_lverts_shgrp = DRW_shgroup_create(e_data.overlay_lvert_sh, pass);
- DRW_shgroup_uniform_block(*r_lverts_shgrp, "globalsBlock", globals_ubo);
- DRW_shgroup_uniform_vec2(*r_lverts_shgrp, "viewportSize", DRW_viewport_size_get(), 1);
- DRW_shgroup_uniform_float(*r_lverts_shgrp, "edgeScale", edge_width_scale, 1);
- DRW_shgroup_state_enable(*r_lverts_shgrp, DRW_STATE_WRITE_DEPTH);
- DRW_shgroup_state_disable(*r_lverts_shgrp, DRW_STATE_BLEND);
-
- *r_verts_shgrp = DRW_shgroup_create(e_data.overlay_vert_sh, pass);
- DRW_shgroup_uniform_block(*r_verts_shgrp, "globalsBlock", globals_ubo);
- DRW_shgroup_uniform_vec2(*r_verts_shgrp, "viewportSize", DRW_viewport_size_get(), 1);
- DRW_shgroup_uniform_float(*r_verts_shgrp, "edgeScale", edge_width_scale, 1);
- DRW_shgroup_state_enable(*r_verts_shgrp, DRW_STATE_WRITE_DEPTH);
- DRW_shgroup_state_disable(*r_verts_shgrp, DRW_STATE_BLEND);
- }
+ DRWShadingGroup *grp;
- if ((tsettings->selectmode & SCE_SELECT_FACE) != 0) {
- *r_facedot_shgrp = DRW_shgroup_create(e_data.overlay_facedot_sh, pass);
- DRW_shgroup_uniform_block(*r_facedot_shgrp, "globalsBlock", globals_ubo);
- DRW_shgroup_uniform_float(*r_facedot_shgrp, "edgeScale", edge_width_scale, 1);
- DRW_shgroup_state_enable(*r_facedot_shgrp, DRW_STATE_WRITE_DEPTH);
- }
+ GPUShader *vert_sh = sh_data->overlay_vert;
+ GPUShader *edge_sh = (select_vert) ? sh_data->overlay_edge : sh_data->overlay_edge_flat;
+ GPUShader *face_sh = sh_data->overlay_face;
+ GPUShader *facedot_sh = sh_data->overlay_facedot;
- *r_face_shgrp = DRW_shgroup_create(tri_sh, pass);
- DRW_shgroup_uniform_block(*r_face_shgrp, "globalsBlock", globals_ubo);
- DRW_shgroup_uniform_vec2(*r_face_shgrp, "viewportSize", DRW_viewport_size_get(), 1);
- DRW_shgroup_uniform_float(*r_face_shgrp, "faceAlphaMod", face_alpha, 1);
- DRW_shgroup_uniform_float(*r_face_shgrp, "edgeScale", edge_width_scale, 1);
- DRW_shgroup_uniform_ivec4(*r_face_shgrp, "dataMask", data_mask, 1);
- DRW_shgroup_uniform_bool_copy(*r_face_shgrp, "doEdges", do_edges);
- if (!fast_mode) {
- DRW_shgroup_uniform_bool_copy(*r_face_shgrp, "isXray", xray);
+ /* Faces */
+ if (select_face) {
+ grp = *r_facedot_shgrp = DRW_shgroup_create(facedot_sh, pass);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
+ DRW_shgroup_state_enable(grp, DRW_STATE_WRITE_DEPTH);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
+ }
}
- else {
- /* To be able to use triple load. */
- DRW_shgroup_state_enable(*r_face_shgrp, DRW_STATE_FIRST_VERTEX_CONVENTION);
+
+ grp = *r_face_shgrp = DRW_shgroup_create(face_sh, pass);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
+ DRW_shgroup_uniform_float(grp, "faceAlphaMod", face_alpha, 1);
+ DRW_shgroup_uniform_ivec4(grp, "dataMask", data_mask, 1);
+ DRW_shgroup_uniform_bool_copy(grp, "doEdges", do_edges);
+ DRW_shgroup_uniform_float_copy(grp, "ofs", 0.0f);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
}
- /* Cage geom needs to be offseted to avoid Z-fighting. */
- *r_face_cage_shgrp = DRW_shgroup_create_sub(*r_face_shgrp);
- DRW_shgroup_state_enable(*r_face_cage_shgrp, DRW_STATE_OFFSET_NEGATIVE);
- *r_ledges_shgrp = DRW_shgroup_create(ledge_sh, pass);
- DRW_shgroup_uniform_block(*r_ledges_shgrp, "globalsBlock", globals_ubo);
- DRW_shgroup_uniform_vec2(*r_ledges_shgrp, "viewportSize", DRW_viewport_size_get(), 1);
- DRW_shgroup_uniform_float(*r_ledges_shgrp, "edgeScale", edge_width_scale, 1);
- DRW_shgroup_uniform_ivec4(*r_ledges_shgrp, "dataMask", data_mask, 1);
- DRW_shgroup_uniform_bool_copy(*r_ledges_shgrp, "doEdges", do_edges);
+ /* Cage geom needs to be offseted to avoid Z-fighting. */
+ grp = *r_face_cage_shgrp = DRW_shgroup_create_sub(*r_face_shgrp);
+ DRW_shgroup_state_enable(grp, DRW_STATE_OFFSET_NEGATIVE);
+
+ /* Edges */
+ grp = *r_edge_shgrp = DRW_shgroup_create(edge_sh, pass);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
+ DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
+ DRW_shgroup_uniform_vec2(grp, "viewportSizeInv", DRW_viewport_invert_size_get(), 1);
+ DRW_shgroup_uniform_ivec4(grp, "dataMask", data_mask, 1);
+ DRW_shgroup_uniform_bool_copy(grp, "doEdges", do_edges);
+ DRW_shgroup_uniform_float_copy(grp, "ofs", depth_ofs);
+ DRW_shgroup_uniform_float_copy(grp, "edgeScale", show_wide_edge ? 1.75f : 1.0f);
+ DRW_shgroup_state_enable(grp, DRW_STATE_OFFSET_NEGATIVE);
+ /* To match blender loop structure. */
+ DRW_shgroup_state_enable(grp, DRW_STATE_FIRST_VERTEX_CONVENTION);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
+ }
+
+ /* Verts */
+ if (select_vert) {
+ grp = *r_vert_shgrp = DRW_shgroup_create(vert_sh, pass);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
+ DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
+ DRW_shgroup_uniform_float_copy(grp, "ofs", depth_ofs * 1.5f);
+ DRW_shgroup_state_enable(grp, DRW_STATE_OFFSET_NEGATIVE | DRW_STATE_WRITE_DEPTH);
+ DRW_shgroup_state_disable(grp, DRW_STATE_BLEND);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
+ }
+ }
return pass;
}
@@ -416,9 +365,10 @@ static void EDIT_MESH_cache_init(void *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
+ RegionView3D *rv3d = draw_ctx->rv3d;
Scene *scene = draw_ctx->scene;
ToolSettings *tsettings = scene->toolsettings;
-
+ EDIT_MESH_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
static float zero = 0.0f;
if (!stl->g_data) {
@@ -432,9 +382,6 @@ static void EDIT_MESH_cache_init(void *vedata)
stl->g_data->do_zbufclip = ((v3d)->shading.flag & XRAY_FLAG(v3d)) != 0;
- /* Applies on top of the theme edge width, so edge-mode can have thick edges. */
- stl->g_data->edge_width_scale = (tsettings->selectmode & (SCE_SELECT_EDGE)) ? 1.75f : 1.0f;
-
stl->g_data->data_mask[0] = 0xFF; /* Face Flag */
stl->g_data->data_mask[1] = 0xFF; /* Edge Flag */
stl->g_data->data_mask[2] = 0xFF; /* Crease */
@@ -449,6 +396,9 @@ static void EDIT_MESH_cache_init(void *vedata)
stl->g_data->data_mask[0] &= ~(VFLAG_FACE_SELECTED & VFLAG_FACE_FREESTYLE);
stl->g_data->do_faces = false;
}
+ if ((tsettings->selectmode & SCE_SELECT_FACE) == 0) {
+ stl->g_data->data_mask[0] &= ~VFLAG_FACE_ACTIVE;
+ }
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_SEAMS) == 0) {
stl->g_data->data_mask[1] &= ~VFLAG_EDGE_SEAM;
}
@@ -478,12 +428,15 @@ static void EDIT_MESH_cache_init(void *vedata)
"Weight Pass",
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL);
- stl->g_data->fweights_shgrp = DRW_shgroup_create(e_data.weight_face_shader, psl->weight_faces);
+ stl->g_data->fweights_shgrp = DRW_shgroup_create(sh_data->weight_face, psl->weight_faces);
static float alpha = 1.0f;
DRW_shgroup_uniform_float(stl->g_data->fweights_shgrp, "opacity", &alpha, 1);
- DRW_shgroup_uniform_texture(stl->g_data->fweights_shgrp, "colorramp", globals_weight_ramp);
- DRW_shgroup_uniform_block(stl->g_data->fweights_shgrp, "globalsBlock", globals_ubo);
+ DRW_shgroup_uniform_texture(stl->g_data->fweights_shgrp, "colorramp", G_draw.weight_ramp);
+ DRW_shgroup_uniform_block(stl->g_data->fweights_shgrp, "globalsBlock", G_draw.block_ubo);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->fweights_shgrp, rv3d);
+ }
}
{
@@ -491,7 +444,10 @@ static void EDIT_MESH_cache_init(void *vedata)
psl->depth_hidden_wire = DRW_pass_create(
"Depth Pass Hidden Wire",
DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK);
- stl->g_data->depth_shgrp_hidden_wire = DRW_shgroup_create(e_data.depth_sh, psl->depth_hidden_wire);
+ stl->g_data->depth_shgrp_hidden_wire = DRW_shgroup_create(sh_data->depth, psl->depth_hidden_wire);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->fweights_shgrp, rv3d);
+ }
}
{
@@ -500,7 +456,7 @@ static void EDIT_MESH_cache_init(void *vedata)
"Ghost Depth Clear",
DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS | DRW_STATE_STENCIL_NEQUAL);
- DRWShadingGroup *shgrp = DRW_shgroup_create(e_data.ghost_clear_depth_sh, psl->ghost_clear_depth);
+ DRWShadingGroup *shgrp = DRW_shgroup_create(sh_data->ghost_clear_depth, psl->ghost_clear_depth);
DRW_shgroup_stencil_mask(shgrp, 0x00);
DRW_shgroup_call_add(shgrp, DRW_cache_fullscreen_quad_get(), NULL);
}
@@ -511,50 +467,60 @@ static void EDIT_MESH_cache_init(void *vedata)
"Edit Mesh Normals Pass",
DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL);
- stl->g_data->fnormals_shgrp = DRW_shgroup_create(e_data.normals_face_sh, psl->normals);
+ stl->g_data->fnormals_shgrp = DRW_shgroup_create(sh_data->normals_face, psl->normals);
DRW_shgroup_uniform_float(stl->g_data->fnormals_shgrp, "normalSize", &size_normal, 1);
- DRW_shgroup_uniform_vec4(stl->g_data->fnormals_shgrp, "color", ts.colorNormal, 1);
+ DRW_shgroup_uniform_vec4(stl->g_data->fnormals_shgrp, "color", G_draw.block.colorNormal, 1);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->fnormals_shgrp, rv3d);
+ }
- stl->g_data->vnormals_shgrp = DRW_shgroup_create(e_data.normals_sh, psl->normals);
+ stl->g_data->vnormals_shgrp = DRW_shgroup_create(sh_data->normals, psl->normals);
DRW_shgroup_uniform_float(stl->g_data->vnormals_shgrp, "normalSize", &size_normal, 1);
- DRW_shgroup_uniform_vec4(stl->g_data->vnormals_shgrp, "color", ts.colorVNormal, 1);
+ DRW_shgroup_uniform_vec4(stl->g_data->vnormals_shgrp, "color", G_draw.block.colorVNormal, 1);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->vnormals_shgrp, rv3d);
+ }
- stl->g_data->lnormals_shgrp = DRW_shgroup_create(e_data.normals_loop_sh, psl->normals);
+ stl->g_data->lnormals_shgrp = DRW_shgroup_create(sh_data->normals_loop, psl->normals);
DRW_shgroup_uniform_float(stl->g_data->lnormals_shgrp, "normalSize", &size_normal, 1);
- DRW_shgroup_uniform_vec4(stl->g_data->lnormals_shgrp, "color", ts.colorLNormal, 1);
+ DRW_shgroup_uniform_vec4(stl->g_data->lnormals_shgrp, "color", G_draw.block.colorLNormal, 1);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->lnormals_shgrp, rv3d);
+ }
}
if (!stl->g_data->do_zbufclip) {
psl->edit_face_overlay = edit_mesh_create_overlay_pass(
- &face_mod, &stl->g_data->edge_width_scale, stl->g_data->data_mask, stl->g_data->do_edges, false,
+ &face_mod, stl->g_data->data_mask, stl->g_data->do_edges, false,
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND,
&stl->g_data->face_shgrp,
&stl->g_data->face_cage_shgrp,
- &stl->g_data->verts_shgrp,
- &stl->g_data->ledges_shgrp,
- &stl->g_data->lverts_shgrp,
- &stl->g_data->facedot_shgrp);
+ &stl->g_data->facedot_shgrp,
+ &stl->g_data->edge_shgrp,
+ &stl->g_data->vert_shgrp);
}
else {
/* We render all wires with depth and opaque to a new fbo and blend the result based on depth values */
psl->edit_face_occluded = edit_mesh_create_overlay_pass(
- &zero, &stl->g_data->edge_width_scale, stl->g_data->data_mask, stl->g_data->do_edges, true,
+ &zero, stl->g_data->data_mask, stl->g_data->do_edges, true,
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WRITE_DEPTH,
&stl->g_data->face_shgrp,
&stl->g_data->face_cage_shgrp,
- &stl->g_data->verts_shgrp,
- &stl->g_data->ledges_shgrp,
- &stl->g_data->lverts_shgrp,
- &stl->g_data->facedot_shgrp);
+ &stl->g_data->facedot_shgrp,
+ &stl->g_data->edge_shgrp,
+ &stl->g_data->vert_shgrp);
/* however we loose the front faces value (because we need the depth of occluded wires and
* faces are alpha blended ) so we recover them in a new pass. */
psl->facefill_occlude = DRW_pass_create(
"Front Face Color",
DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND);
- stl->g_data->facefill_occluded_shgrp = DRW_shgroup_create(e_data.overlay_facefill_sh, psl->facefill_occlude);
- DRW_shgroup_uniform_block(stl->g_data->facefill_occluded_shgrp, "globalsBlock", globals_ubo);
+ stl->g_data->facefill_occluded_shgrp = DRW_shgroup_create(sh_data->overlay_facefill, psl->facefill_occlude);
+ DRW_shgroup_uniform_block(stl->g_data->facefill_occluded_shgrp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_ivec4(stl->g_data->facefill_occluded_shgrp, "dataMask", stl->g_data->data_mask, 1);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->facefill_occluded_shgrp, rv3d);
+ }
/* we need a full screen pass to combine the result */
struct GPUBatch *quad = DRW_cache_fullscreen_quad_get();
@@ -562,7 +528,7 @@ static void EDIT_MESH_cache_init(void *vedata)
psl->mix_occlude = DRW_pass_create(
"Mix Occluded Wires",
DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND);
- DRWShadingGroup *mix_shgrp = DRW_shgroup_create(e_data.overlay_mix_sh, psl->mix_occlude);
+ DRWShadingGroup *mix_shgrp = DRW_shgroup_create(sh_data->overlay_mix, psl->mix_occlude);
DRW_shgroup_call_add(mix_shgrp, quad, NULL);
DRW_shgroup_uniform_float(mix_shgrp, "alpha", &backwire_opacity, 1);
DRW_shgroup_uniform_texture_ref(mix_shgrp, "wireColor", &e_data.occlude_wire_color_tx);
@@ -577,42 +543,34 @@ static void edit_mesh_add_ob_to_pass(
DRWShadingGroup *facedot_shgrp,
DRWShadingGroup *facefill_shgrp)
{
- struct GPUBatch *geom_tris, *geom_verts, *geom_ledges, *geom_ledges_nor, *geom_lverts, *geom_fcenter;
+ struct GPUBatch *geom_tris, *geom_verts, *geom_edges, *geom_fcenter;
ToolSettings *tsettings = scene->toolsettings;
bool has_edit_mesh_cage = false;
/* TODO: Should be its own function. */
Mesh *me = (Mesh *)ob->data;
- BMEditMesh *embm = me->edit_btmesh;
+ BMEditMesh *embm = me->edit_mesh;
if (embm) {
has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final);
}
DRWShadingGroup *face_shgrp = (has_edit_mesh_cage) ? g_data->face_cage_shgrp : g_data->face_shgrp;
- DRWShadingGroup *verts_shgrp = g_data->verts_shgrp;
- DRWShadingGroup *ledges_shgrp = g_data->ledges_shgrp;
- DRWShadingGroup *lverts_shgrp = g_data->lverts_shgrp;
+ DRWShadingGroup *vert_shgrp = g_data->vert_shgrp;
+ DRWShadingGroup *edge_shgrp = g_data->edge_shgrp;
+
+ face_shgrp = (facefill_shgrp != NULL) ? facefill_shgrp : face_shgrp;
geom_tris = DRW_mesh_batch_cache_get_edit_triangles(ob->data);
- geom_ledges = DRW_mesh_batch_cache_get_edit_loose_edges(ob->data);
+ geom_edges = DRW_mesh_batch_cache_get_edit_edges(ob->data);
+ DRW_shgroup_call_add(edge_shgrp, geom_edges, ob->obmat);
DRW_shgroup_call_add(face_shgrp, geom_tris, ob->obmat);
- DRW_shgroup_call_add(ledges_shgrp, geom_ledges, ob->obmat);
-
- if (facefill_shgrp) {
- DRW_shgroup_call_add(facefill_shgrp, geom_tris, ob->obmat);
- }
if ((tsettings->selectmode & SCE_SELECT_VERTEX) != 0) {
- /* Thoses are point batches. */
geom_verts = DRW_mesh_batch_cache_get_edit_vertices(ob->data);
- geom_ledges_nor = DRW_mesh_batch_cache_get_edit_loose_edges_nor(ob->data);
- geom_lverts = DRW_mesh_batch_cache_get_edit_loose_verts(ob->data);
- DRW_shgroup_call_add(verts_shgrp, geom_verts, ob->obmat);
- DRW_shgroup_call_add(lverts_shgrp, geom_ledges_nor, ob->obmat);
- DRW_shgroup_call_add(lverts_shgrp, geom_lverts, ob->obmat);
+ DRW_shgroup_call_add(vert_shgrp, geom_verts, ob->obmat);
}
- if (facedot_shgrp && (tsettings->selectmode & SCE_SELECT_FACE) != 0 ) {
+ if (facedot_shgrp && (tsettings->selectmode & SCE_SELECT_FACE) != 0) {
geom_fcenter = DRW_mesh_batch_cache_get_edit_facedots(ob->data);
DRW_shgroup_call_add(facedot_shgrp, geom_fcenter, ob->obmat);
}
@@ -667,15 +625,11 @@ static void EDIT_MESH_cache_populate(void *vedata, Object *ob)
}
if (vnormals_do) {
- geom = DRW_mesh_batch_cache_get_edit_triangles_nor(ob->data);
- DRW_shgroup_call_add(stl->g_data->vnormals_shgrp, geom, ob->obmat);
- geom = DRW_mesh_batch_cache_get_edit_loose_verts(ob->data);
- DRW_shgroup_call_add(stl->g_data->vnormals_shgrp, geom, ob->obmat);
- geom = DRW_mesh_batch_cache_get_edit_loose_edges_nor(ob->data);
+ geom = DRW_mesh_batch_cache_get_edit_vertices(ob->data);
DRW_shgroup_call_add(stl->g_data->vnormals_shgrp, geom, ob->obmat);
}
if (lnormals_do) {
- geom = DRW_mesh_batch_cache_get_edit_triangles_lnor(ob->data);
+ geom = DRW_mesh_batch_cache_get_edit_lnors(ob->data);
DRW_shgroup_call_add(stl->g_data->lnormals_shgrp, geom, ob->obmat);
}
if (fnormals_do) {
@@ -748,47 +702,45 @@ static void EDIT_MESH_draw_scene(void *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
- if (v3d->shading.type == OB_SOLID && (v3d->shading.flag & XRAY_FLAG(v3d)) == 0) {
- if (stl->g_data->ghost_ob == 1 && stl->g_data->edit_ob == 1) {
- /* In the case of single ghost object edit (common case for retopology):
- * we duplicate the depht+stencil buffer and clear all depth to 1.0f where
- * the stencil buffer is no 0x00. */
- const float *viewport_size = DRW_viewport_size_get();
- const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
- struct GPUTexture *ghost_depth_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_DEPTH24_STENCIL8, &draw_engine_edit_mesh_type);
- GPU_framebuffer_ensure_config(&fbl->ghost_wire_fb, {
- GPU_ATTACHMENT_TEXTURE(ghost_depth_tx),
- GPU_ATTACHMENT_TEXTURE(dtxl->color),
- });
-
- GPU_framebuffer_blit(dfbl->depth_only_fb, 0, fbl->ghost_wire_fb, 0, GPU_DEPTH_BIT | GPU_STENCIL_BIT);
- GPU_framebuffer_bind(fbl->ghost_wire_fb);
-
- DRW_draw_pass(psl->ghost_clear_depth);
- }
+ if (v3d->shading.type == OB_SOLID && (v3d->shading.flag & XRAY_FLAG(v3d)) == 0 &&
+ stl->g_data->ghost_ob == 1 && stl->g_data->edit_ob == 1)
+ {
+ /* In the case of single ghost object edit (common case for retopology):
+ * we duplicate the depht+stencil buffer and clear all depth to 1.0f where
+ * the stencil buffer is no 0x00. */
+ const float *viewport_size = DRW_viewport_size_get();
+ const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
+ struct GPUTexture *ghost_depth_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_DEPTH24_STENCIL8, &draw_engine_edit_mesh_type);
+ GPU_framebuffer_ensure_config(&fbl->ghost_wire_fb, {
+ GPU_ATTACHMENT_TEXTURE(ghost_depth_tx),
+ GPU_ATTACHMENT_TEXTURE(dtxl->color),
+ });
+
+ GPU_framebuffer_blit(dfbl->depth_only_fb, 0, fbl->ghost_wire_fb, 0, GPU_DEPTH_BIT | GPU_STENCIL_BIT);
+ GPU_framebuffer_bind(fbl->ghost_wire_fb);
+
+ DRW_draw_pass(psl->ghost_clear_depth);
+
+ DRW_draw_pass(psl->edit_face_overlay);
+ }
+ else {
+ DRW_draw_pass(psl->edit_face_overlay);
}
-
- DRW_draw_pass(psl->edit_face_overlay);
}
+
+ DRW_state_clip_planes_reset();
}
static void EDIT_MESH_engine_free(void)
{
- DRW_SHADER_FREE_SAFE(e_data.weight_face_shader);
-
- DRW_SHADER_FREE_SAFE(e_data.overlay_vert_sh);
- DRW_SHADER_FREE_SAFE(e_data.overlay_lvert_sh);
- DRW_SHADER_FREE_SAFE(e_data.overlay_facedot_sh);
- DRW_SHADER_FREE_SAFE(e_data.overlay_mix_sh);
- DRW_SHADER_FREE_SAFE(e_data.overlay_facefill_sh);
- DRW_SHADER_FREE_SAFE(e_data.normals_loop_sh);
- DRW_SHADER_FREE_SAFE(e_data.normals_face_sh);
- DRW_SHADER_FREE_SAFE(e_data.normals_sh);
- DRW_SHADER_FREE_SAFE(e_data.ghost_clear_depth_sh);
-
- for (int i = 0; i < MAX_SHADERS; i++) {
- DRW_SHADER_FREE_SAFE(e_data.overlay_tri_sh_cache[i]);
- DRW_SHADER_FREE_SAFE(e_data.overlay_loose_edge_sh_cache[i]);
+ for (int sh_data_index = 0; sh_data_index < ARRAY_SIZE(e_data.sh_data); sh_data_index++) {
+ EDIT_MESH_Shaders *sh_data = &e_data.sh_data[sh_data_index];
+ /* Don't free builtins. */
+ sh_data->depth = NULL;
+ GPUShader **sh_data_as_array = (GPUShader **)sh_data;
+ for (int i = 0; i < (sizeof(EDIT_MESH_Shaders) / sizeof(GPUShader *)); i++) {
+ DRW_SHADER_FREE_SAFE(sh_data_as_array[i]);
+ }
}
}
diff --git a/source/blender/draw/modes/edit_mesh_mode_intern.h b/source/blender/draw/modes/edit_mesh_mode_intern.h
index 99298bd41f4..946615ef66b 100644
--- a/source/blender/draw/modes/edit_mesh_mode_intern.h
+++ b/source/blender/draw/modes/edit_mesh_mode_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/draw/modes/edit_mesh_mode_intern.h
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#ifndef __EDIT_MESH_MODE_INTERN_H__
diff --git a/source/blender/draw/modes/edit_mesh_mode_text.c b/source/blender/draw/modes/edit_mesh_mode_text.c
index 0498998b69a..bd2f65a40cd 100644
--- a/source/blender/draw/modes/edit_mesh_mode_text.c
+++ b/source/blender/draw/modes/edit_mesh_mode_text.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/edit_mesh_mode_text.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "BLI_math.h"
@@ -32,9 +29,6 @@
#include "ED_view3d.h"
-#include "GPU_shader.h"
-#include "GPU_viewport.h"
-
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -58,7 +52,7 @@ void DRW_edit_mesh_mode_text_measure_stats(
struct DRWTextStore *dt = DRW_text_cache_ensure();
const short txt_flag = DRW_TEXT_CACHE_GLOBALSPACE | (unit->system ? 0 : DRW_TEXT_CACHE_ASCII);
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
float v1[3], v2[3], v3[3], vmid[3], fvec[3];
char numstr[32]; /* Stores the measurement display text here */
size_t numstr_len;
diff --git a/source/blender/draw/modes/edit_metaball_mode.c b/source/blender/draw/modes/edit_metaball_mode.c
index 912c30c1482..04b03cb3ac1 100644
--- a/source/blender/draw/modes/edit_metaball_mode.c
+++ b/source/blender/draw/modes/edit_metaball_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,38 +13,27 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/edit_metaball_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
-#include "DRW_engine.h"
#include "DRW_render.h"
#include "DNA_meta_types.h"
#include "BKE_object.h"
-#include "BKE_mball.h"
#include "ED_mball.h"
/* If builtin shaders are needed */
#include "GPU_shader.h"
-#include "GPU_select.h"
#include "draw_common.h"
-
#include "draw_mode_engines.h"
-/* If needed, contains all global/Theme colors
- * Add needed theme colors / values to DRW_globals_update() and update UBO
- * Not needed for constant color. */
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GlobalsUboStorage ts; /* draw_common.c */
-
/* *********** LISTS *********** */
/* All lists are per viewport specific datas.
* They are all free when viewport changes engines
@@ -104,12 +91,22 @@ typedef struct EDIT_METABALL_PrivateData {
/* *********** FUNCTIONS *********** */
+static void EDIT_METABALL_engine_init(void *UNUSED(vedata))
+{
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d);
+ }
+}
+
/* Here init all passes and shading groups
* Assume that all Passes are NULL */
static void EDIT_METABALL_cache_init(void *vedata)
{
EDIT_METABALL_PassList *psl = ((EDIT_METABALL_Data *)vedata)->psl;
EDIT_METABALL_StorageList *stl = ((EDIT_METABALL_Data *)vedata)->stl;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+
if (!stl->g_data) {
/* Alloc transient pointers */
@@ -124,7 +121,7 @@ static void EDIT_METABALL_cache_init(void *vedata)
psl->pass = DRW_pass_create("My Pass", state);
/* Create a shadingGroup using a function in draw_common.c or custom one */
- stl->g_data->group = shgroup_instance_mball_handles(psl->pass);
+ stl->g_data->group = shgroup_instance_mball_handles(psl->pass, draw_ctx->sh_cfg);
}
}
@@ -165,8 +162,8 @@ static void EDIT_METABALL_cache_populate(void *vedata, Object *ob)
copy_v3_v3(draw_scale_xform[2], scamat[2]);
}
- int selection_id = ob->select_color;
- for (MetaElem *ml = mb->editelems->first; ml != NULL; ml = ml->next, selection_id += 0x10000) {
+ int select_id = ob->select_id;
+ for (MetaElem *ml = mb->editelems->first; ml != NULL; ml = ml->next, select_id += 0x10000) {
float world_pos[3];
mul_v3_m4v3(world_pos, ob->obmat, &ml->x);
draw_scale_xform[0][3] = world_pos[0];
@@ -179,7 +176,7 @@ static void EDIT_METABALL_cache_populate(void *vedata, Object *ob)
else color = col_radius;
if (is_select) {
- DRW_select_load_id(selection_id | MBALLSEL_RADIUS);
+ DRW_select_load_id(select_id | MBALLSEL_RADIUS);
}
DRW_shgroup_call_dynamic_add(group, draw_scale_xform, &ml->rad, color);
@@ -188,7 +185,7 @@ static void EDIT_METABALL_cache_populate(void *vedata, Object *ob)
else color = col_stiffness;
if (is_select) {
- DRW_select_load_id(selection_id | MBALLSEL_STIFF);
+ DRW_select_load_id(select_id | MBALLSEL_STIFF);
}
DRW_shgroup_call_dynamic_add(group, draw_scale_xform, &draw_stiffness_radius, color);
@@ -206,6 +203,8 @@ static void EDIT_METABALL_draw_scene(void *vedata)
/* If you changed framebuffer, double check you rebind
* the default one with its textures attached before finishing */
+
+ DRW_state_clip_planes_reset();
}
/* Cleanup when destroying the engine.
@@ -222,7 +221,7 @@ DrawEngineType draw_engine_edit_metaball_type = {
NULL, NULL,
N_("EditMetaballMode"),
&EDIT_METABALL_data_size,
- NULL,
+ &EDIT_METABALL_engine_init,
&EDIT_METABALL_engine_free,
&EDIT_METABALL_cache_init,
&EDIT_METABALL_cache_populate,
diff --git a/source/blender/draw/modes/edit_text_mode.c b/source/blender/draw/modes/edit_text_mode.c
index 40cbd876473..f52bfaccd5b 100644
--- a/source/blender/draw/modes/edit_text_mode.c
+++ b/source/blender/draw/modes/edit_text_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/edit_text_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_engine.h"
@@ -34,18 +31,10 @@
/* If builtin shaders are needed */
#include "GPU_shader.h"
-#include "GPU_batch.h"
#include "draw_common.h"
-
#include "draw_mode_engines.h"
-/* If needed, contains all global/Theme colors
- * Add needed theme colors / values to DRW_globals_update() and update UBO
- * Not needed for constant color. */
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GlobalsUboStorage ts; /* draw_common.c */
-
/* *********** LISTS *********** */
/* All lists are per viewport specific datas.
* They are all free when viewport changes engines
@@ -190,8 +179,8 @@ static void EDIT_TEXT_cache_init(void *vedata)
psl->text_box_pass = DRW_pass_create(
"Font Text Boxes",
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH);
- stl->g_data->box_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, ts.colorWire);
- stl->g_data->box_active_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, ts.colorActive);
+ stl->g_data->box_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, G_draw.block.colorWire);
+ stl->g_data->box_active_shgrp = shgroup_dynlines_dashed_uniform_color(psl->text_box_pass, G_draw.block.colorActive);
}
}
@@ -222,10 +211,12 @@ static void edit_text_cache_populate_select(void *vedata, Object *ob)
float selboxw;
if (i + 1 != ef->selboxes_len) {
- if (ef->selboxes[i + 1].y == sb->y)
+ if (ef->selboxes[i + 1].y == sb->y) {
selboxw = ef->selboxes[i + 1].x - sb->x;
- else
+ }
+ else {
selboxw = sb->w;
+ }
}
else {
selboxw = sb->w;
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 1eddf383433..3ed6034731b 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/object_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_engine.h"
@@ -42,24 +39,17 @@
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
-#include "BIF_gl.h"
-
-#include "BLI_string_utils.h"
-
#include "BKE_anim.h"
#include "BKE_camera.h"
#include "BKE_constraint.h"
#include "BKE_curve.h"
#include "BKE_editmesh.h"
-#include "BKE_global.h"
#include "BKE_mball.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_movieclip.h"
#include "BKE_object.h"
#include "BKE_particle.h"
-#include "BKE_image.h"
-#include "BKE_texture.h"
#include "BKE_tracking.h"
#include "ED_view3d.h"
@@ -79,10 +69,6 @@
#include "DEG_depsgraph_query.h"
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GPUTexture *globals_ramp; /* draw_common.c */
-extern GlobalsUboStorage ts;
-
extern char datatoc_object_outline_prepass_vert_glsl[];
extern char datatoc_object_outline_prepass_geom_glsl[];
extern char datatoc_object_outline_prepass_frag_glsl[];
@@ -104,12 +90,13 @@ extern char datatoc_gpu_shader_flat_color_frag_glsl[];
extern char datatoc_gpu_shader_flat_id_frag_glsl[];
extern char datatoc_common_fullscreen_vert_glsl[];
extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
+extern char datatoc_gpu_shader_3D_vert_glsl[];
/* *********** LISTS *********** */
typedef struct OBJECT_PassList {
struct DRWPass *non_meshes[2];
struct DRWPass *image_empties[2];
- struct DRWPass *spot_shapes[2];
+ struct DRWPass *transp_shapes[2];
struct DRWPass *ob_center;
struct DRWPass *outlines;
struct DRWPass *outlines_search;
@@ -145,13 +132,35 @@ typedef struct OBJECT_Data {
OBJECT_StorageList *stl;
} OBJECT_Data;
+typedef struct OBJECT_Shaders {
+ /* fullscreen shaders */
+ GPUShader *outline_prepass;
+ GPUShader *outline_prepass_wire;
+ GPUShader *outline_resolve;
+ GPUShader *outline_resolve_aa;
+ GPUShader *outline_detect;
+ GPUShader *outline_detect_wire;
+ GPUShader *outline_fade;
+ GPUShader *outline_fade_large;
+
+ /* regular shaders */
+ GPUShader *object_empty_image;
+ GPUShader *object_empty_image_wire;
+ GPUShader *grid;
+ GPUShader *part_dot;
+ GPUShader *part_prim;
+ GPUShader *part_axis;
+ GPUShader *lightprobe_grid;
+ GPUShader *loose_points;
+} OBJECT_Shaders;
+
/* *********** STATIC *********** */
typedef struct OBJECT_ShadingGroupList {
/* Reference only */
struct DRWPass *non_meshes;
struct DRWPass *image_empties;
- struct DRWPass *spot_shapes;
+ struct DRWPass *transp_shapes;
struct DRWPass *bone_solid;
struct DRWPass *bone_outline;
struct DRWPass *bone_wire;
@@ -195,28 +204,28 @@ typedef struct OBJECT_ShadingGroupList {
/* MetaBalls */
DRWShadingGroup *mball_handle;
- /* Lamps */
- DRWShadingGroup *lamp_center;
- DRWShadingGroup *lamp_groundpoint;
- DRWShadingGroup *lamp_groundline;
- DRWShadingGroup *lamp_circle;
- DRWShadingGroup *lamp_circle_shadow;
- DRWShadingGroup *lamp_sunrays;
- DRWShadingGroup *lamp_distance;
- DRWShadingGroup *lamp_buflimit;
- DRWShadingGroup *lamp_buflimit_points;
- DRWShadingGroup *lamp_area_sphere;
- DRWShadingGroup *lamp_area_square;
- DRWShadingGroup *lamp_area_disk;
- DRWShadingGroup *lamp_hemi;
- DRWShadingGroup *lamp_spot_cone;
- DRWShadingGroup *lamp_spot_blend;
- DRWShadingGroup *lamp_spot_pyramid;
- DRWShadingGroup *lamp_spot_blend_rect;
- DRWShadingGroup *lamp_spot_volume;
- DRWShadingGroup *lamp_spot_volume_rect;
- DRWShadingGroup *lamp_spot_volume_outside;
- DRWShadingGroup *lamp_spot_volume_rect_outside;
+ /* Lights */
+ DRWShadingGroup *light_center;
+ DRWShadingGroup *light_groundpoint;
+ DRWShadingGroup *light_groundline;
+ DRWShadingGroup *light_circle;
+ DRWShadingGroup *light_circle_shadow;
+ DRWShadingGroup *light_sunrays;
+ DRWShadingGroup *light_distance;
+ DRWShadingGroup *light_buflimit;
+ DRWShadingGroup *light_buflimit_points;
+ DRWShadingGroup *light_area_sphere;
+ DRWShadingGroup *light_area_square;
+ DRWShadingGroup *light_area_disk;
+ DRWShadingGroup *light_hemi;
+ DRWShadingGroup *light_spot_cone;
+ DRWShadingGroup *light_spot_blend;
+ DRWShadingGroup *light_spot_pyramid;
+ DRWShadingGroup *light_spot_blend_rect;
+ DRWShadingGroup *light_spot_volume;
+ DRWShadingGroup *light_spot_volume_rect;
+ DRWShadingGroup *light_spot_volume_outside;
+ DRWShadingGroup *light_spot_volume_rect_outside;
/* Helpers */
DRWShadingGroup *relationship_lines;
@@ -231,6 +240,10 @@ typedef struct OBJECT_ShadingGroupList {
DRWShadingGroup *camera_clip_points;
DRWShadingGroup *camera_mist;
DRWShadingGroup *camera_mist_points;
+ DRWShadingGroup *camera_stereo_plane;
+ DRWShadingGroup *camera_stereo_plane_wires;
+ DRWShadingGroup *camera_stereo_volume;
+ DRWShadingGroup *camera_stereo_volume_wires;
ListBase camera_path;
/* Wire */
@@ -238,12 +251,18 @@ typedef struct OBJECT_ShadingGroupList {
DRWShadingGroup *wire_active;
DRWShadingGroup *wire_select;
DRWShadingGroup *wire_transform;
+ /* Wire (duplicator) */
+ DRWShadingGroup *wire_dupli;
+ DRWShadingGroup *wire_dupli_select;
/* Points */
DRWShadingGroup *points;
DRWShadingGroup *points_active;
DRWShadingGroup *points_select;
DRWShadingGroup *points_transform;
+ /* Points (duplicator) */
+ DRWShadingGroup *points_dupli;
+ DRWShadingGroup *points_dupli_select;
/* Texture Space */
DRWShadingGroup *texspace;
@@ -256,14 +275,17 @@ typedef struct OBJECT_PrivateData {
/* Outlines */
DRWShadingGroup *outlines_active;
DRWShadingGroup *outlines_select;
+ DRWShadingGroup *outlines_select_dupli;
DRWShadingGroup *outlines_transform;
/* Lightprobes */
DRWShadingGroup *lightprobes_cube_select;
+ DRWShadingGroup *lightprobes_cube_select_dupli;
DRWShadingGroup *lightprobes_cube_active;
DRWShadingGroup *lightprobes_cube_transform;
DRWShadingGroup *lightprobes_planar_select;
+ DRWShadingGroup *lightprobes_planar_select_dupli;
DRWShadingGroup *lightprobes_planar_active;
DRWShadingGroup *lightprobes_planar_transform;
@@ -274,15 +296,19 @@ typedef struct OBJECT_PrivateData {
DRWShadingGroup *center_selected_lib;
DRWShadingGroup *center_deselected_lib;
- /* Outlines id offset */
+ /* Outlines id offset (accessed as an array) */
int id_ofs_active;
int id_ofs_select;
+ int id_ofs_select_dupli;
int id_ofs_transform;
+
int id_ofs_prb_active;
int id_ofs_prb_select;
+ int id_ofs_prb_select_dupli;
int id_ofs_prb_transform;
bool xray_enabled;
+ bool xray_enabled_and_not_wire;
} OBJECT_PrivateData; /* Transient data */
static struct {
@@ -291,33 +317,15 @@ static struct {
struct GPUVertFormat *empty_image_format;
struct GPUVertFormat *empty_image_wire_format;
- /* fullscreen shaders */
- GPUShader *outline_prepass_sh;
- GPUShader *outline_prepass_wire_sh;
- GPUShader *outline_resolve_sh;
- GPUShader *outline_resolve_aa_sh;
- GPUShader *outline_detect_sh;
- GPUShader *outline_detect_wire_sh;
- GPUShader *outline_fade_sh;
+ OBJECT_Shaders sh_data[GPU_SHADER_CFG_LEN];
- /* regular shaders */
- GPUShader *object_empty_image_sh;
- GPUShader *object_empty_image_wire_sh;
- GPUShader *grid_sh;
- GPUShader *part_dot_sh;
- GPUShader *part_prim_sh;
- GPUShader *part_axis_sh;
- GPUShader *lightprobe_grid_sh;
- GPUShader *loose_points_sh;
float camera_pos[3];
- float screenvecs[3][4];
float grid_settings[5];
+ float grid_mesh_size;
int grid_flag;
- float grid_normal[3];
float grid_axes[3];
int zpos_flag;
int zneg_flag;
- float zplane_normal[3];
float zplane_axes[3];
float inv_viewport_size[2];
bool draw_grid;
@@ -388,88 +396,102 @@ static void OBJECT_engine_init(void *vedata)
}
/* Shaders */
- if (!e_data.outline_resolve_sh) {
- /* Outline */
- e_data.outline_prepass_sh = DRW_shader_create_3D(datatoc_object_outline_prepass_frag_glsl, NULL);
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ OBJECT_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
- e_data.outline_prepass_wire_sh = DRW_shader_create(
- datatoc_object_outline_prepass_vert_glsl,
- datatoc_object_outline_prepass_geom_glsl,
- datatoc_object_outline_prepass_frag_glsl, NULL);
+ if (!sh_data->outline_resolve) {
+ /* Outline */
+ sh_data->outline_prepass = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_gpu_shader_3D_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_object_outline_prepass_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
+ sh_data->outline_prepass_wire = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_object_outline_prepass_vert_glsl, NULL},
+ .geom = (const char *[]){sh_cfg_data->lib, datatoc_object_outline_prepass_geom_glsl, NULL},
+ .frag = (const char *[]){datatoc_object_outline_prepass_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
- e_data.outline_resolve_sh = DRW_shader_create_fullscreen(datatoc_object_outline_resolve_frag_glsl, NULL);
+ sh_data->outline_resolve = DRW_shader_create_fullscreen(datatoc_object_outline_resolve_frag_glsl, NULL);
- e_data.outline_resolve_aa_sh = DRW_shader_create_with_lib(
+ sh_data->outline_resolve_aa = DRW_shader_create_with_lib(
datatoc_common_fullscreen_vert_glsl, NULL,
datatoc_object_outline_resolve_frag_glsl,
datatoc_common_fxaa_lib_glsl,
"#define FXAA_ALPHA\n"
"#define USE_FXAA\n");
- e_data.outline_detect_sh = DRW_shader_create_with_lib(
+ sh_data->outline_detect = DRW_shader_create_with_lib(
datatoc_common_fullscreen_vert_glsl, NULL,
datatoc_object_outline_detect_frag_glsl,
datatoc_common_globals_lib_glsl,
NULL);
- e_data.outline_detect_wire_sh = DRW_shader_create_with_lib(
+ sh_data->outline_detect_wire = DRW_shader_create_with_lib(
datatoc_common_fullscreen_vert_glsl, NULL,
datatoc_object_outline_detect_frag_glsl,
datatoc_common_globals_lib_glsl,
"#define WIRE\n");
- e_data.outline_fade_sh = DRW_shader_create_fullscreen(datatoc_object_outline_expand_frag_glsl, NULL);
+ sh_data->outline_fade = DRW_shader_create_fullscreen(datatoc_object_outline_expand_frag_glsl, NULL);
+ sh_data->outline_fade_large = DRW_shader_create_fullscreen(datatoc_object_outline_expand_frag_glsl, "#define LARGE_OUTLINE\n");
/* Empty images */
-# define EMPTY_IMAGE_SHADER_DEFINES \
- "#define DEPTH_UNCHANGED " STRINGIFY(OB_EMPTY_IMAGE_DEPTH_DEFAULT) "\n" \
- "#define DEPTH_FRONT " STRINGIFY(OB_EMPTY_IMAGE_DEPTH_FRONT) "\n" \
- "#define DEPTH_BACK " STRINGIFY(OB_EMPTY_IMAGE_DEPTH_BACK) "\n"
-
- e_data.object_empty_image_sh = DRW_shader_create(
- datatoc_object_empty_image_vert_glsl, NULL,
- datatoc_object_empty_image_frag_glsl,
- EMPTY_IMAGE_SHADER_DEFINES);
-
- e_data.object_empty_image_wire_sh = DRW_shader_create(
- datatoc_object_empty_image_vert_glsl, NULL,
- datatoc_object_empty_image_frag_glsl,
- EMPTY_IMAGE_SHADER_DEFINES
- "#define USE_WIRE\n");
-
-# undef EMPTY_IMAGE_SHADER_DEFINES
+ {
+ const char *empty_image_defs = (
+ "#define DEPTH_UNCHANGED " STRINGIFY(OB_EMPTY_IMAGE_DEPTH_DEFAULT) "\n"
+ "#define DEPTH_FRONT " STRINGIFY(OB_EMPTY_IMAGE_DEPTH_FRONT) "\n"
+ "#define DEPTH_BACK " STRINGIFY(OB_EMPTY_IMAGE_DEPTH_BACK) "\n");
+
+ sh_data->object_empty_image = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_object_empty_image_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_object_empty_image_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, empty_image_defs, NULL},
+ });
+ sh_data->object_empty_image_wire = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_object_empty_image_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_object_empty_image_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, "#define USE_WIRE\n", empty_image_defs, NULL},
+ });
+ }
/* Grid */
- e_data.grid_sh = DRW_shader_create_with_lib(
+ sh_data->grid = DRW_shader_create_with_lib(
datatoc_object_grid_vert_glsl, NULL,
datatoc_object_grid_frag_glsl,
datatoc_common_globals_lib_glsl, NULL);
/* Particles */
- e_data.part_prim_sh = DRW_shader_create(
+ sh_data->part_prim = DRW_shader_create(
datatoc_object_particle_prim_vert_glsl, NULL, datatoc_gpu_shader_flat_color_frag_glsl, NULL);
- e_data.part_axis_sh = DRW_shader_create(
+ sh_data->part_axis = DRW_shader_create(
datatoc_object_particle_prim_vert_glsl, NULL, datatoc_gpu_shader_flat_color_frag_glsl,
"#define USE_AXIS\n");
- e_data.part_dot_sh = DRW_shader_create(
+ sh_data->part_dot = DRW_shader_create(
datatoc_object_particle_dot_vert_glsl, NULL, datatoc_object_particle_dot_frag_glsl, NULL);
/* Lightprobes */
- e_data.lightprobe_grid_sh = DRW_shader_create(
+ sh_data->lightprobe_grid = DRW_shader_create(
datatoc_object_lightprobe_grid_vert_glsl, NULL, datatoc_gpu_shader_flat_id_frag_glsl, NULL);
/* Loose Points */
- e_data.loose_points_sh = DRW_shader_create_3D(datatoc_object_loose_points_frag_glsl, NULL);
+ sh_data->loose_points = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_gpu_shader_3D_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_object_loose_points_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
{
/* Grid precompute */
float invviewmat[4][4], invwinmat[4][4];
float viewmat[4][4], winmat[4][4];
- const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d;
Scene *scene = draw_ctx->scene;
RegionView3D *rv3d = draw_ctx->rv3d;
@@ -495,7 +517,7 @@ static void OBJECT_engine_init(void *vedata)
float fov;
float viewvecs[2][4] = {
{1.0f, -1.0f, -1.0f, 1.0f},
- {-1.0f, 1.0f, -1.0f, 1.0f}
+ {-1.0f, 1.0f, -1.0f, 1.0f},
};
/* convert the view vectors to view space */
@@ -508,12 +530,15 @@ static void OBJECT_engine_init(void *vedata)
grid_res = fabsf(tanf(fov)) / grid_scale;
e_data.grid_flag = (1 << 4); /* XY plane */
- if (show_axis_x)
+ if (show_axis_x) {
e_data.grid_flag |= SHOW_AXIS_X;
- if (show_axis_y)
+ }
+ if (show_axis_y) {
e_data.grid_flag |= SHOW_AXIS_Y;
- if (show_floor)
+ }
+ if (show_floor) {
e_data.grid_flag |= SHOW_GRID;
+ }
}
else {
@@ -526,12 +551,15 @@ static void OBJECT_engine_init(void *vedata)
grid_res = viewdist / grid_scale;
if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) {
+ e_data.draw_grid = true;
e_data.grid_flag = PLANE_YZ | SHOW_AXIS_Y | SHOW_AXIS_Z | SHOW_GRID | GRID_BACK;
}
else if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) {
+ e_data.draw_grid = true;
e_data.grid_flag = PLANE_XY | SHOW_AXIS_X | SHOW_AXIS_Y | SHOW_GRID | GRID_BACK;
}
else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) {
+ e_data.draw_grid = true;
e_data.grid_flag = PLANE_XZ | SHOW_AXIS_X | SHOW_AXIS_Z | SHOW_GRID | GRID_BACK;
}
else { /* RV3D_VIEW_USER */
@@ -548,38 +576,10 @@ static void OBJECT_engine_init(void *vedata)
}
}
- e_data.grid_normal[0] = (float)((e_data.grid_flag & PLANE_YZ) != 0);
- e_data.grid_normal[1] = (float)((e_data.grid_flag & PLANE_XZ) != 0);
- e_data.grid_normal[2] = (float)((e_data.grid_flag & PLANE_XY) != 0);
-
e_data.grid_axes[0] = (float)((e_data.grid_flag & (PLANE_XZ | PLANE_XY)) != 0);
e_data.grid_axes[1] = (float)((e_data.grid_flag & (PLANE_YZ | PLANE_XY)) != 0);
e_data.grid_axes[2] = (float)((e_data.grid_flag & (PLANE_YZ | PLANE_XZ)) != 0);
- /* Vectors to recover pixel world position. Fix grid precision issue. */
- /* Using pixel at z = 0.0f in ndc space : gives average precision between
- * near and far plane. Note that it might not be the best choice. */
- copy_v4_fl4(e_data.screenvecs[0], 1.0f, -1.0f, 0.0f, 1.0f);
- copy_v4_fl4(e_data.screenvecs[1], -1.0f, 1.0f, 0.0f, 1.0f);
- copy_v4_fl4(e_data.screenvecs[2], -1.0f, -1.0f, 0.0f, 1.0f);
-
- for (int i = 0; i < 3; i++) {
- /* Doing 2 steps to recover world position of the corners of the frustum.
- * Using the inverse perspective matrix is giving very low precision output. */
- mul_m4_v4(invwinmat, e_data.screenvecs[i]);
- e_data.screenvecs[i][0] /= e_data.screenvecs[i][3]; /* perspective divide */
- e_data.screenvecs[i][1] /= e_data.screenvecs[i][3]; /* perspective divide */
- e_data.screenvecs[i][2] /= e_data.screenvecs[i][3]; /* perspective divide */
- e_data.screenvecs[i][3] = 1.0f;
- /* main instability come from this one */
- /* TODO : to make things even more stable, don't use
- * invviewmat and derive vectors from camera properties */
- mul_m4_v4(invviewmat, e_data.screenvecs[i]);
- }
-
- sub_v3_v3(e_data.screenvecs[0], e_data.screenvecs[2]);
- sub_v3_v3(e_data.screenvecs[1], e_data.screenvecs[2]);
-
/* Z axis if needed */
if (((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) && show_axis_z) {
e_data.zpos_flag = SHOW_AXIS_Z;
@@ -610,10 +610,6 @@ static void OBJECT_engine_init(void *vedata)
e_data.zneg_flag |= CLIP_ZPOS;
}
- e_data.zplane_normal[0] = (float)((e_data.zpos_flag & PLANE_YZ) != 0);
- e_data.zplane_normal[1] = (float)((e_data.zpos_flag & PLANE_XZ) != 0);
- e_data.zplane_normal[2] = (float)((e_data.zpos_flag & PLANE_XY) != 0);
-
e_data.zplane_axes[0] = (float)((e_data.zpos_flag & (PLANE_XZ | PLANE_XY)) != 0);
e_data.zplane_axes[1] = (float)((e_data.zpos_flag & (PLANE_YZ | PLANE_XY)) != 0);
e_data.zplane_axes[2] = (float)((e_data.zpos_flag & (PLANE_YZ | PLANE_XZ)) != 0);
@@ -626,10 +622,10 @@ static void OBJECT_engine_init(void *vedata)
float dist;
if (rv3d->persp == RV3D_CAMOB && v3d->camera && v3d->camera->type == OB_CAMERA) {
Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, v3d->camera);
- dist = ((Camera *)(camera_object->data))->clipend;
+ dist = ((Camera *)(camera_object->data))->clip_end;
}
else {
- dist = v3d->far;
+ dist = v3d->clip_end;
}
e_data.grid_settings[0] = dist / 2.0f; /* gridDistance */
@@ -637,6 +633,14 @@ static void OBJECT_engine_init(void *vedata)
e_data.grid_settings[2] = grid_scale; /* gridScale */
e_data.grid_settings[3] = v3d->gridsubdiv; /* gridSubdiv */
e_data.grid_settings[4] = (v3d->gridsubdiv > 1) ? 1.0f / logf(v3d->gridsubdiv) : 0.0f; /* 1/log(gridSubdiv) */
+
+ if (winmat[3][3] == 0.0f) {
+ e_data.grid_mesh_size = dist;
+ }
+ else {
+ float viewdist = 1.0f / min_ff(fabsf(winmat[0][0]), fabsf(winmat[1][1]));
+ e_data.grid_mesh_size = viewdist * dist;
+ }
}
copy_v2_v2(e_data.inv_viewport_size, DRW_viewport_size_get());
@@ -648,53 +652,66 @@ static void OBJECT_engine_free(void)
MEM_SAFE_FREE(e_data.particle_format);
MEM_SAFE_FREE(e_data.empty_image_format);
MEM_SAFE_FREE(e_data.empty_image_wire_format);
- DRW_SHADER_FREE_SAFE(e_data.outline_prepass_sh);
- DRW_SHADER_FREE_SAFE(e_data.outline_prepass_wire_sh);
- DRW_SHADER_FREE_SAFE(e_data.outline_resolve_sh);
- DRW_SHADER_FREE_SAFE(e_data.outline_resolve_aa_sh);
- DRW_SHADER_FREE_SAFE(e_data.outline_detect_sh);
- DRW_SHADER_FREE_SAFE(e_data.outline_detect_wire_sh);
- DRW_SHADER_FREE_SAFE(e_data.outline_fade_sh);
- DRW_SHADER_FREE_SAFE(e_data.object_empty_image_sh);
- DRW_SHADER_FREE_SAFE(e_data.object_empty_image_wire_sh);
- DRW_SHADER_FREE_SAFE(e_data.grid_sh);
- DRW_SHADER_FREE_SAFE(e_data.part_prim_sh);
- DRW_SHADER_FREE_SAFE(e_data.part_axis_sh);
- DRW_SHADER_FREE_SAFE(e_data.part_dot_sh);
- DRW_SHADER_FREE_SAFE(e_data.lightprobe_grid_sh);
- DRW_SHADER_FREE_SAFE(e_data.loose_points_sh);
+
+ for (int sh_data_index = 0; sh_data_index < ARRAY_SIZE(e_data.sh_data); sh_data_index++) {
+ OBJECT_Shaders *sh_data = &e_data.sh_data[sh_data_index];
+ GPUShader **sh_data_as_array = (GPUShader **)sh_data;
+ for (int i = 0; i < (sizeof(OBJECT_Shaders) / sizeof(GPUShader *)); i++) {
+ DRW_SHADER_FREE_SAFE(sh_data_as_array[i]);
+ }
+ }
}
-static DRWShadingGroup *shgroup_outline(DRWPass *pass, const int *ofs, GPUShader *sh)
+static DRWShadingGroup *shgroup_outline(DRWPass *pass, const int *ofs, GPUShader *sh, eGPUShaderConfig sh_cfg)
{
DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_int(grp, "baseId", ofs, 1);
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
/* currently same as 'shgroup_outline', new function to avoid confustion */
-static DRWShadingGroup *shgroup_wire(DRWPass *pass, const float col[4], GPUShader *sh)
+static DRWShadingGroup *shgroup_wire(DRWPass *pass, const float col[4], GPUShader *sh, eGPUShaderConfig sh_cfg)
{
DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_vec4(grp, "color", col, 1);
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
/* currently same as 'shgroup_outline', new function to avoid confustion */
-static DRWShadingGroup *shgroup_points(DRWPass *pass, const float col[4], GPUShader *sh)
+static DRWShadingGroup *shgroup_points(DRWPass *pass, const float col[4], GPUShader *sh, eGPUShaderConfig sh_cfg)
{
DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_vec4(grp, "color", col, 1);
- DRW_shgroup_uniform_vec4(grp, "innerColor", ts.colorEditMeshMiddle, 1);
+ DRW_shgroup_uniform_vec4(grp, "innerColor", G_draw.block.colorEditMeshMiddle, 1);
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
return grp;
}
static int *shgroup_theme_id_to_probe_outline_counter(
- OBJECT_StorageList *stl, int theme_id)
+ OBJECT_StorageList *stl, int theme_id, const int base_flag)
{
+ if (UNLIKELY(base_flag & BASE_FROM_DUPLI)) {
+ switch (theme_id) {
+ case TH_ACTIVE:
+ case TH_SELECT:
+ return &stl->g_data->id_ofs_prb_select_dupli;
+ case TH_TRANSFORM:
+ default:
+ return &stl->g_data->id_ofs_prb_transform;
+ }
+ }
+
switch (theme_id) {
case TH_ACTIVE:
return &stl->g_data->id_ofs_prb_active;
@@ -707,8 +724,19 @@ static int *shgroup_theme_id_to_probe_outline_counter(
}
static int *shgroup_theme_id_to_outline_counter(
- OBJECT_StorageList *stl, int theme_id)
+ OBJECT_StorageList *stl, int theme_id, const int base_flag)
{
+ if (UNLIKELY(base_flag & BASE_FROM_DUPLI)) {
+ switch (theme_id) {
+ case TH_ACTIVE:
+ case TH_SELECT:
+ return &stl->g_data->id_ofs_select_dupli;
+ case TH_TRANSFORM:
+ default:
+ return &stl->g_data->id_ofs_transform;
+ }
+ }
+
switch (theme_id) {
case TH_ACTIVE:
return &stl->g_data->id_ofs_active;
@@ -736,9 +764,20 @@ static DRWShadingGroup *shgroup_theme_id_to_probe_planar_outline_shgrp(
}
static DRWShadingGroup *shgroup_theme_id_to_probe_cube_outline_shgrp(
- OBJECT_StorageList *stl, int theme_id)
+ OBJECT_StorageList *stl, int theme_id, const int base_flag)
{
/* does not increment counter */
+ if (UNLIKELY(base_flag & BASE_FROM_DUPLI)) {
+ switch (theme_id) {
+ case TH_ACTIVE:
+ case TH_SELECT:
+ return stl->g_data->lightprobes_cube_select_dupli;
+ case TH_TRANSFORM:
+ default:
+ return stl->g_data->lightprobes_cube_transform;
+ }
+ }
+
switch (theme_id) {
case TH_ACTIVE:
return stl->g_data->lightprobes_cube_active;
@@ -750,12 +789,24 @@ static DRWShadingGroup *shgroup_theme_id_to_probe_cube_outline_shgrp(
}
}
-static DRWShadingGroup *shgroup_theme_id_to_outline_or(
- OBJECT_StorageList *stl, int theme_id, DRWShadingGroup *fallback)
+static DRWShadingGroup *shgroup_theme_id_to_outline_or_null(
+ OBJECT_StorageList *stl, int theme_id, const int base_flag)
{
- int *counter = shgroup_theme_id_to_outline_counter(stl, theme_id);
+ int *counter = shgroup_theme_id_to_outline_counter(stl, theme_id, base_flag);
*counter += 1;
+ if (UNLIKELY(base_flag & BASE_FROM_DUPLI)) {
+ switch (theme_id) {
+ case TH_ACTIVE:
+ case TH_SELECT:
+ return stl->g_data->outlines_select_dupli;
+ case TH_TRANSFORM:
+ return stl->g_data->outlines_transform;
+ default:
+ return NULL;
+ }
+ }
+
switch (theme_id) {
case TH_ACTIVE:
return stl->g_data->outlines_active;
@@ -764,13 +815,28 @@ static DRWShadingGroup *shgroup_theme_id_to_outline_or(
case TH_TRANSFORM:
return stl->g_data->outlines_transform;
default:
- return fallback;
+ return NULL;
}
}
-static DRWShadingGroup *shgroup_theme_id_to_wire_or(
- OBJECT_ShadingGroupList *sgl, int theme_id, DRWShadingGroup *fallback)
+static DRWShadingGroup *shgroup_theme_id_to_wire(
+ OBJECT_ShadingGroupList *sgl, int theme_id, const short base_flag)
{
+ if (UNLIKELY(base_flag & BASE_FROM_SET)) {
+ return sgl->wire_dupli;
+ }
+ else if (UNLIKELY(base_flag & BASE_FROM_DUPLI)) {
+ switch (theme_id) {
+ case TH_ACTIVE:
+ case TH_SELECT:
+ return sgl->wire_dupli_select;
+ case TH_TRANSFORM:
+ return sgl->wire_transform;
+ default:
+ return sgl->wire_dupli;
+ }
+ }
+
switch (theme_id) {
case TH_ACTIVE:
return sgl->wire_active;
@@ -779,13 +845,28 @@ static DRWShadingGroup *shgroup_theme_id_to_wire_or(
case TH_TRANSFORM:
return sgl->wire_transform;
default:
- return fallback;
+ return sgl->wire;
}
}
-static DRWShadingGroup *shgroup_theme_id_to_point_or(
- OBJECT_ShadingGroupList *sgl, int theme_id, DRWShadingGroup *fallback)
+static DRWShadingGroup *shgroup_theme_id_to_point(
+ OBJECT_ShadingGroupList *sgl, int theme_id, const short base_flag)
{
+ if (UNLIKELY(base_flag & BASE_FROM_SET)) {
+ return sgl->points_dupli;
+ }
+ else if (UNLIKELY(base_flag & BASE_FROM_DUPLI)) {
+ switch (theme_id) {
+ case TH_ACTIVE:
+ case TH_SELECT:
+ return sgl->points_dupli_select;
+ case TH_TRANSFORM:
+ return sgl->points_transform;
+ default:
+ return sgl->points_dupli;
+ }
+ }
+
switch (theme_id) {
case TH_ACTIVE:
return sgl->points_active;
@@ -794,7 +875,7 @@ static DRWShadingGroup *shgroup_theme_id_to_point_or(
case TH_TRANSFORM:
return sgl->points_transform;
default:
- return fallback;
+ return sgl->points;
}
}
@@ -833,12 +914,14 @@ static void image_calc_aspect(Image *ima, const int size[2], float r_image_aspec
}
static void DRW_shgroup_empty_image(
- OBJECT_ShadingGroupList *sgl, Object *ob, const float color[3], RegionView3D *rv3d)
+ OBJECT_Shaders *sh_data, OBJECT_ShadingGroupList *sgl,
+ Object *ob, const float color[3], RegionView3D *rv3d, eGPUShaderConfig sh_cfg)
{
/* TODO: 'StereoViews', see draw_empty_image. */
- if (!BKE_object_empty_image_is_visible_in_view3d(ob, rv3d))
+ if (!BKE_object_empty_image_frame_is_visible_in_view3d(ob, rv3d)) {
return;
+ }
/* Calling 'BKE_image_get_size' may free the texture. Get the size from 'tex' instead, see: T59347 */
int size[2] = {0};
@@ -846,7 +929,7 @@ static void DRW_shgroup_empty_image(
GPUTexture *tex = NULL;
if (ob->data != NULL) {
- tex = GPU_texture_from_blender(ob->data, ob->iuser, GL_TEXTURE_2D, false, 0.0f);
+ tex = GPU_texture_from_blender(ob->data, ob->iuser, GL_TEXTURE_2D, false);
if (tex) {
size[0] = GPU_texture_width(tex);
size[1] = GPU_texture_height(tex);
@@ -862,8 +945,8 @@ static void DRW_shgroup_empty_image(
/* OPTI(fclem) We need sorting only for transparent images. If an image as no alpha channel and
* ob->col[3] == 1.0f, we could remove it from the sorting pass. */
- if (tex && (ob->col[3] > 0.0f)) {
- DRWShadingGroup *grp = DRW_shgroup_create(e_data.object_empty_image_sh, sgl->image_empties);
+ if (tex && (ob->color[3] > 0.0f) && BKE_object_empty_image_data_is_visible_in_view3d(ob, rv3d)) {
+ DRWShadingGroup *grp = DRW_shgroup_create(sh_data->object_empty_image, sgl->image_empties);
DRW_shgroup_uniform_texture(grp, "image", tex);
/* TODO(fclem) implement DRW_shgroup_uniform_vec2_copy */
DRW_shgroup_uniform_float_copy(grp, "aspectX", image_aspect[0]);
@@ -871,12 +954,15 @@ static void DRW_shgroup_empty_image(
DRW_shgroup_uniform_int_copy(grp, "depthMode", ob->empty_image_depth);
DRW_shgroup_uniform_float(grp, "size", &ob->empty_drawsize, 1);
DRW_shgroup_uniform_vec2(grp, "offset", ob->ima_ofs, 1);
- DRW_shgroup_uniform_vec4(grp, "objectColor", ob->col, 1);
+ DRW_shgroup_uniform_vec4(grp, "objectColor", ob->color, 1);
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
DRW_shgroup_call_add(grp, DRW_cache_image_plane_get(), ob->obmat);
}
{
- DRWShadingGroup *grp = DRW_shgroup_create(e_data.object_empty_image_wire_sh, sgl->non_meshes);
+ DRWShadingGroup *grp = DRW_shgroup_create(sh_data->object_empty_image_wire, sgl->non_meshes);
/* TODO(fclem) implement DRW_shgroup_uniform_vec2_copy */
DRW_shgroup_uniform_float_copy(grp, "aspectX", image_aspect[0]);
DRW_shgroup_uniform_float_copy(grp, "aspectY", image_aspect[1]);
@@ -884,19 +970,26 @@ static void DRW_shgroup_empty_image(
DRW_shgroup_uniform_float(grp, "size", &ob->empty_drawsize, 1);
DRW_shgroup_uniform_vec2(grp, "offset", ob->ima_ofs, 1);
DRW_shgroup_uniform_vec3(grp, "color", color, 1);
+ if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
+ }
DRW_shgroup_call_add(grp, DRW_cache_image_plane_wire_get(), ob->obmat);
}
}
static void OBJECT_cache_init(void *vedata)
{
+ const GlobalsUboStorage *gb = &G_draw.block;
OBJECT_PassList *psl = ((OBJECT_Data *)vedata)->psl;
OBJECT_StorageList *stl = ((OBJECT_Data *)vedata)->stl;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
OBJECT_PrivateData *g_data;
const DRWContextState *draw_ctx = DRW_context_state_get();
- /* TODO : use dpi setting for enabling the second pass */
- const bool do_outline_expand = false;
+ OBJECT_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+
+ const float outline_width = UI_GetThemeValuef(TH_OUTLINE_WIDTH);
+ const bool do_outline_expand = (U.pixelsize > 1.0) || (outline_width > 2.0f);
+ const bool do_large_expand = ((U.pixelsize > 1.0) && (outline_width > 2.0f)) || (outline_width > 4.0f);
if (!stl->g_data) {
/* Alloc transient pointers */
@@ -904,23 +997,27 @@ static void OBJECT_cache_init(void *vedata)
}
g_data = stl->g_data;
- g_data->xray_enabled = XRAY_ENABLED(draw_ctx->v3d) && (draw_ctx->v3d->shading.type < OB_MATERIAL);
+ g_data->xray_enabled = XRAY_ENABLED(draw_ctx->v3d) &&
+ (draw_ctx->v3d->shading.type < OB_MATERIAL);
+ g_data->xray_enabled_and_not_wire = g_data->xray_enabled && draw_ctx->v3d->shading.type > OB_WIRE;
{
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE;
psl->outlines = DRW_pass_create("Outlines Depth Pass", state);
- GPUShader *sh = e_data.outline_prepass_sh;
+ GPUShader *sh = sh_data->outline_prepass;
- if (g_data->xray_enabled) {
- sh = e_data.outline_prepass_wire_sh;
+ if (g_data->xray_enabled_and_not_wire) {
+ sh = sh_data->outline_prepass_wire;
}
- g_data->outlines_select = shgroup_outline(psl->outlines, &g_data->id_ofs_select, sh);
- g_data->outlines_transform = shgroup_outline(psl->outlines, &g_data->id_ofs_transform, sh);
- g_data->outlines_active = shgroup_outline(psl->outlines, &g_data->id_ofs_active, sh);
+ g_data->outlines_select = shgroup_outline(psl->outlines, &g_data->id_ofs_select, sh, draw_ctx->sh_cfg);
+ g_data->outlines_select_dupli = shgroup_outline(psl->outlines, &g_data->id_ofs_select_dupli, sh, draw_ctx->sh_cfg);
+ g_data->outlines_transform = shgroup_outline(psl->outlines, &g_data->id_ofs_transform, sh, draw_ctx->sh_cfg);
+ g_data->outlines_active = shgroup_outline(psl->outlines, &g_data->id_ofs_active, sh, draw_ctx->sh_cfg);
g_data->id_ofs_select = 0;
+ g_data->id_ofs_select_dupli = 0;
g_data->id_ofs_active = 0;
g_data->id_ofs_transform = 0;
}
@@ -933,15 +1030,18 @@ static void OBJECT_cache_init(void *vedata)
/* Cubemap */
g_data->lightprobes_cube_select = shgroup_instance_outline(pass, sphere, &g_data->id_ofs_prb_select);
+ g_data->lightprobes_cube_select_dupli = shgroup_instance_outline(pass, sphere, &g_data->id_ofs_prb_select_dupli);
g_data->lightprobes_cube_active = shgroup_instance_outline(pass, sphere, &g_data->id_ofs_prb_active);
g_data->lightprobes_cube_transform = shgroup_instance_outline(pass, sphere, &g_data->id_ofs_prb_transform);
/* Planar */
g_data->lightprobes_planar_select = shgroup_instance_outline(pass, quad, &g_data->id_ofs_prb_select);
+ g_data->lightprobes_planar_select_dupli = shgroup_instance_outline(pass, quad, &g_data->id_ofs_prb_select_dupli);
g_data->lightprobes_planar_active = shgroup_instance_outline(pass, quad, &g_data->id_ofs_prb_active);
g_data->lightprobes_planar_transform = shgroup_instance_outline(pass, quad, &g_data->id_ofs_prb_transform);
g_data->id_ofs_prb_select = 0;
+ g_data->id_ofs_prb_select_dupli = 0;
g_data->id_ofs_prb_active = 0;
g_data->id_ofs_prb_transform = 0;
}
@@ -951,35 +1051,34 @@ static void OBJECT_cache_init(void *vedata)
struct GPUBatch *quad = DRW_cache_fullscreen_quad_get();
/* Don't occlude the "outline" detection pass if in xray mode (too much flickering). */
float alphaOcclu = (g_data->xray_enabled) ? 1.0f : 0.35f;
- /* Reminder : bool uniforms need to be 4 bytes. */
- static const int bTrue = true;
- static const int bFalse = false;
psl->outlines_search = DRW_pass_create("Outlines Detect Pass", state);
- GPUShader *sh = (g_data->xray_enabled) ? e_data.outline_detect_wire_sh : e_data.outline_detect_sh;
+ GPUShader *sh = (g_data->xray_enabled_and_not_wire) ? sh_data->outline_detect_wire : sh_data->outline_detect;
DRWShadingGroup *grp = DRW_shgroup_create(sh, psl->outlines_search);
DRW_shgroup_uniform_texture_ref(grp, "outlineId", &e_data.outlines_id_tx);
DRW_shgroup_uniform_texture_ref(grp, "outlineDepth", &e_data.outlines_depth_tx);
DRW_shgroup_uniform_texture_ref(grp, "sceneDepth", &dtxl->depth);
- DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_float_copy(grp, "alphaOcclu", alphaOcclu);
- DRW_shgroup_uniform_int(grp, "idOffsets", &stl->g_data->id_ofs_active, 3);
+ DRW_shgroup_uniform_int(grp, "idOffsets", &stl->g_data->id_ofs_active, 4);
DRW_shgroup_call_add(grp, quad, NULL);
+ /* This is the bleed pass if do_outline_expand is false. */
+ GPUShader *fade_sh = (do_large_expand) ? sh_data->outline_fade_large : sh_data->outline_fade;
psl->outlines_expand = DRW_pass_create("Outlines Expand Pass", state);
- grp = DRW_shgroup_create(e_data.outline_fade_sh, psl->outlines_expand);
+ grp = DRW_shgroup_create(fade_sh, psl->outlines_expand);
DRW_shgroup_uniform_texture_ref(grp, "outlineColor", &e_data.outlines_blur_tx);
- DRW_shgroup_uniform_bool(grp, "doExpand", (do_outline_expand) ? &bTrue : &bFalse, 1);
+ DRW_shgroup_uniform_bool_copy(grp, "doExpand", do_outline_expand);
DRW_shgroup_call_add(grp, quad, NULL);
psl->outlines_bleed = DRW_pass_create("Outlines Bleed Pass", state);
if (do_outline_expand) {
- grp = DRW_shgroup_create(e_data.outline_fade_sh, psl->outlines_bleed);
+ grp = DRW_shgroup_create(sh_data->outline_fade, psl->outlines_bleed);
DRW_shgroup_uniform_texture_ref(grp, "outlineColor", &e_data.outlines_color_tx);
- DRW_shgroup_uniform_bool(grp, "doExpand", &bFalse, 1);
+ DRW_shgroup_uniform_bool_copy(grp, "doExpand", false);
DRW_shgroup_call_add(grp, quad, NULL);
}
}
@@ -991,7 +1090,7 @@ static void OBJECT_cache_init(void *vedata)
struct GPUBatch *quad = DRW_cache_fullscreen_quad_get();
GPUTexture **outline_tx = (do_outline_expand) ? &e_data.outlines_blur_tx : &e_data.outlines_color_tx;
- DRWShadingGroup *grp = DRW_shgroup_create(e_data.outline_resolve_aa_sh, psl->outlines_resolve);
+ DRWShadingGroup *grp = DRW_shgroup_create(sh_data->outline_resolve_aa, psl->outlines_resolve);
DRW_shgroup_uniform_texture_ref(grp, "outlineBluredColor", outline_tx);
DRW_shgroup_uniform_vec2(grp, "rcpDimensions", e_data.inv_viewport_size, 1);
DRW_shgroup_call_add(grp, quad, NULL);
@@ -1008,33 +1107,29 @@ static void OBJECT_cache_init(void *vedata)
unit_m4(mat);
/* Create 3 quads to render ordered transparency Z axis */
- DRWShadingGroup *grp = DRW_shgroup_create(e_data.grid_sh, psl->grid);
+ DRWShadingGroup *grp = DRW_shgroup_create(sh_data->grid, psl->grid);
DRW_shgroup_uniform_int(grp, "gridFlag", &e_data.zneg_flag, 1);
- DRW_shgroup_uniform_vec3(grp, "planeNormal", e_data.zplane_normal, 1);
DRW_shgroup_uniform_vec3(grp, "planeAxes", e_data.zplane_axes, 1);
DRW_shgroup_uniform_vec3(grp, "cameraPos", e_data.camera_pos, 1);
- DRW_shgroup_uniform_vec4(grp, "screenvecs[0]", e_data.screenvecs[0], 3);
DRW_shgroup_uniform_vec4(grp, "gridSettings", e_data.grid_settings, 1);
DRW_shgroup_uniform_float_copy(grp, "lineKernel", grid_line_size);
+ DRW_shgroup_uniform_float_copy(grp, "meshSize", e_data.grid_mesh_size);
DRW_shgroup_uniform_float(grp, "gridOneOverLogSubdiv", &e_data.grid_settings[4], 1);
- DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo);
- DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth);
DRW_shgroup_call_add(grp, geom, mat);
- grp = DRW_shgroup_create(e_data.grid_sh, psl->grid);
+ grp = DRW_shgroup_create(sh_data->grid, psl->grid);
DRW_shgroup_uniform_int(grp, "gridFlag", &e_data.grid_flag, 1);
- DRW_shgroup_uniform_vec3(grp, "planeNormal", e_data.grid_normal, 1);
DRW_shgroup_uniform_vec3(grp, "planeAxes", e_data.grid_axes, 1);
- DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth);
DRW_shgroup_call_add(grp, geom, mat);
- grp = DRW_shgroup_create(e_data.grid_sh, psl->grid);
+ grp = DRW_shgroup_create(sh_data->grid, psl->grid);
DRW_shgroup_uniform_int(grp, "gridFlag", &e_data.zpos_flag, 1);
- DRW_shgroup_uniform_vec3(grp, "planeNormal", e_data.zplane_normal, 1);
DRW_shgroup_uniform_vec3(grp, "planeAxes", e_data.zplane_axes, 1);
- DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth);
DRW_shgroup_call_add(grp, geom, mat);
}
@@ -1062,7 +1157,7 @@ static void OBJECT_cache_init(void *vedata)
for (int i = 0; i < 2; ++i) {
OBJECT_ShadingGroupList *sgl = (i == 1) ? &stl->g_data->sgl_ghost : &stl->g_data->sgl;
- /* Non Meshes Pass (Camera, empties, lamps ...) */
+ /* Non Meshes Pass (Camera, empties, lights ...) */
struct GPUBatch *geom;
struct GPUShader *sh;
@@ -1077,215 +1172,237 @@ static void OBJECT_cache_init(void *vedata)
/* Empties */
geom = DRW_cache_plain_axes_get();
- sgl->plain_axes = shgroup_instance(sgl->non_meshes, geom);
+ sgl->plain_axes = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_empty_cube_get();
- sgl->cube = shgroup_instance(sgl->non_meshes, geom);
+ sgl->cube = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_circle_get();
- sgl->circle = shgroup_instance(sgl->non_meshes, geom);
+ sgl->circle = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_empty_sphere_get();
- sgl->sphere = shgroup_instance(sgl->non_meshes, geom);
+ sgl->sphere = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_sphere_get();
sgl->sphere_solid = shgroup_instance_solid(sgl->non_meshes, geom);
geom = DRW_cache_empty_cylinder_get();
- sgl->cylinder = shgroup_instance(sgl->non_meshes, geom);
+ sgl->cylinder = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_empty_capsule_cap_get();
- sgl->capsule_cap = shgroup_instance(sgl->non_meshes, geom);
+ sgl->capsule_cap = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_empty_capsule_body_get();
- sgl->capsule_body = shgroup_instance(sgl->non_meshes, geom);
+ sgl->capsule_body = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_empty_cone_get();
- sgl->cone = shgroup_instance(sgl->non_meshes, geom);
+ sgl->cone = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_single_arrow_get();
- sgl->single_arrow = shgroup_instance(sgl->non_meshes, geom);
+ sgl->single_arrow = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_single_line_get();
- sgl->single_arrow_line = shgroup_instance(sgl->non_meshes, geom);
+ sgl->single_arrow_line = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_bone_arrows_get();
- sgl->empty_axes = shgroup_instance_empty_axes(sgl->non_meshes, geom);
+ sgl->empty_axes = shgroup_instance_empty_axes(sgl->non_meshes, geom, draw_ctx->sh_cfg);
/* Force Field */
geom = DRW_cache_field_wind_get();
- sgl->field_wind = shgroup_instance_scaled(sgl->non_meshes, geom);
+ sgl->field_wind = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_field_force_get();
- sgl->field_force = shgroup_instance_screen_aligned(sgl->non_meshes, geom);
+ sgl->field_force = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_field_vortex_get();
- sgl->field_vortex = shgroup_instance_scaled(sgl->non_meshes, geom);
+ sgl->field_vortex = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_screenspace_circle_get();
- sgl->field_curve_sta = shgroup_instance_screen_aligned(sgl->non_meshes, geom);
+ sgl->field_curve_sta = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->sh_cfg);
/* Grease Pencil */
geom = DRW_cache_gpencil_axes_get();
- sgl->gpencil_axes = shgroup_instance(sgl->non_meshes, geom);
+ sgl->gpencil_axes = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
/* Speaker */
geom = DRW_cache_speaker_get();
- sgl->speaker = shgroup_instance(sgl->non_meshes, geom);
+ sgl->speaker = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
/* Probe */
static float probeSize = 14.0f;
geom = DRW_cache_lightprobe_cube_get();
- sgl->probe_cube = shgroup_instance_screenspace(sgl->non_meshes, geom, &probeSize);
+ sgl->probe_cube = shgroup_instance_screenspace(sgl->non_meshes, geom, &probeSize, draw_ctx->sh_cfg);
geom = DRW_cache_lightprobe_grid_get();
- sgl->probe_grid = shgroup_instance_screenspace(sgl->non_meshes, geom, &probeSize);
+ sgl->probe_grid = shgroup_instance_screenspace(sgl->non_meshes, geom, &probeSize, draw_ctx->sh_cfg);
static float probePlanarSize = 20.0f;
geom = DRW_cache_lightprobe_planar_get();
- sgl->probe_planar = shgroup_instance_screenspace(sgl->non_meshes, geom, &probePlanarSize);
+ sgl->probe_planar = shgroup_instance_screenspace(sgl->non_meshes, geom, &probePlanarSize, draw_ctx->sh_cfg);
/* Camera */
geom = DRW_cache_camera_get();
- sgl->camera = shgroup_camera_instance(sgl->non_meshes, geom);
+ sgl->camera = shgroup_camera_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_camera_frame_get();
- sgl->camera_frame = shgroup_camera_instance(sgl->non_meshes, geom);
+ sgl->camera_frame = shgroup_camera_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_camera_tria_get();
- sgl->camera_tria = shgroup_camera_instance(sgl->non_meshes, geom);
+ sgl->camera_tria = shgroup_camera_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_plain_axes_get();
- sgl->camera_focus = shgroup_instance(sgl->non_meshes, geom);
+ sgl->camera_focus = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_single_line_get();
- sgl->camera_clip = shgroup_distance_lines_instance(sgl->non_meshes, geom);
- sgl->camera_mist = shgroup_distance_lines_instance(sgl->non_meshes, geom);
+ sgl->camera_clip = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
+ sgl->camera_mist = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_single_line_endpoints_get();
- sgl->camera_clip_points = shgroup_distance_lines_instance(sgl->non_meshes, geom);
- sgl->camera_mist_points = shgroup_distance_lines_instance(sgl->non_meshes, geom);
+ sgl->camera_clip_points = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
+ sgl->camera_mist_points = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
+
+ geom = DRW_cache_quad_wires_get();
+ sgl->camera_stereo_plane_wires = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
+ DRW_shgroup_state_enable(sgl->camera_stereo_plane_wires, DRW_STATE_WIRE);
+
+ geom = DRW_cache_empty_cube_get();
+ sgl->camera_stereo_volume_wires = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
BLI_listbase_clear(&sgl->camera_path);
/* Texture Space */
geom = DRW_cache_empty_cube_get();
- sgl->texspace = shgroup_instance(sgl->non_meshes, geom);
+ sgl->texspace = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
/* Wires (for loose edges) */
- sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
- sgl->wire = shgroup_wire(sgl->non_meshes, ts.colorWire, sh);
- sgl->wire_select = shgroup_wire(sgl->non_meshes, ts.colorSelect, sh);
- sgl->wire_transform = shgroup_wire(sgl->non_meshes, ts.colorTransform, sh);
- sgl->wire_active = shgroup_wire(sgl->non_meshes, ts.colorActive, sh);
+ sh = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_UNIFORM_COLOR, draw_ctx->sh_cfg);
+ sgl->wire = shgroup_wire(sgl->non_meshes, gb->colorWire, sh, draw_ctx->sh_cfg);
+ sgl->wire_select = shgroup_wire(sgl->non_meshes, gb->colorSelect, sh, draw_ctx->sh_cfg);
+ sgl->wire_transform = shgroup_wire(sgl->non_meshes, gb->colorTransform, sh, draw_ctx->sh_cfg);
+ sgl->wire_active = shgroup_wire(sgl->non_meshes, gb->colorActive, sh, draw_ctx->sh_cfg);
+ /* Wire (duplicator) */
+ sgl->wire_dupli = shgroup_wire(sgl->non_meshes, gb->colorDupli, sh, draw_ctx->sh_cfg);
+ sgl->wire_dupli_select = shgroup_wire(sgl->non_meshes, gb->colorDupliSelect, sh, draw_ctx->sh_cfg);
/* Points (loose points) */
- sh = e_data.loose_points_sh;
- sgl->points = shgroup_points(sgl->non_meshes, ts.colorWire, sh);
- sgl->points_select = shgroup_points(sgl->non_meshes, ts.colorSelect, sh);
- sgl->points_transform = shgroup_points(sgl->non_meshes, ts.colorTransform, sh);
- sgl->points_active = shgroup_points(sgl->non_meshes, ts.colorActive, sh);
+ sh = sh_data->loose_points;
+ sgl->points = shgroup_points(sgl->non_meshes, gb->colorWire, sh, draw_ctx->sh_cfg);
+ sgl->points_select = shgroup_points(sgl->non_meshes, gb->colorSelect, sh, draw_ctx->sh_cfg);
+ sgl->points_transform = shgroup_points(sgl->non_meshes, gb->colorTransform, sh, draw_ctx->sh_cfg);
+ sgl->points_active = shgroup_points(sgl->non_meshes, gb->colorActive, sh, draw_ctx->sh_cfg);
+ /* Points (duplicator) */
+ sgl->points_dupli = shgroup_points(sgl->non_meshes, gb->colorDupli, sh, draw_ctx->sh_cfg);
+ sgl->points_dupli_select = shgroup_points(sgl->non_meshes, gb->colorDupliSelect, sh, draw_ctx->sh_cfg);
DRW_shgroup_state_disable(sgl->points, DRW_STATE_BLEND);
DRW_shgroup_state_disable(sgl->points_select, DRW_STATE_BLEND);
DRW_shgroup_state_disable(sgl->points_transform, DRW_STATE_BLEND);
DRW_shgroup_state_disable(sgl->points_active, DRW_STATE_BLEND);
+ DRW_shgroup_state_disable(sgl->points_dupli, DRW_STATE_BLEND);
+ DRW_shgroup_state_disable(sgl->points_dupli_select, DRW_STATE_BLEND);
/* Metaballs Handles */
- sgl->mball_handle = shgroup_instance_mball_handles(sgl->non_meshes);
+ sgl->mball_handle = shgroup_instance_mball_handles(sgl->non_meshes, draw_ctx->sh_cfg);
- /* Lamps */
+ /* Lights */
/* TODO
- * for now we create multiple times the same VBO with only lamp center coordinates
+ * for now we create multiple times the same VBO with only light center coordinates
* but ideally we would only create it once */
/* start with buflimit because we don't want stipples */
geom = DRW_cache_single_line_get();
- sgl->lamp_buflimit = shgroup_distance_lines_instance(sgl->non_meshes, geom);
+ sgl->light_buflimit = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
- sgl->lamp_center = shgroup_dynpoints_uniform_color(sgl->non_meshes, ts.colorLampNoAlpha, &ts.sizeLampCenter);
+ sgl->light_center = shgroup_dynpoints_uniform_color(sgl->non_meshes, gb->colorLightNoAlpha, &gb->sizeLightCenter, draw_ctx->sh_cfg);
- geom = DRW_cache_lamp_get();
- sgl->lamp_circle = shgroup_instance_screenspace(sgl->non_meshes, geom, &ts.sizeLampCircle);
- geom = DRW_cache_lamp_shadows_get();
- sgl->lamp_circle_shadow = shgroup_instance_screenspace(sgl->non_meshes, geom, &ts.sizeLampCircleShadow);
+ geom = DRW_cache_light_get();
+ sgl->light_circle = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLightCircle, draw_ctx->sh_cfg);
+ geom = DRW_cache_light_shadows_get();
+ sgl->light_circle_shadow = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLightCircleShadow, draw_ctx->sh_cfg);
- geom = DRW_cache_lamp_sunrays_get();
- sgl->lamp_sunrays = shgroup_instance_screenspace(sgl->non_meshes, geom, &ts.sizeLampCircle);
+ geom = DRW_cache_light_sunrays_get();
+ sgl->light_sunrays = shgroup_instance_screenspace(sgl->non_meshes, geom, &gb->sizeLightCircle, draw_ctx->sh_cfg);
- sgl->lamp_groundline = shgroup_groundlines_uniform_color(sgl->non_meshes, ts.colorLamp);
- sgl->lamp_groundpoint = shgroup_groundpoints_uniform_color(sgl->non_meshes, ts.colorLamp);
+ sgl->light_groundline = shgroup_groundlines_uniform_color(sgl->non_meshes, gb->colorLight, draw_ctx->sh_cfg);
+ sgl->light_groundpoint = shgroup_groundpoints_uniform_color(sgl->non_meshes, gb->colorLight, draw_ctx->sh_cfg);
geom = DRW_cache_screenspace_circle_get();
- sgl->lamp_area_sphere = shgroup_instance_screen_aligned(sgl->non_meshes, geom);
+ sgl->light_area_sphere = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->sh_cfg);
- geom = DRW_cache_lamp_area_square_get();
- sgl->lamp_area_square = shgroup_instance(sgl->non_meshes, geom);
+ geom = DRW_cache_light_area_square_get();
+ sgl->light_area_square = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
- geom = DRW_cache_lamp_area_disk_get();
- sgl->lamp_area_disk = shgroup_instance(sgl->non_meshes, geom);
+ geom = DRW_cache_light_area_disk_get();
+ sgl->light_area_disk = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
- geom = DRW_cache_lamp_hemi_get();
- sgl->lamp_hemi = shgroup_instance(sgl->non_meshes, geom);
+ geom = DRW_cache_light_hemi_get();
+ sgl->light_hemi = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_single_line_get();
- sgl->lamp_distance = shgroup_distance_lines_instance(sgl->non_meshes, geom);
+ sgl->light_distance = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_single_line_endpoints_get();
- sgl->lamp_buflimit_points = shgroup_distance_lines_instance(sgl->non_meshes, geom);
+ sgl->light_buflimit_points = shgroup_distance_lines_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
- geom = DRW_cache_lamp_spot_get();
- sgl->lamp_spot_cone = shgroup_spot_instance(sgl->non_meshes, geom);
+ geom = DRW_cache_light_spot_get();
+ sgl->light_spot_cone = shgroup_spot_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_circle_get();
- sgl->lamp_spot_blend = shgroup_instance(sgl->non_meshes, geom);
+ sgl->light_spot_blend = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
- geom = DRW_cache_lamp_spot_square_get();
- sgl->lamp_spot_pyramid = shgroup_instance(sgl->non_meshes, geom);
+ geom = DRW_cache_light_spot_square_get();
+ sgl->light_spot_pyramid = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
geom = DRW_cache_square_get();
- sgl->lamp_spot_blend_rect = shgroup_instance(sgl->non_meshes, geom);
+ sgl->light_spot_blend_rect = shgroup_instance(sgl->non_meshes, geom, draw_ctx->sh_cfg);
/* -------- STIPPLES ------- */
/* Relationship Lines */
- sgl->relationship_lines = shgroup_dynlines_dashed_uniform_color(sgl->non_meshes, ts.colorWire);
- sgl->constraint_lines = shgroup_dynlines_dashed_uniform_color(sgl->non_meshes, ts.colorGridAxisZ);
+ sgl->relationship_lines = shgroup_dynlines_dashed_uniform_color(sgl->non_meshes, gb->colorWire);
+ sgl->constraint_lines = shgroup_dynlines_dashed_uniform_color(sgl->non_meshes, gb->colorGridAxisZ);
/* Force Field Curve Guide End (here because of stipple) */
/* TODO port to shader stipple */
geom = DRW_cache_screenspace_circle_get();
- sgl->field_curve_end = shgroup_instance_screen_aligned(sgl->non_meshes, geom);
+ sgl->field_curve_end = shgroup_instance_screen_aligned(sgl->non_meshes, geom, draw_ctx->sh_cfg);
/* Force Field Limits */
/* TODO port to shader stipple */
geom = DRW_cache_field_tube_limit_get();
- sgl->field_tube_limit = shgroup_instance_scaled(sgl->non_meshes, geom);
+ sgl->field_tube_limit = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->sh_cfg);
/* TODO port to shader stipple */
geom = DRW_cache_field_cone_limit_get();
- sgl->field_cone_limit = shgroup_instance_scaled(sgl->non_meshes, geom);
+ sgl->field_cone_limit = shgroup_instance_scaled(sgl->non_meshes, geom, draw_ctx->sh_cfg);
- /* Spot shapes */
+ /* Transparent Shapes */
state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND | DRW_STATE_CULL_FRONT;
- sgl->spot_shapes = psl->spot_shapes[i] = DRW_pass_create("Spot Shape Pass", state);
- float cone_spot_alpha = 0.5f;
+ sgl->transp_shapes = psl->transp_shapes[i] = DRW_pass_create("Transparent Shapes", state);
- geom = DRW_cache_lamp_spot_volume_get();
- sgl->lamp_spot_volume = shgroup_instance_alpha(sgl->spot_shapes, geom, cone_spot_alpha);
+ /* Spot cones */
+ geom = DRW_cache_light_spot_volume_get();
+ sgl->light_spot_volume = shgroup_instance_alpha(sgl->transp_shapes, geom, draw_ctx->sh_cfg);
- geom = DRW_cache_lamp_spot_square_volume_get();
- sgl->lamp_spot_volume_rect = shgroup_instance_alpha(sgl->spot_shapes, geom, cone_spot_alpha);
+ geom = DRW_cache_light_spot_square_volume_get();
+ sgl->light_spot_volume_rect = shgroup_instance_alpha(sgl->transp_shapes, geom, draw_ctx->sh_cfg);
- cone_spot_alpha = 0.3f;
- geom = DRW_cache_lamp_spot_volume_get();
- sgl->lamp_spot_volume_outside = shgroup_instance_alpha(sgl->spot_shapes, geom, cone_spot_alpha);
- DRW_shgroup_state_disable(sgl->lamp_spot_volume_outside, DRW_STATE_CULL_FRONT);
- DRW_shgroup_state_enable(sgl->lamp_spot_volume_outside, DRW_STATE_CULL_BACK);
+ geom = DRW_cache_light_spot_volume_get();
+ sgl->light_spot_volume_outside = shgroup_instance_alpha(sgl->transp_shapes, geom, draw_ctx->sh_cfg);
+ DRW_shgroup_state_disable(sgl->light_spot_volume_outside, DRW_STATE_CULL_FRONT);
+ DRW_shgroup_state_enable(sgl->light_spot_volume_outside, DRW_STATE_CULL_BACK);
- geom = DRW_cache_lamp_spot_square_volume_get();
- sgl->lamp_spot_volume_rect_outside = shgroup_instance_alpha(sgl->spot_shapes, geom, cone_spot_alpha);
- DRW_shgroup_state_disable(sgl->lamp_spot_volume_rect_outside, DRW_STATE_CULL_FRONT);
- DRW_shgroup_state_enable(sgl->lamp_spot_volume_rect_outside, DRW_STATE_CULL_BACK);
+ geom = DRW_cache_light_spot_square_volume_get();
+ sgl->light_spot_volume_rect_outside = shgroup_instance_alpha(sgl->transp_shapes, geom, draw_ctx->sh_cfg);
+ DRW_shgroup_state_disable(sgl->light_spot_volume_rect_outside, DRW_STATE_CULL_FRONT);
+ DRW_shgroup_state_enable(sgl->light_spot_volume_rect_outside, DRW_STATE_CULL_BACK);
+
+ /* Camera stereo volumes */
+ geom = DRW_cache_cube_get();
+ sgl->camera_stereo_volume = shgroup_instance_alpha(sgl->transp_shapes, geom, draw_ctx->sh_cfg);
+
+ geom = DRW_cache_quad_get();
+ sgl->camera_stereo_plane = shgroup_instance_alpha(sgl->transp_shapes, geom, draw_ctx->sh_cfg);
+ DRW_shgroup_state_disable(sgl->camera_stereo_plane, DRW_STATE_CULL_FRONT);
}
{
@@ -1299,34 +1416,50 @@ static void OBJECT_cache_init(void *vedata)
outlineWidth = 1.0f * U.pixelsize;
size = U.obcenter_dia * U.pixelsize + outlineWidth;
- GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA);
+ GPUShader *sh = GPU_shader_get_builtin_shader_with_config(
+ GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA, draw_ctx->sh_cfg);
/* Active */
grp = DRW_shgroup_point_batch_create(sh, psl->ob_center);
DRW_shgroup_uniform_float(grp, "size", &size, 1);
DRW_shgroup_uniform_float(grp, "outlineWidth", &outlineWidth, 1);
- DRW_shgroup_uniform_vec4(grp, "color", ts.colorActive, 1);
- DRW_shgroup_uniform_vec4(grp, "outlineColor", ts.colorOutline, 1);
+ DRW_shgroup_uniform_vec4(grp, "color", gb->colorActive, 1);
+ DRW_shgroup_uniform_vec4(grp, "outlineColor", gb->colorOutline, 1);
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, draw_ctx->rv3d);
+ }
stl->g_data->center_active = grp;
/* Select */
grp = DRW_shgroup_point_batch_create(sh, psl->ob_center);
- DRW_shgroup_uniform_vec4(grp, "color", ts.colorSelect, 1);
+ DRW_shgroup_uniform_vec4(grp, "color", gb->colorSelect, 1);
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, draw_ctx->rv3d);
+ }
stl->g_data->center_selected = grp;
/* Deselect */
grp = DRW_shgroup_point_batch_create(sh, psl->ob_center);
- DRW_shgroup_uniform_vec4(grp, "color", ts.colorDeselect, 1);
+ DRW_shgroup_uniform_vec4(grp, "color", gb->colorDeselect, 1);
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, draw_ctx->rv3d);
+ }
stl->g_data->center_deselected = grp;
/* Select (library) */
grp = DRW_shgroup_point_batch_create(sh, psl->ob_center);
- DRW_shgroup_uniform_vec4(grp, "color", ts.colorLibrarySelect, 1);
+ DRW_shgroup_uniform_vec4(grp, "color", gb->colorLibrarySelect, 1);
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, draw_ctx->rv3d);
+ }
stl->g_data->center_selected_lib = grp;
/* Deselect (library) */
grp = DRW_shgroup_point_batch_create(sh, psl->ob_center);
- DRW_shgroup_uniform_vec4(grp, "color", ts.colorLibrary, 1);
+ DRW_shgroup_uniform_vec4(grp, "color", gb->colorLibrary, 1);
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_world_clip_planes_from_rv3d(grp, draw_ctx->rv3d);
+ }
stl->g_data->center_deselected_lib = grp;
}
@@ -1374,55 +1507,58 @@ static void DRW_shgroup_mball_handles(OBJECT_ShadingGroupList *sgl, Object *ob,
}
}
-static void DRW_shgroup_lamp(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer *view_layer)
+static void DRW_shgroup_light(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer *view_layer)
{
- Lamp *la = ob->data;
+ Light *la = ob->data;
float *color;
int theme_id = DRW_object_wire_theme_get(ob, view_layer, &color);
static float zero = 0.0f;
- typedef struct LampEngineData {
+ typedef struct LightEngineData {
DrawData dd;
float shape_mat[4][4];
float spot_blend_mat[4][4];
- } LampEngineData;
+ } LightEngineData;
- LampEngineData *lamp_engine_data =
- (LampEngineData *)DRW_drawdata_ensure(
+ LightEngineData *light_engine_data =
+ (LightEngineData *)DRW_drawdata_ensure(
&ob->id,
&draw_engine_object_type,
- sizeof(LampEngineData),
+ sizeof(LightEngineData),
NULL,
NULL);
- float (*shapemat)[4] = lamp_engine_data->shape_mat;
- float (*spotblendmat)[4] = lamp_engine_data->spot_blend_mat;
+ float (*shapemat)[4] = light_engine_data->shape_mat;
+ float (*spotblendmat)[4] = light_engine_data->spot_blend_mat;
- /* Don't draw the center if it's selected or active */
- if (theme_id == TH_LAMP)
- DRW_shgroup_call_dynamic_add(sgl->lamp_center, ob->obmat[3]);
+ if ((ob->base_flag & (BASE_FROM_SET | BASE_FROM_DUPLI)) == 0) {
+ /* Don't draw the center if it's selected or active */
+ if (theme_id == TH_LIGHT) {
+ DRW_shgroup_call_dynamic_add(sgl->light_center, ob->obmat[3]);
+ }
+ }
/* First circle */
- DRW_shgroup_call_dynamic_add(sgl->lamp_circle, ob->obmat[3], color);
+ DRW_shgroup_call_dynamic_add(sgl->light_circle, ob->obmat[3], color);
/* draw dashed outer circle for shadow */
- DRW_shgroup_call_dynamic_add(sgl->lamp_circle_shadow, ob->obmat[3], color);
+ DRW_shgroup_call_dynamic_add(sgl->light_circle_shadow, ob->obmat[3], color);
/* Distance */
if (ELEM(la->type, LA_SUN, LA_AREA)) {
- DRW_shgroup_call_dynamic_add(sgl->lamp_distance, color, &zero, &la->dist, ob->obmat);
+ DRW_shgroup_call_dynamic_add(sgl->light_distance, color, &zero, &la->dist, ob->obmat);
}
copy_m4_m4(shapemat, ob->obmat);
if (la->type == LA_SUN) {
- DRW_shgroup_call_dynamic_add(sgl->lamp_sunrays, ob->obmat[3], color);
+ DRW_shgroup_call_dynamic_add(sgl->light_sunrays, ob->obmat[3], color);
}
else if (la->type == LA_SPOT) {
float size[3], sizemat[4][4];
static float one = 1.0f;
- float cone_inside[3] = {0.0f, 0.0f, 0.0f};
- float cone_outside[3] = {1.0f, 1.0f, 1.0f};
+ float cone_inside[4] = {0.0f, 0.0f, 0.0f, 0.5f};
+ float cone_outside[4] = {1.0f, 1.0f, 1.0f, 0.3f};
float blend = 1.0f - pow2f(la->spotblend);
size[0] = size[1] = sinf(la->spotsize * 0.5f) * la->dist;
size[2] = cosf(la->spotsize * 0.5f) * la->dist;
@@ -1437,39 +1573,39 @@ static void DRW_shgroup_lamp(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer
mul_m4_m4m4(spotblendmat, shapemat, sizemat);
if (la->mode & LA_SQUARE) {
- DRW_shgroup_call_dynamic_add(sgl->lamp_spot_pyramid, color, &one, shapemat);
+ DRW_shgroup_call_dynamic_add(sgl->light_spot_pyramid, color, &one, shapemat);
/* hide line if it is zero size or overlaps with outer border,
* previously it adjusted to always to show it but that seems
* confusing because it doesn't show the actual blend size */
if (blend != 0.0f && blend != 1.0f) {
- DRW_shgroup_call_dynamic_add(sgl->lamp_spot_blend_rect, color, &one, spotblendmat);
+ DRW_shgroup_call_dynamic_add(sgl->light_spot_blend_rect, color, &one, spotblendmat);
}
if (la->mode & LA_SHOW_CONE) {
- DRW_shgroup_call_dynamic_add(sgl->lamp_spot_volume_rect, cone_inside, &one, shapemat);
- DRW_shgroup_call_dynamic_add(sgl->lamp_spot_volume_rect_outside, cone_outside, &one, shapemat);
+ DRW_shgroup_call_dynamic_add(sgl->light_spot_volume_rect, cone_inside, &one, shapemat);
+ DRW_shgroup_call_dynamic_add(sgl->light_spot_volume_rect_outside, cone_outside, &one, shapemat);
}
}
else {
- DRW_shgroup_call_dynamic_add(sgl->lamp_spot_cone, color, shapemat);
+ DRW_shgroup_call_dynamic_add(sgl->light_spot_cone, color, shapemat);
/* hide line if it is zero size or overlaps with outer border,
* previously it adjusted to always to show it but that seems
* confusing because it doesn't show the actual blend size */
if (blend != 0.0f && blend != 1.0f) {
- DRW_shgroup_call_dynamic_add(sgl->lamp_spot_blend, color, &one, spotblendmat);
+ DRW_shgroup_call_dynamic_add(sgl->light_spot_blend, color, &one, spotblendmat);
}
if (la->mode & LA_SHOW_CONE) {
- DRW_shgroup_call_dynamic_add(sgl->lamp_spot_volume, cone_inside, &one, shapemat);
- DRW_shgroup_call_dynamic_add(sgl->lamp_spot_volume_outside, cone_outside, &one, shapemat);
+ DRW_shgroup_call_dynamic_add(sgl->light_spot_volume, cone_inside, &one, shapemat);
+ DRW_shgroup_call_dynamic_add(sgl->light_spot_volume_outside, cone_outside, &one, shapemat);
}
}
- DRW_shgroup_call_dynamic_add(sgl->lamp_buflimit, color, &la->clipsta, &la->clipend, ob->obmat);
- DRW_shgroup_call_dynamic_add(sgl->lamp_buflimit_points, color, &la->clipsta, &la->clipend, ob->obmat);
+ DRW_shgroup_call_dynamic_add(sgl->light_buflimit, color, &la->clipsta, &la->clipend, ob->obmat);
+ DRW_shgroup_call_dynamic_add(sgl->light_buflimit_points, color, &la->clipsta, &la->clipend, ob->obmat);
}
else if (la->type == LA_AREA) {
float size[3] = {1.0f, 1.0f, 1.0f}, sizemat[4][4];
@@ -1481,10 +1617,10 @@ static void DRW_shgroup_lamp(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer
}
if (ELEM(la->area_shape, LA_AREA_DISK, LA_AREA_ELLIPSE)) {
- DRW_shgroup_call_dynamic_add(sgl->lamp_area_disk, color, &la->area_size, shapemat);
+ DRW_shgroup_call_dynamic_add(sgl->light_area_disk, color, &la->area_size, shapemat);
}
else {
- DRW_shgroup_call_dynamic_add(sgl->lamp_area_square, color, &la->area_size, shapemat);
+ DRW_shgroup_call_dynamic_add(sgl->light_area_square, color, &la->area_size, shapemat);
}
}
@@ -1494,12 +1630,12 @@ static void DRW_shgroup_lamp(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer
shapemat[0][1] = shapemat[0][2] = 0.0f;
shapemat[1][0] = shapemat[1][2] = 0.0f;
shapemat[2][0] = shapemat[2][1] = 0.0f;
- DRW_shgroup_call_dynamic_add(sgl->lamp_area_sphere, color, &la->area_size, shapemat);
+ DRW_shgroup_call_dynamic_add(sgl->light_area_sphere, color, &la->area_size, shapemat);
}
/* Line and point going to the ground */
- DRW_shgroup_call_dynamic_add(sgl->lamp_groundline, ob->obmat[3]);
- DRW_shgroup_call_dynamic_add(sgl->lamp_groundpoint, ob->obmat[3]);
+ DRW_shgroup_call_dynamic_add(sgl->light_groundline, ob->obmat[3]);
+ DRW_shgroup_call_dynamic_add(sgl->light_groundpoint, ob->obmat[3]);
}
static GPUBatch *batch_camera_path_get(
@@ -1536,6 +1672,140 @@ static void batch_camera_path_free(ListBase *camera_paths)
}
}
+static bool camera_view3d_is_stereo3d(Scene *scene, View3D *v3d)
+{
+ return (scene->r.scemode & R_MULTIVIEW) != 0 &&
+ (v3d->stereo3d_flag);
+}
+
+static void camera_stereo3d(
+ OBJECT_ShadingGroupList *sgl,
+ Scene *scene, ViewLayer *view_layer, View3D *v3d,
+ Object *ob, Camera *cam,
+ const float vec[4][3], float drawsize, const float scale[3])
+{
+ const bool is_select = DRW_state_is_select();
+ static float drw_tria_dummy[2][2][2] = {{{0}}};
+ const float fac = (cam->stereo.pivot == CAM_S3D_PIVOT_CENTER) ? 2.0f : 1.0f;
+ float origin[2][3] = {{0}};
+ const char *viewnames[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
+
+ const bool is_stereo3d_cameras = (v3d->stereo3d_flag & V3D_S3D_DISPCAMERAS) && (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D);
+ const bool is_stereo3d_plane = (v3d->stereo3d_flag & V3D_S3D_DISPPLANE) && (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D);
+ const bool is_stereo3d_volume = (v3d->stereo3d_flag & V3D_S3D_DISPVOLUME);
+
+ float *color;
+ DRW_object_wire_theme_get(ob, view_layer, &color);
+
+ for (int eye = 0; eye < 2; eye++) {
+ float obmat[4][4];
+ ob = BKE_camera_multiview_render(scene, ob, viewnames[eye]);
+
+ BKE_camera_multiview_model_matrix_scaled(&scene->r, ob, viewnames[eye], obmat);
+
+ copy_v2_v2(cam->runtime.drw_corners[eye][0], vec[0]);
+ copy_v2_v2(cam->runtime.drw_corners[eye][1], vec[1]);
+ copy_v2_v2(cam->runtime.drw_corners[eye][2], vec[2]);
+ copy_v2_v2(cam->runtime.drw_corners[eye][3], vec[3]);
+
+ cam->runtime.drw_depth[eye] = vec[0][2];
+
+ if (cam->stereo.convergence_mode == CAM_S3D_OFFAXIS) {
+ const float shift_x =
+ ((BKE_camera_multiview_shift_x(&scene->r, ob, viewnames[eye]) - cam->shiftx) *
+ (drawsize * scale[0] * fac));
+
+ for (int i = 0; i < 4; i++) {
+ cam->runtime.drw_corners[eye][i][0] += shift_x;
+ }
+ }
+
+ /* Dummy triangle, draw on top of existent lines so it is invisible. */
+ copy_v2_v2(drw_tria_dummy[eye][0], cam->runtime.drw_corners[eye][0]);
+ copy_v2_v2(drw_tria_dummy[eye][1], cam->runtime.drw_corners[eye][0]);
+
+ if (is_stereo3d_cameras) {
+ DRW_shgroup_call_dynamic_add(
+ sgl->camera_frame, color, cam->runtime.drw_corners[eye],
+ &cam->runtime.drw_depth[eye], cam->runtime.drw_tria, obmat);
+
+ DRW_shgroup_call_dynamic_add(
+ sgl->camera, color, cam->runtime.drw_corners[eye],
+ &cam->runtime.drw_depth[eye], drw_tria_dummy[eye], obmat);
+ }
+
+ /* Connecting line. */
+ mul_m4_v3(obmat, origin[eye]);
+ }
+
+ /* Draw connecting lines. */
+ if (is_stereo3d_cameras) {
+ DRW_shgroup_call_dynamic_add(sgl->relationship_lines, origin[0]);
+ DRW_shgroup_call_dynamic_add(sgl->relationship_lines, origin[1]);
+ }
+
+ /* Draw convergence plane. */
+ if (is_stereo3d_plane && !is_select) {
+ float convergence_plane[4][2];
+ const float offset = cam->stereo.convergence_distance / cam->runtime.drw_depth[0];
+
+ for (int i = 0; i < 4; i++) {
+ mid_v2_v2v2(convergence_plane[i], cam->runtime.drw_corners[0][i], cam->runtime.drw_corners[1][i]);
+ mul_v2_fl(convergence_plane[i], offset);
+ }
+
+ /* We are using a -1,1 quad for this shading group, so we need to
+ * scale and transform it to match the convergence plane border. */
+ static float one = 1.0f;
+ float plane_mat[4][4], scale_mat[4][4];
+ float scale_factor[3] = {1.0f, 1.0f, 1.0f};
+ float color_plane[2][4] = {{0.0f, 0.0f, 0.0f, v3d->stereo3d_convergence_alpha},
+ {0.0f, 0.0f, 0.0f, 1.0f}};
+
+ const float height = convergence_plane[1][1] - convergence_plane[0][1];
+ const float width = convergence_plane[2][0] - convergence_plane[0][0];
+
+ scale_factor[0] = width * 0.5f;
+ scale_factor[1] = height * 0.5f;
+
+ copy_m4_m4(plane_mat, cam->runtime.drw_normalmat);
+ translate_m4(plane_mat, 0.0f, 0.0f, -cam->stereo.convergence_distance);
+ size_to_mat4(scale_mat, scale_factor);
+ mul_m4_m4_post(plane_mat, scale_mat);
+ translate_m4(plane_mat, 2.0f * cam->shiftx, (width / height) * 2.0f * cam->shifty, 0.0f);
+
+ if (v3d->stereo3d_convergence_alpha > 0.0f) {
+ DRW_shgroup_call_dynamic_add(sgl->camera_stereo_plane, color_plane[0], &one, plane_mat);
+ }
+ DRW_shgroup_call_dynamic_add(sgl->camera_stereo_plane_wires, color_plane[1], &one, plane_mat);
+ }
+
+ /* Draw convergence volume. */
+ if (is_stereo3d_volume && !is_select) {
+ static float one = 1.0f;
+ float color_volume[3][4] = {{0.0f, 1.0f, 1.0f, v3d->stereo3d_volume_alpha},
+ {1.0f, 0.0f, 0.0f, v3d->stereo3d_volume_alpha},
+ {0.0f, 0.0f, 0.0f, 1.0f}};
+
+ for (int eye = 0; eye < 2; eye++) {
+ float winmat[4][4], viewinv[4][4], viewmat[4][4], persmat[4][4], persinv[4][4];
+ ob = BKE_camera_multiview_render(scene, ob, viewnames[eye]);
+
+ BKE_camera_multiview_window_matrix(&scene->r, ob, viewnames[eye], winmat);
+ BKE_camera_multiview_model_matrix(&scene->r, ob, viewnames[eye], viewinv);
+
+ invert_m4_m4(viewmat, viewinv);
+ mul_m4_m4m4(persmat, winmat, viewmat);
+ invert_m4_m4(persinv, persmat);
+
+ if (v3d->stereo3d_volume_alpha > 0.0f) {
+ DRW_shgroup_call_dynamic_add(sgl->camera_stereo_volume, color_volume[eye], &one, persinv);
+ }
+ DRW_shgroup_call_dynamic_add(sgl->camera_stereo_volume_wires, color_volume[2], &one, persinv);
+ }
+ }
+}
+
static void DRW_shgroup_camera(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer *view_layer)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
@@ -1545,99 +1815,140 @@ static void DRW_shgroup_camera(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLay
Camera *cam = ob->data;
const Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, v3d->camera);
+ const bool is_select = DRW_state_is_select();
const bool is_active = (ob == camera_object);
const bool look_through = (is_active && (rv3d->persp == RV3D_CAMOB));
+ const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0;
+ const bool is_stereo3d = is_active && camera_view3d_is_stereo3d(scene, v3d);
+ const bool is_stereo3d_view = (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D);
+ const bool is_stereo3d_cameras = (ob == scene->camera) &&
+ is_multiview &&
+ is_stereo3d_view &&
+ (v3d->stereo3d_flag & V3D_S3D_DISPCAMERAS);
+ const bool is_selection_camera_stereo = is_select &&
+ look_through && is_multiview &&
+ is_stereo3d_view;
+
float *color;
DRW_object_wire_theme_get(ob, view_layer, &color);
float vec[4][3], asp[2], shift[2], scale[3], drawsize;
- scale[0] = 1.0f / len_v3(ob->obmat[0]);
- scale[1] = 1.0f / len_v3(ob->obmat[1]);
- scale[2] = 1.0f / len_v3(ob->obmat[2]);
+ /* BKE_camera_multiview_model_matrix already accounts for scale, don't do it here. */
+ if (is_selection_camera_stereo) {
+ scale[0] = 1.0f;
+ scale[1] = 1.0f;
+ scale[2] = 1.0f;
+ }
+ else {
+ scale[0] = 1.0f / len_v3(ob->obmat[0]);
+ scale[1] = 1.0f / len_v3(ob->obmat[1]);
+ scale[2] = 1.0f / len_v3(ob->obmat[2]);
+ }
BKE_camera_view_frame_ex(scene, cam, cam->drawsize, false, scale,
asp, shift, &drawsize, vec);
/* Frame coords */
- copy_v2_v2(cam->drwcorners[0], vec[0]);
- copy_v2_v2(cam->drwcorners[1], vec[1]);
- copy_v2_v2(cam->drwcorners[2], vec[2]);
- copy_v2_v2(cam->drwcorners[3], vec[3]);
+ copy_v2_v2(cam->runtime.drw_corners[0][0], vec[0]);
+ copy_v2_v2(cam->runtime.drw_corners[0][1], vec[1]);
+ copy_v2_v2(cam->runtime.drw_corners[0][2], vec[2]);
+ copy_v2_v2(cam->runtime.drw_corners[0][3], vec[3]);
/* depth */
- cam->drwdepth = vec[0][2];
+ cam->runtime.drw_depth[0] = vec[0][2];
/* tria */
- cam->drwtria[0][0] = shift[0] + ((0.7f * drawsize) * scale[0]);
- cam->drwtria[0][1] = shift[1] + ((drawsize * (asp[1] + 0.1f)) * scale[1]);
- cam->drwtria[1][0] = shift[0];
- cam->drwtria[1][1] = shift[1] + ((1.1f * drawsize * (asp[1] + 0.7f)) * scale[1]);
+ cam->runtime.drw_tria[0][0] = shift[0] + ((0.7f * drawsize) * scale[0]);
+ cam->runtime.drw_tria[0][1] = shift[1] + ((drawsize * (asp[1] + 0.1f)) * scale[1]);
+ cam->runtime.drw_tria[1][0] = shift[0];
+ cam->runtime.drw_tria[1][1] = shift[1] + ((1.1f * drawsize * (asp[1] + 0.7f)) * scale[1]);
if (look_through) {
/* Only draw the frame. */
+ float mat[4][4];
+ if (is_stereo3d_view) {
+ const bool is_left = v3d->multiview_eye == STEREO_LEFT_ID;
+ const char *view_name = is_left ? STEREO_LEFT_NAME : STEREO_RIGHT_NAME;
+ BKE_camera_multiview_model_matrix(&scene->r, ob, view_name, mat);
+ const float shiftx = BKE_camera_multiview_shift_x(&scene->r, ob, view_name);
+ cam->runtime.drw_corners[0][0][0] += shiftx;
+ cam->runtime.drw_corners[0][1][0] += shiftx;
+ cam->runtime.drw_corners[0][2][0] += shiftx;
+ cam->runtime.drw_corners[0][3][0] += shiftx;
+ }
+ else {
+ copy_m4_m4(mat, ob->obmat);
+ }
+
DRW_shgroup_call_dynamic_add(
- sgl->camera_frame, color, cam->drwcorners,
- &cam->drwdepth, cam->drwtria, ob->obmat);
+ sgl->camera_frame, color, cam->runtime.drw_corners[0],
+ &cam->runtime.drw_depth[0], cam->runtime.drw_tria, mat);
}
else {
- DRW_shgroup_call_dynamic_add(
- sgl->camera, color, cam->drwcorners,
- &cam->drwdepth, cam->drwtria, ob->obmat);
+ if (!is_stereo3d_cameras) {
+ DRW_shgroup_call_dynamic_add(
+ sgl->camera, color, cam->runtime.drw_corners[0],
+ &cam->runtime.drw_depth[0], cam->runtime.drw_tria, ob->obmat);
+ }
/* Active cam */
if (is_active) {
DRW_shgroup_call_dynamic_add(
sgl->camera_tria, color,
- cam->drwcorners, &cam->drwdepth, cam->drwtria, ob->obmat);
+ cam->runtime.drw_corners[0], &cam->runtime.drw_depth[0], cam->runtime.drw_tria, ob->obmat);
}
}
/* draw the rest in normalize object space */
- normalize_m4_m4(cam->drwnormalmat, ob->obmat);
+ normalize_m4_m4(cam->runtime.drw_normalmat, ob->obmat);
if (cam->flag & CAM_SHOWLIMITS) {
- static float col[3] = {0.5f, 0.5f, 0.25f}, col_hi[3] = {1.0f, 1.0f, 0.5f};
+ static float col[4] = {0.5f, 0.5f, 0.25f, 1.0f}, col_hi[4] = {1.0f, 1.0f, 0.5f, 1.0f};
float sizemat[4][4], size[3] = {1.0f, 1.0f, 0.0f};
float focusdist = BKE_camera_object_dof_distance(ob);
- copy_m4_m4(cam->drwfocusmat, cam->drwnormalmat);
- translate_m4(cam->drwfocusmat, 0.0f, 0.0f, -focusdist);
+ copy_m4_m4(cam->runtime.drw_focusmat, cam->runtime.drw_normalmat);
+ translate_m4(cam->runtime.drw_focusmat, 0.0f, 0.0f, -focusdist);
size_to_mat4(sizemat, size);
- mul_m4_m4m4(cam->drwfocusmat, cam->drwfocusmat, sizemat);
+ mul_m4_m4m4(cam->runtime.drw_focusmat, cam->runtime.drw_focusmat, sizemat);
DRW_shgroup_call_dynamic_add(
sgl->camera_focus, (is_active ? col_hi : col),
- &cam->drawsize, cam->drwfocusmat);
+ &cam->drawsize, cam->runtime.drw_focusmat);
DRW_shgroup_call_dynamic_add(
sgl->camera_clip, color,
- &cam->clipsta, &cam->clipend, cam->drwnormalmat);
+ &cam->clip_start, &cam->clip_end, cam->runtime.drw_normalmat);
DRW_shgroup_call_dynamic_add(
sgl->camera_clip_points, (is_active ? col_hi : col),
- &cam->clipsta, &cam->clipend, cam->drwnormalmat);
+ &cam->clip_start, &cam->clip_end, cam->runtime.drw_normalmat);
}
if (cam->flag & CAM_SHOWMIST) {
World *world = scene->world;
if (world) {
- static float col[3] = {0.5f, 0.5f, 0.5f}, col_hi[3] = {1.0f, 1.0f, 1.0f};
+ static float col[4] = {0.5f, 0.5f, 0.5f, 1.0f}, col_hi[4] = {1.0f, 1.0f, 1.0f, 1.0f};
world->mistend = world->miststa + world->mistdist;
DRW_shgroup_call_dynamic_add(
sgl->camera_mist, color,
- &world->miststa, &world->mistend, cam->drwnormalmat);
+ &world->miststa, &world->mistend, cam->runtime.drw_normalmat);
DRW_shgroup_call_dynamic_add(
sgl->camera_mist_points, (is_active ? col_hi : col),
- &world->miststa, &world->mistend, cam->drwnormalmat);
+ &world->miststa, &world->mistend, cam->runtime.drw_normalmat);
}
}
+ /* Stereo cameras drawing. */
+ if (is_stereo3d && !look_through) {
+ camera_stereo3d(sgl, scene, view_layer, v3d, ob, cam, vec, drawsize, scale);
+ }
+
/* Motion Tracking. */
MovieClip *clip = BKE_object_movieclip_get(scene, ob, false);
if ((v3d->flag2 & V3D_SHOW_RECONSTRUCTION) && (clip != NULL)) {
BLI_assert(BLI_listbase_is_empty(&sgl->camera_path));
- const bool is_select = DRW_state_is_select();
const bool is_solid_bundle = (v3d->bundle_drawtype == OB_EMPTY_SPHERE) &&
((v3d->shading.type != OB_SOLID) ||
((v3d->shading.flag & XRAY_FLAG(v3d)) == 0));
@@ -1677,7 +1988,7 @@ static void DRW_shgroup_camera(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLay
BKE_tracking_camera_get_reconstructed_interpolate(tracking, tracking_object, framenr, object_mat);
invert_m4(object_mat);
- mul_m4_m4m4(tracking_object_mat, cam->drwnormalmat, object_mat);
+ mul_m4_m4m4(tracking_object_mat, cam->runtime.drw_normalmat, object_mat);
}
ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object);
@@ -1708,7 +2019,7 @@ static void DRW_shgroup_camera(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLay
}
if (is_select) {
- DRW_select_load_id(camera_object->select_color | (track_index << 16));
+ DRW_select_load_id(camera_object->select_id | (track_index << 16));
track_index++;
}
@@ -1806,7 +2117,9 @@ static void DRW_shgroup_empty_ex(
}
}
-static void DRW_shgroup_empty(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer *view_layer, RegionView3D *rv3d)
+static void DRW_shgroup_empty(
+ OBJECT_Shaders *sh_data, OBJECT_ShadingGroupList *sgl,
+ Object *ob, ViewLayer *view_layer, RegionView3D *rv3d, eGPUShaderConfig sh_cfg)
{
float *color;
DRW_object_wire_theme_get(ob, view_layer, &color);
@@ -1822,7 +2135,7 @@ static void DRW_shgroup_empty(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLaye
DRW_shgroup_empty_ex(sgl, ob->obmat, &ob->empty_drawsize, ob->empty_drawtype, color);
break;
case OB_EMPTY_IMAGE:
- DRW_shgroup_empty_image(sgl, ob, color, rv3d);
+ DRW_shgroup_empty_image(sh_data, sgl, ob, color, rv3d, sh_cfg);
break;
}
}
@@ -2005,14 +2318,6 @@ static void volumes_free_smoke_textures(void)
BLI_freelistN(&e_data.smoke_domains);
}
-static void DRW_shgroup_gpencil(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer *view_layer)
-{
- float *color;
- DRW_object_wire_theme_get(ob, view_layer, &color);
-
- DRW_shgroup_call_dynamic_add(sgl->gpencil_axes, color, &ob->empty_drawsize, ob->obmat);
-}
-
static void DRW_shgroup_speaker(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLayer *view_layer)
{
float *color;
@@ -2031,7 +2336,9 @@ typedef struct OBJECT_LightProbeEngineData {
float corner[3];
} OBJECT_LightProbeEngineData;
-static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, OBJECT_PassList *psl, Object *ob, ViewLayer *view_layer)
+static void DRW_shgroup_lightprobe(
+ OBJECT_Shaders *sh_data, OBJECT_StorageList *stl, OBJECT_PassList *psl,
+ Object *ob, ViewLayer *view_layer)
{
float *color;
static float one = 1.0f;
@@ -2049,7 +2356,7 @@ static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, OBJECT_PassList *psl
NULL);
if ((DRW_state_is_select() || do_outlines) && ((prb->flag & LIGHTPROBE_FLAG_SHOW_DATA) != 0)) {
- int *call_id = shgroup_theme_id_to_probe_outline_counter(stl, theme_id);
+ int *call_id = shgroup_theme_id_to_probe_outline_counter(stl, theme_id, ob->base_flag);
if (prb->type == LIGHTPROBE_TYPE_GRID) {
/* Update transforms */
@@ -2085,7 +2392,7 @@ static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, OBJECT_PassList *psl
sub_v3_v3(prb_data->increment_z, prb_data->corner);
uint cell_count = prb->grid_resolution_x * prb->grid_resolution_y * prb->grid_resolution_z;
- DRWShadingGroup *grp = DRW_shgroup_create(e_data.lightprobe_grid_sh, psl->lightprobes);
+ DRWShadingGroup *grp = DRW_shgroup_create(sh_data->lightprobe_grid, psl->lightprobes);
DRW_shgroup_uniform_int_copy(grp, "call_id", *call_id);
DRW_shgroup_uniform_int(grp, "baseId", call_id, 1); /* that's correct */
DRW_shgroup_uniform_vec3(grp, "corner", prb_data->corner, 1);
@@ -2102,7 +2409,7 @@ static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, OBJECT_PassList *psl
// unit_m4(prb_data->probe_cube_mat);
// copy_v3_v3(prb_data->probe_cube_mat[3], ob->obmat[3]);
- DRWShadingGroup *grp = shgroup_theme_id_to_probe_cube_outline_shgrp(stl, theme_id);
+ DRWShadingGroup *grp = shgroup_theme_id_to_probe_cube_outline_shgrp(stl, theme_id, ob->base_flag);
/* TODO remove or change the drawing of the cube probes. Theses line draws nothing on purpose
* to keep the call ids correct. */
zero_m4(probe_cube_mat);
@@ -2221,16 +2528,16 @@ static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, OBJECT_PassList *psl
normalize_m4_m4(clipmat, ob->obmat);
mul_m4_m4m4(clipmat, clipmat, cubefacemat[i]);
- DRW_shgroup_call_dynamic_add(sgl->lamp_buflimit, color, &prb->clipsta, &prb->clipend, clipmat);
- DRW_shgroup_call_dynamic_add(sgl->lamp_buflimit_points, color, &prb->clipsta, &prb->clipend, clipmat);
+ DRW_shgroup_call_dynamic_add(sgl->light_buflimit, color, &prb->clipsta, &prb->clipend, clipmat);
+ DRW_shgroup_call_dynamic_add(sgl->light_buflimit_points, color, &prb->clipsta, &prb->clipend, clipmat);
}
}
}
/* Line and point going to the ground */
if (prb->type == LIGHTPROBE_TYPE_CUBE) {
- DRW_shgroup_call_dynamic_add(sgl->lamp_groundline, ob->obmat[3]);
- DRW_shgroup_call_dynamic_add(sgl->lamp_groundpoint, ob->obmat[3]);
+ DRW_shgroup_call_dynamic_add(sgl->light_groundline, ob->obmat[3]);
+ DRW_shgroup_call_dynamic_add(sgl->light_groundpoint, ob->obmat[3]);
}
}
@@ -2241,7 +2548,7 @@ static void DRW_shgroup_relationship_lines(
Object *ob)
{
if (ob->parent && (DRW_object_visibility_in_active_context(ob->parent) & OB_VISIBLE_SELF)) {
- DRW_shgroup_call_dynamic_add(sgl->relationship_lines, ob->orig);
+ DRW_shgroup_call_dynamic_add(sgl->relationship_lines, ob->runtime.parent_display_origin);
DRW_shgroup_call_dynamic_add(sgl->relationship_lines, ob->obmat[3]);
}
@@ -2489,8 +2796,10 @@ static void DRW_shgroup_bounds(OBJECT_ShadingGroupList *sgl, Object *ob, int the
}
}
-static void OBJECT_cache_populate_particles(Object *ob,
- OBJECT_PassList *psl)
+static void OBJECT_cache_populate_particles(
+ OBJECT_Shaders *sh_data,
+ Object *ob,
+ OBJECT_PassList *psl)
{
for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) {
if (!psys_check_enabled(ob, psys, false)) {
@@ -2514,39 +2823,39 @@ static void OBJECT_cache_populate_particles(Object *ob,
static float def_sec_col[3] = {1.0f, 1.0f, 1.0f};
/* Dummy particle format for instancing to work. */
- DRW_shgroup_instance_format(e_data.particle_format, {{"dummy", DRW_ATTRIB_FLOAT, 1}});
+ DRW_shgroup_instance_format(e_data.particle_format, {{"dummy", DRW_ATTR_FLOAT, 1}});
Material *ma = give_current_material(ob, part->omat);
switch (draw_as) {
case PART_DRAW_DOT:
- shgrp = DRW_shgroup_create(e_data.part_dot_sh, psl->particle);
+ shgrp = DRW_shgroup_create(sh_data->part_dot, psl->particle);
DRW_shgroup_uniform_vec3(shgrp, "color", ma ? &ma->r : def_prim_col, 1);
DRW_shgroup_uniform_vec3(shgrp, "outlineColor", ma ? &ma->specr : def_sec_col, 1);
DRW_shgroup_uniform_float(shgrp, "pixel_size", DRW_viewport_pixelsize_get(), 1);
DRW_shgroup_uniform_float(shgrp, "size", &part->draw_size, 1);
- DRW_shgroup_uniform_texture(shgrp, "ramp", globals_ramp);
+ DRW_shgroup_uniform_texture(shgrp, "ramp", G_draw.ramp);
DRW_shgroup_call_add(shgrp, geom, mat);
break;
case PART_DRAW_CROSS:
shgrp = DRW_shgroup_instance_create(
- e_data.part_prim_sh, psl->particle, DRW_cache_particles_get_prim(PART_DRAW_CROSS),
+ sh_data->part_prim, psl->particle, DRW_cache_particles_get_prim(PART_DRAW_CROSS),
e_data.particle_format);
- DRW_shgroup_uniform_texture(shgrp, "ramp", globals_ramp);
+ DRW_shgroup_uniform_texture(shgrp, "ramp", G_draw.ramp);
DRW_shgroup_uniform_vec3(shgrp, "color", ma ? &ma->r : def_prim_col, 1);
DRW_shgroup_uniform_int(shgrp, "screen_space", &screen_space[0], 1);
break;
case PART_DRAW_CIRC:
shgrp = DRW_shgroup_instance_create(
- e_data.part_prim_sh, psl->particle, DRW_cache_particles_get_prim(PART_DRAW_CIRC),
+ sh_data->part_prim, psl->particle, DRW_cache_particles_get_prim(PART_DRAW_CIRC),
e_data.particle_format);
- DRW_shgroup_uniform_texture(shgrp, "ramp", globals_ramp);
+ DRW_shgroup_uniform_texture(shgrp, "ramp", G_draw.ramp);
DRW_shgroup_uniform_vec3(shgrp, "color", ma ? &ma->r : def_prim_col, 1);
DRW_shgroup_uniform_int(shgrp, "screen_space", &screen_space[1], 1);
break;
case PART_DRAW_AXIS:
shgrp = DRW_shgroup_instance_create(
- e_data.part_axis_sh, psl->particle, DRW_cache_particles_get_prim(PART_DRAW_AXIS),
+ sh_data->part_axis, psl->particle, DRW_cache_particles_get_prim(PART_DRAW_AXIS),
e_data.particle_format);
DRW_shgroup_uniform_int(shgrp, "screen_space", &screen_space[0], 1);
break;
@@ -2578,18 +2887,20 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
ModifierData *md = NULL;
int theme_id = TH_UNDEFINED;
const int ob_visibility = DRW_object_visibility_in_active_context(ob);
+ OBJECT_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
/* Handle particles first in case the emitter itself shouldn't be rendered. */
if (ob_visibility & OB_VISIBLE_PARTICLES) {
- OBJECT_cache_populate_particles(ob, psl);
+ OBJECT_cache_populate_particles(sh_data, ob, psl);
}
if ((ob_visibility & OB_VISIBLE_SELF) == 0) {
return;
}
- const bool do_outlines = (draw_ctx->v3d->flag & V3D_SELECT_OUTLINE) && ((ob->base_flag & BASE_SELECTED) != 0) &&
- ((DRW_object_is_renderable(ob) && (ob->dt > OB_WIRE)) || (ob->dt == OB_WIRE));
+ const bool do_outlines = (
+ (draw_ctx->v3d->flag & V3D_SELECT_OUTLINE) && ((ob->base_flag & BASE_SELECTED) != 0) &&
+ ((DRW_object_is_renderable(ob) && (ob->dt > OB_WIRE)) || (ob->dt == OB_WIRE)));
const bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0);
const bool hide_object_extra = (v3d->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS) != 0;
@@ -2606,7 +2917,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
DRW_object_is_flat(ob, &flat_axis) &&
DRW_object_axis_orthogonal_to_view(ob, flat_axis));
- if (stl->g_data->xray_enabled || is_flat_object_viewed_from_side) {
+ if (stl->g_data->xray_enabled_and_not_wire || is_flat_object_viewed_from_side) {
geom = DRW_cache_object_edge_detection_get(ob, NULL);
}
else {
@@ -2615,7 +2926,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (geom) {
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
- DRWShadingGroup *shgroup = shgroup_theme_id_to_outline_or(stl, theme_id, NULL);
+ DRWShadingGroup *shgroup = shgroup_theme_id_to_outline_or_null(stl, theme_id, ob->base_flag);
if (shgroup != NULL) {
DRW_shgroup_call_object_add(shgroup, geom, ob);
}
@@ -2637,28 +2948,25 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (theme_id == TH_UNDEFINED) {
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
}
- DRWShadingGroup *shgroup = shgroup_theme_id_to_point_or(sgl, theme_id, sgl->points);
+ DRWShadingGroup *shgroup = shgroup_theme_id_to_point(sgl, theme_id, ob->base_flag);
DRW_shgroup_call_object_add(shgroup, geom, ob);
}
}
}
else {
- /* Kind of expensive in edit mode. Only show if in wireframe mode. */
bool has_edit_mesh_cage = false;
/* TODO: Should be its own function. */
if (is_edit_mode) {
- BMEditMesh *embm = me->edit_btmesh;
+ BMEditMesh *embm = me->edit_mesh;
has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final);
}
- if (!is_edit_mode ||
- (((v3d->shading.type < OB_SOLID) || (ob->dt == OB_WIRE)) && has_edit_mesh_cage))
- {
+ if (!is_edit_mode || has_edit_mesh_cage) {
struct GPUBatch *geom = DRW_cache_mesh_loose_edges_get(ob);
if (geom) {
if (theme_id == TH_UNDEFINED) {
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
}
- DRWShadingGroup *shgroup = shgroup_theme_id_to_wire_or(sgl, theme_id, sgl->wire);
+ DRWShadingGroup *shgroup = shgroup_theme_id_to_wire(sgl, theme_id, ob->base_flag);
DRW_shgroup_call_object_add(shgroup, geom, ob);
}
}
@@ -2677,7 +2985,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (theme_id == TH_UNDEFINED) {
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
}
- DRWShadingGroup *shgroup = shgroup_theme_id_to_wire_or(sgl, theme_id, sgl->wire);
+ DRWShadingGroup *shgroup = shgroup_theme_id_to_wire(sgl, theme_id, ob->base_flag);
DRW_shgroup_call_object_add(shgroup, geom, ob);
break;
}
@@ -2692,7 +3000,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
}
- DRWShadingGroup *shgroup = shgroup_theme_id_to_wire_or(sgl, theme_id, sgl->wire);
+ DRWShadingGroup *shgroup = shgroup_theme_id_to_wire(sgl, theme_id, ob->base_flag);
DRW_shgroup_call_object_add(shgroup, geom, ob);
}
break;
@@ -2707,7 +3015,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (theme_id == TH_UNDEFINED) {
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
}
- DRWShadingGroup *shgroup = shgroup_theme_id_to_wire_or(sgl, theme_id, sgl->wire);
+ DRWShadingGroup *shgroup = shgroup_theme_id_to_wire(sgl, theme_id, ob->base_flag);
DRW_shgroup_call_object_add(shgroup, geom, ob);
}
break;
@@ -2723,7 +3031,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (hide_object_extra) {
break;
}
- DRW_shgroup_lamp(sgl, ob, view_layer);
+ DRW_shgroup_light(sgl, ob, view_layer);
break;
case OB_CAMERA:
if (hide_object_extra) {
@@ -2735,17 +3043,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (hide_object_extra) {
break;
}
- DRW_shgroup_empty(sgl, ob, view_layer, rv3d);
- break;
- case OB_GPENCIL:
- if (hide_object_extra) {
- break;
- }
- /* in all modes except object mode hide always */
- if (draw_ctx->object_mode != OB_MODE_OBJECT) {
- break;
- }
- DRW_shgroup_gpencil(sgl, ob, view_layer);
+ DRW_shgroup_empty(sh_data, sgl, ob, view_layer, rv3d, draw_ctx->sh_cfg);
break;
case OB_SPEAKER:
if (hide_object_extra) {
@@ -2757,27 +3055,29 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (hide_object_extra) {
break;
}
- DRW_shgroup_lightprobe(stl, psl, ob, view_layer);
+ DRW_shgroup_lightprobe(sh_data, stl, psl, ob, view_layer);
break;
case OB_ARMATURE:
{
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
- (v3d->overlay.flag & V3D_OVERLAY_HIDE_BONES))
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
+ (v3d->overlay.flag & V3D_OVERLAY_HIDE_BONES) ||
+ ((ob->dt < OB_WIRE) && !DRW_state_is_select()))
{
break;
}
bArmature *arm = ob->data;
if (arm->edbo == NULL) {
if (DRW_state_is_select() || !DRW_pose_mode_armature(ob, draw_ctx->obact)) {
+ bool is_wire = (v3d->shading.type == OB_WIRE) || (ob->dt <= OB_WIRE);
DRWArmaturePasses passes = {
- .bone_solid = sgl->bone_solid,
+ .bone_solid = (is_wire) ? NULL : sgl->bone_solid,
.bone_outline = sgl->bone_outline,
.bone_wire = sgl->bone_wire,
.bone_envelope = sgl->bone_envelope,
.bone_axes = sgl->bone_axes,
.relationship_lines = NULL, /* Don't draw relationship lines */
};
- DRW_shgroup_armature_object(ob, view_layer, passes);
+ DRW_shgroup_armature_object(ob, view_layer, passes, is_wire);
}
}
break;
@@ -2795,7 +3095,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (theme_id == TH_UNDEFINED) {
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
}
- DRWShadingGroup *shgroup = shgroup_theme_id_to_wire_or(sgl, theme_id, sgl->wire);
+ DRWShadingGroup *shgroup = shgroup_theme_id_to_wire(sgl, theme_id, ob->base_flag);
DRW_shgroup_call_object_add(shgroup, geom, ob);
}
}
@@ -2817,7 +3117,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
}
/* don't show object extras in set's */
- if ((ob->base_flag & (BASE_FROM_SET | BASE_FROMDUPLI)) == 0) {
+ if ((ob->base_flag & (BASE_FROM_SET | BASE_FROM_DUPLI)) == 0) {
if ((draw_ctx->object_mode & (OB_MODE_ALL_PAINT | OB_MODE_ALL_PAINT_GPENCIL)) == 0) {
DRW_shgroup_object_center(stl, ob, view_layer, v3d);
}
@@ -2885,24 +3185,27 @@ static void OBJECT_draw_scene(void *vedata)
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
- int id_ct_select = g_data->id_ofs_select;
- int id_ct_active = g_data->id_ofs_active;
- int id_ct_transform = g_data->id_ofs_transform;
+ int id_len_select = g_data->id_ofs_select;
+ int id_len_select_dupli = g_data->id_ofs_select_dupli;
+ int id_len_active = g_data->id_ofs_active;
+ int id_len_transform = g_data->id_ofs_transform;
- int id_ct_prb_select = g_data->id_ofs_prb_select;
- int id_ct_prb_active = g_data->id_ofs_prb_active;
- int id_ct_prb_transform = g_data->id_ofs_prb_transform;
+ int id_len_prb_select = g_data->id_ofs_prb_select;
+ int id_len_prb_select_dupli = g_data->id_ofs_prb_select_dupli;
+ int id_len_prb_active = g_data->id_ofs_prb_active;
+ int id_len_prb_transform = g_data->id_ofs_prb_transform;
- int outline_calls = id_ct_select + id_ct_active + id_ct_transform;
- outline_calls += id_ct_prb_select + id_ct_prb_active + id_ct_prb_transform;
+ int outline_calls = id_len_select + id_len_select_dupli + id_len_active + id_len_transform;
+ outline_calls += id_len_prb_select + id_len_prb_select_dupli + id_len_prb_active + id_len_prb_transform;
float clearcol[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ /* Don't draw Transparent passes in MSAA buffer. */
// DRW_draw_pass(psl->bone_envelope); /* Never drawn in Object mode currently. */
+ DRW_draw_pass(stl->g_data->sgl.transp_shapes);
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
- DRW_draw_pass(stl->g_data->sgl.spot_shapes);
DRW_draw_pass(stl->g_data->sgl.bone_solid);
DRW_draw_pass(stl->g_data->sgl.bone_wire);
DRW_draw_pass(stl->g_data->sgl.bone_outline);
@@ -2918,12 +3221,14 @@ static void OBJECT_draw_scene(void *vedata)
DRW_stats_group_start("Outlines");
g_data->id_ofs_active = 1;
- g_data->id_ofs_select = g_data->id_ofs_active + id_ct_active + id_ct_prb_active + 1;
- g_data->id_ofs_transform = g_data->id_ofs_select + id_ct_select + id_ct_prb_select + 1;
+ g_data->id_ofs_select = g_data->id_ofs_active + id_len_active + id_len_prb_active + 1;
+ g_data->id_ofs_select_dupli = g_data->id_ofs_select + id_len_select + id_len_prb_select + 1;
+ g_data->id_ofs_transform = g_data->id_ofs_select_dupli + id_len_select_dupli + id_len_prb_select_dupli + 1;
- g_data->id_ofs_prb_active = g_data->id_ofs_active + id_ct_active;
- g_data->id_ofs_prb_select = g_data->id_ofs_select + id_ct_select;
- g_data->id_ofs_prb_transform = g_data->id_ofs_transform + id_ct_transform;
+ g_data->id_ofs_prb_active = g_data->id_ofs_active + id_len_active;
+ g_data->id_ofs_prb_select = g_data->id_ofs_select + id_len_select;
+ g_data->id_ofs_prb_select_dupli = g_data->id_ofs_select_dupli + id_len_select_dupli;
+ g_data->id_ofs_prb_transform = g_data->id_ofs_transform + id_len_transform;
/* Render filled polygon on a separate framebuffer */
GPU_framebuffer_bind(fbl->outlines_fb);
@@ -2996,7 +3301,7 @@ static void OBJECT_draw_scene(void *vedata)
GPU_depth_range(0.0f, 0.01f);
}
- DRW_draw_pass(stl->g_data->sgl_ghost.spot_shapes);
+ DRW_draw_pass(stl->g_data->sgl_ghost.transp_shapes);
DRW_draw_pass(stl->g_data->sgl_ghost.bone_solid);
DRW_draw_pass(stl->g_data->sgl_ghost.bone_wire);
DRW_draw_pass(stl->g_data->sgl_ghost.bone_outline);
diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c
index ef1ef7936ef..a2dca50a600 100644
--- a/source/blender/draw/modes/overlay_mode.c
+++ b/source/blender/draw/modes/overlay_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,28 +13,37 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file overlay_mode.c
- * \ingroup draw_engine
+/** \file
+ * \ingroup draw_engine
*/
#include "DNA_mesh_types.h"
#include "DNA_view3d_types.h"
+#include "BIF_glutil.h"
+
#include "BKE_editmesh.h"
#include "BKE_object.h"
#include "BKE_global.h"
+#include "BLI_hash.h"
+
#include "GPU_shader.h"
-#include "GPU_extensions.h"
#include "DRW_render.h"
#include "draw_mode_engines.h"
+#ifdef __APPLE__
+#define USE_GEOM_SHADER_WORKAROUND 1
+#else
+#define USE_GEOM_SHADER_WORKAROUND 0
+#endif
+
/* Structures */
+
typedef struct OVERLAY_StorageList {
struct OVERLAY_PrivateData *g_data;
} OVERLAY_StorageList;
@@ -56,23 +63,25 @@ typedef struct OVERLAY_Data {
typedef struct OVERLAY_PrivateData {
DRWShadingGroup *face_orientation_shgrp;
- DRWShadingGroup *face_wires;
- DRWShadingGroup *flat_wires;
- DRWShadingGroup *sculpt_wires;
+ DRWShadingGroup *face_wires_shgrp;
+ BLI_mempool *wire_color_mempool;
View3DOverlay overlay;
- float wire_step_param[2];
+ float wire_step_param;
bool ghost_stencil_test;
bool show_overlays;
} OVERLAY_PrivateData; /* Transient data */
-/* *********** STATIC *********** */
-static struct {
+typedef struct OVERLAY_Shaders {
/* Face orientation shader */
- struct GPUShader *face_orientation_sh;
+ struct GPUShader *face_orientation;
/* Wireframe shader */
- struct GPUShader *select_wireframe_sh;
- struct GPUShader *face_wireframe_sh;
- struct GPUShader *face_wireframe_sculpt_sh;
+ struct GPUShader *select_wireframe;
+ struct GPUShader *face_wireframe;
+} OVERLAY_Shaders;
+
+/* *********** STATIC *********** */
+static struct {
+ OVERLAY_Shaders sh_data[GPU_SHADER_CFG_LEN];
} e_data = {NULL};
/* Shaders */
@@ -84,45 +93,58 @@ extern char datatoc_overlay_face_wireframe_geom_glsl[];
extern char datatoc_overlay_face_wireframe_frag_glsl[];
extern char datatoc_gpu_shader_depth_only_frag_glsl[];
-extern struct GlobalsUboStorage ts; /* draw_common.c */
-
/* Functions */
static void overlay_engine_init(void *vedata)
{
OVERLAY_Data *data = vedata;
OVERLAY_StorageList *stl = data->stl;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d);
+ }
+
if (!stl->g_data) {
/* Alloc transient pointers */
- stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
+ stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__);
}
stl->g_data->ghost_stencil_test = false;
- if (!e_data.face_orientation_sh) {
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
+
+ if (!sh_data->face_orientation) {
/* Face orientation */
- e_data.face_orientation_sh = DRW_shader_create(
- datatoc_overlay_face_orientation_vert_glsl, NULL,
- datatoc_overlay_face_orientation_frag_glsl, NULL);
+ sh_data->face_orientation = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_overlay_face_orientation_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_overlay_face_orientation_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
}
- if (!e_data.face_wireframe_sh) {
- e_data.select_wireframe_sh = DRW_shader_create(
- datatoc_overlay_face_wireframe_vert_glsl,
- datatoc_overlay_face_wireframe_geom_glsl,
- datatoc_gpu_shader_depth_only_frag_glsl,
- "#define SELECT_EDGES\n");
-
- e_data.face_wireframe_sh = DRW_shader_create(
- datatoc_overlay_face_wireframe_vert_glsl,
- NULL,
- datatoc_overlay_face_wireframe_frag_glsl,
- NULL);
-
- e_data.face_wireframe_sculpt_sh = DRW_shader_create(
- datatoc_overlay_face_wireframe_vert_glsl,
- datatoc_overlay_face_wireframe_geom_glsl,
- datatoc_overlay_face_wireframe_frag_glsl,
- "#define USE_SCULPT\n");
+ if (!sh_data->face_wireframe) {
+ sh_data->select_wireframe = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_overlay_face_wireframe_vert_glsl, NULL},
+ .geom = (const char *[]){sh_cfg_data->lib, datatoc_overlay_face_wireframe_geom_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_depth_only_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, "#define SELECT_EDGES\n", NULL},
+ });
+#if USE_GEOM_SHADER_WORKAROUND
+ /* Apple drivers does not support wide wires. Use geometry shader as a workaround. */
+ sh_data->face_wireframe = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_overlay_face_wireframe_vert_glsl, NULL},
+ .geom = (const char *[]){sh_cfg_data->lib, datatoc_overlay_face_wireframe_geom_glsl, NULL},
+ .frag = (const char *[]){datatoc_overlay_face_wireframe_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, "#define USE_GEOM\n", NULL},
+ });
+#else
+ sh_data->face_wireframe = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_overlay_face_wireframe_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_overlay_face_wireframe_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
+#endif
}
}
@@ -133,12 +155,16 @@ static void overlay_cache_init(void *vedata)
OVERLAY_StorageList *stl = data->stl;
OVERLAY_PrivateData *g_data = stl->g_data;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ RegionView3D *rv3d = draw_ctx->rv3d;
+ OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+
const DRWContextState *DCS = DRW_context_state_get();
View3D *v3d = DCS->v3d;
if (v3d) {
g_data->overlay = v3d->overlay;
- g_data->show_overlays = (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0;
+ g_data->show_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0;
}
else {
memset(&g_data->overlay, 0, sizeof(g_data->overlay));
@@ -152,6 +178,13 @@ static void overlay_cache_init(void *vedata)
if (v3d->shading.type == OB_WIRE) {
g_data->overlay.flag |= V3D_OVERLAY_WIREFRAMES;
g_data->show_overlays = true;
+
+ if (ELEM(v3d->shading.wire_color_type,
+ V3D_SHADING_OBJECT_COLOR,
+ V3D_SHADING_RANDOM_COLOR))
+ {
+ g_data->wire_color_mempool = BLI_mempool_create(sizeof(float[3]), 0, 512, 0);
+ }
}
{
@@ -159,40 +192,132 @@ static void overlay_cache_init(void *vedata)
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND;
psl->face_orientation_pass = DRW_pass_create("Face Orientation", state);
g_data->face_orientation_shgrp = DRW_shgroup_create(
- e_data.face_orientation_sh, psl->face_orientation_pass);
+ sh_data->face_orientation, psl->face_orientation_pass);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(g_data->face_orientation_shgrp, rv3d);
+ }
}
{
/* Wireframe */
- DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND | DRW_STATE_FIRST_VERTEX_CONVENTION;
- float wire_size = max_ff(0.0f, U.pixelsize - 1.0f) * 0.5f;
+ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS |
+ DRW_STATE_FIRST_VERTEX_CONVENTION | DRW_STATE_OFFSET_NEGATIVE;
+ float wire_size = U.pixelsize * 0.5f;
+
+ float winmat[4][4];
+ float viewdist = rv3d->dist;
+ DRW_viewport_matrix_get(winmat, DRW_MAT_WIN);
+ /* special exception for ortho camera (viewdist isnt used for perspective cameras) */
+ if (rv3d->persp == RV3D_CAMOB && rv3d->is_persp == false) {
+ viewdist = 1.0f / max_ff(fabsf(rv3d->winmat[0][0]), fabsf(rv3d->winmat[1][1]));
+ }
+ const float depth_ofs = bglPolygonOffsetCalc((float *)winmat, viewdist, 1.0f);
const bool use_select = (DRW_state_is_select() || DRW_state_is_depth());
- GPUShader *sculpt_wire_sh = use_select ? e_data.select_wireframe_sh : e_data.face_wireframe_sculpt_sh;
- GPUShader *face_wires_sh = use_select ? e_data.select_wireframe_sh : e_data.face_wireframe_sh;
- GPUShader *flat_wires_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
+ GPUShader *face_wires_sh = use_select ? sh_data->select_wireframe : sh_data->face_wireframe;
psl->face_wireframe_pass = DRW_pass_create("Face Wires", state);
- g_data->flat_wires = DRW_shgroup_create(flat_wires_sh, psl->face_wireframe_pass);
+ g_data->face_wires_shgrp = DRW_shgroup_create(face_wires_sh, psl->face_wireframe_pass);
+ DRW_shgroup_uniform_float(g_data->face_wires_shgrp, "wireStepParam", &g_data->wire_step_param, 1);
+ DRW_shgroup_uniform_float_copy(g_data->face_wires_shgrp, "ofs", depth_ofs);
+ if (use_select || USE_GEOM_SHADER_WORKAROUND) {
+ DRW_shgroup_uniform_float_copy(g_data->face_wires_shgrp, "wireSize", wire_size);
+ DRW_shgroup_uniform_vec2(g_data->face_wires_shgrp, "viewportSize", DRW_viewport_size_get(), 1);
+ DRW_shgroup_uniform_vec2(g_data->face_wires_shgrp, "viewportSizeInv", DRW_viewport_invert_size_get(), 1);
+ }
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(g_data->face_wires_shgrp, rv3d);
+ }
- g_data->sculpt_wires = DRW_shgroup_create(sculpt_wire_sh, psl->face_wireframe_pass);
+ g_data->wire_step_param = stl->g_data->overlay.wireframe_threshold - 254.0f / 255.0f;
+ }
+}
- g_data->face_wires = DRW_shgroup_create(face_wires_sh, psl->face_wireframe_pass);
- DRW_shgroup_uniform_vec2(g_data->face_wires, "wireStepParam", g_data->wire_step_param, 1);
+static void overlay_wire_color_get(
+ const View3D *v3d, const OVERLAY_PrivateData *pd, const Object *ob, const bool use_coloring,
+ float **rim_col, float **wire_col)
+{
+#ifndef NDEBUG
+ *rim_col = NULL;
+ *wire_col = NULL;
+#endif
+ const DRWContextState *draw_ctx = DRW_context_state_get();
- if (!use_select) {
- DRW_shgroup_uniform_float_copy(g_data->sculpt_wires, "wireSize", wire_size);
- DRW_shgroup_uniform_float_copy(g_data->face_wires, "wireSize", wire_size);
+ if (UNLIKELY(ob->base_flag & BASE_FROM_SET)) {
+ *rim_col = G_draw.block.colorDupli;
+ *wire_col = G_draw.block.colorDupli;
+ }
+ else if (UNLIKELY(ob->base_flag & BASE_FROM_DUPLI)) {
+ if (ob->base_flag & BASE_SELECTED) {
+ if (G.moving & G_TRANSFORM_OBJ) {
+ *rim_col = G_draw.block.colorTransform;
+ }
+ else {
+ *rim_col = G_draw.block.colorDupliSelect;
+ }
}
+ else {
+ *rim_col = G_draw.block.colorDupli;
+ }
+ *wire_col = G_draw.block.colorDupli;
+ }
+ else if ((ob->base_flag & BASE_SELECTED) && use_coloring) {
+ if (G.moving & G_TRANSFORM_OBJ) {
+ *rim_col = G_draw.block.colorTransform;
+ }
+ else if (ob == draw_ctx->obact) {
+ *rim_col = G_draw.block.colorActive;
+ }
+ else {
+ *rim_col = G_draw.block.colorSelect;
+ }
+ *wire_col = G_draw.block.colorWire;
+ }
+ else {
+ *rim_col = G_draw.block.colorWire;
+ *wire_col = G_draw.block.colorBackground;
+ }
- /* Control aspect of the falloff. */
- const float sharpness = 4.0f;
- /* Scale and bias: Adjust with wiredata encoding. (see mesh_batch_cache_create_edges_wireframe_data) */
- const float decompress = (0xFF / (float)(0xFF - 0x20));
- g_data->wire_step_param[0] = -sharpness * decompress;
- g_data->wire_step_param[1] = decompress + sharpness * stl->g_data->overlay.wireframe_threshold;
+ if (v3d->shading.type == OB_WIRE) {
+ if (ELEM(v3d->shading.wire_color_type,
+ V3D_SHADING_OBJECT_COLOR,
+ V3D_SHADING_RANDOM_COLOR))
+ {
+ *wire_col = BLI_mempool_alloc(pd->wire_color_mempool);
+ *rim_col = BLI_mempool_alloc(pd->wire_color_mempool);
+
+ if (v3d->shading.wire_color_type == V3D_SHADING_OBJECT_COLOR) {
+ linearrgb_to_srgb_v3_v3(*wire_col, ob->color);
+ mul_v3_fl(*wire_col, 0.5f);
+ copy_v3_v3(*rim_col, *wire_col);
+ }
+ else {
+ uint hash = BLI_ghashutil_strhash_p_murmur(ob->id.name);
+ if (ob->id.lib) {
+ hash = (hash * 13) ^ BLI_ghashutil_strhash_p_murmur(ob->id.lib->name);
+ }
+
+ float hue = BLI_hash_int_01(hash);
+ float hsv[3] = {hue, 0.75f, 0.8f};
+ hsv_to_rgb_v(hsv, *wire_col);
+ copy_v3_v3(*rim_col, *wire_col);
+ }
+
+ if ((ob->base_flag & BASE_SELECTED) && use_coloring) {
+ /* "Normalize" color. */
+ add_v3_fl(*wire_col, 1e-4f);
+ float brightness = max_fff((*wire_col)[0], (*wire_col)[1], (*wire_col)[2]);
+ mul_v3_fl(*wire_col, (0.5f / brightness));
+ add_v3_fl(*rim_col, 0.75f);
+ }
+ else {
+ mul_v3_fl(*rim_col, 0.5f);
+ add_v3_fl(*wire_col, 0.5f);
+ }
+ }
}
+ BLI_assert(*rim_col && *wire_col);
}
static void overlay_cache_populate(void *vedata, Object *ob)
@@ -201,7 +326,6 @@ static void overlay_cache_populate(void *vedata, Object *ob)
OVERLAY_StorageList *stl = data->stl;
OVERLAY_PrivateData *pd = stl->g_data;
const DRWContextState *draw_ctx = DRW_context_state_get();
- RegionView3D *rv3d = draw_ctx->rv3d;
View3D *v3d = draw_ctx->v3d;
if ((!pd->show_overlays) ||
@@ -228,7 +352,7 @@ static void overlay_cache_populate(void *vedata, Object *ob)
if (ob->type == OB_MESH) {
/* TODO: Should be its own function. */
Mesh *me = (Mesh *)ob->data;
- BMEditMesh *embm = me->edit_btmesh;
+ BMEditMesh *embm = me->edit_mesh;
if (embm) {
has_edit_mesh_cage = embm->mesh_eval_cage && (embm->mesh_eval_cage != embm->mesh_eval_final);
}
@@ -240,61 +364,38 @@ static void overlay_cache_populate(void *vedata, Object *ob)
{
const bool is_active = (ob == draw_ctx->obact);
const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & OB_MODE_SCULPT) != 0;
- const bool all_wires = (pd->overlay.wireframe_threshold == 1.0f) ||
- (ob->dtx & OB_DRAW_ALL_EDGES);
+ const bool all_wires = (ob->dtx & OB_DRAW_ALL_EDGES);
const bool is_wire = (ob->dt < OB_SOLID);
+ const bool use_coloring = (!is_edit_mode && !is_sculpt_mode && !has_edit_mesh_cage);
const int stencil_mask = (ob->dtx & OB_DRAWXRAY) ? 0x00 : 0xFF;
+ float *rim_col, *wire_col;
DRWShadingGroup *shgrp = NULL;
- float *rim_col = ts.colorWire;
- if (!is_edit_mode && !is_sculpt_mode && !has_edit_mesh_cage &&
- ((ob->base_flag & BASE_SELECTED) != 0))
- {
- rim_col = (ob == draw_ctx->obact) ? ts.colorActive : ts.colorSelect;
- rim_col = (G.moving & G_TRANSFORM_OBJ) ? ts.colorTransform : rim_col;
- }
+ overlay_wire_color_get(v3d, pd, ob, use_coloring, &rim_col, &wire_col);
+
+ struct GPUBatch *geom;
+ geom = DRW_cache_object_face_wireframe_get(ob);
+
+ if (geom || is_sculpt_mode) {
+ shgrp = DRW_shgroup_create_sub(pd->face_wires_shgrp);
+
+ float wire_step_param = 10.0f;
+ if (!is_sculpt_mode) {
+ wire_step_param = (all_wires) ? 1.0f : pd->wire_step_param;
+ }
+ DRW_shgroup_uniform_float_copy(shgrp, "wireStepParam", wire_step_param);
- /* This fixes only the biggest case which is a plane in ortho view. */
- int flat_axis = 0;
- bool is_flat_object_viewed_from_side = (
- (rv3d->persp == RV3D_ORTHO) &&
- DRW_object_is_flat(ob, &flat_axis) &&
- DRW_object_axis_orthogonal_to_view(ob, flat_axis));
-
- if (is_flat_object_viewed_from_side && !is_sculpt_mode) {
- /* Avoid losing flat objects when in ortho views (see T56549) */
- struct GPUBatch *geom = DRW_cache_object_all_edges_get(ob);
- if (geom) {
- shgrp = pd->flat_wires;
- shgrp = DRW_shgroup_create_sub(shgrp);
+ if (!(DRW_state_is_select() || DRW_state_is_depth())) {
DRW_shgroup_stencil_mask(shgrp, stencil_mask);
- DRW_shgroup_call_object_add(shgrp, geom, ob);
- DRW_shgroup_uniform_vec4(shgrp, "color", rim_col, 1);
+ DRW_shgroup_uniform_vec3(shgrp, "wireColor", wire_col, 1);
+ DRW_shgroup_uniform_vec3(shgrp, "rimColor", rim_col, 1);
}
- }
- else {
- struct GPUBatch *geom = DRW_cache_object_face_wireframe_get(ob);
- if (geom || is_sculpt_mode) {
- shgrp = (is_sculpt_mode) ? pd->sculpt_wires : pd->face_wires;
- shgrp = DRW_shgroup_create_sub(shgrp);
-
- static float all_wires_params[2] = {0.0f, 10.0f}; /* Parameters for all wires */
- DRW_shgroup_uniform_vec2(shgrp, "wireStepParam", (all_wires)
- ? all_wires_params
- : pd->wire_step_param, 1);
-
- if (!(DRW_state_is_select() || DRW_state_is_depth())) {
- DRW_shgroup_stencil_mask(shgrp, stencil_mask);
- DRW_shgroup_uniform_vec3(shgrp, "wireColor", ts.colorWire, 1);
- DRW_shgroup_uniform_vec3(shgrp, "rimColor", rim_col, 1);
- }
-
- if (is_sculpt_mode) {
- DRW_shgroup_call_sculpt_add(shgrp, ob, ob->obmat);
- }
- else {
- DRW_shgroup_call_add(shgrp, geom, ob->obmat);
- }
+
+ if (is_sculpt_mode) {
+ DRW_shgroup_call_sculpt_wires_add(shgrp, ob, ob->obmat);
+ }
+ else {
+ DRW_shgroup_call_add(shgrp, geom, ob->obmat);
}
}
if (is_wire && shgrp != NULL) {
@@ -333,21 +434,52 @@ static void overlay_draw_scene(void *vedata)
{
OVERLAY_Data *data = vedata;
OVERLAY_PassList *psl = data->psl;
+ OVERLAY_StorageList *stl = data->stl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
+ DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
if (DRW_state_is_fbo()) {
GPU_framebuffer_bind(dfbl->default_fb);
}
DRW_draw_pass(psl->face_orientation_pass);
+
+ /* This is replaced by the next code block */
+ // MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
+
+ if (dfbl->multisample_fb != NULL) {
+ DRW_stats_query_start("Multisample Blit");
+ GPU_framebuffer_bind(dfbl->multisample_fb);
+ GPU_framebuffer_clear_color(dfbl->multisample_fb, (const float[4]){0.0f});
+ /* Special blit: we need the original depth and stencil
+ * in the Multisample buffer. */
+ GPU_framebuffer_blit(dfbl->default_fb, 0,
+ dfbl->multisample_fb, 0,
+ GPU_DEPTH_BIT | GPU_STENCIL_BIT);
+ DRW_stats_query_end();
+ }
+
DRW_draw_pass(psl->face_wireframe_pass);
+
+ /* TODO(fclem): find a way to unify the multisample pass together
+ * (non meshes + armature + wireframe) */
+ MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl);
+
+ /* XXX TODO(fclem) do not discard data after drawing! Store them per viewport. */
+ if (stl->g_data->wire_color_mempool) {
+ BLI_mempool_destroy(stl->g_data->wire_color_mempool);
+ stl->g_data->wire_color_mempool = NULL;
+ }
}
static void overlay_engine_free(void)
{
- DRW_SHADER_FREE_SAFE(e_data.face_orientation_sh);
- DRW_SHADER_FREE_SAFE(e_data.select_wireframe_sh);
- DRW_SHADER_FREE_SAFE(e_data.face_wireframe_sh);
- DRW_SHADER_FREE_SAFE(e_data.face_wireframe_sculpt_sh);
+ for (int sh_data_index = 0; sh_data_index < ARRAY_SIZE(e_data.sh_data); sh_data_index++) {
+ OVERLAY_Shaders *sh_data = &e_data.sh_data[sh_data_index];
+ GPUShader **sh_data_as_array = (GPUShader **)sh_data;
+ for (int i = 0; i < (sizeof(OVERLAY_Shaders) / sizeof(GPUShader *)); i++) {
+ DRW_SHADER_FREE_SAFE(sh_data_as_array[i]);
+ }
+ }
}
static const DrawEngineDataSize overlay_data_size = DRW_VIEWPORT_DATA_SIZE(OVERLAY_Data);
diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c
index a89616c2cae..0a9746b3de5 100644
--- a/source/blender/draw/modes/paint_texture_mode.c
+++ b/source/blender/draw/modes/paint_texture_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/paint_texture_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_engine.h"
@@ -28,12 +25,13 @@
#include "BIF_gl.h"
+#include "BKE_node.h"
+
/* If builtin shaders are needed */
#include "GPU_shader.h"
#include "GPU_texture.h"
#include "draw_common.h"
-
#include "draw_mode_engines.h"
#include "DNA_mesh_types.h"
@@ -49,12 +47,6 @@ extern char datatoc_paint_face_vert_glsl[];
extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
-/* If needed, contains all global/Theme colors
- * Add needed theme colors / values to DRW_globals_update() and update UBO
- * Not needed for constant color. */
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GlobalsUboStorage ts; /* draw_common.c */
-
/* *********** LISTS *********** */
/* All lists are per viewport specific datas.
* They are all free when viewport changes engines
@@ -139,8 +131,6 @@ static void PAINT_TEXTURE_engine_init(void *UNUSED(vedata))
if (!e_data.fallback_sh) {
e_data.fallback_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
- e_data.image_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
-
e_data.image_sh = DRW_shader_create_with_lib(
datatoc_paint_texture_vert_glsl, NULL,
datatoc_paint_texture_frag_glsl,
@@ -189,7 +179,8 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
Object *ob = draw_ctx->obact;
if (ob && ob->type == OB_MESH) {
Scene *scene = draw_ctx->scene;
- const bool use_material_slots = (scene->toolsettings->imapaint.mode == IMAGEPAINT_MODE_MATERIAL);
+ const ImagePaintSettings *imapaint = &scene->toolsettings->imapaint;
+ const bool use_material_slots = (imapaint->mode == IMAGEPAINT_MODE_MATERIAL);
const Mesh *me = ob->data;
const int mat_nr = max_ii(1, me->totcol);
@@ -200,14 +191,16 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
for (int i = 0; i < mat_nr; i++) {
Material *ma = give_current_material(ob, i + 1);
Image *ima = (ma && ma->texpaintslot) ? ma->texpaintslot[ma->paint_active_slot].ima : NULL;
+ int interp = (ma && ma->texpaintslot) ? ma->texpaintslot[ma->paint_active_slot].interp : 0;
GPUTexture *tex = ima ?
- GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0f) : NULL;
+ GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false) : NULL;
if (tex) {
DRWShadingGroup *grp = DRW_shgroup_create(e_data.image_sh, psl->image_faces);
DRW_shgroup_uniform_texture(grp, "image", tex);
DRW_shgroup_uniform_float(grp, "alpha", &draw_ctx->v3d->overlay.texture_paint_mode_opacity, 1);
- DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
+ DRW_shgroup_uniform_bool_copy(grp, "nearestInterp", interp == SHD_INTERP_CLOSEST);
stl->g_data->shgroup_image_array[i] = grp;
}
else {
@@ -216,15 +209,16 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
}
}
else {
- Image *ima = scene->toolsettings->imapaint.canvas;
+ Image *ima = imapaint->canvas;
GPUTexture *tex = ima ?
- GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0f) : NULL;
+ GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false) : NULL;
if (tex) {
DRWShadingGroup *grp = DRW_shgroup_create(e_data.image_sh, psl->image_faces);
DRW_shgroup_uniform_texture(grp, "image", tex);
DRW_shgroup_uniform_float(grp, "alpha", &draw_ctx->v3d->overlay.texture_paint_mode_opacity, 1);
- DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo);
+ DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
+ DRW_shgroup_uniform_bool_copy(grp, "nearestInterp", imapaint->interp == IMAGEPAINT_INTERP_CLOSEST);
stl->g_data->shgroup_image_array[0] = grp;
}
else {
@@ -241,7 +235,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE);
stl->g_data->lwire_shgrp = DRW_shgroup_create(e_data.wire_overlay_shader, psl->wire_overlay);
- DRW_shgroup_uniform_block(stl->g_data->lwire_shgrp, "globalsBlock", globals_ubo);
+ DRW_shgroup_uniform_block(stl->g_data->lwire_shgrp, "globalsBlock", G_draw.block_ubo);
}
{
@@ -282,7 +276,7 @@ static void PAINT_TEXTURE_cache_populate(void *vedata, Object *ob)
for (int i = 0; i < mat_nr; i++) {
const int index = use_material_slots ? i : 0;
- if (stl->g_data->shgroup_image_array[index]) {
+ if ((i < me->totcol) && stl->g_data->shgroup_image_array[index]) {
DRW_shgroup_call_add(stl->g_data->shgroup_image_array[index], geom_array[i], ob->obmat);
}
else {
diff --git a/source/blender/draw/modes/paint_vertex_mode.c b/source/blender/draw/modes/paint_vertex_mode.c
index d57777675af..ac678a996dc 100644
--- a/source/blender/draw/modes/paint_vertex_mode.c
+++ b/source/blender/draw/modes/paint_vertex_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,22 +13,19 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/paint_vertex_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
-#include "DRW_engine.h"
#include "DRW_render.h"
/* If builtin shaders are needed */
#include "GPU_shader.h"
#include "draw_common.h"
-
#include "draw_mode_engines.h"
#include "DNA_mesh_types.h"
@@ -38,24 +33,34 @@
#include "DEG_depsgraph_query.h"
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GlobalsUboStorage ts; /* draw_common.c */
-
+extern char datatoc_paint_face_vert_glsl[];
+extern char datatoc_paint_weight_vert_glsl[];
+extern char datatoc_paint_weight_frag_glsl[];
extern char datatoc_paint_vertex_vert_glsl[];
extern char datatoc_paint_vertex_frag_glsl[];
extern char datatoc_paint_wire_vert_glsl[];
extern char datatoc_paint_wire_frag_glsl[];
-extern char datatoc_paint_face_vert_glsl[];
+extern char datatoc_paint_vert_frag_glsl[];
extern char datatoc_common_globals_lib_glsl[];
extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
/* *********** LISTS *********** */
+enum {
+ VERTEX_MODE = 0,
+ WEIGHT_MODE = 1,
+};
+#define MODE_LEN (WEIGHT_MODE + 1)
+
typedef struct PAINT_VERTEX_PassList {
- struct DRWPass *vcolor_faces;
+ struct {
+ struct DRWPass *color_faces;
+ } by_mode[MODE_LEN];
struct DRWPass *wire_overlay;
- struct DRWPass *face_overlay;
+ struct DRWPass *wire_select_overlay;
+ struct DRWPass *face_select_overlay;
+ struct DRWPass *vert_select_overlay;
} PAINT_VERTEX_PassList;
typedef struct PAINT_VERTEX_StorageList {
@@ -70,37 +75,83 @@ typedef struct PAINT_VERTEX_Data {
PAINT_VERTEX_StorageList *stl;
} PAINT_VERTEX_Data;
+typedef struct PAINT_VERTEX_Shaders {
+ struct {
+ struct GPUShader *color_face;
+ struct GPUShader *wire_overlay;
+ struct GPUShader *wire_select_overlay;
+ } by_mode[MODE_LEN];
+ struct GPUShader *face_select_overlay;
+ struct GPUShader *vert_select_overlay;
+} PAINT_VERTEX_Shaders;
+
/* *********** STATIC *********** */
static struct {
- struct GPUShader *vcolor_face_shader;
- struct GPUShader *wire_overlay_shader;
- struct GPUShader *face_overlay_shader;
-} e_data = {NULL}; /* Engine data */
+ PAINT_VERTEX_Shaders sh_data[GPU_SHADER_CFG_LEN];
+} e_data = {{{{{NULL}}}}}; /* Engine data */
typedef struct PAINT_VERTEX_PrivateData {
- DRWShadingGroup *fvcolor_shgrp;
- DRWShadingGroup *lwire_shgrp;
- DRWShadingGroup *face_shgrp;
+ struct {
+ DRWShadingGroup *color_shgrp;
+ DRWShadingGroup *lwire_shgrp;
+ DRWShadingGroup *lwire_select_shgrp;
+ } by_mode[MODE_LEN];
+ DRWShadingGroup *face_select_shgrp;
+ DRWShadingGroup *vert_select_shgrp;
} PAINT_VERTEX_PrivateData; /* Transient data */
/* *********** FUNCTIONS *********** */
static void PAINT_VERTEX_engine_init(void *UNUSED(vedata))
{
- if (!e_data.vcolor_face_shader) {
- e_data.vcolor_face_shader = DRW_shader_create(
- datatoc_paint_vertex_vert_glsl, NULL,
- datatoc_paint_vertex_frag_glsl, NULL);
-
- e_data.wire_overlay_shader = DRW_shader_create_with_lib(
- datatoc_paint_wire_vert_glsl, NULL,
- datatoc_paint_wire_frag_glsl,
- datatoc_common_globals_lib_glsl, "#define VERTEX_MODE\n");
-
- e_data.face_overlay_shader = DRW_shader_create(
- datatoc_paint_face_vert_glsl, NULL,
- datatoc_gpu_shader_uniform_color_frag_glsl, NULL);
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ PAINT_VERTEX_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+
+ if (draw_ctx->sh_cfg) {
+ DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d);
+ }
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
+
+ if (!sh_data->face_select_overlay) {
+ sh_data->by_mode[VERTEX_MODE].color_face = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_paint_vertex_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_paint_vertex_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
+ sh_data->by_mode[WEIGHT_MODE].color_face = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_paint_weight_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_common_globals_lib_glsl, datatoc_paint_weight_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
+
+ sh_data->face_select_overlay = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_paint_face_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
+ });
+ sh_data->vert_select_overlay = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_paint_wire_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_paint_vert_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, "#define USE_SELECT\n", NULL},
+ });
+
+ const char *mode_defs[MODE_LEN] = {
+ "#define VERTEX_MODE\n",
+ "#define WEIGHT_MODE\n",
+ };
+ for (int i = 0; i < MODE_LEN; i++) {
+ sh_data->by_mode[i].wire_overlay = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_paint_wire_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_paint_wire_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, mode_defs[i], NULL},
+ });
+ sh_data->by_mode[i].wire_select_overlay = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){sh_cfg_data->lib, datatoc_common_globals_lib_glsl, datatoc_paint_wire_vert_glsl, NULL},
+ .frag = (const char *[]){datatoc_paint_wire_frag_glsl, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, mode_defs[i], "#define USE_SELECT\n", NULL},
+ });
+ }
}
}
@@ -110,40 +161,101 @@ static void PAINT_VERTEX_cache_init(void *vedata)
PAINT_VERTEX_StorageList *stl = ((PAINT_VERTEX_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
const View3D *v3d = draw_ctx->v3d;
+ const RegionView3D *rv3d = draw_ctx->rv3d;
+ PAINT_VERTEX_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
if (!stl->g_data) {
/* Alloc transient pointers */
stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
}
+ /* Vertex color pass */
{
- /* Create a pass */
- psl->vcolor_faces = DRW_pass_create(
+ DRWPass *pass = DRW_pass_create(
"Vert Color Pass",
DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_MULTIPLY);
+ DRWShadingGroup *shgrp = DRW_shgroup_create(sh_data->by_mode[VERTEX_MODE].color_face, pass);
+ DRW_shgroup_uniform_float_copy(shgrp, "white_factor", 1.0f - v3d->overlay.vertex_paint_mode_opacity);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(shgrp, rv3d);
+ }
+ psl->by_mode[VERTEX_MODE].color_faces = pass;
+ stl->g_data->by_mode[VERTEX_MODE].color_shgrp = shgrp;
+ }
- stl->g_data->fvcolor_shgrp = DRW_shgroup_create(e_data.vcolor_face_shader, psl->vcolor_faces);
- DRW_shgroup_uniform_float_copy(stl->g_data->fvcolor_shgrp, "white_factor", 1.0f - v3d->overlay.vertex_paint_mode_opacity);
+ /* Weight color pass */
+ {
+ DRWPass *pass = DRW_pass_create(
+ "Weight Pass",
+ DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_MULTIPLY);
+ DRWShadingGroup *shgrp = DRW_shgroup_create(sh_data->by_mode[WEIGHT_MODE].color_face, pass);
+ DRW_shgroup_uniform_bool_copy(shgrp, "drawContours", (v3d->overlay.wpaint_flag & V3D_OVERLAY_WPAINT_CONTOURS) != 0);
+ DRW_shgroup_uniform_float(shgrp, "opacity", &v3d->overlay.weight_paint_mode_opacity, 1);
+ DRW_shgroup_uniform_texture(shgrp, "colorramp", G_draw.weight_ramp);
+ DRW_shgroup_uniform_block(shgrp, "globalsBlock", G_draw.block_ubo);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(shgrp, rv3d);
+ }
+ psl->by_mode[WEIGHT_MODE].color_faces = pass;
+ stl->g_data->by_mode[WEIGHT_MODE].color_shgrp = shgrp;
}
{
- psl->wire_overlay = DRW_pass_create(
+ DRWPass *pass = DRW_pass_create(
"Wire Pass",
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE);
+ for (int i = 0; i < MODE_LEN; i++) {
+ DRWShadingGroup *shgrp = DRW_shgroup_create(sh_data->by_mode[i].wire_overlay, pass);
+ DRW_shgroup_uniform_block(shgrp, "globalsBlock", G_draw.block_ubo);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(shgrp, rv3d);
+ }
+ stl->g_data->by_mode[i].lwire_shgrp = shgrp;
+ }
+ psl->wire_overlay = pass;
+ }
- stl->g_data->lwire_shgrp = DRW_shgroup_create(e_data.wire_overlay_shader, psl->wire_overlay);
- DRW_shgroup_uniform_block(stl->g_data->lwire_shgrp, "globalsBlock", globals_ubo);
+
+ {
+ DRWPass *pass = DRW_pass_create(
+ "Wire Mask Pass",
+ DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE);
+ for (int i = 0; i < MODE_LEN; i++) {
+ DRWShadingGroup *shgrp = DRW_shgroup_create(sh_data->by_mode[i].wire_select_overlay, pass);
+ DRW_shgroup_uniform_block(shgrp, "globalsBlock", G_draw.block_ubo);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(shgrp, rv3d);
+ }
+ stl->g_data->by_mode[i].lwire_select_shgrp = shgrp;
+ }
+ psl->wire_select_overlay = pass;
}
{
- psl->face_overlay = DRW_pass_create(
+ static float col[4] = {1.0f, 1.0f, 1.0f, 0.2f};
+ DRWPass *pass = DRW_pass_create(
"Face Mask Pass",
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND);
+ DRWShadingGroup *shgrp = DRW_shgroup_create(sh_data->face_select_overlay, pass);
+ DRW_shgroup_uniform_vec4(shgrp, "color", col, 1);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(shgrp, rv3d);
+ }
+ psl->face_select_overlay = pass;
+ stl->g_data->face_select_shgrp = shgrp;
+ }
- stl->g_data->face_shgrp = DRW_shgroup_create(e_data.face_overlay_shader, psl->face_overlay);
-
- static float col[4] = {1.0f, 1.0f, 1.0f, 0.2f};
- DRW_shgroup_uniform_vec4(stl->g_data->face_shgrp, "color", col, 1);
+ {
+ DRWPass *pass = DRW_pass_create(
+ "Vert Mask Pass",
+ DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE);
+ DRWShadingGroup *shgrp = DRW_shgroup_create(sh_data->vert_select_overlay, pass);
+ DRW_shgroup_uniform_block(shgrp, "globalsBlock", G_draw.block_ubo);
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ DRW_shgroup_world_clip_planes_from_rv3d(shgrp, rv3d);
+ }
+ psl->vert_select_overlay = pass;
+ stl->g_data->vert_select_shgrp = shgrp;
}
}
@@ -154,29 +266,47 @@ static void PAINT_VERTEX_cache_populate(void *vedata, Object *ob)
const View3D *v3d = draw_ctx->v3d;
if ((ob->type == OB_MESH) && (ob == draw_ctx->obact)) {
+ const int draw_mode = (ob->mode == OB_MODE_VERTEX_PAINT) ? VERTEX_MODE : WEIGHT_MODE;
const Mesh *me = ob->data;
+ const Mesh *me_orig = DEG_get_original_object(ob)->data;
const bool use_wire = (v3d->overlay.paint_flag & V3D_OVERLAY_PAINT_WIRE) != 0;
- const bool use_surface = v3d->overlay.vertex_paint_mode_opacity != 0.0f;
- const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
- struct GPUBatch *geom;
-
- if (me->mloopcol == NULL) {
- return;
+ const bool use_face_sel = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
+ const bool use_vert_sel = (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
+
+ struct GPUBatch *geom = NULL;
+ if (draw_mode == VERTEX_MODE) {
+ if (me->mloopcol == NULL) {
+ return;
+ }
+ if (v3d->overlay.vertex_paint_mode_opacity != 0.0f) {
+ geom = DRW_cache_mesh_surface_vertpaint_get(ob);
+ }
}
-
- if (use_surface) {
- geom = DRW_cache_mesh_surface_vertpaint_get(ob);
- DRW_shgroup_call_add(stl->g_data->fvcolor_shgrp, geom, ob->obmat);
+ else {
+ if (v3d->overlay.weight_paint_mode_opacity != 0.0f) {
+ geom = DRW_cache_mesh_surface_weights_get(ob);
+ }
+ }
+ if (geom != NULL) {
+ DRW_shgroup_call_add(stl->g_data->by_mode[draw_mode].color_shgrp, geom, ob->obmat);
}
if (use_face_sel || use_wire) {
+ DRWShadingGroup *shgrp = use_face_sel ?
+ stl->g_data->by_mode[draw_mode].lwire_select_shgrp :
+ stl->g_data->by_mode[draw_mode].lwire_shgrp;
geom = DRW_cache_mesh_surface_edges_get(ob);
- DRW_shgroup_call_add(stl->g_data->lwire_shgrp, geom, ob->obmat);
+ DRW_shgroup_call_add(shgrp, geom, ob->obmat);
}
if (use_face_sel) {
geom = DRW_cache_mesh_surface_get(ob);
- DRW_shgroup_call_add(stl->g_data->face_shgrp, geom, ob->obmat);
+ DRW_shgroup_call_add(stl->g_data->face_select_shgrp, geom, ob->obmat);
+ }
+
+ if (use_vert_sel) {
+ geom = DRW_cache_mesh_all_verts_get(ob);
+ DRW_shgroup_call_add(stl->g_data->vert_select_shgrp, geom, ob->obmat);
}
}
}
@@ -184,17 +314,24 @@ static void PAINT_VERTEX_cache_populate(void *vedata, Object *ob)
static void PAINT_VERTEX_draw_scene(void *vedata)
{
PAINT_VERTEX_PassList *psl = ((PAINT_VERTEX_Data *)vedata)->psl;
-
- DRW_draw_pass(psl->vcolor_faces);
- DRW_draw_pass(psl->face_overlay);
+ for (int i = 0; i < MODE_LEN; i++) {
+ DRW_draw_pass(psl->by_mode[i].color_faces);
+ }
DRW_draw_pass(psl->wire_overlay);
+ DRW_draw_pass(psl->wire_select_overlay);
+ DRW_draw_pass(psl->vert_select_overlay);
+ DRW_draw_pass(psl->face_select_overlay);
}
static void PAINT_VERTEX_engine_free(void)
{
- DRW_SHADER_FREE_SAFE(e_data.vcolor_face_shader);
- DRW_SHADER_FREE_SAFE(e_data.wire_overlay_shader);
- DRW_SHADER_FREE_SAFE(e_data.face_overlay_shader);
+ for (int sh_data_index = 0; sh_data_index < ARRAY_SIZE(e_data.sh_data); sh_data_index++) {
+ PAINT_VERTEX_Shaders *sh_data = &e_data.sh_data[sh_data_index];
+ GPUShader **sh_data_as_array = (GPUShader **)sh_data;
+ for (int i = 0; i < (sizeof(PAINT_VERTEX_Shaders) / sizeof(GPUShader *)); i++) {
+ DRW_SHADER_FREE_SAFE(sh_data_as_array[i]);
+ }
+ }
}
static const DrawEngineDataSize PAINT_VERTEX_data_size = DRW_VIEWPORT_DATA_SIZE(PAINT_VERTEX_Data);
diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c
deleted file mode 100644
index 0d6b2edba93..00000000000
--- a/source/blender/draw/modes/paint_weight_mode.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright 2016, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Institute
- *
- */
-
-/** \file blender/draw/modes/paint_weight_mode.c
- * \ingroup draw
- */
-
-#include "DRW_engine.h"
-#include "DRW_render.h"
-
-/* If builtin shaders are needed */
-#include "GPU_shader.h"
-
-#include "draw_common.h"
-
-#include "draw_mode_engines.h"
-
-#include "DNA_mesh_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BKE_mesh.h"
-
-#include "DEG_depsgraph_query.h"
-
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GlobalsUboStorage ts; /* draw_common.c */
-
-extern struct GPUTexture *globals_weight_ramp; /* draw_common.c */
-
-extern char datatoc_paint_face_vert_glsl[];
-extern char datatoc_paint_weight_vert_glsl[];
-extern char datatoc_paint_weight_frag_glsl[];
-extern char datatoc_paint_wire_vert_glsl[];
-extern char datatoc_paint_wire_frag_glsl[];
-extern char datatoc_paint_vert_frag_glsl[];
-extern char datatoc_common_globals_lib_glsl[];
-
-extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
-
-/* *********** LISTS *********** */
-
-typedef struct PAINT_WEIGHT_PassList {
- struct DRWPass *weight_faces;
- struct DRWPass *wire_overlay;
- struct DRWPass *face_overlay;
- struct DRWPass *vert_overlay;
-} PAINT_WEIGHT_PassList;
-
-typedef struct PAINT_WEIGHT_StorageList {
- struct PAINT_WEIGHT_PrivateData *g_data;
-} PAINT_WEIGHT_StorageList;
-
-typedef struct PAINT_WEIGHT_Data {
- void *engine_type;
- DRWViewportEmptyList *fbl;
- DRWViewportEmptyList *txl;
- PAINT_WEIGHT_PassList *psl;
- PAINT_WEIGHT_StorageList *stl;
-} PAINT_WEIGHT_Data;
-
-/* *********** STATIC *********** */
-
-static struct {
- struct GPUShader *weight_face_shader;
- struct GPUShader *wire_overlay_shader;
- struct GPUShader *face_overlay_shader;
- struct GPUShader *vert_overlay_shader;
- int actdef;
-} e_data = {NULL}; /* Engine data */
-
-typedef struct PAINT_WEIGHT_PrivateData {
- DRWShadingGroup *fweights_shgrp;
- DRWShadingGroup *lwire_shgrp;
- DRWShadingGroup *face_shgrp;
- DRWShadingGroup *vert_shgrp;
-} PAINT_WEIGHT_PrivateData;
-
-/* *********** FUNCTIONS *********** */
-
-static void PAINT_WEIGHT_engine_init(void *UNUSED(vedata))
-{
- if (!e_data.weight_face_shader) {
- e_data.weight_face_shader = DRW_shader_create_with_lib(
- datatoc_paint_weight_vert_glsl, NULL,
- datatoc_paint_weight_frag_glsl,
- datatoc_common_globals_lib_glsl, NULL);
-
- e_data.wire_overlay_shader = DRW_shader_create_with_lib(
- datatoc_paint_wire_vert_glsl, NULL,
- datatoc_paint_wire_frag_glsl,
- datatoc_common_globals_lib_glsl, "#define WEIGHT_MODE\n");
-
- e_data.face_overlay_shader = DRW_shader_create(
- datatoc_paint_face_vert_glsl, NULL,
- datatoc_gpu_shader_uniform_color_frag_glsl, NULL);
-
- e_data.vert_overlay_shader = DRW_shader_create_with_lib(
- datatoc_paint_wire_vert_glsl, NULL,
- datatoc_paint_vert_frag_glsl,
- datatoc_common_globals_lib_glsl, NULL);
- }
-}
-
-static void PAINT_WEIGHT_cache_init(void *vedata)
-{
- PAINT_WEIGHT_PassList *psl = ((PAINT_WEIGHT_Data *)vedata)->psl;
- PAINT_WEIGHT_StorageList *stl = ((PAINT_WEIGHT_Data *)vedata)->stl;
- const DRWContextState *draw_ctx = DRW_context_state_get();
- const View3D *v3d = draw_ctx->v3d;
-
- if (!stl->g_data) {
- /* Alloc transient pointers */
- stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
- }
-
- {
- /* Create a pass */
- psl->weight_faces = DRW_pass_create(
- "Weight Pass",
- DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_MULTIPLY);
-
- stl->g_data->fweights_shgrp = DRW_shgroup_create(e_data.weight_face_shader, psl->weight_faces);
-
- DRW_shgroup_uniform_bool_copy(stl->g_data->fweights_shgrp, "drawContours", (v3d->overlay.wpaint_flag & V3D_OVERLAY_WPAINT_CONTOURS) != 0);
-
- DRW_shgroup_uniform_float(stl->g_data->fweights_shgrp, "opacity", &v3d->overlay.weight_paint_mode_opacity, 1);
- DRW_shgroup_uniform_texture(stl->g_data->fweights_shgrp, "colorramp", globals_weight_ramp);
- DRW_shgroup_uniform_block(stl->g_data->fweights_shgrp, "globalsBlock", globals_ubo);
- }
-
- {
- psl->wire_overlay = DRW_pass_create(
- "Wire Pass",
- DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE);
-
- stl->g_data->lwire_shgrp = DRW_shgroup_create(e_data.wire_overlay_shader, psl->wire_overlay);
- DRW_shgroup_uniform_block(stl->g_data->lwire_shgrp, "globalsBlock", globals_ubo);
- }
-
- {
- psl->face_overlay = DRW_pass_create(
- "Face Mask Pass",
- DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND);
-
- stl->g_data->face_shgrp = DRW_shgroup_create(e_data.face_overlay_shader, psl->face_overlay);
-
- static float col[4] = {1.0f, 1.0f, 1.0f, 0.2f};
- DRW_shgroup_uniform_vec4(stl->g_data->face_shgrp, "color", col, 1);
- }
-
- {
- psl->vert_overlay = DRW_pass_create(
- "Vert Mask Pass",
- DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE);
-
- stl->g_data->vert_shgrp = DRW_shgroup_create(e_data.vert_overlay_shader, psl->vert_overlay);
- DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", globals_ubo);
- }
-}
-
-static void PAINT_WEIGHT_cache_populate(void *vedata, Object *ob)
-{
- PAINT_WEIGHT_StorageList *stl = ((PAINT_WEIGHT_Data *)vedata)->stl;
- const DRWContextState *draw_ctx = DRW_context_state_get();
- const View3D *v3d = draw_ctx->v3d;
-
- if ((ob->type == OB_MESH) && (ob == draw_ctx->obact)) {
- const Mesh *me_orig = DEG_get_original_object(ob)->data;
- const bool use_wire = (v3d->overlay.paint_flag & V3D_OVERLAY_PAINT_WIRE) != 0;
- const bool use_surface = v3d->overlay.weight_paint_mode_opacity != 0.0f;
- const bool use_face_sel = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
- const bool use_vert_sel = (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
- struct GPUBatch *geom;
-
- if (use_surface) {
- geom = DRW_cache_mesh_surface_weights_get(ob);
- DRW_shgroup_call_add(stl->g_data->fweights_shgrp, geom, ob->obmat);
- }
-
- if (use_face_sel || use_wire) {
- geom = DRW_cache_mesh_surface_edges_get(ob);
- DRW_shgroup_call_add(stl->g_data->lwire_shgrp, geom, ob->obmat);
- }
-
- if (use_face_sel) {
- geom = DRW_cache_mesh_surface_get(ob);
- DRW_shgroup_call_add(stl->g_data->face_shgrp, geom, ob->obmat);
- }
-
- if (use_vert_sel) {
- geom = DRW_cache_mesh_all_verts_get(ob);
- DRW_shgroup_call_add(stl->g_data->vert_shgrp, geom, ob->obmat);
- }
- }
-}
-
-static void PAINT_WEIGHT_draw_scene(void *vedata)
-{
- PAINT_WEIGHT_PassList *psl = ((PAINT_WEIGHT_Data *)vedata)->psl;
-
- DRW_draw_pass(psl->weight_faces);
- DRW_draw_pass(psl->face_overlay);
- DRW_draw_pass(psl->wire_overlay);
- DRW_draw_pass(psl->vert_overlay);
-}
-
-static void PAINT_WEIGHT_engine_free(void)
-{
- DRW_SHADER_FREE_SAFE(e_data.weight_face_shader);
- DRW_SHADER_FREE_SAFE(e_data.wire_overlay_shader);
- DRW_SHADER_FREE_SAFE(e_data.vert_overlay_shader);
- DRW_SHADER_FREE_SAFE(e_data.face_overlay_shader);
-}
-
-static const DrawEngineDataSize PAINT_WEIGHT_data_size = DRW_VIEWPORT_DATA_SIZE(PAINT_WEIGHT_Data);
-
-DrawEngineType draw_engine_paint_weight_type = {
- NULL, NULL,
- N_("PaintWeightMode"),
- &PAINT_WEIGHT_data_size,
- &PAINT_WEIGHT_engine_init,
- &PAINT_WEIGHT_engine_free,
- &PAINT_WEIGHT_cache_init,
- &PAINT_WEIGHT_cache_populate,
- NULL,
- NULL,
- &PAINT_WEIGHT_draw_scene,
- NULL,
- NULL,
-};
diff --git a/source/blender/draw/modes/particle_mode.c b/source/blender/draw/modes/particle_mode.c
index 758218fe329..3090322fc80 100644
--- a/source/blender/draw/modes/particle_mode.c
+++ b/source/blender/draw/modes/particle_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,43 +13,33 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/particle_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
-#include "DRW_engine.h"
#include "DRW_render.h"
-#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
-#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "GPU_shader.h"
-#include "GPU_batch.h"
#include "draw_common.h"
-
#include "draw_mode_engines.h"
#include "ED_particle.h"
#include "DEG_depsgraph_query.h"
-#include "draw_cache_impl.h"
-
extern char datatoc_particle_strand_vert_glsl[];
extern char datatoc_particle_strand_frag_glsl[];
extern char datatoc_common_globals_lib_glsl[];
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-
/* *********** LISTS *********** */
typedef struct PARTICLE_PassList {
@@ -147,9 +135,9 @@ static void particle_cache_init(void *vedata)
stl->g_data->inner_points_group = DRW_shgroup_create(e_data.points_shader, psl->psys_edit_pass);
stl->g_data->tip_points_group = DRW_shgroup_create(e_data.points_shader, psl->psys_edit_pass);
- DRW_shgroup_uniform_block(stl->g_data->strands_group, "globalsBlock", globals_ubo);
- DRW_shgroup_uniform_block(stl->g_data->inner_points_group, "globalsBlock", globals_ubo);
- DRW_shgroup_uniform_block(stl->g_data->tip_points_group, "globalsBlock", globals_ubo);
+ DRW_shgroup_uniform_block(stl->g_data->strands_group, "globalsBlock", G_draw.block_ubo);
+ DRW_shgroup_uniform_block(stl->g_data->inner_points_group, "globalsBlock", G_draw.block_ubo);
+ DRW_shgroup_uniform_block(stl->g_data->tip_points_group, "globalsBlock", G_draw.block_ubo);
}
static void particle_edit_cache_populate(void *vedata,
diff --git a/source/blender/draw/modes/pose_mode.c b/source/blender/draw/modes/pose_mode.c
index 6ee6f59e5fa..01affecade4 100644
--- a/source/blender/draw/modes/pose_mode.c
+++ b/source/blender/draw/modes/pose_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/pose_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "BKE_modifier.h"
@@ -34,11 +31,8 @@
#include "GPU_shader.h"
#include "draw_common.h"
-
#include "draw_mode_engines.h"
-extern GlobalsUboStorage ts;
-
/* *********** LISTS *********** */
/* All lists are per viewport specific datas.
* They are all free when viewport changes engines
@@ -48,6 +42,7 @@ extern GlobalsUboStorage ts;
typedef struct POSE_PassList {
struct DRWPass *bone_solid[2];
+ struct DRWPass *bone_transp[2];
struct DRWPass *bone_outline[2];
struct DRWPass *bone_wire[2];
struct DRWPass *bone_envelope[2];
@@ -116,12 +111,13 @@ static void POSE_cache_init(void *vedata)
stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__);
}
POSE_PrivateData *ppd = stl->g_data;
- ppd->transparent_bones = (draw_ctx->v3d->overlay.arm_flag & V3D_OVERLAY_ARM_TRANSP_BONES) != 0;
+ ppd->transparent_bones = (draw_ctx->v3d->shading.type == OB_WIRE);
for (int i = 0; i < 2; ++i) {
/* Solid bones */
- DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK;
- psl->bone_solid[i] = DRW_pass_create("Bone Solid Pass", state);
+ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK;
+ psl->bone_solid[i] = DRW_pass_create("Bone Solid Pass", state | DRW_STATE_WRITE_DEPTH);
+ psl->bone_transp[i] = DRW_pass_create("Bone Transp Pass", state | DRW_STATE_BLEND);
/* Bones Outline */
state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
@@ -195,23 +191,24 @@ static void POSE_cache_populate(void *vedata, Object *ob)
* and similar functionalities. For now we handle only pose bones. */
if (ob->type == OB_ARMATURE) {
- if ((draw_ctx->v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ if ((draw_ctx->v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(draw_ctx->v3d->overlay.flag & V3D_OVERLAY_HIDE_BONES))
{
return;
}
if (DRW_pose_mode_armature(ob, draw_ctx->obact)) {
int ghost = (ob->dtx & OB_DRAWXRAY) ? 1 : 0;
+ bool transp = (ppd->transparent_bones || (ob->dt <= OB_WIRE));
DRWArmaturePasses passes = {
- .bone_solid = psl->bone_solid[ghost],
+ .bone_solid = (transp) ? psl->bone_transp[ghost] : psl->bone_solid[ghost],
.bone_outline = psl->bone_outline[ghost],
.bone_wire = psl->bone_wire[ghost],
.bone_envelope = psl->bone_envelope[ghost],
.bone_axes = psl->bone_axes,
.relationship_lines = psl->relationship[ghost],
};
- DRW_shgroup_armature_pose(ob, passes, ppd->transparent_bones);
+ DRW_shgroup_armature_pose(ob, passes, transp);
}
}
else if (ob->type == OB_MESH &&
@@ -260,13 +257,13 @@ static void POSE_draw_scene(void *vedata)
POSE_PassList *psl = ((POSE_Data *)vedata)->psl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
- const DRWContextState *draw_ctx = DRW_context_state_get();
- const bool transparent_bones = (draw_ctx->v3d->overlay.arm_flag & V3D_OVERLAY_ARM_TRANSP_BONES) != 0;
const bool bone_selection_overlay = POSE_is_bone_selection_overlay_active();
if (DRW_state_is_select()) {
+ DRW_draw_pass(psl->bone_outline[0]);
DRW_draw_pass(psl->bone_solid[0]);
DRW_draw_pass(psl->bone_wire[0]);
+ DRW_draw_pass(psl->bone_outline[1]);
DRW_draw_pass(psl->bone_solid[1]);
DRW_draw_pass(psl->bone_wire[1]);
return;
@@ -281,19 +278,11 @@ static void POSE_draw_scene(void *vedata)
}
DRW_draw_pass(psl->bone_envelope[0]);
-
- if (transparent_bones) {
- DRW_pass_state_add(psl->bone_solid[0], DRW_STATE_BLEND);
- DRW_pass_state_remove(psl->bone_solid[0], DRW_STATE_WRITE_DEPTH);
- DRW_draw_pass(psl->bone_solid[0]);
- }
+ DRW_draw_pass(psl->bone_transp[0]);
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
- if (!transparent_bones) {
- DRW_draw_pass(psl->bone_solid[0]);
- }
-
+ DRW_draw_pass(psl->bone_solid[0]);
DRW_draw_pass(psl->bone_outline[0]);
DRW_draw_pass(psl->bone_wire[0]);
DRW_draw_pass(psl->relationship[0]);
@@ -301,6 +290,7 @@ static void POSE_draw_scene(void *vedata)
MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl);
if (!DRW_pass_is_empty(psl->bone_envelope[1]) ||
+ !DRW_pass_is_empty(psl->bone_transp[1]) ||
!DRW_pass_is_empty(psl->bone_solid[1]) ||
!DRW_pass_is_empty(psl->bone_outline[1]) ||
!DRW_pass_is_empty(psl->bone_wire[1]) ||
@@ -311,13 +301,9 @@ static void POSE_draw_scene(void *vedata)
GPU_framebuffer_clear_depth(dfbl->default_fb, 1.0f);
}
- if (transparent_bones) {
- DRW_pass_state_add(psl->bone_solid[1], DRW_STATE_BLEND);
- DRW_pass_state_remove(psl->bone_solid[1], DRW_STATE_WRITE_DEPTH);
- }
-
DRW_draw_pass(psl->bone_envelope[1]);
DRW_draw_pass(psl->bone_solid[1]);
+ DRW_draw_pass(psl->bone_transp[1]);
DRW_draw_pass(psl->bone_outline[1]);
DRW_draw_pass(psl->bone_wire[1]);
DRW_draw_pass(psl->relationship[1]);
diff --git a/source/blender/draw/modes/sculpt_mode.c b/source/blender/draw/modes/sculpt_mode.c
index 5bc5506cbb7..ead539bc30f 100644
--- a/source/blender/draw/modes/sculpt_mode.c
+++ b/source/blender/draw/modes/sculpt_mode.c
@@ -1,6 +1,4 @@
/*
- * Copyright 2016, Blender Foundation.
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -15,12 +13,11 @@
* 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): Blender Institute
- *
+ * Copyright 2016, Blender Foundation.
*/
-/** \file blender/draw/modes/sculpt_mode.c
- * \ingroup draw
+/** \file
+ * \ingroup draw
*/
#include "DRW_engine.h"
@@ -32,19 +29,15 @@
#include "BKE_pbvh.h"
#include "BKE_paint.h"
-
-#include "DEG_depsgraph.h"
+#include "BKE_subdiv_ccg.h"
/* If builtin shaders are needed */
#include "GPU_shader.h"
-#include "GPU_matrix.h"
#include "draw_common.h"
-
#include "draw_mode_engines.h"
extern char datatoc_sculpt_mask_vert_glsl[];
-extern char datatoc_gpu_shader_flat_color_frag_glsl[];
extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
/* *********** LISTS *********** */
@@ -101,7 +94,6 @@ static struct {
* Add sources to source/blender/draw/modes/shaders
* init in SCULPT_engine_init();
* free in SCULPT_engine_free(); */
- struct GPUShader *shader_flat;
struct GPUShader *shader_smooth;
} e_data = {NULL}; /* Engine data */
@@ -125,11 +117,6 @@ static void SCULPT_engine_init(void *vedata)
UNUSED_VARS(txl, fbl, stl);
- if (!e_data.shader_flat) {
- e_data.shader_flat = DRW_shader_create(datatoc_sculpt_mask_vert_glsl, NULL,
- datatoc_gpu_shader_flat_color_frag_glsl,
- "#define SHADE_FLAT");
- }
if (!e_data.shader_smooth) {
e_data.shader_smooth = DRW_shader_create(datatoc_sculpt_mask_vert_glsl, NULL,
datatoc_gpu_shader_3D_smooth_color_frag_glsl, NULL);
@@ -144,37 +131,16 @@ static void SCULPT_cache_init(void *vedata)
SCULPT_StorageList *stl = ((SCULPT_Data *)vedata)->stl;
if (!stl->g_data) {
- /* Alloc transient pointers */
stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
}
{
- /* Create a pass */
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_MULTIPLY;
psl->pass = DRW_pass_create("Sculpt Pass", state);
-
- /* Create a shadingGroup using a function in draw_common.c or custom one */
- /*
- * stl->g_data->group = shgroup_dynlines_uniform_color(psl->pass, ts.colorWire);
- * -- or --
- * stl->g_data->group = DRW_shgroup_create(e_data.custom_shader, psl->pass);
- */
- stl->g_data->group_flat = DRW_shgroup_create(e_data.shader_flat, psl->pass);
stl->g_data->group_smooth = DRW_shgroup_create(e_data.shader_smooth, psl->pass);
}
}
-static bool object_is_flat(const Object *ob)
-{
- Mesh *me = ob->data;
- if (me->mpoly && me->mpoly[0].flag & ME_SMOOTH) {
- return false;
- }
- else {
- return true;
- }
-}
-
static void sculpt_draw_mask_cb(
DRWShadingGroup *shgroup,
void (*draw_fn)(DRWShadingGroup *shgroup, struct GPUBatch *geom),
@@ -185,11 +151,29 @@ static void sculpt_draw_mask_cb(
if (pbvh) {
BKE_pbvh_draw_cb(
- pbvh, NULL, NULL, false, true,
+ pbvh, NULL, NULL, false, false, true,
(void (*)(void *, struct GPUBatch *))draw_fn, shgroup);
}
}
+static void sculpt_update_pbvh_normals(Object *object)
+{
+ Mesh *mesh = object->data;
+ PBVH *pbvh = object->sculpt->pbvh;
+ SubdivCCG *subdiv_ccg = mesh->runtime.subdiv_ccg;
+ if (pbvh == NULL || subdiv_ccg == NULL) {
+ return;
+ }
+ BKE_sculpt_bvh_update_from_ccg(pbvh, subdiv_ccg);
+ struct CCGFace **faces;
+ int num_faces;
+ BKE_pbvh_get_grid_updates(pbvh, 1, (void ***)&faces, &num_faces);
+ if (num_faces > 0) {
+ BKE_subdiv_ccg_update_normals(subdiv_ccg, faces, num_faces);
+ MEM_freeN(faces);
+ }
+}
+
/* Add geometry to shadingGroups. Execute for each objects */
static void SCULPT_cache_populate(void *vedata, Object *ob)
{
@@ -202,6 +186,8 @@ static void SCULPT_cache_populate(void *vedata, Object *ob)
const DRWContextState *draw_ctx = DRW_context_state_get();
if (ob->sculpt && (ob == draw_ctx->obact)) {
+ sculpt_update_pbvh_normals(ob);
+
/* XXX, needed for dyntopo-undo (which clears).
* probably depsgraph should handlle? in 2.7x getting derived-mesh does this (mesh_build_data) */
if (ob->sculpt->pbvh == NULL) {
@@ -214,10 +200,7 @@ static void SCULPT_cache_populate(void *vedata, Object *ob)
PBVH *pbvh = ob->sculpt->pbvh;
if (pbvh && pbvh_has_mask(pbvh)) {
- /* Get geometry cache */
- DRWShadingGroup *shgroup = object_is_flat(ob) ? stl->g_data->group_flat : stl->g_data->group_smooth;
-
- DRW_shgroup_call_generate_add(shgroup, sculpt_draw_mask_cb, ob, ob->obmat);
+ DRW_shgroup_call_generate_add(stl->g_data->group_smooth, sculpt_draw_mask_cb, ob, ob->obmat);
}
}
}
@@ -266,7 +249,6 @@ static void SCULPT_draw_scene(void *vedata)
* Mostly used for freeing shaders */
static void SCULPT_engine_free(void)
{
- DRW_SHADER_FREE_SAFE(e_data.shader_flat);
DRW_SHADER_FREE_SAFE(e_data.shader_smooth);
}
diff --git a/source/blender/draw/modes/shaders/animviz_mpath_points_vert.glsl b/source/blender/draw/modes/shaders/animviz_mpath_points_vert.glsl
index 3b2f170ca22..f662cf5afde 100644
--- a/source/blender/draw/modes/shaders/animviz_mpath_points_vert.glsl
+++ b/source/blender/draw/modes/shaders/animviz_mpath_points_vert.glsl
@@ -7,6 +7,7 @@ uniform int cacheStart;
uniform bool showKeyFrames = true;
uniform bool useCustomColor;
uniform vec3 customColor;
+uniform int stepSize;
in vec3 pos;
in int flag;
@@ -27,6 +28,10 @@ void main()
/* Bias to reduce z fighting with the path */
gl_Position.z -= 1e-4;
+ if (gl_VertexID % stepSize == 0) {
+ gl_PointSize = float(pointSize) + 4;
+ }
+
if (showKeyFrames) {
if ((flag & MOTIONPATH_VERT_KEY) != 0) {
gl_PointSize = float(pointSize + 5);
diff --git a/source/blender/draw/modes/shaders/armature_axes_vert.glsl b/source/blender/draw/modes/shaders/armature_axes_vert.glsl
index 53b2a3d3b3b..137bcff1ed1 100644
--- a/source/blender/draw/modes/shaders/armature_axes_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_axes_vert.glsl
@@ -2,12 +2,12 @@
uniform mat4 ViewProjectionMatrix;
uniform vec3 screenVecs[3];
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in float axis; /* position on the axis. [0.0-1.0] is X axis, [1.0-2.0] is Y, etc... */
in vec2 screenPos;
in vec3 colorAxis;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat4 InstanceModelMatrix;
in vec4 color;
diff --git a/source/blender/draw/modes/shaders/armature_dof_vert.glsl b/source/blender/draw/modes/shaders/armature_dof_vert.glsl
index 5c89cf644d6..d9d56862140 100644
--- a/source/blender/draw/modes/shaders/armature_dof_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_dof_vert.glsl
@@ -1,10 +1,10 @@
uniform mat4 ViewProjectionMatrix;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec2 pos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
/* Assumed to be in world coordinate already. */
in mat4 InstanceModelMatrix;
in vec4 color;
diff --git a/source/blender/draw/modes/shaders/armature_envelope_outline_vert.glsl b/source/blender/draw/modes/shaders/armature_envelope_outline_vert.glsl
index 307c7276184..b170b4f41e2 100644
--- a/source/blender/draw/modes/shaders/armature_envelope_outline_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_envelope_outline_vert.glsl
@@ -7,12 +7,12 @@ uniform mat4 ProjectionMatrix;
uniform vec2 viewportSize;
uniform float lineThickness = 2.0;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec2 pos0;
in vec2 pos1;
in vec2 pos2;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
/* Assumed to be in world coordinate already. */
in vec4 headSphere;
in vec4 tailSphere;
diff --git a/source/blender/draw/modes/shaders/armature_envelope_solid_vert.glsl b/source/blender/draw/modes/shaders/armature_envelope_solid_vert.glsl
index 11935e9001f..01e77837201 100644
--- a/source/blender/draw/modes/shaders/armature_envelope_solid_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_envelope_solid_vert.glsl
@@ -3,10 +3,10 @@ uniform mat4 ViewMatrix;
uniform mat4 ViewMatrixInverse;
uniform mat4 ViewProjectionMatrix;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec3 pos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
/* Assumed to be in world coordinate already. */
in vec4 headSphere;
in vec4 tailSphere;
diff --git a/source/blender/draw/modes/shaders/armature_shape_outline_geom.glsl b/source/blender/draw/modes/shaders/armature_shape_outline_geom.glsl
index bcfa097b277..0fdd874f1fd 100644
--- a/source/blender/draw/modes/shaders/armature_shape_outline_geom.glsl
+++ b/source/blender/draw/modes/shaders/armature_shape_outline_geom.glsl
@@ -27,14 +27,26 @@ void emit_edge(vec2 edge_dir, vec2 hidden_dir, vec2 thick, bool is_persp)
vec2 t = thick * (is_persp ? abs(vPos[1].z) : 1.0);
gl_Position = pPos[1];
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[1].gl_ClipDistance);
+#endif
EmitVertex();
gl_Position.xy += t * edge_dir;
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[1].gl_ClipDistance);
+#endif
EmitVertex();
t = thick * (is_persp ? abs(vPos[2].z) : 1.0);
gl_Position = pPos[2];
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[2].gl_ClipDistance);
+#endif
EmitVertex();
gl_Position.xy += t * edge_dir;
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[2].gl_ClipDistance);
+#endif
EmitVertex();
}
@@ -44,6 +56,9 @@ void emit_corner(const int e, vec2 thick, bool is_persp)
vec2 t = thick * (is_persp ? abs(vPos[e].z) : 1.0);
gl_Position = pPos[e] + vec4(t * corner_dir, 0.0, 0.0);
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[e].gl_ClipDistance);
+#endif
EmitVertex();
}
@@ -69,13 +84,15 @@ void main(void)
if (abs(fac0) > 1e-5 && abs(fac3) > 1e-5) {
/* If both adjacent verts are facing the camera the same way,
* then it isn't an outline edge. */
- if (sign(fac0) == sign(fac3))
+ if (sign(fac0) == sign(fac3)) {
return;
+ }
}
/* Don't outline if concave edge. */
- if (dot(n0, v13) > 0.0001)
+ if (dot(n0, v13) > 0.0001) {
return;
+ }
vec2 thick = vColSize[0].w * (lineThickness / viewportSize);
vec2 edge_dir = compute_dir(ssPos[1], ssPos[2]);
diff --git a/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl b/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl
index 7619d8018f9..b190d834a61 100644
--- a/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl
@@ -5,11 +5,11 @@ uniform mat4 ViewMatrix;
uniform mat4 ProjectionMatrix;
uniform vec2 viewportSize;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec3 pos;
in vec3 snor;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat4 InstanceModelMatrix;
in vec4 outlineColorSize;
@@ -28,10 +28,11 @@ vec2 proj(vec4 pos)
void main()
{
/* This is slow and run per vertex, but it's still faster than
- * doing it per instance on CPU and sending it on via instance attrib */
+ * doing it per instance on CPU and sending it on via instance attribute. */
mat3 NormalMatrix = transpose(inverse(mat3(ViewMatrix * InstanceModelMatrix)));
- vec4 viewpos = ViewMatrix * (InstanceModelMatrix * vec4(pos, 1.0));
+ vec4 worldPosition = InstanceModelMatrix * vec4(pos, 1.0);
+ vec4 viewpos = ViewMatrix * worldPosition;
vPos = viewpos.xyz;
pPos = ProjectionMatrix * viewpos;
@@ -44,4 +45,8 @@ void main()
ssPos = proj(pPos);
vColSize = outlineColorSize;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance(worldPosition.xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl b/source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl
index 7abbf7f3d25..8463ffab447 100644
--- a/source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl
@@ -6,11 +6,11 @@ uniform mat4 ViewProjectionMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ProjectionMatrix;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec3 pos;
in vec3 nor;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat4 InstanceModelMatrix;
in vec3 boneColor;
in vec3 stateColor;
@@ -32,5 +32,11 @@ void main()
finalColor.rgb = mix(stateColor, boneColor, fac);
finalColor.a = 1.0;
- gl_Position = ViewProjectionMatrix * (InstanceModelMatrix * vec4(pos, 1.0));
+
+ vec4 worldPosition = InstanceModelMatrix * vec4(pos, 1.0);
+ gl_Position = ViewProjectionMatrix * worldPosition;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance(worldPosition.xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/armature_sphere_outline_vert.glsl b/source/blender/draw/modes/shaders/armature_sphere_outline_vert.glsl
index 0c1fefbf814..a48148a9a50 100644
--- a/source/blender/draw/modes/shaders/armature_sphere_outline_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_sphere_outline_vert.glsl
@@ -4,11 +4,11 @@ uniform mat4 ProjectionMatrix;
uniform vec2 viewportSize;
uniform float lineThickness = 2.0;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec2 pos0;
in vec2 pos1;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat4 InstanceModelMatrix;
in vec4 outlineColorSize;
@@ -99,4 +99,9 @@ void main()
gl_Position.xy += t * edge_dir;
finalColor = vec4(outlineColorSize.rgb, 1.0);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ vec4 worldPosition = InstanceModelMatrix * vec4(cam_pos0, 1.0);
+ world_clip_planes_calc_clip_distance(worldPosition.xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/armature_sphere_solid_vert.glsl b/source/blender/draw/modes/shaders/armature_sphere_solid_vert.glsl
index 7cbc0c5bc3a..0a2a2959120 100644
--- a/source/blender/draw/modes/shaders/armature_sphere_solid_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_sphere_solid_vert.glsl
@@ -2,10 +2,10 @@
uniform mat4 ViewMatrix;
uniform mat4 ProjectionMatrix;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec2 pos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat4 InstanceModelMatrix;
in vec3 stateColor;
in vec3 boneColor;
@@ -73,10 +73,16 @@ void main()
/* Camera oriented position (but still in local space) */
vec3 cam_pos = x_axis * pos.x + y_axis * pos.y + z_axis * z_ofs;
- vec4 V = model_view_matrix * vec4(cam_pos, 1.0);
+ vec4 pos_4d = vec4(cam_pos, 1.0);
+ vec4 V = model_view_matrix * pos_4d;
gl_Position = ProjectionMatrix * V;
viewPosition = V.xyz;
finalStateColor = stateColor;
finalBoneColor = boneColor;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ vec4 worldPosition = InstanceModelMatrix * pos_4d;
+ world_clip_planes_calc_clip_distance(worldPosition.xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/armature_stick_vert.glsl b/source/blender/draw/modes/shaders/armature_stick_vert.glsl
index 58fc48e608e..3f1aef47dce 100644
--- a/source/blender/draw/modes/shaders/armature_stick_vert.glsl
+++ b/source/blender/draw/modes/shaders/armature_stick_vert.glsl
@@ -1,10 +1,11 @@
uniform mat4 ProjectionMatrix;
uniform mat4 ViewProjectionMatrix;
+uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;
uniform vec2 viewportSize;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec2 pos; /* bone aligned screen space */
in uint flag;
@@ -17,7 +18,7 @@ in uint flag;
#define POS_TAIL 32u /* (1 << 5) */ /* UNUSED */
#define POS_BONE 64u /* (1 << 6) */
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in vec3 boneStart;
in vec3 boneEnd;
in vec4 wireColor; /* alpha encode if we do wire. If 0.0 we dont. */
@@ -49,8 +50,10 @@ void main()
/* Make the color */
colorFac = ((flag & COL_WIRE) == 0u) ? ((flag & COL_BONE) != 0u) ? 1.0 : 2.0 : 0.0;
- vec4 v0 = ViewMatrix * vec4(boneStart, 1.0);
- vec4 v1 = ViewMatrix * vec4(boneEnd, 1.0);
+ vec4 boneStart_4d = vec4(boneStart, 1.0);
+ vec4 boneEnd_4d = vec4(boneEnd, 1.0);
+ vec4 v0 = ViewMatrix * boneStart_4d;
+ vec4 v1 = ViewMatrix * boneEnd_4d;
/* Clip the bone to the camera origin plane (not the clip plane)
* to avoid glitches if one end is behind the camera origin (in persp). */
@@ -81,6 +84,10 @@ void main()
gl_Position = (is_head) ? p0 : p1;
gl_Position.xy += stickSize * (vpos / viewportSize);
gl_Position.z += (is_bone) ? 0.0 : 1e-6; /* Avoid Z fighting of head/tails. */
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * (is_head ? boneStart_4d : boneEnd_4d)).xyz);
+#endif
}
else {
gl_Position = vec4(0.0);
diff --git a/source/blender/draw/modes/shaders/common_globals_lib.glsl b/source/blender/draw/modes/shaders/common_globals_lib.glsl
index 520b368bbc2..88540b13941 100644
--- a/source/blender/draw/modes/shaders/common_globals_lib.glsl
+++ b/source/blender/draw/modes/shaders/common_globals_lib.glsl
@@ -5,10 +5,12 @@ layout(std140) uniform globalsBlock {
vec4 colorWireEdit;
vec4 colorActive;
vec4 colorSelect;
- vec4 colorTransform;
+ vec4 colorDupliSelect;
+ vec4 colorDupli;
vec4 colorLibrarySelect;
vec4 colorLibrary;
- vec4 colorLamp;
+ vec4 colorTransform;
+ vec4 colorLight;
vec4 colorSpeaker;
vec4 colorCamera;
vec4 colorEmpty;
@@ -33,7 +35,7 @@ layout(std140) uniform globalsBlock {
vec4 colorFaceDot;
vec4 colorDeselect;
vec4 colorOutline;
- vec4 colorLampNoAlpha;
+ vec4 colorLightNoAlpha;
vec4 colorBackground;
vec4 colorEditMeshMiddle;
@@ -64,9 +66,9 @@ layout(std140) uniform globalsBlock {
vec4 colorGridAxisY;
vec4 colorGridAxisZ;
- float sizeLampCenter;
- float sizeLampCircle;
- float sizeLampCircleShadow;
+ float sizeLightCenter;
+ float sizeLightCircle;
+ float sizeLightCircleShadow;
float sizeVertex;
float sizeEdge;
float sizeEdgeFix;
@@ -79,3 +81,21 @@ layout(std140) uniform globalsBlock {
float pad_globalsBlock;
};
+
+/* data[0] (1nd byte flags) */
+#define FACE_ACTIVE (1 << 0)
+#define FACE_SELECTED (1 << 1)
+#define FACE_FREESTYLE (1 << 2)
+#define VERT_UV_SELECT (1 << 3)
+#define VERT_UV_PINNED (1 << 4)
+#define EDGE_UV_SELECT (1 << 5)
+#define FACE_UV_ACTIVE (1 << 6)
+#define FACE_UV_SELECT (1 << 7)
+/* data[1] (2st byte flags) */
+#define VERT_ACTIVE (1 << 0)
+#define VERT_SELECTED (1 << 1)
+#define EDGE_ACTIVE (1 << 2)
+#define EDGE_SELECTED (1 << 3)
+#define EDGE_SEAM (1 << 4)
+#define EDGE_SHARP (1 << 5)
+#define EDGE_FREESTYLE (1 << 6)
diff --git a/source/blender/draw/modes/shaders/common_hair_lib.glsl b/source/blender/draw/modes/shaders/common_hair_lib.glsl
index 594a7b31f0b..359e4d87b7a 100644
--- a/source/blender/draw/modes/shaders/common_hair_lib.glsl
+++ b/source/blender/draw/modes/shaders/common_hair_lib.glsl
@@ -71,7 +71,7 @@ int hair_get_base_id(float local_time, int strand_segments, out float interp_tim
return int(ratio);
}
-void hair_get_interp_attribs(out vec4 data0, out vec4 data1, out vec4 data2, out vec4 data3, out float interp_time)
+void hair_get_interp_attrs(out vec4 data0, out vec4 data1, out vec4 data2, out vec4 data3, out float interp_time)
{
float local_time = float(gl_VertexID % hairStrandsRes) / float(hairStrandsRes - 1);
diff --git a/source/blender/draw/modes/shaders/common_hair_refine_vert.glsl b/source/blender/draw/modes/shaders/common_hair_refine_vert.glsl
index 9f412c57db3..c193c307e01 100644
--- a/source/blender/draw/modes/shaders/common_hair_refine_vert.glsl
+++ b/source/blender/draw/modes/shaders/common_hair_refine_vert.glsl
@@ -1,7 +1,7 @@
/* To be compiled with common_hair_lib.glsl */
-out vec4 outData;
+out vec4 finalColor;
vec4 get_weights_cardinal(float t)
{
@@ -44,12 +44,28 @@ vec4 interp_data(vec4 v0, vec4 v1, vec4 v2, vec4 v3, vec4 w)
return v0 * w.x + v1 * w.y + v2 * w.z + v3 * w.w;
}
+#ifdef TF_WORKAROUND
+uniform int targetWidth;
+uniform int targetHeight;
+uniform int idOffset;
+#endif
+
void main(void)
{
float interp_time;
vec4 data0, data1, data2, data3;
- hair_get_interp_attribs(data0, data1, data2, data3, interp_time);
+ hair_get_interp_attrs(data0, data1, data2, data3, interp_time);
vec4 weights = get_weights_cardinal(interp_time);
- outData = interp_data(data0, data1, data2, data3, weights);
+ finalColor = interp_data(data0, data1, data2, data3, weights);
+
+#ifdef TF_WORKAROUND
+ int id = gl_VertexID - idOffset;
+ gl_Position.x = ((float(id % targetWidth) + 0.5) / float(targetWidth)) * 2.0 - 1.0;
+ gl_Position.y = ((float(id / targetWidth) + 0.5) / float(targetHeight)) * 2.0 - 1.0;
+ gl_Position.z = 0.0;
+ gl_Position.w = 1.0;
+
+ gl_PointSize = 1.0;
+#endif
}
diff --git a/source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl b/source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl
index 7bc9b381bad..c2ab0ecfd40 100644
--- a/source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl
+++ b/source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl
@@ -1,7 +1,6 @@
-#define VERTEX_ACTIVE 1 << 0
-#define VERTEX_SELECTED 1 << 1
-#define ACTIVE_NURB 1 << 2 /* Keep the same value of `ACTIVE_NURB` in `draw_cache_imp_curve.c` */
+/* Keep the same value of `ACTIVE_NURB` in `draw_cache_imp_curve.c` */
+#define ACTIVE_NURB 1 << 2
#define EVEN_U_BIT 1 << 3
layout(lines) in;
@@ -20,10 +19,16 @@ void output_line(vec2 offset, vec4 color)
gl_Position = gl_in[0].gl_Position;
gl_Position.xy += offset * gl_in[0].gl_Position.w;
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[0].gl_ClipDistance);
+#endif
EmitVertex();
gl_Position = gl_in[1].gl_Position;
gl_Position.xy += offset * gl_in[1].gl_Position.w;
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[1].gl_ClipDistance);
+#endif
EmitVertex();
}
@@ -36,10 +41,11 @@ void main()
int color_id = (vertFlag[1] >> 4);
/* Don't output any edges if we don't show handles */
- if (!showCurveHandles && (color_id < 5))
+ if (!showCurveHandles && (color_id < 5)) {
return;
+ }
- bool edge_selected = (((vertFlag[1] | vertFlag[0]) & VERTEX_SELECTED) != 0);
+ bool edge_selected = (((vertFlag[1] | vertFlag[0]) & VERT_SELECTED) != 0);
vec4 inner_color;
if (color_id == 0) inner_color = (edge_selected) ? colorHandleSelFree : colorHandleFree;
@@ -48,7 +54,7 @@ void main()
else if (color_id == 3) inner_color = (edge_selected) ? colorHandleSelAlign : colorHandleAlign;
else if (color_id == 4) inner_color = (edge_selected) ? colorHandleSelAutoclamp : colorHandleAutoclamp;
else {
- bool is_selected = (((vertFlag[1] & vertFlag[0]) & VERTEX_SELECTED) != 0);
+ bool is_selected = (((vertFlag[1] & vertFlag[0]) & VERT_SELECTED) != 0);
bool is_u_segment = (((vertFlag[1] ^ vertFlag[0]) & EVEN_U_BIT) != 0);
if (is_u_segment) {
inner_color = (is_selected) ? colorNurbSelUline : colorNurbUline;
diff --git a/source/blender/draw/modes/shaders/edit_curve_overlay_handle_vert.glsl b/source/blender/draw/modes/shaders/edit_curve_overlay_handle_vert.glsl
index d3f9deedf0c..f92aab3254c 100644
--- a/source/blender/draw/modes/shaders/edit_curve_overlay_handle_vert.glsl
+++ b/source/blender/draw/modes/shaders/edit_curve_overlay_handle_vert.glsl
@@ -1,7 +1,6 @@
-
/* Draw Curve Handles */
-
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
in vec3 pos;
in int data;
@@ -10,6 +9,11 @@ flat out int vertFlag;
void main()
{
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+ vec4 pos_4d = vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * pos_4d;
vertFlag = data;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/edit_curve_overlay_loosevert_vert.glsl b/source/blender/draw/modes/shaders/edit_curve_overlay_loosevert_vert.glsl
index 85e38ba3b43..b7ffb56ad30 100644
--- a/source/blender/draw/modes/shaders/edit_curve_overlay_loosevert_vert.glsl
+++ b/source/blender/draw/modes/shaders/edit_curve_overlay_loosevert_vert.glsl
@@ -1,7 +1,6 @@
-
/* Draw Curve Vertices */
-
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
uniform vec2 viewportSize;
in vec3 pos;
@@ -9,13 +8,10 @@ in int data;
out vec4 finalColor;
-#define VERTEX_ACTIVE (1 << 0)
-#define VERTEX_SELECTED (1 << 1)
-
void main()
{
- if ((data & VERTEX_SELECTED) != 0) {
- if ((data & VERTEX_ACTIVE) != 0) {
+ if ((data & VERT_SELECTED) != 0) {
+ if ((data & VERT_ACTIVE) != 0) {
finalColor = colorEditMeshActive;
}
else {
@@ -26,6 +22,10 @@ void main()
finalColor = colorVertex;
}
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+ vec4 pos_4d = vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * pos_4d;
gl_PointSize = sizeVertex * 2.0;
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl b/source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl
index 06be402d737..da05d224283 100644
--- a/source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl
+++ b/source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl
@@ -1,7 +1,6 @@
-
/* Draw Curve Normals */
-
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
uniform float normalSize;
in vec3 pos;
@@ -19,5 +18,10 @@ void main()
final_pos += normalSize * rad * (flip * nor - tan);
}
- gl_Position = ModelViewProjectionMatrix * vec4(final_pos, 1.0);
+ vec4 final_pos_4d = vec4(final_pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * final_pos_4d;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * final_pos_4d).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/edit_lattice_overlay_frag.glsl b/source/blender/draw/modes/shaders/edit_lattice_overlay_frag.glsl
index e78462b6915..92caa4620d7 100644
--- a/source/blender/draw/modes/shaders/edit_lattice_overlay_frag.glsl
+++ b/source/blender/draw/modes/shaders/edit_lattice_overlay_frag.glsl
@@ -1,19 +1,16 @@
flat in int vertFlag;
-#define VERTEX_SELECTED (1 << 0)
-#define VERTEX_ACTIVE (1 << 1)
-
out vec4 FragColor;
void main()
{
/* TODO: vertex size */
- if ((vertFlag & VERTEX_SELECTED) != 0) {
+ if ((vertFlag & VERT_SELECTED) != 0) {
FragColor = colorVertexSelect;
}
- else if ((vertFlag & VERTEX_ACTIVE) != 0) {
+ else if ((vertFlag & VERT_ACTIVE) != 0) {
FragColor = colorEditMeshActive;
}
else {
diff --git a/source/blender/draw/modes/shaders/edit_lattice_overlay_loosevert_vert.glsl b/source/blender/draw/modes/shaders/edit_lattice_overlay_loosevert_vert.glsl
index 0cbc66a2b1f..bf0357632e6 100644
--- a/source/blender/draw/modes/shaders/edit_lattice_overlay_loosevert_vert.glsl
+++ b/source/blender/draw/modes/shaders/edit_lattice_overlay_loosevert_vert.glsl
@@ -2,6 +2,7 @@
/* Draw Lattice Vertices */
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
uniform vec2 viewportSize;
in vec3 pos;
@@ -36,4 +37,9 @@ void main()
gl_PointSize = sizeVertex;
gl_Position = pPos;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
+
}
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_common_lib.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_common_lib.glsl
index b37862f2037..6563945af39 100644
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_common_lib.glsl
+++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_common_lib.glsl
@@ -1,24 +1,7 @@
-#define EDGE_EXISTS (1 << 0)
-#define EDGE_ACTIVE (1 << 1)
-#define EDGE_SELECTED (1 << 2)
-#define EDGE_SEAM (1 << 3)
-#define EDGE_SHARP (1 << 4)
-#define EDGE_FREESTYLE (1 << 5)
-#define EDGE_VERTEX_ACTIVE (1 << (0 + 8))
-#define EDGE_VERTEX_SELECTED (1 << (1 + 8))
-#define EDGE_VERTEX_EXISTS (1 << (2 + 8))
-
-#define VERTEX_ACTIVE (1 << 0)
-#define VERTEX_SELECTED (1 << 1)
-#define VERTEX_EXISTS (1 << 2)
-
-#define FACE_ACTIVE (1 << 3)
-#define FACE_SELECTED (1 << 4)
-#define FACE_FREESTYLE (1 << 5)
uniform bool doEdges = true;
-vec4 EDIT_MESH_edge_color_outer(int edge_flag, bool face_active, float crease, float bweight)
+vec4 EDIT_MESH_edge_color_outer(int edge_flag, int face_flag, float crease, float bweight)
{
vec4 color = vec4(0.0);
color = ((edge_flag & EDGE_FREESTYLE) != 0) ? colorEdgeFreestyle : color;
@@ -26,28 +9,62 @@ vec4 EDIT_MESH_edge_color_outer(int edge_flag, bool face_active, float crease, f
color = (crease > 0.0) ? vec4(colorEdgeCrease.rgb, crease) : color;
color = (bweight > 0.0) ? vec4(colorEdgeBWeight.rgb, bweight) : color;
color = ((edge_flag & EDGE_SEAM) != 0) ? colorEdgeSeam : color;
-
- if (face_active) {
- color = colorEditMeshActive;
- }
return color;
}
-vec4 EDIT_MESH_edge_color_inner(int edge_flag, bool face_active)
+vec4 EDIT_MESH_edge_color_inner(int edge_flag)
{
vec4 color = colorWireEdit;
-#ifdef EDGE_SELECTION
color = ((edge_flag & EDGE_SELECTED) != 0) ? colorEdgeSelect : color;
color = ((edge_flag & EDGE_ACTIVE) != 0) ? colorEditMeshActive : color;
-#else
- color = (doEdges && (edge_flag & EDGE_SELECTED) != 0) ? colorEdgeSelect : color;
-#endif
return color;
}
-vec4 EDIT_MESH_vertex_color(int vertex_flag)
+vec4 EDIT_MESH_edge_vertex_color(int vertex_flag)
{
vec4 color = colorWireEdit;
- color = (doEdges && (vertex_flag & (VERTEX_ACTIVE | VERTEX_SELECTED)) != 0) ? colorEdgeSelect : color;
+ color = (doEdges && (vertex_flag & (VERT_ACTIVE | VERT_SELECTED)) != 0) ? colorEdgeSelect : color;
return color;
}
+
+vec4 EDIT_MESH_vertex_color(int vertex_flag)
+{
+ if ((vertex_flag & VERT_ACTIVE) != 0) {
+ return vec4(colorEditMeshActive.xyz, 1.0);
+ }
+ else if ((vertex_flag & VERT_SELECTED) != 0) {
+ return colorVertexSelect;
+ }
+ else {
+ return colorVertex;
+ }
+}
+
+vec4 EDIT_MESH_face_color(int face_flag)
+{
+ if ((face_flag & FACE_ACTIVE) != 0) {
+ return mix(colorFaceSelect, colorEditMeshActive, 0.5);
+ }
+ else if ((face_flag & FACE_SELECTED) != 0) {
+ return colorFaceSelect;
+ }
+ else if ((face_flag & FACE_FREESTYLE) != 0) {
+ return colorFaceFreestyle;
+ }
+ else {
+ return colorFace;
+ }
+}
+
+vec4 EDIT_MESH_facedot_color(float facedot_flag)
+{
+ if (facedot_flag < 0.0f) {
+ return colorEditMeshActive;
+ }
+ else if (facedot_flag > 0.0f) {
+ return colorFaceDot;
+ }
+ else {
+ return colorVertex;
+ }
+}
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_facedot_frag.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_facedot_frag.glsl
deleted file mode 100644
index 71cc1ccde8d..00000000000
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_facedot_frag.glsl
+++ /dev/null
@@ -1,19 +0,0 @@
-
-flat in int isSelected;
-#ifdef VERTEX_FACING
-flat in float facing;
-#endif
-
-out vec4 FragColor;
-
-void main()
-{
- if (isSelected != 0)
- FragColor = colorFaceDot;
- else
- FragColor = colorVertex;
-
-#ifdef VERTEX_FACING
- FragColor.a *= 1.0 - abs(facing) * 0.4;
-#endif
-}
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_facedot_vert.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_facedot_vert.glsl
deleted file mode 100644
index 50f6f3e2cf8..00000000000
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_facedot_vert.glsl
+++ /dev/null
@@ -1,31 +0,0 @@
-
-uniform mat4 ModelViewProjectionMatrix;
-
-in vec3 pos;
-in vec4 norAndFlag;
-
-flat out int isSelected;
-
-#ifdef VERTEX_FACING
-uniform mat4 ProjectionMatrix;
-uniform mat4 ModelViewMatrix;
-uniform mat3 NormalMatrix;
-
-flat out float facing;
-#endif
-
-void main()
-{
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
- /* Bias Facedot Z position in clipspace. */
- gl_Position.z -= 0.00035;
- gl_PointSize = sizeFaceDot;
- isSelected = int(norAndFlag.w);
-#ifdef VERTEX_FACING
- vec3 view_normal = normalize(NormalMatrix * norAndFlag.xyz);
- vec3 view_vec = (ProjectionMatrix[3][3] == 0.0)
- ? normalize((ModelViewMatrix * vec4(pos, 1.0)).xyz)
- : vec3(0.0, 0.0, 1.0);
- facing = dot(view_vec, view_normal);
-#endif
-}
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl
index eb68eb9b0dc..1c2338f0913 100644
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl
+++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl
@@ -1,5 +1,6 @@
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
uniform ivec4 dataMask = ivec4(0xFF);
in vec3 pos;
@@ -7,22 +8,15 @@ in ivec4 data;
flat out vec4 faceColor;
-#define FACE_ACTIVE (1 << 3)
-#define FACE_SELECTED (1 << 4)
-#define FACE_FREESTYLE (1 << 5)
-
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
ivec4 data_m = data & dataMask;
- if ((data_m.x & FACE_ACTIVE) != 0)
- faceColor = colorFaceSelect;
- else if ((data_m.x & FACE_SELECTED) != 0)
- faceColor = colorFaceSelect;
- else if ((data_m.x & FACE_FREESTYLE) != 0)
- faceColor = colorFaceFreestyle;
- else
- faceColor = colorFace;
+ faceColor = EDIT_MESH_face_color(data_m.x);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl
index 0d5c76ad790..dbad525c281 100644
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl
+++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl
@@ -1,152 +1,36 @@
-/* Solid Wirefram implementation
- * Mike Erwin, Clément Foucault */
+#define M_1_SQRTPI 0.5641895835477563 /* 1/sqrt(pi) */
+
+/**
+ * We want to know how much a pixel is covered by a line.
+ * We replace the square pixel with acircle of the same area and try to find the intersection area.
+ * The area we search is the circular segment. https://en.wikipedia.org/wiki/Circular_segment
+ * The formula for the area uses inverse trig function and is quite complexe.
+ * Instead, we approximate it by using the smoothstep function and a 1.05 factor to the disc radius.
+ **/
+#define DISC_RADIUS (M_1_SQRTPI * 1.05)
+#define GRID_LINE_SMOOTH_START (0.5 - DISC_RADIUS)
+#define GRID_LINE_SMOOTH_END (0.5 + DISC_RADIUS)
-uniform float faceAlphaMod;
uniform float edgeScale;
-uniform bool isXray = false;
-flat in vec3 edgesCrease;
-flat in vec3 edgesBweight;
-flat in vec4 faceColor;
-flat in ivec3 flag;
-#ifdef VERTEX_SELECTION
-in vec3 vertexColor;
-#endif
-
-#ifdef EDGE_FIX
-flat in vec2 ssPos[3];
-#else
-in vec3 barycentric;
-#endif
-
-#ifdef VERTEX_FACING
-in float facing;
-#endif
+flat in vec4 finalColorOuter_f;
+in vec4 finalColor_f;
+in float edgeCoord_f;
out vec4 FragColor;
-/* Vertex flag is shifted and combined with the edge flag */
-#define FACE_ACTIVE_ (FACE_ACTIVE << 8)
-
-#define LARGE_EDGE_SIZE 2.15
-
-/* Enough to visually fill gaps and not enough to mess the AA gradient too much. */
-#define EDGE_FIX_ALPHA 0.67
-
-void distToEdgesAndPoints(out vec3 edges, out vec3 points)
-{
-#ifdef EDGE_FIX
- vec2 e0 = normalize(ssPos[1] - ssPos[0] + 1e-8);
- vec2 e1 = normalize(ssPos[2] - ssPos[1] + 1e-8);
- vec2 e2 = normalize(ssPos[0] - ssPos[2] + 1e-8);
- e0 = vec2(-e0.y, e0.x);
- e1 = vec2(-e1.y, e1.x);
- e2 = vec2(-e2.y, e2.x);
- vec2 p0 = gl_FragCoord.xy - ssPos[0];
- vec2 p1 = gl_FragCoord.xy - ssPos[1];
- vec2 p2 = gl_FragCoord.xy - ssPos[2];
- edges.z = abs(dot(e0, p0));
- edges.x = abs(dot(e1, p1));
- edges.y = abs(dot(e2, p2));
-#else
- vec3 dx = dFdx(barycentric);
- vec3 dy = dFdy(barycentric);
- /* per component derivative */
- vec2 d0 = vec2(dx.x, dy.x);
- vec2 d1 = vec2(dx.y, dy.y);
- vec2 d2 = vec2(dx.z, dy.z);
- vec3 d = vec3(length(d0), length(d1), length(d2));
-
- edges = abs(vec3(barycentric / d));
-#endif
-
-#if defined(VERTEX_SELECTION) && defined(EDGE_FIX)
- points.x = dot(p0, p0);
- points.y = dot(p1, p1);
- points.z = dot(p2, p2);
- points = sqrt(points);
-#else
- points = vec3(1e10);
-#endif
-}
-
-void colorDist(vec4 color, float dist)
-{
- FragColor = (dist < 0) ? color : FragColor;
-}
-
-#ifdef ANTI_ALIASING
-void colorDistEdge(vec4 color, float dist)
-{
- FragColor.rgb *= FragColor.a;
- FragColor = mix(color, FragColor, clamp(dist, 0.0, 1.0));
- FragColor.rgb /= max(1e-8, FragColor.a);
-}
-#else
-#define colorDistEdge colorDist
-#endif
-
void main()
{
- vec3 e, p;
- distToEdgesAndPoints(e, p);
-
- /* Face */
- FragColor = faceColor;
- FragColor.a *= faceAlphaMod;
-
- /* Edges */
- float sizeEdgeFinal = sizeEdge * edgeScale;
-
- for (int v = 0; v < 3; ++v) {
- if ((flag[v] & EDGE_EXISTS) != 0) {
- /* Outer large edge */
- float largeEdge = e[v] - sizeEdgeFinal * LARGE_EDGE_SIZE;
-
- vec4 large_edge_color = EDIT_MESH_edge_color_outer(flag[v], (flag[0] & FACE_ACTIVE_) != 0, edgesCrease[v], edgesBweight[v]);
-#ifdef EDGE_FIX
- large_edge_color *= isXray ? 1.0 : EDGE_FIX_ALPHA;
-#endif
- if (large_edge_color.a != 0.0) {
- colorDistEdge(large_edge_color, largeEdge);
- }
-
- /* Inner thin edge */
- float innerEdge = e[v] - sizeEdgeFinal;
-#ifdef ANTI_ALIASING
- innerEdge += 0.4;
-#endif
-
-#ifdef VERTEX_SELECTION
- vec4 inner_edge_color = vec4(vertexColor, 1.0);
+ float dist = abs(edgeCoord_f) - max(sizeEdge * edgeScale - 0.5, 0.0);
+ float dist_outer = dist - max(sizeEdge * edgeScale, 1.0);
+#ifdef USE_SMOOTH_WIRE
+ float mix_w = smoothstep(GRID_LINE_SMOOTH_START, GRID_LINE_SMOOTH_END, dist);
+ float mix_w_outer = smoothstep(GRID_LINE_SMOOTH_START, GRID_LINE_SMOOTH_END, dist_outer);
#else
- vec4 inner_edge_color = EDIT_MESH_edge_color_inner(flag[v], (flag[0] & FACE_ACTIVE_) != 0);
-#endif
-#ifdef EDGE_FIX
- inner_edge_color *= isXray ? 1.0 : EDGE_FIX_ALPHA;
+ float mix_w = step(0.5, dist);
+ float mix_w_outer = step(0.5, dist_outer);
#endif
- colorDistEdge(inner_edge_color, innerEdge);
- }
- }
-
-#if defined(VERTEX_SELECTION) && defined(EDGE_FIX)
- /* Points */
- for (int v = 0; v < 3; ++v) {
- if ((flag[v] & EDGE_VERTEX_EXISTS) != 0) {
- float size = p[v] - sizeVertex;
- vec4 point_color = colorVertex;
- point_color = ((flag[v] & EDGE_VERTEX_SELECTED) != 0) ? colorVertexSelect : point_color;
- point_color = ((flag[v] & EDGE_VERTEX_ACTIVE) != 0) ? vec4(colorEditMeshActive.xyz, 1.0) : point_color;
- colorDist(point_color, size);
- }
- }
-#endif
-
-#ifdef VERTEX_FACING
- FragColor.rgb = mix(colorEditMeshMiddle.rgb, FragColor.rgb, 1.0 - abs(facing) * 0.4);
-#endif
-
- /* don't write depth if not opaque */
- if (FragColor.a == 0.0) discard;
+ FragColor = mix(finalColorOuter_f, finalColor_f, 1.0 - mix_w * finalColorOuter_f.a);
+ FragColor.a *= 1.0 - (finalColorOuter_f.a > 0.0 ? mix_w_outer : mix_w);
}
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_geom.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_geom.glsl
new file mode 100644
index 00000000000..9a0bda3b81d
--- /dev/null
+++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_geom.glsl
@@ -0,0 +1,60 @@
+
+layout(lines) in;
+layout(triangle_strip, max_vertices = 4) out;
+
+uniform vec2 viewportSize;
+uniform vec2 viewportSizeInv;
+uniform float edgeScale;
+
+in vec4 finalColor[2];
+in vec4 finalColorOuter[2];
+in int selectOveride[2];
+
+flat out vec4 finalColorOuter_f;
+out vec4 finalColor_f;
+out float edgeCoord_f;
+
+void do_vertex(const int i, float coord, vec2 offset)
+{
+ finalColor_f = (selectOveride[0] == 0) ? finalColor[i] : finalColor[0];
+ edgeCoord_f = coord;
+ gl_Position = gl_in[i].gl_Position;
+ /* Multiply offset by 2 because gl_Position range is [-1..1]. */
+ gl_Position.xy += offset * 2.0 * gl_Position.w;
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[i].gl_ClipDistance);
+#endif
+ EmitVertex();
+}
+
+void main()
+{
+ vec2 ss_pos[2];
+ ss_pos[0] = gl_in[0].gl_Position.xy / gl_in[0].gl_Position.w;
+ ss_pos[1] = gl_in[1].gl_Position.xy / gl_in[1].gl_Position.w;
+
+ vec2 line = ss_pos[0] - ss_pos[1];
+ line = abs(line) * viewportSize;
+
+ finalColorOuter_f = finalColorOuter[0];
+ float half_size = sizeEdge * edgeScale;
+ /* Enlarge edge for flag display. */
+ half_size += (finalColorOuter_f.a > 0.0) ? max(sizeEdge * edgeScale, 1.0) : 0.0;
+
+#ifdef USE_SMOOTH_WIRE
+ /* Add 1 px for AA */
+ half_size += 0.5;
+#endif
+
+ vec3 edge_ofs = half_size * viewportSizeInv.xyy * vec3(1.0, 1.0, 0.0);
+
+ bool horizontal = line.x > line.y;
+ edge_ofs = (horizontal) ? edge_ofs.zyz : edge_ofs.xzz;
+
+ do_vertex(0, half_size, edge_ofs.xy);
+ do_vertex(0, -half_size, -edge_ofs.xy);
+ do_vertex(1, half_size, edge_ofs.xy);
+ do_vertex(1, -half_size, -edge_ofs.xy);
+
+ EndPrimitive();
+}
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_geom_edge.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_geom_edge.glsl
deleted file mode 100644
index 1a44e4a9e4f..00000000000
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_geom_edge.glsl
+++ /dev/null
@@ -1,119 +0,0 @@
-
-/* Solid Wirefram implementation
- * Mike Erwin, Clément Foucault */
-
-layout(lines) in;
-layout(triangle_strip, max_vertices=4) out;
-
-uniform mat4 ProjectionMatrix;
-uniform vec2 viewportSize;
-
-in vec4 pPos[];
-in ivec4 vData[];
-#ifdef VERTEX_FACING
-in float vFacing[];
-#endif
-
-/* these are the same for all vertices
- * and does not need interpolation */
-flat out vec3 edgesCrease;
-flat out vec3 edgesBweight;
-flat out vec4 faceColor;
-flat out ivec3 flag;
-#ifdef VERTEX_SELECTION
-out vec3 vertexColor;
-#endif
-#ifdef VERTEX_FACING
-out float facing;
-#endif
-
-/* See fragment shader */
-flat out vec2 ssPos[3];
-
-/* Some bugged AMD drivers need these global variables. See T55961 */
-#ifdef VERTEX_SELECTION
-vec3 vertex_color[3];
-#endif
-
-#ifdef VERTEX_FACING
-float v_facing[3];
-#endif
-
-/* project to screen space */
-vec2 proj(vec4 pos)
-{
- return (0.5 * (pos.xy / pos.w) + 0.5) * viewportSize;
-}
-
-void doVertex(int v, vec4 pos)
-{
-#ifdef VERTEX_SELECTION
- vertexColor = vertex_color[v];
-#endif
-
-#ifdef VERTEX_FACING
- facing = v_facing[v];
-#endif
-
- gl_Position = pos;
-
- EmitVertex();
-}
-
-void main()
-{
- /* Face */
- faceColor = vec4(0.0);
-
- /* Proj Vertex */
- vec2 pos[2] = vec2[2](proj(pPos[0]), proj(pPos[1]));
-
- /* little optimization use a vec4 to vectorize
- * following operations */
- vec4 dirs1, dirs2;
-
- /* Edge normalized vector */
- dirs1.xy = normalize(pos[1] - pos[0]);
-
- /* perpendicular to dir */
- dirs1.zw = vec2(-dirs1.y, dirs1.x);
-
- /* Make it view independent */
- dirs1 *= sizeEdgeFix / viewportSize.xyxy;
-
- dirs2 = dirs1;
-
- /* Perspective */
- if (ProjectionMatrix[3][3] == 0.0) {
- dirs1 *= pPos[0].w;
- dirs2 *= pPos[1].w;
- }
-
-#ifdef VERTEX_SELECTION
- vertex_color[0] = EDIT_MESH_vertex_color(vData[0].x).rgb;
- vertex_color[1] = EDIT_MESH_vertex_color(vData[1].x).rgb;
-#endif
-
-#ifdef VERTEX_FACING
- /* Weird but some buggy AMD drivers need this. */
- v_facing[0] = vFacing[0];
- v_facing[1] = vFacing[1];
-#endif
-
- /* Edge / Vert data */
- ssPos[0] = ssPos[2] = pos[0];
- ssPos[1] = pos[1];
- flag[0] = flag[2] = (vData[0].x << 8);
- flag[1] = (vData[1].x << 8);
- doVertex(0, pPos[0] + vec4( dirs1.zw, 0.0, 0.0));
- doVertex(0, pPos[0] + vec4(-dirs1.zw, 0.0, 0.0));
-
- flag[2] |= vData[0].y;
- edgesCrease[2] = vData[0].z / 255.0;
- edgesBweight[2] = vData[0].w / 255.0;
-
- doVertex(1, pPos[1] + vec4( dirs2.zw, 0.0, 0.0));
- doVertex(1, pPos[1] + vec4(-dirs2.zw, 0.0, 0.0));
-
- EndPrimitive();
-}
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_geom_tri.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_geom_tri.glsl
deleted file mode 100644
index fa2063a40a6..00000000000
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_geom_tri.glsl
+++ /dev/null
@@ -1,211 +0,0 @@
-
-/* Solid Wirefram implementation
- * Mike Erwin, Clément Foucault */
-
-layout(triangles) in;
-
-/* To fix the edge artifacts, we render
- * an outline strip around the screenspace
- * triangle. Order is important.
- * TODO diagram
- */
-layout(triangle_strip, max_vertices=11) out;
-
-uniform mat4 ProjectionMatrix;
-uniform vec2 viewportSize;
-uniform bool isXray = false;
-
-in vec4 pPos[];
-in ivec4 vData[];
-#ifdef VERTEX_FACING
-in float vFacing[];
-#endif
-
-/* these are the same for all vertices
- * and does not need interpolation */
-flat out vec3 edgesCrease;
-flat out vec3 edgesBweight;
-flat out vec4 faceColor;
-flat out ivec3 flag;
-
-flat out vec2 ssPos[3];
-#ifdef VERTEX_SELECTION
-out vec3 vertexColor;
-#endif
-#ifdef VERTEX_FACING
-out float facing;
-#endif
-
-#ifdef ANTI_ALIASING
-#define Z_OFFSET -0.0005
-#else
-#define Z_OFFSET 0.0
-#endif
-
-/* Some bugged AMD drivers need these global variables. See T55961 */
-#ifdef VERTEX_SELECTION
-vec3 vertex_color[3];
-#endif
-
-#ifdef VERTEX_FACING
-float v_facing[3];
-#endif
-
-/* project to screen space */
-vec2 proj(vec4 pos)
-{
- return (0.5 * (pos.xy / pos.w) + 0.5) * viewportSize;
-}
-
-void doVertex(int v)
-{
-#ifdef VERTEX_SELECTION
- vertexColor = vertex_color[v];
-#endif
-
-#ifdef VERTEX_FACING
- facing = v_facing[v];
-#endif
- gl_Position = pPos[v];
-
- EmitVertex();
-}
-
-void doVertexOfs(int v, vec2 fixvec)
-{
-#ifdef VERTEX_SELECTION
- vertexColor = vertex_color[v];
-#endif
-
-#ifdef VERTEX_FACING
- facing = v_facing[v];
-#endif
- float z_ofs = Z_OFFSET * ((ProjectionMatrix[3][3] == 0.0) ? 1.0 : 0.0);
- gl_Position = pPos[v] + vec4(fixvec * pPos[v].w, z_ofs, 0.0);
-
- EmitVertex();
-}
-
-void mask_edge_flag(int v, ivec3 eflag)
-{
- int vaf = (v + 1) % 3;
-
- /* Only shade the edge that we are currently drawing.
- * (fix corner bleeding) */
- flag = eflag;
- flag[vaf] &= ~EDGE_EXISTS;
- flag[v] &= ~EDGE_EXISTS;
-}
-
-vec2 compute_fixvec(int i)
-{
- int i1 = (i + 1) % 3;
- int i2 = (i + 2) % 3;
- /* This fix the case when 2 vertices are perfectly aligned
- * and corner vectors have nowhere to go.
- * ie: length(cornervec[i]) == 0 */
- const float epsilon = 1e-2; /* in pixel so not that much */
- const vec2 bias[3] = vec2[3](
- vec2( epsilon, epsilon),
- vec2(-epsilon, epsilon),
- vec2( 0.0, -epsilon)
- );
- vec2 v1 = ssPos[i] + bias[i];
- vec2 v2 = ssPos[i1] + bias[i1];
- vec2 v3 = ssPos[i2] + bias[i2];
- /* Edge normalized vector */
- vec2 dir = normalize(v2 - v1);
- vec2 dir2 = normalize(v3 - v1);
- /* perpendicular to dir */
- vec2 perp = vec2(-dir.y, dir.x);
- /* Backface case */
- if (dot(perp, dir2) > 0.0) {
- perp = -perp;
- }
- /* Make it view independent */
- return perp * sizeEdgeFix / viewportSize;
-}
-
-void main()
-{
- /* Edge */
- ivec3 eflag;
- for (int v = 0; v < 3; ++v) {
- eflag[v] = vData[v].y | (vData[v].x << 8);
- edgesCrease[v] = vData[v].z / 255.0;
- edgesBweight[v] = vData[v].w / 255.0;
- }
-
- /* Face */
- vec4 fcol;
- if ((vData[0].x & FACE_ACTIVE) != 0)
- fcol = colorFaceSelect;
- else if ((vData[0].x & FACE_SELECTED) != 0)
- fcol = colorFaceSelect;
- else if ((vData[0].x & FACE_FREESTYLE) != 0)
- fcol = colorFaceFreestyle;
- else
- fcol = colorFace;
-
- /* Vertex */
- ssPos[0] = proj(pPos[0]);
- ssPos[1] = proj(pPos[1]);
- ssPos[2] = proj(pPos[2]);
-
-#ifdef VERTEX_SELECTION
- vertex_color[0] = EDIT_MESH_vertex_color(vData[0].x).rgb;
- vertex_color[1] = EDIT_MESH_vertex_color(vData[1].x).rgb;
- vertex_color[2] = EDIT_MESH_vertex_color(vData[2].x).rgb;
-#endif
-
-#ifdef VERTEX_FACING
- /* Weird but some buggy AMD drivers need this. */
- v_facing[0] = vFacing[0];
- v_facing[1] = vFacing[1];
- v_facing[2] = vFacing[2];
-#endif
-
- /* Remember that we are assuming the last vertex
- * of a triangle is the provoking vertex (decide what flat attribs are). */
-
- if ((eflag[2] & EDGE_EXISTS) != 0) {
- /* Do 0 -> 1 edge strip */
- faceColor = vec4(fcol.rgb, 0.0);
- mask_edge_flag(0, eflag);
-
- vec2 fixvec = compute_fixvec(0);
- doVertexOfs(0, fixvec);
- doVertexOfs(1, fixvec);
- }
-
- doVertex(0);
- doVertex(1);
-
- /* Do face triangle */
- faceColor = fcol;
- flag = (isXray) ? ivec3(0) : eflag;
- doVertex(2);
- faceColor.a = 0.0; /* to not let face color bleed */
-
- if ((eflag[0] & EDGE_EXISTS) != 0) {
- /* Do 1 -> 2 edge strip */
- mask_edge_flag(1, eflag);
-
- vec2 fixvec = compute_fixvec(1);
- doVertexOfs(1, fixvec);
- doVertexOfs(2, fixvec);
- }
- EndPrimitive();
-
- if ((eflag[1] & EDGE_EXISTS) != 0) {
- /* Do 2 -> 0 edge strip */
- mask_edge_flag(2, eflag);
- doVertex(2);
- doVertex(0);
-
- vec2 fixvec = compute_fixvec(2);
- doVertexOfs(2, fixvec);
- doVertexOfs(0, fixvec);
- EndPrimitive();
- }
-}
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_points_vert.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_points_vert.glsl
deleted file mode 100644
index 245cbab92d5..00000000000
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_points_vert.glsl
+++ /dev/null
@@ -1,51 +0,0 @@
-
-uniform mat3 NormalMatrix;
-uniform mat4 ProjectionMatrix;
-uniform mat4 ModelViewMatrix;
-uniform mat4 ModelViewProjectionMatrix;
-uniform float ofs = 3e-5;
-
-in vec3 pos;
-in ivec4 data;
-#ifdef VERTEX_FACING
-in vec3 vnor;
-#endif
-
-out vec4 finalColor;
-
-void main()
-{
- finalColor = colorVertex;
- finalColor = ((data.x & VERTEX_SELECTED) != 0) ? colorVertexSelect : finalColor;
- finalColor = ((data.x & VERTEX_ACTIVE) != 0) ? vec4(colorEditMeshActive.xyz, 1.0) : finalColor;
-
- gl_PointSize = sizeVertex * 2.0;
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
- gl_Position.z -= ofs * ((ProjectionMatrix[3][3] == 0.0) ? 1.0 : 0.0);
-
- /* Make selected and active vertex always on top. */
- if ((data.x & VERTEX_SELECTED) != 0) {
- gl_Position.z -= 1e-7;
- }
- if ((data.x & VERTEX_ACTIVE) != 0) {
- gl_Position.z -= 1e-7;
- }
-
-#ifdef VERTEX_FACING
- vec4 vPos = ModelViewMatrix * vec4(pos, 1.0);
- vec3 view_normal = normalize(NormalMatrix * vnor);
- vec3 view_vec = (ProjectionMatrix[3][3] == 0.0)
- ? normalize(vPos.xyz)
- : vec3(0.0, 0.0, 1.0);
- float facing = dot(view_vec, view_normal);
- facing = 1.0 - abs(facing) * 0.4;
-
- finalColor = mix(colorEditMeshMiddle, finalColor, facing);
- finalColor.a = 1.0;
-#endif
-
- if ((data.x & VERTEX_EXISTS) == 0) {
- gl_Position = vec4(0.0);
- gl_PointSize = 0.0;
- }
-}
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
index b78c7a7a476..982ef2ca801 100644
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
+++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
@@ -1,102 +1,100 @@
-/* Solid Wirefram implementation
- * Mike Erwin, Clément Foucault */
-
uniform mat3 NormalMatrix;
uniform mat4 ProjectionMatrix;
uniform mat4 ModelViewMatrix;
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
+uniform float faceAlphaMod;
uniform ivec4 dataMask = ivec4(0xFF);
+uniform float ofs;
+in ivec4 data;
in vec3 pos;
-#ifdef VERTEX_FACING
+#ifndef FACEDOT
in vec3 vnor;
+#else
+in vec4 norAndFlag;
+# define vnor norAndFlag.xyz
#endif
-#ifdef EDGE_FIX
-in ivec4 data;
-
-out vec4 pPos;
-out ivec4 vData;
-# ifdef VERTEX_FACING
-out float vFacing;
-# endif
+out vec4 finalColor;
+out vec4 finalColorOuter;
+#ifdef USE_GEOM_SHADER
+out int selectOveride;
+#endif
void main()
{
- pPos = ModelViewProjectionMatrix * vec4(pos, 1.0);
- vData = data & dataMask;
-# ifdef VERTEX_FACING
- vec4 vpos = ModelViewMatrix * vec4(pos, 1.0);
- vec3 view_normal = normalize(NormalMatrix * vnor);
- vec3 view_vec = (ProjectionMatrix[3][3] == 0.0)
- ? normalize(vpos.xyz)
- : vec3(0.0, 0.0, 1.0);
- vFacing = dot(view_vec, view_normal);
-# endif
-}
-
-#else /* EDGE_FIX */
-
-/* Consecutive data of the nth vertex.
- * Only valid for first vertex in the triangle.
- * Assuming GL_FRIST_VERTEX_CONVENTION. */
-in ivec4 data0;
-in ivec4 data1;
-in ivec4 data2;
-
-flat out vec3 edgesCrease;
-flat out vec3 edgesBweight;
-flat out vec4 faceColor;
-flat out ivec3 flag;
-# ifdef VERTEX_SELECTION
-out vec3 vertexColor;
-# endif
-# ifdef VERTEX_FACING
-out float facing;
-# endif
+#if !defined(FACE)
+ mat4 projmat = ProjectionMatrix;
+ projmat[3][2] -= ofs;
-out vec3 barycentric;
+ gl_Position = projmat * (ModelViewMatrix * vec4(pos, 1.0));
+#else
-void main()
-{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+#endif
+
+ ivec4 m_data = data & dataMask;
- int v_0 = (gl_VertexID / 3) * 3;
- int vidx = gl_VertexID % 3;
- barycentric = vec3(equal(ivec3(0, 1, 2), ivec3(vidx)));
-
- /* Edge */
- ivec4 vData[3] = ivec4[3](data0, data1, data2);
- ivec3 eflag;
- for (int v = 0; v < 3; ++v) {
- vData[v] = vData[v] & dataMask;
- flag[v] = eflag[v] = vData[v].y | (vData[v].x << 8);
- edgesCrease[v] = vData[v].z / 255.0;
- edgesBweight[v] = vData[v].w / 255.0;
+#if defined(VERT)
+ finalColor = EDIT_MESH_vertex_color(m_data.y);
+ gl_PointSize = sizeVertex * 2.0;
+ gl_Position.z -= 3e-5 * ((ProjectionMatrix[3][3] == 0.0) ? 1.0 : 0.0);
+ /* Make selected and active vertex always on top. */
+ if ((data.x & VERT_SELECTED) != 0) {
+ gl_Position.z -= 1e-7;
+ }
+ if ((data.x & VERT_ACTIVE) != 0) {
+ gl_Position.z -= 1e-7;
}
- /* Face */
- if ((vData[0].x & FACE_ACTIVE) != 0)
- faceColor = colorFaceSelect;
- else if ((vData[0].x & FACE_SELECTED) != 0)
- faceColor = colorFaceSelect;
- else if ((vData[0].x & FACE_FREESTYLE) != 0)
- faceColor = colorFaceFreestyle;
- else
- faceColor = colorFace;
-
-# ifdef VERTEX_SELECTION
- vertexColor = EDIT_MESH_vertex_color(data0.x).rgb;
+#elif defined(EDGE)
+# ifdef FLAT
+ finalColor = EDIT_MESH_edge_color_inner(m_data.y);
+ selectOveride = 1;
+# else
+ finalColor = EDIT_MESH_edge_vertex_color(m_data.y);
+ selectOveride = (m_data.y & EDGE_SELECTED);
# endif
-# ifdef VERTEX_FACING
- vec4 vPos = ModelViewMatrix * vec4(pos, 1.0);
- vec3 view_normal = normalize(NormalMatrix * vnor);
+
+ float crease = float(m_data.z) / 255.0;
+ float bweight = float(m_data.w) / 255.0;
+ finalColorOuter = EDIT_MESH_edge_color_outer(m_data.y, m_data.x, crease, bweight);
+
+#elif defined(FACE)
+ finalColor = EDIT_MESH_face_color(m_data.x);
+ finalColor.a *= faceAlphaMod;
+
+#elif defined(FACEDOT)
+ finalColor = EDIT_MESH_facedot_color(norAndFlag.w);
+ /* Bias Facedot Z position in clipspace. */
+ gl_Position.z -= 0.00035;
+ gl_PointSize = sizeFaceDot;
+
+#endif
+
+#if !defined(FACE) && !defined(EDGE_DECORATION)
+ /* Facing based color blend */
+ vec4 vpos = ModelViewMatrix * vec4(pos, 1.0);
+ vec3 view_normal = normalize(NormalMatrix * vnor + 1e-4);
vec3 view_vec = (ProjectionMatrix[3][3] == 0.0)
- ? normalize(vPos.xyz)
+ ? normalize(vpos.xyz)
: vec3(0.0, 0.0, 1.0);
- facing = dot(view_vec, view_normal);
+ float facing = dot(view_vec, view_normal);
+ facing = 1.0 - abs(facing) * 0.3;
+
+ finalColor = mix(colorEditMeshMiddle, finalColor, facing);
+ finalColor.a = 1.0;
+
+# if defined(EDGE) && !defined(FLAT)
+ /* Hack to blend color in pixel shader in case of overide. */
+ finalColor.a = facing;
# endif
-}
#endif
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
+}
diff --git a/source/blender/draw/modes/shaders/edit_normals_geom.glsl b/source/blender/draw/modes/shaders/edit_normals_geom.glsl
index d17823f2f5a..91a57a79eb0 100644
--- a/source/blender/draw/modes/shaders/edit_normals_geom.glsl
+++ b/source/blender/draw/modes/shaders/edit_normals_geom.glsl
@@ -7,9 +7,12 @@ flat in vec4 v2[1];
void main()
{
- gl_Position = v1[0];
- EmitVertex();
- gl_Position = v2[0];
- EmitVertex();
+ for (int v = 0; v < 2; v++) {
+ gl_Position = (v == 0) ? v1[0] : v2[0];
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[0].gl_ClipDistance);
+#endif
+ EmitVertex();
+ }
EndPrimitive();
}
diff --git a/source/blender/draw/modes/shaders/edit_normals_vert.glsl b/source/blender/draw/modes/shaders/edit_normals_vert.glsl
index 3ce7e618511..8d73a2f5ad2 100644
--- a/source/blender/draw/modes/shaders/edit_normals_vert.glsl
+++ b/source/blender/draw/modes/shaders/edit_normals_vert.glsl
@@ -2,6 +2,7 @@
uniform mat4 ModelViewProjectionMatrix;
uniform mat3 NormalMatrix;
uniform mat4 ProjectionMatrix;
+uniform mat4 ModelMatrix;
uniform float normalSize;
in vec3 pos;
@@ -27,4 +28,7 @@ void main()
v1 = ModelViewProjectionMatrix * vec4(pos, 1.0);
vec3 n = normalize(NormalMatrix * nor); /* viewspace */
v2 = v1 + ProjectionMatrix * vec4(n * normalSize, 0.0);
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/object_empty_axes_vert.glsl b/source/blender/draw/modes/shaders/object_empty_axes_vert.glsl
index 10e8805ef55..4aafceeb437 100644
--- a/source/blender/draw/modes/shaders/object_empty_axes_vert.glsl
+++ b/source/blender/draw/modes/shaders/object_empty_axes_vert.glsl
@@ -1,12 +1,14 @@
uniform mat4 ViewProjectionMatrix;
+uniform mat4 ModelMatrix;
+
uniform vec3 screenVecs[3];
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in float axis; /* position on the axis. [0.0-1.0] is X axis, [1.0-2.0] is Y, etc... */
in vec2 screenPos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in vec3 color;
in float size;
in mat4 InstanceModelMatrix;
@@ -23,7 +25,12 @@ void main()
/* Scale uniformly by axis length */
spos *= length(chosen_axis) * draw_size;
- gl_Position = ViewProjectionMatrix * vec4(wpos + spos, 1.0);
+ vec4 pos = vec4(wpos + spos, 1.0);
+ gl_Position = ViewProjectionMatrix * pos;
finalColor = vec4(color, 1.0);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * pos).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/object_empty_image_vert.glsl b/source/blender/draw/modes/shaders/object_empty_image_vert.glsl
index 1c1525696fb..e5ea42c0661 100644
--- a/source/blender/draw/modes/shaders/object_empty_image_vert.glsl
+++ b/source/blender/draw/modes/shaders/object_empty_image_vert.glsl
@@ -1,4 +1,5 @@
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
uniform float aspectX;
uniform float aspectY;
uniform float size;
@@ -20,9 +21,8 @@ out vec2 texCoord_interp;
void main()
{
- gl_Position = ModelViewProjectionMatrix * vec4(
- (pos + offset) * (size * vec2(aspectX, aspectY)),
- 0.0, 1.0);
+ vec4 pos_4d = vec4((pos + offset) * (size * vec2(aspectX, aspectY)), 0.0, 1.0);
+ gl_Position = ModelViewProjectionMatrix * pos_4d;
#ifdef USE_WIRE
gl_Position.z -= 1e-5;
finalColor = vec4(color, 1.0);
@@ -30,4 +30,8 @@ void main()
texCoord_interp = texCoord;
finalColor = objectColor;
#endif
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/object_grid_frag.glsl b/source/blender/draw/modes/shaders/object_grid_frag.glsl
index 35a95e809df..5a2913fc2e2 100644
--- a/source/blender/draw/modes/shaders/object_grid_frag.glsl
+++ b/source/blender/draw/modes/shaders/object_grid_frag.glsl
@@ -2,16 +2,18 @@
/* Infinite grid
* Author: Clément Foucault */
+/* We use the normalized local position to avoid precision
+ * loss during interpolation. */
+in vec3 local_pos;
+
out vec4 FragColor;
uniform mat4 ProjectionMatrix;
uniform vec3 cameraPos;
-uniform vec3 planeNormal;
uniform vec3 planeAxes;
uniform vec3 eye;
uniform vec4 gridSettings;
-uniform vec2 viewportSize;
-uniform vec4 screenvecs[3];
+uniform float meshSize;
uniform float lineKernel = 0.0;
uniform float gridOneOverLogSubdiv;
uniform sampler2D depthBuffer;
@@ -70,52 +72,11 @@ vec3 get_axes(vec3 co, vec3 fwidthCos, float line_size)
return 1.0 - smoothstep(GRID_LINE_SMOOTH_START, GRID_LINE_SMOOTH_END, axes_domain - (line_size + lineKernel));
}
-vec3 get_floor_pos(vec2 uv, out vec3 wPos)
-{
- vec3 camera_vec, camera_pos, corner_pos;
- vec3 floored_pos = planeAxes * floor(screenvecs[2].xyz);
- corner_pos = screenvecs[2].xyz - floored_pos;
-
- vec3 pixel_pos = corner_pos + uv.x * screenvecs[0].xyz + uv.y * screenvecs[1].xyz;
-
- /* if perspective */
- if (ProjectionMatrix[3][3] == 0.0) {
- camera_pos = cameraPos - floored_pos;
- camera_vec = normalize(pixel_pos - camera_pos);
- }
- else {
- camera_pos = pixel_pos;
- camera_vec = normalize(eye);
- }
-
- float plane_normal_dot_camera_vec = dot(planeNormal, camera_vec);
- float p = -dot(planeNormal, camera_pos);
- if (plane_normal_dot_camera_vec != 0) {
- p /= plane_normal_dot_camera_vec;
- }
- vec3 plane = camera_pos + camera_vec * p;
-
- /* fix residual imprecision */
- plane *= planeAxes;
-
- /* Recover non-offseted world position */
- wPos = plane + floored_pos;
-
- return plane;
-}
-
void main()
{
- vec2 sPos = gl_FragCoord.xy / viewportSize; /* Screen [0,1] position */
-
- /* To reduce artifacts, use a local version of the positions
- * to compute derivatives since they are not position dependent.
- * This gets rid of the blocky artifacts. Unfortunately we still
- * need the world position for the grid to scale properly from the origin. */
- vec3 gPos, wPos; /* Grid pos., World pos. */
- gPos = get_floor_pos(sPos, wPos);
-
- vec3 fwidthPos = fwidth(gPos);
+ vec3 wPos = local_pos * meshSize;
+ vec3 fwidthPos = fwidth(wPos);
+ wPos += cameraPos * planeAxes;
float dist, fade;
/* if persp */
@@ -228,7 +189,7 @@ void main()
/* Add a small bias so the grid will always
* be on top of a mesh with the same depth. */
float grid_depth = gl_FragCoord.z - 6e-8 - fwidth(gl_FragCoord.z);
- float scene_depth = texture(depthBuffer, sPos).r;
+ float scene_depth = texelFetch(depthBuffer, ivec2(gl_FragCoord.xy), 0).r;
if ((gridFlag & GRID_BACK) != 0) {
fade *= (scene_depth == 1.0) ? 1.0 : 0.0;
}
diff --git a/source/blender/draw/modes/shaders/object_grid_vert.glsl b/source/blender/draw/modes/shaders/object_grid_vert.glsl
index 15b37bb289d..1cf6c49b733 100644
--- a/source/blender/draw/modes/shaders/object_grid_vert.glsl
+++ b/source/blender/draw/modes/shaders/object_grid_vert.glsl
@@ -5,7 +5,9 @@
uniform mat4 ViewProjectionMatrix;
uniform mat4 ProjectionMatrix;
uniform vec3 cameraPos;
+uniform vec3 planeAxes;
uniform vec4 gridSettings;
+uniform float meshSize;
#define gridDistance gridSettings.x
#define gridResolution gridSettings.y
@@ -22,42 +24,36 @@ uniform int gridFlag;
in vec3 pos;
+out vec3 local_pos;
+
void main()
{
- vec3 vert_pos, proj_camera_pos;
+ vec3 vert_pos;
/* Project camera pos to the needed plane */
if ((gridFlag & PLANE_XY) != 0) {
vert_pos = vec3(pos.x, pos.y, 0.0);
- proj_camera_pos = vec3(cameraPos.x, cameraPos.y, 0.0);
}
else if ((gridFlag & PLANE_XZ) != 0) {
vert_pos = vec3(pos.x, 0.0, pos.y);
- proj_camera_pos = vec3(cameraPos.x, 0.0, cameraPos.z);
}
else {
vert_pos = vec3(0.0, pos.x, pos.y);
- proj_camera_pos = vec3(0.0, cameraPos.y, cameraPos.z);
}
- /* if persp */
- if (ProjectionMatrix[3][3] == 0.0) {
- vert_pos *= gridDistance * 2.0;
- }
- else {
- float viewdist = 1.0 / min(abs(ProjectionMatrix[0][0]), abs(ProjectionMatrix[1][1]));
- vert_pos *= viewdist * gridDistance * 2.0;
- }
+ local_pos = vert_pos;
- vec3 realPos = proj_camera_pos + vert_pos;
+ vec3 real_pos = cameraPos * planeAxes + vert_pos * meshSize;
/* Used for additional Z axis */
if ((gridFlag & CLIP_Z_POS) != 0) {
- realPos.z = clamp(realPos.z, 0.0, 1e30);
+ real_pos.z = clamp(real_pos.z, 0.0, 1e30);
+ local_pos.z = clamp(local_pos.z, 0.0, 1.0);
}
if ((gridFlag & CLIP_Z_NEG) != 0) {
- realPos.z = clamp(realPos.z, -1e30, 0.0);
+ real_pos.z = clamp(real_pos.z, -1e30, 0.0);
+ local_pos.z = clamp(local_pos.z, -1.0, 0.0);
}
- gl_Position = ViewProjectionMatrix * vec4(realPos, 1.0);
+ gl_Position = ViewProjectionMatrix * vec4(real_pos, 1.0);
}
diff --git a/source/blender/draw/modes/shaders/object_mball_handles_vert.glsl b/source/blender/draw/modes/shaders/object_mball_handles_vert.glsl
index b1c10feb62c..a2bd08be3c1 100644
--- a/source/blender/draw/modes/shaders/object_mball_handles_vert.glsl
+++ b/source/blender/draw/modes/shaders/object_mball_handles_vert.glsl
@@ -5,12 +5,13 @@
uniform mat4 ViewProjectionMatrix;
+uniform mat4 ModelMatrix;
uniform vec3 screen_vecs[2];
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec2 pos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat3x4 ScaleTranslationMatrix;
in float radius;
in vec3 color;
@@ -31,4 +32,8 @@ void main()
gl_Position = ViewProjectionMatrix * world_pos;
finalColor = vec4(color, 1.0);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * world_pos).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl b/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl
index dbf7f411a20..6545104c3c6 100644
--- a/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl
+++ b/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl
@@ -7,7 +7,7 @@ uniform usampler2D outlineId;
uniform sampler2D outlineDepth;
uniform sampler2D sceneDepth;
-uniform int idOffsets[3];
+uniform int idOffsets[4];
uniform float alphaOcclu;
uniform vec2 viewportSize;
@@ -23,6 +23,9 @@ vec4 convert_id_to_color(int id)
else if (id < idOffsets[2]) {
return colorSelect;
}
+ else if (id < idOffsets[3]) {
+ return colorDupliSelect;
+ }
else {
return colorTransform;
}
diff --git a/source/blender/draw/modes/shaders/object_outline_expand_frag.glsl b/source/blender/draw/modes/shaders/object_outline_expand_frag.glsl
index 7e288cde236..8b5603919c4 100644
--- a/source/blender/draw/modes/shaders/object_outline_expand_frag.glsl
+++ b/source/blender/draw/modes/shaders/object_outline_expand_frag.glsl
@@ -28,6 +28,20 @@ void main()
return;
}
+#ifdef LARGE_OUTLINE
+ if (!any(btests)) {
+ color[0] = texelFetchOffset(outlineColor, uv, 0, ivec2( 2, 0)).rgba;
+ color[1] = texelFetchOffset(outlineColor, uv, 0, ivec2( 0, 2)).rgba;
+ color[2] = texelFetchOffset(outlineColor, uv, 0, ivec2(-2, 0)).rgba;
+ color[3] = texelFetchOffset(outlineColor, uv, 0, ivec2( 0, -2)).rgba;
+
+ values = vec4(color[0].a, color[1].a, color[2].a, color[3].a);
+
+ tests = step(vec4(1e-6), values); /* (color.a != 0.0) */
+ btests = equal(tests, vec4(1.0));
+ }
+#endif
+
FragColor = (btests.x) ? color[0] : FragColor;
FragColor = (btests.y) ? color[1] : FragColor;
FragColor = (btests.z) ? color[2] : FragColor;
diff --git a/source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl b/source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl
index 1fa0a9137c0..36999267ef2 100644
--- a/source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl
+++ b/source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl
@@ -7,6 +7,14 @@ uniform mat4 ProjectionMatrix;
in vec4 pPos[];
in vec3 vPos[];
+void vert_from_gl_in(int v)
+{
+ gl_Position = pPos[v];
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[v].gl_ClipDistance);
+#endif
+}
+
void main()
{
bool is_persp = (ProjectionMatrix[3][3] == 0.0);
@@ -25,8 +33,9 @@ void main()
/* If both adjacent verts are facing the camera the same way,
* then it isn't an outline edge. */
- if (sign(fac0) == sign(fac3))
+ if (sign(fac0) == sign(fac3)) {
return;
+ }
/* Don't outline if concave edge. */
/* That would hide a lot of non useful edge but it flickers badly.
@@ -34,7 +43,11 @@ void main()
// if (dot(n0, v13) > 0.01)
// return;
- gl_Position = pPos[1]; EmitVertex();
- gl_Position = pPos[2]; EmitVertex();
+ vert_from_gl_in(1);
+ EmitVertex();
+
+ vert_from_gl_in(2);
+ EmitVertex();
+
EndPrimitive();
}
diff --git a/source/blender/draw/modes/shaders/object_outline_prepass_vert.glsl b/source/blender/draw/modes/shaders/object_outline_prepass_vert.glsl
index ba824a7c007..744bf0ff1e3 100644
--- a/source/blender/draw/modes/shaders/object_outline_prepass_vert.glsl
+++ b/source/blender/draw/modes/shaders/object_outline_prepass_vert.glsl
@@ -1,6 +1,7 @@
uniform mat4 ModelViewMatrix;
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
in vec3 pos;
@@ -13,4 +14,8 @@ void main()
pPos = ModelViewProjectionMatrix * vec4(pos, 1.0);
/* Small bias to always be on top of the geom. */
pPos.z -= 1e-3;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/object_particle_prim_vert.glsl b/source/blender/draw/modes/shaders/object_particle_prim_vert.glsl
index 54ae319307a..3df5115db76 100644
--- a/source/blender/draw/modes/shaders/object_particle_prim_vert.glsl
+++ b/source/blender/draw/modes/shaders/object_particle_prim_vert.glsl
@@ -39,12 +39,15 @@ void main()
}
#ifdef USE_AXIS
- if (axis == 0)
+ if (axis == 0) {
finalColor = vec4(1.0, 0.0, 0.0, 1.0);
- else if (axis == 1)
+ }
+ else if (axis == 1) {
finalColor = vec4(0.0, 1.0, 0.0, 1.0);
- else
+ }
+ else {
finalColor = vec4(0.0, 0.0, 1.0, 1.0);
+ }
#else
if (val < 0.0) {
finalColor = vec4(color, 1.0);
diff --git a/source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl b/source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl
index d8a72f28eee..f9f2679fe81 100644
--- a/source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl
+++ b/source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl
@@ -1,7 +1,13 @@
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
+
in vec3 pos;
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl b/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl
index cefd4eab2e3..1a984b2fbc6 100644
--- a/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl
+++ b/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl
@@ -1,41 +1,23 @@
+
uniform vec3 wireColor;
uniform vec3 rimColor;
+flat in float edgeSharpness;
in float facing;
-in vec3 barycentric;
-flat in vec3 edgeSharpness;
out vec4 fragColor;
-float max_v3(vec3 v) { return max(v.x, max(v.y, v.z)); }
-
-/* In pixels */
-uniform float wireSize = 0.0; /* Expands the core of the wire (part that is 100% wire color) */
-const float wire_smooth = 1.2; /* Smoothing distance after the 100% core. */
-
-/* Alpha constants could be exposed in the future. */
-const float front_alpha = 0.35;
-const float rim_alpha = 0.75;
-
void main()
{
- vec3 dx = dFdx(barycentric);
- vec3 dy = dFdy(barycentric);
- vec3 d = vec3(
- length(vec2(dx.x, dy.x)),
- length(vec2(dx.y, dy.y)),
- length(vec2(dx.z, dy.z))
- );
- vec3 dist_to_edge = barycentric / d;
-
- vec3 fac = abs(dist_to_edge);
-
- fac = smoothstep(wireSize + wire_smooth, wireSize, fac);
+ if (edgeSharpness < 0.0) {
+ discard;
+ }
- float facing_clamped = clamp((gl_FrontFacing) ? facing : -facing, 0.0, 1.0);
+ float facing_clamped = clamp(abs(facing), 0.0, 1.0);
- vec3 final_front_col = mix(rimColor, wireColor, 0.05);
- fragColor = mix(vec4(rimColor, rim_alpha), vec4(final_front_col, front_alpha), facing_clamped);
+ vec3 final_front_col = mix(rimColor, wireColor, 0.4);
+ vec3 final_rim_col = mix(rimColor, wireColor, 0.1);
- fragColor.a *= max_v3(fac * edgeSharpness);
+ fragColor.rgb = mix(final_rim_col, final_front_col, facing_clamped);
+ fragColor.a = 1.0f;
}
diff --git a/source/blender/draw/modes/shaders/overlay_face_wireframe_geom.glsl b/source/blender/draw/modes/shaders/overlay_face_wireframe_geom.glsl
index 9249b29436b..8f52c4fdf95 100644
--- a/source/blender/draw/modes/shaders/overlay_face_wireframe_geom.glsl
+++ b/source/blender/draw/modes/shaders/overlay_face_wireframe_geom.glsl
@@ -1,68 +1,60 @@
-/* This shader is only used for edge selection & sculpt mode wires (because of indexed drawing). */
+/* This shader is only used for edge selection and OSX workaround for large wires. */
-layout(triangles) in;
-#ifdef SELECT_EDGES
-layout(line_strip, max_vertices = 6) out;
-#else
-layout(triangle_strip, max_vertices = 3) out;
-#endif
+uniform float wireSize;
+uniform vec2 viewportSize;
+uniform vec2 viewportSizeInv;
+
+layout(lines) in;
+layout(triangle_strip, max_vertices = 4) out;
in float facing_g[];
in float edgeSharpness_g[];
#ifndef SELECT_EDGES
out float facing;
-out vec3 barycentric;
-flat out vec3 edgeSharpness;
+flat out float edgeSharpness;
#endif
-void main(void)
+void do_vertex(const int i, float coord, vec2 offset)
{
-#ifdef SELECT_EDGES
- const float edge_select_threshold = 0.3;
- if (edgeSharpness_g[0] > edge_select_threshold) {
- gl_Position = gl_in[0].gl_Position; EmitVertex();
- gl_Position = gl_in[1].gl_Position; EmitVertex();
- EndPrimitive();
- }
+#ifndef SELECT_EDGES
+ edgeSharpness = edgeSharpness_g[i];
+ facing = facing_g[i];
+#endif
+ gl_Position = gl_in[i].gl_Position;
+ /* Multiply offset by 2 because gl_Position range is [-1..1]. */
+ gl_Position.xy += offset * 2.0 * gl_Position.w;
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[i].gl_ClipDistance);
+#endif
+ EmitVertex();
+}
- if (edgeSharpness_g[1] > edge_select_threshold) {
- gl_Position = gl_in[1].gl_Position; EmitVertex();
- gl_Position = gl_in[2].gl_Position; EmitVertex();
- EndPrimitive();
- }
+void main()
+{
+ vec2 ss_pos[2];
+ ss_pos[0] = gl_in[0].gl_Position.xy / gl_in[0].gl_Position.w;
+ ss_pos[1] = gl_in[1].gl_Position.xy / gl_in[1].gl_Position.w;
- if (edgeSharpness_g[2] > edge_select_threshold) {
- gl_Position = gl_in[2].gl_Position; EmitVertex();
- gl_Position = gl_in[0].gl_Position; EmitVertex();
- EndPrimitive();
- }
-#else
- /* Originally was:
- * edgeSharpness = vec3(edgeSharpness_g[0], edgeSharpness_g[1], edgeSharpness_g[2]);
- *
- * But that strangely does not work for some AMD GPUs.
- * However since this code is currently only used for sculpt mode
- * and in this mode the `edgeSharpness_g` is not calculated,
- * let's simply set all to 1.0.
- */
- edgeSharpness = vec3(1.0);
+ vec2 line = ss_pos[0] - ss_pos[1];
+ line = abs(line) * viewportSize;
- barycentric = vec3(1.0, 0.0, 0.0);
- gl_Position = gl_in[0].gl_Position;
- facing = facing_g[0];
- EmitVertex();
+ float half_size = wireSize;
- barycentric = vec3(0.0, 1.0, 0.0);
- gl_Position = gl_in[1].gl_Position;
- facing = facing_g[1];
- EmitVertex();
+ vec3 edge_ofs = half_size * viewportSizeInv.xyy * vec3(1.0, 1.0, 0.0);
+
+ bool horizontal = line.x > line.y;
+ edge_ofs = (horizontal) ? edge_ofs.zyz : edge_ofs.xzz;
+
+ if (edgeSharpness_g[0] < 0.0) {
+ return;
+ }
+
+ do_vertex(0, half_size, edge_ofs.xy);
+ do_vertex(0, -half_size, -edge_ofs.xy);
+ do_vertex(1, half_size, edge_ofs.xy);
+ do_vertex(1, -half_size, -edge_ofs.xy);
- barycentric = vec3(0.0, 0.0, 1.0);
- gl_Position = gl_in[2].gl_Position;
- facing = facing_g[2];
- EmitVertex();
EndPrimitive();
-#endif /* SELECT_EDGES */
}
diff --git a/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl b/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl
index d5c2bdeefea..0424a49dd5d 100644
--- a/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl
+++ b/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl
@@ -1,81 +1,64 @@
-uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ProjectionMatrix;
+uniform mat4 ModelViewMatrix;
+uniform mat4 ModelMatrix;
uniform mat3 NormalMatrix;
-uniform vec2 wireStepParam;
+uniform float wireStepParam;
+uniform float ofs;
-vec3 get_edge_sharpness(vec3 wd)
-{
- bvec3 do_edge = greaterThan(wd, vec3(0.0));
- bvec3 force_edge = equal(wd, vec3(1.0));
- wd = clamp(wireStepParam.x * wd + wireStepParam.y, 0.0, 1.0);
- return clamp(wd * vec3(do_edge) + vec3(force_edge), 0.0, 1.0);
-}
+in vec3 pos;
+in vec3 nor;
+in float wd; /* wiredata */
+#ifndef USE_SCULPT
float get_edge_sharpness(float wd)
{
- bool do_edge = (wd > 0.0);
- bool force_edge = (wd == 1.0);
- wd = (wireStepParam.x * wd + wireStepParam.y);
- return clamp(wd * float(do_edge) + float(force_edge), 0.0, 1.0);
+ return ((wd == 0.0) ? -1.5 : wd) + wireStepParam;
}
+#else
+float get_edge_sharpness(float wd) { return 1.0; }
+#endif
/* Geometry shader version */
-#if defined(SELECT_EDGES) || defined(USE_SCULPT)
-
-in vec3 pos;
-in vec3 nor;
-in float wd; /* wiredata */
-
+#if defined(SELECT_EDGES) || defined(USE_GEOM)
out float facing_g;
out float edgeSharpness_g;
void main()
{
-# ifndef USE_SCULPT
edgeSharpness_g = get_edge_sharpness(wd);
-# else
- /* TODO approximation using normals. */
- edgeSharpness_g = 1.0;
-# endif
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+ mat4 projmat = ProjectionMatrix;
+ projmat[3][2] -= ofs;
+
+ gl_Position = projmat * (ModelViewMatrix * vec4(pos, 1.0));
facing_g = normalize(NormalMatrix * nor).z;
-}
-#else /* SELECT_EDGES */
-
-/* Consecutive pos of the nth vertex
- * Only valid for first vertex in the triangle.
- * Assuming GL_FRIST_VERTEX_CONVENTION. */
-in vec3 pos0;
-in vec3 pos1;
-in vec3 pos2;
-in float wd0; /* wiredata */
-in float wd1;
-in float wd2;
-in vec3 nor;
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
+}
+#else /* USE_GEOM */
out float facing;
-out vec3 barycentric;
-flat out vec3 edgeSharpness;
+flat out float edgeSharpness;
void main()
{
- int v_n = gl_VertexID % 3;
-
- barycentric = vec3(equal(ivec3(2, 0, 1), ivec3(v_n)));
+ edgeSharpness = get_edge_sharpness(wd);
- vec3 wb = vec3(wd0, wd1, wd2);
- edgeSharpness = get_edge_sharpness(wb);
+ mat4 projmat = ProjectionMatrix;
+ projmat[3][2] -= ofs;
- /* Don't generate any fragment if there is no edge to draw. */
- vec3 pos = (!any(greaterThan(edgeSharpness, vec3(0.04))) && (v_n == 0)) ? pos1 : pos0;
-
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+ gl_Position = projmat * (ModelViewMatrix * vec4(pos, 1.0));
facing = normalize(NormalMatrix * nor).z;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
#endif /* SELECT_EDGES */
diff --git a/source/blender/draw/modes/shaders/paint_face_vert.glsl b/source/blender/draw/modes/shaders/paint_face_vert.glsl
index 437eeb28118..a850a130955 100644
--- a/source/blender/draw/modes/shaders/paint_face_vert.glsl
+++ b/source/blender/draw/modes/shaders/paint_face_vert.glsl
@@ -1,5 +1,6 @@
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
in vec3 pos;
in vec4 nor; /* select flag on the 4th component */
@@ -11,4 +12,9 @@ void main()
if (nor.w > 0.0) {
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
}
+ else {
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
+ }
}
diff --git a/source/blender/draw/modes/shaders/paint_texture_frag.glsl b/source/blender/draw/modes/shaders/paint_texture_frag.glsl
index 4305e20ce7b..68fd1be0886 100644
--- a/source/blender/draw/modes/shaders/paint_texture_frag.glsl
+++ b/source/blender/draw/modes/shaders/paint_texture_frag.glsl
@@ -4,8 +4,14 @@ out vec4 fragColor;
uniform sampler2D image;
uniform float alpha = 1.0;
+uniform bool nearestInterp;
void main()
{
- fragColor = vec4(texture(image, uv_interp).rgb, alpha);
+ vec2 uv = uv_interp;
+ if (nearestInterp) {
+ vec2 tex_size = vec2(textureSize(image, 0).xy);
+ uv = (floor(uv_interp * tex_size) + 0.5) / tex_size;
+ }
+ fragColor = vec4(texture(image, uv).rgb, alpha);
}
diff --git a/source/blender/draw/modes/shaders/paint_texture_vert.glsl b/source/blender/draw/modes/shaders/paint_texture_vert.glsl
index 8eae494cc35..c53439f46a0 100644
--- a/source/blender/draw/modes/shaders/paint_texture_vert.glsl
+++ b/source/blender/draw/modes/shaders/paint_texture_vert.glsl
@@ -1,5 +1,6 @@
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
in vec2 u; /* active uv map */
in vec3 pos;
@@ -11,4 +12,8 @@ void main()
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
uv_interp = u;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/paint_vert_frag.glsl b/source/blender/draw/modes/shaders/paint_vert_frag.glsl
index d7f604d5c2c..3042ddf9770 100644
--- a/source/blender/draw/modes/shaders/paint_vert_frag.glsl
+++ b/source/blender/draw/modes/shaders/paint_vert_frag.glsl
@@ -2,16 +2,11 @@
flat in vec4 finalColor;
out vec4 fragColor;
-#define VERTEX_SELECTED (1 << 0)
-#define VERTEX_HIDE (1 << 4)
-
void main()
{
vec2 centered = gl_PointCoord - vec2(0.5);
float dist_squared = dot(centered, centered);
const float rad_squared = 0.25;
- const vec4 colSel = vec4(1.0, 1.0, 1.0, 1.0);
- const vec4 colUnsel = vec4(0.0, 0.0, 0.0, 1.0);
// round point with jaggy edges
if (dist_squared > rad_squared) {
diff --git a/source/blender/draw/modes/shaders/paint_vertex_frag.glsl b/source/blender/draw/modes/shaders/paint_vertex_frag.glsl
index 3ff264a5e22..6dd97b36ee7 100644
--- a/source/blender/draw/modes/shaders/paint_vertex_frag.glsl
+++ b/source/blender/draw/modes/shaders/paint_vertex_frag.glsl
@@ -4,7 +4,7 @@ in vec3 finalColor;
out vec4 fragColor;
uniform float white_factor = 1.0;
-vec3 linear_to_srgb_attrib(vec3 c) {
+vec3 linear_to_srgb_attr(vec3 c) {
c = max(c, vec3(0.0));
vec3 c1 = c * 12.92;
vec3 c2 = 1.055 * pow(c, vec3(1.0 / 2.4)) - 0.055;
@@ -13,6 +13,6 @@ vec3 linear_to_srgb_attrib(vec3 c) {
void main()
{
- fragColor.rgb = mix(linear_to_srgb_attrib(finalColor), vec3(1.0), white_factor);
+ fragColor.rgb = mix(linear_to_srgb_attr(finalColor), vec3(1.0), white_factor);
fragColor.a = 1.0;
}
diff --git a/source/blender/draw/modes/shaders/paint_vertex_vert.glsl b/source/blender/draw/modes/shaders/paint_vertex_vert.glsl
index e52c17e52d5..39f59a29756 100644
--- a/source/blender/draw/modes/shaders/paint_vertex_vert.glsl
+++ b/source/blender/draw/modes/shaders/paint_vertex_vert.glsl
@@ -1,12 +1,13 @@
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
in vec3 pos;
in vec3 c; /* active color */
out vec3 finalColor;
-vec3 srgb_to_linear_attrib(vec3 c) {
+vec3 srgb_to_linear_attr(vec3 c) {
c = max(c, vec3(0.0));
vec3 c1 = c * (1.0 / 12.92);
vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
@@ -17,5 +18,9 @@ void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
- finalColor = srgb_to_linear_attrib(c);
+ finalColor = srgb_to_linear_attr(c);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/paint_weight_frag.glsl b/source/blender/draw/modes/shaders/paint_weight_frag.glsl
index faa36f5535e..7460eabedbe 100644
--- a/source/blender/draw/modes/shaders/paint_weight_frag.glsl
+++ b/source/blender/draw/modes/shaders/paint_weight_frag.glsl
@@ -18,15 +18,17 @@ float contours(float value, float steps, float width_px, float max_rel_width, fl
/* Don't draw lines at 0 or 1. */
float rel_value = value * steps;
- if (rel_value < 0.5 || rel_value > steps - 0.5)
+ if (rel_value < 0.5 || rel_value > steps - 0.5) {
return 0.0;
+ }
/* Check if completely invisible due to fade out. */
float rel_gradient = gradient * steps;
float rel_min_width = min_width_px * rel_gradient;
- if (max_rel_width <= rel_min_width)
+ if (max_rel_width <= rel_min_width) {
return 0.0;
+ }
/* Main shape of the line, accounting for width bias and maximum weight space width. */
float rel_width = width_px * rel_gradient;
@@ -48,8 +50,9 @@ vec4 contour_grid(float weight, float weight_gradient)
/* Fade away when the gradient is too low to avoid big fills and noise. */
float flt_eps = max(1e-8, 1e-6 * weight);
- if (weight_gradient <= flt_eps)
+ if (weight_gradient <= flt_eps) {
return vec4(0.0);
+ }
/* Three levels of grid lines */
float grid10 = contours(weight, 10.0, 5.0, 0.3, weight_gradient);
diff --git a/source/blender/draw/modes/shaders/paint_weight_vert.glsl b/source/blender/draw/modes/shaders/paint_weight_vert.glsl
index 78a3695c82c..d111f3dc0a8 100644
--- a/source/blender/draw/modes/shaders/paint_weight_vert.glsl
+++ b/source/blender/draw/modes/shaders/paint_weight_vert.glsl
@@ -1,5 +1,6 @@
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
in float weight;
in vec3 pos;
@@ -12,4 +13,8 @@ void main()
/* Separate actual weight and alerts for independent interpolation */
weight_interp = max(vec2(weight, -weight), 0.0);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/paint_wire_vert.glsl b/source/blender/draw/modes/shaders/paint_wire_vert.glsl
index b5ef921b8dc..b415be7841c 100644
--- a/source/blender/draw/modes/shaders/paint_wire_vert.glsl
+++ b/source/blender/draw/modes/shaders/paint_wire_vert.glsl
@@ -1,5 +1,6 @@
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
in vec3 pos;
in vec4 nor; /* flag stored in w */
@@ -8,12 +9,17 @@ flat out vec4 finalColor;
void main()
{
+#ifdef USE_SELECT
bool is_select = (nor.w > 0.0);
bool is_hidden = (nor.w < 0.0);
+#else
+ bool is_select = false;
+ bool is_hidden = false;
+#endif
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
/* Add offset in Z to avoid zfighting and render selected wires on top. */
/* TODO scale this bias using znear and zfar range. */
- gl_Position.zw -= exp2(-20.0) * (is_select ? 2.0 : 1.0);
+ gl_Position.z -= (is_select ? 2e-4 : 1e-4);
if (is_hidden) {
gl_Position = vec4(-2.0, -2.0, -2.0, 1.0);
@@ -26,6 +32,20 @@ void main()
const vec4 colSel = vec4(1.0, 1.0, 1.0, 1.0);
#endif
+#ifdef USE_SELECT
finalColor = (is_select) ? colSel : colorWire;
+#else
+# ifdef VERTEX_MODE
+ finalColor = colorWire;
+# else
+ /* Weight paint needs a light color to contrasts with dark weights. */
+ finalColor.xyz = vec3(0.8, 0.8, 0.8);
+# endif
+#endif
+
finalColor.a = nor.w;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl b/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl
index e76d21eb43a..553a49f38df 100644
--- a/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl
+++ b/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl
@@ -4,11 +4,7 @@ uniform mat4 ModelViewProjectionMatrix;
in vec3 pos;
in float msk;
-#ifdef SHADE_FLAT
-flat out vec4 finalColor;
-#else
out vec4 finalColor;
-#endif
void main()
{
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index cf1db751c85..3b06e1784e6 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
if(WITH_BLENDER)
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index 13432e38669..933b4815175 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index c00b1a4d2fa..d1cef1cfa17 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_channels_defines.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -48,7 +42,7 @@
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_mesh_types.h"
@@ -82,8 +76,6 @@
#include "ED_anim_api.h"
#include "ED_keyframing.h"
-#include "BIF_gl.h"
-
#include "WM_api.h"
#include "WM_types.h"
@@ -175,9 +167,9 @@ static bool acf_show_channel_colors(bAnimContext *ac)
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
showGroupColors = !(sipo->flag & SIPO_NODRAWGCOLORS);
break;
@@ -542,7 +534,7 @@ static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale)
/* visible only in Graph Editor */
case ACHANNEL_SETTING_VISIBLE:
- return ((ac) && (ac->spacetype == SPACE_IPO));
+ return ((ac) && (ac->spacetype == SPACE_GRAPH));
/* only select and expand supported otherwise */
case ACHANNEL_SETTING_SELECT:
@@ -702,7 +694,7 @@ static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnim
/* visible only in Graph Editor */
case ACHANNEL_SETTING_VISIBLE:
- return ((ac) && (ac->spacetype == SPACE_IPO) && (ob->adt));
+ return ((ac) && (ac->spacetype == SPACE_GRAPH) && (ob->adt));
/* only select and expand supported otherwise */
case ACHANNEL_SETTING_SELECT:
@@ -710,7 +702,7 @@ static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnim
return true;
case ACHANNEL_SETTING_ALWAYS_VISIBLE:
- return ((ac) && (ac->spacetype == SPACE_IPO) && (ob->adt));
+ return ((ac) && (ac->spacetype == SPACE_GRAPH) && (ob->adt));
default:
return false;
@@ -870,10 +862,10 @@ static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale)
/* conditionally supported */
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
- return (ac->spacetype == SPACE_IPO);
+ return (ac->spacetype == SPACE_GRAPH);
case ACHANNEL_SETTING_ALWAYS_VISIBLE:
- return (ac->spacetype == SPACE_IPO);
+ return (ac->spacetype == SPACE_GRAPH);
default: /* always supported */
return true;
@@ -896,7 +888,7 @@ static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings settin
* allowing different collapsing of groups there, since sharing the flag
* proved to be a hazard for workflows...
*/
- return (ac->spacetype == SPACE_IPO) ?
+ return (ac->spacetype == SPACE_GRAPH) ?
AGRP_EXPANDED_G : /* Graph Editor case */
AGRP_EXPANDED; /* DopeSheet and elsewhere */
}
@@ -1002,7 +994,7 @@ static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnim
return false; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
- return (ac->spacetype == SPACE_IPO);
+ return (ac->spacetype == SPACE_GRAPH);
case ACHANNEL_SETTING_ALWAYS_VISIBLE:
return false;
@@ -1491,7 +1483,7 @@ static int acf_dslight_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setti
/* get pointer to the setting */
static void *acf_dslight_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
- Lamp *la = (Lamp *)ale->data;
+ Light *la = (Light *)ale->data;
/* clear extra return data first */
*type = 0;
@@ -1512,7 +1504,7 @@ static void *acf_dslight_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings s
}
}
-/* lamp expander type define */
+/* light expander type define */
static bAnimChannelType ACF_DSLIGHT =
{
"Light Expander", /* type name */
@@ -2036,7 +2028,7 @@ static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- return 0;
+ return PART_DS_EXPAND;
case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
return ADT_NLA_EVAL_OFF;
@@ -2054,18 +2046,22 @@ static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
}
/* get pointer to the setting */
-static void *acf_dspart_setting_ptr(bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting, short *type)
+static void *acf_dspart_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
{
+ ParticleSettings *part = (ParticleSettings *)ale->data;
+
/* clear extra return data first */
*type = 0;
switch (setting) {
case ACHANNEL_SETTING_EXPAND: /* expanded */
- return NULL;
+ 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)
+ return GET_ACF_FLAG_PTR(part->adt->flag, type);
return NULL;
default: /* unsupported */
@@ -3531,7 +3527,8 @@ static bAnimChannelType ACF_NLAACTION =
"NLA Active Action", /* type name */
ACHANNEL_ROLE_CHANNEL, /* role */
- acf_nlaaction_color, /* backdrop color (NOTE: the backdrop handles this too, since it needs special hacks) */
+ acf_nlaaction_color, /* backdrop color (NOTE: the backdrop handles this too,
+ * since it needs special hacks) */
acf_nlaaction_backdrop, /* backdrop */
acf_generic_indention_flexible, /* indent level */
acf_generic_group_offset, /* offset */ // XXX?
@@ -3864,7 +3861,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
* - in Grease Pencil mode, color swatches for layer color
*/
if (ac->sl) {
- if ((ac->spacetype == SPACE_IPO) &&
+ if ((ac->spacetype == SPACE_GRAPH) &&
(acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE) ||
acf->has_setting(ac, ale, ACHANNEL_SETTING_ALWAYS_VISIBLE)))
{
@@ -3964,7 +3961,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
immUniformColor3fv(color);
/* check if we need to show the sliders */
- if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_IPO)) {
+ if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_GRAPH)) {
switch (ac->spacetype) {
case SPACE_ACTION:
{
@@ -3972,9 +3969,9 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
draw_sliders = (saction->flag & SACTION_SLIDERS);
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
draw_sliders = (sipo->flag & SIPO_SLIDERS);
break;
}
@@ -4064,7 +4061,7 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
/* tag copy-on-write flushing (so that the settings will have an effect) */
if (ale_setting->id) {
- DEG_id_tag_update(ale_setting->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_id_tag_update(ale_setting->id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
}
if (ale_setting->adt && ale_setting->adt->action) {
/* action is it's own datablock, so has to be tagged specifically... */
@@ -4113,7 +4110,7 @@ static void achannel_nlatrack_solo_widget_cb(bContext *C, void *ale_poin, void *
/* send notifiers */
DEG_id_tag_update(ale->id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
- WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_RENAME, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
}
/* callback for widget sliders - insert keyframes */
@@ -4413,13 +4410,20 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
break;
/* no flushing */
- case ACHANNEL_SETTING_EXPAND: /* expanding - cannot flush, otherwise all would open/close at once */
+ case ACHANNEL_SETTING_EXPAND: /* expanding - cannot flush,
+ * otherwise all would open/close at once */
default:
UI_but_func_set(but, achannel_setting_widget_cb, NULL, NULL);
break;
}
}
}
+
+ if ((ale->fcurve_owner_id != NULL && ID_IS_LINKED(ale->fcurve_owner_id)) ||
+ (ale->id != NULL && ID_IS_LINKED(ale->id)))
+ {
+ UI_but_flag_enable(but, UI_BUT_DISABLED);
+ }
}
/* Draw UI widgets the given channel */
@@ -4467,7 +4471,7 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
* - in Grease Pencil mode, color swatches for layer color
*/
if (ac->sl) {
- if ((ac->spacetype == SPACE_IPO) &&
+ if ((ac->spacetype == SPACE_GRAPH) &&
(acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE) ||
acf->has_setting(ac, ale, ACHANNEL_SETTING_ALWAYS_VISIBLE)))
{
@@ -4564,7 +4568,7 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
short draw_sliders = 0;
/* check if we need to show the sliders */
- if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_IPO)) {
+ if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_GRAPH)) {
switch (ac->spacetype) {
case SPACE_ACTION:
{
@@ -4572,9 +4576,9 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
draw_sliders = (saction->flag & SACTION_SLIDERS);
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
draw_sliders = (sipo->flag & SIPO_SLIDERS);
break;
}
@@ -4601,7 +4605,8 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
/* modifiers disable */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MOD_OFF)) {
- offset += ICON_WIDTH * 1.2f; /* hack: extra spacing, to avoid touching the mute toggle */
+ /* hack: extra spacing, to avoid touching the mute toggle */
+ offset += ICON_WIDTH * 1.2f;
draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_MOD_OFF);
}
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 26de5c3afc8..3bcbe2d99e3 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_channels_edit.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -670,7 +664,7 @@ static bool animedit_poll_channels_active(bContext *C)
if (ELEM(NULL, sa, CTX_wm_region(C)))
return 0;
/* animation editor test */
- if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA) == 0)
+ if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_GRAPH, SPACE_NLA) == 0)
return 0;
return 1;
@@ -687,7 +681,7 @@ static bool animedit_poll_channels_nla_tweakmode_off(bContext *C)
if (ELEM(NULL, sa, CTX_wm_region(C)))
return 0;
/* animation editor test */
- if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA) == 0)
+ if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_GRAPH, SPACE_NLA) == 0)
return 0;
/* NLA TweakMode test */
@@ -707,7 +701,7 @@ typedef enum eRearrangeAnimChan_Mode {
REARRANGE_ANIMCHAN_TOP = -2,
REARRANGE_ANIMCHAN_UP = -1,
REARRANGE_ANIMCHAN_DOWN = 1,
- REARRANGE_ANIMCHAN_BOTTOM = 2
+ REARRANGE_ANIMCHAN_BOTTOM = 2,
} eRearrangeAnimChan_Mode;
/* defines for rearranging channels */
@@ -716,7 +710,7 @@ static const EnumPropertyItem prop_animchannel_rearrange_types[] = {
{REARRANGE_ANIMCHAN_UP, "UP", 0, "Up", ""},
{REARRANGE_ANIMCHAN_DOWN, "DOWN", 0, "Down", ""},
{REARRANGE_ANIMCHAN_BOTTOM, "BOTTOM", 0, "To Bottom", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Reordering "Islands" Defines ----------------------------------- */
@@ -881,7 +875,8 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr
Link *channel, eAnim_ChannelType type,
const bool is_hidden)
{
- tReorderChannelIsland *island = islands->last; /* always try to add to last island if possible */
+ /* always try to add to last island if possible */
+ tReorderChannelIsland *island = islands->last;
bool is_sel = false, is_untouchable = false;
/* get flags - selected and untouchable from the channel */
@@ -1355,6 +1350,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
switch (ac.datatype) {
case ANIMCONT_NLA: /* NLA-tracks only */
rearrange_nla_channels(&ac, adt, mode);
+ DEG_id_tag_update(ale->id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
break;
case ANIMCONT_DRIVERS: /* Drivers list only */
@@ -1442,9 +1438,9 @@ static bool animchannels_grouping_poll(bContext *C)
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ SpaceGraph *sipo = (SpaceGraph *)sl;
/* drivers can't have groups... */
if (sipo->mode != SIPO_MODE_ANIMATION)
@@ -1560,7 +1556,8 @@ static void ANIM_OT_channels_group(wmOperatorType *ot)
ot->prop = RNA_def_string(ot->srna, "name", "New Group",
sizeof(((bActionGroup *)NULL)->name),
"Name", "Name of newly created group");
- /* RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE); */ /* XXX: still not too sure about this - keeping same text is confusing... */
+ /* XXX: still not too sure about this - keeping same text is confusing... */
+ // RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
}
/* ----------------------------------------------------------- */
@@ -1629,6 +1626,27 @@ static void ANIM_OT_channels_ungroup(wmOperatorType *ot)
/* ******************** Delete Channel Operator *********************** */
+static void update_dependencies_on_delete(bAnimListElem *ale)
+{
+ ID *id = ale->id;
+ AnimData *adt = BKE_animdata_from_id(id);
+ /* TODO(sergey): Technically, if the animation element is being deleted
+ * from a driver we don't have to tag action. This is something we can check
+ * for in the future. For now just do most reliable tag whic hwas always
+ * happening. */
+ if (adt != NULL) {
+ DEG_id_tag_update(id, ID_RECALC_ANIMATION);
+ if (adt->action != NULL) {
+ DEG_id_tag_update(&adt->action->id, ID_RECALC_COPY_ON_WRITE);
+ }
+ }
+ /* Deals with NLA and drivers.
+ * Doesn't cause overhead for action updates, since object will receive
+ * animation update after dependency graph flushes update from action to
+ * all its users. */
+ DEG_id_tag_update(id, ID_RECALC_ANIMATION);
+}
+
static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
@@ -1701,7 +1719,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* try to free F-Curve */
ANIM_fcurve_delete_from_animdata(&ac, adt, fcu);
- ale->update = ANIM_UPDATE_DEPS;
+ update_dependencies_on_delete(ale);
break;
}
case ANIMTYPE_NLACURVE:
@@ -1723,7 +1741,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* unlink and free the F-Curve */
BLI_remlink(&strip->fcurves, fcu);
free_fcurve(fcu);
- ale->update = ANIM_UPDATE_DEPS;
+ update_dependencies_on_delete(ale);
break;
}
case ANIMTYPE_GPLAYER:
@@ -1751,7 +1769,6 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
}
/* cleanup */
- ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
/* send notifier that things have changed */
@@ -1784,7 +1801,7 @@ static const EnumPropertyItem prop_animchannel_setflag_types[] = {
{ACHANNEL_SETFLAG_CLEAR, "DISABLE", 0, "Disable", ""},
{ACHANNEL_SETFLAG_ADD, "ENABLE", 0, "Enable", ""},
{ACHANNEL_SETFLAG_INVERT, "INVERT", 0, "Invert", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* defines for set animation-channel settings */
@@ -1792,7 +1809,7 @@ static const EnumPropertyItem prop_animchannel_setflag_types[] = {
static const EnumPropertyItem prop_animchannel_settings_types[] = {
{ACHANNEL_SETTING_PROTECT, "PROTECT", 0, "Protect", ""},
{ACHANNEL_SETTING_MUTE, "MUTE", 0, "Mute", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -1828,7 +1845,7 @@ static void setflag_anim_channels(bAnimContext *ac, eAnimChannel_Settings settin
* - but for Graph Editor, this gets used also from main region
* where hierarchy doesn't apply [#21276]
*/
- if ((ac->spacetype == SPACE_IPO) && (ac->regiontype != RGN_TYPE_CHANNELS)) {
+ if ((ac->spacetype == SPACE_GRAPH) && (ac->regiontype != RGN_TYPE_CHANNELS)) {
/* graph editor (case 2) */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
}
@@ -2207,7 +2224,7 @@ static bool animchannels_enable_poll(bContext *C)
return 0;
/* animation editor test - Action/Dopesheet/etc. and Graph only */
- if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO) == 0)
+ if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_GRAPH) == 0)
return 0;
return 1;
@@ -2279,7 +2296,7 @@ static bool animchannels_find_poll(bContext *C)
return 0;
/* animation editor with dopesheet */
- return ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA);
+ return ELEM(sa->spacetype, SPACE_ACTION, SPACE_GRAPH, SPACE_NLA);
}
/* find_invoke() - Get initial channels */
@@ -2738,7 +2755,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
/* ensure we exit editmode on whatever object was active before to avoid getting stuck there - T48747 */
if (ob != CTX_data_edit_object(C)) {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
@@ -2947,7 +2964,8 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
BKE_gpencil_layer_setactive(gpd, gpl);
}
- WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED | ND_SPACE_PROPERTIES, NULL); /* Grease Pencil updates */
+ /* Grease Pencil updates */
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED | ND_SPACE_PROPERTIES, NULL);
notifierFlags |= (ND_ANIMCHAN | NA_EDITED); /* Animation Editors updates */
break;
}
@@ -3017,17 +3035,24 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmE
v2d = &ar->v2d;
/* select mode is either replace (deselect all, then add) or add/extend */
- if (RNA_boolean_get(op->ptr, "extend"))
+ if (RNA_boolean_get(op->ptr, "extend")) {
selectmode = SELECT_INVERT;
- else if (RNA_boolean_get(op->ptr, "children_only"))
- selectmode = -1; /* this is a bit of a special case for ActionGroups only... should it be removed or extended to all instead? */
- else
+ }
+ else if (RNA_boolean_get(op->ptr, "children_only")) {
+ /* this is a bit of a special case for ActionGroups only...
+ * should it be removed or extended to all instead? */
+ selectmode = -1;
+ }
+ else {
selectmode = SELECT_REPLACE;
+ }
/* figure out which channel user clicked in
- * Note: although channels technically start at (y = ACHANNEL_FIRST), we need to adjust by half a channel's height
- * so that the tops of channels get caught ok. Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use
- * ACHANNEL_HEIGHT_HALF.
+ *
+ * Note:
+ * although channels technically start at (y = ACHANNEL_FIRST),
+ * we need to adjust by half a channel's height so that the tops of channels get caught ok.
+ * Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use ACHANNEL_HEIGHT_HALF.
*/
UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP(&ac), 0, (float)ACHANNEL_HEIGHT_HALF(&ac), x, y, NULL, &channel_index);
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index b69d93aaacf..7bef42d8682 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_deps.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -77,7 +70,6 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale)
/* tag AnimData for refresh so that other views will update in realtime with these changes */
adt = BKE_animdata_from_id(id);
if (adt) {
- adt->recalc |= ADT_RECALC_ANIM;
DEG_id_tag_update(id, ID_RECALC_ANIMATION);
if (adt->action != NULL) {
DEG_id_tag_update(&adt->action->id, ID_RECALC_COPY_ON_WRITE);
@@ -117,13 +109,6 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale)
void ANIM_id_update(Main *bmain, ID *id)
{
if (id) {
- AnimData *adt = BKE_animdata_from_id(id);
-
- /* tag AnimData for refresh so that other views will update in realtime with these changes */
- if (adt)
- adt->recalc |= ADT_RECALC_ANIM;
-
- /* set recalc flags */
DEG_id_tag_update_ex(bmain, id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); // XXX or do we want something more restrictive?
}
}
@@ -199,7 +184,7 @@ static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGro
}
/* perform syncing updates for F-Curves */
-static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **active_fcurve)
+static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale, FCurve **active_fcurve)
{
FCurve *fcu = (FCurve *)ale->data;
ID *owner_id = ale->id;
@@ -210,50 +195,7 @@ static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **
if (ELEM(NULL, fcu, fcu->rna_path, owner_id))
return;
- if (GS(owner_id->name) == ID_OB) {
- Object *ob = (Object *)owner_id;
-
- /* only affect if F-Curve involves pose.bones */
- if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones")) {
- bArmature *arm = (bArmature *)ob->data;
- bPoseChannel *pchan;
- char *bone_name;
-
- /* get bone-name, and check if this bone is selected */
- bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
- pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
- if (bone_name) MEM_freeN(bone_name);
-
- /* F-Curve selection depends on whether the bone is selected */
- if ((pchan) && (pchan->bone)) {
- /* F-Curve selection */
- if (pchan->bone->flag & BONE_SELECTED)
- fcu->flag |= FCURVE_SELECTED;
- else
- fcu->flag &= ~FCURVE_SELECTED;
-
- /* Active F-Curve - it should be the first one for this bone on the
- * active object to be considered as active
- */
- if ((ob == ac->obact) && (pchan->bone == arm->act_bone)) {
- /* if no previous F-Curve has active flag, then we're the first and only one to get it */
- if (*active_fcurve == NULL) {
- fcu->flag |= FCURVE_ACTIVE;
- *active_fcurve = fcu;
- }
- else {
- /* someone else has already taken it - set as not active */
- fcu->flag &= ~FCURVE_ACTIVE;
- }
- }
- else {
- /* this can't possibly be active now */
- fcu->flag &= ~FCURVE_ACTIVE;
- }
- }
- }
- }
- else if (GS(owner_id->name) == ID_SCE) {
+ if (GS(owner_id->name) == ID_SCE) {
Scene *scene = (Scene *)owner_id;
/* only affect if F-Curve involves sequence_editor.sequences */
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 239ab5f8206..2b168aa9463 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_draw.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
#include "BLI_sys_types.h"
@@ -175,7 +168,8 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShadeAlpha(TH_ANIM_PREVIEW_RANGE, -25, -30);
- //immUniformColor4f(0.8f, 0.44f, 0.1f, 0.2f); /* XXX: Fix this hardcoded color (anim_active) */
+ /* XXX: Fix this hardcoded color (anim_active) */
+ //immUniformColor4f(0.8f, 0.44f, 0.1f, 0.2f);
/* only draw two separate 'curtains' if there's no overlap between them */
if (PSFRA < PEFRA + end_frame_width) {
@@ -285,7 +279,8 @@ static short bezt_nlamapping_restore(KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
-/* helper function for ANIM_nla_mapping_apply_fcurve() -> "apply", i.e. mapping points to NLA-mapped global time */
+/* helper function for ANIM_nla_mapping_apply_fcurve() -> "apply",
+ * i.e. mapping points to NLA-mapped global time */
static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt)
{
/* AnimData block providing scaling is stored in 'data', only_keys option is stored in i1 */
@@ -336,8 +331,8 @@ void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, boo
/* Get flags used for normalization in ANIM_unit_mapping_get_factor. */
short ANIM_get_normalization_flags(bAnimContext *ac)
{
- if (ac->sl->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = (SpaceIpo *) ac->sl;
+ if (ac->sl->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = (SpaceGraph *) ac->sl;
bool use_normalization = (sipo->flag & SIPO_NORMALIZE) != 0;
bool freeze_normalization = (sipo->flag & SIPO_NORMALIZE_FREEZE) != 0;
return use_normalization
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 1567c72c2b2..af2037ef376 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (original author)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_filter.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -54,7 +47,7 @@
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_cachefile_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_key_types.h"
@@ -119,7 +112,7 @@ static void animedit_get_yscale_factor(bAnimContext *ac)
* NOTE: This theme setting doesn't have an ID, as it cannot be accessed normally
* since it is a float, and the theme settings methods can only handle chars.
*/
- ac->yscale_fac = btheme->tact.keyframe_scale_fac;
+ ac->yscale_fac = btheme->space_action.keyframe_scale_fac;
/* clamp to avoid problems with uninitialised values... */
if (ac->yscale_fac < 0.1f)
@@ -276,7 +269,7 @@ static bool actedit_get_context(bAnimContext *ac, SpaceAction *saction)
/* ----------- Private Stuff - Graph Editor ------------- */
/* Get data being edited in Graph Editor (depending on current 'mode') */
-static bool graphedit_get_context(bAnimContext *ac, SpaceIpo *sipo)
+static bool graphedit_get_context(bAnimContext *ac, SpaceGraph *sipo)
{
/* init dopesheet data if non-existent (i.e. for old files) */
if (sipo->ads == NULL) {
@@ -365,9 +358,9 @@ bool ANIM_animdata_context_getdata(bAnimContext *ac)
ok = actedit_get_context(ac, saction);
break;
}
- case SPACE_IPO:
+ case SPACE_GRAPH:
{
- SpaceIpo *sipo = (SpaceIpo *)sl;
+ SpaceGraph *sipo = (SpaceGraph *)sl;
ok = graphedit_get_context(ac, sipo);
break;
}
@@ -546,11 +539,11 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
* ! This causes the calling function to return early if we're only "peeking" for channels
*/
// XXX: ale_statement stuff is really a hack for one special case. It shouldn't really be needed...
-#define ANIMCHANNEL_NEW_CHANNEL_FULL(channel_data, channel_type, owner_id, ale_statement) \
+#define ANIMCHANNEL_NEW_CHANNEL_FULL(channel_data, channel_type, owner_id, fcurve_owner_id, ale_statement) \
if (filter_mode & ANIMFILTER_TMP_PEEK) \
return 1; \
else { \
- bAnimListElem *ale = make_new_animlistelem(channel_data, channel_type, (ID *)owner_id); \
+ bAnimListElem *ale = make_new_animlistelem(channel_data, channel_type, (ID *)owner_id, fcurve_owner_id); \
if (ale) { \
BLI_addtail(anim_data, ale); \
items ++; \
@@ -558,8 +551,8 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
} \
} (void)0
-#define ANIMCHANNEL_NEW_CHANNEL(channel_data, channel_type, owner_id) \
- ANIMCHANNEL_NEW_CHANNEL_FULL(channel_data, channel_type, owner_id, {})
+#define ANIMCHANNEL_NEW_CHANNEL(channel_data, channel_type, owner_id, fcurve_owner_id) \
+ ANIMCHANNEL_NEW_CHANNEL_FULL(channel_data, channel_type, owner_id, fcurve_owner_id, {})
/* ............................... */
@@ -591,7 +584,7 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
/* this function allocates memory for a new bAnimListElem struct for the
* provided animation channel-data.
*/
-static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owner_id)
+static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owner_id, ID *fcurve_owner_id)
{
bAnimListElem *ale = NULL;
@@ -605,6 +598,7 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
ale->id = owner_id;
ale->adt = BKE_animdata_from_id(owner_id);
+ ale->fcurve_owner_id = fcurve_owner_id;
/* do specifics */
switch (datatype) {
@@ -678,7 +672,7 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
}
case ANIMTYPE_DSLAM:
{
- Lamp *la = (Lamp *)data;
+ Light *la = (Light *)data;
AnimData *adt = la->adt;
ale->flag = FILTER_LAM_OBJD(la);
@@ -907,7 +901,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
break;
}
case ANIMTYPE_FCURVE:
- case ANIMTYPE_NLACURVE: /* practically the same as ANIMTYPE_FCURVE. Differences are applied post-creation */
+ case ANIMTYPE_NLACURVE: /* practically the same as ANIMTYPE_FCURVE.
+ * Differences are applied post-creation */
{
FCurve *fcu = (FCurve *)data;
@@ -1000,7 +995,8 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
if (fcu->grp != NULL && fcu->grp->flag & ADT_CURVES_ALWAYS_VISIBLE) {
return false;
}
- /* hidden items should be skipped if we only care about visible data, but we aren't interested in hidden stuff */
+ /* hidden items should be skipped if we only care about visible data,
+ * but we aren't interested in hidden stuff */
const bool skip_hidden = (filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN);
if (GS(owner_id->name) == ID_OB) {
@@ -1249,7 +1245,7 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, eAnim_Chan
static size_t animfilter_fcurves(ListBase *anim_data, bDopeSheet *ads,
FCurve *first, eAnim_ChannelType fcurve_type,
int filter_mode,
- void *owner, ID *owner_id)
+ void *owner, ID *owner_id, ID *fcurve_owner_id)
{
FCurve *fcu;
size_t items = 0;
@@ -1265,15 +1261,16 @@ static size_t animfilter_fcurves(ListBase *anim_data, bDopeSheet *ads,
*/
for (fcu = first; ( (fcu = animfilter_fcurve_next(ads, fcu, fcurve_type, filter_mode, owner, owner_id)) ); fcu = fcu->next) {
if (UNLIKELY(fcurve_type == ANIMTYPE_NLACURVE)) {
- /* NLA Control Curve - Basically the same as normal F-Curves, except we need to set some stuff differently */
- ANIMCHANNEL_NEW_CHANNEL_FULL(fcu, ANIMTYPE_NLACURVE, owner_id, {
+ /* NLA Control Curve - Basically the same as normal F-Curves,
+ * except we need to set some stuff differently */
+ ANIMCHANNEL_NEW_CHANNEL_FULL(fcu, ANIMTYPE_NLACURVE, owner_id, fcurve_owner_id, {
ale->owner = owner; /* strip */
ale->adt = NULL; /* to prevent time mapping from causing problems */
});
}
else {
/* Normal FCurve */
- ANIMCHANNEL_NEW_CHANNEL(fcu, ANIMTYPE_FCURVE, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(fcu, ANIMTYPE_FCURVE, owner_id, fcurve_owner_id);
}
}
@@ -1281,7 +1278,7 @@ static size_t animfilter_fcurves(ListBase *anim_data, bDopeSheet *ads,
return items;
}
-static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *UNUSED(act), bActionGroup *agrp, int filter_mode, ID *owner_id)
+static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *act, bActionGroup *agrp, int filter_mode, ID *owner_id)
{
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
@@ -1294,8 +1291,11 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
* - Hierarchy matters: this hack should be applied
* - Hierarchy ignored: cases like [#21276] won't work properly, unless we skip this hack
*/
- if ( ((filter_mode & ANIMFILTER_LIST_VISIBLE) && EXPANDED_AGRP(ac, agrp) == 0) && /* care about hierarchy but group isn't expanded */
- (filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) ) /* care about selection status */
+ if (
+ /* care about hierarchy but group isn't expanded */
+ ((filter_mode & ANIMFILTER_LIST_VISIBLE) && EXPANDED_AGRP(ac, agrp) == 0) &&
+ /* care about selection status */
+ (filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) )
{
/* if the group itself isn't selected appropriately, we shouldn't consider it's children either */
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0)
@@ -1317,9 +1317,9 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
{
/* special filter so that we can get just the F-Curves within the active group */
if (!(filter_mode & ANIMFILTER_ACTGROUPED) || (agrp->flag & AGRP_ACTIVE)) {
- /* for the Graph Editor, curves may be set to not be visible in the view to lessen clutter,
- * but to do this, we need to check that the group doesn't have it's not-visible flag set preventing
- * all its sub-curves to be shown
+ /* for the Graph Editor, curves may be set to not be visible in the view to lessen
+ * clutter, but to do this, we need to check that the group doesn't have it's
+ * not-visible flag set preventing all its sub-curves to be shown
*/
if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE)) {
/* group must be editable for its children to be editable (if we care about this) */
@@ -1328,7 +1328,7 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
FCurve *first_fcu = animfilter_fcurve_next(ads, agrp->channels.first, ANIMTYPE_FCURVE, filter_mode, agrp, owner_id);
/* filter list, starting from this F-Curve */
- tmp_items += animfilter_fcurves(&tmp_data, ads, first_fcu, ANIMTYPE_FCURVE, filter_mode, agrp, owner_id);
+ tmp_items += animfilter_fcurves(&tmp_data, ads, first_fcu, ANIMTYPE_FCURVE, filter_mode, agrp, owner_id, &act->id);
}
}
}
@@ -1342,9 +1342,10 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
/* restore original filter mode so that this next step works ok... */
//filter_mode = ofilter;
- /* filter selection of channel specially here again, since may be open and not subject to previous test */
+ /* filter selection of channel specially here again,
+ * since may be open and not subject to previous test */
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) ) {
- ANIMCHANNEL_NEW_CHANNEL(agrp, ANIMTYPE_GROUP, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(agrp, ANIMTYPE_GROUP, owner_id, NULL);
}
}
@@ -1384,7 +1385,7 @@ static size_t animfilter_action(bAnimContext *ac, ListBase *anim_data, bDopeShee
/* un-grouped F-Curves (only if we're not only considering those channels in the active group) */
if (!(filter_mode & ANIMFILTER_ACTGROUPED)) {
FCurve *firstfcu = (lastchan) ? (lastchan->next) : (act->curves.first);
- items += animfilter_fcurves(anim_data, ads, firstfcu, ANIMTYPE_FCURVE, filter_mode, NULL, owner_id);
+ items += animfilter_fcurves(anim_data, ads, firstfcu, ANIMTYPE_FCURVE, filter_mode, NULL, owner_id, &act->id);
}
/* return the number of items added to the list */
@@ -1417,7 +1418,7 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
* - as AnimData may not have an action, we pass a dummy pointer just to get the list elem created, then
* overwrite this with the real value - REVIEW THIS...
*/
- ANIMCHANNEL_NEW_CHANNEL_FULL((void *)(&adt->action), ANIMTYPE_NLAACTION, owner_id,
+ ANIMCHANNEL_NEW_CHANNEL_FULL((void *)(&adt->action), ANIMTYPE_NLAACTION, owner_id, NULL,
{
ale->data = adt->action ? adt->action : NULL;
});
@@ -1477,7 +1478,7 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
}
/* add the track now that it has passed all our tests */
- ANIMCHANNEL_NEW_CHANNEL(nlt, ANIMTYPE_NLATRACK, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(nlt, ANIMTYPE_NLATRACK, owner_id, NULL);
}
}
}
@@ -1507,7 +1508,10 @@ static size_t animfilter_nla_controls(ListBase *anim_data, bDopeSheet *ads, Anim
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
for (strip = nlt->strips.first; strip; strip = strip->next) {
/* pass strip as the "owner", so that the name lookups (used while filtering) will resolve */
- tmp_items += animfilter_fcurves(&tmp_data, ads, strip->fcurves.first, ANIMTYPE_NLACURVE, filter_mode, strip, owner_id);
+ /* NLA tracks are coming from AnimData, so owner of f-curves
+ * is the same as owner of animation data. */
+ tmp_items += animfilter_fcurves(&tmp_data, ads, strip->fcurves.first, ANIMTYPE_NLACURVE,
+ filter_mode, strip, owner_id, owner_id);
}
}
}
@@ -1519,7 +1523,7 @@ static size_t animfilter_nla_controls(ListBase *anim_data, bDopeSheet *ads, Anim
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* currently these channels cannot be selected, so they should be skipped */
if ((filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) == 0) {
- ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_NLACONTROLS, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_NLACONTROLS, owner_id, NULL);
}
}
@@ -1551,14 +1555,15 @@ static size_t animfilter_block_data(bAnimContext *ac, ListBase *anim_data, bDope
{ /* AnimData */
/* specifically filter animdata block */
if (ANIMCHANNEL_SELOK(SEL_ANIMDATA(adt)) ) {
- ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_ANIMDATA, id);
+ ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_ANIMDATA, id, NULL);
}
},
{ /* NLA */
items += animfilter_nla(ac, anim_data, ads, adt, filter_mode, id);
},
{ /* Drivers */
- items += animfilter_fcurves(anim_data, ads, adt->drivers.first, ANIMTYPE_FCURVE, filter_mode, NULL, id);
+ items += animfilter_fcurves(anim_data, ads, adt->drivers.first, ANIMTYPE_FCURVE,
+ filter_mode, NULL, id, id);
},
{ /* NLA Control Keyframes */
items += animfilter_nla_controls(anim_data, ads, adt, filter_mode, id);
@@ -1595,7 +1600,7 @@ static size_t animdata_filter_shapekey(bAnimContext *ac, ListBase *anim_data, Ke
// TODO: consider 'active' too?
/* owner-id here must be key so that the F-Curve can be resolved... */
- ANIMCHANNEL_NEW_CHANNEL(kb, ANIMTYPE_SHAPEKEY, key);
+ ANIMCHANNEL_NEW_CHANNEL(kb, ANIMTYPE_SHAPEKEY, key, NULL);
}
}
}
@@ -1606,7 +1611,7 @@ static size_t animdata_filter_shapekey(bAnimContext *ac, ListBase *anim_data, Ke
if (key->adt) {
if (filter_mode & ANIMFILTER_ANIMDATA) {
if (ANIMCHANNEL_SELOK(SEL_ANIMDATA(key->adt)) ) {
- ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, key);
+ ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, key, NULL);
}
}
else if (key->adt->action) {
@@ -1638,10 +1643,8 @@ static size_t animdata_filter_gpencil_layers_data(ListBase *anim_data, bDopeShee
if (name_matches_dopesheet_filter(ads, gpl->info) == false)
continue;
}
-
-
/* add to list */
- ANIMCHANNEL_NEW_CHANNEL(gpl, ANIMTYPE_GPLAYER, gpd);
+ ANIMCHANNEL_NEW_CHANNEL(gpl, ANIMTYPE_GPLAYER, gpd, NULL);
}
}
}
@@ -1661,7 +1664,7 @@ static size_t animdata_filter_gpencil_data(ListBase *anim_data, bDopeSheet *ads,
*/
if (filter_mode & ANIMFILTER_ANIMDATA) {
/* just add GPD as a channel - this will add everything needed */
- ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, gpd);
+ ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, gpd, NULL);
}
else {
ListBase tmp_data = {NULL, NULL};
@@ -1679,7 +1682,7 @@ static size_t animdata_filter_gpencil_data(ListBase *anim_data, bDopeSheet *ads,
/* include data-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* add gpd as channel too (if for drawing, and it has layers) */
- ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, NULL);
+ ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, NULL, NULL);
}
/* now add the list of collected channels */
@@ -1756,8 +1759,9 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, voi
else {
bGPdata *gpd;
- /* Grab all Grease Pencil datablocks directly from main, but only those that seem to be useful somewhere */
- for (gpd = ac->bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+ /* Grab all Grease Pencil datablocks directly from main,
+ * but only those that seem to be useful somewhere */
+ for (gpd = ac->bmain->gpencils.first; gpd; gpd = gpd->id.next) {
/* only show if gpd is used by something... */
if (ID_REAL_USERS(gpd) < 1)
continue;
@@ -1797,7 +1801,7 @@ static size_t animdata_filter_ds_gpencil(bAnimContext *ac, ListBase *anim_data,
/* check if filtering by active status */
// XXX: active check here needs checking
if (ANIMCHANNEL_ACTIVEOK(gpd)) {
- ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_DSGPENCIL, gpd);
+ ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_DSGPENCIL, gpd, NULL);
}
}
@@ -1833,7 +1837,7 @@ static size_t animdata_filter_ds_cachefile(bAnimContext *ac, ListBase *anim_data
/* check if filtering by active status */
// XXX: active check here needs checking
if (ANIMCHANNEL_ACTIVEOK(cache_file)) {
- ANIMCHANNEL_NEW_CHANNEL(cache_file, ANIMTYPE_DSCACHEFILE, cache_file);
+ ANIMCHANNEL_NEW_CHANNEL(cache_file, ANIMTYPE_DSCACHEFILE, cache_file, NULL);
}
}
@@ -1863,7 +1867,7 @@ static size_t animdata_filter_mask_data(ListBase *anim_data, Mask *mask, const i
/* active... */
if (!(filter_mode & ANIMFILTER_ACTIVE) || (masklay_act == masklay)) {
/* add to list */
- ANIMCHANNEL_NEW_CHANNEL(masklay, ANIMTYPE_MASKLAYER, mask);
+ ANIMCHANNEL_NEW_CHANNEL(masklay, ANIMTYPE_MASKLAYER, mask, NULL);
}
}
}
@@ -1880,7 +1884,7 @@ static size_t animdata_filter_mask(Main *bmain, ListBase *anim_data, void *UNUSE
/* for now, grab mask datablocks directly from main */
// XXX: this is not good...
- for (mask = bmain->mask.first; mask; mask = mask->id.next) {
+ for (mask = bmain->masks.first; mask; mask = mask->id.next) {
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
@@ -1899,8 +1903,8 @@ static size_t animdata_filter_mask(Main *bmain, ListBase *anim_data, void *UNUSE
if (tmp_items) {
/* include data-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
- /* add gpd as channel too (if for drawing, and it has layers) */
- ANIMCHANNEL_NEW_CHANNEL(mask, ANIMTYPE_MASKDATABLOCK, NULL);
+ /* add mask datablock as channel too (if for drawing, and it has layers) */
+ ANIMCHANNEL_NEW_CHANNEL(mask, ANIMTYPE_MASKDATABLOCK, NULL, NULL);
}
/* now add the list of collected channels */
@@ -1935,7 +1939,7 @@ static size_t animdata_filter_ds_nodetree_group(bAnimContext *ac, ListBase *anim
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(ntree)) {
- ANIMCHANNEL_NEW_CHANNEL(ntree, ANIMTYPE_DSNTREE, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(ntree, ANIMTYPE_DSNTREE, owner_id, NULL);
}
}
@@ -2018,7 +2022,7 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(linestyle)) {
- ANIMCHANNEL_NEW_CHANNEL(linestyle, ANIMTYPE_DSLINESTYLE, sce);
+ ANIMCHANNEL_NEW_CHANNEL(linestyle, ANIMTYPE_DSLINESTYLE, sce, NULL);
}
}
@@ -2063,7 +2067,7 @@ static size_t animdata_filter_ds_texture(bAnimContext *ac, ListBase *anim_data,
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(tex)) {
- ANIMCHANNEL_NEW_CHANNEL(tex, ANIMTYPE_DSTEX, owner_id);
+ ANIMCHANNEL_NEW_CHANNEL(tex, ANIMTYPE_DSTEX, owner_id, NULL);
}
}
@@ -2078,7 +2082,7 @@ static size_t animdata_filter_ds_texture(bAnimContext *ac, ListBase *anim_data,
}
/* NOTE: owner_id is the direct owner of the texture stack in question
- * It used to be Material/Lamp/World before the Blender Internal removal for 2.8
+ * It used to be Material/Light/World before the Blender Internal removal for 2.8
*/
static size_t animdata_filter_ds_textures(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *owner_id, int filter_mode)
{
@@ -2147,7 +2151,7 @@ static size_t animdata_filter_ds_material(bAnimContext *ac, ListBase *anim_data,
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(ma)) {
- ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma);
+ ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma, NULL);
}
}
@@ -2321,7 +2325,7 @@ static size_t animdata_filter_ds_particles(bAnimContext *ac, ListBase *anim_data
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(psys->part)) {
- ANIMCHANNEL_NEW_CHANNEL(psys->part, ANIMTYPE_DSPART, psys->part);
+ ANIMCHANNEL_NEW_CHANNEL(psys->part, ANIMTYPE_DSPART, psys->part, NULL);
}
}
@@ -2359,9 +2363,9 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
expanded = FILTER_CAM_OBJD(ca);
break;
}
- case OB_LAMP: /* ---------- Lamp ----------- */
+ case OB_LAMP: /* ---------- Light ----------- */
{
- Lamp *la = (Lamp *)ob->data;
+ Light *la = (Light *)ob->data;
if (ads->filterflag & ADS_FILTER_NOLAM)
return 0;
@@ -2445,9 +2449,9 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
/* sub-data filtering... */
switch (ob->type) {
- case OB_LAMP: /* lamp - textures + nodetree */
+ case OB_LAMP: /* light - textures + nodetree */
{
- Lamp *la = ob->data;
+ Light *la = ob->data;
bNodeTree *ntree = la->nodetree;
/* nodetree */
@@ -2465,7 +2469,7 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(iat)) {
- ANIMCHANNEL_NEW_CHANNEL(iat, type, iat);
+ ANIMCHANNEL_NEW_CHANNEL(iat, type, iat, NULL);
}
}
@@ -2499,7 +2503,7 @@ static size_t animdata_filter_ds_keyanim(bAnimContext *ac, ListBase *anim_data,
/* include key-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
if (ANIMCHANNEL_ACTIVEOK(key)) {
- ANIMCHANNEL_NEW_CHANNEL(key, ANIMTYPE_DSSKEY, ob);
+ ANIMCHANNEL_NEW_CHANNEL(key, ANIMTYPE_DSSKEY, ob, NULL);
}
}
@@ -2556,7 +2560,7 @@ static size_t animdata_filter_ds_obanim(bAnimContext *ac, ListBase *anim_data, b
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
if (type != ANIMTYPE_NONE) {
/* NOTE: active-status (and the associated checks) don't apply here... */
- ANIMCHANNEL_NEW_CHANNEL(cdata, type, ob);
+ ANIMCHANNEL_NEW_CHANNEL(cdata, type, ob, NULL);
}
}
@@ -2632,7 +2636,7 @@ static size_t animdata_filter_dopesheet_ob(bAnimContext *ac, ListBase *anim_data
if (ANIMCHANNEL_SELOK((base->flag & BASE_SELECTED))) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(ob)) {
- ANIMCHANNEL_NEW_CHANNEL(base, ANIMTYPE_OBJECT, ob);
+ ANIMCHANNEL_NEW_CHANNEL(base, ANIMTYPE_OBJECT, ob, NULL);
}
}
}
@@ -2671,7 +2675,7 @@ static size_t animdata_filter_ds_world(bAnimContext *ac, ListBase *anim_data, bD
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(wo)) {
- ANIMCHANNEL_NEW_CHANNEL(wo, ANIMTYPE_DSWOR, sce);
+ ANIMCHANNEL_NEW_CHANNEL(wo, ANIMTYPE_DSWOR, sce, NULL);
}
}
@@ -2726,7 +2730,7 @@ static size_t animdata_filter_ds_scene(bAnimContext *ac, ListBase *anim_data, bD
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
if (type != ANIMTYPE_NONE) {
/* NOTE: active-status (and the associated checks) don't apply here... */
- ANIMCHANNEL_NEW_CHANNEL(cdata, type, sce);
+ ANIMCHANNEL_NEW_CHANNEL(cdata, type, sce, NULL);
}
}
@@ -2789,7 +2793,7 @@ static size_t animdata_filter_dopesheet_scene(bAnimContext *ac, ListBase *anim_d
/* check if filtering by selection */
if (ANIMCHANNEL_SELOK((sce->flag & SCE_DS_SELECTED))) {
/* NOTE: active-status doesn't matter for this! */
- ANIMCHANNEL_NEW_CHANNEL(sce, ANIMTYPE_SCENE, sce);
+ ANIMCHANNEL_NEW_CHANNEL(sce, ANIMTYPE_SCENE, sce, NULL);
}
}
@@ -2821,7 +2825,7 @@ static size_t animdata_filter_ds_movieclip(bAnimContext *ac, ListBase *anim_data
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(clip)) {
- ANIMCHANNEL_NEW_CHANNEL(clip, ANIMTYPE_DSMCLIP, clip);
+ ANIMCHANNEL_NEW_CHANNEL(clip, ANIMTYPE_DSMCLIP, clip, NULL);
}
}
/* now add the list of collected channels */
@@ -2837,7 +2841,7 @@ static size_t animdata_filter_dopesheet_movieclips(bAnimContext *ac, ListBase *a
{
size_t items = 0;
MovieClip *clip;
- for (clip = ac->bmain->movieclip.first; clip != NULL; clip = clip->id.next) {
+ for (clip = ac->bmain->movieclips.first; clip != NULL; clip = clip->id.next) {
/* only show if gpd is used by something... */
if (ID_REAL_USERS(clip) < 1) {
continue;
@@ -2976,9 +2980,11 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, b
}
/* Cache files level animations (frame duration and such). */
- CacheFile *cache_file = ac->bmain->cachefiles.first;
- for (; cache_file; cache_file = cache_file->id.next) {
- items += animdata_filter_ds_cachefile(ac, anim_data, ads, cache_file, filter_mode);
+ if (!(ads->filterflag2 & ADS_FILTER_NOCACHEFILES) && !(ads->filterflag & ADS_FILTER_ONLYSEL)) {
+ CacheFile *cache_file = ac->bmain->cachefiles.first;
+ for (; cache_file; cache_file = cache_file->id.next) {
+ items += animdata_filter_ds_cachefile(ac, anim_data, ads, cache_file, filter_mode);
+ }
}
/* movie clip's animation */
@@ -3057,7 +3063,7 @@ static short animdata_filter_dopesheet_summary(bAnimContext *ac, ListBase *anim_
* - only useful for DopeSheet/Action/etc. editors where it is actually useful
*/
if ((filter_mode & ANIMFILTER_LIST_CHANNELS) && (ads->filterflag & ADS_FILTER_SUMMARY)) {
- bAnimListElem *ale = make_new_animlistelem(ac, ANIMTYPE_SUMMARY, NULL);
+ bAnimListElem *ale = make_new_animlistelem(ac, ANIMTYPE_SUMMARY, NULL, NULL);
if (ale) {
BLI_addtail(anim_data, ale);
(*items)++;
@@ -3198,7 +3204,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
/* all channels here are within the same AnimData block, hence this special case */
if (LIKELY(obact->adt)) {
- ANIMCHANNEL_NEW_CHANNEL(obact->adt, ANIMTYPE_ANIMDATA, (ID *)obact);
+ ANIMCHANNEL_NEW_CHANNEL(obact->adt, ANIMTYPE_ANIMDATA, (ID *)obact, NULL);
}
}
else {
@@ -3217,7 +3223,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
/* all channels here are within the same AnimData block, hence this special case */
if (LIKELY(key->adt)) {
- ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, (ID *)key);
+ ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, (ID *)key, NULL);
}
}
else {
@@ -3257,7 +3263,8 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
case ANIMCONT_DRIVERS: /* Graph Editor -> Drivers Editing */
case ANIMCONT_NLA: /* NLA Editor */
{
- /* all of these editors use the basic DopeSheet data for filtering options, but don't have all the same features */
+ /* all of these editors use the basic DopeSheet data for filtering options,
+ * but don't have all the same features */
items = animdata_filter_dopesheet(ac, anim_data, data, filter_mode);
break;
}
diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h
index 73f2e85164b..af1fd0e31c4 100644
--- a/source/blender/editors/animation/anim_intern.h
+++ b/source/blender/editors/animation/anim_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung
* This is a new part of Blender (with some old code)
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_intern.h
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index d88a418fa06..03cc4855a4b 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2005. Full recode
- * Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_ipo_utils.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 74169128e5a..7a9bb1df477 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_markers.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
#include <math.h>
@@ -57,8 +50,6 @@
#include "WM_api.h"
#include "WM_types.h"
-#include "BIF_glutil.h"
-
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
@@ -297,6 +288,28 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
add_marker_to_cfra_elem(lb, marker, only_sel);
}
+void ED_markers_deselect_all(ListBase *markers, int action)
+{
+ if (action == SEL_TOGGLE) {
+ action = ED_markers_get_first_selected(markers) ? SEL_DESELECT : SEL_SELECT;
+ }
+
+ for (TimeMarker *marker = markers->first; marker; marker = marker->next) {
+ if (action == SEL_SELECT) {
+ marker->flag |= SELECT;
+ }
+ else if (action == SEL_DESELECT) {
+ marker->flag &= ~SELECT;
+ }
+ else if (action == SEL_INVERT) {
+ marker->flag ^= SELECT;
+ }
+ else {
+ BLI_assert(0);
+ }
+ }
+}
+
/* --------------------------------- */
/* Get the first selected marker */
@@ -377,11 +390,35 @@ static void draw_marker_name(
UI_fontstyle_draw_simple(fstyle, x, y, name, text_col);
}
+static void draw_marker_line(const float color[4], float x, float ymin, float ymax)
+{
+ GPUVertFormat *format = immVertexFormat();
+ uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+
+ immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
+
+ float viewport_size[4];
+ GPU_viewport_size_get_f(viewport_size);
+ immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
+
+ immUniformColor4fv(color);
+ immUniform1i("colors_len", 0); /* "simple" mode */
+ immUniform1f("dash_width", 6.0f);
+ immUniform1f("dash_factor", 0.5f);
+
+ immBegin(GPU_PRIM_LINES, 2);
+ immVertex2f(pos, x, ymin);
+ immVertex2f(pos, x, ymax);
+ immEnd();
+
+ immUnbindProgram();
+}
+
/* function to draw markers */
static void draw_marker(
- View2D *v2d, const uiFontStyle *fstyle, TimeMarker *marker, int cfra, int flag,
+ const uiFontStyle *fstyle, TimeMarker *marker, int cfra, int flag,
/* avoid re-calculating each time */
- const float ypixels, const float xscale, const float yscale)
+ const float ypixels, const float xscale, int height)
{
const float xpos = marker->frame * xscale;
#ifdef DURIAN_CAMERA_SWITCH
@@ -401,31 +438,15 @@ static void draw_marker(
if (flag & DRAW_MARKERS_LINES)
#endif
{
- GPUVertFormat *format = immVertexFormat();
- uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
-
- immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
-
- float viewport_size[4];
- GPU_viewport_size_get_f(viewport_size);
- immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
-
+ float color[4];
if (marker->flag & SELECT) {
- immUniformColor4f(1.0f, 1.0f, 1.0f, 0.38f);
+ copy_v4_fl4(color, 1.0f, 1.0f, 1.0f, 0.38f);
}
else {
- immUniformColor4f(0.0f, 0.0f, 0.0f, 0.38f);
+ copy_v4_fl4(color, 0.0f, 0.0f, 0.0f, 0.38f);
}
- immUniform1i("colors_len", 0); /* "simple" mode */
- immUniform1f("dash_width", 6.0f);
- immUniform1f("dash_factor", 0.5f);
-
- immBegin(GPU_PRIM_LINES, 2);
- immVertex2f(pos, xpos + 0.5f, 12.0f);
- immVertex2f(pos, xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale);
- immEnd();
- immUnbindProgram();
+ draw_marker_line(color, xpos, yoffs + 1.5f * UI_DPI_ICON_SIZE, height);
}
/* 5 px to offset icon to align properly, space / pixels corrects for zoom */
@@ -445,7 +466,7 @@ static void draw_marker(
ICON_MARKER;
}
- UI_icon_draw(xpos - 0.45f * UI_DPI_ICON_SIZE, yoffs + UI_DPI_ICON_SIZE, icon_id);
+ UI_icon_draw(xpos - 0.55f * UI_DPI_ICON_SIZE, yoffs + UI_DPI_ICON_SIZE, icon_id);
GPU_blend(false);
@@ -486,6 +507,7 @@ void ED_markers_draw(const bContext *C, int flag)
scene = CTX_data_scene(C);
v2d = UI_view2d_fromcontext(C);
+ int height = v2d->mask.ymax - v2d->mask.ymin;
if (flag & DRAW_MARKERS_MARGIN) {
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -524,8 +546,8 @@ void ED_markers_draw(const bContext *C, int flag)
if ((marker->frame >= v2d_clip_range_x[0]) &&
(marker->frame <= v2d_clip_range_x[1]))
{
- draw_marker(v2d, fstyle, marker, scene->r.cfra, flag,
- ypixels, xscale, yscale);
+ draw_marker(fstyle, marker, scene->r.cfra, flag,
+ ypixels, xscale, height);
}
}
}
@@ -616,7 +638,8 @@ static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, const wm
BKE_report(op->reports, RPT_ERROR, "Programming error: operator does not actually have code to do anything!");
- /* unless successful, must add "pass-through" to let normal operator's have a chance at tackling this event */
+ /* unless successful, must add "pass-through"
+ * to let normal operator's have a chance at tackling this event */
if ((retval & (OPERATOR_FINISHED | OPERATOR_INTERFACE)) == 0) {
retval |= OPERATOR_PASS_THROUGH;
}
@@ -707,7 +730,6 @@ static void MARKER_OT_add(wmOperatorType *ot)
* invoke() calls init, adds modal handler
*
* modal() accept modal events while doing it, ends with apply and exit, or cancel
- *
*/
typedef struct MarkerMove {
@@ -722,7 +744,7 @@ static bool ed_marker_move_use_time(MarkerMove *mm)
{
if (((mm->slink->spacetype == SPACE_SEQ) && !(((SpaceSeq *)mm->slink)->flag & SEQ_DRAWFRAMES)) ||
((mm->slink->spacetype == SPACE_ACTION) && (((SpaceAction *)mm->slink)->flag & SACTION_DRAWTIME)) ||
- ((mm->slink->spacetype == SPACE_IPO) && !(((SpaceIpo *)mm->slink)->flag & SIPO_DRAWTIME)) ||
+ ((mm->slink->spacetype == SPACE_GRAPH) && !(((SpaceGraph *)mm->slink)->flag & SIPO_DRAWTIME)) ||
((mm->slink->spacetype == SPACE_NLA) && !(((SpaceNla *)mm->slink)->flag & SNLA_DRAWTIME)))
{
return true;
@@ -1279,9 +1301,6 @@ static int ed_marker_box_select_exec(bContext *C, wmOperator *op)
{
View2D *v2d = UI_view2d_fromcontext(C);
ListBase *markers = ED_context_get_markers(C);
- TimeMarker *marker;
- bool select = !RNA_boolean_get(op->ptr, "deselect");
- bool extend = RNA_boolean_get(op->ptr, "extend");
rctf rect;
WM_operator_properties_border_to_rctf(op, &rect);
@@ -1290,18 +1309,15 @@ static int ed_marker_box_select_exec(bContext *C, wmOperator *op)
if (markers == NULL)
return 0;
- /* XXX marker context */
- for (marker = markers->first; marker; marker = marker->next) {
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_markers_deselect_all(markers, SEL_DESELECT);
+ }
+
+ for (TimeMarker *marker = markers->first; marker; marker = marker->next) {
if (BLI_rctf_isect_x(&rect, marker->frame)) {
- if (select) {
- marker->flag |= SELECT;
- }
- else {
- marker->flag &= ~SELECT;
- }
- }
- else if (!extend) {
- marker->flag &= ~SELECT;
+ SET_FLAG_FROM_TEST(marker->flag, select, SELECT);
}
}
@@ -1334,8 +1350,9 @@ static void MARKER_OT_select_box(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- /* rna */
- WM_operator_properties_gesture_box_select(ot);
+ /* properties */
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/* *********************** (de)select all ***************** */
@@ -1343,29 +1360,12 @@ static void MARKER_OT_select_box(wmOperatorType *ot)
static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
{
ListBase *markers = ED_context_get_markers(C);
- TimeMarker *marker;
- int action = RNA_enum_get(op->ptr, "action");
-
- if (markers == NULL)
+ if (markers == NULL) {
return OPERATOR_CANCELLED;
-
- if (action == SEL_TOGGLE) {
- action = (ED_markers_get_first_selected(markers) != NULL) ? SEL_DESELECT : SEL_SELECT;
}
- for (marker = markers->first; marker; marker = marker->next) {
- switch (action) {
- case SEL_SELECT:
- marker->flag |= SELECT;
- break;
- case SEL_DESELECT:
- marker->flag &= ~SELECT;
- break;
- case SEL_INVERT:
- marker->flag ^= SELECT;
- break;
- }
- }
+ int action = RNA_enum_get(op->ptr, "action");
+ ED_markers_deselect_all(markers, action);
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
@@ -1499,7 +1499,7 @@ static void MARKER_OT_rename(wmOperatorType *ot)
static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
{
ListBase *markers = ED_context_get_markers(C);
- Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
+ Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scenes, RNA_enum_get(op->ptr, "scene"));
TimeMarker *marker, *marker_new;
if (scene_to == NULL) {
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 8914cf9492c..b4e60d29a40 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/anim_ops.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -79,7 +72,7 @@ static bool change_frame_poll(bContext *C)
if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_SEQ, SPACE_CLIP)) {
return true;
}
- else if (sa->spacetype == SPACE_IPO) {
+ else if (sa->spacetype == SPACE_GRAPH) {
/* NOTE: Graph Editor has special version which does some extra stuff.
* No need to show the generic error message for that case though!
*/
@@ -294,7 +287,7 @@ static bool anim_set_end_frames_poll(bContext *C)
* this shouldn't show up in 3D editor (or others without 2D timeline view) via search
*/
if (sa) {
- if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO, SPACE_NLA, SPACE_SEQ, SPACE_CLIP)) {
+ if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_GRAPH, SPACE_NLA, SPACE_SEQ, SPACE_CLIP)) {
return true;
}
}
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index ac57f77bac9..d726c25816b 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/drivers.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -329,7 +321,8 @@ int ANIM_add_driver_with_target(
/* handle curve-property mappings based on mapping_type */
switch (mapping_type) {
- case CREATEDRIVER_MAPPING_N_N: /* N-N - Try to match as much as possible, then use the first one */
+ case CREATEDRIVER_MAPPING_N_N: /* N-N - Try to match as much as possible,
+ * then use the first one */
{
/* Use the shorter of the two (to avoid out of bounds access) */
int dst_len = (RNA_property_array_check(prop)) ? RNA_property_array_length(&ptr, prop) : 1;
@@ -772,7 +765,7 @@ EnumPropertyItem prop_driver_create_mapping_types[] = {
"Create drivers for all properties without assigning any targets yet"},
{CREATEDRIVER_MAPPING_NONE, "NONE_SINGLE", 0, "Manually Create Later (Single)",
"Create driver for this property only and without assigning any targets yet"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Filtering callback for driver mapping types enum */
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 3136b3e7137..40454bcad0c 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/fmodifier_ui.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -50,6 +43,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
@@ -64,6 +58,8 @@
#include "ED_anim_api.h"
#include "ED_undo.h"
+#include "DEG_depsgraph.h"
+
/* ********************************************** */
/* UI STUFF */
@@ -86,9 +82,14 @@ static void validate_fmodifier_cb(bContext *UNUSED(C), void *fcm_v, void *UNUSED
}
/* callback to remove the given modifier */
-static void delete_fmodifier_cb(bContext *C, void *fmods_v, void *fcm_v)
+typedef struct FModifierDeleteContext {
+ ID *fcurve_owner_id;
+ ListBase *modifiers;
+} FModifierDeleteContext;
+static void delete_fmodifier_cb(bContext *C, void *ctx_v, void *fcm_v)
{
- ListBase *modifiers = (ListBase *)fmods_v;
+ FModifierDeleteContext *ctx = (FModifierDeleteContext *)ctx_v;
+ ListBase *modifiers = ctx->modifiers;
FModifier *fcm = (FModifier *)fcm_v;
/* remove the given F-Modifier from the active modifier-stack */
@@ -99,12 +100,13 @@ static void delete_fmodifier_cb(bContext *C, void *fmods_v, void *fcm_v)
/* send notifiers */
// XXX for now, this is the only way to get updates in all the right places... but would be nice to have a special one in this case
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ DEG_id_tag_update(ctx->fcurve_owner_id, ID_RECALC_COPY_ON_WRITE);
}
/* --------------- */
/* draw settings for generator modifier */
-static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, short width)
+static void draw_modifier__generator(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short width)
{
FMod_Generator *data = (FMod_Generator *)fcm->data;
uiLayout /* *col, */ /* UNUSED */ *row;
@@ -114,7 +116,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
short bwidth = width - 1.5 * UI_UNIT_X; /* max button width */
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
/* basic settings (backdrop + mode selector + some padding) */
/* col = uiLayoutColumn(layout, true); */ /* UNUSED */
@@ -252,13 +254,13 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
/* --------------- */
/* draw settings for generator modifier */
-static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__fn_generator(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
uiLayout *col;
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
/* add the settings */
col = uiLayoutColumn(layout, true);
@@ -275,13 +277,13 @@ static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm
/* --------------- */
/* draw settings for cycles modifier */
-static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__cycles(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
uiLayout *split, *col;
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierCycles, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierCycles, fcm, &ptr);
/* split into 2 columns
* NOTE: the mode comboboxes shouldn't get labels, otherwise there isn't enough room
@@ -304,13 +306,13 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor
/* --------------- */
/* draw settings for noise modifier */
-static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__noise(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
uiLayout *split, *col;
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierNoise, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierNoise, fcm, &ptr);
/* blending mode */
uiItemR(layout, &ptr, "blend_type", 0, NULL, ICON_NONE);
@@ -349,9 +351,11 @@ static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(ar
bool exists;
int i = BKE_fcm_envelope_find_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
- /* binarysearch_...() will set exists by default to 0, so if it is non-zero, that means that the point exists already */
- if (exists)
+ /* binarysearch_...() will set exists by default to 0,
+ * so if it is non-zero, that means that the point exists already */
+ if (exists) {
return;
+ }
/* add new */
fedn = MEM_callocN((env->totvert + 1) * sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
@@ -413,7 +417,7 @@ static void fmod_envelope_deletepoint_cb(bContext *UNUSED(C), void *fcm_dv, void
}
/* draw settings for envelope modifier */
-static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__envelope(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
FMod_Envelope *env = (FMod_Envelope *)fcm->data;
FCM_EnvelopeData *fed;
@@ -424,7 +428,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
int i;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierEnvelope, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierEnvelope, fcm, &ptr);
/* general settings */
col = uiLayoutColumn(layout, true);
@@ -473,13 +477,13 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
/* --------------- */
/* draw settings for limits modifier */
-static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__limits(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
uiLayout *split, *col /* , *row */ /* UNUSED */;
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierLimits, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierLimits, fcm, &ptr);
/* row 1: minimum */
{
@@ -521,13 +525,13 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
/* --------------- */
/* draw settings for stepped interpolation modifier */
-static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width))
+static void draw_modifier__stepped(uiLayout *layout, ID *fcurve_owner_id, FModifier *fcm, short UNUSED(width))
{
uiLayout *col, *sub;
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifierStepped, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifierStepped, fcm, &ptr);
/* block 1: "stepping" settings */
col = uiLayoutColumn(layout, false);
@@ -553,7 +557,8 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
/* --------------- */
-void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
+void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *fcurve_owner_id,
+ ListBase *modifiers, FModifier *fcm)
{
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
uiLayout *box, *row, *sub, *col;
@@ -563,7 +568,7 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
PointerRNA ptr;
/* init the RNA-pointer */
- RNA_pointer_create(id, &RNA_FModifier, fcm, &ptr);
+ RNA_pointer_create(fcurve_owner_id, &RNA_FModifier, fcm, &ptr);
/* draw header */
{
@@ -604,7 +609,10 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
/* delete button */
but = uiDefIconBut(block, UI_BTYPE_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"));
- UI_but_func_set(but, delete_fmodifier_cb, modifiers, fcm);
+ FModifierDeleteContext *ctx = MEM_mallocN(sizeof(FModifierDeleteContext), "fmodifier ctx");
+ ctx->fcurve_owner_id = fcurve_owner_id;
+ ctx->modifiers = modifiers;
+ UI_but_funcN_set(but, delete_fmodifier_cb, ctx, fcm);
UI_block_emboss_set(block, UI_EMBOSS);
}
@@ -617,31 +625,31 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
/* draw settings for individual modifiers */
switch (fcm->type) {
case FMODIFIER_TYPE_GENERATOR: /* Generator */
- draw_modifier__generator(box, id, fcm, width);
+ draw_modifier__generator(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_FN_GENERATOR: /* Built-In Function Generator */
- draw_modifier__fn_generator(box, id, fcm, width);
+ draw_modifier__fn_generator(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_CYCLES: /* Cycles */
- draw_modifier__cycles(box, id, fcm, width);
+ draw_modifier__cycles(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_ENVELOPE: /* Envelope */
- draw_modifier__envelope(box, id, fcm, width);
+ draw_modifier__envelope(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_LIMITS: /* Limits */
- draw_modifier__limits(box, id, fcm, width);
+ draw_modifier__limits(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_NOISE: /* Noise */
- draw_modifier__noise(box, id, fcm, width);
+ draw_modifier__noise(box, fcurve_owner_id, fcm, width);
break;
case FMODIFIER_TYPE_STEPPED: /* Stepped */
- draw_modifier__stepped(box, id, fcm, width);
+ draw_modifier__stepped(box, fcurve_owner_id, fcm, width);
break;
default: /* unknown type */
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 72da71a8a0e..19ac0ea18a0 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/keyframes_draw.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -557,7 +549,8 @@ void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type,
size *= 0.85f;
break;
- case BEZT_KEYTYPE_MOVEHOLD: /* slightly smaller than normal keyframes (but by less than for breakdowns) */
+ case BEZT_KEYTYPE_MOVEHOLD: /* slightly smaller than normal keyframes
+ * (but by less than for breakdowns) */
size *= 0.925f;
break;
@@ -942,9 +935,10 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, int saction_flag)
/* loop through each F-Curve, grabbing the keyframes */
for (ale = anim_data.first; ale; ale = ale->next) {
/* Why not use all #eAnim_KeyType here?
- * All of the other key types are actually "summaries" themselves, and will just end up duplicating stuff
- * that comes up through standard filtering of just F-Curves.
- * Given the way that these work, there isn't really any benefit at all from including them. - Aligorith */
+ * All of the other key types are actually "summaries" themselves,
+ * and will just end up duplicating stuff that comes up through
+ * standard filtering of just F-Curves. Given the way that these work,
+ * there isn't really any benefit at all from including them. - Aligorith */
switch (ale->datatype) {
case ALE_FCURVE:
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index e733bb0f8b7..837a25946da 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/keyframes_edit.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -369,7 +363,8 @@ short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, bA
return 0;
}
-/* This function is used to apply operation to all keyframes, regardless of the type without needed an AnimListElem wrapper */
+/* This function is used to apply operation to all keyframes,
+ * regardless of the type without needed an AnimListElem wrapper */
short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
{
/* sanity checks */
@@ -670,25 +665,35 @@ KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
{
/* eEditKeyframes_Validate */
switch (mode) {
- case BEZT_OK_FRAME: /* only if bezt falls on the right frame (float) */
+ case BEZT_OK_FRAME:
+ /* only if bezt falls on the right frame (float) */
return ok_bezier_frame;
- case BEZT_OK_FRAMERANGE: /* only if bezt falls within the specified frame range (floats) */
+ case BEZT_OK_FRAMERANGE:
+ /* only if bezt falls within the specified frame range (floats) */
return ok_bezier_framerange;
- case BEZT_OK_SELECTED: /* only if bezt is selected (self) */
+ case BEZT_OK_SELECTED:
+ /* only if bezt is selected (self) */
return ok_bezier_selected;
- case BEZT_OK_VALUE: /* only if bezt value matches (float) */
+ case BEZT_OK_VALUE:
+ /* only if bezt value matches (float) */
return ok_bezier_value;
- case BEZT_OK_VALUERANGE: /* only if bezier falls within the specified value range (floats) */
+ case BEZT_OK_VALUERANGE:
+ /* only if bezier falls within the specified value range (floats) */
return ok_bezier_valuerange;
- case BEZT_OK_REGION: /* only if bezier falls within the specified rect (data -> rectf) */
+ case BEZT_OK_REGION:
+ /* only if bezier falls within the specified rect (data -> rectf) */
return ok_bezier_region;
- case BEZT_OK_REGION_LASSO: /* only if the point falls within KeyframeEdit_LassoData defined data */
+ case BEZT_OK_REGION_LASSO:
+ /* only if the point falls within KeyframeEdit_LassoData defined data */
return ok_bezier_region_lasso;
- case BEZT_OK_REGION_CIRCLE: /* only if the point falls within KeyframeEdit_CircleData defined data */
+ case BEZT_OK_REGION_CIRCLE:
+ /* only if the point falls within KeyframeEdit_CircleData defined data */
return ok_bezier_region_circle;
- case BEZT_OK_CHANNEL_LASSO: /* same as BEZT_OK_REGION_LASSO, but we're only using the x-value of the points */
+ case BEZT_OK_CHANNEL_LASSO:
+ /* same as BEZT_OK_REGION_LASSO, but we're only using the x-value of the points */
return ok_bezier_channel_lasso;
- case BEZT_OK_CHANNEL_CIRCLE: /* same as BEZT_OK_REGION_CIRCLE, but we're only using the x-value of the points */
+ case BEZT_OK_CHANNEL_CIRCLE:
+ /* same as BEZT_OK_REGION_CIRCLE, but we're only using the x-value of the points */
return ok_bezier_channel_circle;
default: /* nothing was ok */
return NULL;
@@ -698,7 +703,10 @@ KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
/* ******************************************* */
/* Assorted Utility Functions */
-/* helper callback for <animeditor>_cfrasnap_exec() -> used to help get the average time of all selected beztriples */
+/**
+ * Helper callback for <animeditor>_cfrasnap_exec() ->
+ * used to help get the average time of all selected beztriples
+ */
short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt)
{
/* only if selected */
@@ -718,7 +726,8 @@ short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
-/* helper callback for columnselect_<animeditor>_keys() -> populate list CfraElems with frame numbers from selected beztriples */
+/* helper callback for columnselect_<animeditor>_keys() -> populate
+ * list CfraElems with frame numbers from selected beztriples */
short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
{
/* only if selected */
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index df87e1b7a5f..d186a0bb757 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation
* All rights reserved.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/keyframes_general.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -48,7 +42,6 @@
#include "BKE_fcurve.h"
#include "BKE_report.h"
#include "BKE_main.h"
-#include "BKE_global.h"
#include "BKE_deform.h"
#include "RNA_access.h"
@@ -739,7 +732,7 @@ static tAnimCopybufItem *pastebuf_match_path_property(
/* check that paths exist */
if (aci->rna_path && fcu->rna_path) {
/* find the property of the fcurve and compare against the end of the tAnimCopybufItem
- * more involved since it needs to to path lookups.
+ * more involved since it needs to do path lookups.
* This is not 100% reliable since the user could be editing the curves on a path that wont
* resolve, or a bone could be renamed after copying for eg. but in normal copy & paste
* this should work out ok.
@@ -904,14 +897,16 @@ const EnumPropertyItem rna_enum_keyframe_paste_offset_items[] = {
{KEYFRAME_PASTE_OFFSET_CFRA_END, "END", 0, "Frame End", "Paste keys ending at current frame"},
{KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE, "RELATIVE", 0, "Frame Relative", "Paste keys relative to the current frame when copying"},
{KEYFRAME_PASTE_OFFSET_NONE, "NONE", 0, "No Offset", "Paste keys from original time"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
const EnumPropertyItem rna_enum_keyframe_paste_merge_items[] = {
{KEYFRAME_PASTE_MERGE_MIX, "MIX", 0, "Mix", "Overlay existing with new keys"},
{KEYFRAME_PASTE_MERGE_OVER, "OVER_ALL", 0, "Overwrite All", "Replace all keys"},
{KEYFRAME_PASTE_MERGE_OVER_RANGE, "OVER_RANGE", 0, "Overwrite Range", "Overwrite keys in pasted range"},
{KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL, "OVER_RANGE_ALL", 0, "Overwrite Entire Range", "Overwrite keys in pasted range, using the range of all copied keys"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
/**
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 02d5e2cb28a..1922b876d1e 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/keyframing.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -425,6 +417,9 @@ int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
fcu->totvert++;
}
+ else {
+ return -1;
+ }
}
/* no keyframes already, but can only add if...
* 1) keyframing modes say that keyframes can only be replaced, so adding new ones won't know
@@ -509,11 +504,15 @@ int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType ke
* to these later, we want these to work in a sane way out of
* the box.
*/
- beztr.back = 1.70158f; /* "back" easing - this value used to be used when overshoot=0, but that */
- /* introduced discontinuities in how the param worked */
- beztr.amplitude = 0.8f; /* "elastic" easing - values here were hand-optimised for a default duration of */
- beztr.period = 4.1f; /* ~10 frames (typical mograph motion length) */
+ /* "back" easing - this value used to be used when overshoot=0, but that
+ * introduced discontinuities in how the param worked. */
+ beztr.back = 1.70158f;
+
+ /* "elastic" easing - values here were hand-optimised for a default duration of
+ * ~10 frames (typical mograph motion length) */
+ beztr.amplitude = 0.8f;
+ beztr.period = 4.1f;
/* add temp beztriple to keyframes */
a = insert_bezt_fcurve(fcu, &beztr, flag);
@@ -678,42 +677,73 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue)
/* ------------------ RNA Data-Access Functions ------------------ */
/* Try to read value using RNA-properties obtained already */
-static float setting_get_rna_value(Depsgraph *depsgraph, PointerRNA *ptr, PropertyRNA *prop, int index, const bool get_evaluated)
+static float *setting_get_rna_values(Depsgraph *depsgraph, PointerRNA *ptr, PropertyRNA *prop, const bool get_evaluated, float *buffer, int buffer_size, int *r_count)
{
- PointerRNA ptr_eval = *ptr;
- float value = 0.0f;
+ BLI_assert(buffer_size >= 1);
+
+ float *values = buffer;
+ PointerRNA ptr_eval;
if (get_evaluated) {
DEG_get_evaluated_rna_pointer(depsgraph, ptr, &ptr_eval);
+ ptr = &ptr_eval;
}
- switch (RNA_property_type(prop)) {
- case PROP_BOOLEAN:
- if (RNA_property_array_check(prop))
- value = (float)RNA_property_boolean_get_index(&ptr_eval, prop, index);
- else
- value = (float)RNA_property_boolean_get(&ptr_eval, prop);
- break;
- case PROP_INT:
- if (RNA_property_array_check(prop))
- value = (float)RNA_property_int_get_index(&ptr_eval, prop, index);
- else
- value = (float)RNA_property_int_get(&ptr_eval, prop);
- break;
- case PROP_FLOAT:
- if (RNA_property_array_check(prop))
- value = RNA_property_float_get_index(&ptr_eval, prop, index);
- else
- value = RNA_property_float_get(&ptr_eval, prop);
- break;
- case PROP_ENUM:
- value = (float)RNA_property_enum_get(&ptr_eval, prop);
- break;
- default:
- break;
+ if (RNA_property_array_check(prop)) {
+ int length = *r_count = RNA_property_array_length(ptr, prop);
+ bool *tmp_bool;
+ int *tmp_int;
+
+ if (length > buffer_size) {
+ values = MEM_malloc_arrayN(sizeof(float), length, __func__);
+ }
+
+ switch (RNA_property_type(prop)) {
+ case PROP_BOOLEAN:
+ tmp_bool = MEM_malloc_arrayN(sizeof(*tmp_bool), length, __func__);
+ RNA_property_boolean_get_array(ptr, prop, tmp_bool);
+ for (int i = 0; i < length; i++) {
+ values[i] = (float)tmp_bool[i];
+ }
+ MEM_freeN(tmp_bool);
+ break;
+ case PROP_INT:
+ tmp_int = MEM_malloc_arrayN(sizeof(*tmp_int), length, __func__);
+ RNA_property_int_get_array(ptr, prop, tmp_int);
+ for (int i = 0; i < length; i++) {
+ values[i] = (float)tmp_int[i];
+ }
+ MEM_freeN(tmp_int);
+ break;
+ case PROP_FLOAT:
+ RNA_property_float_get_array(ptr, prop, values);
+ break;
+ default:
+ memset(values, 0, sizeof(float) * length);
+ }
+ }
+ else {
+ *r_count = 1;
+
+ switch (RNA_property_type(prop)) {
+ case PROP_BOOLEAN:
+ *values = (float)RNA_property_boolean_get(ptr, prop);
+ break;
+ case PROP_INT:
+ *values = (float)RNA_property_int_get(ptr, prop);
+ break;
+ case PROP_FLOAT:
+ *values = RNA_property_float_get(ptr, prop);
+ break;
+ case PROP_ENUM:
+ *values = (float)RNA_property_enum_get(ptr, prop);
+ break;
+ default:
+ *values = 0.0f;
+ }
}
- return value;
+ return values;
}
/* ------------------ 'Visual' Keyframing Functions ------------------ */
@@ -869,8 +899,10 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
* In the event that it is not possible to perform visual keying, try to fall-back
* to using the default method. Assumes that all data it has been passed is valid.
*/
-static float visualkey_get_value(Depsgraph *depsgraph, PointerRNA *ptr, PropertyRNA *prop, int array_index)
+static float *visualkey_get_values(Depsgraph *depsgraph, PointerRNA *ptr, PropertyRNA *prop, float *buffer, int buffer_size, int *r_count)
{
+ BLI_assert(buffer_size >= 4);
+
const char *identifier = RNA_property_identifier(prop);
float tmat[4][4];
int rotmode;
@@ -888,7 +920,9 @@ static float visualkey_get_value(Depsgraph *depsgraph, PointerRNA *ptr, Property
/* Loc code is specific... */
if (strstr(identifier, "location")) {
- return ob_eval->obmat[3][array_index];
+ copy_v3_v3(buffer, ob_eval->obmat[3]);
+ *r_count = 3;
+ return buffer;
}
copy_m4_m4(tmat, ob_eval->obmat);
@@ -907,58 +941,162 @@ static float visualkey_get_value(Depsgraph *depsgraph, PointerRNA *ptr, Property
/* Loc code is specific... */
if (strstr(identifier, "location")) {
/* only use for non-connected bones */
- if ((pchan->bone->parent == NULL) || !(pchan->bone->flag & BONE_CONNECTED))
- return tmat[3][array_index];
+ if ((pchan->bone->parent == NULL) || !(pchan->bone->flag & BONE_CONNECTED)) {
+ copy_v3_v3(buffer, tmat[3]);
+ *r_count = 3;
+ return buffer;
+ }
}
}
else {
- return setting_get_rna_value(depsgraph, ptr, prop, array_index, true);
+ return setting_get_rna_values(depsgraph, ptr, prop, true, buffer, buffer_size, r_count);
}
/* Rot/Scale code are common! */
if (strstr(identifier, "rotation_euler")) {
- float eul[3];
+ mat4_to_eulO(buffer, rotmode, tmat);
- mat4_to_eulO(eul, rotmode, tmat);
- return eul[array_index];
+ *r_count = 3;
+ return buffer;
}
else if (strstr(identifier, "rotation_quaternion")) {
- float mat3[3][3], quat[4];
+ float mat3[3][3];
copy_m3_m4(mat3, tmat);
- mat3_to_quat_is_ok(quat, mat3);
+ mat3_to_quat_is_ok(buffer, mat3);
- return quat[array_index];
+ *r_count = 4;
+ return buffer;
}
else if (strstr(identifier, "rotation_axis_angle")) {
- float axis[3], angle;
-
- mat4_to_axis_angle(axis, &angle, tmat);
-
/* w = 0, x,y,z = 1,2,3 */
- if (array_index == 0)
- return angle;
- else
- return axis[array_index - 1];
+ mat4_to_axis_angle(buffer + 1, buffer, tmat);
+
+ *r_count = 4;
+ return buffer;
}
else if (strstr(identifier, "scale")) {
- float scale[3];
-
- mat4_to_size(scale, tmat);
+ mat4_to_size(buffer, tmat);
- return scale[array_index];
+ *r_count = 3;
+ return buffer;
}
/* as the function hasn't returned yet, read value from system in the default way */
- return setting_get_rna_value(depsgraph, ptr, prop, array_index, true);
+ return setting_get_rna_values(depsgraph, ptr, prop, true, buffer, buffer_size, r_count);
}
/* ------------------------- Insert Key API ------------------------- */
+/* Retrieve current property values to keyframe, possibly applying NLA correction when necessary. */
+static float *get_keyframe_values(
+ Depsgraph *depsgraph, ReportList *reports, PointerRNA ptr, PropertyRNA *prop, int index,
+ struct NlaKeyframingContext *nla_context, eInsertKeyFlags flag,
+ float *buffer, int buffer_size, int *r_count, bool *r_force_all)
+{
+ float *values;
+
+ if ( (flag & INSERTKEY_MATRIX) &&
+ (visualkey_can_use(&ptr, prop)) )
+ {
+ /* visual-keying is only available for object and pchan datablocks, as
+ * it works by keyframing using a value extracted from the final matrix
+ * instead of using the kt system to extract a value.
+ */
+ values = visualkey_get_values(depsgraph, &ptr, prop, buffer, buffer_size, r_count);
+ }
+ else {
+ /* read value from system */
+ values = setting_get_rna_values(depsgraph, &ptr, prop, false, buffer, buffer_size, r_count);
+ }
+
+ /* adjust the value for NLA factors */
+ if (!BKE_animsys_nla_remap_keyframe_values(nla_context, &ptr, prop, values, *r_count, index, r_force_all)) {
+ BKE_report(reports, RPT_ERROR, "Could not insert keyframe due to zero NLA influence or base value");
+
+ if (values != buffer) {
+ MEM_freeN(values);
+ }
+ return NULL;
+ }
+
+ return values;
+}
+
+/* Insert the specified keyframe value into a single F-Curve. */
+static bool insert_keyframe_value(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, FCurve *fcu, float cfra, float curval, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
+{
+ /* F-Curve not editable? */
+ if (fcurve_is_keyframable(fcu) == 0) {
+ BKE_reportf(reports, RPT_ERROR,
+ "F-Curve with path '%s[%d]' cannot be keyframed, ensure that it is not locked or sampled, "
+ "and try removing F-Modifiers",
+ fcu->rna_path, fcu->array_index);
+ return false;
+ }
+
+ /* adjust frame on which to add keyframe */
+ if ((flag & INSERTKEY_DRIVER) && (fcu->driver)) {
+ PathResolvedRNA anim_rna;
+
+ if (RNA_path_resolved_create(ptr, prop, fcu->array_index, &anim_rna)) {
+ /* for making it easier to add corrective drivers... */
+ cfra = evaluate_driver(&anim_rna, fcu->driver, fcu->driver, cfra);
+ }
+ else {
+ cfra = 0.0f;
+ }
+ }
+
+ /* adjust coordinates for cycle aware insertion */
+ if (flag & INSERTKEY_CYCLE_AWARE) {
+ if (remap_cyclic_keyframe_location(fcu, &cfra, &curval) != FCU_CYCLE_PERFECT) {
+ /* inhibit action from insert_vert_fcurve unless it's a perfect cycle */
+ flag &= ~INSERTKEY_CYCLE_AWARE;
+ }
+ }
+
+ /* only insert keyframes where they are needed */
+ if (flag & INSERTKEY_NEEDED) {
+ short insert_mode;
+
+ /* check whether this curve really needs a new keyframe */
+ insert_mode = new_key_needed(fcu, cfra, curval);
+
+ /* only return success if keyframe added */
+ if (insert_mode == KEYNEEDED_DONTADD) {
+ return false;
+ }
+
+ /* insert new keyframe at current frame */
+ if (insert_vert_fcurve(fcu, cfra, curval, keytype, flag) < 0) {
+ return false;
+ }
+
+ /* delete keyframe immediately before/after newly added */
+ switch (insert_mode) {
+ case KEYNEEDED_DELPREV:
+ delete_fcurve_key(fcu, fcu->totvert - 2, 1);
+ break;
+ case KEYNEEDED_DELNEXT:
+ delete_fcurve_key(fcu, 1, 1);
+ break;
+ }
+
+ return true;
+ }
+ else {
+ /* just insert keyframe */
+ return insert_vert_fcurve(fcu, cfra, curval, keytype, flag) >= 0;
+ }
+}
+
/* Secondary Keyframing API call:
* Use this when validation of necessary animation data is not necessary, since an RNA-pointer to the necessary
* data being keyframed, and a pointer to the F-Curve to use have both been provided.
*
+ * This function can't keyframe quaternion channels on some NLA strip types.
+ *
* keytype is the "keyframe type" (eBezTriple_KeyframeType), as shown in the Dope Sheet.
*
* The flag argument is used for special settings that alter the behavior of
@@ -974,14 +1112,6 @@ bool insert_keyframe_direct(Depsgraph *depsgraph, ReportList *reports, PointerRN
BKE_report(reports, RPT_ERROR, "No F-Curve to add keyframes to");
return false;
}
- /* F-Curve not editable? */
- if (fcurve_is_keyframable(fcu) == 0) {
- BKE_reportf(reports, RPT_ERROR,
- "F-Curve with path '%s[%d]' cannot be keyframed, ensure that it is not locked or sampled, "
- "and try removing F-Modifiers",
- fcu->rna_path, fcu->array_index);
- return false;
- }
/* if no property given yet, try to validate from F-Curve info */
if ((ptr.id.data == NULL) && (ptr.data == NULL)) {
@@ -1010,83 +1140,67 @@ bool insert_keyframe_direct(Depsgraph *depsgraph, ReportList *reports, PointerRN
/* update F-Curve flags to ensure proper behavior for property type */
update_autoflags_fcurve_direct(fcu, prop);
- /* adjust frame on which to add keyframe */
- if ((flag & INSERTKEY_DRIVER) && (fcu->driver)) {
- PathResolvedRNA anim_rna;
+ /* Obtain the value to insert. */
+ float value_buffer[RNA_MAX_ARRAY_LENGTH];
+ int value_count;
+ int index = fcu->array_index;
- if (RNA_path_resolved_create(&ptr, prop, fcu->array_index, &anim_rna)) {
- /* for making it easier to add corrective drivers... */
- cfra = evaluate_driver(&anim_rna, fcu->driver, fcu->driver, cfra);
- }
- else {
- cfra = 0.0f;
- }
- }
-
- /* obtain value to give keyframe */
- if ( (flag & INSERTKEY_MATRIX) &&
- (visualkey_can_use(&ptr, prop)) )
- {
- /* visual-keying is only available for object and pchan datablocks, as
- * it works by keyframing using a value extracted from the final matrix
- * instead of using the kt system to extract a value.
- */
- curval = visualkey_get_value(depsgraph, &ptr, prop, fcu->array_index);
- }
- else {
- /* read value from system */
- curval = setting_get_rna_value(depsgraph, &ptr, prop, fcu->array_index, false);
- }
+ float *values = get_keyframe_values(depsgraph, reports, ptr, prop, index, nla_context, flag,
+ value_buffer, RNA_MAX_ARRAY_LENGTH, &value_count, NULL);
- /* adjust the value for NLA factors */
- if (!BKE_animsys_nla_remap_keyframe_value(nla_context, &ptr, prop, fcu->array_index, &curval)) {
- BKE_report(reports, RPT_ERROR, "Could not insert keyframe due to zero NLA influence or base value");
+ if (values == NULL) {
+ /* This happens if NLA rejects this insertion. */
return false;
}
- /* adjust coordinates for cycle aware insertion */
- if (flag & INSERTKEY_CYCLE_AWARE) {
- if (remap_cyclic_keyframe_location(fcu, &cfra, &curval) != FCU_CYCLE_PERFECT) {
- /* inhibit action from insert_vert_fcurve unless it's a perfect cycle */
- flag &= ~INSERTKEY_CYCLE_AWARE;
- }
+ if (index >= 0 && index < value_count) {
+ curval = values[index];
}
- /* only insert keyframes where they are needed */
- if (flag & INSERTKEY_NEEDED) {
- short insert_mode;
-
- /* check whether this curve really needs a new keyframe */
- insert_mode = new_key_needed(fcu, cfra, curval);
+ if (values != value_buffer) {
+ MEM_freeN(values);
+ }
- /* insert new keyframe at current frame */
- if (insert_mode)
- insert_vert_fcurve(fcu, cfra, curval, keytype, flag);
+ return insert_keyframe_value(reports, &ptr, prop, fcu, cfra, curval, keytype, flag);
+}
- /* delete keyframe immediately before/after newly added */
- switch (insert_mode) {
- case KEYNEEDED_DELPREV:
- delete_fcurve_key(fcu, fcu->totvert - 2, 1);
- break;
- case KEYNEEDED_DELNEXT:
- delete_fcurve_key(fcu, 1, 1);
- break;
+/* Find or create the FCurve based on the given path, and insert the specified value into it. */
+static bool insert_keyframe_fcurve_value(
+ Main *bmain, ReportList *reports, PointerRNA *ptr, PropertyRNA *prop,
+ bAction *act, const char group[], const char rna_path[], int array_index,
+ float cfra, float curval, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
+{
+ /* make sure the F-Curve exists
+ * - if we're replacing keyframes only, DO NOT create new F-Curves if they do not exist yet
+ * but still try to get the F-Curve if it exists...
+ */
+ FCurve *fcu = verify_fcurve(bmain, act, group, ptr, rna_path, array_index, (flag & INSERTKEY_REPLACE) == 0);
+
+ /* we may not have a F-Curve when we're replacing only... */
+ if (fcu) {
+ /* set color mode if the F-Curve is new (i.e. without any keyframes) */
+ if ((fcu->totvert == 0) && (flag & INSERTKEY_XYZ2RGB)) {
+ /* for Loc/Rot/Scale and also Color F-Curves, the color of the F-Curve in the Graph Editor,
+ * is determined by the array index for the F-Curve
+ */
+ PropertySubType prop_subtype = RNA_property_subtype(prop);
+ if (ELEM(prop_subtype, PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR, PROP_COORDS)) {
+ fcu->color_mode = FCURVE_COLOR_AUTO_RGB;
+ }
+ else if (ELEM(prop_subtype, PROP_QUATERNION)) {
+ fcu->color_mode = FCURVE_COLOR_AUTO_YRGB;
+ }
}
- /* only return success if keyframe added */
- if (insert_mode)
- return true;
+ /* update F-Curve flags to ensure proper behavior for property type */
+ update_autoflags_fcurve_direct(fcu, prop);
+
+ /* insert keyframe */
+ return insert_keyframe_value(reports, ptr, prop, fcu, cfra, curval, keytype, flag);
}
else {
- /* just insert keyframe */
- insert_vert_fcurve(fcu, cfra, curval, keytype, flag);
-
- /* return success */
- return true;
+ return false;
}
-
- /* failed */
- return false;
}
/* Main Keyframing API call:
@@ -1105,10 +1219,8 @@ short insert_keyframe(
PointerRNA id_ptr, ptr;
PropertyRNA *prop = NULL;
AnimData *adt;
- FCurve *fcu;
ListBase tmp_nla_cache = {NULL, NULL};
NlaKeyframingContext *nla_context = NULL;
- int array_index_max = array_index + 1;
int ret = 0;
/* validate pointer first - exit if failure */
@@ -1149,48 +1261,58 @@ short insert_keyframe(
cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
}
- /* key entire array convenience method */
- if (array_index == -1) {
- array_index = 0;
- array_index_max = RNA_property_array_length(&ptr, prop);
+ /* Obtain values to insert. */
+ float value_buffer[RNA_MAX_ARRAY_LENGTH];
+ int value_count;
+ bool force_all;
- /* for single properties, increase max_index so that the property itself gets included,
- * but don't do this for standard arrays since that can cause corruption issues
- * (extra unused curves)
- */
- if (array_index_max == array_index)
- array_index_max++;
- }
+ float *values = get_keyframe_values(depsgraph, reports, ptr, prop, array_index, nla_context, flag,
+ value_buffer, RNA_MAX_ARRAY_LENGTH, &value_count, &force_all);
- /* will only loop once unless the array index was -1 */
- for (; array_index < array_index_max; array_index++) {
- /* make sure the F-Curve exists
- * - if we're replacing keyframes only, DO NOT create new F-Curves if they do not exist yet
- * but still try to get the F-Curve if it exists...
- */
- fcu = verify_fcurve(bmain, act, group, &ptr, rna_path, array_index, (flag & INSERTKEY_REPLACE) == 0);
-
- /* we may not have a F-Curve when we're replacing only... */
- if (fcu) {
- /* set color mode if the F-Curve is new (i.e. without any keyframes) */
- if ((fcu->totvert == 0) && (flag & INSERTKEY_XYZ2RGB)) {
- /* for Loc/Rot/Scale and also Color F-Curves, the color of the F-Curve in the Graph Editor,
- * is determined by the array index for the F-Curve
- */
- PropertySubType prop_subtype = RNA_property_subtype(prop);
- if (ELEM(prop_subtype, PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR, PROP_COORDS)) {
- fcu->color_mode = FCURVE_COLOR_AUTO_RGB;
+ if (values != NULL) {
+ /* Key the entire array. */
+ if (array_index == -1 || force_all) {
+ /* In force mode, if any of the curves succeeds, drop the replace mode and restart. */
+ if (force_all && (flag & INSERTKEY_REPLACE) != 0) {
+ int exclude = -1;
+
+ for (array_index = 0; array_index < value_count; array_index++) {
+ if (insert_keyframe_fcurve_value(bmain, reports, &ptr, prop, act, group, rna_path, array_index, cfra, values[array_index], keytype, flag)) {
+ ret++;
+ exclude = array_index;
+ break;
+ }
}
- else if (ELEM(prop_subtype, PROP_QUATERNION)) {
- fcu->color_mode = FCURVE_COLOR_AUTO_YRGB;
+
+ if (exclude != -1) {
+ flag &= ~INSERTKEY_REPLACE;
+
+ for (array_index = 0; array_index < value_count; array_index++) {
+ if (array_index != exclude) {
+ ret += insert_keyframe_fcurve_value(bmain, reports, &ptr, prop, act, group, rna_path, array_index, cfra, values[array_index], keytype, flag);
+ }
+ }
+ }
+ }
+ /* Simply insert all channels. */
+ else {
+ for (array_index = 0; array_index < value_count; array_index++) {
+ ret += insert_keyframe_fcurve_value(bmain, reports, &ptr, prop, act, group, rna_path, array_index, cfra, values[array_index], keytype, flag);
}
}
-
- /* insert keyframe */
- ret += insert_keyframe_direct(depsgraph, reports, ptr, prop, fcu, cfra, keytype, nla_context, flag);
+ }
+ /* Key a single index. */
+ else {
+ if (array_index >= 0 && array_index < value_count) {
+ ret += insert_keyframe_fcurve_value(bmain, reports, &ptr, prop, act, group, rna_path, array_index, cfra, values[array_index], keytype, flag);
+ }
}
}
+ if (values != value_buffer) {
+ MEM_freeN(values);
+ }
+
BKE_animsys_free_nla_keyframing_context_cache(&tmp_nla_cache);
if (ret) {
@@ -1243,6 +1365,20 @@ static bool delete_keyframe_fcurve(AnimData *adt, FCurve *fcu, float cfra)
return false;
}
+static void deg_tag_after_keyframe_delete(Main *bmain, ID *id, AnimData *adt)
+{
+ if (adt->action == NULL) {
+ /* In the case last f-curve wes removed need to inform dependency graph
+ * about relations update, since it needs to get rid of animation operation
+ * for this datablock. */
+ DEG_id_tag_update_ex(bmain, id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ }
+ else {
+ DEG_id_tag_update_ex(bmain, &adt->action->id, ID_RECALC_COPY_ON_WRITE);
+ }
+}
+
short delete_keyframe(Main *bmain, ReportList *reports, ID *id, bAction *act,
const char group[], const char rna_path[], int array_index, float cfra,
eInsertKeyFlags UNUSED(flag))
@@ -1319,12 +1455,8 @@ short delete_keyframe(Main *bmain, ReportList *reports, ID *id, bAction *act,
ret += delete_keyframe_fcurve(adt, fcu, cfra);
}
- /* In the case last f-curve wes removed need to inform dependency graph
- * about relations update, since it needs to get rid of animation operation
- * for this datablock. */
- if (ret && adt->action == NULL) {
- DEG_id_tag_update_ex(bmain, id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
+ if (ret) {
+ deg_tag_after_keyframe_delete(bmain, id, adt);
}
/* return success/failure */
return ret;
@@ -1415,12 +1547,8 @@ static short clear_keyframe(Main *bmain, ReportList *reports, ID *id, bAction *a
/* return success */
ret++;
}
- /* In the case last f-curve wes removed need to inform dependency graph
- * about relations update, since it needs to get rid of animation operation
- * for this datablock. */
- if (ret && adt->action == NULL) {
- DEG_id_tag_update_ex(bmain, id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
+ if (ret) {
+ deg_tag_after_keyframe_delete(bmain, id, adt);
}
/* return success/failure */
return ret;
@@ -2267,8 +2395,16 @@ bool fcurve_is_changed(PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float fra
anim_rna.prop = prop;
anim_rna.prop_index = fcu->array_index;
+ float buffer[RNA_MAX_ARRAY_LENGTH];
+ int count, index = fcu->array_index;
+ float *values = setting_get_rna_values(NULL, &ptr, prop, false, buffer, RNA_MAX_ARRAY_LENGTH, &count);
+
float fcurve_val = calculate_fcurve(&anim_rna, fcu, frame);
- float cur_val = setting_get_rna_value(NULL, &ptr, prop, fcu->array_index, false);
+ float cur_val = (index >= 0 && index < count) ? values[index] : 0.0f;
+
+ if (values != buffer) {
+ MEM_freeN(values);
+ }
return !compare_ff_relative(fcurve_val, cur_val, FLT_EPSILON, 64);
}
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index d980e4322dd..444e4634644 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/animation/keyingsets.c
- * \ingroup edanimation
+/** \file
+ * \ingroup edanimation
*/
@@ -615,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->scenes.first; scene; scene = scene->id.next)
BLI_remlink_safe(&scene->keyingsets, ks);
MEM_freeN(ks);
@@ -1026,7 +1018,8 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
RNA_id_pointer_create(ksp->id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, ksp->rna_path, &ptr, &prop)) {
arraylen = RNA_property_array_length(&ptr, prop);
- i = 0; /* start from start of array, instead of the previously specified index - T48020 */
+ /* start from start of array, instead of the previously specified index - T48020 */
+ i = 0;
}
}
diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt
index 96467ee2c2a..0dd213d3bef 100644
--- a/source/blender/editors/armature/CMakeLists.txt
+++ b/source/blender/editors/armature/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -50,8 +47,8 @@ set(SRC
editarmature_undo.c
meshlaplacian.c
pose_edit.c
- pose_lib.c
pose_group.c
+ pose_lib.c
pose_select.c
pose_slide.c
pose_transform.c
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c
index fb0766d3bed..20978a42812 100644
--- a/source/blender/editors/armature/armature_add.c
+++ b/source/blender/editors/armature/armature_add.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators and API's for creating bones
*/
-/** \file blender/editors/armature/armature_add.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "DNA_armature_types.h"
@@ -238,7 +231,7 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, const wmEv
copy_v3_v3(oldcurs, cursor->location);
- VECCOPY2D(mval_f, event->mval);
+ copy_v2fl_v2i(mval_f, event->mval);
ED_view3d_win_to_3d(v3d, ar, cursor->location, mval_f, tvec);
copy_v3_v3(cursor->location, tvec);
@@ -491,7 +484,9 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
EditBone *ebone_iter;
- EditBone *ebone_first_dupe = NULL; /* The beginning of the duplicated bones in the edbo list */
+ /* The beginning of the duplicated bones in the edbo list */
+ EditBone *ebone_first_dupe = NULL;
+
Object *ob = objects[ob_index];
bArmature *arm = ob->data;
@@ -664,7 +659,8 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op)
bArmature *arm = obedit->data;
EditBone *ebone_iter;
- EditBone *ebone_first_dupe = NULL; /* The beginning of the duplicated mirrored bones in the edbo list */
+ /* The beginning of the duplicated mirrored bones in the edbo list */
+ EditBone *ebone_first_dupe = NULL;
ED_armature_edit_sync_selection(arm->edbo); // XXX why is this needed?
@@ -845,7 +841,7 @@ void ARMATURE_OT_symmetrize(wmOperatorType *ot)
static const EnumPropertyItem arm_symmetrize_direction_items[] = {
{-1, "NEGATIVE_X", 0, "-X to +X", ""},
{+1, "POSITIVE_X", 0, "+X to -X", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index 7aa6b578475..f3a4fef2789 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Armature EditMode tools - transforms, chain based editing, and other settings
*/
-/** \file blender/editors/armature/armature_edit.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include <assert.h>
@@ -87,7 +80,7 @@ void ED_armature_transform_apply(Main *bmain, Object *ob, float mat[4][4], const
void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props)
{
EditBone *ebone;
- float scale = mat4_to_scale(mat); /* store the scale of the matrix here to use on envelopes */
+ float scale = mat4_to_scale(mat); /* store the scale of the matrix here to use on envelopes */
float mat3[3][3];
copy_m3_m4(mat3, mat);
@@ -141,7 +134,7 @@ void ED_armature_transform(Main *bmain, bArmature *arm, float mat[4][4], const b
/* exported for use in editors/object/ */
/* 0 == do center, 1 == center new, 2 == center cursor */
-void ED_armature_origin_set(Main *bmain, Object *ob, float cursor[3], int centermode, int around)
+void ED_armature_origin_set(Main *bmain, Object *ob, const float cursor[3], int centermode, int around)
{
const bool is_editmode = BKE_object_is_in_editmode(ob);
EditBone *ebone;
@@ -289,7 +282,7 @@ static const EnumPropertyItem prop_calc_roll_types[] = {
{CALC_ROLL_ACTIVE, "ACTIVE", 0, "Active Bone", ""},
{CALC_ROLL_VIEW, "VIEW", 0, "View Axis", ""},
{CALC_ROLL_CURSOR, "CURSOR", 0, "Cursor", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -1029,7 +1022,7 @@ void ARMATURE_OT_merge(wmOperatorType *ot)
{
static const EnumPropertyItem merge_types[] = {
{1, "WITHIN_CHAIN", 0, "Within Chains", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index da24787fc18..7fe4810762e 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/armature_intern.h
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#ifndef __ARMATURE_INTERN_H__
@@ -34,19 +27,19 @@
/* internal exports only */
struct wmOperatorType;
-struct bContext;
-struct Scene;
-struct Object;
struct Base;
+struct Object;
+struct Scene;
struct bAction;
+struct bContext;
struct bPoseChannel;
-struct bArmature;
-struct EditBone;
struct Bone;
+struct EditBone;
+struct bArmature;
-struct ListBase;
struct LinkData;
+struct ListBase;
/* ******************************************************* */
/* Armature EditMode Operators */
@@ -147,27 +140,35 @@ void POSE_OT_bone_layers(struct wmOperatorType *ot);
typedef struct tPChanFCurveLink {
struct tPChanFCurveLink *next, *prev;
- struct Object *ob; /* Object this Pose Channel belongs to. */
+ /** Object this Pose Channel belongs to. */
+ struct Object *ob;
- ListBase fcurves; /* F-Curves for this PoseChannel (wrapped with LinkData) */
- struct bPoseChannel *pchan; /* Pose Channel which data is attached to */
+ /** F-Curves for this PoseChannel (wrapped with LinkData) */
+ ListBase fcurves;
+ /** Pose Channel which data is attached to */
+ struct bPoseChannel *pchan;
- char *pchan_path; /* RNA Path to this Pose Channel (needs to be freed when we're done) */
+ /** RNA Path to this Pose Channel (needs to be freed when we're done) */
+ char *pchan_path;
- float oldloc[3]; /* transform values at start of operator (to be restored before each modal step) */
+ /** transform values at start of operator (to be restored before each modal step) */
+ float oldloc[3];
float oldrot[3];
float oldscale[3];
float oldquat[4];
float oldangle;
float oldaxis[3];
- float roll1, roll2; /* old bbone values (to be restored along with the transform properties) */
- float curveInX, curveInY; /* (NOTE: we haven't renamed these this time, as their names are already long enough) */
+ /** old bbone values (to be restored along with the transform properties) */
+ float roll1, roll2;
+ /** (NOTE: we haven't renamed these this time, as their names are already long enough) */
+ float curveInX, curveInY;
float curveOutX, curveOutY;
float ease1, ease2;
float scaleIn, scaleOut;
- struct IDProperty *oldprops; /* copy of custom properties at start of operator (to be restored before each modal step) */
+ /** copy of custom properties at start of operator (to be restored before each modal step) */
+ struct IDProperty *oldprops;
} tPChanFCurveLink;
/* ----------- */
diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c
index a027b00f3e1..6d4babe9674 100644
--- a/source/blender/editors/armature/armature_naming.c
+++ b/source/blender/editors/armature/armature_naming.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators and API's for renaming bones both in and out of Edit Mode
*/
-/** \file blender/editors/armature/armature_naming.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include <string.h>
@@ -52,7 +45,6 @@
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_deform.h"
-#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
@@ -185,7 +177,7 @@ void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep,
DEG_id_tag_update(&arm->id, ID_RECALC_COPY_ON_WRITE);
/* do entire dbase - objects */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md;
/* we have the object using the armature */
@@ -215,7 +207,7 @@ void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep,
}
/* Update any object constraints to use the new bone name */
- for (cob = bmain->object.first; cob; cob = cob->id.next) {
+ for (cob = bmain->objects.first; cob; cob = cob->id.next) {
if (cob->constraints.first)
constraint_bone_name_fix(ob, &cob->constraints, oldname, newname);
if (cob->pose) {
@@ -328,7 +320,7 @@ void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep,
/* correct view locking */
{
bScreen *screen;
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.first; screen; screen = screen->id.next) {
ScrArea *sa;
/* add regions */
for (sa = screen->areabase.first; sa; sa = sa->next) {
@@ -547,7 +539,7 @@ void ARMATURE_OT_autoside_names(wmOperatorType *ot)
{0, "XAXIS", 0, "X-Axis", "Left/Right"},
{1, "YAXIS", 0, "Y-Axis", "Front/Back"},
{2, "ZAXIS", 0, "Z-Axis", "Top/Bottom"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index b4c872c044d..36ca3dd486d 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/armature_ops.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "RNA_access.h"
diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c
index aadb805feda..5928e1cd12c 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for relations between bones and for transferring bones between armature objects
*/
-/** \file blender/editors/armature/armature_relations.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -48,7 +41,6 @@
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
-#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_report.h"
@@ -144,7 +136,8 @@ static void joined_armature_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data
const char *old_name = BLI_ghashIterator_getKey(&gh_iter);
const char *new_name = BLI_ghashIterator_getValue(&gh_iter);
- /* only remap if changed; this still means there will be some waste if there aren't many drivers/keys */
+ /* only remap if changed; this still means there will be some
+ * waste if there aren't many drivers/keys */
if (!STREQ(old_name, new_name) && strstr(fcu->rna_path, old_name)) {
fcu->rna_path = BKE_animsys_fix_rna_path_rename(id, fcu->rna_path, "pose.bones",
old_name, new_name, 0, 0, false);
@@ -212,7 +205,7 @@ static void joined_armature_fix_links(Main *bmain, Object *tarArm, Object *srcAr
bPoseChannel *pchant;
/* let's go through all objects in database */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
/* do some object-type specific things */
if (ob->type == OB_ARMATURE) {
pose = ob->pose;
@@ -424,7 +417,7 @@ static void separated_armature_fix_links(Main *bmain, Object *origArm, Object *n
npchans = &newArm->pose->chanbase;
/* let's go through all objects in database */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
/* do some object-type specific things */
if (ob->type == OB_ARMATURE) {
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
@@ -542,7 +535,8 @@ static void separate_armature_bones(Main *bmain, Object *ob, short sel)
for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
if (ebo->parent == curbone) {
ebo->parent = NULL;
- ebo->temp.p = NULL; /* this is needed to prevent random crashes with in ED_armature_from_edit */
+ /* this is needed to prevent random crashes with in ED_armature_from_edit */
+ ebo->temp.p = NULL;
ebo->flag &= ~BONE_CONNECTED;
}
}
@@ -623,7 +617,10 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
ED_armature_edit_free(obedit->data);
/* 2) duplicate base */
- newbase = ED_object_add_duplicate(bmain, scene, view_layer, oldbase, USER_DUP_ARM); /* only duplicate linked armature */
+
+ /* only duplicate linked armature */
+ newbase = ED_object_add_duplicate(bmain, scene, view_layer, oldbase, USER_DUP_ARM);
+
DEG_relations_tag_update(bmain);
newob = newbase->object;
@@ -750,7 +747,7 @@ static void bone_connect_to_new_parent(ListBase *edbo, EditBone *selbone, EditBo
static const EnumPropertyItem prop_editarm_make_parent_types[] = {
{ARM_PAR_CONNECT, "CONNECTED", 0, "Connected", ""},
{ARM_PAR_OFFSET, "OFFSET", 0, "Keep Offset", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int armature_parent_set_exec(bContext *C, wmOperator *op)
@@ -871,7 +868,7 @@ void ARMATURE_OT_parent_set(wmOperatorType *ot)
static const EnumPropertyItem prop_editarm_clear_parent_types[] = {
{1, "CLEAR", 0, "Clear Parent", ""},
{2, "DISCONNECT", 0, "Disconnect Bone", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void editbone_clear_parent(EditBone *ebone, int mode)
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 830798fa737..8d58ee28f5c 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* API's and Operators for selecting armature bones in EditMode
*/
-/** \file blender/editors/armature/armature_select.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -45,8 +38,6 @@
#include "BKE_report.h"
#include "BKE_layer.h"
-#include "BIF_gl.h"
-
#include "RNA_access.h"
#include "RNA_define.h"
@@ -77,7 +68,7 @@ Base *ED_armature_base_and_ebone_from_select_buffer(
EditBone *ebone = NULL;
/* TODO(campbell): optimize, eg: sort & binary search. */
for (uint base_index = 0; base_index < bases_len; base_index++) {
- if (bases[base_index]->object->select_color == hit_object) {
+ if (bases[base_index]->object->select_id == hit_object) {
base = bases[base_index];
break;
}
@@ -99,7 +90,7 @@ Object *ED_armature_object_and_ebone_from_select_buffer(
EditBone *ebone = NULL;
/* TODO(campbell): optimize, eg: sort & binary search. */
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
- if (objects[ob_index]->select_color == hit_object) {
+ if (objects[ob_index]->select_id == hit_object) {
ob = objects[ob_index];
break;
}
@@ -121,7 +112,7 @@ Base *ED_armature_base_and_bone_from_select_buffer(
Bone *bone = NULL;
/* TODO(campbell): optimize, eg: sort & binary search. */
for (uint base_index = 0; base_index < bases_len; base_index++) {
- if (bases[base_index]->object->select_color == hit_object) {
+ if (bases[base_index]->object->select_id == hit_object) {
base = bases[base_index];
break;
}
@@ -269,7 +260,8 @@ void *get_nearest_bone(
if (vc.obedit != NULL) {
bases = BKE_view_layer_array_from_bases_in_mode(
vc.view_layer, vc.v3d, &bases_len, {
- .object_mode = OB_MODE_EDIT});
+ .object_mode = OB_MODE_EDIT,
+ });
}
else {
bases = BKE_object_pose_base_array_get(vc.view_layer, vc.v3d, &bases_len);
@@ -1158,7 +1150,7 @@ static const EnumPropertyItem prop_similar_types[] = {
{SIMEDBONE_LAYER, "LAYER", 0, "Layer", ""},
{SIMEDBONE_GROUP, "GROUP", 0, "Group", ""},
{SIMEDBONE_SHAPE, "SHAPE", 0, "Shape", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static float bone_length_squared_worldspace_get(Object *ob, EditBone *ebone)
@@ -1613,7 +1605,7 @@ void ARMATURE_OT_select_hierarchy(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{BONE_SELECT_PARENT, "PARENT", 0, "Select Parent", ""},
{BONE_SELECT_CHILD, "CHILD", 0, "Select Child", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c
index 462c17e9008..5608479905a 100644
--- a/source/blender/editors/armature/armature_skinning.c
+++ b/source/blender/editors/armature/armature_skinning.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* API's for creating vertex groups from bones
* - Interfaces with heat weighting in meshlaplacian
*/
-/** \file blender/editors/armature/armature_skinning.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "DNA_mesh_types.h"
@@ -43,7 +36,6 @@
#include "BKE_action.h"
#include "BKE_armature.h"
-#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
@@ -378,7 +370,7 @@ static void add_verts_to_dgroups(
/* if in weight paint mode, use final verts from evaluated mesh */
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
BKE_mesh_foreach_mapped_vert_coords_get(me_eval, verts, mesh->totvert);
vertsfilled = 1;
diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c
index 275d00ded58..6b09912064e 100644
--- a/source/blender/editors/armature/armature_utils.c
+++ b/source/blender/editors/armature/armature_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/armature_utils.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "DNA_armature_types.h"
@@ -672,7 +666,9 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm)
if (eBone == arm->act_edbone) {
/* don't change active selection, this messes up separate which uses
* editmode toggle and can separate active bone which is de-selected originally */
- /* newBone->flag |= BONE_SELECTED; */ /* important, editbones can be active with only 1 point selected */
+
+ /* important, editbones can be active with only 1 point selected */
+ /* newBone->flag |= BONE_SELECTED; */
arm->act_bone = newBone;
}
newBone->roll = 0.0f;
@@ -707,8 +703,9 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm)
}
/* Fix parenting in a separate pass to ensure ebone->bone connections are valid at this point.
- * Do not set bone->head/tail here anymore, using EditBone data for that is not OK since our later fiddling
- * with parent's arm_mat (for roll conversion) may have some small but visible impact on locations (T46010). */
+ * Do not set bone->head/tail here anymore,
+ * using EditBone data for that is not OK since our later fiddling with parent's arm_mat
+ * (for roll conversion) may have some small but visible impact on locations (T46010). */
for (eBone = arm->edbo->first; eBone; eBone = eBone->next) {
newBone = eBone->temp.bone;
if (eBone->parent) {
@@ -733,7 +730,7 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm)
armature_finalize_restpose(&arm->bonebase, arm->edbo);
/* so all users of this armature should get rebuilt */
- for (obt = bmain->object.first; obt; obt = obt->id.next) {
+ for (obt = bmain->objects.first; obt; obt = obt->id.next) {
if (obt->data == arm) {
BKE_pose_rebuild(bmain, obt, arm, true);
}
diff --git a/source/blender/editors/armature/editarmature_undo.c b/source/blender/editors/armature/editarmature_undo.c
index 0fd94f664ab..39e8371a824 100644
--- a/source/blender/editors/armature/editarmature_undo.c
+++ b/source/blender/editors/armature/editarmature_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/editarmature_undo.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -35,7 +29,6 @@
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
-#include "BLI_math.h"
#include "BLI_array_utils.h"
#include "BKE_context.h"
@@ -150,13 +143,15 @@ static bool armature_undosys_poll(bContext *C)
return editarm_object_from_context(C) != NULL;
}
-static bool armature_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool armature_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
ArmatureUndoStep *us = (ArmatureUndoStep *)us_p;
+ /* Important not to use the 3D view when getting objects because all objects
+ * outside of this list will be moved out of edit-mode when reading back undo steps. */
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, NULL, &objects_len);
us->elems = MEM_callocN(sizeof(*us->elems) * objects_len, __func__);
us->elems_len = objects_len;
@@ -174,14 +169,15 @@ static bool armature_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void armature_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void armature_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(armature_undosys_poll(C));
-
ArmatureUndoStep *us = (ArmatureUndoStep *)us_p;
+ /* Load all our objects into edit-mode, clear everything else. */
+ ED_undo_object_editmode_restore_helper(C, &us->elems[0].obedit_ref.ptr, us->elems_len, sizeof(*us->elems));
+
+ BLI_assert(armature_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
ArmatureUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;
@@ -234,7 +230,6 @@ void ED_armature_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = armature_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(ArmatureUndoStep);
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 96799304845..34fea2e0996 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* 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): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* meshlaplacian.c: Algorithms using the mesh laplacian.
*/
-/** \file blender/editors/armature/meshlaplacian.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -806,7 +800,7 @@ void heat_bone_weighting(
#define MESHDEFORM_MIN_INFLUENCE 0.0005f
static const int MESHDEFORM_OFFSET[7][3] = {
- {0, 0, 0}, {1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}
+ {0, 0, 0}, {1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1},
};
typedef struct MDefBoundIsect {
@@ -903,9 +897,10 @@ static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *r
face[1] = mdb->cagecos[mloop[lt->tri[1]].v];
face[2] = mdb->cagecos[mloop[lt->tri[2]].v];
- if (!isect_ray_tri_watertight_v3(
- ray->origin, ray->isect_precalc, UNPACK3(face), &dist, NULL))
- {
+ bool isect_ray_tri = isect_ray_tri_watertight_v3(
+ ray->origin, ray->isect_precalc, UNPACK3(face), &dist, NULL);
+
+ if (!isect_ray_tri || dist > isec->vec_length) {
return;
}
@@ -1466,7 +1461,8 @@ static void harmonic_coordinates_bind(MeshDeformModifierData *mmd, MeshDeformBin
mdb->cagemesh_cache.mpoly = me->mpoly;
mdb->cagemesh_cache.mloop = me->mloop;
mdb->cagemesh_cache.looptri = BKE_mesh_runtime_looptri_ensure(me);
- mdb->cagemesh_cache.poly_nors = CustomData_get_layer(&me->pdata, CD_NORMAL); /* can be NULL */
+ /* can be NULL */
+ mdb->cagemesh_cache.poly_nors = CustomData_get_layer(&me->pdata, CD_NORMAL);
}
/* make bounding box equal size in all directions, add padding, and compute
diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h
index 6758f9d16ac..cf0c1de6b67 100644
--- a/source/blender/editors/armature/meshlaplacian.h
+++ b/source/blender/editors/armature/meshlaplacian.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,12 +13,11 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * ***** END GPL LICENSE BLOCK *****
* BIF_meshlaplacian.h: Algorithms using the mesh laplacian.
*/
-/** \file blender/editors/armature/meshlaplacian.h
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
@@ -29,8 +26,8 @@
//#define RIGID_DEFORM
-struct Object;
struct Mesh;
+struct Object;
struct bDeformGroup;
#ifdef RIGID_DEFORM
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 4b069deefa3..5920a69c60b 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Ton Roosendaal, Blender Foundation '05, full recode.
- * Joshua Leung
- * Reevan McKay (original NaN code)
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Pose Mode API's and Operators for Pose Mode armatures
*/
-/** \file blender/editors/armature/pose_edit.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -89,7 +80,7 @@ Object *ED_pose_object_from_context(bContext *C)
Object *ob;
/* since this call may also be used from the buttons window, we need to check for where to get the object */
- if (sa && sa->spacetype == SPACE_BUTS) {
+ if (sa && sa->spacetype == SPACE_PROPERTIES) {
ob = ED_object_context(C);
}
else {
@@ -532,210 +523,6 @@ void POSE_OT_paths_range_update(wmOperatorType *ot)
}
/* ********************************************** */
-#if 0 /* UNUSED 2.5 */
-static void pose_copy_menu(Scene *scene)
-{
- Object *obedit = scene->obedit; // XXX context
- Object *ob = OBACT;
- bArmature *arm;
- bPoseChannel *pchan, *pchanact;
- short nr = 0;
- int i = 0;
-
- /* paranoia checks */
- if (ELEM(NULL, ob, ob->pose)) return;
- if ((ob == obedit) || (ob->mode & OB_MODE_POSE) == 0) return;
-
- pchan = BKE_pose_channel_active(ob);
-
- if (pchan == NULL) return;
- pchanact = pchan;
- arm = ob->data;
-
- /* if proxy-protected bones selected, some things (such as locks + displays) shouldn't be changeable,
- * but for constraints (just add local constraints)
- */
- if (pose_has_protected_selected(ob, 0)) {
- i = BLI_listbase_count(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */
- if (i < 25)
- nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|Constraints... %x5");
- else
- nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4");
- }
- else {
- i = BLI_listbase_count(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */
- if (i < 25)
- nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|Constraints... %x5|%l|Transform Locks %x6|IK Limits %x7|Bone Shape %x8");
- else
- nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|%l|Transform Locks %x6|IK Limits %x7|Bone Shape %x8");
- }
-
- if (nr <= 0)
- return;
-
- if (nr != 5) {
- for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
- if ((arm->layer & pchan->bone->layer) &&
- (pchan->bone->flag & BONE_SELECTED) &&
- (pchan != pchanact) )
- {
- switch (nr) {
- case 1: /* Local Location */
- copy_v3_v3(pchan->loc, pchanact->loc);
- break;
- case 2: /* Local Rotation */
- copy_qt_qt(pchan->quat, pchanact->quat);
- copy_v3_v3(pchan->eul, pchanact->eul);
- break;
- case 3: /* Local Size */
- copy_v3_v3(pchan->size, pchanact->size);
- break;
- case 4: /* All Constraints */
- {
- ListBase tmp_constraints = {NULL, NULL};
-
- /* copy constraints to tmpbase and apply 'local' tags before
- * appending to list of constraints for this channel
- */
- BKE_constraints_copy(&tmp_constraints, &pchanact->constraints, true);
- if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
- bConstraint *con;
-
- /* add proxy-local tags */
- for (con = tmp_constraints.first; con; con = con->next)
- con->flag |= CONSTRAINT_PROXY_LOCAL;
- }
- BLI_movelisttolist(&pchan->constraints, &tmp_constraints);
-
- /* update flags (need to add here, not just copy) */
- pchan->constflag |= pchanact->constflag;
-
- if (ob->pose)
- BKE_pose_tag_recalc(bmain, ob->pose);
- }
- break;
- case 6: /* Transform Locks */
- pchan->protectflag = pchanact->protectflag;
- break;
- case 7: /* IK (DOF) settings */
- {
- pchan->ikflag = pchanact->ikflag;
- copy_v3_v3(pchan->limitmin, pchanact->limitmin);
- copy_v3_v3(pchan->limitmax, pchanact->limitmax);
- copy_v3_v3(pchan->stiffness, pchanact->stiffness);
- pchan->ikstretch = pchanact->ikstretch;
- pchan->ikrotweight = pchanact->ikrotweight;
- pchan->iklinweight = pchanact->iklinweight;
- }
- break;
- case 8: /* Custom Bone Shape */
- pchan->custom = pchanact->custom;
- if (pchan->custom) {
- id_us_plus(&pchan->custom->id);
- }
- break;
- case 9: /* Visual Location */
- BKE_armature_loc_pose_to_bone(pchan, pchanact->pose_mat[3], pchan->loc);
- break;
- case 10: /* Visual Rotation */
- {
- float delta_mat[4][4];
-
- BKE_armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
-
- if (pchan->rotmode == ROT_MODE_AXISANGLE) {
- float tmp_quat[4];
-
- /* need to convert to quat first (in temp var)... */
- mat4_to_quat(tmp_quat, delta_mat);
- quat_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, tmp_quat);
- }
- else if (pchan->rotmode == ROT_MODE_QUAT)
- mat4_to_quat(pchan->quat, delta_mat);
- else
- mat4_to_eulO(pchan->eul, pchan->rotmode, delta_mat);
- }
- break;
- case 11: /* Visual Size */
- {
- float delta_mat[4][4], size[4];
-
- BKE_armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
- mat4_to_size(size, delta_mat);
- copy_v3_v3(pchan->size, size);
- }
- }
- }
- }
- }
- else { /* constraints, optional (note: max we can have is 24 constraints) */
- bConstraint *con, *con_back;
- int const_toggle[24] = {0}; /* XXX, initialize as 0 to quiet errors */
- ListBase const_copy = {NULL, NULL};
-
- BLI_duplicatelist(&const_copy, &(pchanact->constraints));
-
- /* build the puplist of constraints */
- for (con = pchanact->constraints.first, i = 0; con; con = con->next, i++) {
- const_toggle[i] = 1;
-// add_numbut(i, UI_BTYPE_TOGGLE|INT, con->name, 0, 0, &(const_toggle[i]), "");
- }
-
-// if (!do_clever_numbuts("Select Constraints", i, REDRAW)) {
-// BLI_freelistN(&const_copy);
-// return;
-// }
-
- /* now build a new listbase from the options selected */
- for (i = 0, con = const_copy.first; con; i++) {
- /* if not selected, free/remove it from the list */
- if (!const_toggle[i]) {
- con_back = con->next;
- BLI_freelinkN(&const_copy, con);
- con = con_back;
- }
- else
- con = con->next;
- }
-
- /* Copy the temo listbase to the selected posebones */
- for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
- if ((arm->layer & pchan->bone->layer) &&
- (pchan->bone->flag & BONE_SELECTED) &&
- (pchan != pchanact) )
- {
- ListBase tmp_constraints = {NULL, NULL};
-
- /* copy constraints to tmpbase and apply 'local' tags before
- * appending to list of constraints for this channel
- */
- BKE_constraints_copy(&tmp_constraints, &const_copy, true);
- if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
- /* add proxy-local tags */
- for (con = tmp_constraints.first; con; con = con->next)
- con->flag |= CONSTRAINT_PROXY_LOCAL;
- }
- BLI_movelisttolist(&pchan->constraints, &tmp_constraints);
-
- /* update flags (need to add here, not just copy) */
- pchan->constflag |= pchanact->constflag;
- }
- }
- BLI_freelistN(&const_copy);
- BKE_pose_update_constraint_flags(ob->pose); /* we could work out the flags but its simpler to do this */
-
- if (ob->pose)
- BKE_pose_tag_recalc(bmain, ob->pose);
- }
-
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); // and all its relations
-
- BIF_undo_push("Copy Pose Attributes");
-
-}
-#endif
-
-/* ********************************************** */
static int pose_flip_names_exec(bContext *C, wmOperator *op)
{
@@ -827,7 +614,7 @@ void POSE_OT_autoside_names(wmOperatorType *ot)
{0, "XAXIS", 0, "X-Axis", "Left/Right"},
{1, "YAXIS", 0, "Y-Axis", "Front/Back"},
{2, "ZAXIS", 0, "Z-Axis", "Top/Bottom"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -888,7 +675,8 @@ void POSE_OT_rotation_mode_set(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_posebone_rotmode_items, 0, "Rotation Mode", "");
+ ot->prop = RNA_def_enum(
+ ot->srna, "type", rna_enum_object_rotation_mode_items, 0, "Rotation Mode", "");
}
/* ********************************************** */
@@ -926,7 +714,8 @@ static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op)
bArmature *arm = armature_layers_get_data(&ob);
PointerRNA ptr;
int maxLayers = (RNA_boolean_get(op->ptr, "all")) ? 32 : 16;
- bool layers[32] = {false}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32] = {false};
int i;
/* sanity checking */
@@ -978,7 +767,8 @@ static int armature_layers_invoke(bContext *C, wmOperator *op, const wmEvent *ev
Object *ob = CTX_data_active_object(C);
bArmature *arm = armature_layers_get_data(&ob);
PointerRNA ptr;
- bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32];
/* sanity checking */
if (arm == NULL)
@@ -999,7 +789,8 @@ static int armature_layers_exec(bContext *C, wmOperator *op)
Object *ob = CTX_data_active_object(C);
bArmature *arm = armature_layers_get_data(&ob);
PointerRNA ptr;
- bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32];
if (arm == NULL) {
return OPERATOR_CANCELLED;
@@ -1043,7 +834,8 @@ void ARMATURE_OT_armature_layers(wmOperatorType *ot)
/* Present a popup to get the layers that should be used */
static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- bool layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32] = {0};
/* get layers that are active already */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
@@ -1068,7 +860,8 @@ static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *e
static int pose_bone_layers_exec(bContext *C, wmOperator *op)
{
PointerRNA ptr;
- bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32];
/* get the values set in the operator properties */
RNA_boolean_get_array(op->ptr, "layers", layers);
@@ -1117,7 +910,8 @@ void POSE_OT_bone_layers(wmOperatorType *ot)
/* Present a popup to get the layers that should be used */
static int armature_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- bool layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32] = {0};
/* get layers that are active already */
CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones)
@@ -1145,7 +939,8 @@ static int armature_bone_layers_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);
PointerRNA ptr;
- bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32];
/* get the values set in the operator properties */
RNA_boolean_get_array(op->ptr, "layers", layers);
diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c
index 543645b5c1f..0d1f899ce36 100644
--- a/source/blender/editors/armature/pose_group.c
+++ b/source/blender/editors/armature/pose_group.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation
* All rights reserved.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Implementation of Bone Groups operators and editing API's
*/
-/** \file blender/editors/armature/pose_group.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include <string.h>
@@ -337,7 +330,7 @@ void POSE_OT_group_move(wmOperatorType *ot)
static const EnumPropertyItem group_slot_move[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 14706f89607..7ba6db92a47 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2007, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/pose_lib.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include <string.h>
@@ -46,7 +40,6 @@
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_armature.h"
-#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_main.h"
@@ -167,7 +160,7 @@ static Object *get_poselib_object(bContext *C)
sa = CTX_wm_area(C);
- if (sa && (sa->spacetype == SPACE_BUTS))
+ if (sa && (sa->spacetype == SPACE_PROPERTIES))
return ED_object_context(C);
else
return BKE_object_pose_armature_get(CTX_data_active_object(C));
@@ -498,7 +491,10 @@ static int poselib_add_exec(bContext *C, wmOperator *op)
BLI_uniquename(&act->markers, marker, DATA_("Pose"), '.', offsetof(TimeMarker, name), sizeof(marker->name));
/* use Keying Set to determine what to store for the pose */
- ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_WHOLE_CHARACTER_SELECTED_ID); /* this includes custom props :)*/
+
+ /* this includes custom props :)*/
+ ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_WHOLE_CHARACTER_SELECTED_ID);
+
ANIM_apply_keyingset(C, NULL, act, ks, MODIFYKEY_MODE_INSERT, (float)frame);
/* store new 'active' pose number */
@@ -730,7 +726,8 @@ void POSELIB_OT_pose_rename(wmOperatorType *ot)
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 */
+ /* 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");
prop = RNA_def_enum(ot->srna, "pose", DummyRNA_NULL_items, 0, "Pose", "The pose to rename");
RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
@@ -792,7 +789,7 @@ void POSELIB_OT_pose_move(wmOperatorType *ot)
static const EnumPropertyItem pose_lib_pose_move[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -825,30 +822,49 @@ void POSELIB_OT_pose_move(wmOperatorType *ot)
/* Simple struct for storing settings/data for use during PoseLib preview */
typedef struct tPoseLib_PreviewData {
- ListBase backups; /* tPoseLib_Backup structs for restoring poses */
- ListBase searchp; /* LinkData structs storing list of poses which match the current search-string */
-
- Scene *scene; /* active scene */
- ScrArea *sa; /* active area */
-
- PointerRNA rna_ptr; /* RNA-Pointer to Object 'ob' */
- Object *ob; /* object to work on */
- bArmature *arm; /* object's armature data */
- bPose *pose; /* object's pose */
- bAction *act; /* poselib to use */
- TimeMarker *marker; /* 'active' pose */
-
- int totcount; /* total number of elements to work on */
-
- short state; /* state of main loop */
- short redraw; /* redraw/update settings during main loop */
- short flag; /* flags for various settings */
+ /** tPoseLib_Backup structs for restoring poses. */
+ ListBase backups;
+ /** LinkData structs storing list of poses which match the current search-string. */
+ ListBase searchp;
+
+ /** active scene. */
+ Scene *scene;
+ /** active area. */
+ ScrArea *sa;
- short search_cursor; /* position of cursor in searchstr (cursor occurs before the item at the nominated index) */
- char searchstr[64]; /* (Part of) Name to search for to filter poses that get shown */
- char searchold[64]; /* Previously set searchstr (from last loop run), so that we can detected when to rebuild searchp */
+ /** RNA-Pointer to Object 'ob' .*/
+ PointerRNA rna_ptr;
+ /** object to work on. */
+ Object *ob;
+ /** object's armature data. */
+ bArmature *arm;
+ /** object's pose. */
+ bPose *pose;
+ /** poselib to use. */
+ bAction *act;
+ /** 'active' pose. */
+ TimeMarker *marker;
- char headerstr[UI_MAX_DRAW_STR]; /* Info-text to print in header */
+ /** total number of elements to work on. */
+ int totcount;
+
+ /** state of main loop. */
+ short state;
+ /** redraw/update settings during main loop. */
+ short redraw;
+ /** flags for various settings. */
+ short flag;
+
+ /** position of cursor in searchstr (cursor occurs before the item at the nominated index) */
+ short search_cursor;
+ /** (Part of) Name to search for to filter poses that get shown. */
+ char searchstr[64];
+ /** Previously set searchstr (from last loop run),
+ * so that we can detected when to rebuild searchp. */
+ char searchold[64];
+
+ /** Info-text to print in header. */
+ char headerstr[UI_MAX_DRAW_STR];
} tPoseLib_PreviewData;
/* defines for tPoseLib_PreviewData->state values */
@@ -857,7 +873,7 @@ enum {
PL_PREVIEW_RUNNING,
PL_PREVIEW_CONFIRM,
PL_PREVIEW_CANCEL,
- PL_PREVIEW_RUNONCE
+ PL_PREVIEW_RUNONCE,
};
/* defines for tPoseLib_PreviewData->redraw values */
@@ -944,7 +960,8 @@ static void poselib_backup_restore(tPoseLib_PreviewData *pld)
if (plb->oldprops)
IDP_SyncGroupValues(plb->pchan->prop, plb->oldprops);
- /* TODO: constraints settings aren't restored yet, even though these could change (though not that likely) */
+ /* TODO: constraints settings aren't restored yet,
+ * even though these could change (though not that likely) */
}
}
@@ -1766,7 +1783,11 @@ void POSELIB_OT_browse_interactive(wmOperatorType *ot)
// XXX: percentage vs factor?
/* not used yet */
- /* RNA_def_float_factor(ot->srna, "blend_factor", 1.0f, 0.0f, 1.0f, "Blend Factor", "Amount that the pose is applied on top of the existing poses", 0.0f, 1.0f); */
+#if 0
+ RNA_def_float_factor(
+ ot->srna, "blend_factor", 1.0f, 0.0f, 1.0f, "Blend Factor",
+ "Amount that the pose is applied on top of the existing poses", 0.0f, 1.0f);
+#endif
}
void POSELIB_OT_apply_pose(wmOperatorType *ot)
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c
index 184c09f5b10..285901f8dd0 100644
--- a/source/blender/editors/armature/pose_select.c
+++ b/source/blender/editors/armature/pose_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/pose_select.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include <string.h>
@@ -107,8 +101,7 @@ void ED_pose_bone_select_tag_update(Object *ob)
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
- /* copy on write tag is needed (for the armature), or else no refresh happens */
- DEG_id_tag_update(&arm->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_id_tag_update(&arm->id, ID_RECALC_SELECT);
}
@@ -239,7 +232,8 @@ bool ED_armature_pose_select_pick_with_buffer(
}
/* 'select_mode' is usual SEL_SELECT/SEL_DESELECT/SEL_TOGGLE/SEL_INVERT.
- * When true, 'ignore_visibility' makes this func also affect invisible bones (hidden or on hidden layers). */
+ * When true, 'ignore_visibility' makes this func also affect invisible bones
+ * (hidden or on hidden layers). */
bool ED_pose_deselect_all(Object *ob, int select_mode, const bool ignore_visibility)
{
bArmature *arm = ob->data;
@@ -643,7 +637,7 @@ void POSE_OT_select_hierarchy(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{BONE_SELECT_PARENT, "PARENT", 0, "Select Parent", ""},
{BONE_SELECT_CHILD, "CHILD", 0, "Select Child", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -988,7 +982,7 @@ void POSE_OT_select_grouped(wmOperatorType *ot)
{POSE_SEL_SAME_LAYER, "LAYER", 0, "Layer", "Shared layers"},
{POSE_SEL_SAME_GROUP, "GROUP", 0, "Group", "Shared group"},
{POSE_SEL_SAME_KEYINGSET, "KEYINGSET", 0, "Keying Set", "All bones affected by active Keying Set"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index 52e580a94af..769398e9e0c 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/pose_slide.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -87,28 +81,43 @@
/* Temporary data shared between these operators */
typedef struct tPoseSlideOp {
- Scene *scene; /* current scene */
- ScrArea *sa; /* area that we're operating in (needed for modal()) */
- ARegion *ar; /* region that we're operating in (needed for modal()) */
- uint objects_len; /* len of the PoseSlideObject array. */
-
- ListBase pfLinks; /* links between posechannels and f-curves for all the pose objects. */
- DLRBT_Tree keys; /* binary tree for quicker searching for keyframes (when applicable) */
+ /** current scene */
+ Scene *scene;
+ /** area that we're operating in (needed for modal()) */
+ ScrArea *sa;
+ /** region that we're operating in (needed for modal()) */
+ ARegion *ar;
+ /** len of the PoseSlideObject array. */
+ uint objects_len;
+
+ /** links between posechannels and f-curves for all the pose objects. */
+ ListBase pfLinks;
+ /** binary tree for quicker searching for keyframes (when applicable) */
+ DLRBT_Tree keys;
- int cframe; /* current frame number - global time */
+ /** current frame number - global time */
+ int cframe;
- int prevFrame; /* frame before current frame (blend-from) - global time */
- int nextFrame; /* frame after current frame (blend-to) - global time */
+ /** frame before current frame (blend-from) - global time */
+ int prevFrame;
+ /** frame after current frame (blend-to) - global time */
+ int nextFrame;
- short mode; /* sliding mode (ePoseSlide_Modes) */
- short flag; /* unused for now, but can later get used for storing runtime settings.... */
+ /** sliding mode (ePoseSlide_Modes) */
+ short mode;
+ /** unused for now, but can later get used for storing runtime settings.... */
+ short flag;
- short channels; /* which transforms/channels are affected (ePoseSlide_Channels) */
- short axislock; /* axis-limits for transforms (ePoseSlide_AxisLock) */
+ /** which transforms/channels are affected (ePoseSlide_Channels) */
+ short channels;
+ /** axis-limits for transforms (ePoseSlide_AxisLock) */
+ short axislock;
- float percentage; /* 0-1 value for determining the influence of whatever is relevant */
+ /** 0-1 value for determining the influence of whatever is relevant */
+ float percentage;
- NumInput num; /* numeric input */
+ /** numeric input */
+ NumInput num;
struct tPoseSlideObject *ob_data_array;
} tPoseSlideOp;
@@ -150,14 +159,14 @@ static const EnumPropertyItem prop_channels_types[] = {
{PS_TFM_SIZE, "SIZE", 0, "Scale", "Scale only"},
{PS_TFM_BBONE_SHAPE, "BBONE", 0, "Bendy Bone", "Bendy Bone shape properties"},
{PS_TFM_PROPS, "CUSTOM", 0, "Custom Properties", "Custom properties"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Axis Locks */
typedef enum ePoseSlide_AxisLock {
PS_LOCK_X = (1 << 0),
PS_LOCK_Y = (1 << 1),
- PS_LOCK_Z = (1 << 2)
+ PS_LOCK_Z = (1 << 2),
} ePoseSlide_AxisLock;
/* Property enum for ePoseSlide_AxisLock */
@@ -167,7 +176,7 @@ static const EnumPropertyItem prop_axis_lock_types[] = {
{PS_LOCK_Y, "Y", 0, "Y", "Only Y-axis transforms are affected"},
{PS_LOCK_Z, "Z", 0, "Z", "Only Z-axis transforms are affected"},
/* TODO: Combinations? */
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* ------------------------------------ */
@@ -198,8 +207,7 @@ static int pose_slide_init(bContext *C, wmOperator *op, ePoseSlide_Modes mode)
pso->axislock = RNA_enum_get(op->ptr, "axis_lock");
/* for each Pose-Channel which gets affected, get the F-Curves for that channel
- * and set the relevant transform flags...
- */
+ * and set the relevant transform flags... */
poseAnim_mapping_get(C, &pso->pfLinks);
Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(CTX_data_view_layer(C),
@@ -361,7 +369,8 @@ static void pose_slide_apply_val(
* - numerator should be larger than denominator to 'expand' the result
* - perform this weighting a number of times given by the percentage...
*/
- int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ int iters = (int)ceil(10.0f * pso->percentage);
while (iters-- > 0) {
(*val) = (-((sVal * w2) + (eVal * w1)) + ((*val) * 6.0f) ) / 5.0f;
@@ -374,7 +383,8 @@ static void pose_slide_apply_val(
* - numerator should be smaller than denominator to 'relax' the result
* - perform this weighting a number of times given by the percentage...
*/
- int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ int iters = (int)ceil(10.0f * pso->percentage);
while (iters-- > 0) {
(*val) = ( ((sVal * w2) + (eVal * w1)) + ((*val) * 5.0f) ) / 6.0f;
@@ -579,7 +589,8 @@ static void pose_slide_apply_quat(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
}
else {
float quat_interp[4], quat_orig[4];
- int iters = (int)ceil(10.0f * pso->percentage); /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ /* TODO: maybe a sensitivity ctrl on top of this is needed */
+ int iters = (int)ceil(10.0f * pso->percentage);
/* perform this blending several times until a satisfactory result is reached */
while (iters-- > 0) {
@@ -1647,7 +1658,8 @@ void POSE_OT_propagate(wmOperatorType *ot)
"Propagate pose to all selected keyframes"},
{POSE_PROPAGATE_SELECTED_MARKERS, "SELECTED_MARKERS", 0, "On Selected Markers",
"Propagate pose to all keyframes occurring on frames with Scene Markers after the current frame"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Propagate Pose";
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index ffbe8b52137..3c21919a7ac 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/pose_transform.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "DNA_anim_types.h"
@@ -45,7 +39,6 @@
#include "BKE_blender_copybuffer.h"
#include "BKE_context.h"
#include "BKE_deform.h"
-#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_main.h"
@@ -72,7 +65,8 @@
/* ********************************************** */
/* Pose Apply */
-/* helper for apply_armature_pose2bones - fixes parenting of objects that are bone-parented to armature */
+/* helper for apply_armature_pose2bones - fixes parenting of objects
+ * that are bone-parented to armature */
static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Object *armob)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
@@ -80,7 +74,7 @@ static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Objec
Object workob, *ob;
/* go through all objects in database */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
/* if parent is bone in this armature, apply corrections */
if ((ob->parent == armob) && (ob->partype == PARBONE)) {
/* apply current transform from parent (not yet destroyed),
@@ -100,7 +94,8 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
- Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
+ // must be active object, not edit-object
+ Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
bArmature *arm = BKE_armature_from_object(ob);
bPose *pose;
@@ -111,7 +106,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
if (ob->type != OB_ARMATURE)
return OPERATOR_CANCELLED;
if (BKE_object_obdata_is_libdata(ob)) {
- BKE_report(op->reports, RPT_ERROR, "Cannot apply pose to lib-linked armature"); /* error_libdata(); */
+ BKE_report(op->reports, RPT_ERROR, "Cannot apply pose to lib-linked armature");
return OPERATOR_CANCELLED;
}
@@ -476,8 +471,8 @@ static int pose_copy_exec(bContext *C, wmOperator *op)
Object ob_copy = *ob;
bArmature arm_copy = *((bArmature *)ob->data);
ob_copy.data = &arm_copy;
- BLI_addtail(&temp_bmain->object, &ob_copy);
- BLI_addtail(&temp_bmain->armature, &arm_copy);
+ BLI_addtail(&temp_bmain->objects, &ob_copy);
+ BLI_addtail(&temp_bmain->armatures, &arm_copy);
/* begin copy buffer on a temp bmain. */
BKE_copybuffer_begin(temp_bmain);
/* Store the whole object to the copy buffer because pose can't be
@@ -490,8 +485,8 @@ static int pose_copy_exec(bContext *C, wmOperator *op)
* This is required because objects in temp bmain shares same pointers
* as the real ones.
*/
- BLI_listbase_clear(&temp_bmain->object);
- BLI_listbase_clear(&temp_bmain->armature);
+ BLI_listbase_clear(&temp_bmain->objects);
+ BLI_listbase_clear(&temp_bmain->armatures);
BKE_main_free(temp_bmain);
/* We are all done! */
BKE_report(op->reports, RPT_INFO, "Copied pose to buffer");
@@ -541,13 +536,13 @@ static int pose_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
/* Make sure data from this file is usable for pose paste. */
- if (BLI_listbase_count_at_most(&tmp_bmain->object, 2) != 1) {
+ if (BLI_listbase_count_at_most(&tmp_bmain->objects, 2) != 1) {
BKE_report(op->reports, RPT_ERROR, "Copy buffer is not from pose mode");
BKE_main_free(tmp_bmain);
return OPERATOR_CANCELLED;
}
- Object *object_from = tmp_bmain->object.first;
+ Object *object_from = tmp_bmain->objects.first;
bPose *pose_from = object_from->pose;
if (pose_from == NULL) {
BKE_report(op->reports, RPT_ERROR, "Copy buffer has no pose");
@@ -745,7 +740,8 @@ static void pchan_clear_rot(bPoseChannel *pchan)
}
}
- /* Clear also Bendy Bone stuff - Roll is obvious, but Curve X/Y stuff is also kindof rotational in nature... */
+ /* Clear also Bendy Bone stuff - Roll is obvious,
+ * but Curve X/Y stuff is also kindof rotational in nature... */
pchan->roll1 = 0.0f;
pchan->roll2 = 0.0f;
diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c
index 051940d69ec..ad8cff70e27 100644
--- a/source/blender/editors/armature/pose_utils.c
+++ b/source/blender/editors/armature/pose_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009, Blender Foundation, Joshua Leung
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/armature/pose_utils.c
- * \ingroup edarmature
+/** \file
+ * \ingroup edarmature
*/
#include "MEM_guardedalloc.h"
@@ -41,7 +35,6 @@
#include "BKE_armature.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
-#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_context.h"
@@ -244,7 +237,8 @@ void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
else
BKE_pose_where_is(depsgraph, scene, ob);
- DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE); /* otherwise animation doesn't get updated */
+ /* otherwise animation doesn't get updated */
+ DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
}
diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt
index 301d333ebdb..9d1b463ec42 100644
--- a/source/blender/editors/curve/CMakeLists.txt
+++ b/source/blender/editors/curve/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h
index b28f546ee96..c741b5393dc 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/curve_intern.h
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
@@ -33,12 +26,12 @@
#define __CURVE_INTERN_H__
/* internal exports only */
-struct ListBase;
struct EditNurb;
struct GHash;
+struct ListBase;
struct Object;
-struct wmOperatorType;
struct ViewContext;
+struct wmOperatorType;
/* editfont.c */
enum { DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_NEXT_WORD, DEL_PREV_WORD, DEL_SELECTION, DEL_NEXT_SEL, DEL_PREV_SEL };
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index bd1c2248660..de6fe686356 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/curve_ops.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 84f8f17d4ee..fe3ac8fc947 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editcurve.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include "DNA_key_types.h"
@@ -160,8 +152,9 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
pt_index = 0;
while (a--) {
/* We cannot keep *any* reference to curve obdata,
- * it might be replaced and freed while editcurve remain in use (in viewport render case e.g.).
- * Note that we could use a pool to avoid lots of malloc's here, but... not really a problem for now. */
+ * it might be replaced and freed while editcurve remain in use
+ * (in viewport render case e.g.). Note that we could use a pool to avoid
+ * lots of malloc's here, but... not really a problem for now. */
BezTriple *origbezt_cpy = MEM_mallocN(sizeof(*origbezt), __func__);
*origbezt_cpy = *origbezt;
keyIndex = init_cvKeyIndex(origbezt_cpy, key_index, nu_index, pt_index, vertex_index);
@@ -180,8 +173,9 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
pt_index = 0;
while (a--) {
/* We cannot keep *any* reference to curve obdata,
- * it might be replaced and freed while editcurve remain in use (in viewport render case e.g.).
- * Note that we could use a pool to avoid lots of malloc's here, but... not really a problem for now. */
+ * it might be replaced and freed while editcurve remain in use
+ * (in viewport render case e.g.). Note that we could use a pool to avoid
+ * lots of malloc's here, but... not really a problem for now. */
BPoint *origbp_cpy = MEM_mallocN(sizeof(*origbp_cpy), __func__);
*origbp_cpy = *origbp;
keyIndex = init_cvKeyIndex(origbp_cpy, key_index, nu_index, pt_index, vertex_index);
@@ -541,14 +535,14 @@ static void key_to_bezt(float *key, BezTriple *basebezt, BezTriple *bezt)
{
memcpy(bezt, basebezt, sizeof(BezTriple));
memcpy(bezt->vec, key, sizeof(float) * 9);
- bezt->alfa = key[9];
+ bezt->tilt = key[9];
bezt->radius = key[10];
}
static void bezt_to_key(BezTriple *bezt, float *key)
{
memcpy(key, bezt->vec, sizeof(float) * 9);
- key[9] = bezt->alfa;
+ key[9] = bezt->tilt;
key[10] = bezt->radius;
}
@@ -648,7 +642,7 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
nu = editnurb->nurbs.first;
while (nu) {
if (nu->bezt) {
- /* Three vects to store handles and one for alfa */
+ /* Three vects to store handles and one for tilt. */
totvec += nu->pntsu * 4;
}
else {
@@ -674,7 +668,7 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
sub_v3_v3v3(ofs[i], bezt->vec[j], oldbezt->vec[j]);
i++;
}
- ofs[i][0] = bezt->alfa - oldbezt->alfa;
+ ofs[i][0] = bezt->tilt - oldbezt->tilt;
ofs[i][1] = bezt->radius - oldbezt->radius;
i++;
}
@@ -691,7 +685,7 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
oldbp = getKeyIndexOrig_bp(editnurb, bp);
if (oldbp) {
sub_v3_v3v3(ofs[i], bp->vec, oldbp->vec);
- ofs[i + 1][0] = bp->alfa - oldbp->alfa;
+ ofs[i + 1][0] = bp->tilt - oldbp->tilt;
ofs[i + 1][1] = bp->radius - oldbp->radius;
}
i += 2;
@@ -736,11 +730,11 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
copy_v3_v3(newbezt->vec[j], oldbezt->vec[j]);
}
}
- fp[9] = bezt->alfa;
+ fp[9] = bezt->tilt;
fp[10] = bezt->radius;
if (restore && oldbezt) {
- newbezt->alfa = oldbezt->alfa;
+ newbezt->tilt = oldbezt->tilt;
newbezt->radius = oldbezt->radius;
}
@@ -759,12 +753,12 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
copy_v3_v3(fp, bp->vec);
- fp[3] = bp->alfa;
+ fp[3] = bp->tilt;
fp[4] = bp->radius;
if (restore && oldbp) {
copy_v3_v3(newbp->vec, oldbp->vec);
- newbp->alfa = oldbp->alfa;
+ newbp->tilt = oldbp->tilt;
newbp->radius = oldbp->radius;
}
@@ -801,7 +795,7 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
fp[10] = curofp[10];
if (apply_offset) {
- /* apply alfa offsets */
+ /* Apply tilt offsets. */
add_v3_v3(fp + 9, ofs[i]);
i++;
}
@@ -813,7 +807,7 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
for (j = 0; j < 3; j++, i++) {
copy_v3_v3(&fp[j * 3], bezt->vec[j]);
}
- fp[9] = bezt->alfa;
+ fp[9] = bezt->tilt;
fp[10] = bezt->radius;
fp += KEYELEM_FLOAT_LEN_BEZTRIPLE;
@@ -840,7 +834,7 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
}
else {
copy_v3_v3(fp, bp->vec);
- fp[3] = bp->alfa;
+ fp[3] = bp->tilt;
fp[4] = bp->radius;
}
@@ -1027,7 +1021,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
}
/* return 0 if animation data wasn't changed, 1 otherwise */
-int ED_curve_updateAnimPaths(Curve *cu)
+int ED_curve_updateAnimPaths(Main *bmain, Curve *cu)
{
AnimData *adt = BKE_animdata_from_id(&cu->id);
EditNurb *editnurb = cu->editnurb;
@@ -1037,10 +1031,16 @@ int ED_curve_updateAnimPaths(Curve *cu)
if (!curve_is_animated(cu)) return 0;
- if (adt->action)
+ if (adt->action != NULL) {
curve_rename_fcurves(cu, &adt->action->curves);
+ DEG_id_tag_update(&adt->action->id, ID_RECALC_COPY_ON_WRITE);
+ }
curve_rename_fcurves(cu, &adt->drivers);
+ DEG_id_tag_update(&cu->id, ID_RECALC_COPY_ON_WRITE);
+
+ /* TODO(sergey): Only update if something actually changed. */
+ DEG_relations_tag_update(bmain);
return 1;
}
@@ -1132,7 +1132,7 @@ static void remap_hooks_and_vertex_parents(Main *bmain, Object *obedit)
return;
}
- for (object = bmain->object.first; object; object = object->id.next) {
+ for (object = bmain->objects.first; object; object = object->id.next) {
ModifierData *md;
int index;
if ((object->parent) &&
@@ -1224,7 +1224,7 @@ void ED_curve_editnurb_load(Main *bmain, Object *obedit)
cu->nurb = newnurb;
- ED_curve_updateAnimPaths(obedit->data);
+ ED_curve_updateAnimPaths(bmain, obedit->data);
BKE_nurbList_free(&oldnurb);
}
@@ -1272,8 +1272,9 @@ void ED_curve_editnurb_make(Object *obedit)
if (actkey) {
editnurb->shapenr = obedit->shapenr;
- /* Apply shapekey to new nurbs of editnurb, not those of original curve (and *after* we generated keyIndex),
- * else we do not have valid 'original' data to properly restore curve when leaving editmode. */
+ /* Apply shapekey to new nurbs of editnurb, not those of original curve
+ * (and *after* we generated keyIndex), else we do not have valid 'original' data
+ * to properly restore curve when leaving editmode. */
BKE_keyblock_convert_to_curve(actkey, cu, &editnurb->nurbs);
}
}
@@ -1336,7 +1337,8 @@ static int separate_exec(bContext *C, wmOperator *op)
}
/* 2. Duplicate the object and data. */
- newbase = ED_object_add_duplicate(bmain, scene, view_layer, oldbase, 0); /* 0 = fully linked. */
+ newbase = ED_object_add_duplicate(
+ bmain, scene, view_layer, oldbase, 0); /* 0 = fully linked. */
DEG_relations_tag_update(bmain);
newob = newbase->object;
@@ -1426,6 +1428,7 @@ void CURVE_OT_separate(wmOperatorType *ot)
static int curve_split_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
int ok = -1;
@@ -1456,7 +1459,7 @@ static int curve_split_exec(bContext *C, wmOperator *op)
cu->actnu -= len_orig - BLI_listbase_count(editnurb);
BLI_movelisttolist(editnurb, &newnurb);
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -2225,7 +2228,8 @@ static void adduplicateflagNurb(Object *obedit, View3D *v3d, ListBase *newnurb,
newu++;
for (c = a / nu->pntsu, bp3 = bp2; c < nu->pntsv; c++, bp3 += nu->pntsu) {
if (bp3->f1 & flag) {
- bp3->f1 |= SURF_SEEN; /* flag as seen so skipped on future iterations */
+ /* flag as seen so skipped on future iterations */
+ bp3->f1 |= SURF_SEEN;
if (newu == 1) newv++;
}
else {
@@ -2390,6 +2394,7 @@ static void adduplicateflagNurb(Object *obedit, View3D *v3d, ListBase *newnurb,
static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -2417,7 +2422,7 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -2722,7 +2727,8 @@ static void curve_smooth_value(ListBase *editnurb,
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 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) {
@@ -2792,7 +2798,8 @@ static void curve_smooth_value(ListBase *editnurb,
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 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) {
@@ -2919,7 +2926,7 @@ static int curve_smooth_tilt_exec(bContext *C, wmOperator *UNUSED(op))
Object *obedit = CTX_data_edit_object(C);
ListBase *editnurb = object_editcurve_get(obedit);
- curve_smooth_value(editnurb, offsetof(BezTriple, alfa), offsetof(BPoint, alfa));
+ curve_smooth_value(editnurb, offsetof(BezTriple, tilt), offsetof(BPoint, tilt));
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
DEG_id_tag_update(obedit->data, 0);
@@ -3497,6 +3504,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
{
const int number_cuts = RNA_int_get(op->ptr, "number_cuts");
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -3512,8 +3520,9 @@ static int subdivide_exec(bContext *C, wmOperator *op)
subdividenurb(obedit, v3d, number_cuts);
- if (ED_curve_updateAnimPaths(cu))
+ if (ED_curve_updateAnimPaths(bmain, cu)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+ }
WM_event_add_notifier(C, NC_GEOM | ND_DATA, cu);
DEG_id_tag_update(obedit->data, 0);
@@ -3696,6 +3705,7 @@ static void findselectedNurbvert(
static int set_spline_type_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Object *obedit = CTX_data_edit_object(C);
View3D *v3d = CTX_wm_view3d(C);
ListBase *editnurb = object_editcurve_get(obedit);
@@ -3726,8 +3736,9 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
}
if (changed) {
- if (ED_curve_updateAnimPaths(obedit->data))
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+ }
DEG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
@@ -3752,7 +3763,7 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot)
// {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
// {CU_BSPLINE, "B_SPLINE", 0, "B-Spline", ""},
{CU_NURBS, "NURBS", 0, "NURBS", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3810,7 +3821,7 @@ void CURVE_OT_handle_type_set(wmOperatorType *ot)
{5, "ALIGNED", 0, "Aligned", ""},
{6, "FREE_ALIGN", 0, "Free", ""},
{3, "TOGGLE_FREE_ALIGN", 0, "Toggle Free/Align", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -4251,6 +4262,7 @@ static int merge_nurb(View3D *v3d, Object *obedit)
static int make_segment_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -4343,8 +4355,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
nu1 = nu;
/* Just in case both of first/last CV are selected check
- * whether we really need to switch the direction.
- */
+ * whether we really need to switch the direction.
+ */
if (!BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, nu1->bezt)) {
BKE_nurb_direction_switch(nu1);
keyData_switchDirectionNurb(cu, nu1);
@@ -4360,8 +4372,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
nu2 = nu;
/* Just in case both of first/last CV are selected check
- * whether we really need to switch the direction.
- */
+ * whether we really need to switch the direction.
+ */
if (!BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, &(nu->bezt[nu2->pntsu - 1]))) {
BKE_nurb_direction_switch(nu2);
keyData_switchDirectionNurb(cu, nu2);
@@ -4371,9 +4383,9 @@ static int make_segment_exec(bContext *C, wmOperator *op)
}
else if (nu->pntsv == 1) {
/* Same logic as above: if first point is selected spline is
- * preferred for nu1, if last point is selected spline is
- * preferred for u2u.
- */
+ * preferred for nu1, if last point is selected spline is
+ * preferred for u2u.
+ */
bp = nu->bp;
if (bp[nu->pntsu - 1].f1 & SELECT) {
@@ -4481,7 +4493,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
continue;
}
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -4768,6 +4780,7 @@ bool ed_editnurb_spin(float viewmat[4][4], View3D *v3d, Object *obedit, const fl
static int spin_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = ED_view3d_context_rv3d(C);
@@ -4801,7 +4814,7 @@ static int spin_exec(bContext *C, wmOperator *op)
}
ok = 1;
- if (ED_curve_updateAnimPaths(cu)) {
+ if (ED_curve_updateAnimPaths(bmain, cu)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -5248,6 +5261,7 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, View3D *v3d, cons
static int add_vertex_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Object *obedit = CTX_data_edit_object(C);
View3D *v3d = CTX_wm_view3d(C);
Curve *cu = obedit->data;
@@ -5261,7 +5275,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
mul_m4_v3(imat, location);
if (ed_editcurve_addvert(cu, editnurb, v3d, location)) {
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -5388,6 +5402,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot)
static int curve_extrude_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -5425,7 +5440,7 @@ static int curve_extrude_exec(bContext *C, wmOperator *UNUSED(op))
}
if (changed) {
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -5499,7 +5514,8 @@ static bool curve_toggle_cyclic(View3D *v3d, ListBase *editnurb, int direction)
while (a--) {
if (bp->f1 & SELECT) {
nu->flagu ^= CU_NURB_CYCLIC;
- BKE_nurb_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
+ /* 1==u type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_u(nu);
changed = true;
break;
}
@@ -5515,12 +5531,14 @@ static bool curve_toggle_cyclic(View3D *v3d, ListBase *editnurb, int direction)
if (bp->f1 & SELECT) {
if (direction == 0 && nu->pntsu > 1) {
nu->flagu ^= CU_NURB_CYCLIC;
- BKE_nurb_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
+ /* 1==u type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_u(nu);
changed = true;
}
if (direction == 1 && nu->pntsv > 1) {
nu->flagv ^= CU_NURB_CYCLIC;
- BKE_nurb_knot_calc_v(nu); /* 2==v type is ignored for cyclic curves */
+ /* 2==v type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_v(nu);
changed = true;
}
break;
@@ -5592,7 +5610,7 @@ void CURVE_OT_cyclic_toggle(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{0, "CYCLIC_U", 0, "Cyclic U", ""},
{1, "CYCLIC_V", 0, "Cyclic V", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -6079,6 +6097,7 @@ static bool curve_delete_segments(Object *obedit, View3D *v3d, const bool split)
static int curve_delete_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
View3D *v3d = CTX_wm_view3d(C);
eCurveElem_Types type = RNA_enum_get(op->ptr, "type");
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -6109,7 +6128,7 @@ static int curve_delete_exec(bContext *C, wmOperator *op)
changed_multi = true;
cu->actnu = cu->actvert = CU_ACT_NONE;
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -6130,7 +6149,7 @@ static int curve_delete_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem curve_delete_type_items[] = {
{CURVE_VERTEX, "VERT", 0, "Vertices", ""},
{CURVE_SEGMENT, "SEGMENT", 0, "Segments", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem *rna_curve_delete_type_itemf(
@@ -6184,6 +6203,7 @@ static bool test_bezt_is_sel_any(const void *bezt_v, void *user_data)
static int curve_dissolve_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -6268,7 +6288,9 @@ static int curve_dissolve_exec(bContext *C, wmOperator *UNUSED(op))
cu->actnu = cu->actvert = CU_ACT_NONE;
- if (ED_curve_updateAnimPaths(obedit->data)) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
+ WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+ }
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
DEG_id_tag_update(obedit->data, 0);
@@ -6308,6 +6330,7 @@ static bool nurb_bezt_flag_any(const Nurb *nu, const char flag_test)
static int curve_decimate_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
const float error_sq_max = FLT_MAX;
float ratio = RNA_float_get(op->ptr, "ratio");
bool all_supported_multi = true;
@@ -6347,7 +6370,7 @@ static int curve_decimate_exec(bContext *C, wmOperator *op)
if (changed) {
cu->actnu = cu->actvert = CU_ACT_NONE;
- if (ED_curve_updateAnimPaths(obedit->data)) {
+ if (ED_curve_updateAnimPaths(bmain, obedit->data)) {
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
}
@@ -6572,7 +6595,7 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
bezt = nu->bezt;
a = nu->pntsu;
while (a--) {
- if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) bezt->alfa = 0.0;
+ if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) bezt->tilt = 0.0;
bezt++;
}
}
@@ -6580,7 +6603,7 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
bp = nu->bp;
a = nu->pntsu * nu->pntsv;
while (a--) {
- if (bp->f1 & SELECT) bp->alfa = 0.0f;
+ if (bp->f1 & SELECT) bp->tilt = 0.0f;
bp++;
}
}
@@ -6659,7 +6682,7 @@ static int match_texture_space_exec(bContext *C, wmOperator *UNUSED(op))
int a;
if (object->runtime.curve_cache == NULL) {
- BKE_displist_make_curveTypes(depsgraph, scene, object, false, false);
+ BKE_displist_make_curveTypes(depsgraph, scene, object, false, false, NULL);
}
INIT_MINMAX(min, max);
diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c
index 5308660ddee..0e110edf35f 100644
--- a/source/blender/editors/curve/editcurve_add.c
+++ b/source/blender/editors/curve/editcurve_add.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editcurve_add.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include "DNA_object_types.h"
@@ -60,7 +52,7 @@
static const float nurbcircle[8][2] = {
{0.0, -1.0}, {-1.0, -1.0}, {-1.0, 0.0}, {-1.0, 1.0},
- {0.0, 1.0}, { 1.0, 1.0}, { 1.0, 0.0}, { 1.0, -1.0}
+ {0.0, 1.0}, { 1.0, 1.0}, { 1.0, 0.0}, { 1.0, -1.0},
};
/************ add primitive, used by object/ module ****************/
@@ -343,7 +335,7 @@ Nurb *ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4],
break;
case CU_PRIM_TUBE: /* Cylinder */
if (cutype == CU_NURBS) {
- nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0); /* circle */
+ nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
nu->resolu = cu->resolu;
nu->flag = CU_SMOOTH;
BLI_addtail(editnurb, nu); /* temporal for extrude and translate */
@@ -420,7 +412,7 @@ Nurb *ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4],
float tmp_vec[3] = {0.f, 0.f, 1.f};
xzproj = 1;
- nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0); /* circle */
+ nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
xzproj = 0;
nu->resolu = cu->resolu;
nu->resolv = cu->resolv;
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index 3fe880865bb..0edee8a84ea 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editcurve_paint.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include "DNA_object_types.h"
@@ -34,7 +30,6 @@
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_fcurve.h"
-#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_layer.h"
@@ -48,7 +43,6 @@
#include "ED_view3d.h"
#include "ED_curve.h"
-#include "BIF_gl.h"
#include "GPU_batch.h"
#include "GPU_batch_presets.h"
@@ -80,7 +74,6 @@
#define STROKE_CYCLIC_DIST_PX 8
/* -------------------------------------------------------------------- */
-
/** \name StrokeElem / #RNA_OperatorStrokeElement Conversion Functions
* \{ */
@@ -300,7 +293,6 @@ static bool stroke_elem_project_fallback_elem(
/* -------------------------------------------------------------------- */
-
/** \name Operator/Stroke Conversion
* \{ */
@@ -354,7 +346,6 @@ static void curve_draw_stroke_from_operator(wmOperator *op)
/* -------------------------------------------------------------------- */
-
/** \name Operator Callbacks & Helpers
* \{ */
diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c
index cafc3cb076f..25470f7344a 100644
--- a/source/blender/editors/curve/editcurve_select.c
+++ b/source/blender/editors/curve/editcurve_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): John Roper
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editcurve_select.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include "DNA_object_types.h"
@@ -37,7 +29,6 @@
#include "BLI_bitmap.h"
#include "BLI_math.h"
#include "BLI_rand.h"
-#include "BLI_heap.h"
#include "BLI_heap_simple.h"
#include "BLI_kdtree.h"
@@ -1335,7 +1326,7 @@ static const EnumPropertyItem curve_prop_similar_compare_types[] = {
{SIM_CMP_GT, "GREATER", 0, "Greater", ""},
{SIM_CMP_LT, "LESS", 0, "Less", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
enum {
@@ -1350,7 +1341,7 @@ static const EnumPropertyItem curve_prop_similar_types[] = {
{SIMCURHAND_RADIUS, "RADIUS", 0, "Radius", ""},
{SIMCURHAND_WEIGHT, "WEIGHT", 0, "Weight", ""},
{SIMCURHAND_DIRECTION, "DIRECTION", 0, "Direction", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void nurb_bezt_direction_worldspace_get(Object *ob, Nurb *nu, BezTriple *bezt, float r_dir[3])
diff --git a/source/blender/editors/curve/editcurve_undo.c b/source/blender/editors/curve/editcurve_undo.c
index 9163272fbf2..30dd7346191 100644
--- a/source/blender/editors/curve/editcurve_undo.c
+++ b/source/blender/editors/curve/editcurve_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editcurve_undo.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include "MEM_guardedalloc.h"
@@ -39,6 +35,7 @@
#include "BKE_curve.h"
#include "BKE_fcurve.h"
#include "BKE_layer.h"
+#include "BKE_main.h"
#include "BKE_undo_system.h"
#include "DEG_depsgraph.h"
@@ -76,7 +73,7 @@ typedef struct {
size_t undo_size;
} UndoCurve;
-static void undocurve_to_editcurve(UndoCurve *ucu, Curve *cu, short *r_shapenr)
+static void undocurve_to_editcurve(Main *bmain, UndoCurve *ucu, Curve *cu, short *r_shapenr)
{
ListBase *undobase = &ucu->nubase;
ListBase *editbase = BKE_curve_editNurbs_get(cu);
@@ -116,7 +113,7 @@ static void undocurve_to_editcurve(UndoCurve *ucu, Curve *cu, short *r_shapenr)
cu->actnu = ucu->actnu;
cu->flag = ucu->flag;
*r_shapenr = ucu->obedit.shapenr;
- ED_curve_updateAnimPaths(cu);
+ ED_curve_updateAnimPaths(bmain, cu);
}
static void undocurve_from_editcurve(UndoCurve *ucu, Curve *cu, const short shapenr)
@@ -214,13 +211,15 @@ static bool curve_undosys_poll(bContext *C)
return (obedit != NULL);
}
-static bool curve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool curve_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
CurveUndoStep *us = (CurveUndoStep *)us_p;
+ /* Important not to use the 3D view when getting objects because all objects
+ * outside of this list will be moved out of edit-mode when reading back undo steps. */
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, NULL, &objects_len);
us->elems = MEM_callocN(sizeof(*us->elems) * objects_len, __func__);
us->elems_len = objects_len;
@@ -237,14 +236,16 @@ static bool curve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void curve_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void curve_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(curve_undosys_poll(C));
-
CurveUndoStep *us = (CurveUndoStep *)us_p;
+ /* Load all our objects into edit-mode, clear everything else. */
+ ED_undo_object_editmode_restore_helper(
+ C, &us->elems[0].obedit_ref.ptr, us->elems_len, sizeof(*us->elems));
+
+ BLI_assert(curve_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
CurveUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;
@@ -255,7 +256,7 @@ static void curve_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UN
us_p->name, obedit->id.name);
continue;
}
- undocurve_to_editcurve(&elem->data, obedit->data, &obedit->shapenr);
+ undocurve_to_editcurve(bmain, &elem->data, obedit->data, &obedit->shapenr);
DEG_id_tag_update(&obedit->id, ID_RECALC_GEOMETRY);
}
@@ -298,7 +299,6 @@ void ED_curve_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = curve_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(CurveUndoStep);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index b6b0100773d..03161df2a29 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editfont.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
@@ -568,7 +562,7 @@ static const EnumPropertyItem style_items[] = {
{CU_CHINFO_ITALIC, "ITALIC", 0, "Italic", ""},
{CU_CHINFO_UNDERLINE, "UNDERLINE", 0, "Underline", ""},
{CU_CHINFO_SMALLCAPS, "SMALL_CAPS", 0, "Small Caps", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int set_style(bContext *C, const int style, const bool clear)
@@ -894,7 +888,8 @@ static const EnumPropertyItem move_type_items[] = {
{NEXT_LINE, "NEXT_LINE", 0, "Next Line", ""},
{PREV_PAGE, "PREVIOUS_PAGE", 0, "Previous Page", ""},
{NEXT_PAGE, "NEXT_PAGE", 0, "Next Page", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int move_cursor(bContext *C, int type, const bool select)
{
@@ -1182,7 +1177,8 @@ static const EnumPropertyItem delete_type_items[] = {
{DEL_SELECTION, "SELECTION", 0, "Selection", ""},
{DEL_NEXT_SEL, "NEXT_OR_SELECTION", 0, "Next or Selection", ""},
{DEL_PREV_SEL, "PREVIOUS_OR_SELECTION", 0, "Previous or Selection", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int delete_exec(bContext *C, wmOperator *op)
{
@@ -1600,7 +1596,8 @@ void ED_curve_editfont_free(Object *obedit)
static const EnumPropertyItem case_items[] = {
{CASE_LOWER, "LOWER", 0, "Lower", ""},
{CASE_UPPER, "UPPER", 0, "Upper", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int set_case(bContext *C, int ccase)
{
diff --git a/source/blender/editors/curve/editfont_undo.c b/source/blender/editors/curve/editfont_undo.c
index 85e361b495f..13cbea77ab8 100644
--- a/source/blender/editors/curve/editfont_undo.c
+++ b/source/blender/editors/curve/editfont_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/curve/editfont_undo.c
- * \ingroup edcurve
+/** \file
+ * \ingroup edcurve
*/
#include <stdlib.h>
@@ -339,7 +335,7 @@ static bool font_undosys_poll(bContext *C)
return editfont_object_from_context(C) != NULL;
}
-static bool font_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool font_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
FontUndoStep *us = (FontUndoStep *)us_p;
us->obedit_ref.ptr = editfont_object_from_context(C);
@@ -349,7 +345,7 @@ static bool font_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void font_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void font_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_EDIT);
@@ -387,7 +383,6 @@ void ED_font_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = font_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(FontUndoStep);
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index 46981cf5e6d..c116254ebc9 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -671,6 +668,8 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES
ops.curve.draw
ops.curve.extrude_cursor
ops.curve.extrude_move
+ ops.curve.radius
+ ops.curve.vertex_random
ops.generic.cursor
ops.generic.select
ops.generic.select_box
@@ -699,6 +698,7 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES
ops.gpencil.sculpt_thickness
ops.gpencil.sculpt_twist
ops.gpencil.sculpt_weight
+ ops.gpencil.stroke_cutter
ops.mesh.bevel
ops.mesh.bisect
ops.mesh.dupli_extrude_cursor
diff --git a/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c
index 55b33b0d8ad..d62d397c783 100644
--- a/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c
+++ b/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file geom_arrow_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*/
#include "../gizmo_geometry.h"
diff --git a/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c
index 410e2a5ad6e..e89d20a41bd 100644
--- a/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c
+++ b/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file geom_cube_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*/
#include "../gizmo_geometry.h"
diff --git a/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c
index 22cf0785c64..5ead50f67d1 100644
--- a/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c
+++ b/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file geom_dial_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*/
#include "../gizmo_geometry.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_draw_utils.c b/source/blender/editors/gizmo_library/gizmo_draw_utils.c
index 9ef53d8f696..999e211a492 100644
--- a/source/blender/editors/gizmo_library/gizmo_draw_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_draw_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,13 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gizmo_draw_utils.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*/
#include "BLI_listbase.h"
-#include "BLI_ghash.h"
-#include "BLI_math.h"
-#include "BLI_string.h"
-#include "BLI_string_utils.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_geometry.h b/source/blender/editors/gizmo_library/gizmo_geometry.h
index 53541b0aa01..71d8919c91d 100644
--- a/source/blender/editors/gizmo_library/gizmo_geometry.h
+++ b/source/blender/editors/gizmo_library/gizmo_geometry.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gizmo_geometry.h
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Gizmo Geometry
*
diff --git a/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c b/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c
index 274d35269d1..28a5200a041 100644
--- a/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c
+++ b/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file value2d_gizmo_group.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name 2D Value Gizmo
*
diff --git a/source/blender/editors/gizmo_library/gizmo_library_intern.h b/source/blender/editors/gizmo_library/gizmo_library_intern.h
index f58935e1fba..7712767c5ad 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_intern.h
+++ b/source/blender/editors/gizmo_library/gizmo_library_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gizmo_library_intern.h
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*/
#ifndef __GIZMO_LIBRARY_INTERN_H__
diff --git a/source/blender/editors/gizmo_library/gizmo_library_presets.c b/source/blender/editors/gizmo_library/gizmo_library_presets.c
index 4eeddb92664..9dba0c0d515 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_presets.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_presets.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gizmo_library/gizmo_library_presets.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Gizmo Lib Presets
*
@@ -35,8 +31,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
-
#include "GPU_draw.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c
index d8c29eb6675..0ae312d552e 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gizmo_library_utils.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Gizmo Library Utilities
*
@@ -32,7 +26,6 @@
*/
#include "BLI_math.h"
-#include "BLI_listbase.h"
#include "DNA_view3d_types.h"
#include "DNA_screen_types.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
index fb3583b7b27..b4bf4c6726c 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,22 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file arrow2d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name 2D Arrow Gizmo
*
* \brief Simple arrow gizmo which is dragged into a certain direction.
*/
-#include "BLI_listbase.h"
#include "BLI_math.h"
-#include "BLI_rect.h"
#include "DNA_windowmanager_types.h"
#include "BKE_context.h"
-#include "BIF_gl.h"
#include "GPU_draw.h"
#include "GPU_immediate.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
index e02d4b8470c..f31e53d2a1f 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file arrow3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Arrow Gizmo
*
@@ -38,7 +32,6 @@
* - `matrix[2]` is the arrow direction (for all arrowes).
*/
-#include "BIF_gl.h"
#include "BLI_math.h"
@@ -457,16 +450,16 @@ static void GIZMO_GT_arrow_3d(wmGizmoType *gzt)
{ED_GIZMO_ARROW_STYLE_CROSS, "CROSS", 0, "Cross", ""},
{ED_GIZMO_ARROW_STYLE_BOX, "BOX", 0, "Box", ""},
{ED_GIZMO_ARROW_STYLE_CONE, "CONE", 0, "Cone", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_draw_options_items[] = {
{ED_GIZMO_ARROW_DRAW_FLAG_STEM, "STEM", 0, "Stem", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_transform_items[] = {
{ED_GIZMO_ARROW_XFORM_FLAG_INVERTED, "INVERT", 0, "Inverted", ""},
{ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED, "CONSTRAIN", 0, "Constrained", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(
diff --git a/source/blender/editors/gizmo_library/gizmo_types/blank3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/blank3d_gizmo.c
index 6bff72d75cd..55054d1b4ad 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/blank3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/blank3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,16 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blank3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Blank Gizmo
*
* \brief Gizmo to use as a fallback (catch events).
*/
-#include "BLI_math.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
index 7b625364905..542b9aa19e3 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file button2d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Button Gizmo
*
@@ -28,7 +24,6 @@
* \brief Single click button action for use in gizmo groups.
*
* \note Currently only basic icon & vector-shape buttons are supported.
- *
*/
#include "MEM_guardedalloc.h"
@@ -37,8 +32,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -308,7 +301,7 @@ static void GIZMO_GT_button_2d(wmGizmoType *gzt)
{ED_GIZMO_BUTTON_SHOW_OUTLINE, "OUTLINE", 0, "Outline", ""},
{ED_GIZMO_BUTTON_SHOW_BACKDROP, "BACKDROP", 0, "Backdrop", ""},
{ED_GIZMO_BUTTON_SHOW_HELPLINE, "HELPLINE", 0, "Help Line", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
index 04015ee9f1e..d25f982fc23 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file cage2d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Cage Gizmo
*
@@ -42,7 +36,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
#include "GPU_matrix.h"
#include "GPU_shader.h"
@@ -761,10 +754,10 @@ static int gizmo_cage2d_test_select(
/* if gizmo does not have a scale intersection, don't do it */
if (transform_flag & (ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE | ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM)) {
- const rctf r_xmin = {.xmin = -size[0], .ymin = -size[1], .xmax = -size[0] + margin[0], .ymax = size[1]};
- const rctf r_xmax = {.xmin = size[0] - margin[0], .ymin = -size[1], .xmax = size[0], .ymax = size[1]};
- const rctf r_ymin = {.xmin = -size[0], .ymin = -size[1], .xmax = size[0], .ymax = -size[1] + margin[1]};
- const rctf r_ymax = {.xmin = -size[0], .ymin = size[1] - margin[1], .xmax = size[0], .ymax = size[1]};
+ const rctf r_xmin = { .xmin = -size[0], .ymin = -size[1], .xmax = -size[0] + margin[0], .ymax = size[1], };
+ const rctf r_xmax = { .xmin = size[0] - margin[0], .ymin = -size[1], .xmax = size[0], .ymax = size[1], };
+ const rctf r_ymin = { .xmin = -size[0], .ymin = -size[1], .xmax = size[0], .ymax = -size[1] + margin[1], };
+ const rctf r_ymax = { .xmin = -size[0], .ymin = size[1] - margin[1], .xmax = size[0], .ymax = size[1], };
if (BLI_rctf_isect_pt_v(&r_xmin, point_local)) {
if (BLI_rctf_isect_pt_v(&r_ymin, point_local)) {
@@ -853,7 +846,7 @@ static int gizmo_cage2d_modal(
return OPERATOR_RUNNING_MODAL;
}
/* For transform logic to be manageable we operate in -0.5..0.5 2D space,
- * no matter the size of the rectangle, mouse coorts are scaled to unit space.
+ * no matter the size of the rectangle, mouse coords are scaled to unit space.
* The mouse coords have been projected into the matrix so we don't need to worry about axis alignment.
*
* - The cursor offset are multiplied by 'dims'.
@@ -1071,18 +1064,18 @@ static void GIZMO_GT_cage_2d(wmGizmoType *gzt)
static EnumPropertyItem rna_enum_draw_style[] = {
{ED_GIZMO_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""},
{ED_GIZMO_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_transform[] = {
{ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Move", ""},
{ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE, "ROTATE", 0, "Rotate", ""},
{ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""},
{ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_draw_options[] = {
{ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static float unit_v2[2] = {1.0f, 1.0f};
RNA_def_float_vector(gzt->srna, "dimensions", 2, unit_v2, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX);
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
index 3bbe13362d0..977b7c7a0a5 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file cage3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Cage Gizmo
*
@@ -37,12 +31,9 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
-#include "BLI_rect.h"
#include "BKE_context.h"
-#include "BIF_gl.h"
-
#include "GPU_matrix.h"
#include "GPU_shader.h"
#include "GPU_immediate.h"
@@ -664,17 +655,17 @@ static void GIZMO_GT_cage_3d(wmGizmoType *gzt)
static EnumPropertyItem rna_enum_draw_style[] = {
{ED_GIZMO_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""},
{ED_GIZMO_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_transform[] = {
{ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Move", ""},
{ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""},
{ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_draw_options[] = {
{ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static float unit_v3[3] = {1.0f, 1.0f, 1.0f};
RNA_def_float_vector(gzt->srna, "dimensions", 3, unit_v3, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX);
diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
index c391ec812c7..b5be45bb63f 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file dial3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Dial Gizmo
*
@@ -44,8 +38,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -598,7 +590,7 @@ static void GIZMO_GT_dial_3d(wmGizmoType *gzt)
{ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR, "ANGLE_MIRROR", 0, "Angle Mirror", ""},
{ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y, "ANGLE_START_Y", 0, "Angle Start Y", ""},
{ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE, "ANGLE_VALUE", 0, "Show Angle Value", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum_flag(gzt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
RNA_def_boolean(gzt->srna, "wrap_angle", true, "Wrap Angle", "");
diff --git a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
index b91a193e9a0..0fe5a4e7d80 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file move3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Move Gizmo
*
@@ -30,7 +26,6 @@
* - `matrix[0]` is derived from Y and Z.
* - `matrix[1]` currently not used.
* - `matrix[2]` is the widget direction (for all gizmos).
- *
*/
#include "MEM_guardedalloc.h"
@@ -39,8 +34,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -443,12 +436,12 @@ static void GIZMO_GT_move_3d(wmGizmoType *gzt)
static EnumPropertyItem rna_enum_draw_style[] = {
{ED_GIZMO_MOVE_STYLE_RING_2D, "RING_2D", 0, "Ring", ""},
{ED_GIZMO_MOVE_STYLE_CROSS_2D, "CROSS_2D", 0, "Ring", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_draw_options[] = {
{ED_GIZMO_MOVE_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
{ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW, "ALIGN_VIEW", 0, "Align View", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(gzt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_MOVE_STYLE_RING_2D, "Draw Style", "");
diff --git a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c
index d5f1c23971c..2b13398dc4c 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file primitive3d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Primitive Gizmo
*
@@ -37,7 +33,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
@@ -178,7 +173,7 @@ static void GIZMO_GT_primitive_3d(wmGizmoType *gzt)
static EnumPropertyItem rna_enum_draw_style[] = {
{ED_GIZMO_PRIMITIVE_STYLE_PLANE, "PLANE", 0, "Plane", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(gzt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_PRIMITIVE_STYLE_PLANE, "Draw Style", "");
}
diff --git a/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
index 46a6b8f3a5f..9854b62dade 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file value2d_gizmo.c
- * \ingroup edgizmolib
+/** \file
+ * \ingroup edgizmolib
*
* \name Value Gizmo
*
diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt
index 576e16077d2..a12dca3ad16 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -45,21 +42,21 @@ set(SRC
editaction_gpencil.c
gpencil_add_monkey.c
gpencil_add_stroke.c
+ gpencil_armature.c
gpencil_brush.c
gpencil_convert.c
gpencil_data.c
gpencil_edit.c
- gpencil_merge.c
+ gpencil_fill.c
gpencil_interpolate.c
- gpencil_primitive.c
+ gpencil_merge.c
+ gpencil_old.c
gpencil_ops.c
gpencil_paint.c
- gpencil_fill.c
+ gpencil_primitive.c
gpencil_select.c
gpencil_undo.c
gpencil_utils.c
- gpencil_old.c
- gpencil_armature.c
gpencil_intern.h
)
diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c
index e6747856d1e..f30b3a45971 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/annotate_draw.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -41,7 +35,6 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "BLI_polyfill_2d.h"
#include "BLF_api.h"
#include "BLT_translation.h"
@@ -80,13 +73,20 @@
/* ----- General Defines ------ */
/* flags for sflag */
typedef enum eDrawStrokeFlags {
- GP_DRAWDATA_NOSTATUS = (1 << 0), /* don't draw status info */
- GP_DRAWDATA_ONLY3D = (1 << 1), /* only draw 3d-strokes */
- 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), /* don't draw xray in 3D view (which is default) */
- GP_DRAWDATA_NO_ONIONS = (1 << 6), /* no onionskins should be drawn (for animation playback) */
+ /** don't draw status info */
+ GP_DRAWDATA_NOSTATUS = (1 << 0),
+ /** only draw 3d-strokes */
+ GP_DRAWDATA_ONLY3D = (1 << 1),
+ /** only draw 'canvas' strokes */
+ GP_DRAWDATA_ONLYV2D = (1 << 2),
+ /** only draw 'image' strokes */
+ GP_DRAWDATA_ONLYI2D = (1 << 3),
+ /** special hack for drawing strokes in Image Editor (weird coordinates) */
+ GP_DRAWDATA_IEDITHACK = (1 << 4),
+ /** don't draw xray in 3D view (which is default) */
+ GP_DRAWDATA_NO_XRAY = (1 << 5),
+ /** no onionskins should be drawn (for animation playback) */
+ GP_DRAWDATA_NO_ONIONS = (1 << 6),
} eDrawStrokeFlags;
@@ -272,7 +272,8 @@ static void gp_draw_stroke_3d(
* Note: we want more visible levels of pressures when thickness is bigger.
*/
if (fabsf(pt->pressure - curpressure) > 0.2f / (float)thickness) {
- /* if the pressure changes before get at least 2 vertices, need to repeat last point to avoid assert in immEnd() */
+ /* if the pressure changes before get at least 2 vertices,
+ * need to repeat last point to avoid assert in immEnd() */
if (draw_points < 2) {
const bGPDspoint *pt2 = pt - 1;
immVertex3fv(pos, &pt2->x);
@@ -847,7 +848,7 @@ static void gp_draw_data_layers(
* (NOTE: doing it this way means that the toggling editmode shows visible change immediately)
*/
/* XXX: perhaps we don't want to show these when users are drawing... */
- if ((G.f & G_RENDER_OGL) == 0 &&
+ if ((G.f & G_FLAG_RENDER_VIEWPORT) == 0 &&
(gpl->flag & GP_LAYER_LOCKED) == 0 &&
(gpd->flag & GP_DATA_STROKE_EDITMODE))
{
@@ -880,7 +881,7 @@ static void gp_draw_status_text(const bGPdata *gpd, ARegion *ar)
rcti rect;
/* Cannot draw any status text when drawing OpenGL Renders */
- if (G.f & G_RENDER_OGL)
+ if (G.f & G_FLAG_RENDER_VIEWPORT)
return;
/* Get bounds of region - Necessary to avoid problems with region overlap */
@@ -954,7 +955,8 @@ static void gp_draw_data_all(
gpd_source = (scene->gpd ? scene->gpd : NULL);
}
else if (spacetype == SPACE_CLIP && scene->clip) {
- /* currently drawing only gpencil data from either clip or track, but not both - XXX fix logic behind */
+ /* currently drawing only gpencil data from either clip or track,
+ * but not both - XXX fix logic behind */
gpd_source = (scene->clip->gpd ? scene->clip->gpd : NULL);
}
@@ -1097,7 +1099,7 @@ void ED_gpencil_draw_view3d_annotations(
/* 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)) {
+ if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) {
rctf rectf;
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */
@@ -1122,7 +1124,7 @@ void ED_gpencil_draw_view3d_annotations(
dflag |= (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_NOSTATUS);
}
- if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+ if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
/* don't draw status text when "only render" flag is set */
dflag |= GP_DRAWDATA_NOSTATUS;
}
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index b6f81c81823..1c2ad3d2a95 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008/2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/annotate_paint.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -67,7 +61,6 @@
#include "ED_view3d.h"
#include "ED_clip.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -116,56 +109,84 @@ typedef enum eGPencil_PaintFlags {
*/
typedef struct tGPsdata {
Main *bmain;
- Scene *scene; /* current scene from context */
+ /** current scene from context. */
+ Scene *scene;
struct Depsgraph *depsgraph;
- wmWindow *win; /* window where painting originated */
- ScrArea *sa; /* area where painting originated */
- ARegion *ar; /* region where painting originated */
- View2D *v2d; /* needed for GP_STROKE_2DSPACE */
- rctf *subrect; /* for using the camera rect within the 3d view */
+ /** window where painting originated. */
+ wmWindow *win;
+ /** area where painting originated. */
+ ScrArea *sa;
+ /** region where painting originated. */
+ ARegion *ar;
+ /** needed for GP_STROKE_2DSPACE. */
+ View2D *v2d;
+ /** for using the camera rect within the 3d view. */
+ rctf *subrect;
rctf subrect_data;
- GP_SpaceConversion gsc; /* settings to pass to gp_points_to_xy() */
-
- PointerRNA ownerPtr; /* pointer to owner of gp-datablock */
- bGPdata *gpd; /* gp-datablock layer comes from */
- bGPDlayer *gpl; /* layer we're working on */
- bGPDframe *gpf; /* frame we're working on */
-
- char *align_flag; /* projection-mode flags (toolsettings - eGPencil_Placement_Flags) */
-
- eGPencil_PaintStatus status; /* current status of painting */
- eGPencil_PaintModes paintmode; /* mode for painting */
- eGPencil_PaintFlags flags; /* flags that can get set during runtime (eGPencil_PaintFlags) */
-
- short radius; /* radius of influence for eraser */
-
- float mval[2]; /* current mouse-position */
- float mvalo[2]; /* previous recorded mouse-position */
-
- float pressure; /* current stylus pressure */
- float opressure; /* previous stylus pressure */
+ /** settings to pass to gp_points_to_xy(). */
+ GP_SpaceConversion gsc;
+
+ /** pointer to owner of gp-datablock. */
+ PointerRNA ownerPtr;
+ /** gp-datablock layer comes from. */
+ bGPdata *gpd;
+ /** layer we're working on. */
+ bGPDlayer *gpl;
+ /** frame we're working on. */
+ bGPDframe *gpf;
+
+ /** projection-mode flags (toolsettings - eGPencil_Placement_Flags) */
+ char *align_flag;
+
+ /** current status of painting. */
+ eGPencil_PaintStatus status;
+ /** mode for painting. */
+ eGPencil_PaintModes paintmode;
+ /** flags that can get set during runtime (eGPencil_PaintFlags) */
+ eGPencil_PaintFlags flags;
+
+ /** radius of influence for eraser. */
+ short radius;
+
+ /** current mouse-position. */
+ float mval[2];
+ /** previous recorded mouse-position. */
+ float mvalo[2];
+
+ /** current stylus pressure. */
+ float pressure;
+ /** previous stylus pressure. */
+ float opressure;
/* These need to be doubles, as (at least under unix) they are in seconds since epoch,
* float (and its 7 digits precision) is definitively not enough here!
* double, with its 15 digits precision, ensures us millisecond precision for a few centuries at least.
*/
- double inittime; /* Used when converting to path */
- double curtime; /* Used when converting to path */
- double ocurtime; /* Used when converting to path */
-
- float imat[4][4]; /* inverted transformation matrix applying when converting coords from screen-space
- * to region space */
+ /** Used when converting to path. */
+ double inittime;
+ /** Used when converting to path. */
+ double curtime;
+ /** Used when converting to path. */
+ double ocurtime;
+
+ /** Inverted transformation matrix applying when converting coords from screen-space
+ * to region space. */
+ float imat[4][4];
float mat[4][4];
- float custom_color[4]; /* custom color - hack for enforcing a particular color for track/mask editing */
+ /** custom color - hack for enforcing a particular color for track/mask editing. */
+ float custom_color[4];
- void *erasercursor; /* radial cursor data for drawing eraser */
+ /** radial cursor data for drawing eraser. */
+ void *erasercursor;
- short straight[2]; /* 1: line horizontal, 2: line vertical, other: not defined, second element position */
+ /** 1: line horizontal, 2: line vertical, other: not defined, second element position. */
+ short straight[2];
- short keymodifier; /* key used for invoking the operator */
+ /** key used for invoking the operator. */
+ short keymodifier;
} tGPsdata;
/* ------ */
@@ -198,12 +219,24 @@ static void gp_session_validatebuffer(tGPsdata *p);
/* check if context is suitable for drawing */
static bool gpencil_draw_poll(bContext *C)
{
+ /* if is inside grease pencil draw mode cannot use annotations */
+ Object *obact = CTX_data_active_object(C);
+ ScrArea *sa = CTX_wm_area(C);
+ if ((sa) && (sa->spacetype == SPACE_VIEW3D)) {
+ if ((obact) && (obact->type == OB_GPENCIL)
+ && (obact->mode == OB_MODE_PAINT_GPENCIL)) {
+ CTX_wm_operator_poll_msg_set(C,
+ "Annotation cannot be used in grease pencil draw mode");
+ return false;
+ }
+ }
+
if (ED_operator_regionactive(C)) {
/* check if current context can support GPencil data */
if (ED_gpencil_data_get_pointers(C, NULL) != NULL) {
/* check if Grease Pencil isn't already running */
if (ED_gpencil_session_active() == 0)
- return 1;
+ return true;
else
CTX_wm_operator_poll_msg_set(C, "Annotation operator is already active");
}
@@ -215,7 +248,7 @@ static bool gpencil_draw_poll(bContext *C)
CTX_wm_operator_poll_msg_set(C, "Active region not set");
}
- return 0;
+ return false;
}
/* check if projecting strokes into 3d-geometry in the 3D-View */
@@ -331,6 +364,63 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
}
}
+/* Apply smooth to buffer while drawing
+ * to smooth point C, use 2 before (A, B) and current point (D):
+ *
+ * A----B-----C------D
+ *
+ * \param p: Temp data
+ * \param inf: Influence factor
+ * \param idx: Index of the last point (need minimum 3 points in the array)
+ */
+static void gp_smooth_buffer(tGPsdata *p, float inf, int idx)
+{
+ bGPdata *gpd = p->gpd;
+ short num_points = gpd->runtime.sbuffer_size;
+
+ /* Do nothing if not enough points to smooth out */
+ if ((num_points < 3) || (idx < 3) || (inf == 0.0f)) {
+ return;
+ }
+
+ tGPspoint *points = (tGPspoint *)gpd->runtime.sbuffer;
+ float steps = 4.0f;
+ if (idx < 4) {
+ steps--;
+ }
+
+ tGPspoint *pta = idx >= 4 ? &points[idx - 4] : NULL;
+ tGPspoint *ptb = idx >= 3 ? &points[idx - 3] : NULL;
+ tGPspoint *ptc = idx >= 2 ? &points[idx - 2] : NULL;
+ tGPspoint *ptd = &points[idx - 1];
+
+ float sco[2] = { 0.0f };
+ float a[2], b[2], c[2], d[2];
+ const float average_fac = 1.0f / steps;
+
+ /* Compute smoothed coordinate by taking the ones nearby */
+ if (pta) {
+ copy_v2_v2(a, &pta->x);
+ madd_v2_v2fl(sco, a, average_fac);
+ }
+ if (ptb) {
+ copy_v2_v2(b, &ptb->x);
+ madd_v2_v2fl(sco, b, average_fac);
+ }
+ if (ptc) {
+ copy_v2_v2(c, &ptc->x);
+ madd_v2_v2fl(sco, c, average_fac);
+ }
+ if (ptd) {
+ copy_v2_v2(d, &ptd->x);
+ madd_v2_v2fl(sco, d, average_fac);
+ }
+
+ /* Based on influence factor, blend between original and optimal smoothed coordinate */
+ interp_v2_v2v2(c, c, sco, inf);
+ copy_v2_v2(&ptc->x, c);
+}
+
/* add current stroke-point to buffer (returns whether point was successfully added) */
static short gp_stroke_addpoint(
tGPsdata *p, const float mval[2], float pressure, double curtime)
@@ -348,7 +438,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -363,7 +454,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -385,13 +477,18 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
pt->pressure = pressure;
- pt->strength = 1.0f; /* unused for annotations, but initialise for easier conversions to GP Object */
+ /* unused for annotations, but initialise for easier conversions to GP Object */
+ pt->strength = 1.0f;
/* point time */
pt->time = (float)(curtime - p->inittime);
/* increment counters */
gpd->runtime.sbuffer_size++;
+ /* smooth while drawing previous points with a reduction factor for previous */
+ for (int s = 0; s < 3; s++) {
+ gp_smooth_buffer(p, 0.5f * ((3.0f - s) / 3.0f), gpd->runtime.sbuffer_size - s);
+ }
/* check if another operation can still occur */
if (gpd->runtime.sbuffer_size == GP_STROKE_BUFFER_MAX)
@@ -405,7 +502,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -875,7 +973,7 @@ static void gp_stroke_eraser_dostroke(
/* Second Pass: Remove any points that are tagged */
if (do_cull) {
- gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0);
}
}
}
@@ -1102,9 +1200,6 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
/* mark datablock as being used for annotations */
gpd->flag |= GP_DATA_ANNOTATIONS;
-
- /* annotations always in front of all objects */
- gpd->xray_mode = GP_XRAY_FRONT;
}
p->gpd = *gpd_ptr;
}
@@ -1297,7 +1392,8 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true); /* no shift */
+ /* no shift */
+ ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true);
p->subrect = &p->subrect_data;
}
}
@@ -1681,18 +1777,18 @@ static void gpencil_draw_apply(wmOperator *op, tGPsdata *p, Depsgraph *depsgraph
}
/* handle draw event */
-static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event, Depsgraph *depsgraph)
+static void annotation_draw_apply_event(wmOperator *op, const wmEvent *event, Depsgraph *depsgraph, float x, float y)
{
tGPsdata *p = op->customdata;
PointerRNA itemptr;
float mousef[2];
int tablet = 0;
- /* convert from window-space to area-space mouse coordinates
- * NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
- */
- p->mval[0] = event->mval[0] + 1;
- p->mval[1] = event->mval[1] + 1;
+ /* convert from window-space to area-space mouse coordinates
+ * add any x,y override position for fake events
+ */
+ p->mval[0] = (float)event->mval[0] - x;
+ p->mval[1] = (float)event->mval[1] - y;
/* verify key status for straight lines */
if ((event->ctrl > 0) || (event->alt > 0)) {
@@ -1789,7 +1885,8 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event, Depsg
gpencil_draw_apply(op, p, depsgraph);
/* force refresh */
- ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
+ /* just active area for now, since doing whole screen is too slow */
+ ED_region_tag_redraw(p->ar);
}
/* ------------------------------- */
@@ -1877,6 +1974,11 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
Scene *scene = CTX_data_scene(C);
tGPsdata *p = NULL;
+ /* support for tablets eraser pen */
+ if (gpencil_is_tablet_eraser_active(event)) {
+ RNA_enum_set(op->ptr, "mode", GP_PAINTMODE_ERASER);
+ }
+
/* if try to do annotations with a gp object selected, first
* unselect the object to avoid conflicts.
* The solution is not perfect but we can keep running the annotations while
@@ -1933,7 +2035,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
p->status = GP_STATUS_PAINTING;
/* handle the initial drawing - i.e. for just doing a simple dot */
- gpencil_draw_apply_event(op, event, CTX_data_depsgraph(C));
+ annotation_draw_apply_event(op, event, CTX_data_depsgraph(C), 0.0f, 0.0f);
op->flag |= OP_IS_MODAL_CURSOR_REGION;
}
else {
@@ -2002,11 +2104,46 @@ static void gpencil_stroke_end(wmOperator *op)
p->gpf = NULL;
}
+/* add events for missing mouse movements when the artist draw very fast */
+static void annotation_add_missing_events(bContext *C, wmOperator *op, const wmEvent *event, tGPsdata *p)
+{
+ float pt[2], a[2], b[2];
+ float factor = 10.0f;
+
+ copy_v2_v2(a, p->mvalo);
+ b[0] = (float)event->mval[0] + 1.0f;
+ b[1] = (float)event->mval[1] + 1.0f;
+
+ /* get distance in pixels */
+ float dist = len_v2v2(a, b);
+
+ /* for very small distances, add a half way point */
+ if (dist <= 2.0f) {
+ interp_v2_v2v2(pt, a, b, 0.5f);
+ sub_v2_v2v2(pt, b, pt);
+ /* create fake event */
+ annotation_draw_apply_event(op, event, CTX_data_depsgraph(C),
+ pt[0], pt[1]);
+ }
+ else if (dist >= factor) {
+ int slices = 2 + (int)((dist - 1.0) / factor);
+ float n = 1.0f / slices;
+ for (int i = 1; i < slices; i++) {
+ interp_v2_v2v2(pt, a, b, n * i);
+ sub_v2_v2v2(pt, b, pt);
+ /* create fake event */
+ annotation_draw_apply_event(op, event, CTX_data_depsgraph(C),
+ pt[0], pt[1]);
+ }
+ }
+}
+
/* events handling during interactive drawing part of operator */
static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
tGPsdata *p = op->customdata;
- int estate = OPERATOR_PASS_THROUGH; /* default exit state - pass through to support MMB view nav, etc. */
+ /* default exit state - pass through to support MMB view nav, etc. */
+ int estate = OPERATOR_PASS_THROUGH;
/* if (event->type == NDOF_MOTION)
* return OPERATOR_PASS_THROUGH;
@@ -2211,8 +2348,11 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* handle painting mouse-movements? */
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (p->flags & GP_PAINTFLAG_FIRSTRUN)) {
/* handle drawing event */
- /* printf("\t\tGP - add point\n"); */
- gpencil_draw_apply_event(op, event, CTX_data_depsgraph(C));
+ if ((p->flags & GP_PAINTFLAG_FIRSTRUN) == 0) {
+ annotation_add_missing_events(C, op, event, p);
+ }
+
+ annotation_draw_apply_event(op, event, CTX_data_depsgraph(C), 0.0f, 0.0f);
/* finish painting operation if anything went wrong just now */
if (p->status == GP_STATUS_ERROR) {
@@ -2249,7 +2389,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
/* force refresh */
- ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
+ /* just active area for now, since doing whole screen is too slow */
+ ED_region_tag_redraw(p->ar);
/* event handled, so just tag as running modal */
estate = OPERATOR_RUNNING_MODAL;
@@ -2269,7 +2410,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
else {
/* update status indicators - cursor, header, etc. */
gpencil_draw_status_indicators(C, p);
- gpencil_draw_cursor_set(p); /* cursor may have changed outside our control - T44084 */
+ /* cursor may have changed outside our control - T44084 */
+ gpencil_draw_cursor_set(p);
}
/* process last operations before exiting */
@@ -2304,7 +2446,7 @@ static const EnumPropertyItem prop_gpencil_drawmodes[] = {
{GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", "Draw straight line segment(s)"},
{GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", "Click to place endpoints of straight line segments (connected)"},
{GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", "Erase Annotation strokes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
void GPENCIL_OT_annotate(wmOperatorType *ot)
@@ -2332,7 +2474,8 @@ void GPENCIL_OT_annotate(wmOperatorType *ot)
prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
- /* NOTE: wait for input is enabled by default, so that all UI code can work properly without needing users to know about this */
+ /* NOTE: wait for input is enabled by default,
+ * so that all UI code can work properly without needing users to know about this */
prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "Wait for first click instead of painting immediately");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 392c670696b..dafc9507bd1 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/drawgpencil.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -90,15 +84,24 @@
/* ----- General Defines ------ */
/* flags for sflag */
typedef enum eDrawStrokeFlags {
- GP_DRAWDATA_NOSTATUS = (1 << 0), /* don't draw status info */
- GP_DRAWDATA_ONLY3D = (1 << 1), /* only draw 3d-strokes */
- 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), /* don't draw xray in 3D view (which is default) */
- GP_DRAWDATA_NO_ONIONS = (1 << 6), /* no onionskins should be drawn (for animation playback) */
- GP_DRAWDATA_VOLUMETRIC = (1 << 7), /* draw strokes as "volumetric" circular billboards */
- GP_DRAWDATA_FILL = (1 << 8) /* fill insides/bounded-regions of strokes */
+ /** don't draw status info */
+ GP_DRAWDATA_NOSTATUS = (1 << 0),
+ /** only draw 3d-strokes */
+ GP_DRAWDATA_ONLY3D = (1 << 1),
+ /** only draw 'canvas' strokes */
+ GP_DRAWDATA_ONLYV2D = (1 << 2),
+ /** only draw 'image' strokes */
+ GP_DRAWDATA_ONLYI2D = (1 << 3),
+ /** special hack for drawing strokes in Image Editor (weird coordinates) */
+ GP_DRAWDATA_IEDITHACK = (1 << 4),
+ /** don't draw xray in 3D view (which is default) */
+ GP_DRAWDATA_NO_XRAY = (1 << 5),
+ /** no onionskins should be drawn (for animation playback) */
+ GP_DRAWDATA_NO_ONIONS = (1 << 6),
+ /** draw strokes as "volumetric" circular billboards */
+ GP_DRAWDATA_VOLUMETRIC = (1 << 7),
+ /** fill insides/bounded-regions of strokes */
+ GP_DRAWDATA_FILL = (1 << 8),
} eDrawStrokeFlags;
@@ -342,7 +345,10 @@ static void gp_draw_stroke_volumetric_buffer(
const tGPspoint *pt = points;
for (int i = 0; i < totpoints; i++, pt++) {
gp_set_tpoint_varying_color(pt, ink, color);
- immAttr1f(size, pt->pressure * thickness); /* TODO: scale based on view transform (zoom level) */
+
+ /* TODO: scale based on view transform (zoom level) */
+ immAttr1f(size, pt->pressure * thickness);
+
immVertex2f(pos, pt->x, pt->y);
}
@@ -403,8 +409,10 @@ static void gp_draw_stroke_volumetric_3d(
const bGPDspoint *pt = points;
for (int i = 0; i < totpoints && pt; i++, pt++) {
gp_set_point_varying_color(pt, ink, color);
- immAttr1f(size, pt->pressure * thickness); /* TODO: scale based on view transform */
- immVertex3fv(pos, &pt->x); /* we can adjust size in vertex shader based on view/projection! */
+ /* TODO: scale based on view transform */
+ immAttr1f(size, pt->pressure * thickness);
+ /* we can adjust size in vertex shader based on view/projection! */
+ immVertex3fv(pos, &pt->x);
}
immEnd();
@@ -588,7 +596,7 @@ static void gp_draw_stroke_fill(
{
BLI_assert(gps->totpoints >= 3);
Material *ma = gpd->mat[gps->mat_nr];
- MaterialGPencilStyle *gp_style = ma->gp_style;
+ MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL;
/* Calculate triangles cache for filling area (must be done only after changes) */
if ((gps->flag & GP_STROKE_RECALC_GEOMETRY) || (gps->tot_triangles == 0) || (gps->triangles == NULL)) {
@@ -706,7 +714,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4
immBindBuiltinProgram(GPU_SHADER_GPENCIL_STROKE);
immUniform2fv("Viewport", viewport);
immUniform1f("pixsize", tgpw->rv3d->pixsize);
- float obj_scale = tgpw->ob ? (tgpw->ob->size[0] + tgpw->ob->size[1] + tgpw->ob->size[2]) / 3.0f : 1.0f;
+ float obj_scale = tgpw->ob ? (tgpw->ob->scale[0] + tgpw->ob->scale[1] + tgpw->ob->scale[2]) / 3.0f : 1.0f;
immUniform1f("objscale", obj_scale);
int keep_size = (int)((tgpw->gpd) && (tgpw->gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS));
@@ -999,7 +1007,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
}
/* check if the color is visible */
Material *ma = tgpw->gpd->mat[gps->mat_nr];
- MaterialGPencilStyle *gp_style = ma->gp_style;
+ MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL;
if ((gp_style == NULL) ||
(gp_style->flag & GP_STYLE_COLOR_HIDE) ||
@@ -1219,7 +1227,7 @@ static void gp_draw_strokes_edit(
/* verify color lock */
{
Material *ma = gpd->mat[gps->mat_nr];
- MaterialGPencilStyle *gp_style = ma->gp_style;
+ MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL;
if (gp_style != NULL) {
if (gp_style->flag & GP_STYLE_COLOR_HIDE) {
@@ -1249,7 +1257,7 @@ static void gp_draw_strokes_edit(
/* for now, we assume that the base color of the points is not too close to the real color */
/* set color using material */
Material *ma = gpd->mat[gps->mat_nr];
- MaterialGPencilStyle *gp_style = ma->gp_style;
+ MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL;
float selectColor[4];
UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, selectColor);
@@ -1293,10 +1301,14 @@ static void gp_draw_strokes_edit(
immAttr3fv(color, selectColor);
immAttr1f(size, vsize);
}
- else {
+ else if (gp_style) {
immAttr3fv(color, gp_style->stroke_rgba);
immAttr1f(size, bsize);
}
+ else {
+ immAttr3f(color, 0.0f, 0.0f, 0.0f);
+ immAttr1f(size, bsize);
+ }
/* then position */
if (gps->flag & GP_STROKE_3DSPACE) {
@@ -1464,7 +1476,7 @@ static void gp_draw_data_layers(RegionView3D *rv3d,
* (NOTE: doing it this way means that the toggling editmode shows visible change immediately)
*/
/* XXX: perhaps we don't want to show these when users are drawing... */
- if ((G.f & G_RENDER_OGL) == 0 &&
+ if ((G.f & G_FLAG_RENDER_VIEWPORT) == 0 &&
(gpl->flag & GP_LAYER_LOCKED) == 0 &&
(gpd->flag & GP_DATA_STROKE_EDITMODE))
{
@@ -1506,7 +1518,7 @@ static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *ar
rcti rect;
/* Cannot draw any status text when drawing OpenGL Renders */
- if (G.f & G_RENDER_OGL)
+ if (G.f & G_FLAG_RENDER_VIEWPORT)
return;
/* Get bounds of region - Necessary to avoid problems with region overlap */
@@ -1631,7 +1643,7 @@ void ED_gpencil_draw_view3d(
/* 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)) {
+ if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) {
rctf rectf;
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */
@@ -1656,7 +1668,7 @@ void ED_gpencil_draw_view3d(
dflag |= (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_NOSTATUS);
}
- if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+ if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
/* don't draw status text when "only render" flag is set */
dflag |= GP_DRAWDATA_NOSTATUS;
}
@@ -1687,7 +1699,7 @@ void ED_gpencil_draw_view3d_object(wmWindowManager *wm, Scene *scene, Depsgraph
/* 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)) {
+ if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) {
rctf rectf;
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */
@@ -1712,13 +1724,13 @@ void ED_gpencil_draw_view3d_object(wmWindowManager *wm, Scene *scene, Depsgraph
dflag |= (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_NOSTATUS);
}
- if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+ if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
/* don't draw status text when "only render" flag is set */
dflag |= GP_DRAWDATA_NOSTATUS;
}
if ((wm == NULL) || ED_screen_animation_playing(wm)) {
- /* don't show onionskins during animation playback/scrub (i.e. it obscures the poses)
+ /* don't show onion-skins during animation playback/scrub (i.e. it obscures the poses)
* OpenGL Renders (i.e. final output), or depth buffer (i.e. not real strokes)
*/
dflag |= GP_DRAWDATA_NO_ONIONS;
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index 335dc254f40..8ada5a05618 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/editaction_gpencil.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
diff --git a/source/blender/editors/gpencil/gpencil_add_monkey.c b/source/blender/editors/gpencil/gpencil_add_monkey.c
index 21697995b9c..302a6fb10f6 100644
--- a/source/blender/editors/gpencil/gpencil_add_monkey.c
+++ b/source/blender/editors/gpencil/gpencil_add_monkey.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,12 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez, Matias Mendiola
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_add_monkey.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -81,6 +74,9 @@ static int gpencil_monkey_color(
if (!fill) {
ma->gp_style->flag &= ~GP_STYLE_FILL_SHOW;
}
+ else {
+ ma->gp_style->flag |= GP_STYLE_FILL_SHOW;
+ }
return BKE_gpencil_get_material_index(ob, ma) - 1;
}
@@ -88,407 +84,1303 @@ static int gpencil_monkey_color(
/* ***************************************************************** */
/* Monkey Geometry */
static const float data0[270 * GP_PRIM_DATABUF_SIZE] = {
--0.4911f, 0.0f, -0.1781f, 0.267f, 0.362f,-0.5168f, 0.0f, -0.1806f, 0.31f, 0.407f,-0.5361f, 0.0f, -0.1817f, 0.38f, 0.439f,-0.5618f, 0.0f, -0.1829f, 0.433f, 0.458f,
--0.5892f, 0.0f, -0.1827f, 0.471f, 0.5f,-0.6193f, 0.0f, -0.1814f, 0.496f, 0.516f,-0.6499f, 0.0f, -0.1782f, 0.511f, 0.519f,-0.6808f, 0.0f, -0.1729f, 0.521f, 0.53f,
--0.7107f, 0.0f, -0.1651f, 0.527f, 0.533f,-0.7404f, 0.0f, -0.1555f, 0.531f, 0.534f,-0.7698f, 0.0f, -0.1447f, 0.534f, 0.535f,-0.7993f, 0.0f, -0.1332f, 0.535f, 0.535f,
--0.8289f, -0.0f, -0.1209f, 0.536f, 0.537f,-0.8586f, -0.0f, -0.109f, 0.536f, 0.537f,-0.8871f, -0.0f, -0.0973f, 0.536f, 0.537f,-0.9125f, 0.0f, -0.0838f, 0.535f, 0.535f,
--0.9353f, 0.0f, -0.0688f, 0.534f, 0.534f,-0.9561f, 0.0f, -0.0525f, 0.534f, 0.534f,-0.9752f, 0.0f, -0.0346f, 0.533f, 0.534f,-0.9944f, 0.0f, -0.016f, 0.533f, 0.534f,
--1.0148f, 0.0f, 0.0028f, 0.532f, 0.532f,-1.0348f, 0.0f, 0.0215f, 0.531f, 0.531f,-1.05f, 0.0f, 0.0407f, 0.531f, 0.531f,-1.0639f, 0.0f, 0.0613f, 0.532f, 0.532f,
--1.0752f, 0.0f, 0.0838f, 0.535f, 0.535f,-1.0848f, 0.0f, 0.1082f, 0.54f, 0.54f,-1.0936f, 0.0f, 0.1346f, 0.542f, 0.542f,-1.1024f, 0.0f, 0.1639f, 0.543f, 0.543f,
--1.1102f, 0.0f, 0.1953f, 0.543f, 0.543f,-1.1128f, 0.0f, 0.2277f, 0.546f, 0.546f,-1.1091f, 0.0f, 0.2579f, 0.549f, 0.549f,-1.1023f, 0.0f, 0.2849f, 0.549f, 0.549f,
--1.0934f, 0.0f, 0.3086f, 0.549f, 0.549f,-1.0831f, 0.0f, 0.3285f, 0.549f, 0.549f,-1.0724f, 0.0f, 0.3451f, 0.551f, 0.551f,-1.0607f, 0.0f, 0.3594f, 0.553f, 0.553f,
--1.0474f, 0.0f, 0.3713f, 0.554f, 0.554f,-1.031f, 0.0f, 0.3804f, 0.554f, 0.554f,-1.0108f, 0.0f, 0.3874f, 0.555f, 0.555f,-0.9862f, 0.0f, 0.3922f, 0.556f, 0.556f,
--0.9568f, 0.0f, 0.3941f, 0.557f, 0.557f,-0.9243f, 0.0f, 0.3934f, 0.557f, 0.557f,-0.8897f, 0.0f, 0.3861f, 0.557f, 0.557f,-0.8556f, 0.0f, 0.3754f, 0.557f, 0.557f,
--0.8237f, 0.0f, 0.3608f, 0.558f, 0.557f,-0.7982f, 0.0f, 0.344f, 0.558f, 0.558f,-0.7786f, 0.0f, 0.329f, 0.557f, 0.559f,-0.7633f, 0.0f, 0.3183f, 0.556f, 0.559f,
--0.7498f, 0.0f, 0.3135f, 0.554f, 0.559f,-0.7374f, 0.0f, 0.3134f, 0.552f, 0.548f,-0.7261f, 0.0f, 0.3179f, 0.551f, 0.546f,-0.7146f, 0.0f, 0.3262f, 0.55f, 0.547f,
--0.703f, 0.0f, 0.3395f, 0.549f, 0.547f,-0.692f, 0.0f, 0.3576f, 0.549f, 0.548f,-0.6831f, 0.0f, 0.3806f, 0.549f, 0.548f,-0.6748f, 0.0f, 0.4052f, 0.55f, 0.549f,
--0.6648f, 0.0f, 0.4305f, 0.552f, 0.548f,-0.6527f, 0.0f, 0.4549f, 0.556f, 0.549f,-0.6375f, 0.0f, 0.4783f, 0.563f, 0.549f,-0.6195f, 0.0f, 0.5021f, 0.572f, 0.558f,
--0.5985f, 0.0f, 0.5256f, 0.582f, 0.587f,-0.5775f, -0.0f, 0.5488f, 0.591f, 0.595f,-0.556f, -0.0f, 0.5715f, 0.597f, 0.598f,-0.5339f, -0.0f, 0.593f, 0.602f, 0.603f,
--0.5119f, -0.0f, 0.613f, 0.605f, 0.606f,-0.4905f, -0.0f, 0.6312f, 0.607f, 0.607f,-0.4697f, -0.0f, 0.6474f, 0.609f, 0.607f,-0.4499f, -0.0f, 0.6613f, 0.612f, 0.611f,
--0.4306f, -0.0f, 0.6734f, 0.616f, 0.615f,-0.4116f, -0.0f, 0.6845f, 0.619f, 0.621f,-0.3918f, -0.0f, 0.6954f, 0.623f, 0.623f,-0.3709f, -0.0f, 0.7059f, 0.626f, 0.626f,
--0.3486f, -0.0f, 0.7157f, 0.63f, 0.63f,-0.3251f, -0.0f, 0.7249f, 0.637f, 0.632f,-0.3006f, -0.0f, 0.7333f, 0.646f, 0.644f,-0.2755f, -0.0f, 0.7414f, 0.654f, 0.657f,
--0.25f, -0.0f, 0.7489f, 0.659f, 0.661f,-0.2242f, -0.0f, 0.7562f, 0.664f, 0.664f,-0.1979f, -0.0f, 0.7631f, 0.667f, 0.668f,-0.171f, -0.0f, 0.7695f, 0.671f, 0.671f,
--0.1434f, -0.0f, 0.7752f, 0.674f, 0.674f,-0.1151f, -0.0f, 0.7801f, 0.677f, 0.678f,-0.0861f, -0.0f, 0.7841f, 0.678f, 0.68f,-0.0563f, -0.0f, 0.7869f, 0.68f, 0.68f,
--0.026f, -0.0f, 0.7889f, 0.68f, 0.68f,0.0049f, -0.0f, 0.7899f, 0.681f, 0.681f,0.0362f, -0.0f, 0.7898f, 0.682f, 0.681f,0.0679f, -0.0f, 0.7881f, 0.683f, 0.683f,
-0.0996f, -0.0f, 0.7853f, 0.685f, 0.683f,0.1313f, -0.0f, 0.7812f, 0.687f, 0.685f,0.1632f, -0.0f, 0.7756f, 0.69f, 0.686f,0.1953f, -0.0f, 0.7687f, 0.693f, 0.694f,
-0.2277f, -0.0f, 0.7608f, 0.697f, 0.697f,0.2606f, -0.0f, 0.7513f, 0.7f, 0.7f,0.2934f, -0.0f, 0.7404f, 0.704f, 0.704f,0.3258f, -0.0f, 0.7276f, 0.707f, 0.71f,
-0.357f, -0.0f, 0.7135f, 0.709f, 0.711f,0.387f, -0.0f, 0.6983f, 0.711f, 0.713f,0.4157f, -0.0f, 0.6819f, 0.712f, 0.714f,0.444f, -0.0f, 0.6645f, 0.714f, 0.714f,
-0.4719f, -0.0f, 0.6459f, 0.715f, 0.715f,0.4994f, -0.0f, 0.6261f, 0.715f, 0.716f,0.526f, -0.0f, 0.6046f, 0.716f, 0.716f,0.552f, -0.0f, 0.5816f, 0.717f, 0.717f,
-0.577f, -0.0f, 0.5575f, 0.718f, 0.717f,0.6008f, -0.0f, 0.5328f, 0.718f, 0.718f,0.6231f, -0.0f, 0.5077f, 0.718f, 0.718f,0.6423f, -0.0f, 0.4829f, 0.719f, 0.718f,
-0.658f, -0.0f, 0.4617f, 0.719f, 0.719f,0.6713f, -0.0f, 0.4432f, 0.719f, 0.719f,0.6828f, -0.0f, 0.4266f, 0.719f, 0.719f,0.6928f, -0.0f, 0.4118f, 0.719f, 0.719f,
-0.7016f, -0.0f, 0.3987f, 0.718f, 0.717f,0.7094f, -0.0f, 0.3871f, 0.717f, 0.717f,0.7165f, -0.0f, 0.3769f, 0.717f, 0.717f,0.7233f, -0.0f, 0.3679f, 0.718f, 0.718f,
-0.7301f, -0.0f, 0.3598f, 0.717f, 0.719f,0.7373f, -0.0f, 0.3524f, 0.715f, 0.719f,0.7454f, -0.0f, 0.3458f, 0.713f, 0.709f,0.7545f, -0.0f, 0.3398f, 0.718f, 0.704f,
-0.7651f, -0.0f, 0.3351f, 0.732f, 0.705f,0.777f, -0.0f, 0.3317f, 0.753f, 0.713f,0.7909f, -0.0f, 0.3311f, 0.774f, 0.813f,0.8068f, -0.0f, 0.334f, 0.791f, 0.815f,
-0.8246f, -0.0f, 0.3398f, 0.802f, 0.815f,0.8438f, -0.0f, 0.3486f, 0.809f, 0.816f,0.8651f, -0.0f, 0.3575f, 0.812f, 0.816f,0.8893f, -0.0f, 0.3665f, 0.814f, 0.816f,
-0.9166f, -0.0f, 0.374f, 0.814f, 0.817f,0.9459f, -0.0f, 0.3791f, 0.812f, 0.817f,0.9751f, -0.0f, 0.3811f, 0.81f, 0.815f,1.0029f, -0.0f, 0.38f, 0.806f, 0.807f,
-1.0288f, -0.0f, 0.3754f, 0.8f, 0.801f,1.052f, -0.0f, 0.3673f, 0.794f, 0.8f,1.0722f, -0.0f, 0.3556f, 0.788f, 0.781f,1.0888f, -0.0f, 0.3403f, 0.783f, 0.78f,
-1.1027f, -0.0f, 0.322f, 0.781f, 0.778f,1.1133f, -0.0f, 0.301f, 0.779f, 0.777f,1.1215f, -0.0f, 0.278f, 0.778f, 0.777f,1.1269f, -0.0f, 0.2534f, 0.777f, 0.777f,
-1.1296f, -0.0f, 0.2284f, 0.777f, 0.778f,1.1292f, -0.0f, 0.2031f, 0.776f, 0.776f,1.1254f, -0.0f, 0.1778f, 0.775f, 0.776f,1.1178f, 0.0f, 0.153f, 0.774f, 0.774f,
-1.1076f, 0.0f, 0.1299f, 0.774f, 0.772f,1.0955f, 0.0f, 0.1079f, 0.773f, 0.773f,1.0817f, 0.0f, 0.087f, 0.772f, 0.773f,1.0668f, 0.0f, 0.0677f, 0.771f, 0.772f,
-1.0508f, 0.0f, 0.0491f, 0.77f, 0.772f,1.0339f, 0.0f, 0.0313f, 0.768f, 0.766f,1.0157f, 0.0f, 0.0144f, 0.767f, 0.765f,0.9969f, -0.0f, -0.0015f, 0.766f, 0.765f,
-0.9784f, -0.0f, -0.017f, 0.765f, 0.766f,0.96f, -0.0f, -0.0321f, 0.764f, 0.765f,0.9413f, -0.0f, -0.0468f, 0.761f, 0.765f,0.9216f, -0.0f, -0.0611f, 0.756f, 0.761f,
-0.9009f, -0.0f, -0.0751f, 0.751f, 0.751f,0.8787f, 0.0f, -0.0893f, 0.745f, 0.744f,0.8556f, 0.0f, -0.1027f, 0.739f, 0.738f,0.8312f, 0.0f, -0.1152f, 0.733f, 0.731f,
-0.8058f, 0.0f, -0.1268f, 0.728f, 0.727f,0.7788f, 0.0f, -0.1372f, 0.723f, 0.723f,0.7505f, 0.0f, -0.1467f, 0.718f, 0.717f,0.7214f, 0.0f, -0.1549f, 0.713f, 0.708f,
-0.6929f, 0.0f, -0.1617f, 0.709f, 0.706f,0.6652f, 0.0f, -0.1665f, 0.704f, 0.705f,0.6388f, 0.0f, -0.1691f, 0.7f, 0.704f,0.6131f, 0.0f, -0.1701f, 0.695f, 0.698f,
-0.5883f, 0.0f, -0.1699f, 0.691f, 0.691f,0.5644f, 0.0f, -0.1691f, 0.686f, 0.685f,0.5416f, 0.0f, -0.1683f, 0.681f, 0.683f,0.5195f, 0.0f, -0.168f, 0.676f, 0.676f,
-0.4975f, 0.0f, -0.1687f, 0.671f, 0.67f,0.4754f, 0.0f, -0.1705f, 0.666f, 0.663f,0.4527f, 0.0f, -0.1741f, 0.663f, 0.66f,0.4293f, 0.0f, -0.1797f, 0.661f, 0.659f,
-0.4054f, 0.0f, -0.1881f, 0.66f, 0.659f,0.3813f, 0.0f, -0.1992f, 0.659f, 0.657f,0.3585f, 0.0f, -0.212f, 0.658f, 0.659f,0.3368f, 0.0f, -0.2266f, 0.658f, 0.659f,
-0.3174f, 0.0f, -0.2426f, 0.658f, 0.659f,0.2996f, 0.0f, -0.2594f, 0.657f, 0.657f,0.284f, 0.0f, -0.2768f, 0.656f, 0.658f,0.2702f, 0.0f, -0.2946f, 0.653f, 0.657f,
-0.2585f, 0.0f, -0.3127f, 0.646f, 0.656f,0.25f, 0.0f, -0.3308f, 0.637f, 0.642f,0.2447f, 0.0f, -0.3489f, 0.628f, 0.609f,0.2418f, 0.0f, -0.3672f, 0.62f, 0.608f,
-0.2412f, 0.0f, -0.386f, 0.614f, 0.607f,0.2425f, 0.0f, -0.4051f, 0.61f, 0.606f,0.2456f, 0.0f, -0.4246f, 0.608f, 0.604f,0.2509f, 0.0f, -0.4447f, 0.607f, 0.606f,
-0.2576f, 0.0f, -0.4652f, 0.606f, 0.607f,0.2666f, 0.0f, -0.4867f, 0.605f, 0.607f,0.2766f, 0.0f, -0.5091f, 0.603f, 0.607f,0.2871f, 0.0f, -0.5326f, 0.598f, 0.606f,
-0.2973f, 0.0f, -0.5569f, 0.591f, 0.602f,0.306f, 0.0f, -0.5826f, 0.583f, 0.585f,0.3131f, 0.0f, -0.61f, 0.574f, 0.576f,0.3197f, 0.0f, -0.6384f, 0.564f, 0.564f,
-0.326f, 0.0f, -0.6681f, 0.555f, 0.549f,0.3315f, 0.0f, -0.6984f, 0.547f, 0.543f,0.336f, 0.0f, -0.7291f, 0.541f, 0.541f,0.3391f, 0.0f, -0.7593f, 0.536f, 0.538f,
-0.3399f, 0.0f, -0.7884f, 0.532f, 0.528f,0.3382f, 0.0f, -0.8158f, 0.529f, 0.528f,0.334f, 0.0f, -0.8417f, 0.525f, 0.529f,0.3273f, 0.0f, -0.8657f, 0.521f, 0.528f,
-0.3185f, 0.0f, -0.8881f, 0.516f, 0.515f,0.3073f, 0.0f, -0.9088f, 0.51f, 0.514f,0.2941f, 0.0f, -0.9278f, 0.505f, 0.507f,0.2786f, 0.0f, -0.9449f, 0.499f, 0.494f,
-0.261f, 0.0f, -0.96f, 0.495f, 0.49f,0.2413f, 0.0f, -0.9733f, 0.493f, 0.491f,0.2193f, 0.0f, -0.9845f, 0.491f, 0.489f,0.1953f, 0.0f, -0.9935f, 0.491f, 0.491f,
-0.1693f, 0.0f, -1.0004f, 0.491f, 0.492f,0.1421f, 0.0f, -1.0051f, 0.492f, 0.492f,0.1136f, -0.0f, -1.0072f, 0.492f, 0.492f,0.0842f, -0.0f, -1.0073f, 0.492f, 0.492f,
-0.0548f, -0.0f, -1.0059f, 0.493f, 0.494f,0.0258f, -0.0f, -1.0037f, 0.493f, 0.494f,-0.0027f, -0.0f, -1.0003f, 0.493f, 0.493f,-0.0309f, -0.0f, -0.9959f, 0.492f, 0.492f,
--0.0584f, -0.0f, -0.9904f, 0.491f, 0.492f,-0.0858f, -0.0f, -0.9848f, 0.491f, 0.491f,-0.1127f, -0.0f, -0.9783f, 0.49f, 0.49f,-0.1386f, -0.0f, -0.9703f, 0.49f, 0.49f,
--0.1649f, -0.0f, -0.9604f, 0.489f, 0.489f,-0.191f, -0.0f, -0.9479f, 0.489f, 0.489f,-0.2165f, -0.0f, -0.9345f, 0.489f, 0.49f,-0.2414f, -0.0f, -0.9205f, 0.489f, 0.489f,
--0.2654f, -0.0f, -0.9055f, 0.489f, 0.489f,-0.2877f, -0.0f, -0.8898f, 0.49f, 0.49f,-0.3076f, -0.0f, -0.8723f, 0.49f, 0.489f,-0.324f, -0.0f, -0.8532f, 0.491f, 0.489f,
--0.3367f, -0.0f, -0.8316f, 0.492f, 0.489f,-0.3451f, -0.0f, -0.8077f, 0.494f, 0.488f,-0.3505f, -0.0f, -0.7829f, 0.497f, 0.49f,-0.3531f, -0.0f, -0.7584f, 0.501f, 0.497f,
--0.3528f, -0.0f, -0.7349f, 0.505f, 0.504f,-0.3503f, -0.0f, -0.7115f, 0.51f, 0.51f,-0.346f, -0.0f, -0.688f, 0.515f, 0.515f,-0.3411f, -0.0f, -0.6643f, 0.52f, 0.522f,
--0.3361f, -0.0f, -0.6403f, 0.525f, 0.528f,-0.3304f, -0.0f, -0.6164f, 0.53f, 0.532f,-0.3244f, -0.0f, -0.5925f, 0.535f, 0.535f,-0.318f, -0.0f, -0.5687f, 0.539f, 0.54f,
--0.3124f, -0.0f, -0.5441f, 0.542f, 0.545f,-0.3051f, -0.0f, -0.5191f, 0.546f, 0.549f,-0.2959f, -0.0f, -0.4917f, 0.548f, 0.549f,-0.2882f, -0.0f, -0.4639f, 0.55f, 0.552f,
--0.2814f, -0.0f, -0.4363f, 0.551f, 0.552f,-0.2759f, -0.0f, -0.4084f, 0.552f, 0.553f,-0.2707f, -0.0f, -0.3827f, 0.553f, 0.553f,-0.2703f, -0.0f, -0.3586f, 0.554f, 0.553f,
--0.2772f, -0.0f, -0.3375f, 0.554f, 0.554f,-0.2871f, -0.0f, -0.3178f, 0.555f, 0.555f,-0.2995f, -0.0f, -0.2996f, 0.556f, 0.555f,-0.3145f, -0.0f, -0.283f, 0.556f, 0.557f,
--0.332f, -0.0f, -0.2672f, 0.557f, 0.557f,-0.3488f, -0.0f, -0.2531f, 0.558f, 0.558f,-0.3639f, -0.0f, -0.2407f, 0.558f, 0.558f,-0.3778f, -0.0f, -0.2292f, 0.558f, 0.558f,
--0.3909f, -0.0f, -0.2191f, 0.559f, 0.559f,-0.4032f, -0.0f, -0.2102f, 0.559f, 0.558f,-0.4146f, -0.0f, -0.2027f, 0.559f, 0.559f,-0.426f, 0.0f, -0.1968f, 0.558f, 0.558f,
--0.4348f, 0.0f, -0.1931f, 0.558f, 0.558f,-0.4479f, 0.0f, -0.1886f, 0.555f, 0.559f
+ -0.4911f, 0.0f, -0.1781f, 0.267f, 0.362f,
+ -0.5168f, 0.0f, -0.1806f, 0.31f, 0.407f,
+ -0.5361f, 0.0f, -0.1817f, 0.38f, 0.439f,
+ -0.5618f, 0.0f, -0.1829f, 0.433f, 0.458f,
+ -0.5892f, 0.0f, -0.1827f, 0.471f, 0.5f,
+ -0.6193f, 0.0f, -0.1814f, 0.496f, 0.516f,
+ -0.6499f, 0.0f, -0.1782f, 0.511f, 0.519f,
+ -0.6808f, 0.0f, -0.1729f, 0.521f, 0.53f,
+ -0.7107f, 0.0f, -0.1651f, 0.527f, 0.533f,
+ -0.7404f, 0.0f, -0.1555f, 0.531f, 0.534f,
+ -0.7698f, 0.0f, -0.1447f, 0.534f, 0.535f,
+ -0.7993f, 0.0f, -0.1332f, 0.535f, 0.535f,
+ -0.8289f, 0.0f, -0.1209f, 0.536f, 0.537f,
+ -0.8586f, 0.0f, -0.109f, 0.536f, 0.537f,
+ -0.8871f, 0.0f, -0.0973f, 0.536f, 0.537f,
+ -0.9125f, 0.0f, -0.0838f, 0.535f, 0.535f,
+ -0.9353f, 0.0f, -0.0688f, 0.534f, 0.534f,
+ -0.9561f, 0.0f, -0.0525f, 0.534f, 0.534f,
+ -0.9752f, 0.0f, -0.0346f, 0.533f, 0.534f,
+ -0.9944f, 0.0f, -0.016f, 0.533f, 0.534f,
+ -1.0148f, 0.0f, 0.0028f, 0.532f, 0.532f,
+ -1.0348f, 0.0f, 0.0215f, 0.531f, 0.531f,
+ -1.05f, 0.0f, 0.0407f, 0.531f, 0.531f,
+ -1.0639f, 0.0f, 0.0613f, 0.532f, 0.532f,
+ -1.0752f, 0.0f, 0.0838f, 0.535f, 0.535f,
+ -1.0848f, 0.0f, 0.1082f, 0.54f, 0.54f,
+ -1.0936f, 0.0f, 0.1346f, 0.542f, 0.542f,
+ -1.1024f, 0.0f, 0.1639f, 0.543f, 0.543f,
+ -1.1102f, 0.0f, 0.1953f, 0.543f, 0.543f,
+ -1.1128f, 0.0f, 0.2277f, 0.546f, 0.546f,
+ -1.1091f, 0.0f, 0.2579f, 0.549f, 0.549f,
+ -1.1023f, 0.0f, 0.2849f, 0.549f, 0.549f,
+ -1.0934f, 0.0f, 0.3086f, 0.549f, 0.549f,
+ -1.0831f, 0.0f, 0.3285f, 0.549f, 0.549f,
+ -1.0724f, 0.0f, 0.3451f, 0.551f, 0.551f,
+ -1.0607f, 0.0f, 0.3594f, 0.553f, 0.553f,
+ -1.0474f, 0.0f, 0.3713f, 0.554f, 0.554f,
+ -1.031f, 0.0f, 0.3804f, 0.554f, 0.554f,
+ -1.0108f, 0.0f, 0.3874f, 0.555f, 0.555f,
+ -0.9862f, 0.0f, 0.3922f, 0.556f, 0.556f,
+ -0.9568f, 0.0f, 0.3941f, 0.557f, 0.557f,
+ -0.9243f, 0.0f, 0.3934f, 0.557f, 0.557f,
+ -0.8897f, 0.0f, 0.3861f, 0.557f, 0.557f,
+ -0.8556f, 0.0f, 0.3754f, 0.557f, 0.557f,
+ -0.8237f, 0.0f, 0.3608f, 0.558f, 0.557f,
+ -0.7982f, 0.0f, 0.344f, 0.558f, 0.558f,
+ -0.7786f, 0.0f, 0.329f, 0.557f, 0.559f,
+ -0.7633f, 0.0f, 0.3183f, 0.556f, 0.559f,
+ -0.7498f, 0.0f, 0.3135f, 0.554f, 0.559f,
+ -0.7374f, 0.0f, 0.3134f, 0.552f, 0.548f,
+ -0.7261f, 0.0f, 0.3179f, 0.551f, 0.546f,
+ -0.7146f, 0.0f, 0.3262f, 0.55f, 0.547f,
+ -0.703f, 0.0f, 0.3395f, 0.549f, 0.547f,
+ -0.692f, 0.0f, 0.3576f, 0.549f, 0.548f,
+ -0.6831f, 0.0f, 0.3806f, 0.549f, 0.548f,
+ -0.6748f, 0.0f, 0.4052f, 0.55f, 0.549f,
+ -0.6648f, 0.0f, 0.4305f, 0.552f, 0.548f,
+ -0.6527f, 0.0f, 0.4549f, 0.556f, 0.549f,
+ -0.6375f, 0.0f, 0.4783f, 0.563f, 0.549f,
+ -0.6195f, 0.0f, 0.5021f, 0.572f, 0.558f,
+ -0.5985f, 0.0f, 0.5256f, 0.582f, 0.587f,
+ -0.5775f, 0.0f, 0.5488f, 0.591f, 0.595f,
+ -0.556f, 0.0f, 0.5715f, 0.597f, 0.598f,
+ -0.5339f, 0.0f, 0.593f, 0.602f, 0.603f,
+ -0.5119f, 0.0f, 0.613f, 0.605f, 0.606f,
+ -0.4905f, 0.0f, 0.6312f, 0.607f, 0.607f,
+ -0.4697f, 0.0f, 0.6474f, 0.609f, 0.607f,
+ -0.4499f, 0.0f, 0.6613f, 0.612f, 0.611f,
+ -0.4306f, 0.0f, 0.6734f, 0.616f, 0.615f,
+ -0.4116f, 0.0f, 0.6845f, 0.619f, 0.621f,
+ -0.3918f, 0.0f, 0.6954f, 0.623f, 0.623f,
+ -0.3709f, 0.0f, 0.7059f, 0.626f, 0.626f,
+ -0.3486f, 0.0f, 0.7157f, 0.63f, 0.63f,
+ -0.3251f, 0.0f, 0.7249f, 0.637f, 0.632f,
+ -0.3006f, 0.0f, 0.7333f, 0.646f, 0.644f,
+ -0.2755f, 0.0f, 0.7414f, 0.654f, 0.657f,
+ -0.25f, 0.0f, 0.7489f, 0.659f, 0.661f,
+ -0.2242f, 0.0f, 0.7562f, 0.664f, 0.664f,
+ -0.1979f, 0.0f, 0.7631f, 0.667f, 0.668f,
+ -0.171f, 0.0f, 0.7695f, 0.671f, 0.671f,
+ -0.1434f, 0.0f, 0.7752f, 0.674f, 0.674f,
+ -0.1151f, 0.0f, 0.7801f, 0.677f, 0.678f,
+ -0.0861f, 0.0f, 0.7841f, 0.678f, 0.68f,
+ -0.0563f, 0.0f, 0.7869f, 0.68f, 0.68f,
+ -0.026f, 0.0f, 0.7889f, 0.68f, 0.68f,
+ 0.0049f, 0.0f, 0.7899f, 0.681f, 0.681f,
+ 0.0362f, 0.0f, 0.7898f, 0.682f, 0.681f,
+ 0.0679f, 0.0f, 0.7881f, 0.683f, 0.683f,
+ 0.0996f, 0.0f, 0.7853f, 0.685f, 0.683f,
+ 0.1313f, 0.0f, 0.7812f, 0.687f, 0.685f,
+ 0.1632f, 0.0f, 0.7756f, 0.69f, 0.686f,
+ 0.1953f, 0.0f, 0.7687f, 0.693f, 0.694f,
+ 0.2277f, 0.0f, 0.7608f, 0.697f, 0.697f,
+ 0.2606f, 0.0f, 0.7513f, 0.7f, 0.7f,
+ 0.2934f, 0.0f, 0.7404f, 0.704f, 0.704f,
+ 0.3258f, 0.0f, 0.7276f, 0.707f, 0.71f,
+ 0.357f, 0.0f, 0.7135f, 0.709f, 0.711f,
+ 0.387f, 0.0f, 0.6983f, 0.711f, 0.713f,
+ 0.4157f, 0.0f, 0.6819f, 0.712f, 0.714f,
+ 0.444f, 0.0f, 0.6645f, 0.714f, 0.714f,
+ 0.4719f, 0.0f, 0.6459f, 0.715f, 0.715f,
+ 0.4994f, 0.0f, 0.6261f, 0.715f, 0.716f,
+ 0.526f, 0.0f, 0.6046f, 0.716f, 0.716f,
+ 0.552f, 0.0f, 0.5816f, 0.717f, 0.717f,
+ 0.577f, 0.0f, 0.5575f, 0.718f, 0.717f,
+ 0.6008f, 0.0f, 0.5328f, 0.718f, 0.718f,
+ 0.6231f, 0.0f, 0.5077f, 0.718f, 0.718f,
+ 0.6423f, 0.0f, 0.4829f, 0.719f, 0.718f,
+ 0.658f, 0.0f, 0.4617f, 0.719f, 0.719f,
+ 0.6713f, 0.0f, 0.4432f, 0.719f, 0.719f,
+ 0.6828f, 0.0f, 0.4266f, 0.719f, 0.719f,
+ 0.6928f, 0.0f, 0.4118f, 0.719f, 0.719f,
+ 0.7016f, 0.0f, 0.3987f, 0.718f, 0.717f,
+ 0.7094f, 0.0f, 0.3871f, 0.717f, 0.717f,
+ 0.7165f, 0.0f, 0.3769f, 0.717f, 0.717f,
+ 0.7233f, 0.0f, 0.3679f, 0.718f, 0.718f,
+ 0.7301f, 0.0f, 0.3598f, 0.717f, 0.719f,
+ 0.7373f, 0.0f, 0.3524f, 0.715f, 0.719f,
+ 0.7454f, 0.0f, 0.3458f, 0.713f, 0.709f,
+ 0.7545f, 0.0f, 0.3398f, 0.718f, 0.704f,
+ 0.7651f, 0.0f, 0.3351f, 0.732f, 0.705f,
+ 0.777f, 0.0f, 0.3317f, 0.753f, 0.713f,
+ 0.7909f, 0.0f, 0.3311f, 0.774f, 0.813f,
+ 0.8068f, 0.0f, 0.334f, 0.791f, 0.815f,
+ 0.8246f, 0.0f, 0.3398f, 0.802f, 0.815f,
+ 0.8438f, 0.0f, 0.3486f, 0.809f, 0.816f,
+ 0.8651f, 0.0f, 0.3575f, 0.812f, 0.816f,
+ 0.8893f, 0.0f, 0.3665f, 0.814f, 0.816f,
+ 0.9166f, 0.0f, 0.374f, 0.814f, 0.817f,
+ 0.9459f, 0.0f, 0.3791f, 0.812f, 0.817f,
+ 0.9751f, 0.0f, 0.3811f, 0.81f, 0.815f,
+ 1.0029f, 0.0f, 0.38f, 0.806f, 0.807f,
+ 1.0288f, 0.0f, 0.3754f, 0.8f, 0.801f,
+ 1.052f, 0.0f, 0.3673f, 0.794f, 0.8f,
+ 1.0722f, 0.0f, 0.3556f, 0.788f, 0.781f,
+ 1.0888f, 0.0f, 0.3403f, 0.783f, 0.78f,
+ 1.1027f, 0.0f, 0.322f, 0.781f, 0.778f,
+ 1.1133f, 0.0f, 0.301f, 0.779f, 0.777f,
+ 1.1215f, 0.0f, 0.278f, 0.778f, 0.777f,
+ 1.1269f, 0.0f, 0.2534f, 0.777f, 0.777f,
+ 1.1296f, 0.0f, 0.2284f, 0.777f, 0.778f,
+ 1.1292f, 0.0f, 0.2031f, 0.776f, 0.776f,
+ 1.1254f, 0.0f, 0.1778f, 0.775f, 0.776f,
+ 1.1178f, 0.0f, 0.153f, 0.774f, 0.774f,
+ 1.1076f, 0.0f, 0.1299f, 0.774f, 0.772f,
+ 1.0955f, 0.0f, 0.1079f, 0.773f, 0.773f,
+ 1.0817f, 0.0f, 0.087f, 0.772f, 0.773f,
+ 1.0668f, 0.0f, 0.0677f, 0.771f, 0.772f,
+ 1.0508f, 0.0f, 0.0491f, 0.77f, 0.772f,
+ 1.0339f, 0.0f, 0.0313f, 0.768f, 0.766f,
+ 1.0157f, 0.0f, 0.0144f, 0.767f, 0.765f,
+ 0.9969f, 0.0f, -0.0015f, 0.766f, 0.765f,
+ 0.9784f, 0.0f, -0.017f, 0.765f, 0.766f,
+ 0.96f, 0.0f, -0.0321f, 0.764f, 0.765f,
+ 0.9413f, 0.0f, -0.0468f, 0.761f, 0.765f,
+ 0.9216f, 0.0f, -0.0611f, 0.756f, 0.761f,
+ 0.9009f, 0.0f, -0.0751f, 0.751f, 0.751f,
+ 0.8787f, 0.0f, -0.0893f, 0.745f, 0.744f,
+ 0.8556f, 0.0f, -0.1027f, 0.739f, 0.738f,
+ 0.8312f, 0.0f, -0.1152f, 0.733f, 0.731f,
+ 0.8058f, 0.0f, -0.1268f, 0.728f, 0.727f,
+ 0.7788f, 0.0f, -0.1372f, 0.723f, 0.723f,
+ 0.7505f, 0.0f, -0.1467f, 0.718f, 0.717f,
+ 0.7214f, 0.0f, -0.1549f, 0.713f, 0.708f,
+ 0.6929f, 0.0f, -0.1617f, 0.709f, 0.706f,
+ 0.6652f, 0.0f, -0.1665f, 0.704f, 0.705f,
+ 0.6388f, 0.0f, -0.1691f, 0.7f, 0.704f,
+ 0.6131f, 0.0f, -0.1701f, 0.695f, 0.698f,
+ 0.5883f, 0.0f, -0.1699f, 0.691f, 0.691f,
+ 0.5644f, 0.0f, -0.1691f, 0.686f, 0.685f,
+ 0.5416f, 0.0f, -0.1683f, 0.681f, 0.683f,
+ 0.5195f, 0.0f, -0.168f, 0.676f, 0.676f,
+ 0.4975f, 0.0f, -0.1687f, 0.671f, 0.67f,
+ 0.4754f, 0.0f, -0.1705f, 0.666f, 0.663f,
+ 0.4527f, 0.0f, -0.1741f, 0.663f, 0.66f,
+ 0.4293f, 0.0f, -0.1797f, 0.661f, 0.659f,
+ 0.4054f, 0.0f, -0.1881f, 0.66f, 0.659f,
+ 0.3813f, 0.0f, -0.1992f, 0.659f, 0.657f,
+ 0.3585f, 0.0f, -0.212f, 0.658f, 0.659f,
+ 0.3368f, 0.0f, -0.2266f, 0.658f, 0.659f,
+ 0.3174f, 0.0f, -0.2426f, 0.658f, 0.659f,
+ 0.2996f, 0.0f, -0.2594f, 0.657f, 0.657f,
+ 0.284f, 0.0f, -0.2768f, 0.656f, 0.658f,
+ 0.2702f, 0.0f, -0.2946f, 0.653f, 0.657f,
+ 0.2585f, 0.0f, -0.3127f, 0.646f, 0.656f,
+ 0.25f, 0.0f, -0.3308f, 0.637f, 0.642f,
+ 0.2447f, 0.0f, -0.3489f, 0.628f, 0.609f,
+ 0.2418f, 0.0f, -0.3672f, 0.62f, 0.608f,
+ 0.2412f, 0.0f, -0.386f, 0.614f, 0.607f,
+ 0.2425f, 0.0f, -0.4051f, 0.61f, 0.606f,
+ 0.2456f, 0.0f, -0.4246f, 0.608f, 0.604f,
+ 0.2509f, 0.0f, -0.4447f, 0.607f, 0.606f,
+ 0.2576f, 0.0f, -0.4652f, 0.606f, 0.607f,
+ 0.2666f, 0.0f, -0.4867f, 0.605f, 0.607f,
+ 0.2766f, 0.0f, -0.5091f, 0.603f, 0.607f,
+ 0.2871f, 0.0f, -0.5326f, 0.598f, 0.606f,
+ 0.2973f, 0.0f, -0.5569f, 0.591f, 0.602f,
+ 0.306f, 0.0f, -0.5826f, 0.583f, 0.585f,
+ 0.3131f, 0.0f, -0.61f, 0.574f, 0.576f,
+ 0.3197f, 0.0f, -0.6384f, 0.564f, 0.564f,
+ 0.326f, 0.0f, -0.6681f, 0.555f, 0.549f,
+ 0.3315f, 0.0f, -0.6984f, 0.547f, 0.543f,
+ 0.336f, 0.0f, -0.7291f, 0.541f, 0.541f,
+ 0.3391f, 0.0f, -0.7593f, 0.536f, 0.538f,
+ 0.3399f, 0.0f, -0.7884f, 0.532f, 0.528f,
+ 0.3382f, 0.0f, -0.8158f, 0.529f, 0.528f,
+ 0.334f, 0.0f, -0.8417f, 0.525f, 0.529f,
+ 0.3273f, 0.0f, -0.8657f, 0.521f, 0.528f,
+ 0.3185f, 0.0f, -0.8881f, 0.516f, 0.515f,
+ 0.3073f, 0.0f, -0.9088f, 0.51f, 0.514f,
+ 0.2941f, 0.0f, -0.9278f, 0.505f, 0.507f,
+ 0.2786f, 0.0f, -0.9449f, 0.499f, 0.494f,
+ 0.261f, 0.0f, -0.96f, 0.495f, 0.49f,
+ 0.2413f, 0.0f, -0.9733f, 0.493f, 0.491f,
+ 0.2193f, 0.0f, -0.9845f, 0.491f, 0.489f,
+ 0.1953f, 0.0f, -0.9935f, 0.491f, 0.491f,
+ 0.1693f, 0.0f, -1.0004f, 0.491f, 0.492f,
+ 0.1421f, 0.0f, -1.0051f, 0.492f, 0.492f,
+ 0.1136f, 0.0f, -1.0072f, 0.492f, 0.492f,
+ 0.0842f, 0.0f, -1.0073f, 0.492f, 0.492f,
+ 0.0548f, 0.0f, -1.0059f, 0.493f, 0.494f,
+ 0.0258f, 0.0f, -1.0037f, 0.493f, 0.494f,
+ -0.0027f, 0.0f, -1.0003f, 0.493f, 0.493f,
+ -0.0309f, 0.0f, -0.9959f, 0.492f, 0.492f,
+ -0.0584f, 0.0f, -0.9904f, 0.491f, 0.492f,
+ -0.0858f, 0.0f, -0.9848f, 0.491f, 0.491f,
+ -0.1127f, 0.0f, -0.9783f, 0.49f, 0.49f,
+ -0.1386f, 0.0f, -0.9703f, 0.49f, 0.49f,
+ -0.1649f, 0.0f, -0.9604f, 0.489f, 0.489f,
+ -0.191f, 0.0f, -0.9479f, 0.489f, 0.489f,
+ -0.2165f, 0.0f, -0.9345f, 0.489f, 0.49f,
+ -0.2414f, 0.0f, -0.9205f, 0.489f, 0.489f,
+ -0.2654f, 0.0f, -0.9055f, 0.489f, 0.489f,
+ -0.2877f, 0.0f, -0.8898f, 0.49f, 0.49f,
+ -0.3076f, 0.0f, -0.8723f, 0.49f, 0.489f,
+ -0.324f, 0.0f, -0.8532f, 0.491f, 0.489f,
+ -0.3367f, 0.0f, -0.8316f, 0.492f, 0.489f,
+ -0.3451f, 0.0f, -0.8077f, 0.494f, 0.488f,
+ -0.3505f, 0.0f, -0.7829f, 0.497f, 0.49f,
+ -0.3531f, 0.0f, -0.7584f, 0.501f, 0.497f,
+ -0.3528f, 0.0f, -0.7349f, 0.505f, 0.504f,
+ -0.3503f, 0.0f, -0.7115f, 0.51f, 0.51f,
+ -0.346f, 0.0f, -0.688f, 0.515f, 0.515f,
+ -0.3411f, 0.0f, -0.6643f, 0.52f, 0.522f,
+ -0.3361f, 0.0f, -0.6403f, 0.525f, 0.528f,
+ -0.3304f, 0.0f, -0.6164f, 0.53f, 0.532f,
+ -0.3244f, 0.0f, -0.5925f, 0.535f, 0.535f,
+ -0.318f, 0.0f, -0.5687f, 0.539f, 0.54f,
+ -0.3124f, 0.0f, -0.5441f, 0.542f, 0.545f,
+ -0.3051f, 0.0f, -0.5191f, 0.546f, 0.549f,
+ -0.2959f, 0.0f, -0.4917f, 0.548f, 0.549f,
+ -0.2882f, 0.0f, -0.4639f, 0.55f, 0.552f,
+ -0.2814f, 0.0f, -0.4363f, 0.551f, 0.552f,
+ -0.2759f, 0.0f, -0.4084f, 0.552f, 0.553f,
+ -0.2707f, 0.0f, -0.3827f, 0.553f, 0.553f,
+ -0.2703f, 0.0f, -0.3586f, 0.554f, 0.553f,
+ -0.2772f, 0.0f, -0.3375f, 0.554f, 0.554f,
+ -0.2871f, 0.0f, -0.3178f, 0.555f, 0.555f,
+ -0.2995f, 0.0f, -0.2996f, 0.556f, 0.555f,
+ -0.3145f, 0.0f, -0.283f, 0.556f, 0.557f,
+ -0.332f, 0.0f, -0.2672f, 0.557f, 0.557f,
+ -0.3488f, 0.0f, -0.2531f, 0.558f, 0.558f,
+ -0.3639f, 0.0f, -0.2407f, 0.558f, 0.558f,
+ -0.3778f, 0.0f, -0.2292f, 0.558f, 0.558f,
+ -0.3909f, 0.0f, -0.2191f, 0.559f, 0.559f,
+ -0.4032f, 0.0f, -0.2102f, 0.559f, 0.558f,
+ -0.4146f, 0.0f, -0.2027f, 0.559f, 0.559f,
+ -0.426f, 0.0f, -0.1968f, 0.558f, 0.558f,
+ -0.4348f, 0.0f, -0.1931f, 0.558f, 0.558f,
+ -0.4479f, 0.0f, -0.1886f, 0.555f, 0.559f,
};
static const float data1[33 * GP_PRIM_DATABUF_SIZE] = {
-0.5292f, -0.0f, 0.1742f, 0.1f, 1.0f,0.5291f, -0.0f, 0.1621f, 0.2199f, 1.0f,0.5274f, -0.0f, 0.1386f, 0.4615f, 1.0f,0.5239f, -0.0f, 0.116f, 0.6019f, 1.0f,
-0.5185f, -0.0f, 0.0945f, 0.6981f, 1.0f,0.5115f, -0.0f, 0.0741f, 0.7689f, 1.0f,0.503f, -0.0f, 0.0548f, 0.8236f, 1.0f,0.4931f, -0.0f, 0.0368f, 0.866f, 1.0f,
-0.482f, -0.0f, 0.02f, 0.9003f, 1.0f,0.4697f, -0.0f, 0.0046f, 0.9272f, 1.0f,0.4565f, 0.0f, -0.0094f, 0.9485f, 1.0f,0.4424f, 0.0f, -0.0219f, 0.9653f, 1.0f,
-0.4275f, 0.0f, -0.033f, 0.9781f, 1.0f,0.4121f, 0.0f, -0.0424f, 0.9876f, 1.0f,0.3961f, 0.0f, -0.0501f, 0.9942f, 1.0f,0.3799f, 0.0f, -0.0562f, 0.9983f, 1.0f,
-0.3634f, 0.0f, -0.0605f, 0.9997f, 1.0f,0.3468f, 0.0f, -0.0629f, 0.999f, 1.0f,0.3303f, 0.0f, -0.0634f, 0.9963f, 1.0f,0.3139f, 0.0f, -0.062f, 0.9912f, 1.0f,
-0.2979f, 0.0f, -0.0585f, 0.9834f, 1.0f,0.2823f, 0.0f, -0.0529f, 0.9724f, 1.0f,0.2672f, 0.0f, -0.0452f, 0.9576f, 1.0f,0.2529f, 0.0f, -0.0352f, 0.9385f, 1.0f,
-0.2393f, 0.0f, -0.023f, 0.9143f, 1.0f,0.2267f, 0.0f, -0.0085f, 0.8841f, 1.0f,0.2153f, -0.0f, 0.0085f, 0.8461f, 1.0f,0.205f, -0.0f, 0.0279f, 0.7979f, 1.0f,
-0.196f, -0.0f, 0.0499f, 0.7359f, 1.0f,0.1886f, -0.0f, 0.0745f, 0.6541f, 1.0f,0.1827f, -0.0f, 0.1017f, 0.5396f, 1.0f,0.1786f, -0.0f, 0.1316f, 0.36f, 1.0f,
-0.1763f, -0.0f, 0.1643f, 0.1f, 1.0f
+ 0.5292f, 0.0f, 0.1742f, 0.1f, 1.0f,
+ 0.5291f, 0.0f, 0.1621f, 0.2199f, 1.0f,
+ 0.5274f, 0.0f, 0.1386f, 0.4615f, 1.0f,
+ 0.5239f, 0.0f, 0.116f, 0.6019f, 1.0f,
+ 0.5185f, 0.0f, 0.0945f, 0.6981f, 1.0f,
+ 0.5115f, 0.0f, 0.0741f, 0.7689f, 1.0f,
+ 0.503f, 0.0f, 0.0548f, 0.8236f, 1.0f,
+ 0.4931f, 0.0f, 0.0368f, 0.866f, 1.0f,
+ 0.482f, 0.0f, 0.02f, 0.9003f, 1.0f,
+ 0.4697f, 0.0f, 0.0046f, 0.9272f, 1.0f,
+ 0.4565f, 0.0f, -0.0094f, 0.9485f, 1.0f,
+ 0.4424f, 0.0f, -0.0219f, 0.9653f, 1.0f,
+ 0.4275f, 0.0f, -0.033f, 0.9781f, 1.0f,
+ 0.4121f, 0.0f, -0.0424f, 0.9876f, 1.0f,
+ 0.3961f, 0.0f, -0.0501f, 0.9942f, 1.0f,
+ 0.3799f, 0.0f, -0.0562f, 0.9983f, 1.0f,
+ 0.3634f, 0.0f, -0.0605f, 0.9997f, 1.0f,
+ 0.3468f, 0.0f, -0.0629f, 0.999f, 1.0f,
+ 0.3303f, 0.0f, -0.0634f, 0.9963f, 1.0f,
+ 0.3139f, 0.0f, -0.062f, 0.9912f, 1.0f,
+ 0.2979f, 0.0f, -0.0585f, 0.9834f, 1.0f,
+ 0.2823f, 0.0f, -0.0529f, 0.9724f, 1.0f,
+ 0.2672f, 0.0f, -0.0452f, 0.9576f, 1.0f,
+ 0.2529f, 0.0f, -0.0352f, 0.9385f, 1.0f,
+ 0.2393f, 0.0f, -0.023f, 0.9143f, 1.0f,
+ 0.2267f, 0.0f, -0.0085f, 0.8841f, 1.0f,
+ 0.2153f, 0.0f, 0.0085f, 0.8461f, 1.0f,
+ 0.205f, 0.0f, 0.0279f, 0.7979f, 1.0f,
+ 0.196f, 0.0f, 0.0499f, 0.7359f, 1.0f,
+ 0.1886f, 0.0f, 0.0745f, 0.6541f, 1.0f,
+ 0.1827f, 0.0f, 0.1017f, 0.5396f, 1.0f,
+ 0.1786f, 0.0f, 0.1316f, 0.36f, 1.0f,
+ 0.1763f, 0.0f, 0.1643f, 0.1f, 1.0f,
};
static const float data2[18 * GP_PRIM_DATABUF_SIZE] = {
--0.0844f, 0.0f, -0.301f, 0.1f, 1.0f,-0.0825f, 0.0f, -0.3034f, 0.2199f, 1.0f,-0.0751f, 0.0f, -0.3128f, 0.6019f, 1.0f,-0.0677f, 0.0f, -0.3216f, 0.7689f, 1.0f,
--0.06f, 0.0f, -0.3298f, 0.866f, 1.0f,-0.0522f, 0.0f, -0.3372f, 0.9272f, 1.0f,-0.044f, 0.0f, -0.3437f, 0.9653f, 1.0f,-0.0354f, 0.0f, -0.3491f, 0.9876f, 1.0f,
--0.0264f, 0.0f, -0.3535f, 0.9983f, 1.0f,-0.0168f, 0.0f, -0.3566f, 0.999f, 1.0f,-0.0065f, 0.0f, -0.3583f, 0.9912f, 1.0f,0.0045f, 0.0f, -0.3585f, 0.9724f, 1.0f,
-0.0163f, 0.0f, -0.3571f, 0.9385f, 1.0f,0.029f, 0.0f, -0.354f, 0.8841f, 1.0f,0.0427f, 0.0f, -0.3491f, 0.7979f, 1.0f,0.0574f, 0.0f, -0.3421f, 0.6541f, 1.0f,
-0.0732f, 0.0f, -0.3331f, 0.36f, 1.0f,0.0816f, 0.0f, -0.3278f, 0.1f, 1.0f
+ -0.0844f, 0.0f, -0.301f, 0.1f, 1.0f,
+ -0.0825f, 0.0f, -0.3034f, 0.2199f, 1.0f,
+ -0.0751f, 0.0f, -0.3128f, 0.6019f, 1.0f,
+ -0.0677f, 0.0f, -0.3216f, 0.7689f, 1.0f,
+ -0.06f, 0.0f, -0.3298f, 0.866f, 1.0f,
+ -0.0522f, 0.0f, -0.3372f, 0.9272f, 1.0f,
+ -0.044f, 0.0f, -0.3437f, 0.9653f, 1.0f,
+ -0.0354f, 0.0f, -0.3491f, 0.9876f, 1.0f,
+ -0.0264f, 0.0f, -0.3535f, 0.9983f, 1.0f,
+ -0.0168f, 0.0f, -0.3566f, 0.999f, 1.0f,
+ -0.0065f, 0.0f, -0.3583f, 0.9912f, 1.0f,
+ 0.0045f, 0.0f, -0.3585f, 0.9724f, 1.0f,
+ 0.0163f, 0.0f, -0.3571f, 0.9385f, 1.0f,
+ 0.029f, 0.0f, -0.354f, 0.8841f, 1.0f,
+ 0.0427f, 0.0f, -0.3491f, 0.7979f, 1.0f,
+ 0.0574f, 0.0f, -0.3421f, 0.6541f, 1.0f,
+ 0.0732f, 0.0f, -0.3331f, 0.36f, 1.0f,
+ 0.0816f, 0.0f, -0.3278f, 0.1f, 1.0f,
};
static const float data3[64 * GP_PRIM_DATABUF_SIZE] = {
--0.6551f, -0.0f, 0.4448f, 0.1f, 1.0f,-0.6353f, -0.0f, 0.4689f, 0.2199f, 1.0f,-0.6211f, -0.0f, 0.4845f, 0.36f, 1.0f,-0.6033f, -0.0f, 0.5034f, 0.4615f, 1.0f,
--0.5856f, -0.0f, 0.5211f, 0.5396f, 1.0f,-0.5672f, -0.0f, 0.5387f, 0.6019f, 1.0f,-0.5485f, -0.0f, 0.5555f, 0.6541f, 1.0f,-0.5295f, -0.0f, 0.5718f, 0.6981f, 1.0f,
--0.5103f, -0.0f, 0.5875f, 0.7359f, 1.0f,-0.4909f, -0.0f, 0.6028f, 0.7689f, 1.0f,-0.4712f, -0.0f, 0.6174f, 0.7979f, 1.0f,-0.4512f, -0.0f, 0.6313f, 0.8236f, 1.0f,
--0.4307f, -0.0f, 0.6444f, 0.8461f, 1.0f,-0.4099f, -0.0f, 0.6568f, 0.866f, 1.0f,-0.3884f, -0.0f, 0.6684f, 0.8841f, 1.0f,-0.3665f, -0.0f, 0.6793f, 0.9003f, 1.0f,
--0.3439f, -0.0f, 0.6893f, 0.9143f, 1.0f,-0.3207f, -0.0f, 0.6984f, 0.9272f, 1.0f,-0.2971f, -0.0f, 0.7069f, 0.9385f, 1.0f,-0.2731f, -0.0f, 0.7148f, 0.9485f, 1.0f,
--0.249f, -0.0f, 0.7222f, 0.9576f, 1.0f,-0.2247f, -0.0f, 0.7292f, 0.9653f, 1.0f,-0.2003f, -0.0f, 0.7356f, 0.9724f, 1.0f,-0.1759f, -0.0f, 0.7416f, 0.9781f, 1.0f,
--0.1515f, -0.0f, 0.7471f, 0.9834f, 1.0f,-0.1272f, -0.0f, 0.7518f, 0.9876f, 1.0f,-0.1028f, -0.0f, 0.7556f, 0.9912f, 1.0f,-0.0785f, -0.0f, 0.7586f, 0.9942f, 1.0f,
--0.0543f, -0.0f, 0.7607f, 0.9963f, 1.0f,-0.0302f, -0.0f, 0.7621f, 0.9983f, 1.0f,-0.0062f, -0.0f, 0.7627f, 0.999f, 1.0f,0.0177f, -0.0f, 0.7625f, 0.9997f, 1.0f,
-0.0415f, -0.0f, 0.7616f, 0.9997f, 1.0f,0.0652f, -0.0f, 0.7602f, 0.999f, 1.0f,0.0887f, -0.0f, 0.7583f, 0.9983f, 1.0f,0.1122f, -0.0f, 0.7559f, 0.9963f, 1.0f,
-0.1355f, -0.0f, 0.7529f, 0.9942f, 1.0f,0.1585f, -0.0f, 0.7493f, 0.9912f, 1.0f,0.1814f, -0.0f, 0.7451f, 0.9876f, 1.0f,0.2041f, -0.0f, 0.7404f, 0.9834f, 1.0f,
-0.2266f, -0.0f, 0.7352f, 0.9781f, 1.0f,0.2488f, -0.0f, 0.729f, 0.9724f, 1.0f,0.2706f, -0.0f, 0.7216f, 0.9653f, 1.0f,0.2921f, -0.0f, 0.7131f, 0.9576f, 1.0f,
-0.3135f, -0.0f, 0.7041f, 0.9485f, 1.0f,0.3348f, -0.0f, 0.6945f, 0.9385f, 1.0f,0.3559f, -0.0f, 0.6845f, 0.9272f, 1.0f,0.3769f, -0.0f, 0.6739f, 0.9143f, 1.0f,
-0.3978f, -0.0f, 0.6628f, 0.9003f, 1.0f,0.4185f, -0.0f, 0.651f, 0.8841f, 1.0f,0.439f, -0.0f, 0.6383f, 0.866f, 1.0f,0.4594f, -0.0f, 0.6249f, 0.8461f, 1.0f,
-0.4795f, -0.0f, 0.6106f, 0.8236f, 1.0f,0.4995f, -0.0f, 0.5956f, 0.7979f, 1.0f,0.5193f, -0.0f, 0.5801f, 0.7689f, 1.0f,0.539f, -0.0f, 0.5642f, 0.7359f, 1.0f,
-0.5586f, -0.0f, 0.5479f, 0.6981f, 1.0f,0.578f, -0.0f, 0.5312f, 0.6541f, 1.0f,0.597f, -0.0f, 0.5141f, 0.6019f, 1.0f,0.6153f, -0.0f, 0.4966f, 0.5396f, 1.0f,
-0.6324f, -0.0f, 0.4797f, 0.4615f, 1.0f,0.6498f, -0.0f, 0.462f, 0.36f, 1.0f,0.6638f, -0.0f, 0.4477f, 0.2199f, 1.0f,0.6843f, -0.0f, 0.4263f, 0.1f, 1.0f
+ -0.6551f, 0.0f, 0.4448f, 0.1f, 1.0f,
+ -0.6353f, 0.0f, 0.4689f, 0.2199f, 1.0f,
+ -0.6211f, 0.0f, 0.4845f, 0.36f, 1.0f,
+ -0.6033f, 0.0f, 0.5034f, 0.4615f, 1.0f,
+ -0.5856f, 0.0f, 0.5211f, 0.5396f, 1.0f,
+ -0.5672f, 0.0f, 0.5387f, 0.6019f, 1.0f,
+ -0.5485f, 0.0f, 0.5555f, 0.6541f, 1.0f,
+ -0.5295f, 0.0f, 0.5718f, 0.6981f, 1.0f,
+ -0.5103f, 0.0f, 0.5875f, 0.7359f, 1.0f,
+ -0.4909f, 0.0f, 0.6028f, 0.7689f, 1.0f,
+ -0.4712f, 0.0f, 0.6174f, 0.7979f, 1.0f,
+ -0.4512f, 0.0f, 0.6313f, 0.8236f, 1.0f,
+ -0.4307f, 0.0f, 0.6444f, 0.8461f, 1.0f,
+ -0.4099f, 0.0f, 0.6568f, 0.866f, 1.0f,
+ -0.3884f, 0.0f, 0.6684f, 0.8841f, 1.0f,
+ -0.3665f, 0.0f, 0.6793f, 0.9003f, 1.0f,
+ -0.3439f, 0.0f, 0.6893f, 0.9143f, 1.0f,
+ -0.3207f, 0.0f, 0.6984f, 0.9272f, 1.0f,
+ -0.2971f, 0.0f, 0.7069f, 0.9385f, 1.0f,
+ -0.2731f, 0.0f, 0.7148f, 0.9485f, 1.0f,
+ -0.249f, 0.0f, 0.7222f, 0.9576f, 1.0f,
+ -0.2247f, 0.0f, 0.7292f, 0.9653f, 1.0f,
+ -0.2003f, 0.0f, 0.7356f, 0.9724f, 1.0f,
+ -0.1759f, 0.0f, 0.7416f, 0.9781f, 1.0f,
+ -0.1515f, 0.0f, 0.7471f, 0.9834f, 1.0f,
+ -0.1272f, 0.0f, 0.7518f, 0.9876f, 1.0f,
+ -0.1028f, 0.0f, 0.7556f, 0.9912f, 1.0f,
+ -0.0785f, 0.0f, 0.7586f, 0.9942f, 1.0f,
+ -0.0543f, 0.0f, 0.7607f, 0.9963f, 1.0f,
+ -0.0302f, 0.0f, 0.7621f, 0.9983f, 1.0f,
+ -0.0062f, 0.0f, 0.7627f, 0.999f, 1.0f,
+ 0.0177f, 0.0f, 0.7625f, 0.9997f, 1.0f,
+ 0.0415f, 0.0f, 0.7616f, 0.9997f, 1.0f,
+ 0.0652f, 0.0f, 0.7602f, 0.999f, 1.0f,
+ 0.0887f, 0.0f, 0.7583f, 0.9983f, 1.0f,
+ 0.1122f, 0.0f, 0.7559f, 0.9963f, 1.0f,
+ 0.1355f, 0.0f, 0.7529f, 0.9942f, 1.0f,
+ 0.1585f, 0.0f, 0.7493f, 0.9912f, 1.0f,
+ 0.1814f, 0.0f, 0.7451f, 0.9876f, 1.0f,
+ 0.2041f, 0.0f, 0.7404f, 0.9834f, 1.0f,
+ 0.2266f, 0.0f, 0.7352f, 0.9781f, 1.0f,
+ 0.2488f, 0.0f, 0.729f, 0.9724f, 1.0f,
+ 0.2706f, 0.0f, 0.7216f, 0.9653f, 1.0f,
+ 0.2921f, 0.0f, 0.7131f, 0.9576f, 1.0f,
+ 0.3135f, 0.0f, 0.7041f, 0.9485f, 1.0f,
+ 0.3348f, 0.0f, 0.6945f, 0.9385f, 1.0f,
+ 0.3559f, 0.0f, 0.6845f, 0.9272f, 1.0f,
+ 0.3769f, 0.0f, 0.6739f, 0.9143f, 1.0f,
+ 0.3978f, 0.0f, 0.6628f, 0.9003f, 1.0f,
+ 0.4185f, 0.0f, 0.651f, 0.8841f, 1.0f,
+ 0.439f, 0.0f, 0.6383f, 0.866f, 1.0f,
+ 0.4594f, 0.0f, 0.6249f, 0.8461f, 1.0f,
+ 0.4795f, 0.0f, 0.6106f, 0.8236f, 1.0f,
+ 0.4995f, 0.0f, 0.5956f, 0.7979f, 1.0f,
+ 0.5193f, 0.0f, 0.5801f, 0.7689f, 1.0f,
+ 0.539f, 0.0f, 0.5642f, 0.7359f, 1.0f,
+ 0.5586f, 0.0f, 0.5479f, 0.6981f, 1.0f,
+ 0.578f, 0.0f, 0.5312f, 0.6541f, 1.0f,
+ 0.597f, 0.0f, 0.5141f, 0.6019f, 1.0f,
+ 0.6153f, 0.0f, 0.4966f, 0.5396f, 1.0f,
+ 0.6324f, 0.0f, 0.4797f, 0.4615f, 1.0f,
+ 0.6498f, 0.0f, 0.462f, 0.36f, 1.0f,
+ 0.6638f, 0.0f, 0.4477f, 0.2199f, 1.0f,
+ 0.6843f, 0.0f, 0.4263f, 0.1f, 1.0f,
};
static const float data4[33 * GP_PRIM_DATABUF_SIZE] = {
--0.7765f, -0.0f, 0.3255f, 0.1f, 1.0f,-0.7908f, -0.0f, 0.3335f, 0.2199f, 1.0f,-0.8048f, -0.0f, 0.3402f, 0.4615f, 1.0f,-0.8225f, -0.0f, 0.3467f, 0.6019f, 1.0f,
--0.8426f, -0.0f, 0.3529f, 0.6981f, 1.0f,-0.8651f, -0.0f, 0.3587f, 0.7689f, 1.0f,-0.8878f, -0.0f, 0.3633f, 0.8236f, 1.0f,-0.9105f, -0.0f, 0.367f, 0.866f, 1.0f,
--0.9323f, -0.0f, 0.3693f, 0.9003f, 1.0f,-0.9529f, -0.0f, 0.3701f, 0.9272f, 1.0f,-0.972f, -0.0f, 0.3695f, 0.9485f, 1.0f,-0.9896f, -0.0f, 0.3675f, 0.9653f, 1.0f,
--1.0057f, -0.0f, 0.364f, 0.9781f, 1.0f,-1.0203f, -0.0f, 0.3592f, 0.9876f, 1.0f,-1.0333f, -0.0f, 0.3528f, 0.9942f, 1.0f,-1.0447f, -0.0f, 0.3452f, 0.9983f, 1.0f,
--1.0546f, -0.0f, 0.3362f, 0.9997f, 1.0f,-1.0633f, -0.0f, 0.3261f, 0.999f, 1.0f,-1.0708f, -0.0f, 0.315f, 0.9963f, 1.0f,-1.0767f, -0.0f, 0.3027f, 0.9912f, 1.0f,
--1.0818f, -0.0f, 0.2894f, 0.9834f, 1.0f,-1.0861f, -0.0f, 0.2752f, 0.9724f, 1.0f,-1.0897f, -0.0f, 0.2604f, 0.9576f, 1.0f,-1.0922f, -0.0f, 0.2446f, 0.9385f, 1.0f,
--1.0938f, -0.0f, 0.2277f, 0.9143f, 1.0f,-1.0944f, -0.0f, 0.2098f, 0.8841f, 1.0f,-1.0939f, -0.0f, 0.191f, 0.8461f, 1.0f,-1.0924f, -0.0f, 0.1714f, 0.7979f, 1.0f,
--1.0897f, -0.0f, 0.1511f, 0.7359f, 1.0f,-1.0855f, -0.0f, 0.1303f, 0.6541f, 1.0f,-1.0798f, -0.0f, 0.1095f, 0.5396f, 1.0f,-1.0723f, -0.0f, 0.089f, 0.36f, 1.0f,
--1.0642f, -0.0f, 0.0702f, 0.1f, 1.0f
+ -0.7765f, 0.0f, 0.3255f, 0.1f, 1.0f,
+ -0.7908f, 0.0f, 0.3335f, 0.2199f, 1.0f,
+ -0.8048f, 0.0f, 0.3402f, 0.4615f, 1.0f,
+ -0.8225f, 0.0f, 0.3467f, 0.6019f, 1.0f,
+ -0.8426f, 0.0f, 0.3529f, 0.6981f, 1.0f,
+ -0.8651f, 0.0f, 0.3587f, 0.7689f, 1.0f,
+ -0.8878f, 0.0f, 0.3633f, 0.8236f, 1.0f,
+ -0.9105f, 0.0f, 0.367f, 0.866f, 1.0f,
+ -0.9323f, 0.0f, 0.3693f, 0.9003f, 1.0f,
+ -0.9529f, 0.0f, 0.3701f, 0.9272f, 1.0f,
+ -0.972f, 0.0f, 0.3695f, 0.9485f, 1.0f,
+ -0.9896f, 0.0f, 0.3675f, 0.9653f, 1.0f,
+ -1.0057f, 0.0f, 0.364f, 0.9781f, 1.0f,
+ -1.0203f, 0.0f, 0.3592f, 0.9876f, 1.0f,
+ -1.0333f, 0.0f, 0.3528f, 0.9942f, 1.0f,
+ -1.0447f, 0.0f, 0.3452f, 0.9983f, 1.0f,
+ -1.0546f, 0.0f, 0.3362f, 0.9997f, 1.0f,
+ -1.0633f, 0.0f, 0.3261f, 0.999f, 1.0f,
+ -1.0708f, 0.0f, 0.315f, 0.9963f, 1.0f,
+ -1.0767f, 0.0f, 0.3027f, 0.9912f, 1.0f,
+ -1.0818f, 0.0f, 0.2894f, 0.9834f, 1.0f,
+ -1.0861f, 0.0f, 0.2752f, 0.9724f, 1.0f,
+ -1.0897f, 0.0f, 0.2604f, 0.9576f, 1.0f,
+ -1.0922f, 0.0f, 0.2446f, 0.9385f, 1.0f,
+ -1.0938f, 0.0f, 0.2277f, 0.9143f, 1.0f,
+ -1.0944f, 0.0f, 0.2098f, 0.8841f, 1.0f,
+ -1.0939f, 0.0f, 0.191f, 0.8461f, 1.0f,
+ -1.0924f, 0.0f, 0.1714f, 0.7979f, 1.0f,
+ -1.0897f, 0.0f, 0.1511f, 0.7359f, 1.0f,
+ -1.0855f, 0.0f, 0.1303f, 0.6541f, 1.0f,
+ -1.0798f, 0.0f, 0.1095f, 0.5396f, 1.0f,
+ -1.0723f, 0.0f, 0.089f, 0.36f, 1.0f,
+ -1.0642f, 0.0f, 0.0702f, 0.1f, 1.0f,
};
static const float data5[64 * GP_PRIM_DATABUF_SIZE] = {
-0.8135f, -0.0f, 0.3341f, 0.1f, 1.0f,0.8191f, -0.0f, 0.3376f, 0.2199f, 1.0f,0.8246f, -0.0f, 0.3408f, 0.36f, 1.0f,0.8304f, -0.0f, 0.3438f, 0.4615f, 1.0f,
-0.8368f, -0.0f, 0.3465f, 0.5396f, 1.0f,0.843f, -0.0f, 0.3491f, 0.6019f, 1.0f,0.8494f, -0.0f, 0.3515f, 0.6541f, 1.0f,0.8558f, -0.0f, 0.3536f, 0.6981f, 1.0f,
-0.8623f, -0.0f, 0.3557f, 0.7359f, 1.0f,0.8688f, -0.0f, 0.3575f, 0.7689f, 1.0f,0.8752f, -0.0f, 0.3593f, 0.7979f, 1.0f,0.8813f, -0.0f, 0.3609f, 0.8236f, 1.0f,
-0.8872f, -0.0f, 0.3625f, 0.8461f, 1.0f,0.8929f, -0.0f, 0.364f, 0.866f, 1.0f,0.8984f, -0.0f, 0.3653f, 0.8841f, 1.0f,0.9039f, -0.0f, 0.3665f, 0.9003f, 1.0f,
-0.9093f, -0.0f, 0.3675f, 0.9143f, 1.0f,0.9146f, -0.0f, 0.3684f, 0.9272f, 1.0f,0.9199f, -0.0f, 0.3692f, 0.9385f, 1.0f,0.9253f, -0.0f, 0.3698f, 0.9485f, 1.0f,
-0.9305f, -0.0f, 0.3703f, 0.9576f, 1.0f,0.9358f, -0.0f, 0.3706f, 0.9653f, 1.0f,0.941f, -0.0f, 0.3709f, 0.9724f, 1.0f,0.9462f, -0.0f, 0.371f, 0.9781f, 1.0f,
-0.9514f, -0.0f, 0.371f, 0.9834f, 1.0f,0.9566f, -0.0f, 0.3708f, 0.9876f, 1.0f,0.9617f, -0.0f, 0.3706f, 0.9912f, 1.0f,0.9668f, -0.0f, 0.3702f, 0.9942f, 1.0f,
-0.9718f, -0.0f, 0.3697f, 0.9963f, 1.0f,0.9768f, -0.0f, 0.3692f, 0.9983f, 1.0f,0.9818f, -0.0f, 0.3685f, 0.999f, 1.0f,0.9867f, -0.0f, 0.3677f, 0.9997f, 1.0f,
-0.9916f, -0.0f, 0.3667f, 0.9997f, 1.0f,0.9964f, -0.0f, 0.3657f, 0.999f, 1.0f,1.0012f, -0.0f, 0.3646f, 0.9983f, 1.0f,1.006f, -0.0f, 0.3634f, 0.9963f, 1.0f,
-1.0107f, -0.0f, 0.3621f, 0.9942f, 1.0f,1.0154f, -0.0f, 0.3607f, 0.9912f, 1.0f,1.02f, -0.0f, 0.3593f, 0.9876f, 1.0f,1.0245f, -0.0f, 0.3577f, 0.9834f, 1.0f,
-1.029f, -0.0f, 0.3561f, 0.9781f, 1.0f,1.0335f, -0.0f, 0.3543f, 0.9724f, 1.0f,1.0379f, -0.0f, 0.3525f, 0.9653f, 1.0f,1.0422f, -0.0f, 0.3507f, 0.9576f, 1.0f,
-1.0465f, -0.0f, 0.3487f, 0.9485f, 1.0f,1.0507f, -0.0f, 0.3468f, 0.9385f, 1.0f,1.0549f, -0.0f, 0.3447f, 0.9272f, 1.0f,1.0591f, -0.0f, 0.3427f, 0.9143f, 1.0f,
-1.0633f, -0.0f, 0.3404f, 0.9003f, 1.0f,1.0675f, -0.0f, 0.338f, 0.8841f, 1.0f,1.0717f, -0.0f, 0.3351f, 0.866f, 1.0f,1.0761f, -0.0f, 0.3318f, 0.8461f, 1.0f,
-1.0805f, -0.0f, 0.3279f, 0.8236f, 1.0f,1.0849f, -0.0f, 0.3235f, 0.7979f, 1.0f,1.0893f, -0.0f, 0.3186f, 0.7689f, 1.0f,1.0936f, -0.0f, 0.3134f, 0.7359f, 1.0f,
-1.0979f, -0.0f, 0.3076f, 0.6981f, 1.0f,1.102f, -0.0f, 0.3017f, 0.6541f, 1.0f,1.106f, -0.0f, 0.2953f, 0.6019f, 1.0f,1.1097f, -0.0f, 0.289f, 0.5396f, 1.0f,
-1.1132f, -0.0f, 0.2826f, 0.4615f, 1.0f,1.1164f, -0.0f, 0.2766f, 0.36f, 1.0f,1.1193f, -0.0f, 0.2708f, 0.2199f, 1.0f,1.1221f, -0.0f, 0.2652f, 0.1f, 1.0f
+ 0.8135f, 0.0f, 0.3341f, 0.1f, 1.0f,
+ 0.8191f, 0.0f, 0.3376f, 0.2199f, 1.0f,
+ 0.8246f, 0.0f, 0.3408f, 0.36f, 1.0f,
+ 0.8304f, 0.0f, 0.3438f, 0.4615f, 1.0f,
+ 0.8368f, 0.0f, 0.3465f, 0.5396f, 1.0f,
+ 0.843f, 0.0f, 0.3491f, 0.6019f, 1.0f,
+ 0.8494f, 0.0f, 0.3515f, 0.6541f, 1.0f,
+ 0.8558f, 0.0f, 0.3536f, 0.6981f, 1.0f,
+ 0.8623f, 0.0f, 0.3557f, 0.7359f, 1.0f,
+ 0.8688f, 0.0f, 0.3575f, 0.7689f, 1.0f,
+ 0.8752f, 0.0f, 0.3593f, 0.7979f, 1.0f,
+ 0.8813f, 0.0f, 0.3609f, 0.8236f, 1.0f,
+ 0.8872f, 0.0f, 0.3625f, 0.8461f, 1.0f,
+ 0.8929f, 0.0f, 0.364f, 0.866f, 1.0f,
+ 0.8984f, 0.0f, 0.3653f, 0.8841f, 1.0f,
+ 0.9039f, 0.0f, 0.3665f, 0.9003f, 1.0f,
+ 0.9093f, 0.0f, 0.3675f, 0.9143f, 1.0f,
+ 0.9146f, 0.0f, 0.3684f, 0.9272f, 1.0f,
+ 0.9199f, 0.0f, 0.3692f, 0.9385f, 1.0f,
+ 0.9253f, 0.0f, 0.3698f, 0.9485f, 1.0f,
+ 0.9305f, 0.0f, 0.3703f, 0.9576f, 1.0f,
+ 0.9358f, 0.0f, 0.3706f, 0.9653f, 1.0f,
+ 0.941f, 0.0f, 0.3709f, 0.9724f, 1.0f,
+ 0.9462f, 0.0f, 0.371f, 0.9781f, 1.0f,
+ 0.9514f, 0.0f, 0.371f, 0.9834f, 1.0f,
+ 0.9566f, 0.0f, 0.3708f, 0.9876f, 1.0f,
+ 0.9617f, 0.0f, 0.3706f, 0.9912f, 1.0f,
+ 0.9668f, 0.0f, 0.3702f, 0.9942f, 1.0f,
+ 0.9718f, 0.0f, 0.3697f, 0.9963f, 1.0f,
+ 0.9768f, 0.0f, 0.3692f, 0.9983f, 1.0f,
+ 0.9818f, 0.0f, 0.3685f, 0.999f, 1.0f,
+ 0.9867f, 0.0f, 0.3677f, 0.9997f, 1.0f,
+ 0.9916f, 0.0f, 0.3667f, 0.9997f, 1.0f,
+ 0.9964f, 0.0f, 0.3657f, 0.999f, 1.0f,
+ 1.0012f, 0.0f, 0.3646f, 0.9983f, 1.0f,
+ 1.006f, 0.0f, 0.3634f, 0.9963f, 1.0f,
+ 1.0107f, 0.0f, 0.3621f, 0.9942f, 1.0f,
+ 1.0154f, 0.0f, 0.3607f, 0.9912f, 1.0f,
+ 1.02f, 0.0f, 0.3593f, 0.9876f, 1.0f,
+ 1.0245f, 0.0f, 0.3577f, 0.9834f, 1.0f,
+ 1.029f, 0.0f, 0.3561f, 0.9781f, 1.0f,
+ 1.0335f, 0.0f, 0.3543f, 0.9724f, 1.0f,
+ 1.0379f, 0.0f, 0.3525f, 0.9653f, 1.0f,
+ 1.0422f, 0.0f, 0.3507f, 0.9576f, 1.0f,
+ 1.0465f, 0.0f, 0.3487f, 0.9485f, 1.0f,
+ 1.0507f, 0.0f, 0.3468f, 0.9385f, 1.0f,
+ 1.0549f, 0.0f, 0.3447f, 0.9272f, 1.0f,
+ 1.0591f, 0.0f, 0.3427f, 0.9143f, 1.0f,
+ 1.0633f, 0.0f, 0.3404f, 0.9003f, 1.0f,
+ 1.0675f, 0.0f, 0.338f, 0.8841f, 1.0f,
+ 1.0717f, 0.0f, 0.3351f, 0.866f, 1.0f,
+ 1.0761f, 0.0f, 0.3318f, 0.8461f, 1.0f,
+ 1.0805f, 0.0f, 0.3279f, 0.8236f, 1.0f,
+ 1.0849f, 0.0f, 0.3235f, 0.7979f, 1.0f,
+ 1.0893f, 0.0f, 0.3186f, 0.7689f, 1.0f,
+ 1.0936f, 0.0f, 0.3134f, 0.7359f, 1.0f,
+ 1.0979f, 0.0f, 0.3076f, 0.6981f, 1.0f,
+ 1.102f, 0.0f, 0.3017f, 0.6541f, 1.0f,
+ 1.106f, 0.0f, 0.2953f, 0.6019f, 1.0f,
+ 1.1097f, 0.0f, 0.289f, 0.5396f, 1.0f,
+ 1.1132f, 0.0f, 0.2826f, 0.4615f, 1.0f,
+ 1.1164f, 0.0f, 0.2766f, 0.36f, 1.0f,
+ 1.1193f, 0.0f, 0.2708f, 0.2199f, 1.0f,
+ 1.1221f, 0.0f, 0.2652f, 0.1f, 1.0f,
};
static const float data6[33 * GP_PRIM_DATABUF_SIZE] = {
--0.2677f, 0.0f, -0.3496f, 0.1f, 1.0f,-0.2658f, 0.0f, -0.3919f, 0.2199f, 1.0f,-0.2657f, 0.0f, -0.4295f, 0.4615f, 1.0f,-0.2691f, 0.0f, -0.4621f, 0.6019f, 1.0f,
--0.275f, 0.0f, -0.4949f, 0.6981f, 1.0f,-0.2828f, 0.0f, -0.527f, 0.7689f, 1.0f,-0.2911f, 0.0f, -0.5578f, 0.8236f, 1.0f,-0.2971f, 0.0f, -0.5884f, 0.866f, 1.0f,
--0.303f, 0.0f, -0.6181f, 0.9003f, 1.0f,-0.3089f, 0.0f, -0.6467f, 0.9272f, 1.0f,-0.3148f, 0.0f, -0.6738f, 0.9485f, 1.0f,-0.3196f, 0.0f, -0.7f, 0.9653f, 1.0f,
--0.323f, 0.0f, -0.7253f, 0.9781f, 1.0f,-0.3234f, 0.0f, -0.7496f, 0.9876f, 1.0f,-0.3219f, 0.0f, -0.7728f, 0.9942f, 1.0f,-0.3184f, 0.0f, -0.7949f, 0.9983f, 1.0f,
--0.3103f, 0.0f, -0.8138f, 0.9997f, 1.0f,-0.3004f, 0.0f, -0.8307f, 0.999f, 1.0f,-0.2892f, 0.0f, -0.8464f, 0.9963f, 1.0f,-0.2766f, 0.0f, -0.8611f, 0.9912f, 1.0f,
--0.2618f, 0.0f, -0.8735f, 0.9834f, 1.0f,-0.2469f, 0.0f, -0.8853f, 0.9724f, 1.0f,-0.2315f, 0.0f, -0.8964f, 0.9576f, 1.0f,-0.2158f, 0.0f, -0.9068f, 0.9385f, 1.0f,
--0.1997f, 0.0f, -0.9167f, 0.9143f, 1.0f,-0.1833f, 0.0f, -0.9262f, 0.8841f, 1.0f,-0.1663f, 0.0f, -0.9355f, 0.8461f, 1.0f,-0.1481f, 0.0f, -0.9445f, 0.7979f, 1.0f,
--0.1282f, 0.0f, -0.9534f, 0.7359f, 1.0f,-0.1077f, 0.0f, -0.9625f, 0.6541f, 1.0f,-0.0854f, 0.0f, -0.9718f, 0.5396f, 1.0f,-0.0616f, 0.0f, -0.9813f, 0.36f, 1.0f,
--0.0248f, 0.0f, -0.992f, 0.1f, 1.0f
+ -0.2677f, 0.0f, -0.3496f, 0.1f, 1.0f,
+ -0.2658f, 0.0f, -0.3919f, 0.2199f, 1.0f,
+ -0.2657f, 0.0f, -0.4295f, 0.4615f, 1.0f,
+ -0.2691f, 0.0f, -0.4621f, 0.6019f, 1.0f,
+ -0.275f, 0.0f, -0.4949f, 0.6981f, 1.0f,
+ -0.2828f, 0.0f, -0.527f, 0.7689f, 1.0f,
+ -0.2911f, 0.0f, -0.5578f, 0.8236f, 1.0f,
+ -0.2971f, 0.0f, -0.5884f, 0.866f, 1.0f,
+ -0.303f, 0.0f, -0.6181f, 0.9003f, 1.0f,
+ -0.3089f, 0.0f, -0.6467f, 0.9272f, 1.0f,
+ -0.3148f, 0.0f, -0.6738f, 0.9485f, 1.0f,
+ -0.3196f, 0.0f, -0.7f, 0.9653f, 1.0f,
+ -0.323f, 0.0f, -0.7253f, 0.9781f, 1.0f,
+ -0.3234f, 0.0f, -0.7496f, 0.9876f, 1.0f,
+ -0.3219f, 0.0f, -0.7728f, 0.9942f, 1.0f,
+ -0.3184f, 0.0f, -0.7949f, 0.9983f, 1.0f,
+ -0.3103f, 0.0f, -0.8138f, 0.9997f, 1.0f,
+ -0.3004f, 0.0f, -0.8307f, 0.999f, 1.0f,
+ -0.2892f, 0.0f, -0.8464f, 0.9963f, 1.0f,
+ -0.2766f, 0.0f, -0.8611f, 0.9912f, 1.0f,
+ -0.2618f, 0.0f, -0.8735f, 0.9834f, 1.0f,
+ -0.2469f, 0.0f, -0.8853f, 0.9724f, 1.0f,
+ -0.2315f, 0.0f, -0.8964f, 0.9576f, 1.0f,
+ -0.2158f, 0.0f, -0.9068f, 0.9385f, 1.0f,
+ -0.1997f, 0.0f, -0.9167f, 0.9143f, 1.0f,
+ -0.1833f, 0.0f, -0.9262f, 0.8841f, 1.0f,
+ -0.1663f, 0.0f, -0.9355f, 0.8461f, 1.0f,
+ -0.1481f, 0.0f, -0.9445f, 0.7979f, 1.0f,
+ -0.1282f, 0.0f, -0.9534f, 0.7359f, 1.0f,
+ -0.1077f, 0.0f, -0.9625f, 0.6541f, 1.0f,
+ -0.0854f, 0.0f, -0.9718f, 0.5396f, 1.0f,
+ -0.0616f, 0.0f, -0.9813f, 0.36f, 1.0f,
+ -0.0248f, 0.0f, -0.992f, 0.1f, 1.0f,
};
static const float data7[18 * GP_PRIM_DATABUF_SIZE] = {
--0.0618f, 0.0f, -0.1922f, 0.1f, 1.0f,-0.0703f, 0.0f, -0.2021f, 0.2199f, 1.0f,-0.0758f, 0.0f, -0.2103f, 0.6019f, 1.0f,-0.0803f, 0.0f, -0.2206f, 0.7689f, 1.0f,
--0.083f, 0.0f, -0.2307f, 0.866f, 1.0f,-0.0851f, 0.0f, -0.2405f, 0.9272f, 1.0f,-0.0865f, 0.0f, -0.2499f, 0.9653f, 1.0f,-0.0872f, 0.0f, -0.2588f, 0.9876f, 1.0f,
--0.0869f, 0.0f, -0.2673f, 0.9983f, 1.0f,-0.0858f, 0.0f, -0.2754f, 0.999f, 1.0f,-0.0831f, 0.0f, -0.2829f, 0.9912f, 1.0f,-0.0791f, 0.0f, -0.2898f, 0.9724f, 1.0f,
--0.074f, 0.0f, -0.2966f, 0.9385f, 1.0f,-0.0674f, 0.0f, -0.303f, 0.8841f, 1.0f,-0.0591f, 0.0f, -0.3084f, 0.7979f, 1.0f,-0.0465f, 0.0f, -0.3134f, 0.6541f, 1.0f,
--0.0331f, 0.0f, -0.3165f, 0.36f, 1.0f,-0.015f, 0.0f, -0.318f, 0.1f, 1.0f
+ -0.0618f, 0.0f, -0.1922f, 0.1f, 1.0f,
+ -0.0703f, 0.0f, -0.2021f, 0.2199f, 1.0f,
+ -0.0758f, 0.0f, -0.2103f, 0.6019f, 1.0f,
+ -0.0803f, 0.0f, -0.2206f, 0.7689f, 1.0f,
+ -0.083f, 0.0f, -0.2307f, 0.866f, 1.0f,
+ -0.0851f, 0.0f, -0.2405f, 0.9272f, 1.0f,
+ -0.0865f, 0.0f, -0.2499f, 0.9653f, 1.0f,
+ -0.0872f, 0.0f, -0.2588f, 0.9876f, 1.0f,
+ -0.0869f, 0.0f, -0.2673f, 0.9983f, 1.0f,
+ -0.0858f, 0.0f, -0.2754f, 0.999f, 1.0f,
+ -0.0831f, 0.0f, -0.2829f, 0.9912f, 1.0f,
+ -0.0791f, 0.0f, -0.2898f, 0.9724f, 1.0f,
+ -0.074f, 0.0f, -0.2966f, 0.9385f, 1.0f,
+ -0.0674f, 0.0f, -0.303f, 0.8841f, 1.0f,
+ -0.0591f, 0.0f, -0.3084f, 0.7979f, 1.0f,
+ -0.0465f, 0.0f, -0.3134f, 0.6541f, 1.0f,
+ -0.0331f, 0.0f, -0.3165f, 0.36f, 1.0f,
+ -0.015f, 0.0f, -0.318f, 0.1f, 1.0f,
};
static const float data8[49 * GP_PRIM_DATABUF_SIZE] = {
-0.5311f, -0.0f, 0.1661f, 1.0f, 1.0f,0.5307f, -0.0f, 0.1794f, 1.0f, 1.0f,0.5277f, -0.0f, 0.2057f, 1.0f, 1.0f,0.5218f, -0.0f, 0.2314f, 1.0f, 1.0f,
-0.513f, -0.0f, 0.256f, 1.0f, 1.0f,0.5014f, -0.0f, 0.279f, 1.0f, 1.0f,0.4874f, -0.0f, 0.3001f, 1.0f, 1.0f,0.4711f, -0.0f, 0.3189f, 1.0f, 1.0f,
-0.4529f, -0.0f, 0.3351f, 1.0f, 1.0f,0.4329f, -0.0f, 0.3483f, 1.0f, 1.0f,0.4117f, -0.0f, 0.3585f, 1.0f, 1.0f,0.3894f, -0.0f, 0.3654f, 1.0f, 1.0f,
-0.3666f, -0.0f, 0.3689f, 1.0f, 1.0f,0.3435f, -0.0f, 0.3689f, 1.0f, 1.0f,0.3207f, -0.0f, 0.3654f, 1.0f, 1.0f,0.2985f, -0.0f, 0.3585f, 1.0f, 1.0f,
-0.2772f, -0.0f, 0.3483f, 1.0f, 1.0f,0.2573f, -0.0f, 0.3351f, 1.0f, 1.0f,0.239f, -0.0f, 0.3189f, 1.0f, 1.0f,0.2227f, -0.0f, 0.3001f, 1.0f, 1.0f,
-0.2087f, -0.0f, 0.279f, 1.0f, 1.0f,0.1972f, -0.0f, 0.256f, 1.0f, 1.0f,0.1884f, -0.0f, 0.2314f, 1.0f, 1.0f,0.1824f, -0.0f, 0.2057f, 1.0f, 1.0f,
-0.1794f, -0.0f, 0.1794f, 1.0f, 1.0f,0.1794f, -0.0f, 0.1528f, 1.0f, 1.0f,0.1824f, -0.0f, 0.1264f, 1.0f, 1.0f,0.1884f, -0.0f, 0.1007f, 1.0f, 1.0f,
-0.1972f, -0.0f, 0.0762f, 1.0f, 1.0f,0.2087f, -0.0f, 0.0531f, 1.0f, 1.0f,0.2227f, -0.0f, 0.032f, 1.0f, 1.0f,0.239f, -0.0f, 0.0132f, 1.0f, 1.0f,
-0.2573f, 0.0f, -0.0029f, 1.0f, 1.0f,0.2772f, 0.0f, -0.0162f, 1.0f, 1.0f,0.2985f, 0.0f, -0.0264f, 1.0f, 1.0f,0.3207f, 0.0f, -0.0333f, 1.0f, 1.0f,
-0.3435f, 0.0f, -0.0368f, 1.0f, 1.0f,0.3666f, 0.0f, -0.0368f, 1.0f, 1.0f,0.3894f, 0.0f, -0.0333f, 1.0f, 1.0f,0.4117f, 0.0f, -0.0264f, 1.0f, 1.0f,
-0.4329f, 0.0f, -0.0162f, 1.0f, 1.0f,0.4529f, 0.0f, -0.0029f, 1.0f, 1.0f,0.4711f, -0.0f, 0.0132f, 1.0f, 1.0f,0.4874f, -0.0f, 0.032f, 1.0f, 1.0f,
-0.5014f, -0.0f, 0.0531f, 1.0f, 1.0f,0.513f, -0.0f, 0.0762f, 1.0f, 1.0f,0.5218f, -0.0f, 0.1007f, 1.0f, 1.0f,0.5277f, -0.0f, 0.1264f, 1.0f, 1.0f,
-0.5307f, -0.0f, 0.1528f, 1.0f, 1.0f
+ 0.5311f, 0.0f, 0.1661f, 1.0f, 1.0f,
+ 0.5307f, 0.0f, 0.1794f, 1.0f, 1.0f,
+ 0.5277f, 0.0f, 0.2057f, 1.0f, 1.0f,
+ 0.5218f, 0.0f, 0.2314f, 1.0f, 1.0f,
+ 0.513f, 0.0f, 0.256f, 1.0f, 1.0f,
+ 0.5014f, 0.0f, 0.279f, 1.0f, 1.0f,
+ 0.4874f, 0.0f, 0.3001f, 1.0f, 1.0f,
+ 0.4711f, 0.0f, 0.3189f, 1.0f, 1.0f,
+ 0.4529f, 0.0f, 0.3351f, 1.0f, 1.0f,
+ 0.4329f, 0.0f, 0.3483f, 1.0f, 1.0f,
+ 0.4117f, 0.0f, 0.3585f, 1.0f, 1.0f,
+ 0.3894f, 0.0f, 0.3654f, 1.0f, 1.0f,
+ 0.3666f, 0.0f, 0.3689f, 1.0f, 1.0f,
+ 0.3435f, 0.0f, 0.3689f, 1.0f, 1.0f,
+ 0.3207f, 0.0f, 0.3654f, 1.0f, 1.0f,
+ 0.2985f, 0.0f, 0.3585f, 1.0f, 1.0f,
+ 0.2772f, 0.0f, 0.3483f, 1.0f, 1.0f,
+ 0.2573f, 0.0f, 0.3351f, 1.0f, 1.0f,
+ 0.239f, 0.0f, 0.3189f, 1.0f, 1.0f,
+ 0.2227f, 0.0f, 0.3001f, 1.0f, 1.0f,
+ 0.2087f, 0.0f, 0.279f, 1.0f, 1.0f,
+ 0.1972f, 0.0f, 0.256f, 1.0f, 1.0f,
+ 0.1884f, 0.0f, 0.2314f, 1.0f, 1.0f,
+ 0.1824f, 0.0f, 0.2057f, 1.0f, 1.0f,
+ 0.1794f, 0.0f, 0.1794f, 1.0f, 1.0f,
+ 0.1794f, 0.0f, 0.1528f, 1.0f, 1.0f,
+ 0.1824f, 0.0f, 0.1264f, 1.0f, 1.0f,
+ 0.1884f, 0.0f, 0.1007f, 1.0f, 1.0f,
+ 0.1972f, 0.0f, 0.0762f, 1.0f, 1.0f,
+ 0.2087f, 0.0f, 0.0531f, 1.0f, 1.0f,
+ 0.2227f, 0.0f, 0.032f, 1.0f, 1.0f,
+ 0.239f, 0.0f, 0.0132f, 1.0f, 1.0f,
+ 0.2573f, 0.0f, -0.0029f, 1.0f, 1.0f,
+ 0.2772f, 0.0f, -0.0162f, 1.0f, 1.0f,
+ 0.2985f, 0.0f, -0.0264f, 1.0f, 1.0f,
+ 0.3207f, 0.0f, -0.0333f, 1.0f, 1.0f,
+ 0.3435f, 0.0f, -0.0368f, 1.0f, 1.0f,
+ 0.3666f, 0.0f, -0.0368f, 1.0f, 1.0f,
+ 0.3894f, 0.0f, -0.0333f, 1.0f, 1.0f,
+ 0.4117f, 0.0f, -0.0264f, 1.0f, 1.0f,
+ 0.4329f, 0.0f, -0.0162f, 1.0f, 1.0f,
+ 0.4529f, 0.0f, -0.0029f, 1.0f, 1.0f,
+ 0.4711f, 0.0f, 0.0132f, 1.0f, 1.0f,
+ 0.4874f, 0.0f, 0.032f, 1.0f, 1.0f,
+ 0.5014f, 0.0f, 0.0531f, 1.0f, 1.0f,
+ 0.513f, 0.0f, 0.0762f, 1.0f, 1.0f,
+ 0.5218f, 0.0f, 0.1007f, 1.0f, 1.0f,
+ 0.5277f, 0.0f, 0.1264f, 1.0f, 1.0f,
+ 0.5307f, 0.0f, 0.1528f, 1.0f, 1.0f,
};
static const float data9[33 * GP_PRIM_DATABUF_SIZE] = {
--0.5271f, -0.0f, 0.1742f, 0.1f, 1.0f,-0.527f, -0.0f, 0.1621f, 0.2199f, 1.0f,-0.5253f, -0.0f, 0.1386f, 0.4615f, 1.0f,-0.5217f, -0.0f, 0.116f, 0.6019f, 1.0f,
--0.5164f, -0.0f, 0.0945f, 0.6981f, 1.0f,-0.5094f, -0.0f, 0.0741f, 0.7689f, 1.0f,-0.5009f, -0.0f, 0.0548f, 0.8236f, 1.0f,-0.491f, -0.0f, 0.0368f, 0.866f, 1.0f,
--0.4799f, -0.0f, 0.02f, 0.9003f, 1.0f,-0.4676f, -0.0f, 0.0046f, 0.9272f, 1.0f,-0.4544f, 0.0f, -0.0094f, 0.9485f, 1.0f,-0.4402f, 0.0f, -0.0219f, 0.9653f, 1.0f,
--0.4254f, 0.0f, -0.033f, 0.9781f, 1.0f,-0.4099f, 0.0f, -0.0424f, 0.9876f, 1.0f,-0.394f, 0.0f, -0.0501f, 0.9942f, 1.0f,-0.3777f, 0.0f, -0.0562f, 0.9983f, 1.0f,
--0.3612f, 0.0f, -0.0605f, 0.9997f, 1.0f,-0.3447f, 0.0f, -0.0629f, 0.999f, 1.0f,-0.3281f, 0.0f, -0.0634f, 0.9963f, 1.0f,-0.3118f, 0.0f, -0.062f, 0.9912f, 1.0f,
--0.2957f, 0.0f, -0.0585f, 0.9834f, 1.0f,-0.2801f, 0.0f, -0.0529f, 0.9724f, 1.0f,-0.2651f, 0.0f, -0.0452f, 0.9576f, 1.0f,-0.2507f, 0.0f, -0.0352f, 0.9385f, 1.0f,
--0.2372f, 0.0f, -0.023f, 0.9143f, 1.0f,-0.2246f, 0.0f, -0.0085f, 0.8841f, 1.0f,-0.2131f, -0.0f, 0.0085f, 0.8461f, 1.0f,-0.2028f, -0.0f, 0.0279f, 0.7979f, 1.0f,
--0.1939f, -0.0f, 0.0499f, 0.7359f, 1.0f,-0.1864f, -0.0f, 0.0745f, 0.6541f, 1.0f,-0.1806f, -0.0f, 0.1017f, 0.5396f, 1.0f,-0.1765f, -0.0f, 0.1316f, 0.36f, 1.0f,
--0.1742f, -0.0f, 0.1643f, 0.1f, 1.0f
+ -0.5271f, 0.0f, 0.1742f, 0.1f, 1.0f,
+ -0.527f, 0.0f, 0.1621f, 0.2199f, 1.0f,
+ -0.5253f, 0.0f, 0.1386f, 0.4615f, 1.0f,
+ -0.5217f, 0.0f, 0.116f, 0.6019f, 1.0f,
+ -0.5164f, 0.0f, 0.0945f, 0.6981f, 1.0f,
+ -0.5094f, 0.0f, 0.0741f, 0.7689f, 1.0f,
+ -0.5009f, 0.0f, 0.0548f, 0.8236f, 1.0f,
+ -0.491f, 0.0f, 0.0368f, 0.866f, 1.0f,
+ -0.4799f, 0.0f, 0.02f, 0.9003f, 1.0f,
+ -0.4676f, 0.0f, 0.0046f, 0.9272f, 1.0f,
+ -0.4544f, 0.0f, -0.0094f, 0.9485f, 1.0f,
+ -0.4402f, 0.0f, -0.0219f, 0.9653f, 1.0f,
+ -0.4254f, 0.0f, -0.033f, 0.9781f, 1.0f,
+ -0.4099f, 0.0f, -0.0424f, 0.9876f, 1.0f,
+ -0.394f, 0.0f, -0.0501f, 0.9942f, 1.0f,
+ -0.3777f, 0.0f, -0.0562f, 0.9983f, 1.0f,
+ -0.3612f, 0.0f, -0.0605f, 0.9997f, 1.0f,
+ -0.3447f, 0.0f, -0.0629f, 0.999f, 1.0f,
+ -0.3281f, 0.0f, -0.0634f, 0.9963f, 1.0f,
+ -0.3118f, 0.0f, -0.062f, 0.9912f, 1.0f,
+ -0.2957f, 0.0f, -0.0585f, 0.9834f, 1.0f,
+ -0.2801f, 0.0f, -0.0529f, 0.9724f, 1.0f,
+ -0.2651f, 0.0f, -0.0452f, 0.9576f, 1.0f,
+ -0.2507f, 0.0f, -0.0352f, 0.9385f, 1.0f,
+ -0.2372f, 0.0f, -0.023f, 0.9143f, 1.0f,
+ -0.2246f, 0.0f, -0.0085f, 0.8841f, 1.0f,
+ -0.2131f, 0.0f, 0.0085f, 0.8461f, 1.0f,
+ -0.2028f, 0.0f, 0.0279f, 0.7979f, 1.0f,
+ -0.1939f, 0.0f, 0.0499f, 0.7359f, 1.0f,
+ -0.1864f, 0.0f, 0.0745f, 0.6541f, 1.0f,
+ -0.1806f, 0.0f, 0.1017f, 0.5396f, 1.0f,
+ -0.1765f, 0.0f, 0.1316f, 0.36f, 1.0f,
+ -0.1742f, 0.0f, 0.1643f, 0.1f, 1.0f,
};
static const float data10[49 * GP_PRIM_DATABUF_SIZE] = {
--0.174f, -0.0f, 0.1661f, 1.0f, 1.0f,-0.1744f, -0.0f, 0.1794f, 1.0f, 1.0f,-0.1774f, -0.0f, 0.2057f, 1.0f, 1.0f,-0.1833f, -0.0f, 0.2314f, 1.0f, 1.0f,
--0.1922f, -0.0f, 0.256f, 1.0f, 1.0f,-0.2037f, -0.0f, 0.279f, 1.0f, 1.0f,-0.2177f, -0.0f, 0.3001f, 1.0f, 1.0f,-0.234f, -0.0f, 0.3189f, 1.0f, 1.0f,
--0.2522f, -0.0f, 0.3351f, 1.0f, 1.0f,-0.2722f, -0.0f, 0.3483f, 1.0f, 1.0f,-0.2935f, -0.0f, 0.3585f, 1.0f, 1.0f,-0.3157f, -0.0f, 0.3654f, 1.0f, 1.0f,
--0.3385f, -0.0f, 0.3689f, 1.0f, 1.0f,-0.3616f, -0.0f, 0.3689f, 1.0f, 1.0f,-0.3844f, -0.0f, 0.3654f, 1.0f, 1.0f,-0.4066f, -0.0f, 0.3585f, 1.0f, 1.0f,
--0.4279f, -0.0f, 0.3483f, 1.0f, 1.0f,-0.4479f, -0.0f, 0.3351f, 1.0f, 1.0f,-0.4661f, -0.0f, 0.3189f, 1.0f, 1.0f,-0.4824f, -0.0f, 0.3001f, 1.0f, 1.0f,
--0.4964f, -0.0f, 0.279f, 1.0f, 1.0f,-0.508f, -0.0f, 0.256f, 1.0f, 1.0f,-0.5168f, -0.0f, 0.2314f, 1.0f, 1.0f,-0.5227f, -0.0f, 0.2057f, 1.0f, 1.0f,
--0.5257f, -0.0f, 0.1794f, 1.0f, 1.0f,-0.5257f, -0.0f, 0.1528f, 1.0f, 1.0f,-0.5227f, -0.0f, 0.1264f, 1.0f, 1.0f,-0.5168f, -0.0f, 0.1007f, 1.0f, 1.0f,
--0.508f, -0.0f, 0.0762f, 1.0f, 1.0f,-0.4964f, -0.0f, 0.0531f, 1.0f, 1.0f,-0.4824f, -0.0f, 0.032f, 1.0f, 1.0f,-0.4661f, -0.0f, 0.0132f, 1.0f, 1.0f,
--0.4479f, 0.0f, -0.0029f, 1.0f, 1.0f,-0.4279f, 0.0f, -0.0162f, 1.0f, 1.0f,-0.4066f, 0.0f, -0.0264f, 1.0f, 1.0f,-0.3844f, 0.0f, -0.0333f, 1.0f, 1.0f,
--0.3616f, 0.0f, -0.0368f, 1.0f, 1.0f,-0.3385f, 0.0f, -0.0368f, 1.0f, 1.0f,-0.3157f, 0.0f, -0.0333f, 1.0f, 1.0f,-0.2935f, 0.0f, -0.0264f, 1.0f, 1.0f,
--0.2722f, 0.0f, -0.0162f, 1.0f, 1.0f,-0.2522f, 0.0f, -0.0029f, 1.0f, 1.0f,-0.234f, -0.0f, 0.0132f, 1.0f, 1.0f,-0.2177f, -0.0f, 0.032f, 1.0f, 1.0f,
--0.2037f, -0.0f, 0.0531f, 1.0f, 1.0f,-0.1922f, -0.0f, 0.0762f, 1.0f, 1.0f,-0.1833f, -0.0f, 0.1007f, 1.0f, 1.0f,-0.1774f, -0.0f, 0.1264f, 1.0f, 1.0f,
--0.1744f, -0.0f, 0.1528f, 1.0f, 1.0f
+ -0.174f, 0.0f, 0.1661f, 1.0f, 1.0f,
+ -0.1744f, 0.0f, 0.1794f, 1.0f, 1.0f,
+ -0.1774f, 0.0f, 0.2057f, 1.0f, 1.0f,
+ -0.1833f, 0.0f, 0.2314f, 1.0f, 1.0f,
+ -0.1922f, 0.0f, 0.256f, 1.0f, 1.0f,
+ -0.2037f, 0.0f, 0.279f, 1.0f, 1.0f,
+ -0.2177f, 0.0f, 0.3001f, 1.0f, 1.0f,
+ -0.234f, 0.0f, 0.3189f, 1.0f, 1.0f,
+ -0.2522f, 0.0f, 0.3351f, 1.0f, 1.0f,
+ -0.2722f, 0.0f, 0.3483f, 1.0f, 1.0f,
+ -0.2935f, 0.0f, 0.3585f, 1.0f, 1.0f,
+ -0.3157f, 0.0f, 0.3654f, 1.0f, 1.0f,
+ -0.3385f, 0.0f, 0.3689f, 1.0f, 1.0f,
+ -0.3616f, 0.0f, 0.3689f, 1.0f, 1.0f,
+ -0.3844f, 0.0f, 0.3654f, 1.0f, 1.0f,
+ -0.4066f, 0.0f, 0.3585f, 1.0f, 1.0f,
+ -0.4279f, 0.0f, 0.3483f, 1.0f, 1.0f,
+ -0.4479f, 0.0f, 0.3351f, 1.0f, 1.0f,
+ -0.4661f, 0.0f, 0.3189f, 1.0f, 1.0f,
+ -0.4824f, 0.0f, 0.3001f, 1.0f, 1.0f,
+ -0.4964f, 0.0f, 0.279f, 1.0f, 1.0f,
+ -0.508f, 0.0f, 0.256f, 1.0f, 1.0f,
+ -0.5168f, 0.0f, 0.2314f, 1.0f, 1.0f,
+ -0.5227f, 0.0f, 0.2057f, 1.0f, 1.0f,
+ -0.5257f, 0.0f, 0.1794f, 1.0f, 1.0f,
+ -0.5257f, 0.0f, 0.1528f, 1.0f, 1.0f,
+ -0.5227f, 0.0f, 0.1264f, 1.0f, 1.0f,
+ -0.5168f, 0.0f, 0.1007f, 1.0f, 1.0f,
+ -0.508f, 0.0f, 0.0762f, 1.0f, 1.0f,
+ -0.4964f, 0.0f, 0.0531f, 1.0f, 1.0f,
+ -0.4824f, 0.0f, 0.032f, 1.0f, 1.0f,
+ -0.4661f, 0.0f, 0.0132f, 1.0f, 1.0f,
+ -0.4479f, 0.0f, -0.0029f, 1.0f, 1.0f,
+ -0.4279f, 0.0f, -0.0162f, 1.0f, 1.0f,
+ -0.4066f, 0.0f, -0.0264f, 1.0f, 1.0f,
+ -0.3844f, 0.0f, -0.0333f, 1.0f, 1.0f,
+ -0.3616f, 0.0f, -0.0368f, 1.0f, 1.0f,
+ -0.3385f, 0.0f, -0.0368f, 1.0f, 1.0f,
+ -0.3157f, 0.0f, -0.0333f, 1.0f, 1.0f,
+ -0.2935f, 0.0f, -0.0264f, 1.0f, 1.0f,
+ -0.2722f, 0.0f, -0.0162f, 1.0f, 1.0f,
+ -0.2522f, 0.0f, -0.0029f, 1.0f, 1.0f,
+ -0.234f, 0.0f, 0.0132f, 1.0f, 1.0f,
+ -0.2177f, 0.0f, 0.032f, 1.0f, 1.0f,
+ -0.2037f, 0.0f, 0.0531f, 1.0f, 1.0f,
+ -0.1922f, 0.0f, 0.0762f, 1.0f, 1.0f,
+ -0.1833f, 0.0f, 0.1007f, 1.0f, 1.0f,
+ -0.1774f, 0.0f, 0.1264f, 1.0f, 1.0f,
+ -0.1744f, 0.0f, 0.1528f, 1.0f, 1.0f,
};
static const float data11[18 * GP_PRIM_DATABUF_SIZE] = {
-0.963f, -0.0f, 0.1753f, 0.1f, 1.0f,0.9555f, -0.0f, 0.1761f, 0.2199f, 1.0f,0.9367f, -0.0f, 0.1758f, 0.6019f, 1.0f,0.9202f, -0.0f, 0.1741f, 0.7689f, 1.0f,
-0.9036f, -0.0f, 0.1714f, 0.866f, 1.0f,0.8885f, -0.0f, 0.1668f, 0.9272f, 1.0f,0.8746f, -0.0f, 0.1607f, 0.9653f, 1.0f,0.8621f, -0.0f, 0.1531f, 0.9876f, 1.0f,
-0.8503f, -0.0f, 0.1447f, 0.9983f, 1.0f,0.8389f, -0.0f, 0.1352f, 0.999f, 1.0f,0.8279f, -0.0f, 0.1244f, 0.9912f, 1.0f,0.8174f, -0.0f, 0.1125f, 0.9724f, 1.0f,
-0.8079f, -0.0f, 0.099f, 0.9385f, 1.0f,0.7999f, -0.0f, 0.0839f, 0.8841f, 1.0f,0.7935f, -0.0f, 0.0669f, 0.7979f, 1.0f,0.7892f, -0.0f, 0.0488f, 0.6541f, 1.0f,
-0.787f, -0.0f, 0.0305f, 0.36f, 1.0f,0.7847f, -0.0f, 0.0139f, 0.1f, 1.0f
+ 0.963f, 0.0f, 0.1753f, 0.1f, 1.0f,
+ 0.9555f, 0.0f, 0.1761f, 0.2199f, 1.0f,
+ 0.9367f, 0.0f, 0.1758f, 0.6019f, 1.0f,
+ 0.9202f, 0.0f, 0.1741f, 0.7689f, 1.0f,
+ 0.9036f, 0.0f, 0.1714f, 0.866f, 1.0f,
+ 0.8885f, 0.0f, 0.1668f, 0.9272f, 1.0f,
+ 0.8746f, 0.0f, 0.1607f, 0.9653f, 1.0f,
+ 0.8621f, 0.0f, 0.1531f, 0.9876f, 1.0f,
+ 0.8503f, 0.0f, 0.1447f, 0.9983f, 1.0f,
+ 0.8389f, 0.0f, 0.1352f, 0.999f, 1.0f,
+ 0.8279f, 0.0f, 0.1244f, 0.9912f, 1.0f,
+ 0.8174f, 0.0f, 0.1125f, 0.9724f, 1.0f,
+ 0.8079f, 0.0f, 0.099f, 0.9385f, 1.0f,
+ 0.7999f, 0.0f, 0.0839f, 0.8841f, 1.0f,
+ 0.7935f, 0.0f, 0.0669f, 0.7979f, 1.0f,
+ 0.7892f, 0.0f, 0.0488f, 0.6541f, 1.0f,
+ 0.787f, 0.0f, 0.0305f, 0.36f, 1.0f,
+ 0.7847f, 0.0f, 0.0139f, 0.1f, 1.0f,
};
static const float data12[18 * GP_PRIM_DATABUF_SIZE] = {
--1.0227f, -0.0f, 0.1753f, 0.1f, 1.0f,-1.0153f, -0.0f, 0.1761f, 0.2199f, 1.0f,-0.9964f, -0.0f, 0.1758f, 0.6019f, 1.0f,-0.9799f, -0.0f, 0.1741f, 0.7689f, 1.0f,
--0.9634f, -0.0f, 0.1714f, 0.866f, 1.0f,-0.9483f, -0.0f, 0.1668f, 0.9272f, 1.0f,-0.9344f, -0.0f, 0.1607f, 0.9653f, 1.0f,-0.9219f, -0.0f, 0.1531f, 0.9876f, 1.0f,
--0.9101f, -0.0f, 0.1447f, 0.9983f, 1.0f,-0.8986f, -0.0f, 0.1352f, 0.999f, 1.0f,-0.8876f, -0.0f, 0.1244f, 0.9912f, 1.0f,-0.8772f, -0.0f, 0.1125f, 0.9724f, 1.0f,
--0.8677f, -0.0f, 0.099f, 0.9385f, 1.0f,-0.8597f, -0.0f, 0.0839f, 0.8841f, 1.0f,-0.8533f, -0.0f, 0.0669f, 0.7979f, 1.0f,-0.849f, -0.0f, 0.0488f, 0.6541f, 1.0f,
--0.8467f, -0.0f, 0.0305f, 0.36f, 1.0f,-0.8444f, -0.0f, 0.0139f, 0.1f, 1.0f
+ -1.0227f, 0.0f, 0.1753f, 0.1f, 1.0f,
+ -1.0153f, 0.0f, 0.1761f, 0.2199f, 1.0f,
+ -0.9964f, 0.0f, 0.1758f, 0.6019f, 1.0f,
+ -0.9799f, 0.0f, 0.1741f, 0.7689f, 1.0f,
+ -0.9634f, 0.0f, 0.1714f, 0.866f, 1.0f,
+ -0.9483f, 0.0f, 0.1668f, 0.9272f, 1.0f,
+ -0.9344f, 0.0f, 0.1607f, 0.9653f, 1.0f,
+ -0.9219f, 0.0f, 0.1531f, 0.9876f, 1.0f,
+ -0.9101f, 0.0f, 0.1447f, 0.9983f, 1.0f,
+ -0.8986f, 0.0f, 0.1352f, 0.999f, 1.0f,
+ -0.8876f, 0.0f, 0.1244f, 0.9912f, 1.0f,
+ -0.8772f, 0.0f, 0.1125f, 0.9724f, 1.0f,
+ -0.8677f, 0.0f, 0.099f, 0.9385f, 1.0f,
+ -0.8597f, 0.0f, 0.0839f, 0.8841f, 1.0f,
+ -0.8533f, 0.0f, 0.0669f, 0.7979f, 1.0f,
+ -0.849f, 0.0f, 0.0488f, 0.6541f, 1.0f,
+ -0.8467f, 0.0f, 0.0305f, 0.36f, 1.0f,
+ -0.8444f, 0.0f, 0.0139f, 0.1f, 1.0f,
};
static const float data13[33 * GP_PRIM_DATABUF_SIZE] = {
--0.6794f, -0.0f, 0.3908f, 0.1f, 1.0f,-0.6711f, -0.0f, 0.4112f, 0.2199f, 1.0f,-0.6513f, -0.0f, 0.4509f, 0.4615f, 1.0f,-0.6276f, -0.0f, 0.489f, 0.6019f, 1.0f,
--0.6001f, -0.0f, 0.5253f, 0.6981f, 1.0f,-0.5692f, -0.0f, 0.5598f, 0.7689f, 1.0f,-0.535f, -0.0f, 0.5924f, 0.8236f, 1.0f,-0.4979f, -0.0f, 0.6228f, 0.866f, 1.0f,
--0.4579f, -0.0f, 0.651f, 0.9003f, 1.0f,-0.4155f, -0.0f, 0.677f, 0.9272f, 1.0f,-0.3707f, -0.0f, 0.7005f, 0.9485f, 1.0f,-0.3239f, -0.0f, 0.7215f, 0.9653f, 1.0f,
--0.2753f, -0.0f, 0.7399f, 0.9781f, 1.0f,-0.2251f, -0.0f, 0.7555f, 0.9876f, 1.0f,-0.1736f, -0.0f, 0.7683f, 0.9942f, 1.0f,-0.121f, -0.0f, 0.778f, 0.9983f, 1.0f,
--0.0675f, -0.0f, 0.7847f, 0.9997f, 1.0f,-0.0134f, -0.0f, 0.7882f, 0.999f, 1.0f,0.0411f, -0.0f, 0.7884f, 0.9963f, 1.0f,0.0957f, -0.0f, 0.7851f, 0.9912f, 1.0f,
-0.1503f, -0.0f, 0.7783f, 0.9834f, 1.0f,0.2045f, -0.0f, 0.7678f, 0.9724f, 1.0f,0.2581f, -0.0f, 0.7536f, 0.9576f, 1.0f,0.311f, -0.0f, 0.7355f, 0.9385f, 1.0f,
-0.3628f, -0.0f, 0.7134f, 0.9143f, 1.0f,0.4133f, -0.0f, 0.6873f, 0.8841f, 1.0f,0.4622f, -0.0f, 0.6569f, 0.8461f, 1.0f,0.5095f, -0.0f, 0.6221f, 0.7979f, 1.0f,
-0.5547f, -0.0f, 0.583f, 0.7359f, 1.0f,0.5977f, -0.0f, 0.5393f, 0.6541f, 1.0f,0.6382f, -0.0f, 0.4909f, 0.5396f, 1.0f,0.676f, -0.0f, 0.4377f, 0.36f, 1.0f,
-0.7109f, -0.0f, 0.3797f, 0.1f, 1.0f
+ -0.6794f, 0.0f, 0.3908f, 0.1f, 1.0f,
+ -0.6711f, 0.0f, 0.4112f, 0.2199f, 1.0f,
+ -0.6513f, 0.0f, 0.4509f, 0.4615f, 1.0f,
+ -0.6276f, 0.0f, 0.489f, 0.6019f, 1.0f,
+ -0.6001f, 0.0f, 0.5253f, 0.6981f, 1.0f,
+ -0.5692f, 0.0f, 0.5598f, 0.7689f, 1.0f,
+ -0.535f, 0.0f, 0.5924f, 0.8236f, 1.0f,
+ -0.4979f, 0.0f, 0.6228f, 0.866f, 1.0f,
+ -0.4579f, 0.0f, 0.651f, 0.9003f, 1.0f,
+ -0.4155f, 0.0f, 0.677f, 0.9272f, 1.0f,
+ -0.3707f, 0.0f, 0.7005f, 0.9485f, 1.0f,
+ -0.3239f, 0.0f, 0.7215f, 0.9653f, 1.0f,
+ -0.2753f, 0.0f, 0.7399f, 0.9781f, 1.0f,
+ -0.2251f, 0.0f, 0.7555f, 0.9876f, 1.0f,
+ -0.1736f, 0.0f, 0.7683f, 0.9942f, 1.0f,
+ -0.121f, 0.0f, 0.778f, 0.9983f, 1.0f,
+ -0.0675f, 0.0f, 0.7847f, 0.9997f, 1.0f,
+ -0.0134f, 0.0f, 0.7882f, 0.999f, 1.0f,
+ 0.0411f, 0.0f, 0.7884f, 0.9963f, 1.0f,
+ 0.0957f, 0.0f, 0.7851f, 0.9912f, 1.0f,
+ 0.1503f, 0.0f, 0.7783f, 0.9834f, 1.0f,
+ 0.2045f, 0.0f, 0.7678f, 0.9724f, 1.0f,
+ 0.2581f, 0.0f, 0.7536f, 0.9576f, 1.0f,
+ 0.311f, 0.0f, 0.7355f, 0.9385f, 1.0f,
+ 0.3628f, 0.0f, 0.7134f, 0.9143f, 1.0f,
+ 0.4133f, 0.0f, 0.6873f, 0.8841f, 1.0f,
+ 0.4622f, 0.0f, 0.6569f, 0.8461f, 1.0f,
+ 0.5095f, 0.0f, 0.6221f, 0.7979f, 1.0f,
+ 0.5547f, 0.0f, 0.583f, 0.7359f, 1.0f,
+ 0.5977f, 0.0f, 0.5393f, 0.6541f, 1.0f,
+ 0.6382f, 0.0f, 0.4909f, 0.5396f, 1.0f,
+ 0.676f, 0.0f, 0.4377f, 0.36f, 1.0f,
+ 0.7109f, 0.0f, 0.3797f, 0.1f, 1.0f,
};
static const float data14[33 * GP_PRIM_DATABUF_SIZE] = {
--0.7544f, -0.0f, 0.1799f, 0.1f, 1.0f,-0.7495f, -0.0f, 0.162f, 0.2199f, 1.0f,-0.7392f, -0.0f, 0.1283f, 0.4615f, 1.0f,-0.7281f, -0.0f, 0.0975f, 0.6019f, 1.0f,
--0.7161f, -0.0f, 0.0693f, 0.6981f, 1.0f,-0.7033f, -0.0f, 0.0435f, 0.7689f, 1.0f,-0.6898f, -0.0f, 0.02f, 0.8236f, 1.0f,-0.6757f, 0.0f, -0.0014f, 0.866f, 1.0f,
--0.6609f, 0.0f, -0.0208f, 0.9003f, 1.0f,-0.6455f, 0.0f, -0.0386f, 0.9272f, 1.0f,-0.6297f, 0.0f, -0.0547f, 0.9485f, 1.0f,-0.6133f, 0.0f, -0.0695f, 0.9653f, 1.0f,
--0.5966f, 0.0f, -0.083f, 0.9781f, 1.0f,-0.5795f, 0.0f, -0.0955f, 0.9876f, 1.0f,-0.5621f, 0.0f, -0.1071f, 0.9942f, 1.0f,-0.5444f, 0.0f, -0.118f, 0.9983f, 1.0f,
--0.5265f, 0.0f, -0.1284f, 0.9997f, 1.0f,-0.5084f, 0.0f, -0.1384f, 0.999f, 1.0f,-0.4902f, 0.0f, -0.1483f, 0.9963f, 1.0f,-0.4719f, 0.0f, -0.1582f, 0.9912f, 1.0f,
--0.4537f, 0.0f, -0.1682f, 0.9834f, 1.0f,-0.4355f, 0.0f, -0.1787f, 0.9724f, 1.0f,-0.4173f, 0.0f, -0.1896f, 0.9576f, 1.0f,-0.3993f, 0.0f, -0.2013f, 0.9385f, 1.0f,
--0.3815f, 0.0f, -0.2138f, 0.9143f, 1.0f,-0.364f, 0.0f, -0.2274f, 0.8841f, 1.0f,-0.3467f, 0.0f, -0.2422f, 0.8461f, 1.0f,-0.3298f, 0.0f, -0.2584f, 0.7979f, 1.0f,
--0.3133f, 0.0f, -0.2762f, 0.7359f, 1.0f,-0.2972f, 0.0f, -0.2958f, 0.6541f, 1.0f,-0.2816f, 0.0f, -0.3173f, 0.5396f, 1.0f,-0.2665f, 0.0f, -0.3409f, 0.36f, 1.0f,
--0.2521f, 0.0f, -0.3668f, 0.1f, 1.0f
+ -0.7544f, 0.0f, 0.1799f, 0.1f, 1.0f,
+ -0.7495f, 0.0f, 0.162f, 0.2199f, 1.0f,
+ -0.7392f, 0.0f, 0.1283f, 0.4615f, 1.0f,
+ -0.7281f, 0.0f, 0.0975f, 0.6019f, 1.0f,
+ -0.7161f, 0.0f, 0.0693f, 0.6981f, 1.0f,
+ -0.7033f, 0.0f, 0.0435f, 0.7689f, 1.0f,
+ -0.6898f, 0.0f, 0.02f, 0.8236f, 1.0f,
+ -0.6757f, 0.0f, -0.0014f, 0.866f, 1.0f,
+ -0.6609f, 0.0f, -0.0208f, 0.9003f, 1.0f,
+ -0.6455f, 0.0f, -0.0386f, 0.9272f, 1.0f,
+ -0.6297f, 0.0f, -0.0547f, 0.9485f, 1.0f,
+ -0.6133f, 0.0f, -0.0695f, 0.9653f, 1.0f,
+ -0.5966f, 0.0f, -0.083f, 0.9781f, 1.0f,
+ -0.5795f, 0.0f, -0.0955f, 0.9876f, 1.0f,
+ -0.5621f, 0.0f, -0.1071f, 0.9942f, 1.0f,
+ -0.5444f, 0.0f, -0.118f, 0.9983f, 1.0f,
+ -0.5265f, 0.0f, -0.1284f, 0.9997f, 1.0f,
+ -0.5084f, 0.0f, -0.1384f, 0.999f, 1.0f,
+ -0.4902f, 0.0f, -0.1483f, 0.9963f, 1.0f,
+ -0.4719f, 0.0f, -0.1582f, 0.9912f, 1.0f,
+ -0.4537f, 0.0f, -0.1682f, 0.9834f, 1.0f,
+ -0.4355f, 0.0f, -0.1787f, 0.9724f, 1.0f,
+ -0.4173f, 0.0f, -0.1896f, 0.9576f, 1.0f,
+ -0.3993f, 0.0f, -0.2013f, 0.9385f, 1.0f,
+ -0.3815f, 0.0f, -0.2138f, 0.9143f, 1.0f,
+ -0.364f, 0.0f, -0.2274f, 0.8841f, 1.0f,
+ -0.3467f, 0.0f, -0.2422f, 0.8461f, 1.0f,
+ -0.3298f, 0.0f, -0.2584f, 0.7979f, 1.0f,
+ -0.3133f, 0.0f, -0.2762f, 0.7359f, 1.0f,
+ -0.2972f, 0.0f, -0.2958f, 0.6541f, 1.0f,
+ -0.2816f, 0.0f, -0.3173f, 0.5396f, 1.0f,
+ -0.2665f, 0.0f, -0.3409f, 0.36f, 1.0f,
+ -0.2521f, 0.0f, -0.3668f, 0.1f, 1.0f,
};
static const float data15[65 * GP_PRIM_DATABUF_SIZE] = {
--0.2854f, 0.0f, -0.4528f, 0.1f, 1.0f,-0.2866f, 0.0f, -0.4623f, 0.1288f, 1.0f,-0.2899f, 0.0f, -0.4814f, 0.2962f, 1.0f,-0.2943f, 0.0f, -0.5008f, 0.4147f, 1.0f,
--0.2995f, 0.0f, -0.5203f, 0.5028f, 1.0f,-0.3054f, 0.0f, -0.54f, 0.5723f, 1.0f,-0.3117f, 0.0f, -0.5598f, 0.6291f, 1.0f,-0.3182f, 0.0f, -0.5797f, 0.6768f, 1.0f,
--0.3249f, 0.0f, -0.5996f, 0.7177f, 1.0f,-0.3314f, 0.0f, -0.6196f, 0.753f, 1.0f,-0.3376f, 0.0f, -0.6395f, 0.7838f, 1.0f,-0.3432f, 0.0f, -0.6594f, 0.8109f, 1.0f,
--0.3482f, 0.0f, -0.6792f, 0.8349f, 1.0f,-0.3523f, 0.0f, -0.6989f, 0.8564f, 1.0f,-0.3552f, 0.0f, -0.7185f, 0.8756f, 1.0f,-0.3569f, 0.0f, -0.7379f, 0.8922f, 1.0f,
--0.357f, 0.0f, -0.7571f, 0.9074f, 1.0f,-0.3555f, 0.0f, -0.7761f, 0.9211f, 1.0f,-0.3522f, 0.0f, -0.7948f, 0.9329f, 1.0f,-0.3467f, 0.0f, -0.8132f, 0.944f, 1.0f,
--0.339f, 0.0f, -0.8313f, 0.9531f, 1.0f,-0.3289f, 0.0f, -0.849f, 0.9617f, 1.0f,-0.316f, 0.0f, -0.8663f, 0.9688f, 1.0f,-0.3004f, 0.0f, -0.8831f, 0.9755f, 1.0f,
--0.2817f, 0.0f, -0.8996f, 0.9808f, 1.0f,-0.2598f, 0.0f, -0.9155f, 0.9858f, 1.0f,-0.2344f, 0.0f, -0.9309f, 0.9894f, 1.0f,-0.2051f, 0.0f, -0.9457f, 0.993f, 1.0f,
--0.1716f, 0.0f, -0.9599f, 0.9952f, 1.0f,-0.1341f, 0.0f, -0.9733f, 0.9973f, 1.0f,-0.0928f, 0.0f, -0.9857f, 0.9987f, 1.0f,-0.05f, 0.0f, -0.9962f, 0.9993f, 1.0f,
--0.0087f, 0.0f, -1.0041f, 1.0f, 1.0f,0.0287f, 0.0f, -1.0087f, 0.9993f, 1.0f,0.062f, 0.0f, -1.0104f, 0.9987f, 1.0f,0.0924f, 0.0f, -1.0102f, 0.9973f, 1.0f,
-0.1205f, 0.0f, -1.0086f, 0.9952f, 1.0f,0.1465f, 0.0f, -1.0057f, 0.993f, 1.0f,0.1706f, 0.0f, -1.0017f, 0.9894f, 1.0f,0.1928f, 0.0f, -0.9964f, 0.9858f, 1.0f,
-0.2132f, 0.0f, -0.99f, 0.9808f, 1.0f,0.2318f, 0.0f, -0.9824f, 0.9755f, 1.0f,0.2487f, 0.0f, -0.9738f, 0.9688f, 1.0f,0.2641f, 0.0f, -0.9641f, 0.9617f, 1.0f,
-0.2778f, 0.0f, -0.9533f, 0.9531f, 1.0f,0.2901f, 0.0f, -0.9415f, 0.944f, 1.0f,0.3009f, 0.0f, -0.9287f, 0.9329f, 1.0f,0.3103f, 0.0f, -0.9148f, 0.9211f, 1.0f,
-0.3183f, 0.0f, -0.8999f, 0.9074f, 1.0f,0.325f, 0.0f, -0.8841f, 0.8922f, 1.0f,0.3304f, 0.0f, -0.8672f, 0.8756f, 1.0f,0.3345f, 0.0f, -0.8493f, 0.8564f, 1.0f,
-0.3374f, 0.0f, -0.8305f, 0.8349f, 1.0f,0.3391f, 0.0f, -0.8107f, 0.8109f, 1.0f,0.3397f, 0.0f, -0.7899f, 0.7838f, 1.0f,0.3392f, 0.0f, -0.7682f, 0.753f, 1.0f,
-0.3377f, 0.0f, -0.7456f, 0.7177f, 1.0f,0.3352f, 0.0f, -0.7221f, 0.6768f, 1.0f,0.3317f, 0.0f, -0.6976f, 0.6291f, 1.0f,0.3273f, 0.0f, -0.6722f, 0.5723f, 1.0f,
-0.322f, 0.0f, -0.646f, 0.5028f, 1.0f,0.316f, 0.0f, -0.6188f, 0.4147f, 1.0f,0.3091f, 0.0f, -0.5908f, 0.2962f, 1.0f,0.3015f, 0.0f, -0.5619f, 0.1288f, 1.0f,
-0.2974f, 0.0f, -0.5472f, 0.1f, 1.0f
+ -0.2854f, 0.0f, -0.4528f, 0.1f, 1.0f,
+ -0.2866f, 0.0f, -0.4623f, 0.1288f, 1.0f,
+ -0.2899f, 0.0f, -0.4814f, 0.2962f, 1.0f,
+ -0.2943f, 0.0f, -0.5008f, 0.4147f, 1.0f,
+ -0.2995f, 0.0f, -0.5203f, 0.5028f, 1.0f,
+ -0.3054f, 0.0f, -0.54f, 0.5723f, 1.0f,
+ -0.3117f, 0.0f, -0.5598f, 0.6291f, 1.0f,
+ -0.3182f, 0.0f, -0.5797f, 0.6768f, 1.0f,
+ -0.3249f, 0.0f, -0.5996f, 0.7177f, 1.0f,
+ -0.3314f, 0.0f, -0.6196f, 0.753f, 1.0f,
+ -0.3376f, 0.0f, -0.6395f, 0.7838f, 1.0f,
+ -0.3432f, 0.0f, -0.6594f, 0.8109f, 1.0f,
+ -0.3482f, 0.0f, -0.6792f, 0.8349f, 1.0f,
+ -0.3523f, 0.0f, -0.6989f, 0.8564f, 1.0f,
+ -0.3552f, 0.0f, -0.7185f, 0.8756f, 1.0f,
+ -0.3569f, 0.0f, -0.7379f, 0.8922f, 1.0f,
+ -0.357f, 0.0f, -0.7571f, 0.9074f, 1.0f,
+ -0.3555f, 0.0f, -0.7761f, 0.9211f, 1.0f,
+ -0.3522f, 0.0f, -0.7948f, 0.9329f, 1.0f,
+ -0.3467f, 0.0f, -0.8132f, 0.944f, 1.0f,
+ -0.339f, 0.0f, -0.8313f, 0.9531f, 1.0f,
+ -0.3289f, 0.0f, -0.849f, 0.9617f, 1.0f,
+ -0.316f, 0.0f, -0.8663f, 0.9688f, 1.0f,
+ -0.3004f, 0.0f, -0.8831f, 0.9755f, 1.0f,
+ -0.2817f, 0.0f, -0.8996f, 0.9808f, 1.0f,
+ -0.2598f, 0.0f, -0.9155f, 0.9858f, 1.0f,
+ -0.2344f, 0.0f, -0.9309f, 0.9894f, 1.0f,
+ -0.2051f, 0.0f, -0.9457f, 0.993f, 1.0f,
+ -0.1716f, 0.0f, -0.9599f, 0.9952f, 1.0f,
+ -0.1341f, 0.0f, -0.9733f, 0.9973f, 1.0f,
+ -0.0928f, 0.0f, -0.9857f, 0.9987f, 1.0f,
+ -0.05f, 0.0f, -0.9962f, 0.9993f, 1.0f,
+ -0.0087f, 0.0f, -1.0041f, 1.0f, 1.0f,
+ 0.0287f, 0.0f, -1.0087f, 0.9993f, 1.0f,
+ 0.062f, 0.0f, -1.0104f, 0.9987f, 1.0f,
+ 0.0924f, 0.0f, -1.0102f, 0.9973f, 1.0f,
+ 0.1205f, 0.0f, -1.0086f, 0.9952f, 1.0f,
+ 0.1465f, 0.0f, -1.0057f, 0.993f, 1.0f,
+ 0.1706f, 0.0f, -1.0017f, 0.9894f, 1.0f,
+ 0.1928f, 0.0f, -0.9964f, 0.9858f, 1.0f,
+ 0.2132f, 0.0f, -0.99f, 0.9808f, 1.0f,
+ 0.2318f, 0.0f, -0.9824f, 0.9755f, 1.0f,
+ 0.2487f, 0.0f, -0.9738f, 0.9688f, 1.0f,
+ 0.2641f, 0.0f, -0.9641f, 0.9617f, 1.0f,
+ 0.2778f, 0.0f, -0.9533f, 0.9531f, 1.0f,
+ 0.2901f, 0.0f, -0.9415f, 0.944f, 1.0f,
+ 0.3009f, 0.0f, -0.9287f, 0.9329f, 1.0f,
+ 0.3103f, 0.0f, -0.9148f, 0.9211f, 1.0f,
+ 0.3183f, 0.0f, -0.8999f, 0.9074f, 1.0f,
+ 0.325f, 0.0f, -0.8841f, 0.8922f, 1.0f,
+ 0.3304f, 0.0f, -0.8672f, 0.8756f, 1.0f,
+ 0.3345f, 0.0f, -0.8493f, 0.8564f, 1.0f,
+ 0.3374f, 0.0f, -0.8305f, 0.8349f, 1.0f,
+ 0.3391f, 0.0f, -0.8107f, 0.8109f, 1.0f,
+ 0.3397f, 0.0f, -0.7899f, 0.7838f, 1.0f,
+ 0.3392f, 0.0f, -0.7682f, 0.753f, 1.0f,
+ 0.3377f, 0.0f, -0.7456f, 0.7177f, 1.0f,
+ 0.3352f, 0.0f, -0.7221f, 0.6768f, 1.0f,
+ 0.3317f, 0.0f, -0.6976f, 0.6291f, 1.0f,
+ 0.3273f, 0.0f, -0.6722f, 0.5723f, 1.0f,
+ 0.322f, 0.0f, -0.646f, 0.5028f, 1.0f,
+ 0.316f, 0.0f, -0.6188f, 0.4147f, 1.0f,
+ 0.3091f, 0.0f, -0.5908f, 0.2962f, 1.0f,
+ 0.3015f, 0.0f, -0.5619f, 0.1288f, 1.0f,
+ 0.2974f, 0.0f, -0.5472f, 0.1f, 1.0f,
};
static const float data16[34 * GP_PRIM_DATABUF_SIZE] = {
--0.4408f, -0.0f, 0.5073f, 0.1f, 1.0f,-0.4312f, -0.0f, 0.5132f, 0.1288f, 1.0f,-0.3945f, -0.0f, 0.5319f, 0.4147f, 1.0f,-0.3605f, -0.0f, 0.5438f, 0.5723f, 1.0f,
--0.3288f, -0.0f, 0.5496f, 0.6768f, 1.0f,-0.2992f, -0.0f, 0.5501f, 0.753f, 1.0f,-0.2712f, -0.0f, 0.546f, 0.8109f, 1.0f,-0.2446f, -0.0f, 0.5381f, 0.8564f, 1.0f,
--0.2191f, -0.0f, 0.5272f, 0.8922f, 1.0f,-0.1943f, -0.0f, 0.5139f, 0.9211f, 1.0f,-0.1699f, -0.0f, 0.4992f, 0.944f, 1.0f,-0.1456f, -0.0f, 0.4837f, 0.9617f, 1.0f,
--0.1211f, -0.0f, 0.4682f, 0.9755f, 1.0f,-0.096f, -0.0f, 0.4535f, 0.9858f, 1.0f,-0.07f, -0.0f, 0.4404f, 0.993f, 1.0f,-0.0428f, -0.0f, 0.4301f, 0.9973f, 1.0f,
--0.016f, -0.0f, 0.4235f, 0.9993f, 1.0f,0.0076f, -0.0f, 0.4216f, 0.9993f, 1.0f,0.0283f, -0.0f, 0.4237f, 0.9973f, 1.0f,0.0477f, -0.0f, 0.4291f, 0.993f, 1.0f,
-0.067f, -0.0f, 0.4369f, 0.9858f, 1.0f,0.0866f, -0.0f, 0.4465f, 0.9755f, 1.0f,0.1068f, -0.0f, 0.4576f, 0.9617f, 1.0f,0.1278f, -0.0f, 0.4695f, 0.944f, 1.0f,
-0.1498f, -0.0f, 0.4819f, 0.9211f, 1.0f,0.173f, -0.0f, 0.4941f, 0.8922f, 1.0f,0.1977f, -0.0f, 0.5056f, 0.8564f, 1.0f,0.2241f, -0.0f, 0.5159f, 0.8109f, 1.0f,
-0.2523f, -0.0f, 0.5244f, 0.753f, 1.0f,0.2825f, -0.0f, 0.5307f, 0.6768f, 1.0f,0.315f, -0.0f, 0.5342f, 0.5723f, 1.0f,0.3499f, -0.0f, 0.5345f, 0.4147f, 1.0f,
-0.3875f, -0.0f, 0.5311f, 0.1288f, 1.0f,0.3973f, -0.0f, 0.5295f, 0.1f, 1.0f
+ -0.4408f, 0.0f, 0.5073f, 0.1f, 1.0f,
+ -0.4312f, 0.0f, 0.5132f, 0.1288f, 1.0f,
+ -0.3945f, 0.0f, 0.5319f, 0.4147f, 1.0f,
+ -0.3605f, 0.0f, 0.5438f, 0.5723f, 1.0f,
+ -0.3288f, 0.0f, 0.5496f, 0.6768f, 1.0f,
+ -0.2992f, 0.0f, 0.5501f, 0.753f, 1.0f,
+ -0.2712f, 0.0f, 0.546f, 0.8109f, 1.0f,
+ -0.2446f, 0.0f, 0.5381f, 0.8564f, 1.0f,
+ -0.2191f, 0.0f, 0.5272f, 0.8922f, 1.0f,
+ -0.1943f, 0.0f, 0.5139f, 0.9211f, 1.0f,
+ -0.1699f, 0.0f, 0.4992f, 0.944f, 1.0f,
+ -0.1456f, 0.0f, 0.4837f, 0.9617f, 1.0f,
+ -0.1211f, 0.0f, 0.4682f, 0.9755f, 1.0f,
+ -0.096f, 0.0f, 0.4535f, 0.9858f, 1.0f,
+ -0.07f, 0.0f, 0.4404f, 0.993f, 1.0f,
+ -0.0428f, 0.0f, 0.4301f, 0.9973f, 1.0f,
+ -0.016f, 0.0f, 0.4235f, 0.9993f, 1.0f,
+ 0.0076f, 0.0f, 0.4216f, 0.9993f, 1.0f,
+ 0.0283f, 0.0f, 0.4237f, 0.9973f, 1.0f,
+ 0.0477f, 0.0f, 0.4291f, 0.993f, 1.0f,
+ 0.067f, 0.0f, 0.4369f, 0.9858f, 1.0f,
+ 0.0866f, 0.0f, 0.4465f, 0.9755f, 1.0f,
+ 0.1068f, 0.0f, 0.4576f, 0.9617f, 1.0f,
+ 0.1278f, 0.0f, 0.4695f, 0.944f, 1.0f,
+ 0.1498f, 0.0f, 0.4819f, 0.9211f, 1.0f,
+ 0.173f, 0.0f, 0.4941f, 0.8922f, 1.0f,
+ 0.1977f, 0.0f, 0.5056f, 0.8564f, 1.0f,
+ 0.2241f, 0.0f, 0.5159f, 0.8109f, 1.0f,
+ 0.2523f, 0.0f, 0.5244f, 0.753f, 1.0f,
+ 0.2825f, 0.0f, 0.5307f, 0.6768f, 1.0f,
+ 0.315f, 0.0f, 0.5342f, 0.5723f, 1.0f,
+ 0.3499f, 0.0f, 0.5345f, 0.4147f, 1.0f,
+ 0.3875f, 0.0f, 0.5311f, 0.1288f, 1.0f,
+ 0.3973f, 0.0f, 0.5295f, 0.1f, 1.0f,
};
static const float data17[33 * GP_PRIM_DATABUF_SIZE] = {
-0.724f, -0.0f, 0.1799f, 0.1f, 1.0f,0.7192f, -0.0f, 0.162f, 0.2199f, 1.0f,0.7089f, -0.0f, 0.1283f, 0.4615f, 1.0f,0.6977f, -0.0f, 0.0975f, 0.6019f, 1.0f,
-0.6858f, -0.0f, 0.0693f, 0.6981f, 1.0f,0.673f, -0.0f, 0.0435f, 0.7689f, 1.0f,0.6595f, -0.0f, 0.02f, 0.8236f, 1.0f,0.6453f, 0.0f, -0.0014f, 0.866f, 1.0f,
-0.6306f, 0.0f, -0.0208f, 0.9003f, 1.0f,0.6152f, 0.0f, -0.0386f, 0.9272f, 1.0f,0.5994f, 0.0f, -0.0547f, 0.9485f, 1.0f,0.583f, 0.0f, -0.0695f, 0.9653f, 1.0f,
-0.5663f, 0.0f, -0.083f, 0.9781f, 1.0f,0.5492f, 0.0f, -0.0955f, 0.9876f, 1.0f,0.5317f, 0.0f, -0.1071f, 0.9942f, 1.0f,0.514f, 0.0f, -0.118f, 0.9983f, 1.0f,
-0.4961f, 0.0f, -0.1284f, 0.9997f, 1.0f,0.4781f, 0.0f, -0.1384f, 0.999f, 1.0f,0.4599f, 0.0f, -0.1483f, 0.9963f, 1.0f,0.4416f, 0.0f, -0.1582f, 0.9912f, 1.0f,
-0.4234f, 0.0f, -0.1682f, 0.9834f, 1.0f,0.4051f, 0.0f, -0.1787f, 0.9724f, 1.0f,0.387f, 0.0f, -0.1896f, 0.9576f, 1.0f,0.369f, 0.0f, -0.2013f, 0.9385f, 1.0f,
-0.3512f, 0.0f, -0.2138f, 0.9143f, 1.0f,0.3337f, 0.0f, -0.2274f, 0.8841f, 1.0f,0.3164f, 0.0f, -0.2422f, 0.8461f, 1.0f,0.2995f, 0.0f, -0.2584f, 0.7979f, 1.0f,
-0.2829f, 0.0f, -0.2762f, 0.7359f, 1.0f,0.2669f, 0.0f, -0.2958f, 0.6541f, 1.0f,0.2513f, 0.0f, -0.3173f, 0.5396f, 1.0f,0.2362f, 0.0f, -0.3409f, 0.36f, 1.0f,
-0.2218f, 0.0f, -0.3668f, 0.1f, 1.0f
+ 0.724f, 0.0f, 0.1799f, 0.1f, 1.0f,
+ 0.7192f, 0.0f, 0.162f, 0.2199f, 1.0f,
+ 0.7089f, 0.0f, 0.1283f, 0.4615f, 1.0f,
+ 0.6977f, 0.0f, 0.0975f, 0.6019f, 1.0f,
+ 0.6858f, 0.0f, 0.0693f, 0.6981f, 1.0f,
+ 0.673f, 0.0f, 0.0435f, 0.7689f, 1.0f,
+ 0.6595f, 0.0f, 0.02f, 0.8236f, 1.0f,
+ 0.6453f, 0.0f, -0.0014f, 0.866f, 1.0f,
+ 0.6306f, 0.0f, -0.0208f, 0.9003f, 1.0f,
+ 0.6152f, 0.0f, -0.0386f, 0.9272f, 1.0f,
+ 0.5994f, 0.0f, -0.0547f, 0.9485f, 1.0f,
+ 0.583f, 0.0f, -0.0695f, 0.9653f, 1.0f,
+ 0.5663f, 0.0f, -0.083f, 0.9781f, 1.0f,
+ 0.5492f, 0.0f, -0.0955f, 0.9876f, 1.0f,
+ 0.5317f, 0.0f, -0.1071f, 0.9942f, 1.0f,
+ 0.514f, 0.0f, -0.118f, 0.9983f, 1.0f,
+ 0.4961f, 0.0f, -0.1284f, 0.9997f, 1.0f,
+ 0.4781f, 0.0f, -0.1384f, 0.999f, 1.0f,
+ 0.4599f, 0.0f, -0.1483f, 0.9963f, 1.0f,
+ 0.4416f, 0.0f, -0.1582f, 0.9912f, 1.0f,
+ 0.4234f, 0.0f, -0.1682f, 0.9834f, 1.0f,
+ 0.4051f, 0.0f, -0.1787f, 0.9724f, 1.0f,
+ 0.387f, 0.0f, -0.1896f, 0.9576f, 1.0f,
+ 0.369f, 0.0f, -0.2013f, 0.9385f, 1.0f,
+ 0.3512f, 0.0f, -0.2138f, 0.9143f, 1.0f,
+ 0.3337f, 0.0f, -0.2274f, 0.8841f, 1.0f,
+ 0.3164f, 0.0f, -0.2422f, 0.8461f, 1.0f,
+ 0.2995f, 0.0f, -0.2584f, 0.7979f, 1.0f,
+ 0.2829f, 0.0f, -0.2762f, 0.7359f, 1.0f,
+ 0.2669f, 0.0f, -0.2958f, 0.6541f, 1.0f,
+ 0.2513f, 0.0f, -0.3173f, 0.5396f, 1.0f,
+ 0.2362f, 0.0f, -0.3409f, 0.36f, 1.0f,
+ 0.2218f, 0.0f, -0.3668f, 0.1f, 1.0f,
};
static const float data18[33 * GP_PRIM_DATABUF_SIZE] = {
--0.1119f, 0.0f, -0.7868f, 0.1f, 1.0f,-0.1087f, 0.0f, -0.7905f, 0.2199f, 1.0f,-0.1022f, 0.0f, -0.7974f, 0.4615f, 1.0f,-0.0955f, 0.0f, -0.8038f, 0.6019f, 1.0f,
--0.0886f, 0.0f, -0.8097f, 0.6981f, 1.0f,-0.0816f, 0.0f, -0.8152f, 0.7689f, 1.0f,-0.0744f, 0.0f, -0.8201f, 0.8236f, 1.0f,-0.0671f, 0.0f, -0.8246f, 0.866f, 1.0f,
--0.0597f, 0.0f, -0.8286f, 0.9003f, 1.0f,-0.0522f, 0.0f, -0.8321f, 0.9272f, 1.0f,-0.0446f, 0.0f, -0.8351f, 0.9485f, 1.0f,-0.0369f, 0.0f, -0.8376f, 0.9653f, 1.0f,
--0.0292f, 0.0f, -0.8397f, 0.9781f, 1.0f,-0.0214f, 0.0f, -0.8413f, 0.9876f, 1.0f,-0.0136f, 0.0f, -0.8424f, 0.9942f, 1.0f,-0.0057f, 0.0f, -0.843f, 0.9983f, 1.0f,
-0.0022f, 0.0f, -0.8431f, 0.9997f, 1.0f,0.01f, 0.0f, -0.8428f, 0.999f, 1.0f,0.0178f, 0.0f, -0.8419f, 0.9963f, 1.0f,0.0257f, 0.0f, -0.8407f, 0.9912f, 1.0f,
-0.0334f, 0.0f, -0.8389f, 0.9834f, 1.0f,0.0411f, 0.0f, -0.8366f, 0.9724f, 1.0f,0.0488f, 0.0f, -0.8339f, 0.9576f, 1.0f,0.0564f, 0.0f, -0.8308f, 0.9385f, 1.0f,
-0.0638f, 0.0f, -0.8271f, 0.9143f, 1.0f,0.0712f, 0.0f, -0.823f, 0.8841f, 1.0f,0.0785f, 0.0f, -0.8184f, 0.8461f, 1.0f,0.0856f, 0.0f, -0.8134f, 0.7979f, 1.0f,
-0.0925f, 0.0f, -0.8079f, 0.7359f, 1.0f,0.0994f, 0.0f, -0.8019f, 0.6541f, 1.0f,0.106f, 0.0f, -0.7954f, 0.5396f, 1.0f,0.1125f, 0.0f, -0.7885f, 0.36f, 1.0f,
-0.1187f, 0.0f, -0.7812f, 0.1f, 1.0f
+ -0.1119f, 0.0f, -0.7868f, 0.1f, 1.0f,
+ -0.1087f, 0.0f, -0.7905f, 0.2199f, 1.0f,
+ -0.1022f, 0.0f, -0.7974f, 0.4615f, 1.0f,
+ -0.0955f, 0.0f, -0.8038f, 0.6019f, 1.0f,
+ -0.0886f, 0.0f, -0.8097f, 0.6981f, 1.0f,
+ -0.0816f, 0.0f, -0.8152f, 0.7689f, 1.0f,
+ -0.0744f, 0.0f, -0.8201f, 0.8236f, 1.0f,
+ -0.0671f, 0.0f, -0.8246f, 0.866f, 1.0f,
+ -0.0597f, 0.0f, -0.8286f, 0.9003f, 1.0f,
+ -0.0522f, 0.0f, -0.8321f, 0.9272f, 1.0f,
+ -0.0446f, 0.0f, -0.8351f, 0.9485f, 1.0f,
+ -0.0369f, 0.0f, -0.8376f, 0.9653f, 1.0f,
+ -0.0292f, 0.0f, -0.8397f, 0.9781f, 1.0f,
+ -0.0214f, 0.0f, -0.8413f, 0.9876f, 1.0f,
+ -0.0136f, 0.0f, -0.8424f, 0.9942f, 1.0f,
+ -0.0057f, 0.0f, -0.843f, 0.9983f, 1.0f,
+ 0.0022f, 0.0f, -0.8431f, 0.9997f, 1.0f,
+ 0.01f, 0.0f, -0.8428f, 0.999f, 1.0f,
+ 0.0178f, 0.0f, -0.8419f, 0.9963f, 1.0f,
+ 0.0257f, 0.0f, -0.8407f, 0.9912f, 1.0f,
+ 0.0334f, 0.0f, -0.8389f, 0.9834f, 1.0f,
+ 0.0411f, 0.0f, -0.8366f, 0.9724f, 1.0f,
+ 0.0488f, 0.0f, -0.8339f, 0.9576f, 1.0f,
+ 0.0564f, 0.0f, -0.8308f, 0.9385f, 1.0f,
+ 0.0638f, 0.0f, -0.8271f, 0.9143f, 1.0f,
+ 0.0712f, 0.0f, -0.823f, 0.8841f, 1.0f,
+ 0.0785f, 0.0f, -0.8184f, 0.8461f, 1.0f,
+ 0.0856f, 0.0f, -0.8134f, 0.7979f, 1.0f,
+ 0.0925f, 0.0f, -0.8079f, 0.7359f, 1.0f,
+ 0.0994f, 0.0f, -0.8019f, 0.6541f, 1.0f,
+ 0.106f, 0.0f, -0.7954f, 0.5396f, 1.0f,
+ 0.1125f, 0.0f, -0.7885f, 0.36f, 1.0f,
+ 0.1187f, 0.0f, -0.7812f, 0.1f, 1.0f,
};
static const float data19[34 * GP_PRIM_DATABUF_SIZE] = {
--0.1119f, 0.0f, -0.2655f, 0.1f, 1.0f,-0.1101f, 0.0f, -0.2605f, 0.1288f, 1.0f,-0.1032f, 0.0f, -0.2424f, 0.4147f, 1.0f,-0.0965f, 0.0f, -0.2276f, 0.5723f, 1.0f,
--0.0901f, 0.0f, -0.2158f, 0.6768f, 1.0f,-0.0837f, 0.0f, -0.2069f, 0.753f, 1.0f,-0.0775f, 0.0f, -0.2006f, 0.8109f, 1.0f,-0.0712f, 0.0f, -0.1967f, 0.8564f, 1.0f,
--0.065f, 0.0f, -0.1949f, 0.8922f, 1.0f,-0.0587f, 0.0f, -0.195f, 0.9211f, 1.0f,-0.0522f, 0.0f, -0.1968f, 0.944f, 1.0f,-0.0455f, 0.0f, -0.2001f, 0.9617f, 1.0f,
--0.0386f, 0.0f, -0.2046f, 0.9755f, 1.0f,-0.0315f, 0.0f, -0.21f, 0.9858f, 1.0f,-0.0239f, 0.0f, -0.2163f, 0.993f, 1.0f,-0.016f, 0.0f, -0.223f, 0.9973f, 1.0f,
--0.0075f, 0.0f, -0.2301f, 0.9993f, 1.0f,-0.0002f, 0.0f, -0.2342f, 0.9993f, 1.0f,0.0054f, 0.0f, -0.234f, 0.9973f, 1.0f,0.0106f, 0.0f, -0.2324f, 0.993f, 1.0f,
-0.0155f, 0.0f, -0.2297f, 0.9858f, 1.0f,0.0202f, 0.0f, -0.2261f, 0.9755f, 1.0f,0.0249f, 0.0f, -0.2219f, 0.9617f, 1.0f,0.0296f, 0.0f, -0.2174f, 0.944f, 1.0f,
-0.0344f, 0.0f, -0.2128f, 0.9211f, 1.0f,0.0394f, 0.0f, -0.2084f, 0.8922f, 1.0f,0.0448f, 0.0f, -0.2044f, 0.8564f, 1.0f,0.0506f, 0.0f, -0.2012f, 0.8109f, 1.0f,
-0.057f, 0.0f, -0.1988f, 0.753f, 1.0f,0.064f, 0.0f, -0.1977f, 0.6768f, 1.0f,0.0717f, 0.0f, -0.198f, 0.5723f, 1.0f,0.0804f, 0.0f, -0.2001f, 0.4147f, 1.0f,
-0.0899f, 0.0f, -0.2042f, 0.1288f, 1.0f,0.0925f, 0.0f, -0.2055f, 0.1f, 1.0f
+ -0.1119f, 0.0f, -0.2655f, 0.1f, 1.0f,
+ -0.1101f, 0.0f, -0.2605f, 0.1288f, 1.0f,
+ -0.1032f, 0.0f, -0.2424f, 0.4147f, 1.0f,
+ -0.0965f, 0.0f, -0.2276f, 0.5723f, 1.0f,
+ -0.0901f, 0.0f, -0.2158f, 0.6768f, 1.0f,
+ -0.0837f, 0.0f, -0.2069f, 0.753f, 1.0f,
+ -0.0775f, 0.0f, -0.2006f, 0.8109f, 1.0f,
+ -0.0712f, 0.0f, -0.1967f, 0.8564f, 1.0f,
+ -0.065f, 0.0f, -0.1949f, 0.8922f, 1.0f,
+ -0.0587f, 0.0f, -0.195f, 0.9211f, 1.0f,
+ -0.0522f, 0.0f, -0.1968f, 0.944f, 1.0f,
+ -0.0455f, 0.0f, -0.2001f, 0.9617f, 1.0f,
+ -0.0386f, 0.0f, -0.2046f, 0.9755f, 1.0f,
+ -0.0315f, 0.0f, -0.21f, 0.9858f, 1.0f,
+ -0.0239f, 0.0f, -0.2163f, 0.993f, 1.0f,
+ -0.016f, 0.0f, -0.223f, 0.9973f, 1.0f,
+ -0.0075f, 0.0f, -0.2301f, 0.9993f, 1.0f,
+ -0.0002f, 0.0f, -0.2342f, 0.9993f, 1.0f,
+ 0.0054f, 0.0f, -0.234f, 0.9973f, 1.0f,
+ 0.0106f, 0.0f, -0.2324f, 0.993f, 1.0f,
+ 0.0155f, 0.0f, -0.2297f, 0.9858f, 1.0f,
+ 0.0202f, 0.0f, -0.2261f, 0.9755f, 1.0f,
+ 0.0249f, 0.0f, -0.2219f, 0.9617f, 1.0f,
+ 0.0296f, 0.0f, -0.2174f, 0.944f, 1.0f,
+ 0.0344f, 0.0f, -0.2128f, 0.9211f, 1.0f,
+ 0.0394f, 0.0f, -0.2084f, 0.8922f, 1.0f,
+ 0.0448f, 0.0f, -0.2044f, 0.8564f, 1.0f,
+ 0.0506f, 0.0f, -0.2012f, 0.8109f, 1.0f,
+ 0.057f, 0.0f, -0.1988f, 0.753f, 1.0f,
+ 0.064f, 0.0f, -0.1977f, 0.6768f, 1.0f,
+ 0.0717f, 0.0f, -0.198f, 0.5723f, 1.0f,
+ 0.0804f, 0.0f, -0.2001f, 0.4147f, 1.0f,
+ 0.0899f, 0.0f, -0.2042f, 0.1288f, 1.0f,
+ 0.0925f, 0.0f, -0.2055f, 0.1f, 1.0f,
};
static const float data20[33 * GP_PRIM_DATABUF_SIZE] = {
-0.7993f, -0.0f, 0.3242f, 0.1f, 1.0f,0.8169f, -0.0f, 0.3354f, 0.2199f, 1.0f,0.8512f, -0.0f, 0.3542f, 0.4615f, 1.0f,0.884f, -0.0f, 0.3686f, 0.6019f, 1.0f,
-0.9153f, -0.0f, 0.3787f, 0.6981f, 1.0f,0.945f, -0.0f, 0.3848f, 0.7689f, 1.0f,0.9729f, -0.0f, 0.3871f, 0.8236f, 1.0f,0.9989f, -0.0f, 0.3857f, 0.866f, 1.0f,
-1.0229f, -0.0f, 0.3811f, 0.9003f, 1.0f,1.0447f, -0.0f, 0.3732f, 0.9272f, 1.0f,1.0643f, -0.0f, 0.3624f, 0.9485f, 1.0f,1.0814f, -0.0f, 0.349f, 0.9653f, 1.0f,
-1.096f, -0.0f, 0.333f, 0.9781f, 1.0f,1.108f, -0.0f, 0.3147f, 0.9876f, 1.0f,1.1172f, -0.0f, 0.2944f, 0.9942f, 1.0f,1.1235f, -0.0f, 0.2723f, 0.9983f, 1.0f,
-1.1267f, -0.0f, 0.2485f, 0.9997f, 1.0f,1.1269f, -0.0f, 0.2233f, 0.999f, 1.0f,1.1237f, -0.0f, 0.197f, 0.9963f, 1.0f,1.1172f, -0.0f, 0.1697f, 0.9912f, 1.0f,
-1.1071f, -0.0f, 0.1417f, 0.9834f, 1.0f,1.0934f, -0.0f, 0.1131f, 0.9724f, 1.0f,1.0759f, -0.0f, 0.0842f, 0.9576f, 1.0f,1.0545f, -0.0f, 0.0553f, 0.9385f, 1.0f,
-1.0291f, -0.0f, 0.0265f, 0.9143f, 1.0f,0.9995f, 0.0f, -0.0019f, 0.8841f, 1.0f,0.9657f, 0.0f, -0.0298f, 0.8461f, 1.0f,0.9275f, 0.0f, -0.0569f, 0.7979f, 1.0f,
-0.8847f, 0.0f, -0.0829f, 0.7359f, 1.0f,0.8373f, 0.0f, -0.1077f, 0.6541f, 1.0f,0.7852f, 0.0f, -0.1311f, 0.5396f, 1.0f,0.7281f, 0.0f, -0.1528f, 0.36f, 1.0f,
-0.6661f, 0.0f, -0.1725f, 0.1f, 1.0f
+ 0.7993f, 0.0f, 0.3242f, 0.1f, 1.0f,
+ 0.8169f, 0.0f, 0.3354f, 0.2199f, 1.0f,
+ 0.8512f, 0.0f, 0.3542f, 0.4615f, 1.0f,
+ 0.884f, 0.0f, 0.3686f, 0.6019f, 1.0f,
+ 0.9153f, 0.0f, 0.3787f, 0.6981f, 1.0f,
+ 0.945f, 0.0f, 0.3848f, 0.7689f, 1.0f,
+ 0.9729f, 0.0f, 0.3871f, 0.8236f, 1.0f,
+ 0.9989f, 0.0f, 0.3857f, 0.866f, 1.0f,
+ 1.0229f, 0.0f, 0.3811f, 0.9003f, 1.0f,
+ 1.0447f, 0.0f, 0.3732f, 0.9272f, 1.0f,
+ 1.0643f, 0.0f, 0.3624f, 0.9485f, 1.0f,
+ 1.0814f, 0.0f, 0.349f, 0.9653f, 1.0f,
+ 1.096f, 0.0f, 0.333f, 0.9781f, 1.0f,
+ 1.108f, 0.0f, 0.3147f, 0.9876f, 1.0f,
+ 1.1172f, 0.0f, 0.2944f, 0.9942f, 1.0f,
+ 1.1235f, 0.0f, 0.2723f, 0.9983f, 1.0f,
+ 1.1267f, 0.0f, 0.2485f, 0.9997f, 1.0f,
+ 1.1269f, 0.0f, 0.2233f, 0.999f, 1.0f,
+ 1.1237f, 0.0f, 0.197f, 0.9963f, 1.0f,
+ 1.1172f, 0.0f, 0.1697f, 0.9912f, 1.0f,
+ 1.1071f, 0.0f, 0.1417f, 0.9834f, 1.0f,
+ 1.0934f, 0.0f, 0.1131f, 0.9724f, 1.0f,
+ 1.0759f, 0.0f, 0.0842f, 0.9576f, 1.0f,
+ 1.0545f, 0.0f, 0.0553f, 0.9385f, 1.0f,
+ 1.0291f, 0.0f, 0.0265f, 0.9143f, 1.0f,
+ 0.9995f, 0.0f, -0.0019f, 0.8841f, 1.0f,
+ 0.9657f, 0.0f, -0.0298f, 0.8461f, 1.0f,
+ 0.9275f, 0.0f, -0.0569f, 0.7979f, 1.0f,
+ 0.8847f, 0.0f, -0.0829f, 0.7359f, 1.0f,
+ 0.8373f, 0.0f, -0.1077f, 0.6541f, 1.0f,
+ 0.7852f, 0.0f, -0.1311f, 0.5396f, 1.0f,
+ 0.7281f, 0.0f, -0.1528f, 0.36f, 1.0f,
+ 0.6661f, 0.0f, -0.1725f, 0.1f, 1.0f,
};
static const float data21[64 * GP_PRIM_DATABUF_SIZE] = {
--0.7428f, -0.0f, 0.2977f, 0.1f, 1.0f,-0.7608f, -0.0f, 0.3138f, 0.2199f, 1.0f,-0.7786f, -0.0f, 0.3284f, 0.36f, 1.0f,-0.7962f, -0.0f, 0.3414f, 0.4615f, 1.0f,
--0.8135f, -0.0f, 0.3531f, 0.5396f, 1.0f,-0.8306f, -0.0f, 0.3633f, 0.6019f, 1.0f,-0.8473f, -0.0f, 0.3722f, 0.6541f, 1.0f,-0.8637f, -0.0f, 0.3798f, 0.6981f, 1.0f,
--0.8798f, -0.0f, 0.386f, 0.7359f, 1.0f,-0.8956f, -0.0f, 0.3911f, 0.7689f, 1.0f,-0.9109f, -0.0f, 0.3949f, 0.7979f, 1.0f,-0.9259f, -0.0f, 0.3975f, 0.8236f, 1.0f,
--0.9405f, -0.0f, 0.3989f, 0.8461f, 1.0f,-0.9546f, -0.0f, 0.3993f, 0.866f, 1.0f,-0.9682f, -0.0f, 0.3986f, 0.8841f, 1.0f,-0.9814f, -0.0f, 0.3969f, 0.9003f, 1.0f,
--0.994f, -0.0f, 0.3941f, 0.9143f, 1.0f,-1.0062f, -0.0f, 0.3904f, 0.9272f, 1.0f,-1.0178f, -0.0f, 0.3858f, 0.9385f, 1.0f,-1.0288f, -0.0f, 0.3803f, 0.9485f, 1.0f,
--1.0393f, -0.0f, 0.3739f, 0.9576f, 1.0f,-1.0492f, -0.0f, 0.3668f, 0.9653f, 1.0f,-1.0584f, -0.0f, 0.3588f, 0.9724f, 1.0f,-1.067f, -0.0f, 0.3501f, 0.9781f, 1.0f,
--1.075f, -0.0f, 0.3407f, 0.9834f, 1.0f,-1.0822f, -0.0f, 0.3307f, 0.9876f, 1.0f,-1.0888f, -0.0f, 0.32f, 0.9912f, 1.0f,-1.0946f, -0.0f, 0.3087f, 0.9942f, 1.0f,
--1.0997f, -0.0f, 0.2969f, 0.9963f, 1.0f,-1.104f, -0.0f, 0.2845f, 0.9983f, 1.0f,-1.1075f, -0.0f, 0.2717f, 0.999f, 1.0f,-1.1103f, -0.0f, 0.2584f, 0.9997f, 1.0f,
--1.1122f, -0.0f, 0.2447f, 0.9997f, 1.0f,-1.1132f, -0.0f, 0.2306f, 0.999f, 1.0f,-1.1134f, -0.0f, 0.2162f, 0.9983f, 1.0f,-1.1128f, -0.0f, 0.2015f, 0.9963f, 1.0f,
--1.1112f, -0.0f, 0.1865f, 0.9942f, 1.0f,-1.1086f, -0.0f, 0.1713f, 0.9912f, 1.0f,-1.1052f, -0.0f, 0.1559f, 0.9876f, 1.0f,-1.1007f, -0.0f, 0.1404f, 0.9834f, 1.0f,
--1.0953f, -0.0f, 0.1247f, 0.9781f, 1.0f,-1.0889f, -0.0f, 0.109f, 0.9724f, 1.0f,-1.0814f, -0.0f, 0.0932f, 0.9653f, 1.0f,-1.0729f, -0.0f, 0.0774f, 0.9576f, 1.0f,
--1.0633f, -0.0f, 0.0617f, 0.9485f, 1.0f,-1.0527f, -0.0f, 0.046f, 0.9385f, 1.0f,-1.0409f, -0.0f, 0.0304f, 0.9272f, 1.0f,-1.028f, -0.0f, 0.015f, 0.9143f, 1.0f,
--1.0139f, 0.0f, -0.0003f, 0.9003f, 1.0f,-0.9987f, 0.0f, -0.0154f, 0.8841f, 1.0f,-0.9823f, 0.0f, -0.0302f, 0.866f, 1.0f,-0.9646f, 0.0f, -0.0447f, 0.8461f, 1.0f,
--0.9458f, 0.0f, -0.0589f, 0.8236f, 1.0f,-0.9257f, 0.0f, -0.0727f, 0.7979f, 1.0f,-0.9043f, 0.0f, -0.0862f, 0.7689f, 1.0f,-0.8816f, 0.0f, -0.0992f, 0.7359f, 1.0f,
--0.8576f, 0.0f, -0.1117f, 0.6981f, 1.0f,-0.8323f, 0.0f, -0.1237f, 0.6541f, 1.0f,-0.8056f, 0.0f, -0.1352f, 0.6019f, 1.0f,-0.7775f, 0.0f, -0.1461f, 0.5396f, 1.0f,
--0.7481f, 0.0f, -0.1564f, 0.4615f, 1.0f,-0.7172f, 0.0f, -0.166f, 0.36f, 1.0f,-0.6849f, 0.0f, -0.175f, 0.2199f, 1.0f,-0.6512f, 0.0f, -0.1832f, 0.1f, 1.0f
+ -0.7428f, 0.0f, 0.2977f, 0.1f, 1.0f,
+ -0.7608f, 0.0f, 0.3138f, 0.2199f, 1.0f,
+ -0.7786f, 0.0f, 0.3284f, 0.36f, 1.0f,
+ -0.7962f, 0.0f, 0.3414f, 0.4615f, 1.0f,
+ -0.8135f, 0.0f, 0.3531f, 0.5396f, 1.0f,
+ -0.8306f, 0.0f, 0.3633f, 0.6019f, 1.0f,
+ -0.8473f, 0.0f, 0.3722f, 0.6541f, 1.0f,
+ -0.8637f, 0.0f, 0.3798f, 0.6981f, 1.0f,
+ -0.8798f, 0.0f, 0.386f, 0.7359f, 1.0f,
+ -0.8956f, 0.0f, 0.3911f, 0.7689f, 1.0f,
+ -0.9109f, 0.0f, 0.3949f, 0.7979f, 1.0f,
+ -0.9259f, 0.0f, 0.3975f, 0.8236f, 1.0f,
+ -0.9405f, 0.0f, 0.3989f, 0.8461f, 1.0f,
+ -0.9546f, 0.0f, 0.3993f, 0.866f, 1.0f,
+ -0.9682f, 0.0f, 0.3986f, 0.8841f, 1.0f,
+ -0.9814f, 0.0f, 0.3969f, 0.9003f, 1.0f,
+ -0.994f, 0.0f, 0.3941f, 0.9143f, 1.0f,
+ -1.0062f, 0.0f, 0.3904f, 0.9272f, 1.0f,
+ -1.0178f, 0.0f, 0.3858f, 0.9385f, 1.0f,
+ -1.0288f, 0.0f, 0.3803f, 0.9485f, 1.0f,
+ -1.0393f, 0.0f, 0.3739f, 0.9576f, 1.0f,
+ -1.0492f, 0.0f, 0.3668f, 0.9653f, 1.0f,
+ -1.0584f, 0.0f, 0.3588f, 0.9724f, 1.0f,
+ -1.067f, 0.0f, 0.3501f, 0.9781f, 1.0f,
+ -1.075f, 0.0f, 0.3407f, 0.9834f, 1.0f,
+ -1.0822f, 0.0f, 0.3307f, 0.9876f, 1.0f,
+ -1.0888f, 0.0f, 0.32f, 0.9912f, 1.0f,
+ -1.0946f, 0.0f, 0.3087f, 0.9942f, 1.0f,
+ -1.0997f, 0.0f, 0.2969f, 0.9963f, 1.0f,
+ -1.104f, 0.0f, 0.2845f, 0.9983f, 1.0f,
+ -1.1075f, 0.0f, 0.2717f, 0.999f, 1.0f,
+ -1.1103f, 0.0f, 0.2584f, 0.9997f, 1.0f,
+ -1.1122f, 0.0f, 0.2447f, 0.9997f, 1.0f,
+ -1.1132f, 0.0f, 0.2306f, 0.999f, 1.0f,
+ -1.1134f, 0.0f, 0.2162f, 0.9983f, 1.0f,
+ -1.1128f, 0.0f, 0.2015f, 0.9963f, 1.0f,
+ -1.1112f, 0.0f, 0.1865f, 0.9942f, 1.0f,
+ -1.1086f, 0.0f, 0.1713f, 0.9912f, 1.0f,
+ -1.1052f, 0.0f, 0.1559f, 0.9876f, 1.0f,
+ -1.1007f, 0.0f, 0.1404f, 0.9834f, 1.0f,
+ -1.0953f, 0.0f, 0.1247f, 0.9781f, 1.0f,
+ -1.0889f, 0.0f, 0.109f, 0.9724f, 1.0f,
+ -1.0814f, 0.0f, 0.0932f, 0.9653f, 1.0f,
+ -1.0729f, 0.0f, 0.0774f, 0.9576f, 1.0f,
+ -1.0633f, 0.0f, 0.0617f, 0.9485f, 1.0f,
+ -1.0527f, 0.0f, 0.046f, 0.9385f, 1.0f,
+ -1.0409f, 0.0f, 0.0304f, 0.9272f, 1.0f,
+ -1.028f, 0.0f, 0.015f, 0.9143f, 1.0f,
+ -1.0139f, 0.0f, -0.0003f, 0.9003f, 1.0f,
+ -0.9987f, 0.0f, -0.0154f, 0.8841f, 1.0f,
+ -0.9823f, 0.0f, -0.0302f, 0.866f, 1.0f,
+ -0.9646f, 0.0f, -0.0447f, 0.8461f, 1.0f,
+ -0.9458f, 0.0f, -0.0589f, 0.8236f, 1.0f,
+ -0.9257f, 0.0f, -0.0727f, 0.7979f, 1.0f,
+ -0.9043f, 0.0f, -0.0862f, 0.7689f, 1.0f,
+ -0.8816f, 0.0f, -0.0992f, 0.7359f, 1.0f,
+ -0.8576f, 0.0f, -0.1117f, 0.6981f, 1.0f,
+ -0.8323f, 0.0f, -0.1237f, 0.6541f, 1.0f,
+ -0.8056f, 0.0f, -0.1352f, 0.6019f, 1.0f,
+ -0.7775f, 0.0f, -0.1461f, 0.5396f, 1.0f,
+ -0.7481f, 0.0f, -0.1564f, 0.4615f, 1.0f,
+ -0.7172f, 0.0f, -0.166f, 0.36f, 1.0f,
+ -0.6849f, 0.0f, -0.175f, 0.2199f, 1.0f,
+ -0.6512f, 0.0f, -0.1832f, 0.1f, 1.0f,
};
static const float data22[26 * GP_PRIM_DATABUF_SIZE] = {
-0.2721f, -0.0f, 0.2084f, 1.0f, 1.0f,0.2721f, -0.0f, 0.2112f, 1.0f, 1.0f,0.2739f, -0.0f, 0.2223f, 1.0f, 1.0f,0.2778f, -0.0f, 0.2324f, 1.0f, 1.0f,
-0.2836f, -0.0f, 0.2409f, 1.0f, 1.0f,0.291f, -0.0f, 0.2471f, 1.0f, 1.0f,0.2994f, -0.0f, 0.2507f, 1.0f, 1.0f,0.3082f, -0.0f, 0.2515f, 1.0f, 1.0f,
-0.3169f, -0.0f, 0.2493f, 1.0f, 1.0f,0.3248f, -0.0f, 0.2443f, 1.0f, 1.0f,0.3315f, -0.0f, 0.2369f, 1.0f, 1.0f,0.3364f, -0.0f, 0.2275f, 1.0f, 1.0f,
-0.3392f, -0.0f, 0.2168f, 1.0f, 1.0f,0.3398f, -0.0f, 0.2056f, 1.0f, 1.0f,0.3381f, -0.0f, 0.1945f, 1.0f, 1.0f,0.3342f, -0.0f, 0.1844f, 1.0f, 1.0f,
-0.3283f, -0.0f, 0.176f, 1.0f, 1.0f,0.321f, -0.0f, 0.1697f, 1.0f, 1.0f,0.3126f, -0.0f, 0.1661f, 1.0f, 1.0f,0.3038f, -0.0f, 0.1653f, 1.0f, 1.0f,
-0.2951f, -0.0f, 0.1675f, 1.0f, 1.0f,0.2871f, -0.0f, 0.1725f, 1.0f, 1.0f,0.2805f, -0.0f, 0.1799f, 1.0f, 1.0f,0.2756f, -0.0f, 0.1893f, 1.0f, 1.0f,
-0.2727f, -0.0f, 0.2f, 1.0f, 1.0f,0.2721f, -0.0f, 0.2056f, 1.0f, 1.0f
+ 0.2721f, 0.0f, 0.2084f, 1.0f, 1.0f,
+ 0.2721f, 0.0f, 0.2112f, 1.0f, 1.0f,
+ 0.2739f, 0.0f, 0.2223f, 1.0f, 1.0f,
+ 0.2778f, 0.0f, 0.2324f, 1.0f, 1.0f,
+ 0.2836f, 0.0f, 0.2409f, 1.0f, 1.0f,
+ 0.291f, 0.0f, 0.2471f, 1.0f, 1.0f,
+ 0.2994f, 0.0f, 0.2507f, 1.0f, 1.0f,
+ 0.3082f, 0.0f, 0.2515f, 1.0f, 1.0f,
+ 0.3169f, 0.0f, 0.2493f, 1.0f, 1.0f,
+ 0.3248f, 0.0f, 0.2443f, 1.0f, 1.0f,
+ 0.3315f, 0.0f, 0.2369f, 1.0f, 1.0f,
+ 0.3364f, 0.0f, 0.2275f, 1.0f, 1.0f,
+ 0.3392f, 0.0f, 0.2168f, 1.0f, 1.0f,
+ 0.3398f, 0.0f, 0.2056f, 1.0f, 1.0f,
+ 0.3381f, 0.0f, 0.1945f, 1.0f, 1.0f,
+ 0.3342f, 0.0f, 0.1844f, 1.0f, 1.0f,
+ 0.3283f, 0.0f, 0.176f, 1.0f, 1.0f,
+ 0.321f, 0.0f, 0.1697f, 1.0f, 1.0f,
+ 0.3126f, 0.0f, 0.1661f, 1.0f, 1.0f,
+ 0.3038f, 0.0f, 0.1653f, 1.0f, 1.0f,
+ 0.2951f, 0.0f, 0.1675f, 1.0f, 1.0f,
+ 0.2871f, 0.0f, 0.1725f, 1.0f, 1.0f,
+ 0.2805f, 0.0f, 0.1799f, 1.0f, 1.0f,
+ 0.2756f, 0.0f, 0.1893f, 1.0f, 1.0f,
+ 0.2727f, 0.0f, 0.2f, 1.0f, 1.0f,
+ 0.2721f, 0.0f, 0.2056f, 1.0f, 1.0f,
};
static const float data23[26 * GP_PRIM_DATABUF_SIZE] = {
--0.3545f, -0.0f, 0.2084f, 1.0f, 1.0f,-0.3544f, -0.0f, 0.2112f, 1.0f, 1.0f,-0.3527f, -0.0f, 0.2223f, 1.0f, 1.0f,-0.3488f, -0.0f, 0.2324f, 1.0f, 1.0f,
--0.343f, -0.0f, 0.2409f, 1.0f, 1.0f,-0.3356f, -0.0f, 0.2471f, 1.0f, 1.0f,-0.3272f, -0.0f, 0.2507f, 1.0f, 1.0f,-0.3184f, -0.0f, 0.2515f, 1.0f, 1.0f,
--0.3097f, -0.0f, 0.2493f, 1.0f, 1.0f,-0.3018f, -0.0f, 0.2443f, 1.0f, 1.0f,-0.2951f, -0.0f, 0.2369f, 1.0f, 1.0f,-0.2902f, -0.0f, 0.2275f, 1.0f, 1.0f,
--0.2874f, -0.0f, 0.2168f, 1.0f, 1.0f,-0.2868f, -0.0f, 0.2056f, 1.0f, 1.0f,-0.2885f, -0.0f, 0.1945f, 1.0f, 1.0f,-0.2924f, -0.0f, 0.1844f, 1.0f, 1.0f,
--0.2983f, -0.0f, 0.176f, 1.0f, 1.0f,-0.3056f, -0.0f, 0.1697f, 1.0f, 1.0f,-0.314f, -0.0f, 0.1661f, 1.0f, 1.0f,-0.3228f, -0.0f, 0.1653f, 1.0f, 1.0f,
--0.3315f, -0.0f, 0.1675f, 1.0f, 1.0f,-0.3394f, -0.0f, 0.1725f, 1.0f, 1.0f,-0.3461f, -0.0f, 0.1799f, 1.0f, 1.0f,-0.351f, -0.0f, 0.1893f, 1.0f, 1.0f,
--0.3539f, -0.0f, 0.2f, 1.0f, 1.0f,-0.3544f, -0.0f, 0.2056f, 1.0f, 1.0f
+ -0.3545f, 0.0f, 0.2084f, 1.0f, 1.0f,
+ -0.3544f, 0.0f, 0.2112f, 1.0f, 1.0f,
+ -0.3527f, 0.0f, 0.2223f, 1.0f, 1.0f,
+ -0.3488f, 0.0f, 0.2324f, 1.0f, 1.0f,
+ -0.343f, 0.0f, 0.2409f, 1.0f, 1.0f,
+ -0.3356f, 0.0f, 0.2471f, 1.0f, 1.0f,
+ -0.3272f, 0.0f, 0.2507f, 1.0f, 1.0f,
+ -0.3184f, 0.0f, 0.2515f, 1.0f, 1.0f,
+ -0.3097f, 0.0f, 0.2493f, 1.0f, 1.0f,
+ -0.3018f, 0.0f, 0.2443f, 1.0f, 1.0f,
+ -0.2951f, 0.0f, 0.2369f, 1.0f, 1.0f,
+ -0.2902f, 0.0f, 0.2275f, 1.0f, 1.0f,
+ -0.2874f, 0.0f, 0.2168f, 1.0f, 1.0f,
+ -0.2868f, 0.0f, 0.2056f, 1.0f, 1.0f,
+ -0.2885f, 0.0f, 0.1945f, 1.0f, 1.0f,
+ -0.2924f, 0.0f, 0.1844f, 1.0f, 1.0f,
+ -0.2983f, 0.0f, 0.176f, 1.0f, 1.0f,
+ -0.3056f, 0.0f, 0.1697f, 1.0f, 1.0f,
+ -0.314f, 0.0f, 0.1661f, 1.0f, 1.0f,
+ -0.3228f, 0.0f, 0.1653f, 1.0f, 1.0f,
+ -0.3315f, 0.0f, 0.1675f, 1.0f, 1.0f,
+ -0.3394f, 0.0f, 0.1725f, 1.0f, 1.0f,
+ -0.3461f, 0.0f, 0.1799f, 1.0f, 1.0f,
+ -0.351f, 0.0f, 0.1893f, 1.0f, 1.0f,
+ -0.3539f, 0.0f, 0.2f, 1.0f, 1.0f,
+ -0.3544f, 0.0f, 0.2056f, 1.0f, 1.0f,
};
static const float data24[33 * GP_PRIM_DATABUF_SIZE] = {
-0.1904f, -0.0f, 0.0983f, 0.1f, 1.0f,0.1997f, -0.0f, 0.0774f, 0.2199f, 1.0f,0.2234f, -0.0f, 0.0407f, 0.4615f, 1.0f,0.2477f, -0.0f, 0.0158f, 0.6019f, 1.0f,
-0.2767f, -0.0f, -0.0047f, 0.6981f, 1.0f,0.3061f, -0.0f, -0.0179f, 0.7689f, 1.0f,0.3346f, -0.0f, -0.0247f, 0.8236f, 1.0f,0.362f, -0.0f, -0.0262f, 0.866f, 1.0f,
-0.3881f, -0.0f, -0.0231f, 0.9003f, 1.0f,0.4128f, -0.0f, -0.0159f, 0.9272f, 1.0f,0.436f, -0.0f, -0.0049f, 0.9485f, 1.0f,0.4577f, 0.0f, 0.0099f, 0.9653f, 1.0f,
-0.4778f, 0.0f, 0.0289f, 0.9781f, 1.0f,0.4959f, 0.0f, 0.0524f, 0.9876f, 1.0f,0.5114f, 0.0f, 0.0806f, 0.9942f, 1.0f,0.5229f, 0.0f, 0.1134f, 0.9983f, 1.0f,
-0.5291f, 0.0f, 0.1498f, 0.9997f, 1.0f,0.5289f, 0.0f, 0.1884f, 0.999f, 1.0f,0.5219f, -0.0f, 0.2267f, 0.9963f, 1.0f,0.5087f, -0.0f, 0.2616f, 0.9912f, 1.0f,
-0.4907f, -0.0f, 0.2916f, 0.9834f, 1.0f,0.4697f, -0.0f, 0.3159f, 0.9724f, 1.0f,0.4465f, -0.0f, 0.3349f, 0.9576f, 1.0f,0.422f, -0.0f, 0.3489f, 0.9385f, 1.0f,
-0.3964f, -0.0f, 0.3582f, 0.9143f, 1.0f,0.3705f, -0.0f, 0.3628f, 0.8841f, 1.0f,0.3436f, -0.0f, 0.363f, 0.8461f, 1.0f,0.3166f, -0.0f, 0.3586f, 0.7979f, 1.0f,
-0.2897f, -0.0f, 0.3491f, 0.7359f, 1.0f,0.2635f, -0.0f, 0.3344f, 0.6541f, 1.0f,0.2382f, -0.0f, 0.3137f, 0.5396f, 1.0f,0.2162f, -0.0f, 0.2882f, 0.36f, 1.0f,
-0.1949f, -0.0f, 0.2516f, 0.1f, 1.0f
+ 0.1904f, 0.0f, 0.0983f, 0.1f, 1.0f,
+ 0.1997f, 0.0f, 0.0774f, 0.2199f, 1.0f,
+ 0.2234f, 0.0f, 0.0407f, 0.4615f, 1.0f,
+ 0.2477f, 0.0f, 0.0158f, 0.6019f, 1.0f,
+ 0.2767f, 0.0f, -0.0047f, 0.6981f, 1.0f,
+ 0.3061f, 0.0f, -0.0179f, 0.7689f, 1.0f,
+ 0.3346f, 0.0f, -0.0247f, 0.8236f, 1.0f,
+ 0.362f, 0.0f, -0.0262f, 0.866f, 1.0f,
+ 0.3881f, 0.0f, -0.0231f, 0.9003f, 1.0f,
+ 0.4128f, 0.0f, -0.0159f, 0.9272f, 1.0f,
+ 0.436f, 0.0f, -0.0049f, 0.9485f, 1.0f,
+ 0.4577f, 0.0f, 0.0099f, 0.9653f, 1.0f,
+ 0.4778f, 0.0f, 0.0289f, 0.9781f, 1.0f,
+ 0.4959f, 0.0f, 0.0524f, 0.9876f, 1.0f,
+ 0.5114f, 0.0f, 0.0806f, 0.9942f, 1.0f,
+ 0.5229f, 0.0f, 0.1134f, 0.9983f, 1.0f,
+ 0.5291f, 0.0f, 0.1498f, 0.9997f, 1.0f,
+ 0.5289f, 0.0f, 0.1884f, 0.999f, 1.0f,
+ 0.5219f, 0.0f, 0.2267f, 0.9963f, 1.0f,
+ 0.5087f, 0.0f, 0.2616f, 0.9912f, 1.0f,
+ 0.4907f, 0.0f, 0.2916f, 0.9834f, 1.0f,
+ 0.4697f, 0.0f, 0.3159f, 0.9724f, 1.0f,
+ 0.4465f, 0.0f, 0.3349f, 0.9576f, 1.0f,
+ 0.422f, 0.0f, 0.3489f, 0.9385f, 1.0f,
+ 0.3964f, 0.0f, 0.3582f, 0.9143f, 1.0f,
+ 0.3705f, 0.0f, 0.3628f, 0.8841f, 1.0f,
+ 0.3436f, 0.0f, 0.363f, 0.8461f, 1.0f,
+ 0.3166f, 0.0f, 0.3586f, 0.7979f, 1.0f,
+ 0.2897f, 0.0f, 0.3491f, 0.7359f, 1.0f,
+ 0.2635f, 0.0f, 0.3344f, 0.6541f, 1.0f,
+ 0.2382f, 0.0f, 0.3137f, 0.5396f, 1.0f,
+ 0.2162f, 0.0f, 0.2882f, 0.36f, 1.0f,
+ 0.1949f, 0.0f, 0.2516f, 0.1f, 1.0f,
};
static const float data25[18 * GP_PRIM_DATABUF_SIZE] = {
--1.0361f, -0.0f, 0.1745f, 0.1f, 1.0f,-1.0319f, -0.0f, 0.177f, 0.2199f, 1.0f,-1.0153f, -0.0f, 0.1852f, 0.6019f, 1.0f,-0.999f, -0.0f, 0.1907f, 0.7689f, 1.0f,
--0.983f, -0.0f, 0.1936f, 0.866f, 1.0f,-0.9673f, -0.0f, 0.1941f, 0.9272f, 1.0f,-0.9522f, -0.0f, 0.1923f, 0.9653f, 1.0f,-0.9376f, -0.0f, 0.1885f, 0.9876f, 1.0f,
--0.9236f, -0.0f, 0.1827f, 0.9983f, 1.0f,-0.9103f, -0.0f, 0.1752f, 0.999f, 1.0f,-0.8978f, -0.0f, 0.1662f, 0.9912f, 1.0f,-0.8862f, -0.0f, 0.1558f, 0.9724f, 1.0f,
--0.8756f, -0.0f, 0.1441f, 0.9385f, 1.0f,-0.866f, -0.0f, 0.1314f, 0.8841f, 1.0f,-0.8575f, -0.0f, 0.1179f, 0.7979f, 1.0f,-0.8501f, -0.0f, 0.1036f, 0.6541f, 1.0f,
--0.8441f, -0.0f, 0.0889f, 0.36f, 1.0f,-0.8416f, -0.0f, 0.0813f, 0.1f, 1.0f
+ -1.0361f, 0.0f, 0.1745f, 0.1f, 1.0f,
+ -1.0319f, 0.0f, 0.177f, 0.2199f, 1.0f,
+ -1.0153f, 0.0f, 0.1852f, 0.6019f, 1.0f,
+ -0.999f, 0.0f, 0.1907f, 0.7689f, 1.0f,
+ -0.983f, 0.0f, 0.1936f, 0.866f, 1.0f,
+ -0.9673f, 0.0f, 0.1941f, 0.9272f, 1.0f,
+ -0.9522f, 0.0f, 0.1923f, 0.9653f, 1.0f,
+ -0.9376f, 0.0f, 0.1885f, 0.9876f, 1.0f,
+ -0.9236f, 0.0f, 0.1827f, 0.9983f, 1.0f,
+ -0.9103f, 0.0f, 0.1752f, 0.999f, 1.0f,
+ -0.8978f, 0.0f, 0.1662f, 0.9912f, 1.0f,
+ -0.8862f, 0.0f, 0.1558f, 0.9724f, 1.0f,
+ -0.8756f, 0.0f, 0.1441f, 0.9385f, 1.0f,
+ -0.866f, 0.0f, 0.1314f, 0.8841f, 1.0f,
+ -0.8575f, 0.0f, 0.1179f, 0.7979f, 1.0f,
+ -0.8501f, 0.0f, 0.1036f, 0.6541f, 1.0f,
+ -0.8441f, 0.0f, 0.0889f, 0.36f, 1.0f,
+ -0.8416f, 0.0f, 0.0813f, 0.1f, 1.0f,
};
static const float data26[18 * GP_PRIM_DATABUF_SIZE] = {
-0.9747f, -0.0f, 0.1745f, 0.1f, 1.0f,0.9706f, -0.0f, 0.177f, 0.2199f, 1.0f,0.954f, -0.0f, 0.1852f, 0.6019f, 1.0f,0.9377f, -0.0f, 0.1907f, 0.7689f, 1.0f,
-0.9216f, -0.0f, 0.1936f, 0.866f, 1.0f,0.906f, -0.0f, 0.1941f, 0.9272f, 1.0f,0.8908f, -0.0f, 0.1923f, 0.9653f, 1.0f,0.8762f, -0.0f, 0.1885f, 0.9876f, 1.0f,
-0.8622f, -0.0f, 0.1827f, 0.9983f, 1.0f,0.849f, -0.0f, 0.1752f, 0.999f, 1.0f,0.8365f, -0.0f, 0.1662f, 0.9912f, 1.0f,0.8249f, -0.0f, 0.1558f, 0.9724f, 1.0f,
-0.8143f, -0.0f, 0.1441f, 0.9385f, 1.0f,0.8046f, -0.0f, 0.1314f, 0.8841f, 1.0f,0.7961f, -0.0f, 0.1179f, 0.7979f, 1.0f,0.7888f, -0.0f, 0.1036f, 0.6541f, 1.0f,
-0.7828f, -0.0f, 0.0889f, 0.36f, 1.0f,0.7802f, -0.0f, 0.0813f, 0.1f, 1.0f
+ 0.9747f, 0.0f, 0.1745f, 0.1f, 1.0f,
+ 0.9706f, 0.0f, 0.177f, 0.2199f, 1.0f,
+ 0.954f, 0.0f, 0.1852f, 0.6019f, 1.0f,
+ 0.9377f, 0.0f, 0.1907f, 0.7689f, 1.0f,
+ 0.9216f, 0.0f, 0.1936f, 0.866f, 1.0f,
+ 0.906f, 0.0f, 0.1941f, 0.9272f, 1.0f,
+ 0.8908f, 0.0f, 0.1923f, 0.9653f, 1.0f,
+ 0.8762f, 0.0f, 0.1885f, 0.9876f, 1.0f,
+ 0.8622f, 0.0f, 0.1827f, 0.9983f, 1.0f,
+ 0.849f, 0.0f, 0.1752f, 0.999f, 1.0f,
+ 0.8365f, 0.0f, 0.1662f, 0.9912f, 1.0f,
+ 0.8249f, 0.0f, 0.1558f, 0.9724f, 1.0f,
+ 0.8143f, 0.0f, 0.1441f, 0.9385f, 1.0f,
+ 0.8046f, 0.0f, 0.1314f, 0.8841f, 1.0f,
+ 0.7961f, 0.0f, 0.1179f, 0.7979f, 1.0f,
+ 0.7888f, 0.0f, 0.1036f, 0.6541f, 1.0f,
+ 0.7828f, 0.0f, 0.0889f, 0.36f, 1.0f,
+ 0.7802f, 0.0f, 0.0813f, 0.1f, 1.0f,
};
static const float data27[33 * GP_PRIM_DATABUF_SIZE] = {
--0.186f, -0.0f, 0.0983f, 0.1f, 1.0f,-0.1954f, -0.0f, 0.0774f, 0.2199f, 1.0f,-0.2191f, -0.0f, 0.0407f, 0.4615f, 1.0f,-0.2434f, -0.0f, 0.0158f, 0.6019f, 1.0f,
--0.2723f, -0.0f, -0.0047f, 0.6981f, 1.0f,-0.3017f, -0.0f, -0.0179f, 0.7689f, 1.0f,-0.3302f, -0.0f, -0.0247f, 0.8236f, 1.0f,-0.3576f, -0.0f, -0.0262f, 0.866f, 1.0f,
--0.3837f, -0.0f, -0.0231f, 0.9003f, 1.0f,-0.4085f, -0.0f, -0.0159f, 0.9272f, 1.0f,-0.4317f, -0.0f, -0.0049f, 0.9485f, 1.0f,-0.4533f, 0.0f, 0.0099f, 0.9653f, 1.0f,
--0.4734f, 0.0f, 0.0289f, 0.9781f, 1.0f,-0.4916f, 0.0f, 0.0524f, 0.9876f, 1.0f,-0.507f, 0.0f, 0.0806f, 0.9942f, 1.0f,-0.5185f, 0.0f, 0.1134f, 0.9983f, 1.0f,
--0.5247f, 0.0f, 0.1498f, 0.9997f, 1.0f,-0.5246f, 0.0f, 0.1884f, 0.999f, 1.0f,-0.5175f, -0.0f, 0.2267f, 0.9963f, 1.0f,-0.5043f, -0.0f, 0.2616f, 0.9912f, 1.0f,
--0.4864f, -0.0f, 0.2916f, 0.9834f, 1.0f,-0.4653f, -0.0f, 0.3159f, 0.9724f, 1.0f,-0.4422f, -0.0f, 0.3349f, 0.9576f, 1.0f,-0.4177f, -0.0f, 0.3489f, 0.9385f, 1.0f,
--0.3921f, -0.0f, 0.3582f, 0.9143f, 1.0f,-0.3661f, -0.0f, 0.3628f, 0.8841f, 1.0f,-0.3392f, -0.0f, 0.363f, 0.8461f, 1.0f,-0.3123f, -0.0f, 0.3586f, 0.7979f, 1.0f,
--0.2853f, -0.0f, 0.3491f, 0.7359f, 1.0f,-0.2591f, -0.0f, 0.3344f, 0.6541f, 1.0f,-0.2339f, -0.0f, 0.3137f, 0.5396f, 1.0f,-0.2118f, -0.0f, 0.2882f, 0.36f, 1.0f,
--0.1906f, -0.0f, 0.2516f, 0.1f, 1.0f
+ -0.186f, 0.0f, 0.0983f, 0.1f, 1.0f,
+ -0.1954f, 0.0f, 0.0774f, 0.2199f, 1.0f,
+ -0.2191f, 0.0f, 0.0407f, 0.4615f, 1.0f,
+ -0.2434f, 0.0f, 0.0158f, 0.6019f, 1.0f,
+ -0.2723f, 0.0f, -0.0047f, 0.6981f, 1.0f,
+ -0.3017f, 0.0f, -0.0179f, 0.7689f, 1.0f,
+ -0.3302f, 0.0f, -0.0247f, 0.8236f, 1.0f,
+ -0.3576f, 0.0f, -0.0262f, 0.866f, 1.0f,
+ -0.3837f, 0.0f, -0.0231f, 0.9003f, 1.0f,
+ -0.4085f, 0.0f, -0.0159f, 0.9272f, 1.0f,
+ -0.4317f, 0.0f, -0.0049f, 0.9485f, 1.0f,
+ -0.4533f, 0.0f, 0.0099f, 0.9653f, 1.0f,
+ -0.4734f, 0.0f, 0.0289f, 0.9781f, 1.0f,
+ -0.4916f, 0.0f, 0.0524f, 0.9876f, 1.0f,
+ -0.507f, 0.0f, 0.0806f, 0.9942f, 1.0f,
+ -0.5185f, 0.0f, 0.1134f, 0.9983f, 1.0f,
+ -0.5247f, 0.0f, 0.1498f, 0.9997f, 1.0f,
+ -0.5246f, 0.0f, 0.1884f, 0.999f, 1.0f,
+ -0.5175f, 0.0f, 0.2267f, 0.9963f, 1.0f,
+ -0.5043f, 0.0f, 0.2616f, 0.9912f, 1.0f,
+ -0.4864f, 0.0f, 0.2916f, 0.9834f, 1.0f,
+ -0.4653f, 0.0f, 0.3159f, 0.9724f, 1.0f,
+ -0.4422f, 0.0f, 0.3349f, 0.9576f, 1.0f,
+ -0.4177f, 0.0f, 0.3489f, 0.9385f, 1.0f,
+ -0.3921f, 0.0f, 0.3582f, 0.9143f, 1.0f,
+ -0.3661f, 0.0f, 0.3628f, 0.8841f, 1.0f,
+ -0.3392f, 0.0f, 0.363f, 0.8461f, 1.0f,
+ -0.3123f, 0.0f, 0.3586f, 0.7979f, 1.0f,
+ -0.2853f, 0.0f, 0.3491f, 0.7359f, 1.0f,
+ -0.2591f, 0.0f, 0.3344f, 0.6541f, 1.0f,
+ -0.2339f, 0.0f, 0.3137f, 0.5396f, 1.0f,
+ -0.2118f, 0.0f, 0.2882f, 0.36f, 1.0f,
+ -0.1906f, 0.0f, 0.2516f, 0.1f, 1.0f,
};
@@ -504,31 +1396,31 @@ static const ColorTemplate gp_monkey_pct_black = {
static const ColorTemplate gp_monkey_pct_skin = {
"Skin",
{0.733f, 0.569f, 0.361f, 1.0f},
- {0.745f, 0.502f, 0.278f, 1.0f}
+ {0.745f, 0.502f, 0.278f, 1.0f},
};
static const ColorTemplate gp_monkey_pct_skin_light = {
"Skin_Light",
{0.914f, 0.827f, 0.635f, 1.0f},
- {0.913f, 0.828f, 0.637f, 0.0f}
+ {0.913f, 0.828f, 0.637f, 0.0f},
};
static const ColorTemplate gp_monkey_pct_skin_shadow = {
"Skin_Shadow",
{0.322f, 0.29f, 0.224f, 0.5f},
- {0.32f, 0.29f, 0.223f, 0.3f}
+ {0.32f, 0.29f, 0.223f, 0.3f},
};
static const ColorTemplate gp_monkey_pct_eyes = {
"Eyes",
{0.553f, 0.39f, 0.266f, 0.0f},
- {0.847f, 0.723f, 0.599f, 1.0f}
+ {0.847f, 0.723f, 0.599f, 1.0f},
};
static const ColorTemplate gp_monkey_pct_pupils = {
"Pupils",
{0.0f, 0.0f, 0.0f, 0.0f},
- {0.0f, 0.0f, 0.0f, 1.0f}
+ {0.0f, 0.0f, 0.0f, 1.0f},
};
/* ***************************************************************** */
diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c b/source/blender/editors/gpencil/gpencil_add_stroke.c
index 6df3638d859..e02fc4bf801 100644
--- a/source/blender/editors/gpencil/gpencil_add_stroke.c
+++ b/source/blender/editors/gpencil/gpencil_add_stroke.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,12 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez, Matias Mendiola
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_add_stroke.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -73,6 +66,10 @@ static int gp_stroke_material(Main *bmain, Object *ob, const ColorTemplate *pct)
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
copy_v4_v4(ma->gp_style->fill_rgba, pct->fill);
+ if (pct->fill) {
+ ma->gp_style->flag |= GP_STYLE_FILL_SHOW;
+ }
+
return BKE_gpencil_get_material_index(ob, ma) - 1;
}
diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c
index 21715d7ba93..97f5db96a89 100644
--- a/source/blender/editors/gpencil/gpencil_armature.c
+++ b/source/blender/editors/gpencil/gpencil_armature.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for dealing with armatures and GP datablocks
*/
-/** \file blender/editors/gpencil/gpencil_armature.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -40,9 +33,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
#include "BLI_math.h"
-#include "BLI_string_utils.h"
#include "BLT_translation.h"
@@ -79,7 +70,7 @@
enum {
GP_ARMATURE_NAME = 0,
- GP_ARMATURE_AUTO = 1
+ GP_ARMATURE_AUTO = 1,
};
#define DEFAULT_RATIO 0.10f
@@ -655,7 +646,7 @@ void GPENCIL_OT_generate_weights(wmOperatorType *ot)
static const EnumPropertyItem mode_type[] = {
{GP_ARMATURE_NAME, "NAME", 0, "Empty Groups", ""},
{GP_ARMATURE_AUTO, "AUTO", 0, "Automatic Weights", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 412330ccf5c..ee1838af22a 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2015, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Brush based operators for editing Grease Pencil strokes
*/
-/** \file blender/editors/gpencil/gpencil_brush.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -63,7 +56,6 @@
#include "BKE_material.h"
#include "BKE_object_deform.h"
#include "BKE_report.h"
-#include "BKE_screen.h"
#include "UI_interface.h"
@@ -707,7 +699,8 @@ static bool gp_brush_twist_apply(
axis_angle_normalized_to_mat3(rmat, axis, angle);
/* Rotate point (no matrix-space transforms needed, as GP points are in world space) */
- sub_v3_v3v3(vec, &pt->x, gso->dvec); /* make relative to center (center is stored in dvec) */
+ sub_v3_v3v3(vec, &pt->x, gso->dvec); /* make relative to center
+ * (center is stored in dvec) */
mul_m3_v3(rmat, vec);
add_v3_v3v3(&pt->x, vec, gso->dvec); /* restore */
@@ -1252,9 +1245,8 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
gso->is_multiframe = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gso->gpd);
gso->use_multiframe_falloff = (ts->gp_sculpt.flag & GP_SCULPT_SETT_FLAG_FRAME_FALLOFF) != 0;
- /* init multiedit falloff curve data before doing anything,
- * so we won't have to do it again later
- */
+ /* Init multi-edit falloff curve data before doing anything,
+ * so we won't have to do it again later. */
if (gso->is_multiframe) {
curvemapping_initialize(ts->gp_sculpt.cur_falloff);
}
diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c
index cb3fcba45e1..af2c68d6c68 100644
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- * Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operator for converting Grease Pencil data to geometry
*/
-/** \file blender/editors/gpencil/gpencil_convert.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -68,7 +60,6 @@
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"
-#include "BKE_screen.h"
#include "BKE_tracking.h"
#include "DEG_depsgraph.h"
@@ -115,7 +106,7 @@ static const EnumPropertyItem prop_gpencil_convertmodes[] = {
{GP_STROKECONVERT_PATH, "PATH", ICON_CURVE_PATH, "Path", "Animation path"},
{GP_STROKECONVERT_CURVE, "CURVE", ICON_CURVE_BEZCURVE, "Bezier Curve", "Smooth Bezier curve"},
{GP_STROKECONVERT_POLY, "POLY", ICON_MESH_DATA, "Polygon Curve", "Bezier curve with straight-line segments (vector handles)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_gpencil_convert_timingmodes_restricted[] = {
@@ -1129,7 +1120,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
if (rv3d->persp == RV3D_CAMOB) {
Scene *scene = CTX_data_scene(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, subrect, true); /* no shift */
+ ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, subrect, true);
return 1;
}
}
@@ -1137,7 +1128,8 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
return 0;
}
-/* convert a given grease-pencil layer to a 3d-curve representation (using current view if appropriate) */
+/* convert a given grease-pencil layer to a 3d-curve representation
+ * (using current view if appropriate) */
static void gp_layer_to_curve(
bContext *C, ReportList *reports, bGPdata *gpd, bGPDlayer *gpl, const int mode,
const bool norm_weights, const float rad_fac, const bool link_strokes, tGpTimingData *gtd)
@@ -1190,7 +1182,8 @@ static void gp_layer_to_curve(
const bool add_start_point = (link_strokes && !(prev_gps));
const bool add_end_point = (link_strokes && !(gps->next));
- /* Detect new strokes created because of GP_STROKE_BUFFER_MAX reached, and stitch them to previous one. */
+ /* Detect new strokes created because of GP_STROKE_BUFFER_MAX reached,
+ * and stitch them to previous one. */
bool stitch = false;
if (prev_gps) {
bGPDspoint *pt1 = &prev_gps->points[prev_gps->totpoints - 1];
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 8afb0cafeb9..cfcfc49b081 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,18 +13,13 @@
* 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) 2008, Blender Foundation, Joshua Leung
+ * The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for dealing with GP datablocks and layers
*/
-/** \file blender/editors/gpencil/gpencil_data.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -62,7 +55,6 @@
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_fcurve.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_library.h"
@@ -73,7 +65,6 @@
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_scene.h"
-#include "BKE_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -112,7 +103,8 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)
}
else {
/* decrement user count and add new datablock */
- /* TODO: if a datablock exists, we should make a copy of it instead of starting fresh (as in other areas) */
+ /* TODO: if a datablock exists,
+ * we should make a copy of it instead of starting fresh (as in other areas) */
Main *bmain = CTX_data_main(C);
/* decrement user count of old GP datablock */
@@ -334,7 +326,7 @@ void GPENCIL_OT_layer_remove(wmOperatorType *ot)
enum {
GP_LAYER_MOVE_UP = -1,
- GP_LAYER_MOVE_DOWN = 1
+ GP_LAYER_MOVE_DOWN = 1,
};
static int gp_layer_move_exec(bContext *C, wmOperator *op)
@@ -362,7 +354,7 @@ void GPENCIL_OT_layer_move(wmOperatorType *ot)
static const EnumPropertyItem slot_move[] = {
{GP_LAYER_MOVE_UP, "UP", 0, "Up", ""},
{GP_LAYER_MOVE_DOWN, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -425,7 +417,7 @@ void GPENCIL_OT_layer_duplicate(wmOperatorType *ot)
/* ********************* Duplicate Layer in a new object ************************** */
enum {
GP_LAYER_COPY_OBJECT_ALL_FRAME = 0,
- GP_LAYER_COPY_OBJECT_ACT_FRAME = 1
+ GP_LAYER_COPY_OBJECT_ACT_FRAME = 1,
};
static bool gp_layer_duplicate_object_poll(bContext *C)
@@ -538,7 +530,7 @@ void GPENCIL_OT_layer_duplicate_object(wmOperatorType *ot)
static const EnumPropertyItem copy_mode[] = {
{GP_LAYER_COPY_OBJECT_ALL_FRAME, "ALL", 0, "All Frames", ""},
{GP_LAYER_COPY_OBJECT_ACT_FRAME, "ACTIVE", 0, "Active Frame", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -562,7 +554,7 @@ void GPENCIL_OT_layer_duplicate_object(wmOperatorType *ot)
/* ********************* Duplicate Frame ************************** */
enum {
GP_FRAME_DUP_ACTIVE = 0,
- GP_FRAME_DUP_ALL = 1
+ GP_FRAME_DUP_ALL = 1,
};
static int gp_frame_duplicate_exec(bContext *C, wmOperator *op)
@@ -601,7 +593,7 @@ void GPENCIL_OT_frame_duplicate(wmOperatorType *ot)
static const EnumPropertyItem duplicate_mode[] = {
{GP_FRAME_DUP_ACTIVE, "ACTIVE", 0, "Active", "Duplicate frame in active layer only"},
{GP_FRAME_DUP_ALL, "ALL", 0, "All", "Duplicate active frames in all layers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -622,7 +614,7 @@ void GPENCIL_OT_frame_duplicate(wmOperatorType *ot)
/* ********************* Clean Fill Boundaries on Frame ************************** */
enum {
GP_FRAME_CLEAN_FILL_ACTIVE = 0,
- GP_FRAME_CLEAN_FILL_ALL = 1
+ GP_FRAME_CLEAN_FILL_ALL = 1,
};
static int gp_frame_clean_fill_exec(bContext *C, wmOperator *op)
@@ -688,7 +680,7 @@ void GPENCIL_OT_frame_clean_fill(wmOperatorType *ot)
static const EnumPropertyItem duplicate_mode[] = {
{GP_FRAME_CLEAN_FILL_ACTIVE, "ACTIVE", 0, "Active Frame Only", "Clean active frame only"},
{GP_FRAME_CLEAN_FILL_ALL, "ALL", 0, "All Frames", "Clean all frames in all layers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1217,7 +1209,7 @@ enum {
GP_STROKE_MOVE_UP = -1,
GP_STROKE_MOVE_DOWN = 1,
GP_STROKE_MOVE_TOP = 2,
- GP_STROKE_MOVE_BOTTOM = 3
+ GP_STROKE_MOVE_BOTTOM = 3,
};
static int gp_stroke_arrange_exec(bContext *C, wmOperator *op)
@@ -1796,6 +1788,10 @@ static int gpencil_vertex_group_smooth_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
{
+ if (gps->dvert == NULL) {
+ continue;
+ }
+
for (int s = 0; s < repeat; s++) {
for (int i = 0; i < gps->totpoints; i++) {
/* previous point */
@@ -1830,6 +1826,7 @@ static int gpencil_vertex_group_smooth_exec(bContext *C, wmOperator *op)
MDeformWeight *dw = defvert_verify_index(dvertb, def_nr);
if (dw) {
dw->weight = interpf(wb, optimal, fac);
+ CLAMP(dw->weight, 0.0, 1.0f);
}
}
}
@@ -1887,7 +1884,8 @@ static void joined_gpencil_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data)
const char *old_name = BLI_ghashIterator_getKey(&gh_iter);
const char *new_name = BLI_ghashIterator_getValue(&gh_iter);
- /* only remap if changed; this still means there will be some waste if there aren't many drivers/keys */
+ /* only remap if changed;
+ * this still means there will be some waste if there aren't many drivers/keys */
if (!STREQ(old_name, new_name) && strstr(fcu->rna_path, old_name)) {
fcu->rna_path = BKE_animsys_fix_rna_path_rename(
id, fcu->rna_path, "layers",
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index a6ebc81c178..088282c0f02 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,20 +13,14 @@
* 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) 2008, Blender Foundation, Joshua Leung
+ * The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for editing Grease Pencil strokes
*/
- /** \file blender/editors/gpencil/gpencil_edit.c
- * \ingroup edgpencil
- */
-
+/** \file
+ * \ingroup edgpencil
+ */
#include <stdio.h>
#include <string.h>
@@ -40,9 +32,9 @@
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
+#include "BLI_lasso_2d.h"
#include "BLI_math.h"
#include "BLI_string.h"
-#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
@@ -65,7 +57,6 @@
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_report.h"
-#include "BKE_screen.h"
#include "BKE_workspace.h"
#include "UI_interface.h"
@@ -86,6 +77,7 @@
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_view3d.h"
+#include "ED_select_utils.h"
#include "ED_space_api.h"
#include "DEG_depsgraph.h"
@@ -260,7 +252,7 @@ void GPENCIL_OT_selectmode_toggle(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER;
/* properties */
- prop = RNA_def_int(ot->srna, "mode", 0, 0, 1, "Select mode", "Select mode", 0, 1);
+ prop = RNA_def_int(ot->srna, "mode", 0, 0, 2, "Select mode", "Select mode", 0, 2);
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
@@ -627,7 +619,9 @@ static void gp_duplicate_points(const bGPDstroke *gps, ListBase *new_strokes, co
/* make a stupid copy first of the entire stroke (to get the flags too) */
gpsd = MEM_dupallocN(gps);
- BLI_strncpy(gpsd->runtime.tmp_layerinfo, layername, sizeof(gpsd->runtime.tmp_layerinfo)); /* saves original layer name */
+
+ /* saves original layer name */
+ BLI_strncpy(gpsd->runtime.tmp_layerinfo, layername, sizeof(gpsd->runtime.tmp_layerinfo));
/* initialize triangle memory - will be calculated on next redraw */
gpsd->triangles = NULL;
@@ -760,6 +754,220 @@ void GPENCIL_OT_duplicate(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/* ************** Extrude Selected Strokes **************** */
+
+/* helper to copy a point to temp area */
+static void copy_point(
+ bGPDstroke *gps,
+ bGPDspoint *temp_points,
+ MDeformVert *temp_dverts,
+ int from_idx, int to_idx)
+{
+ bGPDspoint *pt = &temp_points[from_idx];
+ bGPDspoint *pt_final = &gps->points[to_idx];
+
+ copy_v3_v3(&pt_final->x, &pt->x);
+ pt_final->pressure = pt->pressure;
+ pt_final->strength = pt->strength;
+ pt_final->time = pt->time;
+ pt_final->flag = pt->flag;
+ pt_final->uv_fac = pt->uv_fac;
+ pt_final->uv_rot = pt->uv_rot;
+
+ if (gps->dvert != NULL) {
+ MDeformVert *dvert = &temp_dverts[from_idx];
+ MDeformVert *dvert_final = &gps->dvert[to_idx];
+
+ dvert_final->totweight = dvert->totweight;
+ dvert_final->dw = dvert->dw;
+ }
+}
+
+static void gpencil_add_move_points(bGPDframe *gpf, bGPDstroke *gps)
+{
+ bGPDspoint *temp_points = NULL;
+ MDeformVert *temp_dverts = NULL;
+ bGPDspoint *pt = NULL;
+ const bGPDspoint *pt_start = &gps->points[0];
+ const bGPDspoint *pt_last = &gps->points[gps->totpoints - 1];
+ const bool do_first = (pt_start->flag & GP_SPOINT_SELECT);
+ const bool do_last = ((pt_last->flag & GP_SPOINT_SELECT) && (pt_start != pt_last));
+ const bool do_stroke = (do_first || do_last);
+
+ /* review points in the midle of stroke to create new strokes */
+ for (int i = 0; i < gps->totpoints; i++) {
+ /* skip first and last point */
+ if ((i == 0) || (i == gps->totpoints - 1)) {
+ continue;
+ }
+
+ pt = &gps->points[i];
+ if (pt->flag == GP_SPOINT_SELECT) {
+ /* duplicate original stroke data */
+ bGPDstroke *gps_new = MEM_dupallocN(gps);
+ gps_new->prev = gps_new->next = NULL;
+
+ /* add new points array */
+ gps_new->totpoints = 1;
+ gps_new->points = MEM_callocN(sizeof(bGPDspoint), __func__);
+ gps_new->dvert = NULL;
+
+ if (gps->dvert != NULL) {
+ gps_new->dvert = MEM_callocN(sizeof(MDeformVert), __func__);
+ }
+
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
+ gps_new->triangles = NULL;
+ gps_new->tot_triangles = 0;
+ BLI_insertlinkafter(&gpf->strokes, gps, gps_new);
+
+ /* copy selected point data to new stroke */
+ copy_point(gps_new, gps->points, gps->dvert, i, 0);
+
+ /* deselect orinal point */
+ pt->flag &= ~GP_SPOINT_SELECT;
+ }
+ }
+
+ /* review first and last point to reuse same stroke */
+ int i2 = 0;
+ int totnewpoints, oldtotpoints;
+ /* if first or last, reuse stroke and resize */
+ if ((do_first) || (do_last)) {
+ totnewpoints = gps->totpoints;
+ if (do_first) {
+ totnewpoints++;
+ }
+ if (do_last) {
+ totnewpoints++;
+ }
+
+ /* duplicate points in a temp area */
+ temp_points = MEM_dupallocN(gps->points);
+ oldtotpoints = gps->totpoints;
+ if (gps->dvert != NULL) {
+ temp_dverts = MEM_dupallocN(gps->dvert);
+ }
+
+ /* if first point, need move all one position */
+ if (do_first) {
+ i2 = 1;
+ }
+
+ /* resize the points arrays */
+ gps->totpoints = totnewpoints;
+ gps->points = MEM_recallocN(gps->points, sizeof(*gps->points) * gps->totpoints);
+ if (gps->dvert != NULL) {
+ gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * gps->totpoints);
+ }
+
+ /* move points to new position */
+ for (int i = 0; i < oldtotpoints; i++) {
+ copy_point(gps, temp_points, temp_dverts, i, i2);
+ i2++;
+ }
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
+
+ /* if first point, add new point at the begining */
+ if (do_first) {
+ copy_point(gps, temp_points, temp_dverts, 0, 0);
+ /* deselect old */
+ pt = &gps->points[1];
+ pt->flag &= ~GP_SPOINT_SELECT;
+ /* select new */
+ pt = &gps->points[0];
+ pt->flag |= GP_SPOINT_SELECT;
+ }
+
+ /* if last point, add new point at the end */
+ if (do_last) {
+ copy_point(gps, temp_points, temp_dverts,
+ oldtotpoints - 1, gps->totpoints - 1);
+
+ /* deselect old */
+ pt = &gps->points[gps->totpoints - 2];
+ pt->flag &= ~GP_SPOINT_SELECT;
+ /* select new */
+ pt = &gps->points[gps->totpoints - 1];
+ pt->flag |= GP_SPOINT_SELECT;
+ }
+
+ MEM_SAFE_FREE(temp_points);
+ MEM_SAFE_FREE(temp_dverts);
+ }
+
+ /* if the stroke is not reused, deselect */
+ if (!do_stroke) {
+ gps->flag &= ~GP_STROKE_SELECT;
+ }
+}
+
+static int gp_extrude_exec(bContext *C, wmOperator *op)
+{
+ Object *obact = CTX_data_active_object(C);
+ bGPdata *gpd = (bGPdata *)obact->data;
+ const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
+ bGPDstroke *gps = NULL;
+
+ if (gpd == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
+ return OPERATOR_CANCELLED;
+ }
+
+ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
+ {
+ bGPDframe *init_gpf = gpl->actframe;
+ if (is_multiedit) {
+ init_gpf = gpl->frames.first;
+ }
+
+ for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
+ if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
+ if (gpf == NULL)
+ continue;
+
+ for (gps = gpf->strokes.first; gps; gps = gps->next) {
+ /* skip strokes that are invalid for current view */
+ if (ED_gpencil_stroke_can_use(C, gps) == false)
+ continue;
+
+ if (gps->flag & GP_STROKE_SELECT) {
+ gpencil_add_move_points(gpf, gps);
+ }
+ }
+ /* if not multiedit, exit loop*/
+ if (!is_multiedit) {
+ break;
+ }
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ /* updates */
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
+ DEG_id_tag_update(&obact->id, ID_RECALC_COPY_ON_WRITE);
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_extrude(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Extrude Stroke Points";
+ ot->idname = "GPENCIL_OT_extrude";
+ ot->description = "Extrude the selected Grease Pencil points";
+
+ /* callbacks */
+ ot->exec = gp_extrude_exec;
+ ot->poll = gp_stroke_edit_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+
/* ******************* Copy/Paste Strokes ************************* */
/* Grease Pencil stroke data copy/paste buffer:
* - The copy operation collects all segments of selected strokes,
@@ -784,7 +992,7 @@ static GHash *gp_strokes_copypastebuf_colors_material_to_name_create(Main *bmain
{
GHash *ma_to_name = BLI_ghash_ptr_new(__func__);
- for (Material *ma = bmain->mat.first; ma != NULL; ma = ma->id.next) {
+ for (Material *ma = bmain->materials.first; ma != NULL; ma = ma->id.next) {
char *name = BKE_id_to_unique_string_key(&ma->id);
BLI_ghash_insert(ma_to_name, ma, name);
}
@@ -801,7 +1009,7 @@ static GHash *gp_strokes_copypastebuf_colors_name_to_material_create(Main *bmain
{
GHash *name_to_ma = BLI_ghash_str_new(__func__);
- for (Material *ma = bmain->mat.first; ma != NULL; ma = ma->id.next) {
+ for (Material *ma = bmain->materials.first; ma != NULL; ma = ma->id.next) {
char *name = BKE_id_to_unique_string_key(&ma->id);
BLI_ghash_insert(name_to_ma, name, ma);
}
@@ -928,7 +1136,8 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op)
/* make direct copies of the stroke and its points */
gpsd = MEM_dupallocN(gps);
- BLI_strncpy(gpsd->runtime.tmp_layerinfo, gpl->info, sizeof(gpsd->runtime.tmp_layerinfo)); /* saves original layer name */
+ /* saves original layer name */
+ BLI_strncpy(gpsd->runtime.tmp_layerinfo, gpl->info, sizeof(gpsd->runtime.tmp_layerinfo));
gpsd->points = MEM_dupallocN(gps->points);
if (gps->dvert != NULL) {
gpsd->dvert = MEM_dupallocN(gps->dvert);
@@ -1007,7 +1216,7 @@ static bool gp_strokes_paste_poll(bContext *C)
typedef enum eGP_PasteMode {
GP_COPY_ONLY = -1,
- GP_COPY_MERGE = 1
+ GP_COPY_MERGE = 1,
} eGP_PasteMode;
static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
@@ -1148,7 +1357,7 @@ void GPENCIL_OT_paste(wmOperatorType *ot)
static const EnumPropertyItem copy_type[] = {
{GP_COPY_ONLY, "COPY", 0, "Copy", ""},
{GP_COPY_MERGE, "MERGE", 0, "Merge", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1192,12 +1401,18 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
bGPDlayer *target_layer = NULL;
ListBase strokes = {NULL, NULL};
int layer_num = RNA_enum_get(op->ptr, "layer");
+ const bool use_autolock = (bool)(gpd->flag & GP_DATA_AUTOLOCK_LAYERS);
if (GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)) {
BKE_report(op->reports, RPT_ERROR, "Operator not supported in multiframe edition");
return OPERATOR_CANCELLED;
}
+ /* if autolock enabled, disabled now */
+ if (use_autolock) {
+ gpd->flag &= ~GP_DATA_AUTOLOCK_LAYERS;
+ }
+
/* Get layer or create new one */
if (layer_num == -1) {
/* Create layer */
@@ -1208,6 +1423,10 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
target_layer = BLI_findlink(&gpd->layers, layer_num);
if (target_layer == NULL) {
+ /* back autolock status */
+ if (use_autolock) {
+ gpd->flag |= GP_DATA_AUTOLOCK_LAYERS;
+ }
BKE_reportf(op->reports, RPT_ERROR, "There is no layer number %d", layer_num);
return OPERATOR_CANCELLED;
}
@@ -1240,6 +1459,11 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
BLI_addtail(&strokes, gps);
}
}
+
+ /* if new layer and autolock, lock old layer */
+ if ((layer_num == -1) && (use_autolock)) {
+ gpl->flag |= GP_LAYER_LOCKED;
+ }
}
CTX_DATA_END;
@@ -1251,6 +1475,11 @@ static int gp_move_to_layer_exec(bContext *C, wmOperator *op)
BLI_assert((strokes.first == strokes.last) && (strokes.first == NULL));
}
+ /* back autolock status */
+ if (use_autolock) {
+ gpd->flag |= GP_DATA_AUTOLOCK_LAYERS;
+ }
+
/* updates */
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
@@ -1816,6 +2045,89 @@ typedef struct tGPDeleteIsland {
int end_idx;
} tGPDeleteIsland;
+static void gp_stroke_join_islands(bGPDframe *gpf, bGPDstroke *gps_first, bGPDstroke *gps_last)
+{
+ bGPDspoint *pt = NULL;
+ bGPDspoint *pt_final = NULL;
+ const int totpoints = gps_first->totpoints + gps_last->totpoints;
+
+ /* create new stroke */
+ bGPDstroke *join_stroke = MEM_dupallocN(gps_first);
+
+ join_stroke->points = MEM_callocN(sizeof(bGPDspoint) * totpoints, __func__);
+ join_stroke->totpoints = totpoints;
+ join_stroke->flag &= ~GP_STROKE_CYCLIC;
+
+ /* copy points (last before) */
+ int e1 = 0;
+ int e2 = 0;
+ float delta = 0.0f;
+
+ for (int i = 0; i < totpoints; i++) {
+ pt_final = &join_stroke->points[i];
+ if (i < gps_last->totpoints) {
+ pt = &gps_last->points[e1];
+ e1++;
+ }
+ else {
+ pt = &gps_first->points[e2];
+ e2++;
+ }
+
+ /* copy current point */
+ copy_v3_v3(&pt_final->x, &pt->x);
+ pt_final->pressure = pt->pressure;
+ pt_final->strength = pt->strength;
+ pt_final->time = delta;
+ pt_final->flag = pt->flag;
+
+ /* retiming with fixed time interval (we cannot determine real time) */
+ delta += 0.01f;
+ }
+
+ /* Copy over vertex weight data (if available) */
+ if ((gps_first->dvert != NULL) || (gps_last->dvert != NULL)) {
+ join_stroke->dvert = MEM_callocN(sizeof(MDeformVert) * totpoints, __func__);
+ MDeformVert *dvert_src = NULL;
+ MDeformVert *dvert_dst = NULL;
+
+ /* Copy weights (last before)*/
+ e1 = 0;
+ e2 = 0;
+ for (int i = 0; i < totpoints; i++) {
+ dvert_dst = &join_stroke->dvert[i];
+ dvert_src = NULL;
+ if (i < gps_last->totpoints) {
+ if (gps_last->dvert) {
+ dvert_src = &gps_last->dvert[e1];
+ e1++;
+ }
+ }
+ else {
+ if (gps_first->dvert) {
+ dvert_src = &gps_first->dvert[e2];
+ e2++;
+ }
+ }
+
+ if ((dvert_src) && (dvert_src->dw)) {
+ dvert_dst->dw = MEM_dupallocN(dvert_src->dw);
+ }
+ }
+ }
+
+ /* add new stroke at head */
+ BLI_addhead(&gpf->strokes, join_stroke);
+
+ /* remove first stroke */
+ BLI_remlink(&gpf->strokes, gps_first);
+ BKE_gpencil_free_stroke(gps_first);
+
+ /* remove last stroke */
+ BLI_remlink(&gpf->strokes, gps_last);
+ BKE_gpencil_free_stroke(gps_last);
+}
+
/* Split the given stroke into several new strokes, partitioning
* it based on whether the stroke points have a particular flag
@@ -1829,14 +2141,17 @@ typedef struct tGPDeleteIsland {
* - Once we start having larger islands than that, the number required
* becomes much less
* 2) Each island gets converted to a new stroke
+ * If the number of points is <= limit, the stroke is deleted
*/
void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke,
- int tag_flags, bool select)
+ int tag_flags, bool select, int limit)
{
tGPDeleteIsland *islands = MEM_callocN(sizeof(tGPDeleteIsland) * (gps->totpoints + 1) / 2, "gp_point_islands");
bool in_island = false;
int num_islands = 0;
+ bGPDstroke *gps_first = NULL;
+ const bool is_cyclic = (bool)(gps->flag & GP_STROKE_CYCLIC);
/* First Pass: Identify start/end of islands */
bGPDspoint *pt = gps->points;
@@ -1869,15 +2184,22 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
if (num_islands) {
/* there are islands, so create a series of new strokes, adding them before the "next" stroke */
int idx;
+ bGPDstroke *new_stroke = NULL;
/* Create each new stroke... */
for (idx = 0; idx < num_islands; idx++) {
tGPDeleteIsland *island = &islands[idx];
- bGPDstroke *new_stroke = MEM_dupallocN(gps);
+ new_stroke = MEM_dupallocN(gps);
+
+ /* if cyclic and first stroke, save to join later */
+ if ((is_cyclic) && (gps_first == NULL)) {
+ gps_first = new_stroke;
+ }
/* initialize triangle memory - to be calculated on next redraw */
new_stroke->triangles = NULL;
new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
+ new_stroke->flag &= ~GP_STROKE_CYCLIC;
new_stroke->tot_triangles = 0;
/* Compute new buffer size (+ 1 needed as the endpoint index is "inclusive") */
@@ -1888,7 +2210,7 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
memcpy(new_stroke->points, gps->points + island->start_idx, sizeof(bGPDspoint) * new_stroke->totpoints);
/* Copy over vertex weight data (if available) */
- if (new_stroke->dvert != NULL) {
+ if (gps->dvert != NULL) {
/* Copy over the relevant vertex-weight points */
new_stroke->dvert = MEM_callocN(sizeof(MDeformVert) * new_stroke->totpoints, "gp delete stroke fragment weight");
memcpy(new_stroke->dvert, gps->dvert + island->start_idx, sizeof(MDeformVert) * new_stroke->totpoints);
@@ -1896,13 +2218,14 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
/* Copy weights */
int e = island->start_idx;
for (int i = 0; i < new_stroke->totpoints; i++) {
- MDeformVert *dvert_dst = &gps->dvert[e];
- MDeformVert *dvert_src = &new_stroke->dvert[i];
- dvert_dst->dw = MEM_dupallocN(dvert_src->dw);
+ MDeformVert *dvert_src = &gps->dvert[e];
+ MDeformVert *dvert_dst = &new_stroke->dvert[i];
+ if (dvert_src->dw) {
+ dvert_dst->dw = MEM_dupallocN(dvert_src->dw);
+ }
e++;
}
}
-
/* Each island corresponds to a new stroke. We must adjust the
* timings of these new strokes:
*
@@ -1929,31 +2252,32 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
}
}
- /* Add new stroke to the frame */
- if (next_stroke) {
- BLI_insertlinkbefore(&gpf->strokes, next_stroke, new_stroke);
+ /* Add new stroke to the frame or delete if below limit */
+ if ((limit > 0) && (new_stroke->totpoints <= limit)) {
+ BKE_gpencil_free_stroke(new_stroke);
}
else {
- BLI_addtail(&gpf->strokes, new_stroke);
+ if (next_stroke) {
+ BLI_insertlinkbefore(&gpf->strokes, next_stroke, new_stroke);
+ }
+ else {
+ BLI_addtail(&gpf->strokes, new_stroke);
+ }
}
}
+ /* if cyclic, need to join last stroke with first stroke */
+ if ((is_cyclic) && (gps_first != NULL) && (gps_first != new_stroke)) {
+ gp_stroke_join_islands(gpf, gps_first, new_stroke);
+ }
+
}
/* free islands */
MEM_freeN(islands);
/* Delete the old stroke */
- if (gps->points) {
- MEM_freeN(gps->points);
- }
- if (gps->dvert) {
- BKE_gpencil_free_stroke_weights(gps);
- MEM_freeN(gps->dvert);
- }
- if (gps->triangles) {
- MEM_freeN(gps->triangles);
- }
- BLI_freelinkN(&gpf->strokes, gps);
+ BLI_remlink(&gpf->strokes, gps);
+ BKE_gpencil_free_stroke(gps);
}
/* Split selected strokes into segments, splitting on selected points */
@@ -1995,7 +2319,7 @@ static int gp_delete_selected_points(bContext *C)
gps->flag &= ~GP_STROKE_SELECT;
/* delete unwanted points by splitting stroke into several smaller ones */
- gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false, 0);
changed = true;
}
@@ -2051,7 +2375,7 @@ void GPENCIL_OT_delete(wmOperatorType *ot)
{GP_DELETEOP_POINTS, "POINTS", 0, "Points", "Delete selected points and split strokes into segments"},
{GP_DELETEOP_STROKES, "STROKES", 0, "Strokes", "Delete selected strokes"},
{GP_DELETEOP_FRAME, "FRAME", 0, "Frame", "Delete active frame"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2084,7 +2408,7 @@ void GPENCIL_OT_dissolve(wmOperatorType *ot)
{GP_DISSOLVE_POINTS, "POINTS", 0, "Dissolve", "Dissolve selected points"},
{GP_DISSOLVE_BETWEEN, "BETWEEN", 0, "Dissolve Between", "Dissolve points between selected points"},
{GP_DISSOLVE_UNSELECT, "UNSELECT", 0, "Dissolve Unselect", "Dissolve all unselected points"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2420,7 +2744,7 @@ void GPENCIL_OT_stroke_apply_thickness(wmOperatorType *ot)
enum {
GP_STROKE_CYCLIC_CLOSE = 1,
GP_STROKE_CYCLIC_OPEN = 2,
- GP_STROKE_CYCLIC_TOGGLE = 3
+ GP_STROKE_CYCLIC_TOGGLE = 3,
};
static int gp_stroke_cyclical_set_exec(bContext *C, wmOperator *op)
@@ -2488,7 +2812,7 @@ void GPENCIL_OT_stroke_cyclical_set(wmOperatorType *ot)
{GP_STROKE_CYCLIC_CLOSE, "CLOSE", 0, "Close all", ""},
{GP_STROKE_CYCLIC_OPEN, "OPEN", 0, "Open all", ""},
{GP_STROKE_CYCLIC_TOGGLE, "TOGGLE", 0, "Toggle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2507,6 +2831,109 @@ void GPENCIL_OT_stroke_cyclical_set(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", cyclic_type, GP_STROKE_CYCLIC_TOGGLE, "Type", "");
}
+/* ******************* Flat Stroke Caps ************************** */
+
+enum {
+ GP_STROKE_CAPS_TOGGLE_BOTH = 0,
+ GP_STROKE_CAPS_TOGGLE_START = 1,
+ GP_STROKE_CAPS_TOGGLE_END = 2,
+ GP_STROKE_CAPS_TOGGLE_DEFAULT = 3,
+};
+
+static int gp_stroke_caps_set_exec(bContext *C, wmOperator *op)
+{
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
+ Object *ob = CTX_data_active_object(C);
+
+ const int type = RNA_enum_get(op->ptr, "type");
+
+ /* sanity checks */
+ if (ELEM(NULL, gpd))
+ return OPERATOR_CANCELLED;
+
+ /* loop all selected strokes */
+ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
+ {
+ if (gpl->actframe == NULL)
+ continue;
+
+ for (bGPDstroke *gps = gpl->actframe->strokes.last; gps; gps = gps->prev) {
+ MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
+
+ /* skip strokes that are not selected or invalid for current view */
+ if (((gps->flag & GP_STROKE_SELECT) == 0) ||
+ (ED_gpencil_stroke_can_use(C, gps) == false))
+ {
+ continue;
+ }
+ /* skip hidden or locked colors */
+ if (!gp_style ||
+ (gp_style->flag & GP_STYLE_COLOR_HIDE) ||
+ (gp_style->flag & GP_STYLE_COLOR_LOCKED))
+ {
+ continue;
+ }
+
+ if ((type == GP_STROKE_CAPS_TOGGLE_BOTH) ||
+ (type == GP_STROKE_CAPS_TOGGLE_START))
+ {
+ ++gps->caps[0];
+ if (gps->caps[0] >= GP_STROKE_CAP_MAX) {
+ gps->caps[0] = GP_STROKE_CAP_ROUND;
+ }
+ }
+ if ((type == GP_STROKE_CAPS_TOGGLE_BOTH) ||
+ (type == GP_STROKE_CAPS_TOGGLE_END))
+ {
+ ++gps->caps[1];
+ if (gps->caps[1] >= GP_STROKE_CAP_MAX) {
+ gps->caps[1] = GP_STROKE_CAP_ROUND;
+ }
+ }
+ if (type == GP_STROKE_CAPS_TOGGLE_DEFAULT) {
+ gps->caps[0] = GP_STROKE_CAP_ROUND;
+ gps->caps[1] = GP_STROKE_CAP_ROUND;
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ /* notifiers */
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+/**
+ * Change Stroke caps mode Rounded or Flat
+ */
+void GPENCIL_OT_stroke_caps_set(wmOperatorType *ot)
+{
+ static const EnumPropertyItem toggle_type[] = {
+ {GP_STROKE_CAPS_TOGGLE_BOTH, "TOGGLE", 0, "Both", ""},
+ {GP_STROKE_CAPS_TOGGLE_START, "START", 0, "Start", ""},
+ {GP_STROKE_CAPS_TOGGLE_END, "END", 0, "End", ""},
+ {GP_STROKE_CAPS_TOGGLE_DEFAULT, "TOGGLE", 0, "Default", "Set as default rounded"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* identifiers */
+ ot->name = "Set Caps Mode";
+ ot->idname = "GPENCIL_OT_stroke_caps_set";
+ ot->description = "Change Stroke caps mode (rounded or flat)";
+
+ /* api callbacks */
+ ot->exec = gp_stroke_caps_set_exec;
+ ot->poll = gp_active_layer_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ ot->prop = RNA_def_enum(ot->srna, "type", toggle_type, GP_STROKE_CAPS_TOGGLE_BOTH, "Type", "");
+}
+
/* ******************* Stroke join ************************** */
/* Helper: flip stroke */
@@ -2762,7 +3189,7 @@ void GPENCIL_OT_stroke_join(wmOperatorType *ot)
static const EnumPropertyItem join_type[] = {
{GP_STROKE_JOIN, "JOIN", 0, "Join", ""},
{GP_STROKE_JOINCOPY, "JOINCOPY", 0, "Join and Copy", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2950,13 +3377,15 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
}
else {
/* Geometry - Snap to surfaces of visible geometry */
- /* XXX: There will be precision loss (possible stairstep artifacts) from this conversion to satisfy the API's */
+ /* XXX: There will be precision loss (possible stairstep artifacts)
+ * from this conversion to satisfy the API's */
const int screen_co[2] = {(int)xy[0], (int)xy[1]};
int depth_margin = 0; // XXX: 4 for strokes, 0 for normal
float depth;
- /* XXX: The proper procedure computes the depths into an array, to have smooth transitions when all else fails... */
+ /* XXX: The proper procedure computes the depths into an array,
+ * to have smooth transitions when all else fails... */
if (ED_view3d_autodist_depth(gsc.ar, screen_co, depth_margin, &depth)) {
ED_view3d_autodist_simple(gsc.ar, screen_co, &pt->x, 0, &depth);
}
@@ -2994,7 +3423,7 @@ void GPENCIL_OT_reproject(wmOperatorType *ot)
"using 'Cursor' Stroke Placement"},
{GP_REPROJECT_SURFACE, "SURFACE", 0, "Surface",
"Reproject the strokes on to the scene geometry, as if drawn using 'Surface' placement"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3347,6 +3776,74 @@ void GPENCIL_OT_stroke_simplify_fixed(wmOperatorType *ot)
}
+/* ******************* Stroke trim ************************** */
+static int gp_stroke_trim_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
+
+ /* sanity checks */
+ if (ELEM(NULL, gpd))
+ return OPERATOR_CANCELLED;
+
+ /* Go through each editable + selected stroke */
+ const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
+
+ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
+ {
+ bGPDframe *init_gpf = gpl->actframe;
+ if (is_multiedit) {
+ init_gpf = gpl->frames.first;
+ }
+
+ for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
+ if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
+ bGPDstroke *gps, *gpsn;
+
+ if (gpf == NULL)
+ continue;
+
+ for (gps = gpf->strokes.first; gps; gps = gpsn) {
+ gpsn = gps->next;
+
+ /* skip strokes that are invalid for current view */
+ if (ED_gpencil_stroke_can_use(C, gps) == false)
+ continue;
+
+ if (gps->flag & GP_STROKE_SELECT) {
+ BKE_gpencil_trim_stroke(gps);
+ }
+ }
+ /* if not multiedit, exit loop*/
+ if (!is_multiedit) {
+ break;
+ }
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ /* notifiers */
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_stroke_trim(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Trim Stroke";
+ ot->idname = "GPENCIL_OT_stroke_trim";
+ ot->description = "Trim selected stroke to first loop or intersection";
+
+ /* api callbacks */
+ ot->exec = gp_stroke_trim_exec;
+ ot->poll = gp_active_layer_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
/* ***************** Separate Strokes ********************** */
typedef enum eGP_SeparateModes {
/* Points */
@@ -3381,6 +3878,12 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
if (ELEM(NULL, gpd_src)) {
return OPERATOR_CANCELLED;
}
+
+ if ((mode == GP_SEPARATE_LAYER) && (BLI_listbase_count(&gpd_src->layers) == 1)) {
+ BKE_report(op->reports, RPT_ERROR, "Cannot separate an object with one layer only");
+ return OPERATOR_CANCELLED;
+ }
+
const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_src);
/* create a new object */
@@ -3388,7 +3891,6 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
ob_dst = base_new->object;
ob_dst->mode = OB_MODE_OBJECT;
/* create new grease pencil datablock */
- // XXX: check usercounts
gpd_dst = BKE_gpencil_data_addnew(bmain, gpd_src->id.name + 2);
ob_dst->data = (bGPdata *)gpd_dst;
@@ -3472,10 +3974,10 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
}
/* delete selected points from destination stroke */
- gp_stroke_delete_tagged_points(gpf_dst, gps_dst, NULL, GP_SPOINT_SELECT, false);
+ gp_stroke_delete_tagged_points(gpf_dst, gps_dst, NULL, GP_SPOINT_SELECT, false, 0);
/* delete selected points from origin stroke */
- gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false, 0);
}
/* selected strokes mode */
else if (mode == GP_SEPARATE_STROKE) {
@@ -3516,8 +4018,35 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
gpl->prev = gpl->next = NULL;
/* relink to destination datablock */
BLI_addtail(&gpd_dst->layers, gpl);
+
+ /* add duplicate materials */
+ for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+ for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+ /* skip strokes that are invalid for current view */
+ if (ED_gpencil_stroke_can_use(C, gps) == false) {
+ continue;
+ }
+ ma = give_current_material(ob, gps->mat_nr + 1);
+ idx = BKE_gpencil_get_material_index(ob_dst, ma);
+ if (idx == 0) {
+ totadd++;
+ ob_dst->actcol = totadd;
+ ob_dst->totcol = totadd;
+
+ if (totadd > totslots) {
+ BKE_object_material_slot_add(bmain, ob_dst);
+ }
+
+ assign_material(bmain, ob_dst, ma, ob_dst->totcol, BKE_MAT_ASSIGN_USERPREF);
+ idx = totadd;
+ }
+ /* reasign material */
+ gps->mat_nr = idx - 1;
+ }
+ }
}
}
+
DEG_id_tag_update(&gpd_src->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
DEG_id_tag_update(&gpd_dst->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
@@ -3534,7 +4063,7 @@ void GPENCIL_OT_stroke_separate(wmOperatorType *ot)
{GP_SEPARATE_POINT, "POINT", 0, "Selected Points", "Separate the selected points"},
{GP_SEPARATE_STROKE, "STROKE", 0, "Selected Strokes", "Separate the selected strokes"},
{GP_SEPARATE_LAYER, "LAYER", 0, "Active Layer", "Separate the strokes of the current layer"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3609,10 +4138,10 @@ static int gp_stroke_split_exec(bContext *C, wmOperator *UNUSED(op))
}
/* delete selected points from destination stroke */
- gp_stroke_delete_tagged_points(gpf, gps_dst, NULL, GP_SPOINT_SELECT, true);
+ gp_stroke_delete_tagged_points(gpf, gps_dst, NULL, GP_SPOINT_SELECT, true, 0);
/* delete selected points from origin stroke */
- gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_SELECT, false, 0);
}
}
/* select again tagged points */
@@ -3702,3 +4231,241 @@ void GPENCIL_OT_stroke_smooth(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "smooth_strength", false, "Strength", "");
RNA_def_boolean(ot->srna, "smooth_uv", false, "UV", "");
}
+
+/* smart stroke cutter for trimming stroke ends */
+struct GP_SelectLassoUserData {
+ rcti rect;
+ const int(*mcords)[2];
+ int mcords_len;
+};
+
+static bool gpencil_test_lasso(
+ bGPDstroke *gps, bGPDspoint *pt,
+ const GP_SpaceConversion *gsc, const float diff_mat[4][4],
+ void *user_data)
+{
+ const struct GP_SelectLassoUserData *data = user_data;
+ bGPDspoint pt2;
+ int x0, y0;
+ gp_point_to_parent_space(pt, diff_mat, &pt2);
+ gp_point_to_xy(gsc, gps, &pt2, &x0, &y0);
+ /* test if in lasso */
+ return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) &&
+ BLI_rcti_isect_pt(&data->rect, x0, y0) &&
+ BLI_lasso_is_point_inside(data->mcords, data->mcords_len, x0, y0, INT_MAX));
+}
+
+typedef bool(*GPencilTestFn)(
+ bGPDstroke *gps, bGPDspoint *pt,
+ const GP_SpaceConversion *gsc, const float diff_mat[4][4], void *user_data);
+
+static void gpencil_cutter_dissolve(bGPDlayer *hit_layer, bGPDstroke *hit_stroke)
+{
+ bGPDspoint *pt = NULL;
+ bGPDspoint *pt1 = NULL;
+ int i;
+
+ bGPDstroke *gpsn = hit_stroke->next;
+
+ int totselect = 0;
+ for (i = 0, pt = hit_stroke->points; i < hit_stroke->totpoints; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ totselect++;
+ }
+ }
+
+ /* if all points selected delete or only 2 points and 1 selected */
+ if (((totselect == 1) && (hit_stroke->totpoints == 2)) ||
+ (hit_stroke->totpoints == totselect))
+ {
+ BLI_remlink(&hit_layer->actframe->strokes, hit_stroke);
+ BKE_gpencil_free_stroke(hit_stroke);
+ hit_stroke = NULL;
+ }
+
+ /* if very small distance delete */
+ if ((hit_stroke) && (hit_stroke->totpoints == 2)) {
+ pt = &hit_stroke->points[0];
+ pt1 = &hit_stroke->points[1];
+ if (len_v3v3(&pt->x, &pt1->x) < 0.001f) {
+ BLI_remlink(&hit_layer->actframe->strokes, hit_stroke);
+ BKE_gpencil_free_stroke(hit_stroke);
+ hit_stroke = NULL;
+ }
+ }
+
+ if (hit_stroke) {
+ /* tag and dissolve (untag new points) */
+ for (i = 0, pt = hit_stroke->points; i < hit_stroke->totpoints; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ pt->flag &= ~GP_SPOINT_SELECT;
+ pt->flag |= GP_SPOINT_TAG;
+ }
+ else if (pt->flag & GP_SPOINT_TAG) {
+ pt->flag &= ~GP_SPOINT_TAG;
+ }
+ }
+ gp_stroke_delete_tagged_points(
+ hit_layer->actframe, hit_stroke, gpsn, GP_SPOINT_TAG, false, 1);
+ }
+}
+
+static int gpencil_cutter_lasso_select(
+ bContext *C, wmOperator *op,
+ GPencilTestFn is_inside_fn, void *user_data)
+{
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
+ ScrArea *sa = CTX_wm_area(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ const float scale = ts->gp_sculpt.isect_threshold;
+
+ bGPDspoint *pt;
+ int i;
+ GP_SpaceConversion gsc = { NULL };
+
+ bool changed = false;
+
+ /* sanity checks */
+ if (sa == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No active area");
+ return OPERATOR_CANCELLED;
+ }
+
+ /* init space conversion stuff */
+ gp_point_conversion_init(C, &gsc);
+
+ /* deselect all strokes first */
+ CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
+ {
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ pt->flag &= ~GP_SPOINT_SELECT;
+ }
+
+ gps->flag &= ~GP_STROKE_SELECT;
+ }
+ CTX_DATA_END;
+
+ /* select points */
+ GP_EDITABLE_STROKES_BEGIN(gpstroke_iter, C, gpl, gps)
+ {
+ int tot_inside = 0;
+ const int oldtot = gps->totpoints;
+ for (i = 0; i < gps->totpoints; i++) {
+ pt = &gps->points[i];
+ if ((pt->flag & GP_SPOINT_SELECT) || (pt->flag & GP_SPOINT_TAG)) {
+ continue;
+ }
+ /* convert point coords to screenspace */
+ const bool is_inside = is_inside_fn(gps, pt, &gsc, gpstroke_iter.diff_mat, user_data);
+ if (is_inside) {
+ tot_inside++;
+ changed = true;
+ pt->flag |= GP_SPOINT_SELECT;
+ gps->flag |= GP_STROKE_SELECT;
+ float r_hita[3], r_hitb[3];
+ if (gps->totpoints > 1) {
+ ED_gpencil_select_stroke_segment(
+ gpl, gps, pt, true, true, scale, r_hita, r_hitb);
+ }
+ /* avoid infinite loops */
+ if (gps->totpoints > oldtot) {
+ break;
+ }
+ }
+ }
+ /* if mark all points inside lasso set to remove all stroke */
+ if ((tot_inside == oldtot) ||
+ ((tot_inside == 1) && (oldtot == 2)))
+ {
+ for (i = 0; i < gps->totpoints; i++) {
+ pt = &gps->points[i];
+ pt->flag |= GP_SPOINT_SELECT;
+ }
+ }
+ }
+ GP_EDITABLE_STROKES_END(gpstroke_iter);
+
+ /* dissolve selected points */
+ bGPDstroke *gpsn;
+ for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ bGPDframe *gpf = gpl->actframe;
+ if (gpf == NULL) {
+ continue;
+ }
+ for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gpsn) {
+ gpsn = gps->next;
+ if (gps->flag & GP_STROKE_SELECT) {
+ gpencil_cutter_dissolve(gpl, gps);
+ }
+ }
+ }
+
+ /* updates */
+ if (changed) {
+ DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
+ WM_event_add_notifier(C, NC_GPENCIL | NA_SELECTED, NULL);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+static bool gpencil_cutter_poll(bContext *C)
+{
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
+
+ if (GPENCIL_PAINT_MODE(gpd)) {
+ if (gpd->layers.first)
+ return true;
+ }
+
+ return false;
+}
+
+static int gpencil_cutter_exec(bContext *C, wmOperator *op)
+{
+ ScrArea *sa = CTX_wm_area(C);
+ /* sanity checks */
+ if (sa == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No active area");
+ return OPERATOR_CANCELLED;
+ }
+
+ struct GP_SelectLassoUserData data = { 0 };
+ data.mcords = WM_gesture_lasso_path_to_array(C, op, &data.mcords_len);
+
+ /* Sanity check. */
+ if (data.mcords == NULL) {
+ return OPERATOR_PASS_THROUGH;
+ }
+
+ /* Compute boundbox of lasso (for faster testing later). */
+ BLI_lasso_boundbox(&data.rect, data.mcords, data.mcords_len);
+
+ gpencil_cutter_lasso_select(C, op, gpencil_test_lasso, &data);
+
+ MEM_freeN((void *)data.mcords);
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_stroke_cutter(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Stroke Cutter";
+ ot->description = "Select section and cut";
+ ot->idname = "GPENCIL_OT_stroke_cutter";
+
+ /* callbacks */
+ ot->invoke = WM_gesture_lasso_invoke;
+ ot->modal = WM_gesture_lasso_modal;
+ ot->exec = gpencil_cutter_exec;
+ ot->poll = gpencil_cutter_poll;
+ ot->cancel = WM_gesture_lasso_cancel;
+
+ /* flag */
+ ot->flag = OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
+
+ /* properties */
+ WM_operator_properties_gesture_lasso(ot);
+}
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 554b94a35f9..680568a96c5 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,17 +13,13 @@
* 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) 2017, Blender Foundation, Joshua Leung
+ * The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
- /** \file blender/editors/gpencil/gpencil_fill.c
- * \ingroup edgpencil
- */
+/** \file
+ * \ingroup edgpencil
+ */
#include <stdio.h>
@@ -91,39 +85,67 @@ typedef struct tGPDfill {
bContext *C;
struct Main *bmain;
struct Depsgraph *depsgraph;
- struct wmWindow *win; /* window where painting originated */
- struct Scene *scene; /* current scene from context */
- struct Object *ob; /* current active gp object */
- struct ScrArea *sa; /* area where painting originated */
- struct RegionView3D *rv3d; /* region where painting originated */
- struct View3D *v3d; /* view3 where painting originated */
- struct ARegion *ar; /* region where painting originated */
- struct bGPdata *gpd; /* current GP datablock */
- struct Material *mat; /* current material */
- struct bGPDlayer *gpl; /* layer */
- struct bGPDframe *gpf; /* frame */
-
- short flag; /* flags */
- short oldkey; /* avoid too fast events */
- bool on_back; /* send to back stroke */
-
- int center[2]; /* mouse fill center position */
- int sizex; /* windows width */
- int sizey; /* window height */
- int lock_axis; /* lock to viewport axis */
-
- short fill_leak; /* number of pixel to consider the leak is too small (x 2) */
- float fill_threshold; /* factor for transparency */
- int fill_simplylvl; /* number of simplify steps */
- int fill_draw_mode; /* boundary limits drawing mode */
-
- short sbuffer_size; /* number of elements currently in cache */
- void *sbuffer; /* temporary points */
- float *depth_arr; /* depth array for reproject */
-
- Image *ima; /* temp image */
- BLI_Stack *stack; /* temp points data */
- void *draw_handle_3d; /* handle for drawing strokes while operator is running 3d stuff */
+ /** window where painting originated */
+ struct wmWindow *win;
+ /** current scene from context */
+ struct Scene *scene;
+ /** current active gp object */
+ struct Object *ob;
+ /** area where painting originated */
+ struct ScrArea *sa;
+ /** region where painting originated */
+ struct RegionView3D *rv3d;
+ /** view3 where painting originated */
+ struct View3D *v3d;
+ /** region where painting originated */
+ struct ARegion *ar;
+ /** current GP datablock */
+ struct bGPdata *gpd;
+ /** current material */
+ struct Material *mat;
+ /** layer */
+ struct bGPDlayer *gpl;
+ /** frame */
+ struct bGPDframe *gpf;
+
+ /** flags */
+ short flag;
+ /** avoid too fast events */
+ short oldkey;
+ /** send to back stroke */
+ bool on_back;
+
+ /** mouse fill center position */
+ int center[2];
+ /** windows width */
+ int sizex;
+ /** window height */
+ int sizey;
+ /** lock to viewport axis */
+ int lock_axis;
+
+ /** number of pixel to consider the leak is too small (x 2) */
+ short fill_leak;
+ /** factor for transparency */
+ float fill_threshold;
+ /** number of simplify steps */
+ int fill_simplylvl;
+ /** boundary limits drawing mode */
+ int fill_draw_mode;
+
+ /** number of elements currently in cache */
+ short sbuffer_size;
+ /** temporary points */
+ void *sbuffer;
+ /** depth array for reproject */
+ float *depth_arr;
+
+ /** temp image */
+ Image *ima;
+ /** temp points data */
+ BLI_Stack *stack;
+ /** handle for drawing strokes while operator is running 3d stuff */
+ void *draw_handle_3d;
} tGPDfill;
@@ -222,7 +244,7 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4])
/* if active layer and no keyframe, create a new one */
if (gpl == tgpf->gpl) {
- if (gpl->actframe->framenum != cfra_eval) {
+ if ((gpl->actframe == NULL) || (gpl->actframe->framenum != cfra_eval)) {
BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_ADD_NEW);
}
}
@@ -294,14 +316,16 @@ static void gp_render_offscreen(tGPDfill *tgpf)
ImBuf *ibuf = IMB_allocImBuf(tgpf->sizex, tgpf->sizey, 32, flag);
rctf viewplane;
- float clipsta, clipend;
+ float clip_start, clip_end;
- is_ortho = ED_view3d_viewplane_get(tgpf->depsgraph, tgpf->v3d, tgpf->rv3d, tgpf->sizex, tgpf->sizey, &viewplane, &clipsta, &clipend, NULL);
+ is_ortho = ED_view3d_viewplane_get(
+ tgpf->depsgraph, tgpf->v3d, tgpf->rv3d, tgpf->sizex, tgpf->sizey,
+ &viewplane, &clip_start, &clip_end, NULL);
if (is_ortho) {
- orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
+ orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clip_end, clip_end);
}
else {
- perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
+ perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clip_start, clip_end);
}
/* set temporary new size */
@@ -654,7 +678,7 @@ static void gpencil_get_outline_points(tGPDfill *tgpf)
{1, 1},
{0, 1},
{-1, 1},
- {-1, 0}
+ {-1, 0},
};
tgpf->stack = BLI_stack_new(sizeof(int[2]), __func__);
@@ -1100,9 +1124,9 @@ static void gpencil_fill_exit(bContext *C, wmOperator *op)
/* delete temp image */
if (tgpf->ima) {
- for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
if (ima == tgpf->ima) {
- BLI_remlink(&bmain->image, ima);
+ BLI_remlink(&bmain->images, ima);
BKE_image_free(tgpf->ima);
MEM_SAFE_FREE(tgpf->ima);
break;
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index e6ef70009c8..4fba83a5f02 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_intern.h
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
#ifndef __GPENCIL_INTERN_H__
@@ -38,27 +31,27 @@
/* internal exports only */
-struct bGPdata;
-struct bGPDstroke;
+struct Material;
struct bGPDspoint;
+struct bGPDstroke;
+struct bGPdata;
struct tGPspoint;
-struct Material;
struct GHash;
struct RNG;
+struct ARegion;
struct Brush;
struct Scene;
-struct ARegion;
-struct View3D;
struct View2D;
+struct View3D;
struct wmOperatorType;
struct Depsgraph;
+struct EnumPropertyItem;
struct PointerRNA;
struct PropertyRNA;
-struct EnumPropertyItem;
/* ***************************************************** */
@@ -107,79 +100,138 @@ typedef struct tGPDdraw {
typedef struct tGPDinterpolate_layer {
struct tGPDinterpolate_layer *next, *prev;
- struct bGPDlayer *gpl; /* layer */
- struct bGPDframe *prevFrame; /* frame before current frame (interpolate-from) */
- struct bGPDframe *nextFrame; /* frame after current frame (interpolate-to) */
- struct bGPDframe *interFrame; /* interpolated frame */
- float factor; /* interpolate factor */
+ /** layer */
+ struct bGPDlayer *gpl;
+ /** frame before current frame (interpolate-from) */
+ struct bGPDframe *prevFrame;
+ /** frame after current frame (interpolate-to) */
+ struct bGPDframe *nextFrame;
+ /** interpolated frame */
+ struct bGPDframe *interFrame;
+ /** interpolate factor */
+ float factor;
} tGPDinterpolate_layer;
typedef struct tGPDinterpolate {
- struct Scene *scene; /* current scene from context */
- struct ScrArea *sa; /* area where painting originated */
- struct ARegion *ar; /* region where painting originated */
- struct bGPdata *gpd; /* current GP datablock */
- struct Material *mat; /* current material */
-
- int cframe; /* current frame number */
- ListBase ilayers; /* (tGPDinterpolate_layer) layers to be interpolated */
- float shift; /* value for determining the displacement influence */
- float init_factor; /* initial interpolation factor for active layer */
- float low_limit; /* shift low limit (-100%) */
- float high_limit; /* shift upper limit (200%) */
- int flag; /* flag from toolsettings */
+ /** current scene from context */
+ struct Scene *scene;
+ /** area where painting originated */
+ struct ScrArea *sa;
+ /** region where painting originated */
+ struct ARegion *ar;
+ /** current GP datablock */
+ struct bGPdata *gpd;
+ /** current material */
+ struct Material *mat;
+
+ /** current frame number */
+ int cframe;
+ /** (tGPDinterpolate_layer) layers to be interpolated */
+ ListBase ilayers;
+ /** value for determining the displacement influence */
+ float shift;
+ /** initial interpolation factor for active layer */
+ float init_factor;
+ /** shift low limit (-100%) */
+ float low_limit;
+ /** shift upper limit (200%) */
+ float high_limit;
+ /** flag from toolsettings */
+ int flag;
NumInput num; /* numeric input */
- void *draw_handle_3d; /* handle for drawing strokes while operator is running 3d stuff */
- void *draw_handle_screen; /* handle for drawing strokes while operator is running screen stuff */
+ /** handle for drawing strokes while operator is running 3d stuff */
+ void *draw_handle_3d;
+ /** handle for drawing strokes while operator is running screen stuff */
+ void *draw_handle_screen;
} tGPDinterpolate;
/* Temporary primitive operation data */
typedef struct tGPDprimitive {
- struct Main *bmain; /* main database pointer */
+ /** main database pointer */
+ struct Main *bmain;
struct Depsgraph *depsgraph;
- struct wmWindow *win; /* window where painting originated */
- struct Scene *scene; /* current scene from context */
- struct Object *ob; /* current active gp object */
- struct ScrArea *sa; /* area where painting originated */
- struct RegionView3D *rv3d; /* region where painting originated */
- struct View3D *v3d; /* view3d where painting originated */
- struct ARegion *ar; /* region where painting originated */
- struct bGPdata *gpd; /* current GP datablock */
- struct Material *mat; /* current material */
- struct Brush *brush; /* current brush */
-
- int cframe; /* current frame number */
- struct bGPDlayer *gpl; /* layer */
- struct bGPDframe *gpf; /* frame */
- int type; /* type of primitive */
- int orign_type; /* original type of primitive */
- bool curve; /* type of primitive is a curve */
- int brush_size; /* brush size */
- float brush_strength; /* brush strength */
- short flip; /* flip option */
- tGPspoint *points; /* array of data-points for stroke */
- int point_count; /* number of edges allocated */
- int tot_stored_edges; /* stored number of polygon edges */
- int tot_edges; /* number of polygon edges */
- float move[2]; /* move distance */
- float origin[2]; /* initial box corner */
- float start[2]; /* first box corner */
- float end[2]; /* last box corner */
- float midpoint[2]; /* midpoint box corner */
- float cp1[2]; /* first control point */
- float cp2[2]; /* second control point */
- int sel_cp; /* flag to determine control point is selected */
- int flag; /* flag to determine operations in progress */
- float mval[2]; /* recorded mouse-position */
- float mvalo[2]; /* previous recorded mouse-position */
-
- int lock_axis; /* lock to viewport axis */
+ /** window where painting originated */
+ struct wmWindow *win;
+ /** current scene from context */
+ struct Scene *scene;
+ /** current active gp object */
+ struct Object *ob;
+ /** area where painting originated */
+ struct ScrArea *sa;
+ /** region where painting originated */
+ struct RegionView3D *rv3d;
+ /** view3d where painting originated */
+ struct View3D *v3d;
+ /** region where painting originated */
+ struct ARegion *ar;
+ /** current GP datablock */
+ struct bGPdata *gpd;
+ /** current material */
+ struct Material *mat;
+ /** current brush */
+ struct Brush *brush;
+
+ /** current frame number */
+ int cframe;
+ /** layer */
+ struct bGPDlayer *gpl;
+ /** frame */
+ struct bGPDframe *gpf;
+ /** type of primitive */
+ int type;
+ /** original type of primitive */
+ int orign_type;
+ /** type of primitive is a curve */
+ bool curve;
+ /** brush size */
+ int brush_size;
+ /** brush strength */
+ float brush_strength;
+ /** flip option */
+ short flip;
+ /** array of data-points for stroke */
+ tGPspoint *points;
+ /** number of edges allocated */
+ int point_count;
+ /** stored number of polygon edges */
+ int tot_stored_edges;
+ /** number of polygon edges */
+ int tot_edges;
+ /** move distance */
+ float move[2];
+ /** initial box corner */
+ float origin[2];
+ /** first box corner */
+ float start[2];
+ /** last box corner */
+ float end[2];
+ /** midpoint box corner */
+ float midpoint[2];
+ /** first control point */
+ float cp1[2];
+ /** second control point */
+ float cp2[2];
+ /** flag to determine control point is selected */
+ int sel_cp;
+ /** flag to determine operations in progress */
+ int flag;
+ /** recorded mouse-position */
+ float mval[2];
+ /** previous recorded mouse-position */
+ float mvalo[2];
+
+ /** lock to viewport axis */
+ int lock_axis;
struct RNG *rng;
- NumInput num; /* numeric input */
+ /** numeric input */
+ NumInput num;
+
+ /** size in pixels for uv calculation */
+ float totpixlen;
} tGPDprimitive;
@@ -234,7 +286,9 @@ void gp_apply_parent(struct Depsgraph *depsgraph, struct Object *obact, bGPdata
*/
void gp_apply_parent_point(struct Depsgraph *depsgraph, struct Object *obact, bGPdata *gpd, bGPDlayer *gpl, bGPDspoint *pt);
-bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, struct Scene *scene, const float screen_co[2], float r_out[3]);
+void gp_point_3d_to_xy(const GP_SpaceConversion *gsc, const short flag, const float pt[3], float xy[2]);
+
+bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, struct Scene *scene, const float screen_co[2], float r_out[3]);
/* helper to convert 2d to 3d */
void gp_stroke_convertcoords_tpoint(
@@ -263,7 +317,7 @@ struct GHash *gp_copybuf_validate_colormap(struct bContext *C);
void gp_stroke_delete_tagged_points(
bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke,
- int tag_flags, bool select);
+ int tag_flags, bool select, int limit);
int gp_delete_selected_point_wrap(bContext *C);
void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide);
@@ -291,12 +345,17 @@ void GPENCIL_OT_annotate(struct wmOperatorType *ot);
void GPENCIL_OT_draw(struct wmOperatorType *ot);
void GPENCIL_OT_fill(struct wmOperatorType *ot);
+/* Guides ----------------------- */
+
+void GPENCIL_OT_guide_rotate(struct wmOperatorType *ot);
+
/* Paint Modes for operator */
typedef enum eGPencil_PaintModes {
GP_PAINTMODE_DRAW = 0,
GP_PAINTMODE_ERASER,
GP_PAINTMODE_DRAW_STRAIGHT,
- GP_PAINTMODE_DRAW_POLY
+ GP_PAINTMODE_DRAW_POLY,
+ GP_PAINTMODE_SET_CP
} eGPencil_PaintModes;
/* maximum sizes of gp-session buffer */
@@ -330,6 +389,7 @@ void GPENCIL_OT_delete(struct wmOperatorType *ot);
void GPENCIL_OT_dissolve(struct wmOperatorType *ot);
void GPENCIL_OT_copy(struct wmOperatorType *ot);
void GPENCIL_OT_paste(struct wmOperatorType *ot);
+void GPENCIL_OT_extrude(struct wmOperatorType *ot);
void GPENCIL_OT_move_to_layer(struct wmOperatorType *ot);
void GPENCIL_OT_layer_change(struct wmOperatorType *ot);
@@ -376,7 +436,7 @@ void GPENCIL_OT_convert(struct wmOperatorType *ot);
enum {
GP_STROKE_JOIN = -1,
- GP_STROKE_JOINCOPY = 1
+ GP_STROKE_JOINCOPY = 1,
};
enum {
@@ -384,12 +444,12 @@ enum {
GP_STROKE_LINE = 1,
GP_STROKE_CIRCLE = 2,
GP_STROKE_ARC = 3,
- GP_STROKE_CURVE = 4
+ GP_STROKE_CURVE = 4,
};
enum {
GP_MERGE_STROKE = -1,
- GP_MERGE_POINT = 1
+ GP_MERGE_POINT = 1,
};
void GPENCIL_OT_stroke_arrange(struct wmOperatorType *ot);
@@ -397,6 +457,7 @@ void GPENCIL_OT_stroke_change_color(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_lock_color(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_apply_thickness(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_cyclical_set(struct wmOperatorType *ot);
+void GPENCIL_OT_stroke_caps_set(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_join(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_flip(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_subdivide(struct wmOperatorType *ot);
@@ -406,6 +467,8 @@ void GPENCIL_OT_stroke_separate(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_split(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_smooth(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_merge(struct wmOperatorType *ot);
+void GPENCIL_OT_stroke_cutter(struct wmOperatorType *ot);
+void GPENCIL_OT_stroke_trim(struct wmOperatorType *ot);
void GPENCIL_OT_brush_presets_create(struct wmOperatorType *ot);
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index 86a8e3479f3..7be157b5d84 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2016, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for interpolating new Grease Pencil frames from existing strokes
*/
-/** \file blender/editors/gpencil/gpencil_interpolate.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -57,10 +50,8 @@
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_deform.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_report.h"
-#include "BKE_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -1112,7 +1103,8 @@ static int gpencil_interpolate_reverse_exec(bContext *C, wmOperator *UNUSED(op))
gpf = gpf->prev;
}
else {
- /* Not a breakdown (may be a key, or an extreme, or something else that wasn't generated)... stop */
+ /* Not a breakdown (may be a key, or an extreme,
+ * or something else that wasn't generated)... stop */
break;
}
}
diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c
index 3641308ae17..80b26a366fe 100644
--- a/source/blender/editors/gpencil/gpencil_merge.c
+++ b/source/blender/editors/gpencil/gpencil_merge.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2019, Blender Foundation.
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for merge Grease Pencil strokes
*/
- /** \file blender/editors/gpencil/gpencil_merge.c
- * \ingroup edgpencil
- */
-
+/** \file
+ * \ingroup edgpencil
+ */
#include <stdio.h>
@@ -194,7 +186,7 @@ static void gpencil_dissolve_points(bContext *C)
for (gps = gpf->strokes.first; gps; gps = gpsn) {
gpsn = gps->next;
- gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_TAG, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gpsn, GP_SPOINT_TAG, false, 0);
}
}
CTX_DATA_END;
@@ -548,7 +540,7 @@ void GPENCIL_OT_stroke_merge(wmOperatorType *ot)
static const EnumPropertyItem mode_type[] = {
{GP_MERGE_STROKE, "STROKE", 0, "Stroke", ""},
{GP_MERGE_POINT, "POINT", 0, "Point", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/gpencil/gpencil_old.c b/source/blender/editors/gpencil/gpencil_old.c
index a2012be223d..b1924b3cacd 100644
--- a/source/blender/editors/gpencil/gpencil_old.c
+++ b/source/blender/editors/gpencil/gpencil_old.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation,
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Use deprecated data to convert old 2.7x files
*/
-/** \file blender/editors/gpencil/gpencil_old.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
/* allow to use deprecated functionality */
@@ -127,7 +120,18 @@ static int gpencil_convert_old_files_exec(bContext *C, wmOperator *UNUSED(op))
MaterialGPencilStyle *gp_style = ma->gp_style;
copy_v4_v4(gp_style->stroke_rgba, palcolor->color);
copy_v4_v4(gp_style->fill_rgba, palcolor->fill);
- gp_style->flag = palcolor->flag;
+
+ /* set basic settings */
+ gp_style->pattern_gridsize = 0.1f;
+ gp_style->gradient_radius = 0.5f;
+ ARRAY_SET_ITEMS(gp_style->mix_rgba, 1.0f, 1.0f, 1.0f, 0.2f);
+ ARRAY_SET_ITEMS(gp_style->gradient_scale, 1.0f, 1.0f);
+ ARRAY_SET_ITEMS(gp_style->texture_scale, 1.0f, 1.0f);
+ gp_style->texture_opacity = 1.0f;
+ gp_style->texture_pixsize = 100.0f;
+
+ gp_style->flag |= GP_STYLE_STROKE_SHOW;
+ gp_style->flag |= GP_STYLE_FILL_SHOW;
/* fix strokes */
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
@@ -161,7 +165,7 @@ static int gpencil_convert_old_files_exec(bContext *C, wmOperator *UNUSED(op))
#if 0 /* GPXX */
/* Handle object-linked grease pencil datablocks */
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->gpd) {
if (ob->type == OB_GPENCIL) {
/* GP Object - remap the links */
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 7814aa963ba..c01da39bcd8 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,16 +13,12 @@
* 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) 2009, Blender Foundation, Joshua Leung
+ * The Original Code is Copyright (C) 2009, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_ops.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -228,6 +222,10 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_draw);
WM_operatortype_append(GPENCIL_OT_fill);
+ /* Guides ----------------------- */
+
+ WM_operatortype_append(GPENCIL_OT_guide_rotate);
+
/* Editing (Strokes) ------------ */
WM_operatortype_append(GPENCIL_OT_editmode_toggle);
@@ -256,6 +254,7 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_dissolve);
WM_operatortype_append(GPENCIL_OT_copy);
WM_operatortype_append(GPENCIL_OT_paste);
+ WM_operatortype_append(GPENCIL_OT_extrude);
WM_operatortype_append(GPENCIL_OT_move_to_layer);
WM_operatortype_append(GPENCIL_OT_layer_change);
@@ -301,6 +300,7 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_stroke_lock_color);
WM_operatortype_append(GPENCIL_OT_stroke_apply_thickness);
WM_operatortype_append(GPENCIL_OT_stroke_cyclical_set);
+ WM_operatortype_append(GPENCIL_OT_stroke_caps_set);
WM_operatortype_append(GPENCIL_OT_stroke_join);
WM_operatortype_append(GPENCIL_OT_stroke_flip);
WM_operatortype_append(GPENCIL_OT_stroke_subdivide);
@@ -310,6 +310,8 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_stroke_split);
WM_operatortype_append(GPENCIL_OT_stroke_smooth);
WM_operatortype_append(GPENCIL_OT_stroke_merge);
+ WM_operatortype_append(GPENCIL_OT_stroke_cutter);
+ WM_operatortype_append(GPENCIL_OT_stroke_trim);
WM_operatortype_append(GPENCIL_OT_brush_presets_create);
@@ -353,13 +355,26 @@ void ED_operatormacros_gpencil(void)
wmOperatorTypeMacro *otmacro;
/* Duplicate + Move = Interactively place newly duplicated strokes */
- ot = WM_operatortype_append_macro("GPENCIL_OT_duplicate_move", "Duplicate Strokes",
- "Make copies of the selected Grease Pencil strokes and move them",
- OPTYPE_UNDO | OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro(
+ "GPENCIL_OT_duplicate_move", "Duplicate Strokes",
+ "Make copies of the selected Grease Pencil strokes and move them",
+ OPTYPE_UNDO | OPTYPE_REGISTER);
WM_operatortype_macro_define(ot, "GPENCIL_OT_duplicate");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_boolean_set(otmacro->ptr, "gpencil_strokes", true);
-
+ RNA_enum_set(otmacro->ptr, "proportional", 0);
+ RNA_boolean_set(otmacro->ptr, "mirror", false);
+
+ /* Extrude + Move = Interactively add new points */
+ ot = WM_operatortype_append_macro(
+ "GPENCIL_OT_extrude_move", "Extrude Stroke Points",
+ "Extrude selected points and move them",
+ OPTYPE_UNDO | OPTYPE_REGISTER);
+ WM_operatortype_macro_define(ot, "GPENCIL_OT_extrude");
+ otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+ RNA_boolean_set(otmacro->ptr, "gpencil_strokes", true);
+ RNA_enum_set(otmacro->ptr, "proportional", 0);
+ RNA_boolean_set(otmacro->ptr, "mirror", false);
}
/* ****************************************** */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 204d6fe267a..a9d680fd7d9 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,18 +13,13 @@
* 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) 2008, Blender Foundation, Joshua Leung
+ * The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
- /** \file blender/editors/gpencil/gpencil_paint.c
- * \ingroup edgpencil
- */
-
+/** \file
+ * \ingroup edgpencil
+ */
#include <stdio.h>
#include <stddef.h>
@@ -76,7 +69,6 @@
#include "ED_view3d.h"
#include "ED_clip.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -119,85 +111,134 @@ typedef enum eGPencil_PaintFlags {
GP_PAINTFLAG_SELECTMASK = (1 << 3),
GP_PAINTFLAG_HARD_ERASER = (1 << 4),
GP_PAINTFLAG_STROKE_ERASER = (1 << 5),
+ GP_PAINTFLAG_REQ_VECTOR = (1 << 6),
} eGPencil_PaintFlags;
-
/* Temporary 'Stroke' Operation data
* "p" = op->customdata
*/
typedef struct tGPsdata {
bContext *C;
- Main *bmain; /* main database pointer */
- Scene *scene; /* current scene from context */
+ /** main database pointer. */
+ Main *bmain;
+ /** current scene from context. */
+ Scene *scene;
struct Depsgraph *depsgraph;
- Object *ob; /* current object */
- wmWindow *win; /* window where painting originated */
- ScrArea *sa; /* area where painting originated */
- ARegion *ar; /* region where painting originated */
- View2D *v2d; /* needed for GP_STROKE_2DSPACE */
- rctf *subrect; /* for using the camera rect within the 3d view */
+ /** current object. */
+ Object *ob;
+ /** window where painting originated. */
+ wmWindow *win;
+ /** area where painting originated. */
+ ScrArea *sa;
+ /** region where painting originated. */
+ ARegion *ar;
+ /** needed for GP_STROKE_2DSPACE. */
+ View2D *v2d;
+ /** for using the camera rect within the 3d view. */
+ rctf *subrect;
rctf subrect_data;
- GP_SpaceConversion gsc; /* settings to pass to gp_points_to_xy() */
-
- PointerRNA ownerPtr; /* pointer to owner of gp-datablock */
- bGPdata *gpd; /* gp-datablock layer comes from */
- bGPDlayer *gpl; /* layer we're working on */
- bGPDframe *gpf; /* frame we're working on */
-
- char *align_flag; /* projection-mode flags (toolsettings - eGPencil_Placement_Flags) */
+ /** settings to pass to gp_points_to_xy(). */
+ GP_SpaceConversion gsc;
- eGPencil_PaintStatus status; /* current status of painting */
- eGPencil_PaintModes paintmode; /* mode for painting */
- eGPencil_PaintFlags flags; /* flags that can get set during runtime (eGPencil_PaintFlags) */
-
- short radius; /* radius of influence for eraser */
-
- float mval[2]; /* current mouse-position */
- float mvalo[2]; /* previous recorded mouse-position */
-
- float pressure; /* current stylus pressure */
- float opressure; /* previous stylus pressure */
+ /** pointer to owner of gp-datablock. */
+ PointerRNA ownerPtr;
+ /** gp-datablock layer comes from. */
+ bGPdata *gpd;
+ /** layer we're working on. */
+ bGPDlayer *gpl;
+ /** frame we're working on. */
+ bGPDframe *gpf;
+
+ /** projection-mode flags (toolsettings - eGPencil_Placement_Flags) */
+ char *align_flag;
+
+ /** current status of painting. */
+ eGPencil_PaintStatus status;
+ /** mode for painting. */
+ eGPencil_PaintModes paintmode;
+ /** flags that can get set during runtime (eGPencil_PaintFlags) */
+ eGPencil_PaintFlags flags;
+
+ /** radius of influence for eraser. */
+ short radius;
+
+ /** current mouse-position. */
+ float mval[2];
+ /** previous recorded mouse-position. */
+ float mvalo[2];
+ /** initial recorded mouse-position */
+ float mvali[2];
+
+ /** current stylus pressure. */
+ float pressure;
+ /** previous stylus pressure. */
+ float opressure;
/* These need to be doubles, as (at least under unix) they are in seconds since epoch,
* float (and its 7 digits precision) is definitively not enough here!
* double, with its 15 digits precision, ensures us millisecond precision for a few centuries at least.
*/
- double inittime; /* Used when converting to path */
- double curtime; /* Used when converting to path */
- double ocurtime; /* Used when converting to path */
-
- float imat[4][4]; /* inverted transformation matrix applying when converting coords from screen-space
- * to region space */
+ /** Used when converting to path. */
+ double inittime;
+ /** Used when converting to path. */
+ double curtime;
+ /** Used when converting to path. */
+ double ocurtime;
+
+ /** Inverted transformation matrix applying when converting coords from screen-space
+ * to region space. */
+ float imat[4][4];
float mat[4][4];
- float custom_color[4]; /* custom color - hack for enforcing a particular color for track/mask editing */
+ /** custom color - hack for enforcing a particular color for track/mask editing. */
+ float custom_color[4];
- void *erasercursor; /* radial cursor data for drawing eraser */
+ /** radial cursor data for drawing eraser. */
+ void *erasercursor;
/* mat settings are only used for 3D view */
- Material *material; /* current material */
-
- Brush *brush; /* current drawing brush */
- Brush *eraser; /* default eraser brush */
- short straight[2]; /* 1: line horizontal, 2: line vertical, other: not defined, second element position */
- int lock_axis; /* lock drawing to one axis */
- bool disable_fill; /* the stroke is no fill mode */
+ /** current material */
+ Material *material;
+ /** current drawing brush */
+ Brush *brush;
+ /** default eraser brush */
+ Brush *eraser;
+
+ /** 1: line horizontal, 2: line vertical, other: not defined */
+ short straight;
+ /** lock drawing to one axis */
+ int lock_axis;
+ /** the stroke is no fill mode */
+ bool disable_fill;
RNG *rng;
- short keymodifier; /* key used for invoking the operator */
- short shift; /* shift modifier flag */
-
- float totpixlen; /* size in pixels for uv calculation */
+ /** key used for invoking the operator */
+ short keymodifier;
+ /** shift modifier flag */
+ short shift;
+ /** size in pixels for uv calculation */
+ float totpixlen;
+
+ /* guide */
+ /** guide spacing */
+ float guide_spacing;
+ /** half guide spacing */
+ float half_spacing;
+ /** origin */
+ float origin[2];
ReportList *reports;
} tGPsdata;
/* ------ */
+#define STROKE_HORIZONTAL 1
+#define STROKE_VERTICAL 2
+
/* Macros for accessing sensitivity thresholds... */
/* minimum number of pixels mouse should move before new point created */
#define MIN_MANHATTEN_PX (U.gp_manhattendist)
@@ -239,33 +280,33 @@ static bool gpencil_draw_poll(bContext *C)
{
if (ED_operator_regionactive(C)) {
ScrArea *sa = CTX_wm_area(C);
- if (!ELEM(sa->spacetype, SPACE_VIEW3D)) {
- /* check if current context can support GPencil data */
- if (ED_gpencil_data_get_pointers(C, NULL) != NULL) {
- /* check if Grease Pencil isn't already running */
- if (ED_gpencil_session_active() == 0)
- return 1;
- else
- CTX_wm_operator_poll_msg_set(C, "Grease Pencil operator is already active");
- }
- else {
- CTX_wm_operator_poll_msg_set(C, "Failed to find Grease Pencil data to draw into");
- }
- return 0;
- }
/* 3D Viewport */
- else {
- if (ED_gpencil_session_active() == 0) {
- return 1;
- }
- else {
- return 0;
- }
+ if (sa->spacetype != SPACE_VIEW3D) {
+ return false;
+ }
+
+ /* check if Grease Pencil isn't already running */
+ if (ED_gpencil_session_active() != 0) {
+ CTX_wm_operator_poll_msg_set(C, "Grease Pencil operator is already active");
+ return false;
+ }
+
+ /* only grease pencil object type */
+ Object *ob = CTX_data_active_object(C);
+ if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+ return false;
+ }
+
+ bGPdata *gpd = (bGPdata *)ob->data;
+ if (!GPENCIL_PAINT_MODE(gpd)) {
+ return false;
}
+
+ return true;
}
else {
CTX_wm_operator_poll_msg_set(C, "Active region not set");
- return 0;
+ return false;
}
}
@@ -293,11 +334,11 @@ static void gp_get_3d_reference(tGPsdata *p, float vec[3])
/* Stroke Editing ---------------------------- */
/* check if the current mouse position is suitable for adding a new point */
-static bool gp_stroke_filtermval(tGPsdata *p, const float mval[2], float pmval[2])
+static bool gp_stroke_filtermval(tGPsdata *p, const float mval[2], float mvalo[2])
{
Brush *brush = p->brush;
- int dx = (int)fabsf(mval[0] - pmval[0]);
- int dy = (int)fabsf(mval[1] - pmval[1]);
+ int dx = (int)fabsf(mval[0] - mvalo[0]);
+ int dy = (int)fabsf(mval[1] - mvalo[1]);
brush->gpencil_settings->flag &= ~GP_BRUSH_STABILIZE_MOUSE_TEMP;
/* if buffer is empty, just let this go through (i.e. so that dots will work) */
@@ -385,7 +426,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
* - nothing more needs to be done here, since view_autodist_simple() has already done it
*/
- /* verify valid zdepth, if it's wrong, the default darwing mode is used
+ /* verify valid zdepth, if it's wrong, the default drawing mode is used
* and the function doesn't return now */
if ((depth == NULL) || (*depth <= 1.0f)) {
return;
@@ -399,12 +440,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
/* Current method just converts each point in screen-coordinates to
* 3D-coordinates using the 3D-cursor as reference. In general, this
- * works OK, but it could of course be improved.
- *
- * TODO:
- * - investigate using nearest point(s) on a previous stroke as
- * reference point instead or as offset, for easier stroke matching
- */
+ * works OK, but it could of course be improved. */
gp_get_3d_reference(p, rvec);
zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL);
@@ -430,7 +466,8 @@ static void gp_brush_jitter(
float curvef = curvemapping_evaluateF(brush->gpencil_settings->curve_jitter, 0, pressure);
tmp_pressure = curvef * brush->gpencil_settings->draw_sensitivity;
}
- const float exfactor = (brush->gpencil_settings->draw_jitter + 2.0f) * (brush->gpencil_settings->draw_jitter + 2.0f); /* exponential value */
+ /* exponential value */
+ const float exfactor = (brush->gpencil_settings->draw_jitter + 2.0f) * (brush->gpencil_settings->draw_jitter + 2.0f);
const float fac = BLI_rng_get_float(rng) * exfactor * tmp_pressure;
/* Jitter is applied perpendicular to the mouse movement vector (2D space) */
float mvec[2], svec[2];
@@ -468,8 +505,10 @@ static void gp_brush_angle(bGPdata *gpd, Brush *brush, tGPspoint *pt, const floa
float fac;
float mpressure;
- float angle = brush->gpencil_settings->draw_angle; /* default angle of brush in radians */;
- float v0[2] = { cos(angle), sin(angle) }; /* angle vector of the brush with full thickness */
+ /* default angle of brush in radians */;
+ float angle = brush->gpencil_settings->draw_angle;
+ /* angle vector of the brush with full thickness */
+ float v0[2] = { cos(angle), sin(angle) };
/* Apply to first point (only if there are 2 points because before no data to do it ) */
if (gpd->runtime.sbuffer_size == 1) {
@@ -582,7 +621,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -597,7 +637,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -701,9 +742,9 @@ static short gp_stroke_addpoint(
pt->time = (float)(curtime - p->inittime);
/* point uv (only 3d view) */
- if ((p->sa->spacetype == SPACE_VIEW3D) && (gpd->runtime.sbuffer_size > 1)) {
+ if ((p->sa->spacetype == SPACE_VIEW3D) && (gpd->runtime.sbuffer_size > 0)) {
float pixsize = gp_style->texture_pixsize / 1000000.0f;
- tGPspoint *ptb = (tGPspoint *)gpd->runtime.sbuffer + gpd->runtime.sbuffer_size - 2;
+ tGPspoint *ptb = (tGPspoint *)gpd->runtime.sbuffer + gpd->runtime.sbuffer_size - 1;
bGPDspoint spt, spt2;
/* get origin to reproject point */
@@ -754,7 +795,8 @@ static short gp_stroke_addpoint(
/* store settings */
copy_v2_v2(&pt->x, mval);
- pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */
+ /* T44932 - Pressure vals are unreliable, so ignore for now */
+ pt->pressure = 1.0f;
pt->strength = 1.0f;
pt->time = (float)(curtime - p->inittime);
@@ -1200,6 +1242,13 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
}
}
+ /* post process stroke */
+ if ((p->brush->gpencil_settings->flag & GP_BRUSH_GROUP_SETTINGS) &&
+ p->brush->gpencil_settings->flag & GP_BRUSH_TRIM_STROKE)
+ {
+ BKE_gpencil_trim_stroke(gps);
+ }
+
gp_stroke_added_enable(p);
}
@@ -1301,9 +1350,10 @@ static void gp_free_stroke(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps)
gp_update_cache(gpd);
}
-/* analyze points to be removed when soft eraser is used
- * to avoid that segments gets the end points rounded. This
- * round cpas breaks the artistic effect.
+/**
+ * Analyze points to be removed when soft eraser is used
+ * to avoid that segments gets the end points rounded.
+ * The round caps breaks the artistic effect.
*/
static void gp_stroke_soft_refine(bGPDstroke *gps, const float cull_thresh)
{
@@ -1564,7 +1614,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
gp_stroke_soft_refine(gps, cull_thresh);
}
- gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false);
+ gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0);
}
gp_update_cache(p->gpd);
}
@@ -1682,7 +1732,7 @@ static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts)
Brush *brush_dft = NULL;
Paint *paint = &ts->gp_paint->paint;
Brush *brush_old = paint->brush;
- for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
if ((brush->ob_mode == OB_MODE_PAINT_GPENCIL) &&
(brush->gpencil_tool == GPAINT_TOOL_ERASE))
{
@@ -1717,6 +1767,25 @@ static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts)
}
}
+/* helper to set default eraser and disable others */
+static void gp_set_default_eraser(Main *bmain, Brush *brush_dft)
+{
+ if (brush_dft == NULL) {
+ return;
+ }
+
+ for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
+ if ((brush->gpencil_settings) && (brush->gpencil_tool == GPAINT_TOOL_ERASE)) {
+ if (brush == brush_dft) {
+ brush->gpencil_settings->flag |= GP_BRUSH_DEFAULT_ERASER;
+ }
+ else if (brush->gpencil_settings->flag & GP_BRUSH_DEFAULT_ERASER) {
+ brush->gpencil_settings->flag &= ~GP_BRUSH_DEFAULT_ERASER;
+ }
+ }
+ }
+}
+
/* initialize a drawing brush */
static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
{
@@ -1743,6 +1812,9 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
else {
p->eraser = paint->brush;
}
+ /* set new eraser as default */
+ gp_set_default_eraser(p->bmain, p->eraser);
+
/* use radius of eraser */
p->radius = (short)p->eraser->size;
@@ -1791,7 +1863,13 @@ static void gp_init_colors(tGPsdata *p)
if (gp_style) {
/* set colors */
- copy_v4_v4(gpd->runtime.scolor, gp_style->stroke_rgba);
+ if (gp_style->flag & GP_STYLE_STROKE_SHOW) {
+ copy_v4_v4(gpd->runtime.scolor, gp_style->stroke_rgba);
+ }
+ else {
+ /* if no stroke, use fill */
+ copy_v4_v4(gpd->runtime.scolor, gp_style->fill_rgba);
+ }
copy_v4_v4(gpd->runtime.sfill, gp_style->fill_rgba);
/* add some alpha to make easy the filling without hide strokes */
if (gpd->runtime.sfill[3] > 0.8f) {
@@ -1943,7 +2021,7 @@ static tGPsdata *gp_session_initpaint(bContext *C, wmOperator *op)
/* Create new context data */
p = MEM_callocN(sizeof(tGPsdata), "GPencil Drawing Data");
- /* Try to initialise context data
+ /* Try to initialize context data
* WARNING: This may not always succeed (e.g. using GP in an annotation-only context)
*/
if (gp_session_initdata(C, op, p) == 0) {
@@ -1976,7 +2054,7 @@ static void gp_session_cleanup(tGPsdata *p)
/* free stroke buffer */
if (gpd->runtime.sbuffer) {
/* printf("\t\tGP - free sbuffer\n"); */
- MEM_freeN(gpd->runtime.sbuffer);
+ MEM_SAFE_FREE(gpd->runtime.sbuffer);
gpd->runtime.sbuffer = NULL;
}
@@ -1991,10 +2069,10 @@ static void gp_session_free(tGPsdata *p)
if (p->rng != NULL) {
BLI_rng_free(p->rng);
}
+
MEM_freeN(p);
}
-
/* init new stroke */
static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Depsgraph *depsgraph)
{
@@ -2007,10 +2085,13 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
if (p->gpl == NULL) {
p->gpl = BKE_gpencil_layer_addnew(p->gpd, DATA_("GP_Layer"), true);
- 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) {
+ if ((paintmode != GP_PAINTMODE_ERASER) &&
+ (p->gpl->flag & GP_LAYER_LOCKED))
+ {
p->status = GP_STATUS_ERROR;
if (G.debug & G_DEBUG)
printf("Error: Cannot paint on locked layer\n");
@@ -2063,8 +2144,6 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
if (has_layer_to_erase == false) {
p->status = GP_STATUS_ERROR;
- //if (G.debug & G_DEBUG)
- printf("Error: Eraser will not be affecting anything (gpencil_paint_init)\n");
return;
}
}
@@ -2121,7 +2200,8 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true); /* no shift */
+ /* no shift */
+ ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true);
p->subrect = &p->subrect_data;
}
}
@@ -2418,35 +2498,60 @@ static void gpencil_draw_status_indicators(bContext *C, tGPsdata *p)
#endif
case GP_STATUS_IDLING:
+ {
/* print status info */
switch (p->paintmode) {
case GP_PAINTMODE_ERASER:
+ {
ED_workspace_status_text(C, IFACE_("Grease Pencil Erase Session: Hold and drag LMB or RMB to erase | "
"ESC/Enter to end (or click outside this area)"));
break;
+ }
case GP_PAINTMODE_DRAW_STRAIGHT:
+ {
ED_workspace_status_text(C, IFACE_("Grease Pencil Line Session: Hold and drag LMB to draw | "
"ESC/Enter to end (or click outside this area)"));
break;
+ }
+ case GP_PAINTMODE_SET_CP:
+ {
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Guides: LMB click and release to place reference point | "
+ "Esc/RMB to cancel"));
+ break;
+ }
case GP_PAINTMODE_DRAW:
- ED_workspace_status_text(C, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw"));
+ {
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+ if (guide->use_guide) {
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw | "
+ "M key to flip guide | O key to move reference point"));
+ }
+ else {
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw"));
+ }
break;
+ }
case GP_PAINTMODE_DRAW_POLY:
+ {
ED_workspace_status_text(C, IFACE_("Grease Pencil Poly Session: LMB click to place next stroke vertex | "
"Release Shift/ESC/Enter to end (or click outside this area)"));
break;
-
+ }
default: /* unhandled future cases */
+ {
ED_workspace_status_text(C, IFACE_("Grease Pencil Session: ESC/Enter to end (or click outside this area)"));
break;
+ }
}
break;
-
+ }
case GP_STATUS_ERROR:
case GP_STATUS_DONE:
+ {
/* clear status string */
ED_workspace_status_text(C, NULL);
break;
+ }
case GP_STATUS_PAINTING:
break;
}
@@ -2466,8 +2571,7 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra
gp_stroke_doeraser(p);
/* store used values */
- p->mvalo[0] = p->mval[0];
- p->mvalo[1] = p->mval[1];
+ copy_v2_v2(p->mvalo, p->mval);
p->opressure = p->pressure;
}
/* only add current point to buffer if mouse moved (even though we got an event, it might be just noise) */
@@ -2516,8 +2620,7 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra
}
/* store used values */
- p->mvalo[0] = p->mval[0];
- p->mvalo[1] = p->mval[1];
+ copy_v2_v2(p->mvalo, p->mval);
p->opressure = p->pressure;
p->ocurtime = p->curtime;
@@ -2536,45 +2639,102 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra
}
}
+/* Helper to rotate point around origin */
+static void gp_rotate_v2_v2v2fl(float v[2], const float p[2], const float origin[2], const float angle)
+{
+ float pt[2];
+ float r[2];
+ sub_v2_v2v2(pt, p, origin);
+ rotate_v2_v2fl(r, pt, angle);
+ add_v2_v2v2(v, r, origin);
+}
+
+/* Helper to snap value to grid */
+static float gp_snap_to_grid_fl(float v, const float offset, const float spacing)
+{
+ if (spacing > 0.0f) {
+ return roundf(v / spacing) * spacing + fmodf(offset, spacing);
+ }
+ else {
+ return v;
+ }
+}
+
+static void UNUSED_FUNCTION(gp_snap_to_grid_v2)(float v[2], const float offset[2], const float spacing)
+{
+ v[0] = gp_snap_to_grid_fl(v[0], offset[0], spacing);
+ v[1] = gp_snap_to_grid_fl(v[1], offset[1], spacing);
+}
+
+/* get reference point - screen coords to buffer coords */
+static void gp_origin_set(wmOperator *op, const int mval[2])
+{
+ tGPsdata *p = op->customdata;
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+ float origin[2];
+ float point[3];
+ copy_v2fl_v2i(origin, mval);
+ gp_stroke_convertcoords(p, origin, point, NULL);
+ if (guide->reference_point == GP_GUIDE_REF_CUSTOM) {
+ copy_v3_v3(guide->location, point);
+ }
+ else if (guide->reference_point == GP_GUIDE_REF_CURSOR) {
+ copy_v3_v3(p->scene->cursor.location, point);
+ }
+}
+
+/* get reference point - buffer coords to screen coords */
+static void gp_origin_get(tGPsdata *p, float origin[2])
+{
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+ float location[3];
+ if (guide->reference_point == GP_GUIDE_REF_CUSTOM) {
+ copy_v3_v3(location, guide->location);
+ }
+ else if (guide->reference_point == GP_GUIDE_REF_OBJECT &&
+ guide->reference_object != NULL)
+ {
+ copy_v3_v3(location, guide->reference_object->loc);
+ }
+ else {
+ copy_v3_v3(location, p->scene->cursor.location);
+ }
+ GP_SpaceConversion *gsc = &p->gsc;
+ gp_point_3d_to_xy(gsc, p->gpd->runtime.sbuffer_sflag, location, origin);
+}
+
/* handle draw event */
static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent *event, Depsgraph *depsgraph, float x, float y)
{
tGPsdata *p = op->customdata;
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
PointerRNA itemptr;
float mousef[2];
int tablet = 0;
/* convert from window-space to area-space mouse coordinates
* add any x,y override position for fake events
- * NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
*/
- p->mval[0] = event->mval[0] + 1.0f - x;
- p->mval[1] = event->mval[1] + 1.0f - y;
+ p->mval[0] = (float)event->mval[0] - x;
+ p->mval[1] = (float)event->mval[1] - y;
p->shift = event->shift;
- /* verify key status for straight lines */
- if ((event->alt > 0) && (RNA_boolean_get(op->ptr, "disable_straight") == false)) {
- if (p->straight[0] == 0) {
- int dx = (int)fabsf(p->mval[0] - p->mvalo[0]);
- int dy = (int)fabsf(p->mval[1] - p->mvalo[1]);
+ /* verify direction for straight lines */
+ if ((guide->use_guide) || ((event->alt > 0) && (RNA_boolean_get(op->ptr, "disable_straight") == false))) {
+ if (p->straight == 0) {
+ int dx = (int)fabsf(p->mval[0] - p->mvali[0]);
+ int dy = (int)fabsf(p->mval[1] - p->mvali[1]);
if ((dx > 0) || (dy > 0)) {
- /* check mouse direction to replace the other coordinate with previous values */
- if (dx >= dy) {
- /* horizontal */
- p->straight[0] = 1;
- p->straight[1] = (short)p->mval[1]; /* save y */
+ /* store mouse direction */
+ if (dx > dy) {
+ p->straight = STROKE_HORIZONTAL;
}
- else {
- /* vertical */
- p->straight[0] = 2;
- p->straight[1] = (short)p->mval[0]; /* save x */
+ else if (dx < dy) {
+ p->straight = STROKE_VERTICAL;
}
}
}
}
- else {
- p->straight[0] = 0;
- }
p->curtime = PIL_check_seconds_timer();
@@ -2622,29 +2782,161 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
if (p->flags & GP_PAINTFLAG_FIRSTRUN) {
p->flags &= ~GP_PAINTFLAG_FIRSTRUN;
- p->mvalo[0] = p->mval[0];
- p->mvalo[1] = p->mval[1];
+ /* set values */
+ copy_v2_v2(p->mvalo, p->mval);
p->opressure = p->pressure;
p->inittime = p->ocurtime = p->curtime;
- p->straight[0] = 0;
- p->straight[1] = 0;
+ p->straight = 0;
+
+ /* save initial mouse */
+ copy_v2_v2(p->mvali, p->mval);
+
+ /* calculate once and store snapping distance and origin */
+ RegionView3D * rv3d = p->ar->regiondata;
+ float scale = 1.0f;
+ if (rv3d->is_persp) {
+ float vec[3];
+ gp_get_3d_reference(p, vec);
+ mul_m4_v3(rv3d->persmat, vec);
+ scale = vec[2] * rv3d->pixsize;
+ }
+ else {
+ scale = rv3d->pixsize;
+ }
+ p->guide_spacing = guide->spacing / scale;
+ p->half_spacing = p->guide_spacing * 0.5f;
+ gp_origin_get(p, p->origin);
/* special exception here for too high pressure values on first touch in
* windows for some tablets, then we just skip first touch...
*/
- if (tablet && (p->pressure >= 0.99f))
+ if (tablet && (p->pressure >= 0.99f)) {
+ return;
+ }
+
+ /* special exception for grid snapping
+ * it requires direction which needs at least two points
+ */
+ if (!ELEM(p->paintmode, GP_PAINTMODE_ERASER, GP_PAINTMODE_SET_CP) &&
+ guide->use_guide &&
+ guide->use_snapping &&
+ (guide->type == GP_GUIDE_GRID))
+ {
+ p->flags |= GP_PAINTFLAG_REQ_VECTOR;
+ }
+ }
+
+ /* wait for vector then add initial point */
+ if (p->flags & GP_PAINTFLAG_REQ_VECTOR) {
+ if (p->straight == 0) {
return;
+ }
+
+ p->flags &= ~GP_PAINTFLAG_REQ_VECTOR;
+
+ /* create fake events */
+ float tmp[2];
+ float pt[2];
+ copy_v2_v2(tmp, p->mval);
+ sub_v2_v2v2(pt, p->mval, p->mvali);
+ gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), pt[0], pt[1]);
+ if (len_v2v2(p->mval, p->mvalo)) {
+ sub_v2_v2v2(pt, p->mval, p->mvalo);
+ gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), pt[0], pt[1]);
+ }
+ copy_v2_v2(p->mval, tmp);
}
- /* check if alt key is pressed and limit to straight lines */
- if ((p->paintmode != GP_PAINTMODE_ERASER) && (p->straight[0] != 0)) {
- if (p->straight[0] == 1) {
- /* horizontal */
- p->mval[1] = p->straight[1]; /* replace y */
+ /* check if stroke is straight or guided */
+ if ((p->paintmode != GP_PAINTMODE_ERASER) &&
+ ((p->straight) || (guide->use_guide)))
+ {
+ /* guided stroke */
+ if (guide->use_guide) {
+ switch (guide->type) {
+ default:
+ case GP_GUIDE_CIRCULAR:
+ {
+ float distance;
+ distance = len_v2v2(p->mvali, p->origin);
+
+ if (guide->use_snapping && (guide->spacing > 0.0f)) {
+ distance = gp_snap_to_grid_fl(distance, 0.0f, p->guide_spacing);
+ }
+
+ dist_ensure_v2_v2fl(p->mval, p->origin, distance);
+ break;
+ }
+ case GP_GUIDE_RADIAL:
+ {
+ if (guide->use_snapping && (guide->angle_snap > 0.0f)) {
+ float point[2];
+ float xy[2];
+ float angle;
+ float half_angle = guide->angle_snap * 0.5f;
+ sub_v2_v2v2(xy, p->mvali, p->origin);
+ angle = atan2f(xy[1], xy[0]);
+ angle += (M_PI * 2.0f);
+ angle = fmodf(angle + half_angle, guide->angle_snap);
+ angle -= half_angle;
+ gp_rotate_v2_v2v2fl(point, p->mvali, p->origin, -angle);
+ closest_to_line_v2(p->mval, p->mval, point, p->origin);
+ }
+ else {
+ closest_to_line_v2(p->mval, p->mval, p->mvali, p->origin);
+ }
+ break;
+ }
+ case GP_GUIDE_PARALLEL:
+ {
+ float point[2];
+ float unit[2];
+ copy_v2_v2(unit, p->mvali);
+ unit[0] += 1.0f; /* start from horizontal */
+ gp_rotate_v2_v2v2fl(point, unit, p->mvali, guide->angle);
+ closest_to_line_v2(p->mval, p->mval, p->mvali, point);
+
+ if (guide->use_snapping && (guide->spacing > 0.0f)) {
+ gp_rotate_v2_v2v2fl(p->mval, p->mval, p->origin, -guide->angle);
+ p->mval[1] = gp_snap_to_grid_fl(p->mval[1] - p->half_spacing, p->origin[1], p->guide_spacing);
+ gp_rotate_v2_v2v2fl(p->mval, p->mval, p->origin, guide->angle);
+ }
+ break;
+ }
+ case GP_GUIDE_GRID:
+ {
+ if (guide->use_snapping && (guide->spacing > 0.0f)) {
+ float point[2];
+ float unit[2];
+ float angle;
+ copy_v2_v2(unit, p->mvali);
+ unit[0] += 1.0f; /* start from horizontal */
+ angle = (p->straight == STROKE_VERTICAL) ? M_PI_2 : 0.0f;
+ gp_rotate_v2_v2v2fl(point, unit, p->mvali, angle);
+ closest_to_line_v2(p->mval, p->mval, p->mvali, point);
+
+ if (p->straight == STROKE_HORIZONTAL) {
+ p->mval[1] = gp_snap_to_grid_fl(p->mval[1] - p->half_spacing, p->origin[1], p->guide_spacing);
+ }
+ else {
+ p->mval[0] = gp_snap_to_grid_fl(p->mval[0] - p->half_spacing, p->origin[0], p->guide_spacing);
+ }
+ }
+ else if (p->straight == STROKE_HORIZONTAL) {
+ p->mval[1] = p->mvali[1]; /* replace y */
+ }
+ else {
+ p->mval[0] = p->mvali[0]; /* replace x */
+ }
+ break;
+ }
+ }
+ }
+ else if (p->straight == STROKE_HORIZONTAL) {
+ p->mval[1] = p->mvali[1]; /* replace y */
}
else {
- /* vertical */
- p->mval[0] = p->straight[1]; /* replace x */
+ p->mval[0] = p->mvali[0]; /* replace x */
}
}
@@ -2663,7 +2955,8 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
gpencil_draw_apply(C, op, p, depsgraph);
/* force refresh */
- ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
+ /* just active area for now, since doing whole screen is too slow */
+ ED_region_tag_redraw(p->ar);
}
/* ------------------------------- */
@@ -2698,8 +2991,8 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op)
/* get relevant data for this point from stroke */
RNA_float_get_array(&itemptr, "mouse", mousef);
- p->mval[0] = (int)mousef[0];
- p->mval[1] = (int)mousef[1];
+ p->mval[0] = mousef[0];
+ p->mval[1] = mousef[1];
p->pressure = RNA_float_get(&itemptr, "pressure");
p->curtime = (double)RNA_float_get(&itemptr, "time") + p->inittime;
@@ -2743,10 +3036,102 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op)
/* ------------------------------- */
+/* handle events for guides */
+static void gpencil_guide_event_handling(bContext *C, wmOperator *op, const wmEvent *event, tGPsdata *p)
+{
+ bool add_notifier = false;
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+
+ /* Enter or exit set center point mode */
+ if ((event->type == OKEY) && (event->val == KM_RELEASE)) {
+ if (p->paintmode == GP_PAINTMODE_DRAW && guide->reference_point != GP_GUIDE_REF_OBJECT) {
+ add_notifier = true;
+ p->paintmode = GP_PAINTMODE_SET_CP;
+ ED_gpencil_toggle_brush_cursor(C, false, NULL);
+ }
+ }
+ /* Freehand mode, turn off speed guide */
+ else if ((event->type == VKEY) && (event->val == KM_RELEASE)) {
+ guide->use_guide = false;
+ add_notifier = true;
+ }
+ /* Alternate or flip direction */
+ else if ((event->type == MKEY) && (event->val == KM_RELEASE)) {
+ if (guide->type == GP_GUIDE_CIRCULAR) {
+ add_notifier = true;
+ guide->type = GP_GUIDE_RADIAL;
+ }
+ else if (guide->type == GP_GUIDE_RADIAL) {
+ add_notifier = true;
+ guide->type = GP_GUIDE_CIRCULAR;
+ }
+ else if (guide->type == GP_GUIDE_PARALLEL) {
+ add_notifier = true;
+ guide->angle += M_PI_2;
+ guide->angle = angle_compat_rad(guide->angle, M_PI);
+ }
+ else {
+ add_notifier = false;
+ }
+ }
+ /* Line guides */
+ else if ((event->type == LKEY) && (event->val == KM_RELEASE)) {
+ add_notifier = true;
+ guide->use_guide = true;
+ if (event->ctrl) {
+ guide->angle = 0.0f;
+ guide->type = GP_GUIDE_PARALLEL;
+ }
+ else if (event->alt) {
+ guide->type = GP_GUIDE_PARALLEL;
+ guide->angle = RNA_float_get(op->ptr, "guide_last_angle");
+ }
+ else {
+ guide->type = GP_GUIDE_PARALLEL;
+ }
+ }
+ /* Point guide */
+ else if ((event->type == CKEY) && (event->val == KM_RELEASE)) {
+ add_notifier = true;
+ if (!guide->use_guide) {
+ guide->use_guide = true;
+ guide->type = GP_GUIDE_CIRCULAR;
+ }
+ else if (guide->type == GP_GUIDE_CIRCULAR) {
+ guide->type = GP_GUIDE_RADIAL;
+ }
+ else if (guide->type == GP_GUIDE_RADIAL) {
+ guide->type = GP_GUIDE_CIRCULAR;
+ }
+ else {
+ guide->type = GP_GUIDE_CIRCULAR;
+ }
+ }
+ /* Change line angle */
+ else if (ELEM(event->type, JKEY, KKEY) && (event->val == KM_RELEASE)) {
+ add_notifier = true;
+ float angle = guide->angle;
+ float adjust = (float)M_PI / 180.0f;
+ if (event->alt)
+ adjust *= 45.0f;
+ else if (!event->shift)
+ adjust *= 15.0f;
+ angle += (event->type == JKEY) ? adjust : -adjust;
+ angle = angle_compat_rad(angle, M_PI);
+ guide->angle = angle;
+ }
+
+ if (add_notifier) {
+ WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS | NC_GPENCIL | NA_EDITED, NULL);
+ }
+}
+
/* start of interactive drawing part of operator */
static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
tGPsdata *p = NULL;
+ Object *ob = CTX_data_active_object(C);
+ bGPdata *gpd = (bGPdata *)ob->data;
if (G.debug & G_DEBUG)
printf("GPencil - Starting Drawing\n");
@@ -2756,6 +3141,33 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
RNA_enum_set(op->ptr, "mode", GP_PAINTMODE_ERASER);
}
+ /* do not draw in locked or invisible layers */
+ eGPencil_PaintModes paintmode = RNA_enum_get(op->ptr, "mode");
+ if (paintmode != GP_PAINTMODE_ERASER) {
+ bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
+ if ((gpl) && ((gpl->flag & GP_LAYER_LOCKED) || (gpl->flag & GP_LAYER_HIDE))) {
+ BKE_report(op->reports, RPT_ERROR, "Active layer is locked or hide");
+ return OPERATOR_CANCELLED;
+ }
+ }
+ else {
+ /* don't erase empty frames */
+ bool has_layer_to_erase = false;
+ for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ /* Skip if layer not editable */
+ if (gpencil_layer_is_editable(gpl)) {
+ if (gpl->actframe && gpl->actframe->strokes.first) {
+ has_layer_to_erase = true;
+ break;
+ }
+ }
+ }
+ if (!has_layer_to_erase) {
+ BKE_report(op->reports, RPT_ERROR, "Nothing to erase or all layers locked");
+ return OPERATOR_FINISHED;
+ }
+ }
+
/* try to initialize context data needed while drawing */
if (!gpencil_draw_init(C, op, event)) {
if (op->customdata)
@@ -2792,7 +3204,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
p->status = GP_STATUS_PAINTING;
/* handle the initial drawing - i.e. for just doing a simple dot */
- gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), 0, 0);
+ gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), 0.0f, 0.0f);
op->flag |= OP_IS_MODAL_CURSOR_REGION;
}
else {
@@ -2802,22 +3214,24 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
}
/* enable paint mode */
- if (p->sa->spacetype == SPACE_VIEW3D) {
- Object *ob = CTX_data_active_object(C);
- if (ob && (ob->type == OB_GPENCIL) && ((p->gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0)) {
- /* FIXME: use the mode switching operator, this misses notifiers, messages. */
- /* Just set paintmode flag... */
- p->gpd->flag |= GP_DATA_STROKE_PAINTMODE;
- /* disable other GP modes */
- p->gpd->flag &= ~GP_DATA_STROKE_EDITMODE;
- p->gpd->flag &= ~GP_DATA_STROKE_SCULPTMODE;
- p->gpd->flag &= ~GP_DATA_STROKE_WEIGHTMODE;
- /* set workspace mode */
- ob->restore_mode = ob->mode;
- ob->mode = OB_MODE_PAINT_GPENCIL;
- /* redraw mode on screen */
- WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
- }
+ /* handle speed guide events before drawing inside view3d */
+ if (!ELEM(p->paintmode, GP_PAINTMODE_ERASER, GP_PAINTMODE_SET_CP)) {
+ gpencil_guide_event_handling(C, op, event, p);
+ }
+
+ if (ob && (ob->type == OB_GPENCIL) && ((p->gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0)) {
+ /* FIXME: use the mode switching operator, this misses notifiers, messages. */
+ /* Just set paintmode flag... */
+ p->gpd->flag |= GP_DATA_STROKE_PAINTMODE;
+ /* disable other GP modes */
+ p->gpd->flag &= ~GP_DATA_STROKE_EDITMODE;
+ p->gpd->flag &= ~GP_DATA_STROKE_SCULPTMODE;
+ p->gpd->flag &= ~GP_DATA_STROKE_WEIGHTMODE;
+ /* set workspace mode */
+ ob->restore_mode = ob->mode;
+ ob->mode = OB_MODE_PAINT_GPENCIL;
+ /* redraw mode on screen */
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
}
WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
@@ -2908,12 +3322,21 @@ static void gpencil_move_last_stroke_to_back(bContext *C)
static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEvent *event, tGPsdata *p)
{
Brush *brush = p->brush;
- if (brush->gpencil_settings->input_samples == 0) {
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+ int input_samples = brush->gpencil_settings->input_samples;
+
+ /* ensure sampling when using circular guide */
+ if (guide->use_guide && (guide->type == GP_GUIDE_CIRCULAR)) {
+ input_samples = GP_MAX_INPUT_SAMPLES;
+ }
+
+ if (input_samples == 0) {
return;
}
+
RegionView3D *rv3d = p->ar->regiondata;
float defaultpixsize = rv3d->pixsize * 1000.0f;
- int samples = (GP_MAX_INPUT_SAMPLES - brush->gpencil_settings->input_samples + 1);
+ int samples = (GP_MAX_INPUT_SAMPLES - input_samples + 1);
float thickness = (float)brush->size;
float pt[2], a[2], b[2];
@@ -2947,8 +3370,8 @@ static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEven
float factor = ((thickness * dot_factor) / scale) * samples;
copy_v2_v2(a, p->mvalo);
- b[0] = event->mval[0] + 1;
- b[1] = event->mval[1] + 1;
+ b[0] = (float)event->mval[0] + 1.0f;
+ b[1] = (float)event->mval[1] + 1.0f;
/* get distance in pixels */
float dist = len_v2v2(a, b);
@@ -2959,7 +3382,7 @@ static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEven
sub_v2_v2v2(pt, b, pt);
/* create fake event */
gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C),
- (int)pt[0], (int)pt[1]);
+ pt[0], pt[1]);
}
else if (dist >= factor) {
int slices = 2 + (int)((dist - 1.0) / factor);
@@ -2969,7 +3392,7 @@ static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEven
sub_v2_v2v2(pt, b, pt);
/* create fake event */
gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C),
- (int)pt[0], (int)pt[1]);
+ pt[0], pt[1]);
}
}
}
@@ -2979,7 +3402,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
tGPsdata *p = op->customdata;
ToolSettings *ts = CTX_data_tool_settings(C);
- int estate = OPERATOR_PASS_THROUGH; /* default exit state - pass through to support MMB view nav, etc. */
+ GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide;
+ /* default exit state - pass through to support MMB view nav, etc. */
+ int estate = OPERATOR_PASS_THROUGH;
/* if (event->type == NDOF_MOTION)
* return OPERATOR_PASS_THROUGH;
@@ -2999,6 +3424,43 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
p->ar = ar;
}
+ /* special mode for editing control points */
+ if (p->paintmode == GP_PAINTMODE_SET_CP) {
+ wmWindow *win = p->win;
+ WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR);
+ bool drawmode = false;
+
+ switch (event->type) {
+ /* cancel */
+ case ESCKEY:
+ case RIGHTMOUSE:
+ {
+ if (ELEM(event->val, KM_RELEASE)) {
+ drawmode = true;
+ }
+ break;
+ }
+ /* set */
+ case LEFTMOUSE:
+ {
+ if (ELEM(event->val, KM_RELEASE)) {
+ gp_origin_set(op, event->mval);
+ drawmode = true;
+ }
+ break;
+ }
+ }
+ if (drawmode) {
+ p->status = GP_STATUS_IDLING;
+ p->paintmode = GP_PAINTMODE_DRAW;
+ ED_gpencil_toggle_brush_cursor(C, true, NULL);
+ DEG_id_tag_update(&p->scene->id, ID_RECALC_COPY_ON_WRITE);
+ }
+ else {
+ return OPERATOR_RUNNING_MODAL;
+ }
+ }
+
/* we don't pass on key events, GP is used with key-modifiers - prevents Dkey to insert drivers */
if (ISKEYBOARD(event->type)) {
if (ELEM(event->type, LEFTARROWKEY, DOWNARROWKEY, RIGHTARROWKEY, UPARROWKEY, ZKEY)) {
@@ -3022,6 +3484,10 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
WM_operator_name_call(C, "GPENCIL_OT_blank_frame_add", WM_OP_EXEC_DEFAULT, NULL);
estate = OPERATOR_RUNNING_MODAL;
}
+ else if ((!ELEM(p->paintmode, GP_PAINTMODE_ERASER, GP_PAINTMODE_SET_CP))) {
+ gpencil_guide_event_handling(C, op, event, p);
+ estate = OPERATOR_RUNNING_MODAL;
+ }
else {
estate = OPERATOR_RUNNING_MODAL;
}
@@ -3046,6 +3512,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
}
+
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}
@@ -3206,6 +3673,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
else if (event->val == KM_RELEASE) {
p->status = GP_STATUS_IDLING;
op->flag |= OP_IS_MODAL_CURSOR_REGION;
+ ED_region_tag_redraw(p->ar);
}
}
@@ -3215,9 +3683,12 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (p->flags & GP_PAINTFLAG_FIRSTRUN)) {
/* handle drawing event */
/* printf("\t\tGP - add point\n"); */
- gpencil_add_missing_events(C, op, event, p);
- gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), 0, 0);
+ if ((!(p->flags & GP_PAINTFLAG_FIRSTRUN)) && guide->use_guide) {
+ gpencil_add_missing_events(C, op, event, p);
+ }
+
+ gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), 0.0f, 0.0f);
/* finish painting operation if anything went wrong just now */
if (p->status == GP_STATUS_ERROR) {
@@ -3254,7 +3725,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
/* force refresh */
- ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
+ /* just active area for now, since doing whole screen is too slow */
+ ED_region_tag_redraw(p->ar);
/* event handled, so just tag as running modal */
estate = OPERATOR_RUNNING_MODAL;
@@ -3280,6 +3752,13 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* process last operations before exiting */
switch (estate) {
case OPERATOR_FINISHED:
+ /* store stroke angle for parallel guide */
+ if ((p->straight == 0) || (guide->use_guide && (guide->type == GP_GUIDE_CIRCULAR))) {
+ float xy[2];
+ sub_v2_v2v2(xy, p->mval, p->mvali);
+ float angle = atan2f(xy[1], xy[0]);
+ RNA_float_set(op->ptr, "guide_last_angle", angle);
+ }
/* one last flush before we're done */
gpencil_draw_exit(C, op);
WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
@@ -3309,7 +3788,7 @@ static const EnumPropertyItem prop_gpencil_drawmodes[] = {
{GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", "Draw straight line segment(s)"},
{GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", "Click to place endpoints of straight line segments (connected)"},
{GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", "Erase Grease Pencil strokes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
void GPENCIL_OT_draw(wmOperatorType *ot)
@@ -3337,7 +3816,8 @@ void GPENCIL_OT_draw(wmOperatorType *ot)
prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
- /* NOTE: wait for input is enabled by default, so that all UI code can work properly without needing users to know about this */
+ /* NOTE: wait for input is enabled by default,
+ * so that all UI code can work properly without needing users to know about this */
prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "Wait for first click instead of painting immediately");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
@@ -3346,4 +3826,48 @@ void GPENCIL_OT_draw(wmOperatorType *ot)
prop = RNA_def_boolean(ot->srna, "disable_fill", false, "No Fill Areas", "Disable fill to use stroke as fill boundary");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+ /* guides */
+ prop = RNA_def_float(ot->srna, "guide_last_angle", 0.0f, -10000.0f, 10000.0f, "Angle", "Speed guide angle", -10000.0f, 10000.0f);
+}
+
+/* additional OPs */
+
+static int gpencil_guide_rotate(bContext *C, wmOperator *op)
+{
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ GP_Sculpt_Guide *guide = &ts->gp_sculpt.guide;
+ float angle = RNA_float_get(op->ptr, "angle");
+ bool increment = RNA_boolean_get(op->ptr, "increment");
+ if (increment) {
+ float oldangle = guide->angle;
+ oldangle += angle;
+ guide->angle = angle_compat_rad(oldangle, M_PI);
+ }
+ else {
+ guide->angle = angle_compat_rad(angle, M_PI);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_guide_rotate(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Rotate Guide Angle";
+ ot->idname = "GPENCIL_OT_guide_rotate";
+ ot->description = "Rotate guide angle";
+
+ /* api callbacks */
+ ot->exec = gpencil_guide_rotate;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_boolean(ot->srna, "increment", true, "Increment", "Increment angle");
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ prop = RNA_def_float(ot->srna, "angle", 0.0f, -10000.0f, 10000.0f, "Angle", "Guide angle", -10000.0f, 10000.0f);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
}
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 6849e876bf5..a7f0d2c47f4 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Operators for creating new Grease Pencil primitives (boxes, circles, ...)
*/
- /** \file blender/editors/gpencil/gpencil_primitive.c
- * \ingroup edgpencil
- */
-
+/** \file
+ * \ingroup edgpencil
+ */
#include <stdio.h>
#include <string.h>
@@ -174,7 +166,14 @@ static void gp_init_colors(tGPDprimitive *p)
if (gp_style) {
/* set colors */
- copy_v4_v4(gpd->runtime.scolor, gp_style->stroke_rgba);
+ if (gp_style->flag & GP_STYLE_STROKE_SHOW) {
+ copy_v4_v4(gpd->runtime.scolor, gp_style->stroke_rgba);
+ }
+ else {
+ /* if no stroke, use fill */
+ copy_v4_v4(gpd->runtime.scolor, gp_style->fill_rgba);
+ }
+
copy_v4_v4(gpd->runtime.sfill, gp_style->fill_rgba);
/* add some alpha to make easy the filling without hide strokes */
if (gpd->runtime.sfill[3] > 0.8f) {
@@ -248,6 +247,16 @@ static void gp_primitive_update_cps(tGPDprimitive *tgpi)
}
}
+/* Helper to reflect point */
+static void UNUSED_FUNCTION(gp_reflect_point_v2_v2v2v2)(
+ float va[2], const float p[2], const float a[2], const float b[2])
+{
+ float point[2];
+ closest_to_line_v2(point, p, a, b);
+ va[0] = point[0] - (p[0] - point[0]);
+ va[1] = point[1] - (p[1] - point[1]);
+}
+
/* Poll callback for primitive operators */
static bool gpencil_primitive_add_poll(bContext *C)
{
@@ -513,26 +522,16 @@ static void gp_primitive_rectangle(tGPDprimitive *tgpi, tGPspoint *points2D)
/* create a line */
static void gp_primitive_line(tGPDprimitive *tgpi, tGPspoint *points2D)
{
- if (tgpi->tot_edges == 2) {
- int i = tgpi->tot_stored_edges;
-
- points2D[i].x = tgpi->start[0];
- points2D[i].y = tgpi->start[1];
-
- points2D[i + 1].x = tgpi->end[0];
- points2D[i + 1].y = tgpi->end[1];
- }
- else {
- const int totpoints = (tgpi->tot_edges + tgpi->tot_stored_edges);
- const float step = 1.0f / (float)(tgpi->tot_edges - 1);
- float a = tgpi->tot_stored_edges ? step : 0.0f;
+ const int totpoints = (tgpi->tot_edges + tgpi->tot_stored_edges);
+ const float step = 1.0f / (float)(tgpi->tot_edges - 1);
+ float a = tgpi->tot_stored_edges ? step : 0.0f;
- for (int i = tgpi->tot_stored_edges; i < totpoints; i++) {
- tGPspoint *p2d = &points2D[i];
- interp_v2_v2v2(&p2d->x, tgpi->start, tgpi->end, a);
- a += step;
- }
+ for (int i = tgpi->tot_stored_edges; i < totpoints; i++) {
+ tGPspoint *p2d = &points2D[i];
+ interp_v2_v2v2(&p2d->x, tgpi->start, tgpi->end, a);
+ a += step;
}
+
float color[4];
UI_GetThemeColor4fv(TH_GIZMO_PRIMARY, color);
gp_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL);
@@ -677,23 +676,25 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
/* compute screen-space coordinates for points */
tGPspoint *points2D = tgpi->points;
- switch (tgpi->type) {
- case GP_STROKE_BOX:
- gp_primitive_rectangle(tgpi, points2D);
- break;
- case GP_STROKE_LINE:
- gp_primitive_line(tgpi, points2D);
- break;
- case GP_STROKE_CIRCLE:
- gp_primitive_circle(tgpi, points2D);
- break;
- case GP_STROKE_ARC:
- gp_primitive_arc(tgpi, points2D);
- break;
- case GP_STROKE_CURVE:
- gp_primitive_bezier(tgpi, points2D);
- default:
- break;
+ if (tgpi->tot_edges > 1) {
+ switch (tgpi->type) {
+ case GP_STROKE_BOX:
+ gp_primitive_rectangle(tgpi, points2D);
+ break;
+ case GP_STROKE_LINE:
+ gp_primitive_line(tgpi, points2D);
+ break;
+ case GP_STROKE_CIRCLE:
+ gp_primitive_circle(tgpi, points2D);
+ break;
+ case GP_STROKE_ARC:
+ gp_primitive_arc(tgpi, points2D);
+ break;
+ case GP_STROKE_CURVE:
+ gp_primitive_bezier(tgpi, points2D);
+ default:
+ break;
+ }
}
/* convert screen-coordinates to 3D coordinates */
@@ -913,7 +914,36 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
tpt->pressure = pressure;
tpt->strength = strength;
tpt->time = p2d->time;
- tpt->uv_fac = 1.0f;
+
+ /* point uv */
+ if (gpd->runtime.sbuffer_size > 0) {
+ MaterialGPencilStyle *gp_style = tgpi->mat->gp_style;
+ const float pixsize = gp_style->texture_pixsize / 1000000.0f;
+ tGPspoint *tptb = (tGPspoint *)gpd->runtime.sbuffer + gpd->runtime.sbuffer_size - 1;
+ bGPDspoint spt, spt2;
+
+ /* get origin to reproject point */
+ float origin[3];
+ ED_gp_get_drawing_reference(tgpi->scene, tgpi->ob, tgpi->gpl,
+ ts->gpencil_v3d_align, origin);
+ /* reproject current */
+ ED_gpencil_tpoint_to_point(tgpi->ar, origin, tpt, &spt);
+ ED_gp_project_point_to_plane(tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt);
+
+ /* reproject previous */
+ ED_gpencil_tpoint_to_point(tgpi->ar, origin, tptb, &spt2);
+ ED_gp_project_point_to_plane(tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt2);
+ tgpi->totpixlen += len_v3v3(&spt.x, &spt2.x) / pixsize;
+ tpt->uv_fac = tgpi->totpixlen;
+ if ((gp_style) && (gp_style->sima)) {
+ tpt->uv_fac /= gp_style->sima->gen_x;
+ }
+ }
+ else {
+ tgpi->totpixlen = 0.0f;
+ tpt->uv_fac = 0.0f;
+ }
+
tpt->uv_rot = p2d->uv_rot;
gpd->runtime.sbuffer_size++;
@@ -933,7 +963,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
pt->strength = strength;
pt->time = 0.0f;
pt->flag = 0;
- pt->uv_fac = 1.0f;
+ pt->uv_fac = tpt->uv_fac;
if (gps->dvert != NULL) {
MDeformVert *dvert = &gps->dvert[i];
@@ -1205,6 +1235,9 @@ static void gpencil_primitive_interaction_end(bContext *C, wmOperator *op, wmWin
gps->thickness = tgpi->brush->size;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
+
+ /* calculate UVs along the stroke */
+ ED_gpencil_calc_stroke_uv(tgpi->ob, gps);
}
/* transfer stroke from temporary buffer to the actual frame */
@@ -1321,7 +1354,7 @@ static void gpencil_primitive_edit_event_handling(bContext *C, wmOperator *op, w
{
if ((event->val == KM_PRESS) &&
(tgpi->curve) &&
- (tgpi->orign_type == GP_STROKE_ARC))
+ (ELEM(tgpi->orign_type, GP_STROKE_ARC) ))
{
tgpi->flip ^= 1;
gp_primitive_update_cps(tgpi);
@@ -1433,21 +1466,27 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e
switch (event->type) {
case MOUSEMOVE:
+ {
gpencil_primitive_move(tgpi, false);
gpencil_primitive_update(C, op, tgpi);
break;
+ }
case ESCKEY:
case LEFTMOUSE:
+ {
zero_v2(tgpi->move);
tgpi->flag = IN_CURVE_EDIT;
break;
+ }
case RIGHTMOUSE:
+ {
if (event->val == KM_RELEASE) {
tgpi->flag = IN_CURVE_EDIT;
gpencil_primitive_move(tgpi, true);
gpencil_primitive_update(C, op, tgpi);
}
break;
+ }
}
copy_v2_v2(tgpi->mvalo, tgpi->mval);
return OPERATOR_RUNNING_MODAL;
@@ -1543,7 +1582,19 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e
/* done! */
return OPERATOR_FINISHED;
}
- case RIGHTMOUSE: /* cancel */
+ case RIGHTMOUSE:
+ {
+ /* exception to cancel current stroke when we have previous strokes in buffer */
+ if (tgpi->tot_stored_edges > 0) {
+ tgpi->flag = IDLE;
+ tgpi->tot_edges = 0;
+ gp_primitive_update_strokes(C, tgpi);
+ gpencil_primitive_interaction_end(C, op, win, tgpi);
+ /* done! */
+ return OPERATOR_FINISHED;
+ }
+ ATTR_FALLTHROUGH;
+ }
case ESCKEY:
{
/* return to normal cursor and header status */
@@ -1723,7 +1774,7 @@ void GPENCIL_OT_primitive(wmOperatorType *ot)
{GP_STROKE_CIRCLE, "CIRCLE", 0, "Circle", ""},
{GP_STROKE_ARC, "ARC", 0, "Arc", ""},
{GP_STROKE_CURVE, "CURVE", 0, "Curve", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c
index fff753cf3a9..0862a8661a3 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_select.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
#include <stdio.h>
@@ -108,90 +102,7 @@ static int gpencil_select_all_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* for "toggle", test for existing selected strokes */
- if (action == SEL_TOGGLE) {
- action = SEL_SELECT;
-
- CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
- {
- if (gps->flag & GP_STROKE_SELECT) {
- action = SEL_DESELECT;
- break; // XXX: this only gets out of the inner loop...
- }
- }
- CTX_DATA_END;
- }
-
- /* if deselecting, we need to deselect strokes across all frames
- * - Currently, an exception is only given for deselection
- * Selecting and toggling should only affect what's visible,
- * while deselecting helps clean up unintended/forgotten
- * stuff on other frames
- */
- if (action == SEL_DESELECT) {
- /* deselect strokes across editable layers
- * NOTE: we limit ourselves to editable layers, since once a layer is "locked/hidden
- * nothing should be able to touch it
- */
- CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
- {
- bGPDframe *gpf;
-
- /* deselect all strokes on all frames */
- for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
- bGPDstroke *gps;
-
- for (gps = gpf->strokes.first; gps; gps = gps->next) {
- bGPDspoint *pt;
- int i;
-
- /* only edit strokes that are valid in this view... */
- if (ED_gpencil_stroke_can_use(C, gps)) {
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- pt->flag &= ~GP_SPOINT_SELECT;
- }
-
- gps->flag &= ~GP_STROKE_SELECT;
- }
- }
- }
- }
- CTX_DATA_END;
- }
- else {
- /* select or deselect all strokes */
- CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
- {
- bGPDspoint *pt;
- int i;
- bool selected = false;
-
- /* Change selection status of all points, then make the stroke match */
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- switch (action) {
- case SEL_SELECT:
- pt->flag |= GP_SPOINT_SELECT;
- break;
- //case SEL_DESELECT:
- // pt->flag &= ~GP_SPOINT_SELECT;
- // break;
- case SEL_INVERT:
- pt->flag ^= GP_SPOINT_SELECT;
- break;
- }
-
- if (pt->flag & GP_SPOINT_SELECT)
- selected = true;
- }
-
- /* Change status of stroke */
- if (selected)
- gps->flag |= GP_STROKE_SELECT;
- else
- gps->flag &= ~GP_STROKE_SELECT;
- }
- CTX_DATA_END;
- }
+ ED_gpencil_select_toggle_all(C, action);
/* updates */
DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
@@ -509,7 +420,7 @@ void GPENCIL_OT_select_grouped(wmOperatorType *ot)
static const EnumPropertyItem prop_select_grouped_types[] = {
{GP_SEL_SAME_LAYER, "LAYER", 0, "Layer", "Shared layers"},
{GP_SEL_SAME_MATERIAL, "MATERIAL", 0, "Material", "Shared materials"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -861,11 +772,14 @@ void GPENCIL_OT_select_less(wmOperatorType *ot)
* It would be great to de-duplicate the logic here sometime, but that can wait...
*/
static bool gp_stroke_do_circle_sel(
+ bGPDlayer *gpl,
bGPDstroke *gps, GP_SpaceConversion *gsc,
const int mx, const int my, const int radius,
- const bool select, rcti *rect, float diff_mat[4][4], const int selectmode)
+ const bool select, rcti *rect, float diff_mat[4][4], const int selectmode,
+ const float scale)
{
- bGPDspoint *pt1, *pt2;
+ bGPDspoint *pt1 = NULL;
+ bGPDspoint *pt2 = NULL;
int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
int i;
bool changed = false;
@@ -958,6 +872,14 @@ static bool gp_stroke_do_circle_sel(
}
}
+ /* expand selection to segment */
+ if ((hit) && (selectmode == GP_SELECTMODE_SEGMENT) && (select)) {
+ float r_hita[3], r_hitb[3];
+ bool hit_select = (bool)(pt1->flag & GP_SPOINT_SELECT);
+ ED_gpencil_select_stroke_segment(
+ gpl, gps, pt1, hit_select, false, scale, r_hita, r_hitb);
+ }
+
/* Ensure that stroke selection is in sync with its points */
BKE_gpencil_stroke_sync_selection(gps);
}
@@ -971,6 +893,7 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op)
bGPdata *gpd = ED_gpencil_data_get_active(C);
ToolSettings *ts = CTX_data_tool_settings(C);
const int selectmode = ts->gpencil_selectmode;
+ const float scale = ts->gp_sculpt.isect_threshold;
/* if not edit/sculpt mode, the event is catched but not processed */
if (GPENCIL_NONE_EDIT_MODE(gpd)) {
@@ -983,10 +906,9 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op)
const int my = RNA_int_get(op->ptr, "y");
const int radius = RNA_int_get(op->ptr, "radius");
- bool select = !RNA_boolean_get(op->ptr, "deselect");
-
GP_SpaceConversion gsc = {NULL};
- rcti rect = {0}; /* for bounding rect around circle (for quicky intersection testing) */
+ /* for bounding rect around circle (for quicky intersection testing) */
+ rcti rect = {0};
bool changed = false;
@@ -997,6 +919,14 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+ const eSelectOp sel_op = ED_select_op_modal(
+ RNA_enum_get(op->ptr, "mode"), WM_gesture_is_modal_first(op->customdata));
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_gpencil_select_toggle_all(C, SEL_DESELECT);
+ changed = true;
+ }
+
/* init space conversion stuff */
gp_point_conversion_init(C, &gsc);
@@ -1012,7 +942,8 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op)
GP_EDITABLE_STROKES_BEGIN(gpstroke_iter, C, gpl, gps)
{
changed |= gp_stroke_do_circle_sel(
- gps, &gsc, mx, my, radius, select, &rect, gpstroke_iter.diff_mat, selectmode);
+ gpl, gps, &gsc, mx, my, radius, select, &rect,
+ gpstroke_iter.diff_mat, selectmode, scale);
}
GP_EDITABLE_STROKES_END(gpstroke_iter);
@@ -1048,7 +979,8 @@ void GPENCIL_OT_select_circle(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
/* properties */
- WM_operator_properties_gesture_circle_select(ot);
+ WM_operator_properties_gesture_circle(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/** \} */
@@ -1074,7 +1006,11 @@ static int gpencil_generic_select_exec(
const bool strokemode = (
(ts->gpencil_selectmode == GP_SELECTMODE_STROKE) &&
((gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0));
+ const bool segmentmode = (
+ (ts->gpencil_selectmode == GP_SELECTMODE_SEGMENT) &&
+ ((gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0));
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const float scale = ts->gp_sculpt.isect_threshold;
GP_SpaceConversion gsc = {NULL};
@@ -1124,6 +1060,15 @@ static int gpencil_generic_select_exec(
if (sel_op_result != -1) {
SET_FLAG_FROM_TEST(pt->flag, sel_op_result, GP_SPOINT_SELECT);
changed = true;
+
+ /* expand selection to segment */
+ if ((sel_op_result != -1) && (segmentmode)) {
+ bool hit_select = (bool)(pt->flag & GP_SPOINT_SELECT);
+ float r_hita[3], r_hitb[3];
+ ED_gpencil_select_stroke_segment(
+ gpl, gps, pt, hit_select, false, scale, r_hita, r_hitb);
+ }
+
}
}
else {
@@ -1228,9 +1173,9 @@ void GPENCIL_OT_select_box(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
- /* rna */
- WM_operator_properties_select_operation(ot);
+ /* properties */
WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation(ot);
}
/** \} */
@@ -1336,6 +1281,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
ScrArea *sa = CTX_wm_area(C);
bGPdata *gpd = ED_gpencil_data_get_active(C);
ToolSettings *ts = CTX_data_tool_settings(C);
+ const float scale = ts->gp_sculpt.isect_threshold;
/* "radius" is simply a threshold (screen space) to make it easier to test with a tolerance */
const float radius = 0.50f * U.widget_unit;
@@ -1350,6 +1296,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
GP_SpaceConversion gsc = {NULL};
+ bGPDlayer *hit_layer = NULL;
bGPDstroke *hit_stroke = NULL;
bGPDspoint *hit_point = NULL;
int hit_distance = radius_squared;
@@ -1394,6 +1341,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
if (pt_distance <= radius_squared) {
/* only use this point if it is a better match than the current hit - T44685 */
if (pt_distance < hit_distance) {
+ hit_layer = gpl;
hit_stroke = gps;
hit_point = pt;
hit_distance = pt_distance;
@@ -1454,6 +1402,15 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
/* we're adding selection, so selection must be true */
hit_point->flag |= GP_SPOINT_SELECT;
hit_stroke->flag |= GP_STROKE_SELECT;
+
+ /* expand selection to segment */
+ if (ts->gpencil_selectmode == GP_SELECTMODE_SEGMENT) {
+ float r_hita[3], r_hitb[3];
+ bool hit_select = (bool)(hit_point->flag & GP_SPOINT_SELECT);
+ ED_gpencil_select_stroke_segment(
+ hit_layer, hit_stroke, hit_point, hit_select,
+ false, scale, r_hita, r_hitb);
+ }
}
else {
/* deselect point */
diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c
index 212a119facb..7ed794a0a32 100644
--- a/source/blender/editors/gpencil/gpencil_undo.c
+++ b/source/blender/editors/gpencil/gpencil_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_undo.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
@@ -44,7 +36,6 @@
#include "BKE_blender_undo.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "ED_gpencil.h"
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index f7fafb56d3a..5f703808d53 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2014, Blender Foundation
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/gpencil/gpencil_utils.c
- * \ingroup edgpencil
+/** \file
+ * \ingroup edgpencil
*/
#include <stdio.h>
@@ -36,6 +30,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_ghash.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BLI_rand.h"
@@ -76,6 +71,7 @@
#include "ED_view3d.h"
#include "ED_object.h"
#include "ED_screen.h"
+#include "ED_select_utils.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -101,7 +97,7 @@ bGPdata **ED_gpencil_data_get_pointers_direct(ID *screen_id, ScrArea *sa, Scene
switch (sa->spacetype) {
/* XXX: Should we reduce reliance on context.gpencil_data for these cases? */
- case SPACE_BUTS: /* properties */
+ case SPACE_PROPERTIES: /* properties */
case SPACE_INFO: /* header info (needed after workspaces merge) */
{
if (ob && (ob->type == OB_GPENCIL)) {
@@ -139,7 +135,8 @@ bGPdata **ED_gpencil_data_get_pointers_direct(ID *screen_id, ScrArea *sa, Scene
/* return the GP data for the active node block/node */
if (snode && snode->nodetree) {
- /* for now, as long as there's an active node tree, default to using that in the Nodes Editor */
+ /* for now, as long as there's an active node tree,
+ * default to using that in the Nodes Editor */
if (r_ptr) RNA_id_pointer_create(&snode->nodetree->id, r_ptr);
return &snode->nodetree->gpd;
}
@@ -273,7 +270,7 @@ bGPdata *ED_gpencil_data_get_active_v3d(ViewLayer *view_layer, View3D *v3d)
/* We have to make sure active object is actually visible and selected, else we must use default scene gpd,
* to be consistent with ED_gpencil_data_get_active's behavior.
*/
- if (base && TESTBASE(v3d, base)) {
+ if (base && BASE_SELECTED(v3d, base)) {
if (base->object->type == OB_GPENCIL)
gpd = base->object->data;
}
@@ -465,7 +462,7 @@ bool ED_gpencil_stroke_can_use_direct(const ScrArea *sa, const bGPDstroke *gps)
/* filter stroke types by flags + spacetype */
if (gps->flag & GP_STROKE_3DSPACE) {
/* 3D strokes - only in 3D view */
- return ((sa->spacetype == SPACE_VIEW3D) || (sa->spacetype == SPACE_BUTS));
+ return ((sa->spacetype == SPACE_VIEW3D) || (sa->spacetype == SPACE_PROPERTIES));
}
else if (gps->flag & GP_STROKE_2DIMAGE) {
/* Special "image" strokes - only in Image Editor */
@@ -545,7 +542,7 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(scene, CTX_data_depsgraph(C), ar, v3d, rv3d, &r_gsc->subrect_data, true); /* no shift */
+ ED_view3d_calc_camera_border(scene, CTX_data_depsgraph(C), ar, v3d, rv3d, &r_gsc->subrect_data, true);
r_gsc->subrect = &r_gsc->subrect_data;
}
}
@@ -723,6 +720,62 @@ void gp_point_to_xy_fl(
}
}
+
+/**
+ * generic based on gp_point_to_xy_fl
+ */
+void gp_point_3d_to_xy(const GP_SpaceConversion *gsc, const short flag, const float pt[3], float xy[2])
+{
+ const ARegion *ar = gsc->ar;
+ const View2D *v2d = gsc->v2d;
+ const rctf *subrect = gsc->subrect;
+ float xyval[2];
+
+ /* sanity checks */
+ BLI_assert((gsc->sa->spacetype == SPACE_VIEW3D));
+
+ if (flag & GP_STROKE_3DSPACE) {
+ if (ED_view3d_project_float_global(ar, pt, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+ xy[0] = xyval[0];
+ xy[1] = xyval[1];
+ }
+ else {
+ xy[0] = 0.0f;
+ xy[1] = 0.0f;
+ }
+ }
+ else if (flag & GP_STROKE_2DSPACE) {
+ float vec[3] = { pt[0], pt[1], 0.0f };
+ int t_x, t_y;
+
+ mul_m4_v3(gsc->mat, vec);
+ UI_view2d_view_to_region_clip(v2d, vec[0], vec[1], &t_x, &t_y);
+
+ if ((t_x == t_y) && (t_x == V2D_IS_CLIPPED)) {
+ /* XXX: Or should we just always use the values as-is? */
+ xy[0] = 0.0f;
+ xy[1] = 0.0f;
+ }
+ else {
+ xy[0] = (float)t_x;
+ xy[1] = (float)t_y;
+ }
+ }
+ else {
+ if (subrect == NULL) {
+ /* normal 3D view (or view space) */
+ xy[0] = (pt[0] / 100.0f * ar->winx);
+ xy[1] = (pt[1] / 100.0f * ar->winy);
+ }
+ else {
+ /* camera view, use subrect */
+ xy[0] = ((pt[0] / 100.0f) * BLI_rctf_size_x(subrect)) + subrect->xmin;
+ xy[1] = ((pt[1] / 100.0f) * BLI_rctf_size_y(subrect)) + subrect->ymin;
+ }
+ }
+}
+
+
/**
* Project screenspace coordinates to 3D-space
*
@@ -738,7 +791,7 @@ void gp_point_to_xy_fl(
*
* \warning Assumes that it is getting called in a 3D view only.
*/
-bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, Scene *scene, const float screen_co[2], float r_out[3])
+bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, Scene *scene, const float screen_co[2], float r_out[3])
{
const RegionView3D *rv3d = gsc->ar->regiondata;
float rvec[3];
@@ -1158,7 +1211,8 @@ void ED_gpencil_parent_location(
mul_m4_m4m4(diff_mat, tmp_mat, gpl->inverse);
}
else {
- mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse); /* if bone not found use object (armature) */
+ /* if bone not found use object (armature) */
+ mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse);
}
return;
}
@@ -1218,8 +1272,6 @@ Object *ED_gpencil_add_object(bContext *C, Scene *UNUSED(scene), const float loc
Object *ob = ED_object_add_type(C, OB_GPENCIL, NULL, loc, rot, false, local_view_bits);
- /* define size */
- BKE_object_obdata_size_init(ob, GP_OBGPENCIL_DEFAULT_SIZE);
/* create default brushes and colors */
ED_gpencil_add_defaults(C, ob);
@@ -1596,54 +1648,53 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
/* for paint use paint brush size and color */
if (gpd->flag & GP_DATA_STROKE_PAINTMODE) {
brush = scene->toolsettings->gp_paint->paint.brush;
+ if ((brush == NULL) || (brush->gpencil_settings == NULL)) {
+ return;
+ }
+
/* while drawing hide */
if ((gpd->runtime.sbuffer_size > 0) &&
- (brush) && ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) &&
+ ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) &&
((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0))
{
return;
}
- if (brush) {
- if ((brush->gpencil_settings->flag & GP_BRUSH_ENABLE_CURSOR) == 0) {
- return;
- }
+ if ((brush->gpencil_settings->flag & GP_BRUSH_ENABLE_CURSOR) == 0) {
+ return;
+ }
- /* eraser has special shape and use a different shader program */
- if (brush->gpencil_tool == GPAINT_TOOL_ERASE) {
- ED_gpencil_brush_draw_eraser(brush, x, y);
- return;
- }
+ /* eraser has special shape and use a different shader program */
+ if (brush->gpencil_tool == GPAINT_TOOL_ERASE) {
+ ED_gpencil_brush_draw_eraser(brush, x, y);
+ return;
+ }
- /* get current drawing color */
- ma = BKE_gpencil_get_material_from_brush(brush);
- if (ma == NULL) {
- BKE_gpencil_material_ensure(bmain, ob);
- /* assign the first material to the brush */
- ma = give_current_material(ob, 1);
- brush->gpencil_settings->material = ma;
- }
- gp_style = ma->gp_style;
-
- /* after some testing, display the size of the brush is not practical because
- * is too disruptive and the size of cursor does not change with zoom factor.
- * The decision was to use a fix size, instead of brush->thickness value.
- */
- if ((gp_style) && (GPENCIL_PAINT_MODE(gpd)) &&
- ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) &&
- ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) &&
- (brush->gpencil_tool == GPAINT_TOOL_DRAW))
- {
- radius = 2.0f;
- copy_v3_v3(color, gp_style->stroke_rgba);
- }
- else {
- radius = 5.0f;
- copy_v3_v3(color, brush->add_col);
- }
+ /* get current drawing color */
+ ma = BKE_gpencil_get_material_from_brush(brush);
+ if (ma == NULL) {
+ BKE_gpencil_material_ensure(bmain, ob);
+ /* assign the first material to the brush */
+ ma = give_current_material(ob, 1);
+ brush->gpencil_settings->material = ma;
+ }
+ gp_style = ma->gp_style;
+
+ /* after some testing, display the size of the brush is not practical because
+ * is too disruptive and the size of cursor does not change with zoom factor.
+ * The decision was to use a fix size, instead of brush->thickness value.
+ */
+ if ((gp_style) && (GPENCIL_PAINT_MODE(gpd)) &&
+ ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) &&
+ ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) &&
+ (brush->gpencil_tool == GPAINT_TOOL_DRAW))
+ {
+ radius = 2.0f;
+ copy_v3_v3(color, gp_style->stroke_rgba);
}
else {
- return;
+ radius = 5.0f;
+ copy_v3_v3(color, brush->add_col);
}
}
@@ -1918,7 +1969,7 @@ void ED_gpencil_update_color_uv(Main *bmain, Material *mat)
{
Material *gps_ma = NULL;
/* read all strokes */
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->type == OB_GPENCIL) {
bGPdata *gpd = ob->data;
if (gpd == NULL) {
@@ -1943,7 +1994,450 @@ void ED_gpencil_update_color_uv(Main *bmain, Material *mat)
}
}
}
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
}
}
}
-/* ******************************************************** */
+
+static bool gpencil_check_collision(
+ bGPDstroke *gps, bGPDstroke **gps_array, GHash *all_2d,
+ int totstrokes, float p2d_a1[2], float p2d_a2[2], float r_hit[2])
+{
+ bool hit = false;
+ /* check segment with all segments of all strokes */
+ for (int s = 0; s < totstrokes; s++) {
+ bGPDstroke *gps_iter = gps_array[s];
+ if (gps_iter->totpoints < 2) {
+ continue;
+ }
+ /* get stroke 2d version */
+ float(*points2d)[2] = BLI_ghash_lookup(all_2d, gps_iter);
+
+ for (int i2 = 0; i2 < gps_iter->totpoints - 1; i2++) {
+ float p2d_b1[2], p2d_b2[2];
+ copy_v2_v2(p2d_b1, points2d[i2]);
+ copy_v2_v2(p2d_b2, points2d[i2 + 1]);
+
+ /* don't self check */
+ if (gps == gps_iter) {
+ if (equals_v2v2(p2d_a1, p2d_b1) || equals_v2v2(p2d_a1, p2d_b2)) {
+ continue;
+ }
+ if (equals_v2v2(p2d_a2, p2d_b1) || equals_v2v2(p2d_a2, p2d_b2)) {
+ continue;
+ }
+ }
+ /* check collision */
+ int check = isect_seg_seg_v2_point(p2d_a1, p2d_a2, p2d_b1, p2d_b2, r_hit);
+ if (check > 0) {
+ hit = true;
+ break;
+ }
+ }
+
+ if (hit) {
+ break;
+ }
+ }
+
+ if (!hit) {
+ zero_v2(r_hit);
+ }
+
+ return hit;
+}
+
+static void gp_copy_points(
+ bGPDstroke *gps, bGPDspoint *pt, bGPDspoint *pt_final, int i, int i2)
+{
+ /* don't copy same point */
+ if (i == i2) {
+ return;
+ }
+
+ copy_v3_v3(&pt_final->x, &pt->x);
+ pt_final->pressure = pt->pressure;
+ pt_final->strength = pt->strength;
+ pt_final->time = pt->time;
+ pt_final->flag = pt->flag;
+ pt_final->uv_fac = pt->uv_fac;
+ pt_final->uv_rot = pt->uv_rot;
+
+ if (gps->dvert != NULL) {
+ MDeformVert *dvert = &gps->dvert[i];
+ MDeformVert *dvert_final = &gps->dvert[i2];
+ MEM_SAFE_FREE(dvert_final->dw);
+
+ dvert_final->totweight = dvert->totweight;
+ if (dvert->dw == NULL) {
+ dvert_final->dw = NULL;
+ dvert_final->totweight = 0;
+ }
+ else {
+ dvert_final->dw = MEM_dupallocN(dvert->dw);
+ }
+ }
+
+}
+
+static void gp_insert_point(
+ bGPDstroke *gps,
+ bGPDspoint *a_pt, bGPDspoint *b_pt,
+ float co_a[3], float co_b[3])
+{
+ bGPDspoint *temp_points;
+ int totnewpoints, oldtotpoints;
+
+ totnewpoints = gps->totpoints;
+ if (a_pt) {
+ totnewpoints++;
+ }
+ if (b_pt) {
+ totnewpoints++;
+ }
+
+ /* duplicate points in a temp area */
+ temp_points = MEM_dupallocN(gps->points);
+ oldtotpoints = gps->totpoints;
+
+ /* look index of base points because memory is changed when resize points array */
+ int a_idx = -1;
+ int b_idx = -1;
+ for (int i = 0; i < oldtotpoints; i++) {
+ bGPDspoint *pt = &gps->points[i];
+ if (pt == a_pt) {
+ a_idx = i;
+ }
+ if (pt == b_pt) {
+ b_idx = i;
+ }
+ }
+
+ /* resize the points arrays */
+ gps->totpoints = totnewpoints;
+ gps->points = MEM_recallocN(gps->points, sizeof(*gps->points) * gps->totpoints);
+ if (gps->dvert != NULL) {
+ gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * gps->totpoints);
+ }
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
+
+ /* copy all points */
+ int i2 = 0;
+ for (int i = 0; i < oldtotpoints; i++) {
+ bGPDspoint *pt = &temp_points[i];
+ bGPDspoint *pt_final = &gps->points[i2];
+ gp_copy_points(gps, pt, pt_final, i, i2);
+
+ /* create new point duplicating point and copy location */
+ if ((i == a_idx) || (i == b_idx)) {
+ i2++;
+ pt_final = &gps->points[i2];
+ gp_copy_points(gps, pt, pt_final, i, i2);
+ copy_v3_v3(&pt_final->x, (i == a_idx) ? co_a : co_b);
+
+ /* unselect */
+ pt_final->flag &= ~GP_SPOINT_SELECT;
+ /* tag to avoid more checking with this point */
+ pt_final->flag |= GP_SPOINT_TAG;
+ }
+
+ i2++;
+ }
+
+ MEM_SAFE_FREE(temp_points);
+}
+
+static float gp_calc_factor(float p2d_a1[2], float p2d_a2[2], float r_hit2d[2])
+{
+ float dist1 = len_squared_v2v2(p2d_a1, p2d_a2);
+ float dist2 = len_squared_v2v2(p2d_a1, r_hit2d);
+ float f = dist1 > 0.0f ? dist2 / dist1 : 0.0f;
+
+ /* apply a correction factor */
+ float v1[2];
+ interp_v2_v2v2(v1, p2d_a1, p2d_a2, f);
+ float dist3 = len_squared_v2v2(p2d_a1, v1);
+ float f1 = dist1 > 0.0f ? dist3 / dist1 : 0.0f;
+ f = f + (f - f1);
+
+ return f;
+}
+
+/* extend selection to stroke intersections */
+int ED_gpencil_select_stroke_segment(
+ bGPDlayer *gpl, bGPDstroke *gps, bGPDspoint *pt,
+ bool select, bool insert, const float scale,
+ float r_hita[3], float r_hitb[3])
+{
+ const float min_factor = 0.0015f;
+ bGPDspoint *pta1 = NULL;
+ bGPDspoint *pta2 = NULL;
+ float f = 0.0f;
+ int i2 = 0;
+
+ bGPDframe *gpf = gpl->actframe;
+ if (gpf == NULL) {
+ return 0;
+ }
+
+ int memsize = BLI_listbase_count(&gpf->strokes);
+ bGPDstroke **gps_array = MEM_callocN(sizeof(bGPDstroke *) * memsize, __func__);
+
+ /* save points */
+ bGPDspoint *oldpoints = MEM_dupallocN(gps->points);
+
+ /* Save list of strokes to check */
+ int totstrokes = 0;
+ for (bGPDstroke *gps_iter = gpf->strokes.first; gps_iter; gps_iter = gps_iter->next) {
+ if (gps_iter->totpoints < 2) {
+ continue;
+ }
+ gps_array[totstrokes] = gps_iter;
+ totstrokes++;
+ }
+
+ if (totstrokes == 0) {
+ return 0;
+ }
+
+ /* look for index of the current point */
+ int cur_idx = -1;
+ for (int i = 0; i < gps->totpoints; i++) {
+ pta1 = &gps->points[i];
+ if (pta1 == pt) {
+ cur_idx = i;
+ break;
+ }
+ }
+ if (cur_idx < 0) {
+ return 0;
+ }
+
+ /* convert all gps points to 2d and save in a hash to avoid recalculation */
+ int direction = 0;
+ float(*points2d)[2] = MEM_mallocN(sizeof(*points2d) * gps->totpoints, "GP Stroke temp 2d points");
+ BKE_gpencil_stroke_2d_flat_ref(
+ gps->points, gps->totpoints,
+ gps->points, gps->totpoints, points2d, scale, &direction);
+
+ GHash *all_2d = BLI_ghash_ptr_new(__func__);
+
+ for (int s = 0; s < totstrokes; s++) {
+ bGPDstroke *gps_iter = gps_array[s];
+ float(*points2d_iter)[2] = MEM_mallocN(sizeof(*points2d_iter) * gps_iter->totpoints, __func__);
+
+ /* the extremes of the stroke are scaled to improve collision detection
+ * for near lines */
+ BKE_gpencil_stroke_2d_flat_ref(
+ gps->points, gps->totpoints,
+ gps_iter->points, gps_iter->totpoints, points2d_iter,
+ scale, &direction);
+ BLI_ghash_insert(all_2d, gps_iter, points2d_iter);
+ }
+
+ bool hit_a = false;
+ bool hit_b = false;
+ float p2d_a1[2] = {0.0f, 0.0f};
+ float p2d_a2[2] = {0.0f, 0.0f};
+ float r_hit2d[2];
+ bGPDspoint *hit_pointa = NULL;
+ bGPDspoint *hit_pointb = NULL;
+
+ /* analyze points before current */
+ if (cur_idx > 0) {
+ for (int i = cur_idx; i >= 0; i--) {
+ pta1 = &gps->points[i];
+ copy_v2_v2(p2d_a1, points2d[i]);
+
+ i2 = i - 1;
+ CLAMP_MIN(i2, 0);
+ pta2 = &gps->points[i2];
+ copy_v2_v2(p2d_a2, points2d[i2]);
+
+ hit_a = gpencil_check_collision(
+ gps, gps_array, all_2d, totstrokes, p2d_a1, p2d_a2, r_hit2d);
+
+ if (select) {
+ pta1->flag |= GP_SPOINT_SELECT;
+ }
+ else {
+ pta1->flag &= ~GP_SPOINT_SELECT;
+ }
+
+ if (hit_a) {
+ f = gp_calc_factor(p2d_a1, p2d_a2, r_hit2d);
+ interp_v3_v3v3(r_hita, &pta1->x, &pta2->x, f);
+ if (f > min_factor) {
+ hit_pointa = pta2; /* first point is second (inverted loop) */
+ }
+ else {
+ pta1->flag &= ~GP_SPOINT_SELECT;
+ }
+ break;
+ }
+ }
+ }
+
+ /* analyze points after current */
+ for (int i = cur_idx; i < gps->totpoints; i++) {
+ pta1 = &gps->points[i];
+ copy_v2_v2(p2d_a1, points2d[i]);
+
+ i2 = i + 1;
+ CLAMP_MAX(i2, gps->totpoints - 1);
+ pta2 = &gps->points[i2];
+ copy_v2_v2(p2d_a2, points2d[i2]);
+
+ hit_b = gpencil_check_collision(
+ gps, gps_array, all_2d, totstrokes, p2d_a1, p2d_a2, r_hit2d);
+
+ if (select) {
+ pta1->flag |= GP_SPOINT_SELECT;
+ }
+ else {
+ pta1->flag &= ~GP_SPOINT_SELECT;
+ }
+
+ if (hit_b) {
+ f = gp_calc_factor(p2d_a1, p2d_a2, r_hit2d);
+ interp_v3_v3v3(r_hitb, &pta1->x, &pta2->x, f);
+ if (f > min_factor) {
+ hit_pointb = pta1;
+ }
+ else {
+ pta1->flag &= ~GP_SPOINT_SELECT;
+ }
+ break;
+ }
+ }
+
+ /* insert new point in the collision points */
+ if (insert) {
+ gp_insert_point(gps, hit_pointa, hit_pointb, r_hita, r_hitb);
+ }
+
+ /* free memory */
+ if (all_2d) {
+ GHashIterator gh_iter;
+ GHASH_ITER(gh_iter, all_2d) {
+ float(*p2d)[2] = BLI_ghashIterator_getValue(&gh_iter);
+ MEM_SAFE_FREE(p2d);
+ }
+ BLI_ghash_free(all_2d, NULL, NULL);
+ }
+
+ /* if no hit, reset selection flag */
+ if ((!hit_a) && (!hit_b)) {
+ for (int i = 0; i < gps->totpoints; i++) {
+ pta1 = &gps->points[i];
+ pta2 = &oldpoints[i];
+ pta1->flag = pta2->flag;
+ }
+ }
+
+ MEM_SAFE_FREE(points2d);
+ MEM_SAFE_FREE(gps_array);
+ MEM_SAFE_FREE(oldpoints);
+
+ /* return type of hit */
+ if ((hit_a) && (hit_b)) {
+ return 3;
+ }
+ else if (hit_a) {
+ return 1;
+ }
+ else if (hit_b) {
+ return 2;
+ }
+ else {
+ return 0;
+ }
+}
+
+void ED_gpencil_select_toggle_all(bContext *C, int action)
+{
+ /* for "toggle", test for existing selected strokes */
+ if (action == SEL_TOGGLE) {
+ action = SEL_SELECT;
+
+ CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
+ {
+ if (gps->flag & GP_STROKE_SELECT) {
+ action = SEL_DESELECT;
+ break; // XXX: this only gets out of the inner loop...
+ }
+ }
+ CTX_DATA_END;
+ }
+
+ /* if deselecting, we need to deselect strokes across all frames
+ * - Currently, an exception is only given for deselection
+ * Selecting and toggling should only affect what's visible,
+ * while deselecting helps clean up unintended/forgotten
+ * stuff on other frames
+ */
+ if (action == SEL_DESELECT) {
+ /* deselect strokes across editable layers
+ * NOTE: we limit ourselves to editable layers, since once a layer is "locked/hidden
+ * nothing should be able to touch it
+ */
+ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers)
+ {
+ bGPDframe *gpf;
+
+ /* deselect all strokes on all frames */
+ for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+ bGPDstroke *gps;
+
+ for (gps = gpf->strokes.first; gps; gps = gps->next) {
+ bGPDspoint *pt;
+ int i;
+
+ /* only edit strokes that are valid in this view... */
+ if (ED_gpencil_stroke_can_use(C, gps)) {
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ pt->flag &= ~GP_SPOINT_SELECT;
+ }
+
+ gps->flag &= ~GP_STROKE_SELECT;
+ }
+ }
+ }
+ }
+ CTX_DATA_END;
+ }
+ else {
+ /* select or deselect all strokes */
+ CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
+ {
+ bGPDspoint *pt;
+ int i;
+ bool selected = false;
+
+ /* Change selection status of all points, then make the stroke match */
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ switch (action) {
+ case SEL_SELECT:
+ pt->flag |= GP_SPOINT_SELECT;
+ break;
+ //case SEL_DESELECT:
+ // pt->flag &= ~GP_SPOINT_SELECT;
+ // break;
+ case SEL_INVERT:
+ pt->flag ^= GP_SPOINT_SELECT;
+ break;
+ }
+
+ if (pt->flag & GP_SPOINT_SELECT)
+ selected = true;
+ }
+
+ /* Change status of stroke */
+ if (selected)
+ gps->flag |= GP_STROKE_SELECT;
+ else
+ gps->flag &= ~GP_STROKE_SELECT;
+ }
+ CTX_DATA_END;
+ }
+}
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
index e2e110ffc31..4a1cdce2ead 100644
--- a/source/blender/editors/include/BIF_gl.h
+++ b/source/blender/editors/include/BIF_gl.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* os dependent include locations of gl.h
*/
-/** \file BIF_gl.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
#ifndef __BIF_GL_H__
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 863d817d19a..35e04106f31 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,26 +15,22 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation 2002-2008
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BIF_glutil.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
#ifndef __BIF_GLUTIL_H__
#define __BIF_GLUTIL_H__
-struct rcti;
struct rctf;
+struct rcti;
+struct ColorManagedDisplaySettings;
+struct ColorManagedViewSettings;
struct ImBuf;
struct bContext;
-struct ColorManagedViewSettings;
-struct ColorManagedDisplaySettings;
/* A few functions defined here are being DEPRECATED for Blender 2.8
*
@@ -112,6 +106,7 @@ void set_inverted_drawing(int enable);
void setlinestyle(int nr);
/* own working polygon offset */
+float bglPolygonOffsetCalc(const float winmat[16], float viewdist, float dist);
void bglPolygonOffset(float viewdist, float dist);
/* **** Color management helper functions for GLSL display/transform ***** */
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index f7cd7bc3786..305e6eaa097 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,41 +15,36 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_anim_api.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_ANIM_API_H__
#define __ED_ANIM_API_H__
+struct AnimData;
struct ID;
struct ListBase;
-struct AnimData;
-struct bContext;
+struct ARegion;
struct Main;
-struct wmKeyConfig;
struct ReportList;
struct ScrArea;
struct SpaceLink;
-struct ARegion;
struct View2D;
+struct bContext;
+struct wmKeyConfig;
-struct Scene;
struct Object;
+struct Scene;
struct bDopeSheet;
-struct bAction;
struct FCurve;
struct FModifier;
+struct bAction;
struct uiBlock;
struct uiLayout;
@@ -69,29 +62,46 @@ struct PropertyRNA;
* 'context' information
*/
typedef struct bAnimContext {
- void *data; /* data to be filtered for use in animation editor */
- short datatype; /* type of data eAnimCont_Types */
-
- short mode; /* editor->mode */
- short spacetype; /* sa->spacetype */
- short regiontype; /* active region -> type (channels or main) */
-
- struct ScrArea *sa; /* editor host */
- struct SpaceLink *sl; /* editor data */
- struct ARegion *ar; /* region within editor */
-
- struct bDopeSheet *ads; /* dopesheet data for editor (or which is being used) */
-
- struct Depsgraph *depsgraph; /* active dependency graph */
- struct Main *bmain; /* Current Main */
- struct Scene *scene; /* active scene */
- struct ViewLayer *view_layer; /* active scene layer */
- struct Object *obact; /* active object */
- ListBase *markers; /* active set of markers */
-
- struct ReportList *reports; /* pointer to current reports list */
-
- float yscale_fac; /* scale factor for height of channels (i.e. based on the size of keyframes) */
+ /** data to be filtered for use in animation editor */
+ void *data;
+ /** type of data eAnimCont_Types */
+ short datatype;
+
+ /** editor->mode */
+ short mode;
+ /** sa->spacetype */
+ short spacetype;
+ /** active region -> type (channels or main) */
+ short regiontype;
+
+ /** editor host */
+ struct ScrArea *sa;
+ /** editor data */
+ struct SpaceLink *sl;
+ /** region within editor */
+ struct ARegion *ar;
+
+ /** dopesheet data for editor (or which is being used) */
+ struct bDopeSheet *ads;
+
+ /** active dependency graph */
+ struct Depsgraph *depsgraph;
+ /** Current Main */
+ struct Main *bmain;
+ /** active scene */
+ struct Scene *scene;
+ /** active scene layer */
+ struct ViewLayer *view_layer;
+ /** active object */
+ struct Object *obact;
+ /** active set of markers */
+ ListBase *markers;
+
+ /** pointer to current reports list */
+ struct ReportList *reports;
+
+ /** Scale factor for height of channels (i.e. based on the size of keyframes). */
+ float yscale_fac;
} bAnimContext;
/* Main Data container types */
@@ -117,37 +127,67 @@ typedef enum eAnimCont_Types {
typedef struct bAnimListElem {
struct bAnimListElem *next, *prev;
- void *data; /* source data this elem represents */
- int type; /* (eAnim_ChannelType) one of the ANIMTYPE_* values */
- int flag; /* copy of elem's flags for quick access */
- int index; /* for un-named data, the index of the data in its collection */
-
- char update; /* (eAnim_Update_Flags) tag the element for updating */
- char tag; /* tag the included data. Temporary always */
-
- short datatype; /* (eAnim_KeyType) type of motion data to expect */
- void *key_data; /* motion data - mostly F-Curves, but can be other types too */
-
-
- /* NOTE: id here is the "IdAdtTemplate"-style datablock (e.g. Object, Material, Texture, NodeTree)
- * from which evaluation of the RNA-paths takes place. It's used to figure out how deep
- * channels should be nested (e.g. for Textures/NodeTrees) in the tree, and allows property
- * lookups (e.g. for sliders and for inserting keyframes) to work. If we had instead used
- * bAction or something similar, none of this would be possible: although it's trivial
- * to use an IdAdtTemplate type to find the source action a channel (e.g. F-Curve) comes from
- * (i.e. in the AnimEditors, it *must* be the active action, as only that can be edited),
- * it's impossible to go the other way (i.e. one action may be used in multiple places).
+ /** source data this elem represents */
+ void *data;
+ /** (eAnim_ChannelType) one of the ANIMTYPE_* values */
+ int type;
+ /** copy of elem's flags for quick access */
+ int flag;
+ /** for un-named data, the index of the data in its collection */
+ int index;
+
+ /** (eAnim_Update_Flags) tag the element for updating */
+ char update;
+ /** tag the included data. Temporary always */
+ char tag;
+
+ /** (eAnim_KeyType) type of motion data to expect */
+ short datatype;
+ /** motion data - mostly F-Curves, but can be other types too */
+ void *key_data;
+
+
+ /**
+ * \note
+ * id here is the "IdAdtTemplate"-style datablock (e.g. Object, Material, Texture, NodeTree)
+ * from which evaluation of the RNA-paths takes place. It's used to figure out how deep
+ * channels should be nested (e.g. for Textures/NodeTrees) in the tree, and allows property
+ * lookups (e.g. for sliders and for inserting keyframes) to work. If we had instead used
+ * bAction or something similar, none of this would be possible: although it's trivial
+ * to use an IdAdtTemplate type to find the source action a channel (e.g. F-Curve) comes from
+ * (i.e. in the AnimEditors, it *must* be the active action, as only that can be edited),
+ * it's impossible to go the other way (i.e. one action may be used in multiple places).
*/
- struct ID *id; /* ID block that channel is attached to */
- struct AnimData *adt; /* source of the animation data attached to ID block (for convenience) */
-
- void *owner; /* for per-element F-Curves (e.g. NLA Control Curves), the element that this represents (e.g. NlaStrip) */
+ /** ID block that channel is attached to */
+ struct ID *id;
+ /** source of the animation data attached to ID block (for convenience) */
+ struct AnimData *adt;
+
+ /**
+ * For list element which corresponds to a f-curve, this is an ID which
+ * owns the f-curve.
+ *
+ * For example, if the f-curve is coming from Action, this id will be set to
+ * action's ID. But if this is a f-curve which is a driver, then the owner
+ * is set to, for example, object.
+ *
+ * Note, that this is different from id above. The id above will be set to
+ * an object if the f-curve is coming from action associated with that
+ * object. */
+ struct ID *fcurve_owner_id;
+
+ /**
+ * for per-element F-Curves
+ * (e.g. NLA Control Curves), the element that this represents (e.g. NlaStrip) */
+ void *owner;
} bAnimListElem;
-/* Some types for easier type-testing
- * NOTE: need to keep the order of these synchronized with the channels define code
- * which is used for drawing and handling channel lists for
+/**
+ * Some types for easier type-testing
+ *
+ * \note need to keep the order of these synchronized with the channels define code
+ * which is used for drawing and handling channel lists for.
*/
typedef enum eAnim_ChannelType {
ANIMTYPE_NONE = 0,
@@ -236,43 +276,47 @@ typedef enum eAnim_Update_Flags {
/* filtering flags - under what circumstances should a channel be returned */
typedef enum eAnimFilter_Flags {
- /* data which channel represents is fits the dopesheet filters (i.e. scene visibility criteria) */
+ /** data which channel represents is fits the dopesheet filters
+ * (i.e. scene visibility criteria) */
// XXX: it's hard to think of any examples where this *ISN'T* the case... perhaps becomes implicit?
ANIMFILTER_DATA_VISIBLE = (1 << 0),
- /* channel is visible within the channel-list hierarchy (i.e. F-Curves within Groups in ActEdit) */
+ /** channel is visible within the channel-list hierarchy
+ * (i.e. F-Curves within Groups in ActEdit) */
ANIMFILTER_LIST_VISIBLE = (1 << 1),
- /* channel has specifically been tagged as visible in Graph Editor (* Graph Editor Only) */
+ /** channel has specifically been tagged as visible in Graph Editor (* Graph Editor Only) */
ANIMFILTER_CURVE_VISIBLE = (1 << 2),
- /* include summary channels and "expanders" (for drawing/mouse-selection in channel list) */
+ /** include summary channels and "expanders" (for drawing/mouse-selection in channel list) */
ANIMFILTER_LIST_CHANNELS = (1 << 3),
- /* for its type, channel should be "active" one */
+ /** for its type, channel should be "active" one */
ANIMFILTER_ACTIVE = (1 << 4),
- /* channel is a child of the active group (* Actions speciality) */
+ /** channel is a child of the active group (* Actions speciality) */
ANIMFILTER_ACTGROUPED = (1 << 5),
- /* channel must be selected/not-selected, but both must not be set together */
+ /** channel must be selected/not-selected, but both must not be set together */
ANIMFILTER_SEL = (1 << 6),
ANIMFILTER_UNSEL = (1 << 7),
- /* editability status - must be editable to be included */
+ /** editability status - must be editable to be included */
ANIMFILTER_FOREDIT = (1 << 8),
- /* only selected animchannels should be considerable as editable - mainly for Graph Editor's option for keys on select curves only */
+ /** only selected animchannels should be considerable as editable - mainly
+ * for Graph Editor's option for keys on select curves only */
ANIMFILTER_SELEDIT = (1 << 9),
- /* flags used to enforce certain data types */
- // NOTE: the ones for curves and NLA tracks were redundant and have been removed for now...
+ /** flags used to enforce certain data types
+ * \node the ones for curves and NLA tracks were redundant and have been removed for now...
+ */
ANIMFILTER_ANIMDATA = (1 << 10),
- /* duplicate entries for animation data attached to multi-user blocks must not occur */
+ /** duplicate entries for animation data attached to multi-user blocks must not occur */
ANIMFILTER_NODUPLIS = (1 << 11),
- /* for checking if we should keep some collapsed channel around (internal use only!) */
+ /** for checking if we should keep some collapsed channel around (internal use only!) */
ANIMFILTER_TMP_PEEK = (1 << 30),
- /* ignore ONLYSEL flag from filterflag, (internal use only!) */
- ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31)
+ /** ignore ONLYSEL flag from filterflag, (internal use only!) */
+ ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31),
} eAnimFilter_Flags;
/* ---------- Flag Checking Macros ------------ */
@@ -291,7 +335,7 @@ typedef enum eAnimFilter_Flags {
/* 'Sub-object' channels (flags stored in Data block) */
#define FILTER_SKE_OBJD(key) (CHECK_TYPE_INLINE(key, Key *), ((key->flag & KEY_DS_EXPAND)))
#define FILTER_MAT_OBJD(ma) (CHECK_TYPE_INLINE(ma, Material *), ((ma->flag & MA_DS_EXPAND)))
-#define FILTER_LAM_OBJD(la) (CHECK_TYPE_INLINE(la, Lamp *), ((la->flag & LA_DS_EXPAND)))
+#define FILTER_LAM_OBJD(la) (CHECK_TYPE_INLINE(la, Light *), ((la->flag & LA_DS_EXPAND)))
#define FILTER_CAM_OBJD(ca) (CHECK_TYPE_INLINE(ca, Camera *), ((ca->flag & CAM_DS_EXPAND)))
#define FILTER_CACHEFILE_OBJD(cf) (CHECK_TYPE_INLINE(cf, CacheFile *), ((cf->flag & CACHEFILE_DS_EXPAND)))
#define FILTER_CUR_OBJD(cu) (CHECK_TYPE_INLINE(cu, Curve *), ((cu->flag & CU_DS_EXPAND)))
@@ -316,8 +360,8 @@ typedef enum eAnimFilter_Flags {
/* Action Channel Group */
#define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED) == 0)
#define EXPANDED_AGRP(ac, agrp) \
- ( ((!(ac) || ((ac)->spacetype != SPACE_IPO)) && (agrp->flag & AGRP_EXPANDED)) || \
- (( (ac) && ((ac)->spacetype == SPACE_IPO)) && (agrp->flag & AGRP_EXPANDED_G)) )
+ ( ((!(ac) || ((ac)->spacetype != SPACE_GRAPH)) && (agrp->flag & AGRP_EXPANDED)) || \
+ (( (ac) && ((ac)->spacetype == SPACE_GRAPH)) && (agrp->flag & AGRP_EXPANDED_G)) )
#define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE))
/* F-Curve Channels */
#define EDITABLE_FCU(fcu) ((fcu->flag & FCURVE_PROTECTED) == 0)
@@ -417,30 +461,42 @@ void ANIM_animdata_freelist(ListBase *anim_data);
/* role or level of animchannel in the hierarchy */
typedef enum eAnimChannel_Role {
- ACHANNEL_ROLE_EXPANDER = -1, /* datablock expander - a "composite" channel type */
- ACHANNEL_ROLE_SPECIAL = 0, /* special purposes - not generally for hierarchy processing */
- ACHANNEL_ROLE_CHANNEL = 1 /* data channel - a channel representing one of the actual building blocks of channels */
+ /** datablock expander - a "composite" channel type */
+ ACHANNEL_ROLE_EXPANDER = -1,
+ /** special purposes - not generally for hierarchy processing */
+ ACHANNEL_ROLE_SPECIAL = 0,
+ /** data channel - a channel representing one of the actual building blocks of channels */
+ ACHANNEL_ROLE_CHANNEL = 1,
} eAnimChannel_Role;
/* flag-setting behavior */
typedef enum eAnimChannels_SetFlag {
- ACHANNEL_SETFLAG_CLEAR = 0, /* turn off */
- ACHANNEL_SETFLAG_ADD = 1, /* turn on */
- ACHANNEL_SETFLAG_INVERT = 2, /* on->off, off->on */
- ACHANNEL_SETFLAG_TOGGLE = 3 /* some on -> all off // all on */
+ /** turn off */
+ ACHANNEL_SETFLAG_CLEAR = 0,
+ /** turn on */
+ ACHANNEL_SETFLAG_ADD = 1,
+ /** on->off, off->on */
+ ACHANNEL_SETFLAG_INVERT = 2,
+ /** some on -> all off // all on */
+ ACHANNEL_SETFLAG_TOGGLE = 3,
} eAnimChannels_SetFlag;
/* types of settings for AnimChannels */
typedef enum eAnimChannel_Settings {
ACHANNEL_SETTING_SELECT = 0,
- ACHANNEL_SETTING_PROTECT = 1, /* warning: for drawing UI's, need to check if this is off (maybe inverse this later) */
+ /** warning: for drawing UI's, need to check if this is off (maybe inverse this later) */
+ ACHANNEL_SETTING_PROTECT = 1,
ACHANNEL_SETTING_MUTE = 2,
ACHANNEL_SETTING_EXPAND = 3,
- ACHANNEL_SETTING_VISIBLE = 4, /* only for Graph Editor */
- ACHANNEL_SETTING_SOLO = 5, /* only for NLA Tracks */
- ACHANNEL_SETTING_PINNED = 6, /* only for NLA Actions */
+ /** only for Graph Editor */
+ ACHANNEL_SETTING_VISIBLE = 4,
+ /** only for NLA Tracks */
+ ACHANNEL_SETTING_SOLO = 5,
+ /** only for NLA Actions */
+ ACHANNEL_SETTING_PINNED = 6,
ACHANNEL_SETTING_MOD_OFF = 7,
- ACHANNEL_SETTING_ALWAYS_VISIBLE = 8, /* channel is pinned and always visible */
+ /** channel is pinned and always visible */
+ ACHANNEL_SETTING_ALWAYS_VISIBLE = 8,
} eAnimChannel_Settings;
@@ -530,7 +586,8 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, eAnimFilter_Flags filter, void *channel_data, eAnim_ChannelType channel_type);
-/* Delete the F-Curve from the given AnimData block (if possible), as appropriate according to animation context */
+/* Delete the F-Curve from the given AnimData block (if possible),
+ * as appropriate according to animation context */
void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, struct FCurve *fcu);
/* ************************************************ */
@@ -546,7 +603,7 @@ enum eAnimEditDraw_CurrentFrame {
/* time indication in seconds or frames */
DRAWCFRA_UNIT_SECONDS = (1 << 0),
/* draw indicator extra wide (for timeline) */
- DRAWCFRA_WIDE = (1 << 1)
+ DRAWCFRA_WIDE = (1 << 1),
};
/* main call to draw current-frame indicator in an Animation Editor */
@@ -572,7 +629,8 @@ void ANIM_draw_framerange(struct Scene *scene, struct View2D *v2d);
/* ------------- UI Panel Drawing -------------- */
/* draw a given F-Modifier for some layout/UI-Block */
-void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm);
+void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *fcurve_owner_id,
+ ListBase *modifiers, struct FModifier *fcm);
/* ------------- Copy/Paste Buffer -------------- */
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index 3306fa09f12..3d4ca7bf3be 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_armature.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_ARMATURE_H__
@@ -34,50 +28,56 @@
extern "C" {
#endif
-struct bArmature;
struct Base;
-struct bContext;
struct Bone;
-struct bPoseChannel;
struct Depsgraph;
struct IDProperty;
struct ListBase;
struct Main;
-struct MeshDeformModifierData;
+struct Main;
struct Mesh;
+struct MeshDeformModifierData;
struct Object;
struct ReportList;
struct Scene;
+struct UndoType;
struct View3D;
-struct ViewLayer;
struct ViewContext;
+struct ViewLayer;
+struct bArmature;
+struct bContext;
+struct bPoseChannel;
struct wmKeyConfig;
struct wmOperator;
-struct Main;
-struct UndoType;
typedef struct EditBone {
struct EditBone *next, *prev;
- struct IDProperty *prop; /* User-Defined Properties on this Bone */
- struct EditBone *parent; /* Editbones have a one-way link (i.e. children refer
- * to parents. This is converted to a two-way link for
- * normal bones when leaving editmode. */
- char name[64]; /* MAXBONENAME */
- float roll; /* Roll along axis. We'll ultimately use the axis/angle method
- * for determining the transformation matrix of the bone. The axis
- * is tail-head while roll provides the angle. Refer to Graphics
- * Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
-
- float head[3]; /* Orientation and length is implicit during editing */
+ /** User-Defined Properties on this Bone */
+ struct IDProperty *prop;
+ /** Editbones have a one-way link (i.e. children refer
+ * to parents. This is converted to a two-way link for
+ * normal bones when leaving editmode. */
+ struct EditBone *parent;
+ /** (64 == MAXBONENAME) */
+ char name[64];
+ /** Roll along axis. We'll ultimately use the axis/angle method
+ * for determining the transformation matrix of the bone. The axis
+ * is tail-head while roll provides the angle. Refer to Graphics
+ * Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
+ float roll;
+
+ /** Orientation and length is implicit during editing */
+ float head[3];
float tail[3];
- /* All joints are considered to have zero rotation with respect to
+ /** All joints are considered to have zero rotation with respect to
* their parents. Therefore any rotations specified during the
* animation are automatically relative to the bones' rest positions*/
int flag;
int layer;
float dist, weight;
- float xwidth, length, zwidth; /* put them in order! transform uses this as scale */
+ /** put them in order! transform uses this as scale */
+ float xwidth, length, zwidth;
float rad_head, rad_tail;
/* Bendy-Bone parameters */
@@ -87,22 +87,28 @@ typedef struct EditBone {
float ease1, ease2;
float scaleIn, scaleOut;
- float oldlength; /* for envelope scaling */
+ /** for envelope scaling */
+ float oldlength;
short segments;
- char bbone_prev_type; /* Type of next/prev bone handles */
+ /** Type of next/prev bone handles */
+ char bbone_prev_type;
char bbone_next_type;
- struct EditBone *bbone_prev; /* Next/prev bones to use as handle references when calculating bbones (optional) */
+ /** Next/prev bones to use as handle references when calculating bbones (optional) */
+ struct EditBone *bbone_prev;
struct EditBone *bbone_next;
/* Used for display */
- float disp_mat[4][4]; /* in Armature space, rest pos matrix */
- float disp_tail_mat[4][4]; /* in Armature space, rest pos matrix */
- /* 32 == MAX_BBONE_SUBDIV */
- float disp_bbone_mat[32][4][4]; /* in Armature space, rest pos matrix */
+ /** in Armature space, rest pos matrix */
+ float disp_mat[4][4];
+ /** in Armature space, rest pos matrix */
+ float disp_tail_mat[4][4];
+ /** in Armature space, rest pos matrix (32 == MAX_BBONE_SUBDIV) */
+ float disp_bbone_mat[32][4][4];
- struct EditBone *bbone_child; /* connected child temporary during drawing */
+ /** connected child temporary during drawing */
+ struct EditBone *bbone_child;
/* Used to store temporary data */
union {
@@ -194,7 +200,7 @@ void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]);
void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]);
void ED_armature_edit_transform_mirror_update(struct Object *obedit);
-void ED_armature_origin_set(struct Main *bmain, struct Object *ob, float cursor[3], int centermode, int around);
+void ED_armature_origin_set(struct Main *bmain, struct Object *ob, const float cursor[3], int centermode, int around);
void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props);
void ED_armature_transform_apply(struct Main *bmain, struct Object *ob, float mat[4][4], const bool do_props);
diff --git a/source/blender/editors/include/ED_buttons.h b/source/blender/editors/include/ED_buttons.h
index 5cc695b6ce8..9ff2678b53e 100644
--- a/source/blender/editors/include/ED_buttons.h
+++ b/source/blender/editors/include/ED_buttons.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,12 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2013, Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_buttons.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_BUTTONS_H__
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 4844d96e6e8..a146bbeb0af 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,24 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_clip.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_CLIP_H__
#define __ED_CLIP_H__
struct ARegion;
-struct bContext;
-struct bScreen;
struct ImBuf;
struct Main;
struct Mask;
struct MovieClip;
-struct SpaceClip;
struct Scene;
+struct SpaceClip;
+struct bContext;
+struct bScreen;
/* ** clip_editor.c ** */
@@ -68,6 +61,8 @@ bool ED_space_clip_color_sample(struct SpaceClip *sc, struct ARegion *ar, int mv
void ED_clip_update_frame(const struct Main *mainp, int cfra);
bool ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, bool fit);
+void ED_clip_select_all(struct SpaceClip *sc, int action, bool *r_has_selection);
+
void ED_clip_point_undistorted_pos(struct SpaceClip *sc, const float co[2], float r_co[2]);
void ED_clip_point_stable_pos(struct SpaceClip *sc, struct ARegion *ar, float x, float y, float *xr, float *yr);
void ED_clip_point_stable_pos__reverse(struct SpaceClip *sc, struct ARegion *ar, const float co[2], float r_co[2]);
diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h
index e4eea9921db..b585dc766d7 100644
--- a/source/blender/editors/include/ED_curve.h
+++ b/source/blender/editors/include/ED_curve.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,33 +15,28 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_curve.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_CURVE_H__
#define __ED_CURVE_H__
-struct bContext;
-struct BezTriple;
struct BPoint;
+struct BezTriple;
struct Curve;
struct EditNurb;
struct Main;
struct Nurb;
struct Object;
struct Text;
-struct wmOperator;
-struct wmKeyConfig;
struct UndoType;
struct View3D;
+struct bContext;
+struct wmKeyConfig;
+struct wmOperator;
/* curve_ops.c */
void ED_operatortypes_curve(void);
@@ -89,7 +82,7 @@ void ED_text_to_object(struct bContext *C, struct Text *text, const bool spli
void ED_curve_beztcpy(struct EditNurb *editnurb, struct BezTriple *dst, struct BezTriple *src, int count);
void ED_curve_bpcpy(struct EditNurb *editnurb, struct BPoint *dst, struct BPoint *src, int count);
-int ED_curve_updateAnimPaths(struct Curve *cu);
+int ED_curve_updateAnimPaths(struct Main *bmain, struct Curve *cu);
bool ED_curve_active_center(struct Curve *cu, float center[3]);
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index c21ef288aeb..fa082e71bf6 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_datafiles.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_DATAFILES_H__
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h
index 64739d968b8..000af75a9cb 100644
--- a/source/blender/editors/include/ED_fileselect.h
+++ b/source/blender/editors/include/ED_fileselect.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_fileselect.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_FILESELECT_H__
@@ -134,8 +127,10 @@ typedef enum FSMenuCategory {
typedef enum FSMenuInsert {
FS_INSERT_SORTED = (1 << 0),
FS_INSERT_SAVE = (1 << 1),
- FS_INSERT_FIRST = (1 << 2), /* moves the item to the front of the list when its not already there */
- FS_INSERT_LAST = (1 << 3), /* just append to preseve delivered order */
+ /** moves the item to the front of the list when its not already there */
+ FS_INSERT_FIRST = (1 << 2),
+ /** just append to preseve delivered order */
+ FS_INSERT_LAST = (1 << 3),
} FSMenuInsert;
struct FSMenu;
diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h
index be772a6af98..53b65292b6a 100644
--- a/source/blender/editors/include/ED_gizmo_library.h
+++ b/source/blender/editors/include/ED_gizmo_library.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_gizmo_library.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \name Generic Gizmos.
*
@@ -47,9 +43,9 @@ void ED_gizmotypes_value_2d(void);
/* gizmo group types */
void ED_gizmogrouptypes_value_2d(void);
-struct bContext;
struct Object;
struct Scene;
+struct bContext;
struct wmGizmo;
struct wmGizmoGroup;
diff --git a/source/blender/editors/include/ED_gizmo_utils.h b/source/blender/editors/include/ED_gizmo_utils.h
index 77956b9ca0d..e81dcb34cd2 100644
--- a/source/blender/editors/include/ED_gizmo_utils.h
+++ b/source/blender/editors/include/ED_gizmo_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_gizmo_utils.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*
* \name Generic Gizmo Utilities.
*/
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index c231d0dc355..e331032bd6e 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_gpencil.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_GPENCIL_H__
@@ -35,31 +29,31 @@ struct ListBase;
struct PointerRNA;
struct rcti;
-struct bGPdata;
-struct bGPDlayer;
+struct Brush;
struct bGPDframe;
-struct bGPDstroke;
+struct bGPDlayer;
struct bGPDspoint;
-struct Brush;
+struct bGPDstroke;
+struct bGPdata;
-struct Main;
-struct bContext;
-struct EvaluationContext;
-struct Depsgraph;
-struct ScrArea;
struct ARegion;
+struct Depsgraph;
+struct EvaluationContext;
+struct Main;
struct RegionView3D;
struct ReportList;
struct Scene;
+struct ScrArea;
struct ToolSettings;
-struct ViewLayer;
struct View3D;
+struct ViewLayer;
+struct bContext;
-struct Object;
struct Material;
+struct Object;
-struct bAnimContext;
struct KeyframeEditData;
+struct bAnimContext;
struct wmKeyConfig;
struct wmOperator;
@@ -259,4 +253,19 @@ void ED_gpencil_tpoint_to_point(struct ARegion *ar, float origin[3], const struc
void ED_gpencil_calc_stroke_uv(struct Object *ob, struct bGPDstroke *gps);
void ED_gpencil_update_color_uv(struct Main *bmain, struct Material *mat);
+/* extend selection to stroke intersections
+ * returns:
+ * 0 - No hit
+ * 1 - Hit in point A
+ * 2 - Hit in point B
+ * 3 - Hit in point A and B
+*/
+int ED_gpencil_select_stroke_segment(
+ struct bGPDlayer *gpl,
+ struct bGPDstroke *gps, struct bGPDspoint *pt,
+ bool select, bool insert, const float scale,
+ float r_hita[3], float r_hitb[3]);
+
+void ED_gpencil_select_toggle_all(struct bContext *C, int action);
+
#endif /* __ED_GPENCIL_H__ */
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index f8af67b55ff..240ed427479 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,33 +15,29 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_image.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_IMAGE_H__
#define __ED_IMAGE_H__
-struct SpaceImage;
-struct bContext;
+struct ARegion;
+struct ImBuf;
struct Image;
struct ImageUser;
-struct ImBuf;
-struct ToolSettings;
-struct wmWindowManager;
-struct ARegion;
struct Scene;
+struct SpaceImage;
+struct ToolSettings;
struct ViewLayer;
+struct bContext;
+struct wmWindowManager;
/* image_edit.c, exported for transform */
struct Image *ED_space_image(struct SpaceImage *sima);
-void ED_space_image_set(struct Main *bmain, struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima);
+void ED_space_image_set(struct Main *bmain, struct SpaceImage *sima, struct Object *obedit, struct Image *ima);
struct Mask *ED_space_image_get_mask(struct SpaceImage *sima);
void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask);
diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h
index 072b1a135a3..118295a80e0 100644
--- a/source/blender/editors/include/ED_info.h
+++ b/source/blender/editors/include/ED_info.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,19 +14,19 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2009, Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_info.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_INFO_H__
#define __ED_INFO_H__
+struct Main;
+
/* info_stats.c */
void ED_info_stats_clear(struct ViewLayer *view_layer);
-const char *ED_info_stats_string(struct Scene *scene, struct ViewLayer *view_layer);
+const char *ED_info_stats_string(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer);
#endif /* __ED_INFO_H__ */
diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h
index 87c6c0be45a..475484104a1 100644
--- a/source/blender/editors/include/ED_keyframes_draw.h
+++ b/source/blender/editors/include/ED_keyframes_draw.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,36 +15,30 @@
*
* The Original Code is Copyright (C) (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_keyframes_draw.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_KEYFRAMES_DRAW_H__
#define __ED_KEYFRAMES_DRAW_H__
-struct bAnimContext;
struct AnimData;
struct CacheFile;
+struct DLRBT_Tree;
struct FCurve;
-struct bDopeSheet;
-struct bAction;
-struct bActionGroup;
-struct Object;
struct ListBase;
-struct bGPDlayer;
-struct Palette;
struct MaskLayer;
+struct Object;
+struct Palette;
struct Scene;
struct View2D;
-struct DLRBT_Tree;
+struct bAction;
+struct bActionGroup;
+struct bAnimContext;
+struct bDopeSheet;
+struct bGPDlayer;
/* ****************************** Base Structs ****************************** */
@@ -67,14 +59,20 @@ typedef struct ActKeyColumn {
struct ActKeyColumn *next, *prev;
/* sorting-tree linkage */
- struct ActKeyColumn *left, *right; /* 'children' of this node, less than and greater than it (respectively) */
- struct ActKeyColumn *parent; /* parent of this node in the tree */
- char tree_col; /* DLRB_BLACK or DLRB_RED */
+ /** 'children' of this node, less than and greater than it (respectively) */
+ struct ActKeyColumn *left, *right;
+ /** parent of this node in the tree */
+ struct ActKeyColumn *parent;
+ /** DLRB_BLACK or DLRB_RED */
+ char tree_col;
/* keyframe info */
- char key_type; /* eBezTripe_KeyframeType */
- char handle_type; /* eKeyframeHandleDrawOpts */
- char extreme_type; /* eKeyframeExtremeDrawOpts */
+ /** eBezTripe_KeyframeType */
+ char key_type;
+ /** eKeyframeHandleDrawOpts */
+ char handle_type;
+ /** eKeyframeExtremeDrawOpts */
+ char extreme_type;
short sel;
float cfra;
@@ -134,7 +132,8 @@ typedef enum eKeyframeExtremeDrawOpts {
} eKeyframeExtremeDrawOpts;
/* draw simple diamond-shape keyframe */
-/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND, immBegin(GPU_PRIM_POINTS, n), then call this n times */
+/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND,
+ * immBegin(GPU_PRIM_POINTS, n), then call this n times */
void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type, short mode, float alpha,
unsigned int pos_id, unsigned int size_id, unsigned int color_id, unsigned int outline_color_id,
unsigned int linemask_id, short ipo_type, short extreme_type);
diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h
index e7ea5cf159e..402dc3e67bc 100644
--- a/source/blender/editors/include/ED_keyframes_edit.h
+++ b/source/blender/editors/include/ED_keyframes_edit.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,26 +15,21 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_keyframes_edit.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_KEYFRAMES_EDIT_H__
#define __ED_KEYFRAMES_EDIT_H__
+struct BezTriple;
+struct FCurve;
+struct Scene;
struct bAnimContext;
struct bAnimListElem;
struct bDopeSheet;
-struct FCurve;
-struct BezTriple;
-struct Scene;
/* ************************************************ */
/* Common Macros and Defines */
@@ -73,7 +66,7 @@ typedef enum eEditKeyframes_Select {
/* remove ok keyframes from selection */
SELECT_SUBTRACT = (1 << 2),
/* flip ok status of keyframes based on key status */
- SELECT_INVERT = (1 << 3)
+ SELECT_INVERT = (1 << 3),
} eEditKeyframes_Select;
/* "selection map" building modes */
@@ -134,7 +127,7 @@ typedef enum eKeyframeVertOk {
/* 'handle 2' is ok */
KEYFRAME_OK_H2 = (1 << 2),
/* all flags */
- KEYFRAME_OK_ALL = (KEYFRAME_OK_KEY | KEYFRAME_OK_H1 | KEYFRAME_OK_H2)
+ KEYFRAME_OK_ALL = (KEYFRAME_OK_KEY | KEYFRAME_OK_H1 | KEYFRAME_OK_H2),
} eKeyframeVertOk;
/* Flags for use during iteration */
@@ -155,20 +148,30 @@ typedef enum eKeyframeIterFlags {
typedef struct KeyframeEditData {
/* generic properties/data access */
- ListBase list; /* temp list for storing custom list of data to check */
- struct Scene *scene; /* pointer to current scene - many tools need access to cfra/etc. */
- void *data; /* pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */
- float f1, f2; /* storage of times/values as 'decimals' */
- int i1, i2; /* storage of times/values/flags as 'whole' numbers */
+ /** temp list for storing custom list of data to check */
+ ListBase list;
+ /** pointer to current scene - many tools need access to cfra/etc. */
+ struct Scene *scene;
+ /** pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */
+ void *data;
+ /** storage of times/values as 'decimals' */
+ float f1, f2;
+ /** storage of times/values/flags as 'whole' numbers */
+ int i1, i2;
/* current iteration data */
- struct FCurve *fcu; /* F-Curve that is being iterated over */
- int curIndex; /* index of current keyframe being iterated over */
- float channel_y; /* y-position of midpoint of the channel (for the dopesheet) */
+ /** F-Curve that is being iterated over */
+ struct FCurve *fcu;
+ /** index of current keyframe being iterated over */
+ int curIndex;
+ /** y-position of midpoint of the channel (for the dopesheet) */
+ float channel_y;
/* flags */
- eKeyframeVertOk curflags; /* current flags for the keyframe we're reached in the iteration process */
- eKeyframeIterFlags iterflags; /* settings for iteration process */
+ /** current flags for the keyframe we're reached in the iteration process */
+ eKeyframeVertOk curflags;
+ /** settings for iteration process */
+ eKeyframeIterFlags iterflags;
} KeyframeEditData;
/* ------- Function Pointer Typedefs ---------------- */
@@ -213,7 +216,8 @@ typedef enum eKeyMergeMode {
/* ---------------- Looping API --------------------- */
/* functions for looping over keyframes */
-/* function for working with F-Curve data only (i.e. when filters have been chosen to explicitly use this) */
+/* function for working with F-Curve data only
+ * (i.e. when filters have been chosen to explicitly use this) */
short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, struct FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb);
/* function for working with any type (i.e. one of the known types) of animation channel
* - filterflag is bDopeSheet->flag (DOPESHEET_FILTERFLAG)
@@ -267,7 +271,8 @@ short bezt_to_cfraelem(KeyframeEditData *ked, struct BezTriple *bezt);
void bezt_remap_times(KeyframeEditData *ked, struct BezTriple *bezt);
/* ------ 1.5-D Region Testing Uitls (Lasso/Circle Select) ------- */
-/* XXX: These are temporary, until we can unify GP/Mask Keyframe handling and standard FCurve Keyframe handling */
+/* XXX: These are temporary,
+ * until we can unify GP/Mask Keyframe handling and standard FCurve Keyframe handling */
bool keyframe_region_lasso_test(
const KeyframeEdit_LassoData *data_lasso,
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index aba381f7989..78a9f13e64f 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender (with some old code)
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_keyframing.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_KEYFRAMING_H__
@@ -34,27 +28,27 @@
extern "C" {
#endif
-struct Main;
-struct ListBase;
struct ID;
+struct ListBase;
+struct Main;
struct Scene;
struct KeyingSet;
-struct bAction;
-struct FCurve;
struct BezTriple;
+struct FCurve;
+struct bAction;
struct bPoseChannel;
-struct bContext;
struct ReportList;
+struct bContext;
struct Depsgraph;
+struct EnumPropertyItem;
struct PointerRNA;
struct PropertyRNA;
-struct EnumPropertyItem;
struct NlaKeyframingContext;
@@ -133,8 +127,8 @@ short delete_keyframe(
/* ************ Keying Sets ********************** */
/* forward decl. for this struct which is declared a bit later... */
-struct KeyingSetInfo;
struct ExtensionRNA;
+struct KeyingSetInfo;
/* Polling Callback for KeyingSets */
typedef bool (*cbKeyingSet_Poll)(struct KeyingSetInfo *ksi, struct bContext *C);
@@ -195,7 +189,8 @@ typedef enum eModifyKey_Returns {
MODIFYKEY_MISSING_TYPEINFO = -2,
} eModifyKey_Returns;
-/* poll the current KeyingSet, updating it's set of paths (if "builtin"/"relative") for context changes */
+/* poll the current KeyingSet, updating it's set of paths
+ * (if "builtin"/"relative") for context changes */
short ANIM_validate_keyingset(struct bContext *C, ListBase *dsources, struct KeyingSet *ks);
/* use the specified KeyingSet to add/remove various Keyframes on the specified frame */
@@ -203,7 +198,8 @@ int ANIM_apply_keyingset(struct bContext *C, ListBase *dsources, struct bAction
/* -------- */
-/* Get the first builtin KeyingSet with the given name, which occurs after the given one (or start of list if none given) */
+/* Get the first builtin KeyingSet with the given name, which occurs after the given one
+ * (or start of list if none given) */
struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, const char name[]);
/* Find KeyingSet type info given a name */
@@ -240,18 +236,27 @@ bool ANIM_keyingset_context_ok_poll(struct bContext *C, struct KeyingSet *ks);
/* Flags for use by driver creation calls */
typedef enum eCreateDriverFlags {
- CREATEDRIVER_WITH_DEFAULT_DVAR = (1 << 0), /* create drivers with a default variable for nicer UI */
- CREATEDRIVER_WITH_FMODIFIER = (1 << 1), /* create drivers with Generator FModifier (for backwards compat) */
+ /** create drivers with a default variable for nicer UI */
+ CREATEDRIVER_WITH_DEFAULT_DVAR = (1 << 0),
+ /** create drivers with Generator FModifier (for backwards compat) */
+ CREATEDRIVER_WITH_FMODIFIER = (1 << 1),
} eCreateDriverFlags;
/* Heuristic to use for connecting target properties to driven ones */
typedef enum eCreateDriver_MappingTypes {
- CREATEDRIVER_MAPPING_1_N = 0, /* 1 to Many - Use the specified index, and drive all elements with it */
- CREATEDRIVER_MAPPING_1_1 = 1, /* 1 to 1 - Only for the specified index on each side */
- CREATEDRIVER_MAPPING_N_N = 2, /* Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */
-
- CREATEDRIVER_MAPPING_NONE = 3, /* None (Single Prop) - Do not create driver with any targets; these will get added later instead */
- CREATEDRIVER_MAPPING_NONE_ALL = 4, /* None (All Properties) - Do not create driver with any targets; these will get added later instead */
+ /** 1 to Many - Use the specified index, and drive all elements with it */
+ CREATEDRIVER_MAPPING_1_N = 0,
+ /** 1 to 1 - Only for the specified index on each side */
+ CREATEDRIVER_MAPPING_1_1 = 1,
+ /** Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */
+ CREATEDRIVER_MAPPING_N_N = 2,
+
+ /** None (Single Prop):
+ * Do not create driver with any targets; these will get added later instead */
+ CREATEDRIVER_MAPPING_NONE = 3,
+ /** None (All Properties):
+ * Do not create driver with any targets; these will get added later instead */
+ CREATEDRIVER_MAPPING_NONE_ALL = 4,
} eCreateDriver_MappingTypes;
/* RNA Enum of eCreateDriver_MappingTypes, for use by the appropriate operators */
diff --git a/source/blender/editors/include/ED_lattice.h b/source/blender/editors/include/ED_lattice.h
index b30929f5307..98a091861d1 100644
--- a/source/blender/editors/include/ED_lattice.h
+++ b/source/blender/editors/include/ED_lattice.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,18 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_lattice.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_LATTICE_H__
#define __ED_LATTICE_H__
-struct wmKeyConfig;
-struct UndoType;
struct Object;
+struct UndoType;
+struct wmKeyConfig;
/* lattice_ops.c */
void ED_operatortypes_lattice(void);
diff --git a/source/blender/editors/include/ED_logic.h b/source/blender/editors/include/ED_logic.h
index 71a5552ae26..8158bee15f3 100644
--- a/source/blender/editors/include/ED_logic.h
+++ b/source/blender/editors/include/ED_logic.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_logic.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_LOGIC_H__
diff --git a/source/blender/editors/include/ED_markers.h b/source/blender/editors/include/ED_markers.h
index fa907010870..f3ca7135e40 100644
--- a/source/blender/editors/include/ED_markers.h
+++ b/source/blender/editors/include/ED_markers.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,26 +15,21 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_markers.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_MARKERS_H__
#define __ED_MARKERS_H__
-struct wmKeyConfig;
-struct wmKeyMap;
-struct bContext;
-struct bAnimContext;
struct Scene;
struct TimeMarker;
+struct bAnimContext;
+struct bContext;
+struct wmKeyConfig;
+struct wmKeyMap;
/* Drawing API ------------------------------ */
@@ -63,6 +56,8 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short sel);
+void ED_markers_deselect_all(ListBase *markers, int action);
+
struct TimeMarker *ED_markers_get_first_selected(ListBase *markers);
/* Operators ------------------------------ */
diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h
index af9d87b8e0e..d555a17c0b1 100644
--- a/source/blender/editors/include/ED_mask.h
+++ b/source/blender/editors/include/ED_mask.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,20 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_mask.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_MASK_H__
#define __ED_MASK_H__
-struct bContext;
-struct wmKeyConfig;
+struct KeyframeEditData;
struct MaskLayer;
struct MaskLayerShape;
-struct KeyframeEditData;
+struct bContext;
+struct wmKeyConfig;
/* mask_edit.c */
void ED_mask_get_size(struct ScrArea *sa, int *width, int *height);
diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h
index 47ea3929883..e1033866193 100644
--- a/source/blender/editors/include/ED_mball.h
+++ b/source/blender/editors/include/ED_mball.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,24 +15,19 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_mball.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_MBALL_H__
#define __ED_MBALL_H__
-struct bContext;
struct Object;
-struct wmKeyConfig;
struct UndoType;
+struct bContext;
+struct wmKeyConfig;
void ED_operatortypes_metaball(void);
void ED_operatormacros_metaball(void);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index a2f034589f6..7318df8adab 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_mesh.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_MESH_H__
@@ -35,36 +28,36 @@
extern "C" {
#endif
-struct Base;
-struct ID;
-struct View3D;
struct ARegion;
-struct bContext;
+struct BMBVHTree;
+struct BMEdge;
+struct BMEditMesh;
+struct BMElem;
+struct BMFace;
+struct BMLoop;
+struct BMVert;
+struct BMesh;
+struct Base;
struct Depsgraph;
-struct wmOperator;
-struct wmKeyConfig;
-struct ReportList;
-struct ViewContext;
-struct bDeformGroup;
+struct ID;
struct MDeformVert;
-struct Scene;
struct Mesh;
-struct UvVertMap;
+struct Object;
+struct ReportList;
+struct Scene;
+struct ToolSettings;
+struct UndoType;
struct UvMapVert;
-struct BMEditMesh;
-struct BMElem;
-struct BMesh;
-struct BMVert;
-struct BMLoop;
-struct BMBVHTree;
-struct BMEdge;
-struct BMFace;
-struct UvVertMap;
struct UvMapVert;
-struct ToolSettings;
-struct Object;
+struct UvVertMap;
+struct UvVertMap;
+struct View3D;
+struct ViewContext;
+struct bContext;
+struct bDeformGroup;
struct rcti;
-struct UndoType;
+struct wmKeyConfig;
+struct wmOperator;
/* editmesh_utils.c */
void EDBM_verts_mirror_cache_begin_ex(struct BMEditMesh *em, const int axis,
@@ -102,8 +95,8 @@ void EDBM_select_flush(struct BMEditMesh *em);
bool EDBM_vert_color_check(struct BMEditMesh *em);
-void EDBM_mesh_hide(struct BMEditMesh *em, bool swap);
-void EDBM_mesh_reveal(struct BMEditMesh *em, bool select);
+bool EDBM_mesh_hide(struct BMEditMesh *em, bool swap);
+bool EDBM_mesh_reveal(struct BMEditMesh *em, bool select);
void EDBM_update_generic(struct BMEditMesh *em, const bool do_tessface, const bool is_destructive);
@@ -323,14 +316,14 @@ void ED_mesh_calc_tessface(struct Mesh *mesh, bool free_mpoly);
void ED_mesh_update(struct Mesh *mesh, struct bContext *C, bool calc_edges, bool calc_edges_loose, bool calc_tessface);
void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name);
-int ED_mesh_uv_texture_add(struct Mesh *me, const char *name, const bool active_set);
+int ED_mesh_uv_texture_add(struct Mesh *me, const char *name, const bool active_set, const bool do_init);
bool ED_mesh_uv_texture_remove_index(struct Mesh *me, const int n);
bool ED_mesh_uv_texture_remove_active(struct Mesh *me);
bool ED_mesh_uv_texture_remove_named(struct Mesh *me, const char *name);
void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me);
void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum);
bool ED_mesh_color_ensure(struct Mesh *me, const char *name);
-int ED_mesh_color_add(struct Mesh *me, const char *name, const bool active_set);
+int ED_mesh_color_add(struct Mesh *me, const char *name, const bool active_set, const bool do_init);
bool ED_mesh_color_remove_index(struct Mesh *me, const int n);
bool ED_mesh_color_remove_active(struct Mesh *me);
bool ED_mesh_color_remove_named(struct Mesh *me, const char *name);
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 8d652609fbc..09449687e6e 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_node.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_NODE_H__
@@ -34,23 +27,23 @@
struct ID;
struct Main;
struct Scene;
+struct Scene;
+struct ScrArea;
struct Tex;
+struct View2D;
struct bContext;
-struct bNodeTree;
struct bNode;
-struct bNodeType;
struct bNodeSocketType;
struct bNodeTree;
+struct bNodeTree;
struct bNodeTreeType;
-struct ScrArea;
-struct Scene;
-struct View2D;
+struct bNodeType;
typedef enum {
NODE_TOP = 1,
NODE_BOTTOM = 2,
NODE_LEFT = 4,
- NODE_RIGHT = 8
+ NODE_RIGHT = 8,
} NodeBorder;
#define NODE_GRID_STEPS 5
@@ -98,6 +91,7 @@ void ED_node_shader_default(const struct bContext *C, struct ID *id);
void ED_node_composit_default(const struct bContext *C, struct Scene *scene);
void ED_node_texture_default(const struct bContext *C, struct Tex *tex);
bool ED_node_select_check(ListBase *lb);
+void ED_node_select_all(ListBase *lb, int action);
void ED_node_post_apply_transform(struct bContext *C, struct bNodeTree *ntree);
void ED_node_set_active(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node);
diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h
index f674a0d87f9..5f90996988a 100644
--- a/source/blender/editors/include/ED_numinput.h
+++ b/source/blender/editors/include/ED_numinput.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_numinput.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_NUMINPUT_H__
@@ -33,20 +27,30 @@
struct wmEvent;
typedef struct NumInput {
- short idx_max; /* idx_max < NUM_MAX_ELEMENTS */
+ /** idx_max < NUM_MAX_ELEMENTS */
+ short idx_max;
int unit_sys;
- int unit_type[NUM_MAX_ELEMENTS]; /* Each value can have a different type */
+ /** Each value can have a different type */
+ int unit_type[NUM_MAX_ELEMENTS];
bool unit_use_radians;
- short flag; /* Flags affecting all values' behavior */
- short val_flag[NUM_MAX_ELEMENTS]; /* Per-value flags */
- float val[NUM_MAX_ELEMENTS]; /* Direct value of the input */
- float val_org[NUM_MAX_ELEMENTS]; /* Original value of the input, for reset */
- float val_inc[NUM_MAX_ELEMENTS]; /* Increment steps */
-
- short idx; /* Active element/value */
- char str[NUM_STR_REP_LEN]; /* String as typed by user for edited value (we assume ASCII world!) */
- /* Current position of cursor in edited value str (first byte of "current" letter, so 0 for an empty str) */
+ /** Flags affecting all values' behavior */
+ short flag;
+ /** Per-value flags */
+ short val_flag[NUM_MAX_ELEMENTS];
+ /** Direct value of the input */
+ float val[NUM_MAX_ELEMENTS];
+ /** Original value of the input, for reset */
+ float val_org[NUM_MAX_ELEMENTS];
+ /** Increment steps */
+ float val_inc[NUM_MAX_ELEMENTS];
+
+ /** Active element/value */
+ short idx;
+ /** String as typed by user for edited value (we assume ASCII world!) */
+ char str[NUM_STR_REP_LEN];
+ /** Current position of cursor in edited value str
+ * (first byte of "current" letter, so 0 for an empty str) */
int str_cur;
} NumInput;
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 7f7e74a4e4e..cb0a390cbc2 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_object.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_OBJECT_H__
@@ -35,40 +28,42 @@
extern "C" {
#endif
-struct bFaceMap;
struct Base;
+struct Depsgraph;
+struct EnumPropertyItem;
struct EnumPropertyItem;
struct ID;
struct Main;
struct Menu;
struct ModifierData;
-struct ShaderFxData;
struct Object;
+struct PointerRNA;
+struct PropertyRNA;
struct ReportList;
struct Scene;
+struct ShaderFxData;
struct View3D;
struct ViewLayer;
struct bConstraint;
struct bContext;
+struct bFaceMap;
struct bPoseChannel;
+struct uiLayout;
struct wmKeyConfig;
struct wmKeyMap;
struct wmOperator;
struct wmOperatorType;
struct wmWindow;
struct wmWindowManager;
-struct PointerRNA;
-struct PropertyRNA;
-struct EnumPropertyItem;
-struct Depsgraph;
-struct uiLayout;
#include "DNA_object_enums.h"
#include "BLI_compiler_attrs.h"
/* object_edit.c */
-struct Object *ED_object_context(struct bContext *C); /* context.object */
-struct Object *ED_object_active_context(struct bContext *C); /* context.object or context.active_object */
+/* context.object */
+struct Object *ED_object_context(struct bContext *C);
+/* context.object or context.active_object */
+struct Object *ED_object_active_context(struct bContext *C);
void ED_collection_hide_menu_draw(const struct bContext *C, struct uiLayout *layout);
/* object_utils.c */
@@ -131,9 +126,7 @@ void ED_object_parent(struct Object *ob, struct Object *parent, const int type,
/* bitflags for enter/exit editmode */
enum {
EM_FREEDATA = (1 << 0),
- EM_WAITCURSOR = (1 << 1),
- EM_IGNORE_LAYER = (1 << 3),
- EM_NO_CONTEXT = (1 << 4),
+ EM_NO_CONTEXT = (1 << 1),
};
bool ED_object_editmode_exit_ex(
struct Main *bmain, struct Scene *scene, struct Object *obedit, int flag);
@@ -159,7 +152,7 @@ void ED_object_wpaintmode_exit(struct bContext *C);
void ED_object_sculptmode_enter_ex(
struct Main *bmain, struct Depsgraph *depsgraph,
- struct Scene *scene, struct Object *ob,
+ struct Scene *scene, struct Object *ob, const bool force_dyntopo,
struct ReportList *reports);
void ED_object_sculptmode_enter(struct bContext *C, struct ReportList *reports);
void ED_object_sculptmode_exit_ex(
@@ -176,7 +169,8 @@ float ED_object_new_primitive_matrix(
const float loc[3], const float rot[3], float primmat[4][4]);
-/* Avoid allowing too much insane values even by typing (typos can hang/crash Blender otherwise). */
+/* Avoid allowing too much insane values even by typing
+ * (typos can hang/crash Blender otherwise). */
#define OBJECT_ADD_SIZE_MAXF 1.0e12f
void ED_object_add_unit_props_size(struct wmOperatorType *ot);
@@ -236,7 +230,7 @@ bool ED_object_mode_generic_has_data(
/* object_modifier.c */
enum {
MODIFIER_APPLY_DATA = 1,
- MODIFIER_APPLY_SHAPE
+ MODIFIER_APPLY_SHAPE,
};
struct ModifierData *ED_object_modifier_add(
diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h
index 52fdeb2045c..e94aedc2b2b 100644
--- a/source/blender/editors/include/ED_outliner.h
+++ b/source/blender/editors/include/ED_outliner.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,19 +14,17 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015, Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_outliner.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_OUTLINER_H__
#define __ED_OUTLINER_H__
-struct bContext;
struct ListBase;
+struct bContext;
bool ED_outliner_collections_editor_poll(struct bContext *C);
diff --git a/source/blender/editors/include/ED_paint.h b/source/blender/editors/include/ED_paint.h
index 246419d64aa..c59f1b9e927 100644
--- a/source/blender/editors/include/ED_paint.h
+++ b/source/blender/editors/include/ED_paint.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,24 +12,22 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_paint.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_PAINT_H__
#define __ED_PAINT_H__
-struct bContext;
-struct wmKeyConfig;
-struct wmOperator;
struct ImBuf;
struct Image;
struct UndoStep;
struct UndoType;
+struct bContext;
+struct wmKeyConfig;
+struct wmOperator;
/* paint_ops.c */
void ED_operatortypes_paint(void);
@@ -44,7 +40,7 @@ void ED_imapaint_dirty_region(struct Image *ima, struct ImBuf *ibuf, int x, int
void ED_imapaint_bucket_fill(struct bContext *C, float color[3], struct wmOperator *op);
/* paint_image_undo.c */
-void ED_image_undo_push_begin(const char *name);
+void ED_image_undo_push_begin(const char *name, int paint_mode);
void ED_image_undo_push_end(void);
void ED_image_undo_restore(struct UndoStep *us);
diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h
index 7e7198a8ace..bbecffee9c0 100644
--- a/source/blender/editors/include/ED_particle.h
+++ b/source/blender/editors/include/ED_particle.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,24 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_particle.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_PARTICLE_H__
#define __ED_PARTICLE_H__
-struct bContext;
struct Object;
-struct ParticleSystem;
-struct ParticleEditSettings;
-struct rcti;
struct PTCacheEdit;
+struct ParticleEditSettings;
+struct ParticleSystem;
struct Scene;
-struct ViewLayer;
struct UndoType;
+struct ViewLayer;
+struct bContext;
+struct rcti;
/* particle edit mode */
void PE_free_ptcache_edit(struct PTCacheEdit *edit);
@@ -63,7 +55,7 @@ void PE_update_object(
/* selection tools */
int PE_mouse_particles(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
int PE_box_select(struct bContext *C, const struct rcti *rect, const int sel_op);
-int PE_circle_select(struct bContext *C, int selecting, const int mval[2], float rad);
+bool PE_circle_select(struct bContext *C, int sel_op, const int mval[2], float rad);
int PE_lasso_select(struct bContext *C, const int mcords[][2], const short moves, const int sel_op);
void PE_deselect_all_visible(struct PTCacheEdit *edit);
diff --git a/source/blender/editors/include/ED_physics.h b/source/blender/editors/include/ED_physics.h
index 32444beb0fe..f37a5eeb666 100644
--- a/source/blender/editors/include/ED_physics.h
+++ b/source/blender/editors/include/ED_physics.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,27 +15,21 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_physics.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_PHYSICS_H__
#define __ED_PHYSICS_H__
-struct bContext;
struct ReportList;
+struct bContext;
struct wmKeyConfig;
-struct Scene;
struct Object;
+struct Scene;
/* particle_edit.c */
bool PE_poll(struct bContext *C);
diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h
index 2615847e90a..d0deefbe7b0 100644
--- a/source/blender/editors/include/ED_render.h
+++ b/source/blender/editors/include/ED_render.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_render.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_RENDER_H__
@@ -30,14 +26,14 @@
#include "DNA_vec_types.h"
-struct bContext;
struct DEGEditorUpdateContext;
struct ID;
-struct Main;
struct MTex;
+struct Main;
struct Render;
struct Scene;
struct ScrArea;
+struct bContext;
struct wmWindowManager;
/* render_ops.c */
diff --git a/source/blender/editors/include/ED_scene.h b/source/blender/editors/include/ED_scene.h
index 116d9bd24fc..08ead58fce6 100644
--- a/source/blender/editors/include/ED_scene.h
+++ b/source/blender/editors/include/ED_scene.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_scene.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SCENE_H__
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 9ad4c06dee6..5d4f0919c44 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_screen.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SCREEN_H__
@@ -41,29 +34,30 @@
#include "BLI_compiler_attrs.h"
+struct ARegion;
struct Depsgraph;
-struct wmWindowManager;
-struct wmWindow;
-struct wmNotifier;
-struct wmEvent;
-struct wmKeyConfig;
+struct IDProperty;
+struct Main;
+struct MenuType;
+struct PropertyRNA;
+struct Scene;
+struct ViewLayer;
struct WorkSpace;
struct WorkSpaceInstanceHook;
struct bContext;
-struct Scene;
-struct ViewLayer;
struct bScreen;
-struct ARegion;
-struct uiBlock;
struct rcti;
-struct Main;
+struct uiBlock;
+struct uiLayout;
+struct wmEvent;
+struct wmKeyConfig;
struct wmMsgBus;
struct wmMsgSubscribeKey;
struct wmMsgSubscribeValue;
+struct wmNotifier;
struct wmOperatorType;
-struct IDProperty;
-struct MenuType;
-struct PropertyRNA;
+struct wmWindow;
+struct wmWindowManager;
/* regions */
void ED_region_do_listen(
@@ -106,6 +100,7 @@ void ED_region_visibility_change_update(struct bContext *C, struct ARegion *a
void ED_region_info_draw(struct ARegion *ar, const char *text, float fill_color[4], const bool full_redraw);
void ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float fill_color[4], const bool full_redraw);
void ED_region_image_metadata_draw(int x, int y, struct ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy);
+void ED_region_image_metadata_panel_draw(struct ImBuf *ibuf, struct uiLayout *layout);
void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy);
float ED_region_blend_alpha(struct ARegion *ar);
void ED_region_visible_rect(struct ARegion *ar, struct rcti *rect);
@@ -361,12 +356,13 @@ void ED_area_type_hud_ensure(struct bContext *C, struct ScrArea *sa);
enum {
ED_KEYMAP_UI = (1 << 1),
ED_KEYMAP_GIZMO = (1 << 2),
- ED_KEYMAP_VIEW2D = (1 << 3),
- ED_KEYMAP_MARKERS = (1 << 4),
- ED_KEYMAP_ANIMATION = (1 << 5),
- ED_KEYMAP_FRAMES = (1 << 6),
- ED_KEYMAP_HEADER = (1 << 7),
- ED_KEYMAP_GPENCIL = (1 << 8),
+ ED_KEYMAP_TOOL = (1 << 3),
+ ED_KEYMAP_VIEW2D = (1 << 4),
+ ED_KEYMAP_MARKERS = (1 << 5),
+ ED_KEYMAP_ANIMATION = (1 << 6),
+ ED_KEYMAP_FRAMES = (1 << 7),
+ ED_KEYMAP_HEADER = (1 << 8),
+ ED_KEYMAP_GPENCIL = (1 << 9),
};
/* SCREEN_OT_space_context_cycle direction */
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h
index 8ef7fee0f32..762fba29947 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_screen_types.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SCREEN_TYPES_H__
@@ -56,7 +49,7 @@ enum {
/* don't drop frames (and ignore SCE_FRAME_DROP flag) */
ANIMPLAY_FLAG_NO_SYNC = (1 << 3),
/* use nextfra at next timer update */
- ANIMPLAY_FLAG_USE_NEXT_FRAME = (1 << 4)
+ ANIMPLAY_FLAG_USE_NEXT_FRAME = (1 << 4),
};
/* ----------------------------------------------------- */
@@ -77,10 +70,18 @@ typedef struct ScreenFrameRateInfo {
/* Enum for Action Zone Edges. Which edge of area is action zone. */
typedef enum {
- AE_RIGHT_TO_TOPLEFT, /* Region located on the left, _right_ edge is action zone. Region minimized to the top left */
- AE_LEFT_TO_TOPRIGHT, /* Region located on the right, _left_ edge is action zone. Region minimized to the top right */
- AE_TOP_TO_BOTTOMRIGHT, /* Region located at the bottom, _top_ edge is action zone. Region minimized to the bottom right */
- AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_ edge is action zone. Region minimized to the top left */
+ /** Region located on the left, _right_ edge is action zone.
+ * Region minimized to the top left */
+ AE_RIGHT_TO_TOPLEFT,
+ /** Region located on the right, _left_ edge is action zone.
+ * Region minimized to the top right */
+ AE_LEFT_TO_TOPRIGHT,
+ /** Region located at the bottom, _top_ edge is action zone.
+ * Region minimized to the bottom right */
+ AE_TOP_TO_BOTTOMRIGHT,
+ /** Region located at the top, _bottom_ edge is action zone.
+ * Region minimized to the top left */
+ AE_BOTTOM_TO_TOPLEFT
} AZEdge;
typedef enum {
diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h
index 94508a98dcb..ce234b5fb12 100644
--- a/source/blender/editors/include/ED_sculpt.h
+++ b/source/blender/editors/include/ED_sculpt.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,24 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Nicholas Bishop
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_sculpt.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SCULPT_H__
#define __ED_SCULPT_H__
struct ARegion;
-struct bContext;
+struct ListBase;
struct Object;
struct RegionView3D;
-struct ViewContext;
-struct rcti;
struct UndoStep;
struct UndoType;
-struct ListBase;
+struct ViewContext;
+struct bContext;
+struct rcti;
/* sculpt.c */
void ED_operatortypes_sculpt(void);
diff --git a/source/blender/editors/include/ED_select_utils.h b/source/blender/editors/include/ED_select_utils.h
index d7f55e2a2d6..a7b9ac7e6c9 100644
--- a/source/blender/editors/include/ED_select_utils.h
+++ b/source/blender/editors/include/ED_select_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_select_utils.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SELECT_UTILS_H__
@@ -47,7 +43,7 @@ typedef enum {
enum {
SIM_CMP_EQ = 0,
SIM_CMP_GT,
- SIM_CMP_LT
+ SIM_CMP_LT,
};
#define SEL_OP_USE_OUTSIDE(sel_op) (ELEM(sel_op, SEL_OP_AND))
@@ -60,4 +56,7 @@ int ED_select_op_action_deselected(const eSelectOp sel_op, const bool is_select,
int ED_select_similar_compare_float(const float delta, const float thresh, const int compare);
bool ED_select_similar_compare_float_tree(const struct KDTree *tree, const float length, const float thresh, const int compare);
+
+eSelectOp ED_select_op_modal(const eSelectOp sel_op, const bool is_first);
+
#endif /* __ED_SELECT_UTILS_H__ */
diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h
index 18446966c4f..38f07e83572 100644
--- a/source/blender/editors/include/ED_sequencer.h
+++ b/source/blender/editors/include/ED_sequencer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,21 +14,19 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2009, Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_sequencer.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SEQUENCER_H__
#define __ED_SEQUENCER_H__
-struct bContext;
struct Scene;
struct Sequence;
struct SpaceSeq;
+struct bContext;
void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, bool deselect_all);
void ED_sequencer_deselect_all(struct Scene *scene);
diff --git a/source/blender/editors/include/ED_sound.h b/source/blender/editors/include/ED_sound.h
index b4b424b0318..44b3c5a6b79 100644
--- a/source/blender/editors/include/ED_sound.h
+++ b/source/blender/editors/include/ED_sound.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_sound.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SOUND_H__
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index 709af6e8b09..8495af9b36a 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_space_api.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_SPACE_API_H__
diff --git a/source/blender/editors/include/ED_text.h b/source/blender/editors/include/ED_text.h
index 858902eeec1..1260c531f54 100644
--- a/source/blender/editors/include/ED_text.h
+++ b/source/blender/editors/include/ED_text.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,19 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_text.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_TEXT_H__
#define __ED_TEXT_H__
-struct SpaceText;
struct ARegion;
-struct UndoType;
+struct SpaceText;
struct TextUndoBuf;
+struct UndoType;
bool ED_text_region_location_from_cursor(struct SpaceText *st, struct ARegion *ar, const int cursor_co[2], int r_pixel_co[2]);
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index ad39c1ccc8a..1bd8782bb12 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_transform.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_TRANSFORM_H__
@@ -36,17 +28,17 @@
struct ARegion;
struct ListBase;
+struct Main;
struct Object;
+struct SnapObjectContext;
+struct SnapObjectParams;
struct View3D;
+struct WorkSpace;
struct bContext;
struct wmEvent;
struct wmKeyConfig;
struct wmKeyMap;
struct wmOperatorType;
-struct WorkSpace;
-struct Main;
-struct SnapObjectContext;
-struct SnapObjectParams;
void ED_keymap_transform(struct wmKeyConfig *keyconf);
void transform_operatortypes(void);
@@ -111,9 +103,9 @@ enum TfmMode {
* */
bool calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], float cent2d[2]);
-struct TransInfo;
-struct Scene;
struct Object;
+struct Scene;
+struct TransInfo;
struct wmGizmoGroup;
struct wmGizmoGroupType;
struct wmOperator;
@@ -121,9 +113,9 @@ struct wmOperator;
/* UNUSED */
// int BIF_snappingSupported(struct Object *obedit);
+struct ReportList;
struct TransformOrientation;
struct bContext;
-struct ReportList;
void BIF_clearTransformOrientation(struct bContext *C);
void BIF_removeTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
@@ -142,8 +134,9 @@ int BIF_countTransformOrientation(const struct bContext *C);
#define P_MIRROR (1 << 0)
#define P_MIRROR_DUMMY (P_MIRROR | (1 << 9))
#define P_PROPORTIONAL (1 << 1)
-#define P_AXIS (1 << 2)
-#define P_AXIS_ORTHO (1 << 16)
+#define P_ORIENT_AXIS (1 << 2)
+#define P_ORIENT_AXIS_ORTHO (1 << 16)
+#define P_ORIENT_MATRIX (1 << 17)
#define P_SNAP (1 << 3)
#define P_GEO_SNAP (P_SNAP | (1 << 4))
#define P_ALIGN_SNAP (P_GEO_SNAP | (1 << 5))
diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h
index 8ac7dfcf9d8..688d01f7846 100644
--- a/source/blender/editors/include/ED_transform_snap_object_context.h
+++ b/source/blender/editors/include/ED_transform_snap_object_context.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,29 +12,27 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_transform_snap_object_context.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_TRANSFORM_SNAP_OBJECT_CONTEXT_H__
#define __ED_TRANSFORM_SNAP_OBJECT_CONTEXT_H__
-struct BMVert;
struct BMEdge;
struct BMFace;
+struct BMVert;
+struct ARegion;
struct Depsgraph;
struct ListBase;
-struct Scene;
-struct ViewLayer;
struct Main;
struct Object;
-struct ARegion;
+struct Scene;
struct View3D;
+struct ViewLayer;
struct bContext;
/* transform_snap_object.c */
@@ -74,7 +70,6 @@ struct SnapObjectParams {
unsigned int use_object_edit_cage : 1;
/* snap to the closest element, use when using more than one snap type */
unsigned int use_occlusion_test : 1;
-
};
typedef struct SnapObjectContext SnapObjectContext;
diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h
index 363bb31c3dc..95b74a2108f 100644
--- a/source/blender/editors/include/ED_transverts.h
+++ b/source/blender/editors/include/ED_transverts.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_transverts.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_TRANSVERTS_H__
@@ -61,9 +54,12 @@ enum {
/* mode flags: */
enum {
- TM_ALL_JOINTS = (1 << 0), /* all joints (for bones only) */
- TM_SKIP_HANDLES = (1 << 1), /* skip handles when control point is selected (for curves only) */
- TM_CALC_NORMALS = (1 << 2), /* fill in normals when available */
+ /** all joints (for bones only) */
+ TM_ALL_JOINTS = (1 << 0),
+ /** skip handles when control point is selected (for curves only) */
+ TM_SKIP_HANDLES = (1 << 1),
+ /** fill in normals when available */
+ TM_CALC_NORMALS = (1 << 2),
};
enum {
diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h
index 9188fca2422..7040a2ef6c1 100644
--- a/source/blender/editors/include/ED_types.h
+++ b/source/blender/editors/include/ED_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_types.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_TYPES_H__
diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h
index 7995644f39e..12839e36a12 100644
--- a/source/blender/editors/include/ED_undo.h
+++ b/source/blender/editors/include/ED_undo.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_undo.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_UNDO_H__
@@ -27,11 +23,13 @@
#include "BLI_compiler_attrs.h"
-struct bContext;
struct CLG_LogRef;
+struct Object;
+struct UndoStack;
+struct ViewLayer;
+struct bContext;
struct wmOperator;
struct wmOperatorType;
-struct UndoStack;
/* undo.c */
void ED_undo_push(struct bContext *C, const char *str);
@@ -54,6 +52,12 @@ void ED_undo_operator_repeat_cb_evt(struct bContext *C, void *arg_op, int arg
bool ED_undo_is_valid(const struct bContext *C, const char *undoname);
+bool ED_undo_is_memfile_compatible(const struct bContext *C);
+
+void ED_undo_object_editmode_restore_helper(
+ struct bContext *C,
+ struct Object **object_array, uint object_array_len, uint object_array_stride);
+
struct UndoStack *ED_undo_stack_get(void);
/* helpers */
diff --git a/source/blender/depsgraph/util/deg_util_foreach.h b/source/blender/editors/include/ED_userpref.h
index 5484192207b..29470608933 100644
--- a/source/blender/depsgraph/util/deg_util_foreach.h
+++ b/source/blender/editors/include/ED_userpref.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,15 @@
* 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) 2016 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Sergey Sharybin
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/depsgraph/util/deg_util_foreach.h
- * \ingroup depsgraph
+/** \file
+ * \ingroup editors
*/
-#pragma once
+#ifndef __ED_USERPREF_H__
+#define __ED_USERPREF_H__
+
+void ED_operatortypes_userpref(void);
-#define foreach(x, y) for(x : y)
+#endif /* __ED_USERPREF_H__ */
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index 7e91b5b88c1..b275b776ddd 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_util.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_UTIL_H__
@@ -33,19 +26,19 @@
#include "BLI_compiler_attrs.h"
+struct Main;
struct bContext;
struct wmOperatorType;
/* ed_util.c */
+void ED_editors_init_for_undo(struct Main *bmain);
+void ED_editors_init(struct bContext *C);
+void ED_editors_exit(struct Main *bmain, bool do_undo_system);
+bool ED_editors_flush_edits(struct Main *bmain, bool for_render);
-void ED_editors_init(struct bContext *C);
-void ED_editors_exit(struct bContext *C);
-
-bool ED_editors_flush_edits(const struct bContext *C, bool for_render);
-
-void ED_spacedata_id_remap(struct ScrArea *sa, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id);
+void ED_spacedata_id_remap(struct ScrArea *sa, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id);
-void ED_OT_flush_edits(struct wmOperatorType *ot);
+void ED_OT_flush_edits(struct wmOperatorType *ot);
/* ************** XXX OLD CRUFT WARNING ************* */
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 9e7f192fd8e..b0d1f7a014a 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,33 +15,30 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_uvedit.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_UVEDIT_H__
#define __ED_UVEDIT_H__
struct ARegionType;
-struct BMesh;
struct BMEditMesh;
struct BMFace;
struct BMLoop;
+struct BMesh;
struct Depsgraph;
struct Image;
struct ImageUser;
struct Main;
struct Object;
struct Scene;
+struct SpaceImage;
+struct ToolSettings;
struct View3D;
struct ViewLayer;
-struct SpaceImage;
struct bNode;
struct wmKeyConfig;
@@ -68,6 +63,22 @@ void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int ma
bool ED_uvedit_test(struct Object *obedit);
/* visibility and selection */
+bool uvedit_face_visible_nolocal_ex(
+ const struct ToolSettings *ts, struct BMFace *efa);
+bool uvedit_face_visible_test_ex(
+ const struct ToolSettings *ts, struct Object *obedit, struct Image *ima, struct BMFace *efa);
+bool uvedit_face_select_test_ex(
+ const struct ToolSettings *ts, struct BMFace *efa,
+ const int cd_loop_uv_offset);
+bool uvedit_edge_select_test_ex(
+ const struct ToolSettings *ts, struct BMLoop *l,
+ const int cd_loop_uv_offset);
+bool uvedit_uv_select_test_ex(
+ const struct ToolSettings *ts, struct BMLoop *l,
+ const int cd_loop_uv_offset);
+
+bool uvedit_face_visible_nolocal(
+ struct Scene *scene, struct BMFace *efa);
bool uvedit_face_visible_test(
struct Scene *scene, struct Object *obedit, struct Image *ima, struct BMFace *efa);
bool uvedit_face_select_test(
@@ -125,12 +136,9 @@ void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
void ED_uvedit_live_unwrap_re_solve(void);
void ED_uvedit_live_unwrap_end(short cancel);
-void ED_uvedit_live_unwrap(struct Scene *scene, struct Object *obedit);
+void ED_uvedit_live_unwrap(struct Scene *scene, struct Object **objects, int objects_len);
void ED_uvedit_add_simple_uvs(struct Main *bmain, struct Scene *scene, struct Object *ob);
-/* single call up unwrap using scene settings, used for edge tag unwrapping */
-void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel, const bool pack);
-
/* uvedit_draw.c */
void ED_image_draw_cursor(
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 60220e8797e..131069bfb5f 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file ED_view3d.h
- * \ingroup editors
+/** \file
+ * \ingroup editors
*/
#ifndef __ED_VIEW3D_H__
@@ -34,6 +27,7 @@
/* ********* exports for space_view3d/ module ********** */
struct ARegion;
struct BMEdge;
+struct BMElem;
struct BMFace;
struct BMVert;
struct BPoint;
@@ -41,8 +35,13 @@ struct Base;
struct BezTriple;
struct BoundBox;
struct Camera;
+struct CustomData_MeshMasks;
struct Depsgraph;
struct EditBone;
+struct GPUFX;
+struct GPUFXSettings;
+struct GPUOffScreen;
+struct GPUViewport;
struct ImBuf;
struct MVert;
struct Main;
@@ -53,24 +52,22 @@ struct RV3DMatrixStore;
struct RegionView3D;
struct RenderEngineType;
struct Scene;
-struct ViewLayer;
struct ScrArea;
struct View3D;
struct ViewContext;
+struct ViewLayer;
+struct WorkSpace;
struct bContext;
struct bPoseChannel;
struct bScreen;
struct rctf;
struct rcti;
+struct wmGizmo;
struct wmOperator;
struct wmOperatorType;
struct wmWindow;
struct wmWindowManager;
-struct GPUFX;
-struct GPUOffScreen;
-struct GPUFXSettings;
-struct GPUViewport;
-struct WorkSpace;
+
enum eGPUFXFlags;
/* for derivedmesh drawing callbacks, for view3d_select, .... */
@@ -155,11 +152,16 @@ void ED_view3d_depth_tag_update(struct RegionView3D *rv3d);
/* return values for ED_view3d_project_...() */
typedef enum {
V3D_PROJ_RET_OK = 0,
- V3D_PROJ_RET_CLIP_NEAR = 1, /* can't avoid this when in perspective mode, (can't avoid) */
- V3D_PROJ_RET_CLIP_ZERO = 2, /* so close to zero we can't apply a perspective matrix usefully */
- V3D_PROJ_RET_CLIP_BB = 3, /* bounding box clip - RV3D_CLIPPING */
- V3D_PROJ_RET_CLIP_WIN = 4, /* outside window bounds */
- V3D_PROJ_RET_OVERFLOW = 5 /* outside range (mainly for short), (can't avoid) */
+ /** can't avoid this when in perspective mode, (can't avoid) */
+ V3D_PROJ_RET_CLIP_NEAR = 1,
+ /** so close to zero we can't apply a perspective matrix usefully */
+ V3D_PROJ_RET_CLIP_ZERO = 2,
+ /** bounding box clip - RV3D_CLIPPING */
+ V3D_PROJ_RET_CLIP_BB = 3,
+ /** outside window bounds */
+ V3D_PROJ_RET_CLIP_WIN = 4,
+ /** outside range (mainly for short), (can't avoid) */
+ V3D_PROJ_RET_OVERFLOW = 5,
} eV3DProjStatus;
/* some clipping tests are optional */
@@ -168,7 +170,7 @@ typedef enum {
V3D_PROJ_TEST_CLIP_BB = (1 << 0),
V3D_PROJ_TEST_CLIP_WIN = (1 << 1),
V3D_PROJ_TEST_CLIP_NEAR = (1 << 2),
- V3D_PROJ_TEST_CLIP_ZERO = (1 << 3)
+ V3D_PROJ_TEST_CLIP_ZERO = (1 << 3),
} eV3DProjTest;
#define V3D_PROJ_TEST_CLIP_DEFAULT \
@@ -485,8 +487,12 @@ char ED_view3d_lock_view_from_index(int index);
char ED_view3d_axis_view_opposite(char view);
bool ED_view3d_lock(struct RegionView3D *rv3d);
-uint64_t ED_view3d_datamask(const struct Scene *scene, const struct View3D *v3d);
-uint64_t ED_view3d_screen_datamask(const struct Scene *scene, const struct bScreen *screen);
+void ED_view3d_datamask(
+ const struct bContext *C, const struct Scene *scene, const struct View3D *v3d,
+ struct CustomData_MeshMasks *r_cddata_masks);
+void ED_view3d_screen_datamask(
+ const struct bContext *C, const struct Scene *scene, const struct bScreen *screen,
+ struct CustomData_MeshMasks *r_cddata_masks);
bool ED_view3d_offset_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d);
void ED_view3d_persp_switch_from_camera(
@@ -553,4 +559,9 @@ void ED_view3d_draw_bgpic_test(
struct ARegion *ar, struct View3D *v3d,
const bool do_foreground, const bool do_camera_frame);
+/* view3d_gizmo_preselect_type.c */
+void ED_view3d_gizmo_mesh_preselect_get_active(
+ struct bContext *C, struct wmGizmo *gz,
+ struct Base **r_base, struct BMElem **r_ele);
+
#endif /* __ED_VIEW3D_H__ */
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index 4bef307f350..59658b0fcdb 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file UI_icons.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
/* Note: this is included multiple times with different #defines for DEF_ICON. */
@@ -72,7 +65,7 @@ DEF_ICON(DOT)
DEF_ICON(COLLAPSEMENU)
DEF_ICON(X)
DEF_ICON(DUPLICATE)
-DEF_ICON_BLANK(75)
+DEF_ICON(TRASH)
DEF_ICON_BLANK(76)
DEF_ICON_BLANK(77)
DEF_ICON(NODE)
@@ -348,7 +341,7 @@ DEF_ICON(GP_SELECT_POINTS)
DEF_ICON(GP_SELECT_STROKES)
DEF_ICON(GP_MULTIFRAME_EDITING)
DEF_ICON(GP_ONLY_SELECTED)
-DEF_ICON_BLANK(351)
+DEF_ICON(GP_SELECT_BETWEEN_STROKES)
DEF_ICON(MODIFIER_OFF)
DEF_ICON(MODIFIER_ON)
DEF_ICON(ONIONSKIN_OFF)
@@ -589,7 +582,7 @@ DEF_ICON(REW)
DEF_ICON(PAUSE)
DEF_ICON(PREV_KEYFRAME)
DEF_ICON(NEXT_KEYFRAME)
-DEF_ICON_BLANK(185)
+DEF_ICON(PLAY_SOUND)
DEF_ICON(PLAY_REVERSE)
DEF_ICON(PREVIEW_RANGE)
DEF_ICON(ACTION_TWEAK)
@@ -649,10 +642,10 @@ DEF_ICON(PIVOT_INDIVIDUAL)
DEF_ICON(PIVOT_MEDIAN)
DEF_ICON(PIVOT_ACTIVE)
DEF_ICON(CENTER_ONLY)
-DEF_ICON_BLANK(652)
+DEF_ICON(ROOTCURVE)
DEF_ICON(SMOOTHCURVE)
DEF_ICON(SPHERECURVE)
-DEF_ICON(ROOTCURVE)
+DEF_ICON(INVERSESQUARECURVE)
DEF_ICON(SHARPCURVE)
DEF_ICON(LINCURVE)
DEF_ICON(NOCURVE)
@@ -660,7 +653,7 @@ DEF_ICON(RNDCURVE)
DEF_ICON(PROP_OFF)
DEF_ICON(PROP_ON)
DEF_ICON(PROP_CON)
-DEF_ICON(SCULPT_DYNTOPO) /* XXX Empty icon! */
+DEF_ICON(PROP_PROJECTED)
DEF_ICON(PARTICLE_POINT)
DEF_ICON(PARTICLE_TIP)
DEF_ICON(PARTICLE_PATH)
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 2e31a1a9ae5..d9b2b09a117 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file UI_interface.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
#ifndef __UI_INTERFACE_H__
@@ -38,50 +30,50 @@
/* Struct Declarations */
-struct ID;
-struct IDProperty;
-struct ListBase;
struct ARegion;
struct ARegionType;
-struct ScrArea;
-struct bScreen;
-struct wmEvent;
-struct wmWindow;
-struct wmOperator;
struct AutoComplete;
-struct bContext;
-struct bContextStore;
+struct ID;
+struct IDProperty;
+struct ImBuf;
+struct Image;
+struct ImageUser;
+struct ListBase;
+struct MTex;
struct Panel;
struct PanelType;
struct PointerRNA;
struct PropertyRNA;
struct ReportList;
+struct ScrArea;
+struct bContext;
+struct bContextStore;
+struct bNode;
+struct bNodeSocket;
+struct bNodeTree;
+struct bScreen;
struct rcti;
+struct uiFontStyle;
struct uiList;
struct uiStyle;
-struct uiFontStyle;
struct uiWidgetColors;
-struct Image;
-struct ImageUser;
-struct wmKeyConfig;
-struct wmOperatorType;
-struct MTex;
-struct ImBuf;
-struct bNodeTree;
-struct bNode;
-struct bNodeSocket;
-struct wmDropBox;
struct wmDrag;
+struct wmDropBox;
+struct wmEvent;
struct wmEvent;
struct wmGizmo;
-struct wmMsgBus;
+struct wmKeyConfig;
struct wmKeyMap;
struct wmKeyMapItem;
+struct wmMsgBus;
+struct wmOperator;
+struct wmOperatorType;
+struct wmWindow;
-typedef struct uiBut uiBut;
typedef struct uiBlock uiBlock;
-typedef struct uiPopupBlockHandle uiPopupBlockHandle;
+typedef struct uiBut uiBut;
typedef struct uiLayout uiLayout;
+typedef struct uiPopupBlockHandle uiPopupBlockHandle;
/* Defines */
@@ -109,14 +101,14 @@ enum {
/* uiBlock->direction */
enum {
- UI_DIR_UP = (1 << 0),
- UI_DIR_DOWN = (1 << 1),
- UI_DIR_LEFT = (1 << 2),
- UI_DIR_RIGHT = (1 << 3),
- UI_DIR_CENTER_X = (1 << 4),
- UI_DIR_CENTER_Y = (1 << 5),
-
- UI_DIR_ALL = (UI_DIR_UP | UI_DIR_DOWN | UI_DIR_LEFT | UI_DIR_RIGHT),
+ UI_DIR_UP = 1 << 0,
+ UI_DIR_DOWN = 1 << 1,
+ UI_DIR_LEFT = 1 << 2,
+ UI_DIR_RIGHT = 1 << 3,
+ UI_DIR_CENTER_X = 1 << 4,
+ UI_DIR_CENTER_Y = 1 << 5,
+
+ UI_DIR_ALL = UI_DIR_UP | UI_DIR_DOWN | UI_DIR_LEFT | UI_DIR_RIGHT,
};
#if 0
@@ -125,82 +117,108 @@ enum {
#define UI_BLOCK_ROWS 2
#endif
-/* uiBlock->flag (controls) */
-#define UI_BLOCK_LOOP (1 << 0)
-#define UI_BLOCK_IS_FLIP (1 << 1)
-#define UI_BLOCK_NO_FLIP (1 << 2)
-#define UI_BLOCK_NUMSELECT (1 << 3)
-#define UI_BLOCK_NO_WIN_CLIP (1 << 4) /* don't apply window clipping */ /* was UI_BLOCK_ENTER_OK */
-#define UI_BLOCK_CLIPBOTTOM (1 << 5)
-#define UI_BLOCK_CLIPTOP (1 << 6)
-#define UI_BLOCK_MOVEMOUSE_QUIT (1 << 7)
-#define UI_BLOCK_KEEP_OPEN (1 << 8)
-#define UI_BLOCK_POPUP (1 << 9)
-#define UI_BLOCK_OUT_1 (1 << 10)
-#define UI_BLOCK_SEARCH_MENU (1 << 11)
-#define UI_BLOCK_POPUP_MEMORY (1 << 12)
-#define UI_BLOCK_CLIP_EVENTS (1 << 13) /* stop handling mouse events */
-
-/* block->flag bits 14-17 are identical to but->drawflag bits */
-
-#define UI_BLOCK_POPUP_HOLD (1 << 18)
-#define UI_BLOCK_LIST_ITEM (1 << 19)
-#define UI_BLOCK_RADIAL (1 << 20)
-#define UI_BLOCK_POPOVER (1 << 21)
-#define UI_BLOCK_POPOVER_ONCE (1 << 22)
-/** Always show keymaps, even for non-menus. */
-#define UI_BLOCK_SHOW_SHORTCUT_ALWAYS (1 << 23)
-
-/* uiPopupBlockHandle->menuretval */
-#define UI_RETURN_CANCEL (1 << 0) /* cancel all menus cascading */
-#define UI_RETURN_OK (1 << 1) /* choice made */
-#define UI_RETURN_OUT (1 << 2) /* left the menu */
-#define UI_RETURN_OUT_PARENT (1 << 3) /* let the parent handle this event */
-#define UI_RETURN_UPDATE (1 << 4) /* update the button that opened */
-#define UI_RETURN_POPUP_OK (1 << 5) /* popup is ok to be handled */
+/** #uiBlock.flag (controls) */
+enum {
+ UI_BLOCK_LOOP = 1 << 0,
+ UI_BLOCK_IS_FLIP = 1 << 1,
+ UI_BLOCK_NO_FLIP = 1 << 2,
+ UI_BLOCK_NUMSELECT = 1 << 3,
+ /** Don't apply window clipping. */
+ UI_BLOCK_NO_WIN_CLIP = 1 << 4,
+ UI_BLOCK_CLIPBOTTOM = 1 << 5,
+ UI_BLOCK_CLIPTOP = 1 << 6,
+ UI_BLOCK_MOVEMOUSE_QUIT = 1 << 7,
+ UI_BLOCK_KEEP_OPEN = 1 << 8,
+ UI_BLOCK_POPUP = 1 << 9,
+ UI_BLOCK_OUT_1 = 1 << 10,
+ UI_BLOCK_SEARCH_MENU = 1 << 11,
+ UI_BLOCK_POPUP_MEMORY = 1 << 12,
+ /* Stop handling mouse events. */
+ UI_BLOCK_CLIP_EVENTS = 1 << 13,
+
+ /* block->flag bits 14-17 are identical to but->drawflag bits */
+
+ UI_BLOCK_POPUP_HOLD = 1 << 18,
+ UI_BLOCK_LIST_ITEM = 1 << 19,
+ UI_BLOCK_RADIAL = 1 << 20,
+ UI_BLOCK_POPOVER = 1 << 21,
+ UI_BLOCK_POPOVER_ONCE = 1 << 22,
+ /** Always show keymaps, even for non-menus. */
+ UI_BLOCK_SHOW_SHORTCUT_ALWAYS = 1 << 23,
+};
+
+/** #uiPopupBlockHandle.menuretval */
+enum {
+ /** Cancel all menus cascading. */
+ UI_RETURN_CANCEL = 1 << 0,
+ /** Choice made. */
+ UI_RETURN_OK = 1 << 1,
+ /** Left the menu. */
+ UI_RETURN_OUT = 1 << 2,
+ /** Let the parent handle this event. */
+ UI_RETURN_OUT_PARENT = 1 << 3,
+ /** Update the button that opened. */
+ UI_RETURN_UPDATE = 1 << 4,
+ /** Popup is ok to be handled. */
+ UI_RETURN_POPUP_OK = 1 << 5,
+};
/* panel controls */
-#define UI_PNL_SOLID (1 << 1)
-#define UI_PNL_CLOSE (1 << 5)
-#define UI_PNL_SCALE (1 << 9)
+enum {
+ UI_PNL_SOLID = 1 << 1,
+ UI_PNL_CLOSE = 1 << 5,
+ UI_PNL_SCALE = 1 << 9,
+};
/* but->flag - general state flags. */
enum {
- /* warning, the first 6 flags are internal */
- UI_BUT_ICON_SUBMENU = (1 << 6),
- UI_BUT_ICON_PREVIEW = (1 << 7),
-
- UI_BUT_NODE_LINK = (1 << 8),
- UI_BUT_NODE_ACTIVE = (1 << 9),
- UI_BUT_DRAG_LOCK = (1 << 10),
- UI_BUT_DISABLED = (1 << 11), /* grayed out and uneditable */
- UI_BUT_COLOR_LOCK = (1 << 12),
- UI_BUT_ANIMATED = (1 << 13),
- UI_BUT_ANIMATED_KEY = (1 << 14),
- UI_BUT_DRIVEN = (1 << 15),
- UI_BUT_REDALERT = (1 << 16),
- UI_BUT_INACTIVE = (1 << 17), /* grayed out but still editable */
- UI_BUT_LAST_ACTIVE = (1 << 18),
- UI_BUT_UNDO = (1 << 19),
- UI_BUT_IMMEDIATE = (1 << 20),
- UI_BUT_NO_UTF8 = (1 << 21),
-
- UI_BUT_VEC_SIZE_LOCK = (1 << 22), /* used to flag if color hsv-circle should keep luminance */
- UI_BUT_COLOR_CUBIC = (1 << 23), /* cubic saturation for the color wheel */
- UI_BUT_LIST_ITEM = (1 << 24), /* This but is "inside" a list item (currently used to change theme colors). */
- UI_BUT_DRAG_MULTI = (1 << 25), /* edit this button as well as the active button (not just dragging) */
-
- UI_BUT_HAS_SEP_CHAR = (1 << 27), /* but->str contains UI_SEP_CHAR, used for key shortcuts */
- UI_BUT_UPDATE_DELAY = (1 << 28), /* don't run updates while dragging (needed in rare cases). */
- UI_BUT_TEXTEDIT_UPDATE = (1 << 29), /* when widget is in textedit mode, update value on each char stroke */
- UI_BUT_VALUE_CLEAR = (1 << 30), /* show 'x' icon to clear/unlink value of text or search button */
-
- UI_BUT_OVERRIDEN = (1u << 31u), /* RNA property of the button is overridden from linked reference data. */
+ /** warning, the first 6 flags are internal. */
+ UI_BUT_ICON_SUBMENU = 1 << 6,
+ UI_BUT_ICON_PREVIEW = 1 << 7,
+
+ UI_BUT_NODE_LINK = 1 << 8,
+ UI_BUT_NODE_ACTIVE = 1 << 9,
+ UI_BUT_DRAG_LOCK = 1 << 10,
+ /** grayed out and uneditable */
+ UI_BUT_DISABLED = 1 << 11,
+ UI_BUT_COLOR_LOCK = 1 << 12,
+ UI_BUT_ANIMATED = 1 << 13,
+ UI_BUT_ANIMATED_KEY = 1 << 14,
+ UI_BUT_DRIVEN = 1 << 15,
+ UI_BUT_REDALERT = 1 << 16,
+ /** grayed out but still editable */
+ UI_BUT_INACTIVE = 1 << 17,
+ UI_BUT_LAST_ACTIVE = 1 << 18,
+ UI_BUT_UNDO = 1 << 19,
+ UI_BUT_IMMEDIATE = 1 << 20,
+ UI_BUT_NO_UTF8 = 1 << 21,
+
+ /** used to flag if color hsv-circle should keep luminance */
+ UI_BUT_VEC_SIZE_LOCK = 1 << 22,
+ /** cubic saturation for the color wheel */
+ UI_BUT_COLOR_CUBIC = 1 << 23,
+ /** This but is "inside" a list item (currently used to change theme colors). */
+ UI_BUT_LIST_ITEM = 1 << 24,
+ /** edit this button as well as the active button (not just dragging) */
+ UI_BUT_DRAG_MULTI = 1 << 25,
+
+ /** #uiBut.str contains #UI_SEP_CHAR, used for key shortcuts */
+ UI_BUT_HAS_SEP_CHAR = 1 << 27,
+ /** Don't run updates while dragging (needed in rare cases). */
+ UI_BUT_UPDATE_DELAY = 1 << 28,
+ /** When widget is in textedit mode, update value on each char stroke */
+ UI_BUT_TEXTEDIT_UPDATE = 1 << 29,
+ /** Show 'x' icon to clear/unlink value of text or search button. */
+ UI_BUT_VALUE_CLEAR = 1 << 30,
+
+ /** RNA property of the button is overridden from linked reference data. */
+ UI_BUT_OVERRIDEN = 1u << 31u,
};
#define UI_PANEL_WIDTH 340
#define UI_COMPACT_PANEL_WIDTH 160
#define UI_NAVIGATION_REGION_WIDTH UI_COMPACT_PANEL_WIDTH
+#define UI_NARROW_NAVIGATION_REGION_WIDTH 100
#define UI_PANEL_CATEGORY_MARGIN_WIDTH (U.widget_unit * 1.0f)
@@ -209,39 +227,48 @@ enum {
* (except for the 'align' ones)!
*/
enum {
- /* Text and icon alignment (by default, they are centered). */
- UI_BUT_TEXT_LEFT = (1 << 1),
- UI_BUT_ICON_LEFT = (1 << 2),
- UI_BUT_TEXT_RIGHT = (1 << 3),
- /* Prevent the button to show any tooltip. */
- UI_BUT_NO_TOOLTIP = (1 << 4),
+ /** Text and icon alignment (by default, they are centered). */
+ UI_BUT_TEXT_LEFT = 1 << 1,
+ UI_BUT_ICON_LEFT = 1 << 2,
+ UI_BUT_TEXT_RIGHT = 1 << 3,
+ /** Prevent the button to show any tooltip. */
+ UI_BUT_NO_TOOLTIP = 1 << 4,
/* Button align flag, for drawing groups together.
* Used in 'uiBlock.flag', take care! */
- UI_BUT_ALIGN_TOP = (1 << 14),
- UI_BUT_ALIGN_LEFT = (1 << 15),
- UI_BUT_ALIGN_RIGHT = (1 << 16),
- UI_BUT_ALIGN_DOWN = (1 << 17),
- UI_BUT_ALIGN = (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN),
+ UI_BUT_ALIGN_TOP = 1 << 14,
+ UI_BUT_ALIGN_LEFT = 1 << 15,
+ UI_BUT_ALIGN_RIGHT = 1 << 16,
+ UI_BUT_ALIGN_DOWN = 1 << 17,
+ UI_BUT_ALIGN = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN,
/* end bits shared with 'uiBlock.flag' */
- /* Warning - HACK! Needed for buttons which are not TOP/LEFT aligned, but have some top/left corner stitched to some
- * other TOP/LEFT-aligned button, because of 'corrective' hack in widget_roundbox_set()... */
- UI_BUT_ALIGN_STITCH_TOP = (1 << 18),
- UI_BUT_ALIGN_STITCH_LEFT = (1 << 19),
- UI_BUT_ALIGN_ALL = (UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT),
+ /**
+ * Warning - HACK!
+ * Needed for buttons which are not TOP/LEFT aligned,
+ * but have some top/left corner stitched to some other TOP/LEFT-aligned button,
+ * because of 'corrective' hack in widget_roundbox_set()... */
+ UI_BUT_ALIGN_STITCH_TOP = 1 << 18,
+ UI_BUT_ALIGN_STITCH_LEFT = 1 << 19,
+ UI_BUT_ALIGN_ALL = UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT,
- UI_BUT_BOX_ITEM = (1 << 20), /* This but is "inside" a box item (currently used to change theme colors). */
+ /** This but is "inside" a box item (currently used to change theme colors). */
+ UI_BUT_BOX_ITEM = 1 << 20,
- UI_BUT_ACTIVE_LEFT = (1 << 21), /* Active left part of number button */
- UI_BUT_ACTIVE_RIGHT = (1 << 22), /* Active right part of number button */
+ /** Active left part of number button */
+ UI_BUT_ACTIVE_LEFT = 1 << 21,
+ /** Active right part of number button */
+ UI_BUT_ACTIVE_RIGHT = 1 << 22,
/* (also used by search buttons to enforce shortcut display for their items). */
- UI_BUT_HAS_SHORTCUT = (1 << 23), /* Button has shortcut text. */
+ /** Button has shortcut text. */
+ UI_BUT_HAS_SHORTCUT = 1 << 23,
- UI_BUT_ICON_REVERSE = (1 << 24), /* Reverse order of consecutive off/on icons */
+ /** Reverse order of consecutive off/on icons */
+ UI_BUT_ICON_REVERSE = 1 << 24,
- UI_BUT_ANIMATED_CHANGED = (1 << 25), /* Value is animated, but the current value differs from the animated one. */
+ /** Value is animated, but the current value differs from the animated one. */
+ UI_BUT_ANIMATED_CHANGED = 1 << 25,
};
/* scale fixed button widths by this to account for DPI */
@@ -270,66 +297,78 @@ typedef enum {
/* assigned to but->type, OR'd with the flags above when passing args */
typedef enum {
- UI_BTYPE_BUT = (1 << 9),
- UI_BTYPE_ROW = (2 << 9),
- UI_BTYPE_TEXT = (3 << 9),
- UI_BTYPE_MENU = (4 << 9), /* dropdown list */
- UI_BTYPE_BUT_MENU = (5 << 9),
- UI_BTYPE_NUM = (6 << 9), /* number button */
- UI_BTYPE_NUM_SLIDER = (7 << 9), /* number slider */
- UI_BTYPE_TOGGLE = (8 << 9),
- UI_BTYPE_TOGGLE_N = (9 << 9),
- UI_BTYPE_ICON_TOGGLE = (10 << 9),
- UI_BTYPE_ICON_TOGGLE_N = (11 << 9),
- UI_BTYPE_BUT_TOGGLE = (12 << 9), /* same as regular toggle, but no on/off state displayed */
- UI_BTYPE_CHECKBOX = (13 << 9), /* similar to toggle, display a 'tick' */
- UI_BTYPE_CHECKBOX_N = (14 << 9),
- UI_BTYPE_COLOR = (15 << 9),
- UI_BTYPE_TAB = (16 << 9),
- UI_BTYPE_POPOVER = (17 << 9),
- UI_BTYPE_SCROLL = (18 << 9),
- UI_BTYPE_BLOCK = (19 << 9),
- UI_BTYPE_LABEL = (20 << 9),
- UI_BTYPE_KEY_EVENT = (24 << 9),
- UI_BTYPE_HSVCUBE = (26 << 9),
- UI_BTYPE_PULLDOWN = (27 << 9), /* menu (often used in headers), **_MENU /w different draw-type */
- UI_BTYPE_ROUNDBOX = (28 << 9),
- UI_BTYPE_COLORBAND = (30 << 9),
- UI_BTYPE_UNITVEC = (31 << 9), /* sphere widget (used to input a unit-vector, aka normal) */
- UI_BTYPE_CURVE = (32 << 9),
- UI_BTYPE_LISTBOX = (36 << 9),
- UI_BTYPE_LISTROW = (37 << 9),
- UI_BTYPE_HSVCIRCLE = (38 << 9),
- UI_BTYPE_TRACK_PREVIEW = (40 << 9),
-
- /* buttons with value >= UI_BTYPE_SEARCH_MENU don't get undo pushes */
- UI_BTYPE_SEARCH_MENU = (41 << 9),
- UI_BTYPE_EXTRA = (42 << 9),
- UI_BTYPE_HOTKEY_EVENT = (46 << 9),
- UI_BTYPE_IMAGE = (47 << 9), /* non-interactive image, used for splash screen */
- UI_BTYPE_HISTOGRAM = (48 << 9),
- UI_BTYPE_WAVEFORM = (49 << 9),
- UI_BTYPE_VECTORSCOPE = (50 << 9),
- UI_BTYPE_PROGRESS_BAR = (51 << 9),
- UI_BTYPE_NODE_SOCKET = (53 << 9),
- UI_BTYPE_SEPR = (54 << 9),
- UI_BTYPE_SEPR_LINE = (55 << 9),
- UI_BTYPE_SEPR_SPACER = (56 << 9), /* Dynamically fill available space. */
- UI_BTYPE_GRIP = (57 << 9), /* resize handle (resize uilist) */
+ UI_BTYPE_BUT = 1 << 9,
+ UI_BTYPE_ROW = 2 << 9,
+ UI_BTYPE_TEXT = 3 << 9,
+ /** dropdown list */
+ UI_BTYPE_MENU = 4 << 9,
+ UI_BTYPE_BUT_MENU = 5 << 9,
+ /** number button */
+ UI_BTYPE_NUM = 6 << 9,
+ /** number slider */
+ UI_BTYPE_NUM_SLIDER = 7 << 9,
+ UI_BTYPE_TOGGLE = 8 << 9,
+ UI_BTYPE_TOGGLE_N = 9 << 9,
+ UI_BTYPE_ICON_TOGGLE = 10 << 9,
+ UI_BTYPE_ICON_TOGGLE_N = 11 << 9,
+ /** same as regular toggle, but no on/off state displayed */
+ UI_BTYPE_BUT_TOGGLE = 12 << 9,
+ /** similar to toggle, display a 'tick' */
+ UI_BTYPE_CHECKBOX = 13 << 9,
+ UI_BTYPE_CHECKBOX_N = 14 << 9,
+ UI_BTYPE_COLOR = 15 << 9,
+ UI_BTYPE_TAB = 16 << 9,
+ UI_BTYPE_POPOVER = 17 << 9,
+ UI_BTYPE_SCROLL = 18 << 9,
+ UI_BTYPE_BLOCK = 19 << 9,
+ UI_BTYPE_LABEL = 20 << 9,
+ UI_BTYPE_KEY_EVENT = 24 << 9,
+ UI_BTYPE_HSVCUBE = 26 << 9,
+ /** menu (often used in headers), **_MENU /w different draw-type */
+ UI_BTYPE_PULLDOWN = 27 << 9,
+ UI_BTYPE_ROUNDBOX = 28 << 9,
+ UI_BTYPE_COLORBAND = 30 << 9,
+ /** sphere widget (used to input a unit-vector, aka normal) */
+ UI_BTYPE_UNITVEC = 31 << 9,
+ UI_BTYPE_CURVE = 32 << 9,
+ UI_BTYPE_LISTBOX = 36 << 9,
+ UI_BTYPE_LISTROW = 37 << 9,
+ UI_BTYPE_HSVCIRCLE = 38 << 9,
+ UI_BTYPE_TRACK_PREVIEW = 40 << 9,
+
+ /** Buttons with value >= #UI_BTYPE_SEARCH_MENU don't get undo pushes. */
+ UI_BTYPE_SEARCH_MENU = 41 << 9,
+ UI_BTYPE_EXTRA = 42 << 9,
+ UI_BTYPE_HOTKEY_EVENT = 46 << 9,
+ /** Non-interactive image, used for splash screen */
+ UI_BTYPE_IMAGE = 47 << 9,
+ UI_BTYPE_HISTOGRAM = 48 << 9,
+ UI_BTYPE_WAVEFORM = 49 << 9,
+ UI_BTYPE_VECTORSCOPE = 50 << 9,
+ UI_BTYPE_PROGRESS_BAR = 51 << 9,
+ UI_BTYPE_NODE_SOCKET = 53 << 9,
+ UI_BTYPE_SEPR = 54 << 9,
+ UI_BTYPE_SEPR_LINE = 55 << 9,
+ /** Dynamically fill available space. */
+ UI_BTYPE_SEPR_SPACER = 56 << 9,
+ /** Resize handle (resize uilist). */
+ UI_BTYPE_GRIP = 57 << 9,
} eButType;
#define BUTTYPE (63 << 9)
-/* gradient types, for color picker UI_BTYPE_HSVCUBE etc */
-#define UI_GRAD_SV 0
-#define UI_GRAD_HV 1
-#define UI_GRAD_HS 2
-#define UI_GRAD_H 3
-#define UI_GRAD_S 4
-#define UI_GRAD_V 5
-
-#define UI_GRAD_V_ALT 9
-#define UI_GRAD_L_ALT 10
+/** Gradient types, for color picker #UI_BTYPE_HSVCUBE etc. */
+enum {
+ UI_GRAD_SV = 0,
+ UI_GRAD_HV = 1,
+ UI_GRAD_HS = 2,
+ UI_GRAD_H = 3,
+ UI_GRAD_S = 4,
+ UI_GRAD_V = 5,
+
+ UI_GRAD_V_ALT = 9,
+ UI_GRAD_L_ALT = 10,
+};
#define UI_PALETTE_COLOR 20
@@ -359,10 +398,12 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo
void UI_draw_safe_areas(uint pos, float x1, float x2, float y1, float y2,
const float title_aspect[2], const float action_aspect[2]);
-/* state for scrolldrawing */
-#define UI_SCROLL_PRESSED (1 << 0)
-#define UI_SCROLL_ARROWS (1 << 1)
-#define UI_SCROLL_NO_OUTLINE (1 << 2)
+/** State for scrolldrawing. */
+enum {
+ UI_SCROLL_PRESSED = 1 << 0,
+ UI_SCROLL_ARROWS = 1 << 1,
+ UI_SCROLL_NO_OUTLINE = 1 << 2,
+};
void UI_draw_widget_scroll(struct uiWidgetColors *wcol, const struct rcti *rect, const struct rcti *slider, int state);
/* Shortening string helper. */
@@ -370,20 +411,21 @@ float UI_text_clip_middle_ex(
const struct uiFontStyle *fstyle, char *str, float okwidth, const float minwidth,
const size_t max_len, const char rpart_sep);
-/* Callbacks
+/**
+ * Callbacks
*
* UI_block_func_handle_set/ButmFunc are for handling events through a callback.
* HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is
* mostly for compatibility with older code.
*
- * UI_but_func_complete_set is for tab completion.
+ * - #UI_but_func_complete_set is for tab completion.
*
- * uiButSearchFunc is for name buttons, showing a popup with matches
+ * - #uiButSearchFunc is for name buttons, showing a popup with matches
*
- * UI_block_func_set and UI_but_func_set are callbacks run when a button is used,
- * in case events, operators or RNA are not sufficient to handle the button.
+ * - #UI_block_func_set and UI_but_func_set are callbacks run when a button is used,
+ * in case events, operators or RNA are not sufficient to handle the button.
*
- * UI_but_funcN_set will free the argument with MEM_freeN. */
+ * - #UI_but_funcN_set will free the argument with MEM_freeN. */
typedef struct uiSearchItems uiSearchItems;
@@ -396,6 +438,7 @@ typedef struct ARegion *(*uiButSearchCreateFunc)(struct bContext *C, struct AReg
typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, const char *str, uiSearchItems *items);
/* Must return allocated string. */
typedef char *(*uiButToolTipFunc)(struct bContext *C, void *argN, const char *tip);
+typedef int (*uiButPushedStateFunc)(struct bContext *C, void *arg);
typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event);
@@ -422,13 +465,14 @@ bool UI_block_is_empty(const uiBlock *block);
/* interface_region_menu_popup.c */
-/* Popup Menus
+/**
+ * Popup Menus
*
* Functions used to create popup menus. For more extended menus the
* UI_popup_menu_begin/End functions can be used to define own items with
* the uiItem functions in between. If it is a simple confirmation menu
- * or similar, popups can be created with a single function call. */
-
+ * or similar, popups can be created with a single function call.
+ */
typedef struct uiPopupMenu uiPopupMenu;
uiPopupMenu *UI_popup_menu_begin(
@@ -489,7 +533,9 @@ typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1);
void UI_popup_block_invoke(struct bContext *C, uiBlockCreateFunc func, void *arg);
void UI_popup_block_invoke_ex(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext);
void UI_popup_block_ex(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg, struct wmOperator *op);
-/* void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext); */ /* UNUSED */
+#if 0 /* UNUSED */
+void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext);
+#endif
void UI_popup_block_close(struct bContext *C, struct wmWindow *win, uiBlock *block);
@@ -688,7 +734,7 @@ enum {
BUT_GET_RNA_TIP,
BUT_GET_RNAENUM_TIP,
BUT_GET_OP_KEYMAP,
- BUT_GET_PROP_KEYMAP
+ BUT_GET_PROP_KEYMAP,
};
typedef struct uiStringInfo {
@@ -705,7 +751,8 @@ void UI_but_string_info_get(struct bContext *C, uiBut *but, ...) ATTR_SENTINEL(0
/* Name of the main py op from i18n addon. */
#define EDTSRC_I18N_OP_NAME "UI_OT_edittranslation"
-/* Special Buttons
+/**
+ * Special Buttons
*
* Buttons with a more specific purpose:
* - MenuBut: buttons that popup a menu (in headers usually).
@@ -713,21 +760,23 @@ void UI_but_string_info_get(struct bContext *C, uiBut *but, ...) ATTR_SENTINEL(0
* - BlockBut: buttons that popup a block with more buttons.
* - KeyevtBut: buttons that can be used to turn key events into values.
* - PickerButtons: buttons like the color picker (for code sharing).
- * - AutoButR: RNA property button with type automatically defined. */
-
-#define UI_ID_RENAME (1 << 0)
-#define UI_ID_BROWSE (1 << 1)
-#define UI_ID_ADD_NEW (1 << 2)
-#define UI_ID_OPEN (1 << 3)
-#define UI_ID_ALONE (1 << 4)
-#define UI_ID_DELETE (1 << 5)
-#define UI_ID_LOCAL (1 << 6)
-#define UI_ID_AUTO_NAME (1 << 7)
-#define UI_ID_FAKE_USER (1 << 8)
-#define UI_ID_PIN (1 << 9)
-#define UI_ID_PREVIEWS (1 << 10)
-#define UI_ID_OVERRIDE (1 << 11)
-#define UI_ID_FULL (UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL)
+ * - AutoButR: RNA property button with type automatically defined.
+ */
+enum {
+ UI_ID_RENAME = 1 << 0,
+ UI_ID_BROWSE = 1 << 1,
+ UI_ID_ADD_NEW = 1 << 2,
+ UI_ID_ALONE = 1 << 4,
+ UI_ID_OPEN = 1 << 3,
+ UI_ID_DELETE = 1 << 5,
+ UI_ID_LOCAL = 1 << 6,
+ UI_ID_AUTO_NAME = 1 << 7,
+ UI_ID_FAKE_USER = 1 << 8,
+ UI_ID_PIN = 1 << 9,
+ UI_ID_PREVIEWS = 1 << 10,
+ UI_ID_OVERRIDE = 1 << 11,
+ UI_ID_FULL = UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL,
+};
/**
* Ways to limit what is displayed in ID-search popup.
@@ -778,9 +827,9 @@ typedef enum {
/* Return info for uiDefAutoButsRNA */
typedef enum {
/* Returns when no buttons were added */
- UI_PROP_BUTS_NONE_ADDED = (1 << 0),
+ UI_PROP_BUTS_NONE_ADDED = 1 << 0,
/* Returned when any property failed the custom check callback (check_prop) */
- UI_PROP_BUTS_ANY_FAILED_CHECK = (1 << 1),
+ UI_PROP_BUTS_ANY_FAILED_CHECK = 1 << 1,
} eAutoPropButsReturn;
uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2);
@@ -832,6 +881,8 @@ void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but);
void UI_but_func_hold_set(uiBut *but, uiButHandleHoldFunc func, void *argN);
+void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, void *arg);
+
/* Autocomplete
*
* Tab complete helper functions, for use in uiButCompleteFunc callbacks.
@@ -913,44 +964,52 @@ void UI_exit(void);
* uiBlockCurLayout. */
/* layout */
-#define UI_LAYOUT_HORIZONTAL 0
-#define UI_LAYOUT_VERTICAL 1
+enum {
+ UI_LAYOUT_HORIZONTAL = 0,
+ UI_LAYOUT_VERTICAL = 1,
+};
-#define UI_LAYOUT_PANEL 0
-#define UI_LAYOUT_HEADER 1
-#define UI_LAYOUT_MENU 2
-#define UI_LAYOUT_TOOLBAR 3
-#define UI_LAYOUT_PIEMENU 4
-#define UI_LAYOUT_VERT_BAR 5
+enum {
+ UI_LAYOUT_PANEL = 0,
+ UI_LAYOUT_HEADER = 1,
+ UI_LAYOUT_MENU = 2,
+ UI_LAYOUT_TOOLBAR = 3,
+ UI_LAYOUT_PIEMENU = 4,
+ UI_LAYOUT_VERT_BAR = 5,
+};
#define UI_UNIT_X ((void)0, U.widget_unit)
#define UI_UNIT_Y ((void)0, U.widget_unit)
-#define UI_LAYOUT_ALIGN_EXPAND 0
-#define UI_LAYOUT_ALIGN_LEFT 1
-#define UI_LAYOUT_ALIGN_CENTER 2
-#define UI_LAYOUT_ALIGN_RIGHT 3
-
-#define UI_ITEM_O_RETURN_PROPS (1 << 0)
-#define UI_ITEM_R_EXPAND (1 << 1)
-#define UI_ITEM_R_SLIDER (1 << 2)
-#define UI_ITEM_R_TOGGLE (1 << 3)
-#define UI_ITEM_R_ICON_ONLY (1 << 4)
-#define UI_ITEM_R_EVENT (1 << 5)
-#define UI_ITEM_R_FULL_EVENT (1 << 6)
-#define UI_ITEM_R_NO_BG (1 << 7)
-#define UI_ITEM_R_IMMEDIATE (1 << 8)
-#define UI_ITEM_O_DEPRESS (1 << 9)
-#define UI_ITEM_R_COMPACT (1 << 10)
+enum {
+ UI_LAYOUT_ALIGN_EXPAND = 0,
+ UI_LAYOUT_ALIGN_LEFT = 1,
+ UI_LAYOUT_ALIGN_CENTER = 2,
+ UI_LAYOUT_ALIGN_RIGHT = 3,
+};
+
+enum {
+ UI_ITEM_O_RETURN_PROPS = 1 << 0,
+ UI_ITEM_R_EXPAND = 1 << 1,
+ UI_ITEM_R_SLIDER = 1 << 2,
+ UI_ITEM_R_TOGGLE = 1 << 3,
+ UI_ITEM_R_ICON_ONLY = 1 << 4,
+ UI_ITEM_R_EVENT = 1 << 5,
+ UI_ITEM_R_FULL_EVENT = 1 << 6,
+ UI_ITEM_R_NO_BG = 1 << 7,
+ UI_ITEM_R_IMMEDIATE = 1 << 8,
+ UI_ITEM_O_DEPRESS = 1 << 9,
+ UI_ITEM_R_COMPACT = 1 << 10,
+};
#define UI_HEADER_OFFSET ((void)0, 0.4f * UI_UNIT_X)
/* uiLayoutOperatorButs flags */
enum {
- UI_TEMPLATE_OP_PROPS_SHOW_TITLE = (1 << 0),
- UI_TEMPLATE_OP_PROPS_SHOW_EMPTY = (1 << 1),
- UI_TEMPLATE_OP_PROPS_COMPACT = (1 << 2),
- UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED = (1 << 3),
+ UI_TEMPLATE_OP_PROPS_SHOW_TITLE = 1 << 0,
+ UI_TEMPLATE_OP_PROPS_SHOW_EMPTY = 1 << 1,
+ UI_TEMPLATE_OP_PROPS_COMPACT = 1 << 2,
+ UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED = 1 << 3,
};
/* used for transp checkers */
@@ -964,13 +1023,13 @@ enum {
* 8------4 */
enum {
- UI_CNR_TOP_LEFT = (1 << 0),
- UI_CNR_TOP_RIGHT = (1 << 1),
- UI_CNR_BOTTOM_RIGHT = (1 << 2),
- UI_CNR_BOTTOM_LEFT = (1 << 3),
+ UI_CNR_TOP_LEFT = 1 << 0,
+ UI_CNR_TOP_RIGHT = 1 << 1,
+ UI_CNR_BOTTOM_RIGHT = 1 << 2,
+ UI_CNR_BOTTOM_LEFT = 1 << 3,
/* just for convenience */
UI_CNR_NONE = 0,
- UI_CNR_ALL = (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)
+ UI_CNR_ALL = (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT),
};
uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, struct uiStyle *style);
@@ -1133,7 +1192,7 @@ void uiTemplateList(
uiLayout *layout, struct bContext *C, const char *listtype_name, const char *list_id,
struct PointerRNA *dataptr, const char *propname, struct PointerRNA *active_dataptr,
const char *active_propname, const char *item_dyntip_propname,
- int rows, int maxrows, int layout_type, int columns, bool reverse);
+ int rows, int maxrows, int layout_type, int columns, bool sort_reverse, bool sort_lock);
void uiTemplateNodeLink(uiLayout *layout, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input);
void uiTemplateNodeView(uiLayout *layout, struct bContext *C, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input);
void uiTemplateTextureUser(uiLayout *layout, struct bContext *C);
@@ -1193,13 +1252,19 @@ void uiItemsFullEnumO_items(
const EnumPropertyItem *item_array, int totitem);
void uiItemL(uiLayout *layout, const char *name, int icon); /* label */
-void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon); /* label icon for dragging */
-void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon); /* menu */
-void uiItemMContents(uiLayout *layout, const char *menuname); /* menu contents */
-void uiItemV(uiLayout *layout, const char *name, int icon, int argval); /* value */
-void uiItemS(uiLayout *layout); /* separator */
+/* label icon for dragging */
+void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon);
+/* menu */
+void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon);
+/* menu contents */
+void uiItemMContents(uiLayout *layout, const char *menuname);
+/* value */
+void uiItemV(uiLayout *layout, const char *name, int icon, int argval);
+/* separator */
+void uiItemS(uiLayout *layout);
void uiItemS_ex(uiLayout *layout, float factor);
-void uiItemSpacer(uiLayout *layout); /* Special separator. */
+/* Special separator. */
+void uiItemSpacer(uiLayout *layout);
void uiItemPopoverPanel_ptr(
uiLayout *layout, struct bContext *C,
@@ -1260,7 +1325,7 @@ uiBut *UI_region_active_but_get(struct ARegion *ar);
typedef enum eFontStyle_Align {
UI_STYLE_TEXT_LEFT = 0,
UI_STYLE_TEXT_CENTER = 1,
- UI_STYLE_TEXT_RIGHT = 2
+ UI_STYLE_TEXT_RIGHT = 2,
} eFontStyle_Align;
struct uiFontStyleDraw_Params {
@@ -1340,6 +1405,10 @@ void UI_widgetbase_draw_cache_begin(void);
void UI_widgetbase_draw_cache_flush(void);
void UI_widgetbase_draw_cache_end(void);
+/* Use for resetting the theme. */
+void UI_theme_init_default(void);
+void UI_style_init_default(void);
+
/* Special drawing for toolbar, mainly workarounds for inflexible icon sizing. */
#define USE_UI_TOOLBAR_HACK
diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h
index 640d66c9ac4..bd1f04ebcff 100644
--- a/source/blender/editors/include/UI_interface_icons.h
+++ b/source/blender/editors/include/UI_interface_icons.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,26 +15,20 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file UI_interface_icons.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
#ifndef __UI_INTERFACE_ICONS_H__
#define __UI_INTERFACE_ICONS_H__
-struct bContext;
struct ID;
-struct Scene;
-struct PreviewImage;
struct PointerRNA;
+struct PreviewImage;
+struct Scene;
+struct bContext;
enum eIconSizes;
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 92871484e66..85b2ccf2077 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPL/BL DUAL 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
@@ -17,23 +15,17 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file UI_resources.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
-#include "BLI_sys_types.h"
-
#ifndef __UI_RESOURCES_H__
#define __UI_RESOURCES_H__
+#include "BLI_sys_types.h"
+
/* Define icon enum. */
#define DEF_ICON(name) ICON_##name,
#define DEF_ICON_VECTOR(name) ICON_##name,
@@ -58,6 +50,8 @@ typedef enum ThemeColorID {
// common colors among spaces
TH_BACK,
+ /** Use when 'TH_SHOW_BACK_GRAD' is set (the lower, darker color). */
+ TH_BACK_GRAD,
TH_TEXT,
TH_TEXT_HI,
TH_TITLE,
@@ -162,7 +156,7 @@ typedef enum ThemeColorID {
TH_KEYBORDER,
TH_KEYBORDER_SELECT,
- TH_LAMP,
+ TH_LIGHT,
TH_SPEAKER,
TH_CAMERA,
TH_EMPTY,
@@ -296,8 +290,6 @@ typedef enum ThemeColorID {
TH_GIZMO_A,
TH_GIZMO_B,
- TH_LOW_GRAD,
- TH_HIGH_GRAD,
TH_SHOW_BACK_GRAD,
TH_INFO_SELECTED,
@@ -343,6 +335,7 @@ int UI_GetThemeValueType(int colorid, int spacetype);
void UI_GetThemeColor3fv(int colorid, float col[3]);
void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]);
void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3]);
+void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4]);
// get the color, range 0.0-1.0, complete with shading offset
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
@@ -353,6 +346,10 @@ void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int o
// get four color values, scaled to 0.0-1.0 range
void UI_GetThemeColor4fv(int colorid, float col[4]);
+
+/* get four color values from specified space type, scaled to 0.0-1.0 range */
+void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4]);
+
// get four color values, range 0.0-1.0, complete with shading offset for the RGB components
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]);
void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]);
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index f35976750c9..8c944760972 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- *
* Generic 2d view with should allow drawing grids,
* panning, zooming, scrolling, ..
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file UI_view2d.h
- * \ingroup editorui
+/** \file
+ * \ingroup editorui
*/
#ifndef __UI_VIEW2D_H__
@@ -61,7 +53,7 @@ enum eView2D_CommonViewTypes {
/* headers (this is basically the same as listview, but no y-panning) */
V2D_COMMONVIEW_HEADER,
/* ui region containing panels */
- V2D_COMMONVIEW_PANELS_UI
+ V2D_COMMONVIEW_PANELS_UI,
};
/* ---- Defines for Scroller/Grid Arguments ----- */
@@ -85,7 +77,7 @@ enum eView2D_Units {
/* clamping of grid values to whole numbers */
enum eView2D_Clamp {
V2D_GRID_NOCLAMP = 0,
- V2D_GRID_CLAMP
+ V2D_GRID_CLAMP,
};
/* flags for grid-lines to draw */
@@ -134,13 +126,13 @@ struct View2D;
struct View2DGrid;
struct View2DScrollers;
-struct wmKeyConfig;
-struct bScreen;
+struct ARegion;
struct Scene;
struct ScrArea;
-struct ARegion;
struct bContext;
+struct bScreen;
struct rctf;
+struct wmKeyConfig;
typedef struct View2DGrid View2DGrid;
typedef struct View2DScrollers View2DScrollers;
diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt
index c2c2438b942..1ecd9e64924 100644
--- a/source/blender/editors/interface/CMakeLists.txt
+++ b/source/blender/editors/interface/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 7d82e8d2377..ffb13e9facf 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation 2002-2008, full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -164,7 +158,18 @@ void ui_block_to_window_rctf(const ARegion *ar, uiBlock *block, rctf *rct_dst, c
ui_block_to_window_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
}
-void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y) /* for mouse cursor */
+float ui_block_to_window_scale(const ARegion *ar, uiBlock *block)
+{
+ /* We could have function for this to avoid dummy arg. */
+ float dummy_x;
+ float min_y = 0, max_y = 1;
+ ui_block_to_window_fl(ar, block, &dummy_x, &min_y);
+ ui_block_to_window_fl(ar, block, &dummy_x, &max_y);
+ return max_y - min_y;
+}
+
+/* for mouse cursor */
+void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y)
{
float a, b, c, d, e, f, px, py;
int sx, sy, getsizex, getsizey;
@@ -436,7 +441,7 @@ static void ui_block_bounds_calc_centered_pie(uiBlock *block)
{
const int xy[2] = {
block->pie_data.pie_center_spawned[0],
- block->pie_data.pie_center_spawned[1]
+ block->pie_data.pie_center_spawned[1],
};
UI_block_translate(block, xy[0], xy[1]);
@@ -505,7 +510,8 @@ static void ui_block_bounds_calc_popup(
ui_block_bounds_calc(block);
/* If given, adjust input coordinates such that they would generate real final popup position.
- * Needed to handle correctly floating panels once they have been dragged around, see T52999. */
+ * Needed to handle correctly floating panels once they have been dragged around,
+ * see T52999. */
if (r_xy) {
r_xy[0] = xy[0] + block->rect.xmin - raw_x;
r_xy[1] = xy[1] + block->rect.ymin - raw_y;
@@ -1071,17 +1077,17 @@ static bool ui_but_event_property_operator_string(
"WM_OT_context_cycle_enum",
"WM_OT_context_cycle_array",
"WM_OT_context_menu_enum",
- NULL
+ NULL,
};
const char *ctx_enum_opnames[] = {
"WM_OT_context_set_enum",
- NULL
+ NULL,
};
const char *ctx_enum_opnames_for_Area_ui_type[] = {
"SCREEN_OT_space_type_set_or_cycle",
- NULL
+ NULL,
};
const char **opnames = ctx_toggle_opnames;
@@ -1116,7 +1122,8 @@ static bool ui_but_event_property_operator_string(
/* Don't use the button again. */
but = NULL;
- /* this version is only for finding hotkeys for properties (which get set via context using operators) */
+ /* this version is only for finding hotkeys for properties
+ * (which get set via context using operators) */
if (prop) {
/* to avoid massive slowdowns on property panels, for now, we only check the
* hotkeys for Editor / Scene settings...
@@ -1327,7 +1334,8 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
continue;
}
else if (((block->flag & UI_BLOCK_POPOVER) == 0) && UI_but_is_tool(but)) {
- /* For non-popovers, shown in shortcut only (has special shortcut handling code). */
+ /* For non-popovers, shown in shortcut only
+ * (has special shortcut handling code). */
continue;
}
}
@@ -2090,7 +2098,8 @@ void ui_but_value_set(uiBut *but, double value)
case PROP_ENUM:
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 */
+ /* toggle for enum/flag buttons */
+ ivalue ^= RNA_property_enum_get(&but->rnapoin, prop);
RNA_property_enum_set(&but->rnapoin, prop, ivalue);
}
else {
@@ -2294,7 +2303,8 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
{
int unit_type = RNA_SUBTYPE_UNIT_VALUE(UI_but_unit_type_get(but));
const double step_orig = step_default * UI_PRECISION_FLOAT_SCALE;
- /* Scaling up 'step_origg ' here is a bit arbitrary, its just giving better scales from user POV */
+ /* Scaling up 'step_origg ' here is a bit arbitrary,
+ * its just giving better scales from user POV */
const double scale_step = ui_get_but_scale_unit(but, step_orig * 10);
const double step = bUnit_ClosestScalar(scale_step, but->block->unit->system, unit_type);
@@ -2514,7 +2524,8 @@ bool ui_but_string_set_eval_num(bContext *C, uiBut *but, const char *str, double
bool is_unit_but = (ui_but_is_float(but) && ui_but_is_unit(but));
/* only enable verbose if we won't run again with units */
if (BPY_execute_string_as_number(C, NULL, str, is_unit_but == false, r_value)) {
- /* if the value parsed ok without unit conversion this button may still need a unit multiplier */
+ /* if the value parsed ok without unit conversion
+ * this button may still need a unit multiplier */
if (is_unit_but) {
char str_new[128];
@@ -2643,7 +2654,7 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
}
else if (but->type == UI_BTYPE_TEXT) {
/* string */
- if (!but->poin || (str[0] == '\0')) {
+ if (!but->poin) {
str = "";
}
else if (ui_but_is_utf8(but)) {
@@ -3045,6 +3056,61 @@ void UI_block_theme_style_set(uiBlock *block, char theme_style)
block->theme_style = theme_style;
}
+static void ui_but_build_drawstr_float(uiBut *but, double value)
+{
+ size_t slen = 0;
+ STR_CONCAT(but->drawstr, slen, but->str);
+
+ PropertySubType subtype = PROP_NONE;
+ if (but->rnaprop) {
+ subtype = RNA_property_subtype(but->rnaprop);
+ }
+
+ if (value == (double)FLT_MAX) {
+ STR_CONCAT(but->drawstr, slen, "inf");
+ }
+ else if (value == (double)-FLT_MIN) {
+ STR_CONCAT(but->drawstr, slen, "-inf");
+ }
+ else if (subtype == PROP_PERCENTAGE) {
+ int prec = ui_but_calc_float_precision(but, value);
+ STR_CONCATF(but->drawstr, slen, "%.*f %%", prec, value);
+ }
+ else if (subtype == PROP_PIXEL) {
+ int prec = ui_but_calc_float_precision(but, value);
+ STR_CONCATF(but->drawstr, slen, "%.*f px", prec, value);
+ }
+ else if (ui_but_is_unit(but)) {
+ char new_str[sizeof(but->drawstr)];
+ ui_get_but_string_unit(but, new_str, sizeof(new_str), value, true, -1);
+ STR_CONCAT(but->drawstr, slen, new_str);
+ }
+ else {
+ int prec = ui_but_calc_float_precision(but, value);
+ STR_CONCATF(but->drawstr, slen, "%.*f", prec, value);
+ }
+}
+
+static void ui_but_build_drawstr_int(uiBut *but, int value)
+{
+ size_t slen = 0;
+ STR_CONCAT(but->drawstr, slen, but->str);
+
+ PropertySubType subtype = PROP_NONE;
+ if (but->rnaprop) {
+ subtype = RNA_property_subtype(but->rnaprop);
+ }
+
+ STR_CONCATF(but->drawstr, slen, "%d", value);
+
+ if (subtype == PROP_PERCENTAGE) {
+ STR_CONCAT(but->drawstr, slen, "%");
+ }
+ else if (subtype == PROP_PIXEL) {
+ STR_CONCAT(but->drawstr, slen, " px");
+ }
+}
+
/**
* \param but: Button to update.
* \param validate: When set, this function may change the button value.
@@ -3134,52 +3200,15 @@ void ui_but_update_ex(uiBut *but, const bool validate)
case UI_BTYPE_NUM:
case UI_BTYPE_NUM_SLIDER:
-
- if (!but->editstr) {
- const char *drawstr_suffix = NULL;
- size_t slen;
-
- UI_GET_BUT_VALUE_INIT(but, value);
-
- slen = BLI_strncpy_rlen(but->drawstr, but->str, sizeof(but->drawstr));
-
- if (ui_but_is_float(but)) {
- if (value == (double) FLT_MAX) {
- slen += BLI_strncpy_rlen(but->drawstr + slen, "inf", sizeof(but->drawstr) - slen);
- }
- else if (value == (double) -FLT_MAX) {
- slen += BLI_strncpy_rlen(but->drawstr + slen, "-inf", sizeof(but->drawstr) - slen);
- }
- /* support length type buttons */
- else if (ui_but_is_unit(but)) {
- char new_str[sizeof(but->drawstr)];
- ui_get_but_string_unit(but, new_str, sizeof(new_str), value, true, -1);
- slen += BLI_strncpy_rlen(but->drawstr + slen, new_str, sizeof(but->drawstr) - slen);
- }
- else {
- const int prec = ui_but_calc_float_precision(but, value);
- slen += BLI_snprintf_rlen(but->drawstr + slen, sizeof(but->drawstr) - slen, "%.*f", prec, value);
- }
- }
- else {
- slen += BLI_snprintf_rlen(but->drawstr + slen, sizeof(but->drawstr) - slen, "%d", (int)value);
- }
-
- if (but->rnaprop) {
- PropertySubType pstype = RNA_property_subtype(but->rnaprop);
-
- if (pstype == PROP_PERCENTAGE) {
- drawstr_suffix = "%";
- }
- else if (pstype == PROP_PIXEL) {
- drawstr_suffix = " px";
- }
- }
-
- if (drawstr_suffix) {
- BLI_strncpy(but->drawstr + slen, drawstr_suffix, sizeof(but->drawstr) - slen);
- }
-
+ if (but->editstr) {
+ break;
+ }
+ UI_GET_BUT_VALUE_INIT(but, value);
+ if (ui_but_is_float(but)) {
+ ui_but_build_drawstr_float(but, value);
+ }
+ else {
+ ui_but_build_drawstr_int(but, (int)value);
}
break;
@@ -3489,7 +3518,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
int totitems = 0;
int columns, rows, a, b;
- int column_start = 0, column_end = 0;
+ int column_end = 0;
int nbr_entries_nosepr = 0;
UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
@@ -3502,7 +3531,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
for (item = item_array; item->identifier; item++, totitems++) {
if (!item->identifier[0]) {
- /* inconsistent, but menus with labels do not look good flipped */
+ /* inconsistent, but menus with categories do not look good flipped */
if (item->name) {
block->flag |= UI_BLOCK_NO_FLIP;
nbr_entries_nosepr++;
@@ -3526,10 +3555,12 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
while (rows * columns < totitems)
rows++;
- /* Title */
- uiDefBut(block, UI_BTYPE_LABEL, 0, RNA_property_ui_name(but->rnaprop),
- 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
- uiItemS(layout);
+ if (block->flag & UI_BLOCK_NO_FLIP) {
+ /* Title at the top for menus with categories. */
+ uiDefBut(block, UI_BTYPE_LABEL, 0, RNA_property_ui_name(but->rnaprop),
+ 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ uiItemS(layout);
+ }
/* note, item_array[...] is reversed on access */
@@ -3540,7 +3571,6 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
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 = totitems;
for (b = a + 1; b < totitems; b++) {
@@ -3556,12 +3586,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
column = uiLayoutColumn(split, false);
}
- if (block->flag & UI_BLOCK_NO_FLIP) {
- item = &item_array[a];
- }
- else {
- item = &item_array[(column_start + column_end - 1 - a)];
- }
+ item = &item_array[a];
if (!item->identifier[0]) {
if (item->name) {
@@ -3569,7 +3594,8 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
uiItemL(column, item->name, item->icon);
}
else {
- /* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */
+ /* Do not use uiItemL here, as our root layout is a menu one,
+ * it will add a fake blank icon! */
uiDefBut(block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
}
}
@@ -3591,6 +3617,13 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
}
}
+ if (!(block->flag & UI_BLOCK_NO_FLIP)) {
+ /* Title at the bottom for menus without categories. */
+ uiItemS(layout);
+ uiDefBut(block, UI_BTYPE_LABEL, 0, RNA_property_ui_name(but->rnaprop),
+ 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ }
+
UI_block_layout_set_current(block, layout);
if (free) {
@@ -4444,6 +4477,12 @@ void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN)
but->tip_argN = argN;
}
+void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, void *arg)
+{
+ but->pushed_state_func = func;
+ but->pushed_state_arg = arg;
+}
+
uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip)
{
uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
@@ -4588,7 +4627,8 @@ void UI_but_func_search_set(
uiButSearchFunc search_func, void *arg,
uiButHandleFunc bfunc, void *active)
{
- /* needed since callers don't have access to internal functions (as an alternative we could expose it) */
+ /* needed since callers don't have access to internal functions
+ * (as an alternative we could expose it) */
if (search_create_func == NULL) {
search_create_func = ui_searchbox_create_generic;
}
@@ -4637,7 +4677,8 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c
RNA_property_enum_items_gettexted((bContext *)C, ptr, prop, &item_array, NULL, &do_free);
for (item = item_array; item->identifier; item++) {
- /* note: need to give the index rather than the identifier because the enum can be freed */
+ /* note: need to give the index rather than the
+ * identifier because the enum can be freed */
if (BLI_strcasestr(item->name, str)) {
if (false == UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), item->icon))
break;
diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c
index d102c7c582d..9fc8c8f4bb1 100644
--- a/source/blender/editors/interface/interface_align.c
+++ b/source/blender/editors/interface/interface_align.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,15 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation 2002-2008, full recode.
- * Bastien Montagne 2015, full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_align.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
-#include "BLI_alloca.h"
#include "BLI_math.h"
#include "BLI_rect.h"
@@ -42,22 +34,25 @@
#ifdef USE_UIBUT_SPATIAL_ALIGN
/**
- * This struct stores a (simplified) 2D representation of all buttons of a same align group, with their
- * immediate neighbors (if found), and needed value to compute 'stitching' of aligned buttons.
+ * This struct stores a (simplified) 2D representation of all buttons of a same align group,
+ * with their immediate neighbors (if found),
+ * and needed value to compute 'stitching' of aligned buttons.
*
- * \note This simplistic struct cannot fully represent complex layouts where buttons share some 'align space' with
- * several others (see schema below), we'd need linked list and more complex code to handle that.
- * However, looks like we can do without that for now, which is rather lucky!
+ * \note This simplistic struct cannot fully represent complex layouts where buttons share some
+ * 'align space' with several others (see schema below), we'd need linked list and more
+ * complex code to handle that. However, looks like we can do without that for now,
+ * which is rather lucky!
*
* <pre>
- * +-----------+-----------+
- * | BUT 1 | BUT 2 | BUT 3 has two 'top' neighbors...
- * |-----------------------| => In practice, we only store one of BUT 1 or 2 (which ones is not
- * | BUT 3 | really deterministic), and assume the other stores a ref to BUT 3.
- * +-----------------------+
+ * +--------+-------+
+ * | BUT 1 | BUT 2 | BUT 3 has two 'top' neighbors...
+ * |----------------| => In practice, we only store one of BUT 1 or 2 (which ones is not
+ * | BUT 3 | really deterministic), and assume the other stores a ref to BUT 3.
+ * +----------------+
* </pre>
*
- * This will probably not work in all possible cases, but not sure we want to support such exotic cases anyway.
+ * This will probably not work in all possible cases,
+ * but not sure we want to support such exotic cases anyway.
*/
typedef struct ButAlign {
uiBut *but;
@@ -71,13 +66,15 @@ typedef struct ButAlign {
/* Distances to the neighbors. */
float dists[4];
- /* Flags, used to mark whether we should 'stitch' the corners of this button with its neighbors' ones. */
+ /* Flags, used to mark whether we should 'stitch'
+ * the corners of this button with its neighbors' ones. */
char flags[4];
} ButAlign;
/* Side-related enums and flags. */
enum {
- /* Sides (used as indices, order is **crucial**, this allows us to factorize code in a loop over the four sides). */
+ /* Sides (used as indices, order is **crucial**,
+ * this allows us to factorize code in a loop over the four sides). */
LEFT = 0,
TOP = 1,
RIGHT = 2,
@@ -162,14 +159,17 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
}
for (side = 0; side < RIGHT; side++) {
- /* We are only interested in buttons which share a same line (LEFT/RIGHT sides) or column (TOP/DOWN sides). */
+ /* We are only interested in buttons which share a same line
+ * (LEFT/RIGHT sides) or column (TOP/DOWN sides). */
if (buts_share[IS_COLUMN(side)]) {
side_opp = OPPOSITE(side);
- /* We check both opposite sides at once, because with very small buttons, delta could be below max_delta for
- * the wrong side (that is, in horizontal case, the total width of two buttons can be below max_delta).
- * We rely on exact zero value here as an 'already processed' flag, so ensure we never actually
- * set a zero value at this stage. FLT_MIN is zero-enough for UI position computing. ;) */
+ /* We check both opposite sides at once, because with very small buttons,
+ * delta could be below max_delta for the wrong side
+ * (that is, in horizontal case, the total width of two buttons can be below max_delta).
+ * We rely on exact zero value here as an 'already processed' flag,
+ * so ensure we never actually set a zero value at this stage.
+ * FLT_MIN is zero-enough for UI position computing. ;) */
delta = max_ff(fabsf(*butal->borders[side] - *butal_other->borders[side_opp]), FLT_MIN);
delta_side_opp = max_ff(fabsf(*butal->borders[side_opp] - *butal_other->borders[side]), FLT_MIN);
if (delta_side_opp < delta) {
@@ -178,18 +178,21 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
}
if (delta < max_delta) {
- /* We are only interested in neighbors that are at least as close as already found ones. */
+ /* We are only interested in neighbors that are
+ * at least as close as already found ones. */
if (delta <= butal->dists[side]) {
{
/* We found an as close or closer neighbor.
* If both buttons are alignable, we set them as each other neighbors.
- * Else, we have an unalignable one, we need to reset the others matching neighbor to NULL
- * if its 'proximity distance' is really lower with current one.
+ * Else, we have an unalignable one, we need to reset the others matching
+ * neighbor to NULL if its 'proximity distance'
+ * is really lower with current one.
*
- * NOTE: We cannot only execute that piece of code in case we found a **closer** neighbor,
- * due to the limited way we represent neighbors (buttons only know **one** neighbor
- * on each side, when they can actually have several ones), it would prevent
- * some buttons to be properly 'neighborly-initialized'. */
+ * NOTE: We cannot only execute that piece of code in case we found a
+ * **closer** neighbor, due to the limited way we represent neighbors
+ * (buttons only know **one** neighbor on each side, when they can
+ * actually have several ones), it would prevent some buttons to be
+ * properly 'neighborly-initialized'. */
if (butal_can_align && butal_other_can_align) {
butal->neighbors[side] = butal_other;
butal_other->neighbors[side_opp] = butal;
@@ -217,10 +220,12 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
butal_other->neighbors[side_opp] = butal;
}
- /* We have a pair of neighbors, we have to check whether we can stitch their matching corners.
+ /* We have a pair of neighbors, we have to check whether we
+ * can stitch their matching corners.
* E.g. if butal_other is on the left of butal (that is, side == LEFT),
- * if both TOP (side_s1) coordinates of buttons are close enough, we can stitch
- * their upper matching corners, and same for DOWN (side_s2) side. */
+ * if both TOP (side_s1) coordinates of buttons are close enough,
+ * we can stitch their upper matching corners,
+ * and same for DOWN (side_s2) side. */
delta = fabsf(*butal->borders[side_s1] - *butal_other->borders[side_s1]);
if (delta < max_delta) {
butal->flags[side_s1] |= stitch;
@@ -233,7 +238,8 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
}
}
}
- /* We assume two buttons can only share one side at most - for until we have sperical UI... */
+ /* We assume two buttons can only share one side at most - for until
+ * we have sperical UI... */
return;
}
}
@@ -329,9 +335,10 @@ static int ui_block_align_butal_cmp(const void *a, const void *b)
return (*butal->borders[LEFT] > *butal_other->borders[LEFT]) ? 1 : -1;
}
- /* XXX We cannot actually assert here, since in some very compressed space cases, stupid UI code produces
- * widgets which have the same TOP and LEFT positions...
- * We do not care really, because this happens when UI is way too small to be usable anyway. */
+ /* XXX We cannot actually assert here, since in some very compressed space cases,
+ * stupid UI code produces widgets which have the same TOP and LEFT positions...
+ * We do not care really,
+ * because this happens when UI is way too small to be usable anyway. */
/* BLI_assert(0); */
return 0;
}
@@ -423,27 +430,29 @@ void ui_block_align_calc(uiBlock *block, const ARegion *region)
}
/* This will give us ButAlign items regrouped by align group, vertical and horizontal location.
- * Note that, given how buttons are defined in UI code, butal_array shall already be "nearly sorted"... */
+ * Note that, given how buttons are defined in UI code,
+ * butal_array shall already be "nearly sorted"... */
qsort(butal_array, (size_t)num_buttons, sizeof(*butal_array), ui_block_align_butal_cmp);
- /* Third loop: for each pair of buttons in the same align group, we compute their potential proximity.
- * Note that each pair is checked only once, and that we break early in case we know all remaining pairs will
- * always be too far away. */
+ /* Third loop: for each pair of buttons in the same align group,
+ * we compute their potential proximity. Note that each pair is checked only once, and that we
+ * break early in case we know all remaining pairs will always be too far away. */
for (i = 0, butal = butal_array; i < num_buttons; i++, butal++) {
const short alignnr = butal->but->alignnr;
for (j = i + 1, butal_other = &butal_array[i + 1]; j < num_buttons; j++, butal_other++) {
const float max_delta = MAX_DELTA;
- /* Since they are sorted, buttons after current butal can only be of same or higher group, and once
- * they are not of same group, we know we can break this sub-loop and start checking with next butal. */
+ /* Since they are sorted, buttons after current butal can only be of same or higher
+ * group, and once they are not of same group, we know we can break this sub-loop and
+ * start checking with next butal. */
if (butal_other->but->alignnr != alignnr) {
break;
}
- /* Since they are sorted vertically first, buttons after current butal can only be at same or lower height,
- * and once they are lower than a given threshold, we know we can break this sub-loop and
- * start checking with next butal. */
+ /* Since they are sorted vertically first, buttons after current butal can only be at
+ * same or lower height, and once they are lower than a given threshold, we know we can
+ * break this sub-loop and start checking with next butal. */
if ((*butal->borders[DOWN] - *butal_other->borders[TOP]) > max_delta) {
break;
}
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 9ec238d7b5e..c8a9f3b9446 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_anim.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <stdio.h>
@@ -98,8 +92,11 @@ void ui_but_anim_flag(uiBut *but, float cfra)
if (fcurve_frame_has_keyframe(fcu, cfra, 0))
but->flag |= UI_BUT_ANIMATED_KEY;
- if (fcurve_is_changed(but->rnapoin, but->rnaprop, fcu, cfra))
- but->drawflag |= UI_BUT_ANIMATED_CHANGED;
+ /* XXX: this feature is totally broken and useless with NLA */
+ if (adt == NULL || adt->nla_tracks.first == NULL) {
+ if (fcurve_is_changed(but->rnapoin, but->rnaprop, fcu, cfra))
+ but->drawflag |= UI_BUT_ANIMATED_CHANGED;
+ }
}
else {
but->flag |= UI_BUT_DRIVEN;
@@ -213,7 +210,8 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
}
/* make sure we have animdata for this */
- /* FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them */
+ /* FIXME: until materials can be handled by depsgraph,
+ * don't allow drivers to be created for them */
id = (ID *)but->rnapoin.id.data;
if ((id == NULL) || (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) {
if (G.debug & G_DEBUG)
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index fc7d3293333..7ed80aac28f 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_context_menu.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Generic context popup menus.
*/
@@ -54,7 +50,8 @@
#include "WM_api.h"
#include "WM_types.h"
-/* This hack is needed because we don't have a good way to re-reference keymap items once added: T42944 */
+/* This hack is needed because we don't have a good way to
+ * re-reference keymap items once added: T42944 */
#define USE_KEYMAP_ADD_HACK
/* -------------------------------------------------------------------- */
@@ -135,7 +132,8 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
int kmi_id;
- /* XXX this guess_opname can potentially return a different keymap than being found on adding later... */
+ /* XXX this guess_opname can potentially return a different keymap
+ * than being found on adding later... */
km = WM_keymap_guess_opname(C, but->optype->idname);
kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0);
kmi_id = kmi->id;
@@ -407,7 +405,8 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
bool is_idprop = RNA_property_is_idprop(prop);
bool is_set = RNA_property_is_set(ptr, prop);
- /* second slower test, saved people finding keyframe items in menus when its not possible */
+ /* second slower test,
+ * saved people finding keyframe items in menus when its not possible */
if (is_anim)
is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
@@ -418,7 +417,8 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
const int override_status = RNA_property_static_override_status(ptr, prop, -1);
const bool is_overridable = (override_status & RNA_OVERRIDE_STATUS_OVERRIDABLE) != 0;
- /* Set the (button_pointer, button_prop) and pointer data for Python access to the hovered ui element. */
+ /* Set the (button_pointer, button_prop)
+ * and pointer data for Python access to the hovered ui element. */
uiLayoutSetContextFromBut(layout, but);
/* Keyframes */
@@ -675,7 +675,8 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
}
}
- /* Pointer properties and string properties with prop_search support jumping to target object/bone. */
+ /* Pointer properties and string properties with
+ * prop_search support jumping to target object/bone. */
if (but->rnapoin.data && but->rnaprop) {
const PropertyType type = RNA_property_type(but->rnaprop);
@@ -691,13 +692,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
uiBlock *block = uiLayoutGetBlock(layout);
const int w = uiLayoutGetWidth(layout);
uiBut *but2;
-
- but2 = uiDefIconTextBut(
- block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL,
- CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Quick Favorites"),
- 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- "Add to a user defined context menu (stored in the user preferences)");
- UI_but_func_set(but2, popup_user_menu_add_or_replace_func, but, NULL);
+ bool item_found = false;
uint um_array_len;
bUserMenu **um_array = ED_screen_user_menus_find(C, &um_array_len);
@@ -709,13 +704,25 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
bUserMenuItem *umi = ui_but_user_menu_find(C, but, um);
if (umi != NULL) {
but2 = uiDefIconTextBut(
- block, UI_BTYPE_BUT, 0, ICON_BLANK1,
+ block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL,
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Quick Favorites"),
0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
UI_but_func_set(but2, popup_user_menu_remove_func, um, umi);
+ item_found = true;
}
}
- MEM_freeN(um_array);
+ if (um_array) {
+ MEM_freeN(um_array);
+ }
+
+ if (!item_found) {
+ but2 = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Quick Favorites"),
+ 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ "Add to a user defined context menu (stored in the user preferences)");
+ UI_but_func_set(but2, popup_user_menu_add_or_replace_func, but, NULL);
+ }
uiItemS(layout);
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 777df75cbf9..7a9b65ac830 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_draw.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -251,15 +245,15 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float
}
#if 0
-static void round_box_shade_col(unsigned attrib, const float col1[3], float const col2[3], const float fac)
+static void round_box_shade_col(uint attr, const float col1[3], float const col2[3], const float fac)
{
float col[4] = {
fac * col1[0] + (1.0f - fac) * col2[0],
fac * col1[1] + (1.0f - fac) * col2[1],
fac * col1[2] + (1.0f - fac) * col2[2],
- 1.0f
+ 1.0f,
};
- immAttr4fv(attrib, col);
+ immAttr4fv(attr, col);
}
#endif
@@ -547,7 +541,8 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo
/* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */
-/* based on UI_draw_roundbox_gl_mode, check on making a version which allows us to skip some sides */
+/* based on UI_draw_roundbox_gl_mode,
+ * check on making a version which allows us to skip some sides */
void ui_draw_but_TAB_outline(const rcti *rect, float rad, uchar highlight[3], uchar highlight_fade[3])
{
GPUVertFormat *format = immVertexFormat();
@@ -685,8 +680,8 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors *UN
*
* \Note This functionn is to be used with the 2D dashed shader enabled.
*
- * \param pos: is a PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attrib
- * \param line_origin: is a PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attrib
+ * \param pos: is a PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attribute.
+ * \param line_origin: is a PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attribute.
*
* The next 4 parameters are the offsets for the view, not the zones.
*/
@@ -732,7 +727,7 @@ static void draw_scope_end(const rctf *rect, GLint *scissor)
static void histogram_draw_one(
float r, float g, float b, float alpha,
float x, float y, float w, float h, const float *data, int res, const bool is_line,
- uint pos_attrib)
+ uint pos_attr)
{
float color[4] = {r, g, b, alpha};
@@ -752,19 +747,19 @@ static void histogram_draw_one(
immBegin(GPU_PRIM_LINE_STRIP, res);
for (int i = 0; i < res; i++) {
float x2 = x + i * (w / (float)res);
- immVertex2f(pos_attrib, x2, y + (data[i] * h));
+ immVertex2f(pos_attr, x2, y + (data[i] * h));
}
immEnd();
}
else {
/* under the curve */
immBegin(GPU_PRIM_TRI_STRIP, res * 2);
- immVertex2f(pos_attrib, x, y);
- immVertex2f(pos_attrib, x, y + (data[0] * h));
+ immVertex2f(pos_attr, x, y);
+ immVertex2f(pos_attr, x, y + (data[0] * h));
for (int i = 1; i < res; i++) {
float x2 = x + i * (w / (float)res);
- immVertex2f(pos_attrib, x2, y + (data[i] * h));
- immVertex2f(pos_attrib, x2, y);
+ immVertex2f(pos_attr, x2, y + (data[i] * h));
+ immVertex2f(pos_attr, x2, y);
}
immEnd();
@@ -775,7 +770,7 @@ static void histogram_draw_one(
immBegin(GPU_PRIM_LINE_STRIP, res);
for (int i = 0; i < res; i++) {
float x2 = x + i * (w / (float)res);
- immVertex2f(pos_attrib, x2, y + (data[i] * h));
+ immVertex2f(pos_attr, x2, y + (data[i] * h));
}
immEnd();
}
@@ -795,7 +790,7 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors
.xmin = (float)recti->xmin + 1,
.xmax = (float)recti->xmax - 1,
.ymin = (float)recti->ymin + 1,
- .ymax = (float)recti->ymax - 1
+ .ymax = (float)recti->ymax - 1,
};
float w = BLI_rctf_size_x(&rect);
@@ -892,7 +887,8 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors
int scissor[4];
float colors[3][3];
float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
- float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */
+ /* colors pre multiplied by alpha for speed up */
+ float colors_alpha[3][3], colorsycc_alpha[3][3];
float min, max;
if (scopes == NULL) return;
@@ -901,7 +897,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors
.xmin = (float)recti->xmin + 1,
.xmax = (float)recti->xmax - 1,
.ymin = (float)recti->ymin + 1,
- .ymax = (float)recti->ymax - 1
+ .ymax = (float)recti->ymax - 1,
};
if (scopes->wavefrm_yfac < 0.5f)
@@ -1187,7 +1183,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColo
.xmin = (float)recti->xmin + 1,
.xmax = (float)recti->xmax - 1,
.ymin = (float)recti->ymin + 1,
- .ymax = (float)recti->ymax - 1
+ .ymax = (float)recti->ymax - 1,
};
float w = BLI_rctf_size_x(&rect);
@@ -1611,12 +1607,26 @@ static void ui_draw_but_curve_grid(uint pos, const rcti *rect, float zoomx, floa
}
-static void gl_shaded_color(uchar *col, int shade)
+
+static void gl_shaded_color_get(const uchar color[3], int shade, uchar r_color[3])
+{
+ r_color[0] = color[0] - shade > 0 ? color[0] - shade : 0;
+ r_color[1] = color[1] - shade > 0 ? color[1] - shade : 0;
+ r_color[2] = color[2] - shade > 0 ? color[2] - shade : 0;
+}
+
+static void gl_shaded_color_get_fl(const uchar *color, int shade, float r_color[3])
{
- immUniformColor3ub(
- col[0] - shade > 0 ? col[0] - shade : 0,
- col[1] - shade > 0 ? col[1] - shade : 0,
- col[2] - shade > 0 ? col[2] - shade : 0);
+ uchar color_shaded[3];
+ gl_shaded_color_get(color, shade, color_shaded);
+ rgb_uchar_to_float(r_color, color_shaded);
+}
+
+static void gl_shaded_color(uchar *color, int shade)
+{
+ uchar color_shaded[3];
+ gl_shaded_color_get(color, shade, color_shaded);
+ immUniformColor3ubv(color_shaded);
}
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
@@ -1639,7 +1649,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
.xmin = rect->xmin,
.ymin = rect->ymin,
.xmax = rect->xmax,
- .ymax = rect->ymax
+ .ymax = rect->ymax,
};
rcti scissor_region = {0, ar->winx, 0, ar->winy};
BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
@@ -1664,7 +1674,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
.xmin = rect->xmin + zoomx * (-offsx),
.xmax = grid.xmin + zoomx,
.ymin = rect->ymin + zoomy * (-offsy),
- .ymax = grid.ymin + zoomy
+ .ymax = grid.ymin + zoomy,
};
ui_draw_gradient(&grid, col, UI_GRAD_H, 1.0f);
@@ -1677,17 +1687,21 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* backdrop */
+ float color_backdrop[4] = {0, 0, 0, 1};
+
if (but->a1 == UI_GRAD_H) {
/* grid, hsv uses different grid */
GPU_blend(true);
GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
- immUniformColor4ub(0, 0, 0, 48);
+ ARRAY_SET_ITEMS(color_backdrop, 0, 0, 0, 48.0 / 255.0);
+ immUniformColor4fv(color_backdrop);
ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.1666666f);
GPU_blend(false);
}
else {
if (cumap->flag & CUMA_DO_CLIP) {
- gl_shaded_color((uchar *)wcol->inner, -20);
+ gl_shaded_color_get_fl((uchar *)wcol->inner, -20, color_backdrop);
+ immUniformColor3fv(color_backdrop);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
immUniformColor3ubv((uchar *)wcol->inner);
immRectf(pos,
@@ -1697,7 +1711,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
}
else {
- immUniformColor3ubv((uchar *)wcol->inner);
+ rgb_uchar_to_float(color_backdrop, (const uchar *)wcol->inner);
+ immUniformColor3fv(color_backdrop);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}
@@ -1836,18 +1851,25 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
+ /* Calculate vertex colors based on text theme. */
+ float color_vert[4], color_vert_select[4];
+ UI_GetThemeColor4fv(TH_TEXT_HI, color_vert);
+ UI_GetThemeColor4fv(TH_TEXT, color_vert_select);
+ if (len_squared_v3v3(color_vert, color_vert_select) < 0.1f) {
+ interp_v3_v3v3(color_vert, color_vert_select, color_backdrop, 0.75f);
+ }
+ if (len_squared_v3(color_vert) > len_squared_v3(color_vert_select)) {
+ /* Ensure brightest text color is used for selection. */
+ swap_v3_v3(color_vert, color_vert_select);
+ }
+
cmp = cuma->curve;
GPU_point_size(max_ff(1.0f, min_ff(UI_DPI_FAC / but->block->aspect * 4.0f, 4.0f)));
immBegin(GPU_PRIM_POINTS, cuma->totpoint);
for (int a = 0; a < cuma->totpoint; a++) {
- float color[4];
- if (cmp[a].flag & CUMA_SELECT)
- UI_GetThemeColor4fv(TH_TEXT_HI, color);
- else
- UI_GetThemeColor4fv(TH_TEXT, color);
float fx = rect->xmin + zoomx * (cmp[a].x - offsx);
float fy = rect->ymin + zoomy * (cmp[a].y - offsy);
- immAttr4fv(col, color);
+ immAttr4fv(col, (cmp[a].flag & CUMA_SELECT) ? color_vert_select : color_vert);
immVertex2f(pos, fx, fy);
}
immEnd();
@@ -1876,7 +1898,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, const uiWidgetCol
.xmin = (float)recti->xmin + 1,
.xmax = (float)recti->xmax - 1,
.ymin = (float)recti->ymin + 1,
- .ymax = (float)recti->ymax - 1
+ .ymax = (float)recti->ymax - 1,
};
int width = BLI_rctf_size_x(&rect) + 1;
@@ -2009,7 +2031,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, const uiWidgetColors *UNUSE
0.00000000f, 0.39435585f, 0.72479278f, 0.93775213f,
0.99871650f, 0.89780453f, 0.65137248f, 0.29936312f,
-0.10116832f, -0.48530196f, -0.79077573f, -0.96807711f,
- -0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f
+ -0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f,
};
/* 16 values of cos function */
const float co[16] = {
@@ -2028,7 +2050,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, const uiWidgetColors *UNUSE
.xmin = recti->xmin,
.ymin = recti->ymin,
.xmax = recti->xmax,
- .ymax = recti->ymax
+ .ymax = recti->ymax,
};
rcti scissor_region = {0, ar->winx, 0, ar->winy};
@@ -2076,7 +2098,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, const uiWidgetColors *UNUSE
* would replace / modify the following 3 functions - merwin
*/
-static void ui_shadowbox(unsigned pos, unsigned color, float minx, float miny, float maxx, float maxy, float shadsize, uchar alpha)
+static void ui_shadowbox(uint pos, uint color, float minx, float miny, float maxx, float maxy, float shadsize, uchar alpha)
{
/**
* <pre>
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index 3a799c6e7db..112fde4a15c 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,16 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "BLI_blenlib.h"
-#include "BLI_math_vector.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -59,7 +52,7 @@ wmKeyMap *eyedropper_modal_keymap(wmKeyConfig *keyconf)
{EYE_MODAL_SAMPLE_CONFIRM, "SAMPLE_CONFIRM", 0, "Confirm Sampling", ""},
{EYE_MODAL_SAMPLE_BEGIN, "SAMPLE_BEGIN", 0, "Start Sampling", ""},
{EYE_MODAL_SAMPLE_RESET, "SAMPLE_RESET", 0, "Reset Sampling", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Eyedropper Modal Map");
@@ -73,7 +66,6 @@ wmKeyMap *eyedropper_modal_keymap(wmKeyConfig *keyconf)
/* assign to operators */
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_colorband");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_color");
- WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_color_crypto");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_id");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_depth");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_driver");
@@ -88,7 +80,7 @@ wmKeyMap *eyedropper_colorband_modal_keymap(wmKeyConfig *keyconf)
{EYE_MODAL_POINT_SAMPLE, "SAMPLE_SAMPLE", 0, "Sample a point", ""},
{EYE_MODAL_POINT_CONFIRM, "SAMPLE_CONFIRM", 0, "Confirm Sampling", ""},
{EYE_MODAL_POINT_RESET, "SAMPLE_RESET", 0, "Reset Sampling", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Eyedropper ColorBand PointSampling Map");
diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c
index 8e80d5657d7..e2f85c4d7cc 100644
--- a/source/blender/editors/interface/interface_eyedropper_color.c
+++ b/source/blender/editors/interface/interface_eyedropper_color.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_color.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Eyedropper (RGB Color)
*
@@ -36,7 +32,6 @@
#include "DNA_screen_types.h"
#include "BLI_math_vector.h"
-#include "BLI_string.h"
#include "BKE_context.h"
#include "BKE_main.h"
@@ -53,6 +48,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "RNA_define.h"
+
#include "interface_intern.h"
#include "ED_image.h"
@@ -67,25 +64,24 @@ typedef struct Eyedropper {
PointerRNA ptr;
PropertyRNA *prop;
int index;
+ bool is_undo;
+ bool is_set;
float init_col[3]; /* for resetting on cancel */
bool accum_start; /* has mouse been pressed */
float accum_col[3];
int accum_tot;
- bool accumulate; /* Color picking for cryptomatte, without accumulation. */
+ bool use_accum;
} Eyedropper;
static bool eyedropper_init(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
- Eyedropper *eye;
+ Eyedropper *eye = MEM_callocN(sizeof(Eyedropper), __func__);
+ eye->use_accum = RNA_boolean_get(op->ptr, "use_accumulate");
- op->customdata = eye = MEM_callocN(sizeof(Eyedropper), "Eyedropper");
- eye->accumulate = !STREQ(op->type->idname, "UI_OT_eyedropper_color_crypto");
-
- UI_context_active_but_prop_get(C, &eye->ptr, &eye->prop, &eye->index);
+ uiBut *but = UI_context_active_but_prop_get(C, &eye->ptr, &eye->prop, &eye->index);
if ((eye->ptr.data == NULL) ||
(eye->prop == NULL) ||
@@ -93,23 +89,28 @@ static bool eyedropper_init(bContext *C, wmOperator *op)
(RNA_property_array_length(&eye->ptr, eye->prop) < 3) ||
(RNA_property_type(eye->prop) != PROP_FLOAT))
{
+ MEM_freeN(eye);
return false;
}
+ op->customdata = eye;
+
+ eye->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
+ float col[4];
+ RNA_property_float_get_array(&eye->ptr, eye->prop, col);
if (RNA_property_subtype(eye->prop) != PROP_COLOR) {
+ Scene *scene = CTX_data_scene(C);
const char *display_device;
- float col[4];
display_device = scene->display_settings.display_device;
eye->display = IMB_colormanagement_display_get_named(display_device);
/* store initial color */
- RNA_property_float_get_array(&eye->ptr, eye->prop, col);
if (eye->display) {
IMB_colormanagement_display_to_scene_linear_v3(col, eye->display);
}
- copy_v3_v3(eye->init_col, col);
}
+ copy_v3_v3(eye->init_col, col);
return true;
}
@@ -207,6 +208,7 @@ static void eyedropper_color_set(bContext *C, Eyedropper *eye, const float col[3
}
RNA_property_float_set_array(&eye->ptr, eye->prop, col_conv);
+ eye->is_set = true;
RNA_property_update(C, &eye->ptr, eye->prop);
}
@@ -217,7 +219,7 @@ static void eyedropper_color_sample(bContext *C, Eyedropper *eye, int mx, int my
float col[3];
eyedropper_color_sample_fl(C, mx, my, col);
- if (eye->accumulate) {
+ if (eye->use_accum) {
add_v3_v3(eye->accum_col, col);
eye->accum_tot++;
}
@@ -240,7 +242,9 @@ static void eyedropper_color_sample(bContext *C, Eyedropper *eye, int mx, int my
static void eyedropper_cancel(bContext *C, wmOperator *op)
{
Eyedropper *eye = op->customdata;
- eyedropper_color_set(C, eye, eye->init_col);
+ if (eye->is_set) {
+ eyedropper_color_set(C, eye, eye->init_col);
+ }
eyedropper_exit(C, op);
}
@@ -256,11 +260,15 @@ static int eyedropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
eyedropper_cancel(C, op);
return OPERATOR_CANCELLED;
case EYE_MODAL_SAMPLE_CONFIRM:
+ {
+ const bool is_undo = eye->is_undo;
if (eye->accum_tot == 0) {
eyedropper_color_sample(C, eye, event->x, event->y);
}
eyedropper_exit(C, op);
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ }
case EYE_MODAL_SAMPLE_BEGIN:
/* enable accum and make first sample */
eye->accum_start = true;
@@ -296,7 +304,6 @@ static int eyedropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
return OPERATOR_RUNNING_MODAL;
}
else {
- eyedropper_exit(C, op);
return OPERATOR_PASS_THROUGH;
}
}
@@ -341,23 +348,12 @@ void UI_OT_eyedropper_color(wmOperatorType *ot)
ot->poll = eyedropper_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
-}
-
-void UI_OT_eyedropper_color_crypto(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Cryptomatte Eyedropper";
- ot->idname = "UI_OT_eyedropper_color_crypto";
- ot->description = "Pick a color from Cryptomatte node Pick output image";
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
- /* api callbacks */
- ot->invoke = eyedropper_invoke;
- ot->modal = eyedropper_modal;
- ot->cancel = eyedropper_cancel;
- ot->exec = eyedropper_exec;
- ot->poll = eyedropper_poll;
+ /* properties */
+ PropertyRNA *prop;
- /* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
+ /* Needed for color picking with crypto-matte. */
+ prop = RNA_def_boolean(ot->srna, "use_accumulate", true, "Accumulate", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
diff --git a/source/blender/editors/interface/interface_eyedropper_colorband.c b/source/blender/editors/interface/interface_eyedropper_colorband.c
index a807a16671c..98dbb31d049 100644
--- a/source/blender/editors/interface/interface_eyedropper_colorband.c
+++ b/source/blender/editors/interface/interface_eyedropper_colorband.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_colorband.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Eyedropper (Color Band).
*
@@ -72,6 +68,8 @@ typedef struct EyedropperColorband {
ColorBand *color_band;
PointerRNA ptr;
PropertyRNA *prop;
+ bool is_undo;
+ bool is_set;
} EyedropperColorband;
/* For user-data only. */
@@ -83,7 +81,6 @@ struct EyedropperColorband_Context {
static bool eyedropper_colorband_init(bContext *C, wmOperator *op)
{
ColorBand *band = NULL;
- EyedropperColorband *eye;
uiBut *but = UI_context_active_but_get(C);
@@ -99,10 +96,11 @@ static bool eyedropper_colorband_init(bContext *C, wmOperator *op)
band = (ColorBand *)but->custom_data;
}
- if (!band)
+ if (!band) {
return false;
+ }
- op->customdata = eye = MEM_callocN(sizeof(EyedropperColorband), __func__);
+ EyedropperColorband *eye = MEM_callocN(sizeof(EyedropperColorband), __func__);
eye->color_buffer_alloc = 16;
eye->color_buffer = MEM_mallocN(sizeof(*eye->color_buffer) * eye->color_buffer_alloc, __func__);
eye->color_buffer_len = 0;
@@ -110,6 +108,9 @@ static bool eyedropper_colorband_init(bContext *C, wmOperator *op)
eye->init_color_band = *eye->color_band;
eye->ptr = ((Colorband_RNAUpdateCb *)but->func_argN)->ptr;
eye->prop = ((Colorband_RNAUpdateCb *)but->func_argN)->prop;
+ eye->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
+
+ op->customdata = eye;
return true;
}
@@ -128,6 +129,7 @@ static void eyedropper_colorband_sample_point(bContext *C, EyedropperColorband *
eye->color_buffer_len += 1;
eye->last_x = mx;
eye->last_y = my;
+ eye->is_set = true;
}
}
@@ -168,14 +170,17 @@ static void eyedropper_colorband_apply(bContext *C, wmOperator *op)
/* Always filter, avoids noise in resulting color-band. */
bool filter_samples = true;
BKE_colorband_init_from_table_rgba(eye->color_band, eye->color_buffer, eye->color_buffer_len, filter_samples);
+ eye->is_set = true;
RNA_property_update(C, &eye->ptr, eye->prop);
}
static void eyedropper_colorband_cancel(bContext *C, wmOperator *op)
{
EyedropperColorband *eye = op->customdata;
- *eye->color_band = eye->init_color_band;
- RNA_property_update(C, &eye->ptr, eye->prop);
+ if (eye->is_set) {
+ *eye->color_band = eye->init_color_band;
+ RNA_property_update(C, &eye->ptr, eye->prop);
+ }
eyedropper_colorband_exit(C, op);
}
@@ -190,10 +195,14 @@ static int eyedropper_colorband_modal(bContext *C, wmOperator *op, const wmEvent
eyedropper_colorband_cancel(C, op);
return OPERATOR_CANCELLED;
case EYE_MODAL_SAMPLE_CONFIRM:
+ {
+ const bool is_undo = eye->is_undo;
eyedropper_colorband_sample_segment(C, eye, event->x, event->y);
eyedropper_colorband_apply(C, op);
eyedropper_colorband_exit(C, op);
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ }
case EYE_MODAL_SAMPLE_BEGIN:
/* enable accum and make first sample */
eye->sample_start = true;
@@ -266,7 +275,6 @@ static int eyedropper_colorband_invoke(bContext *C, wmOperator *op, const wmEven
return OPERATOR_RUNNING_MODAL;
}
else {
- eyedropper_colorband_exit(C, op);
return OPERATOR_CANCELLED;
}
}
@@ -311,7 +319,7 @@ void UI_OT_eyedropper_colorband(wmOperatorType *ot)
ot->poll = eyedropper_colorband_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
}
@@ -331,7 +339,7 @@ void UI_OT_eyedropper_colorband_point(wmOperatorType *ot)
ot->poll = eyedropper_colorband_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
}
diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c
index 781032ef971..ffd8f672622 100644
--- a/source/blender/editors/interface/interface_eyedropper_datablock.c
+++ b/source/blender/editors/interface/interface_eyedropper_datablock.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_datablock.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Eyedropper (ID data-blocks)
*
@@ -37,7 +33,6 @@
#include "DNA_object_types.h"
#include "BLI_string.h"
-#include "BLI_math_vector.h"
#include "BLT_translation.h"
@@ -68,6 +63,7 @@ typedef struct DataDropper {
PropertyRNA *prop;
short idcode;
const char *idcode_name;
+ bool is_undo;
ID *init_id; /* for resetting on cancel */
@@ -86,7 +82,6 @@ static void datadropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg
static int datadropper_init(bContext *C, wmOperator *op)
{
- DataDropper *ddr;
int index_dummy;
StructRNA *type;
@@ -96,17 +91,21 @@ static int datadropper_init(bContext *C, wmOperator *op)
st = BKE_spacetype_from_id(SPACE_VIEW3D);
art = BKE_regiontype_from_id(st, RGN_TYPE_WINDOW);
- op->customdata = ddr = MEM_callocN(sizeof(DataDropper), "DataDropper");
+ DataDropper *ddr = MEM_callocN(sizeof(DataDropper), __func__);
- UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy);
+ uiBut *but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy);
if ((ddr->ptr.data == NULL) ||
(ddr->prop == NULL) ||
(RNA_property_editable(&ddr->ptr, ddr->prop) == false) ||
(RNA_property_type(ddr->prop) != PROP_POINTER))
{
+ MEM_freeN(ddr);
return false;
}
+ op->customdata = ddr;
+
+ ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
ddr->art = art;
ddr->draw_handle_pixel = ED_region_draw_cb_activate(art, datadropper_draw_cb, ddr, REGION_DRAW_POST_PIXEL);
@@ -114,7 +113,8 @@ static int datadropper_init(bContext *C, wmOperator *op)
type = RNA_property_pointer_type(&ddr->ptr, ddr->prop);
ddr->idcode = RNA_type_to_ID_code(type);
BLI_assert(ddr->idcode != 0);
- /* Note we can translate here (instead of on draw time), because this struct has very short lifetime. */
+ /* Note we can translate here (instead of on draw time),
+ * because this struct has very short lifetime. */
ddr->idcode_name = TIP_(BKE_idcode_to_name(ddr->idcode));
PointerRNA ptr = RNA_property_pointer_get(&ddr->ptr, ddr->prop);
@@ -145,7 +145,6 @@ static void datadropper_exit(bContext *C, wmOperator *op)
/* *** datadropper id helper functions *** */
/**
* \brief get the ID from the screen.
- *
*/
static void datadropper_id_sample_pt(bContext *C, DataDropper *ddr, int mx, int my, ID **r_id)
{
@@ -252,13 +251,12 @@ static int datadropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
case EYE_MODAL_SAMPLE_CONFIRM:
{
- bool success;
-
- success = datadropper_id_sample(C, ddr, event->x, event->y);
+ const bool is_undo = ddr->is_undo;
+ const bool success = datadropper_id_sample(C, ddr, event->x, event->y);
datadropper_exit(C, op);
-
if (success) {
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
else {
BKE_report(op->reports, RPT_WARNING, "Failed to set value");
@@ -288,7 +286,6 @@ static int datadropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED
return OPERATOR_RUNNING_MODAL;
}
else {
- datadropper_exit(C, op);
return OPERATOR_CANCELLED;
}
}
@@ -348,7 +345,7 @@ void UI_OT_eyedropper_id(wmOperatorType *ot)
ot->poll = datadropper_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
}
diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c
index 1dae076f930..9e559f65335 100644
--- a/source/blender/editors/interface/interface_eyedropper_depth.c
+++ b/source/blender/editors/interface/interface_eyedropper_depth.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_depth.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* This file defines an eyedropper for picking 3D depth value (primary use is depth-of-field).
*
@@ -41,7 +37,6 @@
#include "BLI_math_vector.h"
#include "BKE_context.h"
-#include "BKE_main.h"
#include "BKE_screen.h"
#include "BKE_unit.h"
@@ -67,7 +62,9 @@
typedef struct DepthDropper {
PointerRNA ptr;
PropertyRNA *prop;
+ bool is_undo;
+ bool is_set;
float init_depth; /* for resetting on cancel */
bool accum_start; /* has mouse been presed */
@@ -89,7 +86,6 @@ static void depthdropper_draw_cb(const struct bContext *C, ARegion *ar, void *ar
static int depthdropper_init(bContext *C, wmOperator *op)
{
- DepthDropper *ddr;
int index_dummy;
SpaceType *st;
@@ -98,9 +94,9 @@ static int depthdropper_init(bContext *C, wmOperator *op)
st = BKE_spacetype_from_id(SPACE_VIEW3D);
art = BKE_regiontype_from_id(st, RGN_TYPE_WINDOW);
- op->customdata = ddr = MEM_callocN(sizeof(DepthDropper), "DepthDropper");
+ DepthDropper *ddr = MEM_callocN(sizeof(DepthDropper), __func__);
- UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy);
+ uiBut *but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy);
/* fallback to the active camera's dof */
if (ddr->prop == NULL) {
@@ -110,17 +106,23 @@ static int depthdropper_init(bContext *C, wmOperator *op)
if (v3d->camera && v3d->camera->data && !ID_IS_LINKED(v3d->camera->data)) {
RNA_id_pointer_create(v3d->camera->data, &ddr->ptr);
ddr->prop = RNA_struct_find_property(&ddr->ptr, "dof_distance");
+ ddr->is_undo = true;
}
}
}
+ else {
+ ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
+ }
if ((ddr->ptr.data == NULL) ||
(ddr->prop == NULL) ||
(RNA_property_editable(&ddr->ptr, ddr->prop) == false) ||
(RNA_property_type(ddr->prop) != PROP_FLOAT))
{
+ MEM_freeN(ddr);
return false;
}
+ op->customdata = ddr;
ddr->art = art;
ddr->draw_handle_pixel = ED_region_draw_cb_activate(art, depthdropper_draw_cb, ddr, REGION_DRAW_POST_PIXEL);
@@ -149,7 +151,6 @@ static void depthdropper_exit(bContext *C, wmOperator *op)
/* *** depthdropper id helper functions *** */
/**
* \brief get the ID from the screen.
- *
*/
static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx, int my, float *r_depth)
{
@@ -215,6 +216,7 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx,
static void depthdropper_depth_set(bContext *C, DepthDropper *ddr, const float depth)
{
RNA_property_float_set(&ddr->ptr, ddr->prop, depth);
+ ddr->is_set = true;
RNA_property_update(C, &ddr->ptr, ddr->prop);
}
@@ -251,7 +253,9 @@ static void depthdropper_depth_sample_accum(bContext *C, DepthDropper *ddr, int
static void depthdropper_cancel(bContext *C, wmOperator *op)
{
DepthDropper *ddr = op->customdata;
- depthdropper_depth_set(C, ddr, ddr->init_depth);
+ if (ddr->is_set) {
+ depthdropper_depth_set(C, ddr, ddr->init_depth);
+ }
depthdropper_exit(C, op);
}
@@ -267,6 +271,8 @@ static int depthdropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
depthdropper_cancel(C, op);
return OPERATOR_CANCELLED;
case EYE_MODAL_SAMPLE_CONFIRM:
+ {
+ const bool is_undo = ddr->is_undo;
if (ddr->accum_tot == 0) {
depthdropper_depth_sample(C, ddr, event->x, event->y);
}
@@ -274,7 +280,9 @@ static int depthdropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
depthdropper_depth_set_accum(C, ddr);
}
depthdropper_exit(C, op);
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ }
case EYE_MODAL_SAMPLE_BEGIN:
/* enable accum and make first sample */
ddr->accum_start = true;
@@ -312,7 +320,6 @@ static int depthdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
return OPERATOR_RUNNING_MODAL;
}
else {
- depthdropper_exit(C, op);
return OPERATOR_CANCELLED;
}
}
@@ -380,7 +387,7 @@ void UI_OT_eyedropper_depth(wmOperatorType *ot)
ot->poll = depthdropper_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
}
diff --git a/source/blender/editors/interface/interface_eyedropper_driver.c b/source/blender/editors/interface/interface_eyedropper_driver.c
index 93719527380..e1f38860721 100644
--- a/source/blender/editors/interface/interface_eyedropper_driver.c
+++ b/source/blender/editors/interface/interface_eyedropper_driver.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_driver.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Eyedropper (Animation Driver Targets).
*
@@ -38,7 +32,6 @@
#include "DNA_screen_types.h"
#include "DNA_object_types.h"
-#include "BLI_math_vector.h"
#include "BKE_context.h"
#include "BKE_animsys.h"
@@ -64,18 +57,16 @@ typedef struct DriverDropper {
PointerRNA ptr;
PropertyRNA *prop;
int index;
+ bool is_undo;
// TODO: new target?
} DriverDropper;
static bool driverdropper_init(bContext *C, wmOperator *op)
{
- DriverDropper *ddr;
- uiBut *but;
+ DriverDropper *ddr = MEM_callocN(sizeof(DriverDropper), __func__);
- op->customdata = ddr = MEM_callocN(sizeof(DriverDropper), "DriverDropper");
-
- but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &ddr->index);
+ uiBut *but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &ddr->index);
if ((ddr->ptr.data == NULL) ||
(ddr->prop == NULL) ||
@@ -83,8 +74,12 @@ static bool driverdropper_init(bContext *C, wmOperator *op)
(RNA_property_animateable(&ddr->ptr, ddr->prop) == false) ||
(but->flag & UI_BUT_DRIVEN))
{
+ MEM_freeN(ddr);
return false;
}
+ op->customdata = ddr;
+
+ ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
return true;
}
@@ -154,18 +149,24 @@ static void driverdropper_cancel(bContext *C, wmOperator *op)
/* main modal status check */
static int driverdropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
+ DriverDropper *ddr = op->customdata;
+
/* handle modal keymap */
if (event->type == EVT_MODAL_MAP) {
switch (event->val) {
case EYE_MODAL_CANCEL:
+ {
driverdropper_cancel(C, op);
return OPERATOR_CANCELLED;
-
+ }
case EYE_MODAL_SAMPLE_CONFIRM:
+ {
+ const bool is_undo = ddr->is_undo;
driverdropper_sample(C, op, event);
driverdropper_exit(C, op);
-
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ }
}
}
@@ -185,7 +186,6 @@ static int driverdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
return OPERATOR_RUNNING_MODAL;
}
else {
- driverdropper_exit(C, op);
return OPERATOR_CANCELLED;
}
}
@@ -226,7 +226,7 @@ void UI_OT_eyedropper_driver(wmOperatorType *ot)
ot->poll = driverdropper_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL | OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
RNA_def_enum(ot->srna, "mapping_type", prop_driver_create_mapping_types, 0,
diff --git a/source/blender/editors/interface/interface_eyedropper_intern.h b/source/blender/editors/interface/interface_eyedropper_intern.h
index 18935c6cc9f..1ce0cb6d3e1 100644
--- a/source/blender/editors/interface/interface_eyedropper_intern.h
+++ b/source/blender/editors/interface/interface_eyedropper_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_eyedropper_intern.h
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Share between interface_eyedropper_*.c files.
*/
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 1d8e452ba45..498e2f07ea4 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_handlers.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <float.h>
@@ -229,10 +223,14 @@ typedef struct uiButMultiState {
typedef struct uiHandleButtonMulti {
enum {
- BUTTON_MULTI_INIT_UNSET = 0, /* gesture direction unknown, wait until mouse has moved enough... */
- BUTTON_MULTI_INIT_SETUP, /* vertical gesture detected, flag buttons interactively (UI_BUT_DRAG_MULTI) */
- BUTTON_MULTI_INIT_ENABLE, /* flag buttons finished, apply horizontal motion to active and flagged */
- BUTTON_MULTI_INIT_DISABLE, /* vertical gesture _not_ detected, take no further action */
+ /** gesture direction unknown, wait until mouse has moved enough... */
+ BUTTON_MULTI_INIT_UNSET = 0,
+ /** vertical gesture detected, flag buttons interactively (UI_BUT_DRAG_MULTI) */
+ BUTTON_MULTI_INIT_SETUP,
+ /** flag buttons finished, apply horizontal motion to active and flagged */
+ BUTTON_MULTI_INIT_ENABLE,
+ /** vertical gesture _not_ detected, take no further action */
+ BUTTON_MULTI_INIT_DISABLE,
} init;
bool has_mbuts; /* any buttons flagged UI_BUT_DRAG_MULTI */
@@ -241,11 +239,12 @@ typedef struct uiHandleButtonMulti {
bool is_proportional;
- /* In some cases we directly apply the changes to multiple buttons, so we don't want to do it twice. */
+ /* In some cases we directly apply the changes to multiple buttons,
+ * so we don't want to do it twice. */
bool skip;
- /* before activating, we need to check gesture direction
- * accumulate signed cursor movement here so we can tell if this is a vertical motion or not. */
+ /* before activating, we need to check gesture direction accumulate signed cursor movement
+ * here so we can tell if this is a vertical motion or not. */
float drag_dir[2];
/* values copied direct from event->x,y
@@ -323,8 +322,10 @@ typedef struct uiHandleButtonData {
CBData *dragcbd;
#ifdef USE_CONT_MOUSE_CORRECT
- /* when ungrabbing buttons which are #ui_but_is_cursor_warp(), we may want to position them
- * FLT_MAX signifies do-nothing, use #ui_block_to_window_fl() to get this into a usable space */
+ /* when ungrabbing buttons which are #ui_but_is_cursor_warp(),
+ * we may want to position them.
+ * FLT_MAX signifies do-nothing, use #ui_block_to_window_fl()
+ * to get this into a usable space. */
float ungrab_mval[2];
#endif
@@ -1125,14 +1126,12 @@ static bool ui_multibut_states_tag(
static void ui_multibut_states_create(uiBut *but_active, uiHandleButtonData *data)
{
- uiBut *but;
-
BLI_assert(data->multi_data.init == BUTTON_MULTI_INIT_SETUP);
BLI_assert(data->multi_data.has_mbuts);
data->multi_data.bs_mbuts = UI_butstore_create(but_active->block);
- for (but = but_active->block->buttons.first; but; but = but->next) {
+ for (uiBut *but = but_active->block->buttons.first; but; but = but->next) {
if (but->flag & UI_BUT_DRAG_MULTI) {
ui_multibut_add(data, but);
}
@@ -1141,11 +1140,14 @@ static void ui_multibut_states_create(uiBut *but_active, uiHandleButtonData *dat
/* edit buttons proportionally to eachother
* note: if we mix buttons which are proportional and others which are not,
* this may work a bit strangely */
- if (but_active->rnaprop) {
- if ((data->origvalue != 0.0) && (RNA_property_flag(but_active->rnaprop) & PROP_PROPORTIONAL)) {
+ if ((but_active->rnaprop && (RNA_property_flag(but_active->rnaprop) & PROP_PROPORTIONAL)) ||
+ ELEM(but_active->unit_type, PROP_UNIT_LENGTH))
+ {
+ if (data->origvalue != 0.0) {
data->multi_data.is_proportional = true;
}
}
+
}
static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBlock *block)
@@ -1236,22 +1238,32 @@ static bool ui_drag_toggle_but_is_supported(const uiBut *but)
}
}
-static bool ui_drag_toggle_but_is_pushed(uiBut *but)
+/* Button pushed state to compare if other buttons match. Can be more
+ * then just true or false for toggle buttons with more than 2 states. */
+static int ui_drag_toggle_but_pushed_state(bContext *C, uiBut *but)
{
- if (ui_but_is_bool(but)) {
- return ui_but_is_pushed(but);
+ if (but->rnapoin.data == NULL && but->poin == NULL && but->icon) {
+ if (but->pushed_state_func) {
+ return but->pushed_state_func(C, but->pushed_state_arg);
+ }
+ else {
+ /* Assume icon identifies a unique state, for buttons that
+ * work though functions callbacks and don't have an boolean
+ * value that indicates the state. */
+ return but->icon + but->iconadd;
+ }
}
- else if (UI_but_is_decorator(but)) {
- return (but->icon == ICON_DECORATE_KEYFRAME);
+ else if (ui_but_is_bool(but)) {
+ return ui_but_is_pushed(but);
}
else {
- return false;
+ return 0;
}
}
typedef struct uiDragToggleHandle {
/* init */
- bool is_set;
+ int pushed_state;
float but_cent_start[2];
bool is_xy_lock_init;
@@ -1262,7 +1274,7 @@ typedef struct uiDragToggleHandle {
} uiDragToggleHandle;
static bool ui_drag_toggle_set_xy_xy(
- bContext *C, ARegion *ar, const bool is_set,
+ bContext *C, ARegion *ar, const int pushed_state,
const int xy_src[2], const int xy_dst[2])
{
/* popups such as layers won't re-evaluate on redraw */
@@ -1288,8 +1300,8 @@ static bool ui_drag_toggle_set_xy_xy(
/* execute the button */
if (ui_drag_toggle_but_is_supported(but)) {
/* is it pressed? */
- bool is_set_but = ui_drag_toggle_but_is_pushed(but);
- if (is_set_but != is_set) {
+ int pushed_state_but = ui_drag_toggle_but_pushed_state(C, but);
+ if (pushed_state_but != pushed_state) {
UI_but_execute(C, but);
if (do_check) {
ui_but_update_edited(but);
@@ -1334,7 +1346,8 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
BLI_rctf_cent_y(&but->rect),
};
- /* check if this is a different button, chances are high the button wont move about :) */
+ /* check if this is a different button,
+ * chances are high the button wont move about :) */
if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) {
if (fabsf(drag_info->but_cent_start[0] - but_cent_new[0]) <
fabsf(drag_info->but_cent_start[1] - but_cent_new[1]))
@@ -1360,7 +1373,7 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
/* touch all buttons between last mouse coord and this one */
- do_draw = ui_drag_toggle_set_xy_xy(C, ar, drag_info->is_set, drag_info->xy_last, xy);
+ do_draw = ui_drag_toggle_set_xy_xy(C, ar, drag_info->pushed_state, drag_info->xy_last, xy);
if (do_draw) {
ED_region_tag_redraw(ar);
@@ -1595,18 +1608,22 @@ static void ui_selectcontext_apply(
RNA_property_int_range(&but->rnapoin, prop, &min.i, &max.i);
}
else if (rna_type == PROP_ENUM) {
- delta.i = RNA_property_enum_get(&but->rnapoin, prop); /* not a delta infact */
+ /* not a delta infact */
+ delta.i = RNA_property_enum_get(&but->rnapoin, prop);
}
else if (rna_type == PROP_BOOLEAN) {
if (is_array) {
- delta.b = RNA_property_boolean_get_index(&but->rnapoin, prop, index); /* not a delta infact */
+ /* not a delta infact */
+ delta.b = RNA_property_boolean_get_index(&but->rnapoin, prop, index);
}
else {
- delta.b = RNA_property_boolean_get(&but->rnapoin, prop); /* not a delta infact */
+ /* not a delta infact */
+ delta.b = RNA_property_boolean_get(&but->rnapoin, prop);
}
}
else if (rna_type == PROP_POINTER) {
- delta.p = RNA_property_pointer_get(&but->rnapoin, prop); /* not a delta infact */
+ /* not a delta infact */
+ delta.p = RNA_property_pointer_get(&but->rnapoin, prop);
}
#ifdef USE_ALLSELECT_LAYER_HACK
@@ -1724,8 +1741,13 @@ static bool ui_but_drag_init(
/* 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 * U.dpi_fac) {
+ /* Clamp the maximum to half the UI unit size so a high user preference
+ * doesn't require the user to drag more then half the default button height. */
+ const int drag_threshold = min_ii(
+ U.tweak_threshold * U.dpi_fac,
+ (int)((UI_UNIT_Y / 2) * ui_block_to_window_scale(data->region, but->block)));
+ if (ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > drag_threshold) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
data->cancel = true;
#ifdef USE_DRAG_TOGGLE
@@ -1737,7 +1759,7 @@ static bool ui_but_drag_init(
* typically 'button_activate_exit()' handles this */
ui_apply_but_autokey(C, but);
- drag_info->is_set = ui_drag_toggle_but_is_pushed(but);
+ drag_info->pushed_state = ui_drag_toggle_but_pushed_state(C, but);
drag_info->but_cent_start[0] = BLI_rctf_cent_x(&but->rect);
drag_info->but_cent_start[1] = BLI_rctf_cent_y(&but->rect);
copy_v2_v2_int(drag_info->xy_init, &event->x);
@@ -2468,7 +2490,6 @@ static void ui_but_paste(bContext *C, uiBut *but, uiHandleButtonData *data, cons
* the cursor position and selection start/end.
*
* \note: remapping is used, because password could contain UTF-8 characters.
- *
*/
static int ui_text_position_from_hidden(uiBut *but, int pos)
@@ -2911,7 +2932,7 @@ static int ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData
enum {
UI_TEXTEDIT_PASTE = 1,
UI_TEXTEDIT_COPY,
- UI_TEXTEDIT_CUT
+ UI_TEXTEDIT_CUT,
};
static bool ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, const int mode)
@@ -3243,7 +3264,8 @@ static void ui_do_but_textedit(
{
bool had_selection = but->selsta != but->selend;
- /* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */
+ /* exit on LMB only on RELEASE for searchbox, to mimic other popups,
+ * and allow multiple menu levels */
if (data->searchbox)
inbox = ui_searchbox_inside(data->searchbox, event->x, event->y);
@@ -3281,7 +3303,8 @@ static void ui_do_but_textedit(
changed = true;
}
else if (inbox) {
- /* if we allow activation on key press, it gives problems launching operators [#35713] */
+ /* if we allow activation on key press,
+ * it gives problems launching operators T35713. */
if (event->val == KM_RELEASE) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval = WM_UI_HANDLER_BREAK;
@@ -3740,7 +3763,8 @@ static bool ui_do_but_ANY_drag_toggle(
}
}
else if (data->state == BUTTON_STATE_WAIT_DRAG) {
- /* note: the 'BUTTON_STATE_WAIT_DRAG' part of 'ui_do_but_EXIT' could be refactored into its own function */
+ /* note: the 'BUTTON_STATE_WAIT_DRAG' part of 'ui_do_but_EXIT' could be refactored into
+ * its own function */
data->applied = false;
*r_retval = ui_do_but_EXIT(C, but, data, event);
return true;
@@ -3900,8 +3924,10 @@ static bool ui_but_is_mouse_over_icon_extra(const ARegion *region, uiBut *but, c
static int ui_do_but_TAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
+ const bool is_property = (but->rnaprop != NULL);
+
#ifdef USE_DRAG_TOGGLE
- {
+ if (is_property) {
int retval;
if (ui_do_but_ANY_drag_toggle(C, but, data, event, &retval)) {
return retval;
@@ -3912,7 +3938,7 @@ static int ui_do_but_TAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
if (data->state == BUTTON_STATE_HIGHLIGHT) {
const int rna_type = but->rnaprop ? RNA_property_type(but->rnaprop) : 0;
- if (but->rnaprop &&
+ if (is_property &&
ELEM(rna_type, PROP_POINTER, PROP_STRING) &&
(but->custom_data != NULL) &&
(event->type == LEFTMOUSE) &&
@@ -3921,9 +3947,12 @@ static int ui_do_but_TAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
return WM_UI_HANDLER_BREAK;
}
- else if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && (event->val == KM_PRESS)) {
- button_activate_state(C, but, BUTTON_STATE_EXIT);
- return WM_UI_HANDLER_BREAK;
+ else if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY)) {
+ int event_val = (is_property) ? KM_PRESS : KM_CLICK;
+ if (event->val == event_val) {
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ return WM_UI_HANDLER_BREAK;
+ }
}
}
else if (data->state == BUTTON_STATE_TEXT_EDITING) {
@@ -4020,7 +4049,23 @@ static int ui_do_but_TOG(
#endif
if (data->state == BUTTON_STATE_HIGHLIGHT) {
- if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
+ bool do_activate = false;
+ if (ELEM(event->type, PADENTER, RETKEY)) {
+ if (event->val == KM_PRESS) {
+ do_activate = true;
+ }
+ }
+ else if (event->type == LEFTMOUSE) {
+ if (ui_block_is_menu(but->block)) {
+ /* Behave like other menu items. */
+ do_activate = (event->val == KM_RELEASE);
+ }
+ else {
+ do_activate = (event->val == KM_PRESS);
+ }
+ }
+
+ if (do_activate) {
#if 0 /* UNUSED */
data->togdual = event->ctrl;
data->togonly = !event->shift;
@@ -4295,7 +4340,8 @@ static bool ui_numedit_but_NUM(
float non_linear_pixel_map;
float non_linear_scale;
- /* Use a non-linear mapping of the mouse drag especially for large floats (normal behavior) */
+ /* Use a non-linear mapping of the mouse drag especially for large floats
+ * (normal behavior) */
deler = 500;
if (is_float) {
/* not needed for smaller float buttons */
@@ -4437,8 +4483,10 @@ static int ui_do_but_NUM(
}
/* XXX hardcoded keymap check.... */
- if (type == MOUSEPAN && event->alt)
- retval = WM_UI_HANDLER_BREAK; /* allow accumulating values, otherwise scrolling gets preference */
+ if (type == MOUSEPAN && event->alt) {
+ /* allow accumulating values, otherwise scrolling gets preference */
+ retval = WM_UI_HANDLER_BREAK;
+ }
else if (type == WHEELDOWNMOUSE && event->ctrl) {
mx = but->rect.xmin;
but->drawflag &= ~UI_BUT_ACTIVE_RIGHT;
@@ -4739,8 +4787,10 @@ static int ui_do_but_SLI(
}
/* XXX hardcoded keymap check.... */
- if (type == MOUSEPAN && event->alt)
- retval = WM_UI_HANDLER_BREAK; /* allow accumulating values, otherwise scrolling gets preference */
+ if (type == MOUSEPAN && event->alt) {
+ /* allow accumulating values, otherwise scrolling gets preference */
+ retval = WM_UI_HANDLER_BREAK;
+ }
else if (type == WHEELDOWNMOUSE && event->ctrl) {
mx = but->rect.xmin;
click = 2;
@@ -4755,7 +4805,8 @@ static int ui_do_but_SLI(
retval = WM_UI_HANDLER_BREAK;
}
#ifndef USE_ALLSELECT
- /* alt-click on sides to get "arrows" like in UI_BTYPE_NUM buttons, and match wheel usage above */
+ /* alt-click on sides to get "arrows" like in UI_BTYPE_NUM buttons,
+ * and match wheel usage above */
else if (event->type == LEFTMOUSE && event->alt) {
int halfpos = BLI_rctf_cent_x(&but->rect);
click = 2;
@@ -4860,7 +4911,8 @@ static int ui_do_but_SLI(
#if 0
if (but->type == SLI) {
- f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect)); /* same as below */
+ /* same as below */
+ f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect));
}
else
#endif
@@ -6091,7 +6143,8 @@ static bool ui_numedit_but_CURVE(
int a;
bool changed = false;
- /* evtx evty and drag coords are absolute mousecoords, prevents errors when editing when layout changes */
+ /* evtx evty and drag coords are absolute mousecoords,
+ * prevents errors when editing when layout changes */
mx = evtx;
my = evty;
ui_window_to_block(data->region, block, &mx, &my);
@@ -6260,7 +6313,8 @@ static int ui_do_but_CURVE(
changed = true;
- /* reset cmp back to the curve points again, rather than drawing segments */
+ /* reset cmp back to the curve points again,
+ * rather than drawing segments */
cmp = cuma->curve;
/* find newly added point and make it 'sel' */
@@ -7180,7 +7234,8 @@ void UI_but_tooltip_refresh(bContext *C, uiBut *but)
}
}
-/* removes tooltip timer from active but (meaning tooltip is disabled until it's reenabled again) */
+/* removes tooltip timer from active but
+ * (meaning tooltip is disabled until it's reenabled again) */
void UI_but_tooltip_timer_remove(bContext *C, uiBut *but)
{
uiHandleButtonData *data;
@@ -7988,7 +8043,8 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
uiBut *but_other = ui_but_find_mouse_over(ar, event);
bool exit = false;
- /* always deactivate button for pie menus, else moving to blank space will leave activated */
+ /* always deactivate button for pie menus,
+ * else moving to blank space will leave activated */
if ((!ui_block_is_menu(block) || ui_block_is_pie_menu(block)) &&
!ui_but_contains_point_px(ar, but, event->x, event->y))
{
@@ -8024,7 +8080,8 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
break;
}
- /* XXX hardcoded keymap check... but anyway, while view changes, tooltips should be removed */
+ /* XXX hardcoded keymap check... but anyway,
+ * while view changes, tooltips should be removed */
case WHEELUPMOUSE:
case WHEELDOWNMOUSE:
case MIDDLEMOUSE:
@@ -8141,6 +8198,17 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
}
break;
}
+ case RIGHTMOUSE:
+ {
+ if (event->val == KM_PRESS) {
+ uiBut *bt = ui_but_find_mouse_over(ar, event);
+ if (bt && bt->active == data) {
+ button_activate_state(C, bt, BUTTON_STATE_HIGHLIGHT);
+ }
+ }
+ break;
+ }
+
}
ui_do_button(C, block, but, event);
@@ -8250,7 +8318,8 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
}
if (dyn_data->items_filter_neworder || dyn_data->items_filter_flags) {
- /* If we have a display order different from collection order, we have some work! */
+ /* If we have a display order different from
+ * collection order, we have some work! */
int *org_order = MEM_mallocN(dyn_data->items_shown * sizeof(int), __func__);
const int *new_order = dyn_data->items_filter_neworder;
int i, org_idx = -1, len = dyn_data->items_len;
@@ -8390,7 +8459,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u
/* ************************* menu handling *******************************/
/**
- * Function used to prevent losing the open menu when using nested pulldowns,
+ * Function used to prevent losing the open menu when using nested pull-downs,
* when moving mouse towards the pulldown menu over other buttons that could
* steal the highlight from the current button, only checks:
*
@@ -8786,7 +8855,29 @@ static int ui_handle_menu_event(
switch (event->type) {
- /* closing sublevels of pulldowns */
+ /* Closing sub-levels of pull-downs.
+ *
+ * The actual event is handled by the button under the cursor.
+ * This is done so we can right click on menu items even when they have sub-menus open. */
+ case RIGHTMOUSE:
+ if (inside == false) {
+ if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
+ if (block->saferct.first) {
+ /* Currently right clicking on a top level pull-down (typically in the header)
+ * just closes the menu and doesn't support immediately handling the RMB event.
+ *
+ * To support we would need UI_RETURN_OUT_PARENT to be handled by
+ * top-level buttons, not just menus. Note that this isn't very important
+ * since it's easy to manually close these menus by clicking on them. */
+ menu->menuretval = (level > 0) ? UI_RETURN_OUT_PARENT : UI_RETURN_OUT;
+
+ }
+ }
+ retval = WM_UI_HANDLER_BREAK;
+ }
+ break;
+
+ /* Closing sub-levels of pull-downs. */
case LEFTARROWKEY:
if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP))
if (block->saferct.first)
@@ -8795,7 +8886,7 @@ static int ui_handle_menu_event(
retval = WM_UI_HANDLER_BREAK;
break;
- /* opening sublevels of pulldowns */
+ /* Opening sub-levels of pull-downs. */
case RIGHTARROWKEY:
if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
@@ -8986,7 +9077,7 @@ static int ui_handle_menu_event(
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY);
}
else if (ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN)) {
- /* open submenus (like right arrow key) */
+ /* open sub-menus (like right arrow key) */
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
}
else if (but->type == UI_BTYPE_MENU) {
@@ -9010,13 +9101,16 @@ static int ui_handle_menu_event(
/* here we check return conditions for menus */
if (block->flag & UI_BLOCK_LOOP) {
- /* if we click outside the block, verify if we clicked on the
+ /* If we click outside the block, verify if we clicked on the
* button that opened us, otherwise we need to close,
*
* note that there is an exception for root level menus and
* popups which you can click again to close.
+ *
+ * Events handled above may have already set the return value,
+ * don't overwrite them, see: T61015.
*/
- if (inside == 0) {
+ if ((inside == 0) && (menu->menuretval == 0)) {
uiSafetyRct *saferct = block->saferct.first;
if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) {
@@ -9036,7 +9130,8 @@ static int ui_handle_menu_event(
}
}
else if (ELEM(event->val, KM_RELEASE, KM_CLICK)) {
- /* For buttons that use a hold function, exit when mouse-up outside the menu. */
+ /* For buttons that use a hold function,
+ * exit when mouse-up outside the menu. */
if (block->flag & UI_BLOCK_POPUP_HOLD) {
/* Note, we could check the cursor is over the parent button. */
menu->menuretval = UI_RETURN_CANCEL;
@@ -9051,12 +9146,12 @@ static int ui_handle_menu_event(
}
#ifdef USE_KEYNAV_LIMIT
else if ((event->type == MOUSEMOVE) && ui_mouse_motion_keynav_test(&menu->keynav_state, event)) {
- /* don't handle the mousemove if we're using key-navigation */
+ /* Don't handle the mouse-move if we're using key-navigation. */
retval = WM_UI_HANDLER_BREAK;
}
#endif
else if (event->type == ESCKEY && event->val == KM_PRESS) {
- /* esc cancels this and all preceding menus */
+ /* Escape cancels this and all preceding menus. */
menu->menuretval = UI_RETURN_CANCEL;
}
else if (ELEM(event->type, RETKEY, PADENTER) && event->val == KM_PRESS) {
@@ -9289,7 +9384,8 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
bool is_click_style;
float dist;
- /* we block all events, this is modal interaction, except for drop events which is described below */
+ /* we block all events, this is modal interaction,
+ * except for drop events which is described below */
int retval = WM_UI_HANDLER_BREAK;
if (event->type == EVT_DROP) {
@@ -9319,6 +9415,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
ui_window_to_block_fl(ar, block, &event_xy[0], &event_xy[1]);
+ /* Distance from initial point. */
dist = ui_block_calc_pie_segment(block, event_xy);
if (but && button_modal_state(but->active->state)) {
@@ -9403,8 +9500,9 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
ED_region_tag_redraw(ar);
}
else {
- /* distance from initial point */
- if (!(block->pie_data.flags & UI_PIE_DRAG_STYLE)) {
+ if ((duration < 0.01 * U.pie_tap_timeout) &&
+ !(block->pie_data.flags & UI_PIE_DRAG_STYLE))
+ {
block->pie_data.flags |= UI_PIE_CLICK_STYLE;
}
else {
@@ -9436,7 +9534,8 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
block->pie_data.flags |= UI_PIE_DRAG_STYLE;
}
- /* here instead, we use the offset location to account for the initial direction timeout */
+ /* here instead, we use the offset location to account for the initial
+ * direction timeout */
if ((U.pie_menu_confirm > 0) &&
(dist >= U.dpi_fac * (U.pie_menu_threshold + U.pie_menu_confirm)))
{
@@ -9554,7 +9653,8 @@ static int ui_handle_menus_recursive(
uiBlock *block = menu->region->uiblocks.first;
const bool is_menu = ui_block_is_menu(block);
bool inside = false;
- /* root pie menus accept the key that spawned them as double click to improve responsiveness */
+ /* root pie menus accept the key that spawned
+ * them as double click to improve responsiveness */
bool do_recursion = (!(block->flag & UI_BLOCK_RADIAL) || event->type != block->pie_data.event);
if (do_recursion) {
@@ -9754,7 +9854,8 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
data = but->active;
if ((data->state == BUTTON_STATE_MENU_OPEN) &&
- (is_inside_menu == false) && /* make sure mouse isn't inside another menu (see T43247) */
+ /* make sure mouse isn't inside another menu (see T43247) */
+ (is_inside_menu == false) &&
(ELEM(but->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER)) &&
(but_other = ui_but_find_mouse_over(ar, event)) &&
(but != but_other) &&
@@ -9818,7 +9919,8 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata)
{
uiPopupBlockHandle *menu = userdata;
struct ARegion *menu_region;
- /* we block all events, this is modal interaction, except for drop events which is described below */
+ /* we block all events, this is modal interaction,
+ * except for drop events which is described below */
int retval = WM_UI_HANDLER_BREAK;
bool reset_pie = false;
@@ -9930,22 +10032,26 @@ void UI_popup_handlers_add(bContext *C, ListBase *handlers, uiPopupBlockHandle *
void UI_popup_handlers_remove(ListBase *handlers, uiPopupBlockHandle *popup)
{
- wmEventHandler *handler;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_UI) {
+ wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base;
- for (handler = handlers->first; handler; handler = handler->next) {
- if (handler->ui_handle == ui_popup_handler &&
- handler->ui_remove == ui_popup_handler_remove &&
- handler->ui_userdata == popup)
- {
- /* tag refresh parent popup */
- if (handler->next &&
- handler->next->ui_handle == ui_popup_handler &&
- handler->next->ui_remove == ui_popup_handler_remove)
+ if (handler->handle_fn == ui_popup_handler &&
+ handler->remove_fn == ui_popup_handler_remove &&
+ handler->user_data == popup)
{
- uiPopupBlockHandle *parent_popup = handler->next->ui_userdata;
- ED_region_tag_refresh_ui(parent_popup->region);
+ /* tag refresh parent popup */
+ wmEventHandler_UI *handler_next = (wmEventHandler_UI *)handler->head.next;
+ if (handler_next &&
+ handler_next->head.type == WM_HANDLER_TYPE_UI &&
+ handler_next->handle_fn == ui_popup_handler &&
+ handler_next->remove_fn == ui_popup_handler_remove)
+ {
+ uiPopupBlockHandle *parent_popup = handler_next->user_data;
+ ED_region_tag_refresh_ui(parent_popup->region);
+ }
+ break;
}
- break;
}
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index eb35f69b627..ae9ee152d0f 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributors: Blender Foundation, full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_icons.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <math.h>
@@ -709,7 +703,10 @@ static void init_internal_icons(void)
if (icondir) {
BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile);
- bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL); /* if the image is missing bbuf will just be NULL */
+
+ /* if the image is missing bbuf will just be NULL */
+ bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL);
+
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);
@@ -1308,7 +1305,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
}
/* draw */
- GPUBuiltinShader shader;
+ eGPUBuiltinShader shader;
if (desaturate != 0.0f) {
shader = GPU_SHADER_2D_IMAGE_DESATURATE_COLOR;
}
@@ -1370,8 +1367,8 @@ static void icon_draw_cache_flush_ex(void)
GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR);
GPU_shader_bind(shader);
- int img_loc = GPU_shader_get_uniform(shader, "image");
- int data_loc = GPU_shader_get_uniform(shader, "calls_data[0]");
+ int img_loc = GPU_shader_get_uniform_ensure(shader, "image");
+ int data_loc = GPU_shader_get_uniform_ensure(shader, "calls_data[0]");
glUniform1i(img_loc, 0);
glUniform4fv(data_loc, ICON_DRAW_CACHE_SIZE * 3, (float *)g_icon_draw_cache.drawcall_cache);
@@ -1459,9 +1456,9 @@ static void icon_draw_texture(
if (rgb) glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), rgb[0], rgb[1], rgb[2], alpha);
else glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), alpha, alpha, alpha, alpha);
- glUniform1i(GPU_shader_get_uniform(shader, "image"), 0);
- glUniform4f(GPU_shader_get_uniform(shader, "rect_icon"), x1, y1, x2, y2);
- glUniform4f(GPU_shader_get_uniform(shader, "rect_geom"), x, y, x + w, y + h);
+ glUniform1i(GPU_shader_get_uniform_ensure(shader, "image"), 0);
+ glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_icon"), x1, y1, x2, y2);
+ glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_geom"), x, y, x + w, y + h);
GPU_draw_primitive(GPU_PRIM_TRI_STRIP, 4);
@@ -1520,7 +1517,8 @@ static void icon_draw_size(
}
else if (di->type == ICON_TYPE_GEOM) {
#ifdef USE_UI_TOOLBAR_HACK
- /* TODO(campbell): scale icons up for toolbar, we need a way to detect larger buttons and do this automatic. */
+ /* TODO(campbell): scale icons up for toolbar,
+ * we need a way to detect larger buttons and do this automatic. */
{
float scale = (float)ICON_DEFAULT_HEIGHT_TOOLBAR / (float)ICON_DEFAULT_HEIGHT;
y = (y + (h / 2)) - ((h * scale) / 2);
@@ -1615,7 +1613,8 @@ static void icon_draw_size(
static void ui_id_preview_image_render_size(
const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job)
{
- if (((pi->flag[size] & PRV_CHANGED) || !pi->rect[size])) { /* changed only ever set by dynamic icons */
+ /* changed only ever set by dynamic icons */
+ if (((pi->flag[size] & PRV_CHANGED) || !pi->rect[size])) {
/* create the rect if necessary */
icon_set_image(C, scene, id, pi, size, use_job);
@@ -1628,10 +1627,14 @@ void UI_id_icon_render(const bContext *C, Scene *scene, ID *id, const bool big,
PreviewImage *pi = BKE_previewimg_id_ensure(id);
if (pi) {
- if (big)
- ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_PREVIEW, use_job); /* bigger preview size */
- else
- ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_ICON, use_job); /* icon size */
+ if (big) {
+ /* bigger preview size */
+ ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_PREVIEW, use_job);
+ }
+ else {
+ /* icon size */
+ ui_id_preview_image_render_size(C, scene, id, pi, ICON_SIZE_ICON, use_job);
+ }
}
}
diff --git a/source/blender/editors/interface/interface_icons_event.c b/source/blender/editors/interface/interface_icons_event.c
index 598adcce87f..e77b47d19e5 100644
--- a/source/blender/editors/interface/interface_icons_event.c
+++ b/source/blender/editors/interface/interface_icons_event.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_icons_event.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* A special set of icons to represent input devices,
* this is a mix of text (via fonts) and a handful of custom glyphs for special keys.
@@ -41,7 +37,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_fileops_types.h"
#include "BLI_math_vector.h"
#include "DNA_brush_types.h"
@@ -55,8 +50,6 @@
#include "RNA_access.h"
#include "RNA_enum_types.h"
-#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_icons.h"
#include "BKE_appdir.h"
#include "BKE_studiolight.h"
@@ -65,7 +58,6 @@
#include "IMB_imbuf_types.h"
#include "IMB_thumbs.h"
-#include "BIF_glutil.h"
#include "BLF_api.h"
#include "DEG_depsgraph.h"
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index b0136feaa30..82d6115fbbb 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_intern.h
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -39,19 +31,19 @@
#include "DNA_listBase.h"
struct ARegion;
+struct ID;
+struct ImBuf;
+struct Scene;
struct bContext;
+struct bContextStore;
struct uiHandleButtonData;
+struct uiLayout;
+struct uiStyle;
+struct uiWidgetColors;
struct wmEvent;
struct wmKeyConfig;
struct wmOperatorType;
struct wmTimer;
-struct uiStyle;
-struct uiWidgetColors;
-struct uiLayout;
-struct bContextStore;
-struct Scene;
-struct ID;
-struct ImBuf;
/* ****************** general defines ************** */
@@ -106,7 +98,8 @@ typedef enum {
} uiWidgetTypeEnum;
#define UI_MENU_WIDTH_MIN (UI_UNIT_Y * 9)
-#define UI_MENU_SUBMENU_PADDING (6 * UI_DPI_FAC) /* some extra padding added to menus containing submenu icons */
+/* some extra padding added to menus containing submenu icons */
+#define UI_MENU_SUBMENU_PADDING (6 * UI_DPI_FAC)
/* menu scrolling */
#define UI_MENU_SCROLL_ARROW 12
@@ -163,7 +156,7 @@ extern const short ui_radial_dir_to_angle[8];
/* internal panel drawing defines */
#define PNL_GRID (UI_UNIT_Y / 5) /* 4 default */
-#define PNL_HEADER (UI_UNIT_Y + 4) /* 24 default */
+#define PNL_HEADER (UI_UNIT_Y * 1.2) /* 24 default */
/* bit button defines */
/* Bit operations */
@@ -181,13 +174,20 @@ extern const short ui_radial_dir_to_angle[8];
/* PieMenuData->flags */
enum {
- UI_PIE_DEGREES_RANGE_LARGE = (1 << 0), /* pie menu item collision is detected at 90 degrees */
- UI_PIE_INITIAL_DIRECTION = (1 << 1), /* use initial center of pie menu to calculate direction */
- UI_PIE_DRAG_STYLE = (1 << 2), /* pie menu is drag style */
- UI_PIE_INVALID_DIR = (1 << 3), /* mouse not far enough from center position */
- UI_PIE_CLICK_STYLE = (1 << 4), /* pie menu changed to click style, click to confirm */
- UI_PIE_ANIMATION_FINISHED = (1 << 5), /* pie animation finished, do not calculate any more motion */
- UI_PIE_GESTURE_END_WAIT = (1 << 6), /* pie gesture selection has been done, now wait for mouse motion to end */
+ /** pie menu item collision is detected at 90 degrees */
+ UI_PIE_DEGREES_RANGE_LARGE = (1 << 0),
+ /** use initial center of pie menu to calculate direction */
+ UI_PIE_INITIAL_DIRECTION = (1 << 1),
+ /** pie menu is drag style */
+ UI_PIE_DRAG_STYLE = (1 << 2),
+ /** mouse not far enough from center position */
+ UI_PIE_INVALID_DIR = (1 << 3),
+ /** pie menu changed to click style, click to confirm */
+ UI_PIE_CLICK_STYLE = (1 << 4),
+ /** pie animation finished, do not calculate any more motion */
+ UI_PIE_ANIMATION_FINISHED = (1 << 5),
+ /** pie gesture selection has been done, now wait for mouse motion to end */
+ UI_PIE_GESTURE_END_WAIT = (1 << 6),
};
#define PIE_CLICK_THRESHOLD_SQ 50.0f
@@ -256,7 +256,7 @@ struct uiBut {
void *rename_arg1;
void *rename_orig;
- /* Run an action when holding the button down. */
+ /** Run an action when holding the button down. */
uiButHandleHoldFunc hold_func;
void *hold_argN;
@@ -264,14 +264,18 @@ struct uiBut {
uiButToolTipFunc tip_func;
void *tip_argN;
- /* info on why button is disabled, displayed in tooltip */
+ /** info on why button is disabled, displayed in tooltip */
const char *disabled_info;
BIFIconID icon;
- char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */
- signed char pie_dir; /* direction in a pie menu, used for collision detection (RadialDirection) */
- bool changed; /* could be made into a single flag */
- uchar unit_type; /* so buttons can support unit systems which are not RNA */
+ /** drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */
+ char dt;
+ /** direction in a pie menu, used for collision detection (RadialDirection) */
+ signed char pie_dir;
+ /** could be made into a single flag */
+ bool changed;
+ /** so buttons can support unit systems which are not RNA */
+ uchar unit_type;
short modifier_key;
short iconadd;
@@ -316,6 +320,9 @@ struct uiBut {
void *editcoba;
void *editcumap;
+ uiButPushedStateFunc pushed_state_func;
+ void *pushed_state_arg;
+
/* pointer back */
uiBlock *block;
};
@@ -327,8 +334,11 @@ typedef struct uiButTab {
typedef struct ColorPicker {
struct ColorPicker *next, *prev;
- float color_data[3]; /* colr data may be HSV or HSL for now */
- int representation; /* store hsv/hsl value */
+ /** Color data, may be HSV or HSL. */
+ float color_data[3];
+ /** Initial color data (detect changes). */
+ float color_data_init[3];
+ bool is_init;
} ColorPicker;
typedef struct ColorPickerData {
@@ -336,7 +346,7 @@ typedef struct ColorPickerData {
} ColorPickerData;
struct PieMenuData {
- /* store title and icon to allow access when pie levels are created */
+ /** store title and icon to allow access when pie levels are created */
const char *title;
int icon;
@@ -346,13 +356,14 @@ struct PieMenuData {
float last_pos[2];
double duration_gesture;
int flags;
- int event; /* initial event used to fire the pie menu, store here so we can query for release */
+ /** initial event used to fire the pie menu, store here so we can query for release */
+ int event;
float alphafac;
};
/* uiBlock.content_hints */
enum eBlockContentHints {
- /* In a menu block, if there is a single sub-menu button, we add some
+ /** In a menu block, if there is a single sub-menu button, we add some
* padding to the right to put nicely aligned triangle icons there. */
UI_BLOCK_CONTAINS_SUBMENU_BUT = (1 << 0),
};
@@ -403,14 +414,16 @@ struct uiBlock {
int flag;
short alignnr;
- /* Hints about the buttons of this block. Used to avoid iterating over
+ /** Hints about the buttons of this block. Used to avoid iterating over
* buttons to find out if some criteria is met by any. Instead, check this
* criteria when adding the button and set a flag here if it's met. */
short content_hints; /* eBlockContentHints */
char direction;
- char theme_style; /* UI_BLOCK_THEME_STYLE_* */
- char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */
+ /** UI_BLOCK_THEME_STYLE_* */
+ char theme_style;
+ /** drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */
+ char dt;
bool auto_open;
char _pad[5];
double auto_open_last;
@@ -418,32 +431,46 @@ struct uiBlock {
const char *lockstr;
char lock;
- char active; /* to keep blocks while drawing and free them afterwards */
- char tooltipdisabled; /* to avoid tooltip after click */
- char endblock; /* UI_block_end done? */
-
- eBlockBoundsCalc bounds_type; /* for doing delayed */
+ /** to keep blocks while drawing and free them afterwards */
+ char active;
+ /** to avoid tooltip after click */
+ char tooltipdisabled;
+ /** UI_block_end done? */
+ char endblock;
+
+ /** for doing delayed */
+ eBlockBoundsCalc bounds_type;
int mx, my;
- int bounds, minbounds; /* for doing delayed */
+ /** for doing delayed */
+ int bounds, minbounds;
- rctf safety; /* pulldowns, to detect outside, can differ per case how it is created */
- ListBase saferct; /* uiSafetyRct list */
+ /** pulldowns, to detect outside, can differ per case how it is created */
+ rctf safety;
+ /** uiSafetyRct list */
+ ListBase saferct;
uiPopupBlockHandle *handle; /* handle */
- struct wmOperator *ui_operator; /* use so presets can find the operator, */
- /* across menus and from nested popups which fail for operator context. */
+ /** use so presets can find the operator,
+ * across menus and from nested popups which fail for operator context. */
+ struct wmOperator *ui_operator;
- void *evil_C; /* XXX hack for dynamic operator enums */
+ /** XXX hack for dynamic operator enums */
+ void *evil_C;
- struct UnitSettings *unit; /* unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. */
- ColorPickerData color_pickers; /* XXX, only accessed by color picker templates */
+ /** unit system, used a lot for numeric buttons so include here
+ * rather then fetching through the scene every time. */
+ struct UnitSettings *unit;
+ /** \note only accessed by color picker templates. */
+ ColorPickerData color_pickers;
bool is_color_gamma_picker; /* Block for color picker with gamma baked in. */
- char display_device[64]; /* display device name used to display this block,
- * used by color widgets to transform colors from/to scene linear
- */
+ /** display device name used to display this block,
+ * used by color widgets to transform colors from/to scene linear
+ */
+ char display_device[64];
+
struct PieMenuData pie_data;
};
@@ -460,6 +487,7 @@ void ui_fontscale(short *points, float aspect);
extern void ui_block_to_window_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
extern void ui_block_to_window(const struct ARegion *ar, uiBlock *block, int *x, int *y);
extern void ui_block_to_window_rctf(const struct ARegion *ar, uiBlock *block, rctf *rct_dst, const rctf *rct_src);
+extern float ui_block_to_window_scale(const struct ARegion *ar, uiBlock *block);
extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y);
extern void ui_window_to_region(const ARegion *ar, int *x, int *y);
@@ -793,8 +821,6 @@ void icon_draw_rect_input(
/* resources.c */
void init_userdef_do_versions(struct Main *bmain);
-void ui_theme_init_default(void);
-void ui_style_init_default(void);
void ui_resources_init(void);
void ui_resources_free(void);
@@ -843,7 +869,6 @@ struct wmKeyMap *eyedropper_colorband_modal_keymap(struct wmKeyConfig *keyconf);
/* interface_eyedropper_color.c */
void UI_OT_eyedropper_color(struct wmOperatorType *ot);
-void UI_OT_eyedropper_color_crypto(struct wmOperatorType *ot);
/* interface_eyedropper_colorband.c */
void UI_OT_eyedropper_colorband(struct wmOperatorType *ot);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 09033a5f56d..b0ac22898b6 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation 2009.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_layout.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -158,7 +152,7 @@ struct uiLayout {
bContextStore *context;
ListBase items;
- /* Sub layout to add child items, if not the layout itself. */
+ /** Sub layout to add child items, if not the layout itself. */
uiLayout *child_items_layout;
int x, y, w, h;
@@ -169,10 +163,12 @@ struct uiLayout {
bool enabled;
bool redalert;
bool keepaspect;
- bool variable_size; /* For layouts inside gridflow, they and their items shall never have a fixed maximal size. */
+ /** For layouts inside gridflow, they and their items shall never have a fixed maximal size. */
+ bool variable_size;
char alignment;
char emboss;
- float units[2]; /* for fixed width or height to avoid UI size changes */
+ /** for fixed width or height to avoid UI size changes */
+ float units[2];
};
typedef struct uiLayoutItemFlow {
@@ -188,9 +184,12 @@ typedef struct uiLayoutItemGridFlow {
bool row_major; /* Fill first row first, instead of filling first column first. */
bool even_columns; /* Same width for all columns. */
bool even_rows; /* Same height for all rows. */
- /* If positive, absolute fixed number of columns.
- * If 0, fully automatic (based on available width).
- * If negative, automatic but only generates number of columns/rows multiple of given (absolute) value. */
+ /**
+ * - If positive, absolute fixed number of columns.
+ * - If 0, fully automatic (based on available width).
+ * - If negative, automatic but only generates number of columns/rows
+ * multiple of given (absolute) value.
+ */
int columns_len;
/* Pure internal runtime storage. */
@@ -274,8 +273,9 @@ static int ui_layout_vary_direction(uiLayout *layout)
static bool ui_layout_variable_size(uiLayout *layout)
{
- /* Note that this code is probably a bit flacky, we'd probably want to know whether it's variable in X and/or Y,
- * etc. But for now it mimics previous one, with addition of variable flag set for children of gridflow layouts. */
+ /* Note that this code is probably a bit flacky, we'd probably want to know whether it's
+ * variable in X and/or Y, etc. But for now it mimics previous one,
+ * with addition of variable flag set for children of gridflow layouts. */
return ui_layout_vary_direction(layout) == UI_ITEM_VARY_X || layout->variable_size;
}
@@ -697,7 +697,8 @@ static void ui_item_enum_expand_exec(
/* Separate items, potentially with a label. */
if (next_item->identifier) {
- /* Item without identifier but with name: Add group label for the following items. */
+ /* Item without identifier but with name:
+ * Add group label for the following items. */
if (item->name) {
if (!is_first) {
uiItemS(block->curlayout);
@@ -722,7 +723,7 @@ static void ui_item_enum_expand_exec(
if (icon && name[0] && !icon_only)
but = uiDefIconTextButR_prop(block, but_type, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
else if (icon)
- but = uiDefIconButR_prop(block, but_type, 0, icon, 0, 0, (is_first) ? itemw : ceilf(itemw - UI_DPI_FAC), h, ptr, prop, -1, 0, value, -1, -1, NULL);
+ but = uiDefIconButR_prop(block, but_type, 0, icon, 0, 0, (is_first) ? itemw : ceilf(itemw - U.pixelsize), h, ptr, prop, -1, 0, value, -1, -1, NULL);
else
but = uiDefButR_prop(block, but_type, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
@@ -735,7 +736,8 @@ static void ui_item_enum_expand_exec(
if (uiLayoutGetLocalDir(layout) != UI_LAYOUT_HORIZONTAL)
but->drawflag |= UI_BUT_TEXT_LEFT;
- /* Allow quick, inaccurate swipe motions to switch tabs (no need to keep cursor over them). */
+ /* Allow quick, inaccurate swipe motions to switch tabs
+ * (no need to keep cursor over them). */
if (but_type == UI_BTYPE_TAB) {
but->flag |= UI_BUT_DRAG_LOCK;
}
@@ -806,7 +808,8 @@ static uiBut *ui_item_with_label(
}
else {
if (ui_layout_variable_size(layout)) {
- /* w_hint is width for label in this case. Use a default width for property button(s) */
+ /* w_hint is width for label in this case.
+ * Use a default width for property button(s) */
prop_but_width = UI_UNIT_X * 5;
w_label = w_hint;
}
@@ -1253,7 +1256,8 @@ void uiItemsFullEnumO_items(
but = block->buttons.last;
}
else {
- /* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */
+ /* Do not use uiItemL here, as our root layout is a menu one,
+ * it will add a fake blank icon! */
but = uiDefBut(
block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL,
0.0, 0.0, 0, 0, "");
@@ -1262,7 +1266,8 @@ void uiItemsFullEnumO_items(
}
else {
if (radial) {
- /* invisible dummy button to ensure all items are always at the same position */
+ /* invisible dummy button to ensure all items are
+ * always at the same position */
uiItemS(target);
}
else {
@@ -1751,7 +1756,8 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
if ((type == PROP_ENUM) && (flag & UI_ITEM_R_EXPAND)) {
/* Expanded enums each have their own name. */
- /* Often expanded enum's are better arranged into a row, so check the existing layout. */
+ /* Often expanded enum's are better arranged into a row,
+ * so check the existing layout. */
if (uiLayoutGetLocalDir(layout) == UI_LAYOUT_HORIZONTAL) {
layout = uiLayoutRow(layout_split, true);
}
@@ -2106,7 +2112,8 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
but->free_search_arg = true;
}
else if (but->type == UI_BTYPE_SEARCH_MENU) {
- /* In case we fail to find proper searchprop, so other code might have already set but->type to search menu... */
+ /* In case we fail to find proper searchprop,
+ * so other code might have already set but->type to search menu... */
but->flag |= UI_BUT_DISABLED;
}
}
@@ -2262,7 +2269,8 @@ static uiBut *ui_item_menu(
}
if (ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR) ||
- (force_menu && layout->root->type != UI_LAYOUT_MENU)) /* We never want a dropdown in menu! */
+ /* We never want a dropdown in menu! */
+ (force_menu && layout->root->type != UI_LAYOUT_MENU))
{
UI_but_type_set_menu_from_pulldown(but);
}
@@ -3182,7 +3190,8 @@ typedef struct UILayoutGridFlowInput {
const bool even_rows : 1; /* All rows will have same height. */
const int space_x; /* Space between columns. */
const int space_y; /* Space between rows. */
- /* Real data about current position and size of this layout item (either estimated, or final values). */
+ /* Real data about current position and size of this layout item
+ * (either estimated, or final values). */
const int litem_w; /* Layout item width. */
const int litem_x; /* Layout item X position. */
const int litem_y; /* Layout item Y position. */
@@ -3430,7 +3439,8 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
}
}
- /* Set evenly-spaced axes size (quick optimization in case we have even columns and rows). */
+ /* Set evenly-spaced axes size
+ * (quick optimization in case we have even columns and rows). */
if (gflow->even_columns && gflow->even_rows) {
litem->w = (int)(gflow->tot_columns * avg_w) + space_x * (gflow->tot_columns - 1);
litem->h = (int)(gflow->tot_rows * max_h) + space_y * (gflow->tot_rows - 1);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 484debf554c..d39fe514f99 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_ops.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <string.h>
@@ -76,31 +70,6 @@
#include "BKE_main.h"
#include "BLI_ghash.h"
-/* Reset Default Theme ------------------------ */
-
-static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
-{
- ui_theme_init_default();
- ui_style_init_default();
- WM_event_add_notifier(C, NC_WINDOW, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-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";
-
- /* callbacks */
- ot->exec = reset_default_theme_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER;
-}
-
/* Copy Data Path Operator ------------------------ */
static bool copy_data_path_button_poll(bContext *C)
@@ -408,7 +377,7 @@ static EnumPropertyItem override_type_items[] = {
{UIOverride_Type_Replace, "REPLACE", 0, "Replace", "Completely replace value from linked data by local one"},
{UIOverride_Type_Difference, "DIFFERENCE", 0, "Difference", "Store difference to linked data value"},
{UIOverride_Type_Factor, "FACTOR", 0, "Factor", "Store factor to linked data value (useful e.g. for scale)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -444,7 +413,8 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op)
operation = IDOVERRIDESTATIC_OP_REPLACE;
break;
case UIOverride_Type_Difference:
- operation = IDOVERRIDESTATIC_OP_ADD; /* override code will automatically switch to subtract if needed. */
+ /* override code will automatically switch to subtract if needed. */
+ operation = IDOVERRIDESTATIC_OP_ADD;
break;
case UIOverride_Type_Factor:
operation = IDOVERRIDESTATIC_OP_MULTIPLY;
@@ -549,13 +519,15 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
if (!all && index != -1) {
bool is_strict_find;
- /* Remove override operation for given item, add singular operations for the other items as needed. */
+ /* Remove override operation for given item,
+ * add singular operations for the other items as needed. */
IDOverrideStaticPropertyOperation *opop = BKE_override_static_property_operation_find(
oprop, NULL, NULL, index, index, false, &is_strict_find);
BLI_assert(opop != NULL);
if (!is_strict_find) {
/* No specific override operation, we have to get generic one,
- * and create item-specific override operations for all but given index, before removing generic one. */
+ * and create item-specific override operations for all but given index,
+ * before removing generic one. */
for (int idx = RNA_property_array_length(&ptr, prop); idx--; ) {
if (idx != index) {
BKE_override_static_property_operation_get(oprop, opop->operation, NULL, NULL, idx, idx, true, NULL, NULL);
@@ -735,7 +707,8 @@ bool UI_context_copy_to_selected_list(
}
else if (GS(id->name) == ID_SCE) {
/* Sequencer's ID is scene :/ */
- /* Try to recursively find an RNA_Sequence ancestor, to handle situations like T41062... */
+ /* Try to recursively find an RNA_Sequence ancestor,
+ * to handle situations like T41062... */
if ((*r_path = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_Sequence)) != NULL) {
*r_lb = CTX_data_collection_get(C, "selected_editable_sequences");
}
@@ -1160,7 +1133,7 @@ static int editsource_text_edit(
/* Developers may wish to copy-paste to an external editor. */
printf("%s:%d\n", filepath, line);
- for (text = bmain->text.first; text; text = text->id.next) {
+ for (text = bmain->texts.first; text; text = text->id.next) {
if (text->name && BLI_path_cmp(text->name, filepath) == 0) {
break;
}
@@ -1605,7 +1578,6 @@ static void UI_OT_drop_color(wmOperatorType *ot)
void ED_operatortypes_ui(void)
{
- WM_operatortype_append(UI_OT_reset_default_theme);
WM_operatortype_append(UI_OT_copy_data_path_button);
WM_operatortype_append(UI_OT_copy_python_command_button);
WM_operatortype_append(UI_OT_reset_default_button);
@@ -1626,7 +1598,6 @@ void ED_operatortypes_ui(void)
/* external */
WM_operatortype_append(UI_OT_eyedropper_color);
- WM_operatortype_append(UI_OT_eyedropper_color_crypto);
WM_operatortype_append(UI_OT_eyedropper_colorband);
WM_operatortype_append(UI_OT_eyedropper_colorband_point);
WM_operatortype_append(UI_OT_eyedropper_id);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 469720c2d30..1897d07d224 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,15 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009 full recode.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_panel.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
-/* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt */
+/* a full doc with API notes can be found in
+ * bf-blender/trunk/blender/doc/guides/interface_API.txt */
#include <math.h>
#include <stdlib.h>
@@ -130,7 +125,7 @@ static void panel_title_color_get(bool show_background, uchar color[4])
/*********************** space specific code ************************/
/* temporary code to remove all sbuts stuff from panel code */
-/* SpaceButs.align */
+/* SpaceProperties.align */
typedef enum eSpaceButtons_Align {
BUT_HORIZONTAL = 0,
BUT_VERTICAL = 1,
@@ -139,7 +134,7 @@ typedef enum eSpaceButtons_Align {
static int panel_aligned(ScrArea *sa, ARegion *ar)
{
- if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW)
+ if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW)
return BUT_VERTICAL;
else if (sa->spacetype == SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
return BUT_VERTICAL;
@@ -195,8 +190,8 @@ static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **pa_animate)
{
*pa_animate = NULL;
- if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
- SpaceButs *sbuts = sa->spacedata.first;
+ if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW) {
+ SpaceProperties *sbuts = sa->spacedata.first;
if (sbuts->mainbo != sbuts->mainb) {
return true;
@@ -621,14 +616,13 @@ static void ui_draw_panel_dragwidget(uint pos, uint col, const rctf *rect)
void UI_panel_label_offset(uiBlock *block, int *x, int *y)
{
Panel *panel = block->panel;
- uiStyle *style = UI_style_get_dpi();
const bool is_subpanel = (panel->type && panel->type->parent);
- *x = UI_UNIT_X * 1.1f;
- *y = (UI_UNIT_Y * 1.1f) + style->panelspace;
+ *x = UI_UNIT_X * 1.0f;
+ *y = UI_UNIT_Y * 1.5f;
if (is_subpanel) {
- *x += 5.0f / block->aspect;
+ *x += (0.7f * UI_UNIT_X);
}
}
@@ -646,9 +640,9 @@ static void ui_draw_aligned_panel_header(
/* + 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;
+ pnl_icons = (panel->labelofs + (2.0f * PNL_ICON)) / block->aspect + 0.001f;
else
- pnl_icons = (panel->labelofs + PNL_ICON + 5) / block->aspect + 0.001f;
+ pnl_icons = (panel->labelofs + (1.1f * PNL_ICON)) / block->aspect + 0.001f;
/* draw text label */
panel_title_color_get(show_background, col_title);
@@ -657,7 +651,7 @@ static void ui_draw_aligned_panel_header(
hrect = *rect;
if (dir == 'h') {
hrect.xmin = rect->xmin + pnl_icons;
- hrect.ymin += 2.0f / block->aspect;
+ hrect.ymin -= 2.0f / block->aspect;
UI_fontstyle_draw(
fontstyle, &hrect, activename, col_title,
&(struct uiFontStyleDraw_Params) { .align = UI_STYLE_TEXT_LEFT, });
@@ -700,7 +694,7 @@ void ui_draw_aligned_panel(
rcti titlerect = headrect;
if (is_subpanel) {
- titlerect.xmin += 5.0f / block->aspect;
+ titlerect.xmin += (0.7f * UI_UNIT_X);
}
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -763,7 +757,7 @@ void ui_draw_aligned_panel(
col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
/* itemrect smaller */
- itemrect.xmax = headrect.xmax - 5.0f / block->aspect;
+ itemrect.xmax = headrect.xmax - (0.2f * UI_UNIT_X);
itemrect.xmin = itemrect.xmax - BLI_rcti_size_y(&headrect);
itemrect.ymin = headrect.ymin;
itemrect.ymax = headrect.ymax;
@@ -835,7 +829,7 @@ void ui_draw_aligned_panel(
/* draw collapse icon */
/* itemrect smaller */
- itemrect.xmin = titlerect.xmin + 3.0f / block->aspect;
+ itemrect.xmin = titlerect.xmin;
itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&titlerect);
itemrect.ymin = titlerect.ymin;
itemrect.ymax = titlerect.ymax;
@@ -1873,8 +1867,10 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
const int px_x_sign = is_left ? px : -px;
const int category_tabs_width = round_fl_to_int(UI_PANEL_CATEGORY_MARGIN_WIDTH * zoom);
const float dpi_fac = UI_DPI_FAC;
- const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom); /* padding of tabs around text */
- const int tab_v_pad = round_fl_to_int((4 + (2 * px * dpi_fac)) * zoom); /* padding between tabs */
+ /* padding of tabs around text */
+ const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom);
+ /* padding between tabs */
+ const int tab_v_pad = round_fl_to_int((4 + (2 * px * dpi_fac)) * zoom);
const float tab_curve_radius = ((px * 3) * dpi_fac) * zoom;
/* We flip the tab drawing, so always use these flags. */
const int roundboxtype = UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT;
@@ -2154,7 +2150,8 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, ARegion *ar, c
const bool backwards = event->shift;
pc_dyn = backwards ? pc_dyn->prev : pc_dyn->next;
if (!pc_dyn) {
- /* proper cyclic behavior, back to first/last category (only used for ctrl+tab) */
+ /* proper cyclic behavior,
+ * back to first/last category (only used for ctrl+tab) */
pc_dyn = backwards ? ar->panels_category.last : ar->panels_category.first;
}
}
@@ -2226,10 +2223,13 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
/* checks for mouse position inside */
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. */
+ }
+ /* XXX - accessed freed panels when scripts reload, need to fix. */
+ if (pa->type && pa->type->flag & PNL_NO_HEADER) {
continue;
+ }
mouse_state = ui_panel_mouse_state_get(block, pa, mx, my);
@@ -2314,7 +2314,7 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
ScrArea *sa = CTX_wm_area(C);
SpaceLink *sl = sa->spacedata.first;
- if (sa->spacetype != SPACE_BUTS) {
+ if (sa->spacetype != SPACE_PROPERTIES) {
if (!(pa->control & UI_PNL_SCALE)) {
if (event->type == PADPLUSKEY) sl->blockscale += 0.1;
else sl->blockscale -= 0.1;
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c
index d49a1a727aa..d4d5e3d3df6 100644
--- a/source/blender/editors/interface/interface_query.c
+++ b/source/blender/editors/interface/interface_query.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_query.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Utilities to inspect the interface, extract information.
*/
diff --git a/source/blender/editors/interface/interface_region_color_picker.c b/source/blender/editors/interface/interface_region_color_picker.c
index 8830fc6feef..f96210b46d4 100644
--- a/source/blender/editors/interface/interface_region_color_picker.c
+++ b/source/blender/editors/interface/interface_region_color_picker.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_color_picker.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Color Picker Region & Color Utils
*/
@@ -59,6 +53,12 @@
#include "interface_intern.h"
+enum ePickerType {
+ PICKER_TYPE_RGB = 0,
+ PICKER_TYPE_HSV = 1,
+ PICKER_TYPE_HEX = 2,
+};
+
/* -------------------------------------------------------------------- */
/** \name Color Conversion
* \{ */
@@ -175,7 +175,8 @@ static void ui_update_color_picker_buts_rgb(
}
ui_rgb_to_color_picker_compat_v(tmp, hsv);
- /* this updates button strings, is hackish... but button pointers are on stack of caller function */
+ /* this updates button strings,
+ * is hackish... but button pointers are on stack of caller function */
for (bt = block->buttons.first; bt; bt = bt->next) {
if (bt->custom_data != cpicker)
continue;
@@ -193,7 +194,8 @@ static void ui_update_color_picker_buts_rgb(
double intpart;
char col[16];
- /* Hex code is assumed to be in sRGB space (coming from other applications, web, etc) */
+ /* Hex code is assumed to be in sRGB space
+ * (coming from other applications, web, etc) */
copy_v3_v3(rgb_hex, rgb);
if (from_but && !ui_but_is_color_gamma(from_but)) {
IMB_colormanagement_scene_linear_to_srgb_v3(rgb_hex);
@@ -288,7 +290,7 @@ static void ui_colorpicker_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexc
IMB_colormanagement_srgb_to_scene_linear_v3(rgb);
}
- ui_update_color_picker_buts_rgb(NULL, but->block, cpicker, rgb);
+ ui_update_color_picker_buts_rgb(but, but->block, cpicker, rgb);
if (popup)
popup->menuretval = UI_RETURN_UPDATE;
@@ -299,30 +301,33 @@ static void ui_popup_close_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
uiBut *but = (uiBut *)bt1;
uiPopupBlockHandle *popup = but->block->handle;
- if (popup)
- popup->menuretval = UI_RETURN_OK;
+ if (popup) {
+ ColorPicker *cpicker = but->custom_data;
+ BLI_assert(cpicker->is_init);
+ popup->menuretval = (
+ equals_v3v3(cpicker->color_data, cpicker->color_data_init) ?
+ UI_RETURN_CANCEL : UI_RETURN_OK);
+ }
}
-static void ui_colorpicker_hide_reveal(uiBlock *block, short colormode)
+static void ui_colorpicker_hide_reveal(uiBlock *block, enum ePickerType colormode)
{
- uiBut *bt;
-
/* tag buttons */
- for (bt = block->buttons.first; bt; bt = bt->next) {
- if ((bt->func == ui_colorpicker_rna_cb) && bt->type == UI_BTYPE_NUM_SLIDER && bt->rnaindex != 3) {
+ for (uiBut *bt = block->buttons.first; bt; bt = bt->next) {
+ if ((bt->func == ui_colorpicker_rna_cb) &&
+ (bt->type == UI_BTYPE_NUM_SLIDER) &&
+ (bt->rnaindex != 3))
+ {
/* RGB sliders (color circle and alpha are always shown) */
- if (colormode == 0) bt->flag &= ~UI_HIDDEN;
- else bt->flag |= UI_HIDDEN;
+ SET_FLAG_FROM_TEST(bt->flag, (colormode != PICKER_TYPE_RGB), UI_HIDDEN);
}
else if (bt->func == ui_color_wheel_rna_cb) {
/* HSV sliders */
- if (colormode == 1) bt->flag &= ~UI_HIDDEN;
- else bt->flag |= UI_HIDDEN;
+ SET_FLAG_FROM_TEST(bt->flag, (colormode != PICKER_TYPE_HSV), UI_HIDDEN);
}
else if (bt->func == ui_colorpicker_hex_rna_cb || bt->type == UI_BTYPE_LABEL) {
- /* hex input or gamma correction status label */
- if (colormode == 2) bt->flag &= ~UI_HIDDEN;
- else bt->flag |= UI_HIDDEN;
+ /* HEX input or gamma correction status label */
+ SET_FLAG_FROM_TEST(bt->flag, (colormode != PICKER_TYPE_HEX), UI_HIDDEN);
}
}
}
@@ -393,7 +398,8 @@ static void ui_colorpicker_square(uiBlock *block, PointerRNA *ptr, PropertyRNA *
static void ui_block_colorpicker(
uiBlock *block, uiBut *from_but, float rgba[4], bool show_picker)
{
- static short colormode = 0; /* temp? 0=rgb, 1=hsv, 2=hex */
+ /* ePickerType */
+ static char colormode = 1;
uiBut *bt;
int width, butwidth;
static char hexcol[128];
@@ -418,6 +424,10 @@ static void ui_block_colorpicker(
copy_v3_v3(rgb_perceptual, rgba);
ui_scene_linear_to_color_picker_space(from_but, rgb_perceptual);
ui_rgb_to_color_picker_v(rgb_perceptual, hsv);
+ if (cpicker->is_init == false) {
+ copy_v3_v3(cpicker->color_data_init, cpicker->color_data);
+ cpicker->is_init = true;
+ }
/* when the softmax isn't defined in the RNA,
* using very large numbers causes sRGB/linear round trip to fail. */
@@ -447,26 +457,24 @@ static void ui_block_colorpicker(
/* mode */
yco = -1.5f * UI_UNIT_Y;
UI_block_align_begin(block);
- bt = uiDefButS(
+ bt = uiDefButC(
block, UI_BTYPE_ROW, 0, IFACE_("RGB"), 0, yco, width / 3, UI_UNIT_Y,
- &colormode, 0.0, 0.0, 0, 0, "");
+ &colormode, 0.0, (float)PICKER_TYPE_RGB, 0, 0, "");
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_colorpicker_create_mode_cb, bt, NULL);
bt->custom_data = cpicker;
- if (U.color_picker_type == USER_CP_CIRCLE_HSL) {
- bt = uiDefButS(
- block, UI_BTYPE_ROW, 0, IFACE_("HSL"), width / 3, yco, width / 3, UI_UNIT_Y,
- &colormode, 0.0, 1.0, 0, 0, "");
- }
- else {
- bt = uiDefButS(
- block, UI_BTYPE_ROW, 0, IFACE_("HSV"), width / 3, yco, width / 3, UI_UNIT_Y,
- &colormode, 0.0, 1.0, 0, 0, "");
- }
+ bt = uiDefButC(
+ block, UI_BTYPE_ROW, 0,
+ IFACE_((U.color_picker_type == USER_CP_CIRCLE_HSL) ? "HSL" : "HSV"),
+ width / 3, yco, width / 3, UI_UNIT_Y,
+ &colormode, 0.0, PICKER_TYPE_HSV, 0, 0, "");
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_colorpicker_create_mode_cb, bt, NULL);
bt->custom_data = cpicker;
- bt = uiDefButS(
+ bt = uiDefButC(
block, UI_BTYPE_ROW, 0, IFACE_("Hex"), 2 * width / 3, yco, width / 3, UI_UNIT_Y,
- &colormode, 0.0, 2.0, 0, 0, "");
+ &colormode, 0.0, PICKER_TYPE_HEX, 0, 0, "");
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_colorpicker_create_mode_cb, bt, NULL);
bt->custom_data = cpicker;
UI_block_align_end(block);
@@ -476,10 +484,14 @@ static void ui_block_colorpicker(
bt = uiDefIconButO(
block, UI_BTYPE_BUT, "UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER,
butwidth + 10, yco, UI_UNIT_X, UI_UNIT_Y, NULL);
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
+ UI_but_drawflag_disable(bt, UI_BUT_ICON_LEFT);
UI_but_func_set(bt, ui_popup_close_cb, bt, NULL);
bt->custom_data = cpicker;
}
+ /* Note: don't disable UI_BUT_UNDO for RGBA values, since these don't add undo steps. */
+
/* RGB values */
UI_block_align_begin(block);
bt = uiDefButR_prop(
@@ -507,11 +519,13 @@ static void ui_block_colorpicker(
bt = uiDefButF(
block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("H:"), 0, yco, butwidth,
UI_UNIT_Y, hsv, 0.0, 1.0, 10, 3, TIP_("Hue"));
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_color_wheel_rna_cb, bt, hsv);
bt->custom_data = cpicker;
bt = uiDefButF(
block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("S:"), 0, yco -= UI_UNIT_Y,
butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, TIP_("Saturation"));
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_color_wheel_rna_cb, bt, hsv);
bt->custom_data = cpicker;
if (U.color_picker_type == USER_CP_CIRCLE_HSL) {
@@ -524,6 +538,7 @@ static void ui_block_colorpicker(
block, UI_BTYPE_NUM_SLIDER, 0, IFACE_("V:"), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y,
hsv + 2, 0.0, softmax, 10, 3, TIP_("Value"));
}
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
bt->hardmax = hardmax; /* not common but rgb may be over 1.0 */
UI_but_func_set(bt, ui_color_wheel_rna_cb, bt, hsv);
@@ -559,6 +574,7 @@ static void ui_block_colorpicker(
bt = uiDefBut(
block, UI_BTYPE_TEXT, 0, IFACE_("Hex: "), 0, yco, butwidth, UI_UNIT_Y,
hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)"));
+ UI_but_flag_disable(bt, UI_BUT_UNDO);
UI_but_func_set(bt, ui_colorpicker_hex_rna_cb, bt, hexcol);
bt->custom_data = cpicker;
uiDefBut(
diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c
index c30958a4d3a..e874609f61e 100644
--- a/source/blender/editors/interface/interface_region_hud.c
+++ b/source/blender/editors/interface/interface_region_hud.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_hud.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Floating Persistent Region
*/
@@ -39,18 +33,15 @@
#include "BLI_rect.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
-#include "BLI_math_color.h"
#include "BKE_context.h"
#include "BKE_screen.h"
-#include "BKE_main.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
-#include "BIF_gl.h"
#include "UI_interface.h"
#include "UI_view2d.h"
@@ -213,7 +204,7 @@ static void hud_region_draw(const bContext *C, ARegion *ar)
GPU_clear(GPU_COLOR_BIT);
if ((ar->flag & RGN_FLAG_HIDDEN) == 0) {
- ui_draw_menu_back(NULL, NULL, &(rcti){.xmax = ar->winx, .ymax = ar->winy});
+ ui_draw_menu_back(NULL, NULL, &(rcti){ .xmax = ar->winx, .ymax = ar->winy, });
ED_region_panels_draw(C, ar);
}
}
@@ -337,7 +328,7 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa)
ED_region_tag_redraw(ar);
/* Reset zoom level (not well supported). */
- ar->v2d.cur = ar->v2d.tot = (rctf){.xmax = ar->winx, .ymax = ar->winy};
+ ar->v2d.cur = ar->v2d.tot = (rctf){ .xmax = ar->winx, .ymax = ar->winy, };
ar->v2d.minzoom = 1.0f;
ar->v2d.maxzoom = 1.0f;
@@ -352,7 +343,7 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa)
if (was_hidden) {
ar->winx = ar->v2d.winx;
ar->winy = ar->v2d.winy;
- ar->v2d.cur = ar->v2d.tot = (rctf){.xmax = ar->winx, .ymax = ar->winy};
+ ar->v2d.cur = ar->v2d.tot = (rctf){ .xmax = ar->winx, .ymax = ar->winy, };
}
CTX_wm_region_set((bContext *)C, ar_prev);
}
diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c
index 44effc8c097..2631f38d73d 100644
--- a/source/blender/editors/interface/interface_region_menu_pie.c
+++ b/source/blender/editors/interface/interface_region_menu_pie.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_menu_pie.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Pie Menu Region
*/
@@ -126,7 +120,8 @@ uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, co
pie->block_radial->puphash = ui_popup_menu_hash(title);
pie->block_radial->flag |= UI_BLOCK_RADIAL;
- /* if pie is spawned by a left click, release or click event, it is always assumed to be click style */
+ /* if pie is spawned by a left click, release or click event,
+ * it is always assumed to be click style */
if (event->type == LEFTMOUSE || ELEM(event->val, KM_RELEASE, KM_CLICK)) {
pie->block_radial->pie_data.flags |= UI_PIE_CLICK_STYLE;
pie->block_radial->pie_data.event = EVENT_NONE;
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c
index e136614d30e..73847d6fc71 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.c
+++ b/source/blender/editors/interface/interface_region_menu_popup.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_menu_popup.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* PopUp Menu Region
*/
@@ -199,19 +193,12 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
minwidth = UI_MENU_WIDTH_MIN;
}
- /* settings (typically rna-enum-popups) show above the button,
- * menu's like file-menu, show below */
if (pup->block->direction != 0) {
/* allow overriding the direction from menu_func */
direction = pup->block->direction;
}
- else if ((pup->but->type == UI_BTYPE_PULLDOWN) ||
- (UI_but_menutype_get(pup->but) != NULL))
- {
- direction = UI_DIR_DOWN;
- }
else {
- direction = UI_DIR_UP;
+ direction = UI_DIR_DOWN;
}
}
else {
@@ -393,7 +380,8 @@ uiPopupMenu *UI_popup_menu_begin_ex(bContext *C, const char *title, const char *
pup->layout = UI_block_layout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style);
/* note, this intentionally differs from the menu & submenu default because many operators
- * use popups like this to select one of their options - where having invoke doesn't make sense */
+ * use popups like this to select one of their options -
+ * where having invoke doesn't make sense */
uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
/* create in advance so we can let buttons point to retval already */
@@ -640,7 +628,8 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
UI_popup_handlers_remove(&win->modalhandlers, block->handle);
ui_popup_block_free(C, block->handle);
- /* In the case we have nested popups, closing one may need to redraw another, see: T48874 */
+ /* In the case we have nested popups,
+ * closing one may need to redraw another, see: T48874 */
for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
ED_region_tag_refresh_ui(ar);
}
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c
index cb4939adc56..4fd25c4c7e2 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_popover.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Pop-Over Region
*
@@ -82,7 +76,7 @@ struct uiPopover {
/* Needed for keymap removal. */
wmWindow *window;
wmKeyMap *keymap;
- struct wmEventHandler *keymap_handler;
+ struct wmEventHandler_Keymap *keymap_handler;
uiMenuCreateFunc menu_func;
void *menu_arg;
@@ -165,7 +159,8 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
if (!handle->refresh) {
float center[2] = {BLI_rctf_cent_x(&pup->but->rect), BLI_rctf_cent_y(&pup->but->rect)};
ui_block_to_window_fl(handle->ctx_region, pup->but->block, &center[0], &center[1]);
- /* These variables aren't used for popovers, we could add new variables if there is a conflict. */
+ /* These variables aren't used for popovers,
+ * we could add new variables if there is a conflict. */
handle->prev_mx = block->mx = (int)center[0];
handle->prev_my = block->my = (int)center[1];
}
@@ -353,7 +348,7 @@ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap)
UI_block_flag_enable(pup->block, UI_BLOCK_SHOW_SHORTCUT_ALWAYS);
pup->keymap = keymap;
pup->keymap_handler = WM_event_add_keymap_handler_priority(&window->modalhandlers, keymap, 0);
- WM_event_set_keymap_handler_callback(pup->keymap_handler, popover_keymap_fn, pup);
+ WM_event_set_keymap_handler_post_callback(pup->keymap_handler, popover_keymap_fn, pup);
}
handle = ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_POPOVER, pup);
diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c
index b62857983df..91020cea371 100644
--- a/source/blender/editors/interface/interface_region_popup.c
+++ b/source/blender/editors/interface/interface_region_popup.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_popup.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* PopUp Region (Generic)
*/
@@ -75,6 +69,10 @@ void ui_popup_translate(ARegion *ar, const int mdiff[2])
/* update blocks */
for (block = ar->uiblocks.first; block; block = block->next) {
+ uiPopupBlockHandle *handle = block->handle;
+ /* Make empty, will be initialized on next use, see T60608. */
+ BLI_rctf_init(&handle->prev_block_rect, 0, 0, 0, 0);
+
uiSafetyRct *saferct;
for (saferct = block->saferct.first; saferct; saferct = saferct->next) {
BLI_rctf_translate(&saferct->parent, UNPACK2(mdiff));
@@ -366,8 +364,8 @@ static void ui_block_region_popup_window_listener(
static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
{
uiBut *bt;
- float xofs = 0.0f;
- int width = UI_SCREEN_MARGIN;
+ const float xmin_orig = block->rect.xmin;
+ const int margin = UI_SCREEN_MARGIN;
int winx, winy;
if (block->flag & UI_BLOCK_NO_WIN_CLIP) {
@@ -377,30 +375,32 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
winx = WM_window_pixels_x(window);
winy = WM_window_pixels_y(window);
- /* shift menus to right if outside of view */
- if (block->rect.xmin < width) {
- xofs = (width - block->rect.xmin);
+ /* shift to left if outside of view */
+ if (block->rect.xmax > winx - margin) {
+ const float xofs = winx - margin - block->rect.xmax;
block->rect.xmin += xofs;
block->rect.xmax += xofs;
}
- /* or shift to left if outside of view */
- if (block->rect.xmax > winx - width) {
- xofs = winx - width - block->rect.xmax;
+ /* shift menus to right if outside of view */
+ if (block->rect.xmin < margin) {
+ const float xofs = (margin - block->rect.xmin);
block->rect.xmin += xofs;
block->rect.xmax += xofs;
}
- if (block->rect.ymin < width)
- block->rect.ymin = width;
- if (block->rect.ymax > winy - UI_POPUP_MENU_TOP)
+ if (block->rect.ymin < margin) {
+ block->rect.ymin = margin;
+ }
+ if (block->rect.ymax > winy - UI_POPUP_MENU_TOP) {
block->rect.ymax = winy - UI_POPUP_MENU_TOP;
+ }
/* ensure menu items draw inside left/right boundary */
+ const float xofs = block->rect.xmin - xmin_orig;
for (bt = block->buttons.first; bt; bt = bt->next) {
bt->rect.xmin += xofs;
bt->rect.xmax += xofs;
}
-
}
void ui_popup_block_scrolltest(uiBlock *block)
diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c
index d6e1fcdea24..65d5fdaba88 100644
--- a/source/blender/editors/interface/interface_region_search.c
+++ b/source/blender/editors/interface/interface_region_search.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_search.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Search Box Region & Interaction
*/
@@ -52,7 +46,6 @@
#include "RNA_access.h"
-#include "BIF_gl.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
@@ -90,10 +83,14 @@ typedef struct uiSearchboxData {
rcti bbox;
uiFontStyle fstyle;
uiSearchItems items;
- int active; /* index in items array */
- bool noback; /* when menu opened with enough space for this */
- bool preview; /* draw thumbnail previews, rather than list */
- bool use_sep; /* use the UI_SEP_CHAR char for splitting shortcuts (good for operators, bad for data) */
+ /** index in items array */
+ int active;
+ /** when menu opened with enough space for this */
+ bool noback;
+ /** draw thumbnail previews, rather than list */
+ bool preview;
+ /** use the UI_SEP_CHAR char for splitting shortcuts (good for operators, bad for data) */
+ bool use_sep;
int prv_rows, prv_cols;
} uiSearchboxData;
@@ -262,7 +259,8 @@ bool ui_searchbox_apply(uiBut *but, ARegion *ar)
return true;
}
else if (but->flag & UI_BUT_VALUE_CLEAR) {
- /* It is valid for _VALUE_CLEAR flavor to have no active element (it's a valid way to unlink). */
+ /* It is valid for _VALUE_CLEAR flavor to have no active element
+ * (it's a valid way to unlink). */
but->editstr[0] = '\0';
return true;
diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c
index e42d2e0cbac..0da96cc09c6 100644
--- a/source/blender/editors/interface/interface_region_tooltip.c
+++ b/source/blender/editors/interface/interface_region_tooltip.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_region_tooltip.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* ToolTip Region and Construction
*/
@@ -49,7 +43,6 @@
#include "BLI_math.h"
#include "BLI_string.h"
-#include "BLI_string_utf8.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
@@ -62,7 +55,6 @@
#include "RNA_access.h"
-#include "BIF_gl.h"
#include "UI_interface.h"
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 0decc937e19..8e3e99940a6 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_regions.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* General Interface Region Code
*
diff --git a/source/blender/editors/interface/interface_regions_intern.h b/source/blender/editors/interface/interface_regions_intern.h
index 7a0c4cd2111..0d24b310817 100644
--- a/source/blender/editors/interface/interface_regions_intern.h
+++ b/source/blender/editors/interface/interface_regions_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_regions_intern.h
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*
* Share between interface_region_*.c files.
*/
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 94bed87b40b..4aea1fad89f 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_style.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -45,8 +39,6 @@
#include "BKE_global.h"
-#include "BIF_gl.h"
-
#include "BLF_api.h"
#ifdef WITH_INTERNATIONAL
# include "BLT_translation.h"
@@ -520,7 +512,8 @@ void uiStyleInit(void)
}
#endif
- /* XXX, this should be moved into a style, but for now best only load the monospaced font once. */
+ /* XXX, this should be moved into a style,
+ * but for now best only load the monospaced font once. */
BLI_assert(blf_mono_font == -1);
if (U.font_path_ui_mono[0]) {
blf_mono_font = BLF_load_unique(U.font_path_ui_mono);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index d7e3dbf6e32..987a2e56948 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation 2009.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_templates.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -129,8 +123,12 @@ static void template_add_button_search_menu(
ARegion *region = CTX_wm_region(C);
ScrArea *area = CTX_wm_area(C);
/* XXX ugly top-bar exception */
- const bool use_big_size = (region->regiontype != RGN_TYPE_HEADER) && (area->spacetype != SPACE_TOPBAR); /* silly check, could be more generic */
- /* Ugly exception for screens here, drawing their preview in icon size looks ugly/useless */
+ const bool use_big_size = (
+ /* silly check, could be more generic */
+ (region->regiontype != RGN_TYPE_HEADER) &&
+ (area->spacetype != SPACE_TOPBAR));
+ /* Ugly exception for screens here,
+ * drawing their preview in icon size looks ugly/useless */
const bool use_preview_icon = use_big_size || (id && (GS(id->name) != ID_SCR));
const short width = UI_UNIT_X * (use_big_size ? 6 : 1.6f);
const short height = UI_UNIT_Y * (use_big_size ? 6 : 1);
@@ -297,8 +295,8 @@ static bool id_search_add(
}
if (*str == '\0' || BLI_strcasestr(id->name + 2, str)) {
- /* +1 is needed because BKE_id_ui_prefix uses 3 letter prefix
- * followed by ID_NAME-2 characters from id->name.
+ /* +1 is needed because BKE_id_ui_prefix used 3 letter prefix
+ * followed by ID_NAME-2 characters from id->name
*/
char name_ui[MAX_ID_FULL_NAME];
BKE_id_full_name_ui_prefix_get(name_ui, id);
@@ -600,7 +598,7 @@ static uiBut *template_id_def_new_but(
BLT_I18NCONTEXT_ID_TEXTURE,
BLT_I18NCONTEXT_ID_IMAGE,
BLT_I18NCONTEXT_ID_LATTICE,
- BLT_I18NCONTEXT_ID_LAMP,
+ BLT_I18NCONTEXT_ID_LIGHT,
BLT_I18NCONTEXT_ID_CAMERA,
BLT_I18NCONTEXT_ID_WORLD,
BLT_I18NCONTEXT_ID_SCREEN,
@@ -735,8 +733,7 @@ static void template_ID(
but->flag |= UI_BUT_UNDO;
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_ALONE));
- if (/* test only */
- (id_copy(CTX_data_main(C), id, NULL, true) == false) ||
+ if ((!BKE_id_copy_is_allowed(id)) ||
(idfrom && idfrom->lib) ||
(!editable) ||
/* object in editmode - don't change data */
@@ -802,7 +799,7 @@ static void template_ID(
but = NULL;
if (unlinkop) {
- but = uiDefIconButO(block, UI_BTYPE_BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
+ but = uiDefIconButO(block, UI_BTYPE_BUT, unlinkop, WM_OP_INVOKE_DEFAULT, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
/* so we can access the template from operators, font unlinking needs this */
UI_but_funcN_set(but, NULL, MEM_dupallocN(template_ui), NULL);
}
@@ -1048,7 +1045,9 @@ void uiTemplateAnyID(
}
/* Start drawing UI Elements using standard defines */
- split = uiLayoutSplit(layout, 0.33f, false); /* NOTE: split amount here needs to be synced with normal labels */
+
+ /* NOTE: split amount here needs to be synced with normal labels */
+ split = uiLayoutSplit(layout, 0.33f, false);
/* FIRST PART ................................................ */
row = uiLayoutRow(split, false);
@@ -1066,14 +1065,20 @@ void uiTemplateAnyID(
row = uiLayoutRow(split, true);
/* ID-Type Selector - just have a menu of icons */
- sub = uiLayoutRow(row, true); /* HACK: special group just for the enum, otherwise we */
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */
+
+ /* HACK: special group just for the enum,
+ * otherwise we get ugly layout with text included too... */
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
/* ID-Block Selector - just use pointer widget... */
- sub = uiLayoutRow(row, true); /* HACK: special group to counteract the effects of the previous */
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */
+
+ /* HACK: special group to counteract the effects of the previous enum,
+ * which now pushes everything too far right. */
+ sub = uiLayoutRow(row, true);
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND);
uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE);
}
@@ -1312,12 +1317,13 @@ void uiTemplatePathBuilder(
/* Path (existing string) Widget */
uiItemR(row, ptr, propname, 0, text, ICON_RNA);
- /* TODO: attach something to this to make allow searching of nested properties to 'build' the path */
+ /* TODO: attach something to this to make allow
+ * searching of nested properties to 'build' the path */
}
/************************ Modifier Template *************************/
-#define ERROR_LIBDATA_MESSAGE IFACE_("Can't edit external libdata")
+#define ERROR_LIBDATA_MESSAGE IFACE_("Can't edit external library data")
static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
{
@@ -1350,7 +1356,8 @@ static int modifier_can_delete(ModifierData *md)
return 1;
}
-/* Check whether Modifier is a simulation or not, this is used for switching to the physics/particles context tab */
+/* Check whether Modifier is a simulation or not,
+ * this is used for switching to the physics/particles context tab */
static int modifier_is_simulation(ModifierData *md)
{
/* Physic Tab */
@@ -1477,7 +1484,8 @@ static uiLayout *draw_modifier(
UI_block_align_end(block);
UI_block_emboss_set(block, UI_EMBOSS_NONE);
- /* When Modifier is a simulation, show button to switch to context rather than the delete button. */
+ /* When Modifier is a simulation,
+ * show button to switch to context rather than the delete button. */
if (modifier_can_delete(md) &&
!modifier_is_simulation(md))
{
@@ -1542,7 +1550,8 @@ static uiLayout *draw_modifier(
}
}
- /* result is the layout block inside the box, that we return so that modifier settings can be drawn */
+ /* result is the layout block inside the box,
+ * that we return so that modifier settings can be drawn */
result = uiLayoutColumn(box, false);
block = uiLayoutAbsoluteBlock(box);
}
@@ -1679,7 +1688,8 @@ static uiLayout *gpencil_draw_modifier(
uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), ICON_NONE,
"OBJECT_OT_gpencil_modifier_copy");
- /* result is the layout block inside the box, that we return so that modifier settings can be drawn */
+ /* result is the layout block inside the box,
+ * that we return so that modifier settings can be drawn */
result = uiLayoutColumn(box, false);
block = uiLayoutAbsoluteBlock(box);
}
@@ -1797,7 +1807,8 @@ static uiLayout *gpencil_draw_shaderfx(
/* only here obdata, the rest of effect is ob level */
UI_block_lock_set(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- /* result is the layout block inside the box, that we return so that effect settings can be drawn */
+ /* result is the layout block inside the box,
+ * that we return so that effect settings can be drawn */
result = uiLayoutColumn(box, false);
block = uiLayoutAbsoluteBlock(box);
}
@@ -2022,7 +2033,8 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
if (proxy_protected) {
UI_block_emboss_set(block, UI_EMBOSS_NONE);
- /* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */
+ /* draw a ghost icon (for proxy) and also a lock beside it,
+ * to show that constraint is "proxy locked" */
uiDefIconBut(block, UI_BTYPE_BUT, B_CONSTRAINT_TEST, ICON_GHOST_ENABLED, xco + 12.2f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
uiDefIconBut(block, UI_BTYPE_BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 13.1f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y,
@@ -2132,7 +2144,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
/************************* Preview Template ***************************/
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_world_types.h"
@@ -2180,7 +2192,7 @@ void uiTemplatePreview(
else if (parent && (GS(parent->name) == ID_WO))
pr_texture = &((World *)parent)->pr_texture;
else if (parent && (GS(parent->name) == ID_LA))
- pr_texture = &((Lamp *)parent)->pr_texture;
+ pr_texture = &((Light *)parent)->pr_texture;
else if (parent && (GS(parent->name) == ID_LS))
pr_texture = &((FreestyleLineStyle *)parent)->pr_texture;
@@ -2257,7 +2269,8 @@ void uiTemplatePreview(
pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
}
else if (GS(parent->name) == ID_LA) {
- uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Light"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+ uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, CTX_IFACE_(BLT_I18NCONTEXT_ID_LIGHT, "Light"),
+ 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
}
else if (GS(parent->name) == ID_WO) {
@@ -3057,7 +3070,8 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
rna_update_cb(C, cb_v, NULL);
}
-/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */
+/* still unsure how this call evolves...
+ * we use labeltype for defining what curve-channels to show */
static void curvemap_buttons_layout(
uiLayout *layout, PointerRNA *ptr, char labeltype, bool levels,
bool brush, bool neg_slope, bool tone, RNAUpdateCb *cb)
@@ -3444,10 +3458,14 @@ void uiTemplateCryptoPicker(uiLayout *layout, PointerRNA *ptr, const char *propn
block = uiLayoutGetBlock(layout);
- but = uiDefIconTextButO(block, UI_BTYPE_BUT, "UI_OT_eyedropper_color_crypto", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, RNA_property_ui_name(prop), 0, 0, UI_UNIT_X, UI_UNIT_Y, RNA_property_ui_description(prop));
+ but = uiDefIconTextButO(block, UI_BTYPE_BUT, "UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, RNA_property_ui_name(prop), 0, 0, UI_UNIT_X, UI_UNIT_Y, RNA_property_ui_description(prop));
but->rnapoin = *ptr;
but->rnaprop = prop;
but->rnaindex = -1;
+
+ PointerRNA *opptr = UI_but_operator_ptr_get(but);
+ /* Important for crypto-matte operation. */
+ RNA_boolean_set(opptr, "use_accumulate", false);
}
/********************* Layer Buttons Template ************************/
@@ -3573,7 +3591,7 @@ static void uilist_draw_item_default(
}
}
-static void uilist_draw_filter_default(struct uiList *ui_list, struct bContext *UNUSED(C), struct uiLayout *layout, bool reverse)
+static void uilist_draw_filter_default(struct uiList *ui_list, struct bContext *UNUSED(C), struct uiLayout *layout)
{
PointerRNA listptr;
uiLayout *row, *subrow;
@@ -3587,8 +3605,7 @@ static void uilist_draw_filter_default(struct uiList *ui_list, struct bContext *
uiItemR(subrow, &listptr, "use_filter_invert", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "",
(ui_list->filter_flag & UILST_FLT_EXCLUDE) ? ICON_ZOOM_OUT : ICON_ZOOM_IN);
- /* a reverse list, cannot sort or invert order in filter */
- if (!reverse) {
+ if ((ui_list->filter_sort_flag & UILST_FLT_SORT_LOCK) == 0) {
subrow = uiLayoutRow(row, true);
uiItemR(subrow, &listptr, "use_filter_sort_alpha", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
uiItemR(subrow, &listptr, "use_filter_sort_reverse", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "",
@@ -3617,7 +3634,7 @@ static void uilist_filter_items_default(
const char *filter_raw = ui_list->filter_byname;
char *filter = (char *)filter_raw, filter_buff[32], *filter_dyn = NULL;
const bool filter_exclude = (ui_list->filter_flag & UILST_FLT_EXCLUDE) != 0;
- const bool order_by_name = (ui_list->filter_sort_flag & UILST_FLT_SORT_ALPHA) != 0;
+ const bool order_by_name = (ui_list->filter_sort_flag & UILST_FLT_SORT_MASK) == UILST_FLT_SORT_ALPHA;
int len = RNA_property_collection_length(dataptr, prop);
dyn_data->items_shown = dyn_data->items_len = len;
@@ -3757,7 +3774,8 @@ static void uilist_prepare(
rows = min_ii(dyn_data->height, maxrows);
}
- /* If list length changes or list is tagged to check this, and active is out of view, scroll to it .*/
+ /* If list length changes or list is tagged to check this,
+ * and active is out of view, scroll to it .*/
if (ui_list->list_last_len != len || ui_list->flag & UILST_SCROLL_TO_ACTIVE_ITEM) {
if (activei_row < ui_list->list_scroll) {
ui_list->list_scroll = activei_row;
@@ -3816,7 +3834,8 @@ static char *uilist_item_tooltip_func(bContext *UNUSED(C), void *argN, const cha
void uiTemplateList(
uiLayout *layout, bContext *C, const char *listtype_name, const char *list_id,
PointerRNA *dataptr, const char *propname, PointerRNA *active_dataptr, const char *active_propname,
- const char *item_dyntip_propname, int rows, int maxrows, int layout_type, int columns, bool reverse)
+ const char *item_dyntip_propname, int rows, int maxrows, int layout_type, int columns,
+ bool sort_reverse, bool sort_lock)
{
uiListType *ui_list_type;
uiList *ui_list = NULL;
@@ -3921,6 +3940,12 @@ void uiTemplateList(
BLI_strncpy(ui_list->list_id, ui_list_id, sizeof(ui_list->list_id));
BLI_addtail(&ar->ui_lists, ui_list);
ui_list->list_grip = -UI_LIST_AUTO_SIZE_THRESHOLD; /* Force auto size by default. */
+ if (sort_reverse) {
+ ui_list->filter_sort_flag |= UILST_FLT_SORT_REVERSE;
+ }
+ if (sort_lock) {
+ ui_list->filter_sort_flag |= UILST_FLT_SORT_LOCK;
+ }
}
if (!ui_list->dyn_data) {
@@ -3937,19 +3962,6 @@ void uiTemplateList(
MEM_SAFE_FREE(dyn_data->items_filter_neworder);
dyn_data->items_len = dyn_data->items_shown = -1;
- /* if reverse, enable reverse and forced flag */
- if (reverse) {
- ui_list->filter_sort_flag |= UILST_FLT_SORT_REVERSE;
- ui_list->filter_sort_flag |= UILST_FLT_FORCED_REVERSE;
- }
- else {
- /* if it was forced, disable forced flag to restore all normal behavior */
- if (ui_list->filter_sort_flag & UILST_FLT_FORCED_REVERSE) {
- ui_list->filter_sort_flag &= ~UILST_FLT_SORT_REVERSE;
- ui_list->filter_sort_flag &= ~UILST_FLT_FORCED_REVERSE;
- }
- }
-
/* When active item changed since last draw, scroll to it. */
if (activei != ui_list->list_last_activei) {
ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM;
@@ -4227,7 +4239,7 @@ void uiTemplateList(
subblock = uiLayoutGetBlock(col);
uiDefBut(subblock, UI_BTYPE_SEPR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y * 0.05f, NULL, 0.0, 0.0, 0, 0, "");
- draw_filter(ui_list, C, col, reverse);
+ draw_filter(ui_list, C, col);
}
else {
but = uiDefIconButBitI(subblock, UI_BTYPE_TOGGLE, UILST_FLT_SHOW, 0, ICON_DISCLOSURE_TRI_RIGHT, 0, 0,
@@ -4404,7 +4416,8 @@ eAutoPropButsReturn uiTemplateOperatorPropertyButs(
/* menu */
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! */
+ /* XXX, no simple way to get WM_MT_operator_presets.bl_label
+ * from python! Label remains the same always! */
PointerRNA op_ptr;
uiLayout *row;
@@ -4433,7 +4446,7 @@ eAutoPropButsReturn uiTemplateOperatorPropertyButs(
else {
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
- struct uiTemplateOperatorPropertyPollParam user_data = {.C = C, .op = op, .flag = flag};
+ struct uiTemplateOperatorPropertyPollParam user_data = { .C = C, .op = op, .flag = flag, };
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
@@ -4601,7 +4614,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
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) {
+ for (scene = CTX_data_main(C)->scenes.first; scene; scene = scene->id.next) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
handle_event = B_STOPRENDER;
icon = ICON_SCENE;
@@ -4875,7 +4888,8 @@ void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
if (but->rnaprop) {
UI_but_func_set(but, keymap_item_modified, ptr->data, NULL);
- /* Otherwise the keymap will be re-generated which we're trying to edit, see: T47685 */
+ /* Otherwise the keymap will be re-generated which we're trying to edit,
+ * see: T47685 */
UI_but_flag_enable(but, UI_BUT_UPDATE_DELAY);
}
}
@@ -5036,7 +5050,7 @@ void uiTemplateCacheFile(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
return;
}
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
uiLayout *row = uiLayoutRow(layout, false);
uiBlock *block = uiLayoutGetBlock(row);
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index a7787d14776..7400e922b30 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_utils.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -43,7 +37,6 @@
#include "BLT_translation.h"
-#include "BKE_library.h"
#include "BKE_report.h"
#include "MEM_guardedalloc.h"
@@ -271,28 +264,22 @@ void ui_rna_collection_search_cb(const struct bContext *C, void *arg, const char
continue;
}
+ name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */
iconid = 0;
if (itemptr.type && RNA_struct_is_ID(itemptr.type)) {
- name = MEM_malloc_arrayN(MAX_ID_FULL_NAME, sizeof(*name), __func__);
- BKE_id_full_name_ui_prefix_get(name, itemptr.data);
iconid = ui_id_icon_get(C, itemptr.data, false);
}
- else {
- name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */
- }
if (name) {
if (skip_filter || BLI_strcasestr(name, str)) {
cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
cis->data = itemptr.data;
- cis->name = name; /* Still ownership of that memory. */
+ cis->name = MEM_dupallocN(name);
cis->index = i;
cis->iconid = iconid;
BLI_addtail(items_list, cis);
}
- else {
- MEM_freeN(name);
- }
+ MEM_freeN(name);
}
i++;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index fcb995d089c..7e43ac8c850 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/interface_widgets.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <limits.h>
@@ -159,7 +153,7 @@ typedef struct uiWidgetType {
static const float cornervec[WIDGET_CURVE_RESOLU][2] = {
{0.0, 0.0}, {0.195, 0.02}, {0.383, 0.067},
{0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45},
- {0.924, 0.617}, {0.98, 0.805}, {1.0, 1.0}
+ {0.924, 0.617}, {0.98, 0.805}, {1.0, 1.0},
};
@@ -167,7 +161,7 @@ const float ui_pixel_jitter[UI_PIXEL_AA_JITTER][2] = {
{ 0.468813, -0.481430}, {-0.155755, -0.352820},
{ 0.219306, -0.238501}, {-0.393286, -0.110949},
{-0.024699, 0.013908}, { 0.343805, 0.147431},
- {-0.272855, 0.269918}, { 0.095909, 0.388710}
+ {-0.272855, 0.269918}, { 0.095909, 0.388710},
};
#define WIDGET_AA_JITTER UI_PIXEL_AA_JITTER
#define jit ui_pixel_jitter
@@ -177,36 +171,36 @@ const float ui_pixel_jitter[UI_PIXEL_AA_JITTER][2] = {
* \{ */
static const float g_shape_preset_number_arrow_vert[3][2] = {
- {-0.352077, 0.532607}, {-0.352077, -0.549313}, {0.330000, -0.008353}
+ {-0.352077, 0.532607}, {-0.352077, -0.549313}, {0.330000, -0.008353},
};
static const uint g_shape_preset_number_arrow_face[1][3] = {
- {0, 1, 2}
+ {0, 1, 2},
};
static const float g_shape_preset_scroll_circle_vert[16][2] = {
{0.382684, 0.923879}, {0.000001, 1.000000}, {-0.382683, 0.923880}, {-0.707107, 0.707107},
{-0.923879, 0.382684}, {-1.000000, 0.000000}, {-0.923880, -0.382684}, {-0.707107, -0.707107},
{-0.382683, -0.923880}, {0.000000, -1.000000}, {0.382684, -0.923880}, {0.707107, -0.707107},
- {0.923880, -0.382684}, {1.000000, -0.000000}, {0.923880, 0.382683}, {0.707107, 0.707107}
+ {0.923880, -0.382684}, {1.000000, -0.000000}, {0.923880, 0.382683}, {0.707107, 0.707107},
};
static const uint g_shape_preset_scroll_circle_face[14][3] = {
{0, 1, 2}, {2, 0, 3}, {3, 0, 15}, {3, 15, 4}, {4, 15, 14}, {4, 14, 5}, {5, 14, 13}, {5, 13, 6},
- {6, 13, 12}, {6, 12, 7}, {7, 12, 11}, {7, 11, 8}, {8, 11, 10}, {8, 10, 9}
+ {6, 13, 12}, {6, 12, 7}, {7, 12, 11}, {7, 11, 8}, {8, 11, 10}, {8, 10, 9},
};
static const float g_shape_preset_menu_arrow_vert[6][2] = {
{-0.33, 0.16}, {0.33, 0.16}, {0, 0.82},
- {0, -0.82}, {-0.33, -0.16}, {0.33, -0.16}
+ {0, -0.82}, {-0.33, -0.16}, {0.33, -0.16},
};
static const uint g_shape_preset_menu_arrow_face[2][3] = {{2, 0, 1}, {3, 5, 4}};
static const float g_shape_preset_checkmark_vert[6][2] = {
{-0.578579, 0.253369}, {-0.392773, 0.412794}, {-0.004241, -0.328551},
- {-0.003001, 0.034320}, {1.055313, 0.864744}, {0.866408, 1.026895}
+ {-0.003001, 0.034320}, {1.055313, 0.864744}, {0.866408, 1.026895},
};
static const uint g_shape_preset_checkmark_face[4][3] = {
- {3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3}
+ {3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3},
};
#define OY (-0.2 / 2)
@@ -368,7 +362,8 @@ GPUBatch *ui_batch_roundbox_widget_get(int tria)
set_roundbox_vertex_data(&vflag_step, last_data);
set_roundbox_vertex(&vflag_step, 0, 0, 0, false, false, EMBOSS);
/* Emboss */
- bool rev = false; /* go back and forth : avoid degenerate triangle (but beware of backface cull) */
+ /* go back and forth : avoid degenerate triangle (but beware of backface cull) */
+ bool rev = false;
for (int j = 0; j < WIDGET_AA_JITTER; j++, rev = !rev) {
for (int c = (rev) ? 1 : 0; (rev) ? c >= 0 : c < 2; (rev) ? c-- : c++) {
int sta = (rev) ? WIDGET_CURVE_RESOLU - 1 : 0;
@@ -685,7 +680,8 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, const rcti *re
float maxxi = maxx - U.pixelsize;
float minyi = miny + U.pixelsize;
float maxyi = maxy - U.pixelsize;
- float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f; /* for uv, can divide by zero */
+ /* for uv, can divide by zero */
+ float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f;
float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f;
int a, tot = 0, minsize;
const int hnum = (
@@ -1448,7 +1444,8 @@ float UI_text_clip_middle_ex(
float strwidth;
/* Add some epsilon to OK width, avoids 'ellipsing' text that nearly fits!
- * Better to have a small piece of the last char cut out, than two remaining chars replaced by an ellipsis... */
+ * Better to have a small piece of the last char cut out,
+ * than two remaining chars replaced by an ellipsis... */
okwidth += 1.0f + UI_DPI_FAC;
BLI_assert(str[0]);
@@ -1463,7 +1460,8 @@ float UI_text_clip_middle_ex(
strwidth = BLF_width(fstyle->uifont_id, str, max_len);
if ((okwidth > 0.0f) && (strwidth > okwidth)) {
- /* utf8 two-dots leader '..' (shorter than ellipsis '...'), some compilers complain with real litteral string. */
+ /* utf8 two-dots leader '..' (shorter than ellipsis '...'),
+ * some compilers complain with real litteral string. */
const char sep[] = {0xe2, 0x80, 0xA5, 0x0};
const int sep_len = sizeof(sep) - 1;
const float sep_strwidth = BLF_width(fstyle->uifont_id, sep, sep_len + 1);
@@ -1527,7 +1525,8 @@ float UI_text_clip_middle_ex(
else {
memmove(str + l_end + sep_len, str + r_offset, r_len);
memcpy(str + l_end, sep, sep_len);
- final_lpart_len = (size_t)(l_end + sep_len + r_len - 1); /* -1 to remove trailing '\0'! */
+ /* -1 to remove trailing '\0'! */
+ final_lpart_len = (size_t)(l_end + sep_len + r_len - 1);
while (BLF_width(fstyle->uifont_id, str, max_len) > okwidth) {
/* This will happen because a lot of string width processing is done in integer pixels,
@@ -1690,7 +1689,8 @@ static void ui_text_clip_right_label(const uiFontStyle *fstyle, uiBut *but, cons
const char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, cp2);
int bytes = cp2 - prev_utf8;
- /* shift the text after and including cp2 back by 1 char, +1 to include null terminator */
+ /* shift the text after and including cp2 back by 1 char,
+ * +1 to include null terminator */
memmove(cp2 - bytes, cp2, drawstr_len + 1);
cp2 -= bytes;
@@ -2323,7 +2323,8 @@ static void widget_state(uiWidgetType *wt, int state, int drawflag)
static void widget_state_numslider(uiWidgetType *wt, int state, int drawflag)
{
uiWidgetStateColors *wcol_state = wt->wcol_state;
- float blend = wcol_state->blend - 0.2f; /* XXX special tweak to make sure that bar will still be visible */
+ /* XXX special tweak to make sure that bar will still be visible */
+ float blend = wcol_state->blend - 0.2f;
/* call this for option button */
widget_state(wt, state, drawflag);
@@ -2756,7 +2757,9 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
immBegin(GPU_PRIM_TRIS, steps * 3 * 6);
- for (dx = 0.0f; dx < 0.999f; dx += color_step) { /* 0.999 = prevent float inaccuracy for steps */
+
+ /* 0.999 = prevent float inaccuracy for steps */
+ for (dx = 0.0f; dx < 0.999f; dx += color_step) {
const float dx_next = dx + color_step;
/* previous color */
@@ -2981,7 +2984,7 @@ static void ui_draw_separator(const rcti *rect, const uiWidgetColors *wcol)
wcol->text[0],
wcol->text[1],
wcol->text[2],
- 30
+ 30,
};
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -3366,7 +3369,8 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
wtb.draw_inner = false;
widgetbase_draw(&wtb, wcol);
- /* Add space at either side of the button so text aligns with numbuttons (which have arrow icons). */
+ /* Add space at either side of the button so text aligns with numbuttons
+ * (which have arrow icons). */
if (!(state & UI_STATE_TEXT_INPUT)) {
rect->xmax -= toffs;
rect->xmin += toffs;
@@ -3763,7 +3767,8 @@ static void widget_tab(uiWidgetColors *wcol, rcti *rect, int state, int roundbox
const float rad = wcol->roundness * U.widget_unit;
const bool is_active = (state & UI_SELECT);
-/* Draw shaded outline - Disabled for now, seems incorrect and also looks nicer without it imho ;) */
+/* Draw shaded outline - Disabled for now,
+ * seems incorrect and also looks nicer without it imho ;) */
//#define USE_TAB_SHADED_HIGHLIGHT
uiWidgetBase wtb;
@@ -4252,7 +4257,8 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
break;
case UI_BTYPE_HSVCUBE:
- if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) { /* vertical V slider, uses new widget draw now */
+ if (ELEM(but->a1, UI_GRAD_V_ALT, UI_GRAD_L_ALT)) {
+ /* vertical V slider, uses new widget draw now */
ui_draw_but_HSV_v(but, rect);
}
else { /* other HSV pickers... */
@@ -4745,7 +4751,8 @@ void ui_draw_menu_item(const uiFontStyle *fstyle, rcti *rect, const char *name,
aspect = ICON_DEFAULT_HEIGHT / height;
GPU_blend(true);
- UI_icon_draw_aspect(xs, ys, iconid, aspect, 1.0f, wt->wcol.text); /* XXX scale weak get from fstyle? */
+ /* XXX scale weak get from fstyle? */
+ UI_icon_draw_aspect(xs, ys, iconid, aspect, 1.0f, wt->wcol.text);
GPU_blend(false);
}
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index d7451b0d0e4..48b24da8f5c 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/resources.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <math.h>
@@ -117,59 +109,59 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
else {
switch (spacetype) {
- case SPACE_BUTS:
- ts = &btheme->tbuts;
+ case SPACE_PROPERTIES:
+ ts = &btheme->space_properties;
break;
case SPACE_VIEW3D:
- ts = &btheme->tv3d;
+ ts = &btheme->space_view3d;
break;
- case SPACE_IPO:
- ts = &btheme->tipo;
+ case SPACE_GRAPH:
+ ts = &btheme->space_graph;
break;
case SPACE_FILE:
- ts = &btheme->tfile;
+ ts = &btheme->space_file;
break;
case SPACE_NLA:
- ts = &btheme->tnla;
+ ts = &btheme->space_nla;
break;
case SPACE_ACTION:
- ts = &btheme->tact;
+ ts = &btheme->space_action;
break;
case SPACE_SEQ:
- ts = &btheme->tseq;
+ ts = &btheme->space_sequencer;
break;
case SPACE_IMAGE:
- ts = &btheme->tima;
+ ts = &btheme->space_image;
break;
case SPACE_TEXT:
- ts = &btheme->text;
+ ts = &btheme->space_text;
break;
case SPACE_OUTLINER:
- ts = &btheme->toops;
+ ts = &btheme->space_outliner;
break;
case SPACE_INFO:
- ts = &btheme->tinfo;
+ ts = &btheme->space_info;
break;
case SPACE_USERPREF:
- ts = &btheme->tuserpref;
+ ts = &btheme->space_preferences;
break;
case SPACE_CONSOLE:
- ts = &btheme->tconsole;
+ ts = &btheme->space_console;
break;
case SPACE_NODE:
- ts = &btheme->tnode;
+ ts = &btheme->space_node;
break;
case SPACE_CLIP:
- ts = &btheme->tclip;
+ ts = &btheme->space_clip;
break;
case SPACE_TOPBAR:
- ts = &btheme->ttopbar;
+ ts = &btheme->space_topbar;
break;
case SPACE_STATUSBAR:
- ts = &btheme->tstatusbar;
+ ts = &btheme->space_statusbar;
break;
default:
- ts = &btheme->tv3d;
+ ts = &btheme->space_view3d;
break;
}
@@ -194,15 +186,13 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
}
cp = back;
break;
- case TH_LOW_GRAD:
- cp = ts->gradients.gradient;
- break;
- case TH_HIGH_GRAD:
- cp = ts->gradients.high_gradient;
+ case TH_BACK_GRAD:
+ cp = ts->back_grad;
break;
+
case TH_SHOW_BACK_GRAD:
cp = &setting;
- setting = ts->gradients.show_grad;
+ setting = ts->show_back_grad;
break;
case TH_TEXT:
if (theme_regionid == RGN_TYPE_WINDOW)
@@ -238,7 +228,8 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_HEADER:
cp = ts->header; break;
case TH_HEADERDESEL:
- /* we calculate a dynamic builtin header deselect color, also for pulldowns... */
+ /* we calculate a dynamic builtin header deselect color,
+ * also for pulldowns... */
cp = ts->header;
headerdesel[0] = cp[0] > 10 ? cp[0] - 10 : 0;
headerdesel[1] = cp[1] > 10 ? cp[1] - 10 : 0;
@@ -291,7 +282,7 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
cp = ts->syntaxr; break;
case TH_WIRE_EDIT:
cp = ts->wire_edit; break;
- case TH_LAMP:
+ case TH_LIGHT:
cp = ts->lamp; break;
case TH_SPEAKER:
cp = ts->speaker; break;
@@ -753,9 +744,8 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
* \note: when you add new colors, created & saved themes need initialized
* use function below, init_userdef_do_versions()
*/
-void ui_theme_init_default(void)
+void UI_theme_init_default(void)
{
-
/* we search for the theme with name Default */
bTheme *btheme = BLI_findstring(&U.themes, "Default", offsetof(bTheme, name));
if (btheme == NULL) {
@@ -770,7 +760,7 @@ void ui_theme_init_default(void)
btheme->active_theme_area = active_theme_area;
}
-void ui_style_init_default(void)
+void UI_style_init_default(void)
{
BLI_freelistN(&U.uistyles);
/* gets automatically re-allocated */
@@ -789,7 +779,7 @@ void UI_SetTheme(int spacetype, int regionid)
else if (regionid) {
/* popups */
theme_active = U.themes.first;
- theme_spacetype = SPACE_BUTS;
+ theme_spacetype = SPACE_PROPERTIES;
theme_regionid = regionid;
}
else {
@@ -864,6 +854,20 @@ void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[
r_col[2] = ((1.0f - fac) * cp1[2] + fac * cp2[2]) / 255.0f;
}
+void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4])
+{
+ const uchar *cp1, *cp2;
+
+ cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+ cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
+
+ CLAMP(fac, 0.0f, 1.0f);
+ r_col[0] = ((1.0f - fac) * cp1[0] + fac * cp2[0]) / 255.0f;
+ r_col[1] = ((1.0f - fac) * cp1[1] + fac * cp2[1]) / 255.0f;
+ r_col[2] = ((1.0f - fac) * cp1[2] + fac * cp2[2]) / 255.0f;
+ r_col[3] = ((1.0f - fac) * cp1[3] + fac * cp2[3]) / 255.0f;
+}
+
void UI_FontThemeColor(int fontid, int colorid)
{
uchar color[4];
@@ -929,6 +933,17 @@ void UI_GetThemeColor4fv(int colorid, float col[4])
col[3] = ((float)cp[3]) / 255.0f;
}
+void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4])
+{
+ const unsigned char *cp;
+
+ cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
+ col[0] = ((float)cp[0]) / 255.0f;
+ col[1] = ((float)cp[1]) / 255.0f;
+ col[2] = ((float)cp[2]) / 255.0f;
+ col[3] = ((float)cp[3]) / 255.0f;
+}
+
/* get the color, range 0.0-1.0, complete with shading offset */
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
{
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 6352dacad80..bb49f024bc3 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/view2d.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -234,7 +228,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
*/
case V2D_COMMONVIEW_STANDARD:
{
- /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+ /* for now, aspect ratio should be maintained,
+ * and zoom is clamped within sane default limits */
v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM);
v2d->minzoom = 0.01f;
v2d->maxzoom = 1000.0f;
@@ -289,7 +284,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
/* scroller settings are currently not set here... that is left for regions... */
break;
}
- /* 'header' regions - zoom, aspect ratio, alignment, and panning restrictions are set here */
+ /* 'header' regions - zoom, aspect ratio,
+ * alignment, and panning restrictions are set here */
case V2D_COMMONVIEW_HEADER:
{
/* zoom + aspect ratio are locked */
@@ -322,7 +318,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
case V2D_COMMONVIEW_PANELS_UI:
{
- /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+ /* for now, aspect ratio should be maintained,
+ * and zoom is clamped within sane default limits */
v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM | V2D_KEEPZOOM);
v2d->minzoom = 0.5f;
v2d->maxzoom = 2.0f;
@@ -357,7 +354,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
}
/* other view types are completely defined using their own settings already */
default:
- /* we don't do anything here, as settings should be fine, but just make sure that rect */
+ /* we don't do anything here,
+ * as settings should be fine, but just make sure that rect */
break;
}
@@ -377,7 +375,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
}
/* set 'tot' rect before setting cur? */
- /* XXX confusing stuff here still - I made this function not check scroller hide - that happens in totrect_set */
+ /* XXX confusing stuff here still -
+ * I made this function not check scroller hide - that happens in totrect_set */
if (tot_changed)
UI_view2d_totRect_set_resize(v2d, winx, winy, !do_init);
else
@@ -486,7 +485,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
}
}
else {
- /* make sure sizes don't exceed that of the min/max sizes (even though we're not doing zoom clamping) */
+ /* make sure sizes don't exceed that of the min/max sizes
+ * (even though we're not doing zoom clamping) */
CLAMP(width, v2d->min[0], v2d->max[0]);
CLAMP(height, v2d->min[1], v2d->max[1]);
}
@@ -576,7 +576,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
v2d->oldwiny = (short)winy;
}
- /* Step 2: apply new sizes to cur rect, but need to take into account alignment settings here... */
+ /* Step 2: apply new sizes to cur rect,
+ * but need to take into account alignment settings here... */
if ((width != curwidth) || (height != curheight)) {
float temp, dh;
@@ -675,7 +676,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
* (XXX - in the past, max was favored... if there are bugs, swap!)
*/
if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) {
- /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
+ /* outside boundaries on both sides,
+ * so take middle-point of tot, and place in balanced way */
temp = BLI_rctf_cent_x(tot);
diff = curwidth * 0.5f;
@@ -725,7 +727,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize, bool mas
* We favour moving the 'minimum' across, as that's origin for most things
*/
if ((cur->ymin < tot->ymin) && (cur->ymax > tot->ymax)) {
- /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
+ /* outside boundaries on both sides,
+ * so take middle-point of tot, and place in balanced way */
temp = BLI_rctf_cent_y(tot);
diff = curheight * 0.5f;
@@ -803,7 +806,8 @@ void UI_view2d_curRect_validate(View2D *v2d)
/* ------------------ */
-/* Called by menus to activate it, or by view2d operators to make sure 'related' views stay in synchrony */
+/* Called by menus to activate it, or by view2d operators
+ * to make sure 'related' views stay in synchrony */
void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
{
ScrArea *sa;
@@ -992,7 +996,8 @@ void UI_view2d_totRect_set(View2D *v2d, int width, int height)
UI_view2d_totRect_set_resize(v2d, width, height, 0);
- /* solve bad recursion... if scroller state changed, mask is different, so you get different rects */
+ /* solve bad recursion... if scroller state changed,
+ * mask is different, so you get different rects */
if (scroll != view2d_scroll_mapped(v2d->scroll)) {
UI_view2d_totRect_set_resize(v2d, width, height, 0);
}
@@ -1046,7 +1051,7 @@ bool UI_view2d_tab_set(View2D *v2d, int tab)
void UI_view2d_zoom_cache_reset(void)
{
- /* TODO(sergey): This way we avoid threading conflict with VSE rendering
+ /* TODO(sergey): This way we avoid threading conflict with sequencer rendering
* text strip. But ideally we want to make glyph cache to be fully safe
* for threading.
*/
@@ -1072,7 +1077,8 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
float sizex = BLI_rcti_size_x(&v2d->mask);
float sizey = BLI_rcti_size_y(&v2d->mask);
- /* prevent tiny or narrow regions to get invalid coordinates - mask can get negative even... */
+ /* prevent tiny or narrow regions to get
+ * invalid coordinates - mask can get negative even... */
if (sizex > 0.0f && sizey > 0.0f) {
float dx = BLI_rctf_size_x(&v2d->cur) / (sizex + 1);
float dy = BLI_rctf_size_y(&v2d->cur) / (sizey + 1);
@@ -1109,7 +1115,8 @@ void UI_view2d_view_ortho(View2D *v2d)
if (sizey > 0)
yofs = eps * BLI_rctf_size_y(&v2d->cur) / sizey;
- /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
+ /* apply mask-based adjustments to cur rect (due to scrollers),
+ * to eliminate scaling artifacts */
view2d_map_cur_using_mask(v2d, &curmasked);
BLI_rctf_translate(&curmasked, -xofs, -yofs);
@@ -1145,7 +1152,8 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, const bool xaxis)
xofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_X) ? GLA_PIXEL_OFS : 0.0f;
yofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_Y) ? GLA_PIXEL_OFS : 0.0f;
- /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
+ /* apply mask-based adjustments to cur rect (due to scrollers),
+ * to eliminate scaling artifacts */
view2d_map_cur_using_mask(v2d, &curmasked);
/* only set matrix with 'cur' coordinates on relevant axes */
@@ -1202,7 +1210,9 @@ static void step_to_grid(float *step, int *power, int unit)
/* for frames, we want 1.0 frame intervals only */
if (unit == V2D_UNIT_FRAMES) {
rem = 1.0f;
- *step = 2.0f; /* use 2 since there are grid lines drawn in between, this way to get 1 line per frame */
+ /* use 2 since there are grid lines drawn in between,
+ * this way to get 1 line per frame */
+ *step = 2.0f;
}
/* prevents printing 1.0 2.0 3.0 etc */
@@ -1806,7 +1816,8 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
BLI_timecode_string_from_time_seconds(timecode_str, sizeof(timecode_str), power, val);
}
- /* get length of string, and adjust printing location to fit it into the horizontal scrollbar */
+ /* get length of string,
+ * and adjust printing location to fit it into the horizontal scrollbar */
len = strlen(timecode_str);
if (dir == 'h') {
/* seconds/timecode display has slightly longer strings... */
@@ -1935,7 +1946,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
break;
case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */
- /* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */
+ /* HACK: although we're drawing horizontal,
+ * we make this draw as 'vertical', just to get degree signs */
scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v');
break;
}
@@ -2004,7 +2016,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
UI_FontThemeColor(font_id, TH_TEXT);
val = grid->starty;
- /* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), apply correction */
+ /* if vertical clamping (to whole numbers) is used (i.e. in Sequencer),
+ * apply correction */
if (vs->yclamp == V2D_GRID_CLAMP)
fac += 0.5f * dfac;
@@ -2559,6 +2572,8 @@ void UI_view2d_text_cache_draw(ARegion *ar)
/* investigate using BLF_ascender() */
const int font_id = BLF_default();
+
+ BLF_set_default();
const float default_height = g_v2d_strings ? BLF_height(font_id, "28", 3) : 0.0f;
wmOrtho2_region_pixelspace(ar);
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 62bc7e87f0e..e6cce1f0df9 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/interface/view2d_ops.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
@@ -77,19 +71,28 @@ static bool view2d_poll(bContext *C)
/* temp customdata for operator */
typedef struct v2dViewPanData {
- bScreen *sc; /* screen where view pan was initiated */
- ScrArea *sa; /* area where view pan was initiated */
- ARegion *ar; /* region where view pan was initiated */
- View2D *v2d; /* view2d we're operating in */
+ /** screen where view pan was initiated */
+ bScreen *sc;
+ /** area where view pan was initiated */
+ ScrArea *sa;
+ /** region where view pan was initiated */
+ ARegion *ar;
+ /** view2d we're operating in */
+ View2D *v2d;
- float facx, facy; /* amount to move view relative to zoom */
+ /** amount to move view relative to zoom */
+ float facx, facy;
/* options for version 1 */
- int startx, starty; /* mouse x/y values in window when operator was initiated */
- int lastx, lasty; /* previous x/y values of mouse in window */
- int invoke_event; /* event starting pan, for modal exit */
-
- short in_scroller; /* for MMB in scrollers (old feature in past, but now not that useful) */
+ /** mouse x/y values in window when operator was initiated */
+ int startx, starty;
+ /** previous x/y values of mouse in window */
+ int lastx, lasty;
+ /** event starting pan, for modal exit */
+ int invoke_event;
+
+ /** for MMB in scrollers (old feature in past, but now not that useful) */
+ short in_scroller;
} v2dViewPanData;
/* initialize panning customdata */
@@ -256,7 +259,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-/* handle user input - calculations of mouse-movement need to be done here, not in the apply callback! */
+/* handle user input - calculations of mouse-movement
+ * need to be done here, not in the apply callback! */
static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewPanData *vpd = op->customdata;
@@ -669,7 +673,8 @@ static void view_zoomstep_apply_ex(
v2d->cur.xmax -= dx;
if (use_mousepos && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) {
- /* get zoom fac the same way as in ui_view2d_curRect_validate_resize - better keep in sync! */
+ /* get zoom fac the same way as in
+ * ui_view2d_curRect_validate_resize - better keep in sync! */
const float zoomx = (float)(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur);
/* only move view to mouse if zoom fac is inside minzoom/maxzoom */
@@ -702,7 +707,8 @@ static void view_zoomstep_apply_ex(
v2d->cur.ymax -= dy;
if (use_mousepos && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) {
- /* get zoom fac the same way as in ui_view2d_curRect_validate_resize - better keep in sync! */
+ /* get zoom fac the same way as in
+ * ui_view2d_curRect_validate_resize - better keep in sync! */
const float zoomy = (float)(BLI_rcti_size_y(&v2d->mask) + 1) / BLI_rctf_size_y(&v2d->cur);
/* only move view to mouse if zoom fac is inside minzoom/maxzoom */
@@ -1042,7 +1048,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
fac = 0.01f * (event->prevy - event->y);
dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f;
- /* support trackpad zoom to always zoom entirely - the v2d code uses portrait or landscape exceptions */
+ /* support trackpad zoom to always zoom entirely - the v2d code uses portrait or
+ * landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy))
dy = dx;
@@ -1095,7 +1102,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_RUNNING_MODAL;
}
-/* handle user input - calculations of mouse-movement need to be done here, not in the apply callback! */
+/* handle user input - calculations of mouse-movement need to be done here,
+ * not in the apply callback! */
static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewZoomData *vzd = op->customdata;
@@ -1141,7 +1149,8 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
}
- /* support zoom to always zoom entirely - the v2d code uses portrait or landscape exceptions */
+ /* support zoom to always zoom entirely - the v2d code uses portrait or
+ * landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy))
dy = dx;
@@ -1270,7 +1279,8 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
*/
float zoom, center, size;
- /* TODO: is this zoom factor calculation valid? It seems to produce same results every time... */
+ /* TODO: is this zoom factor calculation valid?
+ * It seems to produce same results every time... */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
size = BLI_rctf_size_x(&cur_new);
zoom = size / BLI_rctf_size_x(&rect);
@@ -1487,7 +1497,8 @@ void UI_view2d_smooth_view(
if (v2d->smooth_timer)
WM_event_remove_timer(wm, win, v2d->smooth_timer);
/* TIMER1 is hardcoded in keymap */
- v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0); /* max 30 frs/sec */
+ /* max 30 frs/sec */
+ v2d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0);
ok = true;
}
@@ -1583,20 +1594,32 @@ static void VIEW2D_OT_smoothview(wmOperatorType *ot)
/* customdata for scroller-invoke data */
typedef struct v2dScrollerMove {
- View2D *v2d; /* View2D data that this operation affects */
- ARegion *ar; /* region that the scroller is in */
+ /** View2D data that this operation affects */
+ View2D *v2d;
+ /** region that the scroller is in */
+ ARegion *ar;
+
+ /** scroller that mouse is in ('h' or 'v') */
+ char scroller;
- char scroller; /* scroller that mouse is in ('h' or 'v') */
- short zone; /* -1 is min zoomer, 0 is bar, 1 is max zoomer */ // XXX find some way to provide visual feedback of this (active color?)
+ /* XXX find some way to provide visual feedback of this (active color?) */
+ /** -1 is min zoomer, 0 is bar, 1 is max zoomer */
+ short zone;
- float fac; /* view adjustment factor, based on size of region */
- float fac_round; /* for pixel rounding (avoid visible UI jitter) */
- float delta; /* amount moved by mouse on axis of interest */
+ /** view adjustment factor, based on size of region */
+ float fac;
+ /** for pixel rounding (avoid visible UI jitter) */
+ float fac_round;
+ /** amount moved by mouse on axis of interest */
+ float delta;
- float scrollbarwidth; /* width of the scrollbar itself, used for page up/down clicks */
- int scrollbar_orig; /* initial location of scrollbar x/y, mouse relative */
+ /** width of the scrollbar itself, used for page up/down clicks */
+ float scrollbarwidth;
+ /** initial location of scrollbar x/y, mouse relative */
+ int scrollbar_orig;
- int lastx, lasty; /* previous mouse coordinates (in screen coordinates) for determining movement */
+ /** previous mouse coordinates (in screen coordinates) for determining movement */
+ int lastx, lasty;
} v2dScrollerMove;
@@ -1719,8 +1742,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
*/
scrollers = UI_view2d_scrollers_calc(C, v2d, NULL, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
- /* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'.
- * In this cases moving the scroll bars has far too little effect and the view can get stuck [#31476] */
+ /* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'. In this cases
+ * moving the scroll bars has far too little effect and the view can get stuck T31476. */
tot_cur_union = v2d->tot;
BLI_rctf_union(&tot_cur_union, &v2d->cur);
@@ -1866,10 +1889,12 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
if (ELEM(vsm->zone, SCROLLHANDLE_BAR, SCROLLHANDLE_MAX)) {
/* if using bar (i.e. 'panning') or 'max' zoom widget */
switch (vsm->scroller) {
- case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves opposite to mouse) */
+ case 'h': /* horizontal scroller - so only horizontal movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->x - vsm->lastx);
break;
- case 'v': /* vertical scroller - so only vertical movement ('cur' moves opposite to mouse) */
+ case 'v': /* vertical scroller - so only vertical movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->y - vsm->lasty);
break;
}
@@ -1877,10 +1902,12 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
else if (vsm->zone == SCROLLHANDLE_MIN) {
/* using 'min' zoom widget */
switch (vsm->scroller) {
- case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves with mouse) */
+ case 'h': /* horizontal scroller - so only horizontal movement
+ * ('cur' moves with mouse) */
vsm->delta = (float)(vsm->lastx - event->x);
break;
- case 'v': /* vertical scroller - so only vertical movement ('cur' moves with to mouse) */
+ case 'v': /* vertical scroller - so only vertical movement
+ * ('cur' moves with to mouse) */
vsm->delta = (float)(vsm->lasty - event->y);
break;
}
@@ -1922,7 +1949,8 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
}
-/* a click (or click drag in progress) should have occurred, so check if it happened in scrollbar */
+/* a click (or click drag in progress)
+ * should have occurred, so check if it happened in scrollbar */
static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
@@ -1931,7 +1959,8 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
/* check if mouse in scrollbars, if they're enabled */
const char in_scroller = UI_view2d_mouse_in_scrollers(ar, v2d, event->x, event->y);
- /* if in a scroller, init customdata then set modal handler which will catch mousedown to start doing useful stuff */
+ /* if in a scroller, init customdata then set modal handler which will
+ * catch mousedown to start doing useful stuff */
if (in_scroller) {
v2dScrollerMove *vsm;
@@ -1942,10 +1971,12 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
/* support for quick jump to location - gtk and qt do this on linux */
if (event->type == MIDDLEMOUSE) {
switch (vsm->scroller) {
- case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves opposite to mouse) */
+ case 'h': /* horizontal scroller - so only horizontal movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->x - vsm->scrollbar_orig);
break;
- case 'v': /* vertical scroller - so only vertical movement ('cur' moves opposite to mouse) */
+ case 'v': /* vertical scroller - so only vertical movement
+ * ('cur' moves opposite to mouse) */
vsm->delta = (float)(event->y - vsm->scrollbar_orig);
break;
}
@@ -2002,7 +2033,8 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
return OPERATOR_RUNNING_MODAL;
}
else {
- /* not in scroller, so nothing happened... (pass through let's something else catch event) */
+ /* not in scroller, so nothing happened...
+ * (pass through let's something else catch event) */
return OPERATOR_PASS_THROUGH;
}
}
diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt
index 4d3f106a5d6..2235e94180d 100644
--- a/source/blender/editors/io/CMakeLists.txt
+++ b/source/blender/editors/io/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Blender Foundation
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c
index 38e0ec0cb3a..576d51b7c49 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/io/io_alembic.c
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
#ifdef WITH_ALEMBIC
@@ -130,6 +125,7 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op)
.normals = RNA_boolean_get(op->ptr, "normals"),
.vcolors = RNA_boolean_get(op->ptr, "vcolors"),
.apply_subdiv = RNA_boolean_get(op->ptr, "apply_subdiv"),
+ .curves_as_mesh = RNA_boolean_get(op->ptr, "curves_as_mesh"),
.flatten_hierarchy = RNA_boolean_get(op->ptr, "flatten"),
.visible_layers_only = RNA_boolean_get(op->ptr, "visible_layers_only"),
.renderable_only = RNA_boolean_get(op->ptr, "renderable_only"),
@@ -246,6 +242,9 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
uiItemR(row, imfptr, "apply_subdiv", 0, NULL, ICON_NONE);
row = uiLayoutRow(box, false);
+ uiItemR(row, imfptr, "curves_as_mesh", 0, NULL, ICON_NONE);
+
+ row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "triangulate", 0, NULL, ICON_NONE);
const bool triangulate = RNA_boolean_get(imfptr, "triangulate");
@@ -373,6 +372,9 @@ void WM_OT_alembic_export(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "apply_subdiv", 0,
"Apply Subsurf", "Export subdivision surfaces as meshes");
+ RNA_def_boolean(ot->srna, "curves_as_mesh", false,
+ "Curves as Mesh", "Export curves and NURBS surfaces as meshes");
+
RNA_def_enum(ot->srna, "compression_type", rna_enum_abc_compression_items,
ABC_ARCHIVE_OGAWA, "Compression", "");
diff --git a/source/blender/editors/io/io_alembic.h b/source/blender/editors/io/io_alembic.h
index 5eefabef4be..881712fe630 100644
--- a/source/blender/editors/io/io_alembic.h
+++ b/source/blender/editors/io/io_alembic.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,13 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __IO_ALEMBIC_H__
#define __IO_ALEMBIC_H__
-/** \file blender/editors/io/io_alembic.h
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
struct wmOperatorType;
diff --git a/source/blender/editors/io/io_cache.c b/source/blender/editors/io/io_cache.c
index 953dc24f6a5..300382d3071 100644
--- a/source/blender/editors/io/io_cache.c
+++ b/source/blender/editors/io/io_cache.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/io/io_cache.c
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
#include "MEM_guardedalloc.h"
@@ -105,8 +100,8 @@ static int cachefile_open_exec(bContext *C, wmOperator *op)
/* hook into UI */
PropertyPointerRNA *pprop = op->customdata;
if (pprop->prop) {
- /* when creating new ID blocks, use is already 1, but RNA
- * pointer se also increases user, so this compensates it */
+ /* When creating new ID blocks, use is already 1, but RNA
+ * pointer see also increases user, so this compensates it. */
id_us_min(&cache_file->id);
PointerRNA idptr;
diff --git a/source/blender/editors/io/io_cache.h b/source/blender/editors/io/io_cache.h
index ea270c2aba1..25548dcdbce 100644
--- a/source/blender/editors/io/io_cache.h
+++ b/source/blender/editors/io/io_cache.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,13 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __IO_CACHE_H__
#define __IO_CACHE_H__
-/** \file blender/editors/io/io_cache.h
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
struct wmOperatorType;
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index 08dcde6da62..d73ddfac2f6 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/io/io_collada.c
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#ifdef WITH_COLLADA
#include "DNA_space_types.h"
@@ -98,6 +91,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
int sampling_rate;
int keep_smooth_curves;
int keep_keyframes;
+ int keep_flat_curves;
int export_animation_type;
int use_texture_copies;
@@ -157,6 +151,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
sampling_rate = (sample_animations) ? RNA_int_get(op->ptr, "sampling_rate") : 0;
keep_smooth_curves = RNA_boolean_get(op->ptr, "keep_smooth_curves");
keep_keyframes = RNA_boolean_get(op->ptr, "keep_keyframes");
+ keep_flat_curves = RNA_boolean_get(op->ptr, "keep_flat_curves");
deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only");
@@ -195,6 +190,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
export_settings.include_all_actions = include_all_actions != 0;
export_settings.sampling_rate = sampling_rate;
export_settings.keep_keyframes = keep_keyframes != 0 || sampling_rate < 1;
+ export_settings.keep_flat_curves = keep_flat_curves != 0;
export_settings.active_uv_only = active_uv_only != 0;
export_settings.export_animation_type = export_animation_type;
@@ -357,6 +353,9 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
uiItemR(row, imfptr, "keep_keyframes", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, sampling && include_animations);
+ row = uiLayoutColumn(box, false);
+ uiItemR(row, imfptr, "keep_flat_curves", 0, NULL, ICON_NONE);
+
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "include_all_actions", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, include_animations);
@@ -413,7 +412,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
static const EnumPropertyItem prop_bc_export_mesh_type[] = {
{BC_MESH_TYPE_VIEW, "view", 0, "View", "Apply modifier's view settings"},
{BC_MESH_TYPE_RENDER, "render", 0, "Render", "Apply modifier's render settings"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_bc_export_transformation_type[] = {
@@ -502,7 +501,10 @@ void WM_OT_collada_export(wmOperatorType *ot)
"is the unity matrix, otherwise you may end up with odd results)");
RNA_def_boolean(func, "keep_keyframes", 0, "Keep Keyframes",
- "Use existing keyframes as additional sample points (this helps when you want to keep manual tweaks)");
+ "Use existing keyframes as additional sample points (this helps when you want to keep manual tweaks)");
+
+ RNA_def_boolean(func, "keep_flat_curves", 0, "All keyed curves",
+ "Export also curves which have only one key or are totally flat");
RNA_def_boolean(func, "active_uv_only", 0, "Only Selected UV Map",
"Export only the selected UV Map");
diff --git a/source/blender/editors/io/io_collada.h b/source/blender/editors/io/io_collada.h
index ba122630aec..6330fc9639a 100644
--- a/source/blender/editors/io/io_collada.h
+++ b/source/blender/editors/io/io_collada.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/io/io_collada.h
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
#ifndef __IO_COLLADA_H__
diff --git a/source/blender/editors/io/io_ops.c b/source/blender/editors/io/io_ops.c
index 26414661f52..93874031ea2 100644
--- a/source/blender/editors/io/io_ops.c
+++ b/source/blender/editors/io/io_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/io/io_ops.c
- * \ingroup collada
+/** \file
+ * \ingroup collada
*/
#include "io_ops.h" /* own include */
diff --git a/source/blender/editors/io/io_ops.h b/source/blender/editors/io/io_ops.h
index 677ce40cc38..2923e052752 100644
--- a/source/blender/editors/io/io_ops.h
+++ b/source/blender/editors/io/io_ops.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/io/io_ops.h
- * \ingroup editor/io
+/** \file
+ * \ingroup editor/io
*/
#ifndef __IO_OPS_H__
diff --git a/source/blender/editors/lattice/CMakeLists.txt b/source/blender/editors/lattice/CMakeLists.txt
index 2207e0fa736..f14de01c102 100644
--- a/source/blender/editors/lattice/CMakeLists.txt
+++ b/source/blender/editors/lattice/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/lattice/editlattice_select.c b/source/blender/editors/lattice/editlattice_select.c
index 9a50c5ba908..2c7f084fe17 100644
--- a/source/blender/editors/lattice/editlattice_select.c
+++ b/source/blender/editors/lattice/editlattice_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/lattice/editlattice_select.c
- * \ingroup edlattice
+/** \file
+ * \ingroup edlattice
*/
#include <stdlib.h>
diff --git a/source/blender/editors/lattice/editlattice_tools.c b/source/blender/editors/lattice/editlattice_tools.c
index 2f8dc37a2f6..0d57b94a493 100644
--- a/source/blender/editors/lattice/editlattice_tools.c
+++ b/source/blender/editors/lattice/editlattice_tools.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/lattice/editlattice_tools.c
- * \ingroup edlattice
+/** \file
+ * \ingroup edlattice
*/
@@ -135,7 +129,7 @@ void LATTICE_OT_make_regular(wmOperatorType *ot)
typedef enum eLattice_FlipAxes {
LATTICE_FLIP_U = 0,
LATTICE_FLIP_V = 1,
- LATTICE_FLIP_W = 2
+ LATTICE_FLIP_W = 2,
} eLattice_FlipAxes;
/**
@@ -239,7 +233,8 @@ static int lattice_flip_exec(bContext *C, wmOperator *op)
numW = lt->pntsw;
totP = numU * numV * numW;
- /* First Pass: determine midpoint - used for flipping center verts if there are odd number of points on axis */
+ /* First Pass: determine midpoint - used for flipping center verts if there
+ * are odd number of points on axis */
switch (axis) {
case LATTICE_FLIP_U:
isOdd = numU & 1;
@@ -351,7 +346,8 @@ void LATTICE_OT_flip(wmOperatorType *ot)
{LATTICE_FLIP_U, "U", 0, "U (X) Axis", ""},
{LATTICE_FLIP_V, "V", 0, "V (Y) Axis", ""},
{LATTICE_FLIP_W, "W", 0, "W (Z) Axis", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Flip (Distortion Free)";
diff --git a/source/blender/editors/lattice/editlattice_undo.c b/source/blender/editors/lattice/editlattice_undo.c
index 744f353f129..be8e0ae0633 100644
--- a/source/blender/editors/lattice/editlattice_undo.c
+++ b/source/blender/editors/lattice/editlattice_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/lattice/editlattice_undo.c
- * \ingroup edlattice
+/** \file
+ * \ingroup edlattice
*/
#include <stdlib.h>
@@ -151,13 +145,15 @@ static bool lattice_undosys_poll(bContext *C)
return editlatt_object_from_context(C) != NULL;
}
-static bool lattice_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool lattice_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
LatticeUndoStep *us = (LatticeUndoStep *)us_p;
+ /* Important not to use the 3D view when getting objects because all objects
+ * outside of this list will be moved out of edit-mode when reading back undo steps. */
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, NULL, &objects_len);
us->elems = MEM_callocN(sizeof(*us->elems) * objects_len, __func__);
us->elems_len = objects_len;
@@ -175,14 +171,15 @@ static bool lattice_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void lattice_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void lattice_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(lattice_undosys_poll(C));
-
LatticeUndoStep *us = (LatticeUndoStep *)us_p;
+ /* Load all our objects into edit-mode, clear everything else. */
+ ED_undo_object_editmode_restore_helper(C, &us->elems[0].obedit_ref.ptr, us->elems_len, sizeof(*us->elems));
+
+ BLI_assert(lattice_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
LatticeUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;
@@ -236,7 +233,6 @@ void ED_lattice_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = lattice_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(LatticeUndoStep);
diff --git a/source/blender/editors/lattice/lattice_intern.h b/source/blender/editors/lattice/lattice_intern.h
index 7902b992270..c08e6b6adb5 100644
--- a/source/blender/editors/lattice/lattice_intern.h
+++ b/source/blender/editors/lattice/lattice_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/lattice/lattice_intern.h
- * \ingroup edlattice
+/** \file
+ * \ingroup edlattice
*/
diff --git a/source/blender/editors/lattice/lattice_ops.c b/source/blender/editors/lattice/lattice_ops.c
index 76ccc2250ee..49be5a6a4c9 100644
--- a/source/blender/editors/lattice/lattice_ops.c
+++ b/source/blender/editors/lattice/lattice_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/lattice/lattice_ops.c
- * \ingroup edlattice
+/** \file
+ * \ingroup edlattice
*/
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/mask/CMakeLists.txt b/source/blender/editors/mask/CMakeLists.txt
index d17df344dc9..63f8dc78d13 100644
--- a/source/blender/editors/mask/CMakeLists.txt
+++ b/source/blender/editors/mask/CMakeLists.txt
@@ -15,10 +15,6 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2012 Blender Foundation.
-#
-# Contributor(s): Blender Foundation,
-# Sergey Sharybin
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index 0cc608a56f1..579f3765710 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_add.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index fc9cfc85bc5..82f7cb49d12 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Campbell Barton,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_draw.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include "MEM_guardedalloc.h"
@@ -35,7 +26,6 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_rect.h"
-#include "BLI_task.h"
#include "BLI_listbase.h"
#include "BKE_context.h"
@@ -634,14 +624,17 @@ static float *mask_rasterize(Mask *mask, const int width, const int height)
/* sets up the opengl context.
* width, height are to match the values from ED_mask_get_size() */
-void ED_mask_draw_region(Mask *mask, ARegion *ar,
- const char draw_flag, const char draw_type, const char overlay_mode,
- const int width_i, const int height_i, /* convert directly into aspect corrected vars */
- const float aspx, const float aspy,
- const bool do_scale_applied, const bool do_draw_cb,
- float stabmat[4][4], /* optional - only used by clip */
- const bContext *C /* optional - only used when do_post_draw is set or called from clip editor */
- )
+void ED_mask_draw_region(
+ Mask *mask, ARegion *ar,
+ const char draw_flag, const char draw_type, const char overlay_mode,
+ /* convert directly into aspect corrected vars */
+ const int width_i, const int height_i,
+ const float aspx, const float aspy,
+ const bool do_scale_applied, const bool do_draw_cb,
+ /* optional - only used by clip */
+ float stabmat[4][4],
+ /* optional - only used when do_post_draw is set or called from clip editor */
+ const bContext *C)
{
struct View2D *v2d = &ar->v2d;
@@ -706,7 +699,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
GPU_matrix_mul(stabmat);
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(&state, 0.0f, 0.0f, width, height, GL_RED, GL_FLOAT, GL_NEAREST, buffer, 1.0f, 1.0f, NULL);
GPU_matrix_pop();
@@ -718,7 +711,8 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
MEM_freeN(buffer);
}
- /* apply transformation so mask editing tools will assume drawing from the origin in normalized space */
+ /* apply transformation so mask editing tools will assume drawing from the
+ * origin in normalized space */
GPU_matrix_push();
GPU_matrix_translate_2f(x + xofs, y + yofs);
GPU_matrix_scale_2f(zoomx, zoomy);
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index 03fc7252ea6..a2deaac30ac 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_edit.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c
index 00db3c6e659..9c7eed6ba51 100644
--- a/source/blender/editors/mask/mask_editaction.c
+++ b/source/blender/editors/mask/mask_editaction.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_editaction.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include <stdio.h>
diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h
index 60acb430b20..77f537e2e4a 100644
--- a/source/blender/editors/mask/mask_intern.h
+++ b/source/blender/editors/mask/mask_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,17 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_intern.h
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#ifndef __MASK_INTERN_H__
#define __MASK_INTERN_H__
-struct bContext;
struct Mask;
+struct bContext;
struct wmOperatorType;
/* internal exports only */
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index 20fc403762d..1bb76045c72 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_ops.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include "MEM_guardedalloc.h"
@@ -464,7 +456,7 @@ enum {
SLIDE_ACTION_POINT = 1,
SLIDE_ACTION_HANDLE = 2,
SLIDE_ACTION_FEATHER = 3,
- SLIDE_ACTION_SPLINE = 4
+ SLIDE_ACTION_SPLINE = 4,
};
typedef struct SlidePointData {
@@ -1920,7 +1912,7 @@ void MASK_OT_handle_type_set(wmOperatorType *ot)
{HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""},
{HD_ALIGN_DOUBLESIDE, "ALIGNED_DOUBLESIDE", 0, "Aligned", ""},
{HD_FREE, "FREE", 0, "Free", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2162,7 +2154,7 @@ void MASK_OT_layer_move(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2220,7 +2212,8 @@ static int mask_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
MaskSplinePoint *new_point;
int b;
- /* BKE_mask_spline_add might allocate the points, need to free them in this case. */
+ /* BKE_mask_spline_add might allocate the points,
+ * need to free them in this case. */
if (new_spline->points) {
MEM_freeN(new_spline->points);
}
diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c
index c500ec75aee..d7dfcc64ab0 100644
--- a/source/blender/editors/mask/mask_relationships.c
+++ b/source/blender/editors/mask/mask_relationships.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_relationships.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index a5daa7b4565..89a15ec316d 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_select.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include "MEM_guardedalloc.h"
@@ -53,6 +45,10 @@
#include "mask_intern.h" /* own include */
+/* -------------------------------------------------------------------- */
+/** \name Public Mask Selection API
+ * \{ */
+
/* 'check' select */
bool ED_mask_spline_select_check(MaskSpline *spline)
{
@@ -209,7 +205,11 @@ void ED_mask_select_flush_all(Mask *mask)
}
}
-/******************** toggle selection *********************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name (De)select All Operator
+ * \{ */
static int select_all_exec(bContext *C, wmOperator *op)
{
@@ -242,7 +242,11 @@ void MASK_OT_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
-/******************** select *********************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select (Cursor Pick) Operator
+ * \{ */
static int select_exec(bContext *C, wmOperator *op)
{
@@ -394,9 +398,11 @@ void MASK_OT_select(wmOperatorType *ot)
"Location", "Location of vertex in normalized space", -1.0f, 1.0f);
}
+/** \} */
-
-/********************** box select operator *********************/
+/* -------------------------------------------------------------------- */
+/** \name Box Select Operator
+ * \{ */
static int box_select_exec(bContext *C, wmOperator *op)
{
@@ -410,8 +416,13 @@ static int box_select_exec(bContext *C, wmOperator *op)
rcti rect;
rctf rectf;
bool changed = false;
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
+
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_mask_select_toggle_all(mask, SEL_DESELECT);
+ changed = true;
+ }
/* get rectangle from operator */
WM_operator_properties_border_to_rcti(op, &rect);
@@ -436,17 +447,11 @@ static int box_select_exec(bContext *C, wmOperator *op)
/* TODO: handles? */
/* TODO: uw? */
-
if (BLI_rctf_isect_pt_v(&rectf, point_deform->bezt.vec[1])) {
BKE_mask_point_select_set(point, select);
BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, select);
+ changed = true;
}
- else if (!extend) {
- BKE_mask_point_select_set(point, false);
- BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, false);
- }
-
- changed = true;
}
}
}
@@ -479,10 +484,17 @@ void MASK_OT_select_box(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_box_select(ot);
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
-static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves, bool select, bool extend)
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Lasso Select Operator
+ * \{ */
+
+static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves, const eSelectOp sel_op)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
@@ -494,6 +506,12 @@ static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves
rcti rect;
bool changed = false;
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_mask_select_toggle_all(mask, SEL_DESELECT);
+ changed = true;
+ }
+
/* get rectangle from operator */
BLI_lasso_boundbox(&rect, mcords, moves);
@@ -515,7 +533,7 @@ static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves
/* TODO: handles? */
/* TODO: uw? */
- if (MASKPOINT_ISSEL_ANY(point) && select && extend) {
+ if (MASKPOINT_ISSEL_ANY(point) && select) {
continue;
}
@@ -533,11 +551,6 @@ static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves
BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, select);
changed = true;
}
- else if (select && !extend) {
- BKE_mask_point_select_set(point, false);
- BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, false);
- changed = true;
- }
}
}
}
@@ -557,9 +570,8 @@ static int clip_lasso_select_exec(bContext *C, wmOperator *op)
const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
if (mcords) {
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
- do_lasso_select_mask(C, mcords, mcords_tot, select, extend);
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ do_lasso_select_mask(C, mcords, mcords_tot, sel_op);
MEM_freeN((void *)mcords);
@@ -586,10 +598,15 @@ void MASK_OT_select_lasso(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_lasso_select(ot);
+ WM_operator_properties_gesture_lasso(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
-/********************** circle select operator *********************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Circle Select Operator
+ * \{ */
static int mask_spline_point_inside_ellipse(BezTriple *bezt, const float offset[2], const float ellipse[2])
{
@@ -620,8 +637,6 @@ static int circle_select_exec(bContext *C, wmOperator *op)
const int y = RNA_int_get(op->ptr, "y");
const int radius = RNA_int_get(op->ptr, "radius");
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
-
/* compute ellipse and position in unified coordinates */
ED_mask_get_size(sa, &width, &height);
ED_mask_zoom(sa, ar, &zoomx, &zoomy);
@@ -632,6 +647,14 @@ static int circle_select_exec(bContext *C, wmOperator *op)
ED_mask_point_pos(sa, ar, x, y, &offset[0], &offset[1]);
+ const eSelectOp sel_op = ED_select_op_modal(
+ RNA_enum_get(op->ptr, "mode"), WM_gesture_is_modal_first(op->customdata));
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_mask_select_toggle_all(mask, SEL_DESELECT);
+ changed = true;
+ }
+
/* do actual selection */
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
MaskSpline *spline;
@@ -685,9 +708,16 @@ void MASK_OT_select_circle(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_circle_select(ot);
+ WM_operator_properties_gesture_circle(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select Linked (Cursor Pick) Operator
+ * \{ */
+
static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ScrArea *sa = CTX_wm_area(C);
@@ -742,6 +772,12 @@ void MASK_OT_select_linked_pick(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "");
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select Linked Operator
+ * \{ */
+
static int mask_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
Mask *mask = CTX_data_edit_mask(C);
@@ -791,7 +827,11 @@ void MASK_OT_select_linked(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/**************** Select more/less **************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select More/Less Operators
+ * \{ */
static int mask_select_more_less(bContext *C, bool more)
{
@@ -907,3 +947,6 @@ void MASK_OT_select_less(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+
+
+/** \} */
diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c
index d64963d4347..7d33d13cbd3 100644
--- a/source/blender/editors/mask/mask_shapekey.c
+++ b/source/blender/editors/mask/mask_shapekey.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mask/mask_shapekey.c
- * \ingroup edmask
+/** \file
+ * \ingroup edmask
*/
#include <stdlib.h>
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index 4cefbf21c24..bc8761f24c0 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 8e64ed93842..5afde1b3ba1 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editface.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -548,7 +542,8 @@ void paintvert_tag_select_update(struct bContext *C, struct Object *ob)
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
}
-/* note: if the caller passes false to flush_flags, then they will need to run paintvert_flush_flags(ob) themselves */
+/* note: if the caller passes false to flush_flags,
+ * then they will need to run paintvert_flush_flags(ob) themselves */
void paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
{
Mesh *me;
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index bcde2411899..aca8fac8bf7 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,24 +15,19 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_add.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
+#include "BLI_math.h"
+#include "BLI_sys_types.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_math.h"
-
#include "BLT_translation.h"
#include "BKE_context.h"
@@ -69,14 +62,15 @@ static Object *make_prim_init(
const float loc[3], const float rot[3], ushort local_view_bits,
MakePrimitiveData *r_creation_data)
{
+ struct Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
r_creation_data->was_editmode = false;
if (obedit == NULL || obedit->type != OB_MESH) {
obedit = ED_object_add_type(C, OB_MESH, idname, loc, rot, false, local_view_bits);
+ ED_object_editmode_enter_ex(bmain, scene, obedit, 0);
- /* create editmode */
- ED_object_editmode_enter(C, EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
r_creation_data->was_editmode = true;
}
@@ -215,7 +209,8 @@ static const EnumPropertyItem fill_type_items[] = {
{0, "NOTHING", 0, "Nothing", "Don't fill at all"},
{1, "NGON", 0, "Ngon", "Use ngons"},
{2, "TRIFAN", 0, "Triangle Fan", "Use triangle fans"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int add_primitive_circle_exec(bContext *C, wmOperator *op)
{
diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c
index d3a81a3f9ed..b01a935e4d2 100644
--- a/source/blender/editors/mesh/editmesh_add_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_add_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_add_gizmo.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* Creation gizmos.
*/
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index ff259f01f64..477a5b068ac 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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, Howard Trickey, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_bevel.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -30,7 +24,6 @@
#include "BLI_string.h"
#include "BLI_math.h"
-#include "BLI_linklist_stack.h"
#include "BLT_translation.h"
@@ -41,6 +34,8 @@
#include "BKE_layer.h"
#include "BKE_mesh.h"
+#include "DNA_mesh_types.h"
+
#include "RNA_define.h"
#include "RNA_access.h"
@@ -72,7 +67,7 @@
#define SEGMENTS_VALUE 3
#define NUM_VALUE_KINDS 4
-static const char *value_rna_name[NUM_VALUE_KINDS] = {"offset", "offset", "profile", "segments"};
+static const char *value_rna_name[NUM_VALUE_KINDS] = {"offset", "offset_pct", "profile", "segments"};
static const float value_clamp_min[NUM_VALUE_KINDS] = {0.0f, 0.0f, PROFILE_HARD_MIN, 1.0f};
static const float value_clamp_max[NUM_VALUE_KINDS] = {1e6, 100.0f, 1.0f, SEGMENTS_HARD_MAX};
static const float value_start[NUM_VALUE_KINDS] = {0.0f, 0.0f, 0.5f, 1.0f};
@@ -88,7 +83,9 @@ typedef struct {
float initial_length[NUM_VALUE_KINDS];
float scale[NUM_VALUE_KINDS];
NumInput num_input[NUM_VALUE_KINDS];
- float shift_value[NUM_VALUE_KINDS]; /* The current value when shift is pressed. Negative when shift not active. */
+ /** The current value when shift is pressed. Negative when shift not active. */
+ float shift_value[NUM_VALUE_KINDS];
+ float max_obj_scale;
bool is_modal;
BevelObjectStore *ob_store;
@@ -102,38 +99,108 @@ typedef struct {
float segments; /* Segments as float so smooth mouse pan works in small increments */
} BevelData;
-static void edbm_bevel_update_header(bContext *C, wmOperator *op)
+enum {
+ BEV_MODAL_CANCEL = 1,
+ BEV_MODAL_CONFIRM,
+ BEV_MODAL_VALUE_OFFSET,
+ BEV_MODAL_VALUE_PROFILE,
+ BEV_MODAL_VALUE_SEGMENTS,
+ BEV_MODAL_SEGMENTS_UP,
+ BEV_MODAL_SEGMENTS_DOWN,
+ BEV_MODAL_OFFSET_MODE_CHANGE,
+ BEV_MODAL_CLAMP_OVERLAP_TOGGLE,
+ BEV_MODAL_VERTEX_ONLY_TOGGLE,
+ BEV_MODAL_HARDEN_NORMALS_TOGGLE,
+ BEV_MODAL_MARK_SEAM_TOGGLE,
+ BEV_MODAL_MARK_SHARP_TOGGLE,
+ BEV_MODAL_OUTER_MITER_CHANGE,
+ BEV_MODAL_INNER_MITER_CHANGE,
+};
+
+static float get_bevel_offset(wmOperator *op)
{
- const char *str = IFACE_("Confirm: (Enter/LMB), Cancel: (Esc/RMB), Mode: %s (M), Clamp Overlap: %s (C), "
- "Vertex Only: %s (V), Profile Control: %s (P), Offset: %s, Segments: %d, Profile: %.3f");
-
- char msg[UI_MAX_DRAW_STR];
- ScrArea *sa = CTX_wm_area(C);
- Scene *sce = CTX_data_scene(C);
-
- if (sa) {
- BevelData *opdata = op->customdata;
- char offset_str[NUM_STR_REP_LEN];
- const char *type_str;
- PropertyRNA *prop = RNA_struct_find_property(op->ptr, "offset_type");
+ float val;
- if (hasNumInput(&opdata->num_input[OFFSET_VALUE])) {
- outputNumInput(&opdata->num_input[OFFSET_VALUE], offset_str, &sce->unit);
- }
- else {
- BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset"));
- }
+ if (RNA_enum_get(op->ptr, "offset_type") == BEVEL_AMT_PERCENT)
+ val = RNA_float_get(op->ptr, "offset_pct");
+ else
+ val = RNA_float_get(op->ptr, "offset");
+ return val;
+}
- RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &type_str);
+static void edbm_bevel_update_header(bContext *C, wmOperator *op)
+{
+ char header[UI_MAX_DRAW_STR];
+ char buf[UI_MAX_DRAW_STR];
+ char *p = buf;
+ int available_len = sizeof(buf);
+ Scene *sce = CTX_data_scene(C);
+ char offset_str[NUM_STR_REP_LEN];
+ const char *mode_str, *omiter_str, *imiter_str;
+ PropertyRNA *prop;
- BLI_snprintf(msg, sizeof(msg), str, type_str,
- WM_bool_as_string(RNA_boolean_get(op->ptr, "clamp_overlap")),
- WM_bool_as_string(RNA_boolean_get(op->ptr, "vertex_only")),
- WM_bool_as_string(opdata->value_mode == PROFILE_VALUE),
- offset_str, RNA_int_get(op->ptr, "segments"), RNA_float_get(op->ptr, "profile"));
+#define WM_MODALKEY(_id) \
+ WM_modalkeymap_operator_items_to_string_buf(op->type, (_id), true, UI_MAX_SHORTCUT_STR, &available_len, &p)
- ED_area_status_text(sa, msg);
+ if (RNA_enum_get(op->ptr, "offset_type") == BEVEL_AMT_PERCENT) {
+ BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%.1f%%", RNA_float_get(op->ptr, "offset_pct"));
+ }
+ else {
+ bUnit_AsString2(offset_str, NUM_STR_REP_LEN, (double)RNA_float_get(op->ptr, "offset"), 3,
+ B_UNIT_LENGTH, &sce->unit, true);
}
+
+ prop = RNA_struct_find_property(op->ptr, "offset_type");
+ RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &mode_str);
+ prop = RNA_struct_find_property(op->ptr, "miter_outer");
+ RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &omiter_str);
+ prop = RNA_struct_find_property(op->ptr, "miter_inner");
+ RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &imiter_str);
+
+ BLI_snprintf(header, sizeof(header),
+ IFACE_("%s: confirm, "
+ "%s: cancel, "
+ "%s: mode (%s), "
+ "%s: width (%s), "
+ "%s: segments (%d), "
+ "%s: profile (%.3f), "
+ "%s: clamp overlap (%s), "
+ "%s: vertex only (%s), "
+ "%s: outer miter (%s), "
+ "%s: inner miter (%s), "
+ "%s: harden normals (%s), "
+ "%s: mark seam (%s), "
+ "%s: mark sharp (%s)"
+ ),
+ WM_MODALKEY(BEV_MODAL_CONFIRM),
+ WM_MODALKEY(BEV_MODAL_CANCEL),
+ WM_MODALKEY(BEV_MODAL_OFFSET_MODE_CHANGE),
+ mode_str,
+ WM_MODALKEY(BEV_MODAL_VALUE_OFFSET),
+ offset_str,
+ WM_MODALKEY(BEV_MODAL_VALUE_SEGMENTS),
+ RNA_int_get(op->ptr, "segments"),
+ WM_MODALKEY(BEV_MODAL_VALUE_PROFILE),
+ RNA_float_get(op->ptr, "profile"),
+ WM_MODALKEY(BEV_MODAL_CLAMP_OVERLAP_TOGGLE),
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "clamp_overlap")),
+ WM_MODALKEY(BEV_MODAL_VERTEX_ONLY_TOGGLE),
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "vertex_only")),
+ WM_MODALKEY(BEV_MODAL_OUTER_MITER_CHANGE),
+ omiter_str,
+ WM_MODALKEY(BEV_MODAL_INNER_MITER_CHANGE),
+ imiter_str,
+ WM_MODALKEY(BEV_MODAL_HARDEN_NORMALS_TOGGLE),
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "harden_normals")),
+ WM_MODALKEY(BEV_MODAL_MARK_SEAM_TOGGLE),
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "mark_seam")),
+ WM_MODALKEY(BEV_MODAL_MARK_SHARP_TOGGLE),
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "mark_sharp"))
+ );
+
+#undef WM_MODALKEY
+
+ ED_workspace_status_text(C, header);
}
static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
@@ -146,17 +213,23 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
if (is_modal) {
RNA_float_set(op->ptr, "offset", 0.0f);
+ RNA_float_set(op->ptr, "offset_pct", 0.0f);
+ RNA_enum_set(op->ptr, "offset_type", BEVEL_AMT_OFFSET);
}
op->customdata = opdata = MEM_mallocN(sizeof(BevelData), "beveldata_mesh_operator");
uint objects_used_len = 0;
+ opdata->max_obj_scale = FLT_MIN;
{
uint ob_store_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &ob_store_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(
+ view_layer, CTX_wm_view3d(C), &ob_store_len);
opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__);
for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) {
Object *obedit = objects[ob_index];
+ float scale = mat4_to_scale(obedit->obmat);
+ opdata->max_obj_scale = max_ff(opdata->max_obj_scale, scale);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
if (em->bm->totvertsel > 0) {
opdata->ob_store[objects_used_len].em = em;
@@ -187,7 +260,8 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
if (i == OFFSET_VALUE) {
opdata->num_input[i].unit_sys = scene->unit.system;
}
- opdata->num_input[i].unit_type[0] = B_UNIT_NONE; /* Not sure this is a factor or a unit? */
+ /* Not sure this is a factor or a unit? */
+ opdata->num_input[i].unit_type[0] = B_UNIT_NONE;
}
/* avoid the cost of allocating a bm copy */
@@ -218,7 +292,7 @@ static bool edbm_bevel_calc(wmOperator *op)
BMOperator bmop;
bool changed = false;
- const float offset = RNA_float_get(op->ptr, "offset");
+ const float offset = get_bevel_offset(op);
const int offset_type = RNA_enum_get(op->ptr, "offset_type");
const int segments = RNA_int_get(op->ptr, "segments");
const float profile = RNA_float_get(op->ptr, "profile");
@@ -230,6 +304,9 @@ static bool edbm_bevel_calc(wmOperator *op)
const bool mark_sharp = RNA_boolean_get(op->ptr, "mark_sharp");
const bool harden_normals = RNA_boolean_get(op->ptr, "harden_normals");
const int face_strength_mode = RNA_enum_get(op->ptr, "face_strength_mode");
+ const int miter_outer = RNA_enum_get(op->ptr, "miter_outer");
+ const int miter_inner = RNA_enum_get(op->ptr, "miter_inner");
+ const float spread = RNA_float_get(op->ptr, "spread");
for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
em = opdata->ob_store[ob_index].em;
@@ -243,12 +320,22 @@ static bool edbm_bevel_calc(wmOperator *op)
material = CLAMPIS(material, -1, em->ob->totcol - 1);
}
+ Mesh *me = em->ob->data;
+
+ if (harden_normals && !(me->flag & ME_AUTOSMOOTH)) {
+ /* harden_normals only has a visible effect if autosmooth is on, so turn it on */
+ me->flag |= ME_AUTOSMOOTH;
+ }
+
EDBM_op_init(
em, &bmop, op,
- "bevel geom=%hev offset=%f segments=%i vertex_only=%b offset_type=%i profile=%f clamp_overlap=%b "
- "material=%i loop_slide=%b mark_seam=%b mark_sharp=%b harden_normals=%b face_strength_mode=%i",
+ "bevel geom=%hev offset=%f segments=%i vertex_only=%b offset_type=%i profile=%f "
+ "clamp_overlap=%b material=%i loop_slide=%b mark_seam=%b mark_sharp=%b "
+ "harden_normals=%b face_strength_mode=%i "
+ "miter_outer=%i miter_inner=%i spread=%f smoothresh=%f",
BM_ELEM_SELECT, offset, segments, vertex_only, offset_type, profile,
- clamp_overlap, material, loop_slide, mark_seam, mark_sharp, harden_normals, face_strength_mode);
+ clamp_overlap, material, loop_slide, mark_seam, mark_sharp, harden_normals, face_strength_mode,
+ miter_outer, miter_inner, spread, me->smoothresh);
BMO_op_exec(em->bm, &bmop);
@@ -360,7 +447,6 @@ static void edbm_bevel_calc_initial_length(wmOperator *op, const wmEvent *event,
static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- /* TODO make modal keymap (see fly mode) */
RegionView3D *rv3d = CTX_wm_region_view3d(C);
BevelData *opdata;
float center_3d[3];
@@ -380,6 +466,8 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* for OFFSET_VALUE only, the scale is the size of a pixel under the mouse in 3d space */
opdata->scale[OFFSET_VALUE] = rv3d ? ED_view3d_pixel_size(rv3d, center_3d) : 1.0f;
+ /* since we are affecting untransformed object but seeing in transformed space, compensate for that */
+ opdata->scale[OFFSET_VALUE] /= opdata->max_obj_scale;
edbm_bevel_calc_initial_length(op, event, false);
@@ -387,6 +475,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (!edbm_bevel_calc(op)) {
edbm_bevel_cancel(C, op);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_CANCELLED;
}
@@ -453,70 +542,127 @@ static void edbm_bevel_numinput_set_value(wmOperator *op)
}
}
+/* Hide one of offset or offset_pct, depending on offset_type */
+static bool edbm_bevel_poll_property(const bContext *UNUSED(C), wmOperator *op, const PropertyRNA *prop)
+{
+ const char *prop_id = RNA_property_identifier(prop);
+
+ if (STRPREFIX(prop_id, "offset")) {
+ int offset_type = RNA_enum_get(op->ptr, "offset_type");
+
+ if (STREQ(prop_id, "offset") && offset_type == BEVEL_AMT_PERCENT)
+ return false;
+ else if (STREQ(prop_id, "offset_pct") && offset_type != BEVEL_AMT_PERCENT)
+ return false;
+ }
+
+ return true;
+}
+
+wmKeyMap *bevel_modal_keymap(wmKeyConfig *keyconf)
+{
+ static const EnumPropertyItem modal_items[] = {
+ {BEV_MODAL_CANCEL, "CANCEL", 0, "Cancel", "Cancel bevel"},
+ {BEV_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", "Confirm bevel"},
+ {BEV_MODAL_VALUE_OFFSET, "VALUE_OFFSET", 0, "Value is offset",
+ "Value changes offset"},
+ {BEV_MODAL_VALUE_PROFILE, "VALUE_PROFILE", 0, "Value is profile",
+ "Value changes profile"},
+ {BEV_MODAL_VALUE_SEGMENTS, "VALUE_SEGMENTS", 0, "Value is segments",
+ "Value changes segments"},
+ {BEV_MODAL_SEGMENTS_UP, "SEGMENTS_UP", 0, "Increase segments",
+ "Increase segments"},
+ {BEV_MODAL_SEGMENTS_DOWN, "SEGMENTS_DOWN", 0, "Decrease segments",
+ "Decrease segments"},
+ {BEV_MODAL_OFFSET_MODE_CHANGE, "OFFSET_MODE_CHANGE", 0, "Change offset mode",
+ "Cycle through offset modes"},
+ {BEV_MODAL_CLAMP_OVERLAP_TOGGLE, "CLAMP_OVERLAP_TOGGLE", 0, "Toggle clamp overlap",
+ "Toggle clamp overlap flag"},
+ {BEV_MODAL_VERTEX_ONLY_TOGGLE, "VERTEX_ONLY_TOGGLE", 0, "Toggle vertex only",
+ "Toggle vertex only flag"},
+ {BEV_MODAL_HARDEN_NORMALS_TOGGLE, "HARDEN_NORMALS_TOGGLE", 0, "Toggle harden normals",
+ "Toggle harden normals flag"},
+ {BEV_MODAL_MARK_SEAM_TOGGLE, "MARK_SEAM_TOGGLE", 0, "Toggle mark seam",
+ "Toggle mark seam flag"},
+ {BEV_MODAL_MARK_SHARP_TOGGLE, "MARK_SHARP_TOGGLE", 0, "Toggle mark sharp",
+ "Toggle mark sharp flag"},
+ {BEV_MODAL_OUTER_MITER_CHANGE, "OUTER_MITER_CHANGE", 0, "Change outer miter",
+ "Cycle through outer miter kinds"},
+ {BEV_MODAL_INNER_MITER_CHANGE, "INNER_MITER_CHANGE", 0, "Change inner miter",
+ "Cycle through inner miter kinds"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Bevel Modal Map");
+
+ /* this function is called for each spacetype, only needs to add map once */
+ if (keymap && keymap->modal_items)
+ return NULL;
+
+ keymap = WM_modalkeymap_add(keyconf, "Bevel Modal Map", modal_items);
+
+ WM_modalkeymap_assign(keymap, "MESH_OT_bevel");
+
+ return keymap;
+}
+
static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
BevelData *opdata = op->customdata;
const bool has_numinput = hasNumInput(&opdata->num_input[opdata->value_mode]);
+ bool handled = false;
+ short etype = event->type;
+ short eval = event->val;
+ /* When activated from toolbar, need to convert leftmouse release to confirm */
+ if (etype == LEFTMOUSE && eval == KM_RELEASE &&
+ RNA_boolean_get(op->ptr, "release_confirm"))
+ {
+ etype = EVT_MODAL_MAP;
+ eval = BEV_MODAL_CONFIRM;
+ }
/* Modal numinput active, try to handle numeric inputs first... */
- if (event->val == KM_PRESS && has_numinput && handleNumInput(C, &opdata->num_input[opdata->value_mode], event)) {
+ if (etype != EVT_MODAL_MAP && eval == KM_PRESS && has_numinput &&
+ handleNumInput(C, &opdata->num_input[opdata->value_mode], event))
+ {
edbm_bevel_numinput_set_value(op);
edbm_bevel_calc(op);
edbm_bevel_update_header(C, op);
return OPERATOR_RUNNING_MODAL;
}
- else {
- bool handled = false;
- switch (event->type) {
- case ESCKEY:
- case RIGHTMOUSE:
+ else if (etype == MOUSEMOVE) {
+ if (!has_numinput) {
+ edbm_bevel_mouse_set_value(op, event);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ }
+ }
+ else if (etype == MOUSEPAN) {
+ float delta = 0.02f * (event->y - event->prevy);
+ if (opdata->segments >= 1 && opdata->segments + delta < 1)
+ opdata->segments = 1;
+ else
+ opdata->segments += delta;
+ RNA_int_set(op->ptr, "segments", (int)opdata->segments);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ }
+ else if (etype == EVT_MODAL_MAP) {
+ switch (eval) {
+ case BEV_MODAL_CANCEL:
edbm_bevel_cancel(C, op);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_CANCELLED;
- case MOUSEMOVE:
- if (!has_numinput) {
- edbm_bevel_mouse_set_value(op, event);
- edbm_bevel_calc(op);
- edbm_bevel_update_header(C, op);
- handled = true;
- }
- break;
-
- case LEFTMOUSE:
- case PADENTER:
- case RETKEY:
- if ((event->val == KM_PRESS) ||
- ((event->val == KM_RELEASE) && RNA_boolean_get(op->ptr, "release_confirm")))
- {
- edbm_bevel_calc(op);
- edbm_bevel_exit(C, op);
- return OPERATOR_FINISHED;
- }
- break;
-
- case MOUSEPAN: {
- float delta = 0.02f * (event->y - event->prevy);
- if (opdata->segments >= 1 && opdata->segments + delta < 1)
- opdata->segments = 1;
- else
- opdata->segments += delta;
- RNA_int_set(op->ptr, "segments", (int)opdata->segments);
+ case BEV_MODAL_CONFIRM:
edbm_bevel_calc(op);
- edbm_bevel_update_header(C, op);
- handled = true;
- break;
- }
-
- /* Note this will prevent padplus and padminus to ever activate modal numinput.
- * This is not really an issue though, as we only expect positive values here...
- * Else we could force them to only modify segments number when shift is pressed, or so.
- */
-
- case WHEELUPMOUSE: /* change number of segments */
- case PADPLUSKEY:
- if (event->val == KM_RELEASE)
- break;
+ edbm_bevel_exit(C, op);
+ ED_workspace_status_text(C, NULL);
+ return OPERATOR_FINISHED;
+ case BEV_MODAL_SEGMENTS_UP:
opdata->segments = opdata->segments + 1;
RNA_int_set(op->ptr, "segments", (int)opdata->segments);
edbm_bevel_calc(op);
@@ -524,11 +670,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
handled = true;
break;
- case WHEELDOWNMOUSE: /* change number of segments */
- case PADMINUS:
- if (event->val == KM_RELEASE)
- break;
-
+ case BEV_MODAL_SEGMENTS_DOWN:
opdata->segments = max_ff(opdata->segments - 1, 1);
RNA_int_set(op->ptr, "segments", (int)opdata->segments);
edbm_bevel_calc(op);
@@ -536,13 +678,9 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
handled = true;
break;
- case MKEY:
- if (event->val == KM_RELEASE)
- break;
-
+ case BEV_MODAL_OFFSET_MODE_CHANGE:
{
- PropertyRNA *prop = RNA_struct_find_property(op->ptr, "offset_type");
- int type = RNA_property_enum_get(op->ptr, prop);
+ int type = RNA_enum_get(op->ptr, "offset_type");
type++;
if (type > BEVEL_AMT_PERCENT) {
type = BEVEL_AMT_OFFSET;
@@ -551,7 +689,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
opdata->value_mode = OFFSET_VALUE_PERCENT;
else if (opdata->value_mode == OFFSET_VALUE_PERCENT && type != BEVEL_AMT_PERCENT)
opdata->value_mode = OFFSET_VALUE;
- RNA_property_enum_set(op->ptr, prop, type);
+ RNA_enum_set(op->ptr, "offset_type", type);
if (opdata->initial_length[opdata->value_mode] == -1.0f)
edbm_bevel_calc_initial_length(op, event, true);
}
@@ -565,96 +703,111 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
edbm_bevel_update_header(C, op);
handled = true;
break;
- case CKEY:
- if (event->val == KM_RELEASE)
- break;
+ case BEV_MODAL_CLAMP_OVERLAP_TOGGLE:
{
- PropertyRNA *prop = RNA_struct_find_property(op->ptr, "clamp_overlap");
- RNA_property_boolean_set(op->ptr, prop, !RNA_property_boolean_get(op->ptr, prop));
- }
- edbm_bevel_calc(op);
- edbm_bevel_update_header(C, op);
- handled = true;
- break;
- case PKEY:
- if (event->val == KM_RELEASE)
+ bool clamp_overlap = RNA_boolean_get(op->ptr, "clamp_overlap");
+ RNA_boolean_set(op->ptr, "clamp_overlap", !clamp_overlap);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
break;
- if (opdata->value_mode == PROFILE_VALUE) {
- opdata->value_mode = OFFSET_VALUE;
- }
- else {
- opdata->value_mode = PROFILE_VALUE;
}
+
+ case BEV_MODAL_VALUE_OFFSET:
+ opdata->value_mode = OFFSET_VALUE;
edbm_bevel_calc_initial_length(op, event, true);
break;
- case SKEY:
- if (event->val == KM_RELEASE)
- break;
- if (opdata->value_mode == SEGMENTS_VALUE) {
- opdata->value_mode = OFFSET_VALUE;
- }
- else {
- opdata->value_mode = SEGMENTS_VALUE;
- }
+
+ case BEV_MODAL_VALUE_PROFILE:
+ opdata->value_mode = PROFILE_VALUE;
edbm_bevel_calc_initial_length(op, event, true);
break;
- case VKEY:
- if (event->val == KM_RELEASE)
- break;
- {
- PropertyRNA *prop = RNA_struct_find_property(op->ptr, "vertex_only");
- RNA_property_boolean_set(op->ptr, prop, !RNA_property_boolean_get(op->ptr, prop));
- }
- edbm_bevel_calc(op);
- edbm_bevel_update_header(C, op);
- handled = true;
+ case BEV_MODAL_VALUE_SEGMENTS:
+ opdata->value_mode = SEGMENTS_VALUE;
+ edbm_bevel_calc_initial_length(op, event, true);
break;
- case UKEY:
- if (event->val == KM_RELEASE)
+
+ case BEV_MODAL_VERTEX_ONLY_TOGGLE:
+ {
+ bool vertex_only = RNA_boolean_get(op->ptr, "vertex_only");
+ RNA_boolean_set(op->ptr, "vertex_only", !vertex_only);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
break;
- else {
+ }
+
+ case BEV_MODAL_MARK_SEAM_TOGGLE:
+ {
bool mark_seam = RNA_boolean_get(op->ptr, "mark_seam");
RNA_boolean_set(op->ptr, "mark_seam", !mark_seam);
edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
handled = true;
break;
}
- case KKEY:
- if (event->val == KM_RELEASE)
- break;
- else {
+
+ case BEV_MODAL_MARK_SHARP_TOGGLE:
+ {
bool mark_sharp = RNA_boolean_get(op->ptr, "mark_sharp");
RNA_boolean_set(op->ptr, "mark_sharp", !mark_sharp);
edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
handled = true;
break;
}
- }
+ case BEV_MODAL_INNER_MITER_CHANGE:
+ {
+ int miter_inner = RNA_enum_get(op->ptr, "miter_inner");
+ miter_inner++;
+ if (miter_inner == BEVEL_MITER_PATCH)
+ miter_inner++; /* no patch option for inner miter */
+ if (miter_inner > BEVEL_MITER_ARC)
+ miter_inner = BEVEL_MITER_SHARP;
+ RNA_enum_set(op->ptr, "miter_inner", miter_inner);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ break;
+ }
- /* Modal numinput inactive, try to handle numeric inputs last... */
- if (!handled && event->val == KM_PRESS && handleNumInput(C, &opdata->num_input[opdata->value_mode], event)) {
- edbm_bevel_numinput_set_value(op);
- edbm_bevel_calc(op);
- edbm_bevel_update_header(C, op);
- return OPERATOR_RUNNING_MODAL;
+ case BEV_MODAL_OUTER_MITER_CHANGE:
+ {
+ int miter_outer = RNA_enum_get(op->ptr, "miter_outer");
+ miter_outer++;
+ if (miter_outer > BEVEL_MITER_ARC)
+ miter_outer = BEVEL_MITER_SHARP;
+ RNA_enum_set(op->ptr, "miter_outer", miter_outer);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ break;
+ }
+
+ case BEV_MODAL_HARDEN_NORMALS_TOGGLE:
+ {
+ bool harden_normals = RNA_boolean_get(op->ptr, "harden_normals");
+ RNA_boolean_set(op->ptr, "harden_normals", !harden_normals);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ break;
+ }
}
}
- return OPERATOR_RUNNING_MODAL;
-}
-
-static void mesh_ot_bevel_offset_range_func(PointerRNA *ptr, PropertyRNA *UNUSED(prop),
- float *min, float *max, float *softmin, float *softmax)
-{
- const int offset_type = RNA_enum_get(ptr, "offset_type");
+ /* Modal numinput inactive, try to handle numeric inputs last... */
+ if (!handled && eval == KM_PRESS && handleNumInput(C, &opdata->num_input[opdata->value_mode], event)) {
+ edbm_bevel_numinput_set_value(op);
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ return OPERATOR_RUNNING_MODAL;
+ }
- *min = -FLT_MAX;
- *max = FLT_MAX;
- *softmin = 0.0f;
- *softmax = (offset_type == BEVEL_AMT_PERCENT) ? 100.0f : 1.0f;
+ return OPERATOR_RUNNING_MODAL;
}
void MESH_OT_bevel(wmOperatorType *ot)
@@ -677,6 +830,19 @@ void MESH_OT_bevel(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem miter_outer_items[] = {
+ {BEVEL_MITER_SHARP, "SHARP", 0, "Sharp", "Outside of miter is sharp"},
+ {BEVEL_MITER_PATCH, "PATCH", 0, "Patch", "Outside of miter is squared-off patch"},
+ {BEVEL_MITER_ARC, "ARC", 0, "Arc", "Outside of miter is arc"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem miter_inner_items[] = {
+ {BEVEL_MITER_SHARP, "SHARP", 0, "Sharp", "Inside of miter is sharp"},
+ {BEVEL_MITER_ARC, "ARC", 0, "Arc", "Inside of miter is arc"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
/* identifiers */
ot->name = "Bevel";
ot->description = "Edge Bevel";
@@ -688,14 +854,20 @@ void MESH_OT_bevel(wmOperatorType *ot)
ot->modal = edbm_bevel_modal;
ot->cancel = edbm_bevel_cancel;
ot->poll = ED_operator_editmesh;
+ ot->poll_property = edbm_bevel_poll_property;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_CURSOR | OPTYPE_BLOCKING;
- RNA_def_enum(ot->srna, "offset_type", offset_type_items, 0, "Amount Type", "What distance Amount measures");
- prop = RNA_def_float(ot->srna, "offset", 0.0f, -1e6f, 1e6f, "Amount", "", 0.0f, 100.0f);
- RNA_def_property_float_array_funcs_runtime(prop, NULL, NULL, mesh_ot_bevel_offset_range_func);
- RNA_def_int(ot->srna, "segments", 1, 1, SEGMENTS_HARD_MAX, "Segments", "Segments for curved edge", 1, 8);
+ RNA_def_enum(ot->srna, "offset_type", offset_type_items, 0, "Width Type", "What distance Width measures");
+ prop = RNA_def_property(ot->srna, "offset", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.0, 1e6);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0, 1, 3);
+ RNA_def_property_ui_text(prop, "Width", "Bevel amount");
+ prop = RNA_def_property(ot->srna, "offset_pct", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_range(prop, 0.0, 100);
+ RNA_def_property_ui_text(prop, "Width Percent", "Bevel amount for percentage method");
+ RNA_def_int(ot->srna, "segments", 1, 1, SEGMENTS_HARD_MAX, "Segments", "Segments for curved edge", 1, 100);
RNA_def_float(ot->srna, "profile", 0.5f, PROFILE_HARD_MIN, 1.0f, "Profile",
"Controls profile shape (0.5 = round)", PROFILE_HARD_MIN, 1.0f);
RNA_def_boolean(ot->srna, "vertex_only", false, "Vertex Only", "Bevel only vertices");
@@ -706,9 +878,16 @@ void MESH_OT_bevel(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "mark_sharp", false, "Mark Sharp", "Mark beveled edges as sharp");
RNA_def_int(ot->srna, "material", -1, -1, INT_MAX, "Material",
"Material for bevel faces (-1 means use adjacent faces)", -1, 100);
- RNA_def_boolean(ot->srna, "harden_normals", false, "Harden Normals", "Match normals of new faces to adjacent faces");
+ RNA_def_boolean(ot->srna, "harden_normals", false, "Harden Normals",
+ "Match normals of new faces to adjacent faces");
RNA_def_enum(ot->srna, "face_strength_mode", face_strength_mode_items, BEVEL_FACE_STRENGTH_NONE,
"Face Strength Mode", "Whether to set face strength, and which faces to set face strength on");
+ RNA_def_enum(ot->srna, "miter_outer", miter_outer_items, BEVEL_MITER_SHARP,
+ "Outer Miter", "Pattern to use for outside of miters");
+ RNA_def_enum(ot->srna, "miter_inner", miter_inner_items, BEVEL_MITER_SHARP,
+ "Inner Miter", "Pattern to use for inside of miters");
+ RNA_def_float(ot->srna, "spread", 0.1f, 0.0f, 1e6f, "Spread",
+ "Amount to spread arcs for arc inner miters", 0.0f, 100.0f);
prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c
index 5b59f1aa5f9..61531109a01 100644
--- a/source/blender/editors/mesh/editmesh_bisect.c
+++ b/source/blender/editors/mesh/editmesh_bisect.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2013 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_bisect.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -404,8 +398,8 @@ void MESH_OT_bisect(struct wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- prop = RNA_def_float_vector(ot->srna, "plane_co", 3, NULL, -1e12f, 1e12f,
- "Plane Point", "A point on the plane", -1e4f, 1e4f);
+ prop = RNA_def_float_vector_xyz(ot->srna, "plane_co", 3, NULL, -1e12f, 1e12f,
+ "Plane Point", "A point on the plane", -1e4f, 1e4f);
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_float_vector(ot->srna, "plane_no", 3, NULL, -1.0f, 1.0f,
"Plane Normal", "The direction the plane points", -1.0f, 1.0f);
@@ -429,7 +423,6 @@ void MESH_OT_bisect(struct wmOperatorType *ot)
#ifdef USE_GIZMO
/* -------------------------------------------------------------------- */
-
/** \name Bisect Gizmo
* \{ */
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index fad8d39e665..ab49a6ce203 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_extrude.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_modifier_types.h"
diff --git a/source/blender/editors/mesh/editmesh_extrude_screw.c b/source/blender/editors/mesh/editmesh_extrude_screw.c
index 589e3987050..4b3a93a2111 100644
--- a/source/blender/editors/mesh/editmesh_extrude_screw.c
+++ b/source/blender/editors/mesh/editmesh_extrude_screw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_extrude_screw.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -49,8 +41,6 @@
#include "ED_screen.h"
#include "ED_view3d.h"
-
-
#include "mesh_intern.h" /* own include */
/* -------------------------------------------------------------------- */
@@ -207,8 +197,8 @@ void MESH_OT_screw(wmOperatorType *ot)
RNA_def_int(ot->srna, "steps", 9, 1, 100000, "Steps", "Steps", 3, 256);
RNA_def_int(ot->srna, "turns", 1, 1, 100000, "Turns", "Turns", 1, 256);
- RNA_def_float_vector(ot->srna, "center", 3, NULL, -1e12f, 1e12f,
- "Center", "Center in global view space", -1e4f, 1e4f);
+ RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -1e12f, 1e12f,
+ "Center", "Center in global view space", -1e4f, 1e4f);
RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f,
"Axis", "Axis in global view space", -1.0f, 1.0f);
}
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c
index 50ea452f7f3..a098751fd21 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_extrude_spin.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_object_types.h"
@@ -208,8 +200,8 @@ void MESH_OT_spin(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_auto_merge", true, "Auto Merge", "Merge first/last when the angle is a full revolution");
RNA_def_boolean(ot->srna, "use_normal_flip", 0, "Flip Normals", "");
- RNA_def_float_vector(ot->srna, "center", 3, NULL, -1e12f, 1e12f,
- "Center", "Center in global view space", -1e4f, 1e4f);
+ RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -1e12f, 1e12f,
+ "Center", "Center in global view space", -1e4f, 1e4f);
RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -1.0f, 1.0f);
WM_gizmogrouptype_append(MESH_GGT_spin);
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
index dd5f97cd010..9884ded4f0a 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_extrude_spin_gizmo.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "BLI_math.h"
@@ -144,7 +140,7 @@ static void gizmo_mesh_spin_init_setup(const bContext *UNUSED(C), wmGizmoGroup *
WM_gizmo_set_scale(gz, scale_button);
gz->color[3] = 0.6f;
- gz->flag |= WM_GIZMO_DRAW_OFFSET_SCALE;
+ gz->flag |= WM_GIZMO_DRAW_OFFSET_SCALE | WM_GIZMO_OPERATOR_TOOL_INIT;
ggd->gizmos.icon_button[i][j] = gz;
}
@@ -247,7 +243,7 @@ static void gizmo_mesh_spin_init_draw_prepare(
Scene *scene = CTX_data_scene(C);
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
switch (orient_slot->type) {
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
if (!equals_m3m3(viewinv_m3, ggd->prev.viewinv_m3)) {
/* Take care calling refresh from draw_prepare,
@@ -442,23 +438,15 @@ static void gizmo_mesh_spin_init_message_subscribe(
.notify = WM_gizmo_do_msg_notify_tag_refresh,
};
- PointerRNA scene_ptr;
- RNA_id_pointer_create(&scene->id, &scene_ptr);
-
- {
- extern PropertyRNA rna_Scene_cursor_location;
- const PropertyRNA *props[] = {
- &rna_Scene_cursor_location,
- };
- for (int i = 0; i < ARRAY_SIZE(props); i++) {
- WM_msg_subscribe_rna(mbus, &scene_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
- }
- }
+ PointerRNA cursor_ptr;
+ RNA_pointer_create(&scene->id, &RNA_View3DCursor, &scene->cursor, &cursor_ptr);
+ /* All cursor properties. */
+ WM_msg_subscribe_rna(mbus, &cursor_ptr, NULL, &msg_sub_value_gz_tag_refresh, __func__);
WM_msg_subscribe_rna_params(
mbus,
&(const wmMsgParams_RNA){
- .ptr = (PointerRNA){.type = gzgroup->type->srna},
+ .ptr = (PointerRNA){ .type = gzgroup->type->srna, },
.prop = ggd->data.gzgt_axis_prop,
},
&msg_sub_value_gz_tag_refresh, __func__);
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index 9eae3d3b564..c63f0db1f2b 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/editors/mesh/editmesh_inset.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -70,6 +64,7 @@ typedef struct {
bool is_modal;
bool shift;
float shift_amount;
+ float max_obj_scale;
NumInput num_input;
InsetObjectStore *ob_store;
@@ -124,7 +119,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
ViewLayer *view_layer = CTX_data_view_layer(C);
if (is_modal) {
- RNA_float_set(op->ptr, "thickness", 0.01f);
+ RNA_float_set(op->ptr, "thickness", 0.0f);
RNA_float_set(op->ptr, "depth", 0.0f);
}
@@ -132,12 +127,16 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
uint objects_used_len = 0;
+ opdata->max_obj_scale = FLT_MIN;
+
{
uint ob_store_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &ob_store_len);
opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__);
for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) {
Object *obedit = objects[ob_index];
+ float scale = mat4_to_scale(obedit->obmat);
+ opdata->max_obj_scale = max_ff(opdata->max_obj_scale, scale);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
if (em->bm->totvertsel > 0) {
opdata->ob_store[objects_used_len].em = em;
@@ -148,7 +147,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
opdata->ob_store_len = objects_used_len;
}
- opdata->old_thickness = 0.01;
+ opdata->old_thickness = 0.0;
opdata->old_depth = 0.0;
opdata->modify_depth = false;
opdata->shift = false;
@@ -241,7 +240,8 @@ static bool edbm_inset_calc(wmOperator *op)
const float thickness = RNA_float_get(op->ptr, "thickness");
const float depth = RNA_float_get(op->ptr, "depth");
const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
- const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */
+ /* not passed onto the BMO */
+ const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset");
const bool use_individual = RNA_boolean_get(op->ptr, "use_individual");
const bool use_interpolate = RNA_boolean_get(op->ptr, "use_interpolate");
@@ -384,9 +384,11 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
mdiff[1] = opdata->mcenter[1] - event->mval[1];
if (opdata->modify_depth)
- amount = opdata->old_depth + ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size);
+ amount = opdata->old_depth +
+ ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) / opdata->max_obj_scale;
else
- amount = opdata->old_thickness - ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size);
+ amount = opdata->old_thickness -
+ ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) / opdata->max_obj_scale;
/* Fake shift-transform... */
if (opdata->shift)
@@ -565,7 +567,7 @@ void MESH_OT_inset(wmOperatorType *ot)
ot->srna, "use_edge_rail",
false, "Edge Rail", "Inset the region along existing edges");
- prop = RNA_def_float_distance(ot->srna, "thickness", 0.01f, 0.0f, 1e12f, "Thickness", "", 0.0f, 10.0f);
+ prop = RNA_def_float_distance(ot->srna, "thickness", 0.0f, 0.0f, 1e12f, "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);
diff --git a/source/blender/editors/mesh/editmesh_intersect.c b/source/blender/editors/mesh/editmesh_intersect.c
index a625d8949a6..08486f28669 100644
--- a/source/blender/editors/mesh/editmesh_intersect.c
+++ b/source/blender/editors/mesh/editmesh_intersect.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_intersect.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -30,7 +26,6 @@
#include "BLI_memarena.h"
#include "BLI_stack.h"
#include "BLI_buffer.h"
-#include "BLI_kdopbvh.h"
#include "BLI_linklist_stack.h"
#include "BKE_layer.h"
@@ -233,7 +228,7 @@ void MESH_OT_intersect(struct wmOperatorType *ot)
"Self intersect selected faces"},
{ISECT_SEL_UNSEL, "SELECT_UNSELECT", 0, "Selected/Unselected",
"Intersect selected with unselected faces"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem isect_separate_items[] = {
@@ -243,7 +238,7 @@ void MESH_OT_intersect(struct wmOperatorType *ot)
"Cut into geometry keeping each side separate (Selected/Unselected only)"},
{ISECT_SEPARATE_NONE, "NONE", 0, "Merge",
"Merge all geometry from the intersection"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -329,7 +324,7 @@ void MESH_OT_intersect_boolean(struct wmOperatorType *ot)
{BMESH_ISECT_BOOLEAN_ISECT, "INTERSECT", 0, "Intersect", ""},
{BMESH_ISECT_BOOLEAN_UNION, "UNION", 0, "Union", ""},
{BMESH_ISECT_BOOLEAN_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -637,8 +632,9 @@ static BMEdge *bm_face_split_edge_find(
ok = false;
}
else if (found_other_face) {
- /* double check that _all_ the faces used by v_pivot's edges are attached to this edge
- * otherwise don't attempt the split since it will give non-deterministic results */
+ /* double check that _all_ the faces used by v_pivot's edges are attached
+ * to this edge otherwise don't attempt the split since it will give
+ * non-deterministic results */
BMLoop *l_radial_iter = l_iter->radial_next;
int other_face_shared = 0;
if (l_radial_iter != l_iter) {
@@ -786,7 +782,8 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op))
dot_test = fabsf(dot_v3v3(e_dir, l->f->no));
if (dot_test < dot_best) {
- /* check we're in the correct corner (works with convex loops too) */
+ /* check we're in the correct corner
+ * (works with convex loops too) */
if (angle_signed_on_axis_v3v3v3_v3(l->prev->v->co, l->v->co, v_other->co, l->f->no) <
angle_signed_on_axis_v3v3v3_v3(l->prev->v->co, l->v->co, l->next->v->co, l->f->no))
{
@@ -881,8 +878,8 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op))
for (int j = 0; j < 2; j++) {
BMVert *v_pivot = (&e->v1)[j];
- /* checking that \a v_pivot isn't in the face
- * prevents attempting to splice the same vertex into an edge from multiple faces */
+ /* checking that \a v_pivot isn't in the face prevents attempting
+ * to splice the same vertex into an edge from multiple faces */
if (!BM_vert_in_face(v_pivot, f)) {
float v_pivot_co[3];
float v_pivot_fac;
@@ -891,7 +888,8 @@ static int edbm_face_split_by_edges_exec(bContext *C, wmOperator *UNUSED(op))
v_pivot_co, &v_pivot_fac);
if (e_split) {
- /* for degenerate cases this vertex may be in one of this edges radial faces */
+ /* for degenerate cases this vertex may be in one
+ * of this edges radial faces */
if (!bm_vert_in_faces_radial(v_pivot, e_split, f)) {
BMEdge *e_new;
BMVert *v_new = BM_edge_split(bm, e_split, e_split->v1, &e_new, v_pivot_fac);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index ca1251ef728..0017044f2ff 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joseph Eagar, Joshua Leung, Howard Trickey,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_knife.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* Interactive editmesh knife tool.
*/
@@ -1457,7 +1449,7 @@ static bool point_is_visible(
/* avoid projecting behind the viewpoint */
if (kcd->is_ortho && (kcd->vc.rv3d->persp != RV3D_CAMOB)) {
- dist = kcd->vc.v3d->far * 2.0f;
+ dist = kcd->vc.v3d->clip_end * 2.0f;
}
if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
@@ -2098,7 +2090,8 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo
knife_project_v2(kcd, kfv->cageco, kfv->sco);
- /* be strict about angle snapping, the vertex needs to be very close to the angle, or we ignore */
+ /* be strict about angle snapping, the vertex needs to be very close to the angle,
+ * or we ignore */
if (kcd->is_angle_snapping) {
if (dist_squared_to_line_segment_v2(kfv->sco, kcd->prev.mval, kcd->curr.mval) > KNIFE_FLT_EPSBIG) {
continue;
@@ -2756,7 +2749,7 @@ wmKeyMap *knifetool_modal_keymap(wmKeyConfig *keyconf)
{KNF_MODAL_NEW_CUT, "NEW_CUT", 0, "End Current Cut", ""},
{KNF_MODAL_ADD_CUT, "ADD_CUT", 0, "Add Cut", ""},
{KNF_MODAL_PANNING, "PANNING", 0, "Panning", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Knife Tool Modal Map");
@@ -3120,7 +3113,8 @@ void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_throug
keep_search = false;
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_TAG) == false && (F_ISECT_IS_UNKNOWN(f))) {
- /* am I connected to a tagged face via an un-tagged edge (ie, not across a cut) */
+ /* am I connected to a tagged face via an un-tagged edge
+ * (ie, not across a cut) */
BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
BMLoop *l_iter = l_first;
bool found = false;
diff --git a/source/blender/editors/mesh/editmesh_knife_project.c b/source/blender/editors/mesh/editmesh_knife_project.c
index a3396f75eaf..13fcb99f59b 100644
--- a/source/blender/editors/mesh/editmesh_knife_project.c
+++ b/source/blender/editors/mesh/editmesh_knife_project.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_knife_project.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_curve_types.h"
@@ -72,12 +65,13 @@ static LinkNode *knifeproject_poly_from_object(const bContext *C, Scene *scene,
me_eval = ob_eval->runtime.mesh_eval;
if (me_eval == NULL) {
Scene *scene_eval = (Scene *)DEG_get_evaluated_id(depsgraph, &scene->id);
- me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
}
me_eval_needs_free = false;
}
else if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
- me_eval = BKE_mesh_new_nomain_from_curve(ob);
+ Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
+ me_eval = BKE_mesh_new_nomain_from_curve(ob_eval);
me_eval_needs_free = true;
}
else {
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 9c5372cafd8..f0c2023dfcc 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,16 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joseph Eagar, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_loopcut.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_object_types.h"
#include "MEM_guardedalloc.h"
-#include "BLI_stack.h"
#include "BLI_string.h"
#include "BLI_math.h"
@@ -221,10 +213,13 @@ static void ringsel_finish(bContext *C, wmOperator *op)
/* XXX Is this piece of code ever used now? Simple loop select is now
* in editmesh_select.c (around line 1000)... */
/* sets as active, useful for other tools */
- if (em->selectmode & SCE_SELECT_VERTEX)
- BM_select_history_store(em->bm, lcd->eed->v1); /* low priority TODO, get vertrex close to mouse */
- if (em->selectmode & SCE_SELECT_EDGE)
+ if (em->selectmode & SCE_SELECT_VERTEX) {
+ /* low priority TODO, get vertrex close to mouse */
+ BM_select_history_store(em->bm, lcd->eed->v1);
+ }
+ if (em->selectmode & SCE_SELECT_EDGE) {
BM_select_history_store(em->bm, lcd->eed);
+ }
EDBM_selectmode_flush(lcd->em);
DEG_id_tag_update(lcd->ob->data, ID_RECALC_SELECT);
@@ -698,7 +693,8 @@ void MESH_OT_loopcut(wmOperatorType *ot)
/* properties */
prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 1000000, "Number of Cuts", "", 1, 100);
- /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
+ /* 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);
prop = RNA_def_float(ot->srna, "smoothness", 0.0f, -1e3f, 1e3f,
diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c
index 91d08953b8a..d16cd639c0d 100644
--- a/source/blender/editors/mesh/editmesh_path.c
+++ b/source/blender/editors/mesh/editmesh_path.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* 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 *****
*/
-/** \file blender/editors/mesh/editmesh_path.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -72,7 +64,8 @@
* \{ */
struct PathSelectParams {
- bool track_active; /* ensure the active element is the last selected item (handy for picking) */
+ /** ensure the active element is the last selected item (handy for picking) */
+ bool track_active;
bool use_topology_distance;
bool use_face_step;
bool use_fill;
@@ -294,7 +287,7 @@ static void edgetag_set_cb(BMEdge *e, bool val, void *user_data_v)
static void edgetag_ensure_cd_flag(Mesh *me, const char edge_mode)
{
- BMesh *bm = me->edit_btmesh->bm;
+ BMesh *bm = me->edit_mesh->bm;
switch (edge_mode) {
case EDGE_MODE_TAG_CREASE:
diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c
index 1d0521ec777..19831e8f380 100644
--- a/source/blender/editors/mesh/editmesh_polybuild.c
+++ b/source/blender/editors/mesh/editmesh_polybuild.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_polybuild.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* Tools to implement polygon building tool,
* an experimental tool for quickly constructing/manipulating faces.
@@ -90,51 +86,23 @@ static void edbm_flag_disable_all_multi(ViewLayer *view_layer, View3D *v3d, cons
/* When accessed as a tool, get the active edge from the preselection gizmo. */
static bool edbm_preselect_or_active(
bContext *C,
+ const View3D *v3d,
Base **r_base,
BMElem **r_ele)
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
ARegion *ar = CTX_wm_region(C);
- wmGizmoMap *gzmap = ar->gizmo_map;
+ const bool show_gizmo = !(
+ (v3d->flag2 & V3D_HIDE_OVERLAYS) ||
+ (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)));
+
+ wmGizmoMap *gzmap = show_gizmo ? ar->gizmo_map : NULL;
wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_mesh_preselect_elem") : NULL;
if (gzgroup != NULL) {
wmGizmo *gz = gzgroup->gizmos.first;
- const int object_index = RNA_int_get(gz->ptr, "object_index");
-
- /* weak, allocate an array just to access the index. */
- Base *base = NULL;
- Object *obedit = NULL;
- {
- uint bases_len;
- Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(view_layer, CTX_wm_view3d(C), &bases_len);
- if (object_index < bases_len) {
- base = bases[object_index];
- obedit = base->object;
- }
- MEM_freeN(bases);
- }
-
- *r_base = base;
- *r_ele = NULL;
-
- if (obedit) {
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
- BMesh *bm = em->bm;
- const int vert_index = RNA_int_get(gz->ptr, "vert_index");
- const int edge_index = RNA_int_get(gz->ptr, "edge_index");
- const int face_index = RNA_int_get(gz->ptr, "face_index");
- if (vert_index != -1) {
- *r_ele = (BMElem *)BM_vert_at_index_find(bm, vert_index);
- }
- else if (edge_index != -1) {
- *r_ele = (BMElem *)BM_edge_at_index_find(bm, edge_index);
- }
- else if (face_index != -1) {
- *r_ele = (BMElem *)BM_face_at_index_find(bm, face_index);
- }
- }
+ ED_view3d_gizmo_mesh_preselect_get_active(C, gz, r_base, r_ele);
}
else {
+ ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = view_layer->basact;
Object *obedit = base->object;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
@@ -152,7 +120,7 @@ static bool edbm_preselect_or_active_init_viewcontext(
BMElem **r_ele)
{
em_setup_viewcontext(C, vc);
- bool ok = edbm_preselect_or_active(C, r_base, r_ele);
+ bool ok = edbm_preselect_or_active(C, vc->v3d, r_base, r_ele);
if (ok) {
ED_view3d_viewcontext_init_object(vc, (*r_base)->object);
}
diff --git a/source/blender/editors/mesh/editmesh_preselect_edgering.c b/source/blender/editors/mesh/editmesh_preselect_edgering.c
index 3b31b9c15f6..9e761713f7e 100644
--- a/source/blender/editors/mesh/editmesh_preselect_edgering.c
+++ b/source/blender/editors/mesh/editmesh_preselect_edgering.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_preselect_edgering.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/mesh/editmesh_preselect_elem.c b/source/blender/editors/mesh/editmesh_preselect_elem.c
index e0b06019de1..827d47a265c 100644
--- a/source/blender/editors/mesh/editmesh_preselect_elem.c
+++ b/source/blender/editors/mesh/editmesh_preselect_elem.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,16 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_preselect_elem.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
-#include "BLI_stack.h"
#include "BLI_math.h"
-#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "GPU_immediate.h"
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index f00973768ed..2117c2bb689 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_rip.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -313,7 +305,8 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
uid = uid_end + bm->totedge;
lp = BLI_array_append_ret(eloop_pairs);
- BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b); /* no need to check, we know this will be true */
+ /* no need to check, we know this will be true */
+ BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b);
BLI_assert(tot == uid_end - uid_start);
@@ -408,7 +401,7 @@ typedef struct UnorderedLoopPair {
} UnorderedLoopPair;
enum {
ULP_FLIP_0 = (1 << 0),
- ULP_FLIP_1 = (1 << 1)
+ ULP_FLIP_1 = (1 << 1),
};
static UnorderedLoopPair *edbm_tagged_loop_pairs_to_fill(BMesh *bm)
@@ -795,7 +788,8 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
if (do_fill) {
/* Only needed when filling...
- * Also, we never want to tag best edge, that one won't change during split. See T44618. */
+ * Also, we never want to tag best edge,
+ * that one won't change during split. See T44618. */
if (larr[larr_len]->e == e_best) {
BM_elem_flag_enable(larr[larr_len]->prev->e, BM_ELEM_TAG);
}
diff --git a/source/blender/editors/mesh/editmesh_rip_edge.c b/source/blender/editors/mesh/editmesh_rip_edge.c
index ef07aac0ab2..e449f96bc05 100644
--- a/source/blender/editors/mesh/editmesh_rip_edge.c
+++ b/source/blender/editors/mesh/editmesh_rip_edge.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_rip_edge.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* based on mouse cursor position, split of vertices along the closest edge.
*/
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index e522c8849c7..80d23f37e71 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* 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 *****
*/
-/** \file blender/editors/mesh/editmesh_select.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -204,7 +196,8 @@ void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag)
/** \name Back-Buffer OpenGL Selection
* \{ */
-unsigned int bm_solidoffs = 0, bm_wireoffs = 0, bm_vertoffs = 0; /* set in drawobject.c ... for colorindices */
+/* set in drawobject.c ... for colorindices */
+unsigned int bm_solidoffs = 0, bm_wireoffs = 0, bm_vertoffs = 0;
/* facilities for box select and circle select */
static BLI_bitmap *selbuf = NULL;
@@ -1161,16 +1154,13 @@ bool EDBM_unified_findnearest_from_raycast(
if ((BM_elem_flag_test(e, BM_ELEM_HIDDEN) == false) &&
(BM_edge_is_boundary(e)))
{
- float depth;
-
if (use_vert) {
for (uint j = 0; j < 2; j++) {
BMVert *v = *((&e->v1) + j);
float point[3];
mul_v3_m4v3(point, obedit->obmat, coords ? coords[BM_elem_index_get(v)] : v->co);
- const float dist_sq_test = dist_squared_to_ray_v3(
- ray_origin, ray_direction,
- point, &depth);
+ const float dist_sq_test = dist_squared_to_ray_v3_normalized(
+ ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best) {
dist_sq_best = dist_sq_test;
best.base_index = base_index;
@@ -1194,9 +1184,8 @@ bool EDBM_unified_findnearest_from_raycast(
mid_v3_v3v3(point, e->v1->co, e->v2->co);
}
mul_m4_v3(obedit->obmat, point);
- const float dist_sq_test = dist_squared_to_ray_v3(
- ray_origin, ray_direction,
- point, &depth);
+ const float dist_sq_test = dist_squared_to_ray_v3_normalized(
+ ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best) {
dist_sq_best = dist_sq_test;
best.base_index = base_index;
@@ -1216,10 +1205,8 @@ bool EDBM_unified_findnearest_from_raycast(
if (BM_elem_flag_test(v, BM_ELEM_HIDDEN) == false) {
float point[3];
mul_v3_m4v3(point, obedit->obmat, v->co);
- float depth;
- const float dist_sq_test = dist_squared_to_ray_v3(
- ray_origin, ray_direction,
- v->co, &depth);
+ const float dist_sq_test = dist_squared_to_ray_v3_normalized(
+ ray_origin, ray_direction, v->co);
if (dist_sq_test < dist_sq_best) {
dist_sq_best = dist_sq_test;
best.base_index = base_index;
@@ -1241,10 +1228,8 @@ bool EDBM_unified_findnearest_from_raycast(
mid_v3_v3v3(point, e->v1->co, e->v2->co);
}
mul_m4_v3(obedit->obmat, point);
- float depth;
- const float dist_sq_test = dist_squared_to_ray_v3(
- ray_origin, ray_direction,
- point, &depth);
+ const float dist_sq_test = dist_squared_to_ray_v3_normalized(
+ ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best) {
dist_sq_best = dist_sq_test;
best.base_index = base_index;
@@ -1268,10 +1253,8 @@ bool EDBM_unified_findnearest_from_raycast(
BM_face_calc_center_median(f, point);
}
mul_m4_v3(obedit->obmat, point);
- float depth;
- const float dist_sq_test = dist_squared_to_ray_v3(
- ray_origin, ray_direction,
- point, &depth);
+ const float dist_sq_test = dist_squared_to_ray_v3_normalized(
+ ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best) {
dist_sq_best = dist_sq_test;
best.base_index = base_index;
@@ -1466,7 +1449,7 @@ void MESH_OT_select_mode(wmOperatorType *ot)
{0, "DISABLE", 0, "Disable", "Disable selected markers"},
{1, "ENABLE", 0, "Enable", "Enable selected markers"},
{2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2245,7 +2228,8 @@ void EDBM_selectmode_set(BMEditMesh *em)
em->bm->selectmode = em->selectmode;
- edbm_strip_selections(em); /* strip BMEditSelections from em->selected that are not relevant to new mode */
+ /* strip BMEditSelections from em->selected that are not relevant to new mode */
+ edbm_strip_selections(em);
if (em->bm->totvertsel == 0 &&
em->bm->totedgesel == 0 &&
@@ -3329,7 +3313,7 @@ void MESH_OT_select_face_by_sides(wmOperatorType *ot)
{1, "EQUAL", 0, "Equal To", ""},
{2, "GREATER", 0, "Greater Than", ""},
{3, "NOTEQUAL", 0, "Not Equal To", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3621,7 +3605,7 @@ void MESH_OT_select_less(wmOperatorType *ot)
* \{ */
/**
- * Check if we're connected to another selected efge.
+ * Check if we're connected to another selected edge.
*/
static bool bm_edge_is_select_isolated(BMEdge *e)
{
@@ -4447,7 +4431,7 @@ void MESH_OT_select_axis(wmOperatorType *ot)
{SELECT_AXIS_POS, "POS", 0, "Positive Axis", ""},
{SELECT_AXIS_NEG, "NEG", 0, "Negative Axis", ""},
{SELECT_AXIS_ALIGN, "ALIGN", 0, "Aligned Axis", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -4463,7 +4447,7 @@ void MESH_OT_select_axis(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- RNA_def_enum(ot->srna, "orientation", rna_enum_transform_orientation_items, V3D_MANIP_LOCAL, "Axis Mode", "Axis orientation");
+ RNA_def_enum(ot->srna, "orientation", rna_enum_transform_orientation_items, V3D_ORIENT_LOCAL, "Axis Mode", "Axis orientation");
RNA_def_enum(ot->srna, "sign", axis_sign_items, SELECT_AXIS_POS, "Axis Sign", "Side to select");
RNA_def_enum(ot->srna, "axis", rna_enum_axis_xyz_items, 0, "Axis", "Select the axis to compare each vertex on");
RNA_def_float(ot->srna, "threshold", 0.0001f, 0.000001f, 50.0f, "Threshold", "", 0.00001f, 10.0f);
diff --git a/source/blender/editors/mesh/editmesh_select_similar.c b/source/blender/editors/mesh/editmesh_select_similar.c
index 55e79761681..c9dea33dc78 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* 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 *****
*/
-/** \file blender/editors/mesh/editmesh_select_similar.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -64,7 +56,7 @@ static const EnumPropertyItem prop_similar_compare_types[] = {
{SIM_CMP_GT, "GREATER", 0, "Greater", ""},
{SIM_CMP_LT, "LESS", 0, "Less", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_similar_types[] = {
@@ -97,7 +89,7 @@ static const EnumPropertyItem prop_similar_types[] = {
{SIMFACE_FREESTYLE, "FREESTYLE_FACE", 0, "Freestyle Face Marks", ""},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int mesh_select_similar_compare_int(const int delta, const int compare)
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 0a78fa0fafe..23814d4038b 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_tools.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include <stddef.h>
@@ -46,7 +38,6 @@
#include "BLI_listbase.h"
#include "BLI_linklist.h"
#include "BLI_linklist_stack.h"
-#include "BLI_noise.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_sort_utils.h"
@@ -150,7 +141,7 @@ static const EnumPropertyItem prop_mesh_cornervert_types[] = {
{SUBD_CORNER_PATH, "PATH", 0, "Path", ""},
{SUBD_CORNER_STRAIGHT_CUT, "STRAIGHT_CUT", 0, "Straight Cut", ""},
{SUBD_CORNER_FAN, "FAN", 0, "Fan", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
void MESH_OT_subdivide(wmOperatorType *ot)
@@ -171,7 +162,8 @@ void MESH_OT_subdivide(wmOperatorType *ot)
/* properties */
prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 100, "Number of Cuts", "", 1, 10);
- /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
+ /* 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);
RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, 1e3f, "Smoothness", "Smoothness factor", 0.0f, 1.0f);
@@ -214,7 +206,7 @@ static void mesh_operator_edgering_props(wmOperatorType *ot, const int cuts_min,
{SUBD_RING_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
{SUBD_RING_INTERP_PATH, "PATH", 0, "Blend Path", ""},
{SUBD_RING_INTERP_SURF, "SURFACE", 0, "Blend Surface", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -499,7 +491,7 @@ void MESH_OT_delete(wmOperatorType *ot)
{MESH_DELETE_FACE, "FACE", 0, "Faces", ""},
{MESH_DELETE_EDGE_FACE, "EDGE_FACE", 0, "Only Edges & Faces", ""},
{MESH_DELETE_ONLY_FACE, "ONLY_FACE", 0, "Only Faces", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1005,10 +997,16 @@ static int edbm_mark_seam_exec(bContext *C, wmOperator *op)
BM_elem_flag_enable(eed, BM_ELEM_SEAM);
}
}
+ }
- ED_uvedit_live_unwrap(scene, obedit);
+ ED_uvedit_live_unwrap(scene, objects, objects_len);
+
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object *obedit = objects[ob_index];
+ BMEditMesh *em = BKE_editmesh_from_object(obedit);
EDBM_update_generic(em, true, false);
}
+
MEM_freeN(objects);
return OPERATOR_FINISHED;
@@ -1173,7 +1171,8 @@ static bool edbm_connect_vert_pair(BMEditMesh *em, wmOperator *op)
len = 0;
}
else {
- EDBM_selectmode_flush(em); /* so newly created edges get the selection state from the vertex */
+ /* so newly created edges get the selection state from the vertex */
+ EDBM_selectmode_flush(em);
EDBM_update_generic(em, true, true);
}
@@ -1906,7 +1905,8 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
EDBM_op_init(em, &bmop, op, "rotate_edges edges=%he use_ccw=%b", BM_ELEM_TAG, use_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 */
+ * since this means the edges become selected around the face
+ * which then attempt to rotate */
BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "edges", BM_EDGE, BM_ELEM_SELECT, true);
BMO_op_exec(em->bm, &bmop);
@@ -1984,6 +1984,7 @@ static int edbm_hide_exec(bContext *C, wmOperator *op)
{
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
ViewLayer *view_layer = CTX_data_view_layer(C);
+ bool changed = false;
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
@@ -1992,18 +1993,28 @@ static int edbm_hide_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
- if ((bm->totvertsel == 0) &&
- (bm->totedgesel == 0) &&
- (bm->totfacesel == 0))
- {
- continue;
+ if (unselected) {
+ if (bm->totvertsel == bm->totvert) {
+ continue;
+ }
+ }
+ else {
+ if (bm->totvertsel == 0) {
+ continue;
+ }
}
- EDBM_mesh_hide(em, unselected);
- EDBM_update_generic(em, true, false);
+ if (EDBM_mesh_hide(em, unselected)) {
+ EDBM_update_generic(em, true, false);
+ changed = true;
+ }
}
-
MEM_freeN(objects);
+
+ if (!changed) {
+ return OPERATOR_CANCELLED;
+ }
+
return OPERATOR_FINISHED;
}
@@ -2042,8 +2053,9 @@ static int edbm_reveal_exec(bContext *C, wmOperator *op)
Object *obedit = objects[ob_index];
BMEditMesh *em = BKE_editmesh_from_object(obedit);
- EDBM_mesh_reveal(em, select);
- EDBM_update_generic(em, true, false);
+ if (EDBM_mesh_reveal(em, select)) {
+ EDBM_update_generic(em, true, false);
+ }
}
MEM_freeN(objects);
@@ -2121,7 +2133,7 @@ void MESH_OT_normals_make_consistent(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Smooth Vertex Operator
+/** \name Smooth Vertices Operator
* \{ */
static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
@@ -2206,7 +2218,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
void MESH_OT_vertices_smooth(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Smooth Vertex";
+ ot->name = "Smooth Vertices";
ot->description = "Flatten angles of selected vertices";
ot->idname = "MESH_OT_vertices_smooth";
@@ -2217,7 +2229,7 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- ot->prop = RNA_def_float(ot->srna, "factor", 0.5f, -10.0f, 10.0f, "Smoothing", "Smoothing factor", 0.0f, 1.0f);
+ ot->prop = RNA_def_float_factor(ot->srna, "factor", 0.5f, -10.0f, 10.0f, "Smoothing", "Smoothing factor", 0.0f, 1.0f);
RNA_def_int(ot->srna, "repeat", 1, 1, 1000, "Repeat", "Number of times to smooth the mesh", 1, 100);
WM_operatortype_props_advanced_begin(ot);
@@ -2230,7 +2242,7 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Laplacian Vertex Smooth Operator
+/** \name Laplacian Smooth Vertices Operator
* \{ */
static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
@@ -2327,7 +2339,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Laplacian Smooth Vertex";
+ ot->name = "Laplacian Smooth Vertices";
ot->description = "Laplacian smooth of selected vertices";
ot->idname = "MESH_OT_vertices_smooth_laplacian";
@@ -2836,7 +2848,7 @@ static const EnumPropertyItem merge_type_items[] = {
{MESH_MERGE_CENTER, "CENTER", 0, "At Center", ""},
{MESH_MERGE_CURSOR, "CURSOR", 0, "At Cursor", ""},
{MESH_MERGE_COLLAPSE, "COLLAPSE", 0, "Collapse", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
@@ -2882,7 +2894,8 @@ static const EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(
return item;
}
- return NULL;
+ /* Get all items e.g. when creating keymap item. */
+ return merge_type_items;
}
void MESH_OT_merge(wmOperatorType *ot)
@@ -3055,7 +3068,7 @@ static int edbm_shape_propagate_to_all_exec(bContext *C, wmOperator *op)
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
Mesh *me = obedit->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
if (em->bm->totvertsel == 0) {
continue;
@@ -3116,7 +3129,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
Mesh *me_ref = obedit_ref->data;
Key *key_ref = me_ref->key;
KeyBlock *kb_ref = NULL;
- BMEditMesh *em_ref = me_ref->edit_btmesh;
+ BMEditMesh *em_ref = me_ref->edit_mesh;
BMVert *eve;
BMIter iter;
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -3152,7 +3165,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
Mesh *me = obedit->data;
Key *key = me->key;
KeyBlock *kb = NULL;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
int shape;
if (em->bm->totvertsel == 0) {
@@ -3354,26 +3367,6 @@ void MESH_OT_solidify(wmOperatorType *ot)
/** \name Knife Subdivide Operator
* \{ */
-/* ******************************************************************** */
-/* Knife Subdivide Tool. Subdivides edges intersected by a mouse trail
- * drawn by user.
- *
- * Currently mapped to KKey when in MeshEdit mode.
- * Usage:
- * - Hit Shift K, Select Centers or Exact
- * - Hold LMB down to draw path, hit RETKEY.
- * - ESC cancels as expected.
- *
- * Contributed by Robert Wenzlaff (Det. Thorn).
- *
- * 2.5 Revamp:
- * - non modal (no menu before cutting)
- * - exit on mouse release
- * - polygon/segment drawing can become handled by WM cb later
- *
- * bmesh port version
- */
-
#define KNIFE_EXACT 1
#define KNIFE_MIDPOINT 2
#define KNIFE_MULTICUT 3
@@ -3382,7 +3375,7 @@ static const EnumPropertyItem knife_items[] = {
{KNIFE_EXACT, "EXACT", 0, "Exact", ""},
{KNIFE_MIDPOINT, "MIDPOINTS", 0, "Midpoints", ""},
{KNIFE_MULTICUT, "MULTICUT", 0, "Multicut", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* bm_edge_seg_isect() Determines if and where a mouse trail intersects an BMEdge */
@@ -3464,8 +3457,10 @@ static float bm_edge_seg_isect(
y12 = mouse_path[i][1];
/* Perp. Distance from point to line */
- if (m2 != MAXSLOPE) dist = (y12 - m2 * x12 - b2); /* /sqrt(m2 * m2 + 1); Only looking for */
- /* change in sign. Skip extra math */
+ if (m2 != MAXSLOPE) {
+ /* sqrt(m2 * m2 + 1); Only looking for change in sign. Skip extra math .*/
+ dist = (y12 - m2 * x12 - b2);
+ }
else dist = x22 - x12;
if (i == 0) lastdist = dist;
@@ -3592,7 +3587,8 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
/* TODO, investigate using index lookup for screen_vert_coords() rather then a hash table */
- /* the floating point coordinates of verts in screen space will be stored in a hash table according to the vertices pointer */
+ /* the floating point coordinates of verts in screen space will be
+ * stored in a hash table according to the vertices pointer */
screen_vert_coords = sco = MEM_mallocN(bm->totvert * sizeof(float) * 2, __func__);
BM_ITER_MESH_INDEX (bv, &iter, bm, BM_VERTS_OF_MESH, i) {
@@ -3712,10 +3708,10 @@ static Base *mesh_separate_tagged(Main *bmain, Scene *scene, ViewLayer *view_lay
&((struct BMeshCreateParams){.use_toolflags = true,}));
BM_mesh_elem_toolflags_ensure(bm_new); /* needed for 'duplicate' bmo */
- 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);
- CustomData_copy(&bm_old->ldata, &bm_new->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
- CustomData_copy(&bm_old->pdata, &bm_new->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
+ CustomData_copy(&bm_old->vdata, &bm_new->vdata, CD_MASK_BMESH.vmask, CD_CALLOC, 0);
+ CustomData_copy(&bm_old->edata, &bm_new->edata, CD_MASK_BMESH.emask, CD_CALLOC, 0);
+ CustomData_copy(&bm_old->ldata, &bm_new->ldata, CD_MASK_BMESH.lmask, CD_CALLOC, 0);
+ CustomData_copy(&bm_old->pdata, &bm_new->pdata, CD_MASK_BMESH.pmask, CD_CALLOC, 0);
CustomData_bmesh_init_pool(&bm_new->vdata, bm_mesh_allocsize_default.totvert, BM_VERT);
CustomData_bmesh_init_pool(&bm_new->edata, bm_mesh_allocsize_default.totedge, BM_EDGE);
@@ -3723,8 +3719,12 @@ static Base *mesh_separate_tagged(Main *bmain, Scene *scene, ViewLayer *view_lay
CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE);
base_new = ED_object_add_duplicate(bmain, scene, view_layer, base_old, USER_DUP_MESH);
- /* DAG_relations_tag_update(bmain); */ /* normally would call directly after but in this case delay recalc */
- assign_matarar(bmain, base_new->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
+
+ /* normally would call directly after but in this case delay recalc */
+ /* DAG_relations_tag_update(bmain); */
+
+ /* new in 2.5 */
+ assign_matarar(bmain, base_new->object, give_matarar(obedit), *give_totcolp(obedit));
ED_object_base_select(base_new, BA_SELECT);
@@ -3743,7 +3743,7 @@ static Base *mesh_separate_tagged(Main *bmain, Scene *scene, ViewLayer *view_lay
BM_mesh_bm_to_me(bmain, bm_new, base_new->object->data, (&(struct BMeshToMeshParams){0}));
BM_mesh_free(bm_new);
- ((Mesh *)base_new->object->data)->edit_btmesh = NULL;
+ ((Mesh *)base_new->object->data)->edit_mesh = NULL;
return base_new;
}
@@ -4088,7 +4088,7 @@ void MESH_OT_separate(wmOperatorType *ot)
{MESH_SEPARATE_SELECTED, "SELECTED", 0, "Selection", ""},
{MESH_SEPARATE_MATERIAL, "MATERIAL", 0, "By Material", ""},
{MESH_SEPARATE_LOOSE, "LOOSE", 0, "By loose parts", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -4375,7 +4375,11 @@ static int edbm_fill_grid_exec(bContext *C, wmOperator *op)
int span;
int offset;
- if (RNA_property_is_set(op->ptr, prop_span)) {
+ /* Only reuse on redo because these settings need to match the current selection.
+ * We never want to use them on other geometry, repeat last for eg, see: T60777. */
+ if ((op->flag & OP_IS_REPEAT) &&
+ RNA_property_is_set(op->ptr, prop_span))
+ {
span = RNA_property_int_get(op->ptr, prop_span);
span = min_ii(span, (clamp / 2) - 1);
calc_span = false;
@@ -4650,7 +4654,8 @@ void MESH_OT_poke(wmOperatorType *ot)
{BMOP_POKE_MEDIAN_WEIGHTED, "MEDIAN_WEIGHTED", 0, "Weighted Median", "Weighted median face center"},
{BMOP_POKE_MEDIAN, "MEDIAN", 0, "Median", "Median face center"},
{BMOP_POKE_BOUNDS, "BOUNDS", 0, "Bounds", "Face bounds center"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
@@ -5662,7 +5667,8 @@ static void sort_bmelem_flag(
float fact = reverse ? -1.0 : 1.0;
int coidx = (action == SRT_VIEW_ZAXIS) ? 2 : 0;
- mul_m4_m4m4(mat, rv3d->viewmat, ob->obmat); /* Apply the view matrix to the object matrix. */
+ /* Apply the view matrix to the object matrix. */
+ mul_m4_m4m4(mat, rv3d->viewmat, ob->obmat);
if (totelem[0]) {
pb = pblock[0] = MEM_callocN(sizeof(char) * totelem[0], "sort_bmelem vert pblock");
@@ -5801,9 +5807,11 @@ static void sort_bmelem_flag(
float srt = reverse ? (float)(MAXMAT - fa->mat_nr) : (float)fa->mat_nr;
pb[i] = false;
sb[affected[2]].org_idx = i;
- /* Multiplying with totface and adding i ensures us we keep current order for all faces of same mat. */
+ /* Multiplying with totface and adding i ensures us
+ * we keep current order for all faces of same mat. */
sb[affected[2]++].srt = srt * ((float)totelem[2]) + ((float)i);
-/* printf("e: %d; srt: %f; final: %f\n", i, srt, srt * ((float)totface) + ((float)i));*/
+ // printf("e: %d; srt: %f; final: %f\n",
+ // i, srt, srt * ((float)totface) + ((float)i));
}
else {
pb[i] = true;
@@ -6385,7 +6393,7 @@ void MESH_OT_bridge_edge_loops(wmOperatorType *ot)
{MESH_BRIDGELOOP_SINGLE, "SINGLE", 0, "Open Loop", ""},
{MESH_BRIDGELOOP_CLOSED, "CLOSED", 0, "Closed Loop", ""},
{MESH_BRIDGELOOP_PAIRS, "PAIRS", 0, "Loop Pairs", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -7128,7 +7136,7 @@ wmKeyMap *point_normals_modal_keymap(wmKeyConfig *keyconf)
"Set new 3D cursor position and use it"},
{EDBM_CLNOR_MODAL_POINTTO_SET_USE_SELECTED, "SET_USE_SELECTED", 0, "Select and Use Mesh Item",
"Select new active mesh element and use its location"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const char *keymap_name = "Custom Normals Modal Map";
@@ -7158,7 +7166,7 @@ static EnumPropertyItem clnors_pointto_mode_items[] = {
{EDBM_CLNOR_POINTTO_MODE_COORDINATES, "COORDINATES", 0, "Coordinates",
"Use static coordinates (defined by various means)"},
{EDBM_CLNOR_POINTTO_MODE_MOUSE, "MOUSE", 0, "Mouse", "Follow mouse cursor"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Initialize loop normal data */
@@ -7261,7 +7269,10 @@ static void point_normals_apply(bContext *C, wmOperator *op, float target[3], co
float spherized_normal[3];
sub_v3_v3v3(spherized_normal, target, lnor_ed->loc);
- normalize_v3(spherized_normal); /* otherwise, multiplication by strength is meaningless... */
+
+ /* otherwise, multiplication by strength is meaningless... */
+ normalize_v3(spherized_normal);
+
mul_v3_fl(spherized_normal, strength);
mul_v3_v3fl(lnor_ed->nloc, lnor_ed->niloc, 1.0f - strength);
add_v3_v3(lnor_ed->nloc, spherized_normal);
@@ -7347,7 +7358,8 @@ static int edbm_point_normals_modal(bContext *C, wmOperator *op, const wmEvent *
case EDBM_CLNOR_MODAL_POINTTO_USE_MOUSE:
new_mode = EDBM_CLNOR_POINTTO_MODE_MOUSE;
- force_mousemove = true; /* We want to immediately update to mouse cursor position... */
+ /* We want to immediately update to mouse cursor position... */
+ force_mousemove = true;
ret = OPERATOR_RUNNING_MODAL;
break;
@@ -7368,7 +7380,9 @@ static int edbm_point_normals_modal(bContext *C, wmOperator *op, const wmEvent *
new_mode = EDBM_CLNOR_POINTTO_MODE_COORDINATES;
view3d_operator_needs_opengl(C);
if (EDBM_select_pick(C, event->mval, false, false, false)) {
- ED_object_calc_active_center_for_editmode(obedit, false, target); /* Point to newly selected active. */
+ /* Point to newly selected active. */
+ ED_object_calc_active_center_for_editmode(obedit, false, target);
+
add_v3_v3(target, obedit->loc);
ret = OPERATOR_RUNNING_MODAL;
}
@@ -7491,7 +7505,8 @@ static int edbm_point_normals_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* Note that 'mode' is ignored in exec case, we directly use vector stored in target_location, whatever that is. */
+ /* Note that 'mode' is ignored in exec case,
+ * we directly use vector stored in target_location, whatever that is. */
float target[3];
RNA_float_get_array(op->ptr, "target_location", target);
@@ -7555,8 +7570,8 @@ void MESH_OT_point_normals(struct wmOperatorType *ot)
RNA_def_boolean(ot->srna, "align", false, "Align", "Make all affected normals parallel");
- RNA_def_float_vector(ot->srna, "target_location", 3, NULL, -FLT_MAX, FLT_MAX,
- "Target", "Target location to which normals will point", -1000.0f, 1000.0f);
+ RNA_def_float_vector_xyz(ot->srna, "target_location", 3, NULL, -FLT_MAX, FLT_MAX,
+ "Target", "Target location to which normals will point", -1000.0f, 1000.0f);
RNA_def_boolean(ot->srna, "spherize", false,
"Spherize", "Interpolate between original and new normals");
@@ -7767,7 +7782,7 @@ static EnumPropertyItem average_method_items[] = {
{EDBM_CLNOR_AVERAGE_LOOP, "CUSTOM_NORMAL", 0, "Custom Normal", "Take Average of vert Normals"},
{EDBM_CLNOR_AVERAGE_FACE_AREA, "FACE_AREA", 0, "Face Area", "Set all vert normals by Face Area"},
{EDBM_CLNOR_AVERAGE_ANGLE, "CORNER_ANGLE", 0, "Corner Angle", "Set all vert normals by Corner Angle"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int edbm_average_normals_exec(bContext *C, wmOperator *op)
@@ -7964,7 +7979,7 @@ static EnumPropertyItem normal_vector_tool_items[] = {
{EDBM_CLNOR_TOOLS_ADD, "ADD", 0, "Add Normal", "Add normal vector with selection"},
{EDBM_CLNOR_TOOLS_MULTIPLY, "MULTIPLY", 0, "Multiply Normal", "Multiply normal vector with selection"},
{EDBM_CLNOR_TOOLS_RESET, "RESET", 0, "Reset Normal", "Reset buffer and/or normal of selected element"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int edbm_normals_tools_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c
index 9b24157e4d9..e22addd614e 100644
--- a/source/blender/editors/mesh/editmesh_undo.c
+++ b/source/blender/editors/mesh/editmesh_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_undo.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -34,7 +30,6 @@
#include "BLI_listbase.h"
#include "BLI_array_utils.h"
-#include "BLI_alloca.h"
#include "BKE_context.h"
#include "BKE_key.h"
@@ -514,7 +509,7 @@ static void *undomesh_from_editmesh(UndoMesh *um, BMEditMesh *em, Key *key)
NULL, em->bm, &um->me, (&(struct BMeshToMeshParams){
/* Undo code should not be manipulating 'G_MAIN->object' hooks/vertex-parent. */
.calc_object_remap = false,
- .cd_mask_extra = CD_MASK_SHAPE_KEYINDEX,
+ .cd_mask_extra = {.vmask=CD_MASK_SHAPE_KEYINDEX},
}));
um->selectmode = em->selectmode;
@@ -667,7 +662,7 @@ static Object *editmesh_object_from_context(bContext *C)
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_MESH) {
Mesh *me = obedit->data;
- if (me->edit_btmesh != NULL) {
+ if (me->edit_mesh != NULL) {
return obedit;
}
}
@@ -700,13 +695,15 @@ static bool mesh_undosys_poll(bContext *C)
return editmesh_object_from_context(C) != NULL;
}
-static bool mesh_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool mesh_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
MeshUndoStep *us = (MeshUndoStep *)us_p;
+ /* Important not to use the 3D view when getting objects because all objects
+ * outside of this list will be moved out of edit-mode when reading back undo steps. */
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, NULL, &objects_len);
us->elems = MEM_callocN(sizeof(*us->elems) * objects_len, __func__);
us->elems_len = objects_len;
@@ -717,32 +714,33 @@ static bool mesh_undosys_step_encode(struct bContext *C, UndoStep *us_p)
elem->obedit_ref.ptr = ob;
Mesh *me = elem->obedit_ref.ptr->data;
- undomesh_from_editmesh(&elem->data, me->edit_btmesh, me->key);
+ undomesh_from_editmesh(&elem->data, me->edit_mesh, me->key);
us->step.data_size += elem->data.undo_size;
}
MEM_freeN(objects);
return true;
}
-static void mesh_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void mesh_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(mesh_undosys_poll(C));
-
MeshUndoStep *us = (MeshUndoStep *)us_p;
+ /* Load all our objects into edit-mode, clear everything else. */
+ ED_undo_object_editmode_restore_helper(C, &us->elems[0].obedit_ref.ptr, us->elems_len, sizeof(*us->elems));
+
+ BLI_assert(mesh_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
MeshUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;
Mesh *me = obedit->data;
- if (me->edit_btmesh == NULL) {
+ if (me->edit_mesh == NULL) {
/* Should never fail, may not crash but can give odd behavior. */
CLOG_ERROR(&LOG, "name='%s', failed to enter edit-mode for object '%s', undo state invalid",
us_p->name, obedit->id.name);
continue;
}
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
undomesh_to_editmesh(&elem->data, em, obedit->data);
DEG_id_tag_update(&obedit->id, ID_RECALC_GEOMETRY);
}
@@ -794,7 +792,6 @@ void ED_mesh_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = mesh_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(MeshUndoStep);
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 6c4e82f5b71..ed6ab38e5ab 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/editmesh_utils.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -305,26 +297,26 @@ void EDBM_mesh_make(Object *ob, const int select_mode, const bool add_key_index)
me, ob, add_key_index,
&((struct BMeshCreateParams){.use_toolflags = true,}));
- if (me->edit_btmesh) {
+ if (me->edit_mesh) {
/* this happens when switching shape keys */
- EDBM_mesh_free(me->edit_btmesh);
- MEM_freeN(me->edit_btmesh);
+ EDBM_mesh_free(me->edit_mesh);
+ MEM_freeN(me->edit_mesh);
}
/* currently executing operators re-tessellates, so we can avoid doing here
* but at some point it may need to be added back. */
#if 0
- me->edit_btmesh = BKE_editmesh_create(bm, true);
+ me->edit_mesh = BKE_editmesh_create(bm, true);
#else
- me->edit_btmesh = BKE_editmesh_create(bm, false);
+ me->edit_mesh = BKE_editmesh_create(bm, false);
#endif
- me->edit_btmesh->selectmode = me->edit_btmesh->bm->selectmode = select_mode;
- me->edit_btmesh->mat_nr = (ob->actcol > 0) ? ob->actcol - 1 : 0;
- me->edit_btmesh->ob = ob;
+ me->edit_mesh->selectmode = me->edit_mesh->bm->selectmode = select_mode;
+ me->edit_mesh->mat_nr = (ob->actcol > 0) ? ob->actcol - 1 : 0;
+ me->edit_mesh->ob = ob;
/* we need to flush selection because the mode may have changed from when last in editmode */
- EDBM_selectmode_flush(me->edit_btmesh);
+ EDBM_selectmode_flush(me->edit_mesh);
}
/**
@@ -334,7 +326,7 @@ void EDBM_mesh_make(Object *ob, const int select_mode, const bool add_key_index)
void EDBM_mesh_load(Main *bmain, Object *ob)
{
Mesh *me = ob->data;
- BMesh *bm = me->edit_btmesh->bm;
+ BMesh *bm = me->edit_mesh->bm;
/* Workaround for T42360, 'ob->shapenr' should be 1 in this case.
* however this isn't synchronized between objects at the moment. */
@@ -363,7 +355,7 @@ void EDBM_mesh_load(Main *bmain, Object *ob)
* cycles.
*/
#if 0
- for (Object *other_object = bmain->object.first;
+ for (Object *other_object = bmain->objects.first;
other_object != NULL;
other_object = other_object->id.next)
{
@@ -802,7 +794,8 @@ UvElementMap *BM_uv_element_map_create(
island_number = MEM_mallocN(sizeof(*island_number) * totfaces, "uv_island_number_face");
copy_vn_i(island_number, totfaces, INVALID_ISLAND);
- /* at this point, every UvElement in vert points to a UvElement sharing the same vertex. Now we should sort uv's in islands. */
+ /* 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++) {
if (element_map->buf[i].island == INVALID_ISLAND) {
element_map->buf[i].island = nislands;
@@ -821,7 +814,8 @@ UvElementMap *BM_uv_element_map_create(
initelement = element;
if (element->l->f == efa) {
- /* found the uv corresponding to our face and vertex. Now fill it to the buffer */
+ /* found the uv corresponding to our face and vertex.
+ * Now fill it to the buffer */
element->island = nislands;
map[element - element_map->buf] = islandbufsize;
islandbuf[islandbufsize].l = element->l;
@@ -1204,14 +1198,13 @@ void EDBM_verts_mirror_apply(BMEditMesh *em, const int sel_from, const int sel_t
* \{ */
/* swap is 0 or 1, if 1 it hides not selected */
-void EDBM_mesh_hide(BMEditMesh *em, bool swap)
+bool EDBM_mesh_hide(BMEditMesh *em, bool swap)
{
BMIter iter;
BMElem *ele;
int itermode;
char hflag_swap = swap ? BM_ELEM_SELECT : 0;
-
- if (em == NULL) return;
+ bool changed = true;
if (em->selectmode & SCE_SELECT_VERTEX)
itermode = BM_VERTS_OF_MESH;
@@ -1221,14 +1214,22 @@ void EDBM_mesh_hide(BMEditMesh *em, bool swap)
itermode = BM_FACES_OF_MESH;
BM_ITER_MESH (ele, &iter, em->bm, itermode) {
- if (BM_elem_flag_test(ele, BM_ELEM_SELECT) ^ hflag_swap)
- BM_elem_hide_set(em->bm, ele, true);
+ if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) {
+ if (BM_elem_flag_test(ele, BM_ELEM_SELECT) ^ hflag_swap) {
+ BM_elem_hide_set(em->bm, ele, true);
+ changed = true;
+ }
+ }
}
- EDBM_selectmode_flush(em);
+ if (changed) {
+ EDBM_selectmode_flush(em);
+ }
+ return changed;
/* original hide flushing comment (OUTDATED):
- * hide happens on least dominant select mode, and flushes up, not down! (helps preventing errors in subsurf) */
+ * 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
@@ -1236,7 +1237,7 @@ void EDBM_mesh_hide(BMEditMesh *em, bool swap)
*/
}
-void EDBM_mesh_reveal(BMEditMesh *em, bool select)
+bool EDBM_mesh_reveal(BMEditMesh *em, bool select)
{
const char iter_types[3] = {
BM_VERTS_OF_MESH,
@@ -1250,6 +1251,7 @@ void EDBM_mesh_reveal(BMEditMesh *em, bool select)
(em->selectmode & SCE_SELECT_FACE) != 0,
};
int i;
+ bool changed = false;
/* Use tag flag to remember what was hidden before all is revealed.
* BM_ELEM_HIDDEN --> BM_ELEM_TAG */
@@ -1258,10 +1260,20 @@ void EDBM_mesh_reveal(BMEditMesh *em, bool select)
BMElem *ele;
BM_ITER_MESH (ele, &iter, em->bm, iter_types[i]) {
- BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_HIDDEN));
+ if (BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) {
+ BM_elem_flag_enable(ele, BM_ELEM_TAG);
+ changed = true;
+ }
+ else {
+ BM_elem_flag_disable(ele, BM_ELEM_TAG);
+ }
}
}
+ if (!changed) {
+ return false;
+ }
+
/* Reveal everything */
EDBM_flag_disable_all(em, BM_ELEM_HIDDEN);
@@ -1285,6 +1297,8 @@ void EDBM_mesh_reveal(BMEditMesh *em, bool select)
/* hidden faces can have invalid normals */
EDBM_mesh_normals_update(em);
+
+ return true;
}
/** \} */
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 8b2c7601524..3d880fc0bfe 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/mesh_data.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "MEM_guardedalloc.h"
@@ -38,7 +31,6 @@
#include "BLI_utildefines.h"
#include "BLI_alloca.h"
-#include "BLI_path_util.h"
#include "BLI_math.h"
#include "BKE_context.h"
@@ -66,7 +58,7 @@
static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_tot)
{
CustomData *data;
- BMesh *bm = (me->edit_btmesh) ? me->edit_btmesh->bm : NULL;
+ BMesh *bm = (me->edit_mesh) ? me->edit_mesh->bm : NULL;
int tot;
/* this */
@@ -122,7 +114,7 @@ static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_t
return data;
}
-#define GET_CD_DATA(me, data) ((me)->edit_btmesh ? &(me)->edit_btmesh->bm->data : &(me)->data)
+#define GET_CD_DATA(me, data) ((me)->edit_mesh ? &(me)->edit_mesh->bm->data : &(me)->data)
static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
{
const int type = layer->type;
@@ -134,8 +126,8 @@ static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
n = (layer - &data->layers[layer_index]);
BLI_assert(n >= 0 && (n + layer_index) < data->totlayer);
- if (me->edit_btmesh) {
- BM_data_layer_free_n(me->edit_btmesh->bm, data, type, n);
+ if (me->edit_mesh) {
+ BM_data_layer_free_n(me->edit_mesh->bm, data, type, n);
}
else {
CustomData_free_layer(data, type, tot, layer_index + n);
@@ -213,7 +205,7 @@ static void mesh_uv_reset_mface(MPoly *mp, MLoopUV *mloopuv)
/* without bContext, called in uvedit */
void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum)
{
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
if (em) {
/* Collect BMesh UVs */
@@ -258,15 +250,15 @@ void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
}
/* note: keep in sync with ED_mesh_color_add */
-int ED_mesh_uv_texture_add(Mesh *me, const char *name, const bool active_set)
+int ED_mesh_uv_texture_add(Mesh *me, const char *name, const bool active_set, const bool do_init)
{
BMEditMesh *em;
int layernum_dst;
bool is_init = false;
- if (me->edit_btmesh) {
- em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ em = me->edit_mesh;
layernum_dst = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPUV);
if (layernum_dst >= MAX_MTFACE)
@@ -275,7 +267,7 @@ int ED_mesh_uv_texture_add(Mesh *me, const char *name, const bool active_set)
/* CD_MLOOPUV */
BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_MLOOPUV, name);
/* copy data from active UV */
- if (layernum_dst) {
+ if (layernum_dst && do_init) {
const int layernum_src = CustomData_get_active_layer(&em->bm->ldata, CD_MLOOPUV);
BM_data_layer_copy(em->bm, &em->bm->ldata, CD_MLOOPUV, layernum_src, layernum_dst);
@@ -290,7 +282,7 @@ int ED_mesh_uv_texture_add(Mesh *me, const char *name, const bool active_set)
if (layernum_dst >= MAX_MTFACE)
return -1;
- if (me->mloopuv) {
+ if (me->mloopuv && do_init) {
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);
is_init = true;
@@ -309,7 +301,7 @@ int ED_mesh_uv_texture_add(Mesh *me, const char *name, const bool active_set)
}
/* don't overwrite our copied coords */
- if (is_init == false) {
+ if (!is_init && do_init) {
ED_mesh_uv_loop_reset_ex(me, layernum_dst);
}
@@ -324,17 +316,17 @@ void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name)
BMEditMesh *em;
int layernum_dst;
- if (me->edit_btmesh) {
- em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ em = me->edit_mesh;
layernum_dst = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPUV);
if (layernum_dst == 0)
- ED_mesh_uv_texture_add(me, name, true);
+ ED_mesh_uv_texture_add(me, name, true, true);
}
else {
layernum_dst = CustomData_number_of_layers(&me->ldata, CD_MLOOPUV);
if (layernum_dst == 0)
- ED_mesh_uv_texture_add(me, name, true);
+ ED_mesh_uv_texture_add(me, name, true, true);
}
}
@@ -385,13 +377,13 @@ bool ED_mesh_uv_texture_remove_named(Mesh *me, const char *name)
}
/* note: keep in sync with ED_mesh_uv_texture_add */
-int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set)
+int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set, const bool do_init)
{
BMEditMesh *em;
int layernum;
- if (me->edit_btmesh) {
- em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ em = me->edit_mesh;
layernum = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL);
if (layernum >= MAX_MCOL) {
@@ -401,7 +393,7 @@ int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set)
/* CD_MLOOPCOL */
BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_MLOOPCOL, name);
/* copy data from active vertex color layer */
- if (layernum) {
+ if (layernum && do_init) {
const int layernum_dst = CustomData_get_active_layer(&em->bm->ldata, CD_MLOOPCOL);
BM_data_layer_copy(em->bm, &em->bm->ldata, CD_MLOOPCOL, layernum_dst, layernum);
}
@@ -415,7 +407,7 @@ int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set)
return -1;
}
- if (me->mloopcol) {
+ if (me->mloopcol && do_init) {
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->mcol, me->totface, name);
}
@@ -440,7 +432,7 @@ int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set)
bool ED_mesh_color_ensure(struct Mesh *me, const char *name)
{
- BLI_assert(me->edit_btmesh == NULL);
+ BLI_assert(me->edit_mesh == NULL);
if (!me->mloopcol && me->totloop) {
CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name);
@@ -507,7 +499,7 @@ 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(me, NULL, true) == -1)
+ if (ED_mesh_uv_texture_add(me, NULL, true, true) == -1)
return OPERATOR_CANCELLED;
if (ob->mode & OB_MODE_TEXTURE_PAINT) {
@@ -573,7 +565,7 @@ static int mesh_vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob = ED_object_context(C);
Mesh *me = ob->data;
- if (ED_mesh_color_add(me, NULL, true) == -1)
+ if (ED_mesh_color_add(me, NULL, true, true) == -1)
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -634,8 +626,8 @@ static int mesh_customdata_clear_exec__internal(bContext *C,
BLI_assert(CustomData_layertype_is_singleton(type) == true);
if (CustomData_has_layer(data, type)) {
- if (me->edit_btmesh) {
- BM_data_layer_free(me->edit_btmesh->bm, data, type);
+ if (me->edit_mesh) {
+ BM_data_layer_free(me->edit_mesh->bm, data, type);
}
else {
CustomData_free_layers(data, type, tot);
@@ -792,13 +784,13 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator
if (!BKE_mesh_has_custom_loop_normals(me)) {
CustomData *data = GET_CD_DATA(me, ldata);
- if (me->edit_btmesh) {
+ if (me->edit_mesh) {
/* Tag edges as sharp according to smooth threshold if needed, to preserve autosmooth shading. */
if (me->flag & ME_AUTOSMOOTH) {
- BM_edges_sharp_from_angle_set(me->edit_btmesh->bm, me->smoothresh);
+ BM_edges_sharp_from_angle_set(me->edit_mesh->bm, me->smoothresh);
}
- BM_data_layer_add(me->edit_btmesh->bm, data, CD_CUSTOMLOOPNORMAL);
+ BM_data_layer_add(me->edit_mesh->bm, data, CD_CUSTOMLOOPNORMAL);
}
else {
/* Tag edges as sharp according to smooth threshold if needed, to preserve autosmooth shading. */
@@ -919,7 +911,7 @@ static void mesh_add_verts(Mesh *mesh, int len)
return;
totvert = mesh->totvert + len;
- CustomData_copy(&mesh->vdata, &vdata, CD_MASK_MESH, CD_DEFAULT, totvert);
+ CustomData_copy(&mesh->vdata, &vdata, CD_MASK_MESH.vmask, CD_DEFAULT, totvert);
CustomData_copy_data(&mesh->vdata, &vdata, 0, 0, mesh->totvert);
if (!CustomData_has_layer(&vdata, CD_MVERT))
@@ -952,7 +944,7 @@ static void mesh_add_edges(Mesh *mesh, int len)
totedge = mesh->totedge + len;
/* update customdata */
- CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge);
+ CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH.emask, CD_DEFAULT, totedge);
CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge);
if (!CustomData_has_layer(&edata, CD_MEDGE))
@@ -982,7 +974,7 @@ static void mesh_add_tessfaces(Mesh *mesh, int len)
totface = mesh->totface + len; /* new face count */
/* update customdata */
- CustomData_copy(&mesh->fdata, &fdata, CD_MASK_MESH, CD_DEFAULT, totface);
+ CustomData_copy(&mesh->fdata, &fdata, CD_MASK_MESH.fmask, CD_DEFAULT, totface);
CustomData_copy_data(&mesh->fdata, &fdata, 0, 0, mesh->totface);
if (!CustomData_has_layer(&fdata, CD_MFACE))
@@ -1011,7 +1003,7 @@ static void mesh_add_loops(Mesh *mesh, int len)
totloop = mesh->totloop + len; /* new face count */
/* update customdata */
- CustomData_copy(&mesh->ldata, &ldata, CD_MASK_MESH, CD_DEFAULT, totloop);
+ CustomData_copy(&mesh->ldata, &ldata, CD_MASK_MESH.lmask, CD_DEFAULT, totloop);
CustomData_copy_data(&mesh->ldata, &ldata, 0, 0, mesh->totloop);
if (!CustomData_has_layer(&ldata, CD_MLOOP))
@@ -1036,7 +1028,7 @@ static void mesh_add_polys(Mesh *mesh, int len)
totpoly = mesh->totpoly + len; /* new face count */
/* update customdata */
- CustomData_copy(&mesh->pdata, &pdata, CD_MASK_MESH, CD_DEFAULT, totpoly);
+ CustomData_copy(&mesh->pdata, &pdata, CD_MASK_MESH.pmask, CD_DEFAULT, totpoly);
CustomData_copy_data(&mesh->pdata, &pdata, 0, 0, mesh->totpoly);
if (!CustomData_has_layer(&pdata, CD_MPOLY))
@@ -1097,7 +1089,7 @@ 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_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add geometry in edit mode");
return;
}
@@ -1113,7 +1105,7 @@ void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges,
void ED_mesh_tessfaces_add(Mesh *mesh, ReportList *reports, int count)
{
- if (mesh->edit_btmesh) {
+ if (mesh->edit_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add tessfaces in edit mode");
return;
}
@@ -1128,7 +1120,7 @@ void ED_mesh_tessfaces_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_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add edges in edit mode");
return;
}
@@ -1138,7 +1130,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_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add vertices in edit mode");
return;
}
@@ -1148,7 +1140,7 @@ 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_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot remove faces in edit mode");
return;
}
@@ -1162,7 +1154,7 @@ 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_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot remove edges in edit mode");
return;
}
@@ -1176,7 +1168,7 @@ 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_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot remove vertices in edit mode");
return;
}
@@ -1190,7 +1182,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_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add loops in edit mode");
return;
}
@@ -1200,7 +1192,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_mesh) {
BKE_report(reports, RPT_ERROR, "Cannot add polygons in edit mode");
return;
}
@@ -1210,8 +1202,8 @@ void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_calc_tessface(Mesh *mesh, bool free_mpoly)
{
- if (mesh->edit_btmesh) {
- BKE_editmesh_tessface_calc(mesh->edit_btmesh);
+ if (mesh->edit_mesh) {
+ BKE_editmesh_tessface_calc(mesh->edit_mesh);
}
else {
BKE_mesh_tessface_calc(mesh);
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 87e1011642a..735593c589f 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/mesh_intern.h
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
/* Internal for editmesh_xxxx.c functions */
@@ -35,15 +27,15 @@
#define __MESH_INTERN_H__
struct BMEditMesh;
-struct BMOperator;
struct BMElem;
+struct BMOperator;
struct EnumPropertyItem;
+struct LinkNode;
struct bContext;
struct wmKeyConfig;
struct wmKeyMap;
struct wmOperator;
struct wmOperatorType;
-struct LinkNode;
/* *** editmesh_utils.c *** */
@@ -97,6 +89,7 @@ void MESH_OT_primitive_cube_add_gizmo(struct wmOperatorType *ot);
/* *** editmesh_bevel.c *** */
void MESH_OT_bevel(struct wmOperatorType *ot);
+struct wmKeyMap *bevel_modal_keymap(struct wmKeyConfig *keyconf);
/* *** editmesh_bisect.c *** */
void MESH_OT_bisect(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c
index b9479a660f9..3d49d874503 100644
--- a/source/blender/editors/mesh/mesh_mirror.c
+++ b/source/blender/editors/mesh/mesh_mirror.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/mesh_mirror.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* Mirror calculation for edit-mode and object mode.
*/
@@ -29,7 +23,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
-#include "BLI_bitmap.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -71,7 +64,7 @@ int ED_mesh_mirror_spatial_table(Object *ob, BMEditMesh *em, Mesh *me_eval, cons
}
else if (mode == 's') { /* start table */
Mesh *me = ob->data;
- const bool use_em = (!me_eval && em && me->edit_btmesh == em);
+ const bool use_em = (!me_eval && em && me->edit_mesh == em);
const int totvert = use_em ? em->bm->totvert : me_eval ? me_eval->totvert : me->totvert;
if (MirrKdStore.tree) /* happens when entering this call without ending it */
@@ -144,7 +137,7 @@ static int mirrtopo_vert_sort(const void *v1, const void *v2)
bool ED_mesh_mirrtopo_recalc_check(Mesh *me, Mesh *me_eval, MirrTopoStore_t *mesh_topo_store)
{
- const bool is_editmode = (me->edit_btmesh != NULL);
+ const bool is_editmode = (me->edit_mesh != NULL);
int totvert;
int totedge;
@@ -152,9 +145,9 @@ bool ED_mesh_mirrtopo_recalc_check(Mesh *me, Mesh *me_eval, MirrTopoStore_t *mes
totvert = me_eval->totvert;
totedge = me_eval->totedge;
}
- else if (me->edit_btmesh) {
- totvert = me->edit_btmesh->bm->totvert;
- totedge = me->edit_btmesh->bm->totedge;
+ else if (me->edit_mesh) {
+ totvert = me->edit_mesh->bm->totvert;
+ totedge = me->edit_mesh->bm->totedge;
}
else {
totvert = me->totvert;
@@ -178,9 +171,9 @@ void ED_mesh_mirrtopo_init(
Mesh *me, Mesh *me_eval, MirrTopoStore_t *mesh_topo_store,
const bool skip_em_vert_array_init)
{
- const bool is_editmode = (me->edit_btmesh != NULL);
+ const bool is_editmode = (me->edit_mesh != NULL);
MEdge *medge = NULL, *med;
- BMEditMesh *em = me_eval ? NULL : me->edit_btmesh;
+ BMEditMesh *em = me_eval ? NULL : me->edit_mesh;
/* editmode*/
BMEdge *eed;
@@ -216,7 +209,7 @@ void ED_mesh_mirrtopo_init(
/* Initialize the vert-edge-user counts used to detect unique topology */
if (em) {
- totedge = me->edit_btmesh->bm->totedge;
+ totedge = me->edit_mesh->bm->totedge;
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
const int i1 = BM_elem_index_get(eed->v1), i2 = BM_elem_index_get(eed->v2);
@@ -317,7 +310,8 @@ void ED_mesh_mirrtopo_init(
if (em) {
BMVert **vtable = em->bm->vtable;
for (a = 1; a <= totvert; a++) {
- /* printf("I %d %ld %d\n", (a - last), MirrTopoPairs[a].hash, MirrTopoPairs[a].v_indexs); */
+ // printf("I %d %ld %d\n",
+ // (a - last), MirrTopoPairs[a].hash, MirrTopoPairs[a].v_indexs);
if ((a == totvert) || (topo_pairs[a - 1].hash != topo_pairs[a].hash)) {
const int match_count = a - last;
if (match_count == 2) {
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index fe3703babf4..566f49878fb 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,15 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/mesh_ops.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "DNA_scene_types.h"
#include "DNA_modifier_types.h"
-
#include "RNA_access.h"
#include "WM_api.h"
@@ -329,4 +321,5 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
knifetool_modal_keymap(keyconf);
point_normals_modal_keymap(keyconf);
+ bevel_modal_keymap(keyconf);
}
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index cc49beb17b8..2b8535f868b 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/mesh/meshtools.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*
* meshtools.c: no editmode (violated already :), mirror & join),
* tools operating on meshes
@@ -105,7 +97,7 @@ static void join_mesh_single(
((Mesh *)ob_dst->data)->cd_flag |= me->cd_flag;
/* standard data */
- CustomData_merge(&me->vdata, vdata, CD_MASK_MESH, CD_DEFAULT, totvert);
+ CustomData_merge(&me->vdata, vdata, CD_MASK_MESH.vmask, CD_DEFAULT, totvert);
CustomData_copy_data_named(&me->vdata, vdata, 0, *vertofs, me->totvert);
/* vertex groups */
@@ -151,7 +143,8 @@ static void join_mesh_single(
/* check if this mesh has such a shapekey */
KeyBlock *okb = me->key ? BKE_keyblock_find_name(me->key, kb->name) : NULL;
if (okb) {
- /* copy this mesh's shapekey to the destination shapekey (need to transform first) */
+ /* copy this mesh's shapekey to the destination shapekey
+ * (need to transform first) */
float (*ocos)[3] = okb->data;
for (a = 0; a < me->totvert; a++, cos++, ocos++) {
copy_v3_v3(*cos, *ocos);
@@ -198,7 +191,7 @@ static void join_mesh_single(
}
if (me->totedge) {
- CustomData_merge(&me->edata, edata, CD_MASK_MESH, CD_DEFAULT, totedge);
+ CustomData_merge(&me->edata, edata, CD_MASK_MESH.emask, CD_DEFAULT, totedge);
CustomData_copy_data_named(&me->edata, edata, 0, *edgeofs, me->totedge);
for (a = 0; a < me->totedge; a++, medge++) {
@@ -220,7 +213,7 @@ static void join_mesh_single(
}
}
- CustomData_merge(&me->ldata, ldata, CD_MASK_MESH, CD_DEFAULT, totloop);
+ CustomData_merge(&me->ldata, ldata, CD_MASK_MESH.lmask, CD_DEFAULT, totloop);
CustomData_copy_data_named(&me->ldata, ldata, 0, *loopofs, me->totloop);
for (a = 0; a < me->totloop; a++, mloop++) {
@@ -244,7 +237,7 @@ static void join_mesh_single(
}
}
- CustomData_merge(&me->pdata, pdata, CD_MASK_MESH, CD_DEFAULT, totpoly);
+ CustomData_merge(&me->pdata, pdata, CD_MASK_MESH.pmask, CD_DEFAULT, totpoly);
CustomData_copy_data_named(&me->pdata, pdata, 0, *polyofs, me->totpoly);
for (a = 0; a < me->totpoly; a++, mpoly++) {
@@ -400,7 +393,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
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) */
+ /* 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 <= ob_iter->totcol; a++) {
ma = give_current_material(ob_iter, a);
@@ -423,7 +417,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
}
- /* if this mesh has shapekeys, check if destination mesh already has matching entries too */
+ /* if this mesh has shapekeys,
+ * check if destination mesh already has matching entries too */
if (me->key && key) {
/* for remapping KeyBlock.relative */
int *index_map = MEM_mallocN(sizeof(int) * me->key->totkey, __func__);
@@ -454,7 +449,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* remap relative index values */
for (kb = me->key->block.first, i = 0; kb; kb = kb->next, i++) {
- if (LIKELY(kb->relative < me->key->totkey)) { /* sanity check, should always be true */
+ /* sanity check, should always be true */
+ if (LIKELY(kb->relative < me->key->totkey)) {
kb_map[i]->relative = index_map[kb->relative];
}
}
@@ -488,8 +484,10 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* inverse transform for all selected meshes in this object */
invert_m4_m4(imat, ob->obmat);
- /* Add back active mesh first. This allows to keep things similar as they were, as much as possible (i.e. data from
- * active mesh will remain first ones in new result of the merge, in same order for CD layers, etc. See also T50084.
+ /* Add back active mesh first.
+ * This allows to keep things similar as they were, as much as possible
+ * (i.e. data from active mesh will remain first ones in new result of the merge,
+ * in same order for CD layers, etc). See also T50084.
*/
join_mesh_single(
depsgraph, bmain, scene,
@@ -580,7 +578,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* free temp copy of destination shapekeys (if applicable) */
if (nkey) {
/* We can assume nobody is using that ID currently. */
- BKE_libblock_free_ex(bmain, nkey, false, false);
+ BKE_id_free_ex(bmain, nkey, LIB_ID_FREE_NO_UI_USER, false);
}
/* ensure newly inserted keys are time sorted */
@@ -667,7 +665,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob_iter);
- me_deformed = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
+ me_deformed = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
if (!me_deformed) {
continue;
@@ -825,7 +823,7 @@ BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *e
int ED_mesh_mirror_get_vert(Object *ob, int index)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
int index_mirr;
@@ -1089,7 +1087,7 @@ bool ED_mesh_pick_face_vert(bContext *C, Object *ob, const int mval[2], unsigned
struct ARegion *ar = CTX_wm_region(C);
/* derived mesh to find deformed locations */
- Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH_ORIGINDEX);
int v_idx_best = ORIGINDEX_NONE;
@@ -1218,7 +1216,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
Object *ob_eval = DEG_get_evaluated_object(vc.depsgraph, ob);
/* derived mesh to find deformed locations */
- Mesh *me_eval = mesh_get_eval_final(vc.depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
+ Mesh *me_eval = mesh_get_eval_final(vc.depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
ARegion *ar = vc.ar;
RegionView3D *rv3d = ar->regiondata;
@@ -1258,7 +1256,7 @@ MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve)
{
if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && ob->defbase.first) {
Mesh *me = ob->data;
- BMesh *bm = me->edit_btmesh->bm;
+ BMesh *bm = me->edit_mesh->bm;
const int cd_dvert_offset = CustomData_get_offset(&bm->vdata, CD_MDEFORMVERT);
if (cd_dvert_offset != -1) {
diff --git a/source/blender/editors/metaball/CMakeLists.txt b/source/blender/editors/metaball/CMakeLists.txt
index b0ae3122727..a0d6fb928ff 100644
--- a/source/blender/editors/metaball/CMakeLists.txt
+++ b/source/blender/editors/metaball/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/metaball/editmball_undo.c b/source/blender/editors/metaball/editmball_undo.c
index ebf056f71db..af6f78c7bcb 100644
--- a/source/blender/editors/metaball/editmball_undo.c
+++ b/source/blender/editors/metaball/editmball_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/metaball/editmball_undo.c
- * \ingroup edmeta
+/** \file
+ * \ingroup edmeta
*/
#include <math.h>
@@ -157,13 +153,15 @@ static bool mball_undosys_poll(bContext *C)
return editmball_object_from_context(C) != NULL;
}
-static bool mball_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool mball_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
MBallUndoStep *us = (MBallUndoStep *)us_p;
+ /* Important not to use the 3D view when getting objects because all objects
+ * outside of this list will be moved out of edit-mode when reading back undo steps. */
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
- Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, NULL, &objects_len);
us->elems = MEM_callocN(sizeof(*us->elems) * objects_len, __func__);
us->elems_len = objects_len;
@@ -181,14 +179,15 @@ static bool mball_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void mball_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void mball_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(mball_undosys_poll(C));
-
MBallUndoStep *us = (MBallUndoStep *)us_p;
+ /* Load all our objects into edit-mode, clear everything else. */
+ ED_undo_object_editmode_restore_helper(C, &us->elems[0].obedit_ref.ptr, us->elems_len, sizeof(*us->elems));
+
+ BLI_assert(mball_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
MBallUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;
@@ -241,7 +240,6 @@ void ED_mball_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = mball_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(MBallUndoStep);
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index aedb182dceb..2af78261b87 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -18,15 +16,11 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
- * The Original Code is: all of this file.
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/metaball/mball_edit.c
- * \ingroup edmeta
+/** \file
+ * \ingroup edmeta
*/
#include <math.h>
@@ -189,7 +183,7 @@ enum {
SIMMBALL_TYPE = 1,
SIMMBALL_RADIUS,
SIMMBALL_STIFFNESS,
- SIMMBALL_ROTATION
+ SIMMBALL_ROTATION,
};
static const EnumPropertyItem prop_similar_types[] = {
@@ -197,7 +191,7 @@ static const EnumPropertyItem prop_similar_types[] = {
{SIMMBALL_RADIUS, "RADIUS", 0, "Radius", ""},
{SIMMBALL_STIFFNESS, "STIFFNESS", 0, "Stiffness", ""},
{SIMMBALL_ROTATION, "ROTATION", 0, "Rotation", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void mball_select_similar_type_get(Object *obedit, MetaBall *mb, int type, KDTree *r_tree)
@@ -718,7 +712,7 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese
}
const uint hit_object = hitresult & 0xFFFF;
- if (vc.obedit->select_color != hit_object) {
+ if (vc.obedit->select_id != hit_object) {
continue;
}
@@ -747,8 +741,7 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese
metaelem_id += 0x10000;
}
- /* When some metaelem was found, then it is necessary to select or
- * deselect it. */
+ /* When some metaelem was found, then it is necessary to select or deselect it. */
if (ml_act) {
if (!extend && !deselect && !toggle) {
uint objects_len;
diff --git a/source/blender/editors/metaball/mball_intern.h b/source/blender/editors/metaball/mball_intern.h
index 927a8acf5db..dad1fa172fa 100644
--- a/source/blender/editors/metaball/mball_intern.h
+++ b/source/blender/editors/metaball/mball_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/metaball/mball_intern.h
- * \ingroup edmeta
+/** \file
+ * \ingroup edmeta
*/
diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c
index 0e029e36e0e..b8a209dc5eb 100644
--- a/source/blender/editors/metaball/mball_ops.c
+++ b/source/blender/editors/metaball/mball_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/metaball/mball_ops.c
- * \ingroup edmeta
+/** \file
+ * \ingroup edmeta
*/
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index db8997c5e0a..f15427e61ac 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -50,23 +47,23 @@ set(SRC
object_bake_api.c
object_collection.c
object_constraint.c
+ object_data_transfer.c
object_edit.c
object_facemap_ops.c
+ object_gpencil_modifier.c
object_hook.c
object_modes.c
object_modifier.c
- object_gpencil_modifier.c
- object_shader_fx.c
object_ops.c
object_random.c
object_relations.c
object_select.c
+ object_shader_fx.c
object_shapekey.c
- object_data_transfer.c
object_transform.c
object_utils.c
- object_warp.c
object_vgroup.c
+ object_warp.c
object_intern.h
)
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 6be1afdcb2a..4a27e05815f 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_add.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -38,7 +32,7 @@
#include "DNA_camera_types.h"
#include "DNA_collection_types.h"
#include "DNA_curve_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
@@ -73,7 +67,7 @@
#include "BKE_font.h"
#include "BKE_gpencil.h"
#include "BKE_key.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_lattice.h"
#include "BKE_layer.h"
#include "BKE_library.h"
@@ -90,7 +84,6 @@
#include "BKE_particle.h"
#include "BKE_report.h"
#include "BKE_scene.h"
-#include "BKE_screen.h"
#include "BKE_speaker.h"
#include "DEG_depsgraph.h"
@@ -121,7 +114,7 @@
#include "object_intern.h"
-/* this is an exact copy of the define in rna_lamp.c
+/* this is an exact copy of the define in rna_light.c
* kept here because of linking order.
* Icons are only defined here */
const EnumPropertyItem rna_enum_light_type_items[] = {
@@ -129,7 +122,7 @@ const EnumPropertyItem rna_enum_light_type_items[] = {
{LA_SUN, "SUN", ICON_LIGHT_SUN, "Sun", "Constant direction parallel ray light source"},
{LA_SPOT, "SPOT", ICON_LIGHT_SPOT, "Spot", "Directional cone light source"},
{LA_AREA, "AREA", ICON_LIGHT_AREA, "Area", "Directional area light source"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* copy from rna_object_force.c */
@@ -147,7 +140,7 @@ static const EnumPropertyItem field_type_items[] = {
{PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", ""},
{PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", ""},
{PFIELD_SMOKEFLOW, "SMOKE", ICON_FORCE_SMOKEFLOW, "Smoke Flow", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem lightprobe_type_items[] = {
@@ -157,7 +150,7 @@ static EnumPropertyItem lightprobe_type_items[] = {
"Planar reflection probe"},
{LIGHTPROBE_TYPE_GRID, "GRID", ICON_LIGHTPROBE_GRID, "Irradiance Volume",
"Irradiance probe to capture diffuse indirect lighting"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/************************** Exported *****************************/
@@ -396,7 +389,7 @@ Object *ED_object_add_type(
/* for as long scene has editmode... */
if (CTX_data_edit_object(C)) {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
/* deselects all, sets active object */
@@ -417,8 +410,9 @@ Object *ED_object_add_type(
DEG_id_tag_update_ex(bmain, (ID *)ob->data, ID_RECALC_EDITORS);
}
- if (enter_editmode)
- ED_object_editmode_enter(C, EM_IGNORE_LAYER);
+ if (enter_editmode) {
+ ED_object_editmode_enter_ex(bmain, scene, ob, 0);
+ }
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
@@ -446,7 +440,7 @@ static int object_add_exec(bContext *C, wmOperator *op)
if (ob->type == OB_LATTICE) {
/* lattice is a special case!
* we never want to scale the obdata since that is the rest-state */
- copy_v3_fl(ob->size, radius);
+ copy_v3_fl(ob->scale, radius);
}
else {
BKE_object_obdata_size_init(ob, radius);
@@ -471,7 +465,8 @@ void OBJECT_OT_add(wmOperatorType *ot)
/* properties */
ED_object_add_unit_props_radius(ot);
- RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 0, "Type", "");
+ PropertyRNA *prop = RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 0, "Type", "");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
ED_object_add_generic_props(ot, true);
}
@@ -482,11 +477,11 @@ void OBJECT_OT_add(wmOperatorType *ot)
static const char *get_lightprobe_defname(int type)
{
switch (type) {
- case LIGHTPROBE_TYPE_GRID: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "IrradianceVolume");
- case LIGHTPROBE_TYPE_PLANAR: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "ReflectionPlane");
- case LIGHTPROBE_TYPE_CUBE: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "ReflectionCubemap");
+ case LIGHTPROBE_TYPE_GRID: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "IrradianceVolume");
+ case LIGHTPROBE_TYPE_PLANAR: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "ReflectionPlane");
+ case LIGHTPROBE_TYPE_CUBE: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "ReflectionCubemap");
default:
- return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "LightProbe");
+ return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "LightProbe");
}
}
@@ -967,6 +962,23 @@ void OBJECT_OT_drop_named_image(wmOperatorType *ot)
}
/********************* Add Gpencil Operator ********************/
+static bool object_gpencil_add_poll(bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ Object *obact = CTX_data_active_object(C);
+
+ if ((scene == NULL) || (ID_IS_LINKED(scene))) {
+ return false;
+ }
+
+ if (obact && obact->type == OB_GPENCIL) {
+ if (obact->mode != OB_MODE_OBJECT) {
+ return false;
+ }
+ }
+
+ return true;
+}
static int object_gpencil_add_exec(bContext *C, wmOperator *op)
{
@@ -1006,12 +1018,9 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op)
}
}
- float radius = RNA_float_get(op->ptr, "radius");
ob = ED_object_add_type(C, OB_GPENCIL, ob_name, loc, rot, true, local_view_bits);
gpd = ob->data;
newob = true;
-
- BKE_object_obdata_size_init(ob, GP_OBGPENCIL_DEFAULT_SIZE * radius);
}
else {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
@@ -1057,6 +1066,9 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op)
/* if this is a new object, initialise default stuff (colors, etc.) */
if (newob) {
+ /* set default viewport color to black */
+ copy_v3_fl(ob->color, 0.0f);
+
ED_gpencil_add_defaults(C, ob);
}
@@ -1073,7 +1085,7 @@ void OBJECT_OT_gpencil_add(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = object_gpencil_add_exec;
- ot->poll = ED_operator_scene_editable;
+ ot->poll = object_gpencil_add_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1090,12 +1102,12 @@ void OBJECT_OT_gpencil_add(wmOperatorType *ot)
static const char *get_light_defname(int type)
{
switch (type) {
- case LA_LOCAL: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Point");
- case LA_SUN: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Sun");
- case LA_SPOT: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Spot");
- case LA_AREA: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Area");
+ case LA_LOCAL: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Point");
+ case LA_SUN: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Sun");
+ case LA_SPOT: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Spot");
+ case LA_AREA: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Area");
default:
- return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Light");
+ return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Light");
}
}
@@ -1103,7 +1115,7 @@ static int object_light_add_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *ob;
- Lamp *la;
+ Light *la;
int type = RNA_enum_get(op->ptr, "type");
ushort local_view_bits;
float loc[3], rot[3];
@@ -1129,7 +1141,7 @@ static int object_light_add_exec(bContext *C, wmOperator *op)
}
BKE_object_obdata_size_init(ob, size);
- la = (Lamp *)ob->data;
+ la = (Light *)ob->data;
la->type = type;
if (BKE_scene_uses_cycles(scene)) {
@@ -1157,7 +1169,7 @@ void OBJECT_OT_light_add(wmOperatorType *ot)
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_light_type_items, 0, "Type", "");
- RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_LAMP);
+ RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_LIGHT);
ED_object_add_unit_props_radius(ot);
ED_object_add_generic_props(ot, false);
@@ -1189,7 +1201,7 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
}
}
else
- collection = BLI_findlink(&CTX_data_main(C)->collection, RNA_enum_get(op->ptr, "collection"));
+ collection = BLI_findlink(&CTX_data_main(C)->collections, RNA_enum_get(op->ptr, "collection"));
if (!ED_object_add_generic_get_opts(C, op, 'Z', loc, rot, NULL, &local_view_bits, NULL)) {
return OPERATOR_CANCELLED;
@@ -1205,7 +1217,7 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
}
Object *ob = ED_object_add_type(C, OB_EMPTY, collection->id.name + 2, loc, rot, false, local_view_bits);
- ob->dup_group = collection;
+ ob->instance_collection = collection;
ob->transflag |= OB_DUPLICOLLECTION;
id_us_plus(&collection->id);
@@ -1361,7 +1373,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
*/
if (use_global && ob->id.lib == NULL) {
/* We want to nuke the object, let's nuke it the easy way (not for linked data though)... */
- BKE_libblock_delete(bmain, &ob->id);
+ BKE_id_delete(bmain, &ob->id);
changed_count += 1;
continue;
}
@@ -1369,7 +1381,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
/* remove from Grease Pencil parent */
/* XXX This is likely not correct? Will also remove parent from grease pencil from other scenes,
* even when use_global is false... */
- for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+ for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
if (gpl->parent != NULL) {
if (gpl->parent == ob) {
@@ -1385,7 +1397,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
if (use_global) {
Scene *scene_iter;
- for (scene_iter = bmain->scene.first; scene_iter; scene_iter = scene_iter->id.next) {
+ for (scene_iter = bmain->scenes.first; scene_iter; scene_iter = scene_iter->id.next) {
if (scene_iter != scene && !ID_IS_LINKED(scene_iter)) {
if (is_indirectly_used && ID_REAL_USERS(ob) <= 1 && ID_EXTRA_USERS(ob) == 0) {
BKE_reportf(op->reports, RPT_WARNING,
@@ -1408,7 +1420,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
}
/* delete has to handle all open scenes */
- BKE_main_id_tag_listbase(&bmain->scene, LIB_TAG_DOIT, true);
+ BKE_main_id_tag_listbase(&bmain->scenes, LIB_TAG_DOIT, true);
for (win = wm->windows.first; win; win = win->next) {
scene = WM_window_get_active_scene(win);
@@ -1600,8 +1612,9 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
BLI_ghash_insert(dupli_gh, dob, ob_dst);
if (parent_gh) {
void **val;
- /* Due to nature of hash/comparison of this ghash, a lot of duplis may be considered as 'the same',
- * this avoids trying to insert same key several time and raise asserts in debug builds... */
+ /* Due to nature of hash/comparison of this ghash, a lot of duplis may be considered as
+ * 'the same', this avoids trying to insert same key several time and
+ * raise asserts in debug builds... */
if (!BLI_ghash_ensure_p(parent_gh, dob, &val)) {
*val = ob_dst;
}
@@ -1673,8 +1686,8 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
}
}
- if (base->object->transflag & OB_DUPLICOLLECTION && base->object->dup_group) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ if (base->object->transflag & OB_DUPLICOLLECTION && base->object->instance_collection) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->proxy_group == base->object) {
ob->proxy = NULL;
ob->proxy_from = NULL;
@@ -1746,7 +1759,7 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
static const EnumPropertyItem convert_target_items[] = {
{OB_CURVE, "CURVE", ICON_OUTLINER_OB_CURVE, "Curve from Mesh/Text", ""},
{OB_MESH, "MESH", ICON_OUTLINER_OB_MESH, "Mesh from Curve/Meta/Surf/Text", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Object *ob)
@@ -1759,7 +1772,7 @@ static void convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Objec
if (ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) {
/* We need 'for render' ON here, to enable computing bevel dipslist if needed.
* Also makes sense anyway, we would not want e.g. to loose hidden parts etc. */
- BKE_displist_make_curveTypes(depsgraph, scene, ob, true, false);
+ BKE_displist_make_curveTypes(depsgraph, scene, ob, true, false, NULL);
}
else if (ob->type == OB_MBALL) {
BKE_displist_make_mball(depsgraph, scene, ob);
@@ -1873,8 +1886,8 @@ static int convert_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
}
- uint64_t customdata_mask_prev = scene->customdata_mask;
- scene->customdata_mask |= CD_MASK_MESH;
+ CustomData_MeshMasks customdata_mask_prev = scene->customdata_mask;
+ CustomData_MeshMasks_update(&scene->customdata_mask, &CD_MASK_MESH);
BKE_scene_graph_update_tagged(depsgraph, bmain);
scene->customdata_mask = customdata_mask_prev;
}
@@ -1953,9 +1966,9 @@ static int convert_exec(bContext *C, wmOperator *op)
*/
Scene *scene_eval = (Scene *)DEG_get_evaluated_id(depsgraph, &scene->id);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_MESH);
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_MESH);
me_eval = BKE_mesh_copy_for_eval(me_eval, false);
- BKE_mesh_nomain_to_mesh(me_eval, newob->data, newob, CD_MASK_MESH, true);
+ BKE_mesh_nomain_to_mesh(me_eval, newob->data, newob, &CD_MASK_MESH, true);
BKE_object_free_modifiers(newob, 0); /* after derivedmesh calls! */
}
else if (ob->type == OB_FONT) {
@@ -1981,7 +1994,8 @@ static int convert_exec(bContext *C, wmOperator *op)
* datablock, but for until we've got granular update
* lets take care by selves.
*/
- /* XXX This may fail/crash, since BKE_vfont_to_curve() accesses evaluated data in some cases (bastien). */
+ /* XXX This may fail/crash, since BKE_vfont_to_curve()
+ * accesses evaluated data in some cases (bastien). */
BKE_vfont_to_curve(newob, FO_EDIT);
newob->type = OB_CURVE;
@@ -2007,7 +2021,7 @@ static int convert_exec(bContext *C, wmOperator *op)
if (!keep_original) {
/* other users */
if (cu->id.us > 1) {
- for (ob1 = bmain->object.first; ob1; ob1 = ob1->id.next) {
+ for (ob1 = bmain->objects.first; ob1; ob1 = ob1->id.next) {
if (ob1->data == ob->data) {
ob1->type = OB_CURVE;
DEG_id_tag_update(&ob1->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
@@ -2143,7 +2157,7 @@ static int convert_exec(bContext *C, wmOperator *op)
}
// XXX ED_object_editmode_enter(C, 0);
-// XXX exit_editmode(C, EM_FREEDATA|EM_WAITCURSOR); /* freedata, but no undo */
+// XXX exit_editmode(C, EM_FREEDATA|); /* freedata, but no undo */
if (basact) {
/* active base was changed */
@@ -2197,20 +2211,14 @@ void OBJECT_OT_convert(wmOperatorType *ot)
/* Does set ID->newid pointers. */
static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer *view_layer, Object *ob, int dupflag)
{
-#define ID_NEW_REMAP_US(a) if ( (a)->id.newid) { (a) = (void *)(a)->id.newid; (a)->id.us++; }
-#define ID_NEW_REMAP_US2(a) if (((ID *)a)->newid) { (a) = ((ID *)a)->newid; ((ID *)a)->us++; }
-
Base *base, *basen = NULL;
- Material ***matarar;
Object *obn;
- ID *id;
- int a, didit;
if (ob->mode & OB_MODE_POSE) {
; /* nothing? */
}
else {
- obn = ID_NEW_SET(ob, BKE_object_copy(bmain, ob));
+ obn = ID_NEW_SET(ob, BKE_object_duplicate(bmain, ob, dupflag));
DEG_id_tag_update(&obn->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
base = BKE_view_layer_base_find(view_layer, ob);
@@ -2221,8 +2229,11 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer
LayerCollection *layer_collection = BKE_layer_collection_get_active(view_layer);
BKE_collection_object_add(bmain, layer_collection->collection, obn);
}
+
basen = BKE_view_layer_base_find(view_layer, obn);
- basen->local_view_bits = base->local_view_bits;
+ if (base != NULL) {
+ basen->local_view_bits = base->local_view_bits;
+ }
/* 1) duplis should end up in same collection as the original
* 2) Rigid Body sim participants MUST always be part of a collection...
@@ -2230,223 +2241,13 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer
// XXX: is 2) really a good measure here?
if (ob->rigidbody_object || ob->rigidbody_constraint) {
Collection *collection;
- for (collection = bmain->collection.first; collection; collection = collection->id.next) {
+ for (collection = bmain->collections.first; collection; collection = collection->id.next) {
if (BKE_collection_has_object(collection, ob))
BKE_collection_object_add(bmain, collection, obn);
}
}
-
- /* duplicates using userflags */
- if (dupflag & USER_DUP_ACT) {
- BKE_animdata_copy_id_action(bmain, &obn->id, true);
- }
-
- if (dupflag & USER_DUP_MAT) {
- for (a = 0; a < obn->totcol; a++) {
- id = (ID *)obn->mat[a];
- if (id) {
- ID_NEW_REMAP_US(obn->mat[a])
- else {
- obn->mat[a] = ID_NEW_SET(obn->mat[a], BKE_material_copy(bmain, obn->mat[a]));
- /* duplicate grease pencil settings */
- if (ob->mat[a]->gp_style) {
- obn->mat[a]->gp_style = MEM_dupallocN(ob->mat[a]->gp_style);
- }
- }
- id_us_min(id);
-
- if (dupflag & USER_DUP_ACT) {
- BKE_animdata_copy_id_action(bmain, &obn->mat[a]->id, true);
- }
- }
- }
- }
- if (dupflag & USER_DUP_PSYS) {
- ParticleSystem *psys;
- for (psys = obn->particlesystem.first; psys; psys = psys->next) {
- id = (ID *) psys->part;
- if (id) {
- ID_NEW_REMAP_US(psys->part)
- else {
- psys->part = ID_NEW_SET(psys->part, BKE_particlesettings_copy(bmain, psys->part));
- }
-
- if (dupflag & USER_DUP_ACT) {
- BKE_animdata_copy_id_action(bmain, &psys->part->id, true);
- }
-
- id_us_min(id);
- }
- }
- }
-
- id = obn->data;
- didit = 0;
-
- switch (obn->type) {
- case OB_MESH:
- if (dupflag & USER_DUP_MESH) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_mesh_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_CURVE:
- if (dupflag & USER_DUP_CURVE) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_curve_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_SURF:
- if (dupflag & USER_DUP_SURF) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_curve_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_FONT:
- if (dupflag & USER_DUP_FONT) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_curve_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_MBALL:
- if (dupflag & USER_DUP_MBALL) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_mball_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_LAMP:
- if (dupflag & USER_DUP_LAMP) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_lamp_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_ARMATURE:
- DEG_id_tag_update(&obn->id, ID_RECALC_GEOMETRY);
- if (obn->pose)
- BKE_pose_tag_recalc(bmain, obn->pose);
- if (dupflag & USER_DUP_ARM) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_armature_copy(bmain, obn->data));
- BKE_pose_rebuild(bmain, obn, obn->data, true);
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_LATTICE:
- if (dupflag != 0) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_lattice_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_CAMERA:
- if (dupflag != 0) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_camera_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_LIGHTPROBE:
- if (dupflag != 0) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_lightprobe_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_SPEAKER:
- if (dupflag != 0) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_speaker_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- case OB_GPENCIL:
- if (dupflag != 0) {
- ID_NEW_REMAP_US2(obn->data)
- else {
- obn->data = ID_NEW_SET(obn->data, BKE_gpencil_copy(bmain, obn->data));
- didit = 1;
- }
- id_us_min(id);
- }
- break;
- }
-
- /* check if obdata is copied */
- if (didit) {
- Key *key = BKE_key_from_object(obn);
-
- Key *oldkey = BKE_key_from_object(ob);
- if (oldkey != NULL) {
- ID_NEW_SET(oldkey, key);
- }
-
- if (dupflag & USER_DUP_ACT) {
- BKE_animdata_copy_id_action(bmain, (ID *)obn->data, true);
- if (key) {
- BKE_animdata_copy_id_action(bmain, (ID *)key, true);
- }
- }
-
- if (dupflag & USER_DUP_MAT) {
- matarar = give_matarar(obn);
- if (matarar) {
- for (a = 0; a < obn->totcol; a++) {
- id = (ID *)(*matarar)[a];
- if (id) {
- ID_NEW_REMAP_US((*matarar)[a])
- else {
- (*matarar)[a] = ID_NEW_SET((*matarar)[a], BKE_material_copy(bmain, (*matarar)[a]));
- }
- id_us_min(id);
- }
- }
- }
- }
- }
}
return basen;
-
-#undef ID_NEW_REMAP_US
-#undef ID_NEW_REMAP_US2
}
/* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */
@@ -2514,8 +2315,6 @@ static int duplicate_exec(bContext *C, wmOperator *op)
copy_object_set_idnew(C);
- BKE_main_id_clear_newpoins(bmain);
-
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT);
@@ -2594,8 +2393,6 @@ static int add_named_exec(bContext *C, wmOperator *op)
copy_object_set_idnew(C);
- BKE_main_id_clear_newpoins(bmain);
-
/* TODO(sergey): Only update relations for the current scene. */
DEG_relations_tag_update(bmain);
@@ -2647,7 +2444,7 @@ static int join_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
else if (BKE_object_obdata_is_libdata(ob)) {
- BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
+ BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
return OPERATOR_CANCELLED;
}
else if (ob->type == OB_GPENCIL) {
@@ -2709,7 +2506,7 @@ static int join_shapes_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
else if (BKE_object_obdata_is_libdata(ob)) {
- BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
+ BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 5a650d9dc05..ac1f31d0b48 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Morten Mikkelsen,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_bake.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include <string.h>
@@ -43,15 +34,12 @@
#include "DNA_meshdata_types.h"
#include "BLI_blenlib.h"
-#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BKE_blender.h"
-#include "BKE_screen.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
-#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_multires.h"
#include "BKE_report.h"
@@ -120,14 +108,22 @@ typedef struct MultiresBakerJobData {
typedef struct {
Scene *scene;
ListBase data;
- bool bake_clear; /* Clear the images before baking */
- int bake_filter; /* Bake-filter, aka margin */
- short mode; /* mode of baking (displacement, normals, AO) */
- bool use_lores_mesh; /* Use low-resolution mesh when baking displacement maps */
- int number_of_rays; /* Number of rays to be cast when doing AO baking */
- float bias; /* Bias between object and start ray point when doing AO baking */
- int threads; /* Number of threads to be used for baking */
- float user_scale; /* User scale used to scale displacement when baking derivative map. */
+ /** Clear the images before baking */
+ bool bake_clear;
+ /** Bake-filter, aka margin */
+ int bake_filter;
+ /** mode of baking (displacement, normals, AO) */
+ short mode;
+ /** Use low-resolution mesh when baking displacement maps */
+ bool use_lores_mesh;
+ /** Number of rays to be cast when doing AO baking */
+ int number_of_rays;
+ /** Bias between object and start ray point when doing AO baking */
+ float bias;
+ /** Number of threads to be used for baking */
+ int threads;
+ /** User scale used to scale displacement when baking derivative map. */
+ float user_scale;
} MultiresBakeJob;
static bool multiresbake_check(bContext *C, wmOperator *op)
@@ -230,7 +226,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
MultiresModifierData tmp_mmd = *mmd;
DerivedMesh *cddm = CDDM_from_mesh(me);
- DM_set_only_copy(cddm, CD_MASK_BAREMESH);
+ DM_set_only_copy(cddm, &CD_MASK_BAREMESH);
if (mmd->lvl == 0) {
dm = CDDM_copy(cddm);
@@ -256,13 +252,13 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
DerivedMesh *cddm = CDDM_from_mesh(me);
DerivedMesh *dm;
- DM_set_only_copy(cddm, CD_MASK_BAREMESH);
+ DM_set_only_copy(cddm, &CD_MASK_BAREMESH);
/* TODO: DM_set_only_copy wouldn't set mask for loop and poly data,
* but we really need BAREMESH only to save lots of memory
*/
- CustomData_set_only_copy(&cddm->loopData, CD_MASK_BAREMESH);
- CustomData_set_only_copy(&cddm->polyData, CD_MASK_BAREMESH);
+ CustomData_set_only_copy(&cddm->loopData, CD_MASK_BAREMESH.lmask);
+ CustomData_set_only_copy(&cddm->polyData, CD_MASK_BAREMESH.pmask);
*lvl = mmd->totlvl;
*simple = mmd->simple != 0;
@@ -277,7 +273,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
typedef enum ClearFlag {
CLEAR_TANGENT_NORMAL = 1,
- CLEAR_DISPLACEMENT = 2
+ CLEAR_DISPLACEMENT = 2,
} ClearFlag;
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 90b6be215d4..08bf08d0b62 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_bake_api.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -41,9 +33,7 @@
#include "RNA_enum_types.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_fileops.h"
-#include "BLI_math_geom.h"
#include "BLI_path_util.h"
#include "BKE_context.h"
@@ -557,7 +547,7 @@ static bool bake_objects_check(Main *bmain, ViewLayer *view_layer, Object *ob, L
static void bake_images_clear(Main *bmain, const bool is_tangent)
{
Image *image;
- for (image = bmain->image.first; image; image = image->id.next) {
+ for (image = bmain->images.first; image; image = image->id.next) {
if ((image->id.tag & LIB_TAG_DOIT) != 0) {
RE_bake_ibuf_clear(image, is_tangent);
}
@@ -635,9 +625,9 @@ static size_t initialize_internal_images(BakeImages *bake_images, ReportList *re
/* create new mesh with edit mode changes and modifiers applied */
static Mesh *bake_mesh_new_from_object(Depsgraph *depsgraph, Main *bmain, Scene *scene, Object *ob)
{
- ED_object_editmode_load(bmain, ob);
+ bool apply_modifiers = (ob->type != OB_MESH);
+ Mesh *me = BKE_mesh_new_from_object(depsgraph, bmain, scene, ob, apply_modifiers, false);
- Mesh *me = BKE_mesh_new_from_object(depsgraph, bmain, scene, ob, 1, 0);
if (me->flag & ME_AUTOSMOOTH) {
BKE_mesh_split_faces(me, true);
}
@@ -655,7 +645,8 @@ static int bake(
const char *custom_cage, const char *filepath, const int width, const int height,
const char *identifier, ScrArea *sa, const char *uv_layer)
{
- /* We build a depsgraph for the baking, so we don't need to change the original data to adjust visibility and modifiers. */
+ /* We build a depsgraph for the baking,
+ * so we don't need to change the original data to adjust visibility and modifiers. */
Depsgraph *depsgraph = DEG_graph_new(scene, view_layer, DAG_EVAL_RENDER);
DEG_graph_build_from_view_layer(depsgraph, bmain, scene, view_layer);
@@ -773,7 +764,7 @@ static int bake(
}
if (is_cage && custom_cage[0] != '\0') {
- ob_cage = BLI_findstring(&bmain->object, custom_cage, offsetof(ID, name) + 2);
+ ob_cage = BLI_findstring(&bmain->objects, custom_cage, offsetof(ID, name) + 2);
if (ob_cage == NULL || ob_cage->type != OB_MESH) {
BKE_report(reports, RPT_ERROR, "No valid cage object");
@@ -805,7 +796,7 @@ static int bake(
ob_low_eval = DEG_get_evaluated_object(depsgraph, ob_low);
/* get the mesh as it arrives in the renderer */
- me_low = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low);
+ me_low = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low_eval);
/* populate the pixel array with the face data */
if ((is_selected_to_active && (ob_cage == NULL) && is_cage) == false)
@@ -818,7 +809,7 @@ static int bake(
/* prepare cage mesh */
if (ob_cage) {
- me_cage = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_cage);
+ me_cage = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_cage_eval);
if ((me_low->totpoly != me_cage->totpoly) || (me_low->totloop != me_cage->totloop)) {
BKE_report(reports, RPT_ERROR,
"Invalid cage object, the cage mesh must have the same number "
@@ -827,6 +818,8 @@ static int bake(
}
}
else if (is_cage) {
+ BKE_object_eval_reset(ob_low_eval);
+
ModifierData *md = ob_low_eval->modifiers.first;
while (md) {
ModifierData *md_next = md->next;
@@ -844,7 +837,6 @@ static int bake(
md = md_next;
}
- BKE_object_eval_reset(ob_low_eval);
me_cage = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low_eval);
RE_bake_pixels_populate(me_cage, pixel_array_low, num_pixels, &bake_images, uv_layer);
}
@@ -860,10 +852,10 @@ static int bake(
/* initialize highpoly_data */
highpoly[i].ob = ob_iter;
- highpoly[i].me = bake_mesh_new_from_object(depsgraph, bmain, scene, highpoly[i].ob);
highpoly[i].ob_eval = DEG_get_evaluated_object(depsgraph, ob_iter);
highpoly[i].ob_eval->restrictflag &= ~OB_RESTRICT_RENDER;
highpoly[i].ob_eval->base_flag |= (BASE_VISIBLE | BASE_ENABLED_RENDER);
+ highpoly[i].me = bake_mesh_new_from_object(depsgraph, bmain, scene, highpoly[i].ob_eval);
/* lowpoly to highpoly transformation matrix */
copy_m4_m4(highpoly[i].obmat, highpoly[i].ob->obmat);
@@ -887,7 +879,7 @@ static int bake(
/* populate the pixel arrays with the corresponding face data for each high poly object */
if (!RE_bake_pixels_populate_from_objects(
me_low, pixel_array_low, pixel_array_high, highpoly, tot_highpoly, num_pixels, ob_cage != NULL,
- cage_extrusion, ob_low->obmat, (ob_cage ? ob_cage->obmat : ob_low->obmat), me_cage))
+ cage_extrusion, ob_low_eval->obmat, (ob_cage ? ob_cage->obmat : ob_low_eval->obmat), me_cage))
{
BKE_report(reports, RPT_ERROR, "Error handling selected objects");
goto cleanup;
@@ -905,10 +897,10 @@ static int bake(
}
else {
/* If low poly is not renderable it should have failed long ago. */
- BLI_assert((ob_low->restrictflag & OB_RESTRICT_RENDER) == 0);
+ BLI_assert((ob_low_eval->restrictflag & OB_RESTRICT_RENDER) == 0);
if (RE_bake_has_engine(re)) {
- ok = RE_bake_engine(re, depsgraph, ob_low, 0, pixel_array_low, num_pixels, depth, pass_type, pass_filter, result);
+ ok = RE_bake_engine(re, depsgraph, ob_low_eval, 0, pixel_array_low, num_pixels, depth, pass_type, pass_filter, result);
}
else {
BKE_report(reports, RPT_ERROR, "Current render engine does not support baking");
@@ -936,13 +928,13 @@ static int bake(
}
case R_BAKE_SPACE_OBJECT:
{
- RE_bake_normal_world_to_object(pixel_array_low, num_pixels, depth, result, ob_low, normal_swizzle);
+ RE_bake_normal_world_to_object(pixel_array_low, num_pixels, depth, result, ob_low_eval, normal_swizzle);
break;
}
case R_BAKE_SPACE_TANGENT:
{
if (is_selected_to_active) {
- RE_bake_normal_world_to_tangent(pixel_array_low, num_pixels, depth, result, me_low, normal_swizzle, ob_low->obmat);
+ RE_bake_normal_world_to_tangent(pixel_array_low, num_pixels, depth, result, me_low, normal_swizzle, ob_low_eval->obmat);
}
else {
/* from multiresolution */
@@ -950,18 +942,20 @@ static int bake(
ModifierData *md = NULL;
int mode;
- md = modifiers_findByType(ob_low, eModifierType_Multires);
+ BKE_object_eval_reset(ob_low_eval);
+ md = modifiers_findByType(ob_low_eval, eModifierType_Multires);
if (md) {
mode = md->mode;
md->mode &= ~eModifierMode_Render;
}
- me_nores = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low);
+ /* Evaluate modifiers again. */
+ me_nores = BKE_mesh_new_from_object(depsgraph, bmain, scene, ob_low_eval, true, false);
RE_bake_pixels_populate(me_nores, pixel_array_low, num_pixels, &bake_images, uv_layer);
- RE_bake_normal_world_to_tangent(pixel_array_low, num_pixels, depth, result, me_nores, normal_swizzle, ob_low->obmat);
- BKE_libblock_free(bmain, me_nores);
+ RE_bake_normal_world_to_tangent(pixel_array_low, num_pixels, depth, result, me_nores, normal_swizzle, ob_low_eval->obmat);
+ BKE_id_free(bmain, me_nores);
if (md)
md->mode = mode;
@@ -1022,8 +1016,8 @@ static int bake(
BLI_path_suffix(name, FILE_MAX, bk_image->image->id.name + 2, "_");
}
else {
- if (ob_low->mat[i]) {
- BLI_path_suffix(name, FILE_MAX, ob_low->mat[i]->id.name + 2, "_");
+ if (ob_low_eval->mat[i]) {
+ BLI_path_suffix(name, FILE_MAX, ob_low_eval->mat[i]->id.name + 2, "_");
}
else if (me_low->mat[i]) {
BLI_path_suffix(name, FILE_MAX, me_low->mat[i]->id.name + 2, "_");
@@ -1070,7 +1064,7 @@ cleanup:
int i;
for (i = 0; i < tot_highpoly; i++) {
if (highpoly[i].me)
- BKE_libblock_free(bmain, highpoly[i].me);
+ BKE_id_free(bmain, highpoly[i].me);
}
MEM_freeN(highpoly);
}
@@ -1094,10 +1088,10 @@ cleanup:
MEM_freeN(result);
if (me_low)
- BKE_libblock_free(bmain, me_low);
+ BKE_id_free(bmain, me_low);
if (me_cage)
- BKE_libblock_free(bmain, me_cage);
+ BKE_id_free(bmain, me_cage);
DEG_graph_free(depsgraph);
diff --git a/source/blender/editors/object/object_collection.c b/source/blender/editors/object/object_collection.c
index 5e1773bf3c2..4aad3c14a62 100644
--- a/source/blender/editors/object/object_collection.c
+++ b/source/blender/editors/object/object_collection.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_collection.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -42,7 +34,6 @@
#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_library.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -141,7 +132,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* now add all selected objects to the collection(s) */
- for (collection = bmain->collection.first; collection; collection = collection->id.next) {
+ for (collection = bmain->collections.first; collection; collection = collection->id.next) {
if (single_collection && collection != single_collection)
continue;
if (!BKE_collection_has_object(collection, ob))
@@ -216,7 +207,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
/* linking to same collection requires its own loop so we can avoid
* looking up the active objects collections each time */
- for (collection = bmain->collection.first; collection; collection = collection->id.next) {
+ for (collection = bmain->collections.first; collection; collection = collection->id.next) {
if (single_collection && collection != single_collection)
continue;
@@ -308,7 +299,7 @@ static int collection_objects_remove_exec(bContext *C, wmOperator *op)
if (ob == NULL)
return OPERATOR_CANCELLED;
- for (collection = bmain->collection.first; collection; collection = collection->id.next) {
+ for (collection = bmain->collections.first; collection; collection = collection->id.next) {
if (single_collection && collection != single_collection)
continue;
if (!BKE_collection_has_object(collection, ob))
@@ -438,7 +429,7 @@ static int collection_link_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *ob = ED_object_context(C);
- Collection *collection = BLI_findlink(&bmain->collection, RNA_enum_get(op->ptr, "collection"));
+ Collection *collection = BLI_findlink(&bmain->collections, RNA_enum_get(op->ptr, "collection"));
if (ELEM(NULL, ob, collection))
return OPERATOR_CANCELLED;
@@ -538,7 +529,7 @@ static int collection_unlink_exec(bContext *C, wmOperator *UNUSED(op))
if (!collection)
return OPERATOR_CANCELLED;
- BKE_libblock_delete(bmain, collection);
+ BKE_id_delete(bmain, collection);
DEG_relations_tag_update(bmain);
@@ -562,7 +553,8 @@ void OBJECT_OT_collection_unlink(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static int select_grouped_exec(bContext *C, wmOperator *UNUSED(op)) /* Select objects in the same collection as the active */
+/* Select objects in the same collection as the active */
+static int select_grouped_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Collection *collection = CTX_data_pointer_get_type(C, "collection", &RNA_Collection).data;
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 93ff94edc75..f095edc2d60 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung, Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_constraint.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -54,7 +46,6 @@
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -105,7 +96,8 @@ ListBase *get_active_constraints(Object *ob)
return NULL;
}
-/* Find the list that a given constraint belongs to, and/or also get the posechannel this is from (if applicable) */
+/* Find the list that a given constraint belongs to,
+ * and/or also get the posechannel this is from (if applicable) */
ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **r_pchan)
{
if (r_pchan)
@@ -162,7 +154,7 @@ static void validate_pyconstraint_cb(Main *bmain, void *arg1, void *arg2)
/* exception for no script */
if (index) {
/* innovative use of a for...loop to search */
- for (text = bmain->text.first, i = 1; text && index != i; i++, text = text->id.next) ;
+ for (text = bmain->texts.first, i = 1; text && index != i; i++, text = text->id.next) ;
}
data->text = text;
}
@@ -185,7 +177,7 @@ static char *buildmenu_pyconstraints(Main *bmain, Text *con_text, int *pyconinde
*pyconindex = 0;
/* loop through markers, adding them */
- for (text = bmain->text.first, i = 1; text; i++, text = text->id.next) {
+ for (text = bmain->texts.first, i = 1; text; i++, text = text->id.next) {
/* this is important to ensure that right script is shown as active */
if (text == con_text) *pyconindex = i;
@@ -592,7 +584,8 @@ static void object_test_constraint(Main *bmain, Object *owner, bConstraint *con)
static const EnumPropertyItem constraint_owner_items[] = {
{EDIT_CONSTRAINT_OWNER_OBJECT, "OBJECT", 0, "Object", "Edit a constraint on the active object"},
{EDIT_CONSTRAINT_OWNER_BONE, "BONE", 0, "Bone", "Edit a constraint on the active bone"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static bool edit_constraint_poll_generic(bContext *C, StructRNA *rna_type)
@@ -1242,7 +1235,7 @@ static void object_pose_tag_update(Main *bmain, Object *ob)
* Note that this is a bit wide here, since we cannot be sure whether there are some locked proxy bones
* or not...
* XXX Temp hack until new depsgraph hopefully solves this. */
- ob->adt->recalc |= ADT_RECALC_ANIM;
+ DEG_id_tag_update(&ob->id, ID_RECALC_ANIMATION);
}
}
@@ -1306,7 +1299,8 @@ static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op))
if (BKE_constraint_remove_ex(lb, ob, con, true)) {
/* there's no active constraint now, so make sure this is the case */
BKE_constraints_active_set(&ob->constraints, NULL);
- ED_object_constraint_update(bmain, ob); /* needed to set the flags on posebones correctly */
+ /* needed to set the flags on posebones correctly */
+ ED_object_constraint_update(bmain, ob);
/* relatiols */
DEG_relations_tag_update(CTX_data_main(C));
@@ -1637,7 +1631,8 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob
return false;
/* restricted target-type constraints -------------- */
- /* NOTE: for these, we cannot try to add a target object if no valid ones are found, since that doesn't work */
+ /* NOTE: for these, we cannot try to add a target object if no valid ones are found,
+ * since that doesn't work */
/* curve-based constraints - set the only_curve and only_ob flags */
case CONSTRAINT_TYPE_CLAMPTO:
case CONSTRAINT_TYPE_FOLLOWPATH:
@@ -1854,7 +1849,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
/* We need to make use of ugly POSE_ANIMATION_WORKAROUND here too, else anim data are not reloaded
* after calling `BKE_pose_rebuild()`, which causes T43872.
* XXX Temp hack until new depsgraph hopefully solves this. */
- ob->adt->recalc |= ADT_RECALC_ANIM;
+ DEG_id_tag_update(&ob->id, ID_RECALC_ANIMATION);
}
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | ID_RECALC_TRANSFORM);
}
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c
index ad47e07b2e9..8ca0b9c3c91 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2014 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bastien Montagne.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_data_transfer.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include "DNA_mesh_types.h"
@@ -71,7 +63,8 @@ static const EnumPropertyItem DT_layer_items[] = {
#if 0 /* XXX For now, would like to finish/merge work from 2014 gsoc first. */
{DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"},
#endif
-#if 0 /* XXX When SkinModifier is enabled, it seems to erase its own CD_MVERT_SKIN layer from final DM :( */
+#if 0 /* XXX When SkinModifier is enabled,
+ * it seems to erase its own CD_MVERT_SKIN layer from final DM :( */
{DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"},
#endif
{DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"},
@@ -88,7 +81,7 @@ static const EnumPropertyItem DT_layer_items[] = {
{0, "", 0, "Face Data", ""},
{DT_TYPE_SHARP_FACE, "SMOOTH", 0, "Smooth", "Transfer flat/smooth mark"},
{DT_TYPE_FREESTYLE_FACE, "FREESTYLE_FACE", 0, "Freestyle Mark", "Transfer Freestyle face mark"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Note: rna_enum_dt_layers_select_src_items enum is from rna_modifier.c */
@@ -142,7 +135,9 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
- me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, CD_MASK_BAREMESH | CD_MLOOPUV);
+ CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH;
+ cddata_masks.lmask |= CD_MASK_MLOOPUV;
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, &cddata_masks);
num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPUV);
RNA_enum_item_add_separator(&item, &totitem);
@@ -164,7 +159,9 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
- me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, CD_MASK_BAREMESH | CD_MLOOPCOL);
+ CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH;
+ cddata_masks.lmask |= CD_MASK_MLOOPCOL;
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, &cddata_masks);
num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPCOL);
RNA_enum_item_add_separator(&item, &totitem);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 59ce42c50a5..9048b786044 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_edit.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include <stdlib.h>
@@ -38,10 +32,8 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
-#include "BLI_string_utils.h"
#include "BLT_translation.h"
@@ -73,7 +65,6 @@
#include "BKE_image.h"
#include "BKE_lattice.h"
#include "BKE_layer.h"
-#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mball.h"
@@ -81,6 +72,7 @@
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_paint.h"
+#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_softbody.h"
#include "BKE_editmesh.h"
@@ -124,8 +116,6 @@ static void move_to_collection_menus_items(struct uiLayout *layout, struct MoveT
/* ************* XXX **************** */
static void error(const char *UNUSED(arg)) {}
-static void waitcursor(int UNUSED(val)) {}
-static int pupmenu(const char *UNUSED(msg)) { return 0; }
/* port over here */
static void error_libdata(void) {}
@@ -211,21 +201,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
-
- /* Do nothing if no objects was selected. */
- bool have_selected = false;
- for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (base->flag & BASE_VISIBLE) {
- if (base->flag & BASE_SELECTED) {
- have_selected = true;
- break;
- }
- }
- }
-
- if (!have_selected) {
- return OPERATOR_CANCELLED;
- }
+ bool changed = false;
/* Hide selected or unselected objects. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
@@ -237,15 +213,20 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
if (base->flag & BASE_SELECTED) {
ED_object_base_select(base, BA_DESELECT);
base->flag |= BASE_HIDDEN;
+ changed = true;
}
}
else {
if (!(base->flag & BASE_SELECTED)) {
ED_object_base_select(base, BA_DESELECT);
base->flag |= BASE_HIDDEN;
+ changed = true;
}
}
}
+ if (!changed) {
+ return OPERATOR_CANCELLED;
+ }
BKE_layer_collection_sync(scene, view_layer);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
@@ -293,9 +274,12 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- BKE_layer_collection_set_visible(scene, view_layer, lc, extend);
-
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ if (BKE_layer_collection_isolate(scene, view_layer, lc, extend)) {
+ DEG_relations_tag_update(CTX_data_main(C));
+ }
+
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
return OPERATOR_FINISHED;
@@ -322,12 +306,6 @@ void ED_collection_hide_menu_draw(const bContext *C, uiLayout *layout)
continue;
}
- if ((view_layer->runtime_flag & VIEW_LAYER_HAS_HIDE) &&
- !(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS))
- {
- uiLayoutSetActive(row, false);
- }
-
int icon = ICON_NONE;
if (BKE_layer_collection_has_selected_objects(view_layer, lc)) {
icon = ICON_LAYER_ACTIVE;
@@ -368,7 +346,7 @@ static int object_hide_collection_invoke(bContext *C, wmOperator *op, const wmEv
void OBJECT_OT_hide_collection(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Hide Objects By Collection";
+ ot->name = "Hide Collection";
ot->description = "Show only objects in collection (Shift to extend)";
ot->idname = "OBJECT_OT_hide_collection";
@@ -397,7 +375,7 @@ static bool mesh_needs_keyindex(Main *bmain, const Mesh *me)
return false; /* will be added */
}
- for (const Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (const Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if ((ob->parent) && (ob->parent->data == me) && ELEM(ob->partype, PARVERT1, PARVERT3)) {
return true;
}
@@ -424,11 +402,11 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f
if (obedit->type == OB_MESH) {
Mesh *me = obedit->data;
- if (me->edit_btmesh == NULL) {
+ if (me->edit_mesh == NULL) {
return false;
}
- if (me->edit_btmesh->bm->totvert > MESH_MAX_VERTS) {
+ if (me->edit_mesh->bm->totvert > MESH_MAX_VERTS) {
error("Too many vertices");
return false;
}
@@ -436,9 +414,9 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f
EDBM_mesh_load(bmain, obedit);
if (freedata) {
- EDBM_mesh_free(me->edit_btmesh);
- MEM_freeN(me->edit_btmesh);
- me->edit_btmesh = NULL;
+ EDBM_mesh_free(me->edit_mesh);
+ MEM_freeN(me->edit_mesh);
+ me->edit_mesh = NULL;
}
/* will be recalculated as needed. */
{
@@ -518,15 +496,12 @@ bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int f
{
const bool freedata = (flag & EM_FREEDATA) != 0;
- if (flag & EM_WAITCURSOR) waitcursor(1);
-
if (ED_object_editmode_load_ex(bmain, obedit, freedata) == false) {
/* in rare cases (background mode) its possible active object
* is flagged for editmode, without 'obedit' being set [#35489] */
if (UNLIKELY(obedit && obedit->mode & OB_MODE_EDIT)) {
obedit->mode &= ~OB_MODE_EDIT;
}
- if (flag & EM_WAITCURSOR) waitcursor(0);
return true;
}
@@ -538,11 +513,14 @@ bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int f
/* flag object caches as outdated */
BKE_ptcache_ids_from_object(&pidlist, obedit, scene, 0);
for (pid = pidlist.first; pid; pid = pid->next) {
- if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
+ /* particles don't need reset on geometry change */
+ if (pid->type != PTCACHE_TYPE_PARTICLES) {
pid->cache->flag |= PTCACHE_OUTDATED;
+ }
}
BLI_freelistN(&pidlist);
+ BKE_particlesystem_reset_all(obedit);
BKE_ptcache_object_reset(scene, obedit, PTCACHE_RESET_OUTDATED);
/* also flush ob recalc, doesn't take much overhead, but used for particles */
@@ -553,8 +531,6 @@ bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int f
obedit->mode &= ~OB_MODE_EDIT;
}
- if (flag & EM_WAITCURSOR) waitcursor(0);
-
return (obedit->mode & OB_MODE_EDIT) == 0;
}
@@ -584,8 +560,6 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
return false;
}
- if (flag & EM_WAITCURSOR) waitcursor(1);
-
ob->restore_mode = ob->mode;
ob->mode = OB_MODE_EDIT;
@@ -611,7 +585,9 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
ok = 1;
ED_armature_to_edit(ob->data);
/* to ensure all goes in restposition and without striding */
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); /* XXX: should this be ID_RECALC_GEOMETRY? */
+
+ /* XXX: should this be ID_RECALC_GEOMETRY? */
+ DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_ARMATURE, scene);
}
@@ -650,8 +626,6 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
}
- if (flag & EM_WAITCURSOR) waitcursor(0);
-
return (ob->mode & OB_MODE_EDIT) != 0;
}
@@ -659,15 +633,11 @@ bool ED_object_editmode_enter(bContext *C, int flag)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob;
- if ((flag & EM_IGNORE_LAYER) == 0) {
- ob = CTX_data_active_object(C); /* active layer checked here for view3d */
- }
- else {
- ob = view_layer->basact->object;
- }
+ /* Active layer checked here for view3d,
+ * callers that don't want view context can call the extended version. */
+ ob = CTX_data_active_object(C);
if ((ob == NULL) || ID_IS_LINKED(ob)) {
return false;
}
@@ -692,24 +662,24 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op)
}
if (!is_mode_set) {
- ED_object_editmode_enter(C, EM_WAITCURSOR);
+ ED_object_editmode_enter(C, 0);
if (obact->mode & mode_flag) {
FOREACH_SELECTED_OBJECT_BEGIN(view_layer, v3d, ob)
{
if ((ob != obact) && (ob->type == obact->type)) {
- ED_object_editmode_enter_ex(bmain, scene, ob, EM_WAITCURSOR | EM_NO_CONTEXT);
+ ED_object_editmode_enter_ex(bmain, scene, ob, EM_NO_CONTEXT);
}
}
FOREACH_SELECTED_OBJECT_END;
}
}
else {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
if ((obact->mode & mode_flag) == 0) {
FOREACH_OBJECT_BEGIN(view_layer, ob)
{
if ((ob != obact) && (ob->type == obact->type)) {
- ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA);
}
}
FOREACH_OBJECT_END;
@@ -845,331 +815,6 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/* both pointers should exist */
-static void copy_texture_space(Object *to, Object *ob)
-{
- float *poin1 = NULL, *poin2 = NULL;
- short texflag = 0;
-
- if (ob->type == OB_MESH) {
- texflag = ((Mesh *)ob->data)->texflag;
- poin2 = ((Mesh *)ob->data)->loc;
- }
- else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- texflag = ((Curve *)ob->data)->texflag;
- poin2 = ((Curve *)ob->data)->loc;
- }
- else if (ob->type == OB_MBALL) {
- texflag = ((MetaBall *)ob->data)->texflag;
- poin2 = ((MetaBall *)ob->data)->loc;
- }
- else
- return;
-
- if (to->type == OB_MESH) {
- ((Mesh *)to->data)->texflag = texflag;
- poin1 = ((Mesh *)to->data)->loc;
- }
- else if (ELEM(to->type, OB_CURVE, OB_SURF, OB_FONT)) {
- ((Curve *)to->data)->texflag = texflag;
- poin1 = ((Curve *)to->data)->loc;
- }
- else if (to->type == OB_MBALL) {
- ((MetaBall *)to->data)->texflag = texflag;
- poin1 = ((MetaBall *)to->data)->loc;
- }
- else
- return;
-
- memcpy(poin1, poin2, 9 * sizeof(float)); /* this was noted in DNA_mesh, curve, mball */
-
- if (to->type == OB_MESH) {
- /* pass */
- }
- else if (to->type == OB_MBALL) {
- BKE_mball_texspace_calc(to);
- }
- else {
- BKE_curve_texspace_calc(to->data);
- }
-
-}
-
-/* UNUSED, keep in case we want to copy functionality for use elsewhere */
-static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, short event)
-{
- Object *ob;
- Base *base;
- Curve *cu, *cu1;
- Nurb *nu;
-
- if (ID_IS_LINKED(scene)) return;
-
- if (!(ob = OBACT(view_layer))) return;
-
- if (BKE_object_is_in_editmode(ob)) {
- /* obedit_copymenu(); */
- return;
- }
-
- if (event == 24) {
- /* moved to BKE_object_link_modifiers */
- /* copymenu_modifiers(bmain, scene, v3d, ob); */
- return;
- }
-
- for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if (base != BASACT(view_layer)) {
- if (TESTBASELIB(v3d, base)) {
- DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
-
- 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 */
- 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 */
- copy_v3_v3(base->object->size, ob->size);
- copy_v3_v3(base->object->dscale, ob->dscale);
- }
- else if (event == 4) { /* drawtype */
- base->object->dt = ob->dt;
- base->object->dtx = ob->dtx;
- base->object->empty_drawtype = ob->empty_drawtype;
- base->object->empty_drawsize = ob->empty_drawsize;
- }
- else if (event == 5) { /* time offs */
- base->object->sf = ob->sf;
- }
- else if (event == 6) { /* dupli */
- base->object->dupon = ob->dupon;
- base->object->dupoff = ob->dupoff;
- base->object->dupsta = ob->dupsta;
- base->object->dupend = ob->dupend;
-
- base->object->transflag &= ~OB_DUPLI;
- base->object->transflag |= (ob->transflag & OB_DUPLI);
-
- base->object->dup_group = ob->dup_group;
- if (ob->dup_group)
- id_us_plus(&ob->dup_group->id);
- }
- else if (event == 17) { /* tex space */
- copy_texture_space(base->object, ob);
- }
- else if (event == 18) { /* font settings */
-
- if (base->object->type == ob->type) {
- cu = ob->data;
- cu1 = base->object->data;
-
- cu1->spacemode = cu->spacemode;
- cu1->align_y = cu->align_y;
- cu1->spacing = cu->spacing;
- cu1->linedist = cu->linedist;
- cu1->shear = cu->shear;
- cu1->fsize = cu->fsize;
- cu1->xof = cu->xof;
- cu1->yof = cu->yof;
- cu1->textoncurve = cu->textoncurve;
- cu1->wordspace = cu->wordspace;
- cu1->ulpos = cu->ulpos;
- cu1->ulheight = cu->ulheight;
- if (cu1->vfont)
- id_us_min(&cu1->vfont->id);
- cu1->vfont = cu->vfont;
- id_us_plus((ID *)cu1->vfont);
- if (cu1->vfontb)
- id_us_min(&cu1->vfontb->id);
- cu1->vfontb = cu->vfontb;
- id_us_plus((ID *)cu1->vfontb);
- if (cu1->vfonti)
- id_us_min(&cu1->vfonti->id);
- cu1->vfonti = cu->vfonti;
- id_us_plus((ID *)cu1->vfonti);
- if (cu1->vfontbi)
- id_us_min(&cu1->vfontbi->id);
- cu1->vfontbi = cu->vfontbi;
- id_us_plus((ID *)cu1->vfontbi);
-
- BLI_strncpy(cu1->family, cu->family, sizeof(cu1->family));
-
- DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
- }
- }
- else if (event == 19) { /* bevel settings */
-
- if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
- cu = ob->data;
- cu1 = base->object->data;
-
- cu1->bevobj = cu->bevobj;
- cu1->taperobj = cu->taperobj;
- cu1->width = cu->width;
- cu1->bevresol = cu->bevresol;
- cu1->ext1 = cu->ext1;
- cu1->ext2 = cu->ext2;
-
- DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
- }
- }
- else if (event == 25) { /* curve resolution */
-
- if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
- cu = ob->data;
- cu1 = base->object->data;
-
- cu1->resolu = cu->resolu;
- cu1->resolu_ren = cu->resolu_ren;
-
- nu = cu1->nurb.first;
-
- while (nu) {
- nu->resolu = cu1->resolu;
- nu = nu->next;
- }
-
- DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
- }
- }
- else if (event == 21) {
- if (base->object->type == OB_MESH) {
- ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
-
- if (md) {
- ModifierData *tmd = modifiers_findByType(base->object, eModifierType_Subsurf);
-
- if (!tmd) {
- tmd = modifier_new(eModifierType_Subsurf);
- BLI_addtail(&base->object->modifiers, tmd);
- }
-
- modifier_copyData(md, tmd);
- DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
- }
- }
- }
- else if (event == 22) {
- /* Copy the constraint channels over */
- BKE_constraints_copy(&base->object->constraints, &ob->constraints, true);
- DEG_id_tag_update(&base->object->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- }
- else if (event == 23) {
- sbFree(base->object);
- BKE_object_copy_softbody(base->object, ob, 0);
-
- if (!modifiers_findByType(base->object, eModifierType_Softbody)) {
- BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody));
- }
-
- DEG_id_tag_update(&base->object->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- }
- else if (event == 26) {
-#if 0 // XXX old animation system
- BKE_nlastrip_copy(s(&base->object->nlastrips, &ob->nlastrips);
-#endif // XXX old animation system
- }
- else if (event == 27) { /* autosmooth */
- if (base->object->type == OB_MESH) {
- Mesh *me = ob->data;
- Mesh *cme = base->object->data;
- cme->smoothresh = me->smoothresh;
- 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)) {
- cu = ob->data;
- cu1 = base->object->data;
-
- if (cu->flag & CU_UV_ORCO)
- cu1->flag |= CU_UV_ORCO;
- else
- cu1->flag &= ~CU_UV_ORCO;
- }
- }
- else if (event == 29) { /* protected bits */
- base->object->protectflag = ob->protectflag;
- }
- else if (event == 30) { /* index object */
- base->object->index = ob->index;
- }
- else if (event == 31) { /* object color */
- copy_v4_v4(base->object->col, ob->col);
- }
- }
- }
- }
-}
-
-static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, Object *obedit)
-{
- Object *ob;
- short event;
- char str[512];
-
- if (!(ob = OBACT(view_layer))) return;
-
- if (obedit) {
-/* if (ob->type == OB_MESH) */
-/* XXX mesh_copy_menu(); */
- return;
- }
-
- /* Object Mode */
-
- /* If you change this menu, don't forget to update the menu in header_view3d.c
- * view3d_edit_object_copyattrmenu() and in toolbox.c
- */
-
- strcpy(str,
- "Copy Attributes %t|Location %x1|Rotation %x2|Size %x3|Draw Options %x4|"
- "Time Offset %x5|Dupli %x6|Object Color %x31|%l|Mass %x7|Damping %x8|All Physical Attributes %x11|Properties %x9|"
- "Logic Bricks %x10|Protected Transform %x29|%l");
-
- strcat(str, "|Object Constraints %x22");
- strcat(str, "|NLA Strips %x26");
-
-/* XXX if (OB_TYPE_SUPPORT_MATERIAL(ob->type)) { */
-/* 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) || (ob->type == OB_CURVE)) {
- strcat(str, "|Curve Resolution %x25");
- }
-
- if (ob->type == OB_MESH) {
- strcat(str, "|Subsurf Settings %x21|AutoSmooth %x27");
- }
-
- 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) {
- strcat(str, "|Modifiers ... %x24");
- }
-
- event = pupmenu(str);
- if (event <= 0) return;
-
- copy_attr(bmain, scene, view_layer, v3d, event);
-}
-
/* ******************* force field toggle operator ***************** */
void ED_object_check_force_modifiers(Main *bmain, Scene *scene, Object *object)
diff --git a/source/blender/editors/object/object_facemap_ops.c b/source/blender/editors/object/object_facemap_ops.c
index a111a73a42c..c46310c8c9d 100644
--- a/source/blender/editors/object/object_facemap_ops.c
+++ b/source/blender/editors/object/object_facemap_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_facemap_ops.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include <string.h>
@@ -33,8 +26,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
-#include "BLI_path_util.h"
-#include "BLI_string.h"
#include "BLI_listbase.h"
#include "DNA_object_types.h"
@@ -109,8 +100,8 @@ static void object_fmap_swap_edit_mode(Object *ob, int num1, int num2)
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
const int cd_fmap_offset = CustomData_get_offset(&em->bm->pdata, CD_FACEMAP);
if (cd_fmap_offset != -1) {
@@ -248,7 +239,7 @@ static int face_map_assign_exec(bContext *C, wmOperator *UNUSED(op))
if (fmap) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMFace *efa;
BMIter iter;
int *map;
@@ -296,7 +287,7 @@ static int face_map_remove_from_exec(bContext *C, wmOperator *UNUSED(op))
if (fmap) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMFace *efa;
BMIter iter;
int *map;
@@ -341,7 +332,7 @@ void OBJECT_OT_face_map_remove_from(struct wmOperatorType *ot)
static void fmap_select(Object *ob, bool select)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMFace *efa;
BMIter iter;
int *map;
@@ -482,7 +473,7 @@ void OBJECT_OT_face_map_move(wmOperatorType *ot)
static EnumPropertyItem fmap_slot_move[] = {
{1, "UP", 0, "Up", ""},
{-1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c
index 1523cafa928..a1f529b3bde 100644
--- a/source/blender/editors/object/object_gpencil_modifier.c
+++ b/source/blender/editors/object/object_gpencil_modifier.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2018
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_gpencil_modifier.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -39,9 +33,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_math.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
@@ -378,11 +370,6 @@ static int gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type,
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type);
Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
- if (!ptr.data) {
- CTX_wm_operator_poll_msg_set(C, "Context missing 'modifier'");
- return 0;
- }
-
if (!ob || ID_IS_LINKED(ob)) return 0;
if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) return 0;
if (ptr.id.data && ID_IS_LINKED(ptr.id.data)) return 0;
@@ -587,7 +574,7 @@ static int gpencil_modifier_apply_invoke(bContext *C, wmOperator *op, const wmEv
static const EnumPropertyItem gpencil_modifier_apply_as_items[] = {
{MODIFIER_APPLY_DATA, "DATA", 0, "Object Data", "Apply modifier to the object's data"},
{MODIFIER_APPLY_SHAPE, "SHAPE", 0, "New Shape", "Apply deform-only modifier to a new shape on this object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
void OBJECT_OT_gpencil_modifier_apply(wmOperatorType *ot)
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 995f62f3cd8..f65abb2f269 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_hook.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -143,7 +137,7 @@ static bool return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *r_name,
static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMVert *eve;
BMIter iter;
int index = 0, nr = 0;
@@ -323,7 +317,7 @@ static bool object_hook_index_array(Main *bmain, Scene *scene, Object *obedit,
DEG_id_tag_update(obedit->data, 0);
- em = me->edit_btmesh;
+ em = me->edit_mesh;
EDBM_mesh_normals_update(em);
BKE_editmesh_tessface_calc(em);
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index e4953202ee4..33f821126a2 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,20 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_intern.h
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#ifndef __OBJECT_INTERN_H__
#define __OBJECT_INTERN_H__
-struct wmOperatorType;
struct Object;
-struct bContext;
struct StructRNA;
+struct bContext;
struct wmOperator;
+struct wmOperatorType;
struct ModifierData;
@@ -43,7 +36,7 @@ struct ModifierData;
enum eObject_Hook_Add_Mode {
OBJECT_ADDHOOK_NEWOB = 1,
OBJECT_ADDHOOK_SELOB,
- OBJECT_ADDHOOK_SELOB_BONE
+ OBJECT_ADDHOOK_SELOB_BONE,
};
/* internal exports only */
@@ -65,8 +58,6 @@ void OBJECT_OT_parent_clear(struct wmOperatorType *ot);
void OBJECT_OT_vertex_parent_set(struct wmOperatorType *ot);
void OBJECT_OT_track_set(struct wmOperatorType *ot);
void OBJECT_OT_track_clear(struct wmOperatorType *ot);
-void OBJECT_OT_slow_parent_set(struct wmOperatorType *ot);
-void OBJECT_OT_slow_parent_clear(struct wmOperatorType *ot);
void OBJECT_OT_make_local(struct wmOperatorType *ot);
void OBJECT_OT_make_override_static(struct wmOperatorType *ot);
void OBJECT_OT_make_single_user(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c
index 771bbc5c18c..dd0a37b4498 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_modes.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*
* General utils to handle mode switching,
* actual mode switching logic is per-object type.
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 79dffa17c7a..a55163b01d1 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_modifier.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -102,7 +96,7 @@ static void modifier_skin_customdata_delete(struct Object *ob);
static void object_force_modifier_update_for_bind(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
if (ob->type == OB_MESH) {
- Mesh *me_eval = mesh_create_eval_final_view(depsgraph, scene, ob, 0);
+ Mesh *me_eval = mesh_create_eval_final_view(depsgraph, scene, ob, &CD_MASK_BAREMESH);
BKE_id_free(NULL, me_eval);
}
else if (ob->type == OB_LATTICE) {
@@ -112,7 +106,7 @@ static void object_force_modifier_update_for_bind(Depsgraph *depsgraph, Scene *s
BKE_displist_make_mball(depsgraph, scene, ob);
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- BKE_displist_make_curveTypes(depsgraph, scene, ob, false, false);
+ BKE_displist_make_curveTypes(depsgraph, scene, ob, false, false, NULL);
}
}
@@ -239,7 +233,7 @@ bool ED_object_iter_other(
Object *ob;
int totfound = include_orig ? 0 : 1;
- for (ob = bmain->object.first; ob && totfound < users;
+ for (ob = bmain->objects.first; ob && totfound < users;
ob = ob->id.next)
{
if (((ob != orig_ob) || include_orig) &&
@@ -267,8 +261,8 @@ static bool object_has_modifier_cb(Object *ob, void *data)
}
/* Use with ED_object_iter_other(). Sets the total number of levels
-* for any multires modifiers on the object to the int pointed to by
-* callback_data. */
+ * for any multires modifiers on the object to the int pointed to by
+ * callback_data. */
bool ED_object_multires_update_totlevels_cb(Object *ob, void *totlevel_v)
{
ModifierData *md;
@@ -643,7 +637,7 @@ static int modifier_apply_obdata(ReportList *reports, Depsgraph *depsgraph, Scen
return 0;
}
- BKE_mesh_nomain_to_mesh(mesh_applied, me, ob, CD_MASK_MESH, true);
+ BKE_mesh_nomain_to_mesh(mesh_applied, me, ob, &CD_MASK_MESH, true);
if (md->type == eModifierType_Multires)
multires_customdata_delete(me);
@@ -1068,7 +1062,7 @@ static int modifier_apply_invoke(bContext *C, wmOperator *op, const wmEvent *UNU
static const EnumPropertyItem modifier_apply_as_items[] = {
{MODIFIER_APPLY_DATA, "DATA", 0, "Object Data", "Apply modifier to the object's data"},
{MODIFIER_APPLY_SHAPE, "SHAPE", 0, "New Shape", "Apply deform-only modifier to a new shape on this object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
void OBJECT_OT_modifier_apply(wmOperatorType *ot)
@@ -1359,7 +1353,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op)
BLI_path_rel(path, BKE_main_blendfile_path(bmain));
CustomData_external_add(&me->ldata, &me->id, CD_MDISPS, me->totloop, path);
- CustomData_external_write(&me->ldata, &me->id, CD_MASK_MESH, me->totloop, 0);
+ CustomData_external_write(&me->ldata, &me->id, CD_MASK_MESH.lmask, me->totloop, 0);
return OPERATOR_FINISHED;
}
@@ -1492,7 +1486,7 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
static void modifier_skin_customdata_delete(Object *ob)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
if (em)
BM_data_layer_free(em->bm, &em->bm->vdata, CD_MVERT_SKIN);
@@ -1628,7 +1622,7 @@ void OBJECT_OT_skin_loose_mark_clear(wmOperatorType *ot)
static const EnumPropertyItem action_items[] = {
{SKIN_LOOSE_MARK, "MARK", 0, "Mark", "Mark selected vertices as loose"},
{SKIN_LOOSE_CLEAR, "CLEAR", 0, "Clear", "Set selected vertices as not loose"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
ot->name = "Skin Mark/Clear Loose";
@@ -1754,7 +1748,7 @@ static Object *modifier_skin_armature_create(Depsgraph *depsgraph, Main *bmain,
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, skin_ob);
- me_eval_deform = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
+ me_eval_deform = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
mvert = me_eval_deform->mvert;
/* add vertex weights to original mesh */
@@ -1916,7 +1910,8 @@ static int correctivesmooth_bind_exec(bContext *C, wmOperator *op)
/* signal to modifier to recalculate */
csmd->bind_coords_num = (unsigned int)-1;
- /* Force modifier to run, it will call binding routine (this has to happen outside of depsgraph evaluation). */
+ /* Force modifier to run, it will call binding routine
+ * (this has to happen outside of depsgraph evaluation). */
const int mode = csmd->modifier.mode;
csmd->modifier.mode |= eModifierMode_Realtime;
object_force_modifier_update_for_bind(depsgraph, scene, ob);
@@ -2189,23 +2184,8 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
/* precalculate time variable before baking */
for (f = omd->bakestart; f <= omd->bakeend; f++) {
- /* from physics_fluid.c:
- *
- * XXX: This can't be used due to an anim sys optimization that ignores recalc object animation,
- * leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ )
- * --> BKE_animsys_evaluate_all_animation(bmain, eval_time);
- * This doesn't work with drivers:
- * --> BKE_animsys_evaluate_animdata(&fsDomain->id, fsDomain->adt, eval_time, ADT_RECALC_ALL);
- */
-
- /* Modifying the global scene isn't nice, but we can do it in
- * this part of the process before a threaded job is created */
-
- //scene->r.cfra = f;
- //ED_update_for_newframe(bmain, scene);
-
- /* ok, this doesn't work with drivers, but is way faster.
- * let's use this for now and hope nobody wants to drive the time value... */
+ /* For now only simple animation of time value is supported, nothing else.
+ * No drivers or other modifier parameters. */
BKE_animsys_evaluate_animdata(CTX_data_depsgraph(C), scene, (ID *)ob, ob->adt, f, ADT_RECALC_ANIM);
och->time[i] = omd->time;
@@ -2303,7 +2283,8 @@ static int laplaciandeform_bind_exec(bContext *C, wmOperator *op)
lmd->flag |= MOD_LAPLACIANDEFORM_BIND;
}
- /* Force modifier to run, it will call binding routine (this has to happen outside of depsgraph evaluation). */
+ /* Force modifier to run, it will call binding routine
+ * (this has to happen outside of depsgraph evaluation). */
const int mode = lmd->modifier.mode;
lmd->modifier.mode |= eModifierMode_Realtime;
object_force_modifier_update_for_bind(depsgraph, scene, ob);
@@ -2365,7 +2346,8 @@ static int surfacedeform_bind_exec(bContext *C, wmOperator *op)
smd->flags |= MOD_SDEF_BIND;
}
- /* Force modifier to run, it will call binding routine (this has to happen outside of depsgraph evaluation). */
+ /* Force modifier to run, it will call binding routine
+ * (this has to happen outside of depsgraph evaluation). */
const int mode = smd->modifier.mode;
smd->modifier.mode |= eModifierMode_Realtime;
object_force_modifier_update_for_bind(depsgraph, scene, ob);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index eb9dd0bbe28..024fa24480a 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_ops.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -87,8 +80,6 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_vertex_parent_set);
WM_operatortype_append(OBJECT_OT_track_set);
WM_operatortype_append(OBJECT_OT_track_clear);
- WM_operatortype_append(OBJECT_OT_slow_parent_set);
- WM_operatortype_append(OBJECT_OT_slow_parent_clear);
WM_operatortype_append(OBJECT_OT_make_local);
WM_operatortype_append(OBJECT_OT_make_override_static);
WM_operatortype_append(OBJECT_OT_make_single_user);
diff --git a/source/blender/editors/object/object_random.c b/source/blender/editors/object/object_random.c
index 8291b68f15f..7c176318c57 100644
--- a/source/blender/editors/object/object_random.c
+++ b/source/blender/editors/object/object_random.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2014 by Blender Foundation
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_random.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include "MEM_guardedalloc.h"
@@ -162,12 +158,12 @@ void TRANSFORM_OT_vertex_random(struct wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
- ot->prop = RNA_def_float(
+ ot->prop = RNA_def_float_distance(
ot->srna, "offset", 0.1f, -FLT_MAX, FLT_MAX,
"Amount", "Distance to offset", -10.0f, 10.0f);
- RNA_def_float(ot->srna, "uniform", 0.0f, 0.0f, 1.0f, "Uniform",
+ RNA_def_float_factor(ot->srna, "uniform", 0.0f, 0.0f, 1.0f, "Uniform",
"Increase for uniform offset distance", 0.0f, 1.0f);
- RNA_def_float(ot->srna, "normal", 0.0f, 0.0f, 1.0f, "Normal",
+ RNA_def_float_factor(ot->srna, "normal", 0.0f, 0.0f, 1.0f, "Normal",
"Align offset direction to normals", 0.0f, 1.0f);
RNA_def_int(ot->srna, "seed", 0, 0, 10000, "Random Seed", "Seed for the random number generator", 0, 50);
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 3dec9d945a1..dbd90628136 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_relations.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -39,7 +33,7 @@
#include "DNA_mesh_types.h"
#include "DNA_collection_types.h"
#include "DNA_constraint_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lattice_types.h"
#include "DNA_material_types.h"
#include "DNA_meta_types.h"
@@ -70,11 +64,10 @@
#include "BKE_DerivedMesh.h"
#include "BKE_displist.h"
#include "BKE_editmesh.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_fcurve.h"
#include "BKE_idprop.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_lattice.h"
#include "BKE_layer.h"
#include "BKE_library.h"
@@ -96,6 +89,7 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -152,14 +146,14 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(obedit->data, 0);
- em = me->edit_btmesh;
+ em = me->edit_mesh;
EDBM_mesh_normals_update(em);
BKE_editmesh_tessface_calc(em);
/* derivedMesh might be needed for solving parenting,
* so re-create it here */
- makeDerivedMesh(depsgraph, scene, obedit, em, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX, false);
+ makeDerivedMesh(depsgraph, scene, obedit, em, &CD_MASK_BAREMESH_ORIGINDEX, false);
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
@@ -305,9 +299,9 @@ static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
/* Get object to work on - use a menu if we need to... */
- if (ob->dup_group && ID_IS_LINKED(ob->dup_group)) {
+ if (ob->instance_collection && ID_IS_LINKED(ob->instance_collection)) {
/* gives menu with list of objects in group */
- /* proxy_group_objects_menu(C, op, ob, ob->dup_group); */
+ /* proxy_group_objects_menu(C, op, ob, ob->instance_collection); */
WM_enum_search_invoke(C, op, event);
return OPERATOR_CANCELLED;
}
@@ -341,9 +335,9 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- if (gob->dup_group != NULL) {
- const ListBase dup_group_objects = BKE_collection_object_cache_get(gob->dup_group);
- Base *base = BLI_findlink(&dup_group_objects, RNA_enum_get(op->ptr, "object"));
+ if (gob->instance_collection != NULL) {
+ const ListBase instance_collection_objects = BKE_collection_object_cache_get(gob->instance_collection);
+ Base *base = BLI_findlink(&instance_collection_objects, RNA_enum_get(op->ptr, "object"));
ob = base->object;
}
else {
@@ -394,11 +388,11 @@ static const EnumPropertyItem *proxy_collection_object_itemf(
int i = 0;
Object *ob = ED_object_active_context(C);
- if (!ob || !ob->dup_group)
+ if (!ob || !ob->instance_collection)
return DummyRNA_DEFAULT_items;
/* find the object to affect */
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(ob->dup_group, object)
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(ob->instance_collection, object)
{
item_tmp.identifier = item_tmp.name = object->id.name + 2;
item_tmp.value = i++;
@@ -453,7 +447,7 @@ EnumPropertyItem prop_clear_parent_types[] = {
"As 'Clear Parent', but keep the current visual transformations of the object"},
{CLEAR_PARENT_INVERSE, "CLEAR_INVERSE", 0, "Clear Parent Inverse",
"Reset the transform corrections applied to the parenting relationship, does not remove parenting itself"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Helper for ED_object_parent_clear() - Remove deform-modifiers associated with parent */
@@ -505,7 +499,8 @@ void ED_object_parent_clear(Object *ob, const int type)
switch (type) {
case CLEAR_PARENT_ALL:
{
- /* for deformers, remove corresponding modifiers to prevent a large number of modifiers building up */
+ /* for deformers, remove corresponding modifiers to prevent
+ * a large number of modifiers building up */
object_remove_parent_deform_modifiers(ob, ob->parent);
/* clear parenting relationship completely */
@@ -514,14 +509,16 @@ void ED_object_parent_clear(Object *ob, const int type)
}
case CLEAR_PARENT_KEEP_TRANSFORM:
{
- /* remove parent, and apply the parented transform result as object's local transforms */
+ /* remove parent, and apply the parented transform
+ * result as object's local transforms */
ob->parent = NULL;
BKE_object_apply_mat4(ob, ob->obmat, true, false);
break;
}
case CLEAR_PARENT_INVERSE:
{
- /* object stays parented, but the parent inverse (i.e. offset from parent to retain binding state)
+ /* object stays parented, but the parent inverse
+ * (i.e. offset from parent to retain binding state)
* is cleared. In other words: nothing to do here! */
break;
}
@@ -610,7 +607,7 @@ EnumPropertyItem prop_make_parent_types[] = {
{PAR_LATTICE, "LATTICE", 0, "Lattice Deform", ""},
{PAR_VERTEX, "VERTEX", 0, "Vertex", ""},
{PAR_VERTEX_TRI, "VERTEX_TRI", 0, "Vertex (Triangle)", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene, Object *ob, Object *par,
@@ -619,9 +616,11 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
Main *bmain = CTX_data_main(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
bPoseChannel *pchan = NULL;
+ bPoseChannel *pchan_eval = NULL;
const bool pararm = ELEM(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
+ Object *parent_eval = DEG_get_evaluated_object(depsgraph, par);
- DEG_id_tag_update(&par->id, ID_RECALC_TRANSFORM);
+ DEG_id_tag_update(&par->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
/* preconditions */
if (partype == PAR_FOLLOW || partype == PAR_PATH_CONST) {
@@ -632,7 +631,8 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
if ((cu->flag & CU_PATH) == 0) {
cu->flag |= CU_PATH | CU_FOLLOW;
- BKE_displist_make_curveTypes(depsgraph, scene, par, false, false); /* force creation of path data */
+ /* force creation of path data */
+ BKE_displist_make_curveTypes(depsgraph, scene, par, false, false, NULL);
}
else {
cu->flag |= CU_FOLLOW;
@@ -656,6 +656,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
}
else if (ELEM(partype, PAR_BONE, PAR_BONE_RELATIVE)) {
pchan = BKE_pose_channel_active(par);
+ pchan_eval = BKE_pose_channel_active(parent_eval);
if (pchan == NULL) {
BKE_report(reports, RPT_ERROR, "No active bone");
@@ -683,6 +684,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
ob->parent = par;
/* Always clear parentinv matrix for sake of consistency, see T41950. */
unit_m4(ob->parentinv);
+ DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
}
/* handle types */
@@ -743,13 +745,17 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
}
else if (partype == PAR_BONE) {
ob->partype = PARBONE; /* note, dna define, not operator property */
- if (pchan->bone)
+ if (pchan->bone) {
pchan->bone->flag &= ~BONE_RELATIVE_PARENTING;
+ pchan_eval->bone->flag &= ~BONE_RELATIVE_PARENTING;
+ }
}
else if (partype == PAR_BONE_RELATIVE) {
ob->partype = PARBONE; /* note, dna define, not operator property */
- if (pchan->bone)
+ if (pchan->bone) {
pchan->bone->flag |= BONE_RELATIVE_PARENTING;
+ pchan_eval->bone->flag |= BONE_RELATIVE_PARENTING;
+ }
}
else if (partype == PAR_VERTEX) {
ob->partype = PARVERT1;
@@ -916,7 +922,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
{
- Object *ob = ED_object_active_context(C);
+ Object *parent = ED_object_active_context(C);
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Set Parent To"), ICON_NONE);
uiLayout *layout = UI_popup_menu_layout(pup);
@@ -936,26 +942,46 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
RNA_enum_set(&opptr, "type", PAR_OBJECT);
RNA_boolean_set(&opptr, "keep_transform", true);
#endif
- /* ob becomes parent, make the associated menus */
- if (ob->type == OB_ARMATURE) {
+
+ struct {
+ bool mesh, gpencil;
+ } has_children_of_type = { 0 };
+
+ CTX_DATA_BEGIN (C, Object *, child, selected_editable_objects)
+ {
+ if (child == parent) {
+ continue;
+ }
+ if (child->type == OB_MESH) {
+ has_children_of_type.mesh = true;
+ }
+ if (child->type == OB_GPENCIL) {
+ has_children_of_type.gpencil = true;
+ }
+ }
+ CTX_DATA_END;
+
+ if (parent->type == OB_ARMATURE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_NAME);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_ENVELOPE);
- uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO);
+ if (has_children_of_type.mesh || has_children_of_type.gpencil) {
+ uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO);
+ }
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE_RELATIVE);
}
- else if (ob->type == OB_CURVE) {
+ else if (parent->type == OB_CURVE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_CURVE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_FOLLOW);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_PATH_CONST);
}
- else if (ob->type == OB_LATTICE) {
+ else if (parent->type == OB_LATTICE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_LATTICE);
}
/* vertex parenting */
- if (OB_TYPE_SUPPORT_PARVERT(ob->type)) {
+ if (OB_TYPE_SUPPORT_PARVERT(parent->type)) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX_TRI);
}
@@ -1058,83 +1084,6 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/************************ Clear Slow Parent Operator *********************/
-
-static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
- Scene *scene = CTX_data_scene(C);
-
- CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
- {
- if (ob->parent) {
- if (ob->partype & PARSLOW) {
- ob->partype -= PARSLOW;
- BKE_object_where_is_calc(depsgraph, scene, ob);
- ob->partype |= PARSLOW;
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
- }
- }
- }
- CTX_DATA_END;
-
- WM_event_add_notifier(C, NC_SCENE, scene);
-
- return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_slow_parent_clear(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Clear Slow Parent";
- ot->description = "Clear the object's slow parent";
- 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;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-/********************** Make Slow Parent Operator *********************/
-
-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)
- ob->partype |= PARSLOW;
-
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
- }
- CTX_DATA_END;
-
- WM_event_add_notifier(C, NC_SCENE, scene);
-
- return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_slow_parent_set(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Set Slow Parent";
- ot->description = "Set the object's slow parent";
- 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;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
/* ******************** Clear Track Operator ******************* */
enum {
@@ -1145,7 +1094,7 @@ enum {
static const EnumPropertyItem prop_clear_track_types[] = {
{CLEAR_TRACK, "CLEAR", 0, "Clear Track", ""},
{CLEAR_TRACK_KEEP_TRANSFORM, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation (Clear Track)", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* note, poll should check for editable scene */
@@ -1215,7 +1164,7 @@ static const EnumPropertyItem prop_make_track_types[] = {
{CREATE_TRACK_DAMPTRACK, "DAMPTRACK", 0, "Damped Track Constraint", ""},
{CREATE_TRACK_TRACKTO, "TRACKTO", 0, "Track To Constraint", ""},
{CREATE_TRACK_LOCKTRACK, "LOCKTRACK", 0, "Lock Track Constraint", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int track_set_exec(bContext *C, wmOperator *op)
@@ -1240,7 +1189,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data->tar = obact;
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
- /* Lamp, Camera and Speaker track differently by default */
+ /* Light, Camera and Speaker track differently by default */
if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
data->trackflag = TRACK_nZ;
}
@@ -1263,7 +1212,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data->tar = obact;
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
- /* Lamp, Camera and Speaker track differently by default */
+ /* Light, Camera and Speaker track differently by default */
if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
data->reserved1 = TRACK_nZ;
data->reserved2 = UP_Y;
@@ -1287,7 +1236,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
data->tar = obact;
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
- /* Lamp, Camera and Speaker track differently by default */
+ /* Light, Camera and Speaker track differently by default */
if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
data->trackflag = TRACK_nZ;
data->lockflag = LOCK_Y;
@@ -1337,7 +1286,7 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
if (sce->id.lib) return;
for (base = FIRSTBASE; base; base = base->next) {
- if (TESTBASE(v3d, base)) {
+ if (BASE_SELECTED(v3d, base)) {
nbase = MEM_mallocN(sizeof(Base), "newbase");
*nbase = *base;
BLI_addhead(&(sce->base), nbase);
@@ -1350,7 +1299,7 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
static int make_links_scene_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- Scene *scene_to = BLI_findlink(&bmain->scene, RNA_enum_get(op->ptr, "scene"));
+ Scene *scene_to = BLI_findlink(&bmain->scenes, RNA_enum_get(op->ptr, "scene"));
if (scene_to == NULL) {
BKE_report(op->reports, RPT_ERROR, "Could not find scene");
@@ -1374,6 +1323,8 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
+ DEG_relations_tag_update(bmain);
+
/* redraw the 3D view because the object center points are colored differently */
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
@@ -1469,7 +1420,8 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
/* new approach, using functions from kernel */
for (a = 0; a < ob_src->totcol; a++) {
Material *ma = give_current_material(ob_src, a + 1);
- assign_material(bmain, ob_dst, ma, a + 1, BKE_MAT_ASSIGN_USERPREF); /* also works with ma==NULL */
+ /* also works with `ma == NULL` */
+ assign_material(bmain, ob_dst, ma, a + 1, BKE_MAT_ASSIGN_USERPREF);
}
DEG_id_tag_update(&ob_dst->id, ID_RECALC_GEOMETRY);
break;
@@ -1493,7 +1445,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
/* now add in the collections from the link nodes */
for (collection_node = ob_collections; collection_node; collection_node = collection_node->next) {
- if (ob_dst->dup_group != collection_node->link) {
+ if (ob_dst->instance_collection != collection_node->link) {
BKE_collection_object_add(bmain, collection_node->link, ob_dst);
}
else {
@@ -1503,9 +1455,9 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
break;
}
case MAKE_LINKS_DUPLICOLLECTION:
- ob_dst->dup_group = ob_src->dup_group;
- if (ob_dst->dup_group) {
- id_us_plus(&ob_dst->dup_group->id);
+ ob_dst->instance_collection = ob_src->instance_collection;
+ if (ob_dst->instance_collection) {
+ id_us_plus(&ob_dst->instance_collection->id);
ob_dst->transflag |= OB_DUPLICOLLECTION;
}
break;
@@ -1602,11 +1554,12 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
{MAKE_LINKS_OBDATA, "OBDATA", 0, "Object Data", ""},
{MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""},
{MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""},
- {MAKE_LINKS_GROUP, "GROUPS", 0, "Group", ""},
- {MAKE_LINKS_DUPLICOLLECTION, "DUPLICOLLECTION", 0, "DupliGroup", ""},
+ {MAKE_LINKS_GROUP, "GROUPS", 0, "Collection", ""},
+ {MAKE_LINKS_DUPLICOLLECTION, "DUPLICOLLECTION", 0, "Instance Collection", ""},
{MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Modifiers", ""},
{MAKE_LINKS_FONTS, "FONTS", 0, "Fonts", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Link Data";
@@ -1655,7 +1608,7 @@ static void single_object_users_collection(
Object *ob = cob->ob;
/* an object may be in more than one collection */
if ((ob->id.newid == NULL) && ((ob->flag & flag) == flag)) {
- if (!ID_IS_LINKED(ob) && ob->id.us > 1) {
+ if (!ID_IS_LINKED(ob) && BKE_object_scenes_users_get(bmain, ob) > 1) {
ID_NEW_SET(ob, BKE_object_copy(bmain, ob));
}
}
@@ -1680,7 +1633,7 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
#if 0
if (copy_collections) {
Collection *collection, *collectionn;
- for (collection = bmain->collection.first; collection; collection = collection->id.next) {
+ for (collection = bmain->collections.first; collection; collection = collection->id.next) {
bool all_duplicated = true;
bool any_duplicated = false;
@@ -1757,7 +1710,7 @@ static void new_id_matar(Main *bmain, Material **matar, const int totcol)
static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const int flag)
{
- Lamp *la;
+ Light *la;
Curve *cu;
/* Camera *cam; */
Mesh *me;
@@ -1774,7 +1727,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer
switch (ob->type) {
case OB_LAMP:
- ob->data = la = ID_NEW_SET(ob->data, BKE_lamp_copy(bmain, ob->data));
+ ob->data = la = ID_NEW_SET(ob->data, BKE_light_copy(bmain, ob->data));
break;
case OB_CAMERA:
ob->data = ID_NEW_SET(ob->data, BKE_camera_copy(bmain, ob->data));
@@ -1838,7 +1791,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer
}
FOREACH_OBJECT_FLAG_END;
- me = bmain->mesh.first;
+ me = bmain->meshes.first;
while (me) {
ID_NEW_REMAP(me->texcomesh);
me = me->id.next;
@@ -1868,7 +1821,8 @@ static void single_mat_users(Main *bmain, Scene *scene, ViewLayer *view_layer, V
for (a = 1; a <= ob->totcol; a++) {
ma = give_current_material(ob, a);
if (ma) {
- /* do not test for LIB_TAG_NEW or use newid: this functions guaranteed delivers single_users! */
+ /* do not test for LIB_TAG_NEW or use newid:
+ * this functions guaranteed delivers single_users! */
if (ma->id.us > 1) {
man = BKE_material_copy(bmain, ma);
@@ -1896,23 +1850,23 @@ static void single_mat_users_expand(Main *bmain)
MetaBall *mb;
bGPdata *gpd;
- for (ob = bmain->object.first; ob; ob = ob->id.next)
+ for (ob = bmain->objects.first; ob; ob = ob->id.next)
if (ob->id.tag & LIB_TAG_NEW)
new_id_matar(bmain, ob->mat, ob->totcol);
- for (me = bmain->mesh.first; me; me = me->id.next)
+ for (me = bmain->meshes.first; me; me = me->id.next)
if (me->id.tag & LIB_TAG_NEW)
new_id_matar(bmain, me->mat, me->totcol);
- for (cu = bmain->curve.first; cu; cu = cu->id.next)
+ for (cu = bmain->curves.first; cu; cu = cu->id.next)
if (cu->id.tag & LIB_TAG_NEW)
new_id_matar(bmain, cu->mat, cu->totcol);
- for (mb = bmain->mball.first; mb; mb = mb->id.next)
+ for (mb = bmain->metaballs.first; mb; mb = mb->id.next)
if (mb->id.tag & LIB_TAG_NEW)
new_id_matar(bmain, mb->mat, mb->totcol);
- for (gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next)
+ for (gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next)
if (gpd->id.tag & LIB_TAG_NEW)
new_id_matar(bmain, gpd->mat, gpd->totcol);
}
@@ -2016,7 +1970,7 @@ static void tag_localizable_objects(bContext *C, const int mode)
/* Also forbid making objects local if other library objects are using
* them for modifiers or constraints.
*/
- for (Object *object = bmain->object.first; object; object = object->id.next) {
+ for (Object *object = bmain->objects.first; object; object = object->id.next) {
if ((object->id.tag & LIB_TAG_DOIT) == 0) {
BKE_library_foreach_ID_link(NULL, &object->id, tag_localizable_looper, NULL, IDWALK_READONLY);
}
@@ -2040,7 +1994,7 @@ static bool make_local_all__instance_indirect_unused(Main *bmain, ViewLayer *vie
Object *ob;
bool changed = false;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ID_IS_LINKED(ob) && (ob->id.us == 0)) {
Base *base;
@@ -2183,7 +2137,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
{MAKE_LOCAL_SELECT_OBDATA, "SELECT_OBDATA", 0, "Selected Objects and Data", ""},
{MAKE_LOCAL_SELECT_OBDATA_MATERIAL, "SELECT_OBDATA_MATERIAL", 0, "Selected Objects, Data and Materials", ""},
{MAKE_LOCAL_ALL, "ALL", 0, "All", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -2214,8 +2168,9 @@ static void make_override_static_tag_object(Object *obact, Object *ob)
return;
}
- /* Note: all this is very case-by-case bad handling, ultimately we'll want a real full 'automatic', generic
- * handling of all this, will probably require adding some override-aware stuff to library_query code... */
+ /* Note: all this is very case-by-case bad handling, ultimately we'll want a real full
+ * 'automatic', generic handling of all this,
+ * will probably require adding some override-aware stuff to library_query code... */
if (obact->type == OB_ARMATURE && ob->modifiers.first != NULL) {
for (ModifierData *md = ob->modifiers.first; md != NULL; md = md->next) {
@@ -2257,7 +2212,7 @@ static int make_override_static_invoke(bContext *C, wmOperator *op, const wmEven
}
/* Get object to work on - use a menu if we need to... */
- if (!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group)) {
+ if (!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_LINKED(obact->instance_collection)) {
/* Gives menu with list of objects in group. */
WM_enum_search_invoke(C, op, event);
return OPERATOR_CANCELLED;
@@ -2292,9 +2247,9 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
bool success = false;
- if (!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group)) {
+ if (!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_LINKED(obact->instance_collection)) {
Object *obcollection = obact;
- Collection *collection = obcollection->dup_group;
+ Collection *collection = obcollection->instance_collection;
const ListBase dup_collection_objects = BKE_collection_object_cache_get(collection);
Base *base = BLI_findlink(&dup_collection_objects, RNA_enum_get(op->ptr, "object"));
@@ -2357,16 +2312,18 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
- /* obcollection is no more duplicollection-ing, it merely parents whole collection of overriding instantiated objects. */
- obcollection->dup_group = NULL;
+ /* obcollection is no more duplicollection-ing,
+ * it merely parents whole collection of overriding instantiated objects. */
+ obcollection->instance_collection = NULL;
- /* Also, we'd likely want to lock by default things like transformations of implicitly overridden objects? */
+ /* Also, we'd likely want to lock by default things like
+ * transformations of implicitly overridden objects? */
DEG_id_tag_update(&scene->id, 0);
/* Cleanup. */
BKE_main_id_clear_newpoins(bmain);
- BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, false);
+ BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, false);
}
/* Else, poll func ensures us that ID_IS_LINKED(obact) is true. */
else if (obact->type == OB_ARMATURE) {
@@ -2374,17 +2331,18 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
obact->id.tag |= LIB_TAG_DOIT;
- for (Object *ob = bmain->object.first; ob != NULL; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob != NULL; ob = ob->id.next) {
make_override_static_tag_object(obact, ob);
}
success = BKE_override_static_create_from_tag(bmain);
- /* Also, we'd likely want to lock by default things like transformations of implicitly overridden objects? */
+ /* Also, we'd likely want to lock by default things like
+ * transformations of implicitly overridden objects? */
/* Cleanup. */
BKE_main_id_clear_newpoins(bmain);
- BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, false);
+ BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, false);
}
/* TODO: probably more cases where we want to do automated smart things in the future! */
else {
@@ -2404,7 +2362,7 @@ static bool make_override_static_poll(bContext *C)
return (BKE_override_static_is_enabled() &&
ED_operator_objectmode(C) && obact != NULL &&
((ID_IS_LINKED(obact) && obact->id.tag & LIB_TAG_EXTERN) ||
- (!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group))));
+ (!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_LINKED(obact->instance_collection))));
}
void OBJECT_OT_make_override_static(wmOperatorType *ot)
@@ -2487,7 +2445,8 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
static const EnumPropertyItem type_items[] = {
{MAKE_SINGLE_USER_SELECTED, "SELECTED_OBJECTS", 0, "Selected Objects", ""},
{MAKE_SINGLE_USER_ALL, "ALL", 0, "All", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Make Single User";
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 0b032a3111a..2155956727e 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_select.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
-
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@@ -39,7 +32,7 @@
#include "DNA_modifier_types.h"
#include "DNA_scene_types.h"
#include "DNA_armature_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_workspace_types.h"
#include "DNA_gpencil_types.h"
@@ -72,6 +65,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "WM_message.h"
#include "ED_armature.h"
#include "ED_object.h"
@@ -88,7 +82,9 @@
#include "object_intern.h"
-/************************ Exported **************************/
+/* -------------------------------------------------------------------- */
+/** \name Public Object Selection API
+ * \{ */
/* simple API for object selection, rather than just using the flag
* this takes into account the 'restrict selection in 3d view' flag.
@@ -126,11 +122,13 @@ void ED_object_base_select(Base *base, eObjectSelect_Mode mode)
*/
void ED_object_base_activate(bContext *C, Base *base)
{
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
view_layer->basact = base;
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_SELECT);
}
@@ -195,7 +193,11 @@ bool ED_object_base_deselect_all(ViewLayer *view_layer, View3D *v3d, int action)
return ED_object_base_deselect_all_ex(view_layer, v3d, action, NULL);
}
-/********************** Jump To Object Utilities **********************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Jump To Object Utilities
+ * \{ */
static int get_base_select_priority(Base *base)
{
@@ -370,7 +372,11 @@ bool ED_object_jump_to_bone(
return false;
}
-/********************** Selection Operators **********************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select Operator Utils
+ * \{ */
static bool objects_selectable_poll(bContext *C)
{
@@ -386,7 +392,11 @@ static bool objects_selectable_poll(bContext *C)
return 1;
}
-/************************ Select by Type *************************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select by Type
+ * \{ */
static int object_select_by_type_exec(bContext *C, wmOperator *op)
{
@@ -434,9 +444,14 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first");
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 1, "Type", "");
+ RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_ID);
}
-/*********************** Selection by Links *********************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Selection by Links
+ * \{ */
enum {
OBJECT_SELECT_LINKED_IPO = 1,
@@ -445,7 +460,7 @@ enum {
OBJECT_SELECT_LINKED_DUPGROUP,
OBJECT_SELECT_LINKED_PARTICLE,
OBJECT_SELECT_LINKED_LIBRARY,
- OBJECT_SELECT_LINKED_LIBRARY_OBDATA
+ OBJECT_SELECT_LINKED_LIBRARY_OBDATA,
};
static const EnumPropertyItem prop_select_linked_types[] = {
@@ -456,7 +471,7 @@ static const EnumPropertyItem prop_select_linked_types[] = {
{OBJECT_SELECT_LINKED_PARTICLE, "PARTICLE", 0, "Particle System", ""},
{OBJECT_SELECT_LINKED_LIBRARY, "LIBRARY", 0, "Library", ""},
{OBJECT_SELECT_LINKED_LIBRARY_OBDATA, "LIBRARY_OBDATA", 0, "Library (Object Data)", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static bool object_select_all_by_obdata(bContext *C, void *obdata)
@@ -503,16 +518,16 @@ static bool object_select_all_by_material(bContext *C, Material *mat)
return changed;
}
-static bool object_select_all_by_dup_group(bContext *C, Object *ob)
+static bool object_select_all_by_instance_collection(bContext *C, Object *ob)
{
bool changed = false;
- Collection *dup_group = (ob->transflag & OB_DUPLICOLLECTION) ? ob->dup_group : NULL;
+ Collection *instance_collection = (ob->transflag & OB_DUPLICOLLECTION) ? ob->instance_collection : NULL;
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
- Collection *dup_group_other = (base->object->transflag & OB_DUPLICOLLECTION) ? base->object->dup_group : NULL;
- if (dup_group == dup_group_other) {
+ Collection *instance_collection_other = (base->object->transflag & OB_DUPLICOLLECTION) ? base->object->instance_collection : NULL;
+ if (instance_collection == instance_collection_other) {
ED_object_base_select(base, BA_SELECT);
changed = true;
}
@@ -652,10 +667,10 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
changed = object_select_all_by_material(C, mat);
}
else if (nr == OBJECT_SELECT_LINKED_DUPGROUP) {
- if (ob->dup_group == NULL)
+ if (ob->instance_collection == NULL)
return OPERATOR_CANCELLED;
- changed = object_select_all_by_dup_group(C, ob);
+ changed = object_select_all_by_instance_collection(C, ob);
}
else if (nr == OBJECT_SELECT_LINKED_PARTICLE) {
if (BLI_listbase_is_empty(&ob->particlesystem))
@@ -705,7 +720,11 @@ void OBJECT_OT_select_linked(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", prop_select_linked_types, 0, "Type", "");
}
-/*********************** Selected Grouped ********************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Selected Grouped
+ * \{ */
enum {
OBJECT_GRPSEL_CHILDREN_RECURSIVE = 0,
@@ -733,7 +752,7 @@ static const EnumPropertyItem prop_select_grouped_types[] = {
{OBJECT_GRPSEL_COLOR, "COLOR", 0, "Color", "Object Color"},
{OBJECT_GRPSEL_KEYINGSET, "KEYINGSET", 0, "Keying Set", "Objects included in active Keying Set"},
{OBJECT_GRPSEL_LIGHT_TYPE, "LIGHT_TYPE", 0, "Light Type", "Matching light types"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static bool select_grouped_children(bContext *C, Object *ob, const bool recursive)
@@ -781,7 +800,8 @@ static bool select_grouped_parent(bContext *C) /* Makes parent active and de-sel
#define COLLECTION_MENU_MAX 24
-static bool select_grouped_collection(bContext *C, Object *ob) /* Select objects in the same group as the active */
+/* Select objects in the same group as the active */
+static bool select_grouped_collection(bContext *C, Object *ob)
{
bool changed = false;
Collection *collection, *ob_collections[COLLECTION_MENU_MAX];
@@ -789,7 +809,7 @@ static bool select_grouped_collection(bContext *C, Object *ob) /* Select object
uiPopupMenu *pup;
uiLayout *layout;
- for (collection = CTX_data_main(C)->collection.first; collection && collection_count < COLLECTION_MENU_MAX; collection = collection->id.next) {
+ for (collection = CTX_data_main(C)->collections.first; collection && collection_count < COLLECTION_MENU_MAX; collection = collection->id.next) {
if (BKE_collection_has_object(collection, ob)) {
ob_collections[collection_count] = collection;
collection_count++;
@@ -867,16 +887,16 @@ static bool select_grouped_siblings(bContext *C, Object *ob)
CTX_DATA_END;
return changed;
}
-static bool select_grouped_lamptype(bContext *C, Object *ob)
+static bool select_grouped_lighttype(bContext *C, Object *ob)
{
- Lamp *la = ob->data;
+ Light *la = ob->data;
bool changed = false;
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
if (base->object->type == OB_LAMP) {
- Lamp *la_test = base->object->data;
+ Light *la_test = base->object->data;
if ((la->type == la_test->type) && ((base->flag & BASE_SELECTED) == 0)) {
ED_object_base_select(base, BA_SELECT);
changed = true;
@@ -922,7 +942,7 @@ static bool select_grouped_color(bContext *C, Object *ob)
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && (compare_v3v3(base->object->col, ob->col, 0.005f))) {
+ if (((base->flag & BASE_SELECTED) == 0) && (compare_v3v3(base->object->color, ob->color, 0.005f))) {
ED_object_base_select(base, BA_SELECT);
changed = true;
}
@@ -1039,7 +1059,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Active object must be a light");
break;
}
- changed |= select_grouped_lamptype(C, ob);
+ changed |= select_grouped_lighttype(C, ob);
break;
default:
break;
@@ -1074,7 +1094,11 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
}
-/**************************** (De)select All ****************************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name (De)select All
+ * \{ */
static int object_select_all_exec(bContext *C, wmOperator *op)
{
@@ -1120,7 +1144,11 @@ void OBJECT_OT_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
-/**************************** Select In The Same Collection ****************************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select In The Same Collection
+ * \{ */
static int object_select_same_collection_exec(bContext *C, wmOperator *op)
{
@@ -1174,7 +1202,12 @@ void OBJECT_OT_select_same_collection(wmOperatorType *ot)
RNA_def_string(ot->srna, "collection", NULL, MAX_ID_NAME, "Collection", "Name of the collection to select");
}
-/**************************** Select Mirror ****************************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select Mirror
+ * \{ */
+
static int object_select_mirror_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
@@ -1231,7 +1264,9 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
}
+/** \} */
+/* -------------------------------------------------------------------- */
/** \name Select More/Less
* \{ */
@@ -1261,7 +1296,6 @@ static bool object_select_more_less(bContext *C, const bool select)
CTX_DATA_END;
-
for (ctx_base = ctx_base_list.first; ctx_base; ctx_base = ctx_base->next) {
Object *ob = ((Base *)ctx_base->ptr.data)->object;
if (ob->parent) {
@@ -1352,8 +1386,9 @@ void OBJECT_OT_select_less(wmOperatorType *ot)
/** \} */
-
-/**************************** Select Random ****************************/
+/* -------------------------------------------------------------------- */
+/** \name Select Random
+ * \{ */
static int object_select_random_exec(bContext *C, wmOperator *op)
{
@@ -1398,3 +1433,5 @@ void OBJECT_OT_select_random(wmOperatorType *ot)
/* properties */
WM_operator_properties_select_random(ot);
}
+
+/** \} */
diff --git a/source/blender/editors/object/object_shader_fx.c b/source/blender/editors/object/object_shader_fx.c
index a7505c4b2cc..8580ea10d35 100644
--- a/source/blender/editors/object/object_shader_fx.c
+++ b/source/blender/editors/object/object_shader_fx.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2018
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_shader_fx.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -39,12 +33,12 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_math.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
+#include "BLT_translation.h"
+
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_shader_fx.h"
@@ -263,8 +257,6 @@ static const EnumPropertyItem *shaderfx_add_itemf(
void OBJECT_OT_shaderfx_add(wmOperatorType *ot)
{
- PropertyRNA *prop;
-
/* identifiers */
ot->name = "Add Effect";
ot->description = "Add a visual effect to the active object";
@@ -279,9 +271,9 @@ void OBJECT_OT_shaderfx_add(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop = RNA_def_enum(ot->srna, "type", rna_enum_object_shaderfx_type_items, eShaderFxType_Blur, "Type", "");
- RNA_def_enum_funcs(prop, shaderfx_add_itemf);
- ot->prop = prop;
+ ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_shaderfx_type_items, eShaderFxType_Blur, "Type", "");
+ RNA_def_enum_funcs(ot->prop, shaderfx_add_itemf);
+ RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_ID); /* Abused, for "Light"... */
}
/************************ generic functions for operators using names and data context *********************/
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index cafb3a50202..d445177f236 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, shapekey support
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_shapekey.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 1620d1f82f9..f7a49f3fcb7 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2008 full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_transform.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
@@ -35,7 +29,7 @@
#include "DNA_armature_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_gpencil_types.h"
@@ -228,15 +222,15 @@ static void object_clear_scale(Object *ob, const bool clear_delta)
{
/* clear scale factors which are not locked */
if ((ob->protectflag & OB_LOCK_SCALEX) == 0) {
- ob->size[0] = 1.0f;
+ ob->scale[0] = 1.0f;
if (clear_delta) ob->dscale[0] = 1.0f;
}
if ((ob->protectflag & OB_LOCK_SCALEY) == 0) {
- ob->size[1] = 1.0f;
+ ob->scale[1] = 1.0f;
if (clear_delta) ob->dscale[1] = 1.0f;
}
if ((ob->protectflag & OB_LOCK_SCALEZ) == 0) {
- ob->size[2] = 1.0f;
+ ob->scale[2] = 1.0f;
if (clear_delta) ob->dscale[2] = 1.0f;
}
}
@@ -414,7 +408,7 @@ static void ignore_parent_tx(const bContext *C, Main *bmain, Scene *scene, Objec
Depsgraph *depsgraph = CTX_data_depsgraph(C);
/* a change was made, adjust the children to compensate */
- for (ob_child = bmain->object.first; ob_child; ob_child = ob_child->id.next) {
+ for (ob_child = bmain->objects.first; ob_child; ob_child = ob_child->id.next) {
if (ob_child->parent == ob) {
BKE_object_apply_mat4(ob_child, ob_child->obmat, true, false);
BKE_object_workob_calc_parent(depsgraph, scene, ob_child, &workob);
@@ -491,7 +485,8 @@ static int apply_objects_internal(
bool has_unparented_layers = false;
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- /* Parented layers aren't supported as we can't easily re-evaluate the scene to sample parent movement */
+ /* Parented layers aren't supported as we can't easily re-evaluate
+ * the scene to sample parent movement */
if (gpl->parent == NULL) {
has_unparented_layers = true;
break;
@@ -515,7 +510,7 @@ static int apply_objects_internal(
}
if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
if (la->type == LA_AREA) {
if (apply_rot || apply_loc) {
BKE_reportf(reports, RPT_ERROR,
@@ -635,7 +630,7 @@ static int apply_objects_internal(
continue;
if (apply_scale)
- BKE_tracking_reconstruction_scale(&clip->tracking, ob->size);
+ BKE_tracking_reconstruction_scale(&clip->tracking, ob->scale);
}
else if (ob->type == OB_EMPTY) {
/* It's possible for empties too, even though they don't
@@ -654,12 +649,12 @@ static int apply_objects_internal(
(apply_rot == false) &&
(apply_scale == true))
{
- float max_scale = max_fff(fabsf(ob->size[0]), fabsf(ob->size[1]), fabsf(ob->size[2]));
+ float max_scale = max_fff(fabsf(ob->scale[0]), fabsf(ob->scale[1]), fabsf(ob->scale[2]));
ob->empty_drawsize *= max_scale;
}
}
else if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
if (la->type != LA_AREA) {
continue;
}
@@ -685,7 +680,7 @@ static int apply_objects_internal(
if (apply_loc)
zero_v3(ob->loc);
if (apply_scale)
- ob->size[0] = ob->size[1] = ob->size[2] = 1.0f;
+ ob->scale[0] = ob->scale[1] = ob->scale[2] = 1.0f;
if (apply_rot) {
zero_v3(ob->rot);
unit_qt(ob->quat);
@@ -785,9 +780,9 @@ void OBJECT_OT_transform_apply(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_boolean(ot->srna, "location", 0, "Location", "");
- RNA_def_boolean(ot->srna, "rotation", 0, "Rotation", "");
- RNA_def_boolean(ot->srna, "scale", 0, "Scale", "");
+ RNA_def_boolean(ot->srna, "location", true, "Location", "");
+ RNA_def_boolean(ot->srna, "rotation", true, "Rotation", "");
+ RNA_def_boolean(ot->srna, "scale", true, "Scale", "");
RNA_def_boolean(ot->srna, "properties", true, "Apply Properties",
"Modify properties such as curve vertex radius, font size and bone envelope");
}
@@ -810,9 +805,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *tob;
- float cursor[3], cent[3], cent_neg[3], centn[3];
+ float cent[3], cent_neg[3], centn[3];
+ const float *cursor = scene->cursor.location;
int centermode = RNA_enum_get(op->ptr, "type");
- int around = RNA_enum_get(op->ptr, "center"); /* initialized from v3d->around */
ListBase ctx_data_list;
CollectionPointerLink *ctx_ob;
@@ -825,12 +820,22 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in edit mode");
return OPERATOR_CANCELLED;
}
- else {
- /* get the view settings if 'around' isn't set and the view is available */
- View3D *v3d = CTX_wm_view3d(C);
- copy_v3_v3(cursor, scene->cursor.location);
- if (v3d && !RNA_struct_property_is_set(op->ptr, "center"))
- around = scene->toolsettings->transform_pivot_point;
+
+ int around;
+ {
+ PropertyRNA *prop_center = RNA_struct_find_property(op->ptr, "center");
+ if (RNA_property_is_set(op->ptr, prop_center)) {
+ around = RNA_property_enum_get(op->ptr, prop_center);
+ }
+ else {
+ if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_BOUNDS) {
+ around = V3D_AROUND_CENTER_BOUNDS;
+ }
+ else {
+ around = V3D_AROUND_CENTER_MEDIAN;
+ }
+ RNA_property_enum_set(op->ptr, prop_center, around);
+ }
}
zero_v3(cent);
@@ -838,7 +843,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (obedit) {
if (obedit->type == OB_MESH) {
Mesh *me = obedit->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMVert *eve;
BMIter iter;
@@ -896,11 +901,11 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
BLI_listbase_rotate_first(&ctx_data_list, (LinkData *)ctx_ob_act);
}
- for (tob = bmain->object.first; tob; tob = tob->id.next) {
+ for (tob = bmain->objects.first; tob; tob = tob->id.next) {
if (tob->data)
((ID *)tob->data)->tag &= ~LIB_TAG_DOIT;
- if (tob->dup_group)
- ((ID *)tob->dup_group)->tag &= ~LIB_TAG_DOIT;
+ if (tob->instance_collection)
+ ((ID *)tob->instance_collection)->tag &= ~LIB_TAG_DOIT;
}
for (ctx_ob = ctx_data_list.first;
@@ -921,8 +926,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (ob->data == NULL) {
/* special support for dupligroups */
- if ((ob->transflag & OB_DUPLICOLLECTION) && ob->dup_group && (ob->dup_group->id.tag & LIB_TAG_DOIT) == 0) {
- if (ID_IS_LINKED(ob->dup_group)) {
+ if ((ob->transflag & OB_DUPLICOLLECTION) && ob->instance_collection && (ob->instance_collection->id.tag & LIB_TAG_DOIT) == 0) {
+ if (ID_IS_LINKED(ob->instance_collection)) {
tot_lib_error++;
}
else {
@@ -939,10 +944,10 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
mul_m4_v3(ob->imat, cent);
}
- add_v3_v3(ob->dup_group->dupli_ofs, cent);
+ add_v3_v3(ob->instance_collection->instance_offset, cent);
tot_change++;
- ob->dup_group->id.tag |= LIB_TAG_DOIT;
+ ob->instance_collection->id.tag |= LIB_TAG_DOIT;
do_inverse_offset = true;
}
}
@@ -1007,7 +1012,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
Curve *cu = ob->data;
- if (ob->bb == NULL && (centermode != ORIGIN_TO_CURSOR)) {
+ if (ob->runtime.bb == NULL && (centermode != ORIGIN_TO_CURSOR)) {
/* do nothing*/
}
else {
@@ -1016,8 +1021,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
else {
/* extra 0.5 is the height o above line */
- cent[0] = 0.5f * (ob->bb->vec[4][0] + ob->bb->vec[0][0]);
- cent[1] = 0.5f * (ob->bb->vec[0][1] + ob->bb->vec[2][1]);
+ cent[0] = 0.5f * (ob->runtime.bb->vec[4][0] + ob->runtime.bb->vec[0][0]);
+ cent[1] = 0.5f * (ob->runtime.bb->vec[0][1] + ob->runtime.bb->vec[2][1]);
}
cent[2] = 0.0f;
@@ -1122,7 +1127,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
float diff_mat[4][4];
float inverse_diff_mat[4][4];
- /* recalculate all strokes (all layers are considered without evaluating lock attributtes) */
+ /* recalculate all strokes
+ * (all layers are considered without evaluating lock attributes) */
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* calculate difference matrix */
ED_gpencil_parent_location(depsgraph, obact, gpd, gpl, diff_mat);
@@ -1192,7 +1198,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if ((ob_other->flag & OB_DONE) == 0 &&
((ob->data && (ob->data == ob_other->data)) ||
- (ob->dup_group == ob_other->dup_group &&
+ (ob->instance_collection == ob_other->instance_collection &&
(ob->transflag | ob_other->transflag) & OB_DUPLICOLLECTION)))
{
ob_other->flag |= OB_DONE;
@@ -1203,7 +1209,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
BKE_object_where_is_calc(depsgraph, scene, ob_other);
if (ob_other->type == OB_ARMATURE) {
- BKE_pose_where_is(depsgraph, scene, ob_other); /* needed for bone parents */
+ /* needed for bone parents */
+ BKE_pose_where_is(depsgraph, scene, ob_other);
}
ignore_parent_tx(C, bmain, scene, ob_other);
}
@@ -1214,7 +1221,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
BLI_freelistN(&ctx_data_list);
- for (tob = bmain->object.first; tob; tob = tob->id.next) {
+ for (tob = bmain->objects.first; tob; tob = tob->id.next) {
if (tob->data && (((ID *)tob->data)->tag & LIB_TAG_DOIT)) {
BKE_object_batch_cache_dirty_tag(tob);
DEG_id_tag_update(&tob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
@@ -1250,13 +1257,13 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
"Calculate the center of mass from the surface area"},
{ORIGIN_TO_CENTER_OF_MASS_VOLUME, "ORIGIN_CENTER_OF_VOLUME", 0, "Origin to Center of Mass (Volume)",
"Calculate the center of mass from the volume (must be manifold geometry with consistent normals)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_set_bounds_types[] = {
{V3D_AROUND_CENTER_MEDIAN, "MEDIAN", 0, "Median Center", ""},
{V3D_AROUND_CENTER_BOUNDS, "BOUNDS", 0, "Bounds Center", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1278,17 +1285,16 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
}
/* -------------------------------------------------------------------- */
-
/** \name Transform Axis Target
*
- * Note this is an experemental operator to point lamps/cameras at objects.
+ * Note this is an experemental operator to point lights/cameras at objects.
* We may re-work how this behaves based on user feedback.
* - campbell.
* \{ */
/* When using multiple objects, apply their relative rotational offset to the active object. */
#define USE_RELATIVE_ROTATION
-/* Disable overlays, ignoring user setting (lamp wire gets in the way). */
+/* Disable overlays, ignoring user setting (light wire gets in the way). */
#define USE_RENDER_OVERRIDE
/* Calculate a depth if the cursor isn't already over a depth (not essential but feels buggy without). */
#define USE_FAKE_DEPTH_INIT
@@ -1355,12 +1361,12 @@ static void object_transform_axis_target_calc_depth_init(struct XFormAxisData *x
static bool object_is_target_compat(const Object *ob)
{
if (ob->type == OB_LAMP) {
- const Lamp *la = ob->data;
+ const Light *la = ob->data;
if (ELEM(la->type, LA_SUN, LA_SPOT, LA_AREA)) {
return true;
}
}
- /* We might want to enable this later, for now just lamps */
+ /* We might want to enable this later, for now just lights. */
#if 0
else if (ob->type == OB_CAMERA) {
return true;
@@ -1396,10 +1402,10 @@ static void object_apply_rotation(Object *ob, const float rmat[3][3])
float rmat4[4][4];
copy_m4_m3(rmat4, rmat);
- copy_v3_v3(size, ob->size);
+ copy_v3_v3(size, ob->scale);
copy_v3_v3(loc, ob->loc);
BKE_object_apply_mat4(ob, rmat4, true, true);
- copy_v3_v3(ob->size, size);
+ copy_v3_v3(ob->scale, size);
copy_v3_v3(ob->loc, loc);
}
/* We may want to extract this to: BKE_object_apply_location */
@@ -1462,7 +1468,7 @@ static int object_transform_axis_target_invoke(bContext *C, wmOperator *op, cons
#ifdef USE_RENDER_OVERRIDE
int flag2_prev = vc.v3d->flag2;
- vc.v3d->flag2 |= V3D_RENDER_OVERRIDE;
+ vc.v3d->flag2 |= V3D_HIDE_OVERLAYS;
#endif
ED_view3d_autodist_init(vc.depsgraph, vc.ar, vc.v3d, 0);
@@ -1651,7 +1657,8 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
copy_v3_v3(loc, location_world);
madd_v3_v3fl(loc, target_normal, item->xform_dist);
object_apply_location(item->ob, loc);
- copy_v3_v3(item->ob->obmat[3], loc); /* so orient behaves as expected */
+ /* so orient behaves as expected */
+ copy_v3_v3(item->ob->obmat[3], loc);
}
object_orient_to_location(item->ob, item->rot_mat, item->rot_mat[2], location_world);
diff --git a/source/blender/editors/object/object_utils.c b/source/blender/editors/object/object_utils.c
index 780942f04d2..39f5dad7698 100644
--- a/source/blender/editors/object/object_utils.c
+++ b/source/blender/editors/object/object_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_utils.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include <stdlib.h>
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 036689509e9..c0e022df629 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Ove M Henriksen.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_vgroup.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include <string.h>
@@ -50,7 +42,6 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_linklist_stack.h"
#include "BLI_utildefines_stack.h"
@@ -90,7 +81,9 @@ static bool vertex_group_use_vert_sel(Object *ob)
if (ob->mode == OB_MODE_EDIT) {
return true;
}
- else if (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_PAINT_VERT_SEL) {
+ else if ((ob->type == OB_MESH) &&
+ ((Mesh *)ob->data)->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL))
+ {
return true;
}
else {
@@ -155,8 +148,8 @@ bool ED_vgroup_parray_alloc(ID *id, MDeformVert ***dvert_arr, int *dvert_tot, co
{
Mesh *me = (Mesh *)id;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
BMesh *bm = em->bm;
const int cd_dvert_offset = CustomData_get_offset(&bm->vdata, CD_MDEFORMVERT);
BMIter iter;
@@ -514,7 +507,7 @@ static void ED_mesh_defvert_mirror_update_em(
const int cd_dvert_offset)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMVert *eve_mirr;
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
@@ -551,7 +544,7 @@ static void ED_mesh_defvert_mirror_update_ob(Object *ob, int def_nr, int vidx)
void ED_vgroup_vert_active_mirror(Object *ob, int def_nr)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
MDeformVert *dvert_act;
if (me->editflag & ME_EDIT_MIRROR_X) {
@@ -588,7 +581,7 @@ static void vgroup_remove_weight(Object *ob, const int def_nr)
static bool vgroup_normalize_active_vertex(Object *ob, eVGroupSelect subset_type)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMVert *eve_act;
int v_act;
MDeformVert *dvert_act;
@@ -627,7 +620,7 @@ static bool vgroup_normalize_active_vertex(Object *ob, eVGroupSelect subset_type
static void vgroup_copy_active_to_sel(Object *ob, eVGroupSelect subset_type)
{
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
MDeformVert *dvert_act;
int i, vgroup_tot, subset_count;
const bool *vgroup_validmap = BKE_object_defgroup_subset_from_select_type(ob, subset_type, &vgroup_tot, &subset_count);
@@ -683,7 +676,7 @@ static const EnumPropertyItem WT_vertex_group_select_item[] = {
"BONE_DEFORM", 0, "Deform Pose Bones", "All Vertex Groups assigned to Deform Bones"},
{WT_VGROUP_ALL,
"ALL", 0, "All Groups", "All Vertex Groups"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem *ED_object_vgroup_selection_itemf_helper(
@@ -903,8 +896,8 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
/* warning, this lookup is _not_ fast */
@@ -960,7 +953,9 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
}
void ED_vgroup_select_by_name(Object *ob, const char *name)
-{ /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */
+{
+ /* note: ob->actdef==0 signals on painting to create a new one,
+ * if a bone in posemode is selected */
ob->actdef = defgroup_name_index(ob, name) + 1;
}
@@ -978,8 +973,8 @@ static void vgroup_select_verts(Object *ob, int select)
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
if (cd_dvert_offset != -1) {
@@ -1294,7 +1289,7 @@ static void moveCloserToDistanceFromPlane(
float originalDistToBe = distToBe;
do {
wasChange = false;
- me_deform = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ me_deform = mesh_get_eval_deform(depsgraph, scene, ob, &CD_MASK_BAREMESH);
m = me_deform->mvert[index];
copy_v3_v3(oldPos, m.co);
distToStart = dot_v3v3(norm, oldPos) + d;
@@ -1334,7 +1329,7 @@ static void moveCloserToDistanceFromPlane(
if (dw->weight > 1) {
dw->weight = 1;
}
- me_deform = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ me_deform = mesh_get_eval_deform(depsgraph, scene, ob, &CD_MASK_BAREMESH);
m = me_deform->mvert[index];
getVerticalAndHorizontalChange(norm, d, coord, oldPos, distToStart, m.co, changes, dists, i);
dw->weight = oldw;
@@ -1464,7 +1459,7 @@ static void vgroup_fix(const bContext *C, Scene *scene, Object *ob, float distTo
MVert *p = MEM_callocN(sizeof(MVert) * (count), "deformedPoints");
int k;
- Mesh *me_deform = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ Mesh *me_deform = mesh_get_eval_deform(depsgraph, scene, ob, &CD_MASK_BAREMESH);
k = count;
while (k--) {
p[k] = me_deform->mvert[verts[k]];
@@ -1623,7 +1618,7 @@ enum {
VGROUP_TOGGLE,
VGROUP_LOCK,
VGROUP_UNLOCK,
- VGROUP_INVERT
+ VGROUP_INVERT,
};
static const EnumPropertyItem vgroup_lock_actions[] = {
@@ -1631,7 +1626,7 @@ static const EnumPropertyItem vgroup_lock_actions[] = {
{VGROUP_LOCK, "LOCK", 0, "Lock", "Lock all vertex groups"},
{VGROUP_UNLOCK, "UNLOCK", 0, "Unlock", "Unlock all vertex groups"},
{VGROUP_INVERT, "INVERT", 0, "Invert", "Invert the lock state of all vertex groups"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void vgroup_lock_all(Object *ob, int action)
@@ -1946,20 +1941,22 @@ static int inv_cmp_mdef_vert_weights(const void *a1, const void *a2)
{
/* qsort sorts in ascending order. We want descending order to save a memcopy
* so this compare function is inverted from the standard greater than comparison qsort needs.
- * A normal compare function is called with two pointer arguments and should return an integer less than, equal to,
- * or greater than zero corresponding to whether its first argument is considered less than, equal to,
- * or greater than its second argument. This does the opposite. */
+ * A normal compare function is called with two pointer arguments and should return an integer
+ * less than, equal to, or greater than zero corresponding to whether its first argument is
+ * considered less than, equal to, or greater than its second argument.
+ * This does the opposite. */
const struct MDeformWeight *dw1 = a1, *dw2 = a2;
if (dw1->weight < dw2->weight) return 1;
else if (dw1->weight > dw2->weight) return -1;
- else if (&dw1 < &dw2) return 1; /* compare addresses so we have a stable sort algorithm */
+ else if (&dw1 < &dw2) return 1; /* compare address for stable sort algorithm */
else return -1;
}
/* Used for limiting the number of influencing bones per vertex when exporting
* skinned meshes. if all_deform_weights is True, limit all deform modifiers
- * to max_weights regardless of type, otherwise, only limit the number of influencing bones per vertex*/
+ * to max_weights regardless of type, otherwise,
+ * only limit the number of influencing bones per vertex. */
static int vgroup_limit_total_subset(
Object *ob,
const bool *vgroup_validmap,
@@ -2214,7 +2211,7 @@ void ED_vgroup_mirror(
/* only the active group */
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
if (em) {
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
@@ -2391,8 +2388,8 @@ static void vgroup_assign_verts(Object *ob, const float weight)
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- BMEditMesh *em = me->edit_btmesh;
+ if (me->edit_mesh) {
+ BMEditMesh *em = me->edit_mesh;
int cd_dvert_offset;
BMIter iter;
@@ -2679,8 +2676,10 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
- RNA_def_boolean(ot->srna, "all", 0, "All", "Remove all vertex groups");
- RNA_def_boolean(ot->srna, "all_unlocked", 0, "All Unlocked", "Remove all unlocked vertex groups");
+ PropertyRNA *prop = RNA_def_boolean(ot->srna, "all", 0, "All", "Remove all vertex groups");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "all_unlocked", 0, "All Unlocked", "Remove all unlocked vertex groups");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
static int vertex_group_assign_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3626,7 +3625,7 @@ static void vgroup_sort_bone_hierarchy(Object *ob, ListBase *bonebase)
enum {
SORT_TYPE_NAME = 0,
- SORT_TYPE_BONEHIERARCHY = 1
+ SORT_TYPE_BONEHIERARCHY = 1,
};
static int vertex_group_sort_exec(bContext *C, wmOperator *op)
@@ -3667,7 +3666,7 @@ void OBJECT_OT_vertex_group_sort(wmOperatorType *ot)
static const EnumPropertyItem vgroup_sort_type[] = {
{SORT_TYPE_NAME, "NAME", 0, "Name", ""},
{SORT_TYPE_BONEHIERARCHY, "BONE_HIERARCHY", 0, "Bone Hierarchy", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
ot->name = "Sort Vertex Groups";
@@ -3718,7 +3717,7 @@ void OBJECT_OT_vertex_group_move(wmOperatorType *ot)
static const EnumPropertyItem vgroup_slot_move[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3742,7 +3741,7 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
MDeformVert *dvert_act;
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
float weight_act;
int i;
diff --git a/source/blender/editors/object/object_warp.c b/source/blender/editors/object/object_warp.c
index d28ed71c382..753e29ca9a7 100644
--- a/source/blender/editors/object/object_warp.c
+++ b/source/blender/editors/object/object_warp.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2013 by Blender Foundation
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/object/object_warp.c
- * \ingroup edobj
+/** \file
+ * \ingroup edobj
*/
#include "DNA_object_types.h"
diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt
index 3705ff9d41a..88d6f1b015c 100644
--- a/source/blender/editors/physics/CMakeLists.txt
+++ b/source/blender/editors/physics/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index dc38cc76604..a88d2089ea1 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/dynamicpaint_ops.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <math.h>
@@ -234,7 +230,7 @@ static int output_toggle_exec(bContext *C, wmOperator *op)
/* Vertex Color Layer */
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
if (!exists)
- ED_mesh_color_add(ob->data, name, true);
+ ED_mesh_color_add(ob->data, name, true, true);
else
ED_mesh_color_remove_named(ob->data, name);
}
@@ -258,7 +254,7 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
static const EnumPropertyItem prop_output_toggle_types[] = {
{0, "A", 0, "Output A", ""},
{1, "B", 0, "Output B", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c
index 9f85ed08244..7ddb193b0e5 100644
--- a/source/blender/editors/physics/particle_boids.c
+++ b/source/blender/editors/physics/particle_boids.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Janne Karhu.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/particle_boids.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index e8afa1ae441..b2f314a66ec 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/particle_edit.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <stdlib.h>
@@ -46,7 +38,6 @@
#include "BLI_math.h"
#include "BLI_lasso_2d.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_kdtree.h"
#include "BLI_rand.h"
#include "BLI_task.h"
@@ -67,7 +58,6 @@
#include "DEG_depsgraph.h"
-#include "BIF_gl.h"
#include "ED_object.h"
#include "ED_physics.h"
@@ -435,6 +425,7 @@ typedef struct PEData {
int select_action;
int select_toggle_action;
+ bool is_changed;
} PEData;
static void PE_set_data(bContext *C, PEData *data)
@@ -1325,25 +1316,26 @@ void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), Part
mvert = &mesh->mvert[mface->v1];
copy_v3_v3(vec, mvert->co);
- VECCOPY(nor, mvert->no);
+ copy_v3fl_v3s(nor, mvert->no);
mvert = &mesh->mvert[mface->v2];
add_v3_v3v3(vec, vec, mvert->co);
- VECADD(nor, nor, mvert->no);
+ add_v3fl_v3fl_v3s(nor, nor, mvert->no);
mvert = &mesh->mvert[mface->v3];
add_v3_v3v3(vec, vec, mvert->co);
- VECADD(nor, nor, mvert->no);
+ add_v3fl_v3fl_v3s(nor, nor, mvert->no);
if (mface->v4) {
mvert = &mesh->mvert[mface->v4];
add_v3_v3v3(vec, vec, mvert->co);
- VECADD(nor, nor, mvert->no);
+ add_v3fl_v3fl_v3s(nor, nor, mvert->no);
mul_v3_fl(vec, 0.25);
}
- else
+ else {
mul_v3_fl(vec, 1.0f / 3.0f);
+ }
normalize_v3(nor);
@@ -1525,6 +1517,7 @@ static void select_key(PEData *data, int point_index, int key_index, bool UNUSED
key->flag &= ~PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
+ data->is_changed = true;
}
static void select_key_op(PEData *data, int point_index, int key_index, bool is_inside)
@@ -1841,7 +1834,7 @@ enum { RAN_HAIR, RAN_POINTS };
static const EnumPropertyItem select_random_type_items[] = {
{RAN_HAIR, "HAIR", 0, "Hair", ""},
{RAN_POINTS, "POINTS", 0, "Points", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int select_random_exec(bContext *C, wmOperator *op)
@@ -2007,27 +2000,38 @@ int PE_box_select(bContext *C, const rcti *rect, const int sel_op)
/************************ circle select operator ************************/
-int PE_circle_select(bContext *C, int selecting, const int mval[2], float rad)
+bool PE_circle_select(bContext *C, const int sel_op, const int mval[2], float rad)
{
+ BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
PTCacheEdit *edit = PE_get_current(scene, ob);
PEData data;
- if (!PE_start_edit(edit))
- return OPERATOR_FINISHED;
+ if (!PE_start_edit(edit)) {
+ return false;
+ }
+
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ PE_deselect_all_visible(edit);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
PE_set_view3d_data(C, &data);
data.mval = mval;
data.rad = rad;
- data.select = selecting;
+ data.select = select;
for_mouse_hit_keys(&data, select_key, 0);
+ changed |= data.is_changed;
- PE_update_selection(data.depsgraph, scene, ob, 1);
- WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, ob);
-
- return OPERATOR_FINISHED;
+ if (changed) {
+ PE_update_selection(data.depsgraph, scene, ob, 1);
+ WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, ob);
+ }
+ return changed;
}
/************************ lasso select operator ************************/
@@ -2911,7 +2915,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
ParticleEditSettings *pset = PE_settings(scene);
ParticleBrushData *brush;
- if (pset->brushtype < 0) {
+ if (!WM_toolsystem_active_tool_is_brush(C)) {
return;
}
@@ -2959,7 +2963,7 @@ enum { DEL_PARTICLE, DEL_KEY };
static const EnumPropertyItem delete_type_items[] = {
{DEL_PARTICLE, "PARTICLE", 0, "Particle", ""},
{DEL_KEY, "KEY", 0, "Key", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void set_delete_particle(PEData *data, int pa_index)
@@ -3384,7 +3388,10 @@ static void brush_puff(PEData *data, int point_index)
/* 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 */
+
+ /* use 'kco' as the object space version of worldspace 'co',
+ * ob->imat is set before calling */
+ mul_v3_m4v3(kco, data->ob->imat, co);
point_index = BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL);
if (point_index == -1) return;
@@ -3468,7 +3475,10 @@ static void brush_puff(PEData *data, int point_index)
float oco[3], onor[3];
copy_v3_v3(oco, key->co);
mul_m4_v3(mat, oco);
- mul_v3_m4v3(kco, data->ob->imat, oco); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
+
+ /* use 'kco' as the object space version of worldspace 'co',
+ * ob->imat is set before calling */
+ mul_v3_m4v3(kco, data->ob->imat, oco);
point_index = BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL);
if (point_index != -1) {
@@ -3583,9 +3593,9 @@ static int particle_intersect_mesh(Depsgraph *depsgraph, Scene *UNUSED(scene), O
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- mesh = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
+ mesh = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
if (mesh == NULL) {
- mesh = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
+ mesh = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
}
psys_enable_all(ob);
@@ -4068,14 +4078,14 @@ static int brush_edit_init(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = CTX_data_active_object(C);
- ParticleEditSettings *pset = PE_settings(scene);
PTCacheEdit *edit = PE_get_current(scene, ob);
ARegion *ar = CTX_wm_region(C);
BrushEdit *bedit;
float min[3], max[3];
- if (pset->brushtype < 0)
+ if (!WM_toolsystem_active_tool_is_brush(C)) {
return 0;
+ }
/* set the 'distance factor' for grabbing (used in comb etc) */
INIT_MINMAX(min, max);
@@ -4354,7 +4364,7 @@ static void brush_edit_apply_event(bContext *C, wmOperator *op, const wmEvent *e
PointerRNA itemptr;
float mouse[2];
- VECCOPY2D(mouse, event->mval);
+ copy_v2fl_v2i(mouse, event->mval);
/* fill in stroke */
RNA_collection_add(op->ptr, "stroke", &itemptr);
diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c
index 911a1ce0676..877bfbac953 100644
--- a/source/blender/editors/physics/particle_edit_undo.c
+++ b/source/blender/editors/physics/particle_edit_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/particle_edit_undo.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <stdlib.h>
@@ -41,7 +33,6 @@
#include "DNA_windowmanager_types.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -237,7 +228,7 @@ static bool particle_undosys_poll(struct bContext *C)
return (edit != NULL);
}
-static bool particle_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool particle_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
ParticleUndoStep *us = (ParticleUndoStep *)us_p;
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -248,7 +239,7 @@ static bool particle_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void particle_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void particle_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
/* TODO(campbell): undo_system: use low-level API to set mode. */
ED_object_mode_set(C, OB_MODE_PARTICLE_EDIT);
@@ -292,7 +283,6 @@ void ED_particle_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = particle_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(ParticleUndoStep);
diff --git a/source/blender/editors/physics/particle_edit_utildefines.h b/source/blender/editors/physics/particle_edit_utildefines.h
index 1084bb9742a..afdeb5e985c 100644
--- a/source/blender/editors/physics/particle_edit_utildefines.h
+++ b/source/blender/editors/physics/particle_edit_utildefines.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/particle_edit_utildefines.h
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#ifndef __PARTICLE_EDIT_UTILDEFNIES_H__
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 4619e063dd1..ac304f1aeec 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/particle_object.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
@@ -429,10 +423,10 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
part = psys->part;
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (dw = part->instance_weights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
- BLI_remlink(&part->dupliweights, dw);
- BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw);
+ BLI_remlink(&part->instance_weights, dw);
+ BLI_insertlinkbefore(&part->instance_weights, dw->prev, dw);
DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
@@ -467,12 +461,12 @@ static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
if (!psys)
return OPERATOR_CANCELLED;
part = psys->part;
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (dw = part->instance_weights.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;
- BLI_addhead(&part->dupliweights, dw);
+ BLI_addhead(&part->instance_weights, dw);
DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
@@ -508,15 +502,15 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
part = psys->part;
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (dw = part->instance_weights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT) {
- BLI_remlink(&part->dupliweights, dw);
+ BLI_remlink(&part->instance_weights, dw);
MEM_freeN(dw);
break;
}
}
- dw = part->dupliweights.last;
+ dw = part->instance_weights.last;
if (dw)
dw->flag |= PART_DUPLIW_CURRENT;
@@ -554,10 +548,10 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
part = psys->part;
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ for (dw = part->instance_weights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT && dw->next) {
- BLI_remlink(&part->dupliweights, dw);
- BLI_insertlinkafter(&part->dupliweights, dw->next, dw);
+ BLI_remlink(&part->instance_weights, dw);
+ BLI_insertlinkafter(&part->instance_weights, dw->next, dw);
DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
@@ -627,8 +621,9 @@ static void disconnect_hair(
psys->flag |= PSYS_GLOBAL_HAIR;
- if (ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_PUFF))
- pset->brushtype = PE_BRUSH_NONE;
+ if (ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_PUFF)) {
+ pset->brushtype = PE_BRUSH_COMB;
+ }
PE_update_object(depsgraph, scene, ob, 0);
}
@@ -669,7 +664,8 @@ void PARTICLE_OT_disconnect_hair(wmOperatorType *ot)
ot->exec = disconnect_hair_exec;
/* flags */
- ot->flag = OPTYPE_UNDO; /* No REGISTER, redo does not work due to missing update, see T47750. */
+ /* No REGISTER, redo does not work due to missing update, see T47750. */
+ ot->flag = OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "all", 0, "All hair", "Disconnect all hair systems from the emitter mesh");
}
@@ -722,13 +718,7 @@ static bool remap_hair_emitter(
return false;
}
/* don't modify the original vertices */
- BKE_id_copy_ex(
- NULL, &mesh->id, (ID **)&mesh,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &mesh->id, (ID **)&mesh, LIB_ID_COPY_LOCALIZE);
/* BMESH_ONLY, deform dm may not have tessface */
BKE_mesh_tessface_ensure(mesh);
@@ -935,7 +925,8 @@ void PARTICLE_OT_connect_hair(wmOperatorType *ot)
ot->exec = connect_hair_exec;
/* flags */
- ot->flag = OPTYPE_UNDO; /* No REGISTER, redo does not work due to missing update, see T47750. */
+ /* No REGISTER, redo does not work due to missing update, see T47750. */
+ ot->flag = OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "all", 0, "All hair", "Connect all hair systems to the emitter mesh");
}
@@ -1038,7 +1029,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
ParticleSystem *psys_start = NULL, *psys, *psys_from;
ParticleSystem **tmp_psys;
Mesh *final_mesh;
- CustomDataMask cdmask;
+ CustomData_MeshMasks cdmask = {0};
int i, totpsys;
if (ob_to->type != OB_MESH)
@@ -1060,7 +1051,6 @@ static bool copy_particle_systems_to_object(const bContext *C,
tmp_psys = MEM_mallocN(sizeof(ParticleSystem *) * totpsys, "temporary particle system array");
- cdmask = 0;
for (psys_from = PSYS_FROM_FIRST, i = 0;
psys_from;
psys_from = PSYS_FROM_NEXT(psys_from), ++i)
@@ -1071,7 +1061,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
if (psys_start == NULL)
psys_start = psys;
- cdmask |= psys_emitter_customdata_mask(psys);
+ psys_emitter_customdata_mask(psys, &cdmask);
}
/* to iterate source and target psys in sync,
* we need to know where the newly added psys start
@@ -1079,7 +1069,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
psys_start = totpsys > 0 ? tmp_psys[0] : NULL;
/* Get the evaluated mesh (psys and their modifiers have not been appended yet) */
- final_mesh = mesh_get_eval_final(depsgraph, scene, ob_to, cdmask);
+ final_mesh = mesh_get_eval_final(depsgraph, scene, ob_to, &cdmask);
/* now append psys to the object and make modifiers */
for (i = 0, psys_from = PSYS_FROM_FIRST;
@@ -1103,13 +1093,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
modifier_unique_name(&ob_to->modifiers, (ModifierData *)psmd);
psmd->psys = psys;
- BKE_id_copy_ex(
- NULL, &final_mesh->id, (ID **)&psmd->mesh_final,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &final_mesh->id, (ID **)&psmd->mesh_final, LIB_ID_COPY_LOCALIZE);
BKE_mesh_calc_normals(psmd->mesh_final);
BKE_mesh_tessface_ensure(psmd->mesh_final);
@@ -1225,7 +1209,7 @@ void PARTICLE_OT_copy_particle_systems(wmOperatorType *ot)
static const EnumPropertyItem space_items[] = {
{PAR_COPY_SPACE_OBJECT, "OBJECT", 0, "Object", "Copy inside each object's local space"},
{PAR_COPY_SPACE_WORLD, "WORLD", 0, "World", "Copy in world space"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
ot->name = "Copy Particle Systems";
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 4279cfd5101..9192d1c2fe9 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/physics_fluid.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <math.h>
@@ -41,15 +33,11 @@
#include "DNA_object_types.h"
#include "DNA_object_fluidsim_types.h"
-#include "BLI_blenlib.h"
-#include "BLI_path_util.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_fluidsim.h"
-#include "BKE_main.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -69,7 +57,12 @@
/* enable/disable overall compilation */
#ifdef WITH_MOD_FLUID
+#include "BLI_blenlib.h"
+#include "BLI_path_util.h"
+#include "BLI_math.h"
+
#include "BKE_global.h"
+#include "BKE_main.h"
#include "WM_api.h"
@@ -217,7 +210,6 @@ static void fluidsimPrintChannel(FILE *file, float *channel, int paramsize, char
* CHANNEL_VEC:
* frame 1 |frame 2
* [dataX][dataY][dataZ][time][dataX][dataY][dataZ][time]
- *
*/
static void init_time(FluidsimSettings *domainSettings, FluidAnimChannels *channels)
@@ -398,13 +390,6 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
eval_time = domainSettings->bakeStart + i;
- /* XXX: This can't be used due to an anim sys optimization that ignores recalc object animation,
- * leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ )
- * --> BKE_animsys_evaluate_all_animation(CTX_data_main(C), eval_time);
- * This doesn't work with drivers:
- * --> BKE_animsys_evaluate_animdata(&fsDomain->id, fsDomain->adt, eval_time, ADT_RECALC_ALL);
- */
-
/* Modifying the global scene isn't nice, but we can do it in
* this part of the process before a threaded job is created */
scene->r.cfra = (int)eval_time;
@@ -453,7 +438,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
set_channel(fobj->Translation, timeAtFrame, ob->loc, i, CHANNEL_VEC);
set_channel(fobj->Rotation, timeAtFrame, rot_d, i, CHANNEL_VEC);
- set_channel(fobj->Scale, timeAtFrame, ob->size, i, CHANNEL_VEC);
+ set_channel(fobj->Scale, timeAtFrame, ob->scale, i, CHANNEL_VEC);
set_channel(fobj->Active, timeAtFrame, &active, i, CHANNEL_FLOAT);
set_channel(fobj->InitialVelocity, timeAtFrame, &fluidmd->fss->iniVelx, i, CHANNEL_VEC);
diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h
index df688d90e44..dbadb2356d1 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/physics_intern.h
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c
index 06b0d557d86..40cbf51b840 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/physics_ops.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <stdlib.h>
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index 58bd761a2a9..ab89922e89c 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/physics/physics_pointcache.c
- * \ingroup edphys
+/** \file
+ * \ingroup edphys
*/
#include <stdlib.h>
@@ -40,13 +32,13 @@
#include "DNA_scene_types.h"
#include "BKE_context.h"
-#include "BKE_screen.h"
#include "BKE_global.h"
#include "BKE_layer.h"
-#include "BKE_main.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
+#include "DEG_depsgraph.h"
+
#include "ED_particle.h"
#include "WM_api.h"
@@ -288,9 +280,9 @@ void PTCACHE_OT_bake_all(wmOperatorType *ot)
void PTCACHE_OT_free_bake_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Free All Physics Bakes";
+ ot->name = "Delete All Physics Bakes";
ot->idname = "PTCACHE_OT_free_bake_all";
- ot->description = "Free all baked caches of all objects in the current scene";
+ ot->description = "Delete all baked caches of all objects in the current scene";
/* api callbacks */
ot->exec = ptcache_free_bake_all_exec;
@@ -346,8 +338,8 @@ void PTCACHE_OT_bake(wmOperatorType *ot)
void PTCACHE_OT_free_bake(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Free Physics Bake";
- ot->description = "Free physics bake";
+ ot->name = "Delete Physics Bake";
+ ot->description = "Delete physics bake";
ot->idname = "PTCACHE_OT_free_bake";
/* api callbacks */
@@ -384,10 +376,11 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op))
PointCache *cache_new = BKE_ptcache_add(pid.ptcaches);
cache_new->step = pid.default_step;
*(pid.cache_ptr) = cache_new;
- }
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
- WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_POINT_CACHE);
+ WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
+ }
return OPERATOR_FINISHED;
}
@@ -404,9 +397,10 @@ static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op))
BLI_remlink(pid.ptcaches, pid.cache);
BKE_ptcache_free(pid.cache);
*(pid.cache_ptr) = pid.ptcaches->first;
- }
- WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
+ WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
+ }
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c
index 4d950a16b00..499a1d0e2e5 100644
--- a/source/blender/editors/physics/rigidbody_constraint.c
+++ b/source/blender/editors/physics/rigidbody_constraint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Sergej Reich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file rigidbody_constraint.c
- * \ingroup editor_physics
- * \brief Rigid Body constraint editing operators
+/** \file
+ * \ingroup editor_physics
+ * \brief Rigid Body constraint editing operators
*/
#include <stdlib.h>
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index 1c0ceed2455..fd76a1b18f4 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung, Sergej Reich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file rigidbody_object.c
- * \ingroup editor_physics
- * \brief Rigid Body object editing operators
+/** \file
+ * \ingroup editor_physics
+ * \brief Rigid Body object editing operators
*/
#include <stdlib.h>
@@ -447,7 +439,7 @@ static rbMaterialDensityItem RB_MATERIAL_DENSITY_TABLE[] = {
{N_("Steel"), 7860.0f},
{N_("Stone"), 2515.0f},
{N_("Stone (Crushed)"), 1602.0f},
- {N_("Timber"), 610.0f}
+ {N_("Timber"), 610.0f},
};
static const int NUM_RB_MATERIAL_PRESETS = sizeof(RB_MATERIAL_DENSITY_TABLE) / sizeof(rbMaterialDensityItem);
diff --git a/source/blender/editors/physics/rigidbody_world.c b/source/blender/editors/physics/rigidbody_world.c
index d6ffbb638e0..b9049f79d0c 100644
--- a/source/blender/editors/physics/rigidbody_world.c
+++ b/source/blender/editors/physics/rigidbody_world.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung, Sergej Reich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file rigidbody_world.c
- * \ingroup editor_physics
- * \brief Rigid Body world editing operators
+/** \file
+ * \ingroup editor_physics
+ * \brief Rigid Body world editing operators
*/
#include <stdlib.h>
diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt
index ed2e9747d1c..c65cada1cc0 100644
--- a/source/blender/editors/render/CMakeLists.txt
+++ b/source/blender/editors/render/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h
index 834e9020981..2b142d09385 100644
--- a/source/blender/editors/render/render_intern.h
+++ b/source/blender/editors/render/render_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,20 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_intern.h
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
#ifndef __RENDER_INTERN_H__
#define __RENDER_INTERN_H__
-struct bContext;
struct RenderEngine;
-struct wmOperatorType;
struct ScrArea;
+struct bContext;
+struct wmOperatorType;
/* render_shading.c */
void OBJECT_OT_material_slot_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 1ca06beefad..b5546bd7b90 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_internal.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
@@ -34,7 +29,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
-#include "BLI_rect.h"
#include "BLI_timecode.h"
#include "BLI_math.h"
#include "BLI_threads.h"
@@ -87,9 +81,6 @@
#include "GPU_shader.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
#include "RNA_access.h"
#include "RNA_define.h"
@@ -152,7 +143,8 @@ static void image_buffer_rect_update(RenderJob *rj, RenderResult *rr, ImBuf *ibu
/* if renrect argument, we only refresh scanlines */
if (renrect) {
- /* if (ymax == recty), rendering of layer is ready, we should not draw, other things happen... */
+ /* if (ymax == recty), rendering of layer is ready,
+ * we should not draw, other things happen... */
if (rr->renlay == NULL || renrect->ymax >= rr->recty)
return;
@@ -269,7 +261,7 @@ static void screen_render_single_layer_set(wmOperator *op, Main *mainp, ViewLaye
char scene_name[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "scene", scene_name);
- scn = (Scene *)BLI_findstring(&mainp->scene, scene_name, offsetof(ID, name) + 2);
+ scn = (Scene *)BLI_findstring(&mainp->scenes, scene_name, offsetof(ID, name) + 2);
if (scn) {
/* camera switch wont have updated */
@@ -665,8 +657,9 @@ static void render_endjob(void *rjv)
{
RenderJob *rj = rjv;
- /* this render may be used again by the sequencer without the active 'Render' where the callbacks
- * would be re-assigned. assign dummy callbacks to avoid referencing freed renderjobs bug [#24508] */
+ /* this render may be used again by the sequencer without the active
+ * 'Render' where the callbacks would be re-assigned. assign dummy callbacks
+ * to avoid referencing freed renderjobs bug T24508. */
RE_InitRenderCB(rj->re);
if (rj->main != G_MAIN)
@@ -824,7 +817,7 @@ static void clean_viewport_memory(Main *bmain, Scene *scene)
Base *base;
/* Tag all the available objects. */
- BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true);
+ BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
/* Go over all the visible objects. */
for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
@@ -896,7 +889,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even
WM_cursor_wait(1);
/* flush sculpt and editmode changes */
- ED_editors_flush_edits(C, true);
+ ED_editors_flush_edits(bmain, true);
/* cleanup sequencer caches before starting user triggered render.
* otherwise, invalidated cache entries can make their way into
@@ -1098,7 +1091,8 @@ void RENDER_OT_shutter_curve_preset(wmOperatorType *ot)
{CURVE_PRESET_LINE, "LINE", 0, "Line", ""},
{CURVE_PRESET_ROUND, "ROUND", 0, "Round", ""},
{CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
ot->name = "Shutter Curve Preset";
ot->description = "Set shutter curve";
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 8006f5071d1..feadc88e1d7 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_opengl.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
@@ -47,6 +42,7 @@
#include "BKE_camera.h"
#include "BKE_context.h"
+#include "BKE_customdata.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_main.h"
@@ -329,10 +325,10 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
wmOrtho2(0, sizex, 0, sizey);
GPU_matrix_translate_2f(sizex / 2, sizey / 2);
- G.f |= G_RENDER_OGL;
+ G.f |= G_FLAG_RENDER_VIEWPORT;
ED_gpencil_draw_ex(
view_layer, rv3d, scene, gpd, sizex, sizey, scene->r.cfra, SPACE_SEQ);
- G.f &= ~G_RENDER_OGL;
+ G.f &= ~G_FLAG_RENDER_VIEWPORT;
gp_rect = MEM_mallocN(sizex * sizey * sizeof(unsigned char) * 4, "offscreen rect");
GPU_offscreen_read_pixels(oglrender->ofs, GL_UNSIGNED_BYTE, gp_rect);
@@ -602,15 +598,18 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->prevar = prevar;
if (is_view_context) {
- ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar); /* so quad view renders camera */
+ /* so quad view renders camera */
+ ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar);
+
oglrender->rv3d = oglrender->ar->regiondata;
/* MUST be cleared on exit */
- oglrender->scene->customdata_mask_modal = ED_view3d_datamask(oglrender->scene, oglrender->v3d);
+ memset(&oglrender->scene->customdata_mask_modal, 0, sizeof(oglrender->scene->customdata_mask_modal));
+ ED_view3d_datamask(C, oglrender->scene, oglrender->v3d, &oglrender->scene->customdata_mask_modal);
/* apply immediately in case we're rendering from a script,
* running notifiers again will overwrite */
- oglrender->scene->customdata_mask |= oglrender->scene->customdata_mask_modal;
+ CustomData_MeshMasks_update(&oglrender->scene->customdata_mask, &oglrender->scene->customdata_mask_modal);
}
/* create render */
@@ -741,7 +740,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
MEM_freeN(oglrender->seq_data.ibufs_arr);
}
- oglrender->scene->customdata_mask_modal = 0;
+ memset(&oglrender->scene->customdata_mask_modal, 0, sizeof(oglrender->scene->customdata_mask_modal));
CTX_wm_area_set(C, oglrender->prevsa);
CTX_wm_region_set(C, oglrender->prevar);
diff --git a/source/blender/editors/render/render_ops.c b/source/blender/editors/render/render_ops.c
index 517303cd880..4468f58c01e 100644
--- a/source/blender/editors/render/render_ops.c
+++ b/source/blender/editors/render/render_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_ops.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
#include <stdlib.h>
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index ad2caead1e6..9599a7bdbee 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_preview.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
@@ -55,7 +47,7 @@
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_brush_types.h"
@@ -69,9 +61,8 @@
#include "BKE_idprop.h"
#include "BKE_image.h"
#include "BKE_icons.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_layer.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
@@ -165,10 +156,11 @@ typedef struct ShaderPreview {
/* datablocks with nodes need full copy during preview render, glsl uses it too */
Material *matcopy;
Tex *texcopy;
- Lamp *lampcopy;
+ Light *lampcopy;
World *worldcopy;
- float col[4]; /* active object color */
+ /** Copy of the active objects #Object.color */
+ float color[4];
int sizex, sizey;
unsigned int *pr_rect;
@@ -257,7 +249,7 @@ static Scene *preview_get_scene(Main *pr_main)
{
if (pr_main == NULL) return NULL;
- return pr_main->scene.first;
+ return pr_main->scenes.first;
}
static const char *preview_collection_name(const char pr_type)
@@ -276,7 +268,7 @@ static const char *preview_collection_name(const char pr_type)
case MA_TEXTURE:
return "Texture";
case MA_LAMP:
- return "Lamp";
+ return "Light";
case MA_SKY:
return "Sky";
case MA_HAIR:
@@ -315,7 +307,7 @@ static World *preview_get_localized_world(ShaderPreview *sp, World *world)
return sp->worldcopy;
}
sp->worldcopy = BKE_world_localize(world);
- BLI_addtail(&sp->pr_main->world, sp->worldcopy);
+ BLI_addtail(&sp->pr_main->worlds, sp->worldcopy);
return sp->worldcopy;
}
@@ -338,7 +330,7 @@ static ID *duplicate_ids(ID *id, Depsgraph *depsgraph)
case ID_TE:
return (ID *)BKE_texture_localize((Tex *)id_eval);
case ID_LA:
- return (ID *)BKE_lamp_localize((Lamp *)id_eval);
+ return (ID *)BKE_light_localize((Light *)id_eval);
case ID_WO:
return (ID *)BKE_world_localize((World *)id_eval);
case ID_IM:
@@ -367,7 +359,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
/* this flag tells render to not execute depsgraph or ipos etc */
sce->r.scemode |= R_BUTS_PREVIEW;
/* set world always back, is used now */
- sce->world = pr_main->world.first;
+ sce->world = pr_main->worlds.first;
/* now: exposure copy */
if (scene->world) {
sce->world->exp = scene->world->exp;
@@ -415,7 +407,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
BLI_assert(sp->id_copy != NULL);
mat = sp->matcopy = (Material *)sp->id_copy;
sp->id_copy = NULL;
- BLI_addtail(&pr_main->mat, mat);
+ BLI_addtail(&pr_main->materials, mat);
/* use current scene world to light sphere */
if (mat->pr_type == MA_SPHERE_A && sp->pr_method == PR_BUTS_RENDER) {
@@ -452,7 +444,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
for (Base *base = view_layer->object_bases.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);
+ copy_v4_v4(base->object->color, sp->color);
if (OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
/* don't use assign_material, it changed mat->id.us, which shows in the UI */
@@ -475,7 +467,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
BLI_assert(sp->id_copy != NULL);
tex = sp->texcopy = (Tex *)sp->id_copy;
sp->id_copy = NULL;
- BLI_addtail(&pr_main->tex, tex);
+ BLI_addtail(&pr_main->textures, tex);
}
set_preview_collection(sce, view_layer, MA_TEXTURE);
@@ -487,20 +479,20 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
}
}
else if (id_type == ID_LA) {
- Lamp *la = NULL, *origla = (Lamp *)id;
+ Light *la = NULL, *origla = (Light *)id;
/* work on a copy */
if (origla) {
BLI_assert(sp->id_copy != NULL);
- la = sp->lampcopy = (Lamp *)sp->id_copy;
+ la = sp->lampcopy = (Light *)sp->id_copy;
sp->id_copy = NULL;
- BLI_addtail(&pr_main->lamp, la);
+ BLI_addtail(&pr_main->lights, la);
}
set_preview_collection(sce, view_layer, MA_LAMP);
if (sce->world) {
- /* Only use lighting from the lamp. */
+ /* Only use lighting from the light. */
sce->world->use_nodes = false;
sce->world->horr = 0.0f;
sce->world->horg = 0.0f;
@@ -528,7 +520,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
BLI_assert(sp->id_copy != NULL);
wrld = sp->worldcopy = (World *)sp->id_copy;
sp->id_copy = NULL;
- BLI_addtail(&pr_main->world, wrld);
+ BLI_addtail(&pr_main->worlds, wrld);
}
set_preview_collection(sce, view_layer, MA_SKY);
@@ -632,7 +624,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
ID *id = (ID *)idp;
ID *parent = (ID *)parentp;
MTex *slot = (MTex *)slotp;
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ShaderPreview *sp = WM_jobs_customdata(wm, sa);
rcti newrect;
int ok;
@@ -713,7 +705,7 @@ static void shader_preview_updatejob(void *spv)
ntreeLocalSync(sp->worldcopy->nodetree, wrld->nodetree);
}
else if (GS(sp->id->name) == ID_LA) {
- Lamp *la = (Lamp *)sp->id;
+ Light *la = (Light *)sp->id;
if (sp->lampcopy && la->nodetree && sp->lampcopy->nodetree)
ntreeLocalSync(sp->lampcopy->nodetree, la->nodetree);
@@ -908,19 +900,19 @@ static void shader_preview_free(void *customdata)
if (sp->matcopy) {
sp->id_copy = (ID *)sp->matcopy;
- BLI_remlink(&pr_main->mat, sp->matcopy);
+ BLI_remlink(&pr_main->materials, sp->matcopy);
}
if (sp->texcopy) {
sp->id_copy = (ID *)sp->texcopy;
- BLI_remlink(&pr_main->tex, sp->texcopy);
+ BLI_remlink(&pr_main->textures, sp->texcopy);
}
if (sp->worldcopy) {
sp->id_copy = (ID *)sp->worldcopy;
- BLI_remlink(&pr_main->world, sp->worldcopy);
+ BLI_remlink(&pr_main->worlds, sp->worldcopy);
}
if (sp->lampcopy) {
sp->id_copy = (ID *)sp->lampcopy;
- BLI_remlink(&pr_main->lamp, sp->lampcopy);
+ BLI_remlink(&pr_main->lights, sp->lampcopy);
}
if (sp->id_copy) {
/* node previews */
@@ -942,7 +934,7 @@ static void shader_preview_free(void *customdata)
BKE_texture_free((Tex *)sp->id_copy);
break;
case ID_LA:
- BKE_lamp_free((Lamp *)sp->id_copy);
+ BKE_light_free((Light *)sp->id_copy);
break;
case ID_WO:
BKE_world_free((World *)sp->id_copy);
@@ -1372,8 +1364,12 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
sp->pr_main = G_pr_main_grease_pencil;
}
- 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;
+ if (ob && ob->totcol) {
+ copy_v4_v4(sp->color, ob->color);
+ }
+ else {
+ ARRAY_SET_ITEMS(sp->color, 0.0f, 0.0f, 0.0f, 1.0f);
+ }
/* setup job */
WM_jobs_customdata_set(wm_job, sp, shader_preview_free);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index f2446a01ecf..d1bed15872d 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,14 +14,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_shading.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
#include <stdlib.h>
@@ -32,7 +26,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_curve_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lightprobe_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
@@ -106,9 +100,9 @@
static Object **object_array_for_shading(bContext *C, uint *r_objects_len)
{
ScrArea *sa = CTX_wm_area(C);
- SpaceButs *sbuts = NULL;
+ SpaceProperties *sbuts = NULL;
View3D *v3d = NULL;
- if (sa->spacetype == SPACE_BUTS) {
+ if (sa->spacetype == SPACE_PROPERTIES) {
sbuts = sa->spacedata.first;
}
else if (sa->spacetype == SPACE_VIEW3D) {
@@ -499,7 +493,7 @@ void OBJECT_OT_material_slot_move(wmOperatorType *ot)
static const EnumPropertyItem material_slot_move[] = {
{1, "UP", 0, "Up", ""},
{-1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -533,7 +527,9 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
/* add or copy material */
if (ma) {
- ma = BKE_material_copy(bmain, ma);
+ Material *new_ma = NULL;
+ BKE_id_copy_ex(bmain, &ma->id, (ID **)&new_ma, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS);
+ ma = new_ma;
}
else {
const char *name = DATA_("Material");
@@ -718,6 +714,12 @@ void SCENE_OT_view_layer_add(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
}
+static bool view_layer_remove_poll(bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ return (scene->view_layers.first != scene->view_layers.last);
+}
+
static int view_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
@@ -742,6 +744,7 @@ void SCENE_OT_view_layer_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = view_layer_remove_exec;
+ ot->poll = view_layer_remove_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
@@ -865,7 +868,7 @@ void SCENE_OT_light_cache_bake(wmOperatorType *ot)
{LIGHTCACHE_SUBSET_DIRTY, "DIRTY", 0, "Dirty Only", "Only bake lightprobes that are marked as dirty"},
{LIGHTCACHE_SUBSET_CUBE, "CUBEMAPS", 0, "Cubemaps Only", "Try to only bake reflection cubemaps if irradiance "
"grids are up to date"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -920,9 +923,9 @@ static int light_cache_free_exec(bContext *C, wmOperator *UNUSED(op))
void SCENE_OT_light_cache_free(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Free Light Cache";
+ ot->name = "Delete Light Cache";
ot->idname = "SCENE_OT_light_cache_free";
- ot->description = "Free cached indirect lighting";
+ ot->description = "Delete cached indirect lighting";
/* api callbacks */
ot->exec = light_cache_free_exec;
@@ -1094,7 +1097,7 @@ void SCENE_OT_freestyle_module_move(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1252,7 +1255,7 @@ void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1621,7 +1624,7 @@ void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1724,7 +1727,7 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot)
static const EnumPropertyItem slot_move[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1769,7 +1772,8 @@ void MATERIAL_OT_copy(wmOperatorType *ot)
ot->exec = copy_material_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL; /* no undo needed since no changes are made to the material */
+ /* no undo needed since no changes are made to the material */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL;
}
static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1781,6 +1785,7 @@ static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
paste_matcopybuf(CTX_data_main(C), ma);
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
return OPERATOR_FINISHED;
@@ -1901,7 +1906,8 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot)
ot->poll = copy_mtex_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL; /* no undo needed since no changes are made to the mtex */
+ /* no undo needed since no changes are made to the mtex */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL;
}
static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1910,7 +1916,7 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
if (id == NULL) {
Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
- Lamp *la = CTX_data_pointer_get_type(C, "light", &RNA_Light).data;
+ Light *la = CTX_data_pointer_get_type(C, "light", &RNA_Light).data;
World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data;
ParticleSystem *psys = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data;
FreestyleLineStyle *linestyle = CTX_data_pointer_get_type(C, "line_style", &RNA_FreestyleLineStyle).data;
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index c42eda678ba..d99c9847ed6 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,20 +14,16 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_update.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
#include <stdlib.h>
#include <string.h>
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
@@ -150,7 +144,7 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update
.view_layer = view_layer,
.ar = ar,
.v3d = (View3D *)sa->spacedata.first,
- .engine_type = engine_type
+ .engine_type = engine_type,
}));
}
}
@@ -182,7 +176,7 @@ void ED_render_engine_area_exit(Main *bmain, ScrArea *sa)
void ED_render_engine_changed(Main *bmain)
{
/* on changing the render engine type, clear all running render engines */
- for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
ED_render_engine_area_exit(bmain, sa);
}
@@ -191,7 +185,7 @@ void ED_render_engine_changed(Main *bmain)
/* Inform all render engines and draw managers. */
DEGEditorUpdateContext update_ctx = {NULL};
update_ctx.bmain = bmain;
- for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
update_ctx.scene = scene;
LISTBASE_FOREACH(ViewLayer *, view_layer, &scene->view_layers) {
/* TDODO(sergey): Iterate over depsgraphs instead? */
@@ -210,39 +204,13 @@ void ED_render_engine_changed(Main *bmain)
* editor level updates when the ID changes. when these ID blocks are in *
* the dependency graph, we can get rid of the manual dependency checks */
-static void render_engine_flag_changed(Main *bmain, int update_flag)
-{
- bScreen *sc;
- 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)
- continue;
-
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- RegionView3D *rv3d;
-
- if (ar->regiontype != RGN_TYPE_WINDOW)
- continue;
-
- rv3d = ar->regiondata;
- if (rv3d->render_engine)
- rv3d->render_engine->update_flag |= update_flag;
-
- }
- }
- }
-}
-
static void material_changed(Main *UNUSED(bmain), Material *ma)
{
/* icons */
BKE_icon_changed(BKE_icon_id_ensure(&ma->id));
}
-static void lamp_changed(Main *UNUSED(bmain), Lamp *la)
+static void lamp_changed(Main *UNUSED(bmain), Light *la)
{
/* icons */
BKE_icon_changed(BKE_icon_id_ensure(&la->id));
@@ -257,7 +225,7 @@ static void texture_changed(Main *bmain, Tex *tex)
/* icons */
BKE_icon_changed(BKE_icon_id_ensure(&tex->id));
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* paint overlays */
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
BKE_paint_invalidate_overlay_tex(scene, view_layer, tex);
@@ -286,7 +254,7 @@ static void image_changed(Main *bmain, Image *ima)
BKE_icon_changed(BKE_icon_id_ensure(&ima->id));
/* textures */
- for (tex = bmain->tex.first; tex; tex = tex->id.next)
+ for (tex = bmain->textures.first; tex; tex = tex->id.next)
if (tex->ima == ima)
texture_changed(bmain, tex);
}
@@ -296,7 +264,7 @@ static void scene_changed(Main *bmain, Scene *scene)
Object *ob;
/* glsl */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->mode & OB_MODE_TEXTURE_PAINT) {
BKE_texpaint_slots_refresh_object(scene, ob);
BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
@@ -317,7 +285,6 @@ void ED_render_id_flush_update(const DEGEditorUpdateContext *update_ctx, ID *id)
switch (GS(id->name)) {
case ID_MA:
material_changed(bmain, (Material *)id);
- render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_MA);
break;
case ID_TE:
texture_changed(bmain, (Tex *)id);
@@ -326,17 +293,15 @@ void ED_render_id_flush_update(const DEGEditorUpdateContext *update_ctx, ID *id)
world_changed(bmain, (World *)id);
break;
case ID_LA:
- lamp_changed(bmain, (Lamp *)id);
+ lamp_changed(bmain, (Light *)id);
break;
case ID_IM:
image_changed(bmain, (Image *)id);
break;
case ID_SCE:
scene_changed(bmain, (Scene *)id);
- render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_OTHER);
break;
default:
- render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_OTHER);
break;
}
}
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index 12f9c8f40c1..1d7022c5263 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/render/render_view.c
- * \ingroup edrend
+/** \file
+ * \ingroup edrend
*/
#include <string.h>
@@ -66,7 +61,7 @@ static ScrArea *biggest_non_image_area(bContext *C)
for (sa = sc->areabase.first; sa; sa = sa->next) {
if (sa->winx > 30 && sa->winy > 30) {
size = sa->winx * sa->winy;
- if (!sa->full && sa->spacetype == SPACE_BUTS) {
+ if (!sa->full && sa->spacetype == SPACE_PROPERTIES) {
if (foundwin == 0 && size > bwmaxsize) {
bwmaxsize = size;
big = sa;
diff --git a/source/blender/editors/scene/CMakeLists.txt b/source/blender/editors/scene/CMakeLists.txt
index 9fbebbc58cc..7f496cad060 100644
--- a/source/blender/editors/scene/CMakeLists.txt
+++ b/source/blender/editors/scene/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c
index 0553e223c55..3ad5ba5722a 100644
--- a/source/blender/editors/scene/scene_edit.c
+++ b/source/blender/editors/scene/scene_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/scene/scene_edit.c
- * \ingroup edscene
+/** \file
+ * \ingroup edscene
*/
#include <stdio.h>
@@ -78,7 +74,7 @@ Scene *ED_scene_add(Main *bmain, bContext *C, wmWindow *win, eSceneCopyMethod me
ED_object_single_users(bmain, scene_new, false, true);
}
else if (method == SCE_COPY_FULL) {
- ED_editors_flush_edits(C, false);
+ ED_editors_flush_edits(bmain, false);
ED_object_single_users(bmain, scene_new, true, true);
}
}
@@ -111,12 +107,7 @@ bool ED_scene_delete(bContext *C, Main *bmain, wmWindow *win, Scene *scene)
WM_window_set_active_scene(bmain, C, win, scene_new);
- BKE_libblock_remap(bmain, scene, scene_new, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_NEVER_NULL_USAGE);
-
- id_us_clear_real(&scene->id);
- if (scene->id.us == 0) {
- BKE_libblock_free(bmain, scene);
- }
+ BKE_id_delete(bmain, scene);
return true;
}
@@ -156,7 +147,7 @@ static void view_layer_remove_unset_nodetrees(const Main *bmain, Scene *scene, V
{
int act_layer_index = BLI_findindex(&scene->view_layers, layer);
- for (Scene *sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (Scene *sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) {
BKE_nodetree_remove_layer_n(sce->nodetree, scene, act_layer_index);
}
@@ -219,7 +210,7 @@ static void SCENE_OT_new(wmOperatorType *ot)
{SCE_COPY_LINK_OB, "LINK_OBJECTS", 0, "Link Objects", "Link to the objects from the current scene"},
{SCE_COPY_LINK_DATA, "LINK_OBJECT_DATA", 0, "Link Object Data", "Copy objects linked to data from the current scene"},
{SCE_COPY_FULL, "FULL_COPY", 0, "Full Copy", "Make a full copy of the current scene"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -238,6 +229,12 @@ static void SCENE_OT_new(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
}
+static bool scene_delete_poll(bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ return (scene->id.prev || scene->id.next);
+}
+
static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
@@ -263,6 +260,7 @@ static void SCENE_OT_delete(wmOperatorType *ot)
/* api callbacks */
ot->exec = scene_delete_exec;
+ ot->poll = scene_delete_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index e01be2ed709..810adba3288 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 34a20c8ccf7..27b97776503 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/area.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
@@ -43,6 +36,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_image.h"
#include "BKE_screen.h"
#include "BKE_workspace.h"
@@ -210,7 +204,7 @@ static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, f
* The click_rect is the same as defined in fullscreen_click_rcti_init
* Keep them both in sync */
- if (G.debug_value == 1) {
+ if (G.debug_value == 101) {
rcti click_rect;
float icon_size = UI_DPI_ICON_SIZE + 7 * UI_DPI_FAC;
@@ -758,25 +752,25 @@ static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea
float coords[4][4] = {
/* Bottom-left. */
- {sa->totrct.xmin,
- sa->totrct.ymin,
- sa->totrct.xmin + (AZONESPOT - 1),
- sa->totrct.ymin + (AZONESPOT - 1)},
+ {sa->totrct.xmin - U.pixelsize,
+ sa->totrct.ymin - U.pixelsize,
+ sa->totrct.xmin + AZONESPOTW,
+ sa->totrct.ymin + AZONESPOTH},
/* Bottom-right. */
- {sa->totrct.xmax - (AZONESPOT - 1),
- sa->totrct.ymin,
- sa->totrct.xmax,
- sa->totrct.ymin + (AZONESPOT - 1)},
+ {sa->totrct.xmax - AZONESPOTW,
+ sa->totrct.ymin - U.pixelsize,
+ sa->totrct.xmax + U.pixelsize,
+ sa->totrct.ymin + AZONESPOTH},
/* Top-left. */
- {sa->totrct.xmin,
- sa->totrct.ymax - (AZONESPOT - 1),
- sa->totrct.xmin + (AZONESPOT - 1),
- sa->totrct.ymax},
+ {sa->totrct.xmin - U.pixelsize,
+ sa->totrct.ymax - AZONESPOTH,
+ sa->totrct.xmin + AZONESPOTW,
+ sa->totrct.ymax + U.pixelsize},
/* Top-right. */
- {sa->totrct.xmax - (AZONESPOT - 1),
- sa->totrct.ymax - (AZONESPOT - 1),
- sa->totrct.xmax,
- sa->totrct.ymax}};
+ {sa->totrct.xmax - AZONESPOTW,
+ sa->totrct.ymax - AZONESPOTH,
+ sa->totrct.xmax + U.pixelsize,
+ sa->totrct.ymax + U.pixelsize}};
for (int i = 0; i < 4; i++) {
/* can't click on bottom corners on OS X, already used for resizing */
@@ -1111,7 +1105,7 @@ bool ED_region_is_overlap(int spacetype, int regiontype)
return true;
}
}
- else if (ELEM(spacetype, SPACE_VIEW3D, SPACE_SEQ, SPACE_IMAGE)) {
+ else if (ELEM(spacetype, SPACE_VIEW3D, SPACE_IMAGE)) {
if (ELEM(regiontype, RGN_TYPE_TOOLS, RGN_TYPE_UI, RGN_TYPE_TOOL_PROPS)) {
return true;
}
@@ -1480,6 +1474,9 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ARegion *ar, L
WM_gizmomap_add_handlers(ar, ar->gizmo_map);
}
}
+ if (flag & ED_KEYMAP_TOOL) {
+ WM_event_add_keymap_handler_dynamic(&ar->handlers, WM_event_get_keymap_from_toolsystem, sa);
+ }
if (flag & ED_KEYMAP_VIEW2D) {
/* 2d-viewport handling+manipulation */
wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "View2D", 0, 0);
@@ -2507,10 +2504,10 @@ void ED_region_header_init(ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
}
-/* UI_UNIT_Y is defined as U variable now, depending dpi */
int ED_area_headersize(void)
{
- return (int)(HEADERY * UI_DPI_FAC);
+ /* Accomodate widget and padding. */
+ return U.widget_unit + (int)(UI_DPI_FAC * HEADER_PADDING_Y);
}
int ED_area_header_alignment_or_fallback(const ScrArea *area, int fallback)
@@ -2678,7 +2675,7 @@ static const char *meta_data_list[] =
"Time",
"Frame",
"Camera",
- "Scene"
+ "Scene",
};
BLI_INLINE bool metadata_is_valid(ImBuf *ibuf, char *r_str, short index, int offset)
@@ -2686,6 +2683,45 @@ BLI_INLINE bool metadata_is_valid(ImBuf *ibuf, char *r_str, short index, int off
return (IMB_metadata_get_field(ibuf->metadata, meta_data_list[index], r_str + offset, MAX_METADATA_STR - offset) && r_str[0]);
}
+BLI_INLINE bool metadata_is_custom_drawable(const char *field)
+{
+ /* Metadata field stored by Blender for multilayer EXR images. Is rather
+ * useless to be viewed all the time. Can still be seen in the Metadata
+ * panel. */
+ if (STREQ(field, "BlenderMultiChannel")) {
+ return false;
+ }
+ /* Is almost always has value "scanlineimage", also useless to be seen
+ * all the time. */
+ if (STREQ(field, "type")) {
+ return false;
+ }
+ return !BKE_stamp_is_known_field(field);
+}
+
+typedef struct MetadataCustomDrawContext {
+ int fontid;
+ int xmin, ymin;
+ int vertical_offset;
+ int current_y;
+} MetadataCustomDrawContext;
+
+static void metadata_custom_draw_fields(
+ const char *field,
+ const char *value,
+ void *ctx_v)
+{
+ if (!metadata_is_custom_drawable(field)) {
+ return;
+ }
+ MetadataCustomDrawContext *ctx = (MetadataCustomDrawContext *)ctx_v;
+ char temp_str[MAX_METADATA_STR];
+ BLI_snprintf(temp_str, MAX_METADATA_STR, "%s: %s", field, value);
+ BLF_position(ctx->fontid, ctx->xmin, ctx->ymin + ctx->current_y, 0.0f);
+ BLF_draw(ctx->fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX);
+ ctx->current_y += ctx->vertical_offset;
+}
+
static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const bool is_top)
{
char temp_str[MAX_METADATA_STR];
@@ -2760,11 +2796,20 @@ static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const
}
}
else {
+ MetadataCustomDrawContext ctx;
+ ctx.fontid = fontid;
+ ctx.xmin = xmin;
+ ctx.ymin = ymin;
+ ctx.vertical_offset = vertical_offset;
+ ctx.current_y = ofs_y;
+ ctx.vertical_offset = vertical_offset;
+ IMB_metadata_foreach(ibuf, metadata_custom_draw_fields, &ctx);
int ofs_x = 0;
+ ofs_y = ctx.current_y;
for (i = 5; i < 10; i++) {
len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i]);
if (metadata_is_valid(ibuf, temp_str, i, len)) {
- BLF_position(fontid, xmin + ofs_x, ymin, 0.0f);
+ BLF_position(fontid, xmin + ofs_x, ymin + ofs_y, 0.0f);
BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX);
ofs_x += BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX) + UI_UNIT_X;
@@ -2773,6 +2818,23 @@ static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const
}
}
+typedef struct MetadataCustomCountContext {
+ int count;
+} MetadataCustomCountContext;
+
+static void metadata_custom_count_fields(
+ const char *field,
+ const char *UNUSED(value),
+ void *ctx_v)
+{
+ if (!metadata_is_custom_drawable(field)) {
+ return;
+ }
+ MetadataCustomCountContext *ctx = (MetadataCustomCountContext *)ctx_v;
+ ctx->count++;
+}
+
+
static float metadata_box_height_get(ImBuf *ibuf, int fontid, const bool is_top)
{
const float height = BLF_height_max(fontid);
@@ -2810,8 +2872,13 @@ static float metadata_box_height_get(ImBuf *ibuf, int fontid, const bool is_top)
for (i = 5; i < 10; i++) {
if (metadata_is_valid(ibuf, str, i, 0)) {
count = 1;
+ break;
}
}
+ MetadataCustomCountContext ctx;
+ ctx.count = 0;
+ IMB_metadata_foreach(ibuf, metadata_custom_count_fields, &ctx);
+ count += ctx.count;
}
if (count) {
@@ -2894,6 +2961,28 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame,
GPU_matrix_pop();
}
+typedef struct MetadataPanelDrawContext {
+ uiLayout *layout;
+} MetadataPanelDrawContext;
+
+static void metadata_panel_draw_field(
+ const char *field,
+ const char *value,
+ void *ctx_v)
+{
+ MetadataPanelDrawContext *ctx = (MetadataPanelDrawContext *)ctx_v;
+ uiLayout *row = uiLayoutRow(ctx->layout, false);
+ uiItemL(row, field, ICON_NONE);
+ uiItemL(row, value, ICON_NONE);
+}
+
+void ED_region_image_metadata_panel_draw(ImBuf *ibuf, uiLayout *layout)
+{
+ MetadataPanelDrawContext ctx;
+ ctx.layout = layout;
+ IMB_metadata_foreach(ibuf, metadata_panel_draw_field, &ctx);
+}
+
void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
{
float gridsize, gridstep = 1.0f / 32.0f;
diff --git a/source/blender/editors/screen/area_utils.c b/source/blender/editors/screen/area_utils.c
index 53e2f96d6c4..2137d98d226 100644
--- a/source/blender/editors/screen/area_utils.c
+++ b/source/blender/editors/screen/area_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/area_utils.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*
* Helper functions for area/region API.
*/
@@ -29,8 +25,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BKE_context.h"
-
#include "RNA_access.h"
#include "RNA_types.h"
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 728df79fbbd..c96b7f04284 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/glutil.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
@@ -36,13 +30,11 @@
#include "DNA_userdef_types.h"
#include "DNA_vec_types.h"
-#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BKE_context.h"
-#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "IMB_colormanagement.h"
@@ -147,7 +139,7 @@ static void immDrawPixelsTexSetupAttributes(IMMDrawPixelsTexState *state)
/* To be used before calling immDrawPixelsTex
* Default shader is GPU_SHADER_2D_IMAGE_COLOR
* You can still set uniforms with :
- * GPU_shader_uniform_int(shader, GPU_shader_get_uniform(shader, "name"), 0);
+ * GPU_shader_uniform_int(shader, GPU_shader_get_uniform_ensure(shader, "name"), 0);
* */
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
{
@@ -241,7 +233,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
/* NOTE: Shader could be null for GLSL OCIO drawing, it is fine, since
* it does not need color.
*/
- if (state->shader != NULL && GPU_shader_get_uniform(state->shader, "color") != -1) {
+ if (state->shader != NULL && GPU_shader_get_uniform_ensure(state->shader, "color") != -1) {
immUniformColor4fv((color) ? color : white);
}
@@ -349,6 +341,34 @@ void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state,
/* *************** glPolygonOffset hack ************* */
+float bglPolygonOffsetCalc(const float winmat[16], float viewdist, float dist)
+{
+ if (winmat[15] > 0.5f) {
+#if 1
+ return 0.00001f * dist * viewdist; // ortho tweaking
+#else
+ static float depth_fac = 0.0f;
+ if (depth_fac == 0.0f) {
+ int depthbits;
+ glGetIntegerv(GL_DEPTH_BITS, &depthbits);
+ depth_fac = 1.0f / (float)((1 << depthbits) - 1);
+ }
+ offs = (-1.0 / winmat[10]) * dist * depth_fac;
+
+ UNUSED_VARS(viewdist);
+#endif
+ }
+ else {
+ /* This adjustment effectively results in reducing the Z value by 0.25%.
+ *
+ * winmat[14] actually evaluates to `-2 * far * near / (far - near)`,
+ * is very close to -0.2 with default clip range, and is used as the coefficient multiplied by `w / z`,
+ * thus controlling the z dependent part of the depth value.
+ */
+ return winmat[14] * -0.0025f * dist;
+ }
+}
+
/**
* \note \a viewdist is only for ortho at the moment.
*/
@@ -357,8 +377,6 @@ void bglPolygonOffset(float viewdist, float dist)
static float winmat[16], offset = 0.0f;
if (dist != 0.0f) {
- float offs;
-
// glEnable(GL_POLYGON_OFFSET_FILL);
// glPolygonOffset(-1.0, -1.0);
@@ -367,30 +385,7 @@ void bglPolygonOffset(float viewdist, float dist)
/* dist is from camera to center point */
- if (winmat[15] > 0.5f) {
-#if 1
- offs = 0.00001f * dist * viewdist; // ortho tweaking
-#else
- static float depth_fac = 0.0f;
- if (depth_fac == 0.0f) {
- int depthbits;
- glGetIntegerv(GL_DEPTH_BITS, &depthbits);
- depth_fac = 1.0f / (float)((1 << depthbits) - 1);
- }
- offs = (-1.0 / winmat[10]) * dist * depth_fac;
-
- UNUSED_VARS(viewdist);
-#endif
- }
- else {
- /* This adjustment effectively results in reducing the Z value by 0.25%.
- *
- * winmat[14] actually evaluates to `-2 * far * near / (far - near)`,
- * is very close to -0.2 with default clip range, and is used as the coefficient multiplied by `w / z`,
- * thus controlling the z dependent part of the depth value.
- */
- offs = winmat[14] * -0.0025f * dist;
- }
+ float offs = bglPolygonOffsetCalc(winmat, viewdist, dist);
winmat[14] -= offs;
offset += offs;
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index d5683ae1267..31b1be2d8b3 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_context.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
#include <stdio.h>
@@ -51,10 +46,8 @@
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_paint.h"
-#include "BKE_main.h"
#include "BKE_gpencil.h"
#include "BKE_layer.h"
-#include "BKE_screen.h"
#include "BKE_sequencer.h"
#include "BKE_workspace.h"
@@ -111,17 +104,17 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "visible_objects")) {
- FOREACH_VISIBLE_OBJECT_BEGIN(view_layer, v3d, ob)
- {
- CTX_data_id_list_add(result, &ob->id);
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (BASE_VISIBLE(v3d, base)) {
+ CTX_data_id_list_add(result, &base->object->id);
+ }
}
- FOREACH_VISIBLE_BASE_END;
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
else if (CTX_data_equals(member, "selectable_objects")) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (BASE_SELECTABLE_BGMODE(v3d, base)) {
+ if (BASE_SELECTABLE(v3d, base)) {
CTX_data_id_list_add(result, &base->object->id);
}
}
@@ -129,49 +122,45 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "selected_objects")) {
- FOREACH_SELECTED_OBJECT_BEGIN(view_layer, v3d, ob)
- {
- CTX_data_id_list_add(result, &ob->id);
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (BASE_SELECTED(v3d, base)) {
+ CTX_data_id_list_add(result, &base->object->id);
+ }
}
- FOREACH_SELECTED_OBJECT_END;
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
else if (CTX_data_equals(member, "selected_editable_objects")) {
- FOREACH_SELECTED_OBJECT_BEGIN(view_layer, v3d, ob)
- {
- if (0 == BKE_object_is_libdata(ob)) {
- CTX_data_id_list_add(result, &ob->id);
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (BASE_SELECTED_EDITABLE(v3d, base)) {
+ CTX_data_id_list_add(result, &base->object->id);
}
}
- FOREACH_SELECTED_OBJECT_END;
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
else if (CTX_data_equals(member, "editable_objects")) {
/* Visible + Editable, but not necessarily selected */
- FOREACH_VISIBLE_OBJECT_BEGIN(view_layer, v3d, ob)
- {
- if (0 == BKE_object_is_libdata(ob)) {
- CTX_data_id_list_add(result, &ob->id);
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (BASE_EDITABLE(v3d, base)) {
+ CTX_data_id_list_add(result, &base->object->id);
}
}
- FOREACH_VISIBLE_OBJECT_END;
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
else if ( CTX_data_equals(member, "visible_bases")) {
- FOREACH_VISIBLE_BASE_BEGIN(view_layer, v3d, base)
- {
- CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (BASE_VISIBLE(v3d, base)) {
+ CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
+ }
}
- FOREACH_VISIBLE_BASE_END;
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
else if (CTX_data_equals(member, "selectable_bases")) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (BASE_SELECTABLE_BGMODE(v3d, base)) {
+ if (BASE_SELECTABLE(v3d, base)) {
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}
}
@@ -180,7 +169,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if (CTX_data_equals(member, "selected_bases")) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (BASE_VISIBLE_BGMODE(v3d, base) && (base->flag & BASE_SELECTED) != 0) {
+ if (BASE_SELECTED(v3d, base)) {
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}
}
@@ -189,10 +178,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if (CTX_data_equals(member, "selected_editable_bases")) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (BASE_VISIBLE_BGMODE(v3d, base) && (base->flag & BASE_SELECTED) != 0) {
- if (0 == BKE_object_is_libdata(base->object)) {
- CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
- }
+ if (BASE_SELECTED_EDITABLE(v3d, base)) {
+ CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}
}
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
@@ -201,10 +188,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
else if (CTX_data_equals(member, "editable_bases")) {
/* Visible + Editable, but not necessarily selected */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (BASE_VISIBLE_BGMODE(v3d, base)) {
- if (0 == BKE_object_is_libdata(base->object)) {
- CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
- }
+ if (BASE_EDITABLE(v3d, base)) {
+ CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}
}
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
@@ -259,7 +244,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
if (arm->flag & ARM_MIRROR_EDIT)
flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
- /* if we're filtering for editable too, use the check for that instead, as it has selection check too */
+ /* if we're filtering for editable too, use the check for that instead,
+ * as it has selection check too */
if (editable_bones) {
/* only selected + editable */
if (EBONE_EDITABLE(ebone)) {
@@ -310,7 +296,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
if (arm->flag & ARM_MIRROR_EDIT)
flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
- /* if we're filtering for editable too, use the check for that instead, as it has selection check too */
+ /* if we're filtering for editable too, use the check for that instead,
+ * as it has selection check too */
if (selected_editable_bones) {
/* only selected + editable */
if (EBONE_EDITABLE(ebone)) {
@@ -678,12 +665,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
else if (CTX_data_equals(member, "selected_editable_fcurves")) {
bAnimContext ac;
- if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_ACTION, SPACE_IPO)) {
+ if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_ACTION, SPACE_GRAPH)) {
bAnimListElem *ale;
ListBase anim_data = {NULL, NULL};
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS | ANIMFILTER_SEL) |
- (ac.spacetype == SPACE_IPO ? ANIMFILTER_CURVE_VISIBLE : ANIMFILTER_LIST_VISIBLE);
+ (ac.spacetype == SPACE_GRAPH ? ANIMFILTER_CURVE_VISIBLE : ANIMFILTER_LIST_VISIBLE);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c
index ca3707786dd..84eb723a43d 100644
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_draw.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
#include "ED_screen.h"
@@ -564,7 +560,7 @@ static void screen_preview_draw_areas(const bScreen *screen, const float scale[2
.xmin = sa->totrct.xmin * scale[0] + ofs_h,
.xmax = sa->totrct.xmax * scale[0] - ofs_h,
.ymin = sa->totrct.ymin * scale[1] + ofs_h,
- .ymax = sa->totrct.ymax * scale[1] - ofs_h
+ .ymax = sa->totrct.ymax * scale[1] - ofs_h,
};
immBegin(GPU_PRIM_TRI_FAN, 4);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 7e6e31d339d..7556a44da1a 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_edit.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
@@ -38,7 +33,6 @@
#include "DNA_workspace_types.h"
#include "DNA_userdef_types.h"
-#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -48,7 +42,6 @@
#include "BKE_image.h"
#include "BKE_layer.h"
#include "BKE_library.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_screen.h"
@@ -485,6 +478,12 @@ void ED_screens_initialize(Main *bmain, wmWindowManager *wm)
ED_screen_set_active_region(NULL, win, &win->eventstate->x);
}
}
+
+ if (U.uiflag & USER_HEADER_FROM_PREF) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ BKE_screen_header_alignment_reset(screen);
+ }
+ }
}
void ED_screen_ensure_updated(wmWindowManager *wm, wmWindow *win, bScreen *screen)
@@ -863,7 +862,7 @@ void ED_screen_global_areas_refresh(wmWindow *win)
static bScreen *screen_fullscreen_find_associated_normal_screen(const Main *bmain, bScreen *screen)
{
- for (bScreen *screen_iter = bmain->screen.first; screen_iter; screen_iter = screen_iter->id.next) {
+ for (bScreen *screen_iter = bmain->screens.first; screen_iter; screen_iter = screen_iter->id.next) {
ScrArea *sa = screen_iter->areabase.first;
if (sa && sa->full == screen) {
return screen_iter;
@@ -880,7 +879,7 @@ static bScreen *screen_fullscreen_find_associated_normal_screen(const Main *bmai
bScreen *screen_change_prepare(bScreen *screen_old, bScreen *screen_new, Main *bmain, bContext *C, wmWindow *win)
{
/* validate screen, it's called with notifier reference */
- if (BLI_findindex(&bmain->screen, screen_new) == -1) {
+ if (BLI_findindex(&bmain->screens, screen_new) == -1) {
return NULL;
}
@@ -1347,7 +1346,7 @@ void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync,
if (sa)
spacetype = sa->spacetype;
- sad->from_anim_edit = (ELEM(spacetype, SPACE_IPO, SPACE_ACTION, SPACE_NLA));
+ sad->from_anim_edit = (ELEM(spacetype, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA));
screen->animtimer->customdata = sad;
@@ -1406,7 +1405,7 @@ void ED_update_for_newframe(Main *bmain, Depsgraph *depsgraph)
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->screens.first; sc; sc = sc->id.next) {
BKE_screen_view3d_scene_sync(sc, scene);
}
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
@@ -1425,7 +1424,7 @@ void ED_update_for_newframe(Main *bmain, Depsgraph *depsgraph)
/* update animated texture nodes */
{
Tex *tex;
- for (tex = bmain->tex.first; tex; tex = tex->id.next) {
+ for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->use_nodes && tex->nodetree) {
ntreeTexTagAnimated(tex->nodetree);
}
diff --git a/source/blender/editors/screen/screen_geometry.c b/source/blender/editors/screen/screen_geometry.c
index 5d87479e371..68fd28013f8 100644
--- a/source/blender/editors/screen/screen_geometry.c
+++ b/source/blender/editors/screen/screen_geometry.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,13 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_geometry.c
- * \ingroup edscr
- * \brief Functions for screen vertices and edges
+/** \file
+ * \ingroup edscr
+ * \brief Functions for screen vertices and edges
*
* Screen geometry refers to the vertices (ScrVert) and edges (ScrEdge) through
* which the flexible screen-layout system of Blender is established.
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index 5f36f4a06ab..cb400bb3734 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,27 +15,23 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_intern.h
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
#ifndef __SCREEN_INTERN_H__
#define __SCREEN_INTERN_H__
+struct Main;
struct bContext;
struct bContextDataResult;
-struct Main;
/* internal exports only */
-#define AZONESPOT (0.4f * U.widget_unit)
+#define AZONESPOTW UI_HEADER_OFFSET /* width of corner azone - max */
+#define AZONESPOTH (0.6f * U.widget_unit) /* height of corner azone */
#define AZONEFADEIN (5.0f * U.widget_unit) /* when azone is totally visible */
#define AZONEFADEOUT (6.5f * U.widget_unit) /* when we start seeing the azone */
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 62b4db94937..bb56d127b31 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,13 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_ops.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
@@ -211,7 +206,7 @@ bool ED_operator_animview_active(bContext *C)
{
if (ED_operator_areaactive(C)) {
SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C);
- if (sl && (ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_IPO)))
+ if (sl && (ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH)))
return true;
}
@@ -249,7 +244,7 @@ bool ED_operator_action_active(bContext *C)
bool ED_operator_buttons_active(bContext *C)
{
- return ed_spacetype_test(C, SPACE_BUTS);
+ return ed_spacetype_test(C, SPACE_PROPERTIES);
}
bool ED_operator_node_active(bContext *C)
@@ -274,7 +269,7 @@ bool ED_operator_node_editable(bContext *C)
bool ED_operator_graphedit_active(bContext *C)
{
- return ed_spacetype_test(C, SPACE_IPO);
+ return ed_spacetype_test(C, SPACE_GRAPH);
}
bool ED_operator_sequencer_active(bContext *C)
@@ -650,15 +645,17 @@ typedef struct sActionzoneData {
static bool actionzone_area_poll(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
- ScrArea *sa = CTX_wm_area(C);
+ bScreen *screen = WM_window_get_active_screen(win);
- if (sa && win && win->eventstate) {
+ if (screen && win && win->eventstate) {
const int *xy = &win->eventstate->x;
AZone *az;
- for (az = sa->actionzones.first; az; az = az->next)
- if (BLI_rcti_isect_pt_v(&az->rect, xy))
- return 1;
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (az = sa->actionzones.first; az; az = az->next)
+ if (BLI_rcti_isect_pt_v(&az->rect, xy))
+ return 1;
+ }
}
return 0;
}
@@ -709,7 +706,7 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
}
else {
const int mouse_sq = SQUARE(xy[0] - az->x2) + SQUARE(xy[1] - az->y2);
- const int spot_sq = SQUARE(AZONESPOT);
+ const int spot_sq = SQUARE(AZONESPOTW);
const int fadein_sq = SQUARE(AZONEFADEIN);
const int fadeout_sq = SQUARE(AZONEFADEOUT);
@@ -829,6 +826,31 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
return az;
}
+/* Finds an actionzone by position in entire screen so azones can overlap */
+static AZone *screen_actionzone_find_xy(bScreen *sc, const int xy[2])
+{
+ for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
+ AZone *az = area_actionzone_refresh_xy(sa, xy, true);
+ if (az != NULL) {
+ return az;
+ }
+ }
+ return NULL;
+}
+
+/* Returns the area that the azone belongs to */
+static ScrArea *screen_actionzone_area(bScreen *sc, const AZone *az)
+{
+ for (ScrArea *area = sc->areabase.first; area; area = area->next) {
+ for (AZone *zone = area->actionzones.first; zone; zone = zone->next) {
+ if (zone == az) {
+ return area;
+ }
+ }
+ }
+ return NULL;
+}
+
AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2])
{
return area_actionzone_refresh_xy(sa, xy, true);
@@ -874,8 +896,8 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type)
static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ScrArea *sa = CTX_wm_area(C);
- AZone *az = ED_area_actionzone_find_xy(sa, &event->x);
+ bScreen *sc = CTX_wm_screen(C);
+ AZone *az = screen_actionzone_find_xy(sc, &event->x);
sActionzoneData *sad;
/* quick escape - Scroll azones only hide/unhide the scroll-bars, they have their own handling. */
@@ -884,7 +906,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* ok we do the actionzone */
sad = op->customdata = MEM_callocN(sizeof(sActionzoneData), "sActionzoneData");
- sad->sa1 = sa;
+ sad->sa1 = screen_actionzone_area(sc, az);
sad->az = az;
sad->x = event->x; sad->y = event->y;
@@ -916,10 +938,18 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
const int delta_x = (event->x - sad->x);
const int delta_y = (event->y - sad->y);
- /* calculate gesture direction */
+ /* Movement in dominant direction. */
+ const int delta_max = max_ii(ABS(delta_x), ABS(delta_y));
+
+ /* Movement in dominant direction before action taken. */
+ const int join_threshold = (0.6 * U.widget_unit);
+ const int split_threshold = (1.2 * U.widget_unit);
+ const int area_threshold = (0.1 * U.widget_unit);
+
+ /* Calculate gesture cardinal direction. */
if (delta_y > ABS(delta_x))
sad->gesture_dir = 'n';
- else if (delta_x > ABS(delta_y))
+ else if (delta_x >= ABS(delta_y))
sad->gesture_dir = 'e';
else if (delta_y < -ABS(delta_x))
sad->gesture_dir = 's';
@@ -927,19 +957,42 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
sad->gesture_dir = 'w';
if (sad->az->type == AZONE_AREA) {
- const wmWindow *win = CTX_wm_window(C);
+ wmWindow *win = CTX_wm_window(C);
rcti screen_rect;
WM_window_screen_rect_calc(win, &screen_rect);
- /* once we drag outside the actionzone, register a gesture
- * check we're not on an edge so join finds the other area */
- is_gesture = ((ED_area_actionzone_find_xy(sad->sa1, &event->x) != sad->az) &&
- (screen_geom_area_map_find_active_scredge(
- AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y) == NULL));
+
+ /* Have we dragged off the zone and are not on an edge? */
+ if ((ED_area_actionzone_find_xy(sad->sa1, &event->x) != sad->az) &&
+ (screen_geom_area_map_find_active_scredge(
+ AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y) == NULL))
+ {
+ /* Are we still in same area? */
+ if (BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, event->x, event->y) == sad->sa1) {
+ /* Same area, so possible split. */
+ WM_cursor_set(win, (ELEM(sad->gesture_dir, 'n', 's')) ? BC_V_SPLITCURSOR : BC_H_SPLITCURSOR);
+ is_gesture = (delta_max > split_threshold);
+ }
+ else {
+ /* Different area, so posible join. */
+ if (sad->gesture_dir == 'n')
+ WM_cursor_set(win, BC_N_ARROWCURSOR);
+ else if (sad->gesture_dir == 's')
+ WM_cursor_set(win, BC_S_ARROWCURSOR);
+ else if (sad->gesture_dir == 'e')
+ WM_cursor_set(win, BC_E_ARROWCURSOR);
+ else
+ WM_cursor_set(win, BC_W_ARROWCURSOR);
+ is_gesture = (delta_max > join_threshold);
+ }
+ }
+ else {
+ WM_cursor_set(CTX_wm_window(C), BC_CROSSCURSOR);
+ is_gesture = false;
+ }
}
else {
- const int delta_min = 1;
- is_gesture = (ABS(delta_x) > delta_min || ABS(delta_y) > delta_min);
+ is_gesture = (delta_max > area_threshold);
}
/* gesture is large enough? */
@@ -1272,7 +1325,7 @@ static void area_move_set_limits(
int size_min = ED_area_global_min_size_y(area) - 1;
int size_max = ED_area_global_max_size_y(area) - 1;
- size_min = MAX2(size_min, 0);
+ size_min = max_ii(size_min, 0);
BLI_assert(size_min < size_max);
/* logic here is only tested for lower edge :) */
@@ -1889,7 +1942,7 @@ static void area_split_preview_update_cursor(bContext *C, wmOperator *op)
{
wmWindow *win = CTX_wm_window(C);
int dir = RNA_enum_get(op->ptr, "direction");
- WM_cursor_set(win, (dir == 'v') ? CURSOR_X_MOVE : CURSOR_Y_MOVE);
+ WM_cursor_set(win, (dir == 'n' || dir == 's') ? BC_V_SPLITCURSOR : BC_H_SPLITCURSOR);
}
/* UI callback, adds new handler */
@@ -2183,7 +2236,7 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
static const EnumPropertyItem prop_direction_items[] = {
{'h', "HORIZONTAL", 0, "Horizontal", ""},
{'v', "VERTICAL", 0, "Vertical", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void SCREEN_OT_area_split(wmOperatorType *ot)
@@ -2526,7 +2579,7 @@ static void areas_do_frame_follow(bContext *C, bool middle)
/* do follow here if editor type supports it */
if ((scr->redraws_flag & TIME_FOLLOW)) {
if ((ar->regiontype == RGN_TYPE_WINDOW &&
- ELEM(sa->spacetype, SPACE_SEQ, SPACE_IPO, SPACE_ACTION, SPACE_NLA)) ||
+ ELEM(sa->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
(sa->spacetype == SPACE_CLIP && ar->regiontype == RGN_TYPE_PREVIEW))
{
float w = BLI_rctf_size_x(&ar->v2d.cur);
@@ -2989,7 +3042,6 @@ static int area_join_init(bContext *C, wmOperator *op)
sAreaJoinData *jd = NULL;
int x1, y1;
int x2, y2;
- int shared = 0;
/* required properties, make negative to get return 0 if not set by caller */
x1 = RNA_int_get(op->ptr, "min_x");
@@ -3013,16 +3065,6 @@ static int area_join_init(bContext *C, wmOperator *op)
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) {
- printf("areas don't share edge\n");
- return 0;
- }
-
jd = (sAreaJoinData *)MEM_callocN(sizeof(sAreaJoinData), "op_area_join");
jd->sa1 = sa1;
@@ -3102,10 +3144,10 @@ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_PASS_THROUGH;
/* prepare operator state vars */
- RNA_int_set(op->ptr, "min_x", sad->x);
- RNA_int_set(op->ptr, "min_y", sad->y);
- RNA_int_set(op->ptr, "max_x", event->x);
- RNA_int_set(op->ptr, "max_y", event->y);
+ RNA_int_set(op->ptr, "min_x", sad->sa1->totrct.xmin);
+ RNA_int_set(op->ptr, "min_y", sad->sa1->totrct.ymin);
+ RNA_int_set(op->ptr, "max_x", sad->sa2->totrct.xmin);
+ RNA_int_set(op->ptr, "max_y", sad->sa2->totrct.ymin);
}
@@ -3129,6 +3171,7 @@ static void area_join_cancel(bContext *C, wmOperator *op)
static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
bScreen *sc = CTX_wm_screen(C);
+ wmWindow *win = CTX_wm_window(C);
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
/* execute the events */
@@ -3137,7 +3180,7 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
case MOUSEMOVE:
{
ScrArea *sa = BKE_screen_find_area_xy(sc, SPACE_TYPE_ANY, event->x, event->y);
- int dir;
+ int dir = -1;
if (sa) {
if (jd->sa1 != sa) {
@@ -3181,6 +3224,18 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
WM_event_add_notifier(C, NC_WINDOW, NULL);
}
}
+
+ if (dir == 1)
+ WM_cursor_set(win, BC_N_ARROWCURSOR);
+ else if (dir == 3)
+ WM_cursor_set(win, BC_S_ARROWCURSOR);
+ else if (dir == 2)
+ WM_cursor_set(win, BC_E_ARROWCURSOR);
+ else if (dir == 0)
+ WM_cursor_set(win, BC_W_ARROWCURSOR);
+ else
+ WM_cursor_set(win, BC_STOPCURSOR);
+
break;
}
case LEFTMOUSE:
@@ -3298,7 +3353,7 @@ static int spacedata_cleanup_exec(bContext *C, wmOperator *op)
ScrArea *sa;
int tot = 0;
- for (screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (screen = bmain->screens.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;
@@ -3351,7 +3406,7 @@ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
if (lastop) {
WM_operator_free_all_after(wm, lastop);
- WM_operator_repeat(C, lastop);
+ WM_operator_repeat_interactive(C, lastop);
}
return OPERATOR_CANCELLED;
@@ -3859,7 +3914,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws,
if ((redraws & TIME_ALL_3D_WIN) || from_anim_edit)
return 1;
break;
- case SPACE_IPO:
+ case SPACE_GRAPH:
case SPACE_NLA:
if ((redraws & TIME_ALL_ANIM_WIN) || from_anim_edit)
return 1;
@@ -3871,7 +3926,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws,
if ((redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN)) || from_anim_edit)
return 1;
break;
- case SPACE_BUTS:
+ case SPACE_PROPERTIES:
if (redraws & TIME_ALL_BUTS_WIN)
return 1;
break;
@@ -3896,7 +3951,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws,
}
else if (regiontype == RGN_TYPE_CHANNELS) {
switch (spacetype) {
- case SPACE_IPO:
+ case SPACE_GRAPH:
case SPACE_ACTION:
case SPACE_NLA:
if (redraws & TIME_ALL_ANIM_WIN)
@@ -4080,7 +4135,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
/* do follow here if editor type supports it */
if ((sad->redraws & TIME_FOLLOW)) {
if ((ar->regiontype == RGN_TYPE_WINDOW &&
- ELEM(sa->spacetype, SPACE_SEQ, SPACE_IPO, SPACE_ACTION, SPACE_NLA)) ||
+ ELEM(sa->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
(sa->spacetype == SPACE_CLIP && ar->regiontype == RGN_TYPE_PREVIEW))
{
float w = BLI_rctf_size_x(&ar->v2d.cur);
@@ -4108,8 +4163,8 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
*/
ED_refresh_viewport_fps(C);
- /* recalculate the timestep for the timer now that we've finished calculating this,
- * since the frames-per-second value may have been changed
+ /* Recalculate the time-step for the timer now that we've finished calculating this,
+ * since the frames-per-second value may have been changed.
*/
/* TODO: this may make evaluation a bit slower if the value doesn't change... any way to avoid this? */
wt->timestep = (1.0 / FPS);
@@ -4183,7 +4238,8 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
}
else {
- int refresh = SPACE_ACTION; /* these settings are currently only available from a menu in the TimeLine */
+ /* these settings are currently only available from a menu in the TimeLine */
+ int refresh = SPACE_ACTION;
if (mode == 1) /* XXX only play audio forwards!? */
BKE_sound_play_scene(scene);
@@ -4389,7 +4445,8 @@ static int userpref_show_invoke(bContext *C, wmOperator *op, const wmEvent *even
/* changes context! */
if (WM_window_open_temp(C, event->x, event->y, sizex, sizey, WM_WINDOW_USERPREFS) != NULL) {
- /* The header only contains the editor switcher and looks empty. So hiding in the temp window makes sense. */
+ /* The header only contains the editor switcher and looks empty.
+ * So hiding in the temp window makes sense. */
ScrArea *area = CTX_wm_area(C);
ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_HEADER);
region->flag |= RGN_FLAG_HIDDEN;
@@ -4695,6 +4752,12 @@ static void SCREEN_OT_region_blend(wmOperatorType *ot)
/** \name Space Type Set or Cycle Operator
* \{ */
+static bool space_type_set_or_cycle_poll(bContext *C)
+{
+ ScrArea *sa = CTX_wm_area(C);
+ return (sa && !ELEM(sa->spacetype, SPACE_TOPBAR, SPACE_STATUSBAR));
+}
+
static int space_type_set_or_cycle_exec(bContext *C, wmOperator *op)
{
const int space_type = RNA_enum_get(op->ptr, "space_type");
@@ -4743,7 +4806,7 @@ static void SCREEN_OT_space_type_set_or_cycle(wmOperatorType *ot)
/* api callbacks */
ot->exec = space_type_set_or_cycle_exec;
- ot->poll = ED_operator_areaactive;
+ ot->poll = space_type_set_or_cycle_poll;
ot->flag = 0;
@@ -4760,14 +4823,14 @@ static void SCREEN_OT_space_type_set_or_cycle(wmOperatorType *ot)
static const EnumPropertyItem space_context_cycle_direction[] = {
{SPACE_CONTEXT_CYCLE_PREV, "PREV", 0, "Previous", ""},
{SPACE_CONTEXT_CYCLE_NEXT, "NEXT", 0, "Next", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static bool space_context_cycle_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
/* sa might be NULL if called out of window bounds */
- return (sa && ELEM(sa->spacetype, SPACE_BUTS, SPACE_USERPREF));
+ return (sa && ELEM(sa->spacetype, SPACE_PROPERTIES, SPACE_USERPREF));
}
/**
@@ -4781,7 +4844,7 @@ static void context_cycle_prop_get(
const char *propname;
switch (sa->spacetype) {
- case SPACE_BUTS:
+ case SPACE_PROPERTIES:
RNA_pointer_create(&screen->id, &RNA_SpaceProperties, sa->spacedata.first, r_ptr);
propname = "context";
break;
@@ -4976,7 +5039,8 @@ static void keymap_modal_set(wmKeyConfig *keyconf)
{KM_MODAL_APPLY, "APPLY", 0, "Apply", ""},
{KM_MODAL_SNAP_ON, "SNAP", 0, "Snap on", ""},
{KM_MODAL_SNAP_OFF, "SNAP_OFF", 0, "Snap off", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
wmKeyMap *keymap;
/* Standard Modal keymap ------------------------------------------------ */
diff --git a/source/blender/editors/screen/screen_user_menu.c b/source/blender/editors/screen/screen_user_menu.c
index ef8588ca58c..4b8f210f1d9 100644
--- a/source/blender/editors/screen/screen_user_menu.c
+++ b/source/blender/editors/screen/screen_user_menu.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/screen_user_menu.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include <string.h>
@@ -67,11 +60,16 @@ bUserMenu **ED_screen_user_menus_find(const bContext *C, uint *r_len)
SpaceLink *sl = CTX_wm_space_data(C);
const char *context = CTX_data_mode_string(C);
+ if (sl == NULL) {
+ *r_len = 0;
+ return NULL;
+ }
+
uint array_len = 3;
bUserMenu **um_array = MEM_calloc_arrayN(array_len, sizeof(*um_array), __func__);
um_array[0] = BKE_blender_user_menu_find(&U.user_menus, sl->spacetype, context);
um_array[1] = (sl->spacetype != SPACE_TOPBAR) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_TOPBAR, context) : NULL;
- um_array[2] = (sl->spacetype == SPACE_VIEW3D) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_BUTS, context) : NULL;
+ um_array[2] = (sl->spacetype == SPACE_VIEW3D) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_PROPERTIES, context) : NULL;
*r_len = array_len;
return um_array;
@@ -261,7 +259,9 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu)
}
}
}
- MEM_freeN(um_array);
+ if (um_array) {
+ MEM_freeN(um_array);
+ }
if (is_empty) {
uiItemL(menu->layout, IFACE_("No menu items found"), ICON_NONE);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 8e3b32941e5..e49b42574a8 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
* Making screendumps.
*/
-/** \file blender/editors/screen/screendump.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
@@ -279,7 +273,8 @@ static bool screenshot_poll(bContext *C)
void SCREEN_OT_screenshot(wmOperatorType *ot)
{
- ot->name = "Save Screenshot"; /* weak: opname starting with 'save' makes filewindow give save-over */
+ /* weak: opname starting with 'save' makes filewindow give save-over */
+ ot->name = "Save Screenshot";
ot->idname = "SCREEN_OT_screenshot";
ot->description = "Capture a picture of the active area or whole Blender window";
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index d8e0945eb25..b442f718aa1 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/workspace_edit.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
#include <stdlib.h>
@@ -29,7 +25,6 @@
#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_path_util.h"
-#include "BLI_string.h"
#include "BKE_appdir.h"
#include "BKE_blendfile.h"
@@ -238,7 +233,7 @@ bool ED_workspace_delete(
ED_workspace_change((prev != NULL) ? prev : next, C, wm, win);
}
- BKE_libblock_free(bmain, workspace_id);
+ BKE_id_free(bmain, workspace_id);
return true;
}
diff --git a/source/blender/editors/screen/workspace_layout_edit.c b/source/blender/editors/screen/workspace_layout_edit.c
index 6d504c05dd1..401f0323af6 100644
--- a/source/blender/editors/screen/workspace_layout_edit.c
+++ b/source/blender/editors/screen/workspace_layout_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/screen/workspace_layout_edit.c
- * \ingroup edscr
+/** \file
+ * \ingroup edscr
*/
#include <stdlib.h>
@@ -31,7 +27,6 @@
#include "DNA_workspace_types.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_screen.h"
#include "BKE_workspace.h"
@@ -70,13 +65,22 @@ WorkSpaceLayout *ED_workspace_layout_duplicate(
bScreen *screen_new;
WorkSpaceLayout *layout_new;
- if (BKE_screen_is_fullscreen_area(screen_old)) {
- return NULL; /* XXX handle this case! */
- }
-
layout_new = ED_workspace_layout_add(bmain, workspace, win, name);
screen_new = BKE_workspace_layout_screen_get(layout_new);
- screen_data_copy(screen_new, screen_old);
+
+ if (BKE_screen_is_fullscreen_area(screen_old)) {
+ for (ScrArea *area_old = screen_old->areabase.first; area_old; area_old = area_old->next) {
+ if (area_old->full) {
+ ScrArea *area_new = (ScrArea *)screen_new->areabase.first;
+ ED_area_data_copy(area_new, area_old, true);
+ ED_area_tag_redraw(area_new);
+ break;
+ }
+ }
+ }
+ else {
+ screen_data_copy(screen_new, screen_old);
+ }
return layout_new;
}
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 80c58e5b91d..704de3f7f9d 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -56,9 +53,9 @@ set(SRC
paint_vertex.c
paint_vertex_color_ops.c
paint_vertex_color_utils.c
+ paint_vertex_proj.c
paint_vertex_weight_ops.c
paint_vertex_weight_utils.c
- paint_vertex_proj.c
sculpt.c
sculpt_undo.c
sculpt_uv.c
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 5467312d111..863afcf70aa 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 by Nicholas Bishop
* All rights reserved.
- *
- * Contributor(s): Jason Wilkins, Tom Musgrove.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/sculpt_paint/paint_cursor.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
@@ -316,8 +309,10 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
pool = BKE_image_pool_new();
- if (mtex->tex && mtex->tex->nodetree)
- ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */
+ if (mtex->tex && mtex->tex->nodetree) {
+ /* has internal flag to detect it only does it once */
+ ntreeTexBeginExecTree(mtex->tex->nodetree);
+ }
LoadTexData data = {
.br = br, .vc = vc, .mtex = mtex, .buffer = buffer, .col = col,
@@ -801,10 +796,11 @@ static void paint_draw_alpha_overlay(
UnifiedPaintSettings *ups, Brush *brush,
ViewContext *vc, int x, int y, float zoom, ePaintMode mode)
{
- /* color means that primary brush texture is colured and secondary is used for alpha/mask control */
+ /* color means that primary brush texture is colured and
+ * secondary is used for alpha/mask control */
bool col = ELEM(mode, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D, PAINT_MODE_VERTEX) ? true : false;
eOverlayControlFlags flags = BKE_paint_get_overlay_flags();
- gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT);
+ gpuPushAttr(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT);
/* Translate to region. */
GPU_matrix_push();
@@ -829,7 +825,7 @@ static void paint_draw_alpha_overlay(
}
GPU_matrix_pop();
- gpuPopAttrib();
+ gpuPopAttr();
}
@@ -1079,8 +1075,9 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
float translation[2] = { x, y };
float final_radius = (BKE_brush_size_get(scene, brush) * zoomx);
- /* don't calculate rake angles while a stroke is active because the rake variables are global and
- * we may get interference with the stroke itself. For line strokes, such interference is visible */
+ /* don't calculate rake angles while a stroke is active because the rake variables are global
+ * and we may get interference with the stroke itself.
+ * For line strokes, such interference is visible */
if (!ups->stroke_active) {
paint_calculate_rake_rotation(ups, brush, translation);
}
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index e9918481408..6e43c0ab492 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_curve.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include <string.h>
@@ -170,6 +166,8 @@ static int paintcurve_new_exec(bContext *C, wmOperator *UNUSED(op))
p->brush->paint_curve = BKE_paint_curve_add(bmain, "PaintCurve");
}
+ WM_event_add_notifier(C, NC_PAINTCURVE | NA_ADDED, NULL);
+
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/sculpt_paint/paint_curve_undo.c b/source/blender/editors/sculpt_paint/paint_curve_undo.c
index 77f06180df6..fb2f4b49f19 100644
--- a/source/blender/editors/sculpt_paint/paint_curve_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_curve_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_curve_undo.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include <string.h>
@@ -29,7 +25,6 @@
#include "DNA_brush_types.h"
#include "DNA_space_types.h"
-#include "BLI_string.h"
#include "BLI_array_utils.h"
#include "BKE_context.h"
@@ -99,7 +94,7 @@ static void paintcurve_undosys_step_encode_init(struct bContext *C, UndoStep *us
UNUSED_VARS(C, us_p);
}
-static bool paintcurve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool paintcurve_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
Paint *p = BKE_paint_get_active_from_context(C);
PaintCurve *pc = p ? (p->brush ? p->brush->paint_curve : NULL) : NULL;
@@ -116,7 +111,7 @@ static bool paintcurve_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C), UndoStep *us_p, int UNUSED(dir))
+static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
{
PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p;
undocurve_to_paintcurve(&us->data, us->pc);
@@ -139,7 +134,6 @@ void ED_paintcurve_undosys_type(UndoType *ut)
ut->step_decode = paintcurve_undosys_step_decode;
ut->step_free = paintcurve_undosys_step_free;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = false;
ut->step_size = sizeof(PaintCurveUndoStep);
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index 6faabe66462..b64c23ad0b6 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,11 @@
*
* 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
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
@@ -453,7 +443,7 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot)
static const EnumPropertyItem action_items[] = {
{PARTIALVIS_HIDE, "HIDE", 0, "Hide", "Hide vertices"},
{PARTIALVIS_SHOW, "SHOW", 0, "Show", "Show vertices"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem area_items[] = {
@@ -461,7 +451,7 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot)
{PARTIALVIS_INSIDE, "INSIDE", 0, "Inside", "Hide or show vertices inside the selection"},
{PARTIALVIS_ALL, "ALL", 0, "All", "Hide or show all vertices"},
{PARTIALVIS_MASKED, "MASKED", 0, "Masked", "Hide or show vertices that are masked (minimum mask value of 0.5)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index b8ac4403e1d..4749d2a3308 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -18,15 +16,11 @@
* All rights reserved.
*
* The Original Code is: some of this file.
- *
- * Contributor(s): Jens Ole Wund (bjornmose), Campbell Barton (ideasman42)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_image.c
- * \ingroup edsculpt
- * \brief Functions to paint images in 2D and 3D.
+/** \file
+ * \ingroup edsculpt
+ * \brief Functions to paint images in 2D and 3D.
*/
#include <float.h>
@@ -84,7 +78,6 @@
#include "GPU_immediate.h"
#include "GPU_state.h"
-#include "BIF_gl.h"
#include "IMB_colormanagement.h"
@@ -391,11 +384,14 @@ void paint_brush_init_tex(Brush *brush)
/* init mtex nodes */
if (brush) {
MTex *mtex = &brush->mtex;
- if (mtex->tex && mtex->tex->nodetree)
- ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */
+ if (mtex->tex && mtex->tex->nodetree) {
+ /* has internal flag to detect it only does it once */
+ ntreeTexBeginExecTree(mtex->tex->nodetree);
+ }
mtex = &brush->mask_mtex;
- if (mtex->tex && mtex->tex->nodetree)
+ if (mtex->tex && mtex->tex->nodetree) {
ntreeTexBeginExecTree(mtex->tex->nodetree);
+ }
}
}
@@ -493,7 +489,7 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo
}
settings->imapaint.flag |= IMAGEPAINT_DRAWING;
- ED_image_undo_push_begin(op->type->name);
+ ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D);
return pop;
}
@@ -1105,7 +1101,8 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
/* entering paint mode also sets image to editors */
if (imapaint->mode == IMAGEPAINT_MODE_MATERIAL) {
- Material *ma = give_current_material(ob, ob->actcol); /* set the current material active paint slot on image editor */
+ /* set the current material active paint slot on image editor */
+ Material *ma = give_current_material(ob, ob->actcol);
if (ma && ma->texpaintslot)
ima = ma->texpaintslot[ma->paint_active_slot].ima;
@@ -1115,7 +1112,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
}
if (ima) {
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl;
@@ -1125,7 +1122,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
if (!sima->pin) {
Object *obedit = CTX_data_edit_object(C);
- ED_space_image_set(bmain, sima, scene, obedit, ima);
+ ED_space_image_set(bmain, sima, obedit, ima);
}
}
}
@@ -1177,20 +1174,12 @@ void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
- UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings;
+ Scene *scene = CTX_data_scene(C);
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
- Object *ob = CTX_data_active_object(C);
- Brush *br;
- if (!(ob && (ob->mode & OB_MODE_VERTEX_PAINT))) {
- br = image_paint_brush(C);
- }
- else {
- /* At the moment, wpaint does not support the color flipper.
- * So for now we're only handling vpaint */
- ToolSettings *ts = CTX_data_tool_settings(C);
- VPaint *vp = ts->vpaint;
- br = BKE_paint_brush(&vp->paint);
- }
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Paint *paint = BKE_paint_get_active(scene, view_layer);
+ Brush *br = BKE_paint_brush(paint);
if (ups->flag & UNIFIED_PAINT_COLOR) {
swap_v3_v3(ups->rgb, ups->secondary_rgb);
@@ -1208,15 +1197,17 @@ static bool brush_colors_flip_poll(bContext *C)
if (image_paint_poll(C)) {
Brush *br = image_paint_brush(C);
if (br->imagepaint_tool == PAINT_TOOL_DRAW)
- return 1;
+ return true;
}
else {
Object *ob = CTX_data_active_object(C);
- if (ob && (ob->mode & OB_MODE_VERTEX_PAINT)) {
- return 1;
+ if (ob != NULL) {
+ if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)) {
+ return true;
+ }
}
}
- return 0;
+ return false;
}
void PAINT_OT_brush_colors_flip(wmOperatorType *ot)
@@ -1243,7 +1234,7 @@ void ED_imapaint_bucket_fill(struct bContext *C, float color[3], wmOperator *op)
BKE_undosys_step_push_init_with_type(wm->undo_stack, C, op->type->name, BKE_UNDOSYS_TYPE_IMAGE);
- ED_image_undo_push_begin(op->type->name);
+ ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D);
paint_2d_bucket_fill(C, color, NULL, NULL, NULL);
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 90aa13ab5c1..990017d3a20 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_image_2d.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
//#include <math.h>
#include <string.h>
@@ -1522,7 +1514,8 @@ void paint_2d_bucket_fill(
float image_init[2];
int minx = ibuf->x, miny = ibuf->y, maxx = 0, maxy = 0;
float pixel_color[4];
- /* We are comparing to sum of three squared values (assumed in range [0,1]), so need to multiply... */
+ /* We are comparing to sum of three squared values
+ * (assumed in range [0,1]), so need to multiply... */
float threshold_sq = br->fill_threshold * br->fill_threshold * 3;
UI_view2d_region_to_view(s->v2d, mouse_init[0], mouse_init[1], &image_init[0], &image_init[1]);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index e366246efbc..f8a2259d4a5 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -18,15 +16,11 @@
* All rights reserved.
*
* The Original Code is: some of this file.
- *
- * Contributor(s): Jens Ole Wund (bjornmose), Campbell Barton (ideasman42)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_image_proj.c
- * \ingroup edsculpt
- * \brief Functions to paint images in 2D and 3D.
+/** \file
+ * \ingroup edsculpt
+ * \brief Functions to paint images in 2D and 3D.
*/
#include <float.h>
@@ -67,6 +61,7 @@
#include "BKE_colorband.h"
#include "BKE_context.h"
#include "BKE_colortools.h"
+#include "BKE_customdata.h"
#include "BKE_idprop.h"
#include "BKE_image.h"
#include "BKE_library.h"
@@ -79,6 +74,7 @@
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "BKE_texture.h"
#include "DEG_depsgraph.h"
@@ -147,13 +143,20 @@ BLI_INLINE unsigned char f_to_char(const float val)
/* projectFaceSeamFlags options */
//#define PROJ_FACE_IGNORE (1<<0) /* When the face is hidden, backfacing or occluded */
//#define PROJ_FACE_INIT (1<<1) /* When we have initialized the faces data */
-#define PROJ_FACE_SEAM1 (1 << 0) /* If this face has a seam on any of its edges */
-#define PROJ_FACE_SEAM2 (1 << 1)
-#define PROJ_FACE_SEAM3 (1 << 2)
-#define PROJ_FACE_NOSEAM1 (1 << 4)
-#define PROJ_FACE_NOSEAM2 (1 << 5)
-#define PROJ_FACE_NOSEAM3 (1 << 6)
+/* If this face has a seam on any of its edges. */
+#define PROJ_FACE_SEAM0 (1 << 0)
+#define PROJ_FACE_SEAM1 (1 << 1)
+#define PROJ_FACE_SEAM2 (1 << 2)
+
+#define PROJ_FACE_NOSEAM0 (1 << 4)
+#define PROJ_FACE_NOSEAM1 (1 << 5)
+#define PROJ_FACE_NOSEAM2 (1 << 6)
+
+/* If the seam is completely initialized, including adjecent seams. */
+#define PROJ_FACE_SEAM_INIT0 (1 << 8)
+#define PROJ_FACE_SEAM_INIT1 (1 << 9)
+#define PROJ_FACE_SEAM_INIT2 (1 << 10)
/* face winding */
#define PROJ_FACE_WINDING_INIT 1
@@ -172,7 +175,8 @@ BLI_INLINE unsigned char f_to_char(const float val)
#define PROJ_SRC_VIEW_FILL 4
#define PROJ_VIEW_DATA_ID "view_data"
-#define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3) /* viewmat + winmat + clipsta + clipend + is_ortho */
+/* viewmat + winmat + clip_start + clip_end + is_ortho */
+#define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3)
#define PROJ_BUCKET_NULL 0
#define PROJ_BUCKET_INIT (1 << 0)
@@ -188,17 +192,20 @@ BLI_INLINE unsigned char f_to_char(const float val)
/* to avoid locking in tile initialization */
#define TILE_PENDING POINTER_FROM_INT(-1)
-/* This is mainly a convenience struct used so we can keep an array of images we use -
+/** This is mainly a convenience struct used so we can keep an array of images we use -
* their imbufs, etc, in 1 array, When using threads this array is copied for each thread
* because 'partRedrawRect' and 'touch' values would not be thread safe */
typedef struct ProjPaintImage {
Image *ima;
ImBuf *ibuf;
ImagePaintPartialRedraw *partRedrawRect;
- volatile void **undoRect; /* only used to build undo tiles during painting */
- unsigned short **maskRect; /* the mask accumulation must happen on canvas, not on space screen bucket.
- * Here we store the mask rectangle */
- bool **valid; /* store flag to enforce validation of undo rectangle */
+ /** Only used to build undo tiles during painting. */
+ volatile void **undoRect;
+ /** The mask accumulation must happen on canvas, not on space screen bucket.
+ * Here we store the mask rectangle. */
+ unsigned short **maskRect;
+ /** Store flag to enforce validation of undo rectangle. */
+ bool **valid;
bool touch;
} ProjPaintImage;
@@ -225,6 +232,12 @@ typedef struct ProjStrokeHandle {
Brush *brush;
} ProjStrokeHandle;
+typedef struct LoopSeamData {
+ float seam_uvs[2][2];
+ float seam_puvs[2][2];
+ float corner_dist_sq[2];
+} LoopSeamData;
+
/* Main projection painting struct passed to all projection painting functions */
typedef struct ProjPaintState {
View3D *v3d;
@@ -232,7 +245,8 @@ typedef struct ProjPaintState {
ARegion *ar;
Depsgraph *depsgraph;
Scene *scene;
- int source; /* PROJ_SRC_**** */
+ /* PROJ_SRC_**** */
+ int source;
/* the paint color. It can change depending of inverted mode or not */
float paint_color[3];
@@ -255,25 +269,38 @@ typedef struct ProjPaintState {
float stencil_value;
/* projection painting only */
- MemArena *arena_mt[BLENDER_MAX_THREADS]; /* for multithreading, the first item is sometimes used for non threaded cases too */
- LinkNode **bucketRect; /* screen sized 2D array, each pixel has a linked list of ProjPixel's */
- LinkNode **bucketFaces; /* bucketRect aligned array linkList of faces overlapping each bucket */
- unsigned char *bucketFlags; /* store if the bucks have been initialized */
-
- char *vertFlags; /* store options per vert, now only store if the vert is pointing away from the view */
- int buckets_x; /* The size of the bucket grid, the grid span's screenMin/screenMax so you can paint outsize the screen or with 2 brushes at once */
+ /** for multithreading, the first item is sometimes used for non threaded cases too. */
+ MemArena *arena_mt[BLENDER_MAX_THREADS];
+ /** screen sized 2D array, each pixel has a linked list of ProjPixel's */
+ LinkNode **bucketRect;
+ /** bucketRect aligned array linkList of faces overlapping each bucket. */
+ LinkNode **bucketFaces;
+ /** store if the bucks have been initialized. */
+ unsigned char *bucketFlags;
+
+ /** store options per vert, now only store if the vert is pointing away from the view. */
+ char *vertFlags;
+ /** The size of the bucket grid, the grid span's screenMin/screenMax
+ * so you can paint outsize the screen or with 2 brushes at once. */
+ int buckets_x;
int buckets_y;
- int pixel_sizeof; /* result of project_paint_pixel_sizeof(), constant per stroke */
+ /** result of project_paint_pixel_sizeof(), constant per stroke. */
+ int pixel_sizeof;
- int image_tot; /* size of projectImages array */
+ /** size of projectImages array. */
+ int image_tot;
- float (*screenCoords)[4]; /* verts projected into floating point screen space */
- float screenMin[2]; /* 2D bounds for mesh verts on the screen's plane (screenspace) */
+ /** verts projected into floating point screen space. */
+ float (*screenCoords)[4];
+ /** 2D bounds for mesh verts on the screen's plane (screenspace). */
+ float screenMin[2];
float screenMax[2];
- float screen_width; /* Calculated from screenMin & screenMax */
+ /** Calculated from screenMin & screenMax. */
+ float screen_width;
float screen_height;
- int winx, winy; /* from the carea or from the projection render */
+ /** from the carea or from the projection render. */
+ int winx, winy;
/* options for projection painting */
bool do_layer_clone;
@@ -282,33 +309,51 @@ typedef struct ProjPaintState {
bool do_stencil_brush;
bool do_material_slots;
- bool do_occlude; /* Use raytraced occlusion? - ortherwise will paint right through to the back*/
- bool do_backfacecull; /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */
- bool do_mask_normal; /* mask out pixels based on their normals */
- bool do_mask_cavity; /* mask out pixels based on cavity */
- float normal_angle; /* what angle to mask at */
- float normal_angle__cos; /* cos(normal_angle), faster to compare */
+ /** Use raytraced occlusion? - ortherwise will paint right through to the back. */
+ bool do_occlude;
+ /** ignore faces with normals pointing away,
+ * skips a lot of raycasts if your normals are correctly flipped. */
+ bool do_backfacecull;
+ /** mask out pixels based on their normals. */
+ bool do_mask_normal;
+ /** mask out pixels based on cavity. */
+ bool do_mask_cavity;
+ /** what angle to mask at. */
+ float normal_angle;
+ /** cos(normal_angle), faster to compare. */
+ float normal_angle__cos;
float normal_angle_inner;
float normal_angle_inner__cos;
- float normal_angle_range; /* difference between normal_angle and normal_angle_inner, for easy access */
+ /** difference between normal_angle and normal_angle_inner, for easy access. */
+ float normal_angle_range;
- bool do_face_sel; /* quick access to (me->editflag & ME_EDIT_PAINT_FACE_SEL) */
+ /** quick access to (me->editflag & ME_EDIT_PAINT_FACE_SEL) */
+ bool do_face_sel;
bool is_ortho;
- bool is_flip_object; /* the object is negative scaled */
- bool do_masking; /* use masking during painting. Some operations such as airbrush may disable */
- bool is_texbrush; /* only to avoid running */
- bool is_maskbrush; /* mask brush is applied before masking */
+ /** the object is negative scaled. */
+ bool is_flip_object;
+ /** use masking during painting. Some operations such as airbrush may disable. */
+ bool do_masking;
+ /** only to avoid running. */
+ bool is_texbrush;
+ /** mask brush is applied before masking. */
+ bool is_maskbrush;
#ifndef PROJ_DEBUG_NOSEAMBLEED
float seam_bleed_px;
+ float seam_bleed_px_sq;
#endif
/* clone vars */
float cloneOffset[2];
- float projectMat[4][4]; /* Projection matrix, use for getting screen coords */
- float projectMatInv[4][4]; /* inverse of projectMat */
- float viewDir[3]; /* View vector, use for do_backfacecull and for ray casting with an ortho viewport */
- float viewPos[3]; /* View location in object relative 3D space, so can compare to verts */
- float clipsta, clipend;
+ /** Projection matrix, use for getting screen coords. */
+ float projectMat[4][4];
+ /** inverse of projectMat. */
+ float projectMatInv[4][4];
+ /** View vector, use for do_backfacecull and for ray casting with an ortho viewport. */
+ float viewDir[3];
+ /** View location in object relative 3D space, so can compare to verts. */
+ float viewPos[3];
+ float clip_start, clip_end;
/* reproject vars */
Image *reproject_image;
@@ -320,7 +365,8 @@ typedef struct ProjPaintState {
int thread_tot;
int bucketMin[2];
int bucketMax[2];
- int context_bucket_x, context_bucket_y; /* must lock threads while accessing these */
+ /** must lock threads while accessing these. */
+ int context_bucket_x, context_bucket_y;
struct CurveMapping *cavity_curve;
BlurKernel *blurkernel;
@@ -343,13 +389,21 @@ typedef struct ProjPaintState {
bool is_shared_user;
ProjPaintImage *projImages;
- float *cavities; /* cavity amount for vertices */
+ /** cavity amount for vertices. */
+ float *cavities;
#ifndef PROJ_DEBUG_NOSEAMBLEED
- char *faceSeamFlags; /* store info about faces, if they are initialized etc*/
- char *faceWindingFlags; /* save the winding of the face in uv space, helps as an extra validation step for seam detection */
- float (*faceSeamUVs)[3][2]; /* expanded UVs for faces to use as seams */
- LinkNode **vertFaces; /* Only needed for when seam_bleed_px is enabled, use to find UV seams */
+ /** store info about faces, if they are initialized etc*/
+ ushort *faceSeamFlags;
+ /** save the winding of the face in uv space,
+ * helps as an extra validation step for seam detection. */
+ char *faceWindingFlags;
+ /** expanded UVs for faces to use as seams. */
+ LoopSeamData (*loopSeamData);
+ /** Only needed for when seam_bleed_px is enabled, use to find UV seams. */
+ LinkNode **vertFaces;
+ /** Seams per vert, to find adjacent seams. */
+ ListBase *vertSeams;
#endif
SpinLock *tile_lock;
@@ -357,6 +411,7 @@ typedef struct ProjPaintState {
Mesh *me_eval;
bool me_eval_free;
int totlooptri_eval;
+ int totloop_eval;
int totpoly_eval;
int totedge_eval;
int totvert_eval;
@@ -375,7 +430,8 @@ typedef struct ProjPaintState {
* so a loop indirection is needed as well.
*/
const MLoopUV **poly_to_loop_uv;
- const MLoopUV **poly_to_loop_uv_clone; /* other UV map, use for cloning between layers */
+ /** other UV map, use for cloning between layers. */
+ const MLoopUV **poly_to_loop_uv_clone;
/* Actual material for each index, either from object or Mesh datablock... */
Material **mat_array;
@@ -384,8 +440,10 @@ typedef struct ProjPaintState {
} ProjPaintState;
typedef union pixelPointer {
- float *f_pt; /* float buffer */
- unsigned int *uint_pt; /* 2 ways to access a char buffer */
+ /** float buffer. */
+ float *f_pt;
+ /** 2 ways to access a char buffer. */
+ unsigned int *uint_pt;
unsigned char *ch_pt;
} PixelPointer;
@@ -396,12 +454,14 @@ typedef union pixelStore {
} PixelStore;
typedef struct ProjPixel {
- float projCoSS[2]; /* the floating point screen projection of this pixel */
+ /** the floating point screen projection of this pixel. */
+ float projCoSS[2];
float worldCoSS[3];
short x_px, y_px;
- unsigned short image_index; /* if anyone wants to paint onto more than 65535 images they can bite me */
+ /** if anyone wants to paint onto more than 65535 images they can bite me. */
+ unsigned short image_index;
unsigned char bb_cell_index;
/* for various reasons we may want to mask out painting onto this pixel */
@@ -413,7 +473,8 @@ typedef struct ProjPixel {
* new mask value is lower then mask_accum */
unsigned short *mask_accum;
- /* horrible hack, store tile valid flag pointer here to re-validate tiles used for anchored and drag-dot strokes */
+ /* horrible hack, store tile valid flag pointer here to re-validate tiles
+ * used for anchored and drag-dot strokes */
bool *valid;
PixelPointer origColor;
@@ -435,10 +496,17 @@ typedef struct {
ProjPaintImage *pjima;
} TileInfo;
+typedef struct VertSeam {
+ struct VertSeam *next, *prev;
+ int tri;
+ uint loop;
+ float angle;
+ bool normal_cw;
+ float uv[2];
+} VertSeam;
/* -------------------------------------------------------------------- */
-
/** \name MLoopTri accessor functions.
* \{ */
@@ -624,7 +692,8 @@ static int project_paint_PickFace(
}
}
- return best_tri_index; /* will be -1 or a valid face */
+ /** will be -1 or a valid face. */
+ return best_tri_index;
}
/* Converts a uv coord into a pixel location wrapping if the uv is outside 0-1 range */
@@ -641,7 +710,8 @@ static void uvco_to_wrapped_pxco(const float uv[2], int ibuf_x, int ibuf_y, floa
*y = *y * ibuf_y - 0.5f;
}
-/* Set the top-most face color that the screen space coord 'pt' touches (or return 0 if none touch) */
+/* Set the top-most face color that the screen space coord 'pt' touches
+ * (or return 0 if none touch) */
static bool project_paint_PickColor(
const ProjPaintState *ps, const float pt[2],
float *rgba_fp, unsigned char *rgba, const bool interp)
@@ -665,7 +735,8 @@ static bool project_paint_PickColor(
interp_v2_v2v2v2(uv, UNPACK3(lt_tri_uv), w);
ima = project_paint_face_paint_image(ps, tri_index);
- ibuf = BKE_image_get_first_ibuf(ima); /* we must have got the imbuf before getting here */
+ /** we must have got the imbuf before getting here. */
+ ibuf = BKE_image_get_first_ibuf(ima);
if (!ibuf) return 0;
if (interp) {
@@ -745,7 +816,7 @@ static int project_paint_occlude_ptv(
/* do a 2D point in try intersection */
if (!isect_point_tri_v2(pt, v1, v2, v3))
- return 0; /* we know there is */
+ return 0;
/* From here on we know there IS an intersection */
@@ -801,7 +872,8 @@ static int project_paint_occlude_ptv_clip(
/* Check if a screenspace location is occluded by any other faces
* check, pixelScreenCo must be in screenspace, its Z-Depth only needs to be used for comparison
- * and doesn't need to be correct in relation to X and Y coords (this is the case in perspective view) */
+ * and doesn't need to be correct in relation to X and Y coords
+ * (this is the case in perspective view) */
static bool project_bucket_point_occluded(
const ProjPaintState *ps, LinkNode *bucketFace,
const int orig_face, const float pixelScreenCo[4])
@@ -859,16 +931,19 @@ static int line_isect_y(const float p1[2], const float p2[2], const float y_leve
{
float y_diff;
- if (y_level == p1[1]) { /* are we touching the first point? - no interpolation needed */
+ /* are we touching the first point? - no interpolation needed */
+ if (y_level == p1[1]) {
*x_isect = p1[0];
return ISECT_TRUE_P1;
}
- if (y_level == p2[1]) { /* are we touching the second point? - no interpolation needed */
+ /* are we touching the second point? - no interpolation needed */
+ if (y_level == p2[1]) {
*x_isect = p2[0];
return ISECT_TRUE_P2;
}
- y_diff = fabsf(p1[1] - p2[1]); /* yuck, horizontal line, we cant do much here */
+ /** yuck, horizontal line, we cant do much here. */
+ y_diff = fabsf(p1[1] - p2[1]);
if (y_diff < 0.000001f) {
*x_isect = (p1[0] + p2[0]) * 0.5f;
@@ -876,11 +951,13 @@ static int line_isect_y(const float p1[2], const float p2[2], const float y_leve
}
if (p1[1] > y_level && p2[1] < y_level) {
- *x_isect = (p2[0] * (p1[1] - y_level) + p1[0] * (y_level - p2[1])) / y_diff; /* (p1[1] - p2[1]); */
+ /* (p1[1] - p2[1]); */
+ *x_isect = (p2[0] * (p1[1] - y_level) + p1[0] * (y_level - p2[1])) / y_diff;
return ISECT_TRUE;
}
else if (p1[1] < y_level && p2[1] > y_level) {
- *x_isect = (p2[0] * (y_level - p1[1]) + p1[0] * (p2[1] - y_level)) / y_diff; /* (p2[1] - p1[1]); */
+ /* (p2[1] - p1[1]); */
+ *x_isect = (p2[0] * (y_level - p1[1]) + p1[0] * (p2[1] - y_level)) / y_diff;
return ISECT_TRUE;
}
else {
@@ -901,19 +978,23 @@ static int line_isect_x(const float p1[2], const float p2[2], const float x_leve
return ISECT_TRUE_P2;
}
- x_diff = fabsf(p1[0] - p2[0]); /* yuck, horizontal line, we cant do much here */
+ /* yuck, horizontal line, we cant do much here */
+ x_diff = fabsf(p1[0] - p2[0]);
- if (x_diff < 0.000001f) { /* yuck, vertical line, we cant do much here */
+ /* yuck, vertical line, we cant do much here */
+ if (x_diff < 0.000001f) {
*y_isect = (p1[0] + p2[0]) * 0.5f;
return ISECT_TRUE;
}
if (p1[0] > x_level && p2[0] < x_level) {
- *y_isect = (p2[1] * (p1[0] - x_level) + p1[1] * (x_level - p2[0])) / x_diff; /* (p1[0] - p2[0]); */
+ /* (p1[0] - p2[0]); */
+ *y_isect = (p2[1] * (p1[0] - x_level) + p1[1] * (x_level - p2[0])) / x_diff;
return ISECT_TRUE;
}
else if (p1[0] < x_level && p2[0] > x_level) {
- *y_isect = (p2[1] * (x_level - p1[0]) + p1[1] * (p2[0] - x_level)) / x_diff; /* (p2[0] - p1[0]); */
+ /* (p2[0] - p1[0]); */
+ *y_isect = (p2[1] * (x_level - p1[0]) + p1[1] * (p2[0] - x_level)) / x_diff;
return ISECT_TRUE;
}
else {
@@ -954,7 +1035,8 @@ static bool pixel_bounds_uv(
const int ibuf_x, const int ibuf_y
)
{
- float min_uv[2], max_uv[2]; /* UV bounds */
+ /* UV bounds */
+ float min_uv[2], max_uv[2];
INIT_MINMAX2(min_uv, max_uv);
@@ -978,7 +1060,8 @@ static bool pixel_bounds_uv(
static bool pixel_bounds_array(float (*uv)[2], rcti *bounds_px, const int ibuf_x, const int ibuf_y, int tot)
{
- float min_uv[2], max_uv[2]; /* UV bounds */
+ /* UV bounds */
+ float min_uv[2], max_uv[2];
if (tot == 0) {
return 0;
@@ -1031,7 +1114,8 @@ static bool check_seam(
const unsigned int i1 = ps->mloop_eval[orig_lt->tri[orig_i1_fidx]].v;
const unsigned int i2 = ps->mloop_eval[orig_lt->tri[orig_i2_fidx]].v;
LinkNode *node;
- int i1_fidx = -1, i2_fidx = -1; /* index in face */
+ /* index in face */
+ int i1_fidx = -1, i2_fidx = -1;
for (node = ps->vertFaces[i1]; node; node = node->next) {
const int tri_index = POINTER_AS_INT(node->link);
@@ -1097,123 +1181,306 @@ static bool check_seam(
return 1;
}
-#define SMALL_NUMBER 1.e-6f
-BLI_INLINE float shell_v2v2_normal_dir_to_dist(float n[2], float d[2])
+static VertSeam *find_adjacent_seam(const ProjPaintState *ps, uint loop_index, uint vert_index, VertSeam **r_seam)
+{
+ ListBase *vert_seams = &ps->vertSeams[vert_index];
+ VertSeam *seam = vert_seams->first;
+ VertSeam *adjacent = NULL;
+
+ while (seam->loop != loop_index) {
+ seam = seam->next;
+ }
+
+ if (r_seam) {
+ *r_seam = seam;
+ }
+
+ /* Circulate through the (sorted) vert seam array, in the direction of the seam normal,
+ * until we find the first opposing seam, matching in UV space. */
+ if (seam->normal_cw) {
+ LISTBASE_CIRCULAR_BACKWARD_BEGIN(vert_seams, adjacent, seam)
+ {
+ if ((adjacent->normal_cw != seam->normal_cw) &&
+ cmp_uv(adjacent->uv, seam->uv))
+ {
+ break;
+ }
+ }
+ LISTBASE_CIRCULAR_BACKWARD_END(vert_seams, adjacent, seam);
+ }
+ else {
+ LISTBASE_CIRCULAR_FORWARD_BEGIN(vert_seams, adjacent, seam)
+ {
+ if ((adjacent->normal_cw != seam->normal_cw) &&
+ cmp_uv(adjacent->uv, seam->uv))
+ {
+ break;
+ }
+ }
+ LISTBASE_CIRCULAR_FORWARD_END(vert_seams, adjacent, seam);
+ }
+
+ BLI_assert(adjacent);
+
+ return adjacent;
+}
+
+/* Computes the normal of two seams at their intersection,
+ * and returns the angle between the seam and its normal. */
+static float compute_seam_normal(VertSeam *seam, VertSeam *adj, float r_no[2])
{
- const float angle_cos = (normalize_v2(n) < SMALL_NUMBER) ? fabsf(dot_v2v2(d, n)) : 0.0f;
- return (UNLIKELY(angle_cos < SMALL_NUMBER)) ? 1.0f : (1.0f / angle_cos);
+ const float PI_2 = M_PI * 2.0f;
+ float angle[2];
+ float angle_rel, angle_no;
+
+ if (seam->normal_cw) {
+ angle[0] = adj->angle;
+ angle[1] = seam->angle;
+ }
+ else {
+ angle[0] = seam->angle;
+ angle[1] = adj->angle;
+ }
+
+ angle_rel = angle[1] - angle[0];
+
+ if (angle_rel < 0.0f) {
+ angle_rel += PI_2;
+ }
+
+ angle_rel *= 0.5f;
+
+ angle_no = angle_rel + angle[0];
+
+ if (angle_no > M_PI) {
+ angle_no -= PI_2;
+ }
+
+ r_no[0] = cosf(angle_no);
+ r_no[1] = sinf(angle_no);
+
+ return angle_rel;
}
-#undef SMALL_NUMBER
/* Calculate outset UV's, this is not the same as simply scaling the UVs,
* since the outset coords are a margin that keep an even distance from the original UV's,
* note that the image aspect is taken into account */
static void uv_image_outset(
- float (*orig_uv)[2], float (*outset_uv)[2], const float scaler,
- const int ibuf_x, const int ibuf_y, const bool cw)
+ const ProjPaintState *ps, float (*orig_uv)[2], float (*puv)[2],
+ uint tri_index, const int ibuf_x, const int ibuf_y)
{
- /* disallow shell-thickness to outset extreme values,
- * otherwise near zero area UV's may extend thousands of pixels. */
- const float scale_clamp = 5.0f;
-
- float a1, a2, a3;
- float puv[3][2]; /* pixelspace uv's */
- float no1[2], no2[2], no3[2]; /* normals */
- float dir1[2], dir2[2], dir3[2];
+ int fidx[2];
+ uint loop_index;
+ uint vert[2];
+ const MLoopTri *ltri = &ps->mlooptri_eval[tri_index];
+
float ibuf_inv[2];
ibuf_inv[0] = 1.0f / (float)ibuf_x;
ibuf_inv[1] = 1.0f / (float)ibuf_y;
- /* make UV's in pixel space so we can */
- puv[0][0] = orig_uv[0][0] * ibuf_x;
- puv[0][1] = orig_uv[0][1] * ibuf_y;
-
- puv[1][0] = orig_uv[1][0] * ibuf_x;
- puv[1][1] = orig_uv[1][1] * ibuf_y;
-
- puv[2][0] = orig_uv[2][0] * ibuf_x;
- puv[2][1] = orig_uv[2][1] * ibuf_y;
-
- /* face edge directions */
- sub_v2_v2v2(dir1, puv[1], puv[0]);
- sub_v2_v2v2(dir2, puv[2], puv[1]);
- sub_v2_v2v2(dir3, puv[0], puv[2]);
- normalize_v2(dir1);
- normalize_v2(dir2);
- normalize_v2(dir3);
-
- /* here we just use the orthonormality property (a1, a2) dot (a2, -a1) = 0
- * to get normals from the edge directions based on the winding */
- if (cw) {
- no1[0] = -dir3[1] - dir1[1];
- no1[1] = dir3[0] + dir1[0];
- no2[0] = -dir1[1] - dir2[1];
- no2[1] = dir1[0] + dir2[0];
- no3[0] = -dir2[1] - dir3[1];
- no3[1] = dir2[0] + dir3[0];
+ for (fidx[0] = 0; fidx[0] < 3; fidx[0]++) {
+ LoopSeamData *seam_data;
+ float (*seam_uvs)[2];
+ float ang[2];
+
+ if ((ps->faceSeamFlags[tri_index] & (PROJ_FACE_SEAM0 << fidx[0])) == 0) {
+ continue;
+ }
+
+ loop_index = ltri->tri[fidx[0]];
+
+ seam_data = &ps->loopSeamData[loop_index];
+ seam_uvs = seam_data->seam_uvs;
+
+ if (seam_uvs[0][0] != FLT_MAX) {
+ continue;
+ }
+
+ fidx[1] = (fidx[0] == 2) ? 0 : fidx[0] + 1;
+
+ vert[0] = ps->mloop_eval[loop_index].v;
+ vert[1] = ps->mloop_eval[ltri->tri[fidx[1]]].v;
+
+ for (uint i = 0; i < 2; i++) {
+ VertSeam *seam;
+ VertSeam *adj = find_adjacent_seam(ps, loop_index, vert[i], &seam);
+ float no[2];
+ float len_fact;
+ float tri_ang;
+
+ ang[i] = compute_seam_normal(seam, adj, no);
+ tri_ang = ang[i] - M_PI_2;
+
+ if (tri_ang > 0.0f) {
+ const float dist = ps->seam_bleed_px * tanf(tri_ang);
+ seam_data->corner_dist_sq[i] = SQUARE(dist);
+ }
+ else {
+ seam_data->corner_dist_sq[i] = 0.0f;
+ }
+
+ len_fact = cosf(tri_ang);
+ len_fact = UNLIKELY(len_fact < FLT_EPSILON) ? FLT_MAX : (1.0f / len_fact);
+
+ /* Clamp the length factor, see: T62236. */
+ len_fact = MIN2(len_fact, 5.0f);
+
+ mul_v2_fl(no, ps->seam_bleed_px * len_fact);
+
+ add_v2_v2v2(seam_data->seam_puvs[i], puv[fidx[i]], no);
+
+ mul_v2_v2v2(seam_uvs[i], seam_data->seam_puvs[i], ibuf_inv);
+ }
+
+ /* Handle convergent normals (can self-intersect). */
+ if ((ang[0] + ang[1]) < M_PI) {
+ if (isect_seg_seg_v2_simple(orig_uv[fidx[0]], seam_uvs[0], orig_uv[fidx[1]], seam_uvs[1])) {
+ float isect_co[2];
+
+ isect_seg_seg_v2_point(orig_uv[fidx[0]], seam_uvs[0], orig_uv[fidx[1]], seam_uvs[1], isect_co);
+
+ copy_v2_v2(seam_uvs[0], isect_co);
+ copy_v2_v2(seam_uvs[1], isect_co);
+ }
+ }
+
+ }
+}
+
+static void insert_seam_vert_array(
+ const ProjPaintState *ps, MemArena *arena, const int tri_index,
+ const int fidx1, const int ibuf_x, const int ibuf_y)
+{
+ const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
+ const float *lt_tri_uv[3] = {PS_LOOPTRI_AS_UV_3(ps->poly_to_loop_uv, lt)};
+ const int fidx[2] = {fidx1, ((fidx1 + 1) % 3)};
+ float vec[2];
+
+ VertSeam *vseam = BLI_memarena_alloc(arena, sizeof(VertSeam) * 2);
+
+ vseam->prev = NULL;
+ vseam->next = NULL;
+
+ vseam->tri = tri_index;
+ vseam->loop = lt->tri[fidx[0]];
+
+ sub_v2_v2v2(vec, lt_tri_uv[fidx[1]], lt_tri_uv[fidx[0]]);
+ vec[0] *= ibuf_x;
+ vec[1] *= ibuf_y;
+ vseam->angle = atan2f(vec[1], vec[0]);
+
+ /* If face windings are not initialized, something must be wrong. */
+ BLI_assert((ps->faceWindingFlags[tri_index] & PROJ_FACE_WINDING_INIT) != 0);
+ vseam->normal_cw = (ps->faceWindingFlags[tri_index] & PROJ_FACE_WINDING_CW);
+
+ copy_v2_v2(vseam->uv, lt_tri_uv[fidx[0]]);
+
+ vseam[1] = vseam[0];
+ vseam[1].angle += vseam[1].angle > 0.0f ? -M_PI : M_PI;
+ vseam[1].normal_cw = !vseam[1].normal_cw;
+ copy_v2_v2(vseam[1].uv, lt_tri_uv[fidx[1]]);
+
+ for (uint i = 0; i < 2; i++) {
+ uint vert = ps->mloop_eval[lt->tri[fidx[i]]].v;
+ ListBase *list = &ps->vertSeams[vert];
+ VertSeam *item = list->first;
+
+ while (item && item->angle < vseam[i].angle) {
+ item = item->next;
+ }
+
+ BLI_insertlinkbefore(list, item, &vseam[i]);
}
- else {
- no1[0] = dir3[1] + dir1[1];
- no1[1] = -dir3[0] - dir1[0];
- no2[0] = dir1[1] + dir2[1];
- no2[1] = -dir1[0] - dir2[0];
- no3[0] = dir2[1] + dir3[1];
- no3[1] = -dir2[0] - dir3[0];
- }
-
- a1 = shell_v2v2_normal_dir_to_dist(no1, dir3);
- a2 = shell_v2v2_normal_dir_to_dist(no2, dir1);
- a3 = shell_v2v2_normal_dir_to_dist(no3, dir2);
-
- CLAMP_MAX(a1, scale_clamp);
- CLAMP_MAX(a2, scale_clamp);
- CLAMP_MAX(a3, scale_clamp);
-
- mul_v2_fl(no1, a1 * scaler);
- mul_v2_fl(no2, a2 * scaler);
- mul_v2_fl(no3, a3 * scaler);
- add_v2_v2v2(outset_uv[0], puv[0], no1);
- add_v2_v2v2(outset_uv[1], puv[1], no2);
- add_v2_v2v2(outset_uv[2], puv[2], no3);
-
- mul_v2_v2(outset_uv[0], ibuf_inv);
- mul_v2_v2(outset_uv[1], ibuf_inv);
- mul_v2_v2(outset_uv[2], ibuf_inv);
}
/*
- * Be tricky with flags, first 4 bits are PROJ_FACE_SEAM1 to 4, last 4 bits are PROJ_FACE_NOSEAM1 to 4
+ * Be tricky with flags, first 4 bits are PROJ_FACE_SEAM0 to 4, last 4 bits are PROJ_FACE_NOSEAM0 to 4
* 1<<i - where i is (0-3)
*
* If we're multithreadng, make sure threads are locked when this is called
*/
-static void project_face_seams_init(const ProjPaintState *ps, const int tri_index)
+static void project_face_seams_init(
+ const ProjPaintState *ps, MemArena *arena, const int tri_index, const uint vert_index,
+ bool init_all, const int ibuf_x, const int ibuf_y)
{
- int other_face, other_fidx; /* vars for the other face, we also set its flag */
- int fidx1 = 2;
- int fidx2 = 0; /* next fidx in the face (0,1,2,3) -> (1,2,3,0) or (0,1,2) -> (1,2,0) for a tri */
+ /* vars for the other face, we also set its flag */
+ int other_face, other_fidx;
+ /* next fidx in the face (0,1,2,3) -> (1,2,3,0) or (0,1,2) -> (1,2,0) for a tri */
+ int fidx[2] = {2, 0};
+ const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
+ LinkNode *node;
/* initialize face winding if needed */
if ((ps->faceWindingFlags[tri_index] & PROJ_FACE_WINDING_INIT) == 0)
project_face_winding_init(ps, tri_index);
do {
- if ((ps->faceSeamFlags[tri_index] & (1 << fidx1 | 16 << fidx1)) == 0) {
- if (check_seam(ps, tri_index, fidx1, fidx2, &other_face, &other_fidx)) {
- ps->faceSeamFlags[tri_index] |= 1 << fidx1;
- if (other_face != -1)
- ps->faceSeamFlags[other_face] |= 1 << other_fidx;
- }
- else {
- ps->faceSeamFlags[tri_index] |= 16 << fidx1;
- if (other_face != -1)
- ps->faceSeamFlags[other_face] |= 16 << other_fidx; /* second 4 bits for disabled */
+ if (init_all ||
+ (ps->mloop_eval[lt->tri[fidx[0]]].v == vert_index) ||
+ (ps->mloop_eval[lt->tri[fidx[1]]].v == vert_index))
+ {
+ if ((ps->faceSeamFlags[tri_index] & (PROJ_FACE_SEAM0 << fidx[0] | PROJ_FACE_NOSEAM0 << fidx[0])) == 0) {
+ if (check_seam(ps, tri_index, fidx[0], fidx[1], &other_face, &other_fidx)) {
+ ps->faceSeamFlags[tri_index] |= PROJ_FACE_SEAM0 << fidx[0];
+ insert_seam_vert_array(ps, arena, tri_index, fidx[0], ibuf_x, ibuf_y);
+
+ if (other_face != -1) {
+ /* Check if the other seam is already set. We don't want to insert it in the list twice. */
+ if ((ps->faceSeamFlags[other_face] & (PROJ_FACE_SEAM0 << other_fidx)) == 0) {
+ ps->faceSeamFlags[other_face] |= PROJ_FACE_SEAM0 << other_fidx;
+ insert_seam_vert_array(ps, arena, other_face, other_fidx, ibuf_x, ibuf_y);
+ }
+ }
+ }
+ else {
+ ps->faceSeamFlags[tri_index] |= PROJ_FACE_NOSEAM0 << fidx[0];
+ ps->faceSeamFlags[tri_index] |= PROJ_FACE_SEAM_INIT0 << fidx[0];
+
+ if (other_face != -1) {
+ /* second 4 bits for disabled */
+ ps->faceSeamFlags[other_face] |= PROJ_FACE_NOSEAM0 << other_fidx;
+ ps->faceSeamFlags[other_face] |= PROJ_FACE_SEAM_INIT0 << other_fidx;
+ }
+ }
}
}
- fidx2 = fidx1;
- } while (fidx1--);
+ fidx[1] = fidx[0];
+ } while (fidx[0]--);
+
+ if (init_all) {
+ char checked_verts = 0;
+
+ fidx[0] = 2;
+ fidx[1] = 0;
+
+ do {
+ if ((ps->faceSeamFlags[tri_index] & (PROJ_FACE_SEAM_INIT0 << fidx[0])) == 0) {
+ for (uint i = 0; i < 2; i++) {
+ uint vert;
+
+ if ((checked_verts & (1 << fidx[i])) != 0) {
+ continue;
+ }
+
+ vert = ps->mloop_eval[lt->tri[fidx[i]]].v;
+
+ for (node = ps->vertFaces[vert]; node; node = node->next) {
+ const int tri = POINTER_AS_INT(node->link);
+
+ project_face_seams_init(ps, arena, tri, vert, false, ibuf_x, ibuf_y);
+ }
+
+ checked_verts |= 1 << fidx[i];
+ }
+
+ ps->faceSeamFlags[tri_index] |= PROJ_FACE_SEAM_INIT0 << fidx[0];
+ }
+
+ fidx[1] = fidx[0];
+ } while (fidx[0]--);
+ }
}
#endif // PROJ_DEBUG_NOSEAMBLEED
@@ -1261,7 +1528,8 @@ static void screen_px_from_persp(
}
else {
w[0] = w[1] = w[2] =
- w_int[0] = w_int[1] = w_int[2] = 1.0f / 3.0f; /* dummy values for zero area face */
+ /* dummy values for zero area face */
+ w_int[0] = w_int[1] = w_int[2] = 1.0f / 3.0f;
}
/* done re-weighting */
@@ -1372,8 +1640,10 @@ static float project_paint_uvpixel_mask(
BKE_image_release_ibuf(other_tpage, ibuf_other, NULL);
- if (!ps->do_layer_stencil_inv) /* matching the gimps layer mask black/white rules, white==full opacity */
+ if (!ps->do_layer_stencil_inv) {
+ /* matching the gimps layer mask black/white rules, white==full opacity */
mask = (1.0f - mask);
+ }
if (mask == 0.0f) {
return 0.0f;
@@ -1467,7 +1737,8 @@ static float project_paint_uvpixel_mask(
}
if (angle_cos <= ps->normal_angle__cos) {
- return 0.0f; /* outsize the normal limit*/
+ /* outsize the normal limit*/
+ return 0.0f;
}
else if (angle_cos < ps->normal_angle_inner__cos) {
mask *= (ps->normal_angle - acosf(angle_cos)) / ps->normal_angle_range;
@@ -1686,12 +1957,14 @@ static ProjPixel *project_paint_uvpixel_init(
* the faces are already initialized in project_paint_delayed_face_init(...) */
if (ibuf->rect_float) {
if (!project_paint_PickColor(ps, co, ((ProjPixelClone *)projPixel)->clonepx.f, NULL, 1)) {
- ((ProjPixelClone *)projPixel)->clonepx.f[3] = 0; /* zero alpha - ignore */
+ /* zero alpha - ignore */
+ ((ProjPixelClone *)projPixel)->clonepx.f[3] = 0;
}
}
else {
if (!project_paint_PickColor(ps, co, NULL, ((ProjPixelClone *)projPixel)->clonepx.ch, 1)) {
- ((ProjPixelClone *)projPixel)->clonepx.ch[3] = 0; /* zero alpha - ignore */
+ /* zero alpha - ignore */
+ ((ProjPixelClone *)projPixel)->clonepx.ch[3] = 0;
}
}
}
@@ -1726,7 +1999,8 @@ static bool line_clip_rect2f(
}
- if (fabsf(l1[0] - l2[0]) < PROJ_PIXEL_TOLERANCE) { /* this is a single point (or close to)*/
+ /* this is a single point (or close to)*/
+ if (fabsf(l1[0] - l2[0]) < PROJ_PIXEL_TOLERANCE) {
if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
copy_v2_v2(l2_clip, l2);
@@ -1754,7 +2028,8 @@ static bool line_clip_rect2f(
return 0;
}
- if (fabsf(l1[1] - l2[1]) < PROJ_PIXEL_TOLERANCE) { /* this is a single point (or close to)*/
+ /* this is a single point (or close to)*/
+ if (fabsf(l1[1] - l2[1]) < PROJ_PIXEL_TOLERANCE) {
if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
copy_v2_v2(l2_clip, l2);
@@ -2131,7 +2406,8 @@ static void project_bucket_clip_face(
float bucket_bounds_ss[4][2];
/* detect pathological case where face the three vertices are almost collinear in screen space.
- * mostly those will be culled but when flood filling or with smooth shading it's a possibility */
+ * mostly those will be culled but when flood filling or with
+ * smooth shading it's a possibility */
if (min_fff(dist_squared_to_line_v2(v1coSS, v2coSS, v3coSS),
dist_squared_to_line_v2(v2coSS, v3coSS, v1coSS),
dist_squared_to_line_v2(v3coSS, v1coSS, v2coSS)) < PROJ_PIXEL_TOLERANCE)
@@ -2165,7 +2441,8 @@ static void project_bucket_clip_face(
*tot = 3;
return;
}
- /* handle pathological case here, no need for further intersections below since tringle area is almost zero */
+ /* handle pathological case here,
+ * no need for further intersections below since tringle area is almost zero */
if (collinear) {
int flag;
@@ -2213,7 +2490,8 @@ static void project_bucket_clip_face(
}
/* get the UV space bounding box */
- /* use IsectPT2Df_limit here so we catch points are are touching the tri edge (or a small fraction over) */
+ /* use IsectPT2Df_limit here so we catch points are are touching the tri edge
+ * (or a small fraction over) */
bucket_bounds_ss[0][0] = bucket_bounds->xmax;
bucket_bounds_ss[0][1] = bucket_bounds->ymin;
inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[0], v1coSS, v2coSS, v3coSS, 1 + PROJ_GEOM_TOLERANCE) ? ISECT_1 : 0);
@@ -2249,22 +2527,25 @@ static void project_bucket_clip_face(
else {
/* The Complicated Case!
*
- * The 2 cases above are where the face is inside the bucket or the bucket is inside the face.
+ * The 2 cases above are where the face is inside the bucket
+ * or the bucket is inside the face.
*
* we need to make a convex polyline from the intersection between the screenspace face
* and the bucket bounds.
*
- * There are a number of ways this could be done, currently it just collects all intersecting verts,
- * and line intersections, then sorts them clockwise, this is a lot easier then evaluating the geometry to
- * do a correct clipping on both shapes. */
-
-
- /* add a bunch of points, we know must make up the convex hull which is the clipped rect and triangle */
+ * There are a number of ways this could be done, currently it just collects all
+ * intersecting verts, and line intersections, then sorts them clockwise, this is
+ * a lot easier then evaluating the geometry to do a correct clipping on both shapes.
+ */
+ /* Add a bunch of points, we know must make up the convex hull
+ * which is the clipped rect and triangle */
/* Maximum possible 6 intersections when using a rectangle and triangle */
- float isectVCosSS[8][3]; /* The 3rd float is used to store angle for qsort(), NOT as a Z location */
+
+ /* The 3rd float is used to store angle for qsort(), NOT as a Z location */
+ float isectVCosSS[8][3];
float v1_clipSS[2], v2_clipSS[2];
float w[3];
@@ -2332,7 +2613,8 @@ static void project_bucket_clip_face(
}
#endif
- v1_clipSS[0] = cent[0]; /* Abuse this var for the loop below */
+ /* Abuse this var for the loop below */
+ v1_clipSS[0] = cent[0];
v1_clipSS[1] = cent[1] + 1.0f;
for (i = 0; i < (*tot); i++) {
@@ -2358,7 +2640,8 @@ static void project_bucket_clip_face(
isectVCosSS[j][0] = isectVCosSS[j + 1][0];
isectVCosSS[j][1] = isectVCosSS[j + 1][1];
}
- doubles = true; /* keep looking for more doubles */
+ /* keep looking for more doubles */
+ doubles = true;
(*tot)--;
}
}
@@ -2515,7 +2798,7 @@ static void project_paint_face_init(
ps->do_masking,
IMAPAINT_TILE_NUMBER(ibuf->x),
tmpibuf,
- ps->projImages + image_index
+ ps->projImages + image_index,
};
const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
@@ -2523,29 +2806,36 @@ static void project_paint_face_init(
const float *lt_tri_uv[3] = { PS_LOOPTRI_AS_UV_3(ps->poly_to_loop_uv, lt) };
/* UV/pixel seeking data */
- int x; /* Image X-Pixel */
- int y; /* Image Y-Pixel */
+ /* Image X/Y-Pixel */
+ int x, y;
float mask;
- float uv[2]; /* Image floating point UV - same as x, y but from 0.0-1.0 */
+ /* Image floating point UV - same as x, y but from 0.0-1.0 */
+ float uv[2];
- const float *v1coSS, *v2coSS, *v3coSS; /* vert co screen-space, these will be assigned to lt_vtri[0-2] */
+ /* vert co screen-space, these will be assigned to lt_vtri[0-2] */
+ const float *v1coSS, *v2coSS, *v3coSS;
- const float *vCo[3]; /* vertex screenspace coords */
+ /* vertex screenspace coords */
+ const float *vCo[3];
float w[3], wco[3];
- float *uv1co, *uv2co, *uv3co; /* for convenience only, these will be assigned to lt_tri_uv[0],1,2 or lt_tri_uv[0],2,3 */
+ /* for convenience only, these will be assigned to lt_tri_uv[0],1,2 or lt_tri_uv[0],2,3 */
+ float *uv1co, *uv2co, *uv3co;
float pixelScreenCo[4];
bool do_3d_mapping = ps->brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D;
- rcti bounds_px; /* ispace bounds */
+ /* ispace bounds */
+ rcti bounds_px;
/* vars for getting uvspace bounds */
- float lt_uv_pxoffset[3][2]; /* bucket bounds in UV space so we can init pixels only for this face, */
+ /* bucket bounds in UV space so we can init pixels only for this face, */
+ float lt_uv_pxoffset[3][2];
float xhalfpx, yhalfpx;
const float ibuf_xf = (float)ibuf->x, ibuf_yf = (float)ibuf->y;
- int has_x_isect = 0, has_isect = 0; /* for early loop exit */
+ /* for early loop exit */
+ int has_x_isect = 0, has_isect = 0;
float uv_clip[8][2];
int uv_clip_tot;
@@ -2619,12 +2909,14 @@ static void project_paint_face_init(
has_isect = 0;
for (y = bounds_px.ymin; y < bounds_px.ymax; y++) {
//uv[1] = (((float)y) + 0.5f) / (float)ibuf->y;
- uv[1] = (float)y / ibuf_yf; /* use pixel offset UV coords instead */
+ /* use pixel offset UV coords instead */
+ uv[1] = (float)y / ibuf_yf;
has_x_isect = 0;
for (x = bounds_px.xmin; x < bounds_px.xmax; x++) {
//uv[0] = (((float)x) + 0.5f) / ibuf->x;
- uv[0] = (float)x / ibuf_xf; /* use pixel offset UV coords instead */
+ /* use pixel offset UV coords instead */
+ uv[0] = (float)x / ibuf_xf;
/* Note about IsectPoly2Df_twoside, checking the face or uv flipping doesn't work,
* could check the poly direction but better to do this */
@@ -2646,7 +2938,8 @@ static void project_paint_face_init(
ps->mvert_eval[lt_vtri[2]].co,
w);
if (do_clip && ED_view3d_clipping_test(ps->rv3d, wco, true)) {
- continue; /* Watch out that no code below this needs to run */
+ /* Watch out that no code below this needs to run */
+ continue;
}
}
@@ -2679,7 +2972,8 @@ static void project_paint_face_init(
#if 0 /* TODO - investigate why this dosnt work sometimes! it should! */
- /* no intersection for this entire row, after some intersection above means we can quit now */
+ /* no intersection for this entire row,
+ * after some intersection above means we can quit now */
if (has_x_isect == 0 && has_isect) {
break;
}
@@ -2693,51 +2987,75 @@ static void project_paint_face_init(
if (ps->seam_bleed_px > 0.0f) {
int face_seam_flag;
- if (threaded)
- BLI_thread_lock(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+ if (threaded) {
+ /* Other threads could be modifying these vars. */
+ BLI_thread_lock(LOCK_CUSTOM1);
+ }
face_seam_flag = ps->faceSeamFlags[tri_index];
/* are any of our edges un-initialized? */
- if ((face_seam_flag & (PROJ_FACE_SEAM1 | PROJ_FACE_NOSEAM1)) == 0 ||
- (face_seam_flag & (PROJ_FACE_SEAM2 | PROJ_FACE_NOSEAM2)) == 0 ||
- (face_seam_flag & (PROJ_FACE_SEAM3 | PROJ_FACE_NOSEAM3)) == 0)
+ if ((face_seam_flag & PROJ_FACE_SEAM_INIT0) == 0 ||
+ (face_seam_flag & PROJ_FACE_SEAM_INIT1) == 0 ||
+ (face_seam_flag & PROJ_FACE_SEAM_INIT2) == 0)
{
- project_face_seams_init(ps, tri_index);
+ project_face_seams_init(ps, arena, tri_index, 0, true, ibuf->x, ibuf->y);
face_seam_flag = ps->faceSeamFlags[tri_index];
- //printf("seams - %d %d %d %d\n", flag&PROJ_FACE_SEAM1, flag&PROJ_FACE_SEAM2, flag&PROJ_FACE_SEAM3);
+ //printf("seams - %d %d %d %d\n", flag&PROJ_FACE_SEAM0, flag&PROJ_FACE_SEAM1, flag&PROJ_FACE_SEAM2);
}
- if ((face_seam_flag & (PROJ_FACE_SEAM1 | PROJ_FACE_SEAM2 | PROJ_FACE_SEAM3)) == 0) {
+ if ((face_seam_flag & (PROJ_FACE_SEAM0 | PROJ_FACE_SEAM1 | PROJ_FACE_SEAM2)) == 0) {
- if (threaded)
- BLI_thread_unlock(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+ if (threaded) {
+ /* Other threads could be modifying these vars. */
+ BLI_thread_unlock(LOCK_CUSTOM1);
+ }
}
else {
/* we have a seam - deal with it! */
- /* Now create new UV's for the seam face */
- float (*outset_uv)[2] = ps->faceSeamUVs[tri_index];
- float insetCos[3][3]; /* inset face coords. NOTE!!! ScreenSace for ortho, Worldspace in perspective view */
+ /* inset face coords. NOTE!!! ScreenSace for ortho, Worldspace in perspective view */
+ float insetCos[3][3];
- const float *vCoSS[3]; /* vertex screenspace coords */
+ /* vertex screenspace coords */
+ const float *vCoSS[3];
- float bucket_clip_edges[2][2]; /* store the screenspace coords of the face, clipped by the bucket's screen aligned rectangle */
+ /* Store the screenspace coords of the face,
+ * clipped by the bucket's screen aligned rectangle. */
+ float bucket_clip_edges[2][2];
float edge_verts_inset_clip[2][3];
- int fidx1, fidx2; /* face edge pairs - loop throuh these ((0,1), (1,2), (2,3), (3,0)) or ((0,1), (1,2), (2,0)) for a tri */
+ /* face edge pairs - loop throuh these:
+ * ((0,1), (1,2), (2,3), (3,0)) or ((0,1), (1,2), (2,0)) for a tri */
+ int fidx1, fidx2;
float seam_subsection[4][2];
float fac1, fac2;
- if (outset_uv[0][0] == FLT_MAX) /* first time initialize */
- uv_image_outset(
- lt_uv_pxoffset, outset_uv, ps->seam_bleed_px,
- ibuf->x, ibuf->y, (ps->faceWindingFlags[tri_index] & PROJ_FACE_WINDING_CW) == 0);
+ /* Pixelspace UVs. */
+ float lt_puv[3][2];
- /* ps->faceSeamUVs cant be modified when threading, now this is done we can unlock */
- if (threaded)
- BLI_thread_unlock(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+ lt_puv[0][0] = lt_uv_pxoffset[0][0] * ibuf->x;
+ lt_puv[0][1] = lt_uv_pxoffset[0][1] * ibuf->y;
+
+ lt_puv[1][0] = lt_uv_pxoffset[1][0] * ibuf->x;
+ lt_puv[1][1] = lt_uv_pxoffset[1][1] * ibuf->y;
+
+ lt_puv[2][0] = lt_uv_pxoffset[2][0] * ibuf->x;
+ lt_puv[2][1] = lt_uv_pxoffset[2][1] * ibuf->y;
+
+ if ((ps->faceSeamFlags[tri_index] & PROJ_FACE_SEAM0) ||
+ (ps->faceSeamFlags[tri_index] & PROJ_FACE_SEAM1) ||
+ (ps->faceSeamFlags[tri_index] & PROJ_FACE_SEAM2))
+ {
+ uv_image_outset(ps, lt_uv_pxoffset, lt_puv, tri_index, ibuf->x, ibuf->y);
+ }
+
+ /* ps->loopSeamUVs cant be modified when threading, now this is done we can unlock. */
+ if (threaded) {
+ /* Other threads could be modifying these vars */
+ BLI_thread_unlock(LOCK_CUSTOM1);
+ }
vCoSS[0] = ps->screenCoords[lt_vtri[0]];
vCoSS[1] = ps->screenCoords[lt_vtri[1]];
@@ -2752,12 +3070,17 @@ static void project_paint_face_init(
}
for (fidx1 = 0; fidx1 < 3; fidx1++) {
- fidx2 = (fidx1 == 2) ? 0 : fidx1 + 1; /* next fidx in the face (0,1,2) -> (1,2,0) */
+ /* next fidx in the face (0,1,2) -> (1,2,0) */
+ fidx2 = (fidx1 == 2) ? 0 : fidx1 + 1;
if ((face_seam_flag & (1 << fidx1)) && /* 1<<fidx1 -> PROJ_FACE_SEAM# */
line_clip_rect2f(clip_rect, bucket_bounds, vCoSS[fidx1], vCoSS[fidx2], bucket_clip_edges[0], bucket_clip_edges[1]))
{
- if (len_squared_v2v2(vCoSS[fidx1], vCoSS[fidx2]) > FLT_EPSILON) { /* avoid div by zero */
+ /* Avoid div by zero. */
+ if (len_squared_v2v2(vCoSS[fidx1], vCoSS[fidx2]) > FLT_EPSILON) {
+ uint loop_idx = ps->mlooptri_eval[tri_index].tri[fidx1];
+ LoopSeamData *seam_data = &ps->loopSeamData[loop_idx];
+ float (*seam_uvs)[2] = seam_data->seam_uvs;
if (is_ortho) {
fac1 = line_point_factor_v2(bucket_clip_edges[0], vCoSS[fidx1], vCoSS[fidx2]);
@@ -2771,8 +3094,8 @@ static void project_paint_face_init(
interp_v2_v2v2(seam_subsection[0], lt_uv_pxoffset[fidx1], lt_uv_pxoffset[fidx2], fac1);
interp_v2_v2v2(seam_subsection[1], lt_uv_pxoffset[fidx1], lt_uv_pxoffset[fidx2], fac2);
- interp_v2_v2v2(seam_subsection[2], outset_uv[fidx1], outset_uv[fidx2], fac2);
- interp_v2_v2v2(seam_subsection[3], outset_uv[fidx1], outset_uv[fidx2], fac1);
+ interp_v2_v2v2(seam_subsection[2], seam_uvs[0], seam_uvs[1], fac2);
+ interp_v2_v2v2(seam_subsection[3], seam_uvs[0], seam_uvs[1], fac1);
/* if the bucket_clip_edges values Z values was kept we could avoid this
* Inset needs to be added so occlusion tests wont hit adjacent faces */
@@ -2786,65 +3109,77 @@ static void project_paint_face_init(
has_isect = 0;
for (y = bounds_px.ymin; y < bounds_px.ymax; y++) {
// uv[1] = (((float)y) + 0.5f) / (float)ibuf->y;
- uv[1] = (float)y / ibuf_yf; /* use offset uvs instead */
+ /* use offset uvs instead */
+ uv[1] = (float)y / ibuf_yf;
has_x_isect = 0;
for (x = bounds_px.xmin; x < bounds_px.xmax; x++) {
+ float puv[2] = {(float)x, (float)y};
+ bool in_bounds;
//uv[0] = (((float)x) + 0.5f) / (float)ibuf->x;
- uv[0] = (float)x / ibuf_xf; /* use offset uvs instead */
+ /* use offset uvs instead */
+ uv[0] = (float)x / ibuf_xf;
/* test we're inside uvspace bucket and triangle bounds */
- if (isect_point_quad_v2(uv, UNPACK4(seam_subsection))) {
+ if (equals_v2v2(seam_uvs[0], seam_uvs[1])) {
+ in_bounds = isect_point_tri_v2(uv, UNPACK3(seam_subsection));
+ }
+ else {
+ in_bounds = isect_point_quad_v2(uv, UNPACK4(seam_subsection));
+ }
+
+ if (in_bounds) {
+ if ((seam_data->corner_dist_sq[0] > 0.0f) &&
+ (len_squared_v2v2(puv, seam_data->seam_puvs[0]) < seam_data->corner_dist_sq[0]) &&
+ (len_squared_v2v2(puv, lt_puv[fidx1]) > ps->seam_bleed_px_sq))
+ {
+ in_bounds = false;
+ }
+ else if ((seam_data->corner_dist_sq[1] > 0.0f) &&
+ (len_squared_v2v2(puv, seam_data->seam_puvs[1]) < seam_data->corner_dist_sq[1]) &&
+ (len_squared_v2v2(puv, lt_puv[fidx2]) > ps->seam_bleed_px_sq))
+ {
+ in_bounds = false;
+ }
+ }
+
+ if (in_bounds) {
+ float pixel_on_edge[4];
float fac;
- /* We need to find the closest point along the face edge,
- * getting the screen_px_from_*** wont work because our actual location
- * is not relevant, since we are outside the face, Use VecLerpf to find
- * our location on the side of the face's UV */
-#if 0
- if (is_ortho) screen_px_from_ortho(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo);
- else screen_px_from_persp(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo);
-#endif
+ if (is_ortho) {
+ screen_px_from_ortho(uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo, w);
+ }
+ else {
+ screen_px_from_persp(uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo, w);
+ }
- /* Since this is a seam we need to work out where on the line this pixel is */
- //fac = line_point_factor_v2(uv, uv_seam_quad[0], uv_seam_quad[1]);
+ /* We need the coord of the pixel on the edge, for the occlusion query. */
fac = resolve_quad_u_v2(uv, UNPACK4(seam_subsection));
- interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac);
+ interp_v3_v3v3(pixel_on_edge, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac);
if (!is_ortho) {
- pixelScreenCo[3] = 1.0f;
- mul_m4_v4((float(*)[4])ps->projectMat, pixelScreenCo); /* cast because of const */
- pixelScreenCo[0] = (float)(ps->winx * 0.5f) + (ps->winx * 0.5f) * pixelScreenCo[0] / pixelScreenCo[3];
- pixelScreenCo[1] = (float)(ps->winy * 0.5f) + (ps->winy * 0.5f) * pixelScreenCo[1] / pixelScreenCo[3];
- pixelScreenCo[2] = pixelScreenCo[2] / pixelScreenCo[3]; /* Use the depth for bucket point occlusion */
+ pixel_on_edge[3] = 1.0f;
+ /* cast because of const */
+ mul_m4_v4((float(*)[4])ps->projectMat, pixel_on_edge);
+ pixel_on_edge[0] = (float)(ps->winx * 0.5f) + (ps->winx * 0.5f) * pixel_on_edge[0] / pixel_on_edge[3];
+ pixel_on_edge[1] = (float)(ps->winy * 0.5f) + (ps->winy * 0.5f) * pixel_on_edge[1] / pixel_on_edge[3];
+ /* Use the depth for bucket point occlusion */
+ pixel_on_edge[2] = pixel_on_edge[2] / pixel_on_edge[3];
}
if ((ps->do_occlude == false) ||
- !project_bucket_point_occluded(ps, bucketFaceNodes, tri_index, pixelScreenCo))
+ !project_bucket_point_occluded(ps, bucketFaceNodes, tri_index, pixel_on_edge))
{
- /* Only bother calculating the weights if we intersect */
- if (ps->do_mask_normal || ps->poly_to_loop_uv_clone) {
- const float uv_fac = fac1 + (fac * (fac2 - fac1));
-#if 0
- /* get the UV on the line since we want to copy the pixels from there for bleeding */
- float uv_close[2];
- interp_v2_v2v2(uv_close, lt_uv_pxoffset[fidx1], lt_uv_pxoffset[fidx2], uv_fac);
- barycentric_weights_v2(lt_uv_pxoffset[0], lt_uv_pxoffset[1], lt_uv_pxoffset[2], uv_close, w);
-#else
-
- /* Cheat, we know where we are along the edge so work out the weights from that */
- w[0] = w[1] = w[2] = 0.0;
- w[fidx1] = 1.0f - uv_fac;
- w[fidx2] = uv_fac;
-#endif
- }
-
- /* a pity we need to get the worldspace pixel location here */
+ /* a pity we need to get the worldspace
+ * pixel location here */
if (do_clip || do_3d_mapping) {
interp_v3_v3v3v3(wco, vCo[0], vCo[1], vCo[2], w);
if (do_clip && ED_view3d_clipping_test(ps->rv3d, wco, true)) {
- continue; /* Watch out that no code below this needs to run */
+ /* Watch out that no code below
+ * this needs to run */
+ continue;
}
}
@@ -2862,13 +3197,15 @@ static void project_paint_face_init(
}
}
else if (has_x_isect) {
- /* assuming the face is not a bow-tie - we know we cant intersect again on the X */
+ /* assuming the face is not a bow-tie - we know
+ * we cant intersect again on the X */
break;
}
}
#if 0 /* TODO - investigate why this dosnt work sometimes! it should! */
- /* no intersection for this entire row, after some intersection above means we can quit now */
+ /* no intersection for this entire row,
+ * after some intersection above means we can quit now */
if (has_x_isect == 0 && has_isect) {
break;
}
@@ -2886,12 +3223,22 @@ static void project_paint_face_init(
}
-/* takes floating point screenspace min/max and returns int min/max to be used as indices for ps->bucketRect, ps->bucketFlags */
-static void project_paint_bucket_bounds(const ProjPaintState *ps, const float min[2], const float max[2], int bucketMin[2], int bucketMax[2])
+/**
+ * Takes floating point screenspace min/max and
+ * returns int min/max to be used as indices for ps->bucketRect, ps->bucketFlags
+ */
+static void project_paint_bucket_bounds(
+ const ProjPaintState *ps,
+ const float min[2], const float max[2],
+ int bucketMin[2], int bucketMax[2])
{
/* divide by bucketWidth & bucketHeight so the bounds are offset in bucket grid units */
- /* XXX: the offset of 0.5 is always truncated to zero and the offset of 1.5f is always truncated to 1, is this really correct?? - jwilkins */
- bucketMin[0] = (int)((int)(((float)(min[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) + 0.5f); /* these offsets of 0.5 and 1.5 seem odd but they are correct */
+
+ /* XXX: the offset of 0.5 is always truncated to zero and the offset of 1.5f
+ * is always truncated to 1, is this really correct?? - jwilkins */
+
+ /* these offsets of 0.5 and 1.5 seem odd but they are correct */
+ bucketMin[0] = (int)((int)(((float)(min[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) + 0.5f);
bucketMin[1] = (int)((int)(((float)(min[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y) + 0.5f);
bucketMax[0] = (int)((int)(((float)(max[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) + 1.5f);
@@ -2906,13 +3253,22 @@ static void project_paint_bucket_bounds(const ProjPaintState *ps, const float mi
}
/* set bucket_bounds to a screen space-aligned floating point bound-box */
-static void project_bucket_bounds(const ProjPaintState *ps, const int bucket_x, const int bucket_y, rctf *bucket_bounds)
+static void project_bucket_bounds(
+ const ProjPaintState *ps, const int bucket_x, const int bucket_y, rctf *bucket_bounds)
{
- bucket_bounds->xmin = ps->screenMin[0] + ((bucket_x) * (ps->screen_width / ps->buckets_x)); /* left */
- bucket_bounds->xmax = ps->screenMin[0] + ((bucket_x + 1) * (ps->screen_width / ps->buckets_x)); /* right */
-
- bucket_bounds->ymin = ps->screenMin[1] + ((bucket_y) * (ps->screen_height / ps->buckets_y)); /* bottom */
- bucket_bounds->ymax = ps->screenMin[1] + ((bucket_y + 1) * (ps->screen_height / ps->buckets_y)); /* top */
+ /* left */
+ bucket_bounds->xmin = (
+ ps->screenMin[0] + ((bucket_x) * (ps->screen_width / ps->buckets_x)));
+ /* right */
+ bucket_bounds->xmax = (
+ ps->screenMin[0] + ((bucket_x + 1) * (ps->screen_width / ps->buckets_x)));
+
+ /* bottom */
+ bucket_bounds->ymin = (
+ ps->screenMin[1] + ((bucket_y) * (ps->screen_height / ps->buckets_y)));
+ /* top */
+ bucket_bounds->ymax = (
+ ps->screenMin[1] + ((bucket_y + 1) * (ps->screen_height / ps->buckets_y)));
}
/* Fill this bucket with pixels from the faces that intersect it.
@@ -2973,13 +3329,14 @@ static void project_bucket_init(
/* We want to know if a bucket and a face overlap in screen-space
*
- * Note, if this ever returns false positives its not that bad, since a face in the bounding area will have its pixels
- * calculated when it might not be needed later, (at the moment at least)
+ * Note, if this ever returns false positives its not that bad, since a face in the bounding area
+ * will have its pixels calculated when it might not be needed later, (at the moment at least)
* obviously it shouldn't have bugs though */
static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const MLoopTri *lt)
{
- /* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */
+ /* TODO - replace this with a tricker method that uses sideofline for all
+ * screenCoords's edges against the closest bucket corner */
const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) };
rctf bucket_bounds;
float p1[2], p2[2], p3[2], p4[2];
@@ -3024,15 +3381,19 @@ static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int buck
}
/* 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 */
+ * 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 MLoopTri *lt, const int tri_index)
{
const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) };
float min[2], max[2], *vCoSS;
- int bucketMin[2], bucketMax[2]; /* for ps->bucketRect indexing */
+ /* for ps->bucketRect indexing */
+ int bucketMin[2], bucketMax[2];
int fidx, bucket_x, bucket_y;
- int has_x_isect = -1, has_isect = 0; /* for early loop exit */
- MemArena *arena = ps->arena_mt[0]; /* just use the first thread arena since threading has not started yet */
+ /* for early loop exit */
+ int has_x_isect = -1, has_isect = 0;
+ /* just use the first thread arena since threading has not started yet */
+ MemArena *arena = ps->arena_mt[0];
INIT_MINMAX2(min, max);
@@ -3051,7 +3412,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *
int bucket_index = bucket_x + (bucket_y * ps->buckets_x);
BLI_linklist_prepend_arena(
&ps->bucketFaces[bucket_index],
- POINTER_FROM_INT(tri_index), /* cast to a pointer to shut up the compiler */
+ /* cast to a pointer to shut up the compiler */
+ POINTER_FROM_INT(tri_index),
arena
);
@@ -3063,7 +3425,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *
}
}
- /* no intersection for this entire row, after some intersection above means we can quit now */
+ /* no intersection for this entire row,
+ * after some intersection above means we can quit now */
if (has_x_isect == 0 && has_isect) {
break;
}
@@ -3071,7 +3434,10 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *
#ifndef PROJ_DEBUG_NOSEAMBLEED
if (ps->seam_bleed_px > 0.0f) {
- **ps->faceSeamUVs[tri_index] = FLT_MAX; /* set as uninitialized */
+ /* set as uninitialized */
+ ps->loopSeamData[lt->tri[0]].seam_uvs[0][0] = FLT_MAX;
+ ps->loopSeamData[lt->tri[1]].seam_uvs[0][0] = FLT_MAX;
+ ps->loopSeamData[lt->tri[2]].seam_uvs[0][0] = FLT_MAX;
}
#endif
}
@@ -3110,7 +3476,7 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet
ED_view3d_ob_project_mat_get_from_obmat(ps->rv3d, ps->obmat, ps->projectMat);
- ps->is_ortho = ED_view3d_clip_range_get(ps->depsgraph, ps->v3d, ps->rv3d, &ps->clipsta, &ps->clipend, true);
+ ps->is_ortho = ED_view3d_clip_range_get(ps->depsgraph, ps->v3d, ps->rv3d, &ps->clip_start, &ps->clip_end, true);
}
else {
/* re-projection */
@@ -3130,8 +3496,8 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet
/* use image array, written when creating image */
memcpy(winmat, array, sizeof(winmat)); array += sizeof(winmat) / sizeof(float);
memcpy(viewmat, array, sizeof(viewmat)); array += sizeof(viewmat) / sizeof(float);
- ps->clipsta = array[0];
- ps->clipend = array[1];
+ ps->clip_start = array[0];
+ ps->clip_end = array[1];
ps->is_ortho = array[2] ? 1 : 0;
invert_m4_m4(viewinv, viewmat);
@@ -3152,8 +3518,8 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet
BKE_camera_params_compute_matrix(&params);
copy_m4_m4(winmat, params.winmat);
- ps->clipsta = params.clipsta;
- ps->clipend = params.clipend;
+ ps->clip_start = params.clip_start;
+ ps->clip_end = params.clip_end;
ps->is_ortho = params.is_ortho;
}
else {
@@ -3214,11 +3580,12 @@ static void proj_paint_state_screen_coords_init(ProjPaintState *ps, const int di
mul_m4_v4(ps->projectMat, projScreenCo);
- if (projScreenCo[3] > ps->clipsta) {
+ if (projScreenCo[3] > ps->clip_start) {
/* screen space, not clamped */
projScreenCo[0] = (float)(ps->winx * 0.5f) + (ps->winx * 0.5f) * projScreenCo[0] / projScreenCo[3];
projScreenCo[1] = (float)(ps->winy * 0.5f) + (ps->winy * 0.5f) * projScreenCo[1] / projScreenCo[3];
- projScreenCo[2] = projScreenCo[2] / projScreenCo[3]; /* Use the depth for bucket point occlusion */
+ /* Use the depth for bucket point occlusion */
+ projScreenCo[2] = projScreenCo[2] / projScreenCo[3];
minmax_v2v2_v2(ps->screenMin, ps->screenMax, projScreenCo);
}
else {
@@ -3305,9 +3672,10 @@ static void proj_paint_state_seam_bleed_init(ProjPaintState *ps)
{
if (ps->seam_bleed_px > 0.0f) {
ps->vertFaces = MEM_callocN(sizeof(LinkNode *) * ps->totvert_eval, "paint-vertFaces");
- ps->faceSeamFlags = MEM_callocN(sizeof(char) * ps->totlooptri_eval, "paint-faceSeamFlags");
+ ps->faceSeamFlags = MEM_callocN(sizeof(ushort) * ps->totlooptri_eval, "paint-faceSeamFlags");
ps->faceWindingFlags = MEM_callocN(sizeof(char) * ps->totlooptri_eval, "paint-faceWindindFlags");
- ps->faceSeamUVs = MEM_mallocN(sizeof(float[3][2]) * ps->totlooptri_eval, "paint-faceSeamUVs");
+ ps->loopSeamData = MEM_mallocN(sizeof(LoopSeamData) * ps->totloop_eval, "paint-loopSeamUVs");
+ ps->vertSeams = MEM_callocN(sizeof(ListBase) * ps->totvert_eval, "paint-vertSeams");
}
}
#endif
@@ -3360,7 +3728,8 @@ static void proj_paint_state_vert_flags_init(ProjPaintState *ps)
}
if (ps->is_ortho) {
- if (dot_v3v3(ps->viewDir, no) <= ps->normal_angle__cos) { /* 1 vert of this face is towards us */
+ if (dot_v3v3(ps->viewDir, no) <= ps->normal_angle__cos) {
+ /* 1 vert of this face is towards us */
ps->vertFlags[a] |= PROJ_VERT_CULL;
}
}
@@ -3370,7 +3739,8 @@ static void proj_paint_state_vert_flags_init(ProjPaintState *ps)
if (UNLIKELY(ps->is_flip_object)) {
negate_v3(viewDirPersp);
}
- if (dot_v3v3(viewDirPersp, no) <= ps->normal_angle__cos) { /* 1 vert of this face is towards us */
+ if (dot_v3v3(viewDirPersp, no) <= ps->normal_angle__cos) {
+ /* 1 vert of this face is towards us */
ps->vertFlags[a] |= PROJ_VERT_CULL;
}
}
@@ -3411,17 +3781,26 @@ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *p
return false;
}
+ CustomData_MeshMasks cddata_masks = scene_eval->customdata_mask;
+ cddata_masks.fmask |= CD_MASK_MTFACE;
+ cddata_masks.lmask |= CD_MASK_MLOOPUV;
+
/* Workaround for subsurf selection, try the display mesh first */
if (ps->source == PROJ_SRC_IMAGE_CAM) {
/* using render mesh, assume only camera was rendered from */
ps->me_eval = mesh_create_eval_final_render(
- depsgraph, scene_eval, ob_eval, scene_eval->customdata_mask | CD_MASK_MLOOPUV | CD_MASK_MTFACE);
+ depsgraph, scene_eval, ob_eval, &cddata_masks);
ps->me_eval_free = true;
}
else {
+ if (ps->do_face_sel) {
+ cddata_masks.vmask |= CD_MASK_ORIGINDEX;
+ cddata_masks.emask |= CD_MASK_ORIGINDEX;
+ cddata_masks.pmask |= CD_MASK_ORIGINDEX;
+ }
ps->me_eval = mesh_get_eval_final(
depsgraph, scene_eval, ob_eval,
- scene_eval->customdata_mask | CD_MASK_MLOOPUV | CD_MASK_MTFACE | (ps->do_face_sel ? CD_MASK_ORIGINDEX : 0));
+ &cddata_masks);
ps->me_eval_free = false;
}
@@ -3434,7 +3813,8 @@ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *p
}
/* Build final material array, we use this a lot here. */
- const int totmat = ob->totcol + 1; /* materials start from 1, default material is 0 */
+ /* materials start from 1, default material is 0 */
+ const int totmat = ob->totcol + 1;
ps->mat_array = MEM_malloc_arrayN(totmat, sizeof(*ps->mat_array), __func__);
/* We leave last material as empty - rationale here is being able to index
* the materials by using the mf->mat_nr directly and leaving the last
@@ -3454,6 +3834,7 @@ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *p
ps->totvert_eval = ps->me_eval->totvert;
ps->totedge_eval = ps->me_eval->totedge;
ps->totpoly_eval = ps->me_eval->totpoly;
+ ps->totloop_eval = ps->me_eval->totloop;
ps->mlooptri_eval = BKE_mesh_runtime_looptri_ensure(ps->me_eval);
ps->totlooptri_eval = ps->me_eval->runtime.looptris.len;
@@ -3704,7 +4085,8 @@ static void project_paint_prepare_all_faces(
/* don't allow using the same inage for painting and stencilling */
if (slot->ima == ps->stencil_ima) {
/* While this shouldn't be used, face-winding reads all polys.
- * It's less trouble to set all faces to valid UV's, avoiding NULL checks all over. */
+ * It's less trouble to set all faces to valid UV's,
+ * avoiding NULL checks all over. */
ps->poly_to_loop_uv[lt->poly] = mloopuv_base;
continue;
}
@@ -3779,7 +4161,8 @@ static void project_paint_prepare_all_faces(
image_index = BLI_linklist_index(image_LinkList.list, tpage);
- if (image_index == -1 && BKE_image_has_ibuf(tpage, NULL)) { /* MemArena dosnt have an append func */
+ if (image_index == -1 && BKE_image_has_ibuf(tpage, NULL)) {
+ /* MemArena dosnt have an append func */
BLI_linklist_append(&image_LinkList, tpage);
image_index = ps->image_tot;
ps->image_tot++;
@@ -3814,7 +4197,8 @@ static void project_paint_begin(
ProjPaintFaceLookup face_lookup;
const MLoopUV *mloopuv_base = NULL;
- MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */
+ /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */
+ MemArena *arena;
const int diameter = 2 * BKE_brush_size_get(ps->scene, ps->brush);
@@ -3822,8 +4206,10 @@ static void project_paint_begin(
/* ---- end defines ---- */
- if (ps->source == PROJ_SRC_VIEW)
- ED_view3d_clipping_local(ps->rv3d, ps->ob->obmat); /* faster clipping lookups */
+ if (ps->source == PROJ_SRC_VIEW) {
+ /* faster clipping lookups */
+ ED_view3d_clipping_local(ps->rv3d, ps->ob->obmat);
+ }
ps->do_face_sel = ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_FACE_SEL) != 0);
ps->is_flip_object = (ps->ob->transflag & OB_NEG_SCALE) != 0;
@@ -3967,7 +4353,8 @@ static void project_paint_end(ProjPaintState *ps)
MEM_freeN(ps->vertFaces);
MEM_freeN(ps->faceSeamFlags);
MEM_freeN(ps->faceWindingFlags);
- MEM_freeN(ps->faceSeamUVs);
+ MEM_freeN(ps->loopSeamData);
+ MEM_freeN(ps->vertSeams);
}
#endif
@@ -4057,7 +4444,8 @@ static bool project_image_refresh_tagged(ProjPaintState *ps)
partial_redraw_single_init(pr);
}
- projIma->touch = 0; /* clear for reuse */
+ /* clear for reuse */
+ projIma->touch = 0;
}
}
@@ -4149,8 +4537,11 @@ typedef struct ProjectHandle {
float prevmval[2];
float mval[2];
- /* annoying but we need to have image bounds per thread, then merge into ps->projectPartialRedraws */
- ProjPaintImage *projImages; /* array of partial redraws */
+ /* Annoying but we need to have image bounds per thread,
+ * then merge into ps->projectPartialRedraws. */
+
+ /* array of partial redraws */
+ ProjPaintImage *projImages;
/* thread settings */
int thread_index;
@@ -4292,7 +4683,8 @@ static void do_projectpaint_soften(
float accum_tot = 0;
int xk, yk;
BlurKernel *kernel = ps->blurkernel;
- float rgba[4]; /* convert to byte after */
+ /* convert to byte after */
+ float rgba[4];
/* rather then painting, accumulate surrounding colors */
zero_v4(rgba);
@@ -4479,18 +4871,21 @@ static void *do_projectpaint_thread(void *ph_v)
unsigned short mask_short;
const float brush_alpha = BKE_brush_alpha_get(ps->scene, brush);
const float brush_radius = ps->brush_size;
- const float brush_radius_sq = brush_radius * brush_radius; /* avoid a square root with every dist comparison */
+ /* avoid a square root with every dist comparison */
+ const float brush_radius_sq = brush_radius * brush_radius;
const bool lock_alpha = ELEM(brush->blend, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_ADD_ALPHA) ?
0 : (brush->flag & BRUSH_LOCK_ALPHA) != 0;
LinkNode *smearPixels = NULL;
LinkNode *smearPixels_f = NULL;
- MemArena *smearArena = NULL; /* mem arena for this brush projection only */
+ /* mem arena for this brush projection only */
+ MemArena *smearArena = NULL;
LinkNode *softenPixels = NULL;
LinkNode *softenPixels_f = NULL;
- MemArena *softenArena = NULL; /* mem arena for this brush projection only */
+ /* mem arena for this brush projection only */
+ MemArena *softenArena = NULL;
if (tool == PAINT_TOOL_SMEAR) {
pos_ofs[0] = pos[0] - lastpos[0];
@@ -4502,7 +4897,8 @@ static void *do_projectpaint_thread(void *ph_v)
softenArena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 16), "paint soften arena");
}
- /* printf("brush bounds %d %d %d %d\n", bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */
+ /* printf("brush bounds %d %d %d %d\n",
+ * bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */
while (project_bucket_iter_next(ps, &bucket_index, &bucket_bounds, pos)) {
@@ -4701,7 +5097,8 @@ static void *do_projectpaint_thread(void *ph_v)
float samplecos[3];
float texrgba[4];
- /* taking 3d copy to account for 3D mapping too. It gets concatenated during sampling */
+ /* taking 3d copy to account for 3D mapping too.
+ * It gets concatenated during sampling */
if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
copy_v3_v3(samplecos, projPixel->worldCoSS);
}
@@ -4710,7 +5107,8 @@ static void *do_projectpaint_thread(void *ph_v)
samplecos[2] = 0.0f;
}
- /* note, for clone and smear, we only use the alpha, could be a special function */
+ /* note, for clone and smear,
+ * we only use the alpha, could be a special function */
BKE_brush_sample_tex_3d(ps->scene, brush, samplecos, texrgba, thread_index, pool);
copy_v3_v3(texrgb, texrgba);
@@ -5051,7 +5449,8 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
Brush *brush = ps->brush;
ps->tool = brush->imagepaint_tool;
ps->blend = brush->blend;
- /* only check for inversion for the soften tool, elsewhere, a resident brush inversion flag can cause issues */
+ /* only check for inversion for the soften tool, elsewhere,
+ * a resident brush inversion flag can cause issues */
if (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) {
ps->mode = (((ps->mode == BRUSH_STROKE_INVERT) ^ ((brush->flag & BRUSH_DIR_IN) != 0)) ?
BRUSH_STROKE_INVERT : BRUSH_STROKE_NORMAL);
@@ -5082,7 +5481,8 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
ps->depsgraph = CTX_data_depsgraph(C);
ps->scene = scene;
- ps->ob = ob; /* allow override of active object */
+ /* allow override of active object */
+ ps->ob = ob;
ps->do_material_slots = (settings->imapaint.mode == IMAGEPAINT_MODE_MATERIAL);
ps->stencil_ima = settings->imapaint.stencil;
@@ -5116,7 +5516,9 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
#ifndef PROJ_DEBUG_NOSEAMBLEED
- ps->seam_bleed_px = settings->imapaint.seam_bleed; /* pixel num to bleed */
+ /* pixel num to bleed */
+ ps->seam_bleed_px = settings->imapaint.seam_bleed;
+ ps->seam_bleed_px_sq = SQUARE(settings->imapaint.seam_bleed);
#endif
if (ps->do_mask_normal) {
@@ -5131,8 +5533,10 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
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)
- ps->do_mask_normal = false; /* no need to do blending */
+ if (ps->normal_angle_range <= 0.0f) {
+ /* no need to do blending */
+ ps->do_mask_normal = false;
+ }
ps->normal_angle__cos = cosf(ps->normal_angle);
ps->normal_angle_inner__cos = cosf(ps->normal_angle_inner);
@@ -5300,7 +5704,7 @@ void paint_proj_stroke_done(void *ps_handle_p)
/* use project paint to re-apply an image */
static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
{
- Image *image = BLI_findlink(&CTX_data_main(C)->image, RNA_enum_get(op->ptr, "image"));
+ Image *image = BLI_findlink(&CTX_data_main(C)->images, RNA_enum_get(op->ptr, "image"));
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
ProjPaintState ps = {NULL};
@@ -5368,13 +5772,15 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
ps.is_maskbrush = false;
ps.do_masking = false;
orig_brush_size = BKE_brush_size_get(scene, ps.brush);
- BKE_brush_size_set(scene, ps.brush, 32 * U.pixelsize); /* cover the whole image */
+ /* cover the whole image */
+ BKE_brush_size_set(scene, ps.brush, 32 * U.pixelsize);
- ps.tool = PAINT_TOOL_DRAW; /* so pixels are initialized with minimal info */
+ /* so pixels are initialized with minimal info */
+ ps.tool = PAINT_TOOL_DRAW;
scene->toolsettings->imapaint.flag |= IMAGEPAINT_DRAWING;
- ED_image_undo_push_begin(op->type->name);
+ ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_3D);
/* allocate and initialize spatial data structures */
project_paint_begin(C, &ps, false, 0);
@@ -5429,6 +5835,15 @@ void PAINT_OT_project_image(wmOperatorType *ot)
ot->prop = prop;
}
+static bool texture_paint_image_from_view_poll(bContext *C)
+{
+ if (BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0) == NULL) {
+ CTX_wm_operator_poll_msg_set(C, "No 3D viewport found to create image from");
+ return false;
+ }
+ return true;
+}
+
static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
{
Image *image;
@@ -5439,13 +5854,24 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *settings = scene->toolsettings;
- View3D *v3d = CTX_wm_view3d(C);
- RegionView3D *rv3d = CTX_wm_region_view3d(C);
int w = settings->imapaint.screen_grab_size[0];
int h = settings->imapaint.screen_grab_size[1];
int maxsize;
char err_out[256] = "unknown";
+ ScrArea *sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0);
+ if (!sa) {
+ BKE_report(op->reports, RPT_ERROR, "No 3D viewport found to create image from");
+ return OPERATOR_CANCELLED;
+ }
+ View3D *v3d = sa->spacedata.first;
+ ARegion *ar = BKE_area_find_region_active_win(sa);
+ if (!ar) {
+ BKE_report(op->reports, RPT_ERROR, "No 3D viewport found to create image from");
+ return OPERATOR_CANCELLED;
+ }
+ RegionView3D *rv3d = ar->regiondata;
+
RNA_string_get(op->ptr, "filepath", filename);
maxsize = GPU_max_texture_size();
@@ -5455,7 +5881,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
ibuf = ED_view3d_draw_offscreen_imbuf(
depsgraph, scene, v3d->shading.type,
- v3d, CTX_wm_region(C),
+ v3d, ar,
w, h, IB_rect, V3D_OFSDRAW_NONE, R_ALPHAPREMUL, 0, NULL,
NULL, err_out);
if (!ibuf) {
@@ -5502,11 +5928,11 @@ 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->description = "Make an image from biggest 3D view for re-projection";
/* api callbacks */
ot->exec = texture_paint_image_from_view_exec;
- ot->poll = ED_operator_region_view3d_active;
+ ot->poll = texture_paint_image_from_view_poll;
/* flags */
ot->flag = OPTYPE_REGISTER;
@@ -5529,7 +5955,8 @@ void BKE_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool
);
}
-/* Make sure that active object has a material, and assign UVs and image layers if they do not exist */
+/* Make sure that active object has a material,
+ * and assign UVs and image layers if they do not exist */
bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil)
{
Mesh *me;
@@ -5631,7 +6058,7 @@ enum {
LAYER_METALLIC,
LAYER_NORMAL,
LAYER_BUMP,
- LAYER_DISPLACEMENT
+ LAYER_DISPLACEMENT,
};
static const EnumPropertyItem layer_type_items[] = {
@@ -5642,7 +6069,7 @@ static const EnumPropertyItem layer_type_items[] = {
{LAYER_NORMAL, "NORMAL", 0, "Normal", ""},
{LAYER_BUMP, "BUMP", 0, "Bump", ""},
{LAYER_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static Image *proj_paint_image_create(wmOperator *op, Main *bmain)
@@ -5827,13 +6254,15 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
BKE_texpaint_slot_refresh_cache(scene, ma);
BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_USER_NEW_IMAGE);
WM_event_add_notifier(C, NC_IMAGE | NA_ADDED, ima);
- DEG_id_tag_update(&ma->id, 0);
- ED_area_tag_redraw(CTX_wm_area(C));
+ }
- BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ DEG_id_tag_update(&ntree->id, 0);
+ DEG_id_tag_update(&ma->id, ID_RECALC_SHADING);
+ ED_area_tag_redraw(CTX_wm_area(C));
- return true;
- }
+ BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+
+ return true;
}
return false;
@@ -5883,8 +6312,12 @@ static void get_default_texture_layer_name_for_object(Object *ob, int texture_ty
static int texture_paint_add_texture_paint_slot_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
+ /* Get material and default color to display in the popup. */
Object *ob = ED_object_active_context(C);
+ Material *ma = get_or_create_current_material(C, ob);
+
int type = get_texture_layer_type(op, "type");
+ proj_paint_default_color(op, type, ma);
char imagename[MAX_ID_NAME - 2];
get_default_texture_layer_name_for_object(ob, type, (char *)&imagename, sizeof(imagename));
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c b/source/blender/editors/sculpt_paint/paint_image_undo.c
index e26a4811afc..8c4bfe00654 100644
--- a/source/blender/editors/sculpt_paint/paint_image_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_image_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -13,12 +11,10 @@
*
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_image_undo.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
@@ -40,13 +36,15 @@
#include "BKE_context.h"
#include "BKE_image.h"
-#include "BKE_main.h"
+#include "BKE_paint.h"
#include "BKE_undo_system.h"
#include "DEG_depsgraph.h"
#include "ED_paint.h"
#include "ED_undo.h"
+#include "ED_util.h"
+#include "ED_object.h"
#include "GPU_draw.h"
@@ -98,7 +96,7 @@ void image_undo_end_locks(void)
typedef enum {
COPY = 0,
RESTORE = 1,
- RESTORE_COPY = 2
+ RESTORE_COPY = 2,
} CopyMode;
static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, CopyMode mode)
@@ -346,26 +344,13 @@ static void image_undo_restore_list(ListBase *lb, struct UndoIDPtrMap *id_map)
static void image_undo_free_list(ListBase *lb)
{
- UndoImageTile *tile;
-
- for (tile = lb->first; tile; tile = tile->next) {
+ for (UndoImageTile *tile = lb->first, *tile_next; tile; tile = tile_next) {
+ tile_next = tile->next;
MEM_freeN(tile->rect.pt);
+ MEM_freeN(tile);
}
}
-void ED_image_undo_push_begin(const char *name)
-{
- UndoStack *ustack = ED_undo_stack_get();
- bContext *C = NULL; /* special case, we never read from this. */
- BKE_undosys_step_push_init_with_type(ustack, C, name, BKE_UNDOSYS_TYPE_IMAGE);
-}
-
-void ED_image_undo_push_end(void)
-{
- UndoStack *ustack = ED_undo_stack_get();
- BKE_undosys_step_push(ustack, NULL, NULL);
-}
-
static void image_undo_invalidate(void)
{
UndoImageTile *tile;
@@ -385,6 +370,8 @@ static void image_undo_invalidate(void)
typedef struct ImageUndoStep {
UndoStep step;
ListBase tiles;
+ bool is_encode_init;
+ ePaintMode paint_mode;
/* Use for all ID lookups (can be NULL). */
struct UndoIDPtrMap *id_map;
@@ -418,11 +405,13 @@ static bool image_undosys_poll(bContext *C)
ScrArea *sa = CTX_wm_area(C);
if (sa && (sa->spacetype == SPACE_IMAGE)) {
SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
- if ((obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) || (sima->mode == SI_MODE_PAINT)) {
+ if ((obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) ||
+ (sima->mode == SI_MODE_PAINT))
+ {
return true;
}
}
- else if (sa && (sa->spacetype == SPACE_VIEW3D)) {
+ else {
if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) {
return true;
}
@@ -434,10 +423,11 @@ static void image_undosys_step_encode_init(struct bContext *UNUSED(C), UndoStep
{
ImageUndoStep *us = (ImageUndoStep *)us_p;
/* dummy, memory is cleared anyway. */
+ us->is_encode_init = true;
BLI_listbase_clear(&us->tiles);
}
-static bool image_undosys_step_encode(struct bContext *UNUSED(C), UndoStep *us_p)
+static bool image_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
/* dummy, encoding is done along the way by adding tiles
* to the current 'ImageUndoStep' added by encode_init. */
@@ -447,33 +437,103 @@ static bool image_undosys_step_encode(struct bContext *UNUSED(C), UndoStep *us_p
int allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
-
- /* first dispose of invalid tiles (may happen due to drag dot for instance) */
- for (UndoImageTile *tile = us->tiles.first; tile;) {
- if (!tile->valid) {
- UndoImageTile *tmp_tile = tile->next;
- MEM_freeN(tile->rect.pt);
- BLI_freelinkN(&us->tiles, tile);
- tile = tmp_tile;
- }
- else {
- us->step.data_size += allocsize * ((tile->use_float) ? sizeof(float) : sizeof(char));
- tile = tile->next;
+ if (us->is_encode_init) {
+ /* first dispose of invalid tiles (may happen due to drag dot for instance) */
+ for (UndoImageTile *tile = us->tiles.first; tile;) {
+ if (!tile->valid) {
+ UndoImageTile *tmp_tile = tile->next;
+ MEM_freeN(tile->rect.pt);
+ BLI_freelinkN(&us->tiles, tile);
+ tile = tmp_tile;
+ }
+ else {
+ us->step.data_size += allocsize * ((tile->use_float) ? sizeof(float) : sizeof(char));
+ tile = tile->next;
+ }
}
}
+ else {
+ /* Happens when switching modes. */
+ ePaintMode paint_mode = BKE_paintmode_get_active_from_context(C);
+ BLI_assert(ELEM(paint_mode, PAINT_MODE_TEXTURE_2D, PAINT_MODE_TEXTURE_3D));
+ us->paint_mode = paint_mode;
+ }
image_undosys_step_encode_store_ids(us);
+ us_p->is_applied = true;
+
return true;
}
-static void image_undosys_step_decode(struct bContext *UNUSED(C), UndoStep *us_p, int UNUSED(dir))
+
+static void image_undosys_step_decode_undo_impl(ImageUndoStep *us)
+{
+ BLI_assert(us->step.is_applied == true);
+ image_undo_restore_list(&us->tiles, us->id_map);
+ us->step.is_applied = false;
+}
+
+static void image_undosys_step_decode_redo_impl(ImageUndoStep *us)
+{
+ BLI_assert(us->step.is_applied == false);
+ image_undo_restore_list(&us->tiles, us->id_map);
+ us->step.is_applied = true;
+}
+
+static void image_undosys_step_decode_undo(ImageUndoStep *us)
+{
+ ImageUndoStep *us_iter = us;
+ while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) {
+ if (us_iter->step.next->is_applied == false) {
+ break;
+ }
+ us_iter = (ImageUndoStep *)us_iter->step.next;
+ }
+ while (us_iter != us) {
+ image_undosys_step_decode_undo_impl(us_iter);
+ us_iter = (ImageUndoStep *)us_iter->step.prev;
+ }
+}
+
+static void image_undosys_step_decode_redo(ImageUndoStep *us)
+{
+ ImageUndoStep *us_iter = us;
+ while (us_iter->step.prev && (us_iter->step.prev->type == us_iter->step.type)) {
+ if (us_iter->step.prev->is_applied == true) {
+ break;
+ }
+ us_iter = (ImageUndoStep *)us_iter->step.prev;
+ }
+ while (us_iter && (us_iter->step.is_applied == false)) {
+ image_undosys_step_decode_redo_impl(us_iter);
+ if (us_iter == us) {
+ break;
+ }
+ us_iter = (ImageUndoStep *)us_iter->step.next;
+ }
+}
+
+static void image_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir)
{
ImageUndoStep *us = (ImageUndoStep *)us_p;
#if 0
paint_undosys_step_decode_restore_ids(us);
#endif
- image_undo_restore_list(&us->tiles, us->id_map);
+
+ if (dir < 0) {
+ image_undosys_step_decode_undo(us);
+ }
+ else {
+ image_undosys_step_decode_redo(us);
+ }
+
+ if (us->paint_mode == PAINT_MODE_TEXTURE_3D) {
+ ED_object_mode_set(C, OB_MODE_TEXTURE_PAINT);
+ }
+
+ /* Refresh texture slots. */
+ ED_editors_init_for_undo(bmain);
}
static void image_undosys_step_free(UndoStep *us_p)
@@ -504,7 +564,6 @@ void ED_image_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = image_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_ACCUMULATE;
ut->use_context = true;
ut->step_size = sizeof(ImageUndoStep);
@@ -526,8 +585,17 @@ ListBase *ED_image_undosys_step_get_tiles(UndoStep *us_p)
ListBase *ED_image_undo_get_tiles(void)
{
UndoStack *ustack = ED_undo_stack_get();
- UndoStep *us = BKE_undosys_stack_init_or_active_with_type(ustack, BKE_UNDOSYS_TYPE_IMAGE);
- return ED_image_undosys_step_get_tiles(us);
+ UndoStep *us_prev = ustack->step_init;
+ UndoStep *us_p = BKE_undosys_stack_init_or_active_with_type(ustack, BKE_UNDOSYS_TYPE_IMAGE);
+ ImageUndoStep *us = (ImageUndoStep *)us_p;
+ /* We should always have an undo push started when accessing tiles,
+ * not doing this means we won't have paint_mode correctly set. */
+ BLI_assert(us_p == us_prev);
+ if (us_p != us_prev) {
+ /* Fallback value until we can be sure this never happens. */
+ us->paint_mode = PAINT_MODE_TEXTURE_2D;
+ }
+ return ED_image_undosys_step_get_tiles(us_p);
}
/* restore painting image to previous state. Used for anchored and drag-dot style brushes*/
@@ -538,4 +606,20 @@ void ED_image_undo_restore(UndoStep *us)
image_undo_invalidate();
}
+void ED_image_undo_push_begin(const char *name, int paint_mode)
+{
+ UndoStack *ustack = ED_undo_stack_get();
+ bContext *C = NULL; /* special case, we never read from this. */
+ UndoStep *us_p = BKE_undosys_step_push_init_with_type(ustack, C, name, BKE_UNDOSYS_TYPE_IMAGE);
+ ImageUndoStep *us = (ImageUndoStep *)us_p;
+ BLI_assert(ELEM(paint_mode, PAINT_MODE_TEXTURE_2D, PAINT_MODE_TEXTURE_3D));
+ us->paint_mode = paint_mode;
+}
+
+void ED_image_undo_push_end(void)
+{
+ UndoStack *ustack = ED_undo_stack_get();
+ BKE_undosys_step_push(ustack, NULL, NULL);
+}
+
/** \} */
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 4bfdf39621e..8363145ee07 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_intern.h
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
@@ -33,28 +26,28 @@
#define __PAINT_INTERN_H__
struct ARegion;
-struct bContext;
struct Brush;
-struct ImagePool;
-struct ColorSpace;
struct ColorManagedDisplay;
+struct ColorSpace;
+struct ImagePool;
struct ListBase;
struct MTex;
struct Object;
-struct PaintStroke;
struct Paint;
struct PaintCurve;
+struct PaintStroke;
struct PointerRNA;
-struct rcti;
-struct Scene;
struct RegionView3D;
+struct Scene;
+struct UndoStep;
struct VPaint;
struct ViewContext;
+struct bContext;
+struct rcti;
struct wmEvent;
struct wmOperator;
struct wmOperatorType;
struct wmWindowManager;
-struct UndoStep;
enum ePaintMode;
typedef struct CoNo {
@@ -113,7 +106,7 @@ void PAINT_OT_weight_set(struct wmOperatorType *ot);
enum {
WPAINT_GRADIENT_TYPE_LINEAR,
- WPAINT_GRADIENT_TYPE_RADIAL
+ WPAINT_GRADIENT_TYPE_RADIAL,
};
void PAINT_OT_weight_gradient(struct wmOperatorType *ot);
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index b8175e3d368..2f9706db636 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2012 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/sculpt_paint/paint_mask.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
@@ -484,7 +475,8 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
data.symmpass = symmpass;
- /* gather nodes inside lasso's enclosing rectangle (should greatly help with bigger meshes) */
+ /* gather nodes inside lasso's enclosing rectangle
+ * (should greatly help with bigger meshes) */
BKE_pbvh_search_gather(pbvh, BKE_pbvh_node_planes_contain_AABB, clip_planes_final, &nodes, &totnode);
data.task_data.ob = ob;
@@ -534,7 +526,7 @@ void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot)
ot->poll = sculpt_mode_poll;
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER;
/* properties */
WM_operator_properties_gesture_lasso(ot);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 80911cf202f..12e98bc5d33 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,22 +12,18 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_ops.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
#include <stdlib.h>
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLI_math_vector.h"
-#include "BLI_math_color.h"
#include "DNA_customdata_types.h"
#include "DNA_object_types.h"
@@ -354,7 +348,7 @@ static Brush *brush_tool_cycle(Main *bmain, Paint *paint, Brush *brush_orig, con
{
Brush *brush, *first_brush;
- if (!brush_orig && !(brush_orig = bmain->brush.first)) {
+ if (!brush_orig && !(brush_orig = bmain->brushes.first)) {
return NULL;
}
@@ -368,7 +362,7 @@ static Brush *brush_tool_cycle(Main *bmain, Paint *paint, Brush *brush_orig, con
/* Try to tool-slot first. */
first_brush = BKE_paint_toolslots_brush_get(paint, tool);
if (first_brush == NULL) {
- first_brush = bmain->brush.first;
+ first_brush = bmain->brushes.first;
}
}
else {
@@ -376,7 +370,7 @@ static Brush *brush_tool_cycle(Main *bmain, Paint *paint, Brush *brush_orig, con
* currently active brush do a cycling via all possible
* brushes with requested tool.
*/
- first_brush = brush_orig->id.next ? brush_orig->id.next : bmain->brush.first;
+ first_brush = brush_orig->id.next ? brush_orig->id.next : bmain->brushes.first;
}
/* get the next brush with the active tool */
@@ -388,7 +382,7 @@ static Brush *brush_tool_cycle(Main *bmain, Paint *paint, Brush *brush_orig, con
return brush;
}
- brush = brush->id.next ? brush->id.next : bmain->brush.first;
+ brush = brush->id.next ? brush->id.next : bmain->brushes.first;
} while (brush != first_brush);
return NULL;
@@ -561,13 +555,13 @@ typedef enum {
typedef enum {
STENCIL_PRIMARY = 0,
- STENCIL_SECONDARY = 1
+ STENCIL_SECONDARY = 1,
} StencilTextureMode;
typedef enum {
STENCIL_CONSTRAINT_X = 1,
- STENCIL_CONSTRAINT_Y = 2
+ STENCIL_CONSTRAINT_Y = 2,
} StencilConstraint;
typedef struct {
@@ -799,13 +793,13 @@ static void BRUSH_OT_stencil_control(wmOperatorType *ot)
{STENCIL_TRANSLATE, "TRANSLATION", 0, "Translation", ""},
{STENCIL_SCALE, "SCALE", 0, "Scale", ""},
{STENCIL_ROTATE, "ROTATION", 0, "Rotation", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem stencil_texture_items[] = {
{STENCIL_PRIMARY, "PRIMARY", 0, "Primary", ""},
{STENCIL_SECONDARY, "SECONDARY", 0, "Secondary", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
ot->name = "Stencil Brush Control";
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 15dd0438585..2af6a4db3ee 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2009 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jason Wilkins, Tom Musgrove.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/sculpt_paint/paint_stroke.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
@@ -58,8 +49,6 @@
#include "WM_api.h"
#include "WM_types.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_state.h"
@@ -494,8 +483,11 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float
}
/* This can be removed once fixed properly in
- * BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user)
- * at zero pressure we should do nothing 1/2^12 is 0.0002 which is the sensitivity of the most sensitive pen tablet available */
+ * BKE_brush_painter_paint(
+ * BrushPainter *painter, BrushFunc func,
+ * float *pos, double time, float pressure, void *user);
+ * at zero pressure we should do nothing 1/2^12 is 0.0002
+ * which is the sensitivity of the most sensitive pen tablet available */
if (tablet && (pressure < 0.0002f) &&
((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) ||
BKE_brush_use_alpha_pressure(scene, pop->s.brush) ||
@@ -980,7 +972,7 @@ static void paint_stroke_sample_average(
mul_v2_fl(average->mouse, 1.0f / stroke->num_samples);
average->pressure /= stroke->num_samples;
- /*printf("avg=(%f, %f), num=%d\n", average->mouse[0], average->mouse[1], stroke->num_samples);*/
+ // printf("avg=(%f, %f), num=%d\n", average->mouse[0], average->mouse[1], stroke->num_samples);
}
/**
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 923fc097f43..b8c067d61e7 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_utils.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include <math.h>
@@ -217,10 +209,10 @@ void paint_get_tex_pixel_col(
void paint_stroke_operator_properties(wmOperatorType *ot)
{
static const EnumPropertyItem stroke_mode_items[] = {
- {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally"},
+ {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Regular", "Apply brush normally"},
{BRUSH_STROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke"},
{BRUSH_STROKE_SMOOTH, "SMOOTH", 0, "Smooth", "Switch brush to smooth mode for duration of stroke"},
- {0}
+ {0},
};
PropertyRNA *prop;
@@ -594,7 +586,8 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot)
{CURVE_PRESET_LINE, "LINE", 0, "Line", ""},
{CURVE_PRESET_ROUND, "ROUND", 0, "Round", ""},
{CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
ot->name = "Preset";
ot->description = "Set brush shape";
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index f91c5f71b2f..f1ada42100d 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*
* Used for vertex color & weight paint and mode switching.
*
@@ -823,7 +815,8 @@ static void do_weight_paint_vertex_single(
dv, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags, wpi->active.lock);
if (index_mirr != -1) {
- /* only normalize if this is not a center vertex, else we get a conflict, normalizing twice */
+ /* only normalize if this is not a center vertex,
+ * else we get a conflict, normalizing twice */
if (index != index_mirr) {
do_weight_paint_normalize_all_locked_try_active(
dv_mirr, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags, wpi->mirror.lock);
@@ -1690,7 +1683,7 @@ static void do_wpaint_brush_blur_task_cb_ex(
{
/* Test to see if the vertex coordinates are within the spherical brush region. */
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
- /* For grid based pbvh, take the vert whose loop coopresponds to the current grid.
+ /* For grid based pbvh, take the vert whose loop corresponds to the current grid.
* Otherwise, take the current vert. */
const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
@@ -1787,7 +1780,7 @@ static void do_wpaint_brush_smear_task_cb_ex(
{
/* Test to see if the vertex coordinates are within the spherical brush region. */
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
- /* For grid based pbvh, take the vert whose loop cooresponds to the current grid.
+ /* For grid based pbvh, take the vert whose loop corresponds to the current grid.
* Otherwise, take the current vert. */
const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
@@ -2136,7 +2129,8 @@ static void wpaint_do_radial_symmetry(
}
}
-/* near duplicate of: sculpt.c's, 'do_symmetrical_brush_actions' and 'vpaint_do_symmetrical_brush_actions'. */
+/* near duplicate of: sculpt.c's,
+ * 'do_symmetrical_brush_actions' and 'vpaint_do_symmetrical_brush_actions'. */
static void wpaint_do_symmetrical_brush_actions(
bContext *C, Object *ob, VPaint *wp, Sculpt *sd, struct WPaintData *wpd, WeightPaintInfo *wpi)
{
@@ -2155,7 +2149,8 @@ static void wpaint_do_symmetrical_brush_actions(
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 */
+ /* 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 = 1; i <= symm; i++) {
if ((symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
cache->mirror_symmetry_pass = i;
@@ -2820,7 +2815,8 @@ static void do_vpaint_brush_blur_task_cb_ex(
col[2] = round_fl_to_uchar(sqrtf(divide_round_i(blend[2], total_hit_loops)));
col[3] = round_fl_to_uchar(sqrtf(divide_round_i(blend[3], total_hit_loops)));
- /* For each poly owning this vert, paint each loop belonging to this vert. */
+ /* For each poly owning this vert,
+ * paint each loop belonging to this vert. */
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
const int p_index = gmap->vert_to_poly[v_index].indices[j];
const int l_index = gmap->vert_to_loop[v_index].indices[j];
@@ -2917,7 +2913,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
* to neighbor direction is 0.0, meaning orthogonal. */
float stroke_dot_max = 0.0f;
- /* Get the color of the loop in the opposite direction of the brush movement */
+ /* Get the color of the loop in the opposite
+ * direction of the brush movement */
uint color_final = 0;
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
const int p_index = gmap->vert_to_poly[v_index].indices[j];
@@ -2932,7 +2929,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
if (v_other_index != v_index) {
const MVert *mv_other = &data->me->mvert[v_other_index];
- /* Get the direction from the selected vert to the neighbor. */
+ /* Get the direction from the
+ * selected vert to the neighbor. */
float other_dir[3];
sub_v3_v3v3(other_dir, mv_curr->co, mv_other->co);
project_plane_v3_v3v3(other_dir, other_dir, cache->view_normal);
@@ -2956,7 +2954,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
255 * brush_fade * brush_strength *
brush_alpha_pressure * grid_alpha;
- /* For each poly owning this vert, paint each loop belonging to this vert. */
+ /* For each poly owning this vert,
+ * paint each loop belonging to this vert. */
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
const int p_index = gmap->vert_to_poly[v_index].indices[j];
const int l_index = gmap->vert_to_loop[v_index].indices[j];
@@ -3097,7 +3096,8 @@ static void vpaint_do_radial_symmetry(
}
}
-/* near duplicate of: sculpt.c's, 'do_symmetrical_brush_actions' and 'wpaint_do_symmetrical_brush_actions'. */
+/* near duplicate of: sculpt.c's,
+ * 'do_symmetrical_brush_actions' and 'wpaint_do_symmetrical_brush_actions'. */
static void vpaint_do_symmetrical_brush_actions(
bContext *C, Sculpt *sd, VPaint *vp, struct VPaintData *vpd, Object *ob)
{
@@ -3116,7 +3116,8 @@ static void vpaint_do_symmetrical_brush_actions(
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 */
+ /* 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 = 1; i <= symm; i++) {
if (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5))) {
cache->mirror_symmetry_pass = i;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
index 1ce57868e3a..ae1736581fe 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex_color_ops.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c b/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c
index f78588df0fa..4a5c72e5199 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex_color_utils.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*
* Intended for use by `paint_vertex.c` & `paint_vertex_color_ops.c`.
*/
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
index 5fe96483044..9246c852b3a 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex_proj.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*
* Utility functions for getting vertex locations while painting
* (since they may be instanced multiple times in an evaluated mesh)
@@ -40,6 +33,7 @@
#include "DNA_object_types.h"
#include "BKE_context.h"
+#include "BKE_customdata.h"
#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
@@ -110,7 +104,9 @@ static void vpaint_proj_dm_map_cosnos_init(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
Mesh *me = ob->data;
- Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
+
+ CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH_ORIGINDEX;
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &cddata_masks);
memset(vp_handle->vcosnos, 0, sizeof(*vp_handle->vcosnos) * me->totvert);
BKE_mesh_foreach_mapped_vert(me_eval, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle, MESH_FOREACH_USE_NORMAL);
@@ -175,7 +171,9 @@ static void vpaint_proj_dm_map_cosnos_update(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
Mesh *me = ob->data;
- Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
+
+ CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH_ORIGINDEX;
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &cddata_masks);
/* quick sanity check - we shouldn't have to run this if there are no modifiers */
BLI_assert(BLI_listbase_is_empty(&ob->modifiers) == false);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index fe326ad7337..aa3f424f816 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,22 +12,17 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex_weight_ops.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
-#include "BLI_array_utils.h"
#include "BLI_bitmap.h"
-#include "BLI_task.h"
-#include "BLI_string_utils.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -147,7 +140,8 @@ void PAINT_OT_weight_from_bones(wmOperatorType *ot)
static const EnumPropertyItem type_items[] = {
{ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights from bones"},
{ARM_GROUPS_ENVELOPE, "ENVELOPES", 0, "From Envelopes", "Weights from envelopes with user defined radius"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Weight from Bones";
@@ -214,7 +208,8 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
const int vgroup_active = vc.obact->actdef - 1;
float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
- /* use combined weight in multipaint mode, since that's what is displayed to the user in the colors */
+ /* use combined weight in multipaint mode,
+ * since that's what is displayed to the user in the colors */
if (ts->multipaint) {
int defbase_tot_sel;
const int defbase_tot = BLI_listbase_count(&vc.obact->defbase);
@@ -229,7 +224,8 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
vgroup_weight = BKE_defvert_multipaint_collective_weight(
&me->dvert[v_idx_best], defbase_tot, defbase_sel, defbase_tot_sel, ts->auto_normalize);
- /* if autonormalize is enabled, but weights are not normalized, the value can exceed 1 */
+ /* if autonormalize is enabled, but weights are not normalized,
+ * the value can exceed 1 */
CLAMP(vgroup_weight, 0.0f, 1.0f);
}
@@ -376,7 +372,8 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-/* TODO, we could make this a menu into OBJECT_OT_vertex_group_set_active rather than its own operator */
+/* 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;
@@ -541,7 +538,7 @@ typedef struct WPGradient_vertStore {
float weight_orig;
enum {
VGRAD_STORE_NOP = 0,
- VGRAD_STORE_DW_EXIST = (1 << 0)
+ VGRAD_STORE_DW_EXIST = (1 << 0),
} flag;
} WPGradient_vertStore;
@@ -622,13 +619,13 @@ static void gradientVertUpdate__mapFunc(
const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
{
WPGradient_userData *grad_data = userData;
- Mesh *me = grad_data->me;
- if ((grad_data->use_select == false) || (me->mvert[index].flag & SELECT)) {
- WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- if (vs->sco[0] != FLT_MAX) {
- gradientVert_update(grad_data, index);
- }
+ WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
+
+ if (vs->sco[0] == FLT_MAX) {
+ return;
}
+
+ gradientVert_update(grad_data, index);
}
static void gradientVertInit__mapFunc(
@@ -637,42 +634,41 @@ static void gradientVertInit__mapFunc(
{
WPGradient_userData *grad_data = userData;
Mesh *me = grad_data->me;
+ WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- if ((grad_data->use_select == false) || (me->mvert[index].flag & SELECT)) {
- /* run first pass only,
- * the screen coords of the verts need to be cached because
- * updating the mesh may move them about (entering feedback loop) */
-
- if (BLI_BITMAP_TEST(grad_data->vert_visit, index) == 0) {
- WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- if (ED_view3d_project_float_object(
- grad_data->ar,
- co, vs->sco,
- V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
- {
- /* ok */
- MDeformVert *dv = &me->dvert[index];
- const MDeformWeight *dw;
- dw = defvert_find_index(dv, grad_data->def_nr);
- if (dw) {
- vs->weight_orig = dw->weight;
- vs->flag = VGRAD_STORE_DW_EXIST;
- }
- else {
- vs->weight_orig = 0.0f;
- vs->flag = VGRAD_STORE_NOP;
- }
+ if (grad_data->use_select && !(me->mvert[index].flag & SELECT)) {
+ copy_v2_fl(vs->sco, FLT_MAX);
+ return;
+ }
- BLI_BITMAP_ENABLE(grad_data->vert_visit, index);
+ /* run first pass only,
+ * the screen coords of the verts need to be cached because
+ * updating the mesh may move them about (entering feedback loop) */
+ if (BLI_BITMAP_TEST(grad_data->vert_visit, index)) {
+ copy_v2_fl(vs->sco, FLT_MAX);
+ return;
+ }
- gradientVert_update(grad_data, index);
- }
- else {
- /* no go */
- copy_v2_fl(vs->sco, FLT_MAX);
- }
- }
+ if (ED_view3d_project_float_object(
+ grad_data->ar,
+ co, vs->sco,
+ V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) != V3D_PROJ_RET_OK)
+ {
+ return;
+ }
+
+ MDeformVert *dv = &me->dvert[index];
+ const MDeformWeight *dw = defvert_find_index(dv, grad_data->def_nr);
+ if (dw) {
+ vs->weight_orig = dw->weight;
+ vs->flag = VGRAD_STORE_DW_EXIST;
+ }
+ else {
+ vs->weight_orig = 0.0f;
+ vs->flag = VGRAD_STORE_NOP;
}
+ BLI_BITMAP_ENABLE(grad_data->vert_visit, index);
+ gradientVert_update(grad_data, index);
}
static int paint_weight_gradient_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -792,7 +788,11 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, scene->customdata_mask | CD_MASK_ORIGINDEX);
+ CustomData_MeshMasks cddata_masks = scene->customdata_mask;
+ cddata_masks.vmask |= CD_MASK_ORIGINDEX;
+ cddata_masks.emask |= CD_MASK_ORIGINDEX;
+ cddata_masks.pmask |= CD_MASK_ORIGINDEX;
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &cddata_masks);
if (data.is_init) {
data.vert_visit = BLI_BITMAP_NEW(me->totvert, __func__);
@@ -843,7 +843,7 @@ void PAINT_OT_weight_gradient(wmOperatorType *ot)
static const EnumPropertyItem gradient_types[] = {
{WPAINT_GRADIENT_TYPE_LINEAR, "LINEAR", 0, "Linear", ""},
{WPAINT_GRADIENT_TYPE_RADIAL, "RADIAL", 0, "Radial", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c
index 0a1fc7c0b4e..38f9f1dfa9f 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/paint_vertex_weight_utils.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*
* Intended for use by `paint_vertex.c` & `paint_vertex_weight_ops.c`.
*/
@@ -151,7 +147,7 @@ int ED_wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active)
}
/* curdef should never be NULL unless this is
- * a lamp and BKE_object_defgroup_add_name fails */
+ * a light and BKE_object_defgroup_add_name fails */
return mirrdef;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 5694c760371..69b768c4318 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,11 @@
*
* The Original Code is Copyright (C) 2006 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jason Wilkins, Tom Musgrove.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Implements the Sculpt Mode tools
- *
*/
-/** \file blender/editors/sculpt_paint/sculpt.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
@@ -56,7 +46,6 @@
#include "BKE_ccg.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_library.h"
@@ -68,7 +57,9 @@
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_paint.h"
+#include "BKE_particle.h"
#include "BKE_pbvh.h"
+#include "BKE_pointcache.h"
#include "BKE_report.h"
#include "BKE_screen.h"
#include "BKE_subsurf.h"
@@ -108,7 +99,8 @@
*
* \{ */
-/* Check if there are any active modifiers in stack (used for flushing updates at enter/exit sculpt mode) */
+/* Check if there are any active modifiers in stack
+ * (used for flushing updates at enter/exit sculpt mode) */
static bool sculpt_has_active_modifiers(Scene *scene, Object *ob)
{
ModifierData *md;
@@ -141,13 +133,22 @@ static bool sculpt_tool_is_proxy_used(const char sculpt_tool)
SCULPT_TOOL_LAYER);
}
+static bool sculpt_brush_use_topology_rake(
+ const SculptSession *ss, const Brush *brush)
+{
+ return SCULPT_TOOL_HAS_TOPOLOGY_RAKE(brush->sculpt_tool) &&
+ (brush->topology_rake_factor > 0.0f) &&
+ (ss->bm != NULL);
+}
+
/**
* Test whether the #StrokeCache.sculpt_normal needs update in #do_brush_action
*/
-static int sculpt_brush_needs_normal(const Brush *brush, float normal_weight)
+static int sculpt_brush_needs_normal(
+ const SculptSession *ss, const Brush *brush)
{
return ((SCULPT_TOOL_HAS_NORMAL_WEIGHT(brush->sculpt_tool) &&
- (normal_weight > 0.0f)) ||
+ (ss->cache->normal_weight > 0.0f)) ||
ELEM(brush->sculpt_tool,
SCULPT_TOOL_BLOB,
@@ -158,7 +159,8 @@ static int sculpt_brush_needs_normal(const Brush *brush, float normal_weight)
SCULPT_TOOL_ROTATE,
SCULPT_TOOL_THUMB) ||
- (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA));
+ (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)) ||
+ sculpt_brush_use_topology_rake(ss, brush);
}
/** \} */
@@ -170,7 +172,7 @@ static bool sculpt_brush_needs_rake_rotation(const Brush *brush)
typedef enum StrokeFlags {
CLIP_X = 1,
CLIP_Y = 2,
- CLIP_Z = 4
+ CLIP_Z = 4,
} StrokeFlags;
/************** Access to original unmodified vertex data *************/
@@ -721,7 +723,6 @@ static bool sculpt_brush_test_cyl(SculptBrushTest *test, float co[3], float loca
#endif
/* ===== Sculpting =====
- *
*/
static void flip_v3(float v[3], const char symm)
{
@@ -1597,6 +1598,94 @@ static void bmesh_neighbor_average(float avg[3], BMVert *v)
copy_v3_v3(avg, v->co);
}
+/* For bmesh: average only the four most aligned (parallel and perpendicular) edges
+ * relative to a direction. Naturally converges to a quad-like tesselation. */
+static void bmesh_four_neighbor_average(float avg[3], float direction[3], BMVert *v)
+{
+ /* Logic for 3 or more is identical. */
+ const int vfcount = BM_vert_face_count_at_most(v, 3);
+
+ /* Don't modify corner vertices. */
+ if (vfcount < 2) {
+ copy_v3_v3(avg, v->co);
+ return;
+ }
+
+ /* Project the direction to the vertex normal and create an additional
+ * parallel vector. */
+ float dir_a[3], dir_b[3];
+ cross_v3_v3v3(dir_a, direction, v->no);
+ cross_v3_v3v3(dir_b, dir_a, v->no);
+
+ /* The four vectors which will be used for smoothing.
+ * Occasionally less than 4 verts match the requirements in that case
+ * use 'v' as fallback. */
+ BMVert *pos_a = v;
+ BMVert *neg_a = v;
+ BMVert *pos_b = v;
+ BMVert *neg_b = v;
+
+ float pos_score_a = 0.0f;
+ float neg_score_a = 0.0f;
+ float pos_score_b = 0.0f;
+ float neg_score_b = 0.0f;
+
+ BMIter liter;
+ BMLoop *l;
+
+ BM_ITER_ELEM(l, &liter, v, BM_LOOPS_OF_VERT) {
+ BMVert *adj_v[2] = { l->prev->v, l->next->v };
+
+ for (int i = 0; i < ARRAY_SIZE(adj_v); i++) {
+ BMVert *v_other = adj_v[i];
+
+ if (vfcount != 2 || BM_vert_face_count_at_most(v_other, 2) <= 2) {
+ float vec[3];
+ sub_v3_v3v3(vec, v_other->co, v->co);
+ normalize_v3(vec);
+
+ /* The score is a measure of how orthogonal the edge is. */
+ float score = dot_v3v3(vec, dir_a);
+
+ if (score >= pos_score_a) {
+ pos_a = v_other;
+ pos_score_a = score;
+ }
+ else if (score < neg_score_a) {
+ neg_a = v_other;
+ neg_score_a = score;
+ }
+ /* The same scoring but for the perpendicular direction. */
+ score = dot_v3v3(vec, dir_b);
+
+ if (score >= pos_score_b) {
+ pos_b = v_other;
+ pos_score_b = score;
+ }
+ else if (score < neg_score_b) {
+ neg_b = v_other;
+ neg_score_b = score;
+ }
+ }
+ }
+ }
+
+ /* Average everything together. */
+ zero_v3(avg);
+ add_v3_v3(avg, pos_a->co);
+ add_v3_v3(avg, neg_a->co);
+ add_v3_v3(avg, pos_b->co);
+ add_v3_v3(avg, neg_b->co);
+ mul_v3_fl(avg, 0.25f);
+
+ /* Preserve volume. */
+ float vec[3];
+ sub_v3_v3(avg, v->co);
+ mul_v3_v3fl(vec, v->no, dot_v3v3(avg, v->no));
+ sub_v3_v3(avg, vec);
+ add_v3_v3(avg, v->co);
+}
+
/* Same logic as neighbor_average_mask(), but for bmesh rather than mesh */
static float bmesh_neighbor_average_mask(BMVert *v, const int cd_vert_mask_offset)
{
@@ -1643,7 +1732,7 @@ typedef struct {
const float *ray_start, *ray_normal;
bool hit;
float depth;
- float detail;
+ float edge_length;
} SculptDetailRaycastData;
typedef struct {
@@ -1755,6 +1844,62 @@ static void do_smooth_brush_bmesh_task_cb_ex(
BKE_pbvh_vertex_iter_end;
}
+static void do_topology_rake_bmesh_task_cb_ex(
+ void *__restrict userdata,
+ const int n,
+ const ParallelRangeTLS *__restrict tls)
+{
+ SculptThreadedTaskData *data = userdata;
+ SculptSession *ss = data->ob->sculpt;
+ Sculpt *sd = data->sd;
+ const Brush *brush = data->brush;
+
+ float direction[3];
+ copy_v3_v3(direction, ss->cache->grab_delta_symmetry);
+
+ float tmp[3];
+ mul_v3_v3fl(
+ tmp, ss->cache->sculpt_normal_symm,
+ dot_v3v3(ss->cache->sculpt_normal_symm, direction));
+ sub_v3_v3(direction, tmp);
+
+ /* Cancel if there's no grab data. */
+ if (is_zero_v3(direction)) {
+ return;
+ }
+
+ float bstrength = data->strength;
+ CLAMP(bstrength, 0.0f, 1.0f);
+
+ SculptBrushTest test;
+ SculptBrushTestFn sculpt_brush_test_sq_fn =
+ sculpt_brush_test_init_with_falloff_shape(ss, &test, data->brush->falloff_shape);
+
+ PBVHVertexIter vd;
+ BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
+ {
+ if (sculpt_brush_test_sq_fn(&test, vd.co)) {
+ const float fade = bstrength * tex_strength(
+ ss, brush, vd.co, sqrtf(test.dist),
+ vd.no, vd.fno, *vd.mask, tls->thread_id) * ss->cache->pressure;
+
+ float avg[3], val[3];
+
+ bmesh_four_neighbor_average(avg, direction, vd.bm_vert);
+
+ sub_v3_v3v3(val, avg, vd.co);
+
+ madd_v3_v3v3fl(val, vd.co, val, fade);
+
+ sculpt_clip(sd, ss, vd.co, val);
+
+ if (vd.mvert)
+ vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ }
+ }
+ BKE_pbvh_vertex_iter_end;
+}
+
static void do_smooth_brush_multires_task_cb_ex(
void *__restrict userdata,
const int n,
@@ -1981,6 +2126,37 @@ static void smooth(
}
}
+static void bmesh_topology_rake(
+ Sculpt *sd, Object *ob, PBVHNode **nodes, const int totnode, float bstrength)
+{
+ Brush *brush = BKE_paint_brush(&sd->paint);
+ CLAMP(bstrength, 0.0f, 1.0f);
+
+ /* Interactions increase both strength and quality. */
+ const int iterations = 3;
+
+ int iteration;
+ const int count = iterations * bstrength + 1;
+ const float factor = iterations * bstrength / count;
+
+ for (iteration = 0; iteration <= count; ++iteration) {
+
+ SculptThreadedTaskData data = {
+ .sd = sd, .ob = ob, .brush = brush, .nodes = nodes,
+ .strength = factor,
+ };
+ ParallelRangeSettings settings;
+ BLI_parallel_range_settings_defaults(&settings);
+ settings.use_threading = ((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_THREADED_LIMIT);
+
+ BLI_task_parallel_range(
+ 0, totnode,
+ &data,
+ do_topology_rake_bmesh_task_cb_ex,
+ &settings);
+ }
+}
+
static void do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
{
SculptSession *ss = ob->sculpt;
@@ -2458,7 +2634,8 @@ static void do_snake_hook_brush_task_cb_ex(
project_plane_v3_v3v3(delta_pinch, delta_pinch, ss->cache->true_view_normal);
}
- /* important to calculate based on the grabbed location (intentionally ignore fade here). */
+ /* important to calculate based on the grabbed location
+ * (intentionally ignore fade here). */
add_v3_v3(delta_pinch, grab_delta);
sculpt_project_v3(spvc, delta_pinch, delta_pinch);
@@ -3605,7 +3782,7 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
do_brush_action_task_cb,
&settings);
- if (sculpt_brush_needs_normal(brush, ss->cache->normal_weight))
+ if (sculpt_brush_needs_normal(ss, brush))
update_sculpt_normal(sd, ob, nodes, totnode);
if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)
@@ -3680,6 +3857,10 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
}
}
+ if (sculpt_brush_use_topology_rake(ss, brush)) {
+ bmesh_topology_rake(sd, ob, nodes, totnode, brush->topology_rake_factor);
+ }
+
if (ss->cache->supports_gravity)
do_gravity(sd, ob, nodes, totnode, sd->gravity_factor);
@@ -3914,7 +4095,7 @@ void sculpt_cache_calc_brushdata_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 0
- if (sd->paint.symmetry_flags & SCULPT_SYMMETRY_FEATHER) {
+ if (sd->paint.symmetry_flags & PAINT_SYMMETRY_FEATHER) {
float frac = 1.0f / max_overlap_count(sd);
float reduce = (feather - frac) / (1 - frac);
@@ -3960,7 +4141,8 @@ static void do_tiled(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings
const float *step = sd->paint.tile_offset;
int dim;
- /* These are integer locations, for real location: multiply with step and add orgLoc. So 0,0,0 is at orgLoc. */
+ /* These are integer locations, for real location: multiply with step and add orgLoc.
+ * So 0,0,0 is at orgLoc. */
int start[3];
int end[3];
int cur[3];
@@ -4230,12 +4412,12 @@ static void sculpt_update_cache_invariants(
else {
max_scale = 0.0f;
for (i = 0; i < 3; i ++) {
- max_scale = max_ff(max_scale, fabsf(ob->size[i]));
+ max_scale = max_ff(max_scale, fabsf(ob->scale[i]));
}
}
- cache->scale[0] = max_scale / ob->size[0];
- cache->scale[1] = max_scale / ob->size[1];
- cache->scale[2] = max_scale / ob->size[2];
+ cache->scale[0] = max_scale / ob->scale[0];
+ cache->scale[1] = max_scale / ob->scale[1];
+ cache->scale[2] = max_scale / ob->scale[2];
cache->plane_trim_squared = brush->plane_trim * brush->plane_trim;
@@ -4352,7 +4534,8 @@ static void sculpt_update_cache_invariants(
if (ss->bm) {
/* Free any remaining layer displacements from nodes. If not and topology changes
- * from using another tool, then next layer toolstroke can access past disp array bounds */
+ * from using another tool, then next layer toolstroke
+ * can access past disp array bounds */
BKE_pbvh_free_layer_disp(ss->pbvh);
}
}
@@ -4383,14 +4566,15 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
StrokeCache *cache = ss->cache;
const float mouse[2] = {
cache->mouse[0],
- cache->mouse[1]
+ cache->mouse[1],
};
int tool = brush->sculpt_tool;
if (ELEM(tool,
SCULPT_TOOL_GRAB, SCULPT_TOOL_NUDGE,
SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_SNAKE_HOOK,
- SCULPT_TOOL_THUMB))
+ SCULPT_TOOL_THUMB) ||
+ sculpt_brush_use_topology_rake(ss, brush))
{
float grab_location[3], imat[4][4], delta[3], loc[3];
@@ -4430,6 +4614,11 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
invert_m4_m4(imat, ob->obmat);
mul_mat3_m4_v3(imat, cache->grab_delta);
break;
+ default:
+ /* Use for 'Brush.topology_rake_factor'. */
+ sub_v3_v3v3(cache->grab_delta, grab_location, cache->old_grab_location);
+ break;
+
}
}
else {
@@ -4680,7 +4869,7 @@ static void sculpt_raycast_detail_cb(PBVHNode *node, void *data_v, float *tmin)
if (BKE_pbvh_node_get_tmin(node) < *tmin) {
SculptDetailRaycastData *srd = data_v;
if (BKE_pbvh_bmesh_node_raycast_detail(node, srd->ray_start, srd->ray_normal,
- &srd->depth, &srd->detail))
+ &srd->depth, &srd->edge_length))
{
srd->hit = 1;
*tmin = srd->depth;
@@ -4805,8 +4994,10 @@ 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)
- ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */
+ if (mtex->tex && mtex->tex->nodetree) {
+ /* has internal flag to detect it only does it once */
+ ntreeTexBeginExecTree(mtex->tex->nodetree);
+ }
/* TODO: Shouldn't really have to do this at the start of every
* stroke, but sculpt would need some sort of notification when
@@ -4855,11 +5046,11 @@ static void sculpt_restore_mesh(Sculpt *sd, Object *ob)
/* Copy the PBVH bounding box into the object's bounding box */
void sculpt_update_object_bounding_box(Object *ob)
{
- if (ob->bb) {
+ if (ob->runtime.bb) {
float bb_min[3], bb_max[3];
BKE_pbvh_bounding_box(ob->sculpt->pbvh, bb_min, bb_max);
- BKE_boundbox_init_from_minmax(ob->bb, bb_min, bb_max);
+ BKE_boundbox_init_from_minmax(ob->runtime.bb, bb_min, bb_max);
}
}
@@ -4932,7 +5123,8 @@ static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op,
{
/* Don't start the stroke until mouse goes over the mesh.
* note: mouse will only be null when re-executing the saved stroke.
- * We have exception for 'exec' strokes since they may not set 'mouse', only 'location', see: T52195. */
+ * We have exception for 'exec' strokes since they may not set 'mouse',
+ * only 'location', see: T52195. */
if (((op->flag & OP_IS_INVOKE) == 0) ||
(mouse == NULL) || over_mesh(C, op, mouse[0], mouse[1]))
{
@@ -4965,7 +5157,8 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *UNUSED(st
sculpt_restore_mesh(sd, ob);
if (sd->flags & (SCULPT_DYNTOPO_DETAIL_CONSTANT | SCULPT_DYNTOPO_DETAIL_MANUAL)) {
- BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / sd->constant_detail);
+ float object_space_constant_detail = 1.0f / (sd->constant_detail * mat4_to_scale(ob->obmat));
+ BKE_pbvh_bmesh_detail_size_set(ss->pbvh, object_space_constant_detail);
}
else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) {
BKE_pbvh_bmesh_detail_size_set(ss->pbvh, ss->cache->radius * sd->detail_percent / 100.0f);
@@ -5177,7 +5370,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
"Clicks on the background do not start the stroke");
}
-/**** Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) ****/
+/* Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) */
static int sculpt_set_persistent_base_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -5339,13 +5532,13 @@ void sculpt_dynamic_topology_disable_ex(
me->totpoly = unode->bm_enter_totpoly;
me->totedge = unode->bm_enter_totedge;
me->totface = 0;
- CustomData_copy(&unode->bm_enter_vdata, &me->vdata, CD_MASK_MESH,
+ CustomData_copy(&unode->bm_enter_vdata, &me->vdata, CD_MASK_MESH.vmask,
CD_DUPLICATE, unode->bm_enter_totvert);
- CustomData_copy(&unode->bm_enter_edata, &me->edata, CD_MASK_MESH,
+ CustomData_copy(&unode->bm_enter_edata, &me->edata, CD_MASK_MESH.emask,
CD_DUPLICATE, unode->bm_enter_totedge);
- CustomData_copy(&unode->bm_enter_ldata, &me->ldata, CD_MASK_MESH,
+ CustomData_copy(&unode->bm_enter_ldata, &me->ldata, CD_MASK_MESH.lmask,
CD_DUPLICATE, unode->bm_enter_totloop);
- CustomData_copy(&unode->bm_enter_pdata, &me->pdata, CD_MASK_MESH,
+ CustomData_copy(&unode->bm_enter_pdata, &me->pdata, CD_MASK_MESH.pmask,
CD_DUPLICATE, unode->bm_enter_totpoly);
BKE_mesh_update_customdata_pointers(me, false);
@@ -5367,6 +5560,9 @@ void sculpt_dynamic_topology_disable_ex(
ss->bm_log = NULL;
}
+ BKE_particlesystem_reset_all(ob);
+ BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED);
+
/* Refresh */
sculpt_update_after_dynamic_topology_toggle(depsgraph, scene, ob);
}
@@ -5593,7 +5789,7 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *UNUSED(op))
BM_mesh_toolflags_set(ss->bm, true);
/* Symmetrize and re-triangulate */
- BMO_op_callf(ss->bm, BMO_FLAG_DEFAULTS,
+ BMO_op_callf(ss->bm, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"symmetrize input=%avef direction=%i dist=%f",
sd->symmetrize_direction, 0.00001f);
sculpt_dynamic_topology_triangulate(ss->bm);
@@ -5650,7 +5846,7 @@ static int ed_object_sculptmode_flush_recalc_flag(Scene *scene, Object *ob, Mult
void ED_object_sculptmode_enter_ex(
Main *bmain, Depsgraph *depsgraph,
- Scene *scene, Object *ob,
+ Scene *scene, Object *ob, const bool force_dyntopo,
ReportList *reports)
{
const int mode_flag = OB_MODE_SCULPT;
@@ -5685,7 +5881,7 @@ void ED_object_sculptmode_enter_ex(
BKE_sculpt_mask_layers_ensure(ob, mmd);
}
- if (!(fabsf(ob->size[0] - ob->size[1]) < 1e-4f && fabsf(ob->size[1] - ob->size[2]) < 1e-4f)) {
+ if (!(fabsf(ob->scale[0] - ob->scale[1]) < 1e-4f && fabsf(ob->scale[1] - ob->scale[2]) < 1e-4f)) {
BKE_report(reports, RPT_WARNING,
"Object has non-uniform scale, sculpting may be unpredictable");
}
@@ -5731,11 +5927,19 @@ void ED_object_sculptmode_enter_ex(
}
}
- if (message_unsupported == NULL) {
+ if ((message_unsupported == NULL) || force_dyntopo) {
+ /* Needed because we may be entering this mode before the undo system loads. */
+ wmWindowManager *wm = bmain->wm.first;
+ bool has_undo = wm->undo_stack != NULL;
/* undo push is needed to prevent memory leak */
- sculpt_undo_push_begin("Dynamic topology enable");
+ if (has_undo) {
+ sculpt_undo_push_begin("Dynamic topology enable");
+ }
sculpt_dynamic_topology_enable_ex(depsgraph, scene, ob);
- sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN);
+ if (has_undo) {
+ sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN);
+ sculpt_undo_push_end();
+ }
}
else {
BKE_reportf(reports, RPT_WARNING,
@@ -5756,7 +5960,7 @@ void ED_object_sculptmode_enter(struct bContext *C, ReportList *reports)
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
- ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, reports);
+ ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, reports);
}
void ED_object_sculptmode_exit_ex(
@@ -5838,7 +6042,7 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
ED_object_sculptmode_exit_ex(depsgraph, scene, ob);
}
else {
- ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, op->reports);
+ ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, op->reports);
BKE_paint_toolslots_brush_validate(bmain, &ts->sculpt->paint);
}
@@ -5900,7 +6104,8 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *UNUSED(op))
size = max_fff(dim[0], dim[1], dim[2]);
/* update topology size */
- BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / sd->constant_detail);
+ float object_space_constant_detail = 1.0f / (sd->constant_detail * mat4_to_scale(ob->obmat));
+ BKE_pbvh_bmesh_detail_size_set(ss->pbvh, object_space_constant_detail);
sculpt_undo_push_begin("Dynamic topology flood fill");
sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_COORDS);
@@ -5973,14 +6178,14 @@ static void sample_detail(bContext *C, int mx, int my)
srd.ray_start = ray_start;
srd.ray_normal = ray_normal;
srd.depth = depth;
- srd.detail = sd->constant_detail;
+ srd.edge_length = 0.0f;
BKE_pbvh_raycast(ob->sculpt->pbvh, sculpt_raycast_detail_cb, &srd,
ray_start, ray_normal, false);
- if (srd.hit) {
- /* convert edge length to detail resolution */
- sd->constant_detail = 1.0f / srd.detail;
+ if (srd.hit && srd.edge_length > 0.0f) {
+ /* Convert edge length to world space detail resolution. */
+ sd->constant_detail = 1 / (srd.edge_length * mat4_to_scale(ob->obmat));
}
/* Restore context. */
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 4e2ecc210f4..44ed680a916 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sculpt_paint/sculpt_intern.h
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
@@ -42,11 +34,11 @@
#include "BKE_pbvh.h"
-struct bContext;
struct KeyBlock;
struct Object;
-struct SculptUndoNode;
struct SculptOrigVertData;
+struct SculptUndoNode;
+struct bContext;
bool sculpt_mode_poll(struct bContext *C);
bool sculpt_mode_poll_view3d(struct bContext *C);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 090bc335d66..8c934b6a16a 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,11 @@
*
* The Original Code is Copyright (C) 2006 by Nicholas Bishop
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* Implements the Sculpt Mode tools
- *
*/
-/** \file blender/editors/sculpt_paint/sculpt_undo.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
#include <stddef.h>
@@ -59,9 +49,12 @@
#include "BKE_key.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
+#include "BKE_scene.h"
#include "BKE_subsurf.h"
#include "BKE_subdiv_ccg.h"
#include "BKE_undo_system.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
#include "DEG_depsgraph.h"
@@ -852,13 +845,13 @@ static SculptUndoNode *sculpt_undo_bmesh_push(Object *ob,
* dynamic-topology immediately does topological edits
* (converting polys to triangles) that the BMLog can't
* fully restore from */
- CustomData_copy(&me->vdata, &unode->bm_enter_vdata, CD_MASK_MESH,
+ CustomData_copy(&me->vdata, &unode->bm_enter_vdata, CD_MASK_MESH.vmask,
CD_DUPLICATE, me->totvert);
- CustomData_copy(&me->edata, &unode->bm_enter_edata, CD_MASK_MESH,
+ CustomData_copy(&me->edata, &unode->bm_enter_edata, CD_MASK_MESH.emask,
CD_DUPLICATE, me->totedge);
- CustomData_copy(&me->ldata, &unode->bm_enter_ldata, CD_MASK_MESH,
+ CustomData_copy(&me->ldata, &unode->bm_enter_ldata, CD_MASK_MESH.lmask,
CD_DUPLICATE, me->totloop);
- CustomData_copy(&me->pdata, &unode->bm_enter_pdata, CD_MASK_MESH,
+ CustomData_copy(&me->pdata, &unode->bm_enter_pdata, CD_MASK_MESH.pmask,
CD_DUPLICATE, me->totpoly);
unode->bm_enter_totvert = me->totvert;
unode->bm_enter_totedge = me->totedge;
@@ -1009,8 +1002,12 @@ void sculpt_undo_push_end(void)
BKE_pbvh_node_layer_disp_free(unode->node);
}
- UndoStack *ustack = ED_undo_stack_get();
- BKE_undosys_step_push(ustack, NULL, NULL);
+ /* We could remove this and enforce all callers run in an operator using 'OPTYPE_UNDO'. */
+ wmWindowManager *wm = G_MAIN->wm.first;
+ if (wm->op_undo_depth == 0) {
+ UndoStack *ustack = ED_undo_stack_get();
+ BKE_undosys_step_push(ustack, NULL, NULL);
+ }
}
/* -------------------------------------------------------------------- */
@@ -1025,10 +1022,8 @@ typedef struct SculptUndoStep {
static bool sculpt_undosys_poll(bContext *C)
{
- ScrArea *sa = CTX_wm_area(C);
- if (sa && (sa->spacetype == SPACE_VIEW3D)) {
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *obact = OBACT(view_layer);
+ Object *obact = CTX_data_active_object(C);
+ if (obact && obact->type == OB_MESH) {
if (obact && (obact->mode & OB_MODE_SCULPT)) {
return true;
}
@@ -1043,23 +1038,105 @@ static void sculpt_undosys_step_encode_init(struct bContext *UNUSED(C), UndoStep
BLI_listbase_clear(&us->data.nodes);
}
-static bool sculpt_undosys_step_encode(struct bContext *UNUSED(C), UndoStep *us_p)
+static bool sculpt_undosys_step_encode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p)
{
/* dummy, encoding is done along the way by adding tiles
* to the current 'SculptUndoStep' added by encode_init. */
SculptUndoStep *us = (SculptUndoStep *)us_p;
us->step.data_size = us->data.undo_size;
+
+ SculptUndoNode *unode = us->data.nodes.last;
+ if (unode && unode->type == SCULPT_UNDO_DYNTOPO_END) {
+ us->step.use_memfile_step = true;
+ }
+ us->step.is_applied = true;
return true;
}
-static void sculpt_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void sculpt_undosys_step_decode_undo_impl(struct bContext *C, SculptUndoStep *us)
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_SCULPT);
- BLI_assert(sculpt_undosys_poll(C));
+ BLI_assert(us->step.is_applied == true);
+ sculpt_undo_restore_list(C, &us->data.nodes);
+ us->step.is_applied = false;
+}
- SculptUndoStep *us = (SculptUndoStep *)us_p;
+static void sculpt_undosys_step_decode_redo_impl(struct bContext *C, SculptUndoStep *us)
+{
+ BLI_assert(us->step.is_applied == false);
sculpt_undo_restore_list(C, &us->data.nodes);
+ us->step.is_applied = true;
+}
+
+static void sculpt_undosys_step_decode_undo(struct bContext *C, SculptUndoStep *us)
+{
+ SculptUndoStep *us_iter = us;
+ while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) {
+ if (us_iter->step.next->is_applied == false) {
+ break;
+ }
+ us_iter = (SculptUndoStep *)us_iter->step.next;
+ }
+ while (us_iter != us) {
+ sculpt_undosys_step_decode_undo_impl(C, us_iter);
+ us_iter = (SculptUndoStep *)us_iter->step.prev;
+ }
+}
+
+static void sculpt_undosys_step_decode_redo(struct bContext *C, SculptUndoStep *us)
+{
+ SculptUndoStep *us_iter = us;
+ while (us_iter->step.prev && (us_iter->step.prev->type == us_iter->step.type)) {
+ if (us_iter->step.prev->is_applied == true) {
+ break;
+ }
+ us_iter = (SculptUndoStep *)us_iter->step.prev;
+ }
+ while (us_iter && (us_iter->step.is_applied == false)) {
+ sculpt_undosys_step_decode_redo_impl(C, us_iter);
+ if (us_iter == us) {
+ break;
+ }
+ us_iter = (SculptUndoStep *)us_iter->step.next;
+ }
+}
+
+static void sculpt_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir)
+{
+ /* Ensure sculpt mode. */
+ {
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ /* Sculpt needs evaluated state. */
+ BKE_scene_view_layer_graph_evaluated_ensure(bmain, scene, view_layer);
+ Object *ob = OBACT(view_layer);
+ if (ob && (ob->type == OB_MESH)) {
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ if (ob->mode & OB_MODE_SCULPT) {
+ /* pass */
+ }
+ else {
+ ED_object_mode_generic_exit(bmain, depsgraph, scene, ob);
+ Mesh *me = ob->data;
+ /* Don't add sculpt topology undo steps when reading back undo state.
+ * The undo steps must enter/exit for us. */
+ me->flag &= ~ME_SCULPT_DYNAMIC_TOPOLOGY;
+ ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, NULL);
+ }
+ BLI_assert(sculpt_undosys_poll(C));
+ }
+ else {
+ BLI_assert(0);
+ return;
+ }
+ }
+
+ SculptUndoStep *us = (SculptUndoStep *)us_p;
+ if (dir < 0) {
+ sculpt_undosys_step_decode_undo(C, us);
+ }
+ else {
+ sculpt_undosys_step_decode_redo(C, us);
+ }
}
static void sculpt_undosys_step_free(UndoStep *us_p)
@@ -1078,7 +1155,6 @@ void ED_sculpt_undosys_type(UndoType *ut)
ut->step_decode = sculpt_undosys_step_decode;
ut->step_free = sculpt_undosys_step_free;
- ut->mode = BKE_UNDOTYPE_MODE_ACCUMULATE;
ut->use_context = true;
ut->step_size = sizeof(SculptUndoStep);
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 7fa7c7f37b5..dde09bb0f45 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) Blender Foundation, 2002-2009
* All rights reserved.
- *
- * Contributor(s): Antony Riakiotakis
- *
- * ***** END GPL LICENSE BLOCK *****
- *
* UV Sculpt tools
- *
*/
-/** \file blender/editors/sculpt_paint/sculpt_uv.c
- * \ingroup edsculpt
+/** \file
+ * \ingroup edsculpt
*/
@@ -86,7 +78,8 @@ typedef struct UvAdjacencyElement {
typedef struct UvEdge {
unsigned int uv1;
unsigned int uv2;
- /* general use flag (Used to check if edge is boundary here, and propagates to adjacency elements) */
+ /* general use flag
+ * (Used to check if edge is boundary here, and propagates to adjacency elements) */
char flag;
} UvEdge;
@@ -745,7 +738,8 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
edges[counter].uv1 = offset2;
edges[counter].uv2 = offset1;
}
- /* Hack! Set the value of the key to its flag. Now we can set the flag when an edge exists twice :) */
+ /* Hack! Set the value of the key to its flag.
+ * Now we can set the flag when an edge exists twice :) */
flag = BLI_ghash_lookup(edgeHash, &edges[counter]);
if (flag) {
*flag = 1;
@@ -908,10 +902,10 @@ static int uv_sculpt_stroke_modal(bContext *C, wmOperator *op, const wmEvent *ev
void SCULPT_OT_uv_sculpt_stroke(wmOperatorType *ot)
{
static const EnumPropertyItem stroke_mode_items[] = {
- {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally"},
+ {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Regular", "Apply brush normally"},
{BRUSH_STROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke"},
{BRUSH_STROKE_SMOOTH, "RELAX", 0, "Relax", "Switch brush to relax mode for duration of stroke"},
- {0}
+ {0},
};
/* identifiers */
diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt
index 9efdf11e8d7..67ec2359c5e 100644
--- a/source/blender/editors/sound/CMakeLists.txt
+++ b/source/blender/editors/sound/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/sound/sound_intern.h b/source/blender/editors/sound/sound_intern.h
index d95f473e4d9..f648c639eca 100644
--- a/source/blender/editors/sound/sound_intern.h
+++ b/source/blender/editors/sound/sound_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sound/sound_intern.h
- * \ingroup edsnd
+/** \file
+ * \ingroup edsnd
*/
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 3ce4965b284..8c6970eba77 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/sound/sound_ops.c
- * \ingroup edsnd
+/** \file
+ * \ingroup edsnd
*/
@@ -108,7 +101,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
if (sound->playback_handle == NULL) {
if (op->customdata) MEM_freeN(op->customdata);
- BKE_libblock_free(bmain, sound);
+ BKE_id_free(bmain, sound);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
}
@@ -116,7 +109,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
info = AUD_getInfo(sound->playback_handle);
if (info.specs.channels == AUD_CHANNELS_INVALID) {
- BKE_libblock_free(bmain, sound);
+ BKE_id_free(bmain, sound);
if (op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
@@ -409,7 +402,7 @@ static const EnumPropertyItem container_items[] = {
#endif
{AUD_CONTAINER_OGG, "OGG", 0, "ogg", "Xiph.Org Ogg Container"},
{AUD_CONTAINER_WAV, "WAV", 0, "wav", "Waveform Audio File Format"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const char *snd_ext_sound[] = {
@@ -420,7 +413,7 @@ static const char *snd_ext_sound[] = {
".mp3",
".ogg",
".wav",
- NULL
+ NULL,
};
static bool sound_mixdown_check(bContext *UNUSED(C), wmOperator *op)
@@ -500,20 +493,20 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op)
{AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"},
{AUD_FORMAT_FLOAT32, "F32", 0, "F32", "32 bit floating point"},
{AUD_FORMAT_FLOAT64, "F64", 0, "F64", "64 bit floating point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem mp3_format_items[] = {
{AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"},
{AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef WITH_SNDFILE
static const EnumPropertyItem flac_format_items[] = {
{AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"},
{AUD_FORMAT_S24, "S24", 0, "S24", "24 bit signed"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -525,13 +518,13 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op)
{AUD_CODEC_MP3, "MP3", 0, "MP3", "MPEG-2 Audio Layer III"},
{AUD_CODEC_PCM, "PCM", 0, "PCM", "Pulse Code Modulation (RAW)"},
{AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem ogg_codec_items[] = {
{AUD_CODEC_FLAC, "FLAC", 0, "FLAC", "Free Lossless Audio Codec"},
{AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
uiLayout *layout = op->layout;
@@ -648,7 +641,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
{AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"},
{AUD_FORMAT_FLOAT32, "F32", 0, "F32", "32 bit floating point"},
{AUD_FORMAT_FLOAT64, "F64", 0, "F64", "64 bit floating point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem codec_items[] = {
@@ -663,7 +656,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
#endif
{AUD_CODEC_PCM, "PCM", 0, "PCM", "Pulse Code Modulation (RAW)"},
{AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif // WITH_AUDASPACE
@@ -760,13 +753,13 @@ static int sound_unpack_exec(bContext *C, wmOperator *op)
if (RNA_struct_property_is_set(op->ptr, "id")) {
char sndname[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "id", sndname);
- sound = BLI_findstring(&bmain->sound, sndname, offsetof(ID, name) + 2);
+ sound = BLI_findstring(&bmain->sounds, sndname, offsetof(ID, name) + 2);
}
if (!sound || !sound->packedfile)
return OPERATOR_CANCELLED;
- if (G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_FILE_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
unpackSound(bmain, op->reports, sound, method);
@@ -790,7 +783,7 @@ static int sound_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
if (!sound || !sound->packedfile)
return OPERATOR_CANCELLED;
- if (G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_FILE_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);
@@ -815,7 +808,8 @@ static void SOUND_OT_unpack(wmOperatorType *ot)
/* properties */
RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack");
- RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound data-block name to unpack"); /* XXX, weark!, will fail with library, name collisions */
+ /* XXX, weark!, will fail with library, name collisions */
+ RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Sound Name", "Sound data-block name to unpack");
}
/* ******************************************************* */
diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt
index 24c3ee9cd3d..92cf40248ff 100644
--- a/source/blender/editors/space_action/CMakeLists.txt
+++ b/source/blender/editors/space_action/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_action/action_buttons.c b/source/blender/editors/space_action/action_buttons.c
index 55ad773f4df..eaeeca6dfd1 100644
--- a/source/blender/editors/space_action/action_buttons.c
+++ b/source/blender/editors/space_action/action_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_buttons.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
@@ -40,8 +33,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c
index fa5a13a81b6..8ecf32a2c6c 100644
--- a/source/blender/editors/space_action/action_data.c
+++ b/source/blender/editors/space_action/action_data.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_data.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
@@ -34,8 +28,6 @@
#include <float.h>
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
@@ -867,7 +859,8 @@ static bool action_layer_prev_poll(bContext *C)
AnimData *adt = ED_actedit_animdata_from_context(C);
if (adt) {
if (adt->flag & ADT_NLA_EDIT_ON) {
- /* Tweak Mode: We need to check if there are any tracks below the active one that we can move to */
+ /* Tweak Mode: We need to check if there are any tracks below the active one
+ * that we can move to */
if (adt->nla_tracks.first) {
NlaTrack *nlt = (NlaTrack *)adt->nla_tracks.first;
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 738c5e4d2e2..68d4e4f8ef0 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_draw.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
@@ -55,7 +47,6 @@
/* Everything from source (BIF, BDR, BSE) ------------------------------ */
-#include "BIF_gl.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index e960c32cf0c..b0cc1b72b27 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_edit.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
@@ -324,7 +316,8 @@ static bool actkeys_channels_get_selected_extents(bAnimContext *ac, float *min,
bAnimListElem *ale;
int filter;
- short found = 0; /* NOTE: not bool, since we want prioritise individual channels over expanders */
+ /* NOTE: not bool, since we want prioritise individual channels over expanders */
+ short found = 0;
float y;
/* get all items - we need to do it this way */
@@ -544,8 +537,9 @@ static short paste_action_keys(bAnimContext *ac,
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
- if (ANIM_animdata_filter(ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, ac->datatype) == 0)
+ if (ANIM_animdata_filter(ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, ac->datatype) == 0) {
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+ }
/* paste keyframes */
ok = paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode, flip);
@@ -673,7 +667,7 @@ static const EnumPropertyItem prop_actkeys_insertkey_types[] = {
{1, "ALL", 0, "All Channels", ""},
{2, "SEL", 0, "Only Selected Channels", ""},
{3, "GROUP", 0, "In Active Group", ""}, /* XXX not in all cases */
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for inserting new keyframes */
@@ -692,8 +686,12 @@ static void insert_action_keys(bAnimContext *ac, short mode)
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
- if (mode == 2) filter |= ANIMFILTER_SEL;
- else if (mode == 3) filter |= ANIMFILTER_ACTGROUPED;
+ if (mode == 2) {
+ filter |= ANIMFILTER_SEL;
+ }
+ else if (mode == 3) {
+ filter |= ANIMFILTER_ACTGROUPED;
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -831,10 +829,12 @@ static void duplicate_action_keys(bAnimContext *ac)
int filter;
/* filter data */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */
@@ -899,10 +899,12 @@ static bool delete_action_keys(bAnimContext *ac)
bool changed_final = false;
/* filter data */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */
@@ -1129,7 +1131,7 @@ static const EnumPropertyItem prop_actkeys_expo_types[] = {
{MAKE_CYCLIC_EXPO, "MAKE_CYCLIC", 0, "Make Cyclic (F-Modifier)", "Add Cycles F-Modifier if one doesn't exist already"},
{CLEAR_CYCLIC_EXPO, "CLEAR_CYCLIC", 0, "Clear Cyclic (F-Modifier)", "Remove Cycles F-Modifier if not needed anymore"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for setting extrapolation mode for keyframes */
@@ -1572,7 +1574,7 @@ static const EnumPropertyItem prop_actkeys_snap_types[] = {
"Snap selected keyframes to the nearest second"},
{ACTKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker",
"Snap selected keyframes to the nearest marker"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for snapping keyframes to frame-times */
@@ -1586,10 +1588,12 @@ static void snap_action_keys(bAnimContext *ac, short mode)
KeyframeEditFunc edit_cb;
/* filter data */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get beztriple editing callbacks */
@@ -1679,7 +1683,7 @@ static const EnumPropertyItem prop_actkeys_mirror_types[] = {
"Flip values of selected keyframes (i.e. negative values become positive, and vice versa)"},
{ACTKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker",
"Flip times of selected keyframes using the first selected marker as the reference point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for mirroring keyframes */
@@ -1709,10 +1713,12 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
}
/* filter data */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* mirror keyframes */
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index 986afe96e11..74da8aafcc8 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,24 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_intern.h
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
#ifndef __ACTION_INTERN_H__
#define __ACTION_INTERN_H__
-struct bContext;
-struct bAnimContext;
-struct Scene;
-struct Object;
-struct SpaceAction;
-struct ScrArea;
struct ARegion;
struct ARegionType;
+struct Object;
+struct Scene;
+struct ScrArea;
+struct SpaceAction;
struct View2D;
+struct bAnimContext;
+struct bContext;
struct wmOperatorType;
/* internal exports only */
@@ -77,7 +70,7 @@ void ACTION_OT_clickselect(struct wmOperatorType *ot);
enum eActKeys_LeftRightSelect_Mode {
ACTKEYS_LRSEL_TEST = 0,
ACTKEYS_LRSEL_LEFT,
- ACTKEYS_LRSEL_RIGHT
+ ACTKEYS_LRSEL_RIGHT,
};
/* defines for column-select mode */
diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c
index bbcba93370d..87b9ee4e1ef 100644
--- a/source/blender/editors/space_action/action_ops.c
+++ b/source/blender/editors/space_action/action_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_ops.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 0c96560f6d5..872f889e8b4 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/action_select.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
@@ -96,10 +90,12 @@ static void deselect_action_keys(bAnimContext *ac, short test, short sel)
KeyframeEditFunc test_cb, sel_cb;
/* determine type-based settings */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
/* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -310,11 +306,15 @@ static void box_select_action(bAnimContext *ac, const rcti rect, short mode, sho
break;
}
case ANIMTYPE_MASKLAYER:
+ {
ED_masklayer_frames_select_box(ale->data, rectf.xmin, rectf.xmax, selectmode);
break;
+ }
default:
+ {
ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL);
break;
+ }
}
}
@@ -333,29 +333,22 @@ static int actkeys_box_select_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
rcti rect;
- short mode = 0, selectmode = 0;
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
+ short mode = 0;
/* get editor data */
- if (ANIM_animdata_get_context(C, &ac) == 0)
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
+ }
- /* clear all selection if not extending selection */
- if (!extend) {
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const int selectmode = (sel_op != SEL_OP_SUB) ? SELECT_ADD : SELECT_SUBTRACT;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
deselect_action_keys(&ac, 1, SELECT_SUBTRACT);
}
/* get settings from operator */
WM_operator_properties_border_to_rcti(op, &rect);
- if (select) {
- selectmode = SELECT_ADD;
- }
- else {
- selectmode = SELECT_SUBTRACT;
- }
-
/* selection 'mode' depends on whether box_select region only matters on one axis */
if (RNA_boolean_get(op->ptr, "axis_range")) {
/* mode depends on which axis of the range is larger to determine which axis to use
@@ -399,9 +392,11 @@ void ACTION_OT_select_box(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* rna */
- WM_operator_properties_gesture_box_select(ot);
-
ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+
+ /* properties */
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/* ******************** Region Select Operators ***************************** */
@@ -547,9 +542,6 @@ static int actkeys_lassoselect_exec(bContext *C, wmOperator *op)
rcti rect;
rctf rect_fl;
- short selectmode;
- bool extend;
-
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
@@ -559,15 +551,11 @@ static int actkeys_lassoselect_exec(bContext *C, wmOperator *op)
if (data_lasso.mcords == NULL)
return OPERATOR_CANCELLED;
- /* clear all selection if not extending selection */
- extend = RNA_boolean_get(op->ptr, "extend");
- if (!extend)
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const int selectmode = (sel_op != SEL_OP_SUB) ? SELECT_ADD : SELECT_SUBTRACT;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
deselect_action_keys(&ac, 1, SELECT_SUBTRACT);
-
- if (!RNA_boolean_get(op->ptr, "deselect"))
- selectmode = SELECT_ADD;
- else
- selectmode = SELECT_SUBTRACT;
+ }
/* get settings from operator */
BLI_lasso_boundbox(&rect, data_lasso.mcords, data_lasso.mcords_tot);
@@ -602,7 +590,8 @@ void ACTION_OT_select_lasso(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_lasso_select(ot);
+ WM_operator_properties_gesture_lasso(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/* ------------------- */
@@ -610,8 +599,6 @@ void ACTION_OT_select_lasso(wmOperatorType *ot)
static int action_circle_select_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const short selectmode = select ? SELECT_ADD : SELECT_SUBTRACT;
KeyframeEdit_CircleData data = {0};
rctf rect_fl;
@@ -624,6 +611,13 @@ static int action_circle_select_exec(bContext *C, wmOperator *op)
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
+ const eSelectOp sel_op = ED_select_op_modal(
+ RNA_enum_get(op->ptr, "mode"), WM_gesture_is_modal_first(op->customdata));
+ const short selectmode = (sel_op != SEL_OP_SUB) ? SELECT_ADD : SELECT_SUBTRACT;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ deselect_action_keys(&ac, 0, SELECT_SUBTRACT);
+ }
+
data.mval[0] = x;
data.mval[1] = y;
data.radius_squared = radius * radius;
@@ -659,7 +653,8 @@ void ACTION_OT_select_circle(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_circle_select(ot);
+ WM_operator_properties_gesture_circle(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/* ******************** Column Select Operator **************************** */
@@ -676,7 +671,7 @@ static const EnumPropertyItem prop_column_select_types[] = {
{ACTKEYS_COLUMNSEL_CFRA, "CFRA", 0, "On Current Frame", ""},
{ACTKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", 0, "On Selected Markers", ""},
{ACTKEYS_COLUMNSEL_MARKERS_BETWEEN, "MARKERS_BETWEEN", 0, "Between Min/Max Selected Markers", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* ------------------- */
@@ -1049,7 +1044,7 @@ static const EnumPropertyItem prop_actkeys_leftright_select_types[] = {
{ACTKEYS_LRSEL_TEST, "CHECK", 0, "Check if Select Left or Right", ""},
{ACTKEYS_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""},
{ACTKEYS_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* --------------------------------- */
@@ -1088,10 +1083,12 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se
}
/* filter data */
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys */
@@ -1288,7 +1285,8 @@ static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short s
}
}
-/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
+/* Option 2) Selects all the keyframes on either side of the current frame
+ * (depends on which side the mouse is on) */
/* (see actkeys_select_leftright) */
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
@@ -1308,10 +1306,12 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
- if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
- else
+ }
+ else {
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
+ }
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
@@ -1418,8 +1418,11 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_
/* x-range to check is +/- 7px for standard keyframe under standard dpi/y-scale (in screen/region-space),
* on either side of mouse click (size of keyframe icon)
*/
- key_hsize = ACHANNEL_HEIGHT(ac) * 0.8f; /* standard channel height (to allow for some slop) */
- key_hsize = roundf(key_hsize / 2.0f); /* half-size (for either side), but rounded up to nearest int (for easier targeting) */
+
+ /* standard channel height (to allow for some slop) */
+ key_hsize = ACHANNEL_HEIGHT(ac) * 0.8f;
+ /* half-size (for either side), but rounded up to nearest int (for easier targeting) */
+ key_hsize = roundf(key_hsize / 2.0f);
UI_view2d_region_to_view(v2d, mval[0] - (int)key_hsize, mval[1], &rectf.xmin, &rectf.ymin);
UI_view2d_region_to_view(v2d, mval[0] + (int)key_hsize, mval[1], &rectf.xmax, &rectf.ymax);
@@ -1492,7 +1495,8 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_
mask_to_keylist(ads, masklay, &anim_keys);
}
- /* start from keyframe at root of BST, traversing until we find one within the range that was clicked on */
+ /* start from keyframe at root of BST,
+ * traversing until we find one within the range that was clicked on */
for (ak = anim_keys.root; ak; ak = akn) {
if (IN_RANGE(ak->cfra, rectf.xmin, rectf.xmax)) {
/* set the frame to use, and apply inverse-correction for NLA-mapping
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index b41b97923e2..3dffa6afb55 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_action/space_action.c
- * \ingroup spaction
+/** \file
+ * \ingroup spaction
*/
-
#include <string.h>
#include <stdio.h>
@@ -40,7 +32,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -54,8 +45,6 @@
#include "WM_types.h"
#include "WM_message.h"
-#include "BIF_gl.h"
-
#include "UI_resources.h"
#include "UI_view2d.h"
@@ -254,6 +243,7 @@ static void action_main_region_draw(const bContext *C, ARegion *ar)
UI_view2d_view_orthoSpecial(ar, v2d, 1);
marker_flag = ((ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0) | DRAW_MARKERS_MARGIN;
+ if (saction->flag & SACTION_SHOW_MARKER_LINES) marker_flag |= DRAW_MARKERS_LINES;
ED_markers_draw(C, marker_flag);
/* caches */
@@ -552,7 +542,8 @@ static void action_listener(
saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
ED_area_tag_refresh(sa);
}
- /* autocolor only really needs to change when channels are added/removed, or previously hidden stuff appears
+ /* autocolor only really needs to change when channels are added/removed,
+ * or previously hidden stuff appears
* (assume for now that if just adding these works, that will be fine)
*/
else if (((wmn->data == ND_KEYFRAME) && ELEM(wmn->action, NA_ADDED, NA_REMOVED)) ||
@@ -560,7 +551,8 @@ static void action_listener(
{
ED_area_tag_refresh(sa);
}
- /* for simple edits to the curve data though (or just plain selections), a simple redraw should work
+ /* for simple edits to the curve data though (or just plain selections),
+ * a simple redraw should work
* (see T39851 for an example of how this can go wrong)
*/
else {
@@ -568,48 +560,39 @@ static void action_listener(
}
break;
case NC_SCENE:
- if (saction->mode == SACTCONT_TIMELINE) {
- switch (wmn->data) {
- case ND_RENDER_RESULT:
- ED_area_tag_redraw(sa);
- break;
- case ND_OB_ACTIVE:
- case ND_FRAME:
- ED_area_tag_refresh(sa);
- break;
- case ND_FRAME_RANGE:
- {
- ARegion *ar;
- Scene *scene = wmn->reference;
-
- 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);
- break;
- }
+ switch (wmn->data) {
+ case ND_OB_ACTIVE:
+ case ND_OB_SELECT:
+ /* Selection changed, so force refresh to flush
+ * (needs flag set to do syncing). */
+ saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
+ ED_area_tag_refresh(sa);
+ break;
+ case ND_RENDER_RESULT:
+ ED_area_tag_redraw(sa);
+ break;
+ case ND_FRAME_RANGE:
+ for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ Scene *scene = wmn->reference;
+ ar->v2d.tot.xmin = (float)(SFRA - 4);
+ ar->v2d.tot.xmax = (float)(EFRA + 4);
+ break;
}
- break;
}
- }
- }
- else {
- switch (wmn->data) {
- case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
- case ND_OB_SELECT:
- saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
- ED_area_tag_refresh(sa);
- break;
-
- default: /* just redrawing the view will do */
+ break;
+ default:
+ if (saction->mode != SACTCONT_TIMELINE) {
+ /* Just redrawing the view will do. */
ED_area_tag_redraw(sa);
- break;
- }
+ }
+ break;
}
break;
case NC_OBJECT:
switch (wmn->data) {
- case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
+ case ND_BONE_SELECT: /* selection changed, so force refresh to flush
+ * (needs flag set to do syncing) */
case ND_BONE_ACTIVE:
saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
ED_area_tag_refresh(sa);
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt
index bf3257389ce..34436ae9b4d 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_api/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index afaa3325f6b..0288d7888d8 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,12 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) Blender Foundation, 2008
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_api/spacetypes.c
- * \ingroup spapi
+/** \file
+ * \ingroup spapi
*/
@@ -61,6 +57,7 @@
#include "ED_space_api.h"
#include "ED_sound.h"
#include "ED_uvedit.h"
+#include "ED_userpref.h"
#include "ED_lattice.h"
#include "ED_mball.h"
#include "ED_logic.h"
@@ -103,6 +100,7 @@ void ED_spacetypes_init(void)
// ...
/* register operator types for screen and all spaces */
+ ED_operatortypes_userpref();
ED_operatortypes_workspace();
ED_operatortypes_scene();
ED_operatortypes_screen();
diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index 397d79e1dbe..90919fa793d 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 151959a916e..152442f8671 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_buttons/buttons_context.c
- * \ingroup spbuttons
+/** \file
+ * \ingroup spbuttons
*/
@@ -40,7 +34,7 @@
#include "DNA_armature_types.h"
#include "DNA_collection_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
@@ -120,7 +114,8 @@ static int buttons_context_path_view_layer(ButsContextPath *path, wmWindow *win)
{
PointerRNA *ptr = &path->ptr[path->len - 1];
- /* View Layer may have already been resolved in a previous call (e.g. in buttons_context_path_linestyle). */
+ /* View Layer may have already been resolved in a previous call
+ * (e.g. in buttons_context_path_linestyle). */
if (RNA_struct_is_a(ptr->type, &RNA_ViewLayer)) {
return 1;
}
@@ -471,7 +466,7 @@ static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *vie
wmWindow *window = CTX_wm_window(C);
Scene *scene = WM_window_get_active_scene(window);
FreestyleConfig *config;
- SpaceButs *sbuts;
+ SpaceProperties *sbuts;
/* if Freestyle is disabled in the scene */
if ((scene->r.mode & R_EDGE_FRS) == 0) {
@@ -483,7 +478,7 @@ static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *vie
return false;
}
/* if the scene has already been pinned */
- sbuts = CTX_wm_space_buts(C);
+ sbuts = CTX_wm_space_properties(C);
if (sbuts->pinid && sbuts->pinid == &scene->id) {
return false;
}
@@ -495,11 +490,10 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
{
/* Note we don't use CTX_data here, instead we get it from the window.
* Otherwise there is a loop reading the context that we are setting. */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
wmWindow *window = CTX_wm_window(C);
Scene *scene = WM_window_get_active_scene(window);
ViewLayer *view_layer = WM_window_get_active_view_layer(window);
- Object *ob = OBACT(view_layer);
ID *id;
int found;
@@ -567,14 +561,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
found = buttons_context_path_particle(path);
break;
case BCONTEXT_MATERIAL:
- /* NOTE: Grease Pencil materials use different panels... */
- if (ob && ob->type == OB_GPENCIL) {
- /* XXX: Why path_data? */
- found = buttons_context_path_data(path, -1);
- }
- else {
- found = buttons_context_path_material(path);
- }
+ found = buttons_context_path_material(path);
break;
case BCONTEXT_TEXTURE:
found = buttons_context_path_texture(C, path, sbuts->texuser);
@@ -625,7 +612,7 @@ static int buttons_shading_new_context(const bContext *C, int flag)
return BCONTEXT_RENDER;
}
-void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
+void buttons_context_compute(const bContext *C, SpaceProperties *sbuts)
{
ButsContextPath *path;
PointerRNA *ptr;
@@ -652,7 +639,10 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
ptr = &path->ptr[path->len - 1];
if (ptr->type) {
- sbuts->dataicon = RNA_struct_ui_icon(ptr->type);
+ if (RNA_struct_is_a(ptr->type, &RNA_Light))
+ sbuts->dataicon = ICON_OUTLINER_DATA_LIGHT;
+ else
+ sbuts->dataicon = RNA_struct_ui_icon(ptr->type);
}
else {
sbuts->dataicon = ICON_EMPTY_DATA;
@@ -710,12 +700,12 @@ const char *buttons_context_dir[] = {
"texture", "texture_user", "texture_user_property", "bone", "edit_bone",
"pose_bone", "particle_system", "particle_system_editable", "particle_settings",
"cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint",
- "line_style", "collection", NULL
+ "line_style", "collection", "gpencil", NULL,
};
int buttons_context(const bContext *C, const char *member, bContextDataResult *result)
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextPath *path = sbuts ? sbuts->path : NULL;
if (!path)
@@ -732,7 +722,8 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
else if (CTX_data_equals(member, "scene")) {
- /* Do not return one here if scene not found in path, in this case we want to get default context scene! */
+ /* Do not return one here if scene not found in path,
+ * in this case we want to get default context scene! */
return set_pointer_type(path, result, &RNA_Scene);
}
else if (CTX_data_equals(member, "world")) {
@@ -982,6 +973,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
set_pointer_type(path, result, &RNA_FreestyleLineStyle);
return 1;
}
+ else if (CTX_data_equals(member, "gpencil")) {
+ set_pointer_type(path, result, &RNA_GreasePencil);
+ return 1;
+ }
else {
return 0; /* not found */
}
@@ -993,7 +988,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
if (sbuts->flag & SB_PIN_CONTEXT) {
sbuts->pinid = buttons_context_id_path(C);
@@ -1006,7 +1001,7 @@ static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
void buttons_context_draw(const bContext *C, uiLayout *layout)
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextPath *path = sbuts->path;
uiLayout *row;
uiBlock *block;
@@ -1074,7 +1069,7 @@ static bool buttons_header_context_poll(const bContext *C, HeaderType *UNUSED(ht
static bool buttons_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
#endif
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
return (sbuts->mainb != BCONTEXT_TOOL);
}
@@ -1094,7 +1089,7 @@ void buttons_context_register(ARegionType *art)
ht = MEM_callocN(sizeof(HeaderType), "spacetype buttons context header");
strcpy(ht->idname, "BUTTONS_HT_context");
- ht->space_type = SPACE_BUTS;
+ ht->space_type = SPACE_PROPERTIES;
ht->region_type = art->regionid;
ht->poll = buttons_header_context_poll;
ht->draw = buttons_header_context_draw;
@@ -1104,7 +1099,7 @@ void buttons_context_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context");
strcpy(pt->idname, "BUTTONS_PT_context");
- strcpy(pt->label, N_("Context")); /* XXX C panels are not available through RNA (bpy.types)! */
+ strcpy(pt->label, N_("Context")); /* XXX C panels unavailable through RNA bpy.types! */
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->poll = buttons_panel_context_poll;
pt->draw = buttons_panel_context_draw;
@@ -1115,7 +1110,7 @@ void buttons_context_register(ARegionType *art)
ID *buttons_context_id_path(const bContext *C)
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextPath *path = sbuts->path;
PointerRNA *ptr;
int a;
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
index 65bcf7ef1c8..fa7f0408e15 100644
--- a/source/blender/editors/space_buttons/buttons_intern.h
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_buttons/buttons_intern.h
- * \ingroup spbuttons
+/** \file
+ * \ingroup spbuttons
*/
#ifndef __BUTTONS_INTERN_H__
@@ -36,7 +29,7 @@
struct ARegionType;
struct ID;
-struct SpaceButs;
+struct SpaceProperties;
struct Tex;
struct bContext;
struct bContextDataResult;
@@ -87,7 +80,7 @@ typedef struct ButsContextTexture {
/* internal exports only */
/* buttons_context.c */
-void buttons_context_compute(const struct bContext *C, struct SpaceButs *sbuts);
+void buttons_context_compute(const struct bContext *C, struct SpaceProperties *sbuts);
int buttons_context(const struct bContext *C, const char *member, struct bContextDataResult *result);
void buttons_context_draw(const struct bContext *C, struct uiLayout *layout);
void buttons_context_register(struct ARegionType *art);
@@ -96,7 +89,7 @@ struct ID *buttons_context_id_path(const struct bContext *C);
extern const char *buttons_context_dir[]; /* doc access */
/* buttons_texture.c */
-void buttons_texture_context_compute(const struct bContext *C, struct SpaceButs *sbuts);
+void buttons_texture_context_compute(const struct bContext *C, struct SpaceProperties *sbuts);
/* buttons_ops.c */
void BUTTONS_OT_file_browse(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 473deb35aac..7cec9c09767 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_buttons/buttons_ops.c
- * \ingroup spbuttons
+/** \file
+ * \ingroup spbuttons
*/
@@ -43,7 +37,6 @@
#include "BLT_translation.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_report.h"
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index 958b55526c3..bcf536e9d97 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_buttons/buttons_texture.c
- * \ingroup spbuttons
+/** \file
+ * \ingroup spbuttons
*/
@@ -166,7 +160,7 @@ static void buttons_texture_modifier_gpencil_foreach(void *userData, Object *ob,
N_("Grease Pencil Modifiers"), RNA_struct_ui_icon(ptr.type), md->name);
}
-static void buttons_texture_users_from_context(ListBase *users, const bContext *C, SpaceButs *sbuts)
+static void buttons_texture_users_from_context(ListBase *users, const bContext *C, SpaceProperties *sbuts)
{
Scene *scene = NULL;
Object *ob = NULL;
@@ -272,7 +266,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
}
}
-void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
+void buttons_texture_context_compute(const bContext *C, SpaceProperties *sbuts)
{
/* gather available texture users in context. runs on every draw of
* properties editor, before the buttons are created. */
@@ -334,7 +328,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg))
{
/* callback when selecting a texture user in the menu */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
ButsTextureUser *user = (ButsTextureUser *)user_p;
PointerRNA texptr;
@@ -376,7 +370,7 @@ static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg)
static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUSED(arg))
{
/* callback when opening texture user selection menu, to create buttons. */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextTexture *ct = sbuts->texuser;
ButsTextureUser *user;
uiBlock *block = uiLayoutGetBlock(layout);
@@ -421,7 +415,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
/* texture user selection dropdown menu. the available users have been
* gathered before drawing in ButsContextTexture, we merely need to
* display the current item. */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
uiBlock *block = uiLayoutGetBlock(layout);
uiBut *but;
@@ -461,7 +455,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
static void template_texture_show(bContext *C, void *data_p, void *prop_p)
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
ButsTextureUser *user;
@@ -489,7 +483,7 @@ static void template_texture_show(bContext *C, void *data_p, void *prop_p)
void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
/* button to quickly show texture in texture tab */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
ButsTextureUser *user;
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index c9ba5722572..acba11ddec7 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_buttons/space_buttons.c
- * \ingroup spbuttons
+/** \file
+ * \ingroup spbuttons
*/
#include <string.h>
@@ -61,10 +54,10 @@
static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
ARegion *ar;
- SpaceButs *sbuts;
+ SpaceProperties *sbuts;
- sbuts = MEM_callocN(sizeof(SpaceButs), "initbuts");
- sbuts->spacetype = SPACE_BUTS;
+ sbuts = MEM_callocN(sizeof(SpaceProperties), "initbuts");
+ sbuts->spacetype = SPACE_PROPERTIES;
sbuts->mainb = sbuts->mainbuser = BCONTEXT_OBJECT;
@@ -102,7 +95,7 @@ static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(s
/* not spacelink itself */
static void buttons_free(SpaceLink *sl)
{
- SpaceButs *sbuts = (SpaceButs *) sl;
+ SpaceProperties *sbuts = (SpaceProperties *) sl;
if (sbuts->path)
MEM_freeN(sbuts->path);
@@ -121,7 +114,7 @@ static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)
static SpaceLink *buttons_duplicate(SpaceLink *sl)
{
- SpaceButs *sbutsn = MEM_dupallocN(sl);
+ SpaceProperties *sbutsn = MEM_dupallocN(sl);
/* clear or remove stuff from old */
sbutsn->path = NULL;
@@ -137,11 +130,11 @@ static void buttons_main_region_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap = WM_keymap_ensure(wm->defaultconf, "Property Editor", SPACE_BUTS, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Property Editor", SPACE_PROPERTIES, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
-static void buttons_main_region_layout_properties(const bContext *C, SpaceButs *sbuts, ARegion *ar)
+static void buttons_main_region_layout_properties(const bContext *C, SpaceProperties *sbuts, ARegion *ar)
{
buttons_context_compute(C, sbuts);
@@ -318,7 +311,7 @@ static void buttons_main_region_layout_tool(const bContext *C, ARegion *ar)
static void buttons_main_region_layout(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
if (sbuts->mainb == BCONTEXT_TOOL) {
buttons_main_region_layout_tool(C, ar);
@@ -353,7 +346,7 @@ static void buttons_operatortypes(void)
static void buttons_keymap(struct wmKeyConfig *keyconf)
{
- WM_keymap_ensure(keyconf, "Property Editor", SPACE_BUTS, 0);
+ WM_keymap_ensure(keyconf, "Property Editor", SPACE_PROPERTIES, 0);
}
/* add handlers, stuff you only do once or on area/region changes */
@@ -371,7 +364,7 @@ static void buttons_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
static void buttons_header_region_draw(const bContext *C, ARegion *ar)
{
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ SpaceProperties *sbuts = CTX_wm_space_properties(C);
/* Needed for RNA to get the good values! */
buttons_context_compute(C, sbuts);
@@ -385,14 +378,14 @@ static void buttons_header_region_message_subscribe(
bScreen *UNUSED(screen), ScrArea *sa, ARegion *ar,
struct wmMsgBus *mbus)
{
- SpaceButs *sbuts = sa->spacedata.first;
+ SpaceProperties *sbuts = sa->spacedata.first;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = ar,
.user_data = ar,
.notify = ED_region_do_msg_notify_tag_redraw,
};
- /* Don't check for SpaceButs.mainb here, we may toggle between view-layers
+ /* Don't check for SpaceProperties.mainb here, we may toggle between view-layers
* where one has no active object, so that available contexts changes. */
WM_msg_subscribe_rna_anon_prop(mbus, Window, view_layer, &msg_sub_value_region_tag_redraw);
@@ -411,7 +404,7 @@ static void buttons_header_region_message_subscribe(
static void buttons_navigation_bar_region_init(wmWindowManager *wm, ARegion *ar)
{
- wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Property Editor", SPACE_BUTS, 0);
+ wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Property Editor", SPACE_PROPERTIES, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
ar->flag |= RGN_FLAG_PREFSIZE_OR_HIDDEN;
@@ -427,7 +420,8 @@ static void buttons_navigation_bar_region_draw(const bContext *C, ARegion *ar)
}
ED_region_panels_layout(C, ar);
- ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL; /* ED_region_panels_layout adds vertical scrollbars, we don't want them. */
+ /* ED_region_panels_layout adds vertical scrollbars, we don't want them. */
+ ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL;
ED_region_panels_draw(C, ar);
}
@@ -450,7 +444,7 @@ static void buttons_navigation_bar_region_message_subscribe(
* showing that button set, to reduce unnecessary drawing. */
static void buttons_area_redraw(ScrArea *sa, short buttons)
{
- SpaceButs *sbuts = sa->spacedata.first;
+ SpaceProperties *sbuts = sa->spacedata.first;
/* if the area's current button set is equal to the one to redraw */
if (sbuts->mainb == buttons)
@@ -461,7 +455,7 @@ static void buttons_area_redraw(ScrArea *sa, short buttons)
static void buttons_area_listener(
wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene))
{
- SpaceButs *sbuts = sa->spacedata.first;
+ SpaceProperties *sbuts = sa->spacedata.first;
/* context changes */
switch (wmn->category) {
@@ -643,7 +637,7 @@ static void buttons_area_listener(
static void buttons_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)
{
- SpaceButs *sbuts = (SpaceButs *)slink;
+ SpaceProperties *sbuts = (SpaceProperties *)slink;
if (sbuts->pinid == old_id) {
sbuts->pinid = new_id;
@@ -700,7 +694,7 @@ void ED_spacetype_buttons(void)
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype buttons");
ARegionType *art;
- st->spaceid = SPACE_BUTS;
+ st->spaceid = SPACE_PROPERTIES;
strncpy(st->name, "Buttons", BKE_ST_MAXNAME);
st->new = buttons_new;
@@ -743,7 +737,8 @@ void ED_spacetype_buttons(void)
/* regions: navigation bar */
art = MEM_callocN(sizeof(ARegionType), "spacetype nav buttons region");
art->regionid = RGN_TYPE_NAV_BAR;
- art->prefsizex = AREAMINX - 3; /* XXX Works and looks best, should we update AREAMINX accordingly? */
+ art->prefsizex = AREAMINX - 3; /* XXX Works and looks best,
+ * should we update AREAMINX accordingly? */
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
art->init = buttons_navigation_bar_region_init;
art->draw = buttons_navigation_bar_region_draw;
diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt
index 8fa4a0de53f..a40a1bf6d25 100644
--- a/source/blender/editors/space_clip/CMakeLists.txt
+++ b/source/blender/editors/space_clip/CMakeLists.txt
@@ -15,10 +15,6 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2011 Blender Foundation.
-#
-# Contributor(s): Blender Foundation,
-# Sergey Sharybin
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -58,8 +54,8 @@ set(SRC
tracking_ops_orient.c
tracking_ops_plane.c
tracking_ops_solve.c
- tracking_ops_track.c
tracking_ops_stabilize.c
+ tracking_ops_track.c
tracking_ops_utils.c
tracking_select.c
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index ebe8e802a37..6e4b98af93b 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_buttons.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include <string.h>
@@ -38,9 +30,9 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
+#include "BLI_math.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
@@ -53,7 +45,9 @@
#include "DEG_depsgraph.h"
+#include "ED_clip.h"
#include "ED_gpencil.h"
+#include "ED_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -70,9 +64,39 @@
/* Panels */
-void ED_clip_buttons_register(ARegionType *UNUSED(art))
+static bool metadata_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
{
+ return ED_space_clip_poll((bContext *)C);
+}
+static void metadata_panel_context_draw(const bContext *C, Panel *panel)
+{
+ SpaceClip *space_clip = CTX_wm_space_clip(C);
+ /* NOTE: This might not be exactly the same image buffer as shown in the
+ * clip editor itself, since that might be coming from proxy, or being
+ * postprocessed (stabilized or undistored).
+ * Ideally we need to query metadata from an original image or movie without
+ * reading actual pixels to speed up the process. */
+ ImBuf *ibuf = ED_space_clip_get_buffer(space_clip);
+ if (ibuf != NULL) {
+ ED_region_image_metadata_panel_draw(ibuf, panel->layout);
+ IMB_freeImBuf(ibuf);
+ }
+}
+
+void ED_clip_buttons_register(ARegionType *art)
+{
+ PanelType *pt;
+
+ pt = MEM_callocN(sizeof(PanelType), "spacetype clip panel metadata");
+ strcpy(pt->idname, "CLIP_PT_metadata");
+ strcpy(pt->label, N_("Metadata"));
+ strcpy(pt->category, "Footage");
+ strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ pt->poll = metadata_panel_context_poll;
+ pt->draw = metadata_panel_context_draw;
+ pt->flag |= PNL_DEFAULT_CLOSED;
+ BLI_addtail(&art->paneltypes, pt);
}
/********************* MovieClip Template ************************/
@@ -184,19 +208,27 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
#define B_MARKER_FLAG 8
typedef struct {
- int compact; /* compact mode */
+ /** compact mode */
+ int compact;
MovieClip *clip;
- MovieClipUser *user; /* user of clip */
+ /** user of clip */
+ MovieClipUser *user;
MovieTrackingTrack *track;
MovieTrackingMarker *marker;
- int framenr; /* current frame number */
- float marker_pos[2]; /* position of marker in pixel coords */
- float marker_pat[2]; /* position and dimensions of marker pattern in pixel coords */
- float track_offset[2]; /* offset of "parenting" point */
- float marker_search_pos[2], marker_search[2]; /* position and dimensions of marker search in pixel coords */
- int marker_flag; /* marker's flags */
+ /** current frame number */
+ int framenr;
+ /** position of marker in pixel coords */
+ float marker_pos[2];
+ /** position and dimensions of marker pattern in pixel coords */
+ float marker_pat[2];
+ /** offset of "parenting" point */
+ float track_offset[2];
+ /** position and dimensions of marker search in pixel coords */
+ float marker_search_pos[2], marker_search[2];
+ /** marker's flags */
+ int marker_flag;
} MarkerUpdateCb;
static void to_pixel_space(float r[2], float a[2], int width, int height)
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index c05a4c1b64c..ef2e5b4ea3a 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_dopesheet_draw.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_movieclip_types.h"
@@ -310,7 +302,8 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
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) */
+ /* need to do a view-sync here, so that the keys area doesn't jump around
+ * (it must copy this) */
UI_view2d_sync(NULL, sa, v2d, V2D_LOCK_COPY);
/* loop through channels, and set up drawing depending on their type
diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.c b/source/blender/editors/space_clip/clip_dopesheet_ops.c
index a12e8db6daf..e2689706452 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_ops.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_dopesheet_ops.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 9f4983a35b2..54830c14b85 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_draw.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_gpencil_types.h"
@@ -329,14 +321,15 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar,
glaDrawImBuf_glsl_ctx(C, ibuf, x, y, filter, zoomx * width / ibuf->x, zoomy * height / ibuf->y);
+ if (ibuf->planes == 32) {
+ GPU_blend(false);
+ }
+
if (sc->flag & SC_SHOW_METADATA) {
rctf frame;
BLI_rctf_init(&frame, 0.0f, ibuf->x, 0.0f, ibuf->y);
ED_region_image_metadata_draw(x, y, ibuf, &frame, zoomx * width / ibuf->x, zoomy * height / ibuf->y);
}
-
- if (ibuf->planes == 32)
- GPU_blend(false);
}
static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int height, float zoomx, float zoomy)
@@ -663,7 +656,8 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
GPU_line_width(1.0f);
- /* Since we are switching solid and dashed lines in rather complex logic here, just always go with dashed shader. */
+ /* Since we are switching solid and dashed lines in rather complex logic here,
+ * just always go with dashed shader. */
immUnbindProgram();
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 8308c781902..79a159bac2e 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_editor.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include <stddef.h>
@@ -66,6 +58,7 @@
#include "ED_screen.h"
#include "ED_clip.h"
#include "ED_mask.h"
+#include "ED_select_utils.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -437,6 +430,99 @@ bool ED_clip_view_selection(const bContext *C, ARegion *ar, bool fit)
return true;
}
+void ED_clip_select_all(SpaceClip *sc, int action, bool *r_has_selection)
+{
+ MovieClip *clip = ED_space_clip_get_clip(sc);
+ const int framenr = ED_space_clip_get_clip_frame_number(sc);
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingTrack *track = NULL; /* selected track */
+ MovieTrackingPlaneTrack *plane_track = NULL; /* selected plane track */
+ MovieTrackingMarker *marker;
+ ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
+ ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
+ bool has_selection = false;
+
+ if (action == SEL_TOGGLE) {
+ action = SEL_SELECT;
+
+ for (track = tracksbase->first; track; track = track->next) {
+ if (TRACK_VIEW_SELECTED(sc, track)) {
+ marker = BKE_tracking_marker_get(track, framenr);
+
+ if (MARKER_VISIBLE(sc, track, marker)) {
+ action = SEL_DESELECT;
+ break;
+ }
+ }
+ }
+
+ for (plane_track = plane_tracks_base->first;
+ plane_track;
+ plane_track = plane_track->next)
+ {
+ if (PLANE_TRACK_VIEW_SELECTED(plane_track)) {
+ action = SEL_DESELECT;
+ break;
+ }
+ }
+ }
+
+ for (track = tracksbase->first; track; track = track->next) {
+ if ((track->flag & TRACK_HIDDEN) == 0) {
+ marker = BKE_tracking_marker_get(track, framenr);
+
+ if (MARKER_VISIBLE(sc, track, marker)) {
+ switch (action) {
+ case SEL_SELECT:
+ track->flag |= SELECT;
+ track->pat_flag |= SELECT;
+ track->search_flag |= SELECT;
+ break;
+ case SEL_DESELECT:
+ track->flag &= ~SELECT;
+ track->pat_flag &= ~SELECT;
+ track->search_flag &= ~SELECT;
+ break;
+ case SEL_INVERT:
+ track->flag ^= SELECT;
+ track->pat_flag ^= SELECT;
+ track->search_flag ^= SELECT;
+ break;
+ }
+ }
+ }
+
+ if (TRACK_VIEW_SELECTED(sc, track))
+ has_selection = true;
+ }
+
+ for (plane_track = plane_tracks_base->first;
+ plane_track;
+ plane_track = plane_track->next)
+ {
+ if ((plane_track->flag & PLANE_TRACK_HIDDEN) == 0) {
+ switch (action) {
+ case SEL_SELECT:
+ plane_track->flag |= SELECT;
+ break;
+ case SEL_DESELECT:
+ plane_track->flag &= ~SELECT;
+ break;
+ case SEL_INVERT:
+ plane_track->flag ^= SELECT;
+ break;
+ }
+ if (plane_track->flag & SELECT) {
+ has_selection = true;
+ }
+ }
+ }
+
+ if (r_has_selection) {
+ *r_has_selection = has_selection;
+ }
+}
+
void ED_clip_point_undistorted_pos(SpaceClip *sc, const float co[2], float r_co[2])
{
copy_v2_v2(r_co, co);
@@ -648,29 +734,29 @@ static unsigned char *prefetch_read_file_to_memory(
size_t *r_size)
{
MovieClipUser user = {0};
- char name[FILE_MAX];
- size_t size;
- int file;
- unsigned char *mem;
-
user.framenr = current_frame;
user.render_size = render_size;
user.render_flag = render_flag;
+ char name[FILE_MAX];
BKE_movieclip_filename_for_frame(clip, &user, name);
- file = BLI_open(name, O_BINARY | O_RDONLY, 0);
+ int file = BLI_open(name, O_BINARY | O_RDONLY, 0);
if (file == -1) {
return NULL;
}
- size = BLI_file_descriptor_size(file);
+ const size_t size = BLI_file_descriptor_size(file);
if (size < 1) {
close(file);
return NULL;
}
- mem = MEM_mallocN(size, "movieclip prefetch memory file");
+ unsigned char *mem = MEM_mallocN(size, "movieclip prefetch memory file");
+ if (mem == NULL) {
+ close(file);
+ return NULL;
+ }
if (read(file, mem, size) != size) {
close(file);
@@ -781,7 +867,7 @@ static void prefetch_task_func(TaskPool * __restrict pool, void *task_data, int
while ((mem = prefetch_thread_next_frame(queue, clip, &size, &current_frame))) {
ImBuf *ibuf;
MovieClipUser user = {0};
- int flag = IB_rect | IB_alphamode_detect;
+ int flag = IB_rect | IB_multilayer | IB_alphamode_detect | IB_metadata;
int result;
char *colorspace_name = NULL;
const bool use_proxy = (clip->flag & MCLIP_USE_PROXY) &&
@@ -797,6 +883,10 @@ static void prefetch_task_func(TaskPool * __restrict pool, void *task_data, int
}
ibuf = IMB_ibImageFromMemory(mem, size, flag, colorspace_name, "prefetch frame");
+ if (ibuf == NULL) {
+ continue;
+ }
+ BKE_movieclip_convert_multilayer_ibuf(ibuf);
result = BKE_movieclip_put_frame_if_possible(clip, &user, ibuf);
@@ -962,8 +1052,9 @@ static int prefetch_get_final_frame(const bContext *C)
/* check whether all the frames from prefetch range are cached */
end_frame = EFRA;
- if (clip->len)
- end_frame = min_ii(end_frame, clip->len);
+ if (clip->len) {
+ end_frame = min_ii(end_frame, SFRA + clip->len - 1);
+ }
return end_frame;
}
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index cc8541d9fd7..63d9a45fa2e 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_graph_draw.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_movieclip_types.h"
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index 06233d64a36..8a8cb4b8dcb 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_graph_ops.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_scene_types.h"
@@ -241,7 +233,8 @@ static bool mouse_select_curve(bContext *C, float co[2], bool extend)
if (userdata.track) {
if (extend) {
if (act_track == userdata.track) {
- /* currently only single curve can be selected (selected curve represents active track) */
+ /* currently only single curve can be selected
+ * (selected curve represents active track) */
act_track = NULL;
}
}
@@ -706,7 +699,7 @@ void CLIP_OT_graph_disable_markers(wmOperatorType *ot)
{0, "DISABLE", 0, "Disable", "Disable selected markers"},
{1, "ENABLE", 0, "Enable", "Enable selected markers"},
{2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index e8488a5d0b6..e85d68431d4 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,15 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_intern.h
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#ifndef __CLIP_INTERN_H__
#define __CLIP_INTERN_H__
-struct bContext;
struct ARegion;
struct MovieClip;
struct MovieTrackingMarker;
@@ -40,6 +31,7 @@ struct MovieTrackingTrack;
struct Scene;
struct ScrArea;
struct SpaceClip;
+struct bContext;
struct wmOperatorType;
/* channel heights */
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index e907fdfc570..a86dd7ceb2d 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_ops.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include <errno.h>
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index 304954b56e3..3f16982e2c6 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_toolbar.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include <string.h>
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 7dd5816794f..882cafae5f6 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/clip_utils.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "DNA_scene_types.h"
@@ -35,7 +27,6 @@
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index af7843a01a5..b84a5fc90ed 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/space_clip.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include <string.h>
@@ -227,6 +219,12 @@ static void clip_scopes_check_gpencil_change(ScrArea *sa)
}
}
+static void clip_area_sync_frame_from_scene(ScrArea *sa, Scene *scene)
+{
+ SpaceClip *space_clip = (SpaceClip *)sa->spacedata.first;
+ BKE_movieclip_user_set_frame(&space_clip->user, scene->r.cfra);
+}
+
/* ******************** default callbacks for clip space ***************** */
static SpaceLink *clip_new(const ScrArea *sa, const Scene *scene)
@@ -324,7 +322,7 @@ static SpaceLink *clip_duplicate(SpaceLink *sl)
return (SpaceLink *)scn;
}
-static void clip_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene))
+static void clip_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, Scene *scene)
{
/* context changes */
switch (wmn->category) {
@@ -389,6 +387,9 @@ static void clip_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, S
case ND_ANIMPLAY:
ED_area_tag_redraw(sa);
break;
+ case ND_LAYOUTSET:
+ clip_area_sync_frame_from_scene(sa, scene);
+ break;
}
break;
case NC_SPACE:
@@ -553,6 +554,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
}
/* DO NOT make this static, this hides the symbol and breaks API generation script. */
+extern const char *clip_context_dir[]; /* quiet warning. */
const char *clip_context_dir[] = {"edit_movieclip", "edit_mask", NULL};
static int clip_context(const bContext *C, const char *member, bContextDataResult *result)
@@ -581,9 +583,12 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
/* dropboxes */
static bool clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
{
- if (drag->type == WM_DRAG_PATH)
- if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
+ if (drag->type == WM_DRAG_PATH) {
+ /* rule might not work? */
+ if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) {
return true;
+ }
+ }
return false;
}
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 42077280cca..68d13b63804 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
@@ -1135,7 +1127,7 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot)
{TRACK_CLEAR_UPTO, "UPTO", 0, "Clear up-to", "Clear path up to current frame"},
{TRACK_CLEAR_REMAINED, "REMAINED", 0, "Clear remained", "Clear path at remaining frames (after current)"},
{TRACK_CLEAR_ALL, "ALL", 0, "Clear all", "Clear the whole path"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1210,7 +1202,7 @@ void CLIP_OT_disable_markers(wmOperatorType *ot)
"Enable selected markers"},
{MARKER_OP_TOGGLE, "TOGGLE", 0, "Toggle",
"Toggle disabled flag for selected markers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1428,7 +1420,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
sc->user.framenr += delta;
}
}
- else { /* to to failed frame */
+ else { /* to failed frame */
if (tracking->reconstruction.flag & TRACKING_RECONSTRUCTED) {
int framenr = ED_space_clip_get_clip_frame_number(sc);
MovieTrackingObject *object = BKE_tracking_object_get_active(tracking);
@@ -1475,7 +1467,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
{1, "PATHEND", 0, "Path End", "Jump to end of current path"},
{2, "FAILEDPREV", 0, "Previous Failed", "Jump to previous failed frame"},
{2, "FAILNEXT", 0, "Next Failed", "Jump to next failed frame"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1643,7 +1635,7 @@ void CLIP_OT_lock_tracks(wmOperatorType *ot)
{TRACK_ACTION_UNLOCK, "UNLOCK", 0, "Unlock", "Unlock selected tracks"},
{TRACK_ACTION_TOGGLE, "TOGGLE", 0, "Toggle",
"Toggle locked flag for selected tracks"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1697,7 +1689,7 @@ void CLIP_OT_set_solver_keyframe(wmOperatorType *ot)
static const EnumPropertyItem keyframe_items[] = {
{SOLVER_KEYFRAME_A, "KEYFRAME_A", 0, "Keyframe A", ""},
{SOLVER_KEYFRAME_B, "KEYFRAME_B", 0, "Keyframe B", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1976,7 +1968,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
"Delete unclean tracks"},
{TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments",
"Delete unclean segments of tracks"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_clip/tracking_ops_detect.c b/source/blender/editors/space_clip/tracking_ops_detect.c
index 77f7e8d112c..131ccc05d35 100644
--- a/source/blender/editors/space_clip/tracking_ops_detect.c
+++ b/source/blender/editors/space_clip/tracking_ops_detect.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_detect.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
@@ -135,7 +127,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
"Place markers only inside areas outlined with Grease Pencil"},
{2, "OUTSIDE_GPENCIL", 0, "Outside Grease Pencil",
"Place markers only outside areas outlined with Grease Pencil"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_clip/tracking_ops_intern.h b/source/blender/editors/space_clip/tracking_ops_intern.h
index b53799b88d8..adf0285540a 100644
--- a/source/blender/editors/space_clip/tracking_ops_intern.h
+++ b/source/blender/editors/space_clip/tracking_ops_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,19 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_intern.h
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#ifndef __TRACKING_OPS_INTERN_H__
#define __TRACKING_OPS_INTERN_H__
-struct bContext;
struct ListBase;
struct MovieClip;
struct SpaceClip;
+struct bContext;
/* tracking_utils.c */
diff --git a/source/blender/editors/space_clip/tracking_ops_orient.c b/source/blender/editors/space_clip/tracking_ops_orient.c
index 76421cde8f8..2df74240241 100644
--- a/source/blender/editors/space_clip/tracking_ops_orient.c
+++ b/source/blender/editors/space_clip/tracking_ops_orient.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_orient.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
@@ -509,7 +501,7 @@ void CLIP_OT_set_plane(wmOperatorType *ot)
static const EnumPropertyItem plane_items[] = {
{0, "FLOOR", 0, "Floor", "Set floor plane"},
{1, "WALL", 0, "Wall", "Set wall plane"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -583,7 +575,7 @@ void CLIP_OT_set_axis(wmOperatorType *ot)
static const EnumPropertyItem axis_actions[] = {
{0, "X", 0, "X", "Align bundle align X axis"},
{1, "Y", 0, "Y", "Align bundle align Y axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -678,18 +670,18 @@ static int do_set_scale(bContext *C,
}
else {
if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
- mul_v3_fl(object->size, scale);
+ mul_v3_fl(object->scale, scale);
mul_v3_fl(object->loc, scale);
}
else if (!scale_solution) {
Object *solver_camera = object_solver_camera(scene, object);
- object->size[0] = object->size[1] = object->size[2] = 1.0f / scale;
+ object->scale[0] = object->scale[1] = object->scale[2] = 1.0f / scale;
if (solver_camera) {
- object->size[0] /= solver_camera->size[0];
- object->size[1] /= solver_camera->size[1];
- object->size[2] /= solver_camera->size[2];
+ object->scale[0] /= solver_camera->scale[0];
+ object->scale[1] /= solver_camera->scale[1];
+ object->scale[2] /= solver_camera->scale[2];
}
}
else {
diff --git a/source/blender/editors/space_clip/tracking_ops_plane.c b/source/blender/editors/space_clip/tracking_ops_plane.c
index 6c85bdfc4ec..a12e03a252c 100644
--- a/source/blender/editors/space_clip/tracking_ops_plane.c
+++ b/source/blender/editors/space_clip/tracking_ops_plane.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_plane.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_clip/tracking_ops_solve.c b/source/blender/editors/space_clip/tracking_ops_solve.c
index 4148b3a0070..03e03f94a66 100644
--- a/source/blender/editors/space_clip/tracking_ops_solve.c
+++ b/source/blender/editors/space_clip/tracking_ops_solve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_solve.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_clip/tracking_ops_stabilize.c b/source/blender/editors/space_clip/tracking_ops_stabilize.c
index 2888607a049..ab7585cbf57 100644
--- a/source/blender/editors/space_clip/tracking_ops_stabilize.c
+++ b/source/blender/editors/space_clip/tracking_ops_stabilize.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_stabilize.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_clip/tracking_ops_track.c b/source/blender/editors/space_clip/tracking_ops_track.c
index cd8e92c9b9c..4c14049865b 100644
--- a/source/blender/editors/space_clip/tracking_ops_track.c
+++ b/source/blender/editors/space_clip/tracking_ops_track.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,16 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_track.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
-#include "BLI_blenlib.h"
#include "BKE_main.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_clip/tracking_ops_utils.c b/source/blender/editors/space_clip/tracking_ops_utils.c
index 4fbee51407d..8974f6f7ee0 100644
--- a/source/blender/editors/space_clip/tracking_ops_utils.c
+++ b/source/blender/editors/space_clip/tracking_ops_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_ops_utils.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index c9901bd81bb..0c0fe60108f 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_clip/tracking_select.c
- * \ingroup spclip
+/** \file
+ * \ingroup spclip
*/
#include "MEM_guardedalloc.h"
@@ -451,8 +443,12 @@ static int box_select_exec(bContext *C, wmOperator *op)
ED_clip_point_stable_pos(sc, ar, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
ED_clip_point_stable_pos(sc, ar, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_clip_select_all(sc, SEL_DESELECT, NULL);
+ changed = true;
+ }
/* do actual selection */
track = tracksbase->first;
@@ -469,10 +465,6 @@ static int box_select_exec(bContext *C, wmOperator *op)
BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);
}
}
- else if (!extend) {
- BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);
- }
-
changed = true;
}
}
@@ -498,11 +490,7 @@ static int box_select_exec(bContext *C, wmOperator *op)
plane_track->flag &= ~SELECT;
}
}
- else if (!extend) {
- plane_track->flag &= ~SELECT;
- }
}
-
changed = true;
}
}
@@ -536,7 +524,8 @@ void CLIP_OT_select_box(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_box_select(ot);
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/********************** lasso select operator *********************/
@@ -633,10 +622,15 @@ static int clip_lasso_select_exec(bContext *C, wmOperator *op)
int mcords_tot;
const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
+
if (mcords) {
- bool select;
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ ED_clip_select_all(sc, SEL_DESELECT, NULL);
+ }
- select = !RNA_boolean_get(op->ptr, "deselect");
do_lasso_select_marker(C, mcords, mcords_tot, select);
MEM_freeN((void *)mcords);
@@ -664,7 +658,8 @@ void CLIP_OT_select_lasso(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_lasso_select(ot);
+ WM_operator_properties_gesture_lasso(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/********************** circle select operator *********************/
@@ -706,7 +701,13 @@ static int circle_select_exec(bContext *C, wmOperator *op)
const int y = RNA_int_get(op->ptr, "y");
const int radius = RNA_int_get(op->ptr, "radius");
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
+ const eSelectOp sel_op = ED_select_op_modal(
+ RNA_enum_get(op->ptr, "mode"), WM_gesture_is_modal_first(op->customdata));
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_clip_select_all(sc, SEL_DESELECT, NULL);
+ changed = true;
+ }
/* compute ellipse and position in unified coordinates */
ED_space_clip_get_size(sc, &width, &height);
@@ -790,7 +791,8 @@ void CLIP_OT_select_circle(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_circle_select(ot);
+ WM_operator_properties_gesture_circle(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/********************** select all operator *********************/
@@ -800,90 +802,12 @@ static int select_all_exec(bContext *C, wmOperator *op)
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
- MovieTrackingTrack *track = NULL; /* selected track */
- MovieTrackingPlaneTrack *plane_track = NULL; /* selected plane track */
- MovieTrackingMarker *marker;
- ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
- ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
- int action = RNA_enum_get(op->ptr, "action");
- int framenr = ED_space_clip_get_clip_frame_number(sc);
- bool has_selection = false;
-
- if (action == SEL_TOGGLE) {
- action = SEL_SELECT;
-
- for (track = tracksbase->first; track; track = track->next) {
- if (TRACK_VIEW_SELECTED(sc, track)) {
- marker = BKE_tracking_marker_get(track, framenr);
- if (MARKER_VISIBLE(sc, track, marker)) {
- action = SEL_DESELECT;
- break;
- }
- }
- }
-
- for (plane_track = plane_tracks_base->first;
- plane_track;
- plane_track = plane_track->next)
- {
- if (PLANE_TRACK_VIEW_SELECTED(plane_track)) {
- action = SEL_DESELECT;
- break;
- }
- }
- }
-
- for (track = tracksbase->first; track; track = track->next) {
- if ((track->flag & TRACK_HIDDEN) == 0) {
- marker = BKE_tracking_marker_get(track, framenr);
-
- if (MARKER_VISIBLE(sc, track, marker)) {
- switch (action) {
- case SEL_SELECT:
- track->flag |= SELECT;
- track->pat_flag |= SELECT;
- track->search_flag |= SELECT;
- break;
- case SEL_DESELECT:
- track->flag &= ~SELECT;
- track->pat_flag &= ~SELECT;
- track->search_flag &= ~SELECT;
- break;
- case SEL_INVERT:
- track->flag ^= SELECT;
- track->pat_flag ^= SELECT;
- track->search_flag ^= SELECT;
- break;
- }
- }
- }
+ int action = RNA_enum_get(op->ptr, "action");
- if (TRACK_VIEW_SELECTED(sc, track))
- has_selection = true;
- }
+ bool has_selection = false;
- for (plane_track = plane_tracks_base->first;
- plane_track;
- plane_track = plane_track->next)
- {
- if ((plane_track->flag & PLANE_TRACK_HIDDEN) == 0) {
- switch (action) {
- case SEL_SELECT:
- plane_track->flag |= SELECT;
- break;
- case SEL_DESELECT:
- plane_track->flag &= ~SELECT;
- break;
- case SEL_INVERT:
- plane_track->flag ^= SELECT;
- break;
- }
- if (plane_track->flag & SELECT) {
- has_selection = true;
- }
- }
- }
+ ED_clip_select_all(sc, action, &has_selection);
if (!has_selection)
sc->flag &= ~SC_LOCK_SELECTION;
@@ -990,7 +914,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
{4, "DISABLED", 0, "Disabled tracks", "Select all disabled tracks"},
{5, "COLOR", 0, "Tracks with same color", "Select all tracks with same color as active track"},
{6, "FAILED", 0, "Failed Tracks", "Select all tracks which failed to be reconstructed"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt
index ecfb1f0e0df..bed1b7dce96 100644
--- a/source/blender/editors/space_console/CMakeLists.txt
+++ b/source/blender/editors/space_console/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 789194c21b9..b7e4133e073 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/editors/space_console/console_draw.c
- * \ingroup spconsole
+/** \file
+ * \ingroup spconsole
*/
#include <math.h>
@@ -39,7 +33,6 @@
#include "MEM_guardedalloc.h"
-#include "BIF_gl.h"
#include "GPU_immediate.h"
#include "UI_interface.h"
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index c0ef6e95d2e..1e4a90ca71a 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/editors/space_console/console_intern.h
- * \ingroup spconsole
+/** \file
+ * \ingroup spconsole
*/
#ifndef __CONSOLE_INTERN_H__
@@ -30,12 +24,13 @@
/* internal exports only */
struct ConsoleLine;
-struct wmOperatorType;
struct bContext;
+struct wmOperatorType;
/* console_draw.c */
void console_textview_main(struct SpaceConsole *sc, struct ARegion *ar);
-int console_textview_height(struct SpaceConsole *sc, struct ARegion *ar); /* needed to calculate the scrollbar */
+/* needed to calculate the scrollbar */
+int console_textview_height(struct SpaceConsole *sc, struct ARegion *ar);
int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, const int mval[2]);
void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy);
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 32cf5ea2055..46d22df2609 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/editors/space_console/console_ops.c
- * \ingroup spconsole
+/** \file
+ * \ingroup spconsole
*/
@@ -306,7 +300,7 @@ static const EnumPropertyItem console_move_type_items[] = {
{NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
{PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
{NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int console_move_exec(bContext *C, wmOperator *op)
@@ -575,7 +569,7 @@ static const EnumPropertyItem console_delete_type_items[] = {
{DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
{DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
{DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int console_delete_exec(bContext *C, wmOperator *op)
@@ -747,7 +741,8 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
SpaceConsole *sc = CTX_wm_space_console(C);
ARegion *ar = CTX_wm_region(C);
- ConsoleLine *ci = console_history_verify(C); /* TODO - stupid, just prevents crashes when no command line */
+ /* TODO - stupid, just prevents crashes when no command line */
+ ConsoleLine *ci = console_history_verify(C);
const bool reverse = RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */
int prev_len = ci->len;
@@ -814,7 +809,8 @@ 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, don't free */
+ /* own this text in the new line, don't free */
+ char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
int cursor = RNA_int_get(op->ptr, "current_character");
const bool rem_dupes = RNA_boolean_get(op->ptr, "remove_duplicates");
int prev_len = ci->len;
@@ -871,7 +867,8 @@ 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, don't free */
+ /* own this text in the new line, don't free */
+ char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
int type = RNA_enum_get(op->ptr, "type");
console_history_verify(C);
@@ -900,7 +897,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
{CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""},
{CONSOLE_LINE_INFO, "INFO", 0, "Information", ""},
{CONSOLE_LINE_ERROR, "ERROR", 0, "Error", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index ece29bcd721..65f1fe36fec 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/editors/space_console/space_console.c
- * \ingroup spconsole
+/** \file
+ * \ingroup spconsole
*/
#include <string.h>
@@ -38,8 +32,6 @@
#include "ED_space_api.h"
#include "ED_screen.h"
-#include "BIF_gl.h"
-
#include "RNA_access.h"
#include "WM_api.h"
diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt
index fd701a8be4c..07ba1cc7a64 100644
--- a/source/blender/editors/space_file/CMakeLists.txt
+++ b/source/blender/editors/space_file/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 4b2486f2a68..8156e62a427 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/file_draw.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
@@ -35,7 +28,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_fileops_types.h"
#include "BLI_math.h"
#ifdef WIN32
@@ -45,7 +37,6 @@
#include "BIF_glutil.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BLO_readfile.h"
@@ -310,7 +301,8 @@ static void file_draw_string(
BLI_strncpy(fname, string, FILE_MAXFILE);
UI_text_clip_middle_ex(&fs, fname, width, UI_DPI_ICON_SIZE, sizeof(fname), '\0');
- /* no text clipping needed, UI_fontstyle_draw does it but is a bit too strict (for buttons it works) */
+ /* no text clipping needed, UI_fontstyle_draw does it but is a bit too strict
+ * (for buttons it works) */
rect.xmin = sx;
rect.xmax = (int)(sx + ceil(width + 5.0f / UI_DPI_FAC));
rect.ymin = sy - height;
@@ -391,8 +383,10 @@ static void file_draw_preview(
UI_GetThemeColor4fv(TH_TEXT, col);
}
- /* Preview images use premultiplied alpha. */
- GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ if (!is_icon && typeflags & FILE_TYPE_BLENDERLIB) {
+ /* Datablock preview images use premultiplied alpha. */
+ GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ }
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTexScaled(&state, (float)xco, (float)yco, imb->x, imb->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, imb->rect,
@@ -440,7 +434,7 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
const char *blendfile_path = BKE_main_blendfile_path(bmain);
BLI_make_file_string(blendfile_path, orgname, sfile->params->dir, oldname);
- BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
+ BLI_strncpy(filename, sfile->params->renamefile, sizeof(filename));
BLI_filename_make_safe(filename);
BLI_make_file_string(blendfile_path, newname, sfile->params->dir, filename);
@@ -455,6 +449,17 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
errno ? strerror(errno) : "unknown error");
WM_report_banner_show();
}
+ else {
+ /* If rename is sucessfull, scroll to newly renamed entry. */
+ BLI_strncpy(sfile->params->renamefile, filename, sizeof(sfile->params->renamefile));
+ sfile->params->rename_flag = FILE_PARAMS_RENAME_POSTSCROLL_PENDING;
+
+ if (sfile->smoothscroll_timer != NULL) {
+ WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
+ }
+ sfile->smoothscroll_timer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER1, 1.0 / 1000.0);
+ sfile->scroll_offset = 0;
+ }
/* to make sure we show what is on disk */
ED_fileselect_clear(wm, sa, sfile);
@@ -683,8 +688,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
but = uiDefBut(block, UI_BTYPE_TEXT, 1, "", sx, sy - layout->tile_h - 0.15f * UI_UNIT_X,
- width, textheight, sfile->params->renameedit, 1.0f,
- (float)sizeof(sfile->params->renameedit), 0, 0, "");
+ width, textheight, sfile->params->renamefile, 1.0f,
+ (float)sizeof(sfile->params->renamefile), 0, 0, "");
UI_but_func_rename_set(but, renamebutton_cb, file);
UI_but_flag_enable(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
UI_but_flag_disable(but, UI_BUT_UNDO);
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 710aa472a8b..46e30e556d1 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/file_intern.h
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
#ifndef __FILE_INTERN_H__
@@ -35,6 +28,7 @@
struct ARegion;
struct ARegionType;
+struct FileSelectParams;
struct SpaceFile;
/* file_ops.c */
@@ -59,8 +53,8 @@ void file_draw_check_cb(bContext *C, void *arg1, void *arg2);
bool file_draw_check_exists(SpaceFile *sfile);
/* file_ops.h */
-struct wmOperatorType;
struct wmOperator;
+struct wmOperatorType;
typedef enum WalkSelectDirection {
FILE_SELECT_WALK_UP,
@@ -113,7 +107,6 @@ void file_sfile_to_operator_ex(bContext *C, struct wmOperator *op, struct SpaceF
void file_sfile_to_operator(bContext *C, struct wmOperator *op, struct SpaceFile *sfile);
void file_operator_to_sfile(bContext *C, struct SpaceFile *sfile, struct wmOperator *op);
-
/* filesel.c */
void fileselect_file_set(SpaceFile *sfile, const int index);
float file_string_width(const char *str);
@@ -123,6 +116,8 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matche
int autocomplete_directory(struct bContext *C, char *str, void *arg_v);
int autocomplete_file(struct bContext *C, char *str, void *arg_v);
+void file_params_renamefile_activate(struct SpaceFile *sfile, struct FileSelectParams *params);
+
/* file_panels.c */
void file_panels_register(struct ARegionType *art);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index ea73026020d..482774c8131 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,17 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Andrea Weikert (c) 2008 Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/file_ops.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
-#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_fileops_types.h"
+
+#include "BLI_blenlib.h"
#include "BLI_linklist.h"
+#include "BLI_math.h"
#include "BLO_readfile.h"
@@ -48,6 +42,7 @@
#include "ED_screen.h"
#include "ED_fileselect.h"
+#include "ED_select_utils.h"
#include "UI_interface.h"
@@ -108,7 +103,7 @@ static void file_deselect_all(SpaceFile *sfile, unsigned int flag)
typedef enum FileSelect {
FILE_SELECT_NOTHING = 0,
FILE_SELECT_DIR = 1,
- FILE_SELECT_FILE = 2
+ FILE_SELECT_FILE = 2,
} FileSelect;
static void clamp_to_filelist(int numfiles, FileSelection *sel)
@@ -430,12 +425,12 @@ static int file_box_select_exec(bContext *C, wmOperator *op)
SpaceFile *sfile = CTX_wm_space_file(C);
rcti rect;
FileSelect ret;
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
WM_operator_properties_border_to_rcti(op, &rect);
- if (!extend) {
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
file_deselect_all(sfile, FILE_SEL_SELECTED);
}
@@ -443,7 +438,8 @@ static int file_box_select_exec(bContext *C, wmOperator *op)
ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, false, false);
- /* unselect '..' parent entry - it's not supposed to be selected if more than one file is selected */
+ /* unselect '..' parent entry - it's not supposed to be selected if more than
+ * one file is selected */
filelist_entry_select_index_set(sfile->files, 0, FILE_SEL_REMOVE, FILE_SEL_SELECTED, CHECK_ALL);
if (FILE_SELECT_DIR == ret) {
@@ -470,7 +466,8 @@ void FILE_OT_select_box(wmOperatorType *ot)
ot->cancel = WM_gesture_box_cancel;
/* properties */
- WM_operator_properties_gesture_box_select(ot);
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -507,7 +504,8 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ret = file_select(C, &rect, extend ? FILE_SEL_TOGGLE : FILE_SEL_ADD, fill, do_diropen);
if (extend) {
- /* unselect '..' parent entry - it's not supposed to be selected if more than one file is selected */
+ /* unselect '..' parent entry - it's not supposed to be selected if more
+ * than one file is selected */
filelist_entry_select_index_set(sfile->files, 0, FILE_SEL_REMOVE, FILE_SEL_SELECTED, CHECK_ALL);
}
@@ -571,10 +569,11 @@ static bool file_walk_select_selection_set(
deselect = (fill || other_site == -1 ||
!filelist_entry_select_index_get(files, other_site, CHECK_ALL));
- /* don't change highlight_file here since we either want to deselect active or we want to
- * walk through a block of selected files without selecting/deselecting anything */
+ /* don't change highlight_file here since we either want to deselect active or we want
+ * to walk through a block of selected files without selecting/deselecting anything */
params->active_file = active_new;
- /* but we want to change active if we use fill (needed to get correct selection bounds) */
+ /* but we want to change active if we use fill
+ * (needed to get correct selection bounds) */
if (deselect && fill) {
active = active_new;
}
@@ -606,7 +605,8 @@ static bool file_walk_select_selection_set(
/* highlight the active walker file for extended selection for better visual feedback */
params->highlight_file = params->active_file;
- /* unselect '..' parent entry - it's not supposed to be selected if more than one file is selected */
+ /* unselect '..' parent entry - it's not supposed to be selected if more
+ * than one file is selected */
filelist_entry_select_index_set(files, 0, FILE_SEL_REMOVE, FILE_SEL_SELECTED, CHECK_ALL);
}
else {
@@ -746,7 +746,7 @@ void FILE_OT_select_walk(wmOperatorType *ot)
{FILE_SELECT_WALK_DOWN, "DOWN", 0, "Next", ""},
{FILE_SELECT_WALK_LEFT, "LEFT", 0, "Left", ""},
{FILE_SELECT_WALK_RIGHT, "RIGHT", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -824,7 +824,8 @@ void FILE_OT_select_all(wmOperatorType *ot)
/* ---------- BOOKMARKS ----------- */
-/* Note we could get rid of this one, but it's used by some addon so... Does not hurt keeping it around for now. */
+/* Note we could get rid of this one, but it's used by some addon so...
+ * Does not hurt keeping it around for now. */
static int bookmark_select_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
@@ -1207,7 +1208,8 @@ void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, ch
Main *bmain = CTX_data_main(C);
PropertyRNA *prop;
- BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file); /* XXX, not real length */
+ /* XXX, not real length */
+ BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file);
if ((prop = RNA_struct_find_property(op->ptr, "relative_path"))) {
if (RNA_property_boolean_get(op->ptr, prop)) {
@@ -1243,7 +1245,8 @@ void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, ch
num_files++;
}
}
- /* make sure the file specified in the filename button is added even if no files selected */
+ /* make sure the file specified in the filename button is added even if no
+ * files selected */
if (0 == num_files) {
RNA_property_collection_add(op->ptr, prop, &itemptr);
RNA_string_set(&itemptr, "name", sfile->params->file);
@@ -1263,7 +1266,8 @@ void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, ch
}
}
- /* make sure the directory specified in the button is added even if no directory selected */
+ /* make sure the directory specified in the button is added even if no
+ * directory selected */
if (0 == num_dirs) {
RNA_property_collection_add(op->ptr, prop, &itemptr);
RNA_string_set(&itemptr, "name", sfile->params->dir);
@@ -1581,7 +1585,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
ARegion *ar, *oldar = CTX_wm_region(C);
int offset;
int numfiles, numfiles_layout;
- int edit_idx = 0;
+ int edit_idx = -1;
int i;
/* escape if not our timer */
@@ -1590,18 +1594,29 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
numfiles = filelist_files_ensure(sfile->files);
+ /* Due to async nature of file listing, we may execute this code before `file_refresh()`
+ * editing entry is available in our listing, so we also have to handle switching to rename mode here. */
+ FileSelectParams *params = ED_fileselect_get_params(sfile);
+ if ((params->rename_flag & (FILE_PARAMS_RENAME_PENDING | FILE_PARAMS_RENAME_POSTSCROLL_PENDING)) != 0) {
+ file_params_renamefile_activate(sfile, params);
+ }
+
/* check if we are editing a name */
for (i = 0; i < numfiles; ++i) {
- if (filelist_entry_select_index_get(sfile->files, i, CHECK_ALL) ) {
+ if (filelist_entry_select_index_get(sfile->files, i, CHECK_ALL) & (FILE_SEL_EDITING | FILE_SEL_HIGHLIGHTED)) {
edit_idx = i;
break;
}
}
/* if we are not editing, we are done */
- if (0 == edit_idx) {
- WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
- sfile->smoothscroll_timer = NULL;
+ if (edit_idx == -1) {
+ /* Do not invalidate timer if filerename is still pending, we might still be building the filelist
+ * and yet have to find edited entry... */
+ if (params->rename_flag == 0) {
+ WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
+ sfile->smoothscroll_timer = NULL;
+ }
return OPERATOR_PASS_THROUGH;
}
@@ -1613,8 +1628,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
return OPERATOR_PASS_THROUGH;
}
- offset = ED_fileselect_layout_offset(sfile->layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax);
- if (offset < 0) offset = 0;
+ offset = max_ii(0, ED_fileselect_layout_offset(sfile->layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax));
/* scroll offset is the first file in the row/column we are editing in */
if (sfile->scroll_offset == 0) {
@@ -1629,11 +1643,21 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
}
numfiles_layout = ED_fileselect_layout_numfiles(sfile->layout, ar);
+ /* Using margins helps avoiding scrolling to stop when target item is barely visible on one side of the screen
+ * (i.e. it centers a bit more the target). */
+ int numfiles_layout_margin = max_ii(0, numfiles_layout / 3);
/* check if we have reached our final scroll position */
- if ( (sfile->scroll_offset >= offset) && (sfile->scroll_offset < offset + numfiles_layout) ) {
+ if ((sfile->scroll_offset >= offset + numfiles_layout_margin) &&
+ (sfile->scroll_offset < offset + numfiles_layout - numfiles_layout_margin))
+ {
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
sfile->smoothscroll_timer = NULL;
+ /* Postscroll (after rename has been validated by user) is done, rename process is totally finisehd, cleanup. */
+ if ((params->rename_flag & FILE_PARAMS_RENAME_POSTSCROLL_ACTIVE) != 0) {
+ params->renamefile[0] = '\0';
+ params->rename_flag = 0;
+ }
return OPERATOR_FINISHED;
}
@@ -1671,7 +1695,6 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
void FILE_OT_smoothscroll(wmOperatorType *ot)
{
-
/* identifiers */
ot->name = "Smooth Scroll";
ot->idname = "FILE_OT_smoothscroll";
@@ -1802,9 +1825,14 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
/* now remember file to jump into editing */
BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE);
+ sfile->params->rename_flag = FILE_PARAMS_RENAME_PENDING;
/* set timer to smoothly view newly generated file */
- sfile->smoothscroll_timer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER1, 1.0 / 1000.0); /* max 30 frs/sec */
+ /* max 30 frs/sec */
+ if (sfile->smoothscroll_timer != NULL) {
+ WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
+ }
+ sfile->smoothscroll_timer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER1, 1.0 / 1000.0);
sfile->scroll_offset = 0;
/* reload dir to make sure we're seeing what's in the directory */
@@ -2001,7 +2029,8 @@ void file_filename_enter_handle(bContext *C, void *UNUSED(arg_unused), void *arg
BLI_filename_make_safe(sfile->params->file);
if (matches) {
- /* replace the pattern (or filename that the user typed in, with the first selected file of the match */
+ /* replace the pattern (or filename that the user typed in,
+ * with the first selected file of the match */
BLI_strncpy(sfile->params->file, matched_file, sizeof(sfile->params->file));
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
@@ -2191,8 +2220,9 @@ static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
if ((0 <= idx) && (idx < numfiles)) {
FileDirEntry *file = filelist_file(sfile->files, idx);
filelist_entry_select_index_set(sfile->files, idx, FILE_SEL_ADD, FILE_SEL_EDITING, CHECK_ALL);
- BLI_strncpy(sfile->params->renameedit, file->relpath, FILE_MAXFILE);
- sfile->params->renamefile[0] = '\0';
+ BLI_strncpy(sfile->params->renamefile, file->relpath, FILE_MAXFILE);
+ /* We can skip the pending state, as we can directly set FILE_SEL_EDITING on the expected entry here. */
+ sfile->params->rename_flag = FILE_PARAMS_RENAME_ACTIVE;
}
ED_area_tag_redraw(sa);
}
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index cbf685e6ed8..058ba9bfef3 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Andrea Weikert
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/file_panels.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
#include "BLI_blenlib.h"
diff --git a/source/blender/editors/space_file/file_utils.c b/source/blender/editors/space_file/file_utils.c
index fc870399696..0294b635910 100644
--- a/source/blender/editors/space_file/file_utils.c
+++ b/source/blender/editors/space_file/file_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,13 @@
* 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): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/file_utils.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
#include "BLI_rect.h"
-#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLO_readfile.h"
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 218c7dcdb42..eec30adff10 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/filelist.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
@@ -51,7 +43,6 @@
#include "BLI_fileops_types.h"
#include "BLI_fnmatch.h"
#include "BLI_ghash.h"
-#include "BLI_hash_md5.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_stack.h"
@@ -165,7 +156,8 @@ int folderlist_clear_next(struct SpaceFile *sfile)
if (!sfile->folders_next)
return 0;
- /* if previous_folder, next_folder or refresh_folder operators are executed it doesn't clear folder_next */
+ /* if previous_folder, next_folder or refresh_folder operators are executed
+ * it doesn't clear folder_next */
folder = sfile->folders_prev->last;
if ((!folder) || (BLI_path_cmp(folder->foldername, sfile->params->dir) == 0))
return 0;
@@ -208,19 +200,24 @@ ListBase *folderlist_duplicate(ListBase *folderlist)
typedef struct FileListInternEntry {
struct FileListInternEntry *next, *prev;
- char uuid[16]; /* ASSET_UUID_LENGTH */
+ /** ASSET_UUID_LENGTH */
+ char uuid[16];
- int typeflag; /* eFileSel_File_Types */
- int blentype; /* ID type, in case typeflag has FILE_TYPE_BLENDERLIB set. */
+ /** eFileSel_File_Types */
+ int typeflag;
+ /** ID type, in case typeflag has FILE_TYPE_BLENDERLIB set. */
+ int blentype;
char *relpath;
- char *name; /* not strictly needed, but used during sorting, avoids to have to recompute it there... */
+ /** not strictly needed, but used during sorting, avoids to have to recompute it there... */
+ char *name;
BLI_stat_t st;
} FileListInternEntry;
typedef struct FileListIntern {
- ListBase entries; /* FileListInternEntry items. */
+ /** FileListInternEntry items. */
+ ListBase entries;
FileListInternEntry **filtered;
char curr_uuid[16]; /* Used to generate uuid during internal listing. */
@@ -235,7 +232,8 @@ typedef struct FileListEntryCache {
/* This one gathers all entries from both block and misc caches. Used for easy bulk-freing. */
ListBase cached_entries;
- /* Block cache: all entries between start and end index. used for part of the list on display. */
+ /* Block cache: all entries between start and end index.
+ * used for part of the list on display. */
FileDirEntry **block_entries;
int block_start_index, block_end_index, block_center_index, block_cursor;
@@ -347,7 +345,7 @@ enum {
SPECIAL_IMG_UNKNOWNFILE = 9,
SPECIAL_IMG_LOADING = 10,
SPECIAL_IMG_BACKUP = 11,
- SPECIAL_IMG_MAX
+ SPECIAL_IMG_MAX,
};
static ImBuf *gSpecialFileImages[SPECIAL_IMG_MAX];
@@ -910,7 +908,8 @@ static int filelist_geticon_ex(
return ICON_FILE_BLEND;
}
else if (is_main) {
- /* Do not return icon for folders if icons are not 'main' draw type (e.g. when used over previews). */
+ /* Do not return icon for folders if icons are not 'main' draw type
+ * (e.g. when used over previews). */
return ICON_FILE_FOLDER;
}
}
@@ -1002,7 +1001,8 @@ static void filelist_entry_clear(FileDirEntry *entry)
if (entry->image) {
IMB_freeImBuf(entry->image);
}
- /* For now, consider FileDirEntryRevision::poin as not owned here, so no need to do anything about it */
+ /* For now, consider FileDirEntryRevision::poin as not owned here,
+ * so no need to do anything about it */
if (!BLI_listbase_is_empty(&entry->variants)) {
FileDirEntryVariant *var;
@@ -1348,7 +1348,8 @@ void filelist_free(struct FileList *filelist)
return;
}
- filelist_clear_ex(filelist, false, false); /* No need to clear cache & selection_state, we free them anyway. */
+ /* No need to clear cache & selection_state, we free them anyway. */
+ filelist_clear_ex(filelist, false, false);
filelist_cache_free(&filelist->filelist_cache);
if (filelist->selection_state) {
@@ -1561,7 +1562,8 @@ int filelist_file_findpath(struct FileList *filelist, const char *filename)
}
/* XXX TODO Cache could probably use a ghash on paths too? Not really urgent though.
- * This is only used to find again renamed entry, annoying but looks hairy to get rid of it currently. */
+ * This is only used to find again renamed entry,
+ * annoying but looks hairy to get rid of it currently. */
for (fidx = 0; fidx < filelist->filelist.nbr_entries_filtered; fidx++) {
FileListInternEntry *entry = filelist->filelist_intern.filtered[fidx];
@@ -1602,7 +1604,8 @@ FileDirEntry *filelist_entry_find_uuid(struct FileList *filelist, const int uuid
void filelist_file_cache_slidingwindow_set(FileList *filelist, size_t window_size)
{
- /* Always keep it power of 2, in [256, 8192] range for now, cache being app. twice bigger than requested window. */
+ /* Always keep it power of 2, in [256, 8192] range for now,
+ * cache being app. twice bigger than requested window. */
size_t size = 256;
window_size *= 2;
@@ -1723,8 +1726,9 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
else {
// printf("Partial Recaching!\n");
- /* At this point, we know we keep part of currently cached entries, so update previews if needed,
- * and remove everything from working queue - we'll add all newly needed entries at the end. */
+ /* At this point, we know we keep part of currently cached entries, so update previews
+ * if needed, and remove everything from working queue - we'll add all newly needed
+ * entries at the end. */
if (cache->flags & FLC_PREVIEWS_ACTIVE) {
filelist_cache_previews_update(filelist);
filelist_cache_previews_clear(cache);
@@ -1737,7 +1741,9 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
int size2 = 0;
int idx1 = cache->block_cursor, idx2 = 0;
-// printf("\tcache releasing: [%d:%d] (%d, %d)\n", cache->block_start_index, cache->block_start_index + size1, cache->block_cursor, size1);
+// printf("\tcache releasing: [%d:%d] (%d, %d)\n",
+// cache->block_start_index, cache->block_start_index + size1,
+// cache->block_cursor, size1);
if (idx1 + size1 > cache_size) {
size2 = idx1 + size1 - cache_size;
@@ -1754,7 +1760,8 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
int size2 = 0;
int idx1, idx2 = 0;
-// printf("\tcache releasing: [%d:%d] (%d)\n", cache->block_end_index - size1, cache->block_end_index, cache->block_cursor);
+// printf("\tcache releasing: [%d:%d] (%d)\n",
+// cache->block_end_index - size1, cache->block_end_index, cache->block_cursor);
idx1 = (cache->block_cursor + end_index - cache->block_start_index) % cache_size;
if (idx1 + size1 > cache_size) {
@@ -1771,7 +1778,8 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
if (start_index < cache->block_start_index) {
/* Add (request) needed entries before already cached ones. */
- /* Note: We need some index black magic to wrap around (cycle) inside our cache_size array... */
+ /* Note: We need some index black magic to wrap around (cycle)
+ * inside our cache_size array... */
int size1 = cache->block_start_index - start_index;
int size2 = 0;
int idx1, idx2;
@@ -1802,7 +1810,8 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
// printf("\tstart-extended...\n");
if (end_index > cache->block_end_index) {
/* Add (request) needed entries after already cached ones. */
- /* Note: We need some index black magic to wrap around (cycle) inside our cache_size array... */
+ /* Note: We need some index black magic to wrap around (cycle)
+ * inside our cache_size array... */
int size1 = end_index - cache->block_end_index;
int size2 = 0;
int idx1, idx2;
@@ -1899,11 +1908,13 @@ bool filelist_cache_previews_update(FileList *filelist)
FileListEntryPreview *preview = BLI_thread_queue_pop(cache->previews_done);
FileDirEntry *entry;
- /* Paranoid (should never happen currently since we consume this queue from a single thread), but... */
+ /* Paranoid (should never happen currently
+ * since we consume this queue from a single thread), but... */
if (!preview) {
continue;
}
- /* entry might have been removed from cache in the mean time, we do not want to cache it again here. */
+ /* entry might have been removed from cache in the mean time,
+ * we do not want to cache it again here. */
entry = filelist_file_ex(filelist, preview->index, false);
// printf("%s: %d - %s - %p\n", __func__, preview->index, preview->path, preview->img);
@@ -1921,7 +1932,8 @@ bool filelist_cache_previews_update(FileList *filelist)
}
else if (entry) {
/* We want to avoid re-processing this entry continuously!
- * Note that, since entries only live in cache, preview will be retried quite often anyway. */
+ * Note that, since entries only live in cache,
+ * preview will be retried quite often anyway. */
entry->flags |= FILE_ENTRY_INVALID_PREVIEW;
}
@@ -1964,7 +1976,8 @@ static bool file_is_blend_backup(const char *str)
return (retval);
}
-/* TODO: Maybe we should move this to BLI? On the other hand, it's using defines from spacefile area, so not sure... */
+/* TODO: Maybe we should move this to BLI?
+ * On the other hand, it's using defines from spacefile area, so not sure... */
int ED_path_extension_type(const char *path)
{
if (BLO_has_bfile_extension(path)) {
@@ -2268,7 +2281,8 @@ static int filelist_readjob_list_lib(const char *root, ListBase *entries, const
return nbr_entries;
}
- /* memory for strings is passed into filelist[i].entry->relpath and freed in filelist_entry_free. */
+ /* memory for strings is passed into filelist[i].entry->relpath
+ * and freed in filelist_entry_free. */
if (group) {
idcode = groupname_to_code(group);
names = BLO_blendhandle_get_datablock_names(libfiledata, idcode, &nnames);
@@ -2311,7 +2325,8 @@ static int filelist_readjob_list_lib(const char *root, ListBase *entries, const
}
#if 0
-/* Kept for reference here, in case we want to add back that feature later. We do not need it currently. */
+/* Kept for reference here, in case we want to add back that feature later.
+ * We do not need it currently. */
/* Code ***NOT*** updated for job stuff! */
static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
{
@@ -2385,7 +2400,8 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
}
}
- /* XXX TODO: if databrowse F4 or append/link filelist->flags & FLF_HIDE_PARENT has to be set */
+ /* XXX TODO: if databrowse F4 or append/link
+ * filelist->flags & FLF_HIDE_PARENT has to be set */
if (!(filelist->filter_data.flags & FLF_HIDE_PARENT))
filelist->filelist.nbr_entries++;
@@ -2499,10 +2515,11 @@ static void filelist_readjob_do(
BLI_stack_discard(todo_dirs);
- /* ARRRG! We have to be very careful *not to use* common BLI_path_util helpers over entry->relpath itself
- * (nor any path containing it), since it may actually be a datablock name inside .blend file,
- * which can have slashes and backslashes! See T46827.
- * Note that in the end, this means we 'cache' valid relative subdir once here, this is actually better. */
+ /* ARRRG! We have to be very careful *not to use* common BLI_path_util helpers over
+ * entry->relpath itself (nor any path containing it), since it may actually be a datablock
+ * name inside .blend file, which can have slashes and backslashes! See T46827.
+ * Note that in the end, this means we 'cache' valid relative subdir once here,
+ * this is actually better. */
BLI_strncpy(rel_subdir, subdir, sizeof(rel_subdir));
BLI_cleanup_dir(root, rel_subdir);
BLI_path_rel(rel_subdir, root);
@@ -2521,13 +2538,15 @@ static void filelist_readjob_do(
/* Generate our entry uuid. Abusing uuid as an uint32, shall be more than enough here,
* things would crash way before we overflow that counter!
* Using an atomic operation to avoid having to lock thread...
- * Note that we do not really need this here currently, since there is a single listing thread, but better
+ * Note that we do not really need this here currently,
+ * since there is a single listing thread, but better
* remain consistent about threading! */
*((uint32_t *)entry->uuid) = atomic_add_and_fetch_uint32((uint32_t *)filelist->filelist_intern.curr_uuid, 1);
/* Only thing we change in direntry here, so we need to free it first. */
MEM_freeN(entry->relpath);
- entry->relpath = BLI_strdup(dir + 2); /* + 2 to remove '//' added by BLI_path_rel to rel_subdir */
+ entry->relpath = BLI_strdup(dir + 2); /* + 2 to remove '//'
+ * added by BLI_path_rel to rel_subdir */
entry->name = BLI_strdup(fileentry_uiname(root, entry->relpath, entry->typeflag, dir));
/* Here we decide whether current filedirentry is to be listed too, or not. */
@@ -2568,7 +2587,8 @@ static void filelist_readjob_do(
MEM_freeN(subdir);
}
- /* If we were interrupted by stop, stack may not be empty and we need to free pending dir paths. */
+ /* If we were interrupted by stop, stack may not be empty and we need to free
+ * pending dir paths. */
while (!BLI_stack_is_empty(todo_dirs)) {
td_dir = BLI_stack_peek(todo_dirs);
MEM_freeN(td_dir->dir);
@@ -2601,7 +2621,8 @@ typedef struct FileListReadJob {
ThreadMutex lock;
char main_name[FILE_MAX];
struct FileList *filelist;
- struct FileList *tmp_filelist; /* XXX We may use a simpler struct here... just a linked list and root path? */
+ /** XXX We may use a simpler struct here... just a linked list and root path? */
+ struct FileList *tmp_filelist;
} FileListReadJob;
static void filelist_readjob_startjob(void *flrjv, short *stop, short *do_update, float *progress)
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h
index 6d898ee2fe9..0cfef16c00d 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/filelist.h
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
@@ -47,13 +39,13 @@ struct FileDirEntry;
typedef enum FileSelType {
FILE_SEL_REMOVE = 0,
FILE_SEL_ADD = 1,
- FILE_SEL_TOGGLE = 2
+ FILE_SEL_TOGGLE = 2,
} FileSelType;
typedef enum FileCheckType {
CHECK_DIRS = 1,
CHECK_FILES = 2,
- CHECK_ALL = 3
+ CHECK_ALL = 3,
} FileCheckType;
struct ListBase *folderlist_new(void);
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index cb014f30d95..5195fa818d6 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/filesel.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
@@ -55,27 +48,24 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_fileops_types.h"
#include "BLI_fnmatch.h"
#include "BKE_appdir.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BLF_api.h"
-
#include "ED_fileselect.h"
#include "WM_api.h"
#include "WM_types.h"
-
#include "RNA_access.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
+#include "UI_view2d.h"
#include "file_intern.h"
#include "filelist.h"
@@ -547,7 +537,9 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
layout->prv_border_y = 0;
layout->tile_h = textheight * 3 / 2;
layout->height = (int)(BLI_rctf_size_y(&v2d->cur) - 2 * layout->tile_border_y);
- layout->rows = layout->height / (layout->tile_h + 2 * layout->tile_border_y);
+ /* Padding by full scrollbar H is too much, can overlap tile border Y. */
+ layout->rows = (layout->height - V2D_SCROLL_HEIGHT + layout->tile_border_y) /
+ (layout->tile_h + 2 * layout->tile_border_y);
column_widths(params, layout);
@@ -627,7 +619,8 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matche
*/
for (i = 0; i < n; i++) {
file = filelist_file(sfile->files, i);
- /* Do not check whether file is a file or dir here! Causes T44243 (we do accept dirs at this stage). */
+ /* Do not check whether file is a file or dir here! Causes T44243
+ * (we do accept dirs at this stage). */
if (fnmatch(pattern, file->relpath, 0) == 0) {
filelist_entry_select_set(sfile->files, file, FILE_SEL_ADD, FILE_SEL_SELECTED, CHECK_ALL);
if (!match) {
@@ -739,5 +732,39 @@ void ED_fileselect_exit(wmWindowManager *wm, ScrArea *sa, SpaceFile *sfile)
MEM_freeN(sfile->files);
sfile->files = NULL;
}
+}
+
+/** Helper used by both main update code, and smoothscroll timer, to try to enable rename editing from
+ * params->renamefile name. */
+void file_params_renamefile_activate(SpaceFile *sfile, FileSelectParams *params)
+{
+ BLI_assert(params->rename_flag != 0);
+
+ if ((params->rename_flag & (FILE_PARAMS_RENAME_ACTIVE | FILE_PARAMS_RENAME_POSTSCROLL_ACTIVE)) != 0) {
+ return;
+ }
+
+ BLI_assert(params->renamefile[0] != '\0');
+
+ const int idx = filelist_file_findpath(sfile->files, params->renamefile);
+ if (idx >= 0) {
+ FileDirEntry *file = filelist_file(sfile->files, idx);
+ BLI_assert(file != NULL);
+ if ((params->rename_flag & FILE_PARAMS_RENAME_PENDING) != 0) {
+ filelist_entry_select_set(sfile->files, file, FILE_SEL_ADD, FILE_SEL_EDITING, CHECK_ALL);
+ params->rename_flag = FILE_PARAMS_RENAME_ACTIVE;
+ }
+ else if ((params->rename_flag & FILE_PARAMS_RENAME_POSTSCROLL_PENDING) != 0) {
+ filelist_entry_select_set(sfile->files, file, FILE_SEL_ADD, FILE_SEL_HIGHLIGHTED, CHECK_ALL);
+ params->renamefile[0] = '\0';
+ params->rename_flag = FILE_PARAMS_RENAME_POSTSCROLL_ACTIVE;
+ }
+ }
+ /* File listing is now async, only reset renaming if matching entry is not found
+ * when file listing is not done. */
+ else if (filelist_is_ready(sfile->files)) {
+ params->renamefile[0] = '\0';
+ params->rename_flag = 0;
+ }
}
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 9b1aae03219..c3c85600121 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Andrea Weikert (c) 2008 Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/fsmenu.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
@@ -45,9 +37,11 @@
#include "ED_fileselect.h"
#ifdef WIN32
-# include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
-# include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
- * because 'near' is disabled through BLI_windstuff */
+ /* Need to include windows.h so _WIN32_IE is defined. */
+# include <windows.h>
+ /* For SHGetSpecialFolderPath, has to be done before BLI_winstuff
+ * because 'near' is disabled through BLI_windstuff. */
+# include <shlobj.h>
# include "BLI_winstuff.h"
#endif
@@ -510,7 +504,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
{
/* Get mounted volumes better method OSX 10.6 and higher, see: */
/*https://developer.apple.com/library/mac/#documentation/CoreFOundation/Reference/CFURLRef/Reference/reference.html*/
- /* we get all volumes sorted including network and do not relay on user-defined finder visibility, less confusing */
+
+ /* we get all volumes sorted including network and do not relay
+ * on user-defined finder visibility, less confusing */
CFURLRef cfURL = NULL;
CFURLEnumeratorResult result = kCFURLEnumeratorSuccess;
@@ -644,7 +640,8 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
* Assuming every entry ends with the share name */
const char *label = strstr(dirname, "share=");
if (label != NULL) {
- /* Move pointer so "share=" is trimmed off or use full dirname as label. */
+ /* Move pointer so "share=" is trimmed off
+ * or use full dirname as label. */
const char *label_test = label + 6;
label = *label_test ? label_test : dirname;
}
diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h
index e5a59e356eb..f20016e6895 100644
--- a/source/blender/editors/space_file/fsmenu.h
+++ b/source/blender/editors/space_file/fsmenu.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/space_file/fsmenu.h
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index fb6dfdad4db..5a4b0e36ae1 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_file/space_file.c
- * \ingroup spfile
+/** \file
+ * \ingroup spfile
*/
#include <string.h>
@@ -33,11 +26,9 @@
#include "MEM_guardedalloc.h"
-#include "BIF_gl.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_fileops_types.h"
#include "BKE_appdir.h"
@@ -268,20 +259,8 @@ static void file_refresh(const bContext *C, ScrArea *sa)
}
}
- if (params->renamefile[0] != '\0') {
- int idx = filelist_file_findpath(sfile->files, params->renamefile);
- if (idx >= 0) {
- FileDirEntry *file = filelist_file(sfile->files, idx);
- if (file) {
- filelist_entry_select_set(sfile->files, file, FILE_SEL_ADD, FILE_SEL_EDITING, CHECK_ALL);
- }
- }
- BLI_strncpy(sfile->params->renameedit, sfile->params->renamefile, sizeof(sfile->params->renameedit));
- /* File listing is now async, do not clear renamefile if matching entry not found
- * and dirlist is not finished! */
- if (idx >= 0 || filelist_is_ready(sfile->files)) {
- params->renamefile[0] = '\0';
- }
+ if (params->rename_flag != 0) {
+ file_params_renamefile_activate(sfile, params);
}
if (sfile->layout) {
diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt
index 2840324e65e..20e2ebc0936 100644
--- a/source/blender/editors/space_graph/CMakeLists.txt
+++ b/source/blender/editors/space_graph/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index c3d6c1f6435..a4d7b5e9fc9 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_buttons.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -116,7 +109,7 @@ static bool graph_panel_poll(const bContext *C, PanelType *UNUSED(pt))
static void graph_panel_view(const bContext *C, Panel *pa)
{
bScreen *sc = CTX_wm_screen(C);
- SpaceIpo *sipo = CTX_wm_space_graph(C);
+ SpaceGraph *sipo = CTX_wm_space_graph(C);
Scene *scene = CTX_data_scene(C);
PointerRNA spaceptr, sceneptr;
uiLayout *col, *sub, *row;
@@ -584,7 +577,7 @@ static void driver_update_flags_cb(bContext *UNUSED(C), void *fcu_v, void *UNUSE
/* drivers panel poll */
static bool graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt))
{
- SpaceIpo *sipo = CTX_wm_space_graph(C);
+ SpaceGraph *sipo = CTX_wm_space_graph(C);
if (sipo->mode != SIPO_MODE_DRIVERS)
return 0;
@@ -687,7 +680,9 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", IFACE_("Bone"), ICON_BONE_DATA);
}
- uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */
+ /* we can clear it again now - it's only needed when creating the ID/Bone fields */
+ uiLayoutSetRedAlert(col, false);
+
uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
/* Object 2 */
@@ -702,7 +697,9 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", IFACE_("Bone"), ICON_BONE_DATA);
}
- uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */
+ /* we can clear it again now - it's only needed when creating the ID/Bone fields */
+ uiLayoutSetRedAlert(col, false);
+
uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE);
}
@@ -821,7 +818,7 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, ID *id, FCurve *f
uiItemL(col, IFACE_("ERROR: Invalid Python expression"), ICON_CANCEL);
}
else if (!BKE_driver_has_simple_expression(driver)) {
- if ((G.f & G_SCRIPT_AUTOEXEC) == 0) {
+ if ((G.f & G_FLAG_SCRIPT_AUTOEXEC) == 0) {
/* TODO: Add button to enable? */
uiItemL(col, IFACE_("WARNING: Python expressions limited for security"), ICON_ERROR);
}
@@ -922,14 +919,22 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, ID *id, FCurve *f
subrow = uiLayoutRow(row, true);
/* 1.1.1) variable type */
- sub = uiLayoutRow(subrow, true); /* HACK: special group just for the enum, otherwise we */
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */
+
+ /* HACK: special group just for the enum,
+ * otherwise we get ugly layout with text included too... */
+ sub = uiLayoutRow(subrow, true);
+
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
uiItemR(sub, &dvar_ptr, "type", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
/* 1.1.2) variable name */
- sub = uiLayoutRow(subrow, true); /* HACK: special group to counteract the effects of the previous */
- uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */
+
+ /* HACK: special group to counteract the effects of the previous enum,
+ * which now pushes everything too far right */
+ sub = uiLayoutRow(subrow, true);
+
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND);
uiItemR(sub, &dvar_ptr, "name", 0, "", ICON_NONE);
@@ -993,7 +998,8 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, ID *id, FCurve *f
uiItemS(layout);
uiItemS(layout);
- /* XXX: This should become redundant. But sometimes the flushing fails, so keep this around for a while longer as a "last resort" */
+ /* XXX: This should become redundant. But sometimes the flushing fails,
+ * so keep this around for a while longer as a "last resort" */
row = uiLayoutRow(layout, true);
block = uiLayoutGetBlock(row);
but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_FILE_REFRESH, IFACE_("Update Dependencies"),
@@ -1020,7 +1026,8 @@ static void graph_panel_driven_property(const bContext *C, Panel *pa)
MEM_freeN(ale);
}
-/* driver settings for active F-Curve (only for 'Drivers' mode in Graph Editor, i.e. the full "Drivers Editor") */
+/* driver settings for active F-Curve
+ * (only for 'Drivers' mode in Graph Editor, i.e. the full "Drivers Editor") */
static void graph_panel_drivers(const bContext *C, Panel *pa)
{
bAnimListElem *ale;
@@ -1142,7 +1149,7 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
col = uiLayoutColumn(pa->layout, true);
uiLayoutSetActive(col, active);
- ANIM_uiTemplate_fmodifier_draw(col, ale->id, &fcu->modifiers, fcm);
+ ANIM_uiTemplate_fmodifier_draw(col, ale->fcurve_owner_id, &fcu->modifiers, fcm);
}
MEM_freeN(ale);
@@ -1198,7 +1205,9 @@ void graph_buttons_register(ARegionType *art)
pt->draw = graph_panel_drivers_popover;
pt->poll = graph_panel_drivers_popover_poll;
BLI_addtail(&art->paneltypes, pt);
- WM_paneltype_add(pt); /* This panel isn't used in this region. Add explicitly to global list (so popovers work). */
+ /* This panel isn't used in this region.
+ * Add explicitly to global list (so popovers work). */
+ WM_paneltype_add(pt);
pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel modifiers");
strcpy(pt->idname, "GRAPH_PT_modifiers");
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index d4f6824ccdf..535ec6e8da9 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) Blender Foundation
- *
- * Contributor(s): Joshua Leung (2009 Recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_draw.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -46,7 +40,6 @@
#include "BKE_curve.h"
#include "BKE_fcurve.h"
-#include "BIF_glutil.h"
#include "GPU_draw.h"
#include "GPU_immediate.h"
@@ -245,13 +238,19 @@ static void draw_fcurve_selected_handle_vertices(FCurve *fcu, View2D *v2d, bool
*/
if (!sel_handle_only || BEZT_ISSEL_ANY(bezt)) {
if ((!prevbezt && (bezt->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))) {
- if ((bezt->f1 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/
+ if ((bezt->f1 & SELECT) == sel
+ /* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax) */ )
+ {
immVertex2fv(pos, bezt->vec[0]);
+ }
}
if (bezt->ipo == BEZT_IPO_BEZ) {
- if ((bezt->f3 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax)*/
+ if ((bezt->f3 & SELECT) == sel
+ /* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax) */ )
+ {
immVertex2fv(pos, bezt->vec[2]);
+ }
}
}
}
@@ -291,7 +290,8 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool
GPU_blend(true);
GPU_enable_program_point_size();
- /* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
+ /* draw the two handles first (if they're shown, the curve doesn't
+ * have just a single keyframe, and the curve is being edited) */
if (do_handles) {
draw_fcurve_handle_vertices(fcu, v2d, sel_handle_only, pos);
}
@@ -305,16 +305,23 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool
/* Handles ---------------- */
-static bool draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
+static bool draw_fcurve_handles_check(SpaceGraph *sipo, FCurve *fcu)
{
/* don't draw handle lines if handles are not to be shown */
- if ( (sipo->flag & SIPO_NOHANDLES) || /* handles shouldn't be shown anywhere */
- (fcu->flag & FCURVE_PROTECTED) || /* keyframes aren't editable */
+ if (
+ /* handles shouldn't be shown anywhere */
+ (sipo->flag & SIPO_NOHANDLES) ||
+ /* keyframes aren't editable */
+ (fcu->flag & FCURVE_PROTECTED) ||
#if 0 /* handles can still be selected and handle types set, better draw - campbell */
- (fcu->flag & FCURVE_INT_VALUES) || /* editing the handles here will cause weird/incorrect interpolation issues */
+ /* editing the handles here will cause weird/incorrect interpolation issues */
+ (fcu->flag & FCURVE_INT_VALUES) ||
#endif
- ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) || /* group that curve belongs to is not editable */
- (fcu->totvert <= 1) /* do not show handles if there is only 1 keyframe, otherwise they all clump together in an ugly ball */
+ /* group that curve belongs to is not editable */
+ ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ||
+ /* do not show handles if there is only 1 keyframe,
+ * otherwise they all clump together in an ugly ball */
+ (fcu->totvert <= 1)
)
{
return false;
@@ -326,7 +333,7 @@ static bool draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
/* draw lines for F-Curve handles only (this is only done in EditMode)
* note: draw_fcurve_handles_check must be checked before running this. */
-static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
+static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu)
{
int sel, b;
@@ -440,7 +447,7 @@ static void draw_fcurve_sample_control(float x, float y, float xscale, float ysc
}
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
+static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *ar, FCurve *fcu)
{
FPoint *first, *last;
float hsize, xscale, yscale;
@@ -477,10 +484,9 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
/* Curve ---------------- */
/* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */
-static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid, unsigned int pos)
+static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu_, View2D *v2d, View2DGrid *grid, unsigned int pos)
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
- ChannelDriver *driver;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
float samplefreq;
float stime, etime;
float unitFac, offset;
@@ -495,12 +501,12 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
return;
- /* disable any drivers temporarily */
- driver = fcu->driver;
- fcu->driver = NULL;
+ /* disable any drivers */
+ FCurve fcurve_for_draw = *fcu_;
+ fcurve_for_draw.driver = NULL;
/* compute unit correction factor */
- unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
+ unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, &fcurve_for_draw, mapping_flag, &offset);
/* Note about sampling frequency:
* Ideally, this is chosen such that we have 1-2 pixels = 1 segment
@@ -514,7 +520,8 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
* loop (i.e. too close to 0), then clamp it to a determined "safe" value. The value
* chosen here is just the coarsest value which still looks reasonable...
*/
- /* grid->dx represents the number of 'frames' between gridlines, but we divide by U.v2d_min_gridsize to get pixels-steps */
+ /* grid->dx represents the number of 'frames' between gridlines,
+ * but we divide by U.v2d_min_gridsize to get pixels-steps */
/* TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted? */
samplefreq = dx / (U.v2d_min_gridsize * U.pixelsize);
@@ -555,14 +562,11 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
for (i = 0; i <= n; i++) {
float ctime = stime + i * samplefreq;
- immVertex2f(pos, ctime, (evaluate_fcurve(fcu, ctime) + offset) * unitFac);
+ immVertex2f(pos, ctime, (evaluate_fcurve(&fcurve_for_draw, ctime) + offset) * unitFac);
}
immEnd();
}
-
- /* restore driver */
- fcu->driver = driver;
}
/* helper func - draw a samples-based F-Curve */
@@ -726,7 +730,8 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
/* TODO: optimize this to not have to calc stuff out of view too? */
while (b--) {
if (prevbezt->ipo == BEZT_IPO_CONST) {
- /* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */
+ /* Constant-Interpolation: draw segment between previous keyframe and next,
+ * but holding same value */
v1[0] = prevbezt->vec[1][0];
v1[1] = prevbezt->vec[1][1];
immVertex2fv(pos, v1);
@@ -746,7 +751,8 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
* - resol determines number of points to sample in between keyframes
*/
- /* resol depends on distance between points (not just horizontal) OR is a fixed high res */
+ /* resol depends on distance between points
+ * (not just horizontal) OR is a fixed high res */
/* TODO: view scale should factor into this someday too... */
if (fcu->driver) {
resol = 32;
@@ -956,7 +962,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
* NOTE: unit mapping has already been applied to the values, so do not try and apply again
*/
-void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
+void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar)
{
FCurve *fcu;
@@ -1004,7 +1010,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
/* This is called twice from space_graph.c -> graph_main_region_draw()
* Unselected then selected F-Curves are drawn so that they do not occlude each other.
*/
-void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid, short sel)
+void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, View2DGrid *grid, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 00418d6482a..a85e638e6d8 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_edit.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -58,7 +50,6 @@
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
-#include "BKE_main.h"
#include "BKE_nla.h"
#include "BKE_report.h"
@@ -279,7 +270,8 @@ void GRAPH_OT_view_all(wmOperatorType *ot)
/* 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... */
+ /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */
+ ot->poll = ED_operator_graphedit_active;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -298,7 +290,8 @@ void GRAPH_OT_view_selected(wmOperatorType *ot)
/* 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... */
+ /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */
+ ot->poll = ED_operator_graphedit_active;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -340,7 +333,7 @@ void GRAPH_OT_view_frame(wmOperatorType *ot)
/* Bake each F-Curve into a set of samples, and store as a ghost curve */
static void create_ghost_curves(bAnimContext *ac, int start, int end)
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
@@ -456,12 +449,12 @@ void GRAPH_OT_ghost_curves_create(wmOperatorType *ot)
static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
{
bAnimContext ac;
- SpaceIpo *sipo;
+ SpaceGraph *sipo;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- sipo = (SpaceIpo *)ac.sl;
+ sipo = (SpaceGraph *)ac.sl;
/* if no ghost curves, don't do anything */
if (BLI_listbase_is_empty(&sipo->runtime.ghost_curves)) {
@@ -515,7 +508,7 @@ static const EnumPropertyItem prop_graphkeys_insertkey_types[] = {
"Active Channels At Cursor", "Insert a keyframe for the active F-Curve at the cursor point"},
{GRAPHKEYS_INSERTKEY_SEL | GRAPHKEYS_INSERTKEY_CURSOR, "CURSOR_SEL", 0,
"Selected Channels At Cursor", "Insert a keyframe for selected F-Curves at the cursor point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for snapping keyframes to frame-times */
@@ -528,7 +521,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
size_t num_items;
ReportList *reports = ac->reports;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
struct Depsgraph *depsgraph = ac->depsgraph;
Scene *scene = ac->scene;
ToolSettings *ts = scene->toolsettings;
@@ -615,7 +608,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
else if (adt)
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
- const float curval = evaluate_fcurve(fcu, cfra);
+ const float curval = evaluate_fcurve_only_curve(fcu, cfra);
insert_vert_fcurve(fcu, cfra, curval, ts->keyframe_type, 0);
}
@@ -1479,7 +1472,7 @@ static const EnumPropertyItem prop_graphkeys_expo_types[] = {
{MAKE_CYCLIC_EXPO, "MAKE_CYCLIC", 0, "Make Cyclic (F-Modifier)", "Add Cycles F-Modifier if one doesn't exist already"},
{CLEAR_CYCLIC_EXPO, "CLEAR_CYCLIC", 0, "Clear Cyclic (F-Modifier)", "Remove Cycles F-Modifier if not needed anymore"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for setting extrapolation mode for keyframes */
@@ -1801,9 +1794,12 @@ void GRAPH_OT_handle_type(wmOperatorType *ot)
typedef struct tEulerFilter {
struct tEulerFilter *next, *prev;
- ID *id; /* ID-block which owns the channels */
- FCurve *(fcurves[3]); /* 3 Pointers to F-Curves */
- const char *rna_path; /* Pointer to one of the RNA Path's used by one of the F-Curves */
+ /** ID-block which owns the channels */
+ ID *id;
+ /** 3 Pointers to F-Curves */
+ FCurve *(fcurves[3]);
+ /** Pointer to one of the RNA Path's used by one of the F-Curves */
+ const char *rna_path;
} tEulerFilter;
static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
@@ -1864,7 +1860,8 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
groups++;
euf->id = ale->id;
- euf->rna_path = fcu->rna_path; /* this should be safe, since we're only using it for a short time */
+ /* this should be safe, since we're only using it for a short time */
+ euf->rna_path = fcu->rna_path;
euf->fcurves[fcu->array_index] = fcu;
}
@@ -1884,7 +1881,8 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
int f;
/* sanity check: ensure that there are enough F-Curves to work on in this group */
- /* TODO: also enforce assumption that there be a full set of keyframes at each position by ensuring that totvert counts are same? */
+ /* TODO: also enforce assumption that there be a full set of keyframes
+ * at each position by ensuring that totvert counts are same? */
if (ELEM(NULL, euf->fcurves[0], euf->fcurves[1], euf->fcurves[2])) {
/* report which components are missing */
BKE_reportf(op->reports, RPT_WARNING,
@@ -1917,7 +1915,8 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
/* > 180 degree flip? */
if ((sign * (prev->vec[1][1] - bezt->vec[1][1])) >= (float)M_PI) {
- /* 360 degrees to add/subtract frame value until difference is acceptably small that there's no more flip */
+ /* 360 degrees to add/subtract frame value until difference
+ * is acceptably small that there's no more flip */
const float fac = sign * 2.0f * (float)M_PI;
while ((sign * (prev->vec[1][1] - bezt->vec[1][1])) >= (float)M_PI) {
@@ -2032,7 +2031,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
/* set the new current frame and cursor values, based on the average time and value */
if (ked.i1) {
- SpaceIpo *sipo = (SpaceIpo *)ac.sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac.sl;
Scene *scene = ac.scene;
/* take the average values, rounding to the nearest int as necessary for int results */
@@ -2086,7 +2085,7 @@ static const EnumPropertyItem prop_graphkeys_snap_types[] = {
"Snap selected keyframes to the nearest marker"},
{GRAPHKEYS_SNAP_HORIZONTAL, "HORIZONTAL", 0, "Flatten Handles",
"Flatten handles for a smoother transition"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for snapping keyframes to frame-times */
@@ -2096,7 +2095,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc edit_cb;
float cursor_value = 0.0f;
@@ -2213,7 +2212,7 @@ static const EnumPropertyItem prop_graphkeys_mirror_types[] = {
"Flip values of selected keyframes (i.e. negative values become positive, and vice versa)"},
{GRAPHKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker",
"Flip times of selected keyframes using the first selected marker as the reference point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* this function is responsible for mirroring keyframes */
@@ -2223,7 +2222,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc edit_cb;
float cursor_value = 0.0f;
@@ -2817,7 +2816,7 @@ static bool graph_driver_delete_invalid_poll(bContext *C)
ScrArea *sa = CTX_wm_area(C);
/* firstly, check if in Graph Editor */
- if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ if ((sa == NULL) || (sa->spacetype != SPACE_GRAPH))
return 0;
/* try to init Anim-Context stuff ourselves and check */
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index 286d3cea59c..617233f2a20 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,23 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_intern.h
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
#ifndef __GRAPH_INTERN_H__
#define __GRAPH_INTERN_H__
-struct bContext;
-struct bAnimContext;
-struct bAnimListElem;
-struct SpaceIpo;
-struct ScrArea;
struct ARegion;
struct ARegionType;
+struct ScrArea;
+struct SpaceGraph;
struct View2DGrid;
+struct bAnimContext;
+struct bAnimListElem;
+struct bContext;
/* internal exports only */
@@ -50,8 +43,8 @@ struct ARegion *graph_has_buttons_region(struct ScrArea *sa);
/* graph_draw.c */
void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar);
-void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid, short sel);
-void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
+void graph_draw_curves(struct bAnimContext *ac, struct SpaceGraph *sipo, struct ARegion *ar, struct View2DGrid *grid, short sel);
+void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceGraph *sipo, struct ARegion *ar);
/* ***************************************** */
/* graph_select.c */
@@ -73,7 +66,7 @@ void GRAPH_OT_clickselect(struct wmOperatorType *ot);
enum eGraphKeys_LeftRightSelect_Mode {
GRAPHKEYS_LRSEL_TEST = 0,
GRAPHKEYS_LRSEL_LEFT,
- GRAPHKEYS_LRSEL_RIGHT
+ GRAPHKEYS_LRSEL_RIGHT,
};
/* defines for column-select mode */
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 4ed6a980fcb..1c9bbbcdae5 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_ops.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -83,8 +76,9 @@ static void graphview_cursor_apply(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- SpaceIpo *sipo = CTX_wm_space_graph(C);
- float frame = RNA_float_get(op->ptr, "frame"); /* this isn't technically "frame", but it'll do... */
+ SpaceGraph *sipo = CTX_wm_space_graph(C);
+ /* this isn't technically "frame", but it'll do... */
+ float frame = RNA_float_get(op->ptr, "frame");
/* adjust the frame or the cursor x-value */
if (sipo->mode == SIPO_MODE_DRIVERS) {
@@ -265,7 +259,8 @@ static int graphview_curves_hide_exec(bContext *C, wmOperator *op)
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
- /* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
+ /* hack: skip object channels for now, since flushing those will always flush everything,
+ * but they are always included */
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
@@ -291,7 +286,9 @@ static int graphview_curves_hide_exec(bContext *C, wmOperator *op)
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
- /* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
+ /* hack: skip object channels for now, since flushing those
+ * will always flush everything, but they are always included */
+
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
@@ -359,7 +356,8 @@ static int graphview_curves_reveal_exec(bContext *C, wmOperator *op)
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
- /* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */
+ /* hack: skip object channels for now, since flushing those will always flush everything,
+ * but they are always included. */
/* TODO: find out why this is the case, and fix that */
if (ale->type == ANIMTYPE_OBJECT)
continue;
@@ -491,7 +489,7 @@ void ED_operatormacros_graph(void)
void graphedit_keymap(wmKeyConfig *keyconf)
{
/* keymap for all regions */
- WM_keymap_ensure(keyconf, "Graph Editor Generic", SPACE_IPO, 0);
+ WM_keymap_ensure(keyconf, "Graph Editor Generic", SPACE_GRAPH, 0);
/* channels */
/* Channels are not directly handled by the Graph Editor module, but are inherited from the Animation module.
@@ -500,5 +498,5 @@ void graphedit_keymap(wmKeyConfig *keyconf)
*/
/* keyframes */
- WM_keymap_ensure(keyconf, "Graph Editor", SPACE_IPO, 0);
+ WM_keymap_ensure(keyconf, "Graph Editor", SPACE_GRAPH, 0);
}
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index cbea292c4ec..681e46e9daf 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_select.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -90,7 +84,7 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked = {{NULL}};
KeyframeEditFunc test_cb, sel_cb;
@@ -242,7 +236,7 @@ static void box_select_graphkeys(
bAnimListElem *ale;
int filter, mapping_flag;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc ok_cb, select_cb;
View2D *v2d = &ac->ar->v2d;
@@ -345,31 +339,20 @@ static int graphkeys_box_select_exec(bContext *C, wmOperator *op)
bAnimContext ac;
rcti rect;
rctf rect_fl;
- short mode = 0, selectmode = 0;
- bool incl_handles;
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
+ short mode = 0;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- /* clear all selection if not extending selection */
-
- if (!extend)
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const int selectmode = (sel_op != SEL_OP_SUB) ? SELECT_ADD : SELECT_SUBTRACT;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
deselect_graph_keys(&ac, 1, SELECT_SUBTRACT, true);
-
- /* get select mode
- * - 'include_handles' from the operator specifies whether to include handles in the selection
- */
- if (select) {
- selectmode = SELECT_ADD;
- }
- else {
- selectmode = SELECT_SUBTRACT;
}
- incl_handles = RNA_boolean_get(op->ptr, "include_handles");
+ /* 'include_handles' from the operator specifies whether to include handles in the selection. */
+ const bool incl_handles = RNA_boolean_get(op->ptr, "include_handles");
/* get settings from operator */
WM_operator_properties_border_to_rcti(op, &rect);
@@ -418,11 +401,12 @@ void GRAPH_OT_select_box(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- /* rna */
- WM_operator_properties_gesture_box_select(ot);
-
+ /* properties */
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");
+
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
@@ -436,9 +420,7 @@ static int graphkeys_lassoselect_exec(bContext *C, wmOperator *op)
rcti rect;
rctf rect_fl;
- short selectmode;
bool incl_handles;
- bool extend;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -449,18 +431,14 @@ static int graphkeys_lassoselect_exec(bContext *C, wmOperator *op)
if (data_lasso.mcords == NULL)
return OPERATOR_CANCELLED;
- /* clear all selection if not extending selection */
- extend = RNA_boolean_get(op->ptr, "extend");
- if (!extend)
- deselect_graph_keys(&ac, 1, SELECT_SUBTRACT, true);
-
- if (!RNA_boolean_get(op->ptr, "deselect"))
- selectmode = SELECT_ADD;
- else
- selectmode = SELECT_SUBTRACT;
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const short selectmode = (sel_op != SEL_OP_SUB) ? SELECT_ADD : SELECT_SUBTRACT;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ deselect_graph_keys(&ac, 0, SELECT_SUBTRACT, true);
+ }
{
- SpaceIpo *sipo = (SpaceIpo *)ac.sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac.sl;
if (selectmode == SELECT_ADD) {
incl_handles = ((sipo->flag & SIPO_SELVHANDLESONLY) ||
(sipo->flag & SIPO_NOHANDLES)) == 0;
@@ -503,7 +481,8 @@ void GRAPH_OT_select_lasso(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_lasso_select(ot);
+ WM_operator_properties_gesture_lasso(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/* ------------------- */
@@ -511,8 +490,6 @@ void GRAPH_OT_select_lasso(wmOperatorType *ot)
static int graph_circle_select_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const short selectmode = select ? SELECT_ADD : SELECT_SUBTRACT;
bool incl_handles = false;
KeyframeEdit_CircleData data = {0};
@@ -526,6 +503,13 @@ static int graph_circle_select_exec(bContext *C, wmOperator *op)
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
+ const eSelectOp sel_op = ED_select_op_modal(
+ RNA_enum_get(op->ptr, "mode"), WM_gesture_is_modal_first(op->customdata));
+ const short selectmode = (sel_op != SEL_OP_SUB) ? SELECT_ADD : SELECT_SUBTRACT;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ deselect_graph_keys(&ac, 0, SELECT_SUBTRACT, true);
+ }
+
data.mval[0] = x;
data.mval[1] = y;
data.radius_squared = radius * radius;
@@ -537,7 +521,7 @@ static int graph_circle_select_exec(bContext *C, wmOperator *op)
rect_fl.ymax = y + radius;
{
- SpaceIpo *sipo = (SpaceIpo *)ac.sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac.sl;
if (selectmode == SELECT_ADD) {
incl_handles = ((sipo->flag & SIPO_SELVHANDLESONLY) ||
(sipo->flag & SIPO_NOHANDLES)) == 0;
@@ -572,7 +556,8 @@ void GRAPH_OT_select_circle(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_circle_select(ot);
+ WM_operator_properties_gesture_circle(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/* ******************** Column Select Operator **************************** */
@@ -589,7 +574,7 @@ static const EnumPropertyItem prop_column_select_types[] = {
{GRAPHKEYS_COLUMNSEL_CFRA, "CFRA", 0, "On Current Frame", ""},
{GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", 0, "On Selected Markers", ""},
{GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN, "MARKERS_BETWEEN", 0, "Between Min/Max Selected Markers", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* ------------------- */
@@ -933,7 +918,7 @@ static const EnumPropertyItem prop_graphkeys_leftright_select_types[] = {
{GRAPHKEYS_LRSEL_TEST, "CHECK", 0, "Check if Select Left or Right", ""},
{GRAPHKEYS_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""},
{GRAPHKEYS_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* --------------------------------- */
@@ -1120,7 +1105,7 @@ typedef enum eGraphVertIndex {
/* check if its ok to select a handle */
// XXX also need to check for int-values only?
-static bool fcurve_handle_sel_check(SpaceIpo *sipo, BezTriple *bezt)
+static bool fcurve_handle_sel_check(SpaceGraph *sipo, BezTriple *bezt)
{
if (sipo->flag & SIPO_NOHANDLES) return 0;
if ((sipo->flag & SIPO_SELVHANDLESONLY) && BEZT_ISSEL_ANY(bezt) == 0) return 0;
@@ -1190,7 +1175,7 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
bAnimListElem *ale;
int filter;
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
View2D *v2d = &ac->ar->v2d;
short mapping_flag = 0;
@@ -1314,7 +1299,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert(bAnimContext *ac, const int mv
/* option 1) select keyframe directly under mouse */
static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_mode, short curves_only)
{
- SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ SpaceGraph *sipo = (SpaceGraph *)ac->sl;
tNearestVertInfo *nvi;
BezTriple *bezt = NULL;
@@ -1421,7 +1406,8 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m
}
/* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
- /* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY) otherwise the active flag won't be set [#26452] */
+ /* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY)
+ * otherwise the active flag won't be set T26452. */
if (nvi->fcu->flag & FCURVE_SELECTED) {
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, nvi->ctype);
@@ -1431,7 +1417,8 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m
MEM_freeN(nvi);
}
-/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
+/* Option 2) Selects all the keyframes on either side of the current frame
+ * (depends on which side the mouse is on) */
/* (see graphkeys_select_leftright) */
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index 912b5ceed58..6bef5072a78 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/graph_utils.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -64,7 +57,7 @@
/* NOTE: Currently called from windowmanager (new drivers editor window) and RNA (mode switching) */
void ED_drivers_editor_init(bContext *C, ScrArea *sa)
{
- SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)sa->spacedata.first;
/* Set mode */
sipo->mode = SIPO_MODE_DRIVERS;
@@ -147,7 +140,7 @@ bool graphop_visible_keyframes_poll(bContext *C)
/* firstly, check if in Graph Editor */
// TODO: also check for region?
- if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ if ((sa == NULL) || (sa->spacetype != SPACE_GRAPH))
return 0;
/* try to init Anim-Context stuff ourselves and check */
@@ -196,7 +189,7 @@ bool graphop_editable_keyframes_poll(bContext *C)
/* firstly, check if in Graph Editor */
// TODO: also check for region?
- if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ if ((sa == NULL) || (sa->spacetype != SPACE_GRAPH))
return 0;
/* try to init Anim-Context stuff ourselves and check */
@@ -243,7 +236,7 @@ bool graphop_active_fcurve_poll(bContext *C)
/* firstly, check if in Graph Editor */
// TODO: also check for region?
- if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ if ((sa == NULL) || (sa->spacetype != SPACE_GRAPH))
return 0;
/* try to init Anim-Context stuff ourselves and check */
@@ -284,7 +277,7 @@ bool graphop_selected_fcurve_poll(bContext *C)
/* firstly, check if in Graph Editor */
// TODO: also check for region?
- if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+ if ((sa == NULL) || (sa->spacetype != SPACE_GRAPH))
return 0;
/* try to init Anim-Context stuff ourselves and check */
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 27e401c8948..9892660c59c 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_graph/space_graph.c
- * \ingroup spgraph
+/** \file
+ * \ingroup spgraph
*/
@@ -43,8 +36,6 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
#include "BKE_fcurve.h"
#include "BKE_screen.h"
@@ -102,11 +93,11 @@ ARegion *graph_has_buttons_region(ScrArea *sa)
static SpaceLink *graph_new(const ScrArea *UNUSED(sa), const Scene *scene)
{
ARegion *ar;
- SpaceIpo *sipo;
+ SpaceGraph *sipo;
/* Graph Editor - general stuff */
- sipo = MEM_callocN(sizeof(SpaceIpo), "init graphedit");
- sipo->spacetype = SPACE_IPO;
+ sipo = MEM_callocN(sizeof(SpaceGraph), "init graphedit");
+ sipo->spacetype = SPACE_GRAPH;
sipo->autosnap = SACTSNAP_FRAME;
@@ -172,7 +163,7 @@ static SpaceLink *graph_new(const ScrArea *UNUSED(sa), const Scene *scene)
/* not spacelink itself */
static void graph_free(SpaceLink *sl)
{
- SpaceIpo *si = (SpaceIpo *)sl;
+ SpaceGraph *si = (SpaceGraph *)sl;
if (si->ads) {
BLI_freelistN(&si->ads->chanbase);
@@ -188,7 +179,7 @@ static void graph_free(SpaceLink *sl)
/* spacetype; init callback */
static void graph_init(struct wmWindowManager *wm, ScrArea *sa)
{
- SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)sa->spacedata.first;
/* init dopesheet data if non-existent (i.e. for old files) */
if (sipo->ads == NULL) {
@@ -206,10 +197,10 @@ static void graph_init(struct wmWindowManager *wm, ScrArea *sa)
static SpaceLink *graph_duplicate(SpaceLink *sl)
{
- SpaceIpo *sipon = MEM_dupallocN(sl);
+ SpaceGraph *sipon = MEM_dupallocN(sl);
/* clear or remove stuff from old */
- BLI_duplicatelist(&sipon->runtime.ghost_curves, &((SpaceIpo *)sl)->runtime.ghost_curves);
+ BLI_duplicatelist(&sipon->runtime.ghost_curves, &((SpaceGraph *)sl)->runtime.ghost_curves);
sipon->ads = MEM_dupallocN(sipon->ads);
return (SpaceLink *)sipon;
@@ -223,16 +214,16 @@ static void graph_main_region_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
/* own keymap */
- keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor", SPACE_IPO, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor", SPACE_GRAPH, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
static void graph_main_region_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
- SpaceIpo *sipo = CTX_wm_space_graph(C);
+ SpaceGraph *sipo = CTX_wm_space_graph(C);
Scene *scene = CTX_data_scene(C);
bAnimContext ac;
View2D *v2d = &ar->v2d;
@@ -306,7 +297,8 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* cursor x-value */
float x = sipo->cursorTime;
- /* to help differentiate this from the current frame, draw slightly darker like the horizontal one */
+ /* to help differentiate this from the current frame,
+ * draw slightly darker like the horizontal one */
immUniformThemeColorShadeAlpha(TH_CFRAME, -40, -50);
GPU_blend(true);
GPU_line_width(2.0);
@@ -330,7 +322,11 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
- ED_markers_draw(C, DRAW_MARKERS_MARGIN);
+ int marker_draw_flag = DRAW_MARKERS_MARGIN;
+ if (sipo->flag & SIPO_MARKER_LINES) {
+ marker_draw_flag |= DRAW_MARKERS_LINES;
+ }
+ ED_markers_draw(C, marker_draw_flag);
/* preview range */
UI_view2d_view_ortho(v2d);
@@ -362,7 +358,10 @@ static void graph_channel_region_init(wmWindowManager *wm, ARegion *ar)
/* make sure we keep the hide flags */
ar->v2d.scroll |= V2D_SCROLL_RIGHT;
- ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM); /* prevent any noise of past */
+
+ /* prevent any noise of past */
+ ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM);
+
ar->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
ar->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE;
@@ -371,7 +370,7 @@ static void graph_channel_region_init(wmWindowManager *wm, ARegion *ar)
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Animation Channels", 0, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
- keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -421,7 +420,7 @@ static void graph_buttons_region_init(wmWindowManager *wm, ARegion *ar)
ED_region_panels_init(wm, ar);
- keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -571,12 +570,13 @@ static void graph_region_message_subscribe(
/* editor level listener */
static void graph_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene))
{
- SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)sa->spacedata.first;
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
- /* for selection changes of animation data, we can just redraw... otherwise autocolor might need to be done again */
+ /* for selection changes of animation data, we can just redraw...
+ * otherwise autocolor might need to be done again */
if (ELEM(wmn->data, ND_KEYFRAME, ND_ANIMCHAN) && (wmn->action == NA_SELECTED))
ED_area_tag_redraw(sa);
else
@@ -584,7 +584,8 @@ static void graph_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn,
break;
case NC_SCENE:
switch (wmn->data) {
- case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
+ case ND_OB_ACTIVE: /* selection changed, so force refresh to flush
+ * (needs flag set to do syncing) */
case ND_OB_SELECT:
sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC;
ED_area_tag_refresh(sa);
@@ -597,7 +598,8 @@ static void graph_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn,
break;
case NC_OBJECT:
switch (wmn->data) {
- case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */
+ case ND_BONE_SELECT: /* selection changed, so force refresh to flush
+ * (needs flag set to do syncing) */
case ND_BONE_ACTIVE:
sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC;
ED_area_tag_refresh(sa);
@@ -649,7 +651,7 @@ static void graph_refresh_fcurve_colors(const bContext *C)
if (ANIM_animdata_get_context(C, &ac) == false)
return;
- UI_SetTheme(SPACE_IPO, RGN_TYPE_WINDOW);
+ UI_SetTheme(SPACE_GRAPH, RGN_TYPE_WINDOW);
/* build list of F-Curves which will be visible as channels in channel-region
* - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a
@@ -758,7 +760,7 @@ static void graph_refresh_fcurve_colors(const bContext *C)
static void graph_refresh(const bContext *C, ScrArea *sa)
{
- SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)sa->spacedata.first;
/* updates to data needed depends on Graph Editor mode... */
switch (sipo->mode) {
@@ -800,7 +802,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
static void graph_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)
{
- SpaceIpo *sgraph = (SpaceIpo *)slink;
+ SpaceGraph *sgraph = (SpaceGraph *)slink;
if (sgraph->ads) {
if ((ID *)sgraph->ads->filter_grp == old_id) {
@@ -814,13 +816,13 @@ static void graph_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID
static int graph_space_subtype_get(ScrArea *sa)
{
- SpaceIpo *sgraph = sa->spacedata.first;
+ SpaceGraph *sgraph = sa->spacedata.first;
return sgraph->mode;
}
static void graph_space_subtype_set(ScrArea *sa, int value)
{
- SpaceIpo *sgraph = sa->spacedata.first;
+ SpaceGraph *sgraph = sa->spacedata.first;
sgraph->mode = value;
}
@@ -836,7 +838,7 @@ void ED_spacetype_ipo(void)
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype ipo");
ARegionType *art;
- st->spaceid = SPACE_IPO;
+ st->spaceid = SPACE_GRAPH;
strncpy(st->name, "Graph", BKE_ST_MAXNAME);
st->new = graph_new;
@@ -877,7 +879,8 @@ void ED_spacetype_ipo(void)
/* regions: channels */
art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_CHANNELS;
- art->prefsizex = 200 + V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
+ /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
+ art->prefsizex = 200 + V2D_SCROLL_WIDTH;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
art->listener = graph_region_listener;
art->message_subscribe = graph_region_message_subscribe;
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt
index 0bc09981ba5..77abfebc662 100644
--- a/source/blender/editors/space_image/CMakeLists.txt
+++ b/source/blender/editors/space_image/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 26162266441..b77c08736dc 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_buttons.c
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
#include <string.h>
@@ -151,7 +145,6 @@ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
* otherwise refresh preview
*
* XXX if you put this back, also check XXX in image_main_region_draw() */
- * /
void image_preview_event(int event)
{
int exec = 0;
@@ -181,7 +174,8 @@ void image_preview_event(int event)
BIF_store_spare();
- ntreeCompositExecTree(scene->nodetree, &scene->r, 1, &scene->view_settings, &scene->display_settings); /* 1 is do_previews */
+ /* 1 is do_previews */
+ ntreeCompositExecTree(scene->nodetree, &scene->r, 1, &scene->view_settings, &scene->display_settings);
G.scene->nodetree->timecursor = NULL;
G.scene->nodetree->test_break = NULL;
@@ -863,7 +857,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
ima = imaptr.data;
iuser = userptr->data;
- BKE_image_user_check_frame_calc(iuser, (int)scene->r.cfra);
+ BKE_image_user_frame_calc(iuser, (int)scene->r.cfra);
cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
cb->ptr = *ptr;
@@ -938,17 +932,6 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
}
- // XXX what was this for?
-#if 0
- /* check for re-render, only buttons */
- if (imagechanged == B_IMAGECHANGED) {
- if (iuser->flag & IMA_ANIM_REFRESHED) {
- iuser->flag &= ~IMA_ANIM_REFRESHED;
- WM_event_add_notifier(C, NC_IMAGE, ima);
- }
- }
-#endif
-
/* multilayer? */
if (ima->type == IMA_TYPE_MULTILAYER && ima->rr) {
const float dpi_fac = UI_DPI_FAC;
@@ -1259,6 +1242,7 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser
void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
{
+ Scene *scene = CTX_data_scene(C);
ImBuf *ibuf;
char str[MAX_IMAGE_INFO_LEN];
void *lock;
@@ -1268,16 +1252,44 @@ void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *i
ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
- image_info(CTX_data_scene(C), iuser, ima, ibuf, str, MAX_IMAGE_INFO_LEN);
+ BKE_image_user_frame_calc(iuser, (int)scene->r.cfra);
+ image_info(scene, iuser, ima, ibuf, str, MAX_IMAGE_INFO_LEN);
BKE_image_release_ibuf(ima, ibuf, lock);
uiItemL(layout, str, ICON_NONE);
}
#undef MAX_IMAGE_INFO_LEN
-void image_buttons_register(ARegionType *UNUSED(art))
+static bool metadata_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
+{
+ SpaceImage *space_image = CTX_wm_space_image(C);
+ return space_image != NULL && space_image->image != NULL;
+}
+
+static void metadata_panel_context_draw(const bContext *C, Panel *panel)
{
+ void *lock;
+ SpaceImage *space_image = CTX_wm_space_image(C);
+ Image *image = space_image->image;
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, &space_image->iuser, &lock);
+ if (ibuf != NULL) {
+ ED_region_image_metadata_panel_draw(ibuf, panel->layout);
+ }
+ BKE_image_release_ibuf(image, ibuf, lock);
+}
+void image_buttons_register(ARegionType *art)
+{
+ PanelType *pt;
+
+ pt = MEM_callocN(sizeof(PanelType), "spacetype image panel metadata");
+ strcpy(pt->idname, "IMAGE_PT_metadata");
+ strcpy(pt->label, N_("Metadata"));
+ strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ pt->poll = metadata_panel_context_poll;
+ pt->draw = metadata_panel_context_draw;
+ pt->flag |= PNL_DEFAULT_CLOSED;
+ BLI_addtail(&art->paneltypes, pt);
}
static int image_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op))
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index a46767495dd..885a9c18346 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_draw.c
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
@@ -56,7 +50,6 @@
#include "IMB_moviecache.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_paint.h"
@@ -156,7 +149,12 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
rcti color_rect;
char str[256];
int dx = 6;
- const int dy = 0.3f * UI_UNIT_Y;
+ /* local coordinate visible rect inside region, to accommodate overlapping ui */
+ rcti rect;
+ ED_region_visible_rect(ar, &rect);
+ const int ymin = rect.ymin;
+ const int dy = ymin + 0.3f * UI_UNIT_Y;
+
/* text colors */
/* XXX colored text not allowed in Blender UI */
#if 0
@@ -179,7 +177,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
/* noisy, high contrast make impossible to read if lower alpha is used. */
immUniformColor4ub(0, 0, 0, 190);
- immRecti(pos, 0, 0, BLI_rcti_size_x(&ar->winrct) + 1, UI_UNIT_Y);
+ immRecti(pos, 0, ymin, BLI_rcti_size_x(&ar->winrct) + 1, ymin + UI_UNIT_Y);
immUnbindProgram();
@@ -188,21 +186,21 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
BLF_size(blf_mono_font, 11 * U.pixelsize, U.dpi);
BLF_color3ub(blf_mono_font, 255, 255, 255);
- BLI_snprintf(str, sizeof(str), "X:%-4d Y:%-4d |", x, y);
+ SNPRINTF(str, "X:%-4d Y:%-4d |", x, y);
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
if (zp) {
BLF_color3ub(blf_mono_font, 255, 255, 255);
- BLI_snprintf(str, sizeof(str), " Z:%-.4f |", 0.5f + 0.5f * (((float)*zp) / (float)0x7fffffff));
+ SNPRINTF(str, " Z:%-.4f |", 0.5f + 0.5f * (((float)*zp) / (float)0x7fffffff));
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
}
if (zpf) {
BLF_color3ub(blf_mono_font, 255, 255, 255);
- BLI_snprintf(str, sizeof(str), " Z:%-.3f |", *zpf);
+ SNPRINTF(str, " Z:%-.3f |", *zpf);
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
@@ -210,10 +208,10 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
if (channels == 1 && (cp != NULL || fp != NULL)) {
if (fp != NULL) {
- BLI_snprintf(str, sizeof(str), " Val:%-.3f |", fp[0]);
+ SNPRINTF(str, " Val:%-.3f |", fp[0]);
}
else if (cp != NULL) {
- BLI_snprintf(str, sizeof(str), " Val:%-.3f |", cp[0] / 255.0f);
+ SNPRINTF(str, " Val:%-.3f |", cp[0] / 255.0f);
}
BLF_color3ub(blf_mono_font, 255, 255, 255);
BLF_position(blf_mono_font, dx, dy, 0);
@@ -223,46 +221,58 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
if (channels >= 3) {
BLF_color3ubv(blf_mono_font, red);
- if (fp)
- BLI_snprintf(str, sizeof(str), " R:%-.5f", fp[0]);
- else if (cp)
- BLI_snprintf(str, sizeof(str), " R:%-3d", cp[0]);
- else
- BLI_snprintf(str, sizeof(str), " R:-");
+ if (fp) {
+ SNPRINTF(str, " R:%-.5f", fp[0]);
+ }
+ else if (cp) {
+ SNPRINTF(str, " R:%-3d", cp[0]);
+ }
+ else {
+ STRNCPY(str, " R:-");
+ }
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
BLF_color3ubv(blf_mono_font, green);
- if (fp)
- BLI_snprintf(str, sizeof(str), " G:%-.5f", fp[1]);
- else if (cp)
- BLI_snprintf(str, sizeof(str), " G:%-3d", cp[1]);
- else
- BLI_snprintf(str, sizeof(str), " G:-");
+ if (fp) {
+ SNPRINTF(str, " G:%-.5f", fp[1]);
+ }
+ else if (cp) {
+ SNPRINTF(str, " G:%-3d", cp[1]);
+ }
+ else {
+ STRNCPY(str, " G:-");
+ }
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
BLF_color3ubv(blf_mono_font, blue);
- if (fp)
- BLI_snprintf(str, sizeof(str), " B:%-.5f", fp[2]);
- else if (cp)
- BLI_snprintf(str, sizeof(str), " B:%-3d", cp[2]);
- else
- BLI_snprintf(str, sizeof(str), " B:-");
+ if (fp) {
+ SNPRINTF(str, " B:%-.5f", fp[2]);
+ }
+ else if (cp) {
+ SNPRINTF(str, " B:%-3d", cp[2]);
+ }
+ else {
+ STRNCPY(str, " B:-");
+ }
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
if (channels == 4) {
BLF_color3ub(blf_mono_font, 255, 255, 255);
- if (fp)
- BLI_snprintf(str, sizeof(str), " A:%-.4f", fp[3]);
- else if (cp)
- BLI_snprintf(str, sizeof(str), " A:%-3d", cp[3]);
- else
- BLI_snprintf(str, sizeof(str), "- ");
+ if (fp) {
+ SNPRINTF(str, " A:%-.4f", fp[3]);
+ }
+ else if (cp) {
+ SNPRINTF(str, " A:%-3d", cp[3]);
+ }
+ else {
+ STRNCPY(str, "- ");
+ }
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
@@ -282,7 +292,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
else
IMB_colormanagement_pixel_to_display_space_v4(rgba, rgba, &scene->view_settings, &scene->display_settings);
- BLI_snprintf(str, sizeof(str), " | CM R:%-.4f G:%-.4f B:%-.4f", rgba[0], rgba[1], rgba[2]);
+ SNPRINTF(str, " | CM R:%-.4f G:%-.4f B:%-.4f", rgba[0], rgba[1], rgba[2]);
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
@@ -327,7 +337,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
GPU_blend(false);
dx += 0.25f * UI_UNIT_X;
- BLI_rcti_init(&color_rect, dx, dx + (1.5f * UI_UNIT_X), 0.15f * UI_UNIT_Y, 0.85f * UI_UNIT_Y);
+ BLI_rcti_init(&color_rect, dx, dx + (1.5f * UI_UNIT_X), ymin + 0.15f * UI_UNIT_Y, ymin + 0.85f * UI_UNIT_Y);
/* BLF uses immediate mode too, so we must reset our vertex format */
pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
@@ -386,12 +396,12 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
rgb_to_yuv((float)cp[0] / 255.0f, (float)cp[0] / 255.0f, (float)cp[0] / 255.0f, &lum, &u, &v, BLI_YUV_ITU_BT709);
}
- BLI_snprintf(str, sizeof(str), "V:%-.4f", val);
+ SNPRINTF(str, "V:%-.4f", val);
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
- BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
+ SNPRINTF(str, " L:%-.4f", lum);
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
}
@@ -399,22 +409,22 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
rgb_to_hsv(finalcol[0], finalcol[1], finalcol[2], &hue, &sat, &val);
rgb_to_yuv(finalcol[0], finalcol[1], finalcol[2], &lum, &u, &v, BLI_YUV_ITU_BT709);
- BLI_snprintf(str, sizeof(str), "H:%-.4f", hue);
+ SNPRINTF(str, "H:%-.4f", hue);
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
- BLI_snprintf(str, sizeof(str), " S:%-.4f", sat);
+ SNPRINTF(str, " S:%-.4f", sat);
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
- BLI_snprintf(str, sizeof(str), " V:%-.4f", val);
+ SNPRINTF(str, " V:%-.4f", val);
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str, sizeof(str));
- BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
+ SNPRINTF(str, " L:%-.4f", lum);
BLF_position(blf_mono_font, dx, dy, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
}
@@ -434,7 +444,7 @@ static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(&state, x1, y1, rectx, recty, GL_RED, GL_INT, GL_NEAREST, recti, zoomx, zoomy, NULL);
@@ -444,24 +454,24 @@ static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int
static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rectx, int recty,
float *rect_float, float zoomx, float zoomy)
{
- float bias, scale, *rectf, clipend;
+ float bias, scale, *rectf, clip_end;
int a;
float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
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);
+ bias = ((Camera *)scene->camera->data)->clip_start;
+ clip_end = ((Camera *)scene->camera->data)->clip_end;
+ scale = 1.0f / (clip_end - bias);
}
else {
bias = 0.1f;
scale = 0.01f;
- clipend = 100.0f;
+ clip_end = 100.0f;
}
rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp");
for (a = rectx * recty - 1; a >= 0; a--) {
- if (rect_float[a] > clipend)
+ if (rect_float[a] > clip_end)
rectf[a] = 0.0f;
else if (rect_float[a] < bias)
rectf[a] = 1.0f;
@@ -472,7 +482,7 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(&state, x1, y1, rectx, recty, GL_RED, GL_FLOAT, GL_NEAREST, rectf, zoomx, zoomy, NULL);
@@ -531,7 +541,7 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
shuffle[3] = 1.0f;
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, shuffle);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, shuffle);
IMB_colormanagement_display_settings_from_ctx(C, &view_settings, &display_settings);
display_buffer = IMB_display_buffer_acquire(ibuf, view_settings, display_settings, &cache_handle);
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index 96c3f55df92..9a6f7431d17 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_edit.c
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
#include "DNA_brush_types.h"
@@ -65,7 +58,7 @@ Image *ED_space_image(SpaceImage *sima)
}
/* called to assign images to UV faces */
-void ED_space_image_set(Main *bmain, SpaceImage *sima, Scene *UNUSED(scene), Object *obedit, Image *ima)
+void ED_space_image_set(Main *bmain, SpaceImage *sima, Object *obedit, Image *ima)
{
/* change the space ima after because uvedit_face_visible_test uses the space ima
* to check if the face is displayed in UV-localview */
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index db223d7f7a1..55ae664decd 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_intern.h
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
@@ -33,13 +26,13 @@
#define __IMAGE_INTERN_H__
/* internal exports only */
-struct bContext;
struct ARegion;
struct ARegionType;
struct ScrArea;
struct SpaceImage;
-struct wmOperatorType;
+struct bContext;
struct bNodeTree;
+struct wmOperatorType;
/* space_image.c */
struct ARegion *image_has_buttons_region(struct ScrArea *sa);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 87d2f439ad7..064a4d2ce11 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009, Xavier Thomas
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_ops.c
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
@@ -44,7 +38,6 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_string_utf8.h"
#include "BLT_translation.h"
@@ -72,6 +65,7 @@
#include "DEG_depsgraph.h"
#include "GPU_draw.h"
+#include "GPU_immediate.h"
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
@@ -526,7 +520,7 @@ static int image_view_zoom_exec(bContext *C, wmOperator *op)
enum {
VIEW_PASS = 0,
VIEW_APPLY,
- VIEW_CONFIRM
+ VIEW_CONFIRM,
};
static int image_view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -1306,7 +1300,7 @@ static int image_open_exec(bContext *C, wmOperator *op)
}
else if (sa && sa->spacetype == SPACE_IMAGE) {
SpaceImage *sima = sa->spacedata.first;
- ED_space_image_set(bmain, sima, scene, obedit, ima);
+ ED_space_image_set(bmain, sima, obedit, ima);
iuser = &sima->iuser;
}
else {
@@ -1511,7 +1505,8 @@ void IMAGE_OT_match_movie_length(wmOperatorType *ot)
ot->exec = image_match_len_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL/* | OPTYPE_UNDO */; /* Don't think we need undo for that. */
+ /* Don't think we need undo for that. */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL/* | OPTYPE_UNDO */;
}
/******************** replace image operator ********************/
@@ -1640,7 +1635,8 @@ static int save_image_options_init(Main *bmain, SaveImageOptions *simopts, Space
simopts->im_format = scene->r.im_format;
is_depth_set = true;
if (!BKE_image_is_multiview(ima)) {
- /* In case multiview is disabled, render settings would be invalid for render result in this area. */
+ /* In case multiview is disabled,
+ * render settings would be invalid for render result in this area. */
simopts->im_format.stereo3d_format = *ima->stereo3d_format;
simopts->im_format.views_format = ima->views_format;
}
@@ -1660,7 +1656,8 @@ static int save_image_options_init(Main *bmain, SaveImageOptions *simopts, Space
simopts->im_format.views_format = ima->views_format;
}
- //simopts->subimtype = scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
+ ///* XXX - this is lame, we need to make these available too! */
+ //simopts->subimtype = scene->r.subimtype;
BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath));
@@ -2350,7 +2347,6 @@ static int image_reload_exec(bContext *C, wmOperator *UNUSED(op))
/* XXX unpackImage frees image buffers */
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
- // XXX other users?
BKE_image_signal(bmain, ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_RELOAD);
DEG_id_tag_update(&ima->id, 0);
@@ -2379,7 +2375,7 @@ void IMAGE_OT_reload(wmOperatorType *ot)
enum {
GEN_CONTEXT_NONE = 0,
GEN_CONTEXT_PAINT_CANVAS = 1,
- GEN_CONTEXT_PAINT_STENCIL = 2
+ GEN_CONTEXT_PAINT_STENCIL = 2,
};
typedef struct ImageNewData {
@@ -2409,7 +2405,6 @@ static void image_new_free(wmOperator *op)
static int image_new_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima;
- Scene *scene;
Object *obedit;
Image *ima;
Main *bmain;
@@ -2422,7 +2417,6 @@ static int image_new_exec(bContext *C, wmOperator *op)
/* retrieve state */
sima = CTX_wm_space_image(C);
- scene = CTX_data_scene(C);
obedit = CTX_data_edit_object(C);
bmain = CTX_data_main(C);
@@ -2467,7 +2461,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
RNA_property_update(C, &data->pprop.ptr, data->pprop.prop);
}
else if (sima) {
- ED_space_image_set(bmain, sima, scene, obedit, ima);
+ ED_space_image_set(bmain, sima, obedit, ima);
}
BKE_image_signal(bmain, ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_USER_NEW_IMAGE);
@@ -2607,13 +2601,16 @@ static int image_invert_exec(bContext *C, wmOperator *op)
size_t 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;
+ }
if (support_undo) {
- ED_image_undo_push_begin(op->type->name);
+ ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D);
/* not strictly needed, because we only imapaint_dirty_region to invalidate all tiles
- * but better do this right in case someone copies this for a tool that uses partial redraw better */
+ * but better do this right in case someone copies this for a tool that uses partial
+ * redraw better */
ED_imapaint_clear_partial_redraw();
ED_imapaint_dirty_region(ima, ibuf, 0, 0, ibuf->x, ibuf->y, false);
}
@@ -2799,7 +2796,7 @@ static int image_unpack_exec(bContext *C, wmOperator *op)
if (RNA_struct_property_is_set(op->ptr, "id")) {
char imaname[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "id", imaname);
- ima = BLI_findstring(&CTX_data_main(C)->image, imaname, offsetof(ID, name) + 2);
+ ima = BLI_findstring(&CTX_data_main(C)->images, imaname, offsetof(ID, name) + 2);
if (!ima) ima = CTX_data_edit_image(C);
}
@@ -2811,7 +2808,7 @@ static int image_unpack_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if (G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_FILE_AUTOPACK)
BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
/* XXX unpackImage frees image buffers */
@@ -2839,7 +2836,7 @@ static int image_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
return OPERATOR_CANCELLED;
}
- if (G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_FILE_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", BKE_image_has_packedfile(ima) ? ((ImagePackedFile *)ima->packedfiles.first)->packedfile : NULL);
@@ -2863,7 +2860,8 @@ void IMAGE_OT_unpack(wmOperatorType *ot)
/* properties */
RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack");
- RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Image Name", "Image data-block name to unpack"); /* XXX, weark!, will fail with library, name collisions */
+ /* XXX, weak!, will fail with library, name collisions */
+ RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Image Name", "Image data-block name to unpack");
}
/******************** sample image operator ********************/
@@ -2874,6 +2872,9 @@ typedef struct ImageSampleInfo {
int x, y;
int channels;
+ int width, height;
+ int sample_size;
+
unsigned char col[4];
float colf[4];
float linearcol[4];
@@ -2893,11 +2894,45 @@ typedef struct ImageSampleInfo {
static void image_sample_draw(const bContext *C, ARegion *ar, void *arg_info)
{
ImageSampleInfo *info = arg_info;
- if (info->draw) {
- Scene *scene = CTX_data_scene(C);
+ if (!info->draw) {
+ return;
+ }
- ED_image_draw_info(scene, ar, info->color_manage, info->use_default_view, info->channels,
- info->x, info->y, info->colp, info->colfp, info->linearcol, info->zp, info->zfp);
+ Scene *scene = CTX_data_scene(C);
+ ED_image_draw_info(
+ scene, ar, info->color_manage, info->use_default_view, info->channels,
+ info->x, info->y, info->colp, info->colfp, info->linearcol, info->zp, info->zfp);
+
+ if (info->sample_size > 1) {
+ const wmWindow *win = CTX_wm_window(C);
+ const wmEvent *event = win->eventstate;
+
+ SpaceImage *sima = CTX_wm_space_image(C);
+ GPUVertFormat *format = immVertexFormat();
+ uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+
+ const float color[3] = {1, 1, 1};
+ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+ immUniformColor3fv(color);
+
+ /* TODO(campbell): lock to pixels. */
+ rctf sample_rect_fl;
+ BLI_rctf_init_pt_radius(
+ &sample_rect_fl,
+ (float[2]){event->x - ar->winrct.xmin, event->y - ar->winrct.ymin},
+ (float)(info->sample_size / 2.0f) * sima->zoom);
+
+ glEnable(GL_COLOR_LOGIC_OP);
+ glLogicOp(GL_XOR);
+ imm_draw_box_wire_2d(
+ pos,
+ (float)sample_rect_fl.xmin,
+ (float)sample_rect_fl.ymin,
+ (float)sample_rect_fl.xmax,
+ (float)sample_rect_fl.ymax);
+ glDisable(GL_COLOR_LOGIC_OP);
+
+ immUnbindProgram();
}
}
@@ -2941,6 +2976,85 @@ bool ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], flo
return ret;
}
+
+/* -------------------------------------------------------------------- */
+/** \name Image Pixel Sample
+ * \{ */
+
+static void image_sample_pixel_color_ubyte(
+ const ImBuf *ibuf, const int coord[2],
+ uchar r_col[4], float r_col_linear[4])
+{
+ const uchar *cp = (unsigned char *)(ibuf->rect + coord[1] * ibuf->x + coord[0]);
+ copy_v4_v4_uchar(r_col, cp);
+ rgba_uchar_to_float(r_col_linear, r_col);
+ IMB_colormanagement_colorspace_to_scene_linear_v4(r_col_linear, false, ibuf->rect_colorspace);
+}
+
+static void image_sample_pixel_color_float(
+ ImBuf *ibuf, const int coord[2],
+ float r_col[4])
+{
+ const float *cp = ibuf->rect_float + (ibuf->channels) * (coord[1] * ibuf->x + coord[0]);
+ copy_v4_v4(r_col, cp);
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Image Pixel Region Sample
+ * \{ */
+
+static void image_sample_rect_color_ubyte(
+ const ImBuf *ibuf, const rcti *rect,
+ uchar r_col[4], float r_col_linear[4])
+{
+ uint col_accum_ub[4] = {0, 0, 0, 0};
+ zero_v4(r_col_linear);
+ int col_tot = 0;
+ int coord[2];
+ for (coord[0] = rect->xmin; coord[0] <= rect->xmax; coord[0]++) {
+ for (coord[1] = rect->ymin; coord[1] <= rect->ymax; coord[1]++) {
+ float col_temp_fl[4];
+ uchar col_temp_ub[4];
+ image_sample_pixel_color_ubyte(ibuf, coord, col_temp_ub, col_temp_fl);
+ add_v4_v4(r_col_linear, col_temp_fl);
+ col_accum_ub[0] += (uint)col_temp_ub[0];
+ col_accum_ub[1] += (uint)col_temp_ub[1];
+ col_accum_ub[2] += (uint)col_temp_ub[2];
+ col_accum_ub[3] += (uint)col_temp_ub[3];
+ col_tot += 1;
+ }
+ }
+ mul_v4_fl(r_col_linear, 1.0 / (float)col_tot);
+
+ r_col[0] = MIN2(col_accum_ub[0] / col_tot, 255);
+ r_col[1] = MIN2(col_accum_ub[1] / col_tot, 255);
+ r_col[2] = MIN2(col_accum_ub[2] / col_tot, 255);
+ r_col[3] = MIN2(col_accum_ub[3] / col_tot, 255);
+}
+
+
+static void image_sample_rect_color_float(
+ ImBuf *ibuf, const rcti *rect,
+ float r_col[4])
+{
+ zero_v4(r_col);
+ int col_tot = 0;
+ int coord[2];
+ for (coord[0] = rect->xmin; coord[0] <= rect->xmax; coord[0]++) {
+ for (coord[1] = rect->ymin; coord[1] <= rect->ymax; coord[1]++) {
+ float col_temp_fl[4];
+ image_sample_pixel_color_float(ibuf, coord, col_temp_fl);
+ add_v4_v4(r_col, col_temp_fl);
+ col_tot += 1;
+ }
+ }
+ mul_v4_fl(r_col, 1.0 / (float)col_tot);
+}
+
+/** \} */
+
static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceImage *sima = CTX_wm_space_image(C);
@@ -2961,16 +3075,17 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event
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) {
- const float *fp;
- unsigned char *cp;
int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
Image *image = ED_space_image(sima);
CLAMP(x, 0, ibuf->x - 1);
CLAMP(y, 0, ibuf->y - 1);
+ info->width = ibuf->x;
+ info->height = ibuf->y;
info->x = x;
info->y = y;
+
info->draw = true;
info->channels = ibuf->channels;
@@ -2981,45 +3096,32 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event
info->use_default_view = (image->flag & IMA_VIEW_AS_RENDER) ? false : true;
+ rcti sample_rect;
+ sample_rect.xmin = max_ii(0, x - info->sample_size / 2);
+ sample_rect.ymin = max_ii(0, y - info->sample_size / 2);
+ sample_rect.xmax = min_ii(ibuf->x, sample_rect.xmin + info->sample_size) - 1;
+ sample_rect.ymax = min_ii(ibuf->y, sample_rect.ymin + info->sample_size) - 1;
+
if (ibuf->rect) {
- cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
+ image_sample_rect_color_ubyte(ibuf, &sample_rect, info->col, info->linearcol);
+ rgba_uchar_to_float(info->colf, info->col);
- info->col[0] = cp[0];
- info->col[1] = cp[1];
- info->col[2] = cp[2];
- info->col[3] = cp[3];
info->colp = info->col;
-
- info->colf[0] = (float)cp[0] / 255.0f;
- info->colf[1] = (float)cp[1] / 255.0f;
- info->colf[2] = (float)cp[2] / 255.0f;
- info->colf[3] = (float)cp[3] / 255.0f;
info->colfp = info->colf;
-
- copy_v4_v4(info->linearcol, info->colf);
- IMB_colormanagement_colorspace_to_scene_linear_v4(info->linearcol, false, ibuf->rect_colorspace);
-
info->color_manage = true;
}
if (ibuf->rect_float) {
- fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
+ image_sample_rect_color_float(ibuf, &sample_rect, info->colf);
if (ibuf->channels == 4) {
- info->colf[0] = fp[0];
- info->colf[1] = fp[1];
- info->colf[2] = fp[2];
- info->colf[3] = fp[3];
+ /* pass */
}
else if (ibuf->channels == 3) {
- info->colf[0] = fp[0];
- info->colf[1] = fp[1];
- info->colf[2] = fp[2];
info->colf[3] = 1.0f;
}
else {
- info->colf[0] = fp[0];
- info->colf[1] = fp[0];
- info->colf[2] = fp[0];
+ info->colf[1] = info->colf[0];
+ info->colf[2] = info->colf[0];
info->colf[3] = 1.0f;
}
info->colfp = info->colf;
@@ -3030,6 +3132,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event
}
if (ibuf->zbuf) {
+ /* TODO, blend depth (not urgent). */
info->z = ibuf->zbuf[y * ibuf->x + x];
info->zp = &info->z;
if (ibuf->zbuf == (int *)ibuf->rect) {
@@ -3037,6 +3140,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event
}
}
if (ibuf->zbuf_float) {
+ /* TODO, blend depth (not urgent). */
info->zf = ibuf->zbuf_float[y * ibuf->x + x];
info->zfp = &info->zf;
if (ibuf->zbuf_float == ibuf->rect_float) {
@@ -3109,8 +3213,10 @@ static int image_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event
return OPERATOR_CANCELLED;
info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
+
info->art = ar->type;
info->draw_handle = ED_region_draw_cb_activate(ar->type, image_sample_draw, info, REGION_DRAW_POST_PIXEL);
+ info->sample_size = RNA_int_get(op->ptr, "size");
op->customdata = info;
image_sample_apply(C, op, event);
@@ -3158,6 +3264,11 @@ void IMAGE_OT_sample(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_BLOCKING;
+
+ PropertyRNA *prop;
+ prop = RNA_def_int(ot->srna, "size", 1, 1, 128, "Sample Size", "", 1, 64);
+ RNA_def_property_subtype(prop, PROP_PIXEL);
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/******************** sample line operator ********************/
@@ -3251,7 +3362,7 @@ void IMAGE_OT_curves_point_set(wmOperatorType *ot)
static const EnumPropertyItem point_items[] = {
{0, "BLACK_POINT", 0, "Black Point", ""},
{1, "WHITE_POINT", 0, "White Point", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -3689,7 +3800,7 @@ static int image_read_viewlayers_exec(bContext *C, wmOperator *UNUSED(op))
ima = BKE_image_verify_viewer(bmain, IMA_TYPE_R_RESULT, "Render Result");
if (sima->image == NULL) {
- ED_space_image_set(bmain, sima, scene, NULL, ima);
+ ED_space_image_set(bmain, sima, NULL, ima);
}
RE_ReadRenderResult(scene, scene);
@@ -3755,6 +3866,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
scene->r.mode |= R_BORDER;
}
+ DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, NULL);
return OPERATOR_FINISHED;
@@ -3764,8 +3876,8 @@ static int render_border_exec(bContext *C, wmOperator *op)
void IMAGE_OT_render_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Render Border";
- ot->description = "Set the boundaries of the border render and enable border render";
+ ot->name = "Render Region";
+ ot->description = "Set the boundaries of the render region and enable render region";
ot->idname = "IMAGE_OT_render_border";
/* api callbacks */
@@ -3797,8 +3909,8 @@ static int clear_render_border_exec(bContext *C, wmOperator *UNUSED(op))
void IMAGE_OT_clear_render_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Clear Render Border";
- ot->description = "Clear the boundaries of the border render and disable border render";
+ ot->name = "Clear Render Region";
+ ot->description = "Clear the boundaries of the render region and disable render region";
ot->idname = "IMAGE_OT_clear_render_border";
/* api callbacks */
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 3c850ae1689..6ae4eb9767b 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/space_image.c
- * \ingroup spimage
+/** \file
+ * \ingroup spimage
*/
#include "DNA_gpencil_types.h"
@@ -71,7 +64,6 @@
#include "ED_uvedit.h"
#include "ED_transform.h"
-#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -83,6 +75,12 @@
#include "image_intern.h"
#include "GPU_framebuffer.h"
+#include "GPU_batch_presets.h"
+#include "GPU_viewport.h"
+
+/* TODO(fclem) remove bad level calls */
+#include "../draw/DRW_engine.h"
+#include "wm_draw.h"
/**************************** common state *****************************/
@@ -93,7 +91,7 @@ static void image_scopes_tag_refresh(ScrArea *sa)
/* only while histogram is visible */
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_TOOLS && ar->flag & RGN_FLAG_HIDDEN)
+ if (ar->regiontype == RGN_TYPE_TOOL_PROPS && ar->flag & RGN_FLAG_HIDDEN)
return;
}
@@ -302,9 +300,12 @@ static void image_keymap(struct wmKeyConfig *keyconf)
/* dropboxes */
static bool image_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
{
- if (drag->type == WM_DRAG_PATH)
- if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
+ if (drag->type == WM_DRAG_PATH) {
+ /* rule might not work? */
+ if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) {
return 1;
+ }
+ }
return 0;
}
@@ -334,7 +335,7 @@ static void image_refresh(const bContext *C, ScrArea *sa)
ima = ED_space_image(sima);
- BKE_image_user_check_frame_calc(&sima->iuser, scene->r.cfra);
+ BKE_image_user_frame_calc(&sima->iuser, scene->r.cfra);
/* check if we have to set the image from the editmesh */
if (ima && (ima->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)) {
@@ -397,7 +398,8 @@ static void image_listener(wmWindow *win, ScrArea *sa, wmNotifier *wmn, Scene *U
case NC_MASK:
{
// Scene *scene = wmn->window->screen->scene;
- /* ideally would check for: ED_space_image_check_show_maskedit(scene, sima) but we cant get the scene */
+ /* ideally would check for: ED_space_image_check_show_maskedit(scene, sima)
+ * but we cant get the scene */
if (sima->mode == SI_MODE_MASK) {
switch (wmn->data) {
case ND_SELECT:
@@ -620,6 +622,15 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
//View2DScrollers *scrollers;
float col[3];
+ /* XXX This is in order to draw UI batches with the DRW
+ * olg context since we now use it for drawing the entire area */
+ gpu_batch_presets_reset();
+
+ /* TODO(fclem) port to draw manager and remove the depth buffer allocation. */
+ GPUViewport *viewport = ar->draw_buffer->viewport[ar->draw_buffer->stereo ? sima->iuser.multiview_eye : 0];
+ DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport);
+ GPU_framebuffer_bind(fbl->color_only_fb);
+
/* XXX not supported yet, disabling for now */
scene->r.scemode &= ~R_COMP_CROP;
@@ -775,6 +786,27 @@ static void image_buttons_region_init(wmWindowManager *wm, ARegion *ar)
static void image_buttons_region_draw(const bContext *C, ARegion *ar)
{
+ SpaceImage *sima = CTX_wm_space_image(C);
+ Scene *scene = CTX_data_scene(C);
+ void *lock;
+ ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
+ /* XXX performance regression if name of scopes category changes! */
+ PanelCategoryStack *category = UI_panel_category_active_find(ar, "Scopes");
+
+ /* only update scopes if scope category is active */
+ if (category) {
+ if (ibuf) {
+ if (!sima->scopes.ok) {
+ BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
+ }
+ if (sima->image->flag & IMA_VIEW_AS_RENDER)
+ ED_space_image_scopes_update(C, sima, ibuf, true);
+ else
+ ED_space_image_scopes_update(C, sima, ibuf, false);
+ }
+ }
+ ED_space_image_release_buffer(sima, ibuf, lock);
+
ED_region_panels(C, ar);
}
@@ -829,27 +861,6 @@ static void image_tools_region_init(wmWindowManager *wm, ARegion *ar)
static void image_tools_region_draw(const bContext *C, ARegion *ar)
{
- SpaceImage *sima = CTX_wm_space_image(C);
- Scene *scene = CTX_data_scene(C);
- void *lock;
- ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
- /* XXX performance regression if name of scopes category changes! */
- PanelCategoryStack *category = UI_panel_category_active_find(ar, "Scopes");
-
- /* only update scopes if scope category is active */
- if (category) {
- if (ibuf) {
- if (!sima->scopes.ok) {
- BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
- }
- if (sima->image->flag & IMA_VIEW_AS_RENDER)
- ED_space_image_scopes_update(C, sima, ibuf, true);
- else
- ED_space_image_scopes_update(C, sima, ibuf, false);
- }
- }
- ED_space_image_release_buffer(sima, ibuf, lock);
-
ED_region_panels(C, ar);
}
@@ -1017,13 +1028,13 @@ void ED_spacetype_image(void)
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
art->regionid = RGN_TYPE_WINDOW;
- art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
+ art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_TOOL | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
art->init = image_main_region_init;
art->draw = image_main_region_draw;
art->listener = image_main_region_listener;
BLI_addhead(&st->regiontypes, art);
- /* regions: listview/buttons */
+ /* regions: listview/buttons/scopes */
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
art->regionid = RGN_TYPE_UI;
art->prefsizex = 220; // XXX
@@ -1036,7 +1047,7 @@ void ED_spacetype_image(void)
ED_uvedit_buttons_register(art);
image_buttons_register(art);
- /* regions: statistics/scope buttons */
+ /* regions: tool(bar) */
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
art->regionid = RGN_TYPE_TOOLS;
art->prefsizex = 58; /* XXX */
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index 4896515182e..f54e4921e6b 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -41,12 +38,12 @@ set(INC_SYS
)
set(SRC
- info_ops.c
- info_stats.c
info_draw.c
+ info_ops.c
info_report.c
- textview.c
+ info_stats.c
space_info.c
+ textview.c
info_intern.h
textview.h
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index ecd0b082df6..39d255427cc 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/info_draw.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
#include <math.h>
@@ -33,7 +27,6 @@
#include <sys/stat.h>
#include <limits.h>
-
#include "BLI_utildefines.h"
#include "DNA_space_types.h"
@@ -42,9 +35,6 @@
// #include "BKE_suggestions.h"
#include "BKE_report.h"
-#include "BIF_gl.h"
-
-
#include "UI_resources.h"
#include "UI_interface.h"
#include "UI_view2d.h"
diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h
index 37d3c73f705..7903a462ce1 100644
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/info_intern.h
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
#ifndef __INFO_INTERN_H__
@@ -33,9 +26,9 @@
/* internal exports only */
+struct ReportList;
struct SpaceInfo;
struct wmOperatorType;
-struct ReportList;
void FILE_OT_autopack_toggle(struct wmOperatorType *ot);
void FILE_OT_pack_all(struct wmOperatorType *ot);
@@ -60,7 +53,7 @@ void info_textview_main(struct SpaceInfo *sinfo, struct ARegion *ar, struct Repo
/* info_report.c */
int info_report_mask(struct SpaceInfo *sinfo);
void INFO_OT_select_pick(struct wmOperatorType *ot); /* report selection */
-void INFO_OT_select_all_toggle(struct wmOperatorType *ot);
+void INFO_OT_select_all(struct wmOperatorType *ot);
void INFO_OT_select_box(struct wmOperatorType *ot);
void INFO_OT_report_replay(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index ec0084931eb..538c41f730a 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/info_ops.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
@@ -130,12 +123,12 @@ static int autopack_toggle_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- if (G.fileflags & G_AUTOPACK) {
- G.fileflags &= ~G_AUTOPACK;
+ if (G.fileflags & G_FILE_AUTOPACK) {
+ G.fileflags &= ~G_FILE_AUTOPACK;
}
else {
packAll(bmain, op->reports, true);
- G.fileflags |= G_AUTOPACK;
+ G.fileflags |= G_FILE_AUTOPACK;
}
return OPERATOR_FINISHED;
@@ -173,7 +166,7 @@ static int pack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev
ImBuf *ibuf;
// first check for dirty images
- for (ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (ima = bmain->images.first; ima; ima = ima->id.next) {
if (BKE_image_has_loaded_ibuf(ima)) { /* XXX FIX */
ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
@@ -218,7 +211,8 @@ static const EnumPropertyItem unpack_all_method_items[] = {
{PF_WRITE_ORIGINAL, "WRITE_ORIGINAL", 0, "Write files to original location (overwrite existing files)", ""},
{PF_KEEP, "KEEP", 0, "Disable Auto-pack, keep all packed files", ""},
/* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int unpack_all_exec(bContext *C, wmOperator *op)
{
@@ -226,7 +220,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op)
int method = RNA_enum_get(op->ptr, "method");
if (method != PF_KEEP) unpackAll(bmain, op->reports, method); /* XXX PF_ASK can't work here */
- G.fileflags &= ~G_AUTOPACK;
+ G.fileflags &= ~G_FILE_AUTOPACK;
return OPERATOR_FINISHED;
}
@@ -243,7 +237,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
if (!count) {
BKE_report(op->reports, RPT_WARNING, "No packed files to unpack");
- G.fileflags &= ~G_AUTOPACK;
+ G.fileflags &= ~G_FILE_AUTOPACK;
return OPERATOR_CANCELLED;
}
@@ -289,7 +283,8 @@ static const EnumPropertyItem unpack_item_method_items[] = {
{PF_USE_ORIGINAL, "USE_ORIGINAL", 0, "Use file in original location (create when necessary)", ""},
{PF_WRITE_ORIGINAL, "WRITE_ORIGINAL", 0, "Write file to original location (overwrite existing file)", ""},
/* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int unpack_item_exec(bContext *C, wmOperator *op)
@@ -311,7 +306,7 @@ static int unpack_item_exec(bContext *C, wmOperator *op)
if (method != PF_KEEP)
BKE_unpack_id(bmain, id, op->reports, method); /* XXX PF_ASK can't work here */
- G.fileflags &= ~G_AUTOPACK;
+ G.fileflags &= ~G_FILE_AUTOPACK;
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index d512ac8b32b..73c36f64cb5 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/editors/space_info/info_report.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
@@ -41,6 +35,7 @@
#include "WM_types.h"
#include "ED_screen.h"
+#include "ED_select_utils.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -160,34 +155,40 @@ void INFO_OT_select_pick(wmOperatorType *ot)
RNA_def_int(ot->srna, "report_index", 0, 0, INT_MAX, "Report", "Index of the report", 0, INT_MAX);
}
-
-
-static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
+static int report_select_all_exec(bContext *C, wmOperator *op)
{
SpaceInfo *sinfo = CTX_wm_space_info(C);
ReportList *reports = CTX_wm_reports(C);
- int report_mask = info_report_mask(sinfo);
- int deselect = 0;
+ const int report_mask = info_report_mask(sinfo);
- Report *report;
+ int action = RNA_enum_get(op->ptr, "action");
- for (report = reports->list.last; report; report = report->prev) {
- if ((report->type & report_mask) && (report->flag & SELECT)) {
- deselect = 1;
- break;
+ if (action == SEL_TOGGLE) {
+ action = SEL_SELECT;
+ for (Report *report = reports->list.last; report; report = report->prev) {
+ if ((report->type & report_mask) && (report->flag & SELECT)) {
+ action = SEL_DESELECT;
+ break;
+ }
}
}
-
- 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)
- report->flag |= SELECT;
+ for (Report *report = reports->list.last; report; report = report->prev) {
+ if (report->type & report_mask) {
+ switch (action) {
+ case SEL_SELECT:
+ report->flag = SELECT;
+ break;
+ case SEL_DESELECT:
+ report->flag = ~SELECT;
+ break;
+ case SEL_INVERT:
+ report->flag ^= SELECT;
+ break;
+ default:
+ BLI_assert(0);
+ }
+ }
}
ED_area_tag_redraw(CTX_wm_area(C));
@@ -195,21 +196,19 @@ static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void INFO_OT_select_all_toggle(wmOperatorType *ot)
+void INFO_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "(De)select All";
- ot->description = "Select or deselect all reports";
- ot->idname = "INFO_OT_select_all_toggle";
+ ot->description = "Change selection of all visible reports";
+ ot->idname = "INFO_OT_select_all";
/* api callbacks */
ot->poll = ED_operator_info_active;
- ot->exec = report_select_all_toggle_exec;
-
- /* flags */
- /*ot->flag = OPTYPE_REGISTER;*/
+ ot->exec = report_select_all_exec;
/* properties */
+ WM_operator_properties_select_action(ot, SEL_SELECT);
}
/* box_select operator */
@@ -219,25 +218,18 @@ static int box_select_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
ReportList *reports = CTX_wm_reports(C);
int report_mask = info_report_mask(sinfo);
- const bool extend = RNA_boolean_get(op->ptr, "extend");
- Report *report_min, *report_max, *report;
-
- //View2D *v2d = UI_view2d_fromcontext(C);
-
-
+ Report *report_min, *report_max;
rcti rect;
- //rctf rectf, rq;
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- //int mval[2];
WM_operator_properties_border_to_rcti(op, &rect);
- if (!extend) {
- for (report = reports->list.first; report; report = report->next) {
-
- if ((report->type & report_mask) == 0)
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const int select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ for (Report *report = reports->list.first; report; report = report->next) {
+ if ((report->type & report_mask) == 0) {
continue;
-
+ }
report->flag &= ~SELECT;
}
}
@@ -248,7 +240,7 @@ static int box_select_exec(bContext *C, wmOperator *op)
/* get the first report if none found */
if (report_min == NULL) {
// printf("find_min\n");
- for (report = reports->list.first; report; report = report->next) {
+ for (Report *report = reports->list.first; report; report = report->next) {
if (report->type & report_mask) {
report_min = report;
break;
@@ -258,7 +250,7 @@ static int box_select_exec(bContext *C, wmOperator *op)
if (report_max == NULL) {
// printf("find_max\n");
- for (report = reports->list.last; report; report = report->prev) {
+ for (Report *report = reports->list.last; report; report = report->prev) {
if (report->type & report_mask) {
report_max = report;
break;
@@ -266,18 +258,15 @@ static int box_select_exec(bContext *C, wmOperator *op)
}
}
- 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) {
-
- if ((report->type & report_mask) == 0)
+ for (Report *report = report_min; (report != report_max->next); report = report->next) {
+ if ((report->type & report_mask) == 0) {
continue;
-
- if (select)
- report->flag |= SELECT;
- else
- report->flag &= ~SELECT;
+ }
+ SET_FLAG_FROM_TEST(report->flag, select, SELECT);
}
ED_area_tag_redraw(CTX_wm_area(C));
@@ -305,12 +294,11 @@ void INFO_OT_select_box(wmOperatorType *ot)
/* flags */
/* ot->flag = OPTYPE_REGISTER; */
- /* rna */
- WM_operator_properties_gesture_box_select(ot);
+ /* properties */
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
-
-
static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceInfo *sinfo = CTX_wm_space_info(C);
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index de406ccdc59..e788af1507e 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/info_stats.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
@@ -38,6 +32,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_scene_types.h"
+#include "DNA_windowmanager_types.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
@@ -52,6 +47,7 @@
#include "BKE_displist.h"
#include "BKE_key.h"
#include "BKE_layer.h"
+#include "BKE_main.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_editmesh.h"
@@ -96,7 +92,7 @@ typedef struct SceneStatsFmt {
char totgpstroke[MAX_INFO_NUM_LEN], totgppoint[MAX_INFO_NUM_LEN];
} SceneStatsFmt;
-static bool stats_mesheval(Mesh *me_eval, int sel, int totob, SceneStats *stats)
+static bool stats_mesheval(Mesh *me_eval, bool is_selected, SceneStats *stats)
{
if (me_eval == NULL) {
return false;
@@ -115,32 +111,37 @@ static bool stats_mesheval(Mesh *me_eval, int sel, int totob, SceneStats *stats)
totloop = me_eval->totloop;
}
- stats->totvert += totvert * totob;
- stats->totedge += totedge * totob;
- stats->totface += totface * totob;
- stats->tottri += poly_to_tri_count(totface, totloop) * totob;
+ stats->totvert += totvert;
+ stats->totedge += totedge;
+ stats->totface += totface;
+ stats->tottri += poly_to_tri_count(totface, totloop);
- if (sel) {
+ if (is_selected) {
stats->totvertsel += totvert;
stats->totfacesel += totface;
}
return true;
}
-static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
+static void stats_object(Object *ob, SceneStats *stats)
{
+ const bool is_selected = (ob->base_flag & BASE_SELECTED) != 0;
+
+ stats->totobj++;
+ if (is_selected) stats->totobjsel++;
+
switch (ob->type) {
case OB_MESH:
{
/* we assume evaluated mesh is already built, this strictly does stats now. */
Mesh *me_eval = ob->runtime.mesh_eval;
- stats_mesheval(me_eval, sel, totob, stats);
+ stats_mesheval(me_eval, is_selected, stats);
break;
}
case OB_LAMP:
- stats->totlamp += totob;
- if (sel) {
- stats->totlampsel += totob;
+ stats->totlamp++;
+ if (is_selected) {
+ stats->totlampsel++;
}
break;
case OB_SURF:
@@ -148,7 +149,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
case OB_FONT:
{
Mesh *me_eval = ob->runtime.mesh_eval;
- if (stats_mesheval(me_eval, sel, totob, stats)) {
+ if (stats_mesheval(me_eval, is_selected, stats)) {
break;
}
ATTR_FALLTHROUGH; /* Falltrough to displist. */
@@ -160,15 +161,11 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
if (ob->runtime.curve_cache && ob->runtime.curve_cache->disp.first)
BKE_displist_count(&ob->runtime.curve_cache->disp, &totv, &totf, &tottri);
- totv *= totob;
- totf *= totob;
- tottri *= totob;
-
stats->totvert += totv;
stats->totface += totf;
stats->tottri += tottri;
- if (sel) {
+ if (is_selected) {
stats->totvertsel += totv;
stats->totfacesel += totf;
}
@@ -176,7 +173,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
}
case OB_GPENCIL:
{
- if (sel) {
+ if (is_selected) {
bGPdata *gpd = (bGPdata *)ob->data;
/* GPXX Review if we can move to other place when object change
* maybe to depsgraph evaluation
@@ -318,92 +315,6 @@ static void stats_object_sculpt_dynamic_topology(Object *ob, SceneStats *stats)
stats->tottri = ob->sculpt->bm->totface;
}
-static void stats_dupli_object_group_count(Collection *collection, int *count)
-{
- *count += BLI_listbase_count(&collection->gobject);
-
- for (CollectionChild *child = collection->children.first; child; child = child->next) {
- stats_dupli_object_group_count(child->collection, count);
- }
-}
-
-static void stats_dupli_object_group_doit(Collection *collection, SceneStats *stats, ParticleSystem *psys,
- const int totgroup, int *cur)
-{
- for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
- int tot = count_particles_mod(psys, totgroup, *cur);
- stats_object(cob->ob, 0, tot, stats);
- (*cur)++;
- }
-
- for (CollectionChild *child = collection->children.first; child; child = child->next) {
- stats_dupli_object_group_doit(child->collection, stats, psys, totgroup, cur);
- }
-}
-
-static void stats_dupli_object(Object *ob, SceneStats *stats)
-{
- const bool is_selected = (ob->base_flag & BASE_SELECTED) != 0;
- if (is_selected) stats->totobjsel++;
-
- if (ob->transflag & OB_DUPLIPARTS) {
- /* Dupli Particles */
- ParticleSystem *psys;
- ParticleSettings *part;
-
- for (psys = ob->particlesystem.first; psys; psys = psys->next) {
- part = psys->part;
-
- 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) {
- int totgroup = 0, cur = 0;
-
- Collection *collection = part->dup_group;
- stats_dupli_object_group_count(collection, &totgroup);
- stats_dupli_object_group_doit(collection, stats, psys, totgroup, &cur);
- }
- }
-
- stats_object(ob, is_selected, 1, stats);
- stats->totobj++;
- }
- else if (ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS | OB_DUPLIFACES))) {
- /* Dupli Verts/Faces */
- int tot;
-
- /* metaball dupli-instances are tessellated once */
- if (ob->type == OB_MBALL) {
- tot = 1;
- }
- else {
- tot = count_duplilist(ob->parent);
- }
-
- stats->totobj += tot;
- stats_object(ob, is_selected, tot, stats);
- }
- else if (ob->transflag & OB_DUPLIFRAMES) {
- /* Dupli Frames */
- int tot = count_duplilist(ob);
- stats->totobj += tot;
- stats_object(ob, is_selected, tot, stats);
- }
- else if ((ob->transflag & OB_DUPLICOLLECTION) && ob->dup_group) {
- /* Dupli Group */
- int tot = count_duplilist(ob);
- stats->totobj += tot;
- stats_object(ob, is_selected, tot, stats);
- }
- else {
- /* No Dupli */
- stats_object(ob, is_selected, 1, stats);
- stats->totobj++;
- }
-}
-
static bool stats_is_object_dynamic_topology_sculpt(Object *ob, const eObjectMode object_mode)
{
return (ob &&
@@ -438,7 +349,7 @@ static void stats_update(Depsgraph *depsgraph, ViewLayer *view_layer)
/* Objects */
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob_iter)
{
- stats_dupli_object(ob_iter, &stats);
+ stats_object(ob_iter, &stats);
}
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END;
}
@@ -597,8 +508,15 @@ void ED_info_stats_clear(ViewLayer *view_layer)
}
}
-const char *ED_info_stats_string(Scene *scene, ViewLayer *view_layer)
+const char *ED_info_stats_string(Main *bmain, Scene *scene, ViewLayer *view_layer)
{
+ /* Loopin through dependency graph when interface is locked in not safe.
+ * Thew interface is marked as locked when jobs wants to modify the
+ * dependency graph. */
+ wmWindowManager *wm = bmain->wm.first;
+ if (wm->is_interface_locked) {
+ return "";
+ }
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
if (!view_layer->stats) {
stats_update(depsgraph, view_layer);
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 076b66ef012..754941a12c0 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_info/space_info.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
@@ -40,14 +33,11 @@
#include "BLT_translation.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_screen.h"
#include "ED_space_api.h"
#include "ED_screen.h"
-#include "BIF_gl.h"
-
#include "WM_api.h"
#include "WM_types.h"
#include "WM_message.h"
@@ -197,7 +187,7 @@ static void info_operatortypes(void)
/* info_report.c */
WM_operatortype_append(INFO_OT_select_pick);
- WM_operatortype_append(INFO_OT_select_all_toggle);
+ WM_operatortype_append(INFO_OT_select_all);
WM_operatortype_append(INFO_OT_select_box);
WM_operatortype_append(INFO_OT_report_replay);
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index c94aaf6e861..a335d6d0bfb 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/editors/space_info/textview.c
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
@@ -42,7 +36,6 @@
#include "GPU_immediate.h"
#include "GPU_state.h"
-#include "BIF_gl.h"
#include "BKE_text.h"
@@ -58,13 +51,16 @@ typedef struct ConsoleDrawContext {
int font_id;
int cwidth;
int lheight;
- int lofs; /* text vertical offset */
- int console_width; /* number of characters that fit into the width of the console (fixed width) */
+ /** text vertical offset */
+ int lofs;
+ /** number of characters that fit into the width of the console (fixed width) */
+ int console_width;
int winx;
int ymin, ymax;
int *xy; // [2]
int *sel; // [2]
- int *pos_pick; // bottom of view == 0, top of file == combine chars, end of line is lower then start.
+ /* bottom of view == 0, top of file == combine chars, end of line is lower then start. */
+ int *pos_pick;
const int *mval; // [2]
int draw;
} ConsoleDrawContext;
diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h
index 55f69fbf444..40478e30f37 100644
--- a/source/blender/editors/space_info/textview.h
+++ b/source/blender/editors/space_info/textview.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/editors/space_info/textview.h
- * \ingroup spinfo
+/** \file
+ * \ingroup spinfo
*/
#ifndef __TEXTVIEW_H__
@@ -48,7 +42,8 @@ typedef struct TextViewContext {
int (*step)(struct TextViewContext *tvc);
int (*line_get)(struct TextViewContext *tvc, const char **, int *);
int (*line_color)(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3]);
- void (*const_colors)(struct TextViewContext *tvc, unsigned char bg_sel[4]); /* constant theme colors */
+ /* constant theme colors */
+ void (*const_colors)(struct TextViewContext *tvc, unsigned char bg_sel[4]);
void *iter;
int iter_index;
int iter_char; /* char intex, used for multi-line report display */
diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt
index a6b80a9a587..eb0d92e2e69 100644
--- a/source/blender/editors/space_nla/CMakeLists.txt
+++ b/source/blender/editors/space_nla/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index d5d50c86851..049342b0244 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_buttons.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -156,7 +149,8 @@ bool nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA *nlt_p
id = ale->id;
}
else {
- /* ale->data is always the proper ID block we need, but ale->id may not be (i.e. for textures) */
+ /* ale->data is always the proper ID block we need,
+ * but ale->id may not be (i.e. for textures) */
id = (ID *)ale->data;
}
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 2bd5bafe2d4..ae3888f6ae0 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_channels.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -68,7 +61,8 @@
#include "nla_intern.h" // own include
/* *********************************************** */
-/* Operators for NLA channels-list which need to be different from the standard Animation Editor ones */
+/* Operators for NLA channels-list which need to be different
+ * from the standard Animation Editor ones */
/* ******************** Mouse-Click Operator *********************** */
/* Depending on the channel that was clicked on, the mouse click will activate whichever
@@ -260,7 +254,8 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
nlt->flag |= NLATRACK_SELECTED;
}
- /* if NLA-Track is selected now, make NLA-Track the 'active' one in the visible list */
+ /* if NLA-Track is selected now,
+ * make NLA-Track the 'active' one in the visible list */
if (nlt->flag & NLATRACK_SELECTED)
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nlt, ANIMTYPE_NLATRACK);
@@ -557,7 +552,8 @@ static int nla_action_unlink_exec(bContext *C, wmOperator *op)
static int nla_action_unlink_invoke(bContext *C, wmOperator *op, const wmEvent *evt)
{
- /* NOTE: this is hardcoded to match the behavior for the unlink button (in interface_templates.c) */
+ /* NOTE: this is hardcoded to match the behavior for the unlink button
+ * (in interface_templates.c) */
RNA_boolean_set(op->ptr, "force_delete", evt->shift != 0);
return nla_action_unlink_exec(C, op);
}
@@ -614,7 +610,8 @@ bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel)
added = true;
}
else if ((lastAdt == NULL) || (adt != lastAdt)) {
- /* add one track to the top of the owning AnimData's stack, then don't add anymore to this stack */
+ /* add one track to the top of the owning AnimData's stack,
+ * then don't add anymore to this stack */
BKE_nlatrack_add(adt, NULL);
lastAdt = adt;
ale->update = ANIM_UPDATE_DEPS;
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 2cba6cf2fb2..c73fd768075 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_draw.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -53,7 +46,6 @@
#include "ED_anim_api.h"
#include "ED_keyframes_draw.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -95,7 +87,8 @@ void nla_action_get_color(AnimData *adt, bAction *act, float color[4])
}
}
- /* when an NLA track is tagged "solo", action doesn't contribute, so shouldn't be as prominent */
+ /* when an NLA track is tagged "solo", action doesn't contribute,
+ * so shouldn't be as prominent */
if (adt && (adt->flag & ADT_NLA_SOLO_TRACK))
color[3] *= 0.15f;
}
@@ -339,7 +332,8 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns
if ((IS_EQF(strip->blendin, 0.0f) && IS_EQF(strip->blendout, 0.0f)) == 0) {
immBeginAtMost(GPU_PRIM_LINE_STRIP, 4);
- /* start of strip - if no blendin, start straight at 1, otherwise from 0 to 1 over blendin frames */
+ /* start of strip - if no blendin, start straight at 1,
+ * otherwise from 0 to 1 over blendin frames */
if (IS_EQF(strip->blendin, 0.0f) == 0) {
immVertex2f(pos, strip->start, yminc);
immVertex2f(pos, strip->start + strip->blendin, ymaxc);
@@ -417,7 +411,8 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
GPU_blend(true);
switch (strip->extendmode) {
- /* since this does both sides, only do the 'before' side, and leave the rest to the next case */
+ /* since this does both sides,
+ * only do the 'before' side, and leave the rest to the next case */
case NLASTRIP_EXTEND_HOLD:
/* only need to draw here if there's no strip before since
* it only applies in such a situation
@@ -479,7 +474,8 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
immUnbindProgram();
- /* draw markings indicating locations of local markers (useful for lining up different actions) */
+ /* draw markings indicating locations of local markers
+ * (useful for lining up different actions) */
if ((snla->flag & SNLA_NOLOCALMARKERS) == 0)
nla_strip_draw_markers(strip, yminc, ymaxc);
@@ -532,11 +528,13 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
}
immEnd();
}
- /* or if meta-strip, draw lines delimiting extents of sub-strips (in same color as outline, if more than 1 exists) */
+ /* or if meta-strip, draw lines delimiting extents of sub-strips
+ * (in same color as outline, if more than 1 exists) */
else if ((strip->type == NLASTRIP_TYPE_META) && (strip->strips.first != strip->strips.last)) {
const float y = (ymaxc - yminc) * 0.5f + yminc;
- immBeginAtMost(GPU_PRIM_LINES, 4 * BLI_listbase_count(&strip->strips)); /* up to 2 lines per strip */
+ /* up to 2 lines per strip */
+ immBeginAtMost(GPU_PRIM_LINES, 4 * BLI_listbase_count(&strip->strips));
/* only draw first-level of child-strips, but don't draw any lines on the endpoints */
for (NlaStrip *cs = strip->strips.first; cs; cs = cs->next) {
@@ -603,7 +601,7 @@ static void nla_draw_strip_text(
.xmin = xminc,
.ymin = yminc,
.xmax = xmaxc,
- .ymax = ymaxc
+ .ymax = ymaxc,
};
/* add this string to the cache of texts to draw */
@@ -798,7 +796,8 @@ void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar)
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
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) */
+ /* 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);
/* draw channels */
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 3cab4cfefca..a92a2ec66ca 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_edit.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -418,7 +411,8 @@ static bool nla_channels_get_selected_extents(bAnimContext *ac, float *min, floa
SpaceNla *snla = (SpaceNla *)ac->sl;
const float half_height = NLACHANNEL_HEIGHT_HALF(snla);
- short found = 0; /* NOTE: not bool, since we want prioritise individual channels over expanders */
+ /* NOTE: not bool, since we want prioritise individual channels over expanders */
+ short found = 0;
float y;
/* get all items - we need to do it this way */
@@ -480,7 +474,8 @@ static int nlaedit_viewall(bContext *C, const bool only_sel)
/* set vertical range */
if (only_sel == false) {
- /* view all -> the summary channel is usually the shows everything, and resides right at the top... */
+ /* view all -> the summary channel is usually the shows everything,
+ * and resides right at the top... */
v2d->cur.ymax = 0.0f;
v2d->cur.ymin = (float)-BLI_rcti_size_y(&v2d->mask);
}
@@ -580,7 +575,8 @@ void NLA_OT_view_frame(wmOperatorType *ot)
/* NLA Editing Operations (Constructive/Destructive) */
/* ******************** Add Action-Clip Operator ***************************** */
-/* Add a new Action-Clip strip to the active track (or the active block if no space in the track) */
+/* Add a new Action-Clip strip to the active track
+ * (or the active block if no space in the track) */
/* add the specified action as new strip */
@@ -606,7 +602,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
cfra = (float)CFRA;
/* get action to use */
- act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
+ act = BLI_findlink(&CTX_data_main(C)->actions, RNA_enum_get(op->ptr, "action"));
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid action to add");
@@ -614,7 +610,8 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
else if (act->idroot == 0) {
- /* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */
+ /* hopefully in this case (i.e. library of userless actions),
+ * the user knows what they're doing... */
BKE_reportf(op->reports, RPT_WARNING,
"Action '%s' does not specify what data-blocks it can be used on "
"(try setting the 'ID Root Type' setting from the data-blocks editor "
@@ -639,7 +636,8 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* for every active track, try to add strip to free space in track or to the top of the stack if no space */
+ /* for every active track,
+ * try to add strip to free space in track or to the top of the stack if no space */
for (ale = anim_data.first; ale; ale = ale->next) {
NlaTrack *nlt = (NlaTrack *)ale->data;
AnimData *adt = ale->adt;
@@ -1078,7 +1076,8 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op)
/* make a copy (assume that this is possible) */
nstrip = BKE_nlastrip_copy(ac.bmain, strip, linked, 0);
- /* in case there's no space in the track above, or we haven't got a reference to it yet, try adding */
+ /* in case there's no space in the track above,
+ * or we haven't got a reference to it yet, try adding */
if (BKE_nlatrack_add_strip(nlt->next, nstrip) == 0) {
/* need to add a new track above the one above the current one
* - if the current one is the last one, nlt->next will be NULL, which defaults to adding
@@ -1509,7 +1508,8 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op)
nlt->name);
}
else if (sa == NULL) {
- /* no warning as this is just a common case, and it may get annoying when doing multiple tracks */
+ /* no warning as this is just a common case,
+ * and it may get annoying when doing multiple tracks */
}
else if (sb == NULL) {
/* too few selected warning */
@@ -1520,7 +1520,8 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op)
else {
float nsa[2], nsb[2];
- /* remove these strips from the track, so that we can test if they can fit in the proposed places */
+ /* remove these strips from the track,
+ * so that we can test if they can fit in the proposed places */
BLI_remlink(&nlt->strips, sa);
BLI_remlink(&nlt->strips, sb);
@@ -1633,7 +1634,8 @@ static int nlaedit_move_up_exec(bContext *C, wmOperator *UNUSED(op))
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* check if the track above has room for this strip */
if (BKE_nlatrack_has_space(nltn, strip->start, strip->end)) {
- /* remove from its current track, and add to the one above (it 'should' work, so no need to worry) */
+ /* remove from its current track, and add to the one above
+ * (it 'should' work, so no need to worry) */
BLI_remlink(&nlt->strips, strip);
BKE_nlatrack_add_strip(nltn, strip);
}
@@ -1707,7 +1709,8 @@ static int nlaedit_move_down_exec(bContext *C, wmOperator *UNUSED(op))
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* check if the track below has room for this strip */
if (BKE_nlatrack_has_space(nltp, strip->start, strip->end)) {
- /* remove from its current track, and add to the one above (it 'should' work, so no need to worry) */
+ /* remove from its current track, and add to the one above
+ * (it 'should' work, so no need to worry) */
BLI_remlink(&nlt->strips, strip);
BKE_nlatrack_add_strip(nltp, strip);
}
@@ -1953,23 +1956,27 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
NlaStrip *strip;
for (strip = nlt->strips.first; strip; strip = strip->next) {
- /* strip must be selected, and must be action-clip only (transitions don't have scale) */
+ /* strip must be selected, and must be action-clip only
+ * (transitions don't have scale) */
if ((strip->flag & NLASTRIP_FLAG_SELECT) && (strip->type == NLASTRIP_TYPE_CLIP)) {
- /* if the referenced action is used by other strips, make this strip use its own copy */
+ /* if the referenced action is used by other strips,
+ * make this strip use its own copy */
if (strip->act == NULL)
continue;
if (strip->act->id.us > 1) {
/* make a copy of the Action to work on */
bAction *act = BKE_action_copy(bmain, strip->act);
- /* set this as the new referenced action, decrementing the users of the old one */
+ /* set this as the new referenced action,
+ * decrementing the users of the old one */
id_us_min(&strip->act->id);
strip->act = act;
copied = true;
}
- /* setup iterator, and iterate over all the keyframes in the action, applying this scaling */
+ /* setup iterator, and iterate over all the keyframes in the action,
+ * applying this scaling */
ked.data = strip;
ANIM_animchanneldata_keyframes_loop(&ked, ac.ads, strip->act, ALE_ACT, NULL, bezt_apply_nlamapping, calchandles_fcurve);
@@ -2040,7 +2047,8 @@ static int nlaedit_clear_scale_exec(bContext *C, wmOperator *UNUSED(op))
NlaStrip *strip;
for (strip = nlt->strips.first; strip; strip = strip->next) {
- /* strip must be selected, and must be action-clip only (transitions don't have scale) */
+ /* strip must be selected, and must be action-clip only
+ * (transitions don't have scale) */
if ((strip->flag & NLASTRIP_FLAG_SELECT) && (strip->type == NLASTRIP_TYPE_CLIP)) {
PointerRNA strip_ptr;
@@ -2087,7 +2095,7 @@ static const EnumPropertyItem prop_nlaedit_snap_types[] = {
{NLAEDIT_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", ""}, // XXX as single entry?
{NLAEDIT_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second", ""}, // XXX as single entry?
{NLAEDIT_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int nlaedit_snap_exec(bContext *C, wmOperator *op)
@@ -2182,7 +2190,8 @@ static int nlaedit_snap_exec(bContext *C, wmOperator *op)
track = BKE_nlatrack_add(adt, nlt);
BKE_nlatrack_add_strip(track, strip);
- /* clear temp meta-strips on this new track, as we may not be able to get back to it */
+ /* clear temp meta-strips on this new track,
+ * as we may not be able to get back to it */
BKE_nlastrips_clear_metas(&track->strips, 0, 1);
}
}
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 59844f31447..bb52d9d7f76 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_intern.h
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
#ifndef __NLA_INTERN_H__
@@ -60,7 +53,7 @@ enum eNlaEdit_LeftRightSelect_Mode {
NLAEDIT_LRSEL_TEST = -1,
NLAEDIT_LRSEL_NONE,
NLAEDIT_LRSEL_LEFT,
- NLAEDIT_LRSEL_RIGHT
+ NLAEDIT_LRSEL_RIGHT,
};
/* --- */
@@ -78,7 +71,7 @@ enum eNlaEdit_Snap_Mode {
NLAEDIT_SNAP_CFRA = 1,
NLAEDIT_SNAP_NEAREST_FRAME,
NLAEDIT_SNAP_NEAREST_SECOND,
- NLAEDIT_SNAP_NEAREST_MARKER
+ NLAEDIT_SNAP_NEAREST_MARKER,
};
/* --- */
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 0122306f709..6653c3995b5 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_ops.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
#include <string.h>
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index db7f5d707d2..f326637f1cd 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung (major recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/nla_select.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -291,29 +284,21 @@ static int nlaedit_box_select_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
rcti rect;
- short mode = 0, selectmode = 0;
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
+ short mode = 0;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- /* clear all selection if not extending selection */
- if (!extend) {
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const int selectmode = (sel_op != SEL_OP_SUB) ? SELECT_ADD : SELECT_SUBTRACT;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT);
}
/* get settings from operator */
WM_operator_properties_border_to_rcti(op, &rect);
- if (select) {
- selectmode = SELECT_ADD;
- }
- else {
- selectmode = SELECT_SUBTRACT;
- }
-
/* selection 'mode' depends on whether box_select region only matters on one axis */
if (RNA_boolean_get(op->ptr, "axis_range")) {
/* mode depends on which axis of the range is larger to determine which axis to use
@@ -356,10 +341,11 @@ void NLA_OT_select_box(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- /* rna */
- WM_operator_properties_gesture_box_select(ot);
-
+ /* properties */
RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/* ******************** Select Left/Right Operator ************************* */
@@ -370,7 +356,7 @@ static const EnumPropertyItem prop_nlaedit_leftright_select_types[] = {
{NLAEDIT_LRSEL_TEST, "CHECK", 0, "Check if Select Left or Right", ""},
{NLAEDIT_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""},
{NLAEDIT_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* ------------------- */
@@ -536,7 +522,8 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s
float x, y;
- /* use View2D to determine the index of the channel (i.e a row in the list) where keyframe was */
+ /* use View2D to determine the index of the channel
+ * (i.e a row in the list) where keyframe was */
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, 0, NLACHANNEL_STEP(snla), 0, (float)NLACHANNEL_HEIGHT_HALF(snla), x, y, NULL, &channel_index);
@@ -563,14 +550,16 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s
if (ale->type == ANIMTYPE_NLATRACK) {
NlaTrack *nlt = (NlaTrack *)ale->data;
- /* loop over NLA-strips in this track, trying to find one which occurs in the necessary bounds */
+ /* loop over NLA-strips in this track,
+ * trying to find one which occurs in the necessary bounds */
for (strip = nlt->strips.first; strip; strip = strip->next) {
if (BKE_nlastrip_within_bounds(strip, xmin, xmax))
break;
}
}
- /* remove active channel from list of channels for separate treatment (since it's needed later on) */
+ /* remove active channel from list of channels for separate treatment
+ * (since it's needed later on) */
BLI_remlink(&anim_data, ale);
/* free list of channels, since it's not used anymore */
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 1a7793fadb9..84b8a64bc62 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_nla/space_nla.c
- * \ingroup spnla
+/** \file
+ * \ingroup spnla
*/
@@ -42,8 +35,6 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
#include "BKE_screen.h"
#include "ED_space_api.h"
@@ -51,7 +42,6 @@
#include "ED_markers.h"
#include "ED_screen.h"
-#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -311,7 +301,9 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar)
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
- ED_markers_draw(C, DRAW_MARKERS_MARGIN);
+ int marker_draw_flag = DRAW_MARKERS_MARGIN;
+ if (snla->flag & SNLA_SHOW_MARKER_LINES) marker_draw_flag |= DRAW_MARKERS_LINES;
+ ED_markers_draw(C, marker_draw_flag);
/* preview range */
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index 06a00945452..0950e738e3e 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -47,8 +44,8 @@ set(SRC
node_buttons.c
node_draw.c
node_edit.c
- node_group.c
node_gizmo.c
+ node_group.c
node_ops.c
node_relationships.c
node_select.c
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index ec47d140193..60dcdaebb08 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Bob Holcomb, Thomas Dinges
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/drawnode.c
- * \ingroup spnode
- * \brief lower level node drawing for nodes (boarders, headers etc), also node layout.
+/** \file
+ * \ingroup spnode
+ * \brief lower level node drawing for nodes (boarders, headers etc), also node layout.
*/
#include "BLI_blenlib.h"
@@ -162,7 +154,8 @@ static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA
}
#define SAMPLE_FLT_ISNONE FLT_MAX
-static float _sample_col[4] = {SAMPLE_FLT_ISNONE}; /* bad bad, 2.5 will do better?... no it won't... */
+/* bad bad, 2.5 will do better?... no it won't... */
+static float _sample_col[4] = {SAMPLE_FLT_ISNONE};
void ED_node_sample_set(const float col[4])
{
if (col) {
@@ -362,7 +355,8 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float asp
BLF_enable(fontid, BLF_ASPECT);
BLF_aspect(fontid, aspect, aspect, 1.0f);
- BLF_size(fontid, MIN2(24, font_size), U.dpi); /* clamp otherwise it can suck up a LOT of memory */
+ /* clamp otherwise it can suck up a LOT of memory */
+ BLF_size(fontid, MIN2(24, font_size), U.dpi);
/* title color */
UI_GetThemeColorBlendShade3ubv(TH_TEXT, color_id, 0.4f, 10, color);
@@ -652,7 +646,8 @@ static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr,
source = RNA_enum_get(imaptr, "source");
if (source == IMA_SRC_SEQUENCE) {
- /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
+ /* 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 = iuserptr->data;
/* Image *ima = imaptr->data; */ /* UNUSED */
@@ -1795,17 +1790,18 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi
/* using different collection properties if multilayer format is enabled */
if (multilayer) {
uiTemplateList(col, C, "UI_UL_list", "file_output_node", ptr, "layer_slots", ptr, "active_input_index",
- NULL, 0, 0, 0, 0, false);
+ NULL, 0, 0, 0, 0, false, false);
RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "layer_slots"),
active_index, &active_input_ptr);
}
else {
uiTemplateList(col, C, "UI_UL_list", "file_output_node", ptr, "file_slots", ptr, "active_input_index",
- NULL, 0, 0, 0, 0, false);
+ NULL, 0, 0, 0, 0, false, false);
RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "file_slots"),
active_index, &active_input_ptr);
}
- /* XXX collection lookup does not return the ID part of the pointer, setting this manually here */
+ /* XXX collection lookup does not return the ID part of the pointer,
+ * setting this manually here */
active_input_ptr.id.data = ptr->id.data;
col = uiLayoutColumn(row, true);
@@ -2903,7 +2899,7 @@ static void node_texture_set_butfunc(bNodeType *ntype)
}
}
-/* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */
+/* ****** init draw callbacks for all tree types, only called in usiblender.c, once ************ */
static void node_property_update_default(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
@@ -2967,9 +2963,6 @@ void ED_node_init_butfuncs(void)
/* Fallback types for undefined tree, nodes, sockets
* Defined in blenkernel, but not registered in type hashes.
*/
- /*extern bNodeTreeType NodeTreeTypeUndefined;*/
- extern bNodeType NodeTypeUndefined;
- extern bNodeSocketType NodeSocketTypeUndefined;
/* default ui functions */
NodeTypeUndefined.draw_nodetype = node_draw_default;
@@ -3054,7 +3047,8 @@ static void std_node_socket_interface_draw_color(bContext *UNUSED(C), PointerRNA
copy_v4_v4(r_color, std_node_socket_colors[type]);
}
-/* draw function for file output node sockets, displays only sub-path and format, no value button */
+/* draw function for file output node sockets,
+ * displays only sub-path and format, no value button */
static void node_file_output_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr)
{
bNodeTree *ntree = ptr->id.data;
@@ -3250,7 +3244,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
shuffle[3] = 1.0f;
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, shuffle);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, shuffle);
immDrawPixelsTex(&state, x, y, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST,
display_buffer, snode->zoom, snode->zoom, NULL);
@@ -3532,7 +3526,8 @@ static void nodelink_batch_init(void)
g_batch_link.p3_id = GPU_vertformat_attr_add(&format_inst, "P3", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
g_batch_link.colid_id = GPU_vertformat_attr_add(&format_inst, "colid_doarrow", GPU_COMP_U8, 4, GPU_FETCH_INT);
g_batch_link.inst_vbo = GPU_vertbuf_create_with_format_ex(&format_inst, GPU_USAGE_STREAM);
- GPU_vertbuf_data_alloc(g_batch_link.inst_vbo, NODELINK_GROUP_SIZE); /* Alloc max count but only draw the range we need. */
+ /* Alloc max count but only draw the range we need. */
+ GPU_vertbuf_data_alloc(g_batch_link.inst_vbo, NODELINK_GROUP_SIZE);
GPU_batch_instbuf_set(g_batch_link.batch, g_batch_link.inst_vbo, true);
@@ -3565,7 +3560,7 @@ static void nodelink_batch_draw(SpaceNode *snode)
UI_GetThemeColor4fv(TH_EDGE_SELECT, colors[nodelink_get_color_id(TH_EDGE_SELECT)]);
UI_GetThemeColor4fv(TH_REDALERT, colors[nodelink_get_color_id(TH_REDALERT)]);
- GPU_vertbuf_vertex_count_set(g_batch_link.inst_vbo, g_batch_link.count);
+ GPU_vertbuf_data_len_set(g_batch_link.inst_vbo, g_batch_link.count);
GPU_vertbuf_use(g_batch_link.inst_vbo); /* force update. */
GPU_batch_program_set_builtin(g_batch_link.batch, GPU_SHADER_2D_NODELINK_INST);
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 8f6a0f5c4e2..fd433b48a66 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_add.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index 0a913bcbea8..da0be280f2c 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_buttons.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "MEM_guardedalloc.h"
@@ -150,14 +143,14 @@ static void node_tree_interface_panel(const bContext *C, Panel *pa)
ot = WM_operatortype_find("NODE_OT_tree_socket_add", false);
uiItemL(col, IFACE_("Inputs:"), ICON_NONE);
uiTemplateList(col, (bContext *)C, "NODE_UL_interface_sockets", "inputs", &ptr, "inputs", &ptr, "active_input",
- NULL, 0, 0, 0, 0, false);
+ NULL, 0, 0, 0, 0, false, false);
uiItemFullO_ptr(col, ot, "", ICON_PLUS, NULL, WM_OP_EXEC_DEFAULT, 0, &opptr);
RNA_enum_set(&opptr, "in_out", SOCK_IN);
col = uiLayoutColumn(split, true);
uiItemL(col, IFACE_("Outputs:"), ICON_NONE);
uiTemplateList(col, (bContext *)C, "NODE_UL_interface_sockets", "outputs", &ptr, "outputs", &ptr, "active_output",
- NULL, 0, 0, 0, 0, false);
+ NULL, 0, 0, 0, 0, false, false);
uiItemFullO_ptr(col, ot, "", ICON_PLUS, NULL, WM_OP_EXEC_DEFAULT, 0, &opptr);
RNA_enum_set(&opptr, "in_out", SOCK_OUT);
@@ -188,6 +181,7 @@ void node_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype node panel node sockets");
strcpy(pt->idname, "NODE_PT_sockets");
+ strcpy(pt->category, N_("Node"));
strcpy(pt->label, N_("Sockets"));
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = node_sockets_panel;
@@ -197,6 +191,7 @@ void node_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype node panel tree interface");
strcpy(pt->idname, "NODE_PT_node_tree_interface");
+ strcpy(pt->category, N_("Node"));
strcpy(pt->label, N_("Interface"));
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = node_tree_interface_panel;
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 8ec6d9332d3..0a33e5ebf12 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,14 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- * Contributor(s): Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_draw.c
- * \ingroup spnode
- * \brief higher level node drawing for the node editor.
+/** \file
+ * \ingroup spnode
+ * \brief higher level node drawing for the node editor.
*/
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_node_types.h"
#include "DNA_material_types.h"
#include "DNA_screen_types.h"
@@ -109,7 +102,7 @@ static bNodeTree *node_tree_from_ID(ID *id)
case ID_MA:
return ((Material *)id)->nodetree;
case ID_LA:
- return ((Lamp *)id)->nodetree;
+ return ((Light *)id)->nodetree;
case ID_WO:
return ((World *)id)->nodetree;
case ID_SCE:
@@ -195,7 +188,8 @@ static bool compare_nodes(const bNode *a, const bNode *b)
bool a_active = (a->flag & NODE_ACTIVE) != 0, b_active = (b->flag & NODE_ACTIVE) != 0;
/* if one is an ancestor of the other */
- /* XXX there might be a better sorting algorithm for stable topological sort, this is O(n^2) worst case */
+ /* XXX there might be a better sorting algorithm for stable topological sort,
+ * this is O(n^2) worst case */
for (parent = a->parent; parent; parent = parent->parent) {
/* if b is an ancestor, it is always behind a */
if (parent == b)
@@ -713,7 +707,8 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
node_draw_preview_background(BLI_rctf_size_x(prv) / 10.0f, &draw_rect);
GPU_blend(true);
- GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); /* premul graphics */
+ /* premul graphics */
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTex(&state, draw_rect.xmin, draw_rect.ymin, preview->xsize, preview->ysize, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, preview->rect,
@@ -898,11 +893,11 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* header uses color from backdrop, but we make it opaque */
if (color_id == TH_NODE) {
UI_GetThemeColorShade3fv(color_id, -20, color);
- color[3] = 1.0f;
}
else {
- UI_GetThemeColor4fv(color_id, color);
+ UI_GetThemeColor3fv(color_id, color);
}
+ color[3] = 1.0f;
}
GPU_line_width(1.0f);
@@ -967,8 +962,9 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
nodeLabel(ntree, node, showname, sizeof(showname));
+ /* XXX - don't print into self! */
//if (node->flag & NODE_MUTED)
- // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */
+ // BLI_snprintf(showname, sizeof(showname), "[%s]", showname);
uiDefBut(node->block, UI_BTYPE_LABEL, 0, showname,
(int)(rct->xmin + (NODE_MARGIN_X)), (int)(rct->ymax - NODE_DY),
@@ -976,8 +972,10 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
NULL, 0, 0, 0, 0, "");
/* body */
- if (!nodeIsRegistered(node))
- UI_GetThemeColor4fv(TH_REDALERT, color); /* use warning color to indicate undefined types */
+ if (!nodeIsRegistered(node)) {
+ /* use warning color to indicate undefined types */
+ UI_GetThemeColor4fv(TH_REDALERT, color);
+ }
else if (node->flag & NODE_CUSTOM_COLOR) {
rgba_float_args_set(color, node->color[0], node->color[1], node->color[2], 1.0f);
}
@@ -1092,8 +1090,9 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
if (node->miniwidth > 0.0f) {
nodeLabel(ntree, node, showname, sizeof(showname));
+ /* XXX - don't print into self! */
//if (node->flag & NODE_MUTED)
- // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */
+ // BLI_snprintf(showname, sizeof(showname), "[%s]", showname);
uiDefBut(node->block, UI_BTYPE_LABEL, 0, showname,
round_fl_to_int(rct->xmin + NODE_MARGIN_X), round_fl_to_int(centy - NODE_DY * 0.5f),
@@ -1309,7 +1308,7 @@ static void draw_group_overlay(const bContext *C, ARegion *ar)
/* shade node groups to separate them visually */
GPU_blend(true);
- UI_GetThemeColorShadeAlpha4fv(TH_NODE_GROUP, 0, -70, color);
+ UI_GetThemeColorShadeAlpha4fv(TH_NODE_GROUP, 0, 0, color);
UI_draw_roundbox_corner_set(UI_CNR_NONE);
UI_draw_roundbox_4fv(true, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 0, color);
GPU_blend(false);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 9a6a75d4f61..b1cada9752a 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,15 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_edit.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "MEM_guardedalloc.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_text_types.h"
@@ -56,6 +48,7 @@
#include "ED_node.h" /* own include */
+#include "ED_select_utils.h"
#include "ED_screen.h"
#include "ED_render.h"
@@ -84,7 +77,7 @@
enum {
COM_RECALC_COMPOSITE = 1,
- COM_RECALC_VIEWER = 2
+ COM_RECALC_VIEWER = 2,
};
typedef struct CompoJob {
@@ -421,7 +414,7 @@ void ED_node_shader_default(const bContext *C, ID *id)
}
case ID_LA:
{
- Lamp *la = (Lamp *)id;
+ Light *la = (Light *)id;
la->nodetree = ntree;
output_type = SH_NODE_OUTPUT_LIGHT;
@@ -648,11 +641,11 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
Material *ma;
World *wo;
- for (ma = bmain->mat.first; ma; ma = ma->id.next)
+ for (ma = bmain->materials.first; ma; ma = ma->id.next)
if (ma->nodetree && ma->use_nodes && ntreeHasTree(ma->nodetree, ntree))
GPU_material_free(&ma->gpumaterial);
- for (wo = bmain->world.first; wo; wo = wo->id.next)
+ for (wo = bmain->worlds.first; wo; wo = wo->id.next)
if (wo->nodetree && wo->use_nodes && ntreeHasTree(wo->nodetree, ntree))
GPU_material_free(&wo->gpumaterial);
@@ -1121,15 +1114,10 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
lastnode = ntree->nodes.last;
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 don't touch this
- * but operators and readfile.c do. */
- id_us_plus(newnode->id);
- /* to ensure redraws or rerenders happen */
- ED_node_tag_update_id(snode->id);
- }
+ newnode = BKE_node_copy_ex(ntree, node, LIB_ID_COPY_DEFAULT);
+
+ /* to ensure redraws or rerenders happen */
+ ED_node_tag_update_id(snode->id);
}
/* make sure we don't copy new nodes again! */
@@ -1229,12 +1217,8 @@ void NODE_OT_duplicate(wmOperatorType *ot)
}
bool ED_node_select_check(ListBase *lb)
-
-
{
- bNode *node;
-
- for (node = lb->first; node; node = node->next) {
+ for (bNode *node = lb->first; node; node = node->next) {
if (node->flag & NODE_SELECT) {
return true;
}
@@ -1243,6 +1227,30 @@ bool ED_node_select_check(ListBase *lb)
return false;
}
+void ED_node_select_all(ListBase *lb, int action)
+{
+ if (action == SEL_TOGGLE) {
+ if (ED_node_select_check(lb))
+ action = SEL_DESELECT;
+ else
+ action = SEL_SELECT;
+ }
+
+ for (bNode *node = lb->first; node; node = node->next) {
+ switch (action) {
+ case SEL_SELECT:
+ nodeSetSelected(node, true);
+ break;
+ case SEL_DESELECT:
+ nodeSetSelected(node, false);
+ break;
+ case SEL_INVERT:
+ nodeSetSelected(node, !(node->flag & SELECT));
+ break;
+ }
+ }
+}
+
/* ******************************** */
// XXX some code needing updating to operators...
@@ -1258,7 +1266,7 @@ static int node_read_viewlayers_exec(bContext *C, wmOperator *UNUSED(op))
ED_preview_kill_jobs(CTX_wm_manager(C), bmain);
/* first tag scenes unread */
- for (scene = bmain->scene.first; scene; scene = scene->id.next)
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next)
scene->id.tag |= LIB_TAG_DOIT;
for (node = snode->edittree->nodes.first; node; node = node->next) {
@@ -1935,8 +1943,8 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
- bNode *new_node;
- new_node = nodeCopyNode(NULL, node);
+ /* No ID refcounting, this node is virtual, detached from any actual Blender data currently. */
+ bNode *new_node = BKE_node_copy_ex(NULL, node, LIB_ID_CREATE_NO_USER_REFCOUNT);
BKE_node_clipboard_add_node(new_node);
}
}
@@ -1947,7 +1955,8 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
/* ensure valid pointers */
if (new_node->parent) {
- /* parent pointer must be redirected to new node or detached if parent is not copied */
+ /* parent pointer must be redirected to new node or detached if parent is
+ * not copied */
if (new_node->parent->flag & NODE_SELECT) {
new_node->parent = new_node->parent->new_node;
}
@@ -2055,10 +2064,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
/* copy nodes from clipboard */
for (node = clipboard_nodes_lb->first; node; node = node->next) {
- bNode *new_node = nodeCopyNode(ntree, node);
-
- /* needed since nodeCopyNode() doesn't increase ID's */
- id_us_plus(node->id);
+ bNode *new_node = BKE_node_copy_ex(ntree, node, LIB_ID_COPY_DEFAULT);
/* pasted nodes are selected */
nodeSetSelected(new_node, true);
diff --git a/source/blender/editors/space_node/node_gizmo.c b/source/blender/editors/space_node/node_gizmo.c
index 303962138a8..a511d6b9bd4 100644
--- a/source/blender/editors/space_node/node_gizmo.c
+++ b/source/blender/editors/space_node/node_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_gizmo.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include <math.h>
@@ -49,7 +45,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Local Utilities
* \{ */
@@ -78,7 +73,6 @@ static void node_gizmo_calc_matrix_space_with_image_dims(
/* -------------------------------------------------------------------- */
-
/** \name Backdrop Gizmo
* \{ */
@@ -201,7 +195,6 @@ void NODE_GGT_backdrop_transform(wmGizmoGroupType *gzgt)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Crop Gizmo
* \{ */
@@ -293,7 +286,7 @@ static void gizmo_node_crop_prop_matrix_set(
const bool ny = rct.ymin > rct.ymax;
BLI_rctf_resize(&rct, fabsf(matrix[0][0]), fabsf(matrix[1][1]));
BLI_rctf_recenter(&rct, (matrix[3][0] / dims[0]) + 0.5f, (matrix[3][1] / dims[1]) + 0.5f);
- BLI_rctf_isect(&(rctf){.xmin = 0, .ymin = 0, .xmax = 1, .ymax = 1}, &rct, &rct);
+ BLI_rctf_isect(&(rctf){ .xmin = 0, .ymin = 0, .xmax = 1, .ymax = 1, }, &rct, &rct);
if (nx) {
SWAP(float, rct.xmin, rct.xmax);
}
@@ -404,7 +397,6 @@ void NODE_GGT_backdrop_crop(wmGizmoGroupType *gzgt)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Sun Beams
* \{ */
@@ -509,7 +501,6 @@ void NODE_GGT_backdrop_sun_beams(wmGizmoGroupType *gzgt)
/* -------------------------------------------------------------------- */
-
/** \name Corner Pin
* \{ */
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index c7c856d95c4..8c5bf60bc5d 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_group.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include <stdlib.h>
@@ -45,7 +37,6 @@
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
@@ -258,7 +249,8 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
LinkData *ld, *ldn = NULL;
bAction *waction;
- /* firstly, wgroup needs to temporary dummy action that can be destroyed, as it shares copies */
+ /* firstly, wgroup needs to temporary dummy action
+ * that can be destroyed, as it shares copies */
waction = wgroup->adt->action = BKE_action_copy(bmain, wgroup->adt->action);
/* now perform the moving */
@@ -274,13 +266,13 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
/* free temp action too */
if (waction) {
- BKE_libblock_free(bmain, waction);
+ BKE_id_free(bmain, waction);
wgroup->adt->action = NULL;
}
}
/* free the group tree (takes care of user count) */
- BKE_libblock_free(bmain, wgroup);
+ BKE_id_free(bmain, wgroup);
/* restore external links to and from the gnode */
/* note: the nodes have been copied to intermediate wgroup first (so need to use new_node),
@@ -307,7 +299,9 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
/* XXX TODO bNodeSocket *sock = node_group_find_input_socket(gnode, identifier);
BLI_assert(sock);*/
- /* XXX TODO nodeSocketCopy(ntree, link->tosock->new_sock, link->tonode->new_node, ntree, sock, gnode);*/
+ /* XXX TODO
+ * nodeSocketCopy(ntree, link->tosock->new_sock, link->tonode->new_node,
+ * ntree, sock, gnode);*/
}
}
}
@@ -335,7 +329,8 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
/* XXX TODO bNodeSocket *sock = node_group_find_output_socket(gnode, identifier);
BLI_assert(sock);*/
- /* XXX TODO nodeSocketCopy(ntree, link->tosock, link->tonode, ntree, sock, gnode); */
+ /* XXX TODO
+ * nodeSocketCopy(ntree, link->tosock, link->tonode, ntree, sock, gnode); */
}
}
}
@@ -410,7 +405,7 @@ static int node_group_separate_selected(
for (node = ntree->nodes.first; node; node = node->next)
nodeSetSelected(node, false);
- /* clear new pointers, set in nodeCopyNode */
+ /* clear new pointers, set in BKE_node_copy_ex(). */
for (node = ngroup->nodes.first; node; node = node->next)
node->new_node = NULL;
@@ -428,7 +423,7 @@ static int node_group_separate_selected(
if (make_copy) {
/* make a copy */
- newnode = nodeCopyNode(ngroup, node);
+ newnode = BKE_node_copy_ex(ngroup, node, LIB_ID_COPY_DEFAULT);
}
else {
/* use the existing node */
@@ -522,7 +517,7 @@ typedef enum eNodeGroupSeparateType {
static const EnumPropertyItem node_group_separate_types[] = {
{NODE_GS_COPY, "COPY", 0, "Copy", "Copy to parent node tree, keep group intact"},
{NODE_GS_MOVE, "MOVE", 0, "Move", "Move to parent node tree, remove from group"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int node_group_separate_exec(bContext *C, wmOperator *op)
@@ -547,13 +542,13 @@ static int node_group_separate_exec(bContext *C, wmOperator *op)
switch (type) {
case NODE_GS_COPY:
- if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, 1)) {
+ if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, true)) {
BKE_report(op->reports, RPT_WARNING, "Cannot separate nodes");
return OPERATOR_CANCELLED;
}
break;
case NODE_GS_MOVE:
- if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, 0)) {
+ if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, false)) {
BKE_report(op->reports, RPT_WARNING, "Cannot separate nodes");
return OPERATOR_CANCELLED;
}
@@ -963,7 +958,9 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
snode_notify(C, snode);
snode_dag_update(C, snode);
- DEG_relations_tag_update(bmain); /* We broke relations in node tree, need to rebuild them in the grahes. */
+
+ /* We broke relations in node tree, need to rebuild them in the grahes. */
+ DEG_relations_tag_update(bmain);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 9cff6b7880e..dbd6ef163e3 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_intern.h
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#ifndef __NODE_INTERN_H__
@@ -39,14 +32,14 @@
struct ARegion;
struct ARegionType;
+struct Main;
struct View2D;
struct bContext;
-struct Main;
-struct wmWindow;
struct bNode;
-struct bNodeSocket;
struct bNodeLink;
+struct bNodeSocket;
struct wmKeyConfig;
+struct wmWindow;
/* temp data to pass on to modal */
typedef struct bNodeLinkDrag {
@@ -64,7 +57,8 @@ typedef struct bNodeLinkDrag {
ARegion *node_has_buttons_region(ScrArea *sa);
ARegion *node_has_tools_region(ScrArea *sa);
-void snode_group_offset(struct SpaceNode *snode, float *x, float *y); /* transform between View2Ds in the tree path */
+/* transform between View2Ds in the tree path */
+void snode_group_offset(struct SpaceNode *snode, float *x, float *y);
/* node_draw.c */
int node_get_colorid(struct bNode *node);
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 1eead941c97..ed3190b06fe 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_ops.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 8f3d3d8a4b3..e0fce2a5367 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): David Millan Escriva, Juho Vepsäläinen, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_relationships.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "MEM_guardedalloc.h"
@@ -40,7 +32,6 @@
#include "BKE_animsys.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_node.h"
@@ -138,7 +129,7 @@ static bool node_group_has_output(Main *bmain, bNode *node)
if (ntree == NULL) {
return false;
}
- BKE_main_id_tag_listbase(&bmain->nodetree, LIB_TAG_DOIT, false);
+ BKE_main_id_tag_listbase(&bmain->nodetrees, LIB_TAG_DOIT, false);
return node_group_has_output_dfs(node);
}
@@ -1179,7 +1170,8 @@ static int node_join_exec(bContext *C, wmOperator *UNUSED(op))
bNodeTree *ntree = snode->edittree;
bNode *node, *frame;
- /* XXX save selection: node_add_node call below sets the new frame as single active+selected node */
+ /* XXX save selection: node_add_node call below sets the new frame as single
+ * active+selected node */
for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & NODE_SELECT)
node->flag |= NODE_TEST;
@@ -1455,11 +1447,13 @@ void ED_node_link_intersect_test(ScrArea *sa, int test)
float dist = FLT_MAX;
int i;
- /* loop over link coords to find shortest dist to upper left node edge of a intersected line segment */
+ /* loop over link coords to find shortest dist to
+ * upper left node edge of a intersected line segment */
for (i = 0; i < NODE_LINK_RESOL; i++) {
/* check if the node rect intersetcts the line from this point to next one */
if (BLI_rctf_isect_segment(&select->totr, coord_array[i], coord_array[i + 1])) {
- /* store the shortest distance to the upper left edge of all intersetctions found so far */
+ /* store the shortest distance to the upper left edge
+ * of all intersetctions found so far */
const float node_xy[] = {select->totr.xmin, select->totr.ymax};
/* to be precise coord_array should be clipped by select->totr,
@@ -1645,10 +1639,12 @@ static void node_link_insert_offset_ntree(
/* NODE_TEST will be used later, so disable for all nodes */
ntreeNodeFlagSet(ntree, NODE_TEST, false);
- /* insert->totr isn't updated yet, so totr_insert is used to get the correct worldspace coords */
+ /* insert->totr isn't updated yet,
+ * so totr_insert is used to get the correct worldspace coords */
node_to_updated_rect(insert, &totr_insert);
- /* frame attachment wasn't handled yet so we search the frame that the node will be attached to later */
+ /* frame attachment wasn't handled yet
+ * so we search the frame that the node will be attached to later */
insert->parent = node_find_frame_to_attach(ar, ntree, mouse_xy);
/* this makes sure nodes are also correctly offset when inserting a node on top of a frame
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 1c92c153b11..ae5413f13f4 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_select.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include <stdlib.h>
@@ -61,7 +54,9 @@
#include "node_intern.h" /* own include */
-/* ****** helpers ****** */
+/* -------------------------------------------------------------------- */
+/** \name Public Node Selection API
+ * \{ */
static bNode *node_under_mouse_select(bNodeTree *ntree, int mx, int my)
{
@@ -232,6 +227,12 @@ void node_deselect_all_output_sockets(SpaceNode *snode, const bool deselect_node
}
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select Grouped Operator
+ * \{ */
+
/* Return true if we need redraw, otherwise false. */
static bool node_select_grouped_type(SpaceNode *snode, bNode *node_act)
@@ -363,7 +364,7 @@ void NODE_OT_select_grouped(wmOperatorType *ot)
{NODE_SELECT_GROUPED_COLOR, "COLOR", 0, "Color", ""},
{NODE_SELECT_GROUPED_PREFIX, "PREFIX", 0, "Prefix", ""},
{NODE_SELECT_GROUPED_SUFIX, "SUFFIX", 0, "Suffix", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -384,6 +385,12 @@ void NODE_OT_select_grouped(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select (Cursor Pick) Operator
+ * \{ */
+
void node_select_single(bContext *C, bNode *node)
{
Main *bmain = CTX_data_main(C);
@@ -403,8 +410,6 @@ void node_select_single(bContext *C, bNode *node)
WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL);
}
-/* ****** Click Select ****** */
-
static int node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const int mval[2], short extend)
{
bNode *node, *tnode;
@@ -541,21 +546,28 @@ void NODE_OT_select(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "");
}
-/* ****** Box Select ****** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Box Select Operator
+ * \{ */
static int node_box_select_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
ARegion *ar = CTX_wm_region(C);
- bNode *node;
rctf rectf;
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
WM_operator_properties_border_to_rctf(op, &rectf);
UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf);
- for (node = snode->edittree->nodes.first; node; node = node->next) {
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_node_select_all(&snode->edittree->nodes, SEL_DESELECT);
+ }
+
+ for (bNode *node = snode->edittree->nodes.first; node; node = node->next) {
bool is_inside;
if (node->type == NODE_FRAME) {
is_inside = BLI_rctf_inside_rctf(&rectf, &node->totr);
@@ -567,9 +579,6 @@ static int node_box_select_exec(bContext *C, wmOperator *op)
if (is_inside) {
nodeSetSelected(node, select);
}
- else if (!extend) {
- nodeSetSelected(node, false);
- }
}
ED_node_sort(snode->edittree);
@@ -608,12 +617,18 @@ void NODE_OT_select_box(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- /* rna */
- WM_operator_properties_gesture_box_select(ot);
+ /* properties */
RNA_def_boolean(ot->srna, "tweak", 0, "Tweak", "Only activate when mouse is not over a node - useful for tweak gesture");
+
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
-/* ****** Circle Select ****** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Circle Select Operator
+ * \{ */
static int node_circleselect_exec(bContext *C, wmOperator *op)
{
@@ -626,7 +641,12 @@ static int node_circleselect_exec(bContext *C, wmOperator *op)
float zoom = (float)(BLI_rcti_size_x(&ar->winrct)) / (float)(BLI_rctf_size_x(&ar->v2d.cur));
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
+ const eSelectOp sel_op = ED_select_op_modal(
+ RNA_enum_get(op->ptr, "mode"), WM_gesture_is_modal_first(op->customdata));
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_node_select_all(&snode->edittree->nodes, SEL_DESELECT);
+ }
/* get operator properties */
x = RNA_int_get(op->ptr, "x");
@@ -664,10 +684,15 @@ void NODE_OT_select_circle(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_circle_select(ot);
+ WM_operator_properties_gesture_circle(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
-/* ****** Lasso Select ****** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Lasso Select Operator
+ * \{ */
static int node_lasso_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
@@ -680,7 +705,7 @@ static int node_lasso_select_invoke(bContext *C, wmOperator *op, const wmEvent *
return WM_gesture_lasso_invoke(C, op, event);
}
-static bool do_lasso_select_node(bContext *C, const int mcords[][2], short moves, bool select, bool extend)
+static bool do_lasso_select_node(bContext *C, const int mcords[][2], short moves, eSelectOp sel_op)
{
SpaceNode *snode = CTX_wm_space_node(C);
bNode *node;
@@ -690,13 +715,19 @@ static bool do_lasso_select_node(bContext *C, const int mcords[][2], short moves
rcti rect;
bool changed = false;
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_node_select_all(&snode->edittree->nodes, SEL_DESELECT);
+ changed = true;
+ }
+
/* get rectangle from operator */
BLI_lasso_boundbox(&rect, mcords, moves);
/* do actual selection */
for (node = snode->edittree->nodes.first; node; node = node->next) {
- if (node->flag & NODE_SELECT && select && extend) {
+ if (select && (node->flag & NODE_SELECT)) {
continue;
}
@@ -712,10 +743,6 @@ static bool do_lasso_select_node(bContext *C, const int mcords[][2], short moves
nodeSetSelected(node, select);
changed = true;
}
- else if (select && !extend) {
- nodeSetSelected(node, false);
- changed = true;
- }
}
if (changed) {
@@ -731,9 +758,9 @@ static int node_lasso_select_exec(bContext *C, wmOperator *op)
const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
if (mcords) {
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
- do_lasso_select_node(C, mcords, mcords_tot, select, extend);
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+
+ do_lasso_select_node(C, mcords, mcords_tot, sel_op);
MEM_freeN((void *)mcords);
@@ -760,39 +787,25 @@ void NODE_OT_select_lasso(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_lasso_select(ot);
RNA_def_boolean(ot->srna, "tweak", 0, "Tweak", "Only activate when mouse is not over a node - useful for tweak gesture");
+
+ WM_operator_properties_gesture_lasso(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
-/* ****** Select/Deselect All ****** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name (De)select All Operator
+ * \{ */
static int node_select_all_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
ListBase *node_lb = &snode->edittree->nodes;
- bNode *node;
int action = RNA_enum_get(op->ptr, "action");
- if (action == SEL_TOGGLE) {
- if (ED_node_select_check(node_lb))
- action = SEL_DESELECT;
- else
- action = SEL_SELECT;
- }
-
- for (node = node_lb->first; node; node = node->next) {
- switch (action) {
- case SEL_SELECT:
- nodeSetSelected(node, true);
- break;
- case SEL_DESELECT:
- nodeSetSelected(node, false);
- break;
- case SEL_INVERT:
- nodeSetSelected(node, !(node->flag & SELECT));
- break;
- }
- }
+ ED_node_select_all(node_lb, action);
ED_node_sort(snode->edittree);
@@ -817,7 +830,11 @@ void NODE_OT_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
-/* ****** Select Linked To ****** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select Linked To Operator
+ * \{ */
static int node_select_linked_to_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -861,7 +878,11 @@ void NODE_OT_select_linked_to(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/* ****** Select Linked From ****** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select Linked From Operator
+ * \{ */
static int node_select_linked_from_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -905,6 +926,12 @@ void NODE_OT_select_linked_from(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Select Same Type Step Operator
+ * \{ */
+
static int node_select_same_type_step_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -994,7 +1021,11 @@ void NODE_OT_select_same_type_step(wmOperatorType *ot)
}
-/* *************** find a node **************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Find Node by Name Operator
+ * \{ */
/* generic search invoke */
static void node_find_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
@@ -1093,3 +1124,5 @@ void NODE_OT_find_node(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "prev", 0, "Previous", "");
}
+
+/** \} */
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index e7a9db20103..aef36b49814 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation 2009.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_templates.c
- * \ingroup edinterface
+/** \file
+ * \ingroup edinterface
*/
#include <stdlib.h>
@@ -39,7 +33,6 @@
#include "BLT_translation.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_scene.h"
@@ -308,7 +301,7 @@ static void ui_node_link_items(NodeLinkArg *arg, int in_out, NodeLinkItem **r_it
bNodeTree *ngroup;
int i;
- for (ngroup = arg->bmain->nodetree.first; ngroup; ngroup = ngroup->id.next) {
+ for (ngroup = arg->bmain->nodetrees.first; ngroup; ngroup = ngroup->id.next) {
ListBase *lb = ((in_out == SOCK_IN) ? &ngroup->inputs : &ngroup->outputs);
totitems += BLI_listbase_count(lb);
}
@@ -317,7 +310,7 @@ static void ui_node_link_items(NodeLinkArg *arg, int in_out, NodeLinkItem **r_it
items = MEM_callocN(sizeof(NodeLinkItem) * totitems, "ui node link items");
i = 0;
- for (ngroup = arg->bmain->nodetree.first; ngroup; ngroup = ngroup->id.next) {
+ for (ngroup = arg->bmain->nodetrees.first; ngroup; ngroup = ngroup->id.next) {
ListBase *lb = (in_out == SOCK_IN ? &ngroup->inputs : &ngroup->outputs);
bNodeSocket *stemp;
int index;
@@ -499,7 +492,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (num > 1) {
if (!cur_node_name || !STREQ(cur_node_name, items[i].node_name)) {
cur_node_name = items[i].node_name;
- /* XXX Do not use uiItemL here, it would add an empty icon as we are in a menu! */
+ /* XXX Do not use uiItemL here,
+ * it would add an empty icon as we are in a menu! */
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_(cur_node_name), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, "");
}
diff --git a/source/blender/editors/space_node/node_toolbar.c b/source/blender/editors/space_node/node_toolbar.c
index b4e7e853330..e2effc84870 100644
--- a/source/blender/editors/space_node/node_toolbar.c
+++ b/source/blender/editors/space_node/node_toolbar.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_toolbar.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#include "BLI_utildefines.h"
diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c
index 22df2586a7b..d0e6c45bb07 100644
--- a/source/blender/editors/space_node/node_view.c
+++ b/source/blender/editors/space_node/node_view.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_view.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "DNA_node_types.h"
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index cbd67bfb722..fc8d880080d 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,14 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/space_node.c
- * \ingroup spnode
+/** \file
+ * \ingroup spnode
*/
#include "DNA_gpencil_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_world_types.h"
@@ -538,7 +531,7 @@ static void node_area_refresh(const struct bContext *C, ScrArea *sa)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
else if (GS(snode->id->name) == ID_LA) {
- Lamp *la = (Lamp *)snode->id;
+ Light *la = (Light *)snode->id;
if (la->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
@@ -670,7 +663,8 @@ static void node_main_region_draw(const bContext *C, ARegion *ar)
static bool node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
{
if (drag->type == WM_DRAG_PATH) {
- return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE)); /* rule might not work? */
+ /* rule might not work? */
+ return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE));
}
else {
return WM_drag_ID(drag, ID_IM) != NULL;
@@ -981,7 +975,7 @@ void ED_spacetype_node(void)
art->regionid = RGN_TYPE_WINDOW;
art->init = node_main_region_init;
art->draw = node_main_region_draw;
- art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_GIZMO | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_GIZMO | ED_KEYMAP_TOOL | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
art->listener = node_region_listener;
art->cursor = node_cursor;
art->event_cursor = true;
diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index 796e8732fca..207a5c194bd 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index d219457aeac..7377faa09ac 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation, Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_collections.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include <string.h>
@@ -48,6 +42,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "WM_message.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -140,10 +135,15 @@ TreeTraversalAction outliner_find_selected_objects(TreeElement *te, void *custom
bool ED_outliner_collections_editor_poll(bContext *C)
{
- SpaceOops *so = CTX_wm_space_outliner(C);
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
return (so != NULL) && ELEM(so->outlinevis, SO_VIEW_LAYER, SO_SCENES, SO_LIBRARIES);
}
+static bool outliner_view_layer_collections_editor_poll(bContext *C)
+{
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
+ return (so != NULL) && (so->outlinevis == SO_VIEW_LAYER);
+}
/********************************* New Collection ****************************/
@@ -173,7 +173,7 @@ static TreeTraversalAction collection_find_selected_to_add(TreeElement *te, void
static int collection_new_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -235,7 +235,7 @@ void OUTLINER_OT_collection_new(wmOperatorType *ot)
struct CollectionEditData {
Scene *scene;
- SpaceOops *soops;
+ SpaceOutliner *soops;
GSet *collections_to_edit;
};
@@ -248,7 +248,7 @@ static TreeTraversalAction collection_find_data_to_edit(TreeElement *te, void *c
return TRAVERSE_SKIP_CHILDS;
}
- if (collection == BKE_collection_master(data->scene)) {
+ if (collection->flag & COLLECTION_IS_MASTER) {
/* skip - showing warning/error message might be misleading
* when deleting multiple collections, so just do nothing */
}
@@ -264,10 +264,13 @@ static TreeTraversalAction collection_find_data_to_edit(TreeElement *te, void *c
static int collection_delete_exec(bContext *C, wmOperator *op)
{
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
- struct CollectionEditData data = {.scene = scene, .soops = soops};
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ const Base *basact_prev = BASACT(view_layer);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
bool hierarchy = RNA_boolean_get(op->ptr, "hierarchy");
data.collections_to_edit = BLI_gset_ptr_new(__func__);
@@ -281,7 +284,7 @@ static int collection_delete_exec(bContext *C, wmOperator *op)
Collection *collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
/* Test in case collection got deleted as part of another one. */
- if (BLI_findindex(&bmain->collection, collection) != -1) {
+ if (BLI_findindex(&bmain->collections, collection) != -1) {
BKE_collection_delete(bmain, collection, hierarchy);
}
}
@@ -293,6 +296,10 @@ static int collection_delete_exec(bContext *C, wmOperator *op)
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
+ if (basact_prev != BASACT(view_layer)) {
+ WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
+ }
+
return OPERATOR_FINISHED;
}
@@ -342,7 +349,7 @@ static TreeTraversalAction outliner_find_first_selected_layer_collection(TreeEle
static LayerCollection *outliner_active_layer_collection(bContext *C)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
struct CollectionObjectsSelectData data = {
.layer_collection = NULL,
@@ -426,7 +433,7 @@ static TreeTraversalAction outliner_find_first_selected_collection(TreeElement *
static TreeElement *outliner_active_collection(bContext *C)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
struct CollectionDuplicateData data = {
.te = NULL,
@@ -439,9 +446,16 @@ static TreeElement *outliner_active_collection(bContext *C)
static int collection_duplicate_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te = outliner_active_collection(C);
- BLI_assert(te != NULL);
+ const bool hierarchy = strstr(op->idname, "hierarchy") != NULL;
+ const bool linked = strstr(op->idname, "linked") != NULL;
+
+ /* Can happen when calling from a key binding. */
+ if (te == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No active collection");
+ return OPERATOR_CANCELLED;
+ }
Collection *collection = outliner_collection_from_tree_element(te);
Collection *parent = (te->parent) ? outliner_collection_from_tree_element(te->parent) : NULL;
@@ -455,7 +469,7 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
case SO_SCENES:
case SO_VIEW_LAYER:
case SO_LIBRARIES:
- BKE_collection_copy(bmain, parent, collection);
+ BKE_collection_duplicate(bmain, parent, collection, true, !hierarchy, !linked);
break;
}
@@ -465,12 +479,42 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
+void OUTLINER_OT_collection_duplicate_hierarchy(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Duplicate Collection Hierarchy";
+ ot->idname = "OUTLINER_OT_collection_duplicate_hierarchy";
+ ot->description = "Recursively duplicate the collection and all its children, with linked objects";
+
+ /* api callbacks */
+ ot->exec = collection_duplicate_exec;
+ ot->poll = ED_outliner_collections_editor_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_duplicate_linked(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Duplicate Linked Collection";
+ ot->idname = "OUTLINER_OT_collection_duplicate_linked";
+ ot->description = "Recursively duplicate the collection, all its children and objects, with linked object data";
+
+ /* api callbacks */
+ ot->exec = collection_duplicate_exec;
+ ot->poll = ED_outliner_collections_editor_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
void OUTLINER_OT_collection_duplicate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Duplicate Collection";
ot->idname = "OUTLINER_OT_collection_duplicate";
- ot->description = "Duplicate selected collections";
+ ot->description = "Recursively duplicate the collection, all its children, objects and object data";
/* api callbacks */
ot->exec = collection_duplicate_exec;
@@ -487,8 +531,8 @@ static int collection_link_exec(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Collection *active_collection = CTX_data_layer_collection(C)->collection;
- SpaceOops *soops = CTX_wm_space_outliner(C);
- struct CollectionEditData data = {.scene = scene, .soops = soops};
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
@@ -535,8 +579,8 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
- struct CollectionEditData data = {.scene = scene, .soops = soops};
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
@@ -559,7 +603,7 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
Collection *collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
Object *ob = ED_object_add_type(C, OB_EMPTY, collection->id.name + 2, scene->cursor.location, NULL, false, 0);
- ob->dup_group = collection;
+ ob->instance_collection = collection;
ob->transflag |= OB_DUPLICOLLECTION;
id_lib_extern(&collection->id);
}
@@ -617,13 +661,13 @@ static TreeTraversalAction layer_collection_find_data_to_edit(TreeElement *te, v
static bool collections_view_layer_poll(bContext *C, bool clear, int flag)
{
/* Poll function so the right click menu show current state of selected collections. */
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
if (!(soops && soops->outlinevis == SO_VIEW_LAYER)) {
return false;
}
Scene *scene = CTX_data_scene(C);
- struct CollectionEditData data = {.scene = scene, .soops = soops};
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
bool result = false;
@@ -694,8 +738,8 @@ static int collection_view_layer_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
- struct CollectionEditData data = {.scene = scene, .soops = soops};
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
bool clear = strstr(op->idname, "clear") != NULL;
int flag = strstr(op->idname, "holdout") ? LAYER_COLLECTION_HOLDOUT :
strstr(op->idname, "indirect_only") ? LAYER_COLLECTION_INDIRECT_ONLY :
@@ -709,16 +753,14 @@ static int collection_view_layer_exec(bContext *C, wmOperator *op)
GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
LayerCollection *lc = BLI_gsetIterator_getKey(&collections_to_edit_iter);
- if (!(lc->collection->flag & COLLECTION_IS_MASTER)) {
- if (clear) {
- lc->flag &= ~flag;
- }
- else {
- lc->flag |= flag;
- }
-
- layer_collection_flag_recursive_set(lc, flag);
+ if (clear) {
+ lc->flag &= ~flag;
}
+ else {
+ lc->flag |= flag;
+ }
+
+ layer_collection_flag_recursive_set(lc, flag);
}
BLI_gset_free(data.collections_to_edit, NULL);
@@ -821,6 +863,478 @@ void OUTLINER_OT_collection_indirect_only_clear(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/************************** Visibility Operators ******************************/
+
+static int collection_isolate_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ const bool extend = RNA_boolean_get(op->ptr, "extend");
+ bool depsgraph_changed = false;
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
+ data.collections_to_edit = BLI_gset_ptr_new(__func__);
+
+ /* Hide all collections before the isolate function - needed in order to support multiple selected collections. */
+ if (!extend) {
+ LayerCollection *lc_master = view_layer->layer_collections.first;
+ for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ lc_iter->flag |= LAYER_COLLECTION_RESTRICT_VIEW;
+ layer_collection_flag_recursive_set(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW);
+ }
+ }
+
+ outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+
+ GSetIterator collections_to_edit_iter;
+ GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
+ LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
+ depsgraph_changed |= BKE_layer_collection_isolate(scene, view_layer, layer_collection, true);
+ }
+ BLI_gset_free(data.collections_to_edit, NULL);
+
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ if (depsgraph_changed) {
+ DEG_relations_tag_update(CTX_data_main(C));
+ }
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ return OPERATOR_FINISHED;
+}
+
+static int collection_isolate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+{
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "extend");
+ if (!RNA_property_is_set(op->ptr, prop) && (event->shift)) {
+ RNA_property_boolean_set(op->ptr, prop, true);
+ }
+ return collection_isolate_exec(C, op);
+}
+
+void OUTLINER_OT_collection_isolate(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Isolate Collection";
+ ot->idname = "OUTLINER_OT_collection_isolate";
+ ot->description = "Hide all but this collection and its parents";
+
+ /* api callbacks */
+ ot->exec = collection_isolate_exec;
+ ot->invoke = collection_isolate_invoke;
+ ot->poll = ED_outliner_collections_editor_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ PropertyRNA *prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend current visible collections");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+}
+
+static bool collection_show_poll(bContext *C)
+{
+ return collections_view_layer_poll(C, true, LAYER_COLLECTION_RESTRICT_VIEW);
+}
+
+static bool collection_hide_poll(bContext *C)
+{
+ return collections_view_layer_poll(C, false, LAYER_COLLECTION_RESTRICT_VIEW);
+}
+
+static bool collection_inside_poll(bContext *C)
+{
+ if (!ED_outliner_collections_editor_poll(C)) {
+ return false;
+ }
+ return outliner_active_layer_collection(C) != NULL;
+}
+
+static int collection_visibility_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ const bool is_inside = strstr(op->idname, "inside") != NULL;
+ const bool show = strstr(op->idname, "show") != NULL;
+ bool depsgraph_changed = false;
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
+ data.collections_to_edit = BLI_gset_ptr_new(__func__);
+
+ outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+
+ GSetIterator collections_to_edit_iter;
+ GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
+ LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
+ depsgraph_changed |= BKE_layer_collection_set_visible(view_layer, layer_collection, show, is_inside);
+ }
+ BLI_gset_free(data.collections_to_edit, NULL);
+
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ if (depsgraph_changed) {
+ DEG_relations_tag_update(CTX_data_main(C));
+ }
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OUTLINER_OT_collection_show(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Show Collection";
+ ot->idname = "OUTLINER_OT_collection_show";
+ ot->description = "Show the collection in this view layer";
+
+ /* api callbacks */
+ ot->exec = collection_visibility_exec;
+ ot->poll = collection_show_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_hide(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Hide Collection";
+ ot->idname = "OUTLINER_OT_collection_hide";
+ ot->description = "Hide the collection in this view layer";
+
+ /* api callbacks */
+ ot->exec = collection_visibility_exec;
+ ot->poll = collection_hide_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_show_inside(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Show Inside Collection";
+ ot->idname = "OUTLINER_OT_collection_show_inside";
+ ot->description = "Show all the objects and collections inside the collection";
+
+ /* api callbacks */
+ ot->exec = collection_visibility_exec;
+ ot->poll = collection_inside_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_hide_inside(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Hide Inside Collection";
+ ot->idname = "OUTLINER_OT_collection_hide_inside";
+ ot->description = "Hide all the objects and collections inside the collection";
+
+ /* api callbacks */
+ ot->exec = collection_visibility_exec;
+ ot->poll = collection_inside_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+static bool collection_flag_poll(bContext *C, bool clear, int flag)
+{
+ if (!ED_outliner_collections_editor_poll(C)) {
+ return false;
+ }
+
+ TreeElement *te = outliner_active_collection(C);
+ if (te == NULL) {
+ return false;
+ }
+
+ Collection *collection = outliner_collection_from_tree_element(te);
+ if (collection == NULL) {
+ return false;
+ }
+
+ if (clear && (collection->flag & flag)) {
+ return true;
+ }
+ else if (!clear && !(collection->flag & flag)) {
+ return true;
+ }
+
+ return false;
+}
+
+static bool collection_enable_poll(bContext *C)
+{
+ return collection_flag_poll(C, true, COLLECTION_RESTRICT_VIEW);
+}
+
+static bool collection_disable_poll(bContext *C)
+{
+ return collection_flag_poll(C, false, COLLECTION_RESTRICT_VIEW);
+}
+
+static bool collection_enable_render_poll(bContext *C)
+{
+ return collection_flag_poll(C, true, COLLECTION_RESTRICT_RENDER);
+}
+
+static bool collection_disable_render_poll(bContext *C)
+{
+ return collection_flag_poll(C, false, COLLECTION_RESTRICT_RENDER);
+}
+
+static int collection_flag_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ const bool is_render = strstr(op->idname, "render");
+ const bool clear = strstr(op->idname, "show") || strstr(op->idname, "enable");
+ int flag = is_render ? COLLECTION_RESTRICT_RENDER : COLLECTION_RESTRICT_VIEW;
+ struct CollectionEditData data = {.scene = scene, .soops = soops,};
+ data.collections_to_edit = BLI_gset_ptr_new(__func__);
+ const bool has_layer_collection = soops->outlinevis == SO_VIEW_LAYER;
+
+ if (has_layer_collection) {
+ outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+ GSetIterator collections_to_edit_iter;
+ GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
+ LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
+ Collection *collection = layer_collection->collection;
+ if (ID_IS_LINKED(collection)) {
+ continue;
+ }
+ if (clear) {
+ collection->flag &= ~flag;
+ }
+ else {
+ collection->flag |= flag;
+ }
+
+ /* Make sure (at least for this view layer) the collection is visible. */
+ if (clear && !is_render) {
+ layer_collection->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
+ }
+ }
+ BLI_gset_free(data.collections_to_edit, NULL);
+ }
+ else {
+ outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, collection_find_data_to_edit, &data);
+ GSetIterator collections_to_edit_iter;
+ GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
+ Collection *collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
+
+ if (clear) {
+ collection->flag &= ~flag;
+ }
+ else {
+ collection->flag |= flag;
+ }
+ }
+ BLI_gset_free(data.collections_to_edit, NULL);
+ }
+
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ if (!is_render) {
+ DEG_relations_tag_update(CTX_data_main(C));
+ }
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OUTLINER_OT_collection_enable(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Enable Collection";
+ ot->idname = "OUTLINER_OT_collection_enable";
+ ot->description = "Enable viewport drawing in the view layers";
+
+ /* api callbacks */
+ ot->exec = collection_flag_exec;
+ ot->poll = collection_enable_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_disable(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Disable Collection";
+ ot->idname = "OUTLINER_OT_collection_disable";
+ ot->description = "Disable viewport drawing in the view layers";
+
+ /* api callbacks */
+ ot->exec = collection_flag_exec;
+ ot->poll = collection_disable_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_enable_render(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Enable Collection in Render";
+ ot->idname = "OUTLINER_OT_collection_enable_render";
+ ot->description = "Render the collection";
+
+ /* api callbacks */
+ ot->exec = collection_flag_exec;
+ ot->poll = collection_enable_render_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+void OUTLINER_OT_collection_disable_render(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Disable Collection in Render";
+ ot->idname = "OUTLINER_OT_collection_disable_render";
+ ot->description = "Do not render this collection";
+
+ /* api callbacks */
+ ot->exec = collection_flag_exec;
+ ot->poll = collection_disable_render_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+struct OutlinerHideEditData {
+ Scene *scene;
+ ViewLayer *view_layer;
+ SpaceOutliner *soops;
+ GSet *collections_to_edit;
+ GSet *bases_to_edit;
+};
+
+static TreeTraversalAction outliner_hide_find_data_to_edit(TreeElement *te, void *customdata)
+{
+ struct OutlinerHideEditData *data = customdata;
+ TreeStoreElem *tselem = TREESTORE(te);
+
+ if (tselem == NULL) {
+ return TRAVERSE_CONTINUE;
+ }
+
+ if (tselem->type == TSE_LAYER_COLLECTION) {
+ LayerCollection *lc = te->directdata;
+
+ if (lc->collection->flag & COLLECTION_IS_MASTER) {
+ /* Skip - showing warning/error message might be misleading
+ * when deleting multiple collections, so just do nothing. */
+ }
+ else {
+ /* Delete, duplicate and link don't edit children,
+ * those will come along with the parents. */
+ BLI_gset_add(data->collections_to_edit, lc);
+ }
+ }
+ else if (tselem->type == 0 && te->idcode == ID_OB) {
+ Object *ob = (Object *)tselem->id;
+ Base *base = BKE_view_layer_base_find(data->view_layer, ob);
+ BLI_gset_add(data->bases_to_edit, base);
+ }
+
+ return TRAVERSE_CONTINUE;
+}
+
+static int outliner_hide_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ struct OutlinerHideEditData data = {.scene = scene, .view_layer = view_layer, .soops = soops,};
+ data.collections_to_edit = BLI_gset_ptr_new("outliner_hide_exec__collections_to_edit");
+ data.bases_to_edit = BLI_gset_ptr_new("outliner_hide_exec__bases_to_edit");
+
+ outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, outliner_hide_find_data_to_edit, &data);
+
+ GSetIterator collections_to_edit_iter;
+ GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
+ LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
+ BKE_layer_collection_set_visible(view_layer, layer_collection, false, false);
+ }
+ BLI_gset_free(data.collections_to_edit, NULL);
+
+ GSetIterator bases_to_edit_iter;
+ GSET_ITER(bases_to_edit_iter, data.bases_to_edit) {
+ Base *base = BLI_gsetIterator_getKey(&bases_to_edit_iter);
+ base->flag |= BASE_HIDDEN;
+ }
+ BLI_gset_free(data.bases_to_edit, NULL);
+
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OUTLINER_OT_hide(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Hide";
+ ot->idname = "OUTLINER_OT_hide";
+ ot->description = "Hide selected objects and collections";
+
+ /* api callbacks */
+ ot->exec = outliner_hide_exec;
+ ot->poll = outliner_view_layer_collections_editor_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+static int outliner_unhide_all_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+
+ /* Unhide all the collections. */
+ LayerCollection *lc_master = view_layer->layer_collections.first;
+ for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
+ lc_iter->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
+ layer_collection_flag_recursive_set(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW);
+ }
+
+ /* Unhide all objects. */
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ base->flag &= ~BASE_HIDDEN;
+ }
+
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ return OPERATOR_FINISHED;
+}
+
+void OUTLINER_OT_unhide_all(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Unhide All";
+ ot->idname = "OUTLINER_OT_unhide_all";
+ ot->description = "Unhide all objects and collections";
+
+ /* api callbacks */
+ ot->exec = outliner_unhide_all_exec;
+ ot->poll = outliner_view_layer_collections_editor_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
/**
* Populates the \param objects: ListBase with all the outliner selected objects
* We store it as (Object *)LinkData->data
@@ -828,7 +1342,7 @@ void OUTLINER_OT_collection_indirect_only_clear(wmOperatorType *ot)
*/
void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
struct IDsSelectedData data = {{NULL}};
outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, outliner_find_selected_objects, &data);
LISTBASE_FOREACH (LinkData *, link, &data.selected_array) {
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c
index 6dd12571448..d9dc0d182c7 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.c
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_dragdrop.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include <string.h>
@@ -96,7 +88,7 @@ static TreeElement *outliner_dropzone_element(TreeElement *te, const float fmval
}
/* Find tree element to drop into. */
-static TreeElement *outliner_dropzone_find(const SpaceOops *soops, const float fmval[2], const bool children)
+static TreeElement *outliner_dropzone_find(const SpaceOutliner *soops, const float fmval[2], const bool children)
{
TreeElement *te;
@@ -111,7 +103,7 @@ static TreeElement *outliner_dropzone_find(const SpaceOops *soops, const float f
static TreeElement *outliner_drop_find(bContext *C, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
float fmval[2];
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
@@ -136,7 +128,7 @@ static TreeElement *outliner_drop_insert_find(
bContext *C, const wmEvent *event,
TreeElementInsertType *r_insert_type)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
TreeElement *te_hovered;
float view_mval[2];
@@ -232,7 +224,7 @@ static TreeElement *outliner_drop_insert_collection_find(
/* ******************** Parent Drop Operator *********************** */
-static bool parent_drop_allowed(SpaceOops *soops, TreeElement *te, Object *potential_child)
+static bool parent_drop_allowed(SpaceOutliner *soops, TreeElement *te, Object *potential_child)
{
TreeStoreElem *tselem = TREESTORE(te);
if (te->idcode != ID_OB || tselem->type != 0) {
@@ -249,9 +241,8 @@ static bool parent_drop_allowed(SpaceOops *soops, TreeElement *te, Object *poten
Scene *scene = (Scene *)outliner_search_back(soops, te, ID_SCE);
/* currently outliner organized in a way that if there's no parent scene
- * element for object it means that all displayed objects belong to
- * active scene and parenting them is allowed (sergey)
- */
+ * element for object it means that all displayed objects belong to
+ * active scene and parenting them is allowed (sergey) */
if (scene) {
for (ViewLayer *view_layer = scene->view_layers.first;
view_layer;
@@ -268,7 +259,7 @@ static bool parent_drop_allowed(SpaceOops *soops, TreeElement *te, Object *poten
}
}
-static bool allow_parenting_without_modifier_key(SpaceOops *soops)
+static bool allow_parenting_without_modifier_key(SpaceOutliner *soops)
{
switch (soops->outlinevis) {
case SO_VIEW_LAYER:
@@ -282,7 +273,7 @@ static bool allow_parenting_without_modifier_key(SpaceOops *soops)
static bool parent_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **UNUSED(tooltip))
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
bool changed = outliner_flag_set(&soops->tree, TSE_DRAG_ANY, false);
if (changed) ED_region_tag_redraw_no_rebuild(CTX_wm_region(C));
@@ -337,7 +328,7 @@ static int parent_drop_exec(bContext *C, wmOperator *op)
static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te = outliner_drop_find(C, event);
TreeStoreElem *tselem = te ? TREESTORE(te) : NULL;
@@ -482,7 +473,7 @@ void OUTLINER_OT_parent_drop(wmOperatorType *ot)
static bool parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **UNUSED(tooltip))
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
if (!allow_parenting_without_modifier_key(soops)) {
if (!event->shift) return false;
@@ -683,7 +674,7 @@ static Collection *collection_parent_from_ID(ID *id)
static bool collection_drop_init(bContext *C, wmDrag *drag, const wmEvent *event, CollectionDrop *data)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
/* Get collection to drop into. */
TreeElementInsertType insert_type;
@@ -739,7 +730,7 @@ static bool collection_drop_init(bContext *C, wmDrag *drag, const wmEvent *event
static bool collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **tooltip)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
bool changed = outliner_flag_set(&soops->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false);
@@ -812,7 +803,7 @@ static int collection_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
bool relative_after = false;
if (ELEM(data.insert_type, TE_INSERT_BEFORE, TE_INSERT_AFTER)) {
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
relative = data.to;
relative_after = (data.insert_type == TE_INSERT_AFTER);
@@ -883,7 +874,7 @@ void OUTLINER_OT_collection_drop(wmOperatorType *ot)
/* ********************* Outliner Drag Operator ******************** */
-static TreeElement *outliner_item_drag_element_find(SpaceOops *soops, ARegion *ar, const wmEvent *event)
+static TreeElement *outliner_item_drag_element_find(SpaceOutliner *soops, ARegion *ar, const wmEvent *event)
{
/* note: using EVT_TWEAK_ events to trigger dragging is fine,
* it sends coordinates from where dragging was started */
@@ -894,7 +885,7 @@ static TreeElement *outliner_item_drag_element_find(SpaceOops *soops, ARegion *a
static int outliner_item_drag_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te = outliner_item_drag_element_find(soops, ar, event);
if (!te) {
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index dde04f65ba6..489221f5a5c 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_draw.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include "DNA_anim_types.h"
@@ -34,7 +26,7 @@
#include "DNA_collection_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_lightprobe_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -51,7 +43,6 @@
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_fcurve.h"
-#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_idcode.h"
#include "BKE_layer.h"
@@ -91,7 +82,7 @@
/* ****************************************************** */
/* Tree Size Functions */
-static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
+static void outliner_height(SpaceOutliner *soops, ListBase *lb, int *h)
{
TreeElement *te = lb->first;
while (te) {
@@ -105,7 +96,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
}
#if 0 // XXX this is currently disabled until te->xend is set correctly
-static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
+static void outliner_width(SpaceOutliner *soops, ListBase *lb, int *w)
{
TreeElement *te = lb->first;
while (te) {
@@ -122,7 +113,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
}
#endif
-static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int startx)
+static void outliner_rna_width(SpaceOutliner *soops, ListBase *lb, int *w, int startx)
{
TreeElement *te = lb->first;
while (te) {
@@ -255,8 +246,11 @@ static void restrictbutton_ebone_visibility_cb(bContext *C, void *UNUSED(poin),
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
}
-static void restrictbutton_gp_layer_flag_cb(bContext *C, void *UNUSED(poin), void *UNUSED(poin2))
+static void restrictbutton_gp_layer_flag_cb(bContext *C, void *poin, void *UNUSED(poin2))
{
+ ID *id = (ID *)poin;
+
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
@@ -274,48 +268,131 @@ static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void
}
}
+static int base_pushed_state_cb(bContext *UNUSED(C), void *poin)
+{
+ Base *base = poin;
+ Object *ob = base->object;
+
+ const bool is_visible = ((base->flag & BASE_HIDDEN) == 0) &&
+ ((ob->restrictflag & OB_RESTRICT_VIEW) == 0);
+ return !is_visible;
+}
+
static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2)
{
+ wmWindow *win = CTX_wm_window(C);
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = poin;
Base *base = poin2;
- bool extend = (CTX_wm_window(C)->eventstate->ctrl == 0);
+ Object *ob = base->object;
+ bool do_disable = (CTX_wm_window(C)->eventstate->alt != 0);
+ bool do_isolate = (win->eventstate->ctrl != 0) && !do_disable;
+ bool extend = (win->eventstate->shift != 0);
+ bool depsgraph_changed = false;
+ const bool is_linked = ID_IS_LINKED(ob);
+
+ if (do_disable) {
+ if (!is_linked) {
+ ob->restrictflag |= OB_RESTRICT_VIEW;
+ depsgraph_changed = true;
+ }
+ }
+ else if (do_isolate) {
+ depsgraph_changed = (!is_linked) && ((ob->restrictflag & OB_RESTRICT_VIEW) != 0);
- /* Undo button toggle, let function do it. */
- base->flag ^= BASE_HIDDEN;
+ if (!extend) {
+ /* Make only one base visible. */
+ for (Base *other = view_layer->object_bases.first; other; other = other->next) {
+ other->flag |= BASE_HIDDEN;
+ }
- BKE_base_set_visible(scene, view_layer, base, extend);
+ base->flag &= ~BASE_HIDDEN;
+ }
+ else {
+ /* Toggle visibility of one base. */
+ base->flag ^= BASE_HIDDEN;
+ }
- if (!extend && (base->flag & BASE_VISIBLE)) {
- /* Auto select solo-ed object. */
- ED_object_base_select(base, BA_SELECT);
- view_layer->basact = base;
+ if (!is_linked) {
+ ob->restrictflag &= ~OB_RESTRICT_VIEW;
+ }
+ }
+ else if (ob->restrictflag & OB_RESTRICT_VIEW) {
+ if (!is_linked) {
+ ob->restrictflag &= ~OB_RESTRICT_VIEW;
+ base->flag &= ~BASE_HIDDEN;
+ }
+ depsgraph_changed = true;
+ }
+ else {
+ base->flag ^= BASE_HIDDEN;
}
- DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ if (depsgraph_changed) {
+ BKE_main_collection_sync_remap(bmain);
+ DEG_id_tag_update(&ob->id, LIB_TAG_COPIED_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
+ }
+
+ if (!do_disable) {
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ }
+}
+
+static int layer_collection_pushed_state_cb(bContext *UNUSED(C), void *poin)
+{
+ LayerCollection *lc = poin;
+ Collection *collection = lc->collection;
+
+ const bool is_visible = ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) == 0) &&
+ ((collection->flag & COLLECTION_RESTRICT_VIEW) == 0);
+ return !is_visible;
}
static void hidebutton_layer_collection_flag_cb(bContext *C, void *poin, void *poin2)
{
+ wmWindow *win = CTX_wm_window(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = poin;
LayerCollection *lc = poin2;
- bool extend = (CTX_wm_window(C)->eventstate->ctrl == 0);
-
- /* Undo button toggle, let function do it. */
- lc->runtime_flag ^= LAYER_COLLECTION_HAS_VISIBLE_OBJECTS;
-
- BKE_layer_collection_set_visible(scene, view_layer, lc, extend);
+ Collection *collection = lc->collection;
+ bool do_disable = (win->eventstate->alt != 0);
+ bool do_isolate = (win->eventstate->ctrl != 0) && !do_disable;
+ bool extend = (win->eventstate->shift != 0);
+ bool depsgraph_changed = false;
+
+ if (do_disable) {
+ if (!ID_IS_LINKED(collection)) {
+ collection->flag |= COLLECTION_RESTRICT_VIEW;
+ depsgraph_changed = true;
+ }
+ }
+ else if (do_isolate) {
+ depsgraph_changed |= BKE_layer_collection_isolate(scene, view_layer, lc, extend);
+ }
+ else {
+ bool make_visible = ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0) ||
+ ((collection->flag & COLLECTION_RESTRICT_VIEW) != 0);
+ depsgraph_changed |= BKE_layer_collection_set_visible(view_layer, lc, make_visible, extend);
+ }
+ BKE_layer_collection_sync(scene, view_layer);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+
+ if (depsgraph_changed) {
+ DEG_relations_tag_update(CTX_data_main(C));
+ }
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
}
static void namebutton_cb(bContext *C, void *tsep, char *oldname)
{
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
Object *obedit = CTX_data_edit_object(C);
BLI_mempool *ts = soops->treestore;
TreeStoreElem *tselem = tsep;
@@ -482,7 +559,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
}
static void outliner_draw_restrictbuts(
- uiBlock *block, Scene *scene, ViewLayer *view_layer, ARegion *ar, SpaceOops *soops, ListBase *lb)
+ uiBlock *block, Scene *scene, ViewLayer *view_layer, ARegion *ar, SpaceOutliner *soops, ListBase *lb)
{
/* Get RNA properties (once for speed). */
static struct RestrictProperties {
@@ -525,27 +602,35 @@ static void outliner_draw_restrictbuts(
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
else if (tselem->type == 0 && te->idcode == ID_OB) {
+ PointerRNA ptr;
Object *ob = (Object *)tselem->id;
+ RNA_pointer_create(&ob->id, &RNA_Object, ob, &ptr);
Base *base = BKE_view_layer_base_find(view_layer, ob);
if (base) {
- bt = uiDefIconButBitS(
- block, UI_BTYPE_ICON_TOGGLE, BASE_HIDDEN, 0, ICON_HIDE_OFF,
- (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X,
- UI_UNIT_Y, &base->flag, 0, 0, 0, 0,
- TIP_("Hide object in viewport (Ctrl to isolate)"));
+ int icon = ICON_RESTRICT_VIEW_ON;
+ if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0) {
+ icon = (base->flag & BASE_HIDDEN) != 0 ?
+ ICON_HIDE_ON :
+ ICON_HIDE_OFF;
+ }
+ bt = uiDefIconBut(
+ block, UI_BTYPE_ICON_TOGGLE, 0, icon,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0,
+ TIP_("Hide object in viewport\n"
+ "* Alt to disable for all viewports\n"
+ "* Ctrl to isolate visibility"));
UI_but_func_set(bt, hidebutton_base_flag_cb, view_layer, base);
+ UI_but_func_pushed_state_set(bt, base_pushed_state_cb, base);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ }
+ else {
+ bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
+ &ptr, props.object_hide_viewport, -1, 0, 0, -1, -1, NULL);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
- UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
-
- PointerRNA ptr;
- RNA_pointer_create(&ob->id, &RNA_Object, ob, &ptr);
-
- bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0,
- (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
- &ptr, props.object_hide_viewport, -1, 0, 0, -1, -1, NULL);
- UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y,
@@ -621,6 +706,7 @@ static void outliner_draw_restrictbuts(
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
else if (tselem->type == TSE_GP_LAYER) {
+ ID *id = tselem->id;
bGPDlayer *gpl = (bGPDlayer *)te->directdata;
bt = uiDefIconButBitS(
@@ -628,7 +714,7 @@ static void outliner_draw_restrictbuts(
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0,
TIP_("Restrict/Allow visibility in the 3D View"));
- UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl);
+ UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, id, gpl);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
@@ -637,10 +723,8 @@ static void outliner_draw_restrictbuts(
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X,
UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0,
TIP_("Restrict/Allow editing of strokes and keyframes in this layer"));
- UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl);
+ UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, id, gpl);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
- /* TODO: visibility in renders */
}
else if (outliner_is_collection_tree_element(te)) {
LayerCollection *lc = (tselem->type == TSE_LAYER_COLLECTION) ? te->directdata : NULL;
@@ -649,25 +733,35 @@ static void outliner_draw_restrictbuts(
if ((!lc || !(lc->flag & LAYER_COLLECTION_EXCLUDE)) &&
!(collection->flag & COLLECTION_IS_MASTER))
{
- if (lc && (lc->runtime_flag & LAYER_COLLECTION_HAS_ENABLED_OBJECTS)) {
- bt = uiDefIconButBitS(
- block, UI_BTYPE_ICON_TOGGLE_N, LAYER_COLLECTION_HAS_VISIBLE_OBJECTS, 0, ICON_HIDE_OFF,
- (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X,
- UI_UNIT_Y, &lc->runtime_flag, 0, 0, 0, 0,
- TIP_("Hide collection in viewport (Ctrl to isolate)"));
- UI_but_func_set(bt, hidebutton_layer_collection_flag_cb, view_layer, lc);
- UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
- UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
- }
-
PointerRNA collection_ptr;
RNA_id_pointer_create(&collection->id, &collection_ptr);
- bt = uiDefIconButR_prop(
- block, UI_BTYPE_ICON_TOGGLE, 0, 0,
- (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
- UI_UNIT_Y, &collection_ptr, props.collection_hide_viewport, -1, 0, 0, 0, 0, NULL);
- UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ if (lc != NULL) {
+ int icon = ICON_RESTRICT_VIEW_ON;
+ if ((collection->flag & COLLECTION_RESTRICT_VIEW) == 0) {
+ icon = (lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0 ?
+ ICON_HIDE_ON :
+ ICON_HIDE_OFF;
+ }
+ bt = uiDefIconBut(
+ block, UI_BTYPE_TOGGLE, 0, icon,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0,
+ TIP_("Hide collection in viewport\n"
+ "* Alt to disable for all viewports\n"
+ "* Ctrl to isolate visibility\n"
+ "* Shift to hide inside objects and collections"));
+ UI_but_func_set(bt, hidebutton_layer_collection_flag_cb, view_layer, lc);
+ UI_but_func_pushed_state_set(bt, layer_collection_pushed_state_cb, lc);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ }
+ else {
+ bt = uiDefIconButR_prop(
+ block, UI_BTYPE_ICON_TOGGLE, 0, 0,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
+ UI_UNIT_Y, &collection_ptr, props.collection_hide_viewport, -1, 0, 0, 0, 0, NULL);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ }
bt = uiDefIconButR_prop(
block, UI_BTYPE_ICON_TOGGLE, 0, 0,
@@ -690,7 +784,7 @@ static void outliner_draw_restrictbuts(
}
}
-static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops, ListBase *lb)
+static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOutliner *soops, ListBase *lb)
{
for (TreeElement *te = lb->first; te; te = te->next) {
@@ -775,7 +869,7 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex)
immUnbindProgram();
}
-static void outliner_draw_rnabuts(uiBlock *block, ARegion *ar, SpaceOops *soops, int sizex, ListBase *lb)
+static void outliner_draw_rnabuts(uiBlock *block, ARegion *ar, SpaceOutliner *soops, int sizex, ListBase *lb)
{
PointerRNA *ptr;
PropertyRNA *prop;
@@ -1236,7 +1330,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
case OB_LIGHTPROBE:
data.icon = ICON_OUTLINER_OB_LIGHTPROBE; break;
case OB_EMPTY:
- if (ob->dup_group) {
+ if (ob->instance_collection) {
data.icon = ICON_OUTLINER_OB_GROUP_INSTANCE;
}
else if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
@@ -1268,7 +1362,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
data.icon = ICON_OUTLINER_DATA_LATTICE; break;
case ID_LA:
{
- Lamp *la = (Lamp *)tselem->id;
+ Light *la = (Light *)tselem->id;
switch (la->type) {
case LA_LOCAL:
data.icon = ICON_LIGHT_POINT; break;
@@ -1347,6 +1441,8 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
data.icon = ICON_MOD_MASK; break;
case ID_MC:
data.icon = ICON_SEQUENCE; break;
+ case ID_PC:
+ data.icon = ICON_CURVE_BEZCURVE; break;
default:
break;
}
@@ -1498,7 +1594,7 @@ typedef struct MergedIconRow {
} MergedIconRow;
static void outliner_draw_iconrow(
- bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops,
ListBase *lb, int level, int xmax, int *offsx, int ys, float alpha_fac, MergedIconRow *merged)
{
eOLDrawState active;
@@ -1595,7 +1691,7 @@ static void outliner_set_coord_tree_element(TreeElement *te, int startx, int sta
static void outliner_draw_tree_element(
bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *view_layer,
- ARegion *ar, SpaceOops *soops, TreeElement *te, bool draw_grayed_out,
+ ARegion *ar, SpaceOutliner *soops, TreeElement *te, bool draw_grayed_out,
int startx, int *starty, TreeElement **te_edit)
{
TreeStoreElem *tselem;
@@ -1831,7 +1927,7 @@ static void outliner_draw_tree_element(
}
static void outliner_draw_hierarchy_lines_recursive(
- unsigned pos, SpaceOops *soops, ListBase *lb, int startx,
+ unsigned pos, SpaceOutliner *soops, ListBase *lb, int startx,
const unsigned char col[4], bool draw_grayed_out,
int *starty)
{
@@ -1890,7 +1986,7 @@ static void outliner_draw_hierarchy_lines_recursive(
}
}
-static void outliner_draw_hierarchy_lines(SpaceOops *soops, ListBase *lb, int startx, int *starty)
+static void outliner_draw_hierarchy_lines(SpaceOutliner *soops, ListBase *lb, int startx, int *starty)
{
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
@@ -1907,7 +2003,7 @@ static void outliner_draw_hierarchy_lines(SpaceOops *soops, ListBase *lb, int st
immUnbindProgram();
}
-static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *lb, int *starty)
+static void outliner_draw_struct_marks(ARegion *ar, SpaceOutliner *soops, ListBase *lb, int *starty)
{
for (TreeElement *te = lb->first; te; te = te->next) {
TreeStoreElem *tselem = TREESTORE(te);
@@ -1945,7 +2041,7 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
}
static void outliner_draw_highlights_recursive(
- unsigned pos, const ARegion *ar, const SpaceOops *soops, const ListBase *lb,
+ unsigned pos, const ARegion *ar, const SpaceOutliner *soops, const ListBase *lb,
const float col_selection[4], const float col_highlight[4], const float col_searchmatch[4],
int start_x, int *io_start_y)
{
@@ -2011,7 +2107,7 @@ static void outliner_draw_highlights_recursive(
}
}
-static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx, int *starty)
+static void outliner_draw_highlights(ARegion *ar, SpaceOutliner *soops, int startx, int *starty)
{
const float col_highlight[4] = {1.0f, 1.0f, 1.0f, 0.13f};
float col_selection[4], col_searchmatch[4];
@@ -2034,7 +2130,7 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx,
static void outliner_draw_tree(
bContext *C, uiBlock *block, Scene *scene, ViewLayer *view_layer,
- ARegion *ar, SpaceOops *soops, const bool has_restrict_icons,
+ ARegion *ar, SpaceOutliner *soops, const bool has_restrict_icons,
TreeElement **te_edit)
{
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
@@ -2128,10 +2224,7 @@ static void outliner_draw_restrictcols(ARegion *ar)
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShadeAlpha(TH_BACK, -15, -200);
- immBegin(GPU_PRIM_LINES, 8);
-
- immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), (int)ar->v2d.cur.ymax);
- immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), (int)ar->v2d.cur.ymin);
+ immBegin(GPU_PRIM_LINES, 6);
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymax);
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymin);
@@ -2156,7 +2249,7 @@ void draw_outliner(const bContext *C)
ViewLayer *view_layer = CTX_data_view_layer(C);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
uiBlock *block;
int sizey = 0, sizex = 0, sizex_rna = 0;
TreeElement *te_edit = NULL;
@@ -2167,6 +2260,9 @@ void draw_outliner(const bContext *C)
/* get extents of data */
outliner_height(soops, &soops->tree, &sizey);
+ /* extend size to allow for horizontal scrollbar */
+ sizey += V2D_SCROLL_HEIGHT;
+
if (soops->outlinevis == SO_DATA_API) {
/* RNA has two columns:
* - column 1 is (max_width + OL_RNA_COL_SPACEX) or
@@ -2185,7 +2281,8 @@ void draw_outliner(const bContext *C)
has_restrict_icons = false;
}
else {
- /* width must take into account restriction columns (if visible) so that entries will still be visible */
+ /* width must take into account restriction columns (if visible)
+ * so that entries will still be visible */
//outliner_width(soops, &soops->tree, &sizex);
// XXX should use outliner_width instead when te->xend will be set correctly...
outliner_rna_width(soops, &soops->tree, &sizex, 0);
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index b5059cf6bb3..a96d5ad183f 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_edit.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include <string.h>
@@ -41,11 +33,9 @@
#include "DNA_material_types.h"
#include "BLI_blenlib.h"
+#include "BLI_dynstr.h"
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
-#include "BLI_mempool.h"
-#include "BLI_stack.h"
-#include "BLI_string.h"
#include "BLT_translation.h"
@@ -103,7 +93,7 @@ static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const
}
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
const float my = UI_view2d_region_to_view_y(&ar->v2d, event->mval[1]);
TreeElement *hovered_te = outliner_find_item_at_y(soops, &soops->tree, my);
@@ -137,7 +127,7 @@ void OUTLINER_OT_highlight_update(wmOperatorType *ot)
/* Toggle Open/Closed ------------------------------------------- */
-static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, const bool all, const float mval[2])
+static int do_outliner_item_openclose(bContext *C, SpaceOutliner *soops, TreeElement *te, const bool all, const float mval[2])
{
if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
@@ -168,7 +158,7 @@ static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement
static int outliner_item_openclose(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
const bool all = RNA_boolean_get(op->ptr, "all");
@@ -278,7 +268,7 @@ static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem,
}
}
else if (ID_IS_LINKED(tselem->id)) {
- BKE_report(reports, RPT_WARNING, "Cannot edit external libdata");
+ BKE_report(reports, RPT_WARNING, "Cannot edit external library data");
}
else if (te->idcode == ID_LI && ((Library *)tselem->id)->parent) {
BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library");
@@ -324,7 +314,7 @@ static int do_outliner_item_rename(ReportList *reports, ARegion *ar, TreeElement
static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
bool changed = false;
@@ -379,7 +369,7 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto
}
- BKE_libblock_delete(bmain, id);
+ BKE_id_delete(bmain, id);
WM_event_add_notifier(C, NC_WINDOW, NULL);
}
@@ -421,7 +411,7 @@ static int outliner_id_delete_invoke_do(bContext *C, ReportList *reports, TreeEl
static int outliner_id_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
@@ -455,7 +445,7 @@ void OUTLINER_OT_id_delete(wmOperatorType *ot)
static int outliner_id_remap_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
const short id_type = (short)RNA_enum_get(op->ptr, "id_type");
ID *old_id = BLI_findlink(which_libbase(CTX_data_main(C), id_type), RNA_enum_get(op->ptr, "old_id"));
@@ -486,7 +476,8 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op)
/* recreate dependency graph to include new objects */
DEG_relations_tag_update(bmain);
- /* free gpu materials, some materials depend on existing objects, such as lamps so freeing correctly refreshes */
+ /* Free gpu materials, some materials depend on existing objects,
+ * such as lights so freeing correctly refreshes. */
GPU_materials_free(bmain);
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -520,7 +511,7 @@ static bool outliner_id_remap_find_tree_element(bContext *C, wmOperator *op, Lis
static int outliner_id_remap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
float fmval[2];
@@ -675,7 +666,7 @@ static int outliner_lib_relocate_invoke_do(
static int outliner_lib_relocate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
@@ -705,7 +696,8 @@ void OUTLINER_OT_lib_relocate(wmOperatorType *ot)
}
/* XXX This does not work with several items
- * (it is only called once in the end, due to the 'deferred' filebrowser invocation through event system...). */
+ * (it is only called once in the end, due to the 'deferred'
+ * filebrowser invocation through event system...). */
void lib_relocate_cb(
bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *te,
TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
@@ -719,7 +711,7 @@ void lib_relocate_cb(
static int outliner_lib_reload_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
@@ -870,7 +862,7 @@ int common_restrict_check(bContext *C, Object *ob)
static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
if (outliner_flag_is_any_test(&soops->tree, TSE_CLOSED, 1))
@@ -901,7 +893,7 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
static int outliner_select_all_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int action = RNA_enum_get(op->ptr, "action");
@@ -950,7 +942,7 @@ void OUTLINER_OT_select_all(wmOperatorType *ot)
/* Show Active --------------------------------------------------- */
-static void outliner_set_coordinates_element_recursive(SpaceOops *soops, TreeElement *te, int startx, int *starty)
+static void outliner_set_coordinates_element_recursive(SpaceOutliner *soops, TreeElement *te, int startx, int *starty)
{
TreeStoreElem *tselem = TREESTORE(te);
@@ -968,7 +960,7 @@ static void outliner_set_coordinates_element_recursive(SpaceOops *soops, TreeEle
}
/* to retrieve coordinates with redrawing the entire tree */
-void outliner_set_coordinates(ARegion *ar, SpaceOops *soops)
+void outliner_set_coordinates(ARegion *ar, SpaceOutliner *soops)
{
TreeElement *te;
int starty = (int)(ar->v2d.tot.ymax) - UI_UNIT_Y;
@@ -996,7 +988,7 @@ static int outliner_open_back(TreeElement *te)
static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOops *so = CTX_wm_space_outliner(C);
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
@@ -1111,7 +1103,7 @@ void OUTLINER_OT_scroll_page(wmOperatorType *ot)
#if 0
/* find next element that has this name */
-static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *name, int flags,
+static TreeElement *outliner_find_name(SpaceOutliner *soops, ListBase *lb, char *name, int flags,
TreeElement *prev, int *prevFound)
{
TreeElement *te, *tes;
@@ -1140,7 +1132,7 @@ static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *nam
return NULL;
}
-static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int again, int flags)
+static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOutliner *soops, int again, int flags)
{
ReportList *reports = NULL; // CTX_wm_reports(C);
TreeElement *te = NULL;
@@ -1239,7 +1231,7 @@ static void outliner_openclose_level(ListBase *lb, int curlevel, int level, int
static int outliner_one_level_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
const bool add = RNA_boolean_get(op->ptr, "open");
int level;
@@ -1295,7 +1287,7 @@ static int subtree_has_objects(ListBase *lb)
}
/* recursive helper function for Show Hierarchy operator */
-static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase *lb)
+static void tree_element_show_hierarchy(Scene *scene, SpaceOutliner *soops, ListBase *lb)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -1327,7 +1319,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
/* show entire object level hierarchy */
static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
@@ -1362,7 +1354,7 @@ static bool ed_operator_outliner_datablocks_active(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if ((sa) && (sa->spacetype == SPACE_OUTLINER)) {
- SpaceOops *so = CTX_wm_space_outliner(C);
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
return (so->outlinevis == SO_DATA_API);
}
return 0;
@@ -1520,7 +1512,7 @@ enum {
/* Utilities ---------------------------------- */
/* Recursively iterate over tree, finding and working on selected items */
-static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportList *reports, short mode)
+static void do_outliner_drivers_editop(SpaceOutliner *soops, ListBase *tree, ReportList *reports, short mode)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -1598,7 +1590,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
/* check for invalid states */
if (soutliner == NULL)
@@ -1633,7 +1625,7 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
/* check for invalid states */
if (soutliner == NULL)
@@ -1701,7 +1693,7 @@ static KeyingSet *verify_active_keyingset(Scene *scene, short add)
}
/* Recursively iterate over tree, finding and working on selected items */
-static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBase *tree, short mode)
+static void do_outliner_keyingset_editop(SpaceOutliner *soops, KeyingSet *ks, ListBase *tree, short mode)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -1769,7 +1761,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = verify_active_keyingset(scene, 1);
@@ -1810,7 +1802,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOops *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = verify_active_keyingset(scene, 1);
@@ -1850,7 +1842,7 @@ static bool ed_operator_outliner_id_orphans_active(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if ((sa) && (sa->spacetype == SPACE_OUTLINER)) {
- SpaceOops *so = CTX_wm_space_outliner(C);
+ SpaceOutliner *so = CTX_wm_space_outliner(C);
return (so->outlinevis == SO_ID_ORPHANS);
}
return 0;
@@ -1858,24 +1850,98 @@ static bool ed_operator_outliner_id_orphans_active(bContext *C)
/* Purge Orphans Operator --------------------------------------- */
+static void outliner_orphans_purge_tag(ID *id, int *num_tagged)
+{
+ if (id->us == 0) {
+ id->tag |= LIB_TAG_DOIT;
+ num_tagged[INDEX_ID_NULL]++;
+ num_tagged[BKE_idcode_to_index(GS(id->name))]++;
+ }
+ else {
+ id->tag &= ~LIB_TAG_DOIT;
+ }
+}
+
static int outliner_orphans_purge_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(evt))
{
- /* present a prompt to informing users that this change is irreversible */
- return WM_operator_confirm_message(C, op,
- "Purging unused data-blocks cannot be undone and saves to current .blend file. "
- "Click here to proceed...");
+ Main *bmain = CTX_data_main(C);
+ int num_tagged[INDEX_ID_MAX] = {0};
+
+ /* Tag all IDs having zero users. */
+ ID *id;
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ outliner_orphans_purge_tag(id, num_tagged);
+ }
+ FOREACH_MAIN_ID_END;
+ RNA_int_set(op->ptr, "num_deleted", num_tagged[INDEX_ID_NULL]);
+
+ if (num_tagged[INDEX_ID_NULL] == 0) {
+ BKE_report(op->reports, RPT_INFO, "No orphanned data-blocks to purge");
+ return OPERATOR_CANCELLED;
+ }
+
+ DynStr *dyn_str = BLI_dynstr_new();
+ BLI_dynstr_append(dyn_str, "Purging unused data-blocks (");
+ bool is_first = true;
+ for (int i = 0; i < INDEX_ID_MAX - 2; i++) {
+ if (num_tagged[i] != 0) {
+ if (!is_first) {
+ BLI_dynstr_append(dyn_str, ", ");
+ }
+ else {
+ is_first = false;
+ }
+ BLI_dynstr_appendf(
+ dyn_str, "%d %s",
+ num_tagged[i], TIP_(BKE_idcode_to_name_plural(BKE_idcode_from_index(i))));
+ }
+ }
+ BLI_dynstr_append(dyn_str, TIP_("). Click here to proceed..."));
+
+ char *message = BLI_dynstr_get_cstring(dyn_str);
+ int ret = WM_operator_confirm_message(C, op, message);
+
+ MEM_freeN(message);
+ BLI_dynstr_free(dyn_str);
+ return ret;
}
-static int outliner_orphans_purge_exec(bContext *C, wmOperator *UNUSED(op))
+static int outliner_orphans_purge_exec(bContext *C, wmOperator *op)
{
- /* Firstly, ensure that the file has been saved,
- * so that the latest changes since the last save
- * are retained...
- */
- WM_operator_name_call(C, "WM_OT_save_mainfile", WM_OP_EXEC_DEFAULT, NULL);
+ Main *bmain = CTX_data_main(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ int num_tagged[INDEX_ID_MAX] = {0};
+
+ if ((num_tagged[INDEX_ID_NULL] = RNA_int_get(op->ptr, "num_deleted")) == 0) {
+ /* Tag all IDs having zero users. */
+ ID *id;
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ outliner_orphans_purge_tag(id, num_tagged);
+ }
+ FOREACH_MAIN_ID_END;
- /* Now, reload the file to get rid of the orphans... */
- WM_operator_name_call(C, "WM_OT_revert_mainfile", WM_OP_EXEC_DEFAULT, NULL);
+ if (num_tagged[INDEX_ID_NULL] == 0) {
+ BKE_report(op->reports, RPT_INFO, "No orphanned data-blocks to purge");
+ return OPERATOR_CANCELLED;
+ }
+ }
+
+ BKE_id_multi_tagged_delete(bmain);
+
+ BKE_reportf(op->reports, RPT_INFO, "Deleted %d data-blocks", num_tagged[INDEX_ID_NULL]);
+
+ /* XXX: tree management normally happens from draw_outliner(), but when
+ * you're clicking to fast on Delete object from context menu in
+ * outliner several mouse events can be handled in one cycle without
+ * handling notifiers/redraw which leads to deleting the same object twice.
+ * cleanup tree here to prevent such cases. */
+ outliner_cleanup_tree(soops);
+
+ DEG_relations_tag_update(bmain);
+ WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
return OPERATOR_FINISHED;
}
@@ -1884,8 +1950,7 @@ void OUTLINER_OT_orphans_purge(wmOperatorType *ot)
/* identifiers */
ot->idname = "OUTLINER_OT_orphans_purge";
ot->name = "Purge All";
- ot->description = "Clear all orphaned data-blocks without any users from the file "
- "(cannot be undone, saves to current .blend file)";
+ ot->description = "Clear all orphaned data-blocks without any users from the file";
/* callbacks */
ot->invoke = outliner_orphans_purge_invoke;
@@ -1894,4 +1959,8 @@ void OUTLINER_OT_orphans_purge(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ PropertyRNA *prop = RNA_def_int(ot->srna, "num_deleted", 0, 0, INT_MAX, "", "", 0, INT_MAX);
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
}
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index d6ebddf94e2..5af8e2252ef 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_intern.h
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
@@ -37,20 +30,20 @@
/* internal exports only */
struct ARegion;
+struct EditBone;
+struct ID;
struct ListBase;
-struct wmOperatorType;
-struct TreeElement;
-struct TreeStoreElem;
struct Main;
-struct bContext;
+struct Object;
struct Scene;
+struct TreeElement;
+struct TreeStoreElem;
struct ViewLayer;
-struct ID;
-struct Object;
+struct bContext;
struct bPoseChannel;
-struct EditBone;
struct wmEvent;
struct wmKeyConfig;
+struct wmOperatorType;
typedef enum TreeElementInsertType {
TE_INSERT_BEFORE,
@@ -92,7 +85,8 @@ typedef struct TreeElementIcon {
#define TREESTORE_ID_TYPE(_id) \
(ELEM(GS((_id)->name), ID_SCE, ID_LI, ID_OB, ID_ME, ID_CU, ID_MB, ID_NT, ID_MA, ID_TE, ID_IM, ID_LT, ID_LA, ID_CA) || \
ELEM(GS((_id)->name), ID_KE, ID_WO, ID_SPK, ID_GR, ID_AR, ID_AC, ID_BR, ID_PA, ID_GD, ID_LS, ID_LP) || \
- ELEM(GS((_id)->name), ID_SCR, ID_WM, ID_TXT, ID_VF, ID_SO, ID_CF, ID_PAL, ID_MC, ID_WS, ID_MSK)) /* Only in 'blendfile' mode ... :/ */
+ /* Only in 'blendfile' mode ... :/ */ \
+ ELEM(GS((_id)->name), ID_SCR, ID_WM, ID_TXT, ID_VF, ID_SO, ID_CF, ID_PAL, ID_MC, ID_WS, ID_MSK, ID_PC))
/* TreeElement->flag */
enum {
@@ -129,12 +123,11 @@ typedef enum {
/* size constants */
#define OL_Y_OFFSET 2
-#define OL_TOG_HIDEX (UI_UNIT_X * 4.0f + V2D_SCROLL_WIDTH)
#define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X * 3.0f + V2D_SCROLL_WIDTH)
#define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X * 2.0f + V2D_SCROLL_WIDTH)
#define OL_TOG_RESTRICT_RENDERX (UI_UNIT_X + V2D_SCROLL_WIDTH)
-#define OL_TOGW OL_TOG_HIDEX
+#define OL_TOGW OL_TOG_RESTRICT_SELECTX
#define OL_RNA_COLX (UI_UNIT_X * 15)
#define OL_RNA_COL_SIZEX (UI_UNIT_X * 7.5f)
@@ -168,13 +161,13 @@ typedef enum {
/* outliner_tree.c ----------------------------------------------- */
void outliner_free_tree(ListBase *tree);
-void outliner_cleanup_tree(struct SpaceOops *soops);
+void outliner_cleanup_tree(struct SpaceOutliner *soops);
void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree);
void outliner_build_tree(
struct Main *mainvar,
struct Scene *scene, struct ViewLayer *view_layer,
- struct SpaceOops *soops, struct ARegion *ar);
+ struct SpaceOutliner *soops, struct ARegion *ar);
typedef struct IDsSelectedData {
struct ListBase selected_array;
@@ -191,9 +184,9 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te);
/* outliner_select.c -------------------------------------------- */
eOLDrawState tree_element_type_active(
- struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, struct SpaceOops *soops,
+ struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, struct SpaceOutliner *soops,
TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive);
-eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, SpaceOops *soops,
+eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, struct ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, const eOLSetState set, const bool handle_all_types);
void outliner_item_do_activate_from_tree_element(
@@ -204,7 +197,7 @@ int outliner_item_do_activate_from_cursor(
bool extend, bool recursive);
void outliner_item_select(
- struct SpaceOops *soops, const struct TreeElement *te,
+ struct SpaceOutliner *soops, const struct TreeElement *te,
const bool extend, const bool toggle);
void outliner_object_mode_toggle(
@@ -217,10 +210,10 @@ typedef void (*outliner_operation_cb)(
struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *, void *);
void outliner_do_object_operation_ex(
- struct bContext *C, struct ReportList *reports, struct Scene *scene, struct SpaceOops *soops,
- struct ListBase *lb, outliner_operation_cb operation_cb, bool recurse_selected);
+ struct bContext *C, struct ReportList *reports, struct Scene *scene, struct SpaceOutliner *soops,
+ struct ListBase *lb, outliner_operation_cb operation_cb, void *user_data, bool recurse_selected);
void outliner_do_object_operation(
- struct bContext *C, struct ReportList *reports, struct Scene *scene, struct SpaceOops *soops,
+ struct bContext *C, struct ReportList *reports, struct Scene *scene, struct SpaceOutliner *soops,
struct ListBase *lb, outliner_operation_cb operation_cb);
int common_restrict_check(struct bContext *C, struct Object *ob);
@@ -253,7 +246,7 @@ void item_object_mode_exit_cb(
struct bContext *C, struct ReportList *reports, struct Scene *scene,
TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data);
-void outliner_set_coordinates(struct ARegion *ar, struct SpaceOops *soops);
+void outliner_set_coordinates(struct ARegion *ar, struct SpaceOutliner *soops);
/* outliner_dragdrop.c */
void outliner_dropboxes(void);
@@ -322,6 +315,8 @@ bool outliner_is_collection_tree_element(const TreeElement *te);
struct Collection *outliner_collection_from_tree_element(const TreeElement *te);
void OUTLINER_OT_collection_new(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_duplicate_hierarchy(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_duplicate_linked(struct wmOperatorType *ot);
void OUTLINER_OT_collection_duplicate(struct wmOperatorType *ot);
void OUTLINER_OT_collection_delete(struct wmOperatorType *ot);
void OUTLINER_OT_collection_objects_select(struct wmOperatorType *ot);
@@ -335,18 +330,30 @@ void OUTLINER_OT_collection_holdout_clear(struct wmOperatorType *ot);
void OUTLINER_OT_collection_indirect_only_set(struct wmOperatorType *ot);
void OUTLINER_OT_collection_indirect_only_clear(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_isolate(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_show(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_hide(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_show_inside(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_hide_inside(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_enable(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_disable(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_enable_render(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_disable_render(struct wmOperatorType *ot);
+void OUTLINER_OT_hide(struct wmOperatorType *ot);
+void OUTLINER_OT_unhide_all(struct wmOperatorType *ot);
+
/* outliner_utils.c ---------------------------------------------- */
-TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase *tree, float view_co_y);
-TreeElement *outliner_find_item_at_x_in_row(const SpaceOops *soops, const TreeElement *parent_te, float view_co_x);
-TreeElement *outliner_find_tse(struct SpaceOops *soops, const TreeStoreElem *tse);
+TreeElement *outliner_find_item_at_y(const SpaceOutliner *soops, const ListBase *tree, float view_co_y);
+TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *soops, const TreeElement *parent_te, float view_co_x);
+TreeElement *outliner_find_tse(struct SpaceOutliner *soops, const TreeStoreElem *tse);
TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem);
TreeElement *outliner_find_parent_element(ListBase *lb, TreeElement *parent_te, const TreeElement *child_te);
-TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, const struct ID *id);
+TreeElement *outliner_find_id(struct SpaceOutliner *soops, ListBase *lb, const struct ID *id);
TreeElement *outliner_find_posechannel(ListBase *lb, const struct bPoseChannel *pchan);
TreeElement *outliner_find_editbone(ListBase *lb, const struct EditBone *ebone);
-struct ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode);
-bool outliner_tree_traverse(const SpaceOops *soops, ListBase *tree, int filter_te_flag, int filter_tselem_flag,
+struct ID *outliner_search_back(SpaceOutliner *soops, TreeElement *te, short idcode);
+bool outliner_tree_traverse(const SpaceOutliner *soops, ListBase *tree, int filter_te_flag, int filter_tselem_flag,
TreeTraversalFunc func, void *customdata);
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 87c9827a15a..af73e88aa73 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,19 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_ops.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include "MEM_guardedalloc.h"
-#include "BLI_listbase.h"
-#include "BLI_math.h"
#include "DNA_collection_types.h"
#include "BLT_translation.h"
-#include "BKE_context.h"
-#include "BKE_main.h"
#include "GPU_immediate.h"
#include "GPU_state.h"
@@ -104,6 +93,8 @@ void outliner_operatortypes(void)
/* collections */
WM_operatortype_append(OUTLINER_OT_collection_new);
+ WM_operatortype_append(OUTLINER_OT_collection_duplicate_hierarchy);
+ WM_operatortype_append(OUTLINER_OT_collection_duplicate_linked);
WM_operatortype_append(OUTLINER_OT_collection_duplicate);
WM_operatortype_append(OUTLINER_OT_collection_delete);
WM_operatortype_append(OUTLINER_OT_collection_objects_select);
@@ -116,6 +107,18 @@ void outliner_operatortypes(void)
WM_operatortype_append(OUTLINER_OT_collection_holdout_clear);
WM_operatortype_append(OUTLINER_OT_collection_indirect_only_set);
WM_operatortype_append(OUTLINER_OT_collection_indirect_only_clear);
+
+ WM_operatortype_append(OUTLINER_OT_collection_isolate);
+ WM_operatortype_append(OUTLINER_OT_collection_disable);
+ WM_operatortype_append(OUTLINER_OT_collection_enable);
+ WM_operatortype_append(OUTLINER_OT_collection_hide);
+ WM_operatortype_append(OUTLINER_OT_collection_show);
+ WM_operatortype_append(OUTLINER_OT_collection_disable_render);
+ WM_operatortype_append(OUTLINER_OT_collection_enable_render);
+ WM_operatortype_append(OUTLINER_OT_collection_hide_inside);
+ WM_operatortype_append(OUTLINER_OT_collection_show_inside);
+ WM_operatortype_append(OUTLINER_OT_hide);
+ WM_operatortype_append(OUTLINER_OT_unhide_all);
}
void outliner_keymap(wmKeyConfig *keyconf)
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index d9e069f75c2..09fa6d63557 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,17 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_select.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include <stdlib.h>
#include "DNA_armature_types.h"
#include "DNA_collection_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -61,6 +53,7 @@
#include "ED_armature.h"
#include "ED_object.h"
#include "ED_screen.h"
+#include "ED_select_utils.h"
#include "ED_sequencer.h"
#include "ED_undo.h"
#include "ED_gpencil.h"
@@ -77,84 +70,138 @@
#include "outliner_intern.h"
-static void do_outliner_activate_obdata(bContext *C, Scene *scene, ViewLayer *view_layer, Base *base)
+static bool do_outliner_activate_common(
+ bContext *C,
+ Main *bmain,
+ Depsgraph *depsgraph,
+ Scene *scene,
+ ViewLayer *view_layer,
+ Base *base,
+ const bool extend,
+ const bool do_exit)
+{
+ bool use_all = false;
+
+ if (do_exit) {
+ FOREACH_OBJECT_BEGIN(view_layer, ob_iter)
+ {
+ ED_object_mode_generic_exit(bmain, depsgraph, scene, ob_iter);
+ }
+ FOREACH_OBJECT_END;
+ }
+
+ /* Just like clicking in the object changes the active object,
+ * clicking on the object data should change it as well. */
+ ED_object_base_activate(C, base);
+
+ if (extend) {
+ use_all = true;
+ }
+ else {
+ ED_object_base_deselect_all(view_layer, NULL, SEL_DESELECT);
+ }
+
+ return use_all;
+}
+
+/**
+ * Bring the newly selected object into edit mode.
+ *
+ * If extend is used, we try to have the other compatible selected objects in the new mode as well.
+ * Otherwise only the new object will be active, selected and in the edit mode.
+ */
+static void do_outliner_activate_obdata(bContext *C, Scene *scene, ViewLayer *view_layer, Base *base, const bool extend)
{
Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *obact = OBACT(view_layer);
+ Object *ob = base->object;
bool use_all = false;
if (obact == NULL) {
ED_object_base_activate(C, base);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- obact = base->object;
+ obact = ob;
use_all = true;
}
- else if (obact->data == base->object->data) {
+ else if (obact->data == ob->data) {
use_all = true;
}
+ else if (obact->mode == OB_MODE_OBJECT) {
+ use_all = do_outliner_activate_common(C, bmain, depsgraph, scene, view_layer, base, extend, false);
+ }
+ else if ((ob->type != obact->type) ||
+ ((obact->mode & OB_MODE_EDIT) == 0) ||
+ ((obact->mode & OB_MODE_POSE) && ELEM(OB_ARMATURE, ob->type, obact->type)) ||
+ !extend)
+ {
+ use_all = do_outliner_activate_common(C, bmain, depsgraph, scene, view_layer, base, extend, true);
+ }
if (use_all) {
WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
}
else {
- Object *ob = base->object;
- if (ob->type == obact->type) {
- bool ok;
- if (BKE_object_is_in_editmode(ob)) {
- ok = ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA | EM_WAITCURSOR);
- }
- else {
- ok = ED_object_editmode_enter_ex(CTX_data_main(C), scene, ob, EM_WAITCURSOR | EM_NO_CONTEXT);
- }
- if (ok) {
- ED_object_base_select(base, (ob->mode & OB_MODE_EDIT) ? BA_SELECT : BA_DESELECT);
- DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- }
+ bool ok;
+ if (BKE_object_is_in_editmode(ob)) {
+ ok = ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA);
+ }
+ else {
+ ok = ED_object_editmode_enter_ex(CTX_data_main(C), scene, ob, EM_NO_CONTEXT);
+ }
+ if (ok) {
+ ED_object_base_select(base, (ob->mode & OB_MODE_EDIT) ? BA_SELECT : BA_DESELECT);
+ DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
}
}
-static void do_outliner_activate_pose(bContext *C, ViewLayer *view_layer, Base *base)
+static void do_outliner_activate_pose(bContext *C, Scene *scene, ViewLayer *view_layer, Base *base, const bool extend)
{
+ Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *obact = OBACT(view_layer);
+ Object *ob = base->object;
bool use_all = false;
if (obact == NULL) {
ED_object_base_activate(C, base);
- Scene *scene = CTX_data_scene(C);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- obact = base->object;
+ obact = ob;
use_all = true;
}
- else if (obact->data == base->object->data) {
+ else if (obact->data == ob->data) {
use_all = true;
}
+ else if (obact->mode == OB_MODE_OBJECT) {
+ use_all = do_outliner_activate_common(C, bmain, depsgraph, scene, view_layer, base, extend, false);
+ }
+ else if ((!ELEM(ob->type, obact->type)) ||
+ ((obact->mode & OB_MODE_EDIT) && ELEM(OB_ARMATURE, ob->type, obact->type)))
+ {
+ use_all = do_outliner_activate_common(C, bmain, depsgraph, scene, view_layer, base, extend, true);
+ }
if (use_all) {
WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
}
else {
- Object *ob = base->object;
- if (ob->type == obact->type) {
- struct Main *bmain = CTX_data_main(C);
- bool ok = false;
- if (ob->mode & OB_MODE_POSE) {
- ok = ED_object_posemode_exit_ex(bmain, ob);
- }
- else {
- ok = ED_object_posemode_enter_ex(bmain, ob);
- }
- if (ok) {
- ED_object_base_select(base, (ob->mode & OB_MODE_POSE) ? BA_SELECT : BA_DESELECT);
+ bool ok = false;
+ if (ob->mode & OB_MODE_POSE) {
+ ok = ED_object_posemode_exit_ex(bmain, ob);
+ }
+ else {
+ ok = ED_object_posemode_enter_ex(bmain, ob);
+ }
+ if (ok) {
+ ED_object_base_select(base, (ob->mode & OB_MODE_POSE) ? BA_SELECT : BA_DESELECT);
- Scene *scene = CTX_data_scene(C);
- DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- }
+ DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
}
}
@@ -166,10 +213,10 @@ void outliner_object_mode_toggle(
{
Object *obact = OBACT(view_layer);
if (obact->mode & OB_MODE_EDIT) {
- do_outliner_activate_obdata(C, scene, view_layer, base);
+ do_outliner_activate_obdata(C, scene, view_layer, base, true);
}
else if (obact->mode & OB_MODE_POSE) {
- do_outliner_activate_pose(C, view_layer, base);
+ do_outliner_activate_pose(C, scene, view_layer, base, true);
}
}
@@ -243,7 +290,7 @@ static void do_outliner_ebone_select_recursive(bArmature *arm, EditBone *ebone_p
}
static eOLDrawState tree_element_set_active_object(
- bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, const eOLSetState set, bool recursive)
{
TreeStoreElem *tselem = TREESTORE(te);
@@ -304,7 +351,8 @@ static eOLDrawState tree_element_set_active_object(
/* Only in object mode so we can switch the active object,
* keeping all objects in the current 'mode' selected, useful for multi-pose/edit mode.
- * This keeps the convention that all objects in the current mode are also selected. see T55246. */
+ * This keeps the convention that all objects in the current mode are also selected.
+ * see T55246. */
if ((scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) ? (ob->mode == OB_MODE_OBJECT) : true) {
BKE_view_layer_base_deselect_all(view_layer);
}
@@ -323,14 +371,14 @@ static eOLDrawState tree_element_set_active_object(
}
if (ob != OBEDIT_FROM_VIEW_LAYER(view_layer)) {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
}
return OL_DRAWSEL_NORMAL;
}
static eOLDrawState tree_element_active_material(
- bContext *C, Scene *UNUSED(scene), ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, Scene *UNUSED(scene), ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, const eOLSetState set)
{
TreeElement *tes;
@@ -382,8 +430,8 @@ static eOLDrawState tree_element_active_material(
return OL_DRAWSEL_NONE;
}
-static eOLDrawState tree_element_active_lamp(
- bContext *UNUSED(C), Scene *UNUSED(scene), ViewLayer *view_layer, SpaceOops *soops,
+static eOLDrawState tree_element_active_light(
+ bContext *UNUSED(C), Scene *UNUSED(scene), ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, const eOLSetState set)
{
Object *ob;
@@ -406,7 +454,7 @@ static eOLDrawState tree_element_active_lamp(
}
static eOLDrawState tree_element_active_camera(
- bContext *UNUSED(C), Scene *scene, ViewLayer *UNUSED(sl), SpaceOops *soops,
+ bContext *UNUSED(C), Scene *scene, ViewLayer *UNUSED(sl), SpaceOutliner *soops,
TreeElement *te, const eOLSetState set)
{
Object *ob = (Object *)outliner_search_back(soops, te, ID_OB);
@@ -419,7 +467,7 @@ static eOLDrawState tree_element_active_camera(
}
static eOLDrawState tree_element_active_world(
- bContext *C, Scene *scene, ViewLayer *UNUSED(sl), SpaceOops *UNUSED(soops),
+ bContext *C, Scene *scene, ViewLayer *UNUSED(sl), SpaceOutliner *UNUSED(soops),
TreeElement *te, const eOLSetState set)
{
TreeElement *tep;
@@ -548,7 +596,7 @@ static eOLDrawState tree_element_active_posechannel(
}
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, ob);
-
+ DEG_id_tag_update(&arm->id, ID_RECALC_SELECT);
}
}
else {
@@ -712,7 +760,7 @@ static int tree_element_active_constraint(
}
static eOLDrawState tree_element_active_text(
- bContext *UNUSED(C), Scene *UNUSED(scene), ViewLayer *UNUSED(sl), SpaceOops *UNUSED(soops),
+ bContext *UNUSED(C), Scene *UNUSED(scene), ViewLayer *UNUSED(sl), SpaceOutliner *UNUSED(soops),
TreeElement *UNUSED(te), int UNUSED(set))
{
// XXX removed
@@ -720,7 +768,7 @@ static eOLDrawState tree_element_active_text(
}
static eOLDrawState tree_element_active_pose(
- bContext *C, ViewLayer *view_layer, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
+ bContext *C, Scene *scene, ViewLayer *view_layer, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
{
Object *ob = (Object *)tselem->id;
Base *base = BKE_view_layer_base_find(view_layer, ob);
@@ -731,7 +779,7 @@ static eOLDrawState tree_element_active_pose(
}
if (set != OL_SETSEL_NONE) {
- do_outliner_activate_pose(C, view_layer, base);
+ do_outliner_activate_pose(C, scene, view_layer, base, (set == OL_SETSEL_EXTEND));
}
else {
if (ob->mode & OB_MODE_POSE) {
@@ -864,7 +912,7 @@ static eOLDrawState tree_element_active_layer_collection(
/* ---------------------------------------------- */
/* generic call for ID data check or make/check active in UI */
-eOLDrawState tree_element_active(bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOops *soops, TreeElement *te,
+eOLDrawState tree_element_active(bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops, TreeElement *te,
const eOLSetState set, const bool handle_all_types)
{
switch (te->idcode) {
@@ -880,7 +928,7 @@ eOLDrawState tree_element_active(bContext *C, Scene *scene, ViewLayer *view_laye
case ID_WO:
return tree_element_active_world(C, scene, view_layer, soops, te, set);
case ID_LA:
- return tree_element_active_lamp(C, scene, view_layer, soops, te, set);
+ return tree_element_active_light(C, scene, view_layer, soops, te, set);
case ID_TXT:
return tree_element_active_text(C, scene, view_layer, soops, te, set);
case ID_CA:
@@ -893,7 +941,7 @@ eOLDrawState tree_element_active(bContext *C, Scene *scene, ViewLayer *view_laye
* Generic call for non-id data to make/check active in UI
*/
eOLDrawState tree_element_type_active(
- bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive)
{
switch (tselem->type) {
@@ -916,7 +964,7 @@ eOLDrawState tree_element_type_active(
case TSE_LINKED_PSYS:
return tree_element_active_psys(C, scene, te, tselem, set);
case TSE_POSE_BASE:
- return tree_element_active_pose(C, view_layer, te, tselem, set);
+ return tree_element_active_pose(C, scene, view_layer, te, tselem, set);
case TSE_POSE_CHANNEL:
return tree_element_active_posechannel(C, scene, view_layer, te, tselem, set, recursive);
case TSE_CONSTRAINT:
@@ -951,7 +999,7 @@ eOLDrawState tree_element_type_active(
* Needed to run from operators accessed from a menu.
*/
static void do_outliner_item_activate_tree_element(
- bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops,
TreeElement *te, TreeStoreElem *tselem,
const bool extend, const bool recursive)
{
@@ -1028,7 +1076,7 @@ static void do_outliner_item_activate_tree_element(
if ((ob != NULL) && (ob->data == tselem->id)) {
Base *base = BKE_view_layer_base_find(view_layer, ob);
if ((base != NULL) && (base->flag & BASE_VISIBLE)) {
- do_outliner_activate_obdata(C, scene, view_layer, base);
+ do_outliner_activate_obdata(C, scene, view_layer, base, extend);
}
}
}
@@ -1052,7 +1100,7 @@ static void do_outliner_item_activate_tree_element(
* \param extend: Don't deselect other items, only modify \a te.
* \param toggle: Select \a te when not selected, deselect when selected.
*/
-void outliner_item_select(SpaceOops *soops, const TreeElement *te, const bool extend, const bool toggle)
+void outliner_item_select(SpaceOutliner *soops, const TreeElement *te, const bool extend, const bool toggle)
{
TreeStoreElem *tselem = TREESTORE(te);
const short new_flag = toggle ? (tselem->flag ^ TSE_SELECTED) : (tselem->flag | TSE_SELECTED);
@@ -1082,7 +1130,7 @@ static bool outliner_item_is_co_within_close_toggle(TreeElement *te, float view_
return ((te->flag & TE_ICONROW) == 0) && (view_co_x > te->xs) && (view_co_x < te->xs + UI_UNIT_X);
}
-static bool outliner_is_co_within_restrict_columns(const SpaceOops *soops, const ARegion *ar, float view_co_x)
+static bool outliner_is_co_within_restrict_columns(const SpaceOutliner *soops, const ARegion *ar, float view_co_x)
{
return ((soops->outlinevis != SO_DATA_API) &&
!(soops->flag & SO_HIDE_RESTRICTCOLS) &&
@@ -1101,7 +1149,7 @@ void outliner_item_do_activate_from_tree_element(
{
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
do_outliner_item_activate_tree_element(
C, scene, view_layer, soops,
@@ -1119,7 +1167,7 @@ int outliner_item_do_activate_from_cursor(
bool extend, bool recursive)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float view_mval[2];
bool changed = false, rebuild_tree = false;
@@ -1188,7 +1236,7 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
/* ****************************************************** */
/* **************** Box Select Tool ****************** */
-static void outliner_item_box_select(Scene *scene, rctf *rectf, TreeElement *te, bool select)
+static void outliner_item_box_select(SpaceOutliner *soops, Scene *scene, rctf *rectf, TreeElement *te, bool select)
{
TreeStoreElem *tselem = TREESTORE(te);
@@ -1202,9 +1250,9 @@ static void outliner_item_box_select(Scene *scene, rctf *rectf, TreeElement *te,
}
/* Look at its children. */
- if ((tselem->flag & TSE_CLOSED) == 0) {
+ if (TSELEM_OPEN(tselem, soops)) {
for (te = te->subtree.first; te; te = te->next) {
- outliner_item_box_select(scene, rectf, te, select);
+ outliner_item_box_select(soops, scene, rectf, te, select);
}
}
}
@@ -1212,17 +1260,21 @@ static void outliner_item_box_select(Scene *scene, rctf *rectf, TreeElement *te,
static int outliner_box_select_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
- TreeElement *te;
rctf rectf;
- bool select = !RNA_boolean_get(op->ptr, "deselect");
+
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ outliner_flag_set(&soops->tree, TSE_SELECTED, 0);
+ }
WM_operator_properties_border_to_rctf(op, &rectf);
UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf);
- for (te = soops->tree.first; te; te = te->next) {
- outliner_item_box_select(scene, &rectf, te, select);
+ for (TreeElement *te = soops->tree.first; te; te = te->next) {
+ outliner_item_box_select(soops, scene, &rectf, te, select);
}
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
@@ -1250,8 +1302,9 @@ void OUTLINER_OT_select_box(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- /* rna */
- WM_operator_properties_gesture_box_ex(ot, true, false);
+ /* properties */
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/* ****************************************************** */
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 5806cf28fa8..24ca497ed5d 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_tools.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include "MEM_guardedalloc.h"
@@ -35,7 +27,7 @@
#include "DNA_armature_types.h"
#include "DNA_collection_types.h"
#include "DNA_gpencil_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
@@ -55,11 +47,11 @@
#include "BKE_context.h"
#include "BKE_constraint.h"
#include "BKE_fcurve.h"
+#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_library.h"
#include "BKE_library_override.h"
#include "BKE_library_query.h"
-#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_scene.h"
@@ -78,6 +70,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "WM_message.h"
#include "UI_interface.h"
#include "UI_view2d.h"
@@ -94,7 +87,7 @@
/* ************ SELECTION OPERATIONS ********* */
-static void set_operation_types(SpaceOops *soops, ListBase *lb,
+static void set_operation_types(SpaceOutliner *soops, ListBase *lb,
int *scenelevel,
int *objectlevel,
int *idlevel,
@@ -229,7 +222,7 @@ static void unlink_collection_cb(
if (tsep) {
if (GS(tsep->id->name) == ID_OB) {
Object *ob = (Object *)tsep->id;
- ob->dup_group = NULL;
+ ob->instance_collection = NULL;
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
DEG_relations_tag_update(bmain);
}
@@ -288,7 +281,7 @@ static void unlink_world_cb(
}
static void outliner_do_libdata_operation(
- bContext *C, ReportList *reports, Scene *scene, SpaceOops *soops, ListBase *lb,
+ bContext *C, ReportList *reports, Scene *scene, SpaceOutliner *soops, ListBase *lb,
outliner_operation_cb operation_cb,
void *user_data)
{
@@ -311,12 +304,12 @@ static void outliner_do_libdata_operation(
/* ******************************************** */
typedef enum eOutliner_PropSceneOps {
- OL_SCENE_OP_DELETE = 1
+ OL_SCENE_OP_DELETE = 1,
} eOutliner_PropSceneOps;
static const EnumPropertyItem prop_scene_op_types[] = {
{OL_SCENE_OP_DELETE, "DELETE", ICON_X, "Delete", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static bool outliner_do_scene_operation(
@@ -357,7 +350,7 @@ static bool scene_cb(bContext *C, eOutliner_PropSceneOps event, TreeElement *UNU
static int outliner_scene_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
const eOutliner_PropSceneOps event = RNA_enum_get(op->ptr, "type");
if (outliner_do_scene_operation(C, event, &soops->tree, scene_cb) == false) {
@@ -451,7 +444,7 @@ static void object_delete_cb(
// check also library later
if (ob == CTX_data_edit_object(C)) {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
ED_object_base_free_and_unlink(CTX_data_main(C), scene, ob);
/* leave for ED_outliner_id_unref to handle */
@@ -560,8 +553,8 @@ static void singleuser_world_cb(
* \param select_recurse: Set to false for operations which are already recursively operating on their children.
*/
void outliner_do_object_operation_ex(
- bContext *C, ReportList *reports, Scene *scene_act, SpaceOops *soops, ListBase *lb,
- outliner_operation_cb operation_cb, bool select_recurse)
+ bContext *C, ReportList *reports, Scene *scene_act, SpaceOutliner *soops, ListBase *lb,
+ outliner_operation_cb operation_cb, void *user_data, bool select_recurse)
{
TreeElement *te;
@@ -578,24 +571,24 @@ void outliner_do_object_operation_ex(
/* 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 isn't showing scenes: Visible Layer draw mode for eg. */
- operation_cb(C, reports, scene_owner ? scene_owner : scene_act, te, NULL, tselem, NULL);
+ operation_cb(C, reports, scene_owner ? scene_owner : scene_act, te, NULL, tselem, user_data);
select_handled = true;
}
}
if (TSELEM_OPEN(tselem, soops)) {
if ((select_handled == false) || select_recurse) {
outliner_do_object_operation_ex(
- C, reports, scene_act, soops, &te->subtree, operation_cb, select_recurse);
+ C, reports, scene_act, soops, &te->subtree, operation_cb, NULL, select_recurse);
}
}
}
}
void outliner_do_object_operation(
- bContext *C, ReportList *reports, Scene *scene_act, SpaceOops *soops, ListBase *lb,
+ bContext *C, ReportList *reports, Scene *scene_act, SpaceOutliner *soops, ListBase *lb,
outliner_operation_cb operation_cb)
{
- outliner_do_object_operation_ex(C, reports, scene_act, soops, lb, operation_cb, true);
+ outliner_do_object_operation_ex(C, reports, scene_act, soops, lb, operation_cb, NULL, true);
}
/* ******************************************** */
@@ -752,7 +745,7 @@ static void constraint_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tsel
{
bContext *C = C_v;
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
bConstraint *constraint = (bConstraint *)te->directdata;
Object *ob = (Object *)outliner_search_back(soops, te, ID_OB);
@@ -779,7 +772,10 @@ static void constraint_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tsel
if (BKE_constraint_remove_ex(lb, ob, constraint, true)) {
/* there's no active constraint now, so make sure this is the case */
BKE_constraints_active_set(&ob->constraints, NULL);
- ED_object_constraint_update(bmain, ob); /* needed to set the flags on posebones correctly */
+
+ /* needed to set the flags on posebones correctly */
+ ED_object_constraint_update(bmain, ob);
+
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob);
te->store_elem->flag &= ~TSE_SELECTED;
}
@@ -790,7 +786,7 @@ static void modifier_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem
{
bContext *C = (bContext *)Carg;
Main *bmain = CTX_data_main(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
ModifierData *md = (ModifierData *)te->directdata;
Object *ob = (Object *)outliner_search_back(soops, te, ID_OB);
@@ -811,7 +807,7 @@ static void modifier_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem
}
}
-static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb,
+static void outliner_do_data_operation(SpaceOutliner *soops, int type, int event, ListBase *lb,
void (*operation_cb)(int, TreeElement *, TreeStoreElem *, void *),
void *arg)
{
@@ -883,7 +879,7 @@ static void object_delete_hierarchy_cb(
/* Check also library later. */
for (; obedit && (obedit != base->object); obedit = obedit->parent);
if (obedit == base->object) {
- ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);
+ ED_object_editmode_exit(C, EM_FREEDATA);
}
outline_delete_hierarchy(C, reports, scene, base);
@@ -898,6 +894,77 @@ static void object_delete_hierarchy_cb(
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
}
+static Base *outline_batch_delete_hierarchy(
+ ReportList *reports, Main *bmain, ViewLayer *view_layer, Scene *scene, Base *base)
+{
+ Base *child_base, *base_next;
+ Object *object, *parent;
+
+ if (!base) {
+ return NULL;
+ }
+
+ object = base->object;
+ for (child_base = view_layer->object_bases.first; child_base; child_base = base_next) {
+ base_next = child_base->next;
+ for (parent = child_base->object->parent; parent && (parent != object); parent = parent->parent);
+ if (parent) {
+ base_next = outline_batch_delete_hierarchy(reports, bmain, view_layer, scene, child_base);
+ }
+ }
+
+ base_next = base->next;
+
+ if (object->id.tag & LIB_TAG_INDIRECT) {
+ BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked object '%s'", base->object->id.name + 2);
+ return base_next;
+ }
+ else if (BKE_library_ID_is_indirectly_used(bmain, object) &&
+ ID_REAL_USERS(object) <= 1 && ID_EXTRA_USERS(object) == 0)
+ {
+ BKE_reportf(reports, RPT_WARNING,
+ "Cannot delete object '%s' from scene '%s', indirectly used objects need at least one user",
+ object->id.name + 2, scene->id.name + 2);
+ return base_next;
+ }
+
+ DEG_id_tag_update_ex(bmain, &object->id, ID_RECALC_BASE_FLAGS);
+ BKE_scene_collections_object_remove(bmain, scene, object, false);
+
+ if (object->id.us == 0) {
+ object->id.tag |= LIB_TAG_DOIT;
+ }
+
+ return base_next;
+}
+
+static void object_batch_delete_hierarchy_cb(
+ bContext *C, ReportList *reports, Scene *scene,
+ TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
+{
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Base *base = (Base *)te->directdata;
+ Object *obedit = CTX_data_edit_object(C);
+
+ if (!base) {
+ base = BKE_view_layer_base_find(view_layer, (Object *)tselem->id);
+ }
+ if (base) {
+ /* Check also library later. */
+ for (; obedit && (obedit != base->object); obedit = obedit->parent);
+ if (obedit == base->object) {
+ ED_object_editmode_exit(C, EM_FREEDATA);
+ }
+
+ outline_batch_delete_hierarchy(reports, CTX_data_main(C), view_layer, scene, base);
+ /* leave for ED_outliner_id_unref to handle */
+#if 0
+ te->directdata = NULL;
+ tselem->id = NULL;
+#endif
+ }
+}
+
/* **************************************** */
enum {
@@ -917,25 +984,26 @@ enum {
};
static const EnumPropertyItem prop_object_op_types[] = {
- {OL_OP_SELECT, "SELECT", 0, "Select", ""},
+ {OL_OP_SELECT, "SELECT", ICON_RESTRICT_SELECT_OFF, "Select", ""},
{OL_OP_DESELECT, "DESELECT", 0, "Deselect", ""},
{OL_OP_SELECT_HIERARCHY, "SELECT_HIERARCHY", 0, "Select Hierarchy", ""},
- {OL_OP_DELETE, "DELETE", 0, "Delete", ""},
+ {OL_OP_DELETE, "DELETE", ICON_X, "Delete", ""},
{OL_OP_DELETE_HIERARCHY, "DELETE_HIERARCHY", 0, "Delete Hierarchy", ""},
{OL_OP_REMAP, "REMAP", 0, "Remap Users",
"Make all users of selected data-blocks to use instead a new chosen one"},
{OL_OP_RENAME, "RENAME", 0, "Rename", ""},
{OL_OP_OBJECT_MODE_ENTER, "OBJECT_MODE_ENTER", 0, "Enter Mode", ""},
{OL_OP_OBJECT_MODE_EXIT, "OBJECT_MODE_EXIT", 0, "Exit Mode", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_object_operation_exec(bContext *C, wmOperator *op)
{
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
wmWindow *win = CTX_wm_window(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int event;
const char *str = NULL;
@@ -958,7 +1026,8 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
}
else if (event == OL_OP_SELECT_HIERARCHY) {
Scene *sce = scene; // to be able to delete, scenes are set...
- outliner_do_object_operation_ex(C, op->reports, scene, soops, &soops->tree, object_select_hierarchy_cb, false);
+ outliner_do_object_operation_ex(
+ C, op->reports, scene, soops, &soops->tree, object_select_hierarchy_cb, NULL, false);
if (scene != sce) {
WM_window_set_active_scene(bmain, C, win, sce);
}
@@ -973,6 +1042,9 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
else if (event == OL_OP_DELETE) {
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ const Base *basact_prev = BASACT(view_layer);
+
outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_delete_cb);
/* XXX: tree management normally happens from draw_outliner(), but when
@@ -985,10 +1057,29 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(bmain);
str = "Delete Objects";
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ if (basact_prev != BASACT(view_layer)) {
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
+ }
}
else if (event == OL_OP_DELETE_HIERARCHY) {
- outliner_do_object_operation_ex(C, op->reports, scene, soops, &soops->tree, object_delete_hierarchy_cb, false);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ const Base *basact_prev = BASACT(view_layer);
+
+ /* Keeping old 'safe and slow' code for a bit (new one enabled on 28/01/2019). */
+ if (G.debug_value == 666) {
+ outliner_do_object_operation_ex(
+ C, op->reports, scene, soops, &soops->tree, object_delete_hierarchy_cb, NULL, false);
+ }
+ else {
+ BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
+
+ outliner_do_object_operation_ex(
+ C, op->reports, scene, soops, &soops->tree, object_batch_delete_hierarchy_cb, NULL, false);
+
+ BKE_id_multi_tagged_delete(bmain);
+ }
/* XXX: See OL_OP_DELETE comment above. */
outliner_cleanup_tree(soops);
@@ -996,7 +1087,11 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(bmain);
str = "Delete Object Hierarchy";
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ if (basact_prev != BASACT(view_layer)) {
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
+ }
}
else if (event == OL_OP_REMAP) {
outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_remap_cb, NULL);
@@ -1071,7 +1166,7 @@ static const EnumPropertyItem prop_id_op_types[] = {
{OUTLINER_IDOP_STATIC_OVERRIDE, "STATIC_OVERRIDE", 0, "Add Static Override",
"Add a local static override of this data-block"},
{OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""},
- {OUTLINER_IDOP_DELETE, "DELETE", 0, "Delete", "WARNING: no undo"},
+ {OUTLINER_IDOP_DELETE, "DELETE", ICON_X, "Delete", "WARNING: no undo"},
{OUTLINER_IDOP_REMAP, "REMAP", 0, "Remap Users",
"Make all users of selected data-blocks to use instead current (clicked) one"},
{OUTLINER_IDOP_FAKE_ADD, "ADD_FAKE", 0, "Add Fake User",
@@ -1079,7 +1174,7 @@ static const EnumPropertyItem prop_id_op_types[] = {
{OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""},
{OUTLINER_IDOP_RENAME, "RENAME", 0, "Rename", ""},
{OUTLINER_IDOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem *outliner_id_operation_itemf(
@@ -1108,7 +1203,7 @@ static const EnumPropertyItem *outliner_id_operation_itemf(
static int outliner_id_operation_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutlinerIdOpTypes event;
@@ -1302,16 +1397,16 @@ typedef enum eOutlinerLibOpTypes {
static const EnumPropertyItem outliner_lib_op_type_items[] = {
{OL_LIB_RENAME, "RENAME", 0, "Rename", ""},
- {OL_LIB_DELETE, "DELETE", 0, "Delete", "Delete this library and all its item from Blender - WARNING: no undo"},
+ {OL_LIB_DELETE, "DELETE", ICON_X, "Delete", "Delete this library and all its item from Blender - WARNING: no undo"},
{OL_LIB_RELOCATE, "RELOCATE", 0, "Relocate", "Select a new path for this library, and reload all its data"},
- {OL_LIB_RELOAD, "RELOAD", 0, "Reload", "Reload all data from this library"},
- {0, NULL, 0, NULL, NULL}
+ {OL_LIB_RELOAD, "RELOAD", ICON_FILE_REFRESH, "Reload", "Reload all data from this library"},
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_lib_operation_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutlinerLibOpTypes event;
@@ -1383,7 +1478,7 @@ void OUTLINER_OT_lib_operation(wmOperatorType *ot)
/* **************************************** */
-static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *lb, ID *newid,
+static void outliner_do_id_set_operation(SpaceOutliner *soops, int type, ListBase *lb, ID *newid,
void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *, ID *))
{
TreeElement *te;
@@ -1425,7 +1520,7 @@ static void actionset_id_cb(TreeElement *UNUSED(te), TreeStoreElem *tselem, Tree
static int outliner_action_set_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
bAction *act;
@@ -1436,7 +1531,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
/* get action to use */
- act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
+ act = BLI_findlink(&CTX_data_main(C)->actions, RNA_enum_get(op->ptr, "action"));
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid action to add");
@@ -1517,12 +1612,12 @@ static const EnumPropertyItem prop_animdata_op_types[] = {
//{OUTLINER_ANIMOP_COPY_DRIVERS, "COPY_DRIVERS", 0, "Copy Drivers", ""},
//{OUTLINER_ANIMOP_PASTE_DRIVERS, "PASTE_DRIVERS", 0, "Paste Drivers", ""},
{OUTLINER_ANIMOP_CLEAR_DRV, "CLEAR_DRIVERS", 0, "Clear Drivers", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_AnimDataOps event;
short updateDeps = 0;
@@ -1612,12 +1707,12 @@ static const EnumPropertyItem prop_constraint_op_types[] = {
{OL_CONSTRAINTOP_ENABLE, "ENABLE", ICON_HIDE_OFF, "Enable", ""},
{OL_CONSTRAINTOP_DISABLE, "DISABLE", ICON_HIDE_ON, "Disable", ""},
{OL_CONSTRAINTOP_DELETE, "DELETE", ICON_X, "Delete", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_constraint_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_PropConstraintOps event;
@@ -1657,12 +1752,12 @@ static const EnumPropertyItem prop_modifier_op_types[] = {
{OL_MODIFIER_OP_TOGVIS, "TOGVIS", ICON_RESTRICT_VIEW_OFF, "Toggle viewport use", ""},
{OL_MODIFIER_OP_TOGREN, "TOGREN", ICON_RESTRICT_RENDER_OFF, "Toggle render use", ""},
{OL_MODIFIER_OP_DELETE, "DELETE", ICON_X, "Delete", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_modifier_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_PropModifierOps event;
@@ -1705,12 +1800,12 @@ static const EnumPropertyItem prop_data_op_types[] = {
{OL_DOP_HIDE, "HIDE", 0, "Hide", ""},
{OL_DOP_UNHIDE, "UNHIDE", 0, "Unhide", ""},
{OL_DOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int outliner_data_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_PropDataOps event;
@@ -1817,7 +1912,7 @@ static int outliner_operator_menu(bContext *C, const char *opname)
return OPERATOR_INTERFACE;
}
-static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soops,
+static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOutliner *soops,
TreeElement *te, const float mval[2])
{
ReportList *reports = CTX_wm_reports(C); // XXX...
@@ -1927,7 +2022,7 @@ static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soop
static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- SpaceOops *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
uiBut *but = UI_context_active_but_get(C);
TreeElement *te;
float fmval[2];
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 9ac96cf4929..18623fc0b5e 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_tree.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include <math.h>
@@ -42,7 +34,7 @@
#include "DNA_collection_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
@@ -92,13 +84,13 @@
/* prototypes */
static TreeElement *outliner_add_collection_recursive(
- SpaceOops *soops, Collection *collection, TreeElement *ten);
+ SpaceOutliner *soops, Collection *collection, TreeElement *ten);
static void outliner_make_object_parent_hierarchy(ListBase *lb);
/* ********************************************************* */
/* Persistent Data */
-static void outliner_storage_cleanup(SpaceOops *soops)
+static void outliner_storage_cleanup(SpaceOutliner *soops)
{
BLI_mempool *ts = soops->treestore;
@@ -159,7 +151,7 @@ static void outliner_storage_cleanup(SpaceOops *soops)
}
}
-static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr)
+static void check_persistent(SpaceOutliner *soops, TreeElement *te, ID *id, short type, short nr)
{
TreeStoreElem *tselem;
@@ -203,7 +195,7 @@ void outliner_free_tree(ListBase *tree)
}
}
-void outliner_cleanup_tree(SpaceOops *soops)
+void outliner_cleanup_tree(SpaceOutliner *soops)
{
outliner_free_tree(&soops->tree);
outliner_storage_cleanup(soops);
@@ -212,8 +204,8 @@ void outliner_cleanup_tree(SpaceOops *soops)
/**
* Free \a element and its sub-tree and remove its link in \a parent_subtree.
*
- * \note Does not remove the TreeStoreElem of \a element!
- * \param parent_subtree: Subtree of the parent element, so the list containing \a element.
+ * \note Does not remove the #TreeStoreElem of \a element!
+ * \param parent_subtree: Sub-tree of the parent element, so the list containing \a element.
*/
void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree)
{
@@ -232,13 +224,13 @@ void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree)
/* ********************************************************* */
/* Prototype, see functions below */
-static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
+static TreeElement *outliner_add_element(SpaceOutliner *soops, ListBase *lb, void *idv,
TreeElement *parent, short type, short index);
/* -------------------------------------------------------- */
/* special handling of hierarchical non-lib data */
-static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curBone,
+static void outliner_add_bone(SpaceOutliner *soops, ListBase *lb, ID *id, Bone *curBone,
TreeElement *parent, int *a)
{
TreeElement *te = outliner_add_element(soops, lb, id, parent, TSE_BONE, *a);
@@ -260,7 +252,7 @@ static bool outliner_animdata_test(AnimData *adt)
}
#ifdef WITH_FREESTYLE
-static void outliner_add_line_styles(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
+static void outliner_add_line_styles(SpaceOutliner *soops, ListBase *lb, Scene *sce, TreeElement *te)
{
ViewLayer *view_layer;
FreestyleLineSet *lineset;
@@ -287,7 +279,7 @@ static void outliner_add_line_styles(SpaceOops *soops, ListBase *lb, Scene *sce,
}
#endif
-static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
+static void outliner_add_scene_contents(SpaceOutliner *soops, ListBase *lb, Scene *sce, TreeElement *te)
{
/* View layers */
TreeElement *ten = outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
@@ -322,7 +314,7 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s
}
// can be inlined if necessary
-static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, Object *ob)
+static void outliner_add_object_contents(SpaceOutliner *soops, TreeElement *te, TreeStoreElem *tselem, Object *ob)
{
if (outliner_animdata_test(ob->adt))
outliner_add_element(soops, &te->subtree, ob, te, TSE_ANIM_DATA, 0);
@@ -487,13 +479,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
}
/* duplicated group */
- if (ob->dup_group)
- outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);
+ if (ob->instance_collection)
+ outliner_add_element(soops, &te->subtree, ob->instance_collection, te, 0, 0);
}
// can be inlined if necessary
-static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, ID *id)
+static void outliner_add_id_contents(SpaceOutliner *soops, TreeElement *te, TreeStoreElem *tselem, ID *id)
{
/* tuck pointer back in object, to construct hierarchy */
if (GS(id->name) == ID_OB) id->newid = (ID *)te;
@@ -592,7 +584,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
}
case ID_LA:
{
- Lamp *la = (Lamp *)id;
+ Light *la = (Light *)id;
if (outliner_animdata_test(la->adt))
outliner_add_element(soops, &te->subtree, la, te, TSE_ANIM_DATA, 0);
@@ -728,7 +720,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
// TODO: this function needs to be split up! It's getting a bit too large...
// Note: "ID" is not always a real ID
-static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
+static TreeElement *outliner_add_element(SpaceOutliner *soops, ListBase *lb, void *idv,
TreeElement *parent, short type, short index)
{
TreeElement *te;
@@ -1128,7 +1120,7 @@ static int need_add_seq_dup(Sequence *seq)
return(1);
}
-static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index)
+static void outliner_add_seq_dup(SpaceOutliner *soops, Sequence *seq, TreeElement *te, short index)
{
/* TreeElement *ch; */ /* UNUSED */
Sequence *p;
@@ -1182,7 +1174,7 @@ static bool outliner_library_id_show(Library *lib, ID *id, short filter_id_type)
return true;
}
-static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOops *soops, ListBase *lb, Library *lib)
+static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOutliner *soops, ListBase *lb, Library *lib)
{
TreeElement *ten, *tenlib = NULL;
ListBase *lbarray[MAX_LIBARRAY];
@@ -1240,7 +1232,7 @@ static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOops *soop
return tenlib;
}
-static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops)
+static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOutliner *soops)
{
TreeElement *ten;
ListBase *lbarray[MAX_LIBARRAY];
@@ -1287,7 +1279,7 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops)
}
static void outliner_add_layer_collection_objects(
- SpaceOops *soops, ListBase *tree, ViewLayer *layer,
+ SpaceOutliner *soops, ListBase *tree, ViewLayer *layer,
LayerCollection *lc, TreeElement *ten)
{
for (CollectionObject *cob = lc->collection->gobject.first; cob; cob = cob->next) {
@@ -1302,7 +1294,7 @@ static void outliner_add_layer_collection_objects(
}
static void outliner_add_layer_collections_recursive(
- SpaceOops *soops, ListBase *tree, ViewLayer *layer,
+ SpaceOutliner *soops, ListBase *tree, ViewLayer *layer,
ListBase *layer_collections, TreeElement *parent_ten,
const bool show_objects)
{
@@ -1321,8 +1313,7 @@ static void outliner_add_layer_collections_recursive(
const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0;
if (exclude ||
- ((layer->runtime_flag & VIEW_LAYER_HAS_HIDE) &&
- !(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS)))
+ ((lc->runtime_flag & LAYER_COLLECTION_VISIBLE) == 0))
{
ten->flag |= TE_DISABLED;
}
@@ -1334,7 +1325,7 @@ static void outliner_add_layer_collections_recursive(
}
}
-static void outliner_add_view_layer(SpaceOops *soops, ListBase *tree, TreeElement *parent,
+static void outliner_add_view_layer(SpaceOutliner *soops, ListBase *tree, TreeElement *parent,
ViewLayer *layer, const bool show_objects)
{
/* First layer collection is for master collection, don't show it. */
@@ -1356,7 +1347,7 @@ BLI_INLINE void outliner_add_collection_init(TreeElement *te, Collection *collec
}
BLI_INLINE void outliner_add_collection_objects(
- SpaceOops *soops, ListBase *tree, Collection *collection, TreeElement *parent)
+ SpaceOutliner *soops, ListBase *tree, Collection *collection, TreeElement *parent)
{
for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
outliner_add_element(soops, tree, cob->ob, parent, 0, 0);
@@ -1364,7 +1355,7 @@ BLI_INLINE void outliner_add_collection_objects(
}
static TreeElement *outliner_add_collection_recursive(
- SpaceOops *soops, Collection *collection, TreeElement *ten)
+ SpaceOutliner *soops, Collection *collection, TreeElement *ten)
{
outliner_add_collection_init(ten, collection);
@@ -1559,7 +1550,7 @@ typedef struct OutlinerTreeElementFocus {
* Bring the outliner scrolling back to where it was in relation to the original focus element
* Caller is expected to handle redrawing of ARegion.
*/
-static void outliner_restore_scrolling_position(SpaceOops *soops, ARegion *ar, OutlinerTreeElementFocus *focus)
+static void outliner_restore_scrolling_position(SpaceOutliner *soops, ARegion *ar, OutlinerTreeElementFocus *focus)
{
View2D *v2d = &ar->v2d;
int ytop;
@@ -1602,7 +1593,7 @@ static bool test_object_callback(TreeElement *te)
* See if TreeElement or any of its children pass the callback_test.
*/
static TreeElement *outliner_find_first_desired_element_at_y_recursive(
- const SpaceOops *soops,
+ const SpaceOutliner *soops,
TreeElement *te,
const float limit,
bool (*callback_test)(TreeElement *))
@@ -1628,14 +1619,14 @@ static TreeElement *outliner_find_first_desired_element_at_y_recursive(
* Find the first element that passes a test starting from a reference vertical coordinate
*
* If the element that is in the position is not what we are looking for, keep looking for its
- * children, siblings, and eventually, aunts, cousins, disntant families, ...
+ * children, siblings, and eventually, aunts, cousins, distant families, ... etc.
*
* Basically we keep going up and down the outliner tree from that point forward, until we find
* what we are looking for. If we are past the visible range and we can't find a valid element
* we return NULL.
*/
static TreeElement *outliner_find_first_desired_element_at_y(
- const SpaceOops *soops,
+ const SpaceOutliner *soops,
const float view_co,
const float view_co_limit)
{
@@ -1691,7 +1682,7 @@ static TreeElement *outliner_find_first_desired_element_at_y(
* Finds the top-most collection visible in the outliner and populates the OutlinerTreeElementFocus
* struct to retrieve this element later to make sure it is in the same original position as before filtering
*/
-static void outliner_store_scrolling_position(SpaceOops *soops, ARegion *ar, OutlinerTreeElementFocus *focus)
+static void outliner_store_scrolling_position(SpaceOutliner *soops, ARegion *ar, OutlinerTreeElementFocus *focus)
{
TreeElement *te;
float limit = ar->v2d.cur.ymin;
@@ -1709,7 +1700,7 @@ static void outliner_store_scrolling_position(SpaceOops *soops, ARegion *ar, Out
}
}
-static int outliner_exclude_filter_get(SpaceOops *soops)
+static int outliner_exclude_filter_get(SpaceOutliner *soops)
{
int exclude_filter = soops->filter & ~SO_FILTER_OB_STATE;
@@ -1852,7 +1843,7 @@ static bool outliner_filter_has_name(TreeElement *te, const char *name, int flag
}
static int outliner_filter_subtree(
- SpaceOops *soops, ViewLayer *view_layer, ListBase *lb, const char *search_string, const int exclude_filter)
+ SpaceOutliner *soops, ViewLayer *view_layer, ListBase *lb, const char *search_string, const int exclude_filter)
{
TreeElement *te, *te_next;
TreeStoreElem *tselem;
@@ -1903,9 +1894,9 @@ static int outliner_filter_subtree(
return (BLI_listbase_is_empty(lb) == false);
}
-static void outliner_filter_tree(SpaceOops *soops, ViewLayer *view_layer)
+static void outliner_filter_tree(SpaceOutliner *soops, ViewLayer *view_layer)
{
- char search_buff[sizeof(((struct SpaceOops *)NULL)->search_string) + 2];
+ char search_buff[sizeof(((struct SpaceOutliner *)NULL)->search_string) + 2];
char *search_string;
const int exclude_filter = outliner_exclude_filter_get(soops);
@@ -1931,11 +1922,12 @@ static void outliner_filter_tree(SpaceOops *soops, ViewLayer *view_layer)
/* Main entry point for building the tree data-structure that the outliner represents */
// TODO: split each mode into its own function?
-void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOops *soops, ARegion *ar)
+void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops, ARegion *ar)
{
TreeElement *te = NULL, *ten;
TreeStoreElem *tselem;
- int show_opened = !soops->treestore || !BLI_mempool_len(soops->treestore); /* on first view, we open scenes */
+ /* on first view, we open scenes */
+ int show_opened = !soops->treestore || !BLI_mempool_len(soops->treestore);
/* 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
@@ -1972,7 +1964,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
tselem->flag &= ~TSE_CLOSED;
}
- for (lib = mainvar->library.first; lib; lib = lib->id.next) {
+ for (lib = mainvar->libraries.first; lib; lib = lib->id.next) {
ten = outliner_add_library_contents(mainvar, soops, &soops->tree, lib);
if (ten) {
lib->id.newid = (ID *)ten;
@@ -2007,13 +1999,13 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
}
}
/* restore newid pointers */
- for (lib = mainvar->library.first; lib; lib = lib->id.next)
+ for (lib = mainvar->libraries.first; lib; lib = lib->id.next)
lib->id.newid = NULL;
}
else if (soops->outlinevis == SO_SCENES) {
Scene *sce;
- for (sce = mainvar->scene.first; sce; sce = sce->id.next) {
+ for (sce = mainvar->scenes.first; sce; sce = sce->id.next) {
te = outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
tselem = TREESTORE(te);
diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c
index 6b7035dd326..3afb4f4d75a 100644
--- a/source/blender/editors/space_outliner/outliner_utils.c
+++ b/source/blender/editors/space_outliner/outliner_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/outliner_utils.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
#include "BLI_utildefines.h"
@@ -44,7 +38,7 @@
* Try to find an item under y-coordinate \a view_co_y (view-space).
* \note Recursive
*/
-TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase *tree, float view_co_y)
+TreeElement *outliner_find_item_at_y(const SpaceOutliner *soops, const ListBase *tree, float view_co_y)
{
for (TreeElement *te_iter = tree->first; te_iter; te_iter = te_iter->next) {
if (view_co_y < (te_iter->ys + UI_UNIT_Y)) {
@@ -71,12 +65,15 @@ TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase *tre
*
* \return a hovered child item or \a parent_te (if no hovered child found).
*/
-TreeElement *outliner_find_item_at_x_in_row(const SpaceOops *soops, const TreeElement *parent_te, float view_co_x)
+TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *soops, const TreeElement *parent_te, float view_co_x)
{
- if (!TSELEM_OPEN(TREESTORE(parent_te), soops)) { /* if parent_te is opened, it doesn't show childs in row */
+ /* if parent_te is opened, it doesn't show childs in row */
+ if (!TSELEM_OPEN(TREESTORE(parent_te), soops)) {
/* no recursion, items can only display their direct children in the row */
for (TreeElement *child_te = parent_te->subtree.first;
- child_te && view_co_x >= child_te->xs; /* don't look further if co_x is smaller than child position*/
+ /* don't look further if co_x is smaller than child position*/
+ child_te && view_co_x >= child_te->xs;
+
child_te = child_te->next)
{
if ((child_te->flag & TE_ICONROW) && (view_co_x > child_te->xs) && (view_co_x < child_te->xend)) {
@@ -119,7 +116,7 @@ TreeElement *outliner_find_parent_element(ListBase *lb, TreeElement *parent_te,
}
/* tse is not in the treestore, we use its contents to find a match */
-TreeElement *outliner_find_tse(SpaceOops *soops, const TreeStoreElem *tse)
+TreeElement *outliner_find_tse(SpaceOutliner *soops, const TreeStoreElem *tse)
{
TreeStoreElem *tselem;
@@ -134,7 +131,7 @@ TreeElement *outliner_find_tse(SpaceOops *soops, const TreeStoreElem *tse)
}
/* Find treestore that refers to given ID */
-TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, const ID *id)
+TreeElement *outliner_find_id(SpaceOutliner *soops, ListBase *lb, const ID *id)
{
for (TreeElement *te = lb->first; te; te = te->next) {
TreeStoreElem *tselem = TREESTORE(te);
@@ -188,7 +185,7 @@ TreeElement *outliner_find_editbone(ListBase *lb, const EditBone *ebone)
return NULL;
}
-ID *outliner_search_back(SpaceOops *UNUSED(soops), TreeElement *te, short idcode)
+ID *outliner_search_back(SpaceOutliner *UNUSED(soops), TreeElement *te, short idcode)
{
TreeStoreElem *tselem;
te = te->parent;
@@ -209,7 +206,7 @@ ID *outliner_search_back(SpaceOops *UNUSED(soops), TreeElement *te, short idcode
* \param filter_tselem_flag: Same as \a filter_te_flag, but for the TreeStoreElem.
* \param func: Custom callback to execute for each visited item.
*/
-bool outliner_tree_traverse(const SpaceOops *soops, ListBase *tree, int filter_te_flag, int filter_tselem_flag,
+bool outliner_tree_traverse(const SpaceOutliner *soops, ListBase *tree, int filter_te_flag, int filter_tselem_flag,
TreeTraversalFunc func, void *customdata)
{
for (TreeElement *te = tree->first, *te_next; te; te = te_next) {
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 423641c6fdd..822f9ec61ac 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_outliner/space_outliner.c
- * \ingroup spoutliner
+/** \file
+ * \ingroup spoutliner
*/
@@ -51,8 +44,6 @@
#include "WM_message.h"
#include "WM_types.h"
-#include "BIF_gl.h"
-
#include "RNA_access.h"
#include "DNA_scene_types.h"
@@ -180,7 +171,7 @@ static void outliner_main_region_listener(
ED_region_tag_redraw(ar);
break;
case NC_LAMP:
- /* For updating lamp icons, when changing lamp type */
+ /* For updating light icons, when changing light type */
if (wmn->data == ND_LIGHTING_DRAW)
ED_region_tag_redraw(ar);
break;
@@ -233,6 +224,11 @@ static void outliner_main_region_listener(
ED_region_tag_redraw(ar);
}
break;
+ case NC_PAINTCURVE:
+ if (ELEM(wmn->action, NA_ADDED)) {
+ ED_region_tag_redraw(ar);
+ }
+ break;
}
}
@@ -243,7 +239,7 @@ static void outliner_main_region_message_subscribe(
struct bScreen *UNUSED(screen), struct ScrArea *sa, struct ARegion *ar,
struct wmMsgBus *mbus)
{
- SpaceOops *soops = sa->spacedata.first;
+ SpaceOutliner *soops = sa->spacedata.first;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = ar,
.user_data = ar,
@@ -295,9 +291,9 @@ static void outliner_header_region_listener(
static SpaceLink *outliner_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
ARegion *ar;
- SpaceOops *soutliner;
+ SpaceOutliner *soutliner;
- soutliner = MEM_callocN(sizeof(SpaceOops), "initoutliner");
+ soutliner = MEM_callocN(sizeof(SpaceOutliner), "initoutliner");
soutliner->spacetype = SPACE_OUTLINER;
soutliner->filter_id_type = ID_GR;
@@ -320,7 +316,7 @@ static SpaceLink *outliner_new(const ScrArea *UNUSED(area), const Scene *UNUSED(
/* not spacelink itself */
static void outliner_free(SpaceLink *sl)
{
- SpaceOops *soutliner = (SpaceOops *)sl;
+ SpaceOutliner *soutliner = (SpaceOutliner *)sl;
outliner_free_tree(&soutliner->tree);
if (soutliner->treestore) {
@@ -339,8 +335,8 @@ static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
static SpaceLink *outliner_duplicate(SpaceLink *sl)
{
- SpaceOops *soutliner = (SpaceOops *)sl;
- SpaceOops *soutlinern = MEM_dupallocN(soutliner);
+ SpaceOutliner *soutliner = (SpaceOutliner *)sl;
+ SpaceOutliner *soutlinern = MEM_dupallocN(soutliner);
BLI_listbase_clear(&soutlinern->tree);
soutlinern->treestore = NULL;
@@ -351,7 +347,7 @@ static SpaceLink *outliner_duplicate(SpaceLink *sl)
static void outliner_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)
{
- SpaceOops *so = (SpaceOops *)slink;
+ SpaceOutliner *so = (SpaceOutliner *)slink;
/* Some early out checks. */
if (!TREESTORE_ID_TYPE(old_id)) {
diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt
index 2eb31576c57..5d950a3558d 100644
--- a/source/blender/editors/space_script/CMakeLists.txt
+++ b/source/blender/editors/space_script/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index ee8dcf0ca9a..4b5cd6b7166 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_script/script_edit.c
- * \ingroup spscript
+/** \file
+ * \ingroup spscript
*/
@@ -33,10 +26,10 @@
#include <stdio.h>
#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
#include "BKE_context.h"
#include "BKE_report.h"
-#include "BKE_global.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -96,13 +89,14 @@ static bool script_test_modal_operators(bContext *C)
wm = CTX_wm_manager(C);
for (win = wm->windows.first; win; win = win->next) {
- wmEventHandler *handler;
-
- for (handler = win->modalhandlers.first; handler; handler = handler->next) {
- if (handler->op) {
- wmOperatorType *ot = handler->op->type;
- if (ot->ext.srna) {
- return true;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_OP) {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+ if (handler->op != NULL) {
+ wmOperatorType *ot = handler->op->type;
+ if (ot->ext.srna) {
+ return true;
+ }
}
}
}
diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h
index 649992fec4f..c6f72784b05 100644
--- a/source/blender/editors/space_script/script_intern.h
+++ b/source/blender/editors/space_script/script_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_script/script_intern.h
- * \ingroup spscript
+/** \file
+ * \ingroup spscript
*/
#ifndef __SCRIPT_INTERN_H__
diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c
index 90eb38db7f7..3f800117346 100644
--- a/source/blender/editors/space_script/script_ops.c
+++ b/source/blender/editors/space_script/script_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_script/script_ops.c
- * \ingroup spscript
+/** \file
+ * \ingroup spscript
*/
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index e3ae8accb67..45d6151e7b2 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_script/space_script.c
- * \ingroup spscript
+/** \file
+ * \ingroup spscript
*/
@@ -43,7 +36,6 @@
#include "ED_space_api.h"
#include "ED_screen.h"
-#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt
index 6b8108a1265..7d76fa1af5c 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index a9ae158d162..b408369dc04 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_add.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#include <stdlib.h>
@@ -45,7 +39,6 @@
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mask.h"
@@ -93,18 +86,26 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
{
PropertyRNA *prop;
- 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_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)
- 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 */
+ if (flag & SEQPROP_ENDFRAME) {
+ /* not usual since most strips have a fixed length */
+ RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX,
+ "End Frame", "End frame for the color strip", INT_MIN, INT_MAX);
+ }
- RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ, "Channel", "Channel to place this strip into", 1, MAXSEQ);
+ RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ,
+ "Channel", "Channel to place this strip into", 1, MAXSEQ);
- RNA_def_boolean(ot->srna, "replace_sel", 1, "Replace Selection", "Replace the current selection");
+ RNA_def_boolean(ot->srna, "replace_sel", 1,
+ "Replace Selection", "Replace the current selection");
/* only for python scripts which import strips and place them after */
- prop = RNA_def_boolean(ot->srna, "overlap", 0, "Allow Overlap", "Don't correct overlap on new sequence strips");
+ prop = RNA_def_boolean(ot->srna, "overlap", 0,
+ "Allow Overlap", "Don't correct overlap on new sequence strips");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
@@ -190,11 +191,13 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato
seq_load->len = 1; // images only, if endframe isn't set!
if ((prop = RNA_struct_find_property(op->ptr, "filepath"))) {
- RNA_property_string_get(op->ptr, prop, seq_load->path); /* full path, file is set by the caller */
+ /* full path, file is set by the caller */
+ RNA_property_string_get(op->ptr, prop, seq_load->path);
is_file = 1;
}
else if ((prop = RNA_struct_find_property(op->ptr, "directory"))) {
- RNA_property_string_get(op->ptr, prop, seq_load->path); /* full path, file is set by the caller */
+ /* full path, file is set by the caller */
+ RNA_property_string_get(op->ptr, prop, seq_load->path);
is_file = 0;
}
@@ -249,7 +252,8 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato
seq_load->views_format = imf->views_format;
seq_load->flag |= SEQ_USE_VIEWS;
- /* operator custom data is always released after the SeqLoadInfo, no need to handle the memory here */
+ /* operator custom data is always released after the SeqLoadInfo,
+ * no need to handle the memory here */
seq_load->stereo3d_format = &imf->stereo3d_format;
}
}
@@ -297,7 +301,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
start_frame = RNA_int_get(op->ptr, "frame_start");
channel = RNA_int_get(op->ptr, "channel");
- sce_seq = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
+ sce_seq = BLI_findlink(&CTX_data_main(C)->scenes, RNA_enum_get(op->ptr, "scene"));
if (sce_seq == NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene not found");
@@ -385,7 +389,7 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
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"));
+ clip = BLI_findlink(&CTX_data_main(C)->movieclips, RNA_enum_get(op->ptr, "clip"));
if (clip == NULL) {
BKE_report(op->reports, RPT_ERROR, "Movie clip not found");
@@ -470,7 +474,7 @@ static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op)
start_frame = RNA_int_get(op->ptr, "frame_start");
channel = RNA_int_get(op->ptr, "channel");
- mask = BLI_findlink(&CTX_data_main(C)->mask, RNA_enum_get(op->ptr, "mask"));
+ mask = BLI_findlink(&CTX_data_main(C)->masks, RNA_enum_get(op->ptr, "mask"));
if (mask == NULL) {
BKE_report(op->reports, RPT_ERROR, "Mask not found");
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index a4bca555490..c1b70a7f14a 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2009 by Blender Foundation
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_buttons.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#include <string.h>
@@ -31,12 +27,13 @@
#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
#include "BLT_translation.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "BKE_screen.h"
#include "ED_screen.h"
@@ -46,6 +43,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
#include "sequencer_intern.h"
@@ -61,11 +60,51 @@ static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNU
}
#endif
-void sequencer_buttons_register(ARegionType *UNUSED(art))
+static bool metadata_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
+{
+ SpaceSeq *space_sequencer = CTX_wm_space_seq(C);
+ if (space_sequencer == NULL) {
+ return false;
+ }
+ return ED_space_sequencer_check_show_imbuf(space_sequencer);
+}
+
+static void metadata_panel_context_draw(const bContext *C, Panel *panel)
+{
+ /* Image buffer can not be acquired during render, similar to
+ * draw_image_seq(). */
+ if (G.is_rendering) {
+ return;
+ }
+ struct Main *bmain = CTX_data_main(C);
+ struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ struct Scene *scene = CTX_data_scene(C);
+ SpaceSeq *space_sequencer = CTX_wm_space_seq(C);
+ /* NOTE: We can only reliably show metadata for the original (current)
+ * frame when split view is used. */
+ const bool show_split = (
+ scene->ed &&
+ (scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) &&
+ (space_sequencer->mainb == SEQ_DRAW_IMG_IMBUF));
+ if (show_split &&
+ space_sequencer->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE)
+ {
+ return;
+ }
+ /* NOTE: We disable multiview for drawing, since we don't know what is the
+ * from the panel (is kind of all the views?). */
+ ImBuf *ibuf = sequencer_ibuf_get(bmain, depsgraph, scene, space_sequencer, scene->r.cfra, 0, "");
+ if (ibuf != NULL) {
+ ED_region_image_metadata_panel_draw(ibuf, panel->layout);
+ IMB_freeImBuf(ibuf);
+ }
+}
+
+void sequencer_buttons_register(ARegionType *art)
{
-#if 0
PanelType *pt;
+#if 0
pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
strcpy(pt->idname, "SEQUENCER_PT_gpencil");
strcpy(pt->label, N_("Grease Pencil"));
@@ -75,6 +114,15 @@ void sequencer_buttons_register(ARegionType *UNUSED(art))
pt->poll = sequencer_grease_pencil_panel_poll;
BLI_addtail(&art->paneltypes, pt);
#endif
+
+ pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel metadata");
+ strcpy(pt->idname, "SEQUENCER_PT_metadata");
+ strcpy(pt->label, N_("Metadata"));
+ strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ pt->poll = metadata_panel_context_poll;
+ pt->draw = metadata_panel_context_draw;
+ pt->flag |= PNL_DEFAULT_CLOSED;
+ BLI_addtail(&art->paneltypes, pt);
}
/* **************** operator to open/close properties view ************* */
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index d91ade75807..31a4b15425c 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_draw.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -48,7 +42,6 @@
#include "BKE_context.h"
#include "BKE_global.h"
-#include "BKE_main.h"
#include "BKE_sequencer.h"
#include "BKE_sound.h"
#include "BKE_scene.h"
@@ -56,7 +49,6 @@
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -257,7 +249,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s
endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
samplestep = (endsample - startsample) * stepsize / (x2 - x1);
- length = min_ii(floor((waveform->length - startsample) / samplestep), length);
+ length = min_ii(floor((waveform->length - startsample) / samplestep - (x1_offset - x1) / stepsize), length);
if (length < 2) {
return;
@@ -285,7 +277,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s
value2 = waveform->data[j * 3 + 1];
}
}
- else {
+ else if (p + 1 < waveform->length) {
/* use simple linear interpolation */
float f = sampleoffset - p;
value1 = (1.0f - f) * value1 + f * waveform->data[p * 3 + 3];
@@ -396,7 +388,9 @@ static float draw_seq_handle_size_get_clamped(Sequence *seq, const float pixelx)
}
/* draw a handle, for each end of a sequence strip */
-static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_clamped, const short direction, unsigned int pos)
+static void draw_seq_handle(
+ View2D *v2d, Sequence *seq, const float handsize_clamped,
+ const short direction, unsigned int pos)
{
float v1[2], v2[2], v3[2], rx1 = 0, rx2 = 0; //for triangles and rect
float x1, x2, y1, y2;
@@ -486,7 +480,10 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla
}
/* draw info text on a sequence strip */
-static void draw_seq_text(View2D *v2d, SpaceSeq *sseq, Sequence *seq, float x1, float x2, float y1, float y2, const unsigned char background_col[3])
+static void draw_seq_text(
+ View2D *v2d, SpaceSeq *sseq, Sequence *seq,
+ float x1, float x2, float y1, float y2,
+ const unsigned char background_col[3])
{
rctf rect;
char str[32 + FILE_MAX];
@@ -648,7 +645,8 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
immUniformColor3ubvAlpha(col, col[3] + 50);
- imm_draw_box_wire_2d(pos, (float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1); /* outline */
+ /* outline */
+ imm_draw_box_wire_2d(pos, (float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1);
}
if (seq->endofs) {
immUniformColor4ubv(col);
@@ -656,7 +654,8 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
immUniformColor3ubvAlpha(col, col[3] + 50);
- imm_draw_box_wire_2d(pos, x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); /* outline */
+ /* outline */
+ imm_draw_box_wire_2d(pos, x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM);
}
if (seq->startofs || seq->endofs) {
@@ -703,7 +702,9 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
* ARegion is currently only used to get the windows width in pixels
* so wave file sample drawing precision is zoom adjusted
*/
-static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx)
+static void draw_seq_strip(
+ const bContext *C, SpaceSeq *sseq, Scene *scene, ARegion *ar, Sequence *seq,
+ int outline_tint, float pixelx)
{
View2D *v2d = &ar->v2d;
float x1, x2, y1, y2;
@@ -991,30 +992,13 @@ static ImBuf *sequencer_make_scope(Scene *scene, ImBuf *ibuf, ImBuf *(*make_scop
return scope;
}
-static void sequencer_display_size(Scene *scene, SpaceSeq *sseq, float r_viewrect[2])
+static void sequencer_display_size(Scene *scene, float r_viewrect[2])
{
- float render_size, proxy_size;
-
- if (sseq->render_size == SEQ_PROXY_RENDER_SIZE_SCENE) {
- render_size = (float)scene->r.size / 100.0f;
- proxy_size = 1.0f;
- }
- else {
- render_size = (float)sseq->render_size / 100.0f;
- proxy_size = render_size;
- }
-
- r_viewrect[0] = (render_size * (float)scene->r.xsch);
- r_viewrect[1] = (render_size * (float)scene->r.ysch);
+ r_viewrect[0] = (float)scene->r.xsch;
+ r_viewrect[1] = (float)scene->r.ysch;
- /* rectx = viewrectx + 0.5f; */ /* UNUSED */
- /* recty = viewrecty + 0.5f; */ /* UNUSED */
-
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- r_viewrect[0] *= scene->r.xasp / scene->r.yasp;
- r_viewrect[0] /= proxy_size;
- r_viewrect[1] /= proxy_size;
- }
+ /* Aspect ratio seems to have no effect on output image*/
+ /* r_viewrect[0] *= scene->r.xasp / scene->r.yasp; */
}
static void sequencer_draw_gpencil(const bContext *C)
@@ -1075,43 +1059,105 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
immUnbindProgram();
}
-/* draws checkerboard background for transparent content */
-static void sequencer_draw_background(
- const SpaceSeq *sseq, View2D *v2d, const float viewrect[2], const bool draw_overlay)
+#if 0
+void sequencer_draw_maskedit(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq)
{
- /* setting up the view */
- UI_view2d_totRect_set(v2d, viewrect[0] + 0.5f, viewrect[1] + 0.5f);
- UI_view2d_curRect_validate(v2d);
- UI_view2d_view_ortho(v2d);
+ /* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not,
+ * for now just disable drawing since the strip frame will likely be offset */
- /* only draw alpha for main buffer */
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- if ((sseq->flag & SEQ_USE_ALPHA) && !draw_overlay) {
- imm_draw_box_checker_2d(v2d->tot.xmin, v2d->tot.ymin, v2d->tot.xmax, v2d->tot.ymax);
+ // if (sc->mode == SC_MODE_MASKEDIT)
+ if (0 && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
+ Mask *mask = BKE_sequencer_mask_get(scene);
+
+ if (mask) {
+ int width, height;
+ float aspx = 1.0f, aspy = 1.0f;
+ // ED_mask_get_size(C, &width, &height);
+
+ //Scene *scene = CTX_data_scene(C);
+ width = (scene->r.size * scene->r.xsch) / 100;
+ height = (scene->r.size * scene->r.ysch) / 100;
+
+ ED_mask_draw_region(mask, ar,
+ 0, 0, 0, /* TODO */
+ width, height,
+ aspx, aspy,
+ false, true,
+ NULL, C);
}
}
}
+#endif
-void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs, bool draw_overlay, bool draw_backdrop)
+static void *sequencer_OCIO_transform_ibuf(const bContext *C, ImBuf *ibuf, bool *glsl_used, int *format, int *type)
{
- struct Main *bmain = CTX_data_main(C);
- struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
- struct ImBuf *ibuf = NULL;
- struct ImBuf *scope = NULL;
- struct View2D *v2d = &ar->v2d;
- /* int rectx, recty; */ /* UNUSED */
- float viewrect[2];
- float col[3];
- GLuint texid;
void *display_buffer;
void *cache_handle = NULL;
- const bool is_imbuf = ED_space_sequencer_check_show_imbuf(sseq);
- int format, type;
- bool glsl_used = false;
- const bool draw_gpencil = ((sseq->flag & SEQ_SHOW_GPENCIL) && sseq->gpd);
- const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
- bool draw_metadata = false;
+ bool force_fallback = false;
+ *glsl_used = false;
+ force_fallback |= (U.image_draw_method != IMAGE_DRAW_METHOD_GLSL);
+ force_fallback |= (ibuf->dither != 0.0f);
+
+ if (force_fallback) {
+ /* Fallback to CPU based color space conversion */
+ *glsl_used = false;
+ *format = GL_RGBA;
+ *type = GL_UNSIGNED_BYTE;
+ display_buffer = NULL;
+ }
+ else if (ibuf->rect_float) {
+ display_buffer = ibuf->rect_float;
+
+ if (ibuf->channels == 4) {
+ *format = GL_RGBA;
+ }
+ else if (ibuf->channels == 3) {
+ *format = GL_RGB;
+ }
+ else {
+ BLI_assert(!"Incompatible number of channels for float buffer in sequencer");
+ *format = GL_RGBA;
+ display_buffer = NULL;
+ }
+
+ *type = GL_FLOAT;
+ if (ibuf->float_colorspace) {
+ *glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->float_colorspace, ibuf->dither, true);
+ }
+ else {
+ *glsl_used = IMB_colormanagement_setup_glsl_draw_ctx(C, ibuf->dither, true);
+ }
+ }
+ else if (ibuf->rect) {
+ display_buffer = ibuf->rect;
+ *format = GL_RGBA;
+ *type = GL_UNSIGNED_BYTE;
+
+ *glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->rect_colorspace, ibuf->dither, false);
+ }
+ else {
+ *format = GL_RGBA;
+ *type = GL_UNSIGNED_BYTE;
+ display_buffer = NULL;
+ }
+
+ /* there's a data to be displayed, but GLSL is not initialized
+ * properly, in this case we fallback to CPU-based display transform
+ */
+ if ((ibuf->rect || ibuf->rect_float) && !*glsl_used) {
+ display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
+ *format = GL_RGBA;
+ *type = GL_UNSIGNED_BYTE;
+ }
+ if (cache_handle)
+ IMB_display_buffer_release(cache_handle);
+
+ return display_buffer;
+}
+
+static void sequencer_stop_running_jobs(const bContext *C, Scene *scene)
+{
if (G.is_rendering == false && (scene->r.seq_prev_type) == OB_RENDER) {
/* stop all running jobs, except screen one. currently previews frustrate Render
* needed to make so sequencer's rendering doesn't conflict with compositor
@@ -1123,104 +1169,56 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
*/
WM_jobs_kill_type(CTX_wm_manager(C), NULL, WM_JOB_TYPE_RENDER_PREVIEW);
}
+}
- if ((!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) && !draw_backdrop) {
- UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
- GPU_clear_color(col[0], col[1], col[2], 0.0);
- GPU_clear(GPU_COLOR_BIT);
- }
-
- /* only initialize the preview if a render is in progress */
- if (G.is_rendering)
- return;
-
- if (sseq->render_size == SEQ_PROXY_RENDER_SIZE_NONE) {
- return;
- }
-
- /* for now we only support Left/Right */
- ibuf = sequencer_ibuf_get(bmain, depsgraph, scene, sseq, cfra, frame_ofs, names[sseq->multiview_eye]);
+static void sequencer_preview_clear(void)
+{
+ float col[3];
- if ((ibuf == NULL) ||
- (ibuf->rect == NULL && ibuf->rect_float == NULL))
- {
- sequencer_display_size(scene, sseq, viewrect);
+ UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
+ GPU_clear_color(col[0], col[1], col[2], 0.0);
+ GPU_clear(GPU_COLOR_BIT);
+}
- sequencer_draw_background(sseq, v2d, viewrect, false);
- sequencer_draw_borders(sseq, v2d, scene);
+static void sequencer_preview_get_rect(
+ rctf *preview, Scene *scene, ARegion *ar, SpaceSeq *sseq,
+ bool draw_overlay, bool draw_backdrop)
+{
+ struct View2D *v2d = &ar->v2d;
+ float viewrect[2];
- /* gpencil can also be drawn without a valid imbuf */
- if ((draw_gpencil && is_imbuf) && !draw_overlay) {
- sequencer_draw_gpencil(C);
- }
+ sequencer_display_size(scene, viewrect);
+ BLI_rctf_init(preview, -1.0f, 1.0f, -1.0f, 1.0f);
- return;
+ if (draw_overlay && sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
+ preview->xmax = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmax);
+ preview->xmin = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmin);
+ preview->ymax = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymax);
+ preview->ymin = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymin);
}
+ else if (draw_backdrop) {
+ float aspect = BLI_rcti_size_x(&ar->winrct) / (float)BLI_rcti_size_y(&ar->winrct);
+ float image_aspect = viewrect[0] / viewrect[1];
- sequencer_display_size(scene, sseq, viewrect);
-
- if (!draw_backdrop && (sseq->mainb != SEQ_DRAW_IMG_IMBUF || sseq->zebra != 0)) {
- SequencerScopes *scopes = &sseq->scopes;
-
- sequencer_check_scopes(scopes, ibuf);
-
- switch (sseq->mainb) {
- case SEQ_DRAW_IMG_IMBUF:
- if (!scopes->zebra_ibuf) {
- ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
-
- if (display_ibuf->rect_float) {
- IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings,
- &scene->display_settings);
- }
- scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
- IMB_freeImBuf(display_ibuf);
- }
- scope = scopes->zebra_ibuf;
- break;
- case SEQ_DRAW_IMG_WAVEFORM:
- if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
- if (!scopes->sep_waveform_ibuf)
- scopes->sep_waveform_ibuf = sequencer_make_scope(scene, ibuf, make_sep_waveform_view_from_ibuf);
- scope = scopes->sep_waveform_ibuf;
- }
- else {
- if (!scopes->waveform_ibuf)
- scopes->waveform_ibuf = sequencer_make_scope(scene, ibuf, make_waveform_view_from_ibuf);
- scope = scopes->waveform_ibuf;
- }
- break;
- case SEQ_DRAW_IMG_VECTORSCOPE:
- if (!scopes->vector_ibuf)
- scopes->vector_ibuf = sequencer_make_scope(scene, ibuf, make_vectorscope_view_from_ibuf);
- scope = scopes->vector_ibuf;
- break;
- case SEQ_DRAW_IMG_HISTOGRAM:
- if (!scopes->histogram_ibuf)
- scopes->histogram_ibuf = sequencer_make_scope(scene, ibuf, make_histogram_view_from_ibuf);
- scope = scopes->histogram_ibuf;
- break;
- }
-
- /* future files may have new scopes we don't catch above */
- if (scope) {
- scopes->reference_ibuf = ibuf;
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- /* scopes drawn in image preview use viewrect from orig ibuf - currently that's only zebra */
- }
- else {
- viewrect[0] = scope->x;
- viewrect[1] = scope->y;
- }
+ if (aspect >= image_aspect) {
+ preview->xmax = image_aspect / aspect;
+ preview->xmin = -preview->xmax;
}
else {
- scopes->reference_ibuf = NULL;
+ preview->ymax = aspect / image_aspect;
+ preview->ymin = -preview->ymax;
}
}
-
- if (!draw_backdrop) {
- sequencer_draw_background(sseq, v2d, viewrect, draw_overlay);
+ else {
+ *preview = v2d->tot;
}
+}
+
+static void sequencer_draw_display_buffer(
+ const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, ImBuf *ibuf, ImBuf *scope,
+ bool draw_overlay, bool draw_backdrop)
+{
+ void *display_buffer;
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
GPU_blend(true);
@@ -1230,12 +1228,14 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
/* Format needs to be created prior to any immBindProgram call.
* Do it here because OCIO binds it's own shader.
*/
+ int format, type;
+ bool glsl_used = false;
+ GLuint texid;
GPUVertFormat *imm_format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(imm_format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
uint texCoord = GPU_vertformat_attr_add(imm_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
if (scope) {
- IMB_freeImBuf(ibuf);
ibuf = scope;
if (ibuf->rect_float && ibuf->rect == NULL) {
@@ -1247,83 +1247,28 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
type = GL_UNSIGNED_BYTE;
}
else {
- bool force_fallback = false;
-
- force_fallback |= (U.image_draw_method != IMAGE_DRAW_METHOD_GLSL);
- force_fallback |= (ibuf->dither != 0.0f);
-
- if (force_fallback) {
- /* Fallback to CPU based color space conversion */
- glsl_used = false;
- format = GL_RGBA;
- type = GL_UNSIGNED_BYTE;
- display_buffer = NULL;
- }
- else if (ibuf->rect_float) {
- display_buffer = ibuf->rect_float;
-
- if (ibuf->channels == 4) {
- format = GL_RGBA;
- }
- else if (ibuf->channels == 3) {
- format = GL_RGB;
- }
- else {
- BLI_assert(!"Incompatible number of channels for float buffer in sequencer");
- format = GL_RGBA;
- display_buffer = NULL;
- }
-
- type = GL_FLOAT;
-
- if (ibuf->float_colorspace) {
- glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->float_colorspace, ibuf->dither, true);
- }
- else {
- glsl_used = IMB_colormanagement_setup_glsl_draw_ctx(C, ibuf->dither, true);
- }
- }
- else if (ibuf->rect) {
- display_buffer = ibuf->rect;
- format = GL_RGBA;
- type = GL_UNSIGNED_BYTE;
-
- glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->rect_colorspace, ibuf->dither, false);
- }
- else {
- format = GL_RGBA;
- type = GL_UNSIGNED_BYTE;
- display_buffer = NULL;
- }
-
- /* there's a data to be displayed, but GLSL is not initialized
- * properly, in this case we fallback to CPU-based display transform
- */
- if ((ibuf->rect || ibuf->rect_float) && !glsl_used) {
- display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
- format = GL_RGBA;
- type = GL_UNSIGNED_BYTE;
- }
+ display_buffer = sequencer_OCIO_transform_ibuf(C, ibuf, &glsl_used, &format, &type);
}
if (draw_backdrop) {
- /* XXX: need to load identity projection too? */
GPU_matrix_push();
GPU_matrix_identity_set();
+ GPU_matrix_push_projection();
+ GPU_matrix_identity_projection_set();
}
glGenTextures(1, (GLuint *)&texid);
-
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texid);
-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- if (type == GL_FLOAT)
+ if (type == GL_FLOAT) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, ibuf->x, ibuf->y, 0, format, type, display_buffer);
- else
+ }
+ else {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, format, type, display_buffer);
+ }
if (!glsl_used) {
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
@@ -1333,153 +1278,176 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
immBegin(GPU_PRIM_TRI_FAN, 4);
- if (draw_overlay) {
- if (sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
- rctf tot_clip;
- tot_clip.xmin = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmin);
- tot_clip.ymin = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymin);
- tot_clip.xmax = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmax);
- tot_clip.ymax = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymax);
-
- immAttr2f(texCoord, scene->ed->over_border.xmin, scene->ed->over_border.ymin);
- immVertex2f(pos, tot_clip.xmin, tot_clip.ymin);
-
- immAttr2f(texCoord, scene->ed->over_border.xmin, scene->ed->over_border.ymax);
- immVertex2f(pos, tot_clip.xmin, tot_clip.ymax);
-
- immAttr2f(texCoord, scene->ed->over_border.xmax, scene->ed->over_border.ymax);
- immVertex2f(pos, tot_clip.xmax, tot_clip.ymax);
-
- immAttr2f(texCoord, scene->ed->over_border.xmax, scene->ed->over_border.ymin);
- immVertex2f(pos, tot_clip.xmax, tot_clip.ymin);
- }
- else if (sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) {
- immAttr2f(texCoord, 0.0f, 0.0f);
- immVertex2f(pos, v2d->tot.xmin, v2d->tot.ymin);
-
- immAttr2f(texCoord, 0.0f, 1.0f);
- immVertex2f(pos, v2d->tot.xmin, v2d->tot.ymax);
-
- immAttr2f(texCoord, 1.0f, 1.0f);
- immVertex2f(pos, v2d->tot.xmax, v2d->tot.ymax);
-
- immAttr2f(texCoord, 1.0f, 0.0f);
- immVertex2f(pos, v2d->tot.xmax, v2d->tot.ymin);
- }
- }
- else if (draw_backdrop) {
- float aspect;
- float image_aspect = viewrect[0] / viewrect[1];
- float imagex, imagey;
-
- aspect = BLI_rcti_size_x(&ar->winrct) / (float)BLI_rcti_size_y(&ar->winrct);
-
- if (aspect >= image_aspect) {
- imagex = image_aspect / aspect;
- imagey = 1.0f;
- }
- else {
- imagex = 1.0f;
- imagey = aspect / image_aspect;
- }
-
- immAttr2f(texCoord, 0.0f, 0.0f);
- immVertex2f(pos, -imagex, -imagey);
-
- immAttr2f(texCoord, 0.0f, 1.0f);
- immVertex2f(pos, -imagex, imagey);
+ rctf preview;
+ rctf canvas;
+ sequencer_preview_get_rect(&preview, scene, ar, sseq, draw_overlay, draw_backdrop);
- immAttr2f(texCoord, 1.0f, 1.0f);
- immVertex2f(pos, imagex, imagey);
-
- immAttr2f(texCoord, 1.0f, 0.0f);
- immVertex2f(pos, imagex, -imagey);
+ if (draw_overlay && sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
+ canvas = scene->ed->over_border;
}
else {
- draw_metadata = ((sseq->flag & SEQ_SHOW_METADATA) != 0);
+ BLI_rctf_init(&canvas, 0.0f, 1.0f, 0.0f, 1.0f);
+ }
- immAttr2f(texCoord, 0.0f, 0.0f);
- immVertex2f(pos, v2d->tot.xmin, v2d->tot.ymin);
+ immAttr2f(texCoord, canvas.xmin, canvas.ymin);
+ immVertex2f(pos, preview.xmin, preview.ymin);
- immAttr2f(texCoord, 0.0f, 1.0f);
- immVertex2f(pos, v2d->tot.xmin, v2d->tot.ymax);
+ immAttr2f(texCoord, canvas.xmin, canvas.ymax);
+ immVertex2f(pos, preview.xmin, preview.ymax);
- immAttr2f(texCoord, 1.0f, 1.0f);
- immVertex2f(pos, v2d->tot.xmax, v2d->tot.ymax);
+ immAttr2f(texCoord, canvas.xmax, canvas.ymax);
+ immVertex2f(pos, preview.xmax, preview.ymax);
- immAttr2f(texCoord, 1.0f, 0.0f);
- immVertex2f(pos, v2d->tot.xmax, v2d->tot.ymin);
- }
+ immAttr2f(texCoord, canvas.xmax, canvas.ymin);
+ immVertex2f(pos, preview.xmax, preview.ymin);
immEnd();
-
glBindTexture(GL_TEXTURE_2D, 0);
+ glDeleteTextures(1, &texid);
if (!glsl_used) {
immUnbindProgram();
}
+ else {
+ IMB_colormanagement_finish_glsl_draw();
+ }
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
GPU_blend(false);
}
- glDeleteTextures(1, &texid);
+ if (draw_backdrop) {
+ GPU_matrix_pop();
+ GPU_matrix_pop_projection();
+ }
+}
- if (glsl_used)
- IMB_colormanagement_finish_glsl_draw();
+static ImBuf *sequencer_get_scope(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, bool draw_backdrop)
+{
+ struct ImBuf *scope = NULL;
+ SequencerScopes *scopes = &sseq->scopes;
- if (cache_handle)
- IMB_display_buffer_release(cache_handle);
+ if (!draw_backdrop && (sseq->mainb != SEQ_DRAW_IMG_IMBUF || sseq->zebra != 0)) {
+ sequencer_check_scopes(scopes, ibuf);
- if (!scope)
- IMB_freeImBuf(ibuf);
- if (draw_metadata) {
- ED_region_image_metadata_draw(0.0, 0.0, ibuf, &v2d->tot, 1.0, 1.0);
+ switch (sseq->mainb) {
+ case SEQ_DRAW_IMG_IMBUF:
+ if (!scopes->zebra_ibuf) {
+ ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
+
+ if (display_ibuf->rect_float) {
+ IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings,
+ &scene->display_settings);
+ }
+ scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
+ IMB_freeImBuf(display_ibuf);
+ }
+ scope = scopes->zebra_ibuf;
+ break;
+ case SEQ_DRAW_IMG_WAVEFORM:
+ if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
+ if (!scopes->sep_waveform_ibuf)
+ scopes->sep_waveform_ibuf = sequencer_make_scope(scene, ibuf, make_sep_waveform_view_from_ibuf);
+ scope = scopes->sep_waveform_ibuf;
+ }
+ else {
+ if (!scopes->waveform_ibuf)
+ scopes->waveform_ibuf = sequencer_make_scope(scene, ibuf, make_waveform_view_from_ibuf);
+ scope = scopes->waveform_ibuf;
+ }
+ break;
+ case SEQ_DRAW_IMG_VECTORSCOPE:
+ if (!scopes->vector_ibuf)
+ scopes->vector_ibuf = sequencer_make_scope(scene, ibuf, make_vectorscope_view_from_ibuf);
+ scope = scopes->vector_ibuf;
+ break;
+ case SEQ_DRAW_IMG_HISTOGRAM:
+ if (!scopes->histogram_ibuf)
+ scopes->histogram_ibuf = sequencer_make_scope(scene, ibuf, make_histogram_view_from_ibuf);
+ scope = scopes->histogram_ibuf;
+ break;
+ }
+
+ /* future files may have new scopes we don't catch above */
+ if (scope) {
+ scopes->reference_ibuf = ibuf;
+ }
}
+ return scope;
+}
- if (draw_backdrop) {
- GPU_matrix_pop();
+void sequencer_draw_preview(
+ const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq,
+ int cfra, int frame_ofs,
+ bool draw_overlay, bool draw_backdrop)
+{
+ struct Main *bmain = CTX_data_main(C);
+ struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ struct View2D *v2d = &ar->v2d;
+ struct ImBuf *ibuf = NULL;
+ struct ImBuf *scope = NULL;
+ float viewrect[2];
+ const bool show_imbuf = ED_space_sequencer_check_show_imbuf(sseq);
+ const bool draw_gpencil = ((sseq->flag & SEQ_SHOW_GPENCIL) && sseq->gpd);
+ const char *names[2] = { STEREO_LEFT_NAME, STEREO_RIGHT_NAME };
+
+ sequencer_stop_running_jobs(C, scene);
+ if (G.is_rendering) {
return;
}
- if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- sequencer_draw_borders(sseq, v2d, scene);
+ if (sseq->render_size == SEQ_PROXY_RENDER_SIZE_NONE) {
+ sequencer_preview_clear();
+ return;
}
- if (draw_gpencil && is_imbuf) {
- sequencer_draw_gpencil(C);
- }
- else {
- /* ortho at pixel level */
- UI_view2d_view_restore(C);
+ /* Setup view */
+ sequencer_display_size(scene, viewrect);
+ UI_view2d_totRect_set(v2d, viewrect[0] + 0.5f, viewrect[1] + 0.5f);
+ UI_view2d_curRect_validate(v2d);
+ UI_view2d_view_ortho(v2d);
+
+ /* Draw background */
+ if (!draw_backdrop && (!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE)) {
+ sequencer_preview_clear();
+
+ if (sseq->flag & SEQ_USE_ALPHA) {
+ imm_draw_box_checker_2d(v2d->tot.xmin, v2d->tot.ymin, v2d->tot.xmax, v2d->tot.ymax);
+ }
}
+ /* Get image */
+ ibuf = sequencer_ibuf_get(bmain, depsgraph, scene, sseq, cfra, frame_ofs, names[sseq->multiview_eye]);
+ if (ibuf) {
+ scope = sequencer_get_scope(scene, sseq, ibuf, draw_backdrop);
- /* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not,
- * for now just disable drawing since the strip frame will likely be offset */
+ /* Draw image */
+ sequencer_draw_display_buffer(C, scene, ar, sseq, ibuf, scope, draw_overlay, draw_backdrop);
- // if (sc->mode == SC_MODE_MASKEDIT)
- if (0 && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
- Mask *mask = BKE_sequencer_mask_get(scene);
+ /* Draw over image */
+ if (sseq->flag & SEQ_SHOW_METADATA) {
+ ED_region_image_metadata_draw(0.0, 0.0, ibuf, &v2d->tot, 1.0, 1.0);
+ }
+ }
- if (mask) {
- int width, height;
- float aspx = 1.0f, aspy = 1.0f;
- // ED_mask_get_size(C, &width, &height);
+ if (show_imbuf) {
+ sequencer_draw_borders(sseq, v2d, scene);
+ }
- //Scene *scene = CTX_data_scene(C);
- width = (scene->r.size * scene->r.xsch) / 100;
- height = (scene->r.size * scene->r.ysch) / 100;
+ if (draw_gpencil && show_imbuf) {
+ sequencer_draw_gpencil(C);
+ }
- ED_mask_draw_region(mask, ar,
- 0, 0, 0, /* TODO */
- width, height,
- aspx, aspy,
- false, true,
- NULL, C);
- }
+ /* TODO */
+ /* sequencer_draw_maskedit(C, scene, ar, sseq); */
+
+ /* Scope is freed in sequencer_check_scopes when ibuf changes and scope image is to be replaced. */
+ if (ibuf) {
+ IMB_freeImBuf(ibuf);
}
+
+ UI_view2d_view_restore(C);
}
#if 0
@@ -1564,7 +1532,8 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
/* loop through twice, first unselected, then selected */
for (j = 0; j < 2; j++) {
Sequence *seq;
- int outline_tint = (j) ? 40 : -40; /* highlighting around strip edges indicating selection */
+ /* highlighting around strip edges indicating selection */
+ int outline_tint = (j) ? -60 : -150;
/* loop through strips, checking for those that are visible */
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
@@ -1584,7 +1553,8 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
sel = SELECT;
}
- /* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */
+ /* draw the last selected last (i.e. 'active' in other parts of Blender),
+ * removes some overlapping error */
if (last_seq)
draw_seq_strip(C, sseq, scene, ar, last_seq, 120, pixelx);
@@ -1701,7 +1671,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* Only draw backdrop in pure sequence view. */
if (sseq->view == SEQ_VIEW_SEQUENCE && sseq->draw_flag & SEQ_DRAW_BACKDROP) {
- draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0, false, true);
+ sequencer_draw_preview(C, scene, ar, sseq, scene->r.cfra, 0, false, true);
UI_view2d_view_ortho(v2d);
}
@@ -1725,7 +1695,11 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* markers */
UI_view2d_view_orthoSpecial(ar, v2d, 1);
- ED_markers_draw(C, DRAW_MARKERS_LINES | DRAW_MARKERS_MARGIN);
+ int marker_draw_flag = DRAW_MARKERS_MARGIN;
+ if (sseq->flag & SEQ_SHOW_MARKER_LINES) {
+ marker_draw_flag |= DRAW_MARKERS_LINES;
+ }
+ ED_markers_draw(C, marker_draw_flag);
/* preview range */
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index b6f8552bd81..3c6e2abee12 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_edit.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -95,7 +89,7 @@ EnumPropertyItem sequencer_prop_effect_types[] = {
{SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
{SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
{SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* mute operator */
@@ -107,13 +101,13 @@ EnumPropertyItem prop_side_types[] = {
{SEQ_SIDE_LEFT, "LEFT", 0, "Left", "" },
{SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""},
{SEQ_SIDE_BOTH, "BOTH", 0, "Both", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_side_lr_types[] = {
{SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""},
{SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
typedef struct TransSeq {
@@ -402,9 +396,11 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
handsize = seq->handsize;
displen = (float)abs(seq->startdisp - seq->enddisp);
- 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 than 28.
- * This is important because otherwise selecting handles happens even when you click in the middle */
+ /* don't even try to grab the handles of small strips */
+ if (displen / pixelx > 16) {
+ /* Set the max value to handle to 1/3 of the total len when its
+ * less than 28. This is important because otherwise selecting
+ * handles happens even when you click in the middle. */
if ((displen / 3) < 30 * pixelx) {
handsize = displen / 3;
@@ -667,7 +663,7 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de
}
-static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
+static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, ListBase *new_seq_list, int cutframe)
{
TransSeq ts;
Sequence *seqn = NULL;
@@ -739,7 +735,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
if (!skip_dup) {
/* Duplicate AFTER the first change */
- seqn = BKE_sequence_dupli_recursive(scene, scene, seq, SEQ_DUPE_ANIM);
+ seqn = BKE_sequence_dupli_recursive(scene, scene, new_seq_list, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
}
if (seqn) {
@@ -788,7 +784,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
return seqn;
}
-static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
+static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, ListBase *new_seq_list, int cutframe)
{
TransSeq ts;
Sequence *seqn = NULL;
@@ -848,7 +844,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
if (!skip_dup) {
/* Duplicate AFTER the first change */
- seqn = BKE_sequence_dupli_recursive(scene, scene, seq, SEQ_DUPE_ANIM);
+ seqn = BKE_sequence_dupli_recursive(scene, scene, new_seq_list, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM);
}
if (seqn) {
@@ -900,7 +896,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
*/
static bool cut_seq_list(Scene *scene, ListBase *slist, int cutframe,
- Sequence * (*cut_seq)(Scene *, Sequence *, int))
+ Sequence * (*cut_seq)(Scene *, Sequence *, ListBase *, int))
{
Sequence *seq, *seq_next_iter;
Sequence *seq_first_new = NULL;
@@ -914,9 +910,8 @@ static bool cut_seq_list(Scene *scene, ListBase *slist, int cutframe,
if (cutframe > seq->startdisp &&
cutframe < seq->enddisp)
{
- Sequence *seqn = cut_seq(scene, seq, cutframe);
+ Sequence *seqn = cut_seq(scene, seq, slist, cutframe);
if (seqn) {
- BLI_addtail(slist, seqn);
if (seq_first_new == NULL) {
seq_first_new = seqn;
}
@@ -2045,7 +2040,7 @@ void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot)
static const EnumPropertyItem prop_cut_types[] = {
{SEQ_CUT_SOFT, "SOFT", 0, "Soft", ""},
{SEQ_CUT_HARD, "HARD", 0, "Hard", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int sequencer_cut_exec(bContext *C, wmOperator *op)
@@ -2089,7 +2084,6 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
SEQP_BEGIN (ed, seq)
{
- BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq);
if (seq->seq1 || seq->seq2 || seq->seq3) {
BKE_sequence_calc(scene, seq);
}
@@ -2391,8 +2385,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* new seq */
se = BKE_sequencer_give_stripelem(seq, cfra);
- seq_new = BKE_sequence_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME);
- BLI_addtail(ed->seqbasep, seq_new);
+ seq_new = BKE_sequence_dupli_recursive(scene, scene, ed->seqbasep, seq, SEQ_DUPE_UNIQUE_NAME);
seq_new->start = start_ofs;
seq_new->type = SEQ_TYPE_IMAGE;
@@ -2404,7 +2397,8 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
strip_new->us = 1;
/* new stripdata (only one element now!) */
- /* Note this assume all elements (images) have the same dimension, since we only copy the name here. */
+ /* Note this assume all elements (images) have the same dimension,
+ * since we only copy the name here. */
se_new = MEM_reallocN(strip_new->stripdata, sizeof(*se_new));
BLI_strncpy(se_new->name, se->name, sizeof(se_new->name));
strip_new->stripdata = se_new;
@@ -2846,7 +2840,7 @@ static const EnumPropertyItem view_type_items[] = {
{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
{SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
{SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -3585,7 +3579,7 @@ void SEQUENCER_OT_enable_proxies(wmOperatorType *ot)
/* identifiers */
ot->name = "Set Selected Strip Proxies";
ot->idname = "SEQUENCER_OT_enable_proxies";
- ot->description = "Enable selected proxies on all selected Movie strips";
+ ot->description = "Enable selected proxies on all selected Movie, Image and Meta strips";
/* api callbacks */
ot->invoke = sequencer_enable_proxies_invoke;
@@ -3607,7 +3601,7 @@ static const EnumPropertyItem prop_change_effect_input_types[] = {
{0, "A_B", 0, "A -> B", ""},
{1, "B_C", 0, "B -> C", ""},
{2, "A_C", 0, "A -> C", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 0d647c883be..ad3ac79171c 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_intern.h
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#ifndef __SEQUENCER_INTERN_H__
@@ -36,18 +29,18 @@
/* internal exports only */
+struct ARegion;
+struct ARegionType;
struct Depsgraph;
+struct Main;
+struct Scene;
+struct ScrArea;
struct Sequence;
+struct SpaceSeq;
+struct StripElem;
struct bContext;
struct rctf;
-struct SpaceSeq;
-struct ScrArea;
-struct ARegion;
-struct ARegionType;
-struct Scene;
-struct Main;
struct wmOperator;
-struct StripElem;
/* space_sequencer.c */
struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa);
@@ -55,7 +48,7 @@ struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa);
/* sequencer_draw.c */
void draw_timeline_seq(const struct bContext *C, struct ARegion *ar);
-void draw_image_seq(const struct bContext *C, struct Scene *scene, struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset, bool draw_overlay, bool draw_backdrop);
+void sequencer_draw_preview(const struct bContext *C, struct Scene *scene, struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset, bool draw_overlay, bool draw_backdrop);
void color3ubv_from_seq(struct Scene *curscene, struct Sequence *seq, unsigned char col[3]);
void sequencer_special_update_set(Sequence *seq);
@@ -87,8 +80,8 @@ extern EnumPropertyItem sequencer_prop_effect_types[];
extern EnumPropertyItem prop_side_types[];
/* operators */
-struct wmOperatorType;
struct wmKeyConfig;
+struct wmOperatorType;
void SEQUENCER_OT_cut(struct wmOperatorType *ot);
void SEQUENCER_OT_slip(struct wmOperatorType *ot);
@@ -163,18 +156,18 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot);
enum {
SEQ_CUT_SOFT,
- SEQ_CUT_HARD
+ SEQ_CUT_HARD,
};
enum {
SEQ_SELECTED,
- SEQ_UNSELECTED
+ SEQ_UNSELECTED,
};
enum {
SEQ_SELECT_LR_NONE = 0,
SEQ_SELECT_LR_MOUSE,
SEQ_SELECT_LR_LEFT,
- SEQ_SELECT_LR_RIGHT
+ SEQ_SELECT_LR_RIGHT,
};
/* defines used internally */
diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c
index 1b2357ef6a5..c3df5a0c5ee 100644
--- a/source/blender/editors/space_sequencer/sequencer_modifier.c
+++ b/source/blender/editors/space_sequencer/sequencer_modifier.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_modifier.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -146,7 +139,7 @@ void SEQUENCER_OT_strip_modifier_remove(wmOperatorType *ot)
enum {
SEQ_MODIFIER_MOVE_UP = 0,
- SEQ_MODIFIER_MOVE_DOWN
+ SEQ_MODIFIER_MOVE_DOWN,
};
static int strip_modifier_move_exec(bContext *C, wmOperator *op)
@@ -188,7 +181,7 @@ void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{SEQ_MODIFIER_MOVE_UP, "UP", 0, "Up", "Move modifier up in the stack"},
{SEQ_MODIFIER_MOVE_DOWN, "DOWN", 0, "Down", "Move modifier down in the stack"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -262,7 +255,8 @@ void SEQUENCER_OT_strip_modifier_copy(wmOperatorType *ot)
"Replace modifiers in destination"},
{SEQ_MODIFIER_COPY_APPEND, "APPEND", 0, "Append",
"Append active modifiers to selected strips"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Copy to Selected Strips";
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index cdba163f574..9a619dd0d9b 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_ops.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#include <stdlib.h>
diff --git a/source/blender/editors/space_sequencer/sequencer_preview.c b/source/blender/editors/space_sequencer/sequencer_preview.c
index ae011e48538..640d61a503b 100644
--- a/source/blender/editors/space_sequencer/sequencer_preview.c
+++ b/source/blender/editors/space_sequencer/sequencer_preview.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009, Antony Riakiotakis
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_preview.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#include "DNA_sequence_types.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c
index 00811d68251..f93eaa5bce5 100644
--- a/source/blender/editors/space_sequencer/sequencer_scopes.c
+++ b/source/blender/editors/space_sequencer/sequencer_scopes.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,13 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author: Peter Schlaile < peter [at] schlaile [dot] de >
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/editors/space_sequencer/sequencer_scopes.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -503,7 +498,7 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf)
memset(bins, 0, sizeof(bins));
- MakeHistogramViewData data = {.ibuf = ibuf, .bins = bins};
+ MakeHistogramViewData data = { .ibuf = ibuf, .bins = bins, };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (ibuf->y >= 256);
@@ -588,7 +583,7 @@ static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf)
memset(bins, 0, sizeof(bins));
- MakeHistogramViewData data = {.ibuf = ibuf, .bins = bins};
+ MakeHistogramViewData data = { .ibuf = ibuf, .bins = bins, };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (ibuf->y >= 256);
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 433f1ca8ee5..b87e0b185a4 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2003-2009, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_select.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -351,7 +345,8 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
marker->flag |= SELECT;
}
else {
- /* deselect_markers(0, 0); */ /* XXX, in 2.4x, seq selection used to deselect all, need to re-thnik this for 2.5 */
+ /* XXX, in 2.4x, seq selection used to deselect all, need to re-thnik this for 2.5 */
+ /* deselect_markers(0, 0); */
marker->flag |= SELECT;
}
@@ -554,7 +549,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
{SEQ_SELECT_LR_MOUSE, "MOUSE", 0, "Mouse", "Use mouse position for selection"},
{SEQ_SELECT_LR_LEFT, "LEFT", 0, "Left", "Select left"},
{SEQ_SELECT_LR_RIGHT, "RIGHT", 0, "Right", "Select right"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -886,29 +881,27 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, false);
- View2D *v2d = UI_view2d_fromcontext(C);
+ if (ed == NULL) {
+ return OPERATOR_CANCELLED;
+ }
- Sequence *seq;
- rctf rectf, rq;
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
+ View2D *v2d = UI_view2d_fromcontext(C);
- if (ed == NULL)
- return OPERATOR_CANCELLED;
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_sequencer_deselect_all(scene);
+ }
+ rctf rectf;
WM_operator_properties_border_to_rctf(op, &rectf);
UI_view2d_region_to_view_rctf(v2d, &rectf, &rectf);
- for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+ for (Sequence *seq = ed->seqbasep->first; seq; seq = seq->next) {
+ rctf rq;
seq_rectf(seq, &rq);
-
if (BLI_rctf_isect(&rq, &rectf, NULL)) {
- if (select) seq->flag |= SELECT;
- else seq->flag &= ~SEQ_ALLSEL;
- recurs_sel_seq(seq);
- }
- else if (!extend) {
- seq->flag &= ~SEQ_ALLSEL;
+ SET_FLAG_FROM_TEST(seq->flag, select, SELECT);
recurs_sel_seq(seq);
}
}
@@ -938,8 +931,9 @@ void SEQUENCER_OT_select_box(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- /* rna */
- WM_operator_properties_gesture_box_select(ot);
+ /* properties */
+ WM_operator_properties_gesture_box(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/* ****** Selected Grouped ****** */
@@ -964,7 +958,7 @@ static const EnumPropertyItem sequencer_prop_select_grouped_types[] = {
{SEQ_SELECT_GROUP_EFFECT_LINK, "EFFECT_LINK", 0, "Effect/Linked",
"Other strips affected by the active one (sharing some time, and below or effect-assigned)"},
{SEQ_SELECT_GROUP_OVERLAP, "OVERLAP", 0, "Overlap", "Overlapping time"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#define SEQ_IS_SOUND(_seq) ((_seq->type & SEQ_TYPE_SOUND_RAM) && !(_seq->type & SEQ_TYPE_EFFECT))
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index fb4ef3e51ab..d500a9a081d 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,11 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/sequencer_view.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 3444ad7823e..dec70c4bf43 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_sequencer/space_sequencer.c
- * \ingroup spseq
+/** \file
+ * \ingroup spseq
*/
@@ -123,7 +116,7 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(sa), const Scene *scene)
sseq->chanshown = 0;
sseq->view = SEQ_VIEW_SEQUENCE;
sseq->mainb = SEQ_DRAW_IMG_IMBUF;
- sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA;
+ sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKER_LINES;
/* header */
ar = MEM_callocN(sizeof(ARegion), "header for sequencer");
@@ -439,6 +432,7 @@ static void sequencer_dropboxes(void)
/* ************* end drop *********** */
/* DO NOT make this static, this hides the symbol and breaks API generation script. */
+extern const char *sequencer_context_dir[]; /* quiet warning. */
const char *sequencer_context_dir[] = {"edit_mask", NULL};
static int sequencer_context(const bContext *C, const char *member, bContextDataResult *result)
@@ -636,7 +630,7 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *ar)
if (sseq->mainb == SEQ_DRAW_SEQUENCE) sseq->mainb = SEQ_DRAW_IMG_IMBUF;
if (!show_split || sseq->overlay_type != SEQ_DRAW_OVERLAY_REFERENCE)
- draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0, false, false);
+ sequencer_draw_preview(C, scene, ar, sseq, scene->r.cfra, 0, false, false);
if (show_split && sseq->overlay_type != SEQ_DRAW_OVERLAY_CURRENT) {
int over_cfra;
@@ -647,7 +641,7 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *ar)
over_cfra = scene->r.cfra + scene->ed->over_ofs;
if (over_cfra != scene->r.cfra || sseq->overlay_type != SEQ_DRAW_OVERLAY_RECT)
- draw_image_seq(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra, true, false);
+ sequencer_draw_preview(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra, true, false);
}
if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
diff --git a/source/blender/editors/space_statusbar/CMakeLists.txt b/source/blender/editors/space_statusbar/CMakeLists.txt
index 31439942397..8440d410c31 100644
--- a/source/blender/editors/space_statusbar/CMakeLists.txt
+++ b/source/blender/editors/space_statusbar/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c
index 35eb6c69585..e85d438e80d 100644
--- a/source/blender/editors/space_statusbar/space_statusbar.c
+++ b/source/blender/editors/space_statusbar/space_statusbar.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_statusbar/space_statusbar.c
- * \ingroup spstatusbar
+/** \file
+ * \ingroup spstatusbar
*/
diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt
index 91420a5d63a..378f2e5d84f 100644
--- a/source/blender/editors/space_text/CMakeLists.txt
+++ b/source/blender/editors/space_text/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 8e04cd83fc5..cd5b3facfe9 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/space_text.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
@@ -45,7 +38,6 @@
#include "ED_space_api.h"
#include "ED_screen.h"
-#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index 4f6a3bc82ba..65fb91893f3 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_autocomplete.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <ctype.h>
@@ -194,7 +190,8 @@ static GHash *text_autocomplete_build(Text *text)
str_sub[choice_len] = '\0';
if (!BLI_ghash_lookup(gh, str_sub)) {
char *str_dup = BLI_strdupn(str_sub, choice_len);
- BLI_ghash_insert(gh, str_dup, str_dup); /* A 'set' would make more sense here */
+ /* A 'set' would make more sense here */
+ BLI_ghash_insert(gh, str_dup, str_dup);
}
str_sub[choice_len] = str_sub_last;
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 765bfbd9b83..87bbefdd365 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,16 +14,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_draw.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include "MEM_guardedalloc.h"
@@ -46,8 +38,6 @@
#include "ED_text.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_state.h"
@@ -185,7 +175,6 @@ static void format_draw_color(const TextDrawContext *tdc, char formatchar)
* draw_end = pos+1
* pos += 1
* print line[draw_start:]
- *
*/
int wrap_width(const SpaceText *st, ARegion *ar)
@@ -562,13 +551,21 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
nlines = drawcache->nlines;
/* check if full cache update is needed */
- full_update |= drawcache->winx != ar->winx; /* area was resized */
- full_update |= drawcache->wordwrap != st->wordwrap; /* word-wrapping option was toggled */
- full_update |= drawcache->showlinenrs != st->showlinenrs; /* word-wrapping option was toggled */
- full_update |= drawcache->tabnumber != st->tabnumber; /* word-wrapping option was toggled */
- full_update |= drawcache->lheight != st->lheight_dpi; /* word-wrapping option was toggled */
- full_update |= drawcache->cwidth != st->cwidth; /* word-wrapping option was toggled */
- full_update |= !STREQLEN(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */
+
+ /* area was resized */
+ full_update |= drawcache->winx != ar->winx;
+ /* word-wrapping option was toggled */
+ full_update |= drawcache->wordwrap != st->wordwrap;
+ /* word-wrapping option was toggled */
+ full_update |= drawcache->showlinenrs != st->showlinenrs;
+ /* word-wrapping option was toggled */
+ full_update |= drawcache->tabnumber != st->tabnumber;
+ /* word-wrapping option was toggled */
+ full_update |= drawcache->lheight != st->lheight_dpi;
+ /* word-wrapping option was toggled */
+ full_update |= drawcache->cwidth != st->cwidth;
+ /* text datablock was changed */
+ full_update |= !STREQLEN(drawcache->text_id, txt->id.name, MAX_ID_NAME);
if (st->wordwrap) {
/* update line heights */
@@ -815,7 +812,8 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
scroll->ymin = pix_top_margin;
scroll->ymax = pix_available;
- /* when re-sizing a view-port with the bar at the bottom to a greater height more blank lines will be added */
+ /* 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) {
blank_lines = st->top + st->viewlines - ltexth;
}
diff --git a/source/blender/editors/space_text/text_format.c b/source/blender/editors/space_text/text_format.c
index 7a36b4f3e9c..0f5dfed080c 100644
--- a/source/blender/editors/space_text/text_format.c
+++ b/source/blender/editors/space_text/text_format.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,16 +14,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_format.h b/source/blender/editors/space_text/text_format.h
index 5912dc2402c..9fac0a34d77 100644
--- a/source/blender/editors/space_text/text_format.h
+++ b/source/blender/editors/space_text/text_format.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format.h
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#ifndef __TEXT_FORMAT_H__
@@ -83,16 +76,26 @@ typedef struct TextFormatType {
} TextFormatType;
enum {
- FMT_TYPE_WHITESPACE = '_', /* Whitespace */
- FMT_TYPE_COMMENT = '#', /* Comment text */
- FMT_TYPE_SYMBOL = '!', /* Punctuation and other symbols */
- FMT_TYPE_NUMERAL = 'n', /* Numerals */
- FMT_TYPE_STRING = 'l', /* String letters */
- FMT_TYPE_DIRECTIVE = 'd', /* Decorator / Preprocessor directive */
- FMT_TYPE_SPECIAL = 'v', /* Special variables (class, def) */
- FMT_TYPE_RESERVED = 'r', /* Reserved keywords currently not in use, but still prohibited (OSL -> switch e.g.) */
- FMT_TYPE_KEYWORD = 'b', /* Built-in names (return, for, etc.) */
- FMT_TYPE_DEFAULT = 'q', /* Regular text (identifiers, etc.) */
+ /** Whitespace */
+ FMT_TYPE_WHITESPACE = '_',
+ /** Comment text */
+ FMT_TYPE_COMMENT = '#',
+ /** Punctuation and other symbols */
+ FMT_TYPE_SYMBOL = '!',
+ /** Numerals */
+ FMT_TYPE_NUMERAL = 'n',
+ /** String letters */
+ FMT_TYPE_STRING = 'l',
+ /** Decorator / Preprocessor directive */
+ FMT_TYPE_DIRECTIVE = 'd',
+ /** Special variables (class, def) */
+ FMT_TYPE_SPECIAL = 'v',
+ /** Reserved keywords currently not in use, but still prohibited (OSL -> switch e.g.) */
+ FMT_TYPE_RESERVED = 'r',
+ /** Built-in names (return, for, etc.) */
+ FMT_TYPE_KEYWORD = 'b',
+ /** Regular text (identifiers, etc.) */
+ FMT_TYPE_DEFAULT = 'q',
};
TextFormatType *ED_text_format_get(Text *text);
diff --git a/source/blender/editors/space_text/text_format_lua.c b/source/blender/editors/space_text/text_format_lua.c
index 2a92f9a4d7d..7118b8b748a 100644
--- a/source/blender/editors/space_text/text_format_lua.c
+++ b/source/blender/editors/space_text/text_format_lua.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -13,12 +11,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format_lua.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c
index 2b2dfef72d3..08cae0d978d 100644
--- a/source/blender/editors/space_text/text_format_osl.c
+++ b/source/blender/editors/space_text/text_format_osl.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -13,12 +11,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format_osl.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_format_pov.c b/source/blender/editors/space_text/text_format_pov.c
index f6b6d4f8d42..da10c8626b5 100644
--- a/source/blender/editors/space_text/text_format_pov.c
+++ b/source/blender/editors/space_text/text_format_pov.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -13,12 +11,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format_pov.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_format_pov_ini.c b/source/blender/editors/space_text/text_format_pov_ini.c
index ae7d784dffc..e41fd94ef49 100644
--- a/source/blender/editors/space_text/text_format_pov_ini.c
+++ b/source/blender/editors/space_text/text_format_pov_ini.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -13,12 +11,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format_pov_ini.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c
index 50bad9c07cf..d7dc9d625f5 100644
--- a/source/blender/editors/space_text/text_format_py.c
+++ b/source/blender/editors/space_text/text_format_py.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -13,12 +11,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_format_py.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 896b5444a85..e76fab28327 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_header.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include "DNA_windowmanager_types.h"
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 02948d35623..bf31469c322 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_intern.h
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#ifndef __TEXT_INTERN_H__
@@ -34,11 +27,11 @@
/* internal exports only */
struct ARegion;
-struct bContext;
struct ScrArea;
struct SpaceText;
struct Text;
struct TextLine;
+struct bContext;
struct wmOperatorType;
/* text_draw.c */
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index d1dd2f4affd..2bf1dff63c1 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_ops.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
@@ -44,7 +36,6 @@
#include "PIL_time.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
@@ -93,7 +84,7 @@ static bool text_edit_poll(bContext *C)
return 0;
if (ID_IS_LINKED(text)) {
- // BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
+ // BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
return 0;
}
@@ -109,7 +100,7 @@ bool text_space_edit_poll(bContext *C)
return 0;
if (ID_IS_LINKED(text)) {
- // BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
+ // BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
return 0;
}
@@ -129,7 +120,7 @@ static bool text_region_edit_poll(bContext *C)
return 0;
if (ID_IS_LINKED(text)) {
- // BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
+ // BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
return 0;
}
@@ -195,7 +186,7 @@ static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
void TEXT_OT_new(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Create Text Block";
+ ot->name = "New Text";
ot->idname = "TEXT_OT_new";
ot->description = "Create a new text data-block";
@@ -289,7 +280,7 @@ static int text_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
void TEXT_OT_open(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Open Text Block";
+ ot->name = "Open Text";
ot->idname = "TEXT_OT_open";
ot->description = "Open a new text data-block";
@@ -387,7 +378,7 @@ static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- BKE_libblock_delete(bmain, text);
+ BKE_id_delete(bmain, text);
text_drawcache_tag_update(st, 1);
WM_event_add_notifier(C, NC_TEXT | NA_REMOVED, NULL);
@@ -623,7 +614,7 @@ static int text_run_script(bContext *C, ReportList *reports)
}
}
- BKE_report(reports, RPT_ERROR, "Python script fail, look in the console for now...");
+ BKE_report(reports, RPT_ERROR, "Python script failed, check the message in the system console");
return OPERATOR_FINISHED;
}
@@ -674,7 +665,7 @@ 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)->objects.first; ob; ob = ob->id.next) {
update = 0;
if (ob->type == OB_ARMATURE && ob->pose) {
bPoseChannel *pchan;
@@ -1092,7 +1083,8 @@ enum { TO_SPACES, TO_TABS };
static const EnumPropertyItem whitespace_type_items[] = {
{TO_SPACES, "SPACES", 0, "To Spaces", NULL},
{TO_TABS, "TABS", 0, "To Tabs", NULL},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
{
@@ -1188,7 +1180,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
if (tmp->format)
MEM_freeN(tmp->format);
- /* Put new_line in the tmp->line spot still need to try and set the curc correctly. */
+ /* Put new_line in the tmp->line spot
+ * still need to try and set the curc correctly. */
tmp->line = BLI_strdup(tmp_line);
tmp->len = strlen(tmp_line);
tmp->format = NULL;
@@ -1331,7 +1324,7 @@ void TEXT_OT_move_lines(wmOperatorType *ot)
static const EnumPropertyItem direction_items[] = {
{TXT_MOVE_LINE_UP, "UP", 0, "Up", ""},
{TXT_MOVE_LINE_DOWN, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1365,7 +1358,8 @@ static const EnumPropertyItem move_type_items[] = {
{NEXT_LINE, "NEXT_LINE", 0, "Next Line", ""},
{PREV_PAGE, "PREVIOUS_PAGE", 0, "Previous Page", ""},
{NEXT_PAGE, "NEXT_PAGE", 0, "Next Page", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
/* get cursor position in line by relative wrapped line and column positions */
static int text_get_cursor_rel(SpaceText *st, ARegion *ar, TextLine *linein, int rell, int relc)
@@ -1979,7 +1973,8 @@ static const EnumPropertyItem delete_type_items[] = {
{DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
{DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
{DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
static int text_delete_exec(bContext *C, wmOperator *op)
{
@@ -2129,7 +2124,7 @@ static void txt_screen_skip(SpaceText *st, ARegion *ar, int lines)
enum {
SCROLLHANDLE_BAR,
SCROLLHANDLE_MIN_OUTSIDE,
- SCROLLHANDLE_MAX_OUTSIDE
+ SCROLLHANDLE_MAX_OUTSIDE,
};
typedef struct TextScroll {
@@ -2144,7 +2139,8 @@ typedef struct TextScroll {
static bool text_scroll_poll(bContext *C)
{
- /* it should be possible to still scroll linked texts to read them, even if they can't be edited... */
+ /* it should be possible to still scroll linked texts to read them,
+ * even if they can't be edited... */
return CTX_data_edit_text(C) != NULL;
}
@@ -2470,7 +2466,8 @@ static TextLine *get_line_pos_wrapped(SpaceText *st, ARegion *ar, int *y)
lines = text_get_visible_lines(st, ar, linep->line);
if (i + lines > *y) {
- /* We found the line matching given vertical 'coordinate', now set y relative to this line's start. */
+ /* We found the line matching given vertical 'coordinate',
+ * now set y relative to this line's start. */
*y -= i;
break;
}
@@ -2530,7 +2527,8 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
end = MIN2(end, i);
if (found) {
- /* exact cursor position was found, check if it's still on needed line (hasn't been wrapped) */
+ /* exact cursor position was found, check if it's still on needed line
+ * (hasn't been wrapped) */
if (charp > endj && !chop && ch != '\0')
charp = endj;
break;
@@ -3043,7 +3041,7 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
if (text->id.next)
text = st->text = text->id.next;
else
- text = st->text = bmain->text.first;
+ text = st->text = bmain->texts.first;
txt_move_toline(text, 0, 0);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
@@ -3162,7 +3160,7 @@ static const EnumPropertyItem resolution_items[] = {
{RESOLVE_RELOAD, "RELOAD", 0, "Reload", ""},
{RESOLVE_SAVE, "SAVE", 0, "Save", ""},
{RESOLVE_MAKE_INTERNAL, "MAKE_INTERNAL", 0, "Make Internal", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int text_resolve_conflict_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c
index b8ae9972eec..76da0531225 100644
--- a/source/blender/editors/space_text/text_undo.c
+++ b/source/blender/editors/space_text/text_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_text/text_undo.c
- * \ingroup sptext
+/** \file
+ * \ingroup sptext
*/
#include <string.h>
@@ -29,7 +25,6 @@
#include "DNA_text_types.h"
-#include "BLI_listbase.h"
#include "BLI_array_utils.h"
#include "BLT_translation.h"
@@ -70,16 +65,11 @@ typedef struct TextUndoStep {
TextUndoBuf data;
} TextUndoStep;
-static bool text_undosys_poll(bContext *C)
+static bool text_undosys_poll(bContext *UNUSED(C))
{
- Text *text = CTX_data_edit_text(C);
- if (text == NULL) {
- return false;
- }
- if (ID_IS_LINKED(text)) {
- return false;
- }
- return true;
+ /* Only use when operators initialized. */
+ UndoStack *ustack = ED_undo_stack_get();
+ return (ustack->step_init && (ustack->step_init->type == BKE_UNDOSYS_TYPE_TEXT));
}
static void text_undosys_step_encode_init(struct bContext *C, UndoStep *us_p)
@@ -95,7 +85,7 @@ static void text_undosys_step_encode_init(struct bContext *C, UndoStep *us_p)
us->data.pos = -1;
}
-static bool text_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool text_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p)
{
TextUndoStep *us = (TextUndoStep *)us_p;
@@ -106,6 +96,8 @@ static bool text_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return false;
}
+ us_p->is_applied = true;
+
us->text_ref.ptr = text;
us->step.data_size = us->data.len;
@@ -113,24 +105,83 @@ static bool text_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void text_undosys_step_decode(struct bContext *C, UndoStep *us_p, int dir)
+
+static void text_undosys_step_decode_undo_impl(Text *text, TextUndoStep *us)
+{
+ BLI_assert(us->step.is_applied == true);
+ TextUndoBuf data = us->data;
+ while (data.pos > -1) {
+ txt_do_undo(text, &data);
+ }
+ BLI_assert(data.pos == -1);
+ us->step.is_applied = false;
+}
+
+static void text_undosys_step_decode_redo_impl(Text *text, TextUndoStep *us)
+{
+ BLI_assert(us->step.is_applied == false);
+ TextUndoBuf data = us->data;
+ data.pos = -1;
+ while (data.pos < us->data.pos) {
+ txt_do_redo(text, &data);
+ }
+ BLI_assert(data.pos == us->data.pos);
+ us->step.is_applied = true;
+}
+
+static void text_undosys_step_decode_undo(Text *text, TextUndoStep *us)
+{
+ TextUndoStep *us_iter = us;
+ while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) {
+ if (us_iter->step.next->is_applied == false) {
+ break;
+ }
+ us_iter = (TextUndoStep *)us_iter->step.next;
+ }
+ while (us_iter != us) {
+ text_undosys_step_decode_undo_impl(text, us_iter);
+ us_iter = (TextUndoStep *)us_iter->step.prev;
+ }
+}
+
+static void text_undosys_step_decode_redo(Text *text, TextUndoStep *us)
+{
+ TextUndoStep *us_iter = us;
+ while (us_iter->step.prev && (us_iter->step.prev->type == us_iter->step.type)) {
+ if (us_iter->step.prev->is_applied == true) {
+ break;
+ }
+ us_iter = (TextUndoStep *)us_iter->step.prev;
+ }
+ while (us_iter && (us_iter->step.is_applied == false)) {
+ text_undosys_step_decode_redo_impl(text, us_iter);
+ if (us_iter == us) {
+ break;
+ }
+ us_iter = (TextUndoStep *)us_iter->step.next;
+ }
+}
+
+static void text_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int dir)
{
TextUndoStep *us = (TextUndoStep *)us_p;
Text *text = us->text_ref.ptr;
if (dir < 0) {
- TextUndoBuf data = us->data;
- txt_do_undo(text, &data);
+ text_undosys_step_decode_undo(text, us);
}
else {
- TextUndoBuf data = us->data;
- data.pos = -1;
- txt_do_redo(text, &data);
+ text_undosys_step_decode_redo(text, us);
}
+ SpaceText *st = CTX_wm_space_text(C);
+ if (st) {
+ /* Not essential, always show text being undo where possible. */
+ st->text = text;
+ }
text_update_edited(text);
text_update_cursor_moved(C);
- text_drawcache_tag_update(CTX_wm_space_text(C), 1);
+ text_drawcache_tag_update(st, 1);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
}
@@ -160,7 +211,6 @@ void ED_text_undosys_type(UndoType *ut)
ut->step_foreach_ID_ref = text_undosys_foreach_ID_ref;
- ut->mode = BKE_UNDOTYPE_MODE_ACCUMULATE;
ut->use_context = false;
ut->step_size = sizeof(TextUndoStep);
diff --git a/source/blender/editors/space_topbar/CMakeLists.txt b/source/blender/editors/space_topbar/CMakeLists.txt
index 9559c28de0a..418a0eb3ad8 100644
--- a/source/blender/editors/space_topbar/CMakeLists.txt
+++ b/source/blender/editors/space_topbar/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c
index 567a733309c..e31f29cec8c 100644
--- a/source/blender/editors/space_topbar/space_topbar.c
+++ b/source/blender/editors/space_topbar/space_topbar.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_topbar/space_topbar.c
- * \ingroup sptopbar
+/** \file
+ * \ingroup sptopbar
*/
@@ -239,7 +233,7 @@ static void recent_files_menu_register(void)
mt = MEM_callocN(sizeof(MenuType), "spacetype info menu recent files");
strcpy(mt->idname, "TOPBAR_MT_file_open_recent");
- strcpy(mt->label, N_("Open Recent..."));
+ strcpy(mt->label, N_("Open Recent"));
strcpy(mt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
mt->draw = recent_files_menu_draw;
WM_menutype_add(mt);
diff --git a/source/blender/editors/space_userpref/CMakeLists.txt b/source/blender/editors/space_userpref/CMakeLists.txt
index bd82ef13cd7..ec0c76c3d5b 100644
--- a/source/blender/editors/space_userpref/CMakeLists.txt
+++ b/source/blender/editors/space_userpref/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index 497cca22ba6..2857c5c8d81 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_userpref/space_userpref.c
- * \ingroup spuserpref
+/** \file
+ * \ingroup spuserpref
*/
@@ -53,7 +46,7 @@
/* ******************** default callbacks for userpref space ***************** */
-static SpaceLink *userpref_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
+static SpaceLink *userpref_new(const ScrArea *area, const Scene *UNUSED(scene))
{
ARegion *ar;
SpaceUserPref *spref;
@@ -76,6 +69,11 @@ static SpaceLink *userpref_new(const ScrArea *UNUSED(area), const Scene *UNUSED(
ar->regiontype = RGN_TYPE_NAV_BAR;
ar->alignment = RGN_ALIGN_LEFT;
+ /* Use smaller size when opened in area like properties editor. */
+ if (area->winx && area->winx < 3.0f * UI_NAVIGATION_REGION_WIDTH * UI_DPI_FAC) {
+ ar->sizex = UI_NARROW_NAVIGATION_REGION_WIDTH;
+ }
+
/* execution region */
ar = MEM_callocN(sizeof(ARegion), "execution region for userpref");
@@ -121,7 +119,8 @@ static SpaceLink *userpref_duplicate(SpaceLink *sl)
/* add handlers, stuff you only do once or on area/region changes */
static void userpref_main_region_init(wmWindowManager *wm, ARegion *ar)
{
- /* do not use here, the properties changed in userprefs do a system-wide refresh, then scroller jumps back */
+ /* do not use here, the properties changed in userprefs do a system-wide refresh,
+ * then scroller jumps back */
/* ar->v2d.flag &= ~V2D_IS_INITIALISED; */
ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
diff --git a/source/blender/editors/space_userpref/userpref_intern.h b/source/blender/editors/space_userpref/userpref_intern.h
index 720b4da0f71..56930d3a231 100644
--- a/source/blender/editors/space_userpref/userpref_intern.h
+++ b/source/blender/editors/space_userpref/userpref_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_userpref/userpref_intern.h
- * \ingroup spuserpref
+/** \file
+ * \ingroup spuserpref
*/
#ifndef __USERPREF_INTERN_H__
diff --git a/source/blender/editors/space_userpref/userpref_ops.c b/source/blender/editors/space_userpref/userpref_ops.c
index 6666a6cfc16..f6aaf01747c 100644
--- a/source/blender/editors/space_userpref/userpref_ops.c
+++ b/source/blender/editors/space_userpref/userpref_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,19 +13,62 @@
* 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) 2008 Blender Foundation.
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_userpref/userpref_ops.c
- * \ingroup spuserpref
+/** \file
+ * \ingroup spuserpref
*/
-
#include <string.h>
-#include <stdio.h>
+
+#include "DNA_screen_types.h"
+
+#include "BKE_context.h"
+#include "BKE_report.h"
+
+#include "RNA_types.h"
+
+#include "UI_interface.h"
+
+#include "../interface/interface_intern.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ED_userpref.h"
+
+/* -------------------------------------------------------------------- */
+/** \name Reset Default Theme
+ * \{ */
+
+static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ UI_theme_init_default();
+ UI_style_init_default();
+ WM_event_add_notifier(C, NC_WINDOW, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+static void PREFERENCES_OT_reset_default_theme(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Reset to Default Theme";
+ ot->idname = "PREFERENCES_OT_reset_default_theme";
+ ot->description = "Reset to the default theme colors";
+
+ /* callbacks */
+ ot->exec = reset_default_theme_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER;
+}
+
+/** \} */
+
+void ED_operatortypes_userpref(void)
+{
+ WM_operatortype_append(PREFERENCES_OT_reset_default_theme);
+}
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index 44089734e83..83e65246797 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -51,19 +48,18 @@ set(SRC
view3d_draw_legacy.c
view3d_edit.c
view3d_fly.c
- view3d_walk.c
- view3d_header.c
- view3d_iterators.c
view3d_gizmo_armature.c
view3d_gizmo_camera.c
view3d_gizmo_empty.c
view3d_gizmo_forcefield.c
- view3d_gizmo_lamp.c
+ view3d_gizmo_light.c
view3d_gizmo_navigate.c
view3d_gizmo_navigate_type.c
- view3d_gizmo_ruler.c
view3d_gizmo_preselect.c
view3d_gizmo_preselect_type.c
+ view3d_gizmo_ruler.c
+ view3d_header.c
+ view3d_iterators.c
view3d_ops.c
view3d_project.c
view3d_select.c
@@ -71,6 +67,7 @@ set(SRC
view3d_toolbar.c
view3d_utils.c
view3d_view.c
+ view3d_walk.c
view3d_intern.h
)
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 409f0300530..e6e0438164c 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, full recode and added functions
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/drawobject.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "DNA_mesh_types.h"
@@ -70,7 +64,7 @@ static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
if ((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0)
return false;
- if (G.f & G_BACKBUFSEL)
+ if (G.f & G_FLAG_BACKBUFSEL)
return false;
/* if its drawing textures with zbuf sel, then don't draw dots */
@@ -80,7 +74,7 @@ static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
return true;
}
-/* ----------------- OpenGL Circle Drawing - Tables for Optimized Drawing Speed ------------------ */
+/* OpenGL Circle Drawing - Tables for Optimized Drawing Speed */
/* 32 values of sin function (still same result!) */
#define CIRCLE_RESOL 32
@@ -116,7 +110,7 @@ static const float sinval[CIRCLE_RESOL] = {
-0.57126821,
-0.39435585,
-0.20129852,
- 0.00000000
+ 0.00000000,
};
/* 32 values of cos function (still same result!) */
@@ -152,7 +146,7 @@ static const float cosval[CIRCLE_RESOL] = {
0.82076344,
0.91895781,
0.97952994,
- 1.00000000
+ 1.00000000,
};
static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3], float rad, const float tmat[4][4])
@@ -163,7 +157,7 @@ static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3
mul_v3_v3fl(vx, tmat[0], rad);
mul_v3_v3fl(vy, tmat[1], rad);
- for (unsigned int a = 0; a < CIRCLE_RESOL; a++, viter += 3) {
+ for (uint a = 0; a < CIRCLE_RESOL; a++, viter += 3) {
viter[0] = cent[0] + sinval[a] * vx[0] + cosval[a] * vy[0];
viter[1] = cent[1] + sinval[a] * vx[1] + cosval[a] * vy[1];
viter[2] = cent[2] + sinval[a] * vx[2] + cosval[a] * vy[2];
@@ -184,121 +178,107 @@ void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], un
}
#ifdef VIEW3D_CAMERA_BORDER_HACK
-unsigned char view3d_camera_border_hack_col[3];
+uchar view3d_camera_border_hack_col[3];
bool view3d_camera_border_hack_test = false;
#endif
/* ***************** BACKBUF SEL (BBS) ********* */
-static void bbs_obmode_mesh_verts(Object *ob, int offset)
+/** See #DRW_shgroup_world_clip_planes_from_rv3d, same function for draw manager. */
+static void bbs_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_clip_planes[6][4])
{
- Mesh *me = ob->data;
- GPUBatch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
- GPU_batch_draw(batch);
+ GPU_batch_uniform_4fv_array(batch, "WorldClipPlanes", 6, world_clip_planes[0]);
}
-static void bbs_mesh_verts(BMEditMesh *em, int offset)
+static void bbs_mesh_verts(GPUBatch *batch, int offset, const float world_clip_planes[6][4])
{
GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
- Mesh *me = em->ob->data;
- GPUBatch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
+ const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT;
+ GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg);
+ GPU_batch_uniform_1ui(batch, "offset", offset);
+ if (world_clip_planes != NULL) {
+ bbs_world_clip_planes_from_rv3d(batch, world_clip_planes);
+ }
GPU_batch_draw(batch);
}
-static void bbs_mesh_wire(BMEditMesh *em, int offset)
+static void bbs_mesh_wire(GPUBatch *batch, int offset, const float world_clip_planes[6][4])
{
GPU_line_width(1.0f);
+ glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);
- Mesh *me = em->ob->data;
- GPUBatch *batch = DRW_mesh_batch_cache_get_edges_with_select_id(me, offset);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
+ const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT;
+ GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg);
+ GPU_batch_uniform_1ui(batch, "offset", offset);
+ if (world_clip_planes != NULL) {
+ bbs_world_clip_planes_from_rv3d(batch, world_clip_planes);
+ }
GPU_batch_draw(batch);
+
+ glProvokingVertex(GL_LAST_VERTEX_CONVENTION);
}
-static void bbs_mesh_face(BMEditMesh *em, const bool use_select)
+/* two options, facecolors or black */
+static void bbs_mesh_face(GPUBatch *batch, const bool use_select, const float world_clip_planes[6][4])
{
- Mesh *me = em->ob->data;
- GPUBatch *batch;
-
if (use_select) {
- batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, true, 1);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
+ const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT;
+ GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg);
+ GPU_batch_uniform_1ui(batch, "offset", 1);
+ if (world_clip_planes != NULL) {
+ bbs_world_clip_planes_from_rv3d(batch, world_clip_planes);
+ }
GPU_batch_draw(batch);
}
else {
- int selcol;
- GPU_select_index_get(0, &selcol);
- batch = DRW_mesh_batch_cache_get_triangles_with_select_mask(me, true);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32);
- GPU_batch_uniform_1ui(batch, "color", selcol);
+ const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT;
+ GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_UNIFORM_SELECT_ID, sh_cfg);
+ GPU_batch_uniform_1ui(batch, "id", 0);
+ if (world_clip_planes != NULL) {
+ bbs_world_clip_planes_from_rv3d(batch, world_clip_planes);
+ }
GPU_batch_draw(batch);
}
}
-static void bbs_mesh_face_dot(BMEditMesh *em)
-{
- Mesh *me = em->ob->data;
- GPUBatch *batch = DRW_mesh_batch_cache_get_facedots_with_select_id(me, 1);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
- GPU_batch_draw(batch);
-}
-
-/* two options, facecolors or black */
-static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
- Object *ob, bool use_faceselect)
+static void bbs_mesh_face_dot(GPUBatch *batch, const float world_clip_planes[6][4])
{
- if (use_faceselect) {
- bbs_mesh_face(em, true);
-
- if (check_ob_drawface_dot(scene, v3d, ob->dt)) {
- bbs_mesh_face_dot(em);
- }
- }
- else {
- bbs_mesh_face(em, false);
+ const eGPUShaderConfig sh_cfg = world_clip_planes ? GPU_SHADER_CFG_CLIPPED : GPU_SHADER_CFG_DEFAULT;
+ GPU_batch_program_set_builtin_with_config(batch, GPU_SHADER_3D_FLAT_SELECT_ID, sh_cfg);
+ GPU_batch_uniform_1ui(batch, "offset", 1);
+ if (world_clip_planes != NULL) {
+ bbs_world_clip_planes_from_rv3d(batch, world_clip_planes);
}
+ GPU_batch_draw(batch);
}
-static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *ob)
+static void bbs_mesh_solid_verts(
+ Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *ob, const float world_clip_planes[6][4])
{
Mesh *me = ob->data;
- /* Only draw faces to mask out verts, we don't want their selection ID's. */
- const int G_f_orig = G.f;
- G.f &= ~G_BACKBUFSEL;
-
- {
- int selcol;
- GPUBatch *batch;
- GPU_select_index_get(0, &selcol);
- batch = DRW_mesh_batch_cache_get_triangles_with_select_mask(me, true);
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32);
- GPU_batch_uniform_1ui(batch, "color", selcol);
- GPU_batch_draw(batch);
- }
+ GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
+ GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
+ DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, true);
- G.f |= (G_f_orig & G_BACKBUFSEL);
+ /* Only draw faces to mask out verts, we don't want their selection ID's. */
+ bbs_mesh_face(geom_faces, false, world_clip_planes);
+ bbs_mesh_verts(geom_verts, 1, world_clip_planes);
- bbs_obmode_mesh_verts(ob, 1);
bm_vertoffs = me->totvert + 1;
}
-static void bbs_mesh_solid_faces(Scene *UNUSED(scene), Object *ob)
+static void bbs_mesh_solid_faces(Scene *UNUSED(scene), Object *ob, const float world_clip_planes[6][4])
{
Mesh *me = ob->data;
Mesh *me_orig = DEG_get_original_object(ob)->data;
- GPUBatch *batch;
- if ((me_orig->editflag & ME_EDIT_PAINT_FACE_SEL)) {
- batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, true, 1);
- }
- else {
- batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, false, 1);
- }
- GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32);
- GPU_batch_draw(batch);
+
+ const bool use_hide = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL);
+ GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
+ DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, use_hide);
+
+ bbs_mesh_face(geom_faces, true, world_clip_planes);
}
void draw_object_backbufsel(
@@ -311,19 +291,43 @@ void draw_object_backbufsel(
}
GPU_matrix_mul(ob->obmat);
-
- glClearDepth(1.0); GPU_clear(GPU_DEPTH_BIT);
GPU_depth_test(true);
+ const float (*world_clip_planes)[4] = NULL;
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ ED_view3d_clipping_local(rv3d, ob->obmat);
+ world_clip_planes = rv3d->clip_local;
+ }
+
switch (ob->type) {
case OB_MESH:
if (ob->mode & OB_MODE_EDIT) {
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
+ const bool draw_facedot = check_ob_drawface_dot(scene, v3d, ob->dt);
+ const bool use_faceselect = (select_mode & SCE_SELECT_FACE) != 0;
BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE);
- bbs_mesh_solid_EM(em, scene, v3d, ob, (select_mode & SCE_SELECT_FACE) != 0);
+ GPUBatch *geom_faces, *geom_edges, *geom_verts, *geom_facedots;
+ geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
+ if (select_mode & SCE_SELECT_EDGE) {
+ geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me);
+ }
+ if (select_mode & SCE_SELECT_VERTEX) {
+ geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
+ }
+ if (draw_facedot) {
+ geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me);
+ }
+ DRW_mesh_batch_cache_create_requested(ob, me, NULL, false, true);
+
+ bbs_mesh_face(geom_faces, use_faceselect, world_clip_planes);
+
+ if (use_faceselect && draw_facedot) {
+ bbs_mesh_face_dot(geom_facedots, world_clip_planes);
+ }
+
if (select_mode & SCE_SELECT_FACE)
bm_solidoffs = 1 + em->bm->totface;
else {
@@ -334,7 +338,7 @@ void draw_object_backbufsel(
/* we draw edges if edge select mode */
if (select_mode & SCE_SELECT_EDGE) {
- bbs_mesh_wire(em, bm_solidoffs);
+ bbs_mesh_wire(geom_edges, bm_solidoffs, world_clip_planes);
bm_wireoffs = bm_solidoffs + em->bm->totedge;
}
else {
@@ -342,9 +346,11 @@ void draw_object_backbufsel(
bm_wireoffs = bm_solidoffs;
}
+ ED_view3d_polygon_offset(rv3d, 1.1);
+
/* we draw verts if vert select mode. */
if (select_mode & SCE_SELECT_VERTEX) {
- bbs_mesh_verts(em, bm_wireoffs);
+ bbs_mesh_verts(geom_verts, bm_wireoffs, world_clip_planes);
bm_vertoffs = bm_wireoffs + em->bm->totvert;
}
else {
@@ -354,15 +360,15 @@ void draw_object_backbufsel(
ED_view3d_polygon_offset(rv3d, 0.0);
}
else {
- Mesh *me = ob->data;
+ Mesh *me = DEG_get_original_object(ob)->data;
if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) &&
/* currently vertex select supports weight paint and vertex paint*/
((ob->mode & OB_MODE_WEIGHT_PAINT) || (ob->mode & OB_MODE_VERTEX_PAINT)))
{
- bbs_mesh_solid_verts(depsgraph, scene, ob);
+ bbs_mesh_solid_verts(depsgraph, scene, ob, world_clip_planes);
}
else {
- bbs_mesh_solid_faces(scene, ob);
+ bbs_mesh_solid_faces(scene, ob, world_clip_planes);
}
}
break;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 5a4cebfbdec..cf4b4b270f6 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/space_view3d.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -346,8 +339,8 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
v3d->flag2 = V3D_SHOW_RECONSTRUCTION | V3D_SHOW_ANNOTATION;
v3d->lens = 50.0f;
- v3d->near = 0.01f;
- v3d->far = 1000.0f;
+ v3d->clip_start = 0.01f;
+ v3d->clip_end = 1000.0f;
v3d->overlay.gpencil_paper_opacity = 0.5f;
v3d->overlay.gpencil_grid_opacity = 0.9f;
@@ -568,7 +561,8 @@ static bool view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEven
static bool view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
{
if (drag->type == WM_DRAG_PATH) {
- return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE)); /* rule might not work? */
+ /* rule might not work? */
+ return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE));
}
else {
return WM_drag_ID(drag, ID_IM) != NULL;
@@ -692,9 +686,9 @@ static void view3d_widgets(void)
wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(
&(const struct wmGizmoMapType_Params){SPACE_VIEW3D, RGN_TYPE_WINDOW});
- WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_lamp_spot);
- WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_lamp_area);
- WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_lamp_target);
+ WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_spot);
+ WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_area);
+ WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_target);
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_force_field);
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_camera);
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_camera_view);
@@ -794,7 +788,7 @@ static void view3d_main_region_listener(
ED_region_tag_redraw(ar);
break;
case ND_ANIMCHAN:
- if (wmn->action == NA_SELECTED)
+ if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED, NA_SELECTED))
ED_region_tag_redraw(ar);
break;
}
@@ -1094,6 +1088,9 @@ static void view3d_main_region_message_subscribe(
WM_msg_subscribe_rna_anon_prop(
mbus, Object, mode,
&msg_sub_value_region_tag_refresh);
+ WM_msg_subscribe_rna_anon_prop(
+ mbus, LayerObjects, active,
+ &msg_sub_value_region_tag_refresh);
}
}
@@ -1326,7 +1323,7 @@ static void space_view3d_listener(
case NC_SCENE:
switch (wmn->data) {
case ND_WORLD:
- if (v3d->flag2 & V3D_RENDER_OVERRIDE)
+ if (v3d->flag2 & V3D_HIDE_OVERLAYS)
ED_area_tag_redraw_regiontype(sa, RGN_TYPE_WINDOW);
break;
}
@@ -1364,12 +1361,13 @@ static void space_view3d_refresh(const bContext *C, ScrArea *UNUSED(sa))
}
const char *view3d_context_dir[] = {
- "active_base", "active_object", NULL
+ "active_base", "active_object", NULL,
};
static int view3d_context(const bContext *C, const char *member, bContextDataResult *result)
{
- /* fallback to the scene layer, allows duplicate and other object operators to run outside the 3d view */
+ /* fallback to the scene layer,
+ * allows duplicate and other object operators to run outside the 3d view */
if (CTX_data_dir(member)) {
CTX_data_dir_set(result, view3d_context_dir);
@@ -1437,7 +1435,8 @@ static void view3d_id_remap(ScrArea *sa, SpaceLink *slink, ID *old_id, ID *new_i
if (is_local == false) {
if ((ID *)v3d->ob_centre == old_id) {
v3d->ob_centre = (Object *)new_id;
- /* Otherwise, bonename may remain valid... We could be smart and check this, too? */
+ /* Otherwise, bonename may remain valid...
+ * We could be smart and check this, too? */
if (new_id == NULL) {
v3d->ob_centre_bone[0] = '\0';
}
@@ -1475,7 +1474,7 @@ void ED_spacetype_view3d(void)
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype view3d main region");
art->regionid = RGN_TYPE_WINDOW;
- art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_GPENCIL;
+ art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_TOOL | ED_KEYMAP_GPENCIL;
art->draw = view3d_main_region_draw;
art->init = view3d_main_region_init;
art->exit = view3d_main_region_exit;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 4a66502b438..706215f8fae 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_buttons.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -81,22 +74,49 @@
/* ******************* view3d space & buttons ************** */
-#define B_REDR 2
-#define B_OBJECTPANELMEDIAN 1008
-#define B_OBJECTPANEL_DIMS 1009
+enum {
+ B_REDR = 2,
+ B_TRANSFORM_PANEL_MEDIAN = 1008,
+ B_TRANSFORM_PANEL_DIMS = 1009,
+};
+
+/* All must start w/ location */
+
+typedef struct {
+ float location[3];
+} TransformMedian_Generic;
+
+typedef struct {
+ float location[3], bv_weight, be_weight, skin[2], crease;
+} TransformMedian_Mesh;
-#define NBR_TRANSFORM_PROPERTIES 8
+typedef struct {
+ float location[3], weight, b_weight, radius, tilt;
+} TransformMedian_Curve;
+
+typedef struct {
+ float location[3], weight;
+} TransformMedian_Lattice;
+
+
+typedef union {
+ TransformMedian_Generic generic;
+ TransformMedian_Mesh mesh;
+ TransformMedian_Curve curve;
+ TransformMedian_Lattice lattice;
+} TransformMedian;
/* temporary struct for storing transform properties */
+
typedef struct {
- float ob_eul[4]; /* used for quat too... */
- float ob_scale[3]; /* need temp space due to linked values */
float ob_dims_orig[3];
float ob_dims[3];
- short link_scale;
- float ve_median[NBR_TRANSFORM_PROPERTIES];
+ /* Floats only (treated as an array). */
+ TransformMedian ve_median, median;
} TransformProperties;
+#define TRANSFORM_MEDIAN_ARRAY_LEN (sizeof(TransformMedian) / sizeof(float))
+
/* Helper function to compute a median changed value,
* when the value should be clamped in [0.0, 1.0].
* Returns either 0.0, 1.0 (both can be applied directly), a positive scale factor
@@ -183,41 +203,21 @@ static TransformProperties *v3d_transform_props_ensure(View3D *v3d)
/* is used for both read and write... */
static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim)
{
-/* Get rid of those ugly magic numbers, even in a single func they become confusing! */
-/* Location, common to all. */
-/* Next three *must* remain contiguous (used as array)! */
-#define LOC_X 0
-#define LOC_Y 1
-#define LOC_Z 2
-/* Meshes... */
-#define M_BV_WEIGHT 3
-/* Next two *must* remain contiguous (used as array)! */
-#define M_SKIN_X 4
-#define M_SKIN_Y 5
-#define M_BE_WEIGHT 6
-#define M_CREASE 7
-/* Curves... */
-#define C_BWEIGHT 3
-#define C_WEIGHT 4
-#define C_RADIUS 5
-#define C_TILT 6
-/*Lattice... */
-#define L_WEIGHT 4
-
uiBlock *block = (layout) ? uiLayoutAbsoluteBlock(layout) : NULL;
TransformProperties *tfp = v3d_transform_props_ensure(v3d);
- float median[NBR_TRANSFORM_PROPERTIES], ve_median[NBR_TRANSFORM_PROPERTIES];
+ TransformMedian median_basis, ve_median_basis;
int tot, totedgedata, totcurvedata, totlattdata, totcurvebweight;
bool has_meshdata = false;
bool has_skinradius = false;
PointerRNA data_ptr;
- copy_vn_fl(median, NBR_TRANSFORM_PROPERTIES, 0.0f);
+ copy_vn_fl((float *)&median_basis, TRANSFORM_MEDIAN_ARRAY_LEN, 0.0f);
tot = totedgedata = totcurvedata = totlattdata = totcurvebweight = 0;
if (ob->type == OB_MESH) {
+ TransformMedian_Mesh *median = &median_basis.mesh;
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMesh *bm = em->bm;
BMVert *eve;
BMEdge *eed;
@@ -234,15 +234,15 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
tot++;
- add_v3_v3(&median[LOC_X], eve->co);
+ add_v3_v3(median->location, eve->co);
if (cd_vert_bweight_offset != -1) {
- median[M_BV_WEIGHT] += BM_ELEM_CD_GET_FLOAT(eve, cd_vert_bweight_offset);
+ median->bv_weight += BM_ELEM_CD_GET_FLOAT(eve, cd_vert_bweight_offset);
}
if (has_skinradius) {
MVertSkin *vs = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_skin_offset);
- add_v2_v2(&median[M_SKIN_X], vs->radius); /* Third val not used currently. */
+ add_v2_v2(median->skin, vs->radius); /* Third val not used currently. */
}
}
}
@@ -253,11 +253,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
if (cd_edge_bweight_offset != -1) {
- median[M_BE_WEIGHT] += BM_ELEM_CD_GET_FLOAT(eed, cd_edge_bweight_offset);
+ median->be_weight += BM_ELEM_CD_GET_FLOAT(eed, cd_edge_bweight_offset);
}
if (cd_edge_crease_offset != -1) {
- median[M_CREASE] += BM_ELEM_CD_GET_FLOAT(eed, cd_edge_crease_offset);
+ median->crease += BM_ELEM_CD_GET_FLOAT(eed, cd_edge_crease_offset);
}
totedgedata++;
@@ -272,6 +272,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
has_meshdata = (tot || totedgedata);
}
else if (ob->type == OB_CURVE || ob->type == OB_SURF) {
+ TransformMedian_Curve *median = &median_basis.curve;
Curve *cu = ob->data;
Nurb *nu;
BPoint *bp;
@@ -288,11 +289,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
a = nu->pntsu;
while (a--) {
if (bezt->f2 & SELECT) {
- add_v3_v3(&median[LOC_X], bezt->vec[1]);
+ add_v3_v3(median->location, bezt->vec[1]);
tot++;
- median[C_WEIGHT] += bezt->weight;
- median[C_RADIUS] += bezt->radius;
- median[C_TILT] += bezt->alfa;
+ median->weight += bezt->weight;
+ median->radius += bezt->radius;
+ median->tilt += bezt->tilt;
if (!totcurvedata) { /* I.e. first time... */
selp = bezt;
seltype = &RNA_BezierSplinePoint;
@@ -301,11 +302,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
else {
if (bezt->f1 & SELECT) {
- add_v3_v3(&median[LOC_X], bezt->vec[0]);
+ add_v3_v3(median->location, bezt->vec[0]);
tot++;
}
if (bezt->f3 & SELECT) {
- add_v3_v3(&median[LOC_X], bezt->vec[2]);
+ add_v3_v3(median->location, bezt->vec[2]);
tot++;
}
}
@@ -317,13 +318,13 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->f1 & SELECT) {
- add_v3_v3(&median[LOC_X], bp->vec);
- median[C_BWEIGHT] += bp->vec[3];
+ add_v3_v3(median->location, bp->vec);
+ median->b_weight += bp->vec[3];
totcurvebweight++;
tot++;
- median[C_WEIGHT] += bp->weight;
- median[C_RADIUS] += bp->radius;
- median[C_TILT] += bp->alfa;
+ median->weight += bp->weight;
+ median->radius += bp->radius;
+ median->tilt += bp->tilt;
if (!totcurvedata) { /* I.e. first time... */
selp = bp;
seltype = &RNA_SplinePoint;
@@ -341,6 +342,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
else if (ob->type == OB_LATTICE) {
Lattice *lt = ob->data;
+ TransformMedian_Lattice *median = &median_basis.lattice;
BPoint *bp;
int a;
StructRNA *seltype = NULL;
@@ -350,9 +352,9 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
bp = lt->editlatt->latt->def;
while (a--) {
if (bp->f1 & SELECT) {
- add_v3_v3(&median[LOC_X], bp->vec);
+ add_v3_v3(median->location, bp->vec);
tot++;
- median[L_WEIGHT] += bp->weight;
+ median->weight += bp->weight;
if (!totlattdata) { /* I.e. first time... */
selp = bp;
seltype = &RNA_LatticePoint;
@@ -372,44 +374,48 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
/* Location, X/Y/Z */
- mul_v3_fl(&median[LOC_X], 1.0f / (float)tot);
+ mul_v3_fl(median_basis.generic.location, 1.0f / (float)tot);
if (v3d->flag & V3D_GLOBAL_STATS)
- mul_m4_v3(ob->obmat, &median[LOC_X]);
+ mul_m4_v3(ob->obmat, median_basis.generic.location);
if (has_meshdata) {
+ TransformMedian_Mesh *median = &median_basis.mesh;
if (totedgedata) {
- median[M_CREASE] /= (float)totedgedata;
- median[M_BE_WEIGHT] /= (float)totedgedata;
+ median->crease /= (float)totedgedata;
+ median->be_weight /= (float)totedgedata;
}
if (tot) {
- median[M_BV_WEIGHT] /= (float)tot;
+ median->bv_weight /= (float)tot;
if (has_skinradius) {
- median[M_SKIN_X] /= (float)tot;
- median[M_SKIN_Y] /= (float)tot;
+ median->skin[0] /= (float)tot;
+ median->skin[1] /= (float)tot;
}
}
}
else if (totcurvedata) {
+ TransformMedian_Curve *median = &median_basis.curve;
if (totcurvebweight) {
- median[C_BWEIGHT] /= (float)totcurvebweight;
+ median->b_weight /= (float)totcurvebweight;
}
- median[C_WEIGHT] /= (float)totcurvedata;
- median[C_RADIUS] /= (float)totcurvedata;
- median[C_TILT] /= (float)totcurvedata;
+ median->weight /= (float)totcurvedata;
+ median->radius /= (float)totcurvedata;
+ median->tilt /= (float)totcurvedata;
}
else if (totlattdata) {
- median[L_WEIGHT] /= (float)totlattdata;
+ TransformMedian_Lattice *median = &median_basis.lattice;
+ median->weight /= (float)totlattdata;
}
if (block) { /* buttons */
uiBut *but;
int yi = 200;
const float tilt_limit = DEG2RADF(21600.0f);
+ const int butw = 200;
const int buth = 20 * UI_DPI_FAC;
const int but_margin = 2;
const char *c;
- memcpy(tfp->ve_median, median, sizeof(tfp->ve_median));
+ memcpy(&tfp->ve_median, &median_basis, sizeof(tfp->ve_median));
UI_block_align_begin(block);
if (tot == 1) {
@@ -420,24 +426,24 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
else
c = IFACE_("Median:");
- uiDefBut(block, UI_BTYPE_LABEL, 0, c, 0, yi -= buth, 200, buth, NULL, 0, 0, 0, 0, "");
+ uiDefBut(block, UI_BTYPE_LABEL, 0, c, 0, yi -= buth, butw, buth, NULL, 0, 0, 0, 0, "");
UI_block_align_begin(block);
/* Should be no need to translate these. */
- but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("X:"), 0, yi -= buth, 200, buth,
- &(tfp->ve_median[LOC_X]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
+ but = uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("X:"), 0, yi -= buth, butw, buth,
+ &tfp->ve_median.generic.location[0], -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
UI_but_unit_type_set(but, PROP_UNIT_LENGTH);
- but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Y:"), 0, yi -= buth, 200, buth,
- &(tfp->ve_median[LOC_Y]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
+ but = uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Y:"), 0, yi -= buth, butw, buth,
+ &tfp->ve_median.generic.location[1], -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
UI_but_unit_type_set(but, PROP_UNIT_LENGTH);
- but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Z:"), 0, yi -= buth, 200, buth,
- &(tfp->ve_median[LOC_Z]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
+ but = uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Z:"), 0, yi -= buth, butw, buth,
+ &tfp->ve_median.generic.location[2], -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
UI_but_unit_type_set(but, PROP_UNIT_LENGTH);
if (totcurvebweight == tot) {
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("W:"), 0, yi -= buth, 200, buth,
- &(tfp->ve_median[C_BWEIGHT]), 0.01, 100.0, 1, 3, "");
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("W:"), 0, yi -= buth, butw, buth,
+ &(tfp->ve_median.curve.b_weight), 0.01, 100.0, 1, 3, "");
}
UI_block_align_begin(block);
@@ -451,101 +457,108 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
/* Meshes... */
if (has_meshdata) {
+ TransformMedian_Mesh *ve_median = &tfp->ve_median.mesh;
if (tot) {
uiDefBut(block, UI_BTYPE_LABEL, 0, tot == 1 ? IFACE_("Vertex Data:") : IFACE_("Vertices Data:"),
- 0, yi -= buth + but_margin, 200, buth, NULL, 0.0, 0.0, 0, 0, "");
+ 0, yi -= buth + but_margin, butw, buth, NULL, 0.0, 0.0, 0, 0, "");
/* customdata layer added on demand */
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN,
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN,
tot == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_BV_WEIGHT]), 0.0, 1.0, 1, 2, TIP_("Vertex weight used by Bevel modifier"));
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->bv_weight, 0.0, 1.0, 1, 2, TIP_("Vertex weight used by Bevel modifier"));
}
if (has_skinradius) {
UI_block_align_begin(block);
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN,
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN,
tot == 1 ? IFACE_("Radius X:") : IFACE_("Mean Radius X:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_SKIN_X]), 0.0, 100.0, 1, 3, TIP_("X radius used by Skin modifier"));
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN,
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->skin[0], 0.0, 100.0, 1, 3, TIP_("X radius used by Skin modifier"));
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN,
tot == 1 ? IFACE_("Radius Y:") : IFACE_("Mean Radius Y:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_SKIN_Y]), 0.0, 100.0, 1, 3, TIP_("Y radius used by Skin modifier"));
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->skin[1], 0.0, 100.0, 1, 3, TIP_("Y radius used by Skin modifier"));
UI_block_align_end(block);
}
if (totedgedata) {
uiDefBut(block, UI_BTYPE_LABEL, 0, totedgedata == 1 ? IFACE_("Edge Data:") : IFACE_("Edges Data:"),
- 0, yi -= buth + but_margin, 200, buth, NULL, 0.0, 0.0, 0, 0, "");
+ 0, yi -= buth + but_margin, butw, buth, NULL, 0.0, 0.0, 0, 0, "");
/* customdata layer added on demand */
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN,
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN,
totedgedata == 1 ? IFACE_("Bevel Weight:") : IFACE_("Mean Bevel Weight:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_BE_WEIGHT]), 0.0, 1.0, 1, 2, TIP_("Edge weight used by Bevel modifier"));
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->be_weight, 0.0, 1.0, 1, 2, TIP_("Edge weight used by Bevel modifier"));
/* customdata layer added on demand */
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN,
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN,
totedgedata == 1 ? IFACE_("Crease:") : IFACE_("Mean Crease:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[M_CREASE]), 0.0, 1.0, 1, 2, TIP_("Weight used by the Subdivision Surface modifier"));
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->crease, 0.0, 1.0, 1, 2, TIP_("Weight used by the Subdivision Surface modifier"));
}
}
/* Curve... */
- else if (totcurvedata == 1) {
- uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, 200, buth,
- &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL);
- uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Radius:"), 0, yi -= buth + but_margin, 200, buth,
- &data_ptr, "radius", 0, 0.0, 100.0, 1, 3, NULL);
- uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Tilt:"), 0, yi -= buth + but_margin, 200, buth,
- &data_ptr, "tilt", 0, -tilt_limit, tilt_limit, 1, 3, NULL);
- }
- else if (totcurvedata > 1) {
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[C_WEIGHT]), 0.0, 1.0, 1, 3, TIP_("Weight used for Soft Body Goal"));
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Radius:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[C_RADIUS]), 0.0, 100.0, 1, 3, TIP_("Radius of curve control points"));
- but = uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Tilt:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[C_TILT]), -tilt_limit, tilt_limit, 1, 3,
- TIP_("Tilt of curve control points"));
- UI_but_unit_type_set(but, PROP_UNIT_ROTATION);
+ else if (totcurvedata) {
+ TransformMedian_Curve *ve_median = &tfp->ve_median.curve;
+ if (totcurvedata == 1) {
+ uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, butw, buth,
+ &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL);
+ uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Radius:"), 0, yi -= buth + but_margin, butw, buth,
+ &data_ptr, "radius", 0, 0.0, 100.0, 1, 3, NULL);
+ uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Tilt:"), 0, yi -= buth + but_margin, butw, buth,
+ &data_ptr, "tilt", 0, -tilt_limit, tilt_limit, 1, 3, NULL);
+ }
+ else if (totcurvedata > 1) {
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Mean Weight:"),
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->weight, 0.0, 1.0, 1, 3, TIP_("Weight used for Soft Body Goal"));
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Mean Radius:"),
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->radius, 0.0, 100.0, 1, 3, TIP_("Radius of curve control points"));
+ but = uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Mean Tilt:"),
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->tilt, -tilt_limit, tilt_limit, 1, 3,
+ TIP_("Tilt of curve control points"));
+ UI_but_unit_type_set(but, PROP_UNIT_ROTATION);
+ }
}
/* Lattice... */
- else if (totlattdata == 1) {
- uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, 200, buth,
- &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL);
- }
- else if (totlattdata > 1) {
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"),
- 0, yi -= buth + but_margin, 200, buth,
- &(tfp->ve_median[L_WEIGHT]), 0.0, 1.0, 1, 3, TIP_("Weight used for Soft Body Goal"));
+ else if (totlattdata) {
+ TransformMedian_Lattice *ve_median = &tfp->ve_median.lattice;
+ if (totlattdata == 1) {
+ uiDefButR(block, UI_BTYPE_NUM, 0, IFACE_("Weight:"), 0, yi -= buth + but_margin, butw, buth,
+ &data_ptr, "weight_softbody", 0, 0.0, 1.0, 1, 3, NULL);
+ }
+ else if (totlattdata > 1) {
+ uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_MEDIAN, IFACE_("Mean Weight:"),
+ 0, yi -= buth + but_margin, butw, buth,
+ &ve_median->weight, 0.0, 1.0, 1, 3, TIP_("Weight used for Soft Body Goal"));
+ }
}
UI_block_align_end(block);
}
else { /* apply */
- int i;
- bool apply_vcos;
-
- memcpy(ve_median, tfp->ve_median, sizeof(tfp->ve_median));
+ memcpy(&ve_median_basis, &tfp->ve_median, sizeof(tfp->ve_median));
if (v3d->flag & V3D_GLOBAL_STATS) {
invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_v3(ob->imat, &median[LOC_X]);
- mul_m4_v3(ob->imat, &ve_median[LOC_X]);
+ mul_m4_v3(ob->imat, median_basis.generic.location);
+ mul_m4_v3(ob->imat, ve_median_basis.generic.location);
}
- i = NBR_TRANSFORM_PROPERTIES;
- while (i--)
- median[i] = ve_median[i] - median[i];
+ sub_vn_vnvn(
+ (float *)&median_basis,
+ (float *)&ve_median_basis,
+ (float *)&median_basis,
+ TRANSFORM_MEDIAN_ARRAY_LEN);
/* Note with a single element selected, we always do. */
- apply_vcos = (tot == 1) || (len_squared_v3(&median[LOC_X]) != 0.0f);
+ const bool apply_vcos = (tot == 1) || (len_squared_v3(median_basis.generic.location) != 0.0f);
if ((ob->type == OB_MESH) &&
- (apply_vcos || median[M_BV_WEIGHT] || median[M_SKIN_X] || median[M_SKIN_Y] ||
- median[M_BE_WEIGHT] || median[M_CREASE]))
+ (apply_vcos || median_basis.mesh.bv_weight || median_basis.mesh.skin[0] || median_basis.mesh.skin[1] ||
+ median_basis.mesh.be_weight || median_basis.mesh.crease))
{
+ const TransformMedian_Mesh *median = &median_basis.mesh, *ve_median = &ve_median_basis.mesh;
Mesh *me = ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMesh *bm = em->bm;
BMIter iter;
BMVert *eve;
@@ -557,63 +570,53 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
int cd_edge_crease_offset = -1;
float scale_bv_weight = 1.0f;
- float scale_skin_x = 1.0f;
- float scale_skin_y = 1.0f;
+ float scale_skin[2] = {1.0f, 1.0f};
float scale_be_weight = 1.0f;
float scale_crease = 1.0f;
/* Vertices */
- if (apply_vcos || median[M_BV_WEIGHT] || median[M_SKIN_X] || median[M_SKIN_Y]) {
- if (median[M_BV_WEIGHT]) {
+ if (apply_vcos || median->bv_weight || median->skin[0] || median->skin[1]) {
+ if (median->bv_weight) {
BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_VERT_BWEIGHT);
cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
BLI_assert(cd_vert_bweight_offset != -1);
- scale_bv_weight = compute_scale_factor(ve_median[M_BV_WEIGHT], median[M_BV_WEIGHT]);
+ scale_bv_weight = compute_scale_factor(ve_median->bv_weight, median->bv_weight);
}
- if (median[M_SKIN_X]) {
- cd_vert_skin_offset = CustomData_get_offset(&bm->vdata, CD_MVERT_SKIN);
- BLI_assert(cd_vert_skin_offset != -1);
-
- if (ve_median[M_SKIN_X] != median[M_SKIN_X]) {
- scale_skin_x = ve_median[M_SKIN_X] / (ve_median[M_SKIN_X] - median[M_SKIN_X]);
- }
- }
- if (median[M_SKIN_Y]) {
- if (cd_vert_skin_offset == -1) {
+ for (int i = 0; i < 2; i++) {
+ if (median->skin[i]) {
cd_vert_skin_offset = CustomData_get_offset(&bm->vdata, CD_MVERT_SKIN);
BLI_assert(cd_vert_skin_offset != -1);
- }
- if (ve_median[M_SKIN_Y] != median[M_SKIN_Y]) {
- scale_skin_y = ve_median[M_SKIN_Y] / (ve_median[M_SKIN_Y] - median[M_SKIN_Y]);
+ if (ve_median->skin[i] != median->skin[i]) {
+ scale_skin[i] = ve_median->skin[i] / (ve_median->skin[i] - median->skin[i]);
+ }
}
}
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
if (apply_vcos) {
- apply_raw_diff_v3(eve->co, tot, &ve_median[LOC_X], &median[LOC_X]);
+ apply_raw_diff_v3(eve->co, tot, ve_median->location, median->location);
}
if (cd_vert_bweight_offset != -1) {
- float *bweight = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset);
- apply_scale_factor_clamp(bweight, tot, ve_median[M_BV_WEIGHT], scale_bv_weight);
+ float *b_weight = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset);
+ apply_scale_factor_clamp(b_weight, tot, ve_median->bv_weight, scale_bv_weight);
}
if (cd_vert_skin_offset != -1) {
MVertSkin *vs = BM_ELEM_CD_GET_VOID_P(eve, cd_vert_skin_offset);
/* That one is not clamped to [0.0, 1.0]. */
- if (median[M_SKIN_X] != 0.0f) {
- apply_scale_factor(&vs->radius[0], tot, ve_median[M_SKIN_X], median[M_SKIN_X],
- scale_skin_x);
- }
- if (median[M_SKIN_Y] != 0.0f) {
- apply_scale_factor(&vs->radius[1], tot, ve_median[M_SKIN_Y], median[M_SKIN_Y],
- scale_skin_y);
+ for (int i = 0; i < 2; i++) {
+ if (median->skin[i] != 0.0f) {
+ apply_scale_factor(
+ &vs->radius[i], tot, ve_median->skin[i], median->skin[i],
+ scale_skin[i]);
+ }
}
}
}
@@ -626,48 +629,53 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
/* Edges */
- if (median[M_BE_WEIGHT] || median[M_CREASE]) {
- if (median[M_BE_WEIGHT]) {
+ if (median->be_weight || median->crease) {
+ if (median->be_weight) {
BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_BWEIGHT);
cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
BLI_assert(cd_edge_bweight_offset != -1);
- scale_be_weight = compute_scale_factor(ve_median[M_BE_WEIGHT], median[M_BE_WEIGHT]);
+ scale_be_weight = compute_scale_factor(ve_median->be_weight, median->be_weight);
}
- if (median[M_CREASE]) {
+ if (median->crease) {
BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_CREASE);
cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
BLI_assert(cd_edge_crease_offset != -1);
- scale_crease = compute_scale_factor(ve_median[M_CREASE], median[M_CREASE]);
+ scale_crease = compute_scale_factor(ve_median->crease, median->crease);
}
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
- if (median[M_BE_WEIGHT] != 0.0f) {
- float *bweight = BM_ELEM_CD_GET_VOID_P(eed, cd_edge_bweight_offset);
- apply_scale_factor_clamp(bweight, tot, ve_median[M_BE_WEIGHT], scale_be_weight);
+ if (median->be_weight != 0.0f) {
+ float *b_weight = BM_ELEM_CD_GET_VOID_P(eed, cd_edge_bweight_offset);
+ apply_scale_factor_clamp(b_weight, tot, ve_median->be_weight, scale_be_weight);
}
- if (median[M_CREASE] != 0.0f) {
+ if (median->crease != 0.0f) {
float *crease = BM_ELEM_CD_GET_VOID_P(eed, cd_edge_crease_offset);
- apply_scale_factor_clamp(crease, tot, ve_median[M_CREASE], scale_crease);
+ apply_scale_factor_clamp(crease, tot, ve_median->crease, scale_crease);
}
}
}
}
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF) &&
- (apply_vcos || median[C_BWEIGHT] || median[C_WEIGHT] || median[C_RADIUS] || median[C_TILT]))
+ (apply_vcos ||
+ median_basis.curve.b_weight ||
+ median_basis.curve.weight ||
+ median_basis.curve.radius ||
+ median_basis.curve.tilt))
{
+ const TransformMedian_Curve *median = &median_basis.curve, *ve_median = &ve_median_basis.curve;
Curve *cu = ob->data;
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
int a;
ListBase *nurbs = BKE_curve_editNurbs_get(cu);
- const float scale_w = compute_scale_factor(ve_median[C_WEIGHT], median[C_WEIGHT]);
+ const float scale_w = compute_scale_factor(ve_median->weight, median->weight);
nu = nurbs->first;
while (nu) {
@@ -679,26 +687,27 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
* Cannot avoid some glitches when going e.g. from 3 to 0.0001 (see T37327),
* unless we use doubles.
*/
- add_v3_v3(bezt->vec[0], &median[LOC_X]);
- add_v3_v3(bezt->vec[1], &median[LOC_X]);
- add_v3_v3(bezt->vec[2], &median[LOC_X]);
+ add_v3_v3(bezt->vec[0], median->location);
+ add_v3_v3(bezt->vec[1], median->location);
+ add_v3_v3(bezt->vec[2], median->location);
}
- if (median[C_WEIGHT]) {
- apply_scale_factor_clamp(&bezt->weight, tot, ve_median[C_WEIGHT], scale_w);
+ if (median->weight) {
+ apply_scale_factor_clamp(&bezt->weight, tot, ve_median->weight, scale_w);
}
- if (median[C_RADIUS]) {
- apply_raw_diff(&bezt->radius, tot, ve_median[C_RADIUS], median[C_RADIUS]);
+ if (median->radius) {
+ apply_raw_diff(&bezt->radius, tot, ve_median->radius, median->radius);
}
- if (median[C_TILT]) {
- apply_raw_diff(&bezt->alfa, tot, ve_median[C_TILT], median[C_TILT]);
+ if (median->tilt) {
+ apply_raw_diff(&bezt->tilt, tot, ve_median->tilt, median->tilt);
}
}
- else if (apply_vcos) { /* Handles can only have their coordinates changed here. */
+ else if (apply_vcos) {
+ /* Handles can only have their coordinates changed here. */
if (bezt->f1 & SELECT) {
- apply_raw_diff_v3(bezt->vec[0], tot, &ve_median[LOC_X], &median[LOC_X]);
+ apply_raw_diff_v3(bezt->vec[0], tot, ve_median->location, median->location);
}
if (bezt->f3 & SELECT) {
- apply_raw_diff_v3(bezt->vec[2], tot, &ve_median[LOC_X], &median[LOC_X]);
+ apply_raw_diff_v3(bezt->vec[2], tot, ve_median->location, median->location);
}
}
}
@@ -707,19 +716,19 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a--; bp++) {
if (bp->f1 & SELECT) {
if (apply_vcos) {
- apply_raw_diff_v3(bp->vec, tot, &ve_median[LOC_X], &median[LOC_X]);
+ apply_raw_diff_v3(bp->vec, tot, ve_median->location, median->location);
}
- if (median[C_BWEIGHT]) {
- apply_raw_diff(&bp->vec[3], tot, ve_median[C_BWEIGHT], median[C_BWEIGHT]);
+ if (median->b_weight) {
+ apply_raw_diff(&bp->vec[3], tot, ve_median->b_weight, median->b_weight);
}
- if (median[C_WEIGHT]) {
- apply_scale_factor_clamp(&bp->weight, tot, ve_median[C_WEIGHT], scale_w);
+ if (median->weight) {
+ apply_scale_factor_clamp(&bp->weight, tot, ve_median->weight, scale_w);
}
- if (median[C_RADIUS]) {
- apply_raw_diff(&bp->radius, tot, ve_median[C_RADIUS], median[C_RADIUS]);
+ if (median->radius) {
+ apply_raw_diff(&bp->radius, tot, ve_median->radius, median->radius);
}
- if (median[C_TILT]) {
- apply_raw_diff(&bp->alfa, tot, ve_median[C_TILT], median[C_TILT]);
+ if (median->tilt) {
+ apply_raw_diff(&bp->tilt, tot, ve_median->tilt, median->tilt);
}
}
}
@@ -730,21 +739,24 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
nu = nu->next;
}
}
- else if ((ob->type == OB_LATTICE) && (apply_vcos || median[L_WEIGHT])) {
+ else if ((ob->type == OB_LATTICE) &&
+ (apply_vcos || median_basis.lattice.weight))
+ {
+ const TransformMedian_Lattice *median = &median_basis.lattice, *ve_median = &ve_median_basis.lattice;
Lattice *lt = ob->data;
BPoint *bp;
int a;
- const float scale_w = compute_scale_factor(ve_median[L_WEIGHT], median[L_WEIGHT]);
+ const float scale_w = compute_scale_factor(ve_median->weight, median->weight);
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 (apply_vcos) {
- apply_raw_diff_v3(bp->vec, tot, &ve_median[LOC_X], &median[LOC_X]);
+ apply_raw_diff_v3(bp->vec, tot, ve_median->location, median->location);
}
- if (median[L_WEIGHT]) {
- apply_scale_factor_clamp(&bp->weight, tot, ve_median[L_WEIGHT], scale_w);
+ if (median->weight) {
+ apply_scale_factor_clamp(&bp->weight, tot, ve_median->weight, scale_w);
}
}
bp++;
@@ -753,27 +765,9 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
/* ED_undo_push(C, "Transform properties"); */
}
-
-/* Clean up! */
-/* Location, common to all. */
-#undef LOC_X
-#undef LOC_Y
-#undef LOC_Z
-/* Meshes (and lattice)... */
-#undef M_BV_WEIGHT
-#undef M_SKIN_X
-#undef M_SKIN_Y
-#undef M_BE_WEIGHT
-#undef M_CREASE
-/* Curves... */
-#undef C_BWEIGHT
-#undef C_WEIGHT
-#undef C_RADIUS
-#undef C_TILT
-/* Lattice... */
-#undef L_WEIGHT
}
-#undef NBR_TRANSFORM_PROPERTIES
+
+#undef TRANSFORM_MEDIAN_ARRAY_LEN
static void v3d_object_dimension_buts(bContext *C, uiLayout *layout, View3D *v3d, Object *ob)
{
@@ -793,9 +787,12 @@ static void v3d_object_dimension_buts(bContext *C, uiLayout *layout, View3D *v3d
UI_block_align_begin(block);
const float lim = 10000;
for (int i = 0; i < 3; i++) {
+ uiBut *but;
char text[3] = {'X' + i, ':', '\0'};
- uiDefButF(block, UI_BTYPE_NUM, B_OBJECTPANEL_DIMS, text, 0, yi -= buth, butw, buth,
- &(tfp->ob_dims[i]), 0.0f, lim, 10, 3, "");
+ but = uiDefButF(
+ block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_DIMS, text, 0, yi -= buth, butw, buth,
+ &(tfp->ob_dims[i]), 0.0f, lim, 10, 3, "");
+ UI_but_unit_type_set(but, PROP_UNIT_LENGTH);
}
UI_block_align_end(block);
}
@@ -871,7 +868,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
uiLayout *row;
uiBut *but;
bDeformGroup *dg;
- unsigned int i;
+ uint i;
int subset_count, vgroup_tot;
const bool *vgroup_validmap;
eVGroupSelect subset_type = ts->vgroupsubset;
@@ -1151,13 +1148,13 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
ED_area_tag_redraw(CTX_wm_area(C));
return; /* no notifier! */
- case B_OBJECTPANELMEDIAN:
+ case B_TRANSFORM_PANEL_MEDIAN:
if (ob) {
v3d_editvertex_buts(NULL, v3d, ob, 1.0);
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
break;
- case B_OBJECTPANEL_DIMS:
+ case B_TRANSFORM_PANEL_DIMS:
if (ob) {
v3d_object_dimension_buts(C, NULL, v3d, ob);
}
@@ -1177,10 +1174,9 @@ static bool view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt)
static void view3d_panel_transform(const bContext *C, Panel *pa)
{
uiBlock *block;
- Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *obedit = CTX_data_edit_object(C);
Object *ob = view_layer->basact->object;
+ Object *obedit = OBEDIT_FROM_OBACT(ob);
uiLayout *col;
block = uiLayoutGetBlock(pa->layout);
@@ -1197,6 +1193,7 @@ static void view3d_panel_transform(const bContext *C, Panel *pa)
}
else {
View3D *v3d = CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
const float lim = 10000.0f * max_ff(1.0f, ED_view3d_grid_scale(scene, v3d, NULL));
v3d_editvertex_buts(col, v3d, ob, lim);
}
@@ -1229,7 +1226,7 @@ void view3d_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel object");
strcpy(pt->idname, "VIEW3D_PT_transform");
- strcpy(pt->label, N_("Transform")); /* XXX C panels not available through RNA (bpy.types)! */
+ strcpy(pt->label, N_("Transform")); /* XXX C panels unavailable through RNA bpy.types! */
strcpy(pt->category, "View");
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = view3d_panel_transform;
@@ -1238,7 +1235,7 @@ void view3d_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel vgroup");
strcpy(pt->idname, "VIEW3D_PT_vgroup");
- strcpy(pt->label, N_("Vertex Weights")); /* XXX C panels are not available through RNA (bpy.types)! */
+ strcpy(pt->label, N_("Vertex Weights")); /* XXX C panels unavailable through RNA bpy.types! */
strcpy(pt->category, "View");
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = view3d_panel_vgroup;
diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c
index d8b7d449c36..d1ff73d1f87 100644
--- a/source/blender/editors/space_view3d/view3d_camera_control.c
+++ b/source/blender/editors/space_view3d/view3d_camera_control.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,21 +12,15 @@
* 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 *****
*/
-/** \file blender/editors/space_view3d/view3d_camera_control.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*
* The purpose of View3DCameraControl is to allow editing \a rv3d manipulation
* (mainly \a ofs and \a viewquat) for the purpose of view navigation
* without having to worry about positioning the camera, its parent...
* or other details.
- *
- *
* Typical view-control usage:
*
* - acquire a view-control (#ED_view3d_cameracontrol_acquire).
@@ -54,7 +46,6 @@
#include "BLI_utildefines.h"
#include "BKE_object.h"
-#include "BKE_context.h"
#include "DEG_depsgraph.h"
@@ -94,20 +85,24 @@ typedef struct View3DCameraControl {
Object *root_parent;
/* backup values */
- float dist_backup; /* backup the views distance since we use a zero dist for fly mode */
- float ofs_backup[3]; /* backup the views offset in case the user cancels flying in non camera mode */
+ float dist_backup;
+ /* backup the views distance since we use a zero dist for fly mode */
+ float ofs_backup[3];
+ /* backup the views offset in case the user cancels flying in non camera mode */
/* backup the views quat in case the user cancels flying in non camera mode.
* (quat for view, eul for camera) */
float rot_backup[4];
- char persp_backup; /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
+ /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
+ char persp_backup;
/* are we flying an ortho camera in perspective view,
* which was originally in ortho view?
* could probably figure it out but better be explicit */
bool is_ortho_cam;
- void *obtfm; /* backup the objects transform */
+ /* backup the objects transform */
+ void *obtfm;
} View3DCameraControl;
@@ -185,8 +180,10 @@ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(
}
else {
/* perspective or ortho */
- if (rv3d->persp == RV3D_ORTHO)
- rv3d->persp = RV3D_PERSP; /* if ortho projection, make perspective */
+ if (rv3d->persp == RV3D_ORTHO) {
+ /* if ortho projection, make perspective */
+ rv3d->persp = RV3D_PERSP;
+ }
copy_qt_qt(vctrl->rot_backup, rv3d->viewquat);
copy_v3_v3(vctrl->ofs_backup, rv3d->ofs);
@@ -217,7 +214,8 @@ void ED_view3d_cameracontrol_update(
const bool use_autokey,
struct bContext *C, const bool do_rotate, const bool do_translate)
{
- /* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */
+ /* we are in camera view so apply the view ofs and quat to the view matrix and set the camera
+ * to the view */
Scene *scene = vctrl->ctx_scene;
View3D *v3d = vctrl->ctx_v3d;
@@ -253,21 +251,21 @@ void ED_view3d_cameracontrol_update(
}
else {
float view_mat[4][4];
- float size_mat[4][4];
- float size_back[3];
+ float scale_mat[4][4];
+ float scale_back[3];
- /* even though we handle the size matrix, this still changes over time */
- copy_v3_v3(size_back, v3d->camera->size);
+ /* even though we handle the scale matrix, this still changes over time */
+ copy_v3_v3(scale_back, v3d->camera->scale);
ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
- size_to_mat4(size_mat, v3d->camera->size);
- mul_m4_m4m4(view_mat, view_mat, size_mat);
+ size_to_mat4(scale_mat, v3d->camera->scale);
+ mul_m4_m4m4(view_mat, view_mat, scale_mat);
BKE_object_apply_mat4(v3d->camera, view_mat, true, true);
DEG_id_tag_update(&v3d->camera->id, ID_RECALC_TRANSFORM);
- copy_v3_v3(v3d->camera->size, size_back);
+ copy_v3_v3(v3d->camera->scale, scale_back);
id_key = &v3d->camera->id;
}
@@ -303,7 +301,8 @@ void ED_view3d_cameracontrol_release(
DEG_id_tag_update(&ob_back->id, ID_RECALC_TRANSFORM);
}
else {
- /* Non Camera we need to reset the view back to the original location because the user canceled*/
+ /* Non Camera we need to reset the view back
+ * to the original location because the user canceled. */
copy_qt_qt(rv3d->viewquat, vctrl->rot_backup);
rv3d->persp = vctrl->persp_backup;
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index a64ba5b2197..5e59c36a80f 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_draw.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include <math.h>
@@ -37,8 +30,6 @@
#include "BLI_threads.h"
#include "BLI_jitter_2d.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "BKE_camera.h"
#include "BKE_collection.h"
@@ -154,7 +145,7 @@ void ED_view3d_update_viewmat(
rv3d->viewcamtexcofac[2] = rv3d->viewcamtexcofac[3] = 0.0f;
}
- /* calculate pixelsize factor once, is used for lamps and obcenters */
+ /* calculate pixelsize factor once, is used for lights and obcenters */
{
/* note: '1.0f / len_v3(v1)' replaced 'len_v3(rv3d->viewmat[0])'
* because of float point precision problems at large values [#23908] */
@@ -248,20 +239,22 @@ static void view3d_stereo3d_setup(
/* update the viewport matrices with the new camera */
if (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D) {
- Camera *data;
+ Camera *data, *data_eval;
float viewmat[4][4];
float shiftx;
data = (Camera *)v3d->camera->data;
- shiftx = data->shiftx;
+ data_eval = (Camera *)DEG_get_evaluated_id(depsgraph, &data->id);
+
+ shiftx = data_eval->shiftx;
BLI_thread_lock(LOCK_VIEW3D);
- data->shiftx = BKE_camera_multiview_shift_x(&scene->r, v3d->camera, viewname);
+ data_eval->shiftx = BKE_camera_multiview_shift_x(&scene->r, v3d->camera, viewname);
BKE_camera_multiview_view_matrix(&scene->r, v3d->camera, is_left, viewmat);
view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, NULL, rect);
- data->shiftx = shiftx;
+ data_eval->shiftx = shiftx;
BLI_thread_unlock(LOCK_VIEW3D);
}
else { /* SCE_VIEWS_FORMAT_MULTIVIEW */
@@ -320,8 +313,8 @@ static void view3d_camera_border(
/* get camera viewplane */
BKE_camera_params_init(&params);
/* fallback for non camera objects */
- params.clipsta = v3d->near;
- params.clipend = v3d->far;
+ params.clip_start = v3d->clip_start;
+ params.clip_end = v3d->clip_end;
BKE_camera_params_from_object(&params, camera_eval);
if (no_shift) {
params.shiftx = 0.0f;
@@ -516,7 +509,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View
}
/* When overlays are disabled, only show camera outline & passepartout. */
- if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+ if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
return;
}
@@ -716,7 +709,10 @@ void ED_view3d_draw_depth(
/* temp set drawtype to solid */
/* Setting these temporarily is not nice */
v3d->flag &= ~V3D_SELECT_OUTLINE;
- U.glalphaclip = alphaoverride ? 0.5f : glalphaclip; /* not that nice but means we wont zoom into billboards */
+
+ /* not that nice but means we wont zoom into billboards */
+ U.glalphaclip = alphaoverride ? 0.5f : glalphaclip;
+
U.obcenter_dia = 0;
/* Tools may request depth outside of regular drawing code. */
@@ -794,12 +790,11 @@ float ED_view3d_grid_view_scale(
/* Allow 3 more subdivisions (see OBJECT_engine_init). */
grid_scale /= powf(grid_subdiv, 3);
- float grid_distance = rv3d->dist;
- float lvl = (logf(grid_distance / grid_scale) / logf(grid_subdiv));
+ /* `3.0` was a value obtained by trial and error in order to get
+ * a nice snap distance.*/
+ float grid_res = 3.0 * (rv3d->dist / v3d->lens);
+ float lvl = (logf(grid_res / grid_scale) / logf(grid_subdiv));
- /* 1.3f is a visually chosen offset for the
- * subdivision to match the visible grid. */
- lvl -= 1.3f;
CLAMP_MIN(lvl, 0.0f);
grid_scale *= pow(grid_subdiv, (int)lvl);
@@ -812,7 +807,8 @@ float ED_view3d_grid_view_scale(
static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
{
const float k = U.rvisize * U.pixelsize; /* axis size */
- const int bright = - 20 * (10 - U.rvibright); /* axis alpha offset (rvibright has range 0-10) */
+ /* axis alpha offset (rvibright has range 0-10) */
+ const int bright = - 20 * (10 - U.rvibright);
/* Axis center in screen coordinates.
*
@@ -823,7 +819,7 @@ static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
const float starty = rect->ymax - (k + UI_UNIT_Y);
float axis_pos[3][2];
- unsigned char axis_col[3][4];
+ uchar axis_col[3][4];
int axis_order[3] = {0, 1, 2};
axis_sort_v3(rv3d->viewinv[2], axis_order);
@@ -1209,12 +1205,15 @@ static void draw_selected_name(Scene *scene, ViewLayer *view_layer, Object *ob,
}
/* color depends on whether there is a keyframe */
- if (id_frame_has_keyframe((ID *)ob, /* BKE_scene_frame_get(scene) */ (float)cfra, ANIMFILTER_KEYS_LOCAL))
+ if (id_frame_has_keyframe((ID *)ob, /* BKE_scene_frame_get(scene) */ (float)cfra, ANIMFILTER_KEYS_LOCAL)) {
UI_FontThemeColor(font_id, TH_TIME_KEYFRAME);
- else if (ED_gpencil_has_keyframe_v3d(scene, ob, cfra))
+ }
+ else if (ED_gpencil_has_keyframe_v3d(scene, ob, cfra)) {
UI_FontThemeColor(font_id, TH_TIME_GP_KEYFRAME);
- else
+ }
+ else {
UI_FontThemeColor(font_id, TH_TEXT_HI);
+ }
}
else {
/* no object */
@@ -1274,7 +1273,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
BLF_batch_draw_begin();
if ((U.uiflag & USER_SHOW_GIZMO_AXIS) ||
- (v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ (v3d->flag2 & V3D_HIDE_OVERLAYS) ||
/* No need to display gizmo and this info. */
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_NAVIGATE)))
{
@@ -1287,7 +1286,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
int xoffset = rect.xmin + U.widget_unit;
int yoffset = rect.ymax;
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0 &&
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0 &&
(v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) == 0)
{
if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
@@ -1367,7 +1366,6 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar)
}
/* -------------------------------------------------------------------- */
-
/** \name Offscreen Drawing
* \{ */
@@ -1421,7 +1419,7 @@ void ED_view3d_draw_offscreen(
UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW);
/* set flags */
- G.f |= G_RENDER_OGL;
+ G.f |= G_FLAG_RENDER_VIEWPORT;
{
/* free images which can have changed on frame-change
@@ -1454,7 +1452,7 @@ void ED_view3d_draw_offscreen(
UI_Theme_Restore(&theme_state);
- G.f &= ~G_RENDER_OGL;
+ G.f &= ~G_FLAG_RENDER_VIEWPORT;
}
/**
@@ -1467,7 +1465,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
Depsgraph *depsgraph, Scene *scene,
int drawtype,
View3D *v3d, ARegion *ar, int sizex, int sizey,
- unsigned int flag, unsigned int draw_flags,
+ uint flag, uint draw_flags,
int alpha_mode, int samples, const char *viewname,
/* output vars */
GPUOffScreen *ofs, char err_out[256])
@@ -1519,8 +1517,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
BKE_camera_params_init(&params);
/* fallback for non camera objects */
- params.clipsta = v3d->near;
- params.clipend = v3d->far;
+ params.clip_start = v3d->clip_start;
+ params.clip_end = v3d->clip_end;
BKE_camera_params_from_object(&params, camera_eval);
BKE_camera_multiview_params(&scene->r, &params, camera_eval, viewname);
BKE_camera_params_compute_viewplane(&params, sizex, sizey, scene->r.xasp, scene->r.yasp);
@@ -1533,14 +1531,14 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
}
else {
rctf viewplane;
- float clipsta, clipend;
+ float clip_start, clipend;
- is_ortho = ED_view3d_viewplane_get(depsgraph, v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL);
+ is_ortho = ED_view3d_viewplane_get(depsgraph, v3d, rv3d, sizex, sizey, &viewplane, &clip_start, &clipend, NULL);
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);
+ perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clip_start, clipend);
}
}
@@ -1593,7 +1591,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
&fx_settings, ofs, viewport);
GPU_offscreen_read_pixels(ofs, GL_FLOAT, rect_temp);
- unsigned int i = sizex * sizey * 4;
+ uint i = sizex * sizey * 4;
while (i--) {
accum_buffer[i] += rect_temp[i];
}
@@ -1611,16 +1609,16 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
if (ibuf->rect_float) {
float *rect_float = ibuf->rect_float;
- unsigned int i = sizex * sizey * 4;
+ uint i = sizex * sizey * 4;
while (i--) {
rect_float[i] = accum_buffer[i] / samples;
}
}
else {
- unsigned char *rect_ub = (unsigned char *)ibuf->rect;
- unsigned int i = sizex * sizey * 4;
+ uchar *rect_ub = (uchar *)ibuf->rect;
+ uint i = sizex * sizey * 4;
while (i--) {
- rect_ub[i] = (unsigned char)(255.0f * accum_buffer[i] / samples);
+ rect_ub[i] = (uchar)(255.0f * accum_buffer[i] / samples);
}
}
@@ -1658,7 +1656,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
Depsgraph *depsgraph, Scene *scene,
int drawtype,
Object *camera, int width, int height,
- unsigned int flag, unsigned int draw_flags,
+ uint flag, uint draw_flags,
int alpha_mode, int samples, const char *viewname,
GPUOffScreen *ofs, char err_out[256])
{
@@ -1673,7 +1671,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
v3d.camera = camera;
v3d.shading.type = drawtype;
- v3d.flag2 = V3D_RENDER_OVERRIDE;
+ v3d.flag2 = V3D_HIDE_OVERLAYS;
if (draw_flags & V3D_OFSDRAW_USE_GPENCIL) {
v3d.flag2 |= V3D_SHOW_ANNOTATION;
@@ -1707,8 +1705,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
BKE_camera_params_compute_matrix(&params);
copy_m4_m4(rv3d.winmat, params.winmat);
- v3d.near = params.clipsta;
- v3d.far = params.clipend;
+ v3d.clip_start = params.clip_start;
+ v3d.clip_end = params.clip_end;
v3d.lens = params.lens;
}
@@ -1722,3 +1720,28 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
}
/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Viewport Clipping
+ * \{ */
+
+static bool view3d_clipping_test(const float co[3], const float clip[6][4])
+{
+ if (plane_point_side_v3(clip[0], co) > 0.0f)
+ if (plane_point_side_v3(clip[1], co) > 0.0f)
+ if (plane_point_side_v3(clip[2], co) > 0.0f)
+ if (plane_point_side_v3(clip[3], co) > 0.0f)
+ return false;
+
+ return true;
+}
+
+/* for 'local' ED_view3d_clipping_local must run first
+ * then all comparisons can be done in localspace */
+bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const bool is_local)
+{
+ return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
+}
+
+
+/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index c9a6a9d608b..a52fd89d284 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_draw_legacy.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include <string.h>
@@ -39,7 +32,7 @@
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_scene_types.h"
#include "DNA_world_types.h"
#include "DNA_brush_types.h"
@@ -48,7 +41,6 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
-#include "BLI_jitter_2d.h"
#include "BLI_utildefines.h"
#include "BLI_endian_switch.h"
#include "BLI_threads.h"
@@ -60,12 +52,10 @@
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_layer.h"
-#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_global.h"
#include "BKE_paint.h"
#include "BKE_scene.h"
-#include "BKE_screen.h"
#include "BKE_unit.h"
#include "BKE_movieclip.h"
@@ -114,50 +104,49 @@
/* ********* custom clipping *********** */
+/* Legacy 2.7x, now use shaders that use clip distance instead.
+ * Remove once clipping is working properly. */
+#define USE_CLIP_PLANES
+
void ED_view3d_clipping_set(RegionView3D *rv3d)
{
+#ifdef USE_CLIP_PLANES
double plane[4];
- const unsigned int tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
+ const uint tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
for (unsigned a = 0; a < tot; a++) {
copy_v4db_v4fl(plane, rv3d->clip[a]);
glClipPlane(GL_CLIP_PLANE0 + a, plane);
glEnable(GL_CLIP_PLANE0 + a);
+ glEnable(GL_CLIP_DISTANCE0 + a);
+ }
+#else
+ for (unsigned a = 0; a < 6; a++) {
+ glEnable(GL_CLIP_DISTANCE0 + a);
}
+#endif
}
/* use these to temp disable/enable clipping when 'rv3d->rflag & RV3D_CLIPPING' is set */
void ED_view3d_clipping_disable(void)
{
for (unsigned a = 0; a < 6; a++) {
+#ifdef USE_CLIP_PLANES
glDisable(GL_CLIP_PLANE0 + a);
+#endif
+ glDisable(GL_CLIP_DISTANCE0 + a);
}
}
void ED_view3d_clipping_enable(void)
{
for (unsigned a = 0; a < 6; a++) {
+#ifdef USE_CLIP_PLANES
glEnable(GL_CLIP_PLANE0 + a);
+#endif
+ glEnable(GL_CLIP_DISTANCE0 + a);
}
}
-static bool view3d_clipping_test(const float co[3], const float clip[6][4])
-{
- if (plane_point_side_v3(clip[0], co) > 0.0f)
- if (plane_point_side_v3(clip[1], co) > 0.0f)
- if (plane_point_side_v3(clip[2], co) > 0.0f)
- if (plane_point_side_v3(clip[3], co) > 0.0f)
- return false;
-
- return true;
-}
-
-/* for 'local' ED_view3d_clipping_local must run first
- * then all comparisons can be done in localspace */
-bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const bool is_local)
-{
- return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
-}
-
/* *********************** backdraw for selection *************** */
static void backdrawview3d(
@@ -257,7 +246,7 @@ static void backdrawview3d(
if (rv3d->rflag & RV3D_CLIPPING)
ED_view3d_clipping_set(rv3d);
- G.f |= G_BACKBUFSEL;
+ G.f |= G_FLAG_BACKBUFSEL;
if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE) != 0)) {
draw_object_backbufsel(depsgraph, scene_eval, v3d, rv3d, obact_eval, select_mode);
@@ -268,7 +257,7 @@ static void backdrawview3d(
v3d->flag &= ~V3D_INVALID_BACKBUF;
- G.f &= ~G_BACKBUFSEL;
+ G.f &= ~G_FLAG_BACKBUFSEL;
GPU_depth_test(false);
glEnable(GL_DITHER);
@@ -319,7 +308,7 @@ int ED_view3d_backbuf_sample_size_clamp(ARegion *ar, const float dist)
}
/* samples a single pixel (copied from vpaint) */
-unsigned int ED_view3d_backbuf_sample(
+uint ED_view3d_backbuf_sample(
ViewContext *vc, int x, int y)
{
if (x >= vc->ar->winx || y >= vc->ar->winy) {
@@ -328,7 +317,7 @@ unsigned int ED_view3d_backbuf_sample(
ED_view3d_backbuf_validate(vc);
- unsigned int col;
+ uint col;
view3d_opengl_read_pixels(vc->ar, x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
glReadBuffer(GL_BACK);
@@ -397,9 +386,9 @@ ImBuf *ED_view3d_backbuf_read(
}
/* smart function to sample a rect spiralling outside, nice for backbuf selection */
-unsigned int ED_view3d_backbuf_sample_rect(
+uint ED_view3d_backbuf_sample_rect(
ViewContext *vc, const int mval[2], int size,
- unsigned int min, unsigned int max, float *r_dist)
+ uint min, uint max, float *r_dist)
{
int dirvec[4][2];
@@ -491,8 +480,6 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph,
Camera *cam = v3d->camera->data;
for (CameraBGImage *bgpic = cam->bg_images.first; bgpic; bgpic = bgpic->next) {
- bgpic->iuser.scene = scene; /* Needed for render results. */
-
if ((bgpic->flag & CAM_BGIMG_FLAG_FOREGROUND) != fg_flag)
continue;
@@ -515,13 +502,16 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph,
ima = bgpic->ima;
if (ima == NULL)
continue;
- BKE_image_user_frame_calc(&bgpic->iuser, (int)DEG_get_ctime(depsgraph));
- if (ima->source == IMA_SRC_SEQUENCE && !(bgpic->iuser.flag & IMA_USER_FRAME_IN_RANGE)) {
+
+ ImageUser iuser = bgpic->iuser;
+ iuser.scene = scene; /* Needed for render results. */
+ BKE_image_user_frame_calc(&iuser, (int)DEG_get_ctime(depsgraph));
+ if (ima->source == IMA_SRC_SEQUENCE && !(iuser.flag & IMA_USER_FRAME_IN_RANGE)) {
ibuf = NULL; /* frame is out of range, dont show */
}
else {
- view3d_stereo_bgpic_setup(scene, v3d, ima, &bgpic->iuser);
- ibuf = BKE_image_acquire_ibuf(ima, &bgpic->iuser, &lock);
+ view3d_stereo_bgpic_setup(scene, v3d, ima, &iuser);
+ ibuf = BKE_image_acquire_ibuf(ima, &iuser, &lock);
releaseibuf = ibuf;
}
@@ -563,7 +553,8 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph,
if (ibuf == NULL)
continue;
- if ((ibuf->rect == NULL && ibuf->rect_float == NULL) || ibuf->channels != 4) { /* invalid image format */
+ if ((ibuf->rect == NULL && ibuf->rect_float == NULL) || ibuf->channels != 4) {
+ /* invalid image format */
if (freeibuf)
IMB_freeImBuf(freeibuf);
if (releaseibuf)
@@ -743,7 +734,7 @@ void ED_view3d_draw_bgpic_test(
/* disabled - mango request, since footage /w only render is quite useful
* and this option is easy to disable all background images at once */
#if 0
- if (v3d->flag2 & V3D_RENDER_OVERRIDE)
+ if (v3d->flag2 & V3D_HIDE_OVERLAYS)
return;
#endif
@@ -767,7 +758,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
.xmin = 0,
.xmax = ar->winx - 1,
.ymin = 0,
- .ymax = ar->winy - 1
+ .ymax = ar->winy - 1,
};
/* Constrain rect to depth bounds */
@@ -888,34 +879,37 @@ void ED_view3d_draw_depth_gpencil(
/* *********************** customdata **************** */
-CustomDataMask ED_view3d_datamask(const Scene *UNUSED(scene), const View3D *v3d)
+void ED_view3d_datamask(
+ const bContext *C, const Scene *UNUSED(scene), const View3D *v3d, CustomData_MeshMasks *r_cddata_masks)
{
- CustomDataMask mask = 0;
const int drawtype = view3d_effective_drawtype(v3d);
if (ELEM(drawtype, OB_TEXTURE, OB_MATERIAL)) {
- mask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL;
+ r_cddata_masks->lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL;
if (drawtype == OB_MATERIAL)
- mask |= CD_MASK_ORCO;
+ r_cddata_masks->vmask |= CD_MASK_ORCO;
}
- return mask;
+ if ((CTX_data_mode_enum(C) == CTX_MODE_EDIT_MESH) &&
+ (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_WEIGHT))
+ {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
/* goes over all modes and view3d settings */
-CustomDataMask ED_view3d_screen_datamask(const Scene *scene, const bScreen *screen)
+void ED_view3d_screen_datamask(
+ const bContext *C, const Scene *scene, const bScreen *screen, CustomData_MeshMasks *r_cddata_masks)
{
- CustomDataMask mask = CD_MASK_BAREMESH;
+ CustomData_MeshMasks_update(r_cddata_masks, &CD_MASK_BAREMESH);
/* check if we need tfaces & mcols due to view mode */
for (const ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
if (sa->spacetype == SPACE_VIEW3D) {
- mask |= ED_view3d_datamask(scene, sa->spacedata.first);
+ ED_view3d_datamask(C, scene, sa->spacedata.first, r_cddata_masks);
}
}
-
- return mask;
}
/**
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 4ac2121c7a4..638efab4598 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_edit.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*
* 3D view manipulation/operators.
*/
@@ -294,19 +287,19 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
else if (ob_act == NULL || ob_act->mode == OB_MODE_OBJECT) {
/* object mode use boundbox centers */
Base *base_eval;
- unsigned int tot = 0;
+ uint tot = 0;
float select_center[3];
zero_v3(select_center);
for (base_eval = FIRSTBASE(view_layer_eval); base_eval; base_eval = base_eval->next) {
- if (TESTBASE(v3d, base_eval)) {
+ if (BASE_SELECTED(v3d, base_eval)) {
/* use the boundbox if we can */
Object *ob_eval = base_eval->object;
- if (ob_eval->bb && !(ob_eval->bb->flag & BOUNDBOX_DIRTY)) {
+ if (ob_eval->runtime.bb && !(ob_eval->runtime.bb->flag & BOUNDBOX_DIRTY)) {
float cent[3];
- BKE_boundbox_calc_center_aabb(ob_eval->bb, cent);
+ BKE_boundbox_calc_center_aabb(ob_eval->runtime.bb, cent);
mul_m4_v3(ob_eval->obmat, cent);
add_v3_v3(select_center, cent);
@@ -457,8 +450,8 @@ static void viewops_data_create(
negate_v3_v3(my_origin, rv3d->ofs); /* ofs is flipped */
- /* Set the dist value to be the distance from this 3d point
- * this means youll always be able to zoom into it and panning wont go bad when dist was zero */
+ /* Set the dist value to be the distance from this 3d point this means youll
+ * always be able to zoom into it and panning wont go bad when dist was zero */
/* remove dist value */
upvec[0] = upvec[1] = 0;
@@ -469,7 +462,8 @@ static void viewops_data_create(
sub_v3_v3v3(my_pivot, rv3d->ofs, upvec);
negate_v3(my_pivot); /* ofs is flipped */
- /* find a new ofs value that is along the view axis (rather than the mouse location) */
+ /* find a new ofs value that is along the view axis
+ * (rather than the mouse location) */
closest_to_line_v3(dvec, vod->dyn_ofs, my_pivot, my_origin);
vod->init.dist = rv3d->dist = len_v3v3(my_pivot, dvec);
@@ -549,7 +543,7 @@ static void viewops_data_free(bContext *C, wmOperator *op)
enum {
VIEW_PASS = 0,
VIEW_APPLY,
- VIEW_CONFIRM
+ VIEW_CONFIRM,
};
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
@@ -574,7 +568,7 @@ void viewrotate_modal_keymap(wmKeyConfig *keyconf)
{VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"},
{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Rotate Modal");
@@ -1224,7 +1218,8 @@ void view3d_ndof_fly(
}
if (!is_zero_v3(trans)) {
- /* move center of view opposite of hand motion (this is camera mode, not object mode) */
+ /* move center of view opposite of hand motion
+ * (this is camera mode, not object mode) */
sub_v3_v3(rv3d->ofs, trans);
has_translate = true;
}
@@ -1579,7 +1574,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
{VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"},
{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Move Modal");
@@ -1706,7 +1701,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewops_data_alloc(C, op);
viewops_data_create(
C, op, event,
- viewops_flag_from_prefs() |
+ (viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT) |
(use_mouse_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0));
vod = op->customdata;
@@ -1771,7 +1766,7 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf)
{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Zoom Modal");
@@ -2203,7 +2198,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewops_data_alloc(C, op);
viewops_data_create(
C, op, event,
- viewops_flag_from_prefs() |
+ (viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT) |
(use_mouse_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0));
vod = op->customdata;
@@ -2302,7 +2297,7 @@ void viewdolly_modal_keymap(wmKeyConfig *keyconf)
{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Dolly Modal");
@@ -2520,7 +2515,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewops_data_create(
C, op, event,
- viewops_flag_from_prefs() |
+ (viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT) |
(use_mouse_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0));
@@ -2601,6 +2596,28 @@ void VIEW3D_OT_dolly(wmOperatorType *ot)
* Move & Zoom the view to fit all of it's contents.
* \{ */
+static bool view3d_object_skip_minmax(
+ const View3D *v3d, const RegionView3D *rv3d, const Object *ob, const bool skip_camera,
+ bool *r_only_center)
+{
+ BLI_assert(ob->id.orig_id == NULL);
+ *r_only_center = false;
+
+ if (skip_camera && (ob == v3d->camera)) {
+ return true;
+ }
+
+ if ((ob->type == OB_EMPTY) &&
+ (ob->empty_drawtype == OB_EMPTY_IMAGE) &&
+ !BKE_object_empty_image_frame_is_visible_in_view3d(ob, rv3d))
+ {
+ *r_only_center = true;
+ return false;
+ }
+
+ return false;
+}
+
static void view3d_from_minmax(
bContext *C, View3D *v3d, ARegion *ar,
const float min[3], const float max[3],
@@ -2645,7 +2662,7 @@ static void view3d_from_minmax(
new_dist = ED_view3d_radius_to_dist(v3d, ar, CTX_data_depsgraph(C), persp, true, (size / 2) * VIEW3D_MARGIN);
if (rv3d->is_persp) {
/* don't zoom closer than the near clipping plane */
- new_dist = max_ff(new_dist, v3d->near * 1.5f);
+ new_dist = max_ff(new_dist, v3d->clip_start * 1.5f);
}
}
}
@@ -2659,12 +2676,13 @@ static void view3d_from_minmax(
C, v3d, ar, smooth_viewtx,
&(const V3D_SmoothParams) {
.camera_old = v3d->camera, .ofs = new_ofs,
- .dist = ok_dist ? &new_dist : NULL});
+ .dist = ok_dist ? &new_dist : NULL,
+ });
}
else {
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.ofs = new_ofs, .dist = ok_dist ? &new_dist : NULL});
+ &(const V3D_SmoothParams) { .ofs = new_ofs, .dist = ok_dist ? &new_dist : NULL, });
}
/* smooth view does viewlock RV3D_BOXVIEW copy */
@@ -2696,6 +2714,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
Scene *scene = CTX_data_scene(C);
const Depsgraph *depsgraph = CTX_data_depsgraph(C);
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
@@ -2716,7 +2735,9 @@ static int view3d_all_exec(bContext *C, wmOperator *op)
zero_v3(min);
zero_v3(max);
zero_v3(cursor->location);
- unit_qt(cursor->rotation);
+ float mat3[3][3];
+ unit_m3(mat3);
+ BKE_scene_cursor_mat3_to_rot(cursor, mat3, false);
}
else {
INIT_MINMAX(min, max);
@@ -2724,14 +2745,19 @@ static int view3d_all_exec(bContext *C, wmOperator *op)
for (base_eval = view_layer_eval->object_bases.first; base_eval; base_eval = base_eval->next) {
if (BASE_VISIBLE(v3d, base_eval)) {
- changed = true;
-
+ bool only_center = false;
Object *ob = DEG_get_original_object(base_eval->object);
- if (skip_camera && ob == v3d->camera) {
+ if (view3d_object_skip_minmax(v3d, rv3d, ob, skip_camera, &only_center)) {
continue;
}
- BKE_object_minmax(base_eval->object, min, max, false);
+ if (only_center) {
+ minmax_v3v3_v3(min, max, base_eval->object->obmat[3]);
+ }
+ else {
+ BKE_object_minmax(base_eval->object, min, max, false);
+ }
+ changed = true;
}
}
@@ -2794,6 +2820,7 @@ static int viewselected_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
Scene *scene = CTX_data_scene(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
@@ -2818,10 +2845,11 @@ static int viewselected_exec(bContext *C, wmOperator *op)
if (ob_eval && (ob_eval->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... */
+ /* this is weak code this way, we should make a generic
+ * active/selection callback interface once... */
Base *base_eval;
for (base_eval = view_layer_eval->object_bases.first; base_eval; base_eval = base_eval->next) {
- if (TESTBASELIB(v3d, base_eval)) {
+ if (BASE_SELECTED_EDITABLE(v3d, base_eval)) {
if (base_eval->object->type == OB_ARMATURE)
if (base_eval->object->mode & OB_MODE_POSE)
break;
@@ -2888,15 +2916,23 @@ static int viewselected_exec(bContext *C, wmOperator *op)
else {
Base *base_eval;
for (base_eval = FIRSTBASE(view_layer_eval); base_eval; base_eval = base_eval->next) {
- if (TESTBASE(v3d, base_eval)) {
-
- if (skip_camera && base_eval->object == v3d->camera) {
+ if (BASE_SELECTED(v3d, base_eval)) {
+ bool only_center = false;
+ Object *ob = DEG_get_original_object(base_eval->object);
+ if (view3d_object_skip_minmax(v3d, rv3d, ob, skip_camera, &only_center)) {
continue;
}
/* account for duplis */
- if (BKE_object_minmax_dupli(depsgraph, scene, base_eval->object, min, max, false) == 0)
- BKE_object_minmax(base_eval->object, min, max, false); /* use if duplis not found */
+ if (BKE_object_minmax_dupli(depsgraph, scene, base_eval->object, min, max, false) == 0) {
+ /* use if duplis not found */
+ if (only_center) {
+ minmax_v3v3_v3(min, max, base_eval->object->obmat[3]);
+ }
+ else {
+ BKE_object_minmax(base_eval->object, min, max, false);
+ }
+ }
ok = 1;
}
@@ -3135,7 +3171,7 @@ void VIEW3D_OT_view_center_pick(wmOperatorType *ot)
/** \name View Camera Center Operator
* \{ */
-static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */
+static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op))
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
@@ -3187,7 +3223,7 @@ void VIEW3D_OT_view_center_camera(wmOperatorType *ot)
/** \name View Lock Center Operator
* \{ */
-static int view3d_center_lock_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */
+static int view3d_center_lock_exec(bContext *C, wmOperator *UNUSED(op))
{
RegionView3D *rv3d = CTX_wm_region_view3d(C);
@@ -3291,7 +3327,7 @@ 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 Region";
ot->description = "Set the boundaries of the border render and enable border render";
ot->idname = "VIEW3D_OT_render_border";
@@ -3351,7 +3387,7 @@ static int clear_render_border_exec(bContext *C, wmOperator *UNUSED(op))
void VIEW3D_OT_clear_render_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Clear Render Border";
+ ot->name = "Clear Render Region";
ot->description = "Clear the boundaries of the border render and disable border render";
ot->idname = "VIEW3D_OT_clear_render_border";
@@ -3440,7 +3476,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
new_dist = len_v3(dvec);
/* ignore dist_range min */
- dist_range[0] = v3d->near * 1.5f;
+ dist_range[0] = v3d->clip_start * 1.5f;
}
else { /* othographic */
/* find the current window width and height */
@@ -3497,7 +3533,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.ofs = new_ofs, .dist = &new_dist});
+ &(const V3D_SmoothParams) { .ofs = new_ofs, .dist = &new_dist, });
if (rv3d->viewlock & RV3D_BOXVIEW) {
view3d_boxview_sync(CTX_wm_area(C), ar);
@@ -3594,7 +3630,7 @@ static const EnumPropertyItem prop_view_items[] = {
{RV3D_VIEW_TOP, "TOP", ICON_TRIA_UP, "Top", "View From the Top"},
{RV3D_VIEW_FRONT, "FRONT", 0, "Front", "View From the Front"},
{RV3D_VIEW_BACK, "BACK", 0, "Back", "View From the Back"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -3642,7 +3678,7 @@ static void axis_set_view(
/* to camera */
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.camera_old = v3d->camera, .ofs = rv3d->ofs, .quat = quat});
+ &(const V3D_SmoothParams) { .camera_old = v3d->camera, .ofs = rv3d->ofs, .quat = quat, });
}
else if (orig_persp == RV3D_CAMOB && v3d->camera) {
/* from camera */
@@ -3657,7 +3693,7 @@ static void axis_set_view(
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.ofs = ofs, .quat = quat, .dist = &dist});
+ &(const V3D_SmoothParams) { .ofs = ofs, .quat = quat, .dist = &dist, });
}
else {
/* rotate around selection */
@@ -3674,7 +3710,7 @@ static void axis_set_view(
/* no camera involved */
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.quat = quat, .dyn_ofs = dyn_ofs_pt});
+ &(const V3D_SmoothParams) { .quat = quat, .dyn_ofs = dyn_ofs_pt, });
}
}
@@ -3872,7 +3908,8 @@ static int view_camera_exec(bContext *C, wmOperator *op)
C, v3d, ar, smooth_viewtx,
&(const V3D_SmoothParams) {
.camera = v3d->camera, .ofs = rv3d->ofs, .quat = rv3d->viewquat,
- .dist = &rv3d->dist, .lens = &v3d->lens});
+ .dist = &rv3d->dist, .lens = &v3d->lens,
+ });
}
else {
/* return to settings of last view */
@@ -3912,7 +3949,7 @@ static const EnumPropertyItem prop_view_orbit_items[] = {
{V3D_VIEW_STEPRIGHT, "ORBITRIGHT", 0, "Orbit Right", "Orbit the view around to the Right"},
{V3D_VIEW_STEPUP, "ORBITUP", 0, "Orbit Up", "Orbit the view Up"},
{V3D_VIEW_STEPDOWN, "ORBITDOWN", 0, "Orbit Down", "Orbit the view Down"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int vieworbit_exec(bContext *C, wmOperator *op)
@@ -3998,7 +4035,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.quat = quat_new, .dyn_ofs = dyn_ofs_pt});
+ &(const V3D_SmoothParams) { .quat = quat_new, .dyn_ofs = dyn_ofs_pt, });
return OPERATOR_FINISHED;
}
@@ -4138,7 +4175,7 @@ static const EnumPropertyItem prop_view_roll_items[] = {
{0, "ANGLE", 0, "Roll Angle", "Roll the view using an angle value"},
{V3D_VIEW_STEPLEFT, "LEFT", 0, "Roll Left", "Roll the view around to the Left"},
{V3D_VIEW_STEPRIGHT, "RIGHT", 0, "Roll Right", "Roll the view around to the Right"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -4188,7 +4225,7 @@ static int viewroll_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(
C, v3d, ar, smooth_viewtx,
- &(const V3D_SmoothParams) {.quat = quat_new, .dyn_ofs = dyn_ofs_pt});
+ &(const V3D_SmoothParams) { .quat = quat_new, .dyn_ofs = dyn_ofs_pt, });
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -4274,7 +4311,7 @@ static const EnumPropertyItem prop_view_pan_items[] = {
{V3D_VIEW_PANRIGHT, "PANRIGHT", 0, "Pan Right", "Pan the view to the Right"},
{V3D_VIEW_PANUP, "PANUP", 0, "Pan Up", "Pan the view Up"},
{V3D_VIEW_PANDOWN, "PANDOWN", 0, "Pan Down", "Pan the view Down"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/** \} */
@@ -4296,7 +4333,7 @@ static int viewpan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
else if (pandir == V3D_VIEW_PANDOWN) { y = 25; }
viewops_data_alloc(C, op);
- viewops_data_create(C, op, event, viewops_flag_from_prefs());
+ viewops_data_create(C, op, event, (viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT));
ViewOpsData *vod = op->customdata;
viewmove_apply(vod, vod->prev.event_xy[0] + x, vod->prev.event_xy[1] + y);
@@ -4558,8 +4595,6 @@ void ED_view3d_clipping_local(RegionView3D *rv3d, float mat[4][4])
calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);
}
-#if 0 /* TODO Missing from 2.8 drawing code. Find a solution to support clip border then uncomment it. */
-
static int view3d_clipping_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
@@ -4598,8 +4633,8 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Clipping Border";
- ot->description = "Set the view clipping border";
+ ot->name = "Clipping Region";
+ ot->description = "Set the view clipping region";
ot->idname = "VIEW3D_OT_clip_border";
/* api callbacks */
@@ -4616,7 +4651,6 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
/* properties */
WM_operator_properties_border(ot);
}
-#endif
/** \} */
@@ -4765,10 +4799,30 @@ void ED_view3d_cursor3d_update(
View3DCursor *cursor_curr = &scene->cursor;
View3DCursor cursor_prev = *cursor_curr;
- ED_view3d_cursor3d_position_rotation(
- C, mval,
- use_depth, orientation,
- cursor_curr->location, cursor_curr->rotation);
+ {
+ float quat[4], quat_prev[4];
+ BKE_scene_cursor_rot_to_quat(cursor_curr, quat);
+ copy_qt_qt(quat_prev, quat);
+ ED_view3d_cursor3d_position_rotation(
+ C, mval,
+ use_depth, orientation,
+ cursor_curr->location, quat);
+
+ if (!equals_v4v4(quat_prev, quat)) {
+ if ((cursor_curr->rotation_mode == ROT_MODE_AXISANGLE) &&
+ RV3D_VIEW_IS_AXIS(rv3d->view))
+ {
+ float tmat[3][3], cmat[3][3];
+ quat_to_mat3(tmat, quat);
+ negate_v3_v3(cursor_curr->rotation_axis, tmat[2]);
+ axis_angle_to_mat3(cmat, cursor_curr->rotation_axis, 0.0f);
+ cursor_curr->rotation_angle = angle_signed_on_axis_v3v3_v3(cmat[0], tmat[0], cursor_curr->rotation_axis);
+ }
+ else {
+ BKE_scene_cursor_quat_to_rot(cursor_curr, quat, true);
+ }
+ }
+ }
/* offset the cursor lock to avoid jumping to new offset */
if (v3d->ob_centre_cursor) {
@@ -4786,7 +4840,8 @@ void ED_view3d_cursor3d_update(
}
}
else {
- /* Cursor may be outside of the view, prevent it getting 'lost', see: T40353 & T45301 */
+ /* Cursor may be outside of the view,
+ * prevent it getting 'lost', see: T40353 & T45301 */
zero_v2(rv3d->ofs_lock);
}
}
@@ -4798,8 +4853,9 @@ void ED_view3d_cursor3d_update(
{
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
- WM_msg_publish_rna_prop(
- mbus, &scene->id, scene, Scene, cursor_location);
+ wmMsgParams_RNA msg_key_params = {{{0}}};
+ RNA_pointer_create(&scene->id, &RNA_View3DCursor, &scene->cursor, &msg_key_params.ptr);
+ WM_msg_publish_rna_params(mbus, &msg_key_params);
}
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
@@ -4845,7 +4901,7 @@ void VIEW3D_OT_cursor3d(wmOperatorType *ot)
{V3D_CURSOR_ORIENT_VIEW, "VIEW", 0, "View", "Orient to the viewport"},
{V3D_CURSOR_ORIENT_XFORM, "XFORM", 0, "Transform", "Orient to the current transform setting"},
{V3D_CURSOR_ORIENT_GEOM, "GEOM", 0, "Geometry", "Match the surface normal"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_boolean(
@@ -4870,7 +4926,7 @@ static const EnumPropertyItem prop_shading_type_items[] = {
{OB_SOLID, "SOLID", 0, "Solid", "Toggle solid shading"},
{OB_MATERIAL, "MATERIAL", 0, "LookDev", "Toggle lookdev shading"},
{OB_RENDER, "RENDERED", 0, "Rendered", "Toggle rendered shading"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int toggle_shading_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index de5d5d29e52..47961371530 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,21 +12,18 @@
* 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 *****
*/
-/** \file blender/editors/space_view3d/view3d_fly.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
/* defines VIEW3D_OT_fly modal operator */
#ifdef WITH_INPUT_NDOF
//# define NDOF_FLY_DEBUG
-//# define NDOF_FLY_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesn't thrash - campbell */
+/* is this needed for ndof? - commented so redraw doesn't thrash - campbell */
+//# define NDOF_FLY_DRAW_TOOMUCH
#endif /* WITH_INPUT_NDOF */
#include "DNA_object_types.h"
@@ -43,7 +38,6 @@
#include "BLT_translation.h"
-#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -62,7 +56,8 @@
#include "view3d_intern.h" /* own include */
-/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
+/* NOTE: these defines are saved in keymap files,
+ * do not change values but just add new ones */
enum {
FLY_MODAL_CANCEL = 1,
FLY_MODAL_CONFIRM,
@@ -90,12 +85,13 @@ typedef enum eFlyPanState {
/* disabled */
FLY_AXISLOCK_STATE_OFF = 0,
- /* 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. */
+ /* 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. */
FLY_AXISLOCK_STATE_IDLE = 1,
- /* mouse moved and checking needed, if no view altering is done its changed back to #FLY_AXISLOCK_STATE_IDLE */
- FLY_AXISLOCK_STATE_ACTIVE = 2
+ /* mouse moved and checking needed,
+ * if no view altering is done its changed back to #FLY_AXISLOCK_STATE_IDLE */
+ FLY_AXISLOCK_STATE_ACTIVE = 2,
} eFlyPanState;
/* called in transform_ops.c, on each regeneration of keymaps */
@@ -127,7 +123,8 @@ void fly_modal_keymap(wmKeyConfig *keyconf)
{FLY_MODAL_FREELOOK_ENABLE, "FREELOOK_ENABLE", 0, "Rotation", ""},
{FLY_MODAL_FREELOOK_DISABLE, "FREELOOK_DISABLE", 0, "Rotation (Off)", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Fly Modal");
@@ -531,7 +528,8 @@ static void flyEvent(bContext *C, wmOperator *op, FlyInfo *fly, const wmEvent *e
time_wheel = (float)(time_currwheel - fly->time_lastwheel);
fly->time_lastwheel = time_currwheel;
/* Mouse wheel delays range from (0.5 == slow) to (0.01 == fast) */
- time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
+ /* 0-0.5 -> 0-5.0 */
+ time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f)));
if (fly->speed < 0.0f) {
fly->speed = 0.0f;
@@ -555,7 +553,8 @@ static void flyEvent(bContext *C, wmOperator *op, FlyInfo *fly, const wmEvent *e
time_currwheel = PIL_check_seconds_timer();
time_wheel = (float)(time_currwheel - fly->time_lastwheel);
fly->time_lastwheel = time_currwheel;
- time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
+ /* 0-0.5 -> 0-5.0 */
+ time_wheel = 1.0f + (10.0f - (20.0f * min_ff(time_wheel, 0.5f)));
if (fly->speed > 0.0f) {
fly->speed = 0;
@@ -575,7 +574,8 @@ static void flyEvent(bContext *C, wmOperator *op, FlyInfo *fly, const wmEvent *e
/* implement WASD keys,
* comments only for 'forward '*/
case FLY_MODAL_DIR_FORWARD:
- if (fly->axis == 2 && fly->speed < 0.0f) { /* reverse direction stops, tap again to continue */
+ if (fly->axis == 2 && fly->speed < 0.0f) {
+ /* reverse direction stops, tap again to continue */
fly->axis = -1;
}
else {
@@ -694,18 +694,21 @@ static int flyApply(bContext *C, FlyInfo *fly)
*/
RegionView3D *rv3d = fly->rv3d;
- float mat[3][3]; /* 3x3 copy of the view matrix so we can move along the view axis */
- float dvec[3] = {0, 0, 0}; /* this is the direction that's added to the view offset per redraw */
+ /* 3x3 copy of the view matrix so we can move along the view axis */
+ float mat[3][3];
+ /* this is the direction that's added to the view offset per redraw */
+ float dvec[3] = {0, 0, 0};
/* Camera Uprighting variables */
float moffset[2]; /* mouse offset from the views center */
float tmp_quat[4]; /* used for rotating the view */
- int xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */
+ /* x and y margin are define the safe area where the mouses movement wont rotate the view */
+ int xmargin, ymargin;
#ifdef NDOF_FLY_DEBUG
{
- static unsigned int iteration = 1;
+ static uint iteration = 1;
printf("fly timer %d\n", iteration++);
}
#endif
@@ -763,7 +766,10 @@ static int flyApply(bContext *C, FlyInfo *fly)
#endif
time_current = PIL_check_seconds_timer();
time_redraw = (float)(time_current - fly->time_lastdraw);
- time_redraw_clamped = min_ff(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */
+
+ /* clamp redraw time to avoid jitter in roll correction */
+ time_redraw_clamped = min_ff(0.05f, time_redraw);
+
fly->time_lastdraw = time_current;
/* Scale the time to use shift to scale the speed down- just like
@@ -853,7 +859,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
fly->zlock_momentum += FLY_ZUP_CORRECT_ACCEL;
}
else {
- fly->zlock = FLY_AXISLOCK_STATE_IDLE; /* don't check until the view rotates again */
+ /* don't check until the view rotates again */
+ fly->zlock = FLY_AXISLOCK_STATE_IDLE;
fly->zlock_momentum = 0.0f;
}
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_armature.c b/source/blender/editors/space_view3d/view3d_gizmo_armature.c
index 3d7e8065a9f..47f9cc580ea 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_armature.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_armature.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_armature.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "BLI_blenlib.h"
@@ -51,7 +47,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Armature Spline Gizmo
*
* \{ */
@@ -130,7 +125,7 @@ static void gizmo_bbone_offset_set(
static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
return false;
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
index bf37f9c3b49..a3859a8468e 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_camera.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -47,11 +43,12 @@
#include "WM_types.h"
#include "WM_message.h"
+#include "DEG_depsgraph.h"
+
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
-
/** \name Camera Gizmos
* \{ */
@@ -64,7 +61,7 @@ struct CameraWidgetGroup {
static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
return false;
@@ -177,7 +174,7 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
/* account for lens shifting */
- offset[0] = ((ob->size[0] > 0.0f) ? -2.0f : 2.0f) * ca->shiftx;
+ offset[0] = ((ob->scale[0] > 0.0f) ? -2.0f : 2.0f) * ca->shiftx;
offset[1] = 2.0f * ca->shifty;
offset[2] = 0.0f;
@@ -307,11 +304,13 @@ void VIEW3D_GGT_camera(wmGizmoGroupType *gzgt)
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name CameraView Gizmos
* \{ */
struct CameraViewWidgetGroup {
+ Scene *scene;
+ bool is_camera;
+
wmGizmo *border;
struct {
@@ -348,7 +347,11 @@ static void gizmo_render_border_prop_matrix_set(
BLI_rctf_resize(border, len_v3(matrix[0]), len_v3(matrix[1]));
BLI_rctf_recenter(border, matrix[3][0], matrix[3][1]);
- BLI_rctf_isect(&(rctf){.xmin = 0, .ymin = 0, .xmax = 1, .ymax = 1}, border, border);
+ BLI_rctf_isect(&(rctf){ .xmin = 0, .ymin = 0, .xmax = 1, .ymax = 1, }, border, border);
+
+ if (viewgroup->is_camera) {
+ DEG_id_tag_update(&viewgroup->scene->id, ID_RECALC_COPY_ON_WRITE);
+ }
}
static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
@@ -366,7 +369,7 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *UN
}
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
return false;
@@ -416,7 +419,7 @@ static void WIDGETGROUP_camera_view_draw_prepare(const bContext *C, wmGizmoGroup
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &viewgroup->state.view_border, false);
}
else {
- viewgroup->state.view_border = (rctf){.xmin = 0, .ymin = 0, .xmax = ar->winx, .ymax = ar->winy};
+ viewgroup->state.view_border = (rctf){ .xmin = 0, .ymin = 0, .xmax = ar->winx, .ymax = ar->winy, };
}
wmGizmo *gz = viewgroup->border;
@@ -436,6 +439,8 @@ static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmGizmoGroup *gzg
RegionView3D *rv3d = ar->regiondata;
Scene *scene = CTX_data_scene(C);
+ viewgroup->scene = scene;
+
{
wmGizmo *gz = viewgroup->border;
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
@@ -445,9 +450,11 @@ static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmGizmoGroup *gzg
if (rv3d->persp == RV3D_CAMOB) {
viewgroup->state.edit_border = &scene->r.border;
+ viewgroup->is_camera = true;
}
else {
viewgroup->state.edit_border = &v3d->render_border;
+ viewgroup->is_camera = false;
}
WM_gizmo_target_property_def_func(
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
index b0eb9993576..7d6ec3b782f 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_empty.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -34,7 +29,7 @@
#include "DEG_depsgraph.h"
#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "ED_screen.h"
#include "ED_gizmo_library.h"
@@ -51,7 +46,6 @@
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
-
/** \name Empty Image Gizmos
* \{ */
@@ -112,7 +106,7 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UN
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
return false;
@@ -124,7 +118,7 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UN
Object *ob = base->object;
if (ob->type == OB_EMPTY) {
if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
- return BKE_object_empty_image_is_visible_in_view3d(ob, rv3d);
+ return BKE_object_empty_image_frame_is_visible_in_view3d(ob, rv3d);
}
}
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
index b49a38085a1..750a8101a15 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_forcefield.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -48,7 +42,6 @@
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
-
/** \name Force Field Gizmos
* \{ */
@@ -56,7 +49,7 @@ static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmGizmoGroupType *UNU
{
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
return false;
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_lamp.c b/source/blender/editors/space_view3d/view3d_gizmo_light.c
index a723dae058a..90f1b60e21a 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_lamp.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_light.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_lamp.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -33,7 +28,7 @@
#include "DEG_depsgraph.h"
#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "ED_screen.h"
#include "ED_gizmo_library.h"
@@ -50,14 +45,13 @@
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
-
-/** \name Spot Lamp Gizmos
+/** \name Spot Light Gizmos
* \{ */
-static bool WIDGETGROUP_lamp_spot_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
+static bool WIDGETGROUP_light_spot_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
return false;
@@ -68,14 +62,14 @@ static bool WIDGETGROUP_lamp_spot_poll(const bContext *C, wmGizmoGroupType *UNUS
if (base && BASE_SELECTABLE(v3d, base)) {
Object *ob = base->object;
if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
return (la->type == LA_SPOT);
}
}
return false;
}
-static void WIDGETGROUP_lamp_spot_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_spot_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__);
@@ -90,13 +84,13 @@ static void WIDGETGROUP_lamp_spot_setup(const bContext *UNUSED(C), wmGizmoGroup
UI_GetThemeColor3fv(TH_GIZMO_SECONDARY, gz->color);
}
-static void WIDGETGROUP_lamp_spot_refresh(const bContext *C, wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_spot_refresh(const bContext *C, wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = gzgroup->customdata;
wmGizmo *gz = wwrapper->gizmo;
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
- Lamp *la = ob->data;
+ Light *la = ob->data;
float dir[3];
negate_v3_v3(dir, ob->obmat[2]);
@@ -111,47 +105,46 @@ static void WIDGETGROUP_lamp_spot_refresh(const bContext *C, wmGizmoGroup *gzgro
WM_gizmo_target_property_def_rna(gz, "offset", &lamp_ptr, propname, -1);
}
-void VIEW3D_GGT_lamp_spot(wmGizmoGroupType *gzgt)
+void VIEW3D_GGT_light_spot(wmGizmoGroupType *gzgt)
{
gzgt->name = "Spot Light Widgets";
- gzgt->idname = "VIEW3D_GGT_lamp_spot";
+ gzgt->idname = "VIEW3D_GGT_light_spot";
gzgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT |
WM_GIZMOGROUPTYPE_3D |
WM_GIZMOGROUPTYPE_DEPTH_3D);
- gzgt->poll = WIDGETGROUP_lamp_spot_poll;
- gzgt->setup = WIDGETGROUP_lamp_spot_setup;
- gzgt->refresh = WIDGETGROUP_lamp_spot_refresh;
+ gzgt->poll = WIDGETGROUP_light_spot_poll;
+ gzgt->setup = WIDGETGROUP_light_spot_setup;
+ gzgt->refresh = WIDGETGROUP_light_spot_refresh;
}
/** \} */
/* -------------------------------------------------------------------- */
-
-/** \name Area Lamp Gizmos
+/** \name Area Light Gizmos
* \{ */
/* scale callbacks */
-static void gizmo_area_lamp_prop_matrix_get(
+static void gizmo_area_light_prop_matrix_get(
const wmGizmo *UNUSED(gz), wmGizmoProperty *gz_prop,
void *value_p)
{
BLI_assert(gz_prop->type->array_length == 16);
float (*matrix)[4] = value_p;
- const Lamp *la = gz_prop->custom_func.user_data;
+ const Light *la = gz_prop->custom_func.user_data;
matrix[0][0] = la->area_size;
matrix[1][1] = ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_ELLIPSE) ? la->area_sizey : la->area_size;
}
-static void gizmo_area_lamp_prop_matrix_set(
+static void gizmo_area_light_prop_matrix_set(
const wmGizmo *UNUSED(gz), wmGizmoProperty *gz_prop,
const void *value_p)
{
const float (*matrix)[4] = value_p;
BLI_assert(gz_prop->type->array_length == 16);
- Lamp *la = gz_prop->custom_func.user_data;
+ Light *la = gz_prop->custom_func.user_data;
if (ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_ELLIPSE)) {
la->area_size = len_v3(matrix[0]);
@@ -165,10 +158,10 @@ static void gizmo_area_lamp_prop_matrix_set(
WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, la);
}
-static bool WIDGETGROUP_lamp_area_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
+static bool WIDGETGROUP_light_area_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+ if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
return false;
}
@@ -177,14 +170,14 @@ static bool WIDGETGROUP_lamp_area_poll(const bContext *C, wmGizmoGroupType *UNUS
if (base && BASE_SELECTABLE(v3d, base)) {
Object *ob = base->object;
if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
return (la->type == LA_AREA);
}
}
return false;
}
-static void WIDGETGROUP_lamp_area_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_area_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__);
wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_cage_2d", gzgroup, NULL);
@@ -200,12 +193,12 @@ static void WIDGETGROUP_lamp_area_setup(const bContext *UNUSED(C), wmGizmoGroup
UI_GetThemeColor3fv(TH_GIZMO_HI, gz->color_hi);
}
-static void WIDGETGROUP_lamp_area_refresh(const bContext *C, wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_area_refresh(const bContext *C, wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = gzgroup->customdata;
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
- Lamp *la = ob->data;
+ Light *la = ob->data;
wmGizmo *gz = wwrapper->gizmo;
copy_m4_m4(gz->matrix_basis, ob->obmat);
@@ -220,39 +213,38 @@ static void WIDGETGROUP_lamp_area_refresh(const bContext *C, wmGizmoGroup *gzgro
WM_gizmo_target_property_def_func(
gz, "matrix",
&(const struct wmGizmoPropertyFnParams) {
- .value_get_fn = gizmo_area_lamp_prop_matrix_get,
- .value_set_fn = gizmo_area_lamp_prop_matrix_set,
+ .value_get_fn = gizmo_area_light_prop_matrix_get,
+ .value_set_fn = gizmo_area_light_prop_matrix_set,
.range_get_fn = NULL,
.user_data = la,
});
}
-void VIEW3D_GGT_lamp_area(wmGizmoGroupType *gzgt)
+void VIEW3D_GGT_light_area(wmGizmoGroupType *gzgt)
{
gzgt->name = "Area Light Widgets";
- gzgt->idname = "VIEW3D_GGT_lamp_area";
+ gzgt->idname = "VIEW3D_GGT_light_area";
gzgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT |
WM_GIZMOGROUPTYPE_3D |
WM_GIZMOGROUPTYPE_DEPTH_3D);
- gzgt->poll = WIDGETGROUP_lamp_area_poll;
- gzgt->setup = WIDGETGROUP_lamp_area_setup;
- gzgt->refresh = WIDGETGROUP_lamp_area_refresh;
+ gzgt->poll = WIDGETGROUP_light_area_poll;
+ gzgt->setup = WIDGETGROUP_light_area_setup;
+ gzgt->refresh = WIDGETGROUP_light_area_refresh;
}
/** \} */
/* -------------------------------------------------------------------- */
-
-/** \name Lamp Target Gizmo
+/** \name Light Target Gizmo
* \{ */
-static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
+static bool WIDGETGROUP_light_target_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+ if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
return false;
}
@@ -261,7 +253,7 @@ static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmGizmoGroupType *UN
if (base && BASE_SELECTABLE(v3d, base)) {
Object *ob = base->object;
if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
return (ELEM(la->type, LA_SUN, LA_SPOT, LA_AREA));
}
#if 0
@@ -273,7 +265,7 @@ static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmGizmoGroupType *UN
return false;
}
-static void WIDGETGROUP_lamp_target_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_target_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__);
wwrapper->gizmo = WM_gizmo_new("GIZMO_GT_move_3d", gzgroup, NULL);
@@ -294,7 +286,7 @@ static void WIDGETGROUP_lamp_target_setup(const bContext *UNUSED(C), wmGizmoGrou
WM_gizmo_operator_set(gz, 0, ot, NULL);
}
-static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_light_target_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
wmGizmoWrapper *wwrapper = gzgroup->customdata;
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -305,9 +297,9 @@ static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmGizmoGroup
unit_m4(gz->matrix_offset);
if (ob->type == OB_LAMP) {
- Lamp *la = ob->data;
+ Light *la = ob->data;
if (la->type == LA_SPOT) {
- /* Draw just past the lamp size angle gizmo. */
+ /* Draw just past the light size angle gizmo. */
madd_v3_v3fl(gz->matrix_basis[3], gz->matrix_basis[2], -la->spotsize);
}
}
@@ -315,17 +307,17 @@ static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmGizmoGroup
WM_gizmo_set_flag(gz, WM_GIZMO_DRAW_OFFSET_SCALE, true);
}
-void VIEW3D_GGT_lamp_target(wmGizmoGroupType *gzgt)
+void VIEW3D_GGT_light_target(wmGizmoGroupType *gzgt)
{
gzgt->name = "Target Light Widgets";
- gzgt->idname = "VIEW3D_GGT_lamp_target";
+ gzgt->idname = "VIEW3D_GGT_light_target";
gzgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT |
WM_GIZMOGROUPTYPE_3D);
- gzgt->poll = WIDGETGROUP_lamp_target_poll;
- gzgt->setup = WIDGETGROUP_lamp_target_setup;
- gzgt->draw_prepare = WIDGETGROUP_lamp_target_draw_prepare;
+ gzgt->poll = WIDGETGROUP_light_target_poll;
+ gzgt->setup = WIDGETGROUP_light_target_setup;
+ gzgt->draw_prepare = WIDGETGROUP_light_target_draw_prepare;
}
/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
index 0d9f7eef922..acf6aa7e188 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_navigate.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
-#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -126,7 +121,7 @@ static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType *UNUSE
{
View3D *v3d = CTX_wm_view3d(C);
if (((U.uiflag & USER_SHOW_GIZMO_AXIS) == 0) ||
- (v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ (v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_NAVIGATE)))
{
return false;
@@ -153,16 +148,29 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
if (i == GZ_INDEX_ROTATE) {
gz->color[3] = 0.0f;
- gz->color_hi[3] = 0.1f;
+ copy_v3_fl(gz->color_hi, 0.5f);
+ gz->color_hi[3] = 0.5f;
}
else {
- UI_GetThemeColorShade3fv(TH_HEADER, -40, gz->color);
- UI_GetThemeColorShade3fv(TH_HEADER, 160, gz->color_hi);
- gz->color[3] = 0.4f;
- gz->color_hi[3] = 0.2f;
+ uchar icon_color[3];
+ UI_GetThemeColor3ubv(TH_TEXT, icon_color);
+ int color_tint, color_tint_hi;
+ if (icon_color[0] > 128) {
+ color_tint = -40;
+ color_tint_hi = 60;
+ gz->color[3] = 0.5f;
+ gz->color_hi[3] = 0.5f;
+ }
+ else {
+ color_tint = 60;
+ color_tint_hi = 60;
+ gz->color[3] = 0.5f;
+ gz->color_hi[3] = 0.75f;
+ }
+ UI_GetThemeColorShade3fv(TH_HEADER, color_tint, gz->color);
+ UI_GetThemeColorShade3fv(TH_HEADER, color_tint_hi, gz->color_hi);
}
-
/* may be overwritten later */
gz->scale_basis = (GIZMO_SIZE * GIZMO_MINI_FAC) / 2;
if (info->icon != 0) {
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
index f57ff4464e0..f9b67a430e6 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file view3d_gizmo_navigate_type.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \name Custom Orientation/Navigation Gizmo for the 3D View
*
@@ -37,8 +33,6 @@
#include "BKE_context.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
@@ -267,30 +261,24 @@ static void axis_geom_draw(
}
#endif
+ /* When the cursor is over any of the gizmos (show circle backdrop). */
+ const bool is_active = (color[3] != 0.0f);
+
+ /* Circle defining active area. */
+ if (is_active) {
+ immUniformColor4fv(color);
+ imm_draw_circle_fill_3d(pos_id, 0, 0, 1.0f, DIAL_RESOLUTION);
+ }
+
GPU_matrix_push();
GPU_matrix_mul(gz->matrix_offset);
- bool draw_center_done = false;
-
for (int axis_index = 0; axis_index < ARRAY_SIZE(axis_order); axis_index++) {
const int index = axis_order[axis_index].index;
const int axis = axis_order[axis_index].axis;
const bool is_pos = axis_order[axis_index].is_pos;
const bool is_highlight = index + 1 == gz->highlight_part;
- /* Draw slightly before, so axis aligned arrows draw ontop. */
- if ((draw_center_done == false) && (axis_order[axis_index].depth > -axis_depth_bias)) {
-
- /* Circle defining active area (revert back to 2D space). */
- if (color[3] != 0.0f) {
- GPU_matrix_pop();
- immUniformColor4fv(color);
- imm_draw_circle_fill_3d(pos_id, 0, 0, 1.0f, DIAL_RESOLUTION);
- GPU_matrix_push();
- GPU_matrix_mul(gz->matrix_offset);
- }
- draw_center_done = true;
- }
UI_GetThemeColor3fv(TH_AXIS_X + axis, axis_color[axis]);
axis_color[axis][3] = 1.0f;
@@ -367,6 +355,18 @@ static void axis_geom_draw(
GPUBatch *sphere = GPU_batch_preset_sphere(0);
GPU_batch_program_set_builtin(sphere, GPU_SHADER_3D_UNIFORM_COLOR);
+
+ /* Black outlines for negative axis balls, otherwise they can be hard to see since
+ * they use a faded color which can be similar to the circle backdrop in tone. */
+ if (is_active && !is_highlight && !is_pos && !select && !(axis_align == axis)) {
+ static const float axis_black_faded[4] = {0, 0, 0, 0.2f};
+ const float scale = 1.15f;
+ GPU_matrix_scale_1f(scale);
+ GPU_batch_uniform_4fv(sphere, "color", axis_black_faded);
+ GPU_batch_draw(sphere);
+ GPU_matrix_scale_1f(1.0 / scale);
+ }
+
GPU_batch_uniform_4fv(sphere, "color", is_pos_color ? color_current : color_current_fade);
GPU_batch_draw(sphere);
GPU_matrix_pop();
@@ -485,7 +485,8 @@ static int gizmo_axis_test_select(
bool ok = true;
- /* Check if we're viewing on an axis, there is no point to clicking on the current axis so show the reverse. */
+ /* Check if we're viewing on an axis,
+ * there is no point to clicking on the current axis so show the reverse. */
if (len_squared_v2(co) < 1e-6f && (gz->matrix_offset[i][2] > 0.0f) == is_pos) {
ok = false;
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_preselect.c b/source/blender/editors/space_view3d/view3d_gizmo_preselect.c
index 7b8e3a76c85..b71c03684d6 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_preselect.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_preselect.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_preselect.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
index be07928d5fc..418a9e76678 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file view3d_gizmo_preselect_type.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \name Preselection Gizmo
*
@@ -427,3 +423,62 @@ void ED_gizmotypes_preselect_3d(void)
}
/** \} */
+
+
+/* -------------------------------------------------------------------- */
+/** \name Gizmo Accessors
+ *
+ * This avoids each user of the gizmo needing to write their own look-ups to access
+ * the information from this gizmo.
+ * \{ */
+
+void ED_view3d_gizmo_mesh_preselect_get_active(
+ bContext *C, wmGizmo *gz,
+ Base **r_base, BMElem **r_ele)
+{
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+
+ const int object_index = RNA_int_get(gz->ptr, "object_index");
+
+ /* weak, allocate an array just to access the index. */
+ Base *base = NULL;
+ Object *obedit = NULL;
+ {
+ uint bases_len;
+ Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(view_layer, CTX_wm_view3d(C), &bases_len);
+ if (object_index < bases_len) {
+ base = bases[object_index];
+ obedit = base->object;
+ }
+ MEM_freeN(bases);
+ }
+
+ *r_base = base;
+ *r_ele = NULL;
+
+ if (obedit) {
+ BMEditMesh *em = BKE_editmesh_from_object(obedit);
+ BMesh *bm = em->bm;
+ PropertyRNA *prop;
+
+ /* Ring select only defines edge, check properties exist first. */
+ prop = RNA_struct_find_property(gz->ptr, "vert_index");
+ const int vert_index = prop ? RNA_property_int_get(gz->ptr, prop) : -1;
+ prop = RNA_struct_find_property(gz->ptr, "edge_index");
+ const int edge_index = prop ? RNA_property_int_get(gz->ptr, prop) : -1;
+ prop = RNA_struct_find_property(gz->ptr, "face_index");
+ const int face_index = prop ? RNA_property_int_get(gz->ptr, prop) : -1;
+
+ if (vert_index != -1) {
+ *r_ele = (BMElem *)BM_vert_at_index_find(bm, vert_index);
+ }
+ else if (edge_index != -1) {
+ *r_ele = (BMElem *)BM_edge_at_index_find(bm, edge_index);
+ }
+ else if (face_index != -1) {
+ *r_ele = (BMElem *)BM_face_at_index_find(bm, face_index);
+ }
+ }
+}
+
+/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index ed5a1ab7720..09757e13297 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_gizmo_ruler.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "BLI_listbase.h"
@@ -44,8 +40,6 @@
#include "DNA_gpencil_types.h"
#include "DNA_view3d_types.h"
-#include "BIF_gl.h"
-
#include "ED_gizmo_utils.h"
#include "ED_gpencil.h"
#include "ED_screen.h"
@@ -72,7 +66,6 @@
#include "BLF_api.h"
-
static const char *view3d_gzgt_ruler_id = "VIEW3D_GGT_ruler";
@@ -80,16 +73,15 @@ static const char *view3d_gzgt_ruler_id = "VIEW3D_GGT_ruler";
/* -------------------------------------------------------------------- */
/* Ruler Item (we can have many) */
-enum {
- RULERITEM_USE_ANGLE = (1 << 0), /* use protractor */
- RULERITEM_USE_RAYCAST = (1 << 1)
-};
enum {
- RULERITEM_DIRECTION_IN = 0,
- RULERITEM_DIRECTION_OUT
+ /** Use protractor. */
+ RULERITEM_USE_ANGLE = (1 << 0),
+ /** Protractor vertex is selected (deleting removes it). */
+ RULERITEM_USE_ANGLE_ACTIVE = (1 << 1),
};
+
/* keep smaller then selection, since we may want click elsewhere without selecting a ruler */
#define RULER_PICK_DIST 12.0f
#define RULER_PICK_DIST_SQ (RULER_PICK_DIST * RULER_PICK_DIST)
@@ -102,16 +94,17 @@ enum {
enum {
RULER_STATE_NORMAL = 0,
- RULER_STATE_DRAG
+ RULER_STATE_DRAG,
};
enum {
RULER_SNAP_OK = (1 << 0),
};
+struct RulerItem;
+
typedef struct RulerInfo {
- // ListBase items;
- int item_active;
+ struct RulerItem *item_active;
int flag;
int snap_flag;
int state;
@@ -141,7 +134,6 @@ typedef struct RulerInteraction {
/* selected coord */
char co_index; /* 0 -> 2 */
float drag_start_co[3];
- uint inside_region : 1;
} RulerInteraction;
/* -------------------------------------------------------------------- */
@@ -159,6 +151,10 @@ static RulerItem *ruler_item_add(wmGizmoGroup *gzgroup)
static void ruler_item_remove(bContext *C, wmGizmoGroup *gzgroup, RulerItem *ruler_item)
{
+ RulerInfo *ruler_info = gzgroup->customdata;
+ if (ruler_info->item_active == ruler_item) {
+ ruler_info->item_active = NULL;
+ }
WM_gizmo_unlink(&gzgroup->gizmos, gzgroup->parent_gzmap, &ruler_item->gz, C);
}
@@ -513,8 +509,8 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
const int arc_steps = ARC_STEPS;
const float color_act[4] = {1.0f, 1.0f, 1.0f, 1.0f};
const float color_base[4] = {0.0f, 0.0f, 0.0f, 1.0f};
- unsigned char color_text[3];
- unsigned char color_wire[3];
+ uchar color_text[3];
+ uchar color_wire[3];
float color_back[4] = {1.0f, 1.0f, 1.0f, 0.5f};
/* anti-aliased lines for more consistent appearance */
@@ -533,7 +529,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
copy_v3_fl(color_back, 0.0f);
}
- const bool is_act = (gz->flag & WM_GIZMO_DRAW_HOVER);
+ const bool is_act = (ruler_info->item_active == ruler_item);
float dir_ruler[2];
float co_ss[3][2];
int j;
@@ -632,6 +628,20 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
GPU_blend(true);
+ if (is_act && (ruler_item->flag & RULERITEM_USE_ANGLE_ACTIVE)) {
+ GPU_line_width(3.0f);
+ immUniformColor3fv(color_act);
+ immBegin(GPU_PRIM_LINES, 4);
+ /* angle vertex */
+ immVertex2f(shdr_pos, co_ss[1][0] - cap_size, co_ss[1][1] - cap_size);
+ immVertex2f(shdr_pos, co_ss[1][0] + cap_size, co_ss[1][1] + cap_size);
+ immVertex2f(shdr_pos, co_ss[1][0] - cap_size, co_ss[1][1] + cap_size);
+ immVertex2f(shdr_pos, co_ss[1][0] + cap_size, co_ss[1][1] - cap_size);
+
+ immEnd();
+ GPU_line_width(1.0f);
+ }
+
immUniformColor3ubv(color_wire);
immBegin(GPU_PRIM_LINES, 8);
@@ -836,7 +846,6 @@ static int gizmo_ruler_modal(
int exit_code = OPERATOR_RUNNING_MODAL;
RulerInfo *ruler_info = gz->parent_gzgroup->customdata;
RulerItem *ruler_item = (RulerItem *)gz;
- RulerInteraction *inter = ruler_item->gz.interaction_data;
ARegion *ar = CTX_wm_region(C);
ruler_info->ar = ar;
@@ -851,7 +860,6 @@ static int gizmo_ruler_modal(
{
do_draw = true;
}
- inter->inside_region = BLI_rcti_isect_pt_v(&ar->winrct, &event->x);
}
break;
}
@@ -913,8 +921,14 @@ static int gizmo_ruler_invoke(
copy_v3_v3(inter->drag_start_co, ruler_item_pick->co[inter->co_index]);
}
- /* Should always be true. */
- inter->inside_region = BLI_rcti_isect_pt_v(&ar->winrct, &event->x);
+ if (inter->co_index == 1) {
+ ruler_item_pick->flag |= RULERITEM_USE_ANGLE_ACTIVE;
+ }
+ else {
+ ruler_item_pick->flag &= ~RULERITEM_USE_ANGLE_ACTIVE;
+ }
+
+ ruler_info->item_active = ruler_item_pick;
return OPERATOR_RUNNING_MODAL;
}
@@ -926,22 +940,6 @@ static void gizmo_ruler_exit(bContext *C, wmGizmo *gz, const bool cancel)
if (!cancel) {
if (ruler_info->state == RULER_STATE_DRAG) {
- RulerItem *ruler_item = (RulerItem *)gz;
- RulerInteraction *inter = gz->interaction_data;
- /* rubber-band angle removal */
- if (!inter->inside_region) {
- if ((inter->co_index == 1) && (ruler_item->flag & RULERITEM_USE_ANGLE)) {
- ruler_item->flag &= ~RULERITEM_USE_ANGLE;
- }
- else {
- /* Not ideal, since the ruler isn't a mode and we don't want to override delete key
- * use dragging out of the view for removal. */
- ruler_item_remove(C, gzgroup, ruler_item);
- ruler_item = NULL;
- gz = NULL;
- inter = NULL;
- }
- }
if (ruler_info->snap_flag & RULER_SNAP_OK) {
ruler_info->snap_flag &= ~RULER_SNAP_OK;
}
@@ -1044,7 +1042,7 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *op, const wmEvent *e
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = ar->regiondata;
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)))
{
BKE_report(op->reports, RPT_WARNING, "Gizmos hidden in this view");
@@ -1099,3 +1097,55 @@ void VIEW3D_OT_ruler_add(wmOperatorType *ot)
}
/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Remove Ruler Operator
+ * \{ */
+
+static int view3d_ruler_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
+{
+ ARegion *ar = CTX_wm_region(C);
+ View3D *v3d = CTX_wm_view3d(C);
+
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
+ (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)))
+ {
+ BKE_report(op->reports, RPT_WARNING, "Gizmos hidden in this view");
+ return OPERATOR_CANCELLED;
+ }
+
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ wmGizmoGroup *gzgroup = WM_gizmomap_group_find(gzmap, view3d_gzgt_ruler_id);
+ if (gzgroup) {
+ RulerInfo *ruler_info = gzgroup->customdata;
+ if (ruler_info->item_active) {
+ RulerItem *ruler_item = ruler_info->item_active;
+ if ((ruler_item->flag & RULERITEM_USE_ANGLE) &&
+ (ruler_item->flag & RULERITEM_USE_ANGLE_ACTIVE))
+ {
+ ruler_item->flag &= ~(RULERITEM_USE_ANGLE | RULERITEM_USE_ANGLE_ACTIVE);
+ }
+ else {
+ ruler_item_remove(C, gzgroup, ruler_item);
+ }
+ ED_region_tag_redraw(ar);
+ return OPERATOR_FINISHED;
+ }
+ }
+ return OPERATOR_PASS_THROUGH;
+}
+
+void VIEW3D_OT_ruler_remove(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Ruler Remove";
+ ot->idname = "VIEW3D_OT_ruler_remove";
+
+ ot->invoke = view3d_ruler_remove_invoke;
+ ot->poll = view3d_ruler_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
+}
+
+/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 7ed7d399df4..78bda66b8ff 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2004-2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_header.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include <string.h>
@@ -42,8 +35,6 @@
#include "BLT_translation.h"
#include "BKE_context.h"
-#include "BKE_main.h"
-#include "BKE_screen.h"
#include "BKE_editmesh.h"
#include "DEG_depsgraph.h"
@@ -143,10 +134,10 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
TIP_("Vertex select - Shift-Click for multiple modes, Ctrl-Click contracts selection"));
uiDefIconButBitS(block, UI_BTYPE_TOGGLE, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL,
- 0, 0, ceilf(UI_UNIT_X - UI_DPI_FAC), UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
+ 0, 0, ceilf(UI_UNIT_X - U.pixelsize), UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
TIP_("Edge select - Shift-Click for multiple modes, Ctrl-Click expands/contracts selection"));
uiDefIconButBitS(block, UI_BTYPE_TOGGLE, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL,
- 0, 0, ceilf(UI_UNIT_X - UI_DPI_FAC), UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
+ 0, 0, ceilf(UI_UNIT_X - U.pixelsize), UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
TIP_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection"));
}
}
@@ -168,16 +159,13 @@ static void uiTemplatePaintModeSelection(uiLayout *layout, struct bContext *C)
else {
uiLayout *row = uiLayoutRow(layout, true);
uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- if (ob->mode & OB_MODE_WEIGHT_PAINT) {
- uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- }
+ uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
}
}
void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C)
{
- /* Extracted from: uiTemplateHeader3D */
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
Object *obedit = CTX_data_edit_object(C);
@@ -193,68 +181,3 @@ void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C)
uiTemplatePaintModeSelection(layout, C);
}
}
-
-void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
-{
- bScreen *screen = CTX_wm_screen(C);
- ScrArea *sa = CTX_wm_area(C);
- View3D *v3d = sa->spacedata.first;
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
- PointerRNA v3dptr, toolsptr, sceneptr;
- Object *ob = OBACT(view_layer);
- Object *obedit = CTX_data_edit_object(C);
- bGPdata *gpd = CTX_data_gpencil_data(C);
- uiBlock *block;
- bool is_paint = (
- ob && !(gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE)) &&
- ELEM(ob->mode,
- OB_MODE_SCULPT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, OB_MODE_TEXTURE_PAINT));
-
- RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr);
- RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &toolsptr);
- RNA_pointer_create(&scene->id, &RNA_Scene, scene, &sceneptr);
-
- block = uiLayoutGetBlock(layout);
- UI_block_func_handle_set(block, do_view3d_header_buttons, NULL);
-
- /* other buttons: */
- UI_block_emboss_set(block, UI_EMBOSS);
-
- /* moved to topbar */
-#if 0
- uiLayout *row = uiLayoutRow(layout, true);
- uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- if (!ob || ELEM(ob->mode, OB_MODE_OBJECT, OB_MODE_POSE, OB_MODE_WEIGHT_PAINT)) {
- uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- }
-#endif
-
- if (obedit == NULL && is_paint) {
- /* Currently Python calls this directly. */
-#if 0
- uiTemplatePaintModeSelection(layout, C);
-#endif
-
- }
- else {
- /* Moved to popover and topbar. */
-#if 0
- /* Transform widget / gizmos */
- row = uiLayoutRow(layout, true);
- uiItemR(row, &v3dptr, "show_gizmo", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- uiItemR(row, &sceneptr, "transform_orientation", 0, "", ICON_NONE);
-#endif
- }
-
- if (obedit == NULL && v3d->localvd == NULL) {
- /* Scene lock */
- uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- }
-
- /* Currently Python calls this directly. */
-#if 0
- uiTemplateEditModeSelection(layout, C);
-#endif
-}
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 7a3d2618f07..bb6b96b96d5 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_intern.h
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#ifndef __VIEW3D_INTERN_H__
@@ -39,27 +32,27 @@ struct ARegion;
struct ARegionType;
struct Base;
struct BoundBox;
-struct GPUBatch;
struct Depsgraph;
+struct GPUBatch;
+struct Mesh;
struct Object;
struct SmokeDomainSettings;
+struct ViewLayer;
struct bAnimVizSettings;
struct bContext;
struct bMotionPath;
struct bPoseChannel;
-struct Mesh;
-struct ViewLayer;
-struct wmOperatorType;
-struct wmKeyConfig;
struct wmGizmoGroupType;
struct wmGizmoType;
+struct wmKeyConfig;
+struct wmOperatorType;
struct wmWindowManager;
/* drawing flags: */
enum {
DRAW_PICKING = (1 << 0),
DRAW_CONSTCOLOR = (1 << 1),
- DRAW_SCENESET = (1 << 2)
+ DRAW_SCENESET = (1 << 2),
};
/* view3d_header.c */
@@ -97,7 +90,7 @@ void VIEW3D_OT_background_image_add(struct wmOperatorType *ot);
void VIEW3D_OT_background_image_remove(struct wmOperatorType *ot);
void VIEW3D_OT_view_orbit(struct wmOperatorType *ot);
void VIEW3D_OT_view_roll(struct wmOperatorType *ot);
-// void VIEW3D_OT_clip_border(struct wmOperatorType *ot);
+void VIEW3D_OT_clip_border(struct wmOperatorType *ot);
void VIEW3D_OT_cursor3d(struct wmOperatorType *ot);
void VIEW3D_OT_render_border(struct wmOperatorType *ot);
void VIEW3D_OT_clear_render_border(struct wmOperatorType *ot);
@@ -252,9 +245,9 @@ struct ARegion *view3d_has_tools_region(struct ScrArea *sa);
extern const char *view3d_context_dir[]; /* doc access */
/* view3d_widgets.c */
-void VIEW3D_GGT_lamp_spot(struct wmGizmoGroupType *gzgt);
-void VIEW3D_GGT_lamp_area(struct wmGizmoGroupType *gzgt);
-void VIEW3D_GGT_lamp_target(struct wmGizmoGroupType *gzgt);
+void VIEW3D_GGT_light_spot(struct wmGizmoGroupType *gzgt);
+void VIEW3D_GGT_light_area(struct wmGizmoGroupType *gzgt);
+void VIEW3D_GGT_light_target(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_camera(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_camera_view(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_force_field(struct wmGizmoGroupType *gzgt);
@@ -267,6 +260,7 @@ void VIEW3D_GGT_mesh_preselect_edgering(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_ruler(struct wmGizmoGroupType *gzgt);
void VIEW3D_GT_ruler_item(struct wmGizmoType *gzt);
void VIEW3D_OT_ruler_add(struct wmOperatorType *ot);
+void VIEW3D_OT_ruler_remove(struct wmOperatorType *ot);
void VIEW3D_GT_navigate_rotate(struct wmGizmoType *gzt);
@@ -277,7 +271,7 @@ void VIEW3D_GT_navigate_rotate(struct wmGizmoType *gzt);
* any direction it starts to fail */
#define VIEW3D_CAMERA_BORDER_HACK
#ifdef VIEW3D_CAMERA_BORDER_HACK
-extern unsigned char view3d_camera_border_hack_col[3];
+extern uchar view3d_camera_border_hack_col[3];
extern bool view3d_camera_border_hack_test;
#endif
diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c
index 9ee7cbabd2a..0054680281b 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation, full recode and added functions
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_iterators.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "DNA_curve_types.h"
@@ -42,7 +36,6 @@
#include "BKE_DerivedMesh.h"
#include "BKE_displist.h"
#include "BKE_editmesh.h"
-#include "BKE_context.h"
#include "BKE_mesh_runtime.h"
#include "BKE_mesh_iterators.h"
@@ -122,7 +115,7 @@ void meshobject_foreachScreenVert(
Scene *scene_eval = DEG_get_evaluated_scene(vc->depsgraph);
Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph, vc->obact);
- me = mesh_get_eval_deform(vc->depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH);
+ me = mesh_get_eval_deform(vc->depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
ED_view3d_check_mats_rv3d(vc->rv3d);
@@ -162,7 +155,7 @@ void mesh_foreachScreenVert(
{
foreachScreenVert_userData data;
- Mesh *me = editbmesh_get_eval_cage_from_orig(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+ Mesh *me = editbmesh_get_eval_cage_from_orig(vc->depsgraph, vc->scene, vc->obedit, vc->em, &CD_MASK_BAREMESH);
ED_view3d_check_mats_rv3d(vc->rv3d);
@@ -215,7 +208,7 @@ void mesh_foreachScreenEdge(
{
foreachScreenEdge_userData data;
- Mesh *me = editbmesh_get_eval_cage_from_orig(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+ Mesh *me = editbmesh_get_eval_cage_from_orig(vc->depsgraph, vc->scene, vc->obedit, vc->em, &CD_MASK_BAREMESH);
ED_view3d_check_mats_rv3d(vc->rv3d);
@@ -260,7 +253,7 @@ void mesh_foreachScreenFace(
{
foreachScreenFace_userData data;
- Mesh *me = editbmesh_get_eval_cage_from_orig(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+ Mesh *me = editbmesh_get_eval_cage_from_orig(vc->depsgraph, vc->scene, vc->obedit, vc->em, &CD_MASK_BAREMESH);
ED_view3d_check_mats_rv3d(vc->rv3d);
data.vc = *vc;
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 46a00ffeacf..e551f1ea130 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_ops.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -82,7 +75,7 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- for (Collection *collection = bmain->collection.first; collection; collection = collection->id.next) {
+ for (Collection *collection = bmain->collections.first; collection; collection = collection->id.next) {
for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
Object *object = cob->ob;
@@ -192,7 +185,7 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_view_center_lock);
WM_operatortype_append(VIEW3D_OT_select);
WM_operatortype_append(VIEW3D_OT_select_box);
- // WM_operatortype_append(VIEW3D_OT_clip_border);
+ WM_operatortype_append(VIEW3D_OT_clip_border);
WM_operatortype_append(VIEW3D_OT_select_circle);
WM_operatortype_append(VIEW3D_OT_smoothview);
WM_operatortype_append(VIEW3D_OT_render_border);
@@ -229,6 +222,7 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_toggle_matcap_flip);
WM_operatortype_append(VIEW3D_OT_ruler_add);
+ WM_operatortype_append(VIEW3D_OT_ruler_remove);
transform_operatortypes();
}
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 718f3cd40f1..bb5fdeabc2b 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_project.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "DNA_camera_types.h"
@@ -116,9 +109,10 @@ eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *bas
* - 'rv3d->perspmat', is_local == false
* - 'rv3d->persmatob', is_local == true
*/
-static eV3DProjStatus ed_view3d_project__internal(const ARegion *ar,
- float perspmat[4][4], const bool is_local, /* normally hidden */
- const float co[3], float r_co[2], const eV3DProjTest flag)
+static eV3DProjStatus ed_view3d_project__internal(
+ const ARegion *ar,
+ float perspmat[4][4], const bool is_local, /* normally hidden */
+ const float co[3], float r_co[2], const eV3DProjTest flag)
{
float vec4[4];
@@ -328,7 +322,7 @@ static void view3d_win_to_ray_segment(
ED_view3d_win_to_vector(ar, mval, r_ray_dir);
if ((rv3d->is_persp == false) && (rv3d->persp != RV3D_CAMOB)) {
- end_offset = v3d->far / 2.0f;
+ end_offset = v3d->clip_end / 2.0f;
start_offset = -end_offset;
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index c976803065e..fc13968def7 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_select.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -158,26 +151,33 @@ void ED_view3d_viewcontext_init_object(ViewContext *vc, Object *obact)
/** \name Internal Object Utilities
* \{ */
-static void object_deselect_all_visible(ViewLayer *view_layer, View3D *v3d)
+static bool object_deselect_all_visible(ViewLayer *view_layer, View3D *v3d)
{
- Base *base;
-
- for (base = view_layer->object_bases.first; base; base = base->next) {
- if (BASE_SELECTABLE(v3d, base)) {
- ED_object_base_select(base, BA_DESELECT);
+ bool changed = false;
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (base->flag & BASE_SELECTED) {
+ if (BASE_SELECTABLE(v3d, base)) {
+ ED_object_base_select(base, BA_DESELECT);
+ changed = true;
+ }
}
}
+ return changed;
}
-static void object_deselect_all_except(ViewLayer *view_layer, Base *b) /* deselect all except b */
+/* deselect all except b */
+static bool object_deselect_all_except(ViewLayer *view_layer, Base *b)
{
+ bool changed = false;
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
if (base->flag & BASE_SELECTED) {
if (b != base) {
ED_object_base_select(base, BA_DESELECT);
+ changed = true;
}
}
}
+ return changed;
}
/** \} */
@@ -186,11 +186,12 @@ static void object_deselect_all_except(ViewLayer *view_layer, Base *b) /* dese
/** \name Internal Edit-Mesh Utilities
* \{ */
-static void edbm_backbuf_check_and_select_verts(BMEditMesh *em, const eSelectOp sel_op)
+static bool edbm_backbuf_check_and_select_verts(BMEditMesh *em, const eSelectOp sel_op)
{
BMVert *eve;
BMIter iter;
- unsigned int index = bm_wireoffs;
+ uint index = bm_wireoffs;
+ bool changed = false;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
@@ -199,17 +200,20 @@ static void edbm_backbuf_check_and_select_verts(BMEditMesh *em, const eSelectOp
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
BM_vert_select_set(em->bm, eve, sel_op_result);
+ changed = true;
}
}
index++;
}
+ return changed;
}
-static void edbm_backbuf_check_and_select_edges(BMEditMesh *em, const eSelectOp sel_op)
+static bool edbm_backbuf_check_and_select_edges(BMEditMesh *em, const eSelectOp sel_op)
{
BMEdge *eed;
BMIter iter;
- unsigned int index = bm_solidoffs;
+ uint index = bm_solidoffs;
+ bool changed = false;
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
@@ -218,17 +222,20 @@ static void edbm_backbuf_check_and_select_edges(BMEditMesh *em, const eSelectOp
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
BM_edge_select_set(em->bm, eed, sel_op_result);
+ changed = true;
}
}
index++;
}
+ return changed;
}
-static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, const eSelectOp sel_op)
+static bool edbm_backbuf_check_and_select_faces(BMEditMesh *em, const eSelectOp sel_op)
{
BMFace *efa;
BMIter iter;
- unsigned int index = 1;
+ uint index = 1;
+ bool changed = false;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
@@ -237,17 +244,20 @@ static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, const eSelectOp
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
BM_face_select_set(em->bm, efa, sel_op_result);
+ changed = true;
}
}
index++;
}
+ return changed;
}
/* object mode, edbm_ prefix is confusing here, rename? */
-static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, const eSelectOp sel_op)
+static bool edbm_backbuf_check_and_select_verts_obmode(Mesh *me, const eSelectOp sel_op)
{
MVert *mv = me->mvert;
- unsigned int index;
+ uint index;
+ bool changed = false;
if (mv) {
for (index = 1; index <= me->totvert; index++, mv++) {
@@ -257,17 +267,20 @@ static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, const eSelectOp
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
SET_FLAG_FROM_TEST(mv->flag, sel_op_result, SELECT);
+ changed = true;
}
}
}
}
+ return changed;
}
/* object mode, edbm_ prefix is confusing here, rename? */
-static void edbm_backbuf_check_and_select_tfaces(Mesh *me, const eSelectOp sel_op)
+static bool edbm_backbuf_check_and_select_tfaces(Mesh *me, const eSelectOp sel_op)
{
MPoly *mpoly = me->mpoly;
- unsigned int index;
+ uint index;
+ bool changed = false;
if (mpoly) {
for (index = 1; index <= me->totpoly; index++, mpoly++) {
@@ -277,10 +290,12 @@ static void edbm_backbuf_check_and_select_tfaces(Mesh *me, const eSelectOp sel_o
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
SET_FLAG_FROM_TEST(mpoly->flag, sel_op_result, ME_FACE_SEL);
+ changed = true;
}
}
}
}
+ return changed;
}
/** \} */
@@ -451,11 +466,11 @@ static void do_lasso_select_objects(
View3D *v3d = vc->v3d;
Base *base;
+ bool changed = false;
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
- object_deselect_all_visible(vc->view_layer, vc->v3d);
+ changed = object_deselect_all_visible(vc->view_layer, vc->v3d);
}
- bool changed = false;
for (base = vc->view_layer->object_bases.first; base; base = base->next) {
if (BASE_SELECTABLE(v3d, base)) { /* use this to avoid un-needed lasso lookups */
const bool is_select = base->flag & BASE_SELECTED;
@@ -941,7 +956,8 @@ static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], sh
return;
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
- paintface_deselect_all_visible(vc->C, ob, SEL_DESELECT, false); /* flush selection at the end */
+ /* flush selection at the end */
+ paintface_deselect_all_visible(vc->C, ob, SEL_DESELECT, false);
}
bm_vertoffs = me->totpoly + 1; /* max index array */
@@ -1155,7 +1171,8 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
- /* this is a bit dodjy, there should only be ONE object with this name, but library objects can mess this up */
+ /* This is a bit dodgy, there should only be ONE object with this name,
+ * but library objects can mess this up. */
if (STREQ(name, base->object->id.name + 2)) {
ED_object_base_activate(C, base);
ED_object_base_select(base, BA_SELECT);
@@ -1205,14 +1222,14 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot)
}
static Base *object_mouse_select_menu(
- bContext *C, ViewContext *vc, unsigned int *buffer, int hits,
+ bContext *C, ViewContext *vc, uint *buffer, int hits,
const int mval[2], bool toggle)
{
short baseCount = 0;
bool ok;
LinkNode *linklist = NULL;
- /* handle base->object->select_color */
+ /* handle base->object->select_id */
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
ok = false;
@@ -1221,7 +1238,7 @@ static Base *object_mouse_select_menu(
if (buffer) {
for (int a = 0; a < hits; a++) {
/* index was converted */
- if (base->object->select_color == (buffer[(4 * a) + 3] & ~0xFFFF0000)) {
+ if (base->object->select_id == (buffer[(4 * a) + 3] & ~0xFFFF0000)) {
ok = true;
break;
}
@@ -1288,7 +1305,7 @@ static Base *object_mouse_select_menu(
static bool selectbuffer_has_bones(const uint *buffer, const uint hits)
{
- unsigned int i;
+ uint i;
for (i = 0; i < hits; i++) {
if (buffer[(4 * i) + 3] & 0xFFFF0000) {
return true;
@@ -1298,22 +1315,22 @@ static bool selectbuffer_has_bones(const uint *buffer, const uint hits)
}
/* utility function for mixed_bones_object_selectbuffer */
-static int selectbuffer_ret_hits_15(unsigned int *UNUSED(buffer), const int hits15)
+static int selectbuffer_ret_hits_15(uint *UNUSED(buffer), const int hits15)
{
return hits15;
}
-static int selectbuffer_ret_hits_9(unsigned int *buffer, const int hits15, const int hits9)
+static int selectbuffer_ret_hits_9(uint *buffer, const int hits15, const int hits9)
{
const int offs = 4 * hits15;
- memcpy(buffer, buffer + offs, 4 * hits9 * sizeof(unsigned int));
+ memcpy(buffer, buffer + offs, 4 * hits9 * sizeof(uint));
return hits9;
}
-static int selectbuffer_ret_hits_5(unsigned int *buffer, const int hits15, const int hits9, const int hits5)
+static int selectbuffer_ret_hits_5(uint *buffer, const int hits15, const int hits9, const int hits5)
{
const int offs = 4 * hits15 + 4 * hits9;
- memcpy(buffer, buffer + offs, 4 * hits5 * sizeof(unsigned int));
+ memcpy(buffer, buffer + offs, 4 * hits5 * sizeof(uint));
return hits5;
}
@@ -1322,7 +1339,7 @@ static int selectbuffer_ret_hits_5(unsigned int *buffer, const int hits15, const
* Checks three selection levels and compare.
*/
static int mixed_bones_object_selectbuffer(
- ViewContext *vc, unsigned int *buffer, const int mval[2], eV3DSelectObjectFilter select_filter,
+ ViewContext *vc, uint *buffer, const int mval[2], eV3DSelectObjectFilter select_filter,
bool do_nearest)
{
rcti rect;
@@ -1382,7 +1399,7 @@ finally:
}
static int mixed_bones_object_selectbuffer_extended(
- ViewContext *vc, unsigned int *buffer, const int mval[2], eV3DSelectObjectFilter select_filter,
+ ViewContext *vc, uint *buffer, const int mval[2], eV3DSelectObjectFilter select_filter,
bool use_cycle, bool enumerate, bool *r_do_nearest)
{
static int last_mval[2] = {-100, -100};
@@ -1446,7 +1463,7 @@ static Base *mouse_select_eval_buffer(
int a;
if (do_nearest) {
- unsigned int min = 0xFFFFFFFF;
+ uint min = 0xFFFFFFFF;
int selcol = 0, notcol = 0;
@@ -1462,7 +1479,7 @@ static Base *mouse_select_eval_buffer(
else {
/* only exclude active object when it is selected... */
if (BASACT(view_layer) && (BASACT(view_layer)->flag & BASE_SELECTED) && hits > 1) {
- notcol = BASACT(view_layer)->object->select_color;
+ notcol = BASACT(view_layer)->object->select_id;
}
for (a = 0; a < hits; a++) {
@@ -1476,7 +1493,9 @@ static Base *mouse_select_eval_buffer(
base = FIRSTBASE(view_layer);
while (base) {
if (BASE_SELECTABLE(v3d, base)) {
- if (base->object->select_color == selcol) break;
+ if (base->object->select_id == selcol) {
+ break;
+ }
}
base = base->next;
}
@@ -1499,13 +1518,15 @@ static Base *mouse_select_eval_buffer(
if (has_bones) {
/* skip non-bone objects */
if ((buffer[4 * a + 3] & 0xFFFF0000)) {
- if (base->object->select_color == (buffer[(4 * a) + 3] & 0xFFFF))
+ if (base->object->select_id == (buffer[(4 * a) + 3] & 0xFFFF)) {
basact = base;
+ }
}
}
else {
- if (base->object->select_color == (buffer[(4 * a) + 3] & 0xFFFF))
+ if (base->object->select_id == (buffer[(4 * a) + 3] & 0xFFFF)) {
basact = base;
+ }
}
}
}
@@ -1526,7 +1547,7 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
{
ViewContext vc;
Base *basact = NULL;
- unsigned int buffer[MAXPICKBUF];
+ uint buffer[MAXPICKBUF];
/* setup view context for argument to callbacks */
view3d_operator_needs_opengl(C);
@@ -1582,11 +1603,16 @@ static bool ed_object_select_pick(
bool extend, bool deselect, bool toggle, bool obcenter, bool enumerate, bool object)
{
ViewContext vc;
+ /* setup view context for argument to callbacks */
+ ED_view3d_viewcontext_init(C, &vc);
+
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
- Base *base, *startbase = NULL, *basact = NULL, *oldbasact = BASACT(view_layer);
+ /* Don't set when the context has no active object (hidden), see: T60807. */
+ const Base *oldbasact = vc.obact ? BASACT(view_layer) : NULL;
+ Base *base, *startbase = NULL, *basact = NULL;
const eObjectMode object_mode = oldbasact ? oldbasact->object->mode : OB_MODE_OBJECT;
bool is_obedit;
float dist = ED_view3d_select_dist_px() * 1.3333f;
@@ -1594,8 +1620,6 @@ static bool ed_object_select_pick(
int hits;
const float mval_fl[2] = {(float)mval[0], (float)mval[1]};
- /* setup view context for argument to callbacks */
- ED_view3d_viewcontext_init(C, &vc);
is_obedit = (vc.obedit != NULL);
if (object) {
@@ -1608,9 +1632,13 @@ static bool ed_object_select_pick(
/* always start list from basact in wire mode */
startbase = FIRSTBASE(view_layer);
- if (BASACT(view_layer) && BASACT(view_layer)->next) startbase = BASACT(view_layer)->next;
+ if (oldbasact && oldbasact->next) {
+ startbase = oldbasact->next;
+ }
+
+ /* This block uses the control key to make the object selected
+ * by its center point rather than its contents */
- /* This block uses the control key to make the object selected by its center point rather than its contents */
/* in editmode do not activate */
if (obcenter) {
@@ -1628,7 +1656,9 @@ static bool ed_object_select_pick(
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
float dist_temp = len_manhattan_v2v2(mval_fl, screen_co);
- if (base == BASACT(view_layer)) dist_temp += 10.0f;
+ if (base == oldbasact) {
+ dist_temp += 10.0f;
+ }
if (dist_temp < dist) {
dist = dist_temp;
basact = base;
@@ -1637,8 +1667,12 @@ static bool ed_object_select_pick(
}
base = base->next;
- if (base == NULL) base = FIRSTBASE(view_layer);
- if (base == startbase) break;
+ if (base == NULL) {
+ base = FIRSTBASE(view_layer);
+ }
+ if (base == startbase) {
+ break;
+ }
}
}
if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) {
@@ -1656,7 +1690,7 @@ static bool ed_object_select_pick(
}
}
else {
- unsigned int buffer[MAXPICKBUF];
+ uint buffer[MAXPICKBUF];
bool do_nearest;
// TIMEIT_START(select_time);
@@ -1685,7 +1719,7 @@ static bool ed_object_select_pick(
if (has_bones && basact) {
if (basact->object->type == OB_CAMERA) {
- if (BASACT(view_layer) == basact) {
+ if (oldbasact == basact) {
int i, hitresult;
bool changed = false;
@@ -1694,12 +1728,13 @@ static bool ed_object_select_pick(
/* if there's bundles in buffer select bundles first,
* so non-camera elements should be ignored in buffer */
- if (basact->object->select_color != (hitresult & 0xFFFF)) {
+ if (basact->object->select_id != (hitresult & 0xFFFF)) {
continue;
}
/* index of bundle is 1<<16-based. if there's no "bone" index
- * in height word, this buffer value belongs to camera. not to bundle */
+ * in height word, this buffer value belongs to camera. not to bundle
+ */
if (buffer[4 * i + 3] & 0xFFFF0000) {
MovieClip *clip = BKE_object_movieclip_get(scene, basact->object, false);
MovieTracking *tracking = &clip->tracking;
@@ -1714,13 +1749,15 @@ static bool ed_object_select_pick(
}
else {
int oldsel = TRACK_SELECTED(track) ? 1 : 0;
- if (!extend)
+ if (!extend) {
deselect_all_tracks(tracking);
+ }
BKE_tracking_track_select(tracksbase, track, TRACK_AREA_ALL, extend);
- if (oldsel != (TRACK_SELECTED(track) ? 1 : 0))
+ if (oldsel != (TRACK_SELECTED(track) ? 1 : 0)) {
changed = true;
+ }
}
basact->flag |= BASE_SELECTED;
@@ -1758,16 +1795,18 @@ static bool ed_object_select_pick(
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
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(view_layer) && (BASACT(view_layer)->object->mode & OB_MODE_WEIGHT_PAINT)) {
+ /* in weightpaint, we use selected bone to select vertexgroup,
+ * so no switch to new active object */
+ if (oldbasact && (oldbasact->object->mode & OB_MODE_WEIGHT_PAINT)) {
/* prevent activating */
basact = NULL;
}
}
/* prevent bone selecting to pass on to object selecting */
- if (basact == BASACT(view_layer))
+ if (basact == oldbasact) {
basact = NULL;
+ }
}
if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) {
@@ -1800,6 +1839,9 @@ static bool ed_object_select_pick(
}
}
+ /* Ensure code above doesn't change the active base. */
+ BLI_assert(oldbasact == (vc.obact ? BASACT(view_layer) : NULL));
+
/* so, do we have something selected? */
if (basact) {
retval = true;
@@ -1879,7 +1921,7 @@ static bool ed_wpaint_vertex_select_pick(
const bool use_zbuf = V3D_IS_ZBUF(v3d);
Mesh *me = obact->data; /* already checked for NULL */
- unsigned int index = 0;
+ uint index = 0;
MVert *mv;
if (ED_mesh_pick_vert(C, obact, mval, &index, ED_MESH_PICK_DEFAULT_VERT_SIZE, use_zbuf)) {
@@ -2076,7 +2118,7 @@ static int do_paintvert_box_select(
Mesh *me;
MVert *mvert;
struct ImBuf *ibuf;
- unsigned int *rt;
+ uint *rt;
int a, index;
char *selar;
const int size[2] = {
@@ -2341,7 +2383,7 @@ static int do_meta_box_select(
MetaElem *ml;
int a;
- unsigned int buffer[MAXPICKBUF];
+ uint buffer[MAXPICKBUF];
int hits;
hits = view3d_opengl_select(
@@ -2368,7 +2410,7 @@ static int do_meta_box_select(
}
const uint hit_object = hitresult & 0xFFFF;
- if (vc->obedit->select_color != hit_object) {
+ if (vc->obedit->select_id != hit_object) {
continue;
}
@@ -2412,7 +2454,7 @@ static int do_armature_box_select(
bool changed = false;
int a;
- unsigned int buffer[MAXPICKBUF];
+ uint buffer[MAXPICKBUF];
int hits;
hits = view3d_opengl_select(
@@ -2520,7 +2562,7 @@ static int do_object_box_select(bContext *C, ViewContext *vc, rcti *rect, const
for (Base *base = vc->view_layer->object_bases.first; base; base = base->next) {
if (BASE_SELECTABLE(v3d, base)) {
- if ((base->object->select_color & 0x0000FFFF) != 0) {
+ if ((base->object->select_id & 0x0000FFFF) != 0) {
BLI_array_append(bases, base);
}
}
@@ -2532,7 +2574,9 @@ static int do_object_box_select(bContext *C, ViewContext *vc, rcti *rect, const
for (const uint *col = vbuffer + 3, *col_end = col + (hits * 4); col < col_end; col += 4) {
Bone *bone;
Base *base = ED_armature_base_and_bone_from_select_buffer(bases, BLI_array_len(bases), *col, &bone);
- base->object->id.tag |= LIB_TAG_DOIT;
+ if (base != NULL) {
+ base->object->id.tag |= LIB_TAG_DOIT;
+ }
}
for (Base *base = vc->view_layer->object_bases.first; base && hits; base = base->next) {
@@ -2610,7 +2654,7 @@ static int do_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, const eS
/* Select the next bone if we're not switching bases. */
if (col + 4 != col_end) {
- if ((base->object->select_color & 0x0000FFFF) != (col[4] & 0x0000FFFF)) {
+ if ((base->object->select_id & 0x0000FFFF) != (col[4] & 0x0000FFFF)) {
break;
}
if (base->object->pose != NULL) {
@@ -2799,6 +2843,7 @@ static void mesh_circle_doSelectVert(void *userData, BMVert *eve, const float sc
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
BM_vert_select_set(data->vc->em->bm, eve, data->select);
+ data->is_changed = true;
}
}
static void mesh_circle_doSelectEdge(
@@ -2808,6 +2853,7 @@ static void mesh_circle_doSelectEdge(
if (edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b)) {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
+ data->is_changed = true;
}
}
static void mesh_circle_doSelectFace(void *userData, BMFace *efa, const float screen_co[2], int UNUSED(index))
@@ -2816,25 +2862,32 @@ static void mesh_circle_doSelectFace(void *userData, BMFace *efa, const float sc
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
BM_face_select_set(data->vc->em->bm, efa, data->select);
+ data->is_changed = true;
}
}
-static void mesh_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool mesh_circle_select(ViewContext *vc, eSelectOp sel_op, const int mval[2], float rad)
{
ToolSettings *ts = vc->scene->toolsettings;
int bbsel;
CircleSelectUserData data;
+ vc->em = BKE_editmesh_from_object(vc->obedit);
+
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
- vc->em = BKE_editmesh_from_object(vc->obedit);
-
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
if (ts->selectmode & SCE_SELECT_VERTEX) {
if (bbsel) {
- edbm_backbuf_check_and_select_verts(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
+ changed |= edbm_backbuf_check_and_select_verts(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
}
else {
mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
@@ -2843,7 +2896,7 @@ static void mesh_circle_select(ViewContext *vc, const bool select, const int mva
if (ts->selectmode & SCE_SELECT_EDGE) {
if (bbsel) {
- edbm_backbuf_check_and_select_edges(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
+ changed |= edbm_backbuf_check_and_select_edges(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
}
else {
mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
@@ -2852,31 +2905,48 @@ static void mesh_circle_select(ViewContext *vc, const bool select, const int mva
if (ts->selectmode & SCE_SELECT_FACE) {
if (bbsel) {
- edbm_backbuf_check_and_select_faces(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
+ changed |= edbm_backbuf_check_and_select_faces(vc->em, select ? SEL_OP_ADD : SEL_OP_SUB);
}
else {
mesh_foreachScreenFace(vc, mesh_circle_doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
}
}
+ changed |= data.is_changed;
+
EDBM_backbuf_free();
- EDBM_selectmode_flush(vc->em);
+
+ if (changed) {
+ EDBM_selectmode_flush(vc->em);
+ }
+
+ return changed;
}
-static void paint_facesel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool paint_facesel_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
+ BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
Object *ob = vc->obact;
Mesh *me = ob->data;
bool bbsel;
+ bool changed = false;
+
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ paintface_deselect_all_visible(vc->C, ob, SEL_DESELECT, false);
+ changed = true;
+ }
bm_vertoffs = me->totpoly + 1; /* max index array */
bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
if (bbsel) {
- edbm_backbuf_check_and_select_tfaces(me, select ? SEL_OP_ADD : SEL_OP_SUB);
+ changed |= edbm_backbuf_check_and_select_tfaces(me, sel_op);
EDBM_backbuf_free();
+ }
+ if (changed) {
paintface_flush_flags(vc->C, ob, SELECT);
}
+ return changed;
}
static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
@@ -2887,20 +2957,29 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv,
SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
}
}
-static void paint_vertsel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool paint_vertsel_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
+ BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
const bool use_zbuf = V3D_IS_ZBUF(vc->v3d);
Object *ob = vc->obact;
Mesh *me = ob->data;
bool bbsel;
/* CircleSelectUserData data = {NULL}; */ /* UNUSED */
+ bool changed = false;
+
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ paintvert_deselect_all_visible(ob, SEL_DESELECT, false); /* flush selection at the end */
+ changed = true;
+ }
+
+ const bool select = (sel_op != SEL_OP_SUB);
if (use_zbuf) {
bm_vertoffs = me->totvert + 1; /* max index array */
bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
if (bbsel) {
- edbm_backbuf_check_and_select_verts_obmode(me, select ? SEL_OP_ADD : SEL_OP_SET);
+ changed |= edbm_backbuf_check_and_select_verts_obmode(me, sel_op);
EDBM_backbuf_free();
}
}
@@ -2911,13 +2990,17 @@ static void paint_vertsel_circle_select(ViewContext *vc, const bool select, cons
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
meshobject_foreachScreenVert(vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ changed |= data.is_changed;
}
- if (select == false) {
- BKE_mesh_mselect_validate(me);
+ if (changed) {
+ if (sel_op == SEL_OP_SUB) {
+ BKE_mesh_mselect_validate(me);
+ }
+ paintvert_flush_flags(ob);
+ paintvert_tag_select_update(vc->C, ob);
}
- paintvert_flush_flags(ob);
- paintvert_tag_select_update(vc->C, ob);
+ return changed;
}
@@ -2947,17 +3030,27 @@ static void nurbscurve_circle_doSelect(
}
}
}
+ data->is_changed = true;
}
}
-static void nurbscurve_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool nurbscurve_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
CircleSelectUserData data;
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ Curve *curve = vc->obedit->data;
+ ED_curve_deselect_all(curve->editnurb);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
nurbs_foreachScreenVert(vc, nurbscurve_circle_doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
BKE_curve_nurb_vert_active_validate(vc->obedit->data);
+
+ return changed || data.is_changed;
}
@@ -2967,16 +3060,26 @@ static void latticecurve_circle_doSelect(void *userData, BPoint *bp, const float
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
+ data->is_changed = true;
}
}
-static void lattice_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool lattice_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
CircleSelectUserData data;
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ Curve *curve = vc->obedit->data;
+ ED_curve_deselect_all(curve->editnurb);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
lattice_foreachScreenVert(vc, latticecurve_circle_doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+
+ return changed || data.is_changed;
}
@@ -3038,9 +3141,15 @@ static void do_circle_select_pose__doSelectBone(
data->is_changed |= is_point_done;
}
}
-static void pose_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool pose_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
+ BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
CircleSelectUserData data;
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ changed |= ED_pose_deselect_all(vc->obact, SEL_DESELECT, false);
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
@@ -3048,9 +3157,11 @@ static void pose_circle_select(ViewContext *vc, const bool select, const int mva
pose_foreachScreenBone(vc, do_circle_select_pose__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
- if (data.is_changed) {
+ changed |= data.is_changed;
+ if (changed) {
ED_pose_bone_select_tag_update(vc->obact);
}
+ return changed;
}
static bool armature_circle_doSelectJoint(void *userData, EditBone *ebone, const float screen_co[2], bool head)
@@ -3118,11 +3229,18 @@ static void do_circle_select_armature__doSelectBone(
data->is_changed |= is_point_done;
}
}
-static void armature_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool armature_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
CircleSelectUserData data;
bArmature *arm = vc->obedit->data;
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_armature_edit_deselect_all_visible(vc->obedit);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
+
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
@@ -3134,6 +3252,8 @@ static void armature_circle_select(ViewContext *vc, const bool select, const int
ED_armature_edit_validate_active(arm);
WM_main_add_notifier(NC_OBJECT | ND_BONE_SELECT, vc->obedit);
}
+ changed |= data.is_changed;
+ return changed;
}
static void do_circle_select_mball__doSelectElem(void *userData, struct MetaElem *ml, const float screen_co[2])
@@ -3146,55 +3266,68 @@ static void do_circle_select_mball__doSelectElem(void *userData, struct MetaElem
data->is_changed = true;
}
}
-static void mball_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool mball_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
CircleSelectUserData data;
+ bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ BKE_mball_deselect_all(vc->obedit->data);
+ changed = true;
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
+
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
mball_foreachScreenElem(vc, do_circle_select_mball__doSelectElem, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ changed |= data.is_changed;
+ return changed;
}
/** Callbacks for circle selection in Editmode */
-static void obedit_circle_select(
- ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool obedit_circle_select(
+ ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
+ BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
switch (vc->obedit->type) {
case OB_MESH:
- mesh_circle_select(vc, select, mval, rad);
- break;
+ return mesh_circle_select(vc, sel_op, mval, rad);
case OB_CURVE:
case OB_SURF:
- nurbscurve_circle_select(vc, select, mval, rad);
- break;
+ return nurbscurve_circle_select(vc, sel_op, mval, rad);
case OB_LATTICE:
- lattice_circle_select(vc, select, mval, rad);
- break;
+ return lattice_circle_select(vc, sel_op, mval, rad);
case OB_ARMATURE:
- armature_circle_select(vc, select, mval, rad);
- break;
+ return armature_circle_select(vc, sel_op, mval, rad);
case OB_MBALL:
- mball_circle_select(vc, select, mval, rad);
- break;
+ return mball_circle_select(vc, sel_op, mval, rad);
default:
- return;
+ BLI_assert(0);
+ return false;
}
}
-static bool object_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
+static bool object_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
+ BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
ViewLayer *view_layer = vc->view_layer;
View3D *v3d = vc->v3d;
const float radius_squared = rad * rad;
const float mval_fl[2] = {mval[0], mval[1]};
+
bool changed = false;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ if (object_deselect_all_visible(vc->view_layer, vc->v3d)) {
+ changed = true;
+ }
+ }
+ const bool select = (sel_op != SEL_OP_SUB);
const int select_flag = select ? BASE_SELECTED : 0;
-
Base *base;
for (base = FIRSTBASE(view_layer); base; base = base->next) {
if (BASE_SELECTABLE(v3d, base) && ((base->flag & BASE_SELECTED) != select_flag)) {
@@ -3219,10 +3352,11 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
{
ViewContext vc;
const int radius = RNA_int_get(op->ptr, "radius");
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
const int mval[2] = {RNA_int_get(op->ptr, "x"),
RNA_int_get(op->ptr, "y")};
+ const eSelectOp sel_op = ED_select_op_modal(
+ RNA_enum_get(op->ptr, "mode"), WM_gesture_is_modal_first(op->customdata));
ED_view3d_viewcontext_init(C, &vc);
@@ -3230,7 +3364,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
Object *obedit = vc.obedit;
if (obedit || BKE_paint_select_elem_test(obact) ||
- (obact && (obact->mode & (OB_MODE_PARTICLE_EDIT | OB_MODE_POSE))) )
+ (obact && (obact->mode & OB_MODE_POSE)))
{
view3d_operator_needs_opengl(C);
@@ -3240,31 +3374,38 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
obact = vc.obact;
obedit = vc.obedit;
- if (CTX_data_edit_object(C)) {
- obedit_circle_select(&vc, select, mval, (float)radius);
- DEG_id_tag_update(obact->data, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
+ if (obedit) {
+ if (obedit_circle_select(&vc, sel_op, mval, (float)radius)) {
+ DEG_id_tag_update(obact->data, ID_RECALC_SELECT);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
+ }
}
else if (BKE_paint_select_face_test(obact)) {
- paint_facesel_circle_select(&vc, select, mval, (float)radius);
+ paint_facesel_circle_select(&vc, sel_op, mval, (float)radius);
}
else if (BKE_paint_select_vert_test(obact)) {
- paint_vertsel_circle_select(&vc, select, mval, (float)radius);
+ paint_vertsel_circle_select(&vc, sel_op, mval, (float)radius);
}
else if (obact->mode & OB_MODE_POSE) {
- pose_circle_select(&vc, select, mval, (float)radius);
+ pose_circle_select(&vc, sel_op, mval, (float)radius);
}
else {
- return PE_circle_select(C, select, mval, (float)radius);
+ BLI_assert(0);
}
}
FOREACH_OBJECT_IN_MODE_END;
}
+ else if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT)) {
+ if (PE_circle_select(C, sel_op, mval, (float)radius)) {
+ return OPERATOR_FINISHED;
+ }
+ return OPERATOR_CANCELLED;
+ }
else if (obact && obact->mode & OB_MODE_SCULPT) {
return OPERATOR_CANCELLED;
}
else {
- if (object_circle_select(&vc, select, mval, (float)radius)) {
+ if (object_circle_select(&vc, sel_op, mval, (float)radius)) {
DEG_id_tag_update(&vc.scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc.scene);
}
@@ -3289,7 +3430,8 @@ void VIEW3D_OT_select_circle(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_circle_select(ot);
+ WM_operator_properties_gesture_circle(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 9729598b022..2108fc1ac07 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_snap.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
@@ -317,8 +309,12 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global
}
else if (obact && (obact->mode & OB_MODE_POSE)) {
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
- CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
- {
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ uint objects_len = 0;
+ Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, CTX_wm_view3d(C),
+ &objects_len, OB_MODE_POSE);
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object *ob = objects[ob_index];
bPoseChannel *pchan;
bArmature *arm = ob->data;
float snap_target_local[3];
@@ -382,7 +378,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
- CTX_DATA_END;
+ MEM_freeN(objects);
}
else {
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
@@ -395,7 +391,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global
CTX_data_selected_editable_objects(C, &ctx_data_list);
/* reset flags */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ob->flag &= ~OB_DONE;
}
@@ -551,7 +547,10 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot)
/* **************************************************** */
-/** Returns the center position of a tracking marker visible on the viewport (useful to snap to). **/
+/**
+ * Returns the center position of a tracking marker visible on the viewport
+ * (useful to snap to).
+ */
static void bundle_midpoint(Scene *scene, Object *ob, float r_vec[3])
{
MovieClip *clip = BKE_object_movieclip_get(scene, ob, false);
@@ -830,7 +829,10 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot)
/* **************************************************** */
-/** Calculates the bounding box corners (min and max) for \a obedit. The returned values are in global space. **/
+/**
+ * Calculates the bounding box corners (min and max) for \a obedit.
+ * The returned values are in global space.
+ */
bool ED_view3d_minmax_verts(Object *obedit, float r_min[3], float r_max[3])
{
TransVertStore tvs = {NULL};
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index 707e0e7a394..438cab21134 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_toolbar.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include <string.h>
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c
index 540806d4b67..ab2d09e0862 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_utils.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*
* 3D View checks and manipulation (no operators).
*/
@@ -47,14 +43,13 @@
#include "BKE_camera.h"
#include "BKE_context.h"
-#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_screen.h"
+#include "BKE_scene.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
-#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "GPU_matrix.h"
@@ -88,25 +83,28 @@ void ED_view3d_background_color_get(const Scene *scene, const View3D *v3d, float
return;
}
- UI_GetThemeColor3fv(TH_HIGH_GRAD, r_color);
+ UI_GetThemeColor3fv(TH_BACK, r_color);
}
void ED_view3d_cursor3d_calc_mat3(const Scene *scene, float mat[3][3])
{
const View3DCursor *cursor = &scene->cursor;
- quat_to_mat3(mat, cursor->rotation);
+ BKE_scene_cursor_rot_to_mat3(cursor, mat);
}
void ED_view3d_cursor3d_calc_mat4(const Scene *scene, float mat[4][4])
{
const View3DCursor *cursor = &scene->cursor;
- quat_to_mat4(mat, cursor->rotation);
+ float mat3[3][3];
+ BKE_scene_cursor_rot_to_mat3(cursor, mat3);
+ copy_m4_m3(mat, mat3);
copy_v3_v3(mat[3], cursor->location);
}
Camera *ED_view3d_camera_data_get(View3D *v3d, RegionView3D *rv3d)
{
- /* establish the camera object, so we can default to view mapping if anything is wrong with it */
+ /* establish the camera object,
+ * so we can default to view mapping if anything is wrong with it */
if ((rv3d->persp == RV3D_CAMOB) && v3d->camera && (v3d->camera->type == OB_CAMERA)) {
return v3d->camera->data;
}
@@ -120,7 +118,7 @@ void ED_view3d_dist_range_get(
float r_dist_range[2])
{
r_dist_range[0] = v3d->grid * 0.001f;
- r_dist_range[1] = v3d->far * 10.0f;
+ r_dist_range[1] = v3d->clip_end * 10.0f;
}
/**
@@ -138,13 +136,13 @@ bool ED_view3d_clip_range_get(
BKE_camera_params_from_view3d(&params, depsgraph, v3d, rv3d);
if (use_ortho_factor && params.is_ortho) {
- const float fac = 2.0f / (params.clipend - params.clipsta);
- params.clipsta *= fac;
- params.clipend *= fac;
+ const float fac = 2.0f / (params.clip_end - params.clip_start);
+ params.clip_start *= fac;
+ params.clip_end *= fac;
}
- if (r_clipsta) *r_clipsta = params.clipsta;
- if (r_clipend) *r_clipend = params.clipend;
+ if (r_clipsta) *r_clipsta = params.clip_start;
+ if (r_clipend) *r_clipend = params.clip_end;
return params.is_ortho;
}
@@ -152,7 +150,7 @@ bool ED_view3d_clip_range_get(
bool ED_view3d_viewplane_get(
Depsgraph *depsgraph,
const View3D *v3d, const RegionView3D *rv3d, int winx, int winy,
- rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize)
+ rctf *r_viewplane, float *r_clip_start, float *r_clip_end, float *r_pixsize)
{
CameraParams params;
@@ -161,8 +159,8 @@ bool ED_view3d_viewplane_get(
BKE_camera_params_compute_viewplane(&params, winx, winy, 1.0f, 1.0f);
if (r_viewplane) *r_viewplane = params.viewplane;
- if (r_clipsta) *r_clipsta = params.clipsta;
- if (r_clipend) *r_clipend = params.clipend;
+ if (r_clip_start) *r_clip_start = params.clip_start;
+ if (r_clip_end) *r_clip_end = params.clip_end;
if (r_pixsize) *r_pixsize = params.viewdx;
return params.is_ortho;
@@ -438,7 +436,8 @@ bool ED_view3d_persp_ensure(const Depsgraph *depsgraph, View3D *v3d, ARegion *ar
if (rv3d->persp != RV3D_PERSP) {
if (rv3d->persp == RV3D_CAMOB) {
- /* If autopersp and previous view was an axis one, switch back to PERSP mode, else reuse previous mode. */
+ /* If autopersp and previous view was an axis one,
+ * switch back to PERSP mode, else reuse previous mode. */
char persp = (autopersp && RV3D_VIEW_IS_AXIS(rv3d->lview)) ? RV3D_PERSP : rv3d->lpersp;
ED_view3d_persp_switch_from_camera(depsgraph, v3d, rv3d, persp);
}
@@ -1095,8 +1094,8 @@ float ED_view3d_radius_to_dist(
if (persp == RV3D_CAMOB) {
CameraParams params;
BKE_camera_params_init(&params);
- params.clipsta = v3d->near;
- params.clipend = v3d->far;
+ params.clip_start = v3d->clip_start;
+ params.clip_end = v3d->clip_end;
Object *camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
BKE_camera_params_from_object(&params, camera_eval);
@@ -1114,7 +1113,8 @@ float ED_view3d_radius_to_dist(
angle = focallength_to_fov(lens, sensor_size);
- /* zoom influences lens, correct this by scaling the angle as a distance (by the zoom-level) */
+ /* zoom influences lens, correct this by scaling the angle as a distance
+ * (by the zoom-level) */
angle = atanf(tanf(angle / 2.0f) * zoom) * 2.0f;
dist = ED_view3d_radius_to_dist_persp(angle, radius);
@@ -1337,7 +1337,7 @@ void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], c
* \param ofs: The view offset to be set, normally from RegionView3D.ofs.
* \param quat: The view rotation to be set, quaternion normally from RegionView3D.viewquat.
* \param dist: The view distance from ofs to be set, normally from RegionView3D.dist.
- * \param lens: The view lens angle set for cameras and lamps, normally from View3D.lens.
+ * \param lens: The view lens angle set for cameras and lights, normally from View3D.lens.
*/
void ED_view3d_from_object(const Object *ob, float ofs[3], float quat[4], float *dist, float *lens)
{
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index e3b31a65aec..b6defa1ad62 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_view.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
#include "DNA_camera_types.h"
@@ -66,6 +59,9 @@
#include "DRW_engine.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
@@ -212,7 +208,8 @@ void ED_view3d_smooth_view_ex(
}
/* grid draw as floor */
if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
- /* use existing if exists, means multiple calls to smooth view wont loose the original 'view' setting */
+ /* use existing if exists, means multiple calls to smooth view
+ * wont loose the original 'view' setting */
rv3d->view = RV3D_VIEW_USER;
}
@@ -224,7 +221,8 @@ void ED_view3d_smooth_view_ex(
* this means small rotations wont lag */
if (sview->quat && !sview->ofs && !sview->dist) {
/* scale the time allowed by the rotation */
- sms.time_allowed *= (double)fabsf(angle_signed_normalized_qtqt(sms.dst.quat, sms.src.quat)) / M_PI; /* 180deg == 1.0 */
+ /* 180deg == 1.0 */
+ sms.time_allowed *= (double)fabsf(angle_signed_normalized_qtqt(sms.dst.quat, sms.src.quat)) / M_PI;
}
/* ensure it shows correct */
@@ -239,8 +237,8 @@ void ED_view3d_smooth_view_ex(
rv3d->rflag |= RV3D_NAVIGATING;
- /* not essential but in some cases the caller will tag the area for redraw,
- * and in that case we can get a flicker of the 'org' user view but we want to see 'src' */
+ /* not essential but in some cases the caller will tag the area for redraw, and in that
+ * case we can get a flicker of the 'org' user view but we want to see 'src' */
view3d_smooth_view_state_restore(&sms.src, v3d, rv3d);
/* keep track of running timer! */
@@ -252,7 +250,8 @@ void ED_view3d_smooth_view_ex(
WM_event_remove_timer(wm, win, rv3d->smooth_timer);
}
/* TIMER1 is hardcoded in keymap */
- rv3d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0); /* max 30 frs/sec */
+ /* max 30 frs/sec */
+ rv3d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0);
ok = true;
}
@@ -574,7 +573,7 @@ void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
static void sync_viewport_camera_smoothview(bContext *C, View3D *v3d, Object *ob, const int smooth_viewtx)
{
Main *bmain = CTX_data_main(C);
- for (bScreen *screen = bmain->screen.first; screen != NULL; screen = screen->id.next) {
+ for (bScreen *screen = bmain->screens.first; screen != NULL; screen = screen->id.next) {
for (ScrArea *area = screen->areabase.first; area != NULL; area = area->next) {
for (SpaceLink *space_link = area->spacedata.first; space_link != NULL; space_link = space_link->next) {
if (space_link->spacetype == SPACE_VIEW3D) {
@@ -605,7 +604,8 @@ static void sync_viewport_camera_smoothview(bContext *C, View3D *v3d, Object *ob
.ofs = other_rv3d->ofs,
.quat = other_rv3d->viewquat,
.dist = &other_rv3d->dist,
- .lens = &other_v3d->lens});
+ .lens = &other_v3d->lens,
+ });
}
else {
other_v3d->camera = ob;
@@ -651,7 +651,8 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
&(const V3D_SmoothParams) {
.camera_old = camera_old, .camera = v3d->camera,
.ofs = rv3d->ofs, .quat = rv3d->viewquat,
- .dist = &rv3d->dist, .lens = &v3d->lens});
+ .dist = &rv3d->dist, .lens = &v3d->lens,
+ });
}
if (v3d->scenelock) {
@@ -930,7 +931,7 @@ static bool drw_select_filter_object_mode_lock_for_weight_paint(Object *ob, void
* \note (vc->obedit == NULL) can be set to explicitly skip edit-object selection.
*/
int view3d_opengl_select(
- ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input,
+ ViewContext *vc, uint *buffer, uint bufsize, const rcti *input,
eV3DSelectMode select_mode, eV3DSelectObjectFilter select_filter)
{
struct bThemeState theme_state;
@@ -944,8 +945,7 @@ int view3d_opengl_select(
const bool is_pick_select = (U.gpu_select_pick_deph != 0);
const bool do_passes = (
(is_pick_select == false) &&
- (select_mode == VIEW3D_SELECT_PICK_NEAREST) &&
- GPU_select_query_check_active());
+ (select_mode == VIEW3D_SELECT_PICK_NEAREST));
const bool use_nearest = (is_pick_select && select_mode == VIEW3D_SELECT_PICK_NEAREST);
bool draw_surface = true;
@@ -980,6 +980,8 @@ int view3d_opengl_select(
}
}
+ /* Important to use 'vc->obact', not 'OBACT(vc->view_layer)' below,
+ * so it will be NULL when hidden. */
struct {
DRW_ObjectFilterFn fn;
void *user_data;
@@ -987,7 +989,7 @@ int view3d_opengl_select(
switch (select_filter) {
case VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK:
{
- Object *obact = OBACT(vc->view_layer);
+ Object *obact = vc->obact;
if (obact && obact->mode != OB_MODE_OBJECT) {
object_filter.fn = drw_select_filter_object_mode_lock;
object_filter.user_data = obact;
@@ -996,7 +998,7 @@ int view3d_opengl_select(
}
case VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK:
{
- Object *obact = OBACT(vc->view_layer);
+ Object *obact = vc->obact;
BLI_assert(obact && (obact->mode & OB_MODE_WEIGHT_PAINT));
Object *ob_pose = BKE_object_pose_armature_get(obact);
@@ -1025,7 +1027,7 @@ int view3d_opengl_select(
/* All of the queries need to be perform on the drawing context. */
DRW_opengl_context_enable();
- G.f |= G_PICKSEL;
+ G.f |= G_FLAG_PICKSEL;
/* Important we use the 'viewmat' and don't re-calculate since
* the object & bone view locking takes 'rect' into account, see: T51629. */
@@ -1074,7 +1076,7 @@ int view3d_opengl_select(
.rect = &rect,
.gpu_select_mode = gpu_select_mode,
};
- draw_surface = true;
+ draw_surface = (v3d->shading.type > OB_WIRE) || ((v3d->shading.flag & V3D_XRAY_FLAG(v3d)) == 0);
DRW_draw_select_loop(
depsgraph, ar, v3d,
use_obedit_skip, draw_surface, use_nearest, &rect,
@@ -1083,7 +1085,7 @@ int view3d_opengl_select(
hits = drw_select_loop_user_data.hits;
}
- G.f &= ~G_PICKSEL;
+ G.f &= ~G_FLAG_PICKSEL;
ED_view3d_draw_setup_view(vc->win, depsgraph, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL);
if (v3d->shading.type > OB_WIRE) {
@@ -1110,16 +1112,16 @@ finally:
/** \name Local View Operators
* \{ */
-static unsigned int free_localbit(Main *bmain)
+static uint free_localbit(Main *bmain)
{
ScrArea *sa;
bScreen *sc;
- unsigned short local_view_bits = 0;
+ ushort local_view_bits = 0;
/* sometimes we loose a localview: when an area is closed */
/* check all areas: which localviews are in use? */
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *sl = sa->spacedata.first;
for (; sl; sl = sl->next) {
@@ -1149,14 +1151,15 @@ static bool view3d_localview_init(
Main *bmain,
ViewLayer *view_layer,
ScrArea *sa,
+ const bool frame_selected,
const int smooth_viewtx,
ReportList *reports)
{
View3D *v3d = sa->spacedata.first;
Base *base;
- float min[3], max[3], box[3], mid[3];
+ float min[3], max[3], box[3];
float size = 0.0f;
- unsigned int local_view_bit;
+ uint local_view_bit;
bool ok = false;
if (v3d->localvd) {
@@ -1184,7 +1187,7 @@ static bool view3d_localview_init(
}
else {
for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if (TESTBASE(v3d, base)) {
+ if (BASE_SELECTED(v3d, base)) {
BKE_object_minmax(base->object, min, max, false);
base->local_view_bits |= local_view_bit;
ok = true;
@@ -1196,27 +1199,32 @@ static bool view3d_localview_init(
size = max_fff(box[0], box[1], box[2]);
}
- if (ok == true) {
- ARegion *ar;
+ if (ok == false) {
+ return false;
+ }
- v3d->localvd = MEM_mallocN(sizeof(View3D), "localview");
+ ARegion *ar;
- memcpy(v3d->localvd, v3d, sizeof(View3D));
+ v3d->localvd = MEM_mallocN(sizeof(View3D), "localview");
- mid_v3_v3v3(mid, min, max);
+ memcpy(v3d->localvd, v3d, sizeof(View3D));
+ v3d->local_view_uuid = local_view_bit;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
- bool ok_dist = true;
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = ar->regiondata;
+ bool ok_dist = true;
- /* New view values. */
- Object *camera_old = NULL;
- float dist_new, ofs_new[3];
+ /* New view values. */
+ Object *camera_old = NULL;
+ float dist_new, ofs_new[3];
- rv3d->localvd = MEM_mallocN(sizeof(RegionView3D), "localview region");
- memcpy(rv3d->localvd, rv3d, sizeof(RegionView3D));
+ rv3d->localvd = MEM_mallocN(sizeof(RegionView3D), "localview region");
+ memcpy(rv3d->localvd, rv3d, sizeof(RegionView3D));
+ if (frame_selected) {
+ float mid[3];
+ mid_v3_v3v3(mid, min, max);
negate_v3_v3(ofs_new, mid);
if (rv3d->persp == RV3D_CAMOB) {
@@ -1235,7 +1243,7 @@ static bool view3d_localview_init(
if (rv3d->persp == RV3D_PERSP) {
/* Don't zoom closer than the near clipping plane. */
- dist_new = max_ff(dist_new, v3d->near * 1.5f);
+ dist_new = max_ff(dist_new, v3d->clip_start * 1.5f);
}
}
@@ -1245,48 +1253,52 @@ static bool view3d_localview_init(
&(const V3D_SmoothParams) {
.camera_old = camera_old,
.ofs = ofs_new, .quat = rv3d->viewquat,
- .dist = ok_dist ? &dist_new : NULL, .lens = &v3d->lens});
+ .dist = ok_dist ? &dist_new : NULL, .lens = &v3d->lens,
+ });
}
}
-
- v3d->local_view_uuid = local_view_bit;
}
- DEG_on_visible_update(bmain, false);
return ok;
}
-static void restore_localviewdata(
+static void view3d_localview_exit(
const Depsgraph *depsgraph,
wmWindowManager *wm,
wmWindow *win,
- Main *bmain,
+ ViewLayer *view_layer,
ScrArea *sa,
+ const bool frame_selected,
const int smooth_viewtx)
{
- const bool free = true;
- ARegion *ar;
View3D *v3d = sa->spacedata.first;
- Object *camera_old, *camera_new;
if (v3d->localvd == NULL) return;
- camera_old = v3d->camera;
- camera_new = v3d->localvd->camera;
+ for (Base *base = FIRSTBASE(view_layer); base; base = base->next) {
+ if (base->local_view_bits & v3d->local_view_uuid) {
+ base->local_view_bits &= ~v3d->local_view_uuid;
+ }
+ }
+
+ Object *camera_old = v3d->camera;
+ Object *camera_new = v3d->localvd->camera;
v3d->local_view_uuid = 0;
v3d->camera = v3d->localvd->camera;
- if (free) {
- MEM_freeN(v3d->localvd);
- v3d->localvd = NULL;
- }
+ MEM_freeN(v3d->localvd);
+ v3d->localvd = NULL;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d = ar->regiondata;
- if (rv3d->localvd) {
+ if (rv3d->localvd == NULL) {
+ continue;
+ }
+
+ if (frame_selected) {
Object *camera_old_rv3d, *camera_new_rv3d;
camera_old_rv3d = (rv3d->persp == RV3D_CAMOB) ? camera_old : NULL;
@@ -1303,57 +1315,16 @@ static void restore_localviewdata(
&(const V3D_SmoothParams) {
.camera_old = camera_old_rv3d, .camera = camera_new_rv3d,
.ofs = rv3d->localvd->ofs, .quat = rv3d->localvd->viewquat,
- .dist = &rv3d->localvd->dist});
-
- if (free) {
- MEM_freeN(rv3d->localvd);
- rv3d->localvd = NULL;
- }
+ .dist = &rv3d->localvd->dist,
+ });
}
- ED_view3d_shade_update(bmain, v3d, sa);
+ MEM_freeN(rv3d->localvd);
+ rv3d->localvd = NULL;
}
}
}
-static bool view3d_localview_exit(
- const Depsgraph *depsgraph,
- wmWindowManager *wm,
- wmWindow *win,
- Main *bmain,
- ViewLayer *view_layer,
- ScrArea *sa,
- const int smooth_viewtx)
-{
- View3D *v3d = sa->spacedata.first;
- struct Base *base;
- unsigned int local_view_bit;
-
- if (v3d->localvd) {
-
- local_view_bit = v3d->local_view_uuid;
-
- restore_localviewdata(depsgraph, wm, win, bmain, sa, smooth_viewtx);
-
- Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
- for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if (base->local_view_bits & local_view_bit) {
- base->local_view_bits &= ~local_view_bit;
- if (base->object != obedit) {
- ED_object_base_select(base, BA_SELECT);
- }
- }
- }
-
- DEG_on_visible_update(bmain, false);
-
- return true;
- }
- else {
- return false;
- }
-}
-
static int localview_exec(bContext *C, wmOperator *op)
{
const Depsgraph *depsgraph = CTX_data_depsgraph(C);
@@ -1365,13 +1336,15 @@ static int localview_exec(bContext *C, wmOperator *op)
ViewLayer *view_layer = CTX_data_view_layer(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = CTX_wm_view3d(C);
+ bool frame_selected = RNA_boolean_get(op->ptr, "frame_selected");
bool changed;
if (v3d->localvd) {
- changed = view3d_localview_exit(depsgraph, wm, win, bmain, view_layer, sa, smooth_viewtx);
+ view3d_localview_exit(depsgraph, wm, win, view_layer, sa, frame_selected, smooth_viewtx);
+ changed = true;
}
else {
- changed = view3d_localview_init(depsgraph, wm, win, bmain, view_layer, sa, smooth_viewtx, op->reports);
+ changed = view3d_localview_init(depsgraph, wm, win, bmain, view_layer, sa, frame_selected, smooth_viewtx, op->reports);
}
if (changed) {
@@ -1406,6 +1379,8 @@ void VIEW3D_OT_localview(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO; /* localview changes object layer bitflags */
ot->poll = ED_operator_view3d_active;
+
+ RNA_def_boolean(ot->srna, "frame_selected", true, "Frame Selected", "Move the view to frame the selected objects");
}
static int localview_remove_from_exec(bContext *C, wmOperator *op)
@@ -1417,7 +1392,7 @@ static int localview_remove_from_exec(bContext *C, wmOperator *op)
bool changed = false;
for (Base *base = FIRSTBASE(view_layer); base; base = base->next) {
- if (TESTBASE(v3d, base)) {
+ if (BASE_SELECTED(v3d, base)) {
base->local_view_bits &= ~v3d->local_view_uuid;
ED_object_base_select(base, BA_DESELECT);
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index a716264febb..0caaf6eb113 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Dalai Felinto, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_view3d/view3d_walk.c
- * \ingroup spview3d
+/** \file
+ * \ingroup spview3d
*/
/* defines VIEW3D_OT_navigate - walk modal operator */
@@ -42,9 +36,6 @@
#include "BLT_translation.h"
-
-#include "BIF_gl.h"
-
#include "WM_api.h"
#include "WM_types.h"
@@ -65,7 +56,8 @@
#ifdef WITH_INPUT_NDOF
//# define NDOF_WALK_DEBUG
-//# define NDOF_WALK_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesn't thrash - campbell */
+/* is this needed for ndof? - commented so redraw doesn't thrash - campbell */
+//# define NDOF_WALK_DRAW_TOOMUCH
#endif
#define USE_TABLET_SUPPORT
@@ -76,7 +68,8 @@
/* prototypes */
static float getVelocityZeroTime(const float gravity, const float velocity);
-/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
+/* NOTE: these defines are saved in keymap files,
+ * do not change values but just add new ones */
enum {
WALK_MODAL_CANCEL = 1,
WALK_MODAL_CONFIRM,
@@ -167,7 +160,8 @@ void walk_modal_keymap(wmKeyConfig *keyconf)
{WALK_MODAL_TOGGLE, "GRAVITY_TOGGLE", 0, "Toggle Gravity", "Toggle gravity effect"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Walk Modal");
@@ -945,15 +939,17 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk)
RegionView3D *rv3d = walk->rv3d;
ARegion *ar = walk->ar;
- float mat[3][3]; /* 3x3 copy of the view matrix so we can move along the view axis */
- float dvec[3] = {0.0f, 0.0f, 0.0f}; /* this is the direction that's added to the view offset per redraw */
+ /* 3x3 copy of the view matrix so we can move along the view axis */
+ float mat[3][3];
+ /* this is the direction that's added to the view offset per redraw */
+ float dvec[3] = {0.0f, 0.0f, 0.0f};
int moffset[2]; /* mouse offset from the views center */
float tmp_quat[4]; /* used for rotating the view */
#ifdef NDOF_WALK_DEBUG
{
- static unsigned int iteration = 1;
+ static uint iteration = 1;
printf("walk timer %d\n", iteration++);
}
#endif
@@ -1378,7 +1374,8 @@ static int walk_modal(bContext *C, wmOperator *op, const wmEvent *event)
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, walk_object);
}
- // puts("redraw!"); // too frequent, commented with NDOF_WALK_DRAW_TOOMUCH for now
+ // too frequent, commented with NDOF_WALK_DRAW_TOOMUCH for now
+ // puts("redraw!");
ED_region_tag_redraw(CTX_wm_region(C));
}
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index ccc143af18f..088128ba152 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 2b2de65db15..4e41b3a1065 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <stdlib.h>
@@ -72,8 +64,6 @@
#include "DEG_depsgraph.h"
-#include "BIF_glutil.h"
-
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
@@ -224,7 +214,7 @@ static bool transdata_check_local_center(TransInfo *t, short around)
(t->flag & (T_OBJECT | T_POSE)) ||
/* implicit: (t->flag & T_EDIT) */
(ELEM(t->obedit_type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE, OB_GPENCIL)) ||
- (t->spacetype == SPACE_IPO) ||
+ (t->spacetype == SPACE_GRAPH) ||
(t->options & (CTX_MOVIECLIP | CTX_MASK | CTX_PAINT_CURVE)))
);
}
@@ -287,7 +277,7 @@ void setTransformViewAspect(TransInfo *t, float r_aspect[3])
ED_space_clip_get_aspect(sclip, &r_aspect[0], &r_aspect[1]);
}
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
/* depemds on context of usage */
}
}
@@ -354,7 +344,7 @@ void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy)
r_vec[0] *= t->aspect[0];
r_vec[1] *= t->aspect[1];
}
- else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
+ else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA)) {
convertViewVec2D(t->view, r_vec, dx, dy);
}
else if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
@@ -382,7 +372,8 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr
if (t->spacetype == SPACE_VIEW3D) {
if (t->ar->regiontype == RGN_TYPE_WINDOW) {
if (ED_view3d_project_int_global(t->ar, vec, adr, flag) != V3D_PROJ_RET_OK) {
- adr[0] = (int)2140000000.0f; /* this is what was done in 2.64, perhaps we can be smarter? */
+ /* this is what was done in 2.64, perhaps we can be smarter? */
+ adr[0] = (int)2140000000.0f;
adr[1] = (int)2140000000.0f;
}
}
@@ -435,7 +426,7 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr
adr[0] = out[0];
adr[1] = out[1];
}
- else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
+ else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA)) {
int out[2] = {0, 0};
UI_view2d_view_to_region((View2D *)t->view, vec[0], vec[1], &out[0], &out[1]);
@@ -598,7 +589,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
else
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- /* for realtime animation record - send notifiers recognised by animation editors */
+ /* For real-time animation record - send notifiers recognized by animation editors */
// XXX: is this notifier a lame duck?
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene))
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
@@ -609,8 +600,8 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
//SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
- else if (t->spacetype == SPACE_IPO) {
- //SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ else if (t->spacetype == SPACE_GRAPH) {
+ //SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
else if (t->spacetype == SPACE_NLA) {
@@ -633,6 +624,9 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
wmWindow *window = CTX_wm_window(C);
WM_paint_cursor_tag_redraw(window, t->ar);
}
+ else if (t->flag & T_CURSOR) {
+ ED_area_tag_redraw(t->sa);
+ }
else {
// XXX how to deal with lock?
SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first;
@@ -693,7 +687,7 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
allqueue(REDRAWIMAGE, 0);
allqueue(REDRAWVIEW3D, 0);
}
- else if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) {
+ else if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH)) {
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
@@ -942,7 +936,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
{TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Move", ""},
{TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""},
{TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Transform Modal Map");
@@ -995,7 +989,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
stopConstraint(t);
}
else {
- setUserConstraint(t, V3D_MANIP_GLOBAL, constraint_axis, msg1);
+ setUserConstraint(t, V3D_ORIENT_GLOBAL, constraint_axis, msg1);
}
}
else if (!edit_2d) {
@@ -1003,7 +997,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
/* First press, constraint to an axis. */
t->orientation.index = 0;
const short *orientation_ptr = t->orientation.types[t->orientation.index];
- const short orientation = orientation_ptr ? *orientation_ptr : V3D_MANIP_GLOBAL;
+ const short orientation = orientation_ptr ? *orientation_ptr : V3D_ORIENT_GLOBAL;
if (is_plane == false) {
setUserConstraint(t, orientation, constraint_axis, msg2);
}
@@ -1020,7 +1014,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
}
else {
const short *orientation_ptr = t->orientation.types[t->orientation.index];
- const short orientation = orientation_ptr ? *orientation_ptr : V3D_MANIP_GLOBAL;
+ const short orientation = orientation_ptr ? *orientation_ptr : V3D_ORIENT_GLOBAL;
if (is_plane == false) {
setUserConstraint(t, orientation, constraint_axis, msg2);
}
@@ -1055,7 +1049,8 @@ int transformEvent(TransInfo *t, const wmEvent *event)
copy_v2_v2_int(t->mval, event->mval);
- // t->redraw |= TREDRAW_SOFT; /* Use this for soft redraw. Might cause flicker in object mode */
+ /* Use this for soft redraw. Might cause flicker in object mode */
+ // t->redraw |= TREDRAW_SOFT;
t->redraw |= TREDRAW_HARD;
if (t->state == TRANS_STARTING) {
@@ -1162,7 +1157,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
if (ELEM(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) {
/* Scale isn't normally very useful after extrude along normals, see T39756 */
- if ((t->con.mode & CON_APPLY) && (t->con.orientation == V3D_MANIP_NORMAL)) {
+ if ((t->con.mode & CON_APPLY) && (t->con.orientation == V3D_ORIENT_NORMAL)) {
stopConstraint(t);
}
@@ -1270,7 +1265,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
float fac = 1.0f + 0.005f *(event->y - event->prevy);
t->prop_size *= fac;
if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) {
- t->prop_size = max_ff(min_ff(t->prop_size, ((View3D *)t->view)->far), T_PROP_SIZE_MIN);
+ t->prop_size = max_ff(min_ff(t->prop_size, ((View3D *)t->view)->clip_end), T_PROP_SIZE_MIN);
}
else {
t->prop_size = max_ff(min_ff(t->prop_size, T_PROP_SIZE_MAX), T_PROP_SIZE_MIN);
@@ -1284,7 +1279,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
if (t->flag & T_PROP_EDIT) {
t->prop_size *= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f;
if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) {
- t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far);
+ t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->clip_end);
}
else {
t->prop_size = min_ff(t->prop_size, T_PROP_SIZE_MAX);
@@ -1381,7 +1376,8 @@ int transformEvent(TransInfo *t, const wmEvent *event)
}
else {
if (event->shift) {
- /* bit hackish... but it prevents mmb select to print the orientation from menu */
+ /* bit hackish... but it prevents mmb select to print the
+ * orientation from menu */
float mati[3][3];
strcpy(t->spacename, "global");
unit_m3(mati);
@@ -1473,7 +1469,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
if (event->alt && t->flag & T_PROP_EDIT) {
t->prop_size *= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f;
if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO)
- t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->far);
+ t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->clip_end);
calculatePropRatio(t);
t->redraw = TREDRAW_HARD;
handled = true;
@@ -1953,7 +1949,7 @@ static bool transinfo_show_overlay(const struct bContext *C, TransInfo *t, ARegi
ScrArea *sa = CTX_wm_area(C);
if (sa->spacetype == SPACE_VIEW3D) {
View3D *v3d = sa->spacedata.first;
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+ if ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) {
ok = true;
}
}
@@ -1985,7 +1981,8 @@ static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg)
}
}
-/* just draw a little warning message in the top-right corner of the viewport to warn that autokeying is enabled */
+/* just draw a little warning message in the top-right corner of the viewport
+ * to warn that autokeying is enabled */
static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
{
rcti rect;
@@ -2061,7 +2058,6 @@ static void drawTransformPixel(const struct bContext *C, ARegion *ar, void *arg)
void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- bool constraint_axis[3] = {false, false, false};
int proportional = 0;
PropertyRNA *prop;
@@ -2108,7 +2104,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
if ((prop = RNA_struct_find_property(op->ptr, "proportional")) &&
!RNA_property_is_set(op->ptr, prop))
{
- if (t->spacetype == SPACE_IPO)
+ if (t->spacetype == SPACE_GRAPH)
ts->proportional_fcurve = proportional;
else if (t->spacetype == SPACE_ACTION)
ts->proportional_action = proportional;
@@ -2143,9 +2139,9 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
if (t->spacetype == SPACE_VIEW3D) {
- if ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_type")) &&
!RNA_property_is_set(op->ptr, prop) &&
- (t->orientation.user != V3D_MANIP_CUSTOM_MATRIX))
+ (t->orientation.user != V3D_ORIENT_CUSTOM_MATRIX))
{
TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT];
orient_slot->type = t->orientation.user;
@@ -2162,55 +2158,109 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
RNA_float_set(op->ptr, "proportional_size", t->prop_size);
}
- if ((prop = RNA_struct_find_property(op->ptr, "axis"))) {
- RNA_property_float_set_array(op->ptr, prop, t->axis);
- }
-
- if ((prop = RNA_struct_find_property(op->ptr, "axis_ortho"))) {
- RNA_property_float_set_array(op->ptr, prop, t->axis_ortho);
- }
-
if ((prop = RNA_struct_find_property(op->ptr, "mirror"))) {
- RNA_property_boolean_set(op->ptr, prop, (t->flag & T_MIRROR) != 0);
+ RNA_property_boolean_set(op->ptr, prop, (t->flag & T_NO_MIRROR) == 0);
}
- if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
- /* constraint orientation can be global, even if user selects something else
- * so use the orientation in the constraint if set */
- short orientation = (t->con.mode & CON_APPLY) ? t->con.orientation : t->orientation.user;
-
- if (orientation == V3D_MANIP_CUSTOM) {
+ /* Orientation used for redo. */
+ const bool use_orient_axis = (
+ t->orient_matrix_is_set &&
+ (RNA_struct_find_property(op->ptr, "orient_axis") != NULL));
+ short orientation;
+ if (t->con.mode & CON_APPLY) {
+ orientation = t->con.orientation;
+ if (orientation == V3D_ORIENT_CUSTOM) {
const int orientation_index_custom = BKE_scene_transform_orientation_get_index(
t->scene, t->orientation.custom);
-
- /* Maybe we need a t->con.custom_orientation? Seems like it would always match t->orientation.custom. */
- orientation = V3D_MANIP_CUSTOM + orientation_index_custom;
- BLI_assert(orientation >= V3D_MANIP_CUSTOM);
+ /* Maybe we need a t->con.custom_orientation?
+ * Seems like it would always match t->orientation.custom. */
+ orientation = V3D_ORIENT_CUSTOM + orientation_index_custom;
+ BLI_assert(orientation >= V3D_ORIENT_CUSTOM);
}
+ }
+ else if ((t->orientation.user == V3D_ORIENT_CUSTOM_MATRIX) &&
+ (prop = RNA_struct_find_property(op->ptr, "orient_matrix_type")))
+ {
+ orientation = RNA_property_enum_get(op->ptr, prop);
+ }
+ else if (use_orient_axis) {
+ /* We're not using an orientation, use the fallback. */
+ orientation = t->orientation.unset;
+ }
+ else {
+ orientation = V3D_ORIENT_GLOBAL;
+ }
- RNA_float_set_array(op->ptr, "constraint_matrix", &t->spacemtx[0][0]);
- /* Use 'constraint_matrix' instead. */
- if (orientation != V3D_MANIP_CUSTOM_MATRIX) {
- RNA_enum_set(op->ptr, "constraint_orientation", orientation);
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_axis"))) {
+ if (t->flag & T_MODAL) {
+ if (t->con.mode & CON_APPLY) {
+ int orient_axis = constraintModeToIndex(t);
+ if (orient_axis != -1) {
+ RNA_property_enum_set(op->ptr, prop, orient_axis);
+ }
+ }
+ else {
+ RNA_property_enum_set(op->ptr, prop, t->orient_axis);
+ }
+ }
+ }
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) {
+ if (t->flag & T_MODAL) {
+ RNA_property_enum_set(op->ptr, prop, t->orient_axis_ortho);
}
+ }
- if (t->con.mode & CON_APPLY) {
- if (t->con.mode & CON_AXIS0) {
- constraint_axis[0] = true;
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_matrix"))) {
+ if (t->flag & T_MODAL) {
+ if (orientation != V3D_ORIENT_CUSTOM_MATRIX) {
+ if (t->flag & T_MODAL) {
+ RNA_enum_set(op->ptr, "orient_matrix_type", orientation);
+ }
+ }
+ if (t->con.mode & CON_APPLY) {
+ RNA_float_set_array(op->ptr, "orient_matrix", &t->con.mtx[0][0]);
}
- if (t->con.mode & CON_AXIS1) {
- constraint_axis[1] = true;
+ else if (use_orient_axis) {
+ RNA_float_set_array(op->ptr, "orient_matrix", &t->orient_matrix[0][0]);
}
- if (t->con.mode & CON_AXIS2) {
- constraint_axis[2] = true;
+ else {
+ RNA_float_set_array(op->ptr, "orient_matrix", &t->spacemtx[0][0]);
+ }
+ }
+ }
+
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_type"))) {
+ /* constraint orientation can be global, even if user selects something else
+ * so use the orientation in the constraint if set */
+
+ /* Use 'orient_matrix' instead. */
+ if (t->flag & T_MODAL) {
+ if (orientation != V3D_ORIENT_CUSTOM_MATRIX) {
+ RNA_property_enum_set(op->ptr, prop, orientation);
}
}
+ }
- /* Only set if needed, so we can hide in the UI when nothing is set.
- * See 'transform_poll_property'. */
- if (ELEM(true, UNPACK3(constraint_axis))) {
- RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
+ if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
+ bool constraint_axis[3] = {false, false, false};
+ if (t->flag & T_MODAL) {
+ /* Only set if needed, so we can hide in the UI when nothing is set.
+ * See 'transform_poll_property'. */
+ if (t->con.mode & CON_APPLY) {
+ if (t->con.mode & CON_AXIS0) {
+ constraint_axis[0] = true;
+ }
+ if (t->con.mode & CON_AXIS1) {
+ constraint_axis[1] = true;
+ }
+ if (t->con.mode & CON_AXIS2) {
+ constraint_axis[2] = true;
+ }
+ }
+ if (ELEM(true, UNPACK3(constraint_axis))) {
+ RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
+ }
}
}
@@ -2322,7 +2372,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
SPACE_TYPE_ANY, RGN_TYPE_ANY,
helpline_poll, drawHelpline, t);
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
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(
@@ -2350,10 +2400,10 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
/* keymap for shortcut header prints */
t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
- /* Stupid code to have Ctrl-Click on gizmo work ok
+ /* Stupid code to have Ctrl-Click on gizmo work ok.
*
- * do this only for translation/rotation/resize due to only this
- * moded are available from gizmo and doing such check could
+ * Do this only for translation/rotation/resize because only these
+ * modes are available from gizmo and doing such check could
* lead to keymap conflicts for other modes (see #31584)
*/
if (ELEM(mode, TFM_TRANSLATION, TFM_ROTATION, TFM_RESIZE)) {
@@ -2378,9 +2428,13 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
initSnapSpatial(t, t->snap_spatial);
- /* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */
+ /* EVIL! posemode code can switch translation to rotate when 1 bone is selected.
+ * will be removed (ton) */
+
/* EVIL2: we gave as argument also texture space context bit... was cleared */
- /* EVIL3: extend mode for animation editors also switches modes... but is best way to avoid duplicate code */
+
+ /* EVIL3: extend mode for animation editors also switches modes...
+ * but is best way to avoid duplicate code */
mode = t->mode;
calculatePropRatio(t);
@@ -2413,41 +2467,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
}
- /* Transformation axis from operator */
- if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop)) {
- RNA_property_float_get_array(op->ptr, prop, t->axis);
- normalize_v3(t->axis);
- copy_v3_v3(t->axis_orig, t->axis);
- }
-
- if ((prop = RNA_struct_find_property(op->ptr, "axis_ortho")) && RNA_property_is_set(op->ptr, prop)) {
- RNA_property_float_get_array(op->ptr, prop, t->axis_ortho);
- normalize_v3(t->axis_ortho);
- }
-
- /* Constraint init from operator */
- if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) {
- bool constraint_axis[3];
-
- RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
-
- if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) {
- t->con.mode |= CON_APPLY;
-
- if (constraint_axis[0]) {
- t->con.mode |= CON_AXIS0;
- }
- if (constraint_axis[1]) {
- t->con.mode |= CON_AXIS1;
- }
- if (constraint_axis[2]) {
- t->con.mode |= CON_AXIS2;
- }
-
- setUserConstraint(t, t->orientation.user, t->con.mode, "%s");
- }
- }
-
if (event) {
/* Initialize accurate transform to settings requested by keymap. */
bool use_accurate = false;
@@ -2559,7 +2578,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
/* same as TFM_TIME_EXTEND, but we need the mode info for later
* so that duplicate-culling will work properly
*/
- if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA))
+ if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA))
initTranslation(t);
else
initTimeTranslate(t);
@@ -2571,7 +2590,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
* (for Graph/NLA Editors only since they uses 'standard' transforms to get 2D movement)
* depending on which editor this was called from
*/
- if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA))
+ if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA))
initTranslation(t);
else
initTimeTranslate(t);
@@ -2601,6 +2620,65 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
return 0;
}
+ /* Transformation axis from operator */
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_axis")) &&
+ RNA_property_is_set(op->ptr, prop))
+ {
+ t->orient_axis = RNA_property_enum_get(op->ptr, prop);
+ }
+ if ((prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho")) &&
+ RNA_property_is_set(op->ptr, prop))
+ {
+ t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop);
+ }
+
+ /* Constraint init from operator */
+ if (t->flag & T_MODAL) {
+ if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) &&
+ RNA_property_is_set(op->ptr, prop))
+ {
+ bool constraint_axis[3];
+
+ RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
+
+ if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) {
+ t->con.mode |= CON_APPLY;
+
+ /* Only for interactive operation, when redoing, ignore these values since the numbers
+ * will be constrainted already. */
+ if (t->flag & T_MODAL) {
+ if (constraint_axis[0]) {
+ t->con.mode |= CON_AXIS0;
+ }
+ if (constraint_axis[1]) {
+ t->con.mode |= CON_AXIS1;
+ }
+ if (constraint_axis[2]) {
+ t->con.mode |= CON_AXIS2;
+ }
+ }
+ else {
+ t->con.mode |= CON_AXIS0 | CON_AXIS1 | CON_AXIS2;
+ }
+
+ setUserConstraint(t, t->orientation.user, t->con.mode, "%s");
+ }
+ }
+ }
+ else {
+ /* So we can adjust in non global orientation. */
+ if (t->orientation.user != V3D_ORIENT_GLOBAL) {
+ t->con.mode |= CON_APPLY | CON_AXIS0 | CON_AXIS1 | CON_AXIS2;
+ setUserConstraint(t, t->orientation.user, t->con.mode, "%s");
+ }
+ }
+
+ /* Don't write into the values when non-modal because they are already set from operator redo values. */
+ if (t->flag & T_MODAL) {
+ /* Setup the mouse input with initial values. */
+ applyMouseInput(t, &t->mouse, t->mouse.imval, t->values);
+ }
+
if ((prop = RNA_struct_find_property(op->ptr, "preserve_clnor"))) {
if ((t->flag & T_EDIT) && t->obedit_type == OB_MESH) {
@@ -2609,8 +2687,10 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
BMEditMesh *em = NULL;// BKE_editmesh_from_object(t->obedit);
bool do_skip = false;
- /* Currently only used for two of three most frequent transform ops, can include more ops.
- * Note that scaling cannot be included here, non-uniform scaling will affect normals. */
+ /* Currently only used for two of three most frequent transform ops,
+ * can include more ops.
+ * Note that scaling cannot be included here,
+ * non-uniform scaling will affect normals. */
if (ELEM(t->mode, TFM_TRANSLATION, TFM_ROTATION)) {
if (em->bm->totvertsel == em->bm->totvert) {
/* No need to invalidate if whole mesh is selected. */
@@ -3305,7 +3385,20 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
CLAMP(fac, 0.0f, 1.0f);
}
- fac_scaled = fac * td->factor;
+ if (t->options & CTX_GPENCIL_STROKES) {
+ /* grease pencil multiframe falloff */
+ bGPDstroke *gps = (bGPDstroke *)td->extra;
+ if (gps != NULL) {
+ fac_scaled = fac * td->factor * gps->runtime.multi_frame_falloff;
+ }
+ else {
+ fac_scaled = fac * td->factor;
+ }
+ }
+ else {
+ fac_scaled = fac * td->factor;
+ }
+
axis_angle_normalized_to_mat3(mat, data->warp_nor, values.angle * fac_scaled);
interp_v3_v3v3(delta, warp_sta_local, warp_end_radius_local, fac_scaled);
sub_v3_v3(delta, warp_sta_local);
@@ -3347,10 +3440,15 @@ static void initShear_mouseInputMode(TransInfo *t)
float dir[3];
if (t->custom.mode.data == NULL) {
- copy_v3_v3(dir, t->axis_ortho);
+ copy_v3_v3(dir, t->orient_matrix[t->orient_axis_ortho]);
}
else {
- cross_v3_v3v3(dir, t->axis_ortho, t->axis);
+ cross_v3_v3v3(dir, t->orient_matrix[t->orient_axis_ortho], t->orient_matrix[t->orient_axis]);
+ }
+
+ /* Without this, half the gizmo handles move in the opposite direction. */
+ if ((t->orient_axis_ortho + 1) % 3 != t->orient_axis) {
+ negate_v3(dir);
}
mul_mat3_m4_v3(t->viewmat, dir);
@@ -3368,13 +3466,9 @@ static void initShear(TransInfo *t)
t->transform = applyShear;
t->handleEvent = handleEventShear;
- if (is_zero_v3(t->axis)) {
- negate_v3_v3(t->axis, t->viewinv[2]);
- normalize_v3(t->axis);
- }
- if (is_zero_v3(t->axis_ortho)) {
- copy_v3_v3(t->axis_ortho, t->viewinv[0]);
- normalize_v3(t->axis_ortho);
+ if (t->orient_axis == t->orient_axis_ortho) {
+ t->orient_axis = 2;
+ t->orient_axis_ortho = 1;
}
initShear_mouseInputMode(t);
@@ -3463,8 +3557,8 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
else
smat[0][1] = value;
- copy_v3_v3(axismat_inv[0], t->axis_ortho);
- copy_v3_v3(axismat_inv[2], t->axis);
+ copy_v3_v3(axismat_inv[0], t->orient_matrix[t->orient_axis_ortho]);
+ copy_v3_v3(axismat_inv[2], t->orient_matrix[t->orient_axis]);
cross_v3_v3v3(axismat_inv[1], axismat_inv[0], axismat_inv[2]);
invert_m3_m3(axismat, axismat_inv);
@@ -3504,7 +3598,19 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
add_v3_v3(vec, center);
sub_v3_v3(vec, co);
- mul_v3_fl(vec, td->factor);
+ if (t->options & CTX_GPENCIL_STROKES) {
+ /* grease pencil multiframe falloff */
+ bGPDstroke *gps = (bGPDstroke *)td->extra;
+ if (gps != NULL) {
+ mul_v3_fl(vec, td->factor * gps->runtime.multi_frame_falloff);
+ }
+ else {
+ mul_v3_fl(vec, td->factor);
+ }
+ }
+ else {
+ mul_v3_fl(vec, td->factor);
+ }
add_v3_v3v3(td->loc, td->iloc, vec);
}
@@ -3763,14 +3869,28 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
}
size_to_mat3(mat, t->values);
-
- if (t->con.applySize) {
+ if (t->con.mode & CON_APPLY) {
t->con.applySize(t, NULL, NULL, mat);
+
+ /* Only so we have re-usable value with redo. */
+ float pvec[3] = {0.0f, 0.0f, 0.0f};
+ int j = 0;
+ for (i = 0; i < 3; i++) {
+ if (!(t->con.mode & (CON_AXIS0 << i))) {
+ t->values[i] = 1.0f;
+ }
+ else {
+ pvec[j++] = t->values[i];
+ }
+ }
+ headerResize(t, pvec, str);
+ }
+ else {
+ headerResize(t, t->values, str);
}
copy_m3_m3(t->mat, mat); // used in gizmo
- headerResize(t, t->values, str);
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
@@ -3789,8 +3909,9 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 1)) {
size_to_mat3(mat, t->values);
- if (t->con.applySize)
+ if (t->con.mode & CON_APPLY) {
t->con.applySize(t, NULL, NULL, mat);
+ }
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
@@ -4024,8 +4145,10 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
static void postInputRotation(TransInfo *t, float values[3])
{
+ float axis_final[3];
+ copy_v3_v3(axis_final, t->orient_matrix[t->orient_axis]);
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
- t->con.applyRot(t, NULL, NULL, t->axis, values);
+ t->con.applyRot(t, NULL, NULL, axis_final, values);
}
}
@@ -4050,18 +4173,6 @@ static void initRotation(TransInfo *t)
if (t->flag & T_2D_EDIT)
t->flag |= T_NO_CONSTRAINT;
-
- if (t->options & CTX_PAINT_CURVE) {
- t->axis[0] = 0.0;
- t->axis[1] = 0.0;
- t->axis[2] = -1.0;
- }
- else {
- negate_v3_v3(t->axis, t->viewinv[2]);
- normalize_v3(t->axis);
- }
-
- copy_v3_v3(t->axis_orig, t->axis);
}
/* Used by Transform Rotation and Transform Normal Rotation */
@@ -4295,7 +4406,7 @@ static void ElementRotation_ex(TransInfo *t, TransDataContainer *tc, TransData *
mul_m3_m3m3(smat, td->smtx, totmat);
/* calculate the total rotatation in eulers */
- add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* we have to correct for delta rot */
+ add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* correct for delta rot */
eulO_to_mat3(obmat, eul, td->ext->rotOrder);
/* mat = transform, obmat = object rotation */
mul_m3_m3m3(fmat, smat, obmat);
@@ -4370,12 +4481,11 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
snapGridIncrement(t, &final);
+ float axis_final[3];
+ copy_v3_v3(axis_final, t->orient_matrix[t->orient_axis]);
+
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
- t->con.applyRot(t, NULL, NULL, t->axis, NULL);
- }
- else {
- /* reset axis if constraint is not set */
- copy_v3_v3(t->axis, t->axis_orig);
+ t->con.applyRot(t, NULL, NULL, axis_final, NULL);
}
applySnapping(t, &final);
@@ -4387,7 +4497,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
headerRotation(t, str, final);
- applyRotationValue(t, final, t->axis);
+ applyRotationValue(t, final, axis_final);
recalcData(t);
@@ -4517,7 +4627,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
/* Transform (Normal Rotation) */
/** \name Transform Normal Rotation
-* \{ */
+ * \{ */
static void storeCustomLNorValue(TransDataContainer *tc, BMesh *bm)
{
@@ -4537,7 +4647,8 @@ void freeCustomNormalArray(TransInfo *t, TransDataContainer *tc, TransCustomData
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
BMesh *bm = em->bm;
- for (int i = 0; i < lnors_ed_arr->totloop; i++, lnor_ed++) { /* Restore custom loop normal on cancel */
+ /* Restore custom loop normal on cancel */
+ for (int i = 0; i < lnors_ed_arr->totloop; i++, lnor_ed++) {
BKE_lnor_space_custom_normal_to_data(
bm->lnor_spacearr->lspacearr[lnor_ed->loop_index], lnor_ed->niloc, lnor_ed->clnors_data);
}
@@ -4576,11 +4687,6 @@ static void initNormalRotation(TransInfo *t)
storeCustomLNorValue(tc, bm);
}
-
- negate_v3_v3(t->axis, t->viewinv[2]);
- normalize_v3(t->axis);
-
- copy_v3_v3(t->axis_orig, t->axis);
}
/* Works by getting custom normal from clnor_data, transform, then store */
@@ -4588,12 +4694,11 @@ static void applyNormalRotation(TransInfo *t, const int UNUSED(mval[2]))
{
char str[UI_MAX_DRAW_STR];
+ float axis_final[3];
+ copy_v3_v3(axis_final, t->orient_matrix[t->orient_axis]);
+
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
- t->con.applyRot(t, NULL, NULL, t->axis, NULL);
- }
- else {
- /* reset axis if constraint is not set */
- copy_v3_v3(t->axis, t->axis_orig);
+ t->con.applyRot(t, NULL, NULL, axis_final, NULL);
}
FOREACH_TRANS_DATA_CONTAINER(t, tc) {
@@ -4606,7 +4711,7 @@ static void applyNormalRotation(TransInfo *t, const int UNUSED(mval[2]))
float axis[3];
float mat[3][3];
float angle = t->values[0];
- copy_v3_v3(axis, t->axis);
+ copy_v3_v3(axis, axis_final);
snapGridIncrement(t, &angle);
@@ -4664,7 +4769,7 @@ static void initSnapSpatial(TransInfo *t, float r_snap[3])
r_snap[1] = ED_node_grid_size();
r_snap[2] = ED_node_grid_size();
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
r_snap[0] = 0.0f;
r_snap[1] = 1.0;
r_snap[2] = 0.1f;
@@ -4708,7 +4813,7 @@ static void initTranslation(TransInfo *t)
t->num.unit_type[2] = B_UNIT_LENGTH;
}
else {
- /* SPACE_IPO, SPACE_ACTION, etc. could use some time units, when we have them... */
+ /* SPACE_GRAPH, SPACE_ACTION, etc. could use some time units, when we have them... */
t->num.unit_type[0] = B_UNIT_NONE;
t->num.unit_type[1] = B_UNIT_NONE;
t->num.unit_type[2] = B_UNIT_NONE;
@@ -5980,7 +6085,7 @@ static void slide_origdata_create_data_vert(
}
static void slide_origdata_create_data(
- TransInfo *t, TransDataContainer *tc, SlideOrigData *sod,
+ TransDataContainer *tc, SlideOrigData *sod,
TransDataGenericSlideVert *sv_array, unsigned int v_stride, unsigned int v_num)
{
if (sod->use_origfaces) {
@@ -6015,7 +6120,7 @@ static void slide_origdata_create_data(
slide_origdata_create_data_vert(bm, sod, sv);
}
- if (t->flag & T_MIRROR) {
+ if (tc->mirror.axis_flag) {
TransData *td = tc->data;
TransDataGenericSlideVert *sv_mirror;
@@ -6101,9 +6206,12 @@ static void slide_origdata_interp_data_vert(
bool co_next_ok;
- /* In the unlikely case that we're next to a zero length edge - walk around the to the next.
+ /* In the unlikely case that we're next to a zero length edge -
+ * walk around the to the next.
+ *
* Since we only need to check if the vertex is in this corner,
- * its not important _which_ loop - as long as its not overlapping 'sv->co_orig_3d', see: T45096. */
+ * its not important _which_ loop - as long as its not overlapping
+ * 'sv->co_orig_3d', see: T45096. */
project_plane_normalized_v3_v3v3(v_proj[0], co_prev, v_proj_axis);
while (UNLIKELY(((co_prev_ok = (len_squared_v3v3(v_proj[1], v_proj[0]) > eps)) == false) &&
((l_prev = l_prev->prev) != l->next)))
@@ -6941,7 +7049,9 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t
else if (l_b == NULL && l_a && (l_a->radial_next != l_a)) l_b = l_a->radial_next;
}
else if (e->l != NULL) {
- /* if there are non-contiguous faces, we can still recover the loops of the new edges faces */
+ /* if there are non-contiguous faces, we can still recover
+ * the loops of the new edges faces */
+
/* note!, the behavior in this case means edges may move in opposite directions,
* this could be made to work more usefully. */
@@ -6995,7 +7105,7 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t
/* create copies of faces for customdata projection */
bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
slide_origdata_init_data(tc, &sld->orig_data);
- slide_origdata_create_data(t, tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
+ slide_origdata_create_data(tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
if (rv3d) {
calcEdgeSlide_even(t, tc, sld, mval);
@@ -7190,7 +7300,7 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t
/* create copies of faces for customdata projection */
bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
slide_origdata_init_data(tc, &sld->orig_data);
- slide_origdata_create_data(t, tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
+ slide_origdata_create_data(tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
if (rv3d) {
calcEdgeSlide_even(t, tc, sld, mval);
@@ -7806,7 +7916,7 @@ static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc)
bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
slide_origdata_init_data(tc, &sld->orig_data);
- slide_origdata_create_data(t, tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
+ slide_origdata_create_data(tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
sld->em = em;
@@ -8541,7 +8651,8 @@ static void initSeqSlide(TransInfo *t)
copy_v3_fl(t->num.val_inc, t->snap[1]);
t->num.unit_sys = t->scene->unit.system;
- /* Would be nice to have a time handling in units as well (supporting frames in addition to "natural" time...). */
+ /* Would be nice to have a time handling in units as well
+ * (supporting frames in addition to "natural" time...). */
t->num.unit_type[0] = B_UNIT_NONE;
t->num.unit_type[1] = B_UNIT_NONE;
}
@@ -8641,8 +8752,8 @@ static short getAnimEdit_SnapMode(TransInfo *t)
if (saction)
autosnap = saction->autosnap;
}
- else if (t->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ else if (t->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
if (sipo)
autosnap = sipo->autosnap;
@@ -9181,6 +9292,9 @@ static void applyTimeScaleValue(TransInfo *t)
fac = floorf(fac + 0.5f);
}
+ /* take proportional editing into account */
+ fac = ((fac - 1.0f) * td->factor) + 1;
+
/* check if any need to apply nla-mapping */
if (adt)
startx = BKE_nla_tweakedit_remap(adt, startx, NLATIME_CONVERT_UNMAP);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index fc52f5e723c..835346d9eee 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform.h
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
@@ -45,30 +37,30 @@
/* ************************** Types ***************************** */
+struct ARegion;
struct Depsgraph;
-struct TransInfo;
-struct TransDataContainer;
-struct TransData;
-struct TransformOrientation;
-struct TransSnap;
+struct EditBone;
struct NumInput;
struct Object;
-struct View3D;
-struct ScrArea;
+struct RNG;
+struct RenderEngineType;
+struct ReportList;
struct Scene;
+struct ScrArea;
+struct SnapObjectContext;
+struct TransData;
+struct TransDataContainer;
+struct TransInfo;
+struct TransSnap;
+struct TransformOrientation;
+struct View3D;
struct ViewLayer;
struct bConstraint;
-struct wmKeyMap;
-struct wmKeyConfig;
struct bContext;
struct wmEvent;
+struct wmKeyConfig;
+struct wmKeyMap;
struct wmTimer;
-struct ARegion;
-struct ReportList;
-struct RNG;
-struct EditBone;
-struct RenderEngineType;
-struct SnapObjectContext;
#include "DNA_object_enums.h"
@@ -95,8 +87,10 @@ typedef struct TransSnap {
bool peel;
bool snap_spatial_grid;
short status;
- float snapPoint[3]; /* snapping from this point (in global-space)*/
- float snapTarget[3]; /* to this point (in global-space)*/
+ /** snapping from this point (in global-space). */
+ float snapPoint[3];
+ /** to this point (in global-space). */
+ float snapTarget[3];
float snapNormal[3];
char snapNodeBorder;
ListBase points;
@@ -120,77 +114,116 @@ typedef struct TransSnap {
} TransSnap;
typedef struct TransCon {
- short orientation; /**/
- char text[50]; /* Description of the Constraint for header_print */
- float mtx[3][3]; /* Matrix of the Constraint space */
- float imtx[3][3]; /* Inverse Matrix of the Constraint space */
- float pmtx[3][3]; /* Projection Constraint Matrix (same as imtx with some axis == 0) */
- int imval[2]; /* initial mouse value for visual calculation */
- /* the one in TransInfo is not guarantee to stay the same (Rotates change it) */
- int mode; /* Mode flags of the Constraint */
+ short orientation;
+ /** Description of the constraint for header_print. */
+ char text[50];
+ /** Matrix of the constraint space. */
+ float mtx[3][3];
+ /** Inverse matrix of the constraint space. */
+ float imtx[3][3];
+ /** Projection constraint matrix (same as #imtx with some axis == 0). */
+ float pmtx[3][3];
+ /** Initial mouse value for visual calculation
+ * the one in #TransInfo is not guarantee to stay the same (Rotates change it). */
+ int imval[2];
+ /** Mode flags of the constraint. */
+ int mode;
void (*drawExtra)(struct TransInfo *t);
- /* Note: if 'tc' is NULL, 'td' must also be NULL. */
- /* For constraints that needs to draw differently from the other
- * uses this instead of the generic draw function */
+ /* Note: if 'tc' is NULL, 'td' must also be NULL.
+ * For constraints that needs to draw differently from the other
+ * uses this instead of the generic draw function. */
+
+ /** Apply function pointer for linear vectorial transformation
+ * The last three parameters are pointers to the in/out/printable vectors. */
void (*applyVec)(struct TransInfo *t, struct TransDataContainer *tc, struct TransData *td, const float in[3], float out[3], float pvec[3]);
- /* Apply function pointer for linear vectorial transformation */
- /* The last three parameters are pointers to the in/out/printable vectors */
+ /** Apply function pointer for size transformation. */
void (*applySize)(struct TransInfo *t, struct TransDataContainer *tc, struct TransData *td, float smat[3][3]);
- /* Apply function pointer for size transformation */
+ /** Apply function pointer for rotation transformation */
void (*applyRot)(struct TransInfo *t, struct TransDataContainer *tc, struct TransData *td, float vec[3], float *angle);
- /* Apply function pointer for rotation transformation */
} TransCon;
typedef struct TransDataExtension {
- float drot[3]; /* Initial object drot */
- // float drotAngle; /* Initial object drotAngle, TODO: not yet implemented */
- // float drotAxis[3]; /* Initial object drotAxis, TODO: not yet implemented */
- float dquat[4]; /* Initial object dquat */
- float dscale[3]; /* Initial object dscale */
- float *rot; /* Rotation of the data to transform */
- float irot[3]; /* Initial rotation */
- float *quat; /* Rotation quaternion of the data to transform */
- float iquat[4]; /* Initial rotation quaternion */
- float *rotAngle; /* Rotation angle of the data to transform */
- float irotAngle; /* Initial rotation angle */
- float *rotAxis; /* Rotation axis of the data to transform */
- float irotAxis[4]; /* Initial rotation axis */
- float *size; /* Size of the data to transform */
- float isize[3]; /* Initial size */
- float obmat[4][4]; /* Object matrix */
- float l_smtx[3][3]; /* use instead of td->smtx, It is the same but without the 'bone->bone_mat', see TD_PBONE_LOCAL_MTX_C */
- float r_mtx[3][3]; /* The rotscale matrix of pose bone, to allow using snap-align in translation mode,
- * when td->mtx is the loc pose bone matrix (and hence can't be used to apply rotation in some cases,
- * namely when a bone is in "NoLocal" or "Hinge" mode)... */
- float r_smtx[3][3]; /* Inverse of previous one. */
- int rotOrder; /* rotation mode, as defined in eRotationModes (DNA_action_types.h) */
- float oloc[3], orot[3], oquat[4], orotAxis[3], orotAngle; /* Original object transformation used for rigid bodies */
+ /** Initial object drot. */
+ float drot[3];
+ // /* Initial object drotAngle, TODO: not yet implemented */
+ // float drotAngle;
+ // /* Initial object drotAxis, TODO: not yet implemented */
+ // float drotAxis[3];
+ /** Initial object delta quat. */
+ float dquat[4];
+ /** Initial object delta scale. */
+ float dscale[3];
+ /** Rotation of the data to transform. */
+ float *rot;
+ /** Initial rotation. */
+ float irot[3];
+ /** Rotation quaternion of the data to transform. */
+ float *quat;
+ /** Initial rotation quaternion. */
+ float iquat[4];
+ /** Rotation angle of the data to transform. */
+ float *rotAngle;
+ /** Initial rotation angle. */
+ float irotAngle;
+ /** Rotation axis of the data to transform. */
+ float *rotAxis;
+ /** Initial rotation axis. */
+ float irotAxis[4];
+ /** Size of the data to transform. */
+ float *size;
+ /** Initial size. */
+ float isize[3];
+ /** Object matrix. */
+ float obmat[4][4];
+ /** Use instead of #TransData.smtx,
+ * It is the same but without the #Bone.bone_mat, see #TD_PBONE_LOCAL_MTX_C. */
+ float l_smtx[3][3];
+ /** The rotscale matrix of pose bone, to allow using snap-align in translation mode,
+ * when td->mtx is the loc pose bone matrix (and hence can't be used to apply
+ * rotation in some cases, namely when a bone is in "NoLocal" or "Hinge" mode)... */
+ float r_mtx[3][3];
+ /** Inverse of previous one. */
+ float r_smtx[3][3];
+ /** Rotation mode, as defined in #eRotationModes (DNA_action_types.h). */
+ int rotOrder;
+ /** Original object transformation used for rigid bodies. */
+ float oloc[3], orot[3], oquat[4], orotAxis[3], orotAngle;
} TransDataExtension;
typedef struct TransData2D {
- float loc[3]; /* Location of data used to transform (x,y,0) */
- float *loc2d; /* Pointer to real 2d location of data */
+ /** Location of data used to transform (x,y,0). */
+ float loc[3];
+ /** Pointer to real 2d location of data. */
+ float *loc2d;
- float *h1, *h2; /* Pointer to handle locations, if handles aren't being moved independently */
+ /** Pointer to handle locations, if handles aren't being moved independently. */
+ float *h1, *h2;
float ih1[2], ih2[2];
} TransData2D;
-/* we need to store 2 handles for each transdata in case the other handle wasn't selected */
+/** Used to store 2 handles for each #TransData in case the other handle wasn't selected. */
typedef struct TransDataCurveHandleFlags {
char ih1, ih2;
char *h1, *h2;
} TransDataCurveHandleFlags;
-/* for sequencer transform */
+/** Used for sequencer transform. */
typedef struct TransDataSeq {
struct Sequence *seq;
- int flag; /* a copy of seq->flag that may be modified for nested strips */
- int start_offset; /* use this so we can have transform data at the strips start, but apply correctly to the start frame */
- short sel_flag; /* one of SELECT, SEQ_LEFTSEL and SEQ_RIGHTSEL */
+ /** A copy of #Sequence.flag that may be modified for nested strips. */
+ int flag;
+ /** Use this so we can have transform data at the strips start,
+ * but apply correctly to the start frame. */
+ int start_offset;
+ /** one of #SELECT, #SEQ_LEFTSEL and #SEQ_RIGHTSEL. */
+ short sel_flag;
} TransDataSeq;
+/**
+ * Sequencer transform customdata (stored in #TransCustomDataContainer).
+ */
typedef struct TransSeq {
TransDataSeq *tdseq;
int min;
@@ -198,25 +231,33 @@ typedef struct TransSeq {
bool snap_left;
} TransSeq;
-/* for NLA transform (stored in td->extra pointer) */
+/** Used for NLA transform (stored in #TransData.extra pointer). */
typedef struct TransDataNla {
- ID *id; /* ID-block NLA-data is attached to */
+ /** ID-block NLA-data is attached to. */
+ ID *id;
- struct NlaTrack *oldTrack; /* Original NLA-Track that the strip belongs to */
- struct NlaTrack *nlt; /* Current NLA-Track that the strip belongs to */
+ /** Original NLA-Track that the strip belongs to. */
+ struct NlaTrack *oldTrack;
+ /** Current NLA-Track that the strip belongs to. */
+ struct NlaTrack *nlt;
- struct NlaStrip *strip; /* NLA-strip this data represents */
+ /** NLA-strip this data represents. */
+ struct NlaStrip *strip;
/* dummy values for transform to write in - must have 3 elements... */
- float h1[3]; /* start handle */
- float h2[3]; /* end handle */
-
- int trackIndex; /* index of track that strip is currently in */
- int handle; /* handle-index: 0 for dummy entry, -1 for start, 1 for end, 2 for both ends */
+ /** start handle. */
+ float h1[3];
+ /** end handle. */
+ float h2[3];
+
+ /** index of track that strip is currently in. */
+ int trackIndex;
+ /** handle-index: 0 for dummy entry, -1 for start, 1 for end, 2 for both ends. */
+ int handle;
} TransDataNla;
-struct LinkNode;
struct GHash;
+struct LinkNode;
/* header of TransDataEdgeSlideVert, TransDataEdgeSlideEdge */
typedef struct TransDataGenericSlideVert {
@@ -226,7 +267,7 @@ typedef struct TransDataGenericSlideVert {
} TransDataGenericSlideVert;
typedef struct TransDataEdgeSlideVert {
- /* TransDataGenericSlideVert */
+ /** #TransDataGenericSlideVert (header) */
struct BMVert *v;
struct LinkNode **cd_loop_groups;
float v_co_orig[3];
@@ -245,22 +286,23 @@ typedef struct TransDataEdgeSlideVert {
/* store original data so we can correct UV's and similar when sliding */
typedef struct SlideOrigData {
- /* flag that is set when origfaces is initialized */
+ /** Set when #origfaces is initialized. */
bool use_origfaces;
int cd_loop_mdisp_offset;
- struct GHash *origverts; /* map {BMVert: TransDataGenericSlideVert} */
+ /** map {BMVert: TransDataGenericSlideVert} */
+ struct GHash *origverts;
struct GHash *origfaces;
struct BMesh *bm_origfaces;
struct MemArena *arena;
- /* number of math BMLoop layers */
+ /** Number of math BMLoop layers. */
int layer_math_map_num;
- /* array size of 'layer_math_map_num'
+ /** Array size of 'layer_math_map_num'
* maps TransDataVertSlideVert.cd_group index to absolute CustomData layer index */
int *layer_math_map;
- /* array of slide vert data especially for mirror verts */
+ /** Array of slide vert data especially for mirror verts. */
TransDataGenericSlideVert *sv_mirror;
int totsv_mirror;
} SlideOrigData;
@@ -289,7 +331,7 @@ typedef struct EdgeSlideParams {
} EdgeSlideParams;
typedef struct TransDataVertSlideVert {
- /* TransDataGenericSlideVert */
+ /** #TransDataGenericSlideVert (header) */
struct BMVert *v;
struct LinkNode **cd_loop_groups;
float co_orig_3d[3];
@@ -333,36 +375,58 @@ typedef struct BoneInitData {
} BoneInitData;
typedef struct TransData {
- float dist; /* Distance needed to affect element (for Proportionnal Editing) */
- float rdist; /* Distance to the nearest element (for Proportionnal Editing) */
- float factor; /* Factor of the transformation (for Proportionnal Editing) */
- float *loc; /* Location of the data to transform */
- float iloc[3]; /* Initial location */
- float *val; /* Value pointer for special transforms */
- float ival; /* Old value*/
- float center[3]; /* Individual data center */
- float mtx[3][3]; /* Transformation matrix from data space to global space */
- float smtx[3][3]; /* Transformation matrix from global space to data space */
- float axismtx[3][3];/* Axis orientation matrix of the data */
+ /** Distance needed to affect element (for Proportionnal Editing). */
+ float dist;
+ /** Distance to the nearest element (for Proportionnal Editing). */
+ float rdist;
+ /** Factor of the transformation (for Proportionnal Editing). */
+ float factor;
+ /** Location of the data to transform. */
+ float *loc;
+ /** Initial location. */
+ float iloc[3];
+ /** Value pointer for special transforms. */
+ float *val;
+ /** Old value. */
+ float ival;
+ /** Individual data center. */
+ float center[3];
+ /** Transformation matrix from data space to global space. */
+ float mtx[3][3];
+ /** Transformation matrix from global space to data space. */
+ float smtx[3][3];
+ /** Axis orientation matrix of the data. */
+ float axismtx[3][3];
struct Object *ob;
- struct bConstraint *con; /* for objects/bones, the first constraint in its constraint stack */
- TransDataExtension *ext; /* for objects, poses. 1 single malloc per TransInfo! */
- TransDataCurveHandleFlags *hdata; /* for curves, stores handle flags for modification/cancel */
- void *extra; /* extra data (mirrored element pointer, in editmode mesh to BMVert) (editbone for roll fixing) (...) */
- int flag; /* Various flags */
- short protectflag; /* If set, copy of Object or PoseChannel protection */
+ /** For objects/bones, the first constraint in its constraint stack. */
+ struct bConstraint *con;
+ /** For objects, poses. 1 single malloc per TransInfo! */
+ TransDataExtension *ext;
+ /** for curves, stores handle flags for modification/cancel. */
+ TransDataCurveHandleFlags *hdata;
+ /**
+ * Extra data (mirrored element pointer, in editmode mesh to BMVert)
+ * (editbone for roll fixing) (...).
+ */
+ void *extra;
+ /** Various flags. */
+ int flag;
+ /** If set, copy of Object or PoseChannel protection. */
+ short protectflag;
} TransData;
typedef struct MouseInput {
void (*apply)(struct TransInfo *t, struct MouseInput *mi, const double mval[2], float output[3]);
void (*post)(struct TransInfo *t, float values[3]);
- int imval[2]; /* initial mouse position */
+ /** Initial mouse position. */
+ int imval[2];
bool precision;
float precision_factor;
float center[2];
float factor;
- void *data; /* additional data, if needed by the particular function */
+ /** Additional data, if needed by the particular function. */
+ void *data;
/**
* Use virtual cursor, which takes precision into account
@@ -445,6 +509,16 @@ typedef struct TransDataContainer {
/** Center of transformation (in local-space), Calculated from #TransInfo.center_global. */
float center_local[3];
+ /**
+ * Mirror option
+ */
+ struct {
+ /* Currently for mesh X mirror only. */
+ int axis_flag;
+ /** Set to -1.0f or 1.0 when use_mirror is set. */
+ float sign;
+ } mirror;
+
TransCustomDataContainer custom;
} TransDataContainer;
@@ -455,80 +529,131 @@ typedef struct TransInfo {
* Use to check if nothing is selected or if we have a single selection. */
int data_len_all;
- int mode; /* current mode */
- int flag; /* generic flags for special behaviors */
- int modifiers; /* special modifiers, by function, not key */
- short state; /* current state (running, canceled,...)*/
- int options; /* current context/options for transform */
- float val; /* init value for some transformations (and rotation angle) */
+ /** Current mode. */
+ int mode;
+ /** Generic flags for special behaviors. */
+ int flag;
+ /** Special modifiers, by function, not key. */
+ int modifiers;
+ /** Current state (running, canceled. */
+ short state;
+ /** Current context/options for transform. */
+ int options;
+ /** Init value for some transformations (and rotation angle). */
+ float val;
void (*transform)(struct TransInfo *, const int[2]);
- /* transform function pointer */
+ /** Transform function pointer. */
eRedrawFlag (*handleEvent)(struct TransInfo *, const struct wmEvent *);
/* event handler function pointer RETURN 1 if redraw is needed */
- TransCon con; /* transformed constraint */
+ /** transformed constraint. */
+ TransCon con;
TransSnap tsnap;
- NumInput num; /* numerical input */
- MouseInput mouse; /* mouse input */
- eRedrawFlag redraw; /* redraw flag */
- float prop_size; /* proportional circle radius */
- char proptext[20]; /* proportional falloff text */
- float aspect[3]; /* spaces using non 1:1 aspect, (uv's, f-curve, movie-clip... etc)
- * use for conversion and snapping. */
- float center_global[3]; /* center of transformation (in global-space) */
- float center2d[2]; /* center in screen coordinates */
+ /** numerical input. */
+ NumInput num;
+ /** mouse input. */
+ MouseInput mouse;
+ /** redraw flag. */
+ eRedrawFlag redraw;
+ /** proportional circle radius. */
+ float prop_size;
+ /** proportional falloff text. */
+ char proptext[20];
+ /**
+ * Spaces using non 1:1 aspect, (uv's, f-curve, movie-clip... etc)
+ * use for conversion and snapping.
+ */
+ float aspect[3];
+ /** center of transformation (in global-space) */
+ float center_global[3];
+ /** center in screen coordinates. */
+ float center2d[2];
/* Lazy initialize center data for when we need other center values.
* V3D_AROUND_ACTIVE + 1 (static assert checks this) */
TransCenterData center_cache[5];
- short idx_max; /* maximum index on the input vector */
- float snap[3]; /* Snapping Gears */
- float snap_spatial[3]; /* Spatial snapping gears(even when rotating, scaling... etc) */
- char frame_side; /* Mouse side of the cfra, 'L', 'R' or 'B' */
-
- float viewmat[4][4]; /* copy from G.vd, prevents feedback, */
- float viewinv[4][4]; /* and to make sure we don't have to */
- float persmat[4][4]; /* access G.vd from other space types */
+ /** maximum index on the input vector. */
+ short idx_max;
+ /** Snapping Gears. */
+ float snap[3];
+ /** Spatial snapping gears(even when rotating, scaling... etc). */
+ float snap_spatial[3];
+ /** Mouse side of the cfra, 'L', 'R' or 'B' */
+ char frame_side;
+
+ /** copy from G.vd, prevents feedback. */
+ float viewmat[4][4];
+ /** and to make sure we don't have to. */
+ float viewinv[4][4];
+ /** access G.vd from other space types. */
+ float persmat[4][4];
float persinv[4][4];
short persp;
short around;
- char spacetype; /* spacetype where transforming is */
- char helpline; /* Choice of custom cursor with or without a help line from the gizmo to the mouse position. */
- short obedit_type; /* Avoid looking inside TransDataContainer obedit. */
-
- float vec[3]; /* translation, to show for widget */
- float mat[3][3]; /* rot/rescale, to show for widget */
-
- float spacemtx[3][3]; /* orientation matrix of the current space */
- char spacename[64]; /* name of the current space, MAX_NAME */
+ /** spacetype where transforming is. */
+ char spacetype;
+ /** Choice of custom cursor with or without a help line from the gizmo to the mouse position. */
+ char helpline;
+ /** Avoid looking inside TransDataContainer obedit. */
+ short obedit_type;
+
+ /** translation, to show for widget. */
+ float vec[3];
+ /** rot/rescale, to show for widget. */
+ float mat[3][3];
+
+ /** orientation matrix of the current space. */
+ float spacemtx[3][3];
+ /** name of the current space, MAX_NAME. */
+ char spacename[64];
/*************** NEW STUFF *********************/
- short launch_event; /* event type used to launch transform */
+ /** event type used to launch transform. */
+ short launch_event;
struct {
+ /** Orientation type when when we're not constrained.
+ * nearly always global except for rotate which defaults to screen-space orientation. */
+ short unset;
+ /** Orientation to use when a key is pressed. */
short user;
/* Used when user is global. */
short user_alt;
short index;
short *types[2];
- /* this gets used when custom_orientation is V3D_MANIP_CUSTOM */
+ /* this gets used when custom_orientation is V3D_ORIENT_CUSTOM */
TransformOrientation *custom;
} orientation;
- short gizmo_flag; /* backup from view3d, to restore on end */
+ /** backup from view3d, to restore on end. */
+ short gizmo_flag;
short prop_mode;
- short mirror;
-
float values[4];
- float values_modal_offset[4]; /* Offset applied ontop of modal input. */
+ /** Offset applied ontop of modal input. */
+ float values_modal_offset[4];
float auto_values[4];
- float axis[3];
- float axis_orig[3]; /* TransCon can change 'axis', store the original value here */
- float axis_ortho[3];
- bool remove_on_cancel; /* remove elements if operator is canceled */
+ /* Axis members for modes that use an axis separate from the orientation (rotate & shear). */
+
+ /** Primary axis, rotate only uses this. */
+ int orient_axis;
+ /** Secondary axis, shear uses this. */
+ int orient_axis_ortho;
+
+ /** Often this matrix has similar usage to #TransInfo.spacemtx however this
+ * is used to define extra axes to operate on, not necessarily a space.
+ *
+ * For example, by default rotation operates on the view (`orient_matrix[2]`),
+ * even when the current space isn't set to the view. */
+ float orient_matrix[3][3];
+ /** Don't overwrite when set by operator redo defines the orientation axis. */
+ bool orient_matrix_is_set;
+
+ /** remove elements if operator is canceled. */
+ bool remove_on_cancel;
void *view;
- struct bContext *context; /* Only valid (non null) during an operator called function. */
+ /** Only valid (non null) during an operator called function. */
+ struct bContext *context;
struct ScrArea *sa;
struct ARegion *ar;
struct Depsgraph *depsgraph;
@@ -536,10 +661,14 @@ typedef struct TransInfo {
struct ViewLayer *view_layer;
struct ToolSettings *settings;
struct wmTimer *animtimer;
- struct wmKeyMap *keymap; /* so we can do lookups for header text */
- struct ReportList *reports; /* assign from the operator, or can be NULL */
- int mval[2]; /* current mouse position */
- float zfac; /* use for 3d view */
+ /** so we can do lookups for header text. */
+ struct wmKeyMap *keymap;
+ /** assign from the operator, or can be NULL. */
+ struct ReportList *reports;
+ /** current mouse position. */
+ int mval[2];
+ /** use for 3d view. */
+ float zfac;
void *draw_handle_apply;
void *draw_handle_view;
void *draw_handle_pixel;
@@ -556,75 +685,82 @@ typedef struct TransInfo {
/* ******************** Macros & Prototypes *********************** */
/* transinfo->state */
-#define TRANS_STARTING 0
-#define TRANS_RUNNING 1
-#define TRANS_CONFIRM 2
-#define TRANS_CANCEL 3
+enum {
+ TRANS_STARTING = 0,
+ TRANS_RUNNING = 1,
+ TRANS_CONFIRM = 2,
+ TRANS_CANCEL = 3,
+};
/* transinfo->flag */
-#define T_OBJECT (1 << 0)
-/** \note We could remove 'T_EDIT' and use 'obedit_type', for now ensure they're in sync. */
-#define T_EDIT (1 << 1)
-#define T_POSE (1 << 2)
-#define T_TEXTURE (1 << 3)
- /* transforming the camera while in camera view */
-#define T_CAMERA (1 << 4)
- /* transforming the 3D cursor. */
-#define T_CURSOR (1 << 5)
- // trans on points, having no rotation/scale
-#define T_POINTS (1 << 6)
-/**
- * Apply matrix #TransDataContainer.matrix, this avoids having to have duplicate check all over
- * that happen to apply to spesiifc modes (edit & pose for eg). */
-#define T_LOCAL_MATRIX (1 << 7)
+enum {
+ T_OBJECT = 1 << 0,
+ /** \note We could remove 'T_EDIT' and use 'obedit_type', for now ensure they're in sync. */
+ T_EDIT = 1 << 1,
+ T_POSE = 1 << 2,
+ T_TEXTURE = 1 << 3,
+ /** Transforming the camera while in camera view. */
+ T_CAMERA = 1 << 4,
+ /** Transforming the 3D cursor. */
+ T_CURSOR = 1 << 5,
+ /** Transform points, having no rotation/scale. */
+ T_POINTS = 1 << 6,
+ /**
+ * Apply matrix #TransDataContainer.matrix, this avoids having to have duplicate check all over
+ * that happen to apply to specific modes (edit & pose for eg). */
+ T_LOCAL_MATRIX = 1 << 7,
- /* restrictions flags */
-#define T_ALL_RESTRICTIONS ((1 << 8)|(1 << 9)|(1 << 10))
-#define T_NO_CONSTRAINT (1 << 8)
-#define T_NULL_ONE (1 << 9)
-#define T_NO_ZERO (1 << 10)
+ /** restrictions flags */
+ T_NO_CONSTRAINT = 1 << 8,
+ T_NULL_ONE = 1 << 9,
+ T_NO_ZERO = 1 << 10,
+ T_ALL_RESTRICTIONS = T_NO_CONSTRAINT | T_NULL_ONE | T_NO_ZERO,
-#define T_PROP_EDIT (1 << 11)
-#define T_PROP_CONNECTED (1 << 12)
-#define T_PROP_PROJECTED (1 << 13)
-#define T_PROP_EDIT_ALL (T_PROP_EDIT | T_PROP_CONNECTED | T_PROP_PROJECTED)
+ T_PROP_EDIT = 1 << 11,
+ T_PROP_CONNECTED = 1 << 12,
+ T_PROP_PROJECTED = 1 << 13,
+ T_PROP_EDIT_ALL = T_PROP_EDIT | T_PROP_CONNECTED | T_PROP_PROJECTED,
-#define T_V3D_ALIGN (1 << 14)
- /* for 2d views like uv or ipo */
-#define T_2D_EDIT (1 << 15)
-#define T_CLIP_UV (1 << 16)
+ T_V3D_ALIGN = 1 << 14,
+ /** For 2d views like uv or fcurve. */
+ T_2D_EDIT = 1 << 15,
+ T_CLIP_UV = 1 << 16,
- /* auto-ik is on */
-#define T_AUTOIK (1 << 18)
+ /** Auto-ik is on. */
+ T_AUTOIK = 1 << 18,
-#define T_MIRROR (1 << 19)
+ /** Don't use mirror even if the data-block option is set. */
+ T_NO_MIRROR = 1 << 19,
-#define T_AUTOVALUES (1 << 20)
+ T_AUTOVALUES = 1 << 20,
- /* to specify if we save back settings at the end */
-#define T_MODAL (1 << 21)
+ /** To specify if we save back settings at the end. */
+ T_MODAL = 1 << 21,
- /* no retopo */
-#define T_NO_PROJECT (1 << 22)
+ /** No retopo. */
+ T_NO_PROJECT = 1 << 22,
-#define T_RELEASE_CONFIRM (1 << 23)
+ T_RELEASE_CONFIRM = 1 << 23,
- /* alternative transformation. used to add offset to tracking markers */
-#define T_ALT_TRANSFORM (1 << 24)
+ /** Alternative transformation. used to add offset to tracking markers. */
+ T_ALT_TRANSFORM = 1 << 24,
- /** #TransInfo.center has been set, don't change it. */
-#define T_OVERRIDE_CENTER (1 << 25)
+ /** #TransInfo.center has been set, don't change it. */
+ T_OVERRIDE_CENTER = 1 << 25,
-#define T_MODAL_CURSOR_SET (1 << 26)
+ T_MODAL_CURSOR_SET = 1 << 26,
-#define T_CLNOR_REBUILD (1 << 27)
+ T_CLNOR_REBUILD = 1 << 27,
+};
-/* TransInfo->modifiers */
-#define MOD_CONSTRAINT_SELECT 0x01
-#define MOD_PRECISION 0x02
-#define MOD_SNAP 0x04
-#define MOD_SNAP_INVERT 0x08
-#define MOD_CONSTRAINT_PLANE 0x10
+/** #TransInfo.modifiers */
+enum {
+ MOD_CONSTRAINT_SELECT = 1 << 0,
+ MOD_PRECISION = 1 << 1,
+ MOD_SNAP = 1 << 2,
+ MOD_SNAP_INVERT = 1 << 3,
+ MOD_CONSTRAINT_PLANE = 1 << 4,
+};
/* use node center for transform instead of upper-left corner.
* disabled since it makes absolute snapping not work so nicely
@@ -634,49 +770,74 @@ typedef struct TransInfo {
/* ******************************************************************************** */
-/* transinfo->helpline */
-#define HLP_NONE 0
-#define HLP_SPRING 1
-#define HLP_ANGLE 2
-#define HLP_HARROW 3
-#define HLP_VARROW 4
-#define HLP_CARROW 5
-#define HLP_TRACKBALL 6
-
-/* transinfo->con->mode */
-#define CON_APPLY 1
-#define CON_AXIS0 2
-#define CON_AXIS1 4
-#define CON_AXIS2 8
-#define CON_SELECT 16
-#define CON_NOFLIP 32 /* does not reorient vector to face viewport when on */
-#define CON_USER 64
-
-/* transdata->flag */
-#define TD_SELECTED 1
-#define TD_NOACTION (1 << 2)
-#define TD_USEQUAT (1 << 3)
-#define TD_NOTCONNECTED (1 << 4)
-#define TD_SINGLESIZE (1 << 5) /* used for scaling of MetaElem->rad */
-#define TD_INDIVIDUAL_SCALE (1 << 8) /* Scale relative to individual element center */
-#define TD_NOCENTER (1 << 9)
-#define TD_NO_EXT (1 << 10) /* ext abused for particle key timing */
-#define TD_SKIP (1 << 11) /* don't transform this data */
-#define TD_BEZTRIPLE (1 << 12) /* if this is a bez triple, we need to restore the handles, if this is set transdata->misc.hdata needs freeing */
-#define TD_NO_LOC (1 << 13) /* when this is set, don't apply translation changes to this element */
-#define TD_NOTIMESNAP (1 << 14) /* for Graph Editor autosnap, indicates that point should not undergo autosnapping */
-#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */
-#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */
-#define TD_MOVEHANDLE1 (1 << 17) /* For fcurve handles, move them along with their keyframes */
-#define TD_MOVEHANDLE2 (1 << 18)
-#define TD_PBONE_LOCAL_MTX_P (1 << 19) /* exceptional case with pose bone rotating when a parent bone has 'Local Location' option enabled and rotating also transforms it. */
-#define TD_PBONE_LOCAL_MTX_C (1 << 20) /* same as above but for a child bone */
-
-/* transsnap->status */
-#define SNAP_FORCED 1
-#define TARGET_INIT 2
-#define POINT_INIT 4
-#define MULTI_POINTS 8
+/** #TransInfo.helpline */
+enum {
+ HLP_NONE = 0,
+ HLP_SPRING = 1,
+ HLP_ANGLE = 2,
+ HLP_HARROW = 3,
+ HLP_VARROW = 4,
+ HLP_CARROW = 5,
+ HLP_TRACKBALL = 6,
+};
+
+/** #TransCon.mode, #TransInfo.con.mode */
+enum {
+ /** When set constraints are in use. */
+ CON_APPLY = 1 << 0,
+ /** These are only used for modal execution. */
+ CON_AXIS0 = 1 << 1,
+ CON_AXIS1 = 1 << 2,
+ CON_AXIS2 = 1 << 3,
+ CON_SELECT = 1 << 4,
+ /** Does not reorient vector to face viewport when on. */
+ CON_NOFLIP = 1 << 5,
+ CON_USER = 1 << 6,
+};
+
+/** #TransData.flag */
+enum {
+ TD_SELECTED = 1 << 0,
+ TD_NOACTION = 1 << 2,
+ TD_USEQUAT = 1 << 3,
+ TD_NOTCONNECTED = 1 << 4,
+ /** Used for scaling of #MetaElem.rad */
+ TD_SINGLESIZE = 1 << 5,
+ /** Scale relative to individual element center */
+ TD_INDIVIDUAL_SCALE = 1 << 8,
+ TD_NOCENTER = 1 << 9,
+ /** #TransData.ext abused for particle key timing. */
+ TD_NO_EXT = 1 << 10,
+ /** don't transform this data */
+ TD_SKIP = 1 << 11,
+ /** if this is a bez triple, we need to restore the handles,
+ * if this is set #TransData.hdata needs freeing */
+ TD_BEZTRIPLE = 1 << 12,
+ /** when this is set, don't apply translation changes to this element */
+ TD_NO_LOC = 1 << 13,
+ /** for Graph Editor autosnap, indicates that point should not undergo autosnapping */
+ TD_NOTIMESNAP = 1 << 14,
+ /** for Graph Editor - curves that can only have int-values need their keyframes tagged with this */
+ TD_INTVALUES = 1 << 15,
+ /** For editmode mirror, clamp to x = 0 */
+ TD_MIRROR_EDGE = 1 << 16,
+ /** For fcurve handles, move them along with their keyframes */
+ TD_MOVEHANDLE1 = 1 << 17,
+ TD_MOVEHANDLE2 = 1 << 18,
+ /** Exceptional case with pose bone rotating when a parent bone has 'Local Location'
+ * option enabled and rotating also transforms it. */
+ TD_PBONE_LOCAL_MTX_P = 1 << 19,
+ /** Same as above but for a child bone. */
+ TD_PBONE_LOCAL_MTX_C = 1 << 20,
+};
+
+/** #TransSnap.status */
+enum {
+ SNAP_FORCED = 1 << 0,
+ TARGET_INIT = 1 << 1,
+ POINT_INIT = 1 << 2,
+ MULTI_POINTS = 1 << 3,
+};
/* Hard min/max for proportional size. */
#define T_PROP_SIZE_MIN 1e-6f
@@ -705,7 +866,6 @@ struct wmKeyMap *transform_modal_keymap(struct wmKeyConfig *keyconf);
/*********************** transform_conversions.c ********** */
-struct ListBase;
void flushTransIntFrameActionData(TransInfo *t);
void flushTransGraphData(TransInfo *t);
@@ -764,7 +924,8 @@ void constraintNumInput(TransInfo *t, float vec[3]);
bool isLockConstraint(TransInfo *t);
int getConstraintSpaceDimension(TransInfo *t);
-char constraintModeToChar(TransInfo *t);
+int constraintModeToIndex(const TransInfo *t);
+char constraintModeToChar(const TransInfo *t);
void startConstraint(TransInfo *t);
void stopConstraint(TransInfo *t);
@@ -780,7 +941,7 @@ void setNearestAxis(TransInfo *t);
typedef enum {
NO_GEARS = 0,
BIG_GEARS = 1,
- SMALL_GEARS = 2
+ SMALL_GEARS = 2,
} GearsType;
bool transformModeUseSnap(const TransInfo *t);
@@ -887,11 +1048,13 @@ struct TransformOrientation *addMatrixSpace(struct bContext *C, float mat[3][3],
const char *name, const bool overwrite);
bool applyTransformOrientation(const struct TransformOrientation *ts, float r_mat[3][3], char r_name[64]);
-#define ORIENTATION_NONE 0
-#define ORIENTATION_NORMAL 1
-#define ORIENTATION_VERT 2
-#define ORIENTATION_EDGE 3
-#define ORIENTATION_FACE 4
+enum {
+ ORIENTATION_NONE = 0,
+ ORIENTATION_NORMAL = 1,
+ ORIENTATION_VERT = 2,
+ ORIENTATION_EDGE = 3,
+ ORIENTATION_FACE = 4,
+};
#define ORIENTATION_USE_PLANE(ty) \
ELEM(ty, ORIENTATION_NORMAL, ORIENTATION_EDGE, ORIENTATION_FACE)
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index fe997b77a31..4bed5a3f05c 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_constraints.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <stdlib.h>
@@ -176,7 +168,7 @@ static void viewAxisCorrectCenter(const TransInfo *t, float t_con_center[3])
{
if (t->spacetype == SPACE_VIEW3D) {
// View3D *v3d = t->sa->spacedata.first;
- const float min_dist = 1.0f; /* v3d->near; */
+ const float min_dist = 1.0f; /* v3d->clip_start; */
float dir[3];
float l;
@@ -333,7 +325,6 @@ static void planeProjection(const TransInfo *t, const float in[3], float out[3])
* The IN vector in projected into the constrained space and then further
* projected along the view vector.
* (in perspective mode, the view vector is relative to the position on screen)
- *
*/
static void applyAxisConstraintVec(
@@ -668,7 +659,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
char text[256];
switch (orientation) {
- case V3D_MANIP_GLOBAL:
+ case V3D_ORIENT_GLOBAL:
{
float mtx[3][3];
BLI_snprintf(text, sizeof(text), ftext, IFACE_("global"));
@@ -676,11 +667,11 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
setConstraint(t, mtx, mode, text);
break;
}
- case V3D_MANIP_LOCAL:
+ case V3D_ORIENT_LOCAL:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("local"));
setLocalConstraint(t, mode, text);
break;
- case V3D_MANIP_NORMAL:
+ case V3D_ORIENT_NORMAL:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("normal"));
if (checkUseAxisMatrix(t)) {
setAxisMatrixConstraint(t, mode, text);
@@ -689,23 +680,23 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
setConstraint(t, t->spacemtx, mode, text);
}
break;
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("view"));
setConstraint(t, t->spacemtx, mode, text);
break;
- case V3D_MANIP_CURSOR:
+ case V3D_ORIENT_CURSOR:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("cursor"));
setConstraint(t, t->spacemtx, mode, text);
break;
- case V3D_MANIP_GIMBAL:
+ case V3D_ORIENT_GIMBAL:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal"));
setConstraint(t, t->spacemtx, mode, text);
break;
- case V3D_MANIP_CUSTOM_MATRIX:
+ case V3D_ORIENT_CUSTOM_MATRIX:
BLI_snprintf(text, sizeof(text), ftext, IFACE_("custom matrix"));
setConstraint(t, t->spacemtx, mode, text);
break;
- case V3D_MANIP_CUSTOM:
+ case V3D_ORIENT_CUSTOM:
{
char orientation_str[128];
BLI_snprintf(orientation_str, sizeof(orientation_str), "%s \"%s\"",
@@ -814,7 +805,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
else if (t->spacetype == SPACE_IMAGE) {
GPU_matrix_scale_2f(1.0f / t->aspect[0], 1.0f / t->aspect[1]);
}
- else if (ELEM(t->spacetype, SPACE_IPO, SPACE_ACTION)) {
+ else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION)) {
/* only scale y */
rcti *mask = &t->ar->v2d.mask;
rctf *datamask = &t->ar->v2d.cur;
@@ -1101,26 +1092,35 @@ void setNearestAxis(TransInfo *t)
/*-------------- HELPER FUNCTIONS ----------------*/
-char constraintModeToChar(TransInfo *t)
+int constraintModeToIndex(const TransInfo *t)
{
if ((t->con.mode & CON_APPLY) == 0) {
- return '\0';
+ return -1;
}
switch (t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2)) {
case (CON_AXIS0):
case (CON_AXIS1 | CON_AXIS2):
- return 'X';
+ return 0;
case (CON_AXIS1):
case (CON_AXIS0 | CON_AXIS2):
- return 'Y';
+ return 1;
case (CON_AXIS2):
case (CON_AXIS0 | CON_AXIS1):
- return 'Z';
+ return 2;
default:
- return '\0';
+ return -1;
}
}
+char constraintModeToChar(const TransInfo *t)
+{
+ int index = constraintModeToIndex(t);
+ if (index == -1) {
+ return '\0';
+ }
+ BLI_assert((uint)index < 3);
+ return 'X' + index;
+}
bool isLockConstraint(TransInfo *t)
{
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 47624293a0b..e79f510d308 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_conversions.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <string.h>
@@ -413,15 +405,39 @@ static void createTransCursor_view3d(TransInfo *t)
td->ob = NULL;
unit_m3(td->mtx);
- quat_to_mat3(td->axismtx, cursor->rotation);
+ BKE_scene_cursor_rot_to_mat3(cursor, td->axismtx);
normalize_m3(td->axismtx);
pseudoinverse_m3_m3(td->smtx, td->mtx, PSEUDOINVERSE_EPSILON);
td->loc = cursor->location;
copy_v3_v3(td->iloc, cursor->location);
- td->ext->quat = cursor->rotation;
- copy_qt_qt(td->ext->iquat, cursor->rotation);
+ if (cursor->rotation_mode > 0) {
+ td->ext->rot = cursor->rotation_euler;
+ td->ext->rotAxis = NULL;
+ td->ext->rotAngle = NULL;
+ td->ext->quat = NULL;
+
+ copy_v3_v3(td->ext->irot, cursor->rotation_euler);
+ }
+ else if (cursor->rotation_mode == ROT_MODE_AXISANGLE) {
+ td->ext->rot = NULL;
+ td->ext->rotAxis = cursor->rotation_axis;
+ td->ext->rotAngle = &cursor->rotation_angle;
+ td->ext->quat = NULL;
+
+ td->ext->irotAngle = cursor->rotation_angle;
+ copy_v3_v3(td->ext->irotAxis, cursor->rotation_axis);
+ }
+ else {
+ td->ext->rot = NULL;
+ td->ext->rotAxis = NULL;
+ td->ext->rotAngle = NULL;
+ td->ext->quat = cursor->rotation_quaternion;
+
+ copy_qt_qt(td->ext->iquat, cursor->rotation_quaternion);
+ }
+ td->ext->rotOrder = cursor->rotation_mode;
}
/** \} */
@@ -997,14 +1013,16 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
data = con->data;
if (data->tar == NULL || (data->tar->type == OB_ARMATURE && data->subtarget[0] == '\0')) {
- /* make reference to constraint to base things off later (if it's the last targetless constraint encountered) */
+ /* make reference to constraint to base things off later
+ * (if it's the last targetless constraint encountered) */
targetless = (bKinematicConstraint *)con->data;
/* but, if this is a targetless IK, we make it auto anyway (for the children loop) */
if (con->enforce != 0.0f) {
data->flag |= CONSTRAINT_IK_AUTO;
- /* if no chain length has been specified, just make things obey standard rotation locks too */
+ /* if no chain length has been specified,
+ * just make things obey standard rotation locks too */
if (data->rootbone == 0) {
for (; pchan; pchan = pchan->parent) {
/* here, we set ik-settings for bone from pchan->protectflag */
@@ -1025,7 +1043,10 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
}
con = BKE_constraint_add_for_pose(NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC);
- pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET); /* for draw, but also for detecting while pose solving */
+
+ /* for draw, but also for detecting while pose solving */
+ pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET);
+
data = con->data;
if (targetless) {
/* if exists, use values from last targetless (but disabled) IK-constraint as base */
@@ -1035,7 +1056,10 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
data->flag = CONSTRAINT_IK_TIP;
data->flag |= CONSTRAINT_IK_TEMP | CONSTRAINT_IK_AUTO | CONSTRAINT_IK_POS;
copy_v3_v3(data->grabtarget, pchan->pose_tail);
- data->rootbone = 0; /* watch-it! has to be 0 here, since we're still on the same bone for the first time through the loop [#25885] */
+
+ /* watch-it! has to be 0 here, since we're still on the
+ * same bone for the first time through the loop T25885. */
+ data->rootbone = 0;
/* we only include bones that are part of a continual connected chain */
do {
@@ -1096,7 +1120,8 @@ static short pose_grab_with_ik(Main *bmain, Object *ob)
arm = ob->data;
- /* Rule: allow multiple Bones (but they must be selected, and only one ik-solver per chain should get added) */
+ /* Rule: allow multiple Bones
+ * (but they must be selected, and only one ik-solver per chain should get added) */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone->layer & arm->layer) {
if (pchan->bone->flag & BONE_SELECTED) {
@@ -1162,22 +1187,28 @@ static void createTransPose(TransInfo *t)
continue;
}
+ /* set flags and count total */
+ tc->data_len = count_set_pose_transflags(ob, t->mode, t->around, has_translate_rotate);
+ if (tc->data_len == 0) {
+ continue;
+ }
+
if (arm->flag & ARM_RESTPOS) {
if (ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE) == 0) {
BKE_report(t->reports, RPT_ERROR, "Cannot change Pose when 'Rest Position' is enabled");
- return;
+ tc->data_len = 0;
+ continue;
}
}
/* do we need to add temporal IK chains? */
if ((arm->flag & ARM_AUTO_IK) && t->mode == TFM_TRANSLATION) {
ik_on = pose_grab_with_ik(bmain, ob);
- if (ik_on) t->flag |= T_AUTOIK;
+ if (ik_on) {
+ t->flag |= T_AUTOIK;
+ has_translate_rotate[0] = true;
+ }
}
-
- /* set flags and count total (warning, can change transform to rotate) */
- tc->data_len = count_set_pose_transflags(ob, t->mode, t->around, has_translate_rotate);
- /* len may be zero, skip next iteration. */
}
/* if there are no translatable bones, do rotation */
@@ -1850,13 +1881,14 @@ static void createTransCurveVerts(TransInfo *t)
else td->flag = 0;
td->ext = NULL;
- if (t->mode == TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ /* TODO - make points scale */
+ /* TODO - make points scale */
+ if (t->mode == TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/
td->val = &(bezt->radius);
td->ival = bezt->radius;
}
else if (t->mode == TFM_TILT) {
- td->val = &(bezt->alfa);
- td->ival = bezt->alfa;
+ td->val = &(bezt->tilt);
+ td->ival = bezt->tilt;
}
else {
td->val = NULL;
@@ -1870,7 +1902,8 @@ static void createTransCurveVerts(TransInfo *t)
if ((bezt_tx & SEL_F1) == 0 && (bezt_tx & SEL_F3) == 0)
/* If the middle is selected but the sides arnt, this is needed */
- if (hdata == NULL) { /* if the handle was not saved by the previous handle */
+ if (hdata == NULL) {
+ /* if the handle was not saved by the previous handle */
hdata = initTransDataCurveHandles(td, bezt);
}
@@ -1894,7 +1927,8 @@ static void createTransCurveVerts(TransInfo *t)
td->ext = NULL;
td->val = NULL;
- if (hdata == NULL) { /* if the handle was not saved by the previous handle */
+ if (hdata == NULL) {
+ /* if the handle was not saved by the previous handle */
hdata = initTransDataCurveHandles(td, bezt);
}
@@ -1921,7 +1955,8 @@ static void createTransCurveVerts(TransInfo *t)
/* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles
* but for now just don't change handle types */
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT, TFM_DUMMY) == 0) {
- /* sets the handles based on their selection, do this after the data is copied to the TransData */
+ /* sets the handles based on their selection,
+ * do this after the data is copied to the TransData */
BKE_nurb_handles_test(nu, !hide_handles);
}
}
@@ -1963,8 +1998,8 @@ static void createTransCurveVerts(TransInfo *t)
td->ival = bp->radius;
}
else {
- td->val = &(bp->alfa);
- td->ival = bp->alfa;
+ td->val = &(bp->tilt);
+ td->ival = bp->tilt;
}
copy_m3_m3(td->smtx, smtx);
@@ -2068,7 +2103,6 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
ParticleEditSettings *pset = PE_settings(t->scene);
PTCacheEdit *edit = PE_get_current(t->scene, ob);
ParticleSystem *psys = NULL;
- ParticleSystemModifierData *psmd = NULL;
PTCacheEditPoint *point;
PTCacheEditKey *key;
float mat[4][4];
@@ -2080,9 +2114,6 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
psys = edit->psys;
- if (psys)
- psmd = psys_get_modifier(ob, psys);
-
for (i = 0, point = edit->points; i < edit->totpoint; i++, point++) {
point->flag &= ~PEP_TRANSFORM;
transformparticle = 0;
@@ -2127,8 +2158,10 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
if (!(point->flag & PEP_TRANSFORM)) continue;
- if (psys && !(psys->flag & PSYS_GLOBAL_HAIR))
- psys_mat_hair_to_global(ob, psmd->mesh_final, psys->part->from, psys->particles + i, mat);
+ if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+ ParticleSystemModifierData *psmd_eval = edit->psmd_eval;
+ psys_mat_hair_to_global(ob, psmd_eval->mesh_final, psys->part->from, psys->particles + i, mat);
+ }
for (k = 0, key = point->keys; k < point->totkey; k++, key++) {
if (key->flag & PEK_USE_WCO) {
@@ -2187,7 +2220,6 @@ void flushTransParticles(TransInfo *t)
Object *ob = OBACT(view_layer);
PTCacheEdit *edit = PE_get_current(scene, ob);
ParticleSystem *psys = edit->psys;
- ParticleSystemModifierData *psmd = NULL;
PTCacheEditPoint *point;
PTCacheEditKey *key;
TransData *td;
@@ -2195,9 +2227,6 @@ void flushTransParticles(TransInfo *t)
int i, k;
const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
- 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 = tc->data;
@@ -2205,7 +2234,8 @@ void flushTransParticles(TransInfo *t)
if (!(point->flag & PEP_TRANSFORM)) continue;
if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
- psys_mat_hair_to_global(ob, psmd->mesh_final, psys->part->from, psys->particles + i, mat);
+ ParticleSystemModifierData *psmd_eval = edit->psmd_eval;
+ psys_mat_hair_to_global(ob, psmd_eval->mesh_final, psys->part->from, psys->particles + i, mat);
invert_m4_m4(imat, mat);
for (k = 0, key = point->keys; k < point->totkey; k++, key++) {
@@ -2225,6 +2255,7 @@ void flushTransParticles(TransInfo *t)
}
PE_update_object(t->depsgraph, scene, OBACT(view_layer), 1);
+ DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
}
}
@@ -2449,7 +2480,8 @@ static struct TransIslandData *editmesh_islands_info_calc(
vert_map = MEM_mallocN(sizeof(*vert_map) * bm->totvert, __func__);
/* we shouldn't need this, but with incorrect selection flushing
- * its possible we have a selected vertex that's not in a face, for now best not crash in that case. */
+ * its possible we have a selected vertex that's not in a face,
+ * for now best not crash in that case. */
copy_vn_i(vert_map, bm->totvert, -1);
BM_mesh_elem_table_ensure(bm, htype);
@@ -2661,10 +2693,12 @@ static void createTransEditVerts(TransInfo *t)
int island_info_tot;
int *island_vert_map = NULL;
- /* Snap rotation along normal needs a common axis for whole islands, otherwise one get random crazy results,
- * see T59104. However, we do not want to use the island center for the pivot/translation reference... */
+ /* Snap rotation along normal needs a common axis for whole islands,
+ * otherwise one get random crazy results, see T59104.
+ * However, we do not want to use the island center for the pivot/translation reference. */
const bool is_snap_rotate = ((t->mode == TFM_TRANSLATION) &&
- /* There is not guarantee that snapping is initialized yet at this point... */
+ /* There is not guarantee that snapping
+ * is initialized yet at this point... */
(usingSnappingNormal(t) || (t->settings->snap_flag & SCE_SNAP_ROTATE) != 0) &&
(t->around != V3D_AROUND_LOCAL_ORIGINS));
/* Even for translation this is needed because of island-orientation, see: T51651. */
@@ -2673,12 +2707,9 @@ static void createTransEditVerts(TransInfo *t)
* Optional, allocate if needed. */
int *dists_index = NULL;
- if (t->flag & T_MIRROR) {
- /* TODO(campbell): xform: We need support for many mirror objects at once! */
- if (tc->is_active) {
- EDBM_verts_mirror_cache_begin(em, 0, false, (t->flag & T_PROP_EDIT) == 0, use_topology);
- mirror = 1;
- }
+ if (tc->mirror.axis_flag) {
+ EDBM_verts_mirror_cache_begin(em, 0, false, (t->flag & T_PROP_EDIT) == 0, use_topology);
+ mirror = 1;
}
/**
@@ -2788,7 +2819,7 @@ static void createTransEditVerts(TransInfo *t)
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve->co[0] != 0.0f) {
if (eve->co[0] < 0.0f) {
- t->mirror = -1;
+ tc->mirror.sign = -1.0f;
mirror = -1;
}
break;
@@ -2892,7 +2923,7 @@ cleanup:
if (dists_index)
MEM_freeN(dists_index);
- if (t->flag & T_MIRROR) {
+ if (tc->mirror.axis_flag) {
EDBM_verts_mirror_cache_end(em);
}
}
@@ -2966,7 +2997,8 @@ BLI_INLINE void trans_update_seq(Scene *sce, Sequence *seq, int old_start, int s
void flushTransSeq(TransInfo *t)
{
- ListBase *seqbasep = BKE_sequencer_editing_get(t->scene, false)->seqbasep; /* Editing null check already done */
+ /* Editing null check already done */
+ ListBase *seqbasep = BKE_sequencer_editing_get(t->scene, false)->seqbasep;
int a, new_frame;
TransData *td = NULL;
@@ -2993,11 +3025,15 @@ void flushTransSeq(TransInfo *t)
switch (tdsq->sel_flag) {
case SELECT:
#ifdef SEQ_TX_NESTED_METAS
- if ((seq->depth != 0 || BKE_sequence_tx_test(seq))) /* for meta's, their children move */
+ if ((seq->depth != 0 || BKE_sequence_tx_test(seq))) {
+ /* for meta's, their children move */
seq->start = new_frame - tdsq->start_offset;
+ }
#else
- if (seq->type != SEQ_TYPE_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */
+ if (seq->type != SEQ_TYPE_META && (seq->depth != 0 || seq_tx_test(seq))) {
+ /* for meta's, their children move */
seq->start = new_frame - tdsq->start_offset;
+ }
#endif
if (seq->depth == 0) {
seq->machine = round_fl_to_int(td2d->loc[1]);
@@ -3007,12 +3043,16 @@ void flushTransSeq(TransInfo *t)
case SEQ_LEFTSEL: /* no vertical transform */
BKE_sequence_tx_set_final_left(seq, new_frame);
BKE_sequence_tx_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL);
- BKE_sequence_single_fix(seq); /* todo - move this into aftertrans update? - old seq tx needed it anyway */
+
+ /* todo - move this into aftertrans update? - old seq tx needed it anyway */
+ BKE_sequence_single_fix(seq);
break;
case SEQ_RIGHTSEL: /* no vertical transform */
BKE_sequence_tx_set_final_right(seq, new_frame);
BKE_sequence_tx_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL);
- BKE_sequence_single_fix(seq); /* todo - move this into aftertrans update? - old seq tx needed it anyway */
+
+ /* todo - move this into aftertrans update? - old seq tx needed it anyway */
+ BKE_sequence_single_fix(seq);
break;
}
@@ -3039,8 +3079,8 @@ void flushTransSeq(TransInfo *t)
trans_update_seq(t->scene, seq_prev, old_start_prev, sel_flag_prev);
}
-
- if (ELEM(t->mode, TFM_SEQ_SLIDE, TFM_TIME_TRANSLATE)) { /* originally TFM_TIME_EXTEND, transform changes */
+ /* originally TFM_TIME_EXTEND, transform changes */
+ if (ELEM(t->mode, TFM_SEQ_SLIDE, TFM_TIME_TRANSLATE)) {
/* Special annoying case here, need to calc metas with TFM_TIME_EXTEND only */
/* calc all meta's then effects [#27953] */
@@ -3298,7 +3338,8 @@ finally:
void flushTransUVs(TransInfo *t)
{
SpaceImage *sima = t->sa->spacedata.first;
- const bool use_pixel_snap = ((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL));
+ const bool use_pixel_snap = ((sima->pixel_snap_mode != SI_PIXEL_SNAP_DISABLED) &&
+ (t->state != TRANS_CANCEL));
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData2D *td;
@@ -3321,8 +3362,22 @@ void flushTransUVs(TransInfo *t)
td->loc2d[1] = td->loc[1] * aspect_inv[1];
if (use_pixel_snap) {
- td->loc2d[0] = roundf(td->loc2d[0] * size[0]) / size[0];
- td->loc2d[1] = roundf(td->loc2d[1] * size[1]) / size[1];
+ td->loc2d[0] *= size[0];
+ td->loc2d[1] *= size[1];
+
+ switch (sima->pixel_snap_mode) {
+ case SI_PIXEL_SNAP_CENTER:
+ td->loc2d[0] = roundf(td->loc2d[0] - 0.5f) + 0.5f;
+ td->loc2d[1] = roundf(td->loc2d[1] - 0.5f) + 0.5f;
+ break;
+ case SI_PIXEL_SNAP_CORNER:
+ td->loc2d[0] = roundf(td->loc2d[0]);
+ td->loc2d[1] = roundf(td->loc2d[1]);
+ break;
+ }
+
+ td->loc2d[0] /= size[0];
+ td->loc2d[1] /= size[1];
}
}
}
@@ -3572,7 +3627,8 @@ static void createTransNlaData(bContext *C, TransInfo *t)
td++;
}
if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA)) {
- /* if tdn is already holding the start handle, then we're doing both, otherwise, only end */
+ /* if tdn is already holding the start handle,
+ * then we're doing both, otherwise, only end */
tdn->handle = (tdn->handle) ? 2 : 1;
/* now, link the transform data up to this data */
@@ -3991,7 +4047,8 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
/* only add selected keyframes (for now, proportional edit is not enabled) */
- if (is_prop_edit || (bezt->f2 & SELECT)) { /* note this MUST match count_fcurve_keys(), so can't use BEZT_ISSEL_ANY() macro */
+ if (is_prop_edit || (bezt->f2 & SELECT)) { /* note this MUST match count_fcurve_keys(),
+ * so can't use BEZT_ISSEL_ANY() macro */
/* only add if on the right 'side' of the current frame */
if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
TimeToTransData(td, bezt->vec[1], adt, ypos);
@@ -4475,7 +4532,7 @@ static void graph_key_shortest_dist(TransInfo *t, FCurve *fcu, TransData *td_sta
static void createTransGraphEditData(bContext *C, TransInfo *t)
{
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
Scene *scene = t->scene;
ARegion *ar = t->ar;
View2D *v2d = &ar->v2d;
@@ -4644,7 +4701,8 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
unit_scale = ANIM_unit_mapping_get_factor(ac.scene, ale->id, ale->key_data, anim_map_flag, &offset);
- /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */
+ /* only include BezTriples whose 'keyframe' occurs on the same side
+ * of the current frame as mouse (if applicable) */
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
const bool sel2 = (bezt->f2 & SELECT) != 0;
@@ -4748,7 +4806,8 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
else
cfra = (float)CFRA;
- /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */
+ /* only include BezTriples whose 'keyframe' occurs on the
+ * same side of the current frame as mouse (if applicable) */
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
const bool sel2 = (bezt->f2 & SELECT) != 0;
@@ -4962,7 +5021,7 @@ static void beztmap_to_data(TransInfo *t, FCurve *fcu, BeztMap *bezms, int totve
*/
void remake_graph_transdata(TransInfo *t, ListBase *anim_data)
{
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
bAnimListElem *ale;
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
@@ -4996,7 +5055,7 @@ void remake_graph_transdata(TransInfo *t, ListBase *anim_data)
*/
void flushTransGraphData(TransInfo *t)
{
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
TransData *td;
TransData2D *td2d;
TransDataGraph *tdg;
@@ -5011,7 +5070,9 @@ void flushTransGraphData(TransInfo *t)
a < tc->data_len;
a++, td++, td2d++, tdg++)
{
- AnimData *adt = (AnimData *)td->extra; /* pointers to relevant AnimData blocks are stored in the td->extra pointers */
+ /* pointers to relevant AnimData blocks are stored in the td->extra pointers */
+ AnimData *adt = (AnimData *)td->extra;
+
float inv_unit_scale = 1.0f / tdg->unit_scale;
/* handle snapping for time values
@@ -5431,8 +5492,8 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData *c
}
}
else {
- /* Tag seq with a non zero value,
- * used by BKE_sequence_base_shuffle_time to identify the ones to shuffle */
+ /* Tag seq with a non zero value, used by
+ * BKE_sequence_base_shuffle_time to identify the ones to shuffle */
if (seq->depth == 0) {
seq->tmp = (void *)1;
}
@@ -5704,7 +5765,8 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
float rot[3][3], scale[3];
float ctime = BKE_scene_frame_get(scene);
- /* only use rigid body transform if simulation is running, avoids problems with initial setup of rigid bodies */
+ /* only use rigid body transform if simulation is running,
+ * avoids problems with initial setup of rigid bodies */
if (BKE_rigidbody_check_sim_running(scene->rigidbody_world, ctime)) {
/* save original object transform */
@@ -5744,13 +5806,34 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
if (t->mode == TFM_DUMMY)
skip_invert = true;
+ /* NOTE: This is not really following copy-on-write design and we shoud not
+ * be re-evaluating the evaluated object. But as the comment above mentioned
+ * this is part of a hack.
+ * More proper solution would be to make a shallwe copy of the object and
+ * evaluate that, and access matrix of that evaluated copy of the object.
+ * Might be more tricky than it sounds, if some logic later on accesses the
+ * object matrix via td->ob->obmat. */
+ Object *object_eval = DEG_get_evaluated_object(t->depsgraph, ob);
if (skip_invert == false && constinv == false) {
- ob->transflag |= OB_NO_CONSTRAINTS; /* BKE_object_where_is_calc_time checks this */
- BKE_object_where_is_calc(t->depsgraph, t->scene, ob);
- ob->transflag &= ~OB_NO_CONSTRAINTS;
+ object_eval->transflag |= OB_NO_CONSTRAINTS; /* BKE_object_where_is_calc checks this */
+ /* It is possiblre to have transform data initialization prior to a
+ * complete dependency graph evaluated. Happens, for example, when
+ * changing transformation mode. */
+ BKE_object_tfm_copy(object_eval, ob);
+ BKE_object_where_is_calc(t->depsgraph, t->scene, object_eval);
+ object_eval->transflag &= ~OB_NO_CONSTRAINTS;
}
- else
- BKE_object_where_is_calc(t->depsgraph, t->scene, ob);
+ else {
+ BKE_object_where_is_calc(t->depsgraph, t->scene, object_eval);
+ }
+ /* Copy newly evaluated fields to the original object, similar to how
+ * active dependency graph will do it. */
+ copy_m4_m4(ob->obmat, object_eval->obmat);
+ /* Only copy negative scale flag, this is the only flag which is modifed by
+ * the BKE_object_where_is_calc(). The rest of the flags we need to keep,
+ * otherwise we might loose dupli flags (see T61787). */
+ ob->transflag &= ~OB_NEG_SCALE;
+ ob->transflag |= (object_eval->transflag & OB_NEG_SCALE);
td->ob = ob;
@@ -5788,8 +5871,8 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
}
td->ext->rotOrder = ob->rotmode;
- td->ext->size = ob->size;
- copy_v3_v3(td->ext->isize, ob->size);
+ td->ext->size = ob->scale;
+ copy_v3_v3(td->ext->isize, ob->scale);
copy_v3_v3(td->ext->dscale, ob->dscale);
copy_v3_v3(td->center, ob->obmat[3]);
@@ -5874,7 +5957,7 @@ static void set_trans_object_base_flags(TransInfo *t)
/* Traverse all bases and set all possible flags. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
base->flag_legacy &= ~BA_WAS_SEL;
- if (TESTBASELIB_BGMODE(v3d, base)) {
+ if (BASE_SELECTED_EDITABLE(v3d, base)) {
Object *ob = base->object;
Object *parsel = ob->parent;
/* If parent selected, deselect. */
@@ -5882,7 +5965,7 @@ static void set_trans_object_base_flags(TransInfo *t)
if (parsel->base_flag & BASE_SELECTED) {
Base *parbase = BKE_view_layer_base_find(view_layer, parsel);
if (parbase != NULL) { /* in rare cases this can fail */
- if (TESTBASELIB_BGMODE(v3d, parbase)) {
+ if (BASE_SELECTED_EDITABLE(v3d, parbase)) {
break;
}
}
@@ -5940,7 +6023,7 @@ static int count_proportional_objects(TransInfo *t)
{
/* Mark all parents. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (TESTBASELIB_BGMODE(v3d, base)) {
+ if (BASE_SELECTED_EDITABLE(v3d, base)) {
Object *parent = base->object->parent;
/* flag all parents */
while (parent != NULL) {
@@ -5954,7 +6037,7 @@ static int count_proportional_objects(TransInfo *t)
/* all base not already selected or marked that is editable */
if ((base->object->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
(base->flag & BASE_SELECTED) == 0 &&
- (BASE_EDITABLE_BGMODE(v3d, base)))
+ (BASE_EDITABLE(v3d, base)))
{
mark_children(base->object);
}
@@ -5968,7 +6051,7 @@ static int count_proportional_objects(TransInfo *t)
*/
if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
(base->flag & BASE_SELECTED) == 0 &&
- (BASE_EDITABLE_BGMODE(v3d, base)))
+ (BASE_EDITABLE(v3d, base)))
{
flush_trans_object_base_deps_flag(depsgraph, ob);
total += 1;
@@ -6378,7 +6461,7 @@ static void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t)
char hflag;
bool has_face_sel = (bm->totfacesel != 0);
- if (t->flag & T_MIRROR) {
+ if (tc->mirror.axis_flag) {
TransData *td;
int i;
@@ -6552,9 +6635,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
FCurve *fcu = (FCurve *)ale->key_data;
/* 3 cases here for curve cleanups:
- * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
- * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
- * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
+ * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
+ * 2) canceled == 0 -> user confirmed the transform,
+ * so duplicates should be removed
+ * 3) canceled + duplicate -> user canceled the transform,
+ * but we made duplicates, so get rid of these
*/
if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 &&
((canceled == 0) || (duplicate)) )
@@ -6583,9 +6668,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
/* 3 cases here for curve cleanups:
- * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
- * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
- * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
+ * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
+ * 2) canceled == 0 -> user confirmed the transform,
+ * so duplicates should be removed.
+ * 3) canceled + duplicate -> user canceled the transform,
+ * but we made duplicates, so get rid of these.
*/
if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 &&
((canceled == 0) || (duplicate)))
@@ -6596,9 +6683,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
else if (ac.datatype == ANIMCONT_GPENCIL) {
/* remove duplicate frames and also make sure points are in order! */
/* 3 cases here for curve cleanups:
- * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
- * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
- * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
+ * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
+ * 2) canceled == 0 -> user confirmed the transform,
+ * so duplicates should be removed
+ * 3) canceled + duplicate -> user canceled the transform,
+ * but we made duplicates, so get rid of these
*/
if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 &&
((canceled == 0) || (duplicate)))
@@ -6607,7 +6696,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
// XXX: BAD! this get gpencil datablocks directly from main db...
// but that's how this currently works :/
- for (gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
+ for (gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
if (ID_REAL_USERS(gpd))
posttrans_gpd_clean(gpd);
}
@@ -6627,7 +6716,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
// XXX: BAD! this get gpencil datablocks directly from main db...
// but that's how this currently works :/
- for (mask = bmain->mask.first; mask; mask = mask->id.next) {
+ for (mask = bmain->masks.first; mask; mask = mask->id.next) {
if (ID_REAL_USERS(mask))
posttrans_mask_clean(mask);
}
@@ -6662,8 +6751,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* clear flag that was set for time-slide drawing */
saction->flag &= ~SACTION_MOVING;
}
- else if (t->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ else if (t->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
bAnimContext ac;
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
@@ -6684,9 +6773,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
FCurve *fcu = (FCurve *)ale->key_data;
/* 3 cases here for curve cleanups:
- * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
- * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
- * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
+ * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
+ * 2) canceled == 0 -> user confirmed the transform,
+ * so duplicates should be removed
+ * 3) canceled + duplicate -> user canceled the transform,
+ * but we made duplicates, so get rid of these
*/
if ((sipo->flag & SIPO_NOTRANSKEYCULL) == 0 &&
((canceled == 0) || (duplicate)))
@@ -6758,7 +6849,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
else if (t->flag & T_POSE && (t->mode == TFM_BONESIZE)) {
/* Handle the exception where for TFM_BONESIZE in edit mode we pretend to be
- * in pose mode (to use bone orientation matrix), in that case we don't do operations like autokeyframing. */
+ * in pose mode (to use bone orientation matrix),
+ * in that case we don't do operations like autokeyframing. */
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
ob = tc->poseobj;
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
@@ -6803,7 +6895,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (t->mode == TFM_TRANSLATION)
pose_grab_with_ik_clear(bmain, ob);
- /* automatic inserting of keys and unkeyed tagging - only if transform wasn't canceled (or TFM_DUMMY) */
+ /* automatic inserting of keys and unkeyed tagging -
+ * only if transform wasn't canceled (or TFM_DUMMY) */
if (!canceled && (t->mode != TFM_DUMMY)) {
autokeyframe_pose(C, t->scene, ob, t->mode, targetless_ik);
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
@@ -6868,8 +6961,10 @@ 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 */
+ if (pid->type != PTCACHE_TYPE_PARTICLES) {
+ /* particles don't need reset on geometry change */
pid->cache->flag |= PTCACHE_OUTDATED;
+ }
}
BLI_freelistN(&pidlist);
@@ -6913,7 +7008,7 @@ int special_transform_moving(TransInfo *t)
if (t->spacetype == SPACE_SEQ) {
return G_TRANSFORM_SEQ;
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
return G_TRANSFORM_FCURVES;
}
else if ((t->flag & T_EDIT) || (t->flag & T_POSE)) {
@@ -6937,7 +7032,7 @@ static void createTransObject(bContext *C, TransInfo *t)
TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
/* count */
- tc->data_len = CTX_DATA_COUNT(C, selected_objects);
+ tc->data_len = CTX_DATA_COUNT(C, selected_bases);
if (!tc->data_len) {
/* clear here, main transform function escapes too */
@@ -6986,10 +7081,11 @@ static void createTransObject(bContext *C, TransInfo *t)
for (base = view_layer->object_bases.first; base; base = base->next) {
Object *ob = base->object;
- /* if base is not selected, not a parent of selection or not a child of selection and it is editable */
+ /* if base is not selected, not a parent of selection
+ * or not a child of selection and it is editable */
if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
(base->flag & BASE_SELECTED) == 0 &&
- BASE_EDITABLE_BGMODE(v3d, base))
+ BASE_EDITABLE(v3d, base))
{
td->protectflag = ob->protectflag;
td->ext = tx;
@@ -8447,7 +8543,8 @@ static void createTransGPencil(bContext *C, TransInfo *t)
if (point_ok) {
copy_v3_v3(td->iloc, &pt->x);
/* only copy center in local origins.
- * This allows get interesting effects also when move using proportional editing */
+ * This allows get interesting effects also when move
+ * using proportional editing */
if ((gps->flag & GP_STROKE_SELECT) &&
(ts->transform_pivot_point == V3D_AROUND_LOCAL_ORIGINS))
{
@@ -8489,7 +8586,8 @@ static void createTransGPencil(bContext *C, TransInfo *t)
copy_m3_m4(td->mtx, diff_mat); /* display position */
copy_m3_m4(td->axismtx, diff_mat); /* axis orientation */
- /* Triangulation must be calculated again, so save the stroke for recalc function */
+ /* Triangulation must be calculated again,
+ * so save the stroke for recalc function */
td->extra = gps;
/* save pointer to object */
@@ -8547,6 +8645,7 @@ void createTransData(bContext *C, TransInfo *t)
ViewLayer *view_layer = t->view_layer;
Object *ob = OBACT(view_layer);
+ bool has_transform_context = true;
t->data_len_all = -1;
/* if tests must match recalcData for correct updates */
@@ -8619,6 +8718,9 @@ void createTransData(bContext *C, TransInfo *t)
createTransPaintCurveVerts(C, t);
countAndCleanTransDataContainer(t);
}
+ else {
+ has_transform_context = false;
+ }
}
else if (t->obedit_type == OB_MESH) {
@@ -8634,6 +8736,9 @@ void createTransData(bContext *C, TransInfo *t)
sort_trans_data_dist(t);
}
}
+ else {
+ has_transform_context = false;
+ }
}
else if (t->spacetype == SPACE_ACTION) {
t->flag |= T_POINTS | T_2D_EDIT;
@@ -8644,7 +8749,8 @@ void createTransData(bContext *C, TransInfo *t)
if (t->data_len_all && (t->flag & T_PROP_EDIT)) {
sort_trans_data(t); // makes selected become first in array
- //set_prop_dist(t, false); /* don't do that, distance has been set in createTransActionData already */
+ /* don't do that, distance has been set in createTransActionData already */
+ //set_prop_dist(t, false);
sort_trans_data_dist(t);
}
}
@@ -8659,11 +8765,11 @@ void createTransData(bContext *C, TransInfo *t)
t->flag |= T_POINTS | T_2D_EDIT;
t->obedit_type = -1;
- t->num.flag |= NUM_NO_FRACTION; /* sequencer has no use for floating point transformations */
+ t->num.flag |= NUM_NO_FRACTION; /* sequencer has no use for floating point trasnform */
createTransSeqData(C, t);
countAndCleanTransDataContainer(t);
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
t->flag |= T_POINTS | T_2D_EDIT;
t->obedit_type = -1;
@@ -8671,8 +8777,12 @@ void createTransData(bContext *C, TransInfo *t)
countAndCleanTransDataContainer(t);
if (t->data_len_all && (t->flag & T_PROP_EDIT)) {
- sort_trans_data(t); // makes selected become first in array
- set_prop_dist(t, false); /* don't do that, distance has been set in createTransGraphEditData already */
+ /* makes selected become first in array */
+ sort_trans_data(t);
+
+ /* don't do that, distance has been set in createTransGraphEditData already */
+ set_prop_dist(t, false);
+
sort_trans_data_dist(t);
}
}
@@ -8708,6 +8818,9 @@ void createTransData(bContext *C, TransInfo *t)
sort_trans_data_dist(t);
}
}
+ else {
+ has_transform_context = false;
+ }
}
else if (t->obedit_type != -1) {
/* Multi object editing. */
@@ -8782,6 +8895,7 @@ void createTransData(bContext *C, TransInfo *t)
else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT) && !(t->options & CTX_PAINT_CURVE)) {
/* important that ob_armature can be set even when its not selected [#23412]
* lines below just check is also visible */
+ has_transform_context = false;
Object *ob_armature = modifiers_isDeformedByArmature(ob);
if (ob_armature && ob_armature->mode & OB_MODE_POSE) {
Base *base_arm = BKE_view_layer_base_find(t->view_layer, ob_armature);
@@ -8794,13 +8908,10 @@ void createTransData(bContext *C, TransInfo *t)
initTransDataContainers_FromObjectData(t, ob_armature, objects, objects_len);
createTransPose(t);
countAndCleanTransDataContainer(t);
+ has_transform_context = true;
}
}
}
- /* Mark as initialized if above checks fail. */
- if (t->data_len_all == -1) {
- t->data_len_all = 0;
- }
}
else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_start_edit(PE_get_current(scene, ob))) {
createTransParticleVerts(C, t);
@@ -8819,9 +8930,8 @@ void createTransData(bContext *C, TransInfo *t)
createTransPaintCurveVerts(C, t);
countAndCleanTransDataContainer(t);
}
- /* Mark as initialized if above checks fail. */
- if (t->data_len_all == -1) {
- t->data_len_all = 0;
+ else {
+ has_transform_context = false;
}
}
else {
@@ -8849,7 +8959,13 @@ void createTransData(bContext *C, TransInfo *t)
}
/* Check that 'countAndCleanTransDataContainer' ran. */
- BLI_assert(t->data_len_all != -1);
+ if (has_transform_context) {
+ BLI_assert(t->data_len_all != -1);
+ }
+ else {
+ BLI_assert(t->data_len_all == -1);
+ t->data_len_all = 0;
+ }
BLI_assert((!(t->flag & T_EDIT)) == (!(t->obedit_type != -1)));
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 8ae23737e5e..93bfb7261a8 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_generics.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <string.h>
@@ -237,27 +229,29 @@ static void clipMirrorModifier(TransInfo *t)
static void editbmesh_apply_to_mirror(TransInfo *t)
{
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
- TransData *td = tc->data;
- BMVert *eve;
- int i;
+ if (tc->mirror.axis_flag) {
+ TransData *td = tc->data;
+ BMVert *eve;
+ int i;
- for (i = 0; i < tc->data_len; i++, td++) {
- if (td->flag & TD_NOACTION)
- break;
- if (td->loc == NULL)
- break;
- if (td->flag & TD_SKIP)
- continue;
-
- eve = td->extra;
- if (eve) {
- eve->co[0] = -td->loc[0];
- eve->co[1] = td->loc[1];
- eve->co[2] = td->loc[2];
- }
+ for (i = 0; i < tc->data_len; i++, td++) {
+ if (td->flag & TD_NOACTION)
+ break;
+ if (td->loc == NULL)
+ break;
+ if (td->flag & TD_SKIP)
+ continue;
+
+ eve = td->extra;
+ if (eve) {
+ eve->co[0] = -td->loc[0];
+ eve->co[1] = td->loc[1];
+ eve->co[2] = td->loc[2];
+ }
- if (td->flag & TD_MIRROR_EDGE) {
- td->loc[0] = 0;
+ if (td->flag & TD_MIRROR_EDGE) {
+ td->loc[0] = 0;
+ }
}
}
}
@@ -278,7 +272,8 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
* - the option to add new actions for each round is not enabled
*/
if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL) == 0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) {
- /* if playback has just looped around, we need to add a new NLA track+strip to allow a clean pass to occur */
+ /* if playback has just looped around,
+ * we need to add a new NLA track+strip to allow a clean pass to occur */
if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) {
AnimData *adt = BKE_animdata_from_id(id);
const bool is_first = (adt) && (adt->nla_tracks.first == NULL);
@@ -403,7 +398,7 @@ static void recalcData_actedit(TransInfo *t)
/* helper for recalcData() - for Graph Editor transforms */
static void recalcData_graphedit(TransInfo *t)
{
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
ViewLayer *view_layer = t->view_layer;
ListBase anim_data = {NULL, NULL};
@@ -571,7 +566,8 @@ static void recalcData_nla(TransInfo *t)
if (t->state != TRANS_CANCEL) {
switch (snla->autosnap) {
case SACTSNAP_FRAME: /* snap to nearest frame */
- case SACTSNAP_STEP: /* frame step - this is basically the same, since we don't have any remapping going on */
+ case SACTSNAP_STEP: /* frame step - this is basically the same,
+ * since we don't have any remapping going on */
{
tdn->h1[0] = floorf(tdn->h1[0] + 0.5f);
tdn->h2[0] = floorf(tdn->h2[0] + 0.5f);
@@ -579,7 +575,8 @@ static void recalcData_nla(TransInfo *t)
}
case SACTSNAP_SECOND: /* snap to nearest second */
- case SACTSNAP_TSTEP: /* second step - this is basically the same, since we don't have any remapping going on */
+ case SACTSNAP_TSTEP: /* second step - this is basically the same,
+ * since we don't have any remapping going on */
{
/* This case behaves differently from the rest, since lengths of strips
* may not be multiples of a second. If we just naively resize adjust
@@ -777,7 +774,8 @@ static void recalcData_objects(TransInfo *t)
if (t->state == TRANS_CANCEL) {
while (nu) {
- BKE_nurb_handles_calc(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
+ /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
+ BKE_nurb_handles_calc(nu);
nu = nu->next;
}
}
@@ -812,8 +810,11 @@ static void recalcData_objects(TransInfo *t)
applyProject(t);
clipMirrorModifier(t);
}
- if ((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
+ if ((t->flag & T_NO_MIRROR) == 0 &&
+ (t->options & CTX_NO_MIRROR) == 0)
+ {
editbmesh_apply_to_mirror(t);
+ }
if (t->mode == TFM_EDGE_SLIDE) {
projectEdgeSlideData(t, false);
@@ -1117,7 +1118,7 @@ void recalcData(TransInfo *t)
else if (t->spacetype == SPACE_SEQ) {
recalcData_sequencer(t);
}
- else if (t->spacetype == SPACE_IPO) {
+ else if (t->spacetype == SPACE_GRAPH) {
recalcData_graphedit(t);
}
else if (t->spacetype == SPACE_NODE) {
@@ -1142,7 +1143,7 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis
GPU_matrix_push();
copy_v3_v3(v3, dir);
- mul_v3_fl(v3, v3d->far);
+ mul_v3_fl(v3, v3d->clip_end);
sub_v3_v3v3(v2, center, v3);
add_v3_v3v3(v1, center, v3);
@@ -1227,6 +1228,13 @@ void initTransDataContainers_FromObjectData(TransInfo *t, Object *obact, Object
for (int i = 0; i < objects_len; i++) {
TransDataContainer *tc = &t->data_container[i];
+ /* TODO, multiple axes. */
+ tc->mirror.axis_flag = (
+ ((t->flag & T_NO_MIRROR) == 0) &&
+ ((t->options & CTX_NO_MIRROR) == 0) &&
+ (objects[i]->type == OB_MESH) &&
+ (((Mesh *)objects[i]->data)->editflag & ME_EDIT_MIRROR_X) != 0);
+
if (object_mode & OB_MODE_EDIT) {
tc->obedit = objects[i];
/* Check needed for UV's */
@@ -1329,6 +1337,15 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
unit_m3(t->mat);
+ unit_m3(t->orient_matrix);
+ negate_m3(t->orient_matrix);
+ /* Leave 't->orient_matrix_is_set' to false,
+ * so we overwrite it when we have a useful value. */
+
+ /* Default to rotate on the Z axis. */
+ t->orient_axis = 2;
+ t->orient_axis_ortho = 1;
+
/* if there's an event, we're modal */
if (event) {
t->flag |= T_MODAL;
@@ -1402,6 +1419,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT];
+ t->orientation.unset = V3D_ORIENT_GLOBAL;
t->orientation.user = orient_slot->type;
t->orientation.custom = BKE_scene_transform_orientation_find(t->scene, orient_slot->index_custom);
@@ -1412,8 +1430,8 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
NULL);
/* Make second orientation local if both are global. */
- if (t->orientation.user == V3D_MANIP_GLOBAL) {
- t->orientation.user_alt = V3D_MANIP_LOCAL;
+ if (t->orientation.user == V3D_ORIENT_GLOBAL) {
+ t->orientation.user_alt = V3D_ORIENT_LOCAL;
t->orientation.types[0] = &t->orientation.user_alt;
SWAP(short *, t->orientation.types[0], t->orientation.types[1]);
}
@@ -1477,8 +1495,8 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->view = &ar->v2d;
t->around = V3D_AROUND_CENTER_BOUNDS;
}
- else if (t->spacetype == SPACE_IPO) {
- SpaceIpo *sipo = sa->spacedata.first;
+ else if (t->spacetype == SPACE_GRAPH) {
+ SpaceGraph *sipo = sa->spacedata.first;
t->view = &ar->v2d;
t->around = sipo->around;
}
@@ -1504,27 +1522,46 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->around = V3D_AROUND_CENTER_BOUNDS;
}
- if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_matrix")) &&
- RNA_property_is_set(op->ptr, prop)))
+ if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis"))) {
+ t->orient_axis = RNA_property_enum_get(op->ptr, prop);
+ }
+ if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) {
+ t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop);
+ }
+
+ if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_matrix")) &&
+ RNA_property_is_set(op->ptr, prop)) &&
+ ((t->flag & T_MODAL) ||
+ /* When using redo, don't use the the custom constraint matrix
+ * if the user selects a different orientation. */
+ (RNA_enum_get(op->ptr, "orient_type") ==
+ RNA_enum_get(op->ptr, "orient_matrix_type"))))
{
RNA_property_float_get_array(op->ptr, prop, &t->spacemtx[0][0]);
- t->orientation.user = V3D_MANIP_CUSTOM_MATRIX;
+ /* Some transform modes use this to operate on an axis. */
+ t->orient_matrix_is_set = true;
+ copy_m3_m3(t->orient_matrix, t->spacemtx);
+ t->orient_matrix_is_set = true;
+ t->orientation.user = V3D_ORIENT_CUSTOM_MATRIX;
t->orientation.custom = 0;
+ if (t->flag & T_MODAL) {
+ RNA_enum_set(op->ptr, "orient_matrix_type", RNA_enum_get(op->ptr, "orient_type"));
+ }
}
- else if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
+ else if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_type")) &&
RNA_property_is_set(op->ptr, prop)))
{
short orientation = RNA_property_enum_get(op->ptr, prop);
TransformOrientation *custom_orientation = NULL;
- if (orientation >= V3D_MANIP_CUSTOM) {
- if (orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) {
- orientation = V3D_MANIP_GLOBAL;
+ if (orientation >= V3D_ORIENT_CUSTOM) {
+ if (orientation >= V3D_ORIENT_CUSTOM + BIF_countTransformOrientation(C)) {
+ orientation = V3D_ORIENT_GLOBAL;
}
else {
custom_orientation = BKE_scene_transform_orientation_find(
- t->scene, orientation - V3D_MANIP_CUSTOM);
- orientation = V3D_MANIP_CUSTOM;
+ t->scene, orientation - V3D_ORIENT_CUSTOM);
+ orientation = V3D_ORIENT_CUSTOM;
}
}
@@ -1548,18 +1585,16 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
if (op && ((prop = RNA_struct_find_property(op->ptr, "mirror")) &&
RNA_property_is_set(op->ptr, prop)))
{
- if (RNA_property_boolean_get(op->ptr, prop)) {
- t->flag |= T_MIRROR;
- t->mirror = 1;
+ if (!RNA_property_boolean_get(op->ptr, prop)) {
+ t->flag |= T_NO_MIRROR;
}
}
- // Need stuff to take it from edit mesh or whatnot here
- else if (t->spacetype == SPACE_VIEW3D) {
- /* TODO(campbell): xform, get mirror from each object. */
- if (t->obedit_type == OB_MESH && (((Mesh *)OBACT(t->view_layer)->data)->editflag & ME_EDIT_MIRROR_X)) {
- t->flag |= T_MIRROR;
- t->mirror = 1;
- }
+ else if ((t->spacetype == SPACE_VIEW3D) && (t->obedit_type == OB_MESH)) {
+ /* pass */
+ }
+ else {
+ /* Avoid mirroring for unsupported contexts. */
+ t->options |= CTX_NO_MIRROR;
}
/* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
@@ -1571,7 +1606,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
/* use settings from scene only if modal */
if (t->flag & T_MODAL) {
if ((t->options & CTX_NO_PET) == 0) {
- if (t->spacetype == SPACE_IPO) {
+ if (t->spacetype == SPACE_GRAPH) {
t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_fcurve);
}
else if (t->spacetype == SPACE_ACTION) {
@@ -1712,7 +1747,7 @@ void postTrans(bContext *C, TransInfo *t)
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
/* free data malloced per trans-data */
if (ELEM(t->obedit_type, OB_CURVE, OB_SURF) ||
- (t->spacetype == SPACE_IPO))
+ (t->spacetype == SPACE_GRAPH))
{
TransData *td = tc->data;
for (int a = 0; a < tc->data_len; a++, td++) {
@@ -1927,7 +1962,7 @@ void calculateCenterCursor2D(TransInfo *t, float r_center[2])
void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2])
{
- SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
+ SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
Scene *scene = t->scene;
/* cursor is combination of current frame, and graph-editor cursor value */
@@ -2054,7 +2089,7 @@ static void calculateCenter_FromAround(TransInfo *t, int around, float r_center[
case V3D_AROUND_CURSOR:
if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP))
calculateCenterCursor2D(t, r_center);
- else if (t->spacetype == SPACE_IPO)
+ else if (t->spacetype == SPACE_GRAPH)
calculateCenterCursorGraph2D(t, r_center);
else
calculateCenterCursor(t, r_center);
@@ -2168,7 +2203,7 @@ void calculatePropRatio(TransInfo *t)
if (td->flag & TD_SELECTED) {
td->factor = 1.0f;
}
- else if (t->flag & T_MIRROR && td->loc[0] * t->mirror < -0.00001f) {
+ else if (tc->mirror.axis_flag && (td->loc[0] * tc->mirror.sign) < -0.00001f) {
td->flag |= TD_SKIP;
td->factor = 0.0f;
restoreElement(td);
diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c
index 7d0584e3571..cbc72f99168 100644
--- a/source/blender/editors/transform/transform_gizmo_2d.c
+++ b/source/blender/editors/transform/transform_gizmo_2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_gizmo_2d.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*
* \name 2D Transform Gizmo
*
@@ -28,7 +24,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_listbase.h"
#include "BLI_math.h"
#include "DNA_meshdata_types.h"
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index ddd0c871015..2e6a399d0ea 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_gizmo_3d.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*
* \name 3D Transform Gizmo
*
@@ -59,8 +55,6 @@
#include "BKE_workspace.h"
#include "BKE_object.h"
-#include "BIF_gl.h"
-
#include "DEG_depsgraph.h"
#include "WM_api.h"
@@ -657,11 +651,11 @@ void ED_transform_calc_orientation_from_type_ex(
bool ok = false;
switch (orientation_type) {
- case V3D_MANIP_GLOBAL:
+ case V3D_ORIENT_GLOBAL:
{
break; /* nothing to do */
}
- case V3D_MANIP_GIMBAL:
+ case V3D_ORIENT_GIMBAL:
{
if (gimbal_axis(ob, r_mat)) {
ok = true;
@@ -670,7 +664,7 @@ void ED_transform_calc_orientation_from_type_ex(
/* if not gimbal, fall through to normal */
ATTR_FALLTHROUGH;
}
- case V3D_MANIP_NORMAL:
+ case V3D_ORIENT_NORMAL:
{
if (obedit || ob->mode & OB_MODE_POSE) {
ED_getTransformOrientationMatrix(C, r_mat, pivot_point);
@@ -680,7 +674,7 @@ void ED_transform_calc_orientation_from_type_ex(
/* no break we define 'normal' as 'local' in Object mode */
ATTR_FALLTHROUGH;
}
- case V3D_MANIP_LOCAL:
+ case V3D_ORIENT_LOCAL:
{
if (ob->mode & OB_MODE_POSE) {
/* each bone moves on its own local axis, but to avoid confusion,
@@ -696,7 +690,7 @@ void ED_transform_calc_orientation_from_type_ex(
ok = true;
break;
}
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
if (rv3d != NULL) {
copy_m3_m4(r_mat, rv3d->viewinv);
@@ -705,13 +699,13 @@ void ED_transform_calc_orientation_from_type_ex(
}
break;
}
- case V3D_MANIP_CURSOR:
+ case V3D_ORIENT_CURSOR:
{
ED_view3d_cursor3d_calc_mat3(scene, r_mat);
ok = true;
break;
}
- case V3D_MANIP_CUSTOM:
+ case V3D_ORIENT_CUSTOM:
{
TransformOrientation *custom_orientation = BKE_scene_transform_orientation_find(
scene, orientation_index_custom);
@@ -1088,7 +1082,7 @@ int ED_transform_calc_gizmo_stats(
if (base && ((base->flag & BASE_SELECTED) == 0)) ob = NULL;
for (base = view_layer->object_bases.first; base; base = base->next) {
- if (!TESTBASELIB(v3d, base)) {
+ if (!BASE_SELECTED_EDITABLE(v3d, base)) {
continue;
}
if (ob == NULL) {
@@ -1211,8 +1205,6 @@ static void gizmo_xform_message_subscribe(
wmGizmoGroup *gzgroup, struct wmMsgBus *mbus,
Scene *scene, bScreen *UNUSED(screen), ScrArea *UNUSED(sa), ARegion *ar, const void *type_fn)
{
- GizmoGroup *ggd = gzgroup->customdata;
-
/* Subscribe to view properties */
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
.owner = ar,
@@ -1220,26 +1212,44 @@ static void gizmo_xform_message_subscribe(
.notify = WM_gizmo_do_msg_notify_tag_refresh,
};
+ int orient_flag = 0;
+ if (type_fn == TRANSFORM_GGT_gizmo) {
+ GizmoGroup *ggd = gzgroup->customdata;
+ orient_flag = ggd->twtype_init;
+ }
+ else if (type_fn == VIEW3D_GGT_xform_cage) {
+ orient_flag = SCE_GIZMO_SHOW_SCALE;
+ /* pass */
+ }
+ else if (type_fn == VIEW3D_GGT_xform_shear) {
+ orient_flag = SCE_GIZMO_SHOW_ROTATE;
+ }
+ TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, orient_flag);
+ PointerRNA orient_ref_ptr;
+ RNA_pointer_create(&scene->id, &RNA_TransformOrientationSlot, orient_slot, &orient_ref_ptr);
+ const ToolSettings *ts = scene->toolsettings;
+
PointerRNA scene_ptr;
RNA_id_pointer_create(&scene->id, &scene_ptr);
-
{
extern PropertyRNA rna_Scene_transform_orientation_slots;
- extern PropertyRNA rna_Scene_cursor_location;
const PropertyRNA *props[] = {
&rna_Scene_transform_orientation_slots,
- (scene->toolsettings->transform_pivot_point == V3D_AROUND_CURSOR) ? &rna_Scene_cursor_location : NULL,
};
for (int i = 0; i < ARRAY_SIZE(props); i++) {
- if (props[i]) {
- WM_msg_subscribe_rna(mbus, &scene_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
- }
+ WM_msg_subscribe_rna(mbus, &scene_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
}
}
- TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
- PointerRNA orient_ref_ptr;
- RNA_pointer_create(&scene->id, &RNA_TransformOrientationSlot, orient_slot, &orient_ref_ptr);
+ if ((ts->transform_pivot_point == V3D_AROUND_CURSOR) ||
+ (orient_slot->type == V3D_ORIENT_CURSOR))
+ {
+ /* We could be more specific here, for now subscribe to any cursor change. */
+ PointerRNA cursor_ptr;
+ RNA_pointer_create(&scene->id, &RNA_View3DCursor, &scene->cursor, &cursor_ptr);
+ WM_msg_subscribe_rna(mbus, &cursor_ptr, NULL, &msg_sub_value_gz_tag_refresh, __func__);
+ }
+
{
extern PropertyRNA rna_TransformOrientationSlot_type;
extern PropertyRNA rna_TransformOrientationSlot_use;
@@ -1258,6 +1268,7 @@ static void gizmo_xform_message_subscribe(
RNA_pointer_create(&scene->id, &RNA_ToolSettings, scene->toolsettings, &toolsettings_ptr);
if (type_fn == TRANSFORM_GGT_gizmo) {
+ GizmoGroup *ggd = gzgroup->customdata;
extern PropertyRNA rna_ToolSettings_transform_pivot_point;
extern PropertyRNA rna_ToolSettings_use_gizmo_mode;
const PropertyRNA *props[] = {
@@ -1285,7 +1296,7 @@ static void gizmo_xform_message_subscribe(
void drawDial3d(const TransInfo *t)
{
if (t->mode == TFM_ROTATION && t->spacetype == SPACE_VIEW3D) {
- wmGizmo *gz = wm_gizmomap_highlight_get(t->ar->gizmo_map);
+ wmGizmo *gz = wm_gizmomap_modal_get(t->ar->gizmo_map);
if (gz == NULL) {
/* We only draw Dial3d if the operator has been called by a gizmo. */
return;
@@ -1318,7 +1329,7 @@ void drawDial3d(const TransInfo *t)
}
else {
axis_idx = MAN_AXIS_ROT_C;
- negate_v3_v3(mat_basis[2], t->axis);
+ negate_v3_v3(mat_basis[2], t->orient_matrix[t->orient_axis]);
scale *= 1.2f;
line_with -= 1.0f;
}
@@ -1787,7 +1798,7 @@ static void WIDGETGROUP_gizmo_draw_prepare(const bContext *C, wmGizmoGroup *gzgr
Scene *scene = CTX_data_scene(C);
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
switch (orient_slot->type) {
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
WIDGETGROUP_gizmo_refresh(C, gzgroup);
break;
@@ -1810,15 +1821,15 @@ static void WIDGETGROUP_gizmo_invoke_prepare(
Scene *scene = CTX_data_scene(C);
wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, 0);
PointerRNA *ptr = &gzop->ptr;
- PropertyRNA *prop_constraint_orientation = RNA_struct_find_property(ptr, "constraint_orientation");
+ PropertyRNA *prop_orient_type = RNA_struct_find_property(ptr, "orient_type");
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
if (orient_slot == &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
- RNA_property_unset(ptr, prop_constraint_orientation);
+ RNA_property_unset(ptr, prop_orient_type);
}
else {
/* TODO: APIfunction */
int index = BKE_scene_orientation_slot_get_index(orient_slot);
- RNA_property_enum_set(ptr, prop_constraint_orientation, index);
+ RNA_property_enum_set(ptr, prop_orient_type, index);
}
}
@@ -1897,7 +1908,7 @@ void TRANSFORM_GGT_gizmo(wmGizmoGroupType *gzgt)
{SCE_GIZMO_SHOW_ROTATE, "ROTATE", 0, "Rotate", ""},
{SCE_GIZMO_SHOW_SCALE, "SCALE", 0, "Scale", ""},
{0, "NONE", 0, "None", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(gzgt->srna, "drag_action", rna_enum_gizmo_items, SCE_GIZMO_SHOW_TRANSLATE, "Drag Action", "");
}
@@ -2070,7 +2081,7 @@ static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmGizmoGroup
Scene *scene = CTX_data_scene(C);
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_SCALE);
switch (orient_slot->type) {
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
float viewinv_m3[3][3];
copy_m3_m4(viewinv_m3, rv3d->viewinv);
@@ -2159,15 +2170,20 @@ static void WIDGETGROUP_xform_shear_setup(const bContext *UNUSED(C), wmGizmoGrou
static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzgroup)
{
+ Scene *scene = CTX_data_scene(C);
ARegion *ar = CTX_wm_region(C);
RegionView3D *rv3d = ar->regiondata;
struct XFormShearWidgetGroup *xgzgroup = gzgroup->customdata;
struct TransformBounds tbounds;
+ const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
+
if (ED_transform_calc_gizmo_stats(
C, &(struct TransformCalcParams) {
.use_local_axis = false,
+ .orientation_type = orient_slot->type + 1,
+ .orientation_index_custom = orient_slot->index_custom,
}, &tbounds) == 0)
{
for (int i = 0; i < 3; i++) {
@@ -2191,15 +2207,12 @@ static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzg
WM_gizmo_set_matrix_rotation_from_yz_axis(gz, rv3d->twmat[i_ortho_a], rv3d->twmat[i]);
WM_gizmo_set_matrix_location(gz, rv3d->twmat[3]);
- float axis[3];
- if (j == 0) {
- copy_v3_v3(axis, tbounds.axis[i_ortho_b]);
- }
- else {
- negate_v3_v3(axis, tbounds.axis[i_ortho_b]);
- }
- RNA_float_set_array(&gzop->ptr, "axis", axis);
- RNA_float_set_array(&gzop->ptr, "axis_ortho", tbounds.axis[i_ortho_a]);
+ RNA_float_set_array(&gzop->ptr, "orient_matrix", &tbounds.axis[0][0]);
+ RNA_enum_set(&gzop->ptr, "orient_type", orient_slot->type);
+
+ RNA_enum_set(&gzop->ptr, "orient_axis", i_ortho_b);
+ RNA_enum_set(&gzop->ptr, "orient_axis_ortho", i_ortho_a);
+
mul_v3_fl(gz->matrix_basis[0], 0.5f);
mul_v3_fl(gz->matrix_basis[1], 6.0f);
}
@@ -2229,7 +2242,7 @@ static void WIDGETGROUP_xform_shear_draw_prepare(const bContext *C, wmGizmoGroup
/* Shear is like rotate, use the rotate setting. */
const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
switch (orient_slot->type) {
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
float viewinv_m3[3][3];
copy_m3_m4(viewinv_m3, rv3d->viewinv);
@@ -2248,7 +2261,8 @@ static void WIDGETGROUP_xform_shear_draw_prepare(const bContext *C, wmGizmoGroup
LISTBASE_FOREACH (wmGizmo *, gz, &gzgroup->gizmos) {
/* Since we have two pairs of each axis,
* bias the values so gizmos that are orthogonal to the view get priority.
- * This means we never default to shearing along the view axis in the case of an overlap. */
+ * This means we never default to shearing along
+ * the view axis in the case of an overlap. */
float axis_order[3], axis_bias[3];
copy_v3_v3(axis_order, gz->matrix_basis[2]);
copy_v3_v3(axis_bias, gz->matrix_basis[1]);
diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c
index 441141e9718..3d2e7c89f2b 100644
--- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_gizmo_extrude_3d.c
- * \ingroup edmesh
+/** \file
+ * \ingroup edmesh
*/
#include "BLI_utildefines.h"
@@ -84,7 +80,7 @@ typedef struct GizmoExtrudeGroup {
/* Copied from the transform operator,
* use to redo with the same settings. */
struct {
- float constraint_matrix[3][3];
+ float orient_matrix[3][3];
bool constraint_axis[3];
float value[4];
} redo_xform;
@@ -149,17 +145,22 @@ static void gizmo_mesh_extrude_setup(const bContext *C, wmGizmoGroup *gzgroup)
}
{
- const Object *obedit = CTX_data_edit_object(C);
const char *op_idname = NULL;
- if (obedit->type == OB_MESH) {
+ /* grease pencil does not use obedit */
+ /* GPXX: Remove if OB_MODE_EDIT_GPENCIL is merged with OB_MODE_EDIT */
+ const Object *obact = CTX_data_active_object(C);
+ if (obact->type == OB_GPENCIL) {
+ op_idname = "GPENCIL_OT_extrude_move";
+ }
+ else if (obact->type == OB_MESH) {
op_idname = "MESH_OT_extrude_context_move";
ggd->normal_axis = 2;
}
- else if (obedit->type == OB_ARMATURE) {
+ else if (obact->type == OB_ARMATURE) {
op_idname = "ARMATURE_OT_extrude_move";
ggd->normal_axis = 1;
}
- else if (obedit->type == OB_CURVE) {
+ else if (obact->type == OB_CURVE) {
op_idname = "CURVE_OT_extrude_move";
ggd->normal_axis = 2;
}
@@ -235,7 +236,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
ggd->data.orientation_type = scene->orientation_slots[SCE_ORIENT_DEFAULT].type;
const bool use_normal = (
- (ggd->data.orientation_type != V3D_MANIP_NORMAL) ||
+ (ggd->data.orientation_type != V3D_ORIENT_NORMAL) ||
(axis_type == EXTRUDE_AXIS_NORMAL));
const int axis_len_used = use_normal ? 4 : 3;
@@ -245,7 +246,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
struct TransformBounds tbounds_normal;
if (!ED_transform_calc_gizmo_stats(
C, &(struct TransformCalcParams){
- .orientation_type = V3D_MANIP_NORMAL + 1,
+ .orientation_type = V3D_ORIENT_NORMAL + 1,
}, &tbounds_normal))
{
unit_m3(tbounds_normal.axis);
@@ -286,7 +287,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
gz_adjust = ggd->adjust[1];
/* We can't access this from 'ot->last_properties'
* because some properties use skip-save. */
- RNA_float_get_array(op_xform->ptr, "constraint_matrix", &ggd->redo_xform.constraint_matrix[0][0]);
+ RNA_float_get_array(op_xform->ptr, "orient_matrix", &ggd->redo_xform.orient_matrix[0][0]);
RNA_boolean_get_array(op_xform->ptr, "constraint_axis", ggd->redo_xform.constraint_axis);
RNA_float_get_array(op_xform->ptr, "value", ggd->redo_xform.value);
@@ -315,7 +316,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
if (has_redo) {
if (gz_adjust == ggd->adjust[0]) {
- gizmo_mesh_extrude_orientation_matrix_set_for_adjust(ggd, ggd->redo_xform.constraint_matrix);
+ gizmo_mesh_extrude_orientation_matrix_set_for_adjust(ggd, ggd->redo_xform.orient_matrix);
if (adjust_is_flip) {
negate_v3(ggd->adjust[0]->matrix_basis[2]);
}
@@ -358,7 +359,7 @@ static void gizmo_mesh_extrude_draw_prepare(const bContext *C, wmGizmoGroup *gzg
{
GizmoExtrudeGroup *ggd = gzgroup->customdata;
switch (ggd->data.orientation_type) {
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
{
RegionView3D *rv3d = CTX_wm_region_view3d(C);
float mat[3][3];
@@ -393,8 +394,9 @@ static void gizmo_mesh_extrude_invoke_prepare(const bContext *UNUSED(C), wmGizmo
wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, 0);
PointerRNA macroptr = RNA_pointer_get(&gzop->ptr, "TRANSFORM_OT_translate");
if (gz == ggd->adjust[0]) {
- RNA_float_set_array(&macroptr, "constraint_matrix", &ggd->redo_xform.constraint_matrix[0][0]);
RNA_boolean_set_array(&macroptr, "constraint_axis", ggd->redo_xform.constraint_axis);
+ RNA_float_set_array(&macroptr, "orient_matrix", &ggd->redo_xform.orient_matrix[0][0]);
+ RNA_enum_set(&macroptr, "orient_type", V3D_ORIENT_NORMAL);
}
RNA_float_set_array(&macroptr, "value", ggd->redo_xform.value);
}
@@ -406,13 +408,14 @@ static void gizmo_mesh_extrude_invoke_prepare(const bContext *UNUSED(C), wmGizmo
if (i == 3) {
use_normal_matrix = true;
}
- else if (ggd->data.orientation_type == V3D_MANIP_NORMAL) {
+ else if (ggd->data.orientation_type == V3D_ORIENT_NORMAL) {
use_normal_matrix = true;
}
if (use_normal_matrix) {
wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, 0);
PointerRNA macroptr = RNA_pointer_get(&gzop->ptr, "TRANSFORM_OT_translate");
- RNA_float_set_array(&macroptr, "constraint_matrix", &ggd->data.normal_mat3[0][0]);
+ RNA_float_set_array(&macroptr, "orient_matrix", &ggd->data.normal_mat3[0][0]);
+ RNA_enum_set(&macroptr, "orient_type", V3D_ORIENT_NORMAL);
}
}
}
@@ -438,7 +441,7 @@ static void gizmo_mesh_extrude_message_subscribe(
WM_msg_subscribe_rna_params(
mbus,
&(const wmMsgParams_RNA){
- .ptr = (PointerRNA){.type = gzgroup->type->srna},
+ .ptr = (PointerRNA){ .type = gzgroup->type->srna, },
.prop = ggd->gzgt_axis_type_prop,
},
&msg_sub_value_gz_tag_refresh, __func__);
@@ -462,9 +465,9 @@ void VIEW3D_GGT_xform_extrude(struct wmGizmoGroupType *gzgt)
gzgt->message_subscribe = gizmo_mesh_extrude_message_subscribe;
static const EnumPropertyItem axis_type_items[] = {
- {EXTRUDE_AXIS_NORMAL, "NORMAL", 0, "Normal", "Only show normal axis"},
+ {EXTRUDE_AXIS_NORMAL, "NORMAL", 0, "Regular", "Only show normal axis"},
{EXTRUDE_AXIS_XYZ, "XYZ", 0, "XYZ", "Follow scene orientation"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(gzgt->srna, "axis_type", axis_type_items, 0, "Axis Type", "");
}
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 2721bccb7de..b03d50e11e7 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_input.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
@@ -197,7 +191,8 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const double mval[2
double dx3 = mval[0] - data->mval_prev[0];
double dy3 = mval[1] - data->mval_prev[1];
- /* use doubles here, to make sure a "1.0" (no rotation) doesn't become 9.999999e-01, which gives 0.02 for acos */
+ /* use doubles here, to make sure a "1.0" (no rotation)
+ * doesn't become 9.999999e-01, which gives 0.02 for acos */
double deler = (((dx1 * dx1 + dy1 * dy1) +
(dx2 * dx2 + dy2 * dy2) -
(dx3 * dx3 + dy3 * dy3)) / (2.0 * (((A * B) != 0.0) ? (A * B) : 1.0)));
@@ -387,12 +382,6 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
if (mi_data_prev && (mi_data_prev != mi->data)) {
MEM_freeN(mi_data_prev);
}
-
- /* Don't write into the values when non-modal because they are already set from operator redo values. */
- if (t->flag & T_MODAL) {
- /* bootstrap mouse input with initial values */
- applyMouseInput(t, mi, mi->imval, t->values);
- }
}
void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *t, float values[3]))
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 6bef5e4671a..a1bb970e844 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_ops.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include "MEM_guardedalloc.h"
@@ -125,7 +119,7 @@ static TransformModeItem transform_modes[] =
{OP_EDGE_BWEIGHT, TFM_BWEIGHT, TRANSFORM_OT_edge_bevelweight},
{OP_SEQ_SLIDE, TFM_SEQ_SLIDE, TRANSFORM_OT_seq_slide},
{OP_NORMAL_ROTATION, TFM_NORMAL_ROTATION, TRANSFORM_OT_rotate_normal},
- {NULL, 0}
+ {NULL, 0},
};
const EnumPropertyItem rna_enum_transform_mode_types[] =
@@ -161,7 +155,7 @@ const EnumPropertyItem rna_enum_transform_mode_types[] =
{TFM_ALIGN, "ALIGN", 0, "Align", ""},
{TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},
{TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int select_orientation_exec(bContext *C, wmOperator *op)
@@ -235,7 +229,7 @@ static bool delete_orientation_poll(bContext *C)
if (ED_operator_areaactive(C) == 0)
return 0;
- return ((scene->orientation_slots[SCE_ORIENT_DEFAULT].type >= V3D_MANIP_CUSTOM) &&
+ return ((scene->orientation_slots[SCE_ORIENT_DEFAULT].type >= V3D_ORIENT_CUSTOM) &&
(scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom != -1));
}
@@ -409,7 +403,8 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* XXX, workaround: active needs to be calculated before transforming,
* since we're not reading from 'td->center' in this case. see: T40241 */
if (t->tsnap.target == SCE_SNAP_TARGET_ACTIVE) {
- /* In camera view, tsnap callback is not set (see initSnappingMode() in transfrom_snap.c, and T40348). */
+ /* In camera view, tsnap callback is not set
+ * (see initSnappingMode() in transfrom_snap.c, and T40348). */
if (t->tsnap.targetSnap && ((t->tsnap.status & TARGET_INIT) == 0)) {
t->tsnap.targetSnap(t);
}
@@ -520,8 +515,8 @@ static bool transform_poll_property(const bContext *UNUSED(C), wmOperator *op, c
/* Orientation/Constraints. */
{
/* Hide orientation axis if no constraints are set, since it wont be used. */
- PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "constraint_axis");
- if (prop_con && !RNA_property_is_set(op->ptr, prop_con)) {
+ PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "orient_type");
+ if (prop_con != NULL && (prop_con != prop)) {
if (STRPREFIX(prop_id, "constraint")) {
return false;
}
@@ -547,33 +542,41 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
{
PropertyRNA *prop;
- if (flags & P_AXIS) {
- prop = RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_array(prop, 3);
- /* Make this not hidden when there's a nice axis selection widget */
- RNA_def_property_flag(prop, PROP_HIDDEN);
- RNA_def_property_ui_text(prop, "Axis", "The axis around which the transformation occurs");
+ if (flags & P_ORIENT_AXIS) {
+ prop = RNA_def_property(ot->srna, "orient_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Axis", "");
+ RNA_def_property_enum_default(prop, 2);
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
-
- if (flags & P_AXIS_ORTHO) {
- prop = RNA_def_property(ot->srna, "axis_ortho", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_array(prop, 3);
- /* Make this not hidden when there's a nice axis selection widget */
- RNA_def_property_flag(prop, PROP_HIDDEN);
- RNA_def_property_ui_text(prop, "Axis", "The orthogonal axis around which the transformation occurs");
+ if (flags & P_ORIENT_AXIS_ORTHO) {
+ prop = RNA_def_property(ot->srna, "orient_axis_ortho", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Axis Ortho", "");
+ RNA_def_property_enum_default(prop, 1);
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
- if (flags & P_CONSTRAINT) {
- RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
+ if (flags & P_ORIENT_MATRIX) {
+ prop = RNA_def_property(ot->srna, "orient_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
+ RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
- /* Set by 'constraint_orientation' or gizmo which acts on non-standard orientation. */
- prop = RNA_def_float_matrix(ot->srna, "constraint_matrix", 3, 3, NULL, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f);
+ /* Set by 'orient_type' or gizmo which acts on non-standard orientation. */
+ prop = RNA_def_float_matrix(ot->srna, "orient_matrix", 3, 3, NULL, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f);
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
- prop = RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
- RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
+ /* Only use 'orient_matrix' when 'orient_matrix_type == orient_type',
+ * this allows us to reuse the orientation set by a gizmo for eg, without disabling the ability
+ * to switch over to other orientations. */
+ prop = RNA_def_property(ot->srna, "orient_matrix_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Matrix Orientation", "");
RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ }
+ if (flags & P_CONSTRAINT) {
+ RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
}
if (flags & P_MIRROR) {
@@ -589,7 +592,8 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
RNA_def_enum(ot->srna, "proportional", rna_enum_proportional_editing_items, 0, "Proportional Editing", "");
prop = RNA_def_enum(ot->srna, "proportional_edit_falloff", rna_enum_proportional_falloff_items, 0,
"Proportional Falloff", "Falloff type for proportional editing mode");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+ /* Abusing id_curve :/ */
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE);
RNA_def_float(ot->srna, "proportional_size", 1, T_PROP_SIZE_MIN, T_PROP_SIZE_MAX,
"Proportional Size", "", 0.001f, 100.0f);
}
@@ -673,7 +677,7 @@ static void TRANSFORM_OT_translate(struct wmOperatorType *ot)
Transform_Properties(
ot,
- P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_OPTIONS |
+ P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_OPTIONS |
P_GPENCIL_EDIT | P_CURSOR_EDIT);
}
@@ -698,7 +702,7 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
Transform_Properties(
- ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_GPENCIL_EDIT | P_CENTER);
+ ot, P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_GPENCIL_EDIT | P_CENTER);
}
static bool skin_resize_poll(bContext *C)
@@ -731,7 +735,8 @@ static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
- Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_NO_TEXSPACE);
+ Transform_Properties(
+ ot, P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_NO_TEXSPACE);
}
static void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
@@ -779,7 +784,7 @@ static void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
Transform_Properties(
- ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_GPENCIL_EDIT | P_CENTER);
+ ot, P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_GPENCIL_EDIT | P_CENTER);
}
static void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
@@ -852,7 +857,9 @@ static void TRANSFORM_OT_shear(struct wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
- Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT | P_AXIS | P_AXIS_ORTHO);
+ Transform_Properties(
+ ot, P_ORIENT_AXIS | P_ORIENT_AXIS_ORTHO | P_ORIENT_MATRIX | P_PROPORTIONAL | P_MIRROR |
+ P_SNAP | P_GPENCIL_EDIT);
}
static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot)
@@ -894,7 +901,7 @@ static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
ot->poll = ED_operator_editmesh;
ot->poll_property = transform_poll_property;
- RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
+ RNA_def_float_distance(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
RNA_def_boolean(ot->srna, "use_even_offset", false, "Offset Even", "Scale the offset to give more even thickness");
@@ -943,7 +950,7 @@ static void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
ot->poll = ED_operator_screenactive;
ot->poll_property = transform_poll_property;
- Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_GPENCIL_EDIT | P_CENTER);
+ Transform_Properties(ot, P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_GPENCIL_EDIT | P_CENTER);
}
static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
@@ -1095,7 +1102,7 @@ static void TRANSFORM_OT_rotate_normal(struct wmOperatorType *ot)
RNA_def_float_rotation(ot->srna, "value", 0, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
- Transform_Properties(ot, P_AXIS | P_CONSTRAINT | P_MIRROR);
+ Transform_Properties(ot, P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_MIRROR);
}
@@ -1125,7 +1132,8 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot)
WM_operatortype_props_advanced_begin(ot);
Transform_Properties(
- ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER);
+ ot, P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP |
+ P_GPENCIL_EDIT | P_CENTER);
}
static int transform_from_gizmo_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 04999213c63..b486976bfad 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Martin Poirier
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_orientations.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <string.h>
@@ -51,8 +45,6 @@
#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "BKE_report.h"
-#include "BKE_main.h"
-#include "BKE_screen.h"
#include "BKE_scene.h"
#include "BKE_workspace.h"
@@ -73,8 +65,8 @@ void BIF_clearTransformOrientation(bContext *C)
for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
TransformOrientationSlot *orient_slot = &scene->orientation_slots[i];
- if (orient_slot->type == V3D_MANIP_CUSTOM) {
- orient_slot->type = V3D_MANIP_GLOBAL; /* fallback to global */
+ if (orient_slot->type == V3D_ORIENT_CUSTOM) {
+ orient_slot->type = V3D_ORIENT_GLOBAL; /* fallback to global */
orient_slot->index_custom = -1;
}
}
@@ -369,7 +361,7 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target)
BLI_assert(index != -1);
- scene->orientation_slots[SCE_ORIENT_DEFAULT].type = V3D_MANIP_CUSTOM;
+ scene->orientation_slots[SCE_ORIENT_DEFAULT].type = V3D_ORIENT_CUSTOM;
scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom = index;
}
@@ -422,26 +414,26 @@ void initTransformOrientation(bContext *C, TransInfo *t)
Object *obedit = CTX_data_active_object(C);
switch (t->orientation.user) {
- case V3D_MANIP_GLOBAL:
+ case V3D_ORIENT_GLOBAL:
unit_m3(t->spacemtx);
BLI_strncpy(t->spacename, IFACE_("global"), sizeof(t->spacename));
break;
- case V3D_MANIP_GIMBAL:
+ case V3D_ORIENT_GIMBAL:
unit_m3(t->spacemtx);
if (ob && gimbal_axis(ob, t->spacemtx)) {
BLI_strncpy(t->spacename, IFACE_("gimbal"), sizeof(t->spacename));
break;
}
ATTR_FALLTHROUGH; /* no gimbal fallthrough to normal */
- case V3D_MANIP_NORMAL:
+ case V3D_ORIENT_NORMAL:
if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
BLI_strncpy(t->spacename, IFACE_("normal"), sizeof(t->spacename));
ED_getTransformOrientationMatrix(C, t->spacemtx, t->around);
break;
}
ATTR_FALLTHROUGH; /* we define 'normal' as 'local' in Object mode */
- case V3D_MANIP_LOCAL:
+ case V3D_ORIENT_LOCAL:
BLI_strncpy(t->spacename, IFACE_("local"), sizeof(t->spacename));
if (ob) {
@@ -454,7 +446,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
break;
- case V3D_MANIP_VIEW:
+ case V3D_ORIENT_VIEW:
if ((t->spacetype == SPACE_VIEW3D) &&
(t->ar->regiontype == RGN_TYPE_WINDOW))
{
@@ -470,17 +462,17 @@ void initTransformOrientation(bContext *C, TransInfo *t)
unit_m3(t->spacemtx);
}
break;
- case V3D_MANIP_CURSOR:
+ case V3D_ORIENT_CURSOR:
{
BLI_strncpy(t->spacename, IFACE_("cursor"), sizeof(t->spacename));
ED_view3d_cursor3d_calc_mat3(t->scene, t->spacemtx);
break;
}
- case V3D_MANIP_CUSTOM_MATRIX:
+ case V3D_ORIENT_CUSTOM_MATRIX:
/* Already set. */
BLI_strncpy(t->spacename, IFACE_("custom"), sizeof(t->spacename));
break;
- case V3D_MANIP_CUSTOM:
+ case V3D_ORIENT_CUSTOM:
BLI_strncpy(t->spacename, t->orientation.custom->name, sizeof(t->spacename));
if (applyTransformOrientation(t->orientation.custom, t->spacemtx, t->spacename)) {
@@ -491,6 +483,20 @@ void initTransformOrientation(bContext *C, TransInfo *t)
}
break;
}
+
+ if (t->orient_matrix_is_set == false) {
+ t->orient_matrix_is_set = true;
+ if (t->flag & T_MODAL) {
+ /* Rotate for example defaults to operating on the view plane. */
+ t->orientation.unset = V3D_ORIENT_VIEW;
+ copy_m3_m4(t->orient_matrix, t->viewinv);
+ normalize_m3(t->orient_matrix);
+ }
+ else {
+ copy_m3_m3(t->orient_matrix, t->spacemtx);
+ }
+ negate_m3(t->orient_matrix);
+ }
}
/**
@@ -1079,7 +1085,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
/* first selected */
ob = NULL;
for (base = view_layer->object_bases.first; base; base = base->next) {
- if (TESTBASELIB(v3d, base)) {
+ if (BASE_SELECTED_EDITABLE(v3d, base)) {
ob = base->object;
break;
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 9cf71dc4cf4..305b17949c8 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Martin Poirier
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_snap.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <stdlib.h>
@@ -52,7 +44,6 @@
#include "GPU_immediate.h"
#include "GPU_state.h"
-#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_object.h"
#include "BKE_anim.h" /* for duplis */
@@ -556,7 +547,7 @@ static void initSnappingMode(TransInfo *t)
/* Edit mode */
if (t->tsnap.applySnap != NULL && // A snapping function actually exist
- ((obedit_type != -1) && ELEM(obedit_type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE, OB_MBALL)) ) // Temporary limited to edit mode meshes, armature, curves, mballs
+ ((obedit_type != -1) && ELEM(obedit_type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE, OB_MBALL)) ) // Temporary limited to edit mode meshes, armature, curves, metaballs
{
/* Exclude editmesh if using proportional edit */
if ((obedit_type == OB_MESH) && (t->flag & T_PROP_EDIT)) {
@@ -879,7 +870,9 @@ static void ApplySnapResize(TransInfo *t, float vec[3])
getSnapPoint(t, point);
float dist = ResizeBetween(t, t->tsnap.snapTarget, point);
- copy_v3_fl(vec, dist);
+ if (dist != TRANSFORM_DIST_INVALID) {
+ copy_v3_fl(vec, dist);
+ }
}
/********************** DISTANCE **************************/
@@ -1527,10 +1520,10 @@ static void applyGridIncrement(TransInfo *t, float *val, int max_index, const fl
if (use_aspect) {
/* custom aspect for fcurve */
- if (t->spacetype == SPACE_IPO) {
+ if (t->spacetype == SPACE_GRAPH) {
View2D *v2d = &t->ar->v2d;
View2DGrid *grid;
- SpaceIpo *sipo = t->sa->spacedata.first;
+ SpaceGraph *sipo = t->sa->spacedata.first;
int unity = V2D_UNIT_VALUES;
int unitx = (sipo->flag & SIPO_DRAWTIME) ? V2D_UNIT_SECONDS : V2D_UNIT_FRAMESCALE;
@@ -1590,7 +1583,8 @@ static void applyGridIncrement(TransInfo *t, float *val, int max_index, const fl
float grid_p = iter_fac * roundf(pos_on_axis[j] / iter_fac);
float dist_p = fabs((grid_p - pos_on_axis[j]) / local_axis[j]);
- /* The amount of distance needed to travel along the local axis to snap to the closest grid point */
+ /* The amount of distance needed to travel along the
+ * local axis to snap to the closest grid point */
/* in the global j axis direction */
float move_dist = (grid_p - center_global[j]) / local_axis[j];
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index feca8f3f47a..e7c4c2e441c 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/transform/transform_snap_object.c
- * \ingroup edtransform
+/** \file
+ * \ingroup edtransform
*/
#include <stdlib.h>
@@ -33,7 +29,6 @@
#include "BLI_kdopbvh.h"
#include "BLI_memarena.h"
#include "BLI_ghash.h"
-#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
@@ -210,7 +205,7 @@ typedef void(*IterSnapObjsCallback)(SnapObjectContext *sctx, bool is_obedit, Obj
* Walks through all objects in the scene to create the list of objects to snap.
*
* \param sctx: Snap context to store data.
- * \param snap_select : from enum eSnapSelect.
+ * \param snap_select: from enum #eSnapSelect.
*/
static void iter_snap_objects(
SnapObjectContext *sctx,
@@ -225,7 +220,7 @@ static void iter_snap_objects(
Base *base_act = view_layer->basact;
for (Base *base = view_layer->object_bases.first; base != NULL; base = base->next) {
- if ((BASE_VISIBLE_BGMODE(v3d, base)) && (base->flag_legacy & BA_SNAP_FIX_DEPS_FIASCO) == 0 &&
+ if ((BASE_VISIBLE(v3d, base)) && (base->flag_legacy & BA_SNAP_FIX_DEPS_FIASCO) == 0 &&
!((snap_select == SNAP_NOT_SELECTED && ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL))) ||
(snap_select == SNAP_NOT_ACTIVE && base == base_act)))
{
@@ -454,7 +449,7 @@ static bool raycastMesh(
retval = data.retval;
}
else {
- BVHTreeRayHit hit = {.index = -1, .dist = local_depth};
+ BVHTreeRayHit hit = { .index = -1, .dist = local_depth, };
if (BLI_bvhtree_ray_cast(
treedata->tree, ray_start_local, ray_normal_local, 0.0f,
@@ -567,7 +562,7 @@ static bool raycastEditMesh(
BMEditMesh *em_orig;
int looptri_num_active = -1;
- /* Get original version of the edit_btmesh. */
+ /* Get original version of the edit_mesh. */
em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
if (sctx->callbacks.edit_mesh.test_face_fn) {
@@ -622,7 +617,7 @@ static bool raycastEditMesh(
retval = data.retval;
}
else {
- BVHTreeRayHit hit = {.index = -1, .dist = local_depth};
+ BVHTreeRayHit hit = { .index = -1, .dist = local_depth, };
if (BLI_bvhtree_ray_cast(
treedata->tree, ray_start_local, ray_normal_local, 0.0f,
@@ -646,7 +641,7 @@ static bool raycastEditMesh(
retval = true;
if (r_index) {
- /* Get original version of the edit_btmesh. */
+ /* Get original version of the edit_mesh. */
BMEditMesh *em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
*r_index = BM_elem_index_get(em_orig->looptris[hit.index][0]->f);
@@ -767,8 +762,8 @@ static void raycast_obj_cb(SnapObjectContext *sctx, bool use_obedit, Object *ob,
* Walks through all objects in the scene to find the `hit` on object surface.
*
* \param sctx: Snap context to store data.
- * \param snap_select : from enum eSnapSelect.
- * \param use_object_edit_cage : Uses the coordinates of BMesh(if any) to do the snapping.
+ * \param snap_select: from enum eSnapSelect.
+ * \param use_object_edit_cage: Uses the coordinates of BMesh(if any) to do the snapping.
* \param obj_list: List with objects to snap (created in `create_object_list`).
*
* Read/Write Args
@@ -786,7 +781,6 @@ static void raycast_obj_cb(SnapObjectContext *sctx, bool use_obedit, Object *ob,
* \param r_ob: Hit object.
* \param r_obmat: Object matrix (may not be #Object.obmat with dupli-instances).
* \param r_hit_list: List of #SnapObjectHitDepth (caller must free).
- *
*/
static bool raycastObjects(
SnapObjectContext *sctx,
@@ -995,7 +989,8 @@ static bool test_projected_edge_dist(
typedef void (*Nearest2DGetVertCoCallback)(const int index, const float **co, void *data);
typedef void (*Nearest2DGetEdgeVertsCallback)(const int index, int v_index[2], void *data);
typedef void (*Nearest2DGetTriVertsCallback)(const int index, int v_index[3], void *data);
-typedef void (*Nearest2DGetTriEdgesCallback)(const int index, int e_index[3], void *data); /* Equal the previous one */
+/* Equal the previous one */
+typedef void (*Nearest2DGetTriEdgesCallback)(const int index, int e_index[3], void *data);
typedef void (*Nearest2DCopyVertNoCallback)(const int index, float r_no[3], void *data);
typedef struct Nearest2dUserData {
@@ -1543,7 +1538,7 @@ static short snapCurve(
if (nu->bezt) {
/* don't snap to selected (moving) or hidden */
if (nu->bezt[u].f2 & SELECT || nu->bezt[u].hide != 0) {
- break;
+ continue;
}
has_snap |= test_projected_vert_dist(
&neasrest_precalc,
@@ -1573,7 +1568,7 @@ static short snapCurve(
else {
/* don't snap to selected (moving) or hidden */
if (nu->bp[u].f1 & SELECT || nu->bp[u].hide != 0) {
- break;
+ continue;
}
has_snap |= test_projected_vert_dist(
&neasrest_precalc,
@@ -2300,7 +2295,6 @@ static void sanp_obj_cb(SnapObjectContext *sctx, bool is_obedit, Object *ob, flo
* (currently only set to the polygon index when when using ``snap_to == SCE_SNAP_MODE_FACE``).
* \param r_ob: Hit object.
* \param r_obmat: Object matrix (may not be #Object.obmat with dupli-instances).
- *
*/
static short snapObjectsRay(
SnapObjectContext *sctx, SnapData *snapdata,
diff --git a/source/blender/editors/undo/CMakeLists.txt b/source/blender/editors/undo/CMakeLists.txt
index 2e3e73f34f4..6ccba01c465 100644
--- a/source/blender/editors/undo/CMakeLists.txt
+++ b/source/blender/editors/undo/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 17e5fe912e1..7c8fc4ef8ba 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* 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 *****
*/
-/** \file blender/editors/undo/ed_undo.c
- * \ingroup edundo
+/** \file
+ * \ingroup edundo
*/
#include <string.h>
@@ -56,7 +48,7 @@
#include "BKE_workspace.h"
#include "BKE_paint.h"
-#include "BLO_writefile.h"
+#include "BLO_blend_validate.h"
#include "ED_gpencil.h"
#include "ED_render.h"
@@ -110,9 +102,13 @@ void ED_undo_push(bContext *C, const char *str)
WM_file_tag_modified();
}
-/* note: also check undo_history_exec() in bottom if you change notifiers */
+/**
+ * \note Also check #undo_history_exec in bottom if you change notifiers.
+ */
static int ed_undo_step(bContext *C, int step, const char *undoname, ReportList *reports)
{
+ /* Mutually exclusives, ensure correct input. */
+ BLI_assert((undoname && !step) || (!undoname && step));
CLOG_INFO(&LOG, 1, "name='%s', step=%d", undoname, step);
wmWindowManager *wm = CTX_wm_manager(C);
Scene *scene = CTX_data_scene(C);
@@ -173,7 +169,12 @@ static int ed_undo_step(bContext *C, int step, const char *undoname, ReportList
BKE_undosys_step_undo_with_data(wm->undo_stack, C, step_data_from_name);
}
else {
- BKE_undosys_step_undo_compat_only(wm->undo_stack, C, step);
+ if (step == 1) {
+ BKE_undosys_step_undo(wm->undo_stack, C);
+ }
+ else {
+ BKE_undosys_step_redo(wm->undo_stack, C);
+ }
}
/* Set special modes for grease pencil */
@@ -199,7 +200,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname, ReportList
Main *bmain = CTX_data_main(C);
scene = CTX_data_scene(C);
wm->op_undo_depth++;
- BLI_callback_exec(bmain, &scene->id, step_for_callback > 0 ? BLI_CB_EVT_UNDO_PRE : BLI_CB_EVT_REDO_PRE);
+ BLI_callback_exec(bmain, &scene->id, step_for_callback > 0 ? BLI_CB_EVT_UNDO_POST : BLI_CB_EVT_REDO_POST);
wm->op_undo_depth--;
}
@@ -273,6 +274,23 @@ bool ED_undo_is_valid(const bContext *C, const char *undoname)
return BKE_undosys_stack_has_undo(wm->undo_stack, undoname);
}
+bool ED_undo_is_memfile_compatible(const bContext *C)
+{
+ /* Some modes don't co-exist with memfile undo, disable their use: T60593
+ * (this matches 2.7x behavior). */
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ if (view_layer != NULL) {
+ Object *obact = OBACT(view_layer);
+ if (obact != NULL) {
+ if (obact->mode & (OB_MODE_SCULPT | OB_MODE_EDIT)) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+
/**
* Ideally we wont access the stack directly,
* this is needed for modes which handle undo themselves (bypassing #ED_undo_push).
@@ -306,6 +324,15 @@ static int ed_undo_exec(bContext *C, wmOperator *op)
static int ed_undo_push_exec(bContext *C, wmOperator *op)
{
+ if (G.background) {
+ /* Exception for background mode, see: T60934.
+ * Note: since the undo stack isn't initialized on startup, background mode behavior
+ * won't match regular usage, this is just for scripts to do explicit undo pushes. */
+ wmWindowManager *wm = CTX_wm_manager(C);
+ if (wm->undo_stack == NULL) {
+ wm->undo_stack = BKE_undosys_stack_create();
+ }
+ }
char str[BKE_UNDO_STR_MAX];
RNA_string_get(op->ptr, "message", str);
ED_undo_push(C, str);
@@ -334,11 +361,31 @@ static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op))
return ret;
}
+/* Disable in background mode, we could support if it's useful, T60934. */
+
+static bool ed_undo_is_init_poll(bContext *C)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ if (wm->undo_stack == NULL) {
+ CTX_wm_operator_poll_msg_set(C, "Undo disabled at startup");
+ return false;
+ }
+ return true;
+}
+
+static bool ed_undo_is_init_and_screenactive_poll(bContext *C)
+{
+ if (ed_undo_is_init_poll(C) == false) {
+ return false;
+ }
+ return ED_operator_screenactive(C);
+}
+
static bool ed_undo_redo_poll(bContext *C)
{
wmOperator *last_op = WM_operator_last_redo(C);
- return last_op && ED_operator_screenactive(C) &&
- WM_operator_check_ui_enabled(C, last_op->type->name);
+ return (last_op && ed_undo_is_init_and_screenactive_poll(C) &&
+ WM_operator_check_ui_enabled(C, last_op->type->name));
}
void ED_OT_undo(wmOperatorType *ot)
@@ -350,7 +397,7 @@ void ED_OT_undo(wmOperatorType *ot)
/* api callbacks */
ot->exec = ed_undo_exec;
- ot->poll = ED_operator_screenactive;
+ ot->poll = ed_undo_is_init_and_screenactive_poll;
}
void ED_OT_undo_push(wmOperatorType *ot)
@@ -362,6 +409,8 @@ void ED_OT_undo_push(wmOperatorType *ot)
/* api callbacks */
ot->exec = ed_undo_push_exec;
+ /* Unlike others undo operators this initializes undo stack. */
+ ot->poll = ED_operator_screenactive;
ot->flag = OPTYPE_INTERNAL;
@@ -377,7 +426,7 @@ void ED_OT_redo(wmOperatorType *ot)
/* api callbacks */
ot->exec = ed_redo_exec;
- ot->poll = ED_operator_screenactive;
+ ot->poll = ed_undo_is_init_and_screenactive_poll;
}
void ED_OT_undo_redo(wmOperatorType *ot)
@@ -588,7 +637,7 @@ void ED_OT_undo_history(wmOperatorType *ot)
/* api callbacks */
ot->invoke = undo_history_invoke;
ot->exec = undo_history_exec;
- ot->poll = ED_operator_screenactive;
+ ot->poll = ed_undo_is_init_and_screenactive_poll;
RNA_def_int(ot->srna, "item", 0, 0, INT_MAX, "Item", "", 0, INT_MAX);
@@ -615,4 +664,37 @@ void ED_undo_object_set_active_or_warn(ViewLayer *view_layer, Object *ob, const
}
}
+void ED_undo_object_editmode_restore_helper(
+ struct bContext *C, Object **object_array, uint object_array_len, uint object_array_stride)
+{
+ Main *bmain = CTX_data_main(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ uint bases_len = 0;
+ /* Don't request unique data because we wan't to de-select objects when exiting edit-mode
+ * for that to be done on all objects we can't skip ones that share data. */
+ Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(
+ view_layer, NULL, &bases_len);
+ for (uint i = 0; i < bases_len; i++) {
+ ((ID *)bases[i]->object->data)->tag |= LIB_TAG_DOIT;
+ }
+ Scene *scene = CTX_data_scene(C);
+ Object **ob_p = object_array;
+ for (uint i = 0; i < object_array_len; i++, ob_p = POINTER_OFFSET(ob_p, object_array_stride)) {
+ Object *obedit = *ob_p;
+ ED_object_editmode_enter_ex(bmain, scene, obedit, EM_NO_CONTEXT);
+ ((ID *)obedit->data)->tag &= ~LIB_TAG_DOIT;
+ }
+ for (uint i = 0; i < bases_len; i++) {
+ ID *id = bases[i]->object->data;
+ if (id->tag & LIB_TAG_DOIT) {
+ ED_object_editmode_exit_ex(bmain, scene, bases[i]->object, EM_FREEDATA);
+ /* Ideally we would know the selection state it was before entering edit-mode,
+ * for now follow the convention of having them unselected when exiting the mode. */
+ ED_object_base_select(bases[i], BA_DESELECT);
+
+ }
+ }
+ MEM_freeN(bases);
+}
+
/** \} */
diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c
index 4b38ab282a0..c6719f6433a 100644
--- a/source/blender/editors/undo/memfile_undo.c
+++ b/source/blender/editors/undo/memfile_undo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/undo/memfile_undo.c
- * \ingroup edundo
+/** \file
+ * \ingroup edundo
*
* Wrapper between 'ED_undo.h' and 'BKE_undo_system.h' API's.
*/
@@ -38,8 +34,7 @@
#include "ED_object.h"
#include "ED_undo.h"
-#include "ED_render.h"
-
+#include "ED_util.h"
#include "../blenloader/BLO_undofile.h"
@@ -54,22 +49,29 @@ typedef struct MemFileUndoStep {
MemFileUndoData *data;
} MemFileUndoStep;
-static bool memfile_undosys_poll(bContext *UNUSED(C))
+static bool memfile_undosys_poll(bContext *C)
{
/* other poll functions must run first, this is a catch-all. */
if ((U.uiflag & USER_GLOBALUNDO) == 0) {
return false;
}
+
+ /* Allow a single memfile undo step (the first). */
+ UndoStack *ustack = ED_undo_stack_get();
+ if ((ustack->step_active != NULL) &&
+ (ED_undo_is_memfile_compatible(C) == false))
+ {
+ return false;
+ }
return true;
}
-static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p)
+static bool memfile_undosys_step_encode(struct bContext *UNUSED(C), struct Main *bmain, UndoStep *us_p)
{
MemFileUndoStep *us = (MemFileUndoStep *)us_p;
/* Important we only use 'main' from the context (see: BKE_undosys_stack_init_from_main). */
- struct Main *bmain = CTX_data_main(C);
UndoStack *ustack = ED_undo_stack_get();
/* can be NULL, use when set. */
@@ -80,14 +82,30 @@ static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p)
return true;
}
-static void memfile_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UNUSED(dir))
+static void memfile_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir))
{
- /* Loading the content will correctly switch into compatible non-object modes. */
- ED_object_mode_exit(C);
+ ED_editors_exit(bmain, false);
MemFileUndoStep *us = (MemFileUndoStep *)us_p;
BKE_memfile_undo_decode(us->data, C);
+ for (UndoStep *us_iter = us_p->next; us_iter; us_iter = us_iter->next) {
+ if (BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(us_iter->type)) {
+ continue;
+ }
+ us_iter->is_applied = false;
+ }
+ for (UndoStep *us_iter = us_p; us_iter; us_iter = us_iter->prev) {
+ if (BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(us_iter->type)) {
+ continue;
+ }
+ us_iter->is_applied = true;
+ }
+
+ /* bmain has been freed. */
+ bmain = CTX_data_main(C);
+ ED_editors_init_for_undo(bmain);
+
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
}
@@ -115,7 +133,6 @@ void ED_memfile_undosys_type(UndoType *ut)
ut->step_decode = memfile_undosys_step_decode;
ut->step_free = memfile_undosys_step_free;
- ut->mode = BKE_UNDOTYPE_MODE_STORE;
ut->use_context = true;
ut->step_size = sizeof(MemFileUndoStep);
diff --git a/source/blender/editors/undo/undo_intern.h b/source/blender/editors/undo/undo_intern.h
index 03f9d248ba0..8184e7bfbdc 100644
--- a/source/blender/editors/undo/undo_intern.h
+++ b/source/blender/editors/undo/undo_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/undo/undo_intern.h
- * \ingroup edundo
+/** \file
+ * \ingroup edundo
*/
#ifndef __UNDO_INTERN_H__
diff --git a/source/blender/editors/undo/undo_system_types.c b/source/blender/editors/undo/undo_system_types.c
index 75c3d2cc1b7..0f052920993 100644
--- a/source/blender/editors/undo/undo_system_types.c
+++ b/source/blender/editors/undo/undo_system_types.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/undo/undo_system_types.c
- * \ingroup edundo
+/** \file
+ * \ingroup edundo
*/
#include <string.h>
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index 6bef0f77e1a..55298e5c4ab 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c
index 011e9fc008c..ccd35983551 100644
--- a/source/blender/editors/util/ed_transverts.c
+++ b/source/blender/editors/util/ed_transverts.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/util/ed_transverts.c
- * \ingroup edutil
+/** \file
+ * \ingroup edutil
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index b3ec0a4388f..e2405591141 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/util/ed_util.c
- * \ingroup edutil
+/** \file
+ * \ingroup edutil
*/
#include <stdlib.h>
@@ -46,9 +39,6 @@
#include "BLI_string.h"
#include "BLI_path_util.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
#include "BLT_translation.h"
#include "BKE_context.h"
@@ -62,6 +52,7 @@
#include "BKE_screen.h"
#include "BKE_undo_system.h"
#include "BKE_workspace.h"
+#include "BKE_material.h"
#include "ED_armature.h"
#include "ED_buttons.h"
@@ -88,89 +79,140 @@
/* ********* general editor util funcs, not BKE stuff please! ********* */
+void ED_editors_init_for_undo(Main *bmain)
+{
+ wmWindowManager *wm = bmain->wm.first;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ Base *base = BASACT(view_layer);
+ if (base != NULL) {
+ Object *ob = base->object;
+ if (ob->mode & OB_MODE_TEXTURE_PAINT) {
+ Scene *scene = WM_window_get_active_scene(win);
+
+ BKE_texpaint_slots_refresh_object(scene, ob);
+ BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ }
+ }
+ }
+}
+
void ED_editors_init(bContext *C)
{
+ struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
wmWindowManager *wm = CTX_wm_manager(C);
- if (wm->undo_stack == NULL) {
- wm->undo_stack = BKE_undosys_stack_create();
- }
-
/* This is called during initialization, so we don't want to store any reports */
ReportList *reports = CTX_wm_reports(C);
int reports_flag_prev = reports->flag & ~RPT_STORE;
SWAP(int, reports->flag, reports_flag_prev);
+ /* Don't do undo pushes when calling an operator. */
+ wm->op_undo_depth++;
+
/* 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. */
Object *obact = CTX_data_active_object(C);
if (obact != NULL) {
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
int mode = ob->mode;
-
if (mode == OB_MODE_OBJECT) {
- /* pass */
+ continue;
+ }
+ else if (BKE_object_has_mode_data(ob, mode)) {
+ continue;
}
- else if (!BKE_object_has_mode_data(ob, mode)) {
+ else if (ob->type == OB_GPENCIL) {
/* For multi-edit mode we may already have mode data.
- * (grease pencil does not need it)
- */
- if (ob->type != OB_GPENCIL) {
- ID *data = ob->data;
- ob->mode = OB_MODE_OBJECT;
- if ((ob->type == obact->type) && !ID_IS_LINKED(ob) && !(data && ID_IS_LINKED(data))) {
- if (mode == OB_MODE_EDIT) {
- ED_object_editmode_enter_ex(bmain, scene, ob, 0);
+ * (grease pencil does not need it) */
+ continue;
+ }
+
+ ID *ob_data = ob->data;
+ ob->mode = OB_MODE_OBJECT;
+ if ((ob->type == obact->type) &&
+ !ID_IS_LINKED(ob) &&
+ !(ob_data && ID_IS_LINKED(ob_data)))
+ {
+ if (mode == OB_MODE_EDIT) {
+ ED_object_editmode_enter_ex(bmain, scene, ob, 0);
+ }
+ else if (mode == OB_MODE_POSE) {
+ ED_object_posemode_enter_ex(bmain, ob);
+ }
+ else if (mode & OB_MODE_ALL_SCULPT) {
+ if (obact == ob) {
+ if (mode == OB_MODE_SCULPT) {
+ ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, reports);
}
- else if (mode == OB_MODE_POSE) {
- ED_object_posemode_enter_ex(bmain, ob);
+ else if (mode == OB_MODE_VERTEX_PAINT) {
+ ED_object_vpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
+ }
+ else if (mode == OB_MODE_WEIGHT_PAINT) {
+ ED_object_wpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
}
else {
- ED_object_mode_toggle(C, mode);
+ BLI_assert(0);
+ }
+ }
+ else {
+ /* Create data for non-active objects which need it for
+ * mode-switching but don't yet support multi-editing. */
+ if (mode & OB_MODE_ALL_SCULPT) {
+ ob->mode = mode;
+ BKE_object_sculpt_data_create(ob);
}
}
}
+ else {
+ /* TODO(campbell): avoid operator calls. */
+ if (obact == ob) {
+ ED_object_mode_toggle(C, mode);
+ }
+ }
}
}
}
+
/* image editor paint mode */
if (scene) {
ED_space_image_paint_update(bmain, wm, scene);
}
SWAP(int, reports->flag, reports_flag_prev);
+ wm->op_undo_depth--;
}
/* frees all editmode stuff */
-void ED_editors_exit(bContext *C)
+void ED_editors_exit(Main *bmain, bool do_undo_system)
{
- Main *bmain = CTX_data_main(C);
-
- if (!bmain)
+ if (!bmain) {
return;
+ }
/* frees all editmode undos */
- if (G_MAIN->wm.first) {
+ if (do_undo_system && G_MAIN->wm.first) {
wmWindowManager *wm = G_MAIN->wm.first;
- /* normally we don't check for NULL undo stack, do here since it may run in different context. */
+ /* normally we don't check for NULL undo stack,
+ * do here since it may run in different context. */
if (wm->undo_stack) {
BKE_undosys_stack_destroy(wm->undo_stack);
wm->undo_stack = NULL;
}
}
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh) {
- EDBM_mesh_free(me->edit_btmesh);
- MEM_freeN(me->edit_btmesh);
- me->edit_btmesh = NULL;
+ if (me->edit_mesh) {
+ EDBM_mesh_free(me->edit_mesh);
+ MEM_freeN(me->edit_mesh);
+ me->edit_mesh = NULL;
}
}
else if (ob->type == OB_ARMATURE) {
@@ -188,19 +230,19 @@ void ED_editors_exit(bContext *C)
/* flush any temp data from object editing to DNA before writing files,
* rendering, copying, etc. */
-bool ED_editors_flush_edits(const bContext *C, bool for_render)
+bool ED_editors_flush_edits(Main *bmain, bool for_render)
{
bool has_edited = false;
Object *ob;
- Main *bmain = CTX_data_main(C);
/* loop through all data to find edit mode or object mode, because during
* exiting we might not have a context for edit object and multiple sculpt
* objects can exist at the same time */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->mode & OB_MODE_SCULPT) {
/* Don't allow flushing while in the middle of a stroke (frees data in use).
- * Auto-save prevents this from happening but scripts may cause a flush on saving: T53986. */
+ * Auto-save prevents this from happening but scripts
+ * may cause a flush on saving: T53986. */
if ((ob->sculpt && ob->sculpt->cache) == 0) {
/* flush multires changes (for sculpt) */
multires_force_update(ob);
@@ -390,7 +432,8 @@ void ED_spacedata_id_remap(struct ScrArea *sa, struct SpaceLink *sl, ID *old_id,
static int ed_flush_edits_exec(bContext *C, wmOperator *UNUSED(op))
{
- ED_editors_flush_edits(C, false);
+ Main *bmain = CTX_data_main(C);
+ ED_editors_flush_edits(bmain, false);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/util/gizmo_utils.c b/source/blender/editors/util/gizmo_utils.c
index 6b150f93e38..002425b11b6 100644
--- a/source/blender/editors/util/gizmo_utils.c
+++ b/source/blender/editors/util/gizmo_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gizmo_utils.c
- * \ingroup edutil
+/** \file
+ * \ingroup edutil
*
* \name Generic Gizmo Utilities.
*/
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index 52cf1b2d708..aeb764f9960 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Jonathan Smith
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/util/numinput.c
- * \ingroup edutil
+/** \file
+ * \ingroup edutil
*/
#include "MEM_guardedalloc.h"
@@ -51,23 +45,30 @@
/* Numeric input which isn't allowing full numeric editing. */
#define USE_FAKE_EDIT
-/* NumInput.flag */
+/** #NumInput.flag
+ * (1 << 8) and below are reserved for public flags!
+ */
enum {
- /* (1 << 8) and below are reserved for public flags! */
- NUM_EDIT_FULL = (1 << 9), /* Enable full editing, with units and math operators support. */
+ /** Enable full editing, with units and math operators support. */
+ NUM_EDIT_FULL = (1 << 9),
#ifdef USE_FAKE_EDIT
- NUM_FAKE_EDITED = (1 << 10), /* Fake edited state (temp, avoids issue with backspace). */
+ /** Fake edited state (temp, avoids issue with backspace). */
+ NUM_FAKE_EDITED = (1 << 10),
#endif
};
/* NumInput.val_flag[] */
enum {
/* (1 << 8) and below are reserved for public flags! */
- NUM_EDITED = (1 << 9), /* User has edited this value somehow. */
- NUM_INVALID = (1 << 10), /* Current expression for this value is invalid. */
+ /** User has edited this value somehow. */
+ NUM_EDITED = (1 << 9),
+ /** Current expression for this value is invalid. */
+ NUM_INVALID = (1 << 10),
#ifdef USE_FAKE_EDIT
- NUM_NEGATE = (1 << 11), /* Current expression's result has to be negated. */
- NUM_INVERSE = (1 << 12), /* Current expression's result has to be inverted. */
+ /** Current expression's result has to be negated. */
+ NUM_NEGATE = (1 << 11),
+ /** Current expression's result has to be inverted. */
+ NUM_INVERSE = (1 << 12),
#endif
};
@@ -134,7 +135,8 @@ void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings)
n->unit_sys, n->unit_type[i], true, false);
}
- BLI_strncpy(before_cursor, n->str, n->str_cur + 1); /* +1 because of trailing '\0' */
+ /* +1 because of trailing '\0' */
+ BLI_strncpy(before_cursor, n->str, n->str_cur + 1);
BLI_snprintf(&str[j * ln], ln, "[%s%s|%s%s] = %s",
heading_exp, before_cursor, &n->str[n->str_cur], trailing_exp, val);
}
@@ -155,7 +157,8 @@ void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings)
const char *cur = (i == n->idx) ? "|" : "";
BLI_snprintf(&str[j * ln], ln, "%sNONE%s", cur, cur);
}
- /* We might have cut some multi-bytes utf8 chars (e.g. trailing '°' of degrees values can become only 'A')... */
+ /* We might have cut some multi-bytes utf8 chars
+ * (e.g. trailing '°' of degrees values can become only 'A')... */
BLI_utf8_invalid_strip(&str[j * ln], strlen(&str[j * ln]));
}
}
@@ -258,13 +261,7 @@ bool user_string_to_number(bContext *C, const char *str, const UnitSettings *uni
{
#ifdef WITH_PYTHON
double unit_scale = BKE_scene_unit_scale(unit, type, 1.0);
- if (!bUnit_ContainsUnit(str, unit->system, type)) {
- int success = BPY_execute_string_as_number(C, NULL, str, true, r_value);
- *r_value *= bUnit_PreferredUnitScalar(unit, type);
- *r_value /= unit_scale;
- return success;
- }
- else {
+ if (bUnit_ContainsUnit(str, type)) {
char str_unit_convert[256];
BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert));
bUnit_ReplaceString(
@@ -273,6 +270,12 @@ bool user_string_to_number(bContext *C, const char *str, const UnitSettings *uni
return BPY_execute_string_as_number(C, NULL, str_unit_convert, true, r_value);
}
+ else {
+ int success = BPY_execute_string_as_number(C, NULL, str, true, r_value);
+ *r_value *= bUnit_PreferredInputUnitScalar(unit, type);
+ *r_value /= unit_scale;
+ return success;
+ }
#else
*r_value = atof(str);
return true;
@@ -354,7 +357,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
updated = true;
break;
}
- /* Else, common behavior with DELKEY, only difference is remove char(s) before/after the cursor. */
+ /* Else, common behavior with DELKEY,
+ * only difference is remove char(s) before/after the cursor. */
dir = STRCUR_DIR_PREV;
ATTR_FALLTHROUGH;
case DELKEY:
@@ -369,7 +373,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
SWAP(int, t_cur, cur);
n->str_cur = cur;
}
- memmove(&n->str[cur], &n->str[t_cur], strlen(&n->str[t_cur]) + 1); /* +1 for trailing '\0'. */
+ /* +1 for trailing '\0'. */
+ memmove(&n->str[cur], &n->str[t_cur], strlen(&n->str[t_cur]) + 1);
updated = true;
}
if (!n->str[0]) {
@@ -423,7 +428,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
return true;
case PADPERIOD:
case PERIODKEY:
- /* Force numdot, some OSs/countries generate a comma char in this case, sic... (T37992) */
+ /* Force numdot, some OSs/countries generate a comma char in this case,
+ * sic... (T37992) */
ascii[0] = '.';
utf8_buf = ascii;
break;
@@ -542,7 +548,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
return false;
}
- /* At this point, our value has changed, try to interpret it with python (if str is not empty!). */
+ /* At this point, our value has changed, try to interpret it with python
+ * (if str is not empty!). */
if (n->str[0]) {
const float val_prev = n->val[idx];
Scene *sce = CTX_data_scene(C);
@@ -565,7 +572,8 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
}
if (n->val_flag[idx] & NUM_INVERSE) {
val = n->val[idx];
- /* If we invert on radians when user is in degrees, you get unexpected results... See T53463. */
+ /* If we invert on radians when user is in degrees,
+ * you get unexpected results... See T53463. */
if (!n->unit_use_radians && n->unit_type[idx] == B_UNIT_ROTATION) {
val = RAD2DEG(val);
}
diff --git a/source/blender/editors/util/select_utils.c b/source/blender/editors/util/select_utils.c
index 92de124800b..80b103e0c4b 100644
--- a/source/blender/editors/util/select_utils.c
+++ b/source/blender/editors/util/select_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file select_utils.c
- * \ingroup edutil
+/** \file
+ * \ingroup edutil
*/
#include "BLI_utildefines.h"
@@ -73,6 +69,19 @@ int ED_select_op_action_deselected(const eSelectOp sel_op, const bool is_select,
return -1;
}
+/**
+ * Utility to use for selection operations that run multiple times (circle select).
+ */
+eSelectOp ED_select_op_modal(const eSelectOp sel_op, const bool is_first)
+{
+ if (sel_op == SEL_OP_SET) {
+ if (is_first == false) {
+ return SEL_OP_ADD;
+ }
+ }
+ return sel_op;
+}
+
int ED_select_similar_compare_float(const float delta, const float thresh, const int compare)
{
switch (compare) {
diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt
index a933717fe98..c54c3851ee7 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c
index 4af46ffa610..6f8bfac8c57 100644
--- a/source/blender/editors/uvedit/uvedit_buttons.c
+++ b/source/blender/editors/uvedit/uvedit_buttons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_buttons.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
#include <string.h>
@@ -237,7 +231,7 @@ void ED_uvedit_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype image panel uv");
strcpy(pt->idname, "IMAGE_PT_uv");
- strcpy(pt->label, N_("UV Vertex")); /* XXX C panels are not available through RNA (bpy.types)! */
+ strcpy(pt->label, N_("UV Vertex")); /* XXX C panels unavailable through RNA bpy.types! */
pt->draw = image_panel_uv;
pt->poll = image_panel_uv_poll;
BLI_addtail(&art->paneltypes, pt);
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index dcdcc50db6e..8bc2be11934 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_draw.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
@@ -47,8 +41,6 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "BLI_buffer.h"
-#include "BLI_bitmap.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
@@ -57,8 +49,6 @@
#include "BKE_scene.h"
-#include "BIF_glutil.h"
-
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
@@ -79,10 +69,8 @@
#include "uvedit_intern.h"
-static int draw_uvs_face_check(Scene *scene)
+static int draw_uvs_face_check(const ToolSettings *ts)
{
- ToolSettings *ts = scene->toolsettings;
-
/* checks if we are selecting only faces */
if (ts->uv_flag & UV_SYNC_SELECTION) {
if (ts->selectmode == SCE_SELECT_FACE)
@@ -96,34 +84,6 @@ static int draw_uvs_face_check(Scene *scene)
return (ts->uv_selectmode == UV_SELECT_FACE);
}
-static uchar get_state(SpaceImage *sima, Scene *scene)
-{
- ToolSettings *ts = scene->toolsettings;
- int drawfaces = draw_uvs_face_check(scene);
- const bool draw_stretch = (sima->flag & SI_DRAW_STRETCH) != 0;
- uchar state = UVEDIT_EDGES | UVEDIT_DATA;
-
- if (drawfaces) {
- state |= UVEDIT_FACEDOTS;
- }
- if (draw_stretch || !(sima->flag & SI_NO_DRAWFACES)) {
- state |= UVEDIT_FACES;
-
- if (draw_stretch) {
- if (sima->dt_uvstretch == SI_UVDT_STRETCH_AREA) {
- state |= UVEDIT_STRETCH_AREA;
- }
- else {
- state |= UVEDIT_STRETCH_ANGLE;
- }
- }
- }
- if (ts->uv_flag & UV_SYNC_SELECTION) {
- state |= UVEDIT_SYNC_SEL;
- }
- return state;
-}
-
/* ------------------------- */
void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
@@ -192,20 +152,52 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
GPU_matrix_translate_2f(-cursor[0], -cursor[1]);
}
-static void draw_uvs_shadow(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *depsgraph)
+static void uvedit_get_batches(
+ Object *ob, SpaceImage *sima, const ToolSettings *ts,
+ GPUBatch **faces, GPUBatch **edges, GPUBatch **verts, GPUBatch **facedots)
+{
+ int drawfaces = draw_uvs_face_check(ts);
+ const bool draw_stretch = (sima->flag & SI_DRAW_STRETCH) != 0;
+ const bool draw_faces = (sima->flag & SI_NO_DRAWFACES) == 0;
+
+ *edges = DRW_mesh_batch_cache_get_edituv_edges(ob->data);
+ *verts = DRW_mesh_batch_cache_get_edituv_verts(ob->data);
+
+ if (drawfaces) {
+ *facedots = DRW_mesh_batch_cache_get_edituv_facedots(ob->data);
+ }
+ else {
+ *facedots = NULL;
+ }
+
+ if (draw_stretch && (sima->dt_uvstretch == SI_UVDT_STRETCH_AREA)) {
+ *faces = DRW_mesh_batch_cache_get_edituv_faces_strech_area(ob->data);
+ }
+ else if (draw_stretch) {
+ *faces = DRW_mesh_batch_cache_get_edituv_faces_strech_angle(ob->data);
+ }
+ else if (draw_faces) {
+ *faces = DRW_mesh_batch_cache_get_edituv_faces(ob->data);
+ }
+ else {
+ *faces = NULL;
+ }
+
+ DRW_mesh_batch_cache_create_requested(ob, ob->data, ts, false, false);
+}
+
+static void draw_uvs_shadow(SpaceImage *UNUSED(sima), Scene *scene, Object *obedit, Depsgraph *depsgraph)
{
Object *eval_ob = DEG_get_evaluated_object(depsgraph, obedit);
- GPUBatch *faces, *edges, *verts, *facedots;
- uchar state = UVEDIT_EDGES | UVEDIT_DATA;
+ Mesh *me = eval_ob->data;
float col[4];
UI_GetThemeColor4fv(TH_UV_SHADOW, col);
- DRW_mesh_cache_uvedit(
- eval_ob, sima, scene, state,
- &faces, &edges, &verts, &facedots);
+ GPUBatch *edges = DRW_mesh_batch_cache_get_uv_edges(me);
+ DRW_mesh_batch_cache_create_requested(eval_ob, me, scene->toolsettings, false, false);
if (edges) {
- GPU_batch_program_set_builtin(edges, GPU_SHADER_2D_UNIFORM_COLOR);
+ GPU_batch_program_set_builtin(edges, GPU_SHADER_2D_UV_UNIFORM_COLOR);
GPU_batch_uniform_4fv(edges, "color", col);
GPU_batch_draw(edges);
}
@@ -216,14 +208,17 @@ static void draw_uvs_texpaint(Scene *scene, Object *ob, Depsgraph *depsgraph)
Object *eval_ob = DEG_get_evaluated_object(depsgraph, ob);
Mesh *me = eval_ob->data;
ToolSettings *ts = scene->toolsettings;
- GPUBatch *geom = DRW_mesh_batch_cache_get_texpaint_loop_wire(me);
float col[4];
UI_GetThemeColor4fv(TH_UV_SHADOW, col);
- if (!geom)
+ if (me->mloopuv == NULL) {
return;
+ }
- GPU_batch_program_set_builtin(geom, GPU_SHADER_2D_UNIFORM_COLOR);
+ GPUBatch *geom = DRW_mesh_batch_cache_get_uv_edges(me);
+ DRW_mesh_batch_cache_create_requested(eval_ob, me, scene->toolsettings, false, false);
+
+ GPU_batch_program_set_builtin(geom, GPU_SHADER_2D_UV_UNIFORM_COLOR);
GPU_batch_uniform_4fv(geom, "color", col);
const bool do_material_masking = (ts->uv_flag & UV_SHOW_SAME_IMAGE);
@@ -268,12 +263,16 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
{
GPUBatch *faces, *edges, *verts, *facedots;
Object *eval_ob = DEG_get_evaluated_object(depsgraph, obedit);
- ToolSettings *ts = scene->toolsettings;
+ const ToolSettings *ts = scene->toolsettings;
float col1[4], col2[4], col3[4], transparent[4] = {0.0f, 0.0f, 0.0f, 0.0f};
if (sima->flag & SI_DRAWSHADOW) {
- /* XXX TODO: Need to check if shadow mesh is different than original mesh. */
- bool is_cage_like_final_meshes = true;
+ bool is_cage_like_final_meshes = false;
+ Mesh *me = (Mesh *)eval_ob->data;
+ BMEditMesh *embm = me->edit_mesh;
+ is_cage_like_final_meshes = embm &&
+ embm->mesh_eval_final &&
+ embm->mesh_eval_final->runtime.is_original;
/* When sync selection is enabled, all faces are drawn (except for hidden)
* so if cage is the same as the final, there is no point in drawing this. */
@@ -282,16 +281,15 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
}
}
- uchar state = get_state(sima, scene);
-
- DRW_mesh_cache_uvedit(
- eval_ob, sima, scene, state,
+ uvedit_get_batches(
+ eval_ob, sima, ts,
&faces, &edges, &verts, &facedots);
+
bool interpedges;
bool do_elem_order_fix = (ts->uv_flag & UV_SYNC_SELECTION) && (ts->selectmode & SCE_SELECT_FACE);
bool do_selected_edges = ((sima->flag & SI_NO_DRAWEDGES) == 0);
- bool draw_stretch = (state & (UVEDIT_STRETCH_AREA | UVEDIT_STRETCH_ANGLE)) != 0;
+ bool draw_stretch = (sima->flag & SI_DRAW_STRETCH) != 0;
if (ts->uv_flag & UV_SYNC_SELECTION) {
interpedges = (ts->selectmode & SCE_SELECT_VERTEX) != 0;
}
@@ -303,7 +301,9 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
if (faces) {
GPU_batch_program_set_builtin(faces, (draw_stretch)
- ? GPU_SHADER_2D_UV_FACES_STRETCH
+ ? (sima->dt_uvstretch == SI_UVDT_STRETCH_AREA)
+ ? GPU_SHADER_2D_UV_FACES_STRETCH_AREA
+ : GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE
: GPU_SHADER_2D_UV_FACES);
if (!draw_stretch) {
@@ -317,6 +317,11 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
GPU_batch_uniform_4fv(faces, "selectColor", col2);
GPU_batch_uniform_4fv(faces, "activeColor", col3);
}
+ else if (sima->dt_uvstretch == SI_UVDT_STRETCH_ANGLE) {
+ float asp[2];
+ ED_space_image_get_uv_aspect(sima, &asp[0], &asp[1]);
+ GPU_batch_uniform_2fv(faces, "aspect", asp);
+ }
GPU_batch_draw(faces);
@@ -369,7 +374,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
UI_GetThemeColor4fv(TH_WIRE_EDIT, col1);
UI_GetThemeColor4fv(TH_EDGE_SELECT, col2);
- /* We could modify the vbo's data filling instead of modifying the provoking vert. */
+ /* We could modify the vbo's data filling
+ * instead of modifying the provoking vert. */
glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);
GPU_line_width(1.0f);
diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index eed9d68f39c..5510549ba0e 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,32 +15,24 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_intern.h
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
#ifndef __UVEDIT_INTERN_H__
#define __UVEDIT_INTERN_H__
+struct BMEditMesh;
+struct BMFace;
+struct BMLoop;
struct Image;
struct Object;
struct Scene;
struct SpaceImage;
struct wmOperatorType;
-struct BMEditMesh;
-struct BMFace;
-struct BMLoop;
-
-/* visibility and selection */
-bool uvedit_face_visible_nolocal(struct Scene *scene, struct BMFace *efa);
/* geometric utilities */
void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index bb0c11b171b..ae532a8e5c7 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Antony Riakiotakis.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_ops.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
@@ -243,35 +235,38 @@ static void uvedit_vertex_select_tagged(BMEditMesh *em, Scene *scene, bool selec
}
}
-bool uvedit_face_visible_nolocal(Scene *scene, BMFace *efa)
+bool uvedit_face_visible_nolocal_ex(const ToolSettings *ts, BMFace *efa)
{
- ToolSettings *ts = scene->toolsettings;
-
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));
}
-
-bool uvedit_face_visible_test(Scene *scene, Object *obedit, Image *ima, BMFace *efa)
+bool uvedit_face_visible_nolocal(Scene *scene, BMFace *efa)
{
- ToolSettings *ts = scene->toolsettings;
+ return uvedit_face_visible_nolocal_ex(scene->toolsettings, efa);
+}
+bool uvedit_face_visible_test_ex(const ToolSettings *ts, Object *obedit, Image *ima, BMFace *efa)
+{
if (ts->uv_flag & UV_SHOW_SAME_IMAGE) {
Image *face_image;
ED_object_get_active_image(obedit, efa->mat_nr + 1, &face_image, NULL, NULL, NULL);
- return (face_image == ima) ? uvedit_face_visible_nolocal(scene, efa) : false;
+ return (face_image == ima) ? uvedit_face_visible_nolocal_ex(ts, efa) : false;
}
else {
- return uvedit_face_visible_nolocal(scene, efa);
+ return uvedit_face_visible_nolocal_ex(ts, efa);
}
}
+bool uvedit_face_visible_test(Scene *scene, Object *obedit, Image *ima, BMFace *efa)
+{
+ return uvedit_face_visible_test_ex(scene->toolsettings, obedit, ima, efa);
+}
-bool uvedit_face_select_test(
- Scene *scene, BMFace *efa,
+bool uvedit_face_select_test_ex(
+ const ToolSettings *ts, BMFace *efa,
const int cd_loop_uv_offset)
{
- ToolSettings *ts = scene->toolsettings;
if (ts->uv_flag & UV_SYNC_SELECTION) {
return (BM_elem_flag_test(efa, BM_ELEM_SELECT));
}
@@ -289,6 +284,10 @@ bool uvedit_face_select_test(
return true;
}
}
+bool uvedit_face_select_test(Scene *scene, BMFace *efa, const int cd_loop_uv_offset)
+{
+ return uvedit_face_select_test_ex(scene->toolsettings, efa, cd_loop_uv_offset);
+}
bool uvedit_face_select_set(
struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const bool select,
@@ -355,12 +354,10 @@ bool uvedit_face_select_disable(
return false;
}
-bool uvedit_edge_select_test(
- Scene *scene, BMLoop *l,
+bool uvedit_edge_select_test_ex(
+ const ToolSettings *ts, BMLoop *l,
const int cd_loop_uv_offset)
{
- ToolSettings *ts = scene->toolsettings;
-
if (ts->uv_flag & UV_SYNC_SELECTION) {
if (ts->selectmode & SCE_SELECT_FACE) {
return BM_elem_flag_test(l->f, BM_ELEM_SELECT);
@@ -382,6 +379,10 @@ bool uvedit_edge_select_test(
return (luv1->flag & MLOOPUV_VERTSEL) && (luv2->flag & MLOOPUV_VERTSEL);
}
}
+bool uvedit_edge_select_test(Scene *scene, BMLoop *l, const int cd_loop_uv_offset)
+{
+ return uvedit_edge_select_test_ex(scene->toolsettings, l, cd_loop_uv_offset);
+}
void uvedit_edge_select_set(
BMEditMesh *em, Scene *scene, BMLoop *l, const bool select,
@@ -456,12 +457,10 @@ void uvedit_edge_select_disable(
}
}
-bool uvedit_uv_select_test(
- Scene *scene, BMLoop *l,
+bool uvedit_uv_select_test_ex(
+ const ToolSettings *ts, BMLoop *l,
const int cd_loop_uv_offset)
{
- ToolSettings *ts = scene->toolsettings;
-
if (ts->uv_flag & UV_SYNC_SELECTION) {
if (ts->selectmode & SCE_SELECT_FACE)
return BM_elem_flag_test_bool(l->f, BM_ELEM_SELECT);
@@ -473,6 +472,10 @@ bool uvedit_uv_select_test(
return (luv->flag & MLOOPUV_VERTSEL) != 0;
}
}
+bool uvedit_uv_select_test(Scene *scene, BMLoop *l, const int cd_loop_uv_offset)
+{
+ return uvedit_uv_select_test_ex(scene->toolsettings, l, cd_loop_uv_offset);
+}
void uvedit_uv_select_set(
BMEditMesh *em, Scene *scene, BMLoop *l, const bool select,
@@ -1791,7 +1794,8 @@ static void UV_OT_align(wmOperatorType *ot)
"Automatically choose the axis on which there is most alignment already"},
{UV_ALIGN_X, "ALIGN_X", 0, "Align X", "Align UVs on X axis"},
{UV_ALIGN_Y, "ALIGN_Y", 0, "Align Y", "Align UVs on Y axis"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Align";
@@ -2328,7 +2332,9 @@ static int uv_mouse_select_multi(
UvNearestHit hit = UV_NEAREST_HIT_INIT;
int i, selectmode, sticky, sync, *hitv = NULL;
bool select = true;
- int flush = 0, hitlen = 0; /* 0 == don't flush, 1 == sel, -1 == desel; only use when selection sync is enabled */
+ /* 0 == don't flush, 1 == sel, -1 == desel; only use when selection sync is enabled */
+ int flush = 0;
+ int hitlen = 0;
float limit[2], **hituv = NULL;
/* notice 'limit' is the same no matter the zoom level, since this is like
@@ -2460,7 +2466,8 @@ static int uv_mouse_select_multi(
/* TODO(MULTI_EDIT): We only need to de-select non-active */
uv_select_all_perform_multi(scene, ima, objects, objects_len, SEL_DESELECT);
}
- /* Current behavior of 'extend' is actually toggling, so pass extend flag as 'toggle' here */
+ /* Current behavior of 'extend'
+ * is actually toggling, so pass extend flag as 'toggle' here */
uv_select_linked_multi(scene, ima, objects, objects_len, limit, &hit, false, false, extend, false);
}
else if (extend) {
@@ -3332,6 +3339,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
SpaceImage *sima = CTX_wm_space_image(C);
+ Image *ima = CTX_data_edit_image(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
ToolSettings *ts = scene->toolsettings;
@@ -3342,7 +3350,6 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
MLoopUV *luv;
int x, y, radius, width, height;
float zoomx, zoomy, offset[2], ellipse[2];
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
const bool use_face_center = (
(ts->uv_flag & UV_SYNC_SELECTION) ?
@@ -3369,6 +3376,14 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, ((View3D *)NULL), &objects_len);
+ const eSelectOp sel_op = ED_select_op_modal(
+ RNA_enum_get(op->ptr, "mode"), WM_gesture_is_modal_first(op->customdata));
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ uv_select_all_perform_multi(scene, ima, objects, objects_len, SEL_DESELECT);
+ changed_multi = true;
+ }
+
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
BMEditMesh *em = BKE_editmesh_from_object(obedit);
@@ -3447,7 +3462,8 @@ static void UV_OT_select_circle(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_circle_select(ot);
+ WM_operator_properties_gesture_circle(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/** \} */
@@ -3665,7 +3681,8 @@ static void UV_OT_snap_cursor(wmOperatorType *ot)
static const EnumPropertyItem target_items[] = {
{0, "PIXELS", 0, "Pixels", ""},
{1, "SELECTED", 0, "Selected", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Snap Cursor";
@@ -3898,7 +3915,8 @@ static void UV_OT_snap_selected(wmOperatorType *ot)
{1, "CURSOR", 0, "Cursor", ""},
{2, "CURSOR_OFFSET", 0, "Cursor (Offset)", ""},
{3, "ADJACENT_UNSELECTED", 0, "Adjacent Unselected", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
/* identifiers */
ot->name = "Snap Selection";
@@ -4105,9 +4123,9 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
if (ts->uv_flag & UV_SYNC_SELECTION) {
- EDBM_mesh_hide(em, swap);
- EDBM_update_generic(em, true, false);
-
+ if (EDBM_mesh_hide(em, swap)) {
+ EDBM_update_generic(em, true, false);
+ }
return OPERATOR_FINISHED;
}
@@ -4228,9 +4246,9 @@ static int uv_reveal_exec(bContext *C, wmOperator *op)
/* call the mesh function if we are in mesh sync sel */
if (ts->uv_flag & UV_SYNC_SELECTION) {
- EDBM_mesh_reveal(em, select);
- EDBM_update_generic(em, true, false);
-
+ if (EDBM_mesh_reveal(em, select)) {
+ EDBM_update_generic(em, true, false);
+ }
return OPERATOR_FINISHED;
}
if (use_face_center) {
@@ -4423,7 +4441,7 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index];
Mesh *me = (Mesh *)ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMesh *bm = em->bm;
UvVertMap *vmap;
@@ -4453,7 +4471,8 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
UvMapVert *mv1, *mvinit1, *mv2, *mvinit2, *mviter;
/* mv2cache stores the first of the list of coincident uv's for later comparison
- * mv2sep holds the last separator and is copied to mv2cache when a hit is first found */
+ * mv2sep holds the last separator and is copied to mv2cache
+ * when a hit is first found */
UvMapVert *mv2cache = NULL, *mv2sep = NULL;
mvinit1 = vmap->vert[BM_elem_index_get(editedge->v1)];
@@ -4564,10 +4583,12 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, ((View3D *)NULL), &objects_len);
+ bool changed = false;
+
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index];
Mesh *me = (Mesh *)ob->data;
- BMEditMesh *em = me->edit_btmesh;
+ BMEditMesh *em = me->edit_mesh;
BMesh *bm = em->bm;
if (synced_selection && (bm->totedgesel == 0)) {
@@ -4576,8 +4597,6 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *op)
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
- bool changed = false;
-
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_edge_select_test(scene, loop, cd_loop_uv_offset)) {
@@ -4588,14 +4607,15 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *op)
}
if (changed) {
- if (scene->toolsettings->edge_mode_live_unwrap) {
- ED_unwrap_lscm(scene, ob, false, false);
- }
-
DEG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
}
}
+
+ if (changed) {
+ ED_uvedit_live_unwrap(scene, objects, objects_len);
+ }
+
MEM_freeN(objects);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index ded4a4899c7..1a4e040472e 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,15 @@
* 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):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_parametrizer.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
-#include "BLI_alloca.h"
#include "BLI_memarena.h"
#include "BLI_math.h"
#include "BLI_rand.h"
@@ -72,7 +65,7 @@
#endif
typedef enum PBool {
P_TRUE = 1,
- P_FALSE = 0
+ P_FALSE = 0,
} PBool;
/* Special Purpose Hash */
@@ -92,11 +85,11 @@ typedef struct PHash {
-struct PVert;
+struct PChart;
struct PEdge;
struct PFace;
-struct PChart;
struct PHandle;
+struct PVert;
/* Simplices */
@@ -155,7 +148,7 @@ enum PVertFlag {
PVERT_SELECT = 2,
PVERT_INTERIOR = 4,
PVERT_COLLAPSE = 8,
- PVERT_SPLIT = 16
+ PVERT_SPLIT = 16,
};
enum PEdgeFlag {
@@ -167,7 +160,7 @@ enum PEdgeFlag {
PEDGE_FILLED = 32,
PEDGE_COLLAPSE = 64,
PEDGE_COLLAPSE_EDGE = 128,
- PEDGE_COLLAPSE_PAIR = 256
+ PEDGE_COLLAPSE_PAIR = 256,
};
/* for flipping faces */
@@ -176,7 +169,7 @@ enum PEdgeFlag {
enum PFaceFlag {
PFACE_CONNECTED = 1,
PFACE_FILLED = 2,
- PFACE_COLLAPSE = 4
+ PFACE_COLLAPSE = 4,
};
/* Chart */
@@ -208,14 +201,14 @@ typedef struct PChart {
} PChart;
enum PChartFlag {
- PCHART_HAS_PINS = 1
+ PCHART_HAS_PINS = 1,
};
enum PHandleState {
PHANDLE_STATE_ALLOCATED,
PHANDLE_STATE_CONSTRUCTED,
PHANDLE_STATE_LSCM,
- PHANDLE_STATE_STRETCH
+ PHANDLE_STATE_STRETCH,
};
typedef struct PHandle {
@@ -248,7 +241,7 @@ typedef struct PHandle {
static int PHashSizes[] = {
1, 3, 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, 268435459
+ 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459,
};
#define PHASH_hash(ph, item) (((uintptr_t) (item)) % ((unsigned int) (ph)->cursize))
@@ -4547,7 +4540,8 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate, bool ignore_p
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 */
+ * 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 */
margin = (margin * (float)area) * 0.1f;
unpacked = 0;
for (i = 0; i < phandle->ncharts; i++) {
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h
index 1930e0a9e8e..6724b568f57 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __UVEDIT_PARAMETRIZER_H__
#define __UVEDIT_PARAMETRIZER_H__
-/** \file blender/editors/uvedit/uvedit_parametrizer.h
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
#ifdef __cplusplus
@@ -37,7 +31,7 @@ typedef void ParamHandle; /* handle to a set of charts */
typedef intptr_t ParamKey; /* (hash) key for identifying verts and faces */
typedef enum ParamBool {
PARAM_TRUE = 1,
- PARAM_FALSE = 0
+ PARAM_FALSE = 0,
} ParamBool;
/* Chart construction:
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 4c8d8b77513..91167e247f4 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Antony Riakiotakis.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_smart_stitch.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
@@ -48,8 +40,6 @@
#include "BLT_translation.h"
-#include "BIF_gl.h"
-
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_mesh_mapping.h"
@@ -89,7 +79,8 @@ typedef struct StitchPreviewer {
unsigned int *uvs_per_polygon;
/*number of preview polygons */
unsigned int num_polys;
- /* preview data. These will be either the previewed vertices or edges depending on stitch mode settings */
+ /* preview data. These will be either the previewed vertices or edges
+ * depending on stitch mode settings */
float *preview_stitchable;
float *preview_unstitchable;
/* here we'll store the number of elements to be drawn */
@@ -134,16 +125,19 @@ typedef struct UVVertAverage {
} UVVertAverage;
typedef struct UvEdge {
- /* index to uv buffer */
+ /** index to uv buffer */
unsigned int uv1;
unsigned int uv2;
- /* general use flag (Used to check if edge is boundary here, and propagates to adjacency elements) */
+ /** general use flag
+ * (Used to check if edge is boundary here, and propagates to adjacency elements) */
unsigned char flag;
- /* element that guarantees element->face has the edge on element->tfindex and element->tfindex+1 is the second uv */
+ /** element that guarantees element->face
+ * has the edge on element->tfindex and element->tfindex+1 is the second uv */
UvElement *element;
- /* next uv edge with the same exact vertices as this one.. Calculated at startup to save time */
+ /** next uv edge with the same exact vertices as this one.
+ * Calculated at startup to save time */
struct UvEdge *next;
- /* point to first of common edges. Needed for iteration */
+ /** point to first of common edges. Needed for iteration */
struct UvEdge *first;
} UvEdge;
@@ -230,7 +224,7 @@ typedef struct PreviewPosition {
enum StitchModes {
STITCH_VERT,
- STITCH_EDGE
+ STITCH_EDGE,
};
/* UvElement identification. */
@@ -347,7 +341,8 @@ static void stitch_uv_rotate(float mat[2][2], float medianPoint[2], float uv[2],
uv[1] *= aspect;
}
-/* check if two uvelements are stitchable. This should only operate on -different- separate UvElements */
+/* check if two uvelements are stitchable.
+ * This should only operate on -different- separate UvElements */
static bool stitch_check_uvs_stitchable(
UvElement *element, UvElement *element_iter,
StitchStateContainer *ssc, StitchState *state)
@@ -566,8 +561,9 @@ static void stitch_island_calculate_edge_rotation(
index1 = edge->uv1;
index2 = edge->uv2;
}
- /* the idea here is to take the directions of the edges and find the rotation between final and initial
- * direction. This, using inner and outer vector products, gives the angle. Directions are differences so... */
+ /* the idea here is to take the directions of the edges and find the rotation between
+ * final and initial direction. This, using inner and outer vector products,
+ * gives the angle. Directions are differences so... */
uv1[0] = luv2->uv[0] - luv1->uv[0];
uv1[1] = luv2->uv[1] - luv1->uv[1];
@@ -770,7 +766,8 @@ static void stitch_uv_edge_generate_linked_edges(GHash *edge_hash, StitchState *
* I am not too sure we want this though */
last_set->next = edge2;
last_set = edge2;
- /* set first, similarly to uv elements. Now we can iterate among common edges easily */
+ /* set first, similarly to uv elements.
+ * Now we can iterate among common edges easily */
edge2->first = edge;
}
}
@@ -1063,7 +1060,8 @@ static int stitch_process_data(
while (!(island_stitch_data[ssc->static_island].stitchableCandidate)) {
ssc->static_island++;
ssc->static_island %= state->element_map->totalIslands;
- /* this is entirely possible if for example limit stitching with no stitchable verts or no selection */
+ /* this is entirely possible if for example limit stitching
+ * with no stitchable verts or no selection */
if (ssc->static_island == previous_island) {
break;
}
@@ -1219,7 +1217,8 @@ static int stitch_process_data(
/* copy data from MLoopUVs to the preview display buffers */
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
- /* just to test if face was added for processing. uvs of unselected vertices will return NULL */
+ /* just to test if face was added for processing.
+ * uvs of unselected vertices will return NULL */
UvElement *element = BM_uv_element_get(state->element_map, efa, BM_FACE_FIRST_LOOP(efa));
if (element) {
@@ -1366,7 +1365,8 @@ static int stitch_process_data(
}
}
- /* take mean position here. For edge case, this can't be done inside the loop for shared uvverts */
+ /* take mean position here.
+ * For edge case, this can't be done inside the loop for shared uvverts */
if (ssc->mode == STITCH_EDGE && stitch_midpoints) {
for (i = 0; i < state->total_separate_uvs; i++) {
final_position[i].uv[0] /= final_position[i].count;
@@ -1899,7 +1899,8 @@ static StitchState *stitch_init(
}
}
- /* explicitly set preview to NULL, to avoid deleting an invalid pointer on stitch_process_data */
+ /* explicitly set preview to NULL,
+ * to avoid deleting an invalid pointer on stitch_process_data */
state->stitch_preview = NULL;
/* Allocate the unique uv buffers */
state->uvs = MEM_mallocN(sizeof(*state->uvs) * counter, "uv_stitch_unique_uvs");
@@ -2493,9 +2494,9 @@ static StitchState *stitch_select(
if (ssc->mode == STITCH_VERT) {
if (uv_find_nearest_vert_multi(scene, ima, ssc->objects, ssc->objects_len, co, 0.0f, &hit)) {
- /* Add vertex to selection, deselect all common uv's of vert other
- * than selected and update the preview. This behavior was decided so that
- * you can do stuff like deselect the opposite stitchable vertex and the initial still gets deselected */
+ /* Add vertex to selection, deselect all common uv's of vert other than selected and
+ * update the preview. This behavior was decided so that you can do stuff like deselect
+ * the opposite stitchable vertex and the initial still gets deselected */
/* find StitchState from hit->ob */
StitchState *state = NULL;
@@ -2702,7 +2703,7 @@ void UV_OT_stitch(wmOperatorType *ot)
static const EnumPropertyItem stitch_modes[] = {
{STITCH_VERT, "VERTEX", 0, "Vertex", ""},
{STITCH_EDGE, "EDGE", 0, "Edge", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 6c818a6a75e..19925c2fcd7 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/uvedit/uvedit_unwrap_ops.c
- * \ingroup eduv
+/** \file
+ * \ingroup eduv
*/
@@ -119,7 +111,7 @@ static bool ED_uvedit_ensure_uvs(bContext *C, Scene *UNUSED(scene), Object *obed
return 1;
if (em && em->bm->totface && !CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV))
- ED_mesh_uv_texture_add(obedit->data, NULL, true);
+ ED_mesh_uv_texture_add(obedit->data, NULL, true, true);
if (!ED_uvedit_test(obedit))
return 0;
@@ -164,7 +156,14 @@ static bool ED_uvedit_ensure_uvs(bContext *C, Scene *UNUSED(scene), Object *obed
/****************** Parametrizer Conversion ***************/
-static bool uvedit_have_selection(Scene *scene, BMEditMesh *em, bool implicit)
+typedef struct UnwrapOptions {
+ bool topology_from_uvs; /* Connectivity based on UV coordinates instead of seams. */
+ bool only_selected; /* Only affect selected faces. */
+ bool fill_holes; /* Fill holes to better preserve shape. */
+ bool correct_aspect; /* Correct for mapped image texture aspect ratio. */
+} UnwrapOptions;
+
+static bool uvedit_have_selection(Scene *scene, BMEditMesh *em, const UnwrapOptions *options)
{
BMFace *efa;
BMLoop *l;
@@ -190,7 +189,7 @@ static bool uvedit_have_selection(Scene *scene, BMEditMesh *em, bool implicit)
break;
}
- if (implicit && !l)
+ if (options->topology_from_uvs && !l)
continue;
return true;
@@ -200,13 +199,14 @@ static bool uvedit_have_selection(Scene *scene, BMEditMesh *em, bool implicit)
}
static bool uvedit_have_selection_multi(
- Scene *scene, Object **objects, const uint objects_len, bool implicit)
+ Scene *scene, Object **objects, const uint objects_len,
+ const UnwrapOptions *options)
{
bool have_select = false;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
BMEditMesh *em = BKE_editmesh_from_object(obedit);
- if (uvedit_have_selection(scene, em, implicit)) {
+ if (uvedit_have_selection(scene, em, options)) {
have_select = true;
break;
}
@@ -268,8 +268,7 @@ static void construct_param_handle_face_add(ParamHandle *handle, Scene *scene,
/* See: construct_param_handle_multi to handle multiple objects at once. */
static ParamHandle *construct_param_handle(
Scene *scene, Object *ob, BMesh *bm,
- const bool implicit, const bool fill, const bool sel,
- const bool correct_aspect)
+ const UnwrapOptions *options)
{
ParamHandle *handle;
BMFace *efa;
@@ -282,7 +281,7 @@ static ParamHandle *construct_param_handle(
handle = param_construct_begin();
- if (correct_aspect) {
+ if (options->correct_aspect) {
float aspx, aspy;
ED_uvedit_get_aspect(scene, ob, bm, &aspx, &aspy);
@@ -296,11 +295,13 @@ static ParamHandle *construct_param_handle(
BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) {
- 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)) ||
+ (options->only_selected && BM_elem_flag_test(efa, BM_ELEM_SELECT) == 0))
+ {
continue;
}
- if (implicit) {
+ if (options->topology_from_uvs) {
bool is_loopsel = false;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
@@ -317,7 +318,7 @@ static ParamHandle *construct_param_handle(
construct_param_handle_face_add(handle, scene, efa, i, cd_loop_uv_offset);
}
- if (!implicit) {
+ if (!options->topology_from_uvs) {
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, BM_ELEM_SEAM)) {
ParamKey vkeys[2];
@@ -328,7 +329,7 @@ static ParamHandle *construct_param_handle(
}
}
- param_construct_end(handle, fill, implicit);
+ param_construct_end(handle, options->fill_holes, options->topology_from_uvs);
return handle;
}
@@ -338,8 +339,7 @@ static ParamHandle *construct_param_handle(
*/
static ParamHandle *construct_param_handle_multi(
Scene *scene, Object **objects, const uint objects_len,
- const bool implicit, const bool fill, const bool sel,
- const bool correct_aspect)
+ const UnwrapOptions *options)
{
ParamHandle *handle;
BMFace *efa;
@@ -348,10 +348,9 @@ static ParamHandle *construct_param_handle_multi(
BMIter iter, liter;
int i;
-
handle = param_construct_begin();
- if (correct_aspect) {
+ if (options->correct_aspect) {
Object *ob = objects[0];
BMEditMesh *em = BKE_editmesh_from_object(ob);
BMesh *bm = em->bm;
@@ -377,11 +376,13 @@ static ParamHandle *construct_param_handle_multi(
BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) {
- 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)) ||
+ (options->only_selected && BM_elem_flag_test(efa, BM_ELEM_SELECT) == 0))
+ {
continue;
}
- if (implicit) {
+ if (options->topology_from_uvs) {
bool is_loopsel = false;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
@@ -398,7 +399,7 @@ static ParamHandle *construct_param_handle_multi(
construct_param_handle_face_add(handle, scene, efa, i + offset, cd_loop_uv_offset);
}
- if (!implicit) {
+ if (!options->topology_from_uvs) {
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(eed, BM_ELEM_SEAM)) {
ParamKey vkeys[2];
@@ -411,7 +412,7 @@ static ParamHandle *construct_param_handle_multi(
offset += bm->totface;
}
- param_construct_end(handle, fill, implicit);
+ param_construct_end(handle, options->fill_holes, options->topology_from_uvs);
return handle;
}
@@ -444,7 +445,7 @@ static void texface_from_original_index(BMFace *efa, int index, float **uv, Para
/* unwrap handle initialization for subsurf aware-unwrapper. The many modifications required to make the original function(see above)
* work justified the existence of a new function. */
-static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, BMEditMesh *em, short fill, short sel, short correct_aspect)
+static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, BMEditMesh *em, const UnwrapOptions *options)
{
ParamHandle *handle;
/* index pointers */
@@ -470,7 +471,8 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
/* number of vertices and faces for subsurfed mesh*/
int numOfEdges, numOfFaces;
- /* holds a map to editfaces for every subsurfed MFace. These will be used to get hidden/ selected flags etc. */
+ /* holds a map to editfaces for every subsurfed MFace.
+ * These will be used to get hidden/ selected flags etc. */
BMFace **faceMap;
/* similar to the above, we need a way to map edges to their original ones */
BMEdge **edgeMap;
@@ -479,7 +481,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
handle = param_construct_begin();
- if (correct_aspect) {
+ if (options->correct_aspect) {
float aspx, aspy;
ED_uvedit_get_aspect(scene, ob, em->bm, &aspx, &aspy);
@@ -545,8 +547,11 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
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) ||
+ (options->only_selected && !BM_elem_flag_test(origFace, BM_ELEM_SELECT)))
+ {
continue;
+ }
}
mloop = &subsurfedLoops[mpoly->loopstart];
@@ -584,7 +589,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
}
}
- param_construct_end(handle, fill, 0);
+ param_construct_end(handle, options->fill_holes, options->topology_from_uvs);
/* cleanup */
MEM_freeN(faceMap);
@@ -612,26 +617,29 @@ static bool minimize_stretch_init(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- MinStretch *ms;
- const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
- bool implicit = true;
+ const UnwrapOptions options = {
+ .topology_from_uvs = true,
+ .fill_holes = RNA_boolean_get(op->ptr, "fill_holes"),
+ .only_selected = true,
+ .correct_aspect = true,
+ };
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, CTX_wm_view3d(C), &objects_len);
- if (!uvedit_have_selection_multi(scene, objects, objects_len, implicit)) {
+ if (!uvedit_have_selection_multi(scene, objects, objects_len, &options)) {
MEM_freeN(objects);
return false;
}
- ms = MEM_callocN(sizeof(MinStretch), "MinStretch");
+ MinStretch *ms = MEM_callocN(sizeof(MinStretch), "MinStretch");
ms->scene = scene;
ms->objects_edit = objects;
ms->objects_len = objects_len;
ms->blend = RNA_float_get(op->ptr, "blend");
ms->iterations = RNA_int_get(op->ptr, "iterations");
ms->i = 0;
- ms->handle = construct_param_handle_multi(scene, objects, objects_len, implicit, fill_holes, true, true);
+ ms->handle = construct_param_handle_multi(scene, objects, objects_len, &options);
ms->lasttime = PIL_check_seconds_timer();
param_stretch_begin(ms->handle);
@@ -678,7 +686,7 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, bool interac
continue;
}
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
}
@@ -714,7 +722,7 @@ static void minimize_stretch_exit(bContext *C, wmOperator *op, bool cancel)
continue;
}
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
@@ -837,38 +845,61 @@ void UV_OT_minimize_stretch(wmOperatorType *ot)
/* ******************** Pack Islands operator **************** */
-
static void uvedit_pack_islands(Scene *scene, Object *ob, BMesh *bm)
{
+ const UnwrapOptions options = {
+ .topology_from_uvs = true,
+ .only_selected = false,
+ .fill_holes = false,
+ .correct_aspect = false,
+ };
+
+ bool rotate = true;
+ bool ignore_pinned = false;
+
ParamHandle *handle;
- handle = construct_param_handle(scene, ob, bm, true, false, false, false);
- param_pack(handle, scene->toolsettings->uvcalc_margin, true, false);
+ handle = construct_param_handle(scene, ob, bm, &options);
+ param_pack(handle, scene->toolsettings->uvcalc_margin, rotate, ignore_pinned);
param_flush(handle);
param_delete(handle);
}
static void uvedit_pack_islands_multi(
Scene *scene, Object **objects, const uint objects_len,
- bool do_rotate, bool implicit, bool ignore_pinned)
+ const UnwrapOptions *options, bool rotate, bool ignore_pinned)
{
ParamHandle *handle;
- handle = construct_param_handle_multi(
- scene, objects, objects_len, implicit, false, true, true);
- param_pack(handle, scene->toolsettings->uvcalc_margin, do_rotate, ignore_pinned);
+ handle = construct_param_handle_multi(scene, objects, objects_len, options);
+ param_pack(handle, scene->toolsettings->uvcalc_margin, rotate, ignore_pinned);
param_flush(handle);
param_delete(handle);
+
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object *obedit = objects[ob_index];
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data);
+ }
}
static int pack_islands_exec(bContext *C, wmOperator *op)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
Scene *scene = CTX_data_scene(C);
- bool do_rotate = RNA_boolean_get(op->ptr, "rotate");
+
+ const UnwrapOptions options = {
+ .topology_from_uvs = true,
+ .only_selected = true,
+ .fill_holes = false,
+ .correct_aspect = true,
+ };
+
+ bool rotate = RNA_boolean_get(op->ptr, "rotate");
+ bool ignore_pinned = false;
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, CTX_wm_view3d(C), &objects_len);
- if (!uvedit_have_selection_multi(scene, objects, objects_len, true)) {
+ if (!uvedit_have_selection_multi(scene, objects, objects_len, &options)) {
MEM_freeN(objects);
return OPERATOR_CANCELLED;
}
@@ -878,13 +909,7 @@ static int pack_islands_exec(bContext *C, wmOperator *op)
else
RNA_float_set(op->ptr, "margin", scene->toolsettings->uvcalc_margin);
- uvedit_pack_islands_multi(scene, objects, objects_len, do_rotate, true, false);
-
- for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
- Object *obedit = objects[ob_index];
- DEG_id_tag_update(obedit->data, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
- }
+ uvedit_pack_islands_multi(scene, objects, objects_len, &options, rotate, ignore_pinned);
MEM_freeN(objects);
@@ -917,18 +942,23 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
ViewLayer *view_layer = CTX_data_view_layer(C);
ToolSettings *ts = scene->toolsettings;
const bool synced_selection = (ts->uv_flag & UV_SYNC_SELECTION) != 0;
- const bool implicit = true;
- ParamHandle *handle;
+
+ const UnwrapOptions options = {
+ .topology_from_uvs = true,
+ .only_selected = true,
+ .fill_holes = false,
+ .correct_aspect = true,
+ };
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(view_layer, CTX_wm_view3d(C), &objects_len);
- if (!uvedit_have_selection_multi(scene, objects, objects_len, implicit)) {
+ if (!uvedit_have_selection_multi(scene, objects, objects_len, &options)) {
MEM_freeN(objects);
return OPERATOR_CANCELLED;
}
- handle = construct_param_handle_multi(scene, objects, objects_len, implicit, false, true, true);
+ ParamHandle *handle = construct_param_handle_multi(scene, objects, objects_len, &options);
param_average(handle, false);
param_flush(handle);
param_delete(handle);
@@ -941,7 +971,7 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
continue;
}
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
MEM_freeN(objects);
@@ -974,7 +1004,6 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
ParamHandle *handle = NULL;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
const bool abf = (scene->toolsettings->unwrapper == 0);
- const bool fillholes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0;
bool use_subsurf;
modifier_unwrap_state(obedit, scene, &use_subsurf);
@@ -983,10 +1012,17 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
return;
}
+ const UnwrapOptions options = {
+ .topology_from_uvs = false,
+ .only_selected = false,
+ .fill_holes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0,
+ .correct_aspect = (scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT) == 0,
+ };
+
if (use_subsurf)
- handle = construct_param_handle_subsurfed(scene, obedit, em, fillholes, false, true);
+ handle = construct_param_handle_subsurfed(scene, obedit, em, &options);
else
- handle = construct_param_handle(scene, obedit, em->bm, false, fillholes, false, true);
+ handle = construct_param_handle(scene, obedit, em->bm, &options);
param_lscm_begin(handle, PARAM_TRUE, abf);
@@ -1030,17 +1066,6 @@ void ED_uvedit_live_unwrap_end(short cancel)
}
}
-void ED_uvedit_live_unwrap(Scene *scene, Object *obedit)
-{
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
-
- if (scene->toolsettings->edge_mode_live_unwrap &&
- CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV))
- {
- ED_unwrap_lscm(scene, obedit, false, false); /* unwrap all not just sel */
- }
-}
-
/*************** UV Map Common Transforms *****************/
#define VIEW_ON_EQUATOR 0
@@ -1225,12 +1250,12 @@ static void uv_transform_properties(wmOperatorType *ot, int radius)
{VIEW_ON_EQUATOR, "VIEW_ON_EQUATOR", 0, "View on Equator", "3D view is on the equator"},
{VIEW_ON_POLES, "VIEW_ON_POLES", 0, "View on Poles", "3D view is on the poles"},
{ALIGN_TO_OBJECT, "ALIGN_TO_OBJECT", 0, "Align to Object", "Align according to object transform"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem align_items[] = {
{POLAR_ZX, "POLAR_ZX", 0, "Polar ZX", "Polar 0 is X"},
{POLAR_ZY, "POLAR_ZY", 0, "Polar ZY", "Polar 0 is Y"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_enum(ot->srna, "direction", direction_items, VIEW_ON_EQUATOR, "Direction",
@@ -1385,22 +1410,22 @@ static void uv_map_clip_correct(Scene *scene, Object *ob, wmOperator *op)
/* ******************** Unwrap operator **************** */
-/* assumes UV Map is checked, doesn't run update funcs */
-void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel, const bool pack)
+/* Assumes UV Map exists, doesn't run update funcs. */
+static void uvedit_unwrap(Scene *scene, Object *obedit, const UnwrapOptions *options)
{
BMEditMesh *em = BKE_editmesh_from_object(obedit);
- ParamHandle *handle;
+ if (!CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV)) {
+ return;
+ }
- const bool fill_holes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0;
- const bool correct_aspect = (scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT) == 0;
bool use_subsurf;
-
modifier_unwrap_state(obedit, scene, &use_subsurf);
+ ParamHandle *handle;
if (use_subsurf)
- handle = construct_param_handle_subsurfed(scene, obedit, em, fill_holes, sel, correct_aspect);
+ handle = construct_param_handle_subsurfed(scene, obedit, em, options);
else
- handle = construct_param_handle(scene, obedit, em->bm, false, fill_holes, sel, correct_aspect);
+ handle = construct_param_handle(scene, obedit, em->bm, options);
param_lscm_begin(handle, PARAM_FALSE, scene->toolsettings->unwrapper == 0);
param_lscm_solve(handle);
@@ -1408,15 +1433,39 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel, const bool pa
param_average(handle, true);
- if (pack) {
- param_pack(handle, scene->toolsettings->uvcalc_margin, false, true);
- }
-
param_flush(handle);
param_delete(handle);
}
+static void uvedit_unwrap_multi(Scene *scene, Object **objects, const int objects_len, const UnwrapOptions *options)
+{
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object *obedit = objects[ob_index];
+ uvedit_unwrap(scene, obedit, options);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data);
+ }
+}
+
+void ED_uvedit_live_unwrap(Scene *scene, Object **objects, int objects_len)
+{
+ if (scene->toolsettings->edge_mode_live_unwrap) {
+ const UnwrapOptions options = {
+ .topology_from_uvs = false,
+ .only_selected = false,
+ .fill_holes = (scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0,
+ .correct_aspect = (scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT) == 0,
+ };
+
+ bool rotate = true;
+ bool ignore_pinned = true;
+
+ uvedit_unwrap_multi(scene, objects, objects_len, &options);
+ uvedit_pack_islands_multi(scene, objects, objects_len, &options, rotate, ignore_pinned);
+ }
+}
+
enum {
UNWRAP_ERROR_NONUNIFORM = (1 << 0),
UNWRAP_ERROR_NEGATIVE = (1 << 1),
@@ -1427,18 +1476,26 @@ static int unwrap_exec(bContext *C, wmOperator *op)
ViewLayer *view_layer = CTX_data_view_layer(C);
Scene *scene = CTX_data_scene(C);
int method = RNA_enum_get(op->ptr, "method");
- const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
- const bool correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect");
const bool use_subsurf = RNA_boolean_get(op->ptr, "use_subsurf_data");
- bool implicit = false;
int reported_errors = 0;
- /* We will report an error unless at least one object has the subsurf modifier in the right place. */
+ /* We will report an error unless at least one object
+ * has the subsurf modifier in the right place. */
bool subsurf_error = use_subsurf;
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, CTX_wm_view3d(C), &objects_len);
- if (!uvedit_have_selection_multi(scene, objects, objects_len, implicit)) {
+ const UnwrapOptions options = {
+ .topology_from_uvs = false,
+ .only_selected = true,
+ .fill_holes = RNA_boolean_get(op->ptr, "fill_holes"),
+ .correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect"),
+ };
+
+ bool rotate = true;
+ bool ignore_pinned = true;
+
+ if (!uvedit_have_selection_multi(scene, objects, objects_len, &options)) {
MEM_freeN(objects);
return OPERATOR_CANCELLED;
}
@@ -1454,7 +1511,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
}
if (subsurf_error) {
- /* Double up the check here but better keep ED_unwrap_lscm interface simple and not
+ /* Double up the check here but better keep uvedit_unwrap interface simple and not
* pass operator for warning append. */
modifier_unwrap_state(obedit, scene, &use_subsurf_final);
if (use_subsurf_final) {
@@ -1499,24 +1556,18 @@ static int unwrap_exec(bContext *C, wmOperator *op)
else
RNA_float_set(op->ptr, "margin", scene->toolsettings->uvcalc_margin);
- if (fill_holes) scene->toolsettings->uvcalc_flag |= UVCALC_FILLHOLES;
+ if (options.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 (options.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;
else scene->toolsettings->uvcalc_flag &= ~UVCALC_USESUBSURF;
/* execute unwrap */
- for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
- Object *obedit = objects[ob_index];
- ED_unwrap_lscm(scene, obedit, true, false);
- DEG_id_tag_update(obedit->data, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
- }
-
- uvedit_pack_islands_multi(scene, objects, objects_len, true, implicit, true);
+ uvedit_unwrap_multi(scene, objects, objects_len, &options);
+ uvedit_pack_islands_multi(scene, objects, objects_len, &options, rotate, ignore_pinned);
MEM_freeN(objects);
@@ -1528,7 +1579,7 @@ void UV_OT_unwrap(wmOperatorType *ot)
static const EnumPropertyItem method_items[] = {
{0, "ANGLE_BASED", 0, "Angle Based", ""},
{1, "CONFORMAL", 0, "Conformal", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* identifiers */
@@ -1670,7 +1721,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
if (changed) {
changed_multi = true;
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
else {
@@ -1752,7 +1803,7 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
ED_mesh_uv_loop_reset(C, me);
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
MEM_freeN(objects);
@@ -1865,7 +1916,7 @@ static int sphere_project_exec(bContext *C, wmOperator *op)
uv_map_clip_correct(scene, obedit, op);
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
MEM_freeN(objects);
@@ -1953,7 +2004,7 @@ static int cylinder_project_exec(bContext *C, wmOperator *op)
uv_map_clip_correct(scene, obedit, op);
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
MEM_freeN(objects);
@@ -2070,7 +2121,7 @@ static int cube_project_exec(bContext *C, wmOperator *op)
uv_map_clip_correct(scene, obedit, op);
- DEG_id_tag_update(obedit->data, 0);
+ DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}
MEM_freeN(objects);
@@ -2107,7 +2158,8 @@ void ED_uvedit_add_simple_uvs(Main *bmain, Scene *scene, Object *ob)
&bm_mesh_allocsize_default,
&((struct BMeshCreateParams){.use_toolflags = false,}));
- /* turn sync selection off, since we are not in edit mode we need to ensure only the uv flags are tested */
+ /* turn sync selection off,
+ * since we are not in edit mode we need to ensure only the uv flags are tested */
scene->toolsettings->uv_flag &= ~UV_SYNC_SELECTION;
ED_mesh_uv_texture_ensure(me, NULL);
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt
index 183eaf595ed..edab13d4286 100644
--- a/source/blender/freestyle/CMakeLists.txt
+++ b/source/blender/freestyle/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(SRC
@@ -392,12 +387,12 @@ set(SRC
intern/scene_graph/NodeGroup.h
intern/scene_graph/NodeLight.cpp
intern/scene_graph/NodeLight.h
- intern/scene_graph/NodeViewLayer.cpp
- intern/scene_graph/NodeViewLayer.h
intern/scene_graph/NodeShape.cpp
intern/scene_graph/NodeShape.h
intern/scene_graph/NodeTransform.cpp
intern/scene_graph/NodeTransform.h
+ intern/scene_graph/NodeViewLayer.cpp
+ intern/scene_graph/NodeViewLayer.h
intern/scene_graph/OrientedLineRep.cpp
intern/scene_graph/OrientedLineRep.h
intern/scene_graph/Rep.cpp
diff --git a/source/blender/freestyle/FRS_freestyle.h b/source/blender/freestyle/FRS_freestyle.h
index 5757fcc9294..c06e1b11b84 100644
--- a/source/blender/freestyle/FRS_freestyle.h
+++ b/source/blender/freestyle/FRS_freestyle.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,26 +12,24 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FRS_FREESTYLE_H__
#define __FRS_FREESTYLE_H__
-/** \file blender/freestyle/FRS_freestyle.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifdef __cplusplus
extern "C" {
#endif
-struct Render;
-struct RenderLayer;
-struct Material;
struct FreestyleConfig;
struct FreestyleLineStyle;
+struct Material;
+struct Render;
+struct RenderLayer;
struct FreestyleGlobals {
struct Scene *scene;
diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp
index aca725a0384..7097dd80128 100644
--- a/source/blender/freestyle/intern/application/AppCanvas.cpp
+++ b/source/blender/freestyle/intern/application/AppCanvas.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/application/AppCanvas.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "Controller.h"
diff --git a/source/blender/freestyle/intern/application/AppCanvas.h b/source/blender/freestyle/intern/application/AppCanvas.h
index ed473e22489..e891a661606 100644
--- a/source/blender/freestyle/intern/application/AppCanvas.h
+++ b/source/blender/freestyle/intern/application/AppCanvas.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __APPCANVAS_H__
#define __APPCANVAS_H__
-/** \file blender/freestyle/intern/application/AppCanvas.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "../stroke/Canvas.h"
diff --git a/source/blender/freestyle/intern/application/AppConfig.cpp b/source/blender/freestyle/intern/application/AppConfig.cpp
index 44f8e9b135e..20d8c68ef0e 100644
--- a/source/blender/freestyle/intern/application/AppConfig.cpp
+++ b/source/blender/freestyle/intern/application/AppConfig.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/application/AppConfig.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "AppConfig.h"
diff --git a/source/blender/freestyle/intern/application/AppConfig.h b/source/blender/freestyle/intern/application/AppConfig.h
index d7572aa1a04..c9eeca457eb 100644
--- a/source/blender/freestyle/intern/application/AppConfig.h
+++ b/source/blender/freestyle/intern/application/AppConfig.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __APP_CONFIG_H__
#define __APP_CONFIG_H__
-/** \file blender/freestyle/intern/application/AppConfig.h
- * \ingroup freestyle
- * \brief Configuration file
- * \author Emmanuel Turquin
- * \date 26/02/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Configuration file
*/
#include <string>
diff --git a/source/blender/freestyle/intern/application/AppView.cpp b/source/blender/freestyle/intern/application/AppView.cpp
index 9b1b02c8ee2..12b4f3db93a 100644
--- a/source/blender/freestyle/intern/application/AppView.cpp
+++ b/source/blender/freestyle/intern/application/AppView.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/application/AppView.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include <iostream>
diff --git a/source/blender/freestyle/intern/application/AppView.h b/source/blender/freestyle/intern/application/AppView.h
index 6338ace53c0..3939d96cf16 100644
--- a/source/blender/freestyle/intern/application/AppView.h
+++ b/source/blender/freestyle/intern/application/AppView.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __APPVIEW_H__
#define __APPVIEW_H__
-/** \file blender/freestyle/intern/application/AppView.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "AppConfig.h"
diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp
index 5ae04698a73..bd02b3378d1 100644
--- a/source/blender/freestyle/intern/application/Controller.cpp
+++ b/source/blender/freestyle/intern/application/Controller.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/application/Controller.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
extern "C" {
@@ -232,9 +228,9 @@ bool Controller::hitViewMapCache()
return false;
}
-int Controller::LoadMesh(Render *re, ViewLayer *view_layer)
+int Controller::LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
{
- BlenderFileLoader loader(re, view_layer);
+ BlenderFileLoader loader(re, view_layer, depsgraph);
loader.setRenderMonitor(_pRenderMonitor);
diff --git a/source/blender/freestyle/intern/application/Controller.h b/source/blender/freestyle/intern/application/Controller.h
index 0304c18b8a6..765ea418f5e 100644
--- a/source/blender/freestyle/intern/application/Controller.h
+++ b/source/blender/freestyle/intern/application/Controller.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __CONTROLLER_H__
#define __CONTROLLER_H__
-/** \file blender/freestyle/intern/application/Controller.h
- * \ingroup freestyle
- * \brief The spinal tap of the system.
- * \author Stephane Grabli
- * \date 01/07/2002
+/** \file
+ * \ingroup freestyle
+ * \brief The spinal tap of the system.
*/
#include <string>
@@ -68,7 +62,7 @@ public:
//soc
void init_options();
- int LoadMesh(Render *re, ViewLayer *view_layer);
+ int LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph);
int Load3DSFile(const char *iFileName);
void CloseFile();
void ComputeViewMap();
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index 176193bc65a..1e2bfecff6a 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BlenderFileLoader.h"
@@ -32,10 +28,10 @@
namespace Freestyle {
-BlenderFileLoader::BlenderFileLoader(Render *re, ViewLayer *view_layer)
+BlenderFileLoader::BlenderFileLoader(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
{
_re = re;
- _view_layer = view_layer;
+ _depsgraph = depsgraph;
_Scene = NULL;
_numFacesRead = 0;
#if 0
@@ -64,26 +60,21 @@ NodeGroup *BlenderFileLoader::Load()
_viewplane_bottom = _re->viewplane.ymin;
_viewplane_top = _re->viewplane.ymax;
- if (_re->clipsta < 0.f) {
+ if (_re->clip_start < 0.f) {
// Adjust clipping start/end and set up a Z offset when the viewport preview
- // is used with the orthographic view. In this case, _re->clipsta is negative,
+ // is used with the orthographic view. In this case, _re->clip_start is negative,
// while Freestyle assumes that imported mesh data are in the camera coordinate
// system with the view point located at origin [bug #36009].
_z_near = -0.001f;
- _z_offset = _re->clipsta + _z_near;
- _z_far = -_re->clipend + _z_offset;
+ _z_offset = _re->clip_start + _z_near;
+ _z_far = -_re->clip_end + _z_offset;
}
else {
- _z_near = -_re->clipsta;
- _z_far = -_re->clipend;
+ _z_near = -_re->clip_start;
+ _z_far = -_re->clip_end;
_z_offset = 0.f;
}
- ViewLayer *view_layer = (ViewLayer*)BLI_findstring(&_re->scene->view_layers, _view_layer->name, offsetof(ViewLayer, name));
- Depsgraph *depsgraph = DEG_graph_new(_re->scene, view_layer, DAG_EVAL_RENDER);
-
- BKE_scene_graph_update_tagged(depsgraph, _re->main);
-
#if 0
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Frustum: l " << _viewplane_left << " r " << _viewplane_right
@@ -95,7 +86,7 @@ NodeGroup *BlenderFileLoader::Load()
int id = 0;
DEG_OBJECT_ITER_BEGIN(
- depsgraph, ob,
+ _depsgraph, ob,
DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
DEG_ITER_OBJECT_FLAG_VISIBLE |
@@ -105,9 +96,13 @@ NodeGroup *BlenderFileLoader::Load()
break;
}
+ if (ob->base_flag & (BASE_HOLDOUT | BASE_INDIRECT_ONLY)) {
+ continue;
+ }
+
bool apply_modifiers = false;
bool calc_undeformed = false;
- Mesh *mesh = BKE_mesh_new_from_object(depsgraph,
+ Mesh *mesh = BKE_mesh_new_from_object(_depsgraph,
_re->main,
_re->scene,
ob,
@@ -116,13 +111,11 @@ NodeGroup *BlenderFileLoader::Load()
if (mesh) {
insertShapeNode(ob, mesh, ++id);
- BKE_libblock_free_ex(_re->main, &mesh->id, true, false);
+ BKE_id_free_ex(_re->main, &mesh->id, LIB_ID_FREE_NO_UI_USER, true);
}
}
DEG_OBJECT_ITER_END;
- DEG_graph_free(depsgraph);
-
// Return the built scene.
return _Scene;
}
@@ -411,9 +404,15 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
FreestyleEdge *fed = (FreestyleEdge*)CustomData_get_layer(&me->edata, CD_FREESTYLE_EDGE);
FreestyleFace *ffa = (FreestyleFace*)CustomData_get_layer(&me->pdata, CD_FREESTYLE_FACE);
+ // Compute view matrix
+ Object *ob_camera_eval = DEG_get_evaluated_object(_depsgraph, RE_GetCamera(_re));
+ float viewinv[4][4], viewmat[4][4];
+ RE_GetCameraModelMatrix(_re, ob_camera_eval, viewinv);
+ invert_m4_m4(viewmat, viewinv);
+
// Compute matrix including camera transform
float obmat[4][4], nmat[4][4];
- mul_m4_m4m4(obmat, _re->viewmat, ob->obmat);
+ mul_m4_m4m4(obmat, viewmat, ob->obmat);
invert_m4_m4(nmat, obmat);
transpose_m4(nmat);
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h
index 2fcf4373bba..251e9329128 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLENDER_FILE_LOADER_H__
#define __BLENDER_FILE_LOADER_H__
-/** \file blender/freestyle/intern/blender_interface/BlenderFileLoader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include <string.h>
@@ -89,7 +85,7 @@ class BlenderFileLoader
{
public:
/*! Builds a MaxFileLoader */
- BlenderFileLoader(Render *re, ViewLayer *view_layer);
+ BlenderFileLoader(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph);
virtual ~BlenderFileLoader();
/*! Loads the 3D scene and returns a pointer to the scene root node */
@@ -124,7 +120,7 @@ protected:
unsigned n;
};
Render *_re;
- ViewLayer *_view_layer;
+ Depsgraph *_depsgraph;
NodeGroup *_Scene;
unsigned _numFacesRead;
#if 0
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index e8d6d1e789a..1587bc3d9eb 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BlenderStrokeRenderer.h"
@@ -152,11 +148,11 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str
Camera *camera = (Camera *)object_camera->data;
camera->type = CAM_ORTHO;
camera->ortho_scale = max(re->rectx, re->recty);
- camera->clipsta = 0.1f;
- camera->clipend = 100.0f;
+ camera->clip_start = 0.1f;
+ camera->clip_end = 100.0f;
_z_delta = 0.00001f;
- _z = camera->clipsta + _z_delta;
+ _z = camera->clip_start + _z_delta;
object_camera->loc[0] = re->disprect.xmin + 0.5f * re->rectx;
object_camera->loc[1] = re->disprect.ymin + 0.5f * re->recty;
@@ -185,10 +181,11 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer()
// compositor has finished.
// release objects and data blocks
+ Base *base_next = NULL;
ViewLayer *view_layer = (ViewLayer *)freestyle_scene->view_layers.first;
- for (Base *b = (Base *)view_layer->object_bases.first; b; b = b->next) {
+ for (Base *b = (Base *)view_layer->object_bases.first; b; b = base_next) {
+ base_next = b->next;
Object *ob = b->object;
- void *data = ob->data;
char *name = ob->id.name;
#if 0
if (G.debug & G_DEBUG_FREESTYLE) {
@@ -196,31 +193,28 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer()
}
#endif
switch (ob->type) {
- case OB_MESH:
- BKE_libblock_free(freestyle_bmain, ob);
- BKE_libblock_free(freestyle_bmain, data);
- break;
case OB_CAMERA:
- BKE_libblock_free(freestyle_bmain, ob);
- BKE_libblock_free(freestyle_bmain, data);
freestyle_scene->camera = NULL;
+ ATTR_FALLTHROUGH;
+ case OB_MESH:
+ BKE_scene_collections_object_remove(freestyle_bmain,
+ freestyle_scene,
+ ob,
+ true);
break;
default:
cerr << "Warning: unexpected object in the scene: " << name[0] << name[1] << ":" << (name + 2) << endl;
}
}
- // Make sure we don't have any bases which might reference freed objects.
- BKE_main_collection_sync(freestyle_bmain);
-
// release materials
- Link *lnk = (Link *)freestyle_bmain->mat.first;
+ Link *lnk = (Link *)freestyle_bmain->materials.first;
while (lnk)
{
Material *ma = (Material*)lnk;
lnk = lnk->next;
- BKE_libblock_free(freestyle_bmain, ma);
+ BKE_id_free(freestyle_bmain, ma);
}
BLI_ghash_free(_nodetree_hash, NULL, NULL);
@@ -879,11 +873,11 @@ Object *BlenderStrokeRenderer::NewMesh() const
Render *BlenderStrokeRenderer::RenderScene(Render * /*re*/, bool render)
{
Camera *camera = (Camera *)freestyle_scene->camera->data;
- if (camera->clipend < _z)
- camera->clipend = _z + _z_delta * 100.0f;
+ if (camera->clip_end < _z)
+ camera->clip_end = _z + _z_delta * 100.0f;
#if 0
if (G.debug & G_DEBUG_FREESTYLE) {
- cout << "clipsta " << camera->clipsta << ", clipend " << camera->clipend << endl;
+ cout << "clip_start " << camera->clip_start << ", clip_end " << camera->clip_end << endl;
}
#endif
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h
index c7204293839..1d488f5accf 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLENDER_STROKE_RENDERER_H__
#define __BLENDER_STROKE_RENDERER_H__
-/** \file blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "../stroke/StrokeRenderer.h"
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h b/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h
index 1d73125f627..166f9243f63 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BLENDERSTYLEMODULE_H__
#define __BLENDERSTYLEMODULE_H__
-/** \file blender/freestyle/intern/blender_interface/BlenderStyleModule.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "../stroke/StyleModule.h"
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 3486980fa65..785f291d8c3 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include <iostream>
@@ -51,6 +47,7 @@ extern "C" {
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_linestyle.h"
+#include "BKE_scene.h"
#include "BKE_text.h"
#include "BLT_translation.h"
@@ -62,6 +59,8 @@ extern "C" {
#include "BPY_extern.h"
+#include "DEG_depsgraph_query.h"
+
#include "renderpipeline.h"
#include "FRS_freestyle.h"
@@ -282,13 +281,13 @@ static bool test_edge_type_conditions(struct edge_type_condition *conditions,
return true;
}
-static void prepare(Render *re, ViewLayer *view_layer)
+static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
{
// load mesh
re->i.infostr = IFACE_("Freestyle: Mesh loading");
re->stats_draw(re->sdh, &re->i);
re->i.infostr = NULL;
- if (controller->LoadMesh(re, view_layer)) // returns if scene cannot be loaded or if empty
+ if (controller->LoadMesh(re, view_layer, depsgraph)) // returns if scene cannot be loaded or if empty
return;
if (re->test_break(re->tbh))
return;
@@ -343,7 +342,7 @@ static void prepare(Render *re, ViewLayer *view_layer)
{FREESTYLE_FE_MATERIAL_BOUNDARY, 0},
{FREESTYLE_FE_CONTOUR, 0},
{FREESTYLE_FE_EXTERNAL_CONTOUR, 0},
- {FREESTYLE_FE_EDGE_MARK, 0}
+ {FREESTYLE_FE_EDGE_MARK, 0},
};
int num_edge_types = sizeof(conditions) / sizeof(struct edge_type_condition);
if (G.debug & G_DEBUG_FREESTYLE) {
@@ -606,12 +605,17 @@ Render *FRS_do_stroke_rendering(Render *re, ViewLayer *view_layer, int render)
cout << "----------------------------------------------------------" << endl;
}
+ /* Create depsgraph and evaluate scene. */
+ ViewLayer *scene_view_layer = (ViewLayer*)BLI_findstring(&re->scene->view_layers, view_layer->name, offsetof(ViewLayer, name));
+ Depsgraph *depsgraph = DEG_graph_new(re->scene, scene_view_layer, DAG_EVAL_RENDER);
+ BKE_scene_graph_update_for_newframe(depsgraph, re->main);
+
// prepare Freestyle:
// - load mesh
// - add style modules
// - set parameters
// - compute view map
- prepare(re, view_layer);
+ prepare(re, view_layer, depsgraph);
if (re->test_break(re->tbh)) {
controller->CloseFile();
@@ -626,7 +630,7 @@ Render *FRS_do_stroke_rendering(Render *re, ViewLayer *view_layer, int render)
re->i.infostr = IFACE_("Freestyle: Stroke rendering");
re->stats_draw(re->sdh, &re->i);
re->i.infostr = NULL;
- g_freestyle.scene = re->scene;
+ g_freestyle.scene = DEG_get_evaluated_scene(depsgraph);
int strokeCount = controller->DrawStrokes();
if (strokeCount > 0) {
freestyle_render = controller->RenderStrokes(re, true);
@@ -643,6 +647,8 @@ Render *FRS_do_stroke_rendering(Render *re, ViewLayer *view_layer, int render)
}
}
+ DEG_graph_free(depsgraph);
+
return freestyle_render;
}
diff --git a/source/blender/freestyle/intern/geometry/BBox.h b/source/blender/freestyle/intern/geometry/BBox.h
index 54fd39800cc..741d4e6715e 100644
--- a/source/blender/freestyle/intern/geometry/BBox.h
+++ b/source/blender/freestyle/intern/geometry/BBox.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BBOX_H__
#define __BBOX_H__
-/** \file blender/freestyle/intern/geometry/BBox.h
- * \ingroup freestyle
- * \brief A class to hold a bounding box
- * \author Stephane Grabli
- * \date 22/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief A class to hold a bounding box
*/
#include <stdlib.h>
diff --git a/source/blender/freestyle/intern/geometry/Bezier.cpp b/source/blender/freestyle/intern/geometry/Bezier.cpp
index b9099df9a68..aeac71fca11 100644
--- a/source/blender/freestyle/intern/geometry/Bezier.cpp
+++ b/source/blender/freestyle/intern/geometry/Bezier.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/Bezier.cpp
- * \ingroup freestyle
- * \brief Class to define a Bezier curve of order 4.
- * \author Stephane Grabli
- * \date 04/06/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a Bezier curve of order 4.
*/
#include "Bezier.h"
diff --git a/source/blender/freestyle/intern/geometry/Bezier.h b/source/blender/freestyle/intern/geometry/Bezier.h
index ed26803c2a2..babeb3e9e57 100644
--- a/source/blender/freestyle/intern/geometry/Bezier.h
+++ b/source/blender/freestyle/intern/geometry/Bezier.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BEZIER_H__
#define __BEZIER_H__
-/** \file blender/freestyle/intern/geometry/Bezier.h
- * \ingroup freestyle
- * \brief Class to define a Bezier curve of order 4.
- * \author Stephane Grabli
- * \date 04/06/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a Bezier curve of order 4.
*/
#include <vector>
diff --git a/source/blender/freestyle/intern/geometry/FastGrid.cpp b/source/blender/freestyle/intern/geometry/FastGrid.cpp
index 2ce424483ea..dec22e67acb 100644
--- a/source/blender/freestyle/intern/geometry/FastGrid.cpp
+++ b/source/blender/freestyle/intern/geometry/FastGrid.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/FastGrid.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the bounding box of the scene
- * \author Stephane Grabli
- * \date 30/07/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the bounding box of the scene
*/
#include <cstdlib>
diff --git a/source/blender/freestyle/intern/geometry/FastGrid.h b/source/blender/freestyle/intern/geometry/FastGrid.h
index 75624bb9d9c..8c22703a68c 100644
--- a/source/blender/freestyle/intern/geometry/FastGrid.h
+++ b/source/blender/freestyle/intern/geometry/FastGrid.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FASTGRID_H__
#define __FASTGRID_H__
-/** \file blender/freestyle/intern/geometry/FastGrid.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the bounding box of the scene
- * \author Stephane Grabli
- * \date 30/07/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the bounding box of the scene
*/
#include "Grid.h"
diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp
index fd7d63bbd28..9e12507b896 100644
--- a/source/blender/freestyle/intern/geometry/FitCurve.cpp
+++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/FitCurve.cpp
- * \ingroup freestyle
- * \brief An Algorithm for Automatically Fitting Digitized Curves by Philip J. Schneider,
- * \brief from "Graphics Gems", Academic Press, 1990
- * \author Stephane Grabli
- * \date 06/06/2003
+/** \file
+ * \ingroup freestyle
+ * \brief An Algorithm for Automatically Fitting Digitized Curves by Philip J. Schneider,
+ * \brief from "Graphics Gems", Academic Press, 1990
*/
#include <cstdlib> // for malloc and free
diff --git a/source/blender/freestyle/intern/geometry/FitCurve.h b/source/blender/freestyle/intern/geometry/FitCurve.h
index c402f431c27..f32549ed526 100644
--- a/source/blender/freestyle/intern/geometry/FitCurve.h
+++ b/source/blender/freestyle/intern/geometry/FitCurve.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FITCURVE_H__
#define __FITCURVE_H__
-/** \file blender/freestyle/intern/geometry/FitCurve.h
- * \ingroup freestyle
- * \brief An Algorithm for Automatically Fitting Digitized Curves by Philip J. Schneider,
- * \brief from "Graphics Gems", Academic Press, 1990
- * \author Stephane Grabli
- * \date 06/06/2003
+/** \file
+ * \ingroup freestyle
+ * \brief An Algorithm for Automatically Fitting Digitized Curves by Philip J. Schneider,
+ * \brief from "Graphics Gems", Academic Press, 1990
*/
#include <vector>
diff --git a/source/blender/freestyle/intern/geometry/Geom.h b/source/blender/freestyle/intern/geometry/Geom.h
index ffef032e1eb..ecd07f88835 100644
--- a/source/blender/freestyle/intern/geometry/Geom.h
+++ b/source/blender/freestyle/intern/geometry/Geom.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __GEOM_H__
#define __GEOM_H__
-/** \file blender/freestyle/intern/geometry/Geom.h
- * \ingroup freestyle
- * \brief Vectors and Matrices (useful type definitions)
- * \author Sylvain Paris
- * \author Emmanuel Turquin
- * \author Stephane Grabli
- * \date 20/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Vectors and Matrices (useful type definitions)
*/
#include "VecMat.h"
diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
index c5db92d8f75..9643593a03d 100644
--- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/GeomCleaner.cpp
- * \ingroup freestyle
- * \brief Class to define a cleaner of geometry providing a set of useful tools
- * \author Stephane Grabli
- * \date 04/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cleaner of geometry providing a set of useful tools
*/
#if 0
diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.h b/source/blender/freestyle/intern/geometry/GeomCleaner.h
index aeca592a8c4..32bcc244f69 100644
--- a/source/blender/freestyle/intern/geometry/GeomCleaner.h
+++ b/source/blender/freestyle/intern/geometry/GeomCleaner.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __GEOMCLEANER_H__
#define __GEOMCLEANER_H__
-/** \file blender/freestyle/intern/geometry/GeomCleaner.h
- * \ingroup freestyle
- * \brief Class to define a cleaner of geometry providing a set of useful tools
- * \author Stephane Grabli
- * \date 04/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cleaner of geometry providing a set of useful tools
*/
#include "Geom.h"
diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp
index cd7c1b83a4e..da7774d3843 100644
--- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/GeomUtils.cpp
- * \ingroup freestyle
- * \brief Various tools for geometry
- * \author Stephane Grabli
- * \date 12/04/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Various tools for geometry
*/
#include "GeomUtils.h"
@@ -670,7 +664,7 @@ void fromCameraToWorld(const Vec3r& p, Vec3r& q, const real model_view_matrix[4]
real translation[3] = {
model_view_matrix[0][3],
model_view_matrix[1][3],
- model_view_matrix[2][3]
+ model_view_matrix[2][3],
};
for (unsigned short i = 0; i < 3; i++) {
q[i] = 0.0;
diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.h b/source/blender/freestyle/intern/geometry/GeomUtils.h
index 9e7c629191f..94904b72ff1 100644
--- a/source/blender/freestyle/intern/geometry/GeomUtils.h
+++ b/source/blender/freestyle/intern/geometry/GeomUtils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __GEOMUTILS_H__
#define __GEOMUTILS_H__
-/** \file blender/freestyle/intern/geometry/GeomUtils.h
- * \ingroup freestyle
- * \brief Various tools for geometry
- * \author Stephane Grabli
- * \date 12/04/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Various tools for geometry
*/
#include <vector>
diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp
index 61cf70a0aa3..e7d3cf1a8cc 100644
--- a/source/blender/freestyle/intern/geometry/Grid.cpp
+++ b/source/blender/freestyle/intern/geometry/Grid.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/Grid.cpp
- * \ingroup freestyle
- * \brief Base class to define a cell grid surrounding the bounding box of the scene
- * \author Stephane Grabli
- * \date 30/07/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Base class to define a cell grid surrounding the bounding box of the scene
*/
#include <stdexcept>
diff --git a/source/blender/freestyle/intern/geometry/Grid.h b/source/blender/freestyle/intern/geometry/Grid.h
index 0a9be01aba1..c3a0f16a354 100644
--- a/source/blender/freestyle/intern/geometry/Grid.h
+++ b/source/blender/freestyle/intern/geometry/Grid.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __GRID_H__
#define __GRID_H__
-/** \file blender/freestyle/intern/geometry/Grid.h
- * \ingroup freestyle
- * \brief Base class to define a cell grid surrounding the bounding box of the scene
- * \author Stephane Grabli
- * \date 30/07/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Base class to define a cell grid surrounding the bounding box of the scene
*/
#include <cstring> // for memset
diff --git a/source/blender/freestyle/intern/geometry/GridHelpers.cpp b/source/blender/freestyle/intern/geometry/GridHelpers.cpp
index d969d3e3024..09820043136 100644
--- a/source/blender/freestyle/intern/geometry/GridHelpers.cpp
+++ b/source/blender/freestyle/intern/geometry/GridHelpers.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/GridHelpers.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2010-12-21
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "GridHelpers.h"
diff --git a/source/blender/freestyle/intern/geometry/GridHelpers.h b/source/blender/freestyle/intern/geometry/GridHelpers.h
index 4dd345e9b07..6b0f55e3d6f 100644
--- a/source/blender/freestyle/intern/geometry/GridHelpers.h
+++ b/source/blender/freestyle/intern/geometry/GridHelpers.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __GRIDHELPERS_H__
#define __GRIDHELPERS_H__
-/** \file blender/freestyle/intern/geometry/GridHelpers.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2010-12-13
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include <vector>
@@ -150,7 +144,7 @@ inline bool insideProscenium (const real proscenium[4], const Polygon3r& polygon
Vec3r triverts[3] = {
Vec3r(polygon.getVertices()[0][0], polygon.getVertices()[0][1], 0.0),
Vec3r(polygon.getVertices()[1][0], polygon.getVertices()[1][1], 0.0),
- Vec3r(polygon.getVertices()[2][0], polygon.getVertices()[2][1], 0.0)
+ Vec3r(polygon.getVertices()[2][0], polygon.getVertices()[2][1], 0.0),
};
return GeomUtils::overlapTriangleBox(boxCenter, boxHalfSize, triverts);
}
diff --git a/source/blender/freestyle/intern/geometry/HashGrid.cpp b/source/blender/freestyle/intern/geometry/HashGrid.cpp
index 0b576b6f368..4011dabe1f5 100644
--- a/source/blender/freestyle/intern/geometry/HashGrid.cpp
+++ b/source/blender/freestyle/intern/geometry/HashGrid.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/HashGrid.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the bounding box of the scene
- * \author Stephane Grabli
- * \date 30/07/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the bounding box of the scene
*/
#include "HashGrid.h"
diff --git a/source/blender/freestyle/intern/geometry/HashGrid.h b/source/blender/freestyle/intern/geometry/HashGrid.h
index 4ea7c7146a4..289079fe0d9 100644
--- a/source/blender/freestyle/intern/geometry/HashGrid.h
+++ b/source/blender/freestyle/intern/geometry/HashGrid.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __HASHGRID_H__
#define __HASHGRID_H__
-/** \file blender/freestyle/intern/geometry/HashGrid.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the bounding box of the scene
- * \author Stephane Grabli
- * \date 30/07/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the bounding box of the scene
*/
#if 0
diff --git a/source/blender/freestyle/intern/geometry/Noise.cpp b/source/blender/freestyle/intern/geometry/Noise.cpp
index dd5f2f6ea4c..0764c89c8a3 100644
--- a/source/blender/freestyle/intern/geometry/Noise.cpp
+++ b/source/blender/freestyle/intern/geometry/Noise.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/Noise.cpp
- * \ingroup freestyle
- * \brief Class to define Perlin noise
- * \author Emmanuel Turquin
- * \date 12/01/2004
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define Perlin noise
*/
#include <math.h>
diff --git a/source/blender/freestyle/intern/geometry/Noise.h b/source/blender/freestyle/intern/geometry/Noise.h
index 88994fac0d1..6787e098306 100644
--- a/source/blender/freestyle/intern/geometry/Noise.h
+++ b/source/blender/freestyle/intern/geometry/Noise.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __NOISE_H__
#define __NOISE_H__
-/** \file blender/freestyle/intern/geometry/Noise.h
- * \ingroup freestyle
- * \brief Class to define Perlin noise
- * \author Emmanuel Turquin
- * \date 12/01/2004
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define Perlin noise
*/
#include "Geom.h"
diff --git a/source/blender/freestyle/intern/geometry/Polygon.h b/source/blender/freestyle/intern/geometry/Polygon.h
index f6dfae55d8d..b2359f82477 100644
--- a/source/blender/freestyle/intern/geometry/Polygon.h
+++ b/source/blender/freestyle/intern/geometry/Polygon.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __POLYGON_H__
#define __POLYGON_H__
-/** \file blender/freestyle/intern/geometry/Polygon.h
- * \ingroup freestyle
- * \brief Class to define a polygon
- * \author Stephane Grabli
- * \date 30/07/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a polygon
*/
#include <vector>
diff --git a/source/blender/freestyle/intern/geometry/SweepLine.h b/source/blender/freestyle/intern/geometry/SweepLine.h
index 3edd045320f..d7e3badbe3a 100644
--- a/source/blender/freestyle/intern/geometry/SweepLine.h
+++ b/source/blender/freestyle/intern/geometry/SweepLine.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __SWEEPLINE_H__
#define __SWEEPLINE_H__
-/** \file blender/freestyle/intern/geometry/SweepLine.h
- * \ingroup freestyle
- * \brief Class to define a Sweep Line
- * \author Stephane Grabli
- * \date 29/08/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a Sweep Line
*/
#include <list>
diff --git a/source/blender/freestyle/intern/geometry/VecMat.h b/source/blender/freestyle/intern/geometry/VecMat.h
index e7a44e00b1b..2dd5c3f6718 100644
--- a/source/blender/freestyle/intern/geometry/VecMat.h
+++ b/source/blender/freestyle/intern/geometry/VecMat.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __VECMAT_H__
#define __VECMAT_H__
-/** \file blender/freestyle/intern/geometry/VecMat.h
- * \ingroup freestyle
- * \brief Vectors and Matrices definition and manipulation
- * \author Sylvain Paris
- * \author Emmanuel Turquin
- * \author Stephane Grabli
- * \date 12/06/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Vectors and Matrices definition and manipulation
*/
#include <iostream>
diff --git a/source/blender/freestyle/intern/geometry/matrix_util.cpp b/source/blender/freestyle/intern/geometry/matrix_util.cpp
index 40195361fe0..44490f4bde5 100644
--- a/source/blender/freestyle/intern/geometry/matrix_util.cpp
+++ b/source/blender/freestyle/intern/geometry/matrix_util.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -25,15 +23,10 @@
* Campus Scientifique, BP 239
* 54506 VANDOEUVRE LES NANCY CEDEX
* FRANCE
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/matrix_util.cpp
- * \ingroup freestyle
- * \author Bruno Levy
+/** \file
+ * \ingroup freestyle
*/
#include "matrix_util.h"
@@ -242,7 +235,7 @@ namespace MatrixUtil {
// Step 7: save the eigen vectors
- // back from Fortran to to C++
+ // back from Fortran to C++
v++;
ij = 0;
diff --git a/source/blender/freestyle/intern/geometry/matrix_util.h b/source/blender/freestyle/intern/geometry/matrix_util.h
index 444fd7c4785..b587a9e5738 100644
--- a/source/blender/freestyle/intern/geometry/matrix_util.h
+++ b/source/blender/freestyle/intern/geometry/matrix_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -25,18 +23,13 @@
* Campus Scientifique, BP 239
* 54506 VANDOEUVRE LES NANCY CEDEX
* FRANCE
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __MATRIX_UTIL__
#define __MATRIX_UTIL__
-/** \file blender/freestyle/intern/geometry/matrix_util.h
- * \ingroup freestyle
- * \author Bruno Levy
+/** \file
+ * \ingroup freestyle
*/
#include "../system/FreestyleConfig.h"
diff --git a/source/blender/freestyle/intern/geometry/normal_cycle.cpp b/source/blender/freestyle/intern/geometry/normal_cycle.cpp
index 93d4c006997..e0ef1ddfe12 100644
--- a/source/blender/freestyle/intern/geometry/normal_cycle.cpp
+++ b/source/blender/freestyle/intern/geometry/normal_cycle.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -25,15 +23,10 @@
* Campus Scientifique, BP 239
* 54506 VANDOEUVRE LES NANCY CEDEX
* FRANCE
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/normal_cycle.cpp
- * \ingroup freestyle
- * \author Bruno Levy
+/** \file
+ * \ingroup freestyle
*/
#include "matrix_util.h"
diff --git a/source/blender/freestyle/intern/geometry/normal_cycle.h b/source/blender/freestyle/intern/geometry/normal_cycle.h
index 7ae6762b394..275e5494962 100644
--- a/source/blender/freestyle/intern/geometry/normal_cycle.h
+++ b/source/blender/freestyle/intern/geometry/normal_cycle.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -25,18 +23,13 @@
* Campus Scientifique, BP 239
* 54506 VANDOEUVRE LES NANCY CEDEX
* FRANCE
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __MESH_TOOLS_MATH_NORMAL_CYCLE__
#define __MESH_TOOLS_MATH_NORMAL_CYCLE__
-/** \file blender/freestyle/intern/geometry/normal_cycle.h
- * \ingroup freestyle
- * \author Bruno Levy
+/** \file
+ * \ingroup freestyle
*/
#include "Geom.h"
diff --git a/source/blender/freestyle/intern/image/GaussianFilter.cpp b/source/blender/freestyle/intern/image/GaussianFilter.cpp
index 9d0a6a00b44..540c3392aa3 100644
--- a/source/blender/freestyle/intern/image/GaussianFilter.cpp
+++ b/source/blender/freestyle/intern/image/GaussianFilter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/image/GaussianFilter.cpp
- * \ingroup freestyle
- * \brief Class to perform gaussian filtering operations on an image
- * \author Stephane Grabli
- * \date 20/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to perform gaussian filtering operations on an image
*/
#include <stdlib.h>
diff --git a/source/blender/freestyle/intern/image/GaussianFilter.h b/source/blender/freestyle/intern/image/GaussianFilter.h
index 56baa3c3d46..527444eb484 100644
--- a/source/blender/freestyle/intern/image/GaussianFilter.h
+++ b/source/blender/freestyle/intern/image/GaussianFilter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __GAUSSIANFILTER_H__
#define __GAUSSIANFILTER_H__
-/** \file blender/freestyle/intern/image/GaussianFilter.h
- * \ingroup freestyle
- * \brief Class to perform gaussian filtering operations on an image
- * \author Stephane Grabli
- * \date 20/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to perform gaussian filtering operations on an image
*/
#include <cstdlib> // for abs
diff --git a/source/blender/freestyle/intern/image/Image.h b/source/blender/freestyle/intern/image/Image.h
index c262da475d6..208a8b1938c 100644
--- a/source/blender/freestyle/intern/image/Image.h
+++ b/source/blender/freestyle/intern/image/Image.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __IMAGE_H__
#define __IMAGE_H__
-/** \file blender/freestyle/intern/image/Image.h
- * \ingroup freestyle
- * \brief Class to encapsulate an array of RGB or Gray level values
- * \author Stephane Grabli
- * \date 20/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to encapsulate an array of RGB or Gray level values
*/
#include <string.h> // for memcpy
diff --git a/source/blender/freestyle/intern/image/ImagePyramid.cpp b/source/blender/freestyle/intern/image/ImagePyramid.cpp
index db92cc68286..5683b282a9d 100644
--- a/source/blender/freestyle/intern/image/ImagePyramid.cpp
+++ b/source/blender/freestyle/intern/image/ImagePyramid.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/image/ImagePyramid.cpp
- * \ingroup freestyle
- * \brief Class to represent a pyramid of images
- * \author Stephane Grabli
- * \date 25/12/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a pyramid of images
*/
#include <iostream>
diff --git a/source/blender/freestyle/intern/image/ImagePyramid.h b/source/blender/freestyle/intern/image/ImagePyramid.h
index fa55081646a..023361a1d69 100644
--- a/source/blender/freestyle/intern/image/ImagePyramid.h
+++ b/source/blender/freestyle/intern/image/ImagePyramid.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __IMAGEPYRAMID_H__
#define __IMAGEPYRAMID_H__
-/** \file blender/freestyle/intern/image/ImagePyramid.h
- * \ingroup freestyle
- * \brief Class to represent a pyramid of images
- * \author Stephane Grabli
- * \date 25/12/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a pyramid of images
*/
#include <vector>
diff --git a/source/blender/freestyle/intern/python/BPy_BBox.cpp b/source/blender/freestyle/intern/python/BPy_BBox.cpp
index 29bef7dd42f..0916666e4cc 100644
--- a/source/blender/freestyle/intern/python/BPy_BBox.cpp
+++ b/source/blender/freestyle/intern/python/BPy_BBox.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/python/BPy_BBox.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_BBox.h"
diff --git a/source/blender/freestyle/intern/python/BPy_BBox.h b/source/blender/freestyle/intern/python/BPy_BBox.h
index 089c2167c69..09978308781 100644
--- a/source/blender/freestyle/intern/python/BPy_BBox.h
+++ b/source/blender/freestyle/intern/python/BPy_BBox.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_BBox.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_BBOX_H__
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
index 0577f419ae8..60a85a4594e 100644
--- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_BinaryPredicate0D.h"
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h
index a9a22970e4b..6e27872d48a 100644
--- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h
+++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_BINARYPREDICATE0D_H__
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
index 67c9dd3b1d0..b745d0ed628 100644
--- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_BinaryPredicate1D.h"
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h
index 43511edc09c..20a660e3a3f 100644
--- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h
+++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_BINARYPREDICATE1D_H__
diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
index 50d82656819..371a549e0e3 100644
--- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ContextFunctions.h"
@@ -267,7 +263,7 @@ static PyMethodDef module_functions[] = {
ContextFunctions_read_directional_view_map_pixel___doc__},
{"get_selected_fedge", (PyCFunction)ContextFunctions_get_selected_fedge, METH_NOARGS,
ContextFunctions_get_selected_fedge___doc__},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*-----------------------ContextFunctions module definition--------------------------------*/
@@ -277,7 +273,7 @@ static PyModuleDef module_definition = {
"Freestyle.ContextFunctions",
module_docstring,
-1,
- module_functions
+ module_functions,
};
//------------------- MODULE INITIALIZATION --------------------------------
diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.h b/source/blender/freestyle/intern/python/BPy_ContextFunctions.h
index 40652777c44..674023fa008 100644
--- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.h
+++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_ContextFunctions.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CONTEXTFUNCTIONS_H__
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp
index 0ac116b1bd4..e3e1d7e3301 100644
--- a/source/blender/freestyle/intern/python/BPy_Convert.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Convert.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Convert.h"
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.h b/source/blender/freestyle/intern/python/BPy_Convert.h
index 976b760a325..1b0ce43640b 100644
--- a/source/blender/freestyle/intern/python/BPy_Convert.h
+++ b/source/blender/freestyle/intern/python/BPy_Convert.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Convert.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CONVERT_H__
diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
index 23deb63ce36..e3c7a972867 100644
--- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Freestyle.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Freestyle.h"
@@ -469,7 +465,7 @@ static PyMethodDef module_functions[] = {
{"evaluateColorRamp", (PyCFunction) Freestyle_evaluateColorRamp, METH_VARARGS, Freestyle_evaluateColorRamp___doc__},
{"evaluateCurveMappingF", (PyCFunction) Freestyle_evaluateCurveMappingF, METH_VARARGS,
Freestyle_evaluateCurveMappingF___doc__},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*-----------------------Freestyle module definition---------------------------*/
@@ -479,7 +475,7 @@ static PyModuleDef module_definition = {
"_freestyle",
module_docstring,
-1,
- module_functions
+ module_functions,
};
//-------------------MODULE INITIALIZATION--------------------------------
diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.h b/source/blender/freestyle/intern/python/BPy_Freestyle.h
index 0ed2e00d183..a3a482be9ee 100644
--- a/source/blender/freestyle/intern/python/BPy_Freestyle.h
+++ b/source/blender/freestyle/intern/python/BPy_Freestyle.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Freestyle.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_FREESTYLE_H__
diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
index 3695e85cd15..fe1f23e2665 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
+++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_FrsMaterial.h"
@@ -299,7 +295,7 @@ static Mathutils_Callback FrsMaterial_mathutils_cb = {
FrsMaterial_mathutils_get,
FrsMaterial_mathutils_set,
FrsMaterial_mathutils_get_index,
- FrsMaterial_mathutils_set_index
+ FrsMaterial_mathutils_set_index,
};
static unsigned char FrsMaterial_mathutils_cb_index = -1;
diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.h b/source/blender/freestyle/intern/python/BPy_FrsMaterial.h
index 7cbf5351745..39e564ce97e 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.h
+++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_FrsMaterial.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_FRSMATERIAL_H__
diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
index 9efbe6b53be..871fe517bed 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
+++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_FrsNoise.h"
@@ -289,7 +285,7 @@ static PyMethodDef BPy_FrsNoise_methods[] = {
{"smoothNoise3", (PyCFunction)FrsNoise_smoothNoise3, METH_VARARGS | METH_KEYWORDS, FrsNoise_smoothNoise3_doc},
{"rand", (PyCFunction)FrsNoise_drand, METH_VARARGS | METH_KEYWORDS, NULL},
{"turbulence_smooth", (PyCFunction)FrsNoise_turbulence_smooth, METH_VARARGS | METH_KEYWORDS, NULL},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*-----------------------BPy_FrsNoise type definition ------------------------------*/
diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.h b/source/blender/freestyle/intern/python/BPy_FrsNoise.h
index a5a1064ea8d..109d4aba6b1 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsNoise.h
+++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_FrsNoise.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_FRSNOISE_H__
diff --git a/source/blender/freestyle/intern/python/BPy_Id.cpp b/source/blender/freestyle/intern/python/BPy_Id.cpp
index 7ef56f6baee..fb47874cd97 100644
--- a/source/blender/freestyle/intern/python/BPy_Id.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Id.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Id.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Id.h"
diff --git a/source/blender/freestyle/intern/python/BPy_Id.h b/source/blender/freestyle/intern/python/BPy_Id.h
index 62e480628e3..bb58da25942 100644
--- a/source/blender/freestyle/intern/python/BPy_Id.h
+++ b/source/blender/freestyle/intern/python/BPy_Id.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Id.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_ID_H__
diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
index a6683f538c6..10b1165ba83 100644
--- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
+++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_IntegrationType.h"
@@ -109,7 +105,7 @@ PyDoc_STRVAR(module_docstring, "The Blender Freestyle.Integrator submodule\n\n")
static PyMethodDef module_functions[] = {
{"integrate", (PyCFunction) Integrator_integrate, METH_VARARGS | METH_KEYWORDS, Integrator_integrate_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*-----------------------Integrator module definition--------------------------------------*/
@@ -119,7 +115,7 @@ static PyModuleDef module_definition = {
"Freestyle.Integrator",
module_docstring,
-1,
- module_functions
+ module_functions,
};
/*-----------------------BPy_IntegrationType type definition ------------------------------*/
diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.h b/source/blender/freestyle/intern/python/BPy_IntegrationType.h
index feabe307d56..73cb1b26d59 100644
--- a/source/blender/freestyle/intern/python/BPy_IntegrationType.h
+++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_IntegrationType.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_INTEGRATIONTYPE_H__
diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
index d592aed749d..a08946660b5 100644
--- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Interface0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Interface0D.h"
@@ -147,7 +143,7 @@ static PyObject *Interface0D_get_fedge(BPy_Interface0D *self, PyObject *args, Py
static PyMethodDef BPy_Interface0D_methods[] = {
{"get_fedge", (PyCFunction)Interface0D_get_fedge, METH_VARARGS | METH_KEYWORDS, Interface0D_get_fedge_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------Interface1D get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.h b/source/blender/freestyle/intern/python/BPy_Interface0D.h
index ec1a6f1c42d..2a52394e137 100644
--- a/source/blender/freestyle/intern/python/BPy_Interface0D.h
+++ b/source/blender/freestyle/intern/python/BPy_Interface0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Interface0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_INTERFACE0D_H__
diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
index c5a07fd295b..6c6965a4975 100644
--- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Interface1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Interface1D.h"
@@ -214,7 +210,7 @@ static PyMethodDef BPy_Interface1D_methods[] = {
{"vertices_end", (PyCFunction)Interface1D_vertices_end, METH_NOARGS, Interface1D_vertices_end_doc},
{"points_begin", (PyCFunction)Interface1D_points_begin, METH_VARARGS | METH_KEYWORDS, Interface1D_points_begin_doc},
{"points_end", (PyCFunction)Interface1D_points_end, METH_VARARGS | METH_KEYWORDS, Interface1D_points_end_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------Interface1D get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.h b/source/blender/freestyle/intern/python/BPy_Interface1D.h
index 0c731bb1755..204eb84d87b 100644
--- a/source/blender/freestyle/intern/python/BPy_Interface1D.h
+++ b/source/blender/freestyle/intern/python/BPy_Interface1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Interface1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_INTERFACE1D_H__
diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp
index b153cedfd64..b8ad6ef82f8 100644
--- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Iterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Iterator.h"
@@ -170,7 +166,7 @@ static PyObject *Iterator_decrement(BPy_Iterator *self)
static PyMethodDef BPy_Iterator_methods[] = {
{"increment", (PyCFunction) Iterator_increment, METH_NOARGS, Iterator_increment_doc},
{"decrement", (PyCFunction) Iterator_decrement, METH_NOARGS, Iterator_decrement_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------Iterator get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.h b/source/blender/freestyle/intern/python/BPy_Iterator.h
index dcb8191948e..2648bfa4f13 100644
--- a/source/blender/freestyle/intern/python/BPy_Iterator.h
+++ b/source/blender/freestyle/intern/python/BPy_Iterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Iterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_ITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.cpp b/source/blender/freestyle/intern/python/BPy_MediumType.cpp
index ee24dca0d29..30a930f1839 100644
--- a/source/blender/freestyle/intern/python/BPy_MediumType.cpp
+++ b/source/blender/freestyle/intern/python/BPy_MediumType.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_MediumType.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_MediumType.h"
diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.h b/source/blender/freestyle/intern/python/BPy_MediumType.h
index d99fb537bb3..062c56f2887 100644
--- a/source/blender/freestyle/intern/python/BPy_MediumType.h
+++ b/source/blender/freestyle/intern/python/BPy_MediumType.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_MediumType.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_MEDIUMTYPE_H__
diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp
index deedbb93981..2bfec05cbe5 100644
--- a/source/blender/freestyle/intern/python/BPy_Nature.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Nature.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Nature.h"
diff --git a/source/blender/freestyle/intern/python/BPy_Nature.h b/source/blender/freestyle/intern/python/BPy_Nature.h
index ad6bc0fdbdd..1cdc1a82ca5 100644
--- a/source/blender/freestyle/intern/python/BPy_Nature.h
+++ b/source/blender/freestyle/intern/python/BPy_Nature.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Nature.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_NATURE_H__
diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp
index 1b2b18c2c99..6bbdcd72052 100644
--- a/source/blender/freestyle/intern/python/BPy_Operators.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Operators.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Operators.h"
@@ -719,7 +715,7 @@ static PyMethodDef BPy_Operators_methods[] = {
Operators_get_chains_size_doc},
{"get_strokes_size", (PyCFunction) Operators_get_strokes_size, METH_NOARGS | METH_STATIC,
Operators_get_strokes_size_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*-----------------------BPy_Operators type definition ------------------------------*/
diff --git a/source/blender/freestyle/intern/python/BPy_Operators.h b/source/blender/freestyle/intern/python/BPy_Operators.h
index 86d23c4917f..7d91edc6373 100644
--- a/source/blender/freestyle/intern/python/BPy_Operators.h
+++ b/source/blender/freestyle/intern/python/BPy_Operators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_Operators.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_OPERATORS_H__
diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp
index 00a1f5ce34d..024eb61736a 100644
--- a/source/blender/freestyle/intern/python/BPy_SShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_SShape.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_SShape.h"
@@ -152,7 +148,7 @@ static PyMethodDef BPy_SShape_methods[] = {
{"add_edge", (PyCFunction)SShape_add_edge, METH_VARARGS | METH_KEYWORDS, SShape_add_edge_doc},
{"add_vertex", (PyCFunction)SShape_add_vertex, METH_VARARGS | METH_KEYWORDS, SShape_add_vertex_doc},
{"compute_bbox", (PyCFunction)SShape_compute_bbox, METH_NOARGS, SShape_compute_bbox_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------SShape get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/BPy_SShape.h b/source/blender/freestyle/intern/python/BPy_SShape.h
index 2bfec42cbdd..270c8cb8317 100644
--- a/source/blender/freestyle/intern/python/BPy_SShape.h
+++ b/source/blender/freestyle/intern/python/BPy_SShape.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_SShape.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_SSHAPE_H__
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
index b390bb293d5..65d4ab6ce83 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
+++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_StrokeAttribute.h"
@@ -371,7 +367,7 @@ static PyMethodDef BPy_StrokeAttribute_methods[] = {
StrokeAttribute_set_attribute_vec2_doc},
{"set_attribute_vec3", (PyCFunction) StrokeAttribute_set_attribute_vec3, METH_VARARGS | METH_KEYWORDS,
StrokeAttribute_set_attribute_vec3_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------mathutils callbacks ----------------------------*/
@@ -479,7 +475,7 @@ static Mathutils_Callback StrokeAttribute_mathutils_cb = {
StrokeAttribute_mathutils_get,
StrokeAttribute_mathutils_set,
StrokeAttribute_mathutils_get_index,
- StrokeAttribute_mathutils_set_index
+ StrokeAttribute_mathutils_set_index,
};
static unsigned char StrokeAttribute_mathutils_cb_index = -1;
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h
index 48a61cc9f07..7b55fcc9444 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h
+++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_StrokeAttribute.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_STROKEATTRIBUTE_H__
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
index eee48f19e1b..54ac10f39f7 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
+++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_StrokeShader.h"
@@ -233,7 +229,7 @@ static PyObject *StrokeShader_shade(BPy_StrokeShader *self, PyObject *args, PyOb
static PyMethodDef BPy_StrokeShader_methods[] = {
{"shade", (PyCFunction)StrokeShader_shade, METH_VARARGS | METH_KEYWORDS, StrokeShader_shade___doc__},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------StrokeShader get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.h b/source/blender/freestyle/intern/python/BPy_StrokeShader.h
index 91498581695..80a7e3fab0f 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeShader.h
+++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_StrokeShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_STROKESHADER_H__
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp
index 0941efe9df5..278faceadd4 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0D.h"
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h
index 58126d5291a..2d045b39d82 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h
+++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0D_H__
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
index 1b82c7777c7..a340a7b69bc 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction1D.h"
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h
index 0b38b3d47ac..842d228cf75 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h
+++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1D_H__
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
index 5cc51e2259d..d5323b8ff40 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryPredicate0D.h"
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h
index a40d4648444..685120cfb0c 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h
+++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYPREDICATE0D_H__
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
index 87e5e7505ca..11ab9eb2a2b 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryPredicate1D.h"
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h
index bbbec57b2b3..cd44569aac0 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h
+++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYPREDICATE1D_H__
diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
index 78d6786ff38..39dd784bdfc 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_ViewMap.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ViewMap.h"
@@ -137,7 +133,7 @@ static PyMethodDef BPy_ViewMap_methods[] = {
ViewMap_get_closest_viewedge_doc},
{"get_closest_fedge", (PyCFunction)ViewMap_get_closest_fedge, METH_VARARGS | METH_KEYWORDS,
ViewMap_get_closest_fedge_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------ViewMap get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.h b/source/blender/freestyle/intern/python/BPy_ViewMap.h
index cd42e9453ae..f3659a096ab 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewMap.h
+++ b/source/blender/freestyle/intern/python/BPy_ViewMap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_ViewMap.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_VIEWMAP_H__
diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
index f3f8fc616fd..1cd55f512f7 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_ViewShape.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ViewShape.h"
@@ -165,7 +161,7 @@ static PyObject *ViewShape_add_vertex(BPy_ViewShape *self, PyObject *args, PyObj
static PyMethodDef BPy_ViewShape_methods[] = {
{"add_edge", (PyCFunction)ViewShape_add_edge, METH_VARARGS | METH_KEYWORDS, ViewShape_add_edge_doc},
{"add_vertex", (PyCFunction)ViewShape_add_vertex, METH_VARARGS | METH_KEYWORDS, ViewShape_add_vertex_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------ViewShape get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.h b/source/blender/freestyle/intern/python/BPy_ViewShape.h
index 09bf36edfcd..551e16c4438 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewShape.h
+++ b/source/blender/freestyle/intern/python/BPy_ViewShape.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BPy_ViewShape.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_VIEWSHAPE_H__
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp
index 8fa87166c7d..0a84e3d5144 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_FalseBP1D.h"
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h
index add2a68214f..120cda356c4 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_FALSEBP1D_H__
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp
index 8a0a4ded58d..50046fa0e1c 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Length2DBP1D.h"
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h
index e79e8118c5a..3e73dfa9ad4 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_LENGTH2DBP1D_H__
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp
index b4a256e6f66..cee814e62de 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_SameShapeIdBP1D.h"
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h
index c78aab609a4..f20c4b48fb8 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_SAMESHAPEIDBP1D_H__
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp
index 6306905b4aa..1375aa2d549 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_TrueBP1D.h"
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h
index 29cf57a2215..66fb7bc254d 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_TRUEBP1D_H__
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp
index 8d81e508340..a7e5e7295a2 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ViewMapGradientNormBP1D.h"
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h
index 27182b852d1..7d7fce837db 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_VIEWMAPGRADIENTNORMBP1D_H__
diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp
index f4f02a7026f..f4e174af761 100644
--- a/source/blender/freestyle/intern/python/Director.cpp
+++ b/source/blender/freestyle/intern/python/Director.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Director.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "Director.h"
diff --git a/source/blender/freestyle/intern/python/Director.h b/source/blender/freestyle/intern/python/Director.h
index 6a0ae7dd704..cf89b7f84e6 100644
--- a/source/blender/freestyle/intern/python/Director.h
+++ b/source/blender/freestyle/intern/python/Director.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Director.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_DIRECTOR_H__
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
index 446587c2388..d000677ab55 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_CurvePoint.h"
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h
index 5d651ef1a56..7cc78a12167 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CURVEPOINT_H__
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
index d83a5a5174c..f4b232a957e 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_SVertex.h"
@@ -138,7 +134,7 @@ static PyObject *SVertex_add_fedge(BPy_SVertex *self, PyObject *args, PyObject *
static PyMethodDef BPy_SVertex_methods[] = {
{"add_normal", (PyCFunction)SVertex_add_normal, METH_VARARGS | METH_KEYWORDS, SVertex_add_normal_doc},
{"add_fedge", (PyCFunction)SVertex_add_fedge, METH_VARARGS | METH_KEYWORDS, SVertex_add_fedge_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------mathutils callbacks ----------------------------*/
@@ -253,7 +249,7 @@ static Mathutils_Callback SVertex_mathutils_cb = {
SVertex_mathutils_get,
SVertex_mathutils_set,
SVertex_mathutils_get_index,
- SVertex_mathutils_set_index
+ SVertex_mathutils_set_index,
};
static unsigned char SVertex_mathutils_cb_index = -1;
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h
index a154ac4e48e..dabc7119539 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_SVERTEX_H__
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
index f8d0b34d6a9..155dbf26888 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ViewVertex.h"
@@ -121,7 +117,7 @@ static PyMethodDef BPy_ViewVertex_methods[] = {
{"edges_end", (PyCFunction)ViewVertex_edges_end, METH_NOARGS, ViewVertex_edges_end_doc},
{"edges_iterator", (PyCFunction)ViewVertex_edges_iterator, METH_VARARGS | METH_KEYWORDS,
ViewVertex_edges_iterator_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------ViewVertex get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h
index 21b45c987f2..63bff6557fc 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_VIEWVERTEX_H__
diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
index 09e33db529d..0df055194ae 100644
--- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_StrokeVertex.h"
@@ -211,7 +207,7 @@ static Mathutils_Callback StrokeVertex_mathutils_cb = {
StrokeVertex_mathutils_get,
StrokeVertex_mathutils_set,
StrokeVertex_mathutils_get_index,
- StrokeVertex_mathutils_set_index
+ StrokeVertex_mathutils_set_index,
};
static unsigned char StrokeVertex_mathutils_cb_index = -1;
diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h
index 8519fe98443..a7bbae59c38 100644
--- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h
+++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_STROKEVERTEX_H__
diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp
index 555f93effa0..49a1e7cc8b3 100644
--- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_NonTVertex.h"
diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h
index 7f8d5c175c7..fc65dd3eb0f 100644
--- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h
+++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_NONTVERTEX_H__
diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
index d047d9ae914..f24d551fad8 100644
--- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_TVertex.h"
@@ -117,7 +113,7 @@ static PyObject *TVertex_get_mate( BPy_TVertex *self, PyObject *args, PyObject *
static PyMethodDef BPy_TVertex_methods[] = {
{"get_svertex", (PyCFunction)TVertex_get_svertex, METH_VARARGS | METH_KEYWORDS, TVertex_get_svertex_doc},
{"get_mate", (PyCFunction)TVertex_get_mate, METH_VARARGS | METH_KEYWORDS, TVertex_get_mate_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------TVertex get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h
index 4f14b5afdc0..a7526ffd1c4 100644
--- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h
+++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_TVERTEX_H__
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
index 4c9e0630d40..3bef47efd17 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_FEdge.h"
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h
index 69e7fddd770..094f59f0908 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_FEDGE_H__
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
index 744556e415c..1932a2fd7ae 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_FrsCurve.h"
@@ -151,7 +147,7 @@ static PyMethodDef BPy_FrsCurve_methods[] = {
FrsCurve_push_vertex_back_doc},
{"push_vertex_front", (PyCFunction)FrsCurve_push_vertex_front, METH_VARARGS | METH_KEYWORDS,
FrsCurve_push_vertex_front_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------CurvePoint get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h
index 990d8fb5b24..05415662764 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_FRSCURVE_H__
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
index 9a39db0ee7e..73907467f66 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Stroke.h"
@@ -327,7 +323,7 @@ static PyMethodDef BPy_Stroke_methods[] = {
{"stroke_vertices_end", (PyCFunction)Stroke_stroke_vertices_end, METH_NOARGS, Stroke_stroke_vertices_end_doc},
{"__reversed__", (PyCFunction)Stroke_reversed, METH_NOARGS, Stroke_reversed_doc},
{"stroke_vertices_size", (PyCFunction)Stroke_stroke_vertices_size, METH_NOARGS, Stroke_stroke_vertices_size_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------Stroke get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h
index a22e5c2d006..869ff7d07d5 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_STROKE_H__
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
index 9119d8f999e..c047b678a64 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ViewEdge.h"
@@ -87,7 +83,7 @@ static PyObject *ViewEdge_update_fedges(BPy_ViewEdge *self)
static PyMethodDef BPy_ViewEdge_methods[] = {
{"update_fedges", (PyCFunction)ViewEdge_update_fedges, METH_NOARGS, ViewEdge_update_fedges_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------ViewEdge get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h
index 51af401f33b..81fd21fa092 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_VIEWEDGE_H__
diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
index 2d62918e291..0185fcc5ebe 100644
--- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Chain.h"
@@ -147,7 +143,7 @@ static PyMethodDef BPy_Chain_methods[] = {
Chain_push_viewedge_back_doc},
{"push_viewedge_front", (PyCFunction)Chain_push_viewedge_front, METH_VARARGS | METH_KEYWORDS,
Chain_push_viewedge_front_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*-----------------------BPy_Chain type definition ------------------------------*/
diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h
index 172dffff49b..3356b0144d6 100644
--- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h
+++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CHAIN_H__
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
index 319eee2945e..8d83c942d93 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_FEdgeSharp.h"
@@ -205,7 +201,7 @@ static Mathutils_Callback FEdgeSharp_mathutils_cb = {
FEdgeSharp_mathutils_get,
FEdgeSharp_mathutils_set,
FEdgeSharp_mathutils_get_index,
- FEdgeSharp_mathutils_set_index
+ FEdgeSharp_mathutils_set_index,
};
static unsigned char FEdgeSharp_mathutils_cb_index = -1;
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h
index 1c82453432b..be9adf311b6 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_FEDGESHARP_H__
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
index cf893ad9481..726fe97b3ea 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_FEdgeSmooth.h"
@@ -139,7 +135,7 @@ static Mathutils_Callback FEdgeSmooth_mathutils_cb = {
FEdgeSmooth_mathutils_get,
FEdgeSmooth_mathutils_set,
FEdgeSmooth_mathutils_get_index,
- FEdgeSmooth_mathutils_set_index
+ FEdgeSmooth_mathutils_set_index,
};
static unsigned char FEdgeSmooth_mathutils_cb_index = -1;
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h
index f3dfd796418..b460795228c 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_FEDGESMOOTH_H__
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
index edc49eb8004..f8bae0e5aca 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_AdjacencyIterator.h"
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
index 51fb3e5ebdc..775f8a2628d 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_ADJACENCYITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
index c07f94c9a05..994eb715fe3 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ChainPredicateIterator.h"
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h
index 733a16e3974..2fab8671239 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CHAINPREDICATEITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
index 5a6e838dcc6..73e178a6706 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ChainSilhouetteIterator.h"
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h
index e76c04a6640..7c5974ec218 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CHAINSILHOUETTEITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
index 1dadfbced03..afd7f6f69c6 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ChainingIterator.h"
@@ -163,7 +159,7 @@ static PyObject *ChainingIterator_traverse(BPy_ChainingIterator *self, PyObject
static PyMethodDef BPy_ChainingIterator_methods[] = {
{"init", (PyCFunction) ChainingIterator_init, METH_NOARGS, ChainingIterator_init_doc},
{"traverse", (PyCFunction) ChainingIterator_traverse, METH_VARARGS | METH_KEYWORDS, ChainingIterator_traverse_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------ChainingIterator get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h
index 72015e6a0d9..898662c4f09 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CHAININGITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
index 0329aa99acc..1caf0e9eb58 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_CurvePointIterator.h"
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h
index 8c93ac2c014..41a3007d12c 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CURVEPOINTITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
index 7419f0ed127..6e3606c0041 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Interface0DIterator.h"
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h
index 5b1b70f19e8..7379ec5112d 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_INTERFACE0DITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
index ccf52c64757..ef8e1135139 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_SVertexIterator.h"
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h
index a430e4e7876..43e67af1183 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_SVERTEXITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
index 96a8bee9394..f39f95fda2d 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_StrokeVertexIterator.h"
@@ -197,7 +193,7 @@ static PyMethodDef BPy_StrokeVertexIterator_methods[] = {
{"incremented", (PyCFunction)StrokeVertexIterator_incremented, METH_NOARGS, StrokeVertexIterator_incremented_doc},
{"decremented", (PyCFunction)StrokeVertexIterator_decremented, METH_NOARGS, StrokeVertexIterator_decremented_doc},
{"reversed", (PyCFunction)StrokeVertexIterator_reversed, METH_NOARGS, StrokeVertexIterator_reversed_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------StrokeVertexIterator get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h
index 18bad65b00a..22bdf3341c4 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_STROKEVERTEXITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
index 4a45be8caa5..efd0aafbc17 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ViewEdgeIterator.h"
@@ -110,7 +106,7 @@ static PyObject *ViewEdgeIterator_change_orientation(BPy_ViewEdgeIterator *self)
static PyMethodDef BPy_ViewEdgeIterator_methods[] = {
{"change_orientation", (PyCFunction) ViewEdgeIterator_change_orientation, METH_NOARGS,
ViewEdgeIterator_change_orientation_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*----------------------ViewEdgeIterator get/setters ----------------------------*/
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h
index 47244dcb5f2..83c1512e239 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_VIEWEDGEITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
index d879ac53aaa..4ef1eca4e0a 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_orientedViewEdgeIterator.h"
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h
index bb1207aa46b..226535e3882 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_ORIENTEDVIEWEDGEITERATOR_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp
index 26b83791585..1fa26efdbce 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_BackboneStretcherShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h
index 82d39a853bd..037a06725c1 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_BACKBONESTRETCHERSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp
index df076e0453a..4bb86a0bb0e 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_BezierCurveShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h
index 6982661366f..ea289bbbf62 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_BEZIERCURVESHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp
index 0e603e00f97..91a95d054cd 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_BlenderTextureShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h
index c4fead6a4e4..7fdc3b4f9fd 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_BLENDERTEXTURESHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp
index fb85ee5a792..33734313857 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_CalligraphicShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h
index 6212a8f1d44..1932e5e4dc2 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CALLIGRAPHICSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp
index c4ed45ec820..3e5da7289fa 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ColorNoiseShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h
index 5bce58f9f10..0ee5964641d 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_COLORNOISESHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp
index 6607d5798f4..99dc4a07370 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ConstantColorShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h
index a34db21a873..ad0ddeb23f2 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CONSTANTCOLORSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp
index c8cc41303d8..511ac47b74b 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ConstantThicknessShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h
index 237b550b557..d07ab7250f9 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CONSTANTTHICKNESSSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp
index 6e1886398b6..f50d496b03a 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ConstrainedIncreasingThicknessShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h
index 124ce33aa8b..2c53ee40db4 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CONSTRAINEDINCREASINGTHICKNESSSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp
index 0c9b26fa434..79566195633 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GuidingLinesShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h
index 0fc4ce822c3..1603efce35a 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GUIDINGLINESSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp
index 1ed98d62dd9..a27092d9c61 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_IncreasingColorShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h
index db51fac1bd6..812b8df1271 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_INCREASINGCOLORSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp
index c9c38a9b70a..34b62b02a39 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_IncreasingThicknessShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h
index 809921ffe93..08c2a067d13 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_INCREASINGTHICKNESSSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp
index f5df1ed929f..3444272d77a 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_PolygonalizationShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h
index 023c8ff9fad..dc314c29294 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_POLYGONALIZATIONSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp
index 2fa7b00a3b7..cb8af522798 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_SamplingShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h
index ece206a5be4..e474e836f11 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_SAMPLINGSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp
index 750dc6b9eb1..870af96caf2 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_SmoothingShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h
index 5f45397c06a..35f046a6d4f 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHONSMOOTHINGSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp
index b28c3bd0f96..5f1c1cb7b0d 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_SpatialNoiseShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h
index d7dfe6a6644..73fd0c32f45 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_SPATIALNOISESHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp
index 33962f8e41a..8f7c3728be4 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_StrokeTextureStepShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h
index 038d0022dec..97522da52fd 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_STROKETEXTURESTEPSHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp
index acd4f4172fb..3ba2cec4dae 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ThicknessNoiseShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h
index 3dd77c750f7..ec18ae24966 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_THICKNESSNOISESHADER_H__
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp
index 543cd17c01e..1d33aeb559b 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_TipRemoverShader.h"
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h
index c0c5b024153..9615c4caff8 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_TIPREMOVERSHADER_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
index 06ba12145c0..ebd67c124ea 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0DDouble.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h
index bcf201e3b25..b31297394e6 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DDOUBLE_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
index 02aac5c2dfc..816fd622927 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0DEdgeNature.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h
index ce335f8ad0f..f178c8eff39 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DEDGENATURE_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
index b429b572e4e..4ee2057bafa 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0DFloat.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h
index ea0903701ec..a36b6046a6f 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DFLOAT_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
index e3f9dd1a2c7..43f73a3fedc 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0DId.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h
index e736cbaf1f9..b0c07db56e8 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DID_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
index 7d4e4c09caa..1cfdcd23ad6 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0DMaterial.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h
index 8be2041158c..53035601ef2 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DMATERIAL_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
index 0fbc0ef3472..3aa1edb70a8 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0DUnsigned.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h
index a0c9209da31..3205a2a01dc 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DUNSIGNED_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
index 15a88be874a..025d2801fbf 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0DVec2f.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h
index 33b069e3bc3..974298c290b 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DVEC2F_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
index 9983355fe57..53b3610ea2d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0DVec3f.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h
index da5f27ffb8c..fb938f019ad 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DVEC3F_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
index 2a61dfb075a..ac3eb72038c 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0DVectorViewShape.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h
index c51942c78ac..bbcef5add69 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DVECTORVIEWSHAPE_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
index 94e373d872a..9ee302e4a5c 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction0DViewShape.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h
index b7c67749d78..d94cc89c3fc 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION0DVIEWSHAPE_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp
index 841338ef81c..1019c2495a2 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ShapeIdF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h
index 3c2a0112ca4..c4794e7cbda 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_SHAPEIDF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp
index cbb905dcf2e..8333a7dad74 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_MaterialF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h
index d080976d7db..10f7b11eb32 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_MATERIALF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp
index 41ce2f5d197..c67a7efc92f 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_CurveNatureF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h
index 7a79c89f468..8a60c28beaa 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CURVENATUREF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp
index bfe060bc046..5cd92790ea5 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Normal2DF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h
index 60f9fa87f47..590b8f201eb 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_NORMAL2DF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp
index 70d122bd97a..52aabb351ad 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_VertexOrientation2DF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h
index 20014038704..157737e3f4d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_VERTEXORIENTATION2DF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp
index 6b010af4228..c3d30d9b7e5 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_VertexOrientation3DF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h
index e3a3a696ff5..0254de71b68 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_VERTEXORIENTATION3DF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp
index ba16fec1539..3636ecead72 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetOccludeeF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h
index 02b6ee44e4e..606049b1461 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETOCCLUDEEF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp
index 5e4111de924..f3f8c028a96 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetShapeF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h
index fa25061dd08..3033c98671c 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETSHAPEF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp
index 55f7bab3bb3..e0c2582e841 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Curvature2DAngleF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h
index e9602363461..9f7e5f54c6a 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CURVATURE2DANGLEF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp
index 2aac3f4f1f0..912b56d5555 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_DensityF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h
index 7f29affd131..55fd8042654 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_DENSITYF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp
index 123772b3fc7..7c75b96c2ec 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetProjectedXF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h
index ff01bc0a296..7fedc2eedf8 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETPROJECTEDXF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp
index f4e3d6ba76f..c3c42372361 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetProjectedYF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h
index d2b8798e237..d1a5d754103 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETPROJECTEDYF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp
index 116bb75fc55..3a3cfb96404 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetProjectedZF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h
index fa8a8c39d20..00e933ba88e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETPROJECTEDZF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp
index 614e92cf7c2..063d1470bb7 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetXF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h
index 27e1d17d007..8d29f401faf 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETXF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp
index 1a953b9ebca..9c22ac1acbc 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetYF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h
index 91a24935472..56cf07992d7 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETYF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp
index c985e0f5c99..5c280d74d59 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetZF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h
index 2c1cea52d91..944e575937f 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETZF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp
index 3c7f3b412fe..775c058e882 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_LocalAverageDepthF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h
index 308aa0f381a..951b036f72a 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp
index f0c58352f4a..7b3a2f568d2 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ZDiscontinuityF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h
index 1cf202cbed9..ccfb186fb28 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_ZDISCONTINUITYF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp
index a2358e6ebae..726412428a6 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetCurvilinearAbscissaF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h
index 83defbd21ca..33d268afce2 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETCURVILINEARABSCISSAF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp
index 43061747398..c6c3d351f8f 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetParameterF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h
index 24fe5cdb6e8..3917c27db77 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETPARAMETERF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp
index cecec01dcb5..d56fc8fb321 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetViewMapGradientNormF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h
index 200bbb67c52..24a8bef6277 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp
index 313826f9307..f04284cdb22 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ReadCompleteViewMapPixelF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h
index e4e1707c5f7..53afad75533 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_READCOMPLETEVIEWMAPPIXELF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp
index 8bfccf4c80a..eb1e8c8c068 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ReadMapPixelF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h
index c73a258b717..3c6a05d8233 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_READMAPPIXELF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp
index b36ddf84e71..99f87dfcdee 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ReadSteerableViewMapPixelF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h
index d2ba4990eb7..07d9b4996de 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_READSTEERABLEVIEWMAPPIXELF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp
index 8ec982815c8..6569c8a8c1f 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_QuantitativeInvisibilityF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h
index 142c5b7c04e..cf2bfaac9b6 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp
index 5504bff74ae..e0753337d1b 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetOccludersF0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h
index d87ef720786..0c74fcd5234 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETOCCLUDERSF0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
index 1f5444d7beb..5d6863d4e8e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction1DDouble.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h
index 5b56525f973..0335356e207 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DDOUBLE_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
index 3f0611dba84..41fcab32746 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction1DEdgeNature.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h
index 6f38e774107..fbe3759d48a 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DEDGENATURE_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
index b3b27aabade..4e0ac9fac12 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction1DFloat.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h
index 6d8a4d32ab8..4b269783712 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DFLOAT_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
index 0814eafb18e..8bb551de823 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction1DUnsigned.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h
index 8a1f5ca4dff..28f2bd7270c 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DUNSIGNED_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
index f7f4fea02ae..525218374a7 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction1DVec2f.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h
index eb7c2bb5cae..56a10d8c1eb 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DVEC2F_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
index 980df2c2268..ace1fb7f153 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction1DVec3f.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h
index 4780c54da9d..57257bec850 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DVEC3F_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
index 5eba1573d80..1be830c2e89 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction1DVectorViewShape.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h
index 974070198ab..575d0a272c8 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DVECTORVIEWSHAPE_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
index 7a83a49b9d2..01636d76084 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_UnaryFunction1DVoid.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h
index 03f8446fd45..cbc74bda99b 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_UNARYFUNCTION1DVOID_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp
index 55092416cc2..77c8d48305d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_CurveNatureF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h
index c911155526b..211f7148fef 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CURVENATUREF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp
index 76330c77927..e77a05c1373 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Normal2DF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h
index ac4efabc179..00bb526e92d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_NORMAL2DF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp
index 07aa9071c57..a216b19dacc 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Orientation2DF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h
index 159e98e2fec..fb0c00c0277 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_ORIENTATION2DF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp
index 56dd67b1d2f..80f1bac5d41 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Orientation3DF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h
index 50d5427600f..592337052f7 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_ORIENTATION3DF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp
index e5779ce36e1..f780e15a578 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_Curvature2DAngleF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h
index 457154e02c6..a5f81f6d99f 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CURVATURE2DANGLEF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp
index ffee3ec81f2..9059516e8fc 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_DensityF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h
index c1f0685a967..6483a3fb87c 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_DENSITYF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp
index 9164032488e..62039c8df87 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetCompleteViewMapDensityF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h
index b9706c2c7a9..5b05aed0d06 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETCOMPLETEVIEWMAPDENSITYF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
index 041bb60b507..4fd2b3c9d3f 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetDirectionalViewMapDensityF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h
index 3168a72af5f..cf91eed1a70 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETDIRECTIONALVIEWMAPDENSITYF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp
index 290b43e5ea6..421a5eae8dd 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetProjectedXF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h
index 556aedaaba7..4f66a3db389 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETPROJECTEDXF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp
index 7d9f7461908..4e45c29ac1a 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetProjectedYF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h
index cd786bf0fa1..6869aa4a7fc 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETPROJECTEDYF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp
index b8e8cf5e57e..5f7ee3456e7 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetProjectedZF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h
index fda8df45b2c..d643aeccc4f 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETPROJECTEDZF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp
index c67485e7d36..ad56182d065 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetSteerableViewMapDensityF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h
index 60707ebf078..ce80107a6d9 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETSTEERABLEVIEWMAPDENSITYF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp
index ebcb273082e..23eae370434 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetViewMapGradientNormF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h
index 69dd7994bb5..4d4f562c9d1 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETVIEWMAPGRADIENTNORMF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp
index b55a4a79fe9..f02b5cd4ad5 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetXF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h
index 24d209b5439..2e548a76cba 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETXF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp
index d760ef948f0..2bb6011dc84 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetYF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h
index 421ec0e393a..eedec9929d3 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETYF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp
index 72a8b22630d..1c334c5089d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetZF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h
index 844e18e1cab..b8c5107add7 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETZF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp
index 424f08c07c0..992c620f5e9 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_LocalAverageDepthF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h
index f743dcb53cd..5bcb3130d70 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_LOCALAVERAGEDEPTHF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp
index 488675142b6..e0511734e75 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ZDiscontinuityF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h
index 31b0edf309b..22d6fdac96d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_ZDISCONTINUITYF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp
index a21efd655ab..eccf788c631 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_QuantitativeInvisibilityF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h
index 30439a35817..edaeea2a2d9 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp
index e4e7560822d..4b5fee581f7 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetOccludeeF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h
index 0c7aed2eb46..6e619ffd42e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETOCCLUDEEF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp
index ced04a5077a..a42064be52c 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetOccludersF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h
index 1d0a8a79f2b..93f1fef2167 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETOCCLUDERSF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp
index f26f8105a9e..1ef8502dfbe 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_GetShapeF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h
index 72ce1dde537..6f2ec2bec1d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_GETSHAPEF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp
index 128deeccd11..4f3a8c00cbd 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ChainingTimeStampF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h
index 968ab25da3b..860cbd47e81 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CHAININGTIMESTAMPF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp
index 64a92a8e357..55536d9aff8 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_IncrementChainingTimeStampF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h
index e55e189d140..4e27c628cef 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_INCREMENTCHAININGTIMESTAMPF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp
index 2cd359eea61..d21aa97b591 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_TimeStampF1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h
index 0117231c4f1..c5c58f40080 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_TIMESTAMPF1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp
index 36511e01358..f2ba1f7aafb 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_FalseUP0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h
index e083ba935cb..dbc395fc2f4 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_FALSEUP0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp
index f5da320a31c..fd79c44da43 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_TrueUP0D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h
index d13e8473d52..9dd4a5ecd34 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_TRUEUP0D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp
index d0ced2ad4c3..5a20dd323f6 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ContourUP1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h
index 154a268538c..32f9080173f 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_CONTOURUP1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp
index 807d76f4731..75df852ddfa 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_DensityLowerThanUP1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h
index beed0ce0ed9..e8ea1daca19 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_DENSITYLOWERTHANUP1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
index f8a7ff8650c..ea885e74174 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_EqualToChainingTimeStampUP1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h
index f4ca8a82a20..a542c53a88b 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_EQUALTOCHAININGTIMESTAMPUP1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
index ffed4f966e6..280e7088628 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_EqualToTimeStampUP1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h
index 8bd222c7430..b27509e7205 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_EQUALTOTIMESTAMPUP1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp
index 140ebb86454..3b00ab2dba8 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ExternalContourUP1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h
index cc346a8c814..91140eb9670 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_EXTERNALCONTOURUP1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp
index 2d1e99aed2b..a3a0d8c544c 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_FalseUP1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h
index adce6ad68c9..d138f9d7f9f 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_FALSEUP1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp
index 806ad8168ac..eb4968484fc 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_QuantitativeInvisibilityUP1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h
index 8450e383277..bfd7302b0e1 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_QUANTITATIVEINVISIBILITYUP1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
index 93970972aac..adf44287582 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_ShapeUP1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h
index 2cea311ce20..9cfeded4452 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_SHAPEUP1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp
index d4ca82721d5..d1562dfa692 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_TrueUP1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h
index 69467ee1733..5d4420a2ccd 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_TRUEUP1D_H__
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp
index 6f08cd1c796..26269c34dc7 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "BPy_WithinImageBoundaryUP1D.h"
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h
index 696f5d3063c..39eb3f34b7f 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#ifndef __FREESTYLE_PYTHON_WITHINIMAGEBOUNDARYUP1D_H__
diff --git a/source/blender/freestyle/intern/scene_graph/DrawingStyle.h b/source/blender/freestyle/intern/scene_graph/DrawingStyle.h
index 192fa76c497..5ad16845327 100644
--- a/source/blender/freestyle/intern/scene_graph/DrawingStyle.h
+++ b/source/blender/freestyle/intern/scene_graph/DrawingStyle.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_DRAWING_STYLE_H__
#define __FREESTYLE_DRAWING_STYLE_H__
-/** \file blender/freestyle/intern/scene_graph/DrawingStyle.h
- * \ingroup freestyle
- * \brief Class to define the drawing style of a node
- * \author Stephane Grabli
- * \date 10/10/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the drawing style of a node
*/
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h
index 48b0aabffb6..2a830a40da8 100644
--- a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h
+++ b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_MATERIAL_H__
#define __FREESTYLE_MATERIAL_H__
-/** \file blender/freestyle/intern/scene_graph/FrsMaterial.h
- * \ingroup freestyle
- * \brief Class used to handle materials.
- * \author Stephane Grabli
- * \date 10/10/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class used to handle materials.
*/
#include "../system/FreestyleConfig.h"
diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
index 6f5491fc8ef..d39f6fac75d 100644
--- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
+++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
- * \ingroup freestyle
- * \brief A Set of indexed faces to represent a surfacic object
- * \author Stephane Grabli
- * \date 22/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief A Set of indexed faces to represent a surfacic object
*/
#include "IndexedFaceSet.h"
diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h
index aa090155537..d5a2cad86dc 100644
--- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h
+++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_INDEXED_FACE_SET_H__
#define __FREESTYLE_INDEXED_FACE_SET_H__
-/** \file blender/freestyle/intern/scene_graph/IndexedFaceSet.h
- * \ingroup freestyle
- * \brief A Set of indexed faces to represent a surfacic object
- * \author Stephane Grabli
- * \date 22/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief A Set of indexed faces to represent a surfacic object
*/
#include <memory.h>
diff --git a/source/blender/freestyle/intern/scene_graph/LineRep.cpp b/source/blender/freestyle/intern/scene_graph/LineRep.cpp
index a35920a4f4c..8484aea0376 100644
--- a/source/blender/freestyle/intern/scene_graph/LineRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/LineRep.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/LineRep.cpp
- * \ingroup freestyle
- * \brief Class to define the representation of 3D Line.
- * \author Stephane Grabli
- * \date 26/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the representation of 3D Line.
*/
#include "LineRep.h"
diff --git a/source/blender/freestyle/intern/scene_graph/LineRep.h b/source/blender/freestyle/intern/scene_graph/LineRep.h
index 6d1ac2825c0..a7349240e3b 100644
--- a/source/blender/freestyle/intern/scene_graph/LineRep.h
+++ b/source/blender/freestyle/intern/scene_graph/LineRep.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_LINE_REP_H__
#define __FREESTYLE_LINE_REP_H__
-/** \file blender/freestyle/intern/scene_graph/LineRep.h
- * \ingroup freestyle
- * \brief Class to define the representation of 3D Line.
- * \author Stephane Grabli
- * \date 26/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the representation of 3D Line.
*/
#include <list>
diff --git a/source/blender/freestyle/intern/scene_graph/Node.h b/source/blender/freestyle/intern/scene_graph/Node.h
index 4ddcadd3542..5fbbc797ebf 100644
--- a/source/blender/freestyle/intern/scene_graph/Node.h
+++ b/source/blender/freestyle/intern/scene_graph/Node.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_NODE_H__
#define __FREESTYLE_NODE_H__
-/** \file blender/freestyle/intern/scene_graph/Node.h
- * \ingroup freestyle
- * \brief Abstract class for scene graph nodes. Inherits from BaseObject which defines the addRef release mechanism.
- * \author Stephane Grabli
- * \date 24/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Abstract class for scene graph nodes. Inherits from BaseObject which defines the addRef release mechanism.
*/
#include "SceneVisitor.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp b/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp
index 33f40b5778f..3413cd125c7 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/NodeCamera.cpp
- * \ingroup freestyle
- * \brief Class to represent a light node
- * \author Stephane Grabli
- * \date 25/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a light node
*/
#include <math.h>
diff --git a/source/blender/freestyle/intern/scene_graph/NodeCamera.h b/source/blender/freestyle/intern/scene_graph/NodeCamera.h
index b5021671873..cbff332849c 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeCamera.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeCamera.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_NODE_CAMERA_H__
#define __FREESTYLE_NODE_CAMERA_H__
-/** \file blender/freestyle/intern/scene_graph/NodeCamera.h
- * \ingroup freestyle
- * \brief Class to represent a light node
- * \author Stephane Grabli
- * \date 25/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a light node
*/
#include "Node.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp
index 5868cb92971..c94ee961881 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp
- * \ingroup freestyle
- * \brief Class to define a Drawing Style to be applied to the underlying children. Inherits from NodeGroup.
- * \author Stephane Grabli
- * \date 06/02/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a Drawing Style to be applied to the underlying children. Inherits from NodeGroup.
*/
#include "NodeDrawingStyle.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h
index d053d67c6ba..f7bef20bc8f 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_NODE_DRAWING_STYLE_H__
#define __FREESTYLE_NODE_DRAWING_STYLE_H__
-/** \file blender/freestyle/intern/scene_graph/NodeDrawingStyle.h
- * \ingroup freestyle
- * \brief Class to define a Drawing Style to be applied to the underlying children. Inherits from NodeGroup.
- * \author Stephane Grabli
- * \date 06/02/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a Drawing Style to be applied to the underlying children. Inherits from NodeGroup.
*/
#include "DrawingStyle.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp b/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp
index 35d39dcf667..ee1f0b71b20 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/NodeGroup.cpp
- * \ingroup freestyle
- * \brief Class to represent a group node. This node can contains several children.
- * \brief It also contains a transform matrix indicating the transform state of the underlying children.
- * \author Stephane Grabli
- * \date 24/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a group node. This node can contains several children.
+ * \brief It also contains a transform matrix indicating the transform state of the underlying children.
*/
#include "NodeGroup.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.h b/source/blender/freestyle/intern/scene_graph/NodeGroup.h
index e8e58b0915e..23a168eba01 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeGroup.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_NODE_GROUP_H__
#define __FREESTYLE_NODE_GROUP_H__
-/** \file blender/freestyle/intern/scene_graph/NodeGroup.h
- * \ingroup freestyle
- * \brief Class to represent a group node. This node can contains several children.
- * \brief It also contains a transform matrix indicating the transform state of the underlying children.
- * \author Stephane Grabli
- * \date 24/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a group node. This node can contains several children.
+ * \brief It also contains a transform matrix indicating the transform state of the underlying children.
*/
#include <vector>
diff --git a/source/blender/freestyle/intern/scene_graph/NodeLight.cpp b/source/blender/freestyle/intern/scene_graph/NodeLight.cpp
index 9e15f6c1eee..9e513f6a488 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeLight.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeLight.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/NodeLight.cpp
- * \ingroup freestyle
- * \brief Class to represent a light node
- * \author Stephane Grabli
- * \date 25/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a light node
*/
#include "NodeLight.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeLight.h b/source/blender/freestyle/intern/scene_graph/NodeLight.h
index 10d6f657872..4381d047540 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeLight.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeLight.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_NODE_LIGHT_H__
#define __FREESTYLE_NODE_LIGHT_H__
-/** \file blender/freestyle/intern/scene_graph/NodeLight.h
- * \ingroup freestyle
- * \brief Class to represent a light node
- * \author Stephane Grabli
- * \date 25/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a light node
*/
#include "Node.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeShape.cpp b/source/blender/freestyle/intern/scene_graph/NodeShape.cpp
index 1c1db9d9638..56c8068ad62 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeShape.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeShape.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/NodeShape.cpp
- * \ingroup freestyle
- * \brief Class to build a shape node. It contains a Rep, which is the shape geometry
- * \author Stephane Grabli
- * \date 25/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to build a shape node. It contains a Rep, which is the shape geometry
*/
#include "NodeShape.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeShape.h b/source/blender/freestyle/intern/scene_graph/NodeShape.h
index 351ccb8f743..f0dd24a9d14 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeShape.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeShape.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_NODE_SHAPE_H__
#define __FREESTYLE_NODE_SHAPE_H__
-/** \file blender/freestyle/intern/scene_graph/NodeShape.h
- * \ingroup freestyle
- * \brief Class to build a shape node. It contains a Rep, which is the shape geometry
- * \author Stephane Grabli
- * \date 25/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to build a shape node. It contains a Rep, which is the shape geometry
*/
#include <vector>
diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
index 8a25fe142d1..b4af715b3e4 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/NodeTransform.cpp
- * \ingroup freestyle
- * \brief Class to represent a transform node. A Transform node contains one or several children,
- * \brief all affected by the transformation.
- * \author Stephane Grabli
- * \date 06/02/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a transform node. A Transform node contains one or several children,
+ * \brief all affected by the transformation.
*/
#include "NodeTransform.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.h b/source/blender/freestyle/intern/scene_graph/NodeTransform.h
index c4de08ac4a7..29760cd1951 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeTransform.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_NODE_TRANSFORM_H__
#define __FREESTYLE_NODE_TRANSFORM_H__
-/** \file blender/freestyle/intern/scene_graph/NodeTransform.h
- * \ingroup freestyle
- * \brief Class to represent a transform node. A Transform node contains one or several children,
- * \brief all affected by the transformation.
- * \author Stephane Grabli
- * \date 06/02/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a transform node. A Transform node contains one or several children,
+ * \brief all affected by the transformation.
*/
#include "NodeGroup.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.cpp b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.cpp
index 701c5caa91d..24e1e88afa0 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,13 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/NodeViewLayer.cpp
- * \ingroup freestyle
- * \brief Class to represent a scene render layer in Blender.
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a scene render layer in Blender.
*/
#include "NodeViewLayer.h"
diff --git a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h
index cc64fda60b6..9a646208dec 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_NODE_VIEW_LAYER_H__
#define __FREESTYLE_NODE_VIEW_LAYER_H__
-/** \file blender/freestyle/intern/scene_graph/NodeViewLayer.h
- * \ingroup freestyle
- * \brief Class to represent a view layer in Blender.
+/** \file
+ * \ingroup freestyle
+ * \brief Class to represent a view layer in Blender.
*/
#include "Node.h"
diff --git a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp
index 2c397cd18fc..ba1dfe7478e 100644
--- a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/OrientedLineRep.cpp
- * \ingroup freestyle
- * \brief Class to display an oriented line representation.
- * \author Stephane Grabli
- * \date 24/10/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to display an oriented line representation.
*/
#include "OrientedLineRep.h"
diff --git a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h
index 8fafe72ac51..af06840419e 100644
--- a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h
+++ b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_ORIENTED_LINE_REP_H__
#define __FREESTYLE_ORIENTED_LINE_REP_H__
-/** \file blender/freestyle/intern/scene_graph/OrientedLineRep.h
- * \ingroup freestyle
- * \brief Class to display an oriented line representation.
- * \author Stephane Grabli
- * \date 24/10/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to display an oriented line representation.
*/
#include "LineRep.h"
diff --git a/source/blender/freestyle/intern/scene_graph/Rep.cpp b/source/blender/freestyle/intern/scene_graph/Rep.cpp
index c3386252c67..94f6e1fa9d3 100644
--- a/source/blender/freestyle/intern/scene_graph/Rep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/Rep.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/Rep.cpp
- * \ingroup freestyle
- * \brief Base class for all shapes. Inherits from BasicObjects for references counter management (addRef, release).
- * \author Stephane Grabli
- * \date 25/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Base class for all shapes. Inherits from BasicObjects for references counter management (addRef, release).
*/
#include "Rep.h"
diff --git a/source/blender/freestyle/intern/scene_graph/Rep.h b/source/blender/freestyle/intern/scene_graph/Rep.h
index 222653b2433..db4e9e6782b 100644
--- a/source/blender/freestyle/intern/scene_graph/Rep.h
+++ b/source/blender/freestyle/intern/scene_graph/Rep.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_REP_H__
#define __FREESTYLE_REP_H__
-/** \file blender/freestyle/intern/scene_graph/Rep.h
- * \ingroup freestyle
- * \brief Base class for all shapes. Inherits from BasicObjects for references counter management (addRef, release).
- * \author Stephane Grabli
- * \date 25/01/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Base class for all shapes. Inherits from BasicObjects for references counter management (addRef, release).
*/
#include <string>
diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
index 16c353678c1..fcecb67cae9 100644
--- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
+++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/SceneHash.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "SceneHash.h"
diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.h b/source/blender/freestyle/intern/scene_graph/SceneHash.h
index 662b4bba8f1..4c6bd6216d0 100644
--- a/source/blender/freestyle/intern/scene_graph/SceneHash.h
+++ b/source/blender/freestyle/intern/scene_graph/SceneHash.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_SCENE_HASH_H__
#define __FREESTYLE_SCENE_HASH_H__
-/** \file blender/freestyle/intern/scene_graph/SceneHash.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "IndexedFaceSet.h"
diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
index e7041f04cf0..29da69a37ee 100644
--- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
+++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
- * \ingroup freestyle
- * \brief Class to display textual information about a scene graph.
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 26/04/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to display textual information about a scene graph.
*/
#include <iomanip>
diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h
index e3fe5ee4d78..715f78ab044 100644
--- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h
+++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_SCENE_PRETTY_PRINTER_H__
#define __FREESTYLE_SCENE_PRETTY_PRINTER_H__
-/** \file blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h
- * \ingroup freestyle
- * \brief Class to display textual information about a scene graph.
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 26/04/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to display textual information about a scene graph.
*/
#include <fstream>
diff --git a/source/blender/freestyle/intern/scene_graph/SceneVisitor.cpp b/source/blender/freestyle/intern/scene_graph/SceneVisitor.cpp
index 373dc438b1b..417dc381eec 100644
--- a/source/blender/freestyle/intern/scene_graph/SceneVisitor.cpp
+++ b/source/blender/freestyle/intern/scene_graph/SceneVisitor.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/SceneVisitor.cpp
- * \ingroup freestyle
- * \brief Class to visit (without doing anything) a scene graph structure
- * \author Emmanuel Turquin
- * \date 26/04/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to visit (without doing anything) a scene graph structure
*/
#include "SceneVisitor.h"
diff --git a/source/blender/freestyle/intern/scene_graph/SceneVisitor.h b/source/blender/freestyle/intern/scene_graph/SceneVisitor.h
index d76e48980bf..67b89f014cf 100644
--- a/source/blender/freestyle/intern/scene_graph/SceneVisitor.h
+++ b/source/blender/freestyle/intern/scene_graph/SceneVisitor.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_SCENE_VISITOR_H__
#define __FREESTYLE_SCENE_VISITOR_H__
-/** \file blender/freestyle/intern/scene_graph/SceneVisitor.h
- * \ingroup freestyle
- * \brief Class to visit (without doing anything) a scene graph structure
- * \author Emmanuel Turquin
- * \date 26/04/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to visit (without doing anything) a scene graph structure
*/
#include "../system/FreestyleConfig.h"
diff --git a/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp b/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp
index 98efefb8314..dbd5efc65f5 100644
--- a/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/TriangleRep.cpp
- * \ingroup freestyle
- * \brief Class to define the represenation of a triangle
- * \author Stephane Grabli
- * \date 16/12/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the represenation of a triangle
*/
#include "TriangleRep.h"
diff --git a/source/blender/freestyle/intern/scene_graph/TriangleRep.h b/source/blender/freestyle/intern/scene_graph/TriangleRep.h
index 353555b2802..364943a14ba 100644
--- a/source/blender/freestyle/intern/scene_graph/TriangleRep.h
+++ b/source/blender/freestyle/intern/scene_graph/TriangleRep.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_TRIANGLE_REP_H__
#define __FREESTYLE_TRIANGLE_REP_H__
-/** \file blender/freestyle/intern/scene_graph/TriangleRep.h
- * \ingroup freestyle
- * \brief Class to define the represenation of a triangle
- * \author Stephane Grabli
- * \date 16/12/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the represenation of a triangle
*/
//! inherits from class Rep
diff --git a/source/blender/freestyle/intern/scene_graph/VertexRep.cpp b/source/blender/freestyle/intern/scene_graph/VertexRep.cpp
index 475c6d6d153..47462d0f497 100644
--- a/source/blender/freestyle/intern/scene_graph/VertexRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/VertexRep.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/scene_graph/VertexRep.cpp
- * \ingroup freestyle
- * \brief Class to define the representation of a vertex for displaying purpose.
- * \author Stephane Grabli
- * \date 03/04/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the representation of a vertex for displaying purpose.
*/
#include "VertexRep.h"
diff --git a/source/blender/freestyle/intern/scene_graph/VertexRep.h b/source/blender/freestyle/intern/scene_graph/VertexRep.h
index 87420429e00..8d3e66d7323 100644
--- a/source/blender/freestyle/intern/scene_graph/VertexRep.h
+++ b/source/blender/freestyle/intern/scene_graph/VertexRep.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_VERTEX_REP_H__
#define __FREESTYLE_VERTEX_REP_H__
-/** \file blender/freestyle/intern/scene_graph/VertexRep.h
- * \ingroup freestyle
- * \brief Class to define the representation of a vertex for displaying purpose.
- * \author Stephane Grabli
- * \date 03/04/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the representation of a vertex for displaying purpose.
*/
#include "Rep.h"
diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp
index 65de8471135..0047940a5b7 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp
+++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp
- * \ingroup freestyle
- * \brief Functions taking 0D input
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions taking 0D input
*/
#include "AdvancedFunctions0D.h"
diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h
index f47808e6fc8..5889f3c4ed3 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h
+++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_ADVANCED_FUNCTIONS_0D_H__
#define __FREESTYLE_ADVANCED_FUNCTIONS_0D_H__
-/** \file blender/freestyle/intern/stroke/AdvancedFunctions0D.h
- * \ingroup freestyle
- * \brief Functions taking 0D input
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions taking 0D input
*/
#include "../image/GaussianFilter.h"
diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
index 247217791a5..6d006dd395d 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
+++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
- * \ingroup freestyle
- * \brief Functions taking 1D input
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions taking 1D input
*/
#include "AdvancedFunctions1D.h"
diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h
index 6624d9d255c..6f5b2f34640 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h
+++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_ADVANCED_FUNCTIONS_1D_H__
#define __FREESTYLE_ADVANCED_FUNCTIONS_1D_H__
-/** \file blender/freestyle/intern/stroke/AdvancedFunctions1D.h
- * \ingroup freestyle
- * \brief Functions taking 1D input
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions taking 1D input
*/
#include "AdvancedFunctions0D.h"
diff --git a/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h b/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h
index 5fcabfe9e0e..e3bfae8289a 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h
+++ b/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_ADVANCED_PREDICATES_1D_H__
#define __FREESTYLE_ADVANCED_PREDICATES_1D_H__
-/** \file blender/freestyle/intern/stroke/AdvancedPredicates1D.h
- * \ingroup freestyle
- * \brief Class gathering stroke creation algorithms
- * \author Stephane Grabli
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class gathering stroke creation algorithms
*/
#include <string>
diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
index e37631e5bd6..247fde9a9c0 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
- * \ingroup freestyle
- * \brief Fredo's stroke shaders
- * \author Fredo Durand
- * \date 17/12/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Fredo's stroke shaders
*/
#include "AdvancedStrokeShaders.h"
diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h
index c3498003317..0e14e4f3631 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h
+++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_ADVANCED_STROKE_SHADERS_H__
#define __FREESTYLE_ADVANCED_STROKE_SHADERS_H__
-/** \file blender/freestyle/intern/stroke/AdvancedStrokeShaders.h
- * \ingroup freestyle
- * \brief Fredo's stroke shaders
- * \author Fredo Durand
- * \date 17/12/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Fredo's stroke shaders
*/
#include "BasicStrokeShaders.h"
@@ -68,7 +62,7 @@ protected:
/*! [ Geometry Shader ].
* Spatial Noise stroke shader.
* Moves the vertices to make the stroke more noisy.
- * \see \htmlonly <a href=noise/noise.html>noise/noise.html</a> \endhtmlonly
+ * \see \htmlonly <a href=noise/noise.html>noise/noise.html</a> \endhtmlonly
*/
class SpatialNoiseShader : public StrokeShader
{
@@ -106,7 +100,7 @@ protected:
* (Moves the vertices to make the stroke smoother).
* Uses curvature flow to converge towards a curve of constant curvature. The diffusion method we use is anisotropic
* to prevent the diffusion accross corners.
- * \see \htmlonly <a href=/smoothing/smoothing.html>smoothing/smoothing.html</a> \endhtmlonly
+ * \see \htmlonly <a href=/smoothing/smoothing.html>smoothing/smoothing.html</a> \endhtmlonly
*/
class SmoothingShader : public StrokeShader
{
diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
index eed90a53d77..0a925949617 100644
--- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
- * \ingroup freestyle
- * \brief Class gathering basic stroke shaders
- * \author Stephane Grabli
- * \date 17/12/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class gathering basic stroke shaders
*/
#include <fstream>
diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h
index 53e0d5b7175..55f393c03df 100644
--- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h
+++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_BASIC_STROKE_SHADERS_H__
#define __FREESTYLE_BASIC_STROKE_SHADERS_H__
-/** \file blender/freestyle/intern/stroke/BasicStrokeShaders.h
- * \ingroup freestyle
- * \brief Class gathering basic stroke shaders
- * \author Stephane Grabli
- * \date 17/12/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class gathering basic stroke shaders
*/
#include <fstream>
@@ -428,7 +422,7 @@ public:
/*! [ Geometry Shader. ]
* Resamples the stroke.
- * \see Stroke::Resample(float).
+ * \see Stroke::Resample(float).
*/
class SamplingShader: public StrokeShader
{
@@ -479,7 +473,7 @@ public:
/*! [ Geometry Shader ].
* Transforms the stroke backbone geometry so that it corresponds to a Bezier Curve approximation of the
* original backbone geometry.
- * \see \htmlonly <a href=bezier/bezier.html>bezier/bezier.html</a> \endhtmlonly
+ * \see \htmlonly <a href=bezier/bezier.html>bezier/bezier.html</a> \endhtmlonly
*/
class BezierCurveShader : public StrokeShader
{
diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp
index 63cb58b4042..ea5b8334d20 100644
--- a/source/blender/freestyle/intern/stroke/Canvas.cpp
+++ b/source/blender/freestyle/intern/stroke/Canvas.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/Canvas.cpp
- * \ingroup freestyle
- * \brief Class to define a canvas designed to draw style modules
- * \author Stephane Grabli
- * \date 20/10/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a canvas designed to draw style modules
*/
#include <sstream>
diff --git a/source/blender/freestyle/intern/stroke/Canvas.h b/source/blender/freestyle/intern/stroke/Canvas.h
index 7151a81cce2..9431b37395c 100644
--- a/source/blender/freestyle/intern/stroke/Canvas.h
+++ b/source/blender/freestyle/intern/stroke/Canvas.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CANVAS_H__
#define __FREESTYLE_CANVAS_H__
-/** \file blender/freestyle/intern/stroke/Canvas.h
- * \ingroup freestyle
- * \brief Class to define a canvas designed to draw style modules
- * \author Stephane Grabli
- * \date 20/10/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a canvas designed to draw style modules
*/
#include <cstring>
diff --git a/source/blender/freestyle/intern/stroke/Chain.cpp b/source/blender/freestyle/intern/stroke/Chain.cpp
index 0e8c2c9ae6f..53e5c24352c 100644
--- a/source/blender/freestyle/intern/stroke/Chain.cpp
+++ b/source/blender/freestyle/intern/stroke/Chain.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/Chain.cpp
- * \ingroup freestyle
- * \brief Class to define a chain of viewedges.
- * \author Stephane Grabli
- * \date 09/01/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a chain of viewedges.
*/
#include "Chain.h"
diff --git a/source/blender/freestyle/intern/stroke/Chain.h b/source/blender/freestyle/intern/stroke/Chain.h
index ec1250445fa..21421c7298f 100644
--- a/source/blender/freestyle/intern/stroke/Chain.h
+++ b/source/blender/freestyle/intern/stroke/Chain.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CHAIN_H__
#define __FREESTYLE_CHAIN_H__
-/** \file blender/freestyle/intern/stroke/Chain.h
- * \ingroup freestyle
- * \brief Class to define a chain of viewedges.
- * \author Stephane Grabli
- * \date 09/01/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a chain of viewedges.
*/
#include "Curve.h"
diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp
index 6cacdfedf21..08bdeb61713 100644
--- a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp
+++ b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/ChainingIterators.cpp
- * \ingroup freestyle
- * \brief Chaining iterators
- * \author Stephane Grabli
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Chaining iterators
*/
#include "../python/Director.h"
@@ -161,7 +155,7 @@ int ChainSilhouetteIterator::traverse(const AdjacencyIterator& ait)
Nature::EDGE_MARK,
Nature::SUGGESTIVE_CONTOUR,
Nature::VALLEY,
- Nature::RIDGE
+ Nature::RIDGE,
};
int numNatures = sizeof(natures) / sizeof(Nature::EdgeNature);
for (int i = 0; i < numNatures; ++i) {
diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.h b/source/blender/freestyle/intern/stroke/ChainingIterators.h
index a50a6596f96..ee9730edf2b 100644
--- a/source/blender/freestyle/intern/stroke/ChainingIterators.h
+++ b/source/blender/freestyle/intern/stroke/ChainingIterators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CHAINING_ITERATORS_H__
#define __FREESTYLE_CHAINING_ITERATORS_H__
-/** \file blender/freestyle/intern/stroke/ChainingIterators.h
- * \ingroup freestyle
- * \brief Chaining iterators
- * \author Stephane Grabli
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Chaining iterators
*/
#include <iostream>
diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp
index 052a6804815..f390b4edfb6 100644
--- a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp
+++ b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/ContextFunctions.cpp
- * \ingroup freestyle
- * \brief Functions related to context queries
- * \brief Interface to access the context related information.
- * \author Stephane Grabli
- * \date 20/12/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions related to context queries
+ * \brief Interface to access the context related information.
*/
#include "ContextFunctions.h"
diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.h b/source/blender/freestyle/intern/stroke/ContextFunctions.h
index 58953d021d9..190217c52f7 100644
--- a/source/blender/freestyle/intern/stroke/ContextFunctions.h
+++ b/source/blender/freestyle/intern/stroke/ContextFunctions.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CONTEXT_FUNCTIONS_H__
#define __FREESTYLE_CONTEXT_FUNCTIONS_H__
-/** \file blender/freestyle/intern/stroke/ContextFunctions.h
- * \ingroup freestyle
- * \brief Functions related to context queries
- * \brief Interface to access the context related information.
- * \author Stephane Grabli
- * \date 20/12/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions related to context queries
+ * \brief Interface to access the context related information.
*/
#include "Canvas.h"
@@ -65,40 +59,40 @@ void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels =
// ReadMapPixel
/*! Reads a pixel in a user-defined map
- * \return the floating value stored for that pixel
- * \param iMapName:
+ * \return the floating value stored for that pixel
+ * \param iMapName:
* The name of the map
- * \param level:
+ * \param level:
* The level of the pyramid in which we wish to read the pixel
- * \param x:
+ * \param x:
* The x-coordinate of the pixel we wish to read. The origin is in the lower-left corner.
- * \param y:
+ * \param y:
* The y-coordinate of the pixel we wish to read. The origin is in the lower-left corner.
*/
float ReadMapPixelCF(const char *iMapName, int level, unsigned x, unsigned y);
// ReadCompleteViewMapPixel
/*! Reads a pixel in the complete view map
- * \return the floating value stored for that pixel
- * \param level:
+ * \return the floating value stored for that pixel
+ * \param level:
* The level of the pyramid in which we wish to read the pixel
- * \param x:
+ * \param x:
* The x-coordinate of the pixel we wish to read. The origin is in the lower-left corner.
- * \param y:
+ * \param y:
* The y-coordinate of the pixel we wish to read. The origin is in the lower-left corner.
*/
float ReadCompleteViewMapPixelCF(int level, unsigned x, unsigned y);
// ReadOrientedViewMapPixel
/*! Reads a pixel in one of the oriented view map images
- * \return the floating value stored for that pixel
- * \param iOrientation:
+ * \return the floating value stored for that pixel
+ * \param iOrientation:
* The number telling which orientation we want to check
- * \param level:
+ * \param level:
* The level of the pyramid in which we wish to read the pixel
- * \param x:
+ * \param x:
* The x-coordinate of the pixel we wish to read. The origin is in the lower-left corner.
- * \param y:
+ * \param y:
* The y-coordinate of the pixel we wish to read. The origin is in the lower-left corner.
*/
float ReadDirectionalViewMapPixelCF(int iOrientation, int level, unsigned x, unsigned y);
diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp
index 52fd780ee43..f4439e1398c 100644
--- a/source/blender/freestyle/intern/stroke/Curve.cpp
+++ b/source/blender/freestyle/intern/stroke/Curve.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/Curve.cpp
- * \ingroup freestyle
- * \brief Class to define a container for curves
- * \author Stephane Grabli
- * \date 11/01/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a container for curves
*/
#include <stdio.h> /* printf */
diff --git a/source/blender/freestyle/intern/stroke/Curve.h b/source/blender/freestyle/intern/stroke/Curve.h
index 1b242d172b2..40c20fb777c 100644
--- a/source/blender/freestyle/intern/stroke/Curve.h
+++ b/source/blender/freestyle/intern/stroke/Curve.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CURVE_H__
#define __FREESTYLE_CURVE_H__
-/** \file blender/freestyle/intern/stroke/Curve.h
- * \ingroup freestyle
- * \brief Class to define a container for curves
- * \author Stephane Grabli
- * \date 11/01/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a container for curves
*/
#include <deque>
diff --git a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h
index 726c80d889c..0a56e674936 100644
--- a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h
+++ b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CURVE_ADVANCED_ITERATORS_H__
#define __FREESTYLE_CURVE_ADVANCED_ITERATORS_H__
-/** \file blender/freestyle/intern/stroke/CurveAdvancedIterators.h
- * \ingroup freestyle
- * \brief Iterators used to iterate over the elements of the Curve. Can't be used in python
- * \author Stephane Grabli
- * \date 01/08/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Iterators used to iterate over the elements of the Curve. Can't be used in python
*/
#include "Stroke.h"
diff --git a/source/blender/freestyle/intern/stroke/CurveIterators.h b/source/blender/freestyle/intern/stroke/CurveIterators.h
index cb33221cfd4..7b13abf9c0f 100644
--- a/source/blender/freestyle/intern/stroke/CurveIterators.h
+++ b/source/blender/freestyle/intern/stroke/CurveIterators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CURVE_ITERATORS_H__
#define __FREESTYLE_CURVE_ITERATORS_H__
-/** \file blender/freestyle/intern/stroke/CurveIterators.h
- * \ingroup freestyle
- * \brief Iterators used to iterate over the elements of the Curve
- * \author Stephane Grabli
- * \date 01/08/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Iterators used to iterate over the elements of the Curve
*/
#include "Curve.h"
diff --git a/source/blender/freestyle/intern/stroke/Modifiers.h b/source/blender/freestyle/intern/stroke/Modifiers.h
index b10789504fc..95b63362bac 100644
--- a/source/blender/freestyle/intern/stroke/Modifiers.h
+++ b/source/blender/freestyle/intern/stroke/Modifiers.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_MODIFIERS_H__
#define __FREESTYLE_MODIFIERS_H__
-/** \file blender/freestyle/intern/stroke/Modifiers.h
- * \ingroup freestyle
- * \brief modifiers...
- * \author Stephane Grabli
- * \date 05/01/2003
+/** \file
+ * \ingroup freestyle
+ * \brief modifiers...
*/
#include "TimeStamp.h"
diff --git a/source/blender/freestyle/intern/stroke/Module.h b/source/blender/freestyle/intern/stroke/Module.h
index 64b6f34afa4..ca0954df561 100644
--- a/source/blender/freestyle/intern/stroke/Module.h
+++ b/source/blender/freestyle/intern/stroke/Module.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_MODULE_H__
#define __FREESTYLE_MODULE_H__
-/** \file blender/freestyle/intern/stroke/Module.h
- * \ingroup freestyle
- * \brief Set the type of the module
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Set the type of the module
*/
#include "Canvas.h"
diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp
index 151cd29ca07..e9f6ff02f77 100644
--- a/source/blender/freestyle/intern/stroke/Operators.cpp
+++ b/source/blender/freestyle/intern/stroke/Operators.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/Operators.cpp
- * \ingroup freestyle
- * \brief Class gathering stroke creation algorithms
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class gathering stroke creation algorithms
*/
#include <algorithm>
diff --git a/source/blender/freestyle/intern/stroke/Operators.h b/source/blender/freestyle/intern/stroke/Operators.h
index b364d5a36b4..6c3d9413038 100644
--- a/source/blender/freestyle/intern/stroke/Operators.h
+++ b/source/blender/freestyle/intern/stroke/Operators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_OPERATORS_H__
#define __FREESTYLE_OPERATORS_H__
-/** \file blender/freestyle/intern/stroke/Operators.h
- * \ingroup freestyle
- * \brief Class gathering stroke creation algorithms
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class gathering stroke creation algorithms
*/
#include <iostream>
diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp
index edfa3007ea6..3cdf7904998 100644
--- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/PSStrokeRenderer.cpp
- * \ingroup freestyle
- * \brief Class to define the Postscript rendering of a stroke
- * \author Stephane Grabli
- * \date 10/26/2004
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the Postscript rendering of a stroke
*/
#include "Canvas.h"
diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h
index c802bf4291a..e24188be2f9 100644
--- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h
+++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_PS_STROKE_RENDERER_H__
#define __FREESTYLE_PS_STROKE_RENDERER_H__
-/** \file blender/freestyle/intern/stroke/PSStrokeRenderer.h
- * \ingroup freestyle
- * \brief Class to define the Postscript rendering of a stroke
- * \author Stephane Grabli
- * \date 10/26/2004
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the Postscript rendering of a stroke
*/
#include <fstream>
diff --git a/source/blender/freestyle/intern/stroke/Predicates0D.cpp b/source/blender/freestyle/intern/stroke/Predicates0D.cpp
index f189b2e38ea..e0263abd387 100644
--- a/source/blender/freestyle/intern/stroke/Predicates0D.cpp
+++ b/source/blender/freestyle/intern/stroke/Predicates0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/Predicates0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "Predicates0D.h"
diff --git a/source/blender/freestyle/intern/stroke/Predicates0D.h b/source/blender/freestyle/intern/stroke/Predicates0D.h
index bf09d99bcbd..4309c942218 100644
--- a/source/blender/freestyle/intern/stroke/Predicates0D.h
+++ b/source/blender/freestyle/intern/stroke/Predicates0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_PREDICATES_0D_H__
#define __FREESTYLE_PREDICATES_0D_H__
-/** \file blender/freestyle/intern/stroke/Predicates0D.h
- * \ingroup freestyle
- * \brief Class gathering stroke creation algorithms
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class gathering stroke creation algorithms
*/
#include "../view_map/Functions0D.h"
diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.cpp b/source/blender/freestyle/intern/stroke/Predicates1D.cpp
index 7c5d777e57c..b00443bf404 100644
--- a/source/blender/freestyle/intern/stroke/Predicates1D.cpp
+++ b/source/blender/freestyle/intern/stroke/Predicates1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/Predicates1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "Predicates1D.h"
diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.h b/source/blender/freestyle/intern/stroke/Predicates1D.h
index 9f8b264abcd..0501e33bcf0 100644
--- a/source/blender/freestyle/intern/stroke/Predicates1D.h
+++ b/source/blender/freestyle/intern/stroke/Predicates1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_PREDICATES_1D_H__
#define __FREESTYLE_PREDICATES_1D_H__
-/** \file blender/freestyle/intern/stroke/Predicates1D.h
- * \ingroup freestyle
- * \brief Class gathering stroke creation algorithms
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class gathering stroke creation algorithms
*/
#include <string>
diff --git a/source/blender/freestyle/intern/stroke/QInformationMap.h b/source/blender/freestyle/intern/stroke/QInformationMap.h
index 827b408ed8a..7cb93321233 100644
--- a/source/blender/freestyle/intern/stroke/QInformationMap.h
+++ b/source/blender/freestyle/intern/stroke/QInformationMap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_Q_INFORMATION_MAP_H__
#define __FREESTYLE_Q_INFORMATION_MAP_H__
-/** \file blender/freestyle/intern/stroke/QInformationMap.h
- * \ingroup freestyle
- * \brief Class defining an information map using a QImage
- * \author Stephane Grabli
- * \date 04/01/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class defining an information map using a QImage
*/
#include <qimage.h>
diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp
index 053015f459d..1cd363a15a5 100644
--- a/source/blender/freestyle/intern/stroke/Stroke.cpp
+++ b/source/blender/freestyle/intern/stroke/Stroke.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/Stroke.cpp
- * \ingroup freestyle
- * \brief Classes to define a stroke
- * \author Stephane Grabli
- * \date 09/09/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to define a stroke
*/
#include "Stroke.h"
diff --git a/source/blender/freestyle/intern/stroke/Stroke.h b/source/blender/freestyle/intern/stroke/Stroke.h
index 74c72e159b4..bc335b2252e 100644
--- a/source/blender/freestyle/intern/stroke/Stroke.h
+++ b/source/blender/freestyle/intern/stroke/Stroke.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STROKE_H__
#define __FREESTYLE_STROKE_H__
-/** \file blender/freestyle/intern/stroke/Stroke.h
- * \ingroup freestyle
- * \brief Classes to define a stroke
- * \author Stephane Grabli
- * \date 09/09/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to define a stroke
*/
#include <map>
@@ -303,9 +297,12 @@ private:
typedef std::map<const char *, Vec2f, StringUtils::ltstr> Vec2fMap;
typedef std::map<const char *, Vec3f, StringUtils::ltstr> Vec3fMap;
- float _color[3]; //! the color
- float _alpha; //! alpha
- float _thickness[2]; //! the thickness on the right and on the left of the backbone vertex (the stroke is oriented)
+ //! the color
+ float _color[3];
+ //! alpha
+ float _alpha;
+ //! the thickness on the right and on the left of the backbone vertex (the stroke is oriented)
+ float _thickness[2];
bool _visible;
realMap *_userAttributesReal;
Vec2fMap *_userAttributesVec2f;
diff --git a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h
index eb6b0a70c28..8362c293558 100644
--- a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h
+++ b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STROKE_ADVANCED_ITERATORS_H__
#define __FREESTYLE_STROKE_ADVANCED_ITERATORS_H__
-/** \file blender/freestyle/intern/stroke/StrokeAdvancedIterators.h
- * \ingroup freestyle
- * \brief Iterators used to iterate over the elements of the Stroke. Can't be used in python
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Iterators used to iterate over the elements of the Stroke. Can't be used in python
*/
#include "Stroke.h"
diff --git a/source/blender/freestyle/intern/stroke/StrokeIO.cpp b/source/blender/freestyle/intern/stroke/StrokeIO.cpp
index 0360b7bba4a..9b428a81d1e 100644
--- a/source/blender/freestyle/intern/stroke/StrokeIO.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeIO.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/StrokeIO.cpp
- * \ingroup freestyle
- * \brief Functions to manage I/O for the stroke
- * \author Stephane Grabli
- * \date 03/02/2004
+/** \file
+ * \ingroup freestyle
+ * \brief Functions to manage I/O for the stroke
*/
#include "StrokeAdvancedIterators.h"
diff --git a/source/blender/freestyle/intern/stroke/StrokeIO.h b/source/blender/freestyle/intern/stroke/StrokeIO.h
index f3833e04143..7ce5091e9fe 100644
--- a/source/blender/freestyle/intern/stroke/StrokeIO.h
+++ b/source/blender/freestyle/intern/stroke/StrokeIO.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STROKE_IO_H__
#define __FREESTYLE_STROKE_IO_H__
-/** \file blender/freestyle/intern/stroke/StrokeIO.h
- * \ingroup freestyle
- * \brief Functions to manage I/O for the stroke
- * \author Stephane Grabli
- * \date 03/02/2004
+/** \file
+ * \ingroup freestyle
+ * \brief Functions to manage I/O for the stroke
*/
#include <iostream>
diff --git a/source/blender/freestyle/intern/stroke/StrokeIterators.h b/source/blender/freestyle/intern/stroke/StrokeIterators.h
index 1df9aa2794a..d64fbdfd83c 100644
--- a/source/blender/freestyle/intern/stroke/StrokeIterators.h
+++ b/source/blender/freestyle/intern/stroke/StrokeIterators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STROKE_ITERATORS_H__
#define __FREESTYLE_STROKE_ITERATORS_H__
-/** \file blender/freestyle/intern/stroke/StrokeIterators.h
- * \ingroup freestyle
- * \brief Iterators used to iterate over the elements of the Stroke
- * \author Stephane Grabli
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Iterators used to iterate over the elements of the Stroke
*/
#include "Stroke.h"
@@ -48,8 +42,8 @@ namespace StrokeInternal {
* should use a StrokeVertexIterator.
* The castToInterface0DIterator() method is useful to get an Interface0DIterator from a StrokeVertexIterator in
* order to call any functions of the type UnaryFunction0D.
- * \attention In the scripting language, you must call \code it2 = StrokeVertexIterator(it1) \endcode instead of
- * \code it2 = it1 \endcode where \a it1 and \a it2 are 2 StrokeVertexIterator.
+ * \attention In the scripting language, you must call \code it2 = StrokeVertexIterator(it1) \endcode instead of
+ * \code it2 = it1 \endcode where \a it1 and \a it2 are 2 StrokeVertexIterator.
* Otherwise, incrementing \a it1 will also increment \a it2.
*/
class StrokeVertexIterator : public Interface0DIteratorNested
diff --git a/source/blender/freestyle/intern/stroke/StrokeLayer.cpp b/source/blender/freestyle/intern/stroke/StrokeLayer.cpp
index 67552d6ebf2..3976c56ffe2 100644
--- a/source/blender/freestyle/intern/stroke/StrokeLayer.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeLayer.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/StrokeLayer.cpp
- * \ingroup freestyle
- * \brief Class to define a layer of strokes.
- * \author Stephane Grabli
- * \date 18/12/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a layer of strokes.
*/
#include "Canvas.h"
diff --git a/source/blender/freestyle/intern/stroke/StrokeLayer.h b/source/blender/freestyle/intern/stroke/StrokeLayer.h
index 91292e237d6..1eef44e6c91 100644
--- a/source/blender/freestyle/intern/stroke/StrokeLayer.h
+++ b/source/blender/freestyle/intern/stroke/StrokeLayer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STROKE_LAYER_H__
#define __FREESTYLE_STROKE_LAYER_H__
-/** \file blender/freestyle/intern/stroke/StrokeLayer.h
- * \ingroup freestyle
- * \brief Class to define a layer of strokes.
- * \author Stephane Grabli
- * \date 18/12/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a layer of strokes.
*/
#include <deque>
diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
index d7b37d65a6d..303b6c67984 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/StrokeRenderer.cpp
- * \ingroup freestyle
- * \brief Classes to render a stroke with OpenGL
- * \author Fredo Durand
- * \date 09/09/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to render a stroke with OpenGL
*/
#include "StrokeRenderer.h"
diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.h b/source/blender/freestyle/intern/stroke/StrokeRenderer.h
index 054182a558a..35e206a73c0 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRenderer.h
+++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STROKE_RENDERER_H__
#define __FREESTYLE_STROKE_RENDERER_H__
-/** \file blender/freestyle/intern/stroke/StrokeRenderer.h
- * \ingroup freestyle
- * \brief Classes to render a stroke with OpenGL
- * \author Fredo Durand
- * \date 09/09/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to render a stroke with OpenGL
*/
#include <map>
diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp
index 81ef46e5b3b..7298c3d9355 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/StrokeRep.cpp
- * \ingroup freestyle
- * \brief Class to define the representation of a stroke (for display purpose)
- * \author Stephane Grabli
- * \date 05/03/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the representation of a stroke (for display purpose)
*/
#include "Stroke.h"
diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.h b/source/blender/freestyle/intern/stroke/StrokeRep.h
index ba042eb496d..b282aca690c 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRep.h
+++ b/source/blender/freestyle/intern/stroke/StrokeRep.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STROKE_REP_H__
#define __FREESTYLE_STROKE_REP_H__
-/** \file blender/freestyle/intern/stroke/StrokeRep.h
- * \ingroup freestyle
- * \brief Class to define the representation of a stroke (for display purpose)
- * \author Stephane Grabli
- * \date 05/03/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define the representation of a stroke (for display purpose)
*/
#include "Stroke.h"
diff --git a/source/blender/freestyle/intern/stroke/StrokeShader.cpp b/source/blender/freestyle/intern/stroke/StrokeShader.cpp
index 4b21910a894..31a212a29f4 100644
--- a/source/blender/freestyle/intern/stroke/StrokeShader.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeShader.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/StrokeShader.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "StrokeShader.h"
diff --git a/source/blender/freestyle/intern/stroke/StrokeShader.h b/source/blender/freestyle/intern/stroke/StrokeShader.h
index 1b070a685cc..8b4837746e0 100644
--- a/source/blender/freestyle/intern/stroke/StrokeShader.h
+++ b/source/blender/freestyle/intern/stroke/StrokeShader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STROKE_SHADERS_H__
#define __FREESTYLE_STROKE_SHADERS_H__
-/** \file blender/freestyle/intern/stroke/StrokeShader.h
- * \ingroup freestyle
- * \brief Class defining StrokeShader
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class defining StrokeShader
*/
#include <iostream>
@@ -54,15 +47,15 @@ class Stroke;
* The basic way to achieve this operation consists in iterating over the StrokeVertices of the Stroke
* and to modify each one's StrokeAttribute.
* Here is a python code example of such an iteration:
- * \code
+ * \code
* it = ioStroke.strokeVerticesBegin()
* while not it.isEnd():
* att = it.getObject().attribute()
* ## perform here any attribute modification
* it.increment()
- * \endcode
+ * \endcode
* Here is a C++ code example of such an iteration:
- * \code
+ * \code
* for (StrokeInternal::StrokeVertexIterator v = ioStroke.strokeVerticesBegin(), vend = ioStroke.strokeVerticesEnd();
* v != vend;
* ++v)
@@ -70,7 +63,7 @@ class Stroke;
* StrokeAttribute& att = v->attribute();
* // perform any attribute modification here...
* }
- * \endcode
+ * \endcode
*/
class StrokeShader
{
diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp
index fb221735fb1..bebab7f1bf3 100644
--- a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/StrokeTesselator.cpp
- * \ingroup freestyle
- * \brief Class to build a Node Tree designed to be displayed from a set of strokes structure.
- * \author Stephane Grabli
- * \date 26/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to build a Node Tree designed to be displayed from a set of strokes structure.
*/
#include "StrokeAdvancedIterators.h"
diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.h b/source/blender/freestyle/intern/stroke/StrokeTesselator.h
index 661c871a4d5..228935f2ab5 100644
--- a/source/blender/freestyle/intern/stroke/StrokeTesselator.h
+++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STROKE_TESSELATOR_H__
#define __FREESTYLE_STROKE_TESSELATOR_H__
-/** \file blender/freestyle/intern/stroke/StrokeTesselator.h
- * \ingroup freestyle
- * \brief Class to build a Node Tree designed to be displayed from a set of strokes structure.
- * \author Stephane Grabli
- * \date 26/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to build a Node Tree designed to be displayed from a set of strokes structure.
*/
#include "Stroke.h"
diff --git a/source/blender/freestyle/intern/stroke/StyleModule.h b/source/blender/freestyle/intern/stroke/StyleModule.h
index f1d96283f90..fe902299f9f 100644
--- a/source/blender/freestyle/intern/stroke/StyleModule.h
+++ b/source/blender/freestyle/intern/stroke/StyleModule.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STYLE_MODULE_H__
#define __FREESTYLE_STYLE_MODULE_H__
-/** \file blender/freestyle/intern/stroke/StyleModule.h
- * \ingroup freestyle
- * \brief Class representing a style module
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class representing a style module
*/
#include <iostream>
diff --git a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp
index e2c0de213c6..4b918cd21bc 100644
--- a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,8 +12,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "TextStrokeRenderer.h"
diff --git a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h
index eba3421675c..957ad9c49db 100644
--- a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h
+++ b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/stroke/TextStrokeRenderer.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
//
diff --git a/source/blender/freestyle/intern/system/BaseIterator.h b/source/blender/freestyle/intern/system/BaseIterator.h
index 9eb06744095..b01fac96267 100644
--- a/source/blender/freestyle/intern/system/BaseIterator.h
+++ b/source/blender/freestyle/intern/system/BaseIterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_BASE_ITERATOR_H__
#define __FREESTYLE_BASE_ITERATOR_H__
-/** \file blender/freestyle/intern/system/BaseIterator.h
- * \ingroup freestyle
- * \brief Classes defining the basic "Iterator" design pattern
- * \author Stephane Grabli
- * \date 18/03/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Classes defining the basic "Iterator" design pattern
*/
#include <iterator>
diff --git a/source/blender/freestyle/intern/system/BaseObject.cpp b/source/blender/freestyle/intern/system/BaseObject.cpp
index 2094402fb10..a386812850b 100644
--- a/source/blender/freestyle/intern/system/BaseObject.cpp
+++ b/source/blender/freestyle/intern/system/BaseObject.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/system/BaseObject.cpp
- * \ingroup freestyle
- * \brief Base Class for most shared objects (Node, Rep). Defines the addRef, release system.
- * \brief Inspired by COM IUnknown system.
- * \author Stephane Grabli
- * \date 06/02/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Base Class for most shared objects (Node, Rep). Defines the addRef, release system.
+ * \brief Inspired by COM IUnknown system.
*/
#include "BaseObject.h"
diff --git a/source/blender/freestyle/intern/system/BaseObject.h b/source/blender/freestyle/intern/system/BaseObject.h
index 945c2c8d35e..01099c7724a 100644
--- a/source/blender/freestyle/intern/system/BaseObject.h
+++ b/source/blender/freestyle/intern/system/BaseObject.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_BASE_OBJECT_H__
#define __FREESTYLE_BASE_OBJECT_H__
-/** \file blender/freestyle/intern/system/BaseObject.h
- * \ingroup freestyle
- * \brief Base Class for most shared objects (Node, Rep). Defines the addRef, release system.
- * \brief Inspired by COM IUnknown system.
- * \author Stephane Grabli
- * \date 06/02/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Base Class for most shared objects (Node, Rep). Defines the addRef, release system.
+ * \brief Inspired by COM IUnknown system.
*/
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/blender/freestyle/intern/system/Cast.h b/source/blender/freestyle/intern/system/Cast.h
index 9e115356c0e..f3efcc462bf 100644
--- a/source/blender/freestyle/intern/system/Cast.h
+++ b/source/blender/freestyle/intern/system/Cast.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CAST_H__
#define __FREESTYLE_CAST_H__
-/** \file blender/freestyle/intern/system/Cast.h
- * \ingroup freestyle
- * \brief Cast function
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Cast function
*/
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/system/Exception.cpp b/source/blender/freestyle/intern/system/Exception.cpp
index 527f57a5bff..2ecf3964cd7 100644
--- a/source/blender/freestyle/intern/system/Exception.cpp
+++ b/source/blender/freestyle/intern/system/Exception.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/system/Exception.cpp
- * \ingroup freestyle
- * \brief Singleton to manage exceptions
- * \author Stephane Grabli
- * \date 10/01/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Singleton to manage exceptions
*/
#include "Exception.h"
diff --git a/source/blender/freestyle/intern/system/Exception.h b/source/blender/freestyle/intern/system/Exception.h
index f605735ec40..f334ca040ef 100644
--- a/source/blender/freestyle/intern/system/Exception.h
+++ b/source/blender/freestyle/intern/system/Exception.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_EXCEPTION_H__
#define __FREESTYLE_EXCEPTION_H__
-/** \file blender/freestyle/intern/system/Exception.h
- * \ingroup freestyle
- * \brief Singleton to manage exceptions
- * \author Stephane Grabli
- * \date 10/01/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Singleton to manage exceptions
*/
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/blender/freestyle/intern/system/FreestyleConfig.h b/source/blender/freestyle/intern/system/FreestyleConfig.h
index 752940d83a5..9603ad8190d 100644
--- a/source/blender/freestyle/intern/system/FreestyleConfig.h
+++ b/source/blender/freestyle/intern/system/FreestyleConfig.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CONFIG_H__
#define __FREESTYLE_CONFIG_H__
-/** \file blender/freestyle/intern/system/FreestyleConfig.h
- * \ingroup freestyle
- * \brief Configuration definitions
- * \author Emmanuel Turquin
- * \date 25/02/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Configuration definitions
*/
#include <string>
diff --git a/source/blender/freestyle/intern/system/Id.h b/source/blender/freestyle/intern/system/Id.h
index 279730f7934..5e8e9ba82bd 100644
--- a/source/blender/freestyle/intern/system/Id.h
+++ b/source/blender/freestyle/intern/system/Id.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_ID_H__
#define __FREESTYLE_ID_H__
-/** \file blender/freestyle/intern/system/Id.h
- * \ingroup freestyle
- * \brief Identification system
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Identification system
*/
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/blender/freestyle/intern/system/Interpreter.h b/source/blender/freestyle/intern/system/Interpreter.h
index 74af9f82b12..3bc7fa75141 100644
--- a/source/blender/freestyle/intern/system/Interpreter.h
+++ b/source/blender/freestyle/intern/system/Interpreter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_INTERPRETER_H__
#define __FREESTYLE_INTERPRETER_H__
-/** \file blender/freestyle/intern/system/Interpreter.h
- * \ingroup freestyle
- * \brief Base Class of all script interpreters
- * \author Emmanuel Turquin
- * \date 17/04/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Base Class of all script interpreters
*/
#include <string>
diff --git a/source/blender/freestyle/intern/system/Iterator.cpp b/source/blender/freestyle/intern/system/Iterator.cpp
index 88480b0ee2c..c4bc2538826 100644
--- a/source/blender/freestyle/intern/system/Iterator.cpp
+++ b/source/blender/freestyle/intern/system/Iterator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/system/Iterator.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include "Iterator.h"
diff --git a/source/blender/freestyle/intern/system/Iterator.h b/source/blender/freestyle/intern/system/Iterator.h
index 1fc68b133c2..c38dc09fd2e 100644
--- a/source/blender/freestyle/intern/system/Iterator.h
+++ b/source/blender/freestyle/intern/system/Iterator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_ITERATOR_H__
#define __FREESTYLE_ITERATOR_H__
-/** \file blender/freestyle/intern/system/Iterator.h
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
#include <iostream>
diff --git a/source/blender/freestyle/intern/system/PointerSequence.h b/source/blender/freestyle/intern/system/PointerSequence.h
index 791df90ba9d..b4fc73d6e93 100644
--- a/source/blender/freestyle/intern/system/PointerSequence.h
+++ b/source/blender/freestyle/intern/system/PointerSequence.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_POINTER_SEQUENCE_H__
#define __FREESTYLE_POINTER_SEQUENCE_H__
-/** \file blender/freestyle/intern/system/PointerSequence.h
- * \ingroup freestyle
- * \brief Simple RAII wrappers for std:: sequential containers
- * \author 22/11/2010
- * \date 18/03/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Simple RAII wrappers for std:: sequential containers
*
* PointerSequence
*
diff --git a/source/blender/freestyle/intern/system/Precision.h b/source/blender/freestyle/intern/system/Precision.h
index 8b859f11444..a03730433e5 100644
--- a/source/blender/freestyle/intern/system/Precision.h
+++ b/source/blender/freestyle/intern/system/Precision.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_PRECISION_H__
#define __FREESTYLE_PRECISION_H__
-/** \file blender/freestyle/intern/system/Precision.h
- * \ingroup freestyle
- * \brief Define the float precision used in the program
- * \author Stephane Grabli
- * \date 30/07/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Define the float precision used in the program
*/
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/system/ProgressBar.h b/source/blender/freestyle/intern/system/ProgressBar.h
index 56dbef59b0e..d3589987202 100644
--- a/source/blender/freestyle/intern/system/ProgressBar.h
+++ b/source/blender/freestyle/intern/system/ProgressBar.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_PROGRESS_BAR_H__
#define __FREESTYLE_PROGRESS_BAR_H__
-/** \file blender/freestyle/intern/system/ProgressBar.h
- * \ingroup freestyle
- * \brief Class to encapsulate a progress bar
- * \author Stephane Grabli
- * \date 27/08/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to encapsulate a progress bar
*/
#include <string>
diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp
index 638eb6ca16a..789583591ab 100644
--- a/source/blender/freestyle/intern/system/PseudoNoise.cpp
+++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/system/PseudoNoise.cpp
- * \ingroup freestyle
- * \brief Class to define a pseudo Perlin noise
- * \author Fredo Durand
- * \date 16/06/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a pseudo Perlin noise
*/
#include "BLI_math.h"
diff --git a/source/blender/freestyle/intern/system/PseudoNoise.h b/source/blender/freestyle/intern/system/PseudoNoise.h
index 602ad5293f0..dbcc2a477a2 100644
--- a/source/blender/freestyle/intern/system/PseudoNoise.h
+++ b/source/blender/freestyle/intern/system/PseudoNoise.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_PSEUDO_NOISE_H__
#define __FREESTYLE_PSEUDO_NOISE_H__
-/** \file blender/freestyle/intern/system/PseudoNoise.h
- * \ingroup freestyle
- * \brief Class to define a pseudo Perlin noise
- * \author Fredo Durand
- * \date 16/06/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a pseudo Perlin noise
*/
#include "Precision.h"
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.cpp b/source/blender/freestyle/intern/system/PythonInterpreter.cpp
index 852030e365b..320460c4460 100644
--- a/source/blender/freestyle/intern/system/PythonInterpreter.cpp
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/system/PythonInterpreter.cpp
- * \ingroup freestyle
- * \brief Python Interpreter
- * \author Emmanuel Turquin
- * \date 17/04/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Python Interpreter
*/
#include "PythonInterpreter.h"
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h
index cb49e7718a0..d829f4f87c4 100644
--- a/source/blender/freestyle/intern/system/PythonInterpreter.h
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_PYTHON_INTERPRETER_H__
#define __FREESTYLE_PYTHON_INTERPRETER_H__
-/** \file blender/freestyle/intern/system/PythonInterpreter.h
- * \ingroup freestyle
- * \brief Python Interpreter
- * \author Emmanuel Turquin
- * \date 17/04/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Python Interpreter
*/
#include <iostream>
@@ -84,7 +78,7 @@ public:
Text *text = BKE_text_load(&_freestyle_bmain, fn, G_MAIN->name);
if (text) {
ok = BPY_execute_text(_context, text, reports, false);
- BKE_libblock_delete(&_freestyle_bmain, text);
+ BKE_id_delete(&_freestyle_bmain, text);
}
else {
BKE_reportf(reports, RPT_ERROR, "Cannot open file: %s", fn);
diff --git a/source/blender/freestyle/intern/system/RandGen.cpp b/source/blender/freestyle/intern/system/RandGen.cpp
index 22727db026b..49a9df14f22 100644
--- a/source/blender/freestyle/intern/system/RandGen.cpp
+++ b/source/blender/freestyle/intern/system/RandGen.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/system/RandGen.cpp
- * \ingroup freestyle
- * \brief Pseudo-random number generator
- * \author Fredo Durand
- * \date 20/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Pseudo-random number generator
*/
#include "RandGen.h"
@@ -91,12 +85,12 @@ namespace Freestyle {
static unsigned x[3] = {
X0,
X1,
- X2
+ X2,
};
static unsigned a[3] = {
A0,
A1,
- A2
+ A2,
};
static unsigned c = C;
diff --git a/source/blender/freestyle/intern/system/RandGen.h b/source/blender/freestyle/intern/system/RandGen.h
index d39b4f95bbf..de3c834be55 100644
--- a/source/blender/freestyle/intern/system/RandGen.h
+++ b/source/blender/freestyle/intern/system/RandGen.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_RAND_GEN_H__
#define __FREESTYLE_RAND_GEN_H__
-/** \file blender/freestyle/intern/system/RandGen.h
- * \ingroup freestyle
- * \brief Pseudo-random number generator
- * \author Fredo Durand
- * \date 20/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Pseudo-random number generator
*/
// TODO Check whether we could replace this with BLI rand stuff...
diff --git a/source/blender/freestyle/intern/system/RenderMonitor.h b/source/blender/freestyle/intern/system/RenderMonitor.h
index 7910bf13c63..6d8414337c5 100644
--- a/source/blender/freestyle/intern/system/RenderMonitor.h
+++ b/source/blender/freestyle/intern/system/RenderMonitor.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_RENDER_MONITOR_H__
#define __FREESTYLE_RENDER_MONITOR_H__
-/** \file blender/freestyle/intern/system/RenderMonitor.h
- * \ingroup freestyle
- * \brief Classes defining the basic "Iterator" design pattern
- * \author Stephane Grabli
- * \date 18/03/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Classes defining the basic "Iterator" design pattern
*/
extern "C" {
diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp
index 28876c4031f..e8c3dad5d85 100644
--- a/source/blender/freestyle/intern/system/StringUtils.cpp
+++ b/source/blender/freestyle/intern/system/StringUtils.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/system/StringUtils.cpp
- * \ingroup freestyle
- * \brief String utilities
- * \author Emmanuel Turquin
- * \date 20/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief String utilities
*/
//soc #include <qfileinfo.h>
diff --git a/source/blender/freestyle/intern/system/StringUtils.h b/source/blender/freestyle/intern/system/StringUtils.h
index 10748c45c19..8329f071a51 100644
--- a/source/blender/freestyle/intern/system/StringUtils.h
+++ b/source/blender/freestyle/intern/system/StringUtils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STRING_UTILS_H__
#define __FREESTYLE_STRING_UTILS_H__
-/** \file blender/freestyle/intern/system/StringUtils.h
- * \ingroup freestyle
- * \brief String utilities
- * \author Emmanuel Turquin
- * \date 20/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief String utilities
*/
#include <cstring>
diff --git a/source/blender/freestyle/intern/system/TimeStamp.cpp b/source/blender/freestyle/intern/system/TimeStamp.cpp
index 0e387a5cc54..a751b938908 100644
--- a/source/blender/freestyle/intern/system/TimeStamp.cpp
+++ b/source/blender/freestyle/intern/system/TimeStamp.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/system/TimeStamp.cpp
- * \ingroup freestyle
- * \brief Class defining a singleton used as timestamp
- * \author Stephane Grabli
- * \date 12/12/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class defining a singleton used as timestamp
*/
#include "TimeStamp.h"
diff --git a/source/blender/freestyle/intern/system/TimeStamp.h b/source/blender/freestyle/intern/system/TimeStamp.h
index ccf370ad228..adf6083a16f 100644
--- a/source/blender/freestyle/intern/system/TimeStamp.h
+++ b/source/blender/freestyle/intern/system/TimeStamp.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_TIME_STAMP_H__
#define __FREESTYLE_TIME_STAMP_H__
-/** \file blender/freestyle/intern/system/TimeStamp.h
- * \ingroup freestyle
- * \brief Class defining a singleton used as timestamp
- * \author Stephane Grabli
- * \date 12/12/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class defining a singleton used as timestamp
*/
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/blender/freestyle/intern/system/TimeUtils.h b/source/blender/freestyle/intern/system/TimeUtils.h
index 2d14adc5912..1e3bd05c81d 100644
--- a/source/blender/freestyle/intern/system/TimeUtils.h
+++ b/source/blender/freestyle/intern/system/TimeUtils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_TIME_UTILS_H__
#define __FREESTYLE_TIME_UTILS_H__
-/** \file blender/freestyle/intern/system/TimeUtils.h
- * \ingroup freestyle
- * \brief Class to measure elapsed time
- * \author Stephane Grabli
- * \date 10/04/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to measure elapsed time
*/
#include <time.h>
diff --git a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
index 79de3ca497d..37273b0dd1e 100644
--- a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
+++ b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-2-5
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "ArbitraryGridDensityProvider.h"
diff --git a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h
index c7939d34da4..8b616002279 100644
--- a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h
+++ b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_ARBITRARY_GRID_DENSITY_PROVIDER_H__
#define __FREESTYLE_ARBITRARY_GRID_DENSITY_PROVIDER_H__
-/** \file blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-2-5
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "GridDensityProvider.h"
diff --git a/source/blender/freestyle/intern/view_map/AutoPtrHelper.h b/source/blender/freestyle/intern/view_map/AutoPtrHelper.h
index 17a43c184c7..2554d303b08 100644
--- a/source/blender/freestyle/intern/view_map/AutoPtrHelper.h
+++ b/source/blender/freestyle/intern/view_map/AutoPtrHelper.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_AUTOPTR_HELPER_H__
#define __FREESTYLE_AUTOPTR_HELPER_H__
-/** \file blender/freestyle/intern/view_map/AutoPtrHelper.h
- * \ingroup freestyle
- * \brief Utility header for auto_ptr/unique_ptr selection
- * \author Sergey Sharybin
- * \date 2015-02-09
+/** \file
+ * \ingroup freestyle
+ * \brief Utility header for auto_ptr/unique_ptr selection
*/
#include <memory>
diff --git a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
index b5e133ec441..8fc3fe810af 100644
--- a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
+++ b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-2-9
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "AverageAreaGridDensityProvider.h"
diff --git a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h
index 2c58cc32da9..e422ad2ba8d 100644
--- a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h
+++ b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_AVERAGE_AREA_GRID_DENSITY_PROVIDER_H__
#define __FREESTYLE_AVERAGE_AREA_GRID_DENSITY_PROVIDER_H__
-/** \file blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-2-9
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "GridDensityProvider.h"
diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp
index 34fa2b14379..396688fe62c 100644
--- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp
+++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/BoxGrid.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-1-29
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include <algorithm>
diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.h b/source/blender/freestyle/intern/view_map/BoxGrid.h
index b8e751d041d..9d2a3c7ea4c 100644
--- a/source/blender/freestyle/intern/view_map/BoxGrid.h
+++ b/source/blender/freestyle/intern/view_map/BoxGrid.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_BOX_GRID_H__
#define __FREESTYLE_BOX_GRID_H__
-/** \file blender/freestyle/intern/view_map/BoxGrid.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-1-29
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#define BOX_GRID_LOGGING 0
diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
index ae0d83a3551..28e4b0251de 100644
--- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
+++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/CulledOccluderSource.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2010-12-21
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "CulledOccluderSource.h"
diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.h b/source/blender/freestyle/intern/view_map/CulledOccluderSource.h
index 4bc3c490727..de782eda64c 100644
--- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.h
+++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CULLED_OCCLUDER_SOURCE_H__
#define __FREESTYLE_CULLED_OCCLUDER_SOURCE_H__
-/** \file blender/freestyle/intern/view_map/CulledOccluderSource.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2010-12-21
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "OccluderSource.h"
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
index d179e8b7f18..a195db76fe7 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/FEdgeXDetector.cpp
- * \ingroup freestyle
- * \brief Detects/flags/builds extended features edges on the WXEdge structure
- * \author Stephane Grabli
- * \date 26/10/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Detects/flags/builds extended features edges on the WXEdge structure
*/
#include <float.h>
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
index 99b7c127fff..9143a2b507d 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_FEDGE_X_DETECTOR_H__
#define __FREESTYLE_FEDGE_X_DETECTOR_H__
-/** \file blender/freestyle/intern/view_map/FEdgeXDetector.h
- * \ingroup freestyle
- * \brief Detects/flags/builds extended features edges on the WXEdge structure
- * \author Stephane Grabli
- * \date 26/10/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Detects/flags/builds extended features edges on the WXEdge structure
*/
#include <vector>
diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp
index 15319e54f66..aca8fce2983 100644
--- a/source/blender/freestyle/intern/view_map/Functions0D.cpp
+++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/Functions0D.cpp
- * \ingroup freestyle
- * \brief Functions taking 0D input
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions taking 0D input
*/
#include "Functions0D.h"
diff --git a/source/blender/freestyle/intern/view_map/Functions0D.h b/source/blender/freestyle/intern/view_map/Functions0D.h
index 035da76a6e4..108a124fe78 100644
--- a/source/blender/freestyle/intern/view_map/Functions0D.h
+++ b/source/blender/freestyle/intern/view_map/Functions0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_FUNCTIONS_0D_H__
#define __FREESTYLE_FUNCTIONS_0D_H__
-/** \file blender/freestyle/intern/view_map/Functions0D.h
- * \ingroup freestyle
- * \brief Functions taking 0D input
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions taking 0D input
*/
#include <set>
@@ -62,7 +55,7 @@ using namespace Geometry;
/*! Base class for Unary Functions (functors) working on Interface0DIterator.
* A unary function will be used by calling its operator() on an Interface0DIterator.
- * \attention In the scripting language, there exists several prototypes depending on the returned value type.
+ * \attention In the scripting language, there exists several prototypes depending on the returned value type.
* For example, you would inherit from a UnaryFunction0DDouble if you wish to define a function that returns a double.
* The different existing prototypes are:
* - UnaryFunction0DDouble
diff --git a/source/blender/freestyle/intern/view_map/Functions1D.cpp b/source/blender/freestyle/intern/view_map/Functions1D.cpp
index 8f16f78cb10..31f3b65a2b7 100644
--- a/source/blender/freestyle/intern/view_map/Functions1D.cpp
+++ b/source/blender/freestyle/intern/view_map/Functions1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/Functions1D.cpp
- * \ingroup freestyle
- * \brief Functions taking 1D input
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions taking 1D input
*/
#include "Functions1D.h"
diff --git a/source/blender/freestyle/intern/view_map/Functions1D.h b/source/blender/freestyle/intern/view_map/Functions1D.h
index 60b3192910f..9101e380a40 100644
--- a/source/blender/freestyle/intern/view_map/Functions1D.h
+++ b/source/blender/freestyle/intern/view_map/Functions1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_FUNCTIONS_1D_H__
#define __FREESTYLE_FUNCTIONS_1D_H__
-/** \file blender/freestyle/intern/view_map/Functions1D.h
- * \ingroup freestyle
- * \brief Functions taking 1D input
- * \author Stephane Grabli
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions taking 1D input
*/
#include "Functions0D.h"
@@ -52,7 +45,7 @@ namespace Freestyle {
/*! Base class for Unary Functions (functors) working on Interface1D.
* A unary function will be used by calling its operator() on an Interface1D.
- * \attention In the scripting language, there exists several prototypes depending on the returned value type.
+ * \attention In the scripting language, there exists several prototypes depending on the returned value type.
* For example, you would inherit from a UnaryFunction1DDouble if you wish to define a function that returns a double.
* The different existing prototypes are:
* - UnaryFunction1DDouble
diff --git a/source/blender/freestyle/intern/view_map/GridDensityProvider.h b/source/blender/freestyle/intern/view_map/GridDensityProvider.h
index b49e74d6402..a01569b958a 100644
--- a/source/blender/freestyle/intern/view_map/GridDensityProvider.h
+++ b/source/blender/freestyle/intern/view_map/GridDensityProvider.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_GRID_DENSITY_PROVIDER_H__
#define __FREESTYLE_GRID_DENSITY_PROVIDER_H__
-/** \file blender/freestyle/intern/view_map/GridDensityProvider.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-2-5
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include <stdexcept>
diff --git a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp
index 18edc82b096..676ce8046ad 100644
--- a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp
+++ b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-2-8
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "HeuristicGridDensityProviderFactory.h"
diff --git a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h
index 9414e4931f5..87f602945f1 100644
--- a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h
+++ b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_HEURISTIC_GRID_DENSITY_PROVIDER_FACTORY_H__
#define __FREESTYLE_HEURISTIC_GRID_DENSITY_PROVIDER_FACTORY_H__
-/** \file blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-2-8
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
//#include <memory> // provided by GridDensityProvider.h
diff --git a/source/blender/freestyle/intern/view_map/Interface0D.cpp b/source/blender/freestyle/intern/view_map/Interface0D.cpp
index 5cfd216cda2..17331bb613f 100644
--- a/source/blender/freestyle/intern/view_map/Interface0D.cpp
+++ b/source/blender/freestyle/intern/view_map/Interface0D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/Interface0D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
extern "C" {
diff --git a/source/blender/freestyle/intern/view_map/Interface0D.h b/source/blender/freestyle/intern/view_map/Interface0D.h
index da71d7ad949..88214bb80a1 100644
--- a/source/blender/freestyle/intern/view_map/Interface0D.h
+++ b/source/blender/freestyle/intern/view_map/Interface0D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_INTERFACE_0D_H__
#define __FREESTYLE_INTERFACE_0D_H__
-/** \file blender/freestyle/intern/view_map/Interface0D.h
- * \ingroup freestyle
- * \brief Interface to 0D elts
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Interface to 0D elts
*/
#include <iostream>
@@ -181,8 +175,8 @@ public:
/*! Class defining an iterator over Interface0D elements.
* An instance of this iterator is always obtained from a 1D element.
- * \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1) \endcode instead of
- * \code it2 = it1 \endcode where \a it1 and \a it2 are 2 Interface0DIterator.
+ * \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1) \endcode instead of
+ * \code it2 = it1 \endcode where \a it1 and \a it2 are 2 Interface0DIterator.
* Otherwise, incrementing \a it1 will also increment \a it2.
*/
class Interface0DIterator : public Iterator
diff --git a/source/blender/freestyle/intern/view_map/Interface1D.cpp b/source/blender/freestyle/intern/view_map/Interface1D.cpp
index f4abad11479..4f3c46bbf01 100644
--- a/source/blender/freestyle/intern/view_map/Interface1D.cpp
+++ b/source/blender/freestyle/intern/view_map/Interface1D.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/Interface1D.cpp
- * \ingroup freestyle
+/** \file
+ * \ingroup freestyle
*/
extern "C" {
diff --git a/source/blender/freestyle/intern/view_map/Interface1D.h b/source/blender/freestyle/intern/view_map/Interface1D.h
index d6f402bf153..222d26d2009 100644
--- a/source/blender/freestyle/intern/view_map/Interface1D.h
+++ b/source/blender/freestyle/intern/view_map/Interface1D.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_INTERFACE_1D_H__
#define __FREESTYLE_INTERFACE_1D_H__
-/** \file blender/freestyle/intern/view_map/Interface1D.h
- * \ingroup freestyle
- * \brief Interface 1D and related tools definitions
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Interface 1D and related tools definitions
*/
#include <float.h>
@@ -60,16 +54,16 @@ typedef enum {
} IntegrationType;
/*! Returns a single value from a set of values evaluated at each 0D element of this 1D element.
- * \param fun:
+ * \param fun:
* The UnaryFunction0D used to compute a value at each Interface0D.
- * \param it:
+ * \param it:
* The Interface0DIterator used to iterate over the 0D elements of this 1D element. The integration will occur
* over the 0D elements starting from the one pointed by it.
- * \param it_end:
+ * \param it_end:
* The Interface0DIterator pointing the end of the 0D elements of the 1D element.
- * \param integration_type:
+ * \param integration_type:
* The integration method used to compute a single value from a set of values.
- * \return the single value obtained for the 1D element.
+ * \return the single value obtained for the 1D element.
*/
template <class T>
T integrate(UnaryFunction0D<T>& fun, Interface0DIterator it, Interface0DIterator it_end,
diff --git a/source/blender/freestyle/intern/view_map/OccluderSource.cpp b/source/blender/freestyle/intern/view_map/OccluderSource.cpp
index dbc271cc57b..90393825d28 100644
--- a/source/blender/freestyle/intern/view_map/OccluderSource.cpp
+++ b/source/blender/freestyle/intern/view_map/OccluderSource.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/OccluderSource.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2010-12-21
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include <algorithm>
diff --git a/source/blender/freestyle/intern/view_map/OccluderSource.h b/source/blender/freestyle/intern/view_map/OccluderSource.h
index b916661e04c..fd7d9f38a0d 100644
--- a/source/blender/freestyle/intern/view_map/OccluderSource.h
+++ b/source/blender/freestyle/intern/view_map/OccluderSource.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_OCCLUDER_SOURCE_H__
#define __FREESTYLE_OCCLUDER_SOURCE_H__
-/** \file blender/freestyle/intern/view_map/OccluderSource.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2010-12-21
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "../geometry/GridHelpers.h"
diff --git a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
index 8dff079e0cf..858e6b649eb 100644
--- a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
+++ b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-2-8
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "Pow23GridDensityProvider.h"
diff --git a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.h b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.h
index 5dfa9cdfc87..72fc56e4ef1 100644
--- a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.h
+++ b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_POW_23_GRID_DENSITY_PROVIDER_H__
#define __FREESTYLE_POW_23_GRID_DENSITY_PROVIDER_H__
-/** \file blender/freestyle/intern/view_map/Pow23GridDensityProvider.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2011-2-8
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include "GridDensityProvider.h"
diff --git a/source/blender/freestyle/intern/view_map/Silhouette.cpp b/source/blender/freestyle/intern/view_map/Silhouette.cpp
index 8c428746e34..7934ccf8671 100644
--- a/source/blender/freestyle/intern/view_map/Silhouette.cpp
+++ b/source/blender/freestyle/intern/view_map/Silhouette.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/Silhouette.cpp
- * \ingroup freestyle
- * \brief Classes to define a silhouette structure
- * \author Stephane Grabli
- * \date 25/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to define a silhouette structure
*/
#include "Silhouette.h"
diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h
index 4276409190e..8005203072d 100644
--- a/source/blender/freestyle/intern/view_map/Silhouette.h
+++ b/source/blender/freestyle/intern/view_map/Silhouette.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_SILHOUETTE_H__
#define __FREESTYLE_SILHOUETTE_H__
-/** \file blender/freestyle/intern/view_map/Silhouette.h
- * \ingroup freestyle
- * \brief Classes to define a silhouette structure
- * \author Stephane Grabli
- * \date 25/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to define a silhouette structure
*/
#include <float.h>
diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
index 3bfa4e5e3c1..39893e61dc5 100644
--- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
+++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
- * \ingroup freestyle
- * \brief Class to perform all geometric operations dedicated to silhouette. That, for example, implies that
+/** \file
+ * \ingroup freestyle
+ * \brief Class to perform all geometric operations dedicated to silhouette. That, for example, implies that
* this geom engine has as member data the viewpoint, transformations, projections...
- * \author Stephane Grabli
- * \date 03/09/2002
*/
#include <cstring>
@@ -46,19 +40,19 @@ real SilhouetteGeomEngine::_modelViewMatrix[4][4] = {
{1, 0, 0, 0},
{0, 1, 0, 0},
{0, 0, 1, 0},
- {0, 0, 0, 1}
+ {0, 0, 0, 1},
};
real SilhouetteGeomEngine::_projectionMatrix[4][4] = {
{1, 0, 0, 0},
{0, 1, 0, 0},
{0, 0, 1, 0},
- {0, 0, 0, 1}
+ {0, 0, 0, 1},
};
real SilhouetteGeomEngine::_transform[4][4] = {
{1, 0, 0, 0},
{0, 1, 0, 0},
{0, 0, 1, 0},
- {0, 0, 0, 1}
+ {0, 0, 0, 1},
};
int SilhouetteGeomEngine::_viewport[4] = {1, 1, 1, 1};
real SilhouetteGeomEngine::_Focal = 0.0;
@@ -67,13 +61,13 @@ real SilhouetteGeomEngine::_glProjectionMatrix[4][4] = {
{1, 0, 0, 0},
{0, 1, 0, 0},
{0, 0, 1, 0},
- {0, 0, 0, 1}
+ {0, 0, 0, 1},
};
real SilhouetteGeomEngine::_glModelViewMatrix[4][4] = {
{1, 0, 0, 0},
{0, 1, 0, 0},
{0, 0, 1, 0},
- {0, 0, 0, 1}
+ {0, 0, 0, 1},
};
real SilhouetteGeomEngine::_znear = 0.0;
real SilhouetteGeomEngine::_zfar = 100.0;
diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h
index e4bf1517512..6e46979026a 100644
--- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h
+++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_SILHOUETTE_GEOM_ENGINE_H__
#define __FREESTYLE_SILHOUETTE_GEOM_ENGINE_H__
-/** \file blender/freestyle/intern/view_map/SilhouetteGeomEngine.h
- * \ingroup freestyle
- * \brief Class to perform all geometric operations dedicated to silhouette. That, for example, implies that
+/** \file
+ * \ingroup freestyle
+ * \brief Class to perform all geometric operations dedicated to silhouette. That, for example, implies that
* this geom engine has as member data the viewpoint, transformations, projections...
- * \author Stephane Grabli
- * \date 03/09/2002
*/
#include <vector>
diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
index 10c88190cb3..03a50331dc9 100644
--- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
+++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/SphericalGrid.cpp
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2010-12-19
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#include <algorithm>
diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.h b/source/blender/freestyle/intern/view_map/SphericalGrid.h
index 2310f5ffe2f..19c2461ce01 100644
--- a/source/blender/freestyle/intern/view_map/SphericalGrid.h
+++ b/source/blender/freestyle/intern/view_map/SphericalGrid.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_SPHERICAL_GRID_H__
#define __FREESTYLE_SPHERICAL_GRID_H__
-/** \file blender/freestyle/intern/view_map/SphericalGrid.h
- * \ingroup freestyle
- * \brief Class to define a cell grid surrounding the projected image of a scene
- * \author Alexander Beels
- * \date 2010-12-19
+/** \file
+ * \ingroup freestyle
+ * \brief Class to define a cell grid surrounding the projected image of a scene
*/
#define SPHERICAL_GRID_LOGGING 0
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
index 34d8ecb3a8d..bb9f8069610 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/SteerableViewMap.cpp
- * \ingroup freestyle
- * \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to.
- * \author Stephane Grabli
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to.
*/
#include <sstream>
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.h b/source/blender/freestyle/intern/view_map/SteerableViewMap.h
index 1259d081209..608d64703f4 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.h
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_STEERABLE_VIEW_MAP_H__
#define __FREESTYLE_STEERABLE_VIEW_MAP_H__
-/** \file blender/freestyle/intern/view_map/SteerableViewMap.h
- * \ingroup freestyle
- * \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to.
- * \author Stephane Grabli
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to.
*/
#include <map>
diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
index 139502e8d5e..0ec008ebf2b 100644
--- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
- * \ingroup freestyle
- * \brief Class to build view edges and the underlying chains of feature edges...
- * \author Stephane Grabli
- * \date 27/10/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to build view edges and the underlying chains of feature edges...
*/
#include <list>
diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
index 7f214919114..fbe0ee8be0f 100644
--- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
+++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_VIEW_EDGE_X_BUILDER_H__
#define __FREESTYLE_VIEW_EDGE_X_BUILDER_H__
-/** \file blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
- * \ingroup freestyle
- * \brief Class to build view edges and the underlying chains of feature edges...
- * \author Stephane Grabli
- * \date 27/10/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to build view edges and the underlying chains of feature edges...
*/
#include <map>
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp
index 01a6edad973..d23a87d7159 100644
--- a/source/blender/freestyle/intern/view_map/ViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/ViewMap.cpp
- * \ingroup freestyle
- * \brief Classes to define a View Map (ViewVertex, ViewEdge, etc.)
- * \author Stephane Grabli
- * \date 03/09/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to define a View Map (ViewVertex, ViewEdge, etc.)
*/
#include <float.h>
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h
index 87b59dc1b54..4f0f50fbee2 100644
--- a/source/blender/freestyle/intern/view_map/ViewMap.h
+++ b/source/blender/freestyle/intern/view_map/ViewMap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_VIEW_MAP_H__
#define __FREESTYLE_VIEW_MAP_H__
-/** \file blender/freestyle/intern/view_map/ViewMap.h
- * \ingroup freestyle
- * \brief Classes to define a View Map (ViewVertex, ViewEdge, etc.)
- * \author Stephane Grabli
- * \date 03/09/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to define a View Map (ViewVertex, ViewEdge, etc.)
*/
#include <map>
diff --git a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h
index a3a0b5cbaeb..1b4a98498dd 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_VIEW_MAP_ADVANCED_ITERATORS_H__
#define __FREESTYLE_VIEW_MAP_ADVANCED_ITERATORS_H__
-/** \file blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h
- * \ingroup freestyle
- * \brief Iterators used to iterate over the various elements of the ViewMap.
+/** \file
+ * \ingroup freestyle
+ * \brief Iterators used to iterate over the various elements of the ViewMap.
* These iterators can't be exported to python.
- * \author Stephane Grabli
- * \date 01/07/2003
*/
#include "ViewMap.h"
@@ -279,7 +273,7 @@ protected:
++_tvertex_iter;
#if 0
// Hack to deal with cusp. the result of a cusp is a TVertex having two identical viewedges.
- // In order to iterate properly, we chose to to skip these last ones.
+ // In order to iterate properly, we chose to skip these last ones.
if (_feB.first == _beA.first) {
if (_feA.first == _beB.first) {
_tvertex_iter.first = 0;
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
index f5239b970f5..e2bc45fc03f 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/ViewMapBuilder.cpp
- * \ingroup freestyle
- * \brief Class to build silhouette edges from a Winged-Edge structure
- * \author Stephane Grabli
- * \date 25/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to build silhouette edges from a Winged-Edge structure
*/
#include <algorithm>
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.h b/source/blender/freestyle/intern/view_map/ViewMapBuilder.h
index acde3704625..4148ef5e436 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_VIEW_MAP_BUILDER_H__
#define __FREESTYLE_VIEW_MAP_BUILDER_H__
-/** \file blender/freestyle/intern/view_map/ViewMapBuilder.h
- * \ingroup freestyle
- * \brief Class to build silhouette edges from a Winged-Edge structure
- * \author Stephane Grabli
- * \date 25/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to build silhouette edges from a Winged-Edge structure
*/
#include <vector>
diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
index c0562cbb417..6a37467a867 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/ViewMapIO.cpp
- * \ingroup freestyle
- * \brief Functions to manage I/O for the view map
- * \author Emmanuel Turquin
- * \date 09/01/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions to manage I/O for the view map
*/
#include <limits.h>
diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.h b/source/blender/freestyle/intern/view_map/ViewMapIO.h
index eb26e8adab0..57eb450d45b 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapIO.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapIO.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_VIEW_MAP_IO_H__
#define __FREESTYLE_VIEW_MAP_IO_H__
-/** \file blender/freestyle/intern/view_map/ViewMapIO.h
- * \ingroup freestyle
- * \brief Functions to manage I/O for the view map
- * \author Emmanuel Turquin
- * \date 09/01/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Functions to manage I/O for the view map
*/
#include <fstream>
diff --git a/source/blender/freestyle/intern/view_map/ViewMapIterators.h b/source/blender/freestyle/intern/view_map/ViewMapIterators.h
index bec57bf36df..c8a5b6e5d42 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapIterators.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapIterators.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_VIEW_MAP_ITERATORS_H__
#define __FREESTYLE_VIEW_MAP_ITERATORS_H__
-/** \file blender/freestyle/intern/view_map/ViewMapIterators.h
- * \ingroup freestyle
- * \brief Iterators used to iterate over the various elements of the ViewMap
- * \author Stephane Grabli
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Iterators used to iterate over the various elements of the ViewMap
*/
#include "ViewMap.h"
diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp b/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp
index 74716a927fc..62656c6ade6 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/ViewMapTesselator.cpp
- * \ingroup freestyle
- * \brief Class to build a Node Tree designed to be displayed from a Silhouette View Map structure.
- * \author Stephane Grabli
- * \date 26/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to build a Node Tree designed to be displayed from a Silhouette View Map structure.
*/
#include "ViewMapTesselator.h"
diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h
index cb19875b6c7..a24a7cfdf18 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_VIEW_MAP_TESSELATOR_H__
#define __FREESTYLE_VIEW_MAP_TESSELATOR_H__
-/** \file blender/freestyle/intern/view_map/ViewMapTesselator.h
- * \ingroup freestyle
- * \brief Class to build a Node Tree designed to be displayed from a Silhouette View Map structure.
- * \author Stephane Grabli
- * \date 26/03/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Class to build a Node Tree designed to be displayed from a Silhouette View Map structure.
*/
#include "Silhouette.h"
diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp
index 989e101dd1a..28b38ae4854 100644
--- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp
+++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -27,20 +25,12 @@
* Campus Scientifique, BP 239
* 54506 VANDOEUVRE LES NANCY CEDEX
* FRANCE
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/winged_edge/Curvature.cpp
- * \ingroup freestyle
- * \brief GTS - Library for the manipulation of triangulated surfaces
- * \author Stephane Popinet
- * \date 1999
- * \brief OGF/Graphite: Geometry and Graphics Programming Library + Utilities
- * \author Bruno Levy
- * \date 2000-2003
+/** \file
+ * \ingroup freestyle
+ * \brief GTS - Library for the manipulation of triangulated surfaces
+ * \brief OGF/Graphite: Geometry and Graphics Programming Library + Utilities
*/
#include <assert.h>
diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.h b/source/blender/freestyle/intern/winged_edge/Curvature.h
index dbcecf5bc4b..b8f1a7b3094 100644
--- a/source/blender/freestyle/intern/winged_edge/Curvature.h
+++ b/source/blender/freestyle/intern/winged_edge/Curvature.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -27,23 +25,15 @@
* Campus Scientifique, BP 239
* 54506 VANDOEUVRE LES NANCY CEDEX
* FRANCE
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_CURVATURE_H__
#define __FREESTYLE_CURVATURE_H__
-/** \file blender/freestyle/intern/winged_edge/Curvature.h
- * \ingroup freestyle
- * \brief GTS - Library for the manipulation of triangulated surfaces
- * \author Stephane Popinet
- * \date 1999
- * \brief OGF/Graphite: Geometry and Graphics Programming Library + Utilities
- * \author Bruno Levy
- * \date 2000-2003
+/** \file
+ * \ingroup freestyle
+ * \brief GTS - Library for the manipulation of triangulated surfaces
+ * \brief OGF/Graphite: Geometry and Graphics Programming Library + Utilities
*/
#include "../geometry/Geom.h"
diff --git a/source/blender/freestyle/intern/winged_edge/Nature.h b/source/blender/freestyle/intern/winged_edge/Nature.h
index b1b5c88df5a..71b306ed2d5 100644
--- a/source/blender/freestyle/intern/winged_edge/Nature.h
+++ b/source/blender/freestyle/intern/winged_edge/Nature.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_NATURE_H__
#define __FREESTYLE_NATURE_H__
-/** \file blender/freestyle/intern/winged_edge/Nature.h
- * \ingroup freestyle
- * \brief Different natures for both vertices and edges
- * \author Emmanuel Turquin
- * \date 01/07/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Different natures for both vertices and edges
*/
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
index 7bec5ba1d6e..12a73491989 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/winged_edge/WEdge.cpp
- * \ingroup freestyle
- * \brief Classes to define a Winged Edge data structure.
- * \author Stephane Grabli
- * \date 18/02/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to define a Winged Edge data structure.
*/
#include <iostream>
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h
index 7efed908d73..b4807a4d921 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.h
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_W_EDGE_H__
#define __FREESTYLE_W_EDGE_H__
-/** \file blender/freestyle/intern/winged_edge/WEdge.h
- * \ingroup freestyle
- * \brief Classes to define a Winged Edge data structure.
- * \author Stephane Grabli
- * \date 18/02/2002
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to define a Winged Edge data structure.
*/
#include <iterator>
diff --git a/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp
index 707a9033f13..ea5e7dcc504 100644
--- a/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/winged_edge/WFillGrid.cpp
- * \ingroup freestyle
- * \brief Class to fill in a grid from a SceneGraph (uses only the WingedEdge structures)
- * \author Emmanuel Turquin
- * \author Stephane Grabli
- * \date 03/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to fill in a grid from a SceneGraph (uses only the WingedEdge structures)
*/
#include "WEdge.h"
diff --git a/source/blender/freestyle/intern/winged_edge/WFillGrid.h b/source/blender/freestyle/intern/winged_edge/WFillGrid.h
index 1b83b81274a..0e86d1a1684 100644
--- a/source/blender/freestyle/intern/winged_edge/WFillGrid.h
+++ b/source/blender/freestyle/intern/winged_edge/WFillGrid.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_W_FILL_GRID_H__
#define __FREESTYLE_W_FILL_GRID_H__
-/** \file blender/freestyle/intern/winged_edge/WFillGrid.h
- * \ingroup freestyle
- * \brief Class to fill in a grid from a SceneGraph (uses only the WingedEdge structures)
- * \author Emmanuel Turquin
- * \author Stephane Grabli
- * \date 03/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to fill in a grid from a SceneGraph (uses only the WingedEdge structures)
*/
#include "WEdge.h"
diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
index 352603758f6..4ef3f6a775f 100644
--- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/winged_edge/WSFillGrid.cpp
- * \ingroup freestyle
- * \brief Class to fill in a grid from a SceneGraph (uses only the WingedEdge structures)
- * \author Stephane Grabli
- * \date 03/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to fill in a grid from a SceneGraph (uses only the WingedEdge structures)
*/
#include "WEdge.h"
diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.h b/source/blender/freestyle/intern/winged_edge/WSFillGrid.h
index 247999bfcbf..9648c3bab07 100644
--- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.h
+++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_WS_FILL_GRID_H__
#define __FREESTYLE_WS_FILL_GRID_H__
-/** \file blender/freestyle/intern/winged_edge/WSFillGrid.h
- * \ingroup freestyle
- * \brief Class to fill in a grid from a SceneGraph (uses only the WingedEdge structures)
- * \author Stephane Grabli
- * \date 03/05/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Class to fill in a grid from a SceneGraph (uses only the WingedEdge structures)
*/
#include "WEdge.h"
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
index 11bce2b007e..611d7b3a7cf 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/winged_edge/WXEdge.cpp
- * \ingroup freestyle
- * \brief Classes to define an Extended Winged Edge data structure.
- * \author Stephane Grabli
- * \date 26/10/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to define an Extended Winged Edge data structure.
*/
#include "WXEdge.h"
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.h b/source/blender/freestyle/intern/winged_edge/WXEdge.h
index cabb1f81c1a..acca64b930d 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdge.h
+++ b/source/blender/freestyle/intern/winged_edge/WXEdge.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_WX_EDGE_H__
#define __FREESTYLE_WX_EDGE_H__
-/** \file blender/freestyle/intern/winged_edge/WXEdge.h
- * \ingroup freestyle
- * \brief Classes to define an Extended Winged Edge data structure.
- * \author Stephane Grabli
- * \date 26/10/2003
+/** \file
+ * \ingroup freestyle
+ * \brief Classes to define an Extended Winged Edge data structure.
*/
#include "Curvature.h"
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
index dfdeedef2e1..6fa73c3d212 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
- * \ingroup freestyle
- * \brief Class inherited from WingedEdgeBuilder and designed to build a WX (WingedEdge + extended info
+/** \file
+ * \ingroup freestyle
+ * \brief Class inherited from WingedEdgeBuilder and designed to build a WX (WingedEdge + extended info
* (silhouette etc...)) structure from a polygonal model
- * \author Stephane Grabli
- * \date 28/05/2003
*/
#include "WXEdge.h"
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h
index 6df4efcd9b7..a4eb270435a 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h
+++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_WX_EDGE_BUILDER_H__
#define __FREESTYLE_WX_EDGE_BUILDER_H__
-/** \file blender/freestyle/intern/winged_edge/WXEdgeBuilder.h
- * \ingroup freestyle
- * \brief Class inherited from WingedEdgeBuilder and designed to build a WX (WingedEdge + extended info
+/** \file
+ * \ingroup freestyle
+ * \brief Class inherited from WingedEdgeBuilder and designed to build a WX (WingedEdge + extended info
* (silhouette etc...)) structure from a polygonal model
- * \author Stephane Grabli
- * \date 28/05/2003
*/
#include "WingedEdgeBuilder.h"
diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
index 2ddc821da78..48b815e0d22 100644
--- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,16 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
- * \ingroup freestyle
- * \brief Class to render a WingedEdge data structure from a polyhedral data structure organized in nodes
+/** \file
+ * \ingroup freestyle
+ * \brief Class to render a WingedEdge data structure from a polyhedral data structure organized in nodes
* of a scene graph
- * \author Stephane Grabli
- * \date 28/05/2003
*/
#include <set>
diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
index 601c208b137..30fe7277fdb 100644
--- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
+++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_WINGED_EDGE_BUILDER_H__
#define __FREESTYLE_WINGED_EDGE_BUILDER_H__
-/** \file blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
- * \ingroup freestyle
- * \brief Class to render a WingedEdge data structure from a polyhedral data structure organized in nodes
+/** \file
+ * \ingroup freestyle
+ * \brief Class to render a WingedEdge data structure from a polyhedral data structure organized in nodes
* of a scene graph
- * \author Stephane Grabli
- * \date 28/05/2003
*/
#include "WEdge.h"
diff --git a/source/blender/gpencil_modifiers/CMakeLists.txt b/source/blender/gpencil_modifiers/CMakeLists.txt
index b28a83372b8..e1aad91050a 100644
--- a/source/blender/gpencil_modifiers/CMakeLists.txt
+++ b/source/blender/gpencil_modifiers/CMakeLists.txt
@@ -44,21 +44,21 @@ set(SRC
intern/MOD_gpencil_util.c
intern/MOD_gpencilarmature.c
- intern/MOD_gpencilnoise.c
- intern/MOD_gpencilsubdiv.c
- intern/MOD_gpencilsimplify.c
- intern/MOD_gpencilthick.c
- intern/MOD_gpenciltint.c
- intern/MOD_gpencilcolor.c
intern/MOD_gpencilarray.c
intern/MOD_gpencilbuild.c
- intern/MOD_gpencilopacity.c
+ intern/MOD_gpencilcolor.c
+ intern/MOD_gpencilhook.c
intern/MOD_gpencillattice.c
intern/MOD_gpencilmirror.c
- intern/MOD_gpencilsmooth.c
- intern/MOD_gpencilhook.c
+ intern/MOD_gpencilnoise.c
intern/MOD_gpenciloffset.c
+ intern/MOD_gpencilopacity.c
+ intern/MOD_gpencilsimplify.c
+ intern/MOD_gpencilsmooth.c
+ intern/MOD_gpencilsubdiv.c
+ intern/MOD_gpencilthick.c
intern/MOD_gpenciltime.c
+ intern/MOD_gpenciltint.c
MOD_gpencil_modifiertypes.h
)
diff --git a/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h b/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h
index 07db9f15288..e3b07e04676 100644
--- a/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h
+++ b/source/blender/gpencil_modifiers/MOD_gpencil_modifiertypes.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file MOD_gpencil_modifiertypes.h
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#ifndef __MOD_GPENCIL_MODIFIERTYPES_H__
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
index d7828632ebf..cc6d316bd3a 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencil_util.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
@@ -32,12 +26,11 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
-#include "BLI_utildefines.h"
#include "BLI_math_vector.h"
-#include "BLI_math_color.h"
-#include "BLI_rand.h"
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
@@ -46,7 +39,6 @@
#include "DNA_gpencil_modifier_types.h"
#include "BKE_deform.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_lattice.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h
index 480c431b8b4..2f95840c268 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,23 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencil_util.h
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#ifndef __MOD_GPENCIL_UTIL_H__
#define __MOD_GPENCIL_UTIL_H__
+struct GHash;
+struct MDeformVert;
struct Main;
+struct Material;
struct Object;
struct bGPDlayer;
struct bGPDstroke;
-struct MDeformVert;
-struct Material;
-struct GHash;
bool is_stroke_affected_by_modifier(
struct Object *ob, char *mlayername, int mpassindex,
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
index 55728ca581f..f3448fe2c1c 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,18 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_armature_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
@@ -37,14 +34,8 @@
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_modifier_types.h"
-#include "BLI_math.h"
-
-#include "BLI_listbase.h"
-#include "BLI_task.h"
-#include "BLI_utildefines.h"
#include "BKE_lattice.h"
-#include "BKE_context.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_modifier.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index 553d9087c3f..361b8de9288 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,35 +15,30 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilarray.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
#include "MEM_guardedalloc.h"
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_gpencil_types.h"
-#include "DNA_gpencil_modifier_types.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_rand.h"
#include "BLI_math.h"
-#include "BLI_utildefines.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_gpencil_types.h"
+#include "DNA_gpencil_modifier_types.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_modifier.h"
-#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_main.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
index dbf1a67603f..b1e9a45bfa1 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,32 +15,27 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
@@ -57,7 +50,7 @@ static void initData(GpencilModifierData *md)
BuildGpencilModifierData *gpmd = (BuildGpencilModifierData *)md;
/* We deliberately set this range to the half the default
- * frame-range to have an immediate effect ot suggest use-cases
+ * frame-range to have an immediate effect to suggest use-cases
*/
gpmd->start_frame = 1;
gpmd->end_frame = 125;
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
index 94c5e9ddbdf..12d91ed4653 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,32 +15,26 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_gpencil_types.h"
-#include "DNA_gpencil_modifier_types.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "BLI_math_color.h"
#include "BLI_math_vector.h"
-#include "BLI_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_context.h"
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_gpencil_types.h"
+#include "DNA_gpencil_modifier_types.h"
+
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_main.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
index 97f260f307f..5d63c238f60 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,31 +15,26 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilhook.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_modifier_types.h"
-#include "BLI_math.h"
-
-#include "BLI_utildefines.h"
#include "BKE_action.h"
-#include "BKE_context.h"
#include "BKE_colortools.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
@@ -210,7 +203,7 @@ static void deformStroke(
if (!is_stroke_affected_by_modifier(
ob,
- mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, gps,
+ mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, gps,
mmd->flag & GP_HOOK_INVERT_LAYER, mmd->flag & GP_HOOK_INVERT_PASS,
mmd->flag & GP_HOOK_INVERT_LAYERPASS))
{
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
index 1d8f2c20b59..34ec69bf85a 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,22 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencillattice.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
@@ -83,7 +75,7 @@ static void deformStroke(
if (!is_stroke_affected_by_modifier(
ob,
- mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, gps,
+ mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, gps,
mmd->flag & GP_LATTICE_INVERT_LAYER, mmd->flag & GP_LATTICE_INVERT_PASS,
mmd->flag & GP_LATTICE_INVERT_LAYERPASS))
{
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
index 52de1529b72..db84bc0b467 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,25 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "BLI_listbase.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
@@ -84,24 +77,26 @@ static void update_position(Object *ob, MirrorGpencilModifierData *mmd, bGPDstro
clear[axis] = 1.0f;
float ob_origin[3];
- float mirror_origin[3];
float pt_origin[3];
- copy_v3_v3(ob_origin, ob->loc);
+ if (mmd->object) {
+ float inv_mat[4][4];
+
+ invert_m4_m4(inv_mat, mmd->object->obmat);
+ mul_v3_m4v3(ob_origin, inv_mat, ob->obmat[3]);
+ }
+ else {
+ copy_v3_v3(ob_origin, ob->obmat[3]);
+ }
+
/* only works with current axis */
mul_v3_v3(ob_origin, clear);
- zero_v3(mirror_origin);
- if (mmd->object) {
- mul_v3_v3v3(mirror_origin, mmd->object->loc, clear);
- }
+ mul_v3_v3fl(pt_origin, ob_origin, -2.0f);
- /* clear other axis */
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
mul_v3_v3(&pt->x, factor);
if (mmd->object) {
- sub_v3_v3v3(pt_origin, ob_origin, mirror_origin);
- mul_v3_fl(pt_origin, -2.0f);
add_v3_v3(&pt->x, pt_origin);
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
index 722cf861fb1..9bfbe20343e 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,16 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
-#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+
#include "BLI_math_vector.h"
#include "BLI_rand.h"
@@ -43,8 +36,6 @@
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
@@ -96,8 +87,8 @@ static bool dependsOnTime(GpencilModifierData *md)
/* aply noise effect based on stroke direction */
static void deformStroke(
- GpencilModifierData *md, Depsgraph *depsgraph,
- Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
+ GpencilModifierData *md, Depsgraph *depsgraph,
+ Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
{
NoiseGpencilModifierData *mmd = (NoiseGpencilModifierData *)md;
bGPDspoint *pt0, *pt1;
@@ -108,6 +99,7 @@ static void deformStroke(
int sc_frame = 0;
int sc_diff = 0;
const int def_nr = defgroup_name_index(ob, mmd->vgname);
+ const float unit_v3[3] = { 1.0f, 1.0f, 1.0f };
/* Random generator, only init once. */
if (mmd->rng == NULL) {
@@ -118,7 +110,7 @@ static void deformStroke(
if (!is_stroke_affected_by_modifier(
ob,
- mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, gps,
+ mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, gps,
mmd->flag & GP_NOISE_INVERT_LAYER, mmd->flag & GP_NOISE_INVERT_PASS,
mmd->flag & GP_NOISE_INVERT_LAYERPASS))
{
@@ -130,7 +122,12 @@ static void deformStroke(
zero_v3(vec2);
/* calculate stroke normal*/
- BKE_gpencil_stroke_normal(gps, normal);
+ if (gps->totpoints > 2) {
+ BKE_gpencil_stroke_normal(gps, normal);
+ }
+ else {
+ copy_v3_v3(normal, unit_v3);
+ }
/* move points */
for (int i = 0; i < gps->totpoints; i++) {
@@ -138,13 +135,13 @@ static void deformStroke(
continue;
}
- /* last point is special */
- if (i == gps->totpoints) {
+ /* first point is special */
+ if (i == 0) {
if (gps->dvert) {
- dvert = &gps->dvert[i - 2];
+ dvert = &gps->dvert[0];
}
- pt0 = &gps->points[i - 2];
- pt1 = &gps->points[i - 1];
+ pt0 = (gps->totpoints > 1) ? &gps->points[1] : &gps->points[0];
+ pt1 = &gps->points[0];
}
else {
int prev_idx = i - 1;
@@ -164,7 +161,12 @@ static void deformStroke(
}
/* initial vector (p0 -> p1) */
- sub_v3_v3v3(vec1, &pt1->x, &pt0->x);
+ if (i == 0) {
+ sub_v3_v3v3(vec1, &pt0->x, &pt1->x);
+ }
+ else {
+ sub_v3_v3v3(vec1, &pt1->x, &pt0->x);
+ }
vran = len_v3(vec1);
/* vector orthogonal to normal */
cross_v3_v3v3(vec2, vec1, normal);
@@ -203,7 +205,14 @@ static void deformStroke(
mmd->gp_frame = -999999;
}
- /* apply randomness to location of the point */
+ /* if vec2 is zero, set to something */
+ if (gps->totpoints < 3) {
+ if ((vec2[0] == 0.0f) && (vec2[1] == 0.0f) && (vec2[2] == 0.0f)) {
+ copy_v3_v3(vec2, unit_v3);
+ }
+ }
+
+ /* apply randomness to location of the point */
if (mmd->flag & GP_NOISE_MOD_LOCATION) {
/* factor is too sensitive, so need divide */
shift = ((vran * mmd->factor) / 1000.0f) * weight;
@@ -219,10 +228,10 @@ static void deformStroke(
/* apply randomness to thickness */
if (mmd->flag & GP_NOISE_MOD_THICKNESS) {
if (vdir > 0.5f) {
- pt1->pressure -= pt1->pressure * vran * mmd->factor;
+ pt1->pressure -= pt1->pressure * vran * mmd->factor * weight;
}
else {
- pt1->pressure += pt1->pressure * vran * mmd->factor;
+ pt1->pressure += pt1->pressure * vran * mmd->factor * weight;
}
CLAMP_MIN(pt1->pressure, GPENCIL_STRENGTH_MIN);
}
@@ -230,20 +239,20 @@ static void deformStroke(
/* apply randomness to color strength */
if (mmd->flag & GP_NOISE_MOD_STRENGTH) {
if (vdir > 0.5f) {
- pt1->strength -= pt1->strength * vran * mmd->factor;
+ pt1->strength -= pt1->strength * vran * mmd->factor * weight;
}
else {
- pt1->strength += pt1->strength * vran * mmd->factor;
+ pt1->strength += pt1->strength * vran * mmd->factor * weight;
}
CLAMP_MIN(pt1->strength, GPENCIL_STRENGTH_MIN);
}
/* apply randomness to uv rotation */
if (mmd->flag & GP_NOISE_MOD_UV) {
if (vdir > 0.5f) {
- pt1->uv_rot -= pt1->uv_rot * vran * mmd->factor;
+ pt1->uv_rot -= pt1->uv_rot * vran * mmd->factor * weight;
}
else {
- pt1->uv_rot += pt1->uv_rot * vran * mmd->factor;
+ pt1->uv_rot += pt1->uv_rot * vran * mmd->factor * weight;
}
CLAMP(pt1->uv_rot, -M_PI_2, M_PI_2);
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
index 2c2a5c2f994..785eee9d69f 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,25 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "BLI_utildefines.h"
-#include "BLI_math.h"
-
#include "BKE_colortools.h"
-#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index 7033b246e1c..ca6ea77d6d0 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,19 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "BLI_math_vector.h"
-#include "BLI_utildefines.h"
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
@@ -41,7 +35,6 @@
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_material.h"
#include "BKE_gpencil.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
index 6ddf40df6c0..d77db3c3877 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
@@ -1,5 +1,4 @@
-/* ***** 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
@@ -16,28 +15,22 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_vec_types.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
index ece7ebc9816..104b27965a5 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,21 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
index 71881de50fc..b328289af91 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,31 +15,24 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
- /** \file blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
- * \ingroup modifiers
- */
+/** \file
+ * \ingroup modifiers
+ */
#include <stdio.h>
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
index 441cab909d3..2f8c411af18 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,23 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpencilthick.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_gpencil_modifier_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_colortools.h"
-#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
index d90dea91af9..1863ec067e1 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpenciltime.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
@@ -40,7 +33,6 @@
#include "DNA_gpencil_modifier_types.h"
#include "BKE_colortools.h"
-#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
index 385296c943e..9f82da71957 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,31 +15,25 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/gpencil_modifiers/intern/MOD_gpenciltint.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_gpencil_types.h"
-#include "DNA_gpencil_modifier_types.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "BLI_math_vector.h"
-#include "BLI_utildefines.h"
-#include "BKE_context.h"
-#include "BKE_global.h"
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_gpencil_types.h"
+#include "DNA_gpencil_modifier_types.h"
+
#include "BKE_gpencil.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_material.h"
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 02e5d4ac479..b76edf4068a 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
# WITH_OPENGL limits the visibility of the opengl headers to just GPU and bg_gpu,
@@ -218,6 +213,9 @@ data_to_c_simple(shaders/gpu_shader_2D_edituvs_edges_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_edituvs_faces_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_edituvs_stretch_vert.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_3D_selection_id_vert.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_selection_id_frag.glsl SRC)
+
data_to_c_simple(shaders/gpu_shader_edges_front_back_persp_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_edges_front_back_persp_geom.glsl SRC)
data_to_c_simple(shaders/gpu_shader_edges_front_back_persp_legacy_vert.glsl SRC)
@@ -244,6 +242,8 @@ data_to_c_simple(shaders/gpu_shader_gpencil_stroke_geom.glsl SRC)
data_to_c_simple(shaders/gpu_shader_gpencil_fill_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_gpencil_fill_frag.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_cfg_world_clip_lib.glsl SRC)
+
if(WITH_MOD_SMOKE)
add_definitions(-DWITH_SMOKE)
diff --git a/source/blender/gpu/GPU_attr_binding.h b/source/blender/gpu/GPU_attr_binding.h
index 186acacb71d..4d7bdafe2eb 100644
--- a/source/blender/gpu/GPU_attr_binding.h
+++ b/source/blender/gpu/GPU_attr_binding.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_attr_binding.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU vertex attribute binding
*/
@@ -35,8 +29,10 @@
#include "GPU_common.h"
typedef struct GPUAttrBinding {
- uint64_t loc_bits; /* store 4 bits for each of the 16 attribs */
- uint16_t enabled_bits; /* 1 bit for each attrib */
+ /** Store 4 bits for each of the 16 attributes. */
+ uint64_t loc_bits;
+ /** 1 bit for each attribute. */
+ uint16_t enabled_bits;
} GPUAttrBinding;
#endif /* __GPU_ATTR_BINDING_H__ */
diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h
index f4911d15e56..95eb59a57ae 100644
--- a/source/blender/gpu/GPU_batch.h
+++ b/source/blender/gpu/GPU_batch.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_batch.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU geometry batch
* Contains VAOs + VBOs + Shader representing a drawable entity.
@@ -51,9 +45,13 @@ typedef enum {
typedef struct GPUBatch {
/* geometry */
- GPUVertBuf *verts[GPU_BATCH_VBO_MAX_LEN]; /* verts[0] is required, others can be NULL */
- GPUVertBuf *inst; /* instance attribs */
- GPUIndexBuf *elem; /* NULL if element list not needed */
+
+ /** verts[0] is required, others can be NULL */
+ GPUVertBuf *verts[GPU_BATCH_VBO_MAX_LEN];
+ /** Instance attributes. */
+ GPUVertBuf *inst;
+ /** NULL if element list not needed */
+ GPUIndexBuf *elem;
uint32_t gl_prim_type;
/* cached values (avoid dereferencing later) */
@@ -63,21 +61,22 @@ typedef struct GPUBatch {
/* book-keeping */
uint owns_flag;
- struct GPUContext *context; /* used to free all vaos. this implies all vaos were created under the same context. */
+ /** used to free all vaos. this implies all vaos were created under the same context. */
+ struct GPUContext *context;
GPUBatchPhase phase;
bool program_in_use;
- /* Vao management: remembers all geometry state (vertex attrib bindings & element buffer)
+ /* Vao management: remembers all geometry state (vertex attribute bindings & element buffer)
* for each shader interface. Start with a static number of vaos and fallback to dynamic count
* if necessary. Once a batch goes dynamic it does not go back. */
bool is_dynamic_vao_count;
union {
- /* Static handle count */
+ /** Static handle count */
struct {
const struct GPUShaderInterface *interfaces[GPU_BATCH_VAO_STATIC_LEN];
uint32_t vao_ids[GPU_BATCH_VAO_STATIC_LEN];
} static_vaos;
- /* Dynamic handle count */
+ /** Dynamic handle count */
struct {
uint count;
const struct GPUShaderInterface **interfaces;
@@ -123,7 +122,11 @@ int GPU_batch_vertbuf_add_ex(GPUBatch *, GPUVertBuf *, bool own_vbo);
void GPU_batch_program_set_no_use(GPUBatch *, uint32_t program, const GPUShaderInterface *);
void GPU_batch_program_set(GPUBatch *, uint32_t program, const GPUShaderInterface *);
-void GPU_batch_program_set_builtin(GPUBatch *batch, GPUBuiltinShader shader_id);
+void GPU_batch_program_set_shader(GPUBatch *, GPUShader *shader);
+void GPU_batch_program_set_builtin(
+ GPUBatch *batch, eGPUBuiltinShader shader_id);
+void GPU_batch_program_set_builtin_with_config(
+ GPUBatch *batch, eGPUBuiltinShader shader_id, eGPUShaderConfig sh_cfg);
/* Entire batch draws with one shader program, but can be redrawn later with another program. */
/* Vertex shader's inputs must be compatible with the batch's vertex format. */
diff --git a/source/blender/gpu/GPU_batch_presets.h b/source/blender/gpu/GPU_batch_presets.h
index 30b1574e19c..9e4ced93597 100644
--- a/source/blender/gpu/GPU_batch_presets.h
+++ b/source/blender/gpu/GPU_batch_presets.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Mike Erwin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_batch_presets.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Batched geometry rendering is powered by the GPU library.
* This file contains any additions or modifications specific to Blender.
@@ -34,8 +27,8 @@
#ifndef __GPU_BATCH_PRESETS_H__
#define __GPU_BATCH_PRESETS_H__
-struct rctf;
struct GPUVertFormat;
+struct rctf;
#include "BLI_compiler_attrs.h"
#include "BLI_sys_types.h"
diff --git a/source/blender/gpu/GPU_batch_utils.h b/source/blender/gpu/GPU_batch_utils.h
index 05bbb6542ff..c18f90479ef 100644
--- a/source/blender/gpu/GPU_batch_utils.h
+++ b/source/blender/gpu/GPU_batch_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_batch_utils.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_BATCH_UTILS_H__
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index 5b96312300b..8762a1cb222 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_buffers.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_BUFFERS_H__
@@ -57,7 +49,8 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(
const int face_indices_len);
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(
- int *grid_indices, int totgrid, unsigned int **grid_hidden, int gridsize, const struct CCGKey *key);
+ int totgrid,
+ unsigned int **grid_hidden);
GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading);
@@ -88,7 +81,7 @@ void GPU_pbvh_grid_buffers_update(
const int update_flags);
/* draw */
-struct GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast);
+struct GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast, bool wires);
bool GPU_pbvh_buffers_has_mask(GPU_PBVH_Buffers *buffers);
diff --git a/source/blender/gpu/GPU_common.h b/source/blender/gpu/GPU_common.h
index 3acc7fad5c2..36b369a31ff 100644
--- a/source/blender/gpu/GPU_common.h
+++ b/source/blender/gpu/GPU_common.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_common.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_COMMON_H__
diff --git a/source/blender/gpu/GPU_context.h b/source/blender/gpu/GPU_context.h
index 4d667a02fac..1f812129e29 100644
--- a/source/blender/gpu/GPU_context.h
+++ b/source/blender/gpu/GPU_context.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_context.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* This interface allow GPU to manage VAOs for multiple context and threads.
*/
diff --git a/source/blender/gpu/GPU_debug.h b/source/blender/gpu/GPU_debug.h
index c7a99d33654..8928581ee08 100644
--- a/source/blender/gpu/GPU_debug.h
+++ b/source/blender/gpu/GPU_debug.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jason Wilkins.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/gpu/GPU_debug.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_DEBUG_H__
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 008f4199b02..f9ea9a35084 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_draw.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_DRAW_H__
@@ -36,17 +28,17 @@
extern "C" {
#endif
+struct DupliObject;
struct ImBuf;
struct Image;
struct ImageUser;
struct Main;
struct Object;
-struct Scene;
-struct ViewLayer;
-struct View3D;
struct RegionView3D;
+struct Scene;
struct SmokeModifierData;
-struct DupliObject;
+struct View3D;
+struct ViewLayer;
#include "DNA_object_enums.h"
@@ -80,9 +72,6 @@ void GPU_paint_set_mipmap(struct Main *bmain, bool mipmap);
void GPU_set_anisotropic(struct Main *bmain, float value);
float GPU_get_anisotropic(void);
-/* enable gpu mipmapping */
-void GPU_set_gpu_mipmapping(struct Main *bmain, int gpu_mipmap);
-
/* Image updates and free
* - these deal with images bound as opengl textures */
@@ -115,16 +104,16 @@ void GPU_select_index_get(int index, int *r_col);
int GPU_select_to_index(unsigned int col);
void GPU_select_to_index_array(unsigned int *col, const unsigned int size);
-typedef enum eGPUAttribMask {
+typedef enum eGPUAttrMask {
GPU_DEPTH_BUFFER_BIT = (1 << 0),
GPU_ENABLE_BIT = (1 << 1),
GPU_SCISSOR_BIT = (1 << 2),
GPU_VIEWPORT_BIT = (1 << 3),
GPU_BLEND_BIT = (1 << 4),
-} eGPUAttribMask;
+} eGPUAttrMask;
-void gpuPushAttrib(eGPUAttribMask mask);
-void gpuPopAttrib(void);
+void gpuPushAttr(eGPUAttrMask mask);
+void gpuPopAttr(void);
#ifdef __cplusplus
}
diff --git a/source/blender/gpu/GPU_element.h b/source/blender/gpu/GPU_element.h
index b8a42b7c880..96d9acc55a8 100644
--- a/source/blender/gpu/GPU_element.h
+++ b/source/blender/gpu/GPU_element.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_element.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU element list (AKA index buffer)
*/
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index 22eb917f0bd..3154119592d 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_extensions.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_EXTENSIONS_H__
@@ -55,6 +47,7 @@ void GPU_get_dfdy_factors(float fac[2]);
bool GPU_mip_render_workaround(void);
bool GPU_depth_blitting_workaround(void);
bool GPU_unused_fb_slot_workaround(void);
+bool GPU_crappy_amd_driver(void);
bool GPU_mem_stats_supported(void);
void GPU_mem_stats_get(int *totalmem, int *freemem);
@@ -63,31 +56,31 @@ void GPU_code_generate_glsl_lib(void);
/* GPU Types */
-typedef enum GPUDeviceType {
+typedef enum eGPUDeviceType {
GPU_DEVICE_NVIDIA = (1 << 0),
GPU_DEVICE_ATI = (1 << 1),
GPU_DEVICE_INTEL = (1 << 2),
GPU_DEVICE_INTEL_UHD = (1 << 3),
GPU_DEVICE_SOFTWARE = (1 << 4),
GPU_DEVICE_UNKNOWN = (1 << 5),
- GPU_DEVICE_ANY = (0xff)
-} GPUDeviceType;
+ GPU_DEVICE_ANY = (0xff),
+} eGPUDeviceType;
-typedef enum GPUOSType {
+typedef enum eGPUOSType {
GPU_OS_WIN = (1 << 8),
GPU_OS_MAC = (1 << 9),
GPU_OS_UNIX = (1 << 10),
- GPU_OS_ANY = (0xff00)
-} GPUOSType;
+ GPU_OS_ANY = (0xff00),
+} eGPUOSType;
-typedef enum GPUDriverType {
+typedef enum eGPUDriverType {
GPU_DRIVER_OFFICIAL = (1 << 16),
GPU_DRIVER_OPENSOURCE = (1 << 17),
GPU_DRIVER_SOFTWARE = (1 << 18),
- GPU_DRIVER_ANY = (0xff0000)
-} GPUDriverType;
+ GPU_DRIVER_ANY = (0xff0000),
+} eGPUDriverType;
-bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver);
+bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver);
#ifdef __cplusplus
}
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h
index ef49f9721dd..b635f9489d0 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_framebuffer.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_FRAMEBUFFER_H__
@@ -43,11 +35,11 @@ typedef struct GPUAttachment {
int mip, layer;
} GPUAttachment;
-typedef enum GPUFrameBufferBits {
+typedef enum eGPUFrameBufferBits {
GPU_COLOR_BIT = (1 << 0),
GPU_DEPTH_BIT = (1 << 1),
GPU_STENCIL_BIT = (1 << 2),
-} GPUFrameBufferBits;
+} eGPUFrameBufferBits;
typedef struct GPUFrameBuffer GPUFrameBuffer;
typedef struct GPUOffScreen GPUOffScreen;
@@ -119,28 +111,28 @@ void GPU_framebuffer_texture_detach_slot(
void GPU_framebuffer_config_array(GPUFrameBuffer *fb, const GPUAttachment *config, int config_len);
#define GPU_ATTACHMENT_NONE \
- {.tex = NULL, .layer = -1, .mip = 0}
+ { .tex = NULL, .layer = -1, .mip = 0, }
#define GPU_ATTACHMENT_LEAVE \
- {.tex = NULL, .layer = -1, .mip = -1}
+ { .tex = NULL, .layer = -1, .mip = -1, }
#define GPU_ATTACHMENT_TEXTURE(_tex) \
- {.tex = _tex, .layer = -1, .mip = 0}
+ { .tex = _tex, .layer = -1, .mip = 0, }
#define GPU_ATTACHMENT_TEXTURE_MIP(_tex, _mip) \
- {.tex = _tex, .layer = -1, .mip = _mip}
+ { .tex = _tex, .layer = -1, .mip = _mip, }
#define GPU_ATTACHMENT_TEXTURE_LAYER(_tex, _layer) \
- {.tex = _tex, .layer = _layer, .mip = 0}
+ { .tex = _tex, .layer = _layer, .mip = 0, }
#define GPU_ATTACHMENT_TEXTURE_LAYER_MIP(_tex, _layer, _mip) \
- {.tex = _tex, .layer = _layer, .mip = _mip}
+ { .tex = _tex, .layer = _layer, .mip = _mip, }
#define GPU_ATTACHMENT_TEXTURE_CUBEFACE(_tex, _face) \
- {.tex = _tex, .layer = _face, .mip = 0}
+ { .tex = _tex, .layer = _face, .mip = 0, }
#define GPU_ATTACHMENT_TEXTURE_CUBEFACE_MIP(_tex, _face, _mip) \
- {.tex = _tex, .layer = _face, .mip = _mip}
+ { .tex = _tex, .layer = _face, .mip = _mip, }
/* Framebuffer operations */
void GPU_framebuffer_viewport_set(GPUFrameBuffer *fb, int x, int y, int w, int h);
void GPU_framebuffer_clear(
- GPUFrameBuffer *fb, GPUFrameBufferBits buffers,
+ GPUFrameBuffer *fb, eGPUFrameBufferBits buffers,
const float clear_col[4], float clear_depth, unsigned int clear_stencil);
#define GPU_framebuffer_clear_color(fb, col) \
@@ -168,7 +160,7 @@ void GPU_framebuffer_read_color(
void GPU_framebuffer_blit(
GPUFrameBuffer *fb_read, int read_slot,
GPUFrameBuffer *fb_write, int write_slot,
- GPUFrameBufferBits blit_buffers);
+ eGPUFrameBufferBits blit_buffers);
void GPU_framebuffer_recursive_downsample(
GPUFrameBuffer *fb, int max_lvl,
@@ -195,7 +187,7 @@ void GPU_offscreen_viewport_data_get(
GPUFrameBuffer **r_fb, struct GPUTexture **r_color, struct GPUTexture **r_depth);
void GPU_clear_color(float red, float green, float blue, float alpha);
-void GPU_clear(GPUFrameBufferBits flags);
+void GPU_clear(eGPUFrameBufferBits flags);
#ifdef __cplusplus
}
diff --git a/source/blender/gpu/GPU_glew.h b/source/blender/gpu/GPU_glew.h
index 663660ab234..744bce9713a 100644
--- a/source/blender/gpu/GPU_glew.h
+++ b/source/blender/gpu/GPU_glew.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jason Wilkins.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/gpu/GPU_glew.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_GLEW_H__
diff --git a/source/blender/gpu/GPU_immediate.h b/source/blender/gpu/GPU_immediate.h
index a57ce674b77..57912c01991 100644
--- a/source/blender/gpu/GPU_immediate.h
+++ b/source/blender/gpu/GPU_immediate.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Mike Erwin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_immediate.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU immediate mode work-alike
*/
@@ -40,13 +33,18 @@
#include "GPU_immediate_util.h"
#include "GPU_shader.h"
-GPUVertFormat *immVertexFormat(void); /* returns a cleared vertex format, ready for add_attrib. */
+/** Returns a cleared vertex format, ready for #add_attr. */
+GPUVertFormat *immVertexFormat(void);
-void immBindProgram(uint32_t program, const GPUShaderInterface *); /* every immBegin must have a program bound first. */
-void immUnbindProgram(void); /* call after your last immEnd, or before binding another program. */
+/** Every immBegin must have a program bound first. */
+void immBindProgram(uint32_t program, const GPUShaderInterface *);
+/** Call after your last immEnd, or before binding another program. */
+void immUnbindProgram(void);
-void immBegin(GPUPrimType, uint vertex_len); /* must supply exactly vertex_len vertices. */
-void immBeginAtMost(GPUPrimType, uint max_vertex_len); /* can supply fewer vertices. */
+/** Must supply exactly vertex_len vertices. */
+void immBegin(GPUPrimType, uint vertex_len);
+/** Can supply fewer vertices. */
+void immBeginAtMost(GPUPrimType, uint max_vertex_len);
void immEnd(void); /* finishes and draws. */
/* ImmBegin a batch, then use standard immFunctions as usual. */
@@ -128,7 +126,7 @@ void immUniformColor4ubv(const unsigned char rgba[4]);
/* Extend immBindProgram to use Blender’s library of built-in shader programs.
* Use immUnbindProgram() when done. */
-void immBindBuiltinProgram(GPUBuiltinShader shader_id);
+void immBindBuiltinProgram(eGPUBuiltinShader shader_id);
/* Extend immUniformColor to take Blender's themes */
void immUniformThemeColor(int color_id);
diff --git a/source/blender/gpu/GPU_immediate_util.h b/source/blender/gpu/GPU_immediate_util.h
index e5b259b4783..50d20c753a3 100644
--- a/source/blender/gpu/GPU_immediate_util.h
+++ b/source/blender/gpu/GPU_immediate_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_immediate_util.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Utility drawing functions (rough equivalent to OpenGL's GLU)
*/
diff --git a/source/blender/gpu/GPU_init_exit.h b/source/blender/gpu/GPU_init_exit.h
index 8f1a42c8795..59aef162a9d 100644
--- a/source/blender/gpu/GPU_init_exit.h
+++ b/source/blender/gpu/GPU_init_exit.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jason Wilkins.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_init_exit.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_INIT_EXIT_H__
diff --git a/source/blender/gpu/GPU_legacy_stubs.h b/source/blender/gpu/GPU_legacy_stubs.h
index 27f805c4d31..b290e4b093c 100644
--- a/source/blender/gpu/GPU_legacy_stubs.h
+++ b/source/blender/gpu/GPU_legacy_stubs.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation, Dalai Felinto.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_legacy_stubs.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* This is to mark the transition to OpenGL core profile
* The idea is to allow Blender 2.8 to be built with OpenGL 3.3 even if it means breaking things
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index c2e8dcd2ab6..fac8270cd58 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_material.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_MATERIAL_H__
@@ -41,34 +33,34 @@
extern "C" {
#endif
+struct GPUMaterial;
+struct GPUNode;
+struct GPUNodeLink;
+struct GPUNodeStack;
+struct GPUTexture;
+struct GPUUniformBuffer;
+struct GPUVertAttrLayers;
struct Image;
struct ImageUser;
struct ListBase;
struct Main;
struct Material;
struct Object;
-struct Scene;
-struct GPUVertexAttribs;
-struct GPUNode;
-struct GPUNodeLink;
-struct GPUNodeStack;
-struct GPUMaterial;
-struct GPUTexture;
-struct GPUUniformBuffer;
struct PreviewImage;
+struct Scene;
struct World;
struct bNode;
struct bNodeTree;
+typedef struct GPUMaterial GPUMaterial;
typedef struct GPUNode GPUNode;
typedef struct GPUNodeLink GPUNodeLink;
-typedef struct GPUMaterial GPUMaterial;
typedef struct GPUParticleInfo GPUParticleInfo;
/* Functions to create GPU Materials nodes */
-typedef enum GPUType {
+typedef enum eGPUType {
/* Keep in sync with GPU_DATATYPE_STR */
/* The value indicates the number of elements in each type */
GPU_NONE = 0,
@@ -90,10 +82,10 @@ typedef enum GPUType {
GPU_CLOSURE = 1006,
/* Opengl Attributes */
- GPU_ATTRIB = 3001
-} GPUType;
+ GPU_ATTR = 3001,
+} eGPUType;
-typedef enum GPUBuiltin {
+typedef enum eGPUBuiltin {
GPU_VIEW_MATRIX = (1 << 0),
GPU_OBJECT_MATRIX = (1 << 1),
GPU_INVERSE_VIEW_MATRIX = (1 << 2),
@@ -115,26 +107,26 @@ typedef enum GPUBuiltin {
GPU_VOLUME_TEMPERATURE = (1 << 18),
GPU_BARYCENTRIC_TEXCO = (1 << 19),
GPU_BARYCENTRIC_DIST = (1 << 20),
-} GPUBuiltin;
+} eGPUBuiltin;
-typedef enum GPUMatFlag {
+typedef enum eGPUMatFlag {
GPU_MATFLAG_DIFFUSE = (1 << 0),
GPU_MATFLAG_GLOSSY = (1 << 1),
GPU_MATFLAG_REFRACT = (1 << 2),
GPU_MATFLAG_SSS = (1 << 3),
-} GPUMatFlag;
+} eGPUMatFlag;
-typedef enum GPUBlendMode {
+typedef enum eGPUBlendMode {
GPU_BLEND_SOLID = 0,
GPU_BLEND_ADD = 1,
GPU_BLEND_ALPHA = 2,
GPU_BLEND_CLIP = 4,
GPU_BLEND_ALPHA_SORT = 8,
- GPU_BLEND_ALPHA_TO_COVERAGE = 16
-} GPUBlendMode;
+ GPU_BLEND_ALPHA_TO_COVERAGE = 16,
+} eGPUBlendMode;
typedef struct GPUNodeStack {
- GPUType type;
+ eGPUType type;
float vec[4];
struct GPUNodeLink *link;
bool hasinput;
@@ -143,18 +135,18 @@ typedef struct GPUNodeStack {
bool end;
} GPUNodeStack;
-typedef enum GPUMaterialStatus {
+typedef enum eGPUMaterialStatus {
GPU_MAT_FAILED = 0,
GPU_MAT_QUEUED,
GPU_MAT_SUCCESS,
-} GPUMaterialStatus;
+} eGPUMaterialStatus;
GPUNodeLink *GPU_attribute(CustomDataType type, const char *name);
GPUNodeLink *GPU_constant(float *num);
GPUNodeLink *GPU_uniform(float *num);
GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser, bool is_data);
GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *layer);
-GPUNodeLink *GPU_builtin(GPUBuiltin builtin);
+GPUNodeLink *GPU_builtin(eGPUBuiltin builtin);
bool GPU_link(GPUMaterial *mat, const char *name, ...);
bool GPU_stack_link(GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out, ...);
@@ -163,7 +155,7 @@ GPUNodeLink *GPU_uniformbuffer_link_out(
struct GPUNodeStack *stack, const int index);
void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link);
-GPUBuiltin GPU_get_material_builtins(GPUMaterial *material);
+eGPUBuiltin GPU_get_material_builtins(GPUMaterial *material);
void GPU_material_sss_profile_create(GPUMaterial *material, float radii[3], short *falloff_type, float *sharpness);
struct GPUUniformBuffer *GPU_material_sss_profile_get(
@@ -183,22 +175,22 @@ void GPU_materials_free(struct Main *bmain);
struct Scene *GPU_material_scene(GPUMaterial *material);
struct GPUPass *GPU_material_get_pass(GPUMaterial *material);
struct ListBase *GPU_material_get_inputs(GPUMaterial *material);
-GPUMaterialStatus GPU_material_status(GPUMaterial *mat);
+eGPUMaterialStatus GPU_material_status(GPUMaterial *mat);
struct GPUUniformBuffer *GPU_material_uniform_buffer_get(GPUMaterial *material);
void GPU_material_uniform_buffer_create(GPUMaterial *material, ListBase *inputs);
struct GPUUniformBuffer *GPU_material_create_sss_profile_ubo(void);
-void GPU_material_vertex_attributes(
+void GPU_material_vertex_attrs(
GPUMaterial *material,
- struct GPUVertexAttribs *attrib);
+ struct GPUVertAttrLayers *attrs);
bool GPU_material_do_color_management(GPUMaterial *mat);
bool GPU_material_use_domain_surface(GPUMaterial *mat);
bool GPU_material_use_domain_volume(GPUMaterial *mat);
-void GPU_material_flag_set(GPUMaterial *mat, GPUMatFlag flag);
-bool GPU_material_flag_get(GPUMaterial *mat, GPUMatFlag flag);
+void GPU_material_flag_set(GPUMaterial *mat, eGPUMatFlag flag);
+bool GPU_material_flag_get(GPUMaterial *mat, eGPUMatFlag flag);
void GPU_pass_cache_init(void);
void GPU_pass_cache_garbage_collect(void);
diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h
index 23f19ed19cd..bd7d4478c6a 100644
--- a/source/blender/gpu/GPU_matrix.h
+++ b/source/blender/gpu/GPU_matrix.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Alexandr Kuznetsov, Jason Wilkins, Mike Erwin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/gpu/GPU_matrix.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_MATRIX_H__
diff --git a/source/blender/gpu/GPU_primitive.h b/source/blender/gpu/GPU_primitive.h
index bcedfa56ab1..5867e589ebe 100644
--- a/source/blender/gpu/GPU_primitive.h
+++ b/source/blender/gpu/GPU_primitive.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_primitive.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU geometric primitives
*/
@@ -56,7 +50,7 @@ typedef enum {
GPU_PRIM_CLASS_POINT = (1 << 0),
GPU_PRIM_CLASS_LINE = (1 << 1),
GPU_PRIM_CLASS_SURFACE = (1 << 2),
- GPU_PRIM_CLASS_ANY = GPU_PRIM_CLASS_POINT | GPU_PRIM_CLASS_LINE | GPU_PRIM_CLASS_SURFACE
+ GPU_PRIM_CLASS_ANY = GPU_PRIM_CLASS_POINT | GPU_PRIM_CLASS_LINE | GPU_PRIM_CLASS_SURFACE,
} GPUPrimClass;
GPUPrimClass GPU_primtype_class(GPUPrimType);
diff --git a/source/blender/gpu/GPU_select.h b/source/blender/gpu/GPU_select.h
index f1342a1f6b8..e1396b49c15 100644
--- a/source/blender/gpu/GPU_select.h
+++ b/source/blender/gpu/GPU_select.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Antony Riakiotakis.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_select.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_SELECT_H__
@@ -49,7 +43,6 @@ void GPU_select_begin(unsigned int *buffer, unsigned int bufsize, const struct r
bool GPU_select_load_id(unsigned int id);
void GPU_select_finalize(void);
unsigned int GPU_select_end(void);
-bool GPU_select_query_check_active(void);
/* cache selection region */
bool GPU_select_is_cached(void);
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index 8a603f3caf2..03cb21eab80 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_shader.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_SHADER_H__
@@ -44,12 +36,12 @@ struct GPUUniformBuffer;
* - only for fragment shaders now
* - must call texture bind before setting a texture as uniform! */
-typedef enum GPUShaderTFBType {
+typedef enum eGPUShaderTFBType {
GPU_SHADER_TFB_NONE = 0, /* Transform feedback unsupported. */
GPU_SHADER_TFB_POINTS = 1,
GPU_SHADER_TFB_LINES = 2,
GPU_SHADER_TFB_TRIANGLES = 3,
-} GPUShaderTFBType;
+} eGPUShaderTFBType;
GPUShader *GPU_shader_create(
const char *vertexcode,
@@ -64,10 +56,16 @@ GPUShader *GPU_shader_create_ex(
const char *geocode,
const char *libcode,
const char *defines,
- const GPUShaderTFBType tf_type,
+ const eGPUShaderTFBType tf_type,
const char **tf_names,
const int tf_count,
const char *shader_name);
+struct GPU_ShaderCreateFromArray_Params { const char **vert, **geom, **frag, **defs; };
+struct GPUShader *GPU_shader_create_from_arrays_impl(
+ const struct GPU_ShaderCreateFromArray_Params *params);
+#define GPU_shader_create_from_arrays(...) \
+ GPU_shader_create_from_arrays_impl(&(const struct GPU_ShaderCreateFromArray_Params)__VA_ARGS__)
+
void GPU_shader_free(GPUShader *shader);
void GPU_shader_bind(GPUShader *shader);
@@ -82,6 +80,7 @@ int GPU_shader_get_program(GPUShader *shader);
void *GPU_shader_get_interface(GPUShader *shader);
int GPU_shader_get_uniform(GPUShader *shader, const char *name);
+int GPU_shader_get_uniform_ensure(GPUShader *shader, const char *name);
int GPU_shader_get_builtin_uniform(GPUShader *shader, int builtin);
int GPU_shader_get_uniform_block(GPUShader *shader, const char *name);
void GPU_shader_uniform_vector(
@@ -99,7 +98,7 @@ void GPU_shader_uniform_int(GPUShader *shader, int location, int value);
int GPU_shader_get_attribute(GPUShader *shader, const char *name);
/* Builtin/Non-generated shaders */
-typedef enum GPUBuiltinShader {
+typedef enum eGPUBuiltinShader {
/* specialized drawing */
GPU_SHADER_TEXT,
GPU_SHADER_TEXT_SIMPLE,
@@ -161,7 +160,8 @@ typedef enum GPUBuiltinShader {
* \param pos: in vec3
*/
GPU_SHADER_3D_UNIFORM_COLOR,
- GPU_SHADER_3D_UNIFORM_COLOR_U32,
+ /* Sets Z-depth to 1.0 (draw onto background). */
+ GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND,
GPU_SHADER_3D_UNIFORM_COLOR_INSTANCE,
/**
* Take a 3D position and color for each vertex without color interpolation.
@@ -170,7 +170,6 @@ typedef enum GPUBuiltinShader {
* \param pos: in vec3
*/
GPU_SHADER_3D_FLAT_COLOR,
- GPU_SHADER_3D_FLAT_COLOR_U32, /* use for select-id's */
/**
* Take a 3D position and color for each vertex with perspective correct interpolation.
*
@@ -315,7 +314,7 @@ typedef enum GPUBuiltinShader {
/* lines */
GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR,
GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR,
- /* lamp drawing */
+ /* light drawing */
GPU_SHADER_3D_GROUNDPOINT,
GPU_SHADER_3D_GROUNDLINE,
GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR,
@@ -346,30 +345,51 @@ typedef enum GPUBuiltinShader {
GPU_SHADER_2D_NODELINK,
GPU_SHADER_2D_NODELINK_INST,
/* specialized for edituv drawing */
+ GPU_SHADER_2D_UV_UNIFORM_COLOR,
GPU_SHADER_2D_UV_VERTS,
GPU_SHADER_2D_UV_FACEDOTS,
GPU_SHADER_2D_UV_EDGES,
GPU_SHADER_2D_UV_EDGES_SMOOTH,
GPU_SHADER_2D_UV_FACES,
- GPU_SHADER_2D_UV_FACES_STRETCH,
+ GPU_SHADER_2D_UV_FACES_STRETCH_AREA,
+ GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE,
+ /* Selection */
+ GPU_SHADER_3D_FLAT_SELECT_ID,
+ GPU_SHADER_3D_UNIFORM_SELECT_ID,
+} eGPUBuiltinShader;
+#define GPU_SHADER_BUILTIN_LEN (GPU_SHADER_3D_UNIFORM_SELECT_ID + 1)
+
+/** Support multiple configurations. */
+typedef enum eGPUShaderConfig {
+ GPU_SHADER_CFG_DEFAULT = 0,
+ GPU_SHADER_CFG_CLIPPED = 1,
+} eGPUShaderConfig;
+#define GPU_SHADER_CFG_LEN (GPU_SHADER_CFG_CLIPPED + 1)
- GPU_NUM_BUILTIN_SHADERS /* (not an actual shader) */
-} GPUBuiltinShader;
+typedef struct GPUShaderConfigData {
+ const char *lib;
+ const char *def;
+} GPUShaderConfigData;
+/* gpu_shader.c */
+extern const GPUShaderConfigData GPU_shader_cfg_data[GPU_SHADER_CFG_LEN];
/** Keep these in sync with:
* - `gpu_shader_image_interlace_frag.glsl`
* - `gpu_shader_image_rect_interlace_frag.glsl`
*/
-typedef enum GPUInterlaceShader {
+typedef enum eGPUInterlaceShader {
GPU_SHADER_INTERLACE_ROW = 0,
GPU_SHADER_INTERLACE_COLUMN = 1,
GPU_SHADER_INTERLACE_CHECKER = 2,
-} GPUInterlaceShader;
+} eGPUInterlaceShader;
-GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader);
+GPUShader *GPU_shader_get_builtin_shader_with_config(
+ eGPUBuiltinShader shader, eGPUShaderConfig sh_cfg);
+GPUShader *GPU_shader_get_builtin_shader(
+ eGPUBuiltinShader shader);
void GPU_shader_get_builtin_shader_code(
- GPUBuiltinShader shader,
+ eGPUBuiltinShader shader,
const char **r_vert, const char **r_frag,
const char **r_geom, const char **r_defines);
@@ -377,20 +397,20 @@ void GPU_shader_free_builtin_shaders(void);
/* Vertex attributes for shaders */
-#define GPU_MAX_ATTRIB 32
+#define GPU_MAX_ATTR 32
-typedef struct GPUVertexAttribs {
+typedef struct GPUVertAttrLayers {
struct {
int type;
int glindex;
int glinfoindoex;
int gltexco;
- int attribid;
+ int attr_id;
char name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
- } layer[GPU_MAX_ATTRIB];
+ } layer[GPU_MAX_ATTR];
int totlayer;
-} GPUVertexAttribs;
+} GPUVertAttrLayers;
#ifdef __cplusplus
}
diff --git a/source/blender/gpu/GPU_shader_interface.h b/source/blender/gpu/GPU_shader_interface.h
index af89e487cf8..34b607bcb5d 100644
--- a/source/blender/gpu/GPU_shader_interface.h
+++ b/source/blender/gpu/GPU_shader_interface.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_shader_interface.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU shader interface (C --> GLSL)
*/
@@ -69,9 +63,12 @@ typedef struct GPUShaderInput {
struct GPUShaderInput *next;
uint32_t name_offset;
uint name_hash;
- GPUUniformBuiltin builtin_type; /* only for uniform inputs */
- uint32_t gl_type; /* only for attrib inputs */
- int32_t size; /* only for attrib inputs */
+ /** Only for uniform inputs. */
+ GPUUniformBuiltin builtin_type;
+ /** Only for attribute inputs. */
+ uint32_t gl_type;
+ /** Only for attribute inputs. */
+ int32_t size;
int32_t location;
} GPUShaderInput;
@@ -81,7 +78,7 @@ typedef struct GPUShaderInput {
typedef struct GPUShaderInterface {
int32_t program;
uint32_t name_buffer_offset;
- GPUShaderInput *attrib_buckets[GPU_NUM_SHADERINTERFACE_BUCKETS];
+ GPUShaderInput *attr_buckets[GPU_NUM_SHADERINTERFACE_BUCKETS];
GPUShaderInput *uniform_buckets[GPU_NUM_SHADERINTERFACE_BUCKETS];
GPUShaderInput *ubo_buckets[GPU_NUM_SHADERINTERFACE_BUCKETS];
GPUShaderInput *builtin_uniforms[GPU_NUM_UNIFORMS];
@@ -94,6 +91,7 @@ GPUShaderInterface *GPU_shaderinterface_create(int32_t program_id);
void GPU_shaderinterface_discard(GPUShaderInterface *);
const GPUShaderInput *GPU_shaderinterface_uniform(const GPUShaderInterface *, const char *name);
+const GPUShaderInput *GPU_shaderinterface_uniform_ensure(const GPUShaderInterface *, const char *name);
const GPUShaderInput *GPU_shaderinterface_uniform_builtin(const GPUShaderInterface *, GPUUniformBuiltin);
const GPUShaderInput *GPU_shaderinterface_ubo(const GPUShaderInterface *, const char *name);
const GPUShaderInput *GPU_shaderinterface_attr(const GPUShaderInterface *, const char *name);
diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h
index 057caffd17d..c43a1711528 100644
--- a/source/blender/gpu/GPU_state.h
+++ b/source/blender/gpu/GPU_state.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,39 +12,35 @@
* 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): Ray Molenkamp
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_state.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_STATE_H__
#define __GPU_STATE_H__
/* These map directly to the GL_ blend functions, to minimize API add as needed*/
-typedef enum GPUBlendFunction {
+typedef enum eGPUBlendFunction {
GPU_ONE,
GPU_SRC_ALPHA,
GPU_ONE_MINUS_SRC_ALPHA,
GPU_DST_COLOR,
GPU_ZERO,
-} GPUBlendFunction;
+} eGPUBlendFunction;
/* These map directly to the GL_ filter functions, to minimize API add as needed*/
-typedef enum GPUFilterFunction {
+typedef enum eGPUFilterFunction {
GPU_NEAREST,
GPU_LINEAR
-} GPUFilterFunction;
+} eGPUFilterFunction;
void GPU_blend(bool enable);
-void GPU_blend_set_func(GPUBlendFunction sfactor, GPUBlendFunction dfactor);
+void GPU_blend_set_func(eGPUBlendFunction sfactor, eGPUBlendFunction dfactor);
void GPU_blend_set_func_separate(
- GPUBlendFunction src_rgb, GPUBlendFunction dst_rgb,
- GPUBlendFunction src_alpha, GPUBlendFunction dst_alpha);
+ eGPUBlendFunction src_rgb, eGPUBlendFunction dst_rgb,
+ eGPUBlendFunction src_alpha, eGPUBlendFunction dst_alpha);
void GPU_depth_range(float near, float far);
void GPU_depth_test(bool enable);
bool GPU_depth_test_enabled(void);
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 7a10c2f4854..5732bad81a9 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_texture.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_TEXTURE_H__
@@ -38,10 +30,10 @@
extern "C" {
#endif
+struct GPUVertBuf;
struct Image;
struct ImageUser;
struct PreviewImage;
-struct GPUVertBuf;
struct GPUFrameBuffer;
typedef struct GPUTexture GPUTexture;
@@ -63,7 +55,7 @@ typedef struct GPUTexture GPUTexture;
* are not supported by renderbuffers. All of the following formats
* are part of the OpenGL 3.3 core
* specification. */
-typedef enum GPUTextureFormat {
+typedef enum eGPUTextureFormat {
/* Formats texture & renderbuffer */
GPU_RGBA8UI,
GPU_RGBA8I,
@@ -142,57 +134,57 @@ typedef enum GPUTextureFormat {
GPU_DEPTH_COMPONENT32F,
GPU_DEPTH_COMPONENT24,
GPU_DEPTH_COMPONENT16,
-} GPUTextureFormat;
+} eGPUTextureFormat;
-typedef enum GPUDataFormat {
+typedef enum eGPUDataFormat {
GPU_DATA_FLOAT,
GPU_DATA_INT,
GPU_DATA_UNSIGNED_INT,
GPU_DATA_UNSIGNED_BYTE,
GPU_DATA_UNSIGNED_INT_24_8,
GPU_DATA_10_11_11_REV,
-} GPUDataFormat;
+} eGPUDataFormat;
unsigned int GPU_texture_memory_usage_get(void);
-/* TODO make it static function again. (create function with GPUDataFormat exposed) */
+/* TODO make it static function again. (create function with eGPUDataFormat exposed) */
GPUTexture *GPU_texture_create_nD(
int w, int h, int d, int n, const void *pixels,
- GPUTextureFormat tex_format, GPUDataFormat gpu_data_format, int samples,
+ eGPUTextureFormat tex_format, eGPUDataFormat gpu_data_format, int samples,
const bool can_rescale, char err_out[256]);
GPUTexture *GPU_texture_create_1D(
- int w, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
+ int w, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_1D_array(
- int w, int h, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
+ int w, int h, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_2D(
- int w, int h, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
+ int w, int h, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_2D_multisample(
- int w, int h, GPUTextureFormat data_type, const float *pixels, int samples, char err_out[256]);
+ int w, int h, eGPUTextureFormat data_type, const float *pixels, int samples, char err_out[256]);
GPUTexture *GPU_texture_create_2D_array(
- int w, int h, int d, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
+ int w, int h, int d, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_3D(
- int w, int h, int d, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
+ int w, int h, int d, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_cube(
- int w, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
+ int w, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_from_vertbuf(
struct GPUVertBuf *vert);
GPUTexture *GPU_texture_create_buffer(
- GPUTextureFormat data_type, const uint buffer);
+ eGPUTextureFormat data_type, const uint buffer);
GPUTexture *GPU_texture_from_bindcode(int textarget, int bindcode);
GPUTexture *GPU_texture_from_blender(
- struct Image *ima, struct ImageUser *iuser, int textarget, bool is_data, double time);
+ struct Image *ima, struct ImageUser *iuser, int textarget, bool is_data);
GPUTexture *GPU_texture_from_preview(struct PreviewImage *prv, int mipmap);
-void GPU_texture_add_mipmap(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl, const void *pixels);
+void GPU_texture_add_mipmap(GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl, const void *pixels);
-void GPU_texture_update(GPUTexture *tex, GPUDataFormat data_format, const void *pixels);
+void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *pixels);
void GPU_texture_update_sub(
- GPUTexture *tex, GPUDataFormat gpu_data_format, const void *pixels,
+ GPUTexture *tex, eGPUDataFormat gpu_data_format, const void *pixels,
int offset_x, int offset_y, int offset_z, int width, int height, int depth);
-void *GPU_texture_read(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl);
+void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl);
void GPU_invalid_tex_init(void);
void GPU_invalid_tex_bind(int mode);
@@ -210,7 +202,7 @@ void GPU_texture_compare_mode(GPUTexture *tex, bool use_compare);
void GPU_texture_filter_mode(GPUTexture *tex, bool use_filter);
void GPU_texture_mipmap_mode(GPUTexture *tex, bool use_mipmap, bool use_filter);
void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat);
-void GPU_texture_filters(GPUTexture *tex, GPUFilterFunction min_filter, GPUFilterFunction mag_filter);
+void GPU_texture_filters(GPUTexture *tex, eGPUFilterFunction min_filter, eGPUFilterFunction mag_filter);
void GPU_texture_attach_framebuffer(GPUTexture *tex, struct GPUFrameBuffer *fb, int attachment);
int GPU_texture_detach_framebuffer(GPUTexture *tex, struct GPUFrameBuffer *fb);
@@ -219,7 +211,7 @@ int GPU_texture_target(const GPUTexture *tex);
int GPU_texture_width(const GPUTexture *tex);
int GPU_texture_height(const GPUTexture *tex);
int GPU_texture_layers(const GPUTexture *tex);
-GPUTextureFormat GPU_texture_format(const GPUTexture *tex);
+eGPUTextureFormat GPU_texture_format(const GPUTexture *tex);
int GPU_texture_samples(const GPUTexture *tex);
bool GPU_texture_cube(const GPUTexture *tex);
bool GPU_texture_depth(const GPUTexture *tex);
diff --git a/source/blender/gpu/GPU_uniformbuffer.h b/source/blender/gpu/GPU_uniformbuffer.h
index 2f422fa1a92..812a7604142 100644
--- a/source/blender/gpu/GPU_uniformbuffer.h
+++ b/source/blender/gpu/GPU_uniformbuffer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Clement Foucault.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_uniformbuffer.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_UNIFORMBUFFER_H__
diff --git a/source/blender/gpu/GPU_vertex_buffer.h b/source/blender/gpu/GPU_vertex_buffer.h
index db1309bcede..4c1814a9d9b 100644
--- a/source/blender/gpu/GPU_vertex_buffer.h
+++ b/source/blender/gpu/GPU_vertex_buffer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_vertex_buffer.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU vertex buffer
*/
@@ -35,11 +29,13 @@
#include "GPU_vertex_format.h"
#define VRAM_USAGE 1
-/* How to create a GPUVertBuf: */
-/* 1) verts = GPU_vertbuf_create() or GPU_vertbuf_init(verts) */
-/* 2) GPU_vertformat_attr_add(verts->format, ...) */
-/* 3) GPU_vertbuf_data_alloc(verts, vertex_len) <-- finalizes/packs vertex format */
-/* 4) GPU_vertbuf_attr_fill(verts, pos, application_pos_buffer) */
+/**
+ * How to create a #GPUVertBuf:
+ * 1) verts = GPU_vertbuf_create() or GPU_vertbuf_init(verts)
+ * 2) GPU_vertformat_attr_add(verts->format, ...)
+ * 3) GPU_vertbuf_data_alloc(verts, vertex_len) <-- finalizes/packs vertex format
+ * 4) GPU_vertbuf_attr_fill(verts, pos, application_pos_buffer)
+ */
/* Is GPUVertBuf always used as part of a GPUBatch? */
@@ -77,12 +73,12 @@ void GPU_vertbuf_init_with_format_ex(GPUVertBuf *, const GPUVertFormat *, GPUUsa
uint GPU_vertbuf_size_get(const GPUVertBuf *);
void GPU_vertbuf_data_alloc(GPUVertBuf *, uint v_len);
void GPU_vertbuf_data_resize(GPUVertBuf *, uint v_len);
-void GPU_vertbuf_vertex_count_set(GPUVertBuf *, uint v_len);
+void GPU_vertbuf_data_len_set(GPUVertBuf *, uint v_len);
-/* The most important set_attrib variant is the untyped one. Get it right first. */
-/* It takes a void* so the app developer is responsible for matching their app data types */
-/* to the vertex attribute's type and component count. They're in control of both, so this */
-/* should not be a problem. */
+/* The most important #set_attr variant is the untyped one. Get it right first.
+ * It takes a void* so the app developer is responsible for matching their app data types
+ * to the vertex attribute's type and component count. They're in control of both, so this
+ * should not be a problem. */
void GPU_vertbuf_attr_set(GPUVertBuf *, uint a_idx, uint v_idx, const void *data);
void GPU_vertbuf_attr_fill(GPUVertBuf *, uint a_idx, const void *data); /* tightly packed, non interleaved input data */
@@ -117,17 +113,6 @@ GPU_INLINE uint GPU_vertbuf_raw_used(GPUVertBufRaw *a)
void GPU_vertbuf_attr_get_raw_data(GPUVertBuf *, uint a_idx, GPUVertBufRaw *access);
-/* TODO: decide whether to keep the functions below */
-/* doesn't immediate mode satisfy these needs? */
-
-/* void setAttrib1f(uint a_idx, uint v_idx, float x); */
-/* void setAttrib2f(uint a_idx, unsigned v_idx, float x, float y); */
-/* void setAttrib3f(unsigned a_idx, unsigned v_idx, float x, float y, float z); */
-/* void setAttrib4f(unsigned a_idx, unsigned v_idx, float x, float y, float z, float w); */
-
-/* void setAttrib3ub(unsigned a_idx, unsigned v_idx, unsigned char r, unsigned char g, unsigned char b); */
-/* void setAttrib4ub(unsigned a_idx, unsigned v_idx, unsigned char r, unsigned char g, unsigned char b, unsigned char a); */
-
void GPU_vertbuf_use(GPUVertBuf *);
/* Metrics */
diff --git a/source/blender/gpu/GPU_vertex_format.h b/source/blender/gpu/GPU_vertex_format.h
index 7a271caf079..64d06a0219c 100644
--- a/source/blender/gpu/GPU_vertex_format.h
+++ b/source/blender/gpu/GPU_vertex_format.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/GPU_vertex_format.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU vertex format
*/
@@ -71,13 +65,17 @@ typedef struct GPUVertAttr {
} GPUVertAttr;
typedef struct GPUVertFormat {
- uint attr_len; /* 0 to 16 (GPU_VERT_ATTR_MAX_LEN) */
- uint name_len; /* total count of active vertex attrib */
- uint stride; /* stride in bytes, 1 to 256 */
+ /** 0 to 16 (GPU_VERT_ATTR_MAX_LEN). */
+ uint attr_len;
+ /** Total count of active vertex attribute. */
+ uint name_len;
+ /** Stride in bytes, 1 to 256. */
+ uint stride;
uint name_offset;
bool packed;
char names[GPU_VERT_ATTR_NAMES_BUF_LEN];
- GPUVertAttr attribs[GPU_VERT_ATTR_MAX_LEN]; /* TODO: variable-size attribs array */
+ /** TODO: variable-size array */
+ GPUVertAttr attrs[GPU_VERT_ATTR_MAX_LEN];
} GPUVertFormat;
struct GPUShaderInterface;
@@ -93,7 +91,7 @@ void GPU_vertformat_alias_add(GPUVertFormat *, const char *alias);
int GPU_vertformat_attr_id_get(const GPUVertFormat *, const char *name);
/**
- * This makes the "virtual" attribs with suffixes "0", "1", "2" to access triangle data in the vertex
+ * This makes the "virtual" attributes with suffixes "0", "1", "2" to access triangle data in the vertex
* shader.
*
* IMPORTANT:
diff --git a/source/blender/gpu/GPU_viewport.h b/source/blender/gpu/GPU_viewport.h
index 45712050b73..d3cff782514 100644
--- a/source/blender/gpu/GPU_viewport.h
+++ b/source/blender/gpu/GPU_viewport.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file GPU_viewport.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_VIEWPORT_H__
diff --git a/source/blender/gpu/intern/gpu_attr_binding.c b/source/blender/gpu/intern/gpu_attr_binding.c
index 398b97c7f9d..242c157bec1 100644
--- a/source/blender/gpu/intern/gpu_attr_binding.c
+++ b/source/blender/gpu/intern/gpu_attr_binding.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_attr_binding.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU vertex attribute binding
*/
@@ -35,16 +29,16 @@
#include <stdlib.h>
#if GPU_VERT_ATTR_MAX_LEN != 16
-# error "attrib binding code assumes GPU_VERT_ATTR_MAX_LEN = 16"
+# error "attribute binding code assumes GPU_VERT_ATTR_MAX_LEN = 16"
#endif
-void AttribBinding_clear(GPUAttrBinding *binding)
+void AttrBinding_clear(GPUAttrBinding *binding)
{
binding->loc_bits = 0;
binding->enabled_bits = 0;
}
-uint read_attrib_location(const GPUAttrBinding *binding, uint a_idx)
+uint read_attr_location(const GPUAttrBinding *binding, uint a_idx)
{
#if TRUST_NO_ONE
assert(a_idx < GPU_VERT_ATTR_MAX_LEN);
@@ -53,7 +47,7 @@ uint read_attrib_location(const GPUAttrBinding *binding, uint a_idx)
return (binding->loc_bits >> (4 * a_idx)) & 0xF;
}
-static void write_attrib_location(GPUAttrBinding *binding, uint a_idx, uint location)
+static void write_attr_location(GPUAttrBinding *binding, uint a_idx, uint location)
{
#if TRUST_NO_ONE
assert(a_idx < GPU_VERT_ATTR_MAX_LEN);
@@ -61,25 +55,25 @@ static void write_attrib_location(GPUAttrBinding *binding, uint a_idx, uint loca
#endif
const uint shift = 4 * a_idx;
const uint64_t mask = ((uint64_t)0xF) << shift;
- /* overwrite this attrib's previous location */
+ /* overwrite this attr's previous location */
binding->loc_bits = (binding->loc_bits & ~mask) | (location << shift);
- /* mark this attrib as enabled */
+ /* mark this attr as enabled */
binding->enabled_bits |= 1 << a_idx;
}
-void get_attrib_locations(const GPUVertFormat *format, GPUAttrBinding *binding, const GPUShaderInterface *shaderface)
+void get_attr_locations(const GPUVertFormat *format, GPUAttrBinding *binding, const GPUShaderInterface *shaderface)
{
- AttribBinding_clear(binding);
+ AttrBinding_clear(binding);
for (uint a_idx = 0; a_idx < format->attr_len; ++a_idx) {
- const GPUVertAttr *a = format->attribs + a_idx;
+ const GPUVertAttr *a = &format->attrs[a_idx];
for (uint n_idx = 0; n_idx < a->name_len; ++n_idx) {
const GPUShaderInput *input = GPU_shaderinterface_attr(shaderface, a->name[n_idx]);
#if TRUST_NO_ONE
assert(input != NULL);
/* TODO: make this a recoverable runtime error? indicates mismatch between vertex format and program */
#endif
- write_attrib_location(binding, a_idx, input->location);
+ write_attr_location(binding, a_idx, input->location);
}
}
}
diff --git a/source/blender/gpu/intern/gpu_attr_binding_private.h b/source/blender/gpu/intern/gpu_attr_binding_private.h
index c545983637c..8615e095197 100644
--- a/source/blender/gpu/intern/gpu_attr_binding_private.h
+++ b/source/blender/gpu/intern/gpu_attr_binding_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_attr_binding_private.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU vertex attribute binding
*/
@@ -35,11 +29,11 @@
#include "GPU_vertex_format.h"
#include "GPU_shader_interface.h"
-void AttribBinding_clear(GPUAttrBinding *binding);
+void AttrBinding_clear(GPUAttrBinding *binding);
-void get_attrib_locations(
+void get_attr_locations(
const GPUVertFormat *format, GPUAttrBinding *binding, const GPUShaderInterface *shaderface);
-uint read_attrib_location(
+uint read_attr_location(
const GPUAttrBinding *binding, uint a_idx);
#endif /* __GPU_ATTR_BINDING_PRIVATE_H__ */
diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c
index a2184df229f..5f00fec7c88 100644
--- a/source/blender/gpu/intern/gpu_batch.c
+++ b/source/blender/gpu/intern/gpu_batch.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_batch.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU geometry batch
* Contains VAOs + VBOs + Shader representing a drawable entity.
@@ -197,7 +191,7 @@ int GPU_batch_vertbuf_add_ex(
assert(verts->vertex_len == batch->verts[0]->vertex_len);
#endif
batch->verts[v] = verts;
- /* TODO: mark dirty so we can keep attrib bindings up-to-date */
+ /* TODO: mark dirty so we can keep attribute bindings up-to-date */
if (own_vbo)
batch->owns_flag |= (1 << v);
return v;
@@ -351,7 +345,7 @@ static void create_bindings(
GPU_vertbuf_use(verts);
for (uint a_idx = 0; a_idx < attr_len; ++a_idx) {
- const GPUVertAttr *a = format->attribs + a_idx;
+ const GPUVertAttr *a = &format->attrs[a_idx];
const GLvoid *pointer = (const GLubyte *)0 + a->offset + v_first * stride;
for (uint n_idx = 0; n_idx < a->name_len; ++n_idx) {
@@ -428,9 +422,9 @@ void GPU_batch_program_use_end(GPUBatch *batch)
}
#if TRUST_NO_ONE
-# define GET_UNIFORM const GPUShaderInput *uniform = GPU_shaderinterface_uniform(batch->interface, name); assert(uniform);
+# define GET_UNIFORM const GPUShaderInput *uniform = GPU_shaderinterface_uniform_ensure(batch->interface, name); assert(uniform);
#else
-# define GET_UNIFORM const GPUShaderInput *uniform = GPU_shaderinterface_uniform(batch->interface, name);
+# define GET_UNIFORM const GPUShaderInput *uniform = GPU_shaderinterface_uniform_ensure(batch->interface, name);
#endif
void GPU_batch_uniform_1ui(GPUBatch *batch, const char *name, int value)
@@ -670,12 +664,23 @@ void GPU_draw_primitive(GPUPrimType prim_type, int v_count)
/** \name Utilities
* \{ */
-void GPU_batch_program_set_builtin(GPUBatch *batch, GPUBuiltinShader shader_id)
+void GPU_batch_program_set_shader(GPUBatch *batch, GPUShader *shader)
+{
+ GPU_batch_program_set(batch, shader->program, shader->interface);
+}
+
+void GPU_batch_program_set_builtin_with_config(
+ GPUBatch *batch, eGPUBuiltinShader shader_id, eGPUShaderConfig sh_cfg)
{
- GPUShader *shader = GPU_shader_get_builtin_shader(shader_id);
+ GPUShader *shader = GPU_shader_get_builtin_shader_with_config(shader_id, sh_cfg);
GPU_batch_program_set(batch, shader->program, shader->interface);
}
+void GPU_batch_program_set_builtin(GPUBatch *batch, eGPUBuiltinShader shader_id)
+{
+ GPU_batch_program_set_builtin_with_config(batch, shader_id, GPU_SHADER_CFG_DEFAULT);
+}
+
/** \} */
/* -------------------------------------------------------------------- */
diff --git a/source/blender/gpu/intern/gpu_batch_presets.c b/source/blender/gpu/intern/gpu_batch_presets.c
index 629ab04bf24..8d23d4be297 100644
--- a/source/blender/gpu/intern/gpu_batch_presets.c
+++ b/source/blender/gpu/intern/gpu_batch_presets.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Mike Erwin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_batch_presets.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#include "BLI_utildefines.h"
diff --git a/source/blender/gpu/intern/gpu_batch_private.h b/source/blender/gpu/intern/gpu_batch_private.h
index 3a05e243065..42cfc1e2a5c 100644
--- a/source/blender/gpu/intern/gpu_batch_private.h
+++ b/source/blender/gpu/intern/gpu_batch_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_batch_private.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU geometry batch
* Contains VAOs + VBOs + Shader representing a drawable entity.
diff --git a/source/blender/gpu/intern/gpu_batch_utils.c b/source/blender/gpu/intern/gpu_batch_utils.c
index 13e615e120b..10b7b3c39b5 100644
--- a/source/blender/gpu/intern/gpu_batch_utils.c
+++ b/source/blender/gpu/intern/gpu_batch_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_batch_utils.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index deb10213976..edf5eb7e7d1 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_buffers.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Mesh drawing using OpenGL VBO (Vertex Buffer Objects)
*/
@@ -41,7 +33,6 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
-#include "BLI_threads.h"
#include "DNA_meshdata_types.h"
@@ -63,8 +54,11 @@
struct GPU_PBVH_Buffers {
GPUIndexBuf *index_buf, *index_buf_fast;
+ GPUIndexBuf *index_lines_buf, *index_lines_buf_fast;
GPUVertBuf *vert_buf;
+ GPUBatch *lines;
+ GPUBatch *lines_fast;
GPUBatch *triangles;
GPUBatch *triangles_fast;
@@ -84,8 +78,6 @@ struct GPU_PBVH_Buffers {
BLI_bitmap * const *grid_hidden;
const int *grid_indices;
int totgrid;
- bool has_hidden;
- bool is_index_buf_global; /* Means index_buf uses global bvh's grid_common_gpu_buffer, **DO NOT** free it! */
bool use_bmesh;
@@ -102,6 +94,12 @@ static struct {
uint pos, nor, msk;
} g_vbo_id = {0};
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name PBVH Utils
+ * \{ */
+
/* Allocates a non-initialized buffer to be sent to GPU.
* Return is false it indicates that the memory map failed. */
static bool gpu_pbvh_vert_buf_data_set(GPU_PBVH_Buffers *buffers, uint vert_len)
@@ -150,8 +148,27 @@ static void gpu_pbvh_batch_init(GPU_PBVH_Buffers *buffers, GPUPrimType prim)
prim, buffers->vert_buf,
buffers->index_buf_fast);
}
+
+ if (buffers->lines == NULL) {
+ BLI_assert(buffers->index_lines_buf != NULL);
+ buffers->lines = GPU_batch_create(
+ GPU_PRIM_LINES, buffers->vert_buf,
+ buffers->index_lines_buf);
+ }
+
+ if ((buffers->lines_fast == NULL) && buffers->index_lines_buf_fast) {
+ buffers->lines_fast = GPU_batch_create(
+ GPU_PRIM_LINES, buffers->vert_buf,
+ buffers->index_lines_buf_fast);
+ }
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Mesh PBVH
+ * \{ */
+
void GPU_pbvh_mesh_buffers_update(
GPU_PBVH_Buffers *buffers, const MVert *mvert,
const int *vert_indices, int totvert, const float *vmask,
@@ -255,12 +272,7 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(
buffers = MEM_callocN(sizeof(GPU_PBVH_Buffers), "GPU_Buffers");
/* smooth or flat for all */
-#if 0
buffers->smooth = mpoly[looptri[face_indices[0]].poly].flag & ME_SMOOTH;
-#else
- /* for DrawManager we dont support mixed smooth/flat */
- buffers->smooth = (mpoly[0].flag & ME_SMOOTH) != 0;
-#endif
buffers->show_mask = false;
@@ -283,14 +295,19 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(
return buffers;
}
+ GPU_BATCH_DISCARD_SAFE(buffers->triangles);
+ GPU_BATCH_DISCARD_SAFE(buffers->lines);
+ GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
+ GPU_INDEXBUF_DISCARD_SAFE(buffers->index_lines_buf);
+
/* An element index buffer is used for smooth shading, but flat
- * shading requires separate vertex normals so an index buffer is
+ * shading requires separate vertex normals so an index buffer
* can't be used there. */
if (buffers->smooth) {
- /* Fill the triangle buffer */
- buffers->index_buf = NULL;
- GPUIndexBufBuilder elb;
+ /* Fill the triangle and line buffers. */
+ GPUIndexBufBuilder elb, elb_lines;
GPU_indexbuf_init(&elb, GPU_PRIM_TRIS, tottri, INT_MAX);
+ GPU_indexbuf_init(&elb_lines, GPU_PRIM_LINES, tottri * 3, INT_MAX);
for (i = 0; i < face_indices_len; ++i) {
const MLoopTri *lt = &looptri[face_indices[i]];
@@ -300,15 +317,33 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(
continue;
GPU_indexbuf_add_tri_verts(&elb, UNPACK3(face_vert_indices[i]));
+
+ /* TODO skip "non-real" edges. */
+ GPU_indexbuf_add_line_verts(&elb_lines, face_vert_indices[i][0], face_vert_indices[i][1]);
+ GPU_indexbuf_add_line_verts(&elb_lines, face_vert_indices[i][1], face_vert_indices[i][2]);
+ GPU_indexbuf_add_line_verts(&elb_lines, face_vert_indices[i][2], face_vert_indices[i][0]);
}
buffers->index_buf = GPU_indexbuf_build(&elb);
+ buffers->index_lines_buf = GPU_indexbuf_build(&elb_lines);
}
else {
- if (!buffers->is_index_buf_global) {
- GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
+ /* Fill the only the line buffer. */
+ GPUIndexBufBuilder elb_lines;
+ GPU_indexbuf_init(&elb_lines, GPU_PRIM_LINES, tottri * 3, INT_MAX);
+
+ for (i = 0; i < face_indices_len; ++i) {
+ const MLoopTri *lt = &looptri[face_indices[i]];
+
+ /* Skip hidden faces */
+ if (paint_is_face_hidden(lt, mvert, mloop))
+ continue;
+
+ /* TODO skip "non-real" edges. */
+ GPU_indexbuf_add_line_verts(&elb_lines, i * 3 + 0, i * 3 + 1);
+ GPU_indexbuf_add_line_verts(&elb_lines, i * 3 + 1, i * 3 + 2);
+ GPU_indexbuf_add_line_verts(&elb_lines, i * 3 + 2, i * 3 + 0);
}
- buffers->index_buf = NULL;
- buffers->is_index_buf_global = false;
+ buffers->index_lines_buf = GPU_indexbuf_build(&elb_lines);
}
buffers->tot_tri = tottri;
@@ -323,65 +358,140 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(
return buffers;
}
-static void gpu_pbvh_grid_fill_fast_buffer(GPU_PBVH_Buffers *buffers, int totgrid, int gridsize)
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Grid PBVH
+ * \{ */
+
+static void gpu_pbvh_grid_fill_index_buffers(
+ GPU_PBVH_Buffers *buffers,
+ int *grid_indices,
+ uint visible_quad_len,
+ int totgrid,
+ int gridsize)
{
- GPUIndexBufBuilder elb;
+ GPUIndexBufBuilder elb, elb_lines;
+ GPUIndexBufBuilder elb_fast, elb_lines_fast;
+
+ GPU_indexbuf_init(&elb, GPU_PRIM_TRIS, 2 * visible_quad_len, INT_MAX);
+ GPU_indexbuf_init(&elb_fast, GPU_PRIM_TRIS, 2 * totgrid, INT_MAX);
+ GPU_indexbuf_init(&elb_lines, GPU_PRIM_LINES, 2 * totgrid * gridsize * (gridsize - 1), INT_MAX);
+ GPU_indexbuf_init(&elb_lines_fast, GPU_PRIM_LINES, 4 * totgrid, INT_MAX);
+
if (buffers->smooth) {
- GPU_indexbuf_init(&elb, GPU_PRIM_TRIS, 6 * totgrid, INT_MAX);
- for (int i = 0; i < totgrid; i++) {
- GPU_indexbuf_add_generic_vert(&elb, i * gridsize * gridsize + gridsize - 1);
- GPU_indexbuf_add_generic_vert(&elb, i * gridsize * gridsize);
- GPU_indexbuf_add_generic_vert(&elb, (i + 1) * gridsize * gridsize - gridsize);
- GPU_indexbuf_add_generic_vert(&elb, (i + 1) * gridsize * gridsize - 1);
- GPU_indexbuf_add_generic_vert(&elb, i * gridsize * gridsize + gridsize - 1);
- GPU_indexbuf_add_generic_vert(&elb, (i + 1) * gridsize * gridsize - gridsize);
+ uint offset = 0;
+ const uint grid_vert_len = gridsize * gridsize;
+ for (int i = 0; i < totgrid; i++, offset += grid_vert_len) {
+ uint v0, v1, v2, v3;
+ bool grid_visible = false;
+
+ BLI_bitmap *gh = buffers->grid_hidden[grid_indices[i]];
+
+ for (int j = 0; j < gridsize - 1; ++j) {
+ for (int k = 0; k < gridsize - 1; ++k) {
+ /* Skip hidden grid face */
+ if (gh && paint_is_grid_face_hidden(
+ gh, gridsize, k, j))
+ {
+ continue;
+ }
+ /* Indices in a Clockwise QUAD disposition. */
+ v0 = offset + j * gridsize + k;
+ v1 = v0 + 1;
+ v2 = v1 + gridsize;
+ v3 = v2 - 1;
+
+ GPU_indexbuf_add_tri_verts(&elb, v0, v2, v1);
+ GPU_indexbuf_add_tri_verts(&elb, v0, v3, v2);
+
+ GPU_indexbuf_add_line_verts(&elb_lines, v0, v1);
+ GPU_indexbuf_add_line_verts(&elb_lines, v0, v3);
+
+ if (j + 2 == gridsize) {
+ GPU_indexbuf_add_line_verts(&elb_lines, v2, v3);
+ }
+ grid_visible = true;
+ }
+ GPU_indexbuf_add_line_verts(&elb_lines, v1, v2);
+ }
+
+ if (grid_visible) {
+ /* Grid corners */
+ v0 = offset;
+ v1 = offset + gridsize - 1;
+ v2 = offset + grid_vert_len - 1;
+ v3 = offset + grid_vert_len - gridsize;
+
+ GPU_indexbuf_add_tri_verts(&elb_fast, v0, v2, v1);
+ GPU_indexbuf_add_tri_verts(&elb_fast, v0, v3, v2);
+
+ GPU_indexbuf_add_line_verts(&elb_lines_fast, v0, v1);
+ GPU_indexbuf_add_line_verts(&elb_lines_fast, v1, v2);
+ GPU_indexbuf_add_line_verts(&elb_lines_fast, v2, v3);
+ GPU_indexbuf_add_line_verts(&elb_lines_fast, v3, v0);
+ }
}
}
else {
- GPU_indexbuf_init_ex(&elb, GPU_PRIM_TRI_STRIP, 5 * totgrid, INT_MAX, true);
- uint vbo_index_offset = 0;
- for (int i = 0; i < totgrid; i++) {
- uint grid_indices[4] = {0, 0, 0, 0};
+ uint offset = 0;
+ const uint grid_vert_len = SQUARE(gridsize - 1) * 4;
+ for (int i = 0; i < totgrid; i++, offset += grid_vert_len) {
+ bool grid_visible = false;
+
+ BLI_bitmap *gh = buffers->grid_hidden[grid_indices[i]];
+
+ uint v0, v1, v2, v3;
for (int j = 0; j < gridsize - 1; j++) {
for (int k = 0; k < gridsize - 1; k++) {
- const bool is_row_start = (k == 0);
- const bool is_row_end = (k == gridsize - 2);
- const bool is_grid_start = (j == 0);
- const bool is_grid_end = (j == gridsize - 2);
- const bool is_first_grid = (i == 0);
- const bool is_last_grid = (i == totgrid - 1);
-
- if (is_row_start && !(is_grid_start && is_first_grid)) {
- vbo_index_offset += 1;
+ /* Skip hidden grid face */
+ if (gh && paint_is_grid_face_hidden(
+ gh, gridsize, k, j))
+ {
+ continue;
}
+ /* VBO data are in a Clockwise QUAD disposition. */
+ v0 = offset + (j * (gridsize - 1) + k) * 4;
+ v1 = v0 + 1;
+ v2 = v0 + 2;
+ v3 = v0 + 3;
- if (is_grid_start && is_row_start) {
- grid_indices[0] = vbo_index_offset + 0;
- }
- else if (is_grid_start && is_row_end) {
- grid_indices[1] = vbo_index_offset + 2;
- }
- else if (is_grid_end && is_row_start) {
- grid_indices[2] = vbo_index_offset + 1;
- }
- else if (is_grid_end && is_row_end) {
- grid_indices[3] = vbo_index_offset + 3;
- }
- vbo_index_offset += 4;
+ GPU_indexbuf_add_tri_verts(&elb, v0, v2, v1);
+ GPU_indexbuf_add_tri_verts(&elb, v0, v3, v2);
+
+ GPU_indexbuf_add_line_verts(&elb_lines, v0, v1);
+ GPU_indexbuf_add_line_verts(&elb_lines, v0, v3);
- if (is_row_end && !(is_grid_end && is_last_grid)) {
- vbo_index_offset += 1;
+ if (j + 2 == gridsize) {
+ GPU_indexbuf_add_line_verts(&elb_lines, v2, v3);
}
+ grid_visible = true;
}
+ GPU_indexbuf_add_line_verts(&elb_lines, v1, v2);
+ }
+
+ if (grid_visible) {
+ /* Grid corners */
+ v0 = offset;
+ v1 = offset + (gridsize - 1) * 4 - 3;
+ v2 = offset + grid_vert_len - 2;
+ v3 = offset + grid_vert_len - (gridsize - 1) * 4 + 3;
+
+ GPU_indexbuf_add_tri_verts(&elb_fast, v0, v2, v1);
+ GPU_indexbuf_add_tri_verts(&elb_fast, v0, v3, v2);
+
+ GPU_indexbuf_add_line_verts(&elb_lines_fast, v0, v1);
+ GPU_indexbuf_add_line_verts(&elb_lines_fast, v1, v2);
+ GPU_indexbuf_add_line_verts(&elb_lines_fast, v2, v3);
+ GPU_indexbuf_add_line_verts(&elb_lines_fast, v3, v0);
}
- GPU_indexbuf_add_generic_vert(&elb, grid_indices[1]);
- GPU_indexbuf_add_generic_vert(&elb, grid_indices[0]);
- GPU_indexbuf_add_generic_vert(&elb, grid_indices[3]);
- GPU_indexbuf_add_generic_vert(&elb, grid_indices[2]);
- GPU_indexbuf_add_primitive_restart(&elb);
}
}
- buffers->index_buf_fast = GPU_indexbuf_build(&elb);
+
+ buffers->index_buf = GPU_indexbuf_build(&elb);
+ buffers->index_buf_fast = GPU_indexbuf_build(&elb_fast);
+ buffers->index_lines_buf = GPU_indexbuf_build(&elb_lines);
+ buffers->index_lines_buf_fast = GPU_indexbuf_build(&elb_lines_fast);
}
void GPU_pbvh_grid_buffers_update(
@@ -394,39 +504,50 @@ void GPU_pbvh_grid_buffers_update(
bool empty_mask = true;
int i, j, k, x, y;
- buffers->smooth = grid_flag_mats[grid_indices[0]].flag & ME_SMOOTH;
+ const bool smooth = grid_flag_mats[grid_indices[0]].flag & ME_SMOOTH;
/* Build VBO */
const int has_mask = key->has_mask;
- uint vert_count = totgrid * key->grid_area;
+ uint vert_per_grid = (smooth) ? key->grid_area : (SQUARE(key->grid_size - 1) * 4);
+ uint vert_count = totgrid * vert_per_grid;
- if (!buffers->smooth) {
- vert_count = totgrid * (key->grid_size - 1) * (key->grid_size - 1) * 4;
- /* Count strip restart verts (2 verts between each row and grid) */
- vert_count += ((totgrid - 1) + totgrid * (key->grid_size - 2)) * 2;
- }
-
- if (buffers->smooth && buffers->index_buf == NULL) {
- /* Not sure if really needed. */
- GPU_BATCH_DISCARD_SAFE(buffers->triangles_fast);
- GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf_fast);
- }
- else if (!buffers->smooth && buffers->index_buf != NULL) {
- /* Discard unnecessary index buffers. */
+ if (buffers->smooth != smooth) {
+ buffers->smooth = smooth;
GPU_BATCH_DISCARD_SAFE(buffers->triangles);
GPU_BATCH_DISCARD_SAFE(buffers->triangles_fast);
+ GPU_BATCH_DISCARD_SAFE(buffers->lines);
+ GPU_BATCH_DISCARD_SAFE(buffers->lines_fast);
+
GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf_fast);
+ GPU_INDEXBUF_DISCARD_SAFE(buffers->index_lines_buf);
+ GPU_INDEXBUF_DISCARD_SAFE(buffers->index_lines_buf_fast);
}
- if (buffers->index_buf_fast == NULL) {
- gpu_pbvh_grid_fill_fast_buffer(buffers, totgrid, key->grid_size);
+ if (buffers->index_buf == NULL) {
+ uint visible_quad_len = BKE_pbvh_count_grid_quads((BLI_bitmap **)buffers->grid_hidden,
+ grid_indices,
+ totgrid,
+ key->grid_size);
+
+ /* totally hidden node, return here to avoid BufferData with zero below. */
+ if (visible_quad_len == 0) {
+ return;
+ }
+
+ gpu_pbvh_grid_fill_index_buffers(buffers, grid_indices, visible_quad_len, totgrid, key->grid_size);
}
uint vbo_index_offset = 0;
/* Build VBO */
if (gpu_pbvh_vert_buf_data_set(buffers, vert_count)) {
+ GPUIndexBufBuilder elb_lines;
+
+ if (buffers->index_lines_buf == NULL) {
+ GPU_indexbuf_init(&elb_lines, GPU_PRIM_LINES, totgrid * key->grid_area * 2, vert_count);
+ }
+
for (i = 0; i < totgrid; ++i) {
CCGElem *grid = grids[grid_indices[i]];
int vbo_index = vbo_index_offset;
@@ -454,47 +575,32 @@ void GPU_pbvh_grid_buffers_update(
else {
for (j = 0; j < key->grid_size - 1; j++) {
for (k = 0; k < key->grid_size - 1; k++) {
- const bool is_row_start = (k == 0);
- const bool is_row_end = (k == key->grid_size - 2);
- const bool is_grid_start = (j == 0);
- const bool is_grid_end = (j == key->grid_size - 2);
- const bool is_first_grid = (i == 0);
- const bool is_last_grid = (i == totgrid - 1);
-
CCGElem *elems[4] = {
- CCG_grid_elem(key, grid, k, j + 1),
- CCG_grid_elem(key, grid, k + 1, j + 1),
+ CCG_grid_elem(key, grid, k, j),
CCG_grid_elem(key, grid, k + 1, j),
- CCG_grid_elem(key, grid, k, j)
+ CCG_grid_elem(key, grid, k + 1, j + 1),
+ CCG_grid_elem(key, grid, k, j + 1),
};
float *co[4] = {
CCG_elem_co(key, elems[0]),
CCG_elem_co(key, elems[1]),
CCG_elem_co(key, elems[2]),
- CCG_elem_co(key, elems[3])
+ CCG_elem_co(key, elems[3]),
};
float fno[3];
short no_short[3];
- normal_quad_v3(fno, co[0], co[1], co[2], co[3]);
+ /* Note: Clockwise indices ordering, that's why we invert order here. */
+ normal_quad_v3(fno, co[3], co[2], co[1], co[0]);
normal_float_to_short_v3(no_short, fno);
- if (is_row_start && !(is_grid_start && is_first_grid)) {
- /* Duplicate first vert
- * (only pos is needed since the triangle will be degenerate) */
- GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.pos, vbo_index, co[3]);
- vbo_index += 1;
- vbo_index_offset += 1;
- }
-
- /* Note indices orders (3, 0, 2, 1); we are drawing a triangle strip. */
- GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.pos, vbo_index, co[3]);
- GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.nor, vbo_index, no_short);
- GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.pos, vbo_index + 1, co[0]);
+ GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.pos, vbo_index + 0, co[0]);
+ GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.nor, vbo_index + 0, no_short);
+ GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.pos, vbo_index + 1, co[1]);
GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.nor, vbo_index + 1, no_short);
GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.pos, vbo_index + 2, co[2]);
GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.nor, vbo_index + 2, no_short);
- GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.pos, vbo_index + 3, co[1]);
+ GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.pos, vbo_index + 3, co[3]);
GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.nor, vbo_index + 3, no_short);
if (has_mask && show_mask) {
@@ -502,29 +608,20 @@ void GPU_pbvh_grid_buffers_update(
*CCG_elem_mask(key, elems[1]) +
*CCG_elem_mask(key, elems[2]) +
*CCG_elem_mask(key, elems[3])) * 0.25f;
- GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.msk, vbo_index, &fmask);
+ GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.msk, vbo_index + 0, &fmask);
GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.msk, vbo_index + 1, &fmask);
GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.msk, vbo_index + 2, &fmask);
GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.msk, vbo_index + 3, &fmask);
empty_mask = empty_mask && (fmask == 0.0f);
}
-
- if (is_row_end && !(is_grid_end && is_last_grid)) {
- /* Duplicate last vert
- * (only pos is needed since the triangle will be degenerate) */
- GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.pos, vbo_index + 4, co[1]);
- vbo_index += 1;
- vbo_index_offset += 1;
- }
-
vbo_index += 4;
}
}
- vbo_index_offset += (key->grid_size - 1) * (key->grid_size - 1) * 4;
+ vbo_index_offset += SQUARE(key->grid_size - 1) * 4;
}
}
- gpu_pbvh_batch_init(buffers, buffers->smooth ? GPU_PRIM_TRIS : GPU_PRIM_TRI_STRIP);
+ gpu_pbvh_batch_init(buffers, GPU_PRIM_TRIS);
}
buffers->grids = grids;
@@ -537,72 +634,11 @@ void GPU_pbvh_grid_buffers_update(
//printf("node updated %p\n", buffers);
}
-/* Build the element array buffer of grid indices using either
- * ushorts or uints. */
-#define FILL_QUAD_BUFFER(max_vert_, tot_quad_, buffer_) \
- { \
- int offset = 0; \
- int i, j, k; \
- \
- GPUIndexBufBuilder elb; \
- GPU_indexbuf_init( \
- &elb, GPU_PRIM_TRIS, tot_quad_ * 2, max_vert_); \
- \
- /* Fill the buffer */ \
- 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; \
- } \
- GPU_indexbuf_add_generic_vert(&elb, offset + j * gridsize + k + 1); \
- GPU_indexbuf_add_generic_vert(&elb, offset + j * gridsize + k); \
- GPU_indexbuf_add_generic_vert(&elb, offset + (j + 1) * gridsize + k); \
- \
- GPU_indexbuf_add_generic_vert(&elb, offset + (j + 1) * gridsize + k + 1); \
- GPU_indexbuf_add_generic_vert(&elb, offset + j * gridsize + k + 1); \
- GPU_indexbuf_add_generic_vert(&elb, offset + (j + 1) * gridsize + k); \
- } \
- } \
- \
- offset += gridsize * gridsize; \
- } \
- buffer_ = GPU_indexbuf_build(&elb); \
- } (void)0
-/* end FILL_QUAD_BUFFER */
-
-static GPUIndexBuf *gpu_get_grid_buffer(
- int gridsize, uint *totquad,
- /* remove this arg when GPU gets base-vertex support! */
- int totgrid)
-{
- /* used in the FILL_QUAD_BUFFER macro */
- BLI_bitmap * const *grid_hidden = NULL;
- const int *grid_indices = NULL;
-
- /* Build new VBO */
- *totquad = (gridsize - 1) * (gridsize - 1) * totgrid;
- int max_vert = gridsize * gridsize * totgrid;
-
- GPUIndexBuf *mres_buffer;
- FILL_QUAD_BUFFER(max_vert, *totquad, mres_buffer);
-
- return mres_buffer;
-}
-
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(
- int *grid_indices, int totgrid, BLI_bitmap **grid_hidden, int gridsize, const CCGKey *UNUSED(key))
+ int totgrid,
+ BLI_bitmap **grid_hidden)
{
GPU_PBVH_Buffers *buffers;
- int totquad;
- int fully_visible_totquad = (gridsize - 1) * (gridsize - 1) * totgrid;
buffers = MEM_callocN(sizeof(GPU_PBVH_Buffers), "GPU_Buffers");
buffers->grid_hidden = grid_hidden;
@@ -610,35 +646,17 @@ GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(
buffers->show_mask = false;
- /* Count the number of quads */
- totquad = BKE_pbvh_count_grid_quads(grid_hidden, grid_indices, totgrid, gridsize);
-
- /* totally hidden node, return here to avoid BufferData with zero below. */
- if (totquad == 0)
- return buffers;
-
- /* TODO(fclem) this needs a bit of cleanup. It's only needed for smooth grids.
- * Could be moved to the update function somehow. */
- if (totquad == fully_visible_totquad) {
- buffers->index_buf = gpu_get_grid_buffer(gridsize, &buffers->tot_quad, totgrid);
- buffers->has_hidden = false;
- buffers->is_index_buf_global = false;
- }
- else {
- uint max_vert = totgrid * gridsize * gridsize;
- buffers->tot_quad = totquad;
-
- FILL_QUAD_BUFFER(max_vert, totquad, buffers->index_buf);
-
- buffers->has_hidden = false;
- buffers->is_index_buf_global = false;
- }
-
return buffers;
}
#undef FILL_QUAD_BUFFER
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name BMesh PBVH
+ * \{ */
+
/* Output a BMVert into a VertexBufferFormat array
*
* The vertex is skipped if hidden, otherwise the output goes into
@@ -739,10 +757,15 @@ void GPU_pbvh_bmesh_buffers_update(
if (buffers->smooth) {
/* Smooth needs to recreate index buffer, so we have to invalidate the batch. */
GPU_BATCH_DISCARD_SAFE(buffers->triangles);
+ GPU_BATCH_DISCARD_SAFE(buffers->lines);
+ GPU_INDEXBUF_DISCARD_SAFE(buffers->index_lines_buf);
+ GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
/* Count visible vertices */
totvert = gpu_bmesh_vert_visible_count(bm_unique_verts, bm_other_verts);
}
else {
+ GPU_BATCH_DISCARD_SAFE(buffers->lines);
+ GPU_INDEXBUF_DISCARD_SAFE(buffers->index_lines_buf);
totvert = tottri * 3;
}
@@ -783,6 +806,9 @@ void GPU_pbvh_bmesh_buffers_update(
else {
GSetIterator gs_iter;
+ GPUIndexBufBuilder elb_lines;
+ GPU_indexbuf_init(&elb_lines, GPU_PRIM_LINES, tottri * 3, totvert);
+
GSET_ITER (gs_iter, bm_faces) {
BMFace *f = BLI_gsetIterator_getKey(&gs_iter);
@@ -793,9 +819,6 @@ void GPU_pbvh_bmesh_buffers_update(
float fmask = 0.0f;
int i;
-#if 0
- BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void **)v, 3);
-#endif
BM_face_as_array_vert_tri(f, v);
/* Average mask value */
@@ -804,6 +827,10 @@ void GPU_pbvh_bmesh_buffers_update(
}
fmask /= 3.0f;
+ GPU_indexbuf_add_line_verts(&elb_lines, v_index + 0, v_index + 1);
+ GPU_indexbuf_add_line_verts(&elb_lines, v_index + 1, v_index + 2);
+ GPU_indexbuf_add_line_verts(&elb_lines, v_index + 2, v_index + 0);
+
for (i = 0; i < 3; i++) {
gpu_bmesh_vert_to_buffer_copy__gwn(
v[i], buffers->vert_buf,
@@ -814,6 +841,7 @@ void GPU_pbvh_bmesh_buffers_update(
}
}
+ buffers->index_lines_buf = GPU_indexbuf_build(&elb_lines);
buffers->tot_tri = tottri;
}
@@ -827,15 +855,11 @@ void GPU_pbvh_bmesh_buffers_update(
if (buffers->smooth) {
/* Fill the triangle buffer */
- buffers->index_buf = NULL;
- GPUIndexBufBuilder elb;
+ GPUIndexBufBuilder elb, elb_lines;
GPU_indexbuf_init(&elb, GPU_PRIM_TRIS, tottri, maxvert);
-
- /* Initialize triangle index buffer */
- buffers->is_index_buf_global = false;
+ GPU_indexbuf_init(&elb_lines, GPU_PRIM_LINES, tottri * 3, maxvert);
/* Fill triangle index buffer */
-
{
GSetIterator gs_iter;
@@ -846,8 +870,13 @@ void GPU_pbvh_bmesh_buffers_update(
BMVert *v[3];
BM_face_as_array_vert_tri(f, v);
- GPU_indexbuf_add_tri_verts(
- &elb, BM_elem_index_get(v[0]), BM_elem_index_get(v[1]), BM_elem_index_get(v[2]));
+
+ uint idx[3] = {BM_elem_index_get(v[0]), BM_elem_index_get(v[1]), BM_elem_index_get(v[2])};
+ GPU_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]);
+
+ GPU_indexbuf_add_line_verts(&elb_lines, idx[0], idx[1]);
+ GPU_indexbuf_add_line_verts(&elb_lines, idx[1], idx[2]);
+ GPU_indexbuf_add_line_verts(&elb_lines, idx[2], idx[0]);
}
}
@@ -859,21 +888,22 @@ void GPU_pbvh_bmesh_buffers_update(
else {
GPU_indexbuf_build_in_place(&elb, buffers->index_buf);
}
+
+ buffers->index_lines_buf = GPU_indexbuf_build(&elb_lines);
}
}
- else if (buffers->index_buf) {
- if (!buffers->is_index_buf_global) {
- GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
- }
- buffers->index_buf = NULL;
- buffers->is_index_buf_global = false;
- }
buffers->show_mask = !empty_mask;
gpu_pbvh_batch_init(buffers, GPU_PRIM_TRIS);
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Generic
+ * \{ */
+
GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading)
{
GPU_PBVH_Buffers *buffers;
@@ -886,10 +916,16 @@ GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading)
return buffers;
}
-GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast)
+GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast, bool wires)
{
- return (fast && buffers->triangles_fast) ?
- buffers->triangles_fast : buffers->triangles;
+ if (wires) {
+ return (fast && buffers->lines_fast) ?
+ buffers->lines_fast : buffers->lines;
+ }
+ else {
+ return (fast && buffers->triangles_fast) ?
+ buffers->triangles_fast : buffers->triangles;
+ }
}
bool GPU_pbvh_buffers_has_mask(GPU_PBVH_Buffers *buffers)
@@ -900,18 +936,26 @@ bool GPU_pbvh_buffers_has_mask(GPU_PBVH_Buffers *buffers)
void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers)
{
if (buffers) {
+ GPU_BATCH_DISCARD_SAFE(buffers->lines);
+ GPU_BATCH_DISCARD_SAFE(buffers->lines_fast);
GPU_BATCH_DISCARD_SAFE(buffers->triangles);
GPU_BATCH_DISCARD_SAFE(buffers->triangles_fast);
- if (!buffers->is_index_buf_global) {
- GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
- }
+ GPU_INDEXBUF_DISCARD_SAFE(buffers->index_lines_buf_fast);
+ GPU_INDEXBUF_DISCARD_SAFE(buffers->index_lines_buf);
GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf_fast);
+ GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf);
GPU_VERTBUF_DISCARD_SAFE(buffers->vert_buf);
MEM_freeN(buffers);
}
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Debug
+ * \{ */
+
/* debug function, draws the pbvh BB */
void GPU_pbvh_BB_draw(float min[3], float max[3], bool leaf, uint pos)
{
@@ -968,6 +1012,8 @@ void GPU_pbvh_BB_draw(float min[3], float max[3], bool leaf, uint pos)
immEnd();
}
+/** \} */
+
void GPU_pbvh_fix_linking()
{
}
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 4360941e332..63d875b07fd 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_codegen.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Convert material node-trees to GLSL.
*/
@@ -78,14 +70,14 @@ static char *glsl_material_library = NULL;
static GPUPass *pass_cache = NULL;
static SpinLock pass_cache_spin;
-static uint32_t gpu_pass_hash(const char *frag_gen, const char *defs, GPUVertexAttribs *attribs)
+static uint32_t gpu_pass_hash(const char *frag_gen, const char *defs, GPUVertAttrLayers *attrs)
{
BLI_HashMurmur2A hm2a;
BLI_hash_mm2a_init(&hm2a, 0);
BLI_hash_mm2a_add(&hm2a, (uchar *)frag_gen, strlen(frag_gen));
- if (attribs) {
- for (int att_idx = 0; att_idx < attribs->totlayer; att_idx++) {
- char *name = attribs->layer[att_idx].name;
+ if (attrs) {
+ for (int att_idx = 0; att_idx < attrs->totlayer; att_idx++) {
+ char *name = attrs->layer[att_idx].name;
BLI_hash_mm2a_add(&hm2a, (uchar *)name, strlen(name));
}
}
@@ -146,15 +138,15 @@ typedef enum {
typedef struct GPUFunction {
char name[MAX_FUNCTION_NAME];
- GPUType paramtype[MAX_PARAMETER];
+ eGPUType paramtype[MAX_PARAMETER];
GPUFunctionQual paramqual[MAX_PARAMETER];
int totparam;
} GPUFunction;
-/* Indices match the GPUType enum */
+/* Indices match the eGPUType enum */
static const char *GPU_DATATYPE_STR[17] = {
"", "float", "vec2", "vec3", "vec4",
- NULL, NULL, NULL, NULL, "mat3", NULL, NULL, NULL, NULL, NULL, NULL, "mat4"
+ NULL, NULL, NULL, NULL, "mat3", NULL, NULL, NULL, NULL, NULL, NULL, "mat4",
};
/* GLSL code parsing for finding function definitions.
@@ -215,7 +207,7 @@ static char *gpu_str_skip_token(char *str, char *token, int max)
static void gpu_parse_functions_string(GHash *hash, char *code)
{
GPUFunction *function;
- GPUType type;
+ eGPUType type;
GPUFunctionQual qual;
int i;
@@ -442,7 +434,7 @@ static void codegen_convert_datatype(DynStr *ds, int from, int to, const char *t
}
}
-static void codegen_print_datatype(DynStr *ds, const GPUType type, float *data)
+static void codegen_print_datatype(DynStr *ds, const eGPUType type, float *data)
{
int i;
@@ -465,7 +457,7 @@ static int codegen_input_has_texture(GPUInput *input)
return (input->source == GPU_SOURCE_TEX);
}
-const char *GPU_builtin_name(GPUBuiltin builtin)
+const char *GPU_builtin_name(eGPUBuiltin builtin)
{
if (builtin == GPU_VIEW_MATRIX)
return "unfviewmat";
@@ -636,10 +628,10 @@ static int codegen_process_uniforms_functions(GPUMaterial *material, DynStr *ds,
codegen_print_datatype(ds, input->type, input->vec);
BLI_dynstr_append(ds, ";\n");
}
- else if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
+ else if (input->source == GPU_SOURCE_ATTR && input->attr_first) {
BLI_dynstr_appendf(
ds, "in %s var%d;\n",
- GPU_DATATYPE_STR[input->type], input->attribid);
+ GPU_DATATYPE_STR[input->type], input->attr_id);
}
}
}
@@ -743,8 +735,8 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final
else if (input->source == GPU_SOURCE_CONSTANT) {
BLI_dynstr_appendf(ds, "cons%d", input->id);
}
- else if (input->source == GPU_SOURCE_ATTRIB) {
- BLI_dynstr_appendf(ds, "var%d", input->attribid);
+ else if (input->source == GPU_SOURCE_ATTR) {
+ BLI_dynstr_appendf(ds, "var%d", input->attr_id);
}
BLI_dynstr_append(ds, ", ");
@@ -841,7 +833,7 @@ static char *code_generate_fragment(GPUMaterial *material, ListBase *nodes, GPUO
return code;
}
-static const char *attrib_prefix_get(CustomDataType type)
+static const char *attr_prefix_get(CustomDataType type)
{
switch (type) {
case CD_ORCO: return "orco";
@@ -861,13 +853,13 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
char *code;
int builtins = 0;
- /* Hairs uv and col attribs are passed by bufferTextures. */
+ /* Hairs uv and col attributes are passed by bufferTextures. */
BLI_dynstr_append(
ds,
"#ifdef HAIR_SHADER\n"
- "#define DEFINE_ATTRIB(type, attr) uniform samplerBuffer attr\n"
+ "#define DEFINE_ATTR(type, attr) uniform samplerBuffer attr\n"
"#else\n"
- "#define DEFINE_ATTRIB(type, attr) in type attr\n"
+ "#define DEFINE_ATTR(type, attr) in type attr\n"
"#endif\n"
);
@@ -876,43 +868,45 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
if (input->source == GPU_SOURCE_BUILTIN) {
builtins |= input->builtin;
}
- if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
+ if (input->source == GPU_SOURCE_ATTR && input->attr_first) {
/* XXX FIXME : see notes in mesh_render_data_create() */
/* NOTE : Replicate changes to mesh_render_data_create() in draw_cache_impl_mesh.c */
- if (input->attribtype == CD_ORCO) {
+ if (input->attr_type == CD_ORCO) {
/* orco is computed from local positions, see below */
BLI_dynstr_appendf(ds, "uniform vec3 OrcoTexCoFactors[2];\n");
}
- else if (input->attribname[0] == '\0') {
- BLI_dynstr_appendf(ds, "DEFINE_ATTRIB(%s, %s);\n", GPU_DATATYPE_STR[input->type], attrib_prefix_get(input->attribtype));
- BLI_dynstr_appendf(ds, "#define att%d %s\n", input->attribid, attrib_prefix_get(input->attribtype));
+ else if (input->attr_name[0] == '\0') {
+ BLI_dynstr_appendf(ds, "DEFINE_ATTR(%s, %s);\n", GPU_DATATYPE_STR[input->type], attr_prefix_get(input->attr_type));
+ BLI_dynstr_appendf(ds, "#define att%d %s\n", input->attr_id, attr_prefix_get(input->attr_type));
}
else {
- uint hash = BLI_ghashutil_strhash_p(input->attribname);
+ uint hash = BLI_ghashutil_strhash_p(input->attr_name);
BLI_dynstr_appendf(
- ds, "DEFINE_ATTRIB(%s, %s%u);\n",
- GPU_DATATYPE_STR[input->type], attrib_prefix_get(input->attribtype), hash);
+ ds, "DEFINE_ATTR(%s, %s%u);\n",
+ GPU_DATATYPE_STR[input->type], attr_prefix_get(input->attr_type), hash);
BLI_dynstr_appendf(
ds, "#define att%d %s%u\n",
- input->attribid, attrib_prefix_get(input->attribtype), hash);
- /* Auto attrib can be vertex color byte buffer.
+ input->attr_id, attr_prefix_get(input->attr_type), hash);
+ /* Auto attribute can be vertex color byte buffer.
* We need to know and convert them to linear space in VS. */
- if (!use_geom && input->attribtype == CD_AUTO_FROM_NAME) {
+ if (input->attr_type == CD_AUTO_FROM_NAME) {
BLI_dynstr_appendf(ds, "uniform bool ba%u;\n", hash);
- BLI_dynstr_appendf(ds, "#define att%d_is_srgb ba%u\n", input->attribid, hash);
+ BLI_dynstr_appendf(ds, "#define att%d_is_srgb ba%u\n", input->attr_id, hash);
}
}
BLI_dynstr_appendf(
ds, "out %s var%d%s;\n",
- GPU_DATATYPE_STR[input->type], input->attribid, use_geom ? "g" : "");
+ GPU_DATATYPE_STR[input->type], input->attr_id, use_geom ? "g" : "");
}
}
}
if (builtins & GPU_BARYCENTRIC_TEXCO) {
+ BLI_dynstr_append(ds, "#ifdef HAIR_SHADER\n");
BLI_dynstr_appendf(
ds, "out vec2 barycentricTexCo%s;\n",
use_geom ? "g" : "");
+ BLI_dynstr_append(ds, "#endif\n");
}
if (builtins & GPU_BARYCENTRIC_DIST) {
@@ -924,11 +918,11 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
BLI_dynstr_append(
ds,
- "#define ATTRIB\n"
+ "#define USE_ATTR\n"
"uniform mat3 NormalMatrix;\n"
"uniform mat4 ModelMatrixInverse;\n"
"uniform mat4 ModelMatrix;\n"
- "vec3 srgb_to_linear_attrib(vec3 c) {\n"
+ "vec3 srgb_to_linear_attr(vec3 c) {\n"
"\tc = max(c, vec3(0.0));\n"
"\tvec3 c1 = c * (1.0 / 12.92);\n"
"\tvec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));\n"
@@ -947,7 +941,7 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
"\n"
);
- BLI_dynstr_append(ds, "void pass_attrib(in vec3 position) {\n");
+ BLI_dynstr_append(ds, "void pass_attr(in vec3 position) {\n");
BLI_dynstr_append(ds, "#ifdef HAIR_SHADER\n");
@@ -971,22 +965,22 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
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) {
+ if (input->source == GPU_SOURCE_ATTR && input->attr_first) {
+ if (input->attr_type == CD_TANGENT) {
/* Not supported by hairs */
BLI_dynstr_appendf(
ds, "\tvar%d%s = vec4(0.0);\n",
- input->attribid, use_geom ? "g" : "");
+ input->attr_id, use_geom ? "g" : "");
}
- else if (input->attribtype == CD_ORCO) {
+ else if (input->attr_type == CD_ORCO) {
BLI_dynstr_appendf(
ds, "\tvar%d%s = OrcoTexCoFactors[0] + (ModelMatrixInverse * vec4(hair_get_strand_pos(), 1.0)).xyz * OrcoTexCoFactors[1];\n",
- input->attribid, use_geom ? "g" : "");
+ input->attr_id, use_geom ? "g" : "");
}
else {
BLI_dynstr_appendf(
ds, "\tvar%d%s = hair_get_customdata_%s(att%d);\n",
- input->attribid, use_geom ? "g" : "", GPU_DATATYPE_STR[input->type], input->attribid);
+ input->attr_id, use_geom ? "g" : "", GPU_DATATYPE_STR[input->type], input->attr_id);
}
}
}
@@ -994,14 +988,9 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
BLI_dynstr_append(ds, "#else /* MESH_SHADER */\n");
- if (builtins & GPU_BARYCENTRIC_TEXCO) {
- BLI_dynstr_appendf(
- ds, "\tbarycentricTexCo%s.x = float((gl_VertexID %% 3) == 0);\n",
- use_geom ? "g" : "");
- BLI_dynstr_appendf(
- ds, "\tbarycentricTexCo%s.y = float((gl_VertexID %% 3) == 1);\n",
- use_geom ? "g" : "");
- }
+ /* GPU_BARYCENTRIC_TEXCO cannot be computed based on gl_VertexID
+ * for MESH_SHADER because of indexed drawing. In this case a
+ * geometry shader is needed. */
if (builtins & GPU_BARYCENTRIC_DIST) {
BLI_dynstr_appendf(ds, "\tbarycentricPosg = (ModelMatrix * vec4(position, 1.0)).xyz;\n");
@@ -1009,35 +998,35 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
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->source == GPU_SOURCE_ATTR && input->attr_first) {
+ if (input->attr_type == CD_TANGENT) { /* silly exception */
BLI_dynstr_appendf(
ds, "\tvar%d%s.xyz = normalize(NormalMatrix * att%d.xyz);\n",
- input->attribid, use_geom ? "g" : "", input->attribid);
+ input->attr_id, use_geom ? "g" : "", input->attr_id);
BLI_dynstr_appendf(
ds, "\tvar%d%s.w = att%d.w;\n",
- input->attribid, use_geom ? "g" : "", input->attribid);
+ input->attr_id, use_geom ? "g" : "", input->attr_id);
}
- else if (input->attribtype == CD_ORCO) {
+ else if (input->attr_type == CD_ORCO) {
BLI_dynstr_appendf(
ds, "\tvar%d%s = OrcoTexCoFactors[0] + position * OrcoTexCoFactors[1];\n",
- input->attribid, use_geom ? "g" : "");
+ input->attr_id, use_geom ? "g" : "");
}
- else if (input->attribtype == CD_MCOL) {
+ else if (input->attr_type == CD_MCOL) {
BLI_dynstr_appendf(
- ds, "\tvar%d%s = srgb_to_linear_attrib(att%d);\n",
- input->attribid, use_geom ? "g" : "", input->attribid);
+ ds, "\tvar%d%s = srgb_to_linear_attr(att%d);\n",
+ input->attr_id, use_geom ? "g" : "", input->attr_id);
}
- else if (input->attribtype == CD_AUTO_FROM_NAME) {
+ else if (input->attr_type == CD_AUTO_FROM_NAME) {
BLI_dynstr_appendf(
- ds, "\tvar%d%s = (att%d_is_srgb) ? srgb_to_linear_attrib(att%d) : att%d;\n",
- input->attribid, use_geom ? "g" : "",
- input->attribid, input->attribid, input->attribid);
+ ds, "\tvar%d%s = (att%d_is_srgb) ? srgb_to_linear_attr(att%d) : att%d;\n",
+ input->attr_id, use_geom ? "g" : "",
+ input->attr_id, input->attr_id, input->attr_id);
}
else {
BLI_dynstr_appendf(
ds, "\tvar%d%s = att%d;\n",
- input->attribid, use_geom ? "g" : "", input->attribid);
+ input->attr_id, use_geom ? "g" : "", input->attr_id);
}
}
}
@@ -1079,7 +1068,7 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
return code;
}
-static char *code_generate_geometry(ListBase *nodes, const char *geom_code)
+static char *code_generate_geometry(ListBase *nodes, const char *geom_code, const char *defines)
{
DynStr *ds = BLI_dynstr_new();
GPUNode *node;
@@ -1087,10 +1076,13 @@ static char *code_generate_geometry(ListBase *nodes, const char *geom_code)
char *code;
int builtins = 0;
+ /* XXX we should not make specific eevee cases here. */
+ bool is_hair_shader = (strstr(defines, "HAIR_SHADER") != NULL);
+
/* Create prototype because attributes cannot be declared before layout. */
- BLI_dynstr_appendf(ds, "void pass_attrib(in int vert);\n");
+ BLI_dynstr_appendf(ds, "void pass_attr(in int vert);\n");
BLI_dynstr_appendf(ds, "void calc_barycentric_distances(vec3 pos0, vec3 pos1, vec3 pos2);\n");
- BLI_dynstr_append(ds, "#define ATTRIB\n");
+ BLI_dynstr_append(ds, "#define USE_ATTR\n");
/* Generate varying declarations. */
for (node = nodes->first; node; node = node->next) {
@@ -1098,21 +1090,24 @@ static char *code_generate_geometry(ListBase *nodes, const char *geom_code)
if (input->source == GPU_SOURCE_BUILTIN) {
builtins |= input->builtin;
}
- if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
+ if (input->source == GPU_SOURCE_ATTR && input->attr_first) {
BLI_dynstr_appendf(
ds, "in %s var%dg[];\n",
GPU_DATATYPE_STR[input->type],
- input->attribid);
+ input->attr_id);
BLI_dynstr_appendf(
ds, "out %s var%d;\n",
GPU_DATATYPE_STR[input->type],
- input->attribid);
+ input->attr_id);
}
}
}
if (builtins & GPU_BARYCENTRIC_TEXCO) {
+ BLI_dynstr_appendf(ds, "#ifdef HAIR_SHADER\n");
BLI_dynstr_appendf(ds, "in vec2 barycentricTexCog[];\n");
+ BLI_dynstr_appendf(ds, "#endif\n");
+
BLI_dynstr_appendf(ds, "out vec2 barycentricTexCo;\n");
}
@@ -1122,7 +1117,9 @@ static char *code_generate_geometry(ListBase *nodes, const char *geom_code)
}
if (geom_code == NULL) {
- if ((builtins & GPU_BARYCENTRIC_DIST) == 0) {
+ /* Force geometry usage if GPU_BARYCENTRIC_DIST or GPU_BARYCENTRIC_TEXCO are used.
+ * Note: GPU_BARYCENTRIC_TEXCO only requires it if the shader is not drawing hairs. */
+ if ((builtins & (GPU_BARYCENTRIC_DIST | GPU_BARYCENTRIC_TEXCO)) == 0 || is_hair_shader) {
/* Early out */
BLI_dynstr_free(ds);
return NULL;
@@ -1150,15 +1147,15 @@ static char *code_generate_geometry(ListBase *nodes, const char *geom_code)
}
BLI_dynstr_appendf(ds, "\tgl_Position = gl_in[0].gl_Position;\n");
- BLI_dynstr_appendf(ds, "\tpass_attrib(0);\n");
+ BLI_dynstr_appendf(ds, "\tpass_attr(0);\n");
BLI_dynstr_appendf(ds, "\tEmitVertex();\n");
BLI_dynstr_appendf(ds, "\tgl_Position = gl_in[1].gl_Position;\n");
- BLI_dynstr_appendf(ds, "\tpass_attrib(1);\n");
+ BLI_dynstr_appendf(ds, "\tpass_attr(1);\n");
BLI_dynstr_appendf(ds, "\tEmitVertex();\n");
BLI_dynstr_appendf(ds, "\tgl_Position = gl_in[2].gl_Position;\n");
- BLI_dynstr_appendf(ds, "\tpass_attrib(2);\n");
+ BLI_dynstr_appendf(ds, "\tpass_attr(2);\n");
BLI_dynstr_appendf(ds, "\tEmitVertex();\n");
BLI_dynstr_appendf(ds, "};\n");
}
@@ -1186,7 +1183,7 @@ static char *code_generate_geometry(ListBase *nodes, const char *geom_code)
}
/* Generate varying assignments. */
- BLI_dynstr_appendf(ds, "void pass_attrib(in int vert) {\n");
+ BLI_dynstr_appendf(ds, "void pass_attr(in int vert) {\n");
/* XXX HACK: Eevee specific. */
if (geom_code == NULL) {
@@ -1197,14 +1194,19 @@ static char *code_generate_geometry(ListBase *nodes, const char *geom_code)
}
if (builtins & GPU_BARYCENTRIC_TEXCO) {
+ BLI_dynstr_appendf(ds, "#ifdef HAIR_SHADER\n");
BLI_dynstr_appendf(ds, "\tbarycentricTexCo = barycentricTexCog[vert];\n");
+ BLI_dynstr_appendf(ds, "#else\n");
+ BLI_dynstr_appendf(ds, "\tbarycentricTexCo.x = float((vert %% 3) == 0);\n");
+ BLI_dynstr_appendf(ds, "\tbarycentricTexCo.y = float((vert %% 3) == 1);\n");
+ BLI_dynstr_appendf(ds, "#endif\n");
}
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) {
- /* TODO let shader choose what to do depending on what the attrib is. */
- BLI_dynstr_appendf(ds, "\tvar%d = var%dg[vert];\n", input->attribid, input->attribid);
+ if (input->source == GPU_SOURCE_ATTR && input->attr_first) {
+ /* TODO let shader choose what to do depending on what the attribute is. */
+ BLI_dynstr_appendf(ds, "\tvar%d = var%dg[vert];\n", input->attr_id, input->attr_id);
}
}
}
@@ -1262,7 +1264,7 @@ void GPU_nodes_extract_dynamic_inputs(GPUShader *shader, ListBase *inputs, ListB
/* attributes don't need to be bound, they already have
* an id that the drawing functions will use. Builtins have
* constant names. */
- if (ELEM(input->source, GPU_SOURCE_ATTRIB, GPU_SOURCE_BUILTIN)) {
+ if (ELEM(input->source, GPU_SOURCE_ATTR, GPU_SOURCE_BUILTIN)) {
continue;
}
@@ -1274,7 +1276,7 @@ void GPU_nodes_extract_dynamic_inputs(GPUShader *shader, ListBase *inputs, ListB
if (input->source == GPU_SOURCE_TEX) {
if (input->bindtex) {
- input->shaderloc = GPU_shader_get_uniform(shader, input->shadername);
+ input->shaderloc = GPU_shader_get_uniform_ensure(shader, input->shadername);
/* extract nodes */
BLI_remlink(&node->inputs, input);
BLI_addtail(inputs, input);
@@ -1321,7 +1323,7 @@ static GPUNode *GPU_node_begin(const char *name)
return node;
}
-static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const GPUType type)
+static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType type)
{
GPUInput *input;
GPUNode *outnode;
@@ -1367,10 +1369,10 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const GPUType
input->iuser = link->iuser;
input->image_isdata = link->image_isdata;
break;
- case GPU_NODE_LINK_ATTRIB:
- input->source = GPU_SOURCE_ATTRIB;
- input->attribtype = link->attribtype;
- BLI_strncpy(input->attribname, link->attribname, sizeof(input->attribname));
+ case GPU_NODE_LINK_ATTR:
+ input->source = GPU_SOURCE_ATTR;
+ input->attr_type = link->attr_type;
+ BLI_strncpy(input->attr_name, link->attr_name, sizeof(input->attr_name));
break;
case GPU_NODE_LINK_CONSTANT:
input->source = (type == GPU_CLOSURE) ? GPU_SOURCE_STRUCT : GPU_SOURCE_CONSTANT;
@@ -1474,7 +1476,7 @@ static void gpu_node_input_socket(GPUMaterial *material, bNode *bnode, GPUNode *
}
}
-static void gpu_node_output(GPUNode *node, const GPUType type, GPUNodeLink **link)
+static void gpu_node_output(GPUNode *node, const eGPUType type, GPUNodeLink **link)
{
GPUOutput *output = MEM_callocN(sizeof(GPUOutput), "GPUOutput");
@@ -1533,7 +1535,7 @@ static void gpu_nodes_free(ListBase *nodes)
/* vertex attributes */
-void GPU_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *attribs)
+void GPU_nodes_get_vertex_attrs(ListBase *nodes, GPUVertAttrLayers *attrs)
{
GPUNode *node;
GPUInput *input;
@@ -1542,32 +1544,32 @@ void GPU_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *attribs)
/* convert attributes requested by node inputs to an array of layers,
* checking for duplicates and assigning id's starting from zero. */
- memset(attribs, 0, sizeof(*attribs));
+ memset(attrs, 0, sizeof(*attrs));
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 &&
- STREQ(attribs->layer[a].name, input->attribname))
+ if (input->source == GPU_SOURCE_ATTR) {
+ for (a = 0; a < attrs->totlayer; a++) {
+ if (attrs->layer[a].type == input->attr_type &&
+ STREQ(attrs->layer[a].name, input->attr_name))
{
break;
}
}
- if (a < GPU_MAX_ATTRIB) {
- if (a == attribs->totlayer) {
- input->attribid = attribs->totlayer++;
- input->attribfirst = true;
+ if (a < GPU_MAX_ATTR) {
+ if (a == attrs->totlayer) {
+ input->attr_id = attrs->totlayer++;
+ input->attr_first = true;
- attribs->layer[a].type = input->attribtype;
- attribs->layer[a].attribid = input->attribid;
+ attrs->layer[a].type = input->attr_type;
+ attrs->layer[a].attr_id = input->attr_id;
BLI_strncpy(
- attribs->layer[a].name, input->attribname,
- sizeof(attribs->layer[a].name));
+ attrs->layer[a].name, input->attr_name,
+ sizeof(attrs->layer[a].name));
}
else {
- input->attribid = attribs->layer[a].attribid;
+ input->attr_id = attrs->layer[a].attr_id;
}
}
}
@@ -1580,14 +1582,14 @@ void GPU_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *attribs)
GPUNodeLink *GPU_attribute(const CustomDataType type, const char *name)
{
GPUNodeLink *link = GPU_node_link_create();
- link->link_type = GPU_NODE_LINK_ATTRIB;
- link->attribname = name;
+ link->link_type = GPU_NODE_LINK_ATTR;
+ link->attr_name = name;
/* Fall back to the UV layer, which matches old behavior. */
if (type == CD_AUTO_FROM_NAME && name[0] == '\0') {
- link->attribtype = CD_MTFACE;
+ link->attr_type = CD_MTFACE;
}
else {
- link->attribtype = type;
+ link->attr_type = type;
}
return link;
}
@@ -1627,7 +1629,7 @@ GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *ro
return link;
}
-GPUNodeLink *GPU_builtin(GPUBuiltin builtin)
+GPUNodeLink *GPU_builtin(eGPUBuiltin builtin)
{
GPUNodeLink *link = GPU_node_link_create();
link->link_type = GPU_NODE_LINK_BUILTIN;
@@ -1787,7 +1789,7 @@ static bool gpu_pass_is_valid(GPUPass *pass)
GPUPass *GPU_generate_pass(
GPUMaterial *material,
GPUNodeLink *frag_outlink,
- struct GPUVertexAttribs *attribs,
+ struct GPUVertAttrLayers *attrs,
ListBase *nodes,
int *builtins,
const char *vert_code,
@@ -1801,13 +1803,13 @@ GPUPass *GPU_generate_pass(
/* prune unused nodes */
GPU_nodes_prune(nodes, frag_outlink);
- GPU_nodes_get_vertex_attributes(nodes, attribs);
+ GPU_nodes_get_vertex_attrs(nodes, attrs);
/* generate code */
char *fragmentgen = code_generate_fragment(material, nodes, frag_outlink->output, builtins);
/* Cache lookup: Reuse shaders already compiled */
- uint32_t hash = gpu_pass_hash(fragmentgen, defines, attribs);
+ uint32_t hash = gpu_pass_hash(fragmentgen, defines, attrs);
pass_hash = gpu_pass_cache_lookup(hash);
if (pass_hash && (pass_hash->next == NULL || pass_hash->next->hash != hash)) {
@@ -1825,7 +1827,7 @@ GPUPass *GPU_generate_pass(
* continue generating the shader strings. */
char *tmp = BLI_strdupcat(frag_lib, glsl_material_library);
- geometrycode = code_generate_geometry(nodes, geom_code);
+ geometrycode = code_generate_geometry(nodes, geom_code, defines);
vertexcode = code_generate_vertex(nodes, vert_code, (geometrycode != NULL));
fragmentcode = BLI_strdupcat(tmp, fragmentgen);
@@ -1904,7 +1906,7 @@ static int count_active_texture_sampler(GPUShader *shader, char *source)
if (*code != '\0') {
char sampler_name[64];
code = gpu_str_skip_token(code, sampler_name, sizeof(sampler_name));
- int id = GPU_shader_get_uniform(shader, sampler_name);
+ int id = GPU_shader_get_uniform_ensure(shader, sampler_name);
if (id == -1) {
continue;
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index 82ee559b01f..181bcde9120 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_codegen.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
@@ -38,11 +30,11 @@
#include "GPU_material.h"
#include "GPU_glew.h"
-struct ListBase;
-struct GPUShader;
-struct GPUOutput;
struct GPUNode;
-struct GPUVertexAttribs;
+struct GPUOutput;
+struct GPUShader;
+struct GPUVertAttrLayers;
+struct ListBase;
struct PreviewImage;
/* Pass Generation
@@ -51,19 +43,19 @@ struct PreviewImage;
* at the end if used.
*/
-typedef enum GPUDataSource {
+typedef enum eGPUDataSource {
GPU_SOURCE_OUTPUT,
GPU_SOURCE_CONSTANT,
GPU_SOURCE_UNIFORM,
- GPU_SOURCE_ATTRIB,
+ GPU_SOURCE_ATTR,
GPU_SOURCE_BUILTIN,
GPU_SOURCE_STRUCT,
GPU_SOURCE_TEX,
-} GPUDataSource;
+} eGPUDataSource;
typedef enum {
GPU_NODE_LINK_NONE = 0,
- GPU_NODE_LINK_ATTRIB,
+ GPU_NODE_LINK_ATTR,
GPU_NODE_LINK_BUILTIN,
GPU_NODE_LINK_COLORBAND,
GPU_NODE_LINK_CONSTANT,
@@ -94,15 +86,15 @@ struct GPUNodeLink {
/* GPU_NODE_LINK_CONSTANT | GPU_NODE_LINK_UNIFORM */
float *data;
/* GPU_NODE_LINK_BUILTIN */
- GPUBuiltin builtin;
+ eGPUBuiltin builtin;
/* GPU_NODE_LINK_COLORBAND */
struct GPUTexture **coba;
/* GPU_NODE_LINK_OUTPUT */
struct GPUOutput *output;
- /* GPU_NODE_LINK_ATTRIB */
+ /* GPU_NODE_LINK_ATTR */
struct {
- const char *attribname;
- CustomDataType attribtype;
+ const char *attr_name;
+ CustomDataType attr_type;
};
/* GPU_NODE_LINK_IMAGE_BLENDER */
struct {
@@ -117,7 +109,7 @@ typedef struct GPUOutput {
struct GPUOutput *next, *prev;
GPUNode *node;
- GPUType type; /* data type = length of vector/matrix */
+ eGPUType type; /* data type = length of vector/matrix */
GPUNodeLink *link; /* output link */
int id; /* unique id as created by code generator */
} GPUOutput;
@@ -126,21 +118,21 @@ typedef struct GPUInput {
struct GPUInput *next, *prev;
GPUNode *node;
- GPUType type; /* datatype */
+ eGPUType type; /* datatype */
GPUNodeLink *link;
int id; /* unique id as created by code generator */
- GPUDataSource source; /* data source */
+ eGPUDataSource source; /* data source */
int shaderloc; /* id from opengl */
char shadername[32]; /* name in shader */
- /* Content based on GPUDataSource */
+ /* Content based on eGPUDataSource */
union {
/* GPU_SOURCE_CONSTANT | GPU_SOURCE_UNIFORM */
float vec[16]; /* vector data */
/* GPU_SOURCE_BUILTIN */
- GPUBuiltin builtin; /* builtin uniform */
+ eGPUBuiltin builtin; /* builtin uniform */
/* GPU_SOURCE_TEX */
struct {
struct GPUTexture **coba; /* input texture, only set at runtime */
@@ -149,14 +141,18 @@ typedef struct GPUInput {
bool image_isdata; /* image does not contain color data */
bool bindtex; /* input is responsible for binding the texture? */
int texid; /* number for multitexture, starting from zero */
- GPUType textype; /* texture type (2D, 1D Array ...) */
+ eGPUType textype; /* texture type (2D, 1D Array ...) */
};
- /* GPU_SOURCE_ATTRIB */
+ /* GPU_SOURCE_ATTR */
struct {
- char attribname[MAX_CUSTOMDATA_LAYER_NAME]; /* attribute name */
- int attribid; /* id for vertex attributes */
- bool attribfirst; /* this is the first one that is bound */
- CustomDataType attribtype; /* attribute type */
+ /** Attribute name. */
+ char attr_name[MAX_CUSTOMDATA_LAYER_NAME];
+ /** ID for vertex attributes. */
+ int attr_id;
+ /** This is the first one that is bound. */
+ bool attr_first;
+ /** Attribute type. */
+ CustomDataType attr_type;
};
};
} GPUInput;
@@ -178,7 +174,7 @@ typedef struct GPUPass GPUPass;
GPUPass *GPU_generate_pass(
GPUMaterial *material,
- GPUNodeLink *frag_outlink, struct GPUVertexAttribs *attribs,
+ GPUNodeLink *frag_outlink, struct GPUVertAttrLayers *attrs,
ListBase *nodes, int *builtins,
const char *vert_code, const char *geom_code,
const char *frag_lib, const char *defines);
@@ -186,7 +182,7 @@ GPUPass *GPU_generate_pass(
struct GPUShader *GPU_pass_shader_get(GPUPass *pass);
void GPU_nodes_extract_dynamic_inputs(struct GPUShader *shader, ListBase *inputs, ListBase *nodes);
-void GPU_nodes_get_vertex_attributes(ListBase *nodes, struct GPUVertexAttribs *attribs);
+void GPU_nodes_get_vertex_attrs(ListBase *nodes, struct GPUVertAttrLayers *attrs);
void GPU_nodes_prune(ListBase *nodes, struct GPUNodeLink *outlink);
void GPU_pass_compile(GPUPass *pass, const char *shname);
@@ -200,7 +196,7 @@ void gpu_codegen_exit(void);
/* Material calls */
-const char *GPU_builtin_name(GPUBuiltin builtin);
+const char *GPU_builtin_name(eGPUBuiltin builtin);
void gpu_material_add_node(struct GPUMaterial *material, struct GPUNode *node);
struct GPUTexture **gpu_material_ramp_texture_row_set(GPUMaterial *mat, int size, float *pixels, float *row);
diff --git a/source/blender/gpu/intern/gpu_context.cpp b/source/blender/gpu/intern/gpu_context.cpp
index ce3eb64fa37..77a69999bf6 100644
--- a/source/blender/gpu/intern/gpu_context.cpp
+++ b/source/blender/gpu/intern/gpu_context.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Clément Foucault
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_context.cpp
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Manage GL vertex array IDs in a thread-safe way
* Use these instead of glGenBuffers & its friends
@@ -80,12 +74,14 @@ struct GPUContext {
#if TRUST_NO_ONE
pthread_t thread; /* Thread on which this context is active. */
bool thread_is_used;
+#endif
GPUContext() {
+#if TRUST_NO_ONE
thread_is_used = false;
+#endif
current_fbo = 0;
}
-#endif
};
#if defined(_MSC_VER) && (_MSC_VER == 1800)
diff --git a/source/blender/gpu/intern/gpu_context_private.h b/source/blender/gpu/intern/gpu_context_private.h
index 7f13dd542da..9c4cb30e40f 100644
--- a/source/blender/gpu/intern/gpu_context_private.h
+++ b/source/blender/gpu/intern/gpu_context_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_context_private.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* This interface allow GPU to manage GL objects for multiple context and threads.
*/
diff --git a/source/blender/gpu/intern/gpu_debug.c b/source/blender/gpu/intern/gpu_debug.c
index 8aea87ef659..71f318f3a56 100644
--- a/source/blender/gpu/intern/gpu_debug.c
+++ b/source/blender/gpu/intern/gpu_debug.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel, Jason Wilkins, Mike Erwin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/gpu/intern/gpu_debug.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#include "BLI_compiler_attrs.h"
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 347b48bf321..62dcbb94d1c 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_draw.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Utility functions for dealing with OpenGL texture & material context,
* mipmap generation and light objects.
@@ -39,13 +31,12 @@
#include <string.h>
#include "BLI_blenlib.h"
-#include "BLI_hash.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -84,6 +75,8 @@
# include "smoke_API.h"
#endif
+static void gpu_free_image_immediate(Image *ima);
+
//* Checking powers of two for images since OpenGL ES requires it */
#ifdef WITH_DDS
static bool is_power_of_2_resolution(int w, int h)
@@ -125,23 +118,10 @@ static struct GPUTextureState {
bool texpaint;
float anisotropic;
- int gpu_mipmap;
-} GTS = {1, 0, 0, 1.0f, 0};
+} GTS = {1, 0, 0, 1.0f};
/* Mipmap settings */
-void GPU_set_gpu_mipmapping(Main *bmain, int gpu_mipmap)
-{
- int old_value = GTS.gpu_mipmap;
-
- /* only actually enable if it's supported */
- GTS.gpu_mipmap = gpu_mipmap;
-
- if (old_value != GTS.gpu_mipmap) {
- GPU_free_images(bmain);
- }
-}
-
void GPU_set_mipmap(Main *bmain, bool mipmap)
{
if (GTS.domipmap != mipmap) {
@@ -284,13 +264,18 @@ GPUTexture *GPU_texture_from_blender(
Image *ima,
ImageUser *iuser,
int textarget,
- bool is_data,
- double UNUSED(time))
+ bool is_data)
{
if (ima == NULL) {
return NULL;
}
+ /* currently, gpu refresh tagging is used by ima sequences */
+ if (ima->gpuflag & IMA_GPU_REFRESH) {
+ gpu_free_image_immediate(ima);
+ ima->gpuflag &= ~IMA_GPU_REFRESH;
+ }
+
/* Test if we already have a texture. */
GPUTexture **tex = gpu_get_image_gputexture(ima, textarget);
if (*tex) {
@@ -305,12 +290,6 @@ GPUTexture *GPU_texture_from_blender(
return *tex;
}
- /* currently, tpage refresh is used by ima sequences */
- if (ima->tpageflag & IMA_TPAGE_REFRESH) {
- GPU_free_image(ima);
- ima->tpageflag &= ~IMA_TPAGE_REFRESH;
- }
-
/* check if we have a valid image buffer */
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
if (ibuf == NULL) {
@@ -322,18 +301,7 @@ GPUTexture *GPU_texture_from_blender(
bool use_high_bit_depth = false, do_color_management = false;
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;
- }
- else if (ibuf->rect == NULL) {
- IMB_rect_from_float(ibuf);
- }
- /* we may skip this in high precision, but if not, we need to have a valid buffer here */
- else if (ibuf->userflags & IB_RECT_INVALID) {
- IMB_rect_from_float(ibuf);
- }
+ use_high_bit_depth = true;
/* TODO unneeded when float images are correctly treated as linear always */
if (!is_data) {
@@ -372,9 +340,9 @@ GPUTexture *GPU_texture_from_blender(
/* mark as non-color data texture */
if (bindcode) {
if (is_data)
- ima->tpageflag |= IMA_GLBIND_IS_DATA;
+ ima->gpuflag |= IMA_GPU_IS_DATA;
else
- ima->tpageflag &= ~IMA_GLBIND_IS_DATA;
+ ima->gpuflag &= ~IMA_GPU_IS_DATA;
}
/* clean up */
@@ -461,9 +429,6 @@ void GPU_create_gl_tex(
{
ImBuf *ibuf = NULL;
- int tpx = rectw;
- int tpy = recth;
-
/* create image */
glGenTextures(1, (GLuint *)bind);
glBindTexture(textarget, *bind);
@@ -479,34 +444,10 @@ void GPU_create_gl_tex(
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
if (GPU_get_mipmap() && mipmap) {
- if (GTS.gpu_mipmap) {
- glGenerateMipmap(GL_TEXTURE_2D);
- }
- else {
- int i;
- if (!ibuf) {
- if (use_high_bit_depth) {
- ibuf = IMB_allocFromBuffer(NULL, frect, tpx, tpy);
- }
- else {
- ibuf = IMB_allocFromBuffer(rect, NULL, tpx, tpy);
- }
- }
- IMB_makemipmap(ibuf, true);
-
- for (i = 1; i < ibuf->miptot; i++) {
- ImBuf *mip = ibuf->mipmap[i - 1];
- if (use_high_bit_depth) {
- glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA16F, mip->x, mip->y, 0, GL_RGBA, GL_FLOAT, mip->rect_float);
- }
- else {
- glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA8, mip->x, mip->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, mip->rect);
- }
- }
- }
+ glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
if (ima)
- ima->tpageflag |= IMA_MIPMAP_COMPLETE;
+ ima->gpuflag |= IMA_GPU_MIPMAP_COMPLETE;
}
else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -527,42 +468,11 @@ void GPU_create_gl_tex(
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
if (GPU_get_mipmap() && mipmap) {
- if (GTS.gpu_mipmap) {
- glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
- }
- else {
- if (!ibuf) {
- if (use_high_bit_depth) {
- ibuf = IMB_allocFromBuffer(NULL, frect, tpx, tpy);
- }
- else {
- ibuf = IMB_allocFromBuffer(rect, NULL, tpx, tpy);
- }
- }
-
- IMB_makemipmap(ibuf, true);
-
- for (int i = 1; i < ibuf->miptot; i++) {
- ImBuf *mip = ibuf->mipmap[i - 1];
- void **mip_cube_map = gpu_gen_cube_map(
- mip->rect, mip->rect_float,
- mip->x, mip->y, use_high_bit_depth);
- int mipw = mip->x / 3, miph = mip->y / 2;
-
- if (mip_cube_map) {
- for (int j = 0; j < 6; j++) {
- glTexImage2D(
- GL_TEXTURE_CUBE_MAP_POSITIVE_X + j, i,
- informat, mipw, miph, 0, GL_RGBA, type, mip_cube_map[j]);
- }
- }
- gpu_del_cube_map(mip_cube_map);
- }
- }
+ glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
if (ima)
- ima->tpageflag |= IMA_MIPMAP_COMPLETE;
+ ima->gpuflag |= IMA_GPU_MIPMAP_COMPLETE;
}
else {
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -687,9 +597,9 @@ void GPU_paint_set_mipmap(Main *bmain, bool mipmap)
GTS.texpaint = !mipmap;
if (mipmap) {
- for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
if (BKE_image_has_opengl_texture(ima)) {
- if (ima->tpageflag & IMA_MIPMAP_COMPLETE) {
+ if (ima->gpuflag & IMA_GPU_MIPMAP_COMPLETE) {
if (ima->gputexture[TEXTARGET_TEXTURE_2D]) {
GPU_texture_bind(ima->gputexture[TEXTARGET_TEXTURE_2D], 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
@@ -701,12 +611,12 @@ void GPU_paint_set_mipmap(Main *bmain, bool mipmap)
GPU_free_image(ima);
}
else
- ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
+ ima->gpuflag &= ~IMA_GPU_MIPMAP_COMPLETE;
}
}
else {
- for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
if (BKE_image_has_opengl_texture(ima)) {
if (ima->gputexture[TEXTARGET_TEXTURE_2D]) {
GPU_texture_bind(ima->gputexture[TEXTARGET_TEXTURE_2D], 0);
@@ -716,7 +626,7 @@ void GPU_paint_set_mipmap(Main *bmain, bool mipmap)
}
}
else
- ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
+ ima->gpuflag &= ~IMA_GPU_MIPMAP_COMPLETE;
}
}
}
@@ -784,7 +694,7 @@ static bool gpu_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x,
glGenerateMipmap(GL_TEXTURE_2D);
}
else {
- ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
+ ima->gpuflag &= ~IMA_GPU_MIPMAP_COMPLETE;
}
GPU_texture_unbind(ima->gputexture[TEXTARGET_TEXTURE_2D]);
@@ -799,8 +709,7 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
{
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
- if ((!GTS.gpu_mipmap && GPU_get_mipmap()) ||
- (ima->gputexture[TEXTARGET_TEXTURE_2D] == NULL) ||
+ if ((ima->gputexture[TEXTARGET_TEXTURE_2D] == NULL) ||
(ibuf == NULL) ||
(w == 0) || (h == 0))
{
@@ -815,7 +724,7 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
/* if color correction is needed, we must update the part that needs updating. */
if (ibuf->rect_float) {
float *buffer = MEM_mallocN(w * h * sizeof(float) * 4, "temp_texpaint_float_buf");
- bool is_data = (ima->tpageflag & IMA_GLBIND_IS_DATA) != 0;
+ bool is_data = (ima->gpuflag & IMA_GPU_IS_DATA) != 0;
IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h, is_data);
if (gpu_check_scaled_image(ibuf, ima, buffer, x, y, w, h)) {
@@ -829,13 +738,11 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
MEM_freeN(buffer);
- /* we have already accounted for the case where GTS.gpu_mipmap is false
- * so we will be using GPU mipmap generation here */
if (GPU_get_mipmap()) {
glGenerateMipmap(GL_TEXTURE_2D);
}
else {
- ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
+ ima->gpuflag &= ~IMA_GPU_MIPMAP_COMPLETE;
}
GPU_texture_unbind(ima->gputexture[TEXTARGET_TEXTURE_2D]);
@@ -872,7 +779,7 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
glGenerateMipmap(GL_TEXTURE_2D);
}
else {
- ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
+ ima->gpuflag &= ~IMA_GPU_MIPMAP_COMPLETE;
}
GPU_texture_unbind(ima->gputexture[TEXTARGET_TEXTURE_2D]);
@@ -1001,7 +908,7 @@ static GPUTexture *create_density_texture(SmokeDomainSettings *sds, int highres)
int cell_count = (highres) ? smoke_turbulence_get_cells(sds->wt) : sds->total_cells;
const bool has_color = (highres) ? smoke_turbulence_has_colors(sds->wt) : smoke_has_colors(sds->fluid);
int *dim = (highres) ? sds->res_wt : sds->res;
- GPUTextureFormat format = (has_color) ? GPU_RGBA8 : GPU_R8;
+ eGPUTextureFormat format = (has_color) ? GPU_RGBA8 : GPU_R8;
if (has_color) {
data = MEM_callocN(sizeof(float) * cell_count * 4, "smokeColorTexture");
@@ -1212,7 +1119,7 @@ void GPU_free_unused_buffers(Main *bmain)
Image *ima = node->link;
/* check in case it was freed in the meantime */
- if (bmain && BLI_findindex(&bmain->image, ima) != -1)
+ if (bmain && BLI_findindex(&bmain->images, ima) != -1)
GPU_free_image(ima);
}
@@ -1222,13 +1129,8 @@ void GPU_free_unused_buffers(Main *bmain)
BLI_thread_unlock(LOCK_OPENGL);
}
-void GPU_free_image(Image *ima)
+static void gpu_free_image_immediate(Image *ima)
{
- if (!BLI_thread_is_main()) {
- gpu_queue_image_for_free(ima);
- return;
- }
-
for (int i = 0; i < TEXTARGET_COUNT; i++) {
/* free glsl image binding */
if (ima->gputexture[i]) {
@@ -1237,13 +1139,23 @@ void GPU_free_image(Image *ima)
}
}
- ima->tpageflag &= ~(IMA_MIPMAP_COMPLETE | IMA_GLBIND_IS_DATA);
+ ima->gpuflag &= ~(IMA_GPU_MIPMAP_COMPLETE | IMA_GPU_IS_DATA);
+}
+
+void GPU_free_image(Image *ima)
+{
+ if (!BLI_thread_is_main()) {
+ gpu_queue_image_for_free(ima);
+ return;
+ }
+
+ gpu_free_image_immediate(ima);
}
void GPU_free_images(Main *bmain)
{
if (bmain) {
- for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
GPU_free_image(ima);
}
}
@@ -1253,7 +1165,7 @@ void GPU_free_images(Main *bmain)
void GPU_free_images_anim(Main *bmain)
{
if (bmain) {
- for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
+ for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
if (BKE_image_is_animated(ima)) {
GPU_free_image(ima);
}
@@ -1280,7 +1192,7 @@ void GPU_free_images_old(Main *bmain)
lasttime = ctime;
- Image *ima = bmain->image.first;
+ Image *ima = bmain->images.first;
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
@@ -1509,7 +1421,7 @@ void GPU_select_to_index_array(uint *col, const uint size)
#define STATE_STACK_DEPTH 16
typedef struct {
- eGPUAttribMask mask;
+ eGPUAttrMask mask;
/* GL_ENABLE_BIT */
uint is_blend : 1;
@@ -1542,19 +1454,19 @@ typedef struct {
/* GL_VIEWPORT_BIT */
int viewport[4];
double near_far[2];
-} GPUAttribValues;
+} GPUAttrValues;
typedef struct {
- GPUAttribValues attrib_stack[STATE_STACK_DEPTH];
+ GPUAttrValues attr_stack[STATE_STACK_DEPTH];
uint top;
-} GPUAttribStack;
+} GPUAttrStack;
-static GPUAttribStack state = {
- .top = 0
+static GPUAttrStack state = {
+ .top = 0,
};
-#define AttribStack state
-#define Attrib state.attrib_stack[state.top]
+#define AttrStack state
+#define Attr state.attr_stack[state.top]
/**
* Replacement for glPush/PopAttributes
@@ -1562,54 +1474,54 @@ static GPUAttribStack state = {
* We don't need to cover all the options of legacy OpenGL
* but simply the ones used by Blender.
*/
-void gpuPushAttrib(eGPUAttribMask mask)
+void gpuPushAttr(eGPUAttrMask mask)
{
- Attrib.mask = mask;
+ Attr.mask = mask;
if ((mask & GPU_DEPTH_BUFFER_BIT) != 0) {
- Attrib.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
- glGetIntegerv(GL_DEPTH_FUNC, &Attrib.depth_func);
- glGetDoublev(GL_DEPTH_CLEAR_VALUE, &Attrib.depth_clear_value);
- glGetBooleanv(GL_DEPTH_WRITEMASK, (GLboolean *)&Attrib.depth_write_mask);
+ Attr.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
+ glGetIntegerv(GL_DEPTH_FUNC, &Attr.depth_func);
+ glGetDoublev(GL_DEPTH_CLEAR_VALUE, &Attr.depth_clear_value);
+ glGetBooleanv(GL_DEPTH_WRITEMASK, (GLboolean *)&Attr.depth_write_mask);
}
if ((mask & GPU_ENABLE_BIT) != 0) {
- Attrib.is_blend = glIsEnabled(GL_BLEND);
+ Attr.is_blend = glIsEnabled(GL_BLEND);
for (int i = 0; i < 6; i++) {
- Attrib.is_clip_plane[i] = glIsEnabled(GL_CLIP_PLANE0 + i);
+ Attr.is_clip_plane[i] = glIsEnabled(GL_CLIP_PLANE0 + i);
}
- Attrib.is_cull_face = glIsEnabled(GL_CULL_FACE);
- Attrib.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
- Attrib.is_dither = glIsEnabled(GL_DITHER);
- Attrib.is_line_smooth = glIsEnabled(GL_LINE_SMOOTH);
- Attrib.is_color_logic_op = glIsEnabled(GL_COLOR_LOGIC_OP);
- Attrib.is_multisample = glIsEnabled(GL_MULTISAMPLE);
- Attrib.is_polygon_offset_line = glIsEnabled(GL_POLYGON_OFFSET_LINE);
- Attrib.is_polygon_offset_fill = glIsEnabled(GL_POLYGON_OFFSET_FILL);
- Attrib.is_polygon_smooth = glIsEnabled(GL_POLYGON_SMOOTH);
- Attrib.is_sample_alpha_to_coverage = glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE);
- Attrib.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
- Attrib.is_stencil_test = glIsEnabled(GL_STENCIL_TEST);
+ Attr.is_cull_face = glIsEnabled(GL_CULL_FACE);
+ Attr.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
+ Attr.is_dither = glIsEnabled(GL_DITHER);
+ Attr.is_line_smooth = glIsEnabled(GL_LINE_SMOOTH);
+ Attr.is_color_logic_op = glIsEnabled(GL_COLOR_LOGIC_OP);
+ Attr.is_multisample = glIsEnabled(GL_MULTISAMPLE);
+ Attr.is_polygon_offset_line = glIsEnabled(GL_POLYGON_OFFSET_LINE);
+ Attr.is_polygon_offset_fill = glIsEnabled(GL_POLYGON_OFFSET_FILL);
+ Attr.is_polygon_smooth = glIsEnabled(GL_POLYGON_SMOOTH);
+ Attr.is_sample_alpha_to_coverage = glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ Attr.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
+ Attr.is_stencil_test = glIsEnabled(GL_STENCIL_TEST);
}
if ((mask & GPU_SCISSOR_BIT) != 0) {
- Attrib.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
- glGetIntegerv(GL_SCISSOR_BOX, (GLint *)&Attrib.scissor_box);
+ Attr.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
+ glGetIntegerv(GL_SCISSOR_BOX, (GLint *)&Attr.scissor_box);
}
if ((mask & GPU_VIEWPORT_BIT) != 0) {
- glGetDoublev(GL_DEPTH_RANGE, (GLdouble *)&Attrib.near_far);
- glGetIntegerv(GL_VIEWPORT, (GLint *)&Attrib.viewport);
+ glGetDoublev(GL_DEPTH_RANGE, (GLdouble *)&Attr.near_far);
+ glGetIntegerv(GL_VIEWPORT, (GLint *)&Attr.viewport);
}
if ((mask & GPU_BLEND_BIT) != 0) {
- Attrib.is_blend = glIsEnabled(GL_BLEND);
+ Attr.is_blend = glIsEnabled(GL_BLEND);
}
- BLI_assert(AttribStack.top < STATE_STACK_DEPTH);
- AttribStack.top++;
+ BLI_assert(AttrStack.top < STATE_STACK_DEPTH);
+ AttrStack.top++;
}
static void restore_mask(GLenum cap, const bool value)
@@ -1622,57 +1534,57 @@ static void restore_mask(GLenum cap, const bool value)
}
}
-void gpuPopAttrib(void)
+void gpuPopAttr(void)
{
- BLI_assert(AttribStack.top > 0);
- AttribStack.top--;
+ BLI_assert(AttrStack.top > 0);
+ AttrStack.top--;
- GLint mask = Attrib.mask;
+ GLint mask = Attr.mask;
if ((mask & GPU_DEPTH_BUFFER_BIT) != 0) {
- restore_mask(GL_DEPTH_TEST, Attrib.is_depth_test);
- glDepthFunc(Attrib.depth_func);
- glClearDepth(Attrib.depth_clear_value);
- glDepthMask(Attrib.depth_write_mask);
+ restore_mask(GL_DEPTH_TEST, Attr.is_depth_test);
+ glDepthFunc(Attr.depth_func);
+ glClearDepth(Attr.depth_clear_value);
+ glDepthMask(Attr.depth_write_mask);
}
if ((mask & GPU_ENABLE_BIT) != 0) {
- restore_mask(GL_BLEND, Attrib.is_blend);
+ restore_mask(GL_BLEND, Attr.is_blend);
for (int i = 0; i < 6; i++) {
- restore_mask(GL_CLIP_PLANE0 + i, Attrib.is_clip_plane[i]);
+ restore_mask(GL_CLIP_PLANE0 + i, Attr.is_clip_plane[i]);
}
- restore_mask(GL_CULL_FACE, Attrib.is_cull_face);
- restore_mask(GL_DEPTH_TEST, Attrib.is_depth_test);
- restore_mask(GL_DITHER, Attrib.is_dither);
- restore_mask(GL_LINE_SMOOTH, Attrib.is_line_smooth);
- restore_mask(GL_COLOR_LOGIC_OP, Attrib.is_color_logic_op);
- restore_mask(GL_MULTISAMPLE, Attrib.is_multisample);
- restore_mask(GL_POLYGON_OFFSET_LINE, Attrib.is_polygon_offset_line);
- restore_mask(GL_POLYGON_OFFSET_FILL, Attrib.is_polygon_offset_fill);
- restore_mask(GL_POLYGON_SMOOTH, Attrib.is_polygon_smooth);
- restore_mask(GL_SAMPLE_ALPHA_TO_COVERAGE, Attrib.is_sample_alpha_to_coverage);
- restore_mask(GL_SCISSOR_TEST, Attrib.is_scissor_test);
- restore_mask(GL_STENCIL_TEST, Attrib.is_stencil_test);
+ restore_mask(GL_CULL_FACE, Attr.is_cull_face);
+ restore_mask(GL_DEPTH_TEST, Attr.is_depth_test);
+ restore_mask(GL_DITHER, Attr.is_dither);
+ restore_mask(GL_LINE_SMOOTH, Attr.is_line_smooth);
+ restore_mask(GL_COLOR_LOGIC_OP, Attr.is_color_logic_op);
+ restore_mask(GL_MULTISAMPLE, Attr.is_multisample);
+ restore_mask(GL_POLYGON_OFFSET_LINE, Attr.is_polygon_offset_line);
+ restore_mask(GL_POLYGON_OFFSET_FILL, Attr.is_polygon_offset_fill);
+ restore_mask(GL_POLYGON_SMOOTH, Attr.is_polygon_smooth);
+ restore_mask(GL_SAMPLE_ALPHA_TO_COVERAGE, Attr.is_sample_alpha_to_coverage);
+ restore_mask(GL_SCISSOR_TEST, Attr.is_scissor_test);
+ restore_mask(GL_STENCIL_TEST, Attr.is_stencil_test);
}
if ((mask & GPU_VIEWPORT_BIT) != 0) {
- glViewport(Attrib.viewport[0], Attrib.viewport[1], Attrib.viewport[2], Attrib.viewport[3]);
- glDepthRange(Attrib.near_far[0], Attrib.near_far[1]);
+ glViewport(Attr.viewport[0], Attr.viewport[1], Attr.viewport[2], Attr.viewport[3]);
+ glDepthRange(Attr.near_far[0], Attr.near_far[1]);
}
if ((mask & GPU_SCISSOR_BIT) != 0) {
- restore_mask(GL_SCISSOR_TEST, Attrib.is_scissor_test);
- glScissor(Attrib.scissor_box[0], Attrib.scissor_box[1], Attrib.scissor_box[2], Attrib.scissor_box[3]);
+ restore_mask(GL_SCISSOR_TEST, Attr.is_scissor_test);
+ glScissor(Attr.scissor_box[0], Attr.scissor_box[1], Attr.scissor_box[2], Attr.scissor_box[3]);
}
if ((mask & GPU_BLEND_BIT) != 0) {
- restore_mask(GL_BLEND, Attrib.is_blend);
+ restore_mask(GL_BLEND, Attr.is_blend);
}
}
-#undef Attrib
-#undef AttribStack
+#undef Attr
+#undef AttrStack
/** \} */
diff --git a/source/blender/gpu/intern/gpu_element.c b/source/blender/gpu/intern/gpu_element.c
index ef98e4a328b..2c80fff75a6 100644
--- a/source/blender/gpu/intern/gpu_element.c
+++ b/source/blender/gpu/intern/gpu_element.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_element.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU element list (AKA index buffer)
*/
@@ -44,7 +38,7 @@ static GLenum convert_index_type_to_gl(GPUIndexBufType type)
static const GLenum table[] = {
[GPU_INDEX_U8] = GL_UNSIGNED_BYTE, /* GL has this, Vulkan does not */
[GPU_INDEX_U16] = GL_UNSIGNED_SHORT,
- [GPU_INDEX_U32] = GL_UNSIGNED_INT
+ [GPU_INDEX_U32] = GL_UNSIGNED_INT,
};
return table[type];
}
@@ -55,7 +49,7 @@ uint GPU_indexbuf_size_get(const GPUIndexBuf *elem)
static const uint table[] = {
[GPU_INDEX_U8] = sizeof(GLubyte), /* GL has this, Vulkan does not */
[GPU_INDEX_U16] = sizeof(GLushort),
- [GPU_INDEX_U32] = sizeof(GLuint)
+ [GPU_INDEX_U32] = sizeof(GLuint),
};
return elem->index_len * table[elem->index_type];
#else
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 9c00afbca9f..6fb40b06177 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_extensions.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Wrap OpenGL features such as textures, shaders and GLSL
* with checks for drivers and GPU support.
@@ -77,9 +69,9 @@ static struct GPUGlobal {
GLint maxubobinds;
int colordepth;
int samples_color_texture_max;
- GPUDeviceType device;
- GPUOSType os;
- GPUDriverType driver;
+ eGPUDeviceType device;
+ eGPUOSType os;
+ eGPUDriverType driver;
float line_width_range[2];
/* workaround for different calculation of dfdy factors on GPUs. Some GPUs/drivers
* calculate dfdy in shader differently when drawing to an offscreen buffer. First
@@ -132,7 +124,7 @@ static void gpu_detect_mip_render_workaround(void)
/* GPU Types */
-bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
+bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver)
{
return (GG.device & device) && (GG.os & os) && (GG.driver & driver);
}
@@ -219,6 +211,12 @@ bool GPU_unused_fb_slot_workaround(void)
return GG.unused_fb_slot_workaround;
}
+bool GPU_crappy_amd_driver(void)
+{
+ /* Currently are the same drivers with the `unused_fb_slot` problem. */
+ return GPU_unused_fb_slot_workaround();
+}
+
void gpu_extensions_init(void)
{
/* during 2.8 development each platform has its own OpenGL minimum requirements
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 915a7669326..1c631a23cea 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,18 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup gpu
*/
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
-#include "BKE_global.h"
#include "GPU_batch.h"
#include "GPU_draw.h"
@@ -88,7 +82,7 @@ static GLenum convert_attachment_type_to_gl(GPUAttachmentType type)
[GPU_FB_COLOR_ATTACHMENT1] = GL_COLOR_ATTACHMENT1,
[GPU_FB_COLOR_ATTACHMENT2] = GL_COLOR_ATTACHMENT2,
[GPU_FB_COLOR_ATTACHMENT3] = GL_COLOR_ATTACHMENT3,
- [GPU_FB_COLOR_ATTACHMENT4] = GL_COLOR_ATTACHMENT4
+ [GPU_FB_COLOR_ATTACHMENT4] = GL_COLOR_ATTACHMENT4,
};
return table[type];
}
@@ -108,7 +102,7 @@ static GPUAttachmentType attachment_type_from_tex(GPUTexture *tex, int slot)
}
}
-static GLenum convert_buffer_bits_to_gl(GPUFrameBufferBits bits)
+static GLenum convert_buffer_bits_to_gl(eGPUFrameBufferBits bits)
{
GLbitfield mask = 0;
mask |= (bits & GPU_DEPTH_BIT) ? GL_DEPTH_BUFFER_BIT : 0;
@@ -576,7 +570,7 @@ void GPU_framebuffer_viewport_set(GPUFrameBuffer *fb, int x, int y, int w, int h
}
void GPU_framebuffer_clear(
- GPUFrameBuffer *fb, GPUFrameBufferBits buffers,
+ GPUFrameBuffer *fb, eGPUFrameBufferBits buffers,
const float clear_col[4], float clear_depth, uint clear_stencil)
{
CHECK_FRAMEBUFFER_IS_BOUND(fb);
@@ -630,7 +624,7 @@ void GPU_framebuffer_read_color(
void GPU_framebuffer_blit(
GPUFrameBuffer *fb_read, int read_slot,
GPUFrameBuffer *fb_write, int write_slot,
- GPUFrameBufferBits blit_buffers)
+ eGPUFrameBufferBits blit_buffers)
{
BLI_assert(blit_buffers != 0);
@@ -792,6 +786,11 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, bool dept
ofs = MEM_callocN(sizeof(GPUOffScreen), "GPUOffScreen");
+ /* Sometimes areas can have 0 height or width and this will
+ * create a 1D texture which we don't want. */
+ height = max_ii(1, height);
+ width = max_ii(1, width);
+
ofs->color = GPU_texture_create_2D_multisample(
width, height,
(high_bitdepth) ? GPU_RGBA16F : GPU_RGBA8, NULL, samples, err_out);
@@ -805,7 +804,7 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, bool dept
return NULL;
}
- gpuPushAttrib(GPU_VIEWPORT_BIT);
+ gpuPushAttr(GPU_VIEWPORT_BIT);
GPU_framebuffer_ensure_config(&ofs->fb, {
GPU_ATTACHMENT_TEXTURE(ofs->depth),
@@ -815,13 +814,13 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, bool dept
/* check validity at the very end! */
if (!GPU_framebuffer_check_valid(ofs->fb, err_out)) {
GPU_offscreen_free(ofs);
- gpuPopAttrib();
+ gpuPopAttr();
return NULL;
}
GPU_framebuffer_restore();
- gpuPopAttrib();
+ gpuPopAttr();
return ofs;
}
@@ -841,7 +840,7 @@ void GPU_offscreen_free(GPUOffScreen *ofs)
void GPU_offscreen_bind(GPUOffScreen *ofs, bool save)
{
if (save) {
- gpuPushAttrib(GPU_SCISSOR_BIT | GPU_VIEWPORT_BIT);
+ gpuPushAttr(GPU_SCISSOR_BIT | GPU_VIEWPORT_BIT);
GPUFrameBuffer *fb = GPU_framebuffer_active_get();
gpuPushFrameBuffer(fb);
}
@@ -854,7 +853,7 @@ void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore)
GPUFrameBuffer *fb = NULL;
if (restore) {
- gpuPopAttrib();
+ gpuPopAttr();
fb = gpuPopFrameBuffer();
}
@@ -967,7 +966,7 @@ void GPU_clear_color(float red, float green, float blue, float alpha)
glClearColor(red, green, blue, alpha);
}
-void GPU_clear(GPUFrameBufferBits flags)
+void GPU_clear(eGPUFrameBufferBits flags)
{
glClear(convert_buffer_bits_to_gl(flags));
}
diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c
index a71ba68821b..f24aa454560 100644
--- a/source/blender/gpu/intern/gpu_immediate.c
+++ b/source/blender/gpu/intern/gpu_immediate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_immediate.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU immediate mode work-alike
*/
@@ -66,15 +60,15 @@ typedef struct {
/* current vertex */
uint vertex_idx;
GLubyte *vertex_data;
- uint16_t unassigned_attrib_bits; /* which attributes of current vertex have not been given values? */
+ uint16_t unassigned_attr_bits; /* which attributes of current vertex have not been given values? */
GLuint vbo_id;
GLuint vao_id;
GLuint bound_program;
const GPUShaderInterface *shader_interface;
- GPUAttrBinding attrib_binding;
- uint16_t prev_enabled_attrib_bits; /* <-- only affects this VAO, so we're ok */
+ GPUAttrBinding attr_binding;
+ uint16_t prev_enabled_attr_bits; /* <-- only affects this VAO, so we're ok */
} Immediate;
/* size of internal buffer -- make this adjustable? */
@@ -121,7 +115,7 @@ void immDeactivate(void)
#endif
GPU_vao_free(imm.vao_id, imm.context);
imm.vao_id = 0;
- imm.prev_enabled_attrib_bits = 0;
+ imm.prev_enabled_attr_bits = 0;
}
void immDestroy(void)
@@ -150,11 +144,11 @@ void immBindProgram(GLuint program, const GPUShaderInterface *shaderface)
VertexFormat_pack(&imm.vertex_format);
glUseProgram(program);
- get_attrib_locations(&imm.vertex_format, &imm.attrib_binding, shaderface);
+ get_attr_locations(&imm.vertex_format, &imm.attr_binding, shaderface);
GPU_matrix_bind(shaderface);
}
-void immBindBuiltinProgram(GPUBuiltinShader shader_id)
+void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
{
GPUShader *shader = GPU_shader_get_builtin_shader(shader_id);
immBindProgram(shader->program, shader->interface);
@@ -210,7 +204,7 @@ void immBegin(GPUPrimType prim_type, uint vertex_len)
imm.prim_type = prim_type;
imm.vertex_len = vertex_len;
imm.vertex_idx = 0;
- imm.unassigned_attrib_bits = imm.attrib_binding.enabled_bits;
+ imm.unassigned_attr_bits = imm.attr_binding.enabled_bits;
/* how many bytes do we need for this draw call? */
const uint bytes_needed = vertex_buffer_size(&imm.vertex_format, vertex_len);
@@ -270,7 +264,7 @@ GPUBatch *immBeginBatch(GPUPrimType prim_type, uint vertex_len)
imm.prim_type = prim_type;
imm.vertex_len = vertex_len;
imm.vertex_idx = 0;
- imm.unassigned_attrib_bits = imm.attrib_binding.enabled_bits;
+ imm.unassigned_attr_bits = imm.attr_binding.enabled_bits;
GPUVertBuf *verts = GPU_vertbuf_create_with_format(&imm.vertex_format);
GPU_vertbuf_data_alloc(verts, vertex_len);
@@ -295,11 +289,11 @@ static void immDrawSetup(void)
/* set up VAO -- can be done during Begin or End really */
glBindVertexArray(imm.vao_id);
- /* enable/disable vertex attribs as needed */
- if (imm.attrib_binding.enabled_bits != imm.prev_enabled_attrib_bits) {
+ /* Enable/Disable vertex attributes as needed. */
+ if (imm.attr_binding.enabled_bits != imm.prev_enabled_attr_bits) {
for (uint loc = 0; loc < GPU_VERT_ATTR_MAX_LEN; ++loc) {
- bool is_enabled = imm.attrib_binding.enabled_bits & (1 << loc);
- bool was_enabled = imm.prev_enabled_attrib_bits & (1 << loc);
+ bool is_enabled = imm.attr_binding.enabled_bits & (1 << loc);
+ bool was_enabled = imm.prev_enabled_attr_bits & (1 << loc);
if (is_enabled && !was_enabled) {
glEnableVertexAttribArray(loc);
@@ -309,18 +303,18 @@ static void immDrawSetup(void)
}
}
- imm.prev_enabled_attrib_bits = imm.attrib_binding.enabled_bits;
+ imm.prev_enabled_attr_bits = imm.attr_binding.enabled_bits;
}
const uint stride = imm.vertex_format.stride;
for (uint a_idx = 0; a_idx < imm.vertex_format.attr_len; ++a_idx) {
- const GPUVertAttr *a = imm.vertex_format.attribs + a_idx;
+ const GPUVertAttr *a = &imm.vertex_format.attrs[a_idx];
const uint offset = imm.buffer_offset + a->offset;
const GLvoid *pointer = (const GLubyte *)0 + offset;
- const uint loc = read_attrib_location(&imm.attrib_binding, a_idx);
+ const uint loc = read_attr_location(&imm.attr_binding, a_idx);
switch (a->fetch_mode) {
case GPU_FETCH_FLOAT:
@@ -400,29 +394,29 @@ void immEnd(void)
imm.strict_vertex_len = true;
}
-static void setAttribValueBit(uint attrib_id)
+static void setAttrValueBit(uint attr_id)
{
- uint16_t mask = 1 << attrib_id;
+ uint16_t mask = 1 << attr_id;
#if TRUST_NO_ONE
- assert(imm.unassigned_attrib_bits & mask); /* not already set */
+ assert(imm.unassigned_attr_bits & mask); /* not already set */
#endif
- imm.unassigned_attrib_bits &= ~mask;
+ imm.unassigned_attr_bits &= ~mask;
}
/* --- generic attribute functions --- */
-void immAttr1f(uint attrib_id, float x)
+void immAttr1f(uint attr_id, float x)
{
- GPUVertAttr *attr = imm.vertex_format.attribs + attrib_id;
+ GPUVertAttr *attr = &imm.vertex_format.attrs[attr_id];
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attr_len);
+ assert(attr_id < imm.vertex_format.attr_len);
assert(attr->comp_type == GPU_COMP_F32);
assert(attr->comp_len == 1);
assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
- setAttribValueBit(attrib_id);
+ setAttrValueBit(attr_id);
float *data = (float *)(imm.vertex_data + attr->offset);
/* printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm.buffer_data, data); */
@@ -430,17 +424,17 @@ void immAttr1f(uint attrib_id, float x)
data[0] = x;
}
-void immAttr2f(uint attrib_id, float x, float y)
+void immAttr2f(uint attr_id, float x, float y)
{
- GPUVertAttr *attr = imm.vertex_format.attribs + attrib_id;
+ GPUVertAttr *attr = &imm.vertex_format.attrs[attr_id];
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attr_len);
+ assert(attr_id < imm.vertex_format.attr_len);
assert(attr->comp_type == GPU_COMP_F32);
assert(attr->comp_len == 2);
assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
- setAttribValueBit(attrib_id);
+ setAttrValueBit(attr_id);
float *data = (float *)(imm.vertex_data + attr->offset);
/* printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm.buffer_data, data); */
@@ -449,17 +443,17 @@ void immAttr2f(uint attrib_id, float x, float y)
data[1] = y;
}
-void immAttr3f(uint attrib_id, float x, float y, float z)
+void immAttr3f(uint attr_id, float x, float y, float z)
{
- GPUVertAttr *attr = imm.vertex_format.attribs + attrib_id;
+ GPUVertAttr *attr = &imm.vertex_format.attrs[attr_id];
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attr_len);
+ assert(attr_id < imm.vertex_format.attr_len);
assert(attr->comp_type == GPU_COMP_F32);
assert(attr->comp_len == 3);
assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
- setAttribValueBit(attrib_id);
+ setAttrValueBit(attr_id);
float *data = (float *)(imm.vertex_data + attr->offset);
/* printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm.buffer_data, data); */
@@ -469,17 +463,17 @@ void immAttr3f(uint attrib_id, float x, float y, float z)
data[2] = z;
}
-void immAttr4f(uint attrib_id, float x, float y, float z, float w)
+void immAttr4f(uint attr_id, float x, float y, float z, float w)
{
- GPUVertAttr *attr = imm.vertex_format.attribs + attrib_id;
+ GPUVertAttr *attr = &imm.vertex_format.attrs[attr_id];
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attr_len);
+ assert(attr_id < imm.vertex_format.attr_len);
assert(attr->comp_type == GPU_COMP_F32);
assert(attr->comp_len == 4);
assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
- setAttribValueBit(attrib_id);
+ setAttrValueBit(attr_id);
float *data = (float *)(imm.vertex_data + attr->offset);
/* printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm.buffer_data, data); */
@@ -490,34 +484,34 @@ void immAttr4f(uint attrib_id, float x, float y, float z, float w)
data[3] = w;
}
-void immAttr1u(uint attrib_id, uint x)
+void immAttr1u(uint attr_id, uint x)
{
- GPUVertAttr *attr = imm.vertex_format.attribs + attrib_id;
+ GPUVertAttr *attr = &imm.vertex_format.attrs[attr_id];
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attr_len);
+ assert(attr_id < imm.vertex_format.attr_len);
assert(attr->comp_type == GPU_COMP_U32);
assert(attr->comp_len == 1);
assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
- setAttribValueBit(attrib_id);
+ setAttrValueBit(attr_id);
uint *data = (uint *)(imm.vertex_data + attr->offset);
data[0] = x;
}
-void immAttr2i(uint attrib_id, int x, int y)
+void immAttr2i(uint attr_id, int x, int y)
{
- GPUVertAttr *attr = imm.vertex_format.attribs + attrib_id;
+ GPUVertAttr *attr = &imm.vertex_format.attrs[attr_id];
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attr_len);
+ assert(attr_id < imm.vertex_format.attr_len);
assert(attr->comp_type == GPU_COMP_I32);
assert(attr->comp_len == 2);
assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
- setAttribValueBit(attrib_id);
+ setAttrValueBit(attr_id);
int *data = (int *)(imm.vertex_data + attr->offset);
@@ -525,17 +519,17 @@ void immAttr2i(uint attrib_id, int x, int y)
data[1] = y;
}
-void immAttr2s(uint attrib_id, short x, short y)
+void immAttr2s(uint attr_id, short x, short y)
{
- GPUVertAttr *attr = imm.vertex_format.attribs + attrib_id;
+ GPUVertAttr *attr = &imm.vertex_format.attrs[attr_id];
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attr_len);
+ assert(attr_id < imm.vertex_format.attr_len);
assert(attr->comp_type == GPU_COMP_I16);
assert(attr->comp_len == 2);
assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
- setAttribValueBit(attrib_id);
+ setAttrValueBit(attr_id);
short *data = (short *)(imm.vertex_data + attr->offset);
@@ -543,32 +537,32 @@ void immAttr2s(uint attrib_id, short x, short y)
data[1] = y;
}
-void immAttr2fv(uint attrib_id, const float data[2])
+void immAttr2fv(uint attr_id, const float data[2])
{
- immAttr2f(attrib_id, data[0], data[1]);
+ immAttr2f(attr_id, data[0], data[1]);
}
-void immAttr3fv(uint attrib_id, const float data[3])
+void immAttr3fv(uint attr_id, const float data[3])
{
- immAttr3f(attrib_id, data[0], data[1], data[2]);
+ immAttr3f(attr_id, data[0], data[1], data[2]);
}
-void immAttr4fv(uint attrib_id, const float data[4])
+void immAttr4fv(uint attr_id, const float data[4])
{
- immAttr4f(attrib_id, data[0], data[1], data[2], data[3]);
+ immAttr4f(attr_id, data[0], data[1], data[2], data[3]);
}
-void immAttr3ub(uint attrib_id, uchar r, uchar g, uchar b)
+void immAttr3ub(uint attr_id, uchar r, uchar g, uchar b)
{
- GPUVertAttr *attr = imm.vertex_format.attribs + attrib_id;
+ GPUVertAttr *attr = &imm.vertex_format.attrs[attr_id];
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attr_len);
+ assert(attr_id < imm.vertex_format.attr_len);
assert(attr->comp_type == GPU_COMP_U8);
assert(attr->comp_len == 3);
assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
- setAttribValueBit(attrib_id);
+ setAttrValueBit(attr_id);
GLubyte *data = imm.vertex_data + attr->offset;
/* printf("%s %td %p\n", __FUNCTION__, data - imm.buffer_data, data); */
@@ -578,17 +572,17 @@ void immAttr3ub(uint attrib_id, uchar r, uchar g, uchar b)
data[2] = b;
}
-void immAttr4ub(uint attrib_id, uchar r, uchar g, uchar b, uchar a)
+void immAttr4ub(uint attr_id, uchar r, uchar g, uchar b, uchar a)
{
- GPUVertAttr *attr = imm.vertex_format.attribs + attrib_id;
+ GPUVertAttr *attr = &imm.vertex_format.attrs[attr_id];
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attr_len);
+ assert(attr_id < imm.vertex_format.attr_len);
assert(attr->comp_type == GPU_COMP_U8);
assert(attr->comp_len == 4);
assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
- setAttribValueBit(attrib_id);
+ setAttrValueBit(attr_id);
GLubyte *data = imm.vertex_data + attr->offset;
/* printf("%s %td %p\n", __FUNCTION__, data - imm.buffer_data, data); */
@@ -599,24 +593,24 @@ void immAttr4ub(uint attrib_id, uchar r, uchar g, uchar b, uchar a)
data[3] = a;
}
-void immAttr3ubv(uint attrib_id, const uchar data[3])
+void immAttr3ubv(uint attr_id, const uchar data[3])
{
- immAttr3ub(attrib_id, data[0], data[1], data[2]);
+ immAttr3ub(attr_id, data[0], data[1], data[2]);
}
-void immAttr4ubv(uint attrib_id, const uchar data[4])
+void immAttr4ubv(uint attr_id, const uchar data[4])
{
- immAttr4ub(attrib_id, data[0], data[1], data[2], data[3]);
+ immAttr4ub(attr_id, data[0], data[1], data[2], data[3]);
}
-void immAttrSkip(uint attrib_id)
+void immAttrSkip(uint attr_id)
{
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attr_len);
+ assert(attr_id < imm.vertex_format.attr_len);
assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
#endif
- setAttribValueBit(attrib_id);
+ setAttrValueBit(attr_id);
}
static void immEndVertex(void) /* and move on to the next vertex */
@@ -626,15 +620,15 @@ static void immEndVertex(void) /* and move on to the next vertex */
assert(imm.vertex_idx < imm.vertex_len);
#endif
- /* have all attribs been assigned values?
- * if not, copy value from previous vertex */
- if (imm.unassigned_attrib_bits) {
+ /* Have all attributes been assigned values?
+ * If not, copy value from previous vertex. */
+ if (imm.unassigned_attr_bits) {
#if TRUST_NO_ONE
- assert(imm.vertex_idx > 0); /* first vertex must have all attribs specified */
+ assert(imm.vertex_idx > 0); /* first vertex must have all attributes specified */
#endif
for (uint a_idx = 0; a_idx < imm.vertex_format.attr_len; ++a_idx) {
- if ((imm.unassigned_attrib_bits >> a_idx) & 1) {
- const GPUVertAttr *a = imm.vertex_format.attribs + a_idx;
+ if ((imm.unassigned_attr_bits >> a_idx) & 1) {
+ const GPUVertAttr *a = &imm.vertex_format.attrs[a_idx];
/* printf("copying %s from vertex %u to %u\n", a->name, imm.vertex_idx - 1, imm.vertex_idx); */
@@ -647,54 +641,54 @@ static void immEndVertex(void) /* and move on to the next vertex */
imm.vertex_idx++;
imm.vertex_data += imm.vertex_format.stride;
- imm.unassigned_attrib_bits = imm.attrib_binding.enabled_bits;
+ imm.unassigned_attr_bits = imm.attr_binding.enabled_bits;
}
-void immVertex2f(uint attrib_id, float x, float y)
+void immVertex2f(uint attr_id, float x, float y)
{
- immAttr2f(attrib_id, x, y);
+ immAttr2f(attr_id, x, y);
immEndVertex();
}
-void immVertex3f(uint attrib_id, float x, float y, float z)
+void immVertex3f(uint attr_id, float x, float y, float z)
{
- immAttr3f(attrib_id, x, y, z);
+ immAttr3f(attr_id, x, y, z);
immEndVertex();
}
-void immVertex4f(uint attrib_id, float x, float y, float z, float w)
+void immVertex4f(uint attr_id, float x, float y, float z, float w)
{
- immAttr4f(attrib_id, x, y, z, w);
+ immAttr4f(attr_id, x, y, z, w);
immEndVertex();
}
-void immVertex2i(uint attrib_id, int x, int y)
+void immVertex2i(uint attr_id, int x, int y)
{
- immAttr2i(attrib_id, x, y);
+ immAttr2i(attr_id, x, y);
immEndVertex();
}
-void immVertex2s(uint attrib_id, short x, short y)
+void immVertex2s(uint attr_id, short x, short y)
{
- immAttr2s(attrib_id, x, y);
+ immAttr2s(attr_id, x, y);
immEndVertex();
}
-void immVertex2fv(uint attrib_id, const float data[2])
+void immVertex2fv(uint attr_id, const float data[2])
{
- immAttr2f(attrib_id, data[0], data[1]);
+ immAttr2f(attr_id, data[0], data[1]);
immEndVertex();
}
-void immVertex3fv(uint attrib_id, const float data[3])
+void immVertex3fv(uint attr_id, const float data[3])
{
- immAttr3f(attrib_id, data[0], data[1], data[2]);
+ immAttr3f(attr_id, data[0], data[1], data[2]);
immEndVertex();
}
-void immVertex2iv(uint attrib_id, const int data[2])
+void immVertex2iv(uint attr_id, const int data[2])
{
- immAttr2i(attrib_id, data[0], data[1]);
+ immAttr2i(attr_id, data[0], data[1]);
immEndVertex();
}
@@ -703,16 +697,16 @@ void immVertex2iv(uint attrib_id, const int data[2])
#if 0
# if TRUST_NO_ONE
-# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); assert(uniform);
+# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform_ensure(imm.shader_interface, name); assert(uniform);
# else
-# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name);
+# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform_ensure(imm.shader_interface, name);
# endif
#else
/* NOTE: It is possible to have uniform fully optimized out from the shader.
* In this case we can't assert failure or allow NULL-pointer dereference.
* TODO(sergey): How can we detect existing-but-optimized-out uniform but still
* catch typos in uniform names passed to immUniform*() functions? */
-# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform(imm.shader_interface, name); if (uniform == NULL) return;
+# define GET_UNIFORM const GPUShaderInput* uniform = GPU_shaderinterface_uniform_ensure(imm.shader_interface, name); if (uniform == NULL) return;
#endif
void immUniform1f(const char *name, float x)
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c
index a9e98314014..6d546c1b5c5 100644
--- a/source/blender/gpu/intern/gpu_immediate_util.c
+++ b/source/blender/gpu/intern/gpu_immediate_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_immediate_util.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU immediate mode drawing utilities
*/
@@ -136,7 +132,7 @@ void immRecti_fast_with_color(uint pos, uint col, int x1, int y1, int x2, int y2
void immRecti_complete(int x1, int y1, int x2, int y2, const float color[4])
{
GPUVertFormat *format = immVertexFormat();
- uint pos = add_attrib(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
+ uint pos = add_attr(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(color);
immRecti(pos, x1, y1, x2, y2);
diff --git a/source/blender/gpu/intern/gpu_init_exit.c b/source/blender/gpu/intern/gpu_init_exit.c
index d21acb188d9..b1bdfccacff 100644
--- a/source/blender/gpu/intern/gpu_init_exit.c
+++ b/source/blender/gpu/intern/gpu_init_exit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jason Wilkins
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/gpu/intern/gpu_init_exit.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#include "BLI_sys_types.h"
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index e4a55943999..302b3b4ef1c 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_material.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Manages materials, lights and textures.
*/
@@ -67,10 +59,10 @@ typedef struct GPUColorBandBuilder {
} GPUColorBandBuilder;
struct GPUMaterial {
- Scene *scene; /* DEPRECATED was only useful for lamps */
+ Scene *scene; /* DEPRECATED was only useful for lights. */
Material *ma;
- GPUMaterialStatus status;
+ eGPUMaterialStatus status;
const void *engine_type; /* attached engine type */
int options; /* to identify shader variations (shadow, probe, world background...) */
@@ -82,7 +74,7 @@ struct GPUMaterial {
/* for binding the material */
GPUPass *pass;
ListBase inputs; /* GPUInput */
- GPUVertexAttribs attribs;
+ GPUVertAttrLayers attrs;
int builtins;
int alpha, obcolalpha;
int dynproperty;
@@ -133,7 +125,7 @@ struct GPUMaterial {
enum {
GPU_DOMAIN_SURFACE = (1 << 0),
GPU_DOMAIN_VOLUME = (1 << 1),
- GPU_DOMAIN_SSS = (1 << 2)
+ GPU_DOMAIN_SSS = (1 << 2),
};
/* Functions */
@@ -215,7 +207,7 @@ void GPU_material_free(ListBase *gpumaterial)
BLI_freelistN(gpumaterial);
}
-GPUBuiltin GPU_get_material_builtins(GPUMaterial *material)
+eGPUBuiltin GPU_get_material_builtins(GPUMaterial *material)
{
return material->builtins;
}
@@ -569,9 +561,9 @@ struct GPUUniformBuffer *GPU_material_create_sss_profile_ubo(void)
#undef SSS_EXPONENT
#undef SSS_SAMPLES
-void GPU_material_vertex_attributes(GPUMaterial *material, GPUVertexAttribs *attribs)
+void GPU_material_vertex_attrs(GPUMaterial *material, GPUVertAttrLayers *r_attrs)
{
- *attribs = material->attribs;
+ *r_attrs = material->attrs;
}
void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link)
@@ -586,7 +578,7 @@ void gpu_material_add_node(GPUMaterial *material, GPUNode *node)
}
/* Return true if the material compilation has not yet begin or begin. */
-GPUMaterialStatus GPU_material_status(GPUMaterial *mat)
+eGPUMaterialStatus GPU_material_status(GPUMaterial *mat)
{
return mat->status;
}
@@ -611,12 +603,12 @@ bool GPU_material_use_domain_volume(GPUMaterial *mat)
return (mat->domain & GPU_DOMAIN_VOLUME);
}
-void GPU_material_flag_set(GPUMaterial *mat, GPUMatFlag flag)
+void GPU_material_flag_set(GPUMaterial *mat, eGPUMatFlag flag)
{
mat->flag |= flag;
}
-bool GPU_material_flag_get(GPUMaterial *mat, GPUMatFlag flag)
+bool GPU_material_flag_get(GPUMaterial *mat, eGPUMatFlag flag)
{
return (mat->flag & flag);
}
@@ -676,15 +668,15 @@ GPUMaterial *GPU_material_from_nodetree(
}
if (mat->outlink) {
- /* Prune the unused nodes and extract attribs before compiling so the
+ /* Prune the unused nodes and extract attributes before compiling so the
* generated VBOs are ready to accept the future shader. */
GPU_nodes_prune(&mat->nodes, mat->outlink);
- GPU_nodes_get_vertex_attributes(&mat->nodes, &mat->attribs);
+ GPU_nodes_get_vertex_attrs(&mat->nodes, &mat->attrs);
/* Create source code and search pass cache for an already compiled version. */
mat->pass = GPU_generate_pass(
mat,
mat->outlink,
- &mat->attribs,
+ &mat->attrs,
&mat->nodes,
&mat->builtins,
vert_code,
@@ -762,10 +754,10 @@ void GPU_materials_free(Main *bmain)
World *wo;
extern Material defmaterial;
- for (ma = bmain->mat.first; ma; ma = ma->id.next)
+ for (ma = bmain->materials.first; ma; ma = ma->id.next)
GPU_material_free(&ma->gpumaterial);
- for (wo = bmain->world.first; wo; wo = wo->id.next)
+ for (wo = bmain->worlds.first; wo; wo = wo->id.next)
GPU_material_free(&wo->gpumaterial);
GPU_material_free(&defmaterial.gpumaterial);
diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c
index 5ab8086397c..b5bee35350e 100644
--- a/source/blender/gpu/intern/gpu_matrix.c
+++ b/source/blender/gpu/intern/gpu_matrix.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Alexandr Kuznetsov, Jason Wilkins, Mike Erwin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/gpu/intern/gpu_matrix.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#include "GPU_shader_interface.h"
@@ -75,7 +67,7 @@ typedef struct {
static MatrixState state = {
.model_view_stack = {{MATRIX_4X4_IDENTITY}, 0},
.projection_stack = {{MATRIX_4X4_IDENTITY}, 0},
- .dirty = true
+ .dirty = true,
};
#undef MATRIX_4X4_IDENTITY
@@ -629,7 +621,6 @@ bool GPU_matrix_dirty_get(void)
/* -------------------------------------------------------------------- */
-
/** \name Python API Helpers
* \{ */
BLI_STATIC_ASSERT(GPU_PY_MATRIX_STACK_LEN + 1 == MATRIX_STACK_DEPTH, "define mismatch");
diff --git a/source/blender/gpu/intern/gpu_primitive.c b/source/blender/gpu/intern/gpu_primitive.c
index 189d17f2dd2..e59e4a953d7 100644
--- a/source/blender/gpu/intern/gpu_primitive.c
+++ b/source/blender/gpu/intern/gpu_primitive.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_primitive.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU geometric primitives
*/
@@ -47,7 +41,7 @@ GPUPrimClass GPU_primtype_class(GPUPrimType prim_type)
[GPU_PRIM_LINE_STRIP_ADJ] = GPU_PRIM_CLASS_LINE,
[GPU_PRIM_TRIS_ADJ] = GPU_PRIM_CLASS_SURFACE,
- [GPU_PRIM_NONE] = GPU_PRIM_CLASS_NONE
+ [GPU_PRIM_NONE] = GPU_PRIM_CLASS_NONE,
};
return classes[prim_type];
diff --git a/source/blender/gpu/intern/gpu_primitive_private.h b/source/blender/gpu/intern/gpu_primitive_private.h
index d057f29fdc5..abefa6abd20 100644
--- a/source/blender/gpu/intern/gpu_primitive_private.h
+++ b/source/blender/gpu/intern/gpu_primitive_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_primitive_private.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU geometric primitives
*/
diff --git a/source/blender/gpu/intern/gpu_private.h b/source/blender/gpu/intern/gpu_private.h
index df55f7922b3..a92ff7287f6 100644
--- a/source/blender/gpu/intern/gpu_private.h
+++ b/source/blender/gpu/intern/gpu_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gpu_private.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_PRIVATE_H__
diff --git a/source/blender/gpu/intern/gpu_select.c b/source/blender/gpu/intern/gpu_select.c
index 1c0e7ed4c1c..adc5f5a9864 100644
--- a/source/blender/gpu/intern/gpu_select.c
+++ b/source/blender/gpu/intern/gpu_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Antony Riakiotakis.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_select.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
- * Interface for accessing gpu-related methods for selection. The semantics will be
- * similar to glRenderMode(GL_SELECT) since the goal is to maintain compatibility.
+ * Interface for accessing gpu-related methods for selection. The semantics are
+ * similar to glRenderMode(GL_SELECT) from older OpenGL versions.
*/
#include <stdlib.h>
@@ -45,21 +39,17 @@
/* Internal algorithm used */
enum {
- /** GL_SELECT, legacy OpenGL selection */
- ALGO_GL_LEGACY = 1,
/** glBegin/EndQuery(GL_SAMPLES_PASSED... ), `gpu_select_query.c`
* Only sets 4th component (ID) correctly. */
- ALGO_GL_QUERY = 2,
+ ALGO_GL_QUERY = 1,
/** Read depth buffer for every drawing pass and extract depths, `gpu_select_pick.c`
* Only sets 4th component (ID) correctly. */
- ALGO_GL_PICK = 3,
+ ALGO_GL_PICK = 2,
};
typedef struct GPUSelectState {
/* To ignore selection id calls when not initialized */
bool select_is_active;
- /* flag to cache user preference for occlusion based selection */
- bool use_gpu_select;
/* mode of operation */
char mode;
/* internal algorithm for selection */
@@ -82,29 +72,16 @@ void GPU_select_begin(uint *buffer, uint bufsize, const rcti *input, char mode,
}
g_select_state.select_is_active = true;
- g_select_state.use_gpu_select = GPU_select_query_check_active();
g_select_state.mode = mode;
if (ELEM(g_select_state.mode, GPU_SELECT_PICK_ALL, GPU_SELECT_PICK_NEAREST)) {
g_select_state.algorithm = ALGO_GL_PICK;
}
- else if (!g_select_state.use_gpu_select) {
- g_select_state.algorithm = ALGO_GL_LEGACY;
- }
else {
g_select_state.algorithm = ALGO_GL_QUERY;
}
switch (g_select_state.algorithm) {
- case ALGO_GL_LEGACY:
- {
- g_select_state.use_cache = false;
- glSelectBuffer(bufsize, (GLuint *)buffer);
- glRenderMode(GL_SELECT);
- glInitNames();
- glPushName(-1);
- break;
- }
case ALGO_GL_QUERY:
{
g_select_state.use_cache = false;
@@ -133,11 +110,6 @@ bool GPU_select_load_id(uint id)
return true;
switch (g_select_state.algorithm) {
- case ALGO_GL_LEGACY:
- {
- glLoadName(id);
- return true;
- }
case ALGO_GL_QUERY:
{
return gpu_select_query_load_id(id);
@@ -159,12 +131,6 @@ uint GPU_select_end(void)
uint hits = 0;
switch (g_select_state.algorithm) {
- case ALGO_GL_LEGACY:
- {
- glPopName();
- hits = glRenderMode(GL_RENDER);
- break;
- }
case ALGO_GL_QUERY:
{
hits = gpu_select_query_end();
@@ -182,14 +148,6 @@ uint GPU_select_end(void)
return hits;
}
-/**
- * has user activated?
- */
-bool GPU_select_query_check_active(void)
-{
- return ELEM(U.gpu_select_method, USER_SELECT_USE_OCCLUSION_QUERY, USER_SELECT_AUTO);
-}
-
/* ----------------------------------------------------------------------------
* Caching
*
diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c
index 9b64d48fe50..22388deccdb 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2017 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_select_pick.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Custom select code for picking small regions (not efficient for large regions).
* `gpu_select_pick_*` API.
@@ -41,7 +37,6 @@
#include "BLI_rect.h"
#include "BLI_listbase.h"
-#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "gpu_select_private.h"
@@ -318,7 +313,7 @@ void gpu_select_pick_begin(
/* Restrict OpenGL operations for when we don't have cache */
if (ps->is_cached == false) {
- gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_VIEWPORT_BIT);
+ gpuPushAttr(GPU_DEPTH_BUFFER_BIT | GPU_VIEWPORT_BIT);
/* disable writing to the framebuffer */
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
@@ -540,7 +535,7 @@ uint gpu_select_pick_end(void)
/* force finishing last pass */
gpu_select_pick_load_id(ps->gl.prev_id);
}
- gpuPopAttrib();
+ gpuPopAttr();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
diff --git a/source/blender/gpu/intern/gpu_select_private.h b/source/blender/gpu/intern/gpu_select_private.h
index d6c02d5b3ea..b89d6fd244a 100644
--- a/source/blender/gpu/intern/gpu_select_private.h
+++ b/source/blender/gpu/intern/gpu_select_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Antony Riakiotakis.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_select_private.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Selection implementations.
*/
diff --git a/source/blender/gpu/intern/gpu_select_sample_query.c b/source/blender/gpu/intern/gpu_select_sample_query.c
index 4520025ea7f..60f42b31725 100644
--- a/source/blender/gpu/intern/gpu_select_sample_query.c
+++ b/source/blender/gpu/intern/gpu_select_sample_query.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Antony Riakiotakis.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_select_sample_query.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* Interface for accessing gpu-related methods for selection. The semantics will be
* similar to glRenderMode(GL_SELECT) since the goal is to maintain compatibility.
@@ -98,7 +92,7 @@ void gpu_select_query_begin(
g_query_state.id = MEM_mallocN(g_query_state.num_of_queries * sizeof(*g_query_state.id), "gpu selection ids");
glGenQueries(g_query_state.num_of_queries, g_query_state.queries);
- gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_VIEWPORT_BIT | GPU_SCISSOR_BIT);
+ gpuPushAttr(GPU_DEPTH_BUFFER_BIT | GPU_VIEWPORT_BIT | GPU_SCISSOR_BIT);
/* disable writing to the framebuffer */
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
@@ -219,7 +213,7 @@ uint gpu_select_query_end(void)
glDeleteQueries(g_query_state.num_of_queries, g_query_state.queries);
MEM_freeN(g_query_state.queries);
MEM_freeN(g_query_state.id);
- gpuPopAttrib();
+ gpuPopAttr();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
return hits;
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 00646223793..e9ca3257a8f 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_shader.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#include "MEM_guardedalloc.h"
@@ -36,6 +28,7 @@
#include "BLI_math_vector.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
+#include "BLI_string_utils.h"
#include "BKE_appdir.h"
#include "BKE_global.h"
@@ -146,6 +139,9 @@ extern char datatoc_gpu_shader_2D_edituvs_edges_vert_glsl[];
extern char datatoc_gpu_shader_2D_edituvs_faces_vert_glsl[];
extern char datatoc_gpu_shader_2D_edituvs_stretch_vert_glsl[];
+extern char datatoc_gpu_shader_3D_selection_id_vert_glsl[];
+extern char datatoc_gpu_shader_selection_id_frag_glsl[];
+
extern char datatoc_gpu_shader_2D_line_dashed_uniform_color_vert_glsl[];
extern char datatoc_gpu_shader_2D_line_dashed_frag_glsl[];
extern char datatoc_gpu_shader_2D_line_dashed_geom_glsl[];
@@ -174,9 +170,21 @@ extern char datatoc_gpu_shader_gpencil_stroke_geom_glsl[];
extern char datatoc_gpu_shader_gpencil_fill_vert_glsl[];
extern char datatoc_gpu_shader_gpencil_fill_frag_glsl[];
+extern char datatoc_gpu_shader_cfg_world_clip_lib_glsl[];
+
+const struct GPUShaderConfigData GPU_shader_cfg_data[GPU_SHADER_CFG_LEN] = {
+ [GPU_SHADER_CFG_DEFAULT] = {
+ .lib = "",
+ .def = "",
+ },
+ [GPU_SHADER_CFG_CLIPPED] = {
+ .lib = datatoc_gpu_shader_cfg_world_clip_lib_glsl,
+ .def = "#define USE_WORLD_CLIP_PLANES\n",
+ },
+};
/* cache of built-in shaders (each is created on first use) */
-static GPUShader *builtin_shaders[GPU_NUM_BUILTIN_SHADERS] = { NULL };
+static GPUShader *builtin_shaders[GPU_SHADER_CFG_LEN][GPU_SHADER_BUILTIN_LEN] = {NULL};
#ifndef NDEBUG
static uint g_shaderid = 0;
@@ -184,8 +192,11 @@ static uint g_shaderid = 0;
typedef struct {
const char *vert;
+ /** Optional. */
+ const char *geom;
const char *frag;
- const char *geom; /* geometry stage runs between vert & frag, but is less common, so it goes last */
+ /** Optional. */
+ const char *defs;
} GPUShaderStages;
static void shader_print_errors(const char *task, const char *log, const char **code, int totcode)
@@ -336,7 +347,7 @@ GPUShader *GPU_shader_create_ex(
const char *geocode,
const char *libcode,
const char *defines,
- const GPUShaderTFBType tf_type,
+ const eGPUShaderTFBType tf_type,
const char **tf_names,
const int tf_count,
const char *shname)
@@ -358,7 +369,7 @@ GPUShader *GPU_shader_create_ex(
#endif
/* At least a vertex shader and a fragment shader are required. */
- // BLI_assert((fragcode != NULL) && (vertexcode != NULL));
+ BLI_assert((fragcode != NULL) && (vertexcode != NULL));
if (vertexcode)
shader->vertex = glCreateShader(GL_VERTEX_SHADER);
@@ -383,11 +394,12 @@ GPUShader *GPU_shader_create_ex(
gpu_shader_standard_extensions(standard_extensions);
if (vertexcode) {
- const char *source[5];
+ const char *source[6];
/* custom limit, may be too small, beware */
int num_source = 0;
source[num_source++] = gpu_shader_version();
+ source[num_source++] = "#define GPU_VERTEX_SHADER\n";
source[num_source++] = standard_extensions;
source[num_source++] = standard_defines;
@@ -416,6 +428,7 @@ GPUShader *GPU_shader_create_ex(
int num_source = 0;
source[num_source++] = gpu_shader_version();
+ source[num_source++] = "#define GPU_FRAGMENT_SHADER\n";
source[num_source++] = standard_extensions;
source[num_source++] = standard_defines;
@@ -445,6 +458,7 @@ GPUShader *GPU_shader_create_ex(
int num_source = 0;
source[num_source++] = gpu_shader_version();
+ source[num_source++] = "#define GPU_GEOMETRY_SHADER\n";
source[num_source++] = standard_extensions;
source[num_source++] = standard_defines;
@@ -499,6 +513,73 @@ GPUShader *GPU_shader_create_ex(
#undef DEBUG_SHADER_VERTEX
#undef DEBUG_SHADER_NONE
+static const char *string_join_array_maybe_alloc(const char **str_arr, bool *r_is_alloc)
+{
+ bool is_alloc = false;
+ if (str_arr == NULL) {
+ *r_is_alloc = false;
+ return NULL;
+ }
+ /* Skip empty strings (avoid alloc if we can). */
+ while (str_arr[0] && str_arr[0][0] == '\0') {
+ str_arr++;
+ }
+ int i;
+ for (i = 0; str_arr[i]; i++) {
+ if (i != 0 && str_arr[i][0] != '\0') {
+ is_alloc = true;
+ }
+ }
+ *r_is_alloc = is_alloc;
+ if (is_alloc) {
+ return BLI_string_join_arrayN(str_arr, i);
+ }
+ else {
+ return str_arr[0];
+ }
+}
+
+/**
+ * Use via #GPU_shader_create_from_arrays macro (avoids passing in param).
+ *
+ * Similar to #DRW_shader_create_with_lib with the ability to include libs for each type of shader.
+ *
+ * It has the advantage that each item can be conditionally included
+ * without having to build the string inline, then free it.
+ *
+ * \param params: NULL terminated arrays of strings.
+ *
+ * Example:
+ * \code{.c}
+ * sh = GPU_shader_create_from_arrays({
+ * .vert = (const char *[]){shader_lib_glsl, shader_vert_glsl, NULL},
+ * .geom = (const char *[]){shader_geom_glsl, NULL},
+ * .frag = (const char *[]){shader_frag_glsl, NULL},
+ * .defs = (const char *[]){"#define DEFINE\n", test ? "#define OTHER_DEFINE\n" : "", NULL},
+ * });
+ * \endcode
+ */
+struct GPUShader *GPU_shader_create_from_arrays_impl(
+ const struct GPU_ShaderCreateFromArray_Params *params)
+{
+ struct { const char *str; bool is_alloc;} str_dst[4] = {0};
+ const char **str_src[4] = {params->vert, params->frag, params->geom, params->defs};
+
+ for (int i = 0; i < ARRAY_SIZE(str_src); i++) {
+ str_dst[i].str = string_join_array_maybe_alloc(str_src[i], &str_dst[i].is_alloc);
+ }
+
+ GPUShader *sh = GPU_shader_create(
+ str_dst[0].str, str_dst[1].str, str_dst[2].str, NULL, str_dst[3].str, __func__);
+
+ for (int i = 0; i < ARRAY_SIZE(str_dst); i++) {
+ if (str_dst[i].is_alloc) {
+ MEM_freeN((void *)str_dst[i].str);
+ }
+ }
+ return sh;
+}
+
void GPU_shader_bind(GPUShader *shader)
{
BLI_assert(shader && shader->program);
@@ -560,6 +641,13 @@ int GPU_shader_get_uniform(GPUShader *shader, const char *name)
{
BLI_assert(shader && shader->program);
const GPUShaderInput *uniform = GPU_shaderinterface_uniform(shader->interface, name);
+ return uniform ? uniform->location : -2;
+}
+
+int GPU_shader_get_uniform_ensure(GPUShader *shader, const char *name)
+{
+ BLI_assert(shader && shader->program);
+ const GPUShaderInput *uniform = GPU_shaderinterface_uniform_ensure(shader->interface, name);
return uniform ? uniform->location : -1;
}
@@ -573,7 +661,6 @@ int GPU_shader_get_builtin_uniform(GPUShader *shader, int builtin)
int GPU_shader_get_uniform_block(GPUShader *shader, const char *name)
{
BLI_assert(shader && shader->program);
-
const GPUShaderInput *ubo = GPU_shaderinterface_ubo(shader->interface, name);
return ubo ? ubo->location : -1;
}
@@ -659,414 +746,537 @@ void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUText
int GPU_shader_get_attribute(GPUShader *shader, const char *name)
{
BLI_assert(shader && shader->program);
- const GPUShaderInput *attrib = GPU_shaderinterface_attr(shader->interface, name);
- return attrib ? attrib->location : -1;
+ const GPUShaderInput *attr = GPU_shaderinterface_attr(shader->interface, name);
+ return attr ? attr->location : -1;
}
-static const GPUShaderStages builtin_shader_stages[GPU_NUM_BUILTIN_SHADERS] = {
- [GPU_SHADER_TEXT] =
- { datatoc_gpu_shader_text_vert_glsl,
- datatoc_gpu_shader_text_frag_glsl,
- datatoc_gpu_shader_text_geom_glsl },
- [GPU_SHADER_TEXT_SIMPLE] =
- { datatoc_gpu_shader_text_simple_vert_glsl,
- datatoc_gpu_shader_text_frag_glsl,
- datatoc_gpu_shader_text_simple_geom_glsl },
- [GPU_SHADER_KEYFRAME_DIAMOND] =
- { datatoc_gpu_shader_keyframe_diamond_vert_glsl,
- datatoc_gpu_shader_keyframe_diamond_frag_glsl },
- [GPU_SHADER_EDGES_FRONT_BACK_PERSP] =
- { datatoc_gpu_shader_edges_front_back_persp_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl, /* this version is */
- datatoc_gpu_shader_edges_front_back_persp_geom_glsl }, /* magical but slooow */
- [GPU_SHADER_EDGES_FRONT_BACK_ORTHO] =
- { datatoc_gpu_shader_edges_front_back_ortho_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl },
- [GPU_SHADER_EDGES_OVERLAY_SIMPLE] =
- { datatoc_gpu_shader_3D_vert_glsl,
- datatoc_gpu_shader_edges_overlay_frag_glsl,
- datatoc_gpu_shader_edges_overlay_simple_geom_glsl },
- [GPU_SHADER_EDGES_OVERLAY] =
- { datatoc_gpu_shader_edges_overlay_vert_glsl,
- datatoc_gpu_shader_edges_overlay_frag_glsl,
- datatoc_gpu_shader_edges_overlay_geom_glsl },
- [GPU_SHADER_SIMPLE_LIGHTING] =
- { datatoc_gpu_shader_3D_normal_vert_glsl,
- datatoc_gpu_shader_simple_lighting_frag_glsl },
+static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = {
+ [GPU_SHADER_TEXT] = {
+ .vert = datatoc_gpu_shader_text_vert_glsl,
+ .geom = datatoc_gpu_shader_text_geom_glsl,
+ .frag = datatoc_gpu_shader_text_frag_glsl,
+ },
+ [GPU_SHADER_TEXT_SIMPLE] = {
+ .vert = datatoc_gpu_shader_text_simple_vert_glsl,
+ .geom = datatoc_gpu_shader_text_simple_geom_glsl,
+ .frag = datatoc_gpu_shader_text_frag_glsl,
+ },
+ [GPU_SHADER_KEYFRAME_DIAMOND] = {
+ .vert = datatoc_gpu_shader_keyframe_diamond_vert_glsl,
+ .frag = datatoc_gpu_shader_keyframe_diamond_frag_glsl,
+ },
+ /* This version is magical but slow! */
+ [GPU_SHADER_EDGES_FRONT_BACK_PERSP] = {
+ .vert = datatoc_gpu_shader_edges_front_back_persp_vert_glsl,
+ .geom = datatoc_gpu_shader_edges_front_back_persp_geom_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+ [GPU_SHADER_EDGES_FRONT_BACK_ORTHO] = {
+ .vert = datatoc_gpu_shader_edges_front_back_ortho_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+ [GPU_SHADER_EDGES_OVERLAY_SIMPLE] = {
+ .vert = datatoc_gpu_shader_3D_vert_glsl,
+ .geom = datatoc_gpu_shader_edges_overlay_simple_geom_glsl,
+ .frag = datatoc_gpu_shader_edges_overlay_frag_glsl,
+ },
+ [GPU_SHADER_EDGES_OVERLAY] = {
+ .vert = datatoc_gpu_shader_edges_overlay_vert_glsl,
+ .geom = datatoc_gpu_shader_edges_overlay_geom_glsl,
+ .frag = datatoc_gpu_shader_edges_overlay_frag_glsl,
+ },
+ [GPU_SHADER_SIMPLE_LIGHTING] = {
+ .vert = datatoc_gpu_shader_3D_normal_vert_glsl,
+ .frag = datatoc_gpu_shader_simple_lighting_frag_glsl,
+ },
/* Use 'USE_FLAT_NORMAL' to make flat shader from smooth */
- [GPU_SHADER_SIMPLE_LIGHTING_FLAT_COLOR] =
- { datatoc_gpu_shader_3D_normal_smooth_color_vert_glsl,
- datatoc_gpu_shader_simple_lighting_smooth_color_frag_glsl },
- [GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR] =
- { datatoc_gpu_shader_3D_normal_smooth_color_vert_glsl,
- datatoc_gpu_shader_simple_lighting_smooth_color_frag_glsl },
- [GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR_ALPHA] =
- { datatoc_gpu_shader_3D_normal_smooth_color_vert_glsl,
- datatoc_gpu_shader_simple_lighting_smooth_color_alpha_frag_glsl },
-
- [GPU_SHADER_2D_IMAGE_MASK_UNIFORM_COLOR] =
- { datatoc_gpu_shader_3D_image_vert_glsl,
- datatoc_gpu_shader_image_mask_uniform_color_frag_glsl },
- [GPU_SHADER_3D_IMAGE_MODULATE_ALPHA] =
- { datatoc_gpu_shader_3D_image_vert_glsl,
- datatoc_gpu_shader_image_modulate_alpha_frag_glsl },
- [GPU_SHADER_3D_IMAGE_DEPTH] =
- { datatoc_gpu_shader_3D_image_vert_glsl,
- datatoc_gpu_shader_image_depth_linear_frag_glsl },
- [GPU_SHADER_3D_IMAGE_DEPTH_COPY] =
- { datatoc_gpu_shader_3D_image_vert_glsl,
- datatoc_gpu_shader_image_depth_copy_frag_glsl },
- [GPU_SHADER_2D_IMAGE_MULTISAMPLE_2] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_image_multisample_resolve_frag_glsl },
- [GPU_SHADER_2D_IMAGE_MULTISAMPLE_4] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_image_multisample_resolve_frag_glsl },
- [GPU_SHADER_2D_IMAGE_MULTISAMPLE_8] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_image_multisample_resolve_frag_glsl },
- [GPU_SHADER_2D_IMAGE_MULTISAMPLE_16] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_image_multisample_resolve_frag_glsl },
- [GPU_SHADER_2D_IMAGE_MULTISAMPLE_2_DEPTH_TEST] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_image_multisample_resolve_frag_glsl },
- [GPU_SHADER_2D_IMAGE_MULTISAMPLE_4_DEPTH_TEST] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_image_multisample_resolve_frag_glsl },
- [GPU_SHADER_2D_IMAGE_MULTISAMPLE_8_DEPTH_TEST] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_image_multisample_resolve_frag_glsl },
- [GPU_SHADER_2D_IMAGE_MULTISAMPLE_16_DEPTH_TEST] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_image_multisample_resolve_frag_glsl },
-
- [GPU_SHADER_2D_IMAGE_INTERLACE] =
- { datatoc_gpu_shader_2D_image_vert_glsl,
- datatoc_gpu_shader_image_interlace_frag_glsl },
- [GPU_SHADER_2D_CHECKER] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_checker_frag_glsl },
-
- [GPU_SHADER_2D_DIAG_STRIPES] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_diag_stripes_frag_glsl },
-
- [GPU_SHADER_2D_UNIFORM_COLOR] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_uniform_color_frag_glsl },
- [GPU_SHADER_2D_FLAT_COLOR] =
- { datatoc_gpu_shader_2D_flat_color_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl },
- [GPU_SHADER_2D_SMOOTH_COLOR] =
- { datatoc_gpu_shader_2D_smooth_color_vert_glsl,
- datatoc_gpu_shader_2D_smooth_color_frag_glsl },
- [GPU_SHADER_2D_SMOOTH_COLOR_DITHER] =
- { datatoc_gpu_shader_2D_smooth_color_vert_glsl,
- datatoc_gpu_shader_2D_smooth_color_dithered_frag_glsl },
- [GPU_SHADER_2D_IMAGE_LINEAR_TO_SRGB] =
- { datatoc_gpu_shader_2D_image_vert_glsl,
- datatoc_gpu_shader_image_linear_frag_glsl },
- [GPU_SHADER_2D_IMAGE] =
- { datatoc_gpu_shader_2D_image_vert_glsl,
- datatoc_gpu_shader_image_frag_glsl },
- [GPU_SHADER_2D_IMAGE_COLOR] =
- { datatoc_gpu_shader_2D_image_vert_glsl,
- datatoc_gpu_shader_image_color_frag_glsl },
- [GPU_SHADER_2D_IMAGE_DESATURATE_COLOR] =
- { datatoc_gpu_shader_2D_image_vert_glsl,
- datatoc_gpu_shader_image_desaturate_frag_glsl },
- [GPU_SHADER_2D_IMAGE_ALPHA_COLOR] =
- { datatoc_gpu_shader_2D_image_vert_glsl,
- datatoc_gpu_shader_image_alpha_color_frag_glsl },
- [GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR] =
- { datatoc_gpu_shader_2D_image_vert_glsl,
- datatoc_gpu_shader_image_shuffle_color_frag_glsl },
- [GPU_SHADER_2D_IMAGE_RECT_COLOR] =
- { datatoc_gpu_shader_2D_image_rect_vert_glsl,
- datatoc_gpu_shader_image_color_frag_glsl },
- [GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR] =
- { datatoc_gpu_shader_2D_image_multi_rect_vert_glsl,
- datatoc_gpu_shader_image_varying_color_frag_glsl },
-
- [GPU_SHADER_3D_UNIFORM_COLOR] =
- { datatoc_gpu_shader_3D_vert_glsl,
- datatoc_gpu_shader_uniform_color_frag_glsl },
- [GPU_SHADER_3D_UNIFORM_COLOR_U32] =
- { datatoc_gpu_shader_3D_vert_glsl,
- datatoc_gpu_shader_uniform_color_frag_glsl },
- [GPU_SHADER_3D_FLAT_COLOR] =
- { datatoc_gpu_shader_3D_flat_color_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl },
- [GPU_SHADER_3D_FLAT_COLOR_U32] =
- { datatoc_gpu_shader_3D_flat_color_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl },
- [GPU_SHADER_3D_SMOOTH_COLOR] =
- { datatoc_gpu_shader_3D_smooth_color_vert_glsl,
- datatoc_gpu_shader_3D_smooth_color_frag_glsl },
- [GPU_SHADER_3D_DEPTH_ONLY] =
- { datatoc_gpu_shader_3D_vert_glsl,
- datatoc_gpu_shader_depth_only_frag_glsl },
- [GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR] =
- { datatoc_gpu_shader_3D_clipped_uniform_color_vert_glsl,
- datatoc_gpu_shader_uniform_color_frag_glsl },
-
- [GPU_SHADER_3D_GROUNDPOINT] =
- { datatoc_gpu_shader_3D_groundpoint_vert_glsl,
- datatoc_gpu_shader_point_uniform_color_frag_glsl },
- [GPU_SHADER_3D_GROUNDLINE] =
- { datatoc_gpu_shader_3D_passthrough_vert_glsl,
- datatoc_gpu_shader_uniform_color_frag_glsl,
- datatoc_gpu_shader_3D_groundline_geom_glsl },
-
- [GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR] =
- { datatoc_gpu_shader_2D_line_dashed_uniform_color_vert_glsl,
- datatoc_gpu_shader_2D_line_dashed_frag_glsl,
- datatoc_gpu_shader_2D_line_dashed_geom_glsl },
- [GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR] =
- { datatoc_gpu_shader_3D_line_dashed_uniform_color_vert_glsl,
- datatoc_gpu_shader_2D_line_dashed_frag_glsl,
- datatoc_gpu_shader_2D_line_dashed_geom_glsl },
-
- [GPU_SHADER_3D_OBJECTSPACE_SIMPLE_LIGHTING_VARIYING_COLOR] =
- { datatoc_gpu_shader_instance_objectspace_variying_color_vert_glsl,
- datatoc_gpu_shader_simple_lighting_frag_glsl},
- [GPU_SHADER_3D_OBJECTSPACE_VARIYING_COLOR] =
- { datatoc_gpu_shader_instance_objectspace_variying_color_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl},
- [GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR] =
- { datatoc_gpu_shader_instance_screenspace_variying_color_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl},
- [GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED_AXIS] =
- { datatoc_gpu_shader_instance_screen_aligned_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl},
- [GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED] =
- { datatoc_gpu_shader_instance_screen_aligned_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl},
-
- [GPU_SHADER_CAMERA] =
- { datatoc_gpu_shader_instance_camera_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl},
- [GPU_SHADER_DISTANCE_LINES] =
- { datatoc_gpu_shader_instance_distance_line_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl},
-
- [GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR] =
- { datatoc_gpu_shader_2D_vert_glsl,
- datatoc_gpu_shader_point_uniform_color_frag_glsl },
- [GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR] =
- { datatoc_gpu_shader_2D_point_varying_size_varying_color_vert_glsl,
- datatoc_gpu_shader_point_varying_color_frag_glsl },
- [GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA] =
- { datatoc_gpu_shader_2D_point_uniform_size_aa_vert_glsl,
- datatoc_gpu_shader_point_uniform_color_aa_frag_glsl },
- [GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA] =
- { datatoc_gpu_shader_2D_point_uniform_size_outline_aa_vert_glsl,
- datatoc_gpu_shader_point_uniform_color_outline_aa_frag_glsl },
- [GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA] =
- { datatoc_gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert_glsl,
- datatoc_gpu_shader_point_varying_color_outline_aa_frag_glsl },
- [GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR] =
- { datatoc_gpu_shader_3D_vert_glsl,
- datatoc_gpu_shader_point_uniform_color_frag_glsl },
- [GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR] =
- { datatoc_gpu_shader_3D_point_fixed_size_varying_color_vert_glsl,
- datatoc_gpu_shader_point_varying_color_frag_glsl },
- [GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR] =
- { datatoc_gpu_shader_3D_point_varying_size_vert_glsl,
- datatoc_gpu_shader_point_uniform_color_frag_glsl },
- [GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR] =
- { datatoc_gpu_shader_3D_point_varying_size_varying_color_vert_glsl,
- datatoc_gpu_shader_point_varying_color_frag_glsl },
- [GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA] =
- { datatoc_gpu_shader_3D_point_uniform_size_aa_vert_glsl,
- datatoc_gpu_shader_point_uniform_color_aa_frag_glsl },
- [GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA] =
- { datatoc_gpu_shader_3D_point_uniform_size_outline_aa_vert_glsl,
- datatoc_gpu_shader_point_uniform_color_outline_aa_frag_glsl },
-
- [GPU_SHADER_INSTANCE_UNIFORM_COLOR] =
- { datatoc_gpu_shader_instance_vert_glsl,
- datatoc_gpu_shader_uniform_color_frag_glsl },
- [GPU_SHADER_INSTANCE_VARIYING_ID_VARIYING_SIZE] =
- { datatoc_gpu_shader_instance_variying_size_variying_id_vert_glsl,
- datatoc_gpu_shader_flat_id_frag_glsl },
- [GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE] =
- { datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl },
- [GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE] =
- { datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl },
- [GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR] =
- { datatoc_gpu_shader_instance_edges_variying_color_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl,
- datatoc_gpu_shader_instance_edges_variying_color_geom_glsl},
-
- [GPU_SHADER_2D_AREA_EDGES] =
- { datatoc_gpu_shader_2D_area_borders_vert_glsl,
- datatoc_gpu_shader_2D_area_borders_frag_glsl},
- [GPU_SHADER_2D_WIDGET_BASE] =
- { datatoc_gpu_shader_2D_widget_base_vert_glsl,
- datatoc_gpu_shader_2D_widget_base_frag_glsl},
- [GPU_SHADER_2D_WIDGET_BASE_INST] =
- { datatoc_gpu_shader_2D_widget_base_vert_glsl,
- datatoc_gpu_shader_2D_widget_base_frag_glsl},
- [GPU_SHADER_2D_WIDGET_SHADOW] =
- { datatoc_gpu_shader_2D_widget_shadow_vert_glsl,
- datatoc_gpu_shader_2D_widget_shadow_frag_glsl },
- [GPU_SHADER_2D_NODELINK] =
- { datatoc_gpu_shader_2D_nodelink_vert_glsl,
- datatoc_gpu_shader_2D_nodelink_frag_glsl },
- [GPU_SHADER_2D_NODELINK_INST] =
- { datatoc_gpu_shader_2D_nodelink_vert_glsl,
- datatoc_gpu_shader_2D_nodelink_frag_glsl },
-
- [GPU_SHADER_2D_UV_VERTS] =
- { datatoc_gpu_shader_2D_edituvs_points_vert_glsl,
- datatoc_gpu_shader_point_varying_color_varying_outline_aa_frag_glsl },
- [GPU_SHADER_2D_UV_FACEDOTS] =
- { datatoc_gpu_shader_2D_edituvs_facedots_vert_glsl,
- datatoc_gpu_shader_point_varying_color_frag_glsl },
- [GPU_SHADER_2D_UV_EDGES] =
- { datatoc_gpu_shader_2D_edituvs_edges_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl },
- [GPU_SHADER_2D_UV_EDGES_SMOOTH] =
- { datatoc_gpu_shader_2D_edituvs_edges_vert_glsl,
- datatoc_gpu_shader_2D_smooth_color_frag_glsl },
- [GPU_SHADER_2D_UV_FACES] =
- { datatoc_gpu_shader_2D_edituvs_faces_vert_glsl,
- datatoc_gpu_shader_flat_color_frag_glsl },
- [GPU_SHADER_2D_UV_FACES_STRETCH] =
- { datatoc_gpu_shader_2D_edituvs_stretch_vert_glsl,
- datatoc_gpu_shader_2D_smooth_color_frag_glsl },
-
- [GPU_SHADER_GPENCIL_STROKE] =
- { datatoc_gpu_shader_gpencil_stroke_vert_glsl,
- datatoc_gpu_shader_gpencil_stroke_frag_glsl,
- datatoc_gpu_shader_gpencil_stroke_geom_glsl },
-
- [GPU_SHADER_GPENCIL_FILL] =
- { datatoc_gpu_shader_gpencil_fill_vert_glsl,
- datatoc_gpu_shader_gpencil_fill_frag_glsl },
+ [GPU_SHADER_SIMPLE_LIGHTING_FLAT_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_normal_smooth_color_vert_glsl,
+ .frag = datatoc_gpu_shader_simple_lighting_smooth_color_frag_glsl,
+ .defs =
+ "#define USE_FLAT_NORMAL\n",
+ },
+ [GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_normal_smooth_color_vert_glsl,
+ .frag = datatoc_gpu_shader_simple_lighting_smooth_color_frag_glsl,
+ },
+ [GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR_ALPHA] = {
+ .vert = datatoc_gpu_shader_3D_normal_smooth_color_vert_glsl,
+ .frag = datatoc_gpu_shader_simple_lighting_smooth_color_alpha_frag_glsl,
+ },
+
+ [GPU_SHADER_2D_IMAGE_MASK_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_mask_uniform_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_IMAGE_MODULATE_ALPHA] = {
+ .vert = datatoc_gpu_shader_3D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_modulate_alpha_frag_glsl,
+ },
+ [GPU_SHADER_3D_IMAGE_DEPTH] = {
+ .vert = datatoc_gpu_shader_3D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_depth_linear_frag_glsl,
+ },
+ [GPU_SHADER_3D_IMAGE_DEPTH_COPY] = {
+ .vert = datatoc_gpu_shader_3D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_depth_copy_frag_glsl,
+ },
+ [GPU_SHADER_2D_IMAGE_MULTISAMPLE_2] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_image_multisample_resolve_frag_glsl,
+ .defs =
+ "#define SAMPLES 2\n",
+ },
+ [GPU_SHADER_2D_IMAGE_MULTISAMPLE_4] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_image_multisample_resolve_frag_glsl,
+ .defs =
+ "#define SAMPLES 4\n",
+ },
+ [GPU_SHADER_2D_IMAGE_MULTISAMPLE_8] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_image_multisample_resolve_frag_glsl,
+ .defs =
+ "#define SAMPLES 8\n",
+ },
+ [GPU_SHADER_2D_IMAGE_MULTISAMPLE_16] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_image_multisample_resolve_frag_glsl,
+ .defs =
+ "#define SAMPLES 16\n",
+ },
+ [GPU_SHADER_2D_IMAGE_MULTISAMPLE_2_DEPTH_TEST] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_image_multisample_resolve_frag_glsl,
+ .defs =
+ "#define SAMPLES 2\n"
+ "#define USE_DEPTH\n",
+ },
+ [GPU_SHADER_2D_IMAGE_MULTISAMPLE_4_DEPTH_TEST] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_image_multisample_resolve_frag_glsl,
+ .defs =
+ "#define SAMPLES 4\n"
+ "#define USE_DEPTH\n",
+ },
+ [GPU_SHADER_2D_IMAGE_MULTISAMPLE_8_DEPTH_TEST] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_image_multisample_resolve_frag_glsl,
+ .defs =
+ "#define SAMPLES 8\n"
+ "#define USE_DEPTH\n",
+ },
+ [GPU_SHADER_2D_IMAGE_MULTISAMPLE_16_DEPTH_TEST] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_image_multisample_resolve_frag_glsl,
+ .defs =
+ "#define SAMPLES 16\n"
+ "#define USE_DEPTH\n",
+ },
+
+ [GPU_SHADER_2D_IMAGE_INTERLACE] = {
+ .vert = datatoc_gpu_shader_2D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_interlace_frag_glsl,
+ },
+ [GPU_SHADER_2D_CHECKER] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_checker_frag_glsl,
+ },
+
+ [GPU_SHADER_2D_DIAG_STRIPES] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_diag_stripes_frag_glsl,
+ },
+
+ [GPU_SHADER_2D_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_FLAT_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_flat_color_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_SMOOTH_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_smooth_color_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_smooth_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_SMOOTH_COLOR_DITHER] = {
+ .vert = datatoc_gpu_shader_2D_smooth_color_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_smooth_color_dithered_frag_glsl,
+ },
+ [GPU_SHADER_2D_IMAGE_LINEAR_TO_SRGB] = {
+ .vert = datatoc_gpu_shader_2D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_linear_frag_glsl,
+ },
+ [GPU_SHADER_2D_IMAGE] = {
+ .vert = datatoc_gpu_shader_2D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_frag_glsl,
+ },
+ [GPU_SHADER_2D_IMAGE_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_IMAGE_DESATURATE_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_desaturate_frag_glsl,
+ },
+ [GPU_SHADER_2D_IMAGE_ALPHA_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_alpha_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_image_vert_glsl,
+ .frag = datatoc_gpu_shader_image_shuffle_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_IMAGE_RECT_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_image_rect_vert_glsl,
+ .frag = datatoc_gpu_shader_image_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_image_multi_rect_vert_glsl,
+ .frag = datatoc_gpu_shader_image_varying_color_frag_glsl,
+ },
+
+ [GPU_SHADER_3D_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_vert_glsl,
+ .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND] = {
+ .vert = datatoc_gpu_shader_3D_vert_glsl,
+ .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
+ .defs =
+ "#define USE_BACKGROUND\n",
+ },
+ [GPU_SHADER_3D_FLAT_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_flat_color_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_SMOOTH_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_smooth_color_vert_glsl,
+ .frag = datatoc_gpu_shader_3D_smooth_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_DEPTH_ONLY] = {
+ .vert = datatoc_gpu_shader_3D_vert_glsl,
+ .frag = datatoc_gpu_shader_depth_only_frag_glsl,
+ },
+ [GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_clipped_uniform_color_vert_glsl,
+ .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
+ },
+
+ [GPU_SHADER_3D_GROUNDPOINT] = {
+ .vert = datatoc_gpu_shader_3D_groundpoint_vert_glsl,
+ .frag = datatoc_gpu_shader_point_uniform_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_GROUNDLINE] = {
+ .vert = datatoc_gpu_shader_3D_passthrough_vert_glsl,
+ .geom = datatoc_gpu_shader_3D_groundline_geom_glsl,
+ .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
+ },
+
+ [GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_line_dashed_uniform_color_vert_glsl,
+ .geom = datatoc_gpu_shader_2D_line_dashed_geom_glsl,
+ .frag = datatoc_gpu_shader_2D_line_dashed_frag_glsl,
+ },
+ [GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_line_dashed_uniform_color_vert_glsl,
+ .geom = datatoc_gpu_shader_2D_line_dashed_geom_glsl,
+ .frag = datatoc_gpu_shader_2D_line_dashed_frag_glsl,
+ },
+
+ [GPU_SHADER_3D_OBJECTSPACE_SIMPLE_LIGHTING_VARIYING_COLOR] = {
+ .vert = datatoc_gpu_shader_instance_objectspace_variying_color_vert_glsl,
+ .frag = datatoc_gpu_shader_simple_lighting_frag_glsl,
+ .defs =
+ "#define USE_INSTANCE_COLOR\n",
+ },
+ [GPU_SHADER_3D_OBJECTSPACE_VARIYING_COLOR] = {
+ .vert = datatoc_gpu_shader_instance_objectspace_variying_color_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR] = {
+ .vert = datatoc_gpu_shader_instance_screenspace_variying_color_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED_AXIS] = {
+ .vert = datatoc_gpu_shader_instance_screen_aligned_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ .defs =
+ "#define AXIS_NAME\n",
+ },
+ [GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED] = {
+ .vert = datatoc_gpu_shader_instance_screen_aligned_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+
+ [GPU_SHADER_CAMERA] = {
+ .vert = datatoc_gpu_shader_instance_camera_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+ [GPU_SHADER_DISTANCE_LINES] = {
+ .vert = datatoc_gpu_shader_instance_distance_line_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+
+ [GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_point_uniform_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_point_varying_size_varying_color_vert_glsl,
+ .frag = datatoc_gpu_shader_point_varying_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA] = {
+ .vert = datatoc_gpu_shader_2D_point_uniform_size_aa_vert_glsl,
+ .frag = datatoc_gpu_shader_point_uniform_color_aa_frag_glsl,
+ },
+ [GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA] = {
+ .vert = datatoc_gpu_shader_2D_point_uniform_size_outline_aa_vert_glsl,
+ .frag = datatoc_gpu_shader_point_uniform_color_outline_aa_frag_glsl,
+ },
+ [GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA] = {
+ .vert = datatoc_gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert_glsl,
+ .frag = datatoc_gpu_shader_point_varying_color_outline_aa_frag_glsl,
+ },
+ [GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_vert_glsl,
+ .frag = datatoc_gpu_shader_point_uniform_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_point_fixed_size_varying_color_vert_glsl,
+ .frag = datatoc_gpu_shader_point_varying_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_point_varying_size_vert_glsl,
+ .frag = datatoc_gpu_shader_point_uniform_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR] = {
+ .vert = datatoc_gpu_shader_3D_point_varying_size_varying_color_vert_glsl,
+ .frag = datatoc_gpu_shader_point_varying_color_frag_glsl,
+ },
+ [GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA] = {
+ .vert = datatoc_gpu_shader_3D_point_uniform_size_aa_vert_glsl,
+ .frag = datatoc_gpu_shader_point_uniform_color_aa_frag_glsl,
+ },
+ [GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA] = {
+ .vert = datatoc_gpu_shader_3D_point_uniform_size_outline_aa_vert_glsl,
+ .frag = datatoc_gpu_shader_point_uniform_color_outline_aa_frag_glsl,
+ },
+
+ [GPU_SHADER_INSTANCE_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_instance_vert_glsl,
+ .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
+ },
+ [GPU_SHADER_INSTANCE_VARIYING_ID_VARIYING_SIZE] = {
+ .vert = datatoc_gpu_shader_instance_variying_size_variying_id_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_id_frag_glsl,
+ .defs =
+ "#define UNIFORM_SCALE\n",
+ },
+ [GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE] = {
+ .vert = datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ .defs =
+ "#define UNIFORM_SCALE\n",
+ },
+ [GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE] = {
+ .vert = datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+ [GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR] = {
+ .vert = datatoc_gpu_shader_instance_edges_variying_color_vert_glsl,
+ .geom = datatoc_gpu_shader_instance_edges_variying_color_geom_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+
+ [GPU_SHADER_2D_AREA_EDGES] = {
+ .vert = datatoc_gpu_shader_2D_area_borders_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_area_borders_frag_glsl,
+ },
+ [GPU_SHADER_2D_WIDGET_BASE] = {
+ .vert = datatoc_gpu_shader_2D_widget_base_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_widget_base_frag_glsl,
+ },
+ [GPU_SHADER_2D_WIDGET_BASE_INST] = {
+ .vert = datatoc_gpu_shader_2D_widget_base_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_widget_base_frag_glsl,
+ .defs =
+ "#define USE_INSTANCE\n",
+ },
+ [GPU_SHADER_2D_WIDGET_SHADOW] = {
+ .vert = datatoc_gpu_shader_2D_widget_shadow_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_widget_shadow_frag_glsl,
+ },
+ [GPU_SHADER_2D_NODELINK] = {
+ .vert = datatoc_gpu_shader_2D_nodelink_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_nodelink_frag_glsl,
+ },
+ [GPU_SHADER_2D_NODELINK_INST] = {
+ .vert = datatoc_gpu_shader_2D_nodelink_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_nodelink_frag_glsl,
+ .defs =
+ "#define USE_INSTANCE\n",
+ },
+
+ [GPU_SHADER_2D_UV_UNIFORM_COLOR] = {
+ .vert = datatoc_gpu_shader_2D_vert_glsl,
+ .frag = datatoc_gpu_shader_uniform_color_frag_glsl,
+ .defs =
+ "#define UV_POS\n",
+ },
+ [GPU_SHADER_2D_UV_VERTS] = {
+ .vert = datatoc_gpu_shader_2D_edituvs_points_vert_glsl,
+ .frag = datatoc_gpu_shader_point_varying_color_varying_outline_aa_frag_glsl,
+ },
+ [GPU_SHADER_2D_UV_FACEDOTS] = {
+ .vert = datatoc_gpu_shader_2D_edituvs_facedots_vert_glsl,
+ .frag = datatoc_gpu_shader_point_varying_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_UV_EDGES] = {
+ .vert = datatoc_gpu_shader_2D_edituvs_edges_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_UV_EDGES_SMOOTH] = {
+ .vert = datatoc_gpu_shader_2D_edituvs_edges_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_smooth_color_frag_glsl,
+ .defs =
+ "#define SMOOTH_COLOR\n",
+ },
+ [GPU_SHADER_2D_UV_FACES] = {
+ .vert = datatoc_gpu_shader_2D_edituvs_faces_vert_glsl,
+ .frag = datatoc_gpu_shader_flat_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_UV_FACES_STRETCH_AREA] = {
+ .vert = datatoc_gpu_shader_2D_edituvs_stretch_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_smooth_color_frag_glsl,
+ },
+ [GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE] = {
+ .vert = datatoc_gpu_shader_2D_edituvs_stretch_vert_glsl,
+ .frag = datatoc_gpu_shader_2D_smooth_color_frag_glsl,
+ .defs =
+ "#define STRETCH_ANGLE\n",
+ },
+
+ [GPU_SHADER_3D_FLAT_SELECT_ID] = {
+ .vert = datatoc_gpu_shader_3D_selection_id_vert_glsl,
+ .frag = datatoc_gpu_shader_selection_id_frag_glsl,
+ },
+ [GPU_SHADER_3D_UNIFORM_SELECT_ID] = {
+ .vert = datatoc_gpu_shader_3D_selection_id_vert_glsl,
+ .frag = datatoc_gpu_shader_selection_id_frag_glsl,
+ .defs =
+ "#define UNIFORM_ID\n",
+ },
+
+ [GPU_SHADER_GPENCIL_STROKE] = {
+ .vert = datatoc_gpu_shader_gpencil_stroke_vert_glsl,
+ .geom = datatoc_gpu_shader_gpencil_stroke_geom_glsl,
+ .frag = datatoc_gpu_shader_gpencil_stroke_frag_glsl,
+ },
+
+ [GPU_SHADER_GPENCIL_FILL] = {
+ .vert = datatoc_gpu_shader_gpencil_fill_vert_glsl,
+ .frag = datatoc_gpu_shader_gpencil_fill_frag_glsl,
+ },
};
-/* just a few special cases */
-static const char *gpu_shader_get_builtin_shader_defines(
- GPUBuiltinShader shader)
-{
- switch (shader) {
- case GPU_SHADER_2D_IMAGE_MULTISAMPLE_2:
- return "#define SAMPLES 2\n";
-
- case GPU_SHADER_2D_IMAGE_MULTISAMPLE_2_DEPTH_TEST:
- return "#define SAMPLES 2\n"
- "#define USE_DEPTH\n";
-
- case GPU_SHADER_2D_IMAGE_MULTISAMPLE_4:
- return "#define SAMPLES 4\n";
-
- case GPU_SHADER_2D_IMAGE_MULTISAMPLE_4_DEPTH_TEST:
- return "#define SAMPLES 4\n"
- "#define USE_DEPTH\n";
-
- case GPU_SHADER_2D_IMAGE_MULTISAMPLE_8:
- return "#define SAMPLES 8\n";
-
- case GPU_SHADER_2D_IMAGE_MULTISAMPLE_8_DEPTH_TEST:
- return "#define SAMPLES 8\n"
- "#define USE_DEPTH\n";
-
- case GPU_SHADER_2D_IMAGE_MULTISAMPLE_16:
- return "#define SAMPLES 16\n";
-
- case GPU_SHADER_2D_IMAGE_MULTISAMPLE_16_DEPTH_TEST:
- return "#define SAMPLES 16\n"
- "#define USE_DEPTH\n";
-
- case GPU_SHADER_2D_WIDGET_BASE_INST:
- case GPU_SHADER_2D_NODELINK_INST:
- return "#define USE_INSTANCE\n";
-
- case GPU_SHADER_INSTANCE_VARIYING_ID_VARIYING_SIZE:
- case GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE:
- return "#define UNIFORM_SCALE\n";
-
- case GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED_AXIS:
- return "#define AXIS_NAME\n";
-
- case GPU_SHADER_3D_OBJECTSPACE_SIMPLE_LIGHTING_VARIYING_COLOR:
- return "#define USE_INSTANCE_COLOR\n";
-
- case GPU_SHADER_3D_FLAT_COLOR_U32:
- case GPU_SHADER_3D_UNIFORM_COLOR_U32:
- return "#define USE_COLOR_U32\n";
-
- case GPU_SHADER_SIMPLE_LIGHTING_FLAT_COLOR:
- return "#define USE_FLAT_NORMAL\n";
-
- case GPU_SHADER_2D_UV_EDGES_SMOOTH:
- return "#define SMOOTH_COLOR\n";
-
- default:
- return NULL;
- }
-}
-
-GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
+GPUShader *GPU_shader_get_builtin_shader_with_config(
+ eGPUBuiltinShader shader, eGPUShaderConfig sh_cfg)
{
- BLI_assert(shader != GPU_NUM_BUILTIN_SHADERS); /* don't be a troll */
-
- if (builtin_shaders[shader] == NULL) {
- const char *defines = gpu_shader_get_builtin_shader_defines(shader);
+ BLI_assert(shader < GPU_SHADER_BUILTIN_LEN);
+ BLI_assert(sh_cfg < GPU_SHADER_CFG_LEN);
+ GPUShader **sh_p = &builtin_shaders[sh_cfg][shader];
- const GPUShaderStages *stages = builtin_shader_stages + shader;
+ if (*sh_p == NULL) {
+ GPUShaderStages stages_legacy = {NULL};
+ const GPUShaderStages *stages = &builtin_shader_stages[shader];
- if (shader == GPU_SHADER_EDGES_FRONT_BACK_PERSP && !GLEW_VERSION_3_2) {
+ if (shader == GPU_SHADER_EDGES_FRONT_BACK_PERSP) {
/* TODO: remove after switch to core profile (maybe) */
- static const GPUShaderStages legacy_fancy_edges = {
- datatoc_gpu_shader_edges_front_back_persp_legacy_vert_glsl,
- datatoc_gpu_shader_flat_color_alpha_test_0_frag_glsl,
- };
- stages = &legacy_fancy_edges;
+ if (!GLEW_VERSION_3_2) {
+ stages_legacy.vert = datatoc_gpu_shader_edges_front_back_persp_legacy_vert_glsl;
+ stages_legacy.frag = datatoc_gpu_shader_flat_color_alpha_test_0_frag_glsl;
+ stages = &stages_legacy;
+ }
}
-
- if (shader == GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR && !GLEW_VERSION_3_2) {
+ else if (shader == GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR) {
/* Dashed need geometry shader, which are not supported by legacy OpenGL, fallback to solid lines. */
/* TODO: remove after switch to core profile (maybe) */
- static const GPUShaderStages legacy_dashed_lines = {
- datatoc_gpu_shader_3D_line_dashed_uniform_color_legacy_vert_glsl,
- datatoc_gpu_shader_2D_line_dashed_frag_glsl,
- };
- stages = &legacy_dashed_lines;
+ if (!GLEW_VERSION_3_2) {
+ stages_legacy.vert = datatoc_gpu_shader_3D_line_dashed_uniform_color_legacy_vert_glsl;
+ stages_legacy.frag = datatoc_gpu_shader_2D_line_dashed_frag_glsl;
+ stages = &stages_legacy;
+ }
}
/* common case */
- builtin_shaders[shader] = GPU_shader_create(stages->vert, stages->frag, stages->geom, NULL, defines, __func__);
+ if (sh_cfg == GPU_SHADER_CFG_DEFAULT) {
+ *sh_p = GPU_shader_create(stages->vert, stages->frag, stages->geom, NULL, stages->defs, __func__);
+ }
+ else if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ /* Remove eventually, for now ensure support for each shader has been added. */
+ BLI_assert(ELEM(shader,
+ GPU_SHADER_3D_UNIFORM_COLOR,
+ GPU_SHADER_3D_SMOOTH_COLOR,
+ GPU_SHADER_3D_DEPTH_ONLY,
+ GPU_SHADER_CAMERA,
+ GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE,
+ GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE,
+ GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA,
+ GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA,
+ GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR,
+ GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED,
+ GPU_SHADER_3D_GROUNDLINE,
+ GPU_SHADER_3D_GROUNDPOINT,
+ GPU_SHADER_DISTANCE_LINES,
+ GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR,
+ GPU_SHADER_3D_FLAT_SELECT_ID,
+ GPU_SHADER_3D_UNIFORM_SELECT_ID) ||
+ ELEM(shader,
+ GPU_SHADER_3D_FLAT_COLOR));
+ const char *world_clip_lib = datatoc_gpu_shader_cfg_world_clip_lib_glsl;
+ const char *world_clip_def = "#define USE_WORLD_CLIP_PLANES\n";
+ /* In rare cases geometry shaders calculate clipping themselves. */
+ *sh_p = GPU_shader_create_from_arrays({
+ .vert = (const char *[]){world_clip_lib, stages->vert, NULL},
+ .geom = (const char *[]){stages->geom ? world_clip_lib : NULL, stages->geom, NULL},
+ .frag = (const char *[]){stages->frag, NULL},
+ .defs = (const char *[]){world_clip_def, stages->defs, NULL},
+ });
+ }
+ else {
+ BLI_assert(0);
+ }
}
- return builtin_shaders[shader];
+ return *sh_p;
+}
+GPUShader *GPU_shader_get_builtin_shader(eGPUBuiltinShader shader)
+{
+ return GPU_shader_get_builtin_shader_with_config(shader, GPU_SHADER_CFG_DEFAULT);
}
void GPU_shader_get_builtin_shader_code(
- GPUBuiltinShader shader,
+ eGPUBuiltinShader shader,
const char **r_vert, const char **r_frag,
const char **r_geom, const char **r_defines)
{
- const GPUShaderStages *stages = builtin_shader_stages + shader;
+ const GPUShaderStages *stages = &builtin_shader_stages[shader];
*r_vert = stages->vert;
*r_frag = stages->frag;
*r_geom = stages->geom;
- *r_defines = gpu_shader_get_builtin_shader_defines(shader);
+ *r_defines = stages->defs;
}
-#define MAX_DEFINES 100
-
void GPU_shader_free_builtin_shaders(void)
{
- for (int i = 0; i < GPU_NUM_BUILTIN_SHADERS; ++i) {
- if (builtin_shaders[i]) {
- GPU_shader_free(builtin_shaders[i]);
- builtin_shaders[i] = NULL;
+ for (int i = 0; i < GPU_SHADER_CFG_LEN; i++) {
+ for (int j = 0; j < GPU_SHADER_BUILTIN_LEN; j++) {
+ if (builtin_shaders[i][j]) {
+ GPU_shader_free(builtin_shaders[i][j]);
+ builtin_shaders[i][j] = NULL;
+ }
}
}
}
diff --git a/source/blender/gpu/intern/gpu_shader_interface.c b/source/blender/gpu/intern/gpu_shader_interface.c
index d46fc979363..72f19b3fc6b 100644
--- a/source/blender/gpu/intern/gpu_shader_interface.c
+++ b/source/blender/gpu/intern/gpu_shader_interface.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,16 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_shader_interface.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU shader interface (C --> GLSL)
*/
#include "MEM_guardedalloc.h"
+#include "BKE_global.h"
#include "GPU_shader_interface.h"
@@ -41,6 +36,7 @@
#include <string.h>
#define DEBUG_SHADER_INTERFACE 0
+#define DEBUG_SHADER_UNIFORMS 0
#if DEBUG_SHADER_INTERFACE
# include <stdio.h>
@@ -219,15 +215,15 @@ GPUShaderInterface *GPU_shaderinterface_create(int32_t program)
printf("GPUShaderInterface %p, program %d\n", shaderface, program);
#endif
- GLint max_attrib_name_len, attr_len;
- glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_attrib_name_len);
+ GLint max_attr_name_len, attr_len;
+ glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_attr_name_len);
glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &attr_len);
GLint max_ubo_name_len, ubo_len;
glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &max_ubo_name_len);
glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCKS, &ubo_len);
- const uint32_t name_buffer_len = attr_len * max_attrib_name_len + ubo_len * max_ubo_name_len;
+ const uint32_t name_buffer_len = attr_len * max_attr_name_len + ubo_len * max_ubo_name_len;
shaderface->name_buffer = MEM_mallocN(name_buffer_len, "name_buffer");
/* Attributes */
@@ -251,10 +247,10 @@ GPUShaderInterface *GPU_shaderinterface_create(int32_t program)
set_input_name(shaderface, input, name, name_len);
- shader_input_to_bucket(input, shaderface->attrib_buckets);
+ shader_input_to_bucket(input, shaderface->attr_buckets);
#if DEBUG_SHADER_INTERFACE
- printf("attrib[%u] '%s' at location %d\n", i, name, input->location);
+ printf("attr[%u] '%s' at location %d\n", i, name, input->location);
#endif
}
/* Uniform Blocks */
@@ -294,7 +290,7 @@ void GPU_shaderinterface_discard(GPUShaderInterface *shaderface)
{
/* Free memory used by buckets and has entries. */
buckets_free(shaderface->uniform_buckets);
- buckets_free(shaderface->attrib_buckets);
+ buckets_free(shaderface->attr_buckets);
buckets_free(shaderface->ubo_buckets);
/* Free memory used by name_buffer. */
MEM_freeN(shaderface->name_buffer);
@@ -311,12 +307,30 @@ void GPU_shaderinterface_discard(GPUShaderInterface *shaderface)
const GPUShaderInput *GPU_shaderinterface_uniform(const GPUShaderInterface *shaderface, const char *name)
{
- /* TODO: Warn if we find a matching builtin, since these can be looked up much quicker. */
- const GPUShaderInput *input = buckets_lookup(shaderface->uniform_buckets, shaderface->name_buffer, name);
+ return buckets_lookup(shaderface->uniform_buckets, shaderface->name_buffer, name);
+}
+
+const GPUShaderInput *GPU_shaderinterface_uniform_ensure(const GPUShaderInterface *shaderface, const char *name)
+{
+ const GPUShaderInput *input = GPU_shaderinterface_uniform(shaderface, name);
/* If input is not found add it so it's found next time. */
if (input == NULL) {
input = add_uniform((GPUShaderInterface *)shaderface, name);
+
+ if ((G.debug & G_DEBUG_GPU) && (input->location == -1)) {
+ fprintf(stderr, "GPUShaderInterface: Warning: Uniform '%s' not found!\n", name);
+ }
+ }
+
+#if DEBUG_SHADER_UNIFORMS
+ if ((G.debug & G_DEBUG_GPU) &&
+ input->builtin_type != GPU_UNIFORM_NONE &&
+ input->builtin_type != GPU_UNIFORM_CUSTOM)
+ {
+ /* Warn if we find a matching builtin, since these can be looked up much quicker. */
+ fprintf(stderr, "GPUShaderInterface: Warning: Uniform '%s' is a builtin uniform but not queried as such!\n", name);
}
+#endif
return (input->location != -1) ? input : NULL;
}
@@ -338,7 +352,7 @@ const GPUShaderInput *GPU_shaderinterface_ubo(const GPUShaderInterface *shaderfa
const GPUShaderInput *GPU_shaderinterface_attr(const GPUShaderInterface *shaderface, const char *name)
{
- return buckets_lookup(shaderface->attrib_buckets, shaderface->name_buffer, name);
+ return buckets_lookup(shaderface->attr_buckets, shaderface->name_buffer, name);
}
void GPU_shaderinterface_add_batch_ref(GPUShaderInterface *shaderface, GPUBatch *batch)
diff --git a/source/blender/gpu/intern/gpu_shader_private.h b/source/blender/gpu/intern/gpu_shader_private.h
index 69c0c41cef4..da41e3472fd 100644
--- a/source/blender/gpu/intern/gpu_shader_private.h
+++ b/source/blender/gpu/intern/gpu_shader_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gpu_shader_private.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#ifndef __GPU_SHADER_PRIVATE_H__
@@ -29,13 +25,18 @@
#include "GPU_shader_interface.h"
struct GPUShader {
- GLuint program; /* handle for full program (links shader stages below) */
-
- GLuint vertex; /* handle for vertex shader */
- GLuint geometry; /* handle for geometry shader */
- GLuint fragment; /* handle for fragment shader */
-
- GPUShaderInterface *interface; /* cached uniform & attrib interface for shader */
+ /** Handle for full program (links shader stages below). */
+ GLuint program;
+
+ /** Handle for vertex shader. */
+ GLuint vertex;
+ /** Handle for geometry shader. */
+ GLuint geometry;
+ /** Handle for fragment shader. */
+ GLuint fragment;
+
+ /** Cached uniform & attribute interface for shader. */
+ GPUShaderInterface *interface;
int feedback_transform_type;
#ifndef NDEBUG
diff --git a/source/blender/gpu/intern/gpu_state.c b/source/blender/gpu/intern/gpu_state.c
index 767437a0255..98f905cd051 100644
--- a/source/blender/gpu/intern/gpu_state.c
+++ b/source/blender/gpu/intern/gpu_state.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Ray Molenkamp
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_state.c
- * \ingroup gpu
- *
+/** \file
+ * \ingroup gpu
*/
#include "DNA_userdef_types.h"
@@ -31,7 +24,7 @@
#include "GPU_state.h"
#include "GPU_extensions.h"
-static GLenum gpu_get_gl_blendfunction(GPUBlendFunction blend)
+static GLenum gpu_get_gl_blendfunction(eGPUBlendFunction blend)
{
switch (blend) {
case GPU_ONE:
@@ -60,14 +53,14 @@ void GPU_blend(bool enable)
}
}
-void GPU_blend_set_func(GPUBlendFunction sfactor, GPUBlendFunction dfactor)
+void GPU_blend_set_func(eGPUBlendFunction sfactor, eGPUBlendFunction dfactor)
{
glBlendFunc(gpu_get_gl_blendfunction(sfactor), gpu_get_gl_blendfunction(dfactor));
}
void GPU_blend_set_func_separate(
- GPUBlendFunction src_rgb, GPUBlendFunction dst_rgb,
- GPUBlendFunction src_alpha, GPUBlendFunction dst_alpha)
+ eGPUBlendFunction src_rgb, eGPUBlendFunction dst_rgb,
+ eGPUBlendFunction src_alpha, eGPUBlendFunction dst_alpha)
{
glBlendFuncSeparate(
gpu_get_gl_blendfunction(src_rgb),
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 6d9f009a80c..61db44d786d 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file
+ * \ingroup gpu
*/
#include "MEM_guardedalloc.h"
@@ -32,8 +28,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
-#include "BLI_listbase.h"
-#include "BLI_threads.h"
#include "BKE_global.h"
@@ -57,7 +51,7 @@ static struct GPUTextureGlobal {
/* Maximum number of FBOs a texture can be attached to. */
#define GPU_TEX_MAX_FBO_ATTACHED 10
-typedef enum GPUTextureFormatFlag {
+typedef enum eGPUTextureFormatFlag {
GPU_FORMAT_DEPTH = (1 << 0),
GPU_FORMAT_STENCIL = (1 << 1),
GPU_FORMAT_INTEGER = (1 << 2),
@@ -68,7 +62,7 @@ typedef enum GPUTextureFormatFlag {
GPU_FORMAT_3D = (1 << 12),
GPU_FORMAT_CUBE = (1 << 13),
GPU_FORMAT_ARRAY = (1 << 14),
-} GPUTextureFormatFlag;
+} eGPUTextureFormatFlag;
/* GPUTexture */
struct GPUTexture {
@@ -80,8 +74,8 @@ struct GPUTexture {
* use it for unbinding */
GLuint bindcode; /* opengl identifier for texture */
- GPUTextureFormat format;
- GPUTextureFormatFlag format_flag;
+ eGPUTextureFormat format;
+ eGPUTextureFormatFlag format_flag;
uint bytesize; /* number of byte for one pixel */
int components; /* number of color/alpha channels */
@@ -178,7 +172,7 @@ static const char *gl_enum_to_str(GLenum e)
return enum_strings[e];
}
-static int gpu_get_component_count(GPUTextureFormat format)
+static int gpu_get_component_count(eGPUTextureFormat format)
{
switch (format) {
case GPU_RGBA8:
@@ -203,7 +197,7 @@ static int gpu_get_component_count(GPUTextureFormat format)
}
/* Definitely not complete, edit according to the gl specification. */
-static void gpu_validate_data_format(GPUTextureFormat tex_format, GPUDataFormat data_format)
+static void gpu_validate_data_format(eGPUTextureFormat tex_format, eGPUDataFormat data_format)
{
(void)data_format;
@@ -245,7 +239,7 @@ static void gpu_validate_data_format(GPUTextureFormat tex_format, GPUDataFormat
}
}
-static GPUDataFormat gpu_get_data_format_from_tex_format(GPUTextureFormat tex_format)
+static eGPUDataFormat gpu_get_data_format_from_tex_format(eGPUTextureFormat tex_format)
{
if (ELEM(tex_format,
GPU_DEPTH_COMPONENT24,
@@ -285,7 +279,7 @@ static GPUDataFormat gpu_get_data_format_from_tex_format(GPUTextureFormat tex_fo
}
/* Definitely not complete, edit according to the gl specification. */
-static GLenum gpu_get_gl_dataformat(GPUTextureFormat data_type, GPUTextureFormatFlag *format_flag)
+static GLenum gpu_get_gl_dataformat(eGPUTextureFormat data_type, eGPUTextureFormatFlag *format_flag)
{
if (ELEM(data_type,
GPU_DEPTH_COMPONENT24,
@@ -335,7 +329,7 @@ static GLenum gpu_get_gl_dataformat(GPUTextureFormat data_type, GPUTextureFormat
return GL_RGBA;
}
-static uint gpu_get_bytesize(GPUTextureFormat data_type)
+static uint gpu_get_bytesize(eGPUTextureFormat data_type)
{
switch (data_type) {
case GPU_RGBA32F:
@@ -379,7 +373,7 @@ static uint gpu_get_bytesize(GPUTextureFormat data_type)
}
}
-static GLenum gpu_get_gl_internalformat(GPUTextureFormat format)
+static GLenum gpu_get_gl_internalformat(eGPUTextureFormat format)
{
/* You can add any of the available type to this list
* For available types see GPU_texture.h */
@@ -424,7 +418,7 @@ static GLenum gpu_get_gl_internalformat(GPUTextureFormat format)
}
}
-static GLenum gpu_get_gl_datatype(GPUDataFormat format)
+static GLenum gpu_get_gl_datatype(eGPUDataFormat format)
{
switch (format) {
case GPU_DATA_FLOAT:
@@ -592,7 +586,7 @@ static bool gpu_texture_try_alloc(
GPUTexture *GPU_texture_create_nD(
int w, int h, int d, int n, const void *pixels,
- GPUTextureFormat tex_format, GPUDataFormat gpu_data_format, int samples,
+ eGPUTextureFormat tex_format, eGPUDataFormat gpu_data_format, int samples,
const bool can_rescale, char err_out[256])
{
if (samples) {
@@ -765,7 +759,7 @@ static GPUTexture *GPU_texture_cube_create(
int w, int d,
const float *fpixels_px, const float *fpixels_py, const float *fpixels_pz,
const float *fpixels_nx, const float *fpixels_ny, const float *fpixels_nz,
- GPUTextureFormat tex_format, GPUDataFormat gpu_data_format,
+ eGPUTextureFormat tex_format, eGPUDataFormat gpu_data_format,
char err_out[256])
{
GPUTexture *tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
@@ -851,7 +845,7 @@ static GPUTexture *GPU_texture_cube_create(
}
/* Special buffer textures. tex_format must be compatible with the buffer content. */
-GPUTexture *GPU_texture_create_buffer(GPUTextureFormat tex_format, const GLuint buffer)
+GPUTexture *GPU_texture_create_buffer(eGPUTextureFormat tex_format, const GLuint buffer)
{
GPUTexture *tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
tex->number = -1;
@@ -992,50 +986,57 @@ GPUTexture *GPU_texture_from_preview(PreviewImage *prv, int mipmap)
}
GPUTexture *GPU_texture_create_1D(
- int w, GPUTextureFormat tex_format, const float *pixels, char err_out[256])
+ int w, eGPUTextureFormat tex_format, const float *pixels, char err_out[256])
{
- GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
+ BLI_assert(w > 0);
+ eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, 0, 0, 1, pixels, tex_format, data_format, 0, false, err_out);
}
GPUTexture *GPU_texture_create_1D_array(
- int w, int h, GPUTextureFormat tex_format, const float *pixels, char err_out[256])
+ int w, int h, eGPUTextureFormat tex_format, const float *pixels, char err_out[256])
{
- GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
+ BLI_assert(w > 0 && h > 0);
+ eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, h, 0, 1, pixels, tex_format, data_format, 0, false, err_out);
}
GPUTexture *GPU_texture_create_2D(
- int w, int h, GPUTextureFormat tex_format, const float *pixels, char err_out[256])
+ int w, int h, eGPUTextureFormat tex_format, const float *pixels, char err_out[256])
{
- GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
+ BLI_assert(w > 0 && h > 0);
+ eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, h, 0, 2, pixels, tex_format, data_format, 0, false, err_out);
}
GPUTexture *GPU_texture_create_2D_multisample(
- int w, int h, GPUTextureFormat tex_format, const float *pixels, int samples, char err_out[256])
+ int w, int h, eGPUTextureFormat tex_format, const float *pixels, int samples, char err_out[256])
{
- GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
+ BLI_assert(w > 0 && h > 0);
+ eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, h, 0, 2, pixels, tex_format, data_format, samples, false, err_out);
}
GPUTexture *GPU_texture_create_2D_array(
- int w, int h, int d, GPUTextureFormat tex_format, const float *pixels, char err_out[256])
+ int w, int h, int d, eGPUTextureFormat tex_format, const float *pixels, char err_out[256])
{
- GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
+ BLI_assert(w > 0 && h > 0 && d > 0);
+ eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, h, d, 2, pixels, tex_format, data_format, 0, false, err_out);
}
GPUTexture *GPU_texture_create_3D(
- int w, int h, int d, GPUTextureFormat tex_format, const float *pixels, char err_out[256])
+ int w, int h, int d, eGPUTextureFormat tex_format, const float *pixels, char err_out[256])
{
- GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
+ BLI_assert(w > 0 && h > 0 && d > 0);
+ eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, h, d, 3, pixels, tex_format, data_format, 0, true, err_out);
}
GPUTexture *GPU_texture_create_cube(
- int w, GPUTextureFormat tex_format, const float *fpixels, char err_out[256])
+ int w, eGPUTextureFormat tex_format, const float *fpixels, char err_out[256])
{
+ BLI_assert(w > 0);
const float *fpixels_px, *fpixels_py, *fpixels_pz, *fpixels_nx, *fpixels_ny, *fpixels_nz;
const int channels = gpu_get_component_count(tex_format);
@@ -1059,7 +1060,7 @@ GPUTexture *GPU_texture_create_cube(
GPUTexture *GPU_texture_create_from_vertbuf(GPUVertBuf *vert)
{
GPUVertFormat *format = &vert->format;
- GPUVertAttr *attr = &format->attribs[0];
+ GPUVertAttr *attr = &format->attrs[0];
/* Detect incompatible cases (not supported by texture buffers) */
BLI_assert(format->attr_len == 1 && vert->vbo_id != 0);
@@ -1075,7 +1076,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(GPUVertBuf *vert)
BLI_assert(is_uint || byte_per_comp <= 2);
}
- GPUTextureFormat data_type;
+ eGPUTextureFormat data_type;
switch (attr->fetch_mode) {
case GPU_FETCH_FLOAT:
switch (attr->comp_len) {
@@ -1126,7 +1127,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(GPUVertBuf *vert)
}
void GPU_texture_add_mipmap(
- GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl, const void *pixels)
+ GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl, const void *pixels)
{
BLI_assert((int)tex->format > -1);
BLI_assert(tex->components > -1);
@@ -1166,7 +1167,7 @@ void GPU_texture_add_mipmap(
}
void GPU_texture_update_sub(
- GPUTexture *tex, GPUDataFormat gpu_data_format, const void *pixels,
+ GPUTexture *tex, eGPUDataFormat gpu_data_format, const void *pixels,
int offset_x, int offset_y, int offset_z, int width, int height, int depth)
{
BLI_assert((int)tex->format > -1);
@@ -1211,7 +1212,7 @@ void GPU_texture_update_sub(
glBindTexture(tex->target, 0);
}
-void *GPU_texture_read(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl)
+void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl)
{
int size[3] = {0, 0, 0};
GPU_texture_get_mipmap_size(tex, miplvl, size);
@@ -1265,7 +1266,7 @@ void *GPU_texture_read(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplv
return buf;
}
-void GPU_texture_update(GPUTexture *tex, GPUDataFormat data_format, const void *pixels)
+void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *pixels)
{
GPU_texture_update_sub(tex, data_format, pixels, 0, 0, 0, tex->w, tex->h, tex->d);
}
@@ -1370,7 +1371,7 @@ void GPU_texture_generate_mipmap(GPUTexture *tex)
* In this case we just create a complete texture with mipmaps manually without downsampling.
* You must initialize the texture levels using other methods like GPU_framebuffer_recursive_downsample(). */
int levels = 1 + floor(log2(max_ii(tex->w, tex->h)));
- GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex->format);
+ eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex->format);
for (int i = 1; i < levels; ++i) {
GPU_texture_add_mipmap(tex, data_format, i, NULL);
}
@@ -1441,7 +1442,7 @@ void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat)
glTexParameteri(tex->target_base, GL_TEXTURE_WRAP_R, repeat);
}
-static GLenum gpu_get_gl_filterfunction(GPUFilterFunction filter)
+static GLenum gpu_get_gl_filterfunction(eGPUFilterFunction filter)
{
switch (filter) {
case GPU_NEAREST:
@@ -1454,7 +1455,7 @@ static GLenum gpu_get_gl_filterfunction(GPUFilterFunction filter)
}
}
-void GPU_texture_filters(GPUTexture *tex, GPUFilterFunction min_filter, GPUFilterFunction mag_filter)
+void GPU_texture_filters(GPUTexture *tex, eGPUFilterFunction min_filter, eGPUFilterFunction mag_filter)
{
WARN_NOT_BOUND(tex);
@@ -1515,7 +1516,7 @@ int GPU_texture_layers(const GPUTexture *tex)
return tex->d;
}
-GPUTextureFormat GPU_texture_format(const GPUTexture *tex)
+eGPUTextureFormat GPU_texture_format(const GPUTexture *tex)
{
return tex->format;
}
diff --git a/source/blender/gpu/intern/gpu_uniformbuffer.c b/source/blender/gpu/intern/gpu_uniformbuffer.c
index 97dc511e58b..fea23c1ac0f 100644
--- a/source/blender/gpu/intern/gpu_uniformbuffer.c
+++ b/source/blender/gpu/intern/gpu_uniformbuffer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Clement Foucault.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file gpu_uniformbuffer.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*/
#include <string.h>
@@ -42,21 +34,21 @@
#include "GPU_material.h"
#include "GPU_uniformbuffer.h"
-typedef enum GPUUniformBufferFlag {
+typedef enum eGPUUniformBufferFlag {
GPU_UBO_FLAG_INITIALIZED = (1 << 0),
GPU_UBO_FLAG_DIRTY = (1 << 1),
-} GPUUniformBufferFlag;
+} eGPUUniformBufferFlag;
-typedef enum GPUUniformBufferType {
+typedef enum eGPUUniformBufferType {
GPU_UBO_STATIC = 0,
GPU_UBO_DYNAMIC = 1,
-} GPUUniformBufferType;
+} eGPUUniformBufferType;
struct GPUUniformBuffer {
int size; /* in bytes */
GLuint bindcode; /* opengl identifier for UBO */
int bindpoint; /* current binding point */
- GPUUniformBufferType type;
+ eGPUUniformBufferType type;
};
#define GPUUniformBufferStatic GPUUniformBuffer
@@ -68,7 +60,7 @@ typedef struct GPUUniformBufferDynamic {
} GPUUniformBufferDynamic;
/* Prototypes */
-static GPUType get_padded_gpu_type(struct LinkData *link);
+static eGPUType get_padded_gpu_type(struct LinkData *link);
static void gpu_uniformbuffer_inputs_sort(struct ListBase *inputs);
/* Only support up to this type, if you want to extend it, make sure the
@@ -148,7 +140,7 @@ GPUUniformBuffer *GPU_uniformbuffer_dynamic_create(ListBase *inputs, char err_ou
gpu_uniformbuffer_inputs_sort(inputs);
for (LinkData *link = inputs->first; link; link = link->next) {
- const GPUType gputype = get_padded_gpu_type(link);
+ const eGPUType gputype = get_padded_gpu_type(link);
ubo->buffer.size += gputype * sizeof(float);
}
@@ -231,10 +223,10 @@ void GPU_uniformbuffer_dynamic_update(GPUUniformBuffer *ubo_)
* We need to pad some data types (vec3) on the C side
* To match the GPU expected memory block alignment.
*/
-static GPUType get_padded_gpu_type(LinkData *link)
+static eGPUType get_padded_gpu_type(LinkData *link)
{
GPUInput *input = link->data;
- GPUType gputype = input->type;
+ eGPUType gputype = input->type;
/* Unless the vec3 is followed by a float we need to treat it as a vec4. */
if (gputype == GPU_VEC3 &&
@@ -269,7 +261,7 @@ static void gpu_uniformbuffer_inputs_sort(ListBase *inputs)
/* Creates a lookup table for the different types; */
LinkData *inputs_lookup[MAX_UBO_GPU_TYPE + 1] = {NULL};
- GPUType cur_type = MAX_UBO_GPU_TYPE + 1;
+ eGPUType cur_type = MAX_UBO_GPU_TYPE + 1;
for (LinkData *link = inputs->first; link; link = link->next) {
GPUInput *input = link->data;
diff --git a/source/blender/gpu/intern/gpu_vertex_buffer.c b/source/blender/gpu/intern/gpu_vertex_buffer.c
index a5c560fb17b..dc6367308cd 100644
--- a/source/blender/gpu/intern/gpu_vertex_buffer.c
+++ b/source/blender/gpu/intern/gpu_vertex_buffer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Clément Foucault
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_vertex_buffer.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU vertex buffer
*/
@@ -48,7 +42,7 @@ static GLenum convert_usage_type_to_gl(GPUUsageType type)
static const GLenum table[] = {
[GPU_USAGE_STREAM] = GL_STREAM_DRAW,
[GPU_USAGE_STATIC] = GL_STATIC_DRAW,
- [GPU_USAGE_DYNAMIC] = GL_DYNAMIC_DRAW
+ [GPU_USAGE_DYNAMIC] = GL_DYNAMIC_DRAW,
};
return table[type];
}
@@ -152,7 +146,7 @@ void GPU_vertbuf_data_resize(GPUVertBuf *verts, uint v_len)
/* Set vertex count but does not change allocation.
* Only this many verts will be uploaded to the GPU and rendered.
* This is useful for streaming data. */
-void GPU_vertbuf_vertex_count_set(GPUVertBuf *verts, uint v_len)
+void GPU_vertbuf_data_len_set(GPUVertBuf *verts, uint v_len)
{
#if TRUST_NO_ONE
assert(verts->data != NULL); /* only for dynamic data */
@@ -169,7 +163,7 @@ void GPU_vertbuf_vertex_count_set(GPUVertBuf *verts, uint v_len)
void GPU_vertbuf_attr_set(GPUVertBuf *verts, uint a_idx, uint v_idx, const void *data)
{
const GPUVertFormat *format = &verts->format;
- const GPUVertAttr *a = format->attribs + a_idx;
+ const GPUVertAttr *a = &format->attrs[a_idx];
#if TRUST_NO_ONE
assert(a_idx < format->attr_len);
@@ -183,7 +177,7 @@ void GPU_vertbuf_attr_set(GPUVertBuf *verts, uint a_idx, uint v_idx, const void
void GPU_vertbuf_attr_fill(GPUVertBuf *verts, uint a_idx, const void *data)
{
const GPUVertFormat *format = &verts->format;
- const GPUVertAttr *a = format->attribs + a_idx;
+ const GPUVertAttr *a = &format->attrs[a_idx];
#if TRUST_NO_ONE
assert(a_idx < format->attr_len);
@@ -196,7 +190,7 @@ void GPU_vertbuf_attr_fill(GPUVertBuf *verts, uint a_idx, const void *data)
void GPU_vertbuf_attr_fill_stride(GPUVertBuf *verts, uint a_idx, uint stride, const void *data)
{
const GPUVertFormat *format = &verts->format;
- const GPUVertAttr *a = format->attribs + a_idx;
+ const GPUVertAttr *a = &format->attrs[a_idx];
#if TRUST_NO_ONE
assert(a_idx < format->attr_len);
@@ -220,7 +214,7 @@ void GPU_vertbuf_attr_fill_stride(GPUVertBuf *verts, uint a_idx, uint stride, co
void GPU_vertbuf_attr_get_raw_data(GPUVertBuf *verts, uint a_idx, GPUVertBufRaw *access)
{
const GPUVertFormat *format = &verts->format;
- const GPUVertAttr *a = format->attribs + a_idx;
+ const GPUVertAttr *a = &format->attrs[a_idx];
#if TRUST_NO_ONE
assert(a_idx < format->attr_len);
diff --git a/source/blender/gpu/intern/gpu_vertex_format.c b/source/blender/gpu/intern/gpu_vertex_format.c
index ca636d2e231..d4b975a01ae 100644
--- a/source/blender/gpu/intern/gpu_vertex_format.c
+++ b/source/blender/gpu/intern/gpu_vertex_format.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, Clément Foucault
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_vertex_format.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU vertex format
*/
@@ -55,7 +49,7 @@ void GPU_vertformat_clear(GPUVertFormat *format)
format->name_len = 0;
for (uint i = 0; i < GPU_VERT_ATTR_MAX_LEN; i++) {
- format->attribs[i].name_len = 0;
+ format->attrs[i].name_len = 0;
}
#endif
}
@@ -66,8 +60,8 @@ void GPU_vertformat_copy(GPUVertFormat *dest, const GPUVertFormat *src)
memcpy(dest, src, sizeof(GPUVertFormat));
for (uint i = 0; i < dest->attr_len; i++) {
- for (uint j = 0; j < dest->attribs[i].name_len; j++) {
- dest->attribs[i].name[j] = (char *)dest + (src->attribs[i].name[j] - ((char *)src));
+ for (uint j = 0; j < dest->attrs[i].name_len; j++) {
+ dest->attrs[i].name[j] = (char *)dest + (src->attrs[i].name[j] - ((char *)src));
}
}
}
@@ -84,7 +78,7 @@ static GLenum convert_comp_type_to_gl(GPUVertCompType type)
[GPU_COMP_F32] = GL_FLOAT,
- [GPU_COMP_I10] = GL_INT_2_10_10_10_REV
+ [GPU_COMP_I10] = GL_INT_2_10_10_10_REV,
};
return table[type];
}
@@ -98,7 +92,7 @@ static uint comp_sz(GPUVertCompType type)
return sizes[type];
}
-static uint attrib_sz(const GPUVertAttr *a)
+static uint attr_sz(const GPUVertAttr *a)
{
if (a->comp_type == GPU_COMP_I10) {
return 4; /* always packed as 10_10_10_2 */
@@ -106,7 +100,7 @@ static uint attrib_sz(const GPUVertAttr *a)
return a->comp_len * comp_sz(a->comp_type);
}
-static uint attrib_align(const GPUVertAttr *a)
+static uint attr_align(const GPUVertAttr *a)
{
if (a->comp_type == GPU_COMP_I10) {
return 4; /* always packed as 10_10_10_2 */
@@ -128,7 +122,7 @@ uint vertex_buffer_size(const GPUVertFormat *format, uint vertex_len)
return format->stride * vertex_len;
}
-static const char *copy_attrib_name(GPUVertFormat *format, const char *name, const char *suffix)
+static const char *copy_attr_name(GPUVertFormat *format, const char *name, const char *suffix)
{
/* strncpy does 110% of what we need; let's do exactly 100% */
char *name_copy = format->names + format->name_offset;
@@ -196,37 +190,37 @@ uint GPU_vertformat_attr_add(
#endif
format->name_len++; /* multiname support */
- const uint attrib_id = format->attr_len++;
- GPUVertAttr *attrib = format->attribs + attrib_id;
+ const uint attr_id = format->attr_len++;
+ GPUVertAttr *attr = &format->attrs[attr_id];
- attrib->name[attrib->name_len++] = copy_attrib_name(format, name, NULL);
- attrib->comp_type = comp_type;
- attrib->gl_comp_type = convert_comp_type_to_gl(comp_type);
- attrib->comp_len = (comp_type == GPU_COMP_I10) ? 4 : comp_len; /* system needs 10_10_10_2 to be 4 or BGRA */
- attrib->sz = attrib_sz(attrib);
- attrib->offset = 0; /* offsets & stride are calculated later (during pack) */
- attrib->fetch_mode = fetch_mode;
+ attr->name[attr->name_len++] = copy_attr_name(format, name, NULL);
+ attr->comp_type = comp_type;
+ attr->gl_comp_type = convert_comp_type_to_gl(comp_type);
+ attr->comp_len = (comp_type == GPU_COMP_I10) ? 4 : comp_len; /* system needs 10_10_10_2 to be 4 or BGRA */
+ attr->sz = attr_sz(attr);
+ attr->offset = 0; /* offsets & stride are calculated later (during pack) */
+ attr->fetch_mode = fetch_mode;
- return attrib_id;
+ return attr_id;
}
void GPU_vertformat_alias_add(GPUVertFormat *format, const char *alias)
{
- GPUVertAttr *attrib = format->attribs + (format->attr_len - 1);
+ GPUVertAttr *attr = &format->attrs[format->attr_len - 1];
#if TRUST_NO_ONE
assert(format->name_len < GPU_VERT_ATTR_MAX_LEN); /* there's room for more */
- assert(attrib->name_len < GPU_VERT_ATTR_MAX_NAMES);
+ assert(attr->name_len < GPU_VERT_ATTR_MAX_NAMES);
#endif
format->name_len++; /* multiname support */
- attrib->name[attrib->name_len++] = copy_attrib_name(format, alias, NULL);
+ attr->name[attr->name_len++] = copy_attr_name(format, alias, NULL);
}
int GPU_vertformat_attr_id_get(const GPUVertFormat *format, const char *name)
{
for (int i = 0; i < format->attr_len; i++) {
- const GPUVertAttr *attrib = format->attribs + i;
- for (int j = 0; j < attrib->name_len; j++) {
- if (STREQ(name, attrib->name[j])) {
+ const GPUVertAttr *attr = &format->attrs[i];
+ for (int j = 0; j < attr->name_len; j++) {
+ if (STREQ(name, attr->name[j])) {
return i;
}
}
@@ -246,25 +240,25 @@ void GPU_vertformat_triple_load(GPUVertFormat *format)
uint old_attr_len = format->attr_len;
for (uint a_idx = 0; a_idx < old_attr_len; ++a_idx) {
- GPUVertAttr *attrib = format->attribs + a_idx;
- /* Duplicate attrib twice */
+ GPUVertAttr *attr = &format->attrs[a_idx];
+ /* Duplicate attr twice */
for (int i = 1; i < 3; ++i) {
- GPUVertAttr *dst_attrib = format->attribs + format->attr_len;
- memcpy(dst_attrib, attrib, sizeof(GPUVertAttr));
+ GPUVertAttr *dst_attr = &format->attrs[format->attr_len];
+ memcpy(dst_attr, attr, sizeof(GPUVertAttr));
/* Increase offset to the next vertex. */
- dst_attrib->offset += format->stride * i;
+ dst_attr->offset += format->stride * i;
/* Only copy first name for now. */
- dst_attrib->name_len = 0;
- dst_attrib->name[dst_attrib->name_len++] = copy_attrib_name(format, attrib->name[0], (i == 1) ? "1" : "2");
+ dst_attr->name_len = 0;
+ dst_attr->name[dst_attr->name_len++] = copy_attr_name(format, attr->name[0], (i == 1) ? "1" : "2");
format->attr_len++;
}
#if TRUST_NO_ONE
- assert(attrib->name_len < GPU_VERT_ATTR_MAX_NAMES);
+ assert(attr->name_len < GPU_VERT_ATTR_MAX_NAMES);
#endif
- /* Add alias to first attrib. */
+ /* Add alias to first attr. */
format->name_len++;
- attrib->name[attrib->name_len++] = copy_attrib_name(format, attrib->name[0], "0");
+ attr->name[attr->name_len++] = copy_attr_name(format, attr->name[0], "0");
}
}
@@ -290,14 +284,14 @@ static void show_pack(uint a_idx, uint sz, uint pad)
void VertexFormat_pack(GPUVertFormat *format)
{
/* For now, attributes are packed in the order they were added,
- * making sure each attrib is naturally aligned (add padding where necessary)
+ * making sure each attribute is naturally aligned (add padding where necessary)
* Later we can implement more efficient packing w/ reordering
- * (keep attrib ID order, adjust their offsets to reorder in buffer). */
+ * (keep attribute ID order, adjust their offsets to reorder in buffer). */
/* TODO: realloc just enough to hold the final combo string. And just enough to
- * hold used attribs, not all 16. */
+ * hold used attributes, not all 16. */
- GPUVertAttr *a0 = format->attribs + 0;
+ GPUVertAttr *a0 = &format->attrs[0];
a0->offset = 0;
uint offset = a0->sz;
@@ -306,8 +300,8 @@ void VertexFormat_pack(GPUVertFormat *format)
#endif
for (uint a_idx = 1; a_idx < format->attr_len; ++a_idx) {
- GPUVertAttr *a = format->attribs + a_idx;
- uint mid_padding = padding(offset, attrib_align(a));
+ GPUVertAttr *a = &format->attrs[a_idx];
+ uint mid_padding = padding(offset, attr_align(a));
offset += mid_padding;
a->offset = offset;
offset += a->sz;
@@ -317,7 +311,7 @@ void VertexFormat_pack(GPUVertFormat *format)
#endif
}
- uint end_padding = padding(offset, attrib_align(a0));
+ uint end_padding = padding(offset, attr_align(a0));
#if PACK_DEBUG
show_pack(0, 0, end_padding);
@@ -412,7 +406,7 @@ void GPU_vertformat_from_interface(GPUVertFormat *format, const GPUShaderInterfa
const char *name_buffer = shaderface->name_buffer;
for (int i = 0; i < GPU_NUM_SHADERINTERFACE_BUCKETS; i++) {
- const GPUShaderInput *input = shaderface->attrib_buckets[i];
+ const GPUShaderInput *input = shaderface->attr_buckets[i];
if (input == NULL) {
continue;
}
@@ -425,13 +419,13 @@ void GPU_vertformat_from_interface(GPUVertFormat *format, const GPUShaderInterfa
format->name_len++; /* multiname support */
format->attr_len++;
- GPUVertAttr *attrib = format->attribs + input->location;
+ GPUVertAttr *attr = &format->attrs[input->location];
- attrib->name[attrib->name_len++] = copy_attrib_name(format, name_buffer + input->name_offset, NULL);
- attrib->offset = 0; /* offsets & stride are calculated later (during pack) */
- attrib->comp_len = calc_input_component_size(input);
- attrib->sz = attrib->comp_len * 4;
- get_fetch_mode_and_comp_type(input->gl_type, &attrib->comp_type, &attrib->gl_comp_type, &attrib->fetch_mode);
+ attr->name[attr->name_len++] = copy_attr_name(format, name_buffer + input->name_offset, NULL);
+ attr->offset = 0; /* offsets & stride are calculated later (during pack) */
+ attr->comp_len = calc_input_component_size(input);
+ attr->sz = attr->comp_len * 4;
+ get_fetch_mode_and_comp_type(input->gl_type, &attr->comp_type, &attr->gl_comp_type, &attr->fetch_mode);
}
}
}
@@ -474,12 +468,12 @@ static int convert_i16(short x)
GPUPackedNormal GPU_normal_convert_i10_v3(const float data[3])
{
- GPUPackedNormal n = { .x = quantize(data[0]), .y = quantize(data[1]), .z = quantize(data[2]) };
+ GPUPackedNormal n = { .x = quantize(data[0]), .y = quantize(data[1]), .z = quantize(data[2]), };
return n;
}
GPUPackedNormal GPU_normal_convert_i10_s3(const short data[3])
{
- GPUPackedNormal n = { .x = convert_i16(data[0]), .y = convert_i16(data[1]), .z = convert_i16(data[2]) };
+ GPUPackedNormal n = { .x = convert_i16(data[0]), .y = convert_i16(data[1]), .z = convert_i16(data[2]), };
return n;
}
diff --git a/source/blender/gpu/intern/gpu_vertex_format_private.h b/source/blender/gpu/intern/gpu_vertex_format_private.h
index e4fe61e8697..a850d17a1dd 100644
--- a/source/blender/gpu/intern/gpu_vertex_format_private.h
+++ b/source/blender/gpu/intern/gpu_vertex_format_private.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 by Mike Erwin.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_vertex_format_private.h
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* GPU vertex format
*/
diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c
index 1dd3faa3b03..7688b113547 100644
--- a/source/blender/gpu/intern/gpu_viewport.c
+++ b/source/blender/gpu/intern/gpu_viewport.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/gpu/intern/gpu_viewport.c
- * \ingroup gpu
+/** \file
+ * \ingroup gpu
*
* System that manages viewport drawing.
*/
@@ -35,7 +27,6 @@
#include "BLI_listbase.h"
#include "BLI_rect.h"
-#include "BLI_string.h"
#include "BLI_mempool.h"
#include "BIF_gl.h"
@@ -43,7 +34,6 @@
#include "DNA_vec_types.h"
#include "DNA_userdef_types.h"
-#include "BKE_global.h"
#include "GPU_framebuffer.h"
#include "GPU_glew.h"
@@ -536,9 +526,9 @@ void GPU_viewport_draw_to_screen(GPUViewport *viewport, const rcti *rect)
GPU_shader_bind(shader);
GPU_texture_bind(color, 0);
- glUniform1i(GPU_shader_get_uniform(shader, "image"), 0);
- glUniform4f(GPU_shader_get_uniform(shader, "rect_icon"), halfx, halfy, 1.0f + halfx, 1.0f + halfy);
- glUniform4f(GPU_shader_get_uniform(shader, "rect_geom"), x1, y1, x2, y2);
+ glUniform1i(GPU_shader_get_uniform_ensure(shader, "image"), 0);
+ glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_icon"), halfx, halfy, 1.0f + halfx, 1.0f + halfy);
+ glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_geom"), x1, y1, x2, y2);
glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), 1.0f, 1.0f, 1.0f, 1.0f);
GPU_draw_primitive(GPU_PRIM_TRI_STRIP, 4);
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl
index 76e9c066103..0fddbddddc5 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl
@@ -12,17 +12,19 @@ noperspective out vec4 finalColor;
flat out vec4 finalColor;
#endif
-#define VERTEX_SELECT (1 << 0)
-#define EDGE_SELECT (1 << 4)
+/* TODO: Port drawing to draw manager and
+ * remove constants duplications. */
+#define VERT_UV_SELECT (1 << 3)
+#define EDGE_UV_SELECT (1 << 5)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
#ifdef SMOOTH_COLOR
- bool is_select = (flag & VERTEX_SELECT) != 0;
+ bool is_select = (flag & VERT_UV_SELECT) != 0;
#else
- bool is_select = (flag & EDGE_SELECT) != 0;
+ bool is_select = (flag & EDGE_UV_SELECT) != 0;
#endif
finalColor = (is_select) ? selectColor : edgeColor;
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl
index c5f84b976c5..e0d168e8095 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl
@@ -8,10 +8,12 @@ in int flag;
out vec4 finalColor;
-#define FACE_SELECT (1 << 2)
+/* TODO: Port drawing to draw manager and
+ * remove constants duplications. */
+#define FACE_UV_SELECT (1 << 7)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
- finalColor = ((flag & FACE_SELECT) != 0) ? selectColor : vertColor;
+ finalColor = ((flag & FACE_UV_SELECT) != 0) ? selectColor : vertColor;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl
index 82c8d3f0c4a..1d25c8fe345 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl
@@ -9,15 +9,17 @@ in int flag;
flat out vec4 finalColor;
-#define FACE_SELECT (1 << 2)
-#define FACE_ACTIVE (1 << 3)
+/* TODO: Port drawing to draw manager and
+ * remove constants duplications. */
+#define FACE_UV_ACTIVE (1 << 6)
+#define FACE_UV_SELECT (1 << 7)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
- bool is_selected = (flag & FACE_SELECT) != 0;
- bool is_active = (flag & FACE_ACTIVE) != 0;
+ bool is_selected = (flag & FACE_UV_SELECT) != 0;
+ bool is_active = (flag & FACE_UV_ACTIVE) != 0;
finalColor = (is_selected) ? selectColor : faceColor;
finalColor = (is_active) ? activeColor : finalColor;
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl
index 46dd1e066c8..50166bc4e95 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl
@@ -13,16 +13,18 @@ out vec4 fillColor;
out vec4 outlineColor;
out vec4 radii;
-#define VERTEX_SELECT (1 << 0)
-#define VERTEX_PINNED (1 << 1)
+/* TODO: Port drawing to draw manager and
+ * remove constants duplications. */
+#define VERT_UV_SELECT (1 << 3)
+#define VERT_UV_PINNED (1 << 4)
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
gl_PointSize = pointSize;
- bool is_selected = (flag & VERTEX_SELECT) != 0;
- bool is_pinned = (flag & VERTEX_PINNED) != 0;
+ bool is_selected = (flag & VERT_UV_SELECT) != 0;
+ bool is_pinned = (flag & VERT_UV_PINNED) != 0;
vec4 deselect_col = (is_pinned) ? pinnedColor : vertColor;
fillColor = (is_selected) ? selectColor : deselect_col;
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl
index 4588e41573b..c575e06ed3b 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl
@@ -1,8 +1,16 @@
uniform mat4 ModelViewProjectionMatrix;
+uniform vec2 aspect;
in vec2 pos;
+
+#ifndef STRETCH_ANGLE
in float stretch;
+#else
+
+in vec4 uv_adj;
+in float angle;
+#endif
noperspective out vec4 finalColor;
@@ -42,8 +50,30 @@ vec3 weight_to_rgb(float weight)
return r_rgb;
}
+#define M_PI 3.1415926535897932
+
+/* Adapted from BLI_math_vector.h */
+float angle_normalized_v2v2(vec2 v1, vec2 v2)
+{
+ v1 = normalize(v1 * aspect);
+ v2 = normalize(v2 * aspect);
+ /* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
+ bool q = (dot(v1, v2) >= 0.0);
+ vec2 v = (q) ? (v1 - v2) : (v1 + v2);
+ float a = 2.0 * asin(length(v) / 2.0);
+ return (q) ? a : M_PI - a;
+}
+
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
+
+#ifdef STRETCH_ANGLE
+ float uv_angle = angle_normalized_v2v2(uv_adj.xy, uv_adj.zw) / M_PI;
+ float stretch = 1.0 - abs(uv_angle - angle);
+ stretch = stretch;
+ stretch = 1.0 - stretch * stretch;
+#endif
+
finalColor = vec4(weight_to_rgb(stretch), 1.0);
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
index 4a9f5f94321..ea8d57b5eea 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
@@ -11,7 +11,7 @@ in vec2 pos; /* verts position in the curve tangent space */
in vec2 expand;
#ifdef USE_INSTANCE
-/* Instance attrib */
+/* Instance attrs. */
in vec2 P0;
in vec2 P1;
in vec2 P2;
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl
index 89e3c52f9f8..b3b897da3c6 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl
@@ -1,7 +1,12 @@
uniform mat4 ModelViewProjectionMatrix;
+#ifdef UV_POS
+in vec2 u;
+# define pos u
+#else
in vec2 pos;
+#endif
void main()
{
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
index 7db0029e64d..ff51e0266d7 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
@@ -69,8 +69,8 @@ uniform vec2 triavec[43] = vec2[43](
vec2(0.000000, -1.000000),
/* ROUNDBOX_TRIA_MENU - menu arrows */
- vec2(-0.51, 0.08), vec2(-0.41, 0.20), vec2(-0.05, -0.39),
- vec2(-0.05, -0.18), vec2(0.41, 0.08), vec2(0.3, 0.20),
+ vec2(-0.51, 0.07), vec2(-0.4, 0.18), vec2(-0.05, -0.39),
+ vec2(-0.05, -0.17), vec2(0.41, 0.07), vec2(0.3, 0.18),
/* ROUNDBOX_TRIA_CHECK - check mark */
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl
index 7db7e28d8e6..d4e6f697936 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl
@@ -1,5 +1,8 @@
uniform mat4 ModelViewProjectionMatrix;
+#ifdef USE_WORLD_CLIP_PLANES
+uniform mat4 ModelMatrix;
+#endif
in vec3 pos;
#if defined(USE_COLOR_U32)
@@ -12,7 +15,8 @@ flat out vec4 finalColor;
void main()
{
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+ vec4 pos_4d = vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * pos_4d;
#if defined(USE_COLOR_U32)
finalColor = vec4(
@@ -23,4 +27,8 @@ void main()
#else
finalColor = color;
#endif
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_groundline_geom.glsl b/source/blender/gpu/shaders/gpu_shader_3D_groundline_geom.glsl
index f16fa21b342..29bdd03f7e3 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_groundline_geom.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_groundline_geom.glsl
@@ -8,9 +8,18 @@ layout(line_strip, max_vertices = 2) out;
void main()
{
vec3 vert = gl_in[0].gl_Position.xyz;
+
gl_Position = ViewProjectionMatrix * vec4(vert.xyz, 1.0);
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[0].gl_ClipDistance);
+#endif
EmitVertex();
+
gl_Position = ViewProjectionMatrix * vec4(vert.xy, 0.0, 1.0);
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance(vec3(vert.xy, 0.0));
+#endif
EmitVertex();
+
EndPrimitive();
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_groundpoint_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_groundpoint_vert.glsl
index 55f410eb25d..b08d87cdfa6 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_groundpoint_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_groundpoint_vert.glsl
@@ -6,6 +6,11 @@ in vec3 pos;
void main()
{
- gl_Position = ViewProjectionMatrix * vec4(pos.xy, 0.0, 1.0);
+ vec4 pos_4d = vec4(pos.xy, 0.0, 1.0);
+ gl_Position = ViewProjectionMatrix * pos_4d;
gl_PointSize = 2.0;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance(pos_4d.xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_passthrough_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_passthrough_vert.glsl
index 60793bf56b6..4196dbbad02 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_passthrough_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_passthrough_vert.glsl
@@ -1,8 +1,16 @@
+#ifdef USE_WORLD_CLIP_PLANES
+uniform mat4 ModelMatrix;
+#endif
/* Does Nothing */
in vec3 pos;
void main()
{
- gl_Position = vec4(pos, 1.0);
+ vec4 pos_4d = vec4(pos, 1.0);
+ gl_Position = pos_4d;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_aa_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_aa_vert.glsl
index ebc945fcf35..f39c10e8310 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_aa_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_aa_vert.glsl
@@ -1,12 +1,16 @@
uniform mat4 ModelViewProjectionMatrix;
+#ifdef USE_WORLD_CLIP_PLANES
+uniform mat4 ModelMatrix;
+#endif
uniform float size;
in vec3 pos;
out vec2 radii;
void main() {
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+ vec4 pos_4d = vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * pos_4d;
gl_PointSize = size;
// calculate concentric radii in pixels
@@ -18,4 +22,8 @@ void main() {
// convert to PointCoord units
radii /= size;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl
index 0d6b90cfba4..e14032a9694 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl
@@ -1,5 +1,8 @@
uniform mat4 ModelViewProjectionMatrix;
+#ifdef USE_WORLD_CLIP_PLANES
+uniform mat4 ModelMatrix;
+#endif
uniform float size;
uniform float outlineWidth;
@@ -7,7 +10,8 @@ in vec3 pos;
out vec4 radii;
void main() {
- gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+ vec4 pos_4d = vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * pos_4d;
gl_PointSize = size;
// calculate concentric radii in pixels
@@ -21,4 +25,8 @@ void main() {
// convert to PointCoord units
radii /= size;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_selection_id_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_selection_id_vert.glsl
new file mode 100644
index 00000000000..b2d186efa91
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_3D_selection_id_vert.glsl
@@ -0,0 +1,30 @@
+
+uniform mat4 ModelViewProjectionMatrix;
+
+in vec3 pos;
+
+#ifndef UNIFORM_ID
+uniform uint offset;
+in uint color;
+
+flat out vec4 id;
+#endif
+
+void main()
+{
+#ifndef UNIFORM_ID
+ id = vec4(
+ (((color + offset) ) & 0xFFu) * (1.0f / 255.0f),
+ (((color + offset) >> 8u) & 0xFFu) * (1.0f / 255.0f),
+ (((color + offset) >> 16u) & 0xFFu) * (1.0f / 255.0f),
+ (((color + offset) >> 24u) ) * (1.0f / 255.0f));
+#endif
+
+ vec4 pos_4d = vec4(pos, 1.0);
+ gl_Position = ModelViewProjectionMatrix * pos_4d;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ /* Warning: ModelMatrix is typically used but select drawing is different. */
+ world_clip_planes_calc_clip_distance(pos);
+#endif
+}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl
index a1feb2f75b7..955ce07780c 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl
@@ -1,6 +1,10 @@
uniform mat4 ModelViewProjectionMatrix;
+#ifdef USE_WORLD_CLIP_PLANES
+uniform mat4 ModelMatrix;
+#endif
+
in vec3 pos;
in vec4 color;
@@ -10,4 +14,8 @@ void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
finalColor = color;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
index 059473ebb74..9fc748b292b 100644
--- a/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl
@@ -1,9 +1,17 @@
uniform mat4 ModelViewProjectionMatrix;
+#ifdef USE_WORLD_CLIP_PLANES
+uniform mat4 ModelMatrix;
+#endif
+
in vec3 pos;
void main()
{
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl b/source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl
new file mode 100644
index 00000000000..6964b2a0c39
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl
@@ -0,0 +1,25 @@
+#ifdef USE_WORLD_CLIP_PLANES
+#if defined(GPU_VERTEX_SHADER) || defined(GPU_GEOMETRY_SHADER)
+uniform vec4 WorldClipPlanes[6];
+void world_clip_planes_calc_clip_distance(vec3 wpos)
+{
+ gl_ClipDistance[0] = dot(WorldClipPlanes[0].xyz, wpos) + WorldClipPlanes[0].w;
+ gl_ClipDistance[1] = dot(WorldClipPlanes[1].xyz, wpos) + WorldClipPlanes[1].w;
+ gl_ClipDistance[2] = dot(WorldClipPlanes[2].xyz, wpos) + WorldClipPlanes[2].w;
+ gl_ClipDistance[3] = dot(WorldClipPlanes[3].xyz, wpos) + WorldClipPlanes[3].w;
+ gl_ClipDistance[4] = dot(WorldClipPlanes[4].xyz, wpos) + WorldClipPlanes[4].w;
+ gl_ClipDistance[5] = dot(WorldClipPlanes[5].xyz, wpos) + WorldClipPlanes[5].w;
+}
+#endif
+
+#define world_clip_planes_set_clip_distance(c) \
+{ \
+ gl_ClipDistance[0] = (c)[0]; \
+ gl_ClipDistance[1] = (c)[1]; \
+ gl_ClipDistance[2] = (c)[2]; \
+ gl_ClipDistance[3] = (c)[3]; \
+ gl_ClipDistance[4] = (c)[4]; \
+ gl_ClipDistance[5] = (c)[5]; \
+}
+
+#endif
diff --git a/source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl
index 1f59c9dfdbd..f763b491b59 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl
@@ -89,25 +89,17 @@ void main()
#endif
#ifdef USE_DEPTH
- d1 *= 1.0 - step(1.0, d1); /* make far plane depth = 0 */
# if SAMPLES > 8
- d4 *= 1.0 - step(1.0, d4);
- d3 *= 1.0 - step(1.0, d3);
- d1 = max(d1, max(d3, d4));
+ d1 = min(d1, min(d3, d4));
# endif
# if SAMPLES > 4
- d2 *= 1.0 - step(1.0, d2);
- d1 = max(d1, d2);
- d1 = max(d1, d2);
+ d1 = min(d1, d2);
+ d1 = min(d1, d2);
# endif
# if SAMPLES > 2
- d1.xy = max(d1.xy, d1.zw);
+ d1.xy = min(d1.xy, d1.zw);
# endif
- gl_FragDepth = max(d1.x, d1.y);
- /* Don't let the 0.0 farplane occlude other things */
- if (gl_FragDepth == 0.0) {
- gl_FragDepth = 1.0;
- }
+ gl_FragDepth = min(d1.x, d1.y);
#endif
c1 = c1 + c2;
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl
index 805ecd6085f..6a6da3dd104 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl
@@ -1,10 +1,13 @@
uniform mat4 ViewProjectionMatrix;
+#ifdef USE_WORLD_CLIP_PLANES
+uniform mat4 ModelMatrix;
+#endif
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in float pos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in vec3 color;
in vec4 corners[2]; /* trouble fetching vec2 */
in float depth;
@@ -47,4 +50,8 @@ void main()
gl_Position = ViewProjectionMatrix * InstanceModelMatrix * vec4(pPos, 1.0);
finalColor = vec4(color, 1.0);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * InstanceModelMatrix * vec4(pPos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl
index 255eeb9baf1..2097b900666 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl
@@ -1,10 +1,10 @@
uniform mat4 ViewProjectionMatrix;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec3 pos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in vec3 color;
in float start;
in float end;
@@ -18,8 +18,13 @@ void main()
{
float len = end - start;
vec3 sta = vec3(0.0, 0.0, -start);
+ vec4 pos_4d = vec4(pos * -len + sta, 1.0);
- gl_Position = ViewProjectionMatrix * InstanceModelMatrix * vec4(pos * -len + sta, 1.0);
+ gl_Position = ViewProjectionMatrix * InstanceModelMatrix * pos_4d;
gl_PointSize = size;
finalColor = vec4(color, 1.0);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((InstanceModelMatrix * pos_4d).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_geom.glsl b/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_geom.glsl
index e26f419b8cd..c19598ea8ab 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_geom.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_geom.glsl
@@ -28,10 +28,18 @@ flat out vec4 finalColor;
void emitLine(vec4 color)
{
gl_Position = ProjectionMatrix * MV_pos[0];
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[0].gl_ClipDistance);
+#endif
EmitVertex();
+
gl_Position = ProjectionMatrix * MV_pos[1];
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_set_clip_distance(gl_in[1].gl_ClipDistance);
+#endif
finalColor = color;
EmitVertex();
+
EndPrimitive();
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl
index fa30c9fb1ed..3877c63d00a 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl
@@ -16,7 +16,7 @@ uniform mat4 ProjectionMatrix;
in vec3 pos;
in vec3 N1, N2; // normals of faces this edge joins (object coords)
-/* instance attrib */
+/* Instance attrs */
in vec3 color;
in mat4 InstanceModelMatrix;
@@ -37,7 +37,8 @@ void main()
mat4 ModelViewMatrix = ViewMatrix * InstanceModelMatrix;
- MV_pos = ModelViewMatrix * vec4(pos, 1.0);
+ vec4 pos_4d = vec4(pos, 1.0);
+ MV_pos = ModelViewMatrix * pos_4d;
mat3 NormalMatrix = transpose(inverse(mat3(ModelViewMatrix)));
@@ -60,4 +61,8 @@ void main()
edgeClass = -1.0; // back-facing edge
fCol = color;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((InstanceModelMatrix * vec4(pos, 1.0)).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_objectspace_variying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_objectspace_variying_color_vert.glsl
index d2b64608eaa..087fec80537 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_objectspace_variying_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_objectspace_variying_color_vert.glsl
@@ -2,11 +2,11 @@
uniform mat4 ViewMatrix;
uniform mat4 ViewProjectionMatrix;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec3 pos;
in vec3 nor;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat4 InstanceModelMatrix;
in vec4 color;
@@ -17,7 +17,7 @@ void main()
{
mat4 ModelViewProjectionMatrix = ViewProjectionMatrix * InstanceModelMatrix;
/* This is slow and run per vertex, but it's still faster than
- * doing it per instance on CPU and sending it on via instance attrib */
+ * doing it per instance on CPU and sending it on via instance attr. */
mat3 NormalMatrix = transpose(inverse(mat3(ViewMatrix * InstanceModelMatrix)));
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl
index 429b648ca53..17799281f32 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl
@@ -1,11 +1,14 @@
uniform mat4 ViewProjectionMatrix;
+#ifdef USE_WORLD_CLIP_PLANES
+uniform mat4 ModelMatrix;
+#endif
uniform vec3 screen_vecs[2];
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec3 pos; /* using Z as axis id */
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat4 InstanceModelMatrix;
in vec3 color;
in float size;
@@ -27,6 +30,11 @@ void main()
#endif
vec3 screen_pos = screen_vecs[0].xyz * pos.x + screen_vecs[1].xyz * pos.y;
- gl_Position = ViewProjectionMatrix * (InstanceModelMatrix * vec4(offset, 1.0) + vec4(screen_pos * size, 0.0));
+ vec4 pos_4d = InstanceModelMatrix * vec4(offset, 1.0) + vec4(screen_pos * size, 0.0);
+ gl_Position = ViewProjectionMatrix * pos_4d;
finalColor = vec4(color, 1.0);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_screenspace_variying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_screenspace_variying_color_vert.glsl
index 2a4675ce2c9..d2b85976d73 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_screenspace_variying_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_screenspace_variying_color_vert.glsl
@@ -4,10 +4,10 @@ uniform vec3 screen_vecs[2];
uniform float size;
uniform float pixel_size;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec2 pos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in vec3 world_pos;
in vec3 color;
@@ -26,4 +26,8 @@ void main()
vec3 screen_pos = screen_vecs[0].xyz * pos.x + screen_vecs[1].xyz * pos.y;
gl_Position = ViewProjectionMatrix * vec4(world_pos + screen_pos * size * pix_size, 1.0);
finalColor = vec4(color, 1.0);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance(world_pos);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
index 1ec158ae15c..6a55684c93c 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
@@ -1,13 +1,13 @@
uniform mat4 ViewProjectionMatrix;
-uniform float alpha;
+uniform mat4 ModelMatrix;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec3 pos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat4 InstanceModelMatrix;
-in vec3 color;
+in vec4 color;
#ifdef UNIFORM_SCALE
in float size;
#else
@@ -18,6 +18,12 @@ flat out vec4 finalColor;
void main()
{
- gl_Position = ViewProjectionMatrix * InstanceModelMatrix * vec4(pos * size, 1.0);
- finalColor = vec4(color, alpha);
+ finalColor = color;
+
+ vec4 pos_4d = vec4(pos * size, 1.0);
+ gl_Position = ViewProjectionMatrix * InstanceModelMatrix * pos_4d;
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance((ModelMatrix * InstanceModelMatrix * pos_4d).xyz);
+#endif
}
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl
index f265bf9fc01..777c1498eec 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl
@@ -2,10 +2,10 @@
uniform mat4 ViewProjectionMatrix;
uniform int baseId;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec3 pos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat4 InstanceModelMatrix;
#ifdef UNIFORM_SCALE
in float size;
diff --git a/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl
index a4facae435e..803dc4b3bcf 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_vert.glsl
@@ -1,10 +1,10 @@
uniform mat4 ViewProjectionMatrix;
-/* ---- Instantiated Attribs ---- */
+/* ---- Instantiated Attrs ---- */
in vec3 pos;
-/* ---- Per instance Attribs ---- */
+/* ---- Per instance Attrs ---- */
in mat4 InstanceModelMatrix;
void main()
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 6c7c8f24f51..422487d075d 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -3,7 +3,7 @@ uniform mat4 ModelViewMatrix;
uniform mat4 ModelViewMatrixInverse;
uniform mat3 NormalMatrix;
-#ifndef ATTRIB
+#ifndef USE_ATTR
uniform mat4 ModelMatrix;
uniform mat4 ModelMatrixInverse;
#endif
@@ -479,16 +479,49 @@ void curves_vec(float fac, vec3 vec, sampler1DArray curvemap, float layer, out v
outvec = mix(vec, outvec, fac);
}
-void curves_rgb(float fac, vec4 col, sampler1DArray curvemap, float layer, out vec4 outcol)
+/* ext is vec4(in_x, in_dy, out_x, out_dy). */
+float curve_extrapolate(float x, float y, vec4 ext)
{
- vec4 co = vec4(col.rgb, layer);
- co.x = texture(curvemap, co.xw).a;
- co.y = texture(curvemap, co.yw).a;
- co.z = texture(curvemap, co.zw).a;
- outcol.r = texture(curvemap, co.xw).r;
- outcol.g = texture(curvemap, co.yw).g;
- outcol.b = texture(curvemap, co.zw).b;
+ if (x < 0.0) {
+ return y + x * ext.y;
+ }
+ else if (x > 1.0) {
+ return y + (x - 1.0) * ext.w;
+ }
+ else {
+ return y;
+ }
+}
+
+#define RANGE_RESCALE(x, min, range) ((x - min) * range)
+
+void curves_rgb(
+ float fac, vec4 col, sampler1DArray curvemap, float layer,
+ vec4 range, vec4 ext_r, vec4 ext_g, vec4 ext_b, vec4 ext_a,
+ out vec4 outcol)
+{
+ vec4 co = vec4(RANGE_RESCALE(col.rgb, ext_a.x, range.a), layer);
+ vec3 samp;
+ samp.r = texture(curvemap, co.xw).a;
+ samp.g = texture(curvemap, co.yw).a;
+ samp.b = texture(curvemap, co.zw).a;
+
+ samp.r = curve_extrapolate(co.x, samp.r, ext_a);
+ samp.g = curve_extrapolate(co.y, samp.g, ext_a);
+ samp.b = curve_extrapolate(co.z, samp.b, ext_a);
+
+ vec3 rgb_min = vec3(ext_r.x, ext_g.x, ext_b.x);
+ co.xyz = RANGE_RESCALE(samp.rgb, rgb_min, range.rgb);
+
+ samp.r = texture(curvemap, co.xw).r;
+ samp.g = texture(curvemap, co.yw).g;
+ samp.b = texture(curvemap, co.zw).b;
+
+ outcol.r = curve_extrapolate(co.x, samp.r, ext_r);
+ outcol.g = curve_extrapolate(co.y, samp.g, ext_g);
+ outcol.b = curve_extrapolate(co.z, samp.b, ext_b);
outcol.a = col.a;
+
outcol = mix(col, outcol, fac);
}
@@ -856,12 +889,9 @@ void hue_sat(float hue, float sat, float value, float fac, vec4 col, out vec4 ou
rgb_to_hsv(col, hsv);
- hsv[0] += (hue - 0.5);
- if (hsv[0] > 1.0) hsv[0] -= 1.0; else if (hsv[0] < 0.0) hsv[0] += 1.0;
- hsv[1] *= sat;
- if (hsv[1] > 1.0) hsv[1] = 1.0; else if (hsv[1] < 0.0) hsv[1] = 0.0;
- hsv[2] *= value;
- if (hsv[2] > 1.0) hsv[2] = 1.0; else if (hsv[2] < 0.0) hsv[2] = 0.0;
+ hsv[0] = fract(hsv[0] + hue + 0.5);
+ hsv[1] = clamp(hsv[1] * sat, 0.0, 1.0);
+ hsv[2] = hsv[2] * value;
hsv_to_rgb(hsv, outcol);
@@ -1059,9 +1089,9 @@ float cellnoise(vec3 p)
vec3 cellnoise_color(vec3 p)
{
- float r = cellnoise(p);
- float g = cellnoise(vec3(p.y, p.x, p.z));
- float b = cellnoise(vec3(p.y, p.z, p.x));
+ float r = cellnoise(p.xyz);
+ float g = cellnoise(p.yxz);
+ float b = cellnoise(p.yzx);
return vec3(r, g, b);
}
@@ -1092,6 +1122,8 @@ void convert_metallic_to_specular_tinted(
vec3 principled_sheen(float NV, vec3 basecol_tint, float sheen_tint)
{
float f = 1.0 - NV;
+ /* Temporary fix for T59784. Normal map seems to contain NaNs for tangent space normal maps, therefore we need to clamp value. */
+ f = clamp(f, 0.0, 1.0);
/* Empirical approximation (manual curve fitting). Can be refined. */
float sheen = f*f*f*0.077 + f*0.01 + 0.00026;
return sheen * mix(vec3(1.0), basecol_tint, sheen_tint);
@@ -2758,16 +2790,16 @@ void node_tex_voronoi(vec3 co, float scale, float exponent, float coloring, floa
vec3 pd = p - (vp + ip);
float d = 0.0;
- if (metric == 0) { /* SHD_VORONOI_DISTANCE 0 */
+ if (metric == 0.0) { /* SHD_VORONOI_DISTANCE 0 */
d = dot(pd, pd);
}
- else if (metric == 1) { /* SHD_VORONOI_MANHATTAN 1 */
+ else if (metric == 1.0) { /* SHD_VORONOI_MANHATTAN 1 */
d = abs(pd[0]) + abs(pd[1]) + abs(pd[2]);
}
- else if (metric == 2) { /* SHD_VORONOI_CHEBYCHEV 2 */
+ else if (metric == 2.0) { /* SHD_VORONOI_CHEBYCHEV 2 */
d = max(abs(pd[0]), max(abs(pd[1]), abs(pd[2])));
}
- else if (metric == 3) { /* SHD_VORONOI_MINKOWSKI 3 */
+ else if (metric == 3.0) { /* SHD_VORONOI_MINKOWSKI 3 */
d = pow(pow(abs(pd[0]), exponent) + pow(abs(pd[1]), exponent) + pow(abs(pd[2]), exponent), 1.0/exponent);
}
@@ -2808,43 +2840,43 @@ void node_tex_voronoi(vec3 co, float scale, float exponent, float coloring, floa
if (coloring == 0.0) {
/* Intensity output */
- if (feature == 0) { /* F1 */
+ if (feature == 0.0) { /* F1 */
fac = abs(da[0]);
}
- else if (feature == 1) { /* F2 */
+ else if (feature == 1.0) { /* F2 */
fac = abs(da[1]);
}
- else if (feature == 2) { /* F3 */
+ else if (feature == 2.0) { /* F3 */
fac = abs(da[2]);
}
- else if (feature == 3) { /* F4 */
+ else if (feature == 3.0) { /* F4 */
fac = abs(da[3]);
}
- else if (feature == 4) { /* F2F1 */
+ else if (feature == 4.0) { /* F2F1 */
fac = abs(da[1] - da[0]);
}
- color = vec4(fac, fac, fac, 1);
+ color = vec4(fac, fac, fac, 1.0);
}
else {
/* Color output */
vec3 col = vec3(fac, fac, fac);
- if (feature == 0) { /* F1 */
+ if (feature == 0.0) { /* F1 */
col = pa[0];
}
- else if (feature == 1) { /* F2 */
+ else if (feature == 1.0) { /* F2 */
col = pa[1];
}
- else if (feature == 2) { /* F3 */
+ else if (feature == 2.0) { /* F3 */
col = pa[2];
}
- else if (feature == 3) { /* F4 */
+ else if (feature == 3.0) { /* F4 */
col = pa[3];
}
- else if (feature == 4) { /* F2F1 */
+ else if (feature == 4.0) { /* F2F1 */
col = abs(pa[1] - pa[0]);
}
- color = vec4(cellnoise_color(col), 1);
+ color = vec4(cellnoise_color(col), 1.0);
fac = (color.x + color.y + color.z) * (1.0 / 3.0);
}
}
diff --git a/source/blender/gpu/shaders/gpu_shader_selection_id_frag.glsl b/source/blender/gpu/shaders/gpu_shader_selection_id_frag.glsl
new file mode 100644
index 00000000000..a38113fad87
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_selection_id_frag.glsl
@@ -0,0 +1,21 @@
+
+#ifdef UNIFORM_ID
+uniform uint id;
+#else
+flat in vec4 id;
+#endif
+
+out vec4 fragColor;
+
+void main()
+{
+#ifdef UNIFORM_ID
+ fragColor = vec4(
+ ((id ) & 0xFFu) * (1.0f / 255.0f),
+ ((id >> 8u) & 0xFFu) * (1.0f / 255.0f),
+ ((id >> 16u) & 0xFFu) * (1.0f / 255.0f),
+ ((id >> 24u) ) * (1.0f / 255.0f));
+#else
+ fragColor = id;
+#endif
+}
diff --git a/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl
index 118a661863d..f6f0f5b83ec 100644
--- a/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl
@@ -18,4 +18,8 @@ void main()
#else
fragColor = color;
#endif
+
+#if defined(USE_BACKGROUND)
+ gl_FragDepth = 1.0;
+#endif
}
diff --git a/source/blender/ikplugin/BIK_api.h b/source/blender/ikplugin/BIK_api.h
index 07a223b738e..77571dc631f 100644
--- a/source/blender/ikplugin/BIK_api.h
+++ b/source/blender/ikplugin/BIK_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Original author: Benoit Bolsee
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/ikplugin/BIK_api.h
- * \ingroup ikplugin
+/** \file
+ * \ingroup ikplugin
*/
@@ -38,12 +30,12 @@
extern "C" {
#endif
+struct Depsgraph;
struct Object;
-struct bPoseChannel;
-struct bPose;
struct Scene;
struct bConstraint;
-struct Depsgraph;
+struct bPose;
+struct bPoseChannel;
enum BIK_ParamType {
BIK_PARAM_TYPE_FLOAT = 0,
diff --git a/source/blender/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt
index eb34e50715e..648486072f0 100644
--- a/source/blender/ikplugin/CMakeLists.txt
+++ b/source/blender/ikplugin/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
remove_extra_strict_flags()
diff --git a/source/blender/ikplugin/intern/ikplugin_api.c b/source/blender/ikplugin/intern/ikplugin_api.c
index 80de0beb9f4..3b658a4f822 100644
--- a/source/blender/ikplugin/intern/ikplugin_api.c
+++ b/source/blender/ikplugin/intern/ikplugin_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,14 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Original author: Benoit Bolsee
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/ikplugin/intern/ikplugin_api.c
- * \ingroup ikplugin
+/** \file
+ * \ingroup ikplugin
*/
#include "BIK_api.h"
-#include "BLI_blenlib.h"
#include "DNA_object_types.h"
#include "DNA_action_types.h"
diff --git a/source/blender/ikplugin/intern/ikplugin_api.h b/source/blender/ikplugin/intern/ikplugin_api.h
index 139a50f44f0..a58fc4c4d25 100644
--- a/source/blender/ikplugin/intern/ikplugin_api.h
+++ b/source/blender/ikplugin/intern/ikplugin_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Original author: Benoit Bolsee
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/ikplugin/intern/ikplugin_api.h
- * \ingroup ikplugin
+/** \file
+ * \ingroup ikplugin
*/
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index 0baaa406201..ddb8b37afc2 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Original author: Benoit Bolsee
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/ikplugin/intern/iksolver_plugin.c
- * \ingroup ikplugin
+/** \file
+ * \ingroup ikplugin
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.h b/source/blender/ikplugin/intern/iksolver_plugin.h
index 09eb7139192..63719440372 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.h
+++ b/source/blender/ikplugin/intern/iksolver_plugin.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Original author: Benoit Bolsee
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/ikplugin/intern/iksolver_plugin.h
- * \ingroup ikplugin
+/** \file
+ * \ingroup ikplugin
*/
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index 4a71b36bfef..dbda188c96c 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Original author: Benoit Bolsee
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/ikplugin/intern/itasc_plugin.cpp
- * \ingroup ikplugin
+/** \file
+ * \ingroup ikplugin
*/
#include <stdlib.h>
@@ -233,7 +225,7 @@ enum IK_SegmentAxis {
IK_Z = 2,
IK_TRANS_X = 3,
IK_TRANS_Y = 4,
- IK_TRANS_Z = 5
+ IK_TRANS_Z = 5,
};
static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *con)
diff --git a/source/blender/ikplugin/intern/itasc_plugin.h b/source/blender/ikplugin/intern/itasc_plugin.h
index 2853ae095db..9e9adf74241 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.h
+++ b/source/blender/ikplugin/intern/itasc_plugin.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
* Original author: Benoit Bolsee
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/ikplugin/intern/itasc_plugin.h
- * \ingroup ikplugin
+/** \file
+ * \ingroup ikplugin
*/
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index 8d932c5e79d..dd020ffe1f2 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -140,9 +135,9 @@ if(WITH_CODEC_FFMPEG)
add_definitions(-DWITH_FFMPEG)
remove_strict_c_flags_file(
+ intern/anim_movie.c
intern/indexer.c
intern/util.c
- intern/anim_movie.c
)
endif()
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index 437a699208b..c042e17cf80 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,13 @@
*
* The Original Code is Copyright (C) 2012 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Xavier Thomas,
- * Lukas Toenne,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __IMB_COLORMANAGEMENT_H__
#define __IMB_COLORMANAGEMENT_H__
-/** \file blender/imbuf/IMB_colormanagement.h
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include "BLI_sys_types.h"
@@ -41,24 +30,24 @@
#define BCM_CONFIG_FILE "config.ocio"
-struct bContext;
struct ColorManagedColorspaceSettings;
struct ColorManagedDisplaySettings;
struct ColorManagedViewSettings;
struct ColormanageProcessor;
struct EnumPropertyItem;
struct ImBuf;
-struct Main;
struct ImageFormatData;
+struct Main;
+struct bContext;
-struct ColorSpace;
struct ColorManagedDisplay;
+struct ColorSpace;
/* ** Generic functions ** */
void IMB_colormanagement_check_file_config(struct Main *bmain);
-void IMB_colormanagement_validate_settings(struct ColorManagedDisplaySettings *display_settings,
+void IMB_colormanagement_validate_settings(const struct ColorManagedDisplaySettings *display_settings,
struct ColorManagedViewSettings *view_settings);
const char *IMB_colormanagement_role_colorspace_name_get(int role);
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 1dfbae38213..81050841550 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/IMB_imbuf.h
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
/**
@@ -36,8 +28,6 @@
* \ingroup imbuf
*
* \page IMB Imbuf module external interface
- *
- *
* \section imb_about About the IMB module
*
* External interface of the IMage Buffer module. This module offers
@@ -209,7 +199,7 @@ typedef enum IMB_BlendMode {
IMB_BLEND_COPY = 1000,
IMB_BLEND_COPY_RGB = 1001,
- IMB_BLEND_COPY_ALPHA = 1002
+ IMB_BLEND_COPY_ALPHA = 1002,
} IMB_BlendMode;
void IMB_blend_color_byte(unsigned char dst[4], unsigned char src1[4],
@@ -249,7 +239,7 @@ typedef enum IMB_Timecode_Type {
* device (*every* consumer camcorder can do
* that :) )*/
IMB_TC_RECORD_RUN_NO_GAPS = 8,
- IMB_TC_MAX_SLOT = 4
+ IMB_TC_MAX_SLOT = 4,
} IMB_Timecode_Type;
typedef enum IMB_Proxy_Size {
@@ -258,7 +248,7 @@ typedef enum IMB_Proxy_Size {
IMB_PROXY_50 = 2,
IMB_PROXY_75 = 4,
IMB_PROXY_100 = 8,
- IMB_PROXY_MAX_SLOT = 4
+ IMB_PROXY_MAX_SLOT = 4,
} IMB_Proxy_Size;
/* defaults to BL_proxy within the directory of the animation */
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index d407845e45d..d6e33d0d186 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __IMB_IMBUF_TYPES_H__
@@ -30,8 +22,7 @@
#include "DNA_vec_types.h" /* for rcti */
-/**
- * \file IMB_imbuf_types.h
+/** \file
* \ingroup imbuf
* \brief Contains defines and structs used throughout the imbuf module.
* \todo Clean up includes.
@@ -51,10 +42,14 @@
#define IMB_FILENAME_SIZE 1024
typedef struct DDSData {
- unsigned int fourcc; /* DDS fourcc info */
- unsigned int nummipmaps; /* The number of mipmaps in the dds file */
- unsigned char *data; /* The compressed image data */
- unsigned int size; /* The size of the compressed data */
+ /** DDS fourcc info */
+ unsigned int fourcc;
+ /** The number of mipmaps in the dds file */
+ unsigned int nummipmaps;
+ /** The compressed image data */
+ unsigned char *data;
+ /** The size of the compressed data */
+ unsigned int size;
} DDSData;
/**
@@ -63,12 +58,15 @@ typedef struct DDSData {
* imbuf operations.
*
* Also; add new variables to the end to save pain!
- *
*/
-/* ibuf->ftype flag, main image types */
-/* Warning: Keep explicit value assignments here, this file is included in areas where not all format defines
- * are set (e.g. intern/dds only get WITH_DDS, even if TIFF, HDR etc are also defined). See T46524. */
+
+/* Warning: Keep explicit value assignments here,
+ * this file is included in areas where not all format defines are set
+ * (e.g. intern/dds only get WITH_DDS, even if TIFF, HDR etc are also defined).
+ * See T46524. */
+
+/** #ImBuf.ftype flag, main image types. */
enum eImbTypes {
IMB_FTYPE_PNG = 1,
IMB_FTYPE_TGA = 2,
@@ -136,24 +134,30 @@ enum eImbTypes {
typedef struct ImbFormatOptions {
short flag;
- char quality; /* quality serves dual purpose as quality number for jpeg or compression amount for png */
+ /** quality serves dual purpose as quality number for jpeg or compression amount for png */
+ char quality;
} ImbFormatOptions;
typedef struct ImBuf {
struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
/* dimensions */
- int x, y; /* width and Height of our image buffer.
- * Should be 'unsigned int' since most formats use this.
- * but this is problematic with texture math in imagetexture.c
- * avoid problems and use int. - campbell */
+ /** Width and Height of our image buffer.
+ * Should be 'unsigned int' since most formats use this.
+ * but this is problematic with texture math in imagetexture.c
+ * avoid problems and use int. - campbell */
+ int x, y;
- unsigned char planes; /* Active amount of bits/bitplanes */
- int channels; /* amount of channels in rect_float (0 = 4 channel default) */
+ /** Active amount of bits/bitplanes */
+ unsigned char planes;
+ /** Number of channels in `rect_float` (0 = 4 channel default) */
+ int channels;
/* flags */
- int flags; /* Controls which components should exist. */
- int mall; /* what is malloced internal, and can be freed */
+ /** Controls which components should exist. */
+ int flags;
+ /** what is malloced internal, and can be freed */
+ int mall;
/* pixels */
@@ -179,42 +183,63 @@ typedef struct ImBuf {
unsigned int **tiles;
/* zbuffer */
- int *zbuf; /* z buffer data, original zbuffer */
- float *zbuf_float; /* z buffer data, camera coordinates */
+ /** z buffer data, original zbuffer */
+ int *zbuf;
+ /** z buffer data, camera coordinates */
+ float *zbuf_float;
/* parameters used by conversion between byte and float */
- float dither; /* random dither value, for conversion from float -> byte rect */
+ /** random dither value, for conversion from float -> byte rect */
+ float dither;
/* mipmapping */
- struct ImBuf *mipmap[IMB_MIPMAP_LEVELS]; /* MipMap levels, a series of halved images */
+ /** MipMap levels, a series of halved images */
+ struct ImBuf *mipmap[IMB_MIPMAP_LEVELS];
int miptot, miplevel;
/* externally used data */
- int index; /* reference index for ImBuf lists */
- int userflags; /* used to set imbuf to dirty and other stuff */
- struct IDProperty *metadata; /* image metadata */
- void *userdata; /* temporary storage */
+ /** reference index for ImBuf lists */
+ int index;
+ /** used to set imbuf to dirty and other stuff */
+ int userflags;
+ /** image metadata */
+ struct IDProperty *metadata;
+ /** temporary storage */
+ void *userdata;
/* file information */
- enum eImbTypes ftype; /* file type we are going to save as */
- ImbFormatOptions foptions; /* file format specific flags */
- char name[IMB_FILENAME_SIZE]; /* filename associated with this image */
- char cachename[IMB_FILENAME_SIZE]; /* full filename used for reading from cache */
+ /** file type we are going to save as */
+ enum eImbTypes ftype;
+ /** file format specific flags */
+ ImbFormatOptions foptions;
+ /** filename associated with this image */
+ char name[IMB_FILENAME_SIZE];
+ /** full filename used for reading from cache */
+ char cachename[IMB_FILENAME_SIZE];
/* memory cache limiter */
- struct MEM_CacheLimiterHandle_s *c_handle; /* handle for cache limiter */
- int refcounter; /* reference counter for multiple users */
+ /** handle for cache limiter */
+ struct MEM_CacheLimiterHandle_s *c_handle;
+ /** reference counter for multiple users */
+ int refcounter;
/* some parameters to pass along for packing images */
- unsigned char *encodedbuffer; /* Compressed image only used with png currently */
- unsigned int encodedsize; /* Size of data written to encodedbuffer */
- unsigned int encodedbuffersize; /* Size of encodedbuffer */
+ /** Compressed image only used with png currently */
+ unsigned char *encodedbuffer;
+ /** Size of data written to encodedbuffer */
+ unsigned int encodedsize;
+ /** Size of encodedbuffer */
+ unsigned int encodedbuffersize;
/* color management */
- struct ColorSpace *rect_colorspace; /* color space of byte buffer */
- struct ColorSpace *float_colorspace; /* color space of float buffer, used by sequencer only */
- unsigned int *display_buffer_flags; /* array of per-display display buffers dirty flags */
- struct ColormanageCache *colormanage_cache; /* cache used by color management */
+ /** color space of byte buffer */
+ struct ColorSpace *rect_colorspace;
+ /** color space of float buffer, used by sequencer only */
+ struct ColorSpace *float_colorspace;
+ /** array of per-display display buffers dirty flags */
+ unsigned int *display_buffer_flags;
+ /** cache used by color management */
+ struct ColormanageCache *colormanage_cache;
int colormanage_flag;
rcti invalid_rect;
@@ -226,11 +251,18 @@ typedef struct ImBuf {
* \brief userflags: Flags used internally by blender for imagebuffers
*/
-#define IB_BITMAPDIRTY (1 << 1) /* image needs to be saved is not the same as filename */
-#define IB_MIPMAP_INVALID (1 << 2) /* image mipmaps are invalid, need recreate */
-#define IB_RECT_INVALID (1 << 3) /* float buffer changed, needs recreation of byte rect */
-#define IB_DISPLAY_BUFFER_INVALID (1 << 4) /* either float or byte buffer changed, need to re-calculate display buffers */
-#define IB_PERSISTENT (1 << 5) /* image buffer is persistent in the memory and should never be removed from the cache */
+enum {
+ /** image needs to be saved is not the same as filename */
+ IB_BITMAPDIRTY = (1 << 1),
+ /** image mipmaps are invalid, need recreate */
+ IB_MIPMAP_INVALID = (1 << 2),
+ /** float buffer changed, needs recreation of byte rect */
+ IB_RECT_INVALID = (1 << 3),
+ /** either float or byte buffer changed, need to re-calculate display buffers */
+ IB_DISPLAY_BUFFER_INVALID = (1 << 4),
+ /** image buffer is persistent in the memory and should never be removed from the cache */
+ IB_PERSISTENT = (1 << 5),
+};
/**
* \name Imbuf Component flags
@@ -238,22 +270,27 @@ typedef struct ImBuf {
*
* \{ */
-#define IB_rect (1 << 0)
-#define IB_test (1 << 1)
-#define IB_zbuf (1 << 3)
-#define IB_mem (1 << 4)
-#define IB_rectfloat (1 << 5)
-#define IB_zbuffloat (1 << 6)
-#define IB_multilayer (1 << 7)
-#define IB_metadata (1 << 8)
-#define IB_animdeinterlace (1 << 9)
-#define IB_tiles (1 << 10)
-#define IB_tilecache (1 << 11)
-#define IB_alphamode_premul (1 << 12) /* indicates whether image on disk have premul alpha */
-#define IB_alphamode_detect (1 << 13) /* if this flag is set, alpha mode would be guessed from file */
-#define IB_ignore_alpha (1 << 14) /* ignore alpha on load and substitute it with 1.0f */
-#define IB_thumbnail (1 << 15)
-#define IB_multiview (1 << 16)
+enum {
+ IB_rect = 1 << 0,
+ IB_test = 1 << 1,
+ IB_zbuf = 1 << 3,
+ IB_mem = 1 << 4,
+ IB_rectfloat = 1 << 5,
+ IB_zbuffloat = 1 << 6,
+ IB_multilayer = 1 << 7,
+ IB_metadata = 1 << 8,
+ IB_animdeinterlace = 1 << 9,
+ IB_tiles = 1 << 10,
+ IB_tilecache = 1 << 11,
+ /** indicates whether image on disk have premul alpha */
+ IB_alphamode_premul = 1 << 12,
+ /** if this flag is set, alpha mode would be guessed from file */
+ IB_alphamode_detect = 1 << 13,
+ /** ignore alpha on load and substitute it with 1.0f */
+ IB_ignore_alpha = 1 << 14,
+ IB_thumbnail = 1 << 15,
+ IB_multiview = 1 << 16,
+};
/** \} */
@@ -305,7 +342,7 @@ extern const char *imb_ext_image_filepath_only[];
* \{ */
enum {
- IMB_COLORMANAGE_IS_DATA = (1 << 0)
+ IMB_COLORMANAGE_IS_DATA = (1 << 0),
};
/** \} */
diff --git a/source/blender/imbuf/IMB_metadata.h b/source/blender/imbuf/IMB_metadata.h
index 0321d5ef0fb..d4e8dc1a3b6 100644
--- a/source/blender/imbuf/IMB_metadata.h
+++ b/source/blender/imbuf/IMB_metadata.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,19 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Austin Benesh. Ton Roosendaal.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/IMB_metadata.h
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#ifndef __IMB_METADATA_H__
#define __IMB_METADATA_H__
-struct anim;
-struct ImBuf;
struct IDProperty;
+struct ImBuf;
+struct anim;
/** The metadata is a list of key/value pairs (both char *) that can me
* saved in the header of several image formats.
@@ -54,25 +46,29 @@ void IMB_metadata_ensure(struct IDProperty **metadata);
void IMB_metadata_free(struct IDProperty *metadata);
/** Read the field from the image info into the field.
- * \param metadata: the IDProperty that contains the metadata
- * \param key: the key of the field
- * \param value: the data in the field, first one found with key is returned,
+ * \param metadata: the IDProperty that contains the metadata
+ * \param key: the key of the field
+ * \param value: the data in the field, first one found with key is returned,
* memory has to be allocated by user.
- * \param len: length of value buffer allocated by user.
- * \return - 1 (true) if metadata is present and value for the key found, 0 (false) otherwise
+ * \param len: length of value buffer allocated by user.
+ * \return - 1 (true) if metadata is present and value for the key found, 0 (false) otherwise
*/
bool IMB_metadata_get_field(struct IDProperty *metadata, const char *key, char *value, const size_t len);
/** Set user data in the metadata.
* If the field already exists its value is overwritten, otherwise the field
* will be added with the given value.
- * \param metadata: the IDProperty that contains the metadata
- * \param key: the key of the field
- * \param value: the data to be written to the field. zero terminated string
+ * \param metadata: the IDProperty that contains the metadata
+ * \param key: the key of the field
+ * \param value: the data to be written to the field. zero terminated string
*/
void IMB_metadata_set_field(struct IDProperty *metadata, const char *key, const char *value);
void IMB_metadata_copy(struct ImBuf *dimb, struct ImBuf *simb);
struct IDProperty *IMB_anim_load_metadata(struct anim *anim);
+/* Invoke callback for every value stored in the metadata. */
+typedef void (*IMBMetadataForeachCb)(const char *field, const char *value, void *userdata);
+void IMB_metadata_foreach(struct ImBuf *ibuf, IMBMetadataForeachCb callback, void *userdata);
+
#endif /* __IMB_METADATA_H__ */
diff --git a/source/blender/imbuf/IMB_moviecache.h b/source/blender/imbuf/IMB_moviecache.h
index 0c72d1b4f01..706c7b1a7db 100644
--- a/source/blender/imbuf/IMB_moviecache.h
+++ b/source/blender/imbuf/IMB_moviecache.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __IMB_MOVIECACHE_H__
#define __IMB_MOVIECACHE_H__
-/** \file IMB_moviecache.h
- * \ingroup imbuf
- * \author Sergey Sharybin
+/** \file
+ * \ingroup imbuf
*/
#include "BLI_utildefines.h"
diff --git a/source/blender/imbuf/IMB_thumbs.h b/source/blender/imbuf/IMB_thumbs.h
index f86bfa23692..cc00f50a209 100644
--- a/source/blender/imbuf/IMB_thumbs.h
+++ b/source/blender/imbuf/IMB_thumbs.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Andrea Weikert.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/IMB_thumbs.h
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
diff --git a/source/blender/imbuf/intern/IMB_allocimbuf.h b/source/blender/imbuf/intern/IMB_allocimbuf.h
index 75854926d30..c252a9a63f8 100644
--- a/source/blender/imbuf/intern/IMB_allocimbuf.h
+++ b/source/blender/imbuf/intern/IMB_allocimbuf.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,9 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/**
- * \file IMB_allocimbuf.h
+/** \file
* \ingroup imbuf
* \brief Header file for allocimbuf.c
*/
diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h
index 804095a0727..a0a8a938870 100644
--- a/source/blender/imbuf/intern/IMB_anim.h
+++ b/source/blender/imbuf/intern/IMB_anim.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/IMB_anim.h
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
@@ -86,14 +78,13 @@
#define ANIM_SEQUENCE (1 << 0)
#define ANIM_MOVIE (1 << 4)
#define ANIM_AVI (1 << 6)
-#define ANIM_QTIME (1 << 7)
#define ANIM_FFMPEG (1 << 8)
#define MAXNUMSTREAMS 50
+struct IDProperty;
struct _AviMovie;
struct anim_index;
-struct IDProperty;
struct anim {
int ib_flags;
diff --git a/source/blender/imbuf/intern/IMB_colormanagement_intern.h b/source/blender/imbuf/intern/IMB_colormanagement_intern.h
index ee3d207a8db..7ab36b69704 100644
--- a/source/blender/imbuf/intern/IMB_colormanagement_intern.h
+++ b/source/blender/imbuf/intern/IMB_colormanagement_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,20 @@
*
* The Original Code is Copyright (C) 2012 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Xavier Thomas,
- * Lukas Toenne,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __IMB_COLORMANAGEMENT_INTERN_H__
#define __IMB_COLORMANAGEMENT_INTERN_H__
-/** \file IMB_colormanagement_intern.h
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include "DNA_listBase.h"
#include "BLI_sys_types.h"
-struct OCIO_ConstProcessorRcPtr;
struct ImBuf;
+struct OCIO_ConstProcessorRcPtr;
extern float imbuf_luma_coefficients[3];
extern float imbuf_xyz_to_rgb[3][3];
diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h
index 5351b00d301..8ce1a293d0f 100644
--- a/source/blender/imbuf/intern/IMB_filetype.h
+++ b/source/blender/imbuf/intern/IMB_filetype.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation 2010.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/IMB_filetype.h
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
diff --git a/source/blender/imbuf/intern/IMB_filter.h b/source/blender/imbuf/intern/IMB_filter.h
index 36a2dc31021..2cd785e6889 100644
--- a/source/blender/imbuf/intern/IMB_filter.h
+++ b/source/blender/imbuf/intern/IMB_filter.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,9 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/**
- * \file IMB_filter.h
+/** \file
* \ingroup imbuf
* \brief Function declarations for filter.c
*/
diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h
index 024801cb870..02ba846d148 100644
--- a/source/blender/imbuf/intern/IMB_indexer.h
+++ b/source/blender/imbuf/intern/IMB_indexer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,14 @@
* 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): Peter Schlaile
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __IMB_INDEXER_H__
#define __IMB_INDEXER_H__
-/** \file IMB_indexer.h
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#ifdef WIN32
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index f7005d7ee89..ac284657c5c 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/allocimbuf.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 7f33a95953b..ec22b8d8a2a 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/anim_movie.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c
index edaa57eedf2..d92e6f4ffcb 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/bmp.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include "BLI_utildefines.h"
diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c
index e8beaa9d68f..92e9d21bb65 100644
--- a/source/blender/imbuf/intern/cache.c
+++ b/source/blender/imbuf/intern/cache.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/cache.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/imbuf/intern/cineon/CMakeLists.txt b/source/blender/imbuf/intern/cineon/CMakeLists.txt
index f15839f5eb7..2a592aba860 100644
--- a/source/blender/imbuf/intern/cineon/CMakeLists.txt
+++ b/source/blender/imbuf/intern/cineon/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index c116d32b2f0..2db7668c0ca 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,21 +13,11 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Julien Enche.
- *
- * ***** END GPL LICENSE BLOCK *****
- * cineon.c
- * contributors: joeedh, Julien Enche
- * I hearby donate this code and all rights to the Blender Foundation.
+ * The Original Code is Copyright (C) 2006 Blender Foundation.
*/
-/** \file blender/imbuf/intern/cineon/cineon_dpx.c
- * \ingroup imbcineon
+/** \file
+ * \ingroup imbcineon
*/
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index 50d0e843890..d9f1c92fdde 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -1,28 +1,25 @@
/*
- * Cineon image file format library routines.
- *
- * Copyright 1999,2000,2001 David Hodson <hodsond@acm.org>
- *
- * 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 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.
+ * 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): Julien Enche.
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Copyright 1999,2000,2001 David Hodson <hodsond@acm.org>
*/
-/** \file blender/imbuf/intern/cineon/cineonlib.c
- * \ingroup imbcineon
+/** \file
+ * \ingroup imbcineon
+ *
+ * Cineon image file format library routines.
*/
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.h b/source/blender/imbuf/intern/cineon/cineonlib.h
index 775572debaf..fddef8e658f 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.h
+++ b/source/blender/imbuf/intern/cineon/cineonlib.h
@@ -1,29 +1,26 @@
/*
- * Cineon image file format library definitions.
- * Also handles DPX files (almost)
- *
- * Copyright 1999,2000,2001 David Hodson <hodsond@acm.org>
- *
- * 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 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.
+ * 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): Julien Enche.
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Copyright 1999,2000,2001 David Hodson <hodsond@acm.org>
*/
-/** \file blender/imbuf/intern/cineon/cineonlib.h
- * \ingroup imbcineon
+/** \file
+ * \ingroup imbcineon
+ *
+ * Cineon image file format library definitions.
+ * Also handles DPX files (almost)
*/
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index d29518fc5bc..7ffe259186d 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -1,28 +1,25 @@
/*
- * Dpx image file format library routines.
- *
- * Copyright 1999 - 2002 David Hodson <hodsond@acm.org>
- *
- * 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 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.
+ * 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): Julien Enche.
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Copyright 1999 - 2002 David Hodson <hodsond@acm.org>
*/
-/** \file blender/imbuf/intern/cineon/dpxlib.c
- * \ingroup imbcineon
+/** \file
+ * \ingroup imbcineon
+ *
+ * Dpx image file format library routines.
*/
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.h b/source/blender/imbuf/intern/cineon/dpxlib.h
index 2b90d8c5e07..fe9f34901b8 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.h
+++ b/source/blender/imbuf/intern/cineon/dpxlib.h
@@ -1,8 +1,4 @@
/*
- * DPX image file format library definitions.
- *
- * Copyright 1999 - 2002 David Hodson <hodsond@acm.org>
- *
* 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)
@@ -17,12 +13,13 @@
* 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): Julien Enche.
- *
+ * Copyright 1999 - 2002 David Hodson <hodsond@acm.org>
*/
-/** \file blender/imbuf/intern/cineon/dpxlib.h
- * \ingroup imbcineon
+/** \file
+ * \ingroup imbcineon
+ *
+ * DPX image file format library definitions.
*/
diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c
index 614323d0d11..3dcf1814f27 100644
--- a/source/blender/imbuf/intern/cineon/logImageCore.c
+++ b/source/blender/imbuf/intern/cineon/logImageCore.c
@@ -1,28 +1,25 @@
/*
- * Cineon image file format library routines.
- *
- * Copyright 1999,2000,2001 David Hodson <hodsond@acm.org>
- *
- * 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 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.
+ * 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): Julien Enche.
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Copyright 1999,2000,2001 David Hodson <hodsond@acm.org>
*/
-/** \file blender/imbuf/intern/cineon/logImageCore.c
- * \ingroup imbcineon
+/** \file
+ * \ingroup imbcineon
+ *
+ * Cineon image file format library routines.
*/
diff --git a/source/blender/imbuf/intern/cineon/logImageCore.h b/source/blender/imbuf/intern/cineon/logImageCore.h
index b6f4fff73f6..07fe6e22d40 100644
--- a/source/blender/imbuf/intern/cineon/logImageCore.h
+++ b/source/blender/imbuf/intern/cineon/logImageCore.h
@@ -1,33 +1,30 @@
/*
- * Cineon image file format library definitions.
- * Cineon and DPX common structures.
- *
- * This header file contains private details.
- * User code should generally use cineonlib.h and dpxlib.h only.
- * Hmm. I thought the two formats would have more in common!
- *
- * Copyright 1999,2000,2001 David Hodson <hodsond@acm.org>
- *
- * 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 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.
+ * 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): Julien Enche.
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Copyright 1999,2000,2001 David Hodson <hodsond@acm.org>
*/
-/** \file blender/imbuf/intern/cineon/logImageCore.h
- * \ingroup imbcineon
+/** \file
+ * \ingroup imbcineon
+ *
+ * Cineon image file format library definitions.
+ * Cineon and DPX common structures.
+ *
+ * This header file contains private details.
+ * User code should generally use cineonlib.h and dpxlib.h only.
+ * Hmm. I thought the two formats would have more in common!
*/
#ifndef __LOGIMAGECORE_H__
@@ -49,7 +46,7 @@ extern "C" {
/* There are some differences between DPX and Cineon so we need to know from what type of file the datas come from */
enum format {
format_DPX,
- format_Cineon
+ format_Cineon,
};
typedef struct LogImageElement {
@@ -125,7 +122,7 @@ enum transfer {
transfer_NTSC,
transfer_PAL,
transfer_ZLinear,
- transfer_Homogeneous
+ transfer_Homogeneous,
};
/* The SMPTE defines this code:
@@ -179,7 +176,7 @@ enum descriptor {
descriptor_UserDefined7Elt,
descriptor_UserDefined8Elt,
/* following descriptors are for internal use only */
- descriptor_YA
+ descriptor_YA,
};
/* int functions return 0 for OK */
diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c
index e52660faf66..e67ef74951b 100644
--- a/source/blender/imbuf/intern/cineon/logmemfile.c
+++ b/source/blender/imbuf/intern/cineon/logmemfile.c
@@ -1,28 +1,25 @@
/*
- * Cineon image file format library routines.
- *
- * Copyright 2006 Joseph Eagar (joeedh@gmail.com)
- *
- * 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 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.
+ * 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): Julien Enche.
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Copyright 2006 Joseph Eagar (joeedh@gmail.com)
*/
-/** \file blender/imbuf/intern/cineon/logmemfile.c
- * \ingroup imbcineon
+/** \file
+ * \ingroup imbcineon
+ *
+ * Cineon image file format library routines.
*/
diff --git a/source/blender/imbuf/intern/cineon/logmemfile.h b/source/blender/imbuf/intern/cineon/logmemfile.h
index 068a53e641b..9b6def2a617 100644
--- a/source/blender/imbuf/intern/cineon/logmemfile.h
+++ b/source/blender/imbuf/intern/cineon/logmemfile.h
@@ -1,28 +1,25 @@
/*
- * Cineon image file format library routines.
- *
- * Copyright 2006 Joseph Eagar (joeedh@gmail.com)
- *
- * 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 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.
+ * 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): Julien Enche.
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * Copyright 2006 Joseph Eagar (joeedh@gmail.com)
*/
-/** \file blender/imbuf/intern/cineon/logmemfile.h
- * \ingroup imbcineon
+/** \file
+ * \ingroup imbcineon
+ *
+ * Cineon image file format library routines.
*/
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 887e2390718..597421d80c6 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,10 @@
*
* The Original Code is Copyright (C) 2012 by Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Xavier Thomas,
- * Lukas Toenne,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/imbuf/intern/colormanagement.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include "IMB_colormanagement.h"
@@ -1144,7 +1133,7 @@ void IMB_colormanagement_check_file_config(Main *bmain)
return;
}
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
ColorManagedColorspaceSettings *sequencer_colorspace_settings;
/* check scene color management settings */
@@ -1170,16 +1159,16 @@ void IMB_colormanagement_check_file_config(Main *bmain)
/* ** check input color space settings ** */
- for (image = bmain->image.first; image; image = image->id.next) {
+ for (image = bmain->images.first; image; image = image->id.next) {
colormanage_check_colorspace_settings(&image->colorspace_settings, "image");
}
- for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
colormanage_check_colorspace_settings(&clip->colorspace_settings, "clip");
}
}
-void IMB_colormanagement_validate_settings(ColorManagedDisplaySettings *display_settings,
+void IMB_colormanagement_validate_settings(const ColorManagedDisplaySettings *display_settings,
ColorManagedViewSettings *view_settings)
{
ColorManagedDisplay *display;
diff --git a/source/blender/imbuf/intern/colormanagement_inline.c b/source/blender/imbuf/intern/colormanagement_inline.c
index 37ef8779f58..2200c1d8c52 100644
--- a/source/blender/imbuf/intern/colormanagement_inline.c
+++ b/source/blender/imbuf/intern/colormanagement_inline.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/imbuf/intern/colormanagement_inline.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#ifndef __IMB_COLORMANAGEMENT_INLINE_C__
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index 0887576eedf..aae769d9882 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/BlockDXT.cpp
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h
index 7371d72ea4a..82ec5b45d4e 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.h
+++ b/source/blender/imbuf/intern/dds/BlockDXT.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/BlockDXT.h
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt
index 8c95695f356..6728dbc758d 100644
--- a/source/blender/imbuf/intern/dds/CMakeLists.txt
+++ b/source/blender/imbuf/intern/dds/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s):
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/imbuf/intern/dds/Color.h b/source/blender/imbuf/intern/dds/Color.h
index 51939a6ea4c..da7b77c2854 100644
--- a/source/blender/imbuf/intern/dds/Color.h
+++ b/source/blender/imbuf/intern/dds/Color.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/Color.h
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index e2f52f547f0..e0c1c168d50 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/ColorBlock.cpp
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.h b/source/blender/imbuf/intern/dds/ColorBlock.h
index 67c0b64d53e..66d1ed4e2c5 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.h
+++ b/source/blender/imbuf/intern/dds/ColorBlock.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/ColorBlock.h
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/Common.h b/source/blender/imbuf/intern/dds/Common.h
index b1beb3f3a1b..1a7d087ec2e 100644
--- a/source/blender/imbuf/intern/dds/Common.h
+++ b/source/blender/imbuf/intern/dds/Common.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/Common.h
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index 9dc48fc10c8..d9b061089f7 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/DirectDrawSurface.cpp
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.h b/source/blender/imbuf/intern/dds/DirectDrawSurface.h
index b7bcb8303bf..8166e6b0831 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.h
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/DirectDrawSurface.h
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp
index 336d891fa3a..50488b923db 100644
--- a/source/blender/imbuf/intern/dds/FlipDXT.cpp
+++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp
@@ -1,20 +1,19 @@
/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -27,6 +26,9 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Copyright 2009, Google Inc.
+ * All rights reserved.
*/
// This file comes from the chromium project, adapted to Blender to add DDS
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.h b/source/blender/imbuf/intern/dds/FlipDXT.h
index 6d4b2390255..7d70395f1fa 100644
--- a/source/blender/imbuf/intern/dds/FlipDXT.h
+++ b/source/blender/imbuf/intern/dds/FlipDXT.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,10 +12,6 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FLIPDXT_H__
diff --git a/source/blender/imbuf/intern/dds/Image.cpp b/source/blender/imbuf/intern/dds/Image.cpp
index 2e9ae9da388..642194fa39b 100644
--- a/source/blender/imbuf/intern/dds/Image.cpp
+++ b/source/blender/imbuf/intern/dds/Image.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/Image.cpp
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/Image.h b/source/blender/imbuf/intern/dds/Image.h
index 9a8bacd93a3..fa8cacd3142 100644
--- a/source/blender/imbuf/intern/dds/Image.h
+++ b/source/blender/imbuf/intern/dds/Image.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/Image.h
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/PixelFormat.h b/source/blender/imbuf/intern/dds/PixelFormat.h
index e37e09dd661..7c50245858f 100644
--- a/source/blender/imbuf/intern/dds/PixelFormat.h
+++ b/source/blender/imbuf/intern/dds/PixelFormat.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/PixelFormat.h
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/Stream.cpp b/source/blender/imbuf/intern/dds/Stream.cpp
index 1af10905e64..92b5923e8a1 100644
--- a/source/blender/imbuf/intern/dds/Stream.cpp
+++ b/source/blender/imbuf/intern/dds/Stream.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/Stream.cpp
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/Stream.h b/source/blender/imbuf/intern/dds/Stream.h
index 6557fb4f063..3da0feb5aeb 100644
--- a/source/blender/imbuf/intern/dds/Stream.h
+++ b/source/blender/imbuf/intern/dds/Stream.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/Stream.h
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index c038407c0a6..37577eefc56 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/dds_api.cpp
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/dds/dds_api.h b/source/blender/imbuf/intern/dds/dds_api.h
index d911a163098..cbe19ab3e90 100644
--- a/source/blender/imbuf/intern/dds/dds_api.h
+++ b/source/blender/imbuf/intern/dds/dds_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors: Amorilia (amorilia@users.sourceforge.net)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/dds/dds_api.h
- * \ingroup imbdds
+/** \file
+ * \ingroup imbdds
*/
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index e6635080163..d1997e4612d 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* allocimbuf.c
- *
*/
-/** \file blender/imbuf/intern/divers.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include "BLI_math.h"
diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c
index a5af51e3e95..e02141b6038 100644
--- a/source/blender/imbuf/intern/filetype.c
+++ b/source/blender/imbuf/intern/filetype.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation, 2010.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/filetype.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
@@ -85,7 +79,7 @@ const ImFileType IMB_FILE_TYPES[] = {
#ifdef WITH_OPENIMAGEIO
{NULL, NULL, NULL, imb_is_a_photoshop, imb_ftype_default, NULL, imb_load_photoshop, NULL, NULL, IM_FTYPE_FLOAT, IMB_FTYPE_PSD, COLOR_ROLE_DEFAULT_FLOAT},
#endif
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0}
+ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0},
};
const ImFileType *IMB_FILE_TYPES_LAST = &IMB_FILE_TYPES[sizeof(IMB_FILE_TYPES) / sizeof(ImFileType) - 1];
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index da64403de44..673d4aae59f 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Morten Mikkelsen.
- *
- * ***** END GPL LICENSE BLOCK *****
* filter.c
- *
*/
-/** \file blender/imbuf/intern/filter.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index 507455c47f4..1e48c4fd428 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,16 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/imageprocess.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*
* This file was moved here from the src/ directory. It is meant to
* deal with endianness. It resided in a general blending lib. The
* other functions were only used during rendering. This single
* function remained. It should probably move to imbuf/intern/util.c,
* but we'll keep it here for the time being. (nzc)
- *
*/
#include <stdlib.h>
diff --git a/source/blender/imbuf/intern/imbuf.h b/source/blender/imbuf/intern/imbuf.h
index 05162290538..1546c2790d7 100644
--- a/source/blender/imbuf/intern/imbuf.h
+++ b/source/blender/imbuf/intern/imbuf.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): mar-2001 nzc.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/imbuf.h
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#ifndef __IMBUF_H__
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index 56f90d39850..5d88acd782a 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,14 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Peter Schlaile <peter [at] schlaile [dot] de> 2011
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/indexer.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include <stdlib.h>
@@ -413,7 +407,7 @@ static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc,
"record_run%s%s.blen_tc",
"free_run%s%s.blen_tc",
"interp_free_run%s%s.blen_tc",
- "record_run_no_gaps%s%s.blen_tc"
+ "record_run_no_gaps%s%s.blen_tc",
};
char stream_suffix[20];
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index 11f799a33d2..cc6d99e2a90 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/iris.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
@@ -125,7 +117,6 @@ static void lumrow(uchar *rgbptr, uchar *lumptr, int n);
/*
* byte order independent read/write of shorts and ints.
- *
*/
static ushort getshort(MFileOffset *inf)
@@ -248,7 +239,6 @@ int imb_is_a_iris(const uchar *mem)
* longimagedata -
* read in a B/W RGB or RGBA iris image file and return a
* pointer to an array of ints.
- *
*/
struct ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index de74a321504..c3690bcf643 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/imbuf/intern/jp2.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include "MEM_guardedalloc.h"
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 896c25ffd65..25b23d9a19d 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/jpeg.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
@@ -469,7 +461,6 @@ static void write_jpeg(struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf)
int x, y;
char neogeo[128];
struct NeoGeo_Word *neogeo_word;
- char *text;
jpeg_start_compress(cinfo, true);
@@ -480,8 +471,9 @@ static void write_jpeg(struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf)
jpeg_write_marker(cinfo, 0xe1, (JOCTET *) neogeo, 10);
if (ibuf->metadata) {
IDProperty *prop;
- /* key + max value + "Blender" */
- text = MEM_mallocN(530, "stamp info read");
+ /* Static storage array for the short metadata. */
+ char static_text[1024];
+ const int static_text_size = ARRAY_SIZE(static_text);
for (prop = ibuf->metadata->data.group.first; prop; prop = prop->next) {
if (prop->type == IDP_STRING) {
int text_len;
@@ -489,6 +481,16 @@ static void write_jpeg(struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf)
jpeg_write_marker(cinfo, JPEG_COM, (JOCTET *) IDP_String(prop), prop->len + 1);
}
+ char *text = static_text;
+ int text_size = static_text_size;
+ /* 7 is for Blender, 2 colon separators, length of property
+ * name and property value, followed by the NULL-terminator. */
+ const int text_length_required = 7 + 2 + strlen(prop->name) + strlen(IDP_String(prop)) + 1;
+ if (text_length_required <= static_text_size) {
+ text = MEM_mallocN(text_length_required, "jpeg metadata field");
+ text_size = text_length_required;
+ }
+
/*
* The JPEG format don't support a pair "key/value"
* like PNG, so we "encode" the stamp in a
@@ -498,11 +500,17 @@ static void write_jpeg(struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf)
* The first "Blender" is a simple identify to help
* in the read process.
*/
- text_len = sprintf(text, "Blender:%s:%s", prop->name, IDP_String(prop));
+ text_len = BLI_snprintf(text, text_size, "Blender:%s:%s", prop->name, IDP_String(prop));
jpeg_write_marker(cinfo, JPEG_COM, (JOCTET *) text, text_len + 1);
+
+ /* TODO(sergey): Ideally we will try to re-use allocation as
+ * much as possible. In practice, such long fields don't happen
+ * often. */
+ if (text != static_text) {
+ MEM_freeN(text);
+ }
}
}
- MEM_freeN(text);
}
row_pointer[0] =
diff --git a/source/blender/imbuf/intern/metadata.c b/source/blender/imbuf/intern/metadata.c
index e6d778a4ea2..cc4c2661ef2 100644
--- a/source/blender/imbuf/intern/metadata.c
+++ b/source/blender/imbuf/intern/metadata.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Austin Benesh. Ton Roosendaal.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/metadata.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
@@ -111,3 +103,13 @@ void IMB_metadata_set_field(struct IDProperty *metadata, const char *key, const
IDP_AssignString(prop, value, METADATA_MAX_VALUE_LENGTH);
}
+
+void IMB_metadata_foreach(struct ImBuf *ibuf, IMBMetadataForeachCb callback, void *userdata)
+{
+ if (ibuf->metadata == NULL) {
+ return;
+ }
+ for (IDProperty *prop = ibuf->metadata->data.group.first; prop != NULL; prop = prop->next) {
+ callback(prop->name, IDP_String(prop), userdata);
+ }
+}
diff --git a/source/blender/imbuf/intern/module.c b/source/blender/imbuf/intern/module.c
index 3f2e9e04212..c22ac2c9bfc 100644
--- a/source/blender/imbuf/intern/module.c
+++ b/source/blender/imbuf/intern/module.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation, 2010.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/module.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c
index 2a650a0c63a..78a45d29775 100644
--- a/source/blender/imbuf/intern/moviecache.c
+++ b/source/blender/imbuf/intern/moviecache.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin,
- * Peter Schlaile
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/moviecache.c
- * \ingroup bke
+/** \file
+ * \ingroup bke
*/
#undef DEBUG_MESSAGES
diff --git a/source/blender/imbuf/intern/oiio/CMakeLists.txt b/source/blender/imbuf/intern/oiio/CMakeLists.txt
index a4fb9c5aee1..73438436abc 100644
--- a/source/blender/imbuf/intern/oiio/CMakeLists.txt
+++ b/source/blender/imbuf/intern/oiio/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2013, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s):
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
index 34d5cccac84..4a21478de13 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Dalai Felinto and Brecht van Lommel
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/oiio/openimageio_api.cpp
- * \ingroup openimageio
+/** \file
+ * \ingroup openimageio
*/
#include <set>
@@ -179,7 +171,7 @@ int imb_is_a_photoshop(const char *filename)
".psd",
".pdd",
".psb",
- NULL
+ NULL,
};
return BLI_path_extension_check_array(filename, photoshop_extension);
@@ -203,7 +195,6 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac
struct ImBuf *ibuf = NULL;
int width, height, components;
bool is_float, is_alpha;
- TypeDesc typedesc;
int basesize;
char file_colorspace[IM_MAX_SPACE];
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.h b/source/blender/imbuf/intern/oiio/openimageio_api.h
index df1122584bd..d6249af2a0a 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.h
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/oiio/openimageio_api.h
- * \ingroup openimageio
+/** \file
+ * \ingroup openimageio
*/
diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt
index d4e6e9dc670..18f68d5b365 100644
--- a/source/blender/imbuf/intern/openexr/CMakeLists.txt
+++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 99b3bdb9015..155f971c5eb 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPLLICENSE 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
@@ -17,16 +15,10 @@
*
* Copyright by Gernot Ziegler <gz@lysator.liu.se>.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Austin Benesh, Ton Roosendaal (float, half, speedup, cleanup...).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/openexr/openexr_api.cpp
- * \ingroup openexr
+/** \file
+ * \ingroup openexr
*/
#include <stdlib.h>
@@ -557,7 +549,7 @@ int imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags)
* - parse name from right to left
* - last character is channel ID, 1 char like 'A' 'R' 'G' 'B' 'X' 'Y' 'Z' 'W' 'U' 'V'
* - separated with a dot; the Pass name (like "Depth", "Color", "Diffuse" or "Combined")
- * - separated with a dot: the Layer name (like "Lamp1" or "Walls" or "Characters")
+ * - separated with a dot: the Layer name (like "Light1" or "Walls" or "Characters")
*/
static ListBase exrhandles = {NULL, NULL};
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.h b/source/blender/imbuf/intern/openexr/openexr_api.h
index 32d276b31ea..7b9094e7eb6 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.h
+++ b/source/blender/imbuf/intern/openexr/openexr_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Austin Benesh. Ton Roosendaal.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/openexr/openexr_api.h
- * \ingroup openexr
+/** \file
+ * \ingroup openexr
*/
diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h
index 5b4cdcd5e8e..974b3fe3ca0 100644
--- a/source/blender/imbuf/intern/openexr/openexr_multi.h
+++ b/source/blender/imbuf/intern/openexr/openexr_multi.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Ton Roosendaal.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/openexr/openexr_multi.h
- * \ingroup openexr
+/** \file
+ * \ingroup openexr
*/
diff --git a/source/blender/imbuf/intern/openexr/openexr_stub.cpp b/source/blender/imbuf/intern/openexr/openexr_stub.cpp
index b7138ee464a..23f4bae1bf8 100644
--- a/source/blender/imbuf/intern/openexr/openexr_stub.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_stub.cpp
@@ -1,6 +1,4 @@
/*
- * ***** BEGIN GPLLICENSE 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
@@ -17,16 +15,10 @@
*
* Copyright by Gernot Ziegler <gz@lysator.liu.se>.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Austin Benesh, Ton Roosendaal (float, half, speedup, cleanup...).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/openexr/openexr_stub.cpp
- * \ingroup openexr
+/** \file
+ * \ingroup openexr
*/
#include "openexr_api.h"
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 47a2a8d40fb..e51f24f67d8 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/png.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*
* \todo Save floats as 16 bits per channel, currently readonly.
*/
diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c
index be33c16c8ae..dce61953432 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/radiance_hdr.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
/* ----------------------------------------------------------------------
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index 0cb1ab4b2c5..feb75bed831 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* allocimbuf.c
- *
*/
-/** \file blender/imbuf/intern/readimage.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index a762e3780dc..ef869e35a36 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* allocimbuf.c
- *
*/
-/** \file blender/imbuf/intern/rectop.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include <stdlib.h>
diff --git a/source/blender/imbuf/intern/rotate.c b/source/blender/imbuf/intern/rotate.c
index f00745f0052..277a2d0c491 100644
--- a/source/blender/imbuf/intern/rotate.c
+++ b/source/blender/imbuf/intern/rotate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* rotate.c
- *
*/
-/** \file blender/imbuf/intern/rotate.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include "BLI_utildefines.h"
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index abd13376c72..c722f91670e 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* allocimbuf.c
- *
*/
-/** \file blender/imbuf/intern/scaling.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
diff --git a/source/blender/imbuf/intern/stereoimbuf.c b/source/blender/imbuf/intern/stereoimbuf.c
index 7c58815c216..52f1de1794d 100644
--- a/source/blender/imbuf/intern/stereoimbuf.c
+++ b/source/blender/imbuf/intern/stereoimbuf.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/stereoimbuf.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include <stddef.h>
@@ -43,7 +35,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index b83097c2eaa..fa477037f72 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/targa.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index fbc34264b30..c9112cc768e 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Andrea Weikert.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/thumbs.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include <stdio.h>
@@ -61,12 +53,15 @@
#include <stdio.h>
#ifdef WIN32
-# include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
+ /* Need to include windows.h so _WIN32_IE is defined. */
+# include <windows.h>
# ifndef _WIN32_IE
-# define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
+ /* Minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already. */
+# define _WIN32_IE 0x0400
# endif
-# include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
- * because 'near' is disabled through BLI_windstuff */
+ /* For SHGetSpecialFolderPath, has to be done before BLI_winstuff
+ * because 'near' is disabled through BLI_windstuff */
+# include <shlobj.h>
# include <direct.h> /* chdir */
# include "BLI_winstuff.h"
# include "utfconv.h"
@@ -162,7 +157,7 @@ static const unsigned char acceptable[96] = {
/* ` a b c d e f g h i j k l m n o */
0x20,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
/* p q r s t u v w x y z { | } ~ DEL */
- 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x3F,0x20
+ 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x3F,0x20,
};
static const char hex[17] = "0123456789abcdef";
diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c
index 5bdab03e57c..92005371c2a 100644
--- a/source/blender/imbuf/intern/thumbs_blend.c
+++ b/source/blender/imbuf/intern/thumbs_blend.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/imbuf/intern/thumbs_blend.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
@@ -29,8 +23,6 @@
#include <string.h>
#include "BLI_utildefines.h"
-#include "BLI_endian_switch.h"
-#include "BLI_fileops.h"
#include "BLI_linklist.h"
#include "BLI_listbase.h" /* Needed due to import of BLO_readfile.h */
diff --git a/source/blender/imbuf/intern/thumbs_font.c b/source/blender/imbuf/intern/thumbs_font.c
index 7715e1bc470..ec45749e513 100644
--- a/source/blender/imbuf/intern/thumbs_font.c
+++ b/source/blender/imbuf/intern/thumbs_font.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Thomas Beck.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/thumbs_font.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
#include "BLI_utildefines.h"
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index f72a924806b..928f1ef7a54 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Jonathan Merritt.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/imbuf/intern/tiff.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
@@ -521,8 +515,6 @@ void imb_inittiff(void)
/**
* Loads a TIFF file.
- *
- *
* \param mem: Memory containing the TIFF file.
* \param size: Size of the mem buffer.
* \param flags: If flags has IB_test set then the file is not actually loaded,
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index 6a095b2da1f..ba541dc6e91 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* util.c
- *
*/
-/** \file blender/imbuf/intern/util.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
@@ -41,7 +32,6 @@
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_fileops.h"
-#include "BLI_string.h"
#include "imbuf.h"
#include "IMB_imbuf_types.h"
@@ -51,14 +41,16 @@
#include "IMB_anim.h"
#ifdef WITH_FFMPEG
-#include "BKE_global.h" /* G.debug */
-#include <libavcodec/avcodec.h>
-#include <libavformat/avformat.h>
-#include <libavdevice/avdevice.h>
-#include <libavutil/log.h>
+# include "BLI_string.h" /* BLI_vsnprintf */
+
+# include "BKE_global.h" /* G.debug */
-#include "ffmpeg_compat.h"
+# include <libavcodec/avcodec.h>
+# include <libavformat/avformat.h>
+# include <libavdevice/avdevice.h>
+# include <libavutil/log.h>
+# include "ffmpeg_compat.h"
#endif
#define UTIL_DEBUG 0
@@ -92,14 +84,14 @@ const char *imb_ext_image[] = {
#ifdef WITH_OPENIMAGEIO
".psd", ".pdd", ".psb",
#endif
- NULL
+ NULL,
};
const char *imb_ext_image_filepath_only[] = {
#ifdef WITH_OPENIMAGEIO
".psd", ".pdd", ".psb",
#endif
- NULL
+ NULL,
};
const char *imb_ext_movie[] = {
@@ -131,7 +123,7 @@ const char *imb_ext_movie[] = {
".xvid",
".mxf",
".webm",
- NULL
+ NULL,
};
/* sort of wrong being here... */
@@ -150,7 +142,7 @@ const char *imb_ext_audio[] = {
".aiff",
".m4a",
".mka",
- NULL
+ NULL,
};
int IMB_ispic_type(const char *name)
diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c
index e340d082895..d6f2f801725 100644
--- a/source/blender/imbuf/intern/writeimage.c
+++ b/source/blender/imbuf/intern/writeimage.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* writeimage.c
- *
*/
-/** \file blender/imbuf/intern/writeimage.c
- * \ingroup imbuf
+/** \file
+ * \ingroup imbuf
*/
diff --git a/source/blender/makesdna/CMakeLists.txt b/source/blender/makesdna/CMakeLists.txt
index c60907060f7..6e057f79931 100644
--- a/source/blender/makesdna/CMakeLists.txt
+++ b/source/blender/makesdna/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
if(WITH_FREESTYLE)
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 28ba5c95020..cd29a3c5bc4 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_ID.h
- * \ingroup DNA
- * \brief ID and Library types, which are fundamental for sdna.
+/** \file
+ * \ingroup DNA
+ * \brief ID and Library types, which are fundamental for sdna.
*/
#ifndef __DNA_ID_H__
@@ -39,11 +31,11 @@
extern "C" {
#endif
-struct Library;
struct FileData;
+struct GPUTexture;
struct ID;
+struct Library;
struct PackedFile;
-struct GPUTexture;
/* Runtime display data */
struct DrawData;
@@ -69,19 +61,22 @@ typedef struct DrawDataList {
typedef struct IDPropertyData {
void *pointer;
ListBase group;
- int val, val2; /* note, we actually fit a double into these two ints */
+ /** Note, we actually fit a double into these two ints. */
+ int val, val2;
} IDPropertyData;
typedef struct IDProperty {
struct IDProperty *next, *prev;
char type, subtype;
short flag;
- char name[64]; /* MAX_IDPROP_NAME */
+ /** MAX_IDPROP_NAME. */
+ char name[64];
/* saved is used to indicate if this struct has been saved yet.
- * seemed like a good idea as a pad var was needed anyway :) */
+ * seemed like a good idea as a '_pad' var was needed anyway :) */
int saved;
- IDPropertyData data; /* note, alignment for 64 bits */
+ /** Note, alignment for 64 bits. */
+ IDPropertyData data;
/* array length, also (this is important!) string length + 1.
* the idea is to be able to reuse array realloc functions on strings.*/
@@ -130,11 +125,13 @@ enum {
/*->flag*/
enum {
- /* This IDProp may be statically overridden. Should only be used/be relevant for custom properties. */
+ /** This IDProp may be statically overridden.
+ * Should only be used/be relevant for custom properties. */
IDP_FLAG_OVERRIDABLE_STATIC = 1 << 0,
- IDP_FLAG_GHOST = 1 << 7, /* this means the property is set but RNA will return false when checking
- * 'RNA_property_is_set', currently this is a runtime flag */
+ /** This means the property is set but RNA will return false when checking
+ * 'RNA_property_is_set', currently this is a runtime flag */
+ IDP_FLAG_GHOST = 1 << 7,
};
/* add any future new id property types here.*/
@@ -148,7 +145,7 @@ typedef struct IDOverrideStaticPropertyOperation {
/* Type of override. */
short operation;
short flag;
- short pad_s1[2];
+ char _pad0[4];
/* Sub-item references, if needed (for arrays or collections only).
* We need both reference and local values to allow e.g. insertion into collections (constraints, modifiers...).
@@ -183,27 +180,35 @@ enum {
/* IDOverridePropertyOperation->flag. */
enum {
- IDOVERRIDESTATIC_FLAG_MANDATORY = 1 << 0, /* User cannot remove that override operation. */
- IDOVERRIDESTATIC_FLAG_LOCKED = 1 << 1, /* User cannot change that override operation. */
+ /** User cannot remove that override operation. */
+ IDOVERRIDESTATIC_FLAG_MANDATORY = 1 << 0,
+ /** User cannot change that override operation. */
+ IDOVERRIDESTATIC_FLAG_LOCKED = 1 << 1,
};
-/* A single overridden property, contain all operations on this one. */
+/** A single overridden property, contain all operations on this one. */
typedef struct IDOverrideStaticProperty {
struct IDOverrideStaticProperty *next, *prev;
- /* Path from ID to overridden property. *Does not* include indices/names for final arrays/collections items. */
+ /**
+ * Path from ID to overridden property.
+ * *Does not* include indices/names for final arrays/collections items.
+ */
char *rna_path;
- ListBase operations; /* List of overriding operations (IDOverridePropertyOperation) applied to this property. */
+ /** List of overriding operations (IDOverridePropertyOperation) applied to this property. */
+ ListBase operations;
} IDOverrideStaticProperty;
/* Main container for all overriding data info of a data-block. */
typedef struct IDOverrideStatic {
- struct ID *reference; /* Reference linked ID which this one overrides. */
- ListBase properties; /* List of IDOverrideProperty structs. */
+ /** Reference linked ID which this one overrides. */
+ struct ID *reference;
+ /** List of IDOverrideProperty structs. */
+ ListBase properties;
short flag;
- short pad[3];
+ char _pad[6];
/* Read/write data. */
/* Temp ID storing extra override data (used for differential operations only currently).
@@ -230,9 +235,11 @@ typedef struct ID {
void *next, *prev;
struct ID *newid;
struct Library *lib;
- char name[66]; /* MAX_ID_NAME */
+ /** MAX_ID_NAME. */
+ char name[66];
/**
- * LIB_... flags report on status of the datablock this ID belongs to (persistent, saved to and read from .blend).
+ * LIB_... flags report on status of the datablock this ID belongs to
+ * (persistent, saved to and read from .blend).
*/
short flag;
/**
@@ -242,12 +249,14 @@ typedef struct ID {
int us;
int icon_id;
int recalc;
- int pad;
+ char _pad[4];
IDProperty *properties;
- IDOverrideStatic *override_static; /* Reference linked ID which this one overrides. */
+ /** Reference linked ID which this one overrides. */
+ IDOverrideStatic *override_static;
- /* Only set for datablocks which are coming from copy-on-write, points to
+ /**
+ * Only set for datablocks which are coming from copy-on-write, points to
* the original version of it.
*/
struct ID *orig_id;
@@ -262,28 +271,34 @@ typedef struct ID {
typedef struct Library {
ID id;
struct FileData *filedata;
- char name[1024]; /* path name used for reading, can be relative and edited in the outliner */
+ /** Path name used for reading, can be relative and edited in the outliner. */
+ char name[1024];
- /* absolute filepath, this is only for convenience, 'name' is the real path used on file read but in
+ /**
+ * Absolute filepath, this is only for convenience,
+ * 'name' is the real path used on file read but in
* some cases its useful to access the absolute one.
* This is set on file read.
- * Use BKE_library_filepath_set() rather than setting 'name' directly and it will be kept in sync - campbell */
+ * Use BKE_library_filepath_set() rather than setting 'name'
+ * directly and it will be kept in sync - campbell */
char filepath[1024];
- struct Library *parent; /* set for indirectly linked libs, used in the outliner and while reading */
+ /** Set for indirectly linked libs, used in the outliner and while reading. */
+ struct Library *parent;
struct PackedFile *packedfile;
/* Temp data needed by read/write code. */
int temp_index;
- short versionfile, subversionfile; /* see BLENDER_VERSION, BLENDER_SUBVERSION, needed for do_versions */
+ /** See BLENDER_VERSION, BLENDER_SUBVERSION, needed for do_versions. */
+ short versionfile, subversionfile;
} Library;
enum eIconSizes {
ICON_SIZE_ICON = 0,
ICON_SIZE_PREVIEW = 1,
- NUM_ICON_SIZES
+ NUM_ICON_SIZES,
};
/* for PreviewImage->flag */
@@ -309,10 +324,12 @@ typedef struct PreviewImage {
/* Runtime-only data. */
struct GPUTexture *gputexture[2];
- int icon_id; /* Used by previews outside of ID context. */
+ /** Used by previews outside of ID context. */
+ int icon_id;
- short tag; /* Runtime data. */
- char pad[2];
+ /** Runtime data. */
+ short tag;
+ char _pad[2];
} PreviewImage;
#define PRV_DEFERRED_DATA(prv) \
@@ -351,7 +368,7 @@ typedef enum ID_Type {
ID_TE = MAKE_ID2('T', 'E'), /* Tex (Texture) */
ID_IM = MAKE_ID2('I', 'M'), /* Image */
ID_LT = MAKE_ID2('L', 'T'), /* Lattice */
- ID_LA = MAKE_ID2('L', 'A'), /* Lamp */
+ ID_LA = MAKE_ID2('L', 'A'), /* Light */
ID_CA = MAKE_ID2('C', 'A'), /* Camera */
ID_IP = MAKE_ID2('I', 'P'), /* Ipo (depreciated, replaced by FCurves) */
ID_KE = MAKE_ID2('K', 'E'), /* Key (shape key) */
@@ -380,20 +397,20 @@ typedef enum ID_Type {
} ID_Type;
/* Only used as 'placeholder' in .blend files for directly linked datablocks. */
-#define ID_ID MAKE_ID2('I', 'D') /* (internal use only) */
+#define ID_LINK_PLACEHOLDER MAKE_ID2('I', 'D') /* (internal use only) */
/* Deprecated. */
#define ID_SCRN MAKE_ID2('S', 'N')
/* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */
#define ID_SEQ MAKE_ID2('S', 'Q')
- /* constraint */
+/* constraint */
#define ID_CO MAKE_ID2('C', 'O')
- /* pose (action channel, used to be ID_AC in code, so we keep code for backwards compat) */
+/* pose (action channel, used to be ID_AC in code, so we keep code for backwards compat) */
#define ID_PO MAKE_ID2('A', 'C')
- /* used in outliner... */
+/* used in outliner... */
#define ID_NLA MAKE_ID2('N', 'L')
- /* fluidsim Ipo */
+/* fluidsim Ipo */
#define ID_FLUIDSIM MAKE_ID2('F', 'S')
#define ID_FAKE_USERS(id) ((((ID *)id)->flag & LIB_FAKEUSER) ? 1 : 0)
@@ -443,31 +460,36 @@ enum {
*
* Those flags belong to three different categories, which have different expected handling in code:
*
- * - RESET_BEFORE_USE: piece of code that wants to use such flag has to ensure they are properly 'reset' first.
- * - RESET_AFTER_USE: piece of code that wants to use such flag has to ensure they are properly 'reset' after usage
- * (though 'lifetime' of those flags is a bit fuzzy, e.g. _RECALC ones are reset on depsgraph
- * evaluation...).
- * - RESET_NEVER: those flags are 'status' one, and never actually need any reset (except on initialization
- * during .blend file reading).
+ * - RESET_BEFORE_USE: piece of code that wants to use such flag
+ * has to ensure they are properly 'reset' first.
+ * - RESET_AFTER_USE: piece of code that wants to use such flag has to ensure they are properly
+ * 'reset' after usage
+ * (though 'lifetime' of those flags is a bit fuzzy, e.g. _RECALC ones are reset on depsgraph
+ * evaluation...).
+ * - RESET_NEVER: those flags are 'status' one, and never actually need any reset
+ * (except on initialization during .blend file reading).
*/
enum {
/* RESET_NEVER Datablock is from current .blend file. */
LIB_TAG_LOCAL = 0,
- /* RESET_NEVER Datablock is from a library, but is used (linked) directly by current .blend file. */
+ /* RESET_NEVER Datablock is from a library,
+ * but is used (linked) directly by current .blend file. */
LIB_TAG_EXTERN = 1 << 0,
- /* RESET_NEVER Datablock is from a library, and is only used (linked) inderectly through other libraries. */
+ /* RESET_NEVER Datablock is from a library,
+ * and is only used (linked) inderectly through other libraries. */
LIB_TAG_INDIRECT = 1 << 1,
- /* RESET_AFTER_USE Three flags used internally in readfile.c, to mark IDs needing to be read (only done once). */
+ /* RESET_AFTER_USE Flag used internally in readfile.c,
+ * to mark IDs needing to be expanded (only done once). */
LIB_TAG_NEED_EXPAND = 1 << 3,
- LIB_TAG_TESTEXT = (LIB_TAG_NEED_EXPAND | LIB_TAG_EXTERN),
- LIB_TAG_TESTIND = (LIB_TAG_NEED_EXPAND | LIB_TAG_INDIRECT),
- /* RESET_AFTER_USE Flag used internally in readfile.c, to mark IDs needing to be linked from a library. */
- LIB_TAG_READ = 1 << 4,
+ /* RESET_AFTER_USE Flag used internally in readfile.c to mark ID
+ * placeholders for linked datablocks needing to be read. */
+ LIB_TAG_ID_LINK_PLACEHOLDER = 1 << 4,
/* RESET_AFTER_USE */
LIB_TAG_NEED_LINK = 1 << 5,
- /* RESET_NEVER tag datablock as a place-holder (because the real one could not be linked from its library e.g.). */
+ /* RESET_NEVER tag datablock as a place-holder
+ * (because the real one could not be linked from its library e.g.). */
LIB_TAG_MISSING = 1 << 6,
/* RESET_NEVER tag datablock as being up-to-date regarding its reference. */
@@ -494,21 +516,23 @@ enum {
LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT = 1 << 13,
LIB_TAG_LOCALIZED = 1 << 14,
- /* RESET_NEVER tag datablock for freeing etc. behavior (usually set when copying real one into temp/runtime one). */
+ /* RESET_NEVER tag datablock for freeing etc. behavior
+ * (usually set when copying real one into temp/runtime one). */
LIB_TAG_NO_MAIN = 1 << 15, /* Datablock is not listed in Main database. */
LIB_TAG_NO_USER_REFCOUNT = 1 << 16, /* Datablock does not refcount usages of other IDs. */
/* Datablock was not allocated by standard system (BKE_libblock_alloc), do not free its memory
* (usual type-specific freeing is called though). */
- LIB_TAG_NOT_ALLOCATED = 1 << 17,
+ LIB_TAG_NOT_ALLOCATED = 1 << 18,
};
/* Tag given ID for an update in all the dependency graphs. */
typedef enum IDRecalcFlag {
/* Individual update tags, this is what ID gets tagged for update with. */
- /* Object transformation changed. */
+ /* ** Object transformation changed. ** */
ID_RECALC_TRANSFORM = (1 << 0),
- /* Object geometry changed.
+
+ /* ** Object geometry changed. **
*
* When object of armature type gets tagged with this flag, it's pose is
* re-evaluated.
@@ -517,18 +541,30 @@ typedef enum IDRecalcFlag {
* When object data type (mesh, curve, ...) gets tagged with this flag it
* makes all objects which shares this datablock to be updated. */
ID_RECALC_GEOMETRY = (1 << 1),
- /* Animation or time changed and animation is to be re-evaluated. */
+
+ /* ** Animation or time changed and animation is to be re-evaluated. ** */
ID_RECALC_ANIMATION = (1 << 2),
- /* Particle system changed; values are aligned with ID_RECALC_PSYS_xxx. */
- ID_RECALC_PSYS_REDO = (1 << 3), /* Only do pathcache etc */
- ID_RECALC_PSYS_RESET = (1 << 4), /* Reset everything including pointcache. */
- ID_RECALC_PSYS_CHILD = (1 << 5), /* Only child settings changed. */
- ID_RECALC_PSYS_PHYS = (1 << 6), /* Physics type changed. */
- /* Update copy on write component without flushing down the road. */
- ID_RECALC_COPY_ON_WRITE = (1 << 7),
- /* Tag shading components for update. Only parameters of material changed).
- */
- ID_RECALC_SHADING = (1 << 8),
+
+ /* ** Particle system changed. ** */
+ /* Only do pathcache etc. */
+ ID_RECALC_PSYS_REDO = (1 << 3),
+ /* Reset everything including pointcache. */
+ ID_RECALC_PSYS_RESET = (1 << 4),
+ /* Only child settings changed. */
+ ID_RECALC_PSYS_CHILD = (1 << 5),
+ /* Physics type changed. */
+ ID_RECALC_PSYS_PHYS = (1 << 6),
+
+ /* ** Material and shading ** */
+
+ /* For materials and node trees this means that topology of the shader tree
+ * changed, and the shader is to be recompiled.
+ * For objects it means that the draw batch cache is to be redone. */
+ ID_RECALC_SHADING = (1 << 7),
+ /* TODO(sergey): Consider adding an explicit ID_RECALC_SHADING_PARAMATERS
+ * which can be used for cases when only socket value changed, to speed up
+ * redraw update in that case. */
+
/* Selection of the ID itself or its components (for example, vertices) did
* change, and all the drawing data is to eb updated. */
ID_RECALC_SELECT = (1 << 9),
@@ -543,6 +579,12 @@ typedef enum IDRecalcFlag {
* re-rendered. */
ID_RECALC_EDITORS = (1 << 12),
+ /* ** Update copy on write component. **
+ * This is most generic tag which should only be used when nothing else
+ * matches.
+ */
+ ID_RECALC_COPY_ON_WRITE = (1 << 13),
+
/* Aggregate flags, use only for checks on runtime.
* Do NOT use those for tagging. */
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 538604f46d0..ddea6f64dba 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Original design: Reevan McKay
- * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
- * Contributor(s): Animation recode, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_action_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*
* Define actions data-block for the animation system.
* A collection of animation curves and drivers to be assigned to data-blocks
@@ -41,10 +33,10 @@
#include "DNA_view2d_types.h"
#include "DNA_userdef_types.h" /* ThemeWireColor */
-struct SpaceLink;
-struct Object;
struct Collection;
struct GHash;
+struct Object;
+struct SpaceLink;
/* ************************************************ */
/* Visualization */
@@ -54,8 +46,10 @@ struct GHash;
/* Data point for motion path (mpv) */
typedef struct bMotionPathVert {
- float co[3]; /* coordinates of point in 3D-space */
- int flag; /* quick settings */
+ /** Coordinates of point in 3D-space. */
+ float co[3];
+ /** Quick settings. */
+ int flag;
} bMotionPathVert;
/* bMotionPathVert->flag */
@@ -71,21 +65,28 @@ typedef enum eMotionPathVert_Flag {
* - for elements providing transforms (i.e. Objects or PoseChannels)
*/
typedef struct bMotionPath {
- bMotionPathVert *points; /* path samples */
- int length; /* the number of cached verts */
-
- int start_frame; /* for drawing paths, the start frame number */
- int end_frame; /* for drawing paths, the end frame number */
-
- float color[3]; /* optional custom color */
- int line_thickness; /* line thickness */
- int flag; /* baking settings - eMotionPath_Flag */
+ /** Path samples. */
+ bMotionPathVert *points;
+ /** The number of cached verts. */
+ int length;
+
+ /** For drawing paths, the start frame number. */
+ int start_frame;
+ /** For drawing paths, the end frame number. */
+ int end_frame;
+
+ /** Optional custom color. */
+ float color[3];
+ /** Line thickness. */
+ int line_thickness;
+ /** Baking settings - eMotionPath_Flag. */
+ int flag;
/* Used for drawing. */
struct GPUVertBuf *points_vbo;
struct GPUBatch *batch_line;
struct GPUBatch *batch_points;
- void *pad;
+ void *_pad;
} bMotionPath;
/* bMotionPath->flag */
@@ -97,7 +98,7 @@ typedef enum eMotionPath_Flag {
/* Custom colors */
MOTIONPATH_FLAG_CUSTOM = (1 << 2),
/* Draw lines or only points */
- MOTIONPATH_FLAG_LINES = (1 << 3)
+ MOTIONPATH_FLAG_LINES = (1 << 3),
} eMotionPath_Flag;
/* Visualization General --------------------------- */
@@ -105,56 +106,35 @@ typedef enum eMotionPath_Flag {
/* Animation Visualization Settings (avs) */
typedef struct bAnimVizSettings {
- /* Onion-Skinning Settings ----------------- */
- int ghost_sf, ghost_ef; /* start and end frames of ghost-drawing range (only used for GHOST_TYPE_RANGE) */
- int ghost_bc, ghost_ac; /* number of frames before/after current frame to show */
-
- short ghost_type; /* eOnionSkin_Types */
- short ghost_step; /* number of frames between each ghost shown (not for GHOST_TYPE_KEYS) */
-
- short ghost_flag; /* eOnionSkin_Flag */
-
/* General Settings ------------------------ */
- short recalc; /* eAnimViz_RecalcFlags */
+ /** #eAnimViz_RecalcFlags. */
+ short recalc;
/* Motion Path Settings ------------------- */
- short path_type; /* eMotionPath_Types */
- short path_step; /* number of frames between points indicated on the paths */
-
- short path_viewflag; /* eMotionPaths_ViewFlag */
- short path_bakeflag; /* eMotionPaths_BakeFlag */
-
- int path_sf, path_ef; /* start and end frames of path-calculation range */
- int path_bc, path_ac; /* number of frames before/after current frame to show */
+ /** #eMotionPath_Types. */
+ short path_type;
+ /** Number of frames between points indicated on the paths. */
+ short path_step;
+
+ /** #eMotionPaths_ViewFlag. */
+ short path_viewflag;
+ /** #eMotionPaths_BakeFlag. */
+ short path_bakeflag;
+ char _pad[6];
+
+ /** Start and end frames of path-calculation range. */
+ int path_sf, path_ef;
+ /** Number of frames before/after current frame to show. */
+ int path_bc, path_ac;
} bAnimVizSettings;
/* bAnimVizSettings->recalc */
typedef enum eAnimViz_RecalcFlags {
/* motionpaths need recalculating */
- ANIMVIZ_RECALC_PATHS = (1 << 0)
+ ANIMVIZ_RECALC_PATHS = (1 << 0),
} eAnimViz_RecalcFlags;
-
-/* bAnimVizSettings->ghost_type */
-typedef enum eOnionSkin_Types {
- /* no ghosts at all */
- GHOST_TYPE_NONE = 0,
- /* around current frame */
- GHOST_TYPE_ACFRA = 1,
- /* show ghosts within the specified frame range */
- GHOST_TYPE_RANGE = 2,
- /* show ghosts on keyframes within the specified range only */
- GHOST_TYPE_KEYS = 3
-} eOnionSkin_Types;
-
-/* bAnimVizSettings->ghost_flag */
-typedef enum eOnionSkin_Flag {
- /* only show selected bones in ghosts */
- GHOST_FLAG_ONLYSEL = (1 << 0)
-} eOnionSkin_Flag;
-
-
/* bAnimVizSettings->path_type */
typedef enum eMotionPaths_Types {
/* show the paths along their entire ranges */
@@ -174,17 +154,18 @@ typedef enum eMotionPaths_ViewFlag {
/* find keyframes in whole action (instead of just in matching group name) */
MOTIONPATH_VIEW_KFACT = (1 << 3),
/* draw lines on path */
- MOTIONPATH_VIEW_LINES = (1 << 4)
+ MOTIONPATH_VIEW_LINES = (1 << 4),
} eMotionPath_ViewFlag;
/* bAnimVizSettings->path_bakeflag */
typedef enum eMotionPaths_BakeFlag {
- /* motion paths directly associated with this block of settings needs updating */
+ /** motion paths directly associated with this block of settings needs updating */
MOTIONPATH_BAKE_NEEDS_RECALC = (1 << 0),
- /* for bones - calculate head-points for curves instead of tips */
+ /** for bones - calculate head-points for curves instead of tips */
MOTIONPATH_BAKE_HEADS = (1 << 1),
- /* motion paths exist for AnimVizSettings instance - set when calc for first time, and unset when clearing */
- MOTIONPATH_BAKE_HAS_PATHS = (1 << 2)
+ /** motion paths exist for AnimVizSettings instance - set when calc for first time,
+ * and unset when clearing */
+ MOTIONPATH_BAKE_HAS_PATHS = (1 << 2),
} eMotionPath_BakeFlag;
/* runtime */
@@ -199,12 +180,12 @@ typedef struct bPoseChannelDrawData {
float bbone_matrix[0][4][4];
} bPoseChannelDrawData;
-struct Mat4;
struct DualQuat;
+struct Mat4;
-typedef struct bPoseChannelRuntime {
+typedef struct bPoseChannel_Runtime {
int bbone_segments;
- char pad[4];
+ char _pad[4];
/* Rest and posed matrices for segments. */
struct Mat4 *bbone_rest_mats;
@@ -213,7 +194,7 @@ typedef struct bPoseChannelRuntime {
/* Delta from rest to pose in matrix and DualQuat form. */
struct Mat4 *bbone_deform_mats;
struct DualQuat *bbone_dual_quats;
-} bPoseChannelRuntime;
+} bPoseChannel_Runtime;
/* ************************************************ */
/* Poses */
@@ -228,84 +209,130 @@ typedef struct bPoseChannelRuntime {
typedef struct bPoseChannel {
struct bPoseChannel *next, *prev;
- IDProperty *prop; /* User-Defined Properties on this PoseChannel */
+ /** User-Defined Properties on this PoseChannel. */
+ IDProperty *prop;
- ListBase constraints; /* Constraints that act on this PoseChannel */
- char name[64]; /* need to match bone name length: MAXBONENAME */
+ /** Constraints that act on this PoseChannel. */
+ ListBase constraints;
+ /** Need to match bone name length: MAXBONENAME. */
+ char name[64];
- short flag; /* dynamic, for detecting transform changes */
- short ikflag; /* settings for IK bones */
- short protectflag; /* protect channels from being transformed */
- short agrp_index; /* index of action-group this bone belongs to (0 = default/no group) */
- char constflag; /* for quick detecting which constraints affect this channel */
- char selectflag; /* copy of bone flag, so you can work with library armatures, not for runtime use */
+ /** Dynamic, for detecting transform changes. */
+ short flag;
+ /** Settings for IK bones. */
+ short ikflag;
+ /** Protect channels from being transformed. */
+ short protectflag;
+ /** Index of action-group this bone belongs to (0 = default/no group). */
+ short agrp_index;
+ /** For quick detecting which constraints affect this channel. */
+ char constflag;
+ /** Copy of bone flag, so you can work with library armatures, not for runtime use. */
+ char selectflag;
char drawflag;
char bboneflag DNA_DEPRECATED;
- char pad0[4];
-
- struct Bone *bone; /* set on read file or rebuild pose */
- struct bPoseChannel *parent; /* set on read file or rebuild pose */
- struct bPoseChannel *child; /* set on read file or rebuild pose, the 'ik' child, for b-bones */
-
- struct ListBase iktree; /* "IK trees" - only while evaluating pose */
- struct ListBase siktree; /* Spline-IK "trees" - only while evaluating pose */
-
- bMotionPath *mpath; /* motion path cache for this bone */
- struct Object *custom; /* draws custom object instead of default bone shape */
- struct bPoseChannel *custom_tx; /* odd feature, display with another bones transform.
- * needed in rare cases for advanced rigs,
- * since the alternative is highly complicated - campbell */
+ char _pad0[4];
+
+ /** Set on read file or rebuild pose. */
+ struct Bone *bone;
+ /** Set on read file or rebuild pose. */
+ struct bPoseChannel *parent;
+ /** Set on read file or rebuild pose, the 'ik' child, for b-bones. */
+ struct bPoseChannel *child;
+
+ /** "IK trees" - only while evaluating pose. */
+ struct ListBase iktree;
+ /** Spline-IK "trees" - only while evaluating pose. */
+ struct ListBase siktree;
+
+ /** Motion path cache for this bone. */
+ bMotionPath *mpath;
+ /** Draws custom object instead of default bone shape. */
+ struct Object *custom;
+ /**
+ * Odd feature, display with another bones transform.
+ * needed in rare cases for advanced rigs,
+ * since the alternative is highly complicated - campbell
+ */
+ struct bPoseChannel *custom_tx;
float custom_scale;
- char pad1[4];
+ char _pad1[4];
- /* transforms - written in by actions or transform */
+ /** Transforms - written in by actions or transform. */
float loc[3];
float size[3];
- /* rotations - written in by actions or transform (but only one representation gets used at any time) */
- float eul[3]; /* euler rotation */
- float quat[4]; /* quaternion rotation */
- float rotAxis[3], rotAngle; /* axis-angle rotation */
- short rotmode; /* eRotationModes - rotation representation to use */
- short pad;
-
- float chan_mat[4][4]; /* matrix result of loc/quat/size, and where we put deform in, see next line */
- float pose_mat[4][4]; /* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat
- * this matrix is object space */
- float disp_mat[4][4]; /* for display, pose_mat with bone length applied */
- float disp_tail_mat[4][4]; /* for display, pose_mat with bone length applied and translated to tail*/
- float constinv[4][4]; /* inverse result of constraints.
- * doesn't include effect of restposition, parent, and local transform*/
-
- 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, note! - these are stored in degrees, not radians */
- float stiffness[3]; /* DOF stiffness */
- float ikstretch;
- float ikrotweight; /* weight of joint rotation constraint */
- float iklinweight; /* weight of joint stretch constraint */
+ /**
+ * Rotations - written in by actions or transform
+ * (but only one representation gets used at any time)
+ */
+ /** Euler rotation. */
+ float eul[3];
+ /** Quaternion rotation. */
+ float quat[4];
+ /** Axis-angle rotation. */
+ float rotAxis[3], rotAngle;
+ /** #eRotationModes - rotation representation to use. */
+ short rotmode;
+ char _pad[2];
+
+ /** Matrix result of loc/quat/size, and where we put deform in, see next line */
+ float chan_mat[4][4];
+ /**
+ * Constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat
+ * this matrix is object space.
+ */
+ float pose_mat[4][4];
+ /** For display, pose_mat with bone length applied. */
+ float disp_mat[4][4];
+ /** For display, pose_mat with bone length applied and translated to tai.l*/
+ float disp_tail_mat[4][4];
+ /**
+ * Inverse result of constraints.
+ * doesn't include effect of restposition, parent, and local transform.
+ */
+ float constinv[4][4];
+
+ /** Actually pose_mat[3]. */
+ float pose_head[3];
+ /** Also used for drawing help lines. */
+ float pose_tail[3];
- /* curved bones settings - these are for animating, and are applied on top of the copies in pchan->bone */
+ /** DOF constraint, note! - these are stored in degrees, not radians. */
+ float limitmin[3], limitmax[3];
+ /** DOF stiffness. */
+ float stiffness[3];
+ float ikstretch;
+ /** Weight of joint rotation constraint. */
+ float ikrotweight;
+ /** Weight of joint stretch constraint. */
+ float iklinweight;
+
+ /**
+ * Curved bones settings - these are for animating,
+ * and are applied on top of the copies in pchan->bone
+ */
float roll1, roll2;
float curveInX, curveInY;
float curveOutX, curveOutY;
float ease1, ease2;
float scaleIn, scaleOut;
- struct bPoseChannel *bbone_prev; /* B-Bone custom handles; set on read file or rebuild pose based on pchan->bone data */
+ /** B-Bone custom handles; set on read file or rebuild pose based on pchan->bone data. */
+ struct bPoseChannel *bbone_prev;
struct bPoseChannel *bbone_next;
- void *temp; /* use for outliner */
- /* Runtime data for color and bbone segment matrix. */
+ /** Use for outliner. */
+ void *temp;
+ /** Runtime data for color and bbone segment matrix. */
bPoseChannelDrawData *draw_data;
- /* Points to an original pose channel. */
+ /** Points to an original pose channel. */
struct bPoseChannel *orig_pchan;
- /* Runtime data. */
- struct bPoseChannelRuntime runtime;
+ /** Runtime data (keep last). */
+ struct bPoseChannel_Runtime runtime;
} bPoseChannel;
@@ -338,7 +365,7 @@ typedef enum ePchan_Flag {
POSE_HAS_IKS = (1 << 14),
#endif
/* spline IK solving */
- POSE_IKSPLINE = (1 << 15)
+ POSE_IKSPLINE = (1 << 15),
} ePchan_Flag;
/* PoseChannel constflag (constraint detection) */
@@ -351,7 +378,7 @@ typedef enum ePchan_ConstFlag {
/* only for drawing Posemode too */
PCHAN_HAS_STRIDE = (1 << 4),
/* spline IK */
- PCHAN_HAS_SPLINEIK = (1 << 5)
+ PCHAN_HAS_SPLINEIK = (1 << 5),
} ePchan_ConstFlag;
/* PoseChannel->ikflag */
@@ -369,7 +396,7 @@ typedef enum ePchan_IkFlag {
BONE_IK_NO_XDOF_TEMP = (1 << 10),
BONE_IK_NO_YDOF_TEMP = (1 << 11),
- BONE_IK_NO_ZDOF_TEMP = (1 << 12)
+ BONE_IK_NO_ZDOF_TEMP = (1 << 12),
} ePchan_IkFlag;
/* PoseChannel->drawflag */
@@ -397,7 +424,8 @@ typedef enum eRotationModes {
/* quaternion rotations (default, and for older Blender versions) */
ROT_MODE_QUAT = 0,
/* euler rotations - keep in sync with enum in BLI_math.h */
- ROT_MODE_EUL = 1, /* Blender 'default' (classic) - must be as 1 to sync with BLI_math_rotation.h defines */
+ /** Blender 'default' (classic) - must be as 1 to sync with BLI_math_rotation.h defines */
+ ROT_MODE_EUL = 1,
ROT_MODE_XYZ = 1,
ROT_MODE_XZY = 2,
ROT_MODE_YXZ = 3,
@@ -411,7 +439,7 @@ typedef enum eRotationModes {
ROT_MODE_AXISANGLE = -1,
ROT_MODE_MIN = ROT_MODE_AXISANGLE, /* sentinel for Py API */
- ROT_MODE_MAX = ROT_MODE_ZYX
+ ROT_MODE_MAX = ROT_MODE_ZYX,
} eRotationModes;
/* Pose ------------------------------------ */
@@ -422,32 +450,46 @@ typedef enum eRotationModes {
* though there is a define for it (hack for the outliner).
*/
typedef struct bPose {
- ListBase chanbase; /* list of pose channels, PoseBones in RNA */
- struct GHash *chanhash; /* ghash for quicker string lookups */
+ /** List of pose channels, PoseBones in RNA. */
+ ListBase chanbase;
+ /** Ghash for quicker string lookups. */
+ struct GHash *chanhash;
/* Flat array of pose channels. It references pointers from
* chanbase. Used for quick pose channel lookup from an index.
*/
bPoseChannel **chan_array;
- short flag, pad;
- unsigned int proxy_layer; /* proxy layer: copy from armature, gets synced */
- int pad1;
-
- float ctime; /* local action time of this pose */
- float stride_offset[3]; /* applied to object */
- float cyclic_offset[3]; /* result of match and cycles, applied in BKE_pose_where_is() */
+ short flag;
+ char _pad[2];
+ /** Proxy layer: copy from armature, gets synced. */
+ unsigned int proxy_layer;
+ char _pad1[4];
+ /** Local action time of this pose. */
+ float ctime;
+ /** Applied to object. */
+ float stride_offset[3];
+ /** Result of match and cycles, applied in BKE_pose_where_is(). */
+ float cyclic_offset[3];
- ListBase agroups; /* list of bActionGroups */
- int active_group; /* index of active group (starts from 1) */
- int iksolver; /* ik solver to use, see ePose_IKSolverType */
- void *ikdata; /* temporary IK data, depends on the IK solver. Not saved in file */
- void *ikparam; /* IK solver parameters, structure depends on iksolver */
+ /** List of bActionGroups. */
+ ListBase agroups;
- bAnimVizSettings avs; /* settings for visualization of bone animation */
- char proxy_act_bone[64]; /* proxy active bone name, MAXBONENAME */
+ /** Index of active group (starts from 1). */
+ int active_group;
+ /** Ik solver to use, see ePose_IKSolverType. */
+ int iksolver;
+ /** Temporary IK data, depends on the IK solver. Not saved in file. */
+ void *ikdata;
+ /** IK solver parameters, structure depends on iksolver. */
+ void *ikparam;
+
+ /** Settings for visualization of bone animation. */
+ bAnimVizSettings avs;
+ /** Proxy active bone name, MAXBONENAME. */
+ char proxy_act_bone[64];
} bPose;
@@ -475,7 +517,7 @@ typedef enum ePose_Flags {
/* bPose->iksolver and bPose->ikparam->iksolver */
typedef enum ePose_IKSolverType {
IKSOLVER_STANDARD = 0,
- IKSOLVER_ITASC = 1
+ IKSOLVER_ITASC = 1,
} ePose_IKSolverType;
/* header for all bPose->ikparam structures */
@@ -494,9 +536,12 @@ typedef struct bItasc {
short solver;
short flag;
float feedback;
- float maxvel; /* max velocity to SDLS solver */
- float dampmax; /* maximum damping for DLS solver */
- float dampeps; /* threshold of singular value from which the damping start progressively */
+ /** Max velocity to SDLS solver. */
+ float maxvel;
+ /** Maximum damping for DLS solver. */
+ float dampmax;
+ /** Threshold of singular value from which the damping start progressively. */
+ float dampeps;
} bItasc;
/* bItasc->flag */
@@ -504,7 +549,7 @@ typedef enum eItasc_Flags {
ITASC_AUTO_STEP = (1 << 0),
ITASC_INITIAL_REITERATION = (1 << 1),
ITASC_REITERATION = (1 << 2),
- ITASC_SIMULATION = (1 << 3)
+ ITASC_SIMULATION = (1 << 3),
} eItasc_Flags;
/* bItasc->solver */
@@ -536,13 +581,24 @@ typedef enum eItasc_Solver {
typedef struct bActionGroup {
struct bActionGroup *next, *prev;
- ListBase channels; /* Note: this must not be touched by standard listbase functions which would clear links to other channels */
+ /**
+ * Note: this must not be touched by standard listbase functions
+ * which would clear links to other channels.
+ */
+ ListBase channels;
- int flag; /* settings for this action-group */
- int customCol; /* index of custom color set to use when used for bones (0=default - used for all old files, -1=custom set) */
- char name[64]; /* name of the group */
+ /** Settings for this action-group. */
+ int flag;
+ /**
+ * Index of custom color set to use when used for bones
+ * (0=default - used for all old files, -1=custom set).
+ */
+ int customCol;
+ /** Name of the group. */
+ char name[64];
- ThemeWireColor cs; /* color set to use when customCol == -1 */
+ /** Color set to use when customCol == -1. */
+ ThemeWireColor cs;
} bActionGroup;
/* Action Group flags */
@@ -566,7 +622,7 @@ typedef enum eActionGroup_Flag {
AGRP_MODIFIERS_OFF = (1 << 7),
AGRP_TEMP = (1 << 30),
- AGRP_MOVED = (1u << 31)
+ AGRP_MOVED = (1u << 31),
} eActionGroup_Flag;
@@ -583,18 +639,29 @@ typedef enum eActionGroup_Flag {
* affects a group of related settings (as defined by the user).
*/
typedef struct bAction {
- ID id; /* ID-serialisation for relinking */
-
- ListBase curves; /* function-curves (FCurve) */
- ListBase chanbase DNA_DEPRECATED; /* legacy data - Action Channels (bActionChannel) in pre-2.5 animation system */
- ListBase groups; /* groups of function-curves (bActionGroup) */
- ListBase markers; /* markers local to the Action (used to provide Pose-Libraries) */
-
- int flag; /* settings for this action */
- int active_marker; /* index of the active marker */
-
- int idroot; /* type of ID-blocks that action can be assigned to (if 0, will be set to whatever ID first evaluates it) */
- int pad;
+ /** ID-serialisation for relinking. */
+ ID id;
+
+ /** Function-curves (FCurve). */
+ ListBase curves;
+ /** Legacy data - Action Channels (bActionChannel) in pre-2.5 animation system. */
+ ListBase chanbase DNA_DEPRECATED;
+ /** Groups of function-curves (bActionGroup). */
+ ListBase groups;
+ /** Markers local to the Action (used to provide Pose-Libraries). */
+ ListBase markers;
+
+ /** Settings for this action. */
+ int flag;
+ /** Index of the active marker. */
+ int active_marker;
+
+ /**
+ * Type of ID-blocks that action can be assigned to
+ * (if 0, will be set to whatever ID first evaluates it).
+ */
+ int idroot;
+ char _pad[4];
} bAction;
@@ -607,7 +674,7 @@ typedef enum eAction_Flags {
/* flags for evaluation/editing */
ACT_MUTED = (1 << 9),
ACT_PROTECTED = (1 << 10),
- ACT_DISABLED = (1 << 11)
+ ACT_DISABLED = (1 << 11),
} eAction_Flags;
@@ -616,37 +683,50 @@ 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 initialized when pinned) */ // XXX not used!
-
- struct Collection *filter_grp; /* object group for option to only include objects that belong to this Collection */
- char searchstr[64]; /* string to search for in displayed names of F-Curves, or NlaTracks/GP Layers/etc. */
-
- int filterflag; /* flags to use for filtering data */
- int flag; /* standard flags */
-
- int renameIndex; /* index+1 of channel to rename - only gets set by renaming operator */
- int pad;
+ /** Currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil). */
+ ID *source;
+ /** Cache for channels (only initialized when pinned). */ // XXX not used!
+ ListBase chanbase;
+
+ /** Object group for option to only include objects that belong to this Collection. */
+ struct Collection *filter_grp;
+ /** String to search for in displayed names of F-Curves, or NlaTracks/GP Layers/etc. */
+ char searchstr[64];
+
+ /** Flags to use for filtering data. */
+ int filterflag;
+ int filterflag2;
+ /** Standard flags. */
+ int flag;
+
+ /** Index+1 of channel to rename - only gets set by renaming operator. */
+ int renameIndex;
} bDopeSheet;
/* DopeSheet filter-flag */
typedef enum eDopeSheet_FilterFlag {
/* general filtering */
- ADS_FILTER_ONLYSEL = (1 << 0), /* only include channels relating to selected data */
+ /** only include channels relating to selected data */
+ ADS_FILTER_ONLYSEL = (1 << 0),
/* temporary filters */
- ADS_FILTER_ONLYDRIVERS = (1 << 1), /* for 'Drivers' editor - only include Driver data from AnimData */
- ADS_FILTER_ONLYNLA = (1 << 2), /* for 'NLA' editor - only include NLA data from AnimData */
- ADS_FILTER_SELEDIT = (1 << 3), /* for Graph Editor - used to indicate whether to include a filtering flag or not */
+ /** for 'Drivers' editor - only include Driver data from AnimData */
+ ADS_FILTER_ONLYDRIVERS = (1 << 1),
+ /** for 'NLA' editor - only include NLA data from AnimData */
+ ADS_FILTER_ONLYNLA = (1 << 2),
+ /** for Graph Editor - used to indicate whether to include a filtering flag or not */
+ ADS_FILTER_SELEDIT = (1 << 3),
/* general filtering */
- ADS_FILTER_SUMMARY = (1 << 4), /* for 'DopeSheet' Editors - include 'summary' line */
+ /** for 'DopeSheet' Editors - include 'summary' line */
+ ADS_FILTER_SUMMARY = (1 << 4),
/* datatype-based filtering */
ADS_FILTER_NOSHAPEKEYS = (1 << 6),
ADS_FILTER_NOMESH = (1 << 7),
- ADS_FILTER_NOOBJ = (1 << 8), /* for animdata on object level, if we only want to concentrate on materials/etc. */
+ /** for animdata on object level, if we only want to concentrate on materials/etc. */
+ ADS_FILTER_NOOBJ = (1 << 8),
ADS_FILTER_NOLAT = (1 << 9),
ADS_FILTER_NOCAM = (1 << 10),
ADS_FILTER_NOMAT = (1 << 11),
@@ -666,28 +746,40 @@ typedef enum eDopeSheet_FilterFlag {
/* NOTE: all new datablock filters will have to go in filterflag2 (see below) */
/* NLA-specific filters */
- ADS_FILTER_NLA_NOACT = (1 << 25), /* if the AnimData block has no NLA data, don't include to just show Action-line */
+ /** if the AnimData block has no NLA data, don't include to just show Action-line */
+ ADS_FILTER_NLA_NOACT = (1 << 25),
/* general filtering 3 */
- ADS_FILTER_INCL_HIDDEN = (1 << 26), /* include 'hidden' channels too (i.e. those from hidden Objects/Bones) */
- ADS_FILTER_ONLY_ERRORS = (1 << 28), /* show only F-Curves which are disabled/have errors - for debugging drivers */
+ /** include 'hidden' channels too (i.e. those from hidden Objects/Bones) */
+ ADS_FILTER_INCL_HIDDEN = (1 << 26),
+ /** show only F-Curves which are disabled/have errors - for debugging drivers */
+ ADS_FILTER_ONLY_ERRORS = (1 << 28),
/* GPencil Mode */
- ADS_FILTER_GP_3DONLY = (1 << 29), /* GP Mode - Only show datablocks used in the scene */
+ /** GP Mode - Only show datablocks used in the scene */
+ ADS_FILTER_GP_3DONLY = (1 << 29),
- /* combination filters (some only used at runtime) */
- ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM | ADS_FILTER_NOMAT | ADS_FILTER_NOLAM | ADS_FILTER_NOCUR | ADS_FILTER_NOPART | ADS_FILTER_NOARM | ADS_FILTER_NOSPK | ADS_FILTER_NOMODIFIERS)
+ /** combination filters (some only used at runtime) */
+ ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM | ADS_FILTER_NOMAT | ADS_FILTER_NOLAM | ADS_FILTER_NOCUR | ADS_FILTER_NOPART | ADS_FILTER_NOARM | ADS_FILTER_NOSPK | ADS_FILTER_NOMODIFIERS),
} eDopeSheet_FilterFlag;
+/* DopeSheet filter-flags - Overflow (filterflag2) */
+typedef enum eDopeSheet_FilterFlag2 {
+ ADS_FILTER_NOCACHEFILES = (1 << 1),
+} eDopeSheet_FilterFlag2;
+
/* DopeSheet general flags */
typedef enum eDopeSheet_Flag {
- ADS_FLAG_SUMMARY_COLLAPSED = (1 << 0), /* when summary is shown, it is collapsed, so all other channels get hidden */
- ADS_FLAG_SHOW_DBFILTERS = (1 << 1), /* show filters for datablocks */
-
- ADS_FLAG_FUZZY_NAMES = (1 << 2), /* use fuzzy/partial string matches when ADS_FILTER_BY_FCU_NAME is enabled (WARNING: expensive operation) */
- ADS_FLAG_NO_DB_SORT = (1 << 3), /* do not sort datablocks (mostly objects) by name (NOTE: potentially expensive operation) */
-
- /* NOTE: datablock filter flags continued (1 << 10) onwards... */
+ /** when summary is shown, it is collapsed, so all other channels get hidden */
+ ADS_FLAG_SUMMARY_COLLAPSED = (1 << 0),
+ /** show filters for datablocks */
+ ADS_FLAG_SHOW_DBFILTERS = (1 << 1),
+
+ /** use fuzzy/partial string matches when ADS_FILTER_BY_FCU_NAME is enabled
+ * (WARNING: expensive operation) */
+ ADS_FLAG_FUZZY_NAMES = (1 << 2),
+ /** do not sort datablocks (mostly objects) by name (NOTE: potentially expensive operation) */
+ ADS_FLAG_NO_DB_SORT = (1 << 3),
} eDopeSheet_Flag;
@@ -700,26 +792,33 @@ typedef struct SpaceAction_Runtime {
/* Action Editor Space. This is defined here instead of in DNA_space_types.h */
typedef struct SpaceAction {
struct SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
/* End 'SpaceLink' header. */
- View2D v2d DNA_DEPRECATED; /* copied to region */
+ /** Copied to region. */
+ View2D v2d DNA_DEPRECATED;
- bAction *action; /* the currently active action */
- bDopeSheet ads; /* the currently active context (when not showing action) */
+ /** The currently active action. */
+ bAction *action;
+ /** The currently active context (when not showing action). */
+ bDopeSheet ads;
- float timeslide; /* for Time-Slide transform mode drawing - current frame? */
+ /** For Time-Slide transform mode drawing - current frame?. */
+ float timeslide;
short flag;
/* Editing context */
char mode;
/* Storage for sub-space types. */
char mode_prev;
- char autosnap; /* automatic keyframe snapping mode */
- char cache_display; /* (eTimeline_Cache_Flag) */
+ /** Automatic keyframe snapping mode . */
+ char autosnap;
+ /** (eTimeline_Cache_Flag). */
+ char cache_display;
char _pad1[6];
SpaceAction_Runtime runtime;
@@ -753,6 +852,8 @@ typedef enum eSAction_Flag {
SACTION_SHOW_INTERPOLATION = (1 << 12),
/* show extremes */
SACTION_SHOW_EXTREMES = (1 << 13),
+ /* show vertical line markers */
+ SACTION_SHOW_MARKER_LINES = (1 << 14),
} eSAction_Flag;
@@ -793,7 +894,7 @@ typedef enum eAnimEdit_AutoSnap {
/* snap to actual seconds (nla-action time) */
SACTSNAP_SECOND = 4,
/* snap to 1.0 second increments */
- SACTSNAP_TSTEP = 5
+ SACTSNAP_TSTEP = 5,
} eAnimEdit_AutoSnap;
/* SAction->cache_display */
@@ -824,14 +925,20 @@ typedef enum eTimeline_Cache_Flag {
*/
typedef struct bActionChannel {
struct bActionChannel *next, *prev;
- bActionGroup *grp; /* Action Group this Action Channel belongs to */
-
- struct Ipo *ipo; /* IPO block this action channel references */
- ListBase constraintChannels; /* Constraint Channels (when Action Channel represents an Object or Bone) */
-
- int flag; /* settings accessed via bitmapping */
- char name[64]; /* channel name, MAX_NAME */
- int temp; /* temporary setting - may be used to indicate group that channel belongs to during syncing */
+ /** Action Group this Action Channel belongs to. */
+ bActionGroup *grp;
+
+ /** IPO block this action channel references. */
+ struct Ipo *ipo;
+ /** Constraint Channels (when Action Channel represents an Object or Bone). */
+ ListBase constraintChannels;
+
+ /** Settings accessed via bitmapping. */
+ int flag;
+ /** Channel name, MAX_NAME. */
+ char name[64];
+ /** Temporary setting - may be used to indicate group that channel belongs to during syncing. */
+ int temp;
} bActionChannel;
/* Action Channel flags (ONLY USED FOR DO_VERSIONS...) */
@@ -843,7 +950,7 @@ typedef enum eActionChannelFlag {
ACHAN_EXPANDED = (1 << 4),
ACHAN_SHOWIPO = (1 << 5),
ACHAN_SHOWCONS = (1 << 6),
- ACHAN_MOVED = (1u << 31)
+ ACHAN_MOVED = (1u << 31),
} eActionChannelFlag;
#endif /* __DNA_ACTION_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 2d1cbdc490d..14708632eb6 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
* All rights reserved.
- *
- * Contributor(s): Joshua Leung (full recode)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_anim_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_ANIM_TYPES_H__
@@ -44,7 +38,8 @@ extern "C" {
/* Modifiers -------------------------------------- */
-/* F-Curve Modifiers (fcm)
+/**
+ * F-Curve Modifiers (fcm)
*
* These alter the way F-Curves behave, by altering the value that is returned
* when evaluating the curve's data at some time (t).
@@ -52,22 +47,33 @@ extern "C" {
typedef struct FModifier {
struct FModifier *next, *prev;
- struct FCurve *curve; /* containing curve, only used for updates to CYCLES */
- void *data; /* pointer to modifier data */
-
- char name[64]; /* user-defined description for the modifier - MAX_ID_NAME-2 */
- short type; /* type of f-curve modifier */
- short flag; /* settings for the modifier */
-
- float influence; /* the amount that the modifier should influence the value */
-
- float sfra; /* start frame of restricted frame-range */
- float efra; /* end frame of restricted frame-range */
- float blendin; /* number of frames from sfra before modifier takes full influence */
- float blendout; /* number of frames from efra before modifier fades out */
+ /** Containing curve, only used for updates to CYCLES. */
+ struct FCurve *curve;
+ /** Pointer to modifier data. */
+ void *data;
+
+ /** User-defined description for the modifier - MAX_ID_NAME-2. */
+ char name[64];
+ /** Type of f-curve modifier. */
+ short type;
+ /** Settings for the modifier. */
+ short flag;
+
+ /** The amount that the modifier should influence the value. */
+ float influence;
+
+ /** Start frame of restricted frame-range. */
+ float sfra;
+ /** End frame of restricted frame-range. */
+ float efra;
+ /** Number of frames from sfra before modifier takes full influence. */
+ float blendin;
+ /** Number of frames from efra before modifier fades out. */
+ float blendout;
} FModifier;
-/* Types of F-Curve modifier
+/**
+ * Types of F-Curve modifier
* WARNING: order here is important!
*/
typedef enum eFModifier_Types {
@@ -77,7 +83,8 @@ typedef enum eFModifier_Types {
FMODIFIER_TYPE_ENVELOPE = 3,
FMODIFIER_TYPE_CYCLES = 4,
FMODIFIER_TYPE_NOISE = 5,
- FMODIFIER_TYPE_FILTER = 6, /* unimplemented - for applying: fft, high/low pass filters, etc. */
+ /** unimplemented - for applying: fft, high/low pass filters, etc. */
+ FMODIFIER_TYPE_FILTER = 6,
FMODIFIER_TYPE_PYTHON = 7,
FMODIFIER_TYPE_LIMITS = 8,
FMODIFIER_TYPE_STEPPED = 9,
@@ -99,7 +106,7 @@ typedef enum eFModifier_Flags {
/* restrict range that F-Modifier can be considered over */
FMODIFIER_FLAG_RANGERESTRICT = (1<<4),
/* use influence control */
- FMODIFIER_FLAG_USEINFLUENCE = (1<<5)
+ FMODIFIER_FLAG_USEINFLUENCE = (1<<5),
} eFModifier_Flags;
/* --- */
@@ -107,20 +114,25 @@ typedef enum eFModifier_Flags {
/* Generator modifier data */
typedef struct FMod_Generator {
/* general generator information */
- float *coefficients; /* coefficients array */
- unsigned int arraysize; /* size of the coefficients array */
+ /** Coefficients array. */
+ float *coefficients;
+ /** Size of the coefficients array. */
+ unsigned int arraysize;
- int poly_order; /* order of polynomial generated (i.e. 1 for linear, 2 for quadratic) */
- int mode; /* which 'generator' to use eFMod_Generator_Modes */
+ /** Order of polynomial generated (i.e. 1 for linear, 2 for quadratic). */
+ int poly_order;
+ /** Which 'generator' to use eFMod_Generator_Modes. */
+ int mode;
/* settings */
- int flag; /* settings */
+ /** Settings. */
+ int flag;
} FMod_Generator;
/* generator modes */
typedef enum eFMod_Generator_Modes {
FCM_GENERATOR_POLYNOMIAL = 0,
- FCM_GENERATOR_POLYNOMIAL_FACTORISED = 1
+ FCM_GENERATOR_POLYNOMIAL_FACTORISED = 1,
} eFMod_Generator_Modes;
@@ -128,12 +140,13 @@ typedef enum eFMod_Generator_Modes {
* - shared by Generator and Function Generator
*/
typedef enum eFMod_Generator_Flags {
- /* generator works in conjunction with other modifiers (i.e. doesn't replace those before it) */
- FCM_GENERATOR_ADDITIVE = (1<<0)
+ /* generator works in conjunction with other modifiers (i.e. doesn't replace those before it) */
+ FCM_GENERATOR_ADDITIVE = (1<<0),
} eFMod_Generator_Flags;
-/* 'Built-In Function' Generator modifier data
+/**
+ * 'Built-In Function' Generator modifier data
*
* This uses the general equation for equations:
* y = amplitude * fn(phase_multiplier*x + phase_offset) + y_offset
@@ -142,15 +155,17 @@ typedef enum eFMod_Generator_Flags {
* x is the evaluation 'time', and 'y' is the resultant value
*/
typedef struct FMod_FunctionGenerator {
- /* coefficients for general equation (as above) */
+ /** Coefficients for general equation (as above). */
float amplitude;
float phase_multiplier;
float phase_offset;
float value_offset;
- /* flags */
- int type; /* eFMod_Generator_Functions */
- int flag; /* eFMod_Generator_flags */
+ /* flags */
+ /** #eFMod_Generator_Functions. */
+ int type;
+ /** #eFMod_Generator_flags. */
+ int flag;
} FMod_FunctionGenerator;
/* 'function' generator types */
@@ -160,59 +175,79 @@ typedef enum eFMod_Generator_Functions {
FCM_GENERATOR_FN_TAN = 2,
FCM_GENERATOR_FN_SQRT = 3,
FCM_GENERATOR_FN_LN = 4,
- FCM_GENERATOR_FN_SINC = 5
+ FCM_GENERATOR_FN_SINC = 5,
} eFMod_Generator_Functions;
/* envelope modifier - envelope data */
typedef struct FCM_EnvelopeData {
- float min, max; /* min/max values for envelope at this point (absolute values) */
- float time; /* time for that this sample-point occurs */
-
- short f1; /* settings for 'min' control point */
- short f2; /* settings for 'max' control point */
+ /** Min/max values for envelope at this point (absolute values) . */
+ float min, max;
+ /** Time for that this sample-point occurs. */
+ float time;
+
+ /** Settings for 'min' control point. */
+ short f1;
+ /** Settings for 'max' control point. */
+ short f2;
} FCM_EnvelopeData;
/* envelope-like adjustment to values (for fade in/out) */
typedef struct FMod_Envelope {
- FCM_EnvelopeData *data; /* data-points defining envelope to apply (array) */
- int totvert; /* number of envelope points */
-
- float midval; /* value that envelope's influence is centered around / based on */
- float min, max; /* distances from 'middle-value' for 1:1 envelope influence */
+ /** Data-points defining envelope to apply (array) . */
+ FCM_EnvelopeData *data;
+ /** Number of envelope points. */
+ int totvert;
+
+ /** Value that envelope's influence is centered around / based on. */
+ float midval;
+ /** Distances from 'middle-value' for 1:1 envelope influence. */
+ float min, max;
} FMod_Envelope;
/* cycling/repetition modifier data */
// TODO: we can only do complete cycles...
typedef struct FMod_Cycles {
- short before_mode; /* extrapolation mode to use before first keyframe */
- short after_mode; /* extrapolation mode to use after last keyframe */
- short before_cycles; /* number of 'cycles' before first keyframe to do */
- short after_cycles; /* number of 'cycles' after last keyframe to do */
+ /** Extrapolation mode to use before first keyframe. */
+ short before_mode;
+ /** Extrapolation mode to use after last keyframe. */
+ short after_mode;
+ /** Number of 'cycles' before first keyframe to do. */
+ short before_cycles;
+ /** Number of 'cycles' after last keyframe to do. */
+ short after_cycles;
} FMod_Cycles;
/* cycling modes */
typedef enum eFMod_Cycling_Modes {
- FCM_EXTRAPOLATE_NONE = 0, /* don't do anything */
- FCM_EXTRAPOLATE_CYCLIC, /* repeat keyframe range as-is */
- FCM_EXTRAPOLATE_CYCLIC_OFFSET, /* repeat keyframe range, but with offset based on gradient between values */
- FCM_EXTRAPOLATE_MIRROR /* alternate between forward and reverse playback of keyframe range */
+ /** don't do anything */
+ FCM_EXTRAPOLATE_NONE = 0,
+ /** repeat keyframe range as-is */
+ FCM_EXTRAPOLATE_CYCLIC,
+ /** repeat keyframe range, but with offset based on gradient between values */
+ FCM_EXTRAPOLATE_CYCLIC_OFFSET,
+ /** alternate between forward and reverse playback of keyframe range */
+ FCM_EXTRAPOLATE_MIRROR
} eFMod_Cycling_Modes;
/* Python-script modifier data */
typedef struct FMod_Python {
- struct Text *script; /* text buffer containing script to execute */
- IDProperty *prop; /* ID-properties to provide 'custom' settings */
+ /** Text buffer containing script to execute. */
+ struct Text *script;
+ /** ID-properties to provide 'custom' settings. */
+ IDProperty *prop;
} FMod_Python;
/* limits modifier data */
typedef struct FMod_Limits {
- rctf rect; /* rect defining the min/max values */
- int flag; /* settings for limiting */
- int pad;
+ /** Rect defining the min/max values. */
+ rctf rect;
+ /** Settings for limiting. */
+ int flag;
+ char _pad[4];
} FMod_Limits;
/* limiting flags */
@@ -220,7 +255,7 @@ typedef enum eFMod_Limit_Flags {
FCM_LIMIT_XMIN = (1<<0),
FCM_LIMIT_XMAX = (1<<1),
FCM_LIMIT_YMIN = (1<<2),
- FCM_LIMIT_YMAX = (1<<3)
+ FCM_LIMIT_YMAX = (1<<3),
} eFMod_Limit_Flags;
@@ -246,13 +281,18 @@ typedef enum eFMod_Noise_Modifications {
/* stepped modifier data */
typedef struct FMod_Stepped {
- float step_size; /* Number of frames each interpolated value should be held */
- float offset; /* Reference frame number that stepping starts from */
+ /** Number of frames each interpolated value should be held. */
+ float step_size;
+ /** Reference frame number that stepping starts from. */
+ float offset;
- float start_frame; /* start frame of the frame range that modifier works in */
- float end_frame; /* end frame of the frame range that modifier works in */
+ /** Start frame of the frame range that modifier works in. */
+ float start_frame;
+ /** End frame of the frame range that modifier works in. */
+ float end_frame;
- int flag; /* various settings */
+ /** Various settings. */
+ int flag;
} FMod_Stepped;
/* stepped modifier range flags */
@@ -268,15 +308,27 @@ typedef enum eFMod_Stepped_Flags {
* Defines how to access a dependency needed for a driver variable.
*/
typedef struct DriverTarget {
- ID *id; /* ID-block which owns the target, no user count */
+ /** ID-block which owns the target, no user count. */
+ ID *id;
- char *rna_path; /* RNA path defining the setting to use (for DVAR_TYPE_SINGLE_PROP) */
+ /** RNA path defining the setting to use (for DVAR_TYPE_SINGLE_PROP). */
+ char *rna_path;
- char pchan_name[64]; /* name of the posebone to use (for vars where DTAR_FLAG_STRUCT_REF is used) - MAX_ID_NAME-2 */
- short transChan; /* transform channel index (for DVAR_TYPE_TRANSFORM_CHAN)*/
+ /**
+ * Name of the posebone to use
+ * (for vars where DTAR_FLAG_STRUCT_REF is used) - MAX_ID_NAME-2.
+ */
+ char pchan_name[64];
+ /** Transform channel index (for DVAR_TYPE_TRANSFORM_CHAN.)*/
+ short transChan;
- short flag; /* flags for the validity of the target (NOTE: these get reset every time the types change) */
- int idtype; /* type of ID-block that this target can use */
+ /**
+ * Flags for the validity of the target
+ * (NOTE: these get reset every time the types change).
+ */
+ short flag;
+ /** Type of ID-block that this target can use. */
+ int idtype;
} DriverTarget;
/* Driver Target flags */
@@ -329,15 +381,24 @@ typedef enum eDriverTarget_TransformChannels {
typedef struct DriverVar {
struct DriverVar *next, *prev;
- char name[64]; /* name of the variable to use in py-expression (must be valid python identifier) - MAX_ID_NAME-2 */
+ /**
+ * Name of the variable to use in py-expression
+ * (must be valid python identifier) - MAX_ID_NAME-2.
+ */
+ char name[64];
- DriverTarget targets[8]; /* MAX_DRIVER_TARGETS, target slots */
+ /** MAX_DRIVER_TARGETS, target slots. */
+ DriverTarget targets[8];
- char num_targets; /* number of targets actually used by this variable */
- char type; /* type of driver variable (eDriverVar_Types) */
+ /** Number of targets actually used by this variable. */
+ char num_targets;
+ /** Type of driver variable (eDriverVar_Types). */
+ char type;
- short flag; /* validation tags, etc. (eDriverVar_Flags) */
- float curval; /* result of previous evaluation */
+ /** Validation tags, etc. (eDriverVar_Flags). */
+ short flag;
+ /** Result of previous evaluation. */
+ float curval;
} DriverVar;
/* Driver Variable Types */
@@ -407,22 +468,31 @@ typedef enum eDriverVar_Flags {
* evaluated in. This order is set by the Depsgraph's sorting stuff.
*/
typedef struct ChannelDriver {
- ListBase variables; /* targets for this driver (i.e. list of DriverVar) */
+ /** Targets for this driver (i.e. list of DriverVar). */
+ ListBase variables;
/* python expression to execute (may call functions defined in an accessory file)
* 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, don't save this */
-
- struct ExprPyLike_Parsed *expr_simple; /* compiled simple arithmetic expression */
-
- float curval; /* result of previous evaluation */
- float influence; /* influence of driver on result */ // XXX to be implemented... this is like the constraint influence setting
-
- /* general settings */
- int type; /* type of driver */
- int flag; /* settings of driver */
+ /** Expression to compile for evaluation. */
+ char expression[256];
+ /** PyObject - compiled expression, don't save this. */
+ void *expr_comp;
+
+ /** Compiled simple arithmetic expression. */
+ struct ExprPyLike_Parsed *expr_simple;
+
+ /** Result of previous evaluation. */
+ float curval;
+ // XXX to be implemented... this is like the constraint influence setting
+ /** Influence of driver on result. */
+ float influence;
+
+ /* general settings */
+ /** Type of driver. */
+ int type;
+ /** Settings of driver. */
+ int flag;
} ChannelDriver;
/* driver type */
@@ -444,8 +514,7 @@ typedef enum eDriver_Types {
typedef enum eDriver_Flags {
/* driver has invalid settings (internal flag) */
DRIVER_FLAG_INVALID = (1<<0),
- /* driver needs recalculation (set by depsgraph) */
- DRIVER_FLAG_RECALC = (1<<1),
+ DRIVER_FLAG_DEPRECATED = (1<<1),
/* driver does replace value, but overrides (for layering of animation over driver) */
// TODO: this needs to be implemented at some stage or left out...
//DRIVER_FLAG_LAYERING = (1<<2),
@@ -465,9 +534,11 @@ typedef enum eDriver_Flags {
* than using BPoints, which contain a lot of other unnecessary data...
*/
typedef struct FPoint {
- float vec[2]; /* time + value */
- int flag; /* selection info */
- int pad;
+ /** Time + value. */
+ float vec[2];
+ /** Selection info. */
+ int flag;
+ char _pad[4];
} FPoint;
/* 'Function-Curve' - defines values over time for a given setting (fcu) */
@@ -475,35 +546,48 @@ typedef struct FCurve {
struct FCurve *next, *prev;
/* group */
- bActionGroup *grp; /* group that F-Curve belongs to */
+ /** Group that F-Curve belongs to. */
+ bActionGroup *grp;
/* driver settings */
- ChannelDriver *driver; /* only valid for drivers (i.e. stored in AnimData not Actions) */
+ /** Only valid for drivers (i.e. stored in AnimData not Actions). */
+ ChannelDriver *driver;
/* evaluation settings */
- ListBase modifiers; /* FCurve Modifiers */
+ /** FCurve Modifiers. */
+ ListBase modifiers;
/* motion data */
- BezTriple *bezt; /* user-editable keyframes (array) */
- FPoint *fpt; /* 'baked/imported' motion samples (array) */
- unsigned int totvert; /* total number of points which define the curve (i.e. size of arrays in FPoints) */
+ /** User-editable keyframes (array). */
+ BezTriple *bezt;
+ /** 'baked/imported' motion samples (array). */
+ FPoint *fpt;
+ /** Total number of points which define the curve (i.e. size of arrays in FPoints). */
+ unsigned int totvert;
/* value cache + settings */
- float curval; /* value stored from last time curve was evaluated (not threadsafe, debug display only!) */
- /* Value which comes from original DNA ddatablock at a time f-curve was evaluated. */
- float orig_dna_val;
- short flag; /* user-editable settings for this curve */
- short extend; /* value-extending mode for this curve (does not cover */
- char auto_smoothing; /* auto-handle smoothing mode */
-
- char pad[3];
+ /** Value stored from last time curve was evaluated (not threadsafe, debug display only!). */
+ float curval;
+ char _pad2[4];
+ /** User-editable settings for this curve. */
+ short flag;
+ /** Value-extending mode for this curve (does not cover). */
+ short extend;
+ /** Auto-handle smoothing mode. */
+ char auto_smoothing;
+
+ char _pad[3];
/* RNA - data link */
- int array_index; /* if applicable, the index of the RNA-array item to get */
- char *rna_path; /* RNA-path to resolve data-access */
+ /** If applicable, the index of the RNA-array item to get. */
+ int array_index;
+ /** RNA-path to resolve data-access. */
+ char *rna_path;
/* curve coloring (for editor) */
- int color_mode; /* coloring method to use (eFCurve_Coloring) */
- float color[3]; /* the last-color this curve took */
+ /** Coloring method to use (eFCurve_Coloring). */
+ int color_mode;
+ /** The last-color this curve took. */
+ float color[3];
float prev_norm_factor, prev_offset;
} FCurve;
@@ -511,50 +595,60 @@ typedef struct FCurve {
/* user-editable flags/settings */
typedef enum eFCurve_Flags {
- /* curve/keyframes are visible in editor */
+ /** curve/keyframes are visible in editor */
FCURVE_VISIBLE = (1<<0),
- /* curve is selected for editing */
+ /** curve is selected for editing */
FCURVE_SELECTED = (1<<1),
- /* curve is active one */
+ /** curve is active one */
FCURVE_ACTIVE = (1<<2),
- /* keyframes (beztriples) cannot be edited */
+ /** keyframes (beztriples) cannot be edited */
FCURVE_PROTECTED = (1<<3),
- /* fcurve will not be evaluated for the next round */
+ /** fcurve will not be evaluated for the next round */
FCURVE_MUTED = (1<<4),
- /* fcurve uses 'auto-handles', which stay horizontal... */
- // DEPRECATED
+ /** fcurve uses 'auto-handles', which stay horizontal... */
+ // DEPRECATED
FCURVE_AUTO_HANDLES = (1<<5),
FCURVE_MOD_OFF = (1<<6),
- /* skip evaluation, as RNA-path cannot be resolved (similar to muting, but cannot be set by user) */
+ /** skip evaluation, as RNA-path cannot be resolved
+ * (similar to muting, but cannot be set by user) */
FCURVE_DISABLED = (1<<10),
- /* curve can only have whole-number values (integer types) */
+ /** curve can only have whole-number values (integer types) */
FCURVE_INT_VALUES = (1<<11),
- /* curve can only have certain discrete-number values (no interpolation at all, for enums/booleans) */
+ /** curve can only have certain discrete-number values
+ * (no interpolation at all, for enums/booleans) */
FCURVE_DISCRETE_VALUES = (1<<12),
- /* temporary tag for editing */
- FCURVE_TAGGED = (1<<15)
+ /** temporary tag for editing */
+ FCURVE_TAGGED = (1<<15),
} eFCurve_Flags;
/* extrapolation modes (only simple value 'extending') */
typedef enum eFCurve_Extend {
- FCURVE_EXTRAPOLATE_CONSTANT = 0, /* just extend min/max keyframe value */
- FCURVE_EXTRAPOLATE_LINEAR /* just extend gradient of segment between first segment keyframes */
+ /** just extend min/max keyframe value */
+ FCURVE_EXTRAPOLATE_CONSTANT = 0,
+ /** just extend gradient of segment between first segment keyframes */
+ FCURVE_EXTRAPOLATE_LINEAR
} eFCurve_Extend;
/* curve coloring modes */
typedef enum eFCurve_Coloring {
- FCURVE_COLOR_AUTO_RAINBOW = 0, /* automatically determine color using rainbow (calculated at drawtime) */
- FCURVE_COLOR_AUTO_RGB = 1, /* automatically determine color using XYZ (array index) <-> RGB */
- FCURVE_COLOR_AUTO_YRGB = 3, /* automatically determine color where XYZ <-> RGB, but index(X) != 0 */
- FCURVE_COLOR_CUSTOM = 2, /* custom color */
+ /** automatically determine color using rainbow (calculated at drawtime) */
+ FCURVE_COLOR_AUTO_RAINBOW = 0,
+ /** automatically determine color using XYZ (array index) <-> RGB */
+ FCURVE_COLOR_AUTO_RGB = 1,
+ /** automatically determine color where XYZ <-> RGB, but index(X) != 0 */
+ FCURVE_COLOR_AUTO_YRGB = 3,
+ /** custom color */
+ FCURVE_COLOR_CUSTOM = 2,
} eFCurve_Coloring;
/* curve smoothing modes */
typedef enum eFCurve_Smoothing {
- FCURVE_SMOOTH_NONE = 0, /* legacy mode: auto handles only consider adjacent points */
- FCURVE_SMOOTH_CONT_ACCEL = 1, /* maintain continuity of the acceleration */
+ /** legacy mode: auto handles only consider adjacent points */
+ FCURVE_SMOOTH_NONE = 0,
+ /** maintain continuity of the acceleration */
+ FCURVE_SMOOTH_CONT_ACCEL = 1,
} eFCurve_Smoothing;
/* ************************************************ */
@@ -578,35 +672,52 @@ typedef enum eFCurve_Smoothing {
typedef struct NlaStrip {
struct NlaStrip *next, *prev;
- ListBase strips; /* 'Child' strips (used for 'meta' strips) */
- bAction *act; /* Action that is referenced by this strip (strip is 'user' of the action) */
+ /** 'Child' strips (used for 'meta' strips). */
+ ListBase strips;
+ /** Action that is referenced by this strip (strip is 'user' of the action). */
+ bAction *act;
- ListBase fcurves; /* F-Curves for controlling this strip's influence and timing */ // TODO: move out?
- ListBase modifiers; /* F-Curve modifiers to be applied to the entire strip's referenced F-Curves */
+ /** F-Curves for controlling this strip's influence and timing */ // TODO: move o.ut?
+ ListBase fcurves;
+ /** F-Curve modifiers to be applied to the entire strip's referenced F-Curves. */
+ ListBase modifiers;
- char name[64]; /* User-Visible Identifier for Strip - MAX_ID_NAME-2 */
+ /** User-Visible Identifier for Strip - MAX_ID_NAME-2. */
+ char name[64];
- float influence; /* Influence of strip */
- float strip_time; /* Current 'time' within action being used (automatically evaluated, but can be overridden) */
+ /** Influence of strip. */
+ float influence;
+ /** Current 'time' within action being used (automatically evaluated, but can be overridden). */
+ float strip_time;
- float start, end; /* extents of the strip */
- float actstart, actend; /* range of the action to use */
+ /** Extents of the strip. */
+ float start, end;
+ /** Range of the action to use. */
+ float actstart, actend;
- float repeat; /* The number of times to repeat the action range (only when no F-Curves) */
- float scale; /* The amount the action range is scaled by (only when no F-Curves) */
+ /** The number of times to repeat the action range (only when no F-Curves). */
+ float repeat;
+ /** The amount the action range is scaled by (only when no F-Curves). */
+ float scale;
- float blendin, blendout; /* strip blending length (only used when there are no F-Curves) */
- short blendmode; /* strip blending mode (layer-based mixing) */
+ /** Strip blending length (only used when there are no F-Curves). */
+ float blendin, blendout;
+ /** Strip blending mode (layer-based mixing). */
+ short blendmode;
- short extendmode; /* strip extrapolation mode (time-based mixing) */
- short pad1;
+ /** Strip extrapolation mode (time-based mixing). */
+ short extendmode;
+ char _pad1[2];
- short type; /* type of NLA strip */
+ /** Type of NLA strip. */
+ short type;
- void *speaker_handle; /* handle for speaker objects */
+ /** Handle for speaker objects. */
+ void *speaker_handle;
- int flag; /* settings */
- int pad2;
+ /** Settings. */
+ int flag;
+ char _pad2[4];
} NlaStrip;
/* NLA Strip Blending Mode */
@@ -614,17 +725,19 @@ typedef enum eNlaStrip_Blend_Mode {
NLASTRIP_MODE_REPLACE = 0,
NLASTRIP_MODE_ADD,
NLASTRIP_MODE_SUBTRACT,
- NLASTRIP_MODE_MULTIPLY
+ NLASTRIP_MODE_MULTIPLY,
+ NLASTRIP_MODE_COMBINE,
} eNlaStrip_Blend_Mode;
/* NLA Strip Extrpolation Mode */
typedef enum eNlaStrip_Extrapolate_Mode {
- /* extend before first frame if no previous strips in track, and always hold+extend last frame */
+ /* extend before first frame if no previous strips in track,
+ * and always hold+extend last frame */
NLASTRIP_EXTEND_HOLD = 0,
- /* only hold+extend last frame */
+ /* only hold+extend last frame */
NLASTRIP_EXTEND_HOLD_FORWARD = 1,
- /* don't contribute at all */
- NLASTRIP_EXTEND_NOTHING = 2
+ /* don't contribute at all */
+ NLASTRIP_EXTEND_NOTHING = 2,
} eNlaStrip_Extrapolate_Mode;
/* NLA Strip Settings */
@@ -636,7 +749,9 @@ typedef enum eNlaStrip_Flag {
NLASTRIP_FLAG_SELECT = (1<<1),
// NLASTRIP_FLAG_SELECT_L = (1<<2), // left handle selected
// NLASTRIP_FLAG_SELECT_R = (1<<3), // right handle selected
- /* NLA strip uses the same action that the action being tweaked uses (not set for the twaking one though) */
+
+ /* NLA strip uses the same action that the action being tweaked uses
+ * (not set for the tweaking one though). */
NLASTRIP_FLAG_TWEAKUSER = (1<<4),
/* controls driven by local F-Curves */
@@ -659,9 +774,11 @@ typedef enum eNlaStrip_Flag {
NLASTRIP_FLAG_MIRROR = (1<<13),
/* temporary editing flags */
+ /* NLA strip should ignore frame range and hold settings, and evaluate at global time. */
+ NLASTRIP_FLAG_NO_TIME_MAP = (1<<29),
/* NLA-Strip is really just a temporary meta used to facilitate easier transform code */
NLASTRIP_FLAG_TEMP_META = (1<<30),
- NLASTRIP_FLAG_EDIT_TOUCHED = (1u << 31)
+ NLASTRIP_FLAG_EDIT_TOUCHED = (1u << 31),
} eNlaStrip_Flag;
/* NLA Strip Type */
@@ -689,29 +806,36 @@ typedef enum eNlaStrip_Type {
typedef struct NlaTrack {
struct NlaTrack *next, *prev;
- ListBase strips; /* bActionStrips in this track */
+ /** BActionStrips in this track. */
+ ListBase strips;
- int flag; /* settings for this track */
- int index; /* index of the track in the stack (NOTE: not really useful, but we need a pad var anyways!) */
+ /** Settings for this track. */
+ int flag;
+ /** Index of the track in the stack
+ * \note not really useful, but we need a '_pad' var anyways! */
+ int index;
- char name[64]; /* short user-description of this track - MAX_ID_NAME-2 */
+ /** Short user-description of this track - MAX_ID_NAME-2. */
+ char name[64];
} NlaTrack;
/* settings for track */
typedef enum eNlaTrack_Flag {
- /* track is the one that settings can be modified on, also indicates if track is being 'tweaked' */
+ /** track is the one that settings can be modified on,
+ * also indicates if track is being 'tweaked' */
NLATRACK_ACTIVE = (1<<0),
- /* track is selected in UI for relevant editing operations */
+ /** track is selected in UI for relevant editing operations */
NLATRACK_SELECTED = (1<<1),
- /* track is not evaluated */
+ /** track is not evaluated */
NLATRACK_MUTED = (1<<2),
- /* track is the only one evaluated (must be used in conjunction with adt->flag) */
+ /** track is the only one evaluated (must be used in conjunction with adt->flag) */
NLATRACK_SOLO = (1<<3),
- /* track's settings (and strips) cannot be edited (to guard against unwanted changes) */
+ /** track's settings (and strips) cannot be edited (to guard against unwanted changes) */
NLATRACK_PROTECTED = (1<<4),
- /* track is not allowed to execute, usually as result of tweaking being enabled (internal flag) */
- NLATRACK_DISABLED = (1<<10)
+ /** track is not allowed to execute,
+ * usually as result of tweaking being enabled (internal flag) */
+ NLATRACK_DISABLED = (1<<10),
} eNlaTrack_Flag;
@@ -729,25 +853,34 @@ typedef enum eNlaTrack_Flag {
typedef struct KS_Path {
struct KS_Path *next, *prev;
- ID *id; /* ID block that keyframes are for */
- char group[64]; /* name of the group to add to - MAX_ID_NAME-2 */
+ /** ID block that keyframes are for. */
+ ID *id;
+ /** Name of the group to add to - MAX_ID_NAME-2. */
+ char group[64];
- int idtype; /* ID-type that path can be used on */
+ /** ID-type that path can be used on. */
+ int idtype;
- short groupmode; /* group naming (eKSP_Grouping) */
- short flag; /* various settings, etc. */
+ /** Group naming (eKSP_Grouping). */
+ short groupmode;
+ /** Various settings, etc. */
+ short flag;
- char *rna_path; /* dynamically (or statically in the case of predefined sets) path */
- int array_index; /* index that path affects */
+ /** Dynamically (or statically in the case of predefined sets) path. */
+ char *rna_path;
+ /** Index that path affects. */
+ int array_index;
- short keyingflag; /* (eInsertKeyFlags) settings to supply insertkey() with */
- short keyingoverride; /* (eInsertKeyFlags) for each flag set, the relevant keyingflag bit overrides the default */
+ /** (eInsertKeyFlags) settings to supply insertkey() with. */
+ short keyingflag;
+ /** (eInsertKeyFlags) for each flag set, the relevant keyingflag bit overrides the default. */
+ short keyingoverride;
} KS_Path;
/* KS_Path->flag */
typedef enum eKSP_Settings {
/* entire array (not just the specified index) gets keyframed */
- KSP_FLAG_WHOLE_ARRAY = (1<<0)
+ KSP_FLAG_WHOLE_ARRAY = (1<<0),
} eKSP_Settings;
/* KS_Path->groupmode */
@@ -779,21 +912,30 @@ typedef enum eKSP_Grouping {
typedef struct KeyingSet {
struct KeyingSet *next, *prev;
- ListBase paths; /* (KS_Path) paths to keyframe to */
+ /** (KS_Path) paths to keyframe to. */
+ ListBase paths;
- char idname[64]; /* unique name (for search, etc.) - MAX_ID_NAME-2 */
- char name[64]; /* user-viewable name for KeyingSet (for menus, etc.) - MAX_ID_NAME-2 */
- char description[240]; /* (RNA_DYN_DESCR_MAX) short help text. */
- char typeinfo[64]; /* name of the typeinfo data used for the relative paths - MAX_ID_NAME-2 */
+ /** Unique name (for search, etc.) - MAX_ID_NAME-2 . */
+ char idname[64];
+ /** User-viewable name for KeyingSet (for menus, etc.) - MAX_ID_NAME-2. */
+ char name[64];
+ /** (RNA_DYN_DESCR_MAX) short help text. */
+ char description[240];
+ /** Name of the typeinfo data used for the relative paths - MAX_ID_NAME-2. */
+ char typeinfo[64];
- int active_path; /* index of the active path */
+ /** Index of the active path. */
+ int active_path;
- short flag; /* settings for KeyingSet */
+ /** Settings for KeyingSet. */
+ short flag;
- short keyingflag; /* (eInsertKeyFlags) settings to supply insertkey() with */
- short keyingoverride; /* (eInsertKeyFlags) for each flag set, the relevant keyingflag bit overrides the default */
+ /** (eInsertKeyFlags) settings to supply insertkey() with. */
+ short keyingflag;
+ /** (eInsertKeyFlags) for each flag set, the relevant keyingflag bit overrides the default. */
+ short keyingoverride;
- char pad[6];
+ char _pad[6];
} KeyingSet;
/* KeyingSet settings */
@@ -801,24 +943,34 @@ typedef enum eKS_Settings {
/* keyingset cannot be removed (and doesn't need to be freed) */
KEYINGSET_BUILTIN = (1<<0),
/* keyingset does not depend on context info (i.e. paths are absolute) */
- KEYINGSET_ABSOLUTE = (1<<1)
+ KEYINGSET_ABSOLUTE = (1<<1),
} eKS_Settings;
/* Flags for use by keyframe creation/deletion calls */
typedef enum eInsertKeyFlags {
INSERTKEY_NOFLAGS = 0,
- INSERTKEY_NEEDED = (1<<0), /* only insert keyframes where they're needed */
- INSERTKEY_MATRIX = (1<<1), /* insert 'visual' keyframes where possible/needed */
- INSERTKEY_FAST = (1<<2), /* don't recalculate handles,etc. after adding key */
- INSERTKEY_FASTR = (1<<3), /* don't realloc mem (or increase count, as array has already been set out) */
- INSERTKEY_REPLACE = (1<<4), /* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */
- INSERTKEY_XYZ2RGB = (1<<5), /* transform F-Curves should have XYZ->RGB color mode */
- INSERTKEY_NO_USERPREF = (1<<6), /* ignore user-prefs (needed for predictable API use) */
- /* Allow to make a full copy of new key into existing one, if any, instead of 'reusing' existing handles.
+ /** only insert keyframes where they're needed */
+ INSERTKEY_NEEDED = (1<<0),
+ /** insert 'visual' keyframes where possible/needed */
+ INSERTKEY_MATRIX = (1<<1),
+ /** don't recalculate handles,etc. after adding key */
+ INSERTKEY_FAST = (1<<2),
+ /** don't realloc mem (or increase count, as array has already been set out) */
+ INSERTKEY_FASTR = (1<<3),
+ /** only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */
+ INSERTKEY_REPLACE = (1<<4),
+ /** transform F-Curves should have XYZ->RGB color mode */
+ INSERTKEY_XYZ2RGB = (1<<5),
+ /** ignore user-prefs (needed for predictable API use) */
+ INSERTKEY_NO_USERPREF = (1<<6),
+ /** Allow to make a full copy of new key into existing one, if any,
+ * instead of 'reusing' existing handles.
* Used by copy/paste code. */
INSERTKEY_OVERWRITE_FULL = (1<<7),
- INSERTKEY_DRIVER = (1<<8), /* for driver FCurves, use driver's "input" value - for easier corrective driver setup */
- INSERTKEY_CYCLE_AWARE = (1<<9), /* for cyclic FCurves, adjust key timing to preserve the cycle period and flow */
+ /** for driver FCurves, use driver's "input" value - for easier corrective driver setup */
+ INSERTKEY_DRIVER = (1<<8),
+ /** for cyclic FCurves, adjust key timing to preserve the cycle period and flow */
+ INSERTKEY_CYCLE_AWARE = (1<<9),
} eInsertKeyFlags;
/* ************************************************ */
@@ -832,16 +984,19 @@ typedef enum eInsertKeyFlags {
* yet keyframed (thus, would get overwritten by the animation system before the user had a chance
* to see the changes that were made).
*
- * It is probably not needed for overriding keyframed values in most cases, as those will only get evaluated
- * on frame-change now. That situation may change in future.
+ * It is probably not needed for overriding keyframed values in most cases, as those will only get
+ * evaluated on frame-change now. That situation may change in future.
*/
typedef struct AnimOverride {
struct AnimOverride *next, *prev;
- char *rna_path; /* RNA-path to use to resolve data-access */
- int array_index; /* if applicable, the index of the RNA-array item to get */
+ /** RNA-path to use to resolve data-access. */
+ char *rna_path;
+ /** If applicable, the index of the RNA-array item to get. */
+ int array_index;
- float value; /* value to override setting with */
+ /** Value to override setting with. */
+ float value;
} AnimOverride;
/* AnimData ------------------------------------- */
@@ -856,39 +1011,54 @@ typedef struct AnimOverride {
* blocks may override local settings.
*
* This datablock should be placed immediately after the ID block where it is used, so that
- * the code which retrieves this data can do so in an easier manner. See blenkernel/intern/anim_sys.c for details.
+ * the code which retrieves this data can do so in an easier manner.
+ * See blenkernel/intern/anim_sys.c for details.
*/
typedef struct AnimData {
- /* active action - acts as the 'tweaking track' for the NLA */
+ /** active action - acts as the 'tweaking track' for the NLA */
bAction *action;
- /* temp-storage for the 'real' active action (i.e. the one used before the tweaking-action
- * took over to be edited in the Animation Editors)
- */
+ /** temp-storage for the 'real' active action (i.e. the one used before the tweaking-action
+ * took over to be edited in the Animation Editors)
+ */
bAction *tmpact;
/* nla-tracks */
ListBase nla_tracks;
- /* active NLA-track (only set/used during tweaking, so no need to worry about dangling pointers) */
+ /**
+ * Active NLA-track
+ * (only set/used during tweaking, so no need to worry about dangling pointers).
+ */
NlaTrack *act_track;
- /* active NLA-strip (only set/used during tweaking, so no need to worry about dangling pointers) */
+ /**
+ * Active NLA-strip
+ * (only set/used during tweaking, so no need to worry about dangling pointers).
+ */
NlaStrip *actstrip;
/* 'drivers' for this ID-block's settings - FCurves, but are completely
* separate from those for animation data
*/
- ListBase drivers; /* standard user-created Drivers/Expressions (used as part of a rig) */
- ListBase overrides; /* temp storage (AnimOverride) of values for settings that are animated (but the value hasn't been keyframed) */
+ /** Standard user-created Drivers/Expressions (used as part of a rig). */
+ ListBase drivers;
+ /** Temp storage (AnimOverride) of values for settings that are animated
+ * (but the value hasn't been keyframed). */
+ ListBase overrides;
- FCurve **driver_array; /* runtime data, for depsgraph evaluation */
+ /** Runtime data, for depsgraph evaluation. */
+ FCurve **driver_array;
/* settings for animation evaluation */
- int flag; /* user-defined settings */
- int recalc; /* depsgraph recalculation flags */
+ /** User-defined settings. */
+ int flag;
+ char _pad[4];
/* settings for active action evaluation (based on NLA strip settings) */
- short act_blendmode; /* accumulation mode for active action */
- short act_extendmode; /* extrapolation mode for active action */
- float act_influence; /* influence for active action */
+ /** Accumulation mode for active action. */
+ short act_blendmode;
+ /** Extrapolation mode for active action. */
+ short act_extendmode;
+ /** Influence for active action. */
+ float act_influence;
} AnimData;
/* Animation Data settings (mostly for NLA) */
@@ -921,13 +1091,6 @@ typedef enum eAnimData_Flag {
ADT_CURVES_ALWAYS_VISIBLE = (1<<17),
} eAnimData_Flag;
-/* Animation Data recalculation settings (to be set by depsgraph) */
-typedef enum eAnimData_Recalc {
- ADT_RECALC_DRIVERS = (1 << 0),
- ADT_RECALC_ANIM = (1 << 1),
- ADT_RECALC_ALL = (ADT_RECALC_DRIVERS | ADT_RECALC_ANIM)
-} eAnimData_Recalc;
-
/* Base Struct for Anim ------------------------------------- */
/* Used for BKE_animdata_from_id()
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index 3e68ddcb96b..9aec322520d 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_armature_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_ARMATURE_TYPES_H__
@@ -42,45 +36,65 @@ struct AnimData;
* 2) Armature Space; the rest position, in Object space, Bones Spaces are applied hierarchical
* 3) Pose Space; the animation position, in Object space
* 4) World Space; Object matrix applied to Pose or Armature space
- *
*/
typedef struct Bone {
- struct Bone *next, *prev; /* Next/prev elements within this list */
- IDProperty *prop; /* User-Defined Properties on this Bone */
- struct Bone *parent; /* Parent (ik parent if appropriate flag is set */
- ListBase childbase; /* Children */
- char name[64]; /* Name of the bone - must be unique within the armature, MAXBONENAME */
+ /** Next/prev elements within this list. */
+ struct Bone *next, *prev;
+ /** User-Defined Properties on this Bone. */
+ IDProperty *prop;
+ /** Parent (ik parent if appropriate flag is set. */
+ struct Bone *parent;
+ /** Children . */
+ ListBase childbase;
+ /** Name of the bone - must be unique within the armature, MAXBONENAME. */
+ char name[64];
- float roll; /* roll is input for editmode, length calculated */
+ /** roll is input for editmode, length calculated. */
+ float roll;
float head[3];
- float tail[3]; /* head/tail and roll in Bone Space */
- float bone_mat[3][3]; /* rotation derived from head/tail/roll */
+ /** head/tail and roll in Bone Space . */
+ float tail[3];
+ /** rotation derived from head/tail/roll. */
+ float bone_mat[3][3];
int flag;
float arm_head[3];
- float arm_tail[3]; /* head/tail in Armature Space (rest pos) */
- float arm_mat[4][4]; /* matrix: (bonemat(b)+head(b))*arm_mat(b-1), rest pos*/
- float arm_roll; /* roll in Armature Space (rest pos) */
+ /** head/tail in Armature Space (rest pos). */
+ float arm_tail[3];
+ /** matrix: (bonemat(b)+head(b))*arm_mat(b-1), rest po.s*/
+ float arm_mat[4][4];
+ /** Roll in Armature Space (rest pos). */
+ float arm_roll;
- float dist, weight; /* dist, weight: for non-deformgroup deforms */
- float xwidth, length, zwidth; /* width: for block bones. keep in this order, transform! */
- float rad_head, rad_tail; /* radius for head/tail sphere, defining deform as well, parent->rad_tip overrides rad_head */
+ /** dist, weight: for non-deformgroup deforms. */
+ float dist, weight;
+ /** width: for block bones. keep in this order, transform!. */
+ float xwidth, length, zwidth;
+ /** Radius for head/tail sphere, defining deform as well, parent->rad_tip overrides rad_head. */
+ float rad_head, rad_tail;
- float roll1, roll2; /* curved bones settings - these define the "restpose" for a curved bone */
+ /** Curved bones settings - these define the "restpose" for a curved bone. */
+ float roll1, roll2;
float curveInX, curveInY;
float curveOutX, curveOutY;
- float ease1, ease2; /* length of bezier handles */
+ /** Length of bezier handles. */
+ float ease1, ease2;
float scaleIn, scaleOut;
- float size[3]; /* patch for upward compat, UNUSED! */
- int layer; /* layers that bone appears on */
- short segments; /* for B-bones */
+ /** patch for upward compat, UNUSED!. */
+ float size[3];
+ /** Layers that bone appears on. */
+ int layer;
+ /** for B-bones. */
+ short segments;
- char bbone_prev_type; /* Type of next/prev bone handles */
+ /** Type of next/prev bone handles. */
+ char bbone_prev_type;
char bbone_next_type;
- struct Bone *bbone_prev; /* Next/prev bones to use as handle references when calculating bbones (optional) */
+ /** Next/prev bones to use as handle references when calculating bbones (optional). */
+ struct Bone *bbone_prev;
struct Bone *bbone_next;
} Bone;
@@ -90,7 +104,8 @@ typedef struct bArmature {
ListBase bonebase;
ListBase chainbase;
- ListBase *edbo; /* editbone listbase, we use pointer so we can check state */
+ /** Editbone listbase, we use pointer so we can check state. */
+ ListBase *edbo;
/* active bones should work like active object where possible
* - active and selection are unrelated
@@ -98,46 +113,49 @@ typedef struct bArmature {
* - from the user perspective active == last selected
* - active should be ignored when not visible (hidden layer) */
- Bone *act_bone; /* active bone */
- struct EditBone *act_edbone; /* active editbone (in editmode) */
+ /** Active bone. */
+ Bone *act_bone;
+ /** Active editbone (in editmode). */
+ struct EditBone *act_edbone;
int flag;
int drawtype;
- int gevertdeformer; /* how vertex deformation is handled in the ge */
- int pad;
+ /** How vertex deformation is handled in the ge. */
+ int gevertdeformer;
+ char _pad[4];
short deformflag;
short pathflag;
- unsigned int layer_used; /* for UI, to show which layers are there */
- unsigned int layer, layer_protected; /* for buttons to work, both variables in this order together */
-
-// XXX deprecated... old animation system (armature only viz) ---
- short ghostep, ghostsize; /* number of frames to ghosts to show, and step between them */
- short ghosttype, pathsize; /* ghost drawing options and number of frames between points of path */
- int ghostsf, ghostef; /* start and end frames of ghost-drawing range */
- int pathsf, pathef; /* start and end frames of path-calculation range for all bones */
- int pathbc, pathac; /* number of frames before/after current frame of path-calculation for all bones */
-// XXX end of deprecated code ----------------------------------
+ /** For UI, to show which layers are there. */
+ unsigned int layer_used;
+ /** For buttons to work, both variables in this order together. */
+ unsigned int layer, layer_protected;
} bArmature;
/* armature->flag */
/* 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 */
+ /** XRAY is here only for backwards converting */
+ ARM_FLAG_DEPRECATED_1 = (1 << 1), /* cleared */
ARM_DRAWAXES = (1<<2),
ARM_DRAWNAMES = (1<<3),
ARM_POSEMODE = (1<<4),
- ARM_EDITMODE = (1<<5),
+ ARM_FLAG_DEPRECATED_5 = (1<<5), /* cleared */
ARM_DELAYDEFORM = (1<<6),
- ARM_DONT_USE = (1<<7),
+ ARM_FLAG_DEPRECATED_7 = (1 << 7), /* cleared */
ARM_MIRROR_EDIT = (1<<8),
ARM_AUTO_IK = (1<<9),
- ARM_NO_CUSTOM = (1<<10), /* made option negative, for backwards compat */
- ARM_COL_CUSTOM = (1<<11), /* draw custom colors */
- ARM_GHOST_ONLYSEL = (1<<12), /* when ghosting, only show selected bones (this should belong to ghostflag instead) */ /* XXX deprecated */
- ARM_DS_EXPAND = (1<<13), /* dopesheet channel is expanded */
- ARM_HAS_VIZ_DEPS = (1<<14), /* other objects are used for visualizing various states (hack for efficient updates) */
+ /** made option negative, for backwards compat */
+ ARM_NO_CUSTOM = (1<<10),
+ /** draw custom colors */
+ ARM_COL_CUSTOM = (1<<11),
+ /** when ghosting, only show selected bones (this should belong to ghostflag instead) */
+ ARM_FLAG_DEPRECATED_12 = (1 << 12), /* cleared */
+ /** dopesheet channel is expanded */
+ ARM_DS_EXPAND = (1<<13),
+ /** other objects are used for visualizing various states (hack for efficient updates) */
+ ARM_HAS_VIZ_DEPS = (1<<14),
} eArmature_Flag;
/* armature->drawtype */
@@ -146,13 +164,13 @@ typedef enum eArmature_Drawtype {
ARM_LINE = 1,
ARM_B_BONE = 2,
ARM_ENVELOPE = 3,
- ARM_WIRE = 4
+ ARM_WIRE = 4,
} eArmature_Drawtype;
/* armature->gevertdeformer */
typedef enum eArmature_VertDeformer {
ARM_VDEF_BLENDER = 0,
- ARM_VDEF_BGE_CPU = 1
+ ARM_VDEF_BGE_CPU = 1,
} eArmature_VertDeformer;
/* armature->deformflag */
@@ -163,7 +181,7 @@ typedef enum eArmature_DeformFlag {
#ifdef DNA_DEPRECATED
ARM_DEF_B_BONE_REST = (1<<3), /* deprecated */
#endif
- ARM_DEF_INVERT_VGROUP = (1<<4)
+ ARM_DEF_INVERT_VGROUP = (1<<4),
} eArmature_DeformFlag;
/* armature->pathflag */
@@ -174,45 +192,58 @@ typedef enum eArmature_PathFlag {
ARM_PATH_KFRAS = (1<<1),
ARM_PATH_HEADS = (1<<2),
ARM_PATH_ACFRA = (1<<3),
- ARM_PATH_KFNOS = (1<<4)
+ ARM_PATH_KFNOS = (1<<4),
} eArmature_PathFlag;
#endif
-/* armature->ghosttype */
-// XXX deprecated... old animation system (armature only viz)
-typedef enum eArmature_GhostType {
- ARM_GHOST_CUR = 0,
- ARM_GHOST_RANGE = 1,
- ARM_GHOST_KEYS = 2
-} eArmature_GhostType;
-
/* bone->flag */
typedef enum eBone_Flag {
BONE_SELECTED = (1 << 0),
BONE_ROOTSEL = (1 << 1),
BONE_TIPSEL = (1 << 2),
- BONE_TRANSFORM = (1 << 3), /* Used instead of BONE_SELECTED during transform (clear before use) */
- BONE_CONNECTED = (1 << 4), /* when bone has a parent, connect head of bone to parent's tail*/
+ /** Used instead of BONE_SELECTED during transform (clear before use) */
+ BONE_TRANSFORM = (1 << 3),
+ /** when bone has a parent, connect head of bone to parent's tail*/
+ BONE_CONNECTED = (1 << 4),
/* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */
- BONE_HIDDEN_P = (1 << 6), /* hidden Bones when drawing PoseChannels */
- BONE_DONE = (1 << 7), /* For detecting cyclic dependencies */
- BONE_DRAW_ACTIVE = (1 << 8), /* active is on mouse clicks only - deprecated, ONLY USE FOR DRAWING */
- BONE_HINGE = (1 << 9), /* No parent rotation or scale */
- BONE_HIDDEN_A = (1 << 10), /* hidden Bones when drawing Armature Editmode */
- BONE_MULT_VG_ENV = (1 << 11), /* multiplies vgroup with envelope */
- BONE_NO_DEFORM = (1 << 12), /* bone doesn't deform geometry */
- BONE_UNKEYED = (1 << 13), /* set to prevent destruction of its unkeyframed pose (after transform) */
- BONE_HINGE_CHILD_TRANSFORM = (1 << 14), /* set to prevent hinge child bones from influencing the transform center */
- BONE_NO_SCALE = (1 << 15), /* No parent scale */
- BONE_HIDDEN_PG = (1 << 16), /* hidden bone when drawing PoseChannels (for ghost drawing) */
- BONE_DRAWWIRE = (1 << 17), /* bone should be drawn as OB_WIRE, regardless of draw-types of view+armature */
- BONE_NO_CYCLICOFFSET = (1 << 18), /* when no parent, bone will not get cyclic offset */
- BONE_EDITMODE_LOCKED = (1 << 19), /* bone transforms are locked in EditMode */
- BONE_TRANSFORM_CHILD = (1 << 20), /* Indicates that a parent is also being transformed */
- BONE_UNSELECTABLE = (1 << 21), /* bone cannot be selected */
- BONE_NO_LOCAL_LOCATION = (1 << 22), /* bone location is in armature space */
- BONE_RELATIVE_PARENTING = (1 << 23), /* object child will use relative transform (like deform) */
- BONE_ADD_PARENT_END_ROLL = (1 << 24) /* it will add the parent end roll to the inroll */
+ /** hidden Bones when drawing PoseChannels */
+ BONE_HIDDEN_P = (1 << 6),
+ /** For detecting cyclic dependencies */
+ BONE_DONE = (1 << 7),
+ /** active is on mouse clicks only - deprecated, ONLY USE FOR DRAWING */
+ BONE_DRAW_ACTIVE = (1 << 8),
+ /** No parent rotation or scale */
+ BONE_HINGE = (1 << 9),
+ /** hidden Bones when drawing Armature Editmode */
+ BONE_HIDDEN_A = (1 << 10),
+ /** multiplies vgroup with envelope */
+ BONE_MULT_VG_ENV = (1 << 11),
+ /** bone doesn't deform geometry */
+ BONE_NO_DEFORM = (1 << 12),
+ /** set to prevent destruction of its unkeyframed pose (after transform) */
+ BONE_UNKEYED = (1 << 13),
+ /** set to prevent hinge child bones from influencing the transform center */
+ BONE_HINGE_CHILD_TRANSFORM = (1 << 14),
+ /** No parent scale */
+ BONE_NO_SCALE = (1 << 15),
+ /** hidden bone when drawing PoseChannels (for ghost drawing) */
+ BONE_HIDDEN_PG = (1 << 16),
+ /** bone should be drawn as OB_WIRE, regardless of draw-types of view+armature */
+ BONE_DRAWWIRE = (1 << 17),
+ /** when no parent, bone will not get cyclic offset */
+ BONE_NO_CYCLICOFFSET = (1 << 18),
+ /** bone transforms are locked in EditMode */
+ BONE_EDITMODE_LOCKED = (1 << 19),
+ /** Indicates that a parent is also being transformed */
+ BONE_TRANSFORM_CHILD = (1 << 20),
+ /** bone cannot be selected */
+ BONE_UNSELECTABLE = (1 << 21),
+ /** bone location is in armature space */
+ BONE_NO_LOCAL_LOCATION = (1 << 22),
+ /** object child will use relative transform (like deform) */
+ BONE_RELATIVE_PARENTING = (1 << 23),
+ /** it will add the parent end roll to the inroll */
+ BONE_ADD_PARENT_END_ROLL = (1 << 24),
} eBone_Flag;
diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h
index 43a137f4668..6a0a19fa44c 100644
--- a/source/blender/makesdna/DNA_boid_types.h
+++ b/source/blender/makesdna/DNA_boid_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_boid_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_BOID_TYPES_H__
@@ -36,18 +28,32 @@
typedef enum eBoidRuleType {
eBoidRuleType_None = 0,
- eBoidRuleType_Goal = 1, /* go to goal assigned object or loudest assigned signal source */
- eBoidRuleType_Avoid = 2, /* get away from assigned object or loudest assigned signal source */
- eBoidRuleType_AvoidCollision = 3, /* manoeuver to avoid collisions with other boids and deflector object in near future */
- eBoidRuleType_Separate = 4, /* keep from going through other boids */
- eBoidRuleType_Flock = 5, /* move to center of neighbors and match their velocity */
- eBoidRuleType_FollowLeader = 6, /* follow a boid or assigned object */
- eBoidRuleType_AverageSpeed = 7, /* maintain speed, flight level or wander*/
- eBoidRuleType_Fight = 8, /* go to closest enemy and attack when in range */
- //eBoidRuleType_Protect = 9, /* go to enemy closest to target and attack when in range */
- //eBoidRuleType_Hide = 10, /* find a deflector move to it's other side from closest enemy */
- //eBoidRuleType_FollowPath = 11, /* move along a assigned curve or closest curve in a group */
- //eBoidRuleType_FollowWall = 12, /* move next to a deflector object's in direction of it's tangent */
+ /** go to goal assigned object or loudest assigned signal source */
+ eBoidRuleType_Goal = 1,
+ /** get away from assigned object or loudest assigned signal source */
+ eBoidRuleType_Avoid = 2,
+ /** manoeuver to avoid collisions with other boids and deflector object in near future */
+ eBoidRuleType_AvoidCollision = 3,
+ /** keep from going through other boids */
+ eBoidRuleType_Separate = 4,
+ /** move to center of neighbors and match their velocity */
+ eBoidRuleType_Flock = 5,
+ /** follow a boid or assigned object */
+ eBoidRuleType_FollowLeader = 6,
+ /** maintain speed, flight level or wander*/
+ eBoidRuleType_AverageSpeed = 7,
+ /** go to closest enemy and attack when in range */
+ eBoidRuleType_Fight = 8,
+#if 0
+ /** go to enemy closest to target and attack when in range */
+ eBoidRuleType_Protect = 9,
+ /** find a deflector move to it's other side from closest enemy */
+ eBoidRuleType_Hide = 10,
+ /** move along a assigned curve or closest curve in a group */
+ eBoidRuleType_FollowPath = 11,
+ /** move next to a deflector object's in direction of it's tangent */
+ eBoidRuleType_FollowWall = 12,
+#endif
NUM_BOID_RULE_TYPES
} eBoidRuleType;
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 398c79e0111..b367c141581 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_brush_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_BRUSH_TYPES_H__
@@ -42,57 +34,88 @@
//#endif
struct CurveMapping;
-struct MTex;
struct Image;
+struct MTex;
struct Material;
typedef struct BrushClone {
- struct Image *image; /* image for clone tool */
- float offset[2]; /* offset of clone image from canvas */
- float alpha, pad; /* transparency for drawing of clone image */
+ /** Image for clone tool. */
+ struct Image *image;
+ /** Offset of clone image from canvas. */
+ float offset[2];
+ /** Transparency for drawing of clone image. */
+ float alpha;
+ char _pad[4];
} BrushClone;
typedef struct BrushGpencilSettings {
- float draw_smoothfac; /* amount of smoothing to apply to newly created strokes */
- float draw_sensitivity; /* amount of sensitivity to apply to newly created strokes */
- float draw_strength; /* amount of alpha strength to apply to newly created strokes */
- float draw_jitter; /* amount of jitter to apply to newly created strokes */
- float draw_angle; /* angle when the brush has full thickness */
- float draw_angle_factor; /* factor to apply when angle change (only 90 degrees) */
- float draw_random_press; /* factor of randomness for pressure */
- float draw_random_strength; /* factor of strength for strength */
- float draw_random_sub; /* factor of randomness for subdivision */
- short draw_smoothlvl; /* number of times to apply smooth factor to new strokes */
- short draw_subdivide; /* number of times to subdivide new strokes */
- short flag; /* internal grease pencil drawing flags */
-
- short thick_smoothlvl; /* number of times to apply thickness smooth factor to new strokes */
- float thick_smoothfac; /* amount of thickness smoothing to apply to newly created strokes */
-
- float fill_threshold; /* factor for transparency */
- short fill_leak; /* number of pixel to consider the leak is too small (x 2) */
- char pad_1[6];
-
- int fill_simplylvl; /* number of simplify steps */
- int fill_draw_mode; /* type of control lines drawing mode */
- int icon_id; /* icon identifier */
-
- int input_samples; /* maximum distance before generate new point for very fast mouse movements */
- float uv_random; /* random factor for UV rotation */
- int brush_type DNA_DEPRECATED; /* moved to 'Brush.gpencil_tool' */
- int eraser_mode; /* soft, hard or stroke */
- float active_smooth; /* smooth while drawing factor */
- float era_strength_f; /* factor to apply to strength for soft eraser */
- float era_thickness_f; /* factor to apply to thickness for soft eraser */
- char pad_2[4];
+ /** Amount of smoothing to apply to newly created strokes. */
+ float draw_smoothfac;
+ /** Amount of sensitivity to apply to newly created strokes. */
+ float draw_sensitivity;
+ /** Amount of alpha strength to apply to newly created strokes. */
+ float draw_strength;
+ /** Amount of jitter to apply to newly created strokes. */
+ float draw_jitter;
+ /** Angle when the brush has full thickness. */
+ float draw_angle;
+ /** Factor to apply when angle change (only 90 degrees). */
+ float draw_angle_factor;
+ /** Factor of randomness for pressure. */
+ float draw_random_press;
+ /** Factor of strength for strength. */
+ float draw_random_strength;
+ /** Factor of randomness for subdivision. */
+ float draw_random_sub;
+ /** Number of times to apply smooth factor to new strokes. */
+ short draw_smoothlvl;
+ /** Number of times to subdivide new strokes. */
+ short draw_subdivide;
+ short _pad;
+
+ /** Number of times to apply thickness smooth factor to new strokes. */
+ short thick_smoothlvl;
+ /** Amount of thickness smoothing to apply to newly created strokes. */
+ float thick_smoothfac;
+
+ /** Factor for transparency. */
+ float fill_threshold;
+ /** Number of pixel to consider the leak is too small (x 2). */
+ short fill_leak;
+ char _pad1[6];
+
+ /** Number of simplify steps. */
+ int fill_simplylvl;
+ /** Type of control lines drawing mode. */
+ int fill_draw_mode;
+ /** Icon identifier. */
+ int icon_id;
+
+ /** Maximum distance before generate new point for very fast mouse movements. */
+ int input_samples;
+ /** Random factor for UV rotation. */
+ float uv_random;
+ /** Moved to 'Brush.gpencil_tool'. */
+ int brush_type DNA_DEPRECATED;
+ /** Soft, hard or stroke. */
+ int eraser_mode;
+ /** Smooth while drawing factor. */
+ float active_smooth;
+ /** Factor to apply to strength for soft eraser. */
+ float era_strength_f;
+ /** Factor to apply to thickness for soft eraser. */
+ float era_thickness_f;
+ /** Internal grease pencil drawing flags. */
+ int flag;
struct CurveMapping *curve_sensitivity;
struct CurveMapping *curve_strength;
struct CurveMapping *curve_jitter;
/* optional link of material to replace default in context */
- struct Material *material; /* material */
+ /** Material. */
+ struct Material *material;
} BrushGpencilSettings;
/* BrushGpencilSettings->gp_flag */
@@ -125,6 +148,8 @@ typedef enum eGPDbrush_Flag {
GP_BRUSH_DISSABLE_LASSO = (1 << 14),
/* Do not erase strokes oLcluded */
GP_BRUSH_OCCLUDE_ERASER = (1 << 15),
+ /* Post process trim stroke */
+ GP_BRUSH_TRIM_STROKE = (1 << 16),
} eGPDbrush_Flag;
/* BrushGpencilSettings->gp_fill_draw_mode */
@@ -152,14 +177,15 @@ typedef enum eGP_BrushIcons {
GP_BRUSH_ICON_FILL = 7,
GP_BRUSH_ICON_ERASE_SOFT = 8,
GP_BRUSH_ICON_ERASE_HARD = 9,
- GP_BRUSH_ICON_ERASE_STROKE = 10
+ GP_BRUSH_ICON_ERASE_STROKE = 10,
} eGP_BrushIcons;
typedef struct Brush {
ID id;
struct BrushClone clone;
- struct CurveMapping *curve; /* falloff curve */
+ /** Falloff curve. */
+ struct CurveMapping *curve;
struct MTex mtex;
struct MTex mask_mtex;
@@ -167,59 +193,91 @@ typedef struct Brush {
struct ImBuf *icon_imbuf;
PreviewImage *preview;
- struct ColorBand *gradient; /* color gradient */
+ /** Color gradient. */
+ struct ColorBand *gradient;
struct PaintCurve *paint_curve;
- char icon_filepath[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char icon_filepath[1024];
float normal_weight;
- float rake_factor; /* rake actual data (not texture), used for sculpt */
-
- short blend; /* blend mode */
- short ob_mode; /* eObjectMode: to see if the brush is compatible, use for display only. */
- float weight; /* brush weight */
- int size; /* brush diameter */
- int flag; /* general purpose flag */
- int mask_pressure; /* pressure influence for mask */
- float jitter; /* jitter the position of the brush */
- int jitter_absolute; /* absolute jitter in pixels */
+ /** Rake actual data (not texture), used for sculpt. */
+ float rake_factor;
+
+ /** Blend mode. */
+ short blend;
+ /** #eObjectMode: to see if the brush is compatible, use for display only. */
+ short ob_mode;
+ /** Brush weight. */
+ float weight;
+ /** Brush diameter. */
+ int size;
+ /** General purpose flag. */
+ int flag;
+ /** Pressure influence for mask. */
+ int mask_pressure;
+ /** Jitter the position of the brush. */
+ float jitter;
+ /** Absolute jitter in pixels. */
+ int jitter_absolute;
int overlay_flags;
- int spacing; /* spacing of paint operations */
- int smooth_stroke_radius; /* turning radius (in pixels) for smooth stroke */
- float smooth_stroke_factor; /* higher values limit fast changes in the stroke direction */
- float rate; /* paint operations / second (airbrush) */
-
- float rgb[3]; /* color */
- float alpha; /* opacity */
+ /** Spacing of paint operations. */
+ int spacing;
+ /** Turning radius (in pixels) for smooth stroke. */
+ int smooth_stroke_radius;
+ /** Higher values limit fast changes in the stroke direction. */
+ float smooth_stroke_factor;
+ /** Paint operations / second (airbrush). */
+ float rate;
+
+ /** Color. */
+ float rgb[3];
+ /** Opacity. */
+ float alpha;
- float secondary_rgb[3]; /* background color */
+ /** Background color. */
+ float secondary_rgb[3];
- int sculpt_plane; /* the direction of movement for sculpt vertices */
+ /** The direction of movement for sculpt vertices. */
+ int sculpt_plane;
- float plane_offset; /* offset for plane brushes (clay, flatten, fill, scrape) */
+ /** Offset for plane brushes (clay, flatten, fill, scrape). */
+ float plane_offset;
int gradient_spacing;
- char gradient_stroke_mode; /* source for stroke color gradient application */
- char gradient_fill_mode; /* source for fill tool color gradient application */
-
- char pad;
- char falloff_shape; /* Projection shape (sphere, circle) */
+ /** Source for stroke color gradient application. */
+ char gradient_stroke_mode;
+ /** Source for fill tool color gradient application. */
+ char gradient_fill_mode;
+
+ char _pad;
+ /** Projection shape (sphere, circle). */
+ char falloff_shape;
float falloff_angle;
- char sculpt_tool; /* active sculpt tool */
- char vertexpaint_tool; /* active vertex paint */
- char weightpaint_tool; /* active weight paint */
- char imagepaint_tool; /* active image paint tool */
- char mask_tool; /* enum eBrushMaskTool, only used if sculpt_tool is SCULPT_TOOL_MASK */
- char gpencil_tool; /* Active grease pencil tool. */
- char _pad0[6];
+ /** Active sculpt tool. */
+ char sculpt_tool;
+ /** Active vertex paint. */
+ char vertexpaint_tool;
+ /** Active weight paint. */
+ char weightpaint_tool;
+ /** Active image paint tool. */
+ char imagepaint_tool;
+ /** Enum eBrushMaskTool, only used if sculpt_tool is SCULPT_TOOL_MASK. */
+ char mask_tool;
+ /** Active grease pencil tool. */
+ char gpencil_tool;
+ char _pad0[2];
float autosmooth_factor;
+ float topology_rake_factor;
+
float crease_pinch_factor;
float plane_trim;
- float height; /* affectable height of brush (layer height for layer tool, i.e.) */
+ /** Affectable height of brush (layer height for layer tool, i.e.). */
+ float height;
float texture_sample_bias;
@@ -264,19 +322,23 @@ typedef struct Palette {
ListBase colors;
int active_color;
- int pad;
+ char _pad[4];
} Palette;
typedef struct PaintCurvePoint {
- BezTriple bez; /* bezier handle */
- float pressure; /* pressure on that point */
+ /** Bezier handle. */
+ BezTriple bez;
+ /** Pressure on that point. */
+ float pressure;
} PaintCurvePoint;
typedef struct PaintCurve {
ID id;
- PaintCurvePoint *points; /* points of curve */
+ /** Points of curve. */
+ PaintCurvePoint *points;
int tot_points;
- int add_index; /* index where next point will be added */
+ /** Index where next point will be added. */
+ int add_index;
} PaintCurve;
/* Brush.gradient_source */
@@ -294,13 +356,13 @@ typedef enum eBrushGradientSourceFill {
/* Brush.flag */
typedef enum eBrushFlags {
BRUSH_AIRBRUSH = (1 << 0),
- BRUSH_FLAG_DEPRECATED_1 = (1 << 1),
+ BRUSH_FLAG_DEPRECATED_1 = (1 << 1), /* cleared */
BRUSH_ALPHA_PRESSURE = (1 << 2),
BRUSH_SIZE_PRESSURE = (1 << 3),
BRUSH_JITTER_PRESSURE = (1 << 4),
BRUSH_SPACING_PRESSURE = (1 << 5),
- BRUSH_FLAG_DEPRECATED_2 = (1 << 6),
- BRUSH_FLAG_DEPRECATED_3 = (1 << 7),
+ BRUSH_FLAG_DEPRECATED_6 = (1 << 6), /* cleared */
+ BRUSH_FLAG_DEPRECATED_7 = (1 << 7), /* cleared */
BRUSH_ANCHORED = (1 << 8),
BRUSH_DIR_IN = (1 << 9),
BRUSH_SPACE = (1 << 10),
@@ -310,7 +372,7 @@ typedef enum eBrushFlags {
BRUSH_LOCK_ALPHA = (1 << 14),
BRUSH_ORIGINAL_NORMAL = (1 << 15),
BRUSH_OFFSET_PRESSURE = (1 << 16),
- BRUSH_FLAG_DEPRECATED_4 = (1 << 17),
+ BRUSH_FLAG_DEPRECATED_17 = (1 << 17), /* cleared */
BRUSH_SPACE_ATTEN = (1 << 18),
BRUSH_ADAPTIVE_SPACE = (1 << 19),
BRUSH_LOCK_SIZE = (1 << 20),
@@ -324,12 +386,12 @@ typedef enum eBrushFlags {
BRUSH_CUSTOM_ICON = (1 << 28),
BRUSH_LINE = (1 << 29),
BRUSH_ABSOLUTE_JITTER = (1 << 30),
- BRUSH_CURVE = (1u << 31)
+ BRUSH_CURVE = (1u << 31),
} eBrushFlags;
typedef enum {
BRUSH_MASK_PRESSURE_RAMP = (1 << 1),
- BRUSH_MASK_PRESSURE_CUTOFF = (1 << 2)
+ BRUSH_MASK_PRESSURE_CUTOFF = (1 << 2),
} BrushMaskPressureFlags;
/* Brush.overlay_flags */
@@ -339,7 +401,7 @@ typedef enum eOverlayFlags {
BRUSH_OVERLAY_SECONDARY = (1 << 2),
BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE = (1 << 3),
BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE = (1 << 4),
- BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE = (1 << 5)
+ BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE = (1 << 5),
} eOverlayFlags;
#define BRUSH_OVERLAY_OVERRIDE_MASK (BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE | \
@@ -366,7 +428,7 @@ typedef enum eBrushSculptTool {
SCULPT_TOOL_CREASE = 16,
SCULPT_TOOL_BLOB = 17,
SCULPT_TOOL_CLAY_STRIPS = 18,
- SCULPT_TOOL_MASK = 19
+ SCULPT_TOOL_MASK = 19,
} eBrushSculptTool;
/** When #BRUSH_ACCUMULATE is used */
@@ -398,11 +460,20 @@ typedef enum eBrushSculptTool {
SCULPT_TOOL_THUMB, \
SCULPT_TOOL_LAYER, \
\
- /* These brushes could handle dynamic topology, but user feedback indicates it's better not to */ \
+ /* These brushes could handle dynamic topology, \
+ * but user feedback indicates it's better not to */ \
SCULPT_TOOL_SMOOTH, \
SCULPT_TOOL_MASK \
) == 0)
+#define SCULPT_TOOL_HAS_TOPOLOGY_RAKE(t) (ELEM(t, \
+ /* These brushes, as currently coded, cannot support topology rake. */ \
+ SCULPT_TOOL_GRAB, \
+ SCULPT_TOOL_ROTATE, \
+ SCULPT_TOOL_THUMB, \
+ SCULPT_TOOL_MASK \
+ ) == 0)
+
/* ImagePaintSettings.tool */
typedef enum eBrushImagePaintTool {
PAINT_TOOL_DRAW = 0,
@@ -410,7 +481,7 @@ typedef enum eBrushImagePaintTool {
PAINT_TOOL_SMEAR = 2,
PAINT_TOOL_CLONE = 3,
PAINT_TOOL_FILL = 4,
- PAINT_TOOL_MASK = 5
+ PAINT_TOOL_MASK = 5,
} eBrushImagePaintTool;
typedef enum eBrushVertexPaintTool {
@@ -441,12 +512,12 @@ enum {
SCULPT_DISP_DIR_VIEW = 1,
SCULPT_DISP_DIR_X = 2,
SCULPT_DISP_DIR_Y = 3,
- SCULPT_DISP_DIR_Z = 4
+ SCULPT_DISP_DIR_Z = 4,
};
typedef enum {
BRUSH_MASK_DRAW = 0,
- BRUSH_MASK_SMOOTH = 1
+ BRUSH_MASK_SMOOTH = 1,
} BrushMaskTool;
/* blur kernel types, Brush.blur_mode */
diff --git a/source/blender/makesdna/DNA_cachefile_types.h b/source/blender/makesdna/DNA_cachefile_types.h
index c0e662d8a48..e226519bba0 100644
--- a/source/blender/makesdna/DNA_cachefile_types.h
+++ b/source/blender/makesdna/DNA_cachefile_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Kevin Dietrich.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_cachefile_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_CACHEFILE_TYPES_H__
@@ -62,11 +56,11 @@ typedef struct CacheFile {
struct AbcArchiveHandle *handle;
void *handle_mutex;
- /* Paths of the objects inside of the Alembic archive referenced by this
- * CacheFile. */
+ /** Paths of the objects inside of the Alembic archive referenced by this CacheFile. */
ListBase object_paths;
- char filepath[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char filepath[1024];
char is_sequence;
char forward_axis;
@@ -74,13 +68,16 @@ typedef struct CacheFile {
char override_frame;
float scale;
- float frame; /* The frame/time to lookup in the cache file. */
- float frame_offset; /* The frame offset to subtract. */
+ /** The frame/time to lookup in the cache file. */
+ float frame;
+ /** The frame offset to subtract. */
+ float frame_offset;
- short flag; /* Animation flag. */
+ /** Animation flag. */
+ short flag;
short draw_flag;
- char padding[4];
+ char _pad[4];
} CacheFile;
#ifdef __cplusplus
diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h
index 17cf945fdbf..0af69384c54 100644
--- a/source/blender/makesdna/DNA_camera_types.h
+++ b/source/blender/makesdna/DNA_camera_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_camera_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_CAMERA_TYPES_H__
@@ -42,9 +34,9 @@
extern "C" {
#endif
-struct Object;
struct AnimData;
struct Ipo;
+struct Object;
/* ------------------------------------------- */
/* Stereo Settings */
@@ -54,7 +46,7 @@ typedef struct CameraStereoSettings {
short convergence_mode;
short pivot;
short flag;
- short pad;
+ char _pad[2];
/* Cut-off angle at which interocular distance start to fade down. */
float pole_merge_angle_from;
/* Cut-off angle at which interocular distance stops to fade down. */
@@ -75,25 +67,34 @@ typedef struct CameraBGImage {
short source;
} CameraBGImage;
+typedef struct Camera_Runtime {
+ /* For draw manager. */
+ float drw_corners[2][4][2];
+ float drw_tria[2][2];
+ float drw_depth[2];
+ float drw_focusmat[4][4];
+ float drw_normalmat[4][4];
+} Camera_Runtime;
+
typedef struct Camera {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
- char type; /* CAM_PERSP, CAM_ORTHO or CAM_PANO */
- char dtx; /* draw type extra */
+ /** CAM_PERSP, CAM_ORTHO or CAM_PANO. */
+ char type;
+ /** Draw type extra. */
+ char dtx;
short flag;
float passepartalpha;
- float clipsta, clipend;
+ float clip_start, clip_end;
float lens, ortho_scale, drawsize;
float sensor_x, sensor_y;
float shiftx, shifty;
+ float dof_distance;
- /* yafray: dof params */
- /* qdn: yafray var 'YF_dofdist' now enabled for defocus composite node as well.
- * The name was not changed so that no other files need to be modified */
- float YF_dofdist;
-
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
struct Object *dof_ob;
struct GPUDOFSettings gpu_dof;
@@ -102,17 +103,13 @@ typedef struct Camera {
struct ListBase bg_images;
char sensor_fit;
- char pad[7];
-
- /* runtime only, used for drawing */
- float drwcorners[4][2];
- float drwtria[2][2];
- float drwdepth, pad1;
- float drwfocusmat[4][4];
- float drwnormalmat[4][4];
+ char _pad[7];
/* Stereo settings */
struct CameraStereoSettings stereo;
+
+ /** Runtime data (keep last). */
+ Camera_Runtime runtime;
} Camera;
/* **************** CAMERA ********************* */
@@ -200,8 +197,6 @@ enum {
CAM_BGIMG_FLAG_FLIP_Y = (1 << 8),
};
-#define CAM_BGIMG_FLAG_EXPANDED (CAM_BGIMG_FLAG_EXPANDED | CAM_BGIMG_FLAG_CAMERACLIP)
-
/* CameraBGImage->source */
/* may want to use 1 for select ?*/
enum {
diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h
index 39a110d6ad4..9ab873e1264 100644
--- a/source/blender/makesdna/DNA_cloth_types.h
+++ b/source/blender/makesdna/DNA_cloth_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Daniel (Genscher)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_cloth_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_CLOTH_TYPES_H__
@@ -47,91 +39,148 @@
*/
typedef struct ClothSimSettings {
- struct LinkNode *cache; /* UNUSED atm */
- float mingoal; /* see SB */
- float Cdis DNA_DEPRECATED; /* Mechanical damping of springs. */
- float Cvi; /* Viscous/fluid damping. */
- float gravity[3]; /* Gravity/external force vector. */
- float dt; /* This is the duration of our time step, computed. */
- float mass; /* The mass of the entire cloth. */
- float structural DNA_DEPRECATED; /* Structural spring stiffness. */
- float shear; /* Shear spring stiffness. */
- float bending; /* Flexion spring stiffness. */
- float max_bend; /* max bending scaling value, min is "bending" */
- float max_struct DNA_DEPRECATED; /* max structural scaling value, min is "structural" */
- float max_shear; /* max shear scaling value */
- float max_sewing; /* max sewing force */
- float avg_spring_len; /* used for normalized springs */
- float timescale; /* parameter how fast cloth runs */
- float time_scale; /* multiplies cloth speed */
- float maxgoal; /* see SB */
- float eff_force_scale;/* Scaling of effector forces (see softbody_calc_forces).*/
- float eff_wind_scale; /* Scaling of effector wind (see softbody_calc_forces). */
+ /** UNUSED atm. */
+ struct LinkNode *cache;
+ /** See SB. */
+ float mingoal;
+ /** Mechanical damping of springs. */
+ float Cdis DNA_DEPRECATED;
+ /** Viscous/fluid damping. */
+ float Cvi;
+ /** Gravity/external force vector. */
+ float gravity[3];
+ /** This is the duration of our time step, computed.. */
+ float dt;
+ /** The mass of the entire cloth. */
+ float mass;
+ /** Structural spring stiffness. */
+ float structural DNA_DEPRECATED;
+ /** Shear spring stiffness. */
+ float shear;
+ /** Flexion spring stiffness. */
+ float bending;
+ /** Max bending scaling value, min is "bending". */
+ float max_bend;
+ /** Max structural scaling value, min is "structural". */
+ float max_struct DNA_DEPRECATED;
+ /** Max shear scaling value. */
+ float max_shear;
+ /** Max sewing force. */
+ float max_sewing;
+ /** Used for normalized springs. */
+ float avg_spring_len;
+ /** Parameter how fast cloth runs. */
+ float timescale;
+ /** Multiplies cloth speed. */
+ float time_scale;
+ /** See SB. */
+ float maxgoal;
+ /** Scaling of effector forces (see softbody_calc_forces)..*/
+ float eff_force_scale;
+ /** Scaling of effector wind (see softbody_calc_forces).. */
+ float eff_wind_scale;
float sim_time_old;
float defgoal;
float goalspring;
float goalfrict;
- float velocity_smooth; /* smoothing of velocities for hair */
- float density_target; /* minimum density for hair */
- float density_strength; /* influence of hair density */
- float collider_friction; /* friction with colliders */
- float vel_damping DNA_DEPRECATED; /* damp the velocity to speed up getting to the resting position */
- float shrink_min; /* min amount to shrink cloth by 0.0f (no shrink) - 1.0f (shrink to nothing) */
- float shrink_max; /* max amount to shrink cloth by 0.0f (no shrink) - 1.0f (shrink to nothing) */
+ /** Smoothing of velocities for hair. */
+ float velocity_smooth;
+ /** Minimum density for hair. */
+ float density_target;
+ /** Influence of hair density. */
+ float density_strength;
+ /** Friction with colliders. */
+ float collider_friction;
+ /** Damp the velocity to speed up getting to the resting position. */
+ float vel_damping DNA_DEPRECATED;
+ /** Min amount to shrink cloth by 0.0f (no shrink) - 1.0f (shrink to nothing). */
+ float shrink_min;
+ /** Max amount to shrink cloth by 0.0f (no shrink) - 1.0f (shrink to nothing). */
+ float shrink_max;
/* XXX various hair stuff
* should really be separate, this struct is a horrible mess already
*/
- float bending_damping; /* damping of bending springs */
- float voxel_cell_size; /* size of voxel grid cells for continuum dynamics */
- int pad;
+ /** Damping of bending springs. */
+ float bending_damping;
+ /** Size of voxel grid cells for continuum dynamics. */
+ float voxel_cell_size;
+ char _pad[4];
- int stepsPerFrame; /* Number of time steps per frame. */
- int flags; /* flags, see CSIMSETT_FLAGS enum above. */
- int preroll DNA_DEPRECATED; /* How many frames of simulation to do before we start. */
- int maxspringlen; /* in percent!; if tearing enabled, a spring will get cut */
- short solver_type; /* which solver should be used? txold */
- short vgroup_bend; /* vertex group for scaling bending stiffness */
- short vgroup_mass; /* optional vertexgroup name for assigning weight.*/
- short vgroup_struct; /* vertex group for scaling structural stiffness */
- short vgroup_shrink; /* vertex group for shrinking cloth */
- short shapekey_rest; /* vertex group for scaling structural stiffness */
- short presets; /* used for presets on GUI */
+ /** Number of time steps per frame. */
+ int stepsPerFrame;
+ /** Flags, see CSIMSETT_FLAGS enum above. */
+ int flags;
+ /** How many frames of simulation to do before we start. */
+ int preroll DNA_DEPRECATED;
+ /** In percent!; if tearing enabled, a spring will get cut. */
+ int maxspringlen;
+ /** Which solver should be used? txold. */
+ short solver_type;
+ /** Vertex group for scaling bending stiffness. */
+ short vgroup_bend;
+ /** Optional vertexgroup name for assigning weight..*/
+ short vgroup_mass;
+ /** Vertex group for scaling structural stiffness. */
+ short vgroup_struct;
+ /** Vertex group for shrinking cloth. */
+ short vgroup_shrink;
+ /** Vertex group for scaling structural stiffness. */
+ short shapekey_rest;
+ /** Used for presets on GUI. */
+ short presets;
short reset;
- char pad0[4];
+ char _pad0[4];
struct EffectorWeights *effector_weights;
short bending_model;
- short vgroup_shear; /* Vertex group for scaling structural stiffness. */
+ /** Vertex group for scaling structural stiffness. */
+ short vgroup_shear;
float tension;
float compression;
float max_tension;
float max_compression;
- float tension_damp; /* Mechanical damping of tension springs. */
- float compression_damp; /* Mechanical damping of compression springs. */
- float shear_damp; /* Mechanical damping of shear springs. */
+ /** Mechanical damping of tension springs. */
+ float tension_damp;
+ /** Mechanical damping of compression springs. */
+ float compression_damp;
+ /** Mechanical damping of shear springs. */
+ float shear_damp;
} ClothSimSettings;
typedef struct ClothCollSettings {
- struct LinkNode *collision_list; /* e.g. pointer to temp memory for collisions */
- float epsilon; /* min distance for collisions. */
- float self_friction; /* Fiction/damping with self contact. */
- float friction; /* Friction/damping applied on contact with other object.*/
- float damping; /* Collision restitution on contact with other object.*/
- float selfepsilon; /* for selfcollision */
+ /** E.g. pointer to temp memory for collisions. */
+ struct LinkNode *collision_list;
+ /** Min distance for collisions. */
+ float epsilon;
+ /** Fiction/damping with self contact. */
+ float self_friction;
+ /** Friction/damping applied on contact with other object. */
+ float friction;
+ /** Collision restitution on contact with other object. */
+ float damping;
+ /** For selfcollision. */
+ float selfepsilon;
float repel_force DNA_DEPRECATED;
float distance_repel DNA_DEPRECATED;
- int flags; /* collision flags defined in BKE_cloth.h */
- short self_loop_count DNA_DEPRECATED; /* How many iterations for the selfcollision loop */
- short loop_count; /* How many iterations for the collision loop. */
- int pad;
- struct Collection *group; /* Only use colliders from this group of objects */
- short vgroup_selfcol; /* vgroup to paint which vertices are used for self collisions */
- short pad2[3];
- float clamp; /* Impulse clamp for object collisions. */
- float self_clamp; /* Impulse clamp for self collisions. */
+ /** Collision flags defined in BKE_cloth.h. */
+ int flags;
+ /** How many iterations for the selfcollision loop. */
+ short self_loop_count DNA_DEPRECATED;
+ /** How many iterations for the collision loop. */
+ short loop_count;
+ char _pad[4];
+ /** Only use colliders from this group of objects. */
+ struct Collection *group;
+ /** Vgroup to paint which vertices are used for self collisions. */
+ short vgroup_selfcol;
+ char _pad2[6];
+ /** Impulse clamp for object collisions. */
+ float clamp;
+ /** Impulse clamp for self collisions. */
+ float self_clamp;
} ClothCollSettings;
diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h
index f08725e9fe0..56f3d6ff290 100644
--- a/source/blender/makesdna/DNA_collection_types.h
+++ b/source/blender/makesdna/DNA_collection_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): mar-2001 nzc
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_collection_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*
* \brief Object groups, one object can be in many groups at once.
*/
@@ -38,8 +30,8 @@
#include "DNA_listBase.h"
#include "DNA_ID.h"
-struct Object;
struct Collection;
+struct Object;
typedef struct CollectionObject {
struct CollectionObject *next, *prev;
@@ -56,15 +48,18 @@ typedef struct CollectionChild {
typedef struct Collection {
ID id;
- ListBase gobject; /* CollectionObject */
- ListBase children; /* CollectionChild */
+ /** CollectionObject. */
+ ListBase gobject;
+ /** CollectionChild. */
+ ListBase children;
struct PreviewImage *preview;
unsigned int layer DNA_DEPRECATED;
- float dupli_ofs[3];
+ float instance_offset[3];
- short flag, pad[3];
+ short flag;
+ char _pad[6];
/* Runtime. Cache of objects in this collection and all its
* children. This is created on demand when e.g. some physics
diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h
index 2c6411ad375..76746ef2759 100644
--- a/source/blender/makesdna/DNA_color_types.h
+++ b/source/blender/makesdna/DNA_color_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file DNA_color_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_COLOR_TYPES_H__
@@ -43,7 +35,8 @@
typedef struct CurveMapPoint {
float x, y;
- short flag, shorty; /* shorty for result lookup */
+ /** Shorty for result lookup. */
+ short flag, shorty;
} CurveMapPoint;
/* curvepoint->flag */
@@ -56,14 +49,21 @@ enum {
typedef struct CurveMap {
short totpoint, flag;
- float range; /* quick multiply value for reading table */
- float mintable, maxtable; /* the x-axis range for the table */
- float ext_in[2], ext_out[2]; /* for extrapolated curves, the direction vector */
- CurveMapPoint *curve; /* actual curve */
- CurveMapPoint *table; /* display and evaluate table */
-
- CurveMapPoint *premultable; /* for RGB curves, premulled table */
- float premul_ext_in[2]; /* for RGB curves, premulled extrapolation vector */
+ /** Quick multiply value for reading table. */
+ float range;
+ /** The x-axis range for the table. */
+ float mintable, maxtable;
+ /** For extrapolated curves, the direction vector. */
+ float ext_in[2], ext_out[2];
+ /** Actual curve. */
+ CurveMapPoint *curve;
+ /** Display and evaluate table. */
+ CurveMapPoint *table;
+
+ /** For RGB curves, premulled table. */
+ CurveMapPoint *premultable;
+ /** For RGB curves, premulled extrapolation vector. */
+ float premul_ext_in[2];
float premul_ext_out[2];
} CurveMap;
@@ -71,20 +71,26 @@ typedef struct CurveMap {
#define CUMA_EXTEND_EXTRAPOLATE 1
typedef struct CurveMapping {
- int flag, cur; /* cur; for buttons, to show active curve */
+ /** Cur; for buttons, to show active curve. */
+ int flag, cur;
int preset;
int changed_timestamp;
- rctf curr, clipr; /* current rect, clip rect (is default rect too) */
+ /** Current rect, clip rect (is default rect too). */
+ rctf curr, clipr;
- CurveMap cm[4]; /* max 4 builtin curves per mapping struct now */
- float black[3], white[3]; /* black/white point (black[0] abused for current frame) */
- float bwmul[3]; /* black/white point multiply value, for speed */
+ /** Max 4 builtin curves per mapping struct now. */
+ CurveMap cm[4];
+ /** Black/white point (black[0] abused for current frame). */
+ float black[3], white[3];
+ /** Black/white point multiply value, for speed. */
+ float bwmul[3];
- float sample[3]; /* sample values, if flag set it draws line and intersection */
+ /** Sample values, if flag set it draws line and intersection. */
+ float sample[3];
short tone;
- short pad[3];
+ char _pad[6];
} CurveMapping;
/* cumapping->flag */
@@ -119,12 +125,12 @@ enum {
HISTO_MODE_R = 2,
HISTO_MODE_G = 3,
HISTO_MODE_B = 4,
- HISTO_MODE_ALPHA = 5
+ HISTO_MODE_ALPHA = 5,
};
enum {
HISTO_FLAG_LINE = (1 << 0),
- HISTO_FLAG_SAMPLELINE = (1 << 1)
+ HISTO_FLAG_SAMPLELINE = (1 << 1),
};
typedef struct Histogram {
@@ -164,7 +170,7 @@ typedef struct Scopes {
float *waveform_3;
float *vecscope;
int waveform_tot;
- int pad;
+ char _pad[4];
} Scopes;
/* scopes->wavefrm_mode */
@@ -176,13 +182,20 @@ typedef struct Scopes {
#define SCOPES_WAVEFRM_RGB 5
typedef struct ColorManagedViewSettings {
- int flag, pad;
- char look[64]; /* look which is being applied when displaying buffer on the screen (prior to view transform) */
- char view_transform[64]; /* view transform which is being applied when displaying buffer on the screen */
- float exposure; /* fstop exposure */
- float gamma; /* post-display gamma transform */
- struct CurveMapping *curve_mapping; /* pre-display RGB curves transform */
- void *pad2;
+ int flag;
+ char _pad[4];
+ /** Look which is being applied when displaying buffer on the screen
+ * (prior to view transform). */
+ char look[64];
+ /** View transform which is being applied when displaying buffer on the screen. */
+ char view_transform[64];
+ /** Fstop exposure. */
+ float exposure;
+ /** Post-display gamma transform. */
+ float gamma;
+ /** Pre-display RGB curves transform. */
+ struct CurveMapping *curve_mapping;
+ void *_pad2;
} ColorManagedViewSettings;
typedef struct ColorManagedDisplaySettings {
@@ -190,12 +203,13 @@ typedef struct ColorManagedDisplaySettings {
} ColorManagedDisplaySettings;
typedef struct ColorManagedColorspaceSettings {
- char name[64]; /* MAX_COLORSPACE_NAME */
+ /** MAX_COLORSPACE_NAME. */
+ char name[64];
} ColorManagedColorspaceSettings;
/* ColorManagedViewSettings->flag */
enum {
- COLORMANAGE_VIEW_USE_CURVES = (1 << 0)
+ COLORMANAGE_VIEW_USE_CURVES = (1 << 0),
};
#endif
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index b68ba8d9a89..b6fd57d1663 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): 2007, Joshua Leung, major recode
- *
- * ***** END GPL LICENSE BLOCK *****
* Constraint DNA data
*/
-/** \file DNA_constraint_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_CONSTRAINT_TYPES_H__
@@ -38,8 +30,8 @@
#include "DNA_listBase.h"
struct Action;
-struct Text;
struct Ipo;
+struct Text;
/* channels reside in Object or Action (ListBase) constraintChannels */
// XXX deprecated... old AnimSys
@@ -54,25 +46,38 @@ typedef struct bConstraintChannel {
typedef struct bConstraint {
struct bConstraint *next, *prev;
- void *data; /* Constraint data (a valid constraint type) */
- short type; /* Constraint type */
- short flag; /* Flag - General Settings */
+ /** Constraint data (a valid constraint type). */
+ void *data;
+ /** Constraint type. */
+ short type;
+ /** Flag - General Settings. */
+ short flag;
- char ownspace; /* Space that owner should be evaluated in */
- char tarspace; /* Space that target should be evaluated in (only used if 1 target) */
+ /** Space that owner should be evaluated in. */
+ char ownspace;
+ /** Space that target should be evaluated in (only used if 1 target). */
+ char tarspace;
- char name[64]; /* Constraint name, MAX_NAME */
+ /** Constraint name, MAX_NAME. */
+ char name[64];
- short pad;
+ char _pad[2];
- float enforce; /* Amount of influence exherted by constraint (0.0-1.0) */
- float headtail; /* Point along subtarget bone where the actual target is. 0=head (default for all), 1=tail*/
+ /** Amount of influence exherted by constraint (0.0-1.0). */
+ float enforce;
+ /** Point along subtarget bone where the actual target is. 0=head (default for all), 1=tail. */
+ float headtail;
- struct Ipo *ipo DNA_DEPRECATED; /* local influence ipo or driver */ /* old animation system, deprecated for 2.5 */
+ /* old animation system, deprecated for 2.5. */
+ /** Local influence ipo or driver */
+ struct Ipo *ipo DNA_DEPRECATED;
- /* below are readonly fields that are set at runtime by the solver for use in the GE (only IK atm) */
- float lin_error; /* residual error on constraint expressed in blender unit*/
- float rot_error; /* residual error on constraint expressed in radiant */
+ /* below are readonly fields that are set at runtime
+ * by the solver for use in the GE (only IK atm) */
+ /** Residual error on constraint expressed in blender unit. */
+ float lin_error;
+ /** Residual error on constraint expressed in radiant. */
+ float rot_error;
} bConstraint;
@@ -85,45 +90,71 @@ typedef struct bConstraint {
typedef struct bConstraintTarget {
struct bConstraintTarget *next, *prev;
- struct Object *tar; /* object to use as target */
- char subtarget[64]; /* subtarget - pchan or vgroup name, MAX_ID_NAME-2 */
-
- float matrix[4][4]; /* matrix used during constraint solving - should be cleared before each use */
-
- short space; /* space that target should be evaluated in (overrides bConstraint->tarspace) */
- short flag; /* runtime settings (for editor, etc.) */
- short type; /* type of target (eConstraintObType) */
- short rotOrder; /* rotation order for target (as defined in BLI_math.h) */
- float weight; /* weight for armature deform */
- char pad[4];
+ /** Object to use as target. */
+ struct Object *tar;
+ /** Subtarget - pchan or vgroup name, MAX_ID_NAME-2. */
+ char subtarget[64];
+
+ /** Matrix used during constraint solving - should be cleared before each use. */
+ float matrix[4][4];
+
+ /** Space that target should be evaluated in (overrides bConstraint->tarspace). */
+ short space;
+ /** Runtime settings (for editor, etc.). */
+ short flag;
+ /** Type of target (eConstraintObType). */
+ short type;
+ /** Rotation order for target (as defined in BLI_math.h). */
+ short rotOrder;
+ /** Weight for armature deform. */
+ float weight;
+ char _pad[4];
} bConstraintTarget;
/* bConstraintTarget -> flag */
typedef enum eConstraintTargetFlag {
- CONSTRAINT_TAR_TEMP = (1<<0) /* temporary target-struct that needs to be freed after use */
+ /** temporary target-struct that needs to be freed after use */
+ CONSTRAINT_TAR_TEMP = (1<<0),
} eConstraintTargetFlag;
/* bConstraintTarget/bConstraintOb -> type */
typedef enum eConstraintObType {
- CONSTRAINT_OBTYPE_OBJECT = 1, /* string is "" */
- CONSTRAINT_OBTYPE_BONE = 2, /* string is bone-name */
- CONSTRAINT_OBTYPE_VERT = 3, /* string is vertex-group name */
- CONSTRAINT_OBTYPE_CV = 4 /* string is vertex-group name - is not available until curves get vgroups */
+ /** string is "" */
+ CONSTRAINT_OBTYPE_OBJECT = 1,
+ /** string is bone-name */
+ CONSTRAINT_OBTYPE_BONE = 2,
+ /** string is vertex-group name */
+ CONSTRAINT_OBTYPE_VERT = 3,
+ /** string is vertex-group name - is not available until curves get vgroups */
+ CONSTRAINT_OBTYPE_CV = 4,
} eConstraintObType;
/* Python Script Constraint */
typedef struct bPythonConstraint {
- struct Text *text; /* text-buffer (containing script) to execute */
- IDProperty *prop; /* 'id-properties' used to store custom properties for constraint */
-
- int flag; /* general settings/state indicators accessed by bitmapping */
- int tarnum; /* number of targets - usually only 1-3 are needed */
-
- ListBase targets; /* a list of targets that this constraint has (bConstraintTarget-s) */
-
- struct Object *tar; /* target from previous implementation (version-patch sets this to NULL on file-load) */
- char subtarget[64]; /* subtarger from previous implementation (version-patch sets this to "" on file-load), MAX_ID_NAME-2 */
+ /** Text-buffer (containing script) to execute. */
+ struct Text *text;
+ /** 'id-properties' used to store custom properties for constraint. */
+ IDProperty *prop;
+
+ /** General settings/state indicators accessed by bitmapping. */
+ int flag;
+ /** Number of targets - usually only 1-3 are needed. */
+ int tarnum;
+
+ /** A list of targets that this constraint has (bConstraintTarget-s). */
+ ListBase targets;
+
+ /**
+ * Target from previous implementation
+ * (version-patch sets this to NULL on file-load).
+ */
+ struct Object *tar;
+ /**
+ * Subtarger from previous implementation
+ * (version-patch sets this to "" on file-load), MAX_ID_NAME-2.
+ */
+ char subtarget[64];
} bPythonConstraint;
@@ -134,26 +165,43 @@ typedef struct bPythonConstraint {
* This is indicated in the comments for each field
*/
typedef struct bKinematicConstraint {
- struct Object *tar; /* All: target object in case constraint needs a target */
- short iterations; /* All: Maximum number of iterations to try */
- short flag; /* All & CopyPose: some options Like CONSTRAINT_IK_TIP */
- short rootbone; /* All: index to rootbone, if zero go all the way to mother bone */
- short max_rootbone; /* CopyPose: for auto-ik, maximum length of chain */
- char subtarget[64]; /* All: String to specify sub-object target, MAX_ID_NAME-2 */
- struct Object *poletar; /* All: Pole vector target */
- char polesubtarget[64]; /* All: Pole vector sub-object target, MAX_ID_NAME-2 */
- float poleangle; /* All: Pole vector rest angle */
- float weight; /* All: Weight of constraint in IK tree */
- float orientweight; /* CopyPose: Amount of rotation a target applies on chain */
- float grabtarget[3]; /* CopyPose: for target-less IK */
- short type; /* subtype of IK constraint: eConstraint_IK_Type */
- short mode; /* Distance: how to limit in relation to clamping sphere: LIMITDIST_.. */
- float dist; /* Distance: distance (radius of clamping sphere) from target */
+ /** All: target object in case constraint needs a target. */
+ struct Object *tar;
+ /** All: Maximum number of iterations to try. */
+ short iterations;
+ /** All & CopyPose: some options Like CONSTRAINT_IK_TIP. */
+ short flag;
+ /** All: index to rootbone, if zero go all the way to mother bone. */
+ short rootbone;
+ /** CopyPose: for auto-ik, maximum length of chain. */
+ short max_rootbone;
+ /** All: String to specify sub-object target, MAX_ID_NAME-2. */
+ char subtarget[64];
+ /** All: Pole vector target. */
+ struct Object *poletar;
+ /** All: Pole vector sub-object target, MAX_ID_NAME-2. */
+ char polesubtarget[64];
+ /** All: Pole vector rest angle. */
+ float poleangle;
+ /** All: Weight of constraint in IK tree. */
+ float weight;
+ /** CopyPose: Amount of rotation a target applies on chain. */
+ float orientweight;
+ /** CopyPose: for target-less IK. */
+ float grabtarget[3];
+ /** Subtype of IK constraint: eConstraint_IK_Type. */
+ short type;
+ /** Distance: how to limit in relation to clamping sphere: LIMITDIST_... */
+ short mode;
+ /** Distance: distance (radius of clamping sphere) from target. */
+ float dist;
} bKinematicConstraint;
typedef enum eConstraint_IK_Type {
- CONSTRAINT_IK_COPYPOSE = 0, /* 'standard' IK constraint: match position and/or orientation of target */
- CONSTRAINT_IK_DISTANCE = 1 /* maintain distance with target */
+ /** 'standard' IK constraint: match position and/or orientation of target */
+ CONSTRAINT_IK_COPYPOSE = 0,
+ /** maintain distance with target */
+ CONSTRAINT_IK_DISTANCE = 1,
} eConstraint_IK_Type;
@@ -164,16 +212,25 @@ typedef enum eConstraint_IK_Type {
*/
typedef struct bSplineIKConstraint {
/* target(s) */
- struct Object *tar; /* curve object (with follow path enabled) which drives the bone chain */
+ /** Curve object (with follow path enabled) which drives the bone chain. */
+ struct Object *tar;
/* binding details */
- float *points; /* array of numpoints items, denoting parametric positions along curve that joints should follow */
- short numpoints; /* number of points to bound in points array */
- short chainlen; /* number of bones ('n') that are in the chain */
+ /**
+ * Array of numpoints items,
+ * denoting parametric positions along curve that joints should follow.
+ */
+ float *points;
+ /** Number of points to bound in points array. */
+ short numpoints;
+ /** Number of bones ('n') that are in the chain. */
+ short chainlen;
/* settings */
- short flag; /* general settings for constraint */
- short xzScaleMode; /* method used for determining the x & z scaling of the bones */
+ /** General settings for constraint. */
+ short flag;
+ /** Method used for determining the x & z scaling of the bones. */
+ short xzScaleMode;
/* volume preservation settings */
float bulge;
@@ -184,10 +241,12 @@ typedef struct bSplineIKConstraint {
/* Armature Constraint */
typedef struct bArmatureConstraint {
- int flag; /* general settings/state indicators accessed by bitmapping */
- char pad[4];
+ /** General settings/state indicators accessed by bitmapping. */
+ int flag;
+ char _pad[4];
- ListBase targets; /* a list of targets that this constraint has (bConstraintTarget-s) */
+ /** A list of targets that this constraint has (bConstraintTarget-s). */
+ ListBase targets;
} bArmatureConstraint;
/* Single-target subobject constraints --------------------- */
@@ -195,14 +254,18 @@ typedef struct bArmatureConstraint {
/* Track To Constraint */
typedef struct bTrackToConstraint {
struct Object *tar;
- int reserved1; /* I'll be using reserved1 and reserved2 as Track and Up flags,
- * not sure if that's what they were intended for anyway.
- * Not sure either if it would create backward incompatibility if I were to rename them.
- * - theeth*/
+ /**
+ * I'll be using reserved1 and reserved2 as Track and Up flags,
+ * not sure if that's what they were intended for anyway.
+ * Not sure either if it would create backward incompatibility if I were to rename them.
+ * - theeth
+ */
+ int reserved1;
int reserved2;
int flags;
- int pad;
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ char _pad[4];
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
} bTrackToConstraint;
/* Copy Rotation Constraint */
@@ -210,7 +273,8 @@ typedef struct bRotateLikeConstraint {
struct Object *tar;
int flag;
int reserved1;
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
} bRotateLikeConstraint;
/* Copy Location Constraint */
@@ -218,7 +282,8 @@ typedef struct bLocateLikeConstraint {
struct Object *tar;
int flag;
int reserved1;
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
} bLocateLikeConstraint;
/* Copy Scale Constraint */
@@ -226,7 +291,8 @@ typedef struct bSizeLikeConstraint {
struct Object *tar;
int flag;
int reserved1;
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
} bSizeLikeConstraint;
/* Maintain Volume Constraint */
@@ -238,7 +304,8 @@ typedef struct bSameVolumeConstraint {
/* Copy Transform Constraint */
typedef struct bTransLikeConstraint {
struct Object *tar;
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
} bTransLikeConstraint;
/* Floor Constraint */
@@ -247,23 +314,29 @@ typedef struct bMinMaxConstraint {
int minmaxflag;
float offset;
int flag;
- short sticky, stuck, pad1, pad2; /* for backward compatibility */
+ /** For backward compatibility. */
+ short sticky, stuck;
+ char _pad[4];
float cache[3];
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
} bMinMaxConstraint;
/* Action Constraint */
typedef struct bActionConstraint {
struct Object *tar;
- short type; /* what transform 'channel' drives the result */
- short local; /* was used in versions prior to the Constraints recode */
+ /** What transform 'channel' drives the result. */
+ short type;
+ /** Was used in versions prior to the Constraints recode. */
+ short local;
int start;
int end;
float min;
float max;
int flag;
struct bAction *act;
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
} bActionConstraint;
/* Locked Axis Tracking constraint */
@@ -271,23 +344,28 @@ typedef struct bLockTrackConstraint {
struct Object *tar;
int trackflag;
int lockflag;
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
} bLockTrackConstraint;
/* Damped Tracking constraint */
typedef struct bDampTrackConstraint {
struct Object *tar;
int trackflag;
- int pad;
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ char _pad[4];
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
} bDampTrackConstraint;
/* Follow Path constraints */
typedef struct bFollowPathConstraint {
- struct Object *tar; /* Must be path object */
+ /** Must be path object. */
+ struct Object *tar;
- float offset; /* Offset in time on the path (in frames), when NOT using 'fixed position' */
- float offset_fac; /* Parametric offset factor defining position along path, when using 'fixed position' */
+ /** Offset in time on the path (in frames), when NOT using 'fixed position'. */
+ float offset;
+ /** Parametric offset factor defining position along path, when using 'fixed position'. */
+ float offset_fac;
int followflag;
@@ -306,7 +384,8 @@ typedef struct bStretchToConstraint {
float bulge_min;
float bulge_max;
float bulge_smooth;
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
} bStretchToConstraint;
/* Rigid Body constraint */
@@ -324,49 +403,68 @@ typedef struct bRigidBodyJointConstraint {
float maxLimit[6];
float extraFz;
short flag;
- short pad;
- short pad1;
- short pad2;
+ char _pad[6];
} bRigidBodyJointConstraint;
/* Clamp-To Constraint */
typedef struct bClampToConstraint {
- struct Object *tar; /* 'target' must be a curve */
- int flag; /* which axis/plane to compare owner's location on */
- int flag2; /* for legacy reasons, this is flag2. used for any extra settings */
+ /** 'target' must be a curve. */
+ struct Object *tar;
+ /** Which axis/plane to compare owner's location on . */
+ int flag;
+ /** For legacy reasons, this is flag2. used for any extra settings. */
+ int flag2;
} bClampToConstraint;
/* Child Of Constraint */
typedef struct bChildOfConstraint {
- struct Object *tar; /* object which will act as parent (or target comes from) */
- int flag; /* settings */
- int pad;
- float invmat[4][4]; /* parent-inverse matrix to use */
- char subtarget[64]; /* string to specify a subobject target, MAX_ID_NAME-2 */
+ /** Object which will act as parent (or target comes from). */
+ struct Object *tar;
+ /** Settings. */
+ int flag;
+ char _pad[4];
+ /** Parent-inverse matrix to use. */
+ float invmat[4][4];
+ /** String to specify a subobject target, MAX_ID_NAME-2. */
+ char subtarget[64];
} bChildOfConstraint;
/* Generic Transform->Transform Constraint */
typedef struct bTransformConstraint {
- struct Object *tar; /* target (i.e. 'driver' object/bone) */
- char subtarget[64]; /* MAX_ID_NAME-2 */
-
- short from, to; /* can be loc(0), rot(1) or size(2) */
- char map[3]; /* defines which target-axis deform is copied by each owner-axis */
- char expo; /* extrapolate motion? if 0, confine to ranges */
-
- float from_min[3]; /* from_min/max defines range of target transform */
- float from_max[3]; /* to map on to to_min/max range. */
- float to_min[3]; /* range of motion on owner caused by target */
+ /** Target (i.e. 'driver' object/bone). */
+ struct Object *tar;
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
+
+ /** Can be loc(0), rot(1) or size(2). */
+ short from, to;
+ /** Defines which target-axis deform is copied by each owner-axis. */
+ char map[3];
+ /** Extrapolate motion? if 0, confine to ranges. */
+ char expo;
+
+ /** From_min/max defines range of target transform. */
+ float from_min[3];
+ /** To map on to to_min/max range. */
+ float from_max[3];
+ /** Range of motion on owner caused by target . */
+ float to_min[3];
float to_max[3];
- float from_min_rot[3]; /* from_min/max defines range of target transform */
- float from_max_rot[3]; /* to map on to to_min/max range. */
- float to_min_rot[3]; /* range of motion on owner caused by target */
+ /** From_min/max defines range of target transform. */
+ float from_min_rot[3];
+ /** To map on to to_min/max range. */
+ float from_max_rot[3];
+ /** Range of motion on owner caused by target . */
+ float to_min_rot[3];
float to_max_rot[3];
- float from_min_scale[3]; /* from_min/max defines range of target transform */
- float from_max_scale[3]; /* to map on to to_min/max range. */
- float to_min_scale[3]; /* range of motion on owner caused by target */
+ /** From_min/max defines range of target transform. */
+ float from_min_scale[3];
+ /** To map on to to_min/max range. */
+ float from_max_scale[3];
+ /** Range of motion on owner caused by target . */
+ float to_min_scale[3];
float to_max_scale[3];
} bTransformConstraint;
@@ -375,17 +473,22 @@ typedef struct bPivotConstraint {
/* Pivot Point:
* Either target object + offset, or just offset is used
*/
- struct Object *tar; /* target object (optional) */
- char subtarget[64]; /* subtarget name (optional), MAX_ID_NAME-2 */
- float offset[3]; /* offset from the target to use, regardless of whether it exists */
+ /** Target object (optional). */
+ struct Object *tar;
+ /** Subtarget name (optional), MAX_ID_NAME-2. */
+ char subtarget[64];
+ /** Offset from the target to use, regardless of whether it exists. */
+ float offset[3];
/* Rotation-driven activation:
* This option provides easier one-stop setups for footrolls
*/
- short rotAxis; /* rotation axes to consider for this (ePivotConstraint_Axis) */
+ /** Rotation axes to consider for this (#ePivotConstraint_Axis). */
+ short rotAxis;
/* General flags */
- short flag; /* ePivotConstraint_Flag */
+ /** #ePivotConstraint_Flag. */
+ short flag;
} bPivotConstraint;
/* transform limiting constraints - zero target ---------------------------- */
@@ -419,37 +522,52 @@ typedef struct bSizeLimitConstraint {
/* Limit Distance Constraint */
typedef struct bDistLimitConstraint {
struct Object *tar;
- char subtarget[64]; /* MAX_ID_NAME-2 */
+ /** MAX_ID_NAME-2. */
+ char subtarget[64];
- float dist; /* distance (radius of clamping sphere) from target */
- float soft; /* distance from clamping-sphere to start applying 'fade' */
+ /** Distance (radius of clamping sphere) from target. */
+ float dist;
+ /** Distance from clamping-sphere to start applying 'fade'. */
+ float soft;
- short flag; /* settings */
- short mode; /* how to limit in relation to clamping sphere */
- int pad;
+ /** Settings. */
+ short flag;
+ /** How to limit in relation to clamping sphere. */
+ short mode;
+ char _pad[4];
} bDistLimitConstraint;
/* ShrinkWrap Constraint */
typedef struct bShrinkwrapConstraint {
struct Object *target;
- float dist; /* distance to kept from target */
- short shrinkType; /* shrink type (look on MOD shrinkwrap for values) */
- char projAxis; /* axis to project/constrain */
- char projAxisSpace; /* space to project axis in */
- float projLimit; /* distance to search */
- char shrinkMode; /* inside/outside/on surface (see MOD shrinkwrap) */
- char flag; /* options */
- char trackAxis; /* axis to align to normal */
- char pad;
+ /** Distance to kept from target. */
+ float dist;
+ /** Shrink type (look on MOD shrinkwrap for values). */
+ short shrinkType;
+ /** Axis to project/constrain. */
+ char projAxis;
+ /** Space to project axis in. */
+ char projAxisSpace;
+ /** Distance to search. */
+ float projLimit;
+ /** Inside/outside/on surface (see MOD shrinkwrap). */
+ char shrinkMode;
+ /** Options. */
+ char flag;
+ /** Axis to align to normal. */
+ char trackAxis;
+ char _pad;
} bShrinkwrapConstraint;
/* Follow Track constraints */
typedef struct bFollowTrackConstraint {
struct MovieClip *clip;
- char track[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char track[64];
int flag;
int frame_method;
- char object[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char object[64];
struct Object *camera;
struct Object *depth_ob;
} bFollowTrackConstraint;
@@ -457,15 +575,19 @@ typedef struct bFollowTrackConstraint {
/* Camera Solver constraints */
typedef struct bCameraSolverConstraint {
struct MovieClip *clip;
- int flag, pad;
+ int flag;
+ char _pad[4];
} bCameraSolverConstraint;
/* Camera Solver constraints */
typedef struct bObjectSolverConstraint {
struct MovieClip *clip;
- int flag, pad;
- char object[64]; /* MAX_NAME */
- float invmat[4][4]; /* parent-inverse matrix to use */
+ int flag;
+ char _pad[4];
+ /** MAX_NAME. */
+ char object[64];
+ /** Parent-inverse matrix to use. */
+ float invmat[4][4];
struct Object *camera;
} bObjectSolverConstraint;
@@ -473,7 +595,8 @@ typedef struct bObjectSolverConstraint {
typedef struct bTransformCacheConstraint {
struct CacheFile *cache_file;
struct CacheReader *reader;
- char object_path[1024]; /* FILE_MAX */
+ /** FILE_MAX. */
+ char object_path[1024];
} bTransformCacheConstraint;
/* ------------------------------------------ */
@@ -483,37 +606,60 @@ typedef struct bTransformCacheConstraint {
* broken as their correct value cannot be resolved
*/
typedef enum eBConstraint_Types {
- CONSTRAINT_TYPE_NULL = 0, /* Invalid/legacy constraint */
- CONSTRAINT_TYPE_CHILDOF = 1, /* Unimplemented non longer :) - during constraints recode, Aligorith */
+ /** Invalid/legacy constraint */
+ CONSTRAINT_TYPE_NULL = 0,
+ /** Unimplemented non longer :) - during constraints recode, Aligorith */
+ CONSTRAINT_TYPE_CHILDOF = 1,
CONSTRAINT_TYPE_TRACKTO = 2,
CONSTRAINT_TYPE_KINEMATIC = 3,
CONSTRAINT_TYPE_FOLLOWPATH = 4,
- CONSTRAINT_TYPE_ROTLIMIT = 5, /* Unimplemented no longer :) - Aligorith */
- CONSTRAINT_TYPE_LOCLIMIT = 6, /* Unimplemented no longer :) - Aligorith */
- CONSTRAINT_TYPE_SIZELIMIT = 7, /* Unimplemented no longer :) - Aligorith */
+ /** Unimplemented no longer :) - Aligorith */
+ CONSTRAINT_TYPE_ROTLIMIT = 5,
+ /** Unimplemented no longer :) - Aligorith */
+ CONSTRAINT_TYPE_LOCLIMIT = 6,
+ /** Unimplemented no longer :) - Aligorith */
+ CONSTRAINT_TYPE_SIZELIMIT = 7,
CONSTRAINT_TYPE_ROTLIKE = 8,
CONSTRAINT_TYPE_LOCLIKE = 9,
CONSTRAINT_TYPE_SIZELIKE = 10,
- CONSTRAINT_TYPE_PYTHON = 11, /* Unimplemented no longer :) - Aligorith. Scripts */
+ /** Unimplemented no longer :) - Aligorith. Scripts */
+ CONSTRAINT_TYPE_PYTHON = 11,
CONSTRAINT_TYPE_ACTION = 12,
- CONSTRAINT_TYPE_LOCKTRACK = 13, /* New Tracking constraint that locks an axis in place - theeth */
- CONSTRAINT_TYPE_DISTLIMIT = 14, /* limit distance */
- CONSTRAINT_TYPE_STRETCHTO = 15, /* claiming this to be mine :) is in tuhopuu bjornmose */
- CONSTRAINT_TYPE_MINMAX = 16, /* floor constraint */
+ /** New Tracking constraint that locks an axis in place - theeth */
+ CONSTRAINT_TYPE_LOCKTRACK = 13,
+ /** limit distance */
+ CONSTRAINT_TYPE_DISTLIMIT = 14,
+ /** claiming this to be mine :) is in tuhopuu bjornmose */
+ CONSTRAINT_TYPE_STRETCHTO = 15,
+ /** floor constraint */
+ CONSTRAINT_TYPE_MINMAX = 16,
/* CONSTRAINT_TYPE_DEPRECATED = 17 */
- CONSTRAINT_TYPE_CLAMPTO = 18, /* clampto constraint */
- CONSTRAINT_TYPE_TRANSFORM = 19, /* transformation (loc/rot/size -> loc/rot/size) constraint */
- CONSTRAINT_TYPE_SHRINKWRAP = 20, /* shrinkwrap (loc/rot) constraint */
- CONSTRAINT_TYPE_DAMPTRACK = 21, /* New Tracking constraint that minimizes twisting */
- CONSTRAINT_TYPE_SPLINEIK = 22, /* Spline-IK - Align 'n' bones to a curve */
- CONSTRAINT_TYPE_TRANSLIKE = 23, /* Copy transform matrix */
- CONSTRAINT_TYPE_SAMEVOL = 24, /* Maintain volume during scaling */
- CONSTRAINT_TYPE_PIVOT = 25, /* Pivot Constraint */
- CONSTRAINT_TYPE_FOLLOWTRACK = 26, /* Follow Track Constraint */
- CONSTRAINT_TYPE_CAMERASOLVER = 27, /* Camera Solver Constraint */
- CONSTRAINT_TYPE_OBJECTSOLVER = 28, /* Object Solver Constraint */
- CONSTRAINT_TYPE_TRANSFORM_CACHE = 29, /* Transform Cache Constraint */
- CONSTRAINT_TYPE_ARMATURE = 30, /* Armature Deform Constraint */
+ /** clampto constraint */
+ CONSTRAINT_TYPE_CLAMPTO = 18,
+ /** transformation (loc/rot/size -> loc/rot/size) constraint */
+ CONSTRAINT_TYPE_TRANSFORM = 19,
+ /** shrinkwrap (loc/rot) constraint */
+ CONSTRAINT_TYPE_SHRINKWRAP = 20,
+ /** New Tracking constraint that minimizes twisting */
+ CONSTRAINT_TYPE_DAMPTRACK = 21,
+ /** Spline-IK - Align 'n' bones to a curve */
+ CONSTRAINT_TYPE_SPLINEIK = 22,
+ /** Copy transform matrix */
+ CONSTRAINT_TYPE_TRANSLIKE = 23,
+ /** Maintain volume during scaling */
+ CONSTRAINT_TYPE_SAMEVOL = 24,
+ /** Pivot Constraint */
+ CONSTRAINT_TYPE_PIVOT = 25,
+ /** Follow Track Constraint */
+ CONSTRAINT_TYPE_FOLLOWTRACK = 26,
+ /** Camera Solver Constraint */
+ CONSTRAINT_TYPE_CAMERASOLVER = 27,
+ /** Object Solver Constraint */
+ CONSTRAINT_TYPE_OBJECTSOLVER = 28,
+ /** Transform Cache Constraint */
+ CONSTRAINT_TYPE_TRANSFORM_CACHE = 29,
+ /** Armature Deform Constraint */
+ CONSTRAINT_TYPE_ARMATURE = 30,
/* NOTE: no constraints are allowed to be added after this */
NUM_CONSTRAINT_TYPES
@@ -521,27 +667,28 @@ typedef enum eBConstraint_Types {
/* bConstraint->flag */
/* flags 0x2 (1<<1) and 0x8 (1<<3) were used in past */
-/* flag 0x20 (1<<5) was used to indicate that a constraint was evaluated using a 'local' hack for posebones only */
+/* flag 0x20 (1<<5) was used to indicate that a constraint was evaluated
+ * using a 'local' hack for posebones only. */
typedef enum eBConstraint_Flags {
- /* expand for UI */
+ /* expand for UI */
CONSTRAINT_EXPAND = (1<<0),
- /* pre-check for illegal object name or bone name */
+ /* pre-check for illegal object name or bone name */
CONSTRAINT_DISABLE = (1<<2),
- /* to indicate which Ipo should be shown, maybe for 3d access later too */
+ /* to indicate which Ipo should be shown, maybe for 3d access later too */
CONSTRAINT_ACTIVE = (1<<4),
- /* to indicate that the owner's space should only be changed into ownspace, but not out of it */
+ /* to indicate that the owner's space should only be changed into ownspace, but not out of it */
CONSTRAINT_SPACEONCE = (1<<6),
- /* influence ipo is on constraint itself, not in action channel */
+ /* influence ipo is on constraint itself, not in action channel */
CONSTRAINT_OWN_IPO = (1<<7),
- /* indicates that constraint was added locally (i.e. didn't come from the proxy-lib) */
+ /* indicates that constraint was added locally (i.e. didn't come from the proxy-lib) */
CONSTRAINT_PROXY_LOCAL = (1<<8),
- /* indicates that constraint is temporarily disabled (only used in GE) */
+ /* indicates that constraint is temporarily disabled (only used in GE) */
CONSTRAINT_OFF = (1<<9),
- /* use bbone curve shape when calculating headtail values (also used by dependency graph!) */
+ /* use bbone curve shape when calculating headtail values (also used by dependency graph!) */
CONSTRAINT_BBONE_SHAPE = (1<<10),
- /* That constraint has been inserted in local override (i.e. it can be fully edited!). */
+ /* That constraint has been inserted in local override (i.e. it can be fully edited!). */
CONSTRAINT_STATICOVERRIDE_LOCAL = (1 << 11),
- /* use full transformation (not just segment locations) - only set at runtime */
+ /* use full transformation (not just segment locations) - only set at runtime */
CONSTRAINT_BBONE_SHAPE_FULL = (1 << 12),
} eBConstraint_Flags;
@@ -565,7 +712,7 @@ typedef enum eBConstraint_SpaceTypes {
// XXX deprecated... old AnimSys
typedef enum eConstraintChannel_Flags {
CONSTRAINT_CHANNEL_SELECT = (1<<0),
- CONSTRAINT_CHANNEL_PROTECTED = (1<<1)
+ CONSTRAINT_CHANNEL_PROTECTED = (1<<1),
} eConstraintChannel_Flags;
/* -------------------------------------- */
@@ -578,7 +725,7 @@ typedef enum eCopyRotation_Flags {
ROTLIKE_X_INVERT = (1<<4),
ROTLIKE_Y_INVERT = (1<<5),
ROTLIKE_Z_INVERT = (1<<6),
- ROTLIKE_OFFSET = (1<<7)
+ ROTLIKE_OFFSET = (1<<7),
} eCopyRotation_Flags;
/* bLocateLikeConstraint.flag */
@@ -591,7 +738,7 @@ typedef enum eCopyLocation_Flags {
LOCLIKE_X_INVERT = (1<<4),
LOCLIKE_Y_INVERT = (1<<5),
LOCLIKE_Z_INVERT = (1<<6),
- LOCLIKE_OFFSET = (1<<7)
+ LOCLIKE_OFFSET = (1<<7),
} eCopyLocation_Flags;
/* bSizeLikeConstraint.flag */
@@ -614,7 +761,7 @@ typedef enum eTransform_ToFrom {
typedef enum eSameVolume_Modes {
SAMEVOL_X = 0,
SAMEVOL_Y = 1,
- SAMEVOL_Z = 2
+ SAMEVOL_Z = 2,
} eSameVolume_Modes;
/* bActionConstraint.flag */
@@ -627,14 +774,14 @@ typedef enum eActionConstraint_Flags {
typedef enum eLockAxis_Modes {
LOCK_X = 0,
LOCK_Y = 1,
- LOCK_Z = 2
+ LOCK_Z = 2,
} eLockAxis_Modes;
/* Up-Axis Values (TrackTo and Locked Track) */
typedef enum eUpAxis_Modes {
UP_X = 0,
UP_Y = 1,
- UP_Z = 2
+ UP_Z = 2,
} eUpAxis_Modes;
/* Tracking axis (TrackTo, Locked Track, Damped Track) and minmax (floor) constraint */
@@ -668,12 +815,12 @@ typedef enum eShrinkwrap_Flags {
typedef enum eFollowPath_Flags {
FOLLOWPATH_FOLLOW = (1<<0),
FOLLOWPATH_STATIC = (1<<1),
- FOLLOWPATH_RADIUS = (1<<2)
+ FOLLOWPATH_RADIUS = (1<<2),
} eFollowPath_Flags;
/* bTrackToConstraint->flags */
typedef enum eTrackTo_Flags {
- TARGET_Z_UP = (1<<0)
+ TARGET_Z_UP = (1<<0),
} eTrackTo_Flags;
/* Stretch To Constraint -> volmode */
@@ -681,14 +828,14 @@ typedef enum eStretchTo_VolMode {
VOLUME_XZ = 0,
VOLUME_X = 1,
VOLUME_Z = 2,
- NO_VOLUME = 3
+ NO_VOLUME = 3,
} eStretchTo_VolMode;
/* Stretch To Constraint -> plane mode */
typedef enum eStretchTo_PlaneMode {
PLANE_X = 0,
PLANE_Y = 1,
- PLANE_Z = 2
+ PLANE_Z = 2,
} eStretchTo_PlaneMode;
/* Clamp-To Constraint ->flag */
@@ -696,12 +843,12 @@ typedef enum eClampTo_Modes {
CLAMPTO_AUTO = 0,
CLAMPTO_X = 1,
CLAMPTO_Y = 2,
- CLAMPTO_Z = 3
+ CLAMPTO_Z = 3,
} eClampTo_Modes;
/* ClampTo Constraint ->flag2 */
typedef enum eClampTo_Flags {
- CLAMPTO_CYCLIC = (1<<0)
+ CLAMPTO_CYCLIC = (1<<0),
} eClampTo_Flags;
/* bKinematicConstraint->flag */
@@ -724,7 +871,7 @@ typedef enum eKinematic_Flags {
CONSTRAINT_IK_NO_ROT_Y = (1<<12),
CONSTRAINT_IK_NO_ROT_Z = (1<<13),
/* axis relative to target */
- CONSTRAINT_IK_TARGETAXIS = (1<<14)
+ CONSTRAINT_IK_TARGETAXIS = (1<<14),
} eKinematic_Flags;
/* bSplineIKConstraint->flag */
@@ -754,21 +901,24 @@ typedef enum eSplineIK_XZScaleModes {
/* x/z scales are the inverse of the y-scale */
CONSTRAINT_SPLINEIK_XZS_INVERSE = 2,
/* x/z scales are computed using a volume preserving technique (from Stretch To constraint) */
- CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC = 3
+ CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC = 3,
} eSplineIK_XZScaleModes;
/* bArmatureConstraint -> flag */
typedef enum eArmature_Flags {
- CONSTRAINT_ARMATURE_QUATERNION = (1<<0), /* use dual quaternion blending */
- CONSTRAINT_ARMATURE_ENVELOPE = (1<<1), /* use envelopes */
- CONSTRAINT_ARMATURE_CUR_LOCATION = (1<<2), /* use current bone location */
+ /** use dual quaternion blending */
+ CONSTRAINT_ARMATURE_QUATERNION = (1<<0),
+ /** use envelopes */
+ CONSTRAINT_ARMATURE_ENVELOPE = (1<<1),
+ /** use current bone location */
+ CONSTRAINT_ARMATURE_CUR_LOCATION = (1<<2),
} eArmature_Flags;
/* MinMax (floor) flags */
typedef enum eFloor_Flags {
MINMAX_STICKY = (1<<0),
MINMAX_STUCK = (1<<1),
- MINMAX_USEROT = (1<<2)
+ MINMAX_USEROT = (1<<2),
} eFloor_Flags;
/* transform limiting constraints -> flag2 */
@@ -776,7 +926,7 @@ typedef enum eTransformLimits_Flags2 {
/* not used anymore - for older Limit Location constraints only */
LIMIT_NOPARENT = (1<<0),
/* for all Limit constraints - allow to be used during transform? */
- LIMIT_TRANSFORM = (1<<1)
+ LIMIT_TRANSFORM = (1<<1),
} eTransformLimits_Flags2;
/* transform limiting constraints -> flag (own flags) */
@@ -786,14 +936,14 @@ typedef enum eTransformLimits_Flags {
LIMIT_YMIN = (1<<2),
LIMIT_YMAX = (1<<3),
LIMIT_ZMIN = (1<<4),
- LIMIT_ZMAX = (1<<5)
+ LIMIT_ZMAX = (1<<5),
} eTransformLimits_Flags;
/* limit rotation constraint -> flag (own flags) */
typedef enum eRotLimit_Flags {
LIMIT_XROT = (1<<0),
LIMIT_YROT = (1<<1),
- LIMIT_ZROT = (1<<2)
+ LIMIT_ZROT = (1<<2),
} eRotLimit_Flags;
/* distance limit constraint */
@@ -802,20 +952,20 @@ typedef enum eDistLimit_Flag {
/* "soft" cushion effect when reaching the limit sphere */ // NOT IMPLEMENTED!
LIMITDIST_USESOFT = (1<<0),
/* as for all Limit constraints - allow to be used during transform? */
- LIMITDIST_TRANSFORM = (1<<1)
+ LIMITDIST_TRANSFORM = (1<<1),
} eDistLimit_Flag;
/* bDistLimitConstraint->mode */
typedef enum eDistLimit_Modes {
LIMITDIST_INSIDE = 0,
LIMITDIST_OUTSIDE = 1,
- LIMITDIST_ONSURFACE = 2
+ LIMITDIST_ONSURFACE = 2,
} eDistLimit_Modes;
/* python constraint -> flag */
typedef enum ePyConstraint_Flags {
PYCON_USETARGETS = (1<<0),
- PYCON_SCRIPTERROR = (1<<1)
+ PYCON_SCRIPTERROR = (1<<1),
} ePyConstraint_Flags;
/* ChildOf Constraint -> flag */
@@ -829,7 +979,7 @@ typedef enum eChildOf_Flags {
CHILDOF_SIZEX = (1<<6),
CHILDOF_SIZEY = (1<<7),
CHILDOF_SIZEZ = (1<<8),
- CHILDOF_ALL = 511
+ CHILDOF_ALL = 511,
} eChildOf_Flags;
/* Pivot Constraint */
@@ -850,7 +1000,7 @@ typedef enum ePivotConstraint_Axis {
/* consider +ve y-axis rotations */
PIVOTCON_AXIS_Y = 4,
/* consider +ve z-axis rotations */
- PIVOTCON_AXIS_Z = 5
+ PIVOTCON_AXIS_Z = 5,
} ePivotConstraint_Axis;
/* settings for Pivot Constraint in general */
@@ -858,29 +1008,29 @@ typedef enum ePivotConstraint_Flag {
/* offset is to be interpreted as being a fixed-point in space */
PIVOTCON_FLAG_OFFSET_ABS = (1<<0),
/* rotation-based activation uses negative rotation to drive result */
- PIVOTCON_FLAG_ROTACT_NEG = (1<<1)
+ PIVOTCON_FLAG_ROTACT_NEG = (1<<1),
} ePivotConstraint_Flag;
typedef enum eFollowTrack_Flags {
FOLLOWTRACK_ACTIVECLIP = (1<<0),
FOLLOWTRACK_USE_3D_POSITION = (1<<1),
- FOLLOWTRACK_USE_UNDISTORTION = (1<<2)
+ FOLLOWTRACK_USE_UNDISTORTION = (1<<2),
} eFollowTrack_Flags;
typedef enum eFollowTrack_FrameMethod {
FOLLOWTRACK_FRAME_STRETCH = 0,
FOLLOWTRACK_FRAME_FIT = 1,
- FOLLOWTRACK_FRAME_CROP = 2
+ FOLLOWTRACK_FRAME_CROP = 2,
} eFollowTrack_FrameMethod;
/* CameraSolver Constraint -> flag */
typedef enum eCameraSolver_Flags {
- CAMERASOLVER_ACTIVECLIP = (1<<0)
+ CAMERASOLVER_ACTIVECLIP = (1<<0),
} eCameraSolver_Flags;
/* ObjectSolver Constraint -> flag */
typedef enum eObjectSolver_Flags {
- OBJECTSOLVER_ACTIVECLIP = (1<<0)
+ OBJECTSOLVER_ACTIVECLIP = (1<<0),
} eObjectSolver_Flags;
/* ObjectSolver Constraint -> flag */
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 0cf60a98376..d432209575b 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_curve_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_CURVE_TYPES_H__
@@ -39,21 +31,22 @@
#define MAXTEXTBOX 256 /* used in readfile.c and editfont.c */
+struct AnimData;
struct BoundBox;
-struct Object;
+struct EditFont;
+struct GHash;
struct Ipo;
struct Key;
struct Material;
+struct Object;
struct VFont;
-struct AnimData;
-struct EditFont;
-struct GHash;
/* These two Lines with # tell makesdna this struct can be excluded. */
#
#
typedef struct PathPoint {
- float vec[4]; /* grr, cant get rid of tilt yet */
+ /** Grr, cant get rid of tilt yet. */
+ float vec[4];
float quat[4];
float radius, weight;
} PathPoint;
@@ -71,9 +64,11 @@ typedef struct Path {
#
#
typedef struct BevPoint {
- float vec[3], alfa, radius, weight, offset;
- float sina, cosa; /* 2D Only */
- float dir[3], tan[3], quat[4]; /* 3D Only */
+ float vec[3], tilt, radius, weight, offset;
+ /** 2D Only. */
+ float sina, cosa;
+ /** 3D Only. */
+ float dir[3], tan[3], quat[4];
short split_tag, dupe_tag;
} BevPoint;
@@ -92,9 +87,9 @@ typedef struct BevList {
/**
* Keyframes on F-Curves (allows code reuse of Bezier eval code) and
- * Points on Bezier Curves/Paths are generally BezTriples
+ * Points on Bezier Curves/Paths are generally BezTriples.
*
- * \note alfa location in struct is abused by Key system
+ * \note #BezTriple.tilt location in struct is abused by Key system.
*
* \note vec in BezTriple looks like this:
* - vec[0][0] = x location of handle 1
@@ -109,29 +104,51 @@ typedef struct BevList {
*/
typedef struct BezTriple {
float vec[3][3];
- float alfa, weight, radius; /* alfa: tilt in 3D View, weight: used for softbody goal weight, radius: for bevel tapering */
-
- char ipo; /* ipo: interpolation mode for segment from this BezTriple to the next */
-
- char h1, h2; /* h1, h2: the handle type of the two handles */
- char f1, f2, f3; /* f1, f2, f3: used for selection status */
-
- char hide; /* hide: used to indicate whether BezTriple is hidden (3D), type of keyframe (eBezTriple_KeyframeType) */
-
- char easing; /* easing: easing type for interpolation mode (eBezTriple_Easing) */
- float back; /* BEZT_IPO_BACK */
- float amplitude, period; /* BEZT_IPO_ELASTIC */
-
- char f5; /* f5: used for auto handle to distinguish between normal handle and exception (extrema) */
- char pad[3];
+ /** Tilt in 3D View. */
+ float tilt;
+ /** Used for softbody goal weight. */
+ float weight;
+ /** For bevel tapering & modifiers. */
+ float radius;
+
+ /** Ipo: interpolation mode for segment from this BezTriple to the next. */
+ char ipo;
+
+ /** H1, h2: the handle type of the two handles. */
+ char h1, h2;
+ /** F1, f2, f3: used for selection status. */
+ char f1, f2, f3;
+
+ /** Hide: used to indicate whether BezTriple is hidden (3D),
+ * type of keyframe (eBezTriple_KeyframeType). */
+ char hide;
+
+ /** Easing: easing type for interpolation mode (eBezTriple_Easing). */
+ char easing;
+ /** BEZT_IPO_BACK. */
+ float back;
+ /** BEZT_IPO_ELASTIC. */
+ float amplitude, period;
+
+ /** F5: used for auto handle to distinguish between normal handle and exception (extrema). */
+ char f5;
+ char _pad[3];
} BezTriple;
-/* note; alfa location in struct is abused by Key system */
+/**
+ * \note #BPoint.tilt location in struct is abused by Key system.
+ */
typedef struct BPoint {
float vec[4];
- float alfa, weight; /* alfa: tilt in 3D View, weight: used for softbody goal weight */
- short f1, hide; /* f1: selection status, hide: is point hidden or not */
- float radius, pad; /* user-set radius per point for beveling etc */
+ /** Tilt in 3D View. */
+ float tilt;
+ /** Used for softbody goal weight. */
+ float weight;
+ /** F1: selection status, hide: is point hidden or not. */
+ short f1, hide;
+ /** User-set radius per point for beveling etc. */
+ float radius;
+ char _pad[4];
} BPoint;
/**
@@ -139,13 +156,17 @@ typedef struct BPoint {
* also, it should be NURBS (Nurb isn't the singular of Nurbs).
*/
typedef struct Nurb {
- struct Nurb *next, *prev; /* multiple nurbs per curve object are allowed */
+ /** Multiple nurbs per curve object are allowed. */
+ struct Nurb *next, *prev;
short type;
- short mat_nr; /* index into material list */
+ /** Index into material list. */
+ short mat_nr;
short hide, flag;
- int pntsu, pntsv; /* number of points in the U or V directions */
- short pad[2];
- short resolu, resolv; /* tessellation resolution in the U or V directions */
+ /** Number of points in the U or V directions. */
+ int pntsu, pntsv;
+ char _pad[4];
+ /** Tessellation resolution in the U or V directions. */
+ short resolu, resolv;
short orderu, orderv;
short flagu, flagv;
@@ -153,7 +174,8 @@ typedef struct Nurb {
BPoint *bp;
BezTriple *bezt;
- short tilt_interp; /* KEY_LINEAR, KEY_CARDINAL, KEY_BSPLINE */
+ /** KEY_LINEAR, KEY_CARDINAL, KEY_BSPLINE. */
+ short tilt_interp;
short radius_interp;
/* only used for dynamically generated Nurbs created from OB_FONT's */
@@ -162,10 +184,10 @@ typedef struct Nurb {
typedef struct CharInfo {
short kern;
- short mat_nr; /* index start at 1, unlike mesh & nurbs */
+ /** Index start at 1, unlike mesh & nurbs. */
+ short mat_nr;
char flag;
- char pad;
- short pad2;
+ char _pad[3];
} CharInfo;
typedef struct TextBox {
@@ -182,21 +204,25 @@ typedef struct EditNurb {
/* shape key being edited */
int shapenr;
- char pad[4];
+ char _pad[4];
} EditNurb;
typedef struct Curve {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
struct BoundBox *bb;
- ListBase nurb; /* actual data, called splines in rna */
+ /** Actual data, called splines in rna. */
+ ListBase nurb;
- EditNurb *editnurb; /* edited data, not in file, use pointer so we can check for it */
+ /** Edited data, not in file, use pointer so we can check for it. */
+ EditNurb *editnurb;
struct Object *bevobj, *taperobj, *textoncurve;
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
struct Key *key;
struct Material **mat;
@@ -205,10 +231,13 @@ typedef struct Curve {
float size[3];
float rot[3];
- short type; /* creation-time type of curve datablock */
+ /** Creation-time type of curve datablock. */
+ short type;
- short texflag; /* keep a short because of BKE_object_obdata_texspace_get() */
- short drawflag, twist_mode;
+ /** Keep a short because of BKE_object_obdata_texspace_get(). */
+ short texflag;
+ char _pad0[2];
+ short twist_mode;
float twist_smooth, smallcaps_scale;
int pathlen;
@@ -227,7 +256,7 @@ typedef struct Curve {
char overflow;
char spacemode, align_y;
- char pad[3];
+ char _pad[3];
/* font part */
short lines;
@@ -241,8 +270,10 @@ typedef struct Curve {
int selstart, selend;
/* text data */
- int len_wchar; /* number of characters (strinfo) */
- int len; /* number of bytes (str - utf8) */
+ /** Number of characters (strinfo). */
+ int len_wchar;
+ /** Number of bytes (str - utf8). */
+ int len;
char *str;
struct EditFont *editfont;
@@ -260,13 +291,13 @@ typedef struct Curve {
/* font part end */
- float ctime; /* current evaltime - for use by Objects parented to curves */
+ /** Current evaltime - for use by Objects parented to curves. */
+ float ctime;
float bevfac1, bevfac2;
char bevfac1_mapping, bevfac2_mapping;
- char pad2[2];
+ char _pad2[6];
float fsize_realtime;
- float pad3;
void *batch_cache;
} Curve;
@@ -303,10 +334,14 @@ enum {
CU_FAST = 1 << 9, /* Font: no filling inside editmode */
/* CU_RETOPO = 1 << 10, */ /* DEPRECATED */
CU_DS_EXPAND = 1 << 11,
- CU_PATH_RADIUS = 1 << 12, /* make use of the path radius if this is enabled (default for new curves) */
- CU_DEFORM_FILL = 1 << 13, /* fill 2d curve after deformation */
- CU_FILL_CAPS = 1 << 14, /* fill bevel caps */
- CU_MAP_TAPER = 1 << 15, /* map taper object to beveled area */
+ /** make use of the path radius if this is enabled (default for new curves) */
+ CU_PATH_RADIUS = 1 << 12,
+ /** fill 2d curve after deformation */
+ CU_DEFORM_FILL = 1 << 13,
+ /** fill bevel caps */
+ CU_FILL_CAPS = 1 << 14,
+ /** map taper object to beveled area */
+ CU_MAP_TAPER = 1 << 15,
};
/* Curve.twist_mode */
@@ -411,7 +446,7 @@ typedef enum eBezTriple_Handle {
/* f5 (beztriple) */
typedef enum eBezTriple_Auto_Type {
HD_AUTOTYPE_NORMAL = 0,
- HD_AUTOTYPE_SPECIAL = 1
+ HD_AUTOTYPE_SPECIAL = 1,
} eBezTriple_Auto_Type;
/* interpolation modes (used only for BezTriple->ipo) */
@@ -471,10 +506,13 @@ enum {
CU_CHINFO_BOLD = 1 << 0,
CU_CHINFO_ITALIC = 1 << 1,
CU_CHINFO_UNDERLINE = 1 << 2,
- CU_CHINFO_WRAP = 1 << 3, /* wordwrap occurred here */
+ /** wordwrap occurred here */
+ CU_CHINFO_WRAP = 1 << 3,
CU_CHINFO_SMALLCAPS = 1 << 4,
- CU_CHINFO_SMALLCAPS_CHECK = 1 << 5, /* set at runtime, checks if case switching is needed */
- CU_CHINFO_OVERFLOW = 1 << 6, /* Set at runtime, indicates char that doesn't fit in text boxes. */
+ /** set at runtime, checks if case switching is needed */
+ CU_CHINFO_SMALLCAPS_CHECK = 1 << 5,
+ /** Set at runtime, indicates char that doesn't fit in text boxes. */
+ CU_CHINFO_OVERFLOW = 1 << 6,
};
/* mixed with KEY_LINEAR but define here since only curve supports */
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index 0e0b1d669d9..91412044e0e 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_customdata_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*
* Used for custom mesh data types (stored per vert/edge/loop/face)
*/
@@ -40,37 +32,56 @@ extern "C" {
/** descriptor and storage for a custom data layer */
typedef struct CustomDataLayer {
- int type; /* type of data in layer */
- int offset; /* in editmode, offset of layer in block */
- int flag; /* general purpose flag */
- int active; /* number of the active layer of this type */
- int active_rnd; /* number of the layer to render*/
- int active_clone; /* number of the layer to render*/
- int active_mask; /* number of the layer to render*/
- int uid; /* shape keyblock unique id reference*/
- char name[64]; /* layer name, MAX_CUSTOMDATA_LAYER_NAME */
- void *data; /* layer data */
+ /** Type of data in layer. */
+ int type;
+ /** In editmode, offset of layer in block. */
+ int offset;
+ /** General purpose flag. */
+ int flag;
+ /** Number of the active layer of this type. */
+ int active;
+ /** Number of the layer to rende.r*/
+ int active_rnd;
+ /** Number of the layer to rende.r*/
+ int active_clone;
+ /** Number of the layer to rende.r*/
+ int active_mask;
+ /** Shape keyblock unique id referenc.e*/
+ int uid;
+ /** Layer name, MAX_CUSTOMDATA_LAYER_NAME. */
+ char name[64];
+ /** Layer data. */
+ void *data;
} CustomDataLayer;
#define MAX_CUSTOMDATA_LAYER_NAME 64
typedef struct CustomDataExternal {
- char filename[1024]; /* FILE_MAX */
+ /** FILE_MAX. */
+ char filename[1024];
} CustomDataExternal;
/** structure which stores custom element data associated with mesh elements
* (vertices, edges or faces). The custom data is organized into a series of
* layers, each with a data type (e.g. MTFace, MDeformVert, etc.). */
typedef struct CustomData {
- CustomDataLayer *layers; /* CustomDataLayers, ordered by type */
- int typemap[42]; /* runtime only! - maps types to indices of first layer of that type,
- * MUST be >= CD_NUMTYPES, but we cant use a define here.
- * Correct size is ensured in CustomData_update_typemap assert() */
- int pad_i1;
- int totlayer, maxlayer; /* number of layers, size of layers array */
- int totsize; /* in editmode, total size of all data layers */
- struct BLI_mempool *pool; /* (BMesh Only): Memory pool for allocation of blocks */
- CustomDataExternal *external; /* external file storing customdata layers */
+ /** CustomDataLayers, ordered by type. */
+ CustomDataLayer *layers;
+ /**
+ * runtime only! - maps types to indices of first layer of that type,
+ * MUST be >= CD_NUMTYPES, but we cant use a define here.
+ * Correct size is ensured in CustomData_update_typemap assert().
+ */
+ int typemap[42];
+ char _pad0[4];
+ /** Number of layers, size of layers array. */
+ int totlayer, maxlayer;
+ /** In editmode, total size of all data layers. */
+ int totsize;
+ /** (BMesh Only): Memory pool for allocation of blocks. */
+ struct BLI_mempool *pool;
+ /** External file storing customdata layers. */
+ CustomDataExternal *external;
} CustomData;
/* CustomData.type */
@@ -130,7 +141,7 @@ typedef enum CustomDataType {
CD_TESSLOOPNORMAL = 40,
CD_CUSTOMLOOPNORMAL = 41,
- CD_NUMTYPES = 42
+ CD_NUMTYPES = 42,
} CustomDataType;
/* Bits for CustomDataMask */
@@ -179,6 +190,19 @@ typedef enum CustomDataType {
#define CD_MASK_TESSLOOPNORMAL (1LL << CD_TESSLOOPNORMAL)
#define CD_MASK_CUSTOMLOOPNORMAL (1LL << CD_CUSTOMLOOPNORMAL)
+/** Data types that may be defined for all mesh elements types. */
+#define CD_MASK_GENERIC_DATA (CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR)
+
+
+typedef struct CustomData_MeshMasks {
+ uint64_t vmask;
+ uint64_t emask;
+ uint64_t fmask;
+ uint64_t pmask;
+ uint64_t lmask;
+} CustomData_MeshMasks;
+
+
/* CustomData.flag */
enum {
/* Indicates layer should not be copied by CustomData_from_template or CustomData_copy_data */
diff --git a/source/blender/makesdna/DNA_defs.h b/source/blender/makesdna/DNA_defs.h
index bfa8da02707..958909987f0 100644
--- a/source/blender/makesdna/DNA_defs.h
+++ b/source/blender/makesdna/DNA_defs.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file DNA_defs.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*
* Group generic defines for all DNA headers may use in this file.
*/
diff --git a/source/blender/makesdna/DNA_documentation.h b/source/blender/makesdna/DNA_documentation.h
index 0a0d46d70ff..3f5bbec35bf 100644
--- a/source/blender/makesdna/DNA_documentation.h
+++ b/source/blender/makesdna/DNA_documentation.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/**
- * \page makesdna makesdna
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
+ * \page makesdna makesdna
*
* \section aboutdna About the DNA module
*
@@ -85,7 +77,6 @@
*
* intern/dna_genfile.c
* (ton)
- *
*/
diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h
index 589135e1d58..9f585ac21af 100644
--- a/source/blender/makesdna/DNA_dynamicpaint_types.h
+++ b/source/blender/makesdna/DNA_dynamicpaint_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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 DNA_dynamicpaint_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_DYNAMICPAINT_TYPES_H__
@@ -101,7 +94,8 @@ enum {
typedef struct DynamicPaintSurface {
struct DynamicPaintSurface *next, *prev;
- struct DynamicPaintCanvasSettings *canvas; /* for fast RNA access */
+ /** For fast RNA access. */
+ struct DynamicPaintCanvasSettings *canvas;
struct PaintSurfaceData *data;
struct Collection *brush_group;
@@ -116,18 +110,23 @@ typedef struct DynamicPaintSurface {
char name[64];
short format, type;
short disp_type, image_fileformat;
- short effect_ui; /* ui selection box */
- short preview_id; /* surface output id to preview */
- short init_color_type, pad_s;
+ /** Ui selection box. */
+ short effect_ui;
+ /** Surface output id to preview. */
+ short preview_id;
+ short init_color_type;
+ char _pad0[2];
int flags, effect;
int image_resolution, substeps;
- int start_frame, end_frame, pad;
+ int start_frame, end_frame;
+ char _pad[4];
/* initial color */
float init_color[4];
struct Tex *init_texture;
- char init_layername[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char init_layername[64];
int dry_speed, diss_speed;
float color_dry_threshold;
@@ -141,12 +140,16 @@ typedef struct DynamicPaintSurface {
/* wave settings */
float wave_damping, wave_speed, wave_timescale, wave_spring, wave_smoothness;
- int pad2;
+ char _pad2[4];
- char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
- char image_output_path[1024]; /* 1024 = FILE_MAX */
- char output_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
- char output_name2[64]; /* MAX_CUSTOMDATA_LAYER_NAME */ /* some surfaces have 2 outputs */
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char uvlayer_name[64];
+ /** 1024 = FILE_MAX. */
+ char image_output_path[1024];
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char output_name[64];
+ /** MAX_CUSTOMDATA_LAYER_NAME */ /* some surfaces have 2 outputs. */
+ char output_name2[64];
} DynamicPaintSurface;
@@ -155,41 +158,56 @@ enum {
/* This should not be needed, having a valid WEIGHT_MCOL layer should be enough.
* And if not, should be a general flag. But seems unnecessary for now... */
#if 0
- MOD_DPAINT_PREVIEW_READY = 1 << 0, /* if viewport preview is ready */
+ /** if viewport preview is ready */
+ MOD_DPAINT_PREVIEW_READY = 1 << 0,
#endif
- MOD_DPAINT_BAKING = 1 << 1, /* surface is already baking, so it wont get updated (loop) */
+ /** surface is already baking, so it wont get updated (loop) */
+ MOD_DPAINT_BAKING = 1 << 1,
};
/* Canvas settings */
typedef struct DynamicPaintCanvasSettings {
- struct DynamicPaintModifierData *pmd; /* for fast RNA access */
+ /** For fast RNA access. */
+ struct DynamicPaintModifierData *pmd;
struct Mesh *mesh;
struct ListBase surfaces;
short active_sur, flags;
- int pad;
+ char _pad[4];
- char error[64]; /* Bake error description */
+ /** Bake error description. */
+ char error[64];
} DynamicPaintCanvasSettings;
/* flags */
enum {
- MOD_DPAINT_PART_RAD = 1 << 0, /* use particle radius */
+ /** use particle radius */
+ MOD_DPAINT_PART_RAD = 1 << 0,
//MOD_DPAINT_USE_MATERIAL = 1 << 1, /* DNA_DEPRECATED */
- MOD_DPAINT_ABS_ALPHA = 1 << 2, /* don't increase alpha unless paint alpha is higher than existing */
- MOD_DPAINT_ERASE = 1 << 3, /* removes paint */
-
- MOD_DPAINT_RAMP_ALPHA = 1 << 4, /* only read falloff ramp alpha */
- MOD_DPAINT_PROX_PROJECT = 1 << 5, /* do proximity check only in defined dir */
- MOD_DPAINT_INVERSE_PROX = 1 << 6, /* inverse proximity painting */
- MOD_DPAINT_NEGATE_VOLUME = 1 << 7, /* negates volume influence on "volume + prox" mode */
-
- MOD_DPAINT_DO_SMUDGE = 1 << 8, /* brush smudges existing paint */
- MOD_DPAINT_VELOCITY_ALPHA = 1 << 9, /* multiply brush influence by velocity */
- MOD_DPAINT_VELOCITY_COLOR = 1 << 10, /* replace brush color by velocity color ramp */
- MOD_DPAINT_VELOCITY_DEPTH = 1 << 11, /* multiply brush intersection depth by velocity */
+ /** don't increase alpha unless paint alpha is higher than existing */
+ MOD_DPAINT_ABS_ALPHA = 1 << 2,
+ /** removes paint */
+ MOD_DPAINT_ERASE = 1 << 3,
+
+ /** only read falloff ramp alpha */
+ MOD_DPAINT_RAMP_ALPHA = 1 << 4,
+ /** do proximity check only in defined dir */
+ MOD_DPAINT_PROX_PROJECT = 1 << 5,
+ /** inverse proximity painting */
+ MOD_DPAINT_INVERSE_PROX = 1 << 6,
+ /** negates volume influence on "volume + prox" mode */
+ MOD_DPAINT_NEGATE_VOLUME = 1 << 7,
+
+ /** brush smudges existing paint */
+ MOD_DPAINT_DO_SMUDGE = 1 << 8,
+ /** multiply brush influence by velocity */
+ MOD_DPAINT_VELOCITY_ALPHA = 1 << 9,
+ /** replace brush color by velocity color ramp */
+ MOD_DPAINT_VELOCITY_COLOR = 1 << 10,
+ /** multiply brush intersection depth by velocity */
+ MOD_DPAINT_VELOCITY_DEPTH = 1 << 11,
MOD_DPAINT_USES_VELOCITY = (MOD_DPAINT_DO_SMUDGE | MOD_DPAINT_VELOCITY_ALPHA |
MOD_DPAINT_VELOCITY_COLOR | MOD_DPAINT_VELOCITY_DEPTH),
@@ -228,7 +246,8 @@ enum {
/* Brush settings */
typedef struct DynamicPaintBrushSettings {
- struct DynamicPaintModifierData *pmd; /* for fast RNA access */
+ /** For fast RNA access. */
+ struct DynamicPaintModifierData *pmd;
struct Mesh *mesh;
struct ParticleSystem *psys;
@@ -242,13 +261,15 @@ typedef struct DynamicPaintBrushSettings {
float paint_distance;
/* color ramps */
- struct ColorBand *paint_ramp; /* Proximity paint falloff */
- struct ColorBand *vel_ramp; /* Velocity paint ramp */
+ /** Proximity paint falloff. */
+ struct ColorBand *paint_ramp;
+ /** Velocity paint ramp. */
+ struct ColorBand *vel_ramp;
short proximity_falloff;
short wave_type;
short ray_dir;
- short pad;
+ char _pad[2];
float wave_factor, wave_clamp;
float max_velocity, smudge_strength;
diff --git a/source/blender/makesdna/DNA_effect_types.h b/source/blender/makesdna/DNA_effect_types.h
index 373b1584c77..e9260f54237 100644
--- a/source/blender/makesdna/DNA_effect_types.h
+++ b/source/blender/makesdna/DNA_effect_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_effect_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_EFFECT_TYPES_H__
@@ -110,7 +102,8 @@ typedef struct PartEff {
float force[3];
float damp;
- float nabla, vectsize, maxlen, pad, defvec[3];
+ float nabla, vectsize, maxlen, defvec[3];
+ char _pad[4];
float mult[4], life[4];
short child[4], mat[4];
@@ -118,8 +111,10 @@ typedef struct PartEff {
short staticstep, omat, timetex, speedtex, flag2, flag2neg;
short disp, vertgroup_v;
- char vgroupname[64], vgroupname_v[64]; /* MAX_VGROUP_NAME */
- float imat[4][4]; /* inverse matrix of parent Object */
+ /** MAX_VGROUP_NAME. */
+ char vgroupname[64], vgroupname_v[64];
+ /** Inverse matrix of parent Object. */
+ float imat[4][4];
Particle *keys;
struct Collection *group;
diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h
index 24fb1c86627..6daa0f5aeb3 100644
--- a/source/blender/makesdna/DNA_fileglobal_types.h
+++ b/source/blender/makesdna/DNA_fileglobal_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_fileglobal_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_FILEGLOBAL_TYPES_H__
@@ -37,21 +29,25 @@
* the moment of saving, and the file-specific settings.
*/
typedef struct FileGlobal {
- char subvstr[4]; /* needs to be here, for human fileformat recognition */
+ /** Needs to be here, for human fileformat recognition (keep first!). */
+ char subvstr[4];
+
short subversion;
short minversion, minsubversion;
- char pad[6];
+ char _pad[6];
struct bScreen *curscreen;
struct Scene *curscene;
struct ViewLayer *cur_view_layer;
- void *pad1;
+ void *_pad1;
int fileflags;
int globalf;
- uint64_t build_commit_timestamp; /* commit timestamp from buildinfo */
- char build_hash[16]; /* hash from buildinfo */
- /* file path where this was saved, for recover */
- char filename[1024]; /* 1024 = FILE_MAX */
+ /** Commit timestamp from buildinfo. */
+ uint64_t build_commit_timestamp;
+ /** Hash from buildinfo. */
+ char build_hash[16];
+ /** File path where this was saved, for recover (1024 = FILE_MAX). */
+ char filename[1024];
} FileGlobal;
diff --git a/source/blender/makesdna/DNA_freestyle_types.h b/source/blender/makesdna/DNA_freestyle_types.h
index 36cf151b76e..731bc590117 100644
--- a/source/blender/makesdna/DNA_freestyle_types.h
+++ b/source/blender/makesdna/DNA_freestyle_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __DNA_FREESTYLE_TYPES_H__
#define __DNA_FREESTYLE_TYPES_H__
-/** \file DNA_freestyle_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#include "DNA_defs.h"
@@ -39,8 +31,8 @@
extern "C" {
#endif
-struct FreestyleLineStyle;
struct Collection;
+struct FreestyleLineStyle;
struct Text;
/* FreestyleConfig::flags */
@@ -116,16 +108,21 @@ enum {
typedef struct FreestyleLineSet {
struct FreestyleLineSet *next, *prev;
- char name[64]; /* line set name, MAX_NAME */
+ /** Line set name, MAX_NAME. */
+ char name[64];
int flags;
- int selection; /* selection criteria */
- short qi; /* quantitative invisibility */
- short pad1;
+ /** Selection criteria. */
+ int selection;
+ /** Quantitative invisibility. */
+ short qi;
+ char _pad1[2];
int qi_start, qi_end;
- int edge_types, exclude_edge_types; /* feature edge types */
- int pad2;
- struct Collection *group; /* group of target objects */
+ /** Feature edge types. */
+ int edge_types, exclude_edge_types;
+ char _pad2[4];
+ /** Group of target objects. */
+ struct Collection *group;
struct FreestyleLineStyle *linestyle;
} FreestyleLineSet;
@@ -135,18 +132,21 @@ typedef struct FreestyleModuleConfig {
struct Text *script;
short is_displayed;
- short pad[3];
+ char _pad[6];
} FreestyleModuleConfig;
typedef struct FreestyleConfig {
ListBase modules;
- int mode; /* scripting, editor */
+ /** Scripting, editor. */
+ int mode;
int raycasting_algorithm DNA_DEPRECATED;
- int flags; /* suggestive contours, ridges/valleys, material boundaries */
+ /** Suggestive contours, ridges/valleys, material boundaries. */
+ int flags;
float sphere_radius;
float dkr_epsilon;
- float crease_angle; /* in radians! */
+ /** In radians!. */
+ float crease_angle;
ListBase linesets;
} FreestyleConfig;
diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index 9e9ab974b01..d9fc14d9393 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,28 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_genfile.h
- * \ingroup DNA
- * \brief blenloader genfile private function prototypes
+/** \file
+ * \ingroup DNA
+ * \brief blenloader genfile private function prototypes
*/
#ifndef __DNA_GENFILE_H__
#define __DNA_GENFILE_H__
+#include "intern/dna_utils.h"
+
struct SDNA;
-/* DNAstr contains the prebuilt SDNA structure defining the layouts of the types
+/**
+ * DNAstr contains the prebuilt SDNA structure defining the layouts of the types
* used by this version of Blender. It is defined in a file dna.c, which is
- * generated by the makesdna program during the build process (see makesdna.c). */
+ * generated by the makesdna program during the build process (see makesdna.c).
+ */
extern const unsigned char DNAstr[];
-extern const int DNAlen; /* length of DNAstr */
+/** Length of DNAstr. */
+extern const int DNAlen;
/**
* Primitive (non-struct, non-pointer/function/array) types,
@@ -62,23 +59,26 @@ typedef enum eSDNA_Type {
/* define so switch statements don't complain */
#define SDNA_TYPE_VOID 9
SDNA_TYPE_INT64 = 10,
- SDNA_TYPE_UINT64 = 11
+ SDNA_TYPE_UINT64 = 11,
} eSDNA_Type;
/**
* For use with #DNA_struct_reconstruct & #DNA_struct_get_compareflags
*/
enum eSDNA_StructCompare {
- /* Struct has disappeared (values of this struct type will not be loaded by the current Blender) */
+ /* Struct has disappeared
+ * (values of this struct type will not be loaded by the current Blender) */
SDNA_CMP_REMOVED = 0,
- /* Struct is the same (can be loaded with straight memory copy after any necessary endian conversion) */
+ /* Struct is the same
+ * (can be loaded with straight memory copy after any necessary endian conversion) */
SDNA_CMP_EQUAL = 1,
- /* Struct is different in some way (needs to be copied/converted field by field) */
+ /* Struct is different in some way
+ * (needs to be copied/converted field by field) */
SDNA_CMP_NOT_EQUAL = 2,
};
struct SDNA *DNA_sdna_from_data(
- const void *data, const int datalen,
+ const void *data, const int data_len,
bool do_endian_swap, bool data_alloc,
const char **r_error_message);
void DNA_sdna_free(struct SDNA *sdna);
@@ -97,7 +97,6 @@ void *DNA_struct_reconstruct(
const struct SDNA *newsdna, const struct SDNA *oldsdna,
const char *compflags, int oldSDNAnr, int blocks, const void *data);
-int DNA_elem_array_size(const char *str);
int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, const char *name);
bool DNA_struct_find(const struct SDNA *sdna, const char *stype);
@@ -106,4 +105,11 @@ bool DNA_struct_elem_find(const struct SDNA *sdna, const char *stype, const char
int DNA_elem_type_size(const eSDNA_Type elem_nr);
+bool DNA_sdna_patch_struct(
+ struct SDNA *sdna, const char *struct_name_old, const char *struct_name_new);
+bool DNA_sdna_patch_struct_member(
+ struct SDNA *sdna, const char *struct_name, const char *elem_old, const char *elem_new);
+
+void DNA_sdna_alias_data_ensure(struct SDNA *sdna);
+
#endif /* __DNA_GENFILE_H__ */
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 79ff1568a60..9e930ddec57 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_gpencil_modifier_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_GPENCIL_MODIFIER_TYPES_H__
@@ -74,24 +70,35 @@ typedef struct GpencilModifierData {
int stackindex;
short flag;
short _pad;
- char name[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64];
char *error;
} GpencilModifierData;
typedef struct NoiseGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* layer name */
- char vgname[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- int pass_index; /* custom index for passes */
- int flag; /* several flags */
- float factor; /* factor of noise */
- int step; /* how many frames before recalculate randoms */
- int gp_frame; /* last gp frame used */
- int scene_frame; /* last scene frame used */
- float vrand1, vrand2; /* random values */
+ /** Layer name. */
+ char layername[64];
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgname[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Several flags. */
+ int flag;
+ /** Factor of noise. */
+ float factor;
+ /** How many frames before recalculate randoms. */
+ int step;
+ /** Last gp frame used. */
+ int gp_frame;
+ /** Last scene frame used. */
+ int scene_frame;
+ /** Random values. */
+ float vrand1, vrand2;
struct RNG *rng;
- int layer_pass; /* custom index for passes */
+ /** Custom index for passes. */
+ int layer_pass;
char _pad[4];
} NoiseGpencilModifierData;
@@ -111,11 +118,16 @@ typedef enum eNoiseGpencil_Flag {
typedef struct SubdivGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* layer name */
- int pass_index; /* custom index for passes */
- int flag; /* flags */
- int level; /* factor of subdivision */
- int layer_pass; /* custom index for passes */
+ /** Layer name. */
+ char layername[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
+ /** Factor of subdivision. */
+ int level;
+ /** Custom index for passes. */
+ int layer_pass;
} SubdivGpencilModifierData;
typedef enum eSubdivGpencil_Flag {
@@ -127,12 +139,18 @@ typedef enum eSubdivGpencil_Flag {
typedef struct ThickGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* layer name */
- char vgname[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- int pass_index; /* custom index for passes */
- int flag; /* flags */
- int thickness; /* Thickness change */
- int layer_pass; /* custom index for passes */
+ /** Layer name. */
+ char layername[64];
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgname[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
+ /** Thickness change. */
+ int thickness;
+ /** Custom index for passes. */
+ int layer_pass;
struct CurveMapping *curve_thickness;
} ThickGpencilModifierData;
@@ -147,13 +165,18 @@ typedef enum eThickGpencil_Flag {
typedef struct TimeGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* layer name */
- int layer_pass; /* custom index for passes */
- int flag; /* flags */
+ /** Layer name. */
+ char layername[64];
+ /** Custom index for passes. */
+ int layer_pass;
+ /** Flags. */
+ int flag;
int offset;
- float frame_scale; /* animation scale */
+ /** Animation scale. */
+ float frame_scale;
int mode;
- int sfra, efra; /* start and end frame for custom range */
+ /** Start and end frame for custom range. */
+ int sfra, efra;
char _pad[4];
} TimeGpencilModifierData;
@@ -167,26 +190,33 @@ typedef enum eTimeGpencil_Flag {
typedef enum eTimeGpencil_Mode {
GP_TIME_MODE_NORMAL = 0,
GP_TIME_MODE_REVERSE = 1,
- GP_TIME_MODE_FIX = 2
+ GP_TIME_MODE_FIX = 2,
} eTimeGpencil_Mode;
typedef enum eModifyColorGpencil_Flag {
GP_MODIFY_COLOR_BOTH = 0,
GP_MODIFY_COLOR_STROKE = 1,
- GP_MODIFY_COLOR_FILL = 2
+ GP_MODIFY_COLOR_FILL = 2,
} eModifyColorGpencil_Flag;
typedef struct TintGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* layer name */
- int pass_index; /* custom index for passes */
- int flag; /* flags */
- float rgb[3]; /* Tint color */
- float factor; /* Mix factor */
- char modify_color; /* modify stroke, fill or both */
+ /** Layer name. */
+ char layername[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
+ /** Tint color. */
+ float rgb[3];
+ /** Mix factor. */
+ float factor;
+ /** Modify stroke, fill or both. */
+ char modify_color;
char _pad[7];
- int layer_pass; /* custom index for passes */
+ /** Custom index for passes. */
+ int layer_pass;
char _pad1[4];
} TintGpencilModifierData;
@@ -199,13 +229,19 @@ typedef enum eTintGpencil_Flag {
typedef struct ColorGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* layer name */
- int pass_index; /* custom index for passes */
- int flag; /* flags */
- float hsv[3]; /* hsv factors */
- char modify_color; /* modify stroke, fill or both */
+ /** Layer name. */
+ char layername[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
+ /** Hsv factors. */
+ float hsv[3];
+ /** Modify stroke, fill or both. */
+ char modify_color;
char _pad[3];
- int layer_pass; /* custom index for passes */
+ /** Custom index for passes. */
+ int layer_pass;
char _pad1[4];
} ColorGpencilModifierData;
@@ -218,14 +254,21 @@ typedef enum eColorGpencil_Flag {
typedef struct OpacityGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* layer name */
- char vgname[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- int pass_index; /* custom index for passes */
- int flag; /* flags */
- float factor; /* Main Opacity factor */
- char modify_color; /* modify stroke, fill or both */
+ /** Layer name. */
+ char layername[64];
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgname[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
+ /** Main Opacity factor. */
+ float factor;
+ /** Modify stroke, fill or both. */
+ char modify_color;
char _pad[3];
- int layer_pass; /* custom index for passes */
+ /** Custom index for passes. */
+ int layer_pass;
char _pad1[4];
} OpacityGpencilModifierData;
@@ -240,21 +283,34 @@ typedef enum eOpacityGpencil_Flag {
typedef struct ArrayGpencilModifierData {
GpencilModifierData modifier;
struct Object *object;
- int count; /* number of elements in array */
- int flag; /* several flags */
- float offset[3]; /* Location increments */
- float shift[3]; /* shift increment */
- float rnd_size; /* random size factor */
- float rnd_rot; /* random size factor */
- float rot[3]; /* Rotation changes */
- float scale[3]; /* Scale changes */
- float rnd[20]; /* (first element is the index) random values */
+ /** Number of elements in array. */
+ int count;
+ /** Several flags. */
+ int flag;
+ /** Location increments. */
+ float offset[3];
+ /** Shift increment. */
+ float shift[3];
+ /** Random size factor. */
+ float rnd_size;
+ /** Random size factor. */
+ float rnd_rot;
+ /** Rotation changes. */
+ float rot[3];
+ /** Scale changes. */
+ float scale[3];
+ /** (first element is the index) random values. */
+ float rnd[20];
char _pad[4];
- int pass_index; /* custom index for passes */
- char layername[64]; /* layer name */
- int mat_rpl; /* material replace (0 keep default) */
- int layer_pass; /* custom index for passes */
+ /** Custom index for passes. */
+ int pass_index;
+ /** Layer name. */
+ char layername[64];
+ /** Material replace (0 keep default). */
+ int mat_rpl;
+ /** Custom index for passes. */
+ int layer_pass;
} ArrayGpencilModifierData;
typedef enum eArrayGpencil_Flag {
@@ -269,23 +325,38 @@ typedef enum eArrayGpencil_Flag {
typedef struct BuildGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* if set, restrict modifier to operating on this layer */
+ /** If set, restrict modifier to operating on this layer. */
+ char layername[64];
int pass_index;
- int layer_pass; /* custom index for passes */
+ /** Custom index for passes. */
+ int layer_pass;
- float start_frame; /* If GP_BUILD_RESTRICT_TIME is set, the defines the frame range where GP frames are considered */
+ /**
+ * If GP_BUILD_RESTRICT_TIME is set,
+ * the defines the frame range where GP frames are considered.
+ */
+ float start_frame;
float end_frame;
- float start_delay; /* For each pair of gp keys, number of frames before strokes start appearing */
- float length; /* For each pair of gp keys, number of frames that build effect must be completed within */
+ /** For each pair of gp keys, number of frames before strokes start appearing. */
+ float start_delay;
+ /** For each pair of gp keys, number of frames that build effect must be completed within. */
+ float length;
- short flag; /* (eGpencilBuild_Flag) Options for controlling modifier behavior */
+ /** (eGpencilBuild_Flag) Options for controlling modifier behavior. */
+ short flag;
- short mode; /* (eGpencilBuild_Mode) How are strokes ordered */
- short transition; /* (eGpencilBuild_Transition) In what order do stroke points appear/disappear */
+ /** (eGpencilBuild_Mode) How are strokes ordered. */
+ short mode;
+ /** (eGpencilBuild_Transition) In what order do stroke points appear/disappear. */
+ short transition;
- short time_alignment; /* (eGpencilBuild_TimeAlignment) For the "Concurrent" mode, when should "shorter" strips start/end */
+ /**
+ * (eGpencilBuild_TimeAlignment)
+ * For the "Concurrent" mode, when should "shorter" strips start/end.
+ */
+ short time_alignment;
} BuildGpencilModifierData;
typedef enum eBuildGpencil_Mode {
@@ -326,13 +397,19 @@ typedef enum eBuildGpencil_Flag {
typedef struct LatticeGpencilModifierData {
GpencilModifierData modifier;
struct Object *object;
- char layername[64]; /* layer name */
- char vgname[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- int pass_index; /* custom index for passes */
- int flag; /* flags */
+ /** Layer name. */
+ char layername[64];
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgname[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
float strength;
- int layer_pass; /* custom index for passes */
- void *cache_data; /* runtime only (LatticeDeformData) */
+ /** Custom index for passes. */
+ int layer_pass;
+ /** Runtime only (LatticeDeformData). */
+ void *cache_data;
} LatticeGpencilModifierData;
typedef enum eLatticeGpencil_Flag {
@@ -345,10 +422,14 @@ typedef enum eLatticeGpencil_Flag {
typedef struct MirrorGpencilModifierData {
GpencilModifierData modifier;
struct Object *object;
- char layername[64]; /* layer name */
- int pass_index; /* custom index for passes */
- int flag; /* flags */
- int layer_pass; /* custom index for passes */
+ /** Layer name. */
+ char layername[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
+ /** Custom index for passes. */
+ int layer_pass;
char _pad[4];
} MirrorGpencilModifierData;
@@ -366,19 +447,28 @@ typedef struct HookGpencilModifierData {
GpencilModifierData modifier;
struct Object *object;
- char subtarget[64]; /* optional name of bone target, MAX_ID_NAME-2 */
- char layername[64]; /* layer name */
- char vgname[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- int pass_index; /* custom index for passes */
- int layer_pass; /* custom index for passes */
+ /** Optional name of bone target, MAX_ID_NAME-2. */
+ char subtarget[64];
+ /** Layer name. */
+ char layername[64];
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgname[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Custom index for passes. */
+ int layer_pass;
char _pad[4];
int flag;
- char falloff_type; /* use enums from WarpGpencilModifier (exact same functionality) */
+ /** Use enums from WarpGpencilModifier (exact same functionality). */
+ char falloff_type;
char _pad1[3];
- float parentinv[4][4]; /* matrix making current transform unmodified */
- float cent[3]; /* visualization of hook */
- float falloff; /* if not zero, falloff is distance where influence zero */
+ /** Matrix making current transform unmodified. */
+ float parentinv[4][4];
+ /** Visualization of hook. */
+ float cent[3];
+ /** If not zero, falloff is distance where influence zero. */
+ float falloff;
float force;
struct CurveMapping *curfalloff;
} HookGpencilModifierData;
@@ -405,13 +495,20 @@ typedef enum eHookGpencil_Falloff {
typedef struct SimplifyGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* layer name */
- int pass_index; /* custom index for passes */
- int flag; /* flags */
- float factor; /* factor of simplify */
- short mode; /* type of simplify */
- short step; /* every n vertex to keep */
- int layer_pass; /* custom index for passes */
+ /** Layer name. */
+ char layername[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
+ /** Factor of simplify. */
+ float factor;
+ /** Type of simplify. */
+ short mode;
+ /** Every n vertex to keep. */
+ short step;
+ /** Custom index for passes. */
+ int layer_pass;
char _pad[4];
} SimplifyGpencilModifierData;
@@ -430,14 +527,19 @@ typedef enum eSimplifyGpencil_Mode {
typedef struct OffsetGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* layer name */
- char vgname[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- int pass_index; /* custom index for passes */
- int flag; /* flags */
+ /** Layer name. */
+ char layername[64];
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgname[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
float loc[3];
float rot[3];
float scale[3];
- int layer_pass; /* custom index for passes */
+ /** Custom index for passes. */
+ int layer_pass;
} OffsetGpencilModifierData;
typedef enum eOffsetGpencil_Flag {
@@ -449,13 +551,20 @@ typedef enum eOffsetGpencil_Flag {
typedef struct SmoothGpencilModifierData {
GpencilModifierData modifier;
- char layername[64]; /* layer name */
- char vgname[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- int pass_index; /* custom index for passes */
- int flag; /* several flags */
- float factor; /* factor of noise */
- int step; /* how many times apply smooth */
- int layer_pass; /* custom index for passes */
+ /** Layer name. */
+ char layername[64];
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgname[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Several flags. */
+ int flag;
+ /** Factor of noise. */
+ float factor;
+ /** How many times apply smooth. */
+ int step;
+ /** Custom index for passes. */
+ int layer_pass;
char _pad[4];
} SmoothGpencilModifierData;
@@ -472,11 +581,14 @@ typedef enum eSmoothGpencil_Flag {
typedef struct ArmatureGpencilModifierData {
GpencilModifierData modifier;
- short deformflag, multi; /* deformflag replaces armature->deformflag */
+ /** Deformflag replaces armature->deformflag. */
+ short deformflag, multi;
int _pad;
struct Object *object;
- float *prevCos; /* stored input of previous modifier, for vertexgroup blending */
- char vgname[64]; /* MAX_VGROUP_NAME */
+ /** Stored input of previous modifier, for vertexgroup blending. */
+ float *prevCos;
+ /** MAX_VGROUP_NAME. */
+ char vgname[64];
} ArmatureGpencilModifierData;
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index b841aba18de..bd17d4e57dc 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2008, Blender Foundation.
* This is a new part of Blender
- *
- * Contributor(s): Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_gpencil_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_GPENCIL_TYPES_H__
@@ -40,7 +34,6 @@ struct CurveMapping;
struct GHash;
struct MDeformVert;
-#define GP_OBGPENCIL_DEFAULT_SIZE 0.2f
#define GP_DEFAULT_PIX_FACTOR 1.0f
#define GP_DEFAULT_GRID_LINES 4
#define GP_MAX_INPUT_SAMPLES 10
@@ -50,9 +43,12 @@ struct MDeformVert;
/* 'Control Point' data for primitives and curves */
typedef struct bGPDcontrolpoint {
- float x, y, z; /* x and y coordinates of control point */
- float color[4]; /* point color */
- int size; /* radius */
+ /** X and y coordinates of control point. */
+ float x, y, z;
+ /** Point color. */
+ float color[4];
+ /** Radius. */
+ int size;
} bGPDcontrolpoint;
/* Grease-Pencil Annotations - 'Stroke Point'
@@ -61,14 +57,21 @@ typedef struct bGPDcontrolpoint {
* This assumes that the bottom-left corner is (0,0)
*/
typedef struct bGPDspoint {
- float x, y, z; /* co-ordinates of point (usually 2d, but can be 3d as well) */
- float pressure; /* pressure of input device (from 0 to 1) at this point */
- float strength; /* color strength (used for alpha factor) */
- float time; /* seconds since start of stroke */
- int flag; /* additional options */
-
- float uv_fac; /* factor of uv along the stroke */
- float uv_rot; /* uv rotation for dot mode */
+ /** Co-ordinates of point (usually 2d, but can be 3d as well). */
+ float x, y, z;
+ /** Pressure of input device (from 0 to 1) at this point. */
+ float pressure;
+ /** Color strength (used for alpha factor). */
+ float strength;
+ /** Seconds since start of stroke. */
+ float time;
+ /** Additional options. */
+ int flag;
+
+ /** Factor of uv along the stroke. */
+ float uv_fac;
+ /** Uv rotation for dot mode. */
+ float uv_rot;
} bGPDspoint;
/* bGPDspoint->flag */
@@ -104,11 +107,15 @@ typedef struct bGPDtriangle {
/* color of palettes */
typedef struct bGPDpalettecolor {
struct bGPDpalettecolor *next, *prev;
- char info[64]; /* Color name. Must be unique. */
+ /** Color name. Must be unique. */
+ char info[64];
float color[4];
- float fill[4]; /* color that should be used for drawing "fills" for strokes */
- short flag; /* settings for palette color */
- char _pad[6]; /* padding for compiler alignment error */
+ /** Color that should be used for drawing "fills" for strokes. */
+ float fill[4];
+ /** Settings for palette color. */
+ short flag;
+ /** Padding for compiler alignment error. */
+ char _pad[6];
} bGPDpalettecolor;
/* bGPDpalettecolor->flag */
@@ -122,25 +129,26 @@ typedef enum eGPDpalettecolor_Flag {
/* do onion skinning */
PC_COLOR_ONIONSKIN = (1 << 3),
/* "volumetric" strokes */
- PC_COLOR_VOLUMETRIC = (1 << 4)
+ PC_COLOR_VOLUMETRIC = (1 << 4),
} eGPDpalettecolor_Flag;
/* palette of colors */
typedef struct bGPDpalette {
struct bGPDpalette *next, *prev;
- /* pointer to individual colours */
+ /** Pointer to individual colours. */
ListBase colors;
- char info[64]; /* Palette name. Must be unique. */
+ /** Palette name. Must be unique. */
+ char info[64];
short flag;
- char _pad[6]; /* padding for compiler alignment error */
+ char _pad[6];
} bGPDpalette;
/* bGPDpalette->flag */
typedef enum eGPDpalette_Flag {
/* palette is active */
- PL_PALETTE_ACTIVE = (1 << 0)
+A, PL_PALETTE_ACTIVE = (1 << 0)
} eGPDpalette_Flag;
/* ***************************************** */
@@ -155,7 +163,8 @@ typedef struct bGPDstroke_Runtime {
/* temporary layer name only used during copy/paste to put the stroke in the original layer */
char tmp_layerinfo[128];
- float multi_frame_falloff; /* runtime falloff factor (only for transform) */
+ /** Runtime falloff factor (only for transform). */
+ float multi_frame_falloff;
} bGPDstroke_Runtime;
/* Grease-Pencil Annotations - 'Stroke'
@@ -165,22 +174,33 @@ typedef struct bGPDstroke_Runtime {
typedef struct bGPDstroke {
struct bGPDstroke *next, *prev;
- bGPDspoint *points; /* array of data-points for stroke */
- bGPDtriangle *triangles;/* tessellated triangles for GP Fill */
- int totpoints; /* number of data-points in array */
- int tot_triangles; /* number of triangles in array */
+ /** Array of data-points for stroke. */
+ bGPDspoint *points;
+ /** Tessellated triangles for GP Fill. */
+ bGPDtriangle *triangles;
+ /** Number of data-points in array. */
+ int totpoints;
+ /** Number of triangles in array. */
+ int tot_triangles;
- short thickness; /* thickness of stroke */
- short flag, _pad[2]; /* various settings about this stroke */
+ /** Thickness of stroke. */
+ short thickness;
+ /** Various settings about this stroke. */
+ short flag, _pad[2];
- double inittime; /* Init time of stroke */
+ /** Init time of stroke. */
+ double inittime;
- char colorname[128] DNA_DEPRECATED; /* color name */
+ /** Color name. */
+ char colorname[128] DNA_DEPRECATED;
- int mat_nr; /* material index */
- char _pad1[4];
+ /** Material index. */
+ int mat_nr;
+ /** Caps mode for each stroke extreme */
+ short caps[2];
- struct MDeformVert *dvert; /* vertex weight data */
+ /** Vertex weight data. */
+ struct MDeformVert *dvert;
bGPDstroke_Runtime runtime;
char _pad2[4];
@@ -196,22 +216,34 @@ typedef enum eGPDstroke_Flag {
GP_STROKE_2DIMAGE = (1 << 2),
/* stroke is selected */
GP_STROKE_SELECT = (1 << 3),
- /* Recalculate geometry data (triangulation, UVs, Bound Box,... (when true, force a new recalc) */
+ /* Recalculate geometry data (triangulation, UVs, Bound Box,...
+ * (when true, force a new recalc) */
GP_STROKE_RECALC_GEOMETRY = (1 << 4),
/* Flag used to indicate that stroke is closed and draw edge between last and first point */
GP_STROKE_CYCLIC = (1 << 7),
- /* Flag used to indicate that stroke is used for fill close and must use fill color for stroke and no fill area */
+ /* Flag used to indicate that stroke is used for fill close and must use
+ * fill color for stroke and no fill area */
GP_STROKE_NOFILL = (1 << 8),
/* only for use with stroke-buffer (while drawing eraser) */
- GP_STROKE_ERASER = (1 << 15)
+ GP_STROKE_ERASER = (1 << 15),
} eGPDstroke_Flag;
+/* bGPDstroke->caps */
+typedef enum eGPDstroke_Caps {
+ /* type of extreme */
+ GP_STROKE_CAP_ROUND = 0,
+ GP_STROKE_CAP_FLAT = 1,
+
+ GP_STROKE_CAP_MAX
+} GPDstroke_Caps;
+
/* ***************************************** */
/* GP Frame */
/* Runtime temp data for bGPDframe */
typedef struct bGPDframe_Runtime {
- float viewmatrix[4][4]; /* parent matrix for drawing */
+ /** Parent matrix for drawing. */
+ float viewmatrix[4][4];
} bGPDframe_Runtime;
/* Grease-Pencil Annotations - 'Frame'
@@ -220,12 +252,16 @@ typedef struct bGPDframe_Runtime {
typedef struct bGPDframe {
struct bGPDframe *next, *prev;
- ListBase strokes; /* list of the simplified 'strokes' that make up the frame's data */
+ /** List of the simplified 'strokes' that make up the frame's data. */
+ ListBase strokes;
- int framenum; /* frame number of this frame */
+ /** Frame number of this frame. */
+ int framenum;
- short flag; /* temp settings */
- short key_type; /* keyframe type (eBezTriple_KeyframeType) */
+ /** Temp settings. */
+ short flag;
+ /** Keyframe type (eBezTriple_KeyframeType). */
+ short key_type;
bGPDframe_Runtime runtime;
} bGPDframe;
@@ -235,7 +271,7 @@ typedef enum eGPDframe_Flag {
/* frame is being painted on */
GP_FRAME_PAINT = (1 << 0),
/* for editing in Action Editor */
- GP_FRAME_SELECT = (1 << 1)
+ GP_FRAME_SELECT = (1 << 1),
} eGPDframe_Flag;
/* ***************************************** */
@@ -243,7 +279,8 @@ typedef enum eGPDframe_Flag {
/* Runtime temp data for bGPDlayer */
typedef struct bGPDlayer_Runtime {
- int icon_id; /* id for dynamic icon used to show annotation color preview for layer */
+ /** Id for dynamic icon used to show annotation color preview for layer. */
+ int icon_id;
char _pad[4];
} bGPDlayer_Runtime;
@@ -251,40 +288,68 @@ typedef struct bGPDlayer_Runtime {
typedef struct bGPDlayer {
struct bGPDlayer *next, *prev;
- ListBase frames; /* list of annotations to display for frames (bGPDframe list) */
- bGPDframe *actframe; /* active frame (should be the frame that is currently being displayed) */
-
- short flag; /* settings for layer */
- short onion_flag; /* Per-layer onion-skinning flags (eGPDlayer_OnionFlag) */
-
- float color[4]; /* Color for strokes in layers. Used for annotations, and for ruler (which uses GPencil internally) */
- float fill[4]; /* Fill color for strokes in layers. Not used anymore (was only for) */
+ /** List of annotations to display for frames (bGPDframe list). */
+ ListBase frames;
+ /** Active frame (should be the frame that is currently being displayed). */
+ bGPDframe *actframe;
- char info[128]; /* name/reference info for this layer (i.e. "director's comments, 12/3")
- * needs to be kept unique, as it's used as the layer identifier */
-
- short thickness; /* thickness to apply to strokes (Annotations) */
- short pass_index; /* used to filter groups of layers in modifiers */
+ /** Settings for layer. */
+ short flag;
+ /** Per-layer onion-skinning flags (eGPDlayer_OnionFlag). */
+ short onion_flag;
- struct Object *parent; /* parent object */
- float inverse[4][4]; /* inverse matrix (only used if parented) */
- char parsubstr[64]; /* String describing subobject info, MAX_ID_NAME-2 */
+ /** Color for strokes in layers. Used for annotations, and for ruler
+ * (which uses GPencil internally). */
+ float color[4];
+ /** Fill color for strokes in layers. Not used anymore (was only for). */
+ float fill[4];
+
+ /** Name/reference info for this layer (i.e. "director's comments, 12/.3")
+ * needs to be kept unique, as it's used as the layer identifier */
+ char info[128];
+
+ /** Thickness to apply to strokes (Annotations). */
+ short thickness;
+ /** Used to filter groups of layers in modifiers. */
+ short pass_index;
+
+ /** Parent object. */
+ struct Object *parent;
+ /** Inverse matrix (only used if parented). */
+ float inverse[4][4];
+ /** String describing subobject info, MAX_ID_NAME-2. */
+ char parsubstr[64];
short partype;
- short line_change; /* Thickness adjustment */
- float tintcolor[4]; /* Color used to tint layer, alpha value is used as factor */
- float opacity; /* Opacity of the layer */
- char viewlayername[64]; /* Name of the layer used to filter render output */
-
- int blend_mode; /* blend modes */
+ /** Thickness adjustment. */
+ short line_change;
+ /** Color used to tint layer, alpha value is used as factor. */
+ float tintcolor[4];
+ /** Opacity of the layer. */
+ float opacity;
+ /** Name of the layer used to filter render output. */
+ char viewlayername[64];
+
+ /** Blend modes. */
+ int blend_mode;
char _pad[4];
/* annotation onion skin */
- short gstep; /* Ghosts Before: max number of ghost frames to show between active frame and the one before it (0 = only the ghost itself) */
- short gstep_next; /* Ghosts After: max number of ghost frames to show after active frame and the following it (0 = only the ghost itself) */
+ /**
+ * Ghosts Before: max number of ghost frames to show between
+ * active frame and the one before it (0 = only the ghost itself).
+ */
+ short gstep;
+ /**
+ * Ghosts After: max number of ghost frames to show after
+ * active frame and the following it (0 = only the ghost itself).
+ */
+ short gstep_next;
- float gcolor_prev[3]; /* color for ghosts before the active frame */
- float gcolor_next[3]; /* color for ghosts after the active frame */
+ /** Color for ghosts before the active frame. */
+ float gcolor_prev[3];
+ /** Color for ghosts after the active frame. */
+ float gcolor_next[3];
char _pad1[4];
bGPDlayer_Runtime runtime;
@@ -312,6 +377,8 @@ typedef enum eGPDlayer_Flag {
GP_LAYER_UNLOCK_COLOR = (1 << 12),
/* Mask Layer */
GP_LAYER_USE_MASK = (1 << 13),
+ /* Flag used to display in Paint mode only layers with keyframe */
+ GP_LAYER_SOLO_MODE = (1 << 4),
} eGPDlayer_Flag;
/* bGPDlayer->onion_flag */
@@ -335,27 +402,38 @@ typedef enum eGPLayerBlendModes {
/* Runtime temp data for bGPdata */
typedef struct bGPdata_Runtime {
- struct ARegion *ar; /* last region where drawing was originated */
- void *sbuffer; /* stroke buffer (can hold GP_STROKE_BUFFER_MAX) */
+ /** Last region where drawing was originated. */
+ struct ARegion *ar;
+ /** Stroke buffer (can hold GP_STROKE_BUFFER_MAX). */
+ void *sbuffer;
/* GP Object drawing */
- float scolor[4]; /* buffer stroke color */
- float sfill[4]; /* buffer fill color */
- short mode; /* settings for color */
- short bstroke_style; /* buffer style for drawing strokes (used to select shader type) */
- short bfill_style; /* buffer style for filling areas (used to select shader type) */
+ /** Buffer stroke color. */
+ float scolor[4];
+ /** Buffer fill color. */
+ float sfill[4];
+ /** Settings for color. */
+ short mode;
+ /** Buffer style for drawing strokes (used to select shader type). */
+ short bstroke_style;
+ /** Buffer style for filling areas (used to select shader type). */
+ short bfill_style;
/* Stroke Buffer data (only used during paint-session)
* - buffer must be initialized before use, but freed after
* whole paint operation is over
*/
- short sbuffer_size; /* number of elements currently in cache */
- short sbuffer_sflag; /* flags for stroke that cache represents */
+ /** Number of elements currently in cache. */
+ short sbuffer_size;
+ /** Flags for stroke that cache represents. */
+ short sbuffer_sflag;
char _pad[6];
- int tot_cp_points; /* number of control-points for stroke */
+ /** Number of control-points for stroke. */
+ int tot_cp_points;
char _pad1_[4];
- bGPDcontrolpoint *cp_points; /* array of control-points for stroke */
+ /** Array of control-points for stroke. */
+ bGPDcontrolpoint *cp_points;
} bGPdata_Runtime;
/* grid configuration */
@@ -371,36 +449,57 @@ typedef struct bGPgrid {
/* Grease-Pencil Annotations - 'DataBlock' */
typedef struct bGPdata {
- ID id; /* Grease Pencil data is a datablock */
- struct AnimData *adt; /* animation data - for animating draw settings */
+ /** Grease Pencil data is a datablock. */
+ ID id;
+ /** Animation data - for animating draw settings. */
+ struct AnimData *adt;
/* Grease-Pencil data */
- ListBase layers; /* bGPDlayers */
- int flag; /* settings for this datablock */
+ /** BGPDlayers. */
+ ListBase layers;
+ /** Settings for this datablock. */
+ int flag;
- short xray_mode; /* xray mode for strokes (eGP_DepthOrdering) */
- char _pad1[2];
+ char _pad1[4];
/* Palettes */
- ListBase palettes DNA_DEPRECATED; /* list of bGPDpalette's - Deprecated (2.78 - 2.79 only) */
+ /** List of bGPDpalette's - Deprecated (2.78 - 2.79 only). */
+ ListBase palettes DNA_DEPRECATED;
/* 3D Viewport/Appearance Settings */
- float pixfactor; /* factor to define pixel size conversion */
- float line_color[4]; /* color for edit line */
+ /** Factor to define pixel size conversion. */
+ float pixfactor;
+ /** Color for edit line. */
+ float line_color[4];
/* Onion skinning */
- float onion_factor; /* onion alpha factor change */
- int onion_mode; /* onion skinning range (eGP_OnionModes) */
- int onion_flag; /* onion skinning flags (eGPD_OnionFlag) */
- short gstep; /* Ghosts Before: max number of ghost frames to show between active frame and the one before it (0 = only the ghost itself) */
- short gstep_next; /* Ghosts After: max number of ghost frames to show after active frame and the following it (0 = only the ghost itself) */
+ /** Onion alpha factor change. */
+ float onion_factor;
+ /** Onion skinning range (eGP_OnionModes). */
+ int onion_mode;
+ /** Onion skinning flags (eGPD_OnionFlag). */
+ int onion_flag;
+ /**
+ * Ghosts Before: max number of ghost frames to show between
+ * active frame and the one before it (0 = only the ghost itself).
+ */
+ short gstep;
+ /** Ghosts After: max number of ghost frames to show after
+ * active frame and the following it (0 = only the ghost itself).
+ */
+ short gstep_next;
- float gcolor_prev[3]; /* optional color for ghosts before the active frame */
- float gcolor_next[3]; /* optional color for ghosts after the active frame */
+ /** Optional color for ghosts before the active frame. */
+ float gcolor_prev[3];
+ /** Optional color for ghosts after the active frame. */
+ float gcolor_next[3];
- float zdepth_offset; /* offset for drawing over surfaces to keep strokes on top */
- struct Material **mat; /* materials array */
- short totcol; /* total materials */
+ /** Offset for drawing over surfaces to keep strokes on top. */
+ float zdepth_offset;
+ /** Materials array. */
+ struct Material **mat;
+ /** Total materials. */
+ short totcol;
/* stats */
short totlayer;
@@ -408,7 +507,11 @@ typedef struct bGPdata {
char _pad2[6];
int totstroke;
int totpoint;
- char _pad3[4];
+
+ /** Draw mode for strokes (eGP_DrawMode). */
+ short draw_mode;
+ char _pad3[2];
+
bGPgrid grid;
bGPdata_Runtime runtime;
@@ -446,7 +549,8 @@ typedef enum eGPdata_Flag {
GP_DATA_DEPTH_STROKE_ENDPOINTS = (1 << 7),
/* ------------------------------------------------ DEPRECATED */
- /* Stroke Editing Mode - Toggle to enable alternative keymap for easier editing of stroke points */
+ /* Stroke Editing Mode - Toggle to enable alternative keymap
+ * for easier editing of stroke points */
GP_DATA_STROKE_EDITMODE = (1 << 8),
/* Main flag to switch onion skinning on/off */
@@ -510,9 +614,14 @@ typedef enum eGP_OnionModes {
typedef enum eGP_DepthOrdering {
GP_XRAY_FRONT = 0,
GP_XRAY_3DSPACE = 1,
- GP_XRAY_BACK = 2
} eGP_DepthOrdering;
+/* draw modes (Use 2D or 3D position) */
+typedef enum eGP_DrawMode {
+ GP_DRAWMODE_2D = 0,
+ GP_DRAWMODE_3D = 1
+} eGP_DrawMode;
+
/* ***************************************** */
/* Mode Checking Macros */
diff --git a/source/blender/makesdna/DNA_gpu_types.h b/source/blender/makesdna/DNA_gpu_types.h
index be34309572f..da5abf0a0eb 100644
--- a/source/blender/makesdna/DNA_gpu_types.h
+++ b/source/blender/makesdna/DNA_gpu_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,24 +15,19 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_gpu_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_GPU_TYPES_H__
#define __DNA_GPU_TYPES_H__
-/* properties for dof effect */
+/** Properties for dof effect. */
typedef struct GPUDOFSettings {
- float focus_distance; /* focal distance for depth of field */
+ /** Focal distance for depth of field. */
+ float focus_distance;
float fstop;
float focal_length;
float sensor;
@@ -44,21 +37,23 @@ typedef struct GPUDOFSettings {
int high_quality;
} GPUDOFSettings;
-/* properties for SSAO effect */
+/** Properties for SSAO effect. */
typedef struct GPUSSAOSettings {
float factor;
float color[3];
float distance_max;
float attenuation;
- int samples; /* ray samples, we use presets here for easy control instead of */
- int pad;
+ /** Ray samples, we use presets here for easy control instead of. */
+ int samples;
+ char _pad[4];
} GPUSSAOSettings;
typedef struct GPUFXSettings {
GPUDOFSettings *dof;
GPUSSAOSettings *ssao;
- char fx_flag; /* eGPUFXFlags */
- char pad[7];
+ /** #eGPUFXFlags. */
+ char fx_flag;
+ char _pad[7];
} GPUFXSettings;
/* shaderfx enables */
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index 37a0f65135b..bd0916c9b7e 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_image_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_IMAGE_TYPES_H__
@@ -36,29 +28,36 @@
#include "DNA_ID.h"
#include "DNA_color_types.h" /* for color management */
+struct GPUTexture;
+struct MovieCache;
struct PackedFile;
+struct RenderResult;
struct Scene;
struct anim;
-struct MovieCache;
-struct RenderResult;
-struct GPUTexture;
/* ImageUser is in Texture, in Nodes, Background Image, Image Window, .... */
/* should be used in conjunction with an ID * to Image. */
typedef struct ImageUser {
- struct Scene *scene; /* to retrieve render result */
-
- int framenr; /* movies, sequences: current to display */
- int frames; /* total amount of frames to use */
- int offset, sfra; /* offset within movie, start frame in global time */
- char _pad, cycl; /* cyclic flag */
+ /** To retrieve render result. */
+ struct Scene *scene;
+
+ /** Movies, sequences: current to display. */
+ int framenr;
+ /** Total amount of frames to use. */
+ int frames;
+ /** Offset within movie, start frame in global time. */
+ int offset, sfra;
+ /** Cyclic flag. */
+ char _pad0, cycl;
char ok;
- char multiview_eye; /* multiview current eye - for internal use of drawing routines */
+ /** Multiview current eye - for internal use of drawing routines. */
+ char multiview_eye;
short pass;
- short pad;
+ char _pad1[2];
- short multi_index, view, layer; /* listbase indices, for menu browsing or retrieve buffer */
+ /** Listbase indices, for menu browsing or retrieve buffer. */
+ short multi_index, view, layer;
short flag;
} ImageUser;
@@ -69,42 +68,49 @@ typedef struct ImageAnim {
typedef struct ImageView {
struct ImageView *next, *prev;
- char name[64]; /* MAX_NAME */
- char filepath[1024]; /* 1024 = FILE_MAX */
+ /** MAX_NAME. */
+ char name[64];
+ /** 1024 = FILE_MAX. */
+ char filepath[1024];
} ImageView;
typedef struct ImagePackedFile {
struct ImagePackedFile *next, *prev;
struct PackedFile *packedfile;
- char filepath[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char filepath[1024];
} ImagePackedFile;
typedef struct RenderSlot {
struct RenderSlot *next, *prev;
- char name[64]; /* 64 = MAX_NAME */
+ /** 64 = MAX_NAME. */
+ char name[64];
struct RenderResult *render;
} RenderSlot;
/* iuser->flag */
#define IMA_ANIM_ALWAYS (1 << 0)
-#define IMA_ANIM_REFRESHED (1 << 1)
-/* #define IMA_DO_PREMUL (1 << 2) */
+/* #define IMA_DEPRECATED_1 (1 << 1) */
+/* #define IMA_DEPRECATED_2 (1 << 2) */
#define IMA_NEED_FRAME_RECALC (1 << 3)
#define IMA_SHOW_STEREO (1 << 4)
enum {
TEXTARGET_TEXTURE_2D = 0,
TEXTARGET_TEXTURE_CUBE_MAP = 1,
- TEXTARGET_COUNT = 2
+ TEXTARGET_COUNT = 2,
};
typedef struct Image {
ID id;
- char name[1024]; /* file path, 1024 = FILE_MAX */
+ /** File path, 1024 = FILE_MAX. */
+ char name[1024];
- struct MovieCache *cache; /* not written in file */
- struct GPUTexture *gputexture[2]; /* not written in file 2 = TEXTARGET_COUNT */
+ /** Not written in file. */
+ struct MovieCache *cache;
+ /** Not written in file 2 = TEXTARGET_COUNT. */
+ struct GPUTexture *gputexture[2];
/* sources from: */
ListBase anims;
@@ -117,18 +123,18 @@ typedef struct Image {
short source, type;
int lastframe;
- /* texture page */
- short tpageflag;
- short pad2;
- unsigned int pad3;
+ /* GPU texture flag. */
+ short gpuflag;
+ char _pad2[6];
- struct PackedFile *packedfile DNA_DEPRECATED; /* deprecated */
+ /** Deprecated. */
+ struct PackedFile *packedfile DNA_DEPRECATED;
struct ListBase packedfiles;
struct PreviewImage *preview;
int lastused;
short ok;
- short pad4[3];
+ char _pad4[6];
/* for generated images */
int gen_x, gen_y;
@@ -143,12 +149,14 @@ typedef struct Image {
ColorManagedColorspaceSettings colorspace_settings;
char alpha_mode;
- char pad[5];
+ char _pad[5];
/* Multiview */
- char eye; /* for viewer node stereoscopy */
+ /** For viewer node stereoscopy. */
+ char eye;
char views_format;
- ListBase views; /* ImageView */
+ /** ImageView. */
+ ListBase views;
struct Stereo3dFormat *stereo3d_format;
} Image;
@@ -168,7 +176,8 @@ enum {
IMA_OLD_PREMUL = (1 << 7),
IMA_FLAG_DEPRECATED_8 = (1 << 8), /* cleared */
IMA_USED_FOR_RENDER = (1 << 9),
- IMA_USER_FRAME_IN_RANGE = (1 << 10), /* for image user, but these flags are mixed */
+ /** For image user, but these flags are mixed. */
+ IMA_USER_FRAME_IN_RANGE = (1 << 10),
IMA_VIEW_AS_RENDER = (1 << 11),
IMA_IGNORE_ALPHA = (1 << 12),
IMA_DEINTERLACE = (1 << 13),
@@ -177,15 +186,15 @@ enum {
IMA_FLAG_DEPRECATED_16 = (1 << 16), /* cleared */
};
-/* Image.tpageflag */
-#define IMA_TPAGEFLAG_DEPRECATED_0 (1 << 0) /* cleared */
-#define IMA_TPAGEFLAG_DEPRECATED_1 (1 << 1) /* cleared */
-#define IMA_TPAGEFLAG_DEPRECATED_2 (1 << 2) /* cleared */
-#define IMA_MIPMAP_COMPLETE (1 << 3) /* all mipmap levels in OpenGL texture set? */
-#define IMA_TPAGEFLAG_DEPRECATED_4 (1 << 4) /* cleared */
-#define IMA_TPAGEFLAG_DEPRECATED_5 (1 << 5) /* cleared */
-#define IMA_TPAGE_REFRESH (1 << 6)
-#define IMA_GLBIND_IS_DATA (1 << 7) /* opengl image texture bound as non-color data */
+/* Image.gpuflag */
+enum {
+ /** GPU texture needs to be refreshed. */
+ IMA_GPU_REFRESH = (1 << 0),
+ /** All mipmap levels in OpenGL texture set? */
+ IMA_GPU_MIPMAP_COMPLETE = (1 << 1),
+ /** OpenGL image texture bound as non-color data. */
+ IMA_GPU_IS_DATA = (1 << 2),
+};
/* ima->type and ima->source moved to BKE_image.h, for API */
diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h
index 5f6ca277615..b728e5081ba 100644
--- a/source/blender/makesdna/DNA_ipo_types.h
+++ b/source/blender/makesdna/DNA_ipo_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_ipo_types.h
- * \ingroup DNA
- * \deprecated
+/** \file
+ * \ingroup DNA
+ * \deprecated
* The contents of this file are now officially deprecated. They were used for the 'old' animation system,
* which has (as of 2.50) been replaced with a completely new system by Joshua Leung (aligorith). All defines,
* etc. are only still maintained to provide backwards compatibility for old files.
@@ -51,11 +43,15 @@
/* IPO Curve Driver */
typedef struct IpoDriver {
- struct Object *ob; /* target/driver ob */
- short blocktype, adrcode; /* sub-channel to use */
-
- short type, flag; /* driver settings */
- char name[128]; /* bone, or python expression here */
+ /** Target/driver ob. */
+ struct Object *ob;
+ /** Sub-channel to use. */
+ short blocktype, adrcode;
+
+ /** Driver settings. */
+ short type, flag;
+ /** Bone, or python expression here. */
+ char name[128];
} IpoDriver;
/* --- IPO Curve --- */
@@ -64,22 +60,34 @@ typedef struct IpoDriver {
typedef struct IpoCurve {
struct IpoCurve *next, *prev;
- struct BPoint *bp; /* array of BPoints (sizeof(BPoint) * totvert) - i.e. baked/imported data */
- struct BezTriple *bezt; /* array of BezTriples (sizeof(BezTriple) * totvert) - i.e. user-editable keyframes */
-
- rctf maxrct, totrct; /* bounding boxes */
-
- short blocktype, adrcode, vartype; /* blocktype= ipo-blocktype; adrcode= type of ipo-curve; vartype= 'format' of data */
- short totvert; /* total number of BezTriples (i.e. keyframes) on curve */
- short ipo, extrap; /* interpolation and extrapolation modes */
- short flag, rt; /* flag= settings; rt= ??? */
- float ymin, ymax; /* minimum/maximum y-extents for curve */
- unsigned int bitmask; /* ??? */
-
- float slide_min, slide_max; /* minimum/maximum values for sliders (in action editor) */
- float curval; /* value of ipo-curve for current frame */
-
- IpoDriver *driver; /* pointer to ipo-driver for this curve */
+ /** Array of BPoints (sizeof(BPoint) * totvert) - i.e. baked/imported data. */
+ struct BPoint *bp;
+ /** Array of BezTriples (sizeof(BezTriple) * totvert) - i.e. user-editable keyframes . */
+ struct BezTriple *bezt;
+
+ /** Bounding boxes. */
+ rctf maxrct, totrct;
+
+ /** Blocktype= ipo-blocktype; adrcode= type of ipo-curve; vartype= 'format' of data. */
+ short blocktype, adrcode, vartype;
+ /** Total number of BezTriples (i.e. keyframes) on curve. */
+ short totvert;
+ /** Interpolation and extrapolation modes . */
+ short ipo, extrap;
+ /** Flag= settings; rt= ???. */
+ short flag, rt;
+ /** Minimum/maximum y-extents for curve. */
+ float ymin, ymax;
+ /** ???. */
+ unsigned int bitmask;
+
+ /** Minimum/maximum values for sliders (in action editor). */
+ float slide_min, slide_max;
+ /** Value of ipo-curve for current frame. */
+ float curval;
+
+ /** Pointer to ipo-driver for this curve. */
+ IpoDriver *driver;
} IpoCurve;
/* --- ID-Datablock --- */
@@ -88,11 +96,17 @@ typedef struct IpoCurve {
typedef struct Ipo {
ID id;
- ListBase curve; /* A list of IpoCurve structs in a linked list. */
- rctf cur; /* Rect defining extents of keyframes? */
-
- short blocktype, showkey; /* blocktype: self-explanatory; showkey: either 0 or 1 (show vertical yellow lines for editing) */
- short muteipo, pad; /* muteipo: either 0 or 1 (whether ipo block is muted) */
+ /** A list of IpoCurve structs in a linked list. */
+ ListBase curve;
+ /** Rect defining extents of keyframes?. */
+ rctf cur;
+
+ /** Blocktype: self-explanatory; showkey: either 0 or 1
+ * (show vertical yellow lines for editing). */
+ short blocktype, showkey;
+ /** Muteipo: either 0 or 1 (whether ipo block is muted). */
+ short muteipo;
+ char _pad[2];
} Ipo;
/* ----------- adrcodes (for matching ipo-curves to data) ------------- */
@@ -312,7 +326,7 @@ typedef struct Ipo {
#define WO_STARDIST 15
#define WO_STARSIZE 16
-/* ********** Lamp (ID_LA) ********** */
+/* ********** Light (ID_LA) ********** */
#define LA_TOTIPO 21
#define LA_TOTNAM 10
diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h
index fa58f8f8abd..d35ed7a755f 100644
--- a/source/blender/makesdna/DNA_key_types.h
+++ b/source/blender/makesdna/DNA_key_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __DNA_KEY_TYPES_H__
#define __DNA_KEY_TYPES_H__
-/** \file DNA_key_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*
* This file defines structures for Shape-Keys (not animation keyframes),
* attached to Mesh, Curve and Lattice Data. Even though Key's are ID blocks they
@@ -45,25 +37,36 @@ struct Ipo;
typedef struct KeyBlock {
struct KeyBlock *next, *prev;
- float pos; /* point in time (Key->type == KEY_NORMAL) only,
- * for historic reasons this is relative to (Key->ctime / 100),
- * so this value increments by 0.1f per frame. */
- float curval; /* influence (typically [0 - 1] but can be more), (Key->type == KEY_RELATIVE) only.*/
-
- short type; /* interpolation type (Key->type == KEY_NORMAL) only. */
- short pad1;
-
- short relative; /* relative == 0 means first key is reference, otherwise the index of Key->blocks */
+ /**
+ * point in time (Key->type == KEY_NORMAL) only,
+ * for historic reasons this is relative to (Key->ctime / 100),
+ * so this value increments by 0.1f per frame.
+ */
+ float pos;
+ /** influence (typically [0 - 1] but can be more), (Key->type == KEY_RELATIVE) only.*/
+ float curval;
+
+ /** interpolation type (Key->type == KEY_NORMAL) only. */
+ short type;
+ char _pad1[2];
+
+ /** relative == 0 means first key is reference, otherwise the index of Key->blocks */
+ short relative;
short flag;
- int totelem; /* total number if items in the keyblock (compare with mesh/curve verts to check we match) */
- int uid; /* for meshes only, match the unique number with the customdata layer */
+ /** total number if items in the keyblock (compare with mesh/curve verts to check we match) */
+ int totelem;
+ /** for meshes only, match the unique number with the customdata layer */
+ int uid;
- void *data; /* array of shape key values, size is (Key->elemsize * KeyBlock->totelem) */
- char name[64]; /* MAX_NAME (unique name, user assigned) */
- char vgroup[64]; /* MAX_VGROUP_NAME (optional vertex group), array gets allocated into 'weights' when set */
+ /** array of shape key values, size is (Key->elemsize * KeyBlock->totelem) */
+ void *data;
+ /** MAX_NAME (unique name, user assigned) */
+ char name[64];
+ /** MAX_VGROUP_NAME (optional vertex group), array gets allocated into 'weights' when set */
+ char vgroup[64];
- /* ranges, for RNA and UI only to clamp 'curval' */
+ /** ranges, for RNA and UI only to clamp 'curval' */
float slidermin;
float slidermax;
@@ -72,36 +75,48 @@ typedef struct KeyBlock {
typedef struct Key {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
- /* commonly called 'Basis', (Key->type == KEY_RELATIVE) only.
+ /**
+ * commonly called 'Basis', (Key->type == KEY_RELATIVE) only.
* Looks like this is _always_ 'key->block.first',
- * perhaps later on it could be defined as some other KeyBlock - campbell */
+ * perhaps later on it could be defined as some other KeyBlock - campbell
+ */
KeyBlock *refkey;
- /* this is not a regular string, although it is \0 terminated
+ /**
+ * This is not a regular string, although it is \0 terminated
* this is an array of (element_array_size, element_type) pairs
- * (each one char) used for calculating shape key-blocks */
+ * (each one char) used for calculating shape key-blocks. */
char elemstr[32];
- int elemsize; /* size of each element in #KeyBlock.data, use for allocation and stride */
- int pad;
+ /** Size of each element in #KeyBlock.data, use for allocation and stride. */
+ int elemsize;
+ char _pad[4];
- ListBase block; /* list of KeyBlock's */
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** list of KeyBlock's */
+ ListBase block;
+ /** old animation system, deprecated for 2.5 */
+ struct Ipo *ipo DNA_DEPRECATED;
ID *from;
- int totkey; /* (totkey == BLI_listbase_count(&key->block)) */
+ /** (totkey == BLI_listbase_count(&key->block)) */
+ int totkey;
short flag;
- char type; /* absolute or relative shape key */
- char pad2;
+ /** absolute or relative shape key */
+ char type;
+ char _pad2;
- /* only used when (Key->type == KEY_NORMAL), this value is used as a time slider,
+ /** Only used when (Key->type == KEY_NORMAL), this value is used as a time slider,
* rather then using the scenes time, this value can be animated to give greater control */
float ctime;
- /* can never be 0, this is used for detecting old data */
- int uidgen; /* current free uid for keyblocks */
+ /**
+ * Can never be 0, this is used for detecting old data.
+ * current free uid for keyblocks
+ */
+ int uidgen;
} Key;
/* **************** KEY ********************* */
@@ -112,12 +127,12 @@ enum {
KEY_NORMAL = 0,
/* States to blend between (default) */
- KEY_RELATIVE = 1
+ KEY_RELATIVE = 1,
};
/* Key->flag */
enum {
- KEY_DS_EXPAND = 1
+ KEY_DS_EXPAND = 1,
};
/* KeyBlock->type */
@@ -132,7 +147,7 @@ enum {
enum {
KEYBLOCK_MUTE = (1 << 0),
KEYBLOCK_SEL = (1 << 1),
- KEYBLOCK_LOCKED = (1 << 2)
+ KEYBLOCK_LOCKED = (1 << 2),
};
#define KEYELEM_FLOAT_LEN_COORD 3
diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h
index 71d6b3bbb0e..ca0136522c1 100644
--- a/source/blender/makesdna/DNA_lattice_types.h
+++ b/source/blender/makesdna/DNA_lattice_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_lattice_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_LATTICE_TYPES_H__
@@ -41,12 +33,12 @@ struct Ipo;
struct Key;
struct MDeformVert;
+#
+#
typedef struct EditLatt {
struct Lattice *latt;
int shapenr;
-
- char pad[4];
} EditLatt;
typedef struct Lattice {
@@ -54,19 +46,23 @@ typedef struct Lattice {
struct AnimData *adt;
short pntsu, pntsv, pntsw, flag;
- short opntsu, opntsv, opntsw, pad2;
- char typeu, typev, typew, pad3;
- int actbp; /* active element index, unset with LT_ACTBP_NONE */
+ short opntsu, opntsv, opntsw;
+ char _pad2[3];
+ char typeu, typev, typew;
+ /** Active element index, unset with LT_ACTBP_NONE. */
+ int actbp;
float fu, fv, fw, du, dv, dw;
struct BPoint *def;
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
struct Key *key;
struct MDeformVert *dvert;
- char vgroup[64]; /* multiply the influence, MAX_VGROUP_NAME */
+ /** Multiply the influence, MAX_VGROUP_NAME. */
+ char vgroup[64];
struct EditLatt *editlatt;
void *batch_cache;
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index d959d54b07f..aa7ca2ca987 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_layer_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_LAYER_TYPES_H__
@@ -36,12 +30,26 @@ extern "C" {
typedef struct Base {
struct Base *next, *prev;
+
+ /* Flags which are based on the collections flags evaluation, does not
+ * include flags from object's restrictions. */
+ short flag_from_collection;
+
+ /* Final flags, including both accumulated collection flags and object's
+ * restriction flags. */
short flag;
+
unsigned short local_view_bits;
short sx, sy;
+ char _pad1[6];
struct Object *object;
unsigned int lay DNA_DEPRECATED;
int flag_legacy;
+
+ /* Pointer to an original base. Is initialized for evaluated view layer.
+ * NOTE: Only allowed to be accessed from within active dependency graph. */
+ struct Base *base_orig;
+ void *_pad;
} Base;
typedef struct ViewLayerEngineData {
@@ -57,35 +65,42 @@ typedef struct LayerCollection {
struct SceneCollection *scene_collection DNA_DEPRECATED;
short flag;
short runtime_flag;
- short pad[2];
- ListBase layer_collections; /* synced with collection->children */
+ char _pad[4];
+ /** Synced with collection->children. */
+ ListBase layer_collections;
} LayerCollection;
typedef struct ViewLayer {
struct ViewLayer *next, *prev;
- char name[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64];
short flag;
- short runtime_flag;
- short pad[2];
- ListBase object_bases; /* ObjectBase */
- struct SceneStats *stats; /* default allocated now */
+ char _pad[6];
+ /** ObjectBase. */
+ ListBase object_bases;
+ /** Default allocated now. */
+ struct SceneStats *stats;
struct Base *basact;
- ListBase layer_collections; /* LayerCollection */
+ /** LayerCollection. */
+ ListBase layer_collections;
LayerCollection *active_collection;
/* Old SceneRenderLayer data. */
int layflag;
- int passflag; /* pass_xor has to be after passflag */
+ /** Pass_xor has to be after passflag. */
+ int passflag;
float pass_alpha_threshold;
int samples;
struct Material *mat_override;
- struct IDProperty *id_properties; /* Equivalent to datablocks ID properties. */
+ /** Equivalent to datablocks ID properties. */
+ struct IDProperty *id_properties;
struct FreestyleConfig freestyle_config;
/* Runtime data */
- ListBase drawdata; /* ViewLayerEngineData */
+ /** ViewLayerEngineData. */
+ ListBase drawdata;
struct Base **object_bases_array;
struct GHash *object_bases_hash;
} ViewLayer;
@@ -99,12 +114,12 @@ enum {
/* Runtime evaluated flags. */
BASE_VISIBLE = (1 << 1), /* Object is enabled and visible. */
BASE_SELECTABLE = (1 << 2), /* Object can be selected. */
- BASE_FROMDUPLI = (1 << 3), /* Object comes from duplicator. */
+ BASE_FROM_DUPLI = (1 << 3), /* Object comes from duplicator. */
/* BASE_DEPRECATED = (1 << 4), */
BASE_FROM_SET = (1 << 5), /* Object comes from set. */
BASE_ENABLED_VIEWPORT = (1 << 6), /* Object is enabled in viewport. */
BASE_ENABLED_RENDER = (1 << 7), /* Object is enabled in final render */
- BASE_ENABLED = (1 << 9), /* Object is enabled. */
+ /* BASE_DEPRECATED = (1 << 9), */
BASE_HOLDOUT = (1 << 10), /* Object masked out from render */
BASE_INDIRECT_ONLY = (1 << 11), /* Object only contributes indirectly to render */
};
@@ -118,14 +133,13 @@ enum {
LAYER_COLLECTION_EXCLUDE = (1 << 4),
LAYER_COLLECTION_HOLDOUT = (1 << 5),
LAYER_COLLECTION_INDIRECT_ONLY = (1 << 6),
+ LAYER_COLLECTION_RESTRICT_VIEW = (1 << 7),
};
/* Layer Collection->runtime_flag */
enum {
LAYER_COLLECTION_HAS_OBJECTS = (1 << 0),
- LAYER_COLLECTION_HAS_VISIBLE_OBJECTS = (1 << 1),
- LAYER_COLLECTION_HAS_HIDDEN_OBJECTS = (1 << 2),
- LAYER_COLLECTION_HAS_ENABLED_OBJECTS = (1 << 3),
+ LAYER_COLLECTION_VISIBLE = (1 << 1),
};
/* ViewLayer->flag */
@@ -135,11 +149,6 @@ enum {
VIEW_LAYER_FREESTYLE = (1 << 2),
};
-/* ViewLayer->runtime_flag */
-enum {
- VIEW_LAYER_HAS_HIDE = (1 << 0),
-};
-
/****************************** Deprecated ******************************/
/* Compatibility with collections saved in early 2.8 versions,
@@ -148,13 +157,17 @@ enum {
typedef struct SceneCollection {
struct SceneCollection *next, *prev;
- char name[64]; /* MAX_NAME */
- int active_object_index; /* for UI */
+ /** MAX_NAME. */
+ char name[64];
+ /** For UI. */
+ int active_object_index;
short flag;
char type;
- char pad;
- ListBase objects; /* (Object *)LinkData->data */
- ListBase scene_collections; /* nested collections */
+ char _pad;
+ /** (Object *)LinkData->data. */
+ ListBase objects;
+ /** Nested collections. */
+ ListBase scene_collections;
} SceneCollection;
#ifdef __cplusplus
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_light_types.h
index 1baddad5a6e..a98b03f847c 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_light_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_lamp_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
-#ifndef __DNA_LAMP_TYPES_H__
-#define __DNA_LAMP_TYPES_H__
+#ifndef __DNA_LIGHT_TYPES_H__
+#define __DNA_LIGHT_TYPES_H__
#include "DNA_defs.h"
#include "DNA_ID.h"
@@ -40,14 +32,15 @@
#endif
struct AnimData;
-struct bNodeTree;
struct CurveMapping;
struct Ipo;
struct MTex;
+struct bNodeTree;
-typedef struct Lamp {
+typedef struct Light {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
short type, flag;
int mode;
@@ -57,11 +50,13 @@ typedef struct Lamp {
float energy, dist, spotsize, spotblend;
- float att1, att2; /* Quad1 and Quad2 attenuation */
- float coeff_const, coeff_lin, coeff_quad, coeff_pad;
+ /** Quad1 and Quad2 attenuation. */
+ float att1, att2;
+ float coeff_const, coeff_lin, coeff_quad;
+ char _pad0[4];
struct CurveMapping *curfalloff;
short falloff_type;
- short pad2;
+ char _pad2[2];
float clipsta, clipend;
float bias, soft, bleedbias, bleedexp;
@@ -74,9 +69,10 @@ typedef struct Lamp {
/* texact is for buttons */
short texact, shadhalostep;
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
short pr_texture, use_nodes;
- char pad6[4];
+ char _pad6[4];
/* Eevee */
float cascade_max_dist;
@@ -93,9 +89,9 @@ typedef struct Lamp {
/* nodes */
struct bNodeTree *nodetree;
-} Lamp;
+} Light;
-/* **************** LAMP ********************* */
+/* **************** LIGHT ********************* */
/* flag */
#define LA_DS_EXPAND (1 << 0)
@@ -126,8 +122,8 @@ typedef struct Lamp {
/* #define LA_NO_DIFF (1 << 11) */ /* not used anywhere */
/* #define LA_NO_SPEC (1 << 12) */ /* not used anywhere */
/* #define LA_SHAD_RAY (1 << 13) */ /* not used anywhere - cleaned */
-/* yafray: lamp shadowbuffer flag, softlight */
-/* Since it is used with LOCAL lamp, can't use LA_SHAD */
+/* yafray: light shadowbuffer flag, softlight */
+/* Since it is used with LOCAL light, can't use LA_SHAD */
/* #define LA_YF_SOFT (1 << 14) */ /* not used anymore */
/* #define LA_LAYER_SHADOW (1 << 15) */ /* not used anymore */
/* #define LA_SHAD_TEX (1 << 16) */ /* not used anymore */
@@ -145,11 +141,11 @@ typedef struct Lamp {
#define LA_FALLOFF_INVCOEFFICIENTS 5
/* area shape */
-#define LA_AREA_SQUARE 0
-#define LA_AREA_RECT 1
-#define LA_AREA_CUBE 2
-#define LA_AREA_BOX 3
-#define LA_AREA_DISK 4
-#define LA_AREA_ELLIPSE 5
-
-#endif /* __DNA_LAMP_TYPES_H__ */
+#define LA_AREA_SQUARE 0
+#define LA_AREA_RECT 1
+/* #define LA_AREA_CUBE 2 */ /* UNUSED */
+/* #define LA_AREA_BOX 3 */ /* UNUSED */
+#define LA_AREA_DISK 4
+#define LA_AREA_ELLIPSE 5
+
+#endif /* __DNA_LIGHT_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_lightprobe_types.h b/source/blender/makesdna/DNA_lightprobe_types.h
index 490e2574a33..f852b1f5a7f 100644
--- a/source/blender/makesdna/DNA_lightprobe_types.h
+++ b/source/blender/makesdna/DNA_lightprobe_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file DNA_lightprobe_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_LIGHTPROBE_TYPES_H__
@@ -36,41 +29,55 @@
extern "C" {
#endif
-struct Object;
struct AnimData;
+struct Object;
typedef struct LightProbe {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
-
- char type; /* For realtime probe objects */
- char flag; /* General purpose flags for probes */
- char attenuation_type; /* Attenuation type */
- char parallax_type; /* Parallax type */
-
- float distinf; /* Influence Radius */
- float distpar; /* Parallax Radius */
- float falloff; /* Influence falloff */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
+
+ /** For realtime probe objects. */
+ char type;
+ /** General purpose flags for probes. */
+ char flag;
+ /** Attenuation type. */
+ char attenuation_type;
+ /** Parallax type. */
+ char parallax_type;
+
+ /** Influence Radius. */
+ float distinf;
+ /** Parallax Radius. */
+ float distpar;
+ /** Influence falloff. */
+ float falloff;
float clipsta, clipend;
- float vis_bias, vis_bleedbias; /* VSM visibility biases */
+ /** VSM visibility biases. */
+ float vis_bias, vis_bleedbias;
float vis_blur;
- float intensity; /* Intensity multiplier */
+ /** Intensity multiplier. */
+ float intensity;
- int grid_resolution_x; /* Irradiance grid resolution */
+ /** Irradiance grid resolution. */
+ int grid_resolution_x;
int grid_resolution_y;
int grid_resolution_z;
- int pad1;
+ char _pad1[4];
- struct Object *parallax_ob; /* Object to use as a parallax origin */
- struct Image *image; /* Image to use on as lighting data */
- struct Collection *visibility_grp; /* Object visibility group, inclusive or exclusive */
+ /** Object to use as a parallax origin. */
+ struct Object *parallax_ob;
+ /** Image to use on as lighting data. */
+ struct Image *image;
+ /** Object visibility group, inclusive or exclusive. */
+ struct Collection *visibility_grp;
/* Runtime display data */
float distfalloff, distgridinf;
- float pad[2];
+ char _pad[8];
} LightProbe;
/* Probe->type */
@@ -108,23 +115,30 @@ enum {
/* Needs to be there because written to file
* with the lightcache. */
+/* IMPORTANT Padding in these structs is essential. It must match
+ * GLSL struct definition in lightprobe_lib.glsl. */
+
+/* Must match CubeData. */
typedef struct LightProbeCache {
float position[3], parallax_type;
float attenuation_fac;
float attenuation_type;
- float pad3[2];
+ float _pad3[2];
float attenuationmat[4][4];
float parallaxmat[4][4];
} LightProbeCache;
+/* Must match GridData. */
typedef struct LightGridCache {
float mat[4][4];
- int resolution[3], offset; /* offset to the first irradiance sample in the pool. */
+ /** Offset to the first irradiance sample in the pool. */
+ int resolution[3], offset;
float corner[3], attenuation_scale;
- float increment_x[3], attenuation_bias; /* world space vector between 2 opposite cells */
+ /** World space vector between 2 opposite cells. */
+ float increment_x[3], attenuation_bias;
float increment_y[3], level_bias;
- float increment_z[3], pad4;
- float visibility_bias, visibility_bleed, visibility_range, pad5;
+ float increment_z[3], _pad4;
+ float visibility_bias, visibility_bleed, visibility_range, _pad5;
} LightGridCache;
/* ------ Eevee Lightcache ------- */
@@ -136,22 +150,27 @@ typedef struct LightCacheTexture {
int tex_size[3];
char data_type;
char components;
- char pad[2];
+ char _pad[2];
} LightCacheTexture;
typedef struct LightCache {
int flag;
/* only a single cache for now */
- int cube_len, grid_len; /* Number of probes to use for rendering. */
- int mips_len; /* Number of mipmap level to use. */
- int vis_res, ref_res; /* Size of a visibility/reflection sample. */
- int pad[2];
+ /** Number of probes to use for rendering. */
+ int cube_len, grid_len;
+ /** Number of mipmap level to use. */
+ int mips_len;
+ /** Size of a visibility/reflection sample. */
+ int vis_res, ref_res;
+ char _pad[4][2];
/* In the future, we could create a bigger texture containing
* multiple caches (for animation) and interpolate between the
* caches overtime to another texture. */
LightCacheTexture grid_tx;
- LightCacheTexture cube_tx; /* Contains data for mipmap level 0. */
- LightCacheTexture *cube_mips; /* Does not contains valid GPUTexture, only data. */
+ /** Contains data for mipmap level 0. */
+ LightCacheTexture cube_tx;
+ /** Does not contains valid GPUTexture, only data. */
+ LightCacheTexture *cube_mips;
/* All lightprobes data contained in the cache. */
LightProbeCache *cube_data;
LightGridCache *grid_data;
diff --git a/source/blender/makesdna/DNA_linestyle_types.h b/source/blender/makesdna/DNA_linestyle_types.h
index fa9ce358549..34392016f27 100644
--- a/source/blender/makesdna/DNA_linestyle_types.h
+++ b/source/blender/makesdna/DNA_linestyle_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __DNA_LINESTYLE_TYPES_H__
#define __DNA_LINESTYLE_TYPES_H__
-/** \file DNA_linestyle_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#include "DNA_listBase.h"
@@ -52,7 +44,8 @@ struct bNodeTree;
typedef struct LineStyleModifier {
struct LineStyleModifier *next, *prev;
- char name[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64];
int type;
float influence;
int flags;
@@ -122,7 +115,7 @@ typedef struct LineStyleAlphaModifier_AlongStroke {
struct CurveMapping *curve;
int flags;
- int pad;
+ char _pad[4];
} LineStyleAlphaModifier_AlongStroke;
typedef struct LineStyleThicknessModifier_AlongStroke {
@@ -131,7 +124,7 @@ typedef struct LineStyleThicknessModifier_AlongStroke {
struct CurveMapping *curve;
int flags;
float value_min, value_max;
- int pad;
+ char _pad[4];
} LineStyleThicknessModifier_AlongStroke;
/* Distance from Camera modifiers */
@@ -149,7 +142,7 @@ typedef struct LineStyleAlphaModifier_DistanceFromCamera {
struct CurveMapping *curve;
int flags;
float range_min, range_max;
- int pad;
+ char _pad[4];
} LineStyleAlphaModifier_DistanceFromCamera;
typedef struct LineStyleThicknessModifier_DistanceFromCamera {
@@ -159,7 +152,7 @@ typedef struct LineStyleThicknessModifier_DistanceFromCamera {
int flags;
float range_min, range_max;
float value_min, value_max;
- int pad;
+ char _pad[4];
} LineStyleThicknessModifier_DistanceFromCamera;
/* Distance from Object modifiers */
@@ -179,7 +172,7 @@ typedef struct LineStyleAlphaModifier_DistanceFromObject {
struct CurveMapping *curve;
int flags;
float range_min, range_max;
- int pad;
+ char _pad[4];
} LineStyleAlphaModifier_DistanceFromObject;
typedef struct LineStyleThicknessModifier_DistanceFromObject {
@@ -190,7 +183,7 @@ typedef struct LineStyleThicknessModifier_DistanceFromObject {
int flags;
float range_min, range_max;
float value_min, value_max;
- int pad;
+ char _pad[4];
} LineStyleThicknessModifier_DistanceFromObject;
/* 3D curvature modifiers */
@@ -209,14 +202,15 @@ typedef struct LineStyleAlphaModifier_Curvature_3D {
struct CurveMapping *curve;
int flags;
float min_curvature, max_curvature;
- int pad;
+ char _pad[4];
} LineStyleAlphaModifier_Curvature_3D;
typedef struct LineStyleThicknessModifier_Curvature_3D {
struct LineStyleModifier modifier;
struct CurveMapping *curve;
- int flags, pad;
+ int flags;
+ char _pad[4];
float min_curvature, max_curvature;
float min_thickness, max_thickness;
} LineStyleThicknessModifier_Curvature_3D;
@@ -228,7 +222,8 @@ typedef struct LineStyleColorModifier_Noise {
struct ColorBand *color_ramp;
float period, amplitude;
- int seed, pad;
+ int seed;
+ char _pad[4];
} LineStyleColorModifier_Noise;
typedef struct LineStyleAlphaModifier_Noise {
@@ -263,14 +258,15 @@ typedef struct LineStyleAlphaModifier_CreaseAngle {
struct CurveMapping *curve;
int flags;
float min_angle, max_angle;
- int pad;
+ char _pad[4];
} LineStyleAlphaModifier_CreaseAngle;
typedef struct LineStyleThicknessModifier_CreaseAngle {
struct LineStyleModifier modifier;
struct CurveMapping *curve;
- int flags, pad;
+ int flags;
+ char _pad[4];
float min_angle, max_angle;
float min_thickness, max_thickness;
} LineStyleThicknessModifier_CreaseAngle;
@@ -288,7 +284,7 @@ typedef struct LineStyleAlphaModifier_Tangent {
struct CurveMapping *curve;
int flags;
- int pad;
+ char _pad[4];
} LineStyleAlphaModifier_Tangent;
typedef struct LineStyleThicknessModifier_Tangent {
@@ -297,7 +293,7 @@ typedef struct LineStyleThicknessModifier_Tangent {
struct CurveMapping *curve;
int flags;
float min_thickness, max_thickness;
- int pad;
+ char _pad[4];
} LineStyleThicknessModifier_Tangent;
/* Material modifiers */
@@ -350,21 +346,21 @@ typedef struct LineStyleGeometryModifier_Sampling {
struct LineStyleModifier modifier;
float sampling;
- int pad;
+ char _pad[4];
} LineStyleGeometryModifier_Sampling;
typedef struct LineStyleGeometryModifier_BezierCurve {
struct LineStyleModifier modifier;
float error;
- int pad;
+ char _pad[4];
} LineStyleGeometryModifier_BezierCurve;
typedef struct LineStyleGeometryModifier_SinusDisplacement {
struct LineStyleModifier modifier;
float wavelength, amplitude, phase;
- int pad;
+ char _pad[4];
} LineStyleGeometryModifier_SinusDisplacement;
/* LineStyleGeometryModifier_SpatialNoise::flags */
@@ -383,48 +379,50 @@ typedef struct LineStyleGeometryModifier_PerlinNoise1D {
struct LineStyleModifier modifier;
float frequency, amplitude;
- float angle; /* in radians! */
+ /** In radians!. */
+ float angle;
unsigned int octaves;
int seed;
- int pad1;
+ char _pad1[4];
} LineStyleGeometryModifier_PerlinNoise1D;
typedef struct LineStyleGeometryModifier_PerlinNoise2D {
struct LineStyleModifier modifier;
float frequency, amplitude;
- float angle; /* in radians! */
+ /** In radians!. */
+ float angle;
unsigned int octaves;
int seed;
- int pad1;
+ char _pad1[4];
} LineStyleGeometryModifier_PerlinNoise2D;
typedef struct LineStyleGeometryModifier_BackboneStretcher {
struct LineStyleModifier modifier;
float backbone_length;
- int pad;
+ char _pad[4];
} LineStyleGeometryModifier_BackboneStretcher;
typedef struct LineStyleGeometryModifier_TipRemover {
struct LineStyleModifier modifier;
float tip_length;
- int pad;
+ char _pad[4];
} LineStyleGeometryModifier_TipRemover;
typedef struct LineStyleGeometryModifier_Polygonalization {
struct LineStyleModifier modifier;
float error;
- int pad;
+ char _pad[4];
} LineStyleGeometryModifier_Polygonalization;
typedef struct LineStyleGeometryModifier_GuidingLines {
struct LineStyleModifier modifier;
float offset;
- int pad;
+ char _pad[4];
} LineStyleGeometryModifier_GuidingLines;
/* LineStyleGeometryModifier_BluePrintLines::shape */
@@ -462,17 +460,18 @@ typedef struct LineStyleGeometryModifier_2DTransform {
int pivot;
float scale_x, scale_y;
- float angle; /* in radians! */
+ /** In radians!. */
+ float angle;
float pivot_u;
float pivot_x, pivot_y;
- int pad;
+ char _pad[4];
} LineStyleGeometryModifier_2DTransform;
typedef struct LineStyleGeometryModifier_Simplification {
struct LineStyleModifier modifier;
float tolerance;
- int pad;
+ char _pad[4];
}LineStyleGeometryModifier_Simplification;
/* Calligraphic thickness modifier */
@@ -481,8 +480,9 @@ typedef struct LineStyleThicknessModifier_Calligraphy {
struct LineStyleModifier modifier;
float min_thickness, max_thickness;
- float orientation; /* in radians! */
- int pad;
+ /** In radians!. */
+ float orientation;
+ char _pad[4];
} LineStyleThicknessModifier_Calligraphy;
/* FreestyleLineStyle::panel */
@@ -551,7 +551,8 @@ typedef struct FreestyleLineStyle {
int chaining;
unsigned int rounds;
float split_length;
- float min_angle, max_angle; /* in radians, for splitting */
+ /** In radians, for splitting. */
+ float min_angle, max_angle;
float min_length, max_length;
unsigned int chain_count;
unsigned short split_dash1, split_gap1;
@@ -560,10 +561,13 @@ typedef struct FreestyleLineStyle {
int sort_key, integration_type;
float texstep;
short texact, pr_texture;
- short use_nodes, pad[3];
+ short use_nodes;
+ char _pad[6];
unsigned short dash1, gap1, dash2, gap2, dash3, gap3;
- int panel; /* for UI */
- struct MTex *mtex[18]; /* MAX_MTEX */
+ /** For UI. */
+ int panel;
+ /** MAX_MTEX. */
+ struct MTex *mtex[18];
/* nodes */
struct bNodeTree *nodetree;
diff --git a/source/blender/makesdna/DNA_listBase.h b/source/blender/makesdna/DNA_listBase.h
index ad359efa4d5..359aa7a219c 100644
--- a/source/blender/makesdna/DNA_listBase.h
+++ b/source/blender/makesdna/DNA_listBase.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- *
*/
-/** \file DNA_listBase.h
- * \ingroup DNA
- * \brief These structs are the foundation for all linked lists in the
- * library system.
+/** \file
+ * \ingroup DNA
+ * \brief These structs are the foundation for all linked lists in the library system.
*
* Doubly-linked lists start from a ListBase and contain elements beginning
* with Link.
@@ -43,19 +32,19 @@
extern "C" {
#endif
-/* generic - all structs which are put into linked lists begin with this */
+/** Generic - all structs which are put into linked lists begin with this. */
typedef struct Link {
struct Link *next, *prev;
} Link;
-/* simple subclass of Link--use this when it is not worth defining a custom one... */
+/** Simple subclass of Link. Use this when it is not worth defining a custom one. */
typedef struct LinkData {
struct LinkData *next, *prev;
void *data;
} LinkData;
-/* never change the size of this! genfile.c detects pointerlen with it */
+/** Never change the size of this! dna_genfile.c detects pointer_size with it. */
typedef struct ListBase {
void *first, *last;
} ListBase;
diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h
index 2c6fccae158..58418738f3a 100644
--- a/source/blender/makesdna/DNA_mask_types.h
+++ b/source/blender/makesdna/DNA_mask_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_mask_types.h
- * \ingroup DNA
- * \since march-2012
- * \author Sergey Sharybin
+/** \file
+ * \ingroup DNA
*
* Mask data-blocks are collections of 2D curves to be used
* for image masking in the compositor and sequencer.
@@ -46,68 +35,106 @@
typedef struct Mask {
ID id;
struct AnimData *adt;
- ListBase masklayers; /* mask layers */
- int masklay_act; /* index of active mask layer (-1 == None) */
- int masklay_tot; /* total number of mask layers */
-
- int sfra, efra; /* frames, used by the sequencer */
-
- int flag; /* for anim info */
- int pad;
+ /** Mask layers. */
+ ListBase masklayers;
+ /** Index of active mask layer (-1 == None). */
+ int masklay_act;
+ /** Total number of mask layers. */
+ int masklay_tot;
+
+ /** Frames, used by the sequencer. */
+ int sfra, efra;
+
+ /** For anim info. */
+ int flag;
+ char _pad[4];
} Mask;
typedef struct MaskParent {
- // int flag; /* parenting flags */ /* not used */
- int id_type; /* type of parenting */
- int type; /* type of parenting */
- ID *id; /* ID block of entity to which mask/spline is parented to
- * in case of parenting to movie tracking data set to MovieClip datablock */
- char parent[64]; /* entity of parent to which parenting happened
- * in case of parenting to movie tracking data contains name of layer */
- char sub_parent[64]; /* sub-entity of parent to which parenting happened
- * in case of parenting to movie tracking data contains name of track */
- float parent_orig[2]; /* track location at the moment of parenting,
- * stored in mask space*/
-
- float parent_corners_orig[4][2]; /* Original corners of plane track at the moment of parenting */
+ //* /* Parenting flags */ /* not used. */
+ // int flag;
+ /** Type of parenting. */
+ int id_type;
+ /** Type of parenting. */
+ int type;
+ /**
+ * ID block of entity to which mask/spline is parented to
+ * in case of parenting to movie tracking data set to MovieClip datablock.
+ */
+ ID *id;
+ /**
+ * Entity of parent to which parenting happened
+ * in case of parenting to movie tracking data contains name of layer.
+ */
+ char parent[64];
+ /**
+ * Sub-entity of parent to which parenting happened
+ * in case of parenting to movie tracking data contains name of track.
+ */
+ char sub_parent[64];
+ /**
+ * Track location at the moment of parenting,
+ * stored in mask space.
+ */
+ float parent_orig[2];
+
+ /** Original corners of plane track at the moment of parenting. */
+ float parent_corners_orig[4][2];
} MaskParent;
typedef struct MaskSplinePointUW {
- float u, w; /* u coordinate along spline segment and weight of this point */
- int flag; /* different flags of this point */
+ /** U coordinate along spline segment and weight of this point. */
+ float u, w;
+ /** Different flags of this point. */
+ int flag;
} MaskSplinePointUW;
typedef struct MaskSplinePoint {
- BezTriple bezt; /* actual point coordinates and it's handles */
- int pad;
- int tot_uw; /* number of uv feather values */
- MaskSplinePointUW *uw; /* feather UV values */
- MaskParent parent; /* parenting information of particular spline point */
+ /** Actual point coordinates and it's handles . */
+ BezTriple bezt;
+ char _pad[4];
+ /** Number of uv feather values. */
+ int tot_uw;
+ /** Feather UV values. */
+ MaskSplinePointUW *uw;
+ /** Parenting information of particular spline point. */
+ MaskParent parent;
} MaskSplinePoint;
typedef struct MaskSpline {
struct MaskSpline *next, *prev;
- short flag; /* different spline flag (closed, ...) */
- char offset_mode; /* feather offset method */
- char weight_interp; /* weight interpolation */
-
- int tot_point; /* total number of points */
- MaskSplinePoint *points; /* points which defines spline itself */
- MaskParent parent; /* parenting information of the whole spline */
-
- MaskSplinePoint *points_deform; /* deformed copy of 'points' BezTriple data - not saved */
+ /** Different spline flag (closed, ...). */
+ short flag;
+ /** Feather offset method. */
+ char offset_mode;
+ /** Weight interpolation. */
+ char weight_interp;
+
+ /** Total number of points. */
+ int tot_point;
+ /** Points which defines spline itself. */
+ MaskSplinePoint *points;
+ /** Parenting information of the whole spline. */
+ MaskParent parent;
+
+ /** Deformed copy of 'points' BezTriple data - not saved. */
+ MaskSplinePoint *points_deform;
} MaskSpline;
/* one per frame */
typedef struct MaskLayerShape {
struct MaskLayerShape *next, *prev;
- float *data; /* u coordinate along spline segment and weight of this point */
- int tot_vert; /* to ensure no buffer overruns's: alloc size is (tot_vert * MASK_OBJECT_SHAPE_ELEM_SIZE) */
- int frame; /* different flags of this point */
- char flag; /* animation flag */
- char pad[7];
+ /** U coordinate along spline segment and weight of this point. */
+ float *data;
+ /** To ensure no buffer overruns's: alloc size is (tot_vert * MASK_OBJECT_SHAPE_ELEM_SIZE). */
+ int tot_vert;
+ /** Different flags of this point. */
+ int frame;
+ /** Animation flag. */
+ char flag;
+ char _pad[7];
} MaskLayerShape;
/* cast to this for convenience, not saved */
@@ -122,23 +149,29 @@ typedef struct MaskLayerShapeElem {
typedef struct MaskLayer {
struct MaskLayer *next, *prev;
- char name[64]; /* name of the mask layer (64 = MAD_ID_NAME - 2) */
+ /** Name of the mask layer (64 = MAD_ID_NAME - 2). */
+ char name[64];
- ListBase splines; /* list of splines which defines this mask layer */
+ /** List of splines which defines this mask layer. */
+ ListBase splines;
ListBase splines_shapes;
- struct MaskSpline *act_spline; /* active spline */
- struct MaskSplinePoint *act_point; /* active point */
+ /** Active spline. */
+ struct MaskSpline *act_spline;
+ /** Active point. */
+ struct MaskSplinePoint *act_point;
/* blending options */
float alpha;
char blend;
char blend_flag;
char falloff;
- char pad[7];
+ char _pad[7];
- char flag; /* for animation */
- char restrictflag; /* matching 'Object' flag of the same name - eventually use in the outliner */
+ /** For animation. */
+ char flag;
+ /** Matching 'Object' flag of the same name - eventually use in the outliner . */
+ char restrictflag;
} MaskLayer;
/* MaskParent->flag */
@@ -155,19 +188,19 @@ enum {
enum {
MASK_SPLINE_CYCLIC = (1 << 1),
MASK_SPLINE_NOFILL = (1 << 2),
- MASK_SPLINE_NOINTERSECT = (1 << 3)
+ MASK_SPLINE_NOINTERSECT = (1 << 3),
};
/* MaskSpline->weight_interp */
enum {
MASK_SPLINE_INTERP_LINEAR = 1,
- MASK_SPLINE_INTERP_EASE = 2
+ MASK_SPLINE_INTERP_EASE = 2,
};
/* MaskSpline->offset_mode */
enum {
MASK_SPLINE_OFFSET_EVEN = 0,
- MASK_SPLINE_OFFSET_SMOOTH = 1
+ MASK_SPLINE_OFFSET_SMOOTH = 1,
};
@@ -186,13 +219,13 @@ enum {
MASK_DT_OUTLINE = 0,
MASK_DT_DASH = 1,
MASK_DT_BLACK = 2,
- MASK_DT_WHITE = 3
+ MASK_DT_WHITE = 3,
};
/* MaskSpaceInfo->overlay_mode */
enum {
MASK_OVERLAY_ALPHACHANNEL = 0,
- MASK_OVERLAY_COMBINED = 1
+ MASK_OVERLAY_COMBINED = 1,
};
/* masklay->blend */
@@ -205,12 +238,12 @@ enum {
MASK_BLEND_REPLACE = 5,
MASK_BLEND_DIFFERENCE = 6,
MASK_BLEND_MERGE_ADD = 7,
- MASK_BLEND_MERGE_SUBTRACT = 8
+ MASK_BLEND_MERGE_SUBTRACT = 8,
};
/* masklay->blend_flag */
enum {
- MASK_BLENDFLAG_INVERT = (1 << 0)
+ MASK_BLENDFLAG_INVERT = (1 << 0),
};
/* masklay->flag */
@@ -225,13 +258,13 @@ enum {
/* masklay_shape->flag */
enum {
- MASK_SHAPE_SELECT = (1 << 0)
+ MASK_SHAPE_SELECT = (1 << 0),
};
/* mask->flag */
enum {
- MASK_ANIMF_EXPAND = (1 << 4)
+ MASK_ANIMF_EXPAND = (1 << 4),
};
#endif /* __DNA_MASK_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 312cb5396e1..10834768c3f 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_material_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_MATERIAL_TYPES_H__
@@ -40,45 +32,71 @@
#define MAX_MTEX 18
#endif
-struct Image;
-struct bNodeTree;
struct AnimData;
+struct Image;
struct Ipo;
+struct bNodeTree;
/* WATCH IT: change type? also make changes in ipo.h */
typedef struct TexPaintSlot {
- struct Image *ima; /* image to be painted on */
- char *uvname; /* customdata index for uv layer, MAX_NAME*/
- int valid; /* do we have a valid image and UV map */
- int pad;
+ /** Image to be painted on. */
+ struct Image *ima;
+ /** Customdata index for uv layer, MAX_NAM.E*/
+ char *uvname;
+ /** Do we have a valid image and UV map. */
+ int valid;
+ /** Copy of node inteporlation setting. */
+ int interp;
} TexPaintSlot;
typedef struct MaterialGPencilStyle {
- struct Image *sima; /* Texture image for strokes */
- struct Image *ima; /* Texture image for filling */
- float stroke_rgba[4]; /* color for paint and strokes (alpha included) */
- float fill_rgba[4]; /* color that should be used for drawing "fills" for strokes (alpha included) */
- float mix_rgba[4]; /* secondary color used for gradients and other stuff */
- short flag; /* settings */
- short index; /* custom index for passes */
- short stroke_style; /* style for drawing strokes (used to select shader type) */
- short fill_style; /* style for filling areas (used to select shader type) */
- float mix_factor; /* factor used to define shader behavior (several uses) */
- float gradient_angle; /* angle used for gradients orientation */
- float gradient_radius; /* radius for radial gradients */
- float pattern_gridsize; /* cheesboard size */
- float gradient_scale[2]; /* uv coordinates scale */
- float gradient_shift[2]; /* factor to shift filling in 2d space */
- float texture_angle; /* angle used for texture orientation */
- float texture_scale[2]; /* texture scale (separated of uv scale) */
- float texture_offset[2]; /* factor to shift texture in 2d space */
- float texture_opacity; /* texture opacity */
- float texture_pixsize; /* pixel size for uv along the stroke */
- int mode; /* drawing mode (line or dots) */
-
- int gradient_type; /* type of gradient */
- char pad[4];
+ /** Texture image for strokes. */
+ struct Image *sima;
+ /** Texture image for filling. */
+ struct Image *ima;
+ /** Color for paint and strokes (alpha included). */
+ float stroke_rgba[4];
+ /** Color that should be used for drawing "fills" for strokes (alpha included). */
+ float fill_rgba[4];
+ /** Secondary color used for gradients and other stuff. */
+ float mix_rgba[4];
+ /** Settings. */
+ short flag;
+ /** Custom index for passes. */
+ short index;
+ /** Style for drawing strokes (used to select shader type). */
+ short stroke_style;
+ /** Style for filling areas (used to select shader type). */
+ short fill_style;
+ /** Factor used to define shader behavior (several uses). */
+ float mix_factor;
+ /** Angle used for gradients orientation. */
+ float gradient_angle;
+ /** Radius for radial gradients. */
+ float gradient_radius;
+ /** Cheesboard size. */
+ float pattern_gridsize;
+ /** Uv coordinates scale. */
+ float gradient_scale[2];
+ /** Factor to shift filling in 2d space. */
+ float gradient_shift[2];
+ /** Angle used for texture orientation. */
+ float texture_angle;
+ /** Texture scale (separated of uv scale). */
+ float texture_scale[2];
+ /** Factor to shift texture in 2d space. */
+ float texture_offset[2];
+ /** Texture opacity. */
+ float texture_opacity;
+ /** Pixel size for uv along the stroke. */
+ float texture_pixsize;
+ /** Drawing mode (line or dots). */
+ int mode;
+
+ /** Type of gradient. */
+ int gradient_type;
+ char _pad[4];
} MaterialGPencilStyle;
/* MaterialGPencilStyle->flag */
@@ -102,7 +120,7 @@ typedef enum eMaterialGPencilStyle_Flag {
/* Stroke show main switch */
GP_STYLE_STROKE_SHOW = (1 << 8),
/* Fill show main switch */
- GP_STYLE_FILL_SHOW = (1 << 9)
+ GP_STYLE_FILL_SHOW = (1 << 9),
} eMaterialGPencilStyle_Flag;
typedef enum eMaterialGPencilStyle_Mode {
@@ -113,30 +131,34 @@ typedef enum eMaterialGPencilStyle_Mode {
typedef struct Material {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
- short flag, pad1[7];
+ short flag;
+ char _pad1[2];
/* Colors from Blender Internal that we are still using. */
- float r, g, b;
+ float r, g, b, a;
float specr, specg, specb;
float alpha DNA_DEPRECATED;
float ray_mirror DNA_DEPRECATED;
float spec;
- float gloss_mir DNA_DEPRECATED; /* renamed and inversed to roughness */
+ /** Renamed and inversed to roughness. */
+ float gloss_mir DNA_DEPRECATED;
float roughness;
float metallic;
- float pad4[2];
+ char _pad0[2];
- /* Ror buttons and render. */
+ /** For buttons and render. */
char pr_type, use_nodes;
- short pr_lamp, pr_texture;
+ short pr_texture;
- /* Index for render passes. */
+ /** Index for render passes. */
short index;
struct bNodeTree *nodetree;
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
struct PreviewImage *preview;
/* Freestyle line settings. */
@@ -148,7 +170,7 @@ typedef struct Material {
short paint_active_slot;
short paint_clone_slot;
short tot_slots;
- short pad2[3];
+ char _pad2[2];
/* Transparency. */
float alpha_threshold;
@@ -156,30 +178,32 @@ typedef struct Material {
char blend_method;
char blend_shadow;
char blend_flag;
- char pad3[5];
+ char _pad3[1];
- /* Cached slots for texture painting, must be refreshed in
- * refresh_texpaint_image_cache before using. */
+ /**
+ * Cached slots for texture painting, must be refreshed in
+ * refresh_texpaint_image_cache before using.
+ */
struct TexPaintSlot *texpaintslot;
- /* Runtime cache for GLSL materials. */
+ /** Runtime cache for GLSL materials. */
ListBase gpumaterial;
- /* grease pencil color */
+ /** Grease pencil color. */
struct MaterialGPencilStyle *gp_style;
} Material;
/* **************** MATERIAL ********************* */
/* maximum number of materials per material array.
- * (on object, mesh, lamp, etc.). limited by
+ * (on object, mesh, light, etc.). limited by
* short mat_nr in verts, faces.
* -1 because for active material we store the index + 1 */
#define MAXMAT (32767-1)
/* flag */
/* for render */
-#define MA_IS_USED (1 << 0)
+/* #define MA_IS_USED (1 << 0) */ /* UNUSED */
/* for dopesheet */
#define MA_DS_EXPAND (1 << 1)
/* for dopesheet (texture stack expander)
@@ -210,23 +234,24 @@ typedef struct Material {
/* texco */
#define TEXCO_ORCO (1 << 0)
-#define TEXCO_REFL (1 << 1)
-#define TEXCO_NORM (1 << 2)
+/* #define TEXCO_REFL (1 << 1) */ /* deprecated */
+/* #define TEXCO_NORM (1 << 2) */ /* deprecated */
#define TEXCO_GLOB (1 << 3)
#define TEXCO_UV (1 << 4)
#define TEXCO_OBJECT (1 << 5)
-#define TEXCO_LAVECTOR (1 << 6)
-#define TEXCO_VIEW (1 << 7)
-#define TEXCO_STICKY_ (1 << 8) // DEPRECATED
-#define TEXCO_OSA (1 << 9)
+/* #define TEXCO_LAVECTOR (1 << 6) */ /* deprecated */
+/* #define TEXCO_VIEW (1 << 7) */ /* deprecated */
+/* #define TEXCO_STICKY (1 << 8) */ /* deprecated */
+/* #define TEXCO_OSA (1 << 9) */ /* deprecated */
#define TEXCO_WINDOW (1 << 10)
-#define NEED_UV (1 << 11)
-#define TEXCO_TANGENT (1 << 12)
+/* #define NEED_UV (1 << 11) */ /* deprecated */
+/* #define TEXCO_TANGENT (1 << 12) */ /* deprecated */
/* still stored in vertex->accum, 1 D */
#define TEXCO_STRAND (1 << 13)
-#define TEXCO_PARTICLE (1 << 13) /* strand is used for normal materials, particle for halo materials */
-#define TEXCO_STRESS (1 << 14)
-#define TEXCO_SPEED (1 << 15)
+/** strand is used for normal materials, particle for halo materials */
+#define TEXCO_PARTICLE (1 << 13)
+/* #define TEXCO_STRESS (1 << 14) */ /* deprecated */
+/* #define TEXCO_SPEED (1 << 15) */ /* deprecated */
/* mapto */
#define MAP_COL (1 << 0)
@@ -291,7 +316,7 @@ enum {
/* Grease Pencil Stroke styles */
enum {
GP_STYLE_STROKE_STYLE_SOLID = 0,
- GP_STYLE_STROKE_STYLE_TEXTURE
+ GP_STYLE_STROKE_STYLE_TEXTURE,
};
/* Grease Pencil Fill styles */
@@ -299,13 +324,13 @@ enum {
GP_STYLE_FILL_STYLE_SOLID = 0,
GP_STYLE_FILL_STYLE_GRADIENT,
GP_STYLE_FILL_STYLE_CHESSBOARD,
- GP_STYLE_FILL_STYLE_TEXTURE
+ GP_STYLE_FILL_STYLE_TEXTURE,
};
/* Grease Pencil Gradient Types */
enum {
GP_STYLE_GRADIENT_LINEAR = 0,
- GP_STYLE_GRADIENT_RADIAL
+ GP_STYLE_GRADIENT_RADIAL,
};
#endif
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index 9a91d3a0998..956fee97d40 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_mesh_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_MESH_TYPES_H__
@@ -73,8 +65,9 @@ typedef struct EditMeshData {
* \warning Typical access is done via #BKE_mesh_runtime_looptri_ensure, #BKE_mesh_runtime_looptri_len.
*/
struct MLoopTri_Store {
- /* WARNING! swapping between array (ready-to-be-used data) and array_wip (where data is actually computed)
- * shall always be protected by same lock as one used for looptris computing. */
+ /* WARNING! swapping between array (ready-to-be-used data) and array_wip
+ * (where data is actually computed)
+ * shall always be protected by same lock as one used for looptris computing. */
struct MLoopTri *array, *array_wip;
int len;
int len_alloc;
@@ -86,9 +79,9 @@ typedef struct Mesh_Runtime {
void *batch_cache;
struct SubdivCCG *subdiv_ccg;
- void *pad1;
+ void *_pad1;
int subdiv_ccg_tot_level;
- int pad2;
+ char _pad2[4];
int64_t cd_dirty_vert;
int64_t cd_dirty_edge;
@@ -110,16 +103,18 @@ typedef struct Mesh_Runtime {
* In the future we may leave the mesh-data empty
* since its not needed if we can use edit-mesh data. */
char is_original;
- char padding[6];
+ char _pad[6];
} Mesh_Runtime;
typedef struct Mesh {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
struct BoundBox *bb;
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
struct Key *key;
struct Material **mat;
struct MSelect *mselect;
@@ -134,12 +129,18 @@ typedef struct Mesh {
/* mface stores the tessellation (triangulation) of the mesh,
* real faces are now stored in nface.*/
- struct MFace *mface; /* array of mesh object mode faces for tessellation */
- struct MTFace *mtface; /* store tessellation face UV's and texture here */
- struct TFace *tface DNA_DEPRECATED; /* deprecated, use mtface */
- struct MVert *mvert; /* array of verts */
- struct MEdge *medge; /* array of edges */
- struct MDeformVert *dvert; /* deformgroup vertices */
+ /** Array of mesh object mode faces for tessellation. */
+ struct MFace *mface;
+ /** Store tessellation face UV's and texture here. */
+ struct MTFace *mtface;
+ /** Deprecated, use mtface. */
+ struct TFace *tface DNA_DEPRECATED;
+ /** Array of verts. */
+ struct MVert *mvert;
+ /** Array of edges. */
+ struct MEdge *medge;
+ /** Deformgroup vertices. */
+ struct MDeformVert *dvert;
/* array of colors for the tessellated faces, must be number of tessellated
* faces * 4 in length */
@@ -147,7 +148,8 @@ typedef struct Mesh {
struct Mesh *texcomesh;
/* When the object is available, the preferred access method is: BKE_editmesh_from_object(ob) */
- struct BMEditMesh *edit_btmesh; /* not saved in file! */
+ /** Not saved in file!. */
+ struct BMEditMesh *edit_mesh;
struct CustomData vdata, edata, fdata;
@@ -176,15 +178,17 @@ typedef struct Mesh {
float smoothresh;
/* customdata flag, for bevel-weight and crease, which are now optional */
- char cd_flag, pad;
+ char cd_flag, _pad;
char subdiv DNA_DEPRECATED, subdivr DNA_DEPRECATED;
- char subsurftype DNA_DEPRECATED; /* only kept for backwards compat, not used anymore */
+ /** Only kept for backwards compat, not used anymore. */
+ char subsurftype DNA_DEPRECATED;
char editflag;
short totcol;
- struct Multires *mr DNA_DEPRECATED; /* deprecated multiresolution modeling data, only keep for loading old files */
+ /** Deprecated multiresolution modeling data, only keep for loading old files. */
+ struct Multires *mr DNA_DEPRECATED;
Mesh_Runtime runtime;
} Mesh;
@@ -192,7 +196,8 @@ typedef struct Mesh {
/* deprecated by MTFace, only here for file reading */
#ifdef DNA_DEPRECATED
typedef struct TFace {
- void *tpage; /* the faces image for the active UVLayer */
+ /** The faces image for the active UVLayer. */
+ void *tpage;
float uv[4][2];
unsigned int col[4];
char flag, transp;
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index 8525f9d0334..9ed879d10c5 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_meshdata_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_MESHDATA_TYPES_H__
@@ -41,7 +33,8 @@ struct Image;
typedef struct MFace {
unsigned int v1, v2, v3, v4;
short mat_nr;
- char edcode, flag; /* we keep edcode, for conversion to edges draw flags in old files */
+ /** We keep edcode, for conversion to edges draw flags in old files. */
+ char edcode, flag;
} MFace;
typedef struct MEdge {
@@ -58,7 +51,8 @@ typedef struct MDeformWeight {
typedef struct MDeformVert {
struct MDeformWeight *dw;
int totweight;
- int flag; /* flag only in use for weightpaint now */
+ /** Flag only in use for weightpaint now. */
+ int flag;
} MDeformVert;
typedef struct MVert {
@@ -78,15 +72,18 @@ typedef struct MCol {
typedef struct MPoly {
/* offset into loop array and number of loops in the face */
int loopstart;
- int totloop; /* keep signed since we need to subtract when getting the previous loop */
+ /** Keep signed since we need to subtract when getting the previous loop. */
+ int totloop;
short mat_nr;
- char flag, pad;
+ char flag, _pad;
} MPoly;
/* the e here is because we want to move away from relying on edge hashes.*/
typedef struct MLoop {
- unsigned int v; /* vertex index */
- unsigned int e; /* edge index */
+ /** Vertex index. */
+ unsigned int v;
+ /** Edge index. */
+ unsigned int e;
} MLoop;
/**
@@ -187,7 +184,7 @@ typedef struct MVertTri {
} MVertTri;
//typedef struct MTexPoly {
-// void *pad;
+// void *_pad;
//} MTexPoly;
typedef struct MLoopUV {
@@ -237,7 +234,8 @@ typedef struct MLoopCol {
typedef struct MSelect {
int index;
- int type; /* ME_VSEL/ME_ESEL/ME_FSEL */
+ /** ME_VSEL/ME_ESEL/ME_FSEL. */
+ int type;
} MSelect;
/*tessellation uv face data*/
@@ -270,8 +268,11 @@ typedef struct MDisps {
int level;
float (*disps)[3];
- /* Used for hiding parts of a multires mesh. Essentially the multires equivalent of MVert.flag's ME_HIDE bit.
- * NOTE: This is a bitmap, keep in sync with type used in BLI_bitmap.h
+ /**
+ * Used for hiding parts of a multires mesh.
+ * Essentially the multires equivalent of MVert.flag's ME_HIDE bit.
+ *
+ * \note This is a bitmap, keep in sync with type used in BLI_bitmap.h
*/
unsigned int *hidden;
} MDisps;
@@ -289,7 +290,7 @@ typedef struct MultiresColFace {
typedef struct MultiresFace {
unsigned int v[4];
unsigned int mid;
- char flag, mat_nr, pad[2];
+ char flag, mat_nr, _pad[2];
} MultiresFace;
typedef struct MultiresEdge {
@@ -304,7 +305,8 @@ typedef struct MultiresLevel {
MultiresColFace *colfaces;
MultiresEdge *edges;
- unsigned int totvert, totface, totedge, pad;
+ unsigned int totvert, totface, totedge;
+ char _pad[4];
/* Kept for compatibility with even older files */
MVert *verts;
@@ -337,23 +339,24 @@ typedef struct GridPaintMask {
/* The maximum multires level associated with this grid */
unsigned int level;
- int pad;
+ char _pad[4];
} GridPaintMask;
typedef enum eMVertSkinFlag {
- /* Marks a vertex as the edge-graph root, used for calculating rotations for all connected edges (recursively).
- * Also used to choose a root when generating an armature.
+ /** Marks a vertex as the edge-graph root, used for calculating rotations for all connected
+ * edges (recursively). Also used to choose a root when generating an armature.
*/
MVERT_SKIN_ROOT = 1,
- /* Marks a branch vertex (vertex with more than two connected edges), so that it's neighbors are
- * directly hulled together, rather than the default of generating intermediate frames.
+ /** Marks a branch vertex (vertex with more than two connected edges), so that it's neighbors
+ * are directly hulled together, rather than the default of generating intermediate frames.
*/
MVERT_SKIN_LOOSE = 2,
} eMVertSkinFlag;
typedef struct MVertSkin {
- /* Radii of the skin, define how big the generated frames are. Currently only the first two elements are used. */
+ /* Radii of the skin, define how big the generated frames are.
+ * Currently only the first two elements are used. */
float radius[3];
/* eMVertSkinFlag */
@@ -362,7 +365,7 @@ typedef struct MVertSkin {
typedef struct FreestyleEdge {
char flag;
- char pad[3];
+ char _pad[3];
} FreestyleEdge;
/* FreestyleEdge->flag */
@@ -372,7 +375,7 @@ enum {
typedef struct FreestyleFace {
char flag;
- char pad[3];
+ char _pad[3];
} FreestyleFace;
/* FreestyleFace->flag */
diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h
index 3f0b1b302c7..f5bc9ef383a 100644
--- a/source/blender/makesdna/DNA_meta_types.h
+++ b/source/blender/makesdna/DNA_meta_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_meta_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_META_TYPES_H__
@@ -36,8 +28,8 @@
#include "DNA_listBase.h"
#include "DNA_ID.h"
-struct BoundBox;
struct AnimData;
+struct BoundBox;
struct Ipo;
struct Material;
@@ -45,21 +37,30 @@ struct Material;
typedef struct MetaElem {
struct MetaElem *next, *prev;
- struct BoundBox *bb; /* Bound Box of MetaElem */
+ /** Bound Box of MetaElem. */
+ struct BoundBox *bb;
short type, flag;
- short pad[2];
- float x, y, z; /* Position of center of MetaElem */
- float quat[4]; /* Rotation of MetaElem (MUST be kept normalized) */
- float expx; /* dimension parameters, used for some types like cubes */
+ char _pad[4];
+ /** Position of center of MetaElem. */
+ float x, y, z;
+ /** Rotation of MetaElem (MUST be kept normalized). */
+ float quat[4];
+ /** Dimension parameters, used for some types like cubes. */
+ float expx;
float expy;
float expz;
- float rad; /* radius of the meta element */
- float rad2; /* temp field, used only while processing */
- float s; /* stiffness, how much of the element to fill */
- float len; /* old, only used for backwards compat. use dimensions now */
-
- float *mat, *imat; /* matrix and inverted matrix */
+ /** Radius of the meta element. */
+ float rad;
+ /** Temp field, used only while processing. */
+ float rad2;
+ /** Stiffness, how much of the element to fill. */
+ float s;
+ /** Old, only used for backwards compat. use dimensions now. */
+ float len;
+
+ /** Matrix and inverted matrix. */
+ float *mat, *imat;
} MetaElem;
typedef struct MetaBall {
@@ -68,22 +69,28 @@ typedef struct MetaBall {
ListBase elems;
ListBase disp;
- ListBase *editelems; /* not saved in files, note we use pointer for editmode check */
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** Not saved in files, note we use pointer for editmode check. */
+ ListBase *editelems;
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
/* material of the mother ball will define the material used of all others */
struct Material **mat;
- char flag, flag2; /* flag is enum for updates, flag2 is bitflags for settings */
+ /** Flag is enum for updates, flag2 is bitflags for settings. */
+ char flag, flag2;
short totcol;
- short texflag, pad; /* used to store MB_AUTOSPACE */
+ /** Used to store MB_AUTOSPACE. */
+ short texflag;
+ char _pad[2];
/* texture space, copied as one block in editobject.c */
float loc[3];
float size[3];
float rot[3];
- float wiresize, rendersize; /* display and render res */
+ /** Display and render res. */
+ float wiresize, rendersize;
/* bias elements to have an offset volume.
* mother ball changes will effect other objects thresholds,
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 1759022c296..92511f2f396 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_modifier_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_MODIFIER_TYPES_H__
@@ -34,6 +30,7 @@
struct Mesh;
struct Scene;
+struct Subdiv;
typedef enum ModifierType {
eModifierType_None = 0,
@@ -112,8 +109,9 @@ typedef struct ModifierData {
int type, mode;
int stackindex;
short flag;
- short pad;
- char name[64]; /* MAX_NAME */
+ char _pad[2];
+ /** MAX_NAME. */
+ char name[64];
char *error;
} ModifierData;
@@ -131,7 +129,8 @@ typedef struct MappingInfoModifierData {
struct Tex *texture;
struct Object *map_object;
- char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char uvlayer_name[64];
int uvlayer_tmp;
int texmapping;
} MappingInfoModifierData;
@@ -164,27 +163,33 @@ typedef struct SubsurfModifierData {
short subdivType, levels, renderLevels, flags;
short uv_smooth;
short quality;
- short pad[2];
+ char _pad[4];
+ /* TODO(sergey): Get rid of those with the old CCG subdivision code. */
void *emCache, *mCache;
+ /* Cached subdivision surface descriptor, with topology and settings. */
+ struct Subdiv *subdiv;
} SubsurfModifierData;
typedef struct LatticeModifierData {
ModifierData modifier;
struct Object *object;
- char name[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char name[64];
float strength;
- char pad[4];
+ char _pad[4];
} LatticeModifierData;
typedef struct CurveModifierData {
ModifierData modifier;
struct Object *object;
- char name[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- short defaxis; /* axis along which curve deforms */
- char pad[6];
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char name[64];
+ /** Axis along which curve deforms. */
+ short defaxis;
+ char _pad[6];
} CurveModifierData;
/* CurveModifierData->defaxis */
@@ -203,25 +208,33 @@ typedef struct BuildModifierData {
float start, length;
short flag;
- short randomize; /* (bool) whether order of vertices is randomized - legacy files (for readfile conversion) */
- int seed; /* (int) random seed */
+ /** (bool) whether order of vertices is randomized - legacy files (for readfile conversion). */
+ short randomize;
+ /** (int) random seed. */
+ int seed;
} BuildModifierData;
/* Build Modifier -> flag */
enum {
- MOD_BUILD_FLAG_RANDOMIZE = (1 << 0), /* order of vertices is randomized */
- MOD_BUILD_FLAG_REVERSE = (1 << 1), /* frame range is reversed, resulting in a deconstruction effect */
+ /** order of vertices is randomized */
+ MOD_BUILD_FLAG_RANDOMIZE = (1 << 0),
+ /** frame range is reversed, resulting in a deconstruction effect */
+ MOD_BUILD_FLAG_REVERSE = (1 << 1),
};
/* Mask Modifier */
typedef struct MaskModifierData {
ModifierData modifier;
- struct Object *ob_arm; /* armature to use to in place of hardcoded vgroup */
- char vgroup[64]; /* name of vertex group to use to mask, MAX_VGROUP_NAME */
+ /** Armature to use to in place of hardcoded vgroup. */
+ struct Object *ob_arm;
+ /** Name of vertex group to use to mask, MAX_VGROUP_NAME. */
+ char vgroup[64];
- short mode; /* using armature or hardcoded vgroup */
- short flag; /* flags for various things */
+ /** Using armature or hardcoded vgroup. */
+ short mode;
+ /** Flags for various things. */
+ short flag;
float threshold;
} MaskModifierData;
@@ -304,7 +317,8 @@ enum {
typedef struct MirrorModifierData {
ModifierData modifier;
- short axis DNA_DEPRECATED; /* deprecated, use flag instead */
+ /** Deprecated, use flag instead. */
+ short axis DNA_DEPRECATED;
short flag;
float tolerance;
float uv_offset[2];
@@ -333,7 +347,8 @@ enum {
typedef struct EdgeSplitModifierData {
ModifierData modifier;
- float split_angle; /* angle above which edges should be split */
+ /** Angle above which edges should be split. */
+ float split_angle;
int flags;
} EdgeSplitModifierData;
@@ -343,47 +358,53 @@ enum {
MOD_EDGESPLIT_FROMFLAG = (1 << 2),
};
-typedef struct BevelModNorEditData {
- struct GHash *faceHash;
-} BevelModNorEditData;
-
typedef struct BevelModifierData {
ModifierData modifier;
- float value; /* the "raw" bevel value (distance/amount to bevel) */
- int res; /* the resolution (as originally coded, it is the number of recursive bevels) */
- short flags; /* general option flags */
- short val_flags; /* used to interpret the bevel value */
- short lim_flags; /* flags to tell the tool how to limit the bevel */
- short e_flags; /* flags to direct how edge weights are applied to verts */
- short mat; /* material index if >= 0, else material inherited from surrounding faces */
+ /** The "raw" bevel value (distance/amount to bevel). */
+ float value;
+ /** The resolution (as originally coded, it is the number of recursive bevels). */
+ int res;
+ /** General option flags. */
+ short flags;
+ /** Used to interpret the bevel value. */
+ short val_flags;
+ /** Flags to tell the tool how to limit the bevel. */
+ short lim_flags;
+ /** Flags to direct how edge weights are applied to verts. */
+ short e_flags;
+ /** Material index if >= 0, else material inherited from surrounding faces. */
+ short mat;
short edge_flags;
short face_str_mode;
- short pad2;
- float profile; /* controls profile shape (0->1, .5 is round) */
- /* if the MOD_BEVEL_ANGLE is set, this will be how "sharp" an edge must be before it gets beveled */
+ /* patterns to use for mitering non-reflex and reflex miter edges */
+ short miter_inner;
+ short miter_outer;
+ char _pad0[2];
+ /** Controls profile shape (0->1, .5 is round). */
+ float profile;
+ /** if the MOD_BEVEL_ANGLE is set,
+ * this will be how "sharp" an edge must be before it gets beveled */
float bevel_angle;
- /* if the MOD_BEVEL_VWEIGHT option is set, this will be the name of the vert group, MAX_VGROUP_NAME */
+ float spread;
+ /** if the MOD_BEVEL_VWEIGHT option is set,
+ * this will be the name of the vert group, MAX_VGROUP_NAME */
char defgrp_name[64];
- struct BevelModNorEditData clnordata;
} BevelModifierData;
/* BevelModifierData->flags and BevelModifierData->lim_flags */
enum {
MOD_BEVEL_VERT = (1 << 1),
-/* MOD_BEVEL_RADIUS = (1 << 2), */
+/* unused = (1 << 2), */
MOD_BEVEL_ANGLE = (1 << 3),
MOD_BEVEL_WEIGHT = (1 << 4),
MOD_BEVEL_VGROUP = (1 << 5),
- MOD_BEVEL_EMIN = (1 << 7),
- MOD_BEVEL_EMAX = (1 << 8),
-/* MOD_BEVEL_RUNNING = (1 << 9), */
-/* MOD_BEVEL_RES = (1 << 10), */
- /* This is a new setting not related to old (trunk bmesh bevel code)
- * but adding here because they are mixed - campbell
- */
-/* MOD_BEVEL_EVEN = (1 << 11), */
-/* MOD_BEVEL_DIST = (1 << 12), */ /* same as above */
+/* unused = (1 << 7), */
+/* unused = (1 << 8), */
+/* unused = (1 << 9), */
+/* unused = (1 << 10), */
+/* unused = (1 << 11), */
+/* unused = (1 << 12), */
MOD_BEVEL_OVERLAP_OK = (1 << 13),
MOD_BEVEL_EVEN_WIDTHS = (1 << 14),
MOD_BEVEL_HARDEN_NORMALS = (1 << 15),
@@ -411,14 +432,24 @@ enum {
MOD_BEVEL_FACE_STRENGTH_ALL,
};
+/* BevelModifier->miter_inner and ->miter_outer */
+enum {
+ MOD_BEVEL_MITER_SHARP,
+ MOD_BEVEL_MITER_PATCH,
+ MOD_BEVEL_MITER_ARC,
+};
+
typedef struct SmokeModifierData {
ModifierData modifier;
struct SmokeDomainSettings *domain;
- struct SmokeFlowSettings *flow; /* inflow, outflow, smoke objects */
- struct SmokeCollSettings *coll; /* collision objects */
+ /** Inflow, outflow, smoke objects. */
+ struct SmokeFlowSettings *flow;
+ /** Collision objects. */
+ struct SmokeCollSettings *coll;
float time;
- int type; /* domain, inflow, outflow, ... */
+ /** Domain, inflow, outflow, .... */
+ int type;
} SmokeModifierData;
/* Smoke modifier flags */
@@ -434,14 +465,16 @@ typedef struct DisplaceModifierData {
/* keep in sync with MappingInfoModifierData */
struct Tex *texture;
struct Object *map_object;
- char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char uvlayer_name[64];
int uvlayer_tmp;
int texmapping;
/* end MappingInfoModifierData */
float strength;
int direction;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
float midlevel;
int space;
} DisplaceModifierData;
@@ -474,13 +507,16 @@ typedef struct UVProjectModifierData {
ModifierData modifier;
/* the objects which do the projecting */
- struct Object *projectors[10]; /* MOD_UVPROJECT_MAXPROJECTORS */
- int pad2;
+ /** MOD_UVPROJECT_MAXPROJECTORS. */
+ struct Object *projectors[10];
+ char _pad2[4];
int num_projectors;
float aspectx, aspecty;
float scalex, scaley;
- char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
- int uvlayer_tmp, pad;
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char uvlayer_name[64];
+ int uvlayer_tmp;
+ char _pad[4];
} UVProjectModifierData;
#define MOD_UVPROJECT_MAXPROJECTORS 10
@@ -493,13 +529,19 @@ enum {
typedef struct DecimateModifierData {
ModifierData modifier;
- float percent; /* (mode == MOD_DECIM_MODE_COLLAPSE) */
- short iter; /* (mode == MOD_DECIM_MODE_UNSUBDIV) */
- char delimit; /* (mode == MOD_DECIM_MODE_DISSOLVE) */
- char symmetry_axis; /* (mode == MOD_DECIM_MODE_COLLAPSE) */
- float angle; /* (mode == MOD_DECIM_MODE_DISSOLVE) */
+ /** (mode == MOD_DECIM_MODE_COLLAPSE). */
+ float percent;
+ /** (mode == MOD_DECIM_MODE_UNSUBDIV). */
+ short iter;
+ /** (mode == MOD_DECIM_MODE_DISSOLVE). */
+ char delimit;
+ /** (mode == MOD_DECIM_MODE_COLLAPSE). */
+ char symmetry_axis;
+ /** (mode == MOD_DECIM_MODE_DISSOLVE). */
+ float angle;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
float defgrp_factor;
short flag, mode;
@@ -509,21 +551,25 @@ typedef struct DecimateModifierData {
enum {
MOD_DECIM_FLAG_INVERT_VGROUP = (1 << 0),
- MOD_DECIM_FLAG_TRIANGULATE = (1 << 1), /* for collapse only. dont convert tri pairs back to quads */
- MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS = (1 << 2), /* for dissolve only. collapse all verts between 2 faces */
+ /** for collapse only. dont convert tri pairs back to quads */
+ MOD_DECIM_FLAG_TRIANGULATE = (1 << 1),
+ /** for dissolve only. collapse all verts between 2 faces */
+ MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS = (1 << 2),
MOD_DECIM_FLAG_SYMMETRY = (1 << 3),
};
enum {
MOD_DECIM_MODE_COLLAPSE,
MOD_DECIM_MODE_UNSUBDIV,
- MOD_DECIM_MODE_DISSOLVE, /* called planar in the UI */
+ /** called planar in the UI */
+ MOD_DECIM_MODE_DISSOLVE,
};
typedef struct SmoothModifierData {
ModifierData modifier;
float fac;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
short flag, repeat;
} SmoothModifierData;
@@ -542,7 +588,8 @@ typedef struct CastModifierData {
float fac;
float radius;
float size;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
short flag, type;
} CastModifierData;
@@ -569,21 +616,24 @@ typedef struct WaveModifierData {
/* keep in sync with MappingInfoModifierData */
struct Tex *texture;
struct Object *map_object;
- char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char uvlayer_name[64];
int uvlayer_tmp;
int texmapping;
/* end MappingInfoModifierData */
struct Object *objectcenter;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
- short flag, pad;
+ short flag;
+ char _pad[2];
float startx, starty, height, width;
float narrow, speed, damp, falloff;
float timeoffs, lifetime;
- float pad1;
+ char _pad1[4];
} WaveModifierData;
/* WaveModifierData.flag */
@@ -601,11 +651,14 @@ enum {
typedef struct ArmatureModifierData {
ModifierData modifier;
- short deformflag, multi; /* deformflag replaces armature->deformflag */
- int pad2;
+ /** Deformflag replaces armature->deformflag. */
+ short deformflag, multi;
+ char _pad2[4];
struct Object *object;
- float *prevCos; /* stored input of previous modifier, for vertexgroup blending */
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ /** Stored input of previous modifier, for vertexgroup blending. */
+ float *prevCos;
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
} ArmatureModifierData;
enum {
@@ -630,21 +683,28 @@ typedef struct HookModifierData {
ModifierData modifier;
struct Object *object;
- char subtarget[64]; /* optional name of bone target, MAX_ID_NAME-2 */
+ /** Optional name of bone target, MAX_ID_NAME-2. */
+ char subtarget[64];
char flag;
- char falloff_type; /* use enums from WarpModifier (exact same functionality) */
- char pad[6];
- float parentinv[4][4]; /* matrix making current transform unmodified */
- float cent[3]; /* visualization of hook */
- float falloff; /* if not zero, falloff is distance where influence zero */
+ /** Use enums from WarpModifier (exact same functionality). */
+ char falloff_type;
+ char _pad[6];
+ /** Matrix making current transform unmodified. */
+ float parentinv[4][4];
+ /** Visualization of hook. */
+ float cent[3];
+ /** If not zero, falloff is distance where influence zero. */
+ float falloff;
struct CurveMapping *curfalloff;
- int *indexar; /* if NULL, it's using vertexgroup */
+ /** If NULL, it's using vertexgroup. */
+ int *indexar;
int totindex;
float force;
- char name[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char name[64];
} HookModifierData;
typedef struct SoftbodyModifierData {
@@ -654,13 +714,17 @@ typedef struct SoftbodyModifierData {
typedef struct ClothModifierData {
ModifierData modifier;
- struct Cloth *clothObject; /* The internal data structure for cloth. */
- struct ClothSimSettings *sim_parms; /* definition is in DNA_cloth_types.h */
- struct ClothCollSettings *coll_parms; /* definition is in DNA_cloth_types.h */
+ /** The internal data structure for cloth. */
+ struct Cloth *clothObject;
+ /** Definition is in DNA_cloth_types.h. */
+ struct ClothSimSettings *sim_parms;
+ /** Definition is in DNA_cloth_types.h. */
+ struct ClothCollSettings *coll_parms;
/* PointCache can be shared with other instances of ClothModifierData.
* Inspect (modifier.flag & eModifierFlag_SharedCaches) to find out. */
- struct PointCache *point_cache; /* definition is in DNA_object_force_types.h */
+ /** Definition is in DNA_object_force_types.h. */
+ struct PointCache *point_cache;
struct ListBase ptcaches;
/* XXX nasty hack, remove once hair can be separated from cloth modifier data */
@@ -677,33 +741,45 @@ typedef struct ClothModifierData {
typedef struct CollisionModifierData {
ModifierData modifier;
- struct MVert *x; /* position at the beginning of the frame */
- struct MVert *xnew; /* position at the end of the frame */
- struct MVert *xold; /* unused atm, but was discussed during sprint */
- struct MVert *current_xnew; /* new position at the actual inter-frame step */
- struct MVert *current_x; /* position at the actual inter-frame step */
- struct MVert *current_v; /* (xnew - x) at the actual inter-frame step */
+ /** Position at the beginning of the frame. */
+ struct MVert *x;
+ /** Position at the end of the frame. */
+ struct MVert *xnew;
+ /** Unused atm, but was discussed during sprint. */
+ struct MVert *xold;
+ /** New position at the actual inter-frame step. */
+ struct MVert *current_xnew;
+ /** Position at the actual inter-frame step. */
+ struct MVert *current_x;
+ /** (xnew - x) at the actual inter-frame step. */
+ struct MVert *current_v;
struct MVertTri *tri;
unsigned int mvert_num;
unsigned int tri_num;
- float time_x, time_xnew; /* cfra time of modifier */
- char is_static; /* collider doesn't move this frame, i.e. x[].co==xnew[].co */
- char pad[7];
-
- struct BVHTree *bvhtree; /* bounding volume hierarchy for this cloth object */
+ /** Cfra time of modifier. */
+ float time_x, time_xnew;
+ /** Collider doesn't move this frame, i.e. x[].co==xnew[].co. */
+ char is_static;
+ char _pad[7];
+
+ /** Bounding volume hierarchy for this cloth object. */
+ struct BVHTree *bvhtree;
} CollisionModifierData;
typedef struct SurfaceModifierData {
ModifierData modifier;
- struct MVert *x; /* old position */
- struct MVert *v; /* velocity */
+ /** Old position. */
+ struct MVert *x;
+ /** Velocity. */
+ struct MVert *v;
struct Mesh *mesh;
- struct BVHTreeFromMesh *bvhtree; /* bounding volume hierarchy of the mesh faces */
+ /** Bounding volume hierarchy of the mesh faces. */
+ struct BVHTreeFromMesh *bvhtree;
int cfra, numverts;
} SurfaceModifierData;
@@ -713,7 +789,7 @@ typedef struct BooleanModifierData {
struct Object *object;
char operation;
- char pad[2];
+ char _pad[2];
char bm_flag;
float double_threshold;
} BooleanModifierData;
@@ -744,30 +820,47 @@ typedef struct MDefCell {
typedef struct MeshDeformModifierData {
ModifierData modifier;
- struct Object *object; /* mesh object */
- char defgrp_name[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
+ /** Mesh object. */
+ struct Object *object;
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char defgrp_name[64];
- short gridsize, flag, pad[2];
+ short gridsize, flag;
+ char _pad[4];
/* result of static binding */
- MDefInfluence *bindinfluences; /* influences */
- int *bindoffsets; /* offsets into influences array */
- float *bindcagecos; /* coordinates that cage was bound with */
- int totvert, totcagevert; /* total vertices in mesh and cage */
+ /** Influences. */
+ MDefInfluence *bindinfluences;
+ /** Offsets into influences array. */
+ int *bindoffsets;
+ /** Coordinates that cage was bound with. */
+ float *bindcagecos;
+ /** Total vertices in mesh and cage. */
+ int totvert, totcagevert;
/* result of dynamic binding */
- MDefCell *dyngrid; /* grid with dynamic binding cell points */
- MDefInfluence *dyninfluences; /* dynamic binding vertex influences */
- int *dynverts; /* is this vertex bound or not? */
- int dyngridsize; /* size of the dynamic bind grid */
- int totinfluence; /* total number of vertex influences */
- float dyncellmin[3]; /* offset of the dynamic bind grid */
- float dyncellwidth; /* width of dynamic bind cell */
- float bindmat[4][4]; /* matrix of cage at binding time */
+ /** Grid with dynamic binding cell points. */
+ MDefCell *dyngrid;
+ /** Dynamic binding vertex influences. */
+ MDefInfluence *dyninfluences;
+ /** Is this vertex bound or not?. */
+ int *dynverts;
+ /** Size of the dynamic bind grid. */
+ int dyngridsize;
+ /** Total number of vertex influences. */
+ int totinfluence;
+ /** Offset of the dynamic bind grid. */
+ float dyncellmin[3];
+ /** Width of dynamic bind cell. */
+ float dyncellwidth;
+ /** Matrix of cage at binding time. */
+ float bindmat[4][4];
/* deprecated storage */
- float *bindweights; /* deprecated inefficient storage */
- float *bindcos; /* deprecated storage of cage coords */
+ /** Deprecated inefficient storage. */
+ float *bindweights;
+ /** Deprecated storage of cage coords. */
+ float *bindcos;
/* runtime */
void (*bindfunc)(struct MeshDeformModifierData *mmd, struct Mesh *cagemesh,
@@ -788,10 +881,13 @@ typedef struct ParticleSystemModifierData {
ModifierData modifier;
struct ParticleSystem *psys;
- struct Mesh *mesh_final; /* Final Mesh - its topology may differ from orig mesh. */
- struct Mesh *mesh_original; /* Original mesh that particles are attached to. */
+ /** Final Mesh - its topology may differ from orig mesh. */
+ struct Mesh *mesh_final;
+ /** Original mesh that particles are attached to. */
+ struct Mesh *mesh_original;
int totdmvert, totdmedge, totdmface;
- short flag, pad;
+ short flag;
+ char _pad[2];
} ParticleSystemModifierData;
typedef enum {
@@ -824,8 +920,10 @@ typedef struct ParticleInstanceModifierData {
float position, random_position;
float rotation, random_rotation;
float particle_amount, particle_offset;
- char index_layer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
- char value_layer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char index_layer_name[64];
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char value_layer_name[64];
} ParticleInstanceModifierData;
typedef enum {
@@ -843,17 +941,20 @@ typedef struct ExplodeModifierData {
int *facepa;
short flag, vgroup;
float protect;
- char uvname[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char uvname[64];
} ExplodeModifierData;
typedef struct MultiresModifierData {
ModifierData modifier;
char lvl, sculptlvl, renderlvl, totlvl;
- char simple, flags, pad[2];
+ char simple, flags, _pad[2];
short quality;
short uv_smooth;
- short pad2[2];
+ char _pad2[4];
+ struct Subdiv *subdiv;
+ void *_pad3;
} MultiresModifierData;
typedef enum {
@@ -865,28 +966,38 @@ typedef enum {
typedef struct FluidsimModifierData {
ModifierData modifier;
- struct FluidsimSettings *fss; /* definition is in DNA_object_fluidsim_types.h */
+ /** Definition is in DNA_object_fluidsim_types.h. */
+ struct FluidsimSettings *fss;
} FluidsimModifierData;
typedef struct ShrinkwrapModifierData {
ModifierData modifier;
- struct Object *target; /* shrink target */
- struct Object *auxTarget; /* additional shrink target */
- char vgroup_name[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- float keepDist; /* distance offset to keep from mesh/projection point */
- short shrinkType; /* shrink type projection */
- char shrinkOpts; /* shrink options */
- char shrinkMode; /* shrink to surface mode */
- float projLimit; /* limit the projection ray cast */
- char projAxis; /* axis to project over */
-
- /* If using projection over vertex normal this controls the level of subsurface that must be done
- * before getting the vertex coordinates and normal
+ /** Shrink target. */
+ struct Object *target;
+ /** Additional shrink target. */
+ struct Object *auxTarget;
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgroup_name[64];
+ /** Distance offset to keep from mesh/projection point. */
+ float keepDist;
+ /** Shrink type projection. */
+ short shrinkType;
+ /** Shrink options. */
+ char shrinkOpts;
+ /** Shrink to surface mode. */
+ char shrinkMode;
+ /** Limit the projection ray cast. */
+ float projLimit;
+ /** Axis to project over. */
+ char projAxis;
+
+ /** If using projection over vertex normal this controls the level of subsurface that must be
+ * done before getting the vertex coordinates and normal
*/
char subsurfLevels;
- char pad[2];
+ char _pad[2];
} ShrinkwrapModifierData;
/* Shrinkwrap->shrinkType */
@@ -899,32 +1010,33 @@ enum {
/* Shrinkwrap->shrinkMode */
enum {
- /* Move vertex to the surface of the target object (keepDist towards original position) */
+ /** Move vertex to the surface of the target object (keepDist towards original position) */
MOD_SHRINKWRAP_ON_SURFACE = 0,
- /* Move the vertex inside the target object; don't change if already inside */
+ /** Move the vertex inside the target object; don't change if already inside */
MOD_SHRINKWRAP_INSIDE = 1,
- /* Move the vertex outside the target object; don't change if already outside */
+ /** Move the vertex outside the target object; don't change if already outside */
MOD_SHRINKWRAP_OUTSIDE = 2,
- /* Move vertex to the surface of the target object, with keepDist towards the outside */
+ /** Move vertex to the surface of the target object, with keepDist towards the outside */
MOD_SHRINKWRAP_OUTSIDE_SURFACE = 3,
- /* Move vertex to the surface of the target object, with keepDist along the normal */
+ /** Move vertex to the surface of the target object, with keepDist along the normal */
MOD_SHRINKWRAP_ABOVE_SURFACE = 4,
};
/* Shrinkwrap->shrinkOpts */
enum {
- /* allow shrinkwrap to move the vertex in the positive direction of axis */
+ /** allow shrinkwrap to move the vertex in the positive direction of axis */
MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR = (1 << 0),
- /* allow shrinkwrap to move the vertex in the negative direction of axis */
+ /** allow shrinkwrap to move the vertex in the negative direction of axis */
MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR = (1 << 1),
- /* ignore vertex moves if a vertex ends projected on a front face of the target */
+ /** ignore vertex moves if a vertex ends projected on a front face of the target */
MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE = (1 << 3),
- /* ignore vertex moves if a vertex ends projected on a back face of the target */
+ /** ignore vertex moves if a vertex ends projected on a back face of the target */
MOD_SHRINKWRAP_CULL_TARGET_BACKFACE = (1 << 4),
#ifdef DNA_DEPRECATED_ALLOW
- MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE = (1 << 5), /* distance is measure to the front face of the target */
+ /** distance is measure to the front face of the target */
+ MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE = (1 << 5),
#endif
MOD_SHRINKWRAP_INVERT_VGROUP = (1 << 6),
@@ -935,7 +1047,8 @@ enum {
/* Shrinkwrap->projAxis */
enum {
- MOD_SHRINKWRAP_PROJECT_OVER_NORMAL = 0, /* projection over normal is used if no axis is selected */
+ /** projection over normal is used if no axis is selected */
+ MOD_SHRINKWRAP_PROJECT_OVER_NORMAL = 0,
MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS = (1 << 0),
MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS = (1 << 1),
MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS = (1 << 2),
@@ -945,14 +1058,21 @@ enum {
typedef struct SimpleDeformModifierData {
ModifierData modifier;
- struct Object *origin; /* object to control the origin of modifier space coordinates */
- char vgroup_name[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- float factor; /* factors to control simple deforms */
- float limit[2]; /* lower and upper limit */
+ /** Object to control the origin of modifier space coordinates. */
+ struct Object *origin;
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgroup_name[64];
+ /** Factors to control simple deforms. */
+ float factor;
+ /** Lower and upper limit. */
+ float limit[2];
- char mode; /* deform function */
- char axis; /* lock axis (for taper and stretch) */
- char deform_axis; /* axis to perform the deform on (default is X, but can be overridden by origin */
+ /** Deform function. */
+ char mode;
+ /** Lock axis (for taper and stretch). */
+ char axis;
+ /** Axis to perform the deform on (default is X, but can be overridden by origin. */
+ char deform_axis;
char flag;
} SimpleDeformModifierData;
@@ -983,13 +1103,18 @@ typedef struct ShapeKeyModifierData {
typedef struct SolidifyModifierData {
ModifierData modifier;
- char defgrp_name[64]; /* name of vertex group to use, MAX_VGROUP_NAME */
- float offset; /* new surface offset level*/
- float offset_fac; /* midpoint of the offset */
- /* factor for the minimum weight to use when vgroups are used, avoids 0.0 weights giving duplicate geometry */
+ /** Name of vertex group to use, MAX_VGROUP_NAME. */
+ char defgrp_name[64];
+ /** New surface offset leve.l*/
+ float offset;
+ /** Midpoint of the offset . */
+ float offset_fac;
+ /** factor for the minimum weight to use when vgroups are used,
+ * avoids 0.0 weights giving duplicate geometry */
float offset_fac_vg;
- float offset_clamp; /* clamp offset based on surrounding geometry */
- float pad;
+ /** Clamp offset based on surrounding geometry. */
+ float offset_clamp;
+ char _pad[4];
float crease_inner;
float crease_outer;
float crease_rim;
@@ -1022,7 +1147,7 @@ typedef struct ScrewModifierData {
float merge_dist;
short flag;
char axis;
- char pad[5];
+ char _pad[5];
} ScrewModifierData;
enum {
@@ -1062,13 +1187,15 @@ typedef struct OceanModifierData {
int bakestart;
int bakeend;
- char cachepath[1024]; /* FILE_MAX */
- char foamlayername[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ /** FILE_MAX. */
+ char cachepath[1024];
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char foamlayername[64];
char cached;
char geometry_mode;
char flag;
- char pad2;
+ char _pad2;
short repeat_x;
short repeat_y;
@@ -1079,7 +1206,7 @@ typedef struct OceanModifierData {
float foam_fade;
- int pad;
+ char _pad[4];
} OceanModifierData;
enum {
@@ -1099,7 +1226,8 @@ typedef struct WarpModifierData {
/* keep in sync with MappingInfoModifierData */
struct Tex *texture;
struct Object *map_object;
- char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char uvlayer_name[64];
int uvlayer_tmp;
int texmapping;
/* end MappingInfoModifierData */
@@ -1107,12 +1235,14 @@ typedef struct WarpModifierData {
struct Object *object_from;
struct Object *object_to;
struct CurveMapping *curfalloff;
- char defgrp_name[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char defgrp_name[64];
float strength;
float falloff_radius;
- char flag; /* not used yet */
+ /** Not used yet. */
+ char flag;
char falloff_type;
- char pad[6];
+ char _pad[6];
} WarpModifierData;
#define MOD_WARP_VOLUME_PRESERVE 1
@@ -1133,91 +1263,131 @@ typedef enum {
typedef struct WeightVGEditModifierData {
ModifierData modifier;
- char defgrp_name[64]; /* Name of vertex group to edit. MAX_VGROUP_NAME. */
+ /** Name of vertex group to edit. MAX_VGROUP_NAME. */
+ char defgrp_name[64];
- short edit_flags; /* Using MOD_WVG_EDIT_* flags. */
- short falloff_type; /* Using MOD_WVG_MAPPING_* defines. */
- float default_weight; /* Weight for vertices not in vgroup. */
+ /** Using MOD_WVG_EDIT_* flags. */
+ short edit_flags;
+ /** Using MOD_WVG_MAPPING_* defines. */
+ short falloff_type;
+ /** Weight for vertices not in vgroup. */
+ float default_weight;
/* Mapping stuff. */
- struct CurveMapping *cmap_curve; /* The custom mapping curve! */
+ /** The custom mapping curve!. */
+ struct CurveMapping *cmap_curve;
/* The add/remove vertices weight thresholds. */
float add_threshold, rem_threshold;
/* Masking options. */
- float mask_constant; /* The global "influence", if no vgroup nor tex is used as mask. */
- char mask_defgrp_name[64]; /* Name of mask vertex group from which to get weight factors. MAX_VGROUP_NAME */
+ /** The global "influence", if no vgroup nor tex is used as mask. */
+ float mask_constant;
+ /** Name of mask vertex group from which to get weight factors. MAX_VGROUP_NAME. */
+ char mask_defgrp_name[64];
/* Texture masking. */
- int mask_tex_use_channel; /* Which channel to use as weightf. */
- struct Tex *mask_texture; /* The texture. */
- struct Object *mask_tex_map_obj; /* Name of the map object. */
- int mask_tex_mapping; /* How to map the texture (using MOD_DISP_MAP_* enums). */
- char mask_tex_uvlayer_name[64]; /* Name of the UV map. MAX_CUSTOMDATA_LAYER_NAME */
+ /** Which channel to use as weightf. */
+ int mask_tex_use_channel;
+ /** The texture. */
+ struct Tex *mask_texture;
+ /** Name of the map object. */
+ struct Object *mask_tex_map_obj;
+ /** How to map the texture (using MOD_DISP_MAP_* enums). */
+ int mask_tex_mapping;
+ /** Name of the UV map. MAX_CUSTOMDATA_LAYER_NAME. */
+ char mask_tex_uvlayer_name[64];
/* Padding... */
- int pad_i1;
+ char _pad0[4];
} WeightVGEditModifierData;
/* WeightVGEdit flags. */
enum {
/* (1 << 0), (1 << 1) and (1 << 2) are free for future use! */
- MOD_WVG_EDIT_ADD2VG = (1 << 3), /* Add vertices with higher weight than threshold to vgroup. */
- MOD_WVG_EDIT_REMFVG = (1 << 4), /* Remove vertices with lower weight than threshold from vgroup. */
+ /** Add vertices with higher weight than threshold to vgroup. */
+ MOD_WVG_EDIT_ADD2VG = (1 << 3),
+ /** Remove vertices with lower weight than threshold from vgroup. */
+ MOD_WVG_EDIT_REMFVG = (1 << 4),
};
typedef struct WeightVGMixModifierData {
ModifierData modifier;
- char defgrp_name_a[64]; /* Name of vertex group to modify/weight. MAX_VGROUP_NAME. */
- char defgrp_name_b[64]; /* Name of other vertex group to mix in. MAX_VGROUP_NAME. */
- float default_weight_a; /* Default weight value for first vgroup. */
- float default_weight_b; /* Default weight value to mix in. */
- char mix_mode; /* How second vgroups weights affect first ones */
- char mix_set; /* What vertices to affect. */
-
- char pad_c1[6];
+ /** Name of vertex group to modify/weight. MAX_VGROUP_NAME. */
+ char defgrp_name_a[64];
+ /** Name of other vertex group to mix in. MAX_VGROUP_NAME. */
+ char defgrp_name_b[64];
+ /** Default weight value for first vgroup. */
+ float default_weight_a;
+ /** Default weight value to mix in. */
+ float default_weight_b;
+ /** How second vgroups weights affect first ones. */
+ char mix_mode;
+ /** What vertices to affect. */
+ char mix_set;
+
+ char _pad0[6];
/* Masking options. */
- float mask_constant; /* The global "influence", if no vgroup nor tex is used as mask. */
- char mask_defgrp_name[64]; /* Name of mask vertex group from which to get weight factors. MAX_VGROUP_NAME */
+ /** The global "influence", if no vgroup nor tex is used as mask. */
+ float mask_constant;
+ /** Name of mask vertex group from which to get weight factors. MAX_VGROUP_NAME. */
+ char mask_defgrp_name[64];
/* Texture masking. */
- int mask_tex_use_channel; /* Which channel to use as weightf. */
- struct Tex *mask_texture; /* The texture. */
- struct Object *mask_tex_map_obj; /* Name of the map object. */
- int mask_tex_mapping; /* How to map the texture! */
- char mask_tex_uvlayer_name[64]; /* Name of the UV map. MAX_CUSTOMDATA_LAYER_NAME. */
+ /** Which channel to use as weightf. */
+ int mask_tex_use_channel;
+ /** The texture. */
+ struct Tex *mask_texture;
+ /** Name of the map object. */
+ struct Object *mask_tex_map_obj;
+ /** How to map the texture!. */
+ int mask_tex_mapping;
+ /** Name of the UV map. MAX_CUSTOMDATA_LAYER_NAME. */
+ char mask_tex_uvlayer_name[64];
/* Padding... */
- int pad_i1;
+ char _pad1[4];
} WeightVGMixModifierData;
/* How second vgroup's weights affect first ones. */
enum {
- MOD_WVG_MIX_SET = 1, /* Second weights replace weights. */
- MOD_WVG_MIX_ADD = 2, /* Second weights are added to weights. */
- MOD_WVG_MIX_SUB = 3, /* Second weights are subtracted from weights. */
- MOD_WVG_MIX_MUL = 4, /* Second weights are multiplied with weights. */
- MOD_WVG_MIX_DIV = 5, /* Second weights divide weights. */
- MOD_WVG_MIX_DIF = 6, /* Difference between second weights and weights. */
- MOD_WVG_MIX_AVG = 7, /* Average of both weights. */
+ /** Second weights replace weights. */
+ MOD_WVG_MIX_SET = 1,
+ /** Second weights are added to weights. */
+ MOD_WVG_MIX_ADD = 2,
+ /** Second weights are subtracted from weights. */
+ MOD_WVG_MIX_SUB = 3,
+ /** Second weights are multiplied with weights. */
+ MOD_WVG_MIX_MUL = 4,
+ /** Second weights divide weights. */
+ MOD_WVG_MIX_DIV = 5,
+ /** Difference between second weights and weights. */
+ MOD_WVG_MIX_DIF = 6,
+ /** Average of both weights. */
+ MOD_WVG_MIX_AVG = 7,
};
/* What vertices to affect. */
enum {
- MOD_WVG_SET_ALL = 1, /* Affect all vertices. */
- MOD_WVG_SET_A = 2, /* Affect only vertices in first vgroup. */
- MOD_WVG_SET_B = 3, /* Affect only vertices in second vgroup. */
- MOD_WVG_SET_OR = 4, /* Affect only vertices in one vgroup or the other. */
- MOD_WVG_SET_AND = 5, /* Affect only vertices in both vgroups. */
+ /** Affect all vertices. */
+ MOD_WVG_SET_ALL = 1,
+ /** Affect only vertices in first vgroup. */
+ MOD_WVG_SET_A = 2,
+ /** Affect only vertices in second vgroup. */
+ MOD_WVG_SET_B = 3,
+ /** Affect only vertices in one vgroup or the other. */
+ MOD_WVG_SET_OR = 4,
+ /** Affect only vertices in both vgroups. */
+ MOD_WVG_SET_AND = 5,
};
typedef struct WeightVGProximityModifierData {
ModifierData modifier;
- char defgrp_name[64]; /* Name of vertex group to modify/weight. MAX_VGROUP_NAME. */
+ /** Name of vertex group to modify/weight. MAX_VGROUP_NAME. */
+ char defgrp_name[64];
/* Proximity modes. */
int proximity_mode;
@@ -1227,23 +1397,32 @@ typedef struct WeightVGProximityModifierData {
struct Object *proximity_ob_target;
/* Masking options. */
- float mask_constant; /* The global "influence", if no vgroup nor tex is used as mask. */
- char mask_defgrp_name[64]; /* Name of mask vertex group from which to get weight factors. MAX_VGROUP_NAME */
+ /** The global "influence", if no vgroup nor tex is used as mask. */
+ float mask_constant;
+ /** Name of mask vertex group from which to get weight factors. MAX_VGROUP_NAME. */
+ char mask_defgrp_name[64];
/* Texture masking. */
- int mask_tex_use_channel; /* Which channel to use as weightf. */
- struct Tex *mask_texture; /* The texture. */
- struct Object *mask_tex_map_obj; /* Name of the map object. */
- int mask_tex_mapping; /* How to map the texture! */
- char mask_tex_uvlayer_name[64]; /* Name of the UV Map. MAX_CUSTOMDATA_LAYER_NAME. */
-
- float min_dist, max_dist; /* Distances mapping to 0.0/1.0 weights. */
+ /** Which channel to use as weightf. */
+ int mask_tex_use_channel;
+ /** The texture. */
+ struct Tex *mask_texture;
+ /** Name of the map object. */
+ struct Object *mask_tex_map_obj;
+ /** How to map the texture!. */
+ int mask_tex_mapping;
+ /** Name of the UV Map. MAX_CUSTOMDATA_LAYER_NAME. */
+ char mask_tex_uvlayer_name[64];
+
+ /** Distances mapping to 0.0/1.0 weights. */
+ float min_dist, max_dist;
/* Put here to avoid breaking existing struct... */
- short falloff_type; /* Using MOD_WVG_MAPPING_* enums. */
+ /** Using MOD_WVG_MAPPING_* enums. */
+ short falloff_type;
/* Padding... */
- short pad_s1;
+ char _pad0[2];
} WeightVGProximityModifierData;
/* Modes of proximity weighting. */
@@ -1294,8 +1473,9 @@ typedef struct DynamicPaintModifierData {
struct DynamicPaintCanvasSettings *canvas;
struct DynamicPaintBrushSettings *brush;
- int type; /* ui display: canvas / brush */
- int pad;
+ /** UI display: canvas / brush. */
+ int type;
+ char _pad[4];
} DynamicPaintModifierData;
/* Dynamic paint modifier flags */
@@ -1335,7 +1515,7 @@ typedef struct RemeshModifierData {
char flag;
char mode;
- char pad;
+ char _pad;
} RemeshModifierData;
/* Skin modifier */
@@ -1348,7 +1528,7 @@ typedef struct SkinModifierData {
char symmetry_axes;
- char pad[2];
+ char _pad[2];
} SkinModifierData;
/* SkinModifierData.symmetry_axes */
@@ -1370,14 +1550,16 @@ typedef struct TriangulateModifierData {
int flag;
int quad_method;
int ngon_method;
- int pad;
+ char _pad[4];
} TriangulateModifierData;
-#ifdef DNA_DEPRECATED
+/* TriangulateModifierData.flag */
enum {
- MOD_TRIANGULATE_BEAUTY = (1 << 0), /* deprecated */
-};
+#ifdef DNA_DEPRECATED
+ MOD_TRIANGULATE_BEAUTY = (1 << 0), /* deprecated */
#endif
+ MOD_TRIANGULATE_KEEP_CUSTOMLOOP_NORMALS = 1 << 1,
+};
/* Triangulate methods - NGons */
enum {
@@ -1390,14 +1572,16 @@ enum {
MOD_TRIANGULATE_QUAD_BEAUTY = 0,
MOD_TRIANGULATE_QUAD_FIXED,
MOD_TRIANGULATE_QUAD_ALTERNATE,
- MOD_TRIANGULATE_QUAD_SHORTEDGE
+ MOD_TRIANGULATE_QUAD_SHORTEDGE,
};
typedef struct LaplacianSmoothModifierData {
ModifierData modifier;
- float lambda, lambda_border, pad1;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ float lambda, lambda_border;
+ char _pad1[4];
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
short flag, repeat;
} LaplacianSmoothModifierData;
@@ -1424,15 +1608,16 @@ typedef struct CorrectiveSmoothModifierData {
float lambda;
short repeat, flag;
char smooth_type, rest_source;
- char pad[2];
+ char _pad[2];
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
/* runtime-only cache (delta's between),
* delta's between the original positions and the smoothed positions */
float (*delta_cache)[3];
unsigned int delta_cache_num;
- char pad2[4];
+ char _pad2[4];
} CorrectiveSmoothModifierData;
enum {
@@ -1456,16 +1641,23 @@ typedef struct UVWarpModifierData {
ModifierData modifier;
char axis_u, axis_v;
- char pad[6];
- float center[2]; /* used for rotate/scale */
-
- struct Object *object_src; /* source */
- char bone_src[64]; /* optional name of bone target, MAX_ID_NAME-2 */
- struct Object *object_dst; /* target */
- char bone_dst[64]; /* optional name of bone target, MAX_ID_NAME-2 */
-
- char vgroup_name[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
- char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ char _pad[6];
+ /** Used for rotate/scale. */
+ float center[2];
+
+ /** Source. */
+ struct Object *object_src;
+ /** Optional name of bone target, MAX_ID_NAME-2. */
+ char bone_src[64];
+ /** Target. */
+ struct Object *object_dst;
+ /** Optional name of bone target, MAX_ID_NAME-2. */
+ char bone_dst[64];
+
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgroup_name[64];
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char uvlayer_name[64];
} UVWarpModifierData;
/* cache modifier */
@@ -1473,7 +1665,8 @@ typedef struct MeshCacheModifierData {
ModifierData modifier;
char flag;
- char type; /* file format */
+ /** File format. */
+ char type;
char time_mode;
char play_mode;
@@ -1486,7 +1679,7 @@ typedef struct MeshCacheModifierData {
float factor;
char deform_mode;
- char pad[7];
+ char _pad[7];
/* play_mode == MOD_MESHCACHE_PLAY_CFEA */
float frame_start;
@@ -1498,7 +1691,8 @@ typedef struct MeshCacheModifierData {
float eval_time;
float eval_factor;
- char filepath[1024]; /* FILE_MAX */
+ /** FILE_MAX. */
+ char filepath[1024];
} MeshCacheModifierData;
enum {
@@ -1531,11 +1725,14 @@ enum {
typedef struct LaplacianDeformModifierData {
ModifierData modifier;
- char anchor_grp_name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char anchor_grp_name[64];
int total_verts, repeat;
float *vertexco;
- void *cache_system; /* runtime only */
- short flag, pad[3];
+ /** Runtime only. */
+ void *cache_system;
+ short flag;
+ char _pad[6];
} LaplacianDeformModifierData;
@@ -1547,13 +1744,14 @@ enum {
/* many of these options match 'solidify' */
typedef struct WireframeModifierData {
ModifierData modifier;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
float offset;
float offset_fac;
float offset_fac_vg;
float crease_weight;
short flag, mat_ofs;
- short pad[2];
+ char _pad[4];
} WireframeModifierData;
enum {
@@ -1579,7 +1777,8 @@ typedef struct DataTransferModifierData {
struct Object *ob_source;
- int data_types; /* See DT_TYPE_ enum in ED_object.h */
+ /** See DT_TYPE_ enum in ED_object.h. */
+ int data_types;
/* See MREMAP_MODE_ enum in BKE_mesh_mapping.h */
int vmap_mode;
@@ -1591,14 +1790,18 @@ typedef struct DataTransferModifierData {
float map_ray_radius;
float islands_precision;
- int pad_i1;
+ char _pad1[4];
- int layers_select_src[4]; /* DT_MULTILAYER_INDEX_MAX; See DT_FROMLAYERS_ enum in ED_object.h */
- int layers_select_dst[4]; /* DT_MULTILAYER_INDEX_MAX; See DT_TOLAYERS_ enum in ED_object.h */
+ /** DT_MULTILAYER_INDEX_MAX; See DT_FROMLAYERS_ enum in ED_object.h. */
+ int layers_select_src[4];
+ /** DT_MULTILAYER_INDEX_MAX; See DT_TOLAYERS_ enum in ED_object.h. */
+ int layers_select_dst[4];
- int mix_mode; /* See CDT_MIX_ enum in BKE_customdata.h */
+ /** See CDT_MIX_ enum in BKE_customdata.h. */
+ int mix_mode;
float mix_factor;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
int flags;
} DataTransferModifierData;
@@ -1619,16 +1822,18 @@ enum {
/* Set Split Normals modifier */
typedef struct NormalEditModifierData {
ModifierData modifier;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
- struct Object *target; /* Source of normals, or center of ellipsoid. */
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
+ /** Source of normals, or center of ellipsoid. */
+ struct Object *target;
short mode;
short flag;
short mix_mode;
- char pad[2];
+ char _pad[2];
float mix_factor;
float mix_limit;
float offset[3];
- float pad_f1;
+ char _pad0[4];
} NormalEditModifierData;
/* NormalEditModifierData.mode */
@@ -1657,10 +1862,11 @@ typedef struct MeshSeqCacheModifierData {
struct CacheFile *cache_file;
struct CacheReader *reader;
- char object_path[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char object_path[1024];
char read_flag;
- char pad[7];
+ char _pad[7];
} MeshSeqCacheModifierData;
/* MeshSeqCacheModifierData.read_flag */
@@ -1683,15 +1889,17 @@ typedef struct SDefBind {
typedef struct SDefVert {
SDefBind *binds;
unsigned int numbinds;
- char pad[4];
+ char _pad[4];
} SDefVert;
typedef struct SurfaceDeformModifierData {
ModifierData modifier;
struct Depsgraph *depsgraph;
- struct Object *target; /* bind target object */
- SDefVert *verts; /* vertex bind data */
+ /** Bind target object. */
+ struct Object *target;
+ /** Vertex bind data. */
+ SDefVert *verts;
float falloff;
unsigned int numverts, numpoly;
int flags;
@@ -1717,7 +1925,8 @@ enum {
typedef struct WeightedNormalModifierData {
ModifierData modifier;
- char defgrp_name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char defgrp_name[64];
char mode, flag;
short weight;
float thresh;
diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h
index 56b99475909..fb3b3f994b4 100644
--- a/source/blender/makesdna/DNA_movieclip_types.h
+++ b/source/blender/makesdna/DNA_movieclip_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_movieclip_types.h
- * \ingroup DNA
- * \since may-2011
- * \author Sergey Sharybin
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_MOVIECLIP_TYPES_H__
@@ -39,82 +28,120 @@
#include "DNA_tracking_types.h"
#include "DNA_color_types.h" /* for color management */
-struct anim;
struct AnimData;
-struct bGPdata;
struct ImBuf;
struct MovieClipProxy;
-struct MovieTrackingTrack;
struct MovieTrackingMarker;
+struct MovieTrackingTrack;
+struct anim;
+struct bGPdata;
typedef struct MovieClipUser {
- int framenr; /* current frame number */
- short render_size, render_flag; /* proxy render size */
+ /** Current frame number. */
+ int framenr;
+ /** Proxy render size. */
+ short render_size, render_flag;
} MovieClipUser;
typedef struct MovieClipProxy {
- char dir[768]; /* 768=FILE_MAXDIR custom directory for index and proxy files (defaults to BL_proxy) */
-
- short tc; /* time code in use */
- short quality; /* proxy build quality */
- short build_size_flag; /* size flags (see below) of all proxies to build */
- short build_tc_flag; /* time code flags (see below) of all tc indices to build */
+ /** 768=FILE_MAXDIR custom directory for index and proxy files (defaults to BL_proxy). */
+ char dir[768];
+
+ /** Time code in use. */
+ short tc;
+ /** Proxy build quality. */
+ short quality;
+ /** Size flags (see below) of all proxies to build. */
+ short build_size_flag;
+ /** Time code flags (see below) of all tc indices to build. */
+ short build_tc_flag;
} MovieClipProxy;
typedef struct MovieClip {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
-
- char name[1024]; /* file path, 1024 = FILE_MAX */
-
- int source; /* sequence or movie */
- int lastframe; /* last accessed frame number */
- int lastsize[2]; /* size of last accessed frame */
-
- float aspx, aspy; /* display aspect */
-
- struct anim *anim; /* movie source data */
- struct MovieClipCache *cache; /* cache for different stuff, not in file */
- struct bGPdata *gpd; /* grease pencil data */
-
- struct MovieTracking tracking; /* data for SfM tracking */
- void *tracking_context; /* context of tracking job
- * used to synchronize data like framenumber
- * in SpaceClip clip user */
-
- struct MovieClipProxy proxy; /* proxy to clip data */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
+
+ /** File path, 1024 = FILE_MAX. */
+ char name[1024];
+
+ /** Sequence or movie. */
+ int source;
+ /** Last accessed frame number. */
+ int lastframe;
+ /** Size of last accessed frame. */
+ int lastsize[2];
+
+ /** Display aspect. */
+ float aspx, aspy;
+
+ /** Movie source data. */
+ struct anim *anim;
+ /** Cache for different stuff, not in file. */
+ struct MovieClipCache *cache;
+ /** Grease pencil data. */
+ struct bGPdata *gpd;
+
+ /** Data for SfM tracking. */
+ struct MovieTracking tracking;
+ /**
+ * Context of tracking job used to synchronize data
+ * like framenumber in SpaceClip clip user.
+ */
+ void *tracking_context;
+
+ /** Proxy to clip data. */
+ struct MovieClipProxy proxy;
int flag;
- int len; /* length of movie */
-
- int start_frame; /* scene frame number footage starts playing at */
- /* affects all data which is associated with a clip */
- /* such as motion tracking, camera reconstruciton and so */
-
- int frame_offset; /* offset which is adding to a file number when reading frame */
- /* from a file. affects only a way how scene frame is mapping */
- /* to a file name and not touches other data associated with */
- /* a clip */
+ /** Length of movie. */
+ int len;
+
+ /**
+ * Scene frame number footage starts playing at affects all data
+ * which is associated with a clip such as motion tracking,
+ * camera reconstruciton and so.
+ */
+ int start_frame;
+ /**
+ * Offset which is adding to a file number when reading frame from a file.
+ * affects only a way how scene frame is mapping to a file name and not
+ * touches other data associated with a clip. */
+ int frame_offset;
/* color management */
ColorManagedColorspaceSettings colorspace_settings;
} MovieClip;
typedef struct MovieClipScopes {
- short ok; /* 1 means scopes are ok and recalculation is unneeded */
- short use_track_mask; /* whether track's mask should be applied on preview */
- int track_preview_height; /* height of track preview widget */
- int frame_width, frame_height; /* width and height of frame for which scopes are calculated */
- struct MovieTrackingMarker undist_marker; /* undistorted position of marker used for pattern sampling */
- struct ImBuf *track_search; /* search area of a track */
- struct ImBuf *track_preview; /* ImBuf displayed in track preview */
- float track_pos[2]; /* sub-pizel position of marker in track ImBuf */
- short track_disabled; /* active track is disabled, special notifier should be drawn */
- short track_locked; /* active track is locked, no transformation should be allowed */
- int framenr; /* frame number scopes are created for */
- struct MovieTrackingTrack *track; /* track scopes are created for */
- struct MovieTrackingMarker *marker; /* marker scopes are created for */
- float slide_scale[2]; /* scale used for sliding from previewe area */
+ /** 1 means scopes are ok and recalculation is unneeded. */
+ short ok;
+ /** Whether track's mask should be applied on preview. */
+ short use_track_mask;
+ /** Height of track preview widget. */
+ int track_preview_height;
+ /** Width and height of frame for which scopes are calculated. */
+ int frame_width, frame_height;
+ /** Undistorted position of marker used for pattern sampling. */
+ struct MovieTrackingMarker undist_marker;
+ /** Search area of a track. */
+ struct ImBuf *track_search;
+ /** #ImBuf displayed in track preview. */
+ struct ImBuf *track_preview;
+ /** Sub-pizel position of marker in track ImBuf. */
+ float track_pos[2];
+ /** Active track is disabled, special notifier should be drawn. */
+ short track_disabled;
+ /** Active track is locked, no transformation should be allowed. */
+ short track_locked;
+ /** Frame number scopes are created for. */
+ int framenr;
+ /** Track scopes are created for. */
+ struct MovieTrackingTrack *track;
+ /** Marker scopes are created for. */
+ struct MovieTrackingMarker *marker;
+ /** Scale used for sliding from previewe area. */
+ float slide_scale[2];
} MovieClipScopes;
/* MovieClipProxy->build_size_flag */
@@ -126,19 +153,19 @@ enum {
MCLIP_PROXY_UNDISTORTED_SIZE_25 = (1 << 4),
MCLIP_PROXY_UNDISTORTED_SIZE_50 = (1 << 5),
MCLIP_PROXY_UNDISTORTED_SIZE_75 = (1 << 6),
- MCLIP_PROXY_UNDISTORTED_SIZE_100 = (1 << 7)
+ MCLIP_PROXY_UNDISTORTED_SIZE_100 = (1 << 7),
};
/* MovieClip->source */
enum {
MCLIP_SRC_SEQUENCE = 1,
- MCLIP_SRC_MOVIE = 2
+ MCLIP_SRC_MOVIE = 2,
};
/* MovieClip->selection types */
enum {
MCLIP_SEL_NONE = 0,
- MCLIP_SEL_TRACK = 1
+ MCLIP_SEL_TRACK = 1,
};
/* MovieClip->flag */
@@ -148,7 +175,7 @@ enum {
/* MCLIP_CUSTOM_START_FRAME = (1<<2), */ /* UNUSED */
MCLIP_DATA_EXPAND = (1 << 3),
- MCLIP_TIMECODE_FLAGS = (MCLIP_USE_PROXY | MCLIP_USE_PROXY_CUSTOM_DIR)
+ MCLIP_TIMECODE_FLAGS = (MCLIP_USE_PROXY | MCLIP_USE_PROXY_CUSTOM_DIR),
};
/* MovieClip->render_size */
@@ -157,12 +184,12 @@ enum {
MCLIP_PROXY_RENDER_SIZE_25 = 1,
MCLIP_PROXY_RENDER_SIZE_50 = 2,
MCLIP_PROXY_RENDER_SIZE_75 = 3,
- MCLIP_PROXY_RENDER_SIZE_100 = 4
+ MCLIP_PROXY_RENDER_SIZE_100 = 4,
};
/* MovieClip->render_flag */
enum {
- MCLIP_PROXY_RENDER_UNDISTORT = 1
+ MCLIP_PROXY_RENDER_UNDISTORT = 1,
};
#endif
diff --git a/source/blender/makesdna/DNA_nla_types.h b/source/blender/makesdna/DNA_nla_types.h
index 72db244c1fe..f1b1ab21116 100644
--- a/source/blender/makesdna/DNA_nla_types.h
+++ b/source/blender/makesdna/DNA_nla_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_nla_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_NLA_TYPES_H__
@@ -34,9 +26,9 @@
#include "DNA_listBase.h"
-struct bAction;
struct Ipo;
struct Object;
+struct bAction;
/* simple uniform modifier structure, assumed it can hold all type info */
typedef struct bActionModifier {
@@ -60,25 +52,40 @@ typedef struct bActionModifier {
typedef struct bActionStrip {
struct bActionStrip *next, *prev;
short flag, mode;
- short stride_axis; /* axis 0=x, 1=y, 2=z */
- short curmod; /* current modifier for buttons */
-
- struct Ipo *ipo; /* Blending ipo - was used for some old NAN era experiments. Non-functional currently. */
- struct bAction *act; /* The action referenced by this strip */
- struct Object *object; /* For groups, the actual object being nla'ed */
- float start, end; /* The range of frames covered by this strip */
- float actstart, actend; /* The range of frames taken from the action */
- float actoffs; /* Offset within action, for cycles and striding */
- float stridelen; /* The stridelength (considered when flag & ACT_USESTRIDE) */
- float repeat; /* The number of times to repeat the action range */
- float scale; /* The amount the action range is scaled by */
-
- float blendin, blendout; /* The number of frames on either end of the strip's length to fade in/out */
-
- char stridechannel[32]; /* Instead of stridelen, it uses an action channel */
- char offs_bone[32]; /* if repeat, use this bone/channel for defining offset */
-
- ListBase modifiers; /* modifier stack */
+ /** Axis 0=x, 1=y, 2=z. */
+ short stride_axis;
+ /** Current modifier for buttons. */
+ short curmod;
+
+ /** Blending ipo - was used for some old NAN era experiments. Non-functional currently. */
+ struct Ipo *ipo;
+ /** The action referenced by this strip. */
+ struct bAction *act;
+ /** For groups, the actual object being nla'ed. */
+ struct Object *object;
+ /** The range of frames covered by this strip. */
+ float start, end;
+ /** The range of frames taken from the action. */
+ float actstart, actend;
+ /** Offset within action, for cycles and striding. */
+ float actoffs;
+ /** The stridelength (considered when flag & ACT_USESTRIDE). */
+ float stridelen;
+ /** The number of times to repeat the action range. */
+ float repeat;
+ /** The amount the action range is scaled by. */
+ float scale;
+
+ /** The number of frames on either end of the strip's length to fade in/out. */
+ float blendin, blendout;
+
+ /** Instead of stridelen, it uses an action channel. */
+ char stridechannel[32];
+ /** If repeat, use this bone/channel for defining offset. */
+ char offs_bone[32];
+
+ /** Modifier stack. */
+ ListBase modifiers;
} bActionStrip;
/* strip->mode (these defines aren't really used, but are here for reference) */
@@ -89,16 +96,18 @@ typedef struct bActionStrip {
typedef enum eActStrip_Flag {
ACTSTRIP_SELECT = (1<<0),
ACTSTRIP_USESTRIDE = (1<<1),
- ACTSTRIP_BLENDTONEXT = (1<<2), /* Not implemented. Is not used anywhere */
+ /* Not implemented. Is not used anywhere */
+ ACTSTRIP_BLENDTONEXT = (1<<2),
ACTSTRIP_HOLDLASTFRAME = (1<<3),
ACTSTRIP_ACTIVE = (1<<4),
ACTSTRIP_LOCK_ACTION = (1<<5),
ACTSTRIP_MUTE = (1<<6),
- ACTSTRIP_REVERSE = (1<<7), /* This has yet to be implemented. To indicate that a strip should be played backwards */
+ /* This has yet to be implemented. To indicate that a strip should be played backwards */
+ ACTSTRIP_REVERSE = (1<<7),
ACTSTRIP_CYCLIC_USEX = (1<<8),
ACTSTRIP_CYCLIC_USEY = (1<<9),
ACTSTRIP_CYCLIC_USEZ = (1<<10),
- ACTSTRIP_AUTO_BLENDS = (1<<11)
+ ACTSTRIP_AUTO_BLENDS = (1<<11),
} eActStrip_Flag;
#endif
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 32792fcd85d..a255646b734 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb, Xavier Thomas
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_node_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_NODE_TYPES_H__
@@ -38,17 +30,17 @@
#include "DNA_texture_types.h"
#include "DNA_scene_types.h"
+struct AnimData;
struct ID;
+struct Image;
struct ListBase;
+struct bGPdata;
+struct bNodeInstanceHash;
struct bNodeLink;
-struct bNodeType;
-struct bNodeTreeExec;
struct bNodePreview;
-struct bNodeInstanceHash;
-struct AnimData;
-struct bGPdata;
+struct bNodeTreeExec;
+struct bNodeType;
struct uiBlock;
-struct Image;
/* In writefile.c: write deprecated DNA data,
* to ensure forward compatibility in 2.6x versions.
@@ -62,13 +54,19 @@ typedef struct bNodeStack {
float vec[4];
float min, max;
void *data;
- short hasinput; /* when input has link, tagged before executing */
- short hasoutput; /* when output is linked, tagged before executing */
- short datatype; /* type of data pointer */
- short sockettype; /* type of socket stack comes from, to remap linking different sockets */
- short is_copy; /* data is a copy of external data (no freeing) */
- short external; /* data is used by external nodes (no freeing) */
- short pad[2];
+ /** When input has link, tagged before executing. */
+ short hasinput;
+ /** When output is linked, tagged before executing. */
+ short hasoutput;
+ /** Type of data pointer. */
+ short datatype;
+ /** Type of socket stack comes from, to remap linking different sockets. */
+ short sockettype;
+ /** Data is a copy of external data (no freeing). */
+ short is_copy;
+ /** Data is used by external nodes (no freeing). */
+ short external;
+ char _pad[4];
} bNodeStack;
/* ns->datatype, shadetree only */
@@ -86,48 +84,65 @@ typedef struct bNodeStack {
typedef struct bNodeSocket {
struct bNodeSocket *next, *prev, *new_sock;
- IDProperty *prop; /* user-defined properties */
+ /** User-defined properties. */
+ IDProperty *prop;
- char identifier[64]; /* unique identifier for mapping */
+ /** Unique identifier for mapping. */
+ char identifier[64];
- char name[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64];
/* XXX deprecated, only used for the Image and OutputFile nodes,
* should be removed at some point.
*/
- void *storage; /* custom storage */
+ /** Custom storage. */
+ void *storage;
short type, flag;
- short limit; /* max. number of links */
- short in_out; /* input/output type */
- struct bNodeSocketType *typeinfo; /* runtime type information */
- char idname[64]; /* runtime type identifier */
+ /** Max. number of links. */
+ short limit;
+ /** Input/output type. */
+ short in_out;
+ /** Runtime type information. */
+ struct bNodeSocketType *typeinfo;
+ /** Runtime type identifier. */
+ char idname[64];
float locx, locy;
- void *default_value; /* default input value used for unlinked sockets */
+ /** Default input value used for unlinked sockets. */
+ void *default_value;
/* execution data */
- short stack_index; /* local stack index */
+ /** Local stack index. */
+ short stack_index;
/* XXX deprecated, kept for forward compatibility */
short stack_type DNA_DEPRECATED;
- char draw_shape, pad[3];
+ char draw_shape;
+ char _pad[3];
- void *cache; /* cached data from execution */
+ /** Cached data from execution. */
+ void *cache;
/* internal data to retrieve relations and groups
* DEPRECATED, now uses the generic identifier string instead
*/
- int own_index DNA_DEPRECATED; /* group socket identifiers, to find matching pairs after reading files */
+ /** Group socket identifiers, to find matching pairs after reading files. */
+ int own_index DNA_DEPRECATED;
/* XXX deprecated, only used for restoring old group node links */
int to_index DNA_DEPRECATED;
- /* XXX deprecated, still forward compatible since verification restores pointer from matching own_index. */
+ /* XXX deprecated, still forward compatible since verification
+ * restores pointer from matching own_index. */
struct bNodeSocket *groupsock DNA_DEPRECATED;
- struct bNodeLink *link; /* a link pointer, set in ntreeUpdateTree */
+ /** A link pointer, set in ntreeUpdateTree. */
+ struct bNodeLink *link;
- /* XXX deprecated, socket input values are stored in default_value now. kept for forward compatibility */
- bNodeStack ns DNA_DEPRECATED; /* custom data for inputs, only UI writes in this */
+ /* XXX deprecated, socket input values are stored in default_value now.
+ * kept for forward compatibility */
+ /** Custom data for inputs, only UI writes in this. */
+ bNodeStack ns DNA_DEPRECATED;
} bNodeSocket;
/* sock->type */
@@ -140,32 +155,40 @@ typedef enum eNodeSocketDatatype {
SOCK_BOOLEAN = 4,
__SOCK_MESH = 5, /* deprecated */
SOCK_INT = 6,
- SOCK_STRING = 7
+ SOCK_STRING = 7,
} eNodeSocketDatatype;
/* socket shape */
typedef enum eNodeSocketDrawShape {
SOCK_DRAW_SHAPE_CIRCLE = 0,
SOCK_DRAW_SHAPE_SQUARE = 1,
- SOCK_DRAW_SHAPE_DIAMOND = 2
+ SOCK_DRAW_SHAPE_DIAMOND = 2,
} eNodeSocketDrawShape;
/* socket side (input/output) */
typedef enum eNodeSocketInOut {
SOCK_IN = 1,
- SOCK_OUT = 2
+ SOCK_OUT = 2,
} eNodeSocketInOut;
/* sock->flag, first bit is select */
typedef enum eNodeSocketFlag {
- SOCK_HIDDEN = (1 << 1), /* hidden is user defined, to hide unused */
- SOCK_IN_USE = (1 << 2), /* for quick check if socket is linked */
- SOCK_UNAVAIL = (1 << 3), /* unavailable is for dynamic sockets */
- // SOCK_DYNAMIC = (1 << 4), /* DEPRECATED dynamic socket (can be modified by user) */
- // SOCK_INTERNAL = (1 << 5), /* DEPRECATED group socket should not be exposed */
- SOCK_COLLAPSED = (1 << 6), /* socket collapsed in UI */
- SOCK_HIDE_VALUE = (1 << 7), /* hide socket value, if it gets auto default */
- SOCK_AUTO_HIDDEN__DEPRECATED = (1 << 8), /* socket hidden automatically, to distinguish from manually hidden */
+ /** hidden is user defined, to hide unused */
+ SOCK_HIDDEN = (1 << 1),
+ /** for quick check if socket is linked */
+ SOCK_IN_USE = (1 << 2),
+ /** unavailable is for dynamic sockets */
+ SOCK_UNAVAIL = (1 << 3),
+ // /** DEPRECATED dynamic socket (can be modified by user) */
+ // SOCK_DYNAMIC = (1 << 4),
+ // /** DEPRECATED group socket should not be exposed */
+ // SOCK_INTERNAL = (1 << 5),
+ /** socket collapsed in UI */
+ SOCK_COLLAPSED = (1 << 6),
+ /** hide socket value, if it gets auto default */
+ SOCK_HIDE_VALUE = (1 << 7),
+ /** socket hidden automatically, to distinguish from manually hidden */
+ SOCK_AUTO_HIDDEN__DEPRECATED = (1 << 8),
SOCK_NO_INTERNAL_LINK = (1 << 9),
} eNodeSocketFlag;
@@ -173,45 +196,74 @@ typedef enum eNodeSocketFlag {
typedef struct bNode {
struct bNode *next, *prev, *new_node;
- IDProperty *prop; /* user-defined properties */
+ /** User-defined properties. */
+ IDProperty *prop;
- struct bNodeType *typeinfo; /* runtime type information */
- char idname[64]; /* runtime type identifier */
+ /** Runtime type information. */
+ struct bNodeType *typeinfo;
+ /** Runtime type identifier. */
+ char idname[64];
- char name[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64];
int flag;
- short type, pad;
- short done, level; /* both for dependency and sorting */
- short lasty, menunr; /* lasty: check preview render status, menunr: browse ID blocks */
- short stack_index; /* for groupnode, offset in global caller stack */
- short nr; /* number of this node in list, used for UI exec events */
- float color[3]; /* custom user-defined color */
+ short type;
+ char _pad[2];
+ /** Both for dependency and sorting. */
+ short done, level;
+ /** Lasty: check preview render status, menunr: browse ID blocks. */
+ short lasty, menunr;
+ /** For groupnode, offset in global caller stack. */
+ short stack_index;
+ /** Number of this node in list, used for UI exec events. */
+ short nr;
+ /** Custom user-defined color. */
+ float color[3];
ListBase inputs, outputs;
- struct bNode *parent; /* parent node */
- struct ID *id; /* optional link to libdata */
- void *storage; /* custom data, must be struct, for storage in file */
- struct bNode *original; /* the original node in the tree (for localized tree) */
- ListBase internal_links; /* list of cached internal links (input to output), for muted nodes and operators */
-
- float locx, locy; /* root offset for drawing (parent space) */
- float width, height; /* node custom width and height */
- float miniwidth; /* node width if hidden */
- float offsetx, offsety; /* additional offset from loc */
- float anim_init_locx; /* initial locx for insert offset animation */
- float anim_ofsx; /* offset that will be added to locx for insert offset animation */
-
- int update; /* update flags */
-
- char label[64]; /* custom user-defined label, MAX_NAME */
- short custom1, custom2; /* to be abused for buttons */
+ /** Parent node. */
+ struct bNode *parent;
+ /** Optional link to libdata. */
+ struct ID *id;
+ /** Custom data, must be struct, for storage in file. */
+ void *storage;
+ /** The original node in the tree (for localized tree). */
+ struct bNode *original;
+ /** List of cached internal links (input to output), for muted nodes and operators. */
+ ListBase internal_links;
+
+ /** Root offset for drawing (parent space). */
+ float locx, locy;
+ /** Node custom width and height. */
+ float width, height;
+ /** Node width if hidden. */
+ float miniwidth;
+ /** Additional offset from loc. */
+ float offsetx, offsety;
+ /** Initial locx for insert offset animation. */
+ float anim_init_locx;
+ /** Offset that will be added to locx for insert offset animation. */
+ float anim_ofsx;
+
+ /** Update flags. */
+ int update;
+
+ /** Custom user-defined label, MAX_NAME. */
+ char label[64];
+ /** To be abused for buttons. */
+ short custom1, custom2;
float custom3, custom4;
- short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */
- void *threaddata; /* optional extra storage for use in thread (read only then!) */
- rctf totr; /* entire boundbox (worldspace) */
- rctf butr; /* optional buttons area */
- rctf prvr; /* optional preview area */
+ /** Need_exec is set as UI execution event, exec is flag during exec. */
+ short need_exec, exec;
+ /** Optional extra storage for use in thread (read only then!). */
+ void *threaddata;
+ /** Entire boundbox (worldspace). */
+ rctf totr;
+ /** Optional buttons area. */
+ rctf butr;
+ /** Optional preview area. */
+ rctf prvr;
/* XXX TODO
* Node totr size depends on the prvr size, which in turn is determined from preview size.
* In earlier versions bNodePreview was stored directly in nodes, but since now there can be
@@ -220,12 +272,24 @@ typedef struct bNode {
* could be replaced by more accurate node instance drawing, but that requires removing totr from DNA
* and replacing all uses with per-instance data.
*/
- short preview_xsize, preview_ysize; /* reserved size of the preview rect */
- short tmp_flag, pad2; /* Used at runtime when going through the tree. Initialize before use. */
- struct uiBlock *block; /* runtime during drawing */
-
- float ssr_id; /* XXX: eevee only, id of screen space reflection layer, needs to be a float to feed GPU_uniform. */
- float sss_id; /* XXX: eevee only, id of screen subsurface scatter layer, needs to be a float to feed GPU_uniform. */
+ /** Reserved size of the preview rect. */
+ short preview_xsize, preview_ysize;
+ /** Used at runtime when going through the tree. Initialize before use. */
+ short tmp_flag;
+ char _pad2[2];
+ /** Runtime during drawing. */
+ struct uiBlock *block;
+
+ /**
+ * XXX: eevee only, id of screen space reflection layer,
+ * needs to be a float to feed GPU_uniform.
+ */
+ float ssr_id;
+ /**
+ * XXX: eevee only, id of screen subsurface scatter layer,
+ * needs to be a float to feed GPU_uniform.
+ */
+ float sss_id;
} bNode;
/* node->flag */
@@ -288,21 +352,24 @@ typedef struct bNodeInstanceKey {
* WARNING: pointers are cast to this struct internally,
* it must be first member in hash entry structs!
*/
+#
+#
typedef struct bNodeInstanceHashEntry {
bNodeInstanceKey key;
/* tags for cleaning the cache */
short tag;
- short pad;
} bNodeInstanceHashEntry;
+#
+#
typedef struct bNodePreview {
- bNodeInstanceHashEntry hash_entry; /* must be first */
+ /** Must be first. */
+ bNodeInstanceHashEntry hash_entry;
unsigned char *rect;
short xsize, ysize;
- int pad;
} bNodePreview;
@@ -313,7 +380,7 @@ typedef struct bNodeLink {
bNodeSocket *fromsock, *tosock;
int flag;
- int pad;
+ char _pad[4];
} bNodeLink;
/* link->flag */
@@ -335,35 +402,53 @@ typedef struct bNodeLink {
#define NTREE_CHUNCKSIZE_1024 1024
/* the basis for a Node tree, all links and nodes reside internal here */
-/* only re-usable node trees are in the library though, materials and textures allocate own tree struct */
+/* only re-usable node trees are in the library though,
+ * materials and textures allocate own tree struct */
typedef struct bNodeTree {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
- struct bNodeTreeType *typeinfo; /* runtime type information */
- char idname[64]; /* runtime type identifier */
+ /** Runtime type information. */
+ struct bNodeTreeType *typeinfo;
+ /** Runtime type identifier. */
+ char idname[64];
- struct StructRNA *interface_type; /* runtime RNA type of the group interface */
+ /** Runtime RNA type of the group interface. */
+ struct StructRNA *interface_type;
- struct bGPdata *gpd; /* grease pencil data */
- float view_center[2]; /* node tree stores own offset for consistent editor view */
+ /** Grease pencil data. */
+ struct bGPdata *gpd;
+ /** Node tree stores own offset for consistent editor view. */
+ float view_center[2];
ListBase nodes, links;
- int type, init; /* set init on fileread */
- int cur_index; /* sockets in groups have unique identifiers, adding new sockets always
- * will increase this counter */
+ /** Set init on fileread. */
+ int type, init;
+ /**
+ * Sockets in groups have unique identifiers, adding new sockets always
+ * will increase this counter.
+ */
+ int cur_index;
int flag;
- int update; /* update flags */
- short is_updating; /* flag to prevent reentrant update calls */
- short done; /* generic temporary flag for recursion check (DFS/BFS) */
- int pad2;
-
- int nodetype DNA_DEPRECATED; /* specific node type this tree is used for */
-
- short edit_quality; /* Quality setting when editing */
- short render_quality; /* Quality setting when rendering */
- int chunksize; /* tile size for compositor engine */
+ /** Update flags. */
+ int update;
+ /** Flag to prevent reentrant update calls. */
+ short is_updating;
+ /** Generic temporary flag for recursion check (DFS/BFS). */
+ short done;
+ char _pad2[4];
+
+ /** Specific node type this tree is used for. */
+ int nodetype DNA_DEPRECATED;
+
+ /** Quality setting when editing. */
+ short edit_quality;
+ /** Quality setting when rendering. */
+ short render_quality;
+ /** Tile size for compositor engine. */
+ int chunksize;
rctf viewer_border;
@@ -381,7 +466,7 @@ typedef struct bNodeTree {
* in case multiple different editors are used and make context ambiguous.
*/
bNodeInstanceKey active_viewer_key;
- int pad;
+ char _pad[4];
/* execution data */
/* XXX It would be preferable to completely move this data out of the underlying node tree,
@@ -420,7 +505,9 @@ typedef struct bNodeTree {
#define NTREE_COM_GROUPNODE_BUFFER (1 << 3) /* use groupnode buffers */
#define NTREE_VIEWER_BORDER (1 << 4) /* use a border for viewer nodes */
/* NOTE: DEPRECATED, use (id->tag & LIB_TAG_LOCALIZED) instead. */
-/* #define NTREE_IS_LOCALIZED (1 << 5) */ /* tree is localized copy, free when deleting node groups */
+
+/* tree is localized copy, free when deleting node groups */
+/* #define NTREE_IS_LOCALIZED (1 << 5) */
/* XXX not nice, but needed as a temporary flags
* for group updates after library linking.
@@ -441,7 +528,7 @@ typedef enum eNodeTreeUpdate {
NTREE_UPDATE_GROUP_IN = (1 << 4), /* group inputs have changed */
NTREE_UPDATE_GROUP_OUT = (1 << 5), /* group outputs have changed */
/* group has changed (generic flag including all other group flags) */
- NTREE_UPDATE_GROUP = (NTREE_UPDATE_GROUP_IN | NTREE_UPDATE_GROUP_OUT)
+ NTREE_UPDATE_GROUP = (NTREE_UPDATE_GROUP_IN | NTREE_UPDATE_GROUP_OUT),
} eNodeTreeUpdate;
@@ -450,24 +537,27 @@ typedef enum eNodeTreeUpdate {
*/
typedef struct bNodeSocketValueInt {
- int subtype; /* RNA subtype */
+ /** RNA subtype. */
+ int subtype;
int value;
int min, max;
} bNodeSocketValueInt;
typedef struct bNodeSocketValueFloat {
- int subtype; /* RNA subtype */
+ /** RNA subtype. */
+ int subtype;
float value;
float min, max;
} bNodeSocketValueFloat;
typedef struct bNodeSocketValueBoolean {
char value;
- char pad[3];
+ char _pad[3];
} bNodeSocketValueBoolean;
typedef struct bNodeSocketValueVector {
- int subtype; /* RNA subtype */
+ /** RNA subtype. */
+ int subtype;
float value[3];
float min, max;
} bNodeSocketValueVector;
@@ -478,8 +568,9 @@ typedef struct bNodeSocketValueRGBA {
typedef struct bNodeSocketValueString {
int subtype;
- int pad;
- char value[1024]; /* 1024 = FILEMAX */
+ char _pad[4];
+ /** 1024 = FILEMAX. */
+ char value[1024];
} bNodeSocketValueString;
/* data structs, for node->storage */
@@ -487,25 +578,25 @@ enum {
CMP_NODE_MASKTYPE_ADD = 0,
CMP_NODE_MASKTYPE_SUBTRACT = 1,
CMP_NODE_MASKTYPE_MULTIPLY = 2,
- CMP_NODE_MASKTYPE_NOT = 3
+ CMP_NODE_MASKTYPE_NOT = 3,
};
enum {
CMP_NODE_LENSFLARE_GHOST = (1 << 0),
CMP_NODE_LENSFLARE_GLOW = (1 << 1),
CMP_NODE_LENSFLARE_CIRCLE = (1 << 2),
- CMP_NODE_LENSFLARE_STREAKS = (1 << 3)
+ CMP_NODE_LENSFLARE_STREAKS = (1 << 3),
};
enum {
CMP_NODE_DILATEERODE_STEP = 0,
CMP_NODE_DILATEERODE_DISTANCE_THRESH = 1,
CMP_NODE_DILATEERODE_DISTANCE = 2,
- CMP_NODE_DILATEERODE_DISTANCE_FEATHER = 3
+ CMP_NODE_DILATEERODE_DISTANCE_FEATHER = 3,
};
enum {
- CMP_NODE_INPAINT_SIMPLE = 0
+ CMP_NODE_INPAINT_SIMPLE = 0,
};
enum {
@@ -515,7 +606,7 @@ enum {
/* we may want multiple aspect options, exposed as an rna enum */
CMP_NODEFLAG_MASK_FIXED = (1 << 8),
- CMP_NODEFLAG_MASK_FIXED_SCENE = (1 << 9)
+ CMP_NODEFLAG_MASK_FIXED_SCENE = (1 << 9),
};
enum {
@@ -535,7 +626,7 @@ typedef struct NodeImageAnim {
int nr DNA_DEPRECATED;
char cyclic DNA_DEPRECATED;
char movie DNA_DEPRECATED;
- short pad;
+ char _pad[2];
} NodeImageAnim;
typedef struct ColorCorrectionData {
@@ -544,7 +635,7 @@ typedef struct ColorCorrectionData {
float gamma;
float gain;
float lift;
- int pad;
+ char _pad[4];
} ColorCorrectionData;
typedef struct NodeColorCorrection {
@@ -570,7 +661,7 @@ typedef struct NodeBoxMask {
float rotation;
float height;
float width;
- int pad;
+ char _pad[4];
} NodeBoxMask;
typedef struct NodeEllipseMask {
@@ -579,7 +670,7 @@ typedef struct NodeEllipseMask {
float rotation;
float height;
float width;
- int pad;
+ char _pad[4];
} NodeEllipseMask;
/* layer info for image node outputs */
@@ -587,7 +678,8 @@ typedef struct NodeImageLayer {
/* index in the Image->layers->passes lists */
int pass_index DNA_DEPRECATED;
/* render pass name */
- char pass_name[64]; /* amount defined in openexr_multi.h */
+ /** Amount defined in openexr_multi.h. */
+ char pass_name[64];
} NodeImageLayer;
typedef struct NodeBlurData {
@@ -597,18 +689,20 @@ typedef struct NodeBlurData {
float fac, percentx, percenty;
short filtertype;
char bokeh, gamma;
- int image_in_width, image_in_height; /* needed for absolute/relative conversions */
+ /** Needed for absolute/relative conversions. */
+ int image_in_width, image_in_height;
} NodeBlurData;
typedef struct NodeDBlurData {
float center_x, center_y, distance, angle, spin, zoom;
short iter;
- char wrap, pad;
+ char wrap, _pad;
} NodeDBlurData;
typedef struct NodeBilateralBlurData {
float sigma_color, sigma_space;
- short iter, pad;
+ short iter;
+ char _pad[2];
} NodeBilateralBlurData;
/* NOTE: Only for do-version code. */
@@ -617,30 +711,37 @@ typedef struct NodeHueSat {
} NodeHueSat;
typedef struct NodeImageFile {
- char name[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char name[1024];
struct ImageFormatData im_format;
int sfra, efra;
} NodeImageFile;
/* XXX first struct fields should match NodeImageFile to ensure forward compatibility */
typedef struct NodeImageMultiFile {
- char base_path[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char base_path[1024];
ImageFormatData format;
- int sfra DNA_DEPRECATED, efra DNA_DEPRECATED; /* XXX old frame rand values from NodeImageFile for forward compatibility */
- int active_input; /* selected input in details view list */
- int pad;
+ /** XXX old frame rand values from NodeImageFile for forward compatibility. */
+ int sfra DNA_DEPRECATED, efra DNA_DEPRECATED;
+ /** Selected input in details view list. */
+ int active_input;
+ char _pad[4];
} NodeImageMultiFile;
typedef struct NodeImageMultiFileSocket {
/* single layer file output */
short use_render_format DNA_DEPRECATED;
- short use_node_format; /* use overall node image format */
- int pad1;
- char path[1024]; /* 1024 = FILE_MAX */
+ /** Use overall node image format. */
+ short use_node_format;
+ char _pad1[4];
+ /** 1024 = FILE_MAX. */
+ char path[1024];
ImageFormatData format;
/* multilayer output */
- char layer[30]; /* EXR_TOT_MAXNAME-2 ('.' and channel char are appended) */
- char pad2[2];
+ /** EXR_TOT_MAXNAME-2 ('.' and channel char are appended). */
+ char layer[30];
+ char _pad2[2];
} NodeImageMultiFileSocket;
typedef struct NodeChroma {
@@ -665,24 +766,29 @@ typedef struct NodeVertexCol {
/* qdn: Defocus blur node */
typedef struct NodeDefocus {
- char bktype, pad_c1, preview, gamco;
+ char bktype, _pad0, preview, gamco;
short samples, no_zbuf;
float fstop, maxblur, bthresh, scale;
- float rotation, pad_f1;
+ float rotation;
+ char _pad1[4];
} NodeDefocus;
typedef struct NodeScriptDict {
- void *dict; /* for PyObject *dict */
- void *node; /* for BPy_Node *node */
+ /** For PyObject *dict. */
+ void *dict;
+ /** For BPy_Node *node. */
+ void *node;
} NodeScriptDict;
/* qdn: glare node */
typedef struct NodeGlare {
char quality, type, iter;
- /* XXX angle is only kept for backward/forward compatibility, was used for two different things, see T50736. */
- char angle DNA_DEPRECATED, pad_c1, size, star_45, streaks;
+ /* XXX angle is only kept for backward/forward compatibility,
+ * was used for two different things, see T50736. */
+ char angle DNA_DEPRECATED, _pad0, size, star_45, streaks;
float colmod, mix, threshold, fade;
- float angle_ofs, pad_f1;
+ float angle_ofs;
+ char _pad1[4];
} NodeGlare;
/* qdn: tonemap node */
@@ -694,7 +800,8 @@ typedef struct NodeTonemap {
/* qdn: lens distortion node */
typedef struct NodeLensDist {
- short jit, proj, fit, pad;
+ short jit, proj, fit;
+ char _pad[2];
} NodeLensDist;
typedef struct NodeColorBalance {
@@ -719,7 +826,7 @@ typedef struct NodeColorspill {
typedef struct NodeDilateErode {
char falloff;
- char pad[7];
+ char _pad[7];
} NodeDilateErode;
typedef struct NodeMask {
@@ -747,7 +854,7 @@ typedef struct NodeTexImage {
float projection_blend;
int interpolation;
int extension;
- int pad;
+ char _pad[4];
} NodeTexImage;
typedef struct NodeTexChecker {
@@ -766,13 +873,13 @@ typedef struct NodeTexEnvironment {
int color_space;
int projection;
int interpolation;
- int pad;
+ char _pad[4];
} NodeTexEnvironment;
typedef struct NodeTexGradient {
NodeTexBase base;
int gradient_type;
- int pad;
+ char _pad[4];
} NodeTexGradient;
typedef struct NodeTexNoise {
@@ -784,13 +891,13 @@ typedef struct NodeTexVoronoi {
int coloring;
int distance;
int feature;
- int pad;
+ char _pad[4];
} NodeTexVoronoi;
typedef struct NodeTexMusgrave {
NodeTexBase base;
int musgrave_type;
- int pad;
+ char _pad[4];
} NodeTexMusgrave;
typedef struct NodeTexWave {
@@ -802,7 +909,7 @@ typedef struct NodeTexWave {
typedef struct NodeTexMagic {
NodeTexBase base;
int depth;
- int pad;
+ char _pad[4];
} NodeTexMagic;
typedef struct NodeShaderAttribute {
@@ -812,12 +919,13 @@ typedef struct NodeShaderAttribute {
typedef struct NodeShaderVectTransform {
int type;
int convert_from, convert_to;
- int pad;
+ char _pad[4];
} NodeShaderVectTransform;
typedef struct NodeShaderTexPointDensity {
NodeTexBase base;
- short point_source, pad;
+ short point_source;
+ char _pad[2];
int particle_system;
float radius;
int resolution;
@@ -825,11 +933,12 @@ typedef struct NodeShaderTexPointDensity {
short interpolation;
short color_source;
short ob_color_source;
- char vertex_attribute_name[64]; /* vertex attribute layer for color source, MAX_CUSTOMDATA_LAYER_NAME */
+ /** Vertex attribute layer for color source, MAX_CUSTOMDATA_LAYER_NAME. */
+ char vertex_attribute_name[64];
/* Used at runtime only by sampling RNA API. */
PointDensity pd;
int cached_resolution;
- int pad2;
+ char _pad2[4];
} NodeShaderTexPointDensity;
/* TEX_output */
@@ -862,7 +971,7 @@ typedef struct NodeTrackPosData {
typedef struct NodeTranslateData {
char wrap_axis;
char relative;
- char pad[6];
+ char _pad[6];
} NodeTranslateData;
typedef struct NodePlaneTrackDeformData {
@@ -870,7 +979,7 @@ typedef struct NodePlaneTrackDeformData {
char plane_track_name[64];
char flag;
char motion_blur_samples;
- char pad[2];
+ char _pad[2];
float motion_blur_shutter;
} NodePlaneTrackDeformData;
@@ -878,7 +987,8 @@ typedef struct NodeShaderScript {
int mode;
int flag;
- char filepath[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char filepath[1024];
char bytecode_hash[64];
char *bytecode;
@@ -902,7 +1012,8 @@ typedef struct NodeShaderUVMap {
typedef struct NodeShaderTexIES {
int mode;
- char filepath[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char filepath[1024];
} NodeShaderTexIES;
typedef struct NodeSunBeams {
@@ -916,7 +1027,7 @@ typedef struct NodeCryptomatte {
float remove[3];
char *matte_id;
int num_inputs;
- int pad;
+ char _pad[4];
} NodeCryptomatte;
/* script node mode */
diff --git a/source/blender/makesdna/DNA_object_enums.h b/source/blender/makesdna/DNA_object_enums.h
index 13e68698d1a..77f474eab1e 100644
--- a/source/blender/makesdna/DNA_object_enums.h
+++ b/source/blender/makesdna/DNA_object_enums.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_object_enums.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*
* Enums typedef's for use in public headers.
*/
diff --git a/source/blender/makesdna/DNA_object_fluidsim_types.h b/source/blender/makesdna/DNA_object_fluidsim_types.h
index 9ddae38edf2..534eaf3c780 100644
--- a/source/blender/makesdna/DNA_object_fluidsim_types.h
+++ b/source/blender/makesdna/DNA_object_fluidsim_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004-2005 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_object_fluidsim_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_OBJECT_FLUIDSIM_TYPES_H__
@@ -39,18 +31,19 @@
extern "C" {
#endif
-struct Mesh;
struct Ipo;
+struct Mesh;
typedef struct FluidVertexVelocity {
float vel[3];
} FluidVertexVelocity;
typedef struct FluidsimSettings {
- struct FluidsimModifierData *fmd; /* for fast RNA access */
+ /** For fast RNA access. */
+ struct FluidsimModifierData *fmd;
/* threadcont the calculation is done with */
int threads;
- int pad1;
+ char _pad1[4];
/* domain, fluid or obstacle */
short type;
/* display advanced options in fluid sim tab (on=1, off=0)*/
@@ -78,7 +71,7 @@ typedef struct FluidsimSettings {
int bakeStart, bakeEnd;
/* offset for baked frames */
int frameOffset;
- int pad2;
+ char _pad2[4];
/* g star param (LBM compressibility) */
float gstar;
/* activate refinement? */
@@ -102,7 +95,10 @@ typedef struct FluidsimSettings {
/* additional flags depending on the type, lower short contains flags
* to check validity, higher short additional flags */
short typeFlags;
- /* switch off velocity generation, volume init type for fluid/obstacles (volume=1, shell=2, both=3) */
+ /**
+ * Switch off velocity generation,
+ * volume init type for fluid/obstacles (volume=1, shell=2, both=3).
+ */
char domainNovecgen, volumeInitType;
/* boundary "stickiness" for part slip values */
@@ -114,18 +110,19 @@ typedef struct FluidsimSettings {
float generateParticles;
/* smooth fluid surface? */
float surfaceSmoothing;
- /* number of surface subdivisions*/
+ /** Number of surface subdivisions. */
int surfaceSubdivs;
- int flag; /* GUI flags */
+ /** GUI flags. */
+ int flag;
- /* particle display - size scaling, and alpha influence */
+ /** Particle display - size scaling, and alpha influence. */
float particleInfSize, particleInfAlpha;
/* testing vars */
float farFieldSize;
- /* vertex velocities of simulated fluid mesh */
+ /** Vertex velocities of simulated fluid mesh. */
struct FluidVertexVelocity *meshVelocities;
- /* number of vertices in simulated fluid mesh */
+ /** Number of vertices in simulated fluid mesh. */
int totvert;
/* Fluid control settings */
@@ -140,7 +137,7 @@ typedef struct FluidsimSettings {
int lastgoodframe;
- /* Simulation/flow rate control (i.e. old "Fac-Time") */
+ /** Simulation/flow rate control (i.e. old "Fac-Time"). */
float animRate;
} FluidsimSettings;
@@ -161,7 +158,8 @@ typedef struct FluidsimSettings {
#define OB_FSBND_FREESLIP (1<<(OB_TYPEFLAG_START+4))
#define OB_FSINFLOW_LOCALCOORD (1<<(OB_TYPEFLAG_START+5))
-/* surface generation flag (part of enabling chapter 6 of "Free Surface Flows with Moving and Deforming Objects for LBM") */
+/* surface generation flag (part of enabling chapter 6 of
+ * "Free Surface Flows with Moving and Deforming Objects for LBM") */
#define OB_FSSG_NOOBS (1<<(OB_TYPEFLAG_START+6))
// guiDisplayMode particle flags
diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h
index cf206aada18..c7bb3dad809 100644
--- a/source/blender/makesdna/DNA_object_force_types.h
+++ b/source/blender/makesdna/DNA_object_force_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2004-2005 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_object_force_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_OBJECT_FORCE_TYPES_H__
@@ -41,97 +33,153 @@ extern "C" {
/* pd->forcefield: Effector Fields types */
typedef enum ePFieldType {
- PFIELD_NULL = 0, /* (this is used for general effector weight) */
- PFIELD_FORCE = 1, /* Force away/towards a point depending on force strength */
- PFIELD_VORTEX = 2, /* Force around the effector normal */
- PFIELD_MAGNET = 3, /* Force from the cross product of effector normal and point velocity */
- PFIELD_WIND = 4, /* Force away and towards a point depending which side of the effector */
- /* normal the point is */
- PFIELD_GUIDE = 5, /* Force along curve for dynamics, a shaping curve for hair paths */
- PFIELD_TEXTURE = 6, /* Force based on texture values calculated at point coordinates */
- PFIELD_HARMONIC = 7, /* Force of a harmonic (damped) oscillator */
- PFIELD_CHARGE = 8, /* Force away/towards a point depending on point charge */
- PFIELD_LENNARDJ = 9, /* Force due to a Lennard-Jones potential */
- PFIELD_BOID = 10, /* Defines predator / goal for boids */
- PFIELD_TURBULENCE = 11, /* Force defined by BLI_gTurbulence */
- PFIELD_DRAG = 12, /* Linear & quadratic drag */
- PFIELD_SMOKEFLOW = 13, /* Force based on smoke simulation air flow */
+ /** (this is used for general effector weight). */
+ PFIELD_NULL = 0,
+ /** Force away/towards a point depending on force strength. */
+ PFIELD_FORCE = 1,
+ /** Force around the effector normal. */
+ PFIELD_VORTEX = 2,
+ /** Force from the cross product of effector normal and point velocity. */
+ PFIELD_MAGNET = 3,
+ /** Force away and towards a point depending which side of the effector normal the point is. */
+ PFIELD_WIND = 4,
+ /** Force along curve for dynamics, a shaping curve for hair paths. */
+ PFIELD_GUIDE = 5,
+ /** Force based on texture values calculated at point coordinates. */
+ PFIELD_TEXTURE = 6,
+ /** Force of a harmonic (damped) oscillator. */
+ PFIELD_HARMONIC = 7,
+ /** Force away/towards a point depending on point charge. */
+ PFIELD_CHARGE = 8,
+ /** Force due to a Lennard-Jones potential. */
+ PFIELD_LENNARDJ = 9,
+ /** Defines predator / goal for boids. */
+ PFIELD_BOID = 10,
+ /** Force defined by BLI_gTurbulence. */
+ PFIELD_TURBULENCE = 11,
+ /** Linear & quadratic drag. */
+ PFIELD_DRAG = 12,
+ /** Force based on smoke simulation air flow. */
+ PFIELD_SMOKEFLOW = 13,
+
NUM_PFIELD_TYPES
} ePFieldType;
typedef struct PartDeflect {
- int flag; /* general settings flag */
- short deflect; /* Deflection flag - does mesh deflect particles */
- short forcefield; /* Force field type, do the vertices attract / repel particles? */
- short falloff; /* fall-off type */
- short shape; /* point, plane or surface */
- short tex_mode; /* texture effector */
- short kink, kink_axis; /* for curve guide */
+ /** General settings flag. */
+ int flag;
+ /** Deflection flag - does mesh deflect particles. */
+ short deflect;
+ /** Force field type, do the vertices attract / repel particles? */
+ short forcefield;
+ /** Fall-off type. */
+ short falloff;
+ /** Point, plane or surface. */
+ short shape;
+ /** Texture effector. */
+ short tex_mode;
+ /** For curve guide. */
+ short kink, kink_axis;
short zdir;
/* Main effector values */
- float f_strength; /* The strength of the force (+ or - ) */
- float f_damp; /* Damping ratio of the harmonic effector. */
- float f_flow; /* How much force is converted into "air flow", i.e. */
- /* force used as the velocity of surrounding medium. */
-
- float f_size; /* Noise size for noise effector, restlength for harmonic effector */
+ /** The strength of the force (+ or - ). */
+ float f_strength;
+ /** Damping ratio of the harmonic effector. */
+ float f_damp;
+ /**
+ * How much force is converted into "air flow", i.e.
+ * force used as the velocity of surrounding medium. */
+ float f_flow;
+
+ /** Noise size for noise effector, restlength for harmonic effector. */
+ float f_size;
/* fall-off */
- float f_power; /* The power law - real gravitation is 2 (square) */
- float maxdist; /* if indicated, use this maximum */
- float mindist; /* if indicated, use this minimum */
- float f_power_r; /* radial fall-off power */
- float maxrad; /* radial versions of above */
+ /** The power law - real gravitation is 2 (square). */
+ float f_power;
+ /** If indicated, use this maximum. */
+ float maxdist;
+ /** If indicated, use this minimum. */
+ float mindist;
+ /** Radial fall-off power. */
+ float f_power_r;
+ /** Radial versions of above. */
+ float maxrad;
float minrad;
/* particle collisions */
- float pdef_damp; /* Damping factor for particle deflection */
- float pdef_rdamp; /* Random element of damping for deflection */
- float pdef_perm; /* Chance of particle passing through mesh */
- float pdef_frict; /* Friction factor for particle deflection */
- float pdef_rfrict; /* Random element of friction for deflection */
- float pdef_stickness;/* surface particle stickiness */
-
- float absorption; /* used for forces */
+ /** Damping factor for particle deflection. */
+ float pdef_damp;
+ /** Random element of damping for deflection. */
+ float pdef_rdamp;
+ /** Chance of particle passing through mesh. */
+ float pdef_perm;
+ /** Friction factor for particle deflection. */
+ float pdef_frict;
+ /** Random element of friction for deflection. */
+ float pdef_rfrict;
+ /** Surface particle stickiness. */
+ float pdef_stickness;
+
+ /** Used for forces. */
+ float absorption;
/* softbody collisions */
- float pdef_sbdamp; /* Damping factor for softbody deflection */
- float pdef_sbift; /* inner face thickness for softbody deflection */
- float pdef_sboft; /* outer face thickness for softbody deflection */
+ /** Damping factor for softbody deflection. */
+ float pdef_sbdamp;
+ /** Inner face thickness for softbody deflection. */
+ float pdef_sbift;
+ /** Outer face thickness for softbody deflection. */
+ float pdef_sboft;
/* guide curve, same as for particle child effects */
float clump_fac, clump_pow;
float kink_freq, kink_shape, kink_amp, free_end;
/* texture effector */
- float tex_nabla; /* Used for calculating partial derivatives */
- struct Tex *tex; /* Texture of the texture effector */
+ /** Used for calculating partial derivatives. */
+ float tex_nabla;
+ /** Texture of the texture effector. */
+ struct Tex *tex;
/* effector noise */
- struct RNG *rng; /* random noise generator for e.g. wind */
- float f_noise; /* noise of force */
- int seed; /* noise random seed */
+ /** Random noise generator for e.g. wind. */
+ struct RNG *rng;
+ /** Noise of force. */
+ float f_noise;
+ /** Noise random seed. */
+ int seed;
/* Display Size */
- float drawvec1[4]; /* Runtime only : start of the curve or draw scale */
- float drawvec2[4]; /* Runtime only : end of the curve */
- float drawvec_falloff_min[3], pad1; /* Runtime only */
- float drawvec_falloff_max[3], pad2; /* Runtime only */
-
- struct Object *f_source; /* force source object */
-
- float pdef_cfrict; /* Friction of cloth collisions. */
- float pad;
+ /** Runtime only : start of the curve or draw scale. */
+ float drawvec1[4];
+ /** Runtime only : end of the curve. */
+ float drawvec2[4];
+ /** Runtime only. */
+ float drawvec_falloff_min[3];
+ char _pad1[4];
+ /** Runtime only. */
+ float drawvec_falloff_max[3];
+ char _pad2[4];
+
+ /** Force source object. */
+ struct Object *f_source;
+
+ /** Friction of cloth collisions. */
+ float pdef_cfrict;
+ char _pad[4];
} PartDeflect;
typedef struct EffectorWeights {
- struct Collection *group; /* only use effectors from this group of objects */
+ /** Only use effectors from this group of objects. */
+ struct Collection *group;
- float weight[14]; /* effector type specific weights */
+ /** Effector type specific weights. */
+ float weight[14];
float global_gravity;
short flag, rt[3];
- int pad;
+ char _pad[4];
} EffectorWeights;
/* EffectorWeights->flag */
@@ -171,51 +219,69 @@ typedef struct PTCacheMem {
unsigned int frame, totpoint;
unsigned int data_types, flag;
- void *data[8]; /* BPHYS_TOT_DATA */
- void *cur[8]; /* BPHYS_TOT_DATA */
+ /** BPHYS_TOT_DATA. */
+ void *data[8];
+ /** BPHYS_TOT_DATA. */
+ void *cur[8];
struct ListBase extradata;
} PTCacheMem;
typedef struct PointCache {
struct PointCache *next, *prev;
- int flag; /* generic flag */
-
- int step; /* The number of frames between cached frames.
- * This should probably be an upper bound for a per point adaptive step in the future,
- * buf for now it's the same for all points. Without adaptivity this can effect the perceived
- * simulation quite a bit though. If for example particles are colliding with a horizontal
- * plane (with high damping) they quickly come to a stop on the plane, however there are still
- * forces acting on the particle (gravity and collisions), so the particle velocity isn't necessarily
- * zero for the whole duration of the frame even if the particle seems stationary. If all simulation
- * frames aren't cached (step > 1) these velocities are interpolated into movement for the non-cached
- * frames. The result will look like the point is oscillating around the collision location. So for
- * now cache step should be set to 1 for accurate reproduction of collisions.
- */
-
- int simframe; /* current frame of simulation (only if SIMULATION_VALID) */
- int startframe; /* simulation start frame */
- int endframe; /* simulation end frame */
- int editframe; /* frame being edited (runtime only) */
- int last_exact; /* last exact frame that's cached */
- int last_valid; /* used for editing cache - what is the last baked frame */
- int pad;
+ /** Generic flag. */
+ int flag;
+
+ /**
+ * The number of frames between cached frames.
+ * This should probably be an upper bound for a per point adaptive step in the future,
+ * buf for now it's the same for all points. Without adaptivity this can effect the perceived
+ * simulation quite a bit though. If for example particles are colliding with a horizontal
+ * plane (with high damping) they quickly come to a stop on the plane, however there are still
+ * forces acting on the particle (gravity and collisions), so the particle velocity isn't necessarily
+ * zero for the whole duration of the frame even if the particle seems stationary. If all simulation
+ * frames aren't cached (step > 1) these velocities are interpolated into movement for the non-cached
+ * frames. The result will look like the point is oscillating around the collision location. So for
+ * now cache step should be set to 1 for accurate reproduction of collisions.
+ */
+ int step;
+
+ /** Current frame of simulation (only if SIMULATION_VALID). */
+ int simframe;
+ /** Simulation start frame. */
+ int startframe;
+ /** Simulation end frame. */
+ int endframe;
+ /** Frame being edited (runtime only). */
+ int editframe;
+ /** Last exact frame that's cached. */
+ int last_exact;
+ /** Used for editing cache - what is the last baked frame. */
+ int last_valid;
+ char _pad[4];
/* for external cache files */
- int totpoint; /* number of cached points */
- int index; /* modifier stack index */
+ /** Number of cached points. */
+ int totpoint;
+ /** Modifier stack index. */
+ int index;
short compression, rt;
char name[64];
char prev_name[64];
char info[64];
- char path[1024]; /* file path, 1024 = FILE_MAX */
- char *cached_frames; /* array of length endframe-startframe+1 with flags to indicate cached frames */
- /* can be later used for other per frame flags too if needed */
+ /** File path, 1024 = FILE_MAX. */
+ char path[1024];
+ /**
+ * Array of length endframe-startframe+1 with flags to indicate cached frames.
+ * Can be later used for other per frame flags too if needed.
+ */
+ char *cached_frames;
struct ListBase mem_cache;
struct PTCacheEdit *edit;
- void (*free_edit)(struct PTCacheEdit *edit); /* free callback */
+ /** Free callback. */
+ void (*free_edit)(struct PTCacheEdit *edit);
} PointCache;
typedef struct SBVertex {
@@ -234,61 +300,88 @@ typedef struct SoftBody_Shared {
typedef struct SoftBody {
/* dynamic data */
int totpoint, totspring;
- struct BodyPoint *bpoint; /* not saved in file */
- struct BodySpring *bspring; /* not saved in file */
- char pad;
+ /** Not saved in file. */
+ struct BodyPoint *bpoint;
+ /** Not saved in file. */
+ struct BodySpring *bspring;
+ char _pad;
char msg_lock;
short msg_value;
/* part of UI: */
/* general options */
- float nodemass; /* softbody mass of *vertex* */
- char namedVG_Mass[64]; /* MAX_VGROUP_NAME */
- /* along with it introduce mass painting
- * starting to fix old bug .. nastiness that VG are indexes
- * rather find them by name tag to find it -> jow20090613 */
- float grav; /* softbody amount of gravitaion to apply */
- float mediafrict; /* friction to env */
- float rklimit; /* error limit for ODE solver */
- float physics_speed;/* user control over simulation speed */
+ /** Softbody mass of *vertex*. */
+ float nodemass;
+ /**
+ * Along with it introduce mass painting
+ * starting to fix old bug .. nastiness that VG are indexes
+ * rather find them by name tag to find it -> jow20090613.
+ * MAX_VGROUP_NAME */
+ char namedVG_Mass[64];
+ /** Softbody amount of gravitaion to apply. */
+ float grav;
+ /** Friction to env. */
+ float mediafrict;
+ /** Error limit for ODE solver. */
+ float rklimit;
+ /** User control over simulation speed. */
+ float physics_speed;
/* goal */
- float goalspring; /* softbody goal springs */
- float goalfrict; /* softbody goal springs friction */
- float mingoal; /* quick limits for goal */
+ /** Softbody goal springs. */
+ float goalspring;
+ /** Softbody goal springs friction. */
+ float goalfrict;
+ /** Quick limits for goal. */
+ float mingoal;
float maxgoal;
- float defgoal; /* default goal for vertices without vgroup */
- short vertgroup; /* index starting at 1 */
- char namedVG_Softgoal[64]; /* MAX_VGROUP_NAME */
- /* starting to fix old bug .. nastiness that VG are indexes
- * rather find them by name tag to find it -> jow20090613 */
-
- short fuzzyness; /* */
+ /** Default goal for vertices without vgroup. */
+ float defgoal;
+ /** Index starting at 1. */
+ short vertgroup;
+ /**
+ * Starting to fix old bug .. nastiness that VG are indexes
+ * rather find them by name tag to find it -> jow20090613.
+ * MAX_VGROUP_NAME */
+ char namedVG_Softgoal[64];
+
+ short fuzzyness;
/* springs */
- float inspring; /* softbody inner springs */
- float infrict; /* softbody inner springs friction */
- char namedVG_Spring_K[64]; /* MAX_VGROUP_NAME */
- /* along with it introduce Spring_K painting
- * starting to fix old bug .. nastiness that VG are indexes
- * rather find them by name tag to find it -> jow20090613 */
+ /** Softbody inner springs. */
+ float inspring;
+ /** Softbody inner springs friction. */
+ float infrict;
+ /**
+ * Along with it introduce Spring_K painting
+ * starting to fix old bug .. nastiness that VG are indexes
+ * rather find them by name tag to find it -> jow20090613.
+ * MAX_VGROUP_NAME
+ */
+ char namedVG_Spring_K[64];
/* baking */
int sfra, efra;
int interval;
- short local, solverflags; /* local==1: use local coords for baking */
+ /** Local==1: use local coords for baking. */
+ short local, solverflags;
/* -- these must be kept for backwards compatibility -- */
- SBVertex **keys; /* array of size totpointkey */
- int totpointkey, totkey; /* if totpointkey != totpoint or totkey!- (efra-sfra)/interval -> free keys */
+ /** Array of size totpointkey. */
+ SBVertex **keys;
+ /** If totpointkey != totpoint or totkey!- (efra-sfra)/interval -> free keys. */
+ int totpointkey, totkey;
/* ---------------------------------------------------- */
float secondspring;
/* self collision*/
- float colball; /* fixed collision ball size if > 0 */
- float balldamp; /* cooling down collision response */
- float ballstiff; /* pressure the ball is loaded with */
+ /** Fixed collision ball size if > 0. */
+ float colball;
+ /** Cooling down collision response . */
+ float balldamp;
+ /** Pressure the ball is loaded with . */
+ float ballstiff;
short sbc_mode;
short aeroedge,
minloops,
@@ -298,13 +391,16 @@ typedef struct SoftBody {
plastic, springpreload
;
- struct SBScratch *scratch; /* scratch pad/cache on live time not saved in file */
+ /** Scratchpad/cache on live time not saved in file. */
+ struct SBScratch *scratch;
float shearstiff;
float inpush;
struct SoftBody_Shared *shared;
- struct PointCache *pointcache DNA_DEPRECATED; /* Moved to SoftBody_Shared */
- struct ListBase ptcaches DNA_DEPRECATED; /* Moved to SoftBody_Shared */
+ /** Moved to SoftBody_Shared. */
+ struct PointCache *pointcache DNA_DEPRECATED;
+ /** Moved to SoftBody_Shared. */
+ struct ListBase ptcaches DNA_DEPRECATED;
struct Collection *collision_group;
@@ -321,27 +417,38 @@ typedef struct SoftBody {
/* pd->flag: various settings */
#define PFIELD_USEMAX (1 << 0)
/*#define PDEFLE_DEFORM (1 << 1)*/ /*UNUSED*/
-#define PFIELD_GUIDE_PATH_ADD (1 << 2) /* TODO: do_versions for below */
-#define PFIELD_PLANAR (1 << 3) /* used for do_versions */
+/** TODO: do_versions for below */
+#define PFIELD_GUIDE_PATH_ADD (1 << 2)
+/** used for do_versions */
+#define PFIELD_PLANAR (1 << 3)
#define PDEFLE_KILL_PART (1 << 4)
-#define PFIELD_POSZ (1 << 5) /* used for do_versions */
+/** used for do_versions */
+#define PFIELD_POSZ (1 << 5)
#define PFIELD_TEX_OBJECT (1 << 6)
-#define PFIELD_GLOBAL_CO (1 << 6) /* used for turbulence */
+/** used for turbulence */
+#define PFIELD_GLOBAL_CO (1 << 6)
#define PFIELD_TEX_2D (1 << 7)
-#define PFIELD_MULTIPLE_SPRINGS (1 << 7) /* used for harmonic force */
+/** used for harmonic force */
+#define PFIELD_MULTIPLE_SPRINGS (1 << 7)
#define PFIELD_USEMIN (1 << 8)
#define PFIELD_USEMAXR (1 << 9)
#define PFIELD_USEMINR (1 << 10)
#define PFIELD_TEX_ROOTCO (1 << 11)
-#define PFIELD_SURFACE (1 << 12) /* used for do_versions */
+/** used for do_versions */
+#define PFIELD_SURFACE (1 << 12)
#define PFIELD_VISIBILITY (1 << 13)
#define PFIELD_DO_LOCATION (1 << 14)
#define PFIELD_DO_ROTATION (1 << 15)
-#define PFIELD_GUIDE_PATH_WEIGHT (1 << 16) /* apply curve weights */
-#define PFIELD_SMOKE_DENSITY (1 << 17) /* multiply smoke force by density */
-#define PFIELD_GRAVITATION (1 << 18) /* used for (simple) force */
-#define PFIELD_CLOTH_USE_CULLING (1<< 19) /* Enable cloth collision side detection based on normal. */
-#define PFIELD_CLOTH_USE_NORMAL (1 << 20) /* Replace collision direction with collider normal. */
+/** apply curve weights */
+#define PFIELD_GUIDE_PATH_WEIGHT (1 << 16)
+/** multiply smoke force by density */
+#define PFIELD_SMOKE_DENSITY (1 << 17)
+/** used for (simple) force */
+#define PFIELD_GRAVITATION (1 << 18)
+/** Enable cloth collision side detection based on normal. */
+#define PFIELD_CLOTH_USE_CULLING (1<< 19)
+/** Replace collision direction with collider normal. */
+#define PFIELD_CLOTH_USE_NORMAL (1 << 20)
/* pd->falloff */
#define PFIELD_FALL_SPHERE 0
@@ -373,13 +480,15 @@ typedef struct SoftBody {
//#define PTCACHE_BAKE_EDIT (1 << 4)
//#define PTCACHE_BAKE_EDIT_ACTIVE (1 << 5)
#define PTCACHE_DISK_CACHE (1 << 6)
-//#define PTCACHE_QUICK_CACHE (1 << 7) /* removed since 2.64 - [#30974], could be added back in a more useful way */
+///* removed since 2.64 - [#30974], could be added back in a more useful way */
+//#define PTCACHE_QUICK_CACHE (1 << 7)
#define PTCACHE_FRAMES_SKIPPED (1 << 8)
#define PTCACHE_EXTERNAL (1 << 9)
#define PTCACHE_READ_INFO (1 << 10)
-/* don't 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 (1 << 11)
-/* high resolution cache is saved for smoke for backwards compatibility, so set this flag to know it's a "fake" cache */
+/** 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)
#define PTCACHE_IGNORE_CLEAR (1 << 13)
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 524c22a678d..3b09801b4b7 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_object_types.h
- * \ingroup DNA
- * \brief Object is a sort of wrapper for general info.
+/** \file
+ * \ingroup DNA
+ * \brief Object is a sort of wrapper for general info.
*/
#ifndef __DNA_OBJECT_TYPES_H__
@@ -36,6 +28,7 @@
#include "DNA_object_enums.h"
#include "DNA_defs.h"
+#include "DNA_customdata_types.h"
#include "DNA_listBase.h"
#include "DNA_ID.h"
#include "DNA_action_types.h" /* bAnimVizSettings */
@@ -44,36 +37,38 @@
extern "C" {
#endif
-struct Object;
struct AnimData;
-struct Ipo;
struct BoundBox;
-struct Path;
+struct DerivedMesh;
+struct FluidsimSettings;
+struct GpencilBatchCache;
+struct Ipo;
struct Material;
+struct Object;
struct PartDeflect;
-struct SoftBody;
-struct FluidsimSettings;
struct ParticleSystem;
-struct DerivedMesh;
+struct Path;
+struct RigidBodyOb;
struct SculptSession;
+struct SoftBody;
struct bGPdata;
-struct RigidBodyOb;
-struct GpencilBatchCache;
/* Vertex Groups - Name Info */
typedef struct bDeformGroup {
struct bDeformGroup *next, *prev;
- char name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char name[64];
/* need this flag for locking weights */
- char flag, pad[7];
+ char flag, _pad0[7];
} bDeformGroup;
/* Face Maps*/
typedef struct bFaceMap {
struct bFaceMap *next, *prev;
- char name[64]; /* MAX_VGROUP_NAME */
+ /** MAX_VGROUP_NAME. */
+ char name[64];
char flag;
- char pad[7];
+ char _pad0[7];
} bFaceMap;
#define MAX_VGROUP_NAME 64
@@ -91,8 +86,6 @@ typedef struct bFaceMap {
* | /
* |/
* .-----X
- *
- *
* 2----------6
* /| /|
* / | / |
@@ -106,7 +99,8 @@ typedef struct bFaceMap {
*/
typedef struct BoundBox {
float vec[8][3];
- int flag, pad;
+ int flag;
+ char _pad0[4];
} BoundBox;
/* boundbox flag */
@@ -119,113 +113,160 @@ typedef struct LodLevel {
struct LodLevel *next, *prev;
struct Object *source;
int flags;
- float distance, pad;
+ float distance;
+ char _pad0[4];
int obhysteresis;
} LodLevel;
-typedef struct ObjectDisplay {
- int flag;
-} ObjectDisplay;
-
/* Forward declaration for cache bbone deformation information.
*
* TODO(sergey): Consider moving it to more appropriate place. */
struct ObjectBBoneDeform;
+struct CustomData_MeshMasks;
+
/* Not saved in file! */
typedef struct Object_Runtime {
- /* Original mesh pointer, before object->data was changed to point
+ /**
+ * The custom data layer mask that was last used
+ * to calculate mesh_eval and mesh_deform_eval.
+ */
+ CustomData_MeshMasks last_data_mask;
+
+ /** Did last modifier stack generation need mapping support? */
+ char last_need_mapping;
+
+ char _pad0[3];
+
+ /** Only used for drawing the parent/child help-line. */
+ float parent_display_origin[3];
+
+
+ /** Axis aligned boundbox (in localspace). */
+ struct BoundBox *bb;
+
+ /**
+ * Original mesh pointer, before object->data was changed to point
* to mesh_eval.
* Is assigned by dependency graph's copy-on-write evaluation.
*/
struct Mesh *mesh_orig;
- /* Mesh structure created during object evaluation.
+ /**
+ * Mesh structure created during object evaluation.
* It has all modifiers applied.
*/
struct Mesh *mesh_eval;
- /* Mesh structure created during object evaluation.
+ /**
+ * Mesh structure created during object evaluation.
* It has deforemation only modifiers applied on it.
*/
struct Mesh *mesh_deform_eval;
-
- /* Runtime evaluated curve-specific data, not stored in the file. */
+ /** Runtime evaluated curve-specific data, not stored in the file. */
struct CurveCache *curve_cache;
- /* Runtime grease pencil drawing data */
+ /** Runtime grease pencil drawing data */
struct GpencilBatchCache *gpencil_cache;
struct ObjectBBoneDeform *cached_bbone_deformation;
- /* The custom data layer mask that was last used to calculate mesh_eval and mesh_deform_eval. */
- uint64_t last_data_mask;
-
- /* Did last modifier stack generation need mapping support? */
- char last_need_mapping;
- char pad[7];
} Object_Runtime;
typedef struct Object {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
- struct DrawDataList drawdata; /* runtime (must be immediately after id for utilities to use it). */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
+ /** Runtime (must be immediately after id for utilities to use it). */
+ struct DrawDataList drawdata;
struct SculptSession *sculpt;
short type, partype;
- int par1, par2, par3; /* can be vertexnrs */
- char parsubstr[64]; /* String describing subobject info, MAX_ID_NAME-2 */
+ /** Can be vertexnrs. */
+ int par1, par2, par3;
+ /** String describing subobject info, MAX_ID_NAME-2. */
+ char parsubstr[64];
struct Object *parent, *track;
/* if ob->proxy (or proxy_group), this object is proxy for object ob->proxy */
/* proxy_from is set in target back to the proxy. */
struct Object *proxy, *proxy_group, *proxy_from;
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
/* struct Path *path; */
- struct BoundBox *bb; /* axis aligned boundbox (in localspace) */
struct bAction *action DNA_DEPRECATED; // XXX deprecated... old animation system
struct bAction *poselib;
- struct bPose *pose; /* pose data, armature objects only */
- void *data; /* pointer to objects data - an 'ID' or NULL */
+ /** Pose data, armature objects only. */
+ struct bPose *pose;
+ /** Pointer to objects data - an 'ID' or NULL. */
+ void *data;
- struct bGPdata *gpd; /* Grease Pencil data */
+ /** Grease Pencil data. */
+ struct bGPdata *gpd;
- bAnimVizSettings avs; /* settings for visualization of object-transform animation */
- bMotionPath *mpath; /* motion path cache for this object */
- void *pad1;
+ /** Settings for visualization of object-transform animation. */
+ bAnimVizSettings avs;
+ /** Motion path cache for this object. */
+ bMotionPath *mpath;
+ void *_pad0;
ListBase constraintChannels DNA_DEPRECATED; // XXX deprecated... old animation system
ListBase effect DNA_DEPRECATED; // XXX deprecated... keep for readfile
- ListBase defbase; /* list of bDeformGroup (vertex groups) names and flag only */
- ListBase modifiers; /* list of ModifierData structures */
- ListBase greasepencil_modifiers; /* list of GpencilModifierData structures */
- ListBase fmaps; /* list of facemaps */
- ListBase shader_fx; /* list of viewport effects. Actually only used by grease pencil */
-
- int mode; /* Local object mode */
+ /** List of bDeformGroup (vertex groups) names and flag only. */
+ ListBase defbase;
+ /** List of ModifierData structures. */
+ ListBase modifiers;
+ /** List of GpencilModifierData structures. */
+ ListBase greasepencil_modifiers;
+ /** List of facemaps. */
+ ListBase fmaps;
+ /** List of viewport effects. Actually only used by grease pencil. */
+ ListBase shader_fx;
+
+ /** Local object mode. */
+ int mode;
int restore_mode;
/* materials */
- struct Material **mat; /* material slots */
- char *matbits; /* a boolean field, with each byte 1 if corresponding material is linked to object */
- int totcol; /* copy of mesh, curve & meta struct member of same name (keep in sync) */
- int actcol; /* currently selected material in the UI */
+ /** Material slots. */
+ struct Material **mat;
+ /** A boolean field, with each byte 1 if corresponding material is linked to object. */
+ char *matbits;
+ /** Copy of mesh, curve & meta struct member of same name (keep in sync). */
+ int totcol;
+ /** Currently selected material in the UI. */
+ int actcol;
/* rot en drot have to be together! (transform('r' en 's')) */
- float loc[3], dloc[3], orig[3];
- float size[3]; /* scale in fact */
- float dsize[3] DNA_DEPRECATED ; /* DEPRECATED, 2.60 and older only */
- float dscale[3]; /* ack!, changing */
- float rot[3], drot[3]; /* euler rotation */
- float quat[4], dquat[4]; /* quaternion rotation */
- float rotAxis[3], drotAxis[3]; /* axis angle rotation - axis part */
- float rotAngle, drotAngle; /* axis angle rotation - angle part */
- float obmat[4][4]; /* final worldspace matrix with constraints & animsys applied */
- float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */
- float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */
- float imat[4][4]; /* inverse matrix of 'obmat' for any other use than rendering! */
- /* note: this isn't assured to be valid as with 'obmat',
- * before using this value you should do...
- * invert_m4_m4(ob->imat, ob->obmat); */
+ float loc[3], dloc[3];
+ /** Scale (can be negative). */
+ float scale[3];
+ /** DEPRECATED, 2.60 and older only. */
+ float dsize[3] DNA_DEPRECATED ;
+ /** Ack!, changing. */
+ float dscale[3];
+ /** Euler rotation. */
+ float rot[3], drot[3];
+ /** Quaternion rotation. */
+ float quat[4], dquat[4];
+ /** Axis angle rotation - axis part. */
+ float rotAxis[3], drotAxis[3];
+ /** Axis angle rotation - angle part. */
+ float rotAngle, drotAngle;
+ /** Final worldspace matrix with constraints & animsys applied. */
+ float obmat[4][4];
+ /** Inverse result of parent, so that object doesn't 'stick' to parent. */
+ float parentinv[4][4];
+ /** Inverse result of constraints.
+ * doesn't include effect of parent or object local transform. */
+ float constinv[4][4];
+ /**
+ * Inverse matrix of 'obmat' for any other use than rendering!
+ *
+ * \note this isn't assured to be valid as with 'obmat',
+ * before using this value you should do...
+ * invert_m4_m4(ob->imat, ob->obmat);
+ */
+ float imat[4][4];
/* Previously 'imat' was used at render time, but as other places use it too
* the interactive ui of 2.5 creates problems. So now only 'imat_ren' should
@@ -233,98 +274,116 @@ typedef struct Object {
*/
float imat_ren[4][4];
- unsigned int lay DNA_DEPRECATED; /* copy of Base's layer in the scene */
+ /** Copy of Base's layer in the scene. */
+ unsigned int lay DNA_DEPRECATED;
- short flag; /* copy of Base */
- short colbits DNA_DEPRECATED; /* deprecated, use 'matbits' */
+ /** Copy of Base. */
+ short flag;
+ /** Deprecated, use 'matbits'. */
+ short colbits DNA_DEPRECATED;
- short transflag, protectflag; /* transformation settings and transform locks */
+ /** Transformation settings and transform locks . */
+ short transflag, protectflag;
short trackflag, upflag;
- short nlaflag; /* used for DopeSheet filtering settings (expanded/collapsed) */
- short pad[2];
+ /** Used for DopeSheet filtering settings (expanded/collapsed). */
+ short nlaflag;
- char pad12;
+ char _pad1;
char duplicator_visibility_flag;
- /* dupli-frame settings */
- int dupon, dupoff, dupsta, dupend;
-
/* Depsgraph */
- short base_flag; /* used by depsgraph, flushed from base */
- unsigned short base_local_view_bits; /* used by viewport, synced from base */
+ /** Used by depsgraph, flushed from base. */
+ short base_flag;
+ /** Used by viewport, synced from base. */
+ unsigned short base_local_view_bits;
/** Collision mask settings */
unsigned short col_group, col_mask;
- short rotmode; /* rotation mode - uses defines set out in DNA_action_types.h for PoseChannel rotations... */
+ /** Rotation mode - uses defines set out in DNA_action_types.h for PoseChannel rotations.... */
+ short rotmode;
- char boundtype; /* bounding box use for drawing */
- char collision_boundtype; /* bounding box type used for collision */
+ /** Bounding box use for drawing. */
+ char boundtype;
+ /** Bounding box type used for collision. */
+ char collision_boundtype;
- short dtx; /* viewport draw extra settings */
- char dt; /* viewport draw type */
+ /** Viewport draw extra settings. */
+ short dtx;
+ /** Viewport draw type. */
+ char dt;
char empty_drawtype;
float empty_drawsize;
- float dupfacesca; /* dupliface scale */
-
- float sf; /* sf is time-offset */
-
- short index; /* custom index, for renderpasses */
- unsigned short actdef; /* current deformation group, note: index starts at 1 */
- unsigned short actfmap; /* current face map, note: index starts at 1 */
- unsigned char pad5[6];
- float col[4]; /* object color */
-
- char restrictflag; /* for restricting view, select, render etc. accessible in outliner */
- char pad3;
- short softflag; /* softbody settings */
- int pad2;
-
- ListBase constraints; /* object constraints */
+ /** Dupliface scale. */
+ float instance_faces_scale;
+
+ /** Custom index, for renderpasses. */
+ short index;
+ /** Current deformation group, note: index starts at 1. */
+ unsigned short actdef;
+ /** Current face map, note: index starts at 1. */
+ unsigned short actfmap;
+ char _pad2[2];
+ /** Object color (in most cases the material color is used for drawing). */
+ float color[4];
+
+ /** Softbody settings. */
+ short softflag;
+
+ /** For restricting view, select, render etc. accessible in outliner. */
+ char restrictflag;
+
+ /** Flag for pinning. */
+ char shapeflag;
+ /** Current shape key for menu or pinned. */
+ short shapenr;
+
+ char _pad3[2];
+
+ /** Object constraints. */
+ ListBase constraints;
ListBase nlastrips DNA_DEPRECATED; // XXX deprecated... old animation system
ListBase hooks DNA_DEPRECATED; // XXX deprecated... old animation system
- ListBase particlesystem; /* particle systems */
-
- struct PartDeflect *pd; /* particle deflector/attractor/collision data */
- struct SoftBody *soft; /* if exists, saved in file */
- struct Collection *dup_group; /* object duplicator for group */
- void *pad10;
+ /** Particle systems. */
+ ListBase particlesystem;
- char pad4;
- char shapeflag; /* flag for pinning */
- short shapenr; /* current shape key for menu or pinned */
- float smoothresh; /* smoothresh is phong interpolation ray_shadow correction in render */
+ /** Particle deflector/attractor/collision data. */
+ struct PartDeflect *pd;
+ /** If exists, saved in file. */
+ struct SoftBody *soft;
+ /** Object duplicator for group. */
+ struct Collection *instance_collection;
- struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
+ /** If fluidsim enabled, store additional settings. */
+ struct FluidsimSettings *fluidsimSettings;
struct DerivedMesh *derivedDeform, *derivedFinal;
- void *pad7;
ListBase pc_ids;
- struct RigidBodyOb *rigidbody_object; /* settings for Bullet rigid body */
- struct RigidBodyCon *rigidbody_constraint; /* settings for Bullet constraint */
+ /** Settings for Bullet rigid body. */
+ struct RigidBodyOb *rigidbody_object;
+ /** Settings for Bullet constraint. */
+ struct RigidBodyCon *rigidbody_constraint;
- float ima_ofs[2]; /* offset for image empties */
- ImageUser *iuser; /* must be non-null when object is an empty image */
+ /** Offset for image empties. */
+ float ima_ofs[2];
+ /** Must be non-null when object is an empty image. */
+ ImageUser *iuser;
char empty_image_visibility_flag;
char empty_image_depth;
- char pad11[6];
+ char _pad8[2];
- ListBase lodlevels; /* contains data for levels of detail */
+ int select_id;
+
+ /** Contains data for levels of detail. */
+ ListBase lodlevels;
LodLevel *currentlod;
struct PreviewImage *preview;
- int pad6;
- int select_color;
-
- /* Runtime evaluation data. */
+ /** Runtime evaluation data (keep last). */
Object_Runtime runtime;
-
- /* Object Display */
- struct ObjectDisplay display;
- int pad9;
} Object;
/* Warning, this is not used anymore because hooks are now modifiers */
@@ -332,16 +391,23 @@ typedef struct ObHook {
struct ObHook *next, *prev;
struct Object *parent;
- float parentinv[4][4]; /* matrix making current transform unmodified */
- float mat[4][4]; /* temp matrix while hooking */
- float cent[3]; /* visualization of hook */
- float falloff; /* if not zero, falloff is distance where influence zero */
-
- char name[64]; /* MAX_NAME */
+ /** Matrix making current transform unmodified. */
+ float parentinv[4][4];
+ /** Temp matrix while hooking. */
+ float mat[4][4];
+ /** Visualization of hook. */
+ float cent[3];
+ /** If not zero, falloff is distance where influence zero. */
+ float falloff;
+
+ /** MAX_NAME. */
+ char name[64];
int *indexar;
- int totindex, curindex; /* curindex is cache for fast lookup */
- short type, active; /* active is only first hook, for button menu */
+ /** Curindex is cache for fast lookup. */
+ int totindex, curindex;
+ /** Active is only first hook, for button menu. */
+ short type, active;
float force;
} ObHook;
@@ -365,22 +431,16 @@ enum {
OB_SPEAKER = 12,
OB_LIGHTPROBE = 13,
-/* OB_WAVE = 21, */
OB_LATTICE = 22,
-/* 23 and 24 are for life and sector (old file compat.) */
OB_ARMATURE = 25,
-/* Grease Pencil object used in 3D view but not used for annotation in 2D */
+
+ /** Grease Pencil object used in 3D view but not used for annotation in 2D. */
OB_GPENCIL = 26,
OB_TYPE_MAX,
};
-/* ObjectDisplay.flag */
-enum {
- OB_SHOW_SHADOW = (1 << 0),
-};
-
/* check if the object type supports materials */
#define OB_TYPE_SUPPORT_MATERIAL(_type) \
(((_type) >= OB_MESH && (_type) <= OB_MBALL) || ((_type) == OB_GPENCIL))
@@ -406,39 +466,35 @@ enum {
enum {
PARTYPE = (1 << 4) - 1,
PAROBJECT = 0,
-#ifdef DNA_DEPRECATED
- PARCURVE = 1, /* Deprecated. */
-#endif
- PARKEY = 2, /* XXX Unused, deprecated? */
-
PARSKEL = 4,
PARVERT1 = 5,
PARVERT3 = 6,
PARBONE = 7,
- /* slow parenting - is not threadsafe and/or may give errors after jumping */
- PARSLOW = 16,
};
/* (short) transflag */
enum {
- OB_TRANSFLAG_DEPRECATED_0 = 1 << 0,
- OB_TRANSFLAG_DEPRECATED_1 = 1 << 1,
+ OB_TRANSFLAG_DEPRECATED_0 = 1 << 0, /* cleared */
+ OB_TRANSFLAG_DEPRECATED_1 = 1 << 1, /* cleared */
OB_NEG_SCALE = 1 << 2,
- OB_DUPLIFRAMES = 1 << 3,
+ OB_TRANSFLAG_DEPRECATED_3 = 1 << 3, /* cleared */
OB_DUPLIVERTS = 1 << 4,
OB_DUPLIROT = 1 << 5,
- OB_DUPLINOSPEED = 1 << 6,
- OB_DUPLICALCDERIVED = 1 << 7, /* runtime, calculate derivedmesh for dupli before it's used */
+ OB_TRANSFLAG_DEPRECATED_6 = 1 << 6, /* cleared */
+ /* runtime, calculate derivedmesh for dupli before it's used */
+ OB_DUPLICALCDERIVED = 1 << 7,
OB_DUPLICOLLECTION = 1 << 8,
OB_DUPLIFACES = 1 << 9,
OB_DUPLIFACES_SCALE = 1 << 10,
OB_DUPLIPARTS = 1 << 11,
- OB_TRANSLFAG_DEPRECATED_2 = 1 << 12,
- OB_NO_CONSTRAINTS = 1 << 13, /* runtime constraints disable */
- OB_NO_PSYS_UPDATE = 1 << 14, /* hack to work around particle issue */
+ OB_TRANSFLAG_DEPRECATED_12 = 1 << 12, /* cleared */
+ /* runtime constraints disable */
+ OB_NO_CONSTRAINTS = 1 << 13,
+ /* hack to work around particle issue */
+ OB_NO_PSYS_UPDATE = 1 << 14,
- OB_DUPLI = OB_DUPLIFRAMES | OB_DUPLIVERTS | OB_DUPLICOLLECTION | OB_DUPLIFACES | OB_DUPLIPARTS,
+ OB_DUPLI = OB_DUPLIVERTS | OB_DUPLICOLLECTION | OB_DUPLIFACES | OB_DUPLIPARTS,
};
/* (short) trackflag / upflag */
@@ -475,6 +531,7 @@ enum {
/* enable transparent draw */
OB_DRAWTRANSP = 1 << 7,
OB_DRAW_ALL_EDGES = 1 << 8, /* only for meshes currently */
+ OB_DRAW_NO_SHADOW_CAST = 1 << 9,
};
/* empty_drawtype: no flags */
@@ -493,7 +550,7 @@ enum {
enum {
GP_EMPTY = 0,
GP_STROKE = 1,
- GP_MONKEY = 2
+ GP_MONKEY = 2,
};
/* boundtype */
@@ -525,7 +582,8 @@ enum {
/* NOTE: BA_HAS_RECALC_DATA can be re-used later if freed in readfile.c. */
// BA_HAS_RECALC_OB = (1 << 2), /* DEPRECATED */
// BA_HAS_RECALC_DATA = (1 << 3), /* DEPRECATED */
- BA_SNAP_FIX_DEPS_FIASCO = (1 << 2), /* DEPRECATED, was runtime only, but was reusing an older flag. */
+ /** DEPRECATED, was runtime only, but was reusing an older flag. */
+ BA_SNAP_FIX_DEPS_FIASCO = (1 << 2),
};
/* NOTE: this was used as a proper setting in past, so nullify before using */
@@ -543,12 +601,6 @@ enum {
# define OB_FLAG_DEPRECATED_12 (1 << 12) /* cleared */
#endif
-/* controller state */
-#define OB_MAX_STATES 30
-
-/* collision masks */
-#define OB_MAX_COL_MASKS 16
-
/* ob->restrictflag */
enum {
OB_RESTRICT_VIEW = 1 << 0,
@@ -567,7 +619,8 @@ enum {
/* ob->nlaflag */
enum {
- /* WARNING: flags (1 << 0) and (1 << 1) were from old animsys */
+ OB_ADS_DEPRECATED_1 = 1 << 0, /* cleared */
+ OB_ADS_DEPRECATED_2 = 1 << 1, /* cleared */
/* object-channel expanded status */
OB_ADS_COLLAPSED = 1 << 10,
/* object's ipo-block */
diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h
index 75d0ce493f5..bbd3cf62c2d 100644
--- a/source/blender/makesdna/DNA_outliner_types.h
+++ b/source/blender/makesdna/DNA_outliner_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_outliner_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_OUTLINER_TYPES_H__
@@ -46,10 +38,15 @@ typedef struct TreeStoreElem {
/* used only to store data in in blend files */
typedef struct TreeStore {
- int totelem DNA_DEPRECATED; /* was previously used for memory preallocation */
- int usedelem; /* number of elements in data array */
- TreeStoreElem *data; /* elements to be packed from mempool in writefile.c
- * or extracted to mempool in readfile.c */
+ /** Was previously used for memory preallocation. */
+ int totelem DNA_DEPRECATED;
+ /** Number of elements in data array. */
+ int usedelem;
+ /**
+ * Elements to be packed from mempool in writefile.c
+ * or extracted to mempool in readfile.c
+ */
+ TreeStoreElem *data;
} TreeStore;
/* TreeStoreElem->flag */
diff --git a/source/blender/makesdna/DNA_packedFile_types.h b/source/blender/makesdna/DNA_packedFile_types.h
index d2e0dd92cbc..61d0a89f752 100644
--- a/source/blender/makesdna/DNA_packedFile_types.h
+++ b/source/blender/makesdna/DNA_packedFile_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_packedFile_types.h
- * \ingroup DNA
- * \author nzc
- * \since 12-oct-2000 nzc
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_PACKEDFILE_TYPES_H__
@@ -53,7 +43,7 @@ enum ePF_FileStatus {
PF_REMOVE = 8,
PF_NOOP = 9,
- PF_ASK = 10
+ PF_ASK = 10,
};
#endif /* PACKEDFILE_TYPES_H */
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index fce6d6512a7..dc6e9dd05a1 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_particle_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_PARTICLE_TYPES_H__
@@ -39,20 +31,29 @@
struct AnimData;
typedef struct HairKey {
- float co[3]; /* location of hair vertex */
- float time; /* time along hair, default 0-100 */
- float weight; /* softbody weight */
- short editflag; /* saved particled edit mode flags */
- short pad;
+ /** Location of hair vertex. */
+ float co[3];
+ /** Time along hair, default 0-100. */
+ float time;
+ /** Softbody weight. */
+ float weight;
+ /** Saved particled edit mode flags. */
+ short editflag;
+ char _pad[2];
float world_co[3];
} HairKey;
typedef struct ParticleKey { /* when changed update size of struct to copy_particleKey()!! */
- float co[3]; /* location */
- float vel[3]; /* velocity */
- float rot[4]; /* rotation quaternion */
- float ave[3]; /* angular velocity */
- float time; /* when this key happens */
+ /** Location. */
+ float co[3];
+ /** Velocity. */
+ float vel[3];
+ /** Rotation quaternion. */
+ float rot[4];
+ /** Angular velocity. */
+ float ave[3];
+ /** When this key happens. */
+ float time;
} ParticleKey;
typedef struct BoidParticle {
@@ -70,10 +71,14 @@ typedef struct ParticleSpring {
/* Child particles are created around or between parent particles */
typedef struct ChildParticle {
- int num, parent; /* num is face index on the final derived mesh */
- int pa[4]; /* nearest particles to the child, used for the interpolation */
- float w[4]; /* interpolation weights for the above particles */
- float fuv[4], foffset; /* face vertex weights and offset */
+ /** Num is face index on the final derived mesh. */
+ int num, parent;
+ /** Nearest particles to the child, used for the interpolation. */
+ int pa[4];
+ /** Interpolation weights for the above particles. */
+ float w[4];
+ /** Face vertex weights and offset. */
+ float fuv[4], foffset;
float rt;
} ChildParticle;
@@ -90,40 +95,58 @@ typedef struct ParticleDupliWeight {
struct Object *ob;
short count;
short flag;
- short index, rt; /* only updated on file save and used on file load */
+ /** Only updated on file save and used on file load. */
+ short index, rt;
} ParticleDupliWeight;
typedef struct ParticleData {
- ParticleKey state; /* current global coordinates */
+ /** Current global coordinates. */
+ ParticleKey state;
- ParticleKey prev_state; /* previous state */
+ /** Previous state. */
+ ParticleKey prev_state;
- HairKey *hair; /* hair vertices */
+ /** Hair vertices. */
+ HairKey *hair;
- ParticleKey *keys; /* keyed keys */
+ /** Keyed keys. */
+ ParticleKey *keys;
- BoidParticle *boid; /* boids data */
+ /** Boids data. */
+ BoidParticle *boid;
- int totkey; /* amount of hair or keyed keys*/
+ /** Amount of hair or keyed key.s*/
+ int totkey;
- float time, lifetime; /* dietime is not necessarily time+lifetime as */
- float dietime; /* particles can die unnaturally (collision). */
+ /** Dietime is not necessarily time+lifetime as. */
+ float time, lifetime;
+ /** Particles can die unnaturally (collision). */
+ float dietime;
- /* WARNING! Those two indices, when not affected to vertices, are for !!! TESSELLATED FACES !!!, not POLYGONS! */
- int num; /* index to vert/edge/face */
- int num_dmcache; /* index to derived mesh data (face) to avoid slow lookups */
+ /**
+ * WARNING! Those two indices,
+ * when not affected to vertices, are for !!! TESSELLATED FACES !!!, not POLYGONS!
+ */
+ /** Index to vert/edge/face. */
+ int num;
+ /** Index to derived mesh data (face) to avoid slow lookups. */
+ int num_dmcache;
- float fuv[4], foffset; /* coordinates on face/edge number "num" and depth along*/
+ /** Coordinates on face/edge number "num" and depth alon.g*/
+ float fuv[4], foffset;
/* face normal for volume emission. */
- float size; /* size and multiplier so that we can update size when ever */
+ /** Size and multiplier so that we can update size when ever. */
+ float size;
- float sphdensity; /* density of sph particle */
- int pad;
+ /** Density of sph particle. */
+ float sphdensity;
+ char _pad[4];
int hair_index;
short flag;
- short alive; /* the life state of a particle */
+ /** The life state of a particle. */
+ short alive;
} ParticleData;
typedef struct SPHFluidSettings {
@@ -136,7 +159,7 @@ typedef struct SPHFluidSettings {
float buoyancy;
int flag, spring_frames;
short solver;
- short pad[3];
+ char _pad[6];
} SPHFluidSettings;
/* fluid->flag */
@@ -168,7 +191,8 @@ typedef struct ParticleSettings {
short phystype, rotmode, avemode, reactevent;
int draw;
float draw_size;
- short draw_as, pad1, childtype, pad2;
+ short draw_as, childtype;
+ char _pad2[4];
short ren_as, subframes, draw_col;
/* number of path segments, power of 2 except */
short draw_step, ren_step;
@@ -193,7 +217,8 @@ typedef struct ParticleSettings {
float timetweak, courant_target;
float jitfac, eff_hair, grid_rand, ps_offset[1];
int totpart, userjit, grid_res, effector_amount;
- short time_flag, time_pad[3];
+ short time_flag;
+ char _pad0[6];
/* initial velocity factors */
float normfac, obfac, randfac, partfac, tanfac, tanphase, reactfac;
@@ -207,7 +232,7 @@ typedef struct ParticleSettings {
float randlength;
/* children */
int child_flag;
- int pad3;
+ char _pad3[4];
int child_nbr, ren_child_nbr;
float parents, childsize, childrandsize;
float childrad, childflat;
@@ -216,7 +241,8 @@ typedef struct ParticleSettings {
/* kink */
float kink_amp, kink_freq, kink_shape, kink_flat;
float kink_amp_clump;
- int kink_extra_steps, pad4;
+ int kink_extra_steps;
+ char _pad4[4];
float kink_axis_random, kink_amp_random;
/* rough */
float rough1, rough1_size;
@@ -242,67 +268,88 @@ typedef struct ParticleSettings {
/* hair dynamics */
float bending_random;
- struct MTex *mtex[18]; /* MAX_MTEX */
+ /** MAX_MTEX. */
+ struct MTex *mtex[18];
- struct Collection *dup_group;
- struct ListBase dupliweights;
+ struct Collection *instance_collection;
+ struct ListBase instance_weights;
struct Collection *eff_group DNA_DEPRECATED; // deprecated
- struct Object *dup_ob;
+ struct Object *instance_object;
struct Object *bb_ob;
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
struct PartDeflect *pd;
struct PartDeflect *pd2;
/* modified dm support */
short use_modifier_stack;
- short pad5;
+ char _pad5[2];
/* hair shape */
short shape_flag;
- short pad6;
+ char _pad6[2];
- float twist, pad8;
+ float twist;
+ char _pad8[4];
/* hair thickness shape */
float shape;
float rad_root, rad_tip, rad_scale;
struct CurveMapping *twistcurve;
- void *pad7;
+ void *_pad7;
} ParticleSettings;
typedef struct ParticleSystem {
- /* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX, this function is no more! - need to invstigate */
- /* note2: make sure any uses of this struct in DNA are accounted for in 'BKE_object_copy_particlesystems' */
+ /* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX,
+ * this function is no more! - need to invstigate */
+
+ /* note2: make sure any uses of this struct in DNA are
+ * accounted for in 'BKE_object_copy_particlesystems' */
struct ParticleSystem *next, *prev;
- ParticleSettings *part; /* particle settings */
+ /** Particle settings. */
+ ParticleSettings *part;
- ParticleData *particles; /* (parent) particles */
- ChildParticle *child; /* child particles */
+ /** (parent) particles. */
+ ParticleData *particles;
+ /** Child particles. */
+ ChildParticle *child;
- struct PTCacheEdit *edit; /* particle editmode (runtime) */
- void (*free_edit)(struct PTCacheEdit *edit); /* free callback */
+ /** Particle editmode (runtime). */
+ struct PTCacheEdit *edit;
+ /** Free callback. */
+ void (*free_edit)(struct PTCacheEdit *edit);
- struct ParticleCacheKey **pathcache; /* path cache (runtime) */
- struct ParticleCacheKey **childcache; /* child cache (runtime) */
- ListBase pathcachebufs, childcachebufs; /* buffers for the above */
+ /** Path cache (runtime). */
+ struct ParticleCacheKey **pathcache;
+ /** Child cache (runtime). */
+ struct ParticleCacheKey **childcache;
+ /** Buffers for the above. */
+ ListBase pathcachebufs, childcachebufs;
- struct ClothModifierData *clmd; /* cloth simulation for hair */
- struct Mesh *hair_in_mesh, *hair_out_mesh; /* input/output for cloth simulation */
+ /** Cloth simulation for hair. */
+ struct ClothModifierData *clmd;
+ /** Input/output for cloth simulation. */
+ struct Mesh *hair_in_mesh, *hair_out_mesh;
struct Object *target_ob;
- struct LatticeDeformData *lattice_deform_data; /* run-time only lattice deformation data */
+ /** Run-time only lattice deformation data. */
+ struct LatticeDeformData *lattice_deform_data;
- struct Object *parent; /* particles from global space -> parent space */
+ /** Particles from global space -> parent space. */
+ struct Object *parent;
- struct ListBase targets; /* used for keyed and boid physics */
+ /** Used for keyed and boid physics. */
+ struct ListBase targets;
- char name[64]; /* particle system name, MAX_NAME */
+ /** Particle system name, MAX_NAME. */
+ char name[64];
- float imat[4][4]; /* used for duplicators */
+ /** Used for instancing. */
+ float imat[4][4];
float cfra, tree_frame, bvhtree_frame;
int seed, child_seed;
int flag, totpart, totunexist, totchild, totcached, totchildcache;
@@ -311,15 +358,16 @@ typedef struct ParticleSystem {
* TODO(sergey): Use part->id.recalc instead of this duplicated flag
* somehow. */
int recalc;
- int pad1;
short target_psys, totkeyed, bakespace;
- short pad2;
+ char _pad1[6];
- char bb_uvname[3][64]; /* billboard uv name, MAX_CUSTOMDATA_LAYER_NAME */
+ /** Billboard uv name, MAX_CUSTOMDATA_LAYER_NAME. */
+ char bb_uvname[3][64];
/* if you change these remember to update array lengths to PSYS_TOT_VG! */
- short vgroup[13], vg_neg, rt3; /* vertex groups, 0==disable, 1==starting index */
- char pad[6];
+ /** Vertex groups, 0==disable, 1==starting index. */
+ short vgroup[13], vg_neg, rt3;
+ char _pad[6];
/* point cache */
struct PointCache *pointcache;
@@ -330,13 +378,17 @@ typedef struct ParticleSystem {
ParticleSpring *fluid_springs;
int tot_fluidsprings, alloc_fluidsprings;
- struct KDTree *tree; /* used for interactions with self and other systems */
- struct BVHTree *bvhtree; /* used for interactions with self and other systems */
+ /** Used for interactions with self and other systems. */
+ struct KDTree *tree;
+ /** Used for interactions with self and other systems. */
+ struct BVHTree *bvhtree;
struct ParticleDrawData *pdd;
- float dt_frac; /* current time step, as a fraction of a frame */
- float lattice_strength; /* influence of the lattice modifier */
+ /** Current time step, as a fraction of a frame. */
+ float dt_frac;
+ /** Influence of the lattice modifier. */
+ float lattice_strength;
void *batch_cache;
@@ -361,7 +413,7 @@ typedef enum eParticleDrawFlag {
PART_ABS_PATH_TIME = (1 << 5),
PART_DRAW_COUNT_GR = (1 << 6),
PART_DRAW_BB_LOCK = (1 << 7), /* used with billboards */
- PART_DRAW_ROTATE_OB = (1 << 7), /* used with dupliobjects/groups */
+ PART_DRAW_ROTATE_OB = (1 << 7), /* used with instance object/collection */
PART_DRAW_PARENT = (1 << 8),
PART_DRAW_NUM = (1 << 9),
PART_DRAW_RAND_GR = (1 << 10),
@@ -370,7 +422,7 @@ typedef enum eParticleDrawFlag {
PART_DRAW_MAT_COL = (1 << 13), /* deprecated, but used in do_versions */
PART_DRAW_WHOLE_GR = (1 << 14),
PART_DRAW_REN_STRAND = (1 << 15),
- PART_DRAW_NO_SCALE_OB = (1 << 16), /* used with dupliobjects/groups */
+ PART_DRAW_NO_SCALE_OB = (1 << 16), /* used with instance object/collection */
PART_DRAW_GUIDE_HAIRS = (1 << 17),
PART_DRAW_HAIR_GRID = (1 << 18),
} eParticleDrawFlag;
@@ -475,11 +527,6 @@ typedef enum eParticleShapeFlag {
#define PART_DRAW_COL_VEL 2
#define PART_DRAW_COL_ACC 3
-
-/* part->simplify_flag */
-#define PART_SIMPLIFY_ENABLE 1
-#define PART_SIMPLIFY_VIEWPORT 2
-
/* part->time_flag */
#define PART_TIME_AUTOSF 1 /* Automatic subframes */
@@ -558,8 +605,8 @@ typedef enum eParticleShapeFlag {
#define PSYS_KEYED_TIMING 8
//#define PSYS_ENABLED 16 /* deprecated */
#define PSYS_HAIR_UPDATED 32 /* signal for updating hair particle mode */
-#define PSYS_DRAWING 64
-#define PSYS_USE_IMAT 128
+/* #define PSYS_DRAWING 64 */ /* deprecated */
+/* #define PSYS_USE_IMAT 128 */ /* deprecated */
#define PSYS_DELETE 256 /* remove particlesystem as soon as possible */
#define PSYS_HAIR_DONE 512
#define PSYS_KEYED 1024
diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h
index 1482667d8b8..9985236aeb1 100644
--- a/source/blender/makesdna/DNA_rigidbody_types.h
+++ b/source/blender/makesdna/DNA_rigidbody_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung, Sergej Reich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_rigidbody_types.h
- * \ingroup DNA
- * \brief Types and defines for representing Rigid Body entities
+/** \file
+ * \ingroup DNA
+ * \brief Types and defines for representing Rigid Body entities
*/
#ifndef __DNA_RIGIDBODY_TYPES_H__
@@ -49,7 +41,8 @@ typedef struct RigidBodyWorld_Shared {
struct ListBase ptcaches;
/* References to Physics Sim objects. Exist at runtime only ---------------------- */
- void *physics_world; /* Physics sim world (i.e. btDiscreteDynamicsWorld) */
+ /** Physics sim world (i.e. btDiscreteDynamicsWorld). */
+ void *physics_world;
} RigidBodyWorld_Shared;
/* RigidBodyWorld (rbw)
@@ -58,26 +51,39 @@ typedef struct RigidBodyWorld_Shared {
*/
typedef struct RigidBodyWorld {
/* Sim World Settings ------------------------------------------------------------- */
- struct EffectorWeights *effector_weights; /* effectors info */
-
- struct Collection *group; /* Group containing objects to use for Rigid Bodies */
- struct Object **objects; /* Array to access group objects by index, only used at runtime */
-
- struct Collection *constraints; /* Group containing objects to use for Rigid Body Constraints*/
-
- int pad;
- float ltime; /* last frame world was evaluated for (internal) */
-
- struct RigidBodyWorld_Shared *shared; /* This pointer is shared between all evaluated copies */
- struct PointCache *pointcache DNA_DEPRECATED; /* Moved to shared->pointcache */
- struct ListBase ptcaches DNA_DEPRECATED; /* Moved to shared->ptcaches */
- int numbodies; /* number of objects in rigid body group */
-
- short steps_per_second; /* number of simulation steps thaken per second */
- short num_solver_iterations;/* number of constraint solver iterations made per simulation step */
-
- int flag; /* (eRigidBodyWorld_Flag) settings for this RigidBodyWorld */
- float time_scale; /* used to speed up or slow down the simulation */
+ /** Effectors info. */
+ struct EffectorWeights *effector_weights;
+
+ /** Group containing objects to use for Rigid Bodies. */
+ struct Collection *group;
+ /** Array to access group objects by index, only used at runtime. */
+ struct Object **objects;
+
+ /** Group containing objects to use for Rigid Body Constraint.s*/
+ struct Collection *constraints;
+
+ char _pad[4];
+ /** Last frame world was evaluated for (internal). */
+ float ltime;
+
+ /** This pointer is shared between all evaluated copies. */
+ struct RigidBodyWorld_Shared *shared;
+ /** Moved to shared->pointcache. */
+ struct PointCache *pointcache DNA_DEPRECATED;
+ /** Moved to shared->ptcaches. */
+ struct ListBase ptcaches DNA_DEPRECATED;
+ /** Number of objects in rigid body group. */
+ int numbodies;
+
+ /** Number of simulation steps thaken per second. */
+ short steps_per_second;
+ /** Number of constraint solver iterations made per simulation step. */
+ short num_solver_iterations;
+
+ /** (eRigidBodyWorld_Flag) settings for this RigidBodyWorld. */
+ int flag;
+ /** Used to speed up or slow down the simulation. */
+ float time_scale;
} RigidBodyWorld;
/* Flags for RigidBodyWorld */
@@ -87,7 +93,7 @@ typedef enum eRigidBodyWorld_Flag {
/* sim data needs to be rebuilt */
RBW_FLAG_NEEDS_REBUILD = (1 << 1),
/* usse split impulse when stepping the simulation */
- RBW_FLAG_USE_SPLIT_IMPULSE = (1 << 2)
+ RBW_FLAG_USE_SPLIT_IMPULSE = (1 << 2),
} eRigidBodyWorld_Flag;
/* ******************************** */
@@ -101,8 +107,10 @@ typedef enum eRigidBodyWorld_Flag {
#
typedef struct RigidBodyOb_Shared {
/* References to Physics Sim objects. Exist at runtime only */
- void *physics_object; /* Physics object representation (i.e. btRigidBody) */
- void *physics_shape; /* Collision shape used by physics sim (i.e. btCollisionShape) */
+ /** Physics object representation (i.e. btRigidBody). */
+ void *physics_object;
+ /** Collision shape used by physics sim (i.e. btCollisionShape). */
+ void *physics_shape;
} RigidBodyOb_Shared;
/* RigidBodyObject (rbo)
@@ -113,33 +121,49 @@ typedef struct RigidBodyOb_Shared {
*/
typedef struct RigidBodyOb {
/* General Settings for this RigidBodyOb */
- short type; /* (eRigidBodyOb_Type) role of RigidBody in sim */
- short shape; /* (eRigidBody_Shape) collision shape to use */
-
- int flag; /* (eRigidBodyOb_Flag) */
- int col_groups; /* Collision groups that determines which rigid bodies can collide with each other */
- short mesh_source; /* (eRigidBody_MeshSource) mesh source for mesh based collision shapes */
- short pad;
+ /** (eRigidBodyOb_Type) role of RigidBody in sim . */
+ short type;
+ /** (eRigidBody_Shape) collision shape to use. */
+ short shape;
+
+ /** (eRigidBodyOb_Flag). */
+ int flag;
+ /** Collision groups that determines which rigid bodies can collide with each other. */
+ int col_groups;
+ /** (eRigidBody_MeshSource) mesh source for mesh based collision shapes. */
+ short mesh_source;
+ char _pad[2];
/* Physics Parameters */
- float mass; /* how much object 'weighs' (i.e. absolute 'amount of stuff' it holds) */
-
- float friction; /* resistance of object to movement */
- float restitution; /* how 'bouncy' object is when it collides */
-
- float margin; /* tolerance for detecting collisions */
-
- float lin_damping; /* damping for linear velocities */
- float ang_damping; /* damping for angular velocities */
-
- float lin_sleep_thresh; /* deactivation threshold for linear velocities */
- float ang_sleep_thresh; /* deactivation threshold for angular velocities */
-
- float orn[4]; /* rigid body orientation */
- float pos[3]; /* rigid body position */
- float pad1;
-
- struct RigidBodyOb_Shared *shared; /* This pointer is shared between all evaluated copies */
+ /** How much object 'weighs' (i.e. absolute 'amount of stuff' it holds). */
+ float mass;
+
+ /** Resistance of object to movement. */
+ float friction;
+ /** How 'bouncy' object is when it collides. */
+ float restitution;
+
+ /** Tolerance for detecting collisions. */
+ float margin;
+
+ /** Damping for linear velocities. */
+ float lin_damping;
+ /** Damping for angular velocities. */
+ float ang_damping;
+
+ /** Deactivation threshold for linear velocities. */
+ float lin_sleep_thresh;
+ /** Deactivation threshold for angular velocities. */
+ float ang_sleep_thresh;
+
+ /** Rigid body orientation. */
+ float orn[4];
+ /** Rigid body position. */
+ float pos[3];
+ char _pad1[4];
+
+ /** This pointer is shared between all evaluated copies. */
+ struct RigidBodyOb_Shared *shared;
} RigidBodyOb;
@@ -168,7 +192,7 @@ typedef enum eRigidBodyOb_Flag {
/* collision margin is not embedded (only used by convex hull shapes for now) */
RBO_FLAG_USE_MARGIN = (1 << 6),
/* collision shape deforms during simulation (only for passive triangle mesh shapes) */
- RBO_FLAG_USE_DEFORM = (1 << 7)
+ RBO_FLAG_USE_DEFORM = (1 << 7),
} eRigidBodyOb_Flag;
/* RigidBody Collision Shape */
@@ -210,18 +234,25 @@ typedef enum eRigidBody_MeshSource {
* Represents an constraint connecting two rigid bodies.
*/
typedef struct RigidBodyCon {
- struct Object *ob1; /* First object influenced by the constraint */
- struct Object *ob2; /* Second object influenced by the constraint */
+ /** First object influenced by the constraint. */
+ struct Object *ob1;
+ /** Second object influenced by the constraint. */
+ struct Object *ob2;
/* General Settings for this RigidBodyCon */
- short type; /* (eRigidBodyCon_Type) role of RigidBody in sim */
- short num_solver_iterations;/* number of constraint solver iterations made per simulation step */
+ /** (eRigidBodyCon_Type) role of RigidBody in sim . */
+ short type;
+ /** Number of constraint solver iterations made per simulation step. */
+ short num_solver_iterations;
- int flag; /* (eRigidBodyCon_Flag) */
+ /** (eRigidBodyCon_Flag). */
+ int flag;
- float breaking_threshold; /* breaking impulse threshold */
- char spring_type; /* spring implementation to use */
- char pad[3];
+ /** Breaking impulse threshold. */
+ float breaking_threshold;
+ /** Spring implementation to use. */
+ char spring_type;
+ char _pad[3];
/* limits */
/* translation limits */
@@ -256,41 +287,47 @@ typedef struct RigidBodyCon {
float spring_damping_ang_z;
/* motor settings */
- float motor_lin_target_velocity; /* linear velocity the motor tries to hold */
- float motor_ang_target_velocity; /* angular velocity the motor tries to hold */
- float motor_lin_max_impulse; /* maximum force used to reach linear target velocity */
- float motor_ang_max_impulse; /* maximum force used to reach angular target velocity */
+ /** Linear velocity the motor tries to hold. */
+ float motor_lin_target_velocity;
+ /** Angular velocity the motor tries to hold. */
+ float motor_ang_target_velocity;
+ /** Maximum force used to reach linear target velocity. */
+ float motor_lin_max_impulse;
+ /** Maximum force used to reach angular target velocity. */
+ float motor_ang_max_impulse;
/* References to Physics Sim object. Exist at runtime only */
- void *physics_constraint; /* Physics object representation (i.e. btTypedConstraint) */
+ /** Physics object representation (i.e. btTypedConstraint). */
+ void *physics_constraint;
} RigidBodyCon;
/* Participation types for RigidBodyOb */
typedef enum eRigidBodyCon_Type {
- /* lets bodies rotate around a specified point */
+ /** lets bodies rotate around a specified point */
RBC_TYPE_POINT = 0,
- /* lets bodies rotate around a specified axis */
+ /** lets bodies rotate around a specified axis */
RBC_TYPE_HINGE,
- /* simulates wheel suspension */
+ /** simulates wheel suspension */
RBC_TYPE_HINGE2,
- /* restricts movent to a specified axis */
+ /** restricts movent to a specified axis */
RBC_TYPE_SLIDER,
- /* lets object rotate within a cpecified cone */
+ /** lets object rotate within a cpecified cone */
RBC_TYPE_CONE_TWIST,
- /* allows user to specify constraint axes */
+ /** allows user to specify constraint axes */
RBC_TYPE_6DOF,
- /* like 6DOF but has springs */
+ /** like 6DOF but has springs */
RBC_TYPE_6DOF_SPRING,
- /* simulates a universal joint */
+ /** simulates a universal joint */
RBC_TYPE_UNIVERSAL,
- /* glues two bodies together */
+ /** glues two bodies together */
RBC_TYPE_FIXED,
- /* similar to slider but also allows rotation around slider axis */
+ /** similar to slider but also allows rotation around slider axis */
RBC_TYPE_PISTON,
- /* Simplified spring constraint with only once axis that's automatically placed between the connected bodies */
+ /** Simplified spring constraint with only once axis that's
+ * automatically placed between the connected bodies */
RBC_TYPE_SPRING,
- /* dirves bodies by applying linear and angular forces */
+ /** dirves bodies by applying linear and angular forces */
RBC_TYPE_MOTOR,
} eRigidBodyCon_Type;
@@ -329,7 +366,7 @@ typedef enum eRigidBodyCon_Flag {
/* angular springs */
RBC_FLAG_USE_SPRING_ANG_X = (1 << 16),
RBC_FLAG_USE_SPRING_ANG_Y = (1 << 17),
- RBC_FLAG_USE_SPRING_ANG_Z = (1 << 18)
+ RBC_FLAG_USE_SPRING_ANG_Z = (1 << 18),
} eRigidBodyCon_Flag;
/* ******************************** */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index b053cec6a25..48301202778 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_scene_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_SCENE_TYPES_H__
@@ -42,6 +34,7 @@ extern "C" {
#endif
#include "DNA_color_types.h" /* color management */
+#include "DNA_customdata_types.h" /* Scene's runtime cddata masks. */
#include "DNA_vec_types.h"
#include "DNA_listBase.h"
#include "DNA_ID.h"
@@ -53,22 +46,23 @@ extern "C" {
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
-struct CurveMapping;
-struct Object;
+struct AnimData;
struct Brush;
-struct World;
-struct Scene;
-struct Image;
struct Collection;
-struct Text;
-struct bNodeTree;
-struct AnimData;
+struct ColorSpace;
+struct CurveMapping;
+struct CustomData_MeshMasks;
struct Editing;
-struct SceneStats;
-struct bGPdata;
+struct Image;
struct MovieClip;
-struct ColorSpace;
+struct Object;
+struct Scene;
struct SceneCollection;
+struct SceneStats;
+struct Text;
+struct World;
+struct bGPdata;
+struct bNodeTree;
/* ************************************************************* */
/* Scene Data */
@@ -77,21 +71,32 @@ struct SceneCollection;
/* Output Format Data */
typedef struct AviCodecData {
- void *lpFormat; /* save format */
- void *lpParms; /* compressor options */
- unsigned int cbFormat; /* size of lpFormat buffer */
- unsigned int cbParms; /* size of lpParms buffer */
-
- unsigned int fccType; /* stream type, for consistency */
- unsigned int fccHandler; /* compressor */
- unsigned int dwKeyFrameEvery; /* keyframe rate */
- unsigned int dwQuality; /* compress quality 0-10,000 */
- unsigned int dwBytesPerSecond; /* bytes per second */
- unsigned int dwFlags; /* flags... see below */
- unsigned int dwInterleaveEvery; /* for non-video streams only */
- unsigned int pad;
-
- char avicodecname[128];
+ /** Save format. */
+ void *lpFormat;
+ /** Compressor options. */
+ void *lpParms;
+ /** Size of lpFormat buffer. */
+ unsigned int cbFormat;
+ /** Size of lpParms buffer. */
+ unsigned int cbParms;
+
+ /** Stream type, for consistency. */
+ unsigned int fccType;
+ /** Compressor. */
+ unsigned int fccHandler;
+ /** Keyframe rate. */
+ unsigned int dwKeyFrameEvery;
+ /** Compress quality 0-10,000. */
+ unsigned int dwQuality;
+ /** Bytes per second. */
+ unsigned int dwBytesPerSecond;
+ /** Flags... see below. */
+ unsigned int dwFlags;
+ /** For non-video streams only. */
+ unsigned int dwInterleaveEvery;
+ char _pad[4];
+
+ char avicodecname[128];
} AviCodecData;
typedef enum eFFMpegPreset {
@@ -114,9 +119,12 @@ typedef enum eFFMpegPreset {
* WEBM/VP9 use these values directly, whereas h.264 map those to
* respectively the MEDIUM, SLOWER, and SUPERFAST presets.
*/
- FFM_PRESET_GOOD = 10, /* the default and recommended for most applications */
- FFM_PRESET_BEST, /* recommended if you have lots of time and want the best compression efficiency */
- FFM_PRESET_REALTIME, /* recommended for live / fast encoding */
+ /** the default and recommended for most applications */
+ FFM_PRESET_GOOD = 10,
+ /** recommended if you have lots of time and want the best compression efficiency */
+ FFM_PRESET_BEST,
+ /** recommended for live / fast encoding */
+ FFM_PRESET_REALTIME,
} eFFMpegPreset;
/* Mapping from easily-understandable descriptions to CRF values.
@@ -152,20 +160,22 @@ typedef struct FFMpegCodecData {
int audio_bitrate;
int audio_mixrate;
int audio_channels;
- int audio_pad;
+ char _pad0[4];
float audio_volume;
int gop_size;
- int max_b_frames; /* only used if FFMPEG_USE_MAX_B_FRAMES flag is set. */
+ /** Only used if FFMPEG_USE_MAX_B_FRAMES flag is set. */
+ int max_b_frames;
int flags;
int constant_rate_factor;
- int ffmpeg_preset; /* see eFFMpegPreset */
+ /** See eFFMpegPreset. */
+ int ffmpeg_preset;
int rc_min_rate;
int rc_max_rate;
int rc_buffer_size;
int mux_packet_size;
int mux_rate;
- int pad1;
+ char _pad1[4];
IDProperty *properties;
} FFMpegCodecData;
@@ -180,9 +190,9 @@ typedef struct AudioData {
float doppler_factor;
int distance_model;
short flag;
- short pad;
+ char _pad[2];
float volume;
- float pad2;
+ char _pad2[4];
} AudioData;
/* *************************************************************** */
@@ -192,25 +202,36 @@ typedef struct AudioData {
typedef struct SceneRenderLayer {
struct SceneRenderLayer *next, *prev;
- char name[64] DNA_DEPRECATED; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64] DNA_DEPRECATED;
- struct Material *mat_override DNA_DEPRECATED; /* Converted to ViewLayer setting. */
+ /** Converted to ViewLayer setting. */
+ struct Material *mat_override DNA_DEPRECATED;
- unsigned int lay DNA_DEPRECATED; /* Converted to LayerCollection cycles camera visibility override. */
- unsigned int lay_zmask DNA_DEPRECATED; /* Converted to LayerCollection cycles holdout override. */
+ /** Converted to LayerCollection cycles camera visibility override. */
+ unsigned int lay DNA_DEPRECATED;
+ /** Converted to LayerCollection cycles holdout override. */
+ unsigned int lay_zmask DNA_DEPRECATED;
unsigned int lay_exclude DNA_DEPRECATED;
- int layflag DNA_DEPRECATED; /* Converted to ViewLayer layflag and flag. */
+ /** Converted to ViewLayer layflag and flag. */
+ int layflag DNA_DEPRECATED;
/* pass_xor has to be after passflag */
- int passflag DNA_DEPRECATED; /* pass_xor has to be after passflag */
- int pass_xor DNA_DEPRECATED; /* Converted to ViewLayer passflag and flag. */
+ /** Pass_xor has to be after passflag. */
+ int passflag DNA_DEPRECATED;
+ /** Converted to ViewLayer passflag and flag. */
+ int pass_xor DNA_DEPRECATED;
- int samples DNA_DEPRECATED; /* Converted to ViewLayer setting. */
- float pass_alpha_threshold DNA_DEPRECATED; /* Converted to ViewLayer pass_alpha_threshold. */
+ /** Converted to ViewLayer setting. */
+ int samples DNA_DEPRECATED;
+ /** Converted to ViewLayer pass_alpha_threshold. */
+ float pass_alpha_threshold DNA_DEPRECATED;
- IDProperty *prop DNA_DEPRECATED; /* Converted to ViewLayer id_properties. */
+ /** Converted to ViewLayer id_properties. */
+ IDProperty *prop DNA_DEPRECATED;
- struct FreestyleConfig freestyleConfig DNA_DEPRECATED; /* Converted to ViewLayer freestyleConfig. */
+ /** Converted to ViewLayer freestyleConfig. */
+ struct FreestyleConfig freestyleConfig DNA_DEPRECATED;
} SceneRenderLayer;
/* SceneRenderLayer.layflag */
@@ -225,7 +246,7 @@ typedef struct SceneRenderLayer {
/* flags between (1 << 8) and (1 << 15) are set to 1 already, for future options */
#define SCE_LAY_ALL_Z (1 << 15)
-#define SCE_LAY_XOR (1 << 16)
+/* #define SCE_LAY_XOR (1 << 16) */ /* UNUSED */
#define SCE_LAY_DISABLE (1 << 17)
#define SCE_LAY_ZMASK (1 << 18)
#define SCE_LAY_NEG_ZMASK (1 << 19)
@@ -302,12 +323,13 @@ typedef enum eScenePassType {
typedef struct SceneRenderView {
struct SceneRenderView *next, *prev;
- char name[64]; /* MAX_NAME */
- char suffix[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64];
+ /** MAX_NAME. */
+ char suffix[64];
int viewflag;
- int pad[2];
- char pad2[4];
+ char _pad2[4];
} SceneRenderView;
@@ -329,10 +351,13 @@ enum {
typedef struct Stereo3dFormat {
short flag;
- char display_mode; /* encoding mode */
- char anaglyph_type; /* anaglyph scheme for the user display */
- char interlace_type; /* interlace type for the user display */
- char pad[3];
+ /** Encoding mode. */
+ char display_mode;
+ /** Anaglyph scheme for the user display. */
+ char anaglyph_type;
+ /** Interlace type for the user display. */
+ char interlace_type;
+ char _pad[3];
} Stereo3dFormat;
/* Stereo3dFormat.display_mode */
@@ -375,17 +400,25 @@ typedef enum eStereo3dInterlaceType {
* RNA ensures these enum's are only selectable for render output.
*/
typedef struct ImageFormatData {
- char imtype; /* R_IMF_IMTYPE_PNG, R_... */
- /* note, video types should only ever be set from this
- * structure when used from RenderData */
- char depth; /* bits per channel, R_IMF_CHAN_DEPTH_8 -> 32,
- * not a flag, only set 1 at a time */
+ /**
+ * R_IMF_IMTYPE_PNG, R_...
+ * \note, video types should only ever be set from this structure when used from RenderData.
+ */
+ char imtype;
+ /**
+ * bits per channel, R_IMF_CHAN_DEPTH_8 -> 32,
+ * not a flag, only set 1 at a time. */
+ char depth;
- char planes; /* - R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA */
- char flag; /* generic options for all image types, alpha zbuffer */
+ /** R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA. */
+ char planes;
+ /** Generic options for all image types, alpha zbuffer. */
+ char flag;
- char quality; /* (0 - 100), eg: jpeg quality */
- char compress; /* (0 - 100), eg: png compression */
+ /** (0 - 100), eg: jpeg quality. */
+ char quality;
+ /** (0 - 100), eg: png compression. */
+ char compress;
/* --- format specific --- */
@@ -405,7 +438,7 @@ typedef struct ImageFormatData {
/* TIFF */
char tiff_codec;
- char pad[4];
+ char _pad[4];
/* Multiview */
char views_format;
@@ -503,7 +536,8 @@ enum {
typedef struct BakeData {
struct ImageFormatData im_format;
- char filepath[1024]; /* FILE_MAX */
+ /** FILE_MAX. */
+ char filepath[1024];
short width, height;
short margin, flag;
@@ -515,7 +549,7 @@ typedef struct BakeData {
char normal_space;
char save_mode;
- char pad[3];
+ char _pad[3];
struct Object *cage_object;
} BakeData;
@@ -567,24 +601,31 @@ typedef struct RenderData {
struct AviCodecData *avicodecdata;
struct FFMpegCodecData ffcodecdata;
- int cfra, sfra, efra; /* frames as in 'images' */
- float subframe; /* subframe offset from cfra, in 0.0-1.0 */
- int psfra, pefra; /* start+end frames of preview range */
+ /** Frames as in 'images'. */
+ int cfra, sfra, efra;
+ /** Subframe offset from cfra, in 0.0-1.0. */
+ float subframe;
+ /** Start+end frames of preview range. */
+ int psfra, pefra;
int images, framapto;
short flag, threads;
float framelen, blurfac;
- int frame_step; /* frames to jump during render/playback */
+ /** Frames to jump during render/playback. */
+ int frame_step;
- short stereomode DNA_DEPRECATED; /* standalone player stereo settings */ // XXX deprecated since 2.5
+ /** Standalone player stereo settings */ // XXX deprecated since .2.5
+ short stereomode DNA_DEPRECATED;
- short dimensionspreset; /* for the dimensions presets menu */
+ /** For the dimensions presets menu. */
+ short dimensionspreset;
- short size; /* size in % */
+ /** Size in %. */
+ short size;
- short pad6;
+ char _pad6[2];
/* from buttons: */
/**
@@ -601,14 +642,17 @@ typedef struct RenderData {
*/
int tilex, tiley;
- short planes DNA_DEPRECATED, imtype DNA_DEPRECATED, subimtype DNA_DEPRECATED, quality DNA_DEPRECATED; /*deprecated!*/
+ short planes DNA_DEPRECATED;
+ short imtype DNA_DEPRECATED;
+ short subimtype DNA_DEPRECATED;
+ short quality DNA_DEPRECATED;
/**
* Render to image editor, fullscreen or to new window.
*/
short displaymode;
char use_lock_interface;
- char pad7;
+ char _pad7;
/**
* Flags for render settings. Use bit-masking to access the settings.
@@ -621,8 +665,8 @@ typedef struct RenderData {
int mode;
/**
- * What to do with the sky/background. Picks sky/premul/key
- * blending for the background
+ * What to do with the sky/background.
+ * Picks sky/premul blending for the background.
*/
short alphamode;
@@ -631,7 +675,8 @@ typedef struct RenderData {
*/
short osa;
- short frs_sec, pad[7];
+ short frs_sec;
+ char _pad[6];
/* safety, border and display rect */
@@ -639,9 +684,11 @@ typedef struct RenderData {
rcti disprect;
/* information on different layers to be rendered */
- ListBase layers DNA_DEPRECATED; /* Converted to Scene->view_layers. */
- short actlay DNA_DEPRECATED; /* Converted to Scene->active_layer. */
- short pad1;
+ /** Converted to Scene->view_layers. */
+ ListBase layers DNA_DEPRECATED;
+ /** Converted to Scene->active_layer. */
+ short actlay DNA_DEPRECATED;
+ char _pad1[2];
/**
* Adjustment factors for the aspect ratio in the x direction, was a short in 2.45
@@ -667,11 +714,14 @@ typedef struct RenderData {
float bake_biasdist, bake_user_scale;
/* path to render output */
- char pic[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char pic[1024];
/* stamps flags. */
int stamp;
- short stamp_font_id, pad3; /* select one of blenders bitmap fonts */
+ /** Select one of blenders bitmap fonts. */
+ short stamp_font_id;
+ char _pad3[2];
/* stamp info user data. */
char stamp_udata[768];
@@ -682,25 +732,28 @@ typedef struct RenderData {
/* sequencer options */
char seq_prev_type;
- char seq_rend_type; /* UNUSED! */
- char seq_flag; /* flag use for sequence render/draw */
- char pad5[5];
+ /** UNUSED!. */
+ char seq_rend_type;
+ /** Flag use for sequence render/draw. */
+ char seq_flag;
+ char _pad5[5];
/* render simplify */
short simplify_subsurf;
short simplify_subsurf_render;
short simplify_gpencil;
- short pad10;
+ short simplify_smoke_ignore_highres;
float simplify_particles;
float simplify_particles_render;
/* Freestyle line thickness options */
int line_thickness_mode;
- float unit_line_thickness; /* in pixels */
+ /** In pixels. */
+ float unit_line_thickness;
/* render engine */
char engine[32];
- int pad2;
+ char _pad2[4];
/* Cycles baking */
struct BakeData bake;
@@ -714,7 +767,8 @@ typedef struct RenderData {
short debug_pass_type;
/* MultiView */
- ListBase views; /* SceneRenderView */
+ /** SceneRenderView. */
+ ListBase views;
short actview;
short views_format;
@@ -743,9 +797,10 @@ typedef struct RenderProfile {
short particle_perc;
short subsurf_max;
short shadbufsample_max;
- short pad1;
+ char _pad1[2];
- float ao_error, pad2;
+ float ao_error;
+ char _pad2[4];
} RenderProfile;
@@ -816,7 +871,8 @@ typedef struct Paint {
char _pad1[4];
struct Palette *palette;
- struct CurveMapping *cavity_curve; /* cavity curve */
+ /** Cavity curve. */
+ struct CurveMapping *cavity_curve;
/* WM Paint cursor */
void *paint_cursor;
@@ -833,7 +889,7 @@ typedef struct Paint {
int symmetry_flags;
float tile_offset[3];
- int pad2;
+ char _pad2[4];
struct Paint_Runtime runtime;
} Paint;
@@ -849,16 +905,26 @@ typedef struct ImagePaintSettings {
/* for projection painting only */
short seam_bleed, normal_angle;
- short screen_grab_size[2]; /* capture size for re-projection */
+ /** Capture size for re-projection. */
+ short screen_grab_size[2];
- int mode; /* mode used for texture painting */
+ /** Mode used for texture painting. */
+ int mode;
- void *paintcursor; /* wm handle */
- struct Image *stencil; /* workaround until we support true layer masks */
- struct Image *clone; /* clone layer for image mode for projective texture painting */
- struct Image *canvas; /* canvas when the explicit system is used for painting */
+ /** Wm handle. */
+ void *paintcursor;
+ /** Workaround until we support true layer masks. */
+ struct Image *stencil;
+ /** Clone layer for image mode for projective texture painting. */
+ struct Image *clone;
+ /** Canvas when the explicit system is used for painting. */
+ struct Image *canvas;
float stencil_col[3];
- float dither; /* dither amount used when painting on byte images */
+ /** Dither amount used when painting on byte images. */
+ float dither;
+ /** Display texture interpolation method. */
+ int interp;
+ char _pad[4];
} ImagePaintSettings;
/* ------------------------------------------- */
@@ -866,8 +932,10 @@ typedef struct ImagePaintSettings {
/* Settings for a Particle Editing Brush */
typedef struct ParticleBrushData {
- short size; /* common setting */
- short step, invert, count; /* for specific brushes only */
+ /** Common setting. */
+ short size;
+ /** For specific brushes only. */
+ short step, invert, count;
int flag;
float strength;
} ParticleBrushData;
@@ -880,7 +948,8 @@ typedef struct ParticleEditSettings {
short brushtype;
ParticleBrushData brush[7];
- void *paintcursor; /* runtime */
+ /** Runtime. */
+ void *paintcursor;
float emitterdist, rt;
@@ -919,9 +988,10 @@ typedef struct Sculpt {
float gravity_factor;
/* scale for constant detail size */
- float constant_detail; /* Constant detail resolution (Blender unit / constant_detail) */
+ /** Constant detail resolution (Blender unit / constant_detail). */
+ float constant_detail;
float detail_percent;
- float pad;
+ char _pad[4];
struct Object *gravity_object;
} Sculpt;
@@ -942,14 +1012,15 @@ typedef struct GpPaint {
typedef struct VPaint {
Paint paint;
char flag;
- char pad[3];
- int radial_symm[3]; /* For mirrored painting */
+ char _pad[3];
+ /** For mirrored painting. */
+ int radial_symm[3];
} VPaint;
/* VPaint.flag */
enum {
/* weight paint only */
- VP_FLAG_VGROUP_RESTRICT = (1 << 7)
+ VP_FLAG_VGROUP_RESTRICT = (1 << 7),
};
/* ------------------------------------------- */
@@ -981,20 +1052,40 @@ typedef enum eGP_Lockaxis_Types {
GP_LOCKAXIS_VIEW = 0,
GP_LOCKAXIS_X = 1,
GP_LOCKAXIS_Y = 2,
- GP_LOCKAXIS_Z = 3
+ GP_LOCKAXIS_Z = 3,
} eGP_Lockaxis_Types;
/* Settings for a GPencil Stroke Sculpting Brush */
typedef struct GP_Sculpt_Data {
- short size; /* radius of brush */
- short flag; /* eGP_Sculpt_Flag */
- float strength; /* strength of effect */
- float curcolor_add[3]; /* cursor color for add */
- float curcolor_sub[3]; /* cursor color for sub */
- float weight; /* target weight */
+ /** Radius of brush. */
+ short size;
+ /** EGP_Sculpt_Flag. */
+ short flag;
+ /** Strength of effect. */
+ float strength;
+ /** Cursor color for add. */
+ float curcolor_add[3];
+ /** Cursor color for sub. */
+ float curcolor_sub[3];
+ /** Target weight. */
+ float weight;
char _pad[4];
} GP_Sculpt_Data;
+/* Settings for a GPencil Speed Guide */
+typedef struct GP_Sculpt_Guide {
+ char use_guide;
+ char use_snapping;
+ char reference_point;
+ char type;
+ char _pad2[4];
+ float angle;
+ float angle_snap;
+ float spacing;
+ float location[3];
+ struct Object *reference_object;
+} GP_Sculpt_Guide;
+
/* GP_Sculpt_Data.flag */
typedef enum eGP_Sculpt_Flag {
/* invert the effect of the brush */
@@ -1017,21 +1108,32 @@ typedef enum eGP_Sculpt_Flag {
/* GPencil Stroke Sculpting Settings */
typedef struct GP_Sculpt_Settings {
- GP_Sculpt_Data brush[12]; /* GP_SCULPT_TYPE_MAX */
- void *paintcursor; /* runtime */
-
- int brushtype; /* eGP_Sculpt_Types (sculpt) */
- int flag; /* eGP_Sculpt_SettingsFlag */
- int lock_axis; /* eGP_Lockaxis_Types lock drawing to one axis */
- char pad1[4];
+ /** GP_SCULPT_TYPE_MAX. */
+ GP_Sculpt_Data brush[12];
+ /** Runtime. */
+ void *paintcursor;
+
+ /** #eGP_Sculpt_Types (sculpt). */
+ int brushtype;
+ /** #eGP_Sculpt_SettingsFlag. */
+ int flag;
+ /** #eGP_Lockaxis_Types lock drawing to one axis. */
+ int lock_axis;
+ /** Threshold for intersections */
+ float isect_threshold;
/* weight paint is a submode of sculpt but use its own index. All weight paint
* brushes must be defined at the end of the brush array.
*/
- int weighttype; /* eGP_Sculpt_Types (weight paint) */
- char pad[4];
- struct CurveMapping *cur_falloff; /* multiframe edit falloff effect by frame */
- struct CurveMapping *cur_primitive; /* Curve used for primitve tools */
+ /** #eGP_Sculpt_Types (weight paint). */
+ int weighttype;
+ char _pad[4];
+ /** Multiframe edit falloff effect by frame. */
+ struct CurveMapping *cur_falloff;
+ /** Curve used for primitve tools. */
+ struct CurveMapping *cur_primitive;
+ /** Guides used for paint tools */
+ struct GP_Sculpt_Guide guide;
} GP_Sculpt_Settings;
/* GP_Sculpt_Settings.flag */
@@ -1056,15 +1158,21 @@ typedef enum eGP_Sculpt_SettingsFlag {
/* Settings for GP Interpolation Operators */
typedef struct GP_Interpolate_Settings {
- short flag; /* eGP_Interpolate_SettingsFlag */
+ /** #eGP_Interpolate_SettingsFlag. */
+ short flag;
- char type; /* eGP_Interpolate_Type - Interpolation Mode */
- char easing; /* eBezTriple_Easing - Easing mode (if easing equation used) */
+ /** #eGP_Interpolate_Type - Interpolation Mode. */
+ char type;
+ /** #eBezTriple_Easing - Easing mode (if easing equation used). */
+ char easing;
- float back; /* BEZT_IPO_BACK */
- float amplitude, period; /* BEZT_IPO_ELASTIC */
+ /** BEZT_IPO_BACK. */
+ float back;
+ /** BEZT_IPO_ELASTIC. */
+ float amplitude, period;
- struct CurveMapping *custom_ipo; /* custom interpolation curve (for use with GP_IPO_CURVEMAP) */
+ /** Custom interpolation curve (for use with GP_IPO_CURVEMAP). */
+ struct CurveMapping *custom_ipo;
} GP_Interpolate_Settings;
/* GP_Interpolate_Settings.flag */
@@ -1143,9 +1251,12 @@ typedef struct UnifiedPaintSettings {
*******************************************************************************/
int anchored_size;
- float overlap_factor; /* normalization factor due to accumulated value of curve along spacing.
- * Calculated when brush spacing changes to dampen strength of stroke
- * if space attenuation is used*/
+ /**
+ * Normalization factor due to accumulated value of curve along spacing.
+ * Calculated when brush spacing changes to dampen strength of stroke
+ * if space attenuation is used.
+ */
+ float overlap_factor;
char draw_inverted;
/* check is there an ongoing stroke right now */
char stroke_active;
@@ -1153,7 +1264,8 @@ typedef struct UnifiedPaintSettings {
char draw_anchored;
char do_linear_conversion;
- /* store last location of stroke or whether the mesh was hit. Valid only while stroke is active */
+ /* store last location of stroke or whether the mesh was hit.
+ * Valid only while stroke is active */
float last_location[3];
int last_hit;
@@ -1190,7 +1302,7 @@ typedef enum {
/* only used if unified alpha is enabled, mirrors the brush flag
* BRUSH_ALPHA_PRESSURE */
- UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE = (1 << 4)
+ UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE = (1 << 4),
} eUnifiedPaintSettingsFlags;
@@ -1200,7 +1312,7 @@ typedef struct CurvePaintSettings {
char depth_mode;
char surface_plane;
char fit_method;
- char pad;
+ char _pad;
short error_threshold;
float radius_min, radius_max;
float radius_taper_start, radius_taper_end;
@@ -1265,17 +1377,22 @@ typedef struct MeshStatVis {
/* Tool Settings */
typedef struct ToolSettings {
- VPaint *vpaint; /* vertex paint */
- VPaint *wpaint; /* weight paint */
+ /** Vertex paint. */
+ VPaint *vpaint;
+ /** Weight paint. */
+ VPaint *wpaint;
Sculpt *sculpt;
- UvSculpt *uvsculpt; /* uv smooth */
- GpPaint *gp_paint; /* gpencil paint */
+ /** Uv smooth. */
+ UvSculpt *uvsculpt;
+ /** Gpencil paint. */
+ GpPaint *gp_paint;
/* Vertex group weight - used only for editmode, not weight
* paint */
float vgroup_weight;
- float doublimit; /* remove doubles limit */
+ /** Remove doubles limit. */
+ float doublimit;
char automerge;
char object_flag;
@@ -1291,21 +1408,30 @@ typedef struct ToolSettings {
float uvcalc_margin;
/* Auto-IK */
- short autoik_chainlen; /* runtime only */
+ /** Runtime only. */
+ short autoik_chainlen;
/* Grease Pencil */
- char gpencil_flags; /* flags/options for how the tool works */
-
- char gpencil_v3d_align; /* stroke placement settings: 3D View */
- char gpencil_v2d_align; /* : General 2D Editor */
- char gpencil_seq_align; /* : Sequencer Preview */
- char gpencil_ima_align; /* : Image Editor */
+ /** Flags/options for how the tool works. */
+ char gpencil_flags;
+
+ /** Stroke placement settings: 3D View. */
+ char gpencil_v3d_align;
+ /** General 2D Editor. */
+ char gpencil_v2d_align;
+ /** Sequencer Preview. */
+ char gpencil_seq_align;
+ /** Image Editor. */
+ char gpencil_ima_align;
/* Annotations */
- char annotate_v3d_align; /* stroke placement settings - 3D View */
+ /** Stroke placement settings - 3D View. */
+ char annotate_v3d_align;
- short annotate_thickness; /* default stroke thickness for annotation strokes */
- short gpencil_selectmode; /* stroke selection mode */
+ /** Default stroke thickness for annotation strokes. */
+ short annotate_thickness;
+ /** Stroke selection mode. */
+ short gpencil_selectmode;
/* Grease Pencil Sculpt */
struct GP_Sculpt_Settings gp_sculpt;
@@ -1326,9 +1452,11 @@ typedef struct ToolSettings {
float select_thresh;
/* Auto-Keying Mode */
- short autokey_flag; /* defines in DNA_userdef_types.h */
+ /** Defines in DNA_userdef_types.h. */
+ short autokey_flag;
char autokey_mode;
- char keyframe_type; /* keyframe type (see DNA_curve_types.h) */
+ /** Keyframe type (see DNA_curve_types.h). */
+ char keyframe_type;
/* Multires */
char multires_subdiv_type;
@@ -1351,16 +1479,24 @@ typedef struct ToolSettings {
char proportional, prop_mode;
- char proportional_objects; /* proportional edit, object mode */
- char proportional_mask; /* proportional edit, mask editing */
- char proportional_action; /* proportional edit, action editor */
- char proportional_fcurve; /* proportional edit, graph editor */
- char lock_markers; /* lock marker editing */
-
- char auto_normalize; /*auto normalizing mode in wpaint*/
- char multipaint; /* paint multiple bones in wpaint */
+ /** Proportional edit, object mode. */
+ char proportional_objects;
+ /** Proportional edit, mask editing. */
+ char proportional_mask;
+ /** Proportional edit, action editor. */
+ char proportional_action;
+ /** Proportional edit, graph editor. */
+ char proportional_fcurve;
+ /** Lock marker editing. */
+ char lock_markers;
+
+ /**aUto normalizing mode in wpain.t*/
+ char auto_normalize;
+ /** Paint multiple bones in wpaint. */
+ char multipaint;
char weightuser;
- char vgroupsubset; /* subset selection filter in wpaint */
+ /** Subset selection filter in wpaint. */
+ char vgroupsubset;
/* UV painting */
char _pad2[1];
@@ -1370,7 +1506,8 @@ typedef struct ToolSettings {
char uv_relax_method;
/* XXX: these sculpt_paint_* fields are deprecated, use the
* unified_paint_settings field instead! */
- short sculpt_paint_settings DNA_DEPRECATED; short pad5;
+ short sculpt_paint_settings DNA_DEPRECATED;
+ char _pad5[2];
int sculpt_paint_unified_size DNA_DEPRECATED;
float sculpt_paint_unified_unprojected_radius DNA_DEPRECATED;
float sculpt_paint_unified_alpha DNA_DEPRECATED;
@@ -1391,29 +1528,23 @@ typedef struct ToolSettings {
/* Assorted Scene Data */
/* ------------------------------------------- */
-/* Stats (show in Info header) */
-
-typedef struct bStats {
- /* scene totals for visible layers */
- int totobj, totlamp, totobjsel, totcurve, totmesh, totarmature;
- int totvert, totface;
-} bStats;
-
-/* ------------------------------------------- */
/* Unit Settings */
typedef struct UnitSettings {
/* Display/Editing unit options for each scene */
- float scale_length; /* maybe have other unit conversions? */
- char system; /* imperial, metric etc */
- char system_rotation; /* not implemented as a proper unit system yet */
+ /** Maybe have other unit conversions?. */
+ float scale_length;
+ /** Imperial, metric etc. */
+ char system;
+ /** Not implemented as a proper unit system yet. */
+ char system_rotation;
short flag;
char length_unit;
char mass_unit;
char time_unit;
- char pad[5];
+ char _pad[5];
} UnitSettings;
/* ------------------------------------------- */
@@ -1425,14 +1556,16 @@ typedef struct PhysicsSettings {
} PhysicsSettings;
/* ------------------------------------------- */
-/* Safe Area options used in Camera View & VSE
+/* Safe Area options used in Camera View & Sequencer
*/
typedef struct DisplaySafeAreas {
/* each value represents the (x,y) margins as a multiplier.
* 'center' in this context is just the name for a different kind of safe-area */
- float title[2]; /* Title Safe */
- float action[2]; /* Image/Graphics Safe */
+ /** Title Safe. */
+ float title[2];
+ /** Image/Graphics Safe. */
+ float action[2];
/* use for alternate aspect ratio */
float title_center[2];
@@ -1442,15 +1575,16 @@ typedef struct DisplaySafeAreas {
/* ------------------------------------------- */
/* Scene Display - used for store scene specific display settings for the 3d view */
typedef struct SceneDisplay {
- float light_direction[3]; /* light direction for shadows/highlight */
+ /** Light direction for shadows/highlight. */
+ float light_direction[3];
float shadow_shift, shadow_focus;
- /* Settings for Cavity Shader */
+ /** Settings for Cavity Shader. */
float matcap_ssao_distance;
float matcap_ssao_attenuation;
int matcap_ssao_samples;
- /* OpenGL render engine settings. */
+ /** OpenGL render engine settings. */
View3DShading shading;
} SceneDisplay;
@@ -1462,7 +1596,7 @@ typedef struct SceneEEVEE {
float gi_irradiance_smoothing;
float gi_glossy_clamp;
float gi_filter_quality;
- float pad;
+ char _pad[4];
float gi_cubemap_draw_size;
float gi_irradiance_draw_size;
@@ -1600,7 +1734,8 @@ enum {
typedef struct Scene {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
struct Object *camera;
struct World *world;
@@ -1608,26 +1743,33 @@ typedef struct Scene {
struct Scene *set;
ListBase base DNA_DEPRECATED;
- struct Base *basact DNA_DEPRECATED; /* active base */
+ /** Active base. */
+ struct Base *basact DNA_DEPRECATED;
void *_pad1;
- View3DCursor cursor; /* 3d cursor location */
+ /** 3d cursor location. */
+ View3DCursor cursor;
- unsigned int lay DNA_DEPRECATED; /* bitflags for layer visibility */
- int layact DNA_DEPRECATED; /* active layer */
- unsigned int pad1;
+ /** Bitflags for layer visibility (deprecated). */
+ unsigned int lay DNA_DEPRECATED;
+ /** Active layer (deprecated) */
+ int layact DNA_DEPRECATED;
+ char _pad2[4];
- short flag; /* various settings */
+ /** Various settings. */
+ short flag;
char use_nodes;
- char pad[1];
+ char _pad3[1];
struct bNodeTree *nodetree;
- struct Editing *ed; /* sequence editor data is allocated here */
+ /** Sequence editor data is allocated here. */
+ struct Editing *ed;
- struct ToolSettings *toolsettings; /* default allocated now */
- void *pad2;
+ /** Default allocated now. */
+ struct ToolSettings *toolsettings;
+ void *_pad4;
struct DisplaySafeAreas safe_areas;
/* migrate or replace? depends on some internal things... */
@@ -1638,7 +1780,7 @@ typedef struct Scene {
ListBase markers;
ListBase transform_spaces;
- /* First is the [scene, translate, rotate, scale]. */
+ /** First is the [scene, translate, rotate, scale]. */
TransformOrientationSlot orientation_slots[4];
void *sound_scene;
@@ -1646,15 +1788,21 @@ typedef struct Scene {
void *sound_scrub_handle;
void *speaker_handles;
- void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */
+ /** (runtime) info/cache used for presenting playback framerate info to the user. */
+ void *fps_info;
/* none of the dependency graph vars is mean to be saved */
struct GHash *depsgraph_hash;
- int pad7;
+ char _pad7[4];
/* User-Defined KeyingSets */
- int active_keyingset; /* index of the active KeyingSet. first KeyingSet has index 1, 'none' active is 0, 'add new' is -1 */
- ListBase keyingsets; /* KeyingSets for this scene */
+ /**
+ * Index of the active KeyingSet.
+ * first KeyingSet has index 1, 'none' active is 0, 'add new' is -1
+ */
+ int active_keyingset;
+ /** KeyingSets for this scene */
+ ListBase keyingsets;
/* Units */
struct UnitSettings unit;
@@ -1663,15 +1811,18 @@ typedef struct Scene {
struct bGPdata *gpd;
/* Movie Tracking */
- struct MovieClip *clip; /* active movie clip */
+ /** Active movie clip. */
+ struct MovieClip *clip;
/* Physics simulation settings */
struct PhysicsSettings physics_settings;
- void *pad8;
- uint64_t customdata_mask; /* XXX. runtime flag for drawing, actually belongs in the window, only used by BKE_object_handle_update() */
- uint64_t customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */
-
+ void *_pad8;
+ /* XXX. runtime flag for drawing, actually belongs in the window,
+ * only used by BKE_object_handle_update() */
+ struct CustomData_MeshMasks customdata_mask;
+ /* XXX. same as above but for temp operator use (gl renders) */
+ struct CustomData_MeshMasks customdata_mask_modal;
/* Color Management */
ColorManagedViewSettings view_settings;
@@ -1688,7 +1839,8 @@ typedef struct Scene {
Collection *master_collection;
struct SceneCollection *collection DNA_DEPRECATED;
- IDProperty *layer_properties; /* settings to be override by workspaces */
+ /** Settings to be override by workspaces. */
+ IDProperty *layer_properties;
struct SceneDisplay display;
struct SceneEEVEE eevee;
@@ -1741,8 +1893,9 @@ typedef struct Scene {
/* RenderData.seq_flag */
enum {
- // R_SEQ_GL_PREV = (1 << 1), // UNUSED, we just use setting from seq_prev_type now.
- // R_SEQ_GL_REND = (1 << 2), // UNUSED, opengl render has its own operator now.
+ R_SEQ_DEPRECATED_0 = (1 << 0), /* cleared */
+ R_SEQ_DEPRECATED_1 = (1 << 1), /* cleared */
+ R_SEQ_DEPRECATED_2 = (1 << 2), /* cleared */
R_SEQ_SOLID_TEX = (1 << 3),
R_SEQ_CAMERA_DOF = (1 << 4),
};
@@ -1812,15 +1965,15 @@ enum {
R_STAMP_RENDERTIME|R_STAMP_CAMERALENS|R_STAMP_MEMORY| \
R_STAMP_HIDE_LABELS|R_STAMP_FRAME_RANGE|R_STAMP_HOSTNAME)
-/* RenderData.alphamode */
-#define R_ADDSKY 0
-#define R_ALPHAPREMUL 1
-/*#define R_ALPHAKEY 2*/ /* deprecated, shouldn't be used */
+/** #RenderData.alphamode */
+#define R_ADDSKY 0
+#define R_ALPHAPREMUL 1
/* RenderData.color_mgt_flag */
enum {
- R_COLOR_MANAGEMENT = (1 << 0), /* deprecated, should only be used in versioning code only */
- /*R_COLOR_MANAGEMENT_PREDIVIDE = (1 << 1)*/ /* deprecated, shouldn't be used */
+ /** deprecated, should only be used in versioning code only */
+ R_COLOR_MANAGEMENT = (1 << 0),
+ R_COLOR_MANAGEMENT_DEPRECATED_1 = (1 << 1),
};
#ifdef DNA_DEPRECATED
@@ -1887,34 +2040,22 @@ extern const char *RE_engine_id_CYCLES;
#define MINAFRAME -1048574
#define MINAFRAMEF -1048574.0f
-/* deprecate this! */
#define BASE_VISIBLE(v3d, base) ( \
- (((v3d)->localvd == NULL) || ((v3d)->local_view_uuid & (base)->local_view_bits)) && \
- (((1 << (base)->object->type) & (v3d)->object_type_exclude_viewport) == 0) && \
- (((base)->flag & BASE_VISIBLE) != 0))
-#define BASE_VISIBLE_BGMODE(v3d, base) ( \
((v3d == NULL) || ((v3d)->localvd == NULL) || ((v3d)->local_view_uuid & (base)->local_view_bits)) && \
((v3d == NULL) || (((1 << (base)->object->type) & (v3d)->object_type_exclude_viewport) == 0)) && \
(((base)->flag & BASE_VISIBLE) != 0))
-
#define BASE_SELECTABLE(v3d, base) ( \
BASE_VISIBLE(v3d, base) && \
- (((1 << (base)->object->type) & (v3d)->object_type_exclude_select) == 0) && \
- (((base)->flag & BASE_SELECTABLE) != 0))
-#define BASE_SELECTABLE_BGMODE(v3d, base) ( \
- BASE_VISIBLE_BGMODE(v3d, base) && \
((v3d == NULL) || (((1 << (base)->object->type) & (v3d)->object_type_exclude_select) == 0)) && \
(((base)->flag & BASE_SELECTABLE) != 0))
-
-#define TESTBASE(v3d, base) \
+#define BASE_SELECTED(v3d, base) \
(BASE_VISIBLE(v3d, base) && (((base)->flag & BASE_SELECTED) != 0))
-#define TESTBASELIB(v3d, base) \
- (TESTBASE(v3d, base) && ((base)->object->id.lib == NULL))
-#define BASE_EDITABLE_BGMODE(v3d, base) \
- (BASE_VISIBLE_BGMODE(v3d, base) && ((base)->object->id.lib == NULL))
-#define TESTBASELIB_BGMODE(v3d, base) \
- (BASE_EDITABLE_BGMODE(v3d, base) && (((base)->flag & BASE_SELECTED) != 0))
+#define BASE_EDITABLE(v3d, base) \
+ (BASE_VISIBLE(v3d, base) && ((base)->object->id.lib == NULL))
+#define BASE_SELECTED_EDITABLE(v3d, base) \
+ (BASE_EDITABLE(v3d, base) && (((base)->flag & BASE_SELECTED) != 0))
+/* deprecate this! */
#define FIRSTBASE(_view_layer) ((_view_layer)->object_bases.first)
#define LASTBASE(_view_layer) ((_view_layer)->object_bases.last)
#define BASACT(_view_layer) ((_view_layer)->basact)
@@ -2026,7 +2167,7 @@ enum {
enum {
OB_DRAW_GROUPUSER_NONE = 0,
OB_DRAW_GROUPUSER_ACTIVE = 1,
- OB_DRAW_GROUPUSER_ALL = 2
+ OB_DRAW_GROUPUSER_ALL = 2,
};
/* toolsettings->face_strength */
@@ -2043,7 +2184,7 @@ typedef enum eVGroupSelect {
WT_VGROUP_ACTIVE = 1,
WT_VGROUP_BONE_SELECT = 2,
WT_VGROUP_BONE_DEFORM = 3,
- WT_VGROUP_BONE_DEFORM_OFF = 4
+ WT_VGROUP_BONE_DEFORM_OFF = 4,
} eVGroupSelect;
#define WT_VGROUP_MASK_ALL \
@@ -2088,7 +2229,7 @@ typedef enum ePaintFlags {
PAINT_SHOW_BRUSH = (1 << 0),
PAINT_FAST_NAVIGATE = (1 << 1),
PAINT_SHOW_BRUSH_ON_SURFACE = (1 << 2),
- PAINT_USE_CAVITY_MASK = (1 << 3)
+ PAINT_USE_CAVITY_MASK = (1 << 3),
} ePaintFlags;
/* Paint.symmetry_flags
@@ -2116,8 +2257,7 @@ typedef enum eSculptFlags {
SCULPT_LOCK_Y = (1 << 4),
SCULPT_LOCK_Z = (1 << 5),
- /* deprecated, part of paint struct symmetry_flags now */
- SCULPT_SYMMETRY_FEATHER = (1 << 6),
+ SCULPT_FLAG_DEPRECATED_6 = (1 << 6), /* cleared */
SCULPT_USE_OPENMP = (1 << 7),
SCULPT_ONLY_DEFORM = (1 << 8),
@@ -2147,6 +2287,12 @@ typedef enum eImagePaintMode {
IMAGEPAINT_MODE_IMAGE, /* select texture paint image directly */
} eImagePaintMode;
+/* ImagePaintSettings.interp */
+enum {
+ IMAGEPAINT_INTERP_LINEAR = 0,
+ IMAGEPAINT_INTERP_CLOSEST,
+};
+
/* ImagePaintSettings.flag */
#define IMAGEPAINT_DRAWING (1 << 0)
// #define IMAGEPAINT_DRAW_TOOL (1 << 1) // deprecated
@@ -2169,9 +2315,12 @@ typedef enum eImagePaintMode {
/* ToolSettings.uvcalc_flag */
#define UVCALC_FILLHOLES (1 << 0)
-#define UVCALC_NO_ASPECT_CORRECT (1 << 1) /* would call this UVCALC_ASPECT_CORRECT, except it should be default with old file */
-#define UVCALC_TRANSFORM_CORRECT (1 << 2) /* adjust UV's while transforming to avoid distortion */
-#define UVCALC_USESUBSURF (1 << 3) /* Use mesh data after subsurf to compute UVs*/
+/** would call this UVCALC_ASPECT_CORRECT, except it should be default with old file */
+#define UVCALC_NO_ASPECT_CORRECT (1 << 1)
+/** adjust UV's while transforming to avoid distortion */
+#define UVCALC_TRANSFORM_CORRECT (1 << 2)
+/** Use mesh data after subsurf to compute UVs*/
+#define UVCALC_USESUBSURF (1 << 3)
/* ToolSettings.uv_flag */
#define UV_SYNC_SELECTION 1
@@ -2248,17 +2397,33 @@ typedef enum eGPencil_Placement_Flags {
/* ToolSettings.gpencil_selectmode */
typedef enum eGPencil_Selectmode_types {
- GP_SELECTMODE_POINT = 0,
- GP_SELECTMODE_STROKE = 1
+ GP_SELECTMODE_POINT = 0,
+ GP_SELECTMODE_STROKE = 1,
+ GP_SELECTMODE_SEGMENT = 2,
} eGPencil_Selectmode_types;
+/* ToolSettings.gpencil_guide_types */
+typedef enum eGPencil_GuideTypes {
+ GP_GUIDE_CIRCULAR = 0,
+ GP_GUIDE_RADIAL,
+ GP_GUIDE_PARALLEL,
+ GP_GUIDE_GRID
+} eGPencil_GuideTypes;
+
+/* ToolSettings.gpencil_guide_references */
+typedef enum eGPencil_Guide_Reference {
+ GP_GUIDE_REF_CURSOR = 0,
+ GP_GUIDE_REF_CUSTOM,
+ GP_GUIDE_REF_OBJECT
+} eGPencil_Guide_Reference;
+
/* ToolSettings.particle flag */
#define PE_KEEP_LENGTHS (1 << 0)
#define PE_LOCK_FIRST (1 << 1)
#define PE_DEFLECT_EMITTER (1 << 2)
#define PE_INTERPOLATE_ADDED (1 << 3)
#define PE_DRAW_PART (1 << 4)
-/* #define PE_X_MIRROR (1 << 6) */ /* deprecated */
+#define PE_DEPRECATED_6 (1 << 6) /* cleared */
#define PE_FADE_TIME (1 << 7)
#define PE_AUTO_VELOCITY (1 << 8)
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index cdf67f1e11d..3dc44ac9416 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_screen_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_SCREEN_TYPES_H__
@@ -37,12 +31,12 @@
#include "DNA_ID.h"
-struct SpaceType;
-struct SpaceLink;
struct ARegion;
struct ARegionType;
struct PanelType;
struct Scene;
+struct SpaceLink;
+struct SpaceType;
struct uiLayout;
struct wmDrawBuffer;
struct wmTimer;
@@ -58,35 +52,53 @@ typedef struct bScreen {
/* TODO Should become ScrAreaMap now.
* ** NOTE: KEEP ORDER IN SYNC WITH ScrAreaMap! (see AREAMAP_FROM_SCREEN macro above) ** */
- ListBase vertbase; /* screens have vertices/edges to define areas */
+ /** Screens have vertices/edges to define areas. */
+ ListBase vertbase;
ListBase edgebase;
ListBase areabase;
- ListBase regionbase; /* screen level regions (menus), runtime only */
+ /** Screen level regions (menus), runtime only. */
+ ListBase regionbase;
struct Scene *scene DNA_DEPRECATED;
- short flag; /* general flags */
- short winid; /* winid from WM, starts with 1 */
- short redraws_flag; /* user-setting for which editors get redrawn during anim playback (used to be time->redraws) */
-
- char temp; /* temp screen in a temp window, don't save (like user prefs) */
- char state; /* temp screen for image render display or fileselect */
- char do_draw; /* notifier for drawing edges */
- char do_refresh; /* notifier for scale screen, changed screen, etc */
- char do_draw_gesture; /* notifier for gesture draw. */
- char do_draw_paintcursor; /* notifier for paint cursor draw. */
- char do_draw_drag; /* notifier for dragging draw. */
- char skip_handling; /* set to delay screen handling after switching back from maximized area */
- char scrubbing; /* set when scrubbing to avoid some costly updates */
- char pad[1];
-
- struct ARegion *active_region; /* active region that has mouse focus */
-
- struct wmTimer *animtimer; /* if set, screen has timer handler added in window */
- void *context; /* context callback */
-
- struct wmTooltipState *tool_tip; /* runtime */
+ /** General flags. */
+ short flag;
+ /** Winid from WM, starts with 1. */
+ short winid;
+ /** User-setting for which editors get redrawn during anim playback. */
+ short redraws_flag;
+
+ /** Temp screen in a temp window, don't save (like user prefs). */
+ char temp;
+ /** Temp screen for image render display or fileselect. */
+ char state;
+ /** Notifier for drawing edges. */
+ char do_draw;
+ /** Notifier for scale screen, changed screen, etc. */
+ char do_refresh;
+ /** Notifier for gesture draw. */
+ char do_draw_gesture;
+ /** Notifier for paint cursor draw. */
+ char do_draw_paintcursor;
+ /** Notifier for dragging draw. */
+ char do_draw_drag;
+ /** Set to delay screen handling after switching back from maximized area. */
+ char skip_handling;
+ /** Set when scrubbing to avoid some costly updates. */
+ char scrubbing;
+ char _pad[1];
+
+ /** Active region that has mouse focus. */
+ struct ARegion *active_region;
+
+ /** If set, screen has timer handler added in window. */
+ struct wmTimer *animtimer;
+ /** Context callback. */
+ void *context;
+
+ /** Runtime. */
+ struct wmTooltipState *tool_tip;
PreviewImage *preview;
} bScreen;
@@ -101,50 +113,68 @@ typedef struct ScrVert {
typedef struct ScrEdge {
struct ScrEdge *next, *prev;
ScrVert *v1, *v2;
- short border; /* 1 when at edge of screen */
+ /** 1 when at edge of screen. */
+ short border;
short flag;
- int pad;
+ char _pad[4];
} ScrEdge;
typedef struct ScrAreaMap {
/* ** NOTE: KEEP ORDER IN SYNC WITH LISTBASES IN bScreen! ** */
- ListBase vertbase; /* ScrVert - screens have vertices/edges to define areas */
- ListBase edgebase; /* ScrEdge */
- ListBase areabase; /* ScrArea */
+ /** ScrVert - screens have vertices/edges to define areas. */
+ ListBase vertbase;
+ /** ScrEdge. */
+ ListBase edgebase;
+ /** ScrArea. */
+ ListBase areabase;
} ScrAreaMap;
-typedef struct Panel { /* the part from uiBlock that needs saved in file */
+/** The part from uiBlock that needs saved in file. */
+typedef struct Panel {
struct Panel *next, *prev;
- struct PanelType *type; /* runtime */
- struct uiLayout *layout; /* runtime for drawing */
-
- char panelname[64], tabname[64]; /* defined as UI_MAX_NAME_STR */
- char drawname[64]; /* panelname is identifier for restoring location */
- int ofsx, ofsy; /* offset within the region */
- int sizex, sizey; /* panel size including children */
- int blocksizex, blocksizey; /* panel size excluding children */
- short labelofs, pad;
+ /** Runtime. */
+ struct PanelType *type;
+ /** Runtime for drawing. */
+ struct uiLayout *layout;
+
+ /** Defined as UI_MAX_NAME_STR. */
+ char panelname[64], tabname[64];
+ /** Panel name is identifier for restoring location. */
+ char drawname[64];
+ /** Offset within the region. */
+ int ofsx, ofsy;
+ /** Panel size including children. */
+ int sizex, sizey;
+ /** Panel size excluding children. */
+ int blocksizex, blocksizey;
+ short labelofs;
+ char _pad[2];
short flag, runtime_flag;
short control;
short snap;
- int sortorder; /* panels are aligned according to increasing sortorder */
- struct Panel *paneltab; /* this panel is tabbed in *paneltab */
- void *activedata; /* runtime for panel manipulation */
- ListBase children; /* sub panels */
+ /** Panels are aligned according to increasing sort-order. */
+ int sortorder;
+ /** This panel is tabbed in *paneltab. */
+ struct Panel *paneltab;
+ /** Runtime for panel manipulation. */
+ void *activedata;
+ /** Sub panels. */
+ ListBase children;
} Panel;
-/* Notes on Panel Catogories:
+/**
+ * Notes on Panel Categories:
*
- * ar->panels_category (PanelCategoryDyn) is a runtime only list of categories collected during draw.
+ * - #ARegion.panels_category (#PanelCategoryDyn) is a runtime only list of categories collected during draw.
*
- * ar->panels_category_active (PanelCategoryStack) is basically a list of strings (category id's).
+ * - #ARegion.panels_category_active (#PanelCategoryStack) is basically a list of strings (category id's).
*
* Clicking on a tab moves it to the front of ar->panels_category_active,
* If the context changes so this tab is no longer displayed,
- * then the first-most tab in ar->panels_category_active is used.
+ * then the first-most tab in #ARegion.panels_category_active is used.
*
* This way you can change modes and always have the tab you last clicked on.
*/
@@ -170,32 +200,43 @@ typedef struct PanelCategoryStack {
#
#
typedef struct uiListDyn {
- int height; /* Number of rows needed to draw all elements. */
- int visual_height; /* Actual visual height of the list (in rows). */
- int visual_height_min; /* Minimal visual height of the list (in rows). */
-
- int items_len; /* Number of items in collection. */
- int items_shown; /* Number of items actually visible after filtering. */
-
- /* Those are temp data used during drag-resize with GRIP button (they are in pixels, the meaningful data is the
+ /** Number of rows needed to draw all elements. */
+ int height;
+ /** Actual visual height of the list (in rows). */
+ int visual_height;
+ /** Minimal visual height of the list (in rows). */
+ int visual_height_min;
+
+ /** Number of items in collection. */
+ int items_len;
+ /** Number of items actually visible after filtering. */
+ int items_shown;
+
+ /* Those are temp data used during drag-resize with GRIP button
+ * (they are in pixels, the meaningful data is the
* difference between resize_prev and resize)...
*/
int resize;
int resize_prev;
/* Filtering data. */
- int *items_filter_flags; /* items_len length. */
- int *items_filter_neworder; /* org_idx -> new_idx, items_len length. */
+ /** Items_len length. */
+ int *items_filter_flags;
+ /** Org_idx -> new_idx, items_len length. */
+ int *items_filter_neworder;
} uiListDyn;
typedef struct uiList { /* some list UI data need to be saved in file */
struct uiList *next, *prev;
- struct uiListType *type; /* runtime */
+ /** Runtime. */
+ struct uiListType *type;
- char list_id[64]; /* defined as UI_MAX_NAME_STR */
+ /** Defined as UI_MAX_NAME_STR. */
+ char list_id[64];
- int layout_type; /* How items are layedout in the list */
+ /** How items are layedout in the list. */
+ int layout_type;
int flag;
int list_scroll;
@@ -204,7 +245,8 @@ typedef struct uiList { /* some list UI data need to be saved in file
int list_last_activei;
/* Filtering data. */
- char filter_byname[64]; /* defined as UI_MAX_NAME_STR */
+ /** Defined as UI_MAX_NAME_STR. */
+ char filter_byname[64];
int filter_flag;
int filter_sort_flag;
@@ -217,17 +259,20 @@ typedef struct uiList { /* some list UI data need to be saved in file
typedef struct TransformOrientation {
struct TransformOrientation *next, *prev;
- char name[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64];
float mat[3][3];
- int pad;
+ char _pad[4];
} TransformOrientation;
-typedef struct uiPreview { /* some preview UI data need to be saved in file */
+/** Some preview UI data need to be saved in file. */
+typedef struct uiPreview {
struct uiPreview *next, *prev;
- char preview_id[64]; /* defined as UI_MAX_NAME_STR */
+ /** Defined as UI_MAX_NAME_STR. */
+ char preview_id[64];
short height;
- short pad1[3];
+ char _pad1[6];
} uiPreview;
/* These two lines with # tell makesdna this struct can be excluded.
@@ -244,10 +289,12 @@ typedef struct ScrGlobalAreaData {
* if they are 'collapsed' or not. Value is set on area creation and not
* touched afterwards. */
short size_min, size_max;
- short align; /* GlobalAreaAlign */
+ /** GlobalAreaAlign. */
+ short align;
- short flag; /* GlobalAreaFlag */
- short pad;
+ /** GlobalAreaFlag. */
+ short flag;
+ char _pad[2];
} ScrGlobalAreaData;
enum GlobalAreaFlag {
@@ -268,28 +315,43 @@ typedef struct ScrArea_Runtime {
typedef struct ScrArea {
struct ScrArea *next, *prev;
- ScrVert *v1, *v2, *v3, *v4; /* ordered (bl, tl, tr, br) */
- bScreen *full; /* if area==full, this is the parent */
+ /** Ordered (bl, tl, tr, br). */
+ ScrVert *v1, *v2, *v3, *v4;
+ /** If area==full, this is the parent. */
+ bScreen *full;
- rcti totrct; /* rect bound by v1 v2 v3 v4 */
+ /** Rect bound by v1 v2 v3 v4. */
+ rcti totrct;
- char spacetype; /* eSpace_Type (SPACE_FOO) */
- /* Temporarily used while switching area type, otherwise this should be
- * SPACE_EMPTY. Also, versioning uses it to nicely replace deprecated
- * editors. It's been there for ages, name doesn't fit any more... */
- char butspacetype; /* eSpace_Type (SPACE_FOO) */
+ /**
+ * eSpace_Type (SPACE_FOO).
+ *
+ * Temporarily used while switching area type, otherwise this should be SPACE_EMPTY.
+ * Also, versioning uses it to nicely replace deprecated * editors.
+ * It's been there for ages, name doesn't fit any more.
+ */
+ char spacetype;
+ /** #eSpace_Type (SPACE_FOO). */
+ char butspacetype;
short butspacetype_subtype;
- short winx, winy; /* size */
+ /** Size. */
+ short winx, winy;
- char headertype DNA_DEPRECATED;/* OLD! 0=no header, 1= down, 2= up */
- char do_refresh; /* private, for spacetype refresh callback */
+ /** OLD! 0=no header, 1= down, 2= up. */
+ char headertype DNA_DEPRECATED;
+ /** Private, for spacetype refresh callback. */
+ char do_refresh;
short flag;
- short region_active_win; /* index of last used region of 'RGN_TYPE_WINDOW'
- * runtime variable, updated by executing operators */
- char temp, pad;
+ /**
+ * Index of last used region of 'RGN_TYPE_WINDOW'
+ * runtime variable, updated by executing operators.
+ */
+ short region_active_win;
+ char temp, _pad;
- struct SpaceType *type; /* callbacks for this space type */
+ /** Callbacks for this space type. */
+ struct SpaceType *type;
/* Non-NULL if this area is global. */
ScrGlobalAreaData *global;
@@ -298,14 +360,18 @@ typedef struct ScrArea {
* changing the editor type, we try to reuse old editor data from this list.
* The first item is the active/visible one.
*/
- ListBase spacedata; /* SpaceLink */
+ /** #SpaceLink. */
+ ListBase spacedata;
/* NOTE: This region list is the one from the active/visible editor (first item in
* spacedata list). Use SpaceLink.regionbase if it's inactive (but only then)!
*/
- ListBase regionbase; /* ARegion */
- ListBase handlers; /* wmEventHandler */
+ /** #ARegion. */
+ ListBase regionbase;
+ /** #wmEventHandler. */
+ ListBase handlers;
- ListBase actionzones; /* AZone */
+ /** #AZone. */
+ ListBase actionzones;
ScrArea_Runtime runtime;
} ScrArea;
@@ -319,46 +385,72 @@ typedef struct ARegion_Runtime {
typedef struct ARegion {
struct ARegion *next, *prev;
- View2D v2d; /* 2D-View scrolling/zoom info (most regions are 2d anyways) */
- rcti winrct; /* coordinates of region */
- rcti drawrct; /* runtime for partial redraw, same or smaller than winrct */
- short winx, winy; /* size */
-
- short visible; /* region is currently visible on screen */
- short regiontype; /* window, header, etc. identifier for drawing */
- short alignment; /* how it should split */
- short flag; /* hide, ... */
-
- float fsize; /* current split size in float (unused) */
- short sizex, sizey; /* current split size in pixels (if zero it uses regiontype) */
-
- short do_draw; /* private, cached notifier events */
- short do_draw_overlay; /* private, cached notifier events */
- short overlap; /* private, set for indicate drawing overlapped */
- short flagfullscreen; /* temporary copy of flag settings for clean fullscreen */
- short pad1, pad2;
-
- struct ARegionType *type; /* callbacks for this region type */
-
- ListBase uiblocks; /* uiBlock */
- ListBase panels; /* Panel */
- ListBase panels_category_active; /* Stack of panel categories */
- ListBase ui_lists; /* uiList */
- ListBase ui_previews; /* uiPreview */
- ListBase handlers; /* wmEventHandler */
- ListBase panels_category; /* Panel categories runtime */
-
- struct wmGizmoMap *gizmo_map; /* gizmo-map of this region */
- struct wmTimer *regiontimer; /* blend in/out */
+ /** 2D-View scrolling/zoom info (most regions are 2d anyways). */
+ View2D v2d;
+ /** Coordinates of region. */
+ rcti winrct;
+ /** Runtime for partial redraw, same or smaller than winrct. */
+ rcti drawrct;
+ /** Size. */
+ short winx, winy;
+
+ /** Region is currently visible on screen. */
+ short visible;
+ /** Window, header, etc. identifier for drawing. */
+ short regiontype;
+ /** How it should split. */
+ short alignment;
+ /** Hide, .... */
+ short flag;
+
+ /** Current split size in float (unused). */
+ float fsize;
+ /** Current split size in pixels (if zero it uses regiontype). */
+ short sizex, sizey;
+
+ /** Private, cached notifier events. */
+ short do_draw;
+ /** Private, cached notifier events. */
+ short do_draw_overlay;
+ /** Private, set for indicate drawing overlapped. */
+ short overlap;
+ /** Temporary copy of flag settings for clean fullscreen. */
+ short flagfullscreen;
+ char _pad[4];
+
+ /** Callbacks for this region type. */
+ struct ARegionType *type;
+
+ /** #uiBlock. */
+ ListBase uiblocks;
+ /** Panel. */
+ ListBase panels;
+ /** Stack of panel categories. */
+ ListBase panels_category_active;
+ /** #uiList. */
+ ListBase ui_lists;
+ /** #uiPreview. */
+ ListBase ui_previews;
+ /** #wmEventHandler. */
+ ListBase handlers;
+ /** Panel categories runtime. */
+ ListBase panels_category;
+
+ /** Gizmo-map of this region. */
+ struct wmGizmoMap *gizmo_map;
+ /** Blend in/out. */
+ struct wmTimer *regiontimer;
struct wmDrawBuffer *draw_buffer;
- char *headerstr; /* use this string to draw info */
- void *regiondata; /* XXX 2.50, need spacedata equivalent? */
+ /** Use this string to draw info. */
+ char *headerstr;
+ /** XXX 2.50, need spacedata equivalent?. */
+ void *regiondata;
ARegion_Runtime runtime;
} ARegion;
-/* area->flag */
+/** #ScrArea.flag */
enum {
HEADER_NO_PULLDOWN = (1 << 0),
// AREA_FLAG_DEPRECATED_1 = (1 << 1),
@@ -372,31 +464,48 @@ enum {
// AREA_FLAG_DEPRECATED_5 = (1 << 5),
/* used to check if we should switch back to prevspace (of a different type) */
AREA_FLAG_TEMP_TYPE = (1 << 6),
- /* for temporary fullscreens (file browser, image editor render) that are opened above user set fullscreens */
+ /* for temporary fullscreens (file browser, image editor render)
+ * that are opened above user set fullscreens */
AREA_FLAG_STACKED_FULLSCREEN = (1 << 7),
/* update action zones (even if the mouse is not intersecting them) */
AREA_FLAG_ACTIONZONES_UPDATE = (1 << 8),
};
-#define EDGEWIDTH 1
-#define AREAGRID 4
-#define AREAMINX 32
-#define HEADERY 26
+#define AREAGRID 4
+#define AREAMINX 32
+#define HEADER_PADDING_Y 6
+#define HEADERY (20 + HEADER_PADDING_Y)
-/* screen->flag */
+/** #bScreen.flag */
enum {
SCREEN_COLLAPSE_TOPBAR = 1,
SCREEN_COLLAPSE_STATUSBAR = 2,
};
-/* screen->state */
+/** #bScreen.state */
enum {
SCREENNORMAL = 0,
SCREENMAXIMIZED = 1, /* one editor taking over the screen */
SCREENFULL = 2, /* one editor taking over the screen with no bare-minimum UI elements */
};
-/* Panel->flag */
+/** #bScreen.redraws_flag */
+typedef enum eScreen_Redraws_Flag {
+ TIME_REGION = (1 << 0),
+ TIME_ALL_3D_WIN = (1 << 1),
+ TIME_ALL_ANIM_WIN = (1 << 2),
+ TIME_ALL_BUTS_WIN = (1 << 3),
+ // TIME_WITH_SEQ_AUDIO = (1 << 4), /* DEPRECATED */
+ TIME_SEQ = (1 << 5),
+ TIME_ALL_IMAGE_WIN = (1 << 6),
+ // TIME_CONTINUE_PHYSICS = (1 << 7), /* UNUSED */
+ TIME_NODES = (1 << 8),
+ TIME_CLIPS = (1 << 9),
+
+ TIME_FOLLOW = (1 << 15),
+} eScreen_Redraws_Flag;
+
+/** #Panel.flag */
enum {
PNL_SELECT = (1 << 0),
PNL_CLOSEDX = (1 << 1),
@@ -408,7 +517,7 @@ enum {
PNL_POPOVER = (1 << 6),
};
-/* Panel->snap - for snapping to screen edges */
+/** #Panel.snap - for snapping to screen edges */
#define PNL_SNAP_NONE 0
/* #define PNL_SNAP_TOP 1 */
/* #define PNL_SNAP_RIGHT 2 */
@@ -425,16 +534,17 @@ enum {
/* Fallback panel category (only for old scripts which need updating) */
#define PNL_CATEGORY_FALLBACK "Misc"
-/* uiList layout_type */
+/** #uiList.layout_type */
enum {
UILST_LAYOUT_DEFAULT = 0,
UILST_LAYOUT_COMPACT = 1,
UILST_LAYOUT_GRID = 2,
};
-/* uiList flag */
+/** #uiList.flag */
enum {
- UILST_SCROLL_TO_ACTIVE_ITEM = 1 << 0, /* Scroll list to make active item visible. */
+ /* Scroll list to make active item visible. */
+ UILST_SCROLL_TO_ACTIVE_ITEM = 1 << 0,
};
/* Value (in number of items) we have to go below minimum shown items to enable auto size. */
@@ -447,20 +557,27 @@ enum {
UILST_FLT_ITEM = 1 << 30, /* This item has passed the filter process successfully. */
};
-/* uiList filter options */
+/** #uiList.filter_flag */
enum {
UILST_FLT_SHOW = 1 << 0, /* Show filtering UI. */
UILST_FLT_EXCLUDE = UILST_FLT_ITEM, /* Exclude filtered items, *must* use this same value. */
};
-/* uiList filter orderby type */
+/** #uiList.filter_sort_flag */
enum {
- UILST_FLT_SORT_ALPHA = 1 << 0,
- UILST_FLT_FORCED_REVERSE = 1 << 1, /* Special flag to indicate reverse was set by external parameter */
- UILST_FLT_SORT_REVERSE = 1u << 31 /* Special value, bitflag used to reverse order! */
+ /* Plain values (only one is valid at a time, once masked with UILST_FLT_SORT_MASK. */
+ /** Just for sake of consistency. */
+ UILST_FLT_SORT_INDEX = 0,
+ UILST_FLT_SORT_ALPHA = 1,
+
+ /* Bitflags affecting behavior of any kind of sorting. */
+ /** Special flag to indicate that order is locked (not user-changeable). */
+ UILST_FLT_SORT_LOCK = 1u << 30,
+ /** Special value, bitflag used to reverse order! */
+ UILST_FLT_SORT_REVERSE = 1u << 31,
};
-#define UILST_FLT_SORT_MASK (((unsigned int)UILST_FLT_SORT_REVERSE) - 1)
+#define UILST_FLT_SORT_MASK (((unsigned int)(UILST_FLT_SORT_REVERSE | UILST_FLT_SORT_LOCK)) - 1)
/* regiontype, first two are the default set */
/* Do NOT change order, append on end. Types are hardcoded needed */
@@ -498,7 +615,7 @@ enum {
#define RGN_SPLIT_PREV 32
-/* region flag */
+/** #ARegion.flag */
enum {
RGN_FLAG_HIDDEN = (1 << 0),
RGN_FLAG_TOO_SMALL = (1 << 1),
@@ -512,10 +629,11 @@ enum {
RGN_FLAG_PREFSIZE_OR_HIDDEN = (1 << 4),
};
-/* region do_draw */
+/** #ARegion.do_draw */
#define RGN_DRAW 1
#define RGN_DRAW_PARTIAL 2
#define RGN_DRAWING 4
#define RGN_DRAW_REFRESH_UI 8 /* re-create uiBlock's where possible */
#define RGN_DRAW_NO_REBUILD 16
-#endif
+
+#endif /* __DNA_SCREEN_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h
index 27d18e49634..bf7a8193246 100644
--- a/source/blender/makesdna/DNA_sdna_types.h
+++ b/source/blender/makesdna/DNA_sdna_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,46 +15,66 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/**
- * \file DNA_sdna_types.h
+/** \file
* \ingroup DNA
*/
#ifndef __DNA_SDNA_TYPES_H__
#define __DNA_SDNA_TYPES_H__
+struct MemArena;
+
#
#
typedef struct SDNA {
- const char *data; /* full copy of 'encoded' data (when data_alloc is set, otherwise borrowed). */
- int datalen; /* length of data */
+ /** Full copy of 'encoded' data (when data_alloc is set, otherwise borrowed). */
+ const char *data;
+ /** Length of data. */
+ int data_len;
bool data_alloc;
- int nr_names; /* total number of struct members */
- const char **names; /* struct member names */
+ /** Total number of struct members. */
+ int nr_names, nr_names_alloc;
+ /** Struct member names. */
+ const char **names;
+ /** Result of #DNA_elem_array_size (aligned with #names). */
+ short *names_array_len;
+
+ /** Size of a pointer in bytes. */
+ int pointer_size;
- int pointerlen; /* size of a pointer in bytes */
+ /** Number of basic types + struct types. */
+ int nr_types;
+ /** Type names. */
+ const char **types;
+ /** Type lengths. */
+ short *types_size;
- int nr_types; /* number of basic types + struct types */
- const char **types; /* type names */
- short *typelens; /* type lengths */
+ /** Number of struct types. */
+ int nr_structs;
+ /**
+ * sp = structs[a] is the address of a struct definition
+ * sp[0] is struct type number, sp[1] amount of members
+ *
+ * (sp[2], sp[3]), (sp[4], sp[5]), .. are the member
+ * type and name numbers respectively.
+ */
+ short **structs;
- int nr_structs; /* number of struct types */
- short **structs; /* sp = structs[a] is the address of a struct definition
- * sp[0] is struct type number, sp[1] amount of members
- *
- * (sp[2], sp[3]), (sp[4], sp[5]), .. are the member
- * type and name numbers respectively */
+ /** #GHash for faster lookups, requires WITH_DNA_GHASH to be used for now. */
+ struct GHash *structs_map;
- struct GHash *structs_map; /* ghash for faster lookups,
- * requires WITH_DNA_GHASH to be used for now */
+ /** Temporary memory currently only used for version patching DNA. */
+ struct MemArena *mem_arena;
+ /** Runtime versions of data stored in DNA, lazy initialized,
+ * only different when renaming is done. */
+ struct {
+ /** Aligned with #SDNA.names, same pointers when unchanged. */
+ const char **names;
+ /** Aligned with #SDNA.types, same pointers when unchanged. */
+ const char **types;
+ } alias;
} SDNA;
#
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index f44c9675e86..629bfffb696 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,9 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_sequence_types.h
- * \ingroup DNA
- * \since mar-2001
- * \author nzc
+/** \file
+ * \ingroup DNA
*
* Structs for use by the 'Sequencer' (Video Editor)
*
@@ -45,11 +35,12 @@
#include "DNA_color_types.h"
#include "DNA_listBase.h"
#include "DNA_vec_types.h"
+#include "DNA_vfont_types.h"
struct Ipo;
+struct MovieClip;
struct Scene;
struct bSound;
-struct MovieClip;
/* strlens; 256= FILE_MAXFILE, 768= FILE_MAXDIR */
@@ -80,7 +71,7 @@ typedef struct StripColorBalance {
float gamma[3];
float gain[3];
int flag;
- int pad;
+ char _pad[4];
// float exposure;
// float saturation;
} StripColorBalance;
@@ -101,16 +92,19 @@ typedef struct StripProxy {
// to build
short build_flags;
char storage;
- char pad[5];
+ char _pad[5];
} StripProxy;
typedef struct Strip {
struct Strip *next, *prev;
int us, done;
int startstill, endstill;
- 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 */
+ /**
+ * Only used as an array in IMAGE sequences(!),
+ * and as a 1-element array in MOVIE sequences,
+ * NULL for all other strip-types.
+ */
+ StripElem *stripdata;
char dir[768];
StripProxy *proxy;
StripCrop *crop;
@@ -133,35 +127,63 @@ typedef struct Strip {
*/
typedef struct Sequence {
struct Sequence *next, *prev;
- void *tmp; /* tmp var for copying, and tagging for linked selection */
- void *lib; /* needed (to be like ipo), else it will raise libdata warnings, this should never be used */
- char name[64]; /* SEQ_NAME_MAXSTR - name, set by default and needs to be unique, for RNA paths */
-
- int flag, type; /*flags bitmap (see below) and the type of sequence*/
- int len; /* the length of the contents of this strip - before handles are applied */
- int start; /* start frame of contents of strip in absolute frame coordinates. For metastrips start of first strip startdisp */
- int startofs, endofs; /* frames after the first frame where display starts, frames before the last frame where display ends */
- int startstill, endstill; /* frames that use the first frame before data begins, frames that use the last frame after data ends */
- int machine, depth; /*machine - the strip channel, depth - the depth in the sequence when dealing with metastrips */
- int startdisp, enddisp; /* starting and ending points of the strip in the sequence*/
+ /** Tmp var for copying, and tagging for linked selection. */
+ void *tmp;
+ /** Needed (to be like ipo), else it will raise libdata warnings, this should never be used. */
+ void *lib;
+ /** SEQ_NAME_MAXSTR - name, set by default and needs to be unique, for RNA paths. */
+ char name[64];
+
+ /**fLags bitmap (see below) and the type of sequenc.e*/
+ int flag, type;
+ /** The length of the contents of this strip - before handles are applied. */
+ int len;
+ /**
+ * Start frame of contents of strip in absolute frame coordinates.
+ * For metastrips start of first strip startdisp.
+ */
+ int start;
+ /**
+ * Frames after the first frame where display starts,
+ * frames before the last frame where display ends.
+ */
+ int startofs, endofs;
+ /**
+ * Frames that use the first frame before data begins,
+ * frames that use the last frame after data ends.
+ */
+ int startstill, endstill;
+ /** Machine: the strip channel, depth the depth in the sequence when dealing with metastrips. */
+ int machine, depth;
+ /** Starting and ending points of the strip in the sequenc.e*/
+ int startdisp, enddisp;
float sat;
float mul, handsize;
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 */
+ /** Streamindex for movie or sound files with several streams. */
+ short streamindex;
+ /** For multicam source selection. */
+ int multicam_source;
+ /** MOVIECLIP render flags. */
+ int clip_flag;
Strip *strip;
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
- /* these ID vars should never be NULL but can be when linked libs fail to load, so check on access */
+ /** these ID vars should never be NULL but can be when linked libs fail to load,
+ * so check on access */
struct Scene *scene;
- struct Object *scene_camera; /* override scene camera */
- struct MovieClip *clip; /* for MOVIECLIP strips */
- struct Mask *mask; /* for MASK strips */
- ListBase anims; /* for MOVIE strips */
+ /** Override scene camera. */
+ struct Object *scene_camera;
+ /** For MOVIECLIP strips. */
+ struct MovieClip *clip;
+ /** For MASK strips. */
+ struct Mask *mask;
+ /** For MOVIE strips. */
+ ListBase anims;
float effect_fader;
float speed_fader;
@@ -169,29 +191,36 @@ typedef struct Sequence {
/* pointers for effects: */
struct Sequence *seq1, *seq2, *seq3;
- ListBase seqbase; /* list of strips for metastrips */
+ /** List of strips for metastrips. */
+ ListBase seqbase;
- struct bSound *sound; /* the linked "bSound" object */
+ /** The linked "bSound" object. */
+ struct bSound *sound;
void *scene_sound;
float volume;
- float pitch, pan; /* pitch (-0.1..10), pan -2..2 */
+ /** Pitch (-0.1..10), pan -2..2. */
+ float pitch, pan;
float strobe;
- void *effectdata; /* Struct pointer for effect settings */
+ /** Struct pointer for effect settings. */
+ void *effectdata;
- int anim_startofs; /* only use part of animation file */
- int anim_endofs; /* is subtle different to startofs / endofs */
+ /** Only use part of animation file. */
+ int anim_startofs;
+ /** Is subtle different to startofs / endofs. */
+ int anim_endofs;
int blend_mode;
float blend_opacity;
/* is sfra needed anymore? - it looks like its only used in one place */
- int sfra; /* starting frame according to the timeline of the scene. */
+ /** Starting frame according to the timeline of the scene. */
+ int sfra;
char alpha_mode;
- char pad[2];
+ char _pad[2];
/* Multiview */
char views_format;
@@ -212,15 +241,20 @@ typedef struct MetaStack {
} MetaStack;
typedef struct Editing {
- ListBase *seqbasep; /* pointer to the current list of seq's being edited (can be within a meta strip) */
- ListBase seqbase; /* pointer to the top-most seq's */
+ /** Pointer to the current list of seq's being edited (can be within a meta strip). */
+ ListBase *seqbasep;
+ /** Pointer to the top-most seq's. */
+ ListBase seqbase;
ListBase metastack;
/* Context vars, used to be static */
Sequence *act_seq;
- char act_imagedir[1024]; /* 1024 = FILE_MAX */
- char act_sounddir[1024]; /* 1024 = FILE_MAX */
- char proxy_dir[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char act_imagedir[1024];
+ /** 1024 = FILE_MAX. */
+ char act_sounddir[1024];
+ /** 1024 = FILE_MAX. */
+ char proxy_dir[1024];
int over_ofs, over_cfra;
int over_flag, proxy_storage;
@@ -234,12 +268,16 @@ typedef struct WipeVars {
} WipeVars;
typedef struct GlowVars {
- float fMini; /* Minimum intensity to trigger a glow */
+ /** Minimum intensity to trigger a glow. */
+ float fMini;
float fClamp;
- float fBoost; /* Amount to multiply glow intensity */
- float dDist; /* Radius of glow blurring */
+ /** Amount to multiply glow intensity. */
+ float fBoost;
+ /** Radius of glow blurring. */
+ float dDist;
int dQuality;
- int bNoComp; /* SHOW/HIDE glow buffer */
+ /** SHOW/HIDE glow buffer. */
+ int bNoComp;
} GlowVars;
typedef struct TransformVars {
@@ -250,12 +288,13 @@ typedef struct TransformVars {
float rotIni;
int percent;
int interpolation;
- int uniform_scale; /* preserve aspect/ratio when scaling */
+ /** Preserve aspect/ratio when scaling. */
+ int uniform_scale;
} TransformVars;
typedef struct SolidColorVars {
float col[3];
- float pad;
+ char _pad[4];
} SolidColorVars;
typedef struct SpeedControlVars {
@@ -273,13 +312,15 @@ typedef struct GaussianBlurVars {
typedef struct TextVars {
char text[512];
+ VFont *text_font;
+ int text_blf_id;
int text_size;
float color[4], shadow_color[4];
float loc[2];
float wrap_width;
char flag;
char align, align_y;
- char pad[5];
+ char _pad[1];
} TextVars;
/* TextVars.flag */
@@ -301,9 +342,13 @@ enum {
SEQ_TEXT_ALIGN_Y_BOTTOM = 2,
};
+#define SEQ_FONT_NOT_LOADED -2
+
typedef struct ColorMixVars {
- int blend_effect; /* value from SEQ_TYPE_XXX enumeration */
- float factor; /* blend factor [0.0f, 1.0f] */
+ /** Value from SEQ_TYPE_XXX enumeration. */
+ int blend_effect;
+ /** Blend factor [0.0f, 1.0f]. */
+ float factor;
} ColorMixVars;
/* ***************** Sequence modifiers ****************** */
@@ -311,7 +356,8 @@ typedef struct ColorMixVars {
typedef struct SequenceModifierData {
struct SequenceModifierData *next, *prev;
int type, flag;
- char name[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64];
/* mask input, either sequence or mask ID */
int mask_input_type;
@@ -355,7 +401,7 @@ typedef struct WhiteBalanceModifierData {
SequenceModifierData modifier;
float white_value[3];
- float pad;
+ char _pad[4];
} WhiteBalanceModifierData;
typedef struct SequencerTonemapModifierData {
@@ -487,7 +533,7 @@ enum {
/* seq->alpha_mode */
enum {
SEQ_ALPHA_STRAIGHT = 0,
- SEQ_ALPHA_PREMUL = 1
+ SEQ_ALPHA_PREMUL = 1,
};
/* seq->type WATCH IT: SEQ_TYPE_EFFECT BIT is used to determine if this is an effect strip!!! */
@@ -542,7 +588,7 @@ enum {
SEQ_TYPE_DIFFERENCE = 59,
SEQ_TYPE_EXCLUSION = 60,
- SEQ_TYPE_MAX = 60
+ SEQ_TYPE_MAX = 60,
};
#define SEQ_MOVIECLIP_RENDER_UNDISTORTED (1 << 0)
@@ -569,7 +615,7 @@ enum {
seqModifierType_WhiteBalance = 6,
seqModifierType_Tonemap = 7,
- NUM_SEQUENCE_MODIFIER_TYPES
+ NUM_SEQUENCE_MODIFIER_TYPES,
};
/* SequenceModifierData->flag */
@@ -580,7 +626,7 @@ enum {
enum {
SEQUENCE_MASK_INPUT_STRIP = 0,
- SEQUENCE_MASK_INPUT_ID = 1
+ SEQUENCE_MASK_INPUT_ID = 1,
};
enum {
diff --git a/source/blender/makesdna/DNA_shader_fx_types.h b/source/blender/makesdna/DNA_shader_fx_types.h
index 7c138f21887..54922d78fae 100644
--- a/source/blender/makesdna/DNA_shader_fx_types.h
+++ b/source/blender/makesdna/DNA_shader_fx_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_shader_fx_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_SHADER_FX_TYPES_H__
@@ -67,14 +63,17 @@ typedef struct ShaderFxData {
int type, mode;
int stackindex;
short flag;
- short pad;
- char name[64]; /* MAX_NAME */
+ char _pad[2];
+ /** MAX_NAME. */
+ char name[64];
char *error;
} ShaderFxData;
/* Runtime temp data */
typedef struct ShaderFxData_Runtime {
+ float loc[3];
+ char _pad[4];
struct DRWShadingGroup *fx_sh;
struct DRWShadingGroup *fx_sh_b;
struct DRWShadingGroup *fx_sh_c;
@@ -83,17 +82,21 @@ typedef struct ShaderFxData_Runtime {
typedef struct BlurShaderFxData {
ShaderFxData shaderfx;
int radius[2];
- int flag; /* flags */
- int samples; /* number of samples */
- float coc; /* circle of confusion */
- int blur[2]; /* not visible in rna */
- char pad[4];
+ /** Flags. */
+ int flag;
+ /** Number of samples. */
+ int samples;
+ /** Circle of confusion. */
+ float coc;
+ /** Not visible in rna. */
+ int blur[2];
+ char _pad[4];
ShaderFxData_Runtime runtime;
} BlurShaderFxData;
typedef enum eBlurShaderFx_Flag {
- FX_BLUR_DOF_MODE = (1 << 0)
+ FX_BLUR_DOF_MODE = (1 << 0),
} eBlurShaderFx_Flag;
typedef struct ColorizeShaderFxData {
@@ -102,8 +105,9 @@ typedef struct ColorizeShaderFxData {
float low_color[4];
float high_color[4];
float factor;
- int flag; /* flags */
- char pad[4];
+ /** Flags. */
+ int flag;
+ char _pad[4];
ShaderFxData_Runtime runtime;
} ColorizeShaderFxData;
@@ -111,15 +115,17 @@ typedef struct ColorizeShaderFxData {
typedef enum ColorizeShaderFxModes {
eShaderFxColorizeMode_GrayScale = 0,
eShaderFxColorizeMode_Sepia = 1,
- eShaderFxColorizeMode_BiTone = 2,
+ eShaderFxColorizeMode_Duotone = 2,
eShaderFxColorizeMode_Custom = 3,
eShaderFxColorizeMode_Transparent = 4,
} ColorizeShaderFxModes;
typedef struct FlipShaderFxData {
ShaderFxData shaderfx;
- int flag; /* flags */
- int flipmode; /* internal, not visible in rna */
+ /** Flags. */
+ int flag;
+ /** Internal, not visible in rna. */
+ int flipmode;
ShaderFxData_Runtime runtime;
} FlipShaderFxData;
@@ -133,7 +139,8 @@ typedef struct GlowShaderFxData {
float glow_color[3];
float select_color[3];
float threshold;
- int flag; /* flags */
+ /** Flags. */
+ int flag;
int mode;
int blur[2];
int samples;
@@ -152,18 +159,22 @@ typedef enum eGlowShaderFx_Flag {
typedef struct LightShaderFxData {
ShaderFxData shaderfx;
struct Object *object;
- int flag; /* flags */
+ /** Flags. */
+ int flag;
float energy;
float ambient;
- float loc[4]; /* internal, not visible in rna */
- char pad[4];
+ /** Internal, not visible in rna. */
+ float loc[4];
+ char _pad[4];
ShaderFxData_Runtime runtime;
} LightShaderFxData;
typedef struct PixelShaderFxData {
ShaderFxData shaderfx;
- int size[3]; /* last element used for shader only */
- int flag; /* flags */
+ /** Last element used for shader only. */
+ int size[3];
+ /** Flags. */
+ int flag;
float rgba[4];
ShaderFxData_Runtime runtime;
} PixelShaderFxData;
@@ -175,13 +186,14 @@ typedef enum ePixelShaderFx_Flag {
typedef struct RimShaderFxData {
ShaderFxData shaderfx;
int offset[2];
- int flag; /* flags */
+ /** Flags. */
+ int flag;
float rim_rgb[3];
float mask_rgb[3];
int mode;
int blur[2];
int samples;
- char pad[4];
+ char _pad[4];
ShaderFxData_Runtime runtime;
} RimShaderFxData;
@@ -198,7 +210,8 @@ typedef struct ShadowShaderFxData {
ShaderFxData shaderfx;
struct Object *object;
int offset[2];
- int flag; /* flags */
+ /** Flags. */
+ int flag;
float shadow_rgba[4];
float amplitude;
float period;
@@ -208,7 +221,7 @@ typedef struct ShadowShaderFxData {
float rotation;
int blur[2];
int samples;
- char pad[4];
+ char _pad[4];
ShaderFxData_Runtime runtime;
} ShadowShaderFxData;
@@ -220,10 +233,12 @@ typedef enum eShadowShaderFx_Flag {
typedef struct SwirlShaderFxData {
ShaderFxData shaderfx;
struct Object *object;
- int flag; /* flags */
+ /** Flags. */
+ int flag;
int radius;
float angle;
- int transparent; /* not visible in rna */
+ /** Not visible in rna. */
+ int transparent;
ShaderFxData_Runtime runtime;
} SwirlShaderFxData;
@@ -237,8 +252,9 @@ typedef struct WaveShaderFxData {
float period;
float phase;
int orientation;
- int flag; /* flags */
- char pad[4];
+ /** Flags. */
+ int flag;
+ char _pad[4];
ShaderFxData_Runtime runtime;
} WaveShaderFxData;
#endif /* __DNA_SHADER_FX_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index 97913e29ad4..9f8d3449d39 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Daniel Genrich (Genscher)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_smoke_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_SMOKE_TYPES_H__
@@ -50,7 +42,7 @@ enum {
#define MOD_SMOKE_NOISEFFT (1<<1)
#define MOD_SMOKE_NOISECURL (1<<2)
/* viewsettings */
-#define MOD_SMOKE_VIEW_SHOWBIG (1<<0)
+#define MOD_SMOKE_VIEW_SHOW_HIGHRES (1<<0)
/* slice method */
enum {
@@ -132,7 +124,8 @@ enum {
};
typedef struct SmokeDomainSettings {
- struct SmokeModifierData *smd; /* for fast RNA access */
+ /** For fast RNA access. */
+ struct SmokeModifierData *smd;
struct FLUID_3D *fluid;
void *fluid_mutex;
struct Collection *fluid_group;
@@ -152,27 +145,48 @@ typedef struct SmokeDomainSettings {
float *shadow;
/* simulation data */
- float p0[3]; /* start point of BB in local space (includes sub-cell shift for adaptive domain)*/
- float p1[3]; /* end point of BB in local space */
- float dp0[3]; /* difference from object center to grid start point */
- float cell_size[3]; /* size of simulation cell in local space */
- float global_size[3]; /* global size of domain axises */
+ /** Start point of BB in local space (includes sub-cell shift for adaptive domain.)*/
+ float p0[3];
+ /** End point of BB in local space. */
+ float p1[3];
+ /** Difference from object center to grid start point. */
+ float dp0[3];
+ /** Size of simulation cell in local space. */
+ float cell_size[3];
+ /** Global size of domain axises. */
+ float global_size[3];
float prev_loc[3];
- int shift[3]; /* current domain shift in simulation cells */
- float shift_f[3]; /* exact domain shift */
- float obj_shift_f[3]; /* how much object has shifted since previous smoke frame (used to "lock" domain while drawing) */
- float imat[4][4]; /* domain object imat */
- float obmat[4][4]; /* domain obmat */
- float fluidmat[4][4]; /* low res fluid matrix */
- float fluidmat_wt[4][4]; /* high res fluid matrix */
-
- int base_res[3]; /* initial "non-adapted" resolution */
- int res_min[3]; /* cell min */
- int res_max[3]; /* cell max */
- int res[3]; /* data resolution (res_max-res_min) */
+ /** Current domain shift in simulation cells. */
+ int shift[3];
+ /** Exact domain shift. */
+ float shift_f[3];
+ /**
+ * How much object has shifted since previous smoke frame
+ * (used to "lock" domain while drawing).
+ */
+ float obj_shift_f[3];
+ /** Domain object imat. */
+ float imat[4][4];
+ /** Domain obmat. */
+ float obmat[4][4];
+ /** Low res fluid matrix. */
+ float fluidmat[4][4];
+ /** High res fluid matrix. */
+ float fluidmat_wt[4][4];
+
+ /** Initial "non-adapted" resolution. */
+ int base_res[3];
+ /** Cell min. */
+ int res_min[3];
+ /** Cell max. */
+ int res_max[3];
+ /** Data resolution (res_max-res_min). */
+ int res[3];
int total_cells;
- float dx; /* 1.0f / res */
- float scale; /* largest domain size */
+ /** 1.0f / res. */
+ float dx;
+ /** Largest domain size. */
+ float scale;
/* user settings */
int adapt_margin;
@@ -181,13 +195,18 @@ typedef struct SmokeDomainSettings {
float alpha;
float beta;
- int amplify; /* wavelet amplification */
- int maxres; /* longest axis on the BB gets this resolution assigned */
- int flags; /* show up-res or low res, etc */
+ /** Wavelet amplification. */
+ int amplify;
+ /** Longest axis on the BB gets this resolution assigned. */
+ int maxres;
+ /** Show up-res or low res, etc. */
+ int flags;
int viewsettings;
- short noise; /* noise type: wave, curl, anisotropic */
+ /** Noise type: wave, curl, anisotropic. */
+ short noise;
short diss_percent;
- int diss_speed;/* in frames */
+ /** In frames. */
+ int diss_speed;
float strength;
int res_wt[3];
float dx_wt;
@@ -198,17 +217,21 @@ typedef struct SmokeDomainSettings {
int openvdb_comp;
char cache_file_format;
char data_depth;
- char pad[2];
+ char _pad[2];
- /* Smoke uses only one cache from now on (index [0]), but keeping the array for now for reading old files. */
- struct PointCache *point_cache[2]; /* definition is in DNA_object_force_types.h */
+ /* Smoke uses only one cache from now on (index [0]),
+ * but keeping the array for now for reading old files. */
+ /** Definition is in DNA_object_force_types.h. */
+ struct PointCache *point_cache[2];
struct ListBase ptcaches[2];
struct EffectorWeights *effector_weights;
- int border_collisions; /* How domain border collisions are handled */
+ /** How domain border collisions are handled. */
+ int border_collisions;
float time_scale;
float vorticity;
int active_fields;
- float active_color[3]; /* monitor color situation of simulation */
+ /** Monitor color situation of simulation. */
+ float active_color[3];
int highres_sampling;
/* flame parameters */
@@ -227,11 +250,12 @@ typedef struct SmokeDomainSettings {
float vector_scale;
char vector_draw_type;
char use_coba;
- char coba_field; /* simulation field used for the color mapping */
+ /** Simulation field used for the color mapping. */
+ char coba_field;
char interp_method;
float clipping;
- float pad3;
+ char _pad3[4];
} SmokeDomainSettings;
@@ -252,19 +276,27 @@ typedef struct SmokeDomainSettings {
#define MOD_SMOKE_FLOW_TEXTURE_MAP_UV 1
/* flags */
-#define MOD_SMOKE_FLOW_ABSOLUTE (1<<1) /*old style emission*/
-#define MOD_SMOKE_FLOW_INITVELOCITY (1<<2) /* passes particles speed to the smoke */
-#define MOD_SMOKE_FLOW_TEXTUREEMIT (1<<3) /* use texture to control emission speed */
-#define MOD_SMOKE_FLOW_USE_PART_SIZE (1<<4) /* use specific size for particles instead of closest cell */
+enum {
+ /**old style emission*/
+ MOD_SMOKE_FLOW_ABSOLUTE = (1 << 1),
+ /** passes particles speed to the smoke */
+ MOD_SMOKE_FLOW_INITVELOCITY = (1 << 2),
+ /** use texture to control emission speed */
+ MOD_SMOKE_FLOW_TEXTUREEMIT = (1 << 3),
+ /** use specific size for particles instead of closest cell */
+ MOD_SMOKE_FLOW_USE_PART_SIZE = (1 << 4),
+};
typedef struct SmokeFlowSettings {
- struct SmokeModifierData *smd; /* for fast RNA access */
+ /** For fast RNA access. */
+ struct SmokeModifierData *smd;
struct Mesh *mesh;
struct ParticleSystem *psys;
struct Tex *noise_texture;
/* initial velocity */
- float *verts_old; /* previous vertex positions in domain space */
+ /** Previous vertex positions in domain space. */
+ float *verts_old;
int numverts;
float vel_multi; // Multiplier for inherited velocity
float vel_normal;
@@ -273,22 +305,28 @@ typedef struct SmokeFlowSettings {
float density;
float color[3];
float fuel_amount;
- float temp; /* delta temperature (temp - ambient temp) */
- float volume_density; /* density emitted within mesh volume */
- float surface_distance; /* maximum emission distance from mesh surface */
+ /** Delta temperature (temp - ambient temp). */
+ float temp;
+ /** Density emitted within mesh volume. */
+ float volume_density;
+ /** Maximum emission distance from mesh surface. */
+ float surface_distance;
float particle_size;
int subframes;
/* texture control */
float texture_size;
float texture_offset;
- int pad;
- char uvlayer_name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ char _pad[4];
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char uvlayer_name[64];
short vgroup_density;
- short type; /* smoke, flames, both, outflow */
+ /** Smoke, flames, both, outflow. */
+ short type;
short source;
short texture_type;
- int flags; /* absolute emission etc*/
+ /** Absolute emission et.c*/
+ int flags;
} SmokeFlowSettings;
@@ -298,12 +336,13 @@ typedef struct SmokeFlowSettings {
/* collision objects (filled with smoke) */
typedef struct SmokeCollSettings {
- struct SmokeModifierData *smd; /* for fast RNA access */
+ /** For fast RNA access. */
+ struct SmokeModifierData *smd;
struct Mesh *mesh;
float *verts_old;
int numverts;
short type; // static = 0, rigid = 1, dynamic = 2
- short pad;
+ char _pad[2];
} SmokeCollSettings;
#endif
diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h
index 02d3aa928c7..d17852312d0 100644
--- a/source/blender/makesdna/DNA_sound_types.h
+++ b/source/blender/makesdna/DNA_sound_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,9 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_sound_types.h
- * \ingroup DNA
- * \since mar-2001
- * \author nzc
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_SOUND_TYPES_H__
@@ -48,7 +38,8 @@ typedef struct bSound {
/**
* The path to the sound file.
*/
- char name[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char name[1024];
/**
* The packed file.
@@ -73,8 +64,9 @@ typedef struct bSound {
float max_gain;
float distance;
short flags;
- short tags; /* Runtime only, always reset in readfile. */
- int pad;
+ /** Runtime only, always reset in readfile. */
+ short tags;
+ char _pad[4];
/* unused currently
int type;
@@ -96,7 +88,7 @@ typedef struct bSound {
*/
void *playback_handle;
- /* spinlock for asynchronous loading of sounds */
+ /** Spinlock for asynchronous loading of sounds. */
void *spinlock;
/* XXX unused currently (SOUND_TYPE_LIMITER) */
/* float start, end; */
@@ -108,7 +100,7 @@ typedef enum eSound_Type {
SOUND_TYPE_INVALID = -1,
SOUND_TYPE_FILE = 0,
SOUND_TYPE_BUFFER = 1,
- SOUND_TYPE_LIMITER = 2
+ SOUND_TYPE_LIMITER = 2,
} eSound_Type;
#endif
@@ -121,7 +113,8 @@ enum {
/* bSound->flags */
enum {
#ifdef DNA_DEPRECATED
- SOUND_FLAGS_3D = (1 << 3), /* deprecated! used for sound actuator loading */
+ /* deprecated! used for sound actuator loading */
+ SOUND_FLAGS_3D = (1 << 3),
#endif
SOUND_FLAGS_CACHING = (1 << 4),
SOUND_FLAGS_MONO = (1 << 5),
@@ -129,7 +122,8 @@ enum {
/* bSound->tags */
enum {
- SOUND_TAGS_WAVEFORM_NO_RELOAD = 1 << 0, /* Do not free/reset waveform on sound load, only used by undo code. */
+ /* Do not free/reset waveform on sound load, only used by undo code. */
+ SOUND_TAGS_WAVEFORM_NO_RELOAD = 1 << 0,
SOUND_TAGS_WAVEFORM_LOADING = (1 << 6),
};
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index ca89cf11441..afe80edfdd3 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,9 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_space_types.h
- * \ingroup DNA
- * \since mar-2001
- * \author nzc
+/** \file
+ * \ingroup DNA
*
* Structs for each of space type in the user interface.
*/
@@ -47,25 +37,25 @@
/* Hum ... Not really nice... but needed for spacebuts. */
#include "DNA_view2d_types.h"
+struct BLI_mempool;
+struct FileLayout;
+struct FileList;
+struct FileSelectParams;
+struct Histogram;
struct ID;
-struct Text;
-struct Script;
struct Image;
+struct Mask;
+struct MovieClip;
+struct MovieClipScopes;
struct Scopes;
-struct Histogram;
-struct SpaceIpo;
-struct bNodeTree;
-struct FileList;
-struct bGPdata;
+struct Script;
+struct SpaceGraph;
+struct Text;
struct bDopeSheet;
-struct FileSelectParams;
-struct FileLayout;
+struct bGPdata;
+struct bNodeTree;
struct wmOperator;
struct wmTimer;
-struct MovieClip;
-struct MovieClipScopes;
-struct Mask;
-struct BLI_mempool;
/* TODO 2.8: We don't write the global areas to files currently. Uncomment
* define to enable writing (should become the default in a bit). */
@@ -83,7 +73,8 @@ struct BLI_mempool;
*/
typedef struct SpaceLink {
struct SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
@@ -98,14 +89,15 @@ typedef struct SpaceLink {
/* Info Header */
typedef struct SpaceInfo {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
/* End 'SpaceLink' header. */
char rpt_mask;
- char pad[7];
+ char _pad[7];
} SpaceInfo;
/* SpaceInfo.rpt_mask */
@@ -124,36 +116,41 @@ typedef enum eSpaceInfo_RptMask {
* \{ */
/* Properties Editor */
-typedef struct SpaceButs {
+typedef struct SpaceProperties {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
/* End 'SpaceLink' header. */
- View2D v2d DNA_DEPRECATED; /* deprecated, copied to region */
+ /** Deprecated, copied to region. */
+ View2D v2d DNA_DEPRECATED;
/* For different kinds of property editors (exposed in the space type selector). */
short space_subtype;
- short mainb, mainbo, mainbuser; /* context tabs */
- short preview; /* preview is signal to refresh */
- short pad[2];
+ /** Context tabs. */
+ short mainb, mainbo, mainbuser;
+ /** Preview is signal to refresh. */
+ short preview;
+ char _pad[5];
char flag;
- char collection_context;
- void *path; /* runtime */
- int pathflag, dataicon; /* runtime */
+ /** Runtime. */
+ void *path;
+ /** Runtime. */
+ int pathflag, dataicon;
ID *pinid;
void *texuser;
-} SpaceButs;
+} SpaceProperties;
/* button defines (deprecated) */
#ifdef DNA_DEPRECATED_ALLOW
-/* warning: the values of these defines are used in SpaceButs.tabs[8] */
-/* SpaceButs.mainb new */
+/* warning: the values of these defines are used in SpaceProperties.tabs[8] */
+/* SpaceProperties.mainb new */
#define CONTEXT_SCENE 0
#define CONTEXT_OBJECT 1
// #define CONTEXT_TYPES 2
@@ -162,7 +159,7 @@ typedef struct SpaceButs {
// #define CONTEXT_SCRIPT 5
// #define CONTEXT_LOGIC 6
-/* SpaceButs.mainb old (deprecated) */
+/* SpaceProperties.mainb old (deprecated) */
// #define BUTS_VIEW 0
#define BUTS_LAMP 1
#define BUTS_MAT 2
@@ -180,7 +177,7 @@ typedef struct SpaceButs {
// #define BUTS_EFFECTS 14
#endif /* DNA_DEPRECATED_ALLOW */
-/* SpaceButs.mainb new */
+/* SpaceProperties.mainb new */
typedef enum eSpaceButtons_Context {
BCONTEXT_RENDER = 0,
BCONTEXT_SCENE = 1,
@@ -204,13 +201,14 @@ typedef enum eSpaceButtons_Context {
BCONTEXT_TOT
} eSpaceButtons_Context;
-/* SpaceButs.flag */
+/* SpaceProperties.flag */
typedef enum eSpaceButtons_Flag {
SB_PRV_OSA = (1 << 0),
SB_PIN_CONTEXT = (1 << 1),
SB_FLAG_DEPRECATED_2 = (1 << 2),
SB_FLAG_DEPRECATED_3 = (1 << 3),
- SB_TEX_USER_LIMITED = (1 << 3), /* Do not add materials, particles, etc. in TemplateTextureUser list. */
+ /** Do not add materials, particles, etc. in TemplateTextureUser list. */
+ SB_TEX_USER_LIMITED = (1 << 3),
SB_SHADING_CONTEXT = (1 << 4),
} eSpaceButtons_Flag;
@@ -221,15 +219,17 @@ typedef enum eSpaceButtons_Flag {
* \{ */
/* Outliner */
-typedef struct SpaceOops {
+typedef struct SpaceOutliner {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
/* End 'SpaceLink' header. */
- View2D v2d DNA_DEPRECATED; /* deprecated, copied to region */
+ /** Deprecated, copied to region. */
+ View2D v2d DNA_DEPRECATED;
ListBase tree;
@@ -248,15 +248,17 @@ typedef struct SpaceOops {
short flag, outlinevis, storeflag, search_flags;
int filter;
char filter_state;
- char pad;
+ char _pad;
short filter_id_type;
- /* pointers to treestore elements, grouped by (id, type, nr) in hashtable for faster searching */
+ /**
+ * Pointers to treestore elements, grouped by (id, type, nr)
+ * in hashtable for faster searching */
void *treehash;
-} SpaceOops;
+} SpaceOutliner;
-/* SpaceOops.flag */
+/* SpaceOutliner.flag */
typedef enum eSpaceOutliner_Flag {
SO_TESTBLOCKS = (1 << 0),
SO_NEWSELECTED = (1 << 1),
@@ -265,7 +267,7 @@ typedef enum eSpaceOutliner_Flag {
SO_SKIP_SORT_ALPHA = (1 << 4),
} eSpaceOutliner_Flag;
-/* SpaceOops.filter */
+/* SpaceOutliner.filter */
typedef enum eSpaceOutliner_Filter {
SO_FILTER_SEARCH = (1 << 0), /* Run-time flag. */
SO_FILTER_DEPRECATED_1 = (1 << 1), /* cleared */
@@ -307,7 +309,7 @@ typedef enum eSpaceOutliner_Filter {
SO_FILTER_OB_STATE | \
SO_FILTER_NO_COLLECTION)
-/* SpaceOops.filter_state */
+/* SpaceOutliner.filter_state */
typedef enum eSpaceOutliner_StateFilter {
SO_FILTER_OB_ALL = 0,
SO_FILTER_OB_VISIBLE = 1,
@@ -315,7 +317,7 @@ typedef enum eSpaceOutliner_StateFilter {
SO_FILTER_OB_ACTIVE = 3,
} eSpaceOutliner_StateFilter;
-/* SpaceOops.outlinevis */
+/* SpaceOutliner.outlinevis */
typedef enum eSpaceOutliner_Mode {
SO_SCENES = 0,
/* SO_CUR_SCENE = 1, */ /* deprecated! */
@@ -335,7 +337,7 @@ typedef enum eSpaceOutliner_Mode {
SO_VIEW_LAYER = 15,
} eSpaceOutliner_Mode;
-/* SpaceOops.storeflag */
+/* SpaceOutliner.storeflag */
typedef enum eSpaceOutliner_StoreFlag {
/* cleanup tree */
SO_TREESTORE_CLEANUP = (1 << 0),
@@ -345,7 +347,7 @@ typedef enum eSpaceOutliner_StoreFlag {
SO_TREESTORE_REBUILD = (1 << 2),
} eSpaceOutliner_StoreFlag;
-/* outliner search flags (SpaceOops.search_flags) */
+/* outliner search flags (SpaceOutliner.search_flags) */
typedef enum eSpaceOutliner_Search_Flags {
SO_FIND_CASE_SENSITIVE = (1 << 0),
SO_FIND_COMPLETE = (1 << 1),
@@ -358,41 +360,54 @@ typedef enum eSpaceOutliner_Search_Flags {
/** \name Graph Editor
* \{ */
-typedef struct SpaceIpo_Runtime {
+typedef struct SpaceGraph_Runtime {
/** #eGraphEdit_Runtime_Flag */
char flag;
char _pad[7];
/** Sampled snapshots of F-Curves used as in-session guides */
ListBase ghost_curves;
-} SpaceIpo_Runtime;
+} SpaceGraph_Runtime;
/* 'Graph' Editor (formerly known as the IPO Editor) */
-typedef struct SpaceIpo {
+typedef struct SpaceGraph {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
/* End 'SpaceLink' header. */
- View2D v2d DNA_DEPRECATED; /* deprecated, copied to region */
+ /** Deprecated, copied to region. */
+ View2D v2d DNA_DEPRECATED;
- struct bDopeSheet *ads; /* settings for filtering animation data (NOTE: we use a pointer due to code-linking issues) */
+ /** Settings for filtering animation data
+ * \note we use a pointer due to code-linking issues. */
+ struct bDopeSheet *ads;
- short mode; /* mode for the Graph editor (eGraphEdit_Mode) */
- short autosnap; /* time-transform autosnapping settings for Graph editor (eAnimEdit_AutoSnap in DNA_action_types.h) */
- int flag; /* settings for Graph editor (eGraphEdit_Flag) */
+ /** Mode for the Graph editor (eGraphEdit_Mode). */
+ short mode;
+ /**
+ * Time-transform autosnapping settings for Graph editor
+ * (eAnimEdit_AutoSnap in DNA_action_types.h).
+ */
+ short autosnap;
+ /** Settings for Graph editor (eGraphEdit_Flag). */
+ int flag;
- float cursorTime; /* time value for cursor (when in drivers mode; animation uses current frame) */
- float cursorVal; /* cursor value (y-value, x-value is current frame) */
- int around; /* pivot point for transforms */
- int pad;
+ /** Time value for cursor (when in drivers mode; animation uses current frame). */
+ float cursorTime;
+ /** Cursor value (y-value, x-value is current frame). */
+ float cursorVal;
+ /** Pivot point for transforms. */
+ int around;
+ char _pad[4];
- SpaceIpo_Runtime runtime;
-} SpaceIpo;
+ SpaceGraph_Runtime runtime;
+} SpaceGraph;
-/* SpaceIpo.flag (Graph Editor Settings) */
+/* SpaceGraph.flag (Graph Editor Settings) */
typedef enum eGraphEdit_Flag {
/* OLD DEPRECEATED SETTING */
/* SIPO_LOCK_VIEW = (1 << 0), */
@@ -425,9 +440,11 @@ typedef enum eGraphEdit_Flag {
/* normalize curves on display */
SIPO_NORMALIZE = (1 << 14),
SIPO_NORMALIZE_FREEZE = (1 << 15),
+ /* show vertical line for every marker */
+ SIPO_MARKER_LINES = (1 << 16),
} eGraphEdit_Flag;
-/* SpaceIpo.mode (Graph Editor Mode) */
+/* SpaceGraph.mode (Graph Editor Mode) */
typedef enum eGraphEdit_Mode {
/* all animation curves (from all over Blender) */
SIPO_MODE_ANIMATION = 0,
@@ -451,18 +468,21 @@ typedef enum eGraphEdit_Runtime_Flag {
/* NLA Editor */
typedef struct SpaceNla {
struct SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
/* End 'SpaceLink' header. */
- short autosnap; /* this uses the same settings as autosnap for Action Editor */
+ /** This uses the same settings as autosnap for Action Editor. */
+ short autosnap;
short flag;
- int pad;
+ char _pad[4];
struct bDopeSheet *ads;
- View2D v2d DNA_DEPRECATED; /* deprecated, copied to region */
+ /** Deprecated, copied to region. */
+ View2D v2d DNA_DEPRECATED;
} SpaceNla;
/* SpaceNla.flag */
@@ -480,68 +500,59 @@ typedef enum eSpaceNla_Flag {
SNLA_NOREALTIMEUPDATES = (1 << 6),
/* don't show local strip marker indications */
SNLA_NOLOCALMARKERS = (1 << 7),
+ /* show vertical line for every marker */
+ SNLA_SHOW_MARKER_LINES = (1 << 8),
} eSpaceNla_Flag;
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Timeline
- * \{ */
-
-/* SpaceTime.redraws (now bScreen.redraws_flag) */
-typedef enum eScreen_Redraws_Flag {
- TIME_REGION = (1 << 0),
- TIME_ALL_3D_WIN = (1 << 1),
- TIME_ALL_ANIM_WIN = (1 << 2),
- TIME_ALL_BUTS_WIN = (1 << 3),
- // TIME_WITH_SEQ_AUDIO = (1 << 4), /* DEPRECATED */
- TIME_SEQ = (1 << 5),
- TIME_ALL_IMAGE_WIN = (1 << 6),
- // TIME_CONTINUE_PHYSICS = (1 << 7), /* UNUSED */
- TIME_NODES = (1 << 8),
- TIME_CLIPS = (1 << 9),
-
- TIME_FOLLOW = (1 << 15),
-} eScreen_Redraws_Flag;
-
-/** \} */
-
-/* -------------------------------------------------------------------- */
/** \name Sequence Editor
* \{ */
/* Sequencer */
typedef struct SpaceSeq {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
/* End 'SpaceLink' header. */
- View2D v2d DNA_DEPRECATED; /* deprecated, copied to region */
+ /** Deprecated, copied to region. */
+ View2D v2d DNA_DEPRECATED;
- float xof DNA_DEPRECATED, yof DNA_DEPRECATED; /* deprecated: offset for drawing the image preview */
- short mainb; /* weird name for the sequencer subtype (seq, image, luma... etc) */
- short render_size; /* eSpaceSeq_Proxy_RenderSize */
+ /** Deprecated: offset for drawing the image preview. */
+ float xof DNA_DEPRECATED, yof DNA_DEPRECATED;
+ /** Weird name for the sequencer subtype (seq, image, luma... etc). */
+ short mainb;
+ /** ESpaceSeq_Proxy_RenderSize. */
+ short render_size;
short chanshown;
short zebra;
int flag;
- float zoom DNA_DEPRECATED; /* deprecated, handled by View2D now */
- int view; /* see SEQ_VIEW_* below */
+ /** Deprecated, handled by View2D now. */
+ float zoom DNA_DEPRECATED;
+ /** See SEQ_VIEW_* below. */
+ int view;
int overlay_type;
- int draw_flag; /* overlay an image of the editing on below the strips */
- int pad;
+ /** Overlay an image of the editing on below the strips. */
+ int draw_flag;
+ char _pad[4];
- struct bGPdata *gpd; /* grease-pencil data */
+ /** Grease-pencil data. */
+ struct bGPdata *gpd;
- struct SequencerScopes scopes; /* different scoped displayed in space */
+ /** Different scoped displayed in space. */
+ struct SequencerScopes scopes;
- char multiview_eye; /* multiview current eye - for internal use */
- char pad2[7];
+ /** Multiview current eye - for internal use. */
+ char multiview_eye;
+ char _pad2[7];
struct GPUFX *compositor;
- void *pad3;
+ void *_pad3;
} SpaceSeq;
@@ -574,6 +585,7 @@ typedef enum eSpaceSeq_Flag {
SEQ_NO_WAVEFORMS = (1 << 8), /* draw no waveforms */
SEQ_SHOW_SAFE_CENTER = (1 << 9),
SEQ_SHOW_METADATA = (1 << 10),
+ SEQ_SHOW_MARKER_LINES = (1 << 11),
} eSpaceSeq_Flag;
/* SpaceSeq.view */
@@ -591,7 +603,7 @@ typedef enum eSpaceSeq_Proxy_RenderSize {
SEQ_PROXY_RENDER_SIZE_50 = 50,
SEQ_PROXY_RENDER_SIZE_75 = 75,
SEQ_PROXY_RENDER_SIZE_100 = 99,
- SEQ_PROXY_RENDER_SIZE_FULL = 100
+ SEQ_PROXY_RENDER_SIZE_FULL = 100,
} eSpaceSeq_Proxy_RenderSize;
typedef struct MaskSpaceInfo {
@@ -601,14 +613,14 @@ typedef struct MaskSpaceInfo {
char draw_flag;
char draw_type;
char overlay_mode;
- char pad3[5];
+ char _pad3[5];
} MaskSpaceInfo;
/* SpaceSeq.mainb */
typedef enum eSpaceSeq_OverlayType {
SEQ_DRAW_OVERLAY_RECT = 0,
SEQ_DRAW_OVERLAY_REFERENCE = 1,
- SEQ_DRAW_OVERLAY_CURRENT = 2
+ SEQ_DRAW_OVERLAY_CURRENT = 2,
} eSpaceSeq_OverlayType;
/** \} */
@@ -619,38 +631,55 @@ typedef enum eSpaceSeq_OverlayType {
/* Config and Input for File Selector */
typedef struct FileSelectParams {
- char title[96]; /* title, also used for the text of the execute button */
- char dir[1090]; /* directory, FILE_MAX_LIBEXTRA, 1024 + 66, this is for extreme case when 1023 length path
- * needs to be linked in, where foo.blend/Armature need adding */
- char pad_c1[2];
- char file[256]; /* file */
+ /** Title, also used for the text of the execute button. */
+ char title[96];
+ /**
+ * Directory, FILE_MAX_LIBEXTRA, 1024 + 66, this is for extreme case when 1023 length path
+ * needs to be linked in, where foo.blend/Armature need adding
+ */
+ char dir[1090];
+ char file[256];
+
char renamefile[256];
- char renameedit[256]; /* annoying but the first is only used for initialization */
+ short rename_flag;
- char filter_glob[256]; /* FILE_MAXFILE */ /* list of filetypes to filter */
+ /** List of filetypes to filter (FILE_MAXFILE). */
+ char filter_glob[256];
- char filter_search[64]; /* text items' name must match to be shown. */
- int filter_id; /* same as filter, but for ID types (aka library groups). */
+ /** Text items name must match to be shown. */
+ char filter_search[64];
+ /** Same as filter, but for ID types (aka library groups). */
+ int filter_id;
- int active_file; /* active file used for keyboard navigation */
- int highlight_file; /* file under cursor */
+ /** Active file used for keyboard navigation. */
+ int active_file;
+ /** File under cursor. */
+ int highlight_file;
int sel_first;
int sel_last;
unsigned short thumbnail_size;
- short pad;
+ char _pad1[2];
/* short */
- short type; /* XXXXX for now store type here, should be moved to the operator */
- short flag; /* settings for filter, hiding dots files,... */
- short sort; /* sort order */
- short display; /* display mode flag */
- int filter; /* filter when (flags & FILE_FILTER) is true */
+ /** XXXXX for now store type here, should be moved to the operator. */
+ short type;
+ /** Settings for filter, hiding dots files. */
+ short flag;
+ /** Sort order. */
+ short sort;
+ /** Display mode flag. */
+ short display;
+ /** Filter when (flags & FILE_FILTER) is true. */
+ int filter;
- short recursion_level; /* max number of levels in dirtree to show at once, 0 to disable recursion. */
+ /** Max number of levels in dirtree to show at once, 0 to disable recursion. */
+ short recursion_level;
/* XXX --- still unused -- */
- short f_fp; /* show font preview */
- char fp_str[8]; /* string to use for font preview */
+ /** Show font preview. */
+ short f_fp;
+ /** String to use for font preview. */
+ char fp_str[8];
/* XXX --- end unused -- */
} FileSelectParams;
@@ -658,7 +687,8 @@ typedef struct FileSelectParams {
/* File Browser */
typedef struct SpaceFile {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
@@ -667,12 +697,16 @@ typedef struct SpaceFile {
char _pad1[4];
int scroll_offset;
- struct FileSelectParams *params; /* config and input for file select */
+ /** Config and input for file select. */
+ struct FileSelectParams *params;
- struct FileList *files; /* holds the list of files to show */
+ /** Holds the list of files to show. */
+ struct FileList *files;
- ListBase *folders_prev; /* holds the list of previous directories to show */
- ListBase *folders_next; /* holds the list of next directories (pushed from previous) to show */
+ /** Holds the list of previous directories to show. */
+ ListBase *folders_prev;
+ /** Holds the list of next directories (pushed from previous) to show. */
+ ListBase *folders_next;
/* operator that is invoking fileselect
* op->exec() will be called on the 'Load' button.
@@ -695,7 +729,7 @@ enum eFileDisplayType {
FILE_DEFAULTDISPLAY = 0,
FILE_SHORTDISPLAY = 1,
FILE_LONGDISPLAY = 2,
- FILE_IMGDISPLAY = 3
+ FILE_IMGDISPLAY = 3,
};
/* FileSelectParams.sort */
@@ -704,7 +738,7 @@ enum eFileSortType {
FILE_SORT_ALPHA = 1,
FILE_SORT_EXTENSION = 2,
FILE_SORT_TIME = 3,
- FILE_SORT_SIZE = 4
+ FILE_SORT_SIZE = 4,
};
/* these values need to be hardcoded in structs, dna does not recognize defines */
@@ -722,7 +756,6 @@ enum eFileSortType {
#define FILE_LOADLIB 1
#define FILE_MAIN 2
-#define FILE_LOADFONT 3
/* filesel op property -> action */
typedef enum eFileSel_Action {
@@ -747,6 +780,18 @@ typedef enum eFileSel_Params_Flag {
FILE_GROUP_INSTANCE = (1 << 10),
} eFileSel_Params_Flag;
+/* sfile->params->rename_flag */
+/* Note: short flag. Defined as bitflags, but currently only used as exclusive status markers... */
+typedef enum eFileSel_Params_RenameFlag {
+ /* Used when we only have the name of the entry we want to rename, but not yet access to its matching file entry. */
+ FILE_PARAMS_RENAME_PENDING = 1 << 0,
+ /* We are actually renaming an entry. */
+ FILE_PARAMS_RENAME_ACTIVE = 1 << 1,
+ /* Used to scroll to newly renamed entry. */
+ FILE_PARAMS_RENAME_POSTSCROLL_PENDING = 1 << 2,
+ FILE_PARAMS_RENAME_POSTSCROLL_ACTIVE = 1 << 3,
+} eFileSel_Params_RenameFlag;
+
/* files in filesel list: file types
* Note we could use mere values (instead of bitflags) for file types themselves,
* but since we do not lack of bytes currently...
@@ -761,14 +806,17 @@ typedef enum eFileSel_File_Types {
FILE_TYPE_SOUND = (1 << 8),
FILE_TYPE_TEXT = (1 << 9),
/* 1 << 10 was FILE_TYPE_MOVIE_ICON, got rid of this so free slot for future type... */
- FILE_TYPE_FOLDER = (1 << 11), /* represents folders for filtering */
+ /** represents folders for filtering */
+ FILE_TYPE_FOLDER = (1 << 11),
FILE_TYPE_BTX = (1 << 12),
FILE_TYPE_COLLADA = (1 << 13),
- FILE_TYPE_OPERATOR = (1 << 14), /* from filter_glob operator property */
+ /** from filter_glob operator property */
+ FILE_TYPE_OPERATOR = (1 << 14),
FILE_TYPE_APPLICATIONBUNDLE = (1 << 15),
FILE_TYPE_ALEMBIC = (1 << 16),
- FILE_TYPE_DIR = (1 << 30), /* An FS directory (i.e. S_ISDIR on its path is true). */
+ /** An FS directory (i.e. S_ISDIR on its path is true). */
+ FILE_TYPE_DIR = (1 << 30),
FILE_TYPE_BLENDERLIB = (1u << 31),
} eFileSel_File_Types;
@@ -780,8 +828,6 @@ typedef enum eDirEntry_SelectFlag {
FILE_SEL_EDITING = (1 << 4),
} eDirEntry_SelectFlag;
-#define FILE_LIST_MAX_RECURSION 4
-
/* ***** Related to file browser, but never saved in DNA, only here to help with RNA. ***** */
/* About Unique identifier.
@@ -793,23 +839,30 @@ typedef enum eDirEntry_SelectFlag {
#define ASSET_UUID_LENGTH 16
/* Used to communicate with asset engines outside of 'import' context. */
+#
+#
typedef struct AssetUUID {
int uuid_asset[4];
int uuid_variant[4];
int uuid_revision[4];
} AssetUUID;
+#
+#
typedef struct AssetUUIDList {
AssetUUID *uuids;
- int nbr_uuids, pad;
+ int nbr_uuids;
+ char _pad[4];
} AssetUUIDList;
/* Container for a revision, only relevant in asset context. */
+#
+#
typedef struct FileDirEntryRevision {
struct FileDirEntryRevision *next, *prev;
char *comment;
- void *pad;
+ void *_pad;
int uuid[4];
@@ -823,6 +876,8 @@ typedef struct FileDirEntryRevision {
/* Container for a variant, only relevant in asset context.
* In case there are no variants, a single one shall exist, with NULL name/description. */
+#
+#
typedef struct FileDirEntryVariant {
struct FileDirEntryVariant *next, *prev;
@@ -836,6 +891,8 @@ typedef struct FileDirEntryVariant {
} FileDirEntryVariant;
/* Container for mere direntry, with additional asset-related data. */
+#
+#
typedef struct FileDirEntry {
struct FileDirEntry *next, *prev;
@@ -843,15 +900,19 @@ typedef struct FileDirEntry {
char *name;
char *description;
- /* Either point to active variant/revision if available, or own entry (in mere filebrowser case). */
+ /* Either point to active variant/revision if available, or own entry
+ * (in mere filebrowser case). */
FileDirEntryRevision *entry;
- int typeflag; /* eFileSel_File_Types */
- int blentype; /* ID type, in case typeflag has FILE_TYPE_BLENDERLIB set. */
+ /** #eFileSel_File_Types. */
+ int typeflag;
+ /** ID type, in case typeflag has FILE_TYPE_BLENDERLIB set. */
+ int blentype;
char *relpath;
- void *poin; /* TODO: make this a real ID pointer? */
+ /** TODO: make this a real ID pointer? */
+ void *poin;
struct ImBuf *image;
/* Tags are for info only, most of filtering is done in asset engine. */
@@ -873,13 +934,16 @@ typedef struct FileDirEntry {
* In AssetEngine context (i.e. outside of 'browsing' context), entries contain all needed data, there is no filtering,
* so nbr_entries_filtered, entry_idx_start and entry_idx_end should all be set to -1.
*/
+#
+#
typedef struct FileDirEntryArr {
ListBase entries;
int nbr_entries;
int nbr_entries_filtered;
int entry_idx_start, entry_idx_end;
- char root[1024]; /* FILE_MAX */
+ /** FILE_MAX. */
+ char root[1024];
} FileDirEntryArr;
/* FileDirEntry.status */
@@ -902,7 +966,8 @@ enum {
/* Image/UV Editor */
typedef struct SpaceImage {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
@@ -911,33 +976,48 @@ typedef struct SpaceImage {
struct Image *image;
struct ImageUser iuser;
- struct Scopes scopes; /* histogram waveform and vectorscope */
- struct Histogram sample_line_hist; /* sample line histogram */
-
- struct bGPdata *gpd; /* grease pencil data */
-
- float cursor[2]; /* UV editor 2d cursor */
- float xof, yof; /* user defined offset, image is centered */
- float zoom; /* user defined zoom level */
- float centx, centy; /* storage for offset while render drawing */
-
- char mode; /* view/paint/mask */
+ /** Histogram waveform and vectorscope. */
+ struct Scopes scopes;
+ /** Sample line histogram. */
+ struct Histogram sample_line_hist;
+
+ /** Grease pencil data. */
+ struct bGPdata *gpd;
+
+ /** UV editor 2d cursor. */
+ float cursor[2];
+ /** User defined offset, image is centered. */
+ float xof, yof;
+ /** User defined zoom level. */
+ float zoom;
+ /** Storage for offset while render drawing. */
+ float centx, centy;
+
+ /** View/paint/mask. */
+ char mode;
/* Storage for sub-space types. */
char mode_prev;
char pin;
- char _pad;
- short curtile; /* the currently active tile of the image when tile is enabled, is kept in sync with the active faces tile */
+ char _pad1;
+ /**
+ * The currently active tile of the image when tile is enabled,
+ * is kept in sync with the active faces tile.
+ */
+ short curtile;
short lock;
- char dt_uv; /* UV draw type */
- char sticky; /* sticky selection type */
+ /** UV draw type. */
+ char dt_uv;
+ /** Sticky selection type. */
+ char sticky;
char dt_uvstretch;
char around;
- int pad2;
-
int flag;
+ char pixel_snap_mode;
+ char _pad2[3];
+
MaskSpaceInfo mask_info;
} SpaceImage;
@@ -956,6 +1036,13 @@ typedef enum eSpaceImage_UVDT_Stretch {
SI_UVDT_STRETCH_AREA = 1,
} eSpaceImage_UVDT_Stretch;
+/* SpaceImage.pixel_snap_mode */
+typedef enum eSpaceImage_PixelSnapMode {
+ SI_PIXEL_SNAP_DISABLED = 0,
+ SI_PIXEL_SNAP_CENTER = 1,
+ SI_PIXEL_SNAP_CORNER = 2,
+} eSpaceImage_Snap_Mode;
+
/* SpaceImage.mode */
typedef enum eSpaceImage_Mode {
SI_MODE_VIEW = 0,
@@ -985,7 +1072,7 @@ typedef enum eSpaceImage_Flag {
SI_FLAG_DEPRECATED_7 = (1 << 7), /* cleared */
SI_FLAG_DEPRECATED_8 = (1 << 8), /* cleared */
SI_COORDFLOATS = (1 << 9),
- SI_PIXELSNAP = (1 << 10),
+ SI_FLAG_DEPRECATED_10 = (1 << 10),
SI_LIVE_UNWRAP = (1 << 11),
SI_USE_ALPHA = (1 << 12),
SI_SHOW_ALPHA = (1 << 13),
@@ -1034,7 +1121,8 @@ typedef enum eSpaceImage_OtherUVFilter {
/* Text Editor */
typedef struct SpaceText {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
@@ -1045,8 +1133,13 @@ typedef struct SpaceText {
int top, viewlines;
short flags, menunr;
- short lheight; /* user preference, is font_size! */
- char cwidth, linenrs_tot; /* runtime computed, character width and the number of chars to use when showing line numbers */
+ /** User preference, is font_size! */
+ short lheight;
+ /**
+ * Runtime computed, character width
+ * and the number of chars to use when showing line numbers.
+ */
+ char cwidth, linenrs_tot;
int left;
int showlinenrs;
int tabnumber;
@@ -1054,23 +1147,30 @@ typedef struct SpaceText {
short showsyntax;
short line_hlight;
short overwrite;
- short live_edit; /* run python while editing, evil */
+ /** Run python while editing, evil. */
+ short live_edit;
float pix_per_line;
struct rcti txtscroll, txtbar;
int wordwrap, doplugins;
- char findstr[256]; /* ST_MAX_FIND_STR */
- char replacestr[256]; /* ST_MAX_FIND_STR */
+ /** ST_MAX_FIND_STR. */
+ char findstr[256];
+ /** ST_MAX_FIND_STR. */
+ char replacestr[256];
- short margin_column; /* column number to show right margin at */
- short lheight_dpi; /* actual lineheight, dpi controlled */
- char pad[4];
+ /** Column number to show right margin at. */
+ short margin_column;
+ /** Actual lineheight, dpi controlled. */
+ short lheight_dpi;
+ char _pad[4];
- void *drawcache; /* cache for faster drawing */
+ /** Cache for faster drawing. */
+ void *drawcache;
- float scroll_accum[2]; /* runtime, for scroll increments smaller than a line */
+ /** Runtime, for scroll increments smaller than a line. */
+ float scroll_accum[2];
} SpaceText;
@@ -1109,16 +1209,22 @@ typedef struct Script {
void *py_globaldict;
int flags, lastspace;
- /* store the script file here so we can re-run it on loading blender, if "Enable Scripts" is on */
- char scriptname[1024]; /* 1024 = FILE_MAX */
- char scriptarg[256]; /* 1024 = FILE_MAX */
+ /**
+ * Store the script file here so we can re-run it on loading blender,
+ * if "Enable Scripts" is on
+ */
+ /** 1024 = FILE_MAX. */
+ char scriptname[1024];
+ /** 1024 = FILE_MAX. */
+ char scriptarg[256];
} Script;
#define SCRIPT_SET_NULL(_script) _script->py_draw = _script->py_event = _script->py_button = _script->py_browsercallback = _script->py_globaldict = NULL; _script->flags = 0
/* Script View - Obsolete (pre 2.5) */
typedef struct SpaceScript {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
@@ -1127,7 +1233,7 @@ typedef struct SpaceScript {
struct Script *script;
short flags, menunr;
- int pad1;
+ char _pad1[4];
void *but_refs;
} SpaceScript;
@@ -1142,30 +1248,43 @@ typedef struct bNodeTreePath {
struct bNodeTreePath *next, *prev;
struct bNodeTree *nodetree;
- bNodeInstanceKey parent_key; /* base key for nodes in this tree instance */
- int pad;
- float view_center[2]; /* v2d center point, so node trees can have different offsets in editors */
-
- char node_name[64]; /* MAX_NAME */
+ /** Base key for nodes in this tree instance. */
+ bNodeInstanceKey parent_key;
+ char _pad[4];
+ /** V2d center point, so node trees can have different offsets in editors. */
+ float view_center[2];
+
+ /** MAX_NAME. */
+ char node_name[64];
} bNodeTreePath;
typedef struct SpaceNode {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
/* End 'SpaceLink' header. */
- View2D v2d DNA_DEPRECATED; /* deprecated, copied to region */
+ /** Deprecated, copied to region. */
+ View2D v2d DNA_DEPRECATED;
- struct ID *id, *from; /* context, no need to save in file? well... pinning... */
- short flag, pad1; /* menunr: browse id block in header */
- float aspect, pad2; /* internal state variables */
-
- float xof, yof; /* offset for drawing the backdrop */
- float zoom; /* zoom for backdrop */
- float cursor[2]; /* mouse pos for drawing socketless link and adding nodes */
+ /** Context, no need to save in file? well... pinning... */
+ struct ID *id, *from;
+ /** Menunr: browse id block in header. */
+ short flag;
+ char _pad1[2];
+ /** Internal state variables. */
+ float aspect;
+ char _pad2[4];
+
+ /** Offset for drawing the backdrop. */
+ float xof, yof;
+ /** Zoom for backdrop. */
+ float zoom;
+ /** Mouse pos for drawing socketless link and adding nodes. */
+ float cursor[2];
/* XXX nodetree pointer info is all in the path stack now,
* remove later on and use bNodeTreePath instead. For now these variables are set when pushing/popping
@@ -1178,21 +1297,29 @@ typedef struct SpaceNode {
/* tree type for the current node tree */
char tree_idname[64];
- int treetype DNA_DEPRECATED; /* treetype: as same nodetree->type */
- int pad3;
-
- short texfrom; /* texfrom object, world or brush */
- short shaderfrom; /* shader from object or world */
- short recalc; /* currently on 0/1, for auto compo */
-
- char insert_ofs_dir; /* direction for offsetting nodes on insertion */
- char pad4;
-
- ListBase linkdrag; /* temporary data for modal linking operator */
+ /** Treetype: as same nodetree->type. */
+ int treetype DNA_DEPRECATED;
+ char _pad3[4];
+
+ /** Texfrom object, world or brush. */
+ short texfrom;
+ /** Shader from object or world. */
+ short shaderfrom;
+ /** Currently on 0/1, for auto compo. */
+ short recalc;
+
+ /** Direction for offsetting nodes on insertion. */
+ char insert_ofs_dir;
+ char _pad4;
+
+ /** Temporary data for modal linking operator. */
+ ListBase linkdrag;
/* XXX hack for translate_attach op-macros to pass data from transform op to insert_offset op */
- struct NodeInsertOfsData *iofsd; /* temporary data for node insert offset (in UI called Auto-offset) */
+ /** Temporary data for node insert offset (in UI called Auto-offset). */
+ struct NodeInsertOfsData *iofsd;
- struct bGPdata *gpd; /* grease-pencil data */
+ /** Grease-pencil data. */
+ struct bGPdata *gpd;
} SpaceNode;
/* SpaceNode.flag */
@@ -1209,7 +1336,8 @@ typedef enum eSpaceNode_Flag {
SNODE_FLAG_DEPRECATED_10 = (1 << 10), /* cleared */
SNODE_FLAG_DEPRECATED_11 = (1 << 11), /* cleared */
SNODE_PIN = (1 << 12),
- SNODE_SKIP_INSOFFSET = (1 << 13), /* automatically offset following nodes in a chain on insertion */
+ /** automatically offset following nodes in a chain on insertion */
+ SNODE_SKIP_INSOFFSET = (1 << 13),
} eSpaceNode_Flag;
/* SpaceNode.texfrom */
@@ -1244,12 +1372,15 @@ typedef struct ConsoleLine {
struct ConsoleLine *next, *prev;
/* keep these 3 vars so as to share free, realloc funcs */
- int len_alloc; /* allocated length */
- int len; /* real len - strlen() */
+ /** Allocated length. */
+ int len_alloc;
+ /** Real len - strlen(). */
+ int len;
char *line;
int cursor;
- int type; /* only for use when in the 'scrollback' listbase */
+ /** Only for use when in the 'scrollback' listbase. */
+ int type;
} ConsoleLine;
/* ConsoleLine.type */
@@ -1257,26 +1388,31 @@ typedef enum eConsoleLine_Type {
CONSOLE_LINE_OUTPUT = 0,
CONSOLE_LINE_INPUT = 1,
CONSOLE_LINE_INFO = 2, /* autocomp feedback */
- CONSOLE_LINE_ERROR = 3
+ CONSOLE_LINE_ERROR = 3,
} eConsoleLine_Type;
/* Console View */
typedef struct SpaceConsole {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
/* End 'SpaceLink' header. */
/* space vars */
- int lheight, pad;
+ int lheight;
+ char _pad[4];
- ListBase scrollback; /* ConsoleLine; output */
- ListBase history; /* ConsoleLine; command history, current edited line is the first */
+ /** ConsoleLine; output. */
+ ListBase scrollback;
+ /** ConsoleLine; command history, current edited line is the first. */
+ ListBase history;
char prompt[256];
- char language[32]; /* multiple consoles are possible, not just python */
+ /** Multiple consoles are possible, not just python. */
+ char language[32];
int sel_start;
int sel_end;
@@ -1290,7 +1426,8 @@ typedef struct SpaceConsole {
typedef struct SpaceUserPref {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
@@ -1298,7 +1435,8 @@ typedef struct SpaceUserPref {
char _pad1[7];
char filter_type;
- char filter[64]; /* search term for filtering in the UI */
+ /** Search term for filtering in the UI. */
+ char filter[64];
} SpaceUserPref;
/** \} */
@@ -1310,7 +1448,8 @@ typedef struct SpaceUserPref {
/* Clip Editor */
typedef struct SpaceClip {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
@@ -1318,35 +1457,53 @@ typedef struct SpaceClip {
char _pad1[4];
- float xof, yof; /* user defined offset, image is centered */
- float xlockof, ylockof; /* user defined offset from locked position */
- float zoom; /* user defined zoom level */
-
- struct MovieClipUser user; /* user of clip */
- struct MovieClip *clip; /* clip data */
- struct MovieClipScopes scopes; /* different scoped displayed in space panels */
-
- int flag; /* flags */
- short mode; /* editor mode (editing context being displayed) */
- short view; /* type of the clip editor view */
+ /** User defined offset, image is centered. */
+ float xof, yof;
+ /** User defined offset from locked position. */
+ float xlockof, ylockof;
+ /** User defined zoom level. */
+ float zoom;
+
+ /** User of clip. */
+ struct MovieClipUser user;
+ /** Clip data. */
+ struct MovieClip *clip;
+ /** Different scoped displayed in space panels. */
+ struct MovieClipScopes scopes;
+
+ /** Flags. */
+ int flag;
+ /** Editor mode (editing context being displayed). */
+ short mode;
+ /** Type of the clip editor view. */
+ short view;
- int path_length; /* length of displaying path, in frames */
+ /** Length of displaying path, in frames. */
+ int path_length;
/* current stabilization data */
- float loc[2], scale, angle; /* pre-composed stabilization data */
- int pad;
- float stabmat[4][4], unistabmat[4][4]; /* current stabilization matrix and the same matrix in unified space,
- * defined when drawing and used for mouse position calculation */
+ /** Pre-composed stabilization data. */
+ float loc[2], scale, angle;
+ char _pad[4];
+ /**
+ * Current stabilization matrix and the same matrix in unified space,
+ * defined when drawing and used for mouse position calculation.
+ */
+ float stabmat[4][4], unistabmat[4][4];
/* movie postprocessing */
int postproc_flag;
/* grease pencil */
- short gpencil_src, pad2;
+ short gpencil_src;
+ char _pad2[2];
- int around, pad4; /* pivot point for transforms */
+ /** Pivot point for transforms. */
+ int around;
+ char _pad4[4];
- float cursor[2]; /* Mask editor 2d cursor */
+ /** Mask editor 2d cursor. */
+ float cursor[2];
MaskSpaceInfo mask_info;
} SpaceClip;
@@ -1412,7 +1569,8 @@ typedef enum eSpaceClip_GPencil_Source {
#
typedef struct SpaceTopBar {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
@@ -1431,7 +1589,8 @@ typedef struct SpaceTopBar {
#
typedef struct SpaceStatusBar {
SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
@@ -1449,9 +1608,9 @@ typedef struct SpaceStatusBar {
typedef enum eSpace_Type {
SPACE_EMPTY = 0,
SPACE_VIEW3D = 1,
- SPACE_IPO = 2,
+ SPACE_GRAPH = 2,
SPACE_OUTLINER = 3,
- SPACE_BUTS = 4,
+ SPACE_PROPERTIES = 4,
SPACE_FILE = 5,
SPACE_IMAGE = 6,
SPACE_INFO = 7,
@@ -1474,7 +1633,7 @@ typedef enum eSpace_Type {
SPACE_TOPBAR = 21,
SPACE_STATUSBAR = 22,
- SPACE_TYPE_LAST = SPACE_STATUSBAR
+ SPACE_TYPE_LAST = SPACE_STATUSBAR,
} eSpace_Type;
/* use for function args */
diff --git a/source/blender/makesdna/DNA_speaker_types.h b/source/blender/makesdna/DNA_speaker_types.h
index a7408293131..6d40f8bff72 100644
--- a/source/blender/makesdna/DNA_speaker_types.h
+++ b/source/blender/makesdna/DNA_speaker_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Jörg Müller.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_speaker_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_SPEAKER_TYPES_H__
@@ -34,11 +28,12 @@ struct bSound;
typedef struct Speaker {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
struct bSound *sound;
- // not animatable properties
+ /* not animatable properties */
float volume_max;
float volume_min;
float distance_max;
@@ -48,13 +43,13 @@ typedef struct Speaker {
float cone_angle_inner;
float cone_volume_outer;
- // animatable properties
+ /* animatable properties */
float volume;
float pitch;
- // flag
+ /* flag */
short flag;
- short pad1[3];
+ char _pad1[6];
} Speaker;
/* **************** SPEAKER ********************* */
@@ -62,6 +57,6 @@ typedef struct Speaker {
/* flag */
#define SPK_DS_EXPAND (1<<0)
#define SPK_MUTED (1<<1)
-#define SPK_RELATIVE (1<<2)
+// #define SPK_RELATIVE (1<<2) /* UNUSED */
#endif /* __DNA_SPEAKER_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h
index 0672592b9d1..34b49e29b38 100644
--- a/source/blender/makesdna/DNA_text_types.h
+++ b/source/blender/makesdna/DNA_text_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,9 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_text_types.h
- * \ingroup DNA
- * \since mar-2001
- * \author nzc
+/** \file
+ * \ingroup DNA
*
* Text blocks used for Python-Scripts, OpenShadingLanguage
* and arbitrary text data to store in blend files.
@@ -43,8 +33,10 @@ typedef struct TextLine {
struct TextLine *next, *prev;
char *line;
- char *format; /* may be NULL if syntax is off or not yet formatted */
- int len, blen; /* blen unused */
+ /** May be NULL if syntax is off or not yet formatted. */
+ char *format;
+ /** Blen unused. */
+ int len, blen;
} TextLine;
typedef struct Text {
@@ -71,8 +63,6 @@ typedef struct Text {
#define TXT_ISMEM (1 << 2)
#define TXT_ISEXT (1 << 3)
#define TXT_ISSCRIPT (1 << 4) /* used by space handler scriptlinks */
-// #define TXT_READONLY (1 << 8)
-// #define TXT_FOLLOW (1 << 9) /* always follow cursor (console) */
#define TXT_TABSTOSPACES (1 << 10) /* use space instead of tabs */
#endif /* __DNA_TEXT_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index 8442634ef6f..3db9f2d7131 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_texture_types.h
- * \ingroup DNA
- * \since mar-2001
- * \author nzc
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_TEXTURE_TYPES_H__
@@ -43,28 +33,30 @@ extern "C" {
#endif
struct AnimData;
-struct Ipo;
struct ColorBand;
-struct Object;
-struct Tex;
+struct CurveMapping;
+struct ImBuf;
struct Image;
+struct Ipo;
+struct Object;
struct PreviewImage;
-struct ImBuf;
-struct CurveMapping;
+struct Tex;
typedef struct MTex {
short texco, mapto, maptoneg, blendtype;
struct Object *object;
struct Tex *tex;
- char uvname[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
+ /** MAX_CUSTOMDATA_LAYER_NAME. */
+ char uvname[64];
char projx, projy, projz, mapping;
char brush_map_mode, brush_angle_mode;
- char pad[2];
+ char _pad[2];
float ofs[3], size[3], rot, random_angle;
- short texflag, colormodel, pmapto, pmaptoneg;
+ char _pad0[2];
+ short colormodel, pmapto, pmaptoneg;
short normapspace, which_output;
float r, g, b, k;
float def_var, rt;
@@ -86,7 +78,7 @@ typedef struct MTex {
float lifefac, sizefac, ivelfac, fieldfac;
float twistfac;
- /* lamp */
+ /* light */
float shadowfac;
/* world */
@@ -114,7 +106,7 @@ typedef struct ColorBand {
short tot, cur;
char ipotype, ipotype_hue;
char color_mode;
- char pad[1];
+ char _pad[1];
CBData data[32];
} ColorBand;
@@ -126,42 +118,55 @@ typedef struct PointDensity {
float falloff_softness;
float radius;
short source;
- short pad0;
+ char _pad0[2];
- short color_source; /* psys_color_source */
+ /** psys_color_source */
+ short color_source;
short ob_color_source;
int totpoints;
- struct Object *object; /* for 'Object' or 'Particle system' type - source object */
- int psys; /* index+1 in ob.particlesystem, non-ID pointer not allowed */
- short psys_cache_space; /* cache points in worldspace, object space, ... ? */
- short ob_cache_space; /* cache points in worldspace, object space, ... ? */
- char vertex_attribute_name[64]; /* vertex attribute layer for color source, MAX_CUSTOMDATA_LAYER_NAME */
-
- void *point_tree; /* the acceleration tree containing points */
- float *point_data; /* dynamically allocated extra for extra information, like particle age */
+ /** for 'Object' or 'Particle system' type - source object */
+ struct Object *object;
+ /** index+1 in ob.particlesystem, non-ID pointer not allowed */
+ int psys;
+ /** cache points in worldspace, object space, ... ? */
+ short psys_cache_space;
+ /** cache points in worldspace, object space, ... ? */
+ short ob_cache_space;
+ /** vertex attribute layer for color source, MAX_CUSTOMDATA_LAYER_NAME */
+ char vertex_attribute_name[64];
+
+ /** The acceleration tree containing points. */
+ void *point_tree;
+ /** Dynamically allocated extra for extra information, like particle age. */
+ float *point_data;
float noise_size;
short noise_depth;
short noise_influence;
short noise_basis;
- short pad1[3];
+ char _pad1[6];
float noise_fac;
- float speed_scale, falloff_speed_scale, pad2;
- struct ColorBand *coba; /* for time -> color */
+ float speed_scale, falloff_speed_scale;
+ char _pad2[4];
+ /** For time -> color */
+ struct ColorBand *coba;
- struct CurveMapping *falloff_curve; /* falloff density curve */
+ /** Falloff density curve. */
+ struct CurveMapping *falloff_curve;
} PointDensity;
typedef struct Tex {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
float noisesize, turbul;
float bright, contrast, saturation, rfac, gfac, bfac;
- float filtersize, pad2;
+ float filtersize;
+ char _pad2[4];
/* newnoise: musgrave parameters */
float mg_H, mg_lacunarity, mg_octaves, mg_offset, mg_gain;
@@ -169,7 +174,8 @@ typedef struct Tex {
/* newnoise: distorted noise amount, musgrave & voronoi output scale */
float dist_amount, ns_outscale;
- /* newnoise: voronoi nearest neighbor weights, minkovsky exponent, distance metric & color type */
+ /* newnoise: voronoi nearest neighbor weights, minkovsky exponent,
+ * distance metric & color type */
float vn_w1;
float vn_w2;
float vn_w3;
@@ -177,7 +183,8 @@ typedef struct Tex {
float vn_mexp;
short vn_distm, vn_coltype;
- short noisedepth, noisetype; /* noisedepth MUST be <= 30 else we get floating point exceptions */
+ /* noisedepth MUST be <= 30 else we get floating point exceptions */
+ short noisedepth, noisetype;
/* newnoise: noisebasis type for clouds/marble/etc, noisebasis2 only used for distorted noise */
short noisebasis, noisebasis2;
@@ -197,18 +204,19 @@ typedef struct Tex {
int frames, offset, sfra;
float checkerdist, nabla;
- float pad1;
+ char _pad1[4];
struct ImageUser iuser;
struct bNodeTree *nodetree;
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
+ /* old animation system, deprecated for 2.5 */
+ struct Ipo *ipo DNA_DEPRECATED;
struct Image *ima;
struct ColorBand *coba;
struct PreviewImage *preview;
char use_nodes;
- char pad[7];
+ char _pad[7];
} Tex;
@@ -234,7 +242,8 @@ typedef struct ColorMapping {
float blend_color[3];
float blend_factor;
- int blend_type, pad[3];
+ int blend_type;
+ char _pad[4];
} ColorMapping;
/* texmap->flag */
@@ -399,7 +408,7 @@ typedef struct ColorMapping {
#define TEX_RGB 1
#define TEX_NOR 2
-/* pr_texture in material, world, lamp, */
+/* pr_texture in material, world, light. */
#define TEX_PR_TEXTURE 0
#define TEX_PR_OTHER 1
#define TEX_PR_BOTH 2
@@ -412,24 +421,6 @@ typedef struct ColorMapping {
#define PROJ_Y 2
#define PROJ_Z 3
-/* texflag */
-#define MTEX_RGBTOINT (1 << 0)
-#define MTEX_STENCIL (1 << 1)
-#define MTEX_NEGATIVE (1 << 2)
-#define MTEX_ALPHAMIX (1 << 3)
-#define MTEX_VIEWSPACE (1 << 4)
-#define MTEX_DUPLI_MAPTO (1 << 5)
-#define MTEX_OB_DUPLI_ORIG (1 << 6)
-#define MTEX_COMPAT_BUMP (1 << 7)
-#define MTEX_3TAP_BUMP (1 << 8)
-#define MTEX_5TAP_BUMP (1 << 9)
-#define MTEX_BUMP_OBJECTSPACE (1 << 10)
-#define MTEX_BUMP_TEXTURESPACE (1 << 11)
-/* #define MTEX_BUMP_FLIPPED (1 << 12) */ /* UNUSED */
-#define MTEX_TIPS (1 << 12) /* should use with_freestyle flag? */
-#define MTEX_BICUBIC_BUMP (1 << 13)
-#define MTEX_MAPTO_BOUNDS (1 << 14)
-
/* blendtype */
#define MTEX_BLEND 0
#define MTEX_MUL 1
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index bfd9edceab4..6afabe20800 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_tracking_types.h
- * \ingroup DNA
- * \since may-2011
- * \author Sergey Sharybin
+/** \file
+ * \ingroup DNA
*
* Structs used for camera tracking and the movie-clip editor.
*/
@@ -42,13 +31,13 @@
/* match-moving data */
-struct bGPdata;
struct Image;
struct MovieReconstructedCamera;
+struct MovieTracking;
struct MovieTrackingCamera;
struct MovieTrackingMarker;
struct MovieTrackingTrack;
-struct MovieTracking;
+struct bGPdata;
typedef struct MovieReconstructedCamera {
int framenr;
@@ -57,27 +46,35 @@ typedef struct MovieReconstructedCamera {
} MovieReconstructedCamera;
typedef struct MovieTrackingCamera {
- void *intrinsics; /* intrinsics handle */
+ /** Intrinsics handle. */
+ void *intrinsics;
short distortion_model;
- short pad;
-
- float sensor_width; /* width of CCD sensor */
- float pixel_aspect; /* pixel aspect ratio */
- float focal; /* focal length */
- short units; /* units of focal length user is working with */
- short pad1;
- float principal[2]; /* principal point */
+ char _pad[2];
+
+ /** Width of CCD sensor. */
+ float sensor_width;
+ /** Pixel aspect ratio. */
+ float pixel_aspect;
+ /** Focal length. */
+ float focal;
+ /** Units of focal length user is working with. */
+ short units;
+ char _pad1[2];
+ /** Principal point. */
+ float principal[2];
/* Polynomial distortion */
- float k1, k2, k3; /* polynomial radial distortion */
+ /** Polynomial radial distortion. */
+ float k1, k2, k3;
/* Division distortion model coefficients */
float division_k1, division_k2;
} MovieTrackingCamera;
typedef struct MovieTrackingMarker {
- float pos[2]; /* 2d position of marker on frame (in unified 0..1 space) */
+ /** 2d position of marker on frame (in unified 0..1 space). */
+ float pos[2];
/* corners of pattern in the following order:
*
@@ -99,14 +96,17 @@ typedef struct MovieTrackingMarker {
*/
float search_min[2], search_max[2];
- int framenr; /* number of frame marker is associated with */
- int flag; /* Marker's flag (alive, ...) */
+ /** Number of frame marker is associated with. */
+ int framenr;
+ /** Marker's flag (alive, ...). */
+ int flag;
} MovieTrackingMarker;
typedef struct MovieTrackingTrack {
struct MovieTrackingTrack *next, *prev;
- char name[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64];
/* ** settings ** */
@@ -122,32 +122,50 @@ typedef struct MovieTrackingTrack {
*/
float search_min[2] DNA_DEPRECATED, search_max[2] DNA_DEPRECATED;
- float offset[2]; /* offset to "parenting" point */
+ /** Offset to "parenting" point. */
+ float offset[2];
/* ** track ** */
- int markersnr; /* count of markers in track */
- int last_marker; /* most recently used marker */
- MovieTrackingMarker *markers; /* markers in track */
+ /** Count of markers in track. */
+ int markersnr;
+ /** Most recently used marker. */
+ int last_marker;
+ /** Markers in track. */
+ MovieTrackingMarker *markers;
/* ** reconstruction data ** */
- float bundle_pos[3]; /* reconstructed position */
- float error; /* average track reprojection error */
+ /** Reconstructed position. */
+ float bundle_pos[3];
+ /** Average track reprojection error. */
+ float error;
/* ** UI editing ** */
- int flag, pat_flag, search_flag; /* flags (selection, ...) */
- float color[3]; /* custom color for track */
+ /** Flags (selection, ...). */
+ int flag, pat_flag, search_flag;
+ /** Custom color for track. */
+ float color[3];
/* ** control how tracking happens */
- short frames_limit; /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */
- short margin; /* margin from frame boundaries */
- short pattern_match; /* re-adjust every N frames */
+ /**
+ * Number of frames to be tarcked during single tracking session
+ * (if TRACKING_FRAMES_LIMIT is set).
+ */
+ short frames_limit;
+ /** Margin from frame boundaries. */
+ short margin;
+ /** Re-adjust every N frames. */
+ short pattern_match;
/* tracking parameters */
- short motion_model; /* model of the motion for this track */
- int algorithm_flag; /* flags for the tracking algorithm (use brute, use esm, use pyramid, etc */
- float minimum_correlation; /* minimal correlation which is still treated as successful tracking */
+ /** Model of the motion for this track. */
+ short motion_model;
+ /** Flags for the tracking algorithm (use brute, use esm, use pyramid, etc. */
+ int algorithm_flag;
+ /** Minimal correlation which is still treated as successful tracking. */
+ float minimum_correlation;
- struct bGPdata *gpd; /* grease-pencil data */
+ /** Grease-pencil data. */
+ struct bGPdata *gpd;
/* Weight of this track.
*
@@ -180,122 +198,175 @@ typedef struct MovieTrackingPlaneMarker {
*/
float corners[4][2];
- int framenr; /* Number of frame plane marker is associated with */
- int flag; /* Marker's flag (alive, ...) */
+ /** Number of frame plane marker is associated with. */
+ int framenr;
+ /** Marker's flag (alive, ...). */
+ int flag;
} MovieTrackingPlaneMarker;
typedef struct MovieTrackingPlaneTrack {
struct MovieTrackingPlaneTrack *next, *prev;
- char name[64]; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64];
- MovieTrackingTrack **point_tracks; /* Array of point tracks used to define this plane.
- * Each element is a pointer to MovieTrackingTrack. */
- int point_tracksnr, pad; /* Number of tracks in point_tracks array. */
+ /**
+ * Array of point tracks used to define this pla.ne.
+ * Each element is a pointer to MovieTrackingTrack.
+ */
+ MovieTrackingTrack **point_tracks;
+ /** Number of tracks in point_tracks array. */
+ int point_tracksnr;
+ char _pad[4];
- MovieTrackingPlaneMarker *markers; /* Markers in the plane track */
- int markersnr; /* Count of markers in track (size of markers array) */
+ /** Markers in the plane track. */
+ MovieTrackingPlaneMarker *markers;
+ /** Count of markers in track (size of markers array). */
+ int markersnr;
- int flag; /* flags (selection, ...) */
+ /** Flags (selection, ...). */
+ int flag;
- struct Image *image; /* Image displaying during editing */
- float image_opacity; /* Opacity of the image */
+ /** Image displaying during editing. */
+ struct Image *image;
+ /** Opacity of the image. */
+ float image_opacity;
/* Runtime data */
- int last_marker; /* Most recently used marker */
+ /** Most recently used marker. */
+ int last_marker;
} MovieTrackingPlaneTrack;
typedef struct MovieTrackingSettings {
int flag;
/* ** default tracker settings */
- short default_motion_model; /* model of the motion for this track */
- short default_algorithm_flag; /* flags for the tracking algorithm (use brute, use esm, use pyramid, etc */
- float default_minimum_correlation; /* minimal correlation which is still treated as successful tracking */
- short default_pattern_size; /* size of pattern area for new tracks */
- short default_search_size; /* size of search area for new tracks */
- short default_frames_limit; /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */
- short default_margin; /* margin from frame boundaries */
- short default_pattern_match; /* re-adjust every N frames */
- short default_flag; /* default flags like color channels used by default */
- float default_weight; /* default weight of the track */
-
- short motion_flag; /* flags describes motion type */
+ /** Model of the motion for this track. */
+ short default_motion_model;
+ /** Flags for the tracking algorithm (use brute, use esm, use pyramid, etc. */
+ short default_algorithm_flag;
+ /** Minimal correlation which is still treated as successful tracking. */
+ float default_minimum_correlation;
+ /** Size of pattern area for new tracks. */
+ short default_pattern_size;
+ /** Size of search area for new tracks. */
+ short default_search_size;
+ /** Number of frames to be tarcked during single tracking session
+ * (if TRACKING_FRAMES_LIMIT is set). */
+ short default_frames_limit;
+ /** Margin from frame boundaries. */
+ short default_margin;
+ /** Re-adjust every N frames. */
+ short default_pattern_match;
+ /** Default flags like color channels used by default. */
+ short default_flag;
+ /** Default weight of the track. */
+ float default_weight;
+
+ /** Flags describes motion type. */
+ short motion_flag;
/* ** common tracker settings ** */
- short speed; /* speed of tracking */
+ /** Speed of tracking. */
+ short speed;
/* ** reconstruction settings ** */
+ /* two keyframes for reconstruction initialization
+ * were moved to per-tracking object settings
+ */
int keyframe1 DNA_DEPRECATED,
- keyframe2 DNA_DEPRECATED; /* two keyframes for reconstruction initialization
- * were moved to per-tracking object settings
- */
+ keyframe2 DNA_DEPRECATED;
int reconstruction_flag;
/* which camera intrinsics to refine. uses on the REFINE_* flags */
- short refine_camera_intrinsics, pad2;
+ short refine_camera_intrinsics;
+ char _pad2[2];
/* ** tool settings ** */
/* set scale */
- float dist; /* distance between two bundles used for scene scaling */
+ /** Distance between two bundles used for scene scaling. */
+ float dist;
/* cleanup */
int clean_frames, clean_action;
float clean_error;
/* set object scale */
- float object_distance; /* distance between two bundles used for object scaling */
+ /** Distance between two bundles used for object scaling. */
+ float object_distance;
- int pad3;
+ char _pad3[4];
} MovieTrackingSettings;
typedef struct MovieTrackingStabilization {
int flag;
- int tot_track, act_track; /* total number of translation tracks and index of active track in list */
- int tot_rot_track, act_rot_track; /* total number of rotation tracks and index of active track in list */
+ /** Total number of translation tracks and index of active track in list. */
+ int tot_track, act_track;
+ /** Total number of rotation tracks and index of active track in list. */
+ int tot_rot_track, act_rot_track;
/* 2d stabilization */
- float maxscale; /* max auto-scale factor */
- MovieTrackingTrack *rot_track DNA_DEPRECATED; /* use TRACK_USE_2D_STAB_ROT on individual tracks instead */
-
- int anchor_frame; /* reference point to anchor stabilization offset */
- float target_pos[2]; /* expected target position of frame after raw stabilization, will be subtracted */
- float target_rot; /* expected target rotation of frame after raw stabilization, will be compensated */
- float scale; /* zoom factor known to be present on original footage. Also used for autoscale */
-
- float locinf, scaleinf, rotinf; /* influence on location, scale and rotation */
-
- int filter; /* filter used for pixel interpolation */
+ /** Max auto-scale factor. */
+ float maxscale;
+ /** Use TRACK_USE_2D_STAB_ROT on individual tracks instead. */
+ MovieTrackingTrack *rot_track DNA_DEPRECATED;
+
+ /** Reference point to anchor stabilization offset. */
+ int anchor_frame;
+ /** Expected target position of frame after raw stabilization, will be subtracted. */
+ float target_pos[2];
+ /** Expected target rotation of frame after raw stabilization, will be compensated. */
+ float target_rot;
+ /** Zoom factor known to be present on original footage. Also used for autoscale. */
+ float scale;
+
+ /** Influence on location, scale and rotation. */
+ float locinf, scaleinf, rotinf;
+
+ /** Filter used for pixel interpolation. */
+ int filter;
/* initialization and run-time data */
- int ok DNA_DEPRECATED; /* Without effect now, we initialize on every frame. Formerly used for caching of init values */
+ /** Without effect now, we initialize on every frame.
+ * Formerly used for caching of init values. */
+ int ok DNA_DEPRECATED;
} MovieTrackingStabilization;
typedef struct MovieTrackingReconstruction {
int flag;
- float error; /* average error of reconstruction */
+ /** Average error of reconstruction. */
+ float error;
- int last_camera; /* most recently used camera */
- int camnr; /* number of reconstructed cameras */
- struct MovieReconstructedCamera *cameras; /* reconstructed cameras */
+ /** Most recently used camera. */
+ int last_camera;
+ /** Number of reconstructed cameras. */
+ int camnr;
+ /** Reconstructed cameras. */
+ struct MovieReconstructedCamera *cameras;
} MovieTrackingReconstruction;
typedef struct MovieTrackingObject {
struct MovieTrackingObject *next, *prev;
- char name[64]; /* Name of tracking object, MAX_NAME */
+ /** Name of tracking object, MAX_NAME. */
+ char name[64];
int flag;
- float scale; /* scale of object solution in amera space */
+ /** Scale of object solution in amera space. */
+ float scale;
- ListBase tracks; /* list of tracks use to tracking this object */
- ListBase plane_tracks; /* list of plane tracks used by this object */
- MovieTrackingReconstruction reconstruction; /* reconstruction data for this object */
+ /** List of tracks use to tracking this object. */
+ ListBase tracks;
+ /** List of plane tracks used by this object. */
+ ListBase plane_tracks;
+ /** Reconstruction data for this object. */
+ MovieTrackingReconstruction reconstruction;
/* reconstruction options */
- int keyframe1, keyframe2; /* two keyframes for reconstruction initialization */
+ /** Two keyframes for reconstruction initialization. */
+ int keyframe1, keyframe2;
} MovieTrackingObject;
typedef struct MovieTrackingStats {
@@ -305,14 +376,19 @@ typedef struct MovieTrackingStats {
typedef struct MovieTrackingDopesheetChannel {
struct MovieTrackingDopesheetChannel *next, *prev;
- MovieTrackingTrack *track; /* motion track for which channel is created */
- int pad;
+ /** Motion track for which channel is created. */
+ MovieTrackingTrack *track;
+ char _pad[4];
- char name[64]; /* name of channel */
+ /** Name of channel. */
+ char name[64];
- int tot_segment; /* total number of segments */
- int *segments; /* tracked segments */
- int max_segment, total_frames; /* longest segment length and total number of tracked frames */
+ /** Total number of segments. */
+ int tot_segment;
+ /** Tracked segments. */
+ int *segments;
+ /** Longest segment length and total number of tracked frames. */
+ int max_segment, total_frames;
} MovieTrackingDopesheetChannel;
typedef struct MovieTrackingDopesheetCoverageSegment {
@@ -322,14 +398,17 @@ typedef struct MovieTrackingDopesheetCoverageSegment {
int start_frame;
int end_frame;
- int pad;
+ char _pad[4];
} MovieTrackingDopesheetCoverageSegment;
typedef struct MovieTrackingDopesheet {
- int ok; /* flag if dopesheet information is still relevant */
+ /** Flag if dopesheet information is still relevant. */
+ int ok;
- short sort_method; /* method to be used to sort tracks */
- short flag; /* dopesheet building flag such as inverted order of sort */
+ /** Method to be used to sort tracks. */
+ short sort_method;
+ /** Dopesheet building flag such as inverted order of sort. */
+ short flag;
/* ** runtime stuff ** */
@@ -340,37 +419,48 @@ typedef struct MovieTrackingDopesheet {
ListBase channels;
int tot_channel;
- int pad;
+ char _pad[4];
} MovieTrackingDopesheet;
typedef struct MovieTracking {
- MovieTrackingSettings settings; /* different tracking-related settings */
- MovieTrackingCamera camera; /* camera intrinsics */
- ListBase tracks; /* list of tracks used for camera object */
- ListBase plane_tracks; /* list of plane tracks used by camera object */
- MovieTrackingReconstruction reconstruction; /* reconstruction data for camera object */
- MovieTrackingStabilization stabilization; /* stabilization data */
- MovieTrackingTrack *act_track; /* active track */
- MovieTrackingPlaneTrack *act_plane_track; /* active plane track */
+ /** Different tracking-related settings. */
+ MovieTrackingSettings settings;
+ /** Camera intrinsics. */
+ MovieTrackingCamera camera;
+ /** List of tracks used for camera object. */
+ ListBase tracks;
+ /** List of plane tracks used by camera object. */
+ ListBase plane_tracks;
+ /** Reconstruction data for camera object. */
+ MovieTrackingReconstruction reconstruction;
+ /** Stabilization data. */
+ MovieTrackingStabilization stabilization;
+ /** Active track. */
+ MovieTrackingTrack *act_track;
+ /** Active plane track. */
+ MovieTrackingPlaneTrack *act_plane_track;
ListBase objects;
- int objectnr, tot_object; /* index of active object and total number of objects */
+ /** Index of active object and total number of objects. */
+ int objectnr, tot_object;
- MovieTrackingStats *stats; /* statistics displaying in clip editor */
+ /** Statistics displaying in clip editor. */
+ MovieTrackingStats *stats;
- MovieTrackingDopesheet dopesheet; /* dopesheet data */
+ /** Dopesheet data. */
+ MovieTrackingDopesheet dopesheet;
} MovieTracking;
/* MovieTrackingCamera->distortion_model */
enum {
TRACKING_DISTORTION_MODEL_POLYNOMIAL = 0,
- TRACKING_DISTORTION_MODEL_DIVISION = 1
+ TRACKING_DISTORTION_MODEL_DIVISION = 1,
};
/* MovieTrackingCamera->units */
enum {
CAMERA_UNITS_PX = 0,
- CAMERA_UNITS_MM = 1
+ CAMERA_UNITS_MM = 1,
};
/* MovieTrackingMarker->flag */
@@ -379,7 +469,7 @@ enum {
MARKER_TRACKED = (1 << 1),
MARKER_GRAPH_SEL_X = (1 << 2),
MARKER_GRAPH_SEL_Y = (1 << 3),
- MARKER_GRAPH_SEL = (MARKER_GRAPH_SEL_X | MARKER_GRAPH_SEL_Y)
+ MARKER_GRAPH_SEL = (MARKER_GRAPH_SEL_X | MARKER_GRAPH_SEL_Y),
};
/* MovieTrackingTrack->flag */
@@ -395,7 +485,7 @@ enum {
TRACK_PREVIEW_GRAYSCALE = (1 << 9),
TRACK_DOPE_SEL = (1 << 10),
TRACK_PREVIEW_ALPHA = (1 << 11),
- TRACK_USE_2D_STAB_ROT = (1 << 12)
+ TRACK_USE_2D_STAB_ROT = (1 << 12),
};
/* MovieTrackingTrack->motion_model */
@@ -405,33 +495,33 @@ enum {
TRACK_MOTION_MODEL_TRANSLATION_SCALE = 2,
TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE = 3,
TRACK_MOTION_MODEL_AFFINE = 4,
- TRACK_MOTION_MODEL_HOMOGRAPHY = 5
+ TRACK_MOTION_MODEL_HOMOGRAPHY = 5,
};
/* MovieTrackingTrack->algorithm_flag */
enum {
TRACK_ALGORITHM_FLAG_USE_BRUTE = (1 << 0),
TRACK_ALGORITHM_FLAG_USE_NORMALIZATION = (1 << 2),
- TRACK_ALGORITHM_FLAG_USE_MASK = (1 << 3)
+ TRACK_ALGORITHM_FLAG_USE_MASK = (1 << 3),
};
/* MovieTrackingTrack->adjframes */
enum {
TRACK_MATCH_KEYFRAME = 0,
- TRACK_MATCH_PREVFRAME = 1
+ TRACK_MATCH_PREVFRAME = 1,
};
/* MovieTrackingSettings->flag */
enum {
TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED = (1 << 0),
- TRACKING_SETTINGS_SHOW_EXTRA_EXPANDED = (1 << 1)
+ TRACKING_SETTINGS_SHOW_EXTRA_EXPANDED = (1 << 1),
};
/* MovieTrackingSettings->motion_flag */
enum {
TRACKING_MOTION_TRIPOD = (1 << 0),
- TRACKING_MOTION_MODAL = (TRACKING_MOTION_TRIPOD)
+ TRACKING_MOTION_MODAL = (TRACKING_MOTION_TRIPOD),
};
/* MovieTrackingSettings->speed */
@@ -440,13 +530,13 @@ enum {
TRACKING_SPEED_REALTIME = 1,
TRACKING_SPEED_HALF = 2,
TRACKING_SPEED_QUARTER = 4,
- TRACKING_SPEED_DOUBLE = 5
+ TRACKING_SPEED_DOUBLE = 5,
};
/* MovieTrackingSettings->reconstruction_flag */
enum {
/* TRACKING_USE_FALLBACK_RECONSTRUCTION = (1 << 0), */ /* DEPRECATED */
- TRACKING_USE_KEYFRAME_SELECTION = (1 << 1)
+ TRACKING_USE_KEYFRAME_SELECTION = (1 << 1),
};
/* MovieTrackingSettings->refine_camera_intrinsics */
@@ -454,7 +544,7 @@ enum {
REFINE_FOCAL_LENGTH = (1 << 0),
REFINE_PRINCIPAL_POINT = (1 << 1),
REFINE_RADIAL_DISTORTION_K1 = (1 << 2),
- REFINE_RADIAL_DISTORTION_K2 = (1 << 4)
+ REFINE_RADIAL_DISTORTION_K2 = (1 << 4),
};
/* MovieTrackingStrabilization->flag */
@@ -463,30 +553,30 @@ enum {
TRACKING_AUTOSCALE = (1 << 1),
TRACKING_STABILIZE_ROTATION = (1 << 2),
TRACKING_STABILIZE_SCALE = (1 << 3),
- TRACKING_SHOW_STAB_TRACKS = (1 << 5)
+ TRACKING_SHOW_STAB_TRACKS = (1 << 5),
};
/* MovieTrackingStrabilization->filter */
enum {
TRACKING_FILTER_NEAREST = 0,
TRACKING_FILTER_BILINEAR = 1,
- TRACKING_FILTER_BICUBIC = 2
+ TRACKING_FILTER_BICUBIC = 2,
};
/* MovieTrackingReconstruction->flag */
enum {
- TRACKING_RECONSTRUCTED = (1 << 0)
+ TRACKING_RECONSTRUCTED = (1 << 0),
};
/* MovieTrackingObject->flag */
enum {
- TRACKING_OBJECT_CAMERA = (1 << 0)
+ TRACKING_OBJECT_CAMERA = (1 << 0),
};
enum {
TRACKING_CLEAN_SELECT = 0,
TRACKING_CLEAN_DELETE_TRACK = 1,
- TRACKING_CLEAN_DELETE_SEGMENT = 2
+ TRACKING_CLEAN_DELETE_SEGMENT = 2,
};
/* MovieTrackingDopesheet->sort_method */
@@ -494,21 +584,21 @@ enum {
TRACKING_DOPE_SORT_NAME = 0,
TRACKING_DOPE_SORT_LONGEST = 1,
TRACKING_DOPE_SORT_TOTAL = 2,
- TRACKING_DOPE_SORT_AVERAGE_ERROR = 3
+ TRACKING_DOPE_SORT_AVERAGE_ERROR = 3,
};
/* MovieTrackingDopesheet->flag */
enum {
TRACKING_DOPE_SORT_INVERSE = (1 << 0),
TRACKING_DOPE_SELECTED_ONLY = (1 << 1),
- TRACKING_DOPE_SHOW_HIDDEN = (1 << 2)
+ TRACKING_DOPE_SHOW_HIDDEN = (1 << 2),
};
/* MovieTrackingDopesheetCoverageSegment->trackness */
enum {
TRACKING_COVERAGE_BAD = 0,
TRACKING_COVERAGE_ACCEPTABLE = 1,
- TRACKING_COVERAGE_OK = 2
+ TRACKING_COVERAGE_OK = 2,
};
/* MovieTrackingPlaneMarker->flag */
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 41b8308c8f8..048b7e60d57 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_userdef_types.h
- * \ingroup DNA
- * \since mar-2001
- * \author nzc
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_USERDEF_TYPES_H__
@@ -53,38 +43,50 @@ struct ColorBand;
#define GPU_VIEWPORT_QUALITY_TAA16 0.6f
#define GPU_VIEWPORT_QUALITY_TAA32 0.8f
-/* default offered by Blender.
- * uiFont.uifont_id */
+/** default offered by Blender.
+ * #uiFont.uifont_id */
typedef enum eUIFont_ID {
UIFONT_DEFAULT = 0,
/* UIFONT_BITMAP = 1 */ /* UNUSED */
/* free slots */
UIFONT_CUSTOM1 = 2,
- UIFONT_CUSTOM2 = 3
+ UIFONT_CUSTOM2 = 3,
} eUIFont_ID;
/* default fonts to load/initialize */
/* first font is the default (index 0), others optional */
typedef struct uiFont {
struct uiFont *next, *prev;
- char filename[1024];/* 1024 = FILE_MAX */
- short blf_id; /* from blfont lib */
- short uifont_id; /* own id (eUIFont_ID) */
- short r_to_l; /* fonts that read from left to right */
- short pad;
+ /** 1024 = FILE_MAX. */
+ char filename[1024];
+ /** From blfont lib. */
+ short blf_id;
+ /** Own id (eUIFont_ID). */
+ short uifont_id;
+ /** Fonts that read from left to right. */
+ short r_to_l;
+ char _pad0[2];
} uiFont;
/* this state defines appearance of text */
typedef struct uiFontStyle {
- short uifont_id; /* saved in file, 0 is default */
- short points; /* actual size depends on 'global' dpi */
- short kerning; /* unfitted or default kerning value. */
- short italic, bold; /* style hint */
- short shadow; /* value is amount of pixels blur */
- short shadx, shady; /* shadow offset in pixels */
- float shadowalpha; /* total alpha */
- float shadowcolor; /* 1 value, typically white or black anyway */
+ /** Saved in file, 0 is default. */
+ short uifont_id;
+ /** Actual size depends on 'global' dpi. */
+ short points;
+ /** Unfitted or default kerning value. */
+ short kerning;
+ /** Style hint. */
+ short italic, bold;
+ /** Value is amount of pixels blur. */
+ short shadow;
+ /** Shadow offset in pixels. */
+ short shadx, shady;
+ /** Total alpha. */
+ float shadowalpha;
+ /** 1 value, typically white or black anyway. */
+ float shadowcolor;
} uiFontStyle;
/* this is fed to the layout engine and widget code */
@@ -92,7 +94,8 @@ typedef struct uiFontStyle {
typedef struct uiStyle {
struct uiStyle *next, *prev;
- char name[64]; /* MAX_STYLE_NAME */
+ /** MAX_STYLE_NAME. */
+ char name[64];
uiFontStyle paneltitle;
uiFontStyle grouplabel;
@@ -101,8 +104,10 @@ typedef struct uiStyle {
float panelzoom;
- short minlabelchars; /* in characters */
- short minwidgetchars; /* in characters */
+ /** In characters. */
+ short minlabelchars;
+ /** In characters. */
+ short minwidgetchars;
short columnspace;
short templatespace;
@@ -112,7 +117,7 @@ typedef struct uiStyle {
short panelspace;
short panelouter;
- short pad;
+ char _pad0[2];
} uiStyle;
typedef struct uiWidgetColors {
@@ -139,23 +144,17 @@ typedef struct uiWidgetStateColors {
char inner_overridden_sel[4];
char inner_changed[4];
char inner_changed_sel[4];
- float blend, pad;
+ float blend;
+ char _pad0[4];
} uiWidgetStateColors;
typedef struct uiPanelColors {
char header[4];
char back[4];
char sub_back[4];
- char pad2[4];
+ char _pad0[4];
} uiPanelColors;
-typedef struct uiGradientColors {
- char gradient[4];
- char high_gradient[4];
- int show_grad;
- int pad2;
-} uiGradientColors;
-
typedef struct ThemeUI {
/* Interface Elements (buttons, menus, icons) */
uiWidgetColors wcol_regular, wcol_tool, wcol_toolbar_item, wcol_text;
@@ -166,8 +165,6 @@ typedef struct ThemeUI {
uiWidgetStateColors wcol_state;
- uiPanelColors panel; /* deprecated, but we keep it for do_versions (2.66.1) */
-
char widget_emboss[4];
/* fac: 0 - 1 for blend factor, width in pixels */
@@ -175,9 +172,8 @@ typedef struct ThemeUI {
short menu_shadow_width;
char editor_outline[4];
- short pad[1];
+ char _pad0[2];
- char iconfile[256]; // FILE_MAXFILE length
float icon_alpha;
float icon_saturation;
char _pad[4];
@@ -193,11 +189,16 @@ typedef struct ThemeUI {
char gizmo_b[4];
/* Icon Colors. */
- char icon_collection[4]; /* Collection items */
- char icon_object[4]; /* Object items */
- char icon_object_data[4]; /* Object data items */
- char icon_modifier[4]; /* Modifier and constraint items */
- char icon_shading[4]; /* Shading related items */
+ /** Collection items. */
+ char icon_collection[4];
+ /** Object items. */
+ char icon_object[4];
+ /** Object data items. */
+ char icon_object_data[4];
+ /** Modifier and constraint items. */
+ char icon_modifier[4];
+ /** Shading related items. */
+ char icon_shading[4];
} ThemeUI;
/* try to put them all in one, if needed a special struct can be created as well
@@ -206,13 +207,21 @@ typedef struct ThemeUI {
typedef struct ThemeSpace {
/* main window colors */
char back[4];
- char title[4]; /* panel title */
+ char back_grad[4];
+
+ char show_back_grad;
+ char _pad0[3];
+
+ /** Panel title. */
+ char title[4];
char text[4];
char text_hi[4];
/* header colors */
- char header[4]; /* region background */
- char header_title[4]; /* unused */
+ /** Region background. */
+ char header[4];
+ /** Unused. */
+ char header_title[4];
char header_text[4];
char header_text_hi[4];
@@ -223,32 +232,30 @@ typedef struct ThemeSpace {
char tab_outline[4];
/* button/tool regions */
- char button[4]; /* region background */
- char button_title[4]; /* panel title */
+ /** Region background. */
+ char button[4];
+ /** Panel title. */
+ char button_title[4];
char button_text[4];
char button_text_hi[4];
/* listview regions */
- char list[4]; /* region background */
- char list_title[4]; /* panel title */
+ /** Region background. */
+ char list[4];
+ /** Panel title. */
+ char list_title[4];
char list_text[4];
char list_text_hi[4];
/* navigation bar regions */
- char navigation_bar[4]; /* region background */
- char execution_buts[4]; /* region background */
-
- /* float panel */
-/* char panel[4]; unused */
-/* char panel_title[4]; unused */
-/* char panel_text[4]; unused */
-/* char panel_text_hi[4]; unused */
+ /** Region background. */
+ char navigation_bar[4];
+ /** Region background. */
+ char execution_buts[4];
/* note, cannot use name 'panel' because of DNA mapping old files */
uiPanelColors panelcolors;
- uiGradientColors gradients;
-
char shade1[4];
char shade2[4];
@@ -263,8 +270,10 @@ typedef struct ThemeSpace {
char vertex[4], vertex_select[4], vertex_bevel[4], vertex_unreferenced[4];
char edge[4], edge_select[4];
char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4], edge_bevel[4];
- char face[4], face_select[4]; /* solid faces */
- char face_dot[4]; /* selected color */
+ /** Solid faces. */
+ char face[4], face_select[4];
+ /** selected color. */
+ char face_dot[4];
char extra_edge_len[4], extra_edge_angle[4], extra_face_angle[4], extra_face_area[4];
char normal[4];
char vertex_normal[4];
@@ -281,11 +290,14 @@ typedef struct ThemeSpace {
char handle_free[4], handle_auto[4], handle_vect[4], handle_align[4], handle_auto_clamped[4];
char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4], handle_sel_auto_clamped[4];
- char ds_channel[4], ds_subchannel[4], ds_ipoline[4]; /* dopesheet */
- char keytype_keyframe[4], keytype_extreme[4], keytype_breakdown[4], keytype_jitter[4], keytype_movehold[4]; /* keytypes */
- char keytype_keyframe_select[4], keytype_extreme_select[4], keytype_breakdown_select[4], keytype_jitter_select[4], keytype_movehold_select[4]; /* keytypes */
+ /** Dopesheet. */
+ char ds_channel[4], ds_subchannel[4], ds_ipoline[4];
+ /** Keytypes. */
+ char keytype_keyframe[4], keytype_extreme[4], keytype_breakdown[4], keytype_jitter[4], keytype_movehold[4];
+ /** Keytypes. */
+ char keytype_keyframe_select[4], keytype_extreme_select[4], keytype_breakdown_select[4], keytype_jitter_select[4], keytype_movehold_select[4];
char keyborder[4], keyborder_select[4];
- char pad[4];
+ char _pad4[4];
char console_output[4], console_input[4], console_info[4], console_error[4];
char console_cursor[4], console_select[4];
@@ -304,10 +316,12 @@ typedef struct ThemeSpace {
char nodeclass_shader[4], nodeclass_script[4];
char nodeclass_pattern[4], nodeclass_layout[4];
- char movie[4], movieclip[4], mask[4], image[4], scene[4], audio[4]; /* for sequence editor */
+ /** For sequence editor. */
+ char movie[4], movieclip[4], mask[4], image[4], scene[4], audio[4];
char effect[4], transition[4], meta[4], text_strip[4];
- float keyframe_scale_fac; /* for dopesheet - scale factor for size of keyframes (i.e. height of channels) */
+ /** For dopesheet - scale factor for size of keyframes (i.e. height of channels). */
+ float keyframe_scale_fac;
char editmesh_active[4];
@@ -322,7 +336,7 @@ typedef struct ThemeSpace {
char bundle_solid[4];
char path_before[4], path_after[4];
char camera_path[4];
- char hpad[2];
+ char _pad1[2];
char gp_vertex_size;
char gp_vertex[4], gp_vertex_select[4];
@@ -335,26 +349,39 @@ typedef struct ThemeSpace {
char preview_stitch_unstitchable[4];
char preview_stitch_active[4];
- char uv_shadow[4]; /* two uses, for uvs with modifier applied on mesh and uvs during painting */
- char uv_others[4]; /* uvs of other objects */
+ /** Two uses, for uvs with modifier applied on mesh and uvs during painting. */
+ char uv_shadow[4];
+ /** Uvs of other objects. */
+ char uv_others[4];
- char match[4]; /* outliner - filter match */
- char selected_highlight[4]; /* outliner - selected item */
+ /** Outliner - filter match. */
+ char match[4];
+ /** Outliner - selected item. */
+ char selected_highlight[4];
- char skin_root[4]; /* Skin modifier root color */
+ /** Skin modifier root color. */
+ char skin_root[4];
/* NLA */
- char anim_active[4]; /* Active Action + Summary Channel */
- char anim_non_active[4]; /* Active Action = NULL */
- char anim_preview_range[4]; /* Preview range overlay */
- char anim_pad[4];
-
- char nla_tweaking[4]; /* NLA 'Tweaking' action/strip */
- char nla_tweakdupli[4]; /* NLA - warning color for duplicate instances of tweaking strip */
-
- char nla_transition[4], nla_transition_sel[4]; /* NLA "Transition" strips */
- char nla_meta[4], nla_meta_sel[4]; /* NLA "Meta" strips */
- char nla_sound[4], nla_sound_sel[4]; /* NLA "Sound" strips */
+ /** Active Action + Summary Channel. */
+ char anim_active[4];
+ /** Active Action = NULL. */
+ char anim_non_active[4];
+ /** Preview range overlay. */
+ char anim_preview_range[4];
+ char _pad2[4];
+
+ /** NLA 'Tweaking' action/strip. */
+ char nla_tweaking[4];
+ /** NLA - warning color for duplicate instances of tweaking strip. */
+ char nla_tweakdupli[4];
+
+ /** NLA "Transition" strips. */
+ char nla_transition[4], nla_transition_sel[4];
+ /** NLA "Meta" strips. */
+ char nla_meta[4], nla_meta_sel[4];
+ /** NLA "Sound" strips. */
+ char nla_sound[4], nla_sound_sel[4];
/* info */
char info_selected[4], info_selected_text[4];
@@ -377,11 +404,12 @@ typedef struct ThemeWireColor {
char select[4];
char active[4];
- short flag; /* eWireColor_Flags */
- short pad;
+ /** #eWireColor_Flags. */
+ short flag;
+ char _pad0[2];
} ThemeWireColor;
-/* ThemeWireColor.flag */
+/** #ThemeWireColor.flag */
typedef enum eWireColor_Flags {
TH_WIRECOLOR_CONSTCOLS = (1 << 0),
TH_WIRECOLOR_TEXTCOLS = (1 << 1),
@@ -396,30 +424,30 @@ typedef struct bTheme {
/* Individual Spacetypes */
/* note: ensure UI_THEMESPACE_END is updated when adding */
- ThemeSpace tbuts;
- ThemeSpace tv3d;
- ThemeSpace tfile;
- ThemeSpace tipo;
- ThemeSpace tinfo;
- ThemeSpace tact;
- ThemeSpace tnla;
- ThemeSpace tseq;
- ThemeSpace tima;
- ThemeSpace text;
- ThemeSpace toops;
- ThemeSpace ttime;
- ThemeSpace tnode;
- ThemeSpace tuserpref;
- ThemeSpace tconsole;
- ThemeSpace tclip;
- ThemeSpace ttopbar;
- ThemeSpace tstatusbar;
+ ThemeSpace space_properties;
+ ThemeSpace space_view3d;
+ ThemeSpace space_file;
+ ThemeSpace space_graph;
+ ThemeSpace space_info;
+ ThemeSpace space_action;
+ ThemeSpace space_nla;
+ ThemeSpace space_sequencer;
+ ThemeSpace space_image;
+ ThemeSpace space_text;
+ ThemeSpace space_outliner;
+ ThemeSpace space_node;
+ ThemeSpace space_preferences;
+ ThemeSpace space_console;
+ ThemeSpace space_clip;
+ ThemeSpace space_topbar;
+ ThemeSpace space_statusbar;
/* 20 sets of bone colors for this theme */
ThemeWireColor tarm[20];
/*ThemeWireColor tobj[20];*/
- int active_theme_area, pad;
+ int active_theme_area;
+ char _pad0[4];
} bTheme;
#define UI_THEMESPACE_START(btheme) (CHECK_TYPE_INLINE(btheme, bTheme *), &((btheme)->tbuts))
@@ -428,13 +456,16 @@ typedef struct bTheme {
typedef struct bAddon {
struct bAddon *next, *prev;
char module[64];
- IDProperty *prop; /* User-Defined Properties on this Addon (for storing preferences) */
+ /** User-Defined Properties on this Addon (for storing preferences). */
+ IDProperty *prop;
} bAddon;
typedef struct bPathCompare {
struct bPathCompare *next, *prev;
- char path[768]; /* FILE_MAXDIR */
- char flag, pad[7];
+ /** FILE_MAXDIR. */
+ char path[768];
+ char flag;
+ char _pad0[7];
} bPathCompare;
typedef struct bUserMenu {
@@ -485,51 +516,64 @@ enum {
typedef struct SolidLight {
int flag;
float smooth;
- float pad[2];
+ char _pad0[8];
float col[4], spec[4], vec[4];
} SolidLight;
typedef struct WalkNavigation {
- float mouse_speed; /* speed factor for look around */
+ /** Speed factor for look around. */
+ float mouse_speed;
float walk_speed;
float walk_speed_factor;
float view_height;
float jump_height;
- float teleport_time; /* duration to use for teleporting */
+ /** Duration to use for teleporting. */
+ float teleport_time;
short flag;
- short pad[3];
+ char _pad0[6];
} WalkNavigation;
typedef struct UserDef {
/* UserDef has separate do-version handling, and can be read from other files */
int versionfile, subversionfile;
- int flag; /* eUserPref_Flag */
- int dupflag; /* eDupli_ID_Flags */
+ /** #eUserPref_Flag. */
+ int flag;
+ /** #eDupli_ID_Flags. */
+ int dupflag;
int savetime;
- char tempdir[768]; /* FILE_MAXDIR length */
+ /** FILE_MAXDIR length. */
+ char tempdir[768];
char fontdir[768];
- char renderdir[1024]; /* FILE_MAX length */
+ /** FILE_MAX length. */
+ char renderdir[1024];
/* EXR cache path */
- char render_cachedir[768]; /* 768 = FILE_MAXDIR */
+ /** 768 = FILE_MAXDIR. */
+ char render_cachedir[768];
char textudir[768];
char pythondir[768];
char sounddir[768];
char i18ndir[768];
- char image_editor[1024]; /* 1024 = FILE_MAX */
- char anim_player[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char image_editor[1024];
+ /** 1024 = FILE_MAX. */
+ char anim_player[1024];
int anim_player_preset;
- short v2d_min_gridsize; /* minimum spacing between gridlines in View2D grids */
- short timecode_style; /* eTimecodeStyles, style of timecode display */
+ /** Minimum spacing between gridlines in View2D grids. */
+ short v2d_min_gridsize;
+ /** #eTimecodeStyles, style of timecode display. */
+ short timecode_style;
short versions;
short dbl_click_time;
- short pad;
+ char _pad0[2];
short wheellinescroll;
- int uiflag; /* eUserpref_UI_Flag */
- int uiflag2; /* eUserpref_UI_Flag2 */
+ /** #eUserpref_UI_Flag. */
+ int uiflag;
+ /** #eUserpref_UI_Flag2. */
+ int uiflag2;
/* Experimental flag for app-templates to make changes to behavior
* which are outside the scope of typical preferences. */
short app_flag;
@@ -544,17 +588,26 @@ typedef struct UserDef {
int audioformat;
int audiochannels;
- float ui_scale; /* setting for UI scale */
- int ui_line_width; /* setting for UI line width */
- int dpi; /* runtime, full DPI divided by pixelsize */
- float dpi_fac; /* runtime, multiplier to scale UI elements based on DPI */
- float pixelsize; /* runtime, line width and point size based on DPI */
- int virtual_pixel; /* deprecated, for forward compatibility */
-
- int scrollback; /* console scrollback limit */
- char node_margin; /* node insert offset (aka auto-offset) margin, but might be useful for later stuff as well */
- char pad2[5];
- short transopts; /* eUserpref_Translation_Flags */
+ /** Setting for UI scale. */
+ float ui_scale;
+ /** Setting for UI line width. */
+ int ui_line_width;
+ /** Runtime, full DPI divided by pixelsize. */
+ int dpi;
+ /** Runtime, multiplier to scale UI elements based on DPI. */
+ float dpi_fac;
+ /** Runtime, line width and point size based on DPI. */
+ float pixelsize;
+ /** Deprecated, for forward compatibility. */
+ int virtual_pixel;
+
+ /** Console scrollback limit. */
+ int scrollback;
+ /** Node insert offset (aka auto-offset) margin, but might be useful for later stuff as well. */
+ char node_margin;
+ char _pad2[5];
+ /** #eUserpref_Translation_Flags. */
+ short transopts;
short menuthreshold1, menuthreshold2;
/* startup template */
@@ -564,85 +617,113 @@ typedef struct UserDef {
struct ListBase uifonts;
struct ListBase uistyles;
struct ListBase user_keymaps;
- struct ListBase user_keyconfig_prefs; /* wmKeyConfigPref. */
+ /** #wmKeyConfigPref. */
+ struct ListBase user_keyconfig_prefs;
struct ListBase addons;
struct ListBase autoexec_paths;
- struct ListBase user_menus; /* bUserMenu */
+ /** #bUserMenu. */
+ struct ListBase user_menus;
char keyconfigstr[64];
short undosteps;
- short pad1;
+ char _pad1[2];
int undomemory;
float gpu_viewport_quality;
short gp_manhattendist, gp_euclideandist, gp_eraser;
- short gp_settings; /* eGP_UserdefSettings */
- short tb_leftmouse, tb_rightmouse;
- /* struct SolidLight light[3] DNA_DEPRECATED; */ /* Was using non-aligned struct! */
+ /** #eGP_UserdefSettings. */
+ short gp_settings;
+ char _pad13[4];
struct SolidLight light_param[4];
- float light_ambient[3], pad7;
+ float light_ambient[3];
+ char _pad3[4];
short gizmo_flag, gizmo_size;
short edit_studio_light;
- short pad6[2];
+ char _pad6[4];
short textimeout, texcollectrate;
- short dragthreshold;
+ char _pad14[2];
int memcachelimit;
int prefetchframes;
- float pad_rot_angle; /* control the rotation step of the view when PAD2, PAD4, PAD6&PAD8 is use */
- short _pad0;
+ /** Control the rotation step of the view when PAD2, PAD4, PAD6&PAD8 is use. */
+ float pad_rot_angle;
+ char _pad12[2];
short obcenter_dia;
- short rvisize; /* rotating view icon size */
- short rvibright; /* rotating view icon brightness */
- short recent_files; /* maximum number of recently used files to remember */
- short smooth_viewtx; /* milliseconds to spend spinning the view */
+ /** Rotating view icon size. */
+ short rvisize;
+ /** Rotating view icon brightness. */
+ short rvibright;
+ /** Maximum number of recently used files to remember . */
+ short recent_files;
+ /** Milliseconds to spend spinning the view. */
+ short smooth_viewtx;
short glreslimit;
short curssize;
- short color_picker_type; /* eColorPicker_Types */
- char ipo_new; /* interpolation mode for newly added F-Curves */
- char keyhandles_new; /* handle types for newly added keyframes */
- char gpu_select_method;
+ /** #eColorPicker_Types. */
+ short color_picker_type;
+ /** Interpolation mode for newly added F-Curves. */
+ char ipo_new;
+ /** Handle types for newly added keyframes. */
+ char keyhandles_new;
char gpu_select_pick_deph;
- char pad0;
- char view_frame_type; /* eZoomFrame_Mode */
+ char _pad11[2];
+ /** #eZoomFrame_Mode. */
+ char view_frame_type;
- int view_frame_keyframes; /* number of keyframes to zoom around current frame */
- float view_frame_seconds; /* seconds to zoom around current frame */
+ /** Number of keyframes to zoom around current frame. */
+ int view_frame_keyframes;
+ /** Seconds to zoom around current frame. */
+ float view_frame_seconds;
- char _pad1[4];
+ char _pad7[6];
- short widget_unit; /* private, defaults to 20 for 72 DPI setting */
+ /** Private, defaults to 20 for 72 DPI setting. */
+ short widget_unit;
short anisotropic_filter;
- short use_16bit_textures, use_gpu_mipmap;
- float pressure_threshold_max; /* raw tablet pressure that maps to 100% */
- float pressure_softness; /* curve non-linearity parameter */
+ /** Tablet API to use (Windows only). */
+ short tablet_api;
+
+ /** Raw tablet pressure that maps to 100%. */
+ float pressure_threshold_max;
+ /** Curve non-linearity parameter. */
+ float pressure_softness;
- float ndof_sensitivity; /* overall sensitivity of 3D mouse */
+ /** Overall sensitivity of 3D mouse. */
+ float ndof_sensitivity;
float ndof_orbit_sensitivity;
- float ndof_deadzone; /* deadzone of 3D mouse */
- int ndof_flag; /* eNdof_Flag, flags for 3D mouse */
+ /** Deadzone of 3D mouse. */
+ float ndof_deadzone;
+ /** #eNdof_Flag, flags for 3D mouse. */
+ int ndof_flag;
- short ogl_multisamples; /* eMultiSample_Type, amount of samples for OpenGL FSA, if zero no FSA */
+ /** #eMultiSample_Type, amount of samples for OpenGL FSA, if zero no FSA. */
+ short ogl_multisamples;
- /* eImageDrawMethod, Method to be used to draw the images (AUTO, GLSL, Textures or DrawPixels) */
+ /** eImageDrawMethod, Method to be used to draw the images
+ * (AUTO, GLSL, Textures or DrawPixels) */
short image_draw_method;
float glalphaclip;
- short autokey_mode; /* eAutokey_Mode, autokeying mode */
- short autokey_flag; /* flags for autokeying */
+ /** #eAutokey_Mode, autokeying mode. */
+ short autokey_mode;
+ /** Flags for autokeying. */
+ short autokey_flag;
- short text_render, pad9; /* options for text rendering */
+ /** Options for text rendering. */
+ short text_render;
+ char _pad9[2];
- struct ColorBand coba_weight; /* from texture.h */
+ /** From texture.h. */
+ struct ColorBand coba_weight;
float sculpt_paint_overlay_col[3];
- float gpencil_new_layer_col[4]; /* default color for newly created Grease Pencil layers */
+ /** Default color for newly created Grease Pencil layers. */
+ float gpencil_new_layer_col[4];
short tweak_threshold;
- char navigation_mode, pad10;
-
- char author[80]; /* author name for file formats supporting it */
+ char navigation_mode;
+ char _pad10;
char font_path_ui[1024];
char font_path_ui_mono[1024];
@@ -650,39 +731,49 @@ typedef struct UserDef {
int compute_device_type;
int compute_device_id;
- float fcu_inactive_alpha; /* opacity of inactive F-Curves in F-Curve Editor */
+ /** Opacity of inactive F-Curves in F-Curve Editor. */
+ float fcu_inactive_alpha;
- short pie_interaction_type; /* if keeping a pie menu spawn button pressed after this time, it turns into
- * a drag/release pie menu */
- short pie_initial_timeout; /* direction in the pie menu will always be calculated from the initial position
- * within this time limit */
+ /**
+ * If keeping a pie menu spawn button pressed after this time,
+ * it turns into a drag/release pie menu.
+ */
+ short pie_tap_timeout;
+ /**
+ * Direction in the pie menu will always be calculated from the
+ * initial position within this time limit.
+ */
+ short pie_initial_timeout;
short pie_animation_timeout;
short pie_menu_confirm;
- short pie_menu_radius; /* pie menu radius */
- short pie_menu_threshold; /* pie menu distance from center before a direction is set */
+ /** Pie menu radius. */
+ short pie_menu_radius;
+ /** Pie menu distance from center before a direction is set. */
+ short pie_menu_threshold;
struct WalkNavigation walk_navigation;
short opensubdiv_compute_type;
- short gpencil_multisamples; /* eMultiSample_Type, amount of samples for Grease Pencil */
+ /** #eMultiSample_Type, amount of samples for Grease Pencil. */
+ short gpencil_multisamples;
- char pad5[4];
+ char _pad5[4];
} UserDef;
-extern UserDef U; /* from blenkernel blender.c */
+/* from blenkernel blender.c */
+extern UserDef U;
/* ***************** USERDEF ****************** */
/* Toggles for unfinished 2.8 UserPref design. */
//#define WITH_USERDEF_WORKSPACES
-//#define WITH_USERDEF_SYSTEM_SPLIT
-/* UserDef.userpref (UI active_section) */
+/** #UserDef.userpref (UI active_section) */
typedef enum eUserPref_Section {
USER_SECTION_INTERFACE = 0,
- USER_SECTION_EDIT = 1,
- USER_SECTION_SYSTEM_FILES = 2,
- USER_SECTION_SYSTEM_GENERAL = 3,
+ USER_SECTION_EDITING = 1,
+ USER_SECTION_SAVE_LOAD = 2,
+ USER_SECTION_SYSTEM = 3,
USER_SECTION_THEME = 4,
USER_SECTION_INPUT = 5,
USER_SECTION_ADDONS = 6,
@@ -693,10 +784,10 @@ typedef enum eUserPref_Section {
USER_SECTION_WORKSPACE_ADDONS = 10,
USER_SECTION_WORKSPACE_KEYMAPS = 11,
#endif
-#ifdef WITH_USERDEF_SYSTEM_SPLIT
- USER_SECTION_SYSTEM_DISPLAY = 12,
- USER_SECTION_SYSTEM_DEVICES = 13,
-#endif
+ USER_SECTION_VIEWPORT = 12,
+ USER_SECTION_ANIMATION = 13,
+ USER_SECTION_NAVIGATION = 14,
+ USER_SECTION_FILE_PATHS = 15,
} eUserPref_Section;
/* UserDef.userpref_flag (State of the user preferences UI). */
@@ -705,7 +796,7 @@ typedef enum eUserPref_SectionFlag {
USER_SECTION_INPUT_HIDE_UI_KEYCONFIG = (1 << 0),
} eUserPref_SectionFlag;
-/* UserDef.flag */
+/** #UserDef.flag */
typedef enum eUserPref_Flag {
USER_AUTOSAVE = (1 << 0),
USER_FLAG_NUMINPUT_ADVANCED = (1 << 1),
@@ -736,46 +827,48 @@ typedef enum eUserPref_Flag {
USER_TOOLTIPS_PYTHON = (1 << 26),
} eUserPref_Flag;
-/* bPathCompare.flag */
+/** #bPathCompare.flag */
typedef enum ePathCompare_Flag {
USER_PATHCMP_GLOB = (1 << 0),
} ePathCompare_Flag;
-/* helper macro for checking frame clamping */
+/* Helper macro for checking frame clamping */
#define FRAMENUMBER_MIN_CLAMP(cfra) { \
if ((U.flag & USER_NONEGFRAMES) && (cfra < 0)) \
cfra = 0; \
} (void)0
-/* UserDef.viewzoom */
+/** #UserDef.viewzoom */
typedef enum eViewZoom_Style {
USER_ZOOM_CONT = 0,
USER_ZOOM_SCALE = 1,
- USER_ZOOM_DOLLY = 2
+ USER_ZOOM_DOLLY = 2,
} eViewZoom_Style;
-/* UserDef.navigation_mode */
+/** #UserDef.navigation_mode */
typedef enum eViewNavigation_Method {
VIEW_NAVIGATION_WALK = 0,
VIEW_NAVIGATION_FLY = 1,
} eViewNavigation_Method;
-/* UserDef.flag */
+/** #UserDef.flag */
typedef enum eWalkNavigation_Flag {
USER_WALK_GRAVITY = (1 << 0),
USER_WALK_MOUSE_REVERSE = (1 << 1),
} eWalkNavigation_Flag;
-/* UserDef.uiflag */
+/** #UserDef.uiflag */
typedef enum eUserpref_UI_Flag {
- /* flags 0 and 1 were old flags (for autokeying) that aren't used anymore */
+ USER_UIFLAG_DEPRECATED_0 = (1 << 0), /* cleared */
+ USER_UIFLAG_DEPRECATED_1 = (1 << 1), /* cleared */
USER_WHEELZOOMDIR = (1 << 2),
USER_FILTERFILEEXTS = (1 << 3),
USER_DRAWVIEWINFO = (1 << 4),
USER_PLAINMENUS = (1 << 5),
USER_LOCK_CURSOR_ADJUST = (1 << 6),
USER_HEADER_BOTTOM = (1 << 7),
- USER_UIFLAG_DEPRECATED_8 = (1 << 8), /* cleared */
+ /** Otherwise use header alignment from the file. */
+ USER_HEADER_FROM_PREF = (1 << 8),
USER_MENUOPENAUTO = (1 << 9),
USER_DEPTH_CURSOR = (1 << 10),
USER_AUTOPERSP = (1 << 11),
@@ -797,44 +890,53 @@ typedef enum eUserpref_UI_Flag {
USER_SPLASH_DISABLE = (1 << 27),
USER_HIDE_RECENT = (1 << 28),
USER_SHOW_THUMBNAILS = (1 << 29),
- USER_QUIT_PROMPT = (1 << 30),
- USER_HIDE_SYSTEM_BOOKMARKS = (1u << 31)
+ USER_SAVE_PROMPT = (1 << 30),
+ USER_HIDE_SYSTEM_BOOKMARKS = (1u << 31),
} eUserpref_UI_Flag;
-/* UserDef.uiflag2 */
+/** #UserDef.uiflag2 */
typedef enum eUserpref_UI_Flag2 {
- USER_KEEP_SESSION = (1 << 0),
+ USER_UIFLAG2_DEPRECATED_0 = (1 << 0),
USER_REGION_OVERLAP = (1 << 1),
USER_TRACKPAD_NATURAL = (1 << 2),
+ USER_EDIT_MODE_SMOOTH_WIRE = (1 << 3),
} eUserpref_UI_Flag2;
-/* UserDef.app_flag */
+/** #UserDef.tablet_api */
+typedef enum eUserpref_TableAPI {
+ USER_TABLET_AUTOMATIC = 0,
+ USER_TABLET_NATIVE = 1,
+ USER_TABLET_WINTAB = 2,
+} eUserpref_TabletAPI;
+
+/** #UserDef.app_flag */
typedef enum eUserpref_APP_Flag {
USER_APP_LOCK_UI_LAYOUT = (1 << 0),
} eUserpref_APP_Flag;
-/* Auto-Keying mode.
- * UserDef.autokey_mode */
+/** Auto-Keying mode.
+ * #UserDef.autokey_mode */
typedef enum eAutokey_Mode {
/* AUTOKEY_ON is a bitflag */
AUTOKEY_ON = 1,
- /* AUTOKEY_ON + 2**n... (i.e. AUTOKEY_MODE_NORMAL = AUTOKEY_ON + 2) to preserve setting, even when autokey turned off */
+ /** AUTOKEY_ON + 2**n... (i.e. AUTOKEY_MODE_NORMAL = AUTOKEY_ON + 2)
+ * to preserve setting, even when autokey turned off */
AUTOKEY_MODE_NORMAL = 3,
- AUTOKEY_MODE_EDITKEYS = 5
+ AUTOKEY_MODE_EDITKEYS = 5,
} eAutokey_Mode;
-/* Zoom to frame mode.
- * UserDef.view_frame_type */
+/** Zoom to frame mode.
+ * #UserDef.view_frame_type */
typedef enum eZoomFrame_Mode {
ZOOM_FRAME_MODE_KEEP_RANGE = 0,
ZOOM_FRAME_MODE_SECONDS = 1,
- ZOOM_FRAME_MODE_KEYFRAMES = 2
+ ZOOM_FRAME_MODE_KEYFRAMES = 2,
} eZoomFrame_Mode;
-/* Auto-Keying flag
- * U.autokey_flag (not strictly used when autokeying only - is also used when keyframing these days)
- * note: AUTOKEY_FLAG_* is used with a macro, search for lines like IS_AUTOKEY_FLAG(INSERTAVAIL)
+/** Auto-Keying flag
+ * #UserDef.autokey_flag (not strictly used when autokeying only - is also used when keyframing these days)
+ * \note #eAutokey_Flag is used with a macro, search for lines like IS_AUTOKEY_FLAG(INSERTAVAIL).
*/
typedef enum eAutokey_Flag {
AUTOKEY_FLAG_INSERTAVAIL = (1 << 0),
@@ -849,7 +951,7 @@ typedef enum eAutokey_Flag {
ANIMRECORD_FLAG_WITHNLA = (1 << 10),
} eAutokey_Flag;
-/* UserDef.transopts */
+/** #UserDef.transopts */
typedef enum eUserpref_Translation_Flags {
USER_TR_TOOLTIPS = (1 << 0),
USER_TR_IFACE = (1 << 1),
@@ -862,7 +964,7 @@ typedef enum eUserpref_Translation_Flags {
USER_TR_NEWDATANAME = (1 << 8),
} eUserpref_Translation_Flags;
-/* UserDef.dupflag */
+/** #UserDef.dupflag */
typedef enum eDupli_ID_Flags {
USER_DUP_MESH = (1 << 0),
USER_DUP_CURVE = (1 << 1),
@@ -875,25 +977,19 @@ typedef enum eDupli_ID_Flags {
USER_DUP_TEX = (1 << 8),
USER_DUP_ARM = (1 << 9),
USER_DUP_ACT = (1 << 10),
- USER_DUP_PSYS = (1 << 11)
+ USER_DUP_PSYS = (1 << 11),
} eDupli_ID_Flags;
-/* selection method for opengl gpu_select_method */
-typedef enum eOpenGL_SelectOptions {
- USER_SELECT_AUTO = 0,
- USER_SELECT_USE_OCCLUSION_QUERY = 1,
- USER_SELECT_USE_SELECT_RENDERMODE = 2
-} eOpenGL_SelectOptions;
-
-/* max anti alias draw method UserDef.gpu_viewport_antialias */
+/** Max anti alias draw method
+ * #UserDef.gpu_viewport_antialias */
typedef enum eOpenGL_AntiAliasMethod {
USER_AA_NONE = 0,
USER_AA_FXAA = 1,
USER_AA_TAA8 = 2,
} eOpenGL_AntiAliasMethod;
-/* text draw options
- * UserDef.text_render */
+/** Text draw options
+ * #UserDef.text_render */
typedef enum eText_Draw_Options {
USER_TEXT_DISABLE_AA = (1 << 0),
@@ -902,12 +998,10 @@ typedef enum eText_Draw_Options {
USER_TEXT_HINTING_FULL = (1 << 3),
} eText_Draw_Options;
-/* tw_flag (transform widget) */
-
-/* Grease Pencil Settings.
- * UserDef.gp_settings */
+/** Grease Pencil Settings.
+ * #UserDef.gp_settings */
typedef enum eGP_UserdefSettings {
- GP_PAINT_DOSMOOTH = (1 << 0),
+ GP_PAINT_DEPRECATED_0 = (1 << 0),
GP_PAINT_DOSIMPLIFY = (1 << 1),
} eGP_UserdefSettings;
@@ -915,8 +1009,8 @@ enum {
USER_GIZMO_DRAW = (1 << 0),
};
-/* Color Picker Types.
- * UserDef.color_picker_type */
+/** Color Picker Types.
+ * #UserDef.color_picker_type */
typedef enum eColorPicker_Types {
USER_CP_CIRCLE_HSV = 0,
USER_CP_SQUARE_SV = 1,
@@ -925,8 +1019,8 @@ typedef enum eColorPicker_Types {
USER_CP_CIRCLE_HSL = 4,
} eColorPicker_Types;
-/* timecode display styles
- * UserDef.timecode_style */
+/** Timecode display styles
+ * #UserDef.timecode_style */
typedef enum eTimecodeStyles {
/* as little info as is necessary to show relevant info
* with '+' to denote the frames
@@ -951,17 +1045,7 @@ typedef enum eTimecodeStyles {
USER_TIMECODE_SUBRIP = 100,
} eTimecodeStyles;
-/* theme drawtypes */
-/* XXX: These are probably only for the old UI engine? */
-typedef enum eTheme_DrawTypes {
- TH_MINIMAL = 0,
- TH_ROUNDSHADED = 1,
- TH_ROUNDED = 2,
- TH_OLDSKOOL = 3,
- TH_SHADED = 4
-} eTheme_DrawTypes;
-
-/* UserDef.ndof_flag (3D mouse options) */
+/** #UserDef.ndof_flag (3D mouse options) */
typedef enum eNdof_Flag {
NDOF_SHOW_GUIDE = (1 << 0),
NDOF_FLY_HELICOPTER = (1 << 1),
@@ -994,7 +1078,7 @@ typedef enum eNdof_Flag {
#define NDOF_PIXELS_PER_SECOND 600.0f
-/* UserDef.ogl_multisamples and gpencil_multisamples */
+/** UserDef.ogl_multisamples and gpencil_multisamples */
typedef enum eMultiSample_Type {
USER_MULTISAMPLE_NONE = 0,
USER_MULTISAMPLE_2 = 2,
@@ -1003,7 +1087,7 @@ typedef enum eMultiSample_Type {
USER_MULTISAMPLE_16 = 16,
} eMultiSample_Type;
-/* UserDef.image_draw_method */
+/** #UserDef.image_draw_method */
typedef enum eImageDrawMethod {
/* IMAGE_DRAW_METHOD_AUTO = 0, */ /* Currently unused */
IMAGE_DRAW_METHOD_GLSL = 1,
@@ -1011,7 +1095,7 @@ typedef enum eImageDrawMethod {
IMAGE_DRAW_METHOD_DRAWPIXELS = 3,
} eImageDrawMethod;
-/* UserDef.virtual_pixel */
+/** #UserDef.virtual_pixel */
typedef enum eUserpref_VirtualPixel {
VIRTUAL_PIXEL_NATIVE = 0,
VIRTUAL_PIXEL_DOUBLE = 1,
diff --git a/source/blender/makesdna/DNA_vec_types.h b/source/blender/makesdna/DNA_vec_types.h
index 4a7aaaaa940..a8aeecf53dc 100644
--- a/source/blender/makesdna/DNA_vec_types.h
+++ b/source/blender/makesdna/DNA_vec_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file DNA_vec_types.h
- * \ingroup DNA
- * \since dec-2000
- * \author nzc
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_VEC_TYPES_H__
diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h
index 721a97742b9..225249a49b4 100644
--- a/source/blender/makesdna/DNA_vfont_types.h
+++ b/source/blender/makesdna/DNA_vfont_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_vfont_types.h
- * \ingroup DNA
- * \since mar-2001
- * \author nzc
+/** \file
+ * \ingroup DNA
*
* Vector Fonts used for text in the 3D view-port
* (unrelated to text used to render the GUI).
@@ -45,7 +35,8 @@ struct VFontData;
typedef struct VFont {
ID id;
- char name[1024]; /* 1024 = FILE_MAX */
+ /** 1024 = FILE_MAX. */
+ char name[1024];
struct VFontData *data;
struct PackedFile *packedfile;
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index e2d8d836368..d761cb7ff91 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_view2d_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_VIEW2D_TYPES_H__
@@ -38,35 +30,55 @@
/* View 2D data - stored per region */
typedef struct View2D {
- rctf tot, cur; /* tot - area that data can be drawn in; cur - region of tot that is visible in viewport */
- rcti vert, hor; /* vert - vertical scrollbar region; hor - horizontal scrollbar region */
- rcti mask; /* mask - region (in screenspace) within which 'cur' can be viewed */
-
- float min[2], max[2]; /* min/max sizes of 'cur' rect (only when keepzoom not set) */
- float minzoom, maxzoom; /* allowable zoom factor range (only when (keepzoom & V2D_LIMITZOOM)) is set */
-
- short scroll; /* scroll - scrollbars to display (bitflag) */
- short scroll_ui; /* scroll_ui - temp settings used for UI drawing of scrollers */
-
- short keeptot; /* keeptot - 'cur' rect cannot move outside the 'tot' rect? */
- short keepzoom; /* keepzoom - axes that zooming cannot occur on, and also clamp within zoom-limits */
- short keepofs; /* keepofs - axes that translation is not allowed to occur on */
-
- short flag; /* settings */
- short align; /* alignment of content in totrect */
-
- short winx, winy; /* storage of current winx/winy values, set in UI_view2d_size_update */
- short oldwinx, oldwiny; /* storage of previous winx/winy values encountered by UI_view2d_curRect_validate(), for keepaspect */
-
- short around; /* pivot point for transforms (rotate and scale) */
-
- float *tab_offset; /* different offset per tab, for buttons */
- int tab_num; /* number of tabs stored */
- int tab_cur; /* current tab */
+ /** Tot - area that data can be drawn in; cur - region of tot that is visible in viewport. */
+ rctf tot, cur;
+ /** Vert - vertical scrollbar region; hor - horizontal scrollbar region. */
+ rcti vert, hor;
+ /** Mask - region (in screenspace) within which 'cur' can be viewed. */
+ rcti mask;
+
+ /** Min/max sizes of 'cur' rect (only when keepzoom not set). */
+ float min[2], max[2];
+ /** Allowable zoom factor range (only when (keepzoom & V2D_LIMITZOOM)) is set. */
+ float minzoom, maxzoom;
+
+ /** Scroll - scrollbars to display (bitflag). */
+ short scroll;
+ /** Scroll_ui - temp settings used for UI drawing of scrollers. */
+ short scroll_ui;
+
+ /** Keeptot - 'cur' rect cannot move outside the 'tot' rect?. */
+ short keeptot;
+ /** Keepzoom - axes that zooming cannot occur on, and also clamp within zoom-limits. */
+ short keepzoom;
+ /** Keepofs - axes that translation is not allowed to occur on. */
+ short keepofs;
+
+ /** Settings. */
+ short flag;
+ /** Alignment of content in totrect. */
+ short align;
+
+ /** Storage of current winx/winy values, set in UI_view2d_size_update. */
+ short winx, winy;
+ /** Storage of previous winx/winy values encountered by UI_view2d_curRect_validate(),
+ * for keepaspect. */
+ short oldwinx, oldwiny;
+
+ /** Pivot point for transforms (rotate and scale). */
+ short around;
+
+ /** Different offset per tab, for buttons. */
+ float *tab_offset;
+ /** Number of tabs stored. */
+ int tab_num;
+ /** Current tab. */
+ int tab_cur;
/* Usually set externally (as in, not in view2d files). */
- char alpha_vert, alpha_hor; /* alpha of vertical and horizontal scrollbars (range is [0, 255]) */
- short pad[3];
+ /** Alpha of vertical and horizontal scrollbars (range is [0, 255]). */
+ char alpha_vert, alpha_hor;
+ char _pad[6];
/* animated smooth view */
struct SmoothView2DStore *sms;
@@ -103,18 +115,20 @@ enum {
/* view extent restrictions (v2d->keeptot) */
enum {
- /* 'cur' view can be out of extents of 'tot' */
+ /** 'cur' view can be out of extents of 'tot' */
V2D_KEEPTOT_FREE = 0,
- /* 'cur' rect is adjusted so that it satisfies the extents of 'tot', with some compromises */
+ /** 'cur' rect is adjusted so that it satisfies the extents of 'tot', with some compromises */
V2D_KEEPTOT_BOUNDS = 1,
- /* 'cur' rect is moved so that the 'minimum' bounds of the 'tot' rect are always respected (particularly in x-axis) */
+ /** 'cur' rect is moved so that the 'minimum' bounds of the 'tot' rect are always respected
+ * (particularly in x-axis) */
V2D_KEEPTOT_STRICT = 2,
};
/* general refresh settings (v2d->flag) */
enum {
/* global view2d horizontal locking (for showing same time interval) */
- /* TODO: this flag may be set in old files but is not accessible currently, should be exposed from RNA - Campbell */
+ /* TODO: this flag may be set in old files but is not accessible currently,
+ * should be exposed from RNA - Campbell */
V2D_VIEWSYNC_SCREEN_TIME = (1 << 0),
/* within area (i.e. between regions) view2d vertical locking */
V2D_VIEWSYNC_AREA_VERTICAL = (1 << 1),
@@ -144,7 +158,8 @@ enum {
/* induce hiding of scrollbars - set by region drawing in response to size of region */
V2D_SCROLL_VERTICAL_HIDE = (1 << 7),
V2D_SCROLL_HORIZONTAL_HIDE = (1 << 8),
- /* scrollbar extends beyond its available window - set when calculating scrollbars for drawing */
+ /* scrollbar extends beyond its available window -
+ * set when calculating scrollbars for drawing */
V2D_SCROLL_VERTICAL_FULLR = (1 << 9),
V2D_SCROLL_HORIZONTAL_FULLR = (1 << 10),
};
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 72c9be2c12c..3259587f4cb 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,34 +15,28 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_view3d_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_VIEW3D_TYPES_H__
#define __DNA_VIEW3D_TYPES_H__
-struct ViewDepths;
-struct Object;
-struct Image;
-struct SpaceLink;
struct BoundBox;
+struct GPUViewport;
+struct Image;
+struct Material;
struct MovieClip;
struct MovieClipUser;
+struct Object;
struct RenderEngine;
-struct bGPdata;
struct SmoothView3DStore;
+struct SpaceLink;
+struct ViewDepths;
+struct bGPdata;
struct wmTimer;
-struct Material;
-struct GPUViewport;
#include "DNA_defs.h"
#include "DNA_listBase.h"
@@ -53,90 +45,112 @@ struct GPUViewport;
#include "DNA_movieclip_types.h"
#include "DNA_gpu_types.h"
-/* ******************************** */
-
-/* The near/far thing is a Win EXCEPTION, caused by indirect includes from <windows.h>.
- * Thus, leave near/far in the code, and undef for windows. */
-#ifdef _WIN32
-# undef near
-# undef far
-#endif
-
typedef struct RegionView3D {
- float winmat[4][4]; /* GL_PROJECTION matrix */
- float viewmat[4][4]; /* GL_MODELVIEW matrix */
- float viewinv[4][4]; /* inverse of viewmat */
- float persmat[4][4]; /* viewmat*winmat */
- float persinv[4][4]; /* inverse of persmat */
- float viewcamtexcofac[4]; /* offset/scale for camera glsl texcoords */
-
- /* viewmat/persmat multiplied with object matrix, while drawing and selection */
+ /** GL_PROJECTION matrix. */
+ float winmat[4][4];
+ /** GL_MODELVIEW matrix. */
+ float viewmat[4][4];
+ /** Inverse of viewmat. */
+ float viewinv[4][4];
+ /** Viewmat*winmat. */
+ float persmat[4][4];
+ /** Inverse of persmat. */
+ float persinv[4][4];
+ /** Offset/scale for camera glsl texcoords. */
+ float viewcamtexcofac[4];
+
+ /** viewmat/persmat multiplied with object matrix, while drawing and selection. */
float viewmatob[4][4];
float persmatob[4][4];
- /* user defined clipping planes */
+ /** User defined clipping planes. */
float clip[6][4];
- float clip_local[6][4]; /* clip in object space, means we can test for clipping in editmode without first going into worldspace */
+ /** Clip in object space,
+ * means we can test for clipping in editmode without first going into worldspace. */
+ float clip_local[6][4];
struct BoundBox *clipbb;
- struct RegionView3D *localvd; /* allocated backup of its self while in localview */
+ /** Allocated backup of its self while in localview. */
+ struct RegionView3D *localvd;
struct RenderEngine *render_engine;
struct ViewDepths *depths;
void *gpuoffscreen;
- /* animated smooth view */
+ /** Animated smooth view. */
struct SmoothView3DStore *sms;
struct wmTimer *smooth_timer;
- /* transform gizmo matrix */
+ /** Transform gizmo matrix. */
float twmat[4][4];
- /* min/max dot product on twmat xyz axis. */
+ /** min/max dot product on twmat xyz axis. */
float tw_axis_min[3], tw_axis_max[3];
float tw_axis_matrix[3][3];
float gridview DNA_DEPRECATED;
- float viewquat[4]; /* view rotation, must be kept normalized */
- float dist; /* distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs' */
- float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */
- float pixsize; /* runtime only */
- float ofs[3]; /* view center & orbit pivot, negative of worldspace location,
- * also matches -viewinv[3][0:3] in ortho mode.*/
- float camzoom; /* viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac */
- char is_persp; /* check if persp/ortho view, since 'persp' cant be used for this since
- * it can have cameras assigned as well. (only set in view3d_winmatrix_set) */
+ /** View rotation, must be kept normalized. */
+ float viewquat[4];
+ /** Distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs'. */
+ float dist;
+ /** Camera view offsets, 1.0 = viewplane moves entire width/height. */
+ float camdx, camdy;
+ /** Runtime only. */
+ float pixsize;
+ /**
+ * View center & orbit pivot, negative of worldspace location,
+ * also matches -viewinv[3][0:3] in ortho mode.
+ */
+ float ofs[3];
+ /** Viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac. */
+ float camzoom;
+ /**
+ * Check if persp/ortho view, since 'persp' cant be used for this since
+ * it can have cameras assigned as well. (only set in #view3d_winmatrix_set)
+ */
+ char is_persp;
char persp;
char view;
char viewlock;
- char viewlock_quad; /* options for quadview (store while out of quad view) */
- char pad[3];
- float ofs_lock[2]; /* normalized offset for locked view: (-1, -1) bottom left, (1, 1) upper right */
-
- short twdrawflag; /* XXX can easily get rid of this (Julian) */
+ /** Options for quadview (store while out of quad view). */
+ char viewlock_quad;
+ char _pad[3];
+ /** Normalized offset for locked view: (-1, -1) bottom left, (1, 1) upper right. */
+ float ofs_lock[2];
+
+ /** XXX can easily get rid of this (Julian). */
+ short twdrawflag;
short rflag;
- /* last view (use when switching out of camera view) */
+ /** Last view (use when switching out of camera view). */
float lviewquat[4];
- short lpersp, lview; /* lpersp can never be set to 'RV3D_CAMOB' */
+ /** Lpersp can never be set to 'RV3D_CAMOB'. */
+ short lpersp, lview;
- /* active rotation from NDOF or elsewhere */
+ /** Active rotation from NDOF or elsewhere. */
float rot_angle;
float rot_axis[3];
} RegionView3D;
typedef struct View3DCursor {
float location[3];
- float rotation[4];
- char _pad[4];
+
+ float rotation_quaternion[4];
+ float rotation_euler[3];
+ float rotation_axis[3], rotation_angle;
+ short rotation_mode;
+
+ char _pad[6];
} View3DCursor;
/* 3D Viewport Shading settings */
typedef struct View3DShading {
- char type; /* Shading type (VIEW3D_SHADE_SOLID, ..) */
- char prev_type; /* Runtime, for toggle between rendered viewport. */
+ /** Shading type (VIEW3D_SHADE_SOLID, ..). */
+ char type;
+ /** Runtime, for toggle between rendered viewport. */
+ char prev_type;
char prev_type_wire;
char color_type;
@@ -145,11 +159,15 @@ typedef struct View3DShading {
char light;
char background_type;
char cavity_type;
- char pad[7];
+ char wire_color_type;
+ char _pad[6];
- char studio_light[256]; /* FILE_MAXFILE */
- char lookdev_light[256]; /* FILE_MAXFILE */
- char matcap[256]; /* FILE_MAXFILE */
+ /** FILE_MAXFILE. */
+ char studio_light[256];
+ /** FILE_MAXFILE. */
+ char lookdev_light[256];
+ /** FILE_MAXFILE. */
+ char matcap[256];
float shadow_intensity;
float single_color[3];
@@ -193,7 +211,7 @@ typedef struct View3DOverlay {
float weight_paint_mode_opacity;
/* Armature edit/pose mode settings */
- int arm_flag;
+ int _pad3;
float xray_alpha_bone;
/* Other settings */
@@ -209,7 +227,8 @@ typedef struct View3DOverlay {
/* 3D ViewPort Struct */
typedef struct View3D {
struct SpaceLink *next, *prev;
- ListBase regionbase; /* storage of regions for inactive spaces */
+ /** Storage of regions for inactive spaces. */
+ ListBase regionbase;
char spacetype;
char link_flag;
char _pad0[6];
@@ -218,12 +237,14 @@ typedef struct View3D {
float viewquat[4] DNA_DEPRECATED;
float dist DNA_DEPRECATED;
- float bundle_size; /* size of bundles in reconstructed data */
- char bundle_drawtype; /* display style for bundle */
- char pad[3];
+ /** Size of bundles in reconstructed data. */
+ float bundle_size;
+ /** Display style for bundle. */
+ char bundle_drawtype;
+ char _pad3[2];
- unsigned int lay_prev DNA_DEPRECATED; /* for active layer toggle */
- unsigned int lay_used DNA_DEPRECATED; /* used while drawing */
+ /** Multiview current eye - for internal use. */
+ char multiview_eye;
int object_type_exclude_viewport;
int object_type_exclude_select;
@@ -234,42 +255,39 @@ typedef struct View3D {
struct Object *camera, *ob_centre;
rctf render_border;
- struct View3D *localvd; /* allocated backup of its self while in localview */
+ /** Allocated backup of its self while in localview. */
+ struct View3D *localvd;
- char ob_centre_bone[64]; /* optional string for armature bone to define center, MAXBONENAME */
+ /** Optional string for armature bone to define center, MAXBONENAME. */
+ char ob_centre_bone[64];
unsigned short local_view_uuid;
short _pad6;
int layact DNA_DEPRECATED;
- short ob_centre_cursor; /* optional bool for 3d cursor to define center */
+ /** Optional bool for 3d cursor to define center. */
+ short ob_centre_cursor;
short scenelock;
short gp_flag;
short flag;
int flag2;
float lens, grid;
- float near, far;
- float ofs[3] DNA_DEPRECATED; /* XXX deprecated */
+ float clip_start, clip_end;
+ float ofs[3] DNA_DEPRECATED;
char _pad[4];
- short matcap_icon; /* icon id */
+ /** Icon id. */
+ short matcap_icon;
short gridlines;
- short gridsubdiv; /* Number of subdivisions in the grid between each highlighted grid line */
+ /** Number of subdivisions in the grid between each highlighted grid line. */
+ short gridsubdiv;
char gridflag;
- /* transform gizmo info */
- char _pad5[2], gizmo_flag;
-
- short _pad2;
-
- /* drawflags, denoting state */
- char _pad3;
- char transp, xray;
-
- char multiview_eye; /* multiview current eye - for internal use */
+ /** Transform gizmo info. */
+ char gizmo_flag;
/* actually only used to define the opacity of the grease pencil vertex in edit mode */
float vertex_opacity;
@@ -278,22 +296,24 @@ typedef struct View3D {
* instead set (temporarily) from camera */
struct GPUFXSettings fx_settings;
- void *properties_storage; /* Nkey panel stores stuff here (runtime only!) */
+ /** Nkey panel stores stuff here (runtime only!). */
+ void *properties_storage;
/* XXX deprecated? */
- struct bGPdata *gpd DNA_DEPRECATED; /* Grease-Pencil Data (annotation layers) */
+ /** Grease-Pencil Data (annotation layers). */
+ struct bGPdata *gpd DNA_DEPRECATED;
/* Stereoscopy settings */
short stereo3d_flag;
char stereo3d_camera;
- char pad4;
+ char _pad4;
float stereo3d_convergence_factor;
float stereo3d_volume_alpha;
float stereo3d_convergence_alpha;
/* Display settings */
short drawtype DNA_DEPRECATED;
- short pad5[3];
+ char _pad5[6];
View3DShading shading;
View3DOverlay overlay;
@@ -354,7 +374,7 @@ typedef struct View3D {
(((view) >= RV3D_VIEW_FRONT) && ((view) <= RV3D_VIEW_BOTTOM))
/* View3d->flag2 (int) */
-#define V3D_RENDER_OVERRIDE (1 << 2)
+#define V3D_HIDE_OVERLAYS (1 << 2)
#define V3D_FLAG2_DEPRECATED_3 (1 << 3) /* cleared */
#define V3D_SHOW_ANNOTATION (1 << 4)
#define V3D_LOCK_CAMERA (1 << 5)
@@ -397,6 +417,7 @@ enum {
V3D_SHADING_XRAY_BONE = (1 << 8),
V3D_SHADING_WORLD_ORIENTATION = (1 << 9),
V3D_SHADING_BACKFACE_CULLING = (1 << 10),
+ V3D_SHADING_DEPTH_OF_FIELD = (1 << 11),
};
/* View3DShading->color_type */
@@ -470,11 +491,6 @@ enum {
V3D_OVERLAY_EDIT_CU_NORMALS = (1 << 21),
};
-/* View3DOverlay->arm_flag */
-enum {
- V3D_OVERLAY_ARM_TRANSP_BONES = (1 << 0),
-};
-
/* View3DOverlay->paint_flag */
enum {
V3D_OVERLAY_PAINT_WIRE = (1 << 0),
@@ -516,14 +532,17 @@ enum {
#define V3D_SHOW_Z (1 << 3)
/** #TransformOrientationSlot.type */
-#define V3D_MANIP_GLOBAL 0
-#define V3D_MANIP_LOCAL 1
-#define V3D_MANIP_NORMAL 2
-#define V3D_MANIP_VIEW 3
-#define V3D_MANIP_GIMBAL 4
-#define V3D_MANIP_CURSOR 5
-#define V3D_MANIP_CUSTOM_MATRIX (V3D_MANIP_CUSTOM - 1) /* Runtime only, never saved to DNA. */
-#define V3D_MANIP_CUSTOM 1024
+enum {
+ V3D_ORIENT_GLOBAL = 0,
+ V3D_ORIENT_LOCAL = 1,
+ V3D_ORIENT_NORMAL = 2,
+ V3D_ORIENT_VIEW = 3,
+ V3D_ORIENT_GIMBAL = 4,
+ V3D_ORIENT_CURSOR = 5,
+ V3D_ORIENT_CUSTOM = 1024,
+ /** Runtime only, never saved to DNA. */
+ V3D_ORIENT_CUSTOM_MATRIX = (V3D_ORIENT_CUSTOM - 1),
+};
/* View3d.mpr_flag (also) */
enum {
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 1fdd4d10586..753c9378797 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_windowmanager_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_WINDOWMANAGER_TYPES_H__
@@ -39,28 +32,27 @@
#include "DNA_ID.h"
/* defined here: */
-struct wmWindowManager;
struct wmWindow;
+struct wmWindowManager;
-struct wmMsgBus;
struct wmEvent;
struct wmGesture;
-struct wmOperatorType;
-struct wmOperator;
-struct wmKeyMap;
struct wmKeyConfig;
+struct wmKeyMap;
+struct wmMsgBus;
+struct wmOperator;
+struct wmOperatorType;
/* forwards */
-struct bContext;
-struct bScreen;
-struct wmSubWindow;
-struct wmTimer;
struct PointerRNA;
-struct ReportList;
struct Report;
-struct uiLayout;
+struct ReportList;
struct Stereo3dFormat;
struct UndoStep;
+struct bContext;
+struct bScreen;
+struct uiLayout;
+struct wmTimer;
#define OP_MAX_TYPENAME 64
#define KMAP_MAX_NAME 64
@@ -97,9 +89,11 @@ enum ReportListFlags {
#
typedef struct Report {
struct Report *next, *prev;
- short type; /* ReportType */
+ /** ReportType. */
+ short type;
short flag;
- int len; /* strlen(message), saves some time calculating the word wrap */
+ /** `strlen(message)`, saves some time calculating the word wrap . */
+ int len;
const char *typestr;
const char *message;
} Report;
@@ -107,9 +101,12 @@ typedef struct Report {
/* saved in the wm, don't remove */
typedef struct ReportList {
ListBase list;
- int printlevel; /* ReportType */
- int storelevel; /* ReportType */
- int flag, pad;
+ /** ReportType. */
+ int printlevel;
+ /** ReportType. */
+ int storelevel;
+ int flag;
+ char _pad[4];
struct wmTimer *reporttimer;
} ReportList;
@@ -129,36 +126,54 @@ typedef struct ReportTimerInfo {
typedef struct wmWindowManager {
ID id;
- struct wmWindow *windrawable, *winactive; /* separate active from drawable */
+ /** Separate active from drawable. */
+ struct wmWindow *windrawable, *winactive;
ListBase windows;
- int initialized; /* set on file read */
- short file_saved; /* indicator whether data was saved */
- short op_undo_depth; /* operator stack depth to avoid nested undo pushes */
+ /** Set on file read. */
+ int initialized;
+ /** Indicator whether data was saved. */
+ short file_saved;
+ /** Operator stack depth to avoid nested undo pushes. */
+ short op_undo_depth;
- ListBase operators; /* operator registry */
+ /** Operator registry. */
+ ListBase operators;
- ListBase queue; /* refresh/redraw wmNotifier structs */
+ /** Refresh/redraw wmNotifier structs. */
+ ListBase queue;
- struct ReportList reports; /* information and error reports */
+ /** Information and error reports. */
+ struct ReportList reports;
- ListBase jobs; /* threaded jobs manager */
+ /** Threaded jobs manager. */
+ ListBase jobs;
- ListBase paintcursors; /* extra overlay cursors to draw, like circles */
+ /** Extra overlay cursors to draw, like circles. */
+ ListBase paintcursors;
- ListBase drags; /* active dragged items */
+ /** Active dragged items. */
+ ListBase drags;
- ListBase keyconfigs; /* known key configurations */
- struct wmKeyConfig *defaultconf; /* default configuration */
- struct wmKeyConfig *addonconf; /* addon configuration */
- struct wmKeyConfig *userconf; /* user configuration */
+ /** Known key configurations. */
+ ListBase keyconfigs;
+ /** Default configuration. */
+ struct wmKeyConfig *defaultconf;
+ /** Addon configuration. */
+ struct wmKeyConfig *addonconf;
+ /** User configuration. */
+ struct wmKeyConfig *userconf;
- ListBase timers; /* active timers */
- struct wmTimer *autosavetimer; /* timer for auto save */
+ /** Active timers. */
+ ListBase timers;
+ /** Timer for auto save. */
+ struct wmTimer *autosavetimer;
- struct UndoStack *undo_stack; /* all undo history (runtime only). */
+ /** All undo history (runtime only). */
+ struct UndoStack *undo_stack;
- char is_interface_locked; /* indicates whether interface is locked for user interaction */
+ /** Indicates whether interface is locked for user interaction. */
+ char is_interface_locked;
char par[7];
struct wmMsgBus *message_bus;
@@ -184,14 +199,20 @@ enum {
typedef struct wmWindow {
struct wmWindow *next, *prev;
- void *ghostwin; /* don't want to include ghost.h stuff */
- void *gpuctx; /* don't want to include gpu stuff */
+ /** Don't want to include ghost.h stuff. */
+ void *ghostwin;
+ /** Don't want to include gpu stuff. */
+ void *gpuctx;
- struct wmWindow *parent; /* Parent window */
+ /** Parent window. */
+ struct wmWindow *parent;
- struct Scene *scene; /* Active scene displayed in this window. */
- struct Scene *new_scene; /* temporary when switching */
- char view_layer_name[64]; /* Active view layer displayed in this window. */
+ /** Active scene displayed in this window. */
+ struct Scene *scene;
+ /** Temporary when switching. */
+ struct Scene *new_scene;
+ /** Active view layer displayed in this window. */
+ char view_layer_name[64];
struct WorkSpaceInstanceHook *workspace_hook;
@@ -201,38 +222,59 @@ typedef struct wmWindow {
struct bScreen *screen DNA_DEPRECATED;
- short posx, posy, sizex, sizey; /* window coords */
- short windowstate; /* borderless, full */
- short monitor; /* multiscreen... no idea how to store yet */
- short active; /* set to 1 if an active window, for quick rejects */
- short cursor; /* current mouse cursor type */
- short lastcursor; /* previous cursor when setting modal one */
- short modalcursor; /* the current modal cursor */
- short grabcursor; /* cursor grab mode */
- short addmousemove; /* internal: tag this for extra mousemove event, makes cursors/buttons active on UI switching */
- short pad[4];
-
- int winid; /* winid also in screens, is for retrieving this window after read */
-
- short lock_pie_event; /* internal, lock pie creation from this event until released */
- short last_pie_event; /* exception to the above rule for nested pies, store last pie event for operators
- * that spawn a new pie right after destruction of last pie */
-
- struct wmEvent *eventstate; /* storage for event system */
-
- struct wmGesture *tweak; /* internal for wm_operators.c */
+ /** Window coords. */
+ short posx, posy, sizex, sizey;
+ /** Borderless, full. */
+ short windowstate;
+ /** Multiscreen... no idea how to store yet. */
+ short monitor;
+ /** Set to 1 if an active window, for quick rejects. */
+ short active;
+ /** Current mouse cursor type. */
+ short cursor;
+ /** Previous cursor when setting modal one. */
+ short lastcursor;
+ /** The current modal cursor. */
+ short modalcursor;
+ /** Cursor grab mode. */
+ short grabcursor;
+ /** Internal: tag this for extra mousemove event,
+ * makes cursors/buttons active on UI switching. */
+ short addmousemove;
+
+ /** Winid also in screens, is for retrieving this window after read. */
+ int winid;
+
+ /** Internal, lock pie creation from this event until released. */
+ short lock_pie_event;
+ /**
+ * Exception to the above rule for nested pies, store last pie event for operators
+ * that spawn a new pie right after destruction of last pie.
+ */
+ short last_pie_event;
+
+ /** Storage for event system. */
+ struct wmEvent *eventstate;
+
+ /** Internal for wm_operators.c. */
+ struct wmGesture *tweak;
/* Input Method Editor data - complex character input (esp. for asian character input)
* Currently WIN32, runtime-only data */
struct wmIMEData *ime_data;
- ListBase queue; /* all events (ghost level events were handled) */
- ListBase handlers; /* window+screen handlers, handled last */
- ListBase modalhandlers; /* priority handlers, handled first */
+ /** All events (ghost level events were handled). */
+ ListBase queue;
+ /** Window+screen handlers, handled last. */
+ ListBase handlers;
+ /** Priority handlers, handled first. */
+ ListBase modalhandlers;
- ListBase gesture; /* gesture stuff */
+ /** Gesture stuff. */
+ ListBase gesture;
- struct Stereo3dFormat *stereo3d_format; /* properties for stereoscopic displays */
+ /** Properties for stereoscopic displays. */
+ struct Stereo3dFormat *stereo3d_format;
/* custom drawing callbacks */
ListBase drawcalls;
@@ -256,7 +298,8 @@ typedef struct wmOperatorTypeMacro {
/* operator id */
char idname[64];
/* rna pointer to access properties, like keymap */
- struct IDProperty *properties; /* operator properties, assigned to ptr->data and can be written to a file */
+ /** Operator properties, assigned to ptr->data and can be written to a file. */
+ struct IDProperty *properties;
struct PointerRNA *ptr;
} wmOperatorTypeMacro;
@@ -265,27 +308,38 @@ typedef struct wmKeyMapItem {
struct wmKeyMapItem *next, *prev;
/* operator */
- char idname[64]; /* used to retrieve operator type pointer */
- IDProperty *properties; /* operator properties, assigned to ptr->data and can be written to a file */
+ /** Used to retrieve operator type pointer. */
+ char idname[64];
+ /** Operator properties, assigned to ptr->data and can be written to a file. */
+ IDProperty *properties;
/* modal */
- char propvalue_str[64]; /* runtime temporary storage for loading */
- short propvalue; /* if used, the item is from modal map */
+ /** Runtime temporary storage for loading. */
+ char propvalue_str[64];
+ /** If used, the item is from modal map. */
+ short propvalue;
/* event */
- short type; /* event code itself */
- short val; /* KM_ANY, KM_PRESS, KM_NOTHING etc */
- short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
- short keymodifier; /* rawkey modifier */
+ /** Event code itself. */
+ short type;
+ /** KM_ANY, KM_PRESS, KM_NOTHING etc. */
+ short val;
+ /** Oskey is apple or windowskey, value denotes order of pressed. */
+ short shift, ctrl, alt, oskey;
+ /** Rawkey modifier. */
+ short keymodifier;
/* flag: inactive, expanded */
short flag;
/* runtime */
- short maptype; /* keymap editor */
- short id; /* unique identifier. Positive for kmi that override builtins, negative otherwise */
- short pad;
- struct PointerRNA *ptr; /* rna pointer to access properties */
+ /** Keymap editor. */
+ short maptype;
+ /** Unique identifier. Positive for kmi that override builtins, negative otherwise. */
+ short id;
+ char _pad[2];
+ /** Rna pointer to access properties. */
+ struct PointerRNA *ptr;
} wmKeyMapItem;
/* used instead of wmKeyMapItem for diff keymaps */
@@ -321,13 +375,19 @@ typedef struct wmKeyMap {
ListBase items;
ListBase diff_items;
- char idname[64]; /* global editor keymaps, or for more per space/region */
- short spaceid; /* same IDs as in DNA_space_types.h */
- short regionid; /* see above */
- char owner_id[64]; /* optional, see: #wmOwnerID */
-
- short flag; /* general flags */
- short kmi_id; /* last kmi id */
+ /** Global editor keymaps, or for more per space/region. */
+ char idname[64];
+ /** Same IDs as in DNA_space_types.h. */
+ short spaceid;
+ /** See above. */
+ short regionid;
+ /** Optional, see: #wmOwnerID. */
+ char owner_id[64];
+
+ /** General flags. */
+ short flag;
+ /** Last kmi id. */
+ short kmi_id;
/* runtime */
/** Verify if enabled in the current context, use #WM_keymap_poll instead of direct calls. */
@@ -359,15 +419,18 @@ enum {
*/
typedef struct wmKeyConfigPref {
struct wmKeyConfigPref *next, *prev;
- char idname[64]; /* unique name */
+ /** Unique name. */
+ char idname[64];
IDProperty *prop;
} wmKeyConfigPref;
typedef struct wmKeyConfig {
struct wmKeyConfig *next, *prev;
- char idname[64]; /* unique name */
- char basename[64]; /* idname of configuration this is derives from, "" if none */
+ /** Unique name. */
+ char idname[64];
+ /** Idname of configuration this is derives from, "" if none. */
+ char basename[64];
ListBase keymaps;
int actkeymap;
@@ -387,21 +450,32 @@ typedef struct wmOperator {
struct wmOperator *next, *prev;
/* saved */
- char idname[64]; /* used to retrieve type pointer */
- IDProperty *properties; /* saved, user-settable properties */
+ /** Used to retrieve type pointer. */
+ char idname[64];
+ /** Saved, user-settable properties. */
+ IDProperty *properties;
/* runtime */
- struct wmOperatorType *type; /* operator type definition from idname */
- void *customdata; /* custom storage, only while operator runs */
- void *py_instance; /* python stores the class instance here */
-
- struct PointerRNA *ptr; /* rna pointer to access properties */
- struct ReportList *reports; /* errors and warnings storage */
-
- ListBase macro; /* list of operators, can be a tree */
- struct wmOperator *opm; /* current running macro, not saved */
- struct uiLayout *layout; /* runtime for drawing */
- short flag, pad[3];
+ /** Operator type definition from idname. */
+ struct wmOperatorType *type;
+ /** Custom storage, only while operator runs. */
+ void *customdata;
+ /** Python stores the class instance here. */
+ void *py_instance;
+
+ /** Rna pointer to access properties. */
+ struct PointerRNA *ptr;
+ /** Errors and warnings storage. */
+ struct ReportList *reports;
+
+ /** List of operators, can be a tree. */
+ ListBase macro;
+ /** Current running macro, not saved. */
+ struct wmOperator *opm;
+ /** Runtime for drawing. */
+ struct uiLayout *layout;
+ short flag;
+ char _pad[6];
} wmOperator;
/* operator type return flags: exec(), invoke() modal(), return values */
@@ -431,16 +505,17 @@ enum {
/* wmOperator flag */
enum {
- /* low level flag so exec() operators can tell if they were invoked, use with care.
- * typically this shouldn't make any difference, but it rare cases its needed (see smooth-view) */
+ /** low level flag so exec() operators can tell if they were invoked, use with care.
+ * Typically this shouldn't make any difference, but it rare cases its needed
+ * (see smooth-view) */
OP_IS_INVOKE = (1 << 0),
- /* So we can detect if an operators exec() call is activated from an interactive repeat. */
+ /** So we can detect if an operators exec() call is activated from an interactive repeat. */
OP_IS_REPEAT = (1 << 1),
- /* When the cursor is grabbed */
+ /** When the cursor is grabbed */
OP_IS_MODAL_GRAB_CURSOR = (1 << 2),
- /* allow modal operators to have the region under the cursor for their context
+ /** Allow modal operators to have the region under the cursor for their context
* (the regiontype is maintained to prevent errors) */
OP_IS_MODAL_CURSOR_REGION = (1 << 3),
};
diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h
index 3ad5071fdf2..daf6bb01ee9 100644
--- a/source/blender/makesdna/DNA_workspace_types.h
+++ b/source/blender/makesdna/DNA_workspace_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_workspace_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*
* Use API in BKE_workspace.h!
* Struct members marked with DNA_PRIVATE_WORKSPACE will throw a
@@ -112,26 +108,32 @@ typedef struct WorkSpaceLayout {
struct WorkSpaceLayout *next, *prev;
struct bScreen *screen;
- /* The name of this layout, we override the RNA name of the screen with this (but not ID name itself) */
- char name[64] DNA_PRIVATE_WORKSPACE; /* MAX_NAME */
+ /* The name of this layout, we override the RNA name of the screen with this
+ * (but not ID name itself) */
+ /** MAX_NAME. */
+ char name[64] DNA_PRIVATE_WORKSPACE;
} WorkSpaceLayout;
/** Optional tags, which features to use, aligned with #bAddon names by convention. */
typedef struct wmOwnerID {
struct wmOwnerID *next, *prev;
- char name[64] DNA_PRIVATE_WORKSPACE; /* MAX_NAME */
+ /** MAX_NAME. */
+ char name[64] DNA_PRIVATE_WORKSPACE;
} wmOwnerID;
typedef struct WorkSpace {
ID id;
- ListBase layouts DNA_PRIVATE_WORKSPACE; /* WorkSpaceLayout */
+ /** WorkSpaceLayout. */
+ ListBase layouts DNA_PRIVATE_WORKSPACE;
/* Store for each hook (so for each window) which layout has
* been activated the last time this workspace was visible. */
- ListBase hook_layout_relations DNA_PRIVATE_WORKSPACE_READ_WRITE; /* WorkSpaceDataRelation */
+ /** WorkSpaceDataRelation. */
+ ListBase hook_layout_relations DNA_PRIVATE_WORKSPACE_READ_WRITE;
/* Feature tagging (use for addons) */
- ListBase owner_ids DNA_PRIVATE_WORKSPACE_READ_WRITE; /* wmOwnerID */
+ /** #wmOwnerID. */
+ ListBase owner_ids DNA_PRIVATE_WORKSPACE_READ_WRITE;
/* should be: '#ifdef USE_WORKSPACE_TOOL'. */
@@ -140,7 +142,7 @@ typedef struct WorkSpace {
/**
* BAD DESIGN WARNING:
- * This is a workaround for the topbar not knowing which tools spac */
+ * This is a workaround for the topbar not knowing which tools spec. */
char tools_space_type;
/** Type is different for each space-type. */
char tools_mode;
@@ -148,7 +150,8 @@ typedef struct WorkSpace {
int object_mode;
- int flags DNA_PRIVATE_WORKSPACE; /* enum eWorkSpaceFlags */
+ /** Enum eWorkSpaceFlags. */
+ int flags DNA_PRIVATE_WORKSPACE;
/* Number for workspace tab reordering in the UI. */
int order;
@@ -186,7 +189,8 @@ typedef struct WorkSpace {
typedef struct WorkSpaceDataRelation {
struct WorkSpaceDataRelation *next, *prev;
- /* the data used to identify the relation (e.g. to find screen-layout (= value) from/for a hook) */
+ /* the data used to identify the relation
+ * (e.g. to find screen-layout (= value) from/for a hook) */
void *parent;
/* The value for this parent-data/workspace relation */
void *value;
@@ -202,7 +206,8 @@ typedef struct WorkSpaceInstanceHook {
WorkSpace *active DNA_PRIVATE_WORKSPACE;
struct WorkSpaceLayout *act_layout DNA_PRIVATE_WORKSPACE;
- /* Needed because we can't change workspaces/layouts in running handler loop, it would break context. */
+ /* Needed because we can't change workspaces/layouts in running handler loop,
+ * it would break context. */
WorkSpace *temp_workspace_store;
struct WorkSpaceLayout *temp_layout_store;
} WorkSpaceInstanceHook;
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index a3cc65d3c79..161109cdf2d 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file DNA_world_types.h
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*/
#ifndef __DNA_WORLD_TYPES_H__
@@ -36,9 +28,9 @@
#include "DNA_ID.h"
struct AnimData;
-struct bNodeTree;
struct Ipo;
struct MTex;
+struct bNodeTree;
#ifndef MAX_MTEX
#define MAX_MTEX 18
@@ -50,8 +42,10 @@ struct MTex;
* gravity, color model etc. It mixes rendering data and modeling data. */
typedef struct World {
ID id;
- struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
- DrawDataList drawdata; /* runtime (must be immediately after id for utilities to use it). */
+ /** Animation data (must be immediately after id for utilities to use it). */
+ struct AnimData *adt;
+ /* runtime (must be immediately after id for utilities to use it). */
+ DrawDataList drawdata;
char _pad0[4];
short texact, mistype;
@@ -70,19 +64,22 @@ typedef struct World {
* Some world modes
* bit 0: Do mist
*/
- short mode; // partially moved to scene->gamedata in 2.5
- short pad2[3];
+ short mode;
+ char _pad2[6];
float misi, miststa, mistdist, misthi;
- /* ambient occlusion */
+ /** Ambient occlusion. */
float aodist, aoenergy;
- /* assorted settings */
- short flag, pad3[3];
+ /** Assorted settings. */
+ short flag;
+ char _pad3[6];
- struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
- short pr_texture, use_nodes, pad[2];
+ /** Old animation system, deprecated for 2.5. */
+ struct Ipo *ipo DNA_DEPRECATED;
+ short pr_texture, use_nodes;
+ char _pad[4];
/* previews */
struct PreviewImage *preview;
@@ -90,8 +87,11 @@ typedef struct World {
/* nodes */
struct bNodeTree *nodetree;
- float mistend, pad1; /* runtime : miststa + mistdist, used for drawing camera */
- ListBase gpumaterial; /* runtime */
+ /** Runtime : miststa + mistdist, used for drawing camera. */
+ float mistend;
+ char _pad1[4];
+ /** Runtime. */
+ ListBase gpumaterial;
} World;
/* **************** WORLD ********************* */
diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt
index 06fd23cdff2..294fb861912 100644
--- a/source/blender/makesdna/intern/CMakeLists.txt
+++ b/source/blender/makesdna/intern/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
# message(STATUS "Configuring makesdna")
@@ -38,7 +33,13 @@ blender_include_dirs(
# -----------------------------------------------------------------------------
# Build makesdna executable
set(SRC
+ dna_utils.c
makesdna.c
+ ../../blenlib/intern/BLI_ghash.c
+ ../../blenlib/intern/BLI_ghash_utils.c
+ ../../blenlib/intern/BLI_memarena.c
+ ../../blenlib/intern/BLI_mempool.c
+ ../../blenlib/intern/hash_mm2a.c # needed by 'BLI_ghash_utils.c', not used directly.
../../../../intern/guardedalloc/intern/mallocn.c
../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c
../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c
@@ -82,9 +83,12 @@ set(INC_SYS
)
set(SRC
+ dna_utils.c
dna_genfile.c
${CMAKE_CURRENT_BINARY_DIR}/dna.c
${SRC_DNA_INC}
+
+ dna_utils.h
)
set_source_files_properties(
@@ -109,6 +113,8 @@ set(INC_SYS
set(SRC
../../blenlib/intern/BLI_ghash.c
../../blenlib/intern/BLI_ghash_utils.c
+ ../../blenlib/intern/BLI_linklist.c
+ ../../blenlib/intern/BLI_memarena.c
../../blenlib/intern/BLI_mempool.c
../../blenlib/intern/endian_switch.c
../../blenlib/intern/hash_mm2a.c
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index f04d7ca5fe9..f53651621c2 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
* DNA handling
*/
-/** \file blender/makesdna/intern/dna_genfile.c
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
*
* Lowest-level functions for decoding the parts of a saved .blend
* file, including interpretation of its SDNA block and conversion of
@@ -45,6 +37,7 @@
#include "BLI_utildefines.h"
#include "BLI_endian_switch.h"
+#include "BLI_memarena.h"
#ifdef WITH_DNA_GHASH
# include "BLI_ghash.h"
@@ -131,50 +124,16 @@
* - long: 8 aligned
* - struct: 8 aligned
* - the sdna functions have several error prints builtin, always check blender running from a console.
- *
*/
-/* ************************* MAKE DNA ********************** */
-/* allowed duplicate code from makesdna.c */
-
-/**
- * parses the "[n1][n2]..." on the end of an array name and returns the number of array elements n1*n2*...
- */
-int DNA_elem_array_size(const char *str)
-{
- int result = 1;
- int current = 0;
- while (true) {
- char c = *str++;
- switch (c) {
- case '\0':
- return result;
- case '[':
- current = 0;
- break;
- case ']':
- result *= current;
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- current = current * 10 + (c - '0');
- break;
- default:
- break;
- }
- }
-}
-
-/* ************************* END MAKE DNA ********************** */
+#ifdef __BIG_ENDIAN__
+/* Big Endian */
+# define MAKE_ID(a, b, c, d) ((int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d))
+#else
+/* Little Endian */
+# define MAKE_ID(a, b, c, d) ((int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a))
+#endif
/* ************************* DIV ********************** */
@@ -185,6 +144,7 @@ void DNA_sdna_free(SDNA *sdna)
}
MEM_freeN((void *)sdna->names);
+ MEM_freeN((void *)sdna->names_array_len);
MEM_freeN((void *)sdna->types);
MEM_freeN(sdna->structs);
@@ -194,6 +154,13 @@ void DNA_sdna_free(SDNA *sdna)
}
#endif
+ if (sdna->mem_arena) {
+ BLI_memarena_free(sdna->mem_arena);
+ }
+
+ MEM_SAFE_FREE(sdna->alias.names);
+ MEM_SAFE_FREE(sdna->alias.types);
+
MEM_freeN(sdna);
}
@@ -209,38 +176,24 @@ static bool ispointer(const char *name)
/**
* Returns the size of struct fields of the specified type and name.
*
- * \param type: Index into sdna->types/typelens
+ * \param type: Index into sdna->types/types_size
* \param name: Index into sdna->names,
* needed to extract possible pointer/array information.
*/
static int elementsize(const SDNA *sdna, short type, short name)
{
- int mul, namelen, len;
- const char *cp;
-
- cp = sdna->names[name];
+ int len;
+ const char *cp = sdna->names[name];
len = 0;
- namelen = strlen(cp);
/* is it a pointer or function pointer? */
if (ispointer(cp)) {
/* has the name an extra length? (array) */
- mul = 1;
- if (cp[namelen - 1] == ']') {
- mul = DNA_elem_array_size(cp);
- }
-
- len = sdna->pointerlen * mul;
+ len = sdna->pointer_size * sdna->names_array_len[name];
}
- else if (sdna->typelens[type]) {
+ else if (sdna->types_size[type]) {
/* has the name an extra length? (array) */
- mul = 1;
- if (cp[namelen - 1] == ']') {
- mul = DNA_elem_array_size(cp);
- }
-
- len = mul * sdna->typelens[type];
-
+ len = (int)sdna->types_size[type] * sdna->names_array_len[name];
}
return len;
@@ -329,59 +282,15 @@ BLI_INLINE const char *pad_up_4(const char *ptr)
}
/**
- * Temporary DNA doversion for files that were created with Blender 2.80
- * between October 2016, and November 2017 (>=280.0 and < 280.2).
- *
- * /note This would be way more efficient if we can get the version from SDNA
- * So we could return true if version == 280 && subversion < 2.
- *
- * Returns true if we need to do the DNA renaming.
- */
-static bool need_doversion_280(SDNA *sdna, int *data, const bool data_alloc)
-{
- if (data_alloc == false) {
- return false;
- }
-
- bool active_layer = false, render_layers = false;
-
- const char *cp = (char *)data;
- for (int nr = 0; nr < sdna->nr_names; nr++) {
- if (strcmp(cp, "active_layer") == 0) {
- active_layer = true;
- if (active_layer && render_layers) {
- return true;
- }
- }
- else if (strcmp(cp, "render_layers") == 0) {
- render_layers = true;
- if (active_layer && render_layers) {
- return true;
- }
- }
-
- while (*cp) cp++;
- cp++;
- }
-
- /* If someone adds only one of them to the DNA, don't! */
- BLI_assert(!(active_layer || render_layers));
- return false;
-}
-
-/**
* In sdna->data the data, now we convert that to something understandable
*/
static bool init_structDNA(
SDNA *sdna, bool do_endian_swap,
- bool data_alloc,
const char **r_error_message)
{
- int *data, *verg, gravity_fix = -1;
+ int *data, gravity_fix = -1;
short *sp;
- char str[8];
- verg = (int *)str;
data = (int *)sdna->data;
/* clear pointers incase of error */
@@ -391,9 +300,13 @@ static bool init_structDNA(
#ifdef WITH_DNA_GHASH
sdna->structs_map = NULL;
#endif
+ sdna->mem_arena = NULL;
+
+ /* Lazy initialize. */
+ memset(&sdna->alias, 0, sizeof(sdna->alias));
- strcpy(str, "SDNA");
- if (*data != *verg) {
+ /* Struct DNA ('SDNA') */
+ if (*data != MAKE_ID('S', 'D', 'N', 'A')) {
*r_error_message = "SDNA error in SDNA file";
return false;
}
@@ -401,16 +314,15 @@ static bool init_structDNA(
const char *cp;
data++;
-
- /* load names array */
- strcpy(str, "NAME");
- if (*data == *verg) {
+ /* Names array ('NAME') */
+ if (*data == MAKE_ID('N', 'A', 'M', 'E')) {
data++;
sdna->nr_names = *data;
if (do_endian_swap) {
BLI_endian_switch_int32(&sdna->nr_names);
}
+ sdna->nr_names_alloc = sdna->nr_names;
data++;
sdna->names = MEM_callocN(sizeof(void *) * sdna->nr_names, "sdnanames");
@@ -420,10 +332,6 @@ static bool init_structDNA(
return false;
}
- /* Temporary DNA doversion for files that were created with Blender 2.80
- * between 280.0 and 280.2. */
- const bool doversion_280 = need_doversion_280(sdna, data, data_alloc);
-
cp = (char *)data;
for (int nr = 0; nr < sdna->nr_names; nr++) {
sdna->names[nr] = cp;
@@ -437,39 +345,15 @@ static bool init_structDNA(
gravity_fix = nr;
}
}
- else if (doversion_280) {
- if (strcmp(cp, "*render_layer") == 0) {
- /* WorkSpace. */
- sdna->names[nr] = "*view_layer";
- }
- else if (strcmp(cp, "*scene_layer") == 0) {
- /* ParticleEditSettings. */
- sdna->names[nr] = "*view_layer";
- }
- else if (strcmp(cp, "render_layers") == 0) {
- /* Scene. */
- sdna->names[nr] = "view_layers";
- }
- else if (strcmp(cp, "active_layer") == 0) {
- /* Scene. */
- sdna->names[nr] = "active_view_layer";
- }
- else if (strcmp(cp, "*cur_render_layer") == 0) {
- /* FileGlobal. */
- sdna->names[nr] = "*cur_view_layer";
- }
- }
-
while (*cp) cp++;
cp++;
}
cp = pad_up_4(cp);
- /* load type names array */
+ /* Type names array ('TYPE') */
data = (int *)cp;
- strcpy(str, "TYPE");
- if (*data == *verg) {
+ if (*data == MAKE_ID('T', 'Y', 'P', 'E')) {
data++;
sdna->nr_types = *data;
@@ -487,44 +371,20 @@ static bool init_structDNA(
cp = (char *)data;
for (int nr = 0; nr < sdna->nr_types; nr++) {
- 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) */
-
- /* struct Screen was already used by X, 'bScreen' replaces the old IrisGL 'Screen' struct */
- if (strcmp("bScreen", cp) == 0) {
- sdna->types[nr] = cp + 1;
- }
- /* Groups renamed to collections in 2.8 */
- else if (strcmp("Collection", cp) == 0) {
- sdna->types[nr] = "Group";
- }
- else if (strcmp("CollectionObject", cp) == 0) {
- sdna->types[nr] = "GroupObject";
- }
- else if (doversion_280) {
- if (strcmp(cp, "SceneLayer") == 0) {
- sdna->types[nr] = "ViewLayer";
- }
- else if (strcmp(cp, "SceneLayerEngineData") == 0) {
- sdna->types[nr] = "ViewLayerEngineData";
- }
- }
-
+ /* WARNING! See: DNA_struct_rename_legacy_hack_static_from_alias docs. */
+ sdna->types[nr] = DNA_struct_rename_legacy_hack_static_from_alias(cp);
while (*cp) cp++;
cp++;
}
cp = pad_up_4(cp);
- /* load typelen array */
+ /* Type lengths array ('TLEN') */
data = (int *)cp;
- strcpy(str, "TLEN");
- if (*data == *verg) {
+ if (*data == MAKE_ID('T', 'L', 'E', 'N')) {
data++;
sp = (short *)data;
- sdna->typelens = sp;
+ sdna->types_size = sp;
if (do_endian_swap) {
BLI_endian_switch_int16_array(sp, sdna->nr_types);
@@ -538,10 +398,9 @@ static bool init_structDNA(
}
if (sdna->nr_types & 1) sp++; /* prevent BUS error */
- /* load struct array */
+ /* Struct array ('STRC') */
data = (int *)sp;
- strcpy(str, "STRC");
- if (*data == *verg) {
+ if (*data == MAKE_ID('S', 'T', 'R', 'C')) {
data++;
sdna->nr_structs = *data;
@@ -604,9 +463,9 @@ static bool init_structDNA(
}
#endif
- /* Calculate 'sdna->pointerlen' */
+ /* Calculate 'sdna->pointer_size' */
{
- intptr_t nr = DNA_struct_find_nr(sdna, "ListBase");
+ const int nr = DNA_struct_find_nr(sdna, "ListBase");
/* should never happen, only with corrupt file for example */
if (UNLIKELY(nr == -1)) {
@@ -614,19 +473,28 @@ static bool init_structDNA(
return false;
}
- /* finally pointerlen: use struct ListBase to test it, never change the size of it! */
+ /* finally pointer_size: use struct ListBase to test it, never change the size of it! */
sp = sdna->structs[nr];
/* weird; i have no memory of that... I think I used sizeof(void *) before... (ton) */
- sdna->pointerlen = sdna->typelens[sp[0]] / 2;
+ sdna->pointer_size = sdna->types_size[sp[0]] / 2;
- if (sp[1] != 2 || (sdna->pointerlen != 4 && sdna->pointerlen != 8)) {
+ if (sp[1] != 2 || (sdna->pointer_size != 4 && sdna->pointer_size != 8)) {
*r_error_message = "ListBase struct error! Needs it to calculate pointerize.";
/* well, at least sizeof(ListBase) is error proof! (ton) */
return false;
}
}
+ /* Cache name size. */
+ {
+ short *names_array_len = MEM_mallocN(sizeof(*names_array_len) * sdna->nr_names, __func__);
+ for (int i = 0; i < sdna->nr_names; i++) {
+ names_array_len[i] = DNA_elem_array_size(sdna->names[i]);
+ }
+ sdna->names_array_len = names_array_len;
+ }
+
return true;
}
@@ -634,17 +502,17 @@ static bool init_structDNA(
* Constructs and returns a decoded SDNA structure from the given encoded SDNA data block.
*/
SDNA *DNA_sdna_from_data(
- const void *data, const int datalen,
+ const void *data, const int data_len,
bool do_endian_swap, bool data_alloc,
const char **r_error_message)
{
SDNA *sdna = MEM_mallocN(sizeof(*sdna), "sdna");
const char *error_message = NULL;
- sdna->datalen = datalen;
+ sdna->data_len = data_len;
if (data_alloc) {
- char *data_copy = MEM_mallocN(datalen, "sdna_data");
- memcpy(data_copy, data, datalen);
+ char *data_copy = MEM_mallocN(data_len, "sdna_data");
+ memcpy(data_copy, data, data_len);
sdna->data = data_copy;
}
else {
@@ -653,7 +521,7 @@ SDNA *DNA_sdna_from_data(
sdna->data_alloc = data_alloc;
- if (init_structDNA(sdna, do_endian_swap, data_alloc, &error_message)) {
+ if (init_structDNA(sdna, do_endian_swap, &error_message)) {
return sdna;
}
else {
@@ -769,7 +637,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
/* compare length and amount of elems */
if (sp_new[1] == sp_old[1]) {
- if (newsdna->typelens[sp_new[0]] == oldsdna->typelens[sp_old[0]]) {
+ if (newsdna->types_size[sp_new[0]] == oldsdna->types_size[sp_old[0]]) {
/* same length, same amount of elems, now per type and name */
b = sp_old[1];
@@ -786,7 +654,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
/* same type and same name, now pointersize */
if (ispointer(str1)) {
- if (oldsdna->pointerlen != newsdna->pointerlen) break;
+ if (oldsdna->pointer_size != newsdna->pointer_size) break;
}
b--;
@@ -844,7 +712,8 @@ static eSDNA_Type sdna_type_nr(const char *dna_type)
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! */
+ /* invalid! */
+ else return -1;
}
/**
@@ -854,21 +723,19 @@ static eSDNA_Type sdna_type_nr(const char *dna_type)
*
* \param ctype: Name of type to convert to
* \param otype: Name of type to convert from
- * \param name: Field name to extract array-size information
+ * \param name_array_len: Result of #DNA_elem_array_size for this element.
* \param curdata: Where to put converted data
* \param olddata: Data of type otype to convert
*/
static void cast_elem(
- const char *ctype, const char *otype, const char *name,
+ const char *ctype, const char *otype, int name_array_len,
char *curdata, const char *olddata)
{
double val = 0.0;
- int arrlen, curlen = 1, oldlen = 1;
+ int curlen = 1, oldlen = 1;
eSDNA_Type ctypenr, otypenr;
- arrlen = DNA_elem_array_size(name);
-
if ( (otypenr = sdna_type_nr(otype)) == -1 ||
(ctypenr = sdna_type_nr(ctype)) == -1)
{
@@ -879,7 +746,7 @@ static void cast_elem(
oldlen = DNA_elem_type_size(otypenr);
curlen = DNA_elem_type_size(ctypenr);
- while (arrlen > 0) {
+ while (name_array_len > 0) {
switch (otypenr) {
case SDNA_TYPE_CHAR:
val = *olddata; break;
@@ -926,7 +793,7 @@ static void cast_elem(
olddata += oldlen;
curdata += curlen;
- arrlen--;
+ name_array_len--;
}
}
@@ -937,18 +804,15 @@ static void cast_elem(
*
* \param curlen: Pointer length to conver to
* \param oldlen: Length of pointers in olddata
- * \param name: Field name to extract array-size information
+ * \param name_array_len: Result of #DNA_elem_array_size for this element.
* \param curdata: Where to put converted data
* \param olddata: Data to convert
*/
-static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata, const char *olddata)
+static void cast_pointer(int curlen, int oldlen, int name_array_len, char *curdata, const char *olddata)
{
int64_t lval;
- int arrlen;
-
- arrlen = DNA_elem_array_size(name);
- while (arrlen > 0) {
+ while (name_array_len > 0) {
if (curlen == oldlen) {
memcpy(curdata, olddata, curlen);
@@ -971,7 +835,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
olddata += oldlen;
curdata += curlen;
- arrlen--;
+ name_array_len--;
}
}
@@ -1086,7 +950,7 @@ static const char *find_elem(
* \param newsdna: SDNA of current Blender
* \param oldsdna: SDNA of Blender that saved file
* \param type: current field type name
- * \param name: current field name
+ * \param new_name_nr: current field name number.
* \param curdata: put field data converted to newsdna here
* \param old: pointer to struct info in oldsdna
* \param olddata: struct contents laid out according to oldsdna
@@ -1095,7 +959,7 @@ static void reconstruct_elem(
const SDNA *newsdna,
const SDNA *oldsdna,
const char *type,
- const char *name,
+ const int new_name_nr,
char *curdata,
const short *old,
const char *olddata)
@@ -1109,10 +973,11 @@ static void reconstruct_elem(
* (nzc 2-4-2001 I want the 'unsigned' bit to be parsed as well. Where
* can I force this?)
*/
- int a, elemcount, len, countpos, oldsize, cursize, mul;
+ int a, elemcount, len, countpos, mul;
const char *otype, *oname, *cp;
/* is 'name' an array? */
+ const char *name = newsdna->names[new_name_nr];
cp = name;
countpos = 0;
while (*cp && *cp != '[') {
@@ -1124,6 +989,7 @@ static void reconstruct_elem(
elemcount = old[1];
old += 2;
for (a = 0; a < elemcount; a++, old += 2) {
+ const int old_name_nr = old[1];
otype = oldsdna->types[old[0]];
oname = oldsdna->names[old[1]];
len = elementsize(oldsdna, old[0], old[1]);
@@ -1131,13 +997,17 @@ static void reconstruct_elem(
if (strcmp(name, oname) == 0) { /* name equal */
if (ispointer(name)) { /* pointer of functionpointer afhandelen */
- cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata);
+ cast_pointer(newsdna->pointer_size, oldsdna->pointer_size,
+ newsdna->names_array_len[new_name_nr],
+ curdata, olddata);
}
else if (strcmp(type, otype) == 0) { /* type equal */
memcpy(curdata, olddata, len);
}
else {
- cast_elem(type, otype, name, curdata, olddata);
+ cast_elem(type, otype,
+ newsdna->names_array_len[new_name_nr],
+ curdata, olddata);
}
return;
@@ -1145,28 +1015,31 @@ static void reconstruct_elem(
else if (countpos != 0) { /* name is an array */
if (oname[countpos] == '[' && strncmp(name, oname, countpos) == 0) { /* basis equal */
-
- cursize = DNA_elem_array_size(name);
- oldsize = DNA_elem_array_size(oname);
+ const int new_name_array_len = newsdna->names_array_len[new_name_nr];
+ const int old_name_array_len = oldsdna->names_array_len[old_name_nr];
+ const int min_name_array_len = MIN2(new_name_array_len, old_name_array_len);
if (ispointer(name)) { /* handle pointer or functionpointer */
- cast_pointer(newsdna->pointerlen, oldsdna->pointerlen,
- cursize > oldsize ? oname : name,
+ cast_pointer(newsdna->pointer_size, oldsdna->pointer_size,
+ min_name_array_len,
curdata, olddata);
}
else if (strcmp(type, otype) == 0) { /* type equal */
- mul = len / oldsize; /* size of single old array element */
- mul *= (cursize < oldsize) ? cursize : oldsize; /* smaller of sizes of old and new arrays */
+ /* size of single old array element */
+ mul = len / old_name_array_len;
+ /* smaller of sizes of old and new arrays */
+ mul *= min_name_array_len;
+
memcpy(curdata, olddata, mul);
- if (oldsize > cursize && strcmp(type, "char") == 0) {
+ if (old_name_array_len > new_name_array_len && strcmp(type, "char") == 0) {
/* string had to be truncated, ensure it's still null-terminated */
curdata[mul - 1] = '\0';
}
}
else {
cast_elem(type, otype,
- cursize > oldsize ? oname : name,
+ min_name_array_len,
curdata, olddata);
}
return;
@@ -1208,7 +1081,7 @@ static void reconstruct_struct(
const char *type;
const char *cpo;
char *cpc;
- const char *name, *nameo;
+ const char *name;
unsigned int oldsdna_index_last = UINT_MAX;
unsigned int cursdna_index_last = UINT_MAX;
@@ -1220,7 +1093,7 @@ static void reconstruct_struct(
if (compflags[oldSDNAnr] == SDNA_CMP_EQUAL) {
/* if recursive: test for equal */
spo = oldsdna->structs[oldSDNAnr];
- elen = oldsdna->typelens[spo[0]];
+ elen = oldsdna->types_size[spo[0]];
memcpy(cur, data, elen);
return;
@@ -1241,9 +1114,15 @@ static void reconstruct_struct(
elen = elementsize(newsdna, spc[0], spc[1]);
- /* test: is type a struct? */
- if (spc[0] >= firststructtypenr && !ispointer(name)) {
+ /* Skip pad bytes which must start with '_pad', see makesdna.c 'is_name_legal'.
+ * for exact rules. Note that if we fail to skip a pad byte it's harmless,
+ * this just avoids unnecessary reconstruction. */
+ if (name[0] == '_' || (name[0] == '*' && name[1] == '_')) {
+ cpc += elen;
+ }
+ else if (spc[0] >= firststructtypenr && !ispointer(name)) {
/* struct field type */
+
/* where does the old struct data start (and is there an old one?) */
cpo = (char *)find_elem(oldsdna, type, name, spo, data, &sppo);
@@ -1252,9 +1131,8 @@ static void reconstruct_struct(
curSDNAnr = DNA_struct_find_nr_ex(newsdna, type, &cursdna_index_last);
/* array! */
- mul = DNA_elem_array_size(name);
- nameo = oldsdna->names[sppo[1]];
- mulo = DNA_elem_array_size(nameo);
+ mul = newsdna->names_array_len[spc[1]];
+ mulo = oldsdna->names_array_len[sppo[1]];
eleno = elementsize(oldsdna, sppo[0], sppo[1]);
@@ -1277,7 +1155,7 @@ static void reconstruct_struct(
}
else {
/* non-struct field type */
- reconstruct_elem(newsdna, oldsdna, type, name, cpc, spo, data);
+ reconstruct_elem(newsdna, oldsdna, type, spc[1], cpc, spo, data);
cpc += elen;
}
}
@@ -1314,6 +1192,7 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data)
for (a = 0; a < elemcount; a++, spc += 2) {
type = oldsdna->types[spc[0]];
name = oldsdna->names[spc[1]];
+ const int old_name_array_len = oldsdna->names_array_len[spc[1]];
/* elementsize = including arraysize */
elen = elementsize(oldsdna, spc[0], spc[1]);
@@ -1326,7 +1205,7 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data)
if (cpo) {
oldSDNAnr = DNA_struct_find_nr_ex(oldsdna, type, &oldsdna_index_last);
- mul = DNA_elem_array_size(name);
+ mul = old_name_array_len;
elena = elen / mul;
while (mul--) {
@@ -1338,8 +1217,8 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data)
else {
/* non-struct field type */
if (ispointer(name)) {
- if (oldsdna->pointerlen == 8) {
- BLI_endian_switch_int64_array((int64_t *)cur, DNA_elem_array_size(name));
+ if (oldsdna->pointer_size == 8) {
+ BLI_endian_switch_int64_array((int64_t *)cur, old_name_array_len);
}
}
else {
@@ -1352,7 +1231,7 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data)
}
if (skip == false) {
- BLI_endian_switch_int16_array((int16_t *)cur, DNA_elem_array_size(name));
+ BLI_endian_switch_int16_array((int16_t *)cur, old_name_array_len);
}
}
else if (ELEM(spc[0], SDNA_TYPE_INT, SDNA_TYPE_FLOAT)) {
@@ -1360,10 +1239,10 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data)
* but turns out we only used for runtime vars and
* only once for a struct type that's no longer used. */
- BLI_endian_switch_int32_array((int32_t *)cur, DNA_elem_array_size(name));
+ BLI_endian_switch_int32_array((int32_t *)cur, old_name_array_len);
}
else if (ELEM(spc[0], SDNA_TYPE_INT64, SDNA_TYPE_UINT64, SDNA_TYPE_DOUBLE)) {
- BLI_endian_switch_int64_array((int64_t *)cur, DNA_elem_array_size(name));
+ BLI_endian_switch_int64_array((int64_t *)cur, old_name_array_len);
}
}
}
@@ -1395,13 +1274,13 @@ void *DNA_struct_reconstruct(
/* oldSDNAnr == structnr, we're looking for the corresponding 'cur' number */
spo = oldsdna->structs[oldSDNAnr];
type = oldsdna->types[spo[0]];
- oldlen = oldsdna->typelens[spo[0]];
+ oldlen = oldsdna->types_size[spo[0]];
curSDNAnr = DNA_struct_find_nr(newsdna, type);
/* init data and alloc */
if (curSDNAnr != -1) {
spc = newsdna->structs[curSDNAnr];
- curlen = newsdna->typelens[spc[0]];
+ curlen = newsdna->types_size[spc[0]];
}
if (curlen == 0) {
return NULL;
@@ -1478,3 +1357,218 @@ int DNA_elem_type_size(const eSDNA_Type elem_nr)
/* weak */
return 8;
}
+
+/* -------------------------------------------------------------------- */
+/** \name Version Patch DNA
+ * \{ */
+
+static bool DNA_sdna_patch_struct_nr(
+ SDNA *sdna, const int struct_name_old_nr, const char *struct_name_new)
+{
+ BLI_assert(DNA_struct_find_nr(DNA_sdna_current_get(), struct_name_new) != -1);
+ const short *sp = sdna->structs[struct_name_old_nr];
+#ifdef WITH_DNA_GHASH
+ BLI_ghash_remove(sdna->structs_map, (void *)sdna->types[sp[0]], NULL, NULL);
+ BLI_ghash_insert(sdna->structs_map, (void *)struct_name_new, POINTER_FROM_INT(struct_name_old_nr));
+#endif
+ sdna->types[sp[0]] = struct_name_new;
+ return true;
+}
+/**
+ * Rename a struct
+ */
+bool DNA_sdna_patch_struct(
+ SDNA *sdna, const char *struct_name_old, const char *struct_name_new)
+{
+ const int struct_name_old_nr = DNA_struct_find_nr(sdna, struct_name_old);
+ if (struct_name_old_nr != -1) {
+ return DNA_sdna_patch_struct_nr(sdna, struct_name_old_nr, struct_name_new);
+ }
+ return false;
+}
+
+/* Make public if called often with same struct (avoid duplicate look-ups). */
+static bool DNA_sdna_patch_struct_member_nr(
+ SDNA *sdna, const int struct_name_nr, const char *elem_old, const char *elem_new)
+{
+ /* These names aren't handled here (it's not used).
+ * Ensure they are never used or we get out of sync arrays. */
+ BLI_assert(sdna->alias.names == NULL);
+ const int elem_old_len = strlen(elem_old);
+ const int elem_new_len = strlen(elem_new);
+ BLI_assert(elem_new != NULL);
+ short *sp = sdna->structs[struct_name_nr];
+ for (int elem_index = sp[1]; elem_index > 0; elem_index--, sp += 2) {
+ const char *elem_old_full = sdna->names[sp[1]];
+ /* Start & end offsets in 'elem_old_full'. */
+ uint elem_old_full_offset_start;
+ if (DNA_elem_id_match(elem_old, elem_old_len, elem_old_full, &elem_old_full_offset_start)) {
+ if (sdna->mem_arena == NULL) {
+ sdna->mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
+ }
+ const char *elem_new_full = DNA_elem_id_rename(
+ sdna->mem_arena,
+ elem_old, elem_old_len,
+ elem_new, elem_new_len,
+ elem_old_full, strlen(elem_old_full),
+ elem_old_full_offset_start);
+
+ if (sdna->nr_names == sdna->nr_names_alloc) {
+ sdna->nr_names_alloc += 64;
+ sdna->names = MEM_recallocN(
+ sdna->names, sizeof(*sdna->names) * sdna->nr_names_alloc);
+ sdna->names_array_len = MEM_recallocN(
+ (void *)sdna->names_array_len, sizeof(*sdna->names_array_len) * sdna->nr_names_alloc);
+ }
+ const short name_nr_prev = sp[1];
+ sp[1] = sdna->nr_names++;
+ sdna->names[sp[1]] = elem_new_full;
+ sdna->names_array_len[sp[1]] = sdna->names_array_len[name_nr_prev];
+
+ return true;
+ }
+ }
+ return false;
+}
+/**
+ * Replace \a elem_old with \a elem_new for struct \a struct_name
+ * handles search & replace, maintaining surrounding non-identifier characters such as pointer & array size.
+ */
+bool DNA_sdna_patch_struct_member(
+ SDNA *sdna, const char *struct_name, const char *elem_old, const char *elem_new)
+{
+ const int struct_name_nr = DNA_struct_find_nr(sdna, struct_name);
+ if (struct_name_nr != -1) {
+ return DNA_sdna_patch_struct_member_nr(sdna, struct_name_nr, elem_old, elem_new);
+ }
+ return false;
+}
+
+/** \} */
+
+
+/* -------------------------------------------------------------------- */
+/** \name Versioning (Forward Compatible)
+ *
+ * Versioning that allows new names.
+ * \{ */
+
+/**
+ * Names are shared between structs which causes problems renaming.
+ * Make sure every struct member gets it's own name so renaming only ever impacts a single struct.
+ *
+ * The resulting SDNA is never written to disk.
+ */
+static void sdna_expand_names(SDNA *sdna)
+{
+ int names_expand_len = 0;
+ for (int struct_nr = 0; struct_nr < sdna->nr_structs; struct_nr++) {
+ const short *sp = sdna->structs[struct_nr];
+ names_expand_len += sp[1];
+ }
+ const char **names_expand = MEM_mallocN(sizeof(*names_expand) * names_expand_len, __func__);
+
+ int names_expand_index = 0;
+ for (int struct_nr = 0; struct_nr < sdna->nr_structs; struct_nr++) {
+ /* We can't edit this memory 'sdna->structs' points to (readonly datatoc file). */
+ const short *sp = sdna->structs[struct_nr];
+ short *sp_expand = BLI_memarena_alloc(sdna->mem_arena, sizeof(short[2]) * (1 + sp[1]));
+ memcpy(sp_expand, sp, sizeof(short[2]) * (1 + sp[1]));
+ sdna->structs[struct_nr] = sp_expand;
+ const int names_len = sp[1];
+ sp += 2;
+ sp_expand += 2;
+ for (int i = 0; i < names_len; i++, sp += 2, sp_expand += 2) {
+ names_expand[names_expand_index] = sdna->names[sp[1]];
+ BLI_assert(names_expand_index < SHRT_MAX);
+ sp_expand[1] = names_expand_index;
+ names_expand_index++;
+ }
+ }
+ MEM_freeN((void *)sdna->names);
+ sdna->names = names_expand;
+ sdna->nr_names = names_expand_len;
+}
+
+static const char *dna_sdna_alias_alias_from_static_elem_full(
+ SDNA *sdna, GHash *elem_map_alias_from_static,
+ const char *struct_name_static, const char *elem_static_full)
+{
+ const int elem_static_full_len = strlen(elem_static_full);
+ char *elem_static = alloca(elem_static_full_len + 1);
+ const int elem_static_len = DNA_elem_id_strip_copy(elem_static, elem_static_full);
+ const char *str_pair[2] = {struct_name_static, elem_static};
+ const char *elem_alias = BLI_ghash_lookup(elem_map_alias_from_static, str_pair);
+ if (elem_alias) {
+ return DNA_elem_id_rename(
+ sdna->mem_arena,
+ elem_static, elem_static_len,
+ elem_alias, strlen(elem_alias),
+ elem_static_full, elem_static_full_len,
+ DNA_elem_id_offset_start(elem_static_full));
+ }
+ return NULL;
+}
+
+void DNA_sdna_alias_data_ensure(SDNA *sdna)
+{
+ /* We may want this to be optional later. */
+ const bool use_legacy_hack = true;
+
+ if (sdna->mem_arena == NULL) {
+ sdna->mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
+ }
+
+ GHash *struct_map_alias_from_static;
+ GHash *elem_map_alias_from_static;
+
+ DNA_alias_maps(
+ DNA_RENAME_ALIAS_FROM_STATIC,
+ &struct_map_alias_from_static,
+ &elem_map_alias_from_static);
+
+
+ if (sdna->alias.types == NULL) {
+ sdna->alias.types = MEM_mallocN(sizeof(*sdna->alias.types) * sdna->nr_types, __func__);
+ for (int type_nr = 0; type_nr < sdna->nr_types; type_nr++) {
+ const char *struct_name_static = sdna->types[type_nr];
+
+ if (use_legacy_hack) {
+ struct_name_static = DNA_struct_rename_legacy_hack_alias_from_static(struct_name_static);
+ }
+
+ sdna->alias.types[type_nr] = BLI_ghash_lookup_default(
+ struct_map_alias_from_static, struct_name_static, (void *)struct_name_static);
+ }
+ }
+
+ if (sdna->alias.names == NULL) {
+ sdna_expand_names(sdna);
+ sdna->alias.names = MEM_mallocN(sizeof(*sdna->alias.names) * sdna->nr_names, __func__);
+ for (int struct_nr = 0; struct_nr < sdna->nr_structs; struct_nr++) {
+ const short *sp = sdna->structs[struct_nr];
+ const char *struct_name_static = sdna->types[sp[0]];
+
+ if (use_legacy_hack) {
+ struct_name_static = DNA_struct_rename_legacy_hack_alias_from_static(struct_name_static);
+ }
+
+ const int dna_struct_names_len = sp[1];
+ sp += 2;
+ for (int a = 0; a < dna_struct_names_len; a++, sp += 2) {
+ const char *elem_alias_full = dna_sdna_alias_alias_from_static_elem_full(
+ sdna, elem_map_alias_from_static, struct_name_static, sdna->names[sp[1]]);
+ if (elem_alias_full != NULL) {
+ sdna->alias.names[sp[1]] = elem_alias_full;
+ }
+ else {
+ sdna->alias.names[sp[1]] = sdna->names[sp[1]];
+ }
+ }
+ }
+ }
+ BLI_ghash_free(struct_map_alias_from_static, NULL, NULL);
+ BLI_ghash_free(elem_map_alias_from_static, MEM_freeN, NULL);
+}
+
+/** \} */
diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h
new file mode 100644
index 00000000000..e1fa1e29f96
--- /dev/null
+++ b/source/blender/makesdna/intern/dna_rename_defs.h
@@ -0,0 +1,93 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ * DNA handling
+ */
+
+/** \file
+ * \ingroup DNA
+ *
+ * Defines in this header are only used to define blend file storage.
+ * This allows us to rename variables & structs without breaking compatibility.
+ *
+ * - When renaming the member of a struct which has it's self been renamed
+ * refer to the newer name, not the original.
+ *
+ * - Changes here only change generated code for `makesdna.c` and `makesrna.c`
+ * without impacting Blender's run-time, besides allowing us to use the new names.
+ *
+ * - Renaming something that has already been renamed can be done by editing the existing rename macro.
+ * All references to the previous destination name can be removed since they're
+ * never written to disk.
+ *
+ * - Old names aren't sanity checked (since this file is the only place that knows about them)
+ * typos in the old names will break both backwards & forwards compatibility **TAKE CARE**.
+ *
+ * - Before editing rename defines run:
+ *
+ * `sha1sum $BUILD_DIR/source/blender/makesdna/intern/dna.c`
+ *
+ * Compare the results before & after to ensure all changes are reversed by renaming
+ * and the DNA remains unchanged.
+ *
+ * \see versioning_dna.c for actual version patching.
+ */
+
+/* No include guard (intentional). */
+
+/* Match RNA names where possible, keep sorted. */
+
+DNA_STRUCT_RENAME(Lamp, Light)
+DNA_STRUCT_RENAME(SpaceButs, SpaceProperties)
+DNA_STRUCT_RENAME(SpaceIpo, SpaceGraph)
+DNA_STRUCT_RENAME(SpaceOops, SpaceOutliner)
+DNA_STRUCT_RENAME_ELEM(BPoint, alfa, tilt)
+DNA_STRUCT_RENAME_ELEM(BezTriple, alfa, tilt)
+DNA_STRUCT_RENAME_ELEM(Camera, YF_dofdist, dof_distance)
+DNA_STRUCT_RENAME_ELEM(Camera, clipend, clip_end)
+DNA_STRUCT_RENAME_ELEM(Camera, clipsta, clip_start)
+DNA_STRUCT_RENAME_ELEM(Collection, dupli_ofs, instance_offset)
+DNA_STRUCT_RENAME_ELEM(Object, col, color)
+DNA_STRUCT_RENAME_ELEM(Object, dup_group, instance_collection)
+DNA_STRUCT_RENAME_ELEM(Object, dupfacesca, instance_faces_scale)
+DNA_STRUCT_RENAME_ELEM(Object, size, scale)
+DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_group, instance_collection)
+DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_ob, instance_object)
+DNA_STRUCT_RENAME_ELEM(ParticleSettings, dupliweights, instance_weights)
+DNA_STRUCT_RENAME_ELEM(View3D, far, clip_end)
+DNA_STRUCT_RENAME_ELEM(View3D, near, clip_start)
+DNA_STRUCT_RENAME_ELEM(bTheme, tact, space_action)
+DNA_STRUCT_RENAME_ELEM(bTheme, tbuts, space_properties)
+DNA_STRUCT_RENAME_ELEM(bTheme, tclip, space_clip)
+DNA_STRUCT_RENAME_ELEM(bTheme, tconsole, space_console)
+DNA_STRUCT_RENAME_ELEM(bTheme, text, space_text)
+DNA_STRUCT_RENAME_ELEM(bTheme, tfile, space_file)
+DNA_STRUCT_RENAME_ELEM(bTheme, tima, space_image)
+DNA_STRUCT_RENAME_ELEM(bTheme, tinfo, space_info)
+DNA_STRUCT_RENAME_ELEM(bTheme, tipo, space_graph)
+DNA_STRUCT_RENAME_ELEM(bTheme, tnla, space_nla)
+DNA_STRUCT_RENAME_ELEM(bTheme, tnode, space_node)
+DNA_STRUCT_RENAME_ELEM(bTheme, toops, space_outliner)
+DNA_STRUCT_RENAME_ELEM(bTheme, tseq, space_sequencer)
+DNA_STRUCT_RENAME_ELEM(bTheme, tstatusbar, space_statusbar)
+DNA_STRUCT_RENAME_ELEM(bTheme, ttopbar, space_topbar)
+DNA_STRUCT_RENAME_ELEM(bTheme, tuserpref, space_preferences)
+DNA_STRUCT_RENAME_ELEM(bTheme, tv3d, space_view3d)
+
+#if 0
+DNA_STRUCT_RENAME(Light, Light)
+#endif
diff --git a/source/blender/makesdna/intern/dna_utils.c b/source/blender/makesdna/intern/dna_utils.c
new file mode 100644
index 00000000000..30c82367a37
--- /dev/null
+++ b/source/blender/makesdna/intern/dna_utils.c
@@ -0,0 +1,332 @@
+/*
+ * 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.
+ *
+ * Copyright (C) 2018 Blender Foundation.
+ */
+
+/** \file
+ * \ingroup DNA
+ *
+ * Utilities for stand-alone makesdna.c and Blender to share.
+ */
+
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_sys_types.h"
+#include "BLI_utildefines.h"
+#include "BLI_assert.h"
+#include "BLI_ghash.h"
+
+#include "BLI_memarena.h"
+
+#include "dna_utils.h"
+
+/* -------------------------------------------------------------------- */
+/** \name Struct Member Evaluation
+ * \{ */
+
+/**
+ * Parses the `[n1][n2]...` on the end of an array name
+ * and returns the number of array elements `n1 * n2 ...`.
+ */
+int DNA_elem_array_size(const char *str)
+{
+ int result = 1;
+ int current = 0;
+ while (true) {
+ char c = *str++;
+ switch (c) {
+ case '\0':
+ return result;
+ case '[':
+ current = 0;
+ break;
+ case ']':
+ result *= current;
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ current = current * 10 + (c - '0');
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Struct Member Manipulation
+ * \{ */
+
+static bool is_identifier(const char c)
+{
+ return ((c >= 'a' && c <= 'z') ||
+ (c >= 'A' && c <= 'Z') ||
+ (c >= '0' && c <= '9') ||
+ (c == '_'));
+}
+
+uint DNA_elem_id_offset_start(const char *elem_full)
+{
+ uint elem_full_offset = 0;
+ while (!is_identifier(elem_full[elem_full_offset])) {
+ elem_full_offset++;
+ }
+ return elem_full_offset;
+}
+
+uint DNA_elem_id_offset_end(const char *elem_full)
+{
+ uint elem_full_offset = 0;
+ while (is_identifier(elem_full[elem_full_offset])) {
+ elem_full_offset++;
+ }
+ return elem_full_offset;
+}
+
+/**
+ * \a elem_dst must be at least the size of \a elem_src.
+ */
+uint DNA_elem_id_strip_copy(char *elem_dst, const char *elem_src)
+{
+ const uint elem_src_offset = DNA_elem_id_offset_start(elem_src);
+ const char *elem_src_trim = elem_src + elem_src_offset;
+ const uint elem_src_trim_len = DNA_elem_id_offset_end(elem_src_trim);
+ memcpy(elem_dst, elem_src_trim, elem_src_trim_len);
+ elem_dst[elem_src_trim_len] = '\0';
+ return elem_src_trim_len;
+}
+
+uint DNA_elem_id_strip(char *elem)
+{
+ const uint elem_offset = DNA_elem_id_offset_start(elem);
+ const char *elem_trim = elem + elem_offset;
+ const uint elem_trim_len = DNA_elem_id_offset_end(elem_trim);
+ memmove(elem, elem_trim, elem_trim_len);
+ elem[elem_trim_len] = '\0';
+ return elem_trim_len;
+}
+
+/**
+ * Check if 'var' matches '*var[3]' for eg,
+ * return true if it does, with start/end offsets.
+ */
+bool DNA_elem_id_match(
+ const char *elem_search, const int elem_search_len,
+ const char *elem_full,
+ uint *r_elem_full_offset)
+{
+ BLI_assert(strlen(elem_search) == elem_search_len);
+ const uint elem_full_offset = DNA_elem_id_offset_start(elem_full);
+ const char *elem_full_trim = elem_full + elem_full_offset;
+ if (strncmp(elem_search, elem_full_trim, elem_search_len) == 0) {
+ const char c = elem_full_trim[elem_search_len];
+ if (c == '\0' || !is_identifier(c)) {
+ *r_elem_full_offset = elem_full_offset;
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * Return a renamed dna name, allocated from \a mem_arena.
+ */
+char *DNA_elem_id_rename(
+ struct MemArena *mem_arena,
+ const char *elem_src, const int elem_src_len,
+ const char *elem_dst, const int elem_dst_len,
+ const char *elem_src_full, const int elem_src_full_len,
+ const uint elem_src_full_offset_len)
+{
+ BLI_assert(strlen(elem_src) == elem_src_len);
+ BLI_assert(strlen(elem_dst) == elem_dst_len);
+ BLI_assert(strlen(elem_src_full) == elem_src_full_len);
+ BLI_assert(DNA_elem_id_offset_start(elem_src_full) == elem_src_full_offset_len);
+ UNUSED_VARS_NDEBUG(elem_src);
+
+ const int elem_final_len = (elem_src_full_len - elem_src_len) + elem_dst_len;
+ char *elem_dst_full = BLI_memarena_alloc(mem_arena, elem_final_len + 1);
+ uint i = 0;
+ if (elem_src_full_offset_len != 0) {
+ memcpy(elem_dst_full, elem_src_full, elem_src_full_offset_len);
+ i = elem_src_full_offset_len;
+ }
+ memcpy(&elem_dst_full[i], elem_dst, elem_dst_len + 1);
+ i += elem_dst_len;
+ uint elem_src_full_offset_end = elem_src_full_offset_len + elem_src_len;
+ if (elem_src_full[elem_src_full_offset_end] != '\0') {
+ const int elem_full_tail_len = (elem_src_full_len - elem_src_full_offset_end);
+ memcpy(&elem_dst_full[i], &elem_src_full[elem_src_full_offset_end], elem_full_tail_len + 1);
+ i += elem_full_tail_len;
+ }
+ BLI_assert((strlen(elem_dst_full) == elem_final_len) && (i == elem_final_len));
+ return elem_dst_full;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Versioning
+ * \{ */
+
+static uint strhash_pair_p(const void *ptr)
+{
+ const char * const *pair = ptr;
+ return (BLI_ghashutil_strhash_p(pair[0]) ^
+ BLI_ghashutil_strhash_p(pair[1]));
+}
+
+static bool strhash_pair_cmp(const void *a, const void *b)
+{
+ const char * const *pair_a = a;
+ const char * const *pair_b = b;
+ return (STREQ(pair_a[0], pair_b[0]) &&
+ STREQ(pair_a[1], pair_b[1])) ? false : true;
+}
+
+void DNA_alias_maps(
+ enum eDNA_RenameDir version_dir,
+ GHash **r_struct_map, GHash **r_elem_map)
+{
+ GHash *struct_map_local = NULL;
+ if (r_struct_map) {
+ const char *data[][2] = {
+#define DNA_STRUCT_RENAME(old, new) {#old, #new},
+#define DNA_STRUCT_RENAME_ELEM(struct_name, old, new)
+#include "dna_rename_defs.h"
+#undef DNA_STRUCT_RENAME
+#undef DNA_STRUCT_RENAME_ELEM
+ };
+
+ int elem_key, elem_val;
+ if (version_dir == DNA_RENAME_ALIAS_FROM_STATIC) {
+ elem_key = 0;
+ elem_val = 1;
+ }
+ else {
+ elem_key = 1;
+ elem_val = 0;
+ }
+ GHash *struct_map = BLI_ghash_str_new_ex(__func__, ARRAY_SIZE(data));
+ for (int i = 0; i < ARRAY_SIZE(data); i++) {
+ BLI_ghash_insert(struct_map, (void *)data[i][elem_key], (void *)data[i][elem_val]);
+ }
+ *r_struct_map = struct_map;
+
+ /* We know the direction of this, for local use. */
+ struct_map_local = BLI_ghash_str_new_ex(__func__, ARRAY_SIZE(data));
+ for (int i = 0; i < ARRAY_SIZE(data); i++) {
+ BLI_ghash_insert(struct_map_local, (void *)data[i][1], (void *)data[i][0]);
+ }
+ }
+
+ if (r_elem_map != NULL) {
+ const char *data[][3] = {
+#define DNA_STRUCT_RENAME(old, new)
+#define DNA_STRUCT_RENAME_ELEM(struct_name, old, new) {#struct_name, #old, #new},
+#include "dna_rename_defs.h"
+#undef DNA_STRUCT_RENAME
+#undef DNA_STRUCT_RENAME_ELEM
+ };
+
+ int elem_key, elem_val;
+ if (version_dir == DNA_RENAME_ALIAS_FROM_STATIC) {
+ elem_key = 1;
+ elem_val = 2;
+ }
+ else {
+ elem_key = 2;
+ elem_val = 1;
+ }
+ GHash *elem_map = BLI_ghash_new_ex(strhash_pair_p, strhash_pair_cmp, __func__, ARRAY_SIZE(data));
+ for (int i = 0; i < ARRAY_SIZE(data); i++) {
+ const char **str_pair = MEM_mallocN(sizeof(char *) * 2, __func__);
+ str_pair[0] = BLI_ghash_lookup_default(struct_map_local, data[i][0], (void *)data[i][0]);
+ str_pair[1] = data[i][elem_key];
+ BLI_ghash_insert(elem_map, str_pair, (void *)data[i][elem_val]);
+ }
+ *r_elem_map = elem_map;
+ }
+
+ if (struct_map_local) {
+ BLI_ghash_free(struct_map_local, NULL, NULL);
+ }
+}
+
+#undef DNA_MAKESDNA
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Struct Name Legacy Hack
+ * \{ */
+
+/**
+ * DNA Compatibility Hack
+ * ======================
+ *
+ * Only keep this for compatibility: **NEVER ADD NEW STRINGS HERE**.
+ *
+ * The renaming here isn't complete, references to the old struct names
+ * are still included in DNA, now fixing these struct names properly
+ * breaks forward compatibility. Leave these as-is, but don't add to them!
+ * See D4342#98780
+ */
+const char *DNA_struct_rename_legacy_hack_static_from_alias(const char *name)
+{
+ /* 'bScreen' replaces the old IrisGL 'Screen' struct */
+ if (STREQ("bScreen", name)) {
+ return "Screen";
+ }
+ /* Groups renamed to collections in 2.8 */
+ if (STREQ("Collection", name)) {
+ return "Group";
+ }
+ if (STREQ("CollectionObject", name)) {
+ return "GroupObject";
+ }
+ return name;
+}
+
+const char *DNA_struct_rename_legacy_hack_alias_from_static(const char *name)
+{
+ /* 'bScreen' replaces the old IrisGL 'Screen' struct */
+ if (STREQ("Screen", name)) {
+ return "bScreen";
+ }
+ /* Groups renamed to collections in 2.8 */
+ if (STREQ("Group", name)) {
+ return "Collection";
+ }
+ if (STREQ("GroupObject", name)) {
+ return "CollectionObject";
+ }
+ return name;
+}
+
+/** \} */
diff --git a/source/blender/makesdna/intern/dna_utils.h b/source/blender/makesdna/intern/dna_utils.h
new file mode 100644
index 00000000000..6e96cf43622
--- /dev/null
+++ b/source/blender/makesdna/intern/dna_utils.h
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+/** \file
+ * \ingroup DNA
+ */
+
+#ifndef __DNA_UTILS_H__
+#define __DNA_UTILS_H__
+
+struct GHash;
+struct MemArena;
+
+int DNA_elem_array_size(const char *str);
+
+uint DNA_elem_id_offset_start(const char *elem_full);
+uint DNA_elem_id_offset_end(const char *elem_full);
+uint DNA_elem_id_strip_copy(char *elem_dst, const char *elem_src);
+uint DNA_elem_id_strip(char *elem);
+bool DNA_elem_id_match(
+ const char *elem_search, const int elem_search_len,
+ const char *elem_full,
+ uint *r_elem_full_offset);
+char *DNA_elem_id_rename(
+ struct MemArena *mem_arena,
+ const char *elem_src, const int elem_src_len,
+ const char *elem_dst, const int elem_dst_len,
+ const char *elem_full_src, const int elem_full_src_len,
+ const uint elem_full_offset_start);
+
+/* When requesting version info, support both directions. */
+enum eDNA_RenameDir {
+ DNA_RENAME_STATIC_FROM_ALIAS = -1,
+ DNA_RENAME_ALIAS_FROM_STATIC = 1,
+};
+void DNA_alias_maps(
+ enum eDNA_RenameDir version_dir,
+ struct GHash **r_struct_map, struct GHash **r_elem_map);
+
+const char *DNA_struct_rename_legacy_hack_alias_from_static(const char *name);
+const char *DNA_struct_rename_legacy_hack_static_from_alias(const char *name);
+
+#endif /* __DNA_UTILS_H__ */
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 510f49d5a61..aee98d8ffa5 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,12 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file makesdna.c
- * \brief Struct muncher for making SDNA.
- * \ingroup DNA
+/** \file
+ * \ingroup DNA
+ *
+ * \brief Struct muncher for making SDNA.
*
* \section aboutmakesdnac About makesdna tool
* Originally by Ton, some mods by Frank, and some cleaning and
@@ -51,13 +44,19 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <assert.h>
#include "MEM_guardedalloc.h"
-#include "../blenlib/BLI_sys_types.h" // for intptr_t support
+#include "BLI_utildefines.h"
+#include "BLI_alloca.h"
+#include "BLI_ghash.h"
+#include "BLI_memarena.h"
+#include "BLI_sys_types.h" /* for intptr_t support */
-#define SDNA_MAX_FILENAME_LENGTH 255
+#include "dna_utils.h"
+#define SDNA_MAX_FILENAME_LENGTH 255
/* Included the path relative from /source/blender/ here, so we can move */
/* headers around with more freedom. */
@@ -76,7 +75,7 @@ static const char *includefiles[] = {
"DNA_camera_types.h",
"DNA_image_types.h",
"DNA_texture_types.h",
- "DNA_lamp_types.h",
+ "DNA_light_types.h",
"DNA_material_types.h",
"DNA_vfont_types.h",
"DNA_meta_types.h",
@@ -136,22 +135,43 @@ static const char *includefiles[] = {
/* see comment above before editing! */
/* empty string to indicate end of includefiles */
- ""
+ "",
};
+/* -------------------------------------------------------------------- */
+/** \name Variables
+ * \{ */
+
+static MemArena *mem_arena = NULL;
+
static int maxdata = 500000, maxnr = 50000;
static int nr_names = 0;
static int nr_types = 0;
static int nr_structs = 0;
-static char **names, *namedata; /* at address names[a] is string a */
-static char **types, *typedata; /* at address types[a] is string a */
-static short *typelens_native; /* at typelens[a] is the length of type 'a' on this systems bitness (32 or 64) */
-static short *typelens_32; /* contains sizes as they are calculated on 32 bit systems */
-static short *typelens_64; /* contains sizes as they are calculated on 64 bit systems */
-static short **structs, *structdata; /* at sp = structs[a] is the first address of a struct definition
- * sp[0] is type number
- * sp[1] is amount of elements
- * sp[2] sp[3] is typenr, namenr (etc) */
+/** At address `names[a]` is string `a`. */
+static char **names;
+/** At address `types[a]` is string `a`. */
+static char **types;
+/** At `types_size[a]` is the size of type `a` on this systems bitness (32 or 64). */
+static short *types_size_native;
+/** Contains sizes as they are calculated on 32 bit systems. */
+static short *types_size_32;
+/** Contains sizes as they are calculated on 64 bit systems. */
+static short *types_size_64;
+/** At `sp = structs[a]` is the first address of a struct definition:
+ * - `sp[0]` is type number.
+ * - `sp[1]` is the length of the element array (next).
+ * - `sp[2]` sp[3] is [(type_nr, name_nr), ..] (number of pairs is defined by `sp[1]`),
+ */
+static short **structs, *structdata;
+
+/** Versioning data */
+static struct {
+ GHash *struct_map_alias_from_static;
+ GHash *struct_map_static_from_alias;
+ GHash *elem_map_static_from_alias;
+} g_version_data = {NULL};
+
/**
* Variable to control debug output of makesdna.
* debugSDNA:
@@ -163,20 +183,36 @@ static short **structs, *structdata; /* at sp = structs[a] is the first address
static int debugSDNA = 0;
static int additional_slen_offset;
-/* ************************************************************************** */
-/* Functions */
-/* ************************************************************************** */
+#define DEBUG_PRINTF(debug_level, ...) \
+ { if (debugSDNA > debug_level) { printf(__VA_ARGS__); } } ((void)0)
+
+
+/* stub for BLI_abort() */
+#ifndef NDEBUG
+void BLI_system_backtrace(FILE *fp)
+{
+ (void)fp;
+}
+#endif
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Function Declarations
+ * \{ */
/**
- * Add type \c str to struct indexed by \c len, if it was not yet found.
- * \param str: char
- * \param len: int
+ * Ensure type \c str to is in the #types array.
+ * \param str: Struct name without any qualifiers.
+ * \param len: The struct size in bytes.
+ * \return Index in the #types array.
*/
-static int add_type(const char *str, int len);
+static int add_type(const char *str, int size);
/**
- * Add variable \c str to
- * \param str:
+ * Ensure \c str is int the #names array.
+ * \param str: Struct member name which may include pointer prefix & array size.
+ * \return Index in the #names array.
*/
static int add_name(const char *str);
@@ -190,7 +226,7 @@ static short *add_struct(int namecode);
* Remove comments from this buffer. Assumes that the buffer refers to
* ascii-code text.
*/
-static int preprocess_include(char *maindata, int len);
+static int preprocess_include(char *maindata, const int maindata_len);
/**
* Scan this file for serializable types.
@@ -198,14 +234,9 @@ static int preprocess_include(char *maindata, int len);
static int convert_include(const char *filename);
/**
- * Determine how many bytes are needed for an array.
- */
-static int arraysize(const char *str);
-
-/**
* Determine how many bytes are needed for each struct.
*/
-static int calculate_structlens(int);
+static int calculate_struct_sizes(int);
/**
* Construct the DNA.c file
@@ -215,17 +246,97 @@ static void dna_write(FILE *file, const void *pntr, const int size);
/**
* Report all structures found so far, and print their lengths.
*/
-void printStructLengths(void);
+void print_struct_sizes(void);
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Implementation
+ *
+ * Make DNA string (write to file).
+ * \{ */
+
+
+static const char *version_struct_static_from_alias(const char *str)
+{
+ const char *str_test = BLI_ghash_lookup(g_version_data.struct_map_static_from_alias, str);
+ if (str_test != NULL) {
+ return str_test;
+ }
+ return str;
+}
+static const char *version_struct_alias_from_static(const char *str)
+{
+ const char *str_test = BLI_ghash_lookup(g_version_data.struct_map_alias_from_static, str);
+ if (str_test != NULL) {
+ return str_test;
+ }
+ return str;
+}
+static const char *version_elem_static_from_alias(
+ const int strct, const char *elem_alias_full)
+{
+ const uint elem_alias_full_len = strlen(elem_alias_full);
+ char *elem_alias = alloca(elem_alias_full_len + 1);
+ const int elem_alias_len = DNA_elem_id_strip_copy(elem_alias, elem_alias_full);
+ const char *str_pair[2] = {types[strct], elem_alias};
+ const char *elem_static = BLI_ghash_lookup(g_version_data.elem_map_static_from_alias, str_pair);
+ if (elem_static != NULL) {
+ return DNA_elem_id_rename(
+ mem_arena,
+ elem_alias, elem_alias_len,
+ elem_static, strlen(elem_static),
+ elem_alias_full, elem_alias_full_len,
+ DNA_elem_id_offset_start(elem_alias_full));
+ }
+ return elem_alias_full;
+}
-/* ************************************************************************** */
-/* Implementation */
-/* ************************************************************************** */
+/**
+ * Enforce '_pad123' naming convention, disallow 'pad123' or 'pad_123',
+ * special exception for [a-z] after since there is a 'pad_rot_angle' preference.
+ */
+static bool is_name_legal(const char *name)
+{
+ const int name_size = strlen(name) + 1;
+ char *name_strip = alloca(name_size);
+ DNA_elem_id_strip_copy(name_strip, name);
-/* ************************* MAKEN DNA ********************** */
+ const char prefix[] = {'p', 'a', 'd'};
-static int add_type(const char *str, int len)
+ if (name[0] == '_') {
+ if (strncmp(&name_strip[1], prefix, sizeof(prefix)) != 0) {
+ fprintf(stderr, "Error: only '_pad' variables can start with an underscore, found '%s'\n", name);
+ return false;
+ }
+ }
+ else if (strncmp(name_strip, prefix, sizeof(prefix)) == 0) {
+ int i = sizeof(prefix);
+ if (name_strip[i] >= 'a' && name_strip[i] <= 'z') {
+ /* may be part of a word, allow that. */
+ return true;
+ }
+ bool has_only_digit_or_none = true;
+ for (; name_strip[i]; i++) {
+ const char c = name_strip[i];
+ if (!((c >= '0' && c <= '9') || c == '_')) {
+ has_only_digit_or_none = false;
+ break;
+ }
+ }
+ if (has_only_digit_or_none) {
+ /* found 'pad' or 'pad123'. */
+ fprintf(stderr, "Error: padding variables must be formatted '_pad[number]', found '%s'\n", name);
+ return false;
+ }
+ }
+ return true;
+}
+
+
+static int add_type(const char *str, int size)
{
int nr;
char *cp;
@@ -240,30 +351,28 @@ static int add_type(const char *str, int len)
return -1;
}
+ str = version_struct_static_from_alias(str);
+
/* search through type array */
for (nr = 0; nr < nr_types; nr++) {
if (strcmp(str, types[nr]) == 0) {
- if (len) {
- typelens_native[nr] = len;
- typelens_32[nr] = len;
- typelens_64[nr] = len;
+ if (size) {
+ types_size_native[nr] = size;
+ types_size_32[nr] = size;
+ types_size_64[nr] = size;
}
return nr;
}
}
/* append new type */
- if (nr_types == 0) {
- cp = typedata;
- }
- else {
- cp = types[nr_types - 1] + strlen(types[nr_types - 1]) + 1;
- }
- strcpy(cp, str);
+ const int str_size = strlen(str) + 1;
+ cp = BLI_memarena_alloc(mem_arena, str_size);
+ memcpy(cp, str, str_size);
types[nr_types] = cp;
- typelens_native[nr_types] = len;
- typelens_32[nr_types] = len;
- typelens_64[nr_types] = len;
+ types_size_native[nr_types] = size;
+ types_size_32[nr_types] = size;
+ types_size_64[nr_types] = size;
if (nr_types >= maxnr) {
printf("too many types\n");
@@ -301,7 +410,7 @@ static int add_name(const char *str)
* way in old dna too, and works correct with elementsize() */
int isfuncptr = (strchr(str + 1, '(')) != NULL;
- if (debugSDNA > 3) printf("\t\t\t\t*** Function pointer or multidim array pointer found\n");
+ DEBUG_PRINTF(3, "\t\t\t\t*** Function pointer or multidim array pointer found\n");
/* functionpointer: transform the type (sometimes) */
i = 0;
@@ -315,38 +424,36 @@ static int add_name(const char *str)
* space, no overshoot should be calculated. */
j = i; /* j at first closing brace */
- if (debugSDNA > 3) printf("first brace after offset %d\n", i);
+ DEBUG_PRINTF(3, "first brace after offset %d\n", i);
j++; /* j beyond closing brace ? */
while ((str[j] != 0) && (str[j] != ')')) {
- if (debugSDNA > 3) printf("seen %c ( %d)\n", str[j], str[j]);
+ DEBUG_PRINTF(3, "seen %c (%d)\n", str[j], str[j]);
j++;
}
- if (debugSDNA > 3) printf("seen %c ( %d)\n"
- "special after offset%d\n",
- str[j], str[j], j);
+ DEBUG_PRINTF(3, "seen %c (%d)\n" "special after offset%d\n", str[j], str[j], j);
if (!isfuncptr) {
/* multidimensional array pointer case */
if (str[j] == 0) {
- if (debugSDNA > 3) printf("offsetting for multidim array pointer\n");
+ DEBUG_PRINTF(3, "offsetting for multidim array pointer\n");
}
else
printf("Error during tokening multidim array pointer\n");
}
else if (str[j] == 0) {
- if (debugSDNA > 3) printf("offsetting for space\n");
+ DEBUG_PRINTF(3, "offsetting for space\n");
/* get additional offset */
k = 0;
while (str[j] != ')') {
j++;
k++;
}
- if (debugSDNA > 3) printf("extra offset %d\n", k);
+ DEBUG_PRINTF(3, "extra offset %d\n", k);
additional_slen_offset = k;
}
else if (str[j] == ')') {
- if (debugSDNA > 3) printf("offsetting for brace\n");
+ DEBUG_PRINTF(3, "offsetting for brace\n");
; /* don't get extra offset */
}
else {
@@ -366,7 +473,7 @@ static int add_name(const char *str)
*
* */
buf[i] = 0;
- if (debugSDNA > 3) printf("Name before chomping: %s\n", buf);
+ DEBUG_PRINTF(3, "Name before chomping: %s\n", buf);
if ((strncmp(buf, "(*headdraw", 10) == 0) ||
(strncmp(buf, "(*windraw", 9) == 0) )
{
@@ -386,7 +493,7 @@ static int add_name(const char *str)
buf[i + 3] = 0;
}
/* now precede with buf*/
- if (debugSDNA > 3) printf("\t\t\t\t\tProposing fp name %s\n", buf);
+ DEBUG_PRINTF(3, "\t\t\t\t\tProposing fp name %s\n", buf);
name = buf;
}
else {
@@ -401,14 +508,15 @@ static int add_name(const char *str)
}
}
- /* append new type */
- if (nr_names == 0) {
- cp = namedata;
- }
- else {
- cp = names[nr_names - 1] + strlen(names[nr_names - 1]) + 1;
+ /* Sanity check the name. */
+ if (!is_name_legal(name)) {
+ return -1;
}
- strcpy(cp, name);
+
+ /* Append new name. */
+ const int name_size = strlen(name) + 1;
+ cp = BLI_memarena_alloc(mem_arena, name_size);
+ memcpy(cp, name, name_size);
names[nr_names] = cp;
if (nr_names >= maxnr) {
@@ -446,22 +554,22 @@ static short *add_struct(int namecode)
return sp;
}
-static int preprocess_include(char *maindata, int len)
+static int preprocess_include(char *maindata, const int maindata_len)
{
int a, newlen, comment = 0;
char *cp, *temp, *md;
/* note: len + 1, last character is a dummy to prevent
* comparisons using uninitialized memory */
- temp = MEM_mallocN(len + 1, "preprocess_include");
- temp[len] = ' ';
+ temp = MEM_mallocN(maindata_len + 1, "preprocess_include");
+ temp[maindata_len] = ' ';
- memcpy(temp, maindata, len);
+ memcpy(temp, maindata, maindata_len);
/* remove all c++ comments */
/* replace all enters/tabs/etc with spaces */
cp = temp;
- a = len;
+ a = maindata_len;
comment = 0;
while (a--) {
if (cp[0] == '/' && cp[1] == '/') {
@@ -480,7 +588,7 @@ static int preprocess_include(char *maindata, int len)
md = maindata;
newlen = 0;
comment = 0;
- a = len;
+ a = maindata_len;
while (a--) {
if (cp[0] == '/' && cp[1] == '*') {
@@ -576,24 +684,24 @@ static int convert_include(const char *filename)
/* read include file, skip structs with a '#' before it.
* store all data in temporal arrays.
*/
- int filelen, count, slen, type, name, strct;
+ int maindata_len, count, slen, type, name, strct;
short *structpoin, *sp;
char *maindata, *mainend, *md, *md1;
bool skip_struct;
- md = maindata = read_file_data(filename, &filelen);
- if (filelen == -1) {
+ md = maindata = read_file_data(filename, &maindata_len);
+ if (maindata_len == -1) {
fprintf(stderr, "Can't read file %s\n", filename);
return 1;
}
- filelen = preprocess_include(maindata, filelen);
- mainend = maindata + filelen - 1;
+ maindata_len = preprocess_include(maindata, maindata_len);
+ mainend = maindata + maindata_len - 1;
/* we look for '{' and then back to 'struct' */
count = 0;
skip_struct = false;
- while (count < filelen) {
+ while (count < maindata_len) {
/* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */
if (md[0] == '#' && md[1] == ' ' && md[2] == '#') {
@@ -623,7 +731,7 @@ static int convert_include(const char *filename)
structpoin = add_struct(strct);
sp = structpoin + 2;
- if (debugSDNA > 1) printf("\t|\t|-- detected struct %s\n", types[strct]);
+ DEBUG_PRINTF(1, "\t|\t|-- detected struct %s\n", types[strct]);
/* first lets make it all nice strings */
md1 = md + 1;
@@ -652,7 +760,7 @@ static int convert_include(const char *filename)
return 1;
}
- if (debugSDNA > 1) printf("\t|\t|\tfound type %s (", md1);
+ DEBUG_PRINTF(1, "\t|\t|\tfound type %s (", md1);
md1 += strlen(md1);
@@ -669,13 +777,18 @@ static int convert_include(const char *filename)
if (md1[slen - 1] == ';') {
md1[slen - 1] = 0;
-
- name = add_name(md1);
+ name = add_name(version_elem_static_from_alias(strct, md1));
+ if (name == -1) {
+ fprintf(stderr, "File '%s' contains struct with name that can't be added \"%s\"\n", filename, md1);
+ return 1;
+ }
slen += additional_slen_offset;
sp[0] = type;
sp[1] = name;
- if ((debugSDNA > 1) && (names[name] != NULL)) printf("%s |", names[name]);
+ if (names[name] != NULL) {
+ DEBUG_PRINTF(1, "%s |", names[name]);
+ }
structpoin[1]++;
sp += 2;
@@ -684,13 +797,18 @@ static int convert_include(const char *filename)
break;
}
-
- name = add_name(md1);
+ name = add_name(version_elem_static_from_alias(strct, md1));
+ if (name == -1) {
+ fprintf(stderr, "File '%s' contains struct with name that can't be added \"%s\"\n", filename, md1);
+ return 1;
+ }
slen += additional_slen_offset;
sp[0] = type;
sp[1] = name;
- if ((debugSDNA > 1) && (names[name] != NULL)) printf("%s ||", names[name]);
+ if (names[name] != NULL) {
+ DEBUG_PRINTF(1, "%s ||", names[name]);
+ }
structpoin[1]++;
sp += 2;
@@ -700,7 +818,7 @@ static int convert_include(const char *filename)
md1++;
}
- if (debugSDNA > 1) printf(")\n");
+ DEBUG_PRINTF(1, ")\n");
}
md1++;
@@ -717,40 +835,21 @@ static int convert_include(const char *filename)
return 0;
}
-static int arraysize(const char *str)
-{
- int a, mul = 1;
- const char *cp = NULL;
-
- for (a = 0; str[a]; a++) {
- if (str[a] == '[') {
- cp = &(str[a + 1]);
- }
- else if (str[a] == ']' && cp) {
- /* if 'cp' is a preprocessor definition, it will evaluate to 0,
- * the caller needs to check for this case and throw an error */
- mul *= atoi(cp);
- }
- }
-
- return mul;
-}
-
static bool check_field_alignment(int firststruct, int structtype, int type, int len,
const char *name, const char *detail)
{
bool result = true;
- if (type < firststruct && typelens_native[type] > 4 && (len % 8)) {
+ if (type < firststruct && types_size_native[type] > 4 && (len % 8)) {
fprintf(stderr, "Align 8 error (%s) in struct: %s %s (add %d padding bytes)\n",
detail, types[structtype], name, len % 8);
result = false;
}
- if (typelens_native[type] > 3 && (len % 4) ) {
+ if (types_size_native[type] > 3 && (len % 4) ) {
fprintf(stderr, "Align 4 error (%s) in struct: %s %s (add %d padding bytes)\n",
detail, types[structtype], name, len % 4);
result = false;
}
- if (typelens_native[type] == 2 && (len % 2) ) {
+ if (types_size_native[type] == 2 && (len % 2) ) {
fprintf(stderr, "Align 2 error (%s) in struct: %s %s (add %d padding bytes)\n",
detail, types[structtype], name, len % 2);
result = false;
@@ -758,7 +857,7 @@ static bool check_field_alignment(int firststruct, int structtype, int type, int
return result;
}
-static int calculate_structlens(int firststruct)
+static int calculate_struct_sizes(int firststruct)
{
int unknown = nr_structs, lastunknown;
bool dna_error = false;
@@ -773,12 +872,12 @@ static int calculate_structlens(int firststruct)
const int structtype = structpoin[0];
/* when length is not known... */
- if (typelens_native[structtype] == 0) {
+ if (types_size_native[structtype] == 0) {
const short *sp = structpoin + 2;
- int len_native = 0;
- int len_32 = 0;
- int len_64 = 0;
+ int size_native = 0;
+ int size_32 = 0;
+ int size_64 = 0;
bool has_pointer = false;
/* check all elements in struct */
@@ -792,7 +891,9 @@ static int calculate_structlens(int firststruct)
has_pointer = 1;
/* has the name an extra length? (array) */
int mul = 1;
- if (cp[namelen - 1] == ']') mul = arraysize(cp);
+ if (cp[namelen - 1] == ']') {
+ mul = DNA_elem_array_size(cp);
+ }
if (mul == 0) {
fprintf(stderr, "Zero array size found or could not parse %s: '%.*s'\n",
@@ -802,41 +903,44 @@ static int calculate_structlens(int firststruct)
/* 4-8 aligned/ */
if (sizeof(void *) == 4) {
- if (len_native % 4) {
- fprintf(stderr, "Align pointer error in struct (len_native 4): %s %s\n",
+ if (size_native % 4) {
+ fprintf(stderr, "Align pointer error in struct (size_native 4): %s %s\n",
types[structtype], cp);
dna_error = 1;
}
}
else {
- if (len_native % 8) {
- fprintf(stderr, "Align pointer error in struct (len_native 8): %s %s\n",
+ if (size_native % 8) {
+ fprintf(stderr, "Align pointer error in struct (size_native 8): %s %s\n",
types[structtype], cp);
dna_error = 1;
}
}
- if (len_64 % 8) {
- fprintf(stderr, "Align pointer error in struct (len_64 8): %s %s\n",
+ if (size_64 % 8) {
+ fprintf(stderr, "Align pointer error in struct (size_64 8): %s %s\n",
types[structtype], cp);
dna_error = 1;
}
- len_native += sizeof(void *) * mul;
- len_32 += 4 * mul;
- len_64 += 8 * mul;
+ size_native += sizeof(void *) * mul;
+ size_32 += 4 * mul;
+ size_64 += 8 * mul;
}
else if (cp[0] == '[') {
- /* parsing can cause names "var" and "[3]" to be found for "float var [3]" ... */
+ /* parsing can cause names "var" and "[3]"
+ * to be found for "float var [3]" */
fprintf(stderr, "Parse error in struct, invalid member name: %s %s\n",
types[structtype], cp);
dna_error = 1;
}
- else if (typelens_native[type]) {
+ else if (types_size_native[type]) {
/* has the name an extra length? (array) */
int mul = 1;
- if (cp[namelen - 1] == ']') mul = arraysize(cp);
+ if (cp[namelen - 1] == ']') {
+ mul = DNA_elem_array_size(cp);
+ }
if (mul == 0) {
fprintf(stderr, "Zero array size found or could not parse %s: '%.*s'\n",
@@ -846,7 +950,7 @@ static int calculate_structlens(int firststruct)
/* struct alignment */
if (type >= firststruct) {
- if (sizeof(void *) == 8 && (len_native % 8) ) {
+ if (sizeof(void *) == 8 && (size_native % 8) ) {
fprintf(stderr, "Align struct error: %s %s\n",
types[structtype], cp);
dna_error = 1;
@@ -854,46 +958,46 @@ static int calculate_structlens(int firststruct)
}
/* Check 2-4-8 aligned. */
- if (!check_field_alignment(firststruct, structtype, type, len_32, cp, "32 bit")) {
+ if (!check_field_alignment(firststruct, structtype, type, size_32, cp, "32 bit")) {
dna_error = 1;
}
- if (!check_field_alignment(firststruct, structtype, type, len_64, cp, "64 bit")) {
+ if (!check_field_alignment(firststruct, structtype, type, size_64, cp, "64 bit")) {
dna_error = 1;
}
- len_native += mul * typelens_native[type];
- len_32 += mul * typelens_32[type];
- len_64 += mul * typelens_64[type];
+ size_native += mul * types_size_native[type];
+ size_32 += mul * types_size_32[type];
+ size_64 += mul * types_size_64[type];
}
else {
- len_native = 0;
- len_32 = 0;
- len_64 = 0;
+ size_native = 0;
+ size_32 = 0;
+ size_64 = 0;
break;
}
}
- if (len_native == 0) {
+ if (size_native == 0) {
unknown++;
}
else {
- typelens_native[structtype] = len_native;
- typelens_32[structtype] = len_32;
- typelens_64[structtype] = len_64;
+ types_size_native[structtype] = size_native;
+ types_size_32[structtype] = size_32;
+ types_size_64[structtype] = size_64;
/* two ways to detect if a struct contains a pointer:
- * has_pointer is set or len_native doesn't match any of 32/64bit lengths*/
- if (has_pointer || len_64 != len_native || len_32 != len_native) {
- if (len_64 % 8) {
+ * has_pointer is set or size_native doesn't match any of 32/64bit lengths*/
+ if (has_pointer || size_64 != size_native || size_32 != size_native) {
+ if (size_64 % 8) {
fprintf(stderr, "Sizeerror 8 in struct: %s (add %d bytes)\n",
- types[structtype], len_64 % 8);
+ types[structtype], size_64 % 8);
dna_error = 1;
}
}
- if (len_native % 4) {
+ if (size_native % 4) {
fprintf(stderr, "Sizeerror 4 in struct: %s (add %d bytes)\n",
- types[structtype], len_native % 4);
+ types[structtype], size_native % 4);
dna_error = 1;
}
@@ -915,7 +1019,7 @@ static int calculate_structlens(int firststruct)
const int structtype = structpoin[0];
/* length unknown */
- if (typelens_native[structtype] != 0) {
+ if (types_size_native[structtype] != 0) {
fprintf(stderr, " %s\n", types[structtype]);
}
}
@@ -929,7 +1033,7 @@ static int calculate_structlens(int firststruct)
const int structtype = structpoin[0];
/* length unknown yet */
- if (typelens_native[structtype] == 0) {
+ if (types_size_native[structtype] == 0) {
fprintf(stderr, " %s\n", types[structtype]);
}
}
@@ -937,7 +1041,7 @@ static int calculate_structlens(int firststruct)
dna_error = 1;
}
- return(dna_error);
+ return dna_error;
}
#define MAX_DNA_LINE_LENGTH 20
@@ -960,7 +1064,7 @@ static void dna_write(FILE *file, const void *pntr, const int size)
}
}
-void printStructLengths(void)
+void print_struct_sizes(void)
{
int a, unknown = nr_structs, structtype;
/*int lastunknown;*/ /*UNUSED*/
@@ -975,7 +1079,7 @@ void printStructLengths(void)
for (a = 0; a < nr_structs; a++) {
structpoin = structs[a];
structtype = structpoin[0];
- printf("\t%s\t:%d\n", types[structtype], typelens_native[structtype]);
+ printf("\t%s\t:%d\n", types[structtype], types_size_native[structtype]);
}
}
@@ -986,11 +1090,11 @@ void printStructLengths(void)
static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offsets)
{
- int len, i;
+ int i;
const short *sp;
/* str contains filenames. Since we now include paths, I stretched */
/* it a bit. Hope this is enough :) -nzc- */
- char str[SDNA_MAX_FILENAME_LENGTH], *cp;
+ char str[SDNA_MAX_FILENAME_LENGTH];
int firststruct;
if (debugSDNA > 0) {
@@ -998,19 +1102,29 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
printf("Running makesdna at debug level %d\n", debugSDNA);
}
+ mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
+
/* the longest known struct is 50k, so we assume 100k is sufficient! */
- namedata = MEM_callocN(maxdata, "namedata");
- typedata = MEM_callocN(maxdata, "typedata");
structdata = MEM_callocN(maxdata, "structdata");
/* a maximum of 5000 variables, must be sufficient? */
names = MEM_callocN(sizeof(char *) * maxnr, "names");
types = MEM_callocN(sizeof(char *) * maxnr, "types");
- typelens_native = MEM_callocN(sizeof(short) * maxnr, "typelens_native");
- typelens_32 = MEM_callocN(sizeof(short) * maxnr, "typelens_32");
- typelens_64 = MEM_callocN(sizeof(short) * maxnr, "typelens_64");
+ types_size_native = MEM_callocN(sizeof(short) * maxnr, "types_size_native");
+ types_size_32 = MEM_callocN(sizeof(short) * maxnr, "types_size_32");
+ types_size_64 = MEM_callocN(sizeof(short) * maxnr, "types_size_64");
structs = MEM_callocN(sizeof(short *) * maxnr, "structs");
+ /* Build versioning data */
+ DNA_alias_maps(
+ DNA_RENAME_ALIAS_FROM_STATIC,
+ &g_version_data.struct_map_alias_from_static,
+ NULL);
+ DNA_alias_maps(
+ DNA_RENAME_STATIC_FROM_ALIAS,
+ &g_version_data.struct_map_static_from_alias,
+ &g_version_data.elem_map_static_from_alias);
+
/**
* Insertion of all known types.
*
@@ -1042,19 +1156,19 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
/* Since the internal file+path name buffer has limited length, I do a */
/* little test first... */
/* Mind the breaking condition here! */
- if (debugSDNA) printf("\tStart of header scan:\n");
+ DEBUG_PRINTF(0, "\tStart of header scan:\n");
for (i = 0; *(includefiles[i]) != '\0'; i++) {
sprintf(str, "%s%s", baseDirectory, includefiles[i]);
- if (debugSDNA) printf("\t|-- Converting %s\n", str);
+ DEBUG_PRINTF(0, "\t|-- Converting %s\n", str);
if (convert_include(str)) {
- return (1);
+ return 1;
}
}
- if (debugSDNA) printf("\tFinished scanning %d headers.\n", i);
+ DEBUG_PRINTF(0, "\tFinished scanning %d headers.\n", i);
- if (calculate_structlens(firststruct)) {
+ if (calculate_struct_sizes(firststruct)) {
/* error */
- return(1);
+ return 1;
}
/* FOR DEBUG */
@@ -1069,7 +1183,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
}
printf("\n");
- sp = typelens_native;
+ sp = types_size_native;
for (a = 0; a < nr_types; a++, sp++) {
printf(" %s %d\n", types[a], *sp);
}
@@ -1077,7 +1191,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
for (a = 0; a < nr_structs; a++) {
sp = structs[a];
- printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1], typelens_native[sp[0]]);
+ printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1], types_size_native[sp[0]]);
num_types = sp[1];
sp += 2;
/* ? num_types was elem? */
@@ -1089,45 +1203,55 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
/* file writing */
- if (debugSDNA > 0) printf("Writing file ... ");
+ DEBUG_PRINTF(0, "Writing file ... ");
if (nr_names == 0 || nr_structs == 0) {
/* pass */
}
else {
+ const char nil_bytes[4] = {0};
+ int len, len_align;
+
dna_write(file, "SDNA", 4);
/* write names */
dna_write(file, "NAME", 4);
len = nr_names;
dna_write(file, &len, 4);
-
- /* calculate size of datablock with strings */
- cp = names[nr_names - 1];
- cp += strlen(names[nr_names - 1]) + 1; /* +1: null-terminator */
- len = (intptr_t) (cp - (char *) names[0]);
- len = (len + 3) & ~3;
- dna_write(file, names[0], len);
+ /* write array */
+ len = 0;
+ for (int nr = 0; nr < nr_names; nr++) {
+ int name_size = strlen(names[nr]) + 1;
+ dna_write(file, names[nr], name_size);
+ len += name_size;
+ }
+ len_align = (len + 3) & ~3;
+ if (len != len_align) {
+ dna_write(file, nil_bytes, len_align - len);
+ }
/* write TYPES */
dna_write(file, "TYPE", 4);
len = nr_types;
dna_write(file, &len, 4);
-
- /* calculate datablock size */
- cp = types[nr_types - 1];
- cp += strlen(types[nr_types - 1]) + 1; /* +1: null-terminator */
- len = (intptr_t) (cp - (char *) types[0]);
- len = (len + 3) & ~3;
-
- dna_write(file, types[0], len);
+ /* write array */
+ len = 0;
+ for (int nr = 0; nr < nr_types; nr++) {
+ int type_size = strlen(types[nr]) + 1;
+ dna_write(file, types[nr], type_size);
+ len += type_size;
+ }
+ len_align = (len + 3) & ~3;
+ if (len != len_align) {
+ dna_write(file, nil_bytes, len_align - len);
+ }
/* WRITE TYPELENGTHS */
dna_write(file, "TLEN", 4);
len = 2 * nr_types;
if (nr_types & 1) len += 2;
- dna_write(file, typelens_native, len);
+ dna_write(file, types_size_native, len);
/* WRITE STRUCTS */
dna_write(file, "STRC", 4);
@@ -1159,7 +1283,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
}
fprintf(fp, "main() {\n");
- sp = typelens_native;
+ sp = types_size_native;
sp += firststruct;
for (a = firststruct; a < nr_types; a++, sp++) {
if (*sp) {
@@ -1183,33 +1307,69 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
for (i = 0; i < nr_structs; i++) {
const short *structpoin = structs[i];
const int structtype = structpoin[0];
- fprintf(file_offsets, "\t_SDNA_TYPE_%s = %d,\n", types[structtype], i);
+ fprintf(file_offsets, "\t_SDNA_TYPE_%s = %d,\n", version_struct_alias_from_static(types[structtype]), i);
}
fprintf(file_offsets, "\tSDNA_TYPE_MAX = %d,\n", nr_structs);
fprintf(file_offsets, "};\n");
}
- MEM_freeN(namedata);
- MEM_freeN(typedata);
+ /* Check versioning errors which could cause duplicate names,
+ * do last because names are stripped. */
+ {
+ GSet *names_unique = BLI_gset_str_new_ex(__func__, 512);
+ for (int struct_nr = 0; struct_nr < nr_structs; struct_nr++) {
+ sp = structs[struct_nr];
+ const char *struct_name = types[sp[0]];
+ const int len = sp[1];
+ sp += 2;
+ for (int a = 0; a < len; a++, sp += 2) {
+ char *name = names[sp[1]];
+ DNA_elem_id_strip(name);
+ if (!BLI_gset_add(names_unique, name)) {
+ fprintf(stderr, "Error: duplicate name found '%s.%s', "
+ "likely cause is 'dna_rename_defs.h'\n",
+ struct_name, name);
+ return 1;
+ }
+ }
+ BLI_gset_clear(names_unique, NULL);
+ }
+ BLI_gset_free(names_unique, NULL);
+ }
+
MEM_freeN(structdata);
MEM_freeN(names);
MEM_freeN(types);
- MEM_freeN(typelens_native);
- MEM_freeN(typelens_32);
- MEM_freeN(typelens_64);
+ MEM_freeN(types_size_native);
+ MEM_freeN(types_size_32);
+ MEM_freeN(types_size_64);
MEM_freeN(structs);
- if (debugSDNA > 0) printf("done.\n");
+ BLI_memarena_free(mem_arena);
+
+ BLI_ghash_free(g_version_data.struct_map_alias_from_static, NULL, NULL);
+ BLI_ghash_free(g_version_data.struct_map_static_from_alias, NULL, NULL);
+ BLI_ghash_free(g_version_data.elem_map_static_from_alias, MEM_freeN, NULL);
- return(0);
+ DEBUG_PRINTF(0, "done.\n");
+
+ return 0;
}
-/* ************************* END MAKE DNA ********************** */
+/** \} */
+
+/* end make DNA. */
+
+/* -------------------------------------------------------------------- */
+/** \name Main Function
+ * \{ */
static void make_bad_file(const char *file, int line)
{
FILE *fp = fopen(file, "w");
- fprintf(fp, "#error \"Error! can't make correct DNA.c file from %s:%d, STUPID!\"\n", __FILE__, line);
+ fprintf(fp,
+ "#error \"Error! can't make correct DNA.c file from %s:%d, check alignment.\"\n",
+ __FILE__, line);
fclose(fp);
}
@@ -1246,6 +1406,7 @@ int main(int argc, char **argv)
baseDirectory = BASE_HEADER;
}
+ fprintf(file_dna, "extern const unsigned char DNAstr[];\n");
fprintf(file_dna, "const unsigned char DNAstr[] = {\n");
if (make_structDNA(baseDirectory, file_dna, file_dna_offsets)) {
/* error */
@@ -1256,6 +1417,7 @@ int main(int argc, char **argv)
}
else {
fprintf(file_dna, "};\n");
+ fprintf(file_dna, "extern const int DNAlen;\n");
fprintf(file_dna, "const int DNAlen = sizeof(DNAstr);\n");
}
}
@@ -1269,7 +1431,7 @@ int main(int argc, char **argv)
}
- return(return_status);
+ return return_status;
}
/* handy but fails on struct bounds which makesdna doesn't care about
@@ -1303,7 +1465,7 @@ int main(int argc, char **argv)
#include "DNA_camera_types.h"
#include "DNA_image_types.h"
#include "DNA_texture_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_vfont_types.h"
#include "DNA_meta_types.h"
@@ -1361,3 +1523,25 @@ int main(int argc, char **argv)
#include "DNA_lightprobe_types.h"
/* end of list */
+
+/** \} */
+
+
+/* -------------------------------------------------------------------- */
+/** \name DNA Renaming Sanity Check
+ *
+ * Without this it's possible to reference struct members that don't exist,
+ * breaking backward & forward compatibility.
+ *
+ * \{ */
+
+static void UNUSED_FUNCTION(dna_rename_defs_ensure)(void)
+{
+#define DNA_STRUCT_RENAME(old, new) (void)sizeof(new);
+#define DNA_STRUCT_RENAME_ELEM(struct_name, old, new) (void)offsetof(struct_name, new);
+#include "dna_rename_defs.h"
+#undef DNA_STRUCT_RENAME
+#undef DNA_STRUCT_RENAME_ELEM
+}
+
+/** \} */
diff --git a/source/blender/makesrna/CMakeLists.txt b/source/blender/makesrna/CMakeLists.txt
index 638d618d785..0f6550b1453 100644
--- a/source/blender/makesrna/CMakeLists.txt
+++ b/source/blender/makesrna/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
add_subdirectory(intern)
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 859c373dd49..638e088c7b2 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __RNA_ACCESS_H__
#define __RNA_ACCESS_H__
-/** \file RNA_access.h
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdarg.h>
@@ -37,7 +31,6 @@
extern "C" {
#endif
-struct bContext;
struct ID;
struct IDOverrideStatic;
struct IDOverrideStaticProperty;
@@ -46,6 +39,7 @@ struct ListBase;
struct Main;
struct ReportList;
struct Scene;
+struct bContext;
/* Types */
extern BlenderRNA BLENDER_RNA;
@@ -67,7 +61,6 @@ extern StructRNA RNA_AndController;
extern StructRNA RNA_AnimData;
extern StructRNA RNA_AnimViz;
extern StructRNA RNA_AnimVizMotionPaths;
-extern StructRNA RNA_AnimVizOnionSkinning;
extern StructRNA RNA_AnyType;
extern StructRNA RNA_Area;
extern StructRNA RNA_AreaLight;
@@ -97,6 +90,8 @@ extern StructRNA RNA_BoneGroup;
extern StructRNA RNA_BoolProperty;
extern StructRNA RNA_BooleanModifier;
extern StructRNA RNA_Brush;
+extern StructRNA RNA_BrushCapabilitiesImagePaint;
+extern StructRNA RNA_BrushCapabilitiesVertexPaint;
extern StructRNA RNA_BrushTextureSlot;
extern StructRNA RNA_BuildGpencilModifier;
extern StructRNA RNA_BuildModifier;
@@ -274,6 +269,7 @@ extern StructRNA RNA_GPencilFrame;
extern StructRNA RNA_GPencilInterpolateSettings;
extern StructRNA RNA_GPencilLayer;
extern StructRNA RNA_GPencilSculptBrush;
+extern StructRNA RNA_GPencilSculptGuide;
extern StructRNA RNA_GPencilSculptSettings;
extern StructRNA RNA_GPencilStroke;
extern StructRNA RNA_GPencilStrokePoint;
@@ -300,7 +296,6 @@ extern StructRNA RNA_ImagePreview;
extern StructRNA RNA_ImageSequence;
extern StructRNA RNA_ImageTexture;
extern StructRNA RNA_ImageUser;
-extern StructRNA RNA_ImapaintToolCapabilities;
extern StructRNA RNA_InflowFluidSettings;
extern StructRNA RNA_IntProperty;
extern StructRNA RNA_Itasc;
@@ -325,6 +320,7 @@ extern StructRNA RNA_LatticeGpencilModifier;
extern StructRNA RNA_LatticeModifier;
extern StructRNA RNA_LatticePoint;
extern StructRNA RNA_LayerCollection;
+extern StructRNA RNA_LayerObjects;
extern StructRNA RNA_Library;
extern StructRNA RNA_Light;
extern StructRNA RNA_LightProbe;
@@ -495,6 +491,14 @@ extern StructRNA RNA_PointLight;
extern StructRNA RNA_PointerProperty;
extern StructRNA RNA_Pose;
extern StructRNA RNA_PoseBone;
+extern StructRNA RNA_Preferences;
+extern StructRNA RNA_PreferencesEdit;
+extern StructRNA RNA_PreferencesFilePaths;
+extern StructRNA RNA_PreferencesInput;
+extern StructRNA RNA_PreferencesKeymap;
+extern StructRNA RNA_PreferencesSystem;
+extern StructRNA RNA_PreferencesView;
+extern StructRNA RNA_PreferencesWalkNavigation;
extern StructRNA RNA_Property;
extern StructRNA RNA_PropertyGroup;
extern StructRNA RNA_PropertyGroupItem;
@@ -608,11 +612,11 @@ extern StructRNA RNA_SpaceInfo;
extern StructRNA RNA_SpaceNLA;
extern StructRNA RNA_SpaceNodeEditor;
extern StructRNA RNA_SpaceOutliner;
+extern StructRNA RNA_SpacePreferences;
extern StructRNA RNA_SpaceProperties;
extern StructRNA RNA_SpaceSequenceEditor;
extern StructRNA RNA_SpaceTextEditor;
extern StructRNA RNA_SpaceUVEditor;
-extern StructRNA RNA_SpacePreferences;
extern StructRNA RNA_SpaceView3D;
extern StructRNA RNA_Speaker;
extern StructRNA RNA_SpeedControlSequence;
@@ -679,6 +683,7 @@ extern StructRNA RNA_ThemeLogicEditor;
extern StructRNA RNA_ThemeNLAEditor;
extern StructRNA RNA_ThemeNodeEditor;
extern StructRNA RNA_ThemeOutliner;
+extern StructRNA RNA_ThemePreferences;
extern StructRNA RNA_ThemeProperties;
extern StructRNA RNA_ThemeSequenceEditor;
extern StructRNA RNA_ThemeSpaceGeneric;
@@ -687,7 +692,6 @@ extern StructRNA RNA_ThemeSpaceListGeneric;
extern StructRNA RNA_ThemeStyle;
extern StructRNA RNA_ThemeTextEditor;
extern StructRNA RNA_ThemeUserInterface;
-extern StructRNA RNA_ThemePreferences;
extern StructRNA RNA_ThemeView3D;
extern StructRNA RNA_ThemeWidgetColors;
extern StructRNA RNA_ThemeWidgetStateColors;
@@ -710,14 +714,6 @@ extern StructRNA RNA_UVProjector;
extern StructRNA RNA_UVWarpModifier;
extern StructRNA RNA_UnitSettings;
extern StructRNA RNA_UnknownType;
-extern StructRNA RNA_Preferences;
-extern StructRNA RNA_PreferencesEdit;
-extern StructRNA RNA_PreferencesFilePaths;
-extern StructRNA RNA_PreferencesInput;
-extern StructRNA RNA_PreferencesKeymap;
-extern StructRNA RNA_PreferencesSystem;
-extern StructRNA RNA_PreferencesView;
-extern StructRNA RNA_PreferencesWalkNavigation;
extern StructRNA RNA_UserSolidLight;
extern StructRNA RNA_VectorFont;
extern StructRNA RNA_VertexGroup;
@@ -726,6 +722,7 @@ extern StructRNA RNA_VertexPaint;
extern StructRNA RNA_VertexWeightEditModifier;
extern StructRNA RNA_VertexWeightMixModifier;
extern StructRNA RNA_VertexWeightProximityModifier;
+extern StructRNA RNA_View3DCursor;
extern StructRNA RNA_View3DOverlay;
extern StructRNA RNA_View3DShading;
extern StructRNA RNA_ViewLayer;
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index e14dcbea09e..ab9b6f74832 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __RNA_DEFINE_H__
#define __RNA_DEFINE_H__
-/** \file RNA_define.h
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*
* Functions used during preprocess and runtime, for defining the RNA.
*/
@@ -252,6 +246,10 @@ extern const int rna_matrix_dimsize_3x3[];
extern const int rna_matrix_dimsize_4x4[];
extern const int rna_matrix_dimsize_4x2[];
+extern const float rna_default_axis_angle[4];
+extern const float rna_default_quaternion[4];
+extern const float rna_default_scale_3d[3];
+
/* max size for dynamic defined type descriptors,
* this value is arbitrary */
#define RNA_DYN_DESCR_MAX 240
diff --git a/source/blender/makesrna/RNA_documentation.h b/source/blender/makesrna/RNA_documentation.h
index 491b3836f02..7999c45f758 100644
--- a/source/blender/makesrna/RNA_documentation.h
+++ b/source/blender/makesrna/RNA_documentation.h
@@ -1,6 +1,22 @@
-/** \file blender/makesrna/RNA_documentation.h
- * \page makesrna makesrna
- * \ingroup RNA
- * \section aboutmakesrna About RNA
+/*
+ * 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.
+ */
+
+/** \file
+ * \ingroup RNA
+ * \page makesrna makesrna
+ * \section aboutmakesrna About RNA
* The \ref RNA module defines and provides the access API to the data, thus encapsulating \ref DNA
*/
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index efc3263cdb5..1b37c027c89 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,24 +12,20 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __RNA_ENUM_TYPES_H__
#define __RNA_ENUM_TYPES_H__
-/** \file RNA_enum_types.h
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include "RNA_types.h"
+struct bNodeSocketType;
struct bNodeTreeType;
struct bNodeType;
-struct bNodeSocketType;
/* Types */
@@ -147,6 +141,7 @@ extern const EnumPropertyItem rna_enum_light_type_items[];
extern const EnumPropertyItem rna_enum_unpack_method_items[];
extern const EnumPropertyItem rna_enum_object_type_items[];
+extern const EnumPropertyItem rna_enum_object_rotation_mode_items[];
extern const EnumPropertyItem rna_enum_object_type_curve_items[];
@@ -174,8 +169,6 @@ extern const EnumPropertyItem rna_enum_transform_pivot_items_full[];
extern const EnumPropertyItem rna_enum_transform_orientation_items[];
extern const EnumPropertyItem rna_enum_transform_mode_types[];
-extern const EnumPropertyItem rna_enum_posebone_rotmode_items[];
-
extern const EnumPropertyItem rna_enum_property_type_items[];
extern const EnumPropertyItem rna_enum_property_subtype_items[];
extern const EnumPropertyItem rna_enum_property_unit_items[];
@@ -237,9 +230,9 @@ struct bNodeSocketType *rna_node_socket_type_from_enum(int value);
const EnumPropertyItem *rna_node_socket_type_itemf(
void *data, bool (*poll)(void *data, struct bNodeSocketType *), bool *r_free);
-struct bContext;
struct PointerRNA;
struct PropertyRNA;
+struct bContext;
const EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 72e1c05de3c..e713007cc03 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,34 +12,29 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/RNA_types.h
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
-
-#include "../blenlib/BLI_sys_types.h"
-
#ifndef __RNA_TYPES_H__
#define __RNA_TYPES_H__
+#include "../blenlib/BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-struct ParameterList;
+struct BlenderRNA;
struct FunctionRNA;
+struct Main;
+struct ParameterList;
struct PropertyRNA;
+struct ReportList;
struct StructRNA;
-struct BlenderRNA;
struct bContext;
-struct Main;
-struct ReportList;
/** Pointer
*
@@ -98,6 +91,7 @@ typedef enum PropertyUnit {
PROP_UNIT_VELOCITY = (7 << 16), /* m/s */
PROP_UNIT_ACCELERATION = (8 << 16), /* m/(s^2) */
PROP_UNIT_CAMERA = (9 << 16), /* mm */
+ PROP_UNIT_POWER = (10 << 16), /* W */
} PropertyUnit;
#define RNA_SUBTYPE_UNIT(subtype) ((subtype) & 0x00FF0000)
@@ -154,6 +148,9 @@ typedef enum PropertySubType {
/* booleans */
PROP_LAYER = 40,
PROP_LAYER_MEMBER = 41,
+
+ /* light */
+ PROP_POWER = 42 | PROP_UNIT_POWER,
} PropertySubType;
/* Make sure enums are updated with these */
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 7086359c383..9fdaacc8f6c 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
if(CMAKE_COMPILER_IS_GNUCC)
@@ -53,9 +48,9 @@ set(DEFSRC
rna_gpencil_modifier.c
rna_image.c
rna_key.c
- rna_lamp.c
rna_lattice.c
rna_layer.c
+ rna_light.c
rna_lightprobe.c
rna_linestyle.c
rna_lanpr.c
@@ -113,7 +108,6 @@ set(APISRC
rna_material_api.c
rna_mesh_api.c
rna_meta_api.c
- rna_texture_api.c
rna_object_api.c
rna_pose_api.c
rna_scene_api.c
@@ -121,6 +115,7 @@ set(APISRC
rna_sound_api.c
rna_space_api.c
rna_text_api.c
+ rna_texture_api.c
rna_ui_api.c
rna_vfont_api.c
rna_wm_api.c
@@ -165,6 +160,7 @@ set(SRC
rna_define.c
${DEFSRC}
${APISRC}
+ ../../../../intern/clog/clog.c
../../../../intern/guardedalloc/intern/mallocn.c
../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c
../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c
@@ -172,7 +168,7 @@ set(SRC
)
set(INC
-
+ ../../../../intern/clog
)
set(INC_SYS
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index c6543b51843..b19a5109589 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/makesrna.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <float.h>
@@ -46,6 +40,10 @@
# endif
#endif
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"makesrna"};
+
/**
* Variable to control debug output of makesrna.
* debugSRNA:
@@ -111,15 +109,15 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
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); \
+ CLOG_ERROR(&LOG, "remove error (%s): \"%s\"", \
+ strerror(errno), orgfile); \
return -1; \
} \
} \
} \
if (rename(tmpfile, orgfile) != 0) { \
- fprintf(stderr, "%s:%d, Rename Error (%s): \"%s\" -> \"%s\"\n", \
- __FILE__, __LINE__, strerror(errno), tmpfile, orgfile); \
+ CLOG_ERROR(&LOG, "rename error (%s): \"%s\" -> \"%s\"", \
+ strerror(errno), tmpfile, orgfile); \
return -1; \
} \
remove(tmpfile); \
@@ -184,7 +182,7 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
if (fp_new == NULL) {
/* shouldn't happen, just to be safe */
- fprintf(stderr, "%s:%d, open error: \"%s\"\n", __FILE__, __LINE__, tmpfile);
+ CLOG_ERROR(&LOG, "open error: \"%s\"", tmpfile);
fclose(fp_org);
return -1;
}
@@ -203,10 +201,12 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
arr_new = MEM_mallocN(sizeof(char) * len_new, "rna_cmp_file_new");
arr_org = MEM_mallocN(sizeof(char) * len_org, "rna_cmp_file_org");
- if (fread(arr_new, sizeof(char), len_new, fp_new) != len_new)
- fprintf(stderr, "%s:%d, error reading file %s for comparison.\n", __FILE__, __LINE__, tmpfile);
- if (fread(arr_org, sizeof(char), len_org, fp_org) != len_org)
- fprintf(stderr, "%s:%d, error reading file %s for comparison.\n", __FILE__, __LINE__, orgfile);
+ if (fread(arr_new, sizeof(char), len_new, fp_new) != len_new) {
+ CLOG_ERROR(&LOG, "unable to read file %s for comparison.", tmpfile);
+ }
+ if (fread(arr_org, sizeof(char), len_org, fp_org) != len_org) {
+ CLOG_ERROR(&LOG, "unable to read file %s for comparison.", orgfile);
+ }
fclose(fp_new); fp_new = NULL;
fclose(fp_org); fp_org = NULL;
@@ -340,15 +340,15 @@ 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,
+ 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);
+ fprintf(f, " %s *data = (%s *)(ptr->data);\n", dp->dnastructname, dp->dnastructname);
}
static void rna_print_id_get(FILE *f, PropertyDefRNA *UNUSED(dp))
{
- fprintf(f, " ID *id = ptr->id.data;\n");
+ fprintf(f, " ID *id = ptr->id.data;\n");
}
static void rna_construct_function_name(char *buffer, int size, const char *structname, const char *propname, const char *type)
@@ -539,8 +539,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (!manualfunc) {
if (!dp->dnastructname || !dp->dnaname) {
- fprintf(stderr, "%s (0): %s.%s has no valid dna info.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "%s.%s has no valid dna info.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
return NULL;
}
@@ -551,9 +551,9 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (prop->type == PROP_FLOAT) {
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));
+ CLOG_ERROR(&LOG, "%s.%s is a '%s' but wrapped as type '%s'.",
+ srna->identifier, prop->identifier, dp->dnatype,
+ RNA_property_typename(prop->type));
DefRNA.error = 1;
return NULL;
}
@@ -561,9 +561,9 @@ 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));
+ CLOG_ERROR(&LOG, "%s.%s is a '%s' but wrapped as type '%s'.",
+ srna->identifier, prop->identifier, dp->dnatype,
+ RNA_property_typename(prop->type));
DefRNA.error = 1;
return NULL;
}
@@ -581,7 +581,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, "void %s(PointerRNA *ptr, char *value)\n", func);
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " %s(ptr, value);\n", manualfunc);
+ fprintf(f, " %s(ptr, value);\n", manualfunc);
}
else {
const PropertySubType subtype = prop->subtype;
@@ -594,16 +594,16 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
rna_print_data_get(f, dp);
if (!(prop->flag & PROP_NEVER_NULL)) {
- fprintf(f, " if (data->%s == NULL) {\n", dp->dnaname);
- fprintf(f, " *value = '\\0';\n");
- fprintf(f, " return;\n");
- fprintf(f, " }\n");
+ fprintf(f, " if (data->%s == NULL) {\n", dp->dnaname);
+ fprintf(f, " *value = '\\0';\n");
+ fprintf(f, " return;\n");
+ fprintf(f, " }\n");
}
if (sprop->maxlength)
- fprintf(f, " %s(value, data->%s, %d);\n", string_copy_func, dp->dnaname, 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,
+ fprintf(f, " %s(value, data->%s, sizeof(data->%s));\n", string_copy_func,
dp->dnaname, dp->dnaname);
}
fprintf(f, "}\n\n");
@@ -614,16 +614,16 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, "PointerRNA %s(PointerRNA *ptr)\n", func);
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " return %s(ptr);\n", manualfunc);
+ fprintf(f, " return %s(ptr);\n", manualfunc);
}
else {
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",
+ 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",
+ fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n",
(const char *)pprop->type, dp->dnaname);
}
fprintf(f, "}\n\n");
@@ -640,11 +640,11 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
STREQ(manualfunc, "rna_iterator_array_get") ||
STREQ(manualfunc, "rna_iterator_array_dereference_get"))
{
- fprintf(f, " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n",
+ 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, " return %s(iter);\n", manualfunc);
}
}
fprintf(f, "}\n\n");
@@ -660,7 +660,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " %s(ptr, values);\n", manualfunc);
+ fprintf(f, " %s(ptr, values);\n", manualfunc);
}
else {
rna_print_data_get(f, dp);
@@ -668,48 +668,48 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (prop->flag & PROP_DYNAMIC) {
char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier),
"get_length");
- fprintf(f, " unsigned int arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
- fprintf(f, " unsigned int i;\n");
- fprintf(f, " unsigned int len = %s(ptr, arraylen);\n\n", lenfunc);
- fprintf(f, " for (i = 0; i < len; i++) {\n");
+ fprintf(f, " unsigned int arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
+ fprintf(f, " unsigned int i;\n");
+ fprintf(f, " unsigned int len = %s(ptr, arraylen);\n\n", lenfunc);
+ fprintf(f, " for (i = 0; i < len; i++) {\n");
MEM_freeN(lenfunc);
}
else {
- fprintf(f, " unsigned int i;\n\n");
- fprintf(f, " for (i = 0; i < %u; i++) {\n", prop->totarraylength);
+ fprintf(f, " unsigned int i;\n\n");
+ 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 & (%du << i)) != 0);\n",
+ fprintf(f, " values[i] = %s((data->%s & (%du << i)) != 0);\n",
(dp->booleannegative) ? "!" : "", dp->dnaname, dp->booleanbit);
}
else {
- fprintf(f, " values[i] = (%s)%s((&data->%s)[i]);\n",
+ 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) ? "!" : "",
+ 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",
+ 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",
+ 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",
+ fprintf(f, " values[i] = (%s)%s((data->%s)[i]);\n",
rna_type_type(prop), (dp->booleannegative) ? "!" : "", dp->dnaname);
}
}
- fprintf(f, " }\n");
+ fprintf(f, " }\n");
}
fprintf(f, "}\n\n");
}
@@ -718,22 +718,22 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " return %s(ptr);\n", manualfunc);
+ fprintf(f, " return %s(ptr);\n", manualfunc);
}
else {
rna_print_data_get(f, dp);
if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " return %s(((data->%s) & ", (dp->booleannegative) ? "!" : "", dp->dnaname);
+ fprintf(f, " return %s(((data->%s) & ", (dp->booleannegative) ? "!" : "", dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ") != 0);\n");
}
else if (prop->type == PROP_ENUM && dp->enumbitflags) {
- fprintf(f, " return ((data->%s) & ", dp->dnaname);
+ fprintf(f, " return ((data->%s) & ", dp->dnaname);
rna_int_print(f, rna_enum_bitmask(prop));
fprintf(f, ");\n");
}
else
- fprintf(f, " return (%s)%s(data->%s);\n", rna_type_type(prop),
+ fprintf(f, " return (%s)%s(data->%s);\n", rna_type_type(prop),
(dp->booleannegative) ? "!" : "", dp->dnaname);
}
@@ -752,16 +752,16 @@ static void rna_clamp_value_range(FILE *f, PropertyRNA *prop)
FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
if (fprop->range) {
fprintf(f,
- " float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max;\n");
- fprintf(f, " %s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
+ " float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max;\n");
+ fprintf(f, " %s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
rna_function_string(fprop->range));
}
}
else if (prop->type == PROP_INT) {
IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
if (iprop->range) {
- fprintf(f, " int prop_clamp_min = INT_MIN, prop_clamp_max = INT_MAX, prop_soft_min, prop_soft_max;\n");
- fprintf(f, " %s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
+ fprintf(f, " int prop_clamp_min = INT_MIN, prop_clamp_max = INT_MAX, prop_soft_min, prop_soft_max;\n");
+ fprintf(f, " %s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
rna_function_string(iprop->range));
}
}
@@ -775,7 +775,7 @@ static void rna_clamp_value_range_check(
if (prop->type == PROP_INT) {
IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
fprintf(f,
- " { BLI_STATIC_ASSERT("
+ " { BLI_STATIC_ASSERT("
"(TYPEOF_MAX(%s%s) >= %d) && "
"(TYPEOF_MIN(%s%s) <= %d), "
"\"invalid limits\"); }\n",
@@ -839,8 +839,8 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (!manualfunc) {
if (!dp->dnastructname || !dp->dnaname) {
if (prop->flag & PROP_EDITABLE) {
- fprintf(stderr, "%s: %s.%s has no valid dna info.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "%s.%s has no valid dna info.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
return NULL;
@@ -856,7 +856,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, "void %s(PointerRNA *ptr, const char *value)\n", func);
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " %s(ptr, value);\n", manualfunc);
+ fprintf(f, " %s(ptr, value);\n", manualfunc);
}
else {
const PropertySubType subtype = prop->subtype;
@@ -869,15 +869,15 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
rna_print_data_get(f, dp);
if (!(prop->flag & PROP_NEVER_NULL)) {
- fprintf(f, " if (data->%s == NULL) {\n", dp->dnaname);
- fprintf(f, " return;\n");
- fprintf(f, " }\n");
+ fprintf(f, " if (data->%s == NULL) {\n", dp->dnaname);
+ fprintf(f, " return;\n");
+ fprintf(f, " }\n");
}
if (sprop->maxlength)
- fprintf(f, " %s(data->%s, value, %d);\n", string_copy_func, dp->dnaname, 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,
+ fprintf(f, " %s(data->%s, value, sizeof(data->%s));\n", string_copy_func,
dp->dnaname, dp->dnaname);
}
fprintf(f, "}\n\n");
@@ -888,32 +888,32 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, "void %s(PointerRNA *ptr, PointerRNA value)\n", func);
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " %s(ptr, value);\n", manualfunc);
+ fprintf(f, " %s(ptr, value);\n", manualfunc);
}
else {
rna_print_data_get(f, dp);
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, " id_us_min((ID *)data->%s);\n", dp->dnaname);
- fprintf(f, " if (value.data)\n");
- fprintf(f, " id_us_plus((ID *)value.data);\n\n");
+ 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, " id_us_plus((ID *)value.data);\n\n");
}
else {
PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : NULL;
if (type && (type->flag & STRUCT_ID)) {
- fprintf(f, " if (value.data)\n");
- fprintf(f, " id_lib_extern((ID *)value.data);\n\n");
+ fprintf(f, " if (value.data)\n");
+ fprintf(f, " id_lib_extern((ID *)value.data);\n\n");
}
}
- fprintf(f, " data->%s = value.data;\n", dp->dnaname);
+ fprintf(f, " data->%s = value.data;\n", dp->dnaname);
}
fprintf(f, "}\n\n");
@@ -929,7 +929,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " %s(ptr, values);\n", manualfunc);
+ fprintf(f, " %s(ptr, values);\n", manualfunc);
}
else {
rna_print_data_get(f, dp);
@@ -937,52 +937,52 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (prop->flag & PROP_DYNAMIC) {
char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier),
"set_length");
- fprintf(f, " unsigned int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
- fprintf(f, " unsigned int len = %s(ptr, arraylen);\n\n", lenfunc);
+ fprintf(f, " unsigned int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
+ fprintf(f, " unsigned 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, " unsigned int i;\n\n");
+ fprintf(f, " unsigned 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 |= (%du << i);\n",
+ fprintf(f, " if (%svalues[i]) data->%s |= (%du << i);\n",
(dp->booleannegative) ? "!" : "", dp->dnaname, dp->booleanbit);
- fprintf(f, " else data->%s &= ~(%du << i);\n", dp->dnaname, dp->booleanbit);
+ fprintf(f, " else data->%s &= ~(%du << 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) ? "!" : "",
+ 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);
+ fprintf(f, " else data->%s[i] &= ~", dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ";\n");
}
else if (rna_color_quantize(prop, dp)) {
- fprintf(f, " data->%s[i] = unit_float_to_uchar_clamp(values[i]);\n", dp->dnaname);
+ fprintf(f, " data->%s[i] = unit_float_to_uchar_clamp(values[i]);\n", dp->dnaname);
}
else {
if (dp->dnatype)
- fprintf(f, " ((%s *)data->%s)[i] = %s", dp->dnatype, dp->dnaname,
+ 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);
}
}
- fprintf(f, " }\n");
+ fprintf(f, " }\n");
}
#ifdef USE_RNA_RANGE_CHECK
@@ -1003,27 +1003,27 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " %s(ptr, value);\n", manualfunc);
+ fprintf(f, " %s(ptr, value);\n", manualfunc);
}
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);
+ fprintf(f, " else data->%s &= ~", dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ";\n");
}
else if (prop->type == PROP_ENUM && dp->enumbitflags) {
- fprintf(f, " data->%s &= ~", dp->dnaname);
+ fprintf(f, " data->%s &= ~", dp->dnaname);
rna_int_print(f, rna_enum_bitmask(prop));
fprintf(f, ";\n");
- fprintf(f, " data->%s |= value;\n", dp->dnaname);
+ fprintf(f, " data->%s |= value;\n", dp->dnaname);
}
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);
}
}
@@ -1053,8 +1053,8 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA
if (prop->type == PROP_STRING) {
if (!manualfunc) {
if (!dp->dnastructname || !dp->dnaname) {
- fprintf(stderr, "%s: %s.%s has no valid dna info.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "%s.%s has no valid dna info.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
return NULL;
}
@@ -1065,22 +1065,22 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA
fprintf(f, "int %s(PointerRNA *ptr)\n", func);
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " return %s(ptr);\n", manualfunc);
+ fprintf(f, " return %s(ptr);\n", manualfunc);
}
else {
rna_print_data_get(f, dp);
if (!(prop->flag & PROP_NEVER_NULL)) {
- fprintf(f, " if (data->%s == NULL) return 0;\n", dp->dnaname);
+ fprintf(f, " if (data->%s == NULL) return 0;\n", dp->dnaname);
}
- fprintf(f, " return strlen(data->%s);\n", dp->dnaname);
+ fprintf(f, " return strlen(data->%s);\n", dp->dnaname);
}
fprintf(f, "}\n\n");
}
else if (prop->type == PROP_COLLECTION) {
if (!manualfunc) {
if (prop->type == PROP_COLLECTION && (!(dp->dnalengthname || dp->dnalengthfixed) || !dp->dnaname)) {
- fprintf(stderr, "%s: %s.%s has no valid dna info.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "%s.%s has no valid dna info.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
return NULL;
}
@@ -1091,16 +1091,16 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA
fprintf(f, "int %s(PointerRNA *ptr)\n", func);
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " return %s(ptr);\n", manualfunc);
+ fprintf(f, " return %s(ptr);\n", manualfunc);
}
else {
if (dp->dnaarraylength <= 1 || dp->dnalengthname)
rna_print_data_get(f, dp);
if (dp->dnaarraylength > 1)
- fprintf(f, " return ");
+ fprintf(f, " return ");
else
- fprintf(f, " return (data->%s == NULL) ? 0 : ", dp->dnaname);
+ fprintf(f, " return (data->%s == NULL) ? 0 : ", dp->dnaname);
if (dp->dnalengthname)
fprintf(f, "data->%s;\n", dp->dnalengthname);
@@ -1123,8 +1123,8 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
if (!manualfunc) {
if (!dp->dnastructname || !dp->dnaname) {
- fprintf(stderr, "%s: %s.%s has no valid dna info.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "%s.%s has no valid dna info.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
return NULL;
}
@@ -1138,36 +1138,36 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
if (!manualfunc)
rna_print_data_get(f, dp);
- fprintf(f, "\n memset(iter, 0, sizeof(*iter));\n");
- fprintf(f, " iter->parent = *ptr;\n");
- fprintf(f, " iter->prop = (PropertyRNA *)&rna_%s_%s;\n", srna->identifier, prop->identifier);
+ fprintf(f, "\n memset(iter, 0, sizeof(*iter));\n");
+ fprintf(f, " iter->parent = *ptr;\n");
+ fprintf(f, " iter->prop = (PropertyRNA *)&rna_%s_%s;\n", srna->identifier, prop->identifier);
if (dp->dnalengthname || dp->dnalengthfixed) {
if (manualfunc) {
- fprintf(f, "\n %s(iter, ptr);\n", manualfunc);
+ fprintf(f, "\n %s(iter, ptr);\n", manualfunc);
}
else {
if (dp->dnalengthname)
- fprintf(f, "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, 0, NULL);\n",
+ 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",
+ 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 {
if (manualfunc)
- fprintf(f, "\n %s(iter, ptr);\n", manualfunc);
+ fprintf(f, "\n %s(iter, ptr);\n", manualfunc);
else if (dp->dnapointerlevel == 0)
- fprintf(f, "\n rna_iterator_listbase_begin(iter, &data->%s, NULL);\n", dp->dnaname);
+ fprintf(f, "\n rna_iterator_listbase_begin(iter, &data->%s, NULL);\n", dp->dnaname);
else
- fprintf(f, "\n rna_iterator_listbase_begin(iter, data->%s, NULL);\n", dp->dnaname);
+ fprintf(f, "\n rna_iterator_listbase_begin(iter, data->%s, NULL);\n", dp->dnaname);
}
getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
- fprintf(f, "\n if (iter->valid)\n");
- fprintf(f, " iter->ptr = %s(iter);\n", getfunc);
+ fprintf(f, "\n if (iter->valid)\n");
+ fprintf(f, " iter->ptr = %s(iter);\n", getfunc);
fprintf(f, "}\n\n");
@@ -1201,57 +1201,57 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, "\n return %s(ptr, index, r_ptr);\n", manualfunc);
+ fprintf(f, "\n return %s(ptr, index, r_ptr);\n", manualfunc);
fprintf(f, "}\n\n");
return func;
}
- fprintf(f, " int found = 0;\n");
- fprintf(f, " CollectionPropertyIterator iter;\n\n");
+ fprintf(f, " int found = 0;\n");
+ 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, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, " if (iter.valid) {\n");
if (STREQ(nextfunc, "rna_iterator_array_next")) {
- fprintf(f, " ArrayIterator *internal = &iter.internal.array;\n");
- fprintf(f, " if (index < 0 || index >= internal->length) {\n");
+ fprintf(f, " ArrayIterator *internal = &iter.internal.array;\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, " 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, " 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, " rna_iterator_array_next(&iter);\n");
- fprintf(f, " }\n");
- fprintf(f, " found = (index == -1 && iter.valid);\n");
- fprintf(f, " }\n");
- fprintf(f, " else {\n");
- fprintf(f, " internal->ptr += internal->itemsize * index;\n");
- fprintf(f, " found = 1;\n");
- fprintf(f, " }\n");
+ fprintf(f, " }\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");
+ fprintf(f, " }\n");
+ fprintf(f, " else {\n");
+ fprintf(f, " internal->ptr += internal->itemsize * index;\n");
+ fprintf(f, " found = 1;\n");
+ fprintf(f, " }\n");
}
else if (STREQ(nextfunc, "rna_iterator_listbase_next")) {
- fprintf(f, " ListBaseIterator *internal = &iter.internal.listbase;\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, " internal->link = internal->link->next;\n");
- fprintf(f, " found = (index == -1 && internal->link);\n");
- fprintf(f, " }\n");
+ fprintf(f, " ListBaseIterator *internal = &iter.internal.listbase;\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, " 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, " }\n\n");
- fprintf(f, " %s_%s_end(&iter);\n\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));
- fprintf(f, " return found;\n");
+ fprintf(f, " return found;\n");
#if 0
rna_print_data_get(f, dp);
@@ -1259,18 +1259,18 @@ 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",
+ 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",
+ 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",
+ 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);
+ fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, data->%s, index);\n", item_type, dp->dnaname);
}
#endif
@@ -1312,7 +1312,7 @@ static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, Prope
fprintf(f, "{\n");
if (manualfunc) {
- fprintf(f, " return %s(ptr, key, r_ptr);\n", manualfunc);
+ fprintf(f, " return %s(ptr, key, r_ptr);\n", manualfunc);
fprintf(f, "}\n\n");
return func;
}
@@ -1320,46 +1320,46 @@ static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, Prope
/* XXX extern declaration could be avoid by including RNA_blender.h, but this has lots of unknown
* DNA types in functions, leading to conflicting function signatures.
*/
- fprintf(f, " extern int %s_%s_length(PointerRNA *);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
- fprintf(f, " extern void %s_%s_get(PointerRNA *, char *);\n\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
-
- fprintf(f, " bool found = false;\n");
- fprintf(f, " CollectionPropertyIterator iter;\n");
- fprintf(f, " char namebuf[%d];\n", namebuflen);
- fprintf(f, " char *name;\n\n");
-
- fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
-
- fprintf(f, " while (iter.valid) {\n");
- fprintf(f, " if (iter.ptr.data) {\n");
- fprintf(f, " int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
- fprintf(f, " if (namelen < %d) {\n", namebuflen);
- fprintf(f, " %s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
- fprintf(f, " if (strcmp(namebuf, key) == 0) {\n");
- fprintf(f, " found = true;\n");
- fprintf(f, " *r_ptr = iter.ptr;\n");
- fprintf(f, " break;\n");
- fprintf(f, " }\n");
- fprintf(f, " }\n");
- fprintf(f, " else {\n");
- fprintf(f, " name = MEM_mallocN(namelen+1, \"name string\");\n");
- fprintf(f, " %s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
- fprintf(f, " if (strcmp(name, key) == 0) {\n");
- fprintf(f, " MEM_freeN(name);\n\n");
- fprintf(f, " found = true;\n");
- fprintf(f, " *r_ptr = iter.ptr;\n");
- fprintf(f, " break;\n");
- fprintf(f, " }\n");
- fprintf(f, " else {\n");
- fprintf(f, " MEM_freeN(name);\n");
- fprintf(f, " }\n");
- fprintf(f, " }\n");
- fprintf(f, " }\n");
- fprintf(f, " %s_%s_next(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
- fprintf(f, " }\n");
- fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
-
- fprintf(f, " return found;\n");
+ fprintf(f, " extern int %s_%s_length(PointerRNA *);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " extern void %s_%s_get(PointerRNA *, char *);\n\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+
+ fprintf(f, " bool found = false;\n");
+ fprintf(f, " CollectionPropertyIterator iter;\n");
+ fprintf(f, " char namebuf[%d];\n", namebuflen);
+ fprintf(f, " char *name;\n\n");
+
+ fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+
+ fprintf(f, " while (iter.valid) {\n");
+ fprintf(f, " if (iter.ptr.data) {\n");
+ fprintf(f, " int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " if (namelen < %d) {\n", namebuflen);
+ fprintf(f, " %s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " if (strcmp(namebuf, key) == 0) {\n");
+ fprintf(f, " found = true;\n");
+ fprintf(f, " *r_ptr = iter.ptr;\n");
+ fprintf(f, " break;\n");
+ fprintf(f, " }\n");
+ fprintf(f, " }\n");
+ fprintf(f, " else {\n");
+ fprintf(f, " name = MEM_mallocN(namelen+1, \"name string\");\n");
+ fprintf(f, " %s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " if (strcmp(name, key) == 0) {\n");
+ fprintf(f, " MEM_freeN(name);\n\n");
+ fprintf(f, " found = true;\n");
+ fprintf(f, " *r_ptr = iter.ptr;\n");
+ fprintf(f, " break;\n");
+ fprintf(f, " }\n");
+ fprintf(f, " else {\n");
+ fprintf(f, " MEM_freeN(name);\n");
+ fprintf(f, " }\n");
+ fprintf(f, " }\n");
+ fprintf(f, " }\n");
+ fprintf(f, " %s_%s_next(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, " }\n");
+ fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+
+ fprintf(f, " return found;\n");
fprintf(f, "}\n\n");
return func;
@@ -1380,12 +1380,12 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p
fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
fprintf(f, "{\n");
- fprintf(f, " %s(iter);\n", manualfunc);
+ fprintf(f, " %s(iter);\n", manualfunc);
getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
- fprintf(f, "\n if (iter->valid)\n");
- fprintf(f, " iter->ptr = %s(iter);\n", getfunc);
+ fprintf(f, "\n if (iter->valid)\n");
+ fprintf(f, " iter->ptr = %s(iter);\n", getfunc);
fprintf(f, "}\n\n");
@@ -1405,7 +1405,7 @@ static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
fprintf(f, "{\n");
if (manualfunc)
- fprintf(f, " %s(iter);\n", manualfunc);
+ fprintf(f, " %s(iter);\n", manualfunc);
fprintf(f, "}\n\n");
return func;
@@ -1535,8 +1535,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
pprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)pprop->get);
pprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)pprop->set);
if (!pprop->type) {
- fprintf(stderr, "%s: %s.%s, pointer must have a struct type.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "%s.%s, pointer must have a struct type.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
break;
@@ -1578,24 +1578,24 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
if (!(prop->flag & PROP_IDPROPERTY)) {
if (!cprop->begin) {
- fprintf(stderr, "%s: %s.%s, collection must have a begin function.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "%s.%s, collection must have a begin function.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
if (!cprop->next) {
- fprintf(stderr, "%s: %s.%s, collection must have a next function.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "%s.%s, collection must have a next function.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
if (!cprop->get) {
- fprintf(stderr, "%s: %s.%s, collection must have a get function.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "%s.%s, collection must have a get function.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
}
if (!cprop->item_type) {
- fprintf(stderr, "%s: %s.%s, collection must have a struct type.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "%s.%s, collection must have a struct type.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
break;
@@ -2586,6 +2586,7 @@ static const char *rna_property_subtypename(PropertySubType type)
case PROP_LAYER: return "PROP_LAYER";
case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER";
case PROP_PASSWORD: return "PROP_PASSWORD";
+ case PROP_POWER: return "PROP_POWER";
default:
{
/* in case we don't have a type preset that includes the subtype */
@@ -2612,6 +2613,7 @@ static const char *rna_property_subtype_unit(PropertySubType type)
case PROP_UNIT_VELOCITY: return "PROP_UNIT_VELOCITY";
case PROP_UNIT_ACCELERATION: return "PROP_UNIT_ACCELERATION";
case PROP_UNIT_CAMERA: return "PROP_UNIT_CAMERA";
+ case PROP_UNIT_POWER: return "PROP_UNIT_POWER";
default: return "PROP_UNIT_UNKNOWN";
}
}
@@ -2948,23 +2950,23 @@ 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,
+ CLOG_ERROR(&LOG, "%s%s.%s, enum default includes unused bits (%d).",
+ srna->identifier, errnest, prop->identifier,
eprop->defaultvalue & ~totflag);
DefRNA.error = 1;
}
}
else {
if (!defaultfound) {
- fprintf(stderr, "%s: %s%s.%s, enum default is not in items.\n",
- __func__, srna->identifier, errnest, prop->identifier);
+ CLOG_ERROR(&LOG, "%s%s.%s, enum default is not in items.",
+ srna->identifier, errnest, prop->identifier);
DefRNA.error = 1;
}
}
}
else {
- fprintf(stderr, "%s: %s%s.%s, enum must have items defined.\n",
- __func__, srna->identifier, errnest, prop->identifier);
+ CLOG_ERROR(&LOG, "%s%s.%s, enum must have items defined.",
+ srna->identifier, errnest, prop->identifier);
DefRNA.error = 1;
}
break;
@@ -3358,8 +3360,8 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE
fprintf(f, "\t%s,\n", rna_function_string(srna->idproperties));
if (srna->reg && !srna->refine) {
- fprintf(stderr, "%s: %s has a register function, must also have refine function.\n",
- __func__, srna->identifier);
+ CLOG_ERROR(&LOG, "%s has a register function, must also have refine function.",
+ srna->identifier);
DefRNA.error = 1;
}
@@ -3406,7 +3408,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_gpencil.c", NULL, RNA_def_gpencil},
{"rna_image.c", "rna_image_api.c", RNA_def_image},
{"rna_key.c", NULL, RNA_def_key},
- {"rna_lamp.c", NULL, RNA_def_light},
+ {"rna_light.c", NULL, RNA_def_light},
{"rna_lattice.c", "rna_lattice_api.c", RNA_def_lattice},
{"rna_layer.c", NULL, RNA_def_view_layer},
{"rna_linestyle.c", NULL, RNA_def_linestyle},
@@ -3451,7 +3453,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_movieclip.c", NULL, RNA_def_movieclip},
{"rna_tracking.c", NULL, RNA_def_tracking},
{"rna_mask.c", NULL, RNA_def_mask},
- {NULL, NULL}
+ {NULL, NULL},
};
static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const char *api_filename)
@@ -3564,16 +3566,16 @@ static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f)
fprintf(f, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
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; "
+ 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, " itemptr = rna_macro_iter.ptr;\n\n");
+ fprintf(f, " itemptr = rna_macro_iter.ptr;\n\n");
fprintf(f, "#define FOREACH_END(property) \\\n");
- fprintf(f, " } \\\n");
- fprintf(f, " property##_end(&rna_macro_iter); \\\n");
- fprintf(f, " }\n\n");
+ fprintf(f, " } \\\n");
+ fprintf(f, " property##_end(&rna_macro_iter); \\\n");
+ fprintf(f, " }\n\n");
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
srna = ds->srna;
@@ -3600,226 +3602,227 @@ static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f)
static const char *cpp_classes = ""
"\n"
+"#include <stdlib.h> /* for malloc */\n"
"#include <string>\n"
"#include <string.h> /* for memcpy */\n"
"\n"
"namespace BL {\n"
"\n"
"#define BOOLEAN_PROPERTY(sname, identifier) \\\n"
-" inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr) ? true: false; } \\\n"
-" inline void sname::identifier(bool value) { sname##_##identifier##_set(&ptr, value); }\n"
+" inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr) ? true: false; } \\\n"
+" inline void sname::identifier(bool value) { sname##_##identifier##_set(&ptr, value); }\n"
"\n"
"#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n"
-" inline Array<bool, size> sname::identifier(void) \\\n"
-" { Array<bool, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
-" inline void sname::identifier(bool values[size]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
+" inline Array<bool, size> sname::identifier(void) \\\n"
+" { Array<bool, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
+" inline void sname::identifier(bool values[size]) \\\n"
+" { sname##_##identifier##_set(&ptr, values); } \\\n"
"\n"
"#define BOOLEAN_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
-" inline DynamicArray<bool> sname::identifier(void) { \\\n"
-" int arraylen[3]; \\\n"
-" int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
-" DynamicArray<bool> ar(len); \\\n"
-" sname##_##identifier##_get(&ptr, ar.data); \\\n"
-" return ar; } \\\n"
-" inline void sname::identifier(bool values[]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
+" inline DynamicArray<bool> sname::identifier(void) { \\\n"
+" int arraylen[3]; \\\n"
+" int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
+" DynamicArray<bool> ar(len); \\\n"
+" sname##_##identifier##_get(&ptr, ar.data); \\\n"
+" return ar; } \\\n"
+" inline void sname::identifier(bool values[]) \\\n"
+" { sname##_##identifier##_set(&ptr, values); } \\\n"
"\n"
"#define INT_PROPERTY(sname, identifier) \\\n"
-" inline int sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
-" inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n"
+" inline int sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
+" inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n"
"\n"
"#define INT_ARRAY_PROPERTY(sname, size, identifier) \\\n"
-" inline Array<int, size> sname::identifier(void) \\\n"
-" { Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
-" inline void sname::identifier(int values[size]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
+" inline Array<int, size> sname::identifier(void) \\\n"
+" { Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
+" inline void sname::identifier(int values[size]) \\\n"
+" { sname##_##identifier##_set(&ptr, values); } \\\n"
"\n"
"#define INT_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
-" inline DynamicArray<int> sname::identifier(void) { \\\n"
-" int arraylen[3]; \\\n"
-" int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
-" DynamicArray<int> ar(len); \\\n"
-" sname##_##identifier##_get(&ptr, ar.data); \\\n"
-" return ar; } \\\n"
-" inline void sname::identifier(int values[]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
+" inline DynamicArray<int> sname::identifier(void) { \\\n"
+" int arraylen[3]; \\\n"
+" int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
+" DynamicArray<int> ar(len); \\\n"
+" sname##_##identifier##_get(&ptr, ar.data); \\\n"
+" return ar; } \\\n"
+" inline void sname::identifier(int values[]) \\\n"
+" { sname##_##identifier##_set(&ptr, values); } \\\n"
"\n"
"#define FLOAT_PROPERTY(sname, identifier) \\\n"
-" inline float sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
-" inline void sname::identifier(float value) { sname##_##identifier##_set(&ptr, value); }\n"
+" inline float sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
+" inline void sname::identifier(float value) { sname##_##identifier##_set(&ptr, value); }\n"
"\n"
"#define FLOAT_ARRAY_PROPERTY(sname, size, identifier) \\\n"
-" inline Array<float, size> sname::identifier(void) \\\n"
-" { Array<float, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
-" inline void sname::identifier(float values[size]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
+" inline Array<float, size> sname::identifier(void) \\\n"
+" { Array<float, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
+" inline void sname::identifier(float values[size]) \\\n"
+" { sname##_##identifier##_set(&ptr, values); } \\\n"
"\n"
"#define FLOAT_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
-" inline DynamicArray<float> sname::identifier(void) { \\\n"
-" int arraylen[3]; \\\n"
-" int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
-" DynamicArray<float> ar(len); \\\n"
-" sname##_##identifier##_get(&ptr, ar.data); \\\n"
-" return ar; } \\\n"
-" inline void sname::identifier(float values[]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
+" inline DynamicArray<float> sname::identifier(void) { \\\n"
+" int arraylen[3]; \\\n"
+" int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
+" DynamicArray<float> ar(len); \\\n"
+" sname##_##identifier##_get(&ptr, ar.data); \\\n"
+" return ar; } \\\n"
+" inline void sname::identifier(float values[]) \\\n"
+" { sname##_##identifier##_set(&ptr, values); } \\\n"
"\n"
"#define ENUM_PROPERTY(type, sname, identifier) \\\n"
-" inline sname::type sname::identifier(void) { return (type)sname##_##identifier##_get(&ptr); } \\\n"
-" inline void sname::identifier(sname::type value) { sname##_##identifier##_set(&ptr, value); }\n"
+" inline sname::type sname::identifier(void) { return (type)sname##_##identifier##_get(&ptr); } \\\n"
+" inline void sname::identifier(sname::type value) { sname##_##identifier##_set(&ptr, value); }\n"
"\n"
"#define STRING_PROPERTY(sname, identifier) \\\n"
-" inline std::string sname::identifier(void) { \\\n"
-" int len = sname##_##identifier##_length(&ptr); \\\n"
-" std::string str; str.resize(len); \\\n"
-" sname##_##identifier##_get(&ptr, &str[0]); return str; } \\\n"
-" inline void sname::identifier(const std::string& value) { \\\n"
-" sname##_##identifier##_set(&ptr, value.c_str()); } \\\n"
+" inline std::string sname::identifier(void) { \\\n"
+" int len = sname##_##identifier##_length(&ptr); \\\n"
+" std::string str; str.resize(len); \\\n"
+" sname##_##identifier##_get(&ptr, &str[0]); return str; } \\\n"
+" inline void sname::identifier(const std::string& value) { \\\n"
+" sname##_##identifier##_set(&ptr, value.c_str()); } \\\n"
"\n"
"#define POINTER_PROPERTY(type, sname, identifier) \\\n"
-" inline type sname::identifier(void) { return type(sname##_##identifier##_get(&ptr)); }\n"
+" inline type sname::identifier(void) { return type(sname##_##identifier##_get(&ptr)); }\n"
"\n"
"#define COLLECTION_PROPERTY_LENGTH_false(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
-" { \\\n"
-" CollectionPropertyIterator iter; \\\n"
-" int length = 0; \\\n"
-" sname##_##identifier##_begin(&iter, ptr); \\\n"
-" while (iter.valid) { \\\n"
-" sname##_##identifier##_next(&iter); \\\n"
-" ++length; \\\n"
-" } \\\n"
-" sname##_##identifier##_end(&iter); \\\n"
-" return length; \\\n"
-" } \n"
+" inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
+" { \\\n"
+" CollectionPropertyIterator iter; \\\n"
+" int length = 0; \\\n"
+" sname##_##identifier##_begin(&iter, ptr); \\\n"
+" while (iter.valid) { \\\n"
+" sname##_##identifier##_next(&iter); \\\n"
+" ++length; \\\n"
+" } \\\n"
+" sname##_##identifier##_end(&iter); \\\n"
+" return length; \\\n"
+" } \n"
"#define COLLECTION_PROPERTY_LENGTH_true(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
-" { return sname##_##identifier##_length(ptr); } \n"
+" inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
+" { return sname##_##identifier##_length(ptr); } \n"
"\n"
"#define COLLECTION_PROPERTY_LOOKUP_INT_false(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n"
-" { \\\n"
-" CollectionPropertyIterator iter; \\\n"
-" int i = 0, found = 0; \\\n"
-" sname##_##identifier##_begin(&iter, ptr); \\\n"
-" while (iter.valid) { \\\n"
-" if (i == key) { \\\n"
-" *r_ptr = iter.ptr; \\\n"
-" found = 1; \\\n"
-" break; \\\n"
-" } \\\n"
-" sname##_##identifier##_next(&iter); \\\n"
-" ++i; \\\n"
-" } \\\n"
-" sname##_##identifier##_end(&iter); \\\n"
-" if (!found) \\\n"
-" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
-" return found; \\\n"
-" } \n"
+" inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n"
+" { \\\n"
+" CollectionPropertyIterator iter; \\\n"
+" int i = 0, found = 0; \\\n"
+" sname##_##identifier##_begin(&iter, ptr); \\\n"
+" while (iter.valid) { \\\n"
+" if (i == key) { \\\n"
+" *r_ptr = iter.ptr; \\\n"
+" found = 1; \\\n"
+" break; \\\n"
+" } \\\n"
+" sname##_##identifier##_next(&iter); \\\n"
+" ++i; \\\n"
+" } \\\n"
+" sname##_##identifier##_end(&iter); \\\n"
+" if (!found) \\\n"
+" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+" return found; \\\n"
+" } \n"
"#define COLLECTION_PROPERTY_LOOKUP_INT_true(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n"
-" { \\\n"
-" int found = sname##_##identifier##_lookup_int(ptr, key, r_ptr); \\\n"
-" if (!found) \\\n"
-" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
-" return found; \\\n"
-" } \n"
+" inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n"
+" { \\\n"
+" int found = sname##_##identifier##_lookup_int(ptr, key, r_ptr); \\\n"
+" if (!found) \\\n"
+" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+" return found; \\\n"
+" } \n"
"#define COLLECTION_PROPERTY_LOOKUP_STRING_false(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) \\\n"
-" { \\\n"
-" CollectionPropertyIterator iter; \\\n"
-" int found = 0; \\\n"
-" PropertyRNA *item_name_prop = RNA_struct_name_property(ptr->type); \\\n"
-" sname##_##identifier##_begin(&iter, ptr); \\\n"
-" while (iter.valid && !found) { \\\n"
-" char name_fixed[32]; \\\n"
-" const char *name; \\\n"
-" int name_length; \\\n"
-" name = RNA_property_string_get_alloc(&iter.ptr, item_name_prop, name_fixed, sizeof(name_fixed), &name_length); \\\n"
-" if (!strncmp(name, key, name_length)) { \\\n"
-" *r_ptr = iter.ptr; \\\n"
-" found = 1; \\\n"
-" } \\\n"
-" if (name_fixed != name) \\\n"
-" MEM_freeN((void *) name); \\\n"
-" sname##_##identifier##_next(&iter); \\\n"
-" } \\\n"
-" sname##_##identifier##_end(&iter); \\\n"
-" if (!found) \\\n"
-" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
-" return found; \\\n"
-" } \n"
+" inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) \\\n"
+" { \\\n"
+" CollectionPropertyIterator iter; \\\n"
+" int found = 0; \\\n"
+" PropertyRNA *item_name_prop = RNA_struct_name_property(ptr->type); \\\n"
+" sname##_##identifier##_begin(&iter, ptr); \\\n"
+" while (iter.valid && !found) { \\\n"
+" char name_fixed[32]; \\\n"
+" const char *name; \\\n"
+" int name_length; \\\n"
+" name = RNA_property_string_get_alloc(&iter.ptr, item_name_prop, name_fixed, sizeof(name_fixed), &name_length); \\\n"
+" if (!strncmp(name, key, name_length)) { \\\n"
+" *r_ptr = iter.ptr; \\\n"
+" found = 1; \\\n"
+" } \\\n"
+" if (name_fixed != name) \\\n"
+" MEM_freeN((void *) name); \\\n"
+" sname##_##identifier##_next(&iter); \\\n"
+" } \\\n"
+" sname##_##identifier##_end(&iter); \\\n"
+" if (!found) \\\n"
+" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+" return found; \\\n"
+" } \n"
"#define COLLECTION_PROPERTY_LOOKUP_STRING_true(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) \\\n"
-" { \\\n"
-" int found = sname##_##identifier##_lookup_string(ptr, key, r_ptr); \\\n"
-" if (!found) \\\n"
-" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
-" return found; \\\n"
-" } \n"
+" inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) \\\n"
+" { \\\n"
+" int found = sname##_##identifier##_lookup_string(ptr, key, r_ptr); \\\n"
+" if (!found) \\\n"
+" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+" return found; \\\n"
+" } \n"
"#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, has_lookup_int, has_lookup_string) \\\n"
-" typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n"
-" sname##_##identifier##_next, sname##_##identifier##_end> identifier##_iterator; \\\n"
-" COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n"
-" COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n"
-" COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(sname, identifier) \\\n"
-" CollectionRef<sname, type, sname##_##identifier##_begin, \\\n"
-" sname##_##identifier##_next, sname##_##identifier##_end, \\\n"
-" sname##_##identifier##_length_wrap, \\\n"
-" sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, collection_funcs> identifier;\n"
+" typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n"
+" sname##_##identifier##_next, sname##_##identifier##_end> identifier##_iterator; \\\n"
+" COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n"
+" COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n"
+" COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(sname, identifier) \\\n"
+" CollectionRef<sname, type, sname##_##identifier##_begin, \\\n"
+" sname##_##identifier##_next, sname##_##identifier##_end, \\\n"
+" sname##_##identifier##_length_wrap, \\\n"
+" sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, collection_funcs> identifier;\n"
"\n"
"class Pointer {\n"
"public:\n"
-" Pointer(const PointerRNA &p) : ptr(p) { }\n"
-" operator const PointerRNA&() { return ptr; }\n"
-" bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type) ? true: false; }\n"
-" operator void*() { return ptr.data; }\n"
-" operator bool() { return ptr.data != NULL; }\n"
+" Pointer(const PointerRNA &p) : ptr(p) { }\n"
+" operator const PointerRNA&() { return ptr; }\n"
+" bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type) ? true: false; }\n"
+" operator void*() { return ptr.data; }\n"
+" operator bool() { return ptr.data != NULL; }\n"
"\n"
-" bool operator==(const Pointer &other) { return ptr.data == other.ptr.data; }\n"
-" bool operator!=(const Pointer &other) { return ptr.data != other.ptr.data; }\n"
+" bool operator==(const Pointer &other) { return ptr.data == other.ptr.data; }\n"
+" bool operator!=(const Pointer &other) { return ptr.data != other.ptr.data; }\n"
"\n"
-" PointerRNA ptr;\n"
+" PointerRNA ptr;\n"
"};\n"
"\n"
"\n"
"template<typename T, int Tsize>\n"
"class Array {\n"
"public:\n"
-" T data[Tsize];\n"
+" T data[Tsize];\n"
"\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); "
+" 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"
"\n"
-" operator T*() { return data; }\n"
-" operator const T*() const { return data; }\n"
+" operator T*() { return data; }\n"
+" operator const T*() const { return data; }\n"
"};\n"
"\n"
"template<typename T>\n"
"class DynamicArray {\n"
"public:\n"
-" T *data;\n"
-" int length;\n"
+" T *data;\n"
+" int length;\n"
"\n"
-" DynamicArray() : data(NULL), length(0) {}\n"
-" DynamicArray(int new_length) : data(NULL), length(new_length) { data = (T *)malloc(sizeof(T) * new_length); }\n"
-" DynamicArray(const DynamicArray<T>& other) { copy_from(other); }\n"
-" const DynamicArray<T>& operator = (const DynamicArray<T>& other) { copy_from(other); return *this; }\n"
+" DynamicArray() : data(NULL), length(0) {}\n"
+" DynamicArray(int new_length) : data(NULL), length(new_length) { data = (T *)malloc(sizeof(T) * new_length); }\n"
+" DynamicArray(const DynamicArray<T>& other) { copy_from(other); }\n"
+" const DynamicArray<T>& operator = (const DynamicArray<T>& other) { copy_from(other); return *this; }\n"
"\n"
-" ~DynamicArray() { if (data) free(data); }\n"
+" ~DynamicArray() { if (data) free(data); }\n"
"\n"
-" operator T*() { return data; }\n"
+" operator T*() { return data; }\n"
"\n"
"protected:\n"
-" void copy_from(const DynamicArray<T>& other) {\n"
-" if (data) free(data);\n"
-" data = (T *)malloc(sizeof(T) * other.length);\n"
-" memcpy(data, other.data, sizeof(T) * other.length);\n"
-" length = other.length;\n"
-" }\n"
+" void copy_from(const DynamicArray<T>& other) {\n"
+" if (data) free(data);\n"
+" data = (T *)malloc(sizeof(T) * other.length);\n"
+" memcpy(data, other.data, sizeof(T) * other.length);\n"
+" length = other.length;\n"
+" }\n"
"};\n"
"\n"
"typedef void (*TBeginFunc)(CollectionPropertyIterator *iter, PointerRNA *ptr);\n"
@@ -3832,30 +3835,30 @@ static const char *cpp_classes = ""
"template<typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend>\n"
"class CollectionIterator {\n"
"public:\n"
-" CollectionIterator() : iter(), t(iter.ptr), init(false) { iter.valid = false; }\n"
-" ~CollectionIterator(void) { if (init) Tend(&iter); };\n"
+" CollectionIterator() : iter(), t(iter.ptr), init(false) { iter.valid = false; }\n"
+" ~CollectionIterator(void) { if (init) Tend(&iter); };\n"
"\n"
-" operator bool(void)\n"
-" { return iter.valid != 0; }\n"
-" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator++() { Tnext(&iter); t = T(iter.ptr); return *this; }\n"
+" operator bool(void)\n"
+" { return iter.valid != 0; }\n"
+" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator++() { Tnext(&iter); t = T(iter.ptr); return *this; }\n"
"\n"
-" T& operator*(void) { return t; }\n"
-" T* operator->(void) { return &t; }\n"
-" bool operator == (const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
+" 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) "
+" 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"
+" void begin(const Pointer &ptr)\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>& operator = "
"(const CollectionIterator<T, Tbegin, Tnext, Tend>& /*copy*/) {}\n"
""
-" CollectionPropertyIterator iter;\n"
-" T t;\n"
-" bool init;\n"
+" CollectionPropertyIterator iter;\n"
+" T t;\n"
+" bool init;\n"
"};\n"
"\n"
"template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n"
@@ -3863,27 +3866,27 @@ static const char *cpp_classes = ""
" typename Tcollection_funcs>\n"
"class CollectionRef : public Tcollection_funcs {\n"
"public:\n"
-" CollectionRef(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n"
+" CollectionRef(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n"
"\n"
-" void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n"
-" { iter.begin(ptr); }\n"
-" CollectionIterator<T, Tbegin, Tnext, Tend> end()\n"
-" { return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n"
+" void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n"
+" { iter.begin(ptr); }\n"
+" CollectionIterator<T, Tbegin, Tnext, Tend> end()\n"
+" { return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n"
""
-" int length()\n"
-" { return Tlength(&ptr); }\n"
-" T operator[](int key)\n"
-" { PointerRNA r_ptr; Tlookup_int(&ptr, key, &r_ptr); return T(r_ptr); }\n"
-" T operator[](const std::string &key)\n"
-" { PointerRNA r_ptr; Tlookup_string(&ptr, key.c_str(), &r_ptr); return T(r_ptr); }\n"
+" int length()\n"
+" { return Tlength(&ptr); }\n"
+" T operator[](int key)\n"
+" { PointerRNA r_ptr; Tlookup_int(&ptr, key, &r_ptr); return T(r_ptr); }\n"
+" T operator[](const std::string &key)\n"
+" { PointerRNA r_ptr; Tlookup_string(&ptr, key.c_str(), &r_ptr); return T(r_ptr); }\n"
"\n"
"private:\n"
-" PointerRNA ptr;\n"
+" PointerRNA ptr;\n"
"};\n"
"\n"
"class DefaultCollectionFunctions {\n"
"public:\n"
-" DefaultCollectionFunctions(const PointerRNA & /*p*/) {}\n"
+" DefaultCollectionFunctions(const PointerRNA & /*p*/) {}\n"
"};\n"
"\n"
"\n";
@@ -4055,7 +4058,10 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
static void make_bad_file(const char *file, int line)
{
FILE *fp = fopen(file, "w");
- fprintf(fp, "#error \"Error! can't make correct RNA file from %s:%d, STUPID!\"\n", __FILE__, line);
+ fprintf(fp,
+ "#error \"Error! can't make correct RNA file from %s:%d, "
+ "check DNA properties.\"\n",
+ __FILE__, line);
fclose(fp);
}
@@ -4209,6 +4215,12 @@ int main(int argc, char **argv)
{
int totblock, return_status = 0;
+ CLG_init();
+
+ /* Some useful defaults since this runs standalone. */
+ CLG_output_use_basename_set(true);
+ CLG_level_set(debugSRNA);
+
if (argc < 2) {
fprintf(stderr, "Usage: %s outdirectory/\n", argv[0]);
return_status = 1;
@@ -4221,6 +4233,8 @@ int main(int argc, char **argv)
return_status = rna_preprocess(argv[1]);
}
+ CLG_exit();
+
totblock = MEM_get_memory_blocks_in_use();
if (totblock != 0) {
fprintf(stderr, "Error Totblock: %d\n", totblock);
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index dbf436bd4bc..fac3864d089 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_ID.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -33,7 +27,6 @@
#include "DNA_object_types.h"
#include "BLI_utildefines.h"
-#include "BLI_math_base.h"
#include "BKE_icons.h"
#include "BKE_library.h"
@@ -85,7 +78,7 @@ const EnumPropertyItem rna_enum_id_type_items[] = {
{ID_WM, "WINDOWMANAGER", ICON_WINDOW, "Window Manager", ""},
{ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""},
{ID_WS, "WORKSPACE", ICON_WORKSPACE, "Workspace", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -93,6 +86,7 @@ const EnumPropertyItem rna_enum_id_type_items[] = {
#include "DNA_anim_types.h"
#include "BLI_listbase.h"
+#include "BLI_math_base.h"
#include "BKE_font.h"
#include "BKE_idprop.h"
@@ -369,8 +363,10 @@ static ID *rna_ID_copy(ID *id, Main *bmain)
{
ID *newid;
- if (id_copy(bmain, id, &newid, false)) {
- if (newid) id_us_min(newid);
+ if (BKE_id_copy(bmain, id, &newid)) {
+ if (newid != NULL) {
+ id_us_min(newid);
+ }
return newid;
}
@@ -853,6 +849,14 @@ static IDProperty *rna_IDPropertyWrapPtr_idprops(PointerRNA *ptr, bool UNUSED(cr
return ptr->data;
}
+static void rna_Library_version_get(PointerRNA *ptr, int *value)
+{
+ Library *lib = (Library *)ptr->data;
+ value[0] = lib->versionfile / 100;
+ value[1] = lib->versionfile % 100;
+ value[2] = lib->subversionfile;
+}
+
#else
static void rna_def_ID_properties(BlenderRNA *brna)
@@ -1068,7 +1072,7 @@ static void rna_def_ID_override_static_property_operation(BlenderRNA *brna)
"Insert a new item into collection after the one referenced in subitem_reference_name or _index"},
{IDOVERRIDESTATIC_OP_INSERT_BEFORE, "INSERT_BEFORE", 0, "Insert Before",
"Insert a new item into collection after the one referenced in subitem_reference_name or _index (NOT USED)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem static_override_property_flag_items[] = {
@@ -1076,7 +1080,7 @@ static void rna_def_ID_override_static_property_operation(BlenderRNA *brna)
"For templates, prevents the user from removing pre-defined operation (NOT USED)"},
{IDOVERRIDESTATIC_FLAG_LOCKED, "LOCKED", 0, "Locked",
"Prevents the user from modifying that override operation (NOT USED)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "IDOverrideStaticPropertyOperation", NULL);
@@ -1161,7 +1165,7 @@ static void rna_def_ID(BlenderRNA *brna)
{ID_RECALC_TRANSFORM, "OBJECT", 0, "Object", ""},
{ID_RECALC_GEOMETRY, "DATA", 0, "Data", ""},
{ID_RECALC_ANIMATION, "TIME", 0, "Time", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ID", NULL);
@@ -1321,6 +1325,12 @@ static void rna_def_library(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
RNA_def_property_ui_text(prop, "Packed File", "");
+ prop = RNA_def_int_vector(srna, "version", 3, NULL, 0, INT_MAX,
+ "Version", "Version of Blender the library .blend was saved with", 0, INT_MAX);
+ RNA_def_property_int_funcs(prop, "rna_Library_version_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_THICK_WRAP);
+
func = RNA_def_function(srna, "reload", "WM_lib_reload");
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks");
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 2b0bfb2662e..8282ed04520 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_access.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -523,7 +517,7 @@ static PropertyRNA *typemap[IDP_NUMTYPES] = {
(PropertyRNA *)&rna_PropertyGroupItem_group,
(PropertyRNA *)&rna_PropertyGroupItem_id,
(PropertyRNA *)&rna_PropertyGroupItem_double,
- (PropertyRNA *)&rna_PropertyGroupItem_idp_array
+ (PropertyRNA *)&rna_PropertyGroupItem_idp_array,
};
static PropertyRNA *arraytypemap[IDP_NUMTYPES] = {
@@ -531,7 +525,7 @@ static PropertyRNA *arraytypemap[IDP_NUMTYPES] = {
(PropertyRNA *)&rna_PropertyGroupItem_float_array,
NULL, NULL, NULL,
(PropertyRNA *)&rna_PropertyGroupItem_collection, NULL,
- (PropertyRNA *)&rna_PropertyGroupItem_double_array
+ (PropertyRNA *)&rna_PropertyGroupItem_double_array,
};
static void *rna_idproperty_check_ex(PropertyRNA **prop, PointerRNA *ptr, const bool return_rnaprop)
@@ -2840,7 +2834,7 @@ int RNA_property_int_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
bool RNA_property_int_set_default(PointerRNA *ptr, PropertyRNA *prop, int value)
{
if (value != 0) {
- IDPropertyTemplate val = { .i = value };
+ IDPropertyTemplate val = { .i = value, };
return rna_idproperty_ui_set_default(ptr, prop, IDP_INT, &val);
}
else {
@@ -3160,7 +3154,7 @@ float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
bool RNA_property_float_set_default(PointerRNA *ptr, PropertyRNA *prop, float value)
{
if (value != 0) {
- IDPropertyTemplate val = { .d = value };
+ IDPropertyTemplate val = { .d = value, };
return rna_idproperty_ui_set_default(ptr, prop, IDP_DOUBLE, &val);
}
else {
@@ -5027,7 +5021,7 @@ bool RNA_path_resolve_property(PointerRNA *ptr, const char *path, PointerRNA *r_
* indicated by fully resolving the path.
*
* This is a convenience method to avoid logic errors and ugly syntax.
- * \note Assumes all pointers provided are valid
+ * \note Assumes all pointers provided are valid
* \return True only if both a valid pointer and property are found after resolving the path
*/
bool RNA_path_resolve_property_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
@@ -6322,6 +6316,97 @@ static const char *bool_as_py_string(const int var)
return var ? "True" : "False";
}
+static void *rna_array_as_string_alloc(
+ int type, int len, PointerRNA *ptr, PropertyRNA *prop, void **r_buf_end)
+{
+ void *buf_ret = NULL;
+ if (type == PROP_BOOLEAN) {
+ bool *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
+ RNA_property_boolean_get_array(ptr, prop, buf);
+ *r_buf_end = buf + len;
+ }
+ else if (type == PROP_INT) {
+ int *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
+ RNA_property_int_get_array(ptr, prop, buf);
+ *r_buf_end = buf + len;
+ }
+ else if (type == PROP_FLOAT) {
+ float *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
+ RNA_property_float_get_array(ptr, prop, buf);
+ *r_buf_end = buf + len;
+ }
+ else {
+ BLI_assert(0);
+ }
+ return buf_ret;
+}
+
+static void rna_array_as_string_elem(
+ int type, void **buf_p, int len, DynStr *dynstr)
+{
+ /* This will print a comma seperated string of the array elements from
+ * buf start to len. We will add a comma if len == 1 to preserve tuples. */
+ const int end = len - 1;
+ if (type == PROP_BOOLEAN) {
+ bool *buf = *buf_p;
+ for (int i = 0; i < len; i++, buf++) {
+ BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%s, " : "%s", bool_as_py_string(*buf));
+ }
+ *buf_p = buf;
+ }
+ else if (type == PROP_INT) {
+ int *buf = *buf_p;
+ for (int i = 0; i < len; i++, buf++) {
+ BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%d, " : "%d", *buf);
+ }
+ *buf_p = buf;
+ }
+ else if (type == PROP_FLOAT) {
+ float *buf = *buf_p;
+ for (int i = 0; i < len; i++, buf++) {
+ BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%g, " : "%g", *buf);
+ }
+ *buf_p = buf;
+ }
+ else {
+ BLI_assert(0);
+ }
+}
+
+static void rna_array_as_string_recursive(
+ int type, void **buf_p, int totdim, const int *dim_size, DynStr *dynstr)
+{
+ BLI_dynstr_append(dynstr, "(");
+ if (totdim > 1) {
+ totdim--;
+ const int end = dim_size[totdim] - 1;
+ for (int i = 0; i <= end; i++) {
+ rna_array_as_string_recursive(type, buf_p, totdim, dim_size, dynstr);
+ if (i < end || !end) {
+ BLI_dynstr_append(dynstr, ", ");
+ }
+ }
+ }
+ else {
+ rna_array_as_string_elem(type, buf_p, dim_size[0], dynstr);
+ }
+ BLI_dynstr_append(dynstr, ")");
+}
+
+static void rna_array_as_string(int type, int len, PointerRNA *ptr, PropertyRNA *prop, DynStr *dynstr)
+{
+ void *buf_end;
+ void *buf = rna_array_as_string_alloc(type, len, ptr, prop, &buf_end);
+ void *buf_step = buf;
+ int totdim, dim_size[RNA_MAX_ARRAY_DIMENSION];
+
+ totdim = RNA_property_array_dimension(ptr, prop, dim_size);
+
+ rna_array_as_string_recursive(type, &buf_step, totdim, dim_size, dynstr);
+ BLI_assert(buf_step == buf_end);
+ MEM_freeN(buf);
+}
+
char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index, int max_prop_length)
{
int type = RNA_property_type(prop);
@@ -6330,7 +6415,6 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in
DynStr *dynstr = BLI_dynstr_new();
char *cstring;
-
/* see if we can coerce into a python type - PropertyType */
switch (type) {
case PROP_BOOLEAN:
@@ -6342,20 +6426,7 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in
BLI_dynstr_append(dynstr, bool_as_py_string(RNA_property_boolean_get_index(ptr, prop, index)));
}
else {
- bool fixedbuf[RNA_MAX_ARRAY_LENGTH];
- bool *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__);
-
- RNA_property_boolean_get_array(ptr, prop, buf);
- BLI_dynstr_append(dynstr, "(");
- for (int i = 0; i < len; i++) {
- BLI_dynstr_appendf(dynstr, i ? ", %s" : "%s", bool_as_py_string(buf[i]));
- }
- if (len == 1)
- BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
- BLI_dynstr_append(dynstr, ")");
- if (buf != fixedbuf) {
- MEM_freeN(buf);
- }
+ rna_array_as_string(type, len, ptr, prop, dynstr);
}
}
break;
@@ -6368,20 +6439,7 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in
BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get_index(ptr, prop, index));
}
else {
- int fixedbuf[RNA_MAX_ARRAY_LENGTH];
- int *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__);
-
- RNA_property_int_get_array(ptr, prop, buf);
- BLI_dynstr_append(dynstr, "(");
- for (int i = 0; i < len; i++) {
- BLI_dynstr_appendf(dynstr, i ? ", %d" : "%d", buf[i]);
- }
- if (len == 1)
- BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
- BLI_dynstr_append(dynstr, ")");
- if (buf != fixedbuf) {
- MEM_freeN(buf);
- }
+ rna_array_as_string(type, len, ptr, prop, dynstr);
}
}
break;
@@ -6394,20 +6452,7 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in
BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get_index(ptr, prop, index));
}
else {
- float fixedbuf[RNA_MAX_ARRAY_LENGTH];
- float *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__);
-
- RNA_property_float_get_array(ptr, prop, buf);
- BLI_dynstr_append(dynstr, "(");
- for (int i = 0; i < len; i++) {
- BLI_dynstr_appendf(dynstr, i ? ", %g" : "%g", buf[i]);
- }
- if (len == 1)
- BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
- BLI_dynstr_append(dynstr, ")");
- if (buf != fixedbuf) {
- MEM_freeN(buf);
- }
+ rna_array_as_string(type, len, ptr, prop, dynstr);
}
}
break;
@@ -6937,7 +6982,7 @@ static int rna_function_format_array_length(const char *format, int ofs, int fle
int idx = 0;
if (format[ofs++] == '[')
- for (; ofs < flen && format[ofs] != ']' && idx < sizeof(*lenbuf) - 1; idx++, ofs++)
+ for (; ofs < flen && format[ofs] != ']' && idx < sizeof(lenbuf) - 1; idx++, ofs++)
lenbuf[idx] = format[ofs];
if (ofs < flen && format[ofs + 1] == ']') {
@@ -7464,7 +7509,7 @@ bool RNA_property_copy(Main *bmain, PointerRNA *ptr, PointerRNA *fromptr, Proper
IDOverrideStaticPropertyOperation opop = {
.operation = IDOVERRIDESTATIC_OP_REPLACE,
.subitem_reference_index = index,
- .subitem_local_index = index
+ .subitem_local_index = index,
};
return rna_property_override_operation_apply(
bmain,
@@ -7937,7 +7982,7 @@ bool RNA_struct_override_matches(
IDOverrideStaticPropertyOperation opop_tmp = {
.operation = IDOVERRIDESTATIC_OP_REPLACE,
.subitem_reference_index = -1,
- .subitem_local_index = -1
+ .subitem_local_index = -1,
};
rna_property_override_operation_apply(
bmain,
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 6a9d547042b..fd45a9a9048 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Roland Hess, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_action.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -489,6 +483,12 @@ static void rna_def_dopesheet(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_SPEAKER, 0);
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+ prop = RNA_def_property(srna, "show_cache_files", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag2", ADS_FILTER_NOCACHEFILES);
+ RNA_def_property_ui_text(prop, "Display Cache Files", "Include visualization of cache file related animation data");
+ RNA_def_property_ui_icon(prop, ICON_FILE, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
prop = RNA_def_property(srna, "show_gpencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOGPENCIL);
RNA_def_property_ui_text(prop, "Display Grease Pencil", "Include visualization of Grease Pencil related animation data and frames");
diff --git a/source/blender/makesrna/intern/rna_action_api.c b/source/blender/makesrna/intern/rna_action_api.c
index 3d5252b8cdc..9543042248e 100644
--- a/source/blender/makesrna/intern/rna_action_api.c
+++ b/source/blender/makesrna/intern/rna_action_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Arystanbek Dyussenov
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_action_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index e43b62e8a75..6194a34ac75 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2009), Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_animation.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -51,7 +45,7 @@ const EnumPropertyItem rna_enum_keyingset_path_grouping_items[] = {
{KSP_GROUP_NAMED, "NAMED", 0, "Named Group", ""},
{KSP_GROUP_NONE, "NONE", 0, "None", ""},
{KSP_GROUP_KSNAME, "KEYINGSET", 0, "Keying Set Name", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* It would be cool to get rid of this 'INSERTKEY_' prefix in 'py strings' values, but it would break existing
@@ -65,7 +59,7 @@ const EnumPropertyItem rna_enum_keying_flag_items[] = {
{INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "XYZ=RGB Colors",
"Color for newly added transformation F-Curves (Location, Rotation, Scale) "
"and also Color is based on the transform axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -579,6 +573,33 @@ static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_
}
}
+static FCurve *rna_Driver_new(ID *id, AnimData *adt, ReportList *reports, const char *rna_path, int array_index)
+{
+ if (rna_path[0] == '\0') {
+ BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
+ return NULL;
+ }
+
+ if (list_find_fcurve(&adt->drivers, rna_path, array_index)) {
+ BKE_reportf(reports, RPT_ERROR, "Driver '%s[%d]' already exists", rna_path, array_index);
+ return NULL;
+ }
+
+ short add_mode = 1;
+ FCurve *fcu = verify_driver_fcurve(id, rna_path, array_index, add_mode);
+ BLI_assert(fcu != NULL);
+ return fcu;
+}
+
+static void rna_Driver_remove(AnimData *adt, ReportList *reports, FCurve *fcu)
+{
+ if (!BLI_remlink_safe(&adt->drivers, fcu)) {
+ BKE_report(reports, RPT_ERROR, "Driver not found in this animation data");
+ return;
+ }
+ free_fcurve(fcu);
+}
+
static FCurve *rna_Driver_find(AnimData *adt, ReportList *reports, const char *data_path, int index)
{
if (data_path[0] == '\0') {
@@ -920,7 +941,6 @@ static void rna_def_keyingset(BlenderRNA *brna)
prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "description");
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
RNA_def_property_ui_text(prop, "Description", "A short description of the keying set");
/* KeyingSetInfo (Type Info) for Builtin Sets only */
@@ -1005,6 +1025,24 @@ static void rna_api_animdata_drivers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "AnimData");
RNA_def_struct_ui_text(srna, "Drivers", "Collection of Driver F-Curves");
+ /* Match: ActionFCurves.new/remove */
+
+ /* AnimData.drivers.new(...) */
+ func = RNA_def_function(srna, "new", "rna_Driver_new");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path to use");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
+ /* return type */
+ parm = RNA_def_pointer(func, "driver", "FCurve", "", "Newly Driver F-Curve");
+ RNA_def_function_return(func, parm);
+
+ /* AnimData.drivers.remove(...) */
+ func = RNA_def_function(srna, "remove", "rna_Driver_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "driver", "FCurve", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
/* AnimData.drivers.from_existing(...) */
func = RNA_def_function(srna, "from_existing", "rna_Driver_from_existing");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c
index 0b8f1acbd74..6bc891259ad 100644
--- a/source/blender/makesrna/intern/rna_animation_api.c
+++ b/source/blender/makesrna/intern/rna_animation_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_animation_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c
index 94b4d60ca25..605b10e5848 100644
--- a/source/blender/makesrna/intern/rna_animviz.c
+++ b/source/blender/makesrna/intern/rna_animviz.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2010), Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_animviz.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -47,37 +41,16 @@ const EnumPropertyItem rna_enum_motionpath_bake_location_items[] = {
{MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"},
{0, "TAILS", 0, "Tails", "Calculate bone paths from tails"},
//{MOTIONPATH_BAKE_CENTERS, "CENTROID", 0, "Centers", "Calculate bone paths from center of mass"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-static PointerRNA rna_AnimViz_onion_skinning_get(PointerRNA *ptr)
-{
- return rna_pointer_inherit_refine(ptr, &RNA_AnimVizOnionSkinning, ptr->data);
-}
-
static PointerRNA rna_AnimViz_motion_paths_get(PointerRNA *ptr)
{
return rna_pointer_inherit_refine(ptr, &RNA_AnimVizMotionPaths, ptr->data);
}
-static void rna_AnimViz_ghost_start_frame_set(PointerRNA *ptr, int value)
-{
- bAnimVizSettings *data = (bAnimVizSettings *)ptr->data;
-
- data->ghost_sf = value;
- CLAMP(data->ghost_ef, data->ghost_sf, MAXFRAME / 2);
-}
-
-static void rna_AnimViz_ghost_end_frame_set(PointerRNA *ptr, int value)
-{
- bAnimVizSettings *data = (bAnimVizSettings *)ptr->data;
-
- data->ghost_ef = value;
- CLAMP(data->ghost_sf, 1, data->ghost_ef);
-}
-
static void rna_AnimViz_path_start_frame_set(PointerRNA *ptr, int value)
{
bAnimVizSettings *data = (bAnimVizSettings *)ptr->data;
@@ -195,81 +168,6 @@ static void rna_def_animviz_motion_path(BlenderRNA *brna)
/* --- */
-static void rna_def_animviz_ghosts(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_type_items[] = {
- {GHOST_TYPE_NONE, "NONE", 0, "No Ghosts", "Do not show any ghosts"},
- {GHOST_TYPE_ACFRA, "CURRENT_FRAME", 0, "Around Current Frame", "Show ghosts from around the current frame"},
- {GHOST_TYPE_RANGE, "RANGE", 0, "In Range", "Show ghosts for the specified frame range"},
- {GHOST_TYPE_KEYS, "KEYS", 0, "On Keyframes", "Show ghosts on keyframes"},
- {0, NULL, 0, NULL, NULL}
- };
-
-
- srna = RNA_def_struct(brna, "AnimVizOnionSkinning", NULL);
- RNA_def_struct_sdna(srna, "bAnimVizSettings");
- RNA_def_struct_nested(brna, srna, "AnimViz");
- RNA_def_struct_ui_text(srna, "Onion Skinning Settings", "Onion Skinning settings for animation visualization");
-
- /* Enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "ghost_type");
- RNA_def_property_enum_items(prop, prop_type_items);
- RNA_def_property_ui_text(prop, "Type", "Method used for determining what ghosts get drawn");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
- /* 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_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_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_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_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_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_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-}
-
static void rna_def_animviz_paths(BlenderRNA *brna)
{
StructRNA *srna;
@@ -279,7 +177,7 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
{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}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "AnimVizMotionPaths", NULL);
@@ -394,13 +292,6 @@ static void rna_def_animviz(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "bAnimVizSettings");
RNA_def_struct_ui_text(srna, "Animation Visualization", "Settings for the visualization of motion");
- /* onion-skinning settings (nested struct) */
- prop = RNA_def_property(srna, "onion_skin_frames", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "AnimVizOnionSkinning");
- RNA_def_property_pointer_funcs(prop, "rna_AnimViz_onion_skinning_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Onion Skinning", "Onion Skinning (ghosting) settings for visualization");
-
/* motion path settings (nested struct) */
prop = RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
@@ -414,7 +305,6 @@ static void rna_def_animviz(BlenderRNA *brna)
void RNA_def_animviz(BlenderRNA *brna)
{
rna_def_animviz(brna);
- rna_def_animviz_ghosts(brna);
rna_def_animviz_paths(brna);
rna_def_animviz_motion_path(brna);
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index e07271f3009..1c16abcd12f 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_armature.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -147,7 +141,7 @@ static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), Pointe
/* proxy lib exception, store it here so we can restore layers on file
* load, since it would otherwise get lost due to being linked data */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->data == arm && ob->pose)
ob->pose->proxy_layer = arm->layer;
}
@@ -318,30 +312,6 @@ static void rna_Armature_layer_set(PointerRNA *ptr, const bool *values)
}
}
-/* XXX deprecated.... old armature only animviz */
-static void rna_Armature_ghost_start_frame_set(PointerRNA *ptr, int value)
-{
- bArmature *data = (bArmature *)ptr->data;
- CLAMP(value, 1, (int)(MAXFRAMEF / 2));
- data->ghostsf = value;
-
- if (data->ghostsf >= data->ghostef) {
- data->ghostef = MIN2(data->ghostsf, (int)(MAXFRAMEF / 2));
- }
-}
-
-static void rna_Armature_ghost_end_frame_set(PointerRNA *ptr, int value)
-{
- bArmature *data = (bArmature *)ptr->data;
- CLAMP(value, 1, (int)(MAXFRAMEF / 2));
- data->ghostef = value;
-
- if (data->ghostsf >= data->ghostef) {
- data->ghostsf = MAX2(data->ghostef, 1);
- }
-}
-/* XXX deprecated... old armature only animviz */
-
static void rna_EditBone_name_set(PointerRNA *ptr, const char *value)
{
bArmature *arm = (bArmature *)ptr->id.data;
@@ -456,7 +426,7 @@ static void rna_Bone_bbone_handle_update(Main *bmain, Scene *scene, PointerRNA *
Bone *bone = (Bone *)ptr->data;
/* Update all users of this armature after changing B-Bone handles. */
- for (Object *obt = bmain->object.first; obt; obt = obt->id.next) {
+ for (Object *obt = bmain->objects.first; obt; obt = obt->id.next) {
if (obt->data == arm && obt->pose) {
bPoseChannel *pchan = BKE_pose_channel_find_name(obt->pose, bone->name);
@@ -699,7 +669,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
{BBONE_HANDLE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Use the position of the specified bone to compute the handle"},
{BBONE_HANDLE_RELATIVE, "RELATIVE", 0, "Relative", "Use the offset of the specified bone from rest pose to compute the handle"},
{BBONE_HANDLE_TANGENT, "TANGENT", 0, "Tangent", "Use the orientation of the specified bone to compute the handle, ignoring the location"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -782,7 +752,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
/* Number values */
/* envelope deform settings */
- prop = RNA_def_property(srna, "envelope_distance", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "envelope_distance", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "dist");
RNA_def_property_range(prop, 0.0f, 1000.0f);
RNA_def_property_ui_text(prop, "Envelope Deform Distance", "Bone deformation distance (for Envelope deform only)");
@@ -794,7 +764,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
RNA_def_property_ui_text(prop, "Envelope Deform Weight", "Bone deformation weight (for Envelope deform only)");
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
- prop = RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_UNSIGNED);
+ prop = RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_DISTANCE);
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");
@@ -803,7 +773,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
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)");
- prop = RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_UNSIGNED);
+ prop = RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_DISTANCE);
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");
@@ -1154,19 +1124,12 @@ static void rna_def_armature(BlenderRNA *brna)
{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 const EnumPropertyItem prop_ghost_type_items[] = {
- {ARM_GHOST_CUR, "CURRENT_FRAME", 0, "Around Frame",
- "Display Ghosts of poses within a fixed number of frames around the current frame"},
- {ARM_GHOST_RANGE, "RANGE", 0, "In Range", "Display Ghosts of poses within specified range"},
- {ARM_GHOST_KEYS, "KEYS", 0, "On Keyframes", "Display Ghosts of poses on Keyframes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_pose_position_items[] = {
{0, "POSE", 0, "Pose Position", "Show armature in posed state"},
{ARM_RESTPOS, "REST", 0, "Rest Position", "Show Armature in binding pose state (no posing possible)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Armature", "ID");
@@ -1213,15 +1176,6 @@ static void rna_def_armature(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-/* XXX deprecated ....... old animviz for armatures only */
- prop = RNA_def_property(srna, "ghost_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "ghosttype");
- RNA_def_property_enum_items(prop, prop_ghost_type_items);
- RNA_def_property_ui_text(prop, "Ghost Type", "Method of Onion-skinning for active Action");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-/* XXX deprecated ....... old animviz for armatures only */
-
/* Boolean values */
/* layer */
prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
@@ -1281,54 +1235,6 @@ static void rna_def_armature(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Display Bone Group Colors", "Display bone group colors");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-/* XXX deprecated ....... old animviz for armatures only */
- prop = RNA_def_property(srna, "show_only_ghost_selected", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_GHOST_ONLYSEL);
- RNA_def_property_ui_text(prop, "Display Ghosts on Selected Bones Only", "");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-/* XXX deprecated ....... old animviz for armatures only */
-
- /* Number fields */
-/* XXX deprecated ....... old animviz for armatures only */
- /* ghost/onionskining settings */
- prop = RNA_def_property(srna, "ghost_step", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "ghostep");
- RNA_def_property_range(prop, 0, 30);
- RNA_def_property_ui_text(prop, "Ghosting Step",
- "Number of frame steps on either side of current frame to show as ghosts "
- "(only 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);
-
- prop = RNA_def_property(srna, "ghost_size", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "ghostsize");
- RNA_def_property_range(prop, 1, 20);
- RNA_def_property_ui_text(prop, "Ghosting Frame Step",
- "Frame step for Ghosts (not for 'On Keyframes' Onion-skinning method)");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-
- prop = RNA_def_property(srna, "ghost_frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "ghostsf");
- RNA_def_property_int_funcs(prop, NULL, "rna_Armature_ghost_start_frame_set", NULL);
- RNA_def_property_ui_text(prop, "Ghosting Start Frame",
- "Starting 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);
-
- prop = RNA_def_property(srna, "ghost_frame_end", PROP_INT, PROP_TIME);
- 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)");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-/* XXX deprecated ....... old animviz for armatures only */
-
-
prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_Armature_is_editmode_get", NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_armature_api.c b/source/blender/makesrna/intern/rna_armature_api.c
index e955a37a83f..6174f58aa37 100644
--- a/source/blender/makesrna/intern/rna_armature_api.c
+++ b/source/blender/makesrna/intern/rna_armature_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_armature_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c
index 3f472055087..9906fa49dcb 100644
--- a/source/blender/makesrna/intern/rna_boid.c
+++ b/source/blender/makesrna/intern/rna_boid.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2009 by Janne Karhu.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_boid.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <float.h>
@@ -67,7 +59,7 @@ const EnumPropertyItem rna_enum_boidrule_type_items[] = {
{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}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
@@ -77,7 +69,7 @@ static const EnumPropertyItem boidruleset_type_items[] = {
"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}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -389,7 +381,7 @@ static void rna_def_boidrule_average_speed(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Level", "How much velocity's z-component is kept constant");
RNA_def_property_update(prop, 0, "rna_Boids_reset");
- prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Speed", "Percentage of maximum speed");
RNA_def_property_update(prop, 0, "rna_Boids_reset");
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 03081ff606d..aba1f08ed6b 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Juho Veps�l�inen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_brush.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -48,7 +42,7 @@
static const EnumPropertyItem prop_direction_items[] = {
{0, "ADD", ICON_ADD, "Add", "Add effect of brush"},
{BRUSH_DIR_IN, "SUBTRACT", ICON_REMOVE, "Subtract", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem sculpt_stroke_method_items[] = {
@@ -60,7 +54,7 @@ static const EnumPropertyItem sculpt_stroke_method_items[] = {
{BRUSH_LINE, "LINE", 0, "Line", "Draw a line with dabs separated according to spacing"},
{BRUSH_CURVE, "CURVE", 0, "Curve",
"Define the stroke curve with a bezier curve (dabs are separated according to spacing)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -87,7 +81,7 @@ const EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = {
{0, "", 0, NULL, NULL},
{SCULPT_TOOL_MASK, "MASK", ICON_BRUSH_MASK, "Mask", ""},
{SCULPT_TOOL_SIMPLIFY, "SIMPLIFY", ICON_BRUSH_SUBTRACT /* icon TODO */, "Simplify", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_brush_vertex_tool_items[] = {
@@ -95,7 +89,7 @@ const EnumPropertyItem rna_enum_brush_vertex_tool_items[] = {
{VPAINT_TOOL_BLUR, "BLUR", ICON_BRUSH_BLUR, "Blur", ""},
{VPAINT_TOOL_AVERAGE, "AVERAGE", ICON_BRUSH_BLUR, "Average", ""},
{VPAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_BLUR, "Smear", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_brush_weight_tool_items[] = {
@@ -103,7 +97,7 @@ const EnumPropertyItem rna_enum_brush_weight_tool_items[] = {
{WPAINT_TOOL_BLUR, "BLUR", ICON_BRUSH_BLUR, "Blur", ""},
{WPAINT_TOOL_AVERAGE, "AVERAGE", ICON_BRUSH_BLUR, "Average", ""},
{WPAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_BLUR, "Smear", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_brush_image_tool_items[] = {
@@ -113,14 +107,14 @@ const EnumPropertyItem rna_enum_brush_image_tool_items[] = {
{PAINT_TOOL_CLONE, "CLONE", ICON_BRUSH_CLONE, "Clone", ""},
{PAINT_TOOL_FILL, "FILL", ICON_BRUSH_TEXFILL, "Fill", ""},
{PAINT_TOOL_MASK, "MASK", ICON_BRUSH_TEXMASK, "Mask", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_brush_gpencil_types_items[] = {
{GPAINT_TOOL_DRAW, "DRAW", ICON_STROKE, "Draw", "The brush is of type used for drawing strokes"},
{GPAINT_TOOL_FILL, "FILL", ICON_COLOR, "Fill", "The brush is of type used for filling areas"},
{GPAINT_TOOL_ERASE, "ERASE", ICON_PANEL_CLOSE, "Erase", "The brush is used for erasing strokes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
@@ -128,14 +122,14 @@ static EnumPropertyItem rna_enum_gpencil_brush_eraser_modes_items[] = {
{GP_BRUSH_ERASER_SOFT, "SOFT", 0, "Soft", "Use soft eraser"},
{GP_BRUSH_ERASER_HARD, "HARD", 0, "Hard", "Use hard eraser"},
{GP_BRUSH_ERASER_STROKE, "STROKE", 0, "Stroke", "Use stroke eraser"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_gpencil_fill_draw_modes_items[] = {
{GP_FILL_DMODE_STROKE, "STROKE", 0, "Strokes", "Use visible strokes as fill boundary limits"},
{GP_FILL_DMODE_CONTROL, "CONTROL", 0, "Control", "Use internal control lines as fill boundary limits"},
{GP_FILL_DMODE_BOTH, "BOTH", 0, "Both", "Use visible strokes and control lines as fill boundary limits"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_gpencil_brush_icons_items[] = {
@@ -149,7 +143,7 @@ static EnumPropertyItem rna_enum_gpencil_brush_icons_items[] = {
{GP_BRUSH_ICON_ERASE_SOFT, "SOFT", ICON_GPBRUSH_ERASE_SOFT, "Eraser Soft", ""},
{GP_BRUSH_ICON_ERASE_HARD, "HARD", ICON_GPBRUSH_ERASE_HARD, "Eraser Hard", ""},
{GP_BRUSH_ICON_ERASE_STROKE, "STROKE", ICON_GPBRUSH_ERASE_STROKE, "Eraser Stroke", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -168,25 +162,31 @@ static EnumPropertyItem rna_enum_gpencil_brush_icons_items[] = {
#include "WM_api.h"
-static bool rna_SculptToolCapabilities_has_accumulate_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_accumulate_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return SCULPT_TOOL_HAS_ACCUMULATE(br->sculpt_tool);
}
-static bool rna_SculptToolCapabilities_has_auto_smooth_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_topology_rake_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush *)ptr->data;
+ return SCULPT_TOOL_HAS_TOPOLOGY_RAKE(br->sculpt_tool);
+}
+
+static bool rna_BrushCapabilitiesSculpt_has_auto_smooth_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return !ELEM(br->sculpt_tool, SCULPT_TOOL_MASK, SCULPT_TOOL_SMOOTH);
}
-static bool rna_SculptToolCapabilities_has_height_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_height_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return br->sculpt_tool == SCULPT_TOOL_LAYER;
}
-static bool rna_SculptToolCapabilities_has_jitter_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_jitter_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return (!(br->flag & BRUSH_ANCHORED) &&
@@ -196,13 +196,13 @@ static bool rna_SculptToolCapabilities_has_jitter_get(PointerRNA *ptr)
SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
}
-static bool rna_SculptToolCapabilities_has_normal_weight_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_normal_weight_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return SCULPT_TOOL_HAS_NORMAL_WEIGHT(br->sculpt_tool);
}
-static bool rna_SculptToolCapabilities_has_rake_factor_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_rake_factor_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return SCULPT_TOOL_HAS_RAKE(br->sculpt_tool);
@@ -217,26 +217,26 @@ static bool rna_BrushCapabilities_has_overlay_get(PointerRNA *ptr)
MTEX_MAP_MODE_STENCIL);
}
-static bool rna_SculptToolCapabilities_has_persistence_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_persistence_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return br->sculpt_tool == SCULPT_TOOL_LAYER;
}
-static bool rna_SculptToolCapabilities_has_pinch_factor_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_pinch_factor_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return ELEM(br->sculpt_tool, SCULPT_TOOL_BLOB, SCULPT_TOOL_CREASE, SCULPT_TOOL_SNAKE_HOOK);
}
-static bool rna_SculptToolCapabilities_has_plane_offset_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_plane_offset_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return ELEM(br->sculpt_tool, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS,
SCULPT_TOOL_FILL, SCULPT_TOOL_FLATTEN, SCULPT_TOOL_SCRAPE);
}
-static bool rna_SculptToolCapabilities_has_random_texture_angle_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_random_texture_angle_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return (!ELEM(br->sculpt_tool,
@@ -260,7 +260,7 @@ static bool rna_BrushCapabilities_has_random_texture_angle_get(PointerRNA *ptr)
return !(br->flag & BRUSH_ANCHORED);
}
-static bool rna_SculptToolCapabilities_has_sculpt_plane_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_sculpt_plane_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return !ELEM(br->sculpt_tool, SCULPT_TOOL_INFLATE,
@@ -268,13 +268,13 @@ static bool rna_SculptToolCapabilities_has_sculpt_plane_get(PointerRNA *ptr)
SCULPT_TOOL_SMOOTH);
}
-static bool rna_SculptToolCapabilities_has_secondary_color_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_secondary_color_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return BKE_brush_sculpt_has_secondary_color(br);
}
-static bool rna_SculptToolCapabilities_has_smooth_stroke_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_smooth_stroke_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return (!(br->flag & BRUSH_ANCHORED) &&
@@ -295,7 +295,7 @@ static bool rna_BrushCapabilities_has_smooth_stroke_get(PointerRNA *ptr)
!(br->flag & BRUSH_CURVE));
}
-static bool rna_SculptToolCapabilities_has_space_attenuation_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_space_attenuation_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return ((br->flag & (BRUSH_SPACE | BRUSH_LINE | BRUSH_CURVE)) &&
@@ -303,20 +303,38 @@ static bool rna_SculptToolCapabilities_has_space_attenuation_get(PointerRNA *ptr
SCULPT_TOOL_SMOOTH, SCULPT_TOOL_SNAKE_HOOK));
}
-static bool rna_ImapaintToolCapabilities_has_space_attenuation_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesImagePaint_has_space_attenuation_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return (br->flag & (BRUSH_SPACE | BRUSH_LINE | BRUSH_CURVE)) &&
br->imagepaint_tool != PAINT_TOOL_FILL;
}
+static bool rna_BrushCapabilitiesImagePaint_has_color_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->imagepaint_tool, PAINT_TOOL_DRAW, PAINT_TOOL_FILL);
+}
+
+static bool rna_BrushCapabilitiesVertexPaint_has_color_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->vertexpaint_tool, VPAINT_TOOL_DRAW);
+}
+
+static bool rna_BrushCapabilitiesWeightPaint_has_weight_get(PointerRNA *ptr)
+{
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->weightpaint_tool, WPAINT_TOOL_DRAW);
+}
+
static bool rna_BrushCapabilities_has_spacing_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return (!(br->flag & BRUSH_ANCHORED));
}
-static bool rna_SculptToolCapabilities_has_strength_pressure_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_strength_pressure_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
@@ -328,7 +346,7 @@ static bool rna_TextureCapabilities_has_texture_angle_get(PointerRNA *ptr)
return mtex->brush_map_mode != MTEX_MAP_MODE_3D;
}
-static bool rna_SculptToolCapabilities_has_gravity_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesSculpt_has_gravity_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return !ELEM(br->sculpt_tool, SCULPT_TOOL_MASK, SCULPT_TOOL_SMOOTH);
@@ -343,7 +361,7 @@ static bool rna_TextureCapabilities_has_texture_angle_source_get(PointerRNA *ptr
MTEX_MAP_MODE_RANDOM);
}
-static bool rna_ImapaintToolCapabilities_has_accumulate_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesImagePaint_has_accumulate_get(PointerRNA *ptr)
{
/* only support for draw tool */
Brush *br = (Brush *)ptr->data;
@@ -358,7 +376,7 @@ static bool rna_ImapaintToolCapabilities_has_accumulate_get(PointerRNA *ptr)
) ? false : true;
}
-static bool rna_ImapaintToolCapabilities_has_radius_get(PointerRNA *ptr)
+static bool rna_BrushCapabilitiesImagePaint_has_radius_get(PointerRNA *ptr)
{
/* only support for draw tool */
Brush *br = (Brush *)ptr->data;
@@ -369,12 +387,22 @@ static bool rna_ImapaintToolCapabilities_has_radius_get(PointerRNA *ptr)
static PointerRNA rna_Sculpt_tool_capabilities_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_SculptToolCapabilities, ptr->id.data);
+ return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesSculpt, ptr->id.data);
}
static PointerRNA rna_Imapaint_tool_capabilities_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_ImapaintToolCapabilities, ptr->id.data);
+ return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesImagePaint, ptr->id.data);
+}
+
+static PointerRNA rna_Vertexpaint_tool_capabilities_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesVertexPaint, ptr->id.data);
+}
+
+static PointerRNA rna_Weightpaint_tool_capabilities_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesWeightPaint, ptr->id.data);
}
static PointerRNA rna_Brush_capabilities_get(PointerRNA *ptr)
@@ -536,45 +564,45 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
static const EnumPropertyItem prop_default_items[] = {
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* sculpt mode */
static const EnumPropertyItem prop_flatten_contrast_items[] = {
{BRUSH_DIR_IN, "CONTRAST", ICON_ADD, "Contrast", "Subtract effect of brush"},
{0, "FLATTEN", ICON_REMOVE, "Flatten", "Add effect of brush"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_fill_deepen_items[] = {
{0, "FILL", ICON_ADD, "Fill", "Add effect of brush"},
{BRUSH_DIR_IN, "DEEPEN", ICON_REMOVE, "Deepen", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_scrape_peaks_items[] = {
{0, "SCRAPE", ICON_ADD, "Scrape", "Add effect of brush"},
{BRUSH_DIR_IN, "PEAKS", ICON_REMOVE, "Peaks", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_pinch_magnify_items[] = {
{BRUSH_DIR_IN, "MAGNIFY", ICON_ADD, "Magnify", "Subtract effect of brush"},
{0, "PINCH", ICON_REMOVE, "Pinch", "Add effect of brush"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_inflate_deflate_items[] = {
{0, "INFLATE", ICON_ADD, "Inflate", "Add effect of brush"},
{BRUSH_DIR_IN, "DEFLATE", ICON_REMOVE, "Deflate", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* texture paint mode */
static const EnumPropertyItem prop_soften_sharpen_items[] = {
{BRUSH_DIR_IN, "SHARPEN", ICON_ADD, "Sharpen", "Sharpen effect of brush"},
{0, "SOFTEN", ICON_REMOVE, "Soften", "Blur effect of brush"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
Brush *me = (Brush *)(ptr->data);
@@ -648,7 +676,7 @@ static const EnumPropertyItem *rna_Brush_stroke_itemf(
{BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"},
{BRUSH_LINE, "LINE", 0, "Line", "Drag a line with dabs separated according to spacing"},
{BRUSH_CURVE, "CURVE", 0, "Curve", "Define the stroke curve with a bezier curve. Dabs are separated according to spacing"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
switch (mode) {
@@ -675,7 +703,7 @@ static void rna_BrushGpencilSettings_default_eraser_update(Main *bmain, Scene *s
Brush *brush_cur = paint->brush;
/* disable default eraser in all brushes */
- for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) {
+ for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
if ((brush != brush_cur) &&
(brush->ob_mode == OB_MODE_PAINT_GPENCIL) &&
(brush->gpencil_tool == GPAINT_TOOL_ERASE))
@@ -732,7 +760,7 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
{MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
{MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
{MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_tex_paint_map_mode_items[] = {
@@ -741,7 +769,7 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
{MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
{MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
{MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_mask_paint_map_mode_items[] = {
@@ -749,7 +777,7 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
{MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
{MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
{MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#define TEXTURE_CAPABILITY(prop_name_, ui_name_) \
@@ -821,23 +849,24 @@ static void rna_def_sculpt_capabilities(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "SculptToolCapabilities", NULL);
+ srna = RNA_def_struct(brna, "BrushCapabilitiesSculpt", 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 SCULPT_TOOL_CAPABILITY(prop_name_, ui_name_) \
+#define SCULPT_TOOL_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_SculptToolCapabilities_" \
+ RNA_def_property_boolean_funcs(prop, "rna_BrushCapabilitiesSculpt_" \
#prop_name_ "_get", NULL); \
RNA_def_property_ui_text(prop, ui_name_, NULL)
SCULPT_TOOL_CAPABILITY(has_accumulate, "Has Accumulate");
SCULPT_TOOL_CAPABILITY(has_auto_smooth, "Has Auto Smooth");
+ SCULPT_TOOL_CAPABILITY(has_topology_rake, "Has Topology Rake");
SCULPT_TOOL_CAPABILITY(has_height, "Has Height");
SCULPT_TOOL_CAPABILITY(has_jitter, "Has Jitter");
SCULPT_TOOL_CAPABILITY(has_normal_weight, "Has Crease/Pinch Factor");
@@ -865,14 +894,13 @@ static void rna_def_brush_capabilities(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "Brush");
RNA_def_struct_nested(brna, srna, "Brush");
RNA_def_struct_ui_text(srna, "Brush Capabilities",
- "Read-only indications of which brush operations "
- "are supported by the current brush");
+ "Read-only indications of supported operations");
#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_BrushCapabilities_" \
+ RNA_def_property_boolean_funcs(prop, "rna_BrushCapabilities_" \
#prop_name_ "_get", NULL); \
RNA_def_property_ui_text(prop, ui_name_, NULL)
@@ -890,28 +918,76 @@ static void rna_def_image_paint_capabilities(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ImapaintToolCapabilities", NULL);
+ srna = RNA_def_struct(brna, "BrushCapabilitiesImagePaint", NULL);
RNA_def_struct_sdna(srna, "Brush");
RNA_def_struct_nested(brna, srna, "Brush");
RNA_def_struct_ui_text(srna, "Image Paint Capabilities",
- "Read-only indications of which brush operations "
- "are supported by the current image paint brush");
+ "Read-only indications of supported operations");
#define IMAPAINT_TOOL_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_ImapaintToolCapabilities_" \
+ RNA_def_property_boolean_funcs(prop, "rna_BrushCapabilitiesImagePaint_" \
#prop_name_ "_get", NULL); \
RNA_def_property_ui_text(prop, ui_name_, NULL)
IMAPAINT_TOOL_CAPABILITY(has_accumulate, "Has Accumulate");
IMAPAINT_TOOL_CAPABILITY(has_space_attenuation, "Has Space Attenuation");
IMAPAINT_TOOL_CAPABILITY(has_radius, "Has Radius");
+ IMAPAINT_TOOL_CAPABILITY(has_color, "Has Color");
#undef IMAPAINT_TOOL_CAPABILITY
}
+static void rna_def_vertex_paint_capabilities(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BrushCapabilitiesVertexPaint", NULL);
+ RNA_def_struct_sdna(srna, "Brush");
+ RNA_def_struct_nested(brna, srna, "Brush");
+ RNA_def_struct_ui_text(srna, "Vertex Paint Capabilities",
+ "Read-only indications of supported operations");
+
+#define VPAINT_TOOL_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_BrushCapabilitiesVertexPaint_" \
+ #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
+
+ VPAINT_TOOL_CAPABILITY(has_color, "Has Color");
+
+#undef VPAINT_TOOL_CAPABILITY
+}
+
+static void rna_def_weight_paint_capabilities(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BrushCapabilitiesWeightPaint", NULL);
+ RNA_def_struct_sdna(srna, "Brush");
+ RNA_def_struct_nested(brna, srna, "Brush");
+ RNA_def_struct_ui_text(srna, "Weight Paint Capabilities",
+ "Read-only indications of supported operations");
+
+#define WPAINT_TOOL_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_BrushCapabilitiesWeightPaint_" \
+ #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
+
+ WPAINT_TOOL_CAPABILITY(has_weight, "Has Weight");
+
+#undef WPAINT_TOOL_CAPABILITY
+}
+
static void rna_def_gpencil_options(BlenderRNA *brna)
{
StructRNA *srna;
@@ -940,7 +1016,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
/* Jitter factor for new strokes */
- prop = RNA_def_property(srna, "pen_jitter", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "pen_jitter", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "draw_jitter");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Jitter", "Jitter factor for new strokes");
@@ -948,7 +1024,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
/* Randomnes factor for pressure */
- prop = RNA_def_property(srna, "random_pressure", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "random_pressure", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "draw_random_press");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Pressure Randomness", "Randomness factor for pressure in new strokes");
@@ -956,7 +1032,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
/* Randomnes factor for strength */
- prop = RNA_def_property(srna, "random_strength", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "random_strength", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "draw_random_strength");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Strength Randomness", "Randomness factor strength in new strokes");
@@ -964,7 +1040,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
/* Randomnes factor for subdivision */
- prop = RNA_def_property(srna, "random_subdiv", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "random_subdiv", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "draw_random_sub");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Subdivision", "Randomness factor for new strokes after subdivision");
@@ -982,7 +1058,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
/* Factor to change brush size depending of angle */
- prop = RNA_def_property(srna, "angle_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "angle_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "draw_angle_factor");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Angle Factor",
@@ -1058,7 +1134,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
/* fill threshold for transparence */
- prop = RNA_def_property(srna, "fill_threshold", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "fill_threshold", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "fill_threshold");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Threshold",
@@ -1099,7 +1175,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
/* active smooth factor while drawing */
- prop = RNA_def_property(srna, "active_smooth_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "active_smooth_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "active_smooth");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Active Smooth",
@@ -1180,6 +1256,12 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mode", "Mode to draw boundary limits");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ prop = RNA_def_property(srna, "trim", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_TRIM_STROKE);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(prop, "Trim Stroke Ends", "Trim intersecting stroke ends");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+
/* Material */
prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Material");
@@ -1273,7 +1355,7 @@ static void rna_def_brush(BlenderRNA *brna)
{0, "", ICON_NONE, NULL, NULL},
{IMB_BLEND_ERASE_ALPHA, "ERASE_ALPHA", 0, "Erase Alpha", "Erase alpha while painting"},
{IMB_BLEND_ADD_ALPHA, "ADD_ALPHA", 0, "Add Alpha", "Add alpha while painting"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem brush_sculpt_plane_items[] = {
@@ -1282,39 +1364,39 @@ static void rna_def_brush(BlenderRNA *brna)
{SCULPT_DISP_DIR_X, "X", 0, "X Plane", ""},
{SCULPT_DISP_DIR_Y, "Y", 0, "Y Plane", ""},
{SCULPT_DISP_DIR_Z, "Z", 0, "Z Plane", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem brush_mask_tool_items[] = {
{BRUSH_MASK_DRAW, "DRAW", 0, "Draw", ""},
{BRUSH_MASK_SMOOTH, "SMOOTH", 0, "Smooth", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem brush_blur_mode_items[] = {
{KERNEL_BOX, "BOX", 0, "Box", ""},
{KERNEL_GAUSSIAN, "GAUSSIAN", 0, "Gaussian", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem brush_gradient_items[] = {
{BRUSH_GRADIENT_PRESSURE, "PRESSURE", 0, "Pressure", ""},
{BRUSH_GRADIENT_SPACING_REPEAT, "SPACING_REPEAT", 0, "Repeat", ""},
{BRUSH_GRADIENT_SPACING_CLAMP, "SPACING_CLAMP", 0, "Clamp", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem brush_gradient_fill_items[] = {
{BRUSH_GRADIENT_LINEAR, "LINEAR", 0, "Linear", ""},
{BRUSH_GRADIENT_RADIAL, "RADIAL", 0, "Radial", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem brush_mask_pressure_items[] = {
{0, "NONE", 0, "Off", ""},
{BRUSH_MASK_PRESSURE_RAMP, "RAMP", ICON_STYLUS_PRESSURE, "Ramp", ""},
{BRUSH_MASK_PRESSURE_CUTOFF, "CUTOFF", ICON_STYLUS_PRESSURE, "Cutoff", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Brush", "ID");
@@ -1430,7 +1512,7 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Gradient Spacing", "Spacing before brush gradient goes full circle");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop = RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_NONE);
+ prop = RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_PIXEL);
RNA_def_property_range(prop, 10, 200);
RNA_def_property_ui_text(prop, "Smooth Stroke Radius", "Minimum distance from last point before stroke continues");
RNA_def_property_update(prop, 0, "rna_Brush_update");
@@ -1535,6 +1617,17 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Autosmooth", "Amount of smoothing to automatically apply to each stroke");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "topology_rake_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "topology_rake_factor");
+ RNA_def_property_float_default(prop, 0);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(prop, "Topology Rake", "Automatically align edges to the brush direction to "
+ "to generate cleaner topology and define sharp features "
+ "dynamic topology. Best used on low-poly meshes as it has "
+ "a performance impact");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "stencil_pos", PROP_FLOAT, PROP_XYZ);
RNA_def_property_float_sdna(prop, NULL, "stencil_pos");
RNA_def_property_array(prop, 2);
@@ -1904,7 +1997,7 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Clone Image", "Image for clone tool");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update");
- prop = RNA_def_property(srna, "clone_alpha", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "clone_alpha", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "clone.alpha");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Clone Alpha", "Opacity of clone image display");
@@ -1925,15 +2018,27 @@ static void rna_def_brush(BlenderRNA *brna)
/* 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, "SculptToolCapabilities");
+ RNA_def_property_struct_type(prop, "BrushCapabilitiesSculpt");
RNA_def_property_pointer_funcs(prop, "rna_Sculpt_tool_capabilities_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Sculpt Capabilities", "Brush's capabilities in sculpt mode");
+ RNA_def_property_ui_text(prop, "Sculpt Capabilities", "");
prop = RNA_def_property(srna, "image_paint_capabilities", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "ImapaintToolCapabilities");
+ RNA_def_property_struct_type(prop, "BrushCapabilitiesImagePaint");
RNA_def_property_pointer_funcs(prop, "rna_Imapaint_tool_capabilities_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Image Painting Capabilities", "Brush's capabilities in image paint mode");
+ RNA_def_property_ui_text(prop, "Image Paint Capabilities", "");
+
+ prop = RNA_def_property(srna, "vertex_paint_capabilities", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "BrushCapabilitiesVertexPaint");
+ RNA_def_property_pointer_funcs(prop, "rna_Vertexpaint_tool_capabilities_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Vertex Paint Capabilities", "");
+
+ prop = RNA_def_property(srna, "weight_paint_capabilities", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "BrushCapabilitiesWeightPaint");
+ RNA_def_property_pointer_funcs(prop, "rna_Weightpaint_tool_capabilities_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Weight Paint Capabilities", "");
prop = RNA_def_property(srna, "gpencil_settings", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "BrushGpencilSettings");
@@ -1972,7 +2077,7 @@ static void rna_def_operator_stroke_element(BlenderRNA *brna)
RNA_def_property_array(prop, 2);
RNA_def_property_ui_text(prop, "Mouse", "");
- prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Pressure", "Tablet pressure");
@@ -2009,6 +2114,8 @@ void RNA_def_brush(BlenderRNA *brna)
rna_def_brush_capabilities(brna);
rna_def_sculpt_capabilities(brna);
rna_def_image_paint_capabilities(brna);
+ rna_def_vertex_paint_capabilities(brna);
+ rna_def_weight_paint_capabilities(brna);
rna_def_gpencil_options(brna);
rna_def_brush_texture_slot(brna);
rna_def_operator_stroke_element(brna);
diff --git a/source/blender/makesrna/intern/rna_cachefile.c b/source/blender/makesrna/intern/rna_cachefile.c
index dd76e2409db..a0464372cbd 100644
--- a/source/blender/makesrna/intern/rna_cachefile.c
+++ b/source/blender/makesrna/intern/rna_cachefile.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Kevin Dietrich.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_cachefile.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include "DNA_cachefile_types.h"
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 1e68ab65965..0912c9bdc6e 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_camera.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -146,20 +140,20 @@ static void rna_def_camera_background_image(BlenderRNA *brna)
static const EnumPropertyItem bgpic_source_items[] = {
{CAM_BGIMG_SOURCE_IMAGE, "IMAGE", 0, "Image", ""},
{CAM_BGIMG_SOURCE_MOVIE, "MOVIE_CLIP", 0, "Movie Clip", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem bgpic_camera_frame_items[] = {
{0, "STRETCH", 0, "Stretch", ""},
{CAM_BGIMG_FLAG_CAMERA_ASPECT, "FIT", 0, "Fit", ""},
{CAM_BGIMG_FLAG_CAMERA_ASPECT | CAM_BGIMG_FLAG_CAMERA_CROP, "CROP", 0, "Crop", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem bgpic_display_depth_items[] = {
{0, "BACK", 0, "Back", ""},
{CAM_BGIMG_FLAG_FOREGROUND, "FRONT", 0, "Front", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "CameraBackgroundImage", NULL);
@@ -302,14 +296,14 @@ static void rna_def_camera_stereo_data(BlenderRNA *brna)
{CAM_S3D_OFFAXIS, "OFFAXIS", 0, "Off-Axis", "Off-axis frustums converging in a plane"},
{CAM_S3D_PARALLEL, "PARALLEL", 0, "Parallel", "Parallel cameras with no convergence"},
{CAM_S3D_TOE, "TOE", 0, "Toe-in", "Rotated cameras, looking at the convergence distance"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem pivot_items[] = {
{CAM_S3D_PIVOT_LEFT, "LEFT", 0, "Left", ""},
{CAM_S3D_PIVOT_RIGHT, "RIGHT", 0, "Right", ""},
{CAM_S3D_PIVOT_CENTER, "CENTER", 0, "Center", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "CameraStereoData", NULL);
@@ -376,7 +370,7 @@ void RNA_def_camera(BlenderRNA *brna)
{CAM_PERSP, "PERSP", 0, "Perspective", ""},
{CAM_ORTHO, "ORTHO", 0, "Orthographic", ""},
{CAM_PANO, "PANO", 0, "Panoramic", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_display_type_extra_items[] = {
{CAM_DTX_CENTER, "CENTER", 0, "Center", ""},
@@ -387,18 +381,18 @@ void RNA_def_camera(BlenderRNA *brna)
{CAM_DTX_GOLDEN_TRI_B, "GOLDEN_TRIANGLE_B", 0, "Golden Triangle B", ""},
{CAM_DTX_HARMONY_TRI_A, "HARMONY_TRIANGLE_A", 0, "Harmonious Triangle A", ""},
{CAM_DTX_HARMONY_TRI_B, "HARMONY_TRIANGLE_B", 0, "Harmonious Triangle B", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_lens_unit_items[] = {
{0, "MILLIMETERS", 0, "Millimeters", "Specify the lens in millimeters"},
{CAM_ANGLETOGGLE, "FOV", 0, "Field of View", "Specify the lens as the field of view's angle"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem sensor_fit_items[] = {
{CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Fit to the sensor width or height depending on image resolution"},
{CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Fit to the sensor width"},
{CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Fit to the sensor height"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Camera", "ID");
@@ -454,7 +448,6 @@ void RNA_def_camera(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "clipsta");
RNA_def_property_float_default(prop, 0.1f);
RNA_def_property_range(prop, 1e-6f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
@@ -462,7 +455,6 @@ void RNA_def_camera(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "clipend");
RNA_def_property_float_default(prop, 1000.0f);
RNA_def_property_range(prop, 1e-6f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
@@ -524,7 +516,6 @@ void RNA_def_camera(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
prop = RNA_def_property(srna, "dof_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "YF_dofdist");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 5000.0f, 1, 2);
RNA_def_property_ui_text(prop, "DOF Distance", "Distance to the focus point for depth of field");
diff --git a/source/blender/makesrna/intern/rna_camera_api.c b/source/blender/makesrna/intern/rna_camera_api.c
index d1b25239cbe..8e181fe3c68 100644
--- a/source/blender/makesrna/intern/rna_camera_api.c
+++ b/source/blender/makesrna/intern/rna_camera_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/makesrna/intern/rna_camera_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index 53efbcb56fa..279ed3910c2 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_cloth.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -31,8 +25,6 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_math_base.h"
-
#include "RNA_define.h"
#include "rna_internal.h"
@@ -383,7 +375,7 @@ static void rna_def_cloth_solver_result(BlenderRNA *brna)
{BPH_SOLVER_NUMERICAL_ISSUE, "NUMERICAL_ISSUE", 0, "Numerical Issue", "The provided data did not satisfy the prerequisites"},
{BPH_SOLVER_NO_CONVERGENCE, "NO_CONVERGENCE", 0, "No Convergence", "Iterative procedure did not converge"},
{BPH_SOLVER_INVALID_INPUT, "INVALID_INPUT", 0, "Invalid Input", "The inputs are invalid, or the algorithm has been improperly called"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ClothSolverResult", NULL);
@@ -439,7 +431,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
static const EnumPropertyItem prop_bending_model_items[] = {
{CLOTH_BENDING_ANGULAR, "ANGULAR", 0, "Angular", "Cloth model with angular bending springs"},
{CLOTH_BENDING_LINEAR, "LINEAR", 0, "Linear", "Cloth model with linear bending springs (legacy)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ClothSettings", NULL);
@@ -449,21 +441,21 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
/* goal */
- prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR);
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_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_FACTOR);
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_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_FACTOR);
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",
@@ -482,13 +474,13 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "internal_friction", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "internal_friction", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "velocity_smooth");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Internal Friction", "");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "collider_friction", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "collider_friction", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "collider_friction");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Collider Friction", "");
@@ -500,7 +492,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Target Density", "Maximum density of hair");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "density_strength", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "density_strength", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "density_strength");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Target Density Strength", "Influence of target density on the simulation");
@@ -508,7 +500,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
/* mass */
- prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Mass", "Mass of cloth material");
RNA_def_property_update(prop, 0, "rna_cloth_update");
@@ -561,14 +553,14 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Shrink Vertex Group", "Vertex Group for shrinking cloth");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "shrink_min", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "shrink_min", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "shrink_min");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shrink_min_set", NULL);
RNA_def_property_ui_text(prop, "Shrink Factor", "Factor by which to shrink cloth");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "shrink_max", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "shrink_max", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "shrink_max");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shrink_max_set", NULL);
@@ -774,7 +766,7 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Enable Collision", "Enable collisions with other objects");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "epsilon");
RNA_def_property_range(prop, 0.001f, 1.0f);
RNA_def_property_ui_text(prop, "Minimum Distance",
@@ -814,7 +806,7 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Enable Self Collision", "Enable self collisions");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop = RNA_def_property(srna, "self_distance_min", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "self_distance_min", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "selfepsilon");
RNA_def_property_range(prop, 0.001f, 0.1f);
RNA_def_property_ui_text(prop, "Self Minimum Distance", "Minimum distance between cloth faces before collision response takes effect");
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c
index 1506d3e649a..f98bbc90a9d 100644
--- a/source/blender/makesrna/intern/rna_collection.c
+++ b/source/blender/makesrna/intern/rna_collection.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/makesrna/intern/rna_collection.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -309,15 +303,12 @@ void RNA_def_collections(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "Collection", "ID");
- /* XXX: CAN WE RENAME TO Collection? */
- RNA_def_struct_sdna(srna, "Group"); /* it is actually Collection but for 2.8 the dna is patched! */
RNA_def_struct_ui_text(srna, "Collection", "Collection of Object data-blocks");
RNA_def_struct_ui_icon(srna, ICON_GROUP);
/* this is done on save/load in readfile.c, removed if no objects are in the collection and not in a scene */
RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
prop = RNA_def_property(srna, "instance_offset", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "dupli_ofs");
RNA_def_property_ui_text(prop, "Instance Offset", "Offset from the origin to use when instancing");
RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
@@ -359,6 +350,7 @@ void RNA_def_collections(BlenderRNA *brna)
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_SELECT);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
RNA_def_property_ui_text(prop, "Disable Select", "Disable collection for viewport selection");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
@@ -366,6 +358,7 @@ void RNA_def_collections(BlenderRNA *brna)
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_VIEW);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
RNA_def_property_ui_text(prop, "Disable Viewport", "Disable collection in viewport");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
@@ -373,6 +366,7 @@ void RNA_def_collections(BlenderRNA *brna)
prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_RENDER);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
RNA_def_property_ui_text(prop, "Disable Render", "Disable collection in renders");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 780e275a46d..61c2600a021 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_color.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -414,7 +408,7 @@ static const EnumPropertyItem *rna_ColorManagedDisplaySettings_display_device_it
return items;
}
-static void rna_ColorManagedDisplaySettings_display_device_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_ColorManagedDisplaySettings_display_device_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
ID *id = ptr->id.data;
@@ -428,6 +422,11 @@ static void rna_ColorManagedDisplaySettings_display_device_update(Main *UNUSED(b
DEG_id_tag_update(id, 0);
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+
+ /* Color management can be baked into shaders, need to refresh. */
+ for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ }
}
}
@@ -673,7 +672,7 @@ static void rna_def_curvemappoint(BlenderRNA *brna)
{0, "AUTO", 0, "Auto Handle", ""},
{CUMA_HANDLE_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped Handle", ""},
{CUMA_HANDLE_VECTOR, "VECTOR", 0, "Vector Handle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "CurveMapPoint", NULL);
@@ -731,7 +730,7 @@ static void rna_def_curvemap(BlenderRNA *brna)
static const EnumPropertyItem prop_extend_items[] = {
{0, "HORIZONTAL", 0, "Horizontal", ""},
{CUMA_EXTEND_EXTRAPOLATE, "EXTRAPOLATED", 0, "Extrapolated", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "CurveMap", NULL);
@@ -766,7 +765,7 @@ static void rna_def_curvemapping(BlenderRNA *brna)
static const EnumPropertyItem tone_items[] = {
{CURVE_TONE_STANDARD, "STANDARD", 0, "Standard", ""},
{CURVE_TONE_FILMLIKE, "FILMLIKE", 0, "Film like", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "CurveMapping", NULL);
@@ -910,14 +909,14 @@ static void rna_def_color_ramp(BlenderRNA *brna)
{COLBAND_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
{COLBAND_INTERP_B_SPLINE, "B_SPLINE", 0, "B-Spline", ""},
{COLBAND_INTERP_CONSTANT, "CONSTANT", 0, "Constant", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_mode_items[] = {
{COLBAND_BLEND_RGB, "RGB", 0, "RGB", ""},
{COLBAND_BLEND_HSV, "HSV", 0, "HSV", ""},
{COLBAND_BLEND_HSL, "HSL", 0, "HSL", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_hsv_items[] = {
@@ -925,7 +924,7 @@ static void rna_def_color_ramp(BlenderRNA *brna)
{COLBAND_HUE_FAR, "FAR", 0, "Far", ""},
{COLBAND_HUE_CW, "CW", 0, "Clockwise", ""},
{COLBAND_HUE_CCW, "CCW", 0, "Counter-Clockwise", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ColorRamp", NULL);
@@ -991,7 +990,7 @@ static void rna_def_histogram(BlenderRNA *brna)
{HISTO_MODE_G, "G", 0, "G", "Green"},
{HISTO_MODE_B, "B", 0, "B", "Blue"},
{HISTO_MODE_ALPHA, "A", 0, "A", "Alpha"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Histogram", NULL);
@@ -1020,7 +1019,7 @@ static void rna_def_scopes(BlenderRNA *brna)
{SCOPES_WAVEFRM_YCC_709, "YCBCR709", ICON_COLOR, "YCbCr (ITU 709)", ""},
{SCOPES_WAVEFRM_YCC_JPEG, "YCBCRJPG", ICON_COLOR, "YCbCr (Jpeg)", ""},
{SCOPES_WAVEFRM_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Scopes", NULL);
@@ -1067,22 +1066,22 @@ static void rna_def_colormanage(BlenderRNA *brna)
static const EnumPropertyItem display_device_items[] = {
{0, "DEFAULT", 0, "Default", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem look_items[] = {
{0, "NONE", 0, "None", "Do not modify image in an artistic manner"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem view_transform_items[] = {
{0, "NONE", 0, "None", "Do not perform any color transform on display, use old non-color managed technique for display"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem color_space_items[] = {
{0, "NONE", 0, "None", "Do not perform any color transform on load, treat colors as in scene linear space already"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* ** Display Settings ** */
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 4116dd5753f..c08a1e0128c 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,15 @@
* 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): Blender Foundation (2008), Joshua Leung, Roland Hess
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_constraint.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
#include "BLI_math.h"
-#include "BLI_listbase.h"
#include "MEM_guardedalloc.h"
@@ -111,7 +104,7 @@ const EnumPropertyItem rna_enum_constraint_type_items[] = {
"Restrict movements to surface of target mesh"},
{CONSTRAINT_TYPE_ARMATURE, "ARMATURE", ICON_CONSTRAINT, "Armature",
"Apply weight-blended transformation from multiple bones like the Armature modifier"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem target_space_pchan_items[] = {
@@ -127,7 +120,7 @@ static const EnumPropertyItem target_space_pchan_items[] = {
{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}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem owner_space_pchan_items[] = {
@@ -140,7 +133,7 @@ static const EnumPropertyItem owner_space_pchan_items[] = {
"with the parent transformation added"},
{CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
"The constraint is applied relative to the local coordinate system of the object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem track_axis_items[] = {
@@ -150,7 +143,7 @@ static const EnumPropertyItem track_axis_items[] = {
{TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
{TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
{TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -160,7 +153,7 @@ static const EnumPropertyItem space_object_items[] = {
"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}
+ {0, NULL, 0, NULL, NULL},
};
#include "DNA_cachefile_types.h"
@@ -639,7 +632,7 @@ static const EnumPropertyItem constraint_distance_items[] = {
{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}
+ {0, NULL, 0, NULL, NULL},
};
@@ -723,7 +716,7 @@ static void rna_def_constrainttarget_bone(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Sub-Target", "Target armature bone");
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "weight");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Blend Weight", "Blending weight of this bone");
@@ -1042,7 +1035,7 @@ static void rna_def_constraint_track_to(BlenderRNA *brna)
{TRACK_X, "UP_X", 0, "X", ""},
{TRACK_Y, "UP_Y", 0, "Y", ""},
{TRACK_Z, "UP_Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "TrackToConstraint", "Constraint");
@@ -1215,7 +1208,7 @@ static void rna_def_constraint_same_volume(BlenderRNA *brna)
{SAMEVOL_X, "SAMEVOL_X", 0, "X", ""},
{SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""},
{SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
@@ -1262,7 +1255,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna)
{TRACK_nX, "FLOOR_NEGATIVE_X", 0, "-X", ""},
{TRACK_nY, "FLOOR_NEGATIVE_Y", 0, "-Y", ""},
{TRACK_nZ, "FLOOR_NEGATIVE_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FloorConstraint", "Constraint");
@@ -1308,7 +1301,7 @@ static void rna_def_constraint_action(BlenderRNA *brna)
{10, "SCALE_X", 0, "X Scale", ""},
{11, "SCALE_Y", 0, "Y Scale", ""},
{12, "SCALE_Z", 0, "Z Scale", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ActionConstraint", "Constraint");
@@ -1375,7 +1368,7 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna)
{TRACK_X, "LOCK_X", 0, "X", ""},
{TRACK_Y, "LOCK_Y", 0, "Y", ""},
{TRACK_Z, "LOCK_Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
@@ -1413,14 +1406,14 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
{TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
{TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
{TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem pathup_items[] = {
{TRACK_X, "UP_X", 0, "X", ""},
{TRACK_Y, "UP_Y", 0, "Y", ""},
{TRACK_Z, "UP_Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
@@ -1486,13 +1479,13 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna)
{VOLUME_X, "VOLUME_X", 0, "X", ""},
{VOLUME_Z, "VOLUME_Z", 0, "Z", ""},
{NO_VOLUME, "NO_VOLUME", 0, "None", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem plane_items[] = {
{PLANE_X, "PLANE_X", 0, "X", "Keep X Axis"},
{PLANE_Z, "PLANE_Z", 0, "Z", "Keep Z Axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "StretchToConstraint", "Constraint");
@@ -1564,7 +1557,7 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna)
{CLAMPTO_X, "CLAMPTO_X", 0, "X", ""},
{CLAMPTO_Y, "CLAMPTO_Y", 0, "Y", ""},
{CLAMPTO_Z, "CLAMPTO_Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ClampToConstraint", "Constraint");
@@ -1601,7 +1594,7 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
{TRANS_LOCATION, "LOCATION", 0, "Loc", ""},
{TRANS_ROTATION, "ROTATION", 0, "Rot", ""},
{TRANS_SCALE, "SCALE", 0, "Scale", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "TransformConstraint", "Constraint");
@@ -2140,14 +2133,14 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
{MOD_SHRINKWRAP_TARGET_PROJECT, "TARGET_PROJECT", 0, "Target Normal Project",
"Shrink the location to the nearest target surface "
"along the interpolated vertex normals of the target"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem shrink_face_cull_items[] = {
{0, "OFF", 0, "Off", "No culling"},
{CON_SHRINKWRAP_PROJECT_CULL_FRONTFACE, "FRONT", 0, "Front", "No projection when in front of the face"},
{CON_SHRINKWRAP_PROJECT_CULL_BACKFACE, "BACK", 0, "Back", "No projection when behind the face"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
@@ -2266,7 +2259,7 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna)
"Scale of the X and Z axes is the inverse of the Y-Scale"},
{CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC, "VOLUME_PRESERVE", 0, "Volume Preservation",
"Scale of the X and Z axes are adjusted to preserve the volume of the bones"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
@@ -2383,7 +2376,7 @@ static void rna_def_constraint_pivot(BlenderRNA *brna)
{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"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "PivotConstraint", "Constraint");
@@ -2413,7 +2406,7 @@ static void rna_def_constraint_pivot(BlenderRNA *brna)
"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);
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
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 "
@@ -2437,7 +2430,7 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna)
{FOLLOWTRACK_FRAME_STRETCH, "STRETCH", 0, "Stretch", ""},
{FOLLOWTRACK_FRAME_FIT, "FIT", 0, "Fit", ""},
{FOLLOWTRACK_FRAME_CROP, "CROP", 0, "Crop", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c
index 4b4ae24bafd..d1fc18e17ab 100644
--- a/source/blender/makesrna/intern/rna_context.c
+++ b/source/blender/makesrna/intern/rna_context.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2009).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_context.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -57,7 +51,7 @@ const EnumPropertyItem rna_enum_context_mode_items[] = {
{CTX_MODE_EDIT_GPENCIL, "EDIT_GPENCIL", 0, "Grease Pencil Edit", "" },
{CTX_MODE_SCULPT_GPENCIL, "SCULPT_GPENCIL", 0, "Grease Pencil Sculpt", "" },
{CTX_MODE_WEIGHT_GPENCIL, "WEIGHT_GPENCIL", 0, "Grease Pencil Weight Paint", "" },
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index b92d156b674..ae3b8304d7b 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Juho Veps�l�inen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_curve.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -52,7 +46,7 @@ static const EnumPropertyItem beztriple_handle_type_items[] = {
{HD_VECT, "VECTOR", 0, "Vector", ""},
{HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
{HD_AUTO, "AUTO", 0, "Auto", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -62,7 +56,7 @@ const EnumPropertyItem rna_enum_keyframe_handle_type_items[] = {
{HD_VECT, "VECTOR", ICON_HANDLETYPE_VECTOR_VEC, "Vector", "Automatic handles that create straight lines"},
{HD_AUTO, "AUTO", ICON_HANDLETYPE_AUTO_VEC, "Automatic", "Automatic handles that create smooth curves"},
{HD_AUTO_ANIM, "AUTO_CLAMPED", ICON_HANDLETYPE_AUTO_CLAMP_VEC, "Auto Clamped", "Automatic handles that create smooth curves which only change direction at keyframes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[] = {
@@ -87,7 +81,7 @@ const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[] = {
{BEZT_IPO_BOUNCE, "BOUNCE", ICON_IPO_BOUNCE, "Bounce", "Exponentially decaying parabolic bounce, like when objects collide"},
{BEZT_IPO_ELASTIC, "ELASTIC", ICON_IPO_ELASTIC, "Elastic", "Exponentially decaying sine wave, like an elastic band"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
@@ -97,7 +91,7 @@ static const EnumPropertyItem curve_type_items[] = {
{CU_BSPLINE, "BSPLINE", 0, "BSpline", ""},
{CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
{CU_NURBS, "NURBS", 0, "Ease", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -106,7 +100,7 @@ static const EnumPropertyItem curve3d_fill_mode_items[] = {
{CU_BACK, "BACK", 0, "Back", ""},
{CU_FRONT, "FRONT", 0, "Front", ""},
{CU_FRONT | CU_BACK, "HALF", 0, "Half", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -115,7 +109,7 @@ static const EnumPropertyItem curve2d_fill_mode_items[] = {
{CU_BACK, "BACK", 0, "Back", ""},
{CU_FRONT, "FRONT", 0, "Front", ""},
{CU_FRONT | CU_BACK, "BOTH", 0, "Both", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -789,7 +783,6 @@ static void rna_def_bpoint(BlenderRNA *brna)
/* Number values */
prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "alfa");
RNA_def_property_range(prop, -tilt_limit, tilt_limit);
RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3);
RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
@@ -877,7 +870,6 @@ static void rna_def_beztriple(BlenderRNA *brna)
/* Number values */
prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "alfa");
RNA_def_property_range(prop, -tilt_limit, tilt_limit);
RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3);
RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
@@ -903,7 +895,7 @@ static void rna_def_path(BlenderRNA *UNUSED(brna), StructRNA *srna)
PropertyRNA *prop;
/* number values */
- prop = RNA_def_property(srna, "path_duration", PROP_INT, PROP_NONE);
+ prop = RNA_def_property(srna, "path_duration", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "pathlen");
RNA_def_property_range(prop, 1, MAXFRAME);
RNA_def_property_ui_text(prop, "Path Length",
@@ -962,7 +954,7 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna)
{CU_ALIGN_X_RIGHT, "RIGHT", ICON_ALIGN_RIGHT, "Right", "Align text to the right"},
{CU_ALIGN_X_JUSTIFY, "JUSTIFY", ICON_ALIGN_JUSTIFY, "Justify", "Align to the left and the right"},
{CU_ALIGN_X_FLUSH, "FLUSH", ICON_ALIGN_FLUSH, "Flush", "Align to the left and the right, with equal character spacing"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_align_y_items[] = {
@@ -972,14 +964,14 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna)
{CU_ALIGN_Y_BOTTOM, "BOTTOM", ICON_ALIGN_BOTTOM, "Bottom", "Align text to the bottom"},
{CU_ALIGN_Y_BOTTOM_BASELINE, "BOTTOM_BASELINE", ICON_ALIGN_BOTTOM, "Bottom Base-Line",
"Align text to the bottom but use the base-line of the text"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_overflow_items[] = {
{CU_OVERFLOW_NONE, "NONE", 0, "Overflow", "Let the text overflow outside the text boxes"},
{CU_OVERFLOW_SCALE, "SCALE", 0, "Scale to Fit", "Scale down the text to fit inside the text boxes"},
{CU_OVERFLOW_TRUNCATE, "TRUNCATE", 0, "Truncate", "Truncate the text that would go outside the text boxes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Enums */
@@ -1041,14 +1033,14 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna)
RNA_def_property_ui_text(prop, "Shear", "Italic angle of the characters");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "xof");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
RNA_def_property_ui_text(prop, "X Offset", "Horizontal offset from the object origin");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "yof");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
@@ -1151,28 +1143,28 @@ static void rna_def_textbox(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Text Box", "Text bounding box for layout");
/* number values */
- prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "x");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
RNA_def_property_ui_text(prop, "Textbox X Offset", "");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "y");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
RNA_def_property_ui_text(prop, "Textbox Y Offset", "");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "w");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 50.0f, 10, 3);
RNA_def_property_ui_text(prop, "Textbox Width", "");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "h");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 50.0f, 10, 3);
@@ -1212,7 +1204,7 @@ static void rna_def_charinfo(BlenderRNA *brna)
/* probably there is no reason to expose this */
#if 0
- prop = RNA_def_property(srna, "wrap", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_WRAP);
RNA_def_property_ui_text(prop, "Wrap", "");
RNA_def_property_update(prop, 0, "rna_Curve_update_data"); */
@@ -1364,21 +1356,21 @@ static void rna_def_curve(BlenderRNA *brna)
{CU_TWIST_Z_UP, "Z_UP", 0, "Z-Up", "Use Z-Up axis to calculate the curve twist at each point"},
{CU_TWIST_MINIMUM, "MINIMUM", 0, "Minimum", "Use the least twist over the entire curve"},
{CU_TWIST_TANGENT, "TANGENT", 0, "Tangent", "Use the tangent to calculate twist"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
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"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem bevfac_mapping_items[] = {
{CU_BEVFAC_MAP_RESOLU, "RESOLUTION", 0, "Resolution", "Map the bevel factor to the number of subdivisions of a spline (U resolution)"},
{CU_BEVFAC_MAP_SEGMENT, "SEGMENTS", 0, "Segments", "Map the bevel factor to the length of a segment and to the number of subdivisions of a segment"},
{CU_BEVFAC_MAP_SPLINE, "SPLINE", 0, "Spline", "Map the bevel factor to the length of a spline"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Curve", "ID");
@@ -1465,7 +1457,7 @@ static void rna_def_curve(BlenderRNA *brna)
"Surface resolution in V direction used while rendering (zero uses preview resolution)");
- prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_TIME);
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 "
@@ -1621,7 +1613,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
{KEY_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
{KEY_BSPLINE, "BSPLINE", 0, "BSpline", ""},
{KEY_CU_EASE, "EASE", 0, "Ease", ""}, /* todo, define somewhere, not one of BEZT_IPO_* */
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c
index 4e870d64f1c..fc2b75ceda8 100644
--- a/source/blender/makesrna/intern/rna_curve_api.c
+++ b/source/blender/makesrna/intern/rna_curve_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_curve_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index aa9e1737568..e51fa50ddff 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_define.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -50,11 +44,14 @@
#include "rna_internal.h"
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"rna.define"};
#ifdef DEBUG
# define ASSERT_SOFT_HARD_LIMITS \
if (softmin < hardmin || softmax > hardmax) { \
- fprintf(stderr, "Error with soft/hard limits: %s.%s\n", CONTAINER_RNA_ID(cont), identifier); \
+ CLOG_ERROR(&LOG, "error with soft/hard limits: %s.%s", CONTAINER_RNA_ID(cont), identifier); \
BLI_assert(!"invalid soft/hard limits"); \
} (void)0
#else
@@ -65,6 +62,12 @@
BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1, 1};
+#ifndef RNA_RUNTIME
+static struct {
+ GHash *struct_map_static_from_alias;
+} g_version_data;
+#endif
+
/* Duplicated code since we can't link in blenkernel or blenlib */
/* pedantic check for final '.', note '...' are allowed though. */
@@ -73,8 +76,8 @@ BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1, 1};
if (description && (description)[0]) { \
int i = strlen(description); \
if (i > 3 && (description)[i - 1] == '.' && (description)[i - 3] != '.') { \
- fprintf(stderr, "%s: '%s' description from '%s' '%s' ends with a '.' !\n", \
- __func__, description, id1 ? id1 : "", id2 ? id2 : ""); \
+ CLOG_WARN(&LOG, "'%s' description from '%s' '%s' ends with a '.' !", \
+ description, id1 ? id1 : "", id2 ? id2 : ""); \
} \
} (void)0
@@ -169,13 +172,27 @@ static void rna_brna_structs_remove_and_free(BlenderRNA *brna, StructRNA *srna)
}
#endif
+
+static int DNA_struct_find_nr_wrapper(const struct SDNA *sdna, const char *struct_name)
+{
+ struct_name = DNA_struct_rename_legacy_hack_static_from_alias(struct_name);
+#ifdef RNA_RUNTIME
+ /* We may support this at some point but for now we don't. */
+ BLI_assert(0);
+#else
+ struct_name = BLI_ghash_lookup_default(
+ g_version_data.struct_map_static_from_alias, struct_name, (void *)struct_name);
+#endif
+ return DNA_struct_find_nr(sdna, struct_name);
+}
+
StructDefRNA *rna_find_struct_def(StructRNA *srna)
{
StructDefRNA *dsrna;
if (!DefRNA.preprocess) {
/* we should never get here */
- fprintf(stderr, "%s: only at preprocess time.\n", __func__);
+ CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
}
@@ -194,7 +211,7 @@ PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop)
if (!DefRNA.preprocess) {
/* we should never get here */
- fprintf(stderr, "%s: only at preprocess time.\n", __func__);
+ CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
}
@@ -222,7 +239,7 @@ static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop)
if (!DefRNA.preprocess) {
/* we should never get here */
- fprintf(stderr, "%s: only at preprocess time.\n", __func__);
+ CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
}
@@ -245,7 +262,7 @@ FunctionDefRNA *rna_find_function_def(FunctionRNA *func)
if (!DefRNA.preprocess) {
/* we should never get here */
- fprintf(stderr, "%s: only at preprocess time.\n", __func__);
+ CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
}
@@ -274,7 +291,7 @@ PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm)
if (!DefRNA.preprocess) {
/* we should never get here */
- fprintf(stderr, "%s: only at preprocess time.\n", __func__);
+ CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
}
@@ -308,7 +325,7 @@ static ContainerDefRNA *rna_find_container_def(ContainerRNA *cont)
if (!DefRNA.preprocess) {
/* we should never get here */
- fprintf(stderr, "%s: only at preprocess time.\n", __func__);
+ CLOG_ERROR(&LOG, "only at preprocess time.");
return NULL;
}
@@ -361,7 +378,12 @@ static int rna_find_sdna_member(SDNA *sdna, const char *structname, const char *
const short *sp;
int a, b, structnr, totmember, cmp;
- structnr = DNA_struct_find_nr(sdna, structname);
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return 0;
+ }
+ structnr = DNA_struct_find_nr_wrapper(sdna, structname);
+
if (structnr == -1)
return 0;
@@ -370,12 +392,11 @@ static int rna_find_sdna_member(SDNA *sdna, const char *structname, const char *
sp += 2;
for (a = 0; a < totmember; a++, sp += 2) {
- dnaname = sdna->names[sp[1]];
-
+ dnaname = sdna->alias.names[sp[1]];
cmp = rna_member_cmp(dnaname, membername);
if (cmp == 1) {
- smember->type = sdna->types[sp[0]];
+ smember->type = sdna->alias.types[sp[0]];
smember->name = dnaname;
if (strstr(membername, "["))
@@ -396,7 +417,7 @@ static int rna_find_sdna_member(SDNA *sdna, const char *structname, const char *
smember->arraylength = 0;
membername = strstr(membername, ".") + strlen(".");
- rna_find_sdna_member(sdna, sdna->types[sp[0]], membername, smember);
+ rna_find_sdna_member(sdna, sdna->alias.types[sp[0]], membername, smember);
return 1;
}
@@ -407,7 +428,7 @@ static int rna_find_sdna_member(SDNA *sdna, const char *structname, const char *
smember->arraylength = 0;
membername = strstr(membername, "->") + strlen("->");
- rna_find_sdna_member(sdna, sdna->types[sp[0]], membername, smember);
+ rna_find_sdna_member(sdna, sdna->alias.types[sp[0]], membername, smember);
return 1;
}
@@ -429,7 +450,7 @@ static int rna_validate_identifier(const char *identifier, char *error, bool pro
"class", "continue", "def", "del", "elif", "else", "except",
"finally", "for", "from", "global", "if", "import", "in",
"is", "lambda", "nonlocal", "not", "or", "pass", "raise",
- "return", "try", "while", "with", "yield", NULL
+ "return", "try", "while", "with", "yield", NULL,
};
@@ -472,7 +493,7 @@ static int rna_validate_identifier(const char *identifier, char *error, bool pro
static const char *kwlist_prop[] = {
/* not keywords but reserved all the same because py uses */
"keys", "values", "items", "get",
- NULL
+ NULL,
};
for (a = 0; kwlist_prop[a]; a++) {
@@ -497,7 +518,7 @@ void RNA_identifier_sanitize(char *identifier, int property)
"class", "continue", "def", "del", "elif", "else", "except",
"finally", "for", "from", "global", "if", "import", "in",
"is", "lambda", "nonlocal", "not", "or", "pass", "raise",
- "return", "try", "while", "with", "yield", NULL
+ "return", "try", "while", "with", "yield", NULL,
};
@@ -543,7 +564,7 @@ void RNA_identifier_sanitize(char *identifier, int property)
static const char *kwlist_prop[] = {
/* not keywords but reserved all the same because py uses */
"keys", "values", "items", "get",
- NULL
+ NULL,
};
for (a = 0; kwlist_prop[a]; a++) {
@@ -575,10 +596,20 @@ BlenderRNA *RNA_create(void)
DefRNA.sdna = DNA_sdna_from_data(DNAstr, DNAlen, false, false, &error_message);
if (DefRNA.sdna == NULL) {
- fprintf(stderr, "Error decoding SDNA: %s\n", error_message);
+ CLOG_ERROR(&LOG, "Failed to decode SDNA: %s.", error_message);
DefRNA.error = 1;
}
+ /* We need both alias and static (on-disk) DNA names. */
+ DNA_sdna_alias_data_ensure(DefRNA.sdna);
+
+#ifndef RNA_RUNTIME
+ DNA_alias_maps(
+ DNA_RENAME_STATIC_FROM_ALIAS,
+ &g_version_data.struct_map_static_from_alias,
+ NULL);
+#endif
+
return brna;
}
@@ -644,7 +675,7 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
#if 0
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);
+ fprintf(stderr, "%s '%s' freed while holding a python reference.", srna->identifier);
}
}
#endif
@@ -712,6 +743,12 @@ void RNA_free(BlenderRNA *brna)
RNA_struct_free(brna, srna);
}
}
+
+#ifndef RNA_RUNTIME
+ BLI_ghash_free(g_version_data.struct_map_static_from_alias, NULL, NULL);
+ g_version_data.struct_map_static_from_alias = NULL;
+#endif
+
}
static size_t rna_property_type_sizeof(PropertyType type)
@@ -750,7 +787,7 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN
char error[512];
if (rna_validate_identifier(identifier, error, false) == 0) {
- fprintf(stderr, "%s: struct identifier \"%s\" error - %s\n", __func__, identifier, error);
+ CLOG_ERROR(&LOG, "struct identifier \"%s\" error - %s", identifier, error);
DefRNA.error = 1;
}
}
@@ -870,7 +907,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
/* Inline RNA_struct_find(...) because it wont link from here. */
srnafrom = BLI_ghash_lookup(brna->structs_map, from);
if (!srnafrom) {
- fprintf(stderr, "%s: struct %s not found to define %s.\n", __func__, from, identifier);
+ CLOG_ERROR(&LOG, "struct %s not found to define %s.", from, identifier);
DefRNA.error = 1;
}
}
@@ -883,7 +920,7 @@ void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
StructDefRNA *ds;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -892,9 +929,9 @@ void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
/* there are far too many structs which initialize without valid DNA struct names,
* this can't be checked without adding an option to disable (tested this and it means changes all over - Campbell) */
#if 0
- if (DNA_struct_find_nr(DefRNA.sdna, structname) == -1) {
+ if (DNA_struct_find_nr_wrapper(DefRNA.sdna, structname) == -1) {
if (!DefRNA.silent) {
- fprintf(stderr, "%s: %s not found.\n", __func__, structname);
+ CLOG_ERROR(&LOG, "%s not found.", structname);
DefRNA.error = 1;
}
return;
@@ -909,20 +946,20 @@ void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const cha
StructDefRNA *ds;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
ds = rna_find_def_struct(srna);
if (!ds->dnaname) {
- fprintf(stderr, "%s: %s base struct must know DNA already.\n", __func__, structname);
+ CLOG_ERROR(&LOG, "%s base struct must know DNA already.", structname);
return;
}
- if (DNA_struct_find_nr(DefRNA.sdna, structname) == -1) {
+ if (DNA_struct_find_nr_wrapper(DefRNA.sdna, structname) == -1) {
if (!DefRNA.silent) {
- fprintf(stderr, "%s: %s not found.\n", __func__, structname);
+ CLOG_ERROR(&LOG, "%s not found.", structname);
DefRNA.error = 1;
}
return;
@@ -935,7 +972,7 @@ void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const cha
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
{
if (prop->type != PROP_STRING) {
- fprintf(stderr, "%s: \"%s.%s\", must be a string property.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", must be a string property.", srna->identifier, prop->identifier);
DefRNA.error = 1;
}
else
@@ -949,7 +986,7 @@ void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *struct
/* find struct to derive from */
srnafrom = BLI_ghash_lookup(brna->structs_map, structname);
if (!srnafrom) {
- fprintf(stderr, "%s: struct %s not found for %s.\n", __func__, structname, srna->identifier);
+ CLOG_ERROR(&LOG, "struct %s not found for %s.", structname, srna->identifier);
DefRNA.error = 1;
}
@@ -974,7 +1011,7 @@ void RNA_def_struct_property_tags(StructRNA *srna, const EnumPropertyItem *prop_
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
{
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -984,7 +1021,7 @@ void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
{
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -994,7 +1031,7 @@ void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance)
{
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -1006,7 +1043,7 @@ void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
{
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -1016,7 +1053,7 @@ void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_struct_identifier(BlenderRNA *brna, StructRNA *srna, const char *identifier)
{
if (DefRNA.preprocess) {
- fprintf(stderr, "%s: only at runtime.\n", __func__);
+ CLOG_ERROR(&LOG, "only at runtime.");
return;
}
@@ -1041,7 +1078,7 @@ void RNA_def_struct_identifier(BlenderRNA *brna, StructRNA *srna, const char *id
void RNA_def_struct_identifier_no_struct_map(StructRNA *srna, const char *identifier)
{
if (DefRNA.preprocess) {
- fprintf(stderr, "%s: only at runtime.\n", __func__);
+ CLOG_ERROR(&LOG, "only at runtime.");
return;
}
@@ -1080,7 +1117,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
char error[512];
if (rna_validate_identifier(identifier, error, true) == 0) {
- fprintf(stderr, "%s: property identifier \"%s.%s\" - %s\n", __func__,
+ CLOG_ERROR(&LOG, "property identifier \"%s.%s\" - %s",
CONTAINER_RNA_ID(cont), identifier, error);
DefRNA.error = 1;
}
@@ -1089,7 +1126,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
/* XXX - toto, detect supertype collisions */
if (rna_findlink(&dcont->properties, identifier)) {
- fprintf(stderr, "%s: duplicate identifier \"%s.%s\"\n", __func__, CONTAINER_RNA_ID(cont), identifier);
+ CLOG_ERROR(&LOG, "duplicate identifier \"%s.%s\"", CONTAINER_RNA_ID(cont), identifier);
DefRNA.error = 1;
}
@@ -1100,7 +1137,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
#ifdef DEBUG
char error[512];
if (rna_validate_identifier(identifier, error, true) == 0) {
- fprintf(stderr, "%s: runtime property identifier \"%s.%s\" - %s\n", __func__,
+ CLOG_ERROR(&LOG, "runtime property identifier \"%s.%s\" - %s",
CONTAINER_RNA_ID(cont), identifier, error);
DefRNA.error = 1;
}
@@ -1113,7 +1150,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
case PROP_BOOLEAN:
if (DefRNA.preprocess) {
if ((subtype & ~(PROP_LAYER_MEMBER)) != PROP_NONE) {
- fprintf(stderr, "%s: subtype does not apply to 'PROP_BOOLEAN' \"%s.%s\"\n", __func__,
+ CLOG_ERROR(&LOG, "subtype does not apply to 'PROP_BOOLEAN' \"%s.%s\"",
CONTAINER_RNA_ID(cont), identifier);
DefRNA.error = 1;
}
@@ -1125,7 +1162,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
#ifndef RNA_RUNTIME
if (subtype == PROP_DISTANCE) {
- fprintf(stderr, "%s: subtype does not apply to 'PROP_INT' \"%s.%s\"\n", __func__,
+ CLOG_ERROR(&LOG, "subtype does not apply to 'PROP_INT' \"%s.%s\"",
CONTAINER_RNA_ID(cont), identifier);
DefRNA.error = 1;
}
@@ -1177,7 +1214,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
case PROP_COLLECTION:
break;
default:
- fprintf(stderr, "%s: \"%s.%s\", invalid property type.\n", __func__, CONTAINER_RNA_ID(cont), identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", invalid property type.", CONTAINER_RNA_ID(cont), identifier);
DefRNA.error = 1;
return NULL;
}
@@ -1338,22 +1375,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__,
+ CLOG_ERROR(&LOG, "\"%s.%s\", array length must be zero of greater.",
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__,
+ CLOG_ERROR(&LOG, "\"%s.%s\", array length must be smaller than %d.",
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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.",
+ srna->identifier, prop->identifier, prop->arraydimension);
DefRNA.error = 1;
return;
}
@@ -1367,13 +1404,18 @@ 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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", only boolean/int/float can be array.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
}
+/* common args for defaults. */
+const float rna_default_quaternion[4] = {1, 0, 0, 0};
+const float rna_default_axis_angle[4] = {0, 0, 1, 0};
+const float rna_default_scale_3d[3] = {1, 1, 1};
+
/* common args for length */
const int rna_matrix_dimsize_3x3[] = {3, 3};
const int rna_matrix_dimsize_4x4[] = {4, 4};
@@ -1385,8 +1427,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", array dimension must be between 1 and %d.",
+ srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION);
DefRNA.error = 1;
return;
}
@@ -1397,8 +1439,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", only boolean/int/float can be array.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1453,20 +1495,20 @@ void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double
#ifndef NDEBUG
if (min > max) {
- fprintf(stderr, "%s: \"%s.%s\", min > max.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", min > max.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
if (step < 0 || step > 100) {
- fprintf(stderr, "%s: \"%s.%s\", step outside range.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", step outside range.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
if (precision < -1 || precision > UI_PRECISION_FLOAT_MAX) {
- fprintf(stderr, "%s: \"%s.%s\", precision outside range.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", precision outside range.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
#endif
@@ -1490,8 +1532,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for ui range.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1503,8 +1545,8 @@ void RNA_def_property_range(PropertyRNA *prop, double min, double max)
#ifdef DEBUG
if (min > max) {
- fprintf(stderr, "%s: \"%s.%s\", min > max.\n",
- __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", min > max.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
#endif
@@ -1529,7 +1571,7 @@ void RNA_def_property_range(PropertyRNA *prop, double min, double max)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", invalid type for range.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for range.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1540,7 +1582,7 @@ void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s \"%s.%s\": only during preprocessing.\n", __func__, srna->identifier, prop->identifier);
+ fprintf(stderr, "\"%s.%s\": only during preprocessing.", srna->identifier, prop->identifier);
return;
}
@@ -1558,8 +1600,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for struct type.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1570,7 +1612,7 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type)
StructRNA *srna = DefRNA.laststruct;
if (DefRNA.preprocess) {
- fprintf(stderr, "%s: only at runtime.\n", __func__);
+ CLOG_ERROR(&LOG, "only at runtime.");
return;
}
@@ -1592,8 +1634,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for struct type.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1629,8 +1671,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for struct type.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1648,7 +1690,7 @@ void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1667,7 +1709,7 @@ void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1685,7 +1727,7 @@ void RNA_def_property_boolean_array_default(PropertyRNA *prop, const bool *array
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1703,7 +1745,7 @@ void RNA_def_property_int_default(PropertyRNA *prop, int value)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1721,7 +1763,7 @@ void RNA_def_property_int_array_default(PropertyRNA *prop, const int *array)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1739,7 +1781,7 @@ void RNA_def_property_float_default(PropertyRNA *prop, float value)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1757,7 +1799,7 @@ void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1773,13 +1815,13 @@ void RNA_def_property_string_default(PropertyRNA *prop, const char *value)
StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
if (value == NULL) {
- fprintf(stderr, "%s: \"%s.%s\", NULL string passed (dont call in this case).\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", NULL string passed (dont call in this case).", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
if (!value[0]) {
- fprintf(stderr, "%s: \"%s.%s\", empty string passed (dont call in this case).\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", empty string passed (dont call in this case).", srna->identifier, prop->identifier);
DefRNA.error = 1;
// BLI_assert(0);
break;
@@ -1789,7 +1831,7 @@ void RNA_def_property_string_default(PropertyRNA *prop, const char *value)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1816,8 +1858,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", default includes unused bits (%d).",
+ srna->identifier, prop->identifier, eprop->defaultvalue & ~totflag);
DefRNA.error = 1;
}
}
@@ -1832,8 +1874,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", default is not in items.",
+ srna->identifier, prop->identifier);
DefRNA.error = 1;
}
}
@@ -1842,7 +1884,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value)
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not enum.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -1881,8 +1923,8 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, const char *stru
return dp;
}
else {
- fprintf(stderr, "%s: \"%s.%s\" (identifier \"%s\") not found. Struct must be in DNA.\n",
- __func__, structname, propname, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\" (identifier \"%s\") not found. Struct must be in DNA.",
+ structname, propname, prop->identifier);
DefRNA.error = 1;
return NULL;
}
@@ -1915,12 +1957,12 @@ void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, co
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
if (prop->type != PROP_BOOLEAN) {
- fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
DefRNA.error = 1;
return;
}
@@ -1930,8 +1972,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));
+ CLOG_ERROR(&LOG, "%s.%s is a '%s' but wrapped as type '%s'.",
+ srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
DefRNA.error = 1;
return;
}
@@ -1961,12 +2003,12 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
if (prop->type != PROP_INT) {
- fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
DefRNA.error = 1;
return;
}
@@ -1976,8 +2018,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));
+ CLOG_ERROR(&LOG, "%s.%s is a '%s' but wrapped as type '%s'.",
+ srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
DefRNA.error = 1;
return;
}
@@ -2012,12 +2054,12 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, cons
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
if (prop->type != PROP_FLOAT) {
- fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
DefRNA.error = 1;
return;
}
@@ -2027,8 +2069,8 @@ 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,
+ CLOG_ERROR(&LOG, "%s.%s is a '%s' but wrapped as type '%s'.",
+ srna->identifier, prop->identifier, dp->dnatype,
RNA_property_typename(prop->type));
DefRNA.error = 1;
return;
@@ -2051,12 +2093,12 @@ void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
if (prop->type != PROP_ENUM) {
- fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not enum.", srna->identifier, prop->identifier);
DefRNA.error = 1;
return;
}
@@ -2067,8 +2109,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", array not supported for enum type.",
+ structname, propname);
DefRNA.error = 1;
}
}
@@ -2094,12 +2136,12 @@ void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, con
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
if (prop->type != PROP_STRING) {
- fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
DefRNA.error = 1;
return;
}
@@ -2119,12 +2161,12 @@ void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, co
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
if (prop->type != PROP_POINTER) {
- fprintf(stderr, "%s: \"%s.%s\", type is not pointer.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not pointer.", srna->identifier, prop->identifier);
DefRNA.error = 1;
return;
}
@@ -2135,8 +2177,8 @@ 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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", array not supported for pointer type.",
+ structname, propname);
DefRNA.error = 1;
}
}
@@ -2151,12 +2193,12 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
if (prop->type != PROP_COLLECTION) {
- fprintf(stderr, "%s: \"%s.%s\", type is not collection.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not collection.", srna->identifier, prop->identifier);
DefRNA.error = 1;
return;
}
@@ -2167,8 +2209,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", array of collections not supported.",
+ structname, propname);
DefRNA.error = 1;
}
}
@@ -2209,7 +2251,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
}
else {
if (!DefRNA.silent) {
- fprintf(stderr, "%s: \"%s.%s\" not found.\n", __func__, structname, lengthpropname);
+ CLOG_ERROR(&LOG, "\"%s.%s\" not found.", structname, lengthpropname);
DefRNA.error = 1;
}
}
@@ -2226,7 +2268,7 @@ void RNA_def_property_translation_context(PropertyRNA *prop, const char *context
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
{
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2236,7 +2278,7 @@ void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable)
{
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2251,7 +2293,7 @@ void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editabl
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
{
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2269,7 +2311,7 @@ void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
{
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2288,19 +2330,19 @@ void RNA_def_property_poll_runtime(PropertyRNA *prop, const void *func)
((PointerPropertyRNA *)prop)->poll = (void *)func;
}
else {
- fprintf(stderr, "%s: %s is not a Pointer Property.\n", __func__, prop->identifier);
+ CLOG_ERROR(&LOG, "%s is not a Pointer Property.", prop->identifier);
}
}
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
{
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
if (!(prop->flag & PROP_DYNAMIC)) {
- fprintf(stderr, "%s: property is a not dynamic array.\n", __func__);
+ CLOG_ERROR(&LOG, "property is a not dynamic array.");
DefRNA.error = 1;
return;
}
@@ -2313,7 +2355,7 @@ void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const ch
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2333,7 +2375,7 @@ void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const ch
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -2376,7 +2418,7 @@ void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2397,7 +2439,7 @@ void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -2442,7 +2484,7 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2463,7 +2505,7 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -2508,7 +2550,7 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2523,7 +2565,7 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not enum.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -2557,7 +2599,7 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2572,7 +2614,7 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -2601,7 +2643,7 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2617,7 +2659,7 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not pointer.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not pointer.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -2630,7 +2672,7 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con
StructRNA *srna = DefRNA.laststruct;
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only during preprocessing.\n", __func__);
+ CLOG_ERROR(&LOG, "only during preprocessing.");
return;
}
@@ -2650,7 +2692,7 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con
break;
}
default:
- fprintf(stderr, "%s: \"%s.%s\", type is not collection.\n", __func__, srna->identifier, prop->identifier);
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not collection.", srna->identifier, prop->identifier);
DefRNA.error = 1;
break;
}
@@ -2864,7 +2906,7 @@ PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, co
PropertyRNA *prop;
if (!items) {
- printf("%s: items not allowed to be NULL.\n", __func__);
+ CLOG_ERROR(&LOG, "items not allowed to be NULL.");
return NULL;
}
@@ -2884,7 +2926,7 @@ PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifie
PropertyRNA *prop;
if (!items) {
- printf("%s: items not allowed to be NULL.\n", __func__);
+ CLOG_ERROR(&LOG, "items not allowed to be NULL.");
return NULL;
}
@@ -3152,7 +3194,7 @@ static FunctionRNA *rna_def_function(StructRNA *srna, const char *identifier)
char error[512];
if (rna_validate_identifier(identifier, error, false) == 0) {
- fprintf(stderr, "%s: function identifier \"%s\" - %s\n", __func__, identifier, error);
+ CLOG_ERROR(&LOG, "function identifier \"%s\" - %s", identifier, error);
DefRNA.error = 1;
}
}
@@ -3181,14 +3223,14 @@ FunctionRNA *RNA_def_function(StructRNA *srna, const char *identifier, const cha
FunctionDefRNA *dfunc;
if (BLI_findstring_ptr(&srna->functions, identifier, offsetof(FunctionRNA, identifier))) {
- fprintf(stderr, "%s: %s.%s already defined.\n", __func__, srna->identifier, identifier);
+ CLOG_ERROR(&LOG, "%s.%s already defined.", srna->identifier, identifier);
return NULL;
}
func = rna_def_function(srna, identifier);
if (!DefRNA.preprocess) {
- fprintf(stderr, "%s: only at preprocess time.\n", __func__);
+ CLOG_ERROR(&LOG, "only at preprocess time.");
return func;
}
@@ -3205,7 +3247,7 @@ FunctionRNA *RNA_def_function_runtime(StructRNA *srna, const char *identifier, C
func = rna_def_function(srna, identifier);
if (DefRNA.preprocess) {
- fprintf(stderr, "%s: only at runtime.\n", __func__);
+ CLOG_ERROR(&LOG, "only at runtime.");
return func;
}
@@ -3219,13 +3261,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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", dynamic values are not allowed as strict returns, "
+ "use RNA_def_function_output instead.", 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);
+ CLOG_ERROR(&LOG, "\"%s.%s\", arrays are not allowed as strict returns, "
+ "use RNA_def_function_output instead.", func->identifier, ret->identifier);
return;
}
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index d03dfc65ef4..8c2148896fd 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2014).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_depsgraph.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -151,7 +145,10 @@ static void rna_DepsgraphObjectInstance_matrix_world_get(PointerRNA *ptr, float
copy_m4_m4((float(*)[4])mat, deg_iter->dupli_object_current->mat);
}
else {
- unit_m4((float(*)[4])mat);
+ /* We can return actual object's matrix here, no reason to return identity matrix
+ * when this is not actually an instance... */
+ Object *ob = (Object *)iterator->current;
+ copy_m4_m4((float(*)[4])mat, ob->obmat);
}
}
@@ -305,6 +302,7 @@ typedef struct RNA_Depsgraph_Instances_Iterator
{
BLI_Iterator iterators[2];
DEGObjectIterData deg_data[2];
+ DupliObject dupli_object_current[2];
int counter;
} RNA_Depsgraph_Instances_Iterator;
@@ -335,6 +333,13 @@ static void rna_Depsgraph_object_instances_next(CollectionPropertyIterator *iter
di_it->iterators[di_it->counter % 2].data = &di_it->deg_data[di_it->counter % 2];
DEG_iterator_objects_next(&di_it->iterators[di_it->counter % 2]);
+ /* Dupli_object_current is also temp memory generated during the iterations,
+ * it may be freed when last item has been iterated, so we have same issue as with the iterator itself:
+ * we need to keep a local copy, which memory remains valid a bit longer, for python accesses to work. */
+ if (di_it->deg_data[di_it->counter % 2].dupli_object_current != NULL) {
+ di_it->dupli_object_current[di_it->counter % 2] = *di_it->deg_data[di_it->counter % 2].dupli_object_current;
+ di_it->deg_data[di_it->counter % 2].dupli_object_current = &di_it->dupli_object_current[di_it->counter % 2];
+ }
iter->valid = di_it->iterators[di_it->counter % 2].valid;
}
@@ -564,7 +569,7 @@ static void rna_def_depsgraph(BlenderRNA *brna)
static EnumPropertyItem enum_depsgraph_mode_items[] = {
{DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Viewport non-rendered mode"},
{DAG_EVAL_RENDER, "RENDER", 0, "Render", "Render"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Depsgraph", NULL);
@@ -668,7 +673,10 @@ static void rna_def_depsgraph(BlenderRNA *brna)
"rna_Depsgraph_object_instances_end",
"rna_Depsgraph_object_instances_get",
NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Object Instances", "All object instances to display or render");
+ RNA_def_property_ui_text(prop, "Object Instances",
+ "All object instances to display or render "
+ "(WARNING: only use this as an iterator, never as a sequence, "
+ "and do not keep any references to its items)");
prop = RNA_def_property(srna, "updates", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "DepsgraphUpdate");
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index c15740305a8..d7b58896675 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,15 @@
* 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
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
#include <limits.h>
-#include "BLI_math_base.h"
#include "BKE_modifier.h"
#include "BKE_dynamicpaint.h"
@@ -48,7 +41,7 @@
const EnumPropertyItem rna_enum_prop_dynamicpaint_type_items[] = {
{MOD_DYNAMICPAINT_TYPE_CANVAS, "CANVAS", 0, "Canvas", ""},
{MOD_DYNAMICPAINT_TYPE_BRUSH, "BRUSH", 0, "Brush", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -341,20 +334,20 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
/*{MOD_DPAINT_SURFACE_F_PTEX, "PTEX", ICON_TEXTURE_SHADED, "Ptex", ""}, */
{MOD_DPAINT_SURFACE_F_VERTEX, "VERTEX", ICON_OUTLINER_DATA_MESH, "Vertex", ""},
{MOD_DPAINT_SURFACE_F_IMAGESEQ, "IMAGE", ICON_FILE_IMAGE, "Image Sequence", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Surface type - generated dynamically based on surface format */
static const EnumPropertyItem prop_dynamicpaint_surface_type[] = {
{MOD_DPAINT_SURFACE_T_PAINT, "PAINT", 0, "Paint", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Surface output preview. currently only paint has multiple outputs */
static const EnumPropertyItem prop_dynamicpaint_surface_preview[] = {
{MOD_DPAINT_SURFACE_PREV_PAINT, "PAINT", 0, "Paint", ""},
{MOD_DPAINT_SURFACE_PREV_WETMAP, "WETMAP", 0, "Wetmap", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Initial color setting */
@@ -363,7 +356,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
{MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""},
{MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""},
{MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEX_COLOR", ICON_GROUP_VCOL, "Vertex Color", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Effect type
@@ -372,7 +365,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
{1, "SPREAD", 0, "Spread", ""},
{2, "DRIP", 0, "Drip", ""},
{3, "SHRINK", 0, "Shrink", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Displacemap file format */
@@ -381,14 +374,14 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
#ifdef WITH_OPENEXR
{MOD_DPAINT_IMGFORMAT_OPENEXR, "OPENEXR", 0, "OpenEXR", ""},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Displacemap type */
static const EnumPropertyItem prop_dynamicpaint_displace_type[] = {
{MOD_DPAINT_DISP_DISPLACE, "DISPLACE", 0, "Displacement", ""},
{MOD_DPAINT_DISP_DEPTH, "DEPTH", 0, "Depth", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -445,20 +438,20 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE);
RNA_def_property_ui_text(prop, "Dissolve", "Enable to make surface changes disappear over time");
- prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
+ prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "diss_speed");
RNA_def_property_range(prop, 1.0, 10000.0);
RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, -1);
- RNA_def_property_ui_text(prop, "Dissolve Speed", "Approximately in how many frames should dissolve happen");
+ RNA_def_property_ui_text(prop, "Dissolve Time", "Approximately in how many frames should dissolve happen");
prop = RNA_def_property(srna, "use_drying", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_USE_DRYING);
RNA_def_property_ui_text(prop, "Dry", "Enable to make surface wetness dry over time");
- prop = RNA_def_property(srna, "dry_speed", PROP_INT, PROP_NONE);
+ prop = RNA_def_property(srna, "dry_speed", PROP_INT, PROP_TIME);
RNA_def_property_range(prop, 1.0, 10000.0);
RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, -1);
- RNA_def_property_ui_text(prop, "Dry Speed", "Approximately in how many frames should drying happen");
+ RNA_def_property_ui_text(prop, "Dry Time", "Approximately in how many frames should drying happen");
/*
* Simulation settings
@@ -785,14 +778,14 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
{MOD_DPAINT_COL_DIST, "DISTANCE", ICON_DRIVER_DISTANCE, "Proximity", ""},
{MOD_DPAINT_COL_VOLDIST, "VOLUME_DISTANCE", ICON_META_CUBE, "Mesh Volume + Proximity", ""},
{MOD_DPAINT_COL_VOLUME, "VOLUME", ICON_MESH_CUBE, "Mesh Volume", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_dynamicpaint_prox_falloff[] = {
{MOD_DPAINT_PRFALL_SMOOTH, "SMOOTH", ICON_SPHERECURVE, "Smooth", ""},
{MOD_DPAINT_PRFALL_CONSTANT, "CONSTANT", ICON_NOCURVE, "Constant", ""},
{MOD_DPAINT_PRFALL_RAMP, "RAMP", ICON_COLOR, "Color Ramp", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = {
@@ -800,14 +793,14 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
{MOD_DPAINT_WAVEB_DEPTH, "DEPTH", 0, "Obstacle", ""},
{MOD_DPAINT_WAVEB_FORCE, "FORCE", 0, "Force", ""},
{MOD_DPAINT_WAVEB_REFLECT, "REFLECT", 0, "Reflect Only", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_dynamicpaint_brush_ray_dir[] = {
{MOD_DPAINT_RAY_CANVAS, "CANVAS", 0, "Canvas Normal", ""},
{MOD_DPAINT_RAY_BRUSH_AVG, "BRUSH", 0, "Brush Normal", ""},
{MOD_DPAINT_RAY_ZPLUS, "Z_AXIS", 0, "Z-Axis", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "DynamicPaintBrushSettings", NULL);
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 8992d3ab411..b6cae3de386 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2009), Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_fcurve.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -33,7 +27,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_math.h"
#include "BLT_translation.h"
@@ -68,7 +61,7 @@ const EnumPropertyItem rna_enum_fmodifier_type_items[] = {
"Restrict maximum and minimum values of F-Curve"},
{FMODIFIER_TYPE_STEPPED, "STEPPED", 0, "Stepped Interpolation",
"Snap values to nearest grid-step - e.g. for a stop-motion look"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[] = {
@@ -77,7 +70,7 @@ const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[] = {
{BEZT_KEYTYPE_MOVEHOLD, "MOVING_HOLD", ICON_KEYTYPE_MOVING_HOLD_VEC, "Moving Hold", "A keyframe that is part of a moving hold"},
{BEZT_KEYTYPE_EXTREME, "EXTREME", ICON_KEYTYPE_EXTREME_VEC, "Extreme", "An 'extreme' pose, or some other purpose as needed"},
{BEZT_KEYTYPE_JITTER, "JITTER", ICON_KEYTYPE_JITTER_VEC, "Jitter", "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[] = {
@@ -89,7 +82,7 @@ const EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[] = {
{BEZT_IPO_EASE_IN, "EASE_IN", ICON_IPO_EASE_IN, "Ease In", "Only on the end closest to the next keyframe"},
{BEZT_IPO_EASE_OUT, "EASE_OUT", ICON_IPO_EASE_OUT, "Ease Out", "Only on the end closest to the first keyframe"},
{BEZT_IPO_EASE_IN_OUT, "EASE_IN_OUT", ICON_IPO_EASE_IN_OUT, "Ease In and Out", "Segment between both keyframes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -616,15 +609,13 @@ static void rna_FModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poin
FModifier *fcm = (FModifier *)ptr->data;
AnimData *adt = BKE_animdata_from_id(id);
- DEG_id_tag_update(id, (GS(id->name) == ID_OB) ? ID_RECALC_TRANSFORM : ID_RECALC_GEOMETRY);
+ DEG_id_tag_update(id, ID_RECALC_ANIMATION);
/* tag datablock for time update so that animation is recalculated,
* as FModifiers affect how animation plays...
*/
DEG_id_tag_update(id, ID_RECALC_ANIMATION);
if (adt != NULL) {
- adt->recalc |= ADT_RECALC_ANIM;
-
if (adt->action != NULL) {
/* action is separate datablock, needs separate tag */
DEG_id_tag_update(&adt->action->id, ID_RECALC_COPY_ON_WRITE);
@@ -953,6 +944,22 @@ static void rna_FModifierEnvelope_points_remove(FModifier *fmod, ReportList *rep
RNA_POINTER_INVALIDATE(point);
}
+
+static void rna_Keyframe_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ ID *id = ptr->id.data;
+ AnimData *adt = BKE_animdata_from_id(id);
+
+ DEG_id_tag_update(id, ID_RECALC_ANIMATION);
+
+ if (adt != NULL) {
+ if (adt->action != NULL) {
+ /* action is separate datablock, needs separate tag */
+ DEG_id_tag_update(&adt->action->id, ID_RECALC_COPY_ON_WRITE);
+ }
+ }
+}
+
#else
static void rna_def_fmodifier_generator(BlenderRNA *brna)
@@ -963,7 +970,7 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna)
static const EnumPropertyItem generator_mode_items[] = {
{FCM_GENERATOR_POLYNOMIAL, "POLYNOMIAL", 0, "Expanded Polynomial", ""},
{FCM_GENERATOR_POLYNOMIAL_FACTORISED, "POLYNOMIAL_FACTORISED", 0, "Factorized Polynomial", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FModifierGenerator", "FModifier");
@@ -1014,7 +1021,7 @@ static void rna_def_fmodifier_function_generator(BlenderRNA *brna)
{3, "SQRT", 0, "Square Root", ""},
{4, "LN", 0, "Natural Logarithm", ""},
{5, "SINC", 0, "Normalized Sine", "sin(x) / x"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FModifierFunctionGenerator", "FModifier");
@@ -1166,7 +1173,7 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna)
"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}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FModifierCycles", "FModifier");
@@ -1280,7 +1287,7 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna)
{FCM_NOISE_MODIF_ADD, "ADD", 0, "Add", ""},
{FCM_NOISE_MODIF_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
{FCM_NOISE_MODIF_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FModifierNoise", "FModifier");
@@ -1404,9 +1411,9 @@ static void rna_def_fmodifier(BlenderRNA *brna)
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_MUTED);
- RNA_def_property_ui_text(prop, "Muted", "F-Curve Modifier will not be evaluated");
+ RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier evaluation");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
- RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1);
+ RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1490,7 +1497,7 @@ static void rna_def_drivertarget(BlenderRNA *brna)
{DTAR_TRANSCHAN_SCALEX, "SCALE_X", 0, "X Scale", ""},
{DTAR_TRANSCHAN_SCALEY, "SCALE_Y", 0, "Y Scale", ""},
{DTAR_TRANSCHAN_SCALEZ, "SCALE_Z", 0, "Z Scale", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_local_space_items[] = {
@@ -1500,7 +1507,7 @@ static void rna_def_drivertarget(BlenderRNA *brna)
{DTAR_FLAG_LOCALSPACE | DTAR_FLAG_LOCAL_CONSTS, "LOCAL_SPACE", 0, "Local Space",
"Transforms include effects of constraints but not "
"parenting/restpose"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "DriverTarget", NULL);
@@ -1565,7 +1572,7 @@ static void rna_def_drivervar(BlenderRNA *brna)
"Final transformation value of object or bone"},
{DVAR_TYPE_ROT_DIFF, "ROTATION_DIFF", ICON_DRIVER_ROTATIONAL_DIFFERENCE, "Rotational Difference", "Use the angle between two bones"},
{DVAR_TYPE_LOC_DIFF, "LOC_DIFF", ICON_DRIVER_DISTANCE, "Distance", "Distance between two bones or objects"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -1649,7 +1656,7 @@ static void rna_def_channeldriver(BlenderRNA *brna)
{DRIVER_TYPE_PYTHON, "SCRIPTED", 0, "Scripted Expression", ""},
{DRIVER_TYPE_MIN, "MIN", 0, "Minimum Value", ""},
{DRIVER_TYPE_MAX, "MAX", 0, "Maximum Value", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Driver", NULL);
@@ -1756,13 +1763,13 @@ static void rna_def_fkeyframe(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "h1");
RNA_def_property_enum_items(prop, rna_enum_keyframe_handle_type_items);
RNA_def_property_ui_text(prop, "Left Handle Type", "Handle types");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "h2");
RNA_def_property_enum_items(prop, rna_enum_keyframe_handle_type_items);
RNA_def_property_ui_text(prop, "Right Handle Type", "Handle types");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "ipo");
@@ -1770,13 +1777,13 @@ static void rna_def_fkeyframe(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Interpolation",
"Interpolation method to use for segment of the F-Curve from "
"this Keyframe until the next Keyframe");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "hide");
RNA_def_property_enum_items(prop, rna_enum_beztriple_keyframe_type_items);
RNA_def_property_ui_text(prop, "Type", "Type of keyframe (for visual purposes only)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
@@ -1785,42 +1792,42 @@ static void rna_def_fkeyframe(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Easing",
"Which ends of the segment between this and the next keyframe easing "
"interpolation is applied to");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "back");
RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "amplitude");
RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
RNA_def_property_ui_text(prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "period");
RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
/* Vector values */
prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
RNA_def_property_array(prop, 2);
RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle1_get", "rna_FKeyframe_handle1_set", NULL);
RNA_def_property_ui_text(prop, "Left Handle", "Coordinates of the left handle (before the control point)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
RNA_def_property_array(prop, 2);
RNA_def_property_float_funcs(prop, "rna_FKeyframe_ctrlpoint_get", "rna_FKeyframe_ctrlpoint_set", NULL);
RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
RNA_def_property_array(prop, 2);
RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle2_get", "rna_FKeyframe_handle2_set", NULL);
RNA_def_property_ui_text(prop, "Right Handle", "Coordinates of the right handle (after the control point)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
}
static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
@@ -1877,7 +1884,7 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
{INSERTKEY_REPLACE, "REPLACE", 0, "Replace", "Don't add any new keyframes, but just replace existing ones"},
{INSERTKEY_NEEDED, "NEEDED", 0, "Needed", "Only adds keyframes that are needed"},
{INSERTKEY_FAST, "FAST", 0, "Fast", "Fast keyframe insertion to avoid recalculating the curve each time"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_property_srna(cprop, "FCurveKeyframePoints");
@@ -1924,7 +1931,7 @@ static void rna_def_fcurve(BlenderRNA *brna)
static const EnumPropertyItem prop_mode_extend_items[] = {
{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant", "Hold values of endpoint keyframes"},
{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear", "Use slope of curve leading in/out of endpoint keyframes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_mode_color_items[] = {
{FCURVE_COLOR_AUTO_RAINBOW, "AUTO_RAINBOW", 0, "Auto Rainbow",
@@ -1935,12 +1942,12 @@ static void rna_def_fcurve(BlenderRNA *brna)
"Use axis colors for XYZ parts of transform, and yellow for the 'W' channel"},
{FCURVE_COLOR_CUSTOM, "CUSTOM", 0, "User Defined",
"Use custom hand-picked color for F-Curve"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem prop_mode_smoothing_items[] = {
{FCURVE_SMOOTH_NONE, "NONE", 0, "None", "Auto handles only take adjacent keys into account (legacy mode)"},
{FCURVE_SMOOTH_CONT_ACCEL, "CONT_ACCEL", 0, "Continuous Acceleration", "Auto handles are placed to avoid jumps in acceleration"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FCurve", NULL);
@@ -2008,7 +2015,7 @@ static void rna_def_fcurve(BlenderRNA *brna)
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_MUTED);
- RNA_def_property_ui_text(prop, "Muted", "F-Curve is not evaluated");
+ RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier evaluation");
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, "rna_FCurve_update_eval");
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c
index d8ed908f2df..4fc20d29991 100644
--- a/source/blender/makesrna/intern/rna_fcurve_api.c
+++ b/source/blender/makesrna/intern/rna_fcurve_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_fcurve_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index c6b9277ea8f..d37ac0cb68d 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_fluidsim.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -223,7 +217,7 @@ static void rna_def_fluidsim_slip(StructRNA *srna)
"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}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "slip_type", PROP_ENUM, PROP_NONE);
@@ -232,7 +226,7 @@ static void rna_def_fluidsim_slip(StructRNA *srna)
RNA_def_property_enum_items(prop, slip_items);
RNA_def_property_ui_text(prop, "Slip Type", "");
- prop = RNA_def_property(srna, "partial_slip_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "partial_slip_factor", PROP_FLOAT, PROP_FACTOR);
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",
@@ -265,7 +259,7 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
{OB_FSDOM_GEOM, "GEOMETRY", 0, "Geometry", "Display geometry"},
{OB_FSDOM_PREVIEW, "PREVIEW", 0, "Preview", "Display preview quality results"},
{OB_FSDOM_FINAL, "FINAL", 0, "Final", "Display final quality results"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "DomainFluidSettings", "FluidSettings");
@@ -449,7 +443,7 @@ static void rna_def_fluidsim_volume(StructRNA *srna)
{1, "VOLUME", 0, "Volume", "Use only the inner volume of the mesh"},
{2, "SHELL", 0, "Shell", "Use only the outer shell of the mesh"},
{3, "BOTH", 0, "Both", "Use both the inner volume and the outer shell of the mesh"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "volume_initialization", PROP_ENUM, PROP_NONE);
@@ -682,7 +676,7 @@ void RNA_def_fluidsim(BlenderRNA *brna)
"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}
+ {0, NULL, 0, NULL, NULL},
};
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index e632bf36d67..6203d06c7d5 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2009), Joshua Leung, Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_gpencil.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -36,7 +30,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
@@ -49,37 +42,36 @@
#include "WM_types.h"
-/* parent type */
+ /* parent type */
static const EnumPropertyItem parent_type_items[] = {
{PAROBJECT, "OBJECT", 0, "Object", "The layer is parented to an object"},
{PARSKEL, "ARMATURE", 0, "Armature", ""},
{PARBONE, "BONE", 0, "Bone", "The layer is parented to a bone"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
-static EnumPropertyItem rna_enum_gpencil_xraymodes_items[] = {
- {GP_XRAY_FRONT, "FRONT", 0, "Front", "Draw all strokes in front"},
- {GP_XRAY_3DSPACE, "3DSPACE", 0, "3D Space", "Draw strokes relative to other objects in 3D space"},
- {GP_XRAY_BACK, "BACK", 0, "Back", "Draw all strokes last"},
- {0, NULL, 0, NULL, NULL}
+static EnumPropertyItem rna_enum_gpencil_stroke_depth_order_items[] = {
+ {GP_DRAWMODE_2D, "2D", 0, "2D Layers", "Display strokes using grease pencil layers to define order"},
+ {GP_DRAWMODE_3D, "3D", 0, "3D Location", "Display strokes using real 3D position in 3D space"},
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_gpencil_onion_modes_items[] = {
{GP_ONION_MODE_ABSOLUTE, "ABSOLUTE", 0, "Frames", "Frames in absolute range of the scene frame"},
{GP_ONION_MODE_RELATIVE, "RELATIVE", 0, "Keyframes", "Frames in relative range of the Grease Pencil keyframes"},
{GP_ONION_MODE_SELECTED, "SELECTED", 0, "Selected", "Only selected keyframes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_gplayer_move_type_items[] = {
{-1, "UP", 0, "Up", ""},
{1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_layer_blend_modes_items[] = {
- {eGplBlendMode_Normal, "NORMAL", 0, "Normal", "" },
+ {eGplBlendMode_Normal, "NORMAL", 0, "Regular", "" },
{eGplBlendMode_Overlay, "OVERLAY", 0, "Overlay", "" },
{eGplBlendMode_Add, "ADD", 0, "Add", "" },
{eGplBlendMode_Subtract, "SUBTRACT", 0, "Subtract", "" },
@@ -87,11 +79,18 @@ static const EnumPropertyItem rna_enum_layer_blend_modes_items[] = {
{eGplBlendMode_Divide, "DIVIDE", 0, "Divide", "" },
{0, NULL, 0, NULL, NULL }
};
+
+static EnumPropertyItem rna_enum_gpencil_caps_modes_items[] = {
+ {GP_STROKE_CAP_ROUND, "ROUND", 0, "Rounded", ""},
+ {GP_STROKE_CAP_FLAT, "FLAT", 0, "Flat", ""},
+ {0, NULL, 0, NULL, NULL},
+};
#endif
#ifdef RNA_RUNTIME
#include "BLI_ghash.h"
+#include "BLI_string_utils.h"
#include "WM_api.h"
@@ -285,8 +284,8 @@ static void rna_GPencilLayer_parent_bone_set(PointerRNA *ptr, const char *value)
/* parent types enum */
static const EnumPropertyItem *rna_Object_parent_type_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+ bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), bool *r_free)
{
bGPDlayer *gpl = (bGPDlayer *)ptr->data;
EnumPropertyItem *item = NULL;
@@ -376,7 +375,7 @@ static int rna_GPencil_active_layer_index_get(PointerRNA *ptr)
static void rna_GPencil_active_layer_index_set(PointerRNA *ptr, int value)
{
- bGPdata *gpd = (bGPdata *)ptr->id.data;
+ bGPdata *gpd = (bGPdata *)ptr->id.data;
bGPDlayer *gpl = BLI_findlink(&gpd->layers, value);
BKE_gpencil_layer_setactive(gpd, gpl);
@@ -398,11 +397,11 @@ static void rna_GPencil_active_layer_index_range(PointerRNA *ptr, int *min, int
}
static const EnumPropertyItem *rna_GPencil_active_layer_itemf(
- bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+ bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
bGPdata *gpd = (bGPdata *)ptr->id.data;
bGPDlayer *gpl;
- EnumPropertyItem *item = NULL, item_tmp = {0};
+ EnumPropertyItem *item = NULL, item_tmp = { 0 };
int totitem = 0;
int i = 0;
@@ -507,11 +506,11 @@ static void rna_GPencil_stroke_point_add(ID *id, bGPDstroke *stroke, int count,
if (count > 0) {
/* create space at the end of the array for extra points */
stroke->points = MEM_recallocN_id(stroke->points,
- sizeof(bGPDspoint) * (stroke->totpoints + count),
- "gp_stroke_points");
+ sizeof(bGPDspoint) * (stroke->totpoints + count),
+ "gp_stroke_points");
stroke->dvert = MEM_recallocN_id(stroke->dvert,
- sizeof(MDeformVert) * (stroke->totpoints + count),
- "gp_stroke_weight");
+ sizeof(MDeformVert) * (stroke->totpoints + count),
+ "gp_stroke_weight");
/* init the pressure and strength values so that old scripts won't need to
* be modified to give these initial values...
@@ -775,19 +774,19 @@ static void rna_def_gpencil_stroke_point(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Coordinates", "");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
- prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "pressure");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Pressure", "Pressure of tablet at point when drawing it");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "strength");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Strength", "Color intensity (alpha factor)");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
- prop = RNA_def_property(srna, "uv_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "uv_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "uv_fac");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "UV Factor", "Internal UV factor");
@@ -900,7 +899,7 @@ static void rna_def_gpencil_mvert_group(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Group Index", "");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Weight", "Vertex Weight");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
@@ -916,7 +915,7 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
{GP_STROKE_3DSPACE, "3DSPACE", 0, "3D Space", "Stroke is in 3D-space"},
{GP_STROKE_2DSPACE, "2DSPACE", 0, "2D Space", "Stroke is in 2D-space"},
{GP_STROKE_2DIMAGE, "2DIMAGE", 0, "2D Image", "Stroke is in 2D-space (but with special 'image' scaling)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "GPencilStroke", NULL);
@@ -968,6 +967,19 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Cyclic", "Enable cyclic drawing, closing the stroke");
RNA_def_property_update(prop, 0, "rna_GPencil_update");
+ /* Caps mode */
+ prop = RNA_def_property(srna, "start_cap_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "caps[0]");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_caps_modes_items);
+ RNA_def_property_ui_text(prop, "Start Cap", "Stroke start extreme cap style");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "end_cap_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "caps[1]");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_caps_modes_items);
+ RNA_def_property_ui_text(prop, "End Cap", "Stroke end extreme cap style");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
/* No fill: The stroke never must fill area and must use fill color as stroke color (this is a special flag for fill brush) */
prop = RNA_def_property(srna, "is_nofill_stroke", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STROKE_NOFILL);
@@ -1066,7 +1078,7 @@ static void rna_def_gpencil_frames_api(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a new grease pencil frame");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm = RNA_def_int(func, "frame_number", 1, MINAFRAME, MAXFRAME, "Frame Number",
- "The frame on which this sketch appears", MINAFRAME, MAXFRAME);
+ "The frame on which this sketch appears", MINAFRAME, MAXFRAME);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func, "frame", "GPencilFrame", "", "The newly created frame");
RNA_def_function_return(func, parm);
@@ -1261,6 +1273,13 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
"Clamp any pixel outside underlying layers drawing");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+ /* solo mode: Only display frames with keyframe */
+ prop = RNA_def_property(srna, "use_solo_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SOLO_MODE);
+ RNA_def_property_ui_text(prop, "Solo Mode",
+ "In Paint mode display only layers with keyframe in current frame");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
/* exposed as layers.active */
#if 0
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
@@ -1373,20 +1392,20 @@ static void rna_def_gpencil_layers_api(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_funcs(
- prop,
- "rna_GPencil_active_layer_index_get",
- "rna_GPencil_active_layer_index_set",
- "rna_GPencil_active_layer_index_range");
+ prop,
+ "rna_GPencil_active_layer_index_get",
+ "rna_GPencil_active_layer_index_set",
+ "rna_GPencil_active_layer_index_range");
RNA_def_property_ui_text(prop, "Active Layer Index", "Index of active grease pencil layer");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL);
/* Active Layer - As an enum (for selecting active layer for annotations) */
prop = RNA_def_property(srna, "active_note", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_funcs(
- prop,
- "rna_GPencil_active_layer_index_get",
- "rna_GPencil_active_layer_index_set",
- "rna_GPencil_active_layer_itemf");
+ prop,
+ "rna_GPencil_active_layer_index_get",
+ "rna_GPencil_active_layer_index_set",
+ "rna_GPencil_active_layer_itemf");
RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items); /* purely dynamic, as it maps to user-data */
RNA_def_property_ui_text(prop, "Active Note", "Note/Layer to add annotation strokes to");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
@@ -1405,7 +1424,7 @@ static void rna_def_gpencil_grid(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_GreasePencilGrid_path");
RNA_def_struct_ui_text(srna, "Grid and Canvas Settings",
- "Settings for grid and canvas in 3D viewport");
+ "Settings for grid and canvas in 3D viewport");
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
RNA_def_property_float_sdna(prop, NULL, "scale");
@@ -1429,7 +1448,7 @@ static void rna_def_gpencil_grid(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Grid Subdivisions", "Number of subdivisions in each side of symmetry line");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_XYZ);
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "offset");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_array(prop, 2);
@@ -1447,6 +1466,12 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
static float onion_dft1[3] = { 0.145098f, 0.419608f, 0.137255f }; /* green */
static float onion_dft2[3] = { 0.125490f, 0.082353f, 0.529412f }; /* blue */
+ static const EnumPropertyItem stroke_thickness_items[] = {
+ {0, "WORLDSPACE", 0, "World Space", "Set stroke thickness relative to the world space"},
+ {GP_DATA_STROKE_KEEPTHICKNESS, "SCREENSPACE", 0, "Screen Space", "Set stroke thickness relative to the screen space"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna = RNA_def_struct(brna, "GreasePencil", "ID");
RNA_def_struct_sdna(srna, "bGPdata");
RNA_def_struct_ui_text(srna, "Grease Pencil", "Freehand annotation sketchbook");
@@ -1470,11 +1495,12 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
- /* xray modes */
- prop = RNA_def_property(srna, "xray_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "xray_mode");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_xraymodes_items);
- RNA_def_property_ui_text(prop, "X-Ray", "");
+ /* Depth */
+ prop = RNA_def_property(srna, "stroke_depth_order", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "draw_mode");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_stroke_depth_order_items);
+ RNA_def_property_ui_text(prop, "Stroke Depth Order",
+ "Defines how the strokes are ordered in 3D space");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
/* Flags */
@@ -1510,12 +1536,13 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_stroke_direction", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_SHOW_DIRECTION);
RNA_def_property_ui_text(prop, "Show Direction", "Show stroke drawing direction with a bigger green dot (start) "
- "and smaller red dot (end) points");
+ "and smaller red dot (end) points");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
- prop = RNA_def_property(srna, "show_constant_thickness", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_KEEPTHICKNESS);
- RNA_def_property_ui_text(prop, "Keep Thickness", "Maintain the thickness of the stroke when the viewport zoom changes");
+ prop = RNA_def_property(srna, "stroke_thickness_space", PROP_ENUM, PROP_NONE); /* as an enum */
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, stroke_thickness_items);
+ RNA_def_property_ui_text(prop, "Stroke Thickness", "Set stroke thickness in screen space or world space");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
prop = RNA_def_property(srna, "pixel_factor", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 53387f33b05..1787642e9c3 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_gpencil_modifier.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -79,7 +75,7 @@ const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[] = {
{eGpencilModifierType_Color, "GP_COLOR", ICON_MOD_HUE_SATURATION, "Hue/Saturation", "Apply changes to stroke colors"},
{eGpencilModifierType_Opacity, "GP_OPACITY", ICON_MOD_OPACITY, "Opacity", "Opacity of the strokes"},
{eGpencilModifierType_Tint, "GP_TINT", ICON_MOD_TINT, "Tint", "Tint strokes with new color"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
@@ -87,7 +83,7 @@ static const EnumPropertyItem modifier_modify_color_items[] = {
{GP_MODIFY_COLOR_BOTH, "BOTH", 0, "Both", "Modify fill and stroke colors"},
{GP_MODIFY_COLOR_STROKE, "STROKE", 0, "Stroke", "Modify stroke color only"},
{GP_MODIFY_COLOR_FILL, "FILL", 0, "Fill", "Modify fill color only"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem modifier_gphook_falloff_items[] = {
@@ -100,14 +96,14 @@ static const EnumPropertyItem modifier_gphook_falloff_items[] = {
{eGPHook_Falloff_Sharp, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
{eGPHook_Falloff_Linear, "LINEAR", ICON_LINCURVE, "Linear", ""},
{eGPHook_Falloff_Const, "CONSTANT", ICON_NOCURVE, "Constant", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_time_mode_items[] = {
- {GP_TIME_MODE_NORMAL, "NORMAL", 0, "Normal", "Apply offset in normal animation direction"},
+ {GP_TIME_MODE_NORMAL, "NORMAL", 0, "Regular", "Apply offset in usual animation direction"},
{GP_TIME_MODE_REVERSE, "REVERSE", 0, "Reverse", "Apply offset in reverse animation direction"},
{GP_TIME_MODE_FIX, "FIX", 0, "Fixed Frame", "Keep frame and do not change with time"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -547,7 +543,7 @@ static void rna_def_modifier_gpencilsimplify(BlenderRNA *brna)
"Delete alternative vertices in the stroke, except extremes"},
{GP_SIMPLIFY_ADAPTIVE, "ADAPTIVE", ICON_IPO_EASE_IN_OUT, "Adaptive",
"Use a RDP algorithm to simplify" },
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SimplifyGpencilModifier", "GpencilModifier");
@@ -1168,7 +1164,7 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
"Strokes appear/disappear one after the other, but only a single one changes at a time"},
{GP_BUILD_MODE_CONCURRENT, "CONCURRENT", ICON_PARTICLE_TIP, "Concurrent",
"Multiple strokes appear/disappear at once"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem prop_gpencil_build_transition_items[] = {
@@ -1181,7 +1177,7 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
{GP_BUILD_TRANSITION_FADE, "FADE", 0, "Fade",
"Hide points in the order they occur in each stroke "
"(e.g. for animating ink fading or vanishing after getting drawn)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem prop_gpencil_build_time_align_items[] = {
@@ -1189,7 +1185,7 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
"All strokes start at same time (i.e. short strokes finish earlier)"},
{GP_BUILD_TIMEALIGN_END, "END", 0, "Align End",
"All strokes end at same time (i.e. short strokes start later)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -1396,7 +1392,7 @@ static void rna_def_modifier_gpencilmirror(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
- prop = RNA_def_property(srna, "clip", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_CLIPPING);
RNA_def_property_ui_text(prop, "Clip", "Clip points");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
@@ -1503,7 +1499,7 @@ static void rna_def_modifier_gpencilhook(BlenderRNA *brna)
prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
- RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
+ RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Light Falloff Curve");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 0994d628778..231d4d6dbc8 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,28 +12,24 @@
* 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): Brecht Van Lommel
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_image.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
#include "DNA_image_types.h"
+#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
-#include "BLI_math_base.h"
-#include "BKE_context.h"
#include "BKE_image.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_build.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -50,7 +44,7 @@ const EnumPropertyItem rna_enum_image_generated_type_items[] = {
{IMA_GENTYPE_BLANK, "BLANK", 0, "Blank", "Generate a blank image"},
{IMA_GENTYPE_GRID, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"},
{IMA_GENTYPE_GRID_COLOR, "COLOR_GRID", 0, "Color Grid", "Generated improved UV grid to test UV mappings"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem image_source_items[] = {
@@ -59,11 +53,13 @@ static const EnumPropertyItem image_source_items[] = {
{IMA_SRC_MOVIE, "MOVIE", 0, "Movie", "Movie file"},
{IMA_SRC_GENERATED, "GENERATED", 0, "Generated", "Generated image"},
{IMA_SRC_VIEWER, "VIEWER", 0, "Viewer", "Compositing node viewer"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
+#include "BLI_math_base.h"
+
#include "BKE_global.h"
#include "GPU_draw.h"
@@ -72,6 +68,8 @@ static const EnumPropertyItem image_source_items[] = {
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+#include "ED_node.h"
+
static bool rna_Image_is_stereo_3d_get(PointerRNA *ptr)
{
return BKE_image_is_stereo((Image *)ptr->data);
@@ -97,6 +95,7 @@ static void rna_Image_source_set(PointerRNA *ptr, int value)
BKE_image_signal(G_MAIN, ima, NULL, IMA_SIGNAL_SRC_CHANGE);
DEG_id_tag_update(&ima->id, 0);
DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS);
+ DEG_relations_tag_update(G_MAIN);
}
}
@@ -142,19 +141,31 @@ static void rna_Image_views_format_update(Main *bmain, Scene *scene, PointerRNA
BKE_image_release_ibuf(ima, ibuf, lock);
}
-static void rna_ImageUser_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ImageUser *iuser = ptr->data;
+ ID *id = ptr->id.data;
BKE_image_user_frame_calc(iuser, scene->r.cfra);
- if (ptr->id.data) {
- /* Update material or texture for render preview. */
- DEG_id_tag_update(ptr->id.data, 0);
- DEG_id_tag_update(ptr->id.data, ID_RECALC_EDITORS);
+ if (id) {
+ if (GS(id->name) == ID_NT) {
+ /* Special update for nodetrees to find parent datablock. */
+ ED_node_tag_update_nodetree(bmain, (bNodeTree *)id, NULL);
+ }
+ else {
+ /* Update material or texture for render preview. */
+ DEG_id_tag_update(id, 0);
+ DEG_id_tag_update(id, ID_RECALC_EDITORS);
+ }
}
}
+static void rna_ImageUser_relations_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ rna_ImageUser_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
+}
static char *rna_ImageUser_path(PointerRNA *ptr)
{
@@ -511,7 +522,7 @@ static void rna_def_imageuser(BlenderRNA *brna)
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");
- RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+ RNA_def_property_update(prop, 0, "rna_ImageUser_relations_update");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
@@ -647,12 +658,12 @@ static void rna_def_image(BlenderRNA *brna)
{IMA_TYPE_UV_TEST, "UV_TEST", 0, "UV Test", ""},
{IMA_TYPE_R_RESULT, "RENDER_RESULT", 0, "Render Result", ""},
{IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem alpha_mode_items[] = {
{IMA_ALPHA_STRAIGHT, "STRAIGHT", 0, "Straight", "Transparent RGB and alpha pixels are unmodified"},
{IMA_ALPHA_PREMUL, "PREMUL", 0, "Premultiplied", "Transparent RGB pixels are multiplied by the alpha channel"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Image", "ID");
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index e554dd650a9..25cb6894b4d 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Arystanbek Dyussenov
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_image_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -194,6 +187,7 @@ static void rna_Image_unpack(Image *image, Main *bmain, ReportList *reports, int
static void rna_Image_reload(Image *image, Main *bmain)
{
BKE_image_signal(bmain, image, NULL, IMA_SIGNAL_RELOAD);
+ WM_main_add_notifier(NC_IMAGE | NA_EDITED, image);
}
static void rna_Image_update(Image *image, ReportList *reports)
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 56400f58ee6..1528c8b32e0 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_internal.h
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#ifndef __RNA_INTERNAL_H__
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index f03752968c9..11fb7856af2 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_internal_types.h
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -33,20 +27,20 @@
#include "RNA_types.h"
struct BlenderRNA;
+struct CollectionPropertyIterator;
struct ContainerRNA;
-struct StructRNA;
-struct PropertyRNA;
-struct PointerRNA;
struct FunctionRNA;
-struct CollectionPropertyIterator;
-struct bContext;
+struct GHash;
struct IDOverrideStatic;
struct IDOverrideStaticProperty;
struct IDOverrideStaticPropertyOperation;
struct IDProperty;
-struct GHash;
struct Main;
+struct PointerRNA;
+struct PropertyRNA;
struct Scene;
+struct StructRNA;
+struct bContext;
/* store local properties here */
#define RNA_IDP_UI "_RNA_UI"
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index 5181912f4eb..8fe20a1b03f 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_key.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -33,7 +27,6 @@
#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h"
-#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
@@ -53,6 +46,8 @@
#include "DNA_object_types.h"
+#include "BLI_string_utils.h"
+
#include "BKE_animsys.h"
#include "BKE_key.h"
#include "BKE_main.h"
@@ -660,7 +655,7 @@ static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *p
Key *key = ptr->id.data;
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (BKE_key_from_object(ob) == key) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
@@ -760,7 +755,7 @@ const EnumPropertyItem rna_enum_keyblock_type_items[] = {
{KEY_CARDINAL, "KEY_CARDINAL", 0, "Cardinal", ""},
{KEY_CATMULL_ROM, "KEY_CATMULL_ROM", 0, "Catmull-Rom", ""},
{KEY_BSPLINE, "KEY_BSPLINE", 0, "BSpline", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const float tilt_limit = DEG2RADF(21600.0f);
@@ -899,8 +894,8 @@ static void rna_def_keyblock(BlenderRNA *brna)
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYBLOCK_MUTE);
- RNA_def_property_ui_text(prop, "Mute", "Mute this shape key");
- RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
+ RNA_def_property_ui_text(prop, "Mute", "Toggle this shape key");
+ RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
RNA_def_property_update(prop, 0, "rna_Key_update_data");
prop = RNA_def_property(srna, "slider_min", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index cc6a46123db..410598082db 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_lattice.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -136,7 +130,7 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr)
neww = (lt->opntsw > 0) ? lt->opntsw : lt->pntsw;
/* BKE_lattice_resize needs an object, any object will have the same result */
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->data == lt) {
BKE_lattice_resize(lt, newu, newv, neww, ob);
if (lt->editlatt)
diff --git a/source/blender/makesrna/intern/rna_lattice_api.c b/source/blender/makesrna/intern/rna_lattice_api.c
index 405b7922a0a..f3bdb694c50 100644
--- a/source/blender/makesrna/intern/rna_lattice_api.c
+++ b/source/blender/makesrna/intern/rna_lattice_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_lattice_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index c84c59287a5..527c530f493 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,22 +12,16 @@
* 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): Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_layer.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include "DNA_scene_types.h"
#include "DNA_layer_types.h"
#include "DNA_view3d_types.h"
-#include "BLI_math.h"
-#include "BLI_string_utils.h"
#include "BLT_translation.h"
@@ -204,7 +196,7 @@ int rna_LayerCollection_name_length(PointerRNA *ptr)
return strlen(id->name + 2);
}
-static void rna_LayerCollection_use_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_LayerCollection_exclude_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
Scene *scene = (Scene *)ptr->id.data;
LayerCollection *lc = (LayerCollection *)ptr->data;
@@ -217,29 +209,22 @@ static void rna_LayerCollection_use_update(Main *bmain, Scene *UNUSED(scene), Po
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
}
-static bool rna_LayerCollection_has_objects(LayerCollection *lc)
+static void rna_LayerCollection_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- return (lc->runtime_flag & LAYER_COLLECTION_HAS_OBJECTS) != 0;
-}
+ Scene *scene = (Scene *)ptr->id.data;
+ LayerCollection *lc = (LayerCollection *)ptr->data;
+ ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc);
-static bool rna_LayerCollection_has_visible_objects(LayerCollection *lc, ViewLayer *view_layer)
-{
- if ((view_layer->runtime_flag & VIEW_LAYER_HAS_HIDE) &&
- !(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS))
- {
- return false;
- }
- return true;
+ BKE_layer_collection_sync(scene, view_layer);
+
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
}
-static bool rna_LayerCollection_has_hidden_objects(LayerCollection *lc, ViewLayer *view_layer)
+static bool rna_LayerCollection_has_objects(LayerCollection *lc)
{
- if ((view_layer->runtime_flag & VIEW_LAYER_HAS_HIDE) &&
- (lc->runtime_flag & LAYER_COLLECTION_HAS_HIDDEN_OBJECTS))
- {
- return true;
- }
- return false;
+ return (lc->runtime_flag & LAYER_COLLECTION_HAS_OBJECTS) != 0;
}
static bool rna_LayerCollection_has_selected_objects(LayerCollection *lc, ViewLayer *view_layer)
@@ -281,13 +266,13 @@ static void rna_def_layer_collection(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_EXCLUDE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Exclude", "Exclude collection from view layer");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_use_update");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_exclude_update");
prop = RNA_def_property(srna, "holdout", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HOLDOUT);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Holdout", "Mask out objects in collection from view layer");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_use_update");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");
prop = RNA_def_property(srna, "indirect_only", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_INDIRECT_ONLY);
@@ -295,22 +280,24 @@ static void rna_def_layer_collection(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Indirect Only",
"Objects in collection only contribute indirectly (through shadows and reflections) "
"in the view layer");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_use_update");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");
- func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects");
- RNA_def_function_ui_description(func, "");
- RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
+ prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_RESTRICT_VIEW);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
+ RNA_def_property_ui_text(prop, "Disable Viewport", "Disable collection in viewport for this view layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_update");
- func = RNA_def_function(srna, "has_visible_objects", "rna_LayerCollection_has_visible_objects");
- RNA_def_function_ui_description(func, "");
- prop = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "ViewLayer the layer collection belongs to");
- RNA_def_parameter_flags(prop, 0, PARM_REQUIRED);
- RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
+ prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Visible",
+ "Whether this collection is visible, take into account the collection parent");
- func = RNA_def_function(srna, "has_hidden_objects", "rna_LayerCollection_has_hidden_objects");
+ func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects");
RNA_def_function_ui_description(func, "");
- prop = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "ViewLayer the layer collection belongs to");
- RNA_def_parameter_flags(prop, 0, PARM_REQUIRED);
RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
func = RNA_def_function(srna, "has_selected_objects", "rna_LayerCollection_has_selected_objects");
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_light.c
index d9bd9c42445..43c9ecef40d 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_light.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_lamp.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -36,7 +30,7 @@
#include "RNA_enum_types.h"
#include "rna_internal.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
@@ -56,7 +50,7 @@
static void rna_Light_buffer_size_set(PointerRNA *ptr, int value)
{
- Lamp *la = (Lamp *)ptr->data;
+ Light *la = (Light *)ptr->data;
CLAMP(value, 128, 10240);
la->bufsize = value;
@@ -65,7 +59,7 @@ static void rna_Light_buffer_size_set(PointerRNA *ptr, int value)
static StructRNA *rna_Light_refine(struct PointerRNA *ptr)
{
- Lamp *la = (Lamp *)ptr->data;
+ Light *la = (Light *)ptr->data;
switch (la->type) {
case LA_LOCAL:
@@ -83,7 +77,7 @@ static StructRNA *rna_Light_refine(struct PointerRNA *ptr)
static void rna_Light_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Lamp *la = ptr->id.data;
+ Light *la = ptr->id.data;
DEG_id_tag_update(&la->id, 0);
WM_main_add_notifier(NC_LAMP | ND_LIGHTING, la);
@@ -91,7 +85,7 @@ static void rna_Light_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR
static void rna_Light_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Lamp *la = ptr->id.data;
+ Light *la = ptr->id.data;
DEG_id_tag_update(&la->id, 0);
WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, la);
@@ -99,7 +93,7 @@ static void rna_Light_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
static void rna_Light_use_nodes_update(bContext *C, PointerRNA *ptr)
{
- Lamp *la = (Lamp *)ptr->data;
+ Light *la = (Light *)ptr->data;
if (la->use_nodes && la->nodetree == NULL)
ED_node_shader_default(C, &la->id);
@@ -114,7 +108,7 @@ const EnumPropertyItem rna_enum_light_type_items[] = {
{LA_SUN, "SUN", 0, "Sun", "Constant direction parallel ray light source"},
{LA_SPOT, "SPOT", 0, "Spot", "Directional cone light source"},
{LA_AREA, "AREA", 0, "Area", "Directional area light source"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_light(BlenderRNA *brna)
@@ -124,15 +118,16 @@ static void rna_def_light(BlenderRNA *brna)
static float default_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
srna = RNA_def_struct(brna, "Light", "ID");
- RNA_def_struct_sdna(srna, "Lamp");
+ RNA_def_struct_sdna(srna, "Light");
RNA_def_struct_refine_func(srna, "rna_Light_refine");
RNA_def_struct_ui_text(srna, "Light", "Light data-block for lighting a scene");
+ RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_ID_LIGHT);
RNA_def_struct_ui_icon(srna, ICON_LIGHT_DATA);
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_light_type_items);
RNA_def_property_ui_text(prop, "Type", "Type of Light");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LAMP);
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LIGHT);
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
@@ -143,12 +138,6 @@ static void rna_def_light(BlenderRNA *brna)
"Falloff distance - the light is at half the original intensity at this point");
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
- prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_ui_range(prop, 0, 10, 1, 3);
- RNA_def_property_ui_text(prop, "Energy", "Amount of light emitted");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "r");
RNA_def_property_array(prop, 3);
@@ -193,6 +182,30 @@ static void rna_def_light(BlenderRNA *brna)
rna_def_animdata_common(srna);
}
+static void rna_def_light_energy(StructRNA *srna, bool distant)
+{
+ PropertyRNA *prop;
+
+ if (distant) {
+ /* Distant light strength has no unit defined, it's proportional to
+ * Watt/m^2 and is not sensitive to scene unit scale. */
+ prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Strength", "Amount of light emitted");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+ }
+ else {
+ /* Lights with a location have power in Watt, which is sensitive to
+ * scene unit scale. */
+ prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_POWER);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1000000.0f, 1, 5);
+ RNA_def_property_ui_text(prop, "Power", "Amount of light emitted");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+ }
+}
+
static void rna_def_light_falloff(StructRNA *srna)
{
PropertyRNA *prop;
@@ -204,7 +217,7 @@ static void rna_def_light_falloff(StructRNA *srna)
{LA_FALLOFF_INVCOEFFICIENTS, "INVERSE_COEFFICIENTS", 0, "Inverse Coefficients", ""},
{LA_FALLOFF_CURVE, "CUSTOM_CURVE", 0, "Custom Curve", ""},
{LA_FALLOFF_SLIDERS, "LINEAR_QUADRATIC_WEIGHTED", 0, "Lin/Quad Weighted", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
@@ -217,13 +230,13 @@ static void rna_def_light_falloff(StructRNA *srna)
RNA_def_property_ui_text(prop, "Falloff Curve", "Custom light falloff curve");
RNA_def_property_update(prop, 0, "rna_Light_update");
- prop = RNA_def_property(srna, "linear_attenuation", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "linear_attenuation", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "att1");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Linear Attenuation", "Linear distance attenuation");
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
- prop = RNA_def_property(srna, "quadratic_attenuation", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "quadratic_attenuation", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "att2");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Quadratic Attenuation", "Quadratic distance attenuation");
@@ -251,7 +264,7 @@ static void rna_def_light_falloff(StructRNA *srna)
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
}
-static void rna_def_light_shadow(StructRNA *srna, int sun)
+static void rna_def_light_shadow(StructRNA *srna, bool sun)
{
PropertyRNA *prop;
@@ -407,12 +420,13 @@ static void rna_def_point_light(BlenderRNA *brna)
StructRNA *srna;
srna = RNA_def_struct(brna, "PointLight", "Light");
- RNA_def_struct_sdna(srna, "Lamp");
+ RNA_def_struct_sdna(srna, "Light");
RNA_def_struct_ui_text(srna, "Point Light", "Omnidirectional point Light");
RNA_def_struct_ui_icon(srna, ICON_LIGHT_POINT);
+ rna_def_light_energy(srna, false);
rna_def_light_falloff(srna);
- rna_def_light_shadow(srna, 0);
+ rna_def_light_shadow(srna, false);
}
static void rna_def_area_light(BlenderRNA *brna)
@@ -425,15 +439,16 @@ static void rna_def_area_light(BlenderRNA *brna)
{LA_AREA_RECT, "RECTANGLE", 0, "Rectangle", ""},
{LA_AREA_DISK, "DISK", 0, "Disk", ""},
{LA_AREA_ELLIPSE, "ELLIPSE", 0, "Ellipse", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "AreaLight", "Light");
- RNA_def_struct_sdna(srna, "Lamp");
+ RNA_def_struct_sdna(srna, "Light");
RNA_def_struct_ui_text(srna, "Area Light", "Directional area Light");
RNA_def_struct_ui_icon(srna, ICON_LIGHT_AREA);
- rna_def_light_shadow(srna, 0);
+ rna_def_light_energy(srna, false);
+ rna_def_light_shadow(srna, false);
rna_def_light_falloff(srna);
prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
@@ -466,12 +481,13 @@ static void rna_def_spot_light(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "SpotLight", "Light");
- RNA_def_struct_sdna(srna, "Lamp");
+ RNA_def_struct_sdna(srna, "Light");
RNA_def_struct_ui_text(srna, "Spot Light", "Directional cone Light");
RNA_def_struct_ui_icon(srna, ICON_LIGHT_SPOT);
+ rna_def_light_energy(srna, false);
rna_def_light_falloff(srna);
- rna_def_light_shadow(srna, 0);
+ rna_def_light_shadow(srna, false);
prop = RNA_def_property(srna, "use_square", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SQUARE);
@@ -504,21 +520,12 @@ static void rna_def_sun_light(BlenderRNA *brna)
StructRNA *srna;
srna = RNA_def_struct(brna, "SunLight", "Light");
- RNA_def_struct_sdna(srna, "Lamp");
+ RNA_def_struct_sdna(srna, "Light");
RNA_def_struct_ui_text(srna, "Sun Light", "Constant direction parallel ray Light");
RNA_def_struct_ui_icon(srna, ICON_LIGHT_SUN);
- rna_def_light_shadow(srna, 1);
-}
-
-static void rna_def_hemi_light(BlenderRNA *brna)
-{
- StructRNA *srna;
-
- srna = RNA_def_struct(brna, "HemiLight", "Light");
- RNA_def_struct_sdna(srna, "Lamp");
- RNA_def_struct_ui_text(srna, "Hemi Light", "180 degree constant Light");
- RNA_def_struct_ui_icon(srna, ICON_LIGHT_HEMI);
+ rna_def_light_energy(srna, true);
+ rna_def_light_shadow(srna, true);
}
void RNA_def_light(BlenderRNA *brna)
@@ -528,7 +535,6 @@ void RNA_def_light(BlenderRNA *brna)
rna_def_area_light(brna);
rna_def_spot_light(brna);
rna_def_sun_light(brna);
- rna_def_hemi_light(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_lightprobe.c b/source/blender/makesrna/intern/rna_lightprobe.c
index ee8f2be39ee..427ce36aa44 100644
--- a/source/blender/makesrna/intern/rna_lightprobe.c
+++ b/source/blender/makesrna/intern/rna_lightprobe.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_lightprobe.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -57,14 +51,14 @@ static void rna_LightProbe_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
static EnumPropertyItem parallax_type_items[] = {
{LIGHTPROBE_SHAPE_ELIPSOID, "ELIPSOID", ICON_NONE, "Sphere", ""},
{LIGHTPROBE_SHAPE_BOX, "BOX", ICON_NONE, "Box", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem lightprobe_type_items[] = {
{LIGHTPROBE_TYPE_CUBE, "CUBEMAP", ICON_LIGHTPROBE_CUBEMAP, "Reflection Cubemap", "Capture reflections"},
{LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_LIGHTPROBE_PLANAR, "Reflection Plane", ""},
{LIGHTPROBE_TYPE_GRID, "GRID", ICON_LIGHTPROBE_GRID, "Irradiance Volume", "Volume used for precomputing indirect lighting"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_lightprobe(BlenderRNA *brna)
@@ -74,7 +68,7 @@ static void rna_def_lightprobe(BlenderRNA *brna)
srna = RNA_def_struct(brna, "LightProbe", "ID");
RNA_def_struct_ui_text(srna, "LightProbe", "Light Probe data-block for lighting capture objects");
- RNA_def_struct_ui_icon(srna, ICON_LIGHTPROBE_CUBEMAP);
+ RNA_def_struct_ui_icon(srna, ICON_OUTLINER_OB_LIGHTPROBE);
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, lightprobe_type_items);
@@ -177,14 +171,14 @@ static void rna_def_lightprobe(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Visibility Bias", "Bias for reducing self shadowing");
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
- prop = RNA_def_property(srna, "visibility_bleed_bias", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "visibility_bleed_bias", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "vis_bleedbias");
RNA_def_property_float_default(prop, 0.0f);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Visibility Bleed Bias", "Bias for reducing light-bleed on variance shadow maps");
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
- prop = RNA_def_property(srna, "visibility_blur", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "visibility_blur", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "vis_blur");
RNA_def_property_float_default(prop, 0.2f);
RNA_def_property_range(prop, 0.0f, 1.0f);
diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c
index 5cee2fb90cb..8e791561694 100644
--- a/source/blender/makesrna/intern/rna_linestyle.c
+++ b/source/blender/makesrna/intern/rna_linestyle.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,21 +12,16 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_linestyle.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdio.h>
#include <stdlib.h>
#include "BLI_utildefines.h"
-#include "BLI_string_utils.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
@@ -51,7 +44,7 @@ const EnumPropertyItem rna_enum_linestyle_color_modifier_type_items[] = {
{LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
{LS_MODIFIER_NOISE, "NOISE", ICON_MODIFIER, "Noise", ""},
{LS_MODIFIER_TANGENT, "TANGENT", ICON_MODIFIER, "Tangent", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[] = {
@@ -63,7 +56,7 @@ const EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[] = {
{LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
{LS_MODIFIER_NOISE, "NOISE", ICON_MODIFIER, "Noise", ""},
{LS_MODIFIER_TANGENT, "TANGENT", ICON_MODIFIER, "Tangent", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[] = {
@@ -76,7 +69,7 @@ const EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[] = {
{LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
{LS_MODIFIER_NOISE, "NOISE", ICON_MODIFIER, "Noise", ""},
{LS_MODIFIER_TANGENT, "TANGENT", ICON_MODIFIER, "Tangent", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_linestyle_geometry_modifier_type_items[] = {
@@ -94,11 +87,13 @@ const EnumPropertyItem rna_enum_linestyle_geometry_modifier_type_items[] = {
{LS_MODIFIER_SINUS_DISPLACEMENT, "SINUS_DISPLACEMENT", ICON_MODIFIER, "Sinus Displacement", ""},
{LS_MODIFIER_SPATIAL_NOISE, "SPATIAL_NOISE", ICON_MODIFIER, "Spatial Noise", ""},
{LS_MODIFIER_TIP_REMOVER, "TIP_REMOVER", ICON_MODIFIER, "Tip Remover", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
+#include "BLI_string_utils.h"
+
#include "BKE_linestyle.h"
#include "BKE_texture.h"
@@ -480,7 +475,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna)
{TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"},
{TEXCO_STROKE, "ALONG_STROKE", 0, "Along stroke", "Use stroke length for texture coordinates"},
{TEXCO_ORCO, "ORCO", 0, "Generated", "Use the original undeformed coordinates of the object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_mapping_items[] = {
@@ -488,7 +483,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna)
{MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
{MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
{MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_x_mapping_items[] = {
@@ -496,7 +491,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna)
{1, "X", 0, "X", ""},
{2, "Y", 0, "Y", ""},
{3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_y_mapping_items[] = {
@@ -504,7 +499,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna)
{1, "X", 0, "X", ""},
{2, "Y", 0, "Y", ""},
{3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_z_mapping_items[] = {
@@ -512,7 +507,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna)
{1, "X", 0, "X", ""},
{2, "Y", 0, "Y", ""},
{3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "LineStyleTextureSlot", "TextureSlot");
@@ -553,11 +548,6 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Alpha", "The texture affects the alpha value");
RNA_def_property_update(prop, 0, "rna_LineStyle_update");
- prop = RNA_def_property(srna, "use_tips", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_TIPS);
- RNA_def_property_ui_text(prop, "Use Tips", "Lower half of the texture is for tips of the stroke");
- RNA_def_property_update(prop, 0, "rna_LineStyle_update");
-
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);
@@ -594,7 +584,7 @@ static void rna_def_modifier_type_common(
{LS_VALUE_DIFF, "DIFFERENCE", 0, "Difference", ""},
{LS_VALUE_MIN, "MINIMUM", 0, "Minimum", ""},
{LS_VALUE_MAX, "MAXIMUM", 0, "Maximum", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
@@ -688,7 +678,7 @@ static void rna_def_modifier_curve_common(StructRNA *srna, bool range, bool valu
static const EnumPropertyItem mapping_items[] = {
{0, "LINEAR", 0, "Linear", "Use linear mapping"},
{LS_MODIFIER_USE_CURVE, "CURVE", 0, "Curve", "Use curve mapping"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
@@ -753,7 +743,7 @@ static void rna_def_modifier_material_common(StructRNA *srna)
{LS_MODIFIER_MATERIAL_SPEC_B, "SPEC_B", 0, "Specular Color Blue", ""},
{LS_MODIFIER_MATERIAL_SPEC_HARD, "SPEC_HARD", 0, "Specular Hardness", ""},
{LS_MODIFIER_MATERIAL_ALPHA, "ALPHA", 0, "Alpha Transparency", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "material_attribute", PROP_ENUM, PROP_NONE);
@@ -773,7 +763,7 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna)
{LS_MODIFIER_BLUEPRINT_CIRCLES, "CIRCLES", 0, "Circles", "Draw a blueprint using circular contour strokes"},
{LS_MODIFIER_BLUEPRINT_ELLIPSES, "ELLIPSES", 0, "Ellipses", "Draw a blueprint using elliptic contour strokes"},
{LS_MODIFIER_BLUEPRINT_SQUARES, "SQUARES", 0, "Squares", "Draw a blueprint using square contour strokes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem transform_pivot_items[] = {
@@ -782,7 +772,7 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna)
{LS_MODIFIER_2D_TRANSFORM_PIVOT_END, "END", 0, "Stroke End", ""},
{LS_MODIFIER_2D_TRANSFORM_PIVOT_PARAM, "PARAM", 0, "Stroke Point Parameter", ""},
{LS_MODIFIER_2D_TRANSFORM_PIVOT_ABSOLUTE, "ABSOLUTE", 0, "Absolute 2D Point", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "LineStyleModifier", NULL);
@@ -1569,37 +1559,37 @@ static void rna_def_linestyle(BlenderRNA *brna)
#if 0 /* hidden for now */
{LS_PANEL_MISC, "MISC", 0, "Misc", "Show the panel for miscellaneous options"},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem chaining_items[] = {
{LS_CHAINING_PLAIN, "PLAIN", 0, "Plain", "Plain chaining"},
{LS_CHAINING_SKETCHY, "SKETCHY", 0, "Sketchy", "Sketchy chaining with a multiple touch"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem cap_items[] = {
{LS_CAPS_BUTT, "BUTT", 0, "Butt", "Butt cap (flat)"},
{LS_CAPS_ROUND, "ROUND", 0, "Round", "Round cap (half-circle)"},
{LS_CAPS_SQUARE, "SQUARE", 0, "Square", "Square cap (flat and extended)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem thickness_position_items[] = {
{LS_THICKNESS_CENTER, "CENTER", 0, "Center", "Silhouettes and border edges are centered along stroke geometry"},
{LS_THICKNESS_INSIDE, "INSIDE", 0, "Inside", "Silhouettes and border edges are drawn inside of stroke geometry"},
{LS_THICKNESS_OUTSIDE, "OUTSIDE", 0, "Outside", "Silhouettes and border edges are drawn outside of stroke geometry"},
{LS_THICKNESS_RELATIVE, "RELATIVE", 0, "Relative", "Silhouettes and border edges are shifted by a user-defined ratio"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem sort_key_items[] = {
{LS_SORT_KEY_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", 0, "Distance from Camera", "Sort by distance from camera (closer lines lie on top of further lines)"},
{LS_SORT_KEY_2D_LENGTH, "2D_LENGTH", 0, "2D Length", "Sort by curvilinear 2D length (longer lines lie on top of shorter lines)"},
{LS_SORT_KEY_PROJECTED_X, "PROJECTED_X", 0, "Projected X", "Sort by the projected X value in the image coordinate system"},
{LS_SORT_KEY_PROJECTED_Y, "PROJECTED_Y", 0, "Projected Y", "Sort by the projected Y value in the image coordinate system"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem sort_order_items[] = {
{0, "DEFAULT", 0, "Default", "Default order of the sort key"},
{LS_REVERSE_ORDER, "REVERSE", 0, "Reverse", "Reverse order"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem integration_type_items[] = {
{LS_INTEGRATION_MEAN, "MEAN", 0, "Mean", "The value computed for the chain is the mean of the values obtained for chain vertices"},
@@ -1607,7 +1597,7 @@ static void rna_def_linestyle(BlenderRNA *brna)
{LS_INTEGRATION_MAX, "MAX", 0, "Max", "The value computed for the chain is the maximum of the values obtained for chain vertices"},
{LS_INTEGRATION_FIRST, "FIRST", 0, "First", "The value computed for the chain is the value obtained for the first chain vertex"},
{LS_INTEGRATION_LAST, "LAST", 0, "Last", "The value computed for the chain is the value obtained for the last chain vertex"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FreestyleLineStyle", "ID");
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 4f145d1f48d..b157349062c 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_main.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -45,7 +39,7 @@
static bool rna_Main_use_autopack_get(PointerRNA *UNUSED(ptr))
{
- if (G.fileflags & G_AUTOPACK)
+ if (G.fileflags & G_FILE_AUTOPACK)
return 1;
return 0;
@@ -54,9 +48,9 @@ static bool rna_Main_use_autopack_get(PointerRNA *UNUSED(ptr))
static void rna_Main_use_autopack_set(PointerRNA *UNUSED(ptr), bool value)
{
if (value)
- G.fileflags |= G_AUTOPACK;
+ G.fileflags |= G_FILE_AUTOPACK;
else
- G.fileflags &= ~G_AUTOPACK;
+ G.fileflags &= ~G_FILE_AUTOPACK;
}
static bool rna_Main_is_saved_get(PointerRNA *UNUSED(ptr))
@@ -96,448 +90,49 @@ static void rna_Main_filepath_set(PointerRNA *ptr, const char *value)
}
#endif
-static void rna_Main_scene_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->scene, NULL);
-}
-
-static void rna_Main_object_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->object, NULL);
-}
-
-static void rna_Main_light_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->lamp, NULL);
-}
-
-static void rna_Main_library_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->library, NULL);
-}
-
-static void rna_Main_mesh_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->mesh, NULL);
-}
-
-static void rna_Main_curve_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->curve, NULL);
-}
-
-static void rna_Main_mball_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->mball, NULL);
-}
-
-static void rna_Main_mat_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->mat, NULL);
-}
-
-static void rna_Main_tex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->tex, NULL);
-}
-
-static void rna_Main_image_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->image, NULL);
-}
-
-static void rna_Main_latt_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->latt, NULL);
-}
-
-static void rna_Main_camera_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->camera, NULL);
-}
-
-static void rna_Main_key_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->key, NULL);
-}
-
-static void rna_Main_world_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->world, NULL);
-}
-
-static void rna_Main_screen_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->screen, NULL);
-}
-
-static void rna_Main_font_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->vfont, NULL);
-}
-
-static void rna_Main_text_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->text, NULL);
-}
-
-static void rna_Main_speaker_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->speaker, NULL);
-}
-
-static void rna_Main_sound_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->sound, NULL);
-}
-
-static void rna_Main_collection_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->collection, NULL);
-}
-
-static void rna_Main_armature_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->armature, NULL);
-}
-
-static void rna_Main_action_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->action, NULL);
-}
-
-static void rna_Main_nodetree_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->nodetree, NULL);
-}
-
-static void rna_Main_brush_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->brush, NULL);
-}
-
-static void rna_Main_particle_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->particle, NULL);
-}
-
-static void rna_Main_palettes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->palettes, NULL);
-}
-
-static void rna_Main_gpencil_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->gpencil, NULL);
-}
-
-static void rna_Main_wm_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->wm, NULL);
-}
-
-static void rna_Main_movieclips_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->movieclip, NULL);
-}
-
-static void rna_Main_masks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->mask, NULL);
-}
-
-static void rna_Main_linestyle_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->linestyle, NULL);
-}
-
-static void rna_Main_cachefiles_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->cachefiles, NULL);
-}
-
-static void rna_Main_paintcurves_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->paintcurves, NULL);
-}
-
-static void rna_Main_workspaces_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->workspaces, NULL);
-}
-
-static void rna_Main_lightprobes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
-{
- Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->lightprobe, NULL);
-}
-
-static int rna_ID_lookup_string(ListBase *lb, const char *key, PointerRNA *r_ptr)
-{
- ID *id;
- for (id = lb->first; id != NULL; id = id->next) {
- if (STREQ(id->name + 2, key)) {
- break;
- }
- else if (strstr(key, id->name + 2) != NULL) {
- char full_name_ui[MAX_ID_FULL_NAME_UI];
- BKE_id_full_name_ui_prefix_get(full_name_ui, id);
- /* Second check skips the three 'UI keycode letters' prefix. */
- if (STREQ(full_name_ui, key) || STREQ(full_name_ui + 3, key)) {
- break;
- }
- }
- }
- if (id != NULL) {
- RNA_id_pointer_create(id, r_ptr);
- return true;
+#define RNA_MAIN_LISTBASE_FUNCS_DEF(_listbase_name) \
+ static void rna_Main_##_listbase_name##_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) \
+ { \
+ rna_iterator_listbase_begin(iter, &((Main *)ptr->data)->_listbase_name, NULL); \
}
- return false;
-}
-
-int rna_Main_camera_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->camera, key, r_ptr);
-}
-
-int rna_Main_scene_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->scene, key, r_ptr);
-}
-
-int rna_Main_object_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->object, key, r_ptr);
-}
-
-int rna_Main_mat_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->mat, key, r_ptr);
-}
-
-int rna_Main_nodetree_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->nodetree, key, r_ptr);
-}
-
-int rna_Main_mesh_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->mesh, key, r_ptr);
-}
-
-int rna_Main_light_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->lamp, key, r_ptr);
-}
-
-int rna_Main_library_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->library, key, r_ptr);
-}
-
-int rna_Main_screen_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->screen, key, r_ptr);
-}
-
-int rna_Main_wm_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->wm, key, r_ptr);
-}
-
-int rna_Main_image_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->image, key, r_ptr);
-}
-
-int rna_Main_latt_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->latt, key, r_ptr);
-}
-
-int rna_Main_curve_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->curve, key, r_ptr);
-}
-
-int rna_Main_mball_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->mball, key, r_ptr);
-}
-int rna_Main_font_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->vfont, key, r_ptr);
-}
-
-int rna_Main_tex_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->tex, key, r_ptr);
-}
-
-int rna_Main_brush_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->brush, key, r_ptr);
-}
-
-int rna_Main_world_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->world, key, r_ptr);
-}
-
-int rna_Main_collection_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->collection, key, r_ptr);
-}
-
-int rna_Main_key_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->key, key, r_ptr);
-}
-
-int rna_Main_text_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->text, key, r_ptr);
-}
-
-int rna_Main_speaker_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->speaker, key, r_ptr);
-}
-
-int rna_Main_sound_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->sound, key, r_ptr);
-}
-
-int rna_Main_armature_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->armature, key, r_ptr);
-}
-
-int rna_Main_action_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->action, key, r_ptr);
-}
-
-int rna_Main_particle_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->particle, key, r_ptr);
-}
-
-int rna_Main_palette_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->palettes, key, r_ptr);
-}
-
-int rna_Main_gpencil_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->gpencil, key, r_ptr);
-}
-
-int rna_Main_movieclip_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->movieclip, key, r_ptr);
-}
-
-int rna_Main_mask_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->mask, key, r_ptr);
-}
-
-int rna_Main_linestyle_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->linestyle, key, r_ptr);
-}
-
-int rna_Main_cachefile_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->cachefiles, key, r_ptr);
-}
-
-int rna_Main_paintcurve_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->paintcurves, key, r_ptr);
-}
-
-int rna_Main_workspace_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->workspaces, key, r_ptr);
-}
-
-int rna_Main_lightprobe_lookup_string(PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr)
-{
- Main *bmain = ptr->data;
- return rna_ID_lookup_string(&bmain->lightprobe, key, r_ptr);
-}
+RNA_MAIN_LISTBASE_FUNCS_DEF(actions)
+RNA_MAIN_LISTBASE_FUNCS_DEF(armatures)
+RNA_MAIN_LISTBASE_FUNCS_DEF(brushes)
+RNA_MAIN_LISTBASE_FUNCS_DEF(cachefiles)
+RNA_MAIN_LISTBASE_FUNCS_DEF(cameras)
+RNA_MAIN_LISTBASE_FUNCS_DEF(collections)
+RNA_MAIN_LISTBASE_FUNCS_DEF(curves)
+RNA_MAIN_LISTBASE_FUNCS_DEF(fonts)
+RNA_MAIN_LISTBASE_FUNCS_DEF(gpencils)
+RNA_MAIN_LISTBASE_FUNCS_DEF(images)
+RNA_MAIN_LISTBASE_FUNCS_DEF(lattices)
+RNA_MAIN_LISTBASE_FUNCS_DEF(libraries)
+RNA_MAIN_LISTBASE_FUNCS_DEF(lightprobes)
+RNA_MAIN_LISTBASE_FUNCS_DEF(lights)
+RNA_MAIN_LISTBASE_FUNCS_DEF(linestyles)
+RNA_MAIN_LISTBASE_FUNCS_DEF(masks)
+RNA_MAIN_LISTBASE_FUNCS_DEF(materials)
+RNA_MAIN_LISTBASE_FUNCS_DEF(meshes)
+RNA_MAIN_LISTBASE_FUNCS_DEF(metaballs)
+RNA_MAIN_LISTBASE_FUNCS_DEF(movieclips)
+RNA_MAIN_LISTBASE_FUNCS_DEF(nodetrees)
+RNA_MAIN_LISTBASE_FUNCS_DEF(objects)
+RNA_MAIN_LISTBASE_FUNCS_DEF(paintcurves)
+RNA_MAIN_LISTBASE_FUNCS_DEF(palettes)
+RNA_MAIN_LISTBASE_FUNCS_DEF(particles)
+RNA_MAIN_LISTBASE_FUNCS_DEF(scenes)
+RNA_MAIN_LISTBASE_FUNCS_DEF(screens)
+RNA_MAIN_LISTBASE_FUNCS_DEF(shapekeys)
+RNA_MAIN_LISTBASE_FUNCS_DEF(sounds)
+RNA_MAIN_LISTBASE_FUNCS_DEF(speakers)
+RNA_MAIN_LISTBASE_FUNCS_DEF(texts)
+RNA_MAIN_LISTBASE_FUNCS_DEF(textures)
+RNA_MAIN_LISTBASE_FUNCS_DEF(wm)
+RNA_MAIN_LISTBASE_FUNCS_DEF(workspaces)
+RNA_MAIN_LISTBASE_FUNCS_DEF(worlds)
+
+#undef RNA_MAIN_LISTBASE_FUNCS_DEF
static void rna_Main_version_get(PointerRNA *ptr, int *value)
{
@@ -571,7 +166,6 @@ typedef struct MainCollectionDef {
const char *name;
const char *description;
CollectionDefFunc *func;
- const char *lookup_string;
} MainCollectionDef;
void RNA_def_main(BlenderRNA *brna)
@@ -582,42 +176,42 @@ void RNA_def_main(BlenderRNA *brna)
/* plural must match idtypes in readblenentry.c */
MainCollectionDef lists[] = {
- {"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera data-blocks", RNA_def_main_cameras, "rna_Main_camera_lookup_string"},
- {"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene data-blocks", RNA_def_main_scenes, "rna_Main_scene_lookup_string"},
- {"objects", "Object", "rna_Main_object_begin", "Objects", "Object data-blocks", RNA_def_main_objects, "rna_Main_object_lookup_string"},
- {"materials", "Material", "rna_Main_mat_begin", "Materials", "Material data-blocks", RNA_def_main_materials, "rna_Main_mat_lookup_string"},
- {"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group data-blocks", RNA_def_main_node_groups, "rna_Main_nodetree_lookup_string"},
- {"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh data-blocks", RNA_def_main_meshes, "rna_Main_mesh_lookup_string"},
- {"lights", "Light", "rna_Main_light_begin", "Lights", "Light data-blocks", RNA_def_main_lights, "rna_Main_light_lookup_string"},
- {"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library data-blocks", RNA_def_main_libraries, "rna_Main_library_lookup_string"},
- {"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen data-blocks", RNA_def_main_screens, "rna_Main_screen_lookup_string"},
- {"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager data-blocks", RNA_def_main_window_managers, "rna_Main_wm_lookup_string"},
- {"images", "Image", "rna_Main_image_begin", "Images", "Image data-blocks", RNA_def_main_images, "rna_Main_image_lookup_string"},
- {"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice data-blocks", RNA_def_main_lattices, "rna_Main_latt_lookup_string"},
- {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve data-blocks", RNA_def_main_curves, "rna_Main_curve_lookup_string"},
- {"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball data-blocks", RNA_def_main_metaballs, "rna_Main_mball_lookup_string"},
- {"fonts", "VectorFont", "rna_Main_font_begin", "Vector Fonts", "Vector font data-blocks", RNA_def_main_fonts, "rna_Main_font_lookup_string"},
- {"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture data-blocks", RNA_def_main_textures, "rna_Main_tex_lookup_string"},
- {"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush data-blocks", RNA_def_main_brushes, "rna_Main_brush_lookup_string"},
- {"worlds", "World", "rna_Main_world_begin", "Worlds", "World data-blocks", RNA_def_main_worlds, "rna_Main_world_lookup_string"},
- {"collections", "Collection", "rna_Main_collection_begin", "Collections", "Collection data-blocks", RNA_def_main_collections, "rna_Main_collection_lookup_string"},
- {"shape_keys", "Key", "rna_Main_key_begin", "Shape Keys", "Shape Key data-blocks", NULL, "rna_Main_key_lookup_string"},
- {"texts", "Text", "rna_Main_text_begin", "Texts", "Text data-blocks", RNA_def_main_texts, "rna_Main_text_lookup_string"},
- {"speakers", "Speaker", "rna_Main_speaker_begin", "Speakers", "Speaker data-blocks", RNA_def_main_speakers, "rna_Main_speaker_lookup_string"},
- {"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound data-blocks", RNA_def_main_sounds, "rna_Main_sound_lookup_string"},
- {"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature data-blocks", RNA_def_main_armatures, "rna_Main_armature_lookup_string"},
- {"actions", "Action", "rna_Main_action_begin", "Actions", "Action data-blocks", RNA_def_main_actions, "rna_Main_action_lookup_string"},
- {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle data-blocks", RNA_def_main_particles, "rna_Main_particle_lookup_string"},
- {"palettes", "Palette", "rna_Main_palettes_begin", "Palettes", "Palette data-blocks", RNA_def_main_palettes, "rna_Main_palette_lookup_string"},
- {"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil data-blocks", RNA_def_main_gpencil, "rna_Main_gpencil_lookup_string"},
- {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip data-blocks", RNA_def_main_movieclips, "rna_Main_movieclip_lookup_string"},
- {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks data-blocks", RNA_def_main_masks, "rna_Main_mask_lookup_string"},
- {"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style data-blocks", RNA_def_main_linestyles, "rna_Main_linestyle_lookup_string"},
- {"cache_files", "CacheFile", "rna_Main_cachefiles_begin", "Cache Files", "Cache Files data-blocks", RNA_def_main_cachefiles, "rna_Main_cachefile_lookup_string"},
- {"paint_curves", "PaintCurve", "rna_Main_paintcurves_begin", "Paint Curves", "Paint Curves data-blocks", RNA_def_main_paintcurves, "rna_Main_paintcurve_lookup_string"},
- {"workspaces", "WorkSpace", "rna_Main_workspaces_begin", "Workspaces", "Workspace data-blocks", RNA_def_main_workspaces, "rna_Main_workspace_lookup_string"},
- {"lightprobes", "LightProbe", "rna_Main_lightprobes_begin", "LightProbes", "LightProbe data-blocks", RNA_def_main_lightprobes, "rna_Main_lightprobe_lookup_string"},
- {NULL, NULL, NULL, NULL, NULL, NULL}
+ {"cameras", "Camera", "rna_Main_cameras_begin", "Cameras", "Camera data-blocks", RNA_def_main_cameras},
+ {"scenes", "Scene", "rna_Main_scenes_begin", "Scenes", "Scene data-blocks", RNA_def_main_scenes},
+ {"objects", "Object", "rna_Main_objects_begin", "Objects", "Object data-blocks", RNA_def_main_objects},
+ {"materials", "Material", "rna_Main_materials_begin", "Materials", "Material data-blocks", RNA_def_main_materials},
+ {"node_groups", "NodeTree", "rna_Main_nodetrees_begin", "Node Groups", "Node group data-blocks", RNA_def_main_node_groups},
+ {"meshes", "Mesh", "rna_Main_meshes_begin", "Meshes", "Mesh data-blocks", RNA_def_main_meshes},
+ {"lights", "Light", "rna_Main_lights_begin", "Lights", "Light data-blocks", RNA_def_main_lights},
+ {"libraries", "Library", "rna_Main_libraries_begin", "Libraries", "Library data-blocks", RNA_def_main_libraries},
+ {"screens", "Screen", "rna_Main_screens_begin", "Screens", "Screen data-blocks", RNA_def_main_screens},
+ {"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager data-blocks", RNA_def_main_window_managers},
+ {"images", "Image", "rna_Main_images_begin", "Images", "Image data-blocks", RNA_def_main_images},
+ {"lattices", "Lattice", "rna_Main_lattices_begin", "Lattices", "Lattice data-blocks", RNA_def_main_lattices},
+ {"curves", "Curve", "rna_Main_curves_begin", "Curves", "Curve data-blocks", RNA_def_main_curves},
+ {"metaballs", "MetaBall", "rna_Main_metaballs_begin", "Metaballs", "Metaball data-blocks", RNA_def_main_metaballs},
+ {"fonts", "VectorFont", "rna_Main_fonts_begin", "Vector Fonts", "Vector font data-blocks", RNA_def_main_fonts},
+ {"textures", "Texture", "rna_Main_textures_begin", "Textures", "Texture data-blocks", RNA_def_main_textures},
+ {"brushes", "Brush", "rna_Main_brushes_begin", "Brushes", "Brush data-blocks", RNA_def_main_brushes},
+ {"worlds", "World", "rna_Main_worlds_begin", "Worlds", "World data-blocks", RNA_def_main_worlds},
+ {"collections", "Collection", "rna_Main_collections_begin", "Collections", "Collection data-blocks", RNA_def_main_collections},
+ {"shape_keys", "Key", "rna_Main_shapekeys_begin", "Shape Keys", "Shape Key data-blocks", NULL},
+ {"texts", "Text", "rna_Main_texts_begin", "Texts", "Text data-blocks", RNA_def_main_texts},
+ {"speakers", "Speaker", "rna_Main_speakers_begin", "Speakers", "Speaker data-blocks", RNA_def_main_speakers},
+ {"sounds", "Sound", "rna_Main_sounds_begin", "Sounds", "Sound data-blocks", RNA_def_main_sounds},
+ {"armatures", "Armature", "rna_Main_armatures_begin", "Armatures", "Armature data-blocks", RNA_def_main_armatures},
+ {"actions", "Action", "rna_Main_actions_begin", "Actions", "Action data-blocks", RNA_def_main_actions},
+ {"particles", "ParticleSettings", "rna_Main_particles_begin", "Particles", "Particle data-blocks", RNA_def_main_particles},
+ {"palettes", "Palette", "rna_Main_palettes_begin", "Palettes", "Palette data-blocks", RNA_def_main_palettes},
+ {"grease_pencils", "GreasePencil", "rna_Main_gpencils_begin", "Grease Pencil", "Grease Pencil data-blocks", RNA_def_main_gpencil},
+ {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip data-blocks", RNA_def_main_movieclips},
+ {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks data-blocks", RNA_def_main_masks},
+ {"linestyles", "FreestyleLineStyle", "rna_Main_linestyles_begin", "Line Styles", "Line Style data-blocks", RNA_def_main_linestyles},
+ {"cache_files", "CacheFile", "rna_Main_cachefiles_begin", "Cache Files", "Cache Files data-blocks", RNA_def_main_cachefiles},
+ {"paint_curves", "PaintCurve", "rna_Main_paintcurves_begin", "Paint Curves", "Paint Curves data-blocks", RNA_def_main_paintcurves},
+ {"workspaces", "WorkSpace", "rna_Main_workspaces_begin", "Workspaces", "Workspace data-blocks", RNA_def_main_workspaces},
+ {"lightprobes", "LightProbe", "rna_Main_lightprobes_begin", "LightProbes", "LightProbe data-blocks", RNA_def_main_lightprobes},
+ {NULL, NULL, NULL, NULL, NULL, NULL},
};
int i;
@@ -658,7 +252,7 @@ void RNA_def_main(BlenderRNA *brna)
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, lists[i].lookup_string, NULL);
+ NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, lists[i].name, lists[i].description);
/* collection functions */
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index c6094dc2dc3..34e759325d1 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_main_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -39,7 +32,6 @@
#include "DNA_object_types.h"
#include "BLI_utildefines.h"
-#include "BLI_path_util.h"
#include "RNA_define.h"
#include "RNA_access.h"
@@ -61,7 +53,7 @@
#include "BKE_icons.h"
#include "BKE_idcode.h"
#include "BKE_image.h"
-#include "BKE_lamp.h"
+#include "BKE_light.h"
#include "BKE_lattice.h"
#include "BKE_library_remap.h"
#include "BKE_lightprobe.h"
@@ -89,7 +81,7 @@
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_curve_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_speaker_types.h"
@@ -118,6 +110,7 @@
#endif
#include "WM_api.h"
+#include "WM_types.h"
static void rna_idname_validate(const char *name, char *r_name)
@@ -133,11 +126,16 @@ static void rna_Main_ID_remove(
{
ID *id = id_ptr->data;
if (do_unlink) {
- BKE_libblock_delete(bmain, id);
+ BKE_id_delete(bmain, id);
RNA_POINTER_INVALIDATE(id_ptr);
+ /* Force full redraw, mandatory to avoid crashes when running this from UI... */
+ WM_main_add_notifier(NC_WINDOW, NULL);
}
else if (ID_REAL_USERS(id) <= 0) {
- BKE_libblock_free_ex(bmain, id, do_id_user, do_ui_user);
+ const int flag = (do_id_user ? 0 : LIB_ID_FREE_NO_USER_REFCOUNT) |
+ (do_ui_user ? 0 : LIB_ID_FREE_NO_UI_USER);
+ /* Still using ID flags here, this is in-between commit anyway... */
+ BKE_id_free_ex(bmain, id, flag, true);
RNA_POINTER_INVALIDATE(id_ptr);
}
else {
@@ -167,7 +165,7 @@ static Scene *rna_Main_scenes_new(Main *bmain, const char *name)
}
static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, bool do_unlink)
{
- /* don't call BKE_libblock_free(...) directly */
+ /* don't call BKE_id_free(...) directly */
Scene *scene = scene_ptr->data;
Scene *scene_new;
@@ -327,12 +325,12 @@ Mesh *rna_Main_meshes_new_from_object(
return BKE_mesh_new_from_object(depsgraph, bmain, sce, ob, apply_modifiers, calc_undeformed);
}
-static Lamp *rna_Main_lights_new(Main *bmain, const char *name, int type)
+static Light *rna_Main_lights_new(Main *bmain, const char *name, int type)
{
char safe_name[MAX_ID_NAME - 2];
rna_idname_validate(name, safe_name);
- Lamp *lamp = BKE_lamp_add(bmain, safe_name);
+ Light *lamp = BKE_light_add(bmain, safe_name);
lamp->type = type;
id_us_min(&lamp->id);
return lamp;
@@ -613,41 +611,41 @@ static LightProbe *rna_Main_lightprobe_new(Main *bmain, const char *name)
BKE_main_id_tag_listbase(&bmain->_listbase_name, LIB_TAG_DOIT, value); \
} \
-RNA_MAIN_ID_TAG_FUNCS_DEF(cameras, camera, ID_CA)
-RNA_MAIN_ID_TAG_FUNCS_DEF(scenes, scene, ID_SCE)
-RNA_MAIN_ID_TAG_FUNCS_DEF(objects, object, ID_OB)
-RNA_MAIN_ID_TAG_FUNCS_DEF(materials, mat, ID_MA)
-RNA_MAIN_ID_TAG_FUNCS_DEF(node_groups, nodetree, ID_NT)
-RNA_MAIN_ID_TAG_FUNCS_DEF(meshes, mesh, ID_ME)
-RNA_MAIN_ID_TAG_FUNCS_DEF(lights, lamp, ID_LA)
-RNA_MAIN_ID_TAG_FUNCS_DEF(libraries, library, ID_LI)
-RNA_MAIN_ID_TAG_FUNCS_DEF(screens, screen, ID_SCR)
+RNA_MAIN_ID_TAG_FUNCS_DEF(cameras, cameras, ID_CA)
+RNA_MAIN_ID_TAG_FUNCS_DEF(scenes, scenes, ID_SCE)
+RNA_MAIN_ID_TAG_FUNCS_DEF(objects, objects, ID_OB)
+RNA_MAIN_ID_TAG_FUNCS_DEF(materials, materials, ID_MA)
+RNA_MAIN_ID_TAG_FUNCS_DEF(node_groups, nodetrees, ID_NT)
+RNA_MAIN_ID_TAG_FUNCS_DEF(meshes, meshes, ID_ME)
+RNA_MAIN_ID_TAG_FUNCS_DEF(lights, lights, ID_LA)
+RNA_MAIN_ID_TAG_FUNCS_DEF(libraries, libraries, ID_LI)
+RNA_MAIN_ID_TAG_FUNCS_DEF(screens, screens, ID_SCR)
RNA_MAIN_ID_TAG_FUNCS_DEF(window_managers, wm, ID_WM)
-RNA_MAIN_ID_TAG_FUNCS_DEF(images, image, ID_IM)
-RNA_MAIN_ID_TAG_FUNCS_DEF(lattices, latt, ID_LT)
-RNA_MAIN_ID_TAG_FUNCS_DEF(curves, curve, ID_CU)
-RNA_MAIN_ID_TAG_FUNCS_DEF(metaballs, mball, ID_MB)
-RNA_MAIN_ID_TAG_FUNCS_DEF(fonts, vfont, ID_VF)
-RNA_MAIN_ID_TAG_FUNCS_DEF(textures, tex, ID_TE)
-RNA_MAIN_ID_TAG_FUNCS_DEF(brushes, brush, ID_BR)
-RNA_MAIN_ID_TAG_FUNCS_DEF(worlds, world, ID_WO)
-RNA_MAIN_ID_TAG_FUNCS_DEF(collections, collection, ID_GR)
+RNA_MAIN_ID_TAG_FUNCS_DEF(images, images, ID_IM)
+RNA_MAIN_ID_TAG_FUNCS_DEF(lattices, lattices, ID_LT)
+RNA_MAIN_ID_TAG_FUNCS_DEF(curves, curves, ID_CU)
+RNA_MAIN_ID_TAG_FUNCS_DEF(metaballs, metaballs, ID_MB)
+RNA_MAIN_ID_TAG_FUNCS_DEF(fonts, fonts, ID_VF)
+RNA_MAIN_ID_TAG_FUNCS_DEF(textures, textures, ID_TE)
+RNA_MAIN_ID_TAG_FUNCS_DEF(brushes, brushes, ID_BR)
+RNA_MAIN_ID_TAG_FUNCS_DEF(worlds, worlds, ID_WO)
+RNA_MAIN_ID_TAG_FUNCS_DEF(collections, collections, ID_GR)
//RNA_MAIN_ID_TAG_FUNCS_DEF(shape_keys, key, ID_KE)
-RNA_MAIN_ID_TAG_FUNCS_DEF(texts, text, ID_TXT)
-RNA_MAIN_ID_TAG_FUNCS_DEF(speakers, speaker, ID_SPK)
-RNA_MAIN_ID_TAG_FUNCS_DEF(sounds, sound, ID_SO)
-RNA_MAIN_ID_TAG_FUNCS_DEF(armatures, armature, ID_AR)
-RNA_MAIN_ID_TAG_FUNCS_DEF(actions, action, ID_AC)
-RNA_MAIN_ID_TAG_FUNCS_DEF(particles, particle, ID_PA)
+RNA_MAIN_ID_TAG_FUNCS_DEF(texts, texts, ID_TXT)
+RNA_MAIN_ID_TAG_FUNCS_DEF(speakers, speakers, ID_SPK)
+RNA_MAIN_ID_TAG_FUNCS_DEF(sounds, sounds, ID_SO)
+RNA_MAIN_ID_TAG_FUNCS_DEF(armatures, armatures, ID_AR)
+RNA_MAIN_ID_TAG_FUNCS_DEF(actions, actions, ID_AC)
+RNA_MAIN_ID_TAG_FUNCS_DEF(particles, particles, ID_PA)
RNA_MAIN_ID_TAG_FUNCS_DEF(palettes, palettes, ID_PAL)
-RNA_MAIN_ID_TAG_FUNCS_DEF(gpencil, gpencil, ID_GD)
-RNA_MAIN_ID_TAG_FUNCS_DEF(movieclips, movieclip, ID_MC)
-RNA_MAIN_ID_TAG_FUNCS_DEF(masks, mask, ID_MSK)
-RNA_MAIN_ID_TAG_FUNCS_DEF(linestyle, linestyle, ID_LS)
+RNA_MAIN_ID_TAG_FUNCS_DEF(gpencils, gpencils, ID_GD)
+RNA_MAIN_ID_TAG_FUNCS_DEF(movieclips, movieclips, ID_MC)
+RNA_MAIN_ID_TAG_FUNCS_DEF(masks, masks, ID_MSK)
+RNA_MAIN_ID_TAG_FUNCS_DEF(linestyle, linestyles, ID_LS)
RNA_MAIN_ID_TAG_FUNCS_DEF(cachefiles, cachefiles, ID_CF)
RNA_MAIN_ID_TAG_FUNCS_DEF(paintcurves, paintcurves, ID_PC)
RNA_MAIN_ID_TAG_FUNCS_DEF(workspaces, workspaces, ID_WS)
-RNA_MAIN_ID_TAG_FUNCS_DEF(lightprobes, lightprobe, ID_LP)
+RNA_MAIN_ID_TAG_FUNCS_DEF(lightprobes, lightprobes, ID_LP)
#undef RNA_MAIN_ID_TAG_FUNCS_DEF
@@ -828,7 +826,7 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
static const EnumPropertyItem dummy_items[] = {
{0, "DUMMY", 0, "", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_property_srna(cprop, "BlendDataNodeTrees");
@@ -1663,7 +1661,7 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "Main");
RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
- func = RNA_def_function(srna, "tag", "rna_Main_gpencil_tag");
+ func = RNA_def_function(srna, "tag", "rna_Main_gpencils_tag");
parm = RNA_def_boolean(func, "value", 0, "Value", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c
index 31d195ebdbd..4f5c35b742b 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_mask.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -32,7 +25,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_mask_types.h"
-#include "DNA_object_types.h" /* SELECT */
+#include "DNA_object_types.h" /* SELECT */
#include "DNA_scene_types.h"
#include "BLT_translation.h"
@@ -596,12 +589,14 @@ static void rna_def_maskParent(BlenderRNA *brna)
static const EnumPropertyItem mask_id_type_items[] = {
{ID_MC, "MOVIECLIP", ICON_SEQUENCE, "Movie Clip", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
static const EnumPropertyItem parent_type_items[] = {
{MASK_PARENT_POINT_TRACK, "POINT_TRACK", 0, "Point Track", ""},
{MASK_PARENT_PLANE_TRACK, "PLANE_TRACK", 0, "Plane Track", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
srna = RNA_def_struct(brna, "MaskParent", NULL);
RNA_def_struct_ui_text(srna, "Mask Parent", "Parenting settings for masking element");
@@ -684,7 +679,8 @@ static void rna_def_maskSplinePoint(BlenderRNA *brna)
{HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""},
{HD_ALIGN_DOUBLESIDE, "ALIGNED_DOUBLESIDE", 0, "Aligned", ""},
{HD_FREE, "FREE", 0, "Free", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
rna_def_maskSplinePointUW(brna);
@@ -829,13 +825,13 @@ static void rna_def_maskSpline(BlenderRNA *brna)
static const EnumPropertyItem spline_interpolation_items[] = {
{MASK_SPLINE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
{MASK_SPLINE_INTERP_EASE, "EASE", 0, "Ease", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem spline_offset_mode_items[] = {
{MASK_SPLINE_OFFSET_EVEN, "EVEN", 0, "Even", "Calculate even feather offset"},
{MASK_SPLINE_OFFSET_SMOOTH, "SMOOTH", 0, "Smooth", "Calculate feather offset as a second curve"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -900,7 +896,7 @@ static void rna_def_mask_layer(BlenderRNA *brna)
{MASK_BLEND_MUL, "MUL", 0, "Multiply", ""},
{MASK_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
{MASK_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index a5b02db6a28..4c400b4fb2e 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_material.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <float.h>
@@ -62,7 +56,7 @@ const EnumPropertyItem rna_enum_ramp_blend_items[] = {
{MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
{MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
{MA_RAMP_VAL, "VALUE", 0, "Value", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -142,7 +136,7 @@ static void rna_Material_texpaint_begin(CollectionPropertyIterator *iter, Pointe
}
-static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
bScreen *sc;
Material *ma = ptr->id.data;
@@ -163,7 +157,7 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s
if (ma->texpaintslot) {
Image *image = ma->texpaintslot[ma->paint_active_slot].ima;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
wmWindow *win = ED_screen_window_find(sc, bmain->wm.first);
if (win == NULL) {
continue;
@@ -182,7 +176,7 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s
if (sl->spacetype == SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)sl;
if (!sima->pin) {
- ED_space_image_set(bmain, sima, scene, obedit, image);
+ ED_space_image_set(bmain, sima, obedit, image);
}
}
}
@@ -354,7 +348,7 @@ static void rna_def_material_display(StructRNA *srna)
prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "r");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material");
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
@@ -409,14 +403,14 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
{GP_STYLE_MODE_LINE, "LINE", 0, "Line", "Draw strokes using a continuous line"},
{GP_STYLE_MODE_DOTS, "DOTS", 0, "Dots", "Draw strokes using separated dots"},
{GP_STYLE_MODE_BOX, "BOX", 0, "Boxes", "Draw strokes using separated rectangle boxes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* stroke styles */
static EnumPropertyItem stroke_style_items[] = {
{GP_STYLE_STROKE_STYLE_SOLID, "SOLID", 0, "Solid", "Draw strokes with solid color"},
{GP_STYLE_STROKE_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Draw strokes using texture"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* fill styles */
@@ -425,13 +419,13 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
{GP_STYLE_FILL_STYLE_GRADIENT, "GRADIENT", 0, "Gradient", "Fill area with gradient color"},
{GP_STYLE_FILL_STYLE_CHESSBOARD, "CHESSBOARD", 0, "Checker Board", "Fill area with chessboard pattern"},
{GP_STYLE_FILL_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Fill area with image texture"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem fill_gradient_items[] = {
{GP_STYLE_GRADIENT_LINEAR, "LINEAR", 0, "Linear", "Fill area with gradient color"},
{GP_STYLE_GRADIENT_RADIAL, "RADIAL", 0, "Radial", "Fill area with radial gradient"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MaterialGPencilStyle", NULL);
@@ -667,7 +661,7 @@ void RNA_def_material(BlenderRNA *brna)
{MA_MONKEY, "MONKEY", ICON_MONKEY, "Monkey", "Monkey"},
{MA_HAIR, "HAIR", ICON_HAIR, "Hair", "Hair strands"},
{MA_SPHERE_A, "SPHERE_A", ICON_MAT_SPHERE_SKY, "World Sphere", "Large sphere with sky"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem prop_eevee_blend_items[] = {
@@ -677,7 +671,7 @@ void RNA_def_material(BlenderRNA *brna)
{MA_BM_CLIP, "CLIP", 0, "Alpha Clip", "Use the alpha threshold to clip the visibility (binary visibility)"},
{MA_BM_HASHED, "HASHED", 0, "Alpha Hashed", "Use noise to dither the binary visibility (works well with multi-samples)"},
{MA_BM_BLEND, "BLEND", 0, "Alpha Blend", "Render polygon transparent, depending on alpha channel of the texture"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem prop_eevee_blend_shadow_items[] = {
@@ -685,7 +679,7 @@ void RNA_def_material(BlenderRNA *brna)
{MA_BS_SOLID, "OPAQUE", 0, "Opaque", "Material will cast shadows without transparency"},
{MA_BS_CLIP, "CLIP", 0, "Clip", "Use the alpha threshold to clip the visibility (binary visibility)"},
{MA_BS_HASHED, "HASHED", 0, "Hashed", "Use noise to dither the binary visibility and use filtering to reduce the noise"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Material", "ID");
diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c
index 268655d77bf..6a8021e16eb 100644
--- a/source/blender/makesrna/intern/rna_material_api.c
+++ b/source/blender/makesrna/intern/rna_material_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_material_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 40690731b76..c9a8da51e40 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
/* note: the original vertex color stuff is now just used for
* getting info on the layers themselves, accessing the data is
* done through the (not yet written) mpoly interfaces.*/
-/** \file blender/makesrna/intern/rna_mesh.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -53,7 +47,7 @@
#include "WM_types.h"
const EnumPropertyItem rna_enum_mesh_delimit_mode_items[] = {
- {BMO_DELIM_NORMAL, "NORMAL", 0, "Normal", "Delimit by face directions"},
+ {BMO_DELIM_NORMAL, "NORMAL", 0, "Regular", "Delimit by face directions"},
{BMO_DELIM_MATERIAL, "MATERIAL", 0, "Material", "Delimit by face material"},
{BMO_DELIM_SEAM, "SEAM", 0, "Seam", "Delimit by edge seams"},
{BMO_DELIM_SHARP, "SHARP", 0, "Sharp", "Delimit by sharp edges"},
@@ -93,27 +87,27 @@ static Mesh *rna_mesh(PointerRNA *ptr)
static CustomData *rna_mesh_vdata_helper(Mesh *me)
{
- return (me->edit_btmesh) ? &me->edit_btmesh->bm->vdata : &me->vdata;
+ return (me->edit_mesh) ? &me->edit_mesh->bm->vdata : &me->vdata;
}
static CustomData *rna_mesh_edata_helper(Mesh *me)
{
- return (me->edit_btmesh) ? &me->edit_btmesh->bm->edata : &me->edata;
+ return (me->edit_mesh) ? &me->edit_mesh->bm->edata : &me->edata;
}
static CustomData *rna_mesh_pdata_helper(Mesh *me)
{
- return (me->edit_btmesh) ? &me->edit_btmesh->bm->pdata : &me->pdata;
+ return (me->edit_mesh) ? &me->edit_mesh->bm->pdata : &me->pdata;
}
static CustomData *rna_mesh_ldata_helper(Mesh *me)
{
- return (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
+ return (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
}
static CustomData *rna_mesh_fdata_helper(Mesh *me)
{
- return (me->edit_btmesh) ? NULL : &me->fdata;
+ return (me->edit_mesh) ? NULL : &me->fdata;
}
static CustomData *rna_mesh_vdata(PointerRNA *ptr)
@@ -677,13 +671,13 @@ static void rna_MeshUVLoopLayer_data_begin(CollectionPropertyIterator *iter, Poi
{
Mesh *me = rna_mesh(ptr);
CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MLoopUV), (me->edit_btmesh) ? 0 : me->totloop, 0, NULL);
+ rna_iterator_array_begin(iter, layer->data, sizeof(MLoopUV), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
}
static int rna_MeshUVLoopLayer_data_length(PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
- return (me->edit_btmesh) ? 0 : me->totloop;
+ return (me->edit_mesh) ? 0 : me->totloop;
}
static bool rna_MeshUVLoopLayer_active_render_get(PointerRNA *ptr)
@@ -726,13 +720,13 @@ 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(MLoopCol), (me->edit_btmesh) ? 0 : me->totloop, 0, NULL);
+ rna_iterator_array_begin(iter, layer->data, sizeof(MLoopCol), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
}
static int rna_MeshLoopColorLayer_data_length(PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
- return (me->edit_btmesh) ? 0 : me->totloop;
+ return (me->edit_mesh) ? 0 : me->totloop;
}
static bool rna_MeshLoopColorLayer_active_render_get(PointerRNA *ptr)
@@ -1108,7 +1102,7 @@ static char *rna_VertCustomData_data_path(PointerRNA *ptr, const char *collectio
CustomDataLayer *cdl;
Mesh *me = rna_mesh(ptr);
CustomData *vdata = rna_mesh_vdata(ptr);
- int a, b, totvert = (me->edit_btmesh) ? 0 : me->totvert;
+ int a, b, totvert = (me->edit_mesh) ? 0 : me->totvert;
for (cdl = vdata->layers, a = 0; a < vdata->totlayer; cdl++, a++) {
if (cdl->type == type) {
@@ -1129,7 +1123,7 @@ static char *rna_PolyCustomData_data_path(PointerRNA *ptr, const char *collectio
CustomDataLayer *cdl;
Mesh *me = rna_mesh(ptr);
CustomData *pdata = rna_mesh_pdata(ptr);
- int a, b, totpoly = (me->edit_btmesh) ? 0 : me->totpoly;
+ int a, b, totpoly = (me->edit_mesh) ? 0 : me->totpoly;
for (cdl = pdata->layers, a = 0; a < pdata->totlayer; cdl++, a++) {
if (cdl->type == type) {
@@ -1150,7 +1144,7 @@ static char *rna_LoopCustomData_data_path(PointerRNA *ptr, const char *collectio
CustomDataLayer *cdl;
Mesh *me = rna_mesh(ptr);
CustomData *ldata = rna_mesh_ldata(ptr);
- int a, b, totloop = (me->edit_btmesh) ? 0 : me->totloop;
+ int a, b, totloop = (me->edit_mesh) ? 0 : me->totloop;
for (cdl = ldata->layers, a = 0; a < ldata->totlayer; cdl++, a++) {
if (cdl->type == type) {
@@ -1361,25 +1355,25 @@ static char *rna_MeshFaceMap_path(PointerRNA *ptr)
static int rna_Mesh_tot_vert_get(PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
- return me->edit_btmesh ? me->edit_btmesh->bm->totvertsel : 0;
+ return me->edit_mesh ? me->edit_mesh->bm->totvertsel : 0;
}
static int rna_Mesh_tot_edge_get(PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
- return me->edit_btmesh ? me->edit_btmesh->bm->totedgesel : 0;
+ return me->edit_mesh ? me->edit_mesh->bm->totedgesel : 0;
}
static int rna_Mesh_tot_face_get(PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
- return me->edit_btmesh ? me->edit_btmesh->bm->totfacesel : 0;
+ return me->edit_mesh ? me->edit_mesh->bm->totfacesel : 0;
}
-static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, const char *name)
+static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, const char *name, const bool do_init)
{
PointerRNA ptr;
CustomData *ldata;
CustomDataLayer *cdl = NULL;
- int index = ED_mesh_color_add(me, name, false);
+ int index = ED_mesh_color_add(me, name, false, do_init);
if (index != -1) {
ldata = rna_mesh_ldata_helper(me);
@@ -1421,12 +1415,12 @@ DEFINE_CUSTOMDATA_PROPERTY_API(polygon, int, CD_PROP_INT, pdata, totpoly, MeshPo
DEFINE_CUSTOMDATA_PROPERTY_API(polygon, string, CD_PROP_STR, pdata, totpoly, MeshPolygonStringPropertyLayer)
#undef DEFINE_CUSTOMDATA_PROPERTY_API
-static PointerRNA rna_Mesh_uv_layers_new(struct Mesh *me, const char *name)
+static PointerRNA rna_Mesh_uv_layers_new(struct Mesh *me, const char *name, const bool do_init)
{
PointerRNA ptr;
CustomData *ldata;
CustomDataLayer *cdl = NULL;
- int index = ED_mesh_uv_texture_add(me, name, false);
+ int index = ED_mesh_uv_texture_add(me, name, false, do_init);
if (index != -1) {
ldata = rna_mesh_ldata_helper(me);
@@ -1447,7 +1441,7 @@ static void rna_Mesh_uv_layers_remove(struct Mesh *me, ReportList *reports, Cust
static bool rna_Mesh_is_editmode_get(PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
- return (me->edit_btmesh != NULL);
+ return (me->edit_mesh != NULL);
}
/* only to quiet warnings */
@@ -2219,6 +2213,8 @@ static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
+ RNA_def_boolean(func, "do_init", true, "",
+ "Whether new layer's data should be initialized by copying current active one");
parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The newly created layer");
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
RNA_def_function_return(func, parm);
@@ -2261,6 +2257,9 @@ static void rna_def_uv_layers(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "new", "rna_Mesh_uv_layers_new");
RNA_def_function_ui_description(func, "Add a UV map layer to Mesh");
RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
+ RNA_def_boolean(func, "do_init", true, "",
+ "Whether new layer's data should be initialized by copying current active one, "
+ "or if none is active, with a default UVmap");
parm = RNA_def_pointer(func, "layer", "MeshUVLoopLayer", "", "The newly created layer");
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
RNA_def_function_return(func, parm);
@@ -2776,6 +2775,7 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
RNA_def_property_ui_text(prop, "Auto Texture Space",
"Adjust active object's texture space automatically when transforming object");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
#if 0
prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index 5f198d2e22e..7bedd110947 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_mesh_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -39,7 +32,6 @@
#include "BLI_sys_types.h"
#include "BLI_utildefines.h"
-#include "BLI_math.h"
#include "rna_internal.h" /* own include */
@@ -120,43 +112,11 @@ static void rna_Mesh_calc_smooth_groups(Mesh *mesh, bool use_bitflags, int *r_po
static void rna_Mesh_normals_split_custom_do(Mesh *mesh, float (*custom_loopnors)[3], const bool use_vertices)
{
- float (*polynors)[3];
- short (*clnors)[2];
- const int numloops = mesh->totloop;
- bool free_polynors = false;
-
- clnors = CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
- if (clnors) {
- memset(clnors, 0, sizeof(*clnors) * numloops);
- }
- else {
- clnors = CustomData_add_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL, CD_DEFAULT, NULL, numloops);
- }
-
- if (CustomData_has_layer(&mesh->pdata, CD_NORMAL)) {
- polynors = CustomData_get_layer(&mesh->pdata, CD_NORMAL);
- }
- else {
- polynors = MEM_mallocN(sizeof(float[3]) * mesh->totpoly, __func__);
- BKE_mesh_calc_normals_poly(
- mesh->mvert, NULL, mesh->totvert,
- mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, polynors, false);
- free_polynors = true;
- }
-
if (use_vertices) {
- BKE_mesh_normals_loop_custom_from_vertices_set(
- mesh->mvert, custom_loopnors, mesh->totvert, mesh->medge, mesh->totedge, mesh->mloop, mesh->totloop,
- mesh->mpoly, (const float (*)[3])polynors, mesh->totpoly, clnors);
+ BKE_mesh_set_custom_normals_from_vertices(mesh, custom_loopnors);
}
else {
- BKE_mesh_normals_loop_custom_set(
- mesh->mvert, mesh->totvert, mesh->medge, mesh->totedge, mesh->mloop, custom_loopnors, mesh->totloop,
- mesh->mpoly, (const float (*)[3])polynors, mesh->totpoly, clnors);
- }
-
- if (free_polynors) {
- MEM_freeN(polynors);
+ BKE_mesh_set_custom_normals(mesh, custom_loopnors);
}
}
diff --git a/source/blender/makesrna/intern/rna_mesh_utils.h b/source/blender/makesrna/intern/rna_mesh_utils.h
index b16a7254a86..898d904da96 100644
--- a/source/blender/makesrna/intern/rna_mesh_utils.h
+++ b/source/blender/makesrna/intern/rna_mesh_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Andrew Wiggin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_mesh_utils.h
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#ifndef __RNA_MESH_UTILS_H__
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index af674cd2763..0f4cd4759bc 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Juho Vepsalainen, Jiri Hnidek
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_meta.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -101,7 +95,7 @@ static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
/* cheating way for importers to avoid slow updates */
if (mb->id.us > 0) {
- for (ob = bmain->object.first; ob; ob = ob->id.next)
+ for (ob = bmain->objects.first; ob; ob = ob->id.next)
if (ob->data == mb)
BKE_mball_properties_copy(scene, ob);
@@ -302,7 +296,7 @@ static void rna_def_metaball(BlenderRNA *brna)
{MB_UPDATE_HALFRES, "HALFRES", 0, "Half", "While editing, update metaball in half resolution"},
{MB_UPDATE_FAST, "FAST", 0, "Fast", "While editing, update metaball without polygonization"},
{MB_UPDATE_NEVER, "NEVER", 0, "Never", "While editing, don't update metaball at all"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MetaBall", "ID");
diff --git a/source/blender/makesrna/intern/rna_meta_api.c b/source/blender/makesrna/intern/rna_meta_api.c
index e747a849c12..2cc4bb5adec 100644
--- a/source/blender/makesrna/intern/rna_meta_api.c
+++ b/source/blender/makesrna/intern/rna_meta_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_meta_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 6d8f6776f02..0389410b279 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Juho Veps‰l‰inen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_modifier.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -122,7 +116,7 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = {
{eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
{eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
{eModifierType_Surface, "SURFACE", ICON_MODIFIER, "Surface", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[] = {
@@ -132,13 +126,13 @@ const EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[] = {
"Split the quads on the 2nd and 4th vertices"},
{MOD_TRIANGULATE_QUAD_SHORTEDGE, "SHORTEST_DIAGONAL", 0, "Shortest Diagonal",
"Split the quads based on the distance between the vertices"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[] = {
{MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY", 0, "Beauty", "Arrange the new triangles evenly (slow)"},
{MOD_TRIANGULATE_NGON_EARCLIP, "CLIP", 0, "Clip", "Split the polygons with an ear clipping algorithm"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_modifier_shrinkwrap_mode_items[] = {
@@ -155,7 +149,7 @@ const EnumPropertyItem rna_enum_modifier_shrinkwrap_mode_items[] = {
{MOD_SHRINKWRAP_ABOVE_SURFACE, "ABOVE_SURFACE", 0, "Above Surface",
"The point is constrained to the surface of the target object, "
"with distance offset applied exactly along the target normal"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -171,7 +165,7 @@ static const EnumPropertyItem modifier_warp_falloff_items[] = {
{eWarp_Falloff_Sharp, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
{eWarp_Falloff_Linear, "LINEAR", ICON_LINCURVE, "Linear", ""},
{eWarp_Falloff_Const, "CONSTANT", ICON_NOCURVE, "Constant", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -192,7 +186,7 @@ const EnumPropertyItem rna_enum_dt_method_vertex_items[] = {
"Copy from interpolated values of vertices from closest point on closest face"},
{MREMAP_MODE_VERT_POLYINTERP_VNORPROJ, "POLYINTERP_VNORPROJ", 0, "Projected Face Interpolated",
"Copy from interpolated values of vertices from point on closest face hit by normal-projection"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_method_edge_items[] = {
@@ -206,7 +200,7 @@ const EnumPropertyItem rna_enum_dt_method_edge_items[] = {
"Copy from closest edge of closest face (using midpoints)"},
{MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ, "EDGEINTERP_VNORPROJ", 0, "Projected Edge Interpolated",
"Interpolate all source edges hit by the projection of destination one along its own normal (from vertices)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_method_loop_items[] = {
@@ -222,7 +216,7 @@ const EnumPropertyItem rna_enum_dt_method_loop_items[] = {
"Copy from interpolated corners of the nearest source polygon"},
{MREMAP_MODE_LOOP_POLYINTERP_LNORPROJ, "POLYINTERP_LNORPROJ", 0, "Projected Face Interpolated",
"Copy from interpolated corners of the source polygon hit by corner normal projection"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_method_poly_items[] = {
@@ -234,7 +228,7 @@ const EnumPropertyItem rna_enum_dt_method_poly_items[] = {
"Copy from source polygon which normal is the closest to destination one"},
{MREMAP_MODE_POLY_POLYINTERP_PNORPROJ, "POLYINTERP_PNORPROJ", 0, "Projected Face Interpolated",
"Interpolate all source polygons intersected by the projection of destination one along its own normal"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_mix_mode_items[] = {
@@ -253,7 +247,7 @@ const EnumPropertyItem rna_enum_dt_mix_mode_items[] = {
{CDT_MIX_MUL, "MUL", 0, "Multiply",
"Multiply source value to destination one, using given threshold as factor"},
/* etc. etc. */
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_layers_select_src_items[] = {
@@ -265,7 +259,7 @@ const EnumPropertyItem rna_enum_dt_layers_select_src_items[] = {
"Transfer all vertex groups used by selected pose bones"},
{DT_LAYERS_VGROUP_SRC_BONE_DEFORM, "BONE_DEFORM", 0, "Deform Pose Bones",
"Transfer all vertex groups used by deform bones"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_layers_select_dst_items[] = {
@@ -275,27 +269,27 @@ const EnumPropertyItem rna_enum_dt_layers_select_dst_items[] = {
"Match target data layers to affect by name"},
{DT_LAYERS_INDEX_DST, "INDEX", 0, "By Order",
"Match target data layers to affect by order (indices)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_axis_xy_items[] = {
{0, "X", 0, "X", ""},
{1, "Y", 0, "Y", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_axis_xyz_items[] = {
{0, "X", 0, "X", ""},
{1, "Y", 0, "Y", ""},
{2, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_axis_flag_xyz_items[] = {
{(1 << 0), "X", 0, "X", ""},
{(1 << 1), "Y", 0, "Y", ""},
{(1 << 2), "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -946,7 +940,9 @@ static const EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
- me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, CD_MASK_BAREMESH | CD_MLOOPUV);
+ CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH;
+ cddata_masks.lmask |= CD_MASK_MLOOPUV;
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, &cddata_masks);
num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPUV);
RNA_enum_item_add_separator(&item, &totitem);
@@ -968,7 +964,9 @@ static const EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
- me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, CD_MASK_BAREMESH | CD_MLOOPCOL);
+ CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH;
+ cddata_masks.lmask |= CD_MASK_MLOOPCOL;
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, &cddata_masks);
num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPCOL);
RNA_enum_item_add_separator(&item, &totitem);
@@ -1206,7 +1204,7 @@ static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const c
static const EnumPropertyItem prop_subdivision_type_items[] = {
{SUBSURF_TYPE_CATMULL_CLARK, "CATMULL_CLARK", 0, "Catmull-Clark", ""},
{SUBSURF_TYPE_SIMPLE, "SIMPLE", 0, "Simple", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_uv_smooth_items[] = {
@@ -1226,7 +1224,7 @@ static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const c
{SUBSURF_UV_SMOOTH_ALL, "PRESERVE_BOUNDARIES", 0,
"Smooth all", "UVs and boundaries are smoothed"},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -1293,7 +1291,7 @@ static void rna_def_modifier_generic_map_info(StructRNA *srna)
{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}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -1472,7 +1470,7 @@ static void rna_def_modifier_curve(BlenderRNA *brna)
{MOD_CURVE_NEGX, "NEG_X", 0, "-X", ""},
{MOD_CURVE_NEGY, "NEG_Y", 0, "-Y", ""},
{MOD_CURVE_NEGZ, "NEG_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "CurveModifier", "Modifier");
@@ -1639,7 +1637,7 @@ static void rna_def_modifier_decimate(BlenderRNA *brna)
{MOD_DECIM_MODE_COLLAPSE, "COLLAPSE", 0, "Collapse", "Use edge collapsing"},
{MOD_DECIM_MODE_UNSUBDIV, "UNSUBDIV", 0, "Un-Subdivide", "Use un-subdivide face reduction"},
{MOD_DECIM_MODE_DISSOLVE, "DISSOLVE", 0, "Planar", "Dissolve geometry to form planar polygons"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Note, keep in sync with operator 'MESH_OT_decimate' */
@@ -1710,7 +1708,7 @@ static void rna_def_modifier_decimate(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Axis", "Axis of symmetry");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "vertex_group_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "vertex_group_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "defgrp_factor");
RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_range(prop, 0, 10, 1, 4);
@@ -1785,7 +1783,7 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Z Normal", "Enable displacement along the Z normal");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_TIME);
RNA_def_property_float_sdna(prop, NULL, "timeoffs");
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
RNA_def_property_ui_text(prop, "Time Offset",
@@ -1928,7 +1926,7 @@ static void rna_def_modifier_hook(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "HookModifierData");
RNA_def_struct_ui_icon(srna, ICON_HOOK);
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "force");
RNA_def_property_range(prop, 0, 1);
RNA_def_property_ui_text(prop, "Strength", "Relative force of the hook");
@@ -2021,7 +2019,7 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
"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}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "BooleanModifier", "Modifier");
@@ -2037,6 +2035,7 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_operation_items);
+ RNA_def_property_enum_default(prop, eBooleanModifierOp_Difference);
RNA_def_property_ui_text(prop, "Operation", "");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2054,7 +2053,7 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
{eBooleanModifierBMeshFlag_BMesh_Separate, "SEPARATE", 0, "Separate", ""},
{eBooleanModifierBMeshFlag_BMesh_NoDissolve, "NO_DISSOLVE", 0, "No Dissolve", ""},
{eBooleanModifierBMeshFlag_BMesh_NoConnectRegions, "NO_CONNECT_REGIONS", 0, "No Connect Regions", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "debug_options", PROP_ENUM, PROP_NONE);
@@ -2075,7 +2074,7 @@ static void rna_def_modifier_array(BlenderRNA *brna)
{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}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ArrayModifier", "Modifier");
@@ -2235,13 +2234,13 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
"Use the texture's intensity value to displace along the (averaged) custom normal (falls back to vertex)"},
{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}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_space_items[] = {
{MOD_DISP_SPACE_LOCAL, "LOCAL", 0, "Local", "Direction is defined in local coordinates"},
{MOD_DISP_SPACE_GLOBAL, "GLOBAL", 0, "Global", "Direction is defined in global coordinates"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "DisplaceModifier", "Modifier");
@@ -2379,7 +2378,7 @@ static void rna_def_modifier_smooth(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "fac");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -10, 10, 1, 3);
@@ -2411,7 +2410,7 @@ static void rna_def_modifier_correctivesmooth(BlenderRNA *brna)
"Use the average of adjacent edge-vertices"},
{MOD_CORRECTIVESMOOTH_SMOOTH_LENGTH_WEIGHT, "LENGTH_WEIGHTED", 0, "Length Weight",
"Use the average of adjacent edge-vertices weighted by their length"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem modifier_rest_source_items[] = {
@@ -2419,7 +2418,7 @@ static void rna_def_modifier_correctivesmooth(BlenderRNA *brna)
"Use base mesh vert coords as the rest position"},
{MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND, "BIND", 0, "Bind Coords",
"Use bind vert coords for rest position"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "CorrectiveSmoothModifier", "Modifier");
@@ -2427,7 +2426,7 @@ static void rna_def_modifier_correctivesmooth(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "CorrectiveSmoothModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "lambda");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 3);
@@ -2556,7 +2555,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
{MOD_CAST_TYPE_SPHERE, "SPHERE", 0, "Sphere", ""},
{MOD_CAST_TYPE_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
{MOD_CAST_TYPE_CUBOID, "CUBOID", 0, "Cuboid", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "CastModifier", "Modifier");
@@ -2602,7 +2601,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use transform", "Use object transform to control projection shape");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "fac");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -10, 10, 5, 2);
@@ -2638,7 +2637,7 @@ static void rna_def_modifier_meshdeform(BlenderRNA *brna)
static const EnumPropertyItem prop_mode_items[] = {
{0, "VOLUME", 0, "Volume", "Bind to volume inside cage mesh"},
{1, "SURFACE", 0, "Surface", "Bind to surface of cage mesh"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -2714,7 +2713,7 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
static EnumPropertyItem particleinstance_space[] = {
{eParticleInstanceSpace_Local, "LOCAL", 0, "Local", "Use offset from the particle object in the instance object"},
{eParticleInstanceSpace_World, "WORLD", 0, "World", "Use world space offset in the instance object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ParticleInstanceModifier", "Modifier");
@@ -2757,7 +2756,7 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Parents);
- RNA_def_property_ui_text(prop, "Normal", "Create instances from normal particles");
+ RNA_def_property_ui_text(prop, "Regular", "Create instances from normal particles");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "use_children", PROP_BOOLEAN, PROP_NONE);
@@ -2949,7 +2948,7 @@ static void rna_def_modifier_smoke(BlenderRNA *brna)
{MOD_SMOKE_TYPE_DOMAIN, "DOMAIN", 0, "Domain", ""},
{MOD_SMOKE_TYPE_FLOW, "FLOW", 0, "Flow", "Inflow/Outflow"},
{MOD_SMOKE_TYPE_COLL, "COLLISION", 0, "Collision", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SmokeModifier", "Modifier");
@@ -3032,7 +3031,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
"Use bevel weights to determine how much bevel is applied in edge mode"},
{MOD_BEVEL_VGROUP, "VGROUP", 0, "Vertex Group",
"Use vertex group weights to select whether vertex or edge is beveled"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_val_type_items[] = {
@@ -3040,15 +3039,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
{MOD_BEVEL_AMT_WIDTH, "WIDTH", 0, "Width", "Amount is width of new face"},
{MOD_BEVEL_AMT_DEPTH, "DEPTH", 0, "Depth", "Amount is perpendicular distance from original edge to bevel face"},
{MOD_BEVEL_AMT_PERCENT, "PERCENT", 0, "Percent", "Amount is percent of adjacent edge length"},
- {0, NULL, 0, NULL, NULL}
- };
-
- /* TO BE DEPRECATED */
- static const EnumPropertyItem prop_edge_weight_method_items[] = {
- {0, "AVERAGE", 0, "Average", ""},
- {MOD_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""},
- {MOD_BEVEL_EMAX, "LARGEST", 0, "Largest", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem prop_harden_normals_items[] = {
@@ -3060,6 +3051,13 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
{ 0, NULL, 0, NULL, NULL },
};
+ static EnumPropertyItem prop_miter_items[] = {
+ { MOD_BEVEL_MITER_SHARP, "MITER_SHARP", 0, "Sharp", "Default sharp miter" },
+ { MOD_BEVEL_MITER_PATCH, "MITER_PATCH", 0, "Patch", "Miter with extra corner" },
+ { MOD_BEVEL_MITER_ARC, "MITER_ARC", 0, "Arc", "Miter with curved arc" },
+ { 0, NULL, 0, NULL, NULL },
+ };
+
srna = RNA_def_struct(brna, "BevelModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded");
RNA_def_struct_sdna(srna, "BevelModifierData");
@@ -3069,7 +3067,14 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "value");
RNA_def_property_range(prop, 0, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 4);
- RNA_def_property_ui_text(prop, "Width", "Bevel value/amount");
+ RNA_def_property_ui_text(prop, "Width", "Bevel amount");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "width_pct", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 5.0, 2);
+ RNA_def_property_ui_text(prop, "Width Percent", "Bevel amount for percentage method");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "segments", PROP_INT, PROP_NONE);
@@ -3089,13 +3094,6 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Limit Method", "");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- /* TO BE DEPRECATED */
- prop = RNA_def_property(srna, "edge_weight_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "e_flags");
- RNA_def_property_enum_items(prop, prop_edge_weight_method_items);
- RNA_def_property_ui_text(prop, "Edge Weight Method", "What edge weight to use for weighting a vertex");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "bevel_angle");
RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
@@ -3150,7 +3148,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
prop = RNA_def_property(srna, "harden_normals", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_HARDEN_NORMALS);
RNA_def_property_ui_text(prop, "Harden Normals",
- "Match normals of new faces to adjacent faces");
+ "Match normals of new faces to adjacent faces");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "face_strength_mode", PROP_ENUM, PROP_NONE);
@@ -3158,6 +3156,25 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_enum_items(prop, prop_harden_normals_items);
RNA_def_property_ui_text(prop, "Set Face Strength", "Whether to set face strength, and which faces to set it on");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "miter_outer", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "miter_outer");
+ RNA_def_property_enum_items(prop, prop_miter_items);
+ RNA_def_property_ui_text(prop, "Outer Miter", "Pattern to use for outside of miters");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "miter_inner", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "miter_inner");
+ RNA_def_property_enum_items(prop, prop_miter_items);
+ RNA_def_property_ui_text(prop, "Inner Miter", "Pattern to use for inside of miters");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "spread", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "spread");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 4);
+ RNA_def_property_ui_text(prop, "Spread", "Spread distance for inner miter arcs");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
@@ -3175,14 +3192,14 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
{MOD_SHRINKWRAP_TARGET_PROJECT, "TARGET_PROJECT", 0, "Target Normal Project",
"Shrink the mesh to the nearest target surface "
"along the interpolated vertex normals of the target"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem shrink_face_cull_items[] = {
{0, "OFF", 0, "Off", "No culling"},
{MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, "FRONT", 0, "Front", "No projection when in front of the face"},
{MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, "BACK", 0, "Back", "No projection when behind the face"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
@@ -3231,14 +3248,14 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShrinkwrapModifier_vgroup_name_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "keepDist");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -100, 100, 1, 2);
RNA_def_property_ui_text(prop, "Offset", "Distance to keep from the target");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_UNIT_LENGTH);
RNA_def_property_float_sdna(prop, NULL, "projLimit");
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_ui_range(prop, 0, 100, 1, 2);
@@ -3314,7 +3331,7 @@ static void rna_def_modifier_mask(BlenderRNA *brna)
static const EnumPropertyItem modifier_mask_mode_items[] = {
{MOD_MASK_MODE_VGROUP, "VERTEX_GROUP", 0, "Vertex Group", ""},
{MOD_MASK_MODE_ARM, "ARMATURE", 0, "Armature", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MaskModifier", "Modifier");
@@ -3364,7 +3381,7 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
{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"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
@@ -3735,7 +3752,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna), StructRNA *
{MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use global coordinates"},
{MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object", "Use local generated coordinates of another object"},
{MOD_DISP_MAP_UV, "UV", 0, "UV", "Use coordinates from an UV layer"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem weightvg_mask_tex_used_items[] = {
@@ -3747,7 +3764,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna), StructRNA *
{MOD_WVG_MASK_TEX_USE_SAT, "SAT", 0, "Saturation", ""},
{MOD_WVG_MASK_TEX_USE_VAL, "VAL", 0, "Value", ""},
{MOD_WVG_MASK_TEX_USE_ALPHA, "ALPHA", 0, "Alpha", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -3767,7 +3784,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna), StructRNA *
prop = RNA_def_property(srna, "mask_texture", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Masking Tex", "Masking texture");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
prop = RNA_def_property(srna, "mask_tex_use_channel", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, weightvg_mask_tex_used_items);
@@ -3806,7 +3823,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
{MOD_WVG_MAPPING_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", ""},
{MOD_WVG_MAPPING_STEP, "STEP", ICON_NOCURVE /* Would need a better icon... */, "Median Step",
"Map all values below 0.5 to 0.0, and all others to 1.0"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -3885,7 +3902,7 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
{MOD_WVG_MIX_DIV, "DIV", 0, "Divide", "Divide VGroup A's weights by VGroup B's ones"},
{MOD_WVG_MIX_DIF, "DIF", 0, "Difference", "Difference between VGroup A's and VGroup B's weights"},
{MOD_WVG_MIX_AVG, "AVG", 0, "Average", "Average value of VGroup A's and VGroup B's weights"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem weightvg_mix_set_items[] = {
@@ -3895,7 +3912,7 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
{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}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -3919,14 +3936,14 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGMixModifier_defgrp_name_b_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "default_weight_a", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "default_weight_a", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0, 1.0f);
RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
RNA_def_property_ui_text(prop, "Default Weight A", "Default weight a vertex will have if "
"it is not in the first A vgroup");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "default_weight_b", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "default_weight_b", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0, 1.0f);
RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
RNA_def_property_ui_text(prop, "Default Weight B", "Default weight a vertex will have if "
@@ -3957,14 +3974,14 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
{MOD_WVG_PROXIMITY_GEOMETRY, "GEOMETRY", 0, "Geometry",
"Use distance between affected object's vertices and target "
"object, or target object's geometry"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem proximity_geometry_items[] = {
{MOD_WVG_PROXIMITY_GEOM_VERTS, "VERTEX", 0, "Vertex", "Compute distance to nearest vertex"},
{MOD_WVG_PROXIMITY_GEOM_EDGES, "EDGE", 0, "Edge", "Compute distance to nearest edge"},
{MOD_WVG_PROXIMITY_GEOM_FACES, "FACE", 0, "Face", "Compute distance to nearest face"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem weightvg_proximity_falloff_type_items[] = {
@@ -3977,7 +3994,7 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
{MOD_WVG_MAPPING_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", ""},
{MOD_WVG_MAPPING_STEP, "STEP", ICON_NOCURVE /* Would need a better icon... */, "Median Step",
"Map all values below 0.5 to 0.0, and all others to 1.0"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -4048,7 +4065,7 @@ static void rna_def_modifier_remesh(BlenderRNA *brna)
{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"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -4118,7 +4135,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
{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}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "OceanModifier", "Modifier");
@@ -4262,13 +4279,13 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Random Seed", "Seed of the random generator");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_UNSIGNED);
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "bakestart");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Bake Start", "Start frame of the ocean baking");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_UNSIGNED);
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "bakeend");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Bake End", "End frame of the ocean baking");
@@ -4343,6 +4360,13 @@ static void rna_def_modifier_triangulate(BlenderRNA *brna)
RNA_def_property_enum_items(prop, rna_enum_modifier_triangulate_ngon_method_items);
RNA_def_property_ui_text(prop, "Polygon Method", "Method for splitting the polygons into triangles");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "keep_custom_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_TRIANGULATE_KEEP_CUSTOMLOOP_NORMALS);
+ RNA_def_property_ui_text(prop, "Keep Normals",
+ "Try to preserve custom normals (WARNING: depending on chosen triangulation method, "
+ "shading may not be fully preserved, 'Fixed' method usually gives the best result here)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_meshcache(BlenderRNA *brna)
@@ -4350,7 +4374,7 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna)
static const EnumPropertyItem prop_format_type_items[] = {
{MOD_MESHCACHE_TYPE_MDD, "MDD", 0, "MDD ", ""},
{MOD_MESHCACHE_TYPE_PC2, "PC2", 0, "PC2", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_deform_mode_items[] = {
@@ -4358,7 +4382,7 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna)
"Replace vertex coords with cached values"},
{MOD_MESHCACHE_DEFORM_INTEGRATE, "INTEGRATE", 0, "Integrate",
"Integrate deformation from this modifiers input with the mesh-cache coords (useful for shape keys)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_interpolation_type_items[] = {
@@ -4366,7 +4390,7 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna)
{MOD_MESHCACHE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
/* for cardinal we'd need to read 4x cache's */
// {MOD_MESHCACHE_INTERP_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_time_type_items[] = {
@@ -4377,13 +4401,13 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna)
{MOD_MESHCACHE_TIME_SECONDS, "TIME", 0, "Time", "Control playback using time in seconds"},
/* use 'eval_factor' */
{MOD_MESHCACHE_TIME_FACTOR, "FACTOR", 0, "Factor", "Control playback using a value between [0, 1]"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_time_play_items[] = {
{MOD_MESHCACHE_PLAY_CFEA, "SCENE", 0, "Scene", "Use the time from the scene"},
{MOD_MESHCACHE_PLAY_EVAL, "CUSTOM", 0, "Custom", "Use the modifier's own time evaluation"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -4457,7 +4481,7 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna)
/* -------------------------------------------------------------------- */
/* For Scene time */
- prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
RNA_def_property_float_sdna(prop, NULL, "frame_start");
RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
RNA_def_property_ui_text(prop, "Frame Start", "Add this to the start frame");
@@ -4483,7 +4507,7 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Evaluation Time", "Evaluation time in seconds");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "eval_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "eval_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "eval_factor");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Evaluation Factor", "Evaluation time in seconds");
@@ -4516,7 +4540,7 @@ static void rna_def_modifier_meshseqcache(BlenderRNA *brna)
{MOD_MESHSEQ_READ_POLY, "POLY", 0, "Faces", ""},
{MOD_MESHSEQ_READ_UV, "UV", 0, "UV", ""},
{MOD_MESHSEQ_READ_COLOR, "COLOR", 0, "Color", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "read_data", PROP_ENUM, PROP_NONE);
@@ -4567,7 +4591,7 @@ static void rna_def_modifier_wireframe(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_MOD_WIREFRAME);
- prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "offset");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 4);
@@ -4654,7 +4678,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
{DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"},
#endif
{DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem DT_layer_edge_items[] = {
@@ -4663,20 +4687,20 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
{DT_TYPE_CREASE, "CREASE", 0, "Subsurf Crease", "Transfer crease values"},
{DT_TYPE_BWEIGHT_EDGE, "BEVEL_WEIGHT_EDGE", 0, "Bevel Weight", "Transfer bevel weights"},
{DT_TYPE_FREESTYLE_EDGE, "FREESTYLE_EDGE", 0, "Freestyle Mark", "Transfer Freestyle edge mark"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem DT_layer_loop_items[] = {
{DT_TYPE_LNOR, "CUSTOM_NORMAL", 0, "Custom Normals", "Transfer custom normals"},
{DT_TYPE_VCOL, "VCOL", 0, "VCol", "Vertex (face corners) colors"},
{DT_TYPE_UV, "UV", 0, "UVs", "Transfer UV layers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem DT_layer_poly_items[] = {
{DT_TYPE_SHARP_FACE, "SMOOTH", 0, "Smooth", "Transfer flat/smooth mark"},
{DT_TYPE_FREESTYLE_FACE, "FREESTYLE_FACE", 0, "Freestyle Mark", "Transfer Freestyle face mark"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "DataTransferModifier", "Modifier");
@@ -4847,7 +4871,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_mix_mode_itemf");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_float(srna, "mix_factor", 1.0f, 0.0f, 1.0f, "Mix Factor",
+ prop = RNA_def_float_factor(srna, "mix_factor", 1.0f, 0.0f, 1.0f, "Mix Factor",
"Factor to use when applying data to destination (exact behavior depends on mix mode)",
0.0f, 1.0f);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -4873,7 +4897,7 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna)
"From an ellipsoid (shape defined by the boundbox's dimensions, target is optional)"},
{MOD_NORMALEDIT_MODE_DIRECTIONAL, "DIRECTIONAL", 0, "Directional",
"Normals 'track' (point to) the target object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_mix_mode_items[] = {
@@ -4881,7 +4905,7 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna)
{MOD_NORMALEDIT_MIX_ADD, "ADD", 0, "Add", "Copy sum of new and old normals"},
{MOD_NORMALEDIT_MIX_SUB, "SUB", 0, "Subtract", "Copy new normals minus old normals"},
{MOD_NORMALEDIT_MIX_MUL, "MUL", 0, "Multiply", "Copy product of old and new normals (*not* cross product)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "NormalEditModifier", "Modifier");
@@ -5041,7 +5065,7 @@ static void rna_def_modifier_weightednormal(BlenderRNA *brna)
{MOD_WEIGHTEDNORMAL_MODE_ANGLE, "CORNER_ANGLE", 0, "Corner Angle", "Generate corner angle weighted normals"},
{MOD_WEIGHTEDNORMAL_MODE_FACE_ANGLE, "FACE_AREA_WITH_ANGLE", 0, "Face Area And Angle",
"Generated normals weighted by both face area and angle"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "WeightedNormalModifier", "Modifier");
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index db93518a6c7..c7d323f7146 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_movieclip.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -143,7 +136,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna)
"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}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MovieClipProxy", NULL);
@@ -241,7 +234,7 @@ static void rna_def_moviecliUser(BlenderRNA *brna)
{MCLIP_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "75%", ""},
{MCLIP_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "100%", ""},
{MCLIP_PROXY_RENDER_SIZE_FULL, "FULL", 0, "None, full render", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MovieClipUser", NULL);
@@ -287,7 +280,7 @@ static void rna_def_movieclip(BlenderRNA *brna)
static const EnumPropertyItem clip_source_items[] = {
{MCLIP_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
{MCLIP_SRC_MOVIE, "MOVIE", 0, "Movie File", "Movie file"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MovieClip", "ID");
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 7b5b2f13eef..5ec46c43734 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2009), Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_nla.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -488,13 +482,17 @@ static void rna_NlaTrack_solo_set(PointerRNA *ptr, bool value)
/* enum defines exported for rna_animation.c */
const EnumPropertyItem rna_enum_nla_mode_blend_items[] = {
{NLASTRIP_MODE_REPLACE, "REPLACE", 0, "Replace",
- "Result strip replaces the accumulated results by amount specified by influence"},
+ "The strip values replace the accumulated results by amount specified by influence"},
+ {NLASTRIP_MODE_COMBINE, "COMBINE", 0, "Combine",
+ "The strip values are combined with accumulated results by appropriately using addition, "
+ "multiplication, or quaternion math, based on channel type"},
+ {0, "", 0, NULL, NULL},
{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, "MULTIPLY", 0, "Multiply",
"Weighted result of strip is multiplied with the accumulated results"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_nla_mode_extend_items[] = {
@@ -502,7 +500,7 @@ const EnumPropertyItem rna_enum_nla_mode_extend_items[] = {
{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}
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_strip_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
@@ -541,7 +539,7 @@ static void rna_def_nlastrip(BlenderRNA *brna)
{NLASTRIP_TYPE_TRANSITION, "TRANSITION", 0, "Transition", "NLA Strip 'transitions' between adjacent strips"},
{NLASTRIP_TYPE_META, "META", 0, "Meta", "NLA Strip acts as a container for adjacent strips"},
{NLASTRIP_TYPE_SOUND, "SOUND", 0, "Sound Clip", "NLA Strip representing a sound event for speakers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* struct definition */
@@ -721,7 +719,7 @@ static void rna_def_nlastrip(BlenderRNA *brna)
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_MUTED);
- RNA_def_property_ui_text(prop, "Muted", "NLA Strip is not evaluated");
+ RNA_def_property_ui_text(prop, "Muted", "Disable NLA Strip evaluation");
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
@@ -818,7 +816,7 @@ static void rna_def_nlatrack(BlenderRNA *brna)
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_MUTED);
- RNA_def_property_ui_text(prop, "Muted", "NLA Track is not evaluated");
+ RNA_def_property_ui_text(prop, "Muted", "Disable NLA Track evaluation");
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 6dd243087c4..69ad550976b 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,21 +12,16 @@
* 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): Blender Foundation (2008), Nathan Letwory, Robin Allen, Bob Holcomb
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_nodetree.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
#include <string.h>
#include <limits.h>
-#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -91,14 +84,14 @@ static const EnumPropertyItem node_socket_type_items[] = {
{SOCK_STRING, "STRING", 0, "String", ""},
{SOCK_RGBA, "RGBA", 0, "RGBA", ""},
{SOCK_SHADER, "SHADER", 0, "Shader", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_quality_items[] = {
{NTREE_QUALITY_HIGH, "HIGH", 0, "High", "High quality"},
{NTREE_QUALITY_MEDIUM, "MEDIUM", 0, "Medium", "Medium quality"},
{NTREE_QUALITY_LOW, "LOW", 0, "Low", "Low quality"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_chunksize_items[] = {
@@ -108,7 +101,7 @@ static const EnumPropertyItem node_chunksize_items[] = {
{NTREE_CHUNCKSIZE_256, "256", 0, "256x256", "Chunksize of 256x256"},
{NTREE_CHUNCKSIZE_512, "512", 0, "512x512", "Chunksize of 512x512"},
{NTREE_CHUNCKSIZE_1024, "1024", 0, "1024x1024", "Chunksize of 1024x1024"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -141,7 +134,7 @@ const EnumPropertyItem rna_enum_node_math_items[] = {
{NODE_MATH_ACOS, "ARCCOSINE", 0, "Arccosine", ""},
{NODE_MATH_ATAN, "ARCTANGENT", 0, "Arctangent", ""},
{NODE_MATH_ATAN2, "ARCTAN2", 0, "Arctan2", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_node_vec_math_items[] = {
@@ -151,7 +144,7 @@ const EnumPropertyItem rna_enum_node_vec_math_items[] = {
{3, "DOT_PRODUCT", 0, "Dot Product", ""},
{4, "CROSS_PRODUCT", 0, "Cross Product", ""},
{5, "NORMALIZE", 0, "Normalize", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_node_filter_items[] = {
@@ -162,7 +155,7 @@ const EnumPropertyItem rna_enum_node_filter_items[] = {
{4, "PREWITT", 0, "Prewitt", ""},
{5, "KIRSCH", 0, "Kirsch", ""},
{6, "SHADOW", 0, "Shadow", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
@@ -170,7 +163,7 @@ static const EnumPropertyItem node_sampler_type_items[] = {
{0, "NEAREST", 0, "Nearest", ""},
{1, "BILINEAR", 0, "Bilinear", ""},
{2, "BICUBIC", 0, "Bicubic", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -178,7 +171,7 @@ static const EnumPropertyItem prop_shader_output_target_items[] = {
{SHD_OUTPUT_ALL, "ALL", 0, "All", "Use shaders for all renderers and viewports, unless there exists a more specific output"},
{SHD_OUTPUT_EEVEE, "EEVEE", 0, "Eevee", "Use shaders for Eevee renderer"},
{SHD_OUTPUT_CYCLES, "CYCLES", 0, "Cycles", "Use shaders for Cycles renderer"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -3258,38 +3251,38 @@ void rna_ShaderNodePointDensity_density_minmax(bNode *self,
static const EnumPropertyItem prop_image_layer_items[] = {
{ 0, "PLACEHOLDER", 0, "Placeholder", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_image_view_items[] = {
{ 0, "ALL", 0, "All", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_view_layer_items[] = {
{ 0, "PLACEHOLDER", 0, "Placeholder", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_tri_channel_items[] = {
{ 1, "R", 0, "R", ""},
{ 2, "G", 0, "G", ""},
{ 3, "B", 0, "B", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_flip_items[] = {
{0, "X", 0, "Flip X", ""},
{1, "Y", 0, "Flip Y", ""},
{2, "XY", 0, "Flip X & Y", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_ycc_items[] = {
{ 0, "ITUBT601", 0, "ITU 601", ""},
{ 1, "ITUBT709", 0, "ITU 709", ""},
{ 2, "JFIF", 0, "Jpeg", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_glossy_items[] = {
@@ -3298,7 +3291,7 @@ static const EnumPropertyItem node_glossy_items[] = {
{SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
{SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
{SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_anisotropic_items[] = {
@@ -3306,7 +3299,7 @@ static const EnumPropertyItem node_anisotropic_items[] = {
{SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
{SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
{SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_glass_items[] = {
@@ -3314,26 +3307,26 @@ static const EnumPropertyItem node_glass_items[] = {
{SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
{SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
{SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_refraction_items[] = {
{SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""},
{SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
{SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_toon_items[] = {
{SHD_TOON_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""},
{SHD_TOON_GLOSSY, "GLOSSY", 0, "Glossy", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_hair_items[] = {
{SHD_HAIR_REFLECTION, "Reflection", 0, "Reflection", ""},
{SHD_HAIR_TRANSMISSION, "Transmission", 0, "Transmission", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_principled_hair_items[] = {
@@ -3344,25 +3337,25 @@ static const EnumPropertyItem node_principled_hair_items[] = {
"(you can get the concentrations for different types of hair online)"},
{SHD_PRINCIPLED_HAIR_REFLECTANCE, "COLOR", 0, "Direct coloring",
"Choose the color of your preference, and the shader will approximate the absorption coefficient to render lookalike hair"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_script_mode_items[] = {
{NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
{NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem node_ies_mode_items[] = {
{NODE_IES_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text datablock"},
{NODE_IES_EXTERNAL, "EXTERNAL", 0, "External", "Use external .ies file"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_principled_distribution_items[] = {
{SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
{SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_subsurface_method_items[] = {
@@ -3610,7 +3603,7 @@ static void def_sh_mapping(StructRNA *srna)
{TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
{TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
{TEXMAP_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static float default_1[3] = {1.f, 1.f, 1.f};
@@ -3697,7 +3690,7 @@ static void def_sh_tex_sky(StructRNA *srna)
static const EnumPropertyItem prop_sky_type[] = {
{SHD_SKY_OLD, "PREETHAM", 0, "Preetham", ""},
{SHD_SKY_NEW, "HOSEK_WILKIE", 0, "Hosek / Wilkie", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static float default_dir[3] = {0.0f, 0.0f, 1.0f};
@@ -3736,7 +3729,7 @@ static const EnumPropertyItem sh_tex_prop_color_space_items[] = {
{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}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem sh_tex_prop_interpolation_items[] = {
@@ -3748,7 +3741,7 @@ static const EnumPropertyItem sh_tex_prop_interpolation_items[] = {
"Cubic interpolation"},
{SHD_INTERP_SMART, "Smart", 0, "Smart",
"Bicubic when magnifying, else bilinear (OSL only)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void def_sh_tex_environment(StructRNA *srna)
@@ -3758,7 +3751,7 @@ static void def_sh_tex_environment(StructRNA *srna)
"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}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -3808,14 +3801,14 @@ static void def_sh_tex_image(StructRNA *srna)
"Image is projected spherically using the Z axis as central"},
{SHD_PROJ_TUBE, "TUBE", 0, "Tube",
"Image is projected from the tube using the Z axis as central"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_image_extension[] = {
{SHD_IMAGE_EXTENSION_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"},
{SHD_IMAGE_EXTENSION_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"},
{SHD_IMAGE_EXTENSION_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -3874,7 +3867,7 @@ static void def_sh_tex_gradient(StructRNA *srna)
{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}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -3959,7 +3952,7 @@ static void def_sh_tex_musgrave(StructRNA *srna)
{SHD_MUSGRAVE_HYBRID_MULTIFRACTAL, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", ""},
{SHD_MUSGRAVE_FBM, "FBM", 0, "fBM", ""},
{SHD_MUSGRAVE_HETERO_TERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -3979,7 +3972,7 @@ static void def_sh_tex_voronoi(StructRNA *srna)
static const EnumPropertyItem prop_coloring_items[] = {
{SHD_VORONOI_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"},
{SHD_VORONOI_CELLS, "CELLS", 0, "Cells", "Color cells by position"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem prop_distance_items[] = {
@@ -4028,13 +4021,13 @@ static void def_sh_tex_wave(StructRNA *srna)
static const EnumPropertyItem prop_wave_type_items[] = {
{SHD_WAVE_BANDS, "BANDS", 0, "Bands", "Use standard wave texture in bands"},
{SHD_WAVE_RINGS, "RINGS", 0, "Rings", "Use wave texture in rings"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_wave_profile_items[] = {
{SHD_WAVE_PROFILE_SIN, "SIN", 0, "Sine", "Use a standard sine profile"},
{SHD_WAVE_PROFILE_SAW, "SAW", 0, "Saw", "Use a sawtooth profile"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -4078,14 +4071,14 @@ static void def_sh_vect_transform(StructRNA *srna)
{SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
{SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
{SHD_VECT_TRANSFORM_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_vect_space_items[] = {
{SHD_VECT_TRANSFORM_SPACE_WORLD, "WORLD", 0, "World", ""},
{SHD_VECT_TRANSFORM_SPACE_OBJECT, "OBJECT", 0, "Object", ""},
{SHD_VECT_TRANSFORM_SPACE_CAMERA, "CAMERA", 0, "Camera", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -4131,7 +4124,7 @@ static void def_sh_tex_pointdensity(StructRNA *srna)
"Generate point density from a particle system"},
{SHD_POINTDENSITY_SOURCE_OBJECT, "OBJECT", 0, "Object Vertices",
"Generate point density from an object's vertices"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_interpolation_items[] = {
@@ -4141,13 +4134,13 @@ static void def_sh_tex_pointdensity(StructRNA *srna)
"Linear interpolation"},
{SHD_INTERP_CUBIC, "Cubic", 0, "Cubic",
"Cubic interpolation"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem space_items[] = {
{SHD_POINTDENSITY_SPACE_OBJECT, "OBJECT", 0, "Object Space", ""},
{SHD_POINTDENSITY_SPACE_WORLD, "WORLD", 0, "World Space", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem particle_color_source_items[] = {
@@ -4157,7 +4150,7 @@ static void def_sh_tex_pointdensity(StructRNA *srna)
"Particle speed (absolute magnitude of velocity) mapped as 0.0-1.0 intensity"},
{SHD_POINTDENSITY_COLOR_PARTVEL, "PARTICLE_VELOCITY", 0, "Particle Velocity",
"XYZ velocity mapped to RGB colors"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem vertex_color_source_items[] = {
@@ -4165,7 +4158,7 @@ static void def_sh_tex_pointdensity(StructRNA *srna)
{SHD_POINTDENSITY_COLOR_VERTWEIGHT, "VERTEX_WEIGHT", 0, "Vertex Weight", "Vertex group weight"},
{SHD_POINTDENSITY_COLOR_VERTNOR, "VERTEX_NORMAL", 0, "Vertex Normal",
"XYZ normal vector mapped to RGB colors"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
@@ -4396,7 +4389,7 @@ static void def_sh_normal_map(StructRNA *srna)
{SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space normal mapping"},
{SHD_SPACE_BLENDER_OBJECT, "BLENDER_OBJECT", 0, "Blender Object Space", "Object space normal mapping, compatible with Blender render baking"},
{SHD_SPACE_BLENDER_WORLD, "BLENDER_WORLD", 0, "Blender World Space", "World space normal mapping, compatible with Blender render baking"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -4420,7 +4413,7 @@ static void def_sh_displacement(StructRNA *srna)
static const EnumPropertyItem prop_space_items[] = {
{SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Displacement is in object space, affected by object scale"},
{SHD_SPACE_WORLD, "WORLD", 0, "World Space", "Displacement is in world space, not affected by object scale"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -4440,7 +4433,7 @@ static void def_sh_vector_displacement(StructRNA *srna)
{SHD_SPACE_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space vector displacement mapping"},
{SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space vector displacement mapping"},
{SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space vector displacement mapping"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -4459,14 +4452,14 @@ static void def_sh_tangent(StructRNA *srna)
static const EnumPropertyItem prop_direction_type_items[] = {
{SHD_TANGENT_RADIAL, "RADIAL", 0, "Radial", "Radial tangent around the X, Y or Z axis"},
{SHD_TANGENT_UVMAP, "UV_MAP", 0, "UV Map", "Tangent from UV map"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_axis_items[] = {
{SHD_TANGENT_AXIS_X, "X", 0, "X", "X axis"},
{SHD_TANGENT_AXIS_Y, "Y", 0, "Y", "Y axis"},
{SHD_TANGENT_AXIS_Z, "Z", 0, "Z", "Z axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -4529,7 +4522,7 @@ static void def_sh_subsurface(StructRNA *srna)
{SHD_SUBSURFACE_GAUSSIAN, "GAUSSIAN", 0, "Gaussian", "Normal distribution, multiple can be combined to fit more complex profiles"},
{SHD_SUBSURFACE_BURLEY, "BURLEY", 0, "Christensen-Burley", "Approximation to physically based volume scattering"},
{SHD_SUBSURFACE_RANDOM_WALK, "RANDOM_WALK", 0, "Random Walk", "Volumetric approximation to physically based volume scattering"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -4672,14 +4665,14 @@ static void def_cmp_blur(StructRNA *srna)
{R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""},
{R_FILTER_CATROM, "CATROM", 0, "Catrom", ""},
{R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem aspect_correction_type_items[] = {
{CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""},
{CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""},
{CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* duplicated in def_cmp_bokehblur */
@@ -4868,7 +4861,7 @@ static void def_cmp_levels(StructRNA *srna)
{3, "GREEN", 0, "G", "Green Channel"},
{4, "BLUE", 0, "B", "Blue Channel"},
{5, "LUMINANCE", 0, "L", "Luminance Channel"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
@@ -4951,7 +4944,7 @@ static void def_cmp_image(StructRNA *srna)
{IMA_SRC_MOVIE, "MOVIE", "Movie", ""},
{IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""},
{IMA_SRC_GENERATED, "GENERATED", "Generated", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -5125,7 +5118,7 @@ static void def_cmp_dilate_erode(StructRNA *srna)
{CMP_NODE_DILATEERODE_DISTANCE_THRESH, "THRESHOLD", 0, "Threshold", ""},
{CMP_NODE_DILATEERODE_DISTANCE, "DISTANCE", 0, "Distance", ""},
{CMP_NODE_DILATEERODE_DISTANCE_FEATHER, "FEATHER", 0, "Feather", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
@@ -5205,7 +5198,7 @@ static void def_cmp_scale(StructRNA *srna)
{CMP_SCALE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", ""},
{CMP_SCALE_SCENEPERCENT, "SCENE_SIZE", 0, "Scene Size", ""},
{CMP_SCALE_RENDERPERCENT, "RENDER_SIZE", 0, "Render Size", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* matching bgpic_camera_frame_items[] */
@@ -5213,7 +5206,7 @@ static void def_cmp_scale(StructRNA *srna)
{0, "STRETCH", 0, "Stretch", ""},
{CMP_SCALE_RENDERSIZE_FRAME_ASPECT, "FIT", 0, "Fit", ""},
{CMP_SCALE_RENDERSIZE_FRAME_ASPECT | CMP_SCALE_RENDERSIZE_FRAME_CROP, "CROP", 0, "Crop", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
@@ -5304,7 +5297,7 @@ static void def_cmp_distance_matte(StructRNA *srna)
static const EnumPropertyItem color_space_items[] = {
{1, "RGB", 0, "RGB", "RGB color space"},
{2, "YCC", 0, "YCC", "YCbCr Suppression"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
@@ -5339,20 +5332,20 @@ static void def_cmp_color_spill(StructRNA *srna)
{1, "R", 0, "R", "Red Spill Suppression"},
{2, "G", 0, "G", "Green Spill Suppression"},
{3, "B", 0, "B", "Blue Spill Suppression"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem limit_channel_items[] = {
{0, "R", 0, "R", "Limit by Red"},
{1, "G", 0, "G", "Limit by Green"},
{2, "B", 0, "B", "Limit by Blue"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem algorithm_items[] = {
{0, "SIMPLE", 0, "Simple", "Simple Limit Algorithm"},
{1, "AVERAGE", 0, "Average", "Average Limit Algorithm"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
@@ -5484,13 +5477,13 @@ static void def_cmp_channel_matte(StructRNA *srna)
{CMP_NODE_CHANNEL_MATTE_CS_HSV, "HSV", 0, "HSV", "HSV Color Space"},
{CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV Color Space"},
{CMP_NODE_CHANNEL_MATTE_CS_YCC, "YCC", 0, "YCbCr", "YCbCr Color Space"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem algorithm_items[] = {
{0, "SINGLE", 0, "Single", "Limit by single channel"},
{1, "MAX", 0, "Max", "Limit by max of other channels "},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
@@ -5587,14 +5580,14 @@ static void def_cmp_double_edge_mask(StructRNA *srna)
static const EnumPropertyItem BufEdgeMode_items[] = {
{0, "BLEED_OUT", 0, "Bleed Out", "Allow mask pixels to bleed along edges"},
{1, "KEEP_IN", 0, "Keep In", "Restrict mask pixels from touching edges"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const 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"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "inner_mode", PROP_ENUM, PROP_NONE);
@@ -5633,7 +5626,7 @@ static void def_cmp_defocus(StructRNA *srna)
{4, "SQUARE", 0, "Square", "4 sides"},
{3, "TRIANGLE", 0, "Triangular", "3 sides"},
{0, "CIRCLE", 0, "Circular", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
@@ -5872,7 +5865,7 @@ static void def_cmp_premul_key(StructRNA *srna)
static const EnumPropertyItem type_items[] = {
{0, "STRAIGHT_TO_PREMUL", 0, "Straight to Premul", ""},
{1, "PREMUL_TO_STRAIGHT", 0, "Premul to Straight", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
@@ -5892,14 +5885,14 @@ static void def_cmp_glare(StructRNA *srna)
{2, "STREAKS", 0, "Streaks", ""},
{1, "FOG_GLOW", 0, "Fog Glow", ""},
{0, "SIMPLE_STAR", 0, "Simple Star", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem quality_items[] = {
{0, "HIGH", 0, "High", ""},
{1, "MEDIUM", 0, "Medium", ""},
{2, "LOW", 0, "Low", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_struct_sdna_from(srna, "NodeGlare", "storage");
@@ -5986,7 +5979,7 @@ static void def_cmp_tonemap(StructRNA *srna)
static const EnumPropertyItem type_items[] = {
{1, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""},
{0, "RH_SIMPLE", 0, "Rh Simple", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage");
@@ -6073,7 +6066,7 @@ static void def_cmp_colorbalance(StructRNA *srna)
static const 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, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
@@ -6222,7 +6215,7 @@ static void def_cmp_moviedistortion(StructRNA *srna)
static const EnumPropertyItem distortion_type_items[] = {
{0, "UNDISTORT", 0, "Undistort", ""},
{1, "DISTORT", 0, "Distort", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
@@ -6247,7 +6240,7 @@ static void def_cmp_mask(StructRNA *srna)
{0, "SCENE", 0, "Scene Size", ""},
{CMP_NODEFLAG_MASK_FIXED, "FIXED", 0, "Fixed", "Use pixel size for the buffer"},
{CMP_NODEFLAG_MASK_FIXED_SCENE, "FIXED_SCENE", 0, "Fixed/Scene", "Pixel size scaled by scene percentage"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
@@ -6317,7 +6310,7 @@ static const EnumPropertyItem node_masktype_items[] = {
{1, "SUBTRACT", 0, "Subtract", ""},
{2, "MULTIPLY", 0, "Multiply", ""},
{3, "NOT", 0, "Not", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void def_cmp_boxmask(StructRNA *srna)
@@ -6693,7 +6686,7 @@ static void def_cmp_viewer(StructRNA *srna)
{1, "RANDOM", 0, "Random", "Random tiles"},
{2, "BOTTOMUP", 0, "Bottom up", "Expand from bottom"},
{3, "RULE_OF_THIRDS", 0, "Rule of thirds", "Expand from 9 places"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "tile_order", PROP_ENUM, PROP_NONE);
@@ -6844,7 +6837,7 @@ static void def_cmp_trackpos(StructRNA *srna)
"Relative Frame", "Output position of a marker relative to marker at given frame number"},
{CMP_TRACKPOS_ABSOLUTE_FRAME, "ABSOLUTE_FRAME", 0,
"Absolute Frame", "Output absolute position of a marker at given frame number"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
@@ -6885,7 +6878,7 @@ static void def_cmp_translate(StructRNA *srna)
{CMP_NODE_WRAP_X, "XAXIS", 0, "X Axis", "Wrap all pixels on the X axis"},
{CMP_NODE_WRAP_Y, "YAXIS", 0, "Y Axis", "Wrap all pixels on the Y axis"},
{CMP_NODE_WRAP_XY, "BOTH", 0, "Both Axes", "Wrap all pixels on both axes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -7864,7 +7857,8 @@ static void rna_def_node(BlenderRNA *brna)
static const EnumPropertyItem dummy_static_type_items[] = {
{NODE_CUSTOM, "CUSTOM", 0, "Custom", "Custom Node"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
srna = RNA_def_struct(brna, "Node", NULL);
RNA_def_struct_ui_text(srna, "Node", "Node in a node tree");
@@ -8316,7 +8310,7 @@ static void rna_def_nodetree(BlenderRNA *brna)
{NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"},
{NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
{NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "NodeTree", "ID");
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 1c195ff559e..622a4b7c01b 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_object.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdio.h>
@@ -42,7 +36,8 @@
#include "DNA_shader_fx_types.h"
#include "BLI_utildefines.h"
-#include "BLI_listbase.h"
+
+#include "BLT_translation.h"
#include "BKE_camera.h"
#include "BKE_collection.h"
@@ -78,7 +73,7 @@ const EnumPropertyItem rna_enum_object_mode_items[] = {
{OB_MODE_SCULPT_GPENCIL, "SCULPT_GPENCIL", ICON_SCULPTMODE_HLT, "Sculpt Mode", "Sculpt Grease Pencil Strokes"},
{OB_MODE_PAINT_GPENCIL, "PAINT_GPENCIL", ICON_GREASEPENCIL, "Draw", "Paint Grease Pencil Strokes"},
{OB_MODE_WEIGHT_GPENCIL, "WEIGHT_GPENCIL", ICON_WPAINT_HLT, "Weight Paint", "Grease Pencil Weight Paint Strokes" },
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Same as above, but with names that distinguish grease pencil. */
@@ -95,7 +90,7 @@ const EnumPropertyItem rna_enum_workspace_object_mode_items[] = {
{OB_MODE_SCULPT_GPENCIL, "SCULPT_GPENCIL", ICON_SCULPTMODE_HLT, "Grease Pencil Sculpt Mode", "Sculpt Grease Pencil Strokes"},
{OB_MODE_PAINT_GPENCIL, "PAINT_GPENCIL", ICON_GREASEPENCIL, "Grease Pencil Draw", "Paint Grease Pencil Strokes"},
{OB_MODE_WEIGHT_GPENCIL, "WEIGHT_GPENCIL", ICON_WPAINT_HLT, "Grease Pencil Weight Paint", "Grease Pencil Weight Paint Strokes" },
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_object_empty_drawtype_items[] = {
@@ -107,14 +102,14 @@ const EnumPropertyItem rna_enum_object_empty_drawtype_items[] = {
{OB_EMPTY_SPHERE, "SPHERE", ICON_SPHERE, "Sphere", ""},
{OB_EMPTY_CONE, "CONE", ICON_CONE, "Cone", ""},
{OB_EMPTY_IMAGE, "IMAGE", ICON_FILE_IMAGE, "Image", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_object_empty_image_depth_items[] = {
{OB_EMPTY_IMAGE_DEPTH_DEFAULT, "DEFAULT", 0, "Default", ""},
{OB_EMPTY_IMAGE_DEPTH_FRONT, "FRONT", 0, "Front", ""},
{OB_EMPTY_IMAGE_DEPTH_BACK, "BACK", 0, "Back", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_object_gpencil_type_items[] = {
@@ -131,12 +126,11 @@ static const EnumPropertyItem parent_type_items[] = {
{PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"},
{PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
{PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#define INSTANCE_ITEMS_SHARED \
{0, "NONE", 0, "None", ""}, \
- {OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make instance of object for every frame"}, \
{OB_DUPLIVERTS, "VERTS", 0, "Verts", "Instantiate child objects on all vertices"}, \
{OB_DUPLIFACES, "FACES", 0, "Faces", "Instantiate child objects on all faces"}
@@ -145,12 +139,12 @@ static const EnumPropertyItem parent_type_items[] = {
static const EnumPropertyItem instance_items[] = {
INSTANCE_ITEMS_SHARED,
INSTANCE_ITEM_COLLECTION,
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static EnumPropertyItem instance_items_nogroup[] = {
INSTANCE_ITEMS_SHARED,
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
#undef INSTANCE_ITEMS_SHARED
@@ -162,7 +156,7 @@ const EnumPropertyItem rna_enum_metaelem_type_items[] = {
{MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
{MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, /* NOTE: typo at original definition! */
{MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* used for 2 enums */
@@ -186,14 +180,27 @@ const EnumPropertyItem rna_enum_object_type_items[] = {
{OB_LAMP, "LIGHT", 0, "Light", ""},
{OB_SPEAKER, "SPEAKER", 0, "Speaker", ""},
{OB_LIGHTPROBE, "LIGHT_PROBE", 0, "Probe", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_object_type_curve_items[] = {
OBTYPE_CU_CURVE,
OBTYPE_CU_SURF,
OBTYPE_CU_FONT,
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
+};
+
+const EnumPropertyItem rna_enum_object_rotation_mode_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)"},
+ {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"},
+ {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"},
+ {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"},
+ {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"},
+ {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"},
+ {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle",
+ "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_object_axis_items[] = {
@@ -203,7 +210,7 @@ const EnumPropertyItem rna_enum_object_axis_items[] = {
{OB_NEGX, "NEG_X", 0, "-X", ""},
{OB_NEGY, "NEG_Y", 0, "-Y", ""},
{OB_NEGZ, "NEG_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -262,7 +269,7 @@ static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA
static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = ptr->id.data;
- BKE_main_collection_sync(bmain);
+ BKE_main_collection_sync_remap(bmain);
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
@@ -341,8 +348,8 @@ static void rna_Object_active_shape_update(bContext *C, PointerRNA *ptr)
DEG_id_tag_update(ob->data, 0);
- EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_btmesh);
- BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_btmesh);
+ EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_mesh);
+ BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_mesh);
break;
case OB_CURVE:
case OB_SURF:
@@ -547,9 +554,9 @@ static void rna_Object_dup_collection_set(PointerRNA *ptr, PointerRNA value)
*/
if (BKE_collection_has_object_recursive(grp, ob) == 0) {
if (ob->type == OB_EMPTY) {
- id_us_min(&ob->dup_group->id);
- ob->dup_group = grp;
- id_us_plus(&ob->dup_group->id);
+ id_us_min(&ob->instance_collection->id);
+ ob->instance_collection = grp;
+ id_us_plus(&ob->instance_collection->id);
}
else {
BKE_report(NULL, RPT_ERROR,
@@ -783,8 +790,8 @@ static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->edit_btmesh)
- me->edit_btmesh->mat_nr = value;
+ if (me->edit_mesh)
+ me->edit_mesh->mat_nr = value;
}
}
@@ -903,6 +910,12 @@ static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
BKE_object_dimensions_get(ob, value);
}
+static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
+{
+ Object *ob = ptr->data;
+ BKE_object_dimensions_set(ob, value, 0);
+}
+
static int rna_Object_location_editable(PointerRNA *ptr, int index)
{
Object *ob = (Object *)ptr->data;
@@ -1087,11 +1100,10 @@ static char *rna_MaterialSlot_path(PointerRNA *ptr)
return BLI_sprintfN("material_slots[%d]", index);
}
-/* why does this have to be so complicated?, can't all this crap be
- * moved to in BGE conversion function? - Campbell *
- *
- * logic from check_body_type()
- * */
+static PointerRNA rna_Object_display_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_ObjectDisplay, ptr->data);
+}
static char *rna_ObjectDisplay_path(PointerRNA *UNUSED(ptr))
{
@@ -1608,7 +1620,7 @@ static void rna_def_vertex_group(BlenderRNA *brna)
{WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
{WEIGHT_ADD, "ADD", 0, "Add", "Add"},
{WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "VertexGroup", NULL);
@@ -1712,7 +1724,7 @@ static void rna_def_material_slot(BlenderRNA *brna)
static const EnumPropertyItem link_items[] = {
{1, "OBJECT", 0, "Object", ""},
{0, "DATA", 0, "Data", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
@@ -2069,11 +2081,12 @@ static void rna_def_object_display(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ObjectDisplay", NULL);
RNA_def_struct_ui_text(srna, "Object Display", "Object display settings for 3d viewport");
- RNA_def_struct_sdna(srna, "ObjectDisplay");
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_nested(brna, srna, "Object");
RNA_def_struct_path_func(srna, "rna_ObjectDisplay_path");
prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_SHOW_SHADOW);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "dtx", OB_DRAW_NO_SHADOW_CAST);
RNA_def_property_boolean_default(prop, true);
RNA_def_property_ui_text(prop, "Shadow", "Object cast shadows in the 3d viewport");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
@@ -2088,7 +2101,7 @@ static void rna_def_object(BlenderRNA *brna)
{OB_POSX, "X", 0, "X", ""},
{OB_POSY, "Y", 0, "Y", ""},
{OB_POSZ, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem drawtype_items[] = {
@@ -2097,7 +2110,7 @@ static void rna_def_object(BlenderRNA *brna)
{OB_SOLID, "SOLID", 0, "Solid", "Display the object as a solid (if solid drawing is enabled in the viewport)"},
{OB_TEXTURE, "TEXTURED", 0, "Textured",
"Display the object with textures (if textures are enabled in the viewport)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem boundtype_items[] = {
@@ -2106,28 +2119,9 @@ static void rna_def_object(BlenderRNA *brna)
{OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Display bounds as cylinder"},
{OB_BOUND_CONE, "CONE", 0, "Cone", "Display bounds as cone"},
{OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Display bounds as capsule"},
- {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 */
- static const 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)"},
- {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"},
- {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"},
- {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"},
- {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"},
- {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"},
- {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle",
- "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
- static float default_quat[4] = {1, 0, 0, 0}; /* default quaternion values */
- static float default_axisAngle[4] = {0, 0, 1, 0}; /* default axis-angle rotation values */
- static float default_scale[3] = {1, 1, 1}; /* default scale values */
static int boundbox_dimsize[] = {8, 3};
srna = RNA_def_struct(brna, "Object", "ID");
@@ -2148,6 +2142,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_enum_items(prop, rna_enum_object_type_items);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Type", "Type of Object");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mode");
@@ -2260,7 +2255,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "quat");
RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_float_array_default(prop, default_quat);
+ RNA_def_property_float_array_default(prop, rna_default_quaternion);
RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
@@ -2272,7 +2267,7 @@ static void rna_def_object(BlenderRNA *brna)
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_float_array_default(prop, rna_default_axis_angle);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
@@ -2286,29 +2281,30 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "rotmode");
- RNA_def_property_enum_items(prop, prop_rotmode_items); /* XXX move to using a single define of this someday */
+ RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_Object_rotation_mode_set", NULL);
RNA_def_property_ui_text(prop, "Rotation Mode", "");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "size");
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
- RNA_def_property_float_array_default(prop, default_scale);
+ RNA_def_property_float_array_default(prop, rna_default_scale_3d);
RNA_def_property_ui_text(prop, "Scale", "Scaling of the object");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
RNA_def_property_array(prop, 3);
- /* Only for the transform-panel and conflicts with animating scale. */
- /* Disallow editing, it doesn't work properly, see: T54771. */
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_Object_dimensions_get", NULL, NULL);
+ /* Only as convinient helper for py API, and conflicts with animating scale. */
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_funcs(prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the object");
+ RNA_def_property_ui_text(prop, "Dimensions",
+ "Absolute bounding box dimensions of the object (WARNING: assigning to it or "
+ "its members mutiple consecutive times will not work correctly, "
+ "as this needs up-to-date evaluated data)");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
@@ -2327,7 +2323,7 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
RNA_def_property_float_sdna(prop, NULL, "dquat");
- RNA_def_property_float_array_default(prop, default_quat);
+ RNA_def_property_float_array_default(prop, rna_default_quaternion);
RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)",
"Extra rotation added to the rotation of the object (when using Quaternion rotations)");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
@@ -2336,7 +2332,7 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
/* 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_float_array_default(prop, rna_default_axis_angle);
RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)",
"Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
@@ -2346,7 +2342,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "dscale");
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
- RNA_def_property_float_array_default(prop, default_scale);
+ RNA_def_property_float_array_default(prop, rna_default_scale_3d);
RNA_def_property_ui_text(prop, "Delta Scale", "Extra scaling added to the scale of the object");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
@@ -2511,7 +2507,7 @@ static void rna_def_object(BlenderRNA *brna)
{0, "DOUBLE_SIDED", 0, "Both", ""},
{OB_EMPTY_IMAGE_HIDE_BACK, "FRONT", 0, "Front", ""},
{OB_EMPTY_IMAGE_HIDE_FRONT, "BACK", 0, "Back", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "empty_image_side", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "empty_image_visibility_flag");
@@ -2526,7 +2522,6 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT, "rna_Object_internal_update_draw");
prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "col");
RNA_def_property_ui_text(prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
@@ -2576,6 +2571,7 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_text(prop, "Disable Select", "Disable object selection in the viewport");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
@@ -2602,21 +2598,6 @@ static void rna_def_object(BlenderRNA *brna)
rna_def_animviz_common(srna);
rna_def_motionpath_common(srna);
- /* slow parenting */
- /* 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_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);
- RNA_def_property_float_sdna(prop, NULL, "sf");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Slow Parent Offset", "Delay in the parent relationship");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
/* instancing */
prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
@@ -2625,62 +2606,30 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Instance Type", "If not None, object instancing method to use");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
- prop = RNA_def_property(srna, "use_instance_frames_speed", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
- RNA_def_property_ui_text(prop, "Instance Frames Speed",
- "Set frames instancing 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_instance_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
- RNA_def_property_ui_text(prop, "Instance Verts Rotation", "Rotate instance according to vertex normal");
+ RNA_def_property_ui_text(prop, "Orient with Normals", "Rotate instance according to vertex normal");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "use_instance_faces_scale", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFACES_SCALE);
- RNA_def_property_ui_text(prop, "Instance Faces Inherit Scale", "Scale instance based on face size");
+ RNA_def_property_ui_text(prop, "Scale to Face Sizes", "Scale instance based on face size");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
prop = RNA_def_property(srna, "instance_faces_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "dupfacesca");
+ RNA_def_property_float_sdna(prop, NULL, "instance_faces_scale");
RNA_def_property_range(prop, 0.001f, 10000.0f);
RNA_def_property_ui_text(prop, "Instance Faces Scale", "Scale the face instance objects");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
+ RNA_def_property_pointer_sdna(prop, NULL, "instance_collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_collection_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Instance Collection", "Instance an existing collection");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
- prop = RNA_def_property(srna, "instance_frames_start", PROP_INT, PROP_NONE | PROP_UNIT_TIME);
- RNA_def_property_int_sdna(prop, NULL, "dupsta");
- RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Instance Frames Start", "Start frame for frame instances");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "instance_frames_end", PROP_INT, PROP_NONE | PROP_UNIT_TIME);
- RNA_def_property_int_sdna(prop, NULL, "dupend");
- RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Instance Frames End", "End frame for frame instances");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "instance_frames_on", PROP_INT, PROP_NONE | PROP_UNIT_TIME);
- RNA_def_property_int_sdna(prop, NULL, "dupon");
- RNA_def_property_range(prop, 1, MAXFRAME);
- RNA_def_property_ui_range(prop, 1, 1500, 1, -1);
- RNA_def_property_ui_text(prop, "Instance Frames On", "Number of frames to use between DupOff frames");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "instance_frames_off", PROP_INT, PROP_NONE | PROP_UNIT_TIME);
- RNA_def_property_int_sdna(prop, NULL, "dupoff");
- RNA_def_property_range(prop, 0, MAXFRAME);
- RNA_def_property_ui_range(prop, 0, 1500, 1, -1);
- RNA_def_property_ui_text(prop, "Instance Frames Off", "Recurring frames to exclude from the frame instances");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
-
prop = RNA_def_property(srna, "is_instancer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -2799,7 +2748,7 @@ static void rna_def_object(BlenderRNA *brna)
/* Base Settings */
prop = RNA_def_property(srna, "is_from_instancer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROMDUPLI);
+ RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROM_DUPLI);
RNA_def_property_ui_text(prop, "Base from Instancer", "Object comes from a instancer");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -2810,8 +2759,9 @@ static void rna_def_object(BlenderRNA *brna)
/* Object Display */
prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "display");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_struct_type(prop, "ObjectDisplay");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_display_get", NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Object Display", "Object display settings for 3d viewport");
RNA_api_object(srna);
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 495643b1c7a..6ec631014d0 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_object_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -59,7 +52,7 @@ static const EnumPropertyItem space_items[] = {
"The local space of a bone's parent bone"},
{CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
"The local space of an object/bone"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -142,7 +135,7 @@ static bool rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports)
return false;
}
- return BASE_VISIBLE_BGMODE(v3d, base);
+ return BASE_VISIBLE(v3d, base);
}
static bool rna_Object_holdout_get(Object *ob, ReportList *reports, ViewLayer *view_layer)
@@ -501,7 +494,7 @@ void RNA_api_object(StructRNA *srna)
static const EnumPropertyItem mesh_type_items[] = {
{eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
{eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef NDEBUG
@@ -509,7 +502,7 @@ void RNA_api_object(StructRNA *srna)
{0, "SOURCE", 0, "Source", "Source mesh"},
{1, "DEFORM", 0, "Deform", "Objects deform mesh"},
{2, "FINAL", 0, "Final", "Objects final mesh"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 406ecd9a8eb..a6cfc56706f 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Thomas Dinges
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_object_force.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -47,7 +41,7 @@ static const EnumPropertyItem effector_shape_items[] = {
{PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", "Field originates from the local XY plane of the object"},
{PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface", "Field originates from the surface of the object"},
{PFIELD_SHAPE_POINTS, "POINTS", 0, "Every Point", "Field originates from all of the vertices of the object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -61,14 +55,14 @@ static const EnumPropertyItem curve_shape_items[] = {
{PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
{PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", "Field originates from the local XY plane of the object"},
{PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve", "Field originates from the curve itself"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem empty_shape_items[] = {
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
{PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
{PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", "Field originates from the local XY plane of the object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem vortex_shape_items[] = {
@@ -76,20 +70,20 @@ static const EnumPropertyItem vortex_shape_items[] = {
{PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
{PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface falloff (New)", ""},
{PFIELD_SHAPE_POINTS, "POINTS", 0, "Every Point (New)", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem curve_vortex_shape_items[] = {
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
{PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
{PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve (New)", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem empty_vortex_shape_items[] = {
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
{PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#include "MEM_guardedalloc.h"
@@ -730,7 +724,7 @@ static void rna_def_pointcache_common(StructRNA *srna)
{PTCACHE_COMPRESS_NO, "NO", 0, "No", "No compression"},
{PTCACHE_COMPRESS_LZO, "LIGHT", 0, "Light", "Fast but not so effective compression"},
{PTCACHE_COMPRESS_LZMA, "HEAVY", 0, "Heavy", "Effective but slow compression"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
@@ -892,31 +886,31 @@ static void rna_def_collision(BlenderRNA *brna)
/* Particle Interaction */
- prop = RNA_def_property(srna, "damping_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "damping_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "pdef_damp");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Damping Factor", "Amount of damping during particle collision");
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
- prop = RNA_def_property(srna, "damping_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "damping_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "pdef_rdamp");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Damping", "Random variation of damping");
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
- prop = RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "pdef_frict");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Friction Factor", "Amount of friction during particle collision");
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
- prop = RNA_def_property(srna, "friction_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "friction_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "pdef_rfrict");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Friction", "Random variation of friction");
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
- prop = RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "pdef_perm");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Permeability", "Chance that the particle will pass through the mesh");
@@ -947,7 +941,7 @@ static void rna_def_collision(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Outer Thickness", "Outer face thickness");
RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
- prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "pdef_sbdamp");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Damping", "Amount of damping during collision");
@@ -1134,28 +1128,28 @@ static void rna_def_field(BlenderRNA *brna)
{PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Create turbulence with a noise field"},
{PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Create a force that dampens motion"},
{PFIELD_SMOKEFLOW, "SMOKE_FLOW", ICON_FORCE_SMOKEFLOW, "Smoke Flow", "Create a force based on smoke simulation air flow"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem falloff_items[] = {
{PFIELD_FALL_SPHERE, "SPHERE", 0, "Sphere", ""},
{PFIELD_FALL_TUBE, "TUBE", 0, "Tube", ""},
{PFIELD_FALL_CONE, "CONE", 0, "Cone", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem texture_items[] = {
{PFIELD_TEX_RGB, "RGB", 0, "RGB", ""},
{PFIELD_TEX_GRAD, "GRADIENT", 0, "Gradient", ""},
{PFIELD_TEX_CURL, "CURL", 0, "Curl", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem zdirection_items[] = {
{PFIELD_Z_BOTH, "BOTH", 0, "Both Z", ""},
{PFIELD_Z_POS, "POSITIVE", 0, "+Z", ""},
{PFIELD_Z_NEG, "NEGATIVE", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem guide_kink_items[] = {
@@ -1166,7 +1160,7 @@ static void rna_def_field(BlenderRNA *brna)
{4, "BRAID", 0, "Braid", ""},
{5, "ROTATION", 0, "Rotation", ""},
{6, "ROLL", 0, "Roll", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FieldSettings", NULL);
@@ -1270,13 +1264,13 @@ static void rna_def_field(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Falloff Power", "How quickly strength falls off with distance from the force field");
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
- prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "mindist");
RNA_def_property_range(prop, 0.0f, 1000.0f);
RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance for the field's fall-off");
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
- prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "maxdist");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1.0f, 3);
@@ -1492,13 +1486,13 @@ static void rna_def_softbody(BlenderRNA *brna)
{SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring length * Ball Size"},
{SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring length * Ball Size"},
{SBC_MODE_AVGMINMAX, "MINMAX", 0, "AvMinMax", "(Min+Max)/2 * Ball Size"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem aerodynamics_type[] = {
{0, "SIMPLE", 0, "Simple", "Edges receive a drag force from surrounding media"},
{1, "LIFT_FORCE", 0, "Lift Force", "Edges receive a lift force when passing through surrounding media"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SoftBodySettings", NULL);
@@ -1514,7 +1508,7 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Friction", "General media friction for point movements");
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
RNA_def_property_float_sdna(prop, NULL, "nodemass");
RNA_def_property_range(prop, 0.0f, 50000.0f);
RNA_def_property_ui_text(prop, "Mass", "General Mass value");
@@ -1549,19 +1543,19 @@ static void rna_def_softbody(BlenderRNA *brna)
"rna_SoftBodySettings_goal_vgroup_set");
RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values");
- prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR);
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 weights are scaled to match this range");
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_FACTOR);
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 weights are scaled to match this range");
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_FACTOR);
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);
@@ -1625,7 +1619,7 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Bending", "Bending Stiffness");
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "shearstiff");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Shear", "Shear Stiffness");
@@ -1645,7 +1639,7 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Collision Type", "Choose Collision Type");
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop = RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "colball");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* code is not ready for that yet */
RNA_def_property_range(prop, -10.0f, 10.0f);
diff --git a/source/blender/makesrna/intern/rna_packedfile.c b/source/blender/makesrna/intern/rna_packedfile.c
index 51199af011b..728ff163043 100644
--- a/source/blender/makesrna/intern/rna_packedfile.c
+++ b/source/blender/makesrna/intern/rna_packedfile.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_packedfile.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -40,7 +34,7 @@ const EnumPropertyItem rna_enum_unpack_method_items[] = {
{PF_WRITE_LOCAL, "WRITE_LOCAL", 0, "Write Local File (overwrite existing)", ""},
{PF_USE_ORIGINAL, "USE_ORIGINAL", 0, "Use Original File", ""},
{PF_WRITE_ORIGINAL, "WRITE_ORIGINAL", 0, "Write Original File (overwrite existing)", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
diff --git a/source/blender/makesrna/intern/rna_palette.c b/source/blender/makesrna/intern/rna_palette.c
index 547cac9f38d..1f411a8d15d 100644
--- a/source/blender/makesrna/intern/rna_palette.c
+++ b/source/blender/makesrna/intern/rna_palette.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_palette.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 61707fa4670..4e1a539fe69 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,12 @@
* 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): Blender Foundation (2008).
- *
* Adaptive time step
* Copyright 2011 AutoCRC
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_particle.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdio.h>
@@ -48,7 +41,6 @@
#include "BKE_mesh.h"
-#include "BLI_string_utils.h"
#include "BLT_translation.h"
@@ -62,7 +54,7 @@ static const EnumPropertyItem part_from_items[] = {
{PART_FROM_VERT, "VERT", 0, "Verts", ""},
{PART_FROM_FACE, "FACE", 0, "Faces", ""},
{PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -71,7 +63,7 @@ static const EnumPropertyItem part_reactor_from_items[] = {
{PART_FROM_VERT, "VERT", 0, "Verts", ""},
{PART_FROM_FACE, "FACE", 0, "Faces", ""},
{PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -79,14 +71,14 @@ static const EnumPropertyItem part_dist_items[] = {
{PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
{PART_DISTR_RAND, "RAND", 0, "Random", ""},
{PART_DISTR_GRID, "GRID", 0, "Grid", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static const EnumPropertyItem part_hair_dist_items[] = {
{PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
{PART_DISTR_RAND, "RAND", 0, "Random", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -97,7 +89,7 @@ static const EnumPropertyItem part_draw_as_items[] = {
{PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
{PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
{PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -105,7 +97,7 @@ static const EnumPropertyItem part_hair_draw_as_items[] = {
{PART_DRAW_NOT, "NONE", 0, "None", ""},
{PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
{PART_DRAW_PATH, "PATH", 0, "Path", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -117,7 +109,7 @@ static const EnumPropertyItem part_ren_as_items[] = {
{PART_DRAW_OB, "OBJECT", 0, "Object", ""},
{PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
{PART_DRAW_BB, "BILLBOARD", 0, "Billboard", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -126,13 +118,14 @@ static const EnumPropertyItem part_hair_ren_as_items[] = {
{PART_DRAW_PATH, "PATH", 0, "Path", ""},
{PART_DRAW_OB, "OBJECT", 0, "Object", ""},
{PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
#ifdef RNA_RUNTIME
#include "BLI_math.h"
+#include "BLI_string_utils.h"
#include "BKE_boids.h"
#include "BKE_context.h"
@@ -632,7 +625,7 @@ static void rna_Particle_change_type(Main *bmain, Scene *UNUSED(scene), PointerR
ParticleSettings *part = ptr->id.data;
/* Iterating over all object is slow, but no better solution exists at the moment. */
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) {
if (psys->part == part) {
psys_changed_type(ob, psys);
@@ -1090,7 +1083,7 @@ static bool rna_ParticleSystem_edited_get(PointerRNA *ptr)
static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
{
ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- ParticleDupliWeight *dw = part->dupliweights.first;
+ ParticleDupliWeight *dw = part->instance_weights.first;
for (; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT)
@@ -1103,13 +1096,13 @@ static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min
{
ParticleSettings *part = (ParticleSettings *)ptr->id.data;
*min = 0;
- *max = max_ii(0, BLI_listbase_count(&part->dupliweights) - 1);
+ *max = max_ii(0, BLI_listbase_count(&part->instance_weights) - 1);
}
static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
{
ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- ParticleDupliWeight *dw = part->dupliweights.first;
+ ParticleDupliWeight *dw = part->instance_weights.first;
int i = 0;
for (; dw; dw = dw->next, i++)
@@ -1122,7 +1115,7 @@ static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
{
ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- ParticleDupliWeight *dw = part->dupliweights.first;
+ ParticleDupliWeight *dw = part->instance_weights.first;
int i = 0;
for (; dw; dw = dw->next, i++) {
@@ -1453,7 +1446,7 @@ static void rna_def_particle(BlenderRNA *brna)
{PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
{PARS_ALIVE, "ALIVE", 0, "Alive", ""},
{PARS_DYING, "DYING", 0, "Dying", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Particle", NULL);
@@ -1594,7 +1587,7 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
static const EnumPropertyItem sph_solver_items[] = {
{SPH_SOLVER_DDR, "DDR", 0, "Double-Density", "An artistic solver with strong surface tension effects (original)"},
{SPH_SOLVER_CLASSICAL, "CLASSICAL", 0, "Classical", "A more physically-accurate solver"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SPHFluidSettings", NULL);
@@ -1646,7 +1639,7 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
"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);
+ prop = RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_FACTOR);
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",
@@ -1709,7 +1702,7 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
/* Factor flags */
- prop = RNA_def_property(srna, "factor_repulsion", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_factor_repulsion", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION);
RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -1720,17 +1713,17 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
"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);
+ prop = RNA_def_property(srna, "use_factor_radius", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS);
RNA_def_property_ui_text(prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY);
RNA_def_property_ui_text(prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "factor_rest_length", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_factor_rest_length", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH);
RNA_def_property_ui_text(prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -1748,7 +1741,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
{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)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_mapping_items[] = {
@@ -1756,7 +1749,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
{MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
{MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
{MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_x_mapping_items[] = {
@@ -1764,7 +1757,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
{1, "X", 0, "X", ""},
{2, "Y", 0, "Y", ""},
{3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_y_mapping_items[] = {
@@ -1772,7 +1765,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
{1, "X", 0, "X", ""},
{2, "Y", 0, "Y", ""},
{3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_z_mapping_items[] = {
@@ -1780,7 +1773,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
{1, "X", 0, "X", ""},
{2, "Y", 0, "Y", ""},
{3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
@@ -1793,14 +1786,14 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
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_update(prop, 0, "rna_Particle_reset");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "object");
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "uvname");
@@ -1998,16 +1991,16 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{PART_EMITTER, "EMITTER", 0, "Emitter", ""},
/*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */
{PART_HAIR, "HAIR", 0, "Hair", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem phys_type_items[] = {
- {PART_PHYS_NO, "NO", 0, "No", ""},
+ {PART_PHYS_NO, "NO", 0, "None", ""},
{PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
{PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
{PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
{PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rot_mode_items[] = {
@@ -2021,7 +2014,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
{PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
{PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem ave_mode_items[] = {
@@ -2033,21 +2026,21 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{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}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem react_event_items[] = {
{PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
{PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
{PART_EVENT_NEAR, "NEAR", 0, "Near", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem child_type_items[] = {
{0, "NONE", 0, "None", ""},
{PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
{PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/*TODO: names, tooltips */
@@ -2056,7 +2049,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
{PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
{PART_INT_RK4, "RK4", 0, "RK4", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem kink_type_items[] = {
@@ -2066,7 +2059,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
{PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
{PART_KINK_SPIRAL, "SPIRAL", 0, "Spiral", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem bb_align_items[] = {
@@ -2075,7 +2068,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{PART_BB_Z, "Z", 0, "Z", ""},
{PART_BB_VIEW, "VIEW", 0, "View", ""},
{PART_BB_VEL, "VEL", 0, "Velocity", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem bb_anim_items[] = {
@@ -2083,14 +2076,14 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{PART_BB_ANIM_AGE, "AGE", 0, "Age", ""},
{PART_BB_ANIM_FRAME, "FRAME", 0, "Frame", ""},
{PART_BB_ANIM_ANGLE, "ANGLE", 0, "Angle", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem bb_split_offset_items[] = {
{PART_BB_OFF_NONE, "NONE", 0, "None", ""},
{PART_BB_OFF_LINEAR, "LINEAR", 0, "Linear", ""},
{PART_BB_OFF_RANDOM, "RANDOM", 0, "Random", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem draw_col_items[] = {
@@ -2098,12 +2091,12 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
{PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
{PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem part_mat_items[] = {
{0, "DUMMY", 0, "Dummy", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ParticleSettings", "ID");
@@ -2133,7 +2126,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "regrow_hair", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_regrow_hair", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW);
RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
@@ -2272,7 +2265,7 @@ 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, "Orientation axis",
+ RNA_def_property_ui_text(prop, "Orientation Axis",
"Particle orientation axis (does not affect Explode modifier's results)");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -2398,7 +2391,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
- prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "draw_size");
RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_range(prop, 0, 100, 1, -1);
@@ -2430,7 +2423,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "bending_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "bending_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "bending_random");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Bending Stiffness", "Random stiffness of hairs");
@@ -2528,7 +2521,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
- prop = RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards");
@@ -2562,7 +2555,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_redo");
/* general values */
- prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
RNA_def_property_float_sdna(prop, NULL, "sta"); /*optional if prop names are the same */
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -2570,7 +2563,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Start", "Frame number to start emitting particles");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
RNA_def_property_float_sdna(prop, NULL, "end");
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
@@ -2584,7 +2577,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Lifetime", "Life span of the particles");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "randlife");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
@@ -2631,7 +2624,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "eff_hair");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
@@ -2663,7 +2656,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "grid_rand");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
@@ -2677,7 +2670,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset");
/* initial velocity factors */
- prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_VELOCITY);
RNA_def_property_float_sdna(prop, NULL, "normfac"); /*optional if prop names are the same */
RNA_def_property_range(prop, -1000.0f, 1000.0f);
RNA_def_property_ui_range(prop, 0, 100, 1, 3);
@@ -2688,7 +2681,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "obfac");
RNA_def_property_range(prop, -200.0f, 200.0f);
RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting velocity");
+ RNA_def_property_ui_text(prop, "Object Velocity", "Let the object give the particle a starting velocity");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
@@ -2705,7 +2698,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting velocity");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_VELOCITY);
RNA_def_property_float_sdna(prop, NULL, "tanfac");
RNA_def_property_range(prop, -1000.0f, 1000.0f);
RNA_def_property_ui_range(prop, -100, 100, 1, 2);
@@ -2748,13 +2741,13 @@ static void rna_def_particle_settings(BlenderRNA *brna)
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);
+ prop = RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "randrotfac");
RNA_def_property_range(prop, 0.0f, 1.0f);
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);
+ prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "randphasefac");
RNA_def_property_range(prop, 0.0f, 2.0f);
RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation around the chosen orientation axis");
@@ -2768,7 +2761,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset");
/* physical properties */
- prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
RNA_def_property_range(prop, 0.00000001f, 100000.0f);
RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
RNA_def_property_ui_text(prop, "Mass", "Mass of the particles");
@@ -2781,7 +2774,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Size", "The size of the particles");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "randsize");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
@@ -2795,7 +2788,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
/* global physical properties */
- prop = RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "dragfac");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Drag", "Amount of air-drag");
@@ -2808,14 +2801,14 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Brownian", "Amount of random, erratic particle movement");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "dampfac");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Damp", "Amount of damping");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
/* random length */
- prop = RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "randlength");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
@@ -2835,7 +2828,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0, 10000, 1, -1);
RNA_def_property_ui_text(prop, "Rendered Children", "Number of children/parent for rendering");
- prop = RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "parents");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
@@ -2848,19 +2841,19 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
- prop = RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "childrandsize");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
- prop = RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "childrad");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
- prop = RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "childflat");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
@@ -2904,20 +2897,20 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
/* kink */
- prop = RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "kink_amp");
RNA_def_property_range(prop, -100000.0f, 100000.0f);
RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
- prop = RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump affects kink amplitude");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
- prop = RNA_def_property(srna, "kink_amplitude_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "kink_amplitude_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "kink_amp_random");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Amplitude Random", "Random variation of the amplitude");
@@ -2935,7 +2928,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
- prop = RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
@@ -2946,7 +2939,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Extra Steps", "Extra steps for resolution of special kink features");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
- prop = RNA_def_property(srna, "kink_axis_random", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "kink_axis_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Axis Random", "Random variation of the orientation");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
@@ -2980,7 +2973,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Size2", "Size of random rough");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
- prop = RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough");
@@ -3011,20 +3004,20 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Roughness Curve", "Curve defining roughness");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
- prop = RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "clength");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Length", "Length of child paths");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
- prop = RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "clength_thres");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
/* parting */
- prop = RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "parting_fac");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Parting Factor", "Create parting in the children based on parent strands");
@@ -3045,7 +3038,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
/* branching */
- prop = RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "branch_thres");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
@@ -3102,14 +3095,14 @@ static void rna_def_particle_settings(BlenderRNA *brna)
/* draw objects & collections */
prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
+ RNA_def_property_pointer_sdna(prop, NULL, "instance_collection");
RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Dupli Collection", "Show Objects in this collection in place of particles");
RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
prop = RNA_def_property(srna, "instance_weights", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "dupliweights", NULL);
+ RNA_def_property_collection_sdna(prop, NULL, "instance_weights", NULL);
RNA_def_property_struct_type(prop, "ParticleDupliWeight");
RNA_def_property_ui_text(prop, "Dupli Collection Weights", "Weights for all of the objects in the dupli collection");
@@ -3125,7 +3118,6 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Instance Object", "Show this Object in place of particles");
@@ -3201,14 +3193,14 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Shape", "Strand shape parameter");
RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
- prop = RNA_def_property(srna, "root_radius", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "root_radius", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "rad_root");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
RNA_def_property_ui_text(prop, "Root", "Strand width at the root");
RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
- prop = RNA_def_property(srna, "tip_radius", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "tip_radius", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "rad_tip");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
@@ -3219,7 +3211,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "rad_scale");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
- RNA_def_property_ui_text(prop, "Scaling", "Multiplier of radius properties");
+ RNA_def_property_ui_text(prop, "Radius Scale", "Multiplier of radius properties");
RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
}
@@ -3232,7 +3224,7 @@ static void rna_def_particle_target(BlenderRNA *brna)
{PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""},
{PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""},
{PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -3260,13 +3252,13 @@ static void rna_def_particle_target(BlenderRNA *brna)
prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
RNA_def_property_float_sdna(prop, NULL, "time");
- RNA_def_property_range(prop, 0.0, 30000.0f); /*TODO: replace 30000 with MAXFRAMEF when available in 2.5 */
+ RNA_def_property_range(prop, 0.0, MAXFRAMEF);
RNA_def_property_ui_text(prop, "Time", "");
RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
prop = RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "duration");
- RNA_def_property_range(prop, 0.0, 30000.0f); /*TODO: replace 30000 with MAXFRAMEF when available in 2.5 */
+ RNA_def_property_range(prop, 0.0, MAXFRAMEF);
RNA_def_property_ui_text(prop, "Duration", "");
RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
@@ -3309,7 +3301,7 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
RNA_def_property_pointer_funcs(prop, "rna_particle_settings_get", "rna_particle_settings_set", NULL, NULL);
RNA_def_property_ui_text(prop, "Settings", "Particle system settings");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
prop = RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "particles", "totpart");
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index d86e87f2a1f..118943dab2e 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Roland Hess, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_pose.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -40,7 +34,6 @@
#include "DNA_scene_types.h"
#include "BLI_math.h"
-#include "BLI_string_utils.h"
#include "BLT_translation.h"
@@ -48,23 +41,6 @@
#include "WM_types.h"
-
-
-/* XXX: this RNA enum define is currently duplicated for objects,
- * since there is some text here which is not applicable */
-const EnumPropertyItem rna_enum_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)"},
- {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order (prone to Gimbal Lock)"},
- {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order (prone to Gimbal Lock)"},
- {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order (prone to Gimbal Lock)"},
- {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order (prone to Gimbal Lock)"},
- {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order (prone to Gimbal Lock)"},
- {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle",
- "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
- {0, NULL, 0, NULL, NULL}
-};
-
/* Bone and Group Color Sets */
const EnumPropertyItem rna_enum_color_sets_items[] = {
{0, "DEFAULT", 0, "Default Colors", ""},
@@ -89,11 +65,14 @@ const EnumPropertyItem rna_enum_color_sets_items[] = {
{19, "THEME19", ICON_COLORSET_19_VEC, "19 - Theme Color Set", ""},
{20, "THEME20", ICON_COLORSET_20_VEC, "20 - Theme Color Set", ""},
{-1, "CUSTOM", 0, "Custom Color Set", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
+#include "BLI_ghash.h"
+#include "BLI_string_utils.h"
+
#include "BIK_api.h"
#include "BKE_action.h"
#include "BKE_armature.h"
@@ -102,8 +81,6 @@ const EnumPropertyItem rna_enum_color_sets_items[] = {
#include "MEM_guardedalloc.h"
-#include "BLI_ghash.h"
-
#include "BKE_context.h"
#include "BKE_constraint.h"
#include "BKE_global.h"
@@ -818,13 +795,13 @@ static void rna_def_bone_group(BlenderRNA *brna)
static const EnumPropertyItem prop_iksolver_items[] = {
{IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"},
{IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_solver_items[] = {
{ITASC_SOLVER_SDLS, "SDLS", 0, "SDLS", "Selective Damped Least Square"},
{ITASC_SOLVER_DLS, "DLS", 0, "DLS", "Damped Least Square with Numerical Filtering"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -872,10 +849,6 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
static void rna_def_pose_channel(BlenderRNA *brna)
{
- static float default_quat[4] = {1, 0, 0, 0}; /* default quaternion values */
- static float default_axisAngle[4] = {0, 0, 1, 0}; /* default axis-angle rotation values */
- static float default_scale[3] = {1, 1, 1}; /* default scale values */
-
StructRNA *srna;
PropertyRNA *prop;
@@ -939,7 +912,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
- RNA_def_property_float_array_default(prop, default_scale);
+ RNA_def_property_float_array_default(prop, rna_default_scale_3d);
RNA_def_property_ui_text(prop, "Scale", "");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
@@ -947,7 +920,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "quat");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
- RNA_def_property_float_array_default(prop, default_quat);
+ RNA_def_property_float_array_default(prop, rna_default_quaternion);
RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
@@ -960,7 +933,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get",
"rna_PoseChannel_rotation_axis_angle_set", NULL);
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
- RNA_def_property_float_array_default(prop, default_axisAngle);
+ RNA_def_property_float_array_default(prop, rna_default_axis_angle);
RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
@@ -973,7 +946,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "rotmode");
- RNA_def_property_enum_items(prop, rna_enum_posebone_rotmode_items); /* XXX move to using a single define of this someday */
+ RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_PoseChannel_rotation_mode_set", NULL);
/* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
@@ -1161,21 +1134,21 @@ 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_IK_update");
- prop = RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "ikstretch");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK");
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
- prop = RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "ikrotweight");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "IK Rot Weight", "Weight of rotation constraint for IK");
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
- prop = RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "iklinweight");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "IK Lin Weight", "Weight of scale constraint for IK");
@@ -1288,7 +1261,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
{ITASC_SIMULATION, "SIMULATION", 0, "Simulation",
"State-full solver running in real-time context and ignoring actions "
"and non-IK constraints"},
- {0, NULL, 0, NULL, NULL}
+ {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)"},
@@ -1297,7 +1270,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
"subsequent frame"},
{ITASC_INITIAL_REITERATION | ITASC_REITERATION, "ALWAYS", 0, "Always",
"The solver reiterates (converges) on all frames"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -1347,13 +1320,13 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
"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);
+ prop = RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "minstep");
RNA_def_property_range(prop, 0.0f, 0.1f);
RNA_def_property_ui_text(prop, "Min step", "Lower bound for timestep in second in case of automatic substeps");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
- prop = RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "maxstep");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Max step", "Higher bound for timestep in second in case of automatic substeps");
@@ -1379,7 +1352,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Solver", "Solving method selection: automatic damping or manual damping");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
- prop = RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "dampmax");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Damp",
@@ -1387,7 +1360,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
"(higher values=more stability, less reactivity - default=0.5)");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
- prop = RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "dampeps");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Epsilon",
diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c
index 6b7a8e4e2ff..2658cd552bc 100644
--- a/source/blender/makesrna/intern/rna_pose_api.c
+++ b/source/blender/makesrna/intern/rna_pose_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_pose_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index b549664139f..660e2a76511 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2009)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_render.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -77,7 +71,7 @@ const EnumPropertyItem rna_enum_render_pass_type_items[] = {
#ifdef WITH_CYCLES_DEBUG
{SCE_PASS_DEBUG, "DEBUG", 0, "Pass used for render engine debugging", ""},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_bake_pass_type_items[] = {
@@ -93,7 +87,7 @@ const EnumPropertyItem rna_enum_bake_pass_type_items[] = {
{SCE_PASS_GLOSSY_COLOR, "GLOSSY", 0, "Glossy", ""},
{SCE_PASS_TRANSM_COLOR, "TRANSMISSION", 0, "Transmission", ""},
{SCE_PASS_SUBSURFACE_COLOR, "SUBSURFACE", 0, "Subsurface", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -467,7 +461,7 @@ static void rna_def_render_engine(BlenderRNA *brna)
{SOCK_FLOAT, "VALUE", 0, "Value", ""},
{SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
{SOCK_RGBA, "COLOR", 0, "Color", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "RenderEngine", NULL);
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index 98833390b0d..7f0ee14ef18 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,11 @@
* 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): Blender Foundation 2013, Joshua Leung, Sergej Reich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file rna_rigidbody.c
- * \ingroup rna
- * \brief RNA property definitions for Rigid Body datatypes
+/** \file
+ * \ingroup rna
+ * \brief RNA property definitions for Rigid Body datatypes
*/
#include <stdlib.h>
@@ -47,7 +41,8 @@
const EnumPropertyItem rna_enum_rigidbody_object_type_items[] = {
{RBO_TYPE_ACTIVE, "ACTIVE", 0, "Active", "Object is directly controlled by simulation results"},
{RBO_TYPE_PASSIVE, "PASSIVE", 0, "Passive", "Object is directly controlled by animation system"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
/* collision shapes of objects in rigid body sim */
const EnumPropertyItem rna_enum_rigidbody_object_shape_items[] = {
@@ -61,7 +56,8 @@ const EnumPropertyItem rna_enum_rigidbody_object_shape_items[] = {
"fewer vertices)"},
{RB_SHAPE_TRIMESH, "MESH", ICON_MESH_MONKEY, "Mesh",
"Mesh consisting of triangles only, allowing for more detailed interactions than convex hulls"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
/* collision shapes of constraints in rigid body sim */
const EnumPropertyItem rna_enum_rigidbody_constraint_type_items[] = {
@@ -74,13 +70,15 @@ const EnumPropertyItem rna_enum_rigidbody_constraint_type_items[] = {
{RBC_TYPE_6DOF_SPRING, "GENERIC_SPRING", ICON_NONE, "Generic Spring",
"Restrict translation and rotation to specified axes with springs"},
{RBC_TYPE_MOTOR, "MOTOR", ICON_NONE, "Motor", "Drive rigid body around or along an axis"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
/* bullet spring type */
static const EnumPropertyItem rna_enum_rigidbody_constraint_spring_type_items[] = {
{RBC_SPRING_TYPE1, "SPRING1", ICON_NONE, "Blender 2.7", "Spring implementation used in blender 2.7. Damping is capped at 1.0"},
{RBC_SPRING_TYPE2, "SPRING2", ICON_NONE, "Blender 2.8", "New implementation available since 2.8"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
#ifndef RNA_RUNTIME
/* mesh source for collision shape creation */
@@ -88,7 +86,8 @@ static const EnumPropertyItem rigidbody_mesh_source_items[] = {
{RBO_MESH_BASE, "BASE", 0, "Base", "Base mesh"},
{RBO_MESH_DEFORM, "DEFORM", 0, "Deform", "Deformations (shape keys, deform modifiers)"},
{RBO_MESH_FINAL, "FINAL", 0, "Final", "All modifiers"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
#endif
#ifdef RNA_RUNTIME
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index bbd58b8c4da..c980c306843 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_rna.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -42,13 +36,13 @@
/* Reuse for dynamic types */
const EnumPropertyItem DummyRNA_NULL_items[] = {
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Reuse for dynamic types with default value */
const EnumPropertyItem DummyRNA_DEFAULT_items[] = {
{0, "DEFAULT", 0, "Default", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/** \} */
@@ -66,7 +60,7 @@ const EnumPropertyItem rna_enum_property_type_items[] = {
{PROP_ENUM, "ENUM", 0, "Enumeration", ""},
{PROP_POINTER, "POINTER", 0, "Pointer", ""},
{PROP_COLLECTION, "COLLECTION", 0, "Collection", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* XXX Keep in sync with bpy_props.c's property_subtype_xxx_items ???
@@ -109,7 +103,7 @@ const EnumPropertyItem rna_enum_property_subtype_items[] = {
/* booleans */
{PROP_LAYER, "LAYER", 0, "Layer", ""},
{PROP_LAYER_MEMBER, "LAYER_MEMBER", 0, "Layer Member", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_property_unit_items[] = {
@@ -123,7 +117,8 @@ const EnumPropertyItem rna_enum_property_unit_items[] = {
{PROP_UNIT_ACCELERATION, "ACCELERATION", 0, "Acceleration", ""},
{PROP_UNIT_MASS, "MASS", 0, "Mass", ""},
{PROP_UNIT_CAMERA, "CAMERA", 0, "Camera", ""},
- {0, NULL, 0, NULL, NULL}
+ {PROP_UNIT_POWER, "POWER", 0, "Power", ""},
+ {0, NULL, 0, NULL, NULL},
};
/** \} */
@@ -2328,10 +2323,10 @@ static void rna_def_property(BlenderRNA *brna)
{PROP_COORDS, "COORDINATES", 0, "Vector Coordinates", ""},
{PROP_LAYER, "LAYER", 0, "Layer", ""},
{PROP_LAYER_MEMBER, "LAYER_MEMBERSHIP", 0, "Layer Membership", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
EnumPropertyItem dummy_prop_tags[] = {
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Property", NULL);
@@ -2647,7 +2642,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
/* the itemf func is used instead, keep blender happy */
static const EnumPropertyItem default_dummy_items[] = {
{PROP_NONE, "DUMMY", 0, "Dummy", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "default", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 3a318ac58f3..347cb9fc379 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_scene.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -44,10 +38,10 @@
#include "IMB_imbuf_types.h"
#include "BLI_math.h"
-#include "BLI_string_utils.h"
#include "BLT_translation.h"
+#include "BKE_armature.h"
#include "BKE_editmesh.h"
#include "BKE_paint.h"
@@ -97,7 +91,7 @@ const EnumPropertyItem rna_enum_exr_codec_items[] = {
{R_IMF_EXR_CODEC_DWAA, "DWAA", 0, "DWAA (lossy)", ""},
/* NOTE: Commented out for until new OpenEXR is released, see T50673. */
/* {R_IMF_EXR_CODEC_DWAB, "DWAB", 0, "DWAB (lossy)", ""}, */
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -105,7 +99,7 @@ const EnumPropertyItem rna_enum_exr_codec_items[] = {
static const EnumPropertyItem uv_sculpt_relaxation_items[] = {
{UV_SCULPT_TOOL_RELAX_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"},
{UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -113,7 +107,7 @@ const EnumPropertyItem rna_enum_uv_sculpt_tool_items[] = {
{UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
{UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
{UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -122,19 +116,19 @@ const EnumPropertyItem rna_enum_snap_target_items[] = {
{SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap transformation center onto target"},
{SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"},
{SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_proportional_falloff_items[] = {
{PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
{PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
{PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
- {PROP_INVSQUARE, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", "Inverse Square falloff"},
+ {PROP_INVSQUARE, "INVERSE_SQUARE", ICON_INVERSESQUARECURVE, "Inverse Square", "Inverse Square falloff"},
{PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
{PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
{PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Constant falloff"},
{PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* subset of the enum - only curves, missing random and const */
@@ -145,18 +139,18 @@ const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[] = {
{PROP_INVSQUARE, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", "Inverse Square falloff"},
{PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
{PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_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_PROJECTED, "PROJECTED", ICON_PROP_ON, "Projected (2D)",
- "Proportional Editing using screen space locations"},
+ {PROP_EDIT_PROJECTED, "PROJECTED", ICON_PROP_PROJECTED, "Projected (2D)",
+ "Proportional Editing using screen space locations"},
{PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected",
- "Proportional Editing using connected geometry only"},
- {0, NULL, 0, NULL, NULL}
+ "Proportional Editing using connected geometry only"},
+ {0, NULL, 0, NULL, NULL},
};
/* keep for operators, not used here */
@@ -164,7 +158,7 @@ const EnumPropertyItem rna_enum_mesh_select_mode_items[] = {
{SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
{SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"},
{SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_mesh_select_mode_uv_items[] = {
@@ -172,7 +166,7 @@ const EnumPropertyItem rna_enum_mesh_select_mode_uv_items[] = {
{UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"},
{UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
{UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_snap_element_items[] = {
@@ -181,7 +175,7 @@ const EnumPropertyItem rna_enum_snap_element_items[] = {
{SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"},
{SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"},
{SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_snap_node_element_items[] = {
@@ -189,21 +183,21 @@ const EnumPropertyItem rna_enum_snap_node_element_items[] = {
{SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_NODE_SIDE, "Node X", "Snap to left/right node border"},
{SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_NODE_TOP, "Node Y", "Snap to top/bottom node border"},
{SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y, "NODE_XY", ICON_NODE_CORNER, "Node X / Y", "Snap to any node border"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem snap_uv_element_items[] = {
{SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
{SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_curve_fit_method_items[] = {
{CURVE_PAINT_FIT_METHOD_REFIT, "REFIT", 0, "Refit", "Incrementally re-fit the curve (high quality)"},
{CURVE_PAINT_FIT_METHOD_SPLIT, "SPLIT", 0, "Split", "Split the curve until the tolerance is met (fast)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* workaround for duplicate enums,
@@ -290,7 +284,7 @@ static const EnumPropertyItem image_only_type_items[] = {
IMAGE_TYPE_ITEMS_IMAGE_ONLY
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -305,14 +299,14 @@ const EnumPropertyItem rna_enum_image_type_items[] = {
#ifdef WITH_FFMPEG
{R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "FFmpeg video", "The most versatile way to output video files"},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_image_color_mode_items[] = {
{R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
{R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
{R_IMF_PLANES_RGBA, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -329,13 +323,13 @@ const EnumPropertyItem rna_enum_image_color_depth_items[] = {
{R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"},
/* 24 not used */
{R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32 bit color channels"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_normal_space_items[] = {
{R_BAKE_SPACE_OBJECT, "OBJECT", 0, "Object", "Bake the normals in object space"},
{R_BAKE_SPACE_TANGENT, "TANGENT", 0, "Tangent", "Bake the normals in tangent space"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_normal_swizzle_items[] = {
@@ -345,13 +339,13 @@ const EnumPropertyItem rna_enum_normal_swizzle_items[] = {
{R_BAKE_NEGX, "NEG_X", 0, "-X", ""},
{R_BAKE_NEGY, "NEG_Y", 0, "-Y", ""},
{R_BAKE_NEGZ, "NEG_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_bake_save_mode_items[] = {
{R_BAKE_SAVE_INTERNAL, "INTERNAL", 0, "Internal", "Save the baking map in an internal image data-block"},
{R_BAKE_SAVE_EXTERNAL, "EXTERNAL", 0, "External", "Save the baking map in an external file"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#define R_IMF_VIEWS_ENUM_IND {R_IMF_VIEWS_INDIVIDUAL, "INDIVIDUAL", 0, "Individual", \
@@ -363,20 +357,20 @@ const EnumPropertyItem rna_enum_bake_save_mode_items[] = {
const EnumPropertyItem rna_enum_views_format_items[] = {
R_IMF_VIEWS_ENUM_IND
R_IMF_VIEWS_ENUM_S3D
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_views_format_multilayer_items[] = {
R_IMF_VIEWS_ENUM_IND
R_IMF_VIEWS_ENUM_MV
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_views_format_multiview_items[] = {
R_IMF_VIEWS_ENUM_IND
R_IMF_VIEWS_ENUM_S3D
R_IMF_VIEWS_ENUM_MV
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#undef R_IMF_VIEWS_ENUM_IND
@@ -393,21 +387,21 @@ const EnumPropertyItem rna_enum_stereo3d_display_items[] = {
"Render alternate eyes (also known as page flip, quad buffer support in the graphic card is required)"},
{S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render views for left and right eyes side-by-side"},
{S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render views for left and right eyes one above another"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[] = {
{S3D_ANAGLYPH_REDCYAN, "RED_CYAN", 0, "Red-Cyan", ""},
{S3D_ANAGLYPH_GREENMAGENTA, "GREEN_MAGENTA", 0, "Green-Magenta", ""},
{S3D_ANAGLYPH_YELLOWBLUE, "YELLOW_BLUE", 0, "Yellow-Blue", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_stereo3d_interlace_type_items[] = {
{S3D_INTERLACE_ROW, "ROW_INTERLEAVED", 0, "Row Interleaved", ""},
{S3D_INTERLACE_COLUMN, "COLUMN_INTERLEAVED", 0, "Column Interleaved", ""},
{S3D_INTERLACE_CHECKERBOARD, "CHECKERBOARD_INTERLEAVED", 0, "Checkerboard Interleaved", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
@@ -421,14 +415,14 @@ const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
{R_BAKE_PASS_FILTER_GLOSSY, "GLOSSY", 0, "Glossy", ""},
{R_BAKE_PASS_FILTER_TRANSM, "TRANSMISSION", 0, "Transmission", ""},
{R_BAKE_PASS_FILTER_SUBSURFACE, "SUBSURFACE", 0, "Subsurface", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_gizmo_items[] = {
{SCE_GIZMO_SHOW_TRANSLATE, "TRANSLATE", 0, "Move", ""},
{SCE_GIZMO_SHOW_ROTATE, "ROTATE", 0, "Rotate", ""},
{SCE_GIZMO_SHOW_SCALE, "SCALE", 0, "Scale", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
@@ -453,7 +447,7 @@ static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = {
{GP_IPO_BOUNCE, "BOUNCE", ICON_IPO_BOUNCE, "Bounce", "Exponentially decaying parabolic bounce, like when objects collide"},
{GP_IPO_ELASTIC, "ELASTIC", ICON_IPO_ELASTIC, "Elastic", "Exponentially decaying sine wave, like an elastic band"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -467,25 +461,27 @@ const EnumPropertyItem rna_enum_transform_pivot_items_full[] = {
{V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", ICON_PIVOT_MEDIAN, "Median Point",
"Pivot around the median point of selected objects"},
{V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", ICON_PIVOT_ACTIVE, "Active Element", "Pivot around active object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Icons could be made a consistent set of images. */
const EnumPropertyItem rna_enum_transform_orientation_items[] = {
- {V3D_MANIP_GLOBAL, "GLOBAL", ICON_ORIENTATION_GLOBAL, "Global", "Align the transformation axes to world space"},
- {V3D_MANIP_LOCAL, "LOCAL", ICON_ORIENTATION_LOCAL, "Local", "Align the transformation axes to the selected objects' local space"},
- {V3D_MANIP_NORMAL, "NORMAL", ICON_ORIENTATION_NORMAL, "Normal",
- "Align the transformation axes to average normal of selected elements "
- "(bone Y axis for pose mode)"},
- {V3D_MANIP_GIMBAL, "GIMBAL", ICON_ORIENTATION_GIMBAL, "Gimbal", "Align each axis to the Euler rotation axis as used for input"},
- {V3D_MANIP_VIEW, "VIEW", ICON_ORIENTATION_VIEW, "View", "Align the transformation axes to the window"},
- {V3D_MANIP_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "Cursor", "Align the transformation axes to the 3D cursor"},
- // {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
- {0, NULL, 0, NULL, NULL}
+ {V3D_ORIENT_GLOBAL, "GLOBAL", ICON_ORIENTATION_GLOBAL, "Global", "Align the transformation axes to world space"},
+ {V3D_ORIENT_LOCAL, "LOCAL", ICON_ORIENTATION_LOCAL, "Local", "Align the transformation axes to the selected objects' local space"},
+ {V3D_ORIENT_NORMAL, "NORMAL", ICON_ORIENTATION_NORMAL, "Normal",
+ "Align the transformation axes to average normal of selected elements "
+ "(bone Y axis for pose mode)"},
+ {V3D_ORIENT_GIMBAL, "GIMBAL", ICON_ORIENTATION_GIMBAL, "Gimbal", "Align each axis to the Euler rotation axis as used for input"},
+ {V3D_ORIENT_VIEW, "VIEW", ICON_ORIENTATION_VIEW, "View", "Align the transformation axes to the window"},
+ {V3D_ORIENT_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "Cursor", "Align the transformation axes to the 3D cursor"},
+ // {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
+#include "BLI_string_utils.h"
+
#include "DNA_anim_types.h"
#include "DNA_color_types.h"
#include "DNA_node_types.h"
@@ -692,6 +688,11 @@ static void rna_Scene_volume_set(PointerRNA *ptr, float value)
BKE_sound_set_scene_volume(scene, value);
}
+static const char *rna_Scene_statistics_string_get(Scene *scene, Main *bmain, ViewLayer *view_layer)
+{
+ return ED_info_stats_string(bmain, scene, view_layer);
+}
+
static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
@@ -1394,6 +1395,7 @@ static void rna_Scene_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
rna_Scene_glsl_update(bmain, scene, ptr);
WM_main_add_notifier(NC_WORLD | ND_WORLD, &sc->id);
+ DEG_relations_tag_update(bmain);
}
void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
@@ -1485,9 +1487,9 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *valu
if (view_layer && view_layer->basact) {
Mesh *me = BKE_mesh_from_object(view_layer->basact->object);
- if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
- me->edit_btmesh->selectmode = flag;
- EDBM_selectmode_set(me->edit_btmesh);
+ if (me && me->edit_mesh && me->edit_mesh->selectmode != flag) {
+ me->edit_mesh->selectmode = flag;
+ EDBM_selectmode_set(me->edit_mesh);
}
}
}
@@ -1501,7 +1503,7 @@ static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSE
if (view_layer->basact) {
me = BKE_mesh_from_object(view_layer->basact->object);
- if (me && me->edit_btmesh == NULL)
+ if (me && me->edit_mesh == NULL)
me = NULL;
}
@@ -1531,10 +1533,10 @@ static void object_simplify_update(Object *ob)
for (psys = ob->particlesystem.first; psys; psys = psys->next)
psys->recalc |= ID_RECALC_PSYS_CHILD;
- if (ob->dup_group) {
+ if (ob->instance_collection) {
CollectionObject *cob;
- for (cob = ob->dup_group->gobject.first; cob; cob = cob->next)
+ for (cob = ob->instance_collection->gobject.first; cob; cob = cob->next)
object_simplify_update(cob->ob);
}
}
@@ -1545,7 +1547,7 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), Poi
Scene *sce_iter;
Base *base;
- BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true);
+ BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
FOREACH_SCENE_OBJECT_BEGIN(sce, ob)
{
object_simplify_update(ob);
@@ -1557,6 +1559,7 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), Poi
}
WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
DEG_id_tag_update(&sce->id, 0);
}
@@ -1633,7 +1636,33 @@ static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
}
}
+static void rna_View3DCursor_rotation_mode_set(PointerRNA *ptr, int value)
+{
+ View3DCursor *cursor = ptr->data;
+
+ /* use API Method for conversions... */
+ BKE_rotMode_change_values(
+ cursor->rotation_quaternion,
+ cursor->rotation_euler,
+ cursor->rotation_axis, &cursor->rotation_angle, cursor->rotation_mode, (short)value);
+
+ /* finally, set the new rotation type */
+ cursor->rotation_mode = value;
+}
+static void rna_View3DCursor_rotation_axis_angle_get(PointerRNA *ptr, float *value)
+{
+ View3DCursor *cursor = ptr->data;
+ value[0] = cursor->rotation_angle;
+ copy_v3_v3(&value[1], cursor->rotation_axis);
+}
+
+static void rna_View3DCursor_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
+{
+ View3DCursor *cursor = ptr->data;
+ cursor->rotation_angle = value[0];
+ copy_v3_v3(cursor->rotation_axis, &value[1]);
+}
static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame)
{
@@ -1742,7 +1771,7 @@ static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr))
if (view_layer->basact) {
me = BKE_mesh_from_object(view_layer->basact->object);
- if (me && me->edit_btmesh == NULL)
+ if (me && me->edit_mesh == NULL)
me = NULL;
}
@@ -1985,7 +2014,7 @@ static void rna_ViewLayer_remove(
}
/* Fake value, used internally (not saved to DNA). */
-#define V3D_MANIP_DEFAULT -1
+#define V3D_ORIENT_DEFAULT -1
static int rna_TransformOrientationSlot_type_get(PointerRNA *ptr)
{
@@ -1993,7 +2022,7 @@ static int rna_TransformOrientationSlot_type_get(PointerRNA *ptr)
TransformOrientationSlot *orient_slot = ptr->data;
if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
if ((orient_slot->flag & SELECT) == 0) {
- return V3D_MANIP_DEFAULT;
+ return V3D_ORIENT_DEFAULT;
}
}
return BKE_scene_orientation_slot_get_index(orient_slot);
@@ -2005,7 +2034,7 @@ void rna_TransformOrientationSlot_type_set(PointerRNA *ptr, int value)
TransformOrientationSlot *orient_slot = ptr->data;
if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
- if (value == V3D_MANIP_DEFAULT) {
+ if (value == V3D_ORIENT_DEFAULT) {
orient_slot->flag &= ~SELECT;
return;
}
@@ -2022,7 +2051,7 @@ static PointerRNA rna_TransformOrientationSlot_get(PointerRNA *ptr)
Scene *scene = ptr->id.data;
TransformOrientationSlot *orient_slot = ptr->data;
TransformOrientation *orientation;
- if (orient_slot->type < V3D_MANIP_CUSTOM) {
+ if (orient_slot->type < V3D_ORIENT_CUSTOM) {
orientation = NULL;
}
else {
@@ -2037,13 +2066,13 @@ static const EnumPropertyItem *rna_TransformOrientation_impl_itemf(
{
EnumPropertyItem tmp = {0, "", 0, "", ""};
EnumPropertyItem *item = NULL;
- int i = V3D_MANIP_CUSTOM, totitem = 0;
+ int i = V3D_ORIENT_CUSTOM, totitem = 0;
if (include_default) {
tmp.identifier = "DEFAULT";
tmp.name = "Default";
tmp.description = "Use the scene orientation";
- tmp.value = V3D_MANIP_DEFAULT;
+ tmp.value = V3D_ORIENT_DEFAULT;
tmp.icon = ICON_OBJECT_ORIGIN;
RNA_enum_item_add(&item, &totitem, &tmp);
tmp.icon = 0;
@@ -2093,7 +2122,7 @@ const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(
return rna_TransformOrientation_impl_itemf(scene, include_default, r_free);
}
-#undef V3D_MANIP_DEFAULT
+#undef V3D_ORIENT_DEFAULT
void rna_TransformOrientationSlot_ui_info(
ID *scene_id, TransformOrientationSlot *orient_slot,
@@ -2101,7 +2130,7 @@ void rna_TransformOrientationSlot_ui_info(
{
Scene *scene = (Scene *)scene_id;
- if (orient_slot->type < V3D_MANIP_CUSTOM) {
+ if (orient_slot->type < V3D_ORIENT_CUSTOM) {
const EnumPropertyItem *items = rna_enum_transform_orientation_items;
const int i = RNA_enum_from_value(items, orient_slot->type);
strcpy(r_name, items[i].name);
@@ -2367,6 +2396,52 @@ static void rna_def_transform_orientation_slot(BlenderRNA *brna)
RNA_def_function_output(func, parm);
}
+static void rna_def_view3d_cursor(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "View3DCursor", NULL);
+ RNA_def_struct_sdna(srna, "View3DCursor");
+ RNA_def_struct_ui_text(srna, "3D Cursor", "");
+
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ_LENGTH);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "location");
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "rotation_quaternion");
+ RNA_def_property_float_array_default(prop, rna_default_quaternion);
+ RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in quaternions (keep normalized)");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_float_funcs(prop, "rna_View3DCursor_rotation_axis_angle_get",
+ "rna_View3DCursor_rotation_axis_angle_set", NULL);
+ RNA_def_property_float_array_default(prop, rna_default_axis_angle);
+ RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "rotation_euler");
+ RNA_def_property_ui_text(prop, "Euler Rotation", "3D rotation");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "rotation_mode");
+ RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_View3DCursor_rotation_mode_set", NULL);
+ RNA_def_property_ui_text(prop, "Rotation Mode", "");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+}
static void rna_def_tool_settings(BlenderRNA *brna)
{
@@ -2380,7 +2455,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
static const EnumPropertyItem auto_key_items[] = {
{AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
{AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem edge_tag_items[] = {
@@ -2390,7 +2465,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
{EDGE_MODE_TAG_CREASE, "CREASE", 0, "Tag Crease", ""},
{EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""},
{EDGE_MODE_TAG_FREESTYLE, "FREESTYLE", 0, "Tag Freestyle Edge Mark", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem mod_weighted_strength[] = {
@@ -2404,14 +2479,14 @@ static void rna_def_tool_settings(BlenderRNA *brna)
{OB_DRAW_GROUPUSER_NONE, "NONE", 0, "None", ""},
{OB_DRAW_GROUPUSER_ACTIVE, "ACTIVE", 0, "Active", "Show vertices with no weights in the active group"},
{OB_DRAW_GROUPUSER_ALL, "ALL", 0, "All", "Show vertices with no weights in any group"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem vertex_group_select_items[] = {
{WT_VGROUP_ALL, "ALL", 0, "All", "All Vertex Groups"},
{WT_VGROUP_BONE_DEFORM, "BONE_DEFORM", 0, "Deform", "Vertex Groups assigned to Deform Bones"},
{WT_VGROUP_BONE_DEFORM_OFF, "OTHER_DEFORM", 0, "Other", "Vertex Groups assigned to non Deform Bones"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem gpencil_stroke_placement_items[] = {
@@ -2419,27 +2494,28 @@ static void rna_def_tool_settings(BlenderRNA *brna)
{GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Draw stroke at 3D cursor location" },
{GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", ICON_SNAP_FACE, "Surface", "Stick stroke to surfaces"},
{GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_STROKE, "STROKE", ICON_STROKE, "Stroke", "Stick stroke to other strokes"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem gpencil_stroke_snap_items[] = {
{0, "NONE", 0, "All points", "No snap"},
{GP_PROJECT_DEPTH_STROKE_ENDPOINTS, "ENDS", 0, "End points", "Snap to first and last points and interpolate" },
{GP_PROJECT_DEPTH_STROKE_FIRST, "FIRST", 0, "First point", "Snap to first point" },
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem gpencil_selectmode_items[] = {
{GP_SELECTMODE_POINT, "POINT", ICON_GP_SELECT_POINTS, "Point", "Select only points"},
{GP_SELECTMODE_STROKE, "STROKE", ICON_GP_SELECT_STROKES, "Stroke", "Select all stroke points" },
- {0, NULL, 0, NULL, NULL}
+ {GP_SELECTMODE_SEGMENT, "SEGMENT", ICON_GP_SELECT_BETWEEN_STROKES, "Segment", "Select all stroke points between other strokes" },
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem annotation_stroke_placement_items[] = {
{GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Draw stroke at 3D cursor location" },
{0, "VIEW", ICON_RESTRICT_VIEW_ON, "View", "Stick stroke to the view "}, /* weird, GP_PROJECT_VIEWALIGN is inverted */
{GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", ICON_FACESEL, "Surface", "Stick stroke to surfaces"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -2865,7 +2941,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_enum_items(prop, edge_tag_items);
RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
- prop = RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap");
@@ -3007,7 +3083,7 @@ static void rna_def_curve_paint_settings(BlenderRNA *brna)
static const EnumPropertyItem curve_type_items[] = {
{CU_POLY, "POLY", 0, "Poly", ""},
{CU_BEZIER, "BEZIER", 0, "Bezier", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "curve_type", PROP_ENUM, PROP_NONE);
@@ -3075,7 +3151,7 @@ static void rna_def_curve_paint_settings(BlenderRNA *brna)
static const EnumPropertyItem depth_mode_items[] = {
{CURVE_PAINT_PROJECT_CURSOR, "CURSOR", 0, "Cursor", ""},
{CURVE_PAINT_PROJECT_SURFACE, "SURFACE", 0, "Surface", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "depth_mode", PROP_ENUM, PROP_NONE);
@@ -3087,8 +3163,7 @@ static void rna_def_curve_paint_settings(BlenderRNA *brna)
{CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW, "NORMAL_VIEW", 0, "Normal/View", "Display perpendicular to the surface"},
{CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE, "NORMAL_SURFACE", 0, "Normal/Surface", "Display aligned to the surface"},
{CURVE_PAINT_SURFACE_PLANE_VIEW, "VIEW", 0, "View", "Display aligned to the viewport"},
- {0, NULL, 0, NULL, NULL}
- };
+ {0, NULL, 0, NULL, NULL},};
prop = RNA_def_property(srna, "surface_plane", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "surface_plane");
@@ -3107,7 +3182,7 @@ static void rna_def_statvis(BlenderRNA *brna)
{SCE_STATVIS_INTERSECT, "INTERSECT", 0, "Intersect", ""},
{SCE_STATVIS_DISTORT, "DISTORT", 0, "Distortion", ""},
{SCE_STATVIS_SHARP, "SHARP", 0, "Sharp", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MeshStatVis", NULL);
@@ -3222,13 +3297,13 @@ static void rna_def_unit_settings(BlenderRNA *brna)
{USER_UNIT_NONE, "NONE", 0, "None", ""},
{USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
{USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rotation_units[] = {
{0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
{USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "UnitSettings", NULL);
@@ -3594,52 +3669,52 @@ void rna_def_freestyle_settings(BlenderRNA *brna)
static const EnumPropertyItem edge_type_negation_items[] = {
{0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given edge type conditions"},
{FREESTYLE_LINESET_FE_NOT, "EXCLUSIVE", 0, "Exclusive",
- "Select feature edges not satisfying the given edge type conditions"},
- {0, NULL, 0, NULL, NULL}
+ "Select feature edges not satisfying the given edge type conditions"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem edge_type_combination_items[] = {
{0, "OR", 0, "Logical OR", "Select feature edges satisfying at least one of edge type conditions"},
{FREESTYLE_LINESET_FE_AND, "AND", 0, "Logical AND",
- "Select feature edges satisfying all edge type conditions"},
- {0, NULL, 0, NULL, NULL}
+ "Select feature edges satisfying all edge type conditions"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem collection_negation_items[] = {
{0, "INCLUSIVE", 0, "Inclusive", "Select feature edges belonging to some object in the group"},
{FREESTYLE_LINESET_GR_NOT, "EXCLUSIVE", 0, "Exclusive",
- "Select feature edges not belonging to any object in the group"},
- {0, NULL, 0, NULL, NULL}
+ "Select feature edges not belonging to any object in the group"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem face_mark_negation_items[] = {
{0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given face mark conditions"},
{FREESTYLE_LINESET_FM_NOT, "EXCLUSIVE", 0, "Exclusive",
- "Select feature edges not satisfying the given face mark conditions"},
- {0, NULL, 0, NULL, NULL}
+ "Select feature edges not satisfying the given face mark conditions"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem face_mark_condition_items[] = {
{0, "ONE", 0, "One Face", "Select a feature edge if either of its adjacent faces is marked"},
{FREESTYLE_LINESET_FM_BOTH, "BOTH", 0, "Both Faces",
- "Select a feature edge if both of its adjacent faces are marked"},
- {0, NULL, 0, NULL, NULL}
+ "Select a feature edge if both of its adjacent faces are marked"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem freestyle_ui_mode_items[] = {
{FREESTYLE_CONTROL_SCRIPT_MODE, "SCRIPT", 0, "Python Scripting Mode",
"Advanced mode for using style modules written in Python"},
{FREESTYLE_CONTROL_EDITOR_MODE, "EDITOR", 0, "Parameter Editor Mode",
- "Basic mode for interactive style parameter editing"},
- {0, NULL, 0, NULL, NULL}
+ "Basic mode for interactive style parameter editing"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem visibility_items[] = {
{FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible feature edges"},
{FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden feature edges"},
{FREESTYLE_QI_RANGE, "RANGE", 0, "QI Range",
- "Select feature edges within a range of quantitative invisibility (QI) values"},
- {0, NULL, 0, NULL, NULL}
+ "Select feature edges within a range of quantitative invisibility (QI) values"},
+ {0, NULL, 0, NULL, NULL},
};
/* FreestyleLineSet */
@@ -3993,7 +4068,7 @@ static void rna_def_bake_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Margin", "Extends the baked result as a post process filter");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- prop = RNA_def_property(srna, "cage_extrusion", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "cage_extrusion", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3);
RNA_def_property_ui_text(prop, "Cage Extrusion",
@@ -4365,7 +4440,7 @@ static void rna_def_image_format_stereo3d_format(BlenderRNA *brna)
"Render views for left and right eyes interlaced in a single image (3D-ready monitor is required)"},
{S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render views for left and right eyes side-by-side"},
{S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render views for left and right eyes one above another"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Stereo3dFormat", NULL);
@@ -4417,7 +4492,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
static const EnumPropertyItem jp2_codec_items[] = {
{R_IMF_JP2_CODEC_JP2, "JP2", 0, "JP2", ""},
{R_IMF_JP2_CODEC_J2K, "J2K", 0, "J2K", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -4427,7 +4502,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
{R_IMF_TIFF_CODEC_DEFLATE, "DEFLATE", 0, "Deflate", ""},
{R_IMF_TIFF_CODEC_LZW, "LZW", 0, "LZW", ""},
{R_IMF_TIFF_CODEC_PACKBITS, "PACKBITS", 0, "Pack Bits", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -4607,7 +4682,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
{FFMPEG_OGG, "OGG", 0, "Ogg", ""},
{FFMPEG_MKV, "MKV", 0, "Matroska", ""},
{FFMPEG_FLV, "FLASH", 0, "Flash", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem ffmpeg_codec_items[] = {
@@ -4625,7 +4700,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
{AV_CODEC_ID_QTRLE, "QTRLE", 0, "QT rle / QT Animation", ""},
{AV_CODEC_ID_THEORA, "THEORA", 0, "Theora", ""},
{AV_CODEC_ID_VP9, "WEBM", 0, "WEBM / VP9", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Recommendations come from the FFmpeg wiki, https://trac.ffmpeg.org/wiki/Encode/VP9.
@@ -4636,7 +4711,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
"Recommended if you have lots of time and want the best compression efficiency"},
{FFM_PRESET_GOOD, "GOOD", 0, "Good", "The default and recommended for most applications"},
{FFM_PRESET_REALTIME, "REALTIME", 0, "Realtime", "Recommended for fast encoding"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem ffmpeg_crf_items[] = {
@@ -4649,7 +4724,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
{FFM_CRF_LOW, "LOW", 0, "Low quality", ""},
{FFM_CRF_VERYLOW, "VERYLOW", 0, "Very low quality", ""},
{FFM_CRF_LOWEST, "LOWEST", 0, "Lowest quality", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem ffmpeg_audio_codec_items[] = {
@@ -4661,7 +4736,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
{AV_CODEC_ID_MP3, "MP3", 0, "MP3", ""},
{AV_CODEC_ID_PCM_S16LE, "PCM", 0, "PCM", ""},
{AV_CODEC_ID_VORBIS, "VORBIS", 0, "Vorbis", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -4671,7 +4746,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
{FFM_CHANNELS_SURROUND4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"},
{FFM_CHANNELS_SURROUND51, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound"},
{FFM_CHANNELS_SURROUND71, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FFmpegSettings", NULL);
@@ -4836,7 +4911,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
static const EnumPropertyItem alpha_mode_items[] = {
{R_ADDSKY, "SKY", 0, "Sky", "Transparent pixels are filled with sky color"},
{R_ALPHAPREMUL, "TRANSPARENT", 0, "Transparent", "World background is transparent with premultiplied alpha"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem display_mode_items[] = {
@@ -4844,7 +4919,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
{R_OUTPUT_AREA, "AREA", 0, "Image Editor", "Images are rendered in an Image Editor"},
{R_OUTPUT_WINDOW, "WINDOW", 0, "New Window", "Images are rendered in a new window"},
{R_OUTPUT_NONE, "NONE", 0, "Keep User Interface", "Images are rendered without changing the user interface"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Bake */
@@ -4852,7 +4927,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
//{RE_BAKE_AO, "AO", 0, "Ambient Occlusion", "Bake ambient occlusion"},
{RE_BAKE_NORMALS, "NORMALS", 0, "Normals", "Bake normals"},
{RE_BAKE_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Bake displacement"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem pixel_size_items[] = {
@@ -4861,7 +4936,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
{2, "2", 0, "2x", "Render at 50% resolution"},
{4, "4", 0, "4x", "Render at 25% resolution"},
{8, "8", 0, "8x", "Render at 12.5% resolution"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem fixed_oversample_items[] = {
@@ -4869,40 +4944,40 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
{8, "8", 0, "8", ""},
{11, "11", 0, "11", ""},
{16, "16", 0, "16", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem threads_mode_items[] = {
{0, "AUTO", 0, "Auto-detect", "Automatically determine the number of threads, based on CPUs"},
{R_FIXED_THREADS, "FIXED", 0, "Fixed", "Manually determine the number of threads"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem engine_items[] = {
{0, "BLENDER_EEVEE", 0, "Eevee", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem freestyle_thickness_items[] = {
{R_LINE_THICKNESS_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Specify unit line thickness in pixels"},
{R_LINE_THICKNESS_RELATIVE, "RELATIVE", 0, "Relative",
- "Unit line thickness is scaled by the proportion of the present vertical image "
- "resolution to 480 pixels"},
- {0, NULL, 0, NULL, NULL}
+ "Unit line thickness is scaled by the proportion of the present vertical image "
+ "resolution to 480 pixels"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem views_format_items[] = {
{SCE_VIEWS_FORMAT_STEREO_3D, "STEREO_3D", 0, "Stereo 3D",
"Single stereo camera system, adjust the stereo settings in the camera panel"},
{SCE_VIEWS_FORMAT_MULTIVIEW, "MULTIVIEW", 0, "Multi-View",
- "Multi camera system, adjust the cameras individually"},
- {0, NULL, 0, NULL, NULL}
+ "Multi camera system, adjust the cameras individually"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem hair_shape_type_items[] = {
{SCE_HAIR_SHAPE_STRAND, "STRAND", 0, "Strand", ""},
{SCE_HAIR_SHAPE_STRIP, "STRIP", 0, "Strip", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
rna_def_scene_ffmpeg_settings(brna);
@@ -5091,9 +5166,10 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
- prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_UNSIGNED);
+ prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "blurfac");
- RNA_def_property_ui_range(prop, 0.01f, 2.0f, 1, 2);
+ RNA_def_property_range(prop, 0.01f, 2.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 2);
RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
@@ -5117,41 +5193,41 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Border", "Render a user-defined border region, within the frame size ");
+ RNA_def_property_ui_text(prop, "Render Region", "Render a user-defined render region, within the frame size");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "border.xmin");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Border Minimum X", "Minimum X value for the render border");
+ RNA_def_property_ui_text(prop, "Region Minimum X", "Minimum X value for the render region");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "border_min_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "border.ymin");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Border Minimum Y", "Minimum Y value for the render border");
+ RNA_def_property_ui_text(prop, "Region Minimum Y", "Minimum Y value for the render region");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "border_max_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "border.xmax");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Border Maximum X", "Maximum X value for the render border");
+ RNA_def_property_ui_text(prop, "Region Maximum X", "Maximum X value for the render region");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "border_max_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "border.ymax");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Border Maximum Y", "Maximum Y value for the render border");
+ RNA_def_property_ui_text(prop, "Region Maximum Y", "Maximum Y value for the render region");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "use_crop_to_border", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_CROP);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Crop to Border", "Crop the rendered frame to the defined border size");
+ RNA_def_property_ui_text(prop, "Crop to Render Region", "Crop the rendered frame to the defined render region size");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "use_placeholder", PROP_BOOLEAN, PROP_NONE);
@@ -5259,7 +5335,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "bake_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "bake_mode");
RNA_def_property_enum_items(prop, bake_mode_items);
- RNA_def_property_ui_text(prop, "Bake Mode", "Choose shading information to bake into the image");
+ RNA_def_property_ui_text(prop, "Bake Type", "Choose shading information to bake into the image");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "use_bake_selected_to_active", PROP_BOOLEAN, PROP_NONE);
@@ -5409,7 +5485,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Stamp Hostname", "Include the hostname of the machine that rendered the frame");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- prop = RNA_def_property(srna, "stamp_font_size", PROP_INT, PROP_NONE);
+ prop = RNA_def_property(srna, "stamp_font_size", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "stamp_font_id");
RNA_def_property_range(prop, 8, 64);
RNA_def_property_ui_text(prop, "Font Size", "Size of the font used when rendering stamp text");
@@ -5540,6 +5616,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage during rendering");
RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
+ prop = RNA_def_property(srna, "use_simplify_smoke_highres", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "simplify_smoke_ignore_highres", 1);
+ RNA_def_property_ui_text(prop, "Use Smoke Highres", "Allow drawing high-res smoke in viewport");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
/* Grease Pencil - Simplify Options */
prop = RNA_def_property(srna, "simplify_gpencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_ENABLE);
@@ -5761,7 +5842,7 @@ static void rna_def_display_safe_areas(BlenderRNA *brna)
static float default_action_center[2] = {0.15f, 0.05f};
srna = RNA_def_struct(brna, "DisplaySafeAreas", NULL);
- RNA_def_struct_ui_text(srna, "Safe Areas", "Safe Areas used in 3D view and the VSE");
+ RNA_def_struct_ui_text(srna, "Safe Areas", "Safe areas used in 3D view and the sequencer");
RNA_def_struct_sdna(srna, "DisplaySafeAreas");
/* SAFE AREAS */
@@ -5863,7 +5944,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
static const EnumPropertyItem eevee_shadow_method_items[] = {
{SHADOW_ESM, "ESM", 0, "ESM", "Exponential Shadow Mapping"},
{SHADOW_VSM, "VSM", 0, "VSM", "Variance Shadow Mapping"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem eevee_shadow_size_items[] = {
@@ -5874,7 +5955,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
{1024, "1024", 0, "1024px", ""},
{2048, "2048", 0, "2048px", ""},
{4096, "4096", 0, "4096px", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem eevee_gi_visibility_size_items[] = {
@@ -5882,7 +5963,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
{16, "16", 0, "16px", ""},
{32, "32", 0, "32px", ""},
{64, "64", 0, "64px", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem eevee_volumetric_tile_size_items[] = {
@@ -5890,7 +5971,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
{4, "4", 0, "4px", ""},
{8, "8", 0, "8px", ""},
{16, "16", 0, "16px", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static float default_bloom_color[3] = {1.0f, 1.0f, 1.0f};
@@ -5954,13 +6035,13 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Cubemap Cache", "Display captured cubemaps in the viewport");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- prop = RNA_def_property(srna, "gi_irradiance_display_size", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "gi_irradiance_display_size", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "gi_irradiance_draw_size");
RNA_def_property_range(prop, 0.05f, 10.0f);
RNA_def_property_float_default(prop, 0.1f);
RNA_def_property_ui_text(prop, "Irradiance Display Size", "Size of the irradiance sample spheres to debug captured light");
- prop = RNA_def_property(srna, "gi_cubemap_display_size", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "gi_cubemap_display_size", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "gi_cubemap_draw_size");
RNA_def_property_range(prop, 0.05f, 10.0f);
RNA_def_property_float_default(prop, 0.3f);
@@ -6182,7 +6263,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Depth of Field", "Enable depth of field using the values from the active camera");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- prop = RNA_def_property(srna, "bokeh_max_size", PROP_FLOAT, PROP_FACTOR);
+ prop = RNA_def_property(srna, "bokeh_max_size", PROP_FLOAT, PROP_PIXEL);
RNA_def_property_float_default(prop, 100.0f);
RNA_def_property_ui_text(prop, "Max Size", "Max size of the bokeh shape for the depth of field (lower is faster)");
RNA_def_property_range(prop, 0.0f, 2000.0f);
@@ -6230,17 +6311,17 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
prop = RNA_def_property(srna, "bloom_clamp", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Clamp", "Maximum intensity a bloom pixel can have");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_ui_text(prop, "Clamp", "Maximum intensity a bloom pixel can have (0 to disabled)");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1, 3);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- prop = RNA_def_property(srna, "bloom_intensity", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_default(prop, 0.8f);
+ prop = RNA_def_property(srna, "bloom_intensity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.05f);
RNA_def_property_ui_text(prop, "Intensity", "Blend factor");
RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_range(prop, 0.0f, 0.1f, 1, 3);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
/* Motion blur */
@@ -6256,10 +6337,11 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
RNA_def_property_range(prop, 1, 64);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_UNSIGNED);
+ prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close");
- RNA_def_property_ui_range(prop, 0.01f, 2.0f, 1, 2);
+ RNA_def_property_range(prop, 0.01f, 2.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 2);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
/* Shadows */
@@ -6593,14 +6675,14 @@ void RNA_def_scene(BlenderRNA *brna)
{4, "LINEAR_CLAMPED", 0, "Linear Clamped", "Linear distance model with clamping"},
{5, "EXPONENT", 0, "Exponent", "Exponent distance model"},
{6, "EXPONENT_CLAMPED", 0, "Exponent Clamped", "Exponent distance model with clamping"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem sync_mode_items[] = {
{0, "NONE", 0, "No Sync", "Do not sync, play every frame"},
{SCE_FRAME_DROP, "FRAME_DROP", 0, "Frame Dropping", "Drop frames if playback is too slow"},
{AUDIO_SYNC, "AUDIO_SYNC", 0, "AV-sync", "Sync to audio playback, dropping frames"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Struct definition */
@@ -6630,17 +6712,6 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "World", "World used for rendering the scene");
RNA_def_property_update(prop, NC_SCENE | ND_WORLD, "rna_Scene_world_update");
- prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "cursor.location");
- RNA_def_property_ui_text(prop, "Cursor Location", "3D cursor location");
- RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "cursor_rotation", PROP_FLOAT, PROP_QUATERNION);
- RNA_def_property_float_sdna(prop, NULL, "cursor.rotation");
- RNA_def_property_ui_text(prop, "Cursor Rotation", "3D cursor rotation in quaternions (keep normalized)");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_ui_text(prop, "Objects", "");
@@ -6896,6 +6967,14 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "TransformOrientationSlot");
RNA_def_property_ui_text(prop, "Transform Orientation Slots", "");
+
+ /* 3D View Cursor */
+ prop = RNA_def_property(srna, "cursor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "cursor");
+ RNA_def_property_struct_type(prop, "View3DCursor");
+ RNA_def_property_ui_text(prop, "3D Cursor", "");
+
/* Audio Settings */
prop = RNA_def_property(srna, "use_audio", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_Scene_use_audio_get", "rna_Scene_use_audio_set");
@@ -6945,7 +7024,8 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, NULL, "rna_Scene_volume_set", NULL);
/* Statistics */
- func = RNA_def_function(srna, "statistics", "ED_info_stats_string");
+ func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Active layer");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", "");
@@ -7026,6 +7106,7 @@ void RNA_def_scene(BlenderRNA *brna)
rna_def_scene_image_format_data(brna);
rna_def_transform_orientation(brna);
rna_def_transform_orientation_slot(brna);
+ rna_def_view3d_cursor(brna);
rna_def_selected_uv_element(brna);
rna_def_display_safe_areas(brna);
rna_def_scene_display(brna);
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index f25e093c8a9..01c495f9864 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Joshua Leung, Arystanbek Dyussenov
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_scene_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -367,15 +360,15 @@ void RNA_api_scene(StructRNA *srna)
RNA_def_int(func, "geom_samples", 1, 1, 128, "Geom samples", "Geometry samples per frame", 1, 128);
RNA_def_float(func, "shutter_open", 0.0f, -1.0f, 1.0f, "Shutter open", "", -1.0f, 1.0f);
RNA_def_float(func, "shutter_close", 1.0f, -1.0f, 1.0f, "Shutter close", "", -1.0f, 1.0f);
- RNA_def_boolean(func, "selected_only" , 0, "Selected only", "Export only selected objects");
- RNA_def_boolean(func, "uvs" , 1, "UVs", "Export UVs");
- RNA_def_boolean(func, "normals" , 1, "Normals", "Export normals");
- RNA_def_boolean(func, "vcolors" , 0, "Vertex colors", "Export vertex colors");
- RNA_def_boolean(func, "apply_subdiv" , 1, "Subsurfs as meshes", "Export subdivision surfaces as meshes");
- RNA_def_boolean(func, "flatten" , 0, "Flatten hierarchy", "Flatten hierarchy");
- RNA_def_boolean(func, "visible_layers_only" , 0, "Visible layers only", "Export only objects in visible layers");
- RNA_def_boolean(func, "renderable_only" , 0, "Renderable objects only", "Export only objects marked renderable in the outliner");
- RNA_def_boolean(func, "face_sets" , 0, "Facesets", "Export face sets");
+ RNA_def_boolean(func, "selected_only", 0, "Selected only", "Export only selected objects");
+ RNA_def_boolean(func, "uvs", 1, "UVs", "Export UVs");
+ RNA_def_boolean(func, "normals", 1, "Normals", "Export normals");
+ RNA_def_boolean(func, "vcolors", 0, "Vertex colors", "Export vertex colors");
+ RNA_def_boolean(func, "apply_subdiv", 1, "Subsurfs as meshes", "Export subdivision surfaces as meshes");
+ RNA_def_boolean(func, "flatten", 0, "Flatten hierarchy", "Flatten hierarchy");
+ RNA_def_boolean(func, "visible_layers_only", 0, "Visible layers only", "Export only objects in visible layers");
+ RNA_def_boolean(func, "renderable_only", 0, "Renderable objects only", "Export only objects marked renderable in the outliner");
+ RNA_def_boolean(func, "face_sets", 0, "Facesets", "Export face sets");
RNA_def_boolean(func, "subdiv_schema", 0, "Use Alembic subdivision Schema", "Use Alembic subdivision Schema");
RNA_def_boolean(func, "export_hair", 1, "Export Hair", "Exports hair particle systems as animated curves");
RNA_def_boolean(func, "export_particles", 1, "Export Particles", "Exports non-hair particle systems");
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index 709abdd1779..33e3da6d86c 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Nathan Letwory
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_screen.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -46,9 +40,10 @@ const EnumPropertyItem rna_enum_region_type_items[] = {
{RGN_TYPE_TOOLS, "TOOLS", 0, "Tools", ""},
{RGN_TYPE_TOOL_PROPS, "TOOL_PROPS", 0, "Tool Properties", ""},
{RGN_TYPE_PREVIEW, "PREVIEW", 0, "Preview", ""},
+ {RGN_TYPE_HUD, "HUD", 0, "Floating Region", ""},
{RGN_TYPE_NAV_BAR, "NAVIGATION_BAR", 0, "Navigation Bar", ""},
{RGN_TYPE_EXECUTE, "EXECUTE", 0, "Execute Buttons", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#include "ED_screen.h"
@@ -100,44 +95,6 @@ static int rna_region_alignment_get(PointerRNA *ptr)
return (region->alignment & ~RGN_SPLIT_PREV);
}
-static void rna_Screen_layout_name_get(PointerRNA *ptr, char *value)
-{
- const bScreen *screen = ptr->data;
- const WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G_MAIN, screen, NULL);
-
- if (layout) {
- const char *name = BKE_workspace_layout_name_get(layout);
- strcpy(value, name);
- }
- else {
- value[0] = '\0';
- }
-}
-
-static int rna_Screen_layout_name_length(PointerRNA *ptr)
-{
- const bScreen *screen = ptr->data;
- const WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G_MAIN, screen, NULL);
-
- if (layout) {
- const char *name = BKE_workspace_layout_name_get(layout);
- return strlen(name);
- }
-
- return 0;
-}
-
-static void rna_Screen_layout_name_set(PointerRNA *ptr, const char *value)
-{
- bScreen *screen = ptr->data;
- WorkSpace *workspace;
- WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G_MAIN, screen, &workspace);
-
- if (layout) {
- BKE_workspace_layout_name_set(workspace, layout, value);
- }
-}
-
static bool rna_Screen_fullscreen_get(PointerRNA *ptr)
{
bScreen *sc = (bScreen *)ptr->data;
@@ -261,6 +218,16 @@ static int rna_Area_ui_type_get(PointerRNA *ptr)
{
int value = rna_Area_type_get(ptr) << 16;
ScrArea *sa = ptr->data;
+ /* sa->type can be NULL (when not yet initialized), try to do it now. */
+ /* Copied from `ED_area_initialize()`.*/
+ if (sa->type == NULL) {
+ sa->type = BKE_spacetype_from_id(sa->spacetype);
+ if (sa->type == NULL) {
+ sa->spacetype = SPACE_VIEW3D;
+ sa->type = BKE_spacetype_from_id(sa->spacetype);
+ }
+ BLI_assert(sa->type != NULL);
+ }
if (sa->type->space_subtype_item_extend != NULL) {
value |= sa->type->space_subtype_get(sa);
}
@@ -467,7 +434,7 @@ static void rna_def_region(BlenderRNA *brna)
{RGN_ALIGN_VSPLIT, "VERTICAL_SPLIT", 0, "Vertical Split", ""},
{RGN_ALIGN_FLOAT, "FLOAT", 0, "Float", "Region floats on screen, doesn't use any fixed alignment"},
{RGN_ALIGN_QSPLIT, "QUAD_SPLIT", 0, "Quad Split", "Region is split horizontally and vertically"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Region", NULL);
@@ -525,12 +492,6 @@ static void rna_def_screen(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Screen", "Screen data-block, defining the layout of areas in a window");
RNA_def_struct_ui_icon(srna, ICON_WORKSPACE);
- prop = RNA_def_property(srna, "layout_name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_Screen_layout_name_get", "rna_Screen_layout_name_length",
- "rna_Screen_layout_name_set");
- RNA_def_property_ui_text(prop, "Layout Name", "The name of the layout that refers to the screen");
- RNA_def_struct_name_property(srna, prop);
-
/* collections */
prop = RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 581b0e94aad..f372180dd3b 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,16 @@
* 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 *****
*/
-/** \file blender/makesrna/intern/rna_sculpt_paint.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
+#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "RNA_define.h"
@@ -41,7 +36,6 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
-#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_paint.h"
#include "BKE_brush.h"
@@ -54,7 +48,6 @@
#include "bmesh.h"
const EnumPropertyItem rna_enum_particle_edit_hair_brush_items[] = {
- {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
{PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
{PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
{PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"},
@@ -62,7 +55,7 @@ const EnumPropertyItem rna_enum_particle_edit_hair_brush_items[] = {
{PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up"},
{PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
{PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
@@ -80,7 +73,7 @@ const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
const EnumPropertyItem rna_enum_gpencil_weight_brush_items[] = {
{GP_SCULPT_TYPE_WEIGHT, "WEIGHT", ICON_GPBRUSH_WEIGHT, "Weight", "Weight Paint for Vertex Groups"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
@@ -89,7 +82,7 @@ static const EnumPropertyItem rna_enum_gpencil_lock_axis_items[] = {
{GP_LOCKAXIS_Y, "AXIS_Y", ICON_AXIS_FRONT, "Front (X-Z)", "Project strokes to plane locked to Y"},
{GP_LOCKAXIS_X, "AXIS_X", ICON_AXIS_SIDE, "Side (Y-Z)", "Project strokes to plane locked to X"},
{GP_LOCKAXIS_Z, "AXIS_Z", ICON_AXIS_TOP, "Top (X-Y)", "Project strokes to plane locked to Z"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -142,21 +135,19 @@ static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UN
}
const EnumPropertyItem rna_enum_particle_edit_disconnected_hair_brush_items[] = {
- {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
{PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
{PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
{PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
{PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
{PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem particle_edit_cache_brush_items[] = {
- {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
{PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths"},
{PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth paths"},
{PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make paths longer or shorter"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr)
@@ -164,8 +155,7 @@ static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr)
ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
ParticleBrushData *brush = NULL;
- if (pset->brushtype != PE_BRUSH_NONE)
- brush = &pset->brush[pset->brushtype];
+ brush = &pset->brush[pset->brushtype];
return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush);
}
@@ -491,7 +481,7 @@ static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr))
bScreen *sc;
Image *ima = scene->toolsettings->imapaint.canvas;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
SpaceLink *slink;
@@ -500,7 +490,7 @@ static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr))
SpaceImage *sima = (SpaceImage *)slink;
if (!sima->pin)
- ED_space_image_set(bmain, sima, scene, obedit, ima);
+ ED_space_image_set(bmain, sima, obedit, ima);
}
}
}
@@ -544,6 +534,10 @@ static char *rna_GPencilSculptBrush_path(PointerRNA *UNUSED(ptr))
return BLI_strdup("tool_settings.gpencil_sculpt.brush");
}
+static char *rna_GPencilSculptGuide_path(PointerRNA *UNUSED(ptr))
+{
+ return BLI_strdup("tool_settings.gpencil_sculpt.guide");
+}
#else
@@ -683,19 +677,19 @@ static void rna_def_sculpt(BlenderRNA *brna)
"Collapse Edges", "Collapse short edges to remove mesh detail where possible"},
{SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_COLLAPSE, "SUBDIVIDE_COLLAPSE", 0,
"Subdivide Collapse", "Both subdivide long edges and collapse short edges to refine mesh detail"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem detail_type_items[] = {
{0, "RELATIVE", 0,
"Relative Detail", "Mesh detail is relative to the brush size and detail size"},
{SCULPT_DYNTOPO_DETAIL_CONSTANT, "CONSTANT", 0,
- "Constant Detail", "Mesh detail is constant in object space according to detail size"},
+ "Constant Detail", "Mesh detail is constant in world space according to detail size"},
{SCULPT_DYNTOPO_DETAIL_BRUSH, "BRUSH", 0,
"Brush Detail", "Mesh detail is relative to brush radius"},
{SCULPT_DYNTOPO_DETAIL_MANUAL, "MANUAL", 0,
"Manual Detail", "Mesh detail does not change on each stroke, only when using Flood Fill"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -799,7 +793,7 @@ static void rna_def_sculpt(BlenderRNA *brna)
"In dynamic-topology mode, how mesh detail size is calculated");
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
- prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "gravity_factor");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
@@ -869,7 +863,15 @@ static void rna_def_image_paint(BlenderRNA *brna)
"Material", "Detect image slots from the material"},
{IMAGEPAINT_MODE_IMAGE, "IMAGE", 0,
"Single Image", "Set image for texture painting directly"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem paint_interp_items[] = {
+ {IMAGEPAINT_INTERP_LINEAR, "LINEAR", 0,
+ "Linear", "Linear interpolation"},
+ {IMAGEPAINT_INTERP_CLOSEST, "CLOSEST", 0,
+ "Closest", "No interpolation (sample closest texel)"},
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ImagePaint", "Paint");
@@ -964,6 +966,13 @@ static void rna_def_image_paint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mode", "Mode of operation for projection painting");
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_mode_update");
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "interp");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_enum_items(prop, paint_interp_items);
+ RNA_def_property_ui_text(prop, "Interpolation", "Texture filtering type");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_mode_update");
+
/* Missing data */
prop = RNA_def_property(srna, "missing_uvs", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_UVS);
@@ -999,26 +1008,26 @@ static void rna_def_particle_edit(BlenderRNA *brna)
{SCE_SELECT_PATH, "PATH", ICON_PARTICLE_PATH, "Path", "Path edit mode"},
{SCE_SELECT_POINT, "POINT", ICON_PARTICLE_POINT, "Point", "Point select mode"},
{SCE_SELECT_END, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem puff_mode[] = {
{0, "ADD", 0, "Add", "Make hairs more puffy"},
{1, "SUB", 0, "Sub", "Make hairs less puffy"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem length_mode[] = {
{0, "GROW", 0, "Grow", "Make hairs longer"},
{1, "SHRINK", 0, "Shrink", "Make hairs shorter"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem edit_type_items[] = {
{PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""},
{PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""},
{PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -1179,12 +1188,106 @@ static void rna_def_particle_edit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Curve", "");
}
+/* srna -- gpencil speed guides */
+static void rna_def_gpencil_guides(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "GPencilSculptGuide", NULL);
+ RNA_def_struct_sdna(srna, "GP_Sculpt_Guide");
+ RNA_def_struct_path_func(srna, "rna_GPencilSculptGuide_path");
+ RNA_def_struct_ui_text(srna, "GPencil Sculpt Guide", "Guides for drawing");
+
+ static const EnumPropertyItem prop_gpencil_guidetypes[] = {
+ {GP_GUIDE_CIRCULAR, "CIRCULAR", 0, "Circular", "Use single point to create rings"},
+ {GP_GUIDE_RADIAL, "RADIAL", 0, "Radial", "Use single point as direction"},
+ {GP_GUIDE_PARALLEL, "PARALLEL", 0, "Parallel", "Parallel lines"},
+ {GP_GUIDE_GRID, "GRID", 0, "Grid", "Grid allows horizontal and vertical lines"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_gpencil_guide_references[] = {
+ {GP_GUIDE_REF_CURSOR, "CURSOR", 0, "Cursor", "Use cursor as reference point"},
+ {GP_GUIDE_REF_CUSTOM, "CUSTOM", 0, "Custom", "Use custom reference point"},
+ {GP_GUIDE_REF_OBJECT, "OBJECT", 0, "Object", "Use object as reference point"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "use_guide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_guide", false);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(prop, "Use Guides", "Enable speed guides");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_snapping", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_snapping", false);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(prop, "Use Snapping", "Enable snapping to guides angle or spacing options");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "reference_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "reference_object");
+ RNA_def_property_ui_text(prop, "Object", "Object used for reference point");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
+
+ prop = RNA_def_property(srna, "reference_point", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "reference_point");
+ RNA_def_property_enum_items(prop, prop_gpencil_guide_references);
+ RNA_def_property_ui_text(prop, "Type", "Type of speed guide");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_gpencil_guidetypes);
+ RNA_def_property_ui_text(prop, "Type", "Type of speed guide");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_range(prop, -(M_PI * 2.0f), (M_PI * 2.0f));
+ RNA_def_property_ui_text(prop, "Angle", "Direction of lines");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "angle_snap", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle_snap");
+ RNA_def_property_range(prop, -(M_PI * 2.0f), (M_PI * 2.0f));
+ RNA_def_property_ui_text(prop, "Angle Snap", "Angle snapping");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "spacing", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "spacing");
+ RNA_def_property_float_default(prop, 0.01f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
+ RNA_def_property_ui_text(prop, "Spacing", "Guide spacing");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "location");
+ RNA_def_property_array(prop, 3);
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_ui_text(prop, "Location", "Custom reference point for guides");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
+}
+
static void rna_def_gpencil_sculpt(BlenderRNA *brna)
{
static const EnumPropertyItem prop_direction_items[] = {
{0, "ADD", ICON_ADD, "Add", "Add effect of brush"},
{GP_SCULPT_FLAG_INVERT, "SUBTRACT", ICON_REMOVE, "Subtract", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
StructRNA *srna;
PropertyRNA *prop;
@@ -1215,6 +1318,11 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_ui_text(prop, "Brush", "");
+ prop = RNA_def_property(srna, "guide", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "GPencilSculptGuide");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_ui_text(prop, "Guide", "");
+
prop = RNA_def_property(srna, "use_select_mask", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_SELECT_MASK);
RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke points");
@@ -1284,6 +1392,14 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ /* threshold for cutter */
+ prop = RNA_def_property(srna, "intersection_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "isect_threshold");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_ui_text(prop, "Threshold", "Threshold for stroke intersections");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+
/* brush */
srna = RNA_def_struct(brna, "GPencilSculptBrush", NULL);
RNA_def_struct_sdna(srna, "GP_Sculpt_Data");
@@ -1368,7 +1484,6 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_property_boolean_default(prop, true);
RNA_def_property_ui_text(prop, "Enable Cursor", "Enable cursor on screen");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
-
}
void RNA_def_sculpt_paint(BlenderRNA *brna)
@@ -1384,6 +1499,7 @@ void RNA_def_sculpt_paint(BlenderRNA *brna)
rna_def_vertex_paint(brna);
rna_def_image_paint(brna);
rna_def_particle_edit(brna);
+ rna_def_gpencil_guides(brna);
rna_def_gpencil_sculpt(brna);
RNA_define_animate_sdna(true);
}
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 433ca729c65..c01f59582d1 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_sequencer.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -32,6 +26,7 @@
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_movieclip_types.h"
+#include "DNA_vfont_types.h"
#include "BLI_math.h"
@@ -69,7 +64,7 @@ const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = {
{seqModifierType_Mask, "MASK", ICON_NONE, "Mask", ""},
{seqModifierType_WhiteBalance, "WHITE_BALANCE", ICON_NONE, "White Balance", ""},
{seqModifierType_Tonemap, "TONEMAP", ICON_NONE, "Tone Map", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -461,6 +456,19 @@ static void rna_SequenceCrop_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P
BKE_sequence_invalidate_cache(scene, seq);
}
+static void rna_Sequence_text_font_set(PointerRNA *ptr, PointerRNA ptr_value)
+{
+ Sequence *seq = ptr->data;
+ TextVars *data = seq->effectdata;
+ VFont *value = ptr_value.data;
+
+ BKE_sequencer_text_font_unload(data, true);
+
+ id_us_plus(&value->id);
+ data->text_blf_id = SEQ_FONT_NOT_LOADED;
+ data->text_font = value;
+}
+
/* name functions that ignore the first two characters */
static void rna_Sequence_name_get(PointerRNA *ptr, char *value)
{
@@ -1220,7 +1228,7 @@ static void rna_def_strip_proxy(BlenderRNA *brna)
{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}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SequenceProxy", NULL);
@@ -1394,7 +1402,7 @@ static const EnumPropertyItem blend_mode_items[] = {
{SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
{SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
{SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_sequence_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
@@ -1468,7 +1476,7 @@ static void rna_def_sequence(BlenderRNA *brna)
{SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
{SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
{SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Sequence", NULL);
@@ -1622,7 +1630,7 @@ static void rna_def_sequence(BlenderRNA *brna)
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);
+ prop = RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
RNA_def_property_float_sdna(prop, NULL, "effect_fader");
@@ -1661,7 +1669,7 @@ static void rna_def_editor(BlenderRNA *brna)
static const EnumPropertyItem editing_storage_items[] = {
{0, "PER_STRIP", 0, "Per Strip", "Store proxies using per strip settings"},
{SEQ_EDIT_PROXY_DIR_STORAGE, "PROJECT", 0, "Project", "Store proxies using project directory"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SequenceEditor", NULL);
RNA_def_struct_ui_text(srna, "Sequence Editor", "Sequence editing data for a Scene data-block");
@@ -1729,7 +1737,7 @@ static void rna_def_filter_video(StructRNA *srna)
static const EnumPropertyItem alpha_mode_items[] = {
{SEQ_ALPHA_STRAIGHT, "STRAIGHT", 0, "Straight", "RGB channels in transparent pixels are unaffected by the alpha channel"},
{SEQ_ALPHA_PREMUL, "PREMUL", 0, "Premultiplied", "RGB channels in transparent pixels are multiplied by the alpha channel"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
@@ -2146,7 +2154,7 @@ static void rna_def_sound(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_waveform", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_AUDIO_DRAW_WAVEFORM);
- RNA_def_property_ui_text(prop, "Draw Waveform", "Whether to draw the sound's waveform");
+ RNA_def_property_ui_text(prop, "Display Waveform", "Display the audio waveform inside the clip");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
rna_def_input(srna);
@@ -2189,18 +2197,18 @@ static void rna_def_wipe(StructRNA *srna)
/* not used yet {3, "CROSS", 0, "Cross", ""}, */
{4, "IRIS", 0, "Iris", ""},
{5, "CLOCK", 0, "Clock", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem wipe_direction_items[] = {
{0, "OUT", 0, "Out", ""},
{1, "IN", 0, "In", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_struct_sdna_from(srna, "WipeVars", "effectdata");
- prop = RNA_def_property(srna, "blur_width", PROP_FLOAT, PROP_UNSIGNED);
+ prop = RNA_def_property(srna, "blur_width", PROP_FLOAT, PROP_FACTOR);
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",
@@ -2232,13 +2240,13 @@ static void rna_def_glow(StructRNA *srna)
RNA_def_struct_sdna_from(srna, "GlowVars", "effectdata");
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "fMini");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Threshold", "Minimum intensity to trigger a glow");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "clamp", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "clamp", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "fClamp");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Clamp", "Brightness limit of intensity");
@@ -2276,13 +2284,13 @@ static void rna_def_transform(StructRNA *srna)
{0, "NONE", 0, "None", "No interpolation"},
{1, "BILINEAR", 0, "Bilinear", "Bilinear interpolation"},
{2, "BICUBIC", 0, "Bicubic", "Bicubic interpolation"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem translation_unit_items[] = {
{0, "PIXELS", 0, "Pixels", ""},
{1, "PERCENT", 0, "Percent", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_struct_sdna_from(srna, "TransformVars", "effectdata");
@@ -2365,7 +2373,7 @@ static void rna_def_speed_control(StructRNA *srna)
RNA_def_property_ui_text(prop, "Use as speed", "Interpret the value as speed instead of a frame number");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "scale_to_length", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_scale_to_length", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_COMPRESS_IPO_Y);
RNA_def_property_ui_text(prop, "Scale to length", "Scale values from 0.0 to 1.0 to target sequence length");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
@@ -2394,19 +2402,27 @@ static void rna_def_text(StructRNA *srna)
{SEQ_TEXT_ALIGN_X_LEFT, "LEFT", 0, "Left", ""},
{SEQ_TEXT_ALIGN_X_CENTER, "CENTER", 0, "Center", ""},
{SEQ_TEXT_ALIGN_X_RIGHT, "RIGHT", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem text_align_y_items[] = {
{SEQ_TEXT_ALIGN_Y_TOP, "TOP", 0, "Top", ""},
{SEQ_TEXT_ALIGN_Y_CENTER, "CENTER", 0, "Center", ""},
{SEQ_TEXT_ALIGN_Y_BOTTOM, "BOTTOM", 0, "Bottom", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
RNA_def_struct_sdna_from(srna, "TextVars", "effectdata");
+ prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "text_font");
+ RNA_def_property_ui_icon(prop, ICON_FILE_FONT, false);
+ RNA_def_property_ui_text(prop, "Font", "Font of the text. Falls back to the UI font by default");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Sequence_text_font_set", NULL, NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "text_size");
RNA_def_property_ui_text(prop, "Size", "Size of the text");
@@ -2484,7 +2500,7 @@ static void rna_def_color_mix(StructRNA *srna)
{SEQ_TYPE_VALUE, "VALUE", 0, "Value", ""},
{SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
{SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -2530,7 +2546,7 @@ static EffectInfo def_effects[] = {
{"TextSequence", "Text Sequence", "Sequence strip creating text",
rna_def_text, 0},
{"ColorMixSequence", "Color Mix Sequence", "Color Mix Sequence", rna_def_color_mix, 2},
- {"", "", "", NULL, 0}
+ {"", "", "", NULL, 0},
};
static void rna_def_effects(BlenderRNA *brna)
@@ -2558,13 +2574,13 @@ static void rna_def_modifier(BlenderRNA *brna)
static const EnumPropertyItem mask_input_type_items[] = {
{SEQUENCE_MASK_INPUT_STRIP, "STRIP", 0, "Strip", "Use sequencer strip as mask input"},
{SEQUENCE_MASK_INPUT_ID, "ID", 0, "Mask", "Use mask ID as mask input"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem mask_time_items[] = {
{SEQUENCE_MASK_TIME_RELATIVE, "RELATIVE", 0, "Relative", "Mask animation is offset to start of strip"},
{SEQUENCE_MASK_TIME_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Mask animation is in sync with scene frame"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SequenceModifier", NULL);
@@ -2721,7 +2737,7 @@ static void rna_def_tonemap_modifier(BlenderRNA *brna)
static const EnumPropertyItem type_items[] = {
{SEQ_TONEMAP_RD_PHOTORECEPTOR, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""},
{SEQ_TONEMAP_RH_SIMPLE, "RH_SIMPLE", 0, "Rh Simple", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SequencerTonemapModifierData", "SequenceModifier");
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index 4c56f4c7ccd..b93bfdfe137 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2010)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_sequencer_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -230,7 +224,7 @@ static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, Repor
bSound *sound = BKE_sound_new_file(bmain, file);
if (sound->playback_handle == NULL) {
- BKE_libblock_free(bmain, sound);
+ BKE_id_free(bmain, sound);
BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file");
return NULL;
}
@@ -475,7 +469,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
{SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
{SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
{SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
RNA_def_property_srna(cprop, "Sequences");
diff --git a/source/blender/makesrna/intern/rna_shader_fx.c b/source/blender/makesrna/intern/rna_shader_fx.c
index bea62cfc75e..78a21b71fbf 100644
--- a/source/blender/makesrna/intern/rna_shader_fx.c
+++ b/source/blender/makesrna/intern/rna_shader_fx.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_shader_fx.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -59,11 +55,11 @@ const EnumPropertyItem rna_enum_object_shaderfx_type_items[] = {
{eShaderFxType_Shadow, "FX_SHADOW", ICON_SHADERFX, "Shadow", "Create a shadow effect"},
{eShaderFxType_Swirl, "FX_SWIRL", ICON_SHADERFX, "Swirl", "Create a rotation distortion"},
{eShaderFxType_Wave, "FX_WAVE", ICON_SHADERFX, "Wave Distortion", "Apply sinusoidal deformation"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_shaderfx_rim_modes_items[] = {
- {eShaderFxRimMode_Normal, "NORMAL", 0, "Normal", "" },
+ {eShaderFxRimMode_Normal, "NORMAL", 0, "Regular", "" },
{eShaderFxRimMode_Overlay, "OVERLAY", 0, "Overlay", "" },
{eShaderFxRimMode_Add, "ADD", 0, "Add", "" },
{eShaderFxRimMode_Subtract, "SUBTRACT", 0, "Subtract", "" },
@@ -81,7 +77,7 @@ static const EnumPropertyItem rna_enum_shaderfx_glow_modes_items[] = {
static const EnumPropertyItem rna_enum_shaderfx_colorize_modes_items[] = {
{eShaderFxColorizeMode_GrayScale, "GRAYSCALE", 0, "Gray Scale", "" },
{eShaderFxColorizeMode_Sepia, "SEPIA", 0, "Sepia", "" },
- {eShaderFxColorizeMode_BiTone, "BITONE", 0, "Bi-Tone", "" },
+ {eShaderFxColorizeMode_Duotone, "DUOTONE", 0, "Duotone", "" },
{eShaderFxColorizeMode_Transparent, "TRANSPARENT", 0, "Transparent", "" },
{eShaderFxColorizeMode_Custom, "CUSTOM", 0, "Custom", "" },
{0, NULL, 0, NULL, NULL }
@@ -522,7 +518,7 @@ static void rna_def_shader_fx_glow(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mode", "Glow mode");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "threshold");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);
@@ -573,7 +569,7 @@ static void rna_def_shader_fx_swirl(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Angle", "Angle of rotation");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
- prop = RNA_def_property(srna, "transparent", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_transparent", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_SWIRL_MAKE_TRANSPARENT);
RNA_def_property_ui_text(prop, "Transparent", "Make image transparent outside of radius");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
@@ -662,6 +658,7 @@ void RNA_def_shader_fx(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, rna_enum_object_shaderfx_type_items);
RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID); /* Abused, for "Light"... */
/* flags */
prop = RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 65ff61096cc..3f44d488497 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Daniel Genrich
- * Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_smoke.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -30,7 +23,6 @@
#include <limits.h>
#include "BLI_sys_types.h"
-#include "BLI_threads.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
@@ -52,6 +44,8 @@
#ifdef RNA_RUNTIME
+#include "BLI_threads.h"
+
#include "BKE_colorband.h"
#include "BKE_context.h"
#include "BKE_particle.h"
@@ -455,7 +449,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
{MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""},
#endif
/* {MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_compression_items[] = {
@@ -470,14 +464,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
static const EnumPropertyItem smoke_cache_comp_items[] = {
{SM_CACHE_LIGHT, "CACHELIGHT", 0, "Light", "Fast but not so effective compression"},
{SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow compression"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem smoke_highres_sampling_items[] = {
{SM_HRES_FULLSAMPLE, "FULLSAMPLE", 0, "Full Sample", ""},
{SM_HRES_LINEAR, "LINEAR", 0, "Linear", ""},
{SM_HRES_NEAREST, "NEAREST", 0, "Nearest", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem smoke_data_depth_items[] = {
@@ -491,7 +485,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
{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}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem cache_file_type_items[] = {
@@ -499,25 +493,25 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
#ifdef WITH_OPENVDB
{PTCACHE_FILE_OPENVDB, "OPENVDB", 0, "OpenVDB", "OpenVDB file format"},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem smoke_view_items[] = {
{MOD_SMOKE_SLICE_VIEW_ALIGNED, "VIEW_ALIGNED", 0, "View", "Slice volume parallel to the view plane"},
{MOD_SMOKE_SLICE_AXIS_ALIGNED, "AXIS_ALIGNED", 0, "Axis", "Slice volume parallel to the major axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem axis_slice_method_items[] = {
{AXIS_SLICE_FULL, "FULL", 0, "Full", "Slice the whole domain object"},
{AXIS_SLICE_SINGLE, "SINGLE", 0, "Single", "Perform a single slice of the domain object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem interp_method_item[] = {
{VOLUME_INTERP_LINEAR, "LINEAR", 0, "Linear", "Good smoothness and speed"},
{VOLUME_INTERP_CUBIC, "CUBIC", 0, "Cubic", "Smoothed high quality interpolation, but slower"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem axis_slice_position_items[] = {
@@ -525,13 +519,13 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
{SLICE_AXIS_X, "X", 0, "X", "Slice along the X axis"},
{SLICE_AXIS_Y, "Y", 0, "Y", "Slice along the Y axis"},
{SLICE_AXIS_Z, "Z", 0, "Z", "Slice along the Z axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem vector_draw_items[] = {
{VECTOR_DRAW_NEEDLE, "NEEDLE", 0, "Needle", "Display vectors as needles"},
{VECTOR_DRAW_STREAMLINE, "STREAMLINE", 0, "Streamlines", "Display vectors as streamlines"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SmokeDomainSettings", NULL);
@@ -562,7 +556,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
prop = RNA_def_property(srna, "show_high_resolution", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "viewsettings", MOD_SMOKE_VIEW_SHOWBIG);
+ RNA_def_property_boolean_sdna(prop, NULL, "viewsettings", MOD_SMOKE_VIEW_SHOW_HIGHRES);
RNA_def_property_ui_text(prop, "Show High Resolution", "Show high resolution (using amplification)");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
@@ -617,7 +611,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Strength", "Strength of noise");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
- prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
+ prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "diss_speed");
RNA_def_property_range(prop, 1.0, 10000.0);
RNA_def_property_ui_range(prop, 1.0, 10000.0, 1, -1);
@@ -763,7 +757,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Smoke", "Amount of smoke created by burning fuel");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
- prop = RNA_def_property(srna, "flame_vorticity", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "flame_vorticity", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0, 2.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 5);
RNA_def_property_ui_text(prop, "Vorticity", "Additional vorticity for the flames");
@@ -848,7 +842,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
"How many slices per voxel should be generated");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
- prop = RNA_def_property(srna, "slice_depth", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "slice_depth", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "slice_depth");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
@@ -868,7 +862,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method to use for smoke/fire volumes in solid mode");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
- prop = RNA_def_property(srna, "display_velocity", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw_velocity", 0);
RNA_def_property_ui_text(prop, "Display Velocity", "Toggle visualization of the velocity field as needles");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
@@ -906,7 +900,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
{FLUID_FIELD_VELOCITY_X, "VELOCITY_X", 0, "X Velocity", "X component of the velocity field"},
{FLUID_FIELD_VELOCITY_Y, "VELOCITY_Y", 0, "Y Velocity", "Y component of the velocity field"},
{FLUID_FIELD_VELOCITY_Z, "VELOCITY_Z", 0, "Z Velocity", "Z component of the velocity field"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "coba_field", PROP_ENUM, PROP_NONE);
@@ -926,7 +920,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
RNA_def_property_ui_text(prop, "Clipping",
- "Value under which voxels are considered empty space to optimize caching or rendering");
+ "Value under which voxels are considered empty space to optimize caching and rendering");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
}
@@ -940,19 +934,19 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
{MOD_SMOKE_FLOW_TYPE_SMOKE, "SMOKE", 0, "Smoke", "Add smoke"},
{MOD_SMOKE_FLOW_TYPE_SMOKEFIRE, "BOTH", 0, "Fire + Smoke", "Add fire and smoke"},
{MOD_SMOKE_FLOW_TYPE_FIRE, "FIRE", 0, "Fire", "Add fire"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem smoke_flow_sources[] = {
{MOD_SMOKE_FLOW_SOURCE_PARTICLES, "PARTICLES", ICON_PARTICLES, "Particle System", "Emit smoke from particles"},
{MOD_SMOKE_FLOW_SOURCE_MESH, "MESH", ICON_META_CUBE, "Mesh", "Emit smoke from mesh surface or volume"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem smoke_flow_texture_types[] = {
{MOD_SMOKE_FLOW_TEXTURE_MAP_AUTO, "AUTO", 0, "Generated", "Generated coordinates centered to flow object"},
{MOD_SMOKE_FLOW_TEXTURE_MAP_UV, "UV", 0, "UV", "Use UV layer for texture coordinates"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SmokeFlowSettings", NULL);
@@ -960,7 +954,7 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "SmokeFlowSettings");
RNA_def_struct_path_func(srna, "rna_SmokeFlowSettings_path");
- prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "density");
RNA_def_property_range(prop, 0.0, 1);
RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 4);
@@ -1036,13 +1030,13 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Random", "Amount of random velocity");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
- prop = RNA_def_property(srna, "volume_density", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "volume_density", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Volume", "Factor for smoke emitted from inside the mesh volume");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
- prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
RNA_def_property_ui_text(prop, "Surface", "Maximum distance from mesh surface to emit smoke");
@@ -1114,7 +1108,7 @@ static void rna_def_smoke_coll_settings(BlenderRNA *brna)
{SM_COLL_STATIC, "COLLSTATIC", 0, "Static", "Non moving obstacle"},
{SM_COLL_RIGID, "COLLRIGID", 0, "Rigid", "Rigid obstacle"},
{SM_COLL_ANIMATED, "COLLANIMATED", 0, "Animated", "Animated obstacle"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c
index fb0ba0cdd11..241c42b983e 100644
--- a/source/blender/makesrna/intern/rna_sound.c
+++ b/source/blender/makesrna/intern/rna_sound.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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, Roland Hess
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_sound.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_sound_api.c b/source/blender/makesrna/intern/rna_sound_api.c
index 293a5135acb..9b3529544c2 100644
--- a/source/blender/makesrna/intern/rna_sound_api.c
+++ b/source/blender/makesrna/intern/rna_sound_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2015 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_sound_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include "DNA_packedFile_types.h"
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index d18ffd422e0..0592a524b76 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_space.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -81,7 +75,7 @@ const EnumPropertyItem rna_enum_space_type_items[] = {
{0, "", ICON_NONE, "Animation", ""},
//{SPACE_ACTION, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls (NOTE: Switch to 'Timeline' mode)"}, /* XXX */
{SPACE_ACTION, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", "Adjust timing of keyframes"},
- {SPACE_IPO, "GRAPH_EDITOR", ICON_GRAPH, "Graph Editor", "Edit drivers and keyframe interpolation"},
+ {SPACE_GRAPH, "GRAPH_EDITOR", ICON_GRAPH, "Graph Editor", "Edit drivers and keyframe interpolation"},
{SPACE_NLA, "NLA_EDITOR", ICON_NLA, "Nonlinear Animation", "Combine and layer Actions"},
/* Scripting */
@@ -100,18 +94,18 @@ const EnumPropertyItem rna_enum_space_type_items[] = {
/* Data */
{0, "", ICON_NONE, "Data", ""},
{SPACE_OUTLINER, "OUTLINER", ICON_OUTLINER, "Outliner", "Overview of scene graph and all available data-blocks"},
- {SPACE_BUTS, "PROPERTIES", ICON_PROPERTIES, "Properties", "Edit properties of active object and related data-blocks"},
+ {SPACE_PROPERTIES, "PROPERTIES", ICON_PROPERTIES, "Properties", "Edit properties of active object and related data-blocks"},
{SPACE_FILE, "FILE_BROWSER", ICON_FILEBROWSER, "File Browser", "Browse for files and assets"},
{SPACE_USERPREF, "PREFERENCES", ICON_PREFERENCES, "Preferences",
"Edit persistent configuration settings"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_space_graph_mode_items[] = {
{SIPO_MODE_ANIMATION, "FCURVES", ICON_GRAPH, "Graph Editor",
"Edit animation/keyframes displayed as 2D curves"},
{SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#define SACT_ITEM_DOPESHEET \
@@ -139,7 +133,7 @@ static EnumPropertyItem rna_enum_space_action_mode_all_items[] = {
SACT_ITEM_GPENCIL,
SACT_ITEM_MASK,
SACT_ITEM_CACHEFILE,
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_space_action_ui_mode_items[] = {
SACT_ITEM_DOPESHEET,
@@ -149,14 +143,14 @@ static EnumPropertyItem rna_enum_space_action_ui_mode_items[] = {
SACT_ITEM_GPENCIL,
SACT_ITEM_MASK,
SACT_ITEM_CACHEFILE,
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
/* expose as ui_mode */
const EnumPropertyItem rna_enum_space_action_mode_items[] = {
SACT_ITEM_DOPESHEET,
SACT_ITEM_TIMELINE,
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#undef SACT_ITEM_DOPESHEET
@@ -182,20 +176,20 @@ const EnumPropertyItem rna_enum_space_image_mode_all_items[] = {
SI_ITEM_UV,
SI_ITEM_PAINT,
SI_ITEM_MASK,
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_space_image_mode_ui_items[] = {
SI_ITEM_VIEW("View", ICON_FILE_IMAGE),
SI_ITEM_PAINT,
SI_ITEM_MASK,
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_space_image_mode_items[] = {
SI_ITEM_VIEW("Image Editor", ICON_IMAGE),
SI_ITEM_UV,
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#undef SI_ITEM_VIEW
@@ -214,14 +208,14 @@ static const EnumPropertyItem stereo3d_camera_items[] = {
V3D_S3D_CAMERA_LEFT
V3D_S3D_CAMERA_RIGHT
V3D_S3D_CAMERA_S3D
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static const EnumPropertyItem multiview_camera_items[] = {
V3D_S3D_CAMERA_VIEWS
V3D_S3D_CAMERA_S3D
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -234,7 +228,7 @@ static const EnumPropertyItem multiview_camera_items[] = {
static const EnumPropertyItem stereo3d_eye_items[] = {
{STEREO_LEFT_ID, "LEFT_EYE", ICON_NONE, "Left Eye"},
{STEREO_RIGHT_ID, "RIGHT_EYE", ICON_NONE, "Right Eye"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -248,7 +242,7 @@ static const EnumPropertyItem display_channels_items[] = {
{SI_SHOW_R, "RED", ICON_COLOR_RED, "Red", ""},
{SI_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""},
{SI_SHOW_B, "BLUE", ICON_COLOR_BLUE, "Blue", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
@@ -262,7 +256,7 @@ static const EnumPropertyItem autosnap_items[] = {
{SACTSNAP_SECOND, "SECOND", 0, "Nearest Second", "Snap to actual seconds (nla-action time)"},
/* {-1, "", 0, "", ""}, */
{SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -271,14 +265,14 @@ const EnumPropertyItem rna_enum_shading_type_items[] = {
{OB_SOLID, "SOLID", ICON_SHADING_SOLID, "Solid", "Display in solid mode"},
{OB_MATERIAL, "MATERIAL", ICON_SHADING_TEXTURE, "LookDev", "Display in LookDev mode"},
{OB_RENDER, "RENDERED", ICON_SHADING_RENDERED, "Rendered", "Display render preview"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_viewport_lighting_items[] = {
{V3D_LIGHTING_FLAT, "FLAT", 0, "Flat", "Display using flat lighting"},
{V3D_LIGHTING_STUDIO, "STUDIO", 0, "Studio", "Display using studio lighting"},
{V3D_LIGHTING_MATCAP, "MATCAP", 0, "MatCap", "Display using matcap material and lighting"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_shading_color_type_items[] = {
@@ -287,19 +281,19 @@ static const EnumPropertyItem rna_enum_shading_color_type_items[] = {
{V3D_SHADING_OBJECT_COLOR, "OBJECT", 0, "Object", "Show object color"},
{V3D_SHADING_RANDOM_COLOR, "RANDOM", 0, "Random", "Show random object color"},
{V3D_SHADING_TEXTURE_COLOR, "TEXTURE", 0, "Texture", "Show texture"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_studio_light_items[] = {
{0, "DEFAULT", 0, "Default", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_clip_editor_mode_items[] = {
{SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
{SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask", "Show mask editing tools"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */
@@ -321,7 +315,7 @@ static const EnumPropertyItem buttons_context_items[] = {
{BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particles"},
{BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
{BCONTEXT_SHADERFX, "SHADERFX", ICON_SHADERFX, "Effects", "Object visual effects" },
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem fileselectparams_recursion_level_items[] = {
@@ -330,7 +324,7 @@ static const EnumPropertyItem fileselectparams_recursion_level_items[] = {
{2, "ALL_1", 0, "One Level", "List all sub-directories' content, one level of recursion"},
{3, "ALL_2", 0, "Two Levels", "List all sub-directories' content, two levels of recursion"},
{4, "ALL_3", 0, "Three Levels", "List all sub-directories' content, three levels of recursion"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_file_sort_items[] = {
@@ -338,7 +332,7 @@ const EnumPropertyItem rna_enum_file_sort_items[] = {
{FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension/type"},
{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}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -392,11 +386,11 @@ static StructRNA *rna_Space_refine(struct PointerRNA *ptr)
switch (space->spacetype) {
case SPACE_VIEW3D:
return &RNA_SpaceView3D;
- case SPACE_IPO:
+ case SPACE_GRAPH:
return &RNA_SpaceGraphEditor;
case SPACE_OUTLINER:
return &RNA_SpaceOutliner;
- case SPACE_BUTS:
+ case SPACE_PROPERTIES:
return &RNA_SpaceProperties;
case SPACE_FILE:
return &RNA_SpaceFileBrowser;
@@ -511,7 +505,7 @@ static void rna_Space_view2d_sync_update(Main *UNUSED(bmain), Scene *UNUSED(scen
static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
/* need set all caches as dirty to recalculate onion skinning */
- for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->type == OB_GPENCIL) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
@@ -531,31 +525,15 @@ static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA
}
}
-static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, bool value)
+static void rna_SpaceView3D_use_local_camera_set(PointerRNA *ptr, bool value)
{
View3D *v3d = (View3D *)(ptr->data);
bScreen *sc = (bScreen *)ptr->id.data;
- v3d->scenelock = value;
+ v3d->scenelock = !value;
- if (value) {
+ if (!value) {
Scene *scene = ED_screen_scene_find(sc, G_MAIN->wm.first);
-
- /* TODO: restore local view. */
-#if 0
- int bit;
- v3d->lay = scene->lay;
-
- /* seek for layact */
- bit = 0;
- while (bit < 32) {
- if (v3d->lay & (1u << bit)) {
- v3d->layact = (1u << bit);
- break;
- }
- bit++;
- }
-#endif
v3d->camera = scene->camera;
}
}
@@ -672,7 +650,7 @@ static void rna_3DViewShading_type_update(Main *bmain, Scene *UNUSED(scene), Poi
return;
}
- for (Material *ma = bmain->mat.first; ma; ma = ma->id.next) {
+ for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
/* XXX Dependency graph does not support CD mask tracking,
* so we trigger materials shading for until it's properly supported.
* This is to ensure material batches are all recreated when switching
@@ -826,6 +804,11 @@ static const EnumPropertyItem *rna_View3DShading_color_type_itemf(
RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_TEXTURE_COLOR);
}
}
+ else if (shading->type == OB_WIRE) {
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_SINGLE_COLOR);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_OBJECT_COLOR);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_RANDOM_COLOR);
+ }
RNA_enum_item_end(&item, &totitem);
*r_free = true;
@@ -1048,13 +1031,12 @@ static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
{
SpaceImage *sima = (SpaceImage *)(ptr->data);
bScreen *sc = (bScreen *)ptr->id.data;
- wmWindow *win;
- Scene *scene = ED_screen_scene_find_with_window(sc, G_MAIN->wm.first, &win);
+ wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
BLI_assert(BKE_id_is_in_global_main(value.data));
- ED_space_image_set(G_MAIN, sima, scene, obedit, (Image *)value.data);
+ ED_space_image_set(G_MAIN, sima, obedit, (Image *)value.data);
}
static void rna_SpaceImageEditor_mask_set(PointerRNA *ptr, PointerRNA value)
@@ -1197,7 +1179,7 @@ static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(
{V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", ""},
{V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL,
"Individual Origins", "Pivot around each selected island's own median point"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
SpaceImage *sima = (SpaceImage *)ptr->data;
@@ -1240,13 +1222,13 @@ static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(
/* note: this function exists only to avoid id refcounting */
static void rna_SpaceProperties_pin_id_set(PointerRNA *ptr, PointerRNA value)
{
- SpaceButs *sbuts = (SpaceButs *)(ptr->data);
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
sbuts->pinid = value.data;
}
static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
{
- SpaceButs *sbuts = (SpaceButs *)(ptr->data);
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
if (sbuts->pinid)
return ID_code_to_RNA_type(GS(sbuts->pinid->name));
@@ -1256,7 +1238,7 @@ static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
static void rna_SpaceProperties_pin_id_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- SpaceButs *sbuts = (SpaceButs *)(ptr->data);
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
ID *id = sbuts->pinid;
if (id == NULL) {
@@ -1285,7 +1267,7 @@ static void rna_SpaceProperties_pin_id_update(Main *UNUSED(bmain), Scene *UNUSED
static void rna_SpaceProperties_context_set(PointerRNA *ptr, int value)
{
- SpaceButs *sbuts = (SpaceButs *)(ptr->data);
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
sbuts->mainb = value;
sbuts->mainbuser = value;
@@ -1295,7 +1277,7 @@ static const EnumPropertyItem *rna_SpaceProperties_context_itemf(
bContext *UNUSED(C), PointerRNA *ptr,
PropertyRNA *UNUSED(prop), bool *r_free)
{
- SpaceButs *sbuts = (SpaceButs *)(ptr->data);
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
EnumPropertyItem *item = NULL;
int totitem = 0;
@@ -1384,7 +1366,7 @@ static const EnumPropertyItem *rna_SpaceProperties_context_itemf(
static void rna_SpaceProperties_context_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- SpaceButs *sbuts = (SpaceButs *)(ptr->data);
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
/* XXX BCONTEXT_DATA is ugly, but required for lights... See T51318. */
if (ELEM(sbuts->mainb, BCONTEXT_WORLD, BCONTEXT_MATERIAL, BCONTEXT_TEXTURE, BCONTEXT_DATA)) {
sbuts->preview = 1;
@@ -1532,7 +1514,7 @@ static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr)
}
/* Force update of animdata */
- adt->recalc |= ADT_RECALC_ANIM;
+ DEG_id_tag_update(&obact->id, ID_RECALC_ANIMATION);
}
/* force depsgraph flush too */
@@ -1608,7 +1590,7 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
static void rna_SpaceGraphEditor_display_mode_update(bContext *C, PointerRNA *ptr)
{
ScrArea *sa = rna_area_from_space(ptr);
- SpaceIpo *sipo = (SpaceIpo *)ptr->data;
+ SpaceGraph *sipo = (SpaceGraph *)ptr->data;
/* for "Drivers" mode, enable all the necessary bits and pieces */
if (sipo->mode == SIPO_MODE_DRIVERS) {
@@ -1624,7 +1606,7 @@ static void rna_SpaceGraphEditor_display_mode_update(bContext *C, PointerRNA *pt
static bool rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr)
{
- SpaceIpo *sipo = (SpaceIpo *)(ptr->data);
+ SpaceGraph *sipo = (SpaceGraph *)(ptr->data);
return (BLI_listbase_is_empty(&sipo->runtime.ghost_curves) == false);
}
@@ -2105,7 +2087,7 @@ static const EnumPropertyItem dt_uv_items[] = {
{SI_UVDT_DASH, "DASH", 0, "Dash", "Display dashed black-white edges"},
{SI_UVDT_BLACK, "BLACK", 0, "Black", "Display black edges"},
{SI_UVDT_WHITE, "WHITE", 0, "White", "Display white edges"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_space(BlenderRNA *brna)
@@ -2140,7 +2122,7 @@ static void rna_def_space_mask_info(StructRNA *srna, int noteflag, const char *m
static const EnumPropertyItem overlay_mode_items[] = {
{MASK_OVERLAY_ALPHACHANNEL, "ALPHACHANNEL", ICON_NONE, "Alpha Channel", "Show alpha channel of the mask"},
{MASK_OVERLAY_COMBINED, "COMBINED", ICON_NONE, "Combined", "Combine space background image with the mask"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
@@ -2185,13 +2167,20 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
"Select UVs that are at the same location and share a mesh vertex"},
{SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex",
"Select UVs that share mesh vertex, irrespective if they are in the same location"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem dt_uvstretch_items[] = {
{SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"},
{SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem pixel_snap_mode_items[] = {
+ {SI_PIXEL_SNAP_DISABLED, "DISABLED", 0, "Disabled", "Don't snap to pixels"},
+ {SI_PIXEL_SNAP_CORNER, "CORNER", 0, "Corner", "Snap to pixel corners"},
+ {SI_PIXEL_SNAP_CENTER, "CENTER", 0, "Center", "Snap to pixel centers"},
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SpaceUVEditor", NULL);
@@ -2265,9 +2254,9 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
/* todo: move edge and face drawing options here from G.f */
- prop = RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP);
- RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing");
+ prop = RNA_def_property(srna, "pixel_snap_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, pixel_snap_mode_items);
+ RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixels while editing");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
prop = RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE);
@@ -2296,7 +2285,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
{SO_DATA_API, "DATA_API", ICON_RNA, "Data API", "Display low level Blender data and its properties"},
{SO_ID_ORPHANS, "ORPHAN_DATA", ICON_ORPHAN_DATA, "Orphan Data",
"Display data-blocks which are unused and/or will be lost when the file is reloaded"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem filter_state_items[] = {
@@ -2304,11 +2293,11 @@ static void rna_def_space_outliner(BlenderRNA *brna)
{SO_FILTER_OB_VISIBLE, "VISIBLE", 0, "Visible", "Show visible objects"},
{SO_FILTER_OB_SELECTED, "SELECTED", 0, "Selected", "Show selected objects"},
{SO_FILTER_OB_ACTIVE, "ACTIVE", 0, "Active", "Show only the active object"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SpaceOutliner", "Space");
- RNA_def_struct_sdna(srna, "SpaceOops");
+ RNA_def_struct_sdna(srna, "SpaceOutliner");
RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data");
prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
@@ -2415,6 +2404,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "filter_id_type");
RNA_def_property_enum_items(prop, rna_enum_id_type_items);
RNA_def_property_ui_text(prop, "Filter ID Type", "Data-block type to show");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
}
static void rna_def_space_view3d_shading(BlenderRNA *brna)
@@ -2426,7 +2416,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
{V3D_SHADING_BACKGROUND_THEME, "THEME", 0, "Theme", "Use the theme for background color"},
{V3D_SHADING_BACKGROUND_WORLD, "WORLD", 0, "World", "Use the world for background color"},
{V3D_SHADING_BACKGROUND_VIEWPORT, "VIEWPORT", 0, "Viewport", "Use a custom color limited to this viewport only"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const float default_background_color[] = {0.05f, 0.05f, 0.05f};
@@ -2434,7 +2424,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
{V3D_SHADING_CAVITY_SSAO, "WORLD", 0, "World", "Cavity shading computed in world space, useful for larger-scale occlusion"},
{V3D_SHADING_CAVITY_CURVATURE, "SCREEN", 0, "Screen", "Curvature-based shading, useful for making fine details more visible"},
{V3D_SHADING_CAVITY_BOTH, "BOTH", 0, "Both", "Use both effects simultaneously"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -2550,6 +2540,13 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Color", "Color Type");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "wireframe_color_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "wire_color_type");
+ RNA_def_property_enum_items(prop, rna_enum_shading_color_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_View3DShading_color_type_itemf");
+ RNA_def_property_ui_text(prop, "Color", "Color Type");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
prop = RNA_def_property(srna, "single_color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "single_color");
RNA_def_property_array(prop, 3);
@@ -2603,6 +2600,12 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "use_dof", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_DEPTH_OF_FIELD);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Depth Of Field", "Use depth of field on viewport using the values from the active camera");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
prop = RNA_def_property(srna, "use_scene_lights", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_SCENE_LIGHTS);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -2659,7 +2662,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "3D View Overlay Settings", "Settings for display of overlays in the 3D viewport");
prop = RNA_def_property(srna, "show_overlays", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag2", V3D_HIDE_OVERLAYS);
RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like gizmos and outlines");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
@@ -2853,7 +2856,8 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_face_center", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_DOT);
- RNA_def_property_ui_text(prop, "Draw Face Center", "Display face center");
+ RNA_def_property_ui_text(prop, "Draw Face Center", "Display face center "
+ "(when disabled, edges display wider in edge mode)");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE);
@@ -2946,11 +2950,6 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "show_transparent_bones", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.arm_flag", V3D_OVERLAY_ARM_TRANSP_BONES);
- RNA_def_property_ui_text(prop, "Transparent Bones", "Display bones as transparent");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
prop = RNA_def_property(srna, "texture_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "overlay.texture_paint_mode_opacity");
RNA_def_property_float_default(prop, 1.0f);
@@ -3057,7 +3056,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{RV3D_PERSP, "PERSP", 0, "Perspective", ""},
{RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""},
{RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem bundle_drawtype_items[] = {
@@ -3068,7 +3067,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{OB_CUBE, "CUBE", 0, "Cube", ""},
{OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
{OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SpaceView3D", "Space");
@@ -3086,32 +3085,32 @@ static void rna_def_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_render_border", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_BORDER);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Render Border", "Use a region within the frame size for rendered viewport "
+ RNA_def_property_ui_text(prop, "Render Region", "Use a region within the frame size for rendered viewport"
"(when not viewing through the camera)");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "render_border_min_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "render_border.xmin");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Border Minimum X", "Minimum X value for the render border");
+ RNA_def_property_ui_text(prop, "Region Minimum X", "Minimum X value for the render region");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "render_border_min_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "render_border.ymin");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Border Minimum Y", "Minimum Y value for the render border");
+ RNA_def_property_ui_text(prop, "Region Minimum Y", "Minimum Y value for the render region");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "render_border_max_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "render_border.xmax");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Border Maximum X", "Maximum X value for the render border");
+ RNA_def_property_ui_text(prop, "Region Maximum X", "Maximum X value for the render region");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "render_border_max_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "render_border.ymax");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Border Maximum Y", "Maximum Y value for the render border");
+ RNA_def_property_ui_text(prop, "Region Maximum Y", "Maximum Y value for the render region");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE);
@@ -3142,7 +3141,6 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "near");
RNA_def_property_range(prop, 1e-6f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
RNA_def_property_float_default(prop, 0.1f);
@@ -3150,7 +3148,6 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "far");
RNA_def_property_range(prop, 1e-6f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
RNA_def_property_float_default(prop, 1000.0f);
@@ -3182,12 +3179,11 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Tool Gizmo", "Active tool gizmo");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_lock_camera_and_layers_set");
- RNA_def_property_ui_text(prop, "Lock Camera and Layers",
- "Use the scene's active camera and layers in this view, rather than local layers");
- RNA_def_property_ui_icon(prop, ICON_LOCKVIEW_OFF, 1);
+ prop = RNA_def_property(srna, "use_local_camera", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "scenelock", 1);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_use_local_camera_set");
+ RNA_def_property_ui_text(prop, "Use Local Camera",
+ "Use a local camera in this view, rather than scene's active camera camera");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "region_3d", PROP_POINTER, PROP_NONE);
@@ -3319,7 +3315,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_boolean_negative_sdna(
prop, NULL, view_mask_member[mask_index], info[type_index].type_mask);
RNA_def_property_ui_text(prop, info[type_index].name, "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
}
@@ -3460,7 +3456,7 @@ static void rna_def_space_buttons(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "SpaceProperties", "Space");
- RNA_def_struct_sdna(srna, "SpaceButs");
+ RNA_def_struct_sdna(srna, "SpaceProperties");
RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
prop = RNA_def_property(srna, "context", PROP_ENUM, PROP_NONE);
@@ -3644,7 +3640,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
{SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Preview", ""},
{SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer/Preview", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem display_mode_items[] = {
@@ -3652,7 +3648,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
{SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""},
{SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""},
{SEQ_DRAW_IMG_HISTOGRAM, "HISTOGRAM", ICON_SEQ_HISTOGRAM, "Histogram", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem proxy_render_size_items[] = {
@@ -3663,21 +3659,21 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
{SEQ_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""},
{SEQ_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "Proxy size 100%", ""},
{SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem overlay_type_items[] = {
{SEQ_DRAW_OVERLAY_RECT, "RECTANGLE", 0, "Rectangle", "Show rectangle area overlay"},
{SEQ_DRAW_OVERLAY_REFERENCE, "REFERENCE", 0, "Reference", "Show reference frame only"},
{SEQ_DRAW_OVERLAY_CURRENT, "CURRENT", 0, "Current", "Show current frame only"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem preview_channels_items[] = {
{SEQ_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
"Display image with RGB colors and alpha transparency"},
{0, "COLOR", ICON_IMAGE_RGB, "Color", "Display image with RGB colors"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem waveform_type_display_items[] = {
@@ -3687,7 +3683,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
"Waveforms drawn for all sound strips"},
{0, "DEFAULT_WAVEFORMS", 0, "Use Strip Option",
"Waveforms drawn according to strip setting"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
@@ -3741,7 +3737,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_METADATA);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_METADATA);
RNA_def_property_ui_text(prop, "Show Metadata", "Show metadata of first visible strip");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
@@ -3750,6 +3746,12 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+ prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_MARKER_LINES);
+ RNA_def_property_ui_text(prop, "Show Marker Lines",
+ "Show a vertical line for every marker");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_GPENCIL);
RNA_def_property_ui_text(prop, "Show Annotation",
@@ -4005,6 +4007,12 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
"Mark keyframes where the key value flow changes direction, based on comparison with adjacent keys");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+ prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SHOW_MARKER_LINES);
+ RNA_def_property_ui_text(prop, "Show Marker Lines",
+ "Show a vertical line for every marker");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
/* editing */
prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOTRANSKEYCULL);
@@ -4083,12 +4091,12 @@ static void rna_def_space_graph(BlenderRNA *brna)
{V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL, "Individual Centers", ""},
/*{V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", 0, "Median Point", ""}, */
/*{V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""}, */
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SpaceGraphEditor", "Space");
- RNA_def_struct_sdna(srna, "SpaceIpo");
+ RNA_def_struct_sdna(srna, "SpaceGraph");
RNA_def_struct_ui_text(srna, "Space Graph Editor", "Graph Editor space data");
/* mode */
@@ -4146,6 +4154,12 @@ static void rna_def_space_graph(BlenderRNA *brna)
"Display groups and channels with colors matching their corresponding groups");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+ prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_MARKER_LINES);
+ RNA_def_property_ui_text(prop, "Show Marker Lines",
+ "Show a vertical line for every marker");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
/* editing */
prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL);
@@ -4245,6 +4259,12 @@ static void rna_def_space_nla(BlenderRNA *brna)
"Show action-local markers on the strips, useful when synchronizing timing across strips");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
+ prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SNLA_SHOW_MARKER_LINES);
+ RNA_def_property_ui_text(prop, "Show Marker Lines",
+ "Show a vertical line for every marker");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
/* editing */
prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOREALTIMEUPDATES);
@@ -4274,7 +4294,7 @@ static void rna_def_console_line(BlenderRNA *brna)
{CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""},
{CONSOLE_LINE_INFO, "INFO", 0, "Info", ""},
{CONSOLE_LINE_ERROR, "ERROR", 0, "Error", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -4352,15 +4372,15 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
{FILE_SHORTDISPLAY, "LIST_SHORT", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
{FILE_LONGDISPLAY, "LIST_LONG", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
{FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem display_size_items[] = {
{32, "TINY", 0, "Tiny", ""},
{64, "SMALL", 0, "Small", ""},
- {128, "NORMAL", 0, "Normal", ""},
+ {128, "NORMAL", 0, "Regular", ""},
{256, "LARGE", 0, "Large", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem file_filter_idtypes_items[] = {
@@ -4397,7 +4417,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
{FILTER_ID_VF, "FONT", ICON_FONT_DATA, "Fonts", "Show/hide Font data-blocks"},
{FILTER_ID_WO, "WORLD", ICON_WORLD_DATA, "Worlds", "Show/hide World data-blocks"},
{FILTER_ID_WS, "WORK_SPACE", ICON_NONE, "Workspaces", "Show/hide workspace data-blocks"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem file_filter_idcategories_items[] = {
@@ -4418,7 +4438,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
"ENVIRONMENT", ICON_WORLD_DATA, "Environment", "Show/hide worlds, lights, cameras and speakers"},
{FILTER_ID_BR | FILTER_ID_GD | FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_CF,
"MISC", ICON_GREASEPENCIL, "Miscellaneous", "Show/hide other data types"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "FileSelectParams", NULL);
@@ -4728,7 +4748,8 @@ static void rna_def_space_userpref(BlenderRNA *brna)
static const EnumPropertyItem filter_type_items[] = {
{0, "NAME", 0, "Name", "Filter based on the operator name"},
{1, "KEY", 0, "Key-Binding", "Filter based on key bindings"},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
StructRNA *srna;
PropertyRNA *prop;
@@ -4815,7 +4836,7 @@ static void rna_def_space_node(BlenderRNA *brna)
#ifdef WITH_FREESTYLE
{SNODE_TEX_LINESTYLE, "LINESTYLE", ICON_LINE_DATA, "Line Style", "Edit texture nodes from Line Style"},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem shader_type_items[] = {
@@ -4824,7 +4845,7 @@ static void rna_def_space_node(BlenderRNA *brna)
#ifdef WITH_FREESTYLE
{SNODE_SHADER_LINESTYLE, "LINESTYLE", ICON_LINE_DATA, "Line Style", "Edit shader nodes from Line Style"},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem backdrop_channels_items[] = {
@@ -4835,18 +4856,19 @@ static void rna_def_space_node(BlenderRNA *brna)
{SNODE_SHOW_R, "RED", ICON_COLOR_RED, "Red", ""},
{SNODE_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""},
{SNODE_SHOW_B, "BLUE", ICON_COLOR_BLUE, "Blue", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem insert_ofs_dir_items[] = {
{SNODE_INSERTOFS_DIR_RIGHT, "RIGHT", 0, "Right"},
{SNODE_INSERTOFS_DIR_LEFT, "LEFT", 0, "Left"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem dummy_items[] = {
{0, "DUMMY", 0, "", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+ };
srna = RNA_def_struct(brna, "SpaceNodeEditor", "Space");
RNA_def_struct_sdna(srna, "SpaceNode");
@@ -4974,24 +4996,24 @@ static void rna_def_space_clip(BlenderRNA *brna)
{SC_VIEW_CLIP, "CLIP", ICON_SEQUENCE, "Clip", "Show editing clip preview"},
{SC_VIEW_GRAPH, "GRAPH", ICON_GRAPH, "Graph", "Show graph view for active element"},
{SC_VIEW_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dopesheet", "Dopesheet view for tracking data"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem gpencil_source_items[] = {
{SC_GPENCIL_SRC_CLIP, "CLIP", 0, "Clip", "Show annotation data-block which belongs to movie clip"},
{SC_GPENCIL_SRC_TRACK, "TRACK", 0, "Track", "Show annotation data-block which belongs to active track"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem pivot_items[] = {
{V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_PIVOT_BOUNDBOX, "Bounding Box Center",
"Pivot around bounding box center of selected object(s)"},
{V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", "Pivot around the 2D cursor"},
- {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_CENTER_ONLY,
+ {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL,
"Individual Origins", "Pivot around each object's own origin"},
{V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", ICON_PIVOT_MEDIAN, "Median Point",
"Pivot around the median point of selected objects"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "SpaceClipEditor", "Space");
@@ -5095,7 +5117,7 @@ static void rna_def_space_clip(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_METADATA);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_METADATA);
RNA_def_property_ui_text(prop, "Show Metadata", "Show metadata of clip");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
diff --git a/source/blender/makesrna/intern/rna_space_api.c b/source/blender/makesrna/intern/rna_space_api.c
index f1206b7130f..947eff8c73b 100644
--- a/source/blender/makesrna/intern/rna_space_api.c
+++ b/source/blender/makesrna/intern/rna_space_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_space_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include "RNA_access.h"
diff --git a/source/blender/makesrna/intern/rna_speaker.c b/source/blender/makesrna/intern/rna_speaker.c
index 41f22929143..b589421f6dc 100644
--- a/source/blender/makesrna/intern/rna_speaker.c
+++ b/source/blender/makesrna/intern/rna_speaker.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Jörg Müller.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_speaker.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -64,12 +58,6 @@ static void rna_def_speaker(BlenderRNA *brna)
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
- prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SPK_RELATIVE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Relative", "Whether the source is relative to the camera or not");
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Sound");
RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -78,14 +66,14 @@ static void rna_def_speaker(BlenderRNA *brna)
/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_sound_set", NULL); */
/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
- prop = RNA_def_property(srna, "volume_max", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "volume_max", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Maximum Volume", "Maximum volume, no matter how near the object is");
/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_max_set", NULL); */
/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
- prop = RNA_def_property(srna, "volume_min", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "volume_min", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Minimum Volume", "Minimum volume, no matter how far away the object is");
@@ -131,14 +119,14 @@ static void rna_def_speaker(BlenderRNA *brna)
/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_inner_set", NULL); */
/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
- prop = RNA_def_property(srna, "cone_volume_outer", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "cone_volume_outer", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Outer Cone Volume", "Volume outside the outer cone");
/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_volume_outer_set", NULL); */
/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
- prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Volume", "How loud the sound is");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c
index f6d38c309f3..e850cf9aec9 100644
--- a/source/blender/makesrna/intern/rna_test.c
+++ b/source/blender/makesrna/intern/rna_test.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Arystanbek Dyussenov
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_test.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index 191c3355176..527687e6c78 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_text.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c
index d7a862fecbc..3ea10ea6c69 100644
--- a/source/blender/makesrna/intern/rna_text_api.c
+++ b/source/blender/makesrna/intern/rna_text_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/makesrna/intern/rna_text_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 6a305ce23bb..ca1859895f5 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_texture.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <float.h>
@@ -29,7 +23,7 @@
#include <stdlib.h>
#include "DNA_brush_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_texture_types.h"
@@ -57,7 +51,7 @@ static const EnumPropertyItem texture_filter_items[] = {
{TXF_EWA, "EWA", 0, "EWA", ""},
{TXF_FELINE, "FELINE", 0, "FELINE", ""},
{TXF_AREA, "AREA", 0, "Area", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -76,7 +70,7 @@ const EnumPropertyItem rna_enum_texture_type_items[] = {
{TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - create a fractal noise texture"},
{TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - create cell-like patterns based on Worley noise"},
{TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", "Procedural - wave generated bands or rings, with optional noise"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
@@ -102,7 +96,7 @@ static const EnumPropertyItem blend_type_items[] = {
{MTEX_BLEND_SAT, "SATURATION", 0, "Saturation", ""},
{MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""},
{MTEX_BLEND_VAL, "VALUE", 0, "Value", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -417,7 +411,7 @@ static void rna_def_texmapping(BlenderRNA *brna)
{MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
{MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
{MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_vect_type_items[] = {
@@ -425,7 +419,7 @@ static void rna_def_texmapping(BlenderRNA *brna)
{TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
{TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
{TEXMAP_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_xyz_mapping_items[] = {
@@ -433,7 +427,7 @@ static void rna_def_texmapping(BlenderRNA *brna)
{1, "X", 0, "X", ""},
{2, "Y", 0, "Y", ""},
{3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
StructRNA *srna;
@@ -567,7 +561,7 @@ static void rna_def_mtex(BlenderRNA *brna)
static const EnumPropertyItem output_node_items[] = {
{0, "DUMMY", 0, "Dummy", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "TextureSlot", NULL);
@@ -621,24 +615,6 @@ static void rna_def_mtex(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Blend Type", "Mode used to apply the texture");
RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
- prop = RNA_def_property(srna, "use_stencil", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_STENCIL);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Stencil", "Use this texture as a blending value on the next texture");
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_NEGATIVE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Negate", "Invert the values of the texture to reverse its effect");
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "use_rgb_to_intensity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_RGBTOINT);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "RGB to Intensity", "Convert texture RGB values to intensity (gray) values");
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "def_var");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
@@ -726,13 +702,13 @@ static const EnumPropertyItem prop_noise_basis_items[] = {
"Noise algorithm - Voronoi Crackle: Voronoi tessellation with sharp edges"},
{TEX_CELLNOISE, "CELL_NOISE", 0, "Cell Noise",
"Noise algorithm - Cell Noise: Square cell tessellation"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_noise_type[] = {
{TEX_NOISESOFT, "SOFT_NOISE", 0, "Soft", "Generate soft noise (smooth transitions)"},
{TEX_NOISEPERL, "HARD_NOISE", 0, "Hard", "Generate hard noise (sharp transitions)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -744,7 +720,7 @@ static void rna_def_texture_clouds(BlenderRNA *brna)
static const EnumPropertyItem prop_clouds_stype[] = {
{TEX_DEFAULT, "GRAYSCALE", 0, "Grayscale", ""},
{TEX_COLOR, "COLOR", 0, "Color", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "CloudsTexture", "Texture");
@@ -800,14 +776,14 @@ static void rna_def_texture_wood(BlenderRNA *brna)
{TEX_RING, "RINGS", 0, "Rings", "Use wood texture in rings"},
{TEX_BANDNOISE, "BANDNOISE", 0, "Band Noise", "Add noise to standard wood"},
{TEX_RINGNOISE, "RINGNOISE", 0, "Ring Noise", "Add noise to rings"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_wood_noisebasis2[] = {
{TEX_SIN, "SIN", 0, "Sine", "Use a sine wave to produce bands"},
{TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"},
{TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "WoodTexture", "Texture");
@@ -869,14 +845,14 @@ static void rna_def_texture_marble(BlenderRNA *brna)
{TEX_SOFT, "SOFT", 0, "Soft", "Use soft marble"},
{TEX_SHARP, "SHARP", 0, "Sharp", "Use more clearly defined marble"},
{TEX_SHARPER, "SHARPER", 0, "Sharper", "Use very clearly defined marble"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_marble_noisebasis2[] = {
{TEX_SIN, "SIN", 0, "Sin", "Use a sine wave to produce bands"},
{TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"},
{TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MarbleTexture", "Texture");
@@ -974,13 +950,13 @@ static void rna_def_texture_blend(BlenderRNA *brna)
{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}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_flip_axis_items[] = {
{0, "HORIZONTAL", 0, "Horizontal", "No flipping"},
{TEX_FLIPBLEND, "VERTICAL", 0, "Vertical", "Flip the texture's X and Y axis"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "BlendTexture", "Texture");
@@ -1010,7 +986,7 @@ static void rna_def_texture_stucci(BlenderRNA *brna)
{TEX_PLASTIC, "PLASTIC", 0, "Plastic", "Use standard stucci"},
{TEX_WALLIN, "WALL_IN", 0, "Wall in", "Create Dimples"},
{TEX_WALLOUT, "WALL_OUT", 0, "Wall out", "Create Ridges"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "StucciTexture", "Texture");
@@ -1071,7 +1047,7 @@ static void rna_def_texture_image(BlenderRNA *brna)
"Clip to cubic-shaped area around the image and set exterior pixels as transparent"},
{TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"},
{TEX_CHECKER, "CHECKER", 0, "Checker", "Cause the image to repeat in checker board pattern"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ImageTexture", "Texture");
@@ -1226,7 +1202,7 @@ static void rna_def_texture_musgrave(BlenderRNA *brna)
"Use Perlin noise as a basis, with extended controls"},
{TEX_FBM, "FBM", 0, "fBM", "Fractal Brownian Motion, use Brownian noise as a basis"},
{TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", "Similar to multifractal"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MusgraveTexture", "Texture");
@@ -1314,7 +1290,7 @@ static void rna_def_texture_voronoi(BlenderRNA *brna)
{TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkowski",
"Use the Minkowski function to calculate distance "
"(exponent value determines the shape of the boundaries)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_coloring_items[] = {
@@ -1324,7 +1300,7 @@ static void rna_def_texture_voronoi(BlenderRNA *brna)
{TEX_COL2, "POSITION_OUTLINE", 0, "Position and Outline", "Use position plus an outline based on F2-F1"},
{TEX_COL3, "POSITION_OUTLINE_INTENSITY", 0, "Position, Outline, and Intensity",
"Multiply position and outline by intensity"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "VoronoiTexture", "Texture");
diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c
index 1d513a494d7..b3bd55e3ee3 100644
--- a/source/blender/makesrna/intern/rna_texture_api.c
+++ b/source/blender/makesrna/intern/rna_texture_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Tom Edwards
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_texture_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -29,7 +23,6 @@
#include <string.h>
#include "BLI_utildefines.h"
-#include "BLI_path_util.h"
#include "RNA_define.h"
diff --git a/source/blender/makesrna/intern/rna_timeline.c b/source/blender/makesrna/intern/rna_timeline.c
index 45f90d13477..d3dea9a769d 100644
--- a/source/blender/makesrna/intern/rna_timeline.c
+++ b/source/blender/makesrna/intern/rna_timeline.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Roland Hess
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_timeline.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index ed41d209f6a..8df1d3115cc 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_tracking.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -31,7 +24,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_math.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
@@ -48,6 +40,8 @@
#ifdef RNA_RUNTIME
+#include "BLI_math.h"
+
#include "DNA_anim_types.h"
#include "BKE_animsys.h"
@@ -800,13 +794,13 @@ static const EnumPropertyItem tracker_motion_model[] = {
"Search for markers that are translated and rotated between frames"},
{TRACK_MOTION_MODEL_TRANSLATION, "Loc", 0, "Loc",
"Search for markers that are translated between frames"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem pattern_match_items[] = {
{TRACK_MATCH_KEYFRAME, "KEYFRAME", 0, "Keyframe", "Track pattern from keyframe to next frame"},
{TRACK_MATCH_PREVFRAME, "PREV_FRAME", 0, "Previous frame", "Track pattern from current frame to next frame"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_trackingSettings(BlenderRNA *brna)
@@ -820,14 +814,14 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
{TRACKING_SPEED_REALTIME, "REALTIME", 0, "Realtime", "Track with realtime speed"},
{TRACKING_SPEED_HALF, "HALF", 0, "Half", "Track with half of realtime speed"},
{TRACKING_SPEED_QUARTER, "QUARTER", 0, "Quarter", "Track with quarter of realtime speed"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem cleanup_items[] = {
{TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"},
{TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"},
{TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem refine_items[] = {
@@ -851,7 +845,7 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
{REFINE_RADIAL_DISTORTION_K1 |
REFINE_RADIAL_DISTORTION_K2, "RADIAL_K1_K2", 0, "K1, K2",
"Refine radial distortion K1 and K2"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MovieTrackingSettings", NULL);
@@ -1050,13 +1044,13 @@ static void rna_def_trackingCamera(BlenderRNA *brna)
{TRACKING_DISTORTION_MODEL_POLYNOMIAL, "POLYNOMIAL", 0, "Polynomial", "Radial distortion model which fits common cameras"},
{TRACKING_DISTORTION_MODEL_DIVISION, "DIVISION", 0, "Divisions", "Division distortion model which "
"better represents wide-angle cameras"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem camera_units_items[] = {
{CAMERA_UNITS_PX, "PIXELS", 0, "px", "Use pixels for units of focal length"},
{CAMERA_UNITS_MM, "MILLIMETERS", 0, "mm", "Use millimeters for units of focal length"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MovieTrackingCamera", NULL);
@@ -1640,7 +1634,7 @@ static void rna_def_trackingStabilization(BlenderRNA *brna)
{TRACKING_FILTER_NEAREST, "NEAREST", 0, "Nearest", "No interpolation, use nearest neighbor pixel"},
{TRACKING_FILTER_BILINEAR, "BILINEAR", 0, "Bilinear", "Simple interpolation between adjacent pixels"},
{TRACKING_FILTER_BICUBIC, "BICUBIC", 0, "Bicubic", "High quality pixel interpolation"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MovieTrackingStabilization", NULL);
@@ -2093,7 +2087,7 @@ static void rna_def_trackingDopesheet(BlenderRNA *brna)
{TRACKING_DOPE_SORT_TOTAL, "TOTAL", 0, "Total", "Sort channels by overall amount of tracked segments"},
{TRACKING_DOPE_SORT_AVERAGE_ERROR, "AVERAGE_ERROR", 0, "Average Error",
"Sort channels by average reprojection error of tracks after solve"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "MovieTrackingDopesheet", NULL);
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index f51aad43f69..5bc647493cc 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2009)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_ui.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -58,14 +52,14 @@ const EnumPropertyItem rna_enum_operator_context_items[] = {
{WM_OP_EXEC_REGION_PREVIEW, "EXEC_REGION_PREVIEW", 0, "Exec Region Preview", ""},
{WM_OP_EXEC_AREA, "EXEC_AREA", 0, "Exec Area", ""},
{WM_OP_EXEC_SCREEN, "EXEC_SCREEN", 0, "Exec Screen", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_uilist_layout_type_items[] = {
{UILST_LAYOUT_DEFAULT, "DEFAULT", 0, "Default Layout", "Use the default, multi-rows layout"},
{UILST_LAYOUT_COMPACT, "COMPACT", 0, "Compact Layout", "Use the compact, single-row layout"},
{UILST_LAYOUT_GRID, "GRID", 0, "Grid Layout", "Use the grid-based layout"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -394,7 +388,7 @@ static void uilist_draw_item(uiList *ui_list, bContext *C, uiLayout *layout, Poi
RNA_parameter_list_free(&list);
}
-static void uilist_draw_filter(uiList *ui_list, bContext *C, uiLayout *layout, bool reverse)
+static void uilist_draw_filter(uiList *ui_list, bContext *C, uiLayout *layout)
{
extern FunctionRNA rna_UIList_draw_filter_func;
@@ -408,7 +402,6 @@ static void uilist_draw_filter(uiList *ui_list, bContext *C, uiLayout *layout, b
RNA_parameter_list_create(&list, &ul_ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
RNA_parameter_set_lookup(&list, "layout", &layout);
- RNA_parameter_set_lookup(&list, "reverse", &reverse);
ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list);
RNA_parameter_list_free(&list);
@@ -1037,21 +1030,21 @@ static void rna_def_ui_layout(BlenderRNA *brna)
{UI_LAYOUT_ALIGN_LEFT, "LEFT", 0, "Left", ""},
{UI_LAYOUT_ALIGN_CENTER, "CENTER", 0, "Center", ""},
{UI_LAYOUT_ALIGN_RIGHT, "RIGHT", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem direction_items[] = {
{UI_LAYOUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
{UI_LAYOUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem emboss_items[] = {
- {UI_EMBOSS, "NORMAL", 0, "Normal", "Draw standard button emboss style"},
+ {UI_EMBOSS, "NORMAL", 0, "Regular", "Draw standard button emboss style"},
{UI_EMBOSS_NONE, "NONE", 0, "None", "Draw only text and icons"},
{UI_EMBOSS_PULLDOWN, "PULLDOWN_MENU", 0, "Pulldown Menu", "Draw pulldown menu style"},
{UI_EMBOSS_RADIAL, "RADIAL_MENU", 0, "Radial Menu", "Draw radial menu style"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* layout */
@@ -1129,7 +1122,7 @@ static void rna_def_panel(BlenderRNA *brna)
{PNL_NO_HEADER, "HIDE_HEADER", 0, "Hide Header",
"If set to False, the panel shows a header, which contains a clickable "
"arrow to collapse the panel and the label (see bl_label)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Panel", NULL);
@@ -1297,6 +1290,12 @@ static void rna_def_uilist(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_EXCLUDE);
RNA_def_property_ui_text(prop, "Invert", "Invert filtering (show hidden items, and vice-versa)");
+ /* WARNING: This is sort of an abuse, sort-by-alpha is actually a value, should even be an enum in full logic
+ * (of two values, sort by index and sort by name).
+ * But for default UIList, it's nicer (better UI-wise) to show this as a boolean bit-flag option,
+ * avoids having to define custom setters/getters using UILST_FLT_SORT_MASK to mask out
+ * actual bitflags on same var, etc.
+ */
prop = RNA_def_property(srna, "use_filter_sort_alpha", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_ALPHA);
RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
@@ -1304,7 +1303,11 @@ static void rna_def_uilist(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_filter_sort_reverse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_REVERSE);
- RNA_def_property_ui_text(prop, "Invert", "Invert the order of shown items");
+ RNA_def_property_ui_text(prop, "Reverse", "Reverse the order of shown items");
+
+ prop = RNA_def_property(srna, "use_filter_sort_lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_LOCK);
+ RNA_def_property_ui_text(prop, "Lock Order", "Lock the order of shown items (user cannot change it)");
/* draw_item */
func = RNA_def_function(srna, "draw_item", NULL);
@@ -1341,7 +1344,6 @@ static void rna_def_uilist(BlenderRNA *brna)
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_boolean(func, "reverse", false, "", "Display items in reverse order");
/* filter */
func = RNA_def_function(srna, "filter_items", NULL);
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 0db0408d09f..973f92c6575 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_ui_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -53,7 +46,7 @@
#define DEF_ICON_BLANK(name)
const EnumPropertyItem rna_enum_icon_items[] = {
#include "UI_icons.h"
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
@@ -508,13 +501,13 @@ void RNA_api_ui_layout(StructRNA *srna)
{'v', "VECTOR", 0, "Vector", ""},
{'c', "COLOR", 0, "Color", ""},
{'h', "HUE", 0, "Hue", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem id_template_filter_items[] = {
{UI_TEMPLATE_ID_FILTER_ALL, "ALL", 0, "All", ""},
{UI_TEMPLATE_ID_FILTER_AVAILABLE, "AVAILABLE", 0, "Available", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static float node_socket_color_default[] = { 0.0f, 0.0f, 0.0f, 1.0f };
@@ -1064,17 +1057,14 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Default maximum number of rows to display", 0, INT_MAX);
RNA_def_enum(func, "type", rna_enum_uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use");
RNA_def_int(func, "columns", 9, 0, INT_MAX, "", "Number of items to display per row, for GRID layout", 0, INT_MAX);
- RNA_def_boolean(func, "reverse", false, "", "Display items in reverse order");
+ RNA_def_boolean(func, "sort_reverse", false, "", "Display items in reverse order by default");
+ RNA_def_boolean(func, "sort_lock", false, "", "Lock display order to default value");
func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch");
- func = RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Inserts common 3DView header UI (selectors for context mode, shading, etc.)");
-
func = RNA_def_function(srna, "template_header_3D_mode", "uiTemplateHeader3D_mode");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 7c7a484dd49..dda36d89eb1 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_userdef.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <limits.h>
@@ -36,7 +30,8 @@
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
-#include "BLI_math_vector.h"
+
+#include "BLT_translation.h"
#include "BKE_appdir.h"
#include "BKE_sound.h"
@@ -63,19 +58,19 @@ static const EnumPropertyItem opensubdiv_compute_type_items[] = {
{USER_OPENSUBDIV_COMPUTE_CUDA, "CUDA", 0, "CUDA", ""},
{USER_OPENSUBDIV_COMPUTE_GLSL_TRANSFORM_FEEDBACK, "GLSL_TRANSFORM_FEEDBACK", 0, "GLSL Transform Feedback", ""},
{USER_OPENSUBDIV_COMPUTE_GLSL_COMPUTE, "GLSL_COMPUTE", 0, "GLSL Compute", ""},
- { 0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
static const EnumPropertyItem audio_device_items[] = {
{0, "Null", 0, "None", "Null device - there will be no audio output"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_navigation_mode_items[] = {
{VIEW_NAVIGATION_WALK, "WALK", 0, "Walk", "Interactively walk or free navigate around the scene"},
{VIEW_NAVIGATION_FLY, "FLY", 0, "Fly", "Use fly dynamics to navigate the scene"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -83,7 +78,7 @@ const EnumPropertyItem rna_enum_navigation_mode_items[] = {
static const EnumPropertyItem rna_enum_language_default_items[] = {
{0, "DEFAULT", 0, "Automatic (Automatic)",
"Automatically choose system's defined language if available, or fall-back to English"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -91,12 +86,14 @@ static const EnumPropertyItem rna_enum_studio_light_type_items[] = {
{STUDIOLIGHT_TYPE_STUDIO, "STUDIO", 0, "Studio", ""},
{STUDIOLIGHT_TYPE_WORLD, "WORLD", 0, "World", ""},
{STUDIOLIGHT_TYPE_MATCAP, "MATCAP", 0, "MatCap", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
+#include "BLI_math_vector.h"
+
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
@@ -107,6 +104,7 @@ static const EnumPropertyItem rna_enum_studio_light_type_items[] = {
#include "BKE_mesh_runtime.h"
#include "BKE_pbvh.h"
#include "BKE_paint.h"
+#include "BKE_screen.h"
#include "DEG_depsgraph.h"
@@ -142,6 +140,14 @@ static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe
WM_main_add_notifier(NC_WINDOW, NULL);
}
+static void rna_userdef_theme_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ /* Recreate gizmos when changing themes. */
+ WM_reinit_gizmomap_all(bmain);
+
+ rna_userdef_update(bmain, scene, ptr);
+}
+
/* also used by buffer swap switching */
static void rna_userdef_dpi_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
@@ -158,6 +164,16 @@ static void rna_userdef_update_ui(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
}
+static void rna_userdef_update_ui_header_default(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ if (U.uiflag & USER_HEADER_FROM_PREF) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ BKE_screen_header_alignment_reset(screen);
+ }
+ rna_userdef_update_ui(bmain, scene, ptr);
+ }
+}
+
static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
BLF_cache_clear();
@@ -168,8 +184,8 @@ static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene
static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
UserDef *userdef = (UserDef *)ptr->data;
- if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE) G.f &= ~G_SCRIPT_AUTOEXEC;
- else G.f |= G_SCRIPT_AUTOEXEC;
+ if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE) G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
+ else G.f |= G_FLAG_SCRIPT_AUTOEXEC;
}
static void rna_userdef_load_ui_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
@@ -185,24 +201,12 @@ static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA
rna_userdef_update(bmain, scene, ptr);
}
-static void rna_userdef_gl_gpu_mipmaps(Main *bmain, Scene *scene, PointerRNA *ptr)
-{
- GPU_set_gpu_mipmapping(bmain, U.use_gpu_mipmap);
- rna_userdef_update(bmain, scene, ptr);
-}
-
static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
GPU_free_images(bmain);
rna_userdef_update(bmain, scene, ptr);
}
-static void rna_userdef_gl_use_16bit_textures(Main *bmain, Scene *scene, PointerRNA *ptr)
-{
- GPU_free_images(bmain);
- rna_userdef_update(bmain, scene, ptr);
-}
-
static void rna_userdef_undo_steps_set(PointerRNA *ptr, int value)
{
UserDef *userdef = (UserDef *)ptr->data;
@@ -236,6 +240,11 @@ static void rna_userdef_autokeymode_set(PointerRNA *ptr, int value)
}
}
+static void rna_userdef_tablet_api_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+{
+ WM_init_tablet_api();
+}
+
#ifdef WITH_INPUT_NDOF
static void rna_userdef_ndof_deadzone_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
@@ -327,7 +336,7 @@ static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRN
{
Object *ob;
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->mode & OB_MODE_WEIGHT_PAINT)
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
@@ -418,6 +427,11 @@ static PointerRNA rna_Theme_space_generic_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGeneric, ptr->data);
}
+static PointerRNA rna_Theme_gradient_colors_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_ThemeGradientColors, ptr->data);
+}
+
static PointerRNA rna_Theme_space_gradient_get(PointerRNA *ptr)
{
return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGradient, ptr->data);
@@ -464,7 +478,7 @@ static void rna_userdef_opensubdiv_update(Main *bmain, Scene *UNUSED(scene), Poi
{
Object *object;
- for (object = bmain->object.first;
+ for (object = bmain->objects.first;
object;
object = object->id.next)
{
@@ -809,7 +823,7 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
static const EnumPropertyItem font_kerning_style[] = {
{0, "UNFITTED", 0, "Unfitted", "Use scaled but un-grid-fitted kerning distances"},
{1, "FITTED", 0, "Fitted", "Use scaled and grid-fitted kerning distances"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "ThemeFontStyle", NULL);
@@ -820,42 +834,42 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
prop = RNA_def_property(srna, "points", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 6, 48);
RNA_def_property_ui_text(prop, "Points", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "font_kerning_style", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "kerning");
RNA_def_property_enum_items(prop, font_kerning_style);
RNA_def_property_ui_text(prop, "Kerning Style", "Which style to use for font kerning");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "shadow", PROP_INT, PROP_PIXEL);
RNA_def_property_range(prop, 0, 5);
RNA_def_property_ui_text(prop, "Shadow Size", "Shadow size (0, 3 and 5 supported)");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "shadow_offset_x", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "shadx");
RNA_def_property_range(prop, -10, 10);
RNA_def_property_ui_text(prop, "Shadow X Offset", "Shadow offset in pixels");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "shadow_offset_y", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "shady");
RNA_def_property_range(prop, -10, 10);
RNA_def_property_ui_text(prop, "Shadow Y Offset", "Shadow offset in pixels");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "shadow_alpha", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "shadow_alpha", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "shadowalpha");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Shadow Alpha", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "shadow_value", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "shadow_value", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "shadowcolor");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Shadow Brightness", "Shadow color in gray value");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
@@ -876,21 +890,21 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "paneltitle");
RNA_def_property_struct_type(prop, "ThemeFontStyle");
RNA_def_property_ui_text(prop, "Panel Title Font", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_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");
RNA_def_property_struct_type(prop, "ThemeFontStyle");
RNA_def_property_ui_text(prop, "Widget Label Style", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "widget", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "widget");
RNA_def_property_struct_type(prop, "ThemeFontStyle");
RNA_def_property_ui_text(prop, "Widget Style", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
@@ -907,52 +921,52 @@ static void rna_def_userdef_theme_ui_wcol(BlenderRNA *brna)
prop = RNA_def_property(srna, "outline", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Outline", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Inner", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Inner Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "item", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Item", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "text_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Text Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "show_shaded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "shaded", 1);
RNA_def_property_ui_text(prop, "Shaded", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "shadetop", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, -100, 100);
RNA_def_property_ui_text(prop, "Shade Top", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "shadedown", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, -100, 100);
RNA_def_property_ui_text(prop, "Shade Down", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "roundness", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_funcs(prop, "rna_ThemeUI_roundness_get", "rna_ThemeUI_roundness_set", NULL);
RNA_def_property_ui_text(prop, "Roundness", "Amount of edge rounding");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna)
@@ -968,56 +982,56 @@ static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna)
prop = RNA_def_property(srna, "inner_anim", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Animated", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner_anim_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Animated Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner_key", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Keyframe", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner_key_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Keyframe Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner_driven", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Driven", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner_driven_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Driven Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner_overridden", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Overridden", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner_overridden_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Overridden Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner_changed", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Changed", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "inner_changed_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Changed Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "blend", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Blend", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna)
@@ -1032,41 +1046,45 @@ static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna)
prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_ui_text(prop, "Header", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_ui_text(prop, "Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "sub_back", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_ui_text(prop, "Sub Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui_gradient(BlenderRNA *brna)
{
+ /* Fake struct, keep this for compatible theme presets. */
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ThemeGradientColors", NULL);
- RNA_def_struct_sdna(srna, "uiGradientColors");
+ RNA_def_struct_sdna(srna, "ThemeSpace");
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
RNA_def_struct_ui_text(srna, "Theme Background Color", "Theme settings for background colors and gradient");
prop = RNA_def_property(srna, "show_grad", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "show_back_grad", 1);
RNA_def_property_ui_text(prop, "Use Gradient",
"Do a gradient for the background of the viewport working area");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "gradient", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Gradient Low", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "high_gradient", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "back");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Gradient High/Off", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "gradient", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "back_grad");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Gradient Low", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui(BlenderRNA *brna)
@@ -1087,223 +1105,218 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
prop = RNA_def_property(srna, "wcol_regular", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Regular Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_tool", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Tool Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_toolbar_item", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Toolbar Item Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Radio Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_text", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Text Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_option", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Option Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Toggle Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Number Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_numslider", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Slider Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Box Backdrop Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Menu Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_pulldown", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Pulldown Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_menu_back", PROP_POINTER, PROP_NONE);
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");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_pie_menu", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Pie Menu Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_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");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Menu Item Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Scroll Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_progress", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Progress Bar Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "List Item Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "State Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wcol_tab", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Tab Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "menu_shadow_fac", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Menu Shadow Strength", "Blending factor for menu shadows");
RNA_def_property_range(prop, 0.01f, 1.0f);
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "menu_shadow_width", PROP_INT, PROP_PIXEL);
RNA_def_property_ui_text(prop, "Menu Shadow Width", "Width of menu shadows, set to zero to disable");
RNA_def_property_range(prop, 0.0f, 24.0f);
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "icon_file", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "iconfile");
- RNA_def_property_ui_text(prop, "Icon File", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "icon_alpha", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Icon Alpha", "Transparency of icons in the interface, to reduce contrast");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "icon_saturation", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Icon Saturation", "Saturation of icons in the interface");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "widget_emboss", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "widget_emboss");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Widget Emboss", "Color of the 1px shadow line underlying widgets");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "editor_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "editor_outline");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Editor Outline", "Color of the outline of the editors and their round corners");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* axis */
prop = RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "xaxis");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "X Axis", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "yaxis");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Y Axis", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "zaxis");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Z Axis", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* Generic gizmo colors. */
prop = RNA_def_property(srna, "gizmo_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "gizmo_hi");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Gizmo Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "gizmo_primary", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "gizmo_primary");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Gizmo Primary", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "gizmo_secondary", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "gizmo_secondary");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Gizmo Secondary", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "gizmo_a", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "gizmo_a");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Gizmo A", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "gizmo_b", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "gizmo_b");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Gizmo B", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* Icon colors. */
prop = RNA_def_property(srna, "icon_collection", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "icon_collection");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Collection", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "icon_object", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "icon_object");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Object", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "icon_object_data", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "icon_object_data");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Object Data", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "icon_modifier", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "icon_modifier");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Modifier", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "icon_shading", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "icon_shading");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Shading", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_common(StructRNA *srna)
@@ -1313,92 +1326,92 @@ static void rna_def_userdef_theme_space_common(StructRNA *srna)
prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Title", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Text Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* header */
prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Header", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "header_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Header Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "header_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Header Text Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* panel settings */
prop = RNA_def_property(srna, "panelcolors", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Panel Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* buttons */
-/* if (! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) { */
+/* if (! ELEM(spacetype, SPACE_PROPERTIES, SPACE_OUTLINER)) { */
prop = RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Region Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "button_title", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Region Text Titles", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "button_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Region Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "button_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Region Text Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "navigation_bar", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Navigation Bar Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "execution_buts", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Execution Region Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* tabs */
prop = RNA_def_property(srna, "tab_active", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Tab Active", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "tab_inactive", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Tab Inactive", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "tab_back", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Tab Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "tab_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Tab Outline", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* } */
}
@@ -1415,8 +1428,10 @@ static void rna_def_userdef_theme_space_gradient(BlenderRNA *brna)
/* gradient/background settings */
prop = RNA_def_property(srna, "gradients", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "ThemeGradientColors");
+ RNA_def_property_pointer_funcs(prop, "rna_Theme_gradient_colors_get", NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Gradient Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
rna_def_userdef_theme_space_common(srna);
}
@@ -1433,7 +1448,7 @@ static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)
prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Window Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
rna_def_userdef_theme_space_common(srna);
}
@@ -1451,22 +1466,22 @@ static void rna_def_userdef_theme_space_list_generic(BlenderRNA *brna)
prop = RNA_def_property(srna, "list", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Source List", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "list_title", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Source List Title", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "list_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Source List Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "list_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Source List Text Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_spaces_main(StructRNA *srna)
@@ -1509,27 +1524,27 @@ static void rna_def_userdef_theme_spaces_vertex(StructRNA *srna)
prop = RNA_def_property(srna, "vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Vertex", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Vertex Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "vertex_size", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, 32);
RNA_def_property_ui_text(prop, "Vertex Size", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "vertex_bevel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Vertex Bevel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "vertex_unreferenced", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Vertex Group Unreferenced", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_spaces_edge(StructRNA *srna)
@@ -1539,37 +1554,37 @@ static void rna_def_userdef_theme_spaces_edge(StructRNA *srna)
prop = RNA_def_property(srna, "edge_select", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Edge Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "edge_seam", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Edge Seam", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "edge_sharp", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Edge Sharp", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "edge_crease", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Edge Crease", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "edge_bevel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Edge Bevel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "edge_facesel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Edge UV Face Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "freestyle_edge_mark", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Freestyle Edge Mark", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_spaces_face(StructRNA *srna)
@@ -1579,27 +1594,27 @@ static void rna_def_userdef_theme_spaces_face(StructRNA *srna)
prop = RNA_def_property(srna, "face", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Face", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "face_select", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Face Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "face_dot", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Face Dot Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "facedot_size", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, 10);
RNA_def_property_ui_text(prop, "Face Dot Size", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "freestyle_face_mark", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Freestyle Face Mark", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_spaces_paint_curves(StructRNA *srna)
@@ -1609,12 +1624,12 @@ static void rna_def_userdef_theme_spaces_paint_curves(StructRNA *srna)
prop = RNA_def_property(srna, "paint_curve_handle", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Paint Curve Handle", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "paint_curve_pivot", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Paint Curve Pivot", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, bool incl_nurbs, bool incl_lastsel,
@@ -1627,82 +1642,82 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, bool incl_nurbs
RNA_def_property_float_sdna(prop, NULL, "nurb_uline");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "NURBS U-lines", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "nurb_vline", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nurb_vline");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "NURBS V-lines", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "nurb_sel_uline", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nurb_sel_uline");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "NURBS active U-lines", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "nurb_sel_vline", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nurb_sel_vline");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "NURBS active V-lines", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "act_spline", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "act_spline");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Active spline", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
prop = RNA_def_property(srna, "handle_free", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "handle_free");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Free handle color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "handle_auto", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "handle_auto");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Auto handle color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
if (incl_vector) {
prop = RNA_def_property(srna, "handle_vect", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "handle_vect");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Vector handle color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "handle_sel_vect", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "handle_sel_vect");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Vector handle selected color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
prop = RNA_def_property(srna, "handle_align", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "handle_align");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Align handle color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "handle_sel_free", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "handle_sel_free");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Free handle selected color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "handle_sel_auto", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Auto handle selected color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "handle_sel_align", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "handle_sel_align");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Align handle selected color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
if (!incl_nurbs) {
/* assume that when nurbs are off, this is for 2D (i.e. anim) editors */
@@ -1710,13 +1725,13 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, bool incl_nurbs
RNA_def_property_float_sdna(prop, NULL, "handle_auto_clamped");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Auto-Clamped handle color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "handle_sel_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto_clamped");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Auto-Clamped handle selected color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
if (incl_lastsel) {
@@ -1724,24 +1739,24 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, bool incl_nurbs
RNA_def_property_float_sdna(prop, NULL, "lastsel_point");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Last selected point", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
if (incl_verthandle) {
prop = RNA_def_property(srna, "handle_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Handle Vertex", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "handle_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Handle Vertex Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "handle_vertex_size", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_text(prop, "Handle Vertex Size", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
}
@@ -1752,17 +1767,17 @@ static void rna_def_userdef_theme_spaces_gpencil(StructRNA *srna)
prop = RNA_def_property(srna, "gp_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Grease Pencil Vertex", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "gp_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Grease Pencil Vertex Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "gp_vertex_size", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, 10);
RNA_def_property_ui_text(prop, "Grease Pencil Vertex Size", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
@@ -1784,22 +1799,22 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "clipping_border_3d", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Clipping Border", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wire", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Wire", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wire_edit", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Wire Edit", "Color for wireframe when in edit mode, but edge selection is active");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* Grease Pencil */
@@ -1810,7 +1825,7 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "time_gp_keyframe");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Grease Pencil Keyframe", "Color for indicating Grease Pencil keyframes");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* Object specific options */
@@ -1818,42 +1833,43 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Object Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "object_active", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "active");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Active Object", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "text_keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "time_keyframe");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Object Keyframe", "Color for indicating Object keyframes");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* Object type options */
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");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_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");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "light", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "lamp");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Light", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LIGHT);
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "speaker", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Speaker", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* Mesh Object specific */
@@ -1868,37 +1884,37 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "extra_edge_len", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Edge Length Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "extra_edge_angle", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Edge Angle Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "extra_face_angle", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Face Angle Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "extra_face_area", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Face Area Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Face Normal", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "vertex_normal", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Vertex Normal", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "split_normal", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "loop_normal");
@@ -1911,17 +1927,17 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "bone_pose", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Bone Pose", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "bone_pose_active", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Bone Pose Active", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "bone_solid", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Bone Solid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* misc */
@@ -1929,41 +1945,41 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "bundle_solid");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Bundle Solid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "camera_path", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "camera_path");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Camera Path", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "skin_root", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Skin Root", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "view_overlay", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "View Overlay", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "transform", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Transform", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "cframe");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
rna_def_userdef_theme_spaces_paint_curves(srna);
prop = RNA_def_property(srna, "outline_width", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, 5);
RNA_def_property_ui_text(prop, "Outline Width", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
@@ -1985,55 +2001,55 @@ static void rna_def_userdef_theme_space_graph(BlenderRNA *brna)
prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "cframe");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade1");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Window Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "channels_region", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade2");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Channels Region", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "ds_channel");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Dope Sheet Channel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "ds_subchannel");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Dope Sheet Sub-Channel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "group");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Channel Group", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "group_active");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Active Channel Group", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
rna_def_userdef_theme_spaces_vertex(srna);
rna_def_userdef_theme_spaces_curves(srna, false, true, true, true);
@@ -2057,7 +2073,7 @@ static void rna_def_userdef_theme_space_file(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "hilite");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Selected File", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_outliner(BlenderRNA *brna)
@@ -2077,12 +2093,12 @@ static void rna_def_userdef_theme_space_outliner(BlenderRNA *brna)
prop = RNA_def_property(srna, "match", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Filter Match", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "selected_highlight", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Selected Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_userpref(BlenderRNA *brna)
@@ -2117,37 +2133,37 @@ static void rna_def_userdef_theme_space_console(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "console_output");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Line Output", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "line_input", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "console_input");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Line Input", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "line_info", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "console_info");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Line Info", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "line_error", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "console_error");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Line Error", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "console_cursor");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Cursor", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "select", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "console_select");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Selection", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
@@ -2169,61 +2185,61 @@ static void rna_def_userdef_theme_space_info(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "info_selected");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Selected Line Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "info_selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "info_selected_text");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Selected Line Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "info_error", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "info_error");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Error Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "info_error_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "info_error_text");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Error Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "info_warning", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "info_warning");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Warning Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "info_warning_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "info_warning_text");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Warning Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "info_info", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "info_info");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Info Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "info_info_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "info_info_text");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Info Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "info_debug", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "info_debug");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Debug Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "info_debug_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "info_debug_text");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Debug Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
@@ -2245,7 +2261,7 @@ static void rna_def_userdef_theme_space_text(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "grid");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Line Numbers Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* no longer used */
#if 0
@@ -2253,68 +2269,68 @@ static void rna_def_userdef_theme_space_text(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "shade1");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Scroll Bar", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
#endif
prop = RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade2");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Selected Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "hilite");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Cursor", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "syntax_builtin", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxb");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Syntax Built-in", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "syntax_symbols", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxs");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Syntax Symbols", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "syntax_special", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxv");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Syntax Special", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "syntax_preprocessor", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxd");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Syntax PreProcessor", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "syntax_reserved", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxr");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Syntax Reserved", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "syntax_comment", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxc");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Syntax Comment", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "syntax_string", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxl");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Syntax String", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "syntax_numbers", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxn");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Syntax Numbers", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
@@ -2338,146 +2354,146 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Node Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "node_active", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "active");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Active Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wire", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "wire");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Wires", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wire_inner", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxr");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Wire Color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wire_select", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "edge_select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Wire Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade2");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Selected Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "node_backdrop", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxl");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Node Backdrop", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "converter_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxv");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Converter Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "color_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxb");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Color Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "group_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxc");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Group Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "group_socket_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "console_output");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Group Socket Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "frame_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "movie");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Frame Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "matte_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxs");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Matte Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "distor_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxd");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Distort Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "noodle_curving", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "noodle_curving");
RNA_def_property_int_default(prop, 5);
RNA_def_property_range(prop, 0, 10);
RNA_def_property_ui_text(prop, "Noodle curving", "Curving of the noodle");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "input_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "syntaxn");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Input Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "output_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nodeclass_output");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Output Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "filter_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nodeclass_filter");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Filter Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "vector_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nodeclass_vector");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Vector Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "texture_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nodeclass_texture");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Texture Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "shader_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nodeclass_shader");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Shader Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "script_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nodeclass_script");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Script Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "pattern_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nodeclass_pattern");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Pattern Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "layout_node", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nodeclass_layout");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Layout Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_buts(BlenderRNA *brna)
@@ -2517,89 +2533,89 @@ static void rna_def_userdef_theme_space_image(BlenderRNA *brna)
prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "wire_edit", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Wire Edit", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "edge_select", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Edge Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "scope_back", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "preview_back");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Scope region background color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "preview_stitch_face", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "preview_stitch_face");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Stitch preview face color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "preview_stitch_edge", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "preview_stitch_edge");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Stitch preview edge color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "preview_stitch_vert", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "preview_stitch_vert");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Stitch preview vertex color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "preview_stitch_stitchable", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "preview_stitch_stitchable");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Stitch preview stitchable color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "preview_stitch_unstitchable", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "preview_stitch_unstitchable");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Stitch preview unstitchable color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "preview_stitch_active", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "preview_stitch_active");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Stitch preview active island", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "uv_shadow", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "uv_shadow");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Texture paint/Modifier UVs", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "uv_others", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "uv_others");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Other Object UVs", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "cframe");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "metadatabg");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Metadata Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "metadatatext");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Metadata Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
rna_def_userdef_theme_spaces_curves(srna, false, false, false, true);
@@ -2624,102 +2640,102 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna)
prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade1");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Window Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "movie_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "movie");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Movie Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_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");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_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);
RNA_def_property_ui_text(prop, "Image Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "scene_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "scene");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Scene Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "audio_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "audio");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Audio Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "effect_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "effect");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Effect Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "transition_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "transition");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Transition Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "meta_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "meta");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Meta Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "text_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Text Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "cframe");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "vertex_select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Keyframe", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "draw_action", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "bone_pose");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Draw Action", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_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");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "metadatabg");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Metadata Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "metadatatext");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Metadata Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
@@ -2740,76 +2756,76 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "cframe");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "value_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "face");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Value Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "view_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade1");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "View Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "ds_channel");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Dope Sheet Channel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "ds_subchannel");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Dope Sheet Sub-Channel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "channels", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade2");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Channels", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "channels_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "hilite");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Channels Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "group");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Channel Group", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "group_active");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Active Channel Group", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "long_key", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Long Key", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "long_key_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip_select");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Long Key Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
@@ -2817,98 +2833,98 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "keytype_keyframe");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Keyframe", "Color of Keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keytype_keyframe_select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Keyframe Selected", "Color of selected keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_extreme", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keytype_extreme");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Extreme Keyframe", "Color of extreme keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_extreme_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keytype_extreme_select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Extreme Keyframe Selected", "Color of selected extreme keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_breakdown", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keytype_breakdown");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Breakdown Keyframe", "Color of breakdown keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_breakdown_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keytype_breakdown_select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Breakdown Keyframe Selected", "Color of selected breakdown keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_jitter", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keytype_jitter");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Jitter Keyframe", "Color of jitter keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_jitter_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keytype_jitter_select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Jitter Keyframe Selected", "Color of selected jitter keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_movehold", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keytype_movehold");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Moving Hold Keyframe", "Color of moving hold keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_movehold_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keytype_movehold_select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Moving Hold Keyframe Selected", "Color of selected moving hold keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_border", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keyborder");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Keyframe Border", "Color of keyframe border");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_border_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keyborder_select");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Keyframe Border Selected", "Color of selected keyframe border");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_scale_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "keyframe_scale_fac");
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Keyframe Scale Factor", "Scale factor for adjusting the height of keyframes");
RNA_def_property_range(prop, 0.8f, 5.0f); /* Note: These limits prevent buttons overlapping (min), and excessive size... (max) */
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_userdef_update");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "summary", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_active");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Summary", "Color of summary channel");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "interpolation_line", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "ds_ipoline");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Interpolation Line", "Color of lines showing non-bezier interpolation modes");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
@@ -2928,61 +2944,61 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "view_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade1");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "View Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "active_action", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_active");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Active Action", "Animation data-block has active action");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "active_action_unset", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_non_active");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "No Active Action", "Animation data-block doesn't have active action");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Strips", "Action-Clip Strip - Unselected");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip_select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Strips Selected", "Action-Clip Strip - Selected");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "transition_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_transition");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Transitions", "Transition Strip - Unselected");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "transition_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_transition_sel");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Transitions Selected", "Transition Strip - Selected");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "meta_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_meta");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Meta Strips", "Meta Strip - Unselected (for grouping related strips)");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "meta_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_meta_sel");
@@ -2995,45 +3011,45 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Sound Strips",
"Sound Strip - Unselected (for timing speaker sounds)");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "sound_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_sound_sel");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Sound Strips Selected",
"Sound Strip - Selected (for timing speaker sounds)");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "tweak", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_tweaking");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Tweak", "Color for strip/action being 'tweaked' or edited");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "tweak_duplicate", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_tweakdupli");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Tweak Duplicate Flag",
"Warning/error indicator color for strips referencing the strip being tweaked");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_border", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keyborder");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Keyframe Border", "Color of keyframe border");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "keyframe_border_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keyborder_select");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Keyframe Border Selected", "Color of selected keyframe border");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "cframe");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_colorset(BlenderRNA *brna)
@@ -3049,25 +3065,25 @@ static void rna_def_userdef_theme_colorset(BlenderRNA *brna)
prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "solid");
RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Normal", "Color used for the surface of bones");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_ui_text(prop, "Regular", "Color used for the surface of bones");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "select", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Select", "Color used for selected bones");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "active", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Active", "Color used for active bones");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
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_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
@@ -3091,79 +3107,79 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "marker_outline");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Marker Outline Color", "Color of marker's outline");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "marker", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "marker");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Marker Color", "Color of marker");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "active_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "act_marker");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Active Marker", "Color of active marker");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
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 selected marker");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "disabled_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "dis_marker");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Disabled Marker", "Color of disabled marker");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "locked_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "lock_marker");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Locked Marker", "Color of locked marker");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "path_before", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "path_before");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Path Before", "Color of path before current frame");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "path_after", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "path_after");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Path After", "Color of path after current frame");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "cframe");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Strips", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip_select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Strips Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "metadatabg");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Metadata Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "metadatatext");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Metadata Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
rna_def_userdef_theme_spaces_curves(srna, false, false, false, true);
}
@@ -3222,7 +3238,7 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
{20, "CLIP_EDITOR", ICON_TRACKER, "Movie Clip Editor", ""},
{21, "TOPBAR", ICON_NONE, "Top Bar", ""},
{22, "STATUSBAR", ICON_NONE, "Status Bar", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "Theme", NULL);
@@ -3248,113 +3264,116 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ThemeUserInterface");
RNA_def_property_ui_text(prop, "User Interface", "");
+ /* Space Types */
prop = RNA_def_property(srna, "view_3d", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tv3d");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_view3d");
RNA_def_property_struct_type(prop, "ThemeView3D");
RNA_def_property_ui_text(prop, "3D View", "");
prop = RNA_def_property(srna, "graph_editor", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tipo");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_graph");
RNA_def_property_struct_type(prop, "ThemeGraphEditor");
RNA_def_property_ui_text(prop, "Graph Editor", "");
prop = RNA_def_property(srna, "file_browser", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tfile");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_file");
RNA_def_property_struct_type(prop, "ThemeFileBrowser");
RNA_def_property_ui_text(prop, "File Browser", "");
prop = RNA_def_property(srna, "nla_editor", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tnla");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_nla");
RNA_def_property_struct_type(prop, "ThemeNLAEditor");
RNA_def_property_ui_text(prop, "Nonlinear Animation", "");
prop = RNA_def_property(srna, "dopesheet_editor", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tact");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_action");
RNA_def_property_struct_type(prop, "ThemeDopeSheet");
RNA_def_property_ui_text(prop, "Dope Sheet", "");
prop = RNA_def_property(srna, "image_editor", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tima");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_image");
RNA_def_property_struct_type(prop, "ThemeImageEditor");
RNA_def_property_ui_text(prop, "Image Editor", "");
prop = RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tseq");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_sequencer");
RNA_def_property_struct_type(prop, "ThemeSequenceEditor");
RNA_def_property_ui_text(prop, "Sequence Editor", "");
prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tbuts");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_properties");
RNA_def_property_struct_type(prop, "ThemeProperties");
RNA_def_property_ui_text(prop, "Properties", "");
prop = RNA_def_property(srna, "text_editor", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "text");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_text");
RNA_def_property_struct_type(prop, "ThemeTextEditor");
RNA_def_property_ui_text(prop, "Text Editor", "");
prop = RNA_def_property(srna, "node_editor", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tnode");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_node");
RNA_def_property_struct_type(prop, "ThemeNodeEditor");
RNA_def_property_ui_text(prop, "Node Editor", "");
prop = RNA_def_property(srna, "outliner", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "toops");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_outliner");
RNA_def_property_struct_type(prop, "ThemeOutliner");
RNA_def_property_ui_text(prop, "Outliner", "");
prop = RNA_def_property(srna, "info", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tinfo");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_info");
RNA_def_property_struct_type(prop, "ThemeInfo");
RNA_def_property_ui_text(prop, "Info", "");
prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tuserpref");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_preferences");
RNA_def_property_struct_type(prop, "ThemePreferences");
RNA_def_property_ui_text(prop, "Preferences", "");
prop = RNA_def_property(srna, "console", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tconsole");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_console");
RNA_def_property_struct_type(prop, "ThemeConsole");
RNA_def_property_ui_text(prop, "Console", "");
- prop = RNA_def_property(srna, "bone_color_sets", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_collection_sdna(prop, NULL, "tarm", "");
- RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
- RNA_def_property_ui_text(prop, "Bone Color Sets", "");
-
prop = RNA_def_property(srna, "clip_editor", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tclip");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_clip");
RNA_def_property_struct_type(prop, "ThemeClipEditor");
RNA_def_property_ui_text(prop, "Clip Editor", "");
prop = RNA_def_property(srna, "topbar", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "ttopbar");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_topbar");
RNA_def_property_struct_type(prop, "ThemeTopBar");
RNA_def_property_ui_text(prop, "Top Bar", "");
prop = RNA_def_property(srna, "statusbar", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tstatusbar");
+ RNA_def_property_pointer_sdna(prop, NULL, "space_statusbar");
RNA_def_property_struct_type(prop, "ThemeStatusBar");
RNA_def_property_ui_text(prop, "Status Bar", "");
+ /* end space types */
+
+ prop = RNA_def_property(srna, "bone_color_sets", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_collection_sdna(prop, NULL, "tarm", "");
+ RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
+ RNA_def_property_ui_text(prop, "Bone Color Sets", "");
+
}
static void rna_def_userdef_addon(BlenderRNA *brna)
@@ -3663,7 +3682,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
"milliseconds are shown instead"},
{USER_TIMECODE_SECONDS_ONLY, "SECONDS_ONLY", 0, "Only Seconds",
"Direct conversion of frame numbers to seconds"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem color_picker_types[] = {
@@ -3674,21 +3693,21 @@ static void rna_def_userdef_view(BlenderRNA *brna)
{USER_CP_SQUARE_SV, "SQUARE_SV", 0, "Square (SV + H)", "A square showing Saturation/Value, with Hue slider"},
{USER_CP_SQUARE_HS, "SQUARE_HS", 0, "Square (HS + V)", "A square showing Hue/Saturation, with Value slider"},
{USER_CP_SQUARE_HV, "SQUARE_HV", 0, "Square (HV + S)", "A square showing Hue/Value, with Saturation slider"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem zoom_frame_modes[] = {
{ZOOM_FRAME_MODE_KEEP_RANGE, "KEEP_RANGE", 0, "Keep Range", ""},
{ZOOM_FRAME_MODE_SECONDS, "SECONDS", 0, "Seconds", ""},
{ZOOM_FRAME_MODE_KEYFRAMES, "KEYFRAMES", 0, "Keyframes", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem line_width[] = {
{-1, "THIN", 0, "Thin", "Thinner lines than the default"},
{ 0, "AUTO", 0, "Auto", "Automatic line width based on UI scale"},
{ 1, "THICK", 0, "Thick", "Thicker lines than the default"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
@@ -3702,7 +3721,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
/* View */
prop = RNA_def_property(srna, "ui_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "UI Scale", "Changes the size of the fonts and buttons in the interface");
+ RNA_def_property_ui_text(prop, "UI Scale", "Changes the size of the fonts and widgets in the interface");
RNA_def_property_range(prop, 0.25f, 4.0f);
RNA_def_property_ui_range(prop, 0.5f, 2.0f, 1, 2);
RNA_def_property_float_default(prop, 1.0f);
@@ -3711,7 +3730,8 @@ static void rna_def_userdef_view(BlenderRNA *brna)
prop = RNA_def_property(srna, "ui_line_width", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, line_width);
RNA_def_property_ui_text(prop, "UI Line Width",
- "Changes the thickness of lines and points in the interface");
+ "Changes the thickness of widget outlines, lines and points in the interface, "
+ "for high DPI displays");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
/* display */
@@ -3771,11 +3791,9 @@ static void rna_def_userdef_view(BlenderRNA *brna)
"Color range used for weight visualization in weight painting mode");
RNA_def_property_update(prop, 0, "rna_UserDef_weight_color_update");
-
- /* app flags (use for app-templates) */
prop = RNA_def_property(srna, "show_layout_ui", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "app_flag", USER_APP_LOCK_UI_LAYOUT);
- RNA_def_property_ui_text(prop, "Show Layout Widgets", "Show screen layout editing UI");
+ RNA_def_property_ui_text(prop, "Editor Corner Splitting", "Split and join editors by dragging from corners");
RNA_def_property_update(prop, 0, "rna_userdef_update_ui");
/* menus */
@@ -3809,6 +3827,12 @@ static void rna_def_userdef_view(BlenderRNA *brna)
"Pie menus will use the initial mouse position as center for this amount of time "
"(in 1/100ths of sec)");
+ prop = RNA_def_property(srna, "pie_tap_timeout", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(prop, "Tap Key Timeout",
+ "Pie menu button held longer than this will dismiss menu on release."
+ "(in 1/100ths of sec)");
+
prop = RNA_def_property(srna, "pie_animation_timeout", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_text(prop, "Animation Timeout",
@@ -3827,23 +3851,10 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Confirm Threshold",
"Distance threshold after which selection is made (zero to disable)");
- prop = RNA_def_property(srna, "use_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",
- "Ask 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");
- RNA_def_property_range(prop, 1, 40);
- RNA_def_property_ui_text(prop, "Hold LMB Open Toolbox Delay",
- "Time in 1/10 seconds to hold the Left Mouse Button before opening the toolbox");
-
- prop = RNA_def_property(srna, "open_right_mouse_delay", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "tb_rightmouse");
- RNA_def_property_range(prop, 1, 40);
- RNA_def_property_ui_text(prop, "Hold RMB Open Toolbox Delay",
- "Time in 1/10 seconds to hold the Right Mouse Button before opening the toolbox");
+ prop = RNA_def_property(srna, "use_save_prompt", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SAVE_PROMPT);
+ RNA_def_property_ui_text(prop, "Save Prompt",
+ "Ask for confirmation when quitting with unsaved changes");
prop = RNA_def_property(srna, "show_column_layout", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_PLAINMENUS);
@@ -3855,30 +3866,31 @@ static void rna_def_userdef_view(BlenderRNA *brna)
"Otherwise menus, etc will always be top to bottom, left to right, "
"no matter opening direction");
- static const EnumPropertyItem header_align_default_items[] = {
- {0, "TOP", 0, "Top", ""},
- {USER_HEADER_BOTTOM, "BOTTOM", 0, "Bottom", ""},
- {0, NULL, 0, NULL, NULL}
+ static const EnumPropertyItem header_align_items[] = {
+ {0, "NONE", 0, "Default", "Keep existing header alignment"},
+ {USER_HEADER_FROM_PREF, "TOP", 0, "Top", "Top aligned on load"},
+ {USER_HEADER_FROM_PREF | USER_HEADER_BOTTOM, "BOTTOM", 0, "Bottom", "Bottom align on load (except for property editors)"},
+ {0, NULL, 0, NULL, NULL},
};
- prop = RNA_def_property(srna, "header_align_default", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, header_align_default_items);
+ prop = RNA_def_property(srna, "header_align", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, header_align_items);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag");
RNA_def_property_ui_text(prop, "Header Position", "Default header position for new space-types");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_update_ui_header_default");
static const EnumPropertyItem text_hinting_items[] = {
{0, "AUTO", 0, "Auto", ""},
{USER_TEXT_HINTING_NONE, "NONE", 0, "None", ""},
{USER_TEXT_HINTING_SLIGHT, "SLIGHT", 0, "Slight", ""},
{USER_TEXT_HINTING_FULL, "FULL", 0, "Full", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* mini axis */
static const EnumPropertyItem mini_axis_type_items[] = {
{0, "MINIMAL", 0, "Simple Axis", ""},
{USER_SHOW_GIZMO_AXIS, "GIZMO", 0, "Interactive Navigation", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "mini_axis_type", PROP_ENUM, PROP_NONE);
@@ -4029,20 +4041,20 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
static const EnumPropertyItem auto_key_modes[] = {
{AUTOKEY_MODE_NORMAL, "ADD_REPLACE_KEYS", 0, "Add/Replace", ""},
{AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
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"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem object_align_items[] = {
{0, "WORLD", 0, "World", "Align newly added objects to the world coordinate system"},
{USER_ADD_VIEWALIGNED, "VIEW", 0, "View", "Align newly added objects facing the active 3D View direction"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "PreferencesEdit", NULL);
@@ -4070,18 +4082,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_ADD_EDITMODE);
RNA_def_property_ui_text(prop, "Enter Edit Mode", "Enter Edit Mode automatically after adding a new object");
- 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");
-
- prop = RNA_def_property(srna, "use_numeric_input_advanced", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FLAG_NUMINPUT_ADVANCED);
- RNA_def_property_ui_text(
- prop, "Default to Advanced Numeric Input",
- "When entering numbers while transforming, "
- "default to advanced mode for full math expression evaluation");
-
/* Undo */
prop = RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE);
@@ -4256,6 +4256,17 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "node_margin");
RNA_def_property_ui_text(prop, "Auto-offset Margin", "Minimum distance between nodes for Auto-offsetting nodes");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* cursor */
+ prop = RNA_def_property(srna, "use_cursor_lock_adjust", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_LOCK_CURSOR_ADJUST);
+ RNA_def_property_ui_text(prop, "Cursor Lock Adjust",
+ "Place the cursor without 'jumping' to the new location (when lock-to-cursor is used)");
+
+ prop = RNA_def_property(srna, "use_mouse_depth_cursor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DEPTH_CURSOR);
+ RNA_def_property_ui_text(prop, "Cursor Surface Project",
+ "Use the surface depth for cursor placement");
}
static void rna_def_userdef_system(BlenderRNA *brna)
@@ -4272,7 +4283,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{512, "CLAMP_512", 0, "512", ""},
{256, "CLAMP_256", 0, "256", ""},
{128, "CLAMP_128", 0, "128", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem anisotropic_items[] = {
@@ -4281,7 +4292,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{4, "FILTER_4", 0, "4x", ""},
{8, "FILTER_8", 0, "8x", ""},
{16, "FILTER_16", 0, "16x", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem audio_mixing_samples_items[] = {
@@ -4293,7 +4304,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{8192, "SAMPLES_8192", 0, "8192", "Set audio mixing buffer size to 8192 samples"},
{16384, "SAMPLES_16384", 0, "16384", "Set audio mixing buffer size to 16384 samples"},
{32768, "SAMPLES_32768", 0, "32768", "Set audio mixing buffer size to 32768 samples"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem audio_rate_items[] = {
@@ -4307,7 +4318,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* {88200, "RATE_88200", 0, "88.2 kHz", "Set audio sampling rate to 88200 samples per second"}, */
{96000, "RATE_96000", 0, "96 kHz", "Set audio sampling rate to 96000 samples per second"},
{192000, "RATE_192000", 0, "192 kHz", "Set audio sampling rate to 192000 samples per second"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem audio_format_items[] = {
@@ -4317,7 +4328,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{0x14, "S32", 0, "32-bit Signed", "Set audio sample format to 32 bit signed integer"},
{0x24, "FLOAT", 0, "32-bit Float", "Set audio sample format to 32 bit float"},
{0x28, "DOUBLE", 0, "64-bit Float", "Set audio sample format to 64 bit float"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem audio_channel_items[] = {
@@ -4326,30 +4337,23 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"},
{6, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound"},
{8, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem multi_sample_levels[] = {
{USER_MULTISAMPLE_NONE, "NONE", 0, "No MultiSample", "Do not use OpenGL MultiSample"},
- {USER_MULTISAMPLE_2, "2", 0, "MultiSample: 2", "Use 2x OpenGL MultiSample (requires restart)"},
- {USER_MULTISAMPLE_4, "4", 0, "MultiSample: 4", "Use 4x OpenGL MultiSample (requires restart)"},
- {USER_MULTISAMPLE_8, "8", 0, "MultiSample: 8", "Use 8x OpenGL MultiSample (requires restart)"},
- {USER_MULTISAMPLE_16, "16", 0, "MultiSample: 16", "Use 16x OpenGL MultiSample (requires restart)"},
- {0, NULL, 0, NULL, NULL}
+ {USER_MULTISAMPLE_2, "2", 0, "MultiSample: 2", "Use 2x OpenGL MultiSample"},
+ {USER_MULTISAMPLE_4, "4", 0, "MultiSample: 4", "Use 4x OpenGL MultiSample"},
+ {USER_MULTISAMPLE_8, "8", 0, "MultiSample: 8", "Use 8x OpenGL MultiSample"},
+ {USER_MULTISAMPLE_16, "16", 0, "MultiSample: 16", "Use 16x OpenGL MultiSample"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem image_draw_methods[] = {
{IMAGE_DRAW_METHOD_2DTEXTURE, "2DTEXTURE", 0, "2D Texture", "Use CPU for display transform and draw image with 2D texture"},
{IMAGE_DRAW_METHOD_GLSL, "GLSL", 0, "GLSL", "Use GLSL shaders for display transform and draw image with 2D texture"},
{IMAGE_DRAW_METHOD_DRAWPIXELS, "DRAWPIXELS", 0, "DrawPixels", "Use CPU for display transform and draw image using DrawPixels"},
- {0, NULL, 0, NULL, NULL}
- };
-
- static const EnumPropertyItem gpu_select_method_items[] = {
- {USER_SELECT_AUTO, "AUTO", 0, "Automatic", ""},
- {USER_SELECT_USE_SELECT_RENDERMODE, "GL_SELECT", 0, "OpenGL Select", ""},
- {USER_SELECT_USE_OCCLUSION_QUERY, "GL_QUERY", 0, "OpenGL Occlusion Queries", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "PreferencesSystem", NULL);
@@ -4409,7 +4413,13 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_enum_bitflag_sdna(prop, NULL, "ogl_multisamples");
RNA_def_property_enum_items(prop, multi_sample_levels);
RNA_def_property_ui_text(prop, "MultiSample",
- "Enable OpenGL multi-sampling, only for systems that support it, requires restart");
+ "Enable OpenGL multi-sampling, only for systems that support it");
+ RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
+
+ prop = RNA_def_property(srna, "use_edit_mode_smooth_wire", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_EDIT_MODE_SMOOTH_WIRE);
+ RNA_def_property_ui_text(prop, "Edit-Mode Smooth Wires",
+ "Enable Edit-Mode edge smoothing, reducing aliasing, requires restart");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
/* grease pencil anti-aliasing */
@@ -4423,7 +4433,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_region_overlap", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_REGION_OVERLAP);
RNA_def_property_ui_text(prop, "Region Overlap",
- "Draw tool/property regions over the main region, when using Triple Buffer");
+ "Draw tool/property regions over the main region");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
prop = RNA_def_property(srna, "gpu_viewport_quality", PROP_FLOAT, PROP_FACTOR);
@@ -4444,13 +4454,13 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Ambient Color", "Color of the ambient light that uniformly lit the scene");
RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
- prop = RNA_def_property(srna, "edit_studio_light", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_studio_light_edit", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "edit_studio_light", 1);
RNA_def_property_ui_text(prop, "Edit Studio Light",
"View the result of the studio light editor in the viewport");
RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
- prop = RNA_def_property(srna, "gl_clip_alpha", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "gl_clip_alpha", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "glalphaclip");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Clip Alpha", "Clip alpha below this threshold in the 3D textured view");
@@ -4458,16 +4468,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* Textures */
- prop = RNA_def_property(srna, "use_16bit_textures", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_16bit_textures", 1);
- RNA_def_property_ui_text(prop, "16 Bit Float Textures", "Use 16 bit per component texture for float images");
- RNA_def_property_update(prop, 0, "rna_userdef_gl_use_16bit_textures");
-
- prop = RNA_def_property(srna, "use_gpu_mipmap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_gpu_mipmap", 1);
- RNA_def_property_ui_text(prop, "GPU Mipmap Generation", "Generate Image Mipmaps on the GPU");
- RNA_def_property_update(prop, 0, "rna_userdef_gl_gpu_mipmaps");
-
prop = RNA_def_property(srna, "image_draw_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, image_draw_methods);
RNA_def_property_enum_sdna(prop, NULL, "image_draw_method");
@@ -4504,12 +4504,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* Select */
- prop = RNA_def_property(srna, "select_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "gpu_select_method");
- RNA_def_property_enum_items(prop, gpu_select_method_items);
- RNA_def_property_ui_text(prop, "Selection Method",
- "Use OpenGL occlusion queries or selection render mode to accelerate selection");
-
prop = RNA_def_property(srna, "use_select_pick_depth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gpu_select_pick_deph", 1);
RNA_def_property_ui_text(prop, "OpenGL Depth Picking", "Use the depth buffer for picking 3D View selection");
@@ -4575,35 +4569,42 @@ static void rna_def_userdef_input(BlenderRNA *brna)
static const EnumPropertyItem view_rotation_items[] = {
{0, "TURNTABLE", 0, "Turntable", "Turntable keeps the Z-axis upright while orbiting"},
{USER_TRACKBALL, "TRACKBALL", 0, "Trackball", "Trackball allows you to tumble your view at any angle"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef WITH_INPUT_NDOF
static const EnumPropertyItem ndof_view_navigation_items[] = {
{0, "FREE", 0, "Free", "Use full 6 degrees of freedom by default"},
{NDOF_MODE_ORBIT, "ORBIT", 0, "Orbit", "Orbit about the view center by default"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem ndof_view_rotation_items[] = {
{NDOF_TURNTABLE, "TURNTABLE", 0, "Turntable", "Use turntable style rotation in the viewport"},
{0, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif /* WITH_INPUT_NDOF */
+ static const EnumPropertyItem tablet_api[] = {
+ {USER_TABLET_AUTOMATIC, "AUTOMATIC", 0, "Automatic", "Automatically choose Wintab or Windows Ink depending on the device"},
+ {USER_TABLET_NATIVE, "WINDOWS_INK", 0, "Windows Ink", "Use native Windows Ink API, for modern tablet and pen devices. Requires Windows 8 or newer"},
+ {USER_TABLET_WINTAB, "WINTAB", 0, "Wintab", "Use Wintab driver for older tablets and Windows versions"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
static const 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"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem view_zoom_axes[] = {
{0, "VERTICAL", 0, "Vertical", "Zoom in and out based on vertical mouse movement"},
{USER_ZOOM_HORIZ, "HORIZONTAL", 0, "Horizontal", "Zoom in and out based on horizontal mouse movement"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "PreferencesInput", NULL);
@@ -4626,21 +4627,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_INVERT);
RNA_def_property_ui_text(prop, "Invert Zoom Direction", "Invert the axis of mouse movement for zooming");
- prop = RNA_def_property(srna, "use_cursor_lock_adjust", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_LOCK_CURSOR_ADJUST);
- RNA_def_property_ui_text(prop, "Cursor Lock Adjust",
- "Place the cursor without 'jumping' to the new location (when lock-to-cursor is used)");
-
prop = RNA_def_property(srna, "use_mouse_depth_navigate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DEPTH_NAVIGATE);
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_mouse_depth_cursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DEPTH_CURSOR);
- RNA_def_property_ui_text(prop, "Cursor Surface Project",
- "Use the surface depth for cursor placement");
-
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);
RNA_def_property_ui_text(prop, "Camera Parent Lock",
@@ -4676,6 +4667,18 @@ static void rna_def_userdef_input(BlenderRNA *brna)
"Allow moving the mouse outside the view on some manipulations "
"(transform, ui control drag)");
+ 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");
+
+ prop = RNA_def_property(srna, "use_numeric_input_advanced", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FLAG_NUMINPUT_ADVANCED);
+ RNA_def_property_ui_text(
+ prop, "Default to Advanced Numeric Input",
+ "When entering numbers while transforming, "
+ "default to advanced mode for full math expression evaluation");
+
/* View Navigation */
prop = RNA_def_property(srna, "navigation_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "navigation_mode");
@@ -4690,16 +4693,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
/* tweak tablet & mouse preset */
prop = RNA_def_property(srna, "drag_threshold", PROP_INT, PROP_PIXEL);
- 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");
-
- prop = RNA_def_property(srna, "tweak_threshold", PROP_INT, PROP_PIXEL);
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, "Drag Threshold",
+ "Number of pixels you have to drag before a tweak/drag event is triggered "
+ "(otherwise click events are detected)");
/* tablet pressure curve */
prop = RNA_def_property(srna, "pressure_threshold_max", PROP_FLOAT, PROP_FACTOR);
@@ -4715,6 +4713,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Softness",
"Adjusts softness of the low pressure response onset using a gamma curve");
+ prop = RNA_def_property(srna, "tablet_api", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, tablet_api);
+ RNA_def_property_ui_text(prop, "Tablet API", "Select the tablet API to use for pressure sensitivity");
+ RNA_def_property_update(prop, 0, "rna_userdef_tablet_api_update");
+
#ifdef WITH_INPUT_NDOF
/* 3D mouse settings */
/* global options */
@@ -4866,7 +4869,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
{4, "RV", 0, "rv", "Frame player from Tweak Software"},
{5, "MPLAYER", 0, "MPlayer", "Media player for video & png/jpeg/sgi image sequences"},
{50, "CUSTOM", 0, "Custom", "Custom animation player executable path"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "PreferencesFilePaths", NULL);
@@ -4877,7 +4880,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_hidden_files_datablocks", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_DOT);
- RNA_def_property_ui_text(prop, "Hide Dot Files/Data-Blocks", "Hide files/data-blocks that start with a dot (.*)");
+ RNA_def_property_ui_text(prop, "Hide Dot Files/Libraries", "Hide files and data-blocks if their name start with a dot (.*)");
prop = RNA_def_property(srna, "use_filter_files", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_FILTERFILEEXTS);
@@ -4917,12 +4920,6 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
"(unsafe with blend files from an untrusted source)");
RNA_def_property_update(prop, 0, "rna_userdef_script_autoexec_update");
- 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");
-
prop = RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TXT_TABSTOSPACES_DISABLE);
RNA_def_property_ui_text(prop, "Tabs as Spaces",
@@ -5003,11 +5000,6 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
"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, "use_keep_session", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_KEEP_SESSION);
- RNA_def_property_ui_text(prop, "Keep Session",
- "Always load session recovery and save it after quitting Blender");
-
prop = RNA_def_property(srna, "recent_files", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 30);
RNA_def_property_ui_text(prop, "Recent Files", "Maximum number of recently opened files to remember");
@@ -5076,28 +5068,29 @@ void RNA_def_userdef(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem preference_section_items[] = {
- {0, "", ICON_USER, "User", ""},
{USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""},
{USER_SECTION_THEME, "THEMES", 0, "Themes", ""},
+ {USER_SECTION_VIEWPORT, "VIEWPORT", 0, "Viewport", ""},
{USER_SECTION_LIGHT, "LIGHTS", 0, "Lights", ""},
- {USER_SECTION_EDIT, "EDITING", 0, "Editing", ""},
- {USER_SECTION_INPUT, "INPUT", 0, "Input", ""},
- {USER_SECTION_KEYMAP, "KEYMAP", 0, "Keymap", ""},
+ {USER_SECTION_EDITING, "EDITING", 0, "Editing", ""},
+ {USER_SECTION_ANIMATION, "ANIMATION", 0, "Animation", ""},
+ {0, "", 0, NULL, NULL},
{USER_SECTION_ADDONS, "ADDONS", 0, "Add-ons", ""},
-#ifdef WITH_USERDEF_WORKSPACES
- {0, "", ICON_WORKSPACE, "Workspaces", ""},
+#if 0 //def WITH_USERDEF_WORKSPACES
+ {0, "", 0, NULL, NULL},
{USER_SECTION_WORKSPACE_CONFIG, "WORKSPACE_CONFIG", 0, "Configuration File", ""},
{USER_SECTION_WORKSPACE_ADDONS, "WORKSPACE_ADDONS", 0, "Add-on Overrides", ""},
{USER_SECTION_WORKSPACE_KEYMAPS, "WORKSPACE_KEYMAPS", 0, "Keymap Overrides", ""},
#endif
- {0, "", ICON_SYSTEM, "System", ""},
- {USER_SECTION_SYSTEM_GENERAL, "SYSTEM_GENERAL", 0, "General", ""},
- {USER_SECTION_SYSTEM_FILES, "SYSTEM_FILES", 0, "Files", ""},
-#ifdef WITH_USERDEF_SYSTEM_SPLIT
- {USER_SECTION_SYSTEM_DISPLAY, "SYSTEM_DISPLAY", 0, "Display", ""},
- {USER_SECTION_SYSTEM_DEVICES, "SYSTEM_DEVICES", 0, "Devices", ""},
-#endif
- {0, NULL, 0, NULL, NULL}
+ {0, "", 0, NULL, NULL},
+ {USER_SECTION_INPUT, "INPUT", 0, "Input", ""},
+ {USER_SECTION_NAVIGATION, "NAVIGATION", 0, "Navigation", ""},
+ {USER_SECTION_KEYMAP, "KEYMAP", 0, "Keymap", ""},
+ {0, "", 0, NULL, NULL},
+ {USER_SECTION_SYSTEM, "SYSTEM", 0, "System", ""},
+ {USER_SECTION_SAVE_LOAD, "SAVE_LOAD", 0, "Save & Load", ""},
+ {USER_SECTION_FILE_PATHS, "FILE_PATHS", 0, "File Paths", ""},
+ {0, NULL, 0, NULL, NULL},
};
rna_def_userdef_dothemes(brna);
diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c
index f01f095066e..f8b62711c5f 100644
--- a/source/blender/makesrna/intern/rna_vfont.c
+++ b/source/blender/makesrna/intern/rna_vfont.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008), Juho Vepsäläinen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_vfont.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
diff --git a/source/blender/makesrna/intern/rna_vfont_api.c b/source/blender/makesrna/intern/rna_vfont_api.c
index b93fc1a0053..a6e043c090f 100644
--- a/source/blender/makesrna/intern/rna_vfont_api.c
+++ b/source/blender/makesrna/intern/rna_vfont_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2015 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_vfont_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include "DNA_packedFile_types.h"
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 475f53d9ef1..55a18b40adc 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_wm.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -32,7 +26,6 @@
#include "DNA_windowmanager_types.h"
#include "BLI_utildefines.h"
-#include "BLI_string_utils.h"
#include "BLT_translation.h"
@@ -48,6 +41,7 @@
#include "WM_types.h"
#ifdef RNA_RUNTIME
+
static const EnumPropertyItem event_keymouse_value_items[] = {
{KM_ANY, "ANY", 0, "Any", ""},
{KM_PRESS, "PRESS", 0, "Press", ""},
@@ -55,7 +49,7 @@ static const EnumPropertyItem event_keymouse_value_items[] = {
{KM_CLICK, "CLICK", 0, "Click", ""},
{KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
{KM_CLICK_DRAG, "CLICK_DRAG", 0, "Click Drag", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_tweak_value_items[] = {
@@ -68,14 +62,14 @@ static const EnumPropertyItem event_tweak_value_items[] = {
{EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
{EVT_GESTURE_W, "WEST", 0, "West", ""},
{EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_tweak_type_items[] = {
{EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""},
{EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""},
{EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_mouse_type_items[] = {
@@ -99,7 +93,7 @@ static const EnumPropertyItem event_mouse_type_items[] = {
{WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""},
{WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""},
{WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_timer_type_items[] = {
@@ -111,12 +105,12 @@ static const EnumPropertyItem event_timer_type_items[] = {
{TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", ""},
{TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", ""},
{TIMERREGION, "TIMERREGION", 0, "Timer Region", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_textinput_type_items[] = {
{KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_ndof_type_items[] = {
@@ -166,7 +160,7 @@ static const EnumPropertyItem event_ndof_type_items[] = {
{NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "Button A", ""},
{NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "Button B", ""},
{NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "Button C", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif /* RNA_RUNTIME */
@@ -379,7 +373,7 @@ const EnumPropertyItem rna_enum_event_type_items[] = {
{EVT_ACTIONZONE_AREA, "ACTIONZONE_AREA", 0, "ActionZone Area", "AZone Area"},
{EVT_ACTIONZONE_REGION, "ACTIONZONE_REGION", 0, "ActionZone Region", "AZone Region"},
{EVT_ACTIONZONE_FULLSCREEN, "ACTIONZONE_FULLSCREEN", 0, "ActionZone Fullscreen", "AZone FullScr"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_event_value_items[] = {
@@ -398,12 +392,12 @@ const EnumPropertyItem rna_enum_event_value_items[] = {
{EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
{EVT_GESTURE_W, "WEST", 0, "West", ""},
{EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_keymap_propvalue_items[] = {
{0, "NONE", 0, "", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -418,7 +412,7 @@ const EnumPropertyItem rna_enum_event_type_mask_items[] = {
{EVT_TYPE_MASK_NDOF, "NDOF", 0, "NDOF", ""},
{EVT_TYPE_MASK_TWEAK, "TWEAK", 0, "Tweak", ""},
{EVT_TYPE_MASK_ACTIONZONE, "ACTIONZONE", 0, "Action Zone", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#if 0
@@ -427,7 +421,7 @@ static const EnumPropertyItem keymap_modifiers_items[] = {
{0, "NONE", 0, "None", ""},
{1, "FIRST", 0, "First", ""},
{2, "SECOND", 0, "Second", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -446,7 +440,7 @@ static const EnumPropertyItem operator_flag_items[] = {
{OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"},
{OPTYPE_USE_EVAL_DATA, "USE_EVAL_DATA", 0, "Use Evaluated Data",
"Uses evaluated data (i.e. needs a valid depsgraph for current context)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#endif
@@ -457,12 +451,12 @@ const EnumPropertyItem rna_enum_operator_return_items[] = {
/* used as a flag */
{OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"},
{OPERATOR_INTERFACE, "INTERFACE", 0, "Interface", "Handled but not executed (popup menus)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_operator_property_tags[] = {
{OP_PROP_TAG_ADVANCED, "ADVANCED", 0, "Advanced", "The property is advanced so UI is suggested to hide it"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* flag/enum */
@@ -476,13 +470,15 @@ const EnumPropertyItem rna_enum_wm_report_items[] = {
{RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""},
{RPT_ERROR_INVALID_CONTEXT, "ERROR_INVALID_CONTEXT", 0, "Invalid Context", ""},
{RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
#include <assert.h>
+#include "BLI_string_utils.h"
+
#include "WM_api.h"
#include "DNA_object_types.h"
@@ -2352,7 +2348,7 @@ static void rna_def_keyconfig(BlenderRNA *brna)
{KMI_TYPE_NDOF, "NDOF", 0, "NDOF", ""},
{KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
{KMI_TYPE_TIMER, "TIMER", 0, "Timer", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* KeyConfig */
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index 51291f70cfa..92cef34cc7c 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,16 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_wm_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
#include <stdio.h>
+#include <ctype.h>
#include "BLI_utildefines.h"
@@ -66,12 +60,13 @@ const EnumPropertyItem rna_enum_window_cursor_items[] = {
{BC_NS_SCROLLCURSOR, "SCROLL_Y", 0, "Scroll-Y", ""},
{BC_NSEW_SCROLLCURSOR, "SCROLL_XY", 0, "Scroll-XY", ""},
{BC_EYEDROPPER_CURSOR, "EYEDROPPER", 0, "Eyedropper", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
#include "BKE_context.h"
+#include "BKE_undo_system.h"
#include "WM_types.h"
@@ -309,6 +304,23 @@ static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA
RNA_POINTER_INVALIDATE(kmi_ptr);
}
+static PointerRNA rna_KeyMap_item_find_from_operator(
+ ID *id,
+ wmKeyMap *km,
+ const char *idname,
+ PointerRNA *properties,
+ int include_mask, int exclude_mask)
+{
+ char idname_bl[OP_MAX_TYPENAME];
+ WM_operator_bl_idname(idname_bl, idname);
+
+ wmKeyMapItem *kmi = WM_key_event_operator_from_keymap(
+ km, idname_bl, properties->data, include_mask, exclude_mask);
+ PointerRNA kmi_ptr;
+ RNA_pointer_create(id, &RNA_KeyMapItem, kmi, &kmi_ptr);
+ return kmi_ptr;
+}
+
static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, bool modal, bool tool)
{
wmKeyMap *keymap;
@@ -446,6 +458,11 @@ static void rna_PieMenuEnd(bContext *C, PointerRNA *handle)
UI_pie_menu_end(C, handle->data);
}
+static void rna_WindowManager_print_undo_steps(wmWindowManager *wm)
+{
+ BKE_undosys_print(wm->undo_stack);
+}
+
static PointerRNA rna_WindoManager_operator_properties_last(const char *idname)
{
wmOperatorType *ot = WM_operatortype_find(idname, true);
@@ -458,6 +475,79 @@ static PointerRNA rna_WindoManager_operator_properties_last(const char *idname)
return PointerRNA_NULL;
}
+static wmEvent *rna_Window_event_add_simulate(
+ wmWindow *win, ReportList *reports,
+ int type, int value, const char *unicode,
+ int x, int y,
+ bool shift, bool ctrl, bool alt, bool oskey)
+{
+ if ((G.f & G_FLAG_EVENT_SIMULATE) == 0) {
+ BKE_report(reports, RPT_ERROR, "Not running with '--enable-event-simulate' enabled");
+ return NULL;
+ }
+
+ if (!ELEM(value, KM_PRESS, KM_RELEASE, KM_NOTHING)) {
+ BKE_report(reports, RPT_ERROR, "value: only 'PRESS/RELEASE/NOTHING' are supported");
+ return NULL;
+ }
+ if (ISKEYBOARD(type) || ISMOUSE_BUTTON(type)) {
+ if (!ELEM(value, KM_PRESS, KM_RELEASE)) {
+ BKE_report(reports, RPT_ERROR, "value: must be 'PRESS/RELEASE' for keyboard/buttons");
+ return NULL;
+ }
+ }
+ if (ELEM(type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
+ if (value != KM_NOTHING) {
+ BKE_report(reports, RPT_ERROR, "value: must be 'NOTHING' for motion");
+ return NULL;
+ }
+ }
+ if (unicode != NULL) {
+ if (value != KM_PRESS) {
+ BKE_report(reports, RPT_ERROR, "value: must be 'PRESS' when unicode is set");
+ return NULL;
+ }
+ }
+ /* TODO: validate NDOF. */
+
+ char ascii = 0;
+ if (unicode != NULL) {
+ int len = BLI_str_utf8_size(unicode);
+ if (len == -1 || unicode[len] != '\0') {
+ BKE_report(reports, RPT_ERROR, "Only a single character supported");
+ return NULL;
+ }
+ if (len == 1 && isascii(unicode[0])) {
+ ascii = unicode[0];
+ }
+ }
+
+ wmEvent e = *win->eventstate;
+ e.type = type;
+ e.val = value;
+ e.x = x;
+ e.y = y;
+ /* Note: KM_MOD_FIRST, KM_MOD_SECOND aren't used anywhere, set as bools */
+ e.shift = shift;
+ e.ctrl = ctrl;
+ e.alt = alt;
+ e.oskey = oskey;
+
+ e.prevx = win->eventstate->x;
+ e.prevy = win->eventstate->y;
+ e.prevval = win->eventstate->val;
+ e.prevtype = win->eventstate->type;
+
+ e.ascii = '\0';
+ e.utf8_buf[0] = '\0';
+ if (unicode != NULL) {
+ e.ascii = ascii;
+ STRNCPY(e.utf8_buf, unicode);
+ }
+
+ return WM_event_add_simulate(win, &e);
+}
+
#else
#define WM_GEN_INVOKE_EVENT (1 << 0)
@@ -514,6 +604,26 @@ void RNA_api_window(StructRNA *srna)
RNA_def_function(srna, "cursor_modal_restore", "WM_cursor_modal_restore");
RNA_def_function_ui_description(func, "Restore the previous cursor after calling ``cursor_modal_set``");
+
+ /* Arguments match 'rna_KeyMap_item_new'. */
+ func = RNA_def_function(srna, "event_simulate", "rna_Window_event_add_simulate");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "unicode", NULL, 0, "", "");
+ RNA_def_parameter_clear_flags(parm, PROP_NEVER_NULL, 0);
+
+ RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
+ RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
+
+ RNA_def_boolean(func, "shift", 0, "Shift", "");
+ RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
+ RNA_def_boolean(func, "alt", 0, "Alt", "");
+ RNA_def_boolean(func, "oskey", 0, "OS Key", "");
+ parm = RNA_def_pointer(func, "event", "Event", "Item", "Added key map item");
+ RNA_def_function_return(func, parm);
}
void RNA_api_wm(StructRNA *srna)
@@ -680,6 +790,7 @@ void RNA_api_wm(StructRNA *srna)
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
RNA_def_function_return(func, parm);
+ RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps");
}
void RNA_api_operator(StructRNA *srna)
@@ -908,6 +1019,20 @@ void RNA_api_keymapitems(StructRNA *srna)
RNA_def_property_ui_text(parm, "id", "ID of the item");
parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
RNA_def_function_return(func, parm);
+
+ /* Keymap introspection
+ * Args follow: KeyConfigs.find_item_from_operator */
+ func = RNA_def_function(srna, "find_from_operator", "rna_KeyMap_item_find_from_operator");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_enum_flag(func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
+ RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
}
void RNA_api_keymaps(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 41e3929e8ae..2a084cbd526 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_wm_gizmo.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include <stdlib.h>
@@ -31,7 +27,6 @@
#include "DNA_windowmanager_types.h"
#include "BLI_utildefines.h"
-#include "BLI_string_utils.h"
#include "BLT_translation.h"
@@ -51,6 +46,8 @@
#include <assert.h>
+#include "BLI_string_utils.h"
+
#include "WM_api.h"
#include "DNA_workspace_types.h"
@@ -70,7 +67,6 @@
#endif
/* -------------------------------------------------------------------- */
-
/** \name Gizmo API
* \{ */
@@ -261,7 +257,7 @@ static wmGizmo *rna_GizmoProperties_find_operator(PointerRNA *ptr)
#endif
/* We could try workaruond this lookup, but not trivial. */
- for (bScreen *screen = G_MAIN->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = G_MAIN->screens.first; screen; screen = screen->id.next) {
IDProperty *properties = ptr->data;
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
@@ -407,6 +403,7 @@ RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_hide, flag, WM_GIZMO_HIDDEN);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_hide_select, flag, WM_GIZMO_HIDDEN_SELECT);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_grab_cursor, flag, WM_GIZMO_MOVE_CURSOR);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_select_background, flag, WM_GIZMO_SELECT_BACKGROUND);
+RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_operator_tool_properties, flag, WM_GIZMO_OPERATOR_TOOL_INIT);
/* wmGizmo.state */
RNA_GIZMO_FLAG_RO_DEF(state_is_highlight, state, WM_GIZMO_STATE_HIGHLIGHT);
@@ -1018,14 +1015,14 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
parm = RNA_def_int_array(func, "location", 2, NULL, INT_MIN, INT_MAX, "Location", "Region coordinates", INT_MIN, INT_MAX);
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_int(func, "intersect_id", 0, 0, INT_MAX, "", "", 0, INT_MAX);
+ parm = RNA_def_int(func, "intersect_id", -1, -1, INT_MAX, "", "Use -1 to skip this gizmo", -1, INT_MAX);
RNA_def_function_return(func, parm);
/* wmGizmo.handler */
static EnumPropertyItem tweak_actions[] = {
{WM_GIZMO_TWEAK_PRECISE, "PRECISE", 0, "Precise", ""},
{WM_GIZMO_TWEAK_SNAP, "SNAP", 0, "Snap", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
func = RNA_def_function(srna, "modal", NULL);
RNA_def_function_ui_description(func, "");
@@ -1200,6 +1197,14 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_ui_text(prop, "Select Background", "Don't write into the depth buffer");
RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+ /* WM_GIZMO_OPERATOR_TOOL_INIT */
+ prop = RNA_def_property(srna, "use_operator_tool_properties", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_Gizmo_flag_use_operator_tool_properties_get", "rna_Gizmo_flag_use_operator_tool_properties_set");
+ RNA_def_property_ui_text(prop, "Tool Property Init",
+ "Merge active tool properties on activation (does not overwrite existing)");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
/* wmGizmo.state (readonly) */
/* WM_GIZMO_STATE_HIGHLIGHT */
prop = RNA_def_property(srna, "is_highlight", PROP_BOOLEAN, PROP_NONE);
@@ -1298,7 +1303,7 @@ static void rna_def_gizmogroup(BlenderRNA *brna)
"Show all while interacting"},
{WM_GIZMOGROUPTYPE_TOOL_INIT, "TOOL_INIT", 0, "Tool Init",
"Postpone running until tool operator run (when used with a tool)"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type->flag");
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo_api.c b/source/blender/makesrna/intern/rna_wm_gizmo_api.c
index 37c4e22b68e..48957325963 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo_api.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_wm_gizmo_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c
index 1a06bf7b086..f6691e0fe26 100644
--- a/source/blender/makesrna/intern/rna_workspace.c
+++ b/source/blender/makesrna/intern/rna_workspace.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_workspace.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
#include "RNA_define.h"
@@ -123,19 +119,19 @@ static bToolRef *rna_WorkSpace_tools_from_tkey(WorkSpace *workspace, const bTool
static bToolRef *rna_WorkSpace_tools_from_space_view3d_mode(
WorkSpace *workspace, int mode, bool create)
{
- return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_VIEW3D, .mode = mode}, create);
+ return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_VIEW3D, .mode = mode, }, create);
}
static bToolRef *rna_WorkSpace_tools_from_space_image_mode(
WorkSpace *workspace, int mode, bool create)
{
- return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_IMAGE, .mode = mode}, create);
+ return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_IMAGE, .mode = mode, }, create);
}
static bToolRef *rna_WorkSpace_tools_from_space_node(
WorkSpace *workspace, bool create)
{
- return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_NODE, .mode = 0}, create);
+ return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_NODE, .mode = 0, }, create);
}
const EnumPropertyItem *rna_WorkSpace_tools_mode_itemf(
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c
index fd268c898ff..c2e8e9a49a6 100644
--- a/source/blender/makesrna/intern/rna_workspace_api.c
+++ b/source/blender/makesrna/intern/rna_workspace_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_workspace_api.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index fe561cdef1c..3fd01a5b8e5 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation (2008).
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/makesrna/intern/rna_world.c
- * \ingroup RNA
+/** \file
+ * \ingroup RNA
*/
@@ -148,7 +142,7 @@ static void rna_def_world_mist(BlenderRNA *brna)
{WO_MIST_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Use quadratic progression"},
{WO_MIST_LINEAR, "LINEAR", 0, "Linear", "Use linear progression"},
{WO_MIST_INVERSE_QUADRATIC, "INVERSE_QUADRATIC", 0, "Inverse Quadratic", "Use inverse quadratic progression"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "WorldMistSettings", NULL);
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index a17ea929ef8..89b2114bcb4 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -16,12 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain
-# Ben Batt
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -97,8 +91,8 @@ set(SRC
intern/MOD_surfacedeform.c
intern/MOD_triangulate.c
intern/MOD_util.c
- intern/MOD_uvwarp.c
intern/MOD_uvproject.c
+ intern/MOD_uvwarp.c
intern/MOD_warp.c
intern/MOD_wave.c
intern/MOD_weighted_normal.c
diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h
index 42eb9db3a8f..687bc2c2db6 100644
--- a/source/blender/modifiers/MOD_modifiertypes.h
+++ b/source/blender/modifiers/MOD_modifiertypes.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Ben Batt
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file MOD_modifiertypes.h
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#ifndef __MOD_MODIFIERTYPES_H__
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index fcd54639f9f..4a474dde585 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,31 +15,21 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_armature.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <string.h>
+#include "BLI_utildefines.h"
+
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
-#include "BLI_utildefines.h"
-#include "BLI_string.h"
-
#include "BKE_editmesh.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
@@ -77,14 +65,10 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
tamd->prevCos = NULL;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md), CustomData_MeshMasks *r_cddata_masks)
{
- CustomDataMask dataMask = 0;
-
/* ask for vertexgroups */
- dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
}
static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams))
@@ -110,7 +94,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_object_relation(ctx->node, amd->object, DEG_OB_COMP_EVAL_POSE, "Armature Modifier");
DEG_add_object_relation(ctx->node, amd->object, DEG_OB_COMP_TRANSFORM, "Armature Modifier");
}
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Armature Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Armature Modifier");
}
static void deformVerts(
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index d14d8f2288e..56567c79c6a 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,20 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton,
- * Patrice Bertrand
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_array.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*
* Array modifier: duplicates the object multiple times along an axis.
*/
#include "MEM_guardedalloc.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_math.h"
+
#include "DNA_curve_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -108,7 +97,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
if (amd->offset_ob != NULL) {
DEG_add_object_relation(ctx->node, amd->offset_ob, DEG_OB_COMP_TRANSFORM, "Array Modifier Offset");
}
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Array Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Array Modifier");
}
BLI_INLINE float sum_v3(const float v[3])
@@ -372,7 +361,6 @@ static Mesh *arrayModifier_doArray(
int first_chunk_start, first_chunk_nverts, last_chunk_start, last_chunk_nverts;
Mesh *result, *start_cap_mesh = NULL, *end_cap_mesh = NULL;
- bool start_cap_mesh_free, end_cap_mesh_free;
int *vgroup_start_cap_remap = NULL;
int vgroup_start_cap_remap_len = 0;
@@ -391,7 +379,7 @@ static Mesh *arrayModifier_doArray(
vgroup_start_cap_remap = BKE_object_defgroup_index_map_create(
start_cap_ob, ctx->object, &vgroup_start_cap_remap_len);
- start_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(start_cap_ob, &start_cap_mesh_free);
+ start_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(start_cap_ob, false);
if (start_cap_mesh) {
start_cap_nverts = start_cap_mesh->totvert;
start_cap_nedges = start_cap_mesh->totedge;
@@ -404,7 +392,7 @@ static Mesh *arrayModifier_doArray(
vgroup_end_cap_remap = BKE_object_defgroup_index_map_create(
end_cap_ob, ctx->object, &vgroup_end_cap_remap_len);
- end_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(end_cap_ob, &end_cap_mesh_free);
+ end_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(end_cap_ob, false);
if (end_cap_mesh) {
end_cap_nverts = end_cap_mesh->totvert;
end_cap_nedges = end_cap_mesh->totedge;
@@ -740,12 +728,6 @@ static Mesh *arrayModifier_doArray(
if (vgroup_end_cap_remap) {
MEM_freeN(vgroup_end_cap_remap);
}
- if (start_cap_mesh != NULL && start_cap_mesh_free) {
- BKE_id_free(NULL, start_cap_mesh);
- }
- if (end_cap_mesh != NULL && end_cap_mesh_free) {
- BKE_id_free(NULL, end_cap_mesh);
- }
return result;
}
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index e63b5407a74..6e1dd9ed45d 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,33 +15,23 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_bevel.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_utildefines.h"
-#include "BLI_linklist_stack.h"
-#include "BLI_math.h"
-#include "BLI_string.h"
-
#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
@@ -67,31 +55,28 @@ static void initData(ModifierData *md)
bmd->e_flags = 0;
bmd->edge_flags = 0;
bmd->face_str_mode = MOD_BEVEL_FACE_STRENGTH_NONE;
+ bmd->miter_inner = MOD_BEVEL_MITER_SHARP;
+ bmd->miter_outer = MOD_BEVEL_MITER_SHARP;
+ bmd->spread = 0.1f;
bmd->mat = -1;
bmd->profile = 0.5f;
bmd->bevel_angle = DEG2RADF(30.0f);
bmd->defgrp_name[0] = '\0';
- bmd->clnordata.faceHash = NULL;
}
-static void copyData(const ModifierData *md_src, ModifierData *md_dst, const int UNUSED(flag))
+static void copyData(const ModifierData *md_src, ModifierData *md_dst, const int flag)
{
- BevelModifierData *bmd_src = (BevelModifierData *)md_src;
- BevelModifierData *bmd_dst = (BevelModifierData *)md_dst;
-
- *bmd_dst = *bmd_src;
- bmd_dst->clnordata.faceHash = NULL;
+ modifier_copyData_generic(md_src, md_dst, flag);
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
BevelModifierData *bmd = (BevelModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (bmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (bmd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
/*
@@ -112,12 +97,16 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
const bool vertex_only = (bmd->flags & MOD_BEVEL_VERT) != 0;
const bool do_clamp = !(bmd->flags & MOD_BEVEL_OVERLAP_OK);
const int offset_type = bmd->val_flags;
+ const float value = bmd->value;
const int mat = CLAMPIS(bmd->mat, -1, ctx->object->totcol - 1);
const bool loop_slide = (bmd->flags & MOD_BEVEL_EVEN_WIDTHS) == 0;
const bool mark_seam = (bmd->edge_flags & MOD_BEVEL_MARK_SEAM);
const bool mark_sharp = (bmd->edge_flags & MOD_BEVEL_MARK_SHARP);
- const bool harden_normals = (bmd->flags & MOD_BEVEL_HARDEN_NORMALS);
+ bool harden_normals = (bmd->flags & MOD_BEVEL_HARDEN_NORMALS);
const int face_strength_mode = bmd->face_str_mode;
+ const int miter_outer = bmd->miter_outer;
+ const int miter_inner = bmd->miter_inner;
+ const float spread = bmd->spread;
bm = BKE_mesh_to_bmesh_ex(
mesh,
@@ -125,9 +114,10 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
&(struct BMeshFromMeshParams){
.calc_face_normal = true,
.add_key_index = false,
- .use_shapekey = true,
- .active_shapekey = ctx->object->shapenr,
- .cd_mask_extra = CD_MASK_ORIGINDEX,
+ .use_shapekey = false,
+ .active_shapekey = 0,
+ /* XXX We probably can use CD_MASK_BAREMESH_ORIGDINDEX here instead (also for other modifiers cases)? */
+ .cd_mask_extra = {.vmask = CD_MASK_ORIGINDEX, .emask = CD_MASK_ORIGINDEX, .pmask = CD_MASK_ORIGINDEX},
});
if ((bmd->lim_flags & MOD_BEVEL_VGROUP) && bmd->defgrp_name[0])
@@ -187,21 +177,24 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
}
}
- BM_mesh_bevel(bm, bmd->value, offset_type, bmd->res, bmd->profile,
+ if (harden_normals && !(((Mesh *)ctx->object->data)->flag & ME_AUTOSMOOTH)) {
+ modifier_setError(md, "Enable 'Auto Smooth' option in mesh settings for hardening");
+ harden_normals = false;
+ }
+
+ BM_mesh_bevel(bm, value, offset_type, bmd->res, bmd->profile,
vertex_only, bmd->lim_flags & MOD_BEVEL_WEIGHT, do_clamp,
dvert, vgroup, mat, loop_slide, mark_seam, mark_sharp,
- harden_normals, face_strength_mode);
+ harden_normals, face_strength_mode,
+ miter_outer, miter_inner, spread, mesh->smoothresh);
- result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0);
+ result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL);
BLI_assert(bm->vtoolflagpool == NULL &&
bm->etoolflagpool == NULL &&
bm->ftoolflagpool == NULL); /* make sure we never alloc'd these */
BM_mesh_free(bm);
- if (bmd->clnordata.faceHash)
- BLI_ghash_free(bmd->clnordata.faceHash, NULL, NULL);
-
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
return result;
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 840cee6f630..a90ddde7946 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,45 +15,35 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_boolean.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
// #ifdef DEBUG_TIME
#include <stdio.h>
-#include "DNA_object_types.h"
-
#include "BLI_utildefines.h"
-#include "BLI_math_matrix.h"
-
-#include "BKE_library_query.h"
-#include "BKE_modifier.h"
-
-#include "MOD_util.h"
#include "BLI_alloca.h"
#include "BLI_math_geom.h"
+#include "BLI_math_matrix.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
#include "BKE_global.h" /* only to check G.debug */
#include "BKE_library.h"
+#include "BKE_library_query.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
+#include "BKE_modifier.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
+
+#include "MOD_util.h"
#include "DEG_depsgraph_query.h"
@@ -75,6 +63,7 @@ static void initData(ModifierData *md)
BooleanModifierData *bmd = (BooleanModifierData *)md;
bmd->double_threshold = 1e-6f;
+ bmd->operation = eBooleanModifierOp_Difference;
}
static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams))
@@ -101,7 +90,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_object_relation(ctx->node, bmd->object, DEG_OB_COMP_GEOMETRY, "Boolean Modifier");
}
/* We need own transformation as well. */
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Boolean Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Boolean Modifier");
}
static Mesh *get_quick_mesh(
@@ -122,12 +111,7 @@ static Mesh *get_quick_mesh(
result = mesh_self;
}
else {
- BKE_id_copy_ex(NULL, &mesh_other->id, (ID **)&result,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &mesh_other->id, (ID **)&result, LIB_ID_COPY_LOCALIZE);
float imat[4][4];
float omat[4][4];
@@ -174,14 +158,13 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
Mesh *result = mesh;
Mesh *mesh_other;
- bool mesh_other_free;
if (bmd->object == NULL) {
return result;
}
Object *other = DEG_get_evaluated_object(ctx->depsgraph, bmd->object);
- mesh_other = BKE_modifier_get_evaluated_mesh_from_evaluated_object(other, &mesh_other_free);
+ mesh_other = BKE_modifier_get_evaluated_mesh_from_evaluated_object(other, false);
if (mesh_other) {
Object *object = ctx->object;
@@ -318,7 +301,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
MEM_freeN(looptris);
}
- result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0);
+ result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL);
BM_mesh_free(bm);
@@ -335,20 +318,14 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
modifier_setError(md, "Cannot execute boolean operation");
}
- if (mesh_other != NULL && mesh_other_free) {
- BKE_id_free(NULL, mesh_other);
- }
-
return result;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md), CustomData_MeshMasks *r_cddata_masks)
{
- CustomDataMask dataMask = CD_MASK_MTFACE | CD_MASK_MEDGE;
-
- dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ r_cddata_masks->emask |= CD_MASK_MEDGE;
+ r_cddata_masks->fmask |= CD_MASK_MTFACE;
}
ModifierTypeInfo modifierType_Boolean = {
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index 77f607d19a2..e46c9aca5ce 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,27 +15,19 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_build.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
-#include "BLI_rand.h"
-#include "BLI_math_vector.h"
+
#include "BLI_ghash.h"
+#include "BLI_math_vector.h"
+#include "BLI_rand.h"
#include "DNA_meshdata_types.h"
#include "DNA_mesh_types.h"
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 59ffe11d614..f408a22aadf 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,20 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_cast.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
-#include "BLI_utildefines.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
@@ -77,15 +66,14 @@ static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool
return false;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
CastModifierData *cmd = (CastModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (cmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (cmd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static void foreachObjectLink(
@@ -102,7 +90,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
CastModifierData *cmd = (CastModifierData *)md;
if (cmd->object != NULL) {
DEG_add_object_relation(ctx->node, cmd->object, DEG_OB_COMP_TRANSFORM, "Cast Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Cast Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Cast Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 636c465d304..41f35faac1b 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,18 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_cloth.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <string.h>
+#include "BLI_utildefines.h"
+
+#include "BLI_listbase.h"
+
#include "DNA_cloth_types.h"
#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
@@ -42,9 +35,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_listbase.h"
-#include "BLI_utildefines.h"
-
#include "BKE_cloth.h"
#include "BKE_effect.h"
#include "BKE_global.h"
@@ -98,13 +88,7 @@ static void deformVerts(
else {
/* Not possible to use get_mesh() in this case as we'll modify its vertices
* and get_mesh() would return 'mesh' directly. */
- BKE_id_copy_ex(
- NULL, (ID *)mesh, (ID **)&mesh_src,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, (ID *)mesh, (ID **)&mesh_src, LIB_ID_COPY_LOCALIZE);
}
/* TODO(sergey): For now it actually duplicates logic from DerivedMesh.c
@@ -140,20 +124,20 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_collision_relations(ctx->node, ctx->object, clmd->coll_parms->group, eModifierType_Collision, NULL, "Cloth Collision");
DEG_add_forcefield_relations(ctx->node, ctx->object, clmd->sim_parms->effector_weights, true, 0, "Cloth Field");
}
+ DEG_add_modifier_to_transform_relation(ctx->node, "Cloth Modifier");
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
- CustomDataMask dataMask = 0;
ClothModifierData *clmd = (ClothModifierData *)md;
- if (cloth_uses_vgroup(clmd))
- dataMask |= CD_MASK_MDEFORMVERT;
-
- if (clmd->sim_parms->shapekey_rest != 0)
- dataMask |= CD_MASK_CLOTH_ORCO;
+ if (cloth_uses_vgroup(clmd)) {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
- return dataMask;
+ if (clmd->sim_parms->shapekey_rest != 0) {
+ r_cddata_masks->vmask |= CD_MASK_CLOTH_ORCO;
+ }
}
static void copyData(const ModifierData *md, ModifierData *target, const int flag)
@@ -201,8 +185,9 @@ static void freeData(ModifierData *md)
ClothModifierData *clmd = (ClothModifierData *) md;
if (clmd) {
- if (G.debug_value > 0)
+ if (G.debug & G_DEBUG_SIMDATA) {
printf("clothModifier_freeData\n");
+ }
cloth_free_modifier_extern(clmd);
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index 011635e3012..3e1fa4954fa 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,22 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_collision.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "MEM_guardedalloc.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "BKE_collision.h"
#include "BKE_global.h"
#include "BKE_library.h"
@@ -118,13 +108,7 @@ static void deformVerts(
else {
/* Not possible to use get_mesh() in this case as we'll modify its vertices
* and get_mesh() would return 'mesh' directly. */
- BKE_id_copy_ex(
- NULL, (ID *)mesh, (ID **)&mesh_src,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, (ID *)mesh, (ID **)&mesh_src, LIB_ID_COPY_LOCALIZE);
}
if (!ob->pd) {
@@ -141,8 +125,9 @@ static void deformVerts(
current_time = DEG_get_ctime(ctx->depsgraph);
- if (G.debug_value > 0)
+ if (G.debug & G_DEBUG_SIMDATA) {
printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew);
+ }
mvert_num = mesh_src->totvert;
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c
index 79702517991..cc6177b9bc8 100644
--- a/source/blender/modifiers/intern/MOD_correctivesmooth.c
+++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,23 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Jack Simpson,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_correctivesmooth.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*
* Method of smoothing deformation, also known as 'delta-mush'.
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_scene_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "MEM_guardedalloc.h"
#include "BKE_deform.h"
@@ -112,15 +105,14 @@ static void freeData(ModifierData *md)
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md;
- CustomDataMask dataMask = 0;
+
/* ask for vertex groups if we need them */
- if (csmd->defgrp_name[0]) {
- dataMask |= CD_MASK_MDEFORMVERT;
+ if (csmd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
}
- return dataMask;
}
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index fc33880e922..f3a5e280947 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,20 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_curve.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <string.h>
+#include "BLI_utildefines.h"
+
#include "DNA_mesh_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_editmesh.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
@@ -61,15 +50,14 @@ static void initData(ModifierData *md)
cmd->defaxis = MOD_CURVE_POSX;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
CurveModifierData *cmd = (CurveModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (cmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (cmd->name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static bool isDisabled(const Scene *UNUSED(scene), ModifierData *md, bool UNUSED(userRenderParams))
@@ -103,7 +91,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_special_eval_flag(ctx->node, &cmd->object->id, DAG_EVAL_NEED_CURVE_PATH);
}
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Curve Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Curve Modifier");
}
static void deformVerts(
diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c
index 6e823a8518a..3e461476eac 100644
--- a/source/blender/modifiers/intern/MOD_datatransfer.c
+++ b/source/blender/modifiers/intern/MOD_datatransfer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,14 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): None yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_datatransfer.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "BLI_utildefines.h"
+
#include "BLI_math.h"
#include "DNA_mesh_types.h"
@@ -81,19 +75,16 @@ static void initData(ModifierData *md)
dtmd->flags = MOD_DATATRANSFER_OBSRC_TRANSFORM;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
DataTransferModifierData *dtmd = (DataTransferModifierData *) md;
- CustomDataMask dataMask = 0;
- if (dtmd->defgrp_name[0]) {
+ if (dtmd->defgrp_name[0] != '\0') {
/* We need vertex groups! */
- dataMask |= CD_MASK_MDEFORMVERT;
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
}
- dataMask |= BKE_object_data_transfer_dttypes_to_cdmask(dtmd->data_types);
-
- return dataMask;
+ BKE_object_data_transfer_dttypes_to_cdmask(dtmd->data_types, r_cddata_masks);
}
static bool dependsOnNormals(ModifierData *md)
@@ -129,14 +120,15 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
{
DataTransferModifierData *dtmd = (DataTransferModifierData *) md;
if (dtmd->ob_source != NULL) {
- CustomDataMask mask = BKE_object_data_transfer_dttypes_to_cdmask(dtmd->data_types);
+ CustomData_MeshMasks cddata_masks = {0};
+ BKE_object_data_transfer_dttypes_to_cdmask(dtmd->data_types, &cddata_masks);
DEG_add_object_relation(ctx->node, dtmd->ob_source, DEG_OB_COMP_GEOMETRY, "DataTransfer Modifier");
- DEG_add_customdata_mask(ctx->node, dtmd->ob_source, mask);
+ DEG_add_customdata_mask(ctx->node, dtmd->ob_source, &cddata_masks);
if (dtmd->flags & MOD_DATATRANSFER_OBSRC_TRANSFORM) {
DEG_add_object_relation(ctx->node, dtmd->ob_source, DEG_OB_COMP_TRANSFORM, "DataTransfer Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "DataTransfer Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "DataTransfer Modifier");
}
}
}
@@ -184,13 +176,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
{
/* We need to duplicate data here, otherwise setting custom normals, edges' shaprness, etc., could
* modify org mesh, see T43671. */
- BKE_id_copy_ex(
- NULL, &me_mod->id, (ID **)&result,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &me_mod->id, (ID **)&result, LIB_ID_COPY_LOCALIZE);
}
BKE_reports_init(&reports, RPT_STORE);
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index fff94e0d836..0ca6111c41a 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,33 +15,24 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_decimate.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "MEM_guardedalloc.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
-#include "BKE_library.h"
#include "DEG_depsgraph_query.h"
@@ -68,17 +57,14 @@ static void initData(ModifierData *md)
dmd->defgrp_factor = 1.0;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
DecimateModifierData *dmd = (DecimateModifierData *) md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (dmd->defgrp_name[0] && (dmd->defgrp_factor > 0.0f)) {
- dataMask |= CD_MASK_MDEFORMVERT;
+ if (dmd->defgrp_name[0] != '\0' && (dmd->defgrp_factor > 0.0f)) {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
}
-
- return dataMask;
}
static DecimateModifierData *getOriginalModifierData(
@@ -89,8 +75,10 @@ static DecimateModifierData *getOriginalModifierData(
}
static void updateFaceCount(
- const ModifierEvalContext *ctx, const DecimateModifierData *dmd, int face_count)
+ const ModifierEvalContext *ctx, DecimateModifierData *dmd, int face_count)
{
+ dmd->face_count = face_count;
+
if (DEG_is_active(ctx->depsgraph)) {
/* update for display only */
DecimateModifierData *dmd_orig = getOriginalModifierData(dmd, ctx);
@@ -175,7 +163,7 @@ static Mesh *applyModifier(
&(struct BMeshCreateParams){0},
&(struct BMeshFromMeshParams){
.calc_face_normal = calc_face_normal,
- .cd_mask_extra = CD_MASK_ORIGINDEX,
+ .cd_mask_extra = {.vmask = CD_MASK_ORIGINDEX, .emask = CD_MASK_ORIGINDEX, .pmask = CD_MASK_ORIGINDEX},
});
switch (dmd->mode) {
@@ -208,7 +196,7 @@ static Mesh *applyModifier(
updateFaceCount(ctx, dmd, bm->totface);
- result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0);
+ result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL);
BLI_assert(bm->vtoolflagpool == NULL &&
bm->etoolflagpool == NULL &&
bm->ftoolflagpool == NULL); /* make sure we never alloc'd these */
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 7cad6af6d34..87b25982d81 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,22 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_displace.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-
#include "BLI_utildefines.h"
+
#include "BLI_math.h"
#include "BLI_task.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+
#include "BKE_customdata.h"
#include "BKE_editmesh.h"
#include "BKE_library.h"
@@ -75,22 +65,23 @@ static void initData(ModifierData *md)
dmd->space = MOD_DISP_SPACE_LOCAL;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
DisplaceModifierData *dmd = (DisplaceModifierData *)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] != '\0') {
+ r_cddata_masks->vmask |= 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) {
+ r_cddata_masks->fmask |= CD_MASK_MTFACE;
+ }
if (dmd->direction == MOD_DISP_DIR_CLNOR) {
- dataMask |= CD_MASK_CUSTOMLOOPNORMAL;
+ r_cddata_masks->lmask |= CD_MASK_CUSTOMLOOPNORMAL;
}
-
- return dataMask;
}
static bool dependsOnTime(ModifierData *md)
@@ -148,14 +139,14 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
{
DisplaceModifierData *dmd = (DisplaceModifierData *)md;
if (dmd->map_object != NULL && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Displace Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Displace Modifier");
DEG_add_object_relation(ctx->node, dmd->map_object, DEG_OB_COMP_TRANSFORM, "Displace Modifier");
}
if (dmd->texmapping == MOD_DISP_MAP_GLOBAL ||
(ELEM(dmd->direction, MOD_DISP_DIR_X, MOD_DISP_DIR_Y, MOD_DISP_DIR_Z, MOD_DISP_DIR_RGB_XYZ) &&
dmd->space == MOD_DISP_SPACE_GLOBAL))
{
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Displace Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Displace Modifier");
}
if (dmd->texture != NULL) {
DEG_add_generic_id_relation(ctx->node, &dmd->texture->id, "Displace Modifier");
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index c23a65ec23c..b84e46e145c 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,30 +12,24 @@
* 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/modifiers/intern/MOD_dynamicpaint.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stddef.h>
+#include "BLI_utildefines.h"
+
#include "DNA_dynamicpaint_types.h"
#include "DNA_object_types.h"
#include "DNA_object_force_types.h"
#include "DNA_scene_types.h"
#include "DNA_mesh_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_dynamicpaint.h"
#include "BKE_layer.h"
-#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
@@ -72,10 +64,9 @@ static void freeData(ModifierData *md)
dynamicPaint_Modifier_free(pmd);
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
- CustomDataMask dataMask = 0;
if (pmd->canvas) {
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
@@ -84,21 +75,20 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ ||
surface->init_color_type == MOD_DPAINT_INITIAL_TEXTURE)
{
- dataMask |= CD_MASK_MLOOPUV;
+ r_cddata_masks->lmask |= CD_MASK_MLOOPUV;
}
/* mcol */
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT ||
surface->init_color_type == MOD_DPAINT_INITIAL_VERTEXCOLOR)
{
- dataMask |= CD_MASK_MLOOPCOL;
+ r_cddata_masks->lmask |= CD_MASK_MLOOPCOL;
}
/* CD_MDEFORMVERT */
if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
- dataMask |= CD_MASK_MDEFORMVERT;
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
}
}
}
- return dataMask;
}
static Mesh *applyModifier(
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 8db8da3fc81..a7b980494b3 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,10 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_edgesplit.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*
* EdgeSplit modifier
*
@@ -38,21 +27,21 @@
*/
#include "BLI_utildefines.h"
+
#include "BLI_math.h"
-#include "BKE_library.h"
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "bmesh.h"
#include "bmesh_tools.h"
-#include "DNA_mesh_types.h"
-#include "DNA_object_types.h"
-
#include "MOD_modifiertypes.h"
-static Mesh *doEdgeSplit(Mesh *mesh, EdgeSplitModifierData *emd, const ModifierEvalContext *ctx)
+static Mesh *doEdgeSplit(Mesh *mesh, EdgeSplitModifierData *emd)
{
Mesh *result;
BMesh *bm;
@@ -69,9 +58,9 @@ static Mesh *doEdgeSplit(Mesh *mesh, EdgeSplitModifierData *emd, const ModifierE
&(struct BMeshFromMeshParams){
.calc_face_normal = calc_face_normals,
.add_key_index = false,
- .use_shapekey = true,
- .active_shapekey = ctx->object->shapenr,
- .cd_mask_extra = CD_MASK_ORIGINDEX,
+ .use_shapekey = false,
+ .active_shapekey = 0,
+ .cd_mask_extra = {.vmask = CD_MASK_ORIGINDEX, .emask = CD_MASK_ORIGINDEX, .pmask = CD_MASK_ORIGINDEX},
});
if (do_split_angle) {
@@ -111,7 +100,7 @@ static Mesh *doEdgeSplit(Mesh *mesh, EdgeSplitModifierData *emd, const ModifierE
/* BM_mesh_validate(bm); */ /* for troubleshooting */
- result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0);
+ result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL);
BM_mesh_free(bm);
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
@@ -129,7 +118,7 @@ static void initData(ModifierData *md)
static Mesh *applyModifier(
ModifierData *md,
- const ModifierEvalContext *ctx,
+ const ModifierEvalContext *UNUSED(ctx),
Mesh *mesh)
{
Mesh *result;
@@ -138,7 +127,7 @@ static Mesh *applyModifier(
if (!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG)))
return mesh;
- result = doEdgeSplit(mesh, emd, ctx);
+ result = doEdgeSplit(mesh, emd);
return result;
}
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index f736e44a4cf..3a0449a4e52 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,33 +15,25 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_explode.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_edgehash.h"
+#include "BLI_kdtree.h"
+#include "BLI_math.h"
+#include "BLI_rand.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
-#include "BLI_utildefines.h"
-#include "BLI_kdtree.h"
-#include "BLI_rand.h"
-#include "BLI_math.h"
-#include "BLI_edgehash.h"
-
#include "BKE_deform.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
@@ -86,15 +76,13 @@ static bool dependsOnTime(ModifierData *UNUSED(md))
{
return true;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
ExplodeModifierData *emd = (ExplodeModifierData *) md;
- CustomDataMask dataMask = 0;
-
- if (emd->vgroup)
- dataMask |= CD_MASK_MDEFORMVERT;
- return dataMask;
+ if (emd->vgroup) {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static void createFacepa(
@@ -214,7 +202,7 @@ static const short add_faces[24] = {
0,
0, 0, 2, 0, 1, 2, 2, 0, 2, 1,
2, 2, 2, 2, 3, 0, 0, 0, 1, 0,
- 1, 1, 2
+ 1, 1, 2,
};
static MFace *get_dface(Mesh *mesh, Mesh *split, int cur, int i, MFace *mf)
diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c
index 8b6f25ab0ab..d4bac71f677 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,20 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_fluidsim.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
#include "DNA_mesh_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_fluidsim_types.h"
#include "DNA_object_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_layer.h"
#include "BKE_modifier.h"
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 23a62f88f77..f548eb78abd 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,42 +15,35 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_fluidsim_util.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stddef.h>
#include <zlib.h>
+#include "BLI_utildefines.h"
+
+#ifdef WITH_MOD_FLUID
+# include "BLI_blenlib.h"
+# include "BLI_math.h"
+#endif
+
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_fluidsim_types.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "BKE_fluidsim.h" /* ensure definitions here match */
+#include "BKE_mesh.h"
#ifdef WITH_MOD_FLUID
# include "BKE_global.h"
+# include "BKE_library.h"
#endif
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.h b/source/blender/modifiers/intern/MOD_fluidsim_util.h
index 4bb745fbd66..7673ec7f6b0 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.h
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,27 +15,21 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/modifiers/intern/MOD_fluidsim_util.h
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#ifndef __MOD_FLUIDSIM_UTIL_H__
#define __MOD_FLUIDSIM_UTIL_H__
-struct Object;
-struct Scene;
struct FluidsimModifierData;
struct Mesh;
struct ModifierEvalContext;
+struct Object;
+struct Scene;
/* new fluid-modifier interface */
void fluidsim_init(struct FluidsimModifierData *fluidmd);
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 24400b5a309..e911dbc4b5a 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,21 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_hook.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "BKE_action.h"
#include "BKE_editmesh.h"
#include "BKE_library.h"
@@ -77,16 +67,20 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
thmd->indexar = MEM_dupallocN(hmd->indexar);
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
HookModifierData *hmd = (HookModifierData *)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;
-
- return dataMask;
+ if (hmd->name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
+ if (hmd->indexar != NULL) {
+ /* TODO check which origindex are actually needed? */
+ r_cddata_masks->vmask |= CD_MASK_ORIGINDEX;
+ r_cddata_masks->emask |= CD_MASK_ORIGINDEX;
+ r_cddata_masks->pmask |= CD_MASK_ORIGINDEX;
+ }
}
static void freeData(ModifierData *md)
@@ -124,7 +118,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_object_relation(ctx->node, hmd->object, DEG_OB_COMP_TRANSFORM, "Hook Modifier");
}
/* We need own transformation as well. */
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Hook Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Hook Modifier");
}
struct HookData_cb {
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index ba45e6bf848..db76b0fd0c2 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,24 +15,23 @@
*
* The Original Code is Copyright (C) 2013 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Alexander Pinzon Fernandez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_laplaciandeform.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "BLI_utildefines.h"
-#include "BLI_utildefines_stack.h"
+
#include "BLI_math.h"
#include "BLI_string.h"
+#include "BLI_utildefines_stack.h"
#include "MEM_guardedalloc.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_library.h"
@@ -42,9 +39,6 @@
#include "BKE_mesh_runtime.h"
#include "BKE_particle.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-
#include "MOD_util.h"
#include "eigen_capi.h"
@@ -722,12 +716,13 @@ static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool
return 1;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md;
- CustomDataMask dataMask = 0;
- if (lmd->anchor_grp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
- return dataMask;
+
+ if (lmd->anchor_grp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static void deformVerts(
diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
index 1acec1d8b7a..a6670f313ce 100644
--- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c
+++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,21 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Alexander Pinzon
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_laplaciansmooth.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "MEM_guardedalloc.h"
#include "BKE_deform.h"
@@ -48,11 +42,6 @@
#include "eigen_capi.h"
-#if 0
-#define MOD_LAPLACIANSMOOTH_MAX_EDGE_PERCENTAGE 1.8f
-#define MOD_LAPLACIANSMOOTH_MIN_EDGE_PERCENTAGE 0.02f
-#endif
-
struct BLaplacianSystem {
float *eweights; /* Length weights per Edge */
float (*fweights)[3]; /* Cotangent weights per face */
@@ -80,7 +69,7 @@ struct BLaplacianSystem {
};
typedef struct BLaplacianSystem LaplacianSystem;
-static CustomDataMask required_data_mask(Object *ob, ModifierData *md);
+static void required_data_mask(Object *ob, ModifierData *md, CustomData_MeshMasks *r_cddata_masks);
static bool is_disabled(const struct Scene *UNUSED(scene), ModifierData *md, bool useRenderParams);
static float compute_volume(const float center[3], float (*vertexCos)[3], const MPoly *mpoly, int numPolys, const MLoop *mloop);
static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numPolys, int a_numLoops, int a_numVerts);
@@ -487,15 +476,14 @@ static bool is_disabled(const struct Scene *UNUSED(scene), ModifierData *md, boo
return 0;
}
-static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md)
+static void required_data_mask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (smd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static void deformVerts(
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index 9fbd4629629..46a9c4f0a47 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,19 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_lattice.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <string.h>
-#include "DNA_object_types.h"
-
#include "BLI_utildefines.h"
+#include "DNA_object_types.h"
+
#include "BKE_editmesh.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
@@ -58,15 +47,14 @@ static void initData(ModifierData *md)
lmd->strength = 1.0f;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
LatticeModifierData *lmd = (LatticeModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (lmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (lmd->name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(userRenderParams))
@@ -92,7 +80,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Lattice Modifier");
DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
}
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Lattice Modifier");
}
static void deformVerts(
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index 555fe29978f..6d8317ffe77 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,17 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_mask.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
+
#include "BLI_listbase.h"
#include "BLI_ghash.h"
@@ -47,7 +37,6 @@
#include "BKE_action.h" /* BKE_pose_channel_find_name */
#include "BKE_customdata.h"
-#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
@@ -60,9 +49,9 @@
#include "BLI_strict_flags.h"
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md), CustomData_MeshMasks *r_cddata_masks)
{
- return CD_MASK_MDEFORMVERT;
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
}
static void foreachObjectLink(
@@ -82,7 +71,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
/* TODO(sergey): Is it a proper relation here? */
DEG_add_object_relation(ctx->node, mmd->ob_arm, DEG_OB_COMP_TRANSFORM, "Mask Modifier");
arm->flag |= ARM_HAS_VIZ_DEPS;
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Mask Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Mask Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c
index e3aa239a713..0ecd56372c7 100644
--- a/source/blender/modifiers/intern/MOD_meshcache.c
+++ b/source/blender/modifiers/intern/MOD_meshcache.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,30 +12,25 @@
* 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 *****
*/
-/** \file blender/modifiers/intern/MOD_meshcache.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
-#include "BLI_utildefines.h"
-#include "BLI_string.h"
-#include "BLI_path_util.h"
-#include "BLI_math.h"
-
-#include "BKE_global.h"
-#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_scene.h"
diff --git a/source/blender/modifiers/intern/MOD_meshcache_mdd.c b/source/blender/modifiers/intern/MOD_meshcache_mdd.c
index f0278c409e5..bd99248eec4 100644
--- a/source/blender/modifiers/intern/MOD_meshcache_mdd.c
+++ b/source/blender/modifiers/intern/MOD_meshcache_mdd.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,22 +12,18 @@
* 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, pkowal
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/modifiers/intern/MOD_meshcache_mdd.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include "BLI_sys_types.h"
#include "BLI_utildefines.h"
+
#include "BLI_fileops.h"
#include "BLI_math.h"
#ifdef __LITTLE_ENDIAN__
@@ -39,10 +33,10 @@
# include "BLI_winstuff.h"
#endif
-#include "MOD_meshcache_util.h" /* own include */
-
#include "DNA_modifier_types.h"
+#include "MOD_meshcache_util.h" /* own include */
+
typedef struct MDDHead {
int frame_tot;
int verts_tot;
diff --git a/source/blender/modifiers/intern/MOD_meshcache_pc2.c b/source/blender/modifiers/intern/MOD_meshcache_pc2.c
index 3503ce3ef7a..e19a967cca7 100644
--- a/source/blender/modifiers/intern/MOD_meshcache_pc2.c
+++ b/source/blender/modifiers/intern/MOD_meshcache_pc2.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,22 +12,18 @@
* 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 *****
*/
-/** \file blender/modifiers/intern/MOD_meshcache_pc2.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include "BLI_sys_types.h"
#include "BLI_utildefines.h"
+
#include "BLI_fileops.h"
#ifdef __BIG_ENDIAN__
# include "BLI_endian_switch.h"
@@ -39,10 +33,10 @@
# include "BLI_winstuff.h"
#endif
-#include "MOD_meshcache_util.h" /* own include */
-
#include "DNA_modifier_types.h"
+#include "MOD_meshcache_util.h" /* own include */
+
typedef struct PC2Head {
char header[12]; /* 'POINTCACHE2\0' */
int file_version; /* unused - should be 1 */
diff --git a/source/blender/modifiers/intern/MOD_meshcache_util.c b/source/blender/modifiers/intern/MOD_meshcache_util.c
index f2e12e7749e..2db46af1188 100644
--- a/source/blender/modifiers/intern/MOD_meshcache_util.c
+++ b/source/blender/modifiers/intern/MOD_meshcache_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,14 @@
* 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 *****
*/
-/** \file blender/modifiers/intern/MOD_meshcache_util.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "BLI_utildefines.h"
+
#include "BLI_math.h"
#include "DNA_modifier_types.h"
diff --git a/source/blender/modifiers/intern/MOD_meshcache_util.h b/source/blender/modifiers/intern/MOD_meshcache_util.h
index 8cf13037d78..a177ea467e7 100644
--- a/source/blender/modifiers/intern/MOD_meshcache_util.h
+++ b/source/blender/modifiers/intern/MOD_meshcache_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/modifiers/intern/MOD_meshcache_util.h
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#ifndef __MOD_MESHCACHE_UTIL_H__
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index ae027c64626..e59a6ae9add 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,22 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_meshdeform.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+#include "BLI_task.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_math.h"
-#include "BLI_task.h"
-#include "BLI_utildefines.h"
-
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
@@ -99,15 +89,14 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
if (mmd->bindcos) tmmd->bindcos = MEM_dupallocN(mmd->bindcos); /* deprecated */
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
MeshDeformModifierData *mmd = (MeshDeformModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (mmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (mmd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams))
@@ -291,7 +280,6 @@ static void meshdeformModifier_do(
int a, totvert, totcagevert, defgrp_index;
float (*cagecos)[3] = NULL;
MeshdeformUserdata data;
- bool free_cagemesh = false;
static int recursive_bind_sentinel = 0;
@@ -309,12 +297,12 @@ static void meshdeformModifier_do(
* We'll support this case once granular dependency graph is landed.
*/
Object *ob_target = DEG_get_evaluated_object(ctx->depsgraph, mmd->object);
- cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, &free_cagemesh);
+ cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false);
#if 0 /* This shall not be needed if we always get evaluated target object... */
if (cagemesh == NULL && mmd->bindcagecos == NULL && ob == DEG_get_original_object(ob)) {
/* Special case, binding happens outside of depsgraph evaluation, so we can build our own
* target mesh if needed. */
- cagemesh = mesh_create_eval_final_view(ctx->depsgraph, DEG_get_input_scene(ctx->depsgraph), mmd->object, 0);
+ cagemesh = mesh_create_eval_final_view(ctx->depsgraph, DEG_get_input_scene(ctx->depsgraph), mmd->object, &CD_MASK_BAREMESH);
free_cagemesh = cagemesh != NULL;
}
#endif
@@ -411,9 +399,6 @@ static void meshdeformModifier_do(
finally:
MEM_SAFE_FREE(dco);
MEM_SAFE_FREE(cagecos);
- if (cagemesh != NULL && free_cagemesh) {
- BKE_id_free(NULL, cagemesh);
- }
}
static void deformVerts(
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index f0cdd2b2899..d17f343a1ec 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/modifiers/intern/MOD_meshsequencecache.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "DNA_cachefile_types.h"
@@ -32,7 +26,6 @@
#include "DNA_scene_types.h"
#include "BKE_cachefile.h"
-#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_scene.h"
@@ -44,6 +37,7 @@
#ifdef WITH_ALEMBIC
# include "ABC_alembic.h"
# include "BKE_global.h"
+# include "BKE_library.h"
#endif
static void initData(ModifierData *md)
@@ -128,8 +122,7 @@ static Mesh *applyModifier(
LIB_ID_CREATE_NO_MAIN |
LIB_ID_CREATE_NO_USER_REFCOUNT |
LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ LIB_ID_COPY_NO_PREVIEW);
}
}
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index ae3f28ab764..c46445471df 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,19 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_mirror.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_math.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "BLI_math.h"
-
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_mesh.h"
@@ -78,24 +67,23 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
MirrorModifierData *mmd = (MirrorModifierData *)md;
if (mmd->mirror_ob != NULL) {
DEG_add_object_relation(ctx->node, mmd->mirror_ob, DEG_OB_COMP_TRANSFORM, "Mirror Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Mirror Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Mirror Modifier");
}
}
static Mesh *doBiscetOnMirrorPlane(
MirrorModifierData *mmd,
- Object *ob,
const Mesh *mesh,
- Object *mirror_ob,
int axis,
- float mirrormat[4][4])
+ float plane_co[3],
+ float plane_no[3])
{
bool do_bisect_flip_axis = (
(axis == 0 && mmd->flag & MOD_MIR_BISECT_FLIP_AXIS_X) ||
(axis == 1 && mmd->flag & MOD_MIR_BISECT_FLIP_AXIS_Y) ||
(axis == 2 && mmd->flag & MOD_MIR_BISECT_FLIP_AXIS_Z));
- const float bisect_distance = 0.001;
+ const float bisect_distance = 0.001f;
Mesh *result;
BMesh *bm;
@@ -103,28 +91,21 @@ static Mesh *doBiscetOnMirrorPlane(
BMVert *v, *v_next;
bm = BKE_mesh_to_bmesh_ex(
- mesh,
- &(struct BMeshCreateParams){0},
- &(struct BMeshFromMeshParams){
- .calc_face_normal = true,
- .cd_mask_extra = CD_MASK_ORIGINDEX,
- });
-
- /* prepare data for bisecting */
+ mesh,
+ &(struct BMeshCreateParams){0},
+ &(struct BMeshFromMeshParams){
+ .calc_face_normal = true,
+ .cd_mask_extra = {.vmask = CD_MASK_ORIGINDEX, .emask = CD_MASK_ORIGINDEX, .pmask = CD_MASK_ORIGINDEX},
+ });
+
+ /* Define bisecting plane (aka mirror plane). */
float plane[4];
- float plane_co[3] = {0, 0, 0};
- float plane_no[3];
- copy_v3_v3(plane_no, mirrormat[axis]);
-
- if (mirror_ob != NULL) {
- float tmp[4][4];
- invert_m4_m4(tmp, ob->obmat);
- mul_m4_m4m4(tmp, tmp, mirror_ob->obmat);
-
- copy_v3_v3(plane_no, tmp[axis]);
- copy_v3_v3(plane_co, tmp[3]);
+ if (!do_bisect_flip_axis) {
+ /* That reversed condition is a tad weird, but for some reason that's how you keep
+ * the part of the mesh which is on the non-mirrored side when flip option is disabled,
+ * think that that is the expected behavior. */
+ negate_v3(plane_no);
}
-
plane_from_point_normal_v3(plane, plane_co, plane_no);
BM_mesh_bisect_plane(bm, plane, false, false, 0, 0, bisect_distance);
@@ -134,10 +115,6 @@ static Mesh *doBiscetOnMirrorPlane(
copy_v3_v3(plane_offset, plane);
plane_offset[3] = plane[3] - bisect_distance;
- if (do_bisect_flip_axis) {
- negate_v3(plane_offset);
- }
-
/* Delete verts across the mirror plane. */
BM_ITER_MESH_MUTABLE(v, v_next, &viter, bm, BM_VERTS_OF_MESH) {
if (plane_point_side_v3(plane_offset, v->co) > 0.0f) {
@@ -145,7 +122,7 @@ static Mesh *doBiscetOnMirrorPlane(
}
}
- result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0);
+ result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL);
BM_mesh_free(bm);
return result;
@@ -173,6 +150,7 @@ static Mesh *doMirrorOnAxis(
MLoop *ml;
MPoly *mp;
float mtx[4][4];
+ float plane_co[3], plane_no[3];
int i;
int a, totshape;
int *vtargetmap = NULL, *vtmap_a = NULL, *vtmap_b = NULL;
@@ -197,14 +175,22 @@ static Mesh *doMirrorOnAxis(
/* combine matrices to get a single matrix that translates coordinates into
* mirror-object-relative space, does the mirror, and translates back to
* origin-relative space */
- mul_m4_m4m4(mtx, mtx, tmp);
- mul_m4_m4m4(mtx, itmp, mtx);
- }
+ mul_m4_series(mtx, itmp, mtx, tmp);
+ if (do_bisect) {
+ copy_v3_v3(plane_co, itmp[3]);
+ copy_v3_v3(plane_no, itmp[axis]);
+ }
+ }
+ else if (do_bisect) {
+ copy_v3_v3(plane_co, mtx[3]);
+ /* Need to negate here, since that axis is inverted (for mirror transform). */
+ negate_v3_v3(plane_no, mtx[axis]);
+ }
Mesh *mesh_bisect = NULL;
if (do_bisect) {
- mesh_bisect = doBiscetOnMirrorPlane(mmd, ob, mesh, mirror_ob, axis, mtx);
+ mesh_bisect = doBiscetOnMirrorPlane(mmd, mesh, axis, plane_co, plane_no);
mesh = mesh_bisect;
}
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index fc8a376d2d7..7cd9dfa05aa 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,35 +15,26 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_multires.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stddef.h>
+#include "BLI_utildefines.h"
+
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_cdderivedmesh.h"
-#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_multires.h"
#include "BKE_modifier.h"
+#include "BKE_paint.h"
#include "BKE_subdiv.h"
#include "BKE_subdiv_ccg.h"
#include "BKE_subdiv_mesh.h"
@@ -67,6 +56,35 @@ static void initData(ModifierData *md)
mmd->quality = 3;
}
+static void copyData(const ModifierData *md_src, ModifierData *md_dst, const int flag)
+{
+ MultiresModifierData *mmd_dst = (MultiresModifierData *)md_dst;
+
+ modifier_copyData_generic(md_src, md_dst, flag);
+
+ mmd_dst->subdiv = NULL;
+}
+
+static void freeData(ModifierData *md)
+{
+ MultiresModifierData *mmd = (MultiresModifierData *) md;
+ if (mmd->subdiv != NULL) {
+ BKE_subdiv_free(mmd->subdiv);
+ }
+}
+
+/* Main goal of this function is to give usable subdivision surface descriptor
+ * which matches settings and topology. */
+static Subdiv *subdiv_descriptor_ensure(MultiresModifierData *mmd,
+ const SubdivSettings *subdiv_settings,
+ const Mesh *mesh)
+{
+ Subdiv *subdiv = BKE_subdiv_update_from_mesh(
+ mmd->subdiv, subdiv_settings, mesh);
+ mmd->subdiv = subdiv;
+ return subdiv;
+}
+
/* Subdivide into fully qualified mesh. */
static Mesh *multires_as_mesh(MultiresModifierData *mmd,
@@ -137,28 +155,40 @@ static Mesh *applyModifier(ModifierData *md,
if (subdiv_settings.level == 0) {
return result;
}
- /* TODO(sergey): Try to re-use subdiv when possible. */
- Subdiv *subdiv = BKE_subdiv_new_from_mesh(&subdiv_settings, mesh);
+ BKE_subdiv_settings_validate_for_mesh(&subdiv_settings, mesh);
+ Subdiv *subdiv = subdiv_descriptor_ensure(mmd, &subdiv_settings, mesh);
if (subdiv == NULL) {
/* Happens on bad topology, ut also on empty input mesh. */
return result;
}
/* NOTE: Orco needs final coordinates on CPU side, which are expected to be
* accessible via MVert. For this reason we do not evaluate multires to
- * grids when orco is requested.
- */
+ * grids when orco is requested. */
const bool for_orco = (ctx->flag & MOD_APPLY_ORCO) != 0;
if ((ctx->object->mode & OB_MODE_SCULPT) && !for_orco) {
/* NOTE: CCG takes ownership over Subdiv. */
result = multires_as_ccg(mmd, ctx, mesh, subdiv);
result->runtime.subdiv_ccg_tot_level = mmd->totlvl;
+ /* TODO(sergey): Usually it is sculpt stroke's update variants which
+ * takes care of this, but is possible that we need this before the
+ * stroke: i.e. when exiting blender right after stroke is done.
+ * Annoying and not so much black-boxed as far as sculpting goes, and
+ * surely there is a better way of solving this. */
+ if (ctx->object->sculpt != NULL) {
+ ctx->object->sculpt->subdiv_ccg = result->runtime.subdiv_ccg;
+ }
+ /* NOTE: CCG becomes an owner of Subdiv descriptor, so can not share
+ * this pointer. Not sure if it's needed, but might have a second look
+ * on the ownership model here. */
+ mmd->subdiv = NULL;
// BKE_subdiv_stats_print(&subdiv->stats);
}
else {
result = multires_as_mesh(mmd, ctx, mesh, subdiv);
- /* TODO(sergey): Cache subdiv somehow. */
// BKE_subdiv_stats_print(&subdiv->stats);
- BKE_subdiv_free(subdiv);
+ if (subdiv != mmd->subdiv) {
+ BKE_subdiv_free(subdiv);
+ }
}
return result;
}
@@ -172,7 +202,7 @@ ModifierTypeInfo modifierType_Multires = {
eModifierTypeFlag_SupportsMapping |
eModifierTypeFlag_RequiresOriginalData,
- /* copyData */ modifier_copyData_generic,
+ /* copyData */ copyData,
/* deformVerts_DM */ NULL,
/* deformMatrices_DM */ NULL,
@@ -188,7 +218,7 @@ ModifierTypeInfo modifierType_Multires = {
/* initData */ initData,
/* requiredDataMask */ NULL,
- /* freeData */ NULL,
+ /* freeData */ freeData,
/* isDisabled */ NULL,
/* updateDepsgraph */ NULL,
/* dependsOnTime */ NULL,
diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c
index 3946782b5ef..781e52fc426 100644
--- a/source/blender/modifiers/intern/MOD_none.c
+++ b/source/blender/modifiers/intern/MOD_none.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/modifiers/intern/MOD_none.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c
index 5e5621ae717..d838d203ed5 100644
--- a/source/blender/modifiers/intern/MOD_normal_edit.c
+++ b/source/blender/modifiers/intern/MOD_normal_edit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,29 +12,25 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_normal_edit.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <string.h>
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
+#include "BLI_bitmap.h"
+#include "BLI_math.h"
+
#include "DNA_object_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_mesh_types.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-#include "BLI_bitmap.h"
-
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_mesh.h"
@@ -68,8 +62,11 @@ static void generate_vert_coordinates(
/* Get size (i.e. deformation of the spheroid generating normals), either from target object, or own geometry. */
if (r_size != NULL) {
if (ob_center != NULL) {
+ /* Using 'scale' as 'size' here. The input object is typically an empty
+ * who's scale is used to define an ellipsoid instead of a simple sphere. */
+
/* Not we are not interested in signs here - they are even troublesome actually, due to security clamping! */
- abs_v3_v3(r_size, ob_center->size);
+ abs_v3_v3(r_size, ob_center->scale);
}
else {
/* Set size. */
@@ -418,13 +415,7 @@ static Mesh *normalEditModifier_do(
if (mesh->medge == ((Mesh *)ob->data)->medge) {
/* We need to duplicate data here, otherwise setting custom normals (which may also affect sharp edges) could
* modify org mesh, see T43671. */
- BKE_id_copy_ex(
- NULL, &mesh->id, (ID **)&result,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &mesh->id, (ID **)&result, LIB_ID_COPY_LOCALIZE);
}
else {
result = mesh;
@@ -508,17 +499,16 @@ static void initData(ModifierData *md)
enmd->mix_limit = M_PI;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
NormalEditModifierData *enmd = (NormalEditModifierData *)md;
- CustomDataMask dataMask = CD_MASK_CUSTOMLOOPNORMAL;
+
+ r_cddata_masks->lmask |= CD_MASK_CUSTOMLOOPNORMAL;
/* Ask for vertexgroups if we need them. */
- if (enmd->defgrp_name[0]) {
- dataMask |= (CD_MASK_MDEFORMVERT);
+ if (enmd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
}
-
- return dataMask;
}
static bool dependsOnNormals(ModifierData *UNUSED(md))
@@ -545,7 +535,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
NormalEditModifierData *enmd = (NormalEditModifierData *) md;
if (enmd->target) {
DEG_add_object_relation(ctx->node, enmd->target, DEG_OB_COMP_TRANSFORM, "NormalEdit Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "NormalEdit Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "NormalEdit Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index 8231745aa12..50ec32bd605 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,18 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Matt Ebb
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/modifiers/intern/MOD_ocean.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+#include "BLI_math_inline.h"
+#include "BLI_task.h"
+
#include "DNA_customdata_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
@@ -36,14 +34,7 @@
#include "DNA_modifier_types.h"
#include "DNA_scene_types.h"
-#include "BLI_math.h"
-#include "BLI_math_inline.h"
-#include "BLI_task.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_global.h"
#include "BKE_library.h"
-#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_ocean.h"
@@ -159,22 +150,17 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
}
#ifdef WITH_OCEANSIM
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
OceanModifierData *omd = (OceanModifierData *)md;
- CustomDataMask dataMask = 0;
- if (omd->flag & MOD_OCEAN_GENERATE_FOAM)
- dataMask |= CD_MASK_MCOL;
-
- return dataMask;
+ if (omd->flag & MOD_OCEAN_GENERATE_FOAM) {
+ r_cddata_masks->fmask |= CD_MASK_MCOL; /* XXX Should be loop cddata I guess? */
+ }
}
#else /* WITH_OCEANSIM */
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md), CustomData_MeshMasks *UNUSED(r_cddata_masks))
{
- /* unused */
- (void)md;
- return 0;
}
#endif /* WITH_OCEANSIM */
@@ -394,12 +380,7 @@ static Mesh *doOcean(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mes
BKE_mesh_ensure_normals(result);
}
else if (omd->geometry_mode == MOD_OCEAN_GEOM_DISPLACE) {
- BKE_id_copy_ex(NULL, &mesh->id, (ID **)&result,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &mesh->id, (ID **)&result, LIB_ID_COPY_LOCALIZE);
}
cfra_for_cache = cfra_scene;
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index fa305f4c8a7..a9d8db493b8 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,33 +15,25 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/modifiers/intern/MOD_particleinstance.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_rand.h"
#include "BLI_string.h"
-#include "BLI_utildefines.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "BKE_effect.h"
-#include "BKE_global.h"
#include "BKE_lattice.h"
#include "BKE_library_query.h"
#include "BKE_mesh.h"
@@ -73,19 +63,15 @@ static void initData(ModifierData *md)
STRNCPY(pimd->value_layer_name, "");
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
- CustomDataMask dataMask = 0;
if (pimd->index_layer_name[0] != '\0' ||
pimd->value_layer_name[0] != '\0')
{
- dataMask |= CD_MASK_MLOOPCOL;
+ r_cddata_masks->lmask |= CD_MASK_MLOOPCOL;
}
-
- return dataMask;
-
}
static bool isDisabled(const struct Scene *scene, ModifierData *md, bool useRenderParams)
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index bc1fb300cac..08a19506694 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,19 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_particlesystem.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stddef.h>
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-
#include "BLI_utildefines.h"
+#include "DNA_material_types.h"
+#include "DNA_mesh_types.h"
#include "BKE_editmesh.h"
#include "BKE_mesh.h"
@@ -93,10 +81,11 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
tpsmd->totdmvert = tpsmd->totdmedge = tpsmd->totdmface = 0;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
ParticleSystemModifierData *psmd = (ParticleSystemModifierData *) md;
- return psys_emitter_customdata_mask(psmd->psys);
+
+ psys_emitter_customdata_mask(psmd->psys, r_cddata_masks);
}
/* saves the current emitter state for a particle system and calculates particles */
@@ -127,6 +116,7 @@ static void deformVerts(
}
/* clear old dm */
+ bool had_mesh_final = (psmd->mesh_final != NULL);
if (psmd->mesh_final) {
BKE_id_free(NULL, psmd->mesh_final);
psmd->mesh_final = NULL;
@@ -138,9 +128,12 @@ static void deformVerts(
else if (psmd->flag & eParticleSystemFlag_file_loaded) {
/* in file read mesh just wasn't saved in file so no need to reset everything */
psmd->flag &= ~eParticleSystemFlag_file_loaded;
- }
- else {
- /* no dm before, so recalc particles fully */
+ if (psys->particles == NULL) {
+ psys->recalc |= ID_RECALC_PSYS_RESET;
+ }
+ /* TODO(sergey): This is not how particles were working prior to copy on
+ * write, but now evaluation is similar to case when one duplicates the
+ * object. In that case particles were doing reset here. */
psys->recalc |= ID_RECALC_PSYS_RESET;
}
@@ -158,11 +151,11 @@ static void deformVerts(
Mesh *mesh_original = NULL;
if (ctx->object->type == OB_MESH) {
- BMEditMesh *edit_btmesh = BKE_editmesh_from_object(ctx->object);
+ BMEditMesh *em = BKE_editmesh_from_object(ctx->object);
- if (edit_btmesh) {
+ if (em) {
/* In edit mode get directly from the edit mesh. */
- psmd->mesh_original = BKE_mesh_from_bmesh_for_eval_nomain(edit_btmesh->bm, 0);
+ psmd->mesh_original = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, NULL);
}
else {
/* Otherwise get regular mesh. */
@@ -187,13 +180,16 @@ static void deformVerts(
BKE_id_free(NULL, mesh_src);
}
- /* report change in mesh structure */
- if (psmd->mesh_final->totvert != psmd->totdmvert ||
- psmd->mesh_final->totedge != psmd->totdmedge ||
- psmd->mesh_final->totface != psmd->totdmface)
+ /* Report change in mesh structure.
+ * This is an unreliable check for the topology check, but allows some
+ * handy configuration like emitting particles from inside particle
+ * instance. */
+ if (had_mesh_final &&
+ (psmd->mesh_final->totvert != psmd->totdmvert ||
+ psmd->mesh_final->totedge != psmd->totdmedge ||
+ psmd->mesh_final->totface != psmd->totdmface))
{
psys->recalc |= ID_RECALC_PSYS_RESET;
-
psmd->totdmvert = psmd->mesh_final->totvert;
psmd->totdmedge = psmd->mesh_final->totedge;
psmd->totdmface = psmd->mesh_final->totface;
@@ -205,6 +201,14 @@ static void deformVerts(
particle_system_update(ctx->depsgraph, scene, ctx->object, psys, (ctx->flag & MOD_APPLY_RENDER) != 0);
psmd->flag |= eParticleSystemFlag_psys_updated;
}
+
+ if (DEG_is_active(ctx->depsgraph)) {
+ Object *object_orig = DEG_get_original_object(ctx->object);
+ ModifierData *md_orig = modifiers_findByName(object_orig, psmd->modifier.name);
+ BLI_assert(md_orig != NULL);
+ ParticleSystemModifierData *psmd_orig = (ParticleSystemModifierData *) md_orig;
+ psmd_orig->flag = psmd->flag;
+ }
}
/* disabled particles in editmode for now, until support for proper evaluated mesh
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index 6d0f88df492..2ff82d863df 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,20 +14,18 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2011 by Nicholas Bishop.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/modifiers/intern/MOD_remesh.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "MEM_guardedalloc.h"
-#include "BLI_math_base.h"
-#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
+#include "BLI_math_base.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
@@ -45,6 +41,8 @@
#include <string.h>
#ifdef WITH_MOD_REMESH
+# include "BLI_math_vector.h"
+
# include "dualcon.h"
#endif
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 2c795a8d9ad..837b4d3d532 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,34 +15,25 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_screw.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
/* Screw modifier: revolves the edges about an axis */
#include <limits.h>
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_alloca.h"
-#include "BLI_utildefines.h"
-#include "BKE_library.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+
#include "BKE_library_query.h"
#include "BKE_mesh.h"
@@ -231,7 +220,8 @@ static Mesh *applyModifier(
float axis_vec[3] = {0.0f, 0.0f, 0.0f};
float tmp_vec1[3], tmp_vec2[3];
float mat3[3][3];
- float mtx_tx[4][4]; /* transform the coords by an object relative to this objects transformation */
+ /* transform the coords by an object relative to this objects transformation */
+ float mtx_tx[4][4];
float mtx_tx_inv[4][4]; /* inverted */
float mtx_tmp_a[4][4];
@@ -1119,7 +1109,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
ScrewModifierData *ltmd = (ScrewModifierData *)md;
if (ltmd->ob_axis != NULL) {
DEG_add_object_relation(ctx->node, ltmd->ob_axis, DEG_OB_COMP_TRANSFORM, "Screw Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Screw Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Screw Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c
index 764e99866fd..3530ca21d34 100644
--- a/source/blender/modifiers/intern/MOD_shapekey.c
+++ b/source/blender/modifiers/intern/MOD_shapekey.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,19 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_shapekey.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
#include "BLI_math.h"
#include "DNA_mesh_types.h"
#include "DNA_key_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_key.h"
#include "BKE_particle.h"
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index 92cbbaa78ca..7b33df5bf86 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,20 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_shrinkwrap.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <string.h>
+#include "BLI_utildefines.h"
+
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "BKE_editmesh.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
@@ -66,22 +54,20 @@ static void initData(ModifierData *md)
smd->auxTarget = NULL;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (smd->vgroup_name[0])
- dataMask |= CD_MASK_MDEFORMVERT;
+ if (smd->vgroup_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
if ((smd->shrinkType == MOD_SHRINKWRAP_PROJECT) &&
(smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL))
{
- dataMask |= CD_MASK_MVERT;
+ r_cddata_masks->vmask |= CD_MASK_MVERT; /* XXX Really? These should always be present, always... */
}
-
- return dataMask;
}
static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams))
@@ -148,16 +134,17 @@ static void deformVertsEM(
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
- CustomDataMask mask = 0;
+ CustomData_MeshMasks mask = {0};
if (BKE_shrinkwrap_needs_normals(smd->shrinkType, smd->shrinkMode)) {
- mask |= CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL;
+ mask.vmask |= CD_MASK_NORMAL;
+ mask.lmask |= CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL;
}
if (smd->target != NULL) {
DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier");
- DEG_add_customdata_mask(ctx->node, smd->target, mask);
+ DEG_add_customdata_mask(ctx->node, smd->target, &mask);
if (smd->shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) {
DEG_add_special_eval_flag(ctx->node, &smd->target->id, DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY);
}
@@ -165,12 +152,12 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
if (smd->auxTarget != NULL) {
DEG_add_object_relation(ctx->node, smd->auxTarget, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
DEG_add_object_relation(ctx->node, smd->auxTarget, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier");
- DEG_add_customdata_mask(ctx->node, smd->auxTarget, mask);
+ DEG_add_customdata_mask(ctx->node, smd->auxTarget, &mask);
if (smd->shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) {
DEG_add_special_eval_flag(ctx->node, &smd->auxTarget->id, DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY);
}
}
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Shrinkwrap Modifier");
}
static bool dependsOnNormals(ModifierData *md)
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index 33a585e5324..cc36cfbf9eb 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,28 +15,20 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_simpledeform.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "BKE_editmesh.h"
#include "BKE_mesh.h"
#include "BKE_library.h"
@@ -354,16 +344,14 @@ static void initData(ModifierData *md)
smd->limit[1] = 1.0f;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (smd->vgroup_name[0])
- dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (smd->vgroup_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static void foreachObjectLink(
@@ -379,7 +367,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md;
if (smd->origin != NULL) {
DEG_add_object_relation(ctx->node, smd->origin, DEG_OB_COMP_TRANSFORM, "SimpleDeform Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "SimpleDeform Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "SimpleDeform Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index 586a0b57350..7ba7882d0d0 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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): Nicholas Bishop
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_skin.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
/* Implementation based in part off the paper "B-Mesh: A Fast Modeling
@@ -59,17 +52,18 @@
#include "MEM_guardedalloc.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_modifier_types.h"
-
#include "BLI_utildefines.h"
+
#include "BLI_array.h"
+#include "BLI_bitmap.h"
#include "BLI_heap_simple.h"
#include "BLI_math.h"
#include "BLI_stack.h"
-#include "BLI_bitmap.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_modifier_types.h"
#include "BKE_deform.h"
#include "BKE_library.h"
@@ -92,7 +86,7 @@ typedef enum {
CAP_START = 1,
CAP_END = 2,
SEAM_FRAME = 4,
- ROOT = 8
+ ROOT = 8,
} SkinNodeFlag;
typedef struct Frame {
@@ -1881,7 +1875,7 @@ static Mesh *base_skin(Mesh *origmesh,
if (!bm)
return NULL;
- result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0);
+ result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL);
BM_mesh_free(bm);
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
@@ -1932,10 +1926,9 @@ static Mesh *applyModifier(ModifierData *md,
return result;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob),
- ModifierData *UNUSED(md))
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md), CustomData_MeshMasks *r_cddata_masks)
{
- return CD_MASK_MVERT_SKIN | CD_MASK_MDEFORMVERT;
+ r_cddata_masks->vmask |= CD_MASK_MVERT_SKIN | CD_MASK_MDEFORMVERT;
}
ModifierTypeInfo modifierType_Skin = {
diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c
index d0db852550b..905e8a18e1b 100644
--- a/source/blender/modifiers/intern/MOD_smoke.c
+++ b/source/blender/modifiers/intern/MOD_smoke.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,10 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_smoke.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
@@ -37,6 +26,8 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
#include "DNA_collection_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -44,13 +35,9 @@
#include "DNA_object_force_types.h"
#include "DNA_mesh_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_cdderivedmesh.h"
#include "BKE_layer.h"
-#include "BKE_library.h"
#include "BKE_library_query.h"
-#include "BKE_main.h"
#include "BKE_modifier.h"
#include "BKE_smoke.h"
@@ -88,22 +75,20 @@ static void freeData(ModifierData *md)
smokeModifier_free(smd);
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
SmokeModifierData *smd = (SmokeModifierData *)md;
- CustomDataMask dataMask = 0;
if (smd && (smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) {
if (smd->flow->source == MOD_SMOKE_FLOW_SOURCE_MESH) {
/* vertex groups */
if (smd->flow->vgroup_density)
- dataMask |= CD_MASK_MDEFORMVERT;
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
/* uv layer */
if (smd->flow->texture_type == MOD_SMOKE_FLOW_TEXTURE_MAP_UV)
- dataMask |= CD_MASK_MTFACE;
+ r_cddata_masks->fmask |= CD_MASK_MTFACE;
}
}
- return dataMask;
}
static Mesh *applyModifier(
@@ -201,5 +186,5 @@ ModifierTypeInfo modifierType_Smoke = {
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
- /* foreachTexLink */ NULL
+ /* foreachTexLink */ NULL,
};
diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c
index 8b62c2c1d7d..2b9339842fa 100644
--- a/source/blender/modifiers/intern/MOD_smooth.c
+++ b/source/blender/modifiers/intern/MOD_smooth.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,21 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_smooth.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
+#include "MEM_guardedalloc.h"
-#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "MEM_guardedalloc.h"
+#include "BLI_math.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "BKE_editmesh.h"
#include "BKE_library.h"
@@ -74,15 +64,14 @@ static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool
return 0;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
SmoothModifierData *smd = (SmoothModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (smd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static void smoothModifier_do(
diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c
index 3f45e37e777..868b42bc241 100644
--- a/source/blender/modifiers/intern/MOD_softbody.c
+++ b/source/blender/modifiers/intern/MOD_softbody.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,20 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_softbody.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stdio.h>
+#include "BLI_utildefines.h"
+
#include "DNA_scene_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_force_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_layer.h"
#include "BKE_particle.h"
#include "BKE_softbody.h"
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 6283b7a250d..e449403eb70 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,29 +15,23 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Campbell Barton
- * Shinsuke Irie
- * Martin Felke
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_solidify.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_bitmap.h"
+#include "BLI_math.h"
+#include "BLI_utildefines_stack.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "MEM_guardedalloc.h"
-#include "BLI_utildefines.h"
-#include "BLI_utildefines_stack.h"
-#include "BLI_bitmap.h"
-#include "BLI_math.h"
-
#include "BKE_mesh.h"
#include "BKE_particle.h"
#include "BKE_deform.h"
@@ -58,13 +50,13 @@
/* could be exposed for other functions to use */
typedef struct EdgeFaceRef {
- int f1; /* init as -1 */
- int f2;
+ int p1; /* init as -1 */
+ int p2;
} EdgeFaceRef;
BLI_INLINE bool edgeref_is_init(const EdgeFaceRef *edge_ref)
{
- return !((edge_ref->f1 == 0) && (edge_ref->f2 == 0));
+ return !((edge_ref->p1 == 0) && (edge_ref->p2 == 0));
}
/**
@@ -72,9 +64,9 @@ BLI_INLINE bool edgeref_is_init(const EdgeFaceRef *edge_ref)
* \param face_nors: Precalculated face normals.
* \param r_vert_nors: Return vert normals.
*/
-static void mesh_calc_hq_normal(Mesh *mesh, float (*face_nors)[3], float (*r_vert_nors)[3])
+static void mesh_calc_hq_normal(Mesh *mesh, float (*poly_nors)[3], float (*r_vert_nors)[3])
{
- int i, numVerts, numEdges, numFaces;
+ int i, numVerts, numEdges, numPolys;
MPoly *mpoly, *mp;
MLoop *mloop, *ml;
MEdge *medge, *ed;
@@ -82,7 +74,7 @@ static void mesh_calc_hq_normal(Mesh *mesh, float (*face_nors)[3], float (*r_ver
numVerts = mesh->totvert;
numEdges = mesh->totedge;
- numFaces = mesh->totface;
+ numPolys = mesh->totpoly;
mpoly = mesh->mpoly;
medge = mesh->medge;
mvert = mesh->mvert;
@@ -105,7 +97,7 @@ static void mesh_calc_hq_normal(Mesh *mesh, float (*face_nors)[3], float (*r_ver
float edge_normal[3];
/* Add an edge reference if it's not there, pointing back to the face index. */
- for (i = 0; i < numFaces; i++, mp++) {
+ for (i = 0; i < numPolys; i++, mp++) {
int j;
ml = mloop + mp->loopstart;
@@ -114,15 +106,15 @@ static void mesh_calc_hq_normal(Mesh *mesh, float (*face_nors)[3], float (*r_ver
/* --- add edge ref to face --- */
edge_ref = &edge_ref_array[ml->e];
if (!edgeref_is_init(edge_ref)) {
- edge_ref->f1 = i;
- edge_ref->f2 = -1;
+ edge_ref->p1 = i;
+ edge_ref->p2 = -1;
}
- else if ((edge_ref->f1 != -1) && (edge_ref->f2 == -1)) {
- edge_ref->f2 = i;
+ else if ((edge_ref->p1 != -1) && (edge_ref->p2 == -1)) {
+ edge_ref->p2 = i;
}
else {
/* 3+ faces using an edge, we can't handle this usefully */
- edge_ref->f1 = edge_ref->f2 = -1;
+ edge_ref->p1 = edge_ref->p2 = -1;
#ifdef USE_NONMANIFOLD_WORKAROUND
medge[ml->e].flag |= ME_EDGE_TMP_TAG;
#endif
@@ -134,8 +126,8 @@ static void mesh_calc_hq_normal(Mesh *mesh, float (*face_nors)[3], float (*r_ver
for (i = 0, ed = medge, edge_ref = edge_ref_array; i < numEdges; i++, ed++, edge_ref++) {
/* Get the edge vert indices, and edge value (the face indices that use it) */
- if (edgeref_is_init(edge_ref) && (edge_ref->f1 != -1)) {
- if (edge_ref->f2 != -1) {
+ if (edgeref_is_init(edge_ref) && (edge_ref->p1 != -1)) {
+ if (edge_ref->p2 != -1) {
/* We have 2 faces using this edge, calculate the edges normal
* using the angle between the 2 faces as a weighting */
#if 0
@@ -144,13 +136,13 @@ static void mesh_calc_hq_normal(Mesh *mesh, float (*face_nors)[3], float (*r_ver
edge_normal,
angle_normalized_v3v3(face_nors[edge_ref->f1], face_nors[edge_ref->f2]));
#else
- mid_v3_v3v3_angle_weighted(edge_normal, face_nors[edge_ref->f1], face_nors[edge_ref->f2]);
+ mid_v3_v3v3_angle_weighted(edge_normal, poly_nors[edge_ref->p1], poly_nors[edge_ref->p2]);
#endif
}
else {
/* only one face attached to that edge */
/* an edge without another attached- the weight on this is undefined */
- copy_v3_v3(edge_normal, face_nors[edge_ref->f1]);
+ copy_v3_v3(edge_normal, poly_nors[edge_ref->p1]);
}
add_v3_v3(r_vert_nors[ed->v1], edge_normal);
add_v3_v3(r_vert_nors[ed->v2], edge_normal);
@@ -175,15 +167,14 @@ static void initData(ModifierData *md)
smd->flag = MOD_SOLIDIFY_RIM;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
SolidifyModifierData *smd = (SolidifyModifierData *) md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (smd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
/* specific function for solidify - define locally */
@@ -207,9 +198,9 @@ static Mesh *applyModifier(
MPoly *mp, *mpoly, *orig_mpoly;
const unsigned int numVerts = (unsigned int)mesh->totvert;
const unsigned int numEdges = (unsigned int)mesh->totedge;
- const unsigned int numFaces = (unsigned int)mesh->totpoly;
+ const unsigned int numPolys = (unsigned int)mesh->totpoly;
const unsigned int numLoops = (unsigned int)mesh->totloop;
- unsigned int newLoops = 0, newFaces = 0, newEdges = 0, newVerts = 0, rimVerts = 0;
+ unsigned int newLoops = 0, newPolys = 0, newEdges = 0, newVerts = 0, rimVerts = 0;
/* only use material offsets if we have 2 or more materials */
const short mat_nr_max = ctx->object->totcol > 1 ? ctx->object->totcol - 1 : 0;
@@ -230,9 +221,9 @@ static Mesh *applyModifier(
char *edge_order = NULL;
float (*vert_nors)[3] = NULL;
- float (*face_nors)[3] = NULL;
+ float (*poly_nors)[3] = NULL;
- const bool need_face_normals = (smd->flag & MOD_SOLIDIFY_NORMAL_CALC) || (smd->flag & MOD_SOLIDIFY_EVEN);
+ const bool need_poly_normals = (smd->flag & MOD_SOLIDIFY_NORMAL_CALC) || (smd->flag & MOD_SOLIDIFY_EVEN);
const float ofs_orig = -(((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
const float ofs_new = smd->offset + ofs_orig;
@@ -257,14 +248,14 @@ static Mesh *applyModifier(
orig_mloop = mesh->mloop;
orig_mpoly = mesh->mpoly;
- if (need_face_normals) {
+ if (need_poly_normals) {
/* calculate only face normals */
- face_nors = MEM_malloc_arrayN(numFaces, sizeof(*face_nors), __func__);
+ poly_nors = MEM_malloc_arrayN(numPolys, sizeof(*poly_nors), __func__);
BKE_mesh_calc_normals_poly(
orig_mvert, NULL, (int)numVerts,
orig_mloop, orig_mpoly,
- (int)numLoops, (int)numFaces,
- face_nors, true);
+ (int)numLoops, (int)numPolys,
+ poly_nors, true);
}
STACK_INIT(new_vert_arr, numVerts * 2);
@@ -294,7 +285,7 @@ static Mesh *applyModifier(
edge_users[eidx] = INVALID_UNUSED;
}
- for (i = 0, mp = orig_mpoly; i < numFaces; i++, mp++) {
+ for (i = 0, mp = orig_mpoly; i < numPolys; i++, mp++) {
MLoop *ml_prev;
int j;
@@ -308,7 +299,7 @@ static Mesh *applyModifier(
ed = orig_medge + eidx;
BLI_assert(ELEM(ml_prev->v, ed->v1, ed->v2) &&
ELEM(ml->v, ed->v1, ed->v2));
- edge_users[eidx] = (ml_prev->v > ml->v) == (ed->v1 < ed->v2) ? i : (i + numFaces);
+ edge_users[eidx] = (ml_prev->v > ml->v) == (ed->v1 < ed->v2) ? i : (i + numPolys);
edge_order[eidx] = j;
}
else {
@@ -323,7 +314,7 @@ static Mesh *applyModifier(
BLI_BITMAP_ENABLE(orig_mvert_tag, ed->v1);
BLI_BITMAP_ENABLE(orig_mvert_tag, ed->v2);
STACK_PUSH(new_edge_arr, eidx);
- newFaces++;
+ newPolys++;
newLoops += 4;
}
}
@@ -346,7 +337,7 @@ static Mesh *applyModifier(
/* only add rim vertices */
newVerts = rimVerts;
/* each extruded face needs an opposite edge */
- newEdges = newFaces;
+ newEdges = newPolys;
}
else {
/* (stride == 2) in this case, so no need to add newVerts/newEdges */
@@ -356,7 +347,7 @@ static Mesh *applyModifier(
if (smd->flag & MOD_SOLIDIFY_NORMAL_CALC) {
vert_nors = MEM_calloc_arrayN(numVerts, 3 * sizeof(float), "mod_solid_vno_hq");
- mesh_calc_hq_normal(mesh, face_nors, vert_nors);
+ mesh_calc_hq_normal(mesh, poly_nors, vert_nors);
}
result = BKE_mesh_new_nomain_from_template(
@@ -364,7 +355,7 @@ static Mesh *applyModifier(
(int)((numVerts * stride) + newVerts),
(int)((numEdges * stride) + newEdges + rimVerts), 0,
(int)((numLoops * stride) + newLoops),
- (int)((numFaces * stride) + newFaces));
+ (int)((numPolys * stride) + newPolys));
mpoly = result->mpoly;
mloop = result->mloop;
@@ -379,10 +370,13 @@ static Mesh *applyModifier(
CustomData_copy_data(&mesh->edata, &result->edata, 0, (int)numEdges, (int)numEdges);
CustomData_copy_data(&mesh->ldata, &result->ldata, 0, 0, (int)numLoops);
- CustomData_copy_data(&mesh->ldata, &result->ldata, 0, (int)numLoops, (int)numLoops);
+ /* DO NOT copy here the 'copied' part of loop data, we want to reverse loops
+ * (so that winding of copied face get reversed, so that normals get reversed
+ * and point in expected direction...).
+ * If we also copy data here, then this data get overwritten (and allocated memory becomes memleak). */
- CustomData_copy_data(&mesh->pdata, &result->pdata, 0, 0, (int)numFaces);
- CustomData_copy_data(&mesh->pdata, &result->pdata, 0, (int)numFaces, (int)numFaces);
+ CustomData_copy_data(&mesh->pdata, &result->pdata, 0, 0, (int)numPolys);
+ CustomData_copy_data(&mesh->pdata, &result->pdata, 0, (int)numPolys, (int)numPolys);
}
else {
int i, j;
@@ -411,7 +405,7 @@ static Mesh *applyModifier(
/* will be created later */
CustomData_copy_data(&mesh->ldata, &result->ldata, 0, 0, (int)numLoops);
- CustomData_copy_data(&mesh->pdata, &result->pdata, 0, 0, (int)numFaces);
+ CustomData_copy_data(&mesh->pdata, &result->pdata, 0, 0, (int)numPolys);
}
#undef INVALID_UNUSED
@@ -443,7 +437,7 @@ static Mesh *applyModifier(
if (do_shell) {
unsigned int i;
- mp = mpoly + numFaces;
+ mp = mpoly + numPolys;
for (i = 0; i < mesh->totpoly; i++, mp++) {
const int loop_end = mp->totloop - 1;
MLoop *ml2;
@@ -598,7 +592,7 @@ static Mesh *applyModifier(
}
}
- for (i = 0, mp = mpoly; i < numFaces; i++, mp++) {
+ for (i = 0, mp = mpoly; i < numPolys; i++, mp++) {
/* #BKE_mesh_calc_poly_angles logic is inlined here */
float nor_prev[3];
float nor_next[3];
@@ -632,13 +626,13 @@ static Mesh *applyModifier(
LIKELY(((orig_medge[ml[i_curr].e].flag & ME_EDGE_TMP_TAG) == 0) &&
((orig_medge[ml[i_next].e].flag & ME_EDGE_TMP_TAG) == 0)))
{
- vert_angles[vidx] += shell_v3v3_normalized_to_dist(vert_nors[vidx], face_nors[i]) * angle;
+ vert_angles[vidx] += shell_v3v3_normalized_to_dist(vert_nors[vidx], poly_nors[i]) * angle;
}
else {
vert_angles[vidx] += angle;
}
#else
- vert_angles[vidx] += shell_v3v3_normalized_to_dist(vert_nors[vidx], face_nors[i]) * angle;
+ vert_angles[vidx] += shell_v3v3_normalized_to_dist(vert_nors[vidx], poly_nors[i]) * angle;
#endif
/* --- end non-angle-calc section --- */
@@ -780,7 +774,7 @@ static Mesh *applyModifier(
for (i = 0; i < rimVerts; i++, ed++, orig_ed++) {
ed->v1 = new_vert_arr[i];
ed->v2 = (do_shell ? new_vert_arr[i] : i) + numVerts;
- ed->flag |= ME_EDGEDRAW;
+ ed->flag |= ME_EDGEDRAW | ME_EDGERENDER;
*orig_ed = ORIGINDEX_NONE;
@@ -790,17 +784,17 @@ static Mesh *applyModifier(
}
/* faces */
- mp = mpoly + (numFaces * stride);
+ mp = mpoly + (numPolys * stride);
ml = mloop + (numLoops * stride);
j = 0;
- for (i = 0; i < newFaces; i++, mp++) {
+ for (i = 0; i < newPolys; i++, mp++) {
unsigned int eidx = new_edge_arr[i];
- unsigned int fidx = edge_users[eidx];
+ unsigned int pidx = edge_users[eidx];
int k1, k2;
bool flip;
- if (fidx >= numFaces) {
- fidx -= numFaces;
+ if (pidx >= numPolys) {
+ pidx -= numPolys;
flip = true;
}
else {
@@ -810,15 +804,15 @@ static Mesh *applyModifier(
ed = medge + eidx;
/* copy most of the face settings */
- CustomData_copy_data(&mesh->pdata, &result->pdata, (int)fidx, (int)((numFaces * stride) + i), 1);
+ CustomData_copy_data(&mesh->pdata, &result->pdata, (int)pidx, (int)((numPolys * stride) + i), 1);
mp->loopstart = (int)(j + (numLoops * stride));
- mp->flag = mpoly[fidx].flag;
+ mp->flag = mpoly[pidx].flag;
/* notice we use 'mp->totloop' which is later overwritten,
* we could lookup the original face but there's no point since this is a copy
* and will have the same value, just take care when changing order of assignment */
- k1 = mpoly[fidx].loopstart + (((edge_order[eidx] - 1) + mp->totloop) % mp->totloop); /* prev loop */
- k2 = mpoly[fidx].loopstart + (edge_order[eidx]);
+ k1 = mpoly[pidx].loopstart + (((edge_order[eidx] - 1) + mp->totloop) % mp->totloop); /* prev loop */
+ k2 = mpoly[pidx].loopstart + (edge_order[eidx]);
mp->totloop = 4;
@@ -926,10 +920,10 @@ static Mesh *applyModifier(
if (old_vert_arr)
MEM_freeN(old_vert_arr);
- if (face_nors)
- MEM_freeN(face_nors);
+ if (poly_nors)
+ MEM_freeN(poly_nors);
- if (numFaces == 0 && numEdges != 0) {
+ if (numPolys == 0 && numEdges != 0) {
modifier_setError(md, "Faces needed for useful output");
}
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index e66b3fdbafb..1899faa3583 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,21 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_subsurf.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <stddef.h>
+#include "BLI_utildefines.h"
+
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_mesh_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_cdderivedmesh.h"
#include "BKE_scene.h"
#include "BKE_subdiv.h"
@@ -75,6 +64,7 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
modifier_copyData_generic(md, target, flag);
tsmd->emCache = tsmd->mCache = NULL;
+ tsmd->subdiv = NULL;
}
static void freeData(ModifierData *md)
@@ -89,6 +79,9 @@ static void freeData(ModifierData *md)
ccgSubSurf_free(smd->emCache);
smd->emCache = NULL;
}
+ if (smd->subdiv != NULL) {
+ BKE_subdiv_free(smd->subdiv);
+ }
}
static bool isDisabled(const Scene *scene, ModifierData *md, bool useRenderParams)
@@ -122,6 +115,18 @@ static void subdiv_settings_init(SubdivSettings *settings,
BKE_subdiv_fvar_interpolation_from_uv_smooth(smd->uv_smooth);
}
+/* Main goal of this function is to give usable subdivision surface descriptor
+ * which matches settings and topology. */
+static Subdiv *subdiv_descriptor_ensure(SubsurfModifierData *smd,
+ const SubdivSettings *subdiv_settings,
+ const Mesh *mesh)
+{
+ Subdiv *subdiv = BKE_subdiv_update_from_mesh(
+ smd->subdiv, subdiv_settings, mesh);
+ smd->subdiv = subdiv;
+ return subdiv;
+}
+
/* Subdivide into fully qualified mesh. */
static void subdiv_mesh_settings_init(SubdivToMeshSettings *settings,
@@ -189,24 +194,24 @@ static Mesh *applyModifier(ModifierData *md,
if (subdiv_settings.level == 0) {
return result;
}
- /* TODO(sergey): Try to re-use subdiv when possible. */
- Subdiv *subdiv = BKE_subdiv_new_from_mesh(&subdiv_settings, mesh);
+ BKE_subdiv_settings_validate_for_mesh(&subdiv_settings, mesh);
+ Subdiv *subdiv = subdiv_descriptor_ensure(smd, &subdiv_settings, mesh);
if (subdiv == NULL) {
- /* Happens on bad topology, ut also on empty input mesh. */
+ /* Happens on bad topology, but also on empty input mesh. */
return result;
}
/* TODO(sergey): Decide whether we ever want to use CCG for subsurf,
- * maybe when it is a last modifier in the stack?
- */
+ * maybe when it is a last modifier in the stack? */
if (true) {
result = subdiv_as_mesh(smd, ctx, mesh, subdiv);
}
else {
result = subdiv_as_ccg(smd, ctx, mesh, subdiv);
}
- /* TODO(sergey): Cache subdiv somehow. */
// BKE_subdiv_stats_print(&subdiv->stats);
- BKE_subdiv_free(subdiv);
+ if (subdiv != smd->subdiv) {
+ BKE_subdiv_free(subdiv);
+ }
return result;
}
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c
index c5fa510f2e0..ee3c99bef85 100644
--- a/source/blender/modifiers/intern/MOD_surface.c
+++ b/source/blender/modifiers/intern/MOD_surface.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,17 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_surface.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
@@ -45,9 +38,6 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "MOD_modifiertypes.h"
#include "MOD_util.h"
@@ -59,6 +49,21 @@ static void initData(ModifierData *md)
SurfaceModifierData *surmd = (SurfaceModifierData *) md;
surmd->bvhtree = NULL;
+ surmd->mesh = NULL;
+ surmd->x = NULL;
+ surmd->v = NULL;
+}
+
+static void copyData(const ModifierData *md_src, ModifierData *md_dst, const int flag)
+{
+ SurfaceModifierData *surmd_dst = (SurfaceModifierData *)md_dst;
+
+ modifier_copyData_generic(md_src, md_dst, flag);
+
+ surmd_dst->bvhtree = NULL;
+ surmd_dst->mesh = NULL;
+ surmd_dst->x = NULL;
+ surmd_dst->v = NULL;
}
static void freeData(ModifierData *md)
@@ -96,20 +101,21 @@ static void deformVerts(
SurfaceModifierData *surmd = (SurfaceModifierData *) md;
const int cfra = (int)DEG_get_ctime(ctx->depsgraph);
+ /* Free mesh and BVH cache. */
+ if (surmd->bvhtree) {
+ free_bvhtree_from_mesh(surmd->bvhtree);
+ MEM_SAFE_FREE(surmd->bvhtree);
+ }
+
if (surmd->mesh) {
BKE_id_free(NULL, surmd->mesh);
+ surmd->mesh = NULL;
}
if (mesh) {
/* Not possible to use get_mesh() in this case as we'll modify its vertices
* and get_mesh() would return 'mesh' directly. */
- BKE_id_copy_ex(
- NULL, (ID *)mesh, (ID **)&surmd->mesh,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, (ID *)mesh, (ID **)&surmd->mesh, LIB_ID_COPY_LOCALIZE);
}
else {
surmd->mesh = MOD_deform_mesh_eval_get(ctx->object, NULL, NULL, NULL, numVerts, false, false);
@@ -168,10 +174,7 @@ static void deformVerts(
surmd->cfra = cfra;
- if (surmd->bvhtree)
- free_bvhtree_from_mesh(surmd->bvhtree);
- else
- surmd->bvhtree = MEM_callocN(sizeof(BVHTreeFromMesh), "BVHTreeFromMesh");
+ surmd->bvhtree = MEM_callocN(sizeof(BVHTreeFromMesh), "BVHTreeFromMesh");
if (surmd->mesh->totpoly)
BKE_bvhtree_from_mesh_get(surmd->bvhtree, surmd->mesh, BVHTREE_FROM_LOOPTRI, 2);
@@ -190,7 +193,7 @@ ModifierTypeInfo modifierType_Surface = {
eModifierTypeFlag_AcceptsCVs |
eModifierTypeFlag_NoUserAdd,
- /* copyData */ NULL,
+ /* copyData */ copyData,
/* deformVerts_DM */ NULL,
/* deformMatrices_DM */ NULL,
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c
index d4781e419cf..554545077fa 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -1,13 +1,34 @@
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
+/*
+ * 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.
+ *
+ * Copyright 2017, Blender Foundation.
+ */
+
+/** \file
+ * \ingroup modifiers
+ */
-#include "BLI_alloca.h"
#include "BLI_math.h"
#include "BLI_math_geom.h"
#include "BLI_task.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
#include "BKE_bvhutils.h"
#include "BKE_mesh_runtime.h"
#include "BKE_editmesh.h"
@@ -269,7 +290,7 @@ BLI_INLINE void sortPolyVertsTri(unsigned int *indices, const MLoop * const mloo
BLI_INLINE unsigned int nearestVert(SDefBindCalcData * const data, const float point_co[3])
{
- BVHTreeNearest nearest = {.dist_sq = FLT_MAX, .index = -1};
+ BVHTreeNearest nearest = { .dist_sq = FLT_MAX, .index = -1, };
const MPoly *poly;
const MEdge *edge;
const MLoop *loop;
@@ -976,18 +997,20 @@ static bool surfacedeformBind(
smd->numverts = numverts;
smd->numpoly = tnumpoly;
- SDefBindCalcData data = {.treeData = &treeData,
- .vert_edges = vert_edges,
- .edge_polys = edge_polys,
- .mpoly = mpoly,
- .medge = medge,
- .mloop = mloop,
- .looptri = BKE_mesh_runtime_looptri_ensure(target),
- .targetCos = MEM_malloc_arrayN(tnumverts, sizeof(float[3]), "SDefTargetBindVertArray"),
- .bind_verts = smd->verts,
- .vertexCos = vertexCos,
- .falloff = smd->falloff,
- .success = MOD_SDEF_BIND_RESULT_SUCCESS};
+ SDefBindCalcData data = {
+ .treeData = &treeData,
+ .vert_edges = vert_edges,
+ .edge_polys = edge_polys,
+ .mpoly = mpoly,
+ .medge = medge,
+ .mloop = mloop,
+ .looptri = BKE_mesh_runtime_looptri_ensure(target),
+ .targetCos = MEM_malloc_arrayN(tnumverts, sizeof(float[3]), "SDefTargetBindVertArray"),
+ .bind_verts = smd->verts,
+ .vertexCos = vertexCos,
+ .falloff = smd->falloff,
+ .success = MOD_SDEF_BIND_RESULT_SUCCESS,
+ };
if (data.targetCos == NULL) {
modifier_setError((ModifierData *)smd, "Out of memory");
@@ -1105,7 +1128,6 @@ static void surfacedeformModifier_do(
float (*vertexCos)[3], unsigned int numverts, Object *ob)
{
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
- bool free_target;
Mesh *target;
unsigned int tnumverts, tnumpoly;
@@ -1126,12 +1148,12 @@ static void surfacedeformModifier_do(
}
Object *ob_target = DEG_get_evaluated_object(ctx->depsgraph, smd->target);
- target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, &free_target);
+ target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false);
#if 0 /* Should not be needed anymore since we always get that mesh from eval object ? */
if (target == NULL && smd->verts == NULL && ob == DEG_get_original_object(ob)) {
/* Special case, binding happens outside of depsgraph evaluation, so we can build our own
* target mesh if needed. */
- target = mesh_create_eval_final_view(ctx->depsgraph, DEG_get_input_scene(ctx->depsgraph), smd->target, 0);
+ target = mesh_create_eval_final_view(ctx->depsgraph, DEG_get_input_scene(ctx->depsgraph), smd->target, CD_MASK_BAREMESH);
free_target = target != NULL;
}
#endif
@@ -1150,7 +1172,7 @@ static void surfacedeformModifier_do(
if (ob != DEG_get_original_object(ob)) {
BLI_assert(!"Trying to bind inside of depsgraph evaluation");
modifier_setError(md, "Trying to bind inside of depsgraph evaluation");
- goto finally;
+ return;
}
float tmp_mat[4][4];
@@ -1161,17 +1183,17 @@ static void surfacedeformModifier_do(
smd->flags &= ~MOD_SDEF_BIND;
}
/* Early abort, this is binding 'call', no need to perform whole evaluation. */
- goto finally;
+ return;
}
/* Poly count checks */
if (smd->numverts != numverts) {
modifier_setError(md, "Verts changed from %u to %u", smd->numverts, numverts);
- goto finally;
+ return;
}
else if (smd->numpoly != tnumpoly) {
modifier_setError(md, "Target polygons changed from %u to %u", smd->numpoly, tnumpoly);
- goto finally;
+ return;
}
/* Actual vertex location update starts here */
@@ -1198,11 +1220,6 @@ static void surfacedeformModifier_do(
MEM_freeN(data.targetCos);
}
-
-finally:
- if (target != NULL && free_target) {
- BKE_id_free(NULL, target);
- }
}
static void deformVerts(
diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c
index 0eba535ca9b..802bde21b5c 100644
--- a/source/blender/modifiers/intern/MOD_triangulate.c
+++ b/source/blender/modifiers/intern/MOD_triangulate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,23 +12,20 @@
* 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): Antony Riakiotakis
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_triangulate.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_modifier.h"
#include "BKE_mesh.h"
@@ -39,32 +34,55 @@
#include "MOD_modifiertypes.h"
-static Mesh *triangulate_mesh(Mesh *mesh, const int quad_method, const int ngon_method)
+static Mesh *triangulate_mesh(Mesh *mesh, const int quad_method, const int ngon_method, const int flag)
{
Mesh *result;
BMesh *bm;
int total_edges, i;
MEdge *me;
+ CustomData_MeshMasks cddata_masks = {.vmask = CD_MASK_ORIGINDEX, .emask = CD_MASK_ORIGINDEX, .pmask = CD_MASK_ORIGINDEX};
+
+ bool keep_clnors = (flag & MOD_TRIANGULATE_KEEP_CUSTOMLOOP_NORMALS) != 0;
+
+ if (keep_clnors) {
+ BKE_mesh_calc_normals_split(mesh);
+ /* We need that one to 'survive' to/from BMesh conversions. */
+ CustomData_clear_layer_flag(&mesh->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
+ cddata_masks.lmask |= CD_MASK_NORMAL;
+ }
bm = BKE_mesh_to_bmesh_ex(
mesh,
&((struct BMeshCreateParams){0}),
&((struct BMeshFromMeshParams){
.calc_face_normal = true,
- .cd_mask_extra = CD_MASK_ORIGINDEX,
+ .cd_mask_extra = cddata_masks,
}));
BM_mesh_triangulate(bm, quad_method, ngon_method, false, NULL, NULL, NULL);
- result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0);
+ result = BKE_mesh_from_bmesh_for_eval_nomain(bm, &cddata_masks);
BM_mesh_free(bm);
+
+ if (keep_clnors) {
+ float (*lnors)[3] = CustomData_get_layer(&result->ldata, CD_NORMAL);
+ BLI_assert(lnors != NULL);
+
+ BKE_mesh_set_custom_normals(result, lnors);
+
+ /* Do some cleanup, we do not want those temp data to stay around. */
+ CustomData_set_layer_flag(&mesh->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
+ CustomData_set_layer_flag(&result->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
+ }
+
total_edges = result->totedge;
me = result->medge;
/* force drawing of all edges (seems to be omitted in CDDM_from_bmesh) */
- for (i = 0; i < total_edges; i++, me++)
+ for (i = 0; i < total_edges; i++, me++) {
me->flag |= ME_EDGEDRAW | ME_EDGERENDER;
+ }
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
@@ -89,7 +107,7 @@ static Mesh *applyModifier(
{
TriangulateModifierData *tmd = (TriangulateModifierData *)md;
Mesh *result;
- if (!(result = triangulate_mesh(mesh, tmd->quad_method, tmd->ngon_method))) {
+ if (!(result = triangulate_mesh(mesh, tmd->quad_method, tmd->ngon_method, tmd->flag))) {
return mesh;
}
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index 88fc8048269..941fcf6cf9a 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,21 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Ben Batt
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/modifiers/intern/MOD_util.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <string.h>
+#include "BLI_utildefines.h"
+
+#include "BLI_bitmap.h"
+#include "BLI_math_vector.h"
+#include "BLI_math_matrix.h"
+
#include "DNA_image_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_mesh_types.h"
@@ -39,11 +37,6 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_utildefines.h"
-#include "BLI_bitmap.h"
-#include "BLI_math_vector.h"
-#include "BLI_math_matrix.h"
-
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_image.h"
@@ -186,7 +179,7 @@ Mesh *MOD_deform_mesh_eval_get(
}
else if (ob->type == OB_MESH) {
if (em) {
- mesh = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, 0);
+ mesh = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, NULL);
}
else {
/* TODO(sybren): after modifier conversion of DM to Mesh is done, check whether
@@ -194,12 +187,8 @@ Mesh *MOD_deform_mesh_eval_get(
Mesh *mesh_prior_modifiers = BKE_object_get_pre_modified_mesh(ob);
BKE_id_copy_ex(
NULL, &mesh_prior_modifiers->id, (ID **)&mesh,
- (LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW |
- LIB_ID_COPY_CD_REFERENCE),
- false);
+ (LIB_ID_COPY_LOCALIZE |
+ LIB_ID_COPY_CD_REFERENCE));
mesh->runtime.deformed_only = 1;
}
diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h
index 9a444046bd9..2325f865d6a 100644
--- a/source/blender/modifiers/intern/MOD_util.h
+++ b/source/blender/modifiers/intern/MOD_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Ben Batt
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/modifiers/intern/MOD_util.h
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index 0da96ba1a38..26c7ec7ed13 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,36 +15,26 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_uvproject.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
/* UV Project modifier: Generates UVs projected from an object */
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_object_types.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_uvproject.h"
-#include "BLI_utildefines.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_object_types.h"
#include "BKE_camera.h"
-#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
@@ -69,14 +57,10 @@ static void initData(ModifierData *md)
umd->scalex = umd->scaley = 1.0f;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md), CustomData_MeshMasks *r_cddata_masks)
{
- CustomDataMask dataMask = 0;
-
/* ask for UV coordinates */
- dataMask |= CD_MLOOPUV;
-
- return dataMask;
+ r_cddata_masks->lmask |= CD_MLOOPUV;
}
static void foreachObjectLink(
@@ -112,7 +96,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
}
}
if (do_add_own_transform) {
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "UV Project Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "UV Project Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c
index c051f51facc..d4f17b742f1 100644
--- a/source/blender/modifiers/intern/MOD_uvwarp.c
+++ b/source/blender/modifiers/intern/MOD_uvwarp.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,26 +12,22 @@
* 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): Pawel Kowal, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_uvwarp.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <string.h>
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_task.h"
-#include "BLI_utildefines.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
#include "BKE_action.h" /* BKE_pose_channel_find_name */
#include "BKE_deform.h"
@@ -68,16 +62,14 @@ static void initData(ModifierData *md)
copy_v2_fl(umd->center, 0.5f);
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
UVWarpModifierData *umd = (UVWarpModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (umd->vgroup_name[0])
- dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (umd->vgroup_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static void matrix_from_obj_pchan(float mat[4][4], Object *ob, const char *bonename)
@@ -202,9 +194,11 @@ static Mesh *applyModifier(
mloopuv = CustomData_duplicate_referenced_layer_named(&mesh->ldata, CD_MLOOPUV, uvname, numLoops);
MOD_get_vgroup(ctx->object, mesh, umd->vgroup_name, &dvert, &defgrp_index);
- UVWarpData data = {.mpoly = mpoly, .mloop = mloop, .mloopuv = mloopuv,
- .dvert = dvert, .defgrp_index = defgrp_index,
- .warp_mat = warp_mat, .axis_u = axis_u, .axis_v = axis_v};
+ UVWarpData data = {
+ .mpoly = mpoly, .mloop = mloop, .mloopuv = mloopuv,
+ .dvert = dvert, .defgrp_index = defgrp_index,
+ .warp_mat = warp_mat, .axis_u = axis_u, .axis_v = axis_v,
+ };
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = (numPolys > 1000);
@@ -247,7 +241,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
uv_warp_deps_object_bone_new(ctx->node, umd->object_src, umd->bone_src);
uv_warp_deps_object_bone_new(ctx->node, umd->object_dst, umd->bone_dst);
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "UVWarp Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "UVWarp Modifier");
}
ModifierTypeInfo modifierType_UVWarp = {
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index cf59c81dcf4..adda5df61ea 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,28 +12,24 @@
* 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 *****
- *
*/
-/** \file blender/modifiers/intern/MOD_warp.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include <string.h>
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
+#include "BLI_math.h"
+
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
#include "BKE_editmesh.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
@@ -75,19 +69,19 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
twmd->curfalloff = curvemapping_copy(wmd->curfalloff);
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
WarpModifierData *wmd = (WarpModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (wmd->defgrp_name[0]) dataMask |= (CD_MASK_MDEFORMVERT);
- dataMask |= (CD_MASK_MDEFORMVERT);
+ if (wmd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
/* ask for UV coordinates if we need them */
- if (wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE);
-
- return dataMask;
+ if (wmd->texmapping == MOD_DISP_MAP_UV) {
+ r_cddata_masks->fmask |= CD_MASK_MTFACE;
+ }
}
static bool dependsOnTime(ModifierData *md)
@@ -143,7 +137,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
{
WarpModifierData *wmd = (WarpModifierData *) md;
if (wmd->object_from != NULL && wmd->object_to != NULL) {
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Warplace Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Warplace Modifier");
DEG_add_object_relation(ctx->node, wmd->object_from, DEG_OB_COMP_TRANSFORM, "Warp Modifier from");
DEG_add_object_relation(ctx->node, wmd->object_to, DEG_OB_COMP_TRANSFORM, "Warp Modifier to");
}
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index cc3035d3d9b..80ac323c82f 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,15 @@
*
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Daniel Dunbar
- * Ton Roosendaal,
- * Ben Batt,
- * Brecht Van Lommel,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_wave.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
#include "BLI_math.h"
#include "DNA_mesh_types.h"
@@ -40,9 +31,6 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_utildefines.h"
-
-
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_library.h"
@@ -124,28 +112,26 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_object_relation(ctx->node, wmd->map_object, DEG_OB_COMP_TRANSFORM, "Wave Modifier");
}
if (wmd->objectcenter != NULL || wmd->map_object != NULL) {
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Wave Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "Wave Modifier");
}
if (wmd->texture != NULL) {
DEG_add_generic_id_relation(ctx->node, &wmd->texture->id, "Wave Modifier");
}
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
WaveModifierData *wmd = (WaveModifierData *)md;
- CustomDataMask dataMask = 0;
-
/* ask for UV coordinates if we need them */
- if (wmd->texture && wmd->texmapping == MOD_DISP_MAP_UV)
- dataMask |= CD_MASK_MTFACE;
+ if (wmd->texture && wmd->texmapping == MOD_DISP_MAP_UV) {
+ r_cddata_masks->fmask |= CD_MASK_MTFACE;
+ }
/* ask for vertexgroups if we need them */
- if (wmd->defgrp_name[0])
- dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
+ if (wmd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static bool dependsOnNormals(ModifierData *md)
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c
index 0e116b2e021..9eda072b7d3 100644
--- a/source/blender/modifiers/intern/MOD_weighted_normal.c
+++ b/source/blender/modifiers/intern/MOD_weighted_normal.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,17 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_weighted_normal.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "MEM_guardedalloc.h"
+#include "BLI_linklist.h"
+#include "BLI_math.h"
+
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -32,12 +30,8 @@
#include "BKE_cdderivedmesh.h"
#include "BKE_deform.h"
#include "BKE_library.h"
-#include "BKE_library_query.h"
#include "BKE_mesh.h"
-#include "BLI_math.h"
-#include "BLI_linklist.h"
-
#include "MOD_modifiertypes.h"
#include "MOD_util.h"
@@ -496,13 +490,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
}
Mesh *result;
- BKE_id_copy_ex(
- NULL, &mesh->id, (ID **)&result,
- LIB_ID_CREATE_NO_MAIN |
- LIB_ID_CREATE_NO_USER_REFCOUNT |
- LIB_ID_CREATE_NO_DEG_TAG |
- LIB_ID_COPY_NO_PREVIEW,
- false);
+ BKE_id_copy_ex(NULL, &mesh->id, (ID **)&result, LIB_ID_COPY_LOCALIZE);
const int numVerts = result->totvert;
const int numEdges = result->totedge;
@@ -535,6 +523,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
float (*polynors)[3] = CustomData_get_layer(pdata, CD_NORMAL);
if (!polynors) {
polynors = CustomData_add_layer(pdata, CD_NORMAL, CD_CALLOC, NULL, numPolys);
+ CustomData_set_layer_flag(pdata, CD_NORMAL, CD_FLAG_TEMPORARY);
}
BKE_mesh_calc_normals_poly(mvert, NULL, numVerts, mloop, mpoly, numLoops, numPolys, polynors, false);
@@ -599,6 +588,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
MEM_SAFE_FREE(wn_data.mode_pair);
MEM_SAFE_FREE(wn_data.items_data);
+ /* Currently Modifier stack assumes there is no poly normal data passed around... */
+ CustomData_free_layers(pdata, CD_NORMAL, numPolys);
return result;
}
@@ -611,20 +602,19 @@ static void initData(ModifierData *md)
wnmd->flag = 0;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
WeightedNormalModifierData *wnmd = (WeightedNormalModifierData *)md;
- CustomDataMask dataMask = CD_MASK_CUSTOMLOOPNORMAL;
- if (wnmd->defgrp_name[0]) {
- dataMask |= CD_MASK_MDEFORMVERT;
+ r_cddata_masks->lmask = CD_MASK_CUSTOMLOOPNORMAL;
+
+ if (wnmd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
}
if (wnmd->flag & MOD_WEIGHTEDNORMAL_FACE_INFLUENCE) {
- dataMask |= CD_MASK_PROP_INT;
+ r_cddata_masks->pmask |= CD_MASK_PROP_INT;
}
-
- return dataMask;
}
static bool dependsOnNormals(ModifierData *UNUSED(md))
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 60537e51e22..85cf3102733 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,21 +15,17 @@
*
* The Original Code is Copyright (C) 2011 by Bastien Montagne.
* All rights reserved.
- *
- * Contributor(s): None yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_weightvg_util.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_string.h"
-#include "BLI_utildefines.h"
#include "DNA_color_types.h" /* CurveMapping. */
#include "DNA_mesh_types.h"
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h
index 93594fd8b29..8bc56eb61f9 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.h
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2011 by Bastien Montagne.
* All rights reserved.
- *
- * Contributor(s): None yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_weightvg_util.h
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#ifndef __MOD_WEIGHTVG_UTIL_H__
@@ -37,9 +30,9 @@ struct MDeformWeight;
struct Mesh;
struct ModifierEvalContext;
struct Object;
-struct Tex;
-struct Scene;
struct RNG;
+struct Scene;
+struct Tex;
/*
* XXX I'd like to make modified weights visible in WeightPaint mode,
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index bf7517ee634..32d058e5659 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,14 @@
*
* The Original Code is Copyright (C) 2011 by Bastien Montagne.
* All rights reserved.
- *
- * Contributor(s): None yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_weightvgedit.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "BLI_utildefines.h"
+
#include "BLI_ghash.h"
#include "BLI_listbase.h"
#include "BLI_rand.h"
@@ -41,7 +35,6 @@
#include "BKE_colortools.h" /* CurveMapping. */
#include "BKE_deform.h"
-#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_modifier.h"
#include "BKE_texture.h" /* Texture masking. */
@@ -91,21 +84,19 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
twmd->cmap_curve = curvemapping_copy(wmd->cmap_curve);
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
WeightVGEditModifierData *wmd = (WeightVGEditModifierData *) md;
- CustomDataMask dataMask = 0;
/* We need vertex groups! */
- dataMask |= CD_MASK_MDEFORMVERT;
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
/* Ask for UV coordinates if we need them. */
- if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
- dataMask |= CD_MASK_MTFACE;
+ if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV) {
+ r_cddata_masks->fmask |= CD_MASK_MTFACE;
+ }
/* No need to ask for CD_PREVIEW_MLOOPCOL... */
-
- return dataMask;
}
static bool dependsOnTime(ModifierData *md)
@@ -142,10 +133,13 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
DEG_add_object_relation(ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGEdit Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "WeightVGEdit Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGEdit Modifier");
}
else if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "WeightVGEdit Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGEdit Modifier");
+ }
+ if (wmd->mask_texture != NULL) {
+ DEG_add_generic_id_relation(ctx->node, &wmd->mask_texture->id, "WeightVGEdit Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index 674ef106737..495d235b406 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,16 @@
*
* The Original Code is Copyright (C) 2011 by Bastien Montagne.
* All rights reserved.
- *
- * Contributor(s): None yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_weightvgmix.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "BLI_utildefines.h"
-#include "BLI_math.h"
+
#include "BLI_listbase.h"
+#include "BLI_math.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -39,7 +33,6 @@
#include "BKE_customdata.h"
#include "BKE_deform.h"
-#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_modifier.h"
#include "BKE_texture.h" /* Texture masking. */
@@ -126,21 +119,19 @@ static void initData(ModifierData *md)
wmd->mask_tex_mapping = MOD_DISP_MAP_LOCAL;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md;
- CustomDataMask dataMask = 0;
/* We need vertex groups! */
- dataMask |= CD_MASK_MDEFORMVERT;
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
/* Ask for UV coordinates if we need them. */
- if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
- dataMask |= CD_MASK_MTFACE;
+ if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV) {
+ r_cddata_masks->fmask |= CD_MASK_MTFACE;
+ }
/* No need to ask for CD_PREVIEW_MLOOPCOL... */
-
- return dataMask;
}
static bool dependsOnTime(ModifierData *md)
@@ -179,11 +170,13 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_object_relation(ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGMix Modifier");
DEG_add_object_relation(ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_GEOMETRY, "WeightVGMix Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "WeightVGMix Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGMix Modifier");
}
else if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "WeightVGMix Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_GEOMETRY, "WeightVGMix Modifier");
+ DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGMix Modifier");
+ }
+ if (wmd->mask_texture != NULL) {
+ DEG_add_generic_id_relation(ctx->node, &wmd->mask_texture->id, "WeightVGMix Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index cee5c266e59..2e2e4fe963d 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,18 +15,14 @@
*
* The Original Code is Copyright (C) 2011 by Bastien Montagne.
* All rights reserved.
- *
- * Contributor(s): None yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_weightvgproximity.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
#include "BLI_utildefines.h"
+
#include "BLI_ghash.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
@@ -294,21 +288,19 @@ static void initData(ModifierData *md)
wmd->max_dist = 1.0f; /* vert arbitrary distance, but don't use 0 */
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *) md;
- CustomDataMask dataMask = 0;
/* We need vertex groups! */
- dataMask |= CD_MASK_MDEFORMVERT;
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
/* Ask for UV coordinates if we need them. */
- if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
- dataMask |= CD_MASK_MTFACE;
+ if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV) {
+ r_cddata_masks->fmask |= CD_MASK_MTFACE;
+ }
/* No need to ask for CD_PREVIEW_MLOOPCOL... */
-
- return dataMask;
}
static bool dependsOnTime(ModifierData *md)
@@ -352,8 +344,10 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
DEG_add_object_relation(ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier");
DEG_add_object_relation(ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier");
}
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier");
- DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier");
+ if (wmd->mask_texture != NULL) {
+ DEG_add_generic_id_relation(ctx->node, &wmd->mask_texture->id, "WeightVGProximity Modifier");
+ }
+ DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGProximity Modifier");
}
static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams))
@@ -489,8 +483,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
const bool use_trgt_faces = (wmd->proximity_flags & MOD_WVG_PROXIMITY_GEOM_FACES) != 0;
if (use_trgt_verts || use_trgt_edges || use_trgt_faces) {
- bool target_mesh_free;
- Mesh *target_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(obr, &target_mesh_free);
+ Mesh *target_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(obr, false);
/* We must check that we do have a valid target_mesh! */
if (target_mesh != NULL) {
@@ -513,10 +506,6 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
MEM_SAFE_FREE(dists_v);
MEM_SAFE_FREE(dists_e);
MEM_SAFE_FREE(dists_f);
-
- if (target_mesh_free) {
- BKE_id_free(NULL, target_mesh);
- }
}
/* Else, fall back to default obj2vert behavior. */
else {
diff --git a/source/blender/modifiers/intern/MOD_wireframe.c b/source/blender/modifiers/intern/MOD_wireframe.c
index a47be7b5244..2f70ab16cf8 100644
--- a/source/blender/modifiers/intern/MOD_wireframe.c
+++ b/source/blender/modifiers/intern/MOD_wireframe.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,20 +12,17 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/modifiers/intern/MOD_wireframe.c
- * \ingroup modifiers
+/** \file
+ * \ingroup modifiers
*/
+#include "BLI_utildefines.h"
+
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
-#include "BLI_utildefines.h"
-
#include "BKE_deform.h"
#include "BKE_mesh.h"
@@ -44,16 +39,14 @@ static void initData(ModifierData *md)
wmd->crease_weight = 1.0f;
}
-static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
+static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
{
WireframeModifierData *wmd = (WireframeModifierData *)md;
- CustomDataMask dataMask = 0;
/* ask for vertexgroups if we need them */
- if (wmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-
- return dataMask;
-
+ if (wmd->defgrp_name[0] != '\0') {
+ r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
+ }
}
static bool dependsOnNormals(ModifierData *UNUSED(md))
@@ -74,9 +67,9 @@ static Mesh *WireframeModifier_do(WireframeModifierData *wmd, Object *ob, Mesh *
&(struct BMeshFromMeshParams){
.calc_face_normal = true,
.add_key_index = false,
- .use_shapekey = true,
- .active_shapekey = ob->shapenr,
- .cd_mask_extra = CD_MASK_ORIGINDEX,
+ .use_shapekey = false,
+ .active_shapekey = 0,
+ .cd_mask_extra = {.vmask = CD_MASK_ORIGINDEX, .emask = CD_MASK_ORIGINDEX, .pmask = CD_MASK_ORIGINDEX},
});
BM_mesh_wireframe(
@@ -94,7 +87,7 @@ static Mesh *WireframeModifier_do(WireframeModifierData *wmd, Object *ob, Mesh *
MAX2(ob->totcol - 1, 0),
false);
- result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0);
+ result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL);
BM_mesh_free(bm);
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 8df114afa24..cc2bfbadf80 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -50,26 +45,31 @@ set(SRC
composite/nodes/node_composite_alphaOver.c
composite/nodes/node_composite_bilateralblur.c
composite/nodes/node_composite_blur.c
+ composite/nodes/node_composite_bokehblur.c
+ composite/nodes/node_composite_bokehimage.c
+ composite/nodes/node_composite_boxmask.c
composite/nodes/node_composite_brightness.c
composite/nodes/node_composite_channelMatte.c
composite/nodes/node_composite_chromaMatte.c
composite/nodes/node_composite_colorMatte.c
composite/nodes/node_composite_colorSpill.c
composite/nodes/node_composite_colorbalance.c
+ composite/nodes/node_composite_colorcorrection.c
composite/nodes/node_composite_common.c
composite/nodes/node_composite_composite.c
composite/nodes/node_composite_cornerpin.c
composite/nodes/node_composite_crop.c
composite/nodes/node_composite_cryptomatte.c
composite/nodes/node_composite_curves.c
- composite/nodes/node_composite_despeckle.c
- composite/nodes/node_composite_doubleEdgeMask.c
composite/nodes/node_composite_defocus.c
+ composite/nodes/node_composite_despeckle.c
composite/nodes/node_composite_diffMatte.c
composite/nodes/node_composite_dilate.c
composite/nodes/node_composite_directionalblur.c
composite/nodes/node_composite_displace.c
composite/nodes/node_composite_distanceMatte.c
+ composite/nodes/node_composite_doubleEdgeMask.c
+ composite/nodes/node_composite_ellipsemask.c
composite/nodes/node_composite_filter.c
composite/nodes/node_composite_flip.c
composite/nodes/node_composite_gamma.c
@@ -80,22 +80,23 @@ set(SRC
composite/nodes/node_composite_image.c
composite/nodes/node_composite_inpaint.c
composite/nodes/node_composite_invert.c
- composite/nodes/node_composite_keyingscreen.c
composite/nodes/node_composite_keying.c
+ composite/nodes/node_composite_keyingscreen.c
composite/nodes/node_composite_lensdist.c
composite/nodes/node_composite_levels.c
composite/nodes/node_composite_lummaMatte.c
+ composite/nodes/node_composite_mapRange.c
composite/nodes/node_composite_mapUV.c
composite/nodes/node_composite_mapValue.c
- composite/nodes/node_composite_mapRange.c
- composite/nodes/node_composite_math.c
composite/nodes/node_composite_mask.c
+ composite/nodes/node_composite_math.c
composite/nodes/node_composite_mixrgb.c
composite/nodes/node_composite_movieclip.c
composite/nodes/node_composite_moviedistortion.c
composite/nodes/node_composite_normal.c
composite/nodes/node_composite_normalize.c
composite/nodes/node_composite_outputFile.c
+ composite/nodes/node_composite_pixelate.c
composite/nodes/node_composite_planetrackdeform.c
composite/nodes/node_composite_premulkey.c
composite/nodes/node_composite_rgb.c
@@ -109,6 +110,8 @@ set(SRC
composite/nodes/node_composite_splitViewer.c
composite/nodes/node_composite_stabilize2d.c
composite/nodes/node_composite_sunbeams.c
+ composite/nodes/node_composite_switch.c
+ composite/nodes/node_composite_switchview.c
composite/nodes/node_composite_texture.c
composite/nodes/node_composite_tonemap.c
composite/nodes/node_composite_trackpos.c
@@ -119,83 +122,68 @@ set(SRC
composite/nodes/node_composite_vecBlur.c
composite/nodes/node_composite_viewer.c
composite/nodes/node_composite_zcombine.c
- composite/nodes/node_composite_bokehblur.c
- composite/nodes/node_composite_bokehimage.c
- composite/nodes/node_composite_boxmask.c
- composite/nodes/node_composite_ellipsemask.c
- composite/nodes/node_composite_switch.c
- composite/nodes/node_composite_switchview.c
- composite/nodes/node_composite_colorcorrection.c
- composite/nodes/node_composite_pixelate.c
composite/node_composite_tree.c
composite/node_composite_util.c
- shader/nodes/node_shader_camera.c
- shader/nodes/node_shader_common.c
- shader/nodes/node_shader_curves.c
- shader/nodes/node_shader_gamma.c
- shader/nodes/node_shader_brightness.c
- shader/nodes/node_shader_hueSatVal.c
- shader/nodes/node_shader_invert.c
- shader/nodes/node_shader_mapping.c
- shader/nodes/node_shader_math.c
- shader/nodes/node_shader_mixRgb.c
- shader/nodes/node_shader_normal.c
- shader/nodes/node_shader_rgb.c
- shader/nodes/node_shader_sepcombRGB.c
- shader/nodes/node_shader_sepcombHSV.c
- shader/nodes/node_shader_sepcombXYZ.c
- shader/nodes/node_shader_squeeze.c
- shader/nodes/node_shader_valToRgb.c
- shader/nodes/node_shader_value.c
- shader/nodes/node_shader_wireframe.c
- shader/nodes/node_shader_wavelength.c
- shader/nodes/node_shader_blackbody.c
- shader/nodes/node_shader_vectMath.c
- shader/nodes/node_shader_vectTransform.c
shader/nodes/node_shader_add_shader.c
shader/nodes/node_shader_ambient_occlusion.c
shader/nodes/node_shader_attribute.c
shader/nodes/node_shader_background.c
+ shader/nodes/node_shader_bevel.c
+ shader/nodes/node_shader_blackbody.c
+ shader/nodes/node_shader_brightness.c
shader/nodes/node_shader_bsdf_anisotropic.c
shader/nodes/node_shader_bsdf_diffuse.c
- shader/nodes/node_shader_bsdf_principled.c
shader/nodes/node_shader_bsdf_glass.c
shader/nodes/node_shader_bsdf_glossy.c
- shader/nodes/node_shader_bsdf_toon.c
+ shader/nodes/node_shader_bsdf_hair.c
+ shader/nodes/node_shader_bsdf_hair_principled.c
+ shader/nodes/node_shader_bsdf_principled.c
shader/nodes/node_shader_bsdf_refraction.c
+ shader/nodes/node_shader_bsdf_toon.c
shader/nodes/node_shader_bsdf_translucent.c
shader/nodes/node_shader_bsdf_transparent.c
shader/nodes/node_shader_bsdf_velvet.c
- shader/nodes/node_shader_bsdf_hair.c
- shader/nodes/node_shader_bsdf_hair_principled.c
shader/nodes/node_shader_bump.c
+ shader/nodes/node_shader_camera.c
+ shader/nodes/node_shader_common.c
+ shader/nodes/node_shader_curves.c
+ shader/nodes/node_shader_displacement.c
+ shader/nodes/node_shader_eevee_specular.c
shader/nodes/node_shader_emission.c
shader/nodes/node_shader_fresnel.c
+ shader/nodes/node_shader_gamma.c
shader/nodes/node_shader_geometry.c
+ shader/nodes/node_shader_hair_info.c
shader/nodes/node_shader_holdout.c
+ shader/nodes/node_shader_hueSatVal.c
shader/nodes/node_shader_ies_light.c
+ shader/nodes/node_shader_invert.c
shader/nodes/node_shader_layer_weight.c
shader/nodes/node_shader_light_falloff.c
shader/nodes/node_shader_light_path.c
+ shader/nodes/node_shader_mapping.c
+ shader/nodes/node_shader_math.c
+ shader/nodes/node_shader_mixRgb.c
shader/nodes/node_shader_mix_shader.c
- shader/nodes/node_shader_shaderToRgb.c
+ shader/nodes/node_shader_normal.c
shader/nodes/node_shader_normal_map.c
shader/nodes/node_shader_object_info.c
- shader/nodes/node_shader_hair_info.c
- shader/nodes/node_shader_eevee_specular.c
- shader/nodes/node_shader_output_lamp.c
+ shader/nodes/node_shader_output_light.c
+ shader/nodes/node_shader_output_linestyle.c
shader/nodes/node_shader_output_material.c
shader/nodes/node_shader_output_world.c
- shader/nodes/node_shader_output_linestyle.c
shader/nodes/node_shader_particle_info.c
+ shader/nodes/node_shader_rgb.c
shader/nodes/node_shader_script.c
+ shader/nodes/node_shader_sepcombHSV.c
+ shader/nodes/node_shader_sepcombRGB.c
+ shader/nodes/node_shader_sepcombXYZ.c
+ shader/nodes/node_shader_shaderToRgb.c
+ shader/nodes/node_shader_squeeze.c
shader/nodes/node_shader_subsurface_scattering.c
shader/nodes/node_shader_tangent.c
- shader/nodes/node_shader_bevel.c
- shader/nodes/node_shader_displacement.c
- shader/nodes/node_shader_vector_displacement.c
shader/nodes/node_shader_tex_brick.c
shader/nodes/node_shader_tex_checker.c
shader/nodes/node_shader_tex_coord.c
@@ -209,11 +197,18 @@ set(SRC
shader/nodes/node_shader_tex_sky.c
shader/nodes/node_shader_tex_voronoi.c
shader/nodes/node_shader_tex_wave.c
- shader/nodes/node_shader_volume_scatter.c
- shader/nodes/node_shader_volume_absorption.c
- shader/nodes/node_shader_volume_principled.c
shader/nodes/node_shader_uvAlongStroke.c
shader/nodes/node_shader_uvmap.c
+ shader/nodes/node_shader_valToRgb.c
+ shader/nodes/node_shader_value.c
+ shader/nodes/node_shader_vectMath.c
+ shader/nodes/node_shader_vectTransform.c
+ shader/nodes/node_shader_vector_displacement.c
+ shader/nodes/node_shader_volume_absorption.c
+ shader/nodes/node_shader_volume_principled.c
+ shader/nodes/node_shader_volume_scatter.c
+ shader/nodes/node_shader_wavelength.c
+ shader/nodes/node_shader_wireframe.c
shader/node_shader_tree.c
shader/node_shader_util.c
@@ -243,10 +238,10 @@ set(SRC
texture/node_texture_tree.c
texture/node_texture_util.c
- intern/node_util.c
- intern/node_exec.c
intern/node_common.c
+ intern/node_exec.c
intern/node_socket.c
+ intern/node_util.c
composite/node_composite_util.h
shader/node_shader_util.h
@@ -255,12 +250,12 @@ set(SRC
NOD_common.h
NOD_composite.h
NOD_shader.h
- NOD_texture.h
NOD_socket.h
NOD_static_types.h
- intern/node_util.h
- intern/node_exec.h
+ NOD_texture.h
intern/node_common.h
+ intern/node_exec.h
+ intern/node_util.h
)
if(WITH_PYTHON)
diff --git a/source/blender/nodes/NOD_common.h b/source/blender/nodes/NOD_common.h
index a8279b4c66a..e49bc023f72 100644
--- a/source/blender/nodes/NOD_common.h
+++ b/source/blender/nodes/NOD_common.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file NOD_common.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#ifndef __NOD_COMMON_H__
diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h
index a728d1e228d..1e43b5011e6 100644
--- a/source/blender/nodes/NOD_composite.h
+++ b/source/blender/nodes/NOD_composite.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file NOD_composite.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#ifndef __NOD_COMPOSITE_H__
diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h
index 2f466b0296c..e88f7a49d30 100644
--- a/source/blender/nodes/NOD_shader.h
+++ b/source/blender/nodes/NOD_shader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file NOD_shader.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#ifndef __NOD_SHADER_H__
@@ -120,7 +112,7 @@ void register_node_type_sh_uvalongstroke(void);
void register_node_type_sh_eevee_metallic(void);
void register_node_type_sh_eevee_specular(void);
-void register_node_type_sh_output_lamp(void);
+void register_node_type_sh_output_light(void);
void register_node_type_sh_output_material(void);
void register_node_type_sh_output_eevee_material(void);
void register_node_type_sh_output_world(void);
diff --git a/source/blender/nodes/NOD_socket.h b/source/blender/nodes/NOD_socket.h
index 3ff65ce4fd9..967ef37d56d 100644
--- a/source/blender/nodes/NOD_socket.h
+++ b/source/blender/nodes/NOD_socket.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file NOD_socket.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
@@ -41,8 +33,8 @@
#include "RNA_types.h"
-struct bNodeTree;
struct bNode;
+struct bNodeTree;
struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp, int in_out);
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h
index 22c2afcc466..a2978970951 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file NOD_static_types.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
/* intentionally no include guard */
@@ -34,224 +28,224 @@
/* WARNING! If you edit those strings, please do the same in relevant nodes files (under blender/nodes/...)! */
/* Tree type Node ID RNA def function Enum name Struct name UI Name UI Description */
-DefNode( Node, NODE_FRAME, def_frame, "FRAME", Frame, "Frame", "" )
-DefNode( Node, NODE_GROUP, def_group, "GROUP", Group, "Group", "" )
-DefNode( Node, NODE_GROUP_INPUT, def_group_input, "GROUP_INPUT", GroupInput, "Group Input", "" )
-DefNode( Node, NODE_GROUP_OUTPUT, def_group_output, "GROUP_OUTPUT", GroupOutput, "Group Output", "" )
-DefNode( Node, NODE_REROUTE, 0, "REROUTE", Reroute, "Reroute", "" )
+DefNode( Node, NODE_FRAME, def_frame, "FRAME", Frame, "Frame", "" );
+DefNode( Node, NODE_GROUP, def_group, "GROUP", Group, "Group", "" );
+DefNode( Node, NODE_GROUP_INPUT, def_group_input, "GROUP_INPUT", GroupInput, "Group Input", "" );
+DefNode( Node, NODE_GROUP_OUTPUT, def_group_output, "GROUP_OUTPUT", GroupOutput, "Group Output", "" );
+DefNode( Node, NODE_REROUTE, 0, "REROUTE", Reroute, "Reroute", "" );
-DefNode( ShaderNode, SH_NODE_RGB, 0, "RGB", RGB, "RGB", "" )
-DefNode( ShaderNode, SH_NODE_VALUE, 0, "VALUE", Value, "Value", "" )
-DefNode( ShaderNode, SH_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "MixRGB", "" )
-DefNode( ShaderNode, SH_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" )
-DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
-DefNode( ShaderNode, SH_NODE_SHADERTORGB, 0, "SHADERTORGB", ShaderToRGB, "Shader to RGB", "" )
-DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
-DefNode( ShaderNode, SH_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
-DefNode( ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" )
-DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" )
-DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curves", "" )
-DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curves", "" )
-DefNode( ShaderNode, SH_NODE_CAMERA, 0, "CAMERA", CameraData, "Camera Data", "" )
-DefNode( ShaderNode, SH_NODE_MATH, def_math, "MATH", Math, "Math", "" )
-DefNode( ShaderNode, SH_NODE_VECT_MATH, def_vector_math, "VECT_MATH", VectorMath, "Vector Math", "" )
-DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze Value", "" )
-DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
-DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" )
-DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" )
-DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" )
+DefNode( ShaderNode, SH_NODE_RGB, 0, "RGB", RGB, "RGB", "" );
+DefNode( ShaderNode, SH_NODE_VALUE, 0, "VALUE", Value, "Value", "" );
+DefNode( ShaderNode, SH_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "MixRGB", "" );
+DefNode( ShaderNode, SH_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" );
+DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" );
+DefNode( ShaderNode, SH_NODE_SHADERTORGB, 0, "SHADERTORGB", ShaderToRGB, "Shader to RGB", "" );
+DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" );
+DefNode( ShaderNode, SH_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" );
+DefNode( ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" );
+DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" );
+DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curves", "" );
+DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curves", "" );
+DefNode( ShaderNode, SH_NODE_CAMERA, 0, "CAMERA", CameraData, "Camera Data", "" );
+DefNode( ShaderNode, SH_NODE_MATH, def_math, "MATH", Math, "Math", "" );
+DefNode( ShaderNode, SH_NODE_VECT_MATH, def_vector_math, "VECT_MATH", VectorMath, "Vector Math", "" );
+DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze Value", "" );
+DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" );
+DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" );
+DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" );
+DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" );
-DefNode( ShaderNode, SH_NODE_OUTPUT_MATERIAL, def_sh_output, "OUTPUT_MATERIAL", OutputMaterial, "Material Output", "" )
-DefNode( ShaderNode, SH_NODE_EEVEE_SPECULAR, 0, "EEVEE_SPECULAR", EeveeSpecular, "Specular", "" )
-DefNode( ShaderNode, SH_NODE_OUTPUT_LIGHT, def_sh_output, "OUTPUT_LIGHT", OutputLight, "Light Output", "" )
-DefNode( ShaderNode, SH_NODE_OUTPUT_WORLD, def_sh_output, "OUTPUT_WORLD", OutputWorld, "World Output", "" )
-DefNode( ShaderNode, SH_NODE_OUTPUT_LINESTYLE, def_sh_output_linestyle,"OUTPUT_LINESTYLE", OutputLineStyle, "Line Style Output", "" )
-DefNode( ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" )
-DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "Layer Weight", "" )
-DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" )
-DefNode( ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" )
-DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "" )
-DefNode( ShaderNode, SH_NODE_AMBIENT_OCCLUSION, def_sh_ambient_occlusion,"AMBIENT_OCCLUSION", AmbientOcclusion, "Ambient Occlusion", "" )
-DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "" )
-DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, def_anisotropic, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_PRINCIPLED, def_principled, "BSDF_PRINCIPLED", BsdfPrincipled, "Principled BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glass, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_REFRACTION, def_refraction, "BSDF_REFRACTION", BsdfRefraction, "Refraction BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_TOON, def_toon, "BSDF_TOON", BsdfToon, "Toon BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_HAIR, def_hair, "BSDF_HAIR", BsdfHair, "Hair BSDF", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_HAIR_PRINCIPLED, def_hair_principled, "BSDF_HAIR_PRINCIPLED", BsdfHairPrincipled, "Principled Hair BSDF", "")
-DefNode( ShaderNode, SH_NODE_SUBSURFACE_SCATTERING, def_sh_subsurface, "SUBSURFACE_SCATTERING",SubsurfaceScattering,"Subsurface Scattering","")
-DefNode( ShaderNode, SH_NODE_VOLUME_ABSORPTION, 0, "VOLUME_ABSORPTION", VolumeAbsorption, "Volume Absorption", "" )
-DefNode( ShaderNode, SH_NODE_VOLUME_SCATTER, 0, "VOLUME_SCATTER", VolumeScatter, "Volume Scatter", "" )
-DefNode( ShaderNode, SH_NODE_VOLUME_PRINCIPLED, 0, "PRINCIPLED_VOLUME", VolumePrincipled, "Principled Volume", "" )
-DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "" )
-DefNode( ShaderNode, SH_NODE_NEW_GEOMETRY, 0, "NEW_GEOMETRY", NewGeometry, "Geometry", "" )
-DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", LightPath, "Light Path", "" )
-DefNode( ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, "LIGHT_FALLOFF", LightFalloff, "Light Falloff", "" )
-DefNode( ShaderNode, SH_NODE_OBJECT_INFO, 0, "OBJECT_INFO", ObjectInfo, "Object Info", "" )
-DefNode( ShaderNode, SH_NODE_PARTICLE_INFO, 0, "PARTICLE_INFO", ParticleInfo, "Particle Info", "" )
-DefNode( ShaderNode, SH_NODE_HAIR_INFO, 0, "HAIR_INFO", HairInfo, "Hair Info", "" )
-DefNode( ShaderNode, SH_NODE_WIREFRAME, def_sh_tex_wireframe, "WIREFRAME", Wireframe, "Wireframe", "" )
-DefNode( ShaderNode, SH_NODE_WAVELENGTH, 0, "WAVELENGTH", Wavelength, "Wavelength", "" )
-DefNode( ShaderNode, SH_NODE_BLACKBODY, 0, "BLACKBODY", Blackbody, "Blackbody", "" )
-DefNode( ShaderNode, SH_NODE_BUMP, def_sh_bump, "BUMP", Bump, "Bump", "" )
-DefNode( ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, "NORMAL_MAP", NormalMap, "Normal Map", "" )
-DefNode( ShaderNode, SH_NODE_TANGENT, def_sh_tangent, "TANGENT", Tangent, "Tangent", "" )
-DefNode( ShaderNode, SH_NODE_SCRIPT, def_sh_script, "SCRIPT", Script, "Script", "" )
-DefNode( ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, "TEX_IMAGE", TexImage, "Image Texture", "" )
-DefNode( ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, "TEX_ENVIRONMENT", TexEnvironment, "Environment Texture","" )
-DefNode( ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, "TEX_SKY", TexSky, "Sky Texture", "" )
-DefNode( ShaderNode, SH_NODE_TEX_GRADIENT, def_sh_tex_gradient, "TEX_GRADIENT", TexGradient, "Gradient Texture", "" )
-DefNode( ShaderNode, SH_NODE_TEX_NOISE, def_sh_tex_noise, "TEX_NOISE", TexNoise, "Noise Texture", "" )
-DefNode( ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, "TEX_MAGIC", TexMagic, "Magic Texture", "" )
-DefNode( ShaderNode, SH_NODE_TEX_WAVE, def_sh_tex_wave, "TEX_WAVE", TexWave, "Wave Texture", "" )
-DefNode( ShaderNode, SH_NODE_TEX_MUSGRAVE, def_sh_tex_musgrave, "TEX_MUSGRAVE", TexMusgrave, "Musgrave Texture", "" )
-DefNode( ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, "TEX_VORONOI", TexVoronoi, "Voronoi Texture", "" )
-DefNode( ShaderNode, SH_NODE_TEX_CHECKER, def_sh_tex_checker, "TEX_CHECKER", TexChecker, "Checker Texture", "" )
-DefNode( ShaderNode, SH_NODE_TEX_BRICK, def_sh_tex_brick, "TEX_BRICK", TexBrick, "Brick Texture", "" )
-DefNode( ShaderNode, SH_NODE_TEX_POINTDENSITY, def_sh_tex_pointdensity,"TEX_POINTDENSITY", TexPointDensity, "Point Density", "" )
-DefNode( ShaderNode, SH_NODE_TEX_COORD, def_sh_tex_coord, "TEX_COORD", TexCoord, "Texture Coordinate","" )
-DefNode( ShaderNode, SH_NODE_VECT_TRANSFORM, def_sh_vect_transform, "VECT_TRANSFORM", VectorTransform, "Vector Transform", "" )
-DefNode( ShaderNode, SH_NODE_SEPHSV, 0, "SEPHSV", SeparateHSV, "Separate HSV", "" )
-DefNode( ShaderNode, SH_NODE_COMBHSV, 0, "COMBHSV", CombineHSV, "Combine HSV", "" )
-DefNode( ShaderNode, SH_NODE_UVMAP, def_sh_uvmap, "UVMAP", UVMap, "UV Map", "" )
-DefNode( ShaderNode, SH_NODE_UVALONGSTROKE, def_sh_uvalongstroke, "UVALONGSTROKE", UVAlongStroke, "UV Along Stroke", "" )
-DefNode( ShaderNode, SH_NODE_SEPXYZ, 0, "SEPXYZ", SeparateXYZ, "Separate XYZ", "" )
-DefNode( ShaderNode, SH_NODE_COMBXYZ, 0, "COMBXYZ", CombineXYZ, "Combine XYZ", "" )
-DefNode( ShaderNode, SH_NODE_BEVEL, def_sh_bevel, "BEVEL", Bevel, "Bevel", "" )
-DefNode( ShaderNode, SH_NODE_DISPLACEMENT, def_sh_displacement, "DISPLACEMENT", Displacement, "Displacement", "" )
-DefNode( ShaderNode, SH_NODE_VECTOR_DISPLACEMENT,def_sh_vector_displacement,"VECTOR_DISPLACEMENT",VectorDisplacement,"Vector Displacement","" )
-DefNode( ShaderNode, SH_NODE_TEX_IES, def_sh_tex_ies, "TEX_IES", TexIES, "IES Texture", "" )
+DefNode( ShaderNode, SH_NODE_OUTPUT_MATERIAL, def_sh_output, "OUTPUT_MATERIAL", OutputMaterial, "Material Output", "" );
+DefNode( ShaderNode, SH_NODE_EEVEE_SPECULAR, 0, "EEVEE_SPECULAR", EeveeSpecular, "Specular", "" );
+DefNode( ShaderNode, SH_NODE_OUTPUT_LIGHT, def_sh_output, "OUTPUT_LIGHT", OutputLight, "Light Output", "" );
+DefNode( ShaderNode, SH_NODE_OUTPUT_WORLD, def_sh_output, "OUTPUT_WORLD", OutputWorld, "World Output", "" );
+DefNode( ShaderNode, SH_NODE_OUTPUT_LINESTYLE, def_sh_output_linestyle,"OUTPUT_LINESTYLE", OutputLineStyle, "Line Style Output", "" );
+DefNode( ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" );
+DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "Layer Weight", "" );
+DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" );
+DefNode( ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" );
+DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "" );
+DefNode( ShaderNode, SH_NODE_AMBIENT_OCCLUSION, def_sh_ambient_occlusion,"AMBIENT_OCCLUSION", AmbientOcclusion, "Ambient Occlusion", "" );
+DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "" );
+DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, def_anisotropic, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_PRINCIPLED, def_principled, "BSDF_PRINCIPLED", BsdfPrincipled, "Principled BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glass, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_REFRACTION, def_refraction, "BSDF_REFRACTION", BsdfRefraction, "Refraction BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_TOON, def_toon, "BSDF_TOON", BsdfToon, "Toon BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_HAIR, def_hair, "BSDF_HAIR", BsdfHair, "Hair BSDF", "" );
+DefNode( ShaderNode, SH_NODE_BSDF_HAIR_PRINCIPLED, def_hair_principled, "BSDF_HAIR_PRINCIPLED", BsdfHairPrincipled, "Principled Hair BSDF", "");
+DefNode( ShaderNode, SH_NODE_SUBSURFACE_SCATTERING, def_sh_subsurface, "SUBSURFACE_SCATTERING",SubsurfaceScattering,"Subsurface Scattering","");
+DefNode( ShaderNode, SH_NODE_VOLUME_ABSORPTION, 0, "VOLUME_ABSORPTION", VolumeAbsorption, "Volume Absorption", "" );
+DefNode( ShaderNode, SH_NODE_VOLUME_SCATTER, 0, "VOLUME_SCATTER", VolumeScatter, "Volume Scatter", "" );
+DefNode( ShaderNode, SH_NODE_VOLUME_PRINCIPLED, 0, "PRINCIPLED_VOLUME", VolumePrincipled, "Principled Volume", "" );
+DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "" );
+DefNode( ShaderNode, SH_NODE_NEW_GEOMETRY, 0, "NEW_GEOMETRY", NewGeometry, "Geometry", "" );
+DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", LightPath, "Light Path", "" );
+DefNode( ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, "LIGHT_FALLOFF", LightFalloff, "Light Falloff", "" );
+DefNode( ShaderNode, SH_NODE_OBJECT_INFO, 0, "OBJECT_INFO", ObjectInfo, "Object Info", "" );
+DefNode( ShaderNode, SH_NODE_PARTICLE_INFO, 0, "PARTICLE_INFO", ParticleInfo, "Particle Info", "" );
+DefNode( ShaderNode, SH_NODE_HAIR_INFO, 0, "HAIR_INFO", HairInfo, "Hair Info", "" );
+DefNode( ShaderNode, SH_NODE_WIREFRAME, def_sh_tex_wireframe, "WIREFRAME", Wireframe, "Wireframe", "" );
+DefNode( ShaderNode, SH_NODE_WAVELENGTH, 0, "WAVELENGTH", Wavelength, "Wavelength", "" );
+DefNode( ShaderNode, SH_NODE_BLACKBODY, 0, "BLACKBODY", Blackbody, "Blackbody", "" );
+DefNode( ShaderNode, SH_NODE_BUMP, def_sh_bump, "BUMP", Bump, "Bump", "" );
+DefNode( ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, "NORMAL_MAP", NormalMap, "Normal Map", "" );
+DefNode( ShaderNode, SH_NODE_TANGENT, def_sh_tangent, "TANGENT", Tangent, "Tangent", "" );
+DefNode( ShaderNode, SH_NODE_SCRIPT, def_sh_script, "SCRIPT", Script, "Script", "" );
+DefNode( ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, "TEX_IMAGE", TexImage, "Image Texture", "" );
+DefNode( ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, "TEX_ENVIRONMENT", TexEnvironment, "Environment Texture","" );
+DefNode( ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, "TEX_SKY", TexSky, "Sky Texture", "" );
+DefNode( ShaderNode, SH_NODE_TEX_GRADIENT, def_sh_tex_gradient, "TEX_GRADIENT", TexGradient, "Gradient Texture", "" );
+DefNode( ShaderNode, SH_NODE_TEX_NOISE, def_sh_tex_noise, "TEX_NOISE", TexNoise, "Noise Texture", "" );
+DefNode( ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, "TEX_MAGIC", TexMagic, "Magic Texture", "" );
+DefNode( ShaderNode, SH_NODE_TEX_WAVE, def_sh_tex_wave, "TEX_WAVE", TexWave, "Wave Texture", "" );
+DefNode( ShaderNode, SH_NODE_TEX_MUSGRAVE, def_sh_tex_musgrave, "TEX_MUSGRAVE", TexMusgrave, "Musgrave Texture", "" );
+DefNode( ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, "TEX_VORONOI", TexVoronoi, "Voronoi Texture", "" );
+DefNode( ShaderNode, SH_NODE_TEX_CHECKER, def_sh_tex_checker, "TEX_CHECKER", TexChecker, "Checker Texture", "" );
+DefNode( ShaderNode, SH_NODE_TEX_BRICK, def_sh_tex_brick, "TEX_BRICK", TexBrick, "Brick Texture", "" );
+DefNode( ShaderNode, SH_NODE_TEX_POINTDENSITY, def_sh_tex_pointdensity,"TEX_POINTDENSITY", TexPointDensity, "Point Density", "" );
+DefNode( ShaderNode, SH_NODE_TEX_COORD, def_sh_tex_coord, "TEX_COORD", TexCoord, "Texture Coordinate","" );
+DefNode( ShaderNode, SH_NODE_VECT_TRANSFORM, def_sh_vect_transform, "VECT_TRANSFORM", VectorTransform, "Vector Transform", "" );
+DefNode( ShaderNode, SH_NODE_SEPHSV, 0, "SEPHSV", SeparateHSV, "Separate HSV", "" );
+DefNode( ShaderNode, SH_NODE_COMBHSV, 0, "COMBHSV", CombineHSV, "Combine HSV", "" );
+DefNode( ShaderNode, SH_NODE_UVMAP, def_sh_uvmap, "UVMAP", UVMap, "UV Map", "" );
+DefNode( ShaderNode, SH_NODE_UVALONGSTROKE, def_sh_uvalongstroke, "UVALONGSTROKE", UVAlongStroke, "UV Along Stroke", "" );
+DefNode( ShaderNode, SH_NODE_SEPXYZ, 0, "SEPXYZ", SeparateXYZ, "Separate XYZ", "" );
+DefNode( ShaderNode, SH_NODE_COMBXYZ, 0, "COMBXYZ", CombineXYZ, "Combine XYZ", "" );
+DefNode( ShaderNode, SH_NODE_BEVEL, def_sh_bevel, "BEVEL", Bevel, "Bevel", "" );
+DefNode( ShaderNode, SH_NODE_DISPLACEMENT, def_sh_displacement, "DISPLACEMENT", Displacement, "Displacement", "" );
+DefNode( ShaderNode, SH_NODE_VECTOR_DISPLACEMENT,def_sh_vector_displacement,"VECTOR_DISPLACEMENT",VectorDisplacement,"Vector Displacement","" );
+DefNode( ShaderNode, SH_NODE_TEX_IES, def_sh_tex_ies, "TEX_IES", TexIES, "IES Texture", "" );
-DefNode( CompositorNode, CMP_NODE_VIEWER, def_cmp_viewer, "VIEWER", Viewer, "Viewer", "" )
-DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" )
-DefNode( CompositorNode, CMP_NODE_VALUE, 0, "VALUE", Value, "Value", "" )
-DefNode( CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix", "" )
-DefNode( CompositorNode, CMP_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" )
-DefNode( CompositorNode, CMP_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
-DefNode( CompositorNode, CMP_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
-DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curves", "" )
-DefNode( CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" )
-DefNode( CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, "ALPHAOVER", AlphaOver, "Alpha Over", "" )
-DefNode( CompositorNode, CMP_NODE_BLUR, def_cmp_blur, "BLUR", Blur, "Blur", "" )
-DefNode( CompositorNode, CMP_NODE_FILTER, def_cmp_filter, "FILTER", Filter, "Filter", "" )
-DefNode( CompositorNode, CMP_NODE_MAP_VALUE, def_cmp_map_value, "MAP_VALUE", MapValue, "Map Value", "" )
-DefNode( CompositorNode, CMP_NODE_MAP_RANGE, def_cmp_map_range, "MAP_RANGE", MapRange, "Map Range", "" )
-DefNode( CompositorNode, CMP_NODE_TIME, def_time, "TIME", Time, "Time", "" )
-DefNode( CompositorNode, CMP_NODE_VECBLUR, def_cmp_vector_blur, "VECBLUR", VecBlur, "Vector Blur", "" )
-DefNode( CompositorNode, CMP_NODE_SEPRGBA, 0, "SEPRGBA", SepRGBA, "Separate RGBA", "" )
-DefNode( CompositorNode, CMP_NODE_SEPHSVA, 0, "SEPHSVA", SepHSVA, "Separate HSVA", "" )
-DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETALPHA", SetAlpha, "Set Alpha", "" )
-DefNode( CompositorNode, CMP_NODE_HUE_SAT, 0, "HUE_SAT", HueSat, "Hue Saturation Value","" )
-DefNode( CompositorNode, CMP_NODE_IMAGE, def_cmp_image, "IMAGE", Image, "Image", "" )
-DefNode( CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, "R_LAYERS", RLayers, "Render Layers", "" )
-DefNode( CompositorNode, CMP_NODE_COMPOSITE, def_cmp_composite, "COMPOSITE", Composite, "Composite", "" )
+DefNode( CompositorNode, CMP_NODE_VIEWER, def_cmp_viewer, "VIEWER", Viewer, "Viewer", "" );
+DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" );
+DefNode( CompositorNode, CMP_NODE_VALUE, 0, "VALUE", Value, "Value", "" );
+DefNode( CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix", "" );
+DefNode( CompositorNode, CMP_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" );
+DefNode( CompositorNode, CMP_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" );
+DefNode( CompositorNode, CMP_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" );
+DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curves", "" );
+DefNode( CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" );
+DefNode( CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, "ALPHAOVER", AlphaOver, "Alpha Over", "" );
+DefNode( CompositorNode, CMP_NODE_BLUR, def_cmp_blur, "BLUR", Blur, "Blur", "" );
+DefNode( CompositorNode, CMP_NODE_FILTER, def_cmp_filter, "FILTER", Filter, "Filter", "" );
+DefNode( CompositorNode, CMP_NODE_MAP_VALUE, def_cmp_map_value, "MAP_VALUE", MapValue, "Map Value", "" );
+DefNode( CompositorNode, CMP_NODE_MAP_RANGE, def_cmp_map_range, "MAP_RANGE", MapRange, "Map Range", "" );
+DefNode( CompositorNode, CMP_NODE_TIME, def_time, "TIME", Time, "Time", "" );
+DefNode( CompositorNode, CMP_NODE_VECBLUR, def_cmp_vector_blur, "VECBLUR", VecBlur, "Vector Blur", "" );
+DefNode( CompositorNode, CMP_NODE_SEPRGBA, 0, "SEPRGBA", SepRGBA, "Separate RGBA", "" );
+DefNode( CompositorNode, CMP_NODE_SEPHSVA, 0, "SEPHSVA", SepHSVA, "Separate HSVA", "" );
+DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETALPHA", SetAlpha, "Set Alpha", "" );
+DefNode( CompositorNode, CMP_NODE_HUE_SAT, 0, "HUE_SAT", HueSat, "Hue Saturation Value","" );
+DefNode( CompositorNode, CMP_NODE_IMAGE, def_cmp_image, "IMAGE", Image, "Image", "" );
+DefNode( CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, "R_LAYERS", RLayers, "Render Layers", "" );
+DefNode( CompositorNode, CMP_NODE_COMPOSITE, def_cmp_composite, "COMPOSITE", Composite, "Composite", "" );
/* NB: OutputFile node has special rna setup function called in rna_nodetree.c */
-DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, 0, "OUTPUT_FILE", OutputFile, "File Output", "" )
-DefNode( CompositorNode, CMP_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
-DefNode( CompositorNode, CMP_NODE_TRANSLATE, def_cmp_translate, "TRANSLATE", Translate, "Translate", "" )
-DefNode( CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, "ZCOMBINE", Zcombine, "Z Combine", "" )
-DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" )
-DefNode( CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" )
-DefNode( CompositorNode, CMP_NODE_INPAINT, def_cmp_inpaint, "INPAINT", Inpaint, "Inpaint", "" )
-DefNode( CompositorNode, CMP_NODE_DESPECKLE, def_cmp_despeckle, "DESPECKLE", Despeckle, "Despeckle", "" )
-DefNode( CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, "ROTATE", Rotate, "Rotate", "" )
-DefNode( CompositorNode, CMP_NODE_SCALE, def_cmp_scale, "SCALE", Scale, "Scale", "" )
-DefNode( CompositorNode, CMP_NODE_SEPYCCA, def_cmp_ycc, "SEPYCCA", SepYCCA, "Separate YCbCrA", "" )
-DefNode( CompositorNode, CMP_NODE_COMBYCCA, def_cmp_ycc, "COMBYCCA", CombYCCA, "Combine YCbCrA", "" )
-DefNode( CompositorNode, CMP_NODE_SEPYUVA, 0, "SEPYUVA", SepYUVA, "Separate YUVA", "" )
-DefNode( CompositorNode, CMP_NODE_COMBYUVA, 0, "COMBYUVA", CombYUVA, "Combine YUVA", "" )
-DefNode( CompositorNode, CMP_NODE_DIFF_MATTE, def_cmp_diff_matte, "DIFF_MATTE", DiffMatte, "Difference Key", "" )
-DefNode( CompositorNode, CMP_NODE_COLOR_SPILL, def_cmp_color_spill, "COLOR_SPILL", ColorSpill, "Color Spill", "" )
-DefNode( CompositorNode, CMP_NODE_CHROMA_MATTE, def_cmp_chroma_matte, "CHROMA_MATTE", ChromaMatte, "Chroma Key", "" )
-DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE, def_cmp_channel_matte, "CHANNEL_MATTE", ChannelMatte, "Channel Key", "" )
-DefNode( CompositorNode, CMP_NODE_FLIP, def_cmp_flip, "FLIP", Flip, "Flip", "" )
-DefNode( CompositorNode, CMP_NODE_SPLITVIEWER, def_cmp_splitviewer, "SPLITVIEWER", SplitViewer, "Split Viewer", "" )
-DefNode( CompositorNode, CMP_NODE_MAP_UV, def_cmp_map_uv, "MAP_UV", MapUV, "Map UV", "" )
-DefNode( CompositorNode, CMP_NODE_ID_MASK, def_cmp_id_mask, "ID_MASK", IDMask, "ID Mask", "" )
-DefNode( CompositorNode, CMP_NODE_DOUBLEEDGEMASK, def_cmp_double_edge_mask,"DOUBLEEDGEMASK", DoubleEdgeMask, "Double Edge Mask", "" )
-DefNode( CompositorNode, CMP_NODE_DEFOCUS, def_cmp_defocus, "DEFOCUS", Defocus, "Defocus", "" )
-DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, "DISPLACE", Displace, "Displace", "" )
-DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" )
-DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" )
-DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, "LUMA_MATTE", LumaMatte, "Luminance Key", "" )
-DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, def_cmp_brightcontrast, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" )
-DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
-DefNode( CompositorNode, CMP_NODE_INVERT, def_cmp_invert, "INVERT", Invert, "Invert", "" )
-DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" )
-DefNode( CompositorNode, CMP_NODE_CROP, def_cmp_crop, "CROP", Crop, "Crop", "" )
-DefNode( CompositorNode, CMP_NODE_DBLUR, def_cmp_dblur, "DBLUR", DBlur, "Directional Blur", "" )
-DefNode( CompositorNode, CMP_NODE_BILATERALBLUR, def_cmp_bilateral_blur, "BILATERALBLUR", Bilateralblur, "Bilateral Blur", "" )
-DefNode( CompositorNode, CMP_NODE_PREMULKEY, def_cmp_premul_key, "PREMULKEY", PremulKey, "Alpha Convert", "" )
-DefNode( CompositorNode, CMP_NODE_GLARE, def_cmp_glare, "GLARE", Glare, "Glare", "" )
-DefNode( CompositorNode, CMP_NODE_TONEMAP, def_cmp_tonemap, "TONEMAP", Tonemap, "Tonemap", "" )
-DefNode( CompositorNode, CMP_NODE_LENSDIST, def_cmp_lensdist, "LENSDIST", Lensdist, "Lens Distortion", "" )
-DefNode( CompositorNode, CMP_NODE_VIEW_LEVELS, def_cmp_levels, "LEVELS", Levels, "Levels", "" )
-DefNode( CompositorNode, CMP_NODE_COLOR_MATTE, def_cmp_color_matte, "COLOR_MATTE", ColorMatte, "Color Key", "" )
-DefNode( CompositorNode, CMP_NODE_DIST_MATTE, def_cmp_distance_matte, "DISTANCE_MATTE", DistanceMatte, "Distance Key", "" )
-DefNode( CompositorNode, CMP_NODE_COLORBALANCE, def_cmp_colorbalance, "COLORBALANCE", ColorBalance, "Color Balance", "" )
-DefNode( CompositorNode, CMP_NODE_HUECORRECT, def_cmp_huecorrect, "HUECORRECT", HueCorrect, "Hue Correct", "" )
-DefNode( CompositorNode, CMP_NODE_MOVIECLIP, def_cmp_movieclip, "MOVIECLIP", MovieClip, "Movie Clip", "" )
-DefNode( CompositorNode, CMP_NODE_TRANSFORM, dev_cmd_transform, "TRANSFORM", Transform, "Transform", "" )
-DefNode( CompositorNode, CMP_NODE_STABILIZE2D, def_cmp_stabilize2d, "STABILIZE2D", Stabilize, "Stabilize 2D", "" )
-DefNode( CompositorNode, CMP_NODE_MOVIEDISTORTION,def_cmp_moviedistortion,"MOVIEDISTORTION",MovieDistortion, "Movie Distortion", "" )
-DefNode( CompositorNode, CMP_NODE_MASK_BOX, def_cmp_boxmask, "BOXMASK", BoxMask, "Box Mask", "" )
-DefNode( CompositorNode, CMP_NODE_MASK_ELLIPSE, def_cmp_ellipsemask, "ELLIPSEMASK", EllipseMask, "Ellipse Mask", "" )
-DefNode( CompositorNode, CMP_NODE_BOKEHIMAGE, def_cmp_bokehimage, "BOKEHIMAGE", BokehImage, "Bokeh Image", "" )
-DefNode( CompositorNode, CMP_NODE_BOKEHBLUR, def_cmp_bokehblur, "BOKEHBLUR", BokehBlur, "Bokeh Blur", "" )
-DefNode( CompositorNode, CMP_NODE_SWITCH, def_cmp_switch, "SWITCH", Switch, "Switch", "" )
-DefNode( CompositorNode, CMP_NODE_SWITCH_VIEW, def_cmp_switch_view, "VIEWSWITCH", SwitchView, "View Switch", "" )
-DefNode( CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection,"COLORCORRECTION",ColorCorrection, "Color Correction", "" )
-DefNode( CompositorNode, CMP_NODE_MASK, def_cmp_mask, "MASK", Mask, "Mask", "" )
-DefNode( CompositorNode, CMP_NODE_KEYINGSCREEN, def_cmp_keyingscreen, "KEYINGSCREEN", KeyingScreen, "Keying Screen", "" )
-DefNode( CompositorNode, CMP_NODE_KEYING, def_cmp_keying, "KEYING", Keying, "Keying", "" )
-DefNode( CompositorNode, CMP_NODE_TRACKPOS, def_cmp_trackpos, "TRACKPOS", TrackPos, "Track Position", "" )
-DefNode( CompositorNode, CMP_NODE_PIXELATE, 0, "PIXELATE", Pixelate, "Pixelate", "" )
-DefNode( CompositorNode, CMP_NODE_PLANETRACKDEFORM,def_cmp_planetrackdeform,"PLANETRACKDEFORM",PlaneTrackDeform,"Plane Track Deform","" )
-DefNode( CompositorNode, CMP_NODE_CORNERPIN, 0, "CORNERPIN", CornerPin, "Corner Pin", "" )
-DefNode( CompositorNode, CMP_NODE_SUNBEAMS, def_cmp_sunbeams, "SUNBEAMS", SunBeams, "Sun Beams", "" )
-DefNode( CompositorNode, CMP_NODE_CRYPTOMATTE, def_cmp_cryptomatte, "CRYPTOMATTE", Cryptomatte, "Cryptomatte", "" )
+DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, 0, "OUTPUT_FILE", OutputFile, "File Output", "" );
+DefNode( CompositorNode, CMP_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" );
+DefNode( CompositorNode, CMP_NODE_TRANSLATE, def_cmp_translate, "TRANSLATE", Translate, "Translate", "" );
+DefNode( CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, "ZCOMBINE", Zcombine, "Z Combine", "" );
+DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" );
+DefNode( CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" );
+DefNode( CompositorNode, CMP_NODE_INPAINT, def_cmp_inpaint, "INPAINT", Inpaint, "Inpaint", "" );
+DefNode( CompositorNode, CMP_NODE_DESPECKLE, def_cmp_despeckle, "DESPECKLE", Despeckle, "Despeckle", "" );
+DefNode( CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, "ROTATE", Rotate, "Rotate", "" );
+DefNode( CompositorNode, CMP_NODE_SCALE, def_cmp_scale, "SCALE", Scale, "Scale", "" );
+DefNode( CompositorNode, CMP_NODE_SEPYCCA, def_cmp_ycc, "SEPYCCA", SepYCCA, "Separate YCbCrA", "" );
+DefNode( CompositorNode, CMP_NODE_COMBYCCA, def_cmp_ycc, "COMBYCCA", CombYCCA, "Combine YCbCrA", "" );
+DefNode( CompositorNode, CMP_NODE_SEPYUVA, 0, "SEPYUVA", SepYUVA, "Separate YUVA", "" );
+DefNode( CompositorNode, CMP_NODE_COMBYUVA, 0, "COMBYUVA", CombYUVA, "Combine YUVA", "" );
+DefNode( CompositorNode, CMP_NODE_DIFF_MATTE, def_cmp_diff_matte, "DIFF_MATTE", DiffMatte, "Difference Key", "" );
+DefNode( CompositorNode, CMP_NODE_COLOR_SPILL, def_cmp_color_spill, "COLOR_SPILL", ColorSpill, "Color Spill", "" );
+DefNode( CompositorNode, CMP_NODE_CHROMA_MATTE, def_cmp_chroma_matte, "CHROMA_MATTE", ChromaMatte, "Chroma Key", "" );
+DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE, def_cmp_channel_matte, "CHANNEL_MATTE", ChannelMatte, "Channel Key", "" );
+DefNode( CompositorNode, CMP_NODE_FLIP, def_cmp_flip, "FLIP", Flip, "Flip", "" );
+DefNode( CompositorNode, CMP_NODE_SPLITVIEWER, def_cmp_splitviewer, "SPLITVIEWER", SplitViewer, "Split Viewer", "" );
+DefNode( CompositorNode, CMP_NODE_MAP_UV, def_cmp_map_uv, "MAP_UV", MapUV, "Map UV", "" );
+DefNode( CompositorNode, CMP_NODE_ID_MASK, def_cmp_id_mask, "ID_MASK", IDMask, "ID Mask", "" );
+DefNode( CompositorNode, CMP_NODE_DOUBLEEDGEMASK, def_cmp_double_edge_mask,"DOUBLEEDGEMASK", DoubleEdgeMask, "Double Edge Mask", "" );
+DefNode( CompositorNode, CMP_NODE_DEFOCUS, def_cmp_defocus, "DEFOCUS", Defocus, "Defocus", "" );
+DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, "DISPLACE", Displace, "Displace", "" );
+DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" );
+DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" );
+DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, "LUMA_MATTE", LumaMatte, "Luminance Key", "" );
+DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, def_cmp_brightcontrast, "BRIGHTCONTRAST", BrightContrast, "Bright/Contrast", "" );
+DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" );
+DefNode( CompositorNode, CMP_NODE_INVERT, def_cmp_invert, "INVERT", Invert, "Invert", "" );
+DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" );
+DefNode( CompositorNode, CMP_NODE_CROP, def_cmp_crop, "CROP", Crop, "Crop", "" );
+DefNode( CompositorNode, CMP_NODE_DBLUR, def_cmp_dblur, "DBLUR", DBlur, "Directional Blur", "" );
+DefNode( CompositorNode, CMP_NODE_BILATERALBLUR, def_cmp_bilateral_blur, "BILATERALBLUR", Bilateralblur, "Bilateral Blur", "" );
+DefNode( CompositorNode, CMP_NODE_PREMULKEY, def_cmp_premul_key, "PREMULKEY", PremulKey, "Alpha Convert", "" );
+DefNode( CompositorNode, CMP_NODE_GLARE, def_cmp_glare, "GLARE", Glare, "Glare", "" );
+DefNode( CompositorNode, CMP_NODE_TONEMAP, def_cmp_tonemap, "TONEMAP", Tonemap, "Tonemap", "" );
+DefNode( CompositorNode, CMP_NODE_LENSDIST, def_cmp_lensdist, "LENSDIST", Lensdist, "Lens Distortion", "" );
+DefNode( CompositorNode, CMP_NODE_VIEW_LEVELS, def_cmp_levels, "LEVELS", Levels, "Levels", "" );
+DefNode( CompositorNode, CMP_NODE_COLOR_MATTE, def_cmp_color_matte, "COLOR_MATTE", ColorMatte, "Color Key", "" );
+DefNode( CompositorNode, CMP_NODE_DIST_MATTE, def_cmp_distance_matte, "DISTANCE_MATTE", DistanceMatte, "Distance Key", "" );
+DefNode( CompositorNode, CMP_NODE_COLORBALANCE, def_cmp_colorbalance, "COLORBALANCE", ColorBalance, "Color Balance", "" );
+DefNode( CompositorNode, CMP_NODE_HUECORRECT, def_cmp_huecorrect, "HUECORRECT", HueCorrect, "Hue Correct", "" );
+DefNode( CompositorNode, CMP_NODE_MOVIECLIP, def_cmp_movieclip, "MOVIECLIP", MovieClip, "Movie Clip", "" );
+DefNode( CompositorNode, CMP_NODE_TRANSFORM, dev_cmd_transform, "TRANSFORM", Transform, "Transform", "" );
+DefNode( CompositorNode, CMP_NODE_STABILIZE2D, def_cmp_stabilize2d, "STABILIZE2D", Stabilize, "Stabilize 2D", "" );
+DefNode( CompositorNode, CMP_NODE_MOVIEDISTORTION,def_cmp_moviedistortion,"MOVIEDISTORTION",MovieDistortion, "Movie Distortion", "" );
+DefNode( CompositorNode, CMP_NODE_MASK_BOX, def_cmp_boxmask, "BOXMASK", BoxMask, "Box Mask", "" );
+DefNode( CompositorNode, CMP_NODE_MASK_ELLIPSE, def_cmp_ellipsemask, "ELLIPSEMASK", EllipseMask, "Ellipse Mask", "" );
+DefNode( CompositorNode, CMP_NODE_BOKEHIMAGE, def_cmp_bokehimage, "BOKEHIMAGE", BokehImage, "Bokeh Image", "" );
+DefNode( CompositorNode, CMP_NODE_BOKEHBLUR, def_cmp_bokehblur, "BOKEHBLUR", BokehBlur, "Bokeh Blur", "" );
+DefNode( CompositorNode, CMP_NODE_SWITCH, def_cmp_switch, "SWITCH", Switch, "Switch", "" );
+DefNode( CompositorNode, CMP_NODE_SWITCH_VIEW, def_cmp_switch_view, "VIEWSWITCH", SwitchView, "View Switch", "" );
+DefNode( CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection,"COLORCORRECTION",ColorCorrection, "Color Correction", "" );
+DefNode( CompositorNode, CMP_NODE_MASK, def_cmp_mask, "MASK", Mask, "Mask", "" );
+DefNode( CompositorNode, CMP_NODE_KEYINGSCREEN, def_cmp_keyingscreen, "KEYINGSCREEN", KeyingScreen, "Keying Screen", "" );
+DefNode( CompositorNode, CMP_NODE_KEYING, def_cmp_keying, "KEYING", Keying, "Keying", "" );
+DefNode( CompositorNode, CMP_NODE_TRACKPOS, def_cmp_trackpos, "TRACKPOS", TrackPos, "Track Position", "" );
+DefNode( CompositorNode, CMP_NODE_PIXELATE, 0, "PIXELATE", Pixelate, "Pixelate", "" );
+DefNode( CompositorNode, CMP_NODE_PLANETRACKDEFORM,def_cmp_planetrackdeform,"PLANETRACKDEFORM",PlaneTrackDeform,"Plane Track Deform","" );
+DefNode( CompositorNode, CMP_NODE_CORNERPIN, 0, "CORNERPIN", CornerPin, "Corner Pin", "" );
+DefNode( CompositorNode, CMP_NODE_SUNBEAMS, def_cmp_sunbeams, "SUNBEAMS", SunBeams, "Sun Beams", "" );
+DefNode( CompositorNode, CMP_NODE_CRYPTOMATTE, def_cmp_cryptomatte, "CRYPTOMATTE", Cryptomatte, "Cryptomatte", "" );
-DefNode( TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" )
-DefNode( TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" )
-DefNode( TextureNode, TEX_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
-DefNode( TextureNode, TEX_NODE_BRICKS, def_tex_bricks, "BRICKS", Bricks, "Bricks", "" )
-DefNode( TextureNode, TEX_NODE_MATH, def_math, "MATH", Math, "Math", "" )
-DefNode( TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" )
-DefNode( TextureNode, TEX_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
-DefNode( TextureNode, TEX_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" )
-DefNode( TextureNode, TEX_NODE_IMAGE, def_tex_image, "IMAGE", Image, "Image", "" )
-DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" )
-DefNode( TextureNode, TEX_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
-DefNode( TextureNode, TEX_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" )
-DefNode( TextureNode, TEX_NODE_CURVE_TIME, def_time, "CURVE_TIME", CurveTime, "Curve Time", "" )
-DefNode( TextureNode, TEX_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" )
-DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" )
-DefNode( TextureNode, TEX_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" )
-DefNode( TextureNode, TEX_NODE_COORD, 0, "COORD", Coordinates, "Coordinates", "" )
-DefNode( TextureNode, TEX_NODE_DISTANCE, 0, "DISTANCE", Distance, "Distance", "" )
-DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Combine RGBA", "" )
-DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Separate RGBA", "" )
-DefNode( TextureNode, TEX_NODE_VALTONOR, 0, "VALTONOR", ValToNor, "Value to Normal", "" )
-DefNode( TextureNode, TEX_NODE_SCALE, 0, "SCALE", Scale, "Scale", "" )
-DefNode( TextureNode, TEX_NODE_AT, 0, "AT", At, "At", "" )
+DefNode( TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" );
+DefNode( TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" );
+DefNode( TextureNode, TEX_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" );
+DefNode( TextureNode, TEX_NODE_BRICKS, def_tex_bricks, "BRICKS", Bricks, "Bricks", "" );
+DefNode( TextureNode, TEX_NODE_MATH, def_math, "MATH", Math, "Math", "" );
+DefNode( TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" );
+DefNode( TextureNode, TEX_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" );
+DefNode( TextureNode, TEX_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" );
+DefNode( TextureNode, TEX_NODE_IMAGE, def_tex_image, "IMAGE", Image, "Image", "" );
+DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" );
+DefNode( TextureNode, TEX_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" );
+DefNode( TextureNode, TEX_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" );
+DefNode( TextureNode, TEX_NODE_CURVE_TIME, def_time, "CURVE_TIME", CurveTime, "Curve Time", "" );
+DefNode( TextureNode, TEX_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" );
+DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" );
+DefNode( TextureNode, TEX_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" );
+DefNode( TextureNode, TEX_NODE_COORD, 0, "COORD", Coordinates, "Coordinates", "" );
+DefNode( TextureNode, TEX_NODE_DISTANCE, 0, "DISTANCE", Distance, "Distance", "" );
+DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Combine RGBA", "" );
+DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Separate RGBA", "" );
+DefNode( TextureNode, TEX_NODE_VALTONOR, 0, "VALTONOR", ValToNor, "Value to Normal", "" );
+DefNode( TextureNode, TEX_NODE_SCALE, 0, "SCALE", Scale, "Scale", "" );
+DefNode( TextureNode, TEX_NODE_AT, 0, "AT", At, "At", "" );
/* procedural textures */
-DefNode( TextureNode, TEX_NODE_PROC+TEX_VORONOI, 0, "TEX_VORONOI", TexVoronoi, "Voronoi", "" )
-DefNode( TextureNode, TEX_NODE_PROC+TEX_BLEND, 0, "TEX_BLEND", TexBlend, "Blend", "" )
-DefNode( TextureNode, TEX_NODE_PROC+TEX_MAGIC, 0, "TEX_MAGIC", TexMagic, "Magic", "" )
-DefNode( TextureNode, TEX_NODE_PROC+TEX_MARBLE, 0, "TEX_MARBLE", TexMarble, "Marble", "" )
-DefNode( TextureNode, TEX_NODE_PROC+TEX_CLOUDS, 0, "TEX_CLOUDS", TexClouds, "Clouds", "" )
-DefNode( TextureNode, TEX_NODE_PROC+TEX_WOOD, 0, "TEX_WOOD", TexWood, "Wood", "" )
-DefNode( TextureNode, TEX_NODE_PROC+TEX_MUSGRAVE, 0, "TEX_MUSGRAVE", TexMusgrave, "Musgrave", "" )
-DefNode( TextureNode, TEX_NODE_PROC+TEX_NOISE, 0, "TEX_NOISE", TexNoise, "Noise", "" )
-DefNode( TextureNode, TEX_NODE_PROC+TEX_STUCCI, 0, "TEX_STUCCI", TexStucci, "Stucci", "" )
-DefNode( TextureNode, TEX_NODE_PROC+TEX_DISTNOISE, 0, "TEX_DISTNOISE", TexDistNoise, "Distorted Noise", "" )
+DefNode( TextureNode, TEX_NODE_PROC+TEX_VORONOI, 0, "TEX_VORONOI", TexVoronoi, "Voronoi", "" );
+DefNode( TextureNode, TEX_NODE_PROC+TEX_BLEND, 0, "TEX_BLEND", TexBlend, "Blend", "" );
+DefNode( TextureNode, TEX_NODE_PROC+TEX_MAGIC, 0, "TEX_MAGIC", TexMagic, "Magic", "" );
+DefNode( TextureNode, TEX_NODE_PROC+TEX_MARBLE, 0, "TEX_MARBLE", TexMarble, "Marble", "" );
+DefNode( TextureNode, TEX_NODE_PROC+TEX_CLOUDS, 0, "TEX_CLOUDS", TexClouds, "Clouds", "" );
+DefNode( TextureNode, TEX_NODE_PROC+TEX_WOOD, 0, "TEX_WOOD", TexWood, "Wood", "" );
+DefNode( TextureNode, TEX_NODE_PROC+TEX_MUSGRAVE, 0, "TEX_MUSGRAVE", TexMusgrave, "Musgrave", "" );
+DefNode( TextureNode, TEX_NODE_PROC+TEX_NOISE, 0, "TEX_NOISE", TexNoise, "Noise", "" );
+DefNode( TextureNode, TEX_NODE_PROC+TEX_STUCCI, 0, "TEX_STUCCI", TexStucci, "Stucci", "" );
+DefNode( TextureNode, TEX_NODE_PROC+TEX_DISTNOISE, 0, "TEX_DISTNOISE", TexDistNoise, "Distorted Noise", "" );
/* undefine macros */
diff --git a/source/blender/nodes/NOD_texture.h b/source/blender/nodes/NOD_texture.h
index 378c96d5882..799957e58f0 100644
--- a/source/blender/nodes/NOD_texture.h
+++ b/source/blender/nodes/NOD_texture.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file NOD_texture.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#ifndef __NOD_TEXTURE_H__
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 4f796da58dc..ffa3cf363c9 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/node_composite_tree.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
@@ -203,9 +195,9 @@ void register_node_tree_type_cmp(void)
tt->type = NTREE_COMPOSIT;
strcpy(tt->idname, "CompositorNodeTree");
- strcpy(tt->ui_name, "Compositing");
+ strcpy(tt->ui_name, N_("Compositing"));
tt->ui_icon = 0; /* defined in drawnode.c */
- strcpy(tt->ui_description, "Compositing nodes");
+ strcpy(tt->ui_description, N_("Compositing nodes"));
tt->free_cache = free_cache;
tt->free_node_cache = free_node_cache;
@@ -222,6 +214,7 @@ void register_node_tree_type_cmp(void)
ntreeTypeAdd(tt);
}
+extern void *COM_linker_hack; /* Quiet warning. */
void *COM_linker_hack = NULL;
void ntreeCompositExecTree(Scene *scene, bNodeTree *ntree, RenderData *rd, int rendering, int do_preview,
@@ -283,7 +276,7 @@ void ntreeCompositTagRender(Scene *curscene)
/* XXX Think using G_MAIN here is valid, since you want to update current file's scene nodes,
* not the ones in temp main generated for rendering?
* This is still rather weak though, ideally render struct would store own main AND original G_MAIN... */
- for (sce = G_MAIN->scene.first; sce; sce = sce->id.next) {
+ for (sce = G_MAIN->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) {
bNode *node;
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index 3f67804685c..323cca70083 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/node_composite_util.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#include "node_composite_util.h"
diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h
index 3f05d7d1bef..d1f6e46b6f3 100644
--- a/source/blender/nodes/composite/node_composite_util.h
+++ b/source/blender/nodes/composite/node_composite_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/node_composite_util.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index da26a337add..0ad273ac6b8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_alphaOver.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -36,11 +28,11 @@ static bNodeSocketTemplate cmp_node_alphaover_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_alphaover_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
index 68937262bf5..b009e1d8128 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Vilem Novak
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_bilateralblur.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c
index 09e1ce654ce..fa455fcd412 100644
--- a/source/blender/nodes/composite/nodes/node_composite_blur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton, Alfredo de Greef, David Millan Escriva,
* Juho Vepsäläinen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_blur.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c
index acb5d100b0a..08cd1f2de28 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton, Alfredo de Greef, David Millan Escriva,
* Juho Vepsäläinen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_bokehblur.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
index 04cdd3367e6..31237584c46 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_bokehimage.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -37,7 +29,7 @@
static bNodeSocketTemplate cmp_node_bokehimage_out[] = {
{ SOCK_RGBA, 0, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.c b/source/blender/nodes/composite/nodes/node_composite_boxmask.c
index 611cf323873..071d0941113 100644
--- a/source/blender/nodes/composite/nodes/node_composite_boxmask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_boxmask.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c
index d44b8cd63cb..dba8d30df68 100644
--- a/source/blender/nodes/composite/nodes/node_composite_brightness.c
+++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_brightness.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -39,11 +31,11 @@ static bNodeSocketTemplate cmp_node_brightcontrast_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_brightcontrast_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_brightcontrast(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
index 52afeabb969..9468169e2a8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_channelMatte.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,13 +28,13 @@
/* ******************* Channel Matte Node ********************************* */
static bNodeSocketTemplate cmp_node_channel_matte_in[] = {
{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static bNodeSocketTemplate cmp_node_channel_matte_out[] = {
{SOCK_RGBA, 0, N_("Image")},
{SOCK_FLOAT, 0, N_("Matte")},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
index 92a56a9c9b6..eda217067e1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_chromaMatte.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,13 +28,13 @@
static bNodeSocketTemplate cmp_node_chroma_in[] = {
{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_RGBA, 1, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static bNodeSocketTemplate cmp_node_chroma_out[] = {
{SOCK_RGBA, 0, N_("Image")},
{SOCK_FLOAT, 0, N_("Matte")},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
index eeccd80a01c..cb13603ea34 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_colorMatte.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,13 +28,13 @@
static bNodeSocketTemplate cmp_node_color_in[] = {
{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_RGBA, 1, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static bNodeSocketTemplate cmp_node_color_out[] = {
{SOCK_RGBA, 0, N_("Image")},
{SOCK_FLOAT, 0, N_("Matte")},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
index 641026c3aad..10009dd4e1c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb, Xavier Thomas
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_colorSpill.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -35,12 +27,12 @@
static bNodeSocketTemplate cmp_node_color_spill_in[] = {
{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static bNodeSocketTemplate cmp_node_color_spill_out[] = {
{SOCK_RGBA, 0, N_("Image")},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
index f9ad8c0ea5f..221b1e5192a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Matt Ebb.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_colorbalance.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -35,12 +27,12 @@
static bNodeSocketTemplate cmp_node_colorbalance_in[] = {
{SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static bNodeSocketTemplate cmp_node_colorbalance_out[] = {
{SOCK_RGBA, 0, N_("Image")},
- {-1, 0, ""}
+ {-1, 0, ""},
};
/* Sync functions update formula parameters for other modes, such that the result is comparable.
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
index 2f7d163a7bf..0d7fe67764d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jeroen Bakker.
- * Monique Dewanchand
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_colorcorrection.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -37,12 +28,12 @@
static bNodeSocketTemplate cmp_node_colorcorrection_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Mask"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, ""}
+ { -1, 0, ""},
};
static bNodeSocketTemplate cmp_node_colorcorrection_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, ""}
+ { -1, 0, ""},
};
static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c
index 8efa44e2e5d..9d72335d720 100644
--- a/source/blender/nodes/composite/nodes/node_composite_common.c
+++ b/source/blender/nodes/composite/nodes/node_composite_common.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton, Alfredo de Greef, David Millan Escriva,
* Juho Vepsäläinen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_common.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "DNA_node_types.h"
diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c
index 13dc8387504..fbddeac4094 100644
--- a/source/blender/nodes/composite/nodes/node_composite_composite.c
+++ b/source/blender/nodes/composite/nodes/node_composite_composite.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_composite.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -36,7 +28,7 @@ static bNodeSocketTemplate cmp_node_composite_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_composite(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_cornerpin.c b/source/blender/nodes/composite/nodes/node_composite_cornerpin.c
index 9758e32da3f..a851e3268b0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_cornerpin.c
+++ b/source/blender/nodes/composite/nodes/node_composite_cornerpin.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_cornerpin.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -45,7 +36,7 @@ static bNodeSocketTemplate inputs[] = {
static bNodeSocketTemplate outputs[] = {
{ SOCK_RGBA, 0, N_("Image")},
{ SOCK_FLOAT, 0, N_("Plane")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_cornerpin(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c
index 0ac400cd8dc..e89fd4cdb2b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_crop.c
+++ b/source/blender/nodes/composite/nodes/node_composite_crop.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Juho Vepsäläinen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_crop.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,11 +28,11 @@
static bNodeSocketTemplate cmp_node_crop_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_crop_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
index af988c0df39..37573846d7e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Stockner, Stefan Werner
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_cryptomatte.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c
index 927d319a90d..b1c59bf0b17 100644
--- a/source/blender/nodes/composite/nodes/node_composite_curves.c
+++ b/source/blender/nodes/composite/nodes/node_composite_curves.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Björn C. Schaefer
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_curves.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -38,7 +30,7 @@
/* custom1 = sfra, custom2 = efra */
static bNodeSocketTemplate cmp_node_time_out[] = {
{ SOCK_FLOAT, 0, N_("Fac")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node)
@@ -66,12 +58,12 @@ void register_node_type_cmp_curve_time(void)
/* **************** CURVE VEC ******************** */
static bNodeSocketTemplate cmp_node_curve_vec_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_curve_vec_out[] = {
{ SOCK_VECTOR, 0, N_("Vector")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node)
@@ -99,12 +91,12 @@ static bNodeSocketTemplate cmp_node_curve_rgb_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_RGBA, 1, N_("Black Level"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 1, N_("White Level"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_curve_rgb_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index 00b73bae5fa..96949657bcf 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_defocus.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -37,11 +29,11 @@
static bNodeSocketTemplate cmp_node_defocus_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_defocus_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.c b/source/blender/nodes/composite/nodes/node_composite_despeckle.c
index 8b6c0956b73..4c5ab27b6cd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_despeckle.c
+++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_despeckle.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -35,11 +27,11 @@
static bNodeSocketTemplate cmp_node_despeckle_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_despeckle_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_despeckle(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index a206b1ab851..6163d433349 100644
--- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_diffMatte.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,13 +28,13 @@
static bNodeSocketTemplate cmp_node_diff_matte_in[] = {
{SOCK_RGBA, 1, N_("Image 1"), 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_RGBA, 1, N_("Image 2"), 1.0f, 1.0f, 1.0f, 1.0f},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static bNodeSocketTemplate cmp_node_diff_matte_out[] = {
{SOCK_RGBA, 0, N_("Image")},
{SOCK_FLOAT, 0, N_("Matte")},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c
index 72d12e0a643..e0ccfb6ec10 100644
--- a/source/blender/nodes/composite/nodes/node_composite_dilate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_dilate.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
index 1bd81fa8390..b0996d76cc1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Alfredo de Greef (eeshlo)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_directionalblur.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c
index da3031a7320..6eb93632e43 100644
--- a/source/blender/nodes/composite/nodes/node_composite_displace.c
+++ b/source/blender/nodes/composite/nodes/node_composite_displace.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_displace.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -40,11 +32,11 @@ static bNodeSocketTemplate cmp_node_displace_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION},
{ SOCK_FLOAT, 1, N_("X Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Y Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_displace_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_displace(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
index fda17fa41bc..8c149076fa8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_distanceMatte.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,13 +28,13 @@
static bNodeSocketTemplate cmp_node_distance_matte_in[] = {
{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_RGBA, 1, N_("Key Color"), 1.0f, 1.0f, 1.0f, 1.0f},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static bNodeSocketTemplate cmp_node_distance_matte_out[] = {
{SOCK_RGBA, 0, N_("Image")},
{SOCK_FLOAT, 0, N_("Matte")},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
index 699dfce2243..04effdc152e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Peter Larabell.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
/* **************** Double Edge Mask ******************** */
@@ -35,11 +27,11 @@
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
+ { -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
+ { -1, 0, "" }, // output socket array terminator
};
void register_node_type_cmp_doubleedgemask(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
index b72a0fb82ae..ccebe3a1e1e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_ellipsemask.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c
index ef8c80cecb4..a685116839d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.c
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_filter.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,11 +28,11 @@
static bNodeSocketTemplate cmp_node_filter_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_filter_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_filter(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c
index 71c377b9a66..06485ae58ee 100644
--- a/source/blender/nodes/composite/nodes/node_composite_flip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_flip.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_flip.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -35,12 +27,12 @@
/* **************** Flip ******************** */
static bNodeSocketTemplate cmp_node_flip_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_flip_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_flip(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c
index 30d399d3f73..a912387660a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_gamma.c
+++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_gamma.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -37,11 +29,11 @@
static bNodeSocketTemplate cmp_node_gamma_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Gamma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_gamma_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_gamma(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c
index 33534ad84c6..f28c80c9367 100644
--- a/source/blender/nodes/composite/nodes/node_composite_glare.c
+++ b/source/blender/nodes/composite/nodes/node_composite_glare.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Alfredo de Greef (eeshlo)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_glare.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -34,11 +26,11 @@
static bNodeSocketTemplate cmp_node_glare_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_glare_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
index 372d62470b4..f02dba62114 100644
--- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_hueSatVal.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -40,11 +32,11 @@ static bNodeSocketTemplate cmp_node_hue_sat_in[] = {
{ SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR},
{ SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR},
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_hue_sat_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_hue_sat(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
index 70c73bcb46a..6b16f8df8bd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
+++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Matt Ebb
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_huecorrect.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -35,12 +27,12 @@
static bNodeSocketTemplate cmp_node_huecorrect_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_huecorrect_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c
index 707b68bb06b..6db70413539 100644
--- a/source/blender/nodes/composite/nodes/node_composite_idMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_idMask.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -37,11 +29,11 @@
static bNodeSocketTemplate cmp_node_idmask_in[] = {
{ SOCK_FLOAT, 1, N_("ID value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_idmask_out[] = {
{ SOCK_FLOAT, 0, N_("Alpha")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_idmask(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 856b87631d7..37652daa312 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_image.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -77,7 +69,7 @@ static bNodeSocketTemplate cmp_node_rlayers_out[] = {
{ SOCK_RGBA, 0, N_(RE_PASSNAME_SUBSURFACE_DIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 0, N_(RE_PASSNAME_SUBSURFACE_INDIRECT), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 0, N_(RE_PASSNAME_SUBSURFACE_COLOR), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void cmp_node_image_add_pass_output(bNodeTree *ntree, bNode *node,
@@ -214,6 +206,23 @@ void node_cmp_rlayers_register_pass(bNodeTree *ntree, bNode *node, Scene *scene,
}
}
+static void cmp_node_rlayer_create_outputs_cb(void *UNUSED(userdata), Scene *scene, ViewLayer *view_layer,
+ const char *name, int UNUSED(channels), const char *UNUSED(chanid), int type)
+{
+ /* Register the pass in all scenes that have a render layer node for this layer.
+ * Since multiple scenes can be used in the compositor, the code must loop over all scenes
+ * and check whether their nodetree has a node that needs to be updated. */
+ /* NOTE: using G_MAIN seems valid here,
+ * unless we want to register that for every other temp Main we could generate??? */
+ ntreeCompositRegisterPass(scene->nodetree, scene, view_layer, name, type);
+
+ for (Scene *sce = G_MAIN->scenes.first; sce; sce = sce->id.next) {
+ if (sce->nodetree && sce != scene) {
+ ntreeCompositRegisterPass(sce->nodetree, scene, view_layer, name, type);
+ }
+ }
+}
+
static void cmp_node_rlayer_create_outputs(bNodeTree *ntree, bNode *node, LinkNodePair *available_sockets)
{
Scene *scene = (Scene *)node->id;
@@ -229,7 +238,7 @@ static void cmp_node_rlayer_create_outputs(bNodeTree *ntree, bNode *node, LinkNo
node->storage = data;
RenderEngine *engine = RE_engine_create(engine_type);
- engine_type->update_render_passes(engine, scene, view_layer);
+ RE_engine_update_render_passes(engine, scene, view_layer, cmp_node_rlayer_create_outputs_cb, NULL);
RE_engine_free(engine);
MEM_freeN(data);
@@ -367,7 +376,7 @@ const char *node_cmp_rlayers_sock_to_pass(int sock_index)
RE_PASSNAME_DIFFUSE_DIRECT, RE_PASSNAME_DIFFUSE_INDIRECT, RE_PASSNAME_DIFFUSE_COLOR,
RE_PASSNAME_GLOSSY_DIRECT, RE_PASSNAME_GLOSSY_INDIRECT, RE_PASSNAME_GLOSSY_COLOR,
RE_PASSNAME_TRANSM_DIRECT, RE_PASSNAME_TRANSM_INDIRECT, RE_PASSNAME_TRANSM_COLOR,
- RE_PASSNAME_SUBSURFACE_DIRECT, RE_PASSNAME_SUBSURFACE_INDIRECT, RE_PASSNAME_SUBSURFACE_COLOR
+ RE_PASSNAME_SUBSURFACE_DIRECT, RE_PASSNAME_SUBSURFACE_INDIRECT, RE_PASSNAME_SUBSURFACE_COLOR,
};
if (sock_index > 30) {
return NULL;
@@ -400,7 +409,7 @@ static bool node_composit_poll_rlayers(bNodeType *UNUSED(ntype), bNodeTree *ntre
* Render layers node can only be used in local scene->nodetree,
* since it directly links to the scene.
*/
- for (scene = G.main->scene.first; scene; scene = scene->id.next)
+ for (scene = G.main->scenes.first; scene; scene = scene->id.next)
if (scene->nodetree == ntree)
break;
diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.c b/source/blender/nodes/composite/nodes/node_composite_inpaint.c
index f97f366d0c4..b5fb1b95e9f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_inpaint.c
+++ b/source/blender/nodes/composite/nodes/node_composite_inpaint.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_inpaint.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c
index c3f1fdbf867..7f60180110a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_invert.c
+++ b/source/blender/nodes/composite/nodes/node_composite_invert.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_invert.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.c b/source/blender/nodes/composite/nodes/node_composite_keying.c
index 6dd2bcc9002..39b04c24133 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keying.c
+++ b/source/blender/nodes/composite/nodes/node_composite_keying.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_keying.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "BLT_translation.h"
@@ -35,7 +26,6 @@
#include "DNA_movieclip_types.h"
#include "BLI_math_base.h"
-#include "BLI_math_color.h"
#include "node_composite_util.h"
@@ -46,14 +36,14 @@ static bNodeSocketTemplate cmp_node_keying_in[] = {
{ SOCK_RGBA, 1, "Key Color", 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, "Garbage Matte", 0.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, "Core Matte", 0.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_keying_out[] = {
{ SOCK_RGBA, 0, "Image"},
{ SOCK_FLOAT, 0, "Matte"},
{ SOCK_FLOAT, 0, "Edges"},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
index 0cdf15c0412..8f1bfbfb002 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
+++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_keyingscreen.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "DNA_movieclip_types.h"
@@ -41,7 +32,7 @@
static bNodeSocketTemplate cmp_node_keyingscreen_out[] = {
{ SOCK_RGBA, 0, "Screen"},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_keyingscreen(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.c b/source/blender/nodes/composite/nodes/node_composite_lensdist.c
index 3cc0c5ca73e..3e4364f691f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lensdist.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Alfredo de Greef (eeshlo)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_lensdist.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,11 +28,11 @@ static bNodeSocketTemplate cmp_node_lensdist_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Distort"), 0.f, 0.f, 0.f, 0.f, -0.999f, 1.f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Dispersion"), 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_lensdist_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c
index be9259752d2..296194f5102 100644
--- a/source/blender/nodes/composite/nodes/node_composite_levels.c
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_levels.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,13 +28,13 @@
/* **************** LEVELS ******************** */
static bNodeSocketTemplate cmp_node_view_levels_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_view_levels_out[] = {
{SOCK_FLOAT, 0, N_("Mean")},
{SOCK_FLOAT, 0, N_("Std Dev")},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
index e848c680003..db01397369c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Bob Holcomb .
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_lummaMatte.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,13 +28,13 @@
/* ******************* Luma Matte Node ********************************* */
static bNodeSocketTemplate cmp_node_luma_matte_in[] = {
{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static bNodeSocketTemplate cmp_node_luma_matte_out[] = {
{SOCK_RGBA, 0, N_("Image")},
{SOCK_FLOAT, 0, N_("Matte")},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.c b/source/blender/nodes/composite/nodes/node_composite_mapRange.c
index 2e86dc1d247..a7df95a5713 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapRange.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapRange.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_mapRange.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -39,11 +31,11 @@ static bNodeSocketTemplate cmp_node_map_range_in[] = {
{ SOCK_FLOAT, 1, N_("From Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("To Min"), 0.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("To Max"), 1.0f, 1.0f, 1.0f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_map_range_out[] = {
{ SOCK_FLOAT, 0, N_("Value")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_map_range(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
index dd7cf12420f..aa3370d99fb 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_mapUV.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -37,11 +29,11 @@
static bNodeSocketTemplate cmp_node_mapuv_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_VECTOR, 1, N_("UV"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_mapuv_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_mapuv(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
index d9e8a80a569..5eff355c76d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_mapValue.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -35,11 +27,11 @@
/* **************** MAP VALUE ******************** */
static bNodeSocketTemplate cmp_node_map_value_in[] = {
{ SOCK_FLOAT, 1, N_("Value"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_map_value_out[] = {
{ SOCK_FLOAT, 0, N_("Value")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.c b/source/blender/nodes/composite/nodes/node_composite_mask.c
index f61fc343433..69f2931d236 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mask.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2012 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_mask.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "DNA_mask_types.h"
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c
index e40621d3210..00d9dda8dcc 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.c
+++ b/source/blender/nodes/composite/nodes/node_composite_math.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_math.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
index 765b19b8d9c..a808a5faaa9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_mixrgb.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -36,11 +28,11 @@ static bNodeSocketTemplate cmp_node_mix_rgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_mix_rgb_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
/* custom1 = mix type */
diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
index 0fece9dd4f6..db8a1d52205 100644
--- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_movieclip.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -41,7 +32,7 @@ static bNodeSocketTemplate cmp_node_movieclip_out[] = {
{ SOCK_FLOAT, 1, N_("Offset Y")},
{ SOCK_FLOAT, 1, N_("Scale")},
{ SOCK_FLOAT, 1, N_("Angle")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void init(const bContext *C, PointerRNA *ptr)
diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
index 4149a0eec9d..9366be94227 100644
--- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
+++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_moviedistortion.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -38,12 +29,12 @@
static bNodeSocketTemplate cmp_node_moviedistortion_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_moviedistortion_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c
index 7ba1be1017e..fd256dd32f3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normal.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_normal.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -35,13 +27,13 @@
/* **************** NORMAL ******************** */
static bNodeSocketTemplate cmp_node_normal_in[] = {
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_normal_out[] = {
{ SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION},
{ SOCK_FLOAT, 0, N_("Dot")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_normal(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c
index 9a5cc84797e..9ebe31b5c92 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normalize.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): gsr b3d, and a very minor edit from Robert Holcomb
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_normalize.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index a2a25d5c515..a7e3023cfcf 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_outputFile.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.c b/source/blender/nodes/composite/nodes/node_composite_pixelate.c
index 76844c7952f..ca9159acf0e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_pixelate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jeroen Bakker
- * Monique Dewanchand
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_pixelate.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c
index 415427c360f..2e274f036cc 100644
--- a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c
+++ b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_planetrackdeform.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -41,7 +32,7 @@ static bNodeSocketTemplate cmp_node_planetrackdeform_in[] = {
static bNodeSocketTemplate cmp_node_planetrackdeform_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
{ SOCK_FLOAT, 0, N_("Plane")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void init(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
index 60f3b2bbf63..273c61f88ec 100644
--- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c
+++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_premulkey.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,11 +28,11 @@
static bNodeSocketTemplate cmp_node_premulkey_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_premulkey_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_premulkey(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c
index 2c397d21f7b..85f6f617ef7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rgb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_rgb.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -35,7 +27,7 @@
/* **************** RGB ******************** */
static bNodeSocketTemplate cmp_node_rgb_out[] = {
{ SOCK_RGBA, 0, N_("RGBA"), 0.5f, 0.5f, 0.5f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_rgb(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c
index 0d268766aae..b43e1da5583 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rotate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_rotate.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -37,11 +29,11 @@
static bNodeSocketTemplate cmp_node_rotate_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Degr"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_rotate_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c
index 8041a2e56e9..a98872ea43b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_scale.c
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_scale.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
index 3c0ab9bf4b1..9cb249bab71 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,14 +28,14 @@
/* **************** SEPARATE HSVA ******************** */
static bNodeSocketTemplate cmp_node_sephsva_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_sephsva_out[] = {
{ SOCK_FLOAT, 0, N_("H")},
{ SOCK_FLOAT, 0, N_("S")},
{ SOCK_FLOAT, 0, N_("V")},
{ SOCK_FLOAT, 0, N_("A")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_sephsva(void)
@@ -63,11 +55,11 @@ static bNodeSocketTemplate cmp_node_combhsva_in[] = {
{ SOCK_FLOAT, 1, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_combhsva_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_combhsva(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
index 7269cef0754..ffa034883d8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -35,14 +27,14 @@
/* **************** SEPARATE RGBA ******************** */
static bNodeSocketTemplate cmp_node_seprgba_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_seprgba_out[] = {
{ SOCK_FLOAT, 0, N_("R")},
{ SOCK_FLOAT, 0, N_("G")},
{ SOCK_FLOAT, 0, N_("B")},
{ SOCK_FLOAT, 0, N_("A")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_seprgba(void)
@@ -63,11 +55,11 @@ static bNodeSocketTemplate cmp_node_combrgba_in[] = {
{ SOCK_FLOAT, 1, N_("G"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("B"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_combrgba_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_combrgba(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
index 3f7bea5b837..103a9c51a89 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -70,11 +62,11 @@ static bNodeSocketTemplate cmp_node_combycca_in[] = {
{ SOCK_FLOAT, 1, N_("Cb"), 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Cr"), 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_combycca_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_mode_combycca(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
index 076378e49c0..d8022080ef1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -64,11 +56,11 @@ static bNodeSocketTemplate cmp_node_combyuva_in[] = {
{ SOCK_FLOAT, 1, N_("U"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("A"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_combyuva_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_combyuva(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
index 2c4568cb623..0ef738f0bda 100644
--- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c
+++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_setalpha.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,11 +28,11 @@
static bNodeSocketTemplate cmp_node_setalpha_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_setalpha_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_setalpha(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
index 863c8af66bb..d15fee2b716 100644
--- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_splitViewer.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -39,7 +31,7 @@
static bNodeSocketTemplate cmp_node_splitviewer_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
index 16f5d340ddd..631e463b14e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
+++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_stabilize2d.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -38,12 +29,12 @@
static bNodeSocketTemplate cmp_node_stabilize2d_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_stabilize2d_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void init(const bContext *C, PointerRNA *ptr)
diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.c b/source/blender/nodes/composite/nodes/node_composite_sunbeams.c
index 4761228f724..cc949eded38 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sunbeams.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sunbeams.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,27 +15,21 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_sunbeams.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
static bNodeSocketTemplate inputs[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate outputs[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void init(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c
index 60d8a13d8d7..8ae4934f704 100644
--- a/source/blender/nodes/composite/nodes/node_composite_switch.c
+++ b/source/blender/nodes/composite/nodes/node_composite_switch.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_switch.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "../node_composite_util.h"
@@ -35,12 +27,12 @@
static bNodeSocketTemplate cmp_node_switch_in[] = {
{ SOCK_RGBA, 1, N_("Off"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 1, N_("On"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_switch_out[] = {
{ SOCK_RGBA, 0, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
/* custom1 = mix type */
diff --git a/source/blender/nodes/composite/nodes/node_composite_switchview.c b/source/blender/nodes/composite/nodes/node_composite_switchview.c
index e0d9fa33f13..b15e35e17ac 100644
--- a/source/blender/nodes/composite/nodes/node_composite_switchview.c
+++ b/source/blender/nodes/composite/nodes/node_composite_switchview.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
* Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_switchview.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "BKE_context.h"
@@ -36,7 +28,7 @@
/* **************** SWITCH VIEW ******************** */
static bNodeSocketTemplate cmp_node_switch_view_out[] = {
{ SOCK_RGBA, 0, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocket *ntreeCompositSwitchViewAddSocket(bNodeTree *ntree, bNode *node, const char *name)
diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c
index 8198717a870..e3d80d8e790 100644
--- a/source/blender/nodes/composite/nodes/node_composite_texture.c
+++ b/source/blender/nodes/composite/nodes/node_composite_texture.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_texture.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,12 +28,12 @@
static bNodeSocketTemplate cmp_node_texture_in[] = {
{ SOCK_VECTOR, 1, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_TRANSLATION},
{ SOCK_VECTOR, 1, N_("Scale"), 1.0f, 1.0f, 1.0f, 1.0f, -10.0f, 10.0f, PROP_XYZ},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_texture_out[] = {
{ SOCK_FLOAT, 0, N_("Value")},
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_texture(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
index 3f116efc8cc..4f365496a8c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c
+++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Alfredo de Greef (eeshlo)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_tonemap.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -34,11 +26,11 @@
static bNodeSocketTemplate cmp_node_tonemap_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_tonemap_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.c b/source/blender/nodes/composite/nodes/node_composite_trackpos.c
index 4a00fb5a900..ffbe583155d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_trackpos.c
+++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_trackpos.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -37,7 +28,7 @@ static bNodeSocketTemplate cmp_node_trackpos_out[] = {
{ SOCK_FLOAT, 0, N_("X")},
{ SOCK_FLOAT, 0, N_("Y")},
{ SOCK_VECTOR, 0, N_("Speed"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void init(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c
index 02c2af602af..7819944d50b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_transform.c
+++ b/source/blender/nodes/composite/nodes/node_composite_transform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2011 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_transform.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
#include "node_composite_util.h"
@@ -40,12 +31,12 @@ static bNodeSocketTemplate cmp_node_transform_in[] = {
{ SOCK_FLOAT, 1, N_("Y"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
{ SOCK_FLOAT, 1, N_("Angle"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE},
{ SOCK_FLOAT, 1, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_transform_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_transform(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c
index bfcfa955512..e2973eaf037 100644
--- a/source/blender/nodes/composite/nodes/node_composite_translate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_translate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_translate.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -39,11 +31,11 @@ static bNodeSocketTemplate cmp_node_translate_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("X"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Y"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_translate_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_translate(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
index 16fc98a5e85..c135dac98d3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_valToRgb.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -36,12 +28,12 @@
/* **************** VALTORGB ******************** */
static bNodeSocketTemplate cmp_node_valtorgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_valtorgb_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
{ SOCK_FLOAT, 0, N_("Alpha")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_composit_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node)
@@ -67,11 +59,11 @@ void register_node_type_cmp_valtorgb(void)
/* **************** RGBTOBW ******************** */
static bNodeSocketTemplate cmp_node_rgbtobw_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_rgbtobw_out[] = {
{ SOCK_FLOAT, 0, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_rgbtobw(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_value.c b/source/blender/nodes/composite/nodes/node_composite_value.c
index 33fddbe4471..ecccb5d563e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_value.c
+++ b/source/blender/nodes/composite/nodes/node_composite_value.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_value.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -35,7 +27,7 @@
/* **************** VALUE ******************** */
static bNodeSocketTemplate cmp_node_value_out[] = {
{ SOCK_FLOAT, 0, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_value(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
index a4a56d95a48..a21b5350d38 100644
--- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_vecBlur.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c
index 6221202398a..7248f80a646 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_viewer.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
index dd8f555fcd9..dfda0d1e4a6 100644
--- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c
+++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_zcombine.c
- * \ingroup cmpnodes
+/** \file
+ * \ingroup cmpnodes
*/
@@ -40,12 +32,12 @@ static bNodeSocketTemplate cmp_node_zcombine_in[] = {
{ SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate cmp_node_zcombine_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
{ SOCK_FLOAT, 0, N_("Z")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
void register_node_type_cmp_zcombine(void)
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index 2dbb573f305..88fdc53c856 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/node_common.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#include <string.h>
diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h
index 737489474f9..14342d31204 100644
--- a/source/blender/nodes/intern/node_common.h
+++ b/source/blender/nodes/intern/node_common.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/node_common.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index 09c06e00382..08969fe3c0e 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/node_exec.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
diff --git a/source/blender/nodes/intern/node_exec.h b/source/blender/nodes/intern/node_exec.h
index 6771df76bf9..145bee149d1 100644
--- a/source/blender/nodes/intern/node_exec.h
+++ b/source/blender/nodes/intern/node_exec.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/node_exec.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
@@ -43,9 +35,9 @@
#include "RNA_types.h"
-struct bNodeTree;
struct bNode;
struct bNodeStack;
+struct bNodeTree;
/* Node execution data */
typedef struct bNodeExec {
diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c
index fad57cc410a..351e579d924 100644
--- a/source/blender/nodes/intern/node_socket.c
+++ b/source/blender/nodes/intern/node_socket.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toennne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/node_socket.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#include <limits.h>
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
index 19529794c7c..069a5bb599e 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/node_util.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#include <ctype.h>
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
index 5c0e53c2399..00b2063804b 100644
--- a/source/blender/nodes/intern/node_util.h
+++ b/source/blender/nodes/intern/node_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Nathan Letwory.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/intern/node_util.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
@@ -47,8 +39,8 @@
#include "RNA_access.h"
-struct bNodeTree;
struct bNode;
+struct bNodeTree;
/* data for initializing node execution */
typedef struct bNodeExecContext {
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index 6a8fce76fa7..30cc9d512f7 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,16 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/node_shader_tree.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
#include <string.h>
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
@@ -44,6 +36,7 @@
#include "BLI_listbase.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
+#include "BLI_alloca.h"
#include "BLT_translation.h"
@@ -95,7 +88,7 @@ static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tre
*r_from = &ob->id;
if (ob->type == OB_LAMP) {
*r_id = ob->data;
- *r_ntree = ((Lamp *)ob->data)->nodetree;
+ *r_ntree = ((Light *)ob->data)->nodetree;
}
else {
Material *ma = give_current_material(ob, ob->actcol);
@@ -185,9 +178,9 @@ void register_node_tree_type_sh(void)
tt->type = NTREE_SHADER;
strcpy(tt->idname, "ShaderNodeTree");
- strcpy(tt->ui_name, "Shader Editor");
+ strcpy(tt->ui_name, N_("Shader Editor"));
tt->ui_icon = 0; /* defined in drawnode.c */
- strcpy(tt->ui_description, "Shader nodes");
+ strcpy(tt->ui_description, N_("Shader nodes"));
tt->foreach_nodeclass = foreach_nodeclass;
tt->localize = localize;
@@ -210,6 +203,113 @@ static void ntree_shader_link_builtin_normal(bNodeTree *ntree,
bNode *displacement_node,
bNodeSocket *displacement_socket);
+static bNodeSocket *ntree_shader_node_find_input(bNode *node,
+ const char *identifier);
+
+static bNode *ntree_group_output_node(bNodeTree *ntree);
+
+static bNode *ntree_shader_relink_output_from_group(bNodeTree *ntree,
+ bNode *group_node,
+ bNode *sh_output_node,
+ int target)
+{
+ int i;
+ bNodeTree *group_ntree = (bNodeTree *)group_node->id;
+
+ int sock_len = BLI_listbase_count(&sh_output_node->inputs);
+ bNodeSocket **group_surface_sockets = BLI_array_alloca(group_surface_sockets, sock_len);
+
+ /* Create output sockets to plug output connection to. */
+ i = 0;
+ for (bNodeSocket *sock = sh_output_node->inputs.first; sock; sock = sock->next, ++i) {
+ group_surface_sockets[i] =
+ ntreeAddSocketInterface(group_ntree,
+ SOCK_OUT,
+ sock->typeinfo->idname,
+ sock->name);
+ }
+
+ bNode *group_output_node = ntree_group_output_node(group_ntree);
+
+ /* If no group output node is present, we need to create one. */
+ if (group_output_node == NULL) {
+ group_output_node = nodeAddStaticNode(NULL, group_ntree, NODE_GROUP_OUTPUT);
+ }
+
+ /* Need to update tree so all node instances nodes gets proper sockets. */
+ node_group_verify(ntree, group_node, &group_ntree->id);
+ node_group_output_verify(group_ntree, group_output_node, &group_ntree->id);
+ ntreeUpdateTree(G.main, group_ntree);
+
+ /* Remove other shader output nodes so that only the new one can be selected as active. */
+ for (bNode *node = ntree->nodes.first; node; node = node->next) {
+ if (ELEM(node->type, SH_NODE_OUTPUT_MATERIAL,
+ SH_NODE_OUTPUT_WORLD,
+ SH_NODE_OUTPUT_LIGHT))
+ {
+ nodeFreeNode(ntree, node);
+ }
+ }
+
+ /* Create new shader output node outside the group. */
+ bNode *new_output_node = nodeAddStaticNode(NULL, ntree, sh_output_node->type);
+ new_output_node->custom1 = target;
+
+ i = 0;
+ for (bNodeSocket *sock = sh_output_node->inputs.first; sock; sock = sock->next, ++i) {
+ if (sock->link != NULL) {
+ /* Link the shader output node incoming link to the group output sockets */
+ bNodeSocket *group_output_node_surface_input_sock = nodeFindSocket(group_output_node,
+ SOCK_IN,
+ group_surface_sockets[i]->identifier);
+ nodeAddLink(group_ntree,
+ sock->link->fromnode, sock->link->fromsock,
+ group_output_node, group_output_node_surface_input_sock);
+
+ /* Link the group output sockets to the new shader output node. */
+ bNodeSocket *group_node_surface_output = nodeFindSocket(group_node,
+ SOCK_OUT,
+ group_surface_sockets[i]->identifier);
+ bNodeSocket *output_node_surface_input = ntree_shader_node_find_input(new_output_node, sock->name);
+
+ nodeAddLink(ntree,
+ group_node, group_node_surface_output,
+ new_output_node, output_node_surface_input);
+ }
+ }
+
+ ntreeUpdateTree(G.main, group_ntree);
+ ntreeUpdateTree(G.main, ntree);
+
+ return new_output_node;
+}
+
+static bNode *ntree_shader_output_node_from_group(bNodeTree *ntree, int target)
+{
+ bNode *output_node = NULL;
+
+ /* Search if node groups do not contain valid output nodes (recursively). */
+ for (bNode *node = ntree->nodes.first; node; node = node->next) {
+ if (!ELEM(node->type, NODE_GROUP)) {
+ continue;
+ }
+ if (node->id != NULL) {
+ output_node = ntree_shader_output_node_from_group((bNodeTree *)node->id, target);
+
+ if (output_node == NULL) {
+ output_node = ntreeShaderOutputNode((bNodeTree *)node->id, target);
+ }
+
+ if (output_node != NULL) {
+ /* Output is inside this group node. Create relink to make the output outside the group. */
+ output_node = ntree_shader_relink_output_from_group(ntree, node, output_node, target);
+ break;
+ }
+ }
+ }
+ return output_node;
+}
+
/* Find an output node of the shader tree.
*
* NOTE: it will only return output which is NOT in the group, which isn't how
@@ -345,6 +445,7 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree)
{
bNode *value_node, *group_node;
bNodeSocket *value_socket;
+ bNodeSocketValueVector *src_vector;
bNodeSocketValueRGBA *src_rgba, *dst_rgba;
bNodeSocketValueFloat *src_float, *dst_float;
bool link_added = false;
@@ -368,6 +469,14 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree)
switch (group_socket->type) {
case SOCK_VECTOR:
+ value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_RGB);
+ value_socket = ntree_shader_node_find_output(value_node, "Color");
+ BLI_assert(value_socket != NULL);
+ src_vector = group_socket->default_value;
+ dst_rgba = value_socket->default_value;
+ copy_v3_v3(dst_rgba->value, src_vector->value);
+ dst_rgba->value[3] = 1.0f; /* should never be read */
+ break;
case SOCK_RGBA:
value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_RGB);
value_socket = ntree_shader_node_find_output(value_node, "Color");
@@ -702,9 +811,13 @@ void ntree_shader_tag_nodes(bNodeTree *ntree, bNode *output_node, nTreeTags *tag
/* This one needs to work on a local tree. */
void ntreeGPUMaterialNodes(bNodeTree *localtree, GPUMaterial *mat, bool *has_surface_output, bool *has_volume_output)
{
- bNode *output = ntreeShaderOutputNode(localtree, SHD_OUTPUT_EEVEE);
bNodeTreeExec *exec;
+ /* Extract output nodes from inside nodegroups. */
+ ntree_shader_output_node_from_group(localtree, SHD_OUTPUT_EEVEE);
+
+ bNode *output = ntreeShaderOutputNode(localtree, SHD_OUTPUT_EEVEE);
+
ntree_shader_groups_expand_inputs(localtree);
/* Perform all needed modifications on the tree in order to support
@@ -715,7 +828,7 @@ void ntreeGPUMaterialNodes(bNodeTree *localtree, GPUMaterial *mat, bool *has_sur
/* TODO(fclem): consider moving this to the gpu shader tree evaluation. */
nTreeTags tags = {
.ssr_id = 1.0,
- .sss_id = 1.0
+ .sss_id = 1.0,
};
ntree_shader_tag_nodes(localtree, output, &tags);
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index ca8286f1772..5488706b87d 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/node_shader_util.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h
index 158efc5a6ab..1eca3b8721e 100644
--- a/source/blender/nodes/shader/node_shader_util.h
+++ b/source/blender/nodes/shader/node_shader_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/node_shader_util.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.c b/source/blender/nodes/shader/nodes/node_shader_add_shader.c
index 0661ab59434..3eb5e3831f4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_add_shader.c
+++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -32,12 +24,12 @@
static bNodeSocketTemplate sh_node_add_shader_in[] = {
{ SOCK_SHADER, 1, N_("Shader")},
{ SOCK_SHADER, 1, N_("Shader")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_add_shader_out[] = {
{ SOCK_SHADER, 0, N_("Shader")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_add_shader(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c
index bf5f0ec13c5..e38a97ae9b2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c
+++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -31,15 +23,15 @@
static bNodeSocketTemplate sh_node_ambient_occlusion_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- { SOCK_FLOAT, 0, N_("Distance"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+ { SOCK_FLOAT, 1, N_("Distance"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_ambient_occlusion_out[] = {
- { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 0, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("AO"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c
index aca72ac27cc..6f79b4588bb 100644
--- a/source/blender/nodes/shader/nodes/node_shader_attribute.c
+++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -33,7 +25,7 @@ static bNodeSocketTemplate sh_node_attribute_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
{ SOCK_VECTOR, 0, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_background.c b/source/blender/nodes/shader/nodes/node_shader_background.c
index 38b5883bc1e..8301a5476db 100644
--- a/source/blender/nodes/shader/nodes/node_shader_background.c
+++ b/source/blender/nodes/shader/nodes/node_shader_background.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -32,12 +24,12 @@
static bNodeSocketTemplate sh_node_background_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_background_out[] = {
{ SOCK_SHADER, 0, N_("Background")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_background(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bevel.c b/source/blender/nodes/shader/nodes/node_shader_bevel.c
index 05161bd453a..7b89c7d6f98 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bevel.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bevel.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -30,14 +22,14 @@
/* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_bevel_in[] = {
- { SOCK_FLOAT, 0, N_("Radius"), 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+ { SOCK_FLOAT, 1, N_("Radius"), 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bevel_out[] = {
{ SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_bevel(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_blackbody.c b/source/blender/nodes/shader/nodes/node_shader_blackbody.c
index 28ba3d2c5c8..7e7dcffc8ee 100644
--- a/source/blender/nodes/shader/nodes/node_shader_blackbody.c
+++ b/source/blender/nodes/shader/nodes/node_shader_blackbody.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -30,12 +22,12 @@
/* **************** Blackbody ******************** */
static bNodeSocketTemplate sh_node_blackbody_in[] = {
{ SOCK_FLOAT, 1, N_("Temperature"), 1500.0f, 0.0f, 0.0f, 0.0f, 800.0f, 12000.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_blackbody_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_blackbody(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.c b/source/blender/nodes/shader/nodes/node_shader_brightness.c
index d17a5b9ba6e..5fee57fe0bf 100644
--- a/source/blender/nodes/shader/nodes/node_shader_brightness.c
+++ b/source/blender/nodes/shader/nodes/node_shader_brightness.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "node_shader_util.h"
@@ -34,12 +26,12 @@ static bNodeSocketTemplate sh_node_brightcontrast_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_brightcontrast_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int gpu_shader_brightcontrast(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c
index 6551b20a375..e0303b07e10 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -36,12 +28,12 @@ static bNodeSocketTemplate sh_node_bsdf_anisotropic_in[] = {
{ SOCK_FLOAT, 1, N_("Rotation"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ SOCK_VECTOR, 1, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bsdf_anisotropic_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_anisotropic(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c
index c1b8c748657..15640eba6e9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -33,12 +25,12 @@ static bNodeSocketTemplate sh_node_bsdf_diffuse_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bsdf_diffuse_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c
index b18dcacb98f..20f000dc62b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -34,12 +26,12 @@ static bNodeSocketTemplate sh_node_bsdf_glass_in[] = {
{ SOCK_FLOAT, 1, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_FLOAT, 1, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bsdf_glass_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_glass(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c
index bd1c5e8f348..5c5824814a6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -33,12 +25,12 @@ static bNodeSocketTemplate sh_node_bsdf_glossy_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Roughness"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bsdf_glossy_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_glossy(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c
index d97344ad6a7..6756ca61fb2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -40,7 +32,7 @@ static bNodeSocketTemplate sh_node_bsdf_hair_in[] = {
static bNodeSocketTemplate sh_node_bsdf_hair_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_bsdf_hair(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c
index 83e4bf1731b..0b953c34010 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Stockner, L. E. Segovia
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -49,7 +41,7 @@ static bNodeSocketTemplate sh_node_bsdf_hair_principled_in[] = {
static bNodeSocketTemplate sh_node_bsdf_hair_principled_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
/* Initialize the custom Parametrization property to Color. */
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
index c628fd7a7f5..abc95161cd0 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -50,12 +42,12 @@ static bNodeSocketTemplate sh_node_bsdf_principled_in[] = {
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ SOCK_VECTOR, 1, N_("Clearcoat Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ SOCK_VECTOR, 1, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bsdf_principled_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c
index 0b7b50d0b0a..db4451eea6b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -34,12 +26,12 @@ static bNodeSocketTemplate sh_node_bsdf_refraction_in[] = {
{ SOCK_FLOAT, 1, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_FLOAT, 1, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bsdf_refraction_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_refraction(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c
index 0754a7e5a3b..ed706ca2ae1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -34,12 +26,12 @@ static bNodeSocketTemplate sh_node_bsdf_toon_in[] = {
{ SOCK_FLOAT, 1, N_("Size"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_FLOAT, 1, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bsdf_toon_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_bsdf_toon(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c
index 349db30af14..4dba71e80b4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -32,12 +24,12 @@
static bNodeSocketTemplate sh_node_bsdf_translucent_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bsdf_translucent_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c
index 08ddf221804..a8fbe3afbee 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -31,12 +23,12 @@
static bNodeSocketTemplate sh_node_bsdf_transparent_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bsdf_transparent_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_bsdf_transparent(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c
index 59b831c0dab..15aa58123a2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -33,12 +25,12 @@ static bNodeSocketTemplate sh_node_bsdf_velvet_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Sigma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_bsdf_velvet_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.c b/source/blender/nodes/shader/nodes/node_shader_bump.c
index c806827b71d..8e6cfc5d4cc 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bump.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bump.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_bump.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
#include "node_shader_util.h"
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c
index 9089d415759..95e255dcf1d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_camera.c
+++ b/source/blender/nodes/shader/nodes/node_shader_camera.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_camera.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -37,7 +29,7 @@ static bNodeSocketTemplate sh_node_camera_out[] = {
{ SOCK_VECTOR, 0, N_("View Vector")},
{ SOCK_FLOAT, 0, N_("View Z Depth")},
{ SOCK_FLOAT, 0, N_("View Distance")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int gpu_shader_camera(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c
index 23b27fc5008..c238a3d946d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.c
+++ b/source/blender/nodes/shader/nodes/node_shader_common.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton, Alfredo de Greef, David Millan Escriva,
* Juho Vepsäläinen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_common.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index 243d57339ea..e4c37636347 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_curves.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -35,14 +27,14 @@
/* **************** CURVE VEC ******************** */
static bNodeSocketTemplate sh_node_curve_vec_in[] = {
- { SOCK_FLOAT, 0, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_curve_vec_out[] = {
{ SOCK_VECTOR, 0, N_("Vector")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_exec_curve_vec(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
@@ -91,12 +83,12 @@ void register_node_type_sh_curve_vec(void)
static bNodeSocketTemplate sh_node_curve_rgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR},
{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_curve_rgb_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_exec_curve_rgb(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
@@ -124,11 +116,39 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UN
float *array, layer;
int size;
- curvemapping_initialize(node->storage);
- curvemapping_table_RGBA(node->storage, &array, &size);
+ CurveMapping *cumap = node->storage;
+
+ curvemapping_initialize(cumap);
+ curvemapping_table_RGBA(cumap, &array, &size);
GPUNodeLink *tex = GPU_color_band(mat, size, array, &layer);
- return GPU_stack_link(mat, node, "curves_rgb", in, out, tex, GPU_constant(&layer));
+ float ext_rgba[4][4];
+ float range_rgba[4];
+
+ for (int a = 0; a < CM_TOT; ++a) {
+ const CurveMap *cm = &cumap->cm[a];
+ ext_rgba[a][0] = cm->mintable;
+ ext_rgba[a][2] = cm->maxtable;
+ range_rgba[a] = 1.0f / max_ff(1e-8f, cm->maxtable - cm->mintable);
+ /* Compute extrapolation gradients. */
+ if ((cm->flag & CUMA_EXTEND_EXTRAPOLATE) != 0) {
+ ext_rgba[a][1] = (cm->ext_in[0] != 0.0f) ? (cm->ext_in[1] / (cm->ext_in[0] * range_rgba[a])) : 1e8f;
+ ext_rgba[a][3] = (cm->ext_out[0] != 0.0f) ? (cm->ext_out[1] / (cm->ext_out[0] * range_rgba[a])) : 1e8f;
+ }
+ else {
+ ext_rgba[a][1] = 0.0f;
+ ext_rgba[a][3] = 0.0f;
+ }
+ print_v4_id(ext_rgba[a]);
+ }
+
+ return GPU_stack_link(mat, node, "curves_rgb", in, out, tex,
+ GPU_constant(&layer),
+ GPU_uniform(range_rgba),
+ GPU_uniform(ext_rgba[0]),
+ GPU_uniform(ext_rgba[1]),
+ GPU_uniform(ext_rgba[2]),
+ GPU_uniform(ext_rgba[3]));
}
void register_node_type_sh_curve_rgb(void)
diff --git a/source/blender/nodes/shader/nodes/node_shader_displacement.c b/source/blender/nodes/shader/nodes/node_shader_displacement.c
index 4480cbdf56b..3ab8e3215a8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_displacement.c
+++ b/source/blender/nodes/shader/nodes/node_shader_displacement.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -30,16 +22,16 @@
/* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_displacement_in[] = {
- { SOCK_FLOAT, 0, N_("Height"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- { SOCK_FLOAT, 0, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- { SOCK_FLOAT, 0, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+ { SOCK_FLOAT, 1, N_("Height"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+ { SOCK_FLOAT, 1, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+ { SOCK_FLOAT, 1, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_displacement_out[] = {
{ SOCK_VECTOR, 0, N_("Displacement"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_displacement(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c
index 939cd9f79a2..eb5e3bc7b3c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c
+++ b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Clément Foucault.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -40,12 +32,12 @@ static bNodeSocketTemplate sh_node_eevee_specular_in[] = {
{ SOCK_FLOAT, 1, N_("Clear Coat Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_VECTOR, 1, N_("Clear Coat Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ SOCK_FLOAT, 1, N_("Ambient Occlusion"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_eevee_specular_out[] = {
{ SOCK_SHADER, 0, N_("BSDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_eevee_specular(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.c b/source/blender/nodes/shader/nodes/node_shader_emission.c
index 25194c23d0a..5440ef5e0d0 100644
--- a/source/blender/nodes/shader/nodes/node_shader_emission.c
+++ b/source/blender/nodes/shader/nodes/node_shader_emission.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -32,12 +24,12 @@
static bNodeSocketTemplate sh_node_emission_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_emission_out[] = {
{ SOCK_SHADER, 0, N_("Emission")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_emission(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.c b/source/blender/nodes/shader/nodes/node_shader_fresnel.c
index cb6b35ac4a7..681e361202e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_fresnel.c
+++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -31,12 +23,12 @@
static bNodeSocketTemplate sh_node_fresnel_in[] = {
{ SOCK_FLOAT, 1, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_fresnel_out[] = {
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.c b/source/blender/nodes/shader/nodes/node_shader_gamma.c
index 4a946e92778..06b2ed272c8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_gamma.c
+++ b/source/blender/nodes/shader/nodes/node_shader_gamma.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "node_shader_util.h"
@@ -32,12 +24,12 @@
static bNodeSocketTemplate sh_node_gamma_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Gamma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_gamma_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_exec_gamma(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.c b/source/blender/nodes/shader/nodes/node_shader_geometry.c
index d004e0e80a1..ec9b3a5443e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geometry.c
+++ b/source/blender/nodes/shader/nodes/node_shader_geometry.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -38,15 +30,20 @@ static bNodeSocketTemplate sh_node_geometry_out[] = {
{ SOCK_VECTOR, 0, N_("Parametric"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Backfacing"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Pointiness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_geometry(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
{
+ /* HACK: Don't request GPU_BARYCENTRIC_TEXCO if not used because it will
+ * trigger the use of geometry shader (and the performance penalty it implies). */
+ float val[2] = {0.0f, 0.0f};
+ GPUNodeLink *bary_link = (!out[5].hasoutput) ? GPU_constant(val) : GPU_builtin(GPU_BARYCENTRIC_TEXCO);
+
return GPU_stack_link(mat, node, "node_geometry", in, out,
GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL),
GPU_attribute(CD_ORCO, ""), GPU_builtin(GPU_OBJECT_MATRIX),
- GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_BARYCENTRIC_TEXCO));
+ GPU_builtin(GPU_INVERSE_VIEW_MATRIX), bary_link);
}
/* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.c b/source/blender/nodes/shader/nodes/node_shader_hair_info.c
index 8b2f4b479ad..2191f71a221 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hair_info.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -34,7 +26,7 @@ static bNodeSocketTemplate outputs[] = {
{ SOCK_VECTOR, 0, N_("Tangent Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
/*{ SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},*/
{ SOCK_FLOAT, 0, N_("Random") },
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_hair_info(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_holdout.c b/source/blender/nodes/shader/nodes/node_shader_holdout.c
index 6109022fddf..57394414f4b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_holdout.c
+++ b/source/blender/nodes/shader/nodes/node_shader_holdout.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -30,12 +22,12 @@
/* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_holdout_in[] = {
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_holdout_out[] = {
{ SOCK_SHADER, 0, N_("Holdout")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
index c017765c8e2..1d4b1289fd7 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Juho Vepsäläinen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_hueSatVal.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -40,11 +32,11 @@ static bNodeSocketTemplate sh_node_hue_sat_in[] = {
{ SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_hue_sat_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
/* note: it would be possible to use CMP version for both nodes */
@@ -54,9 +46,8 @@ static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat
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;
- hsv[1] *= sat;
+ hsv[0] = fmodf(hsv[0] + hue + 0.5f, 1.0f);
+ hsv[1] = clamp_f(hsv[1] * sat, 0.0f, 1.0f);
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_ies_light.c b/source/blender/nodes/shader/nodes/node_shader_ies_light.c
index 2714d560862..566deee0c42 100644
--- a/source/blender/nodes/shader/nodes/node_shader_ies_light.c
+++ b/source/blender/nodes/shader/nodes/node_shader_ies_light.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2018 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -32,12 +24,12 @@
static bNodeSocketTemplate sh_node_tex_ies_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ SOCK_FLOAT, 1, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_ies_out[] = {
{ SOCK_FLOAT, 0, N_("Fac")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_ies(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.c b/source/blender/nodes/shader/nodes/node_shader_invert.c
index 448d305b44e..f3d22a5b89f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_invert.c
+++ b/source/blender/nodes/shader/nodes/node_shader_invert.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_invert.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c
index 9c0b0a2f5f6..1dd615bceac 100644
--- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.c
+++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -32,13 +24,13 @@
static bNodeSocketTemplate sh_node_layer_weight_in[] = {
{ SOCK_FLOAT, 1, N_("Blend"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_layer_weight_out[] = {
{ SOCK_FLOAT, 0, N_("Fresnel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Facing"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_layer_weight(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_light_falloff.c b/source/blender/nodes/shader/nodes/node_shader_light_falloff.c
index f32570eaeaa..c3dd65305ab 100644
--- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.c
+++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -30,9 +22,9 @@
/* **************** INPUT ********************* */
static bNodeSocketTemplate sh_node_light_falloff_in[] = {
- { SOCK_FLOAT, 0, N_("Strength"), 100.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
- { SOCK_FLOAT, 0, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- { -1, 0, "" }
+ { SOCK_FLOAT, 1, N_("Strength"), 100.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f},
+ { SOCK_FLOAT, 1, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+ { -1, 0, "" },
};
/* **************** OUTPUT ******************** */
@@ -41,7 +33,7 @@ static bNodeSocketTemplate sh_node_light_falloff_out[] = {
{ SOCK_FLOAT, 0, N_("Quadratic"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Linear"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Constant"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_light_falloff(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.c b/source/blender/nodes/shader/nodes/node_shader_light_path.c
index 23d01ad4417..3584fb542dd 100644
--- a/source/blender/nodes/shader/nodes/node_shader_light_path.c
+++ b/source/blender/nodes/shader/nodes/node_shader_light_path.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -43,7 +35,7 @@ static bNodeSocketTemplate sh_node_light_path_out[] = {
{ SOCK_FLOAT, 0, N_("Glossy Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Transparent Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Transmission Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_light_path(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c
index 282c6a4f147..265d4235c8d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_mapping.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
#include "node_shader_util.h"
@@ -34,12 +26,12 @@
/* **************** MAPPING ******************** */
static bNodeSocketTemplate sh_node_mapping_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_mapping_out[] = {
{ SOCK_VECTOR, 0, N_("Vector")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void *node_shader_initexec_mapping(bNodeExecContext *UNUSED(context),
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c
index a072c686686..a0ecc0f16f1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.c
+++ b/source/blender/nodes/shader/nodes/node_shader_math.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_math.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -280,7 +272,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(
"math_divide", "math_sine", "math_cosine", "math_tangent", "math_asin",
"math_acos", "math_atan", "math_pow", "math_log", "math_min", "math_max",
"math_round", "math_less_than", "math_greater_than", "math_modulo", "math_abs",
- "math_atan2", "math_floor", "math_ceil", "math_fract", "math_sqrt"
+ "math_atan2", "math_floor", "math_ceil", "math_fract", "math_sqrt",
};
switch (node->custom1) {
diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
index 5bf5ce69261..fb7d85ce353 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_mixRgb.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -37,11 +29,11 @@ static bNodeSocketTemplate sh_node_mix_rgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_RGBA, 1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f},
{ SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_mix_rgb_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_exec_mix_rgb(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c
index 1d6c76766b3..345680a5b76 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -33,12 +25,12 @@ static bNodeSocketTemplate sh_node_mix_shader_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_SHADER, 1, N_("Shader")},
{ SOCK_SHADER, 1, N_("Shader")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_mix_shader_out[] = {
{ SOCK_SHADER, 0, N_("Shader")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_mix_shader(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c
index 121cb9cc1a5..63cbabd4556 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_normal.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -35,13 +27,13 @@
/* **************** NORMAL ******************** */
static bNodeSocketTemplate sh_node_normal_in[] = {
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_normal_out[] = {
{ SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION},
{ SOCK_FLOAT, 0, N_("Dot")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
/* generates normal, does dot product */
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.c b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
index c066fea81ad..e0021d44e69 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal_map.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -32,12 +24,12 @@
static bNodeSocketTemplate sh_node_normal_map_in[] = {
{ SOCK_FLOAT, 1, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f},
{ SOCK_RGBA, 1, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_normal_map_out[] = {
{ SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_object_info.c b/source/blender/nodes/shader/nodes/node_shader_object_info.c
index 713e2f749f7..fe3015e689f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_object_info.c
+++ b/source/blender/nodes/shader/nodes/node_shader_object_info.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -34,7 +26,7 @@ static bNodeSocketTemplate sh_node_object_info_out[] = {
{ SOCK_FLOAT, 0, N_("Object Index"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Material Index"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Random"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_object_info(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c b/source/blender/nodes/shader/nodes/node_shader_output_light.c
index f44f5d332cf..e9afefe5ea1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_light.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,30 +15,24 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
/* **************** OUTPUT ******************** */
-static bNodeSocketTemplate sh_node_output_lamp_in[] = {
+static bNodeSocketTemplate sh_node_output_light_in[] = {
{ SOCK_SHADER, 1, N_("Surface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
/* node type definition */
-void register_node_type_sh_output_lamp(void)
+void register_node_type_sh_output_light(void)
{
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_OUTPUT_LIGHT, "Light Output", NODE_CLASS_OUTPUT, 0);
- node_type_socket_templates(&ntype, sh_node_output_lamp_in, NULL);
+ node_type_socket_templates(&ntype, sh_node_output_light_in, NULL);
node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL);
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.c b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.c
index b56d6eca44b..e1c03c53679 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -34,7 +26,7 @@ static bNodeSocketTemplate sh_node_output_linestyle_in[] = {
{ SOCK_FLOAT, 1, N_("Color Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR },
{ SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR },
{ SOCK_FLOAT, 1, N_("Alpha Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR },
- { -1, 0, "" }
+ { -1, 0, "" },
};
/* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.c b/source/blender/nodes/shader/nodes/node_shader_output_material.c
index 81a89177351..3f6cb0d8704 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -35,7 +27,7 @@ static bNodeSocketTemplate sh_node_output_material_in[] = {
{ SOCK_SHADER, 1, N_("Surface")},
{ SOCK_SHADER, 1, N_("Volume")},
{ SOCK_VECTOR, 1, N_("Displacement"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_output_material(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.c b/source/blender/nodes/shader/nodes/node_shader_output_world.c
index 1980e6be5a3..84f52860b5f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_world.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_world.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -32,7 +24,7 @@
static bNodeSocketTemplate sh_node_output_world_in[] = {
{ SOCK_SHADER, 1, N_("Surface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_SHADER, 1, N_("Volume"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_output_world(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.c b/source/blender/nodes/shader/nodes/node_shader_particle_info.c
index 34c4d364fac..3a20dd1ca02 100644
--- a/source/blender/nodes/shader/nodes/node_shader_particle_info.c
+++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb.c b/source/blender/nodes/shader/nodes/node_shader_rgb.c
index 0ddad803270..6d53963cef7 100644
--- a/source/blender/nodes/shader/nodes/node_shader_rgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_rgb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_rgb.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -35,7 +27,7 @@
/* **************** RGB ******************** */
static bNodeSocketTemplate sh_node_rgb_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int gpu_shader_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_script.c b/source/blender/nodes/shader/nodes/node_shader_script.c
index 2d13fc214be..79f140e0687 100644
--- a/source/blender/nodes/shader/nodes/node_shader_script.c
+++ b/source/blender/nodes/shader/nodes/node_shader_script.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_script.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
#include "node_shader_util.h"
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c
index 09cd997f86b..f3d6311a764 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_sepcombHSV.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -35,13 +27,13 @@
/* **************** SEPARATE HSV ******************** */
static bNodeSocketTemplate sh_node_sephsv_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_sephsv_out[] = {
{ SOCK_FLOAT, 0, N_("H")},
{ SOCK_FLOAT, 0, N_("S")},
{ SOCK_FLOAT, 0, N_("V")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_exec_sephsv(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
@@ -76,11 +68,11 @@ static bNodeSocketTemplate sh_node_combhsv_in[] = {
{ SOCK_FLOAT, 1, N_("H"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{ SOCK_FLOAT, 1, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{ SOCK_FLOAT, 1, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_combhsv_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_exec_combhsv(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c
index b4810b95d4b..09f1cc2f973 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Juho Vepsäläinen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_sepcombRGB.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -35,13 +27,13 @@
/* **************** SEPARATE RGBA ******************** */
static bNodeSocketTemplate sh_node_seprgb_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_seprgb_out[] = {
{ SOCK_FLOAT, 0, N_("R")},
{ SOCK_FLOAT, 0, N_("G")},
{ SOCK_FLOAT, 0, N_("B")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_exec_seprgb(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
@@ -78,11 +70,11 @@ static bNodeSocketTemplate sh_node_combrgb_in[] = {
{ SOCK_FLOAT, 1, N_("R"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{ SOCK_FLOAT, 1, N_("G"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{ SOCK_FLOAT, 1, N_("B"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_combrgb_out[] = {
{ SOCK_RGBA, 0, N_("Image")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_exec_combrgb(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c b/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c
index bff8e38b8c8..c2c520c32ce 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Thomas Dinges
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_sepcombXYZ.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -35,13 +27,13 @@
/* **************** SEPARATE XYZ ******************** */
static bNodeSocketTemplate sh_node_sepxyz_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_sepxyz_out[] = {
{ SOCK_FLOAT, 0, N_("X")},
{ SOCK_FLOAT, 0, N_("Y")},
{ SOCK_FLOAT, 0, N_("Z")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int gpu_shader_sepxyz(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
@@ -67,11 +59,11 @@ static bNodeSocketTemplate sh_node_combxyz_in[] = {
{ SOCK_FLOAT, 1, N_("X"), 0.0f, 0.0f, 0.0f, 1.0f, -10000.0f, 10000.0f},
{ SOCK_FLOAT, 1, N_("Y"), 0.0f, 0.0f, 0.0f, 1.0f, -10000.0f, 10000.0f},
{ SOCK_FLOAT, 1, N_("Z"), 0.0f, 0.0f, 0.0f, 1.0f, -10000.0f, 10000.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_combxyz_out[] = {
{ SOCK_VECTOR, 0, N_("Vector")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int gpu_shader_combxyz(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.c b/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.c
index 8617e3414b5..fbb1f97e121 100644
--- a/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Kanzaki Wataru, Kinouti Takahiro
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -31,13 +23,13 @@
static bNodeSocketTemplate sh_node_shadertorgb_in[] = {
{ SOCK_SHADER, 1, N_("Shader")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_shadertorgb_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
{ SOCK_FLOAT, 0, N_("Alpha")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_shadertorgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.c b/source/blender/nodes/shader/nodes/node_shader_squeeze.c
index 51167db857b..1ccfebac08f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_squeeze.c
+++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_squeeze.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c
index 7cc80a0c636..b414dd85eea 100644
--- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c
+++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -36,12 +28,12 @@ static bNodeSocketTemplate sh_node_subsurface_scattering_in[] = {
{ SOCK_FLOAT, 1, N_("Sharpness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_FLOAT, 1, N_("Texture Blur"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_subsurface_scattering_out[] = {
{ SOCK_SHADER, 0, N_("BSSRDF")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_subsurface_scattering(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_tangent.c b/source/blender/nodes/shader/nodes/node_shader_tangent.c
index da3a8e39ccb..673cb9d4936 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tangent.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tangent.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -31,7 +23,7 @@
static bNodeSocketTemplate sh_node_tangent_out[] = {
{ SOCK_VECTOR, 0, N_("Tangent"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tangent(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c
index 4f488025a99..ffd81631a11 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -40,13 +32,13 @@ static bNodeSocketTemplate sh_node_tex_brick_in[] = {
{ SOCK_FLOAT, 1, N_("Bias"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
{ SOCK_FLOAT, 1, N_("Brick Width"), 0.5f, 0.0f, 0.0f, 0.0f, 0.01f, 100.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
{ SOCK_FLOAT, 1, N_("Row Height"), 0.25f, 0.0f, 0.0f, 0.0f, 0.01f, 100.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_brick_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_brick(bNodeTree *UNUSED(ntree), bNode *node)
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 52aa33c033e..80cf1cecae3 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -34,13 +26,13 @@ static bNodeSocketTemplate sh_node_tex_checker_in[] = {
{ SOCK_RGBA, 1, N_("Color1"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 1, N_("Color2"), 0.2f, 0.2f, 0.2f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Scale"), 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_checker_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
index 58fea60f9f5..fb901ea0774 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -39,7 +31,7 @@ static bNodeSocketTemplate sh_node_tex_coord_out[] = {
{ SOCK_VECTOR, 0, N_("Camera"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 0, N_("Window"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 0, N_("Reflection"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *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 ab8ce456b05..3f6c1b92d8b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -31,12 +23,12 @@
static bNodeSocketTemplate sh_node_tex_environment_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_environment_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *node)
@@ -56,8 +48,14 @@ static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *no
static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
{
Image *ima = (Image *)node->id;
- ImageUser *iuser = NULL;
NodeTexEnvironment *tex = node->storage;
+
+ /* We get the image user from the original node, since GPU image keeps
+ * a pointer to it and the dependency refreshes the original. */
+ bNode *node_original = node->original ? node->original : node;
+ NodeTexImage *tex_original = node_original->storage;
+ ImageUser *iuser = &tex_original->iuser;
+
int isdata = tex->color_space == SHD_COLORSPACE_NONE;
GPUNodeLink *outalpha;
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 404463a8fbe..5dd0b5bf37c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Gradienter Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -31,13 +23,13 @@
static bNodeSocketTemplate sh_node_tex_gradient_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_gradient_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode *node)
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 524f7a5c8e2..ba5d34a445f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -31,13 +23,13 @@
static bNodeSocketTemplate sh_node_tex_image_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_image_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
{ SOCK_FLOAT, 0, N_("Alpha"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node)
@@ -59,24 +51,30 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, bNodeExecDat
"node_tex_image_linear",
"node_tex_image_nearest",
"node_tex_image_cubic",
- "node_tex_image_smart"
+ "node_tex_image_smart",
};
static const char *names_box[] = {
"tex_box_sample_linear",
"tex_box_sample_nearest",
"tex_box_sample_cubic",
- "tex_box_sample_smart"
+ "tex_box_sample_smart",
};
static const char *names_clip[] = {
"tex_clip_linear",
"tex_clip_nearest",
"tex_clip_cubic",
- "tex_clip_smart"
+ "tex_clip_smart",
};
Image *ima = (Image *)node->id;
- ImageUser *iuser = NULL;
NodeTexImage *tex = node->storage;
+
+ /* We get the image user from the original node, since GPU image keeps
+ * a pointer to it and the dependency refreshes the original. */
+ bNode *node_original = node->original ? node->original : node;
+ NodeTexImage *tex_original = node_original->storage;
+ ImageUser *iuser = &tex_original->iuser;
+
const char *gpu_node_name = (tex->projection == SHD_PROJ_BOX)
? names_box[tex->interpolation]
: names[tex->interpolation];
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 e24ef04bc57..ba99e53735b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -33,13 +25,13 @@ static bNodeSocketTemplate sh_node_tex_magic_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ SOCK_FLOAT, 1, N_("Scale"), 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
{ SOCK_FLOAT, 1, N_("Distortion"), 1.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_magic_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode *node)
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 5d4f6b7c578..0cfbd225a61 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -37,13 +29,13 @@ static bNodeSocketTemplate sh_node_tex_musgrave_in[] = {
{ SOCK_FLOAT, 1, N_("Lacunarity"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{ SOCK_FLOAT, 1, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
{ SOCK_FLOAT, 1, N_("Gain"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_musgrave_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode *node)
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 310e82d2d6b..65ab7e459c6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -34,13 +26,13 @@ static bNodeSocketTemplate sh_node_tex_noise_in[] = {
{ SOCK_FLOAT, 1, N_("Scale"), 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
{ SOCK_FLOAT, 1, N_("Detail"), 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f},
{ SOCK_FLOAT, 1, N_("Distortion"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_noise_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c
index 1c5f53132bd..56e98520e8b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -34,13 +26,13 @@
static bNodeSocketTemplate sh_node_tex_pointdensity_in[] = {
{SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static bNodeSocketTemplate sh_node_tex_pointdensity_out[] = {
{SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
{SOCK_FLOAT, 0, N_("Density"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
- {-1, 0, ""}
+ {-1, 0, ""},
};
static void node_shader_init_tex_pointdensity(bNodeTree *UNUSED(ntree),
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 821d4b41d09..1fa58396733 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -31,12 +23,12 @@
static bNodeSocketTemplate sh_node_tex_sky_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_sky_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node)
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 059d6348473..bd3dc0d2c79 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -33,13 +25,13 @@ static bNodeSocketTemplate sh_node_tex_voronoi_in[] = {
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ SOCK_FLOAT, 1, N_("Scale"), 5.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
{ SOCK_FLOAT, 1, N_("Exponent"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 32.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_voronoi_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node)
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 db33be2bcb7..660fc0fdcae 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -35,13 +27,13 @@ static bNodeSocketTemplate sh_node_tex_wave_in[] = {
{ SOCK_FLOAT, 1, N_("Distortion"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
{ SOCK_FLOAT, 1, N_("Detail"), 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f},
{ SOCK_FLOAT, 1, N_("Detail Scale"), 1.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_tex_wave_out[] = {
{ SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK},
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR, SOCK_NO_INTERNAL_LINK},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.c b/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.c
index 023f5417e22..1f70b845fed 100644
--- a/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.c
+++ b/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -31,7 +23,7 @@
static bNodeSocketTemplate sh_node_uvalongstroke_out[] = {
{ SOCK_VECTOR, 0, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
/* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_uvmap.c b/source/blender/nodes/shader/nodes/node_shader_uvmap.c
index 9da1056b47f..d2c2341414c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_uvmap.c
+++ b/source/blender/nodes/shader/nodes/node_shader_uvmap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -33,7 +25,7 @@
static bNodeSocketTemplate sh_node_uvmap_out[] = {
{ SOCK_VECTOR, 0, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_uvmap(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
index 1a1d5658d97..51093cd67ad 100644
--- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_valToRgb.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -36,12 +28,12 @@
/* **************** VALTORGB ******************** */
static bNodeSocketTemplate sh_node_valtorgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_valtorgb_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
{ SOCK_FLOAT, 0, N_("Alpha")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_exec_valtorgb(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_value.c b/source/blender/nodes/shader/nodes/node_shader_value.c
index a143b0118e7..6e3428bbdd1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_value.c
+++ b/source/blender/nodes/shader/nodes/node_shader_value.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_value.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
@@ -35,7 +27,7 @@
/* **************** VALUE ******************** */
static bNodeSocketTemplate sh_node_value_out[] = {
{ SOCK_FLOAT, 0, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int gpu_shader_value(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
index 8087e1cab41..cd7a568880f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_vectMath.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
#include "node_shader_util.h"
diff --git a/source/blender/nodes/shader/nodes/node_shader_vectTransform.c b/source/blender/nodes/shader/nodes/node_shader_vectTransform.c
index bce96230403..66def025bff 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vectTransform.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectTransform.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2013 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/shader/nodes/node_shader_vectTransform.c
- * \ingroup shdnodes
+/** \file
+ * \ingroup shdnodes
*/
#include "../node_shader_util.h"
diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c
index 2a40d98baf9..83e6b078be7 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -30,15 +22,15 @@
/* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_vector_displacement_in[] = {
- { SOCK_RGBA, 0, N_("Vector"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE},
- { SOCK_FLOAT, 0, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- { SOCK_FLOAT, 0, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- { -1, 0, "" }
+ { SOCK_RGBA, 1, N_("Vector"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE},
+ { SOCK_FLOAT, 1, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+ { SOCK_FLOAT, 1, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_vector_displacement_out[] = {
{ SOCK_VECTOR, 0, N_("Displacement"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_vector_displacement(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c
index d0ba43d1a15..19dd9bdb5db 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -32,12 +24,12 @@
static bNodeSocketTemplate sh_node_volume_absorption_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_volume_absorption_out[] = {
{ SOCK_SHADER, 0, N_("Volume")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_volume_absorption(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c
index cf458ac8f51..f0ebd9f52be 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -42,12 +34,12 @@ static bNodeSocketTemplate sh_node_volume_principled_in[] = {
{ SOCK_RGBA, 1, N_("Blackbody Tint"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Temperature"), 1000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6500.0f},
{ SOCK_STRING, 1, N_("Temperature Attribute"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_volume_principled_out[] = {
{ SOCK_SHADER, 0, N_("Volume")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void node_shader_init_volume_principled(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c
index 0f97d08803a..d99bc47e25f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -33,12 +25,12 @@ static bNodeSocketTemplate sh_node_volume_scatter_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{ SOCK_FLOAT, 1, N_("Anisotropy"),0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_FACTOR},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_volume_scatter_out[] = {
{ SOCK_SHADER, 0, N_("Volume")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_volume_scatter(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_wavelength.c b/source/blender/nodes/shader/nodes/node_shader_wavelength.c
index edc4333c000..427d9f17a63 100644
--- a/source/blender/nodes/shader/nodes/node_shader_wavelength.c
+++ b/source/blender/nodes/shader/nodes/node_shader_wavelength.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -30,12 +22,12 @@
/* **************** Wavelength ******************** */
static bNodeSocketTemplate sh_node_wavelength_in[] = {
{ SOCK_FLOAT, 1, N_("Wavelength"), 500.0f, 0.0f, 0.0f, 0.0f, 380.0f, 780.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_wavelength_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
/* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_wireframe.c b/source/blender/nodes/shader/nodes/node_shader_wireframe.c
index 3592f98d81d..2a902211ee4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_wireframe.c
+++ b/source/blender/nodes/shader/nodes/node_shader_wireframe.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,6 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
@@ -30,12 +22,12 @@
/* **************** Wireframe ******************** */
static bNodeSocketTemplate sh_node_wireframe_in[] = {
{ SOCK_FLOAT, 1, N_("Size"), 0.01f, 0.0f, 0.0f, 0.0f, 0.0f, 100.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate sh_node_wireframe_out[] = {
{ SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static int node_shader_gpu_wireframe(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
index 6711e644d44..f876ceb0872 100644
--- a/source/blender/nodes/texture/node_texture_tree.c
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/node_texture_tree.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
@@ -164,9 +156,9 @@ void register_node_tree_type_tex(void)
tt->type = NTREE_TEXTURE;
strcpy(tt->idname, "TextureNodeTree");
- strcpy(tt->ui_name, "Texture Node Editor");
+ strcpy(tt->ui_name, N_("Texture Node Editor"));
tt->ui_icon = 0; /* defined in drawnode.c */
- strcpy(tt->ui_description, "Texture nodes");
+ strcpy(tt->ui_description, N_("Texture nodes"));
tt->foreach_nodeclass = foreach_nodeclass;
tt->update = update;
diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c
index ff2e3d20155..cc4ecbfb1d9 100644
--- a/source/blender/nodes/texture/node_texture_util.c
+++ b/source/blender/nodes/texture/node_texture_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/node_texture_util.c
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h
index 6606915c3f7..111b747fa9c 100644
--- a/source/blender/nodes/texture/node_texture_util.h
+++ b/source/blender/nodes/texture/node_texture_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/node_texture_util.h
- * \ingroup nodes
+/** \file
+ * \ingroup nodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_at.c b/source/blender/nodes/texture/nodes/node_texture_at.c
index 690d87b42a9..2e6e7e71578 100644
--- a/source/blender/nodes/texture/nodes/node_texture_at.c
+++ b/source/blender/nodes/texture/nodes/node_texture_at.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): R Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_at.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c
index 43af02acdf2..b9cd696fb2c 100644
--- a/source/blender/nodes/texture/nodes/node_texture_bricks.c
+++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_bricks.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
@@ -47,7 +39,7 @@ static bNodeSocketTemplate inputs[] = {
};
static bNodeSocketTemplate outputs[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, ""}
+ { -1, 0, ""},
};
static void init(bNodeTree *UNUSED(ntree), bNode *node)
diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c
index d7ad642d474..3e647ab07f7 100644
--- a/source/blender/nodes/texture/nodes/node_texture_checker.c
+++ b/source/blender/nodes/texture/nodes/node_texture_checker.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_checker.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c
index 20b1815e436..3efc01d25d6 100644
--- a/source/blender/nodes/texture/nodes/node_texture_common.c
+++ b/source/blender/nodes/texture/nodes/node_texture_common.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,11 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton, Alfredo de Greef, David Millan Escriva,
* Juho Vepsäläinen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_common.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c
index 002da4428cc..c86f5eee983 100644
--- a/source/blender/nodes/texture/nodes/node_texture_compose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_compose.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_compose.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c
index e698ffd0a54..e5b732abfc9 100644
--- a/source/blender/nodes/texture/nodes/node_texture_coord.c
+++ b/source/blender/nodes/texture/nodes/node_texture_coord.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Mathias Panzenböck (panzi) <grosser.meister.morti@gmx.net>.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_coord.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c
index cc734df9586..d0d387f3fa6 100644
--- a/source/blender/nodes/texture/nodes/node_texture_curves.c
+++ b/source/blender/nodes/texture/nodes/node_texture_curves.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_curves.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
@@ -84,12 +76,12 @@ void register_node_type_tex_curve_time(void)
/* **************** CURVE RGB ******************** */
static bNodeSocketTemplate rgb_inputs[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate rgb_outputs[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, ""}
+ { -1, 0, ""},
};
static void rgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c
index 392cff970e7..7b95b6cbf52 100644
--- a/source/blender/nodes/texture/nodes/node_texture_decompose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_decompose.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_distance.c b/source/blender/nodes/texture/nodes/node_texture_distance.c
index 7cd032f7d59..9e75f0bf5af 100644
--- a/source/blender/nodes/texture/nodes/node_texture_distance.c
+++ b/source/blender/nodes/texture/nodes/node_texture_distance.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Mathias Panzenböck (panzi) <grosser.meister.morti@gmx.net>.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_distance.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
index 8316579af93..17f86ecd006 100644
--- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
+++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Juho Vepsäläinen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_hueSatVal.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index 4fccab27b24..9fbbb5c7941 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_image.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c
index 8ef7a7a6ad2..3cd5686478e 100644
--- a/source/blender/nodes/texture/nodes/node_texture_invert.c
+++ b/source/blender/nodes/texture/nodes/node_texture_invert.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_invert.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c
index f786a293080..afa115ed969 100644
--- a/source/blender/nodes/texture/nodes/node_texture_math.c
+++ b/source/blender/nodes/texture/nodes/node_texture_math.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_math.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
index 9fb8332c61a..3734c714e3a 100644
--- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_mixRgb.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c
index 412e3ffb56c..ff9226479c9 100644
--- a/source/blender/nodes/texture/nodes/node_texture_output.c
+++ b/source/blender/nodes/texture/nodes/node_texture_output.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_output.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
@@ -37,7 +29,7 @@
static bNodeSocketTemplate inputs[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION},
- { -1, 0, ""}
+ { -1, 0, ""},
};
/* applies to render pipeline */
diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c
index 47f4683549f..34be50aaeec 100644
--- a/source/blender/nodes/texture/nodes/node_texture_proc.c
+++ b/source/blender/nodes/texture/nodes/node_texture_proc.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_proc.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_rotate.c b/source/blender/nodes/texture/nodes/node_texture_rotate.c
index bc4e56ea81d..2fb63d875fc 100644
--- a/source/blender/nodes/texture/nodes/node_texture_rotate.c
+++ b/source/blender/nodes/texture/nodes/node_texture_rotate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_rotate.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c
index 94ccfd01357..f9b4d5be263 100644
--- a/source/blender/nodes/texture/nodes/node_texture_scale.c
+++ b/source/blender/nodes/texture/nodes/node_texture_scale.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_scale.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index ff405cc9f3e..3adea5f4c0b 100644
--- a/source/blender/nodes/texture/nodes/node_texture_texture.c
+++ b/source/blender/nodes/texture/nodes/node_texture_texture.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_texture.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_translate.c b/source/blender/nodes/texture/nodes/node_texture_translate.c
index fa8319d077b..55a1c372a4c 100644
--- a/source/blender/nodes/texture/nodes/node_texture_translate.c
+++ b/source/blender/nodes/texture/nodes/node_texture_translate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_translate.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_valToNor.c b/source/blender/nodes/texture/nodes/node_texture_valToNor.c
index b7d57b4d4cf..965edf8aede 100644
--- a/source/blender/nodes/texture/nodes/node_texture_valToNor.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Jucas.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_valToNor.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
index ad3c4344f34..9db1caf6a85 100644
--- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_valToRgb.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
@@ -37,11 +29,11 @@
/* **************** VALTORGB ******************** */
static bNodeSocketTemplate valtorgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate valtorgb_out[] = {
{ SOCK_RGBA, 0, N_("Color")},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static void valtorgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
@@ -80,11 +72,11 @@ void register_node_type_tex_valtorgb(void)
/* **************** RGBTOBW ******************** */
static bNodeSocketTemplate rgbtobw_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
static bNodeSocketTemplate rgbtobw_out[] = {
{ SOCK_FLOAT, 0, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
- { -1, 0, "" }
+ { -1, 0, "" },
};
diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c
index 69f4d3ca086..311953fcf1f 100644
--- a/source/blender/nodes/texture/nodes/node_texture_viewer.c
+++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Robin Allen
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/texture/nodes/node_texture_viewer.c
- * \ingroup texnodes
+/** \file
+ * \ingroup texnodes
*/
diff --git a/source/blender/physics/BPH_mass_spring.h b/source/blender/physics/BPH_mass_spring.h
index f1eb049dd52..56743b4867a 100644
--- a/source/blender/physics/BPH_mass_spring.h
+++ b/source/blender/physics/BPH_mass_spring.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/physics/BPH_mass_spring.h
- * \ingroup bph
+/** \file
+ * \ingroup bph
*/
#ifndef __BPH_MASS_SPRING_H__
@@ -36,11 +28,11 @@
extern "C" {
#endif
-struct Implicit_Data;
-struct Object;
struct ClothModifierData;
-struct ListBase;
struct Depsgraph;
+struct Implicit_Data;
+struct ListBase;
+struct Object;
struct VoxelData;
typedef enum eMassSpringSolverStatus {
diff --git a/source/blender/physics/CMakeLists.txt b/source/blender/physics/CMakeLists.txt
index b8663a384a7..800cc6bbdc3 100644
--- a/source/blender/physics/CMakeLists.txt
+++ b/source/blender/physics/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2014, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Lukas Toenne
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -41,11 +36,11 @@ set(INC_SYS
set(SRC
intern/BPH_mass_spring.cpp
intern/ConstrainedConjugateGradient.h
+ intern/eigen_utils.h
intern/hair_volume.cpp
intern/implicit.h
intern/implicit_blender.c
intern/implicit_eigen.cpp
- intern/eigen_utils.h
BPH_mass_spring.h
)
diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp
index 111d5c5b68f..1c78a0728b2 100644
--- a/source/blender/physics/intern/BPH_mass_spring.cpp
+++ b/source/blender/physics/intern/BPH_mass_spring.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/physics/intern/BPH_mass_spring.cpp
- * \ingroup bph
+/** \file
+ * \ingroup bph
*/
extern "C" {
diff --git a/source/blender/physics/intern/ConstrainedConjugateGradient.h b/source/blender/physics/intern/ConstrainedConjugateGradient.h
index bf4fa2870c0..e5cdcb068c8 100644
--- a/source/blender/physics/intern/ConstrainedConjugateGradient.h
+++ b/source/blender/physics/intern/ConstrainedConjugateGradient.h
@@ -1,3 +1,21 @@
+/*
+ * 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) Blender Foundation
+ * All rights reserved.
+ */
#ifndef __CONSTRAINEDCONJUGATEGRADIENT_H__
#define __CONSTRAINEDCONJUGATEGRADIENT_H__
diff --git a/source/blender/physics/intern/eigen_utils.h b/source/blender/physics/intern/eigen_utils.h
index 511e2cea3b1..16e1186441f 100644
--- a/source/blender/physics/intern/eigen_utils.h
+++ b/source/blender/physics/intern/eigen_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __EIGEN_UTILS_H__
#define __EIGEN_UTILS_H__
-/** \file blender/physics/intern/eigen_utils.h
- * \ingroup bph
+/** \file
+ * \ingroup bph
*/
#if defined(__GNUC__) && !defined(__clang__)
diff --git a/source/blender/physics/intern/hair_volume.cpp b/source/blender/physics/intern/hair_volume.cpp
index 5746bc123ea..0eb26934b5d 100644
--- a/source/blender/physics/intern/hair_volume.cpp
+++ b/source/blender/physics/intern/hair_volume.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Janne Karhu, Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/physics/intern/hair_volume.cpp
- * \ingroup bph
+/** \file
+ * \ingroup bph
*/
#include "MEM_guardedalloc.h"
@@ -432,8 +424,6 @@ BLI_INLINE void hair_volume_add_segment_2D(
*
* The radius of influence around a segment is assumed to be at most 2*cellsize,
* i.e. only cells containing the segment and their direct neighbors are examined.
- *
- *
*/
void BPH_hair_volume_add_segment(
HairGrid *grid,
diff --git a/source/blender/physics/intern/implicit.h b/source/blender/physics/intern/implicit.h
index 11621ac812c..eac59a3edbb 100644
--- a/source/blender/physics/intern/implicit.h
+++ b/source/blender/physics/intern/implicit.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,19 +15,13 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __IMPLICIT_H__
#define __IMPLICIT_H__
-/** \file implicit.h
- * \ingroup bph
+/** \file
+ * \ingroup bph
*/
#include "stdio.h"
diff --git a/source/blender/physics/intern/implicit_blender.c b/source/blender/physics/intern/implicit_blender.c
index 28546f8ca0d..cc8caca9588 100644
--- a/source/blender/physics/intern/implicit_blender.c
+++ b/source/blender/physics/intern/implicit_blender.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/physics/intern/implicit_blender.c
- * \ingroup bph
+/** \file
+ * \ingroup bph
*/
#include "implicit.h"
@@ -42,7 +34,6 @@
#include "DNA_texture_types.h"
#include "BLI_math.h"
-#include "BLI_linklist.h"
#include "BLI_utildefines.h"
#include "BKE_cloth.h"
@@ -216,7 +207,7 @@ DO_INLINE void add_lfvector_lfvector(float(*to)[3], float(*fLongVectorA)[3], flo
unsigned int i = 0;
for (i = 0; i < verts; i++) {
- VECADD(to[i], fLongVectorA[i], fLongVectorB[i]);
+ add_v3_v3v3(to[i], fLongVectorA[i], fLongVectorB[i]);
}
}
@@ -431,9 +422,9 @@ DO_INLINE void mul_fmatrix_fvector(float *to, float matrix[3][3], float from[3])
/* 3x3 matrix addition with 3x3 matrix */
DO_INLINE void add_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
{
- VECADD(to[0], matrixA[0], matrixB[0]);
- VECADD(to[1], matrixA[1], matrixB[1]);
- VECADD(to[2], matrixA[2], matrixB[2]);
+ add_v3_v3v3(to[0], matrixA[0], matrixB[0]);
+ add_v3_v3v3(to[1], matrixA[1], matrixB[1]);
+ add_v3_v3v3(to[2], matrixA[2], matrixB[2]);
}
/* A -= B*x + C*y (3x3 matrix sub-addition with 3x3 matrix) */
DO_INLINE void subadd_fmatrixS_fmatrixS(float to[3][3], float matrixA[3][3], float aS, float matrixB[3][3], float bS)
diff --git a/source/blender/physics/intern/implicit_eigen.cpp b/source/blender/physics/intern/implicit_eigen.cpp
index 012764d5ff5..5319042ec13 100644
--- a/source/blender/physics/intern/implicit_eigen.cpp
+++ b/source/blender/physics/intern/implicit_eigen.cpp
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/physics/intern/implicit_eigen.cpp
- * \ingroup bph
+/** \file
+ * \ingroup bph
*/
#include "implicit.h"
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 5a2f15405c1..d04f4bd9025 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,10 @@
* 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): Michel Selten,
- * Willian P. Germano,
- * Chris Keith,
- * Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BPY_extern.h
- * \ingroup python
+/** \file
+ * \ingroup python
*/
@@ -32,19 +23,19 @@
#ifndef __BPY_EXTERN_H__
#define __BPY_EXTERN_H__
-struct PathResolvedRNA;
-struct Text; /* defined in DNA_text_types.h */
-struct ID; /* DNA_ID.h */
-struct Object; /* DNA_object_types.h */
struct ChannelDriver; /* DNA_anim_types.h */
+struct ID; /* DNA_ID.h */
struct ListBase; /* DNA_listBase.h */
+struct Object; /* DNA_object_types.h */
+struct PathResolvedRNA;
+struct ReportList;
+struct Text; /* defined in DNA_text_types.h */
struct bConstraint; /* DNA_constraint_types.h */
-struct bPythonConstraint; /* DNA_constraint_types.h */
struct bConstraintOb; /* DNA_constraint_types.h */
struct bConstraintTarget; /* DNA_constraint_types.h*/
struct bContext;
struct bContextDataResult;
-struct ReportList;
+struct bPythonConstraint; /* DNA_constraint_types.h */
#ifdef __cplusplus
extern "C" {
diff --git a/source/blender/python/BPY_extern_clog.h b/source/blender/python/BPY_extern_clog.h
index fbe7139ba1b..c5ff8461888 100644
--- a/source/blender/python/BPY_extern_clog.h
+++ b/source/blender/python/BPY_extern_clog.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file BPY_extern_clog.h
- * \ingroup python
+/** \file
+ * \ingroup python
*
* Logging defines.
*/
diff --git a/source/blender/python/bmesh/CMakeLists.txt b/source/blender/python/bmesh/CMakeLists.txt
index 48213b7eed5..c9524634f7e 100644
--- a/source/blender/python/bmesh/CMakeLists.txt
+++ b/source/blender/python/bmesh/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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 *****
set(INC
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
index 012f7b1232d..ef3e72bfbad 100644
--- a/source/blender/python/bmesh/bmesh_py_api.c
+++ b/source/blender/python/bmesh/bmesh_py_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_api.c
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*
* This file defines the 'bmesh' module.
*/
@@ -101,13 +95,13 @@ static PyObject *bpy_bm_from_edit_mesh(PyObject *UNUSED(self), PyObject *value)
return NULL;
}
- if (me->edit_btmesh == NULL) {
+ if (me->edit_mesh == NULL) {
PyErr_SetString(PyExc_ValueError,
"The mesh must be in editmode");
return NULL;
}
- bm = me->edit_btmesh->bm;
+ bm = me->edit_mesh->bm;
return BPy_BMesh_CreatePyObject(bm, BPY_BMFLAG_IS_WRAPPED);
}
@@ -148,7 +142,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
return NULL;
}
- if (me->edit_btmesh == NULL) {
+ if (me->edit_mesh == NULL) {
PyErr_SetString(PyExc_ValueError,
"The mesh must be in editmode");
return NULL;
@@ -157,7 +151,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
{
extern void EDBM_update_generic(BMEditMesh *em, const bool do_tessface, const bool is_destructive);
- EDBM_update_generic(me->edit_btmesh, do_loop_triangles, is_destructive);
+ EDBM_update_generic(me->edit_mesh, do_loop_triangles, is_destructive);
}
Py_RETURN_NONE;
@@ -167,7 +161,7 @@ static struct PyMethodDef BPy_BM_methods[] = {
{"new", (PyCFunction)bpy_bm_new, METH_VARARGS | METH_KEYWORDS, bpy_bm_new_doc},
{"from_edit_mesh", (PyCFunction)bpy_bm_from_edit_mesh, METH_O, bpy_bm_from_edit_mesh_doc},
{"update_edit_mesh", (PyCFunction)bpy_bm_update_edit_mesh, METH_VARARGS | METH_KEYWORDS, bpy_bm_update_edit_mesh_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(BPy_BM_doc,
diff --git a/source/blender/python/bmesh/bmesh_py_api.h b/source/blender/python/bmesh/bmesh_py_api.h
index 74510ede47e..9f227b21440 100644
--- a/source/blender/python/bmesh/bmesh_py_api.h
+++ b/source/blender/python/bmesh/bmesh_py_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_api.h
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*/
#ifndef __BMESH_PY_API_H__
diff --git a/source/blender/python/bmesh/bmesh_py_geometry.c b/source/blender/python/bmesh/bmesh_py_geometry.c
index f67bf29c94d..30265af1e9f 100644
--- a/source/blender/python/bmesh/bmesh_py_geometry.c
+++ b/source/blender/python/bmesh/bmesh_py_geometry.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_geometry.c
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*
* This file defines the 'bmesh.geometry' module.
* Utility functions for operating on 'bmesh.types'
@@ -80,7 +74,7 @@ static PyObject *bpy_bm_geometry_intersect_face_point(BPy_BMFace *UNUSED(self),
static struct PyMethodDef BPy_BM_geometry_methods[] = {
{"intersect_face_point", (PyCFunction)bpy_bm_geometry_intersect_face_point, METH_VARARGS, bpy_bm_geometry_intersect_face_point_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
diff --git a/source/blender/python/bmesh/bmesh_py_geometry.h b/source/blender/python/bmesh/bmesh_py_geometry.h
index c0c455f79cd..98d336828dc 100644
--- a/source/blender/python/bmesh/bmesh_py_geometry.h
+++ b/source/blender/python/bmesh/bmesh_py_geometry.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_geometry.h
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*/
#ifndef __BMESH_PY_GEOMETRY_H__
diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c
index 49e71da3bc3..fbd79f28ec7 100644
--- a/source/blender/python/bmesh/bmesh_py_ops.c
+++ b/source/blender/python/bmesh/bmesh_py_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_ops.c
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*
* This file defines the 'bmesh.ops' module.
* Operators from 'opdefines' are wrapped.
@@ -232,7 +226,7 @@ static PyTypeObject bmesh_op_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
@@ -271,7 +265,7 @@ static PyObject *bpy_bmesh_ops_fakemod_dir(PyObject *UNUSED(self))
static struct PyMethodDef bpy_bmesh_ops_fakemod_methods[] = {
{"__dir__", (PyCFunction)bpy_bmesh_ops_fakemod_dir, METH_NOARGS, NULL},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static PyTypeObject bmesh_ops_fakemod_Type = {
@@ -350,7 +344,7 @@ static PyTypeObject bmesh_ops_fakemod_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
PyObject *BPyInit_bmesh_ops(void)
diff --git a/source/blender/python/bmesh/bmesh_py_ops.h b/source/blender/python/bmesh/bmesh_py_ops.h
index 56c980b57ea..a4a12bbef61 100644
--- a/source/blender/python/bmesh/bmesh_py_ops.h
+++ b/source/blender/python/bmesh/bmesh_py_ops.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_ops.h
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*/
#ifndef __BMESH_PY_OPS_H__
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
index ac328e852ac..b9d506c4c41 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_ops_call.c
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*
* This file provides __call__ aka BPy_BMO_call for
* the bmesh operator and has been given its own file
@@ -173,7 +167,7 @@ static int bpy_slot_from_py(
{
if (slot->slot_subtype.intg == BMO_OP_SLOT_SUBTYPE_INT_ENUM) {
int enum_val = -1;
- PyC_FlagSet *items = (PyC_FlagSet *)slot->data.enum_flags;
+ PyC_FlagSet *items = (PyC_FlagSet *)slot->data.enum_data.flags;
const char *enum_str = _PyUnicode_AsString(value);
if (enum_str == NULL) {
@@ -191,7 +185,7 @@ static int bpy_slot_from_py(
}
else if (slot->slot_subtype.intg == BMO_OP_SLOT_SUBTYPE_INT_FLAG) {
int flag = 0;
- PyC_FlagSet *items = (PyC_FlagSet *)slot->data.enum_flags;
+ PyC_FlagSet *items = (PyC_FlagSet *)slot->data.enum_data.flags;
if (PyC_FlagSet_ToBitfield(items, value, &flag, slot_name) == -1) {
return -1;
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.h b/source/blender/python/bmesh/bmesh_py_ops_call.h
index d350aec8f7f..986c4e3e296 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.h
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_ops_call.h
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*/
#ifndef __BMESH_PY_OPS_CALL_H__
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index c1be2cd20d1..b371b482ece 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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.c
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*/
#include "BLI_math.h"
@@ -66,14 +60,14 @@ PyC_FlagSet bpy_bm_scene_vert_edge_face_flags[] = {
{1, "VERT"},
{2, "EDGE"},
{4, "FACE"},
- {0, NULL}
+ {0, NULL},
};
PyC_FlagSet bpy_bm_htype_vert_edge_face_flags[] = {
{BM_VERT, "VERT"},
{BM_EDGE, "EDGE"},
{BM_FACE, "FACE"},
- {0, NULL}
+ {0, NULL},
};
PyC_FlagSet bpy_bm_htype_all_flags[] = {
@@ -81,7 +75,7 @@ PyC_FlagSet bpy_bm_htype_all_flags[] = {
{BM_LOOP, "EDGE"},
{BM_FACE, "FACE"},
{BM_LOOP, "LOOP"},
- {0, NULL}
+ {0, NULL},
};
#define BPY_BM_HFLAG_ALL_STR "('SELECT', 'HIDE', 'SEAM', 'SMOOTH', 'TAG')"
@@ -92,7 +86,7 @@ PyC_FlagSet bpy_bm_hflag_all_flags[] = {
{BM_ELEM_SEAM, "SEAM"},
{BM_ELEM_SMOOTH, "SMOOTH"},
{BM_ELEM_TAG, "TAG"},
- {0, NULL}
+ {0, NULL},
};
/* py-type definitions
@@ -897,7 +891,7 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
}
/* we could allow this but its almost certainly _not_ what script authors want */
- if (me->edit_btmesh) {
+ if (me->edit_mesh) {
PyErr_Format(PyExc_ValueError,
"to_mesh(): Mesh '%s' is in editmode", me->id.name + 2);
return NULL;
@@ -947,7 +941,7 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
bool use_deform = true;
bool use_cage = false;
bool use_fnorm = true;
- const int mask = CD_MASK_BMESH;
+ CustomData_MeshMasks data_masks = CD_MASK_BMESH;
BPY_BM_CHECK_OBJ(self);
@@ -982,15 +976,15 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
return NULL;
}
else {
- me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, ob_eval, mask);
+ me_eval = mesh_create_eval_final_render(depsgraph, scene_eval, ob_eval, &data_masks);
}
}
else {
if (use_cage) {
- me_eval = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, mask);
+ me_eval = mesh_get_eval_deform(depsgraph, scene_eval, ob_eval, &data_masks);
}
else {
- me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, mask);
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &data_masks);
}
}
}
@@ -1002,10 +996,10 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
return NULL;
}
else if (use_render) {
- me_eval = mesh_create_eval_no_deform_render(depsgraph, scene_eval, ob, NULL, mask);
+ me_eval = mesh_create_eval_no_deform_render(depsgraph, scene_eval, ob, NULL, &data_masks);
}
else {
- me_eval = mesh_create_eval_no_deform(depsgraph, scene_eval, ob, NULL, mask);
+ me_eval = mesh_create_eval_no_deform(depsgraph, scene_eval, ob, NULL, &data_masks);
}
}
@@ -1019,7 +1013,7 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
BM_mesh_bm_from_me(
bm, me_eval, (&(struct BMeshFromMeshParams){
- .calc_face_normal = use_fnorm
+ .calc_face_normal = use_fnorm,
}));
Py_RETURN_NONE;
@@ -2723,7 +2717,7 @@ static struct PyMethodDef bpy_bmesh_methods[] = {
/* calculations */
{"calc_volume", (PyCFunction)bpy_bmesh_calc_volume, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_calc_volume_doc},
{"calc_loop_triangles", (PyCFunction)bpy_bmesh_calc_loop_triangles, METH_NOARGS, bpy_bmesh_calc_loop_triangles_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef bpy_bmvert_methods[] = {
@@ -2738,7 +2732,7 @@ static struct PyMethodDef bpy_bmvert_methods[] = {
{"normal_update", (PyCFunction)bpy_bmvert_normal_update, METH_NOARGS, bpy_bmvert_normal_update_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef bpy_bmedge_methods[] = {
@@ -2755,7 +2749,7 @@ static struct PyMethodDef bpy_bmedge_methods[] = {
{"normal_update", (PyCFunction)bpy_bmedge_normal_update, METH_NOARGS, bpy_bmedge_normal_update_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef bpy_bmface_methods[] = {
@@ -2780,7 +2774,7 @@ static struct PyMethodDef bpy_bmface_methods[] = {
{"normal_update", (PyCFunction)bpy_bmface_normal_update, METH_NOARGS, bpy_bmface_normal_update_doc},
{"normal_flip", (PyCFunction)bpy_bmface_normal_flip, METH_NOARGS, bpy_bmface_normal_flip_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef bpy_bmloop_methods[] = {
@@ -2790,13 +2784,13 @@ static struct PyMethodDef bpy_bmloop_methods[] = {
{"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}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef bpy_bmelemseq_methods[] = {
/* odd function, initializes index values */
{"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef bpy_bmvertseq_methods[] = {
@@ -2807,7 +2801,7 @@ static struct PyMethodDef bpy_bmvertseq_methods[] = {
{"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
{"ensure_lookup_table", (PyCFunction)bpy_bmelemseq_ensure_lookup_table, METH_NOARGS, bpy_bmelemseq_ensure_lookup_table_doc},
{"sort", (PyCFunction)bpy_bmelemseq_sort, METH_VARARGS | METH_KEYWORDS, bpy_bmelemseq_sort_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef bpy_bmedgeseq_methods[] = {
@@ -2820,7 +2814,7 @@ static struct PyMethodDef bpy_bmedgeseq_methods[] = {
{"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
{"ensure_lookup_table", (PyCFunction)bpy_bmelemseq_ensure_lookup_table, METH_NOARGS, bpy_bmelemseq_ensure_lookup_table_doc},
{"sort", (PyCFunction)bpy_bmelemseq_sort, METH_VARARGS | METH_KEYWORDS, bpy_bmelemseq_sort_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef bpy_bmfaceseq_methods[] = {
@@ -2833,14 +2827,14 @@ static struct PyMethodDef bpy_bmfaceseq_methods[] = {
{"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
{"ensure_lookup_table", (PyCFunction)bpy_bmelemseq_ensure_lookup_table, METH_NOARGS, bpy_bmelemseq_ensure_lookup_table_doc},
{"sort", (PyCFunction)bpy_bmelemseq_sort, METH_VARARGS | METH_KEYWORDS, bpy_bmelemseq_sort_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef bpy_bmloopseq_methods[] = {
/* odd function, initializes index values */
/* no: index_update() function since we cant iterate over loops */
/* no: sort() function since we cant iterate over loops */
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/* Sequences
diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h
index e6f0976965c..deabbef1b7b 100644
--- a/source/blender/python/bmesh/bmesh_py_types.h
+++ b/source/blender/python/bmesh/bmesh_py_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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.h
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*/
#ifndef __BMESH_PY_TYPES_H__
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index f49766c93ab..c161b974eff 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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
+/** \file
+ * \ingroup pybmesh
*
* This file defines the types for 'BMesh.verts/edges/faces/loops.layers'
* customdata layer access.
@@ -565,7 +559,7 @@ static PyObject *bpy_bmlayercollection_get(BPy_BMLayerCollection *self, PyObject
static struct PyMethodDef bpy_bmlayeritem_methods[] = {
{"copy_from", (PyCFunction)bpy_bmlayeritem_copy_from, METH_O, bpy_bmlayeritem_copy_from_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef bpy_bmelemseq_methods[] = {
@@ -577,7 +571,7 @@ static struct PyMethodDef bpy_bmelemseq_methods[] = {
{"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},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/* Sequences
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.h b/source/blender/python/bmesh/bmesh_py_types_customdata.h
index b16b2806235..39cac7885cd 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.h
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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
+/** \file
+ * \ingroup pybmesh
*/
#ifndef __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
index 2a0f3817f35..aba54c6c43a 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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
+/** \file
+ * \ingroup pybmesh
*
* This file defines customdata types which can't be accessed as primitive
* python types such as MDeformVert, MLoopUV, MTexPoly
@@ -334,7 +328,7 @@ static Mathutils_Callback mathutils_bmloopcol_cb = {
mathutils_bmloopcol_get,
mathutils_bmloopcol_set,
mathutils_bmloopcol_get_index,
- mathutils_bmloopcol_set_index
+ mathutils_bmloopcol_set_index,
};
static void bm_init_types_bmloopcol(void)
@@ -523,7 +517,7 @@ static PySequenceMethods bpy_bmdeformvert_as_sequence = {
static PyMappingMethods bpy_bmdeformvert_as_mapping = {
(lenfunc)bpy_bmdeformvert_len,
(binaryfunc)bpy_bmdeformvert_subscript,
- (objobjargproc)bpy_bmdeformvert_ass_subscript
+ (objobjargproc)bpy_bmdeformvert_ass_subscript,
};
/* Methods
@@ -655,7 +649,7 @@ static struct PyMethodDef bpy_bmdeformvert_methods[] = {
{"get", (PyCFunction)bpy_bmdeformvert_get, METH_VARARGS, bpy_bmdeformvert_get_doc},
/* BMESH_TODO pop, popitem, update */
{"clear", (PyCFunction)bpy_bmdeformvert_clear, METH_NOARGS, bpy_bmdeformvert_clear_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyTypeObject BPy_BMDeformVert_Type; /* bm.loops.layers.uv.active */
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.h b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
index c8ae2596f99..66cdb9c119d 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.h
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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
+/** \file
+ * \ingroup pybmesh
*/
#ifndef __BMESH_PY_TYPES_MESHDATA_H__
@@ -40,9 +34,9 @@ typedef struct BPy_BMGenericMeshData {
void *data;
} BPy_BMGenericMeshData;
-struct MLoopUV;
-struct MLoopCol;
struct MDeformVert;
+struct MLoopCol;
+struct MLoopUV;
struct MVertSkin;
int BPy_BMLoopUV_AssignPyObject(struct MLoopUV *data, PyObject *value);
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c
index 03d295c8ca1..ed631f7105b 100644
--- a/source/blender/python/bmesh/bmesh_py_types_select.c
+++ b/source/blender/python/bmesh/bmesh_py_types_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_select.c
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*
* This file defines the types for 'BMesh.select_history'
* sequence and iterator.
@@ -179,7 +173,7 @@ static struct PyMethodDef bpy_bmeditselseq_methods[] = {
{"add", (PyCFunction)bpy_bmeditselseq_add, METH_O, bpy_bmeditselseq_add_doc},
{"remove", (PyCFunction)bpy_bmeditselseq_remove, METH_O, bpy_bmeditselseq_remove_doc},
{"discard", (PyCFunction)bpy_bmeditselseq_discard, METH_O, bpy_bmeditselseq_discard_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.h b/source/blender/python/bmesh/bmesh_py_types_select.h
index 4741e229400..2bf2214d7f9 100644
--- a/source/blender/python/bmesh/bmesh_py_types_select.h
+++ b/source/blender/python/bmesh/bmesh_py_types_select.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_select.h
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*/
#ifndef __BMESH_PY_TYPES_SELECT_H__
diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c
index 701dd5fbc19..8b8dcb518b9 100644
--- a/source/blender/python/bmesh/bmesh_py_utils.c
+++ b/source/blender/python/bmesh/bmesh_py_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_utils.c
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*
* This file defines the 'bmesh.utils' module.
* Utility functions for operating on 'bmesh.types'
@@ -818,7 +812,7 @@ static struct PyMethodDef BPy_BM_utils_methods[] = {
{"face_vert_separate", (PyCFunction)bpy_bm_utils_face_vert_separate, METH_VARARGS, bpy_bm_utils_face_vert_separate_doc},
{"face_flip", (PyCFunction)bpy_bm_utils_face_flip, METH_O, bpy_bm_utils_face_flip_doc},
{"loop_separate", (PyCFunction)bpy_bm_utils_loop_separate, METH_O, bpy_bm_utils_loop_separate_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
diff --git a/source/blender/python/bmesh/bmesh_py_utils.h b/source/blender/python/bmesh/bmesh_py_utils.h
index db93f5bbb49..a6f4f22bf8b 100644
--- a/source/blender/python/bmesh/bmesh_py_utils.h
+++ b/source/blender/python/bmesh/bmesh_py_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* 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_utils.h
- * \ingroup pybmesh
+/** \file
+ * \ingroup pybmesh
*/
#ifndef __BMESH_PY_UTILS_H__
diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt
index 9a5a3fddff0..c7b361247ef 100644
--- a/source/blender/python/generic/CMakeLists.txt
+++ b/source/blender/python/generic/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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 *****
set(INC
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 6e1c28e1310..08280248649 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Willian P. Germano, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/generic/bgl.c
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*
* This file is the 'bgl' module which wraps OpenGL functions and constants,
* allowing script writers to make OpenGL calls in their Python scripts.
@@ -43,7 +37,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Local utility defines for wrapping OpenGL
* \{ */
@@ -456,7 +449,6 @@ static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value);
/* -------------------------------------------------------------------- */
-
/** \name Utility Functions
* \{ */
@@ -512,7 +504,6 @@ static bool compare_dimensions(int ndim, int *dim1, Py_ssize_t *dim2)
/* -------------------------------------------------------------------- */
-
/** \name Buffer API
* \{ */
@@ -533,7 +524,7 @@ static PySequenceMethods Buffer_SeqMethods = {
static PyMappingMethods Buffer_AsMapping = {
(lenfunc)Buffer_len,
(binaryfunc)Buffer_subscript,
- (objobjargproc)Buffer_ass_subscript
+ (objobjargproc)Buffer_ass_subscript,
};
static void Buffer_dealloc(Buffer *self);
@@ -587,12 +578,12 @@ static PyObject *Buffer_dimensions(Buffer *self, void *UNUSED(arg))
static PyMethodDef Buffer_methods[] = {
{"to_list", (PyCFunction)Buffer_to_list_recursive, METH_NOARGS,
"return the buffer as a list"},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static PyGetSetDef Buffer_getseters[] = {
{(char *)"dimensions", (getter)Buffer_dimensions, NULL, NULL, NULL},
- {NULL, NULL, NULL, NULL, NULL}
+ {NULL, NULL, NULL, NULL, NULL},
};
@@ -1055,7 +1046,6 @@ static PyObject *Buffer_repr(Buffer *self)
/* -------------------------------------------------------------------- */
-
/** \name OpenGL API Wrapping
* \{ */
@@ -1072,261 +1062,261 @@ static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) \
}
/* GL_VERSION_1_0 */
-BGL_Wrap(BlendFunc, void, (GLenum, GLenum))
-BGL_Wrap(Clear, void, (GLbitfield))
-BGL_Wrap(ClearColor, void, (GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(ClearDepth, void, (GLdouble))
-BGL_Wrap(ClearStencil, void, (GLint))
-BGL_Wrap(ColorMask, void, (GLboolean, GLboolean, GLboolean, GLboolean))
-BGL_Wrap(CullFace, void, (GLenum))
-BGL_Wrap(DepthFunc, void, (GLenum))
-BGL_Wrap(DepthMask, void, (GLboolean))
-BGL_Wrap(DepthRange, void, (GLdouble, GLdouble))
-BGL_Wrap(Disable, void, (GLenum))
-BGL_Wrap(DrawBuffer, void, (GLenum))
-BGL_Wrap(Enable, void, (GLenum))
-BGL_Wrap(Finish, void, (void))
-BGL_Wrap(Flush, void, (void))
-BGL_Wrap(FrontFace, void, (GLenum))
-BGL_Wrap(GetBooleanv, void, (GLenum, GLbooleanP))
-BGL_Wrap(GetDoublev, void, (GLenum, GLdoubleP))
-BGL_Wrap(GetError, GLenum, (void))
-BGL_Wrap(GetFloatv, void, (GLenum, GLfloatP))
-BGL_Wrap(GetIntegerv, void, (GLenum, GLintP))
-BGL_Wrap(GetString, GLstring, (GLenum))
-BGL_Wrap(GetTexImage, void, (GLenum, GLint, GLenum, GLenum, GLvoidP))
-BGL_Wrap(GetTexLevelParameterfv, void, (GLenum, GLint, GLenum, GLfloatP))
-BGL_Wrap(GetTexLevelParameteriv, void, (GLenum, GLint, GLenum, GLintP))
-BGL_Wrap(GetTexParameterfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(GetTexParameteriv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(Hint, void, (GLenum, GLenum))
-BGL_Wrap(IsEnabled, GLboolean, (GLenum))
-BGL_Wrap(LineWidth, void, (GLfloat))
-BGL_Wrap(LogicOp, void, (GLenum))
-BGL_Wrap(PixelStoref, void, (GLenum, GLfloat))
-BGL_Wrap(PixelStorei, void, (GLenum, GLint))
-BGL_Wrap(PointSize, void, (GLfloat))
-BGL_Wrap(PolygonMode, void, (GLenum, GLenum))
-BGL_Wrap(ReadBuffer, void, (GLenum))
-BGL_Wrap(ReadPixels, void, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoidP))
-BGL_Wrap(Scissor, void, (GLint, GLint, GLsizei, GLsizei))
-BGL_Wrap(StencilFunc, void, (GLenum, GLint, GLuint))
-BGL_Wrap(StencilMask, void, (GLuint))
-BGL_Wrap(StencilOp, void, (GLenum, GLenum, GLenum))
-BGL_Wrap(TexImage1D, void, (GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, GLvoidP))
-BGL_Wrap(TexImage2D, void, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP))
-BGL_Wrap(TexParameterf, void, (GLenum, GLenum, GLfloat))
-BGL_Wrap(TexParameterfv, void, (GLenum, GLenum, GLfloatP))
-BGL_Wrap(TexParameteri, void, (GLenum, GLenum, GLint))
-BGL_Wrap(TexParameteriv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(Viewport, void, (GLint, GLint, GLsizei, GLsizei))
+BGL_Wrap(BlendFunc, void, (GLenum, GLenum));
+BGL_Wrap(Clear, void, (GLbitfield));
+BGL_Wrap(ClearColor, void, (GLfloat, GLfloat, GLfloat, GLfloat));
+BGL_Wrap(ClearDepth, void, (GLdouble));
+BGL_Wrap(ClearStencil, void, (GLint));
+BGL_Wrap(ColorMask, void, (GLboolean, GLboolean, GLboolean, GLboolean));
+BGL_Wrap(CullFace, void, (GLenum));
+BGL_Wrap(DepthFunc, void, (GLenum));
+BGL_Wrap(DepthMask, void, (GLboolean));
+BGL_Wrap(DepthRange, void, (GLdouble, GLdouble));
+BGL_Wrap(Disable, void, (GLenum));
+BGL_Wrap(DrawBuffer, void, (GLenum));
+BGL_Wrap(Enable, void, (GLenum));
+BGL_Wrap(Finish, void, (void));
+BGL_Wrap(Flush, void, (void));
+BGL_Wrap(FrontFace, void, (GLenum));
+BGL_Wrap(GetBooleanv, void, (GLenum, GLbooleanP));
+BGL_Wrap(GetDoublev, void, (GLenum, GLdoubleP));
+BGL_Wrap(GetError, GLenum, (void));
+BGL_Wrap(GetFloatv, void, (GLenum, GLfloatP));
+BGL_Wrap(GetIntegerv, void, (GLenum, GLintP));
+BGL_Wrap(GetString, GLstring, (GLenum));
+BGL_Wrap(GetTexImage, void, (GLenum, GLint, GLenum, GLenum, GLvoidP));
+BGL_Wrap(GetTexLevelParameterfv, void, (GLenum, GLint, GLenum, GLfloatP));
+BGL_Wrap(GetTexLevelParameteriv, void, (GLenum, GLint, GLenum, GLintP));
+BGL_Wrap(GetTexParameterfv, void, (GLenum, GLenum, GLfloatP));
+BGL_Wrap(GetTexParameteriv, void, (GLenum, GLenum, GLintP));
+BGL_Wrap(Hint, void, (GLenum, GLenum));
+BGL_Wrap(IsEnabled, GLboolean, (GLenum));
+BGL_Wrap(LineWidth, void, (GLfloat));
+BGL_Wrap(LogicOp, void, (GLenum));
+BGL_Wrap(PixelStoref, void, (GLenum, GLfloat));
+BGL_Wrap(PixelStorei, void, (GLenum, GLint));
+BGL_Wrap(PointSize, void, (GLfloat));
+BGL_Wrap(PolygonMode, void, (GLenum, GLenum));
+BGL_Wrap(ReadBuffer, void, (GLenum));
+BGL_Wrap(ReadPixels, void, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoidP));
+BGL_Wrap(Scissor, void, (GLint, GLint, GLsizei, GLsizei));
+BGL_Wrap(StencilFunc, void, (GLenum, GLint, GLuint));
+BGL_Wrap(StencilMask, void, (GLuint));
+BGL_Wrap(StencilOp, void, (GLenum, GLenum, GLenum));
+BGL_Wrap(TexImage1D, void, (GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, GLvoidP));
+BGL_Wrap(TexImage2D, void, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP));
+BGL_Wrap(TexParameterf, void, (GLenum, GLenum, GLfloat));
+BGL_Wrap(TexParameterfv, void, (GLenum, GLenum, GLfloatP));
+BGL_Wrap(TexParameteri, void, (GLenum, GLenum, GLint));
+BGL_Wrap(TexParameteriv, void, (GLenum, GLenum, GLintP));
+BGL_Wrap(Viewport, void, (GLint, GLint, GLsizei, GLsizei));
/* GL_VERSION_1_1 */
-BGL_Wrap(BindTexture, void, (GLenum, GLuint))
-BGL_Wrap(CopyTexImage1D, void, (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint))
-BGL_Wrap(CopyTexImage2D, void, (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint))
-BGL_Wrap(CopyTexSubImage1D, void, (GLenum, GLint, GLint, GLint, GLint, GLsizei))
-BGL_Wrap(CopyTexSubImage2D, void, (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei))
-BGL_Wrap(DeleteTextures, void, (GLsizei, GLuintP))
-BGL_Wrap(DrawArrays, void, (GLenum, GLint, GLsizei))
-BGL_Wrap(DrawElements, void, (GLenum, GLsizei, GLenum, GLvoidP))
-BGL_Wrap(GenTextures, void, (GLsizei, GLuintP))
-BGL_Wrap(IsTexture, GLboolean, (GLuint))
-BGL_Wrap(PolygonOffset, void, (GLfloat, GLfloat))
-BGL_Wrap(TexSubImage1D, void, (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, GLvoidP))
-BGL_Wrap(TexSubImage2D, void, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoidP))
+BGL_Wrap(BindTexture, void, (GLenum, GLuint));
+BGL_Wrap(CopyTexImage1D, void, (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint));
+BGL_Wrap(CopyTexImage2D, void, (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint));
+BGL_Wrap(CopyTexSubImage1D, void, (GLenum, GLint, GLint, GLint, GLint, GLsizei));
+BGL_Wrap(CopyTexSubImage2D, void, (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei));
+BGL_Wrap(DeleteTextures, void, (GLsizei, GLuintP));
+BGL_Wrap(DrawArrays, void, (GLenum, GLint, GLsizei));
+BGL_Wrap(DrawElements, void, (GLenum, GLsizei, GLenum, GLvoidP));
+BGL_Wrap(GenTextures, void, (GLsizei, GLuintP));
+BGL_Wrap(IsTexture, GLboolean, (GLuint));
+BGL_Wrap(PolygonOffset, void, (GLfloat, GLfloat));
+BGL_Wrap(TexSubImage1D, void, (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, GLvoidP));
+BGL_Wrap(TexSubImage2D, void, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoidP));
/* GL_VERSION_1_2 */
-BGL_Wrap(CopyTexSubImage3D, void, (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei))
-BGL_Wrap(DrawRangeElements, void, (GLenum, GLuint, GLuint, GLsizei, GLenum, GLvoidP))
-BGL_Wrap(TexImage3D, void, (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP))
-BGL_Wrap(TexSubImage3D, void, (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoidP))
+BGL_Wrap(CopyTexSubImage3D, void, (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei));
+BGL_Wrap(DrawRangeElements, void, (GLenum, GLuint, GLuint, GLsizei, GLenum, GLvoidP));
+BGL_Wrap(TexImage3D, void, (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP));
+BGL_Wrap(TexSubImage3D, void, (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoidP));
/* GL_VERSION_1_3 */
-BGL_Wrap(ActiveTexture, void, (GLenum))
-BGL_Wrap(CompressedTexImage1D, void, (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, GLvoidP))
-BGL_Wrap(CompressedTexImage2D, void, (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLvoidP))
-BGL_Wrap(CompressedTexImage3D, void, (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, GLvoidP))
-BGL_Wrap(CompressedTexSubImage1D, void, (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, GLvoidP))
-BGL_Wrap(CompressedTexSubImage2D, void, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, GLvoidP))
-BGL_Wrap(CompressedTexSubImage3D, void, (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, GLvoidP))
-BGL_Wrap(GetCompressedTexImage, void, (GLenum, GLint, GLvoidP))
-BGL_Wrap(SampleCoverage, void, (GLfloat, GLboolean))
+BGL_Wrap(ActiveTexture, void, (GLenum));
+BGL_Wrap(CompressedTexImage1D, void, (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, GLvoidP));
+BGL_Wrap(CompressedTexImage2D, void, (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLvoidP));
+BGL_Wrap(CompressedTexImage3D, void, (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, GLvoidP));
+BGL_Wrap(CompressedTexSubImage1D, void, (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, GLvoidP));
+BGL_Wrap(CompressedTexSubImage2D, void, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, GLvoidP));
+BGL_Wrap(CompressedTexSubImage3D, void, (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, GLvoidP));
+BGL_Wrap(GetCompressedTexImage, void, (GLenum, GLint, GLvoidP));
+BGL_Wrap(SampleCoverage, void, (GLfloat, GLboolean));
/* GL_VERSION_1_4 */
-BGL_Wrap(BlendColor, void, (GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(BlendEquation, void, (GLenum))
+BGL_Wrap(BlendColor, void, (GLfloat, GLfloat, GLfloat, GLfloat));
+BGL_Wrap(BlendEquation, void, (GLenum));
/* GL_VERSION_1_5 */
-BGL_Wrap(BeginQuery, void, (GLenum, GLuint))
-BGL_Wrap(BindBuffer, void, (GLenum, GLuint))
-BGL_Wrap(BufferData, void, (GLenum, GLsizeiptr, GLvoidP, GLenum))
-BGL_Wrap(BufferSubData, void, (GLenum, GLintptr, GLsizeiptr, GLvoidP))
-BGL_Wrap(DeleteBuffers, void, (GLsizei, GLuintP))
-BGL_Wrap(DeleteQueries, void, (GLsizei, GLuintP))
-BGL_Wrap(EndQuery, void, (GLenum))
-BGL_Wrap(GenBuffers, void, (GLsizei, GLuintP))
-BGL_Wrap(GenQueries, void, (GLsizei, GLuintP))
-BGL_Wrap(GetBufferParameteriv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(GetBufferPointerv, void, (GLenum, GLenum, GLvoidP))
-BGL_Wrap(GetBufferSubData, void, (GLenum, GLintptr, GLsizeiptr, GLvoidP))
-BGL_Wrap(GetQueryObjectiv, void, (GLuint, GLenum, GLintP))
-BGL_Wrap(GetQueryObjectuiv, void, (GLuint, GLenum, GLuintP))
-BGL_Wrap(GetQueryiv, void, (GLenum, GLenum, GLintP))
-BGL_Wrap(IsBuffer, GLboolean, (GLuint))
-BGL_Wrap(IsQuery, GLboolean, (GLuint))
-BGL_Wrap(MapBuffer, void, (GLenum, GLenum))
-BGL_Wrap(UnmapBuffer, GLboolean, (GLenum))
+BGL_Wrap(BeginQuery, void, (GLenum, GLuint));
+BGL_Wrap(BindBuffer, void, (GLenum, GLuint));
+BGL_Wrap(BufferData, void, (GLenum, GLsizeiptr, GLvoidP, GLenum));
+BGL_Wrap(BufferSubData, void, (GLenum, GLintptr, GLsizeiptr, GLvoidP));
+BGL_Wrap(DeleteBuffers, void, (GLsizei, GLuintP));
+BGL_Wrap(DeleteQueries, void, (GLsizei, GLuintP));
+BGL_Wrap(EndQuery, void, (GLenum));
+BGL_Wrap(GenBuffers, void, (GLsizei, GLuintP));
+BGL_Wrap(GenQueries, void, (GLsizei, GLuintP));
+BGL_Wrap(GetBufferParameteriv, void, (GLenum, GLenum, GLintP));
+BGL_Wrap(GetBufferPointerv, void, (GLenum, GLenum, GLvoidP));
+BGL_Wrap(GetBufferSubData, void, (GLenum, GLintptr, GLsizeiptr, GLvoidP));
+BGL_Wrap(GetQueryObjectiv, void, (GLuint, GLenum, GLintP));
+BGL_Wrap(GetQueryObjectuiv, void, (GLuint, GLenum, GLuintP));
+BGL_Wrap(GetQueryiv, void, (GLenum, GLenum, GLintP));
+BGL_Wrap(IsBuffer, GLboolean, (GLuint));
+BGL_Wrap(IsQuery, GLboolean, (GLuint));
+BGL_Wrap(MapBuffer, void, (GLenum, GLenum));
+BGL_Wrap(UnmapBuffer, GLboolean, (GLenum));
/* GL_VERSION_2_0 */
-BGL_Wrap(AttachShader, void, (GLuint, GLuint))
-BGL_Wrap(BindAttribLocation, void, (GLuint, GLuint, GLstring))
-BGL_Wrap(BlendEquationSeparate, void, (GLenum, GLenum))
-BGL_Wrap(CompileShader, void, (GLuint))
-BGL_Wrap(CreateProgram, GLuint, (void))
-BGL_Wrap(CreateShader, GLuint, (GLenum))
-BGL_Wrap(DeleteProgram, void, (GLuint))
-BGL_Wrap(DeleteShader, void, (GLuint))
-BGL_Wrap(DetachShader, void, (GLuint, GLuint))
-BGL_Wrap(DisableVertexAttribArray, void, (GLuint))
-BGL_Wrap(DrawBuffers, void, (GLsizei, GLenumP))
-BGL_Wrap(EnableVertexAttribArray, void, (GLuint))
-BGL_Wrap(GetActiveAttrib, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLintP, GLenumP, GLcharP))
-BGL_Wrap(GetActiveUniform, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLintP, GLenumP, GLcharP))
-BGL_Wrap(GetAttachedShaders, void, (GLuint, GLsizei, GLsizeiP, GLuintP))
-BGL_Wrap(GetAttribLocation, GLint, (GLuint, GLstring))
-BGL_Wrap(GetProgramInfoLog, void, (GLuint, GLsizei, GLsizeiP, GLcharP))
-BGL_Wrap(GetProgramiv, void, (GLuint, GLenum, GLintP))
-BGL_Wrap(GetShaderInfoLog, void, (GLuint, GLsizei, GLsizeiP, GLcharP))
-BGL_Wrap(GetShaderSource, void, (GLuint, GLsizei, GLsizeiP, GLcharP))
-BGL_Wrap(GetShaderiv, void, (GLuint, GLenum, GLintP))
-BGL_Wrap(GetUniformLocation, GLint, (GLuint, GLstring))
-BGL_Wrap(GetUniformfv, void, (GLuint, GLint, GLfloatP))
-BGL_Wrap(GetUniformiv, void, (GLuint, GLint, GLintP))
-BGL_Wrap(GetVertexAttribPointerv, void, (GLuint, GLenum, GLvoidP))
-BGL_Wrap(GetVertexAttribdv, void, (GLuint, GLenum, GLdoubleP))
-BGL_Wrap(GetVertexAttribfv, void, (GLuint, GLenum, GLfloatP))
-BGL_Wrap(GetVertexAttribiv, void, (GLuint, GLenum, GLintP))
-BGL_Wrap(IsProgram, GLboolean, (GLuint))
-BGL_Wrap(IsShader, GLboolean, (GLuint))
-BGL_Wrap(LinkProgram, void, (GLuint))
-BGL_Wrap(StencilFuncSeparate, void, (GLenum, GLenum, GLint, GLuint))
-BGL_Wrap(StencilMaskSeparate, void, (GLenum, GLuint))
-BGL_Wrap(StencilOpSeparate, void, (GLenum, GLenum, GLenum, GLenum))
-BGL_Wrap(Uniform1f, void, (GLint, GLfloat))
-BGL_Wrap(Uniform1fv, void, (GLint, GLsizei, GLfloatP))
-BGL_Wrap(Uniform1i, void, (GLint, GLint))
-BGL_Wrap(Uniform1iv, void, (GLint, GLsizei, GLintP))
-BGL_Wrap(Uniform2f, void, (GLint, GLfloat, GLfloat))
-BGL_Wrap(Uniform2fv, void, (GLint, GLsizei, GLfloatP))
-BGL_Wrap(Uniform2i, void, (GLint, GLint, GLint))
-BGL_Wrap(Uniform2iv, void, (GLint, GLsizei, GLintP))
-BGL_Wrap(Uniform3f, void, (GLint, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(Uniform3fv, void, (GLint, GLsizei, GLfloatP))
-BGL_Wrap(Uniform3i, void, (GLint, GLint, GLint, GLint))
-BGL_Wrap(Uniform3iv, void, (GLint, GLsizei, GLintP))
-BGL_Wrap(Uniform4f, void, (GLint, GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(Uniform4fv, void, (GLint, GLsizei, GLfloatP))
-BGL_Wrap(Uniform4i, void, (GLint, GLint, GLint, GLint, GLint))
-BGL_Wrap(Uniform4iv, void, (GLint, GLsizei, GLintP))
-BGL_Wrap(UniformMatrix2fv, void, (GLint, GLsizei, GLboolean, GLfloatP))
-BGL_Wrap(UniformMatrix3fv, void, (GLint, GLsizei, GLboolean, GLfloatP))
-BGL_Wrap(UniformMatrix4fv, void, (GLint, GLsizei, GLboolean, GLfloatP))
-BGL_Wrap(UseProgram, void, (GLuint))
-BGL_Wrap(ValidateProgram, void, (GLuint))
-BGL_Wrap(VertexAttrib1d, void, (GLuint, GLdouble))
-BGL_Wrap(VertexAttrib1dv, void, (GLuint, GLdoubleP))
-BGL_Wrap(VertexAttrib1f, void, (GLuint, GLfloat))
-BGL_Wrap(VertexAttrib1fv, void, (GLuint, GLfloatP))
-BGL_Wrap(VertexAttrib1s, void, (GLuint, GLshort))
-BGL_Wrap(VertexAttrib1sv, void, (GLuint, GLshortP))
-BGL_Wrap(VertexAttrib2d, void, (GLuint, GLdouble, GLdouble))
-BGL_Wrap(VertexAttrib2dv, void, (GLuint, GLdoubleP))
-BGL_Wrap(VertexAttrib2f, void, (GLuint, GLfloat, GLfloat))
-BGL_Wrap(VertexAttrib2fv, void, (GLuint, GLfloatP))
-BGL_Wrap(VertexAttrib2s, void, (GLuint, GLshort, GLshort))
-BGL_Wrap(VertexAttrib2sv, void, (GLuint, GLshortP))
-BGL_Wrap(VertexAttrib3d, void, (GLuint, GLdouble, GLdouble, GLdouble))
-BGL_Wrap(VertexAttrib3dv, void, (GLuint, GLdoubleP))
-BGL_Wrap(VertexAttrib3f, void, (GLuint, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(VertexAttrib3fv, void, (GLuint, GLfloatP))
-BGL_Wrap(VertexAttrib3s, void, (GLuint, GLshort, GLshort, GLshort))
-BGL_Wrap(VertexAttrib3sv, void, (GLuint, GLshortP))
-BGL_Wrap(VertexAttrib4Nbv, void, (GLuint, GLbyteP))
-BGL_Wrap(VertexAttrib4Niv, void, (GLuint, GLintP))
-BGL_Wrap(VertexAttrib4Nsv, void, (GLuint, GLshortP))
-BGL_Wrap(VertexAttrib4Nub, void, (GLuint, GLubyte, GLubyte, GLubyte, GLubyte))
-BGL_Wrap(VertexAttrib4Nubv, void, (GLuint, GLubyteP))
-BGL_Wrap(VertexAttrib4Nuiv, void, (GLuint, GLuintP))
-BGL_Wrap(VertexAttrib4Nusv, void, (GLuint, GLushortP))
-BGL_Wrap(VertexAttrib4bv, void, (GLuint, GLbyteP))
-BGL_Wrap(VertexAttrib4d, void, (GLuint, GLdouble, GLdouble, GLdouble, GLdouble))
-BGL_Wrap(VertexAttrib4dv, void, (GLuint, GLdoubleP))
-BGL_Wrap(VertexAttrib4f, void, (GLuint, GLfloat, GLfloat, GLfloat, GLfloat))
-BGL_Wrap(VertexAttrib4fv, void, (GLuint, GLfloatP))
-BGL_Wrap(VertexAttrib4iv, void, (GLuint, GLintP))
-BGL_Wrap(VertexAttrib4s, void, (GLuint, GLshort, GLshort, GLshort, GLshort))
-BGL_Wrap(VertexAttrib4sv, void, (GLuint, GLshortP))
-BGL_Wrap(VertexAttrib4ubv, void, (GLuint, GLubyteP))
-BGL_Wrap(VertexAttrib4uiv, void, (GLuint, GLuintP))
-BGL_Wrap(VertexAttrib4usv, void, (GLuint, GLushortP))
-BGL_Wrap(VertexAttribPointer, void, (GLuint, GLint, GLenum, GLboolean, GLsizei, GLvoidP))
+BGL_Wrap(AttachShader, void, (GLuint, GLuint));
+BGL_Wrap(BindAttribLocation, void, (GLuint, GLuint, GLstring));
+BGL_Wrap(BlendEquationSeparate, void, (GLenum, GLenum));
+BGL_Wrap(CompileShader, void, (GLuint));
+BGL_Wrap(CreateProgram, GLuint, (void));
+BGL_Wrap(CreateShader, GLuint, (GLenum));
+BGL_Wrap(DeleteProgram, void, (GLuint));
+BGL_Wrap(DeleteShader, void, (GLuint));
+BGL_Wrap(DetachShader, void, (GLuint, GLuint));
+BGL_Wrap(DisableVertexAttribArray, void, (GLuint));
+BGL_Wrap(DrawBuffers, void, (GLsizei, GLenumP));
+BGL_Wrap(EnableVertexAttribArray, void, (GLuint));
+BGL_Wrap(GetActiveAttrib, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLintP, GLenumP, GLcharP));
+BGL_Wrap(GetActiveUniform, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLintP, GLenumP, GLcharP));
+BGL_Wrap(GetAttachedShaders, void, (GLuint, GLsizei, GLsizeiP, GLuintP));
+BGL_Wrap(GetAttribLocation, GLint, (GLuint, GLstring));
+BGL_Wrap(GetProgramInfoLog, void, (GLuint, GLsizei, GLsizeiP, GLcharP));
+BGL_Wrap(GetProgramiv, void, (GLuint, GLenum, GLintP));
+BGL_Wrap(GetShaderInfoLog, void, (GLuint, GLsizei, GLsizeiP, GLcharP));
+BGL_Wrap(GetShaderSource, void, (GLuint, GLsizei, GLsizeiP, GLcharP));
+BGL_Wrap(GetShaderiv, void, (GLuint, GLenum, GLintP));
+BGL_Wrap(GetUniformLocation, GLint, (GLuint, GLstring));
+BGL_Wrap(GetUniformfv, void, (GLuint, GLint, GLfloatP));
+BGL_Wrap(GetUniformiv, void, (GLuint, GLint, GLintP));
+BGL_Wrap(GetVertexAttribPointerv, void, (GLuint, GLenum, GLvoidP));
+BGL_Wrap(GetVertexAttribdv, void, (GLuint, GLenum, GLdoubleP));
+BGL_Wrap(GetVertexAttribfv, void, (GLuint, GLenum, GLfloatP));
+BGL_Wrap(GetVertexAttribiv, void, (GLuint, GLenum, GLintP));
+BGL_Wrap(IsProgram, GLboolean, (GLuint));
+BGL_Wrap(IsShader, GLboolean, (GLuint));
+BGL_Wrap(LinkProgram, void, (GLuint));
+BGL_Wrap(StencilFuncSeparate, void, (GLenum, GLenum, GLint, GLuint));
+BGL_Wrap(StencilMaskSeparate, void, (GLenum, GLuint));
+BGL_Wrap(StencilOpSeparate, void, (GLenum, GLenum, GLenum, GLenum));
+BGL_Wrap(Uniform1f, void, (GLint, GLfloat));
+BGL_Wrap(Uniform1fv, void, (GLint, GLsizei, GLfloatP));
+BGL_Wrap(Uniform1i, void, (GLint, GLint));
+BGL_Wrap(Uniform1iv, void, (GLint, GLsizei, GLintP));
+BGL_Wrap(Uniform2f, void, (GLint, GLfloat, GLfloat));
+BGL_Wrap(Uniform2fv, void, (GLint, GLsizei, GLfloatP));
+BGL_Wrap(Uniform2i, void, (GLint, GLint, GLint));
+BGL_Wrap(Uniform2iv, void, (GLint, GLsizei, GLintP));
+BGL_Wrap(Uniform3f, void, (GLint, GLfloat, GLfloat, GLfloat));
+BGL_Wrap(Uniform3fv, void, (GLint, GLsizei, GLfloatP));
+BGL_Wrap(Uniform3i, void, (GLint, GLint, GLint, GLint));
+BGL_Wrap(Uniform3iv, void, (GLint, GLsizei, GLintP));
+BGL_Wrap(Uniform4f, void, (GLint, GLfloat, GLfloat, GLfloat, GLfloat));
+BGL_Wrap(Uniform4fv, void, (GLint, GLsizei, GLfloatP));
+BGL_Wrap(Uniform4i, void, (GLint, GLint, GLint, GLint, GLint));
+BGL_Wrap(Uniform4iv, void, (GLint, GLsizei, GLintP));
+BGL_Wrap(UniformMatrix2fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
+BGL_Wrap(UniformMatrix3fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
+BGL_Wrap(UniformMatrix4fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
+BGL_Wrap(UseProgram, void, (GLuint));
+BGL_Wrap(ValidateProgram, void, (GLuint));
+BGL_Wrap(VertexAttrib1d, void, (GLuint, GLdouble));
+BGL_Wrap(VertexAttrib1dv, void, (GLuint, GLdoubleP));
+BGL_Wrap(VertexAttrib1f, void, (GLuint, GLfloat));
+BGL_Wrap(VertexAttrib1fv, void, (GLuint, GLfloatP));
+BGL_Wrap(VertexAttrib1s, void, (GLuint, GLshort));
+BGL_Wrap(VertexAttrib1sv, void, (GLuint, GLshortP));
+BGL_Wrap(VertexAttrib2d, void, (GLuint, GLdouble, GLdouble));
+BGL_Wrap(VertexAttrib2dv, void, (GLuint, GLdoubleP));
+BGL_Wrap(VertexAttrib2f, void, (GLuint, GLfloat, GLfloat));
+BGL_Wrap(VertexAttrib2fv, void, (GLuint, GLfloatP));
+BGL_Wrap(VertexAttrib2s, void, (GLuint, GLshort, GLshort));
+BGL_Wrap(VertexAttrib2sv, void, (GLuint, GLshortP));
+BGL_Wrap(VertexAttrib3d, void, (GLuint, GLdouble, GLdouble, GLdouble));
+BGL_Wrap(VertexAttrib3dv, void, (GLuint, GLdoubleP));
+BGL_Wrap(VertexAttrib3f, void, (GLuint, GLfloat, GLfloat, GLfloat));
+BGL_Wrap(VertexAttrib3fv, void, (GLuint, GLfloatP));
+BGL_Wrap(VertexAttrib3s, void, (GLuint, GLshort, GLshort, GLshort));
+BGL_Wrap(VertexAttrib3sv, void, (GLuint, GLshortP));
+BGL_Wrap(VertexAttrib4Nbv, void, (GLuint, GLbyteP));
+BGL_Wrap(VertexAttrib4Niv, void, (GLuint, GLintP));
+BGL_Wrap(VertexAttrib4Nsv, void, (GLuint, GLshortP));
+BGL_Wrap(VertexAttrib4Nub, void, (GLuint, GLubyte, GLubyte, GLubyte, GLubyte));
+BGL_Wrap(VertexAttrib4Nubv, void, (GLuint, GLubyteP));
+BGL_Wrap(VertexAttrib4Nuiv, void, (GLuint, GLuintP));
+BGL_Wrap(VertexAttrib4Nusv, void, (GLuint, GLushortP));
+BGL_Wrap(VertexAttrib4bv, void, (GLuint, GLbyteP));
+BGL_Wrap(VertexAttrib4d, void, (GLuint, GLdouble, GLdouble, GLdouble, GLdouble));
+BGL_Wrap(VertexAttrib4dv, void, (GLuint, GLdoubleP));
+BGL_Wrap(VertexAttrib4f, void, (GLuint, GLfloat, GLfloat, GLfloat, GLfloat));
+BGL_Wrap(VertexAttrib4fv, void, (GLuint, GLfloatP));
+BGL_Wrap(VertexAttrib4iv, void, (GLuint, GLintP));
+BGL_Wrap(VertexAttrib4s, void, (GLuint, GLshort, GLshort, GLshort, GLshort));
+BGL_Wrap(VertexAttrib4sv, void, (GLuint, GLshortP));
+BGL_Wrap(VertexAttrib4ubv, void, (GLuint, GLubyteP));
+BGL_Wrap(VertexAttrib4uiv, void, (GLuint, GLuintP));
+BGL_Wrap(VertexAttrib4usv, void, (GLuint, GLushortP));
+BGL_Wrap(VertexAttribPointer, void, (GLuint, GLint, GLenum, GLboolean, GLsizei, GLvoidP));
/* GL_VERSION_2_1 */
-BGL_Wrap(UniformMatrix2x3fv, void, (GLint, GLsizei, GLboolean, GLfloatP))
-BGL_Wrap(UniformMatrix2x4fv, void, (GLint, GLsizei, GLboolean, GLfloatP))
-BGL_Wrap(UniformMatrix3x2fv, void, (GLint, GLsizei, GLboolean, GLfloatP))
-BGL_Wrap(UniformMatrix3x4fv, void, (GLint, GLsizei, GLboolean, GLfloatP))
-BGL_Wrap(UniformMatrix4x2fv, void, (GLint, GLsizei, GLboolean, GLfloatP))
-BGL_Wrap(UniformMatrix4x3fv, void, (GLint, GLsizei, GLboolean, GLfloatP))
+BGL_Wrap(UniformMatrix2x3fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
+BGL_Wrap(UniformMatrix2x4fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
+BGL_Wrap(UniformMatrix3x2fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
+BGL_Wrap(UniformMatrix3x4fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
+BGL_Wrap(UniformMatrix4x2fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
+BGL_Wrap(UniformMatrix4x3fv, void, (GLint, GLsizei, GLboolean, GLfloatP));
/* GL_VERSION_3_0 */
-BGL_Wrap(BindFramebuffer, void, (GLenum, GLuint))
-BGL_Wrap(BindRenderbuffer, void, (GLenum, GLuint))
-BGL_Wrap(BindVertexArray, void, (GLuint))
-BGL_Wrap(BlitFramebuffer, void, (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum))
-BGL_Wrap(CheckFramebufferStatus, GLenum, (GLenum))
-BGL_Wrap(DeleteFramebuffers, void, (GLsizei, GLuintP))
-BGL_Wrap(DeleteRenderbuffers, void, (GLsizei, GLuintP))
-BGL_Wrap(DeleteVertexArrays, void, (GLsizei, GLuintP))
-BGL_Wrap(FramebufferRenderbuffer, void, (GLenum, GLenum, GLenum, GLuint))
-BGL_Wrap(GenFramebuffers, void, (GLsizei, GLuintP))
-BGL_Wrap(GenRenderbuffers, void, (GLsizei, GLuintP))
-BGL_Wrap(GenVertexArrays, void, (GLsizei, GLuintP))
-BGL_Wrap(GetStringi, GLstring, (GLenum, GLuint))
-BGL_Wrap(IsVertexArray, GLboolean, (GLuint))
-BGL_Wrap(RenderbufferStorage, void, (GLenum, GLenum, GLsizei, GLsizei))
+BGL_Wrap(BindFramebuffer, void, (GLenum, GLuint));
+BGL_Wrap(BindRenderbuffer, void, (GLenum, GLuint));
+BGL_Wrap(BindVertexArray, void, (GLuint));
+BGL_Wrap(BlitFramebuffer, void, (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum));
+BGL_Wrap(CheckFramebufferStatus, GLenum, (GLenum));
+BGL_Wrap(DeleteFramebuffers, void, (GLsizei, GLuintP));
+BGL_Wrap(DeleteRenderbuffers, void, (GLsizei, GLuintP));
+BGL_Wrap(DeleteVertexArrays, void, (GLsizei, GLuintP));
+BGL_Wrap(FramebufferRenderbuffer, void, (GLenum, GLenum, GLenum, GLuint));
+BGL_Wrap(GenFramebuffers, void, (GLsizei, GLuintP));
+BGL_Wrap(GenRenderbuffers, void, (GLsizei, GLuintP));
+BGL_Wrap(GenVertexArrays, void, (GLsizei, GLuintP));
+BGL_Wrap(GetStringi, GLstring, (GLenum, GLuint));
+BGL_Wrap(IsVertexArray, GLboolean, (GLuint));
+BGL_Wrap(RenderbufferStorage, void, (GLenum, GLenum, GLsizei, GLsizei));
/* GL_VERSION_3_1 */
-BGL_Wrap(BindBufferBase, void, (GLenum, GLuint, GLuint))
-BGL_Wrap(BindBufferRange, void, (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr))
-BGL_Wrap(GetActiveUniformBlockName, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLcharP))
-BGL_Wrap(GetActiveUniformBlockiv, void, (GLuint, GLuint, GLenum, GLintP))
-BGL_Wrap(GetActiveUniformName, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLcharP))
-BGL_Wrap(GetActiveUniformsiv, void, (GLuint, GLsizei, GLuintP, GLenum, GLintP))
-BGL_Wrap(GetIntegeri_v, void, (GLenum, GLuint, GLintP))
-BGL_Wrap(GetUniformBlockIndex, GLuint, (GLuint, GLstring))
-BGL_Wrap(GetUniformIndices, void, (GLuint, GLsizei, GLcharP, GLuintP))
-BGL_Wrap(UniformBlockBinding, void, (GLuint, GLuint, GLuint))
+BGL_Wrap(BindBufferBase, void, (GLenum, GLuint, GLuint));
+BGL_Wrap(BindBufferRange, void, (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr));
+BGL_Wrap(GetActiveUniformBlockName, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLcharP));
+BGL_Wrap(GetActiveUniformBlockiv, void, (GLuint, GLuint, GLenum, GLintP));
+BGL_Wrap(GetActiveUniformName, void, (GLuint, GLuint, GLsizei, GLsizeiP, GLcharP));
+BGL_Wrap(GetActiveUniformsiv, void, (GLuint, GLsizei, GLuintP, GLenum, GLintP));
+BGL_Wrap(GetIntegeri_v, void, (GLenum, GLuint, GLintP));
+BGL_Wrap(GetUniformBlockIndex, GLuint, (GLuint, GLstring));
+BGL_Wrap(GetUniformIndices, void, (GLuint, GLsizei, GLcharP, GLuintP));
+BGL_Wrap(UniformBlockBinding, void, (GLuint, GLuint, GLuint));
/* GL_VERSION_3_2 */
-BGL_Wrap(FramebufferTexture, void, (GLenum, GLenum, GLuint, GLint))
-BGL_Wrap(GetBufferParameteri64v, void, (GLenum, GLenum, GLint64P))
-BGL_Wrap(GetInteger64i_v, void, (GLenum, GLuint, GLint64P))
-BGL_Wrap(GetMultisamplefv, void, (GLenum, GLuint, GLfloatP))
-BGL_Wrap(SampleMaski, void, (GLuint, GLbitfield))
-BGL_Wrap(TexImage2DMultisample, void, (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean))
-BGL_Wrap(TexImage3DMultisample, void, (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean))
+BGL_Wrap(FramebufferTexture, void, (GLenum, GLenum, GLuint, GLint));
+BGL_Wrap(GetBufferParameteri64v, void, (GLenum, GLenum, GLint64P));
+BGL_Wrap(GetInteger64i_v, void, (GLenum, GLuint, GLint64P));
+BGL_Wrap(GetMultisamplefv, void, (GLenum, GLuint, GLfloatP));
+BGL_Wrap(SampleMaski, void, (GLuint, GLbitfield));
+BGL_Wrap(TexImage2DMultisample, void, (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean));
+BGL_Wrap(TexImage3DMultisample, void, (GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean));
/* GL_VERSION_3_3 */
@@ -1336,7 +1326,6 @@ BGL_Wrap(TexImage3DMultisample, void, (GLenum, GLsizei, GLenum, GLsizei
/* -------------------------------------------------------------------- */
-
/** \name Module Definition
* \{ */
diff --git a/source/blender/python/generic/bgl.h b/source/blender/python/generic/bgl.h
index 1373c81046b..105056be5e6 100644
--- a/source/blender/python/generic/bgl.h
+++ b/source/blender/python/generic/bgl.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Willian P. Germano
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/generic/bgl.h
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*/
#ifndef __BGL_H__
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 7337706639f..79ffb9aa892 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/generic/blf_py_api.c
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*
* This file defines the 'bgl' module, used for drawing text in OpenGL.
*/
@@ -471,7 +465,7 @@ static PyMethodDef BLF_methods[] = {
{"color", (PyCFunction) py_blf_color, METH_VARARGS, py_blf_color_doc},
{"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc},
{"unload", (PyCFunction) py_blf_unload, METH_VARARGS, py_blf_unload_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(BLF_doc,
diff --git a/source/blender/python/generic/blf_py_api.h b/source/blender/python/generic/blf_py_api.h
index d856e68faee..ba816016b4f 100644
--- a/source/blender/python/generic/blf_py_api.h
+++ b/source/blender/python/generic/blf_py_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BLF_PY_API_H__
#define __BLF_PY_API_H__
-/** \file blender/python/generic/blf_py_api.h
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*/
PyObject *BPyInit_blf(void);
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 926de79d0ff..96b5645f0e7 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Willian P. Germano, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/generic/bpy_internal_import.c
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*
* This file defines replacements for pythons '__import__' and 'imp.reload'
* functions which can import from blender textblocks.
@@ -192,7 +186,7 @@ PyObject *bpy_text_import_name(const char *name, int *found)
memcpy(txtname, name, namelen);
memcpy(&txtname[namelen], ".py", 4);
- text = BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
+ text = BLI_findstring(&maggie->texts, txtname, offsetof(ID, name) + 2);
if (text) {
*found = 1;
@@ -202,7 +196,7 @@ PyObject *bpy_text_import_name(const char *name, int *found)
/* If we still haven't found the module try additional modules form bpy_import_main_list */
maggie = bpy_import_main_list.first;
while (maggie && !text) {
- text = BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
+ text = BLI_findstring(&maggie->texts, txtname, offsetof(ID, name) + 2);
maggie = maggie->next;
}
@@ -251,7 +245,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
}
/* look up the text object */
- text = BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2);
+ text = BLI_findstring(&maggie->texts, BLI_path_basename(filepath), offsetof(ID, name) + 2);
/* uh-oh.... didn't find it */
if (!text)
diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h
index 8de1436ed48..bb02b7c2cfe 100644
--- a/source/blender/python/generic/bpy_internal_import.h
+++ b/source/blender/python/generic/bpy_internal_import.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Willian P. Germano, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/generic/bpy_internal_import.h
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*/
diff --git a/source/blender/python/generic/bpy_threads.c b/source/blender/python/generic/bpy_threads.c
index fbc145660f3..1f80caa6182 100644
--- a/source/blender/python/generic/bpy_threads.c
+++ b/source/blender/python/generic/bpy_threads.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): None yet
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/generic/bpy_threads.c
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*
* This file contains wrapper functions related to global interpreter lock.
* these functions are slightly different from the original Python API,
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 072c11b14e5..6c5177d4759 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/generic/idprop_py_api.c
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*/
#include <Python.h>
@@ -30,7 +23,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
-#include "BLI_string.h"
#include "idprop_py_api.h"
@@ -269,7 +261,7 @@ static PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
static PyGetSetDef BPy_IDGroup_getseters[] = {
{(char *)"name", (getter)BPy_IDGroup_GetName, (setter)BPy_IDGroup_SetName, (char *)"The name of this Group.", NULL},
- {NULL, NULL, NULL, NULL, NULL}
+ {NULL, NULL, NULL, NULL, NULL},
};
static Py_ssize_t BPy_IDGroup_Map_Len(BPy_IDProperty *self)
@@ -649,7 +641,6 @@ static IDProperty *idp_from_PyObject(PyObject *name_obj, PyObject *ob)
}
/* -------------------------------------------------------------------------- */
-
/**
* \note group can be a pointer array or a group.
* assume we already checked key is a string.
@@ -1146,7 +1137,7 @@ static struct PyMethodDef BPy_IDGroup_methods[] = {
{"get", (PyCFunction)BPy_IDGroup_get, METH_VARARGS, BPy_IDGroup_get_doc},
{"to_dict", (PyCFunction)BPy_IDGroup_to_dict, METH_NOARGS, BPy_IDGroup_to_dict_doc},
{"clear", (PyCFunction)BPy_IDGroup_clear, METH_NOARGS, BPy_IDGroup_clear_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static PySequenceMethods BPy_IDGroup_Seq = {
@@ -1290,7 +1281,7 @@ static PyObject *BPy_IDArray_to_list(BPy_IDArray *self)
static PyMethodDef BPy_IDArray_methods[] = {
{"to_list", (PyCFunction)BPy_IDArray_to_list, METH_NOARGS, BPy_IDArray_to_list_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static int BPy_IDArray_Len(BPy_IDArray *self)
@@ -1520,7 +1511,7 @@ static int BPy_IDArray_ass_subscript(BPy_IDArray *self, PyObject *item, PyObject
static PyMappingMethods BPy_IDArray_AsMapping = {
(lenfunc)BPy_IDArray_Len,
(binaryfunc)BPy_IDArray_subscript,
- (objobjargproc)BPy_IDArray_ass_subscript
+ (objobjargproc)BPy_IDArray_ass_subscript,
};
static int itemsize_by_idarray_type(int array_type)
@@ -1640,7 +1631,7 @@ PyTypeObject BPy_IDArray_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
/*********** ID Property Group iterator ********/
@@ -1781,7 +1772,7 @@ static PyObject *BPyInit_idprop_types(void)
/* --- */
static PyMethodDef IDProp_methods[] = {
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
diff --git a/source/blender/python/generic/idprop_py_api.h b/source/blender/python/generic/idprop_py_api.h
index 279dad40456..369b8359c55 100644
--- a/source/blender/python/generic/idprop_py_api.h
+++ b/source/blender/python/generic/idprop_py_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,23 +12,19 @@
* 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, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/generic/idprop_py_api.h
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*/
#ifndef __IDPROP_PY_API_H__
#define __IDPROP_PY_API_H__
+struct BPy_IDGroup_Iter;
struct ID;
struct IDProperty;
-struct BPy_IDGroup_Iter;
extern PyTypeObject BPy_IDArray_Type;
extern PyTypeObject BPy_IDGroup_Iter_Type;
diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c
index dfe4007e404..ed9994276c5 100644
--- a/source/blender/python/generic/imbuf_py_api.c
+++ b/source/blender/python/generic/imbuf_py_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/generic/imbuf_py_api.c
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*
* This file defines the 'imbuf' image manipulation module.
*/
@@ -152,7 +146,7 @@ static struct PyMethodDef Py_ImBuf_methods[] = {
{"copy", (PyCFunction)py_imbuf_copy, METH_NOARGS, (char *)py_imbuf_copy_doc},
{"__copy__", (PyCFunction)py_imbuf_copy, METH_NOARGS, (char *)py_imbuf_copy_doc},
{"__deepcopy__", (PyCFunction)py_imbuf_deepcopy, METH_VARARGS, (char *)py_imbuf_copy_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/** \} */
@@ -441,7 +435,7 @@ static PyMethodDef IMB_methods[] = {
{"new", (PyCFunction) M_imbuf_new, METH_VARARGS | METH_KEYWORDS, M_imbuf_new_doc},
{"load", (PyCFunction) M_imbuf_load, METH_VARARGS | METH_KEYWORDS, M_imbuf_load_doc},
{"write", (PyCFunction) M_imbuf_write, METH_VARARGS | METH_KEYWORDS, M_imbuf_write_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(IMB_doc,
diff --git a/source/blender/python/generic/imbuf_py_api.h b/source/blender/python/generic/imbuf_py_api.h
index 35adc541bfc..c36c4ba11f6 100644
--- a/source/blender/python/generic/imbuf_py_api.h
+++ b/source/blender/python/generic/imbuf_py_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __IMBUF_PY_API_H__
#define __IMBUF_PY_API_H__
-/** \file blender/python/generic/imbuf_py_api.h
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*/
PyObject *BPyInit_imbuf(void);
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 991a035f683..f18e794ead3 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/generic/py_capi_utils.c
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*
* Extend upon CPython's API, filling in some gaps, these functions use PyC_
* prefix to distinguish them apart from CPython.
@@ -436,17 +432,24 @@ PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *for
if (PyErr_Occurred()) {
PyObject *error_type, *error_value, *error_traceback;
PyErr_Fetch(&error_type, &error_value, &error_traceback);
- PyErr_Format(exception_type_prefix,
- "%S, %.200s(%S)",
- error_value_prefix,
- Py_TYPE(error_value)->tp_name,
- error_value
- );
+
+ if (PyUnicode_Check(error_value)) {
+ PyErr_Format(exception_type_prefix,
+ "%S, %S",
+ error_value_prefix,
+ error_value);
+ }
+ else {
+ PyErr_Format(exception_type_prefix,
+ "%S, %.200s(%S)",
+ error_value_prefix,
+ Py_TYPE(error_value)->tp_name,
+ error_value);
+ }
}
else {
PyErr_SetObject(exception_type_prefix,
- error_value_prefix
- );
+ error_value_prefix);
}
Py_XDECREF(error_value_prefix);
@@ -455,6 +458,11 @@ PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *for
return NULL;
}
+PyObject *PyC_Err_SetString_Prefix(PyObject *exception_type_prefix, const char *str)
+{
+ return PyC_Err_Format_Prefix(exception_type_prefix, "%s", str);
+}
+
/**
* Use for Python callbacks run directly from C,
* when we can't use normal methods of raising exceptions.
@@ -1236,7 +1244,6 @@ bool PyC_RunString_AsString(const char *imports[], const char *expr, const char
#endif /* #ifndef MATH_STANDALONE */
/* -------------------------------------------------------------------- */
-
/** \name Int Conversion
*
* \note Python doesn't provide overflow checks for specific bit-widths.
@@ -1328,7 +1335,6 @@ uint32_t PyC_Long_AsU32(PyObject *value)
*/
/* -------------------------------------------------------------------- */
-
/** \name Py_buffer Utils
*
* \{ */
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index 21e4ecf2e86..76c28e4a6f5 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/generic/py_capi_utils.h
- * \ingroup pygen
+/** \file
+ * \ingroup pygen
*/
#ifndef __PY_CAPI_UTILS_H__
@@ -38,7 +32,10 @@ PyObject *PyC_ExceptionBuffer(void);
PyObject *PyC_ExceptionBuffer_Simple(void);
PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
PyObject *PyC_FrozenSetFromStrings(const char **strings);
+
PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...);
+PyObject *PyC_Err_SetString_Prefix(PyObject *exception_type_prefix, const char *str);
+
void PyC_Err_PrintWithFunc(PyObject *py_func);
void PyC_FileAndNum(const char **filename, int *lineno);
diff --git a/source/blender/python/generic/python_utildefines.h b/source/blender/python/generic/python_utildefines.h
index 83880d82973..70840e5ce34 100644
--- a/source/blender/python/generic/python_utildefines.h
+++ b/source/blender/python/generic/python_utildefines.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/generic/python_utildefines.h
- * \ingroup pygen
- * \brief header-only utilities
- * \note light addition to Python.h, use py_capi_utils.h for larger features.
+/** \file
+ * \ingroup pygen
+ * \brief header-only utilities
+ * \note light addition to Python.h, use py_capi_utils.h for larger features.
*/
#ifndef __PYTHON_UTILDEFINES_H__
diff --git a/source/blender/python/gpu/CMakeLists.txt b/source/blender/python/gpu/CMakeLists.txt
index fcb0b828ffb..3c3a9b7e577 100644
--- a/source/blender/python/gpu/CMakeLists.txt
+++ b/source/blender/python/gpu/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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 *****
set(INC
diff --git a/source/blender/python/gpu/gpu_py_api.c b/source/blender/python/gpu/gpu_py_api.c
index 7e999bdcc2d..e2baf548064 100644
--- a/source/blender/python/gpu/gpu_py_api.c
+++ b/source/blender/python/gpu/gpu_py_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_api.c
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*
* Experimental Python API, not considered public yet (called '_gpu'),
* we may re-expose as public later.
@@ -45,7 +41,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Utils to invalidate functions
* \{ */
@@ -66,7 +61,6 @@ bool bpygpu_is_initialized_or_error(void)
/* -------------------------------------------------------------------- */
-
/** \name Primitive Type Utils
* \{ */
@@ -113,7 +107,6 @@ success:
/* -------------------------------------------------------------------- */
-
/** \name GPU Module
* \{ */
diff --git a/source/blender/python/gpu/gpu_py_api.h b/source/blender/python/gpu/gpu_py_api.h
index af08881b723..d4cfcce24e9 100644
--- a/source/blender/python/gpu/gpu_py_api.h
+++ b/source/blender/python/gpu/gpu_py_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_api.h
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*/
#ifndef __GPU_PY_API_H__
diff --git a/source/blender/python/gpu/gpu_py_batch.c b/source/blender/python/gpu/gpu_py_batch.c
index a50ea32b5dd..b5f9bb0f45a 100644
--- a/source/blender/python/gpu/gpu_py_batch.c
+++ b/source/blender/python/gpu/gpu_py_batch.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,12 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright 2015, Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_batch.c
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*
* This file defines the offscreen functionalities of the 'gpu' module
* used for off-screen OpenGL rendering.
@@ -36,7 +32,6 @@
#include "BLI_utildefines.h"
-#include "BKE_global.h"
#include "GPU_batch.h"
@@ -285,7 +280,7 @@ static struct PyMethodDef bpygpu_Batch_methods[] = {
METH_NOARGS, ""},
{"_program_use_end", (PyCFunction)bpygpu_Batch_program_use_end,
METH_NOARGS, ""},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
#ifdef USE_GPU_PY_REFERENCES
@@ -363,7 +358,7 @@ PyTypeObject BPyGPUBatch_Type = {
/* -------------------------------------------------------------------- */
/** \name Public API
-* \{ */
+ * \{ */
PyObject *BPyGPUBatch_CreatePyObject(GPUBatch *batch)
{
diff --git a/source/blender/python/gpu/gpu_py_batch.h b/source/blender/python/gpu/gpu_py_batch.h
index c77574428db..a0de4663889 100644
--- a/source/blender/python/gpu/gpu_py_batch.h
+++ b/source/blender/python/gpu/gpu_py_batch.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_batch.h
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*/
#ifndef __GPU_PY_BATCH_H__
diff --git a/source/blender/python/gpu/gpu_py_element.c b/source/blender/python/gpu/gpu_py_element.c
index 2faf57ac55c..b33ab9ec7cc 100644
--- a/source/blender/python/gpu/gpu_py_element.c
+++ b/source/blender/python/gpu/gpu_py_element.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_element.c
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*
* - Use ``bpygpu_`` for local API.
* - Use ``BPyGPU`` for public API.
@@ -41,7 +37,6 @@
/* -------------------------------------------------------------------- */
-
/** \name IndexBuf Type
* \{ */
@@ -227,7 +222,6 @@ PyTypeObject BPyGPUIndexBuf_Type = {
/* -------------------------------------------------------------------- */
-
/** \name Public API
* \{ */
diff --git a/source/blender/python/gpu/gpu_py_element.h b/source/blender/python/gpu/gpu_py_element.h
index e201a767582..274149db565 100644
--- a/source/blender/python/gpu/gpu_py_element.h
+++ b/source/blender/python/gpu/gpu_py_element.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_element.h
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*/
#ifndef __GPU_PY_ELEMENT_H__
diff --git a/source/blender/python/gpu/gpu_py_matrix.c b/source/blender/python/gpu/gpu_py_matrix.c
index 6c77f2ee02b..6f74fc41567 100644
--- a/source/blender/python/gpu/gpu_py_matrix.c
+++ b/source/blender/python/gpu/gpu_py_matrix.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_matrix.c
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*
* This file defines the gpu.matrix stack API.
*
@@ -177,7 +173,7 @@ static PyObject *bpygpu_matrix_stack_context_exit(BPyGPU_MatrixStackContext *sel
static PyMethodDef bpygpu_matrix_stack_context_methods[] = {
{"__enter__", (PyCFunction)bpygpu_matrix_stack_context_enter, METH_NOARGS},
{"__exit__", (PyCFunction)bpygpu_matrix_stack_context_exit, METH_VARARGS},
- {NULL}
+ {NULL},
};
static PyTypeObject BPyGPU_matrix_stack_context_Type = {
@@ -546,7 +542,7 @@ static struct PyMethodDef bpygpu_matrix_methods[] = {
{"get_normal_matrix", (PyCFunction)bpygpu_matrix_get_normal_matrix,
METH_NOARGS, bpygpu_matrix_get_normal_matrix_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(bpygpu_matrix_doc,
diff --git a/source/blender/python/gpu/gpu_py_matrix.h b/source/blender/python/gpu/gpu_py_matrix.h
index 7bd6318611d..d17bce6a7d3 100644
--- a/source/blender/python/gpu/gpu_py_matrix.h
+++ b/source/blender/python/gpu/gpu_py_matrix.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_matrix.h
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*/
#ifndef __GPU_PY_MATRIX_H__
diff --git a/source/blender/python/gpu/gpu_py_offscreen.c b/source/blender/python/gpu/gpu_py_offscreen.c
index 5dc6e36ca56..4027edbb0f9 100644
--- a/source/blender/python/gpu/gpu_py_offscreen.c
+++ b/source/blender/python/gpu/gpu_py_offscreen.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -16,12 +14,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright 2015, Blender Foundation.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_offscreen.c
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*
* This file defines the offscreen functionalities of the 'gpu' module
* used for off-screen OpenGL rendering.
@@ -36,7 +32,6 @@
#include "BLI_utildefines.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_scene.h"
@@ -81,7 +76,6 @@ static int bpygpu_offscreen_valid_check(BPyGPUOffScreen *bpygpu_ofs)
/* -------------------------------------------------------------------- */
-
/** \name GPUOffscreen Type
* \{ */
@@ -324,7 +318,7 @@ static struct PyMethodDef bpygpu_offscreen_methods[] = {
{"free", (PyCFunction)bpygpu_offscreen_free, METH_NOARGS, bpygpu_offscreen_free_doc},
{"__enter__", (PyCFunction)bpygpu_offscreen_bind_context_enter, METH_NOARGS},
{"__exit__", (PyCFunction)bpygpu_offscreen_bind_context_exit, METH_VARARGS},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(bpygpu_offscreen_doc,
@@ -355,7 +349,6 @@ PyTypeObject BPyGPUOffScreen_Type = {
/* -------------------------------------------------------------------- */
-
/** \name Public API
* \{ */
diff --git a/source/blender/python/gpu/gpu_py_offscreen.h b/source/blender/python/gpu/gpu_py_offscreen.h
index c4a2d02a694..c62f1e9051a 100644
--- a/source/blender/python/gpu/gpu_py_offscreen.h
+++ b/source/blender/python/gpu/gpu_py_offscreen.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_offscreen.h
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*/
#ifndef __GPU_PY_OFFSCREEN_H__
diff --git a/source/blender/python/gpu/gpu_py_select.c b/source/blender/python/gpu/gpu_py_select.c
index 56b8b904464..0744d6b26ba 100644
--- a/source/blender/python/gpu/gpu_py_select.c
+++ b/source/blender/python/gpu/gpu_py_select.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_select.c
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*
* This file defines the gpu.select API.
*
@@ -70,7 +66,7 @@ static PyObject *bpygpu_select_load_id(PyObject *UNUSED(self), PyObject *value)
static struct PyMethodDef bpygpu_select_methods[] = {
/* Manage Stack */
{"load_id", (PyCFunction)bpygpu_select_load_id, METH_O, bpygpu_select_load_id_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(bpygpu_select_doc,
diff --git a/source/blender/python/gpu/gpu_py_select.h b/source/blender/python/gpu/gpu_py_select.h
index 11daf2ade64..97cc4b8285f 100644
--- a/source/blender/python/gpu/gpu_py_select.h
+++ b/source/blender/python/gpu/gpu_py_select.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_select.h
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*/
#ifndef __GPU_PY_SELECT_H__
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index 52fe6f2d912..37f4c17a956 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_shader.c
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*
* - Use ``bpygpu_`` for local API.
* - Use ``BPyGPU`` for public API.
@@ -64,7 +60,7 @@ static int bpygpu_ParseBultinShaderEnum(PyObject *o, void *p)
} \
} ((void)0)
- GPUBuiltinShader mode;
+ eGPUBuiltinShader mode;
MATCH_ID(2D_UNIFORM_COLOR);
MATCH_ID(2D_FLAT_COLOR);
MATCH_ID(2D_SMOOTH_COLOR);
@@ -80,13 +76,13 @@ static int bpygpu_ParseBultinShaderEnum(PyObject *o, void *p)
return 0;
success:
- (*(GPUBuiltinShader *)p) = mode;
+ (*(eGPUBuiltinShader *)p) = mode;
return 1;
}
static int bpygpu_uniform_location_get(GPUShader *shader, const char *name, const char *error_prefix)
{
- int uniform = GPU_shader_get_uniform(shader, name);
+ int uniform = GPU_shader_get_uniform_ensure(shader, name);
if (uniform == -1) {
PyErr_Format(PyExc_ValueError, "%s: uniform %.32s %.32s not found", error_prefix, name);
@@ -99,7 +95,6 @@ static int bpygpu_uniform_location_get(GPUShader *shader, const char *name, cons
/* -------------------------------------------------------------------- */
-
/** \name Shader Type
* \{ */
@@ -611,7 +606,7 @@ static struct PyMethodDef bpygpu_shader_methods[] = {
{"format_calc",
(PyCFunction)bpygpu_shader_calc_format,
METH_NOARGS, bpygpu_shader_calc_format_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(bpygpu_shader_program_doc,
@@ -682,7 +677,6 @@ PyTypeObject BPyGPUShader_Type = {
/* -------------------------------------------------------------------- */
-
/** \name gpu.shader Module API
* \{ */
@@ -720,7 +714,7 @@ static PyObject *bpygpu_shader_from_builtin(PyObject *UNUSED(self), PyObject *ar
{
BPYGPU_IS_INIT_OR_ERROR_OBJ;
- GPUBuiltinShader shader_id;
+ eGPUBuiltinShader shader_id;
if (!bpygpu_ParseBultinShaderEnum(arg, &shader_id)) {
return NULL;
@@ -750,7 +744,7 @@ PyDoc_STRVAR(bpygpu_shader_code_from_builtin_doc,
);
static PyObject *bpygpu_shader_code_from_builtin(BPyGPUShader *UNUSED(self), PyObject *arg)
{
- GPUBuiltinShader shader_id;
+ eGPUBuiltinShader shader_id;
const char *vert;
const char *frag;
@@ -795,7 +789,7 @@ static struct PyMethodDef bpygpu_shader_module_methods[] = {
{"code_from_builtin",
(PyCFunction)bpygpu_shader_code_from_builtin,
METH_O, bpygpu_shader_code_from_builtin_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(bpygpu_shader_module_doc,
@@ -812,7 +806,6 @@ static PyModuleDef BPyGPU_shader_module_def = {
/* -------------------------------------------------------------------- */
-
/** \name Public API
* \{ */
diff --git a/source/blender/python/gpu/gpu_py_shader.h b/source/blender/python/gpu/gpu_py_shader.h
index c038cf63e40..a6fd9f5c915 100644
--- a/source/blender/python/gpu/gpu_py_shader.h
+++ b/source/blender/python/gpu/gpu_py_shader.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_shader.h
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*/
#ifndef __GPU_PY_SHADER_H__
diff --git a/source/blender/python/gpu/gpu_py_types.c b/source/blender/python/gpu/gpu_py_types.c
index d9ef0736f8e..7ed1832eb57 100644
--- a/source/blender/python/gpu/gpu_py_types.c
+++ b/source/blender/python/gpu/gpu_py_types.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_types.c
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*
* - Use ``bpygpu_`` for local API.
* - Use ``BPyGPU`` for public API.
diff --git a/source/blender/python/gpu/gpu_py_types.h b/source/blender/python/gpu/gpu_py_types.h
index dc91c579aaf..7e73f5b9084 100644
--- a/source/blender/python/gpu/gpu_py_types.h
+++ b/source/blender/python/gpu/gpu_py_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_types.h
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*/
#ifndef __GPU_PY_TYPES_H__
diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.c b/source/blender/python/gpu/gpu_py_vertex_buffer.c
index c13e3f2195e..62c3b4f696f 100644
--- a/source/blender/python/gpu/gpu_py_vertex_buffer.c
+++ b/source/blender/python/gpu/gpu_py_vertex_buffer.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_vertex_buffer.c
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*
* - Use ``bpygpu_`` for local API.
* - Use ``BPyGPU`` for public API.
@@ -40,7 +36,6 @@
#include "gpu_py_vertex_buffer.h" /* own include */
/* -------------------------------------------------------------------- */
-
/** \name Utility Functions
* \{ */
@@ -102,7 +97,7 @@ static bool bpygpu_vertbuf_fill_impl(
const char *exc_str_size_mismatch = "Expected a %s of size %d, got %u";
bool ok = true;
- const GPUVertAttr *attr = &vbo->format.attribs[data_id];
+ const GPUVertAttr *attr = &vbo->format.attrs[data_id];
if (PyObject_CheckBuffer(seq)) {
Py_buffer pybuffer;
@@ -216,7 +211,6 @@ static int bpygpu_attr_fill(GPUVertBuf *buf, int id, PyObject *py_seq_data, cons
/* -------------------------------------------------------------------- */
-
/** \name VertBuf Type
* \{ */
@@ -301,7 +295,7 @@ static PyObject *bpygpu_VertBuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, P
static struct PyMethodDef bpygpu_VertBuf_methods[] = {
{"attr_fill", (PyCFunction) bpygpu_VertBuf_attr_fill,
METH_VARARGS | METH_KEYWORDS, bpygpu_VertBuf_attr_fill_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static void bpygpu_VertBuf_dealloc(BPyGPUVertBuf *self)
@@ -335,7 +329,6 @@ PyTypeObject BPyGPUVertBuf_Type = {
/* -------------------------------------------------------------------- */
-
/** \name Public API
* \{ */
diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.h b/source/blender/python/gpu/gpu_py_vertex_buffer.h
index 6751956298c..2037c145704 100644
--- a/source/blender/python/gpu/gpu_py_vertex_buffer.h
+++ b/source/blender/python/gpu/gpu_py_vertex_buffer.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_vertex_buffer.h
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*/
#ifndef __GPU_PY_VERTEX_BUFFER_H__
diff --git a/source/blender/python/gpu/gpu_py_vertex_format.c b/source/blender/python/gpu/gpu_py_vertex_format.c
index 27f3791ec15..2cadbaf17ff 100644
--- a/source/blender/python/gpu/gpu_py_vertex_format.c
+++ b/source/blender/python/gpu/gpu_py_vertex_format.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_vertex_format.c
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*
* - Use ``bpygpu_`` for local API.
* - Use ``BPyGPU`` for public API.
@@ -49,7 +45,6 @@
#endif
/* -------------------------------------------------------------------- */
-
/** \name Enum Conversion
*
* Use with PyArg_ParseTuple's "O&" formatting.
@@ -148,7 +143,6 @@ static int bpygpu_ParseVertFetchMode(PyObject *o, void *p)
/* -------------------------------------------------------------------- */
-
/** \name VertFormat Type
* \{ */
@@ -212,7 +206,7 @@ static PyObject *bpygpu_VertFormat_attr_add(BPyGPUVertFormat *self, PyObject *ar
static struct PyMethodDef bpygpu_VertFormat_methods[] = {
{"attr_add", (PyCFunction)bpygpu_VertFormat_attr_add,
METH_VARARGS | METH_KEYWORDS, bpygpu_VertFormat_attr_add_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
@@ -241,7 +235,6 @@ PyTypeObject BPyGPUVertFormat_Type = {
/* -------------------------------------------------------------------- */
-
/** \name Public API
* \{ */
diff --git a/source/blender/python/gpu/gpu_py_vertex_format.h b/source/blender/python/gpu/gpu_py_vertex_format.h
index 5b0bf1addc2..ba09c055aca 100644
--- a/source/blender/python/gpu/gpu_py_vertex_format.h
+++ b/source/blender/python/gpu/gpu_py_vertex_format.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/gpu/gpu_py_vertex_format.h
- * \ingroup bpygpu
+/** \file
+ * \ingroup bpygpu
*/
#ifndef __GPU_PY_VERTEX_FORMAT_H__
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index bd7306cddf2..89e5e368ced 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurainm, Campbell Barton
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
@@ -62,12 +57,12 @@ set(SRC
bpy_app_translations.c
bpy_capi_utils.c
bpy_driver.c
+ bpy_gizmo_wrap.c
bpy_interface.c
bpy_interface_atexit.c
bpy_intern_string.c
bpy_library_load.c
bpy_library_write.c
- bpy_gizmo_wrap.c
bpy_msgbus.c
bpy_operator.c
bpy_operator_wrap.c
@@ -78,8 +73,8 @@ set(SRC
bpy_rna_array.c
bpy_rna_callback.c
bpy_rna_driver.c
- bpy_rna_id_collection.c
bpy_rna_gizmo.c
+ bpy_rna_id_collection.c
bpy_traceback.c
bpy_utils_previews.c
bpy_utils_units.c
@@ -101,9 +96,9 @@ set(SRC
bpy_app_translations.h
bpy_capi_utils.h
bpy_driver.h
+ bpy_gizmo_wrap.h
bpy_intern_string.h
bpy_library.h
- bpy_gizmo_wrap.h
bpy_msgbus.h
bpy_operator.h
bpy_operator_wrap.h
@@ -113,8 +108,8 @@ set(SRC
bpy_rna_anim.h
bpy_rna_callback.h
bpy_rna_driver.h
- bpy_rna_id_collection.h
bpy_rna_gizmo.h
+ bpy_rna_id_collection.h
bpy_traceback.h
bpy_utils_previews.h
bpy_utils_units.h
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 07ad8274f11..05b471c4db7 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines the '_bpy' module which is used by python's 'bpy' package
* to access C defined builtin functions.
@@ -300,7 +294,6 @@ static PyObject *bpy_import_test(const char *modname)
******************************************************************************/
void BPy_init_modules(void)
{
- extern BPy_StructRNA *bpy_context_module;
PointerRNA ctx_ptr;
PyObject *mod;
diff --git a/source/blender/python/intern/bpy.h b/source/blender/python/intern/bpy.h
index b647d0d450c..bd0212cb52a 100644
--- a/source/blender/python/intern/bpy.h
+++ b/source/blender/python/intern/bpy.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,13 +12,10 @@
* 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 ***** */
+ */
-/** \file blender/python/intern/bpy.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_H__
@@ -33,4 +28,7 @@ extern PyObject *bpy_package_py;
void BPY_atexit_register(void);
void BPY_atexit_unregister(void);
+extern struct CLG_LogRef *BPY_LOG_CONTEXT;
+extern struct CLG_LogRef *BPY_LOG_RNA;
+
#endif /* __BPY_H__ */
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index bba9eee0316..252fd1b3e23 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_app.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines a 'PyStructSequence' accessed via 'bpy.app', mostly
* exposing static applications variables such as version and buildinfo
@@ -147,7 +141,7 @@ static PyStructSequence_Desc app_info_desc = {
(char *)"bpy.app", /* name */
bpy_app_doc, /* doc */
app_info_fields, /* fields */
- ARRAY_SIZE(app_info_fields) - 1
+ ARRAY_SIZE(app_info_fields) - 1,
};
static PyObject *make_app_info(void)
@@ -265,6 +259,41 @@ static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *clos
return 0;
}
+PyDoc_STRVAR(bpy_app_global_flag_doc,
+"Boolean, for application behavior (started with --enable-* matching this attribute name)"
+);
+static PyObject *bpy_app_global_flag_get(PyObject *UNUSED(self), void *closure)
+{
+ const int flag = POINTER_AS_INT(closure);
+ return PyBool_FromLong(G.f & flag);
+}
+
+static int bpy_app_global_flag_set(PyObject *UNUSED(self), PyObject *value, void *closure)
+{
+ const int flag = POINTER_AS_INT(closure);
+ const int param = PyObject_IsTrue(value);
+
+ if (param == -1) {
+ PyErr_SetString(PyExc_TypeError, "bpy.app.use_* can only be True/False");
+ return -1;
+ }
+
+ if (param) G.f |= flag;
+ else G.f &= ~flag;
+
+ return 0;
+}
+
+static int bpy_app_global_flag_set__only_disable(PyObject *UNUSED(self), PyObject *value, void *closure)
+{
+ const int param = PyObject_IsTrue(value);
+ if (param == 1) {
+ PyErr_SetString(PyExc_ValueError, "This bpy.app.use_* option can only be disabled");
+ return -1;
+ }
+ return bpy_app_global_flag_set(NULL, value, closure);
+}
+
#define BROKEN_BINARY_PATH_PYTHON_HACK
PyDoc_STRVAR(bpy_app_binary_path_python_doc,
@@ -297,7 +326,7 @@ static PyObject *bpy_app_binary_path_python_get(PyObject *self, void *UNUSED(clo
}
PyDoc_STRVAR(bpy_app_debug_value_doc,
-"Int, number which can be set to non-zero values for testing purposes"
+"Short, number which can be set to non-zero values for testing purposes"
);
static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(closure))
{
@@ -306,10 +335,12 @@ static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(cl
static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
{
- int param = PyC_Long_AsI32(value);
+ short param = PyC_Long_AsI16(value);
if (param == -1 && PyErr_Occurred()) {
- PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number");
+ PyC_Err_SetString_Prefix(
+ PyExc_TypeError,
+ "bpy.app.debug_value can only be set to a whole number");
return -1;
}
@@ -320,12 +351,6 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void
return 0;
}
-static PyObject *bpy_app_global_flag_get(PyObject *UNUSED(self), void *closure)
-{
- const int flag = POINTER_AS_INT(closure);
- return PyBool_FromLong(G.f & flag);
-}
-
PyDoc_STRVAR(bpy_app_tempdir_doc,
"String, the temp directory used by blender (read-only)"
);
@@ -405,6 +430,7 @@ static PyGetSetDef bpy_app_getsets[] = {
{(char *)"debug_io", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_IO},
{(char *)"use_static_override", bpy_app_use_static_override_get, bpy_app_use_static_override_set, (char *)bpy_app_use_static_override_doc, NULL},
+ {(char *)"use_event_simulate", bpy_app_global_flag_get, bpy_app_global_flag_set__only_disable, (char *)bpy_app_global_flag_doc, (void *)G_FLAG_EVENT_SIMULATE},
{(char *)"binary_path_python", bpy_app_binary_path_python_get, NULL, (char *)bpy_app_binary_path_python_doc, NULL},
@@ -416,10 +442,10 @@ static PyGetSetDef bpy_app_getsets[] = {
{(char *)"render_preview_size", bpy_app_preview_render_size_get, NULL, (char *)bpy_app_preview_render_size_doc, (void *)ICON_SIZE_PREVIEW},
/* security */
- {(char *)"autoexec_fail", bpy_app_global_flag_get, NULL, NULL, (void *)G_SCRIPT_AUTOEXEC_FAIL},
- {(char *)"autoexec_fail_quiet", bpy_app_global_flag_get, NULL, NULL, (void *)G_SCRIPT_AUTOEXEC_FAIL_QUIET},
+ {(char *)"autoexec_fail", bpy_app_global_flag_get, NULL, NULL, (void *)G_FLAG_SCRIPT_AUTOEXEC_FAIL},
+ {(char *)"autoexec_fail_quiet", bpy_app_global_flag_get, NULL, NULL, (void *)G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET},
{(char *)"autoexec_fail_message", bpy_app_autoexec_fail_message_get, NULL, NULL, NULL},
- {NULL, NULL, NULL, NULL, NULL}
+ {NULL, NULL, NULL, NULL, NULL},
};
static void py_struct_seq_getset_init(void)
diff --git a/source/blender/python/intern/bpy_app.h b/source/blender/python/intern/bpy_app.h
index 226bf44a493..e9ab3cd2858 100644
--- a/source/blender/python/intern/bpy_app.h
+++ b/source/blender/python/intern/bpy_app.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_app.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_H__
diff --git a/source/blender/python/intern/bpy_app_alembic.c b/source/blender/python/intern/bpy_app_alembic.c
index 2a1a031a629..6f2874dcefa 100644
--- a/source/blender/python/intern/bpy_app_alembic.c
+++ b/source/blender/python/intern/bpy_app_alembic.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_alembic.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#include <Python.h>
@@ -46,14 +38,14 @@ static PyStructSequence_Field app_alembic_info_fields[] = {
{(char *)"supported", (char *)"Boolean, True when Blender is built with Alembic support"},
{(char *)"version", (char *)"The Alembic version as a tuple of 3 numbers"},
{(char *)"version_string", (char *)"The Alembic version formatted as a string"},
- {NULL}
+ {NULL},
};
static PyStructSequence_Desc app_alembic_info_desc = {
(char *)"bpy.app.alembic", /* name */
(char *)"This module contains information about Alembic blender is linked against", /* doc */
app_alembic_info_fields, /* fields */
- ARRAY_SIZE(app_alembic_info_fields) - 1
+ ARRAY_SIZE(app_alembic_info_fields) - 1,
};
static PyObject *make_alembic_info(void)
diff --git a/source/blender/python/intern/bpy_app_alembic.h b/source/blender/python/intern/bpy_app_alembic.h
index 773bb2fd3bf..dfa652c8d15 100644
--- a/source/blender/python/intern/bpy_app_alembic.h
+++ b/source/blender/python/intern/bpy_app_alembic.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_alembic.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_ALEMBIC_H__
diff --git a/source/blender/python/intern/bpy_app_build_options.c b/source/blender/python/intern/bpy_app_build_options.c
index 70c52b8860c..a80156a23bf 100644
--- a/source/blender/python/intern/bpy_app_build_options.c
+++ b/source/blender/python/intern/bpy_app_build_options.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_build_options.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#include <Python.h>
@@ -65,7 +59,7 @@ static PyStructSequence_Field app_builtopts_info_fields[] = {
{(char *)"openmp", NULL},
{(char *)"openvdb", NULL},
{(char *)"alembic", NULL},
- {NULL}
+ {NULL},
};
@@ -73,7 +67,7 @@ static PyStructSequence_Desc app_builtopts_info_desc = {
(char *)"bpy.app.build_options", /* name */
(char *)"This module contains information about options blender is built with", /* doc */
app_builtopts_info_fields, /* fields */
- ARRAY_SIZE(app_builtopts_info_fields) - 1
+ ARRAY_SIZE(app_builtopts_info_fields) - 1,
};
static PyObject *make_builtopts_info(void)
diff --git a/source/blender/python/intern/bpy_app_build_options.h b/source/blender/python/intern/bpy_app_build_options.h
index 82a1417ea2c..e15887d9caf 100644
--- a/source/blender/python/intern/bpy_app_build_options.h
+++ b/source/blender/python/intern/bpy_app_build_options.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_build_options.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_BUILD_OPTIONS_H__
diff --git a/source/blender/python/intern/bpy_app_ffmpeg.c b/source/blender/python/intern/bpy_app_ffmpeg.c
index 9f8355db72b..6fb53f60f90 100644
--- a/source/blender/python/intern/bpy_app_ffmpeg.c
+++ b/source/blender/python/intern/bpy_app_ffmpeg.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_ffmpeg.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#include <Python.h>
@@ -53,7 +47,7 @@ static PyStructSequence_Field app_ffmpeg_info_fields[] = {
DEF_FFMPEG_LIB_VERSION(avformat),
DEF_FFMPEG_LIB_VERSION(avutil),
DEF_FFMPEG_LIB_VERSION(swscale),
- {NULL}
+ {NULL},
};
#undef DEF_FFMPEG_LIB_VERSION
@@ -62,7 +56,7 @@ static PyStructSequence_Desc app_ffmpeg_info_desc = {
(char *)"bpy.app.ffmpeg", /* name */
(char *)"This module contains information about FFmpeg blender is linked against", /* doc */
app_ffmpeg_info_fields, /* fields */
- ARRAY_SIZE(app_ffmpeg_info_fields) - 1
+ ARRAY_SIZE(app_ffmpeg_info_fields) - 1,
};
static PyObject *make_ffmpeg_info(void)
diff --git a/source/blender/python/intern/bpy_app_ffmpeg.h b/source/blender/python/intern/bpy_app_ffmpeg.h
index 26d6e13f8f4..063781a54a5 100644
--- a/source/blender/python/intern/bpy_app_ffmpeg.h
+++ b/source/blender/python/intern/bpy_app_ffmpeg.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_ffmpeg.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_FFMPEG_H__
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index d89b3bd01f5..b6b9f294810 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_app_handlers.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines a 'PyStructSequence' accessed via 'bpy.app.handlers',
* which exposes various lists that the script author can add callback
@@ -72,14 +66,14 @@ static PyStructSequence_Field app_cb_info_fields[] = {
#define APP_CB_OTHER_FIELDS 1
{(char *)"persistent", (char *)"Function decorator for callback functions not to be removed when loading new files"},
- {NULL}
+ {NULL},
};
static PyStructSequence_Desc app_cb_info_desc = {
(char *)"bpy.app.handlers", /* name */
(char *)"This module contains callback lists", /* doc */
app_cb_info_fields, /* fields */
- ARRAY_SIZE(app_cb_info_fields) - 1
+ ARRAY_SIZE(app_cb_info_fields) - 1,
};
#if 0
diff --git a/source/blender/python/intern/bpy_app_handlers.h b/source/blender/python/intern/bpy_app_handlers.h
index 40ca43909ed..426fe376b55 100644
--- a/source/blender/python/intern/bpy_app_handlers.h
+++ b/source/blender/python/intern/bpy_app_handlers.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_app_handlers.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_HANDLERS_H__
diff --git a/source/blender/python/intern/bpy_app_icons.c b/source/blender/python/intern/bpy_app_icons.c
index 12315a6e112..863d11ff84d 100644
--- a/source/blender/python/intern/bpy_app_icons.c
+++ b/source/blender/python/intern/bpy_app_icons.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_icons.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* Runtime defined icons.
*/
@@ -160,7 +156,7 @@ static struct PyMethodDef M_AppIcons_methods[] = {
METH_VARARGS | METH_KEYWORDS, bpy_app_icons_new_triangles_from_file_doc},
{"release", (PyCFunction)bpy_app_icons_release,
METH_VARARGS | METH_KEYWORDS, bpy_app_icons_release_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyModuleDef M_AppIcons_module_def = {
diff --git a/source/blender/python/intern/bpy_app_icons.h b/source/blender/python/intern/bpy_app_icons.h
index 309c7ed222f..2d7cb96aae7 100644
--- a/source/blender/python/intern/bpy_app_icons.h
+++ b/source/blender/python/intern/bpy_app_icons.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_icons.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_ICONS_H__
diff --git a/source/blender/python/intern/bpy_app_ocio.c b/source/blender/python/intern/bpy_app_ocio.c
index 9997e6b87f1..deb025e0e33 100644
--- a/source/blender/python/intern/bpy_app_ocio.c
+++ b/source/blender/python/intern/bpy_app_ocio.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_ocio.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#include <Python.h>
@@ -41,14 +35,14 @@ static PyStructSequence_Field app_ocio_info_fields[] = {
{(char *)"supported", (char *)("Boolean, True when Blender is built with OpenColorIO support")},
{(char *)("version"), (char *)("The OpenColorIO version as a tuple of 3 numbers")},
{(char *)("version_string"), (char *)("The OpenColorIO version formatted as a string")},
- {NULL}
+ {NULL},
};
static PyStructSequence_Desc app_ocio_info_desc = {
(char *)"bpy.app.ocio", /* name */
(char *)"This module contains information about OpenColorIO blender is linked against", /* doc */
app_ocio_info_fields, /* fields */
- ARRAY_SIZE(app_ocio_info_fields) - 1
+ ARRAY_SIZE(app_ocio_info_fields) - 1,
};
static PyObject *make_ocio_info(void)
diff --git a/source/blender/python/intern/bpy_app_ocio.h b/source/blender/python/intern/bpy_app_ocio.h
index ff230b4ba66..54ecad2c5ed 100644
--- a/source/blender/python/intern/bpy_app_ocio.h
+++ b/source/blender/python/intern/bpy_app_ocio.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_ocio.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_OCIO_H__
diff --git a/source/blender/python/intern/bpy_app_oiio.c b/source/blender/python/intern/bpy_app_oiio.c
index e14b48ff7cf..5701a8def92 100644
--- a/source/blender/python/intern/bpy_app_oiio.c
+++ b/source/blender/python/intern/bpy_app_oiio.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_oiio.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#include <Python.h>
@@ -41,14 +35,14 @@ static PyStructSequence_Field app_oiio_info_fields[] = {
{(char *)"supported", (char *)("Boolean, True when Blender is built with OpenImageIO support")},
{(char *)("version"), (char *)("The OpenImageIO version as a tuple of 3 numbers")},
{(char *)("version_string"), (char *)("The OpenImageIO version formatted as a string")},
- {NULL}
+ {NULL},
};
static PyStructSequence_Desc app_oiio_info_desc = {
(char *)"bpy.app.oiio", /* name */
(char *)"This module contains information about OpeImageIO blender is linked against", /* doc */
app_oiio_info_fields, /* fields */
- ARRAY_SIZE(app_oiio_info_fields) - 1
+ ARRAY_SIZE(app_oiio_info_fields) - 1,
};
static PyObject *make_oiio_info(void)
diff --git a/source/blender/python/intern/bpy_app_oiio.h b/source/blender/python/intern/bpy_app_oiio.h
index 775fed237f2..f2832b23936 100644
--- a/source/blender/python/intern/bpy_app_oiio.h
+++ b/source/blender/python/intern/bpy_app_oiio.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_oiio.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_OIIO_H__
diff --git a/source/blender/python/intern/bpy_app_opensubdiv.c b/source/blender/python/intern/bpy_app_opensubdiv.c
index 096374794c9..7c084605fd3 100644
--- a/source/blender/python/intern/bpy_app_opensubdiv.c
+++ b/source/blender/python/intern/bpy_app_opensubdiv.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_opensubdiv.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#include <Python.h>
@@ -41,14 +35,14 @@ static PyStructSequence_Field app_opensubdiv_info_fields[] = {
{(char *)"supported", (char *)("Boolean, True when Blender is built with OpenSubdiv support")},
{(char *)("version"), (char *)("The OpenSubdiv version as a tuple of 3 numbers")},
{(char *)("version_string"), (char *)("The OpenSubdiv version formatted as a string")},
- {NULL}
+ {NULL},
};
static PyStructSequence_Desc app_opensubdiv_info_desc = {
(char *)"bpy.app.opensubdiv", /* name */
(char *)"This module contains information about OpenSubdiv blender is linked against", /* doc */
app_opensubdiv_info_fields, /* fields */
- ARRAY_SIZE(app_opensubdiv_info_fields) - 1
+ ARRAY_SIZE(app_opensubdiv_info_fields) - 1,
};
static PyObject *make_opensubdiv_info(void)
diff --git a/source/blender/python/intern/bpy_app_opensubdiv.h b/source/blender/python/intern/bpy_app_opensubdiv.h
index b1da218b168..6f349c66794 100644
--- a/source/blender/python/intern/bpy_app_opensubdiv.h
+++ b/source/blender/python/intern/bpy_app_opensubdiv.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_opensubdiv.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_OPENSUBDIV_H__
diff --git a/source/blender/python/intern/bpy_app_openvdb.c b/source/blender/python/intern/bpy_app_openvdb.c
index 0b385206d7b..049cfba8bba 100644
--- a/source/blender/python/intern/bpy_app_openvdb.c
+++ b/source/blender/python/intern/bpy_app_openvdb.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_openvdb.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#include <Python.h>
@@ -46,14 +38,14 @@ static PyStructSequence_Field app_openvdb_info_fields[] = {
{(char *)"supported", (char *)("Boolean, True when Blender is built with OpenVDB support")},
{(char *)("version"), (char *)("The OpenVDB version as a tuple of 3 numbers")},
{(char *)("version_string"), (char *)("The OpenVDB version formatted as a string")},
- {NULL}
+ {NULL},
};
static PyStructSequence_Desc app_openvdb_info_desc = {
(char *)"bpy.app.openvdb", /* name */
(char *)"This module contains information about OpenVDB blender is linked against", /* doc */
app_openvdb_info_fields, /* fields */
- ARRAY_SIZE(app_openvdb_info_fields) - 1
+ ARRAY_SIZE(app_openvdb_info_fields) - 1,
};
static PyObject *make_openvdb_info(void)
diff --git a/source/blender/python/intern/bpy_app_openvdb.h b/source/blender/python/intern/bpy_app_openvdb.h
index ef712982695..b002e5e04a6 100644
--- a/source/blender/python/intern/bpy_app_openvdb.h
+++ b/source/blender/python/intern/bpy_app_openvdb.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Kevin Dietrich
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_openvdb.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_OPENVDB_H__
diff --git a/source/blender/python/intern/bpy_app_sdl.c b/source/blender/python/intern/bpy_app_sdl.c
index 816ad2833cc..09e13e4a116 100644
--- a/source/blender/python/intern/bpy_app_sdl.c
+++ b/source/blender/python/intern/bpy_app_sdl.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin, Sybren A. Stuvel
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_sdl.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#include <Python.h>
@@ -58,14 +52,14 @@ static PyStructSequence_Field app_sdl_info_fields[] = {
{(char *)"available", (char *)("Boolean, True when SDL is available. This is False when "
"either *supported* is False, or *dynload* is True and "
"Blender cannot find the correct library.")},
- {NULL}
+ {NULL},
};
static PyStructSequence_Desc app_sdl_info_desc = {
(char *)"bpy.app.sdl", /* name */
(char *)"This module contains information about SDL blender is linked against", /* doc */
app_sdl_info_fields, /* fields */
- ARRAY_SIZE(app_sdl_info_fields) - 1
+ ARRAY_SIZE(app_sdl_info_fields) - 1,
};
static PyObject *make_sdl_info(void)
diff --git a/source/blender/python/intern/bpy_app_sdl.h b/source/blender/python/intern/bpy_app_sdl.h
index e826a59de70..7df0dd4b686 100644
--- a/source/blender/python/intern/bpy_app_sdl.h
+++ b/source/blender/python/intern/bpy_app_sdl.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Sergey Sharybin, Sybren A. Stuvel
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_sdl.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_SDL_H__
diff --git a/source/blender/python/intern/bpy_app_timers.c b/source/blender/python/intern/bpy_app_timers.c
index cd0e57200ec..38a785d0d82 100644
--- a/source/blender/python/intern/bpy_app_timers.c
+++ b/source/blender/python/intern/bpy_app_timers.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_timers.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#include <Python.h>
@@ -175,7 +171,7 @@ static struct PyMethodDef M_AppTimers_methods[] = {
METH_O, bpy_app_timers_unregister_doc},
{"is_registered", (PyCFunction)bpy_app_timers_is_registered,
METH_O, bpy_app_timers_is_registered_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyModuleDef M_AppTimers_module_def = {
diff --git a/source/blender/python/intern/bpy_app_timers.h b/source/blender/python/intern/bpy_app_timers.h
index ddf0e258e67..bc70e85ae12 100644
--- a/source/blender/python/intern/bpy_app_timers.h
+++ b/source/blender/python/intern/bpy_app_timers.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_timers.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_TIMERS_H__
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
index 2a5efc15b87..1ed68201a2e 100644
--- a/source/blender/python/intern/bpy_app_translations.c
+++ b/source/blender/python/intern/bpy_app_translations.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_translations.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines a singleton py object accessed via 'bpy.app.translations',
* which exposes various data and functions useful in i18n work.
@@ -33,8 +27,6 @@
#include <structmember.h>
#include "BLI_utildefines.h"
-#include "BLI_string.h"
-#include "BLI_ghash.h"
#include "BPY_extern.h"
#include "bpy_app_translations.h"
@@ -48,6 +40,11 @@
#include "../generic/python_utildefines.h"
+#ifdef WITH_INTERNATIONAL
+# include "BLI_string.h"
+# include "BLI_ghash.h"
+#endif
+
typedef struct {
PyObject_HEAD
/* The string used to separate context from actual message in PY_TRANSLATE RNA props. */
@@ -387,7 +384,7 @@ static PyStructSequence_Desc app_translations_contexts_desc = {
(char *)"bpy.app.translations.contexts", /* name */
(char *)"This named tuple contains all pre-defined translation contexts", /* doc */
app_translations_contexts_fields, /* fields */
- ARRAY_SIZE(app_translations_contexts_fields) - 1
+ ARRAY_SIZE(app_translations_contexts_fields) - 1,
};
static PyObject *app_translations_contexts_make(void)
@@ -438,7 +435,7 @@ static PyMemberDef app_translations_members[] = {
app_translations_contexts_doc},
{(char *)"contexts_C_to_py", T_OBJECT_EX, offsetof(BlenderAppTranslations, contexts_C_to_py), READONLY,
app_translations_contexts_C_to_py_doc},
- {NULL}
+ {NULL},
};
PyDoc_STRVAR(app_translations_locale_doc,
@@ -482,7 +479,7 @@ static PyGetSetDef app_translations_getseters[] = {
/* {name, getter, setter, doc, userdata} */
{(char *)"locale", (getter)app_translations_locale_get, NULL, app_translations_locale_doc, NULL},
{(char *)"locales", (getter)app_translations_locales_get, NULL, app_translations_locales_doc, NULL},
- {NULL}
+ {NULL},
};
/* pgettext helper. */
@@ -660,7 +657,7 @@ static PyMethodDef app_translations_methods[] = {
app_translations_pgettext_data_doc},
{"locale_explode", (PyCFunction)app_translations_locale_explode, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_locale_explode_doc},
- {NULL}
+ {NULL},
};
static PyObject *app_translations_new(PyTypeObject *type, PyObject *UNUSED(args), PyObject *UNUSED(kw))
@@ -782,7 +779,7 @@ static PyTypeObject BlenderAppTranslationsType = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
PyObject *BPY_app_translations_struct(void)
diff --git a/source/blender/python/intern/bpy_app_translations.h b/source/blender/python/intern/bpy_app_translations.h
index e04c2484ecc..a8eca079f37 100644
--- a/source/blender/python/intern/bpy_app_translations.h
+++ b/source/blender/python/intern/bpy_app_translations.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_app_translations.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_APP_TRANSLATIONS_H__
diff --git a/source/blender/python/intern/bpy_capi_utils.c b/source/blender/python/intern/bpy_capi_utils.c
index f873a8a762b..4c0d220d3d9 100644
--- a/source/blender/python/intern/bpy_capi_utils.c
+++ b/source/blender/python/intern/bpy_capi_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_capi_utils.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file contains Blender/Python utility functions to help implementing API's.
* This is not related to a particular module.
diff --git a/source/blender/python/intern/bpy_capi_utils.h b/source/blender/python/intern/bpy_capi_utils.h
index abb37d6e30c..533ff0fb7c2 100644
--- a/source/blender/python/intern/bpy_capi_utils.h
+++ b/source/blender/python/intern/bpy_capi_utils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,21 +12,17 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_capi_utils.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_CAPI_UTILS_H__
#define __BPY_CAPI_UTILS_H__
-#if PY_VERSION_HEX < 0x03060000
-# error "Python 3.6 or greater is required, you'll need to update your python."
+#if PY_VERSION_HEX < 0x03070000
+# error "Python 3.7 or greater is required, you'll need to update your Python."
#endif
struct EnumPropertyItem;
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index f098a28d679..425a8a29cf9 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Willian P. Germano, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_driver.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines the 'BPY_driver_exec' to execute python driver expressions,
* called by the animation system, there are also some utility functions
@@ -37,7 +31,6 @@
#include "BLI_listbase.h"
#include "BLI_math_base.h"
-#include "BLI_string.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
@@ -409,9 +402,9 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C
return 0.0f;
#ifndef USE_BYTECODE_WHITELIST
- if (!(G.f & G_SCRIPT_AUTOEXEC)) {
- if (!(G.f & G_SCRIPT_AUTOEXEC_FAIL_QUIET)) {
- G.f |= G_SCRIPT_AUTOEXEC_FAIL;
+ if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) {
+ if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET)) {
+ G.f |= G_FLAG_SCRIPT_AUTOEXEC_FAIL;
BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Driver '%s'", expr);
printf("skipping driver '%s', automatic scripts are disabled\n", expr);
@@ -550,7 +543,7 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C
#ifdef USE_BYTECODE_WHITELIST
if (is_recompile && expr_code) {
- if (!(G.f & G_SCRIPT_AUTOEXEC)) {
+ if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) {
if (!bpy_driver_secure_bytecode_validate(
expr_code, (PyObject *[]){
bpy_pydriver_Dict,
diff --git a/source/blender/python/intern/bpy_driver.h b/source/blender/python/intern/bpy_driver.h
index 971cbdf901f..4026a9f2abf 100644
--- a/source/blender/python/intern/bpy_driver.h
+++ b/source/blender/python/intern/bpy_driver.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_driver.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_DRIVER_H__
diff --git a/source/blender/python/intern/bpy_gizmo_wrap.c b/source/blender/python/intern/bpy_gizmo_wrap.c
index 411822ee4da..f1281344bcf 100644
--- a/source/blender/python/intern/bpy_gizmo_wrap.c
+++ b/source/blender/python/intern/bpy_gizmo_wrap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_gizmo_wrap.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file is so Python can define widget-group's that C can call into.
* The generic callback functions for Python widget-group are defines in
@@ -48,7 +44,6 @@
/* we may want to add, but not now */
/* -------------------------------------------------------------------- */
-
/** \name Gizmo
* \{ */
@@ -186,7 +181,6 @@ void BPY_RNA_gizmo_wrapper(wmGizmoType *gzt, void *userdata)
/* -------------------------------------------------------------------- */
-
/** \name Gizmo Group
* \{ */
diff --git a/source/blender/python/intern/bpy_gizmo_wrap.h b/source/blender/python/intern/bpy_gizmo_wrap.h
index 96f15312a4e..f1e9773e866 100644
--- a/source/blender/python/intern/bpy_gizmo_wrap.h
+++ b/source/blender/python/intern/bpy_gizmo_wrap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,17 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_gizmo_wrap.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_GIZMO_WRAP_H__
#define __BPY_GIZMO_WRAP_H__
-struct wmGizmoType;
struct wmGizmoGroupType;
+struct wmGizmoType;
/* exposed to rna/wm api */
void BPY_RNA_gizmo_wrapper(struct wmGizmoType *gzt, void *userdata);
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index e17e7562f2a..189fb97f3d2 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -15,14 +13,11 @@
* 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): Michel Selten, Willian P. Germano, Stephen Swaney,
* Chris Keith, Chris Want, Ken Hughes, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_interface.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file deals with embedding the python interpreter within blender,
* starting and stopping python and exposing blender/python modules so they can
@@ -86,7 +81,6 @@ CLG_LOGREF_DECLARE_GLOBAL(BPY_LOG_RNA, "bpy.rna");
/* in case a python script triggers another python call, stop bpy_context_clear from invalidating */
static int py_call_level = 0;
-BPy_StructRNA *bpy_context_module = NULL; /* for fast access */
// #define TIME_PY_RUN // simple python tests. prints on exit.
@@ -235,7 +229,7 @@ static struct _inittab bpy_internal_modules[] = {
#endif
{"gpu", BPyInit_gpu},
{"idprop", BPyInit_idprop},
- {NULL, NULL}
+ {NULL, NULL},
};
/* call BPY_context_set first */
@@ -394,7 +388,7 @@ void BPY_python_end(void)
void BPY_python_reset(bContext *C)
{
/* unrelated security stuff */
- G.f &= ~(G_SCRIPT_AUTOEXEC_FAIL | G_SCRIPT_AUTOEXEC_FAIL_QUIET);
+ G.f &= ~(G_FLAG_SCRIPT_AUTOEXEC_FAIL | G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET);
G.autoexec_fail[0] = '\0';
BPY_driver_reset();
@@ -524,7 +518,7 @@ static bool python_script_exec(
if (do_jump) {
/* ensure text is valid before use, the script may have freed its self */
Main *bmain_new = CTX_data_main(C);
- if ((bmain_old == bmain_new) && (BLI_findindex(&bmain_new->text, text) != -1)) {
+ if ((bmain_old == bmain_new) && (BLI_findindex(&bmain_new->texts, text) != -1)) {
python_script_error_jump_text(text);
}
}
@@ -767,11 +761,11 @@ void BPY_modules_load_user(bContext *C)
bpy_context_set(C, &gilstate);
- for (text = bmain->text.first; text; text = text->id.next) {
+ for (text = bmain->texts.first; text; text = text->id.next) {
if (text->flags & TXT_ISSCRIPT && BLI_path_extension_check(text->id.name + 2, ".py")) {
- if (!(G.f & G_SCRIPT_AUTOEXEC)) {
- if (!(G.f & G_SCRIPT_AUTOEXEC_FAIL_QUIET)) {
- G.f |= G_SCRIPT_AUTOEXEC_FAIL;
+ if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) {
+ if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET)) {
+ G.f |= G_FLAG_SCRIPT_AUTOEXEC_FAIL;
BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Text '%s'", text->id.name + 2);
printf("scripts disabled for \"%s\", skipping '%s'\n", BKE_main_blendfile_path(bmain), text->id.name + 2);
diff --git a/source/blender/python/intern/bpy_interface_atexit.c b/source/blender/python/intern/bpy_interface_atexit.c
index 3608a26d113..a7aab0e72f4 100644
--- a/source/blender/python/intern/bpy_interface_atexit.c
+++ b/source/blender/python/intern/bpy_interface_atexit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_interface_atexit.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file inserts an exit callback into pythons 'atexit' module.
* Without this sys.exit() can crash because blender is not properly closing
diff --git a/source/blender/python/intern/bpy_intern_string.c b/source/blender/python/intern/bpy_intern_string.c
index 41276963fc9..334aa49c0bf 100644
--- a/source/blender/python/intern/bpy_intern_string.c
+++ b/source/blender/python/intern/bpy_intern_string.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_intern_string.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* Store python versions of strings frequently used for python lookups
* to avoid converting, creating the hash and freeing every time as
diff --git a/source/blender/python/intern/bpy_intern_string.h b/source/blender/python/intern/bpy_intern_string.h
index 41cd58f9c3d..362a07904e0 100644
--- a/source/blender/python/intern/bpy_intern_string.h
+++ b/source/blender/python/intern/bpy_intern_string.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BPY_INTERN_STRING_H__
#define __BPY_INTERN_STRING_H__
-/** \file blender/python/intern/bpy_intern_string.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
void bpy_intern_string_init(void);
diff --git a/source/blender/python/intern/bpy_library.h b/source/blender/python/intern/bpy_library.h
index c381a4206fa..7537eb40d19 100644
--- a/source/blender/python/intern/bpy_library.h
+++ b/source/blender/python/intern/bpy_library.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_library.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_LIBRARY_H__
diff --git a/source/blender/python/intern/bpy_library_load.c b/source/blender/python/intern/bpy_library_load.c
index 5c64a65fb58..bf12db0f3a1 100644
--- a/source/blender/python/intern/bpy_library_load.c
+++ b/source/blender/python/intern/bpy_library_load.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_library_load.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file exposed blend file library appending/linking to python, typically
* this would be done via RNA api but in this case a hand written python api
@@ -167,7 +163,7 @@ static PyTypeObject bpy_lib_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
PyDoc_STRVAR(bpy_lib_load_doc,
diff --git a/source/blender/python/intern/bpy_library_write.c b/source/blender/python/intern/bpy_library_write.c
index 07a81a3bddb..3b2afb42cdb 100644
--- a/source/blender/python/intern/bpy_library_write.c
+++ b/source/blender/python/intern/bpy_library_write.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_library_write.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* Python API for writing a set of data-blocks into a file.
* Useful for writing out asset-libraries, defines: `bpy.data.libraries.write(...)`.
@@ -134,7 +130,7 @@ static PyObject *bpy_lib_write(PyObject *UNUSED(self), PyObject *args, PyObject
if (!pyrna_id_FromPyObject(key, &id_store->id)) {
PyErr_Format(PyExc_TypeError,
- "Expected and ID type, not %.200s",
+ "Expected an ID type, not %.200s",
Py_TYPE(key)->tp_name);
ret = NULL;
goto finally;
diff --git a/source/blender/python/intern/bpy_msgbus.c b/source/blender/python/intern/bpy_msgbus.c
index 101cc8b41a3..0fedb379a49 100644
--- a/source/blender/python/intern/bpy_msgbus.c
+++ b/source/blender/python/intern/bpy_msgbus.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_msgbus.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
* This file defines '_bpy_msgbus' module, exposed as 'bpy.msgbus'.
*/
@@ -241,7 +237,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject *UNUSED(self), PyObject *args
PyObject *py_options = NULL;
EnumPropertyItem py_options_enum[] = {
{IS_PERSISTENT, "PERSISTENT", 0, ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
int options = 0;
@@ -253,7 +249,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject *UNUSED(self), PyObject *args
"options",
NULL,
};
- static _PyArg_Parser _parser = {"$OOO!OO!:subscribe_rna", _keywords, 0};
+ static _PyArg_Parser _parser = {"$OOO!O|O!:subscribe_rna", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(
args, kw, &_parser,
&py_sub, &py_owner,
@@ -377,7 +373,7 @@ static struct PyMethodDef BPy_msgbus_methods[] = {
{"subscribe_rna", (PyCFunction)bpy_msgbus_subscribe_rna, METH_VARARGS | METH_KEYWORDS, bpy_msgbus_subscribe_rna_doc},
{"publish_rna", (PyCFunction)bpy_msgbus_publish_rna, METH_VARARGS | METH_KEYWORDS, bpy_msgbus_publish_rna_doc},
{"clear_by_owner", (PyCFunction)bpy_msgbus_clear_by_owner, METH_O, bpy_msgbus_clear_by_owner_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyModuleDef _bpy_msgbus_def = {
diff --git a/source/blender/python/intern/bpy_msgbus.h b/source/blender/python/intern/bpy_msgbus.h
index 97b20e9b926..179b220c3c2 100644
--- a/source/blender/python/intern/bpy_msgbus.h
+++ b/source/blender/python/intern/bpy_msgbus.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_msgbus.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_MSGBUS_H__
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index d3abaf43aef..ecae71d07e3 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_operator.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines '_bpy.ops', an internal python module which gives python
* the ability to inspect and call both C and Python defined operators.
@@ -37,7 +31,6 @@
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BPY_extern.h"
#include "bpy_operator.h"
@@ -429,7 +422,7 @@ static struct PyMethodDef bpy_ops_methods[] = {
{"dir", (PyCFunction) pyop_dir, METH_NOARGS, NULL},
{"get_rna_type", (PyCFunction) pyop_getrna_type, METH_O, NULL},
{"macro_define", (PyCFunction) PYOP_wrap_macro_define, METH_VARARGS, NULL},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyModuleDef bpy_ops_module = {
@@ -438,7 +431,7 @@ static struct PyModuleDef bpy_ops_module = {
NULL,
-1, /* multiple "initialization" just copies the module dict. */
bpy_ops_methods,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL, NULL,
};
PyObject *BPY_operator_module(void)
diff --git a/source/blender/python/intern/bpy_operator.h b/source/blender/python/intern/bpy_operator.h
index 68ea9423edd..8ecf66adad7 100644
--- a/source/blender/python/intern/bpy_operator.h
+++ b/source/blender/python/intern/bpy_operator.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_operator.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_OPERATOR_H__
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index ae84d83b431..6f1450fcbc2 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_operator_wrap.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file is so python can define operators that C can call into.
* The generic callback functions for python operators are defines in
diff --git a/source/blender/python/intern/bpy_operator_wrap.h b/source/blender/python/intern/bpy_operator_wrap.h
index 0828c58e2bd..5bb087540cc 100644
--- a/source/blender/python/intern/bpy_operator_wrap.h
+++ b/source/blender/python/intern/bpy_operator_wrap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_operator_wrap.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_OPERATOR_WRAP_H__
diff --git a/source/blender/python/intern/bpy_path.c b/source/blender/python/intern/bpy_path.c
index 53d8f8ea954..89f7fda9d4f 100644
--- a/source/blender/python/intern/bpy_path.c
+++ b/source/blender/python/intern/bpy_path.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_path.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines '_bpy_path' module, Some 'C' functionality used by 'bpy.path'
*/
diff --git a/source/blender/python/intern/bpy_path.h b/source/blender/python/intern/bpy_path.h
index a0f31202264..7e38e3693fc 100644
--- a/source/blender/python/intern/bpy_path.h
+++ b/source/blender/python/intern/bpy_path.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_path.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 0bd82d3c52b..385b02f231e 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_props.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines 'bpy.props' module used so scripts can define their own
* rna properties for use with python operators or adding new properties to
@@ -58,8 +52,6 @@ enum {
BPY_DATA_CB_SLOT_SIZE = 4,
};
-extern BPy_StructRNA *bpy_context_module;
-
static const EnumPropertyItem property_flag_items[] = {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
@@ -67,7 +59,8 @@ static const EnumPropertyItem property_flag_items[] = {
{PROP_LIB_EXCEPTION, "LIBRARY_EDITABLE", 0, "Library Editable", ""},
{PROP_PROPORTIONAL, "PROPORTIONAL", 0, "Adjust values proportionally to eachother", ""},
{PROP_TEXTEDIT_UPDATE, "TEXTEDIT_UPDATE", 0, "Update on every keystroke in textedit 'mode'", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
#define BPY_PROPDEF_OPTIONS_DOC \
" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE', 'LIBRARY_EDITABLE', 'PROPORTIONAL'," \
@@ -80,7 +73,8 @@ static const EnumPropertyItem property_flag_enum_items[] = {
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
{PROP_LIB_EXCEPTION, "LIBRARY_EDITABLE", 0, "Library Editable", ""},
{PROP_ENUM_FLAG, "ENUM_FLAG", 0, "Enum Flag", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
#define BPY_PROPDEF_OPTIONS_ENUM_DOC \
" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE', 'ENUM_FLAG', 'LIBRARY_EDITABLE'].\n" \
@@ -98,7 +92,8 @@ static const EnumPropertyItem property_subtype_string_items[] = {
{PROP_PASSWORD, "PASSWORD", 0, "Password", "A string that is displayed hidden ('********')"},
{PROP_NONE, "NONE", 0, "None", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
#define BPY_PROPDEF_SUBTYPE_STRING_DOC \
" :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILE_NAME', 'BYTE_STRING', 'PASSWORD', 'NONE'].\n" \
@@ -114,7 +109,8 @@ static const EnumPropertyItem property_subtype_number_items[] = {
{PROP_DISTANCE, "DISTANCE", 0, "Distance", ""},
{PROP_NONE, "NONE", 0, "None", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
#define BPY_PROPDEF_SUBTYPE_NUMBER_DOC \
" :arg subtype: Enumerator in ['PIXEL', 'UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n" \
@@ -134,14 +130,16 @@ static const EnumPropertyItem property_subtype_array_items[] = {
{PROP_COLOR_GAMMA, "COLOR_GAMMA", 0, "Color Gamma", ""},
{PROP_LAYER, "LAYER", 0, "Layer", ""},
{PROP_LAYER_MEMBER, "LAYER_MEMBER", 0, "Layer Member", ""},
+ {PROP_POWER, "POWER", 0, "Power", ""},
{PROP_NONE, "NONE", 0, "None", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL},
+};
#define BPY_PROPDEF_SUBTYPE_ARRAY_DOC \
" :arg subtype: Enumerator in ['COLOR', 'TRANSLATION', 'DIRECTION', " \
"'VELOCITY', 'ACCELERATION', 'MATRIX', 'EULER', 'QUATERNION', 'AXISANGLE', " \
- "'XYZ', 'COLOR_GAMMA', 'LAYER', 'LAYER_MEMBER', 'NONE'].\n" \
+ "'XYZ', 'COLOR_GAMMA', 'LAYER', 'LAYER_MEMBER', 'POWER', 'NONE'].\n" \
" :type subtype: string\n"
/* PyObject's */
@@ -1904,8 +1902,8 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, PyObject *ge
" :type description: string\n" \
#define BPY_PROPDEF_UNIT_DOC \
-" :arg unit: Enumerator in ['NONE', 'LENGTH', 'AREA', 'VOLUME', 'ROTATION', 'TIME', 'VELOCITY', 'ACCELERATION', 'MASS', 'CAMERA'].\n" \
-" :type unit: string\n" \
+" :arg unit: Enumerator in ['NONE', 'LENGTH', 'AREA', 'VOLUME', 'ROTATION', 'TIME', 'VELOCITY', 'ACCELERATION', 'MASS', 'CAMERA', 'POWER'].\n" \
+" :type unit: string\n" \
#define BPY_PROPDEF_NUM_MIN_DOC \
" :arg min: Hard minimum, trying to assign a value below will silently assign this minimum instead.\n" \
@@ -3181,7 +3179,7 @@ static struct PyMethodDef props_methods[] = {
{"CollectionProperty", (PyCFunction)BPy_CollectionProperty, METH_VARARGS | METH_KEYWORDS, BPy_CollectionProperty_doc},
{"RemoveProperty", (PyCFunction)BPy_RemoveProperty, METH_VARARGS | METH_KEYWORDS, BPy_RemoveProperty_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyModuleDef props_module = {
@@ -3193,7 +3191,7 @@ static struct PyModuleDef props_module = {
".. note:: All parameters to these functions must be passed as keywords.\n",
-1, /* multiple "initialization" just copies the module dict. */
props_methods,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL, NULL,
};
PyObject *BPY_rna_props(void)
diff --git a/source/blender/python/intern/bpy_props.h b/source/blender/python/intern/bpy_props.h
index fa2594f94d2..4741239be52 100644
--- a/source/blender/python/intern/bpy_props.h
+++ b/source/blender/python/intern/bpy_props.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_props.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index f25f007033f..cb1555f8cc4 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_rna.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file is the main interface between python and blenders data api (RNA),
* exposing RNA to python so blender data can be accessed in a python like way.
@@ -84,6 +78,8 @@
#define USE_MATHUTILS
#define USE_STRING_COERCE
+BPy_StructRNA *bpy_context_module = NULL; /* for fast access */
+
static PyObject *pyrna_struct_Subtype(PointerRNA *ptr);
static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self);
@@ -513,7 +509,7 @@ static Mathutils_Callback mathutils_rna_array_cb = {
(BaseMathGetFunc) mathutils_rna_vector_get,
(BaseMathSetFunc) mathutils_rna_vector_set,
(BaseMathGetIndexFunc) mathutils_rna_vector_get_index,
- (BaseMathSetIndexFunc) mathutils_rna_vector_set_index
+ (BaseMathSetIndexFunc) mathutils_rna_vector_set_index,
};
@@ -569,7 +565,7 @@ static Mathutils_Callback mathutils_rna_matrix_cb = {
mathutils_rna_matrix_get,
mathutils_rna_matrix_set,
NULL,
- NULL
+ NULL,
};
static short pyrna_rotation_euler_order_get(
@@ -2347,7 +2343,7 @@ static int pyrna_prop_collection_subscript_str_lib_pair_ptr(
else if (PyUnicode_Check(keylib)) {
Main *bmain = self->ptr.data;
const char *keylib_str = _PyUnicode_AsString(keylib);
- lib = BLI_findstring(&bmain->library, keylib_str, offsetof(Library, name));
+ lib = BLI_findstring(&bmain->libraries, keylib_str, offsetof(Library, name));
if (lib == NULL) {
if (err_not_found) {
PyErr_Format(PyExc_KeyError,
@@ -5265,7 +5261,7 @@ static struct PyMethodDef pyrna_struct_methods[] = {
{"callback_add", (PyCFunction)pyrna_callback_classmethod_add, METH_VARARGS | METH_CLASS, NULL},
{"callback_remove", (PyCFunction)pyrna_callback_classmethod_remove, METH_VARARGS | METH_CLASS, NULL},
#endif
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef pyrna_prop_methods[] = {
@@ -5273,11 +5269,11 @@ static struct PyMethodDef pyrna_prop_methods[] = {
{"as_bytes", (PyCFunction)pyrna_prop_as_bytes, METH_NOARGS, pyrna_prop_as_bytes_doc},
{"update", (PyCFunction)pyrna_prop_update, METH_NOARGS, pyrna_prop_update_doc},
{"__dir__", (PyCFunction)pyrna_prop_dir, METH_NOARGS, NULL},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef pyrna_prop_array_methods[] = {
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef pyrna_prop_collection_methods[] = {
@@ -5290,7 +5286,7 @@ static struct PyMethodDef pyrna_prop_collection_methods[] = {
{"get", (PyCFunction)pyrna_prop_collection_get, METH_VARARGS, pyrna_prop_collection_get_doc},
{"find", (PyCFunction)pyrna_prop_collection_find, METH_O, pyrna_prop_collection_find_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
@@ -5298,7 +5294,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
{"remove", (PyCFunction)pyrna_prop_collection_idprop_remove, METH_O, NULL},
{"clear", (PyCFunction)pyrna_prop_collection_idprop_clear, METH_NOARGS, NULL},
{"move", (PyCFunction)pyrna_prop_collection_idprop_move, METH_VARARGS, NULL},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
@@ -5977,7 +5973,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
@@ -6067,7 +6063,7 @@ PyTypeObject pyrna_struct_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
/*-----------------------BPy_PropertyRNA method def------------------------------*/
@@ -6152,7 +6148,7 @@ PyTypeObject pyrna_prop_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
PyTypeObject pyrna_prop_array_Type = {
@@ -6235,7 +6231,7 @@ PyTypeObject pyrna_prop_array_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
PyTypeObject pyrna_prop_collection_Type = {
@@ -6319,7 +6315,7 @@ PyTypeObject pyrna_prop_collection_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
/* only for add/remove/move methods */
@@ -6404,7 +6400,7 @@ static PyTypeObject pyrna_prop_collection_idprop_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
/*-----------------------BPy_PropertyRNA method def------------------------------*/
@@ -6489,7 +6485,7 @@ PyTypeObject pyrna_func_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
#ifdef USE_PYRNA_ITER
@@ -6592,7 +6588,7 @@ static PyTypeObject pyrna_prop_collection_iter_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
static PyObject *pyrna_prop_collection_iter_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
@@ -7187,7 +7183,7 @@ static PyObject *pyrna_unregister_class(PyObject *self, PyObject *py_class);
static struct PyMethodDef pyrna_basetype_methods[] = {
{"__dir__", (PyCFunction)pyrna_basetype_dir, METH_NOARGS, ""},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/* used to call ..._keys() direct, but we need to filter out operator subclasses */
@@ -8259,16 +8255,20 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
return NULL;
/* call classed register method () */
- py_cls_meth = PyObject_GetAttr(py_class, bpy_intern_str_register);
- if (py_cls_meth == NULL) {
- PyErr_Clear();
- }
- else {
- PyObject *ret = PyObject_CallObject(py_cls_meth, NULL);
- if (ret) {
- Py_DECREF(ret);
+ switch (_PyObject_LookupAttr(py_class, bpy_intern_str_register, &py_cls_meth)) {
+ case 1:
+ {
+ PyObject *ret = PyObject_CallObject(py_cls_meth, NULL);
+ if (ret) {
+ Py_DECREF(ret);
+ }
+ else {
+ return NULL;
+ }
+ break;
}
- else {
+ case -1:
+ {
return NULL;
}
}
@@ -8312,7 +8312,7 @@ PyDoc_STRVAR(pyrna_unregister_class_doc,
" before unregistering.\n"
);
PyMethodDef meth_bpy_unregister_class = {
- "unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc
+ "unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc,
};
static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_class)
{
@@ -8359,16 +8359,20 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
}
/* call classed unregister method */
- py_cls_meth = PyObject_GetAttr(py_class, bpy_intern_str_unregister);
- if (py_cls_meth == NULL) {
- PyErr_Clear();
- }
- else {
- PyObject *ret = PyObject_CallObject(py_cls_meth, NULL);
- if (ret) {
- Py_DECREF(ret);
+ switch (_PyObject_LookupAttr(py_class, bpy_intern_str_unregister, &py_cls_meth)) {
+ case 1:
+ {
+ PyObject *ret = PyObject_CallObject(py_cls_meth, NULL);
+ if (ret) {
+ Py_DECREF(ret);
+ }
+ else {
+ return NULL;
+ }
+ break;
}
- else {
+ case -1:
+ {
return NULL;
}
}
@@ -8500,7 +8504,7 @@ static struct BPyRNA_CallBack pyrna_cb_methods[] = {
{{"draw_cursor_add", (PyCFunction)pyrna_callback_classmethod_add, METH_VARARGS | METH_STATIC, ""}, &RNA_WindowManager},
{{"draw_cursor_remove", (PyCFunction)pyrna_callback_classmethod_remove, METH_VARARGS | METH_STATIC, ""}, &RNA_WindowManager},
- {{NULL, NULL, 0, NULL}, NULL}
+ {{NULL, NULL, 0, NULL}, NULL},
};
void BPY_rna_register_cb(void)
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 32a63acde40..c4c6944d46d 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_rna.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_RNA_H__
@@ -229,4 +223,6 @@ extern PyMethodDef meth_bpy_unregister_class;
extern PyMethodDef meth_bpy_owner_id_set;
extern PyMethodDef meth_bpy_owner_id_get;
+extern BPy_StructRNA *bpy_context_module;
+
#endif
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 5a18fd8b177..faead661f1f 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_rna_anim.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines the animation related methods used in bpy_rna.c
*/
@@ -33,6 +27,7 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
+#include "BLI_string_utils.h"
#include "DNA_scene_types.h"
#include "DNA_anim_types.h"
@@ -61,9 +56,9 @@
#include "../generic/python_utildefines.h"
/* for keyframes and drivers */
-static int pyrna_struct_anim_args_parse(
+static int pyrna_struct_anim_args_parse_ex(
PointerRNA *ptr, const char *error_prefix, const char *path,
- const char **path_full, int *index)
+ const char **r_path_full, int *r_index, bool *r_path_no_validate)
{
const bool is_idbase = RNA_struct_is_ID(ptr->type);
PropertyRNA *prop;
@@ -78,11 +73,11 @@ static int pyrna_struct_anim_args_parse(
/* full paths can only be given from ID base */
if (is_idbase) {
- int r_index = -1;
- if (RNA_path_resolve_property_full(ptr, path, &r_ptr, &prop, &r_index) == false) {
+ int path_index = -1;
+ if (RNA_path_resolve_property_full(ptr, path, &r_ptr, &prop, &path_index) == false) {
prop = NULL;
}
- else if (r_index != -1) {
+ else if (path_index != -1) {
PyErr_Format(PyExc_ValueError,
"%.200s path includes index, must be a separate argument",
error_prefix, path);
@@ -101,86 +96,167 @@ static int pyrna_struct_anim_args_parse(
}
if (prop == NULL) {
+ if (r_path_no_validate) {
+ *r_path_no_validate = true;
+ return -1;
+ }
PyErr_Format(PyExc_TypeError,
"%.200s property \"%s\" not found",
error_prefix, path);
return -1;
}
- if (!RNA_property_animateable(&r_ptr, prop)) {
- PyErr_Format(PyExc_TypeError,
- "%.200s property \"%s\" not animatable",
- error_prefix, path);
- return -1;
+ if (r_path_no_validate) {
+ /* Don't touch the index. */
}
+ else {
+ if (!RNA_property_animateable(&r_ptr, prop)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s property \"%s\" not animatable",
+ error_prefix, path);
+ return -1;
+ }
- if (RNA_property_array_check(prop) == 0) {
- if ((*index) == -1) {
- *index = 0;
+ if (RNA_property_array_check(prop) == 0) {
+ if ((*r_index) == -1) {
+ *r_index = 0;
+ }
+ else {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s index %d was given while property \"%s\" is not an array",
+ error_prefix, *r_index, path);
+ return -1;
+ }
}
else {
- PyErr_Format(PyExc_TypeError,
- "%.200s index %d was given while property \"%s\" is not an array",
- error_prefix, *index, path);
- return -1;
+ int array_len = RNA_property_array_length(&r_ptr, prop);
+ if ((*r_index) < -1 || (*r_index) >= array_len) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s index out of range \"%s\", given %d, array length is %d",
+ error_prefix, path, *r_index, array_len);
+ return -1;
+ }
}
}
+
+ if (is_idbase) {
+ *r_path_full = BLI_strdup(path);
+ }
else {
- int array_len = RNA_property_array_length(&r_ptr, prop);
- if ((*index) < -1 || (*index) >= array_len) {
+ *r_path_full = RNA_path_from_ID_to_property(&r_ptr, prop);
+
+ if (*r_path_full == NULL) {
PyErr_Format(PyExc_TypeError,
- "%.200s index out of range \"%s\", given %d, array length is %d",
- error_prefix, path, *index, array_len);
+ "%.200s could not make path to \"%s\"",
+ error_prefix, path);
return -1;
}
}
+ return 0;
+}
+
+static int pyrna_struct_anim_args_parse(
+ PointerRNA *ptr, const char *error_prefix, const char *path,
+ const char **r_path_full, int *r_index)
+{
+ return pyrna_struct_anim_args_parse_ex(ptr, error_prefix, path, r_path_full, r_index, NULL);
+}
+
+/**
+ * Unlike #pyrna_struct_anim_args_parse \a r_path_full may be copied from \a path.
+ */
+static int pyrna_struct_anim_args_parse_no_resolve(
+ PointerRNA *ptr, const char *error_prefix, const char *path,
+ const char **r_path_full)
+{
+ const bool is_idbase = RNA_struct_is_ID(ptr->type);
if (is_idbase) {
- *path_full = BLI_strdup(path);
+ *r_path_full = path;
+ return 0;
}
else {
- *path_full = RNA_path_from_ID_to_property(&r_ptr, prop);
-
- if (*path_full == NULL) {
+ char *path_prefix = RNA_path_from_ID_to_struct(ptr);
+ if (path_prefix == NULL) {
PyErr_Format(PyExc_TypeError,
- "%.200s could not make path to \"%s\"",
- error_prefix, path);
+ "%.200s could not make path for type %s",
+ error_prefix, RNA_struct_identifier(ptr->type));
return -1;
}
+
+ if (*path == '[') {
+ *r_path_full = BLI_string_joinN(path_prefix, path);
+ }
+ else {
+ *r_path_full = BLI_string_join_by_sep_charN('.', path_prefix, path);
+ }
+ MEM_freeN(path_prefix);
}
+ return 0;
+}
+static int pyrna_struct_anim_args_parse_no_resolve_fallback(
+ PointerRNA *ptr, const char *error_prefix, const char *path,
+ const char **r_path_full, int *r_index)
+{
+ bool path_unresolved = false;
+ if (pyrna_struct_anim_args_parse_ex(
+ ptr, error_prefix, path,
+ r_path_full, r_index, &path_unresolved) == -1)
+ {
+ if (path_unresolved == true) {
+ if (pyrna_struct_anim_args_parse_no_resolve(
+ ptr, error_prefix, path, r_path_full) == -1)
+ {
+ return -1;
+ }
+ }
+ else {
+ return -1;
+ }
+ }
return 0;
}
/* internal use for insert and delete */
static int pyrna_struct_keyframe_parse(
PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
- const char **path_full, int *index, float *cfra, const char **group_name, int *options) /* return values */
+ /* return values */
+ const char **r_path_full, int *r_index, float *r_cfra, const char **r_group_name, int *r_options)
{
static const char *kwlist[] = {"data_path", "index", "frame", "group", "options", NULL};
PyObject *pyoptions = NULL;
const char *path;
/* note, parse_str MUST start with 's|ifsO!' */
- if (!PyArg_ParseTupleAndKeywords(args, kw, parse_str, (char **)kwlist, &path, index, cfra, group_name,
- &PySet_Type, &pyoptions))
+ if (!PyArg_ParseTupleAndKeywords(
+ args, kw, parse_str, (char **)kwlist, &path, r_index, r_cfra, r_group_name,
+ &PySet_Type, &pyoptions))
{
return -1;
}
- if (pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) == -1)
+ if (pyrna_struct_anim_args_parse(
+ ptr, error_prefix, path,
+ r_path_full, r_index) == -1)
+ {
return -1;
+ }
- if (*cfra == FLT_MAX)
- *cfra = CTX_data_scene(BPy_GetContext())->r.cfra;
+ if (*r_cfra == FLT_MAX) {
+ *r_cfra = CTX_data_scene(BPy_GetContext())->r.cfra;
+ }
/* flag may be null (no option currently for remove keyframes e.g.). */
- if (options) {
- if (pyoptions && (pyrna_set_to_enum_bitfield(rna_enum_keying_flag_items, pyoptions, options, error_prefix) == -1)) {
+ if (r_options) {
+ if (pyoptions &&
+ (pyrna_set_to_enum_bitfield(
+ rna_enum_keying_flag_items, pyoptions, r_options, error_prefix) == -1))
+ {
return -1;
}
- *options |= INSERTKEY_NO_USERPREF;
+ *r_options |= INSERTKEY_NO_USERPREF;
}
return 0; /* success */
@@ -222,9 +298,10 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
PYRNA_STRUCT_CHECK_OBJ(self);
- if (pyrna_struct_keyframe_parse(&self->ptr, args, kw,
- "s|ifsO!:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()",
- &path_full, &index, &cfra, &group_name, &options) == -1)
+ if (pyrna_struct_keyframe_parse(
+ &self->ptr, args, kw,
+ "s|ifsO!:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()",
+ &path_full, &index, &cfra, &group_name, &options) == -1)
{
return NULL;
}
@@ -419,7 +496,10 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index))
return NULL;
- if (pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) == -1) {
+ if (pyrna_struct_anim_args_parse(
+ &self->ptr, "bpy_struct.driver_add():", path,
+ &path_full, &index) == -1)
+ {
return NULL;
}
else {
@@ -490,10 +570,14 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
PYRNA_STRUCT_CHECK_OBJ(self);
- if (!PyArg_ParseTuple(args, "s|i:driver_remove", &path, &index))
+ if (!PyArg_ParseTuple(args, "s|i:driver_remove", &path, &index)) {
return NULL;
+ }
- if (pyrna_struct_anim_args_parse(&self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) == -1) {
+ if (pyrna_struct_anim_args_parse_no_resolve_fallback(
+ &self->ptr, "bpy_struct.driver_remove():", path,
+ &path_full, &index) == -1)
+ {
return NULL;
}
else {
@@ -504,7 +588,9 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
result = ANIM_remove_driver(&reports, (ID *)self->ptr.id.data, path_full, index, 0);
- MEM_freeN((void *)path_full);
+ if (path != path_full) {
+ MEM_freeN((void *)path_full);
+ }
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
return NULL;
diff --git a/source/blender/python/intern/bpy_rna_anim.h b/source/blender/python/intern/bpy_rna_anim.h
index 8ef976b8cb4..5145d16eafb 100644
--- a/source/blender/python/intern/bpy_rna_anim.h
+++ b/source/blender/python/intern/bpy_rna_anim.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BPY_RNA_ANIM_H__
#define __BPY_RNA_ANIM_H__
-/** \file blender/python/intern/bpy_rna_anim.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
extern char pyrna_struct_keyframe_insert_doc[];
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 9a184df8054..a87da8782bc 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Arystanbek Dyussenov, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_rna_array.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file deals with array access for 'BPy_PropertyArrayRNA' from bpy_rna.c
*/
@@ -35,7 +29,6 @@
#include "RNA_types.h"
#include "bpy_rna.h"
-#include "BKE_global.h"
#include "MEM_guardedalloc.h"
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index ed29aa795e6..025ea586fee 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/intern/bpy_rna_callback.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file currently exposes callbacks for interface regions but may be
* extended later.
@@ -33,7 +27,6 @@
#include "RNA_types.h"
#include "BLI_utildefines.h"
-#include "BLI_listbase.h"
#include "bpy_rna.h"
#include "bpy_rna_callback.h"
@@ -54,15 +47,15 @@
#include "../generic/python_utildefines.h"
-/* use this to stop other capsules from being mis-used */
-#define RNA_CAPSULE_ID "RNA_HANDLE"
-#define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED"
+/* Use this to stop other capsules from being mis-used. */
+static const char *rna_capsual_id = "RNA_HANDLE";
+static const char *rna_capsual_id_invalid = "RNA_HANDLE_REMOVED";
static const EnumPropertyItem region_draw_mode_items[] = {
{REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""},
{REGION_DRAW_POST_VIEW, "POST_VIEW", 0, "Post View", ""},
{REGION_DRAW_PRE_VIEW, "PRE_VIEW", 0, "Pre View", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata)
@@ -172,7 +165,7 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args)
return NULL;
}
- return PyCapsule_New((void *)handle, RNA_CAPSULE_ID, NULL);
+ return PyCapsule_New((void *)handle, rna_capsual_id, NULL);
}
PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
@@ -184,7 +177,7 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O!:callback_remove", &PyCapsule_Type, &py_handle))
return NULL;
- handle = PyCapsule_GetPointer(py_handle, RNA_CAPSULE_ID);
+ handle = PyCapsule_GetPointer(py_handle, rna_capsual_id);
if (handle == NULL) {
PyErr_SetString(PyExc_ValueError, "callback_remove(handle): NULL handle given, invalid or already removed");
@@ -203,7 +196,7 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
}
/* don't allow reuse */
- PyCapsule_SetName(py_handle, RNA_CAPSULE_ID_INVALID);
+ PyCapsule_SetName(py_handle, rna_capsual_id_invalid);
Py_RETURN_NONE;
}
@@ -213,9 +206,9 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
static eSpace_Type rna_Space_refine_reverse(StructRNA *srna)
{
if (srna == &RNA_SpaceView3D) return SPACE_VIEW3D;
- if (srna == &RNA_SpaceGraphEditor) return SPACE_IPO;
+ if (srna == &RNA_SpaceGraphEditor) return SPACE_GRAPH;
if (srna == &RNA_SpaceOutliner) return SPACE_OUTLINER;
- if (srna == &RNA_SpaceProperties) return SPACE_BUTS;
+ if (srna == &RNA_SpaceProperties) return SPACE_PROPERTIES;
if (srna == &RNA_SpaceFileBrowser) return SPACE_FILE;
if (srna == &RNA_SpaceImageEditor) return SPACE_IMAGE;
if (srna == &RNA_SpaceInfo) return SPACE_INFO;
@@ -350,7 +343,7 @@ PyObject *pyrna_callback_classmethod_add(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- PyObject *ret = PyCapsule_New((void *)handle, RNA_CAPSULE_ID, NULL);
+ PyObject *ret = PyCapsule_New((void *)handle, rna_capsual_id, NULL);
/* Store 'args' in context as well as the handler custom-data,
* because the handle may be freed by Blender (new file, new window... etc) */
@@ -378,7 +371,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar
return NULL;
}
py_handle = PyTuple_GET_ITEM(args, 1);
- handle = PyCapsule_GetPointer(py_handle, RNA_CAPSULE_ID);
+ handle = PyCapsule_GetPointer(py_handle, rna_capsual_id);
if (handle == NULL) {
PyErr_SetString(PyExc_ValueError, "callback_remove(handler): NULL handler given, invalid or already removed");
return NULL;
@@ -445,7 +438,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar
/* don't allow reuse */
if (capsule_clear) {
Py_DECREF(handle_args);
- PyCapsule_SetName(py_handle, RNA_CAPSULE_ID_INVALID);
+ PyCapsule_SetName(py_handle, rna_capsual_id_invalid);
}
Py_RETURN_NONE;
diff --git a/source/blender/python/intern/bpy_rna_callback.h b/source/blender/python/intern/bpy_rna_callback.h
index 6ef98790b4e..6a13e2de9a7 100644
--- a/source/blender/python/intern/bpy_rna_callback.h
+++ b/source/blender/python/intern/bpy_rna_callback.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 *****
*/
#ifndef __BPY_RNA_CALLBACK_H__
#define __BPY_RNA_CALLBACK_H__
-/** \file blender/python/intern/bpy_rna_callback.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
struct BPy_StructRNA;
diff --git a/source/blender/python/intern/bpy_rna_driver.c b/source/blender/python/intern/bpy_rna_driver.c
index 1135ba121e3..91030f7ac36 100644
--- a/source/blender/python/intern/bpy_rna_driver.c
+++ b/source/blender/python/intern/bpy_rna_driver.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_rna_driver.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines utility functions that use the RNA API, from PyDrivers.
*/
diff --git a/source/blender/python/intern/bpy_rna_driver.h b/source/blender/python/intern/bpy_rna_driver.h
index 3f4bf2b9df5..0bb34b8fe9a 100644
--- a/source/blender/python/intern/bpy_rna_driver.h
+++ b/source/blender/python/intern/bpy_rna_driver.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BPY_RNA_DRIVER_H__
#define __BPY_RNA_DRIVER_H__
-/** \file blender/python/intern/bpy_rna_driver.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
struct ChannelDriver;
diff --git a/source/blender/python/intern/bpy_rna_gizmo.c b/source/blender/python/intern/bpy_rna_gizmo.c
index 8189431dfc9..68511627d51 100644
--- a/source/blender/python/intern/bpy_rna_gizmo.c
+++ b/source/blender/python/intern/bpy_rna_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_rna_gizmo.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* .
*/
@@ -32,7 +28,6 @@
#include "BLI_utildefines.h"
#include "BLI_alloca.h"
-#include "BKE_main.h"
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/python/intern/bpy_rna_gizmo.h b/source/blender/python/intern/bpy_rna_gizmo.h
index 68d8c1e052a..2eb02008eb1 100644
--- a/source/blender/python/intern/bpy_rna_gizmo.h
+++ b/source/blender/python/intern/bpy_rna_gizmo.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_rna_gizmo.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_RNA_GIZMO_H__
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c
index 0aed853c66b..31b135fe933 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_rna_id_collection.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file adds some helpers related to ID/Main handling, that cannot fit well in RNA itself.
*/
@@ -35,6 +29,7 @@
#include "BLI_bitmap.h"
#include "BKE_global.h"
+#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_main.h"
@@ -43,6 +38,9 @@
#include "DNA_object_types.h"
#include "DNA_key_types.h"
+#include "WM_api.h"
+#include "WM_types.h"
+
#include "bpy_capi_utils.h"
#include "bpy_rna_id_collection.h"
@@ -96,11 +94,11 @@ static int foreach_libblock_id_user_map_callback(
}
if ((GS(self_id->name) == ID_OB) && (id_p == (ID **)&((Object *)self_id)->proxy_from)) {
- /* We skip proxy_from here, since it some internal pointer which is not irrelevant info for py/API level. */
+ /* We skip proxy_from here, since it's some internal pointer which is not relevant info for py/API level. */
return IDWALK_RET_NOP;
}
else if ((GS(self_id->name) == ID_KE) && (id_p == (ID **)&((Key *)self_id)->from)) {
- /* We skip from here, since it some internal pointer which is not irrelevant info for py/API level. */
+ /* We skip from here, since it's some internal pointer which is not relevant info for py/API level. */
return IDWALK_RET_NOP;
}
@@ -161,6 +159,7 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
#else
Main *bmain = G_MAIN; /* XXX Ugly, but should work! */
#endif
+ ID *id;
PyObject *subset = NULL;
@@ -171,6 +170,8 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
PyObject *ret = NULL;
+ IDUserMapData data_cb = {NULL};
+
static const char *_keywords[] = {"subset", "key_types", "value_types", NULL};
static _PyArg_Parser _parser = {"|O$O!O!:user_map", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(
@@ -198,8 +199,6 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
}
}
- IDUserMapData data_cb = {NULL};
-
if (subset) {
PyObject *subset_fast = PySequence_Fast(subset, "user_map");
if (subset_fast == NULL) {
@@ -224,69 +223,149 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
data_cb.types_bitmap = key_types_bitmap;
- ListBase *lb_array[MAX_LIBARRAY];
- int lb_index;
- lb_index = set_listbasepointers(bmain, lb_array);
-
- while (lb_index--) {
- if (val_types_bitmap && lb_array[lb_index]->first) {
- if (!id_check_type(lb_array[lb_index]->first, val_types_bitmap)) {
- continue;
+ FOREACH_MAIN_ID_BEGIN(bmain, id)
+ {
+ /* We cannot skip here in case we have some filter on key types... */
+ if (key_types_bitmap == NULL && val_types_bitmap != NULL) {
+ if (!id_check_type(id, val_types_bitmap)) {
+ break; /* Break iter on that type of IDs, continues with next ID type. */
}
}
- for (ID *id = lb_array[lb_index]->first; id; id = id->next) {
- /* One-time init, ID is just used as placeholder here, we abuse this in iterator callback
- * to avoid having to rebuild a complete bpyrna object each time for the key searching
- * (where only ID pointer value is used). */
- if (data_cb.py_id_key_lookup_only == NULL) {
- data_cb.py_id_key_lookup_only = pyrna_id_CreatePyObject(id);
- }
+ /* One-time init, ID is just used as placeholder here, we abuse this in iterator callback
+ * to avoid having to rebuild a complete bpyrna object each time for the key searching
+ * (where only ID pointer value is used). */
+ if (data_cb.py_id_key_lookup_only == NULL) {
+ data_cb.py_id_key_lookup_only = pyrna_id_CreatePyObject(id);
+ }
- if (!data_cb.is_subset) {
- PyObject *key = data_cb.py_id_key_lookup_only;
- PyObject *set;
-
- RNA_id_pointer_create(id, &((BPy_StructRNA *)key)->ptr);
-
- /* We have to insert the key now, otherwise ID unused would be missing from final dict... */
- if ((set = PyDict_GetItem(data_cb.user_map, key)) == NULL) {
- /* Cannot use our placeholder key here! */
- key = pyrna_id_CreatePyObject(id);
- set = PySet_New(NULL);
- PyDict_SetItem(data_cb.user_map, key, set);
- Py_DECREF(set);
- Py_DECREF(key);
- }
+ if (!data_cb.is_subset &&
+ /* We do not want to pre-add keys of flitered out types. */
+ (key_types_bitmap == NULL || id_check_type(id, key_types_bitmap)) &&
+ /* We do not want to pre-add keys when we have filter on value types, but not on key types. */
+ (val_types_bitmap == NULL || key_types_bitmap != NULL))
+ {
+ PyObject *key = data_cb.py_id_key_lookup_only;
+ PyObject *set;
+
+ RNA_id_pointer_create(id, &((BPy_StructRNA *)key)->ptr);
+
+ /* We have to insert the key now, otherwise ID unused would be missing from final dict... */
+ if ((set = PyDict_GetItem(data_cb.user_map, key)) == NULL) {
+ /* Cannot use our placeholder key here! */
+ key = pyrna_id_CreatePyObject(id);
+ set = PySet_New(NULL);
+ PyDict_SetItem(data_cb.user_map, key, set);
+ Py_DECREF(set);
+ Py_DECREF(key);
}
+ }
- data_cb.id_curr = id;
- BKE_library_foreach_ID_link(NULL, id, foreach_libblock_id_user_map_callback, &data_cb, IDWALK_CB_NOP);
+ if (val_types_bitmap != NULL && !id_check_type(id, val_types_bitmap)) {
+ continue;
+ }
- if (data_cb.py_id_curr) {
- Py_DECREF(data_cb.py_id_curr);
- data_cb.py_id_curr = NULL;
- }
+ data_cb.id_curr = id;
+ BKE_library_foreach_ID_link(NULL, id, foreach_libblock_id_user_map_callback, &data_cb, IDWALK_CB_NOP);
+
+ if (data_cb.py_id_curr) {
+ Py_DECREF(data_cb.py_id_curr);
+ data_cb.py_id_curr = NULL;
}
}
+ FOREACH_MAIN_ID_END;
ret = data_cb.user_map;
-
error:
+ if (data_cb.py_id_key_lookup_only != NULL) {
+ Py_XDECREF(data_cb.py_id_key_lookup_only);
+ }
- Py_XDECREF(data_cb.py_id_key_lookup_only);
-
- if (key_types_bitmap) {
+ if (key_types_bitmap != NULL) {
MEM_freeN(key_types_bitmap);
}
- if (val_types_bitmap) {
+ if (val_types_bitmap != NULL) {
MEM_freeN(val_types_bitmap);
}
return ret;
+}
+PyDoc_STRVAR(bpy_batch_remove_doc,
+".. method:: batch_remove(ids=(id1, id2, ...))\n"
+"\n"
+" Remove (delete) several IDs at once.\n"
+"\n"
+" WARNING: Considered experimental feature currently.\n"
+"\n"
+" Note that this function is quicker than individual calls to :func:`remove()` (from :class:`bpy.types.BlendData`\n"
+" ID collections), but less safe/versatile (it can break Blender, e.g. by removing all scenes...).\n"
+"\n"
+" :arg ids: Iterables of IDs (types can be mixed).\n"
+" :type subset: sequence\n"
+);
+static PyObject *bpy_batch_remove(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)
+{
+#if 0 /* If someone knows how to get a proper 'self' in that case... */
+ BPy_StructRNA *pyrna = (BPy_StructRNA *)self;
+ Main *bmain = pyrna->ptr.data;
+#else
+ Main *bmain = G_MAIN; /* XXX Ugly, but should work! */
+#endif
+
+ PyObject *ids = NULL;
+
+ PyObject *ret = NULL;
+
+ static const char *_keywords[] = {"ids", NULL};
+ static _PyArg_Parser _parser = {"O:user_map", _keywords, 0};
+ if (!_PyArg_ParseTupleAndKeywordsFast(
+ args, kwds, &_parser,
+ &ids))
+ {
+ return ret;
+ }
+
+ if (ids) {
+ BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
+
+ PyObject *ids_fast = PySequence_Fast(ids, "batch_remove");
+ if (ids_fast == NULL) {
+ goto error;
+ }
+
+ PyObject **ids_array = PySequence_Fast_ITEMS(ids_fast);
+ Py_ssize_t ids_len = PySequence_Fast_GET_SIZE(ids_fast);
+
+ for (; ids_len; ids_array++, ids_len--) {
+ ID *id;
+ if (!pyrna_id_FromPyObject(*ids_array, &id)) {
+ PyErr_Format(PyExc_TypeError,
+ "Expected an ID type, not %.200s",
+ Py_TYPE(*ids_array)->tp_name);
+ Py_DECREF(ids_fast);
+ goto error;
+ }
+
+ id->tag |= LIB_TAG_DOIT;
+ }
+ Py_DECREF(ids_fast);
+
+ BKE_id_multi_tagged_delete(bmain);
+ /* Force full redraw, mandatory to avoid crashes when running this from UI... */
+ WM_main_add_notifier(NC_WINDOW, NULL);
+ }
+ else {
+ goto error;
+ }
+
+ Py_INCREF(Py_None);
+ ret = Py_None;
+
+error:
+ return ret;
}
int BPY_rna_id_collection_module(PyObject *mod_par)
@@ -296,5 +375,10 @@ int BPY_rna_id_collection_module(PyObject *mod_par)
PyModule_AddObject(mod_par, "_rna_id_collection_user_map", PyCFunction_New(&user_map, NULL));
+ static PyMethodDef batch_remove = {
+ "batch_remove", (PyCFunction)bpy_batch_remove, METH_VARARGS | METH_KEYWORDS, bpy_batch_remove_doc};
+
+ PyModule_AddObject(mod_par, "_rna_id_collection_batch_remove", PyCFunction_New(&batch_remove, NULL));
+
return 0;
}
diff --git a/source/blender/python/intern/bpy_rna_id_collection.h b/source/blender/python/intern/bpy_rna_id_collection.h
index c293289c821..b66629fc790 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.h
+++ b/source/blender/python/intern/bpy_rna_id_collection.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_rna_id_collection.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_RNA_ID_COLLECTION_H__
diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c
index bff778b9c9e..dd4d96cb806 100644
--- a/source/blender/python/intern/bpy_traceback.c
+++ b/source/blender/python/intern/bpy_traceback.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_traceback.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file contains utility functions for getting data from a python stack
* trace.
diff --git a/source/blender/python/intern/bpy_traceback.h b/source/blender/python/intern/bpy_traceback.h
index 9ac49c370e4..118b594b6d9 100644
--- a/source/blender/python/intern/bpy_traceback.h
+++ b/source/blender/python/intern/bpy_traceback.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_traceback.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
diff --git a/source/blender/python/intern/bpy_utils_previews.c b/source/blender/python/intern/bpy_utils_previews.c
index fed7c7210de..338e915780d 100644
--- a/source/blender/python/intern/bpy_utils_previews.c
+++ b/source/blender/python/intern/bpy_utils_previews.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_utils_previews.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines a singleton py object accessed via 'bpy.utils.previews',
* which exposes low-level API for custom previews/icons.
@@ -161,7 +155,7 @@ static struct PyMethodDef bpy_utils_previews_methods[] = {
{"new", (PyCFunction)bpy_utils_previews_new, METH_VARARGS, bpy_utils_previews_new_doc},
{"load", (PyCFunction)bpy_utils_previews_load, METH_VARARGS, bpy_utils_previews_load_doc},
{"release", (PyCFunction)bpy_utils_previews_release, METH_VARARGS, bpy_utils_previews_release_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(bpy_utils_previews_doc,
@@ -174,7 +168,7 @@ static struct PyModuleDef bpy_utils_previews_module = {
bpy_utils_previews_doc,
0,
bpy_utils_previews_methods,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL, NULL,
};
diff --git a/source/blender/python/intern/bpy_utils_previews.h b/source/blender/python/intern/bpy_utils_previews.h
index 3d7ade04b9f..e9de8876068 100644
--- a/source/blender/python/intern/bpy_utils_previews.h
+++ b/source/blender/python/intern/bpy_utils_previews.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_utils_previews.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_UTILS_PREVIEWS_H__
diff --git a/source/blender/python/intern/bpy_utils_units.c b/source/blender/python/intern/bpy_utils_units.c
index 1d1108e1af0..abae53088a8 100644
--- a/source/blender/python/intern/bpy_utils_units.c
+++ b/source/blender/python/intern/bpy_utils_units.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_utils_units.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*
* This file defines a singleton py object accessed via 'bpy.utils.units',
* which exposes various data and functions useful in units handling.
@@ -66,6 +60,7 @@ static const char *bpyunits_ucategorie_items[] = {
"VELOCITY",
"ACCELERATION",
"CAMERA",
+ "POWER",
NULL,
};
@@ -81,13 +76,13 @@ static PyStructSequence_Desc bpyunits_systems_desc = {
(char *)"bpy.utils.units.systems", /* name */
(char *)"This named tuple contains all pre-defined unit systems", /* doc */
bpyunits_systems_fields, /* fields */
- ARRAY_SIZE(bpyunits_systems_fields) - 1
+ ARRAY_SIZE(bpyunits_systems_fields) - 1,
};
static PyStructSequence_Desc bpyunits_categories_desc = {
(char *)"bpy.utils.units.categories", /* name */
(char *)"This named tuple contains all pre-defined unit names", /* doc */
bpyunits_categories_fields, /* fields */
- ARRAY_SIZE(bpyunits_categories_fields) - 1
+ ARRAY_SIZE(bpyunits_categories_fields) - 1,
};
/**
@@ -301,7 +296,7 @@ static PyObject *bpyunits_to_string(PyObject *UNUSED(self), PyObject *args, PyOb
static PyMethodDef bpyunits_methods[] = {
{"to_value", (PyCFunction)bpyunits_to_value, METH_VARARGS | METH_KEYWORDS, bpyunits_to_value_doc},
{"to_string", (PyCFunction)bpyunits_to_string, METH_VARARGS | METH_KEYWORDS, bpyunits_to_string_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(bpyunits_doc,
@@ -314,7 +309,7 @@ static struct PyModuleDef bpyunits_module = {
bpyunits_doc,
-1, /* multiple "initialization" just copies the module dict. */
bpyunits_methods,
- NULL, NULL, NULL, NULL
+ NULL, NULL, NULL, NULL,
};
PyObject *BPY_utils_units(void)
diff --git a/source/blender/python/intern/bpy_utils_units.h b/source/blender/python/intern/bpy_utils_units.h
index 5f840a2304d..55b79da6a93 100644
--- a/source/blender/python/intern/bpy_utils_units.h
+++ b/source/blender/python/intern/bpy_utils_units.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Bastien Montagne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/bpy_utils_units.h
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#ifndef __BPY_UTILS_UNITS_H__
diff --git a/source/blender/python/intern/stubs.c b/source/blender/python/intern/stubs.c
index 53adb8f2165..b6c30828f74 100644
--- a/source/blender/python/intern/stubs.c
+++ b/source/blender/python/intern/stubs.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/intern/stubs.c
- * \ingroup pythonintern
+/** \file
+ * \ingroup pythonintern
*/
#include "BLI_utildefines.h"
diff --git a/source/blender/python/mathutils/CMakeLists.txt b/source/blender/python/mathutils/CMakeLists.txt
index 811cc1acbab..4a8d69f72fd 100644
--- a/source/blender/python/mathutils/CMakeLists.txt
+++ b/source/blender/python/mathutils/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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 *****
set(INC
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 07905d2be89..60224d093a1 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 Gilbert, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils.c
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
#include <Python.h>
@@ -586,7 +580,7 @@ void BaseMathObject_dealloc(BaseMathObject *self)
/*----------------------------MODULE INIT-------------------------*/
static struct PyMethodDef M_Mathutils_methods[] = {
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyModuleDef M_Mathutils_module_def = {
diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h
index ab78009ff89..bc5490a3acd 100644
--- a/source/blender/python/mathutils/mathutils.h
+++ b/source/blender/python/mathutils/mathutils.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __MATHUTILS_H__
#define __MATHUTILS_H__
-/** \file blender/python/mathutils/mathutils.h
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
/* Can cast different mathutils types to this, use for generic funcs */
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index e97ed095b24..b05b8c81cf9 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/mathutils/mathutils_Color.c
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
@@ -403,7 +397,7 @@ static PySequenceMethods Color_SeqMethods = {
static PyMappingMethods Color_AsMapping = {
(lenfunc)Color_len,
(binaryfunc)Color_subscript,
- (objobjargproc)Color_ass_subscript
+ (objobjargproc)Color_ass_subscript,
};
/* numeric */
@@ -830,7 +824,7 @@ static struct PyMethodDef Color_methods[] = {
/* base-math methods */
{"freeze", (PyCFunction)BaseMathObject_freeze, METH_NOARGS, BaseMathObject_freeze_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/* ------------------PY_OBECT DEFINITION-------------------------- */
diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h
index e1a392de3da..6dc56f8aacb 100644
--- a/source/blender/python/mathutils/mathutils_Color.h
+++ b/source/blender/python/mathutils/mathutils_Color.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,10 @@
* 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 Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/python/mathutils/mathutils_Color.h
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 9046bdc1aa4..a3336309574 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_Euler.c
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
@@ -602,7 +596,7 @@ static PySequenceMethods Euler_SeqMethods = {
static PyMappingMethods Euler_AsMapping = {
(lenfunc)Euler_len,
(binaryfunc)Euler_subscript,
- (objobjargproc)Euler_ass_subscript
+ (objobjargproc)Euler_ass_subscript,
};
/* euler axis, euler.x/y/z */
@@ -682,7 +676,7 @@ static struct PyMethodDef Euler_methods[] = {
/* base-math methods */
{"freeze", (PyCFunction)BaseMathObject_freeze, METH_NOARGS, BaseMathObject_freeze_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/* ------------------PY_OBECT DEFINITION-------------------------- */
diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h
index 4f5ba76b8df..55ca3cd6df6 100644
--- a/source/blender/python/mathutils/mathutils_Euler.h
+++ b/source/blender/python/mathutils/mathutils_Euler.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,13 @@
* 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 Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
#ifndef __MATHUTILS_EULER_H__
#define __MATHUTILS_EULER_H__
-/** \file blender/python/mathutils/mathutils_Euler.h
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
extern PyTypeObject euler_Type;
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index c033a990901..373a6635369 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Michel Selten & Joseph Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_Matrix.c
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
@@ -158,7 +152,7 @@ Mathutils_Callback mathutils_matrix_row_cb = {
mathutils_matrix_row_get,
mathutils_matrix_row_set,
mathutils_matrix_row_get_index,
- mathutils_matrix_row_set_index
+ mathutils_matrix_row_set_index,
};
@@ -250,7 +244,7 @@ Mathutils_Callback mathutils_matrix_col_cb = {
mathutils_matrix_col_get,
mathutils_matrix_col_set,
mathutils_matrix_col_get_index,
- mathutils_matrix_col_set_index
+ mathutils_matrix_col_set_index,
};
@@ -327,7 +321,7 @@ Mathutils_Callback mathutils_matrix_translation_cb = {
mathutils_matrix_translation_get,
mathutils_matrix_translation_set,
mathutils_matrix_translation_get_index,
- mathutils_matrix_translation_set_index
+ mathutils_matrix_translation_set_index,
};
@@ -2652,7 +2646,7 @@ static int Matrix_ass_subscript(MatrixObject *self, PyObject *item, PyObject *va
static PyMappingMethods Matrix_AsMapping = {
(lenfunc)Matrix_len,
(binaryfunc)Matrix_subscript,
- (objobjargproc)Matrix_ass_subscript
+ (objobjargproc)Matrix_ass_subscript,
};
@@ -2912,7 +2906,7 @@ static struct PyMethodDef Matrix_methods[] = {
{"Shear", (PyCFunction) C_Matrix_Shear, METH_VARARGS | METH_CLASS, C_Matrix_Shear_doc},
{"Translation", (PyCFunction) C_Matrix_Translation, METH_O | METH_CLASS, C_Matrix_Translation_doc},
{"OrthoProjection", (PyCFunction) C_Matrix_OrthoProjection, METH_VARARGS | METH_CLASS, C_Matrix_OrthoProjection_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*------------------PY_OBECT DEFINITION--------------------------*/
@@ -3314,7 +3308,7 @@ static PyObject *MatrixAccess_iter(MatrixAccessObject *self)
static PyMappingMethods MatrixAccess_AsMapping = {
(lenfunc)MatrixAccess_len,
(binaryfunc)MatrixAccess_subscript,
- (objobjargproc) MatrixAccess_ass_subscript
+ (objobjargproc) MatrixAccess_ass_subscript,
};
PyTypeObject matrix_access_Type = {
diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h
index f7c8d7eebeb..0f47472c8fd 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.h
+++ b/source/blender/python/mathutils/mathutils_Matrix.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_Matrix.h
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index a2b4480584a..5f7ab5fface 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_Quaternion.c
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
@@ -1036,7 +1030,7 @@ static PySequenceMethods Quaternion_SeqMethods = {
static PyMappingMethods Quaternion_AsMapping = {
(lenfunc)Quaternion_len,
(binaryfunc)Quaternion_subscript,
- (objobjargproc)Quaternion_ass_subscript
+ (objobjargproc)Quaternion_ass_subscript,
};
static PyNumberMethods Quaternion_NumMethods = {
@@ -1337,7 +1331,7 @@ static struct PyMethodDef Quaternion_methods[] = {
{"copy", (PyCFunction) Quaternion_copy, METH_NOARGS, Quaternion_copy_doc},
{"__copy__", (PyCFunction) Quaternion_copy, METH_NOARGS, Quaternion_copy_doc},
{"__deepcopy__", (PyCFunction) Quaternion_deepcopy, METH_VARARGS, Quaternion_copy_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
/*****************************************************************************/
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h
index 46f305b0f0e..a4c55fffccc 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.h
+++ b/source/blender/python/mathutils/mathutils_Quaternion.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __MATHUTILS_QUATERNION_H__
#define __MATHUTILS_QUATERNION_H__
-/** \file blender/python/mathutils/mathutils_Quaternion.h
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
extern PyTypeObject quaternion_Type;
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 16a242fc718..11b8eff85f6 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Willian P. Germano, Joseph Gilbert, Ken Hughes, Alex Fraser, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_Vector.c
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
@@ -2170,7 +2164,7 @@ static int Vector_ass_subscript(VectorObject *self, PyObject *item, PyObject *va
static PyMappingMethods Vector_AsMapping = {
(lenfunc)Vector_len,
(binaryfunc)Vector_subscript,
- (objobjargproc)Vector_ass_subscript
+ (objobjargproc)Vector_ass_subscript,
};
@@ -2338,8 +2332,6 @@ static PyObject *Vector_length_squared_get(VectorObject *self, void *UNUSED(clos
* (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos))
*
* axises = axises[:-1]
- *
- *
* items = list(axis_dict.items())
* items.sort(key=lambda a: a[0].replace('x', '0').replace('y', '1').replace('z', '2').replace('w', '3'))
*
@@ -2963,7 +2955,7 @@ static struct PyMethodDef Vector_methods[] = {
{"copy", (PyCFunction) Vector_copy, METH_NOARGS, Vector_copy_doc},
{"__copy__", (PyCFunction) Vector_copy, METH_NOARGS, NULL},
{"__deepcopy__", (PyCFunction) Vector_deepcopy, METH_VARARGS, NULL},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
@@ -3064,7 +3056,7 @@ PyTypeObject vector_Type = {
NULL, /* PyObject *tp_cache; */
NULL, /* PyObject *tp_subclasses; */
NULL, /* PyObject *tp_weaklist; */
- NULL
+ NULL,
};
PyObject *Vector_CreatePyObject(
diff --git a/source/blender/python/mathutils/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h
index 9ebf9457f2b..7ebc3fbf1d6 100644
--- a/source/blender/python/mathutils/mathutils_Vector.h
+++ b/source/blender/python/mathutils/mathutils_Vector.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Willian P. Germano & Joseph Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_Vector.h
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c
index fce0dd7d2af..9b972f5fc91 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Lukas Toenne, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_bvhtree.c
- * \ingroup mathutils
+/** \file
+ * \ingroup mathutils
*
* This file defines the 'mathutils.bvhtree' module, a general purpose module to access
* blenders bvhtree for mesh surface nearest-element search and ray casting.
@@ -69,7 +63,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Docstring (snippets)
* \{ */
@@ -119,7 +112,6 @@ typedef struct {
/* -------------------------------------------------------------------- */
-
/** \name Utility helper functions
* \{ */
@@ -152,7 +144,6 @@ static PyObject *bvhtree_CreatePyObject(
/* -------------------------------------------------------------------- */
-
/** \name BVHTreeRayHit to Python utilities
* \{ */
@@ -209,7 +200,6 @@ static PyObject *py_bvhtree_raycast_to_py_and_check(const BVHTreeRayHit *hit)
/* -------------------------------------------------------------------- */
-
/** \name BVHTreeNearest to Python utilities
* \{ */
@@ -281,7 +271,6 @@ static void py_bvhtree__tp_dealloc(PyBVHTree *self)
/* -------------------------------------------------------------------- */
-
/** \name Methods
* \{ */
@@ -661,7 +650,6 @@ static PyObject *py_bvhtree_overlap(PyBVHTree *self, PyBVHTree *other)
/* -------------------------------------------------------------------- */
-
/** \name Class Methods
* \{ */
@@ -1057,7 +1045,7 @@ static Mesh *bvh_get_mesh(
{
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
/* we only need minimum mesh data for topology and vertex locations */
- CustomDataMask mask = CD_MASK_BAREMESH;
+ CustomData_MeshMasks data_masks = CD_MASK_BAREMESH;
const bool use_render = DEG_get_mode(depsgraph) == DAG_EVAL_RENDER;
*r_free_mesh = false;
@@ -1071,15 +1059,15 @@ static Mesh *bvh_get_mesh(
}
else {
*r_free_mesh = true;
- return mesh_create_eval_final_render(depsgraph, scene, ob, mask);
+ return mesh_create_eval_final_render(depsgraph, scene, ob, &data_masks);
}
}
else if (ob_eval != NULL) {
if (use_cage) {
- return mesh_get_eval_deform(depsgraph, scene, ob_eval, mask); /* ob->derivedDeform */
+ return mesh_get_eval_deform(depsgraph, scene, ob_eval, &data_masks); /* ob->derivedDeform */
}
else {
- return mesh_get_eval_final(depsgraph, scene, ob_eval, mask); /* ob->derivedFinal */
+ return mesh_get_eval_final(depsgraph, scene, ob_eval, &data_masks); /* ob->derivedFinal */
}
}
else {
@@ -1098,7 +1086,7 @@ static Mesh *bvh_get_mesh(
}
else {
*r_free_mesh = true;
- return mesh_create_eval_no_deform_render(depsgraph, scene, ob, NULL, mask);
+ return mesh_create_eval_no_deform_render(depsgraph, scene, ob, NULL, &data_masks);
}
}
else {
@@ -1109,7 +1097,7 @@ static Mesh *bvh_get_mesh(
}
else {
*r_free_mesh = true;
- return mesh_create_eval_no_deform(depsgraph, scene, ob, NULL, mask);
+ return mesh_create_eval_no_deform(depsgraph, scene, ob, NULL, &data_masks);
}
}
}
@@ -1240,7 +1228,6 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO
/* -------------------------------------------------------------------- */
-
/** \name Module & Type definition
* \{ */
@@ -1256,7 +1243,7 @@ static PyMethodDef py_bvhtree_methods[] = {
{"FromBMesh", (PyCFunction) C_BVHTree_FromBMesh, METH_VARARGS | METH_KEYWORDS | METH_CLASS, C_BVHTree_FromBMesh_doc},
{"FromObject", (PyCFunction) C_BVHTree_FromObject, METH_VARARGS | METH_KEYWORDS | METH_CLASS, C_BVHTree_FromObject_doc},
#endif
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyTypeObject PyBVHTree_Type = {
diff --git a/source/blender/python/mathutils/mathutils_bvhtree.h b/source/blender/python/mathutils/mathutils_bvhtree.h
index 445a393b93e..6971eb5ccd4 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.h
+++ b/source/blender/python/mathutils/mathutils_bvhtree.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,13 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_bvhtree.h
- * \ingroup mathutils
+/** \file
+ * \ingroup mathutils
*/
#ifndef __MATHUTILS_BVHTREE_H__
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index 371733ea147..6106b01fd41 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 Gilbert, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_geometry.c
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
@@ -1516,7 +1510,7 @@ static PyMethodDef M_Geometry_methods[] = {
{"box_fit_2d", (PyCFunction) M_Geometry_box_fit_2d, METH_O, M_Geometry_box_fit_2d_doc},
{"box_pack_2d", (PyCFunction) M_Geometry_box_pack_2d, METH_O, M_Geometry_box_pack_2d_doc},
#endif
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyModuleDef M_Geometry_module_def = {
diff --git a/source/blender/python/mathutils/mathutils_geometry.h b/source/blender/python/mathutils/mathutils_geometry.h
index 7f6a1a3887f..5a1198b4a26 100644
--- a/source/blender/python/mathutils/mathutils_geometry.h
+++ b/source/blender/python/mathutils/mathutils_geometry.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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 Gilbert
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __MATHUTILS_GEOMETRY_H__
#define __MATHUTILS_GEOMETRY_H__
-/** \file blender/python/mathutils/mathutils_geometry.h
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
PyMODINIT_FUNC PyInit_mathutils_geometry(void);
diff --git a/source/blender/python/mathutils/mathutils_interpolate.c b/source/blender/python/mathutils/mathutils_interpolate.c
index 720fac7c276..da2ed0ced7e 100644
--- a/source/blender/python/mathutils/mathutils_interpolate.c
+++ b/source/blender/python/mathutils/mathutils_interpolate.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_interpolate.c
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
@@ -115,7 +109,7 @@ static PyMethodDef M_Interpolate_methods[] = {
#ifndef MATH_STANDALONE
{"poly_3d_calc", (PyCFunction) M_Interpolate_poly_3d_calc, METH_VARARGS, M_Interpolate_poly_3d_calc_doc},
#endif
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyModuleDef M_Interpolate_module_def = {
diff --git a/source/blender/python/mathutils/mathutils_interpolate.h b/source/blender/python/mathutils/mathutils_interpolate.h
index 1bbff6f3286..50dee1ee8de 100644
--- a/source/blender/python/mathutils/mathutils_interpolate.h
+++ b/source/blender/python/mathutils/mathutils_interpolate.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,17 +12,13 @@
* 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): Lukas Toenne
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __MATHUTILS_INTERPOLATE_H__
#define __MATHUTILS_INTERPOLATE_H__
-/** \file blender/python/mathutils/mathutils_interpolate.h
- * \ingroup pymathutils
+/** \file
+ * \ingroup pymathutils
*/
PyMODINIT_FUNC PyInit_mathutils_interpolate(void);
diff --git a/source/blender/python/mathutils/mathutils_kdtree.c b/source/blender/python/mathutils/mathutils_kdtree.c
index ca66c1906b4..43aaae6ad99 100644
--- a/source/blender/python/mathutils/mathutils_kdtree.c
+++ b/source/blender/python/mathutils/mathutils_kdtree.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Dan Eicher, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_kdtree.c
- * \ingroup mathutils
+/** \file
+ * \ingroup mathutils
*
* This file defines the 'mathutils.kdtree' module, a general purpose module to access
* blenders kdtree for 3d spatial lookups.
@@ -398,7 +392,7 @@ static PyMethodDef PyKDTree_methods[] = {
{"find", (PyCFunction)py_kdtree_find, METH_VARARGS | METH_KEYWORDS, py_kdtree_find_doc},
{"find_n", (PyCFunction)py_kdtree_find_n, METH_VARARGS | METH_KEYWORDS, py_kdtree_find_n_doc},
{"find_range", (PyCFunction)py_kdtree_find_range, METH_VARARGS | METH_KEYWORDS, py_kdtree_find_range_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
PyDoc_STRVAR(py_KDtree_doc,
diff --git a/source/blender/python/mathutils/mathutils_kdtree.h b/source/blender/python/mathutils/mathutils_kdtree.h
index 33c0cbe23fd..4a4e1740ad8 100644
--- a/source/blender/python/mathutils/mathutils_kdtree.h
+++ b/source/blender/python/mathutils/mathutils_kdtree.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,13 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_kdtree.h
- * \ingroup mathutils
+/** \file
+ * \ingroup mathutils
*/
#ifndef __MATHUTILS_KDTREE_H__
diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
index 5e3e86c8ddf..364690c43eb 100644
--- a/source/blender/python/mathutils/mathutils_noise.c
+++ b/source/blender/python/mathutils/mathutils_noise.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): eeshlo, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/python/mathutils/mathutils_noise.c
- * \ingroup mathutils
+/** \file
+ * \ingroup mathutils
*
* This file defines the 'noise' module, a general purpose module to access
* blenders noise functions.
@@ -86,8 +80,6 @@
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
* Any feedback is very welcome.
* http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
* email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
@@ -216,7 +208,7 @@ static PyC_FlagSet bpy_noise_types[] = {
{TEX_VORONOI_F2F1, "VORONOI_F2F1"},
{TEX_VORONOI_CRACKLE, "VORONOI_CRACKLE"},
{TEX_CELLNOISE, "CELLNOISE"},
- {0, NULL}
+ {0, NULL},
};
/* Metric basis enum */
@@ -230,7 +222,7 @@ static PyC_FlagSet bpy_noise_metrics[] = {
{TEX_MINKOVSKY, "MINKOVSKY"},
{TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF"},
{TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR"},
- {0, NULL}
+ {0, NULL},
};
/* Fills an array of length size with random numbers in the range (-1, 1)*/
@@ -1044,7 +1036,7 @@ static PyMethodDef M_Noise_methods[] = {
{"voronoi", (PyCFunction) M_Noise_voronoi, METH_VARARGS | METH_KEYWORDS, M_Noise_voronoi_doc},
{"cell", (PyCFunction) M_Noise_cell, METH_VARARGS, M_Noise_cell_doc},
{"cell_vector", (PyCFunction) M_Noise_cell_vector, METH_VARARGS, M_Noise_cell_vector_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL},
};
static struct PyModuleDef M_Noise_module_def = {
diff --git a/source/blender/python/mathutils/mathutils_noise.h b/source/blender/python/mathutils/mathutils_noise.h
index 469cd9636e6..8204c084947 100644
--- a/source/blender/python/mathutils/mathutils_noise.h
+++ b/source/blender/python/mathutils/mathutils_noise.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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 *****
*/
-/** \file blender/python/mathutils/mathutils_noise.h
- * \ingroup mathutils
+/** \file
+ * \ingroup mathutils
*/
#ifndef __MATHUTILS_NOISE_H__
diff --git a/source/blender/python/rna_dump.py b/source/blender/python/rna_dump.py
index 3c09175910e..c2ede5664f2 100644
--- a/source/blender/python/rna_dump.py
+++ b/source/blender/python/rna_dump.py
@@ -14,8 +14,6 @@
# 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 #####
# <pep8 compliant>
diff --git a/source/blender/python/simple_enum_gen.py b/source/blender/python/simple_enum_gen.py
index 3a9c1847fc7..861701f4b4c 100644
--- a/source/blender/python/simple_enum_gen.py
+++ b/source/blender/python/simple_enum_gen.py
@@ -39,8 +39,8 @@ defs = """
SPACEICONMAX
"""
-print '\tmod = PyModule_New("dummy");'
-print '\tPyModule_AddObject(submodule, "key", mod);'
+print('\tmod = PyModule_New("dummy");')
+print('\tPyModule_AddObject(submodule, "key", mod);')
for d in defs.split('\n'):
@@ -60,4 +60,4 @@ 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/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt
index 8f921d7850a..fc2c0b324a9 100644
--- a/source/blender/render/CMakeLists.txt
+++ b/source/blender/render/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
@@ -60,15 +55,15 @@ set(SRC
intern/source/render_texture.c
intern/source/zbuf.c
- extern/include/RE_engine.h
extern/include/RE_bake.h
+ extern/include/RE_engine.h
extern/include/RE_multires_bake.h
extern/include/RE_pipeline.h
extern/include/RE_render_ext.h
extern/include/RE_shader_ext.h
intern/include/initrender.h
- intern/include/render_types.h
intern/include/render_result.h
+ intern/include/render_types.h
intern/include/renderpipeline.h
intern/include/texture.h
intern/include/zbuf.h
diff --git a/source/blender/render/extern/include/RE_bake.h b/source/blender/render/extern/include/RE_bake.h
index 4489efc6a10..f04f689d114 100644
--- a/source/blender/render/extern/include/RE_bake.h
+++ b/source/blender/render/extern/include/RE_bake.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,25 +15,19 @@
*
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s):
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file RE_bake.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
#ifndef __RE_BAKE_H__
#define __RE_BAKE_H__
+struct Depsgraph;
struct ImBuf;
-struct Render;
struct Mesh;
-struct Depsgraph;
+struct Render;
typedef struct BakeImage {
struct Image *image;
diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h
index faa4c8b3184..cdd696e56bb 100644
--- a/source/blender/render/extern/include/RE_engine.h
+++ b/source/blender/render/extern/include/RE_engine.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file RE_engine.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
#ifndef __RE_ENGINE_H__
@@ -37,8 +29,8 @@
#include "RNA_types.h"
#include "RE_bake.h"
-struct bNode;
-struct bNodeTree;
+#include "BLI_threads.h"
+
struct BakePixel;
struct Depsgraph;
struct IDProperty;
@@ -53,6 +45,8 @@ struct RenderResult;
struct ReportList;
struct Scene;
struct ViewLayer;
+struct bNode;
+struct bNodeTree;
/* External Engine */
@@ -77,11 +71,6 @@ struct ViewLayer;
#define RE_ENGINE_HIGHLIGHT_TILES 32
#define RE_ENGINE_USED_FOR_VIEWPORT 64
-/* RenderEngine.update_flag, used by internal now */
-#define RE_ENGINE_UPDATE_MA 1
-#define RE_ENGINE_UPDATE_OTHER 2
-#define RE_ENGINE_UPDATE_DATABASE 4
-
extern ListBase R_engines;
typedef struct RenderEngineType {
@@ -111,6 +100,9 @@ typedef struct RenderEngineType {
ExtensionRNA ext;
} RenderEngineType;
+typedef void (*update_render_passes_cb_t)(void *userdata, struct Scene *scene, struct ViewLayer *view_layer,
+ const char *name, int channels, const char *chanid, int type);
+
typedef struct RenderEngine {
RenderEngineType *type;
void *py_instance;
@@ -133,9 +125,10 @@ typedef struct RenderEngine {
/* Depsgraph */
struct Depsgraph *depsgraph;
- /* for blender internal only */
- int update_flag;
- int job_update_flag;
+ /* callback for render pass query */
+ ThreadMutex update_render_passes_mutex;
+ update_render_passes_cb_t update_render_passes_cb;
+ void *update_render_passes_data;
rctf last_viewplane;
rcti last_disprect;
@@ -175,6 +168,8 @@ bool RE_engine_is_external(struct Render *re);
void RE_engine_frame_set(struct RenderEngine *engine, int frame, float subframe);
+void RE_engine_update_render_passes(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer,
+ update_render_passes_cb_t callback, void *callback_data);
void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer,
const char *name, int channels, const char *chanid, int type);
diff --git a/source/blender/render/extern/include/RE_multires_bake.h b/source/blender/render/extern/include/RE_multires_bake.h
index 983e95639b4..626910701e0 100644
--- a/source/blender/render/extern/include/RE_multires_bake.h
+++ b/source/blender/render/extern/include/RE_multires_bake.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Morten Mikkelsen,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file RE_multires_bake.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
#ifndef __RE_MULTIRES_BAKE_H__
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index be7bf4f454b..83217c6b009 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file RE_pipeline.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
#ifndef __RE_PIPELINE_H__
@@ -36,8 +28,6 @@
#include "DNA_vec_types.h"
#include "DEG_depsgraph.h"
-struct bMovieHandle;
-struct bNodeTree;
struct Depsgraph;
struct Image;
struct ImageFormatData;
@@ -48,8 +38,10 @@ struct RenderData;
struct RenderResult;
struct ReportList;
struct Scene;
-struct ViewLayer;
struct StampData;
+struct ViewLayer;
+struct bMovieHandle;
+struct bNodeTree;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* this include is what is exposed of render to outside world */
@@ -250,14 +242,13 @@ void RE_ChangeModeFlag(struct Render *re, int flag, bool clear);
struct Object *RE_GetCamera(struct Render *re); /* return camera override if set */
void RE_SetOverrideCamera(struct Render *re, struct Object *camera);
void RE_SetCamera(struct Render *re, struct Object *camera);
-void RE_SetWindow(struct Render *re, const rctf *viewplane, float clipsta, float clipend);
-void RE_SetOrtho(struct Render *re, const rctf *viewplane, float clipsta, float clipend);
+void RE_SetWindow(struct Render *re, const rctf *viewplane, float clip_start, float clip_end);
+void RE_SetOrtho(struct Render *re, const rctf *viewplane, float clip_start, float clip_end);
/* option to set viewmatrix before making dbase */
void RE_SetView(struct Render *re, float mat[4][4]);
/* get current view and window transform */
-void RE_GetView(struct Render *re, float mat[4][4]);
void RE_GetViewPlane(struct Render *re, rctf *r_viewplane, rcti *r_disprect);
/* set the render threads based on the commandline and autothreads setting */
diff --git a/source/blender/render/extern/include/RE_render_ext.h b/source/blender/render/extern/include/RE_render_ext.h
index dad88cf06fa..dd457751545 100644
--- a/source/blender/render/extern/include/RE_render_ext.h
+++ b/source/blender/render/extern/include/RE_render_ext.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,9 @@
*
* The Original Code is Copyright (C) 2006 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file RE_render_ext.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
@@ -40,9 +32,9 @@
struct Depsgraph;
struct ImagePool;
struct MTex;
+struct Render;
struct Scene;
struct ViewLayer;
-struct Render;
/* render_texture.c */
/* used by particle.c, effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */
diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h
index 52d4961352d..5fc9431af3d 100644
--- a/source/blender/render/extern/include/RE_shader_ext.h
+++ b/source/blender/render/extern/include/RE_shader_ext.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,9 @@
*
* The Original Code is Copyright (C) 2006 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file RE_shader_ext.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
@@ -50,11 +42,11 @@ typedef struct BakeImBufuserData {
} BakeImBufuserData;
/* node shaders... */
-struct Tex;
-struct MTex;
struct ImBuf;
struct ImagePool;
+struct MTex;
struct Object;
+struct Tex;
/* this one uses nodes */
int multitex_ext(struct Tex *tex,
diff --git a/source/blender/render/intern/include/initrender.h b/source/blender/render/intern/include/initrender.h
index 22a2176e16c..1c290084fbc 100644
--- a/source/blender/render/intern/include/initrender.h
+++ b/source/blender/render/intern/include/initrender.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/include/initrender.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
diff --git a/source/blender/render/intern/include/render_result.h b/source/blender/render/intern/include/render_result.h
index ab7eee128f0..d7636a150ef 100644
--- a/source/blender/render/intern/include/render_result.h
+++ b/source/blender/render/intern/include/render_result.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/include/render_result.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
#ifndef __RENDER_RESULT_H__
@@ -40,16 +32,17 @@
#define RR_ALL_LAYERS NULL
#define RR_ALL_VIEWS NULL
+struct ColorManagedDisplaySettings;
+struct ColorManagedViewSettings;
struct ImBuf;
struct ListBase;
struct Render;
struct RenderData;
+struct RenderEngine;
struct RenderLayer;
struct RenderResult;
struct Scene;
struct rcti;
-struct ColorManagedDisplaySettings;
-struct ColorManagedViewSettings;
/* New */
@@ -83,8 +76,8 @@ void render_result_single_layer_end(struct Render *re);
/* EXR Tile File Render */
void render_result_save_empty_result_tiles(struct Render *re);
-void render_result_exr_file_begin(struct Render *re);
-void render_result_exr_file_end(struct Render *re);
+void render_result_exr_file_begin(struct Render *re, struct RenderEngine *engine);
+void render_result_exr_file_end(struct Render *re, struct RenderEngine *engine);
/* render pass wrapper for gpencil */
struct RenderPass *gp_add_pass(struct RenderResult *rr, struct RenderLayer *rl, int channels, const char *name, const char *viewname);
@@ -92,7 +85,6 @@ struct RenderPass *gp_add_pass(struct RenderResult *rr, struct RenderLayer *rl,
void render_result_exr_file_merge(struct RenderResult *rr, struct RenderResult *rrpart, const char *viewname);
void render_result_exr_file_path(struct Scene *scene, const char *layname, int sample, char *filepath);
-int render_result_exr_file_read_sample(struct Render *re, int sample);
int render_result_exr_file_read_path(struct RenderResult *rr, struct RenderLayer *rl_single, const char *filepath);
/* EXR cache */
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h
index 1467f8d9804..a4533c6cdec 100644
--- a/source/blender/render/intern/include/render_types.h
+++ b/source/blender/render/intern/include/render_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): (c) 2006 Blender Foundation, full refactor
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/include/render_types.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
@@ -44,10 +38,10 @@
#include "RE_pipeline.h"
+struct Main;
struct Object;
struct RenderEngine;
struct ReportList;
-struct Main;
/* this is handed over to threaded hiding/passes/shading engine */
typedef struct RenderPart {
@@ -66,7 +60,7 @@ enum {
PART_STATUS_NONE = 0,
PART_STATUS_IN_PROGRESS = 1,
PART_STATUS_RENDERED = 2,
- PART_STATUS_MERGED = 3
+ PART_STATUS_MERGED = 3,
};
/* controls state of render, everything that's read-only during render stage */
@@ -103,13 +97,11 @@ struct Render {
int partx, party;
/* Camera transform, only used by Freestyle. */
- float viewmat[4][4], viewinv[4][4];
- float viewmat_orig[4][4]; /* for incremental render */
float winmat[4][4];
/* clippping */
- float clipsta;
- float clipend;
+ float clip_start;
+ float clip_end;
/* main, scene, and its full copy of renderdata and world */
struct Main *main;
diff --git a/source/blender/render/intern/include/renderpipeline.h b/source/blender/render/intern/include/renderpipeline.h
index ef7094633a1..7479de8b707 100644
--- a/source/blender/render/intern/include/renderpipeline.h
+++ b/source/blender/render/intern/include/renderpipeline.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/include/renderpipeline.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h
index 04a456c0850..7c86f700652 100644
--- a/source/blender/render/intern/include/texture.h
+++ b/source/blender/render/intern/include/texture.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/include/texture.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
@@ -63,11 +55,11 @@
} \
} \
-struct TexResult;
-struct Tex;
-struct Image;
struct ImBuf;
+struct Image;
struct ImagePool;
+struct Tex;
+struct TexResult;
/* imagetexture.h */
diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h
index 0acc7d091e3..b5f4fffb0a9 100644
--- a/source/blender/render/intern/include/zbuf.h
+++ b/source/blender/render/intern/include/zbuf.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Full recode: 2004-2006 Blender Foundation
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/include/zbuf.h
- * \ingroup render
+/** \file
+ * \ingroup render
*/
diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c
index 6aa888d9f90..346d57e17cf 100644
--- a/source/blender/render/intern/source/bake_api.c
+++ b/source/blender/render/intern/source/bake_api.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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.
- *
- * Contributors:
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/source/bake_api.c
- * \ingroup render
+/** \file
+ * \ingroup render
*
* \brief The API itself is simple. Blender sends a populated array of BakePixels to the renderer, and gets back an
* array of floats with the result.
@@ -360,7 +354,7 @@ static bool cast_ray_highpoly(
mul_v3_v3fl(dyco, duco_low, pixel_low->du_dy);
madd_v3_v3fl(dyco, dvco_low, pixel_low->dv_dy);
- /* transform from low poly to to high poly object space */
+ /* transform from low poly to high poly object space */
mul_mat3_m4_v3(mat_low, dxco);
mul_mat3_m4_v3(mat_low, dyco);
mul_mat3_m4_v3(highpoly[hit_mesh].imat, dxco);
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 758600e89aa..153d41627c9 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/source/external_engine.c
- * \ingroup render
+/** \file
+ * \ingroup render
*/
#include <stddef.h>
@@ -150,6 +142,8 @@ RenderEngine *RE_engine_create_ex(RenderEngineType *type, bool use_for_viewport)
BLI_threaded_malloc_begin();
}
+ BLI_mutex_init(&engine->update_render_passes_mutex);
+
return engine;
}
@@ -165,6 +159,8 @@ void RE_engine_free(RenderEngine *engine)
BLI_threaded_malloc_end();
}
+ BLI_mutex_end(&engine->update_render_passes_mutex);
+
MEM_freeN(engine);
}
@@ -711,7 +707,7 @@ int RE_engine_render(Render *re, int do_all)
engine->tile_y = re->party;
if (re->result->do_exr_tile)
- render_result_exr_file_begin(re);
+ render_result_exr_file_begin(re, engine);
/* Clear UI drawing locks. */
if (re->draw_lock) {
@@ -765,19 +761,16 @@ int RE_engine_render(Render *re, int do_all)
BLI_rw_mutex_lock(&re->partsmutex, THREAD_LOCK_WRITE);
+ if (re->result->do_exr_tile) {
+ render_result_exr_file_end(re, engine);
+ }
+
/* re->engine becomes zero if user changed active render engine during render */
if (!persistent_data || !re->engine) {
RE_engine_free(engine);
re->engine = NULL;
}
- if (re->result->do_exr_tile) {
- BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
- render_result_save_empty_result_tiles(re);
- render_result_exr_file_end(re);
- BLI_rw_mutex_unlock(&re->resultmutex);
- }
-
if (re->r.scemode & R_EXR_CACHE_FILE) {
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
render_result_exr_file_cache_write(re);
@@ -798,25 +791,32 @@ int RE_engine_render(Render *re, int do_all)
return 1;
}
-void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer,
- const char *name, int UNUSED(channels), const char *UNUSED(chanid), int type)
+void RE_engine_update_render_passes(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer,
+ update_render_passes_cb_t callback, void *callback_data)
{
- /* The channel information is currently not used, but is part of the API in case it's needed in the future. */
-
- if (!(scene && view_layer && engine)) {
+ if (!(scene && view_layer && engine && callback && engine->type->update_render_passes)) {
return;
}
- /* Register the pass in all scenes that have a render layer node for this layer.
- * Since multiple scenes can be used in the compositor, the code must loop over all scenes
- * and check whether their nodetree has a node that needs to be updated. */
- /* NOTE: using G_MAIN seems valid here,
- * unless we want to register that for every other temp Main we could generate??? */
- for (Scene *sce = G_MAIN->scene.first; sce; sce = sce->id.next) {
- if (sce->nodetree) {
- ntreeCompositRegisterPass(sce->nodetree, scene, view_layer, name, type);
- }
+ BLI_mutex_lock(&engine->update_render_passes_mutex);
+
+ engine->update_render_passes_cb = callback;
+ engine->update_render_passes_data = callback_data;
+ engine->type->update_render_passes(engine, scene, view_layer);
+ engine->update_render_passes_cb = NULL;
+ engine->update_render_passes_data = NULL;
+
+ BLI_mutex_unlock(&engine->update_render_passes_mutex);
+}
+
+void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer,
+ const char *name, int channels, const char *chanid, int type)
+{
+ if (!(scene && view_layer && engine && engine->update_render_passes_cb)) {
+ return;
}
+
+ engine->update_render_passes_cb(engine->update_render_passes_data, scene, view_layer, name, channels, chanid, type);
}
void RE_engine_free_blender_memory(RenderEngine *engine)
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 3a31413c5cd..afddbcfbd4c 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributors: 2004/2005/2006 Blender Foundation, full recode
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/source/imagetexture.c
- * \ingroup render
+/** \file
+ * \ingroup render
*/
#include <stdio.h>
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 1420b8feef7..7b0b1bed0ef 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributors: 2004/2005/2006 Blender Foundation, full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/source/initrender.c
- * \ingroup render
+/** \file
+ * \ingroup render
*/
/* Global includes */
@@ -153,8 +147,8 @@ static void re_camera_params_get(Render *re, CameraParams *params)
{
copy_m4_m4(re->winmat, params->winmat);
- re->clipsta = params->clipsta;
- re->clipend = params->clipend;
+ re->clip_start = params->clip_start;
+ re->clip_end = params->clip_end;
re->viewplane = params->viewplane;
}
@@ -200,8 +194,8 @@ void RE_GetCameraWindowWithOverscan(struct Render *re, float mat[4][4], float ov
{
CameraParams params;
params.is_ortho = re->winmat[3][3] != 0.0f;
- params.clipsta = re->clipsta;
- params.clipend = re->clipend;
+ params.clip_start = re->clip_start;
+ params.clip_end = re->clip_end;
params.viewplane = re->viewplane;
overscan *= max_ff(BLI_rctf_size_x(&params.viewplane), BLI_rctf_size_y(&params.viewplane));
diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c
index a5d2a359472..f20434969db 100644
--- a/source/blender/render/intern/source/multires_bake.c
+++ b/source/blender/render/intern/source/multires_bake.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,10 @@
*
* The Original Code is Copyright (C) 2012 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Morten Mikkelsen,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/source/multires_bake.c
- * \ingroup render
+/** \file
+ * \ingroup render
*/
#include <string.h>
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index f3f4ec364c7..bd8d390b23b 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/source/pipeline.c
- * \ingroup render
+/** \file
+ * \ingroup render
*/
#include <math.h>
@@ -56,7 +48,6 @@
#include "BLI_timecode.h"
#include "BLI_fileops.h"
#include "BLI_threads.h"
-#include "BLI_rand.h"
#include "BLI_callbacks.h"
#include "BLT_translation.h"
@@ -70,6 +61,7 @@
#include "BKE_layer.h"
#include "BKE_library.h"
#include "BKE_library_remap.h"
+#include "BKE_mask.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_object.h"
@@ -132,7 +124,6 @@
*
* 5) Image Files
* - save file or append in movie
- *
*/
@@ -938,38 +929,31 @@ void render_update_anim_renderdata(Render *re, RenderData *rd, ListBase *render_
BLI_duplicatelist(&re->r.views, &rd->views);
}
-void RE_SetWindow(Render *re, const rctf *viewplane, float clipsta, float clipend)
+void RE_SetWindow(Render *re, const rctf *viewplane, float clip_start, float clip_end)
{
/* re->ok flag? */
re->viewplane = *viewplane;
- re->clipsta = clipsta;
- re->clipend = clipend;
+ re->clip_start = clip_start;
+ re->clip_end = clip_end;
perspective_m4(re->winmat,
re->viewplane.xmin, re->viewplane.xmax,
- re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend);
+ re->viewplane.ymin, re->viewplane.ymax, re->clip_start, re->clip_end);
}
-void RE_SetOrtho(Render *re, const rctf *viewplane, float clipsta, float clipend)
+void RE_SetOrtho(Render *re, const rctf *viewplane, float clip_start, float clip_end)
{
/* re->ok flag? */
re->viewplane = *viewplane;
- re->clipsta = clipsta;
- re->clipend = clipend;
+ re->clip_start = clip_start;
+ re->clip_end = clip_end;
orthographic_m4(re->winmat,
re->viewplane.xmin, re->viewplane.xmax,
- re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend);
-}
-
-void RE_SetView(Render *re, float mat[4][4])
-{
- /* re->ok flag? */
- copy_m4_m4(re->viewmat, mat);
- invert_m4_m4(re->viewinv, re->viewmat);
+ re->viewplane.ymin, re->viewplane.ymax, re->clip_start, re->clip_end);
}
void RE_GetViewPlane(Render *re, rctf *r_viewplane, rcti *r_disprect)
@@ -985,11 +969,6 @@ void RE_GetViewPlane(Render *re, rctf *r_viewplane, rcti *r_disprect)
}
}
-void RE_GetView(Render *re, float mat[4][4])
-{
- copy_m4_m4(mat, re->viewmat);
-}
-
/* image and movie output has to move to either imbuf or kernel */
void RE_display_init_cb(Render *re, void *handle, void (*f)(void *handle, RenderResult *rr))
{
@@ -1132,6 +1111,7 @@ static void render_result_uncrop(Render *re)
render_result_disprect_to_full_resolution(re);
rres = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
+ rres->stamp_data = BKE_stamp_data_copy(re->result->stamp_data);
render_result_clone_passes(re, rres, NULL);
@@ -1246,7 +1226,7 @@ bool RE_allow_render_generic_object(Object *ob)
if (ob->transflag & OB_DUPLIPARTS) {
/* pass */ /* 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) {
return false;
}
return true;
@@ -1260,20 +1240,22 @@ static void ntree_render_scenes(Render *re)
if (re->scene->nodetree == NULL) return;
- /* now foreach render-result node tagged we do a full render */
- /* results are stored in a way compisitor will find it */
+ /* now foreach render-result node we do a full render */
+ /* results are stored in a way compositor will find it */
+ GSet *scenes_rendered = BLI_gset_ptr_new(__func__);
for (node = re->scene->nodetree->nodes.first; node; node = node->next) {
if (node->type == CMP_NODE_R_LAYERS && (node->flag & NODE_MUTED) == 0) {
if (node->id && node->id != (ID *)re->scene) {
Scene *scene = (Scene *)node->id;
-
- if (render_scene_has_layers_to_render(scene, false)) {
+ if (!BLI_gset_haskey(scenes_rendered, scene) && render_scene_has_layers_to_render(scene, false)) {
render_scene(re, scene, cfra);
+ BLI_gset_add(scenes_rendered, scene);
nodeUpdate(restore_scene->nodetree, node);
}
}
}
}
+ BLI_gset_free(scenes_rendered, NULL);
}
/* bad call... need to think over proper method still */
@@ -1334,19 +1316,21 @@ static void add_freestyle(Render *re, int render)
/* releases temporary scenes and renders for Freestyle stroke rendering */
static void free_all_freestyle_renders(void)
{
- Render *re1, *freestyle_render;
- Scene *freestyle_scene;
+ Render *re1;
LinkData *link;
for (re1= RenderGlobal.renderlist.first; re1; re1= re1->next) {
for (link = (LinkData *)re1->freestyle_renders.first; link; link = link->next) {
- freestyle_render = (Render *)link->data;
+ Render *freestyle_render = (Render *)link->data;
if (freestyle_render) {
- freestyle_scene = freestyle_render->scene;
+ Scene *freestyle_scene = freestyle_render->scene;
RE_FreeRender(freestyle_render);
- BKE_libblock_unlink(re1->freestyle_bmain, freestyle_scene, false, false);
- BKE_libblock_free(re1->freestyle_bmain, freestyle_scene);
+
+ if (freestyle_scene) {
+ BKE_libblock_unlink(re1->freestyle_bmain, freestyle_scene, false, false);
+ BKE_id_free(re1->freestyle_bmain, freestyle_scene);
+ }
}
}
BLI_freelistN(&re1->freestyle_renders);
@@ -1628,6 +1612,9 @@ static void do_render_all_options(Render *re)
* work with copy-on-write. */
BKE_animsys_evaluate_all_animation(re->main, NULL, re->scene, (float)cfra);
+ /* Update for masks (these do not use animsys but own lighter weight structure to define animation). */
+ BKE_mask_evaluate_all_masks(re->main, (float)cfra, true);
+
if (RE_engine_render(re, 1)) {
/* in this case external render overrides all */
}
@@ -2049,28 +2036,6 @@ void RE_RenderFreestyleExternal(Render *re)
for (rv = re->result->views.first; rv; rv = rv->next) {
RE_SetActiveRenderView(re, rv->name);
-
- /* scene needs to be set to get camera */
- Object *camera = RE_GetCamera(re);
-
- /* if no camera, viewmat should have been set! */
- if (camera) {
- /* called before but need to call again in case of lens animation from the
- * above call to BKE_scene_graph_update_for_newframe, fixes bug. [#22702].
- * following calls don't depend on 'RE_SetCamera' */
- float mat[4][4];
-
- RE_SetCamera(re, camera);
- RE_GetCameraModelMatrix(re, camera, mat);
- invert_m4(mat);
- RE_SetView(re, mat);
-
- /* force correct matrix for scaled cameras */
- DEG_id_tag_update_ex(re->main, &camera->id, ID_RECALC_TRANSFORM);
- }
-
- printf("add freestyle\n");
-
add_freestyle(re, 1);
}
}
@@ -2124,6 +2089,8 @@ bool RE_WriteRenderViewsImage(ReportList *reports, RenderResult *rr, Scene *scen
ImBuf *ibuf = render_result_rect_to_ibuf(rr, rd, view_id);
ibuf->planes = 24;
+ IMB_colormanagement_imbuf_for_write(ibuf, true, false, &scene->view_settings,
+ &scene->display_settings, &imf);
ok = render_imbuf_write_stamp_test(reports, scene, rr, ibuf, name, &imf, stamp);
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index f51c472da8f..06d51fb161d 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributors: Matt Ebb
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/source/pointdensity.c
- * \ingroup render
+/** \file
+ * \ingroup render
*/
@@ -52,7 +46,6 @@
#include "BKE_colorband.h"
#include "BKE_deform.h"
#include "BKE_lattice.h"
-#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_scene.h"
@@ -370,18 +363,21 @@ static void pointdensity_cache_object(PointDensity *pd,
{
float *data_color;
int i;
- CustomDataMask mask = CD_MASK_BAREMESH | CD_MASK_MTFACE | CD_MASK_MCOL;
MVert *mvert = NULL, *mv;
Mesh *mesh = ob->data;
+#if 0 /* UNUSED */
+ CustomData_MeshMasks mask = CD_MASK_BAREMESH;
+ mask.fmask |= CD_MASK_MTFACE | CD_MASK_MCOL;
switch (pd->ob_color_source) {
case TEX_PD_COLOR_VERTCOL:
- mask |= CD_MASK_MLOOPCOL;
+ mask.lmask |= CD_MASK_MLOOPCOL;
break;
case TEX_PD_COLOR_VERTWEIGHT:
- mask |= CD_MASK_MDEFORMVERT;
+ mask.vmask |= CD_MASK_MDEFORMVERT;
break;
}
+#endif
mvert = mesh->mvert; /* local object space */
pd->totpoints = mesh->totvert;
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index 7efe0a5da60..6e0eaa68b82 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2006 Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/source/render_result.c
- * \ingroup render
+/** \file
+ * \ingroup render
*/
#include <stdio.h>
@@ -57,6 +49,8 @@
#include "intern/openexr/openexr_multi.h"
+#include "RE_engine.h"
+
#include "render_result.h"
#include "render_types.h"
@@ -482,6 +476,7 @@ void render_result_add_pass(RenderResult *rr, const char *name, int channels, co
for (rp = rl->passes.first; rp; rp = rp->next) {
if (!STREQ(rp->name, name)) continue;
if (!STREQ(rp->view, view)) continue;
+ break;
}
if (!rp) {
@@ -1063,15 +1058,56 @@ void render_result_save_empty_result_tiles(Render *re)
}
}
+/* Compute list of passes needed by render engine. */
+static void templates_register_pass_cb(void *userdata, Scene *UNUSED(scene), ViewLayer *UNUSED(view_layer),
+ const char *name, int channels, const char *chan_id, int UNUSED(type))
+{
+ ListBase *templates = userdata;
+ RenderPass *pass = MEM_callocN(sizeof(RenderPass), "RenderPassTemplate");
+
+ pass->channels = channels;
+ BLI_strncpy(pass->name, name, sizeof(pass->name));
+ BLI_strncpy(pass->chan_id, chan_id, sizeof(pass->chan_id));
+
+ BLI_addtail(templates, pass);
+}
+
+static void render_result_get_pass_templates(RenderEngine *engine, Render *re, RenderLayer *rl, ListBase *templates)
+{
+ BLI_listbase_clear(templates);
+
+ if (engine && engine->type->update_render_passes) {
+ ViewLayer *view_layer = BLI_findstring(&re->view_layers, rl->name, offsetof(ViewLayer, name));
+ if (view_layer) {
+ RE_engine_update_render_passes(engine, re->scene, view_layer, templates_register_pass_cb, templates);
+ }
+ }
+}
+
/* begin write of exr tile file */
-void render_result_exr_file_begin(Render *re)
+void render_result_exr_file_begin(Render *re, RenderEngine *engine)
{
- RenderResult *rr;
- RenderLayer *rl;
char str[FILE_MAX];
- for (rr = re->result; rr; rr = rr->next) {
- for (rl = rr->layers.first; rl; rl = rl->next) {
+ for (RenderResult *rr = re->result; rr; rr = rr->next) {
+ for (RenderLayer *rl = rr->layers.first; rl; rl = rl->next) {
+ /* Get passes needed by engine. Normally we would wait for the
+ * engine to create them, but for EXR file we need to know in
+ * advance. */
+ ListBase templates;
+ render_result_get_pass_templates(engine, re, rl, &templates);
+
+ /* Create render passes requested by engine. Only this part is
+ * mutex locked to avoid deadlock with Python GIL. */
+ BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
+ for (RenderPass *pass = templates.first; pass; pass = pass->next) {
+ render_result_add_pass(re->result, pass->name, pass->channels, pass->chan_id, rl->name, NULL);
+ }
+ BLI_rw_mutex_unlock(&re->resultmutex);
+
+ BLI_freelistN(&templates);
+
+ /* Open EXR file for writing. */
render_result_exr_file_path(re->scene, rl->name, rr->sample_nr, str);
printf("write exr tmp file, %dx%d, %s\n", rr->rectx, rr->recty, str);
IMB_exrtile_begin_write(rl->exrhandle, str, 0, rr->rectx, rr->recty, re->partx, re->party);
@@ -1080,13 +1116,11 @@ void render_result_exr_file_begin(Render *re)
}
/* end write of exr tile file, read back first sample */
-void render_result_exr_file_end(Render *re)
+void render_result_exr_file_end(Render *re, RenderEngine *engine)
{
- RenderResult *rr;
- RenderLayer *rl;
-
- for (rr = re->result; rr; rr = rr->next) {
- for (rl = rr->layers.first; rl; rl = rl->next) {
+ /* Close EXR files. */
+ for (RenderResult *rr = re->result; rr; rr = rr->next) {
+ for (RenderLayer *rl = rr->layers.first; rl; rl = rl->next) {
IMB_exr_close(rl->exrhandle);
rl->exrhandle = NULL;
}
@@ -1094,10 +1128,36 @@ void render_result_exr_file_end(Render *re)
rr->do_exr_tile = false;
}
+ /* Create new render result in memory instead of on disk. */
+ BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
render_result_free_list(&re->fullresult, re->result);
- re->result = NULL;
+ re->result = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
+ BLI_rw_mutex_unlock(&re->resultmutex);
+
+ for (RenderLayer *rl = re->result->layers.first; rl; rl = rl->next) {
+ /* Get passes needed by engine. */
+ ListBase templates;
+ render_result_get_pass_templates(engine, re, rl, &templates);
+
+ /* Create render passes requested by engine. Only this part is
+ * mutex locked to avoid deadlock with Python GIL. */
+ BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
+ for (RenderPass *pass = templates.first; pass; pass = pass->next) {
+ render_result_add_pass(re->result, pass->name, pass->channels, pass->chan_id, rl->name, NULL);
+ }
+
+ BLI_freelistN(&templates);
- render_result_exr_file_read_sample(re, 0);
+ /* Render passes contents from file. */
+ char str[FILE_MAXFILE + MAX_ID_NAME + MAX_ID_NAME + 100] = "";
+ render_result_exr_file_path(re->scene, rl->name, 0, str);
+ printf("read exr tmp file: %s\n", str);
+
+ if (!render_result_exr_file_read_path(re->result, rl, str)) {
+ printf("cannot read: %s\n", str);
+ }
+ BLI_rw_mutex_unlock(&re->resultmutex);
+ }
}
/* save part into exr file */
@@ -1126,29 +1186,6 @@ void render_result_exr_file_path(Scene *scene, const char *layname, int sample,
BLI_make_file_string("/", filepath, BKE_tempdir_session(), name);
}
-/* only for temp buffer, makes exact copy of render result */
-int render_result_exr_file_read_sample(Render *re, int sample)
-{
- RenderLayer *rl;
- char str[FILE_MAXFILE + MAX_ID_NAME + MAX_ID_NAME + 100] = "";
- bool success = true;
-
- RE_FreeRenderResult(re->result);
- re->result = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
-
- for (rl = re->result->layers.first; rl; rl = rl->next) {
- render_result_exr_file_path(re->scene, rl->name, sample, str);
- printf("read exr tmp file: %s\n", str);
-
- if (!render_result_exr_file_read_path(re->result, rl, str)) {
- printf("cannot read: %s\n", str);
- success = false;
- }
- }
-
- return success;
-}
-
/* called for reading temp files, and for external engines */
int render_result_exr_file_read_path(RenderResult *rr, RenderLayer *rl_single, const char *filepath)
{
@@ -1491,6 +1528,6 @@ RenderResult *RE_DuplicateRenderResult(RenderResult *rr)
if (new_rr->rectz != NULL) {
new_rr->rectz = MEM_dupallocN(new_rr->rectz);
}
- new_rr->stamp_data = MEM_dupallocN(new_rr->stamp_data);
+ new_rr->stamp_data = BKE_stamp_data_copy(new_rr->stamp_data);
return new_rr;
}
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index b41e2d7fae4..4e38f8d569a 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): 2004-2006, Blender Foundation, full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/source/render_texture.c
- * \ingroup render
+/** \file
+ * \ingroup render
*/
@@ -41,7 +35,7 @@
#include "DNA_anim_types.h"
#include "DNA_texture_types.h"
#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
+#include "DNA_light_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_material_types.h"
#include "DNA_image_types.h"
@@ -55,8 +49,6 @@
#include "BKE_animsys.h"
#include "BKE_colorband.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_scene.h"
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 436ee590f5c..51104714a99 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributors: Hos, RPW
- * 2004-2006 Blender Foundation, full recode
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/render/intern/source/zbuf.c
- * \ingroup render
+/** \file
+ * \ingroup render
*/
diff --git a/source/blender/shader_fx/CMakeLists.txt b/source/blender/shader_fx/CMakeLists.txt
index 1807635aa8d..ddd21449d40 100644
--- a/source/blender/shader_fx/CMakeLists.txt
+++ b/source/blender/shader_fx/CMakeLists.txt
@@ -42,7 +42,6 @@ set(INC_SYS
set(SRC
intern/FX_shader_util.h
- intern/FX_shader_util.c
intern/FX_shader_blur.c
intern/FX_shader_colorize.c
intern/FX_shader_flip.c
@@ -52,6 +51,7 @@ set(SRC
intern/FX_shader_rim.c
intern/FX_shader_shadow.c
intern/FX_shader_swirl.c
+ intern/FX_shader_util.c
intern/FX_shader_wave.c
FX_shader_types.h
diff --git a/source/blender/shader_fx/FX_shader_types.h b/source/blender/shader_fx/FX_shader_types.h
index 311f5ec52e8..d46bee8f45e 100644
--- a/source/blender/shader_fx/FX_shader_types.h
+++ b/source/blender/shader_fx/FX_shader_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Ben Batt
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file FX_shader_types.h
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#ifndef __FX_SHADER_TYPES_H__
diff --git a/source/blender/shader_fx/intern/FX_shader_blur.c b/source/blender/shader_fx/intern/FX_shader_blur.c
index 128ebba8875..8f994255aa1 100644
--- a/source/blender/shader_fx/intern/FX_shader_blur.c
+++ b/source/blender/shader_fx/intern/FX_shader_blur.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/shader_fx/intern/FX_shader_blur.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#include <stdio.h>
diff --git a/source/blender/shader_fx/intern/FX_shader_colorize.c b/source/blender/shader_fx/intern/FX_shader_colorize.c
index edf276b842c..3faea305140 100644
--- a/source/blender/shader_fx/intern/FX_shader_colorize.c
+++ b/source/blender/shader_fx/intern/FX_shader_colorize.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/shader_fx/intern/FX_shader_colorize.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#include <stdio.h>
diff --git a/source/blender/shader_fx/intern/FX_shader_flip.c b/source/blender/shader_fx/intern/FX_shader_flip.c
index 404e2f8160e..ff420d86b58 100644
--- a/source/blender/shader_fx/intern/FX_shader_flip.c
+++ b/source/blender/shader_fx/intern/FX_shader_flip.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/shader_fx/intern/FX_shader_flip.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#include <stdio.h>
@@ -34,7 +27,6 @@
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
-#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "FX_shader_types.h"
diff --git a/source/blender/shader_fx/intern/FX_shader_glow.c b/source/blender/shader_fx/intern/FX_shader_glow.c
index cd513ed1f0a..8b47d3eba26 100644
--- a/source/blender/shader_fx/intern/FX_shader_glow.c
+++ b/source/blender/shader_fx/intern/FX_shader_glow.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/shader_fx/intern/FX_shader_glow.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#include <stdio.h>
@@ -34,10 +27,8 @@
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
-#include "BLI_math_base.h"
#include "BLI_utildefines.h"
-#include "BKE_library_query.h"
#include "BKE_modifier.h"
#include "BKE_shader_fx.h"
diff --git a/source/blender/shader_fx/intern/FX_shader_light.c b/source/blender/shader_fx/intern/FX_shader_light.c
index 86715e1a1a7..d4c726a63db 100644
--- a/source/blender/shader_fx/intern/FX_shader_light.c
+++ b/source/blender/shader_fx/intern/FX_shader_light.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/shader_fx/intern/FX_shader_light.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#include <stdio.h>
@@ -34,7 +27,6 @@
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
-#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "BKE_library_query.h"
diff --git a/source/blender/shader_fx/intern/FX_shader_pixel.c b/source/blender/shader_fx/intern/FX_shader_pixel.c
index 8c5c38d6aa7..62efb7a0dd5 100644
--- a/source/blender/shader_fx/intern/FX_shader_pixel.c
+++ b/source/blender/shader_fx/intern/FX_shader_pixel.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/shader_fx/intern/FX_shader_pixel.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#include <stdio.h>
diff --git a/source/blender/shader_fx/intern/FX_shader_rim.c b/source/blender/shader_fx/intern/FX_shader_rim.c
index f3bec9a9571..d4e6d618e35 100644
--- a/source/blender/shader_fx/intern/FX_shader_rim.c
+++ b/source/blender/shader_fx/intern/FX_shader_rim.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/shader_fx/intern/FX_shader_rim.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#include <stdio.h>
diff --git a/source/blender/shader_fx/intern/FX_shader_shadow.c b/source/blender/shader_fx/intern/FX_shader_shadow.c
index aa8808f268b..5c99b245954 100644
--- a/source/blender/shader_fx/intern/FX_shader_shadow.c
+++ b/source/blender/shader_fx/intern/FX_shader_shadow.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/shader_fx/intern/FX_shader_shadow.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#include <stdio.h>
@@ -34,7 +27,6 @@
#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
-#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "BKE_library_query.h"
diff --git a/source/blender/shader_fx/intern/FX_shader_swirl.c b/source/blender/shader_fx/intern/FX_shader_swirl.c
index 40fa20e62d5..033f307318d 100644
--- a/source/blender/shader_fx/intern/FX_shader_swirl.c
+++ b/source/blender/shader_fx/intern/FX_shader_swirl.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/shader_fx/intern/FX_shader_swirl.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#include <stdio.h>
diff --git a/source/blender/shader_fx/intern/FX_shader_util.c b/source/blender/shader_fx/intern/FX_shader_util.c
index b74ff45b991..e34acadced7 100644
--- a/source/blender/shader_fx/intern/FX_shader_util.c
+++ b/source/blender/shader_fx/intern/FX_shader_util.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/shader_fx/intern/FX_shader_util.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
@@ -32,7 +26,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BKE_shader_fx.h"
diff --git a/source/blender/shader_fx/intern/FX_shader_util.h b/source/blender/shader_fx/intern/FX_shader_util.h
index e2fdcd6fb4c..11cc7a3ce9a 100644
--- a/source/blender/shader_fx/intern/FX_shader_util.h
+++ b/source/blender/shader_fx/intern/FX_shader_util.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) Blender Foundation.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/shader_fx/intern/FX_shader_util.h
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
diff --git a/source/blender/shader_fx/intern/FX_shader_wave.c b/source/blender/shader_fx/intern/FX_shader_wave.c
index ea4563a00e1..5b427331429 100644
--- a/source/blender/shader_fx/intern/FX_shader_wave.c
+++ b/source/blender/shader_fx/intern/FX_shader_wave.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2018, Blender Foundation
* This is a new part of Blender
- *
- * Contributor(s): Antonio Vazquez
- *
- * ***** END GPL LICENSE BLOCK *****
- *
*/
-/** \file blender/shader_fx/intern/FX_shader_wave.c
- * \ingroup shader_fx
+/** \file
+ * \ingroup shader_fx
*/
#include <stdio.h>
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 173e32ea0bb..10f79691924 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
set(INC
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index adf082982b7..38fb27d2538 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,12 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __WM_API_H__
#define __WM_API_H__
-/** \file blender/windowmanager/WM_api.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \page wmpage windowmanager
* \section wmabout About windowmanager
@@ -46,41 +39,43 @@
extern "C" {
#endif
-struct bContext;
-struct bToolRef_Runtime;
+struct ARegion;
struct GHashIterator;
+struct GPUViewport;
struct IDProperty;
+struct ImBuf;
+struct ImageFormatData;
+struct Main;
+struct MenuType;
+struct PointerRNA;
+struct PropertyRNA;
+struct ScrArea;
+struct ViewLayer;
+struct bContext;
+struct bToolRef_Runtime;
+struct rcti;
+struct wmDrag;
+struct wmDropBox;
struct wmEvent;
struct wmEventHandler;
+struct wmEventHandler_Keymap;
+struct wmEventHandler_UI;
struct wmGesture;
struct wmJob;
struct wmMsgSubscribeKey;
struct wmMsgSubscribeValue;
-struct wmOperatorType;
struct wmOperator;
+struct wmOperatorType;
struct wmPaintCursor;
-struct rcti;
-struct PointerRNA;
-struct PropertyRNA;
-struct MenuType;
-struct wmDropBox;
-struct wmDrag;
-struct ImBuf;
-struct ImageFormatData;
-struct ARegion;
-struct ScrArea;
-struct Main;
-struct ViewLayer;
-struct GPUViewport;
#ifdef WITH_INPUT_NDOF
struct wmNDOFMotionData;
#endif
-typedef struct wmJob wmJob;
typedef struct wmGizmo wmGizmo;
typedef struct wmGizmoMap wmGizmoMap;
typedef struct wmGizmoMapType wmGizmoMapType;
+typedef struct wmJob wmJob;
/* general API */
void WM_init_state_app_template_set(const char *app_template);
@@ -89,8 +84,11 @@ const char *WM_init_state_app_template_get(void);
void WM_init_state_size_set (int stax, int stay, int sizx, int sizy);
void WM_init_state_fullscreen_set(void);
void WM_init_state_normal_set(void);
+void WM_init_state_maximized_set(void);
+void WM_init_state_start_with_console_set(bool value);
void WM_init_window_focus_set(bool do_it);
void WM_init_native_pixels(bool do_it);
+void WM_init_tablet_api(void);
void WM_init (struct bContext *C, int argc, const char **argv);
void WM_exit_ext (struct bContext *C, const bool do_python);
@@ -104,6 +102,7 @@ void WM_init_splash (struct bContext *C);
void WM_init_opengl (struct Main *bmain);
void WM_check (struct bContext *C);
+void WM_reinit_gizmomap_all(struct Main *bmain);
int WM_window_pixels_x(const struct wmWindow *win);
int WM_window_pixels_y(const struct wmWindow *win);
@@ -192,23 +191,34 @@ int WM_userdef_event_type_from_keymap_type(int kmitype);
/* handlers */
-struct wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap);
- /* boundbox, optional subwindow boundbox for offset */
-struct wmEventHandler *WM_event_add_keymap_handler_bb(ListBase *handlers, wmKeyMap *keymap, const rcti *bb, const rcti *swinbb);
- /* priority not implemented, it adds in begin */
-struct wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int priority);
+struct wmEventHandler_Keymap *WM_event_add_keymap_handler(
+ ListBase *handlers, wmKeyMap *keymap);
+/* boundbox, optional subwindow boundbox for offset */
+struct wmEventHandler_Keymap *WM_event_add_keymap_handler_bb(
+ ListBase *handlers, wmKeyMap *keymap, const rcti *bb, const rcti *swinbb);
+/* priority not implemented, it adds in begin */
+struct wmEventHandler_Keymap *WM_event_add_keymap_handler_priority(
+ ListBase *handlers, wmKeyMap *keymap, int priority);
+
+typedef struct wmKeyMap *(wmEventHandler_KeymapDynamicFn)(wmWindowManager *wm, struct wmEventHandler_Keymap *handler) ATTR_WARN_UNUSED_RESULT;
+
+struct wmKeyMap *WM_event_get_keymap_from_toolsystem(struct wmWindowManager *wm, struct wmEventHandler_Keymap *handler);
-void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap);
+struct wmEventHandler_Keymap *WM_event_add_keymap_handler_dynamic(
+ ListBase *handlers, wmEventHandler_KeymapDynamicFn *keymap_fn, void *user_data);
-void WM_event_set_keymap_handler_callback(
- struct wmEventHandler *handler,
+void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap);
+
+void WM_event_set_keymap_handler_post_callback(
+ struct wmEventHandler_Keymap *handler,
void (keymap_tag)(wmKeyMap *keymap, wmKeyMapItem *kmi, void *user_data),
void *user_data);
+wmKeyMap *WM_event_get_keymap_from_handler(wmWindowManager *wm, struct wmEventHandler_Keymap *handler);
typedef int (*wmUIHandlerFunc)(struct bContext *C, const struct wmEvent *event, void *userdata);
typedef void (*wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata);
-struct wmEventHandler *WM_event_add_ui_handler(
+struct wmEventHandler_UI *WM_event_add_ui_handler(
const struct bContext *C, ListBase *handlers,
wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
void *userdata, const char flag);
@@ -222,7 +232,7 @@ void WM_event_free_ui_handler_all(
struct bContext *C, ListBase *handlers,
wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove);
-struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op);
+struct wmEventHandler_Op *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op);
void WM_event_modal_handler_area_replace(wmWindow *win, const struct ScrArea *old_area, struct ScrArea *new_area);
void WM_event_modal_handler_region_replace(wmWindow *win, const struct ARegion *old_region, struct ARegion *new_region);
@@ -237,7 +247,8 @@ enum {
WM_HANDLER_DO_FREE = (1 << 7), /* handler tagged to be freed in wm_handlers_do() */
};
-struct wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes);
+struct wmEventHandler_Dropbox *WM_event_add_dropbox_handler(
+ ListBase *handlers, ListBase *dropboxes);
/* mouse */
void WM_event_add_mousemove(const struct bContext *C);
@@ -321,6 +332,7 @@ int WM_operator_call_ex(struct bContext *C, struct wmOperator *op, const
int WM_operator_call (struct bContext *C, struct wmOperator *op);
int WM_operator_call_notest(struct bContext *C, struct wmOperator *op);
int WM_operator_repeat (struct bContext *C, struct wmOperator *op);
+int WM_operator_repeat_interactive(struct bContext *C, struct wmOperator *op);
bool WM_operator_repeat_check(const struct bContext *C, struct wmOperator *op);
bool WM_operator_is_repeat(const struct bContext *C, const struct wmOperator *op);
int WM_operator_name_call_ptr(struct bContext *C, struct wmOperatorType *ot, short context, struct PointerRNA *properties);
@@ -360,13 +372,9 @@ void WM_operator_properties_gesture_box_ex(struct wmOperatorType *ot, boo
void WM_operator_properties_gesture_box(struct wmOperatorType *ot);
void WM_operator_properties_gesture_box_select(struct wmOperatorType *ot);
void WM_operator_properties_gesture_box_zoom(struct wmOperatorType *ot);
-void WM_operator_properties_gesture_lasso_ex(struct wmOperatorType *ot, bool deselect, bool extend);
void WM_operator_properties_gesture_lasso(struct wmOperatorType *ot);
-void WM_operator_properties_gesture_lasso_select(struct wmOperatorType *ot);
void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor);
-void WM_operator_properties_gesture_circle_ex(struct wmOperatorType *ot, bool deselect);
void WM_operator_properties_gesture_circle(struct wmOperatorType *ot);
-void WM_operator_properties_gesture_circle_select(struct wmOperatorType *ot);
void WM_operator_properties_mouse_select(struct wmOperatorType *ot);
void WM_operator_properties_select_all(struct wmOperatorType *ot);
void WM_operator_properties_select_action(struct wmOperatorType *ot, int default_action);
@@ -472,6 +480,7 @@ void WM_gesture_straightline_cancel(struct bContext *C, struct wmOperator *op);
struct wmGesture *WM_gesture_new(struct bContext *C, const struct wmEvent *event, int type);
void WM_gesture_end(struct bContext *C, struct wmGesture *gesture);
void WM_gestures_remove(struct bContext *C);
+bool WM_gesture_is_modal_first(const struct wmGesture *gesture);
/* fileselecting support */
void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op);
@@ -514,7 +523,7 @@ enum {
WM_JOB_PRIORITY = (1 << 0),
WM_JOB_EXCL_RENDER = (1 << 1),
WM_JOB_PROGRESS = (1 << 2),
- WM_JOB_SUSPEND = (1 << 3)
+ WM_JOB_SUSPEND = (1 << 3),
};
/* identifying jobs by owner alone is unreliable, this isnt saved, order can change (keep 0 for 'any') */
@@ -621,6 +630,9 @@ bool WM_event_is_tablet(const struct wmEvent *event);
bool WM_event_is_ime_switch(const struct wmEvent *event);
#endif
+/* For testing only 'G_FLAG_EVENT_SIMULATE' */
+struct wmEvent *WM_event_add_simulate(struct wmWindow *win, const struct wmEvent *event_to_add);
+
const char *WM_window_cursor_keymap_status_get(const struct wmWindow *win, int button_index, int type_index);
void WM_window_cursor_keymap_status_refresh(struct bContext *C, struct wmWindow *win);
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index 8f31685e453..9d5c42e748e 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,17 +15,13 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __WM_KEYMAP_H__
#define __WM_KEYMAP_H__
-/** \file blender/windowmanager/WM_keymap.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
/* dna-savable wmStructs here */
@@ -152,6 +146,10 @@ char *WM_key_event_operator_string(
struct IDProperty *properties, const bool is_strict,
char *result, const int result_len);
+wmKeyMapItem *WM_key_event_operator_from_keymap(
+ struct wmKeyMap *keymap, const char *opname, struct IDProperty *properties,
+ const short include_mask, const short exclude_mask);
+
const char *WM_bool_as_string(bool test);
#ifdef __cplusplus
diff --git a/source/blender/windowmanager/WM_message.h b/source/blender/windowmanager/WM_message.h
index 48197ae99cd..1527d514e9b 100644
--- a/source/blender/windowmanager/WM_message.h
+++ b/source/blender/windowmanager/WM_message.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/WM_message.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#ifndef __WM_MESSAGE_H__
diff --git a/source/blender/windowmanager/WM_toolsystem.h b/source/blender/windowmanager/WM_toolsystem.h
index 4318179c203..7f9b17dbe17 100644
--- a/source/blender/windowmanager/WM_toolsystem.h
+++ b/source/blender/windowmanager/WM_toolsystem.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __WM_TOOLSYSTEM_H__
#define __WM_TOOLSYSTEM_H__
-/** \file blender/windowmanager/WM_toolsystem.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
/* dna-savable wmStructs here */
@@ -31,17 +27,17 @@
extern "C" {
#endif
-struct bContext;
-struct bToolRef_Runtime;
struct IDProperty;
-struct wmMsgSubscribeKey;
-struct wmMsgSubscribeValue;
-struct wmOperatorType;
+struct Main;
struct PointerRNA;
struct ScrArea;
-struct Main;
struct StructRNA;
struct WorkSpace;
+struct bContext;
+struct bToolRef_Runtime;
+struct wmMsgSubscribeKey;
+struct wmMsgSubscribeValue;
+struct wmOperatorType;
/* wm_toolsystem.c */
@@ -103,8 +99,15 @@ void WM_toolsystem_ref_properties_ensure_ex(
#define WM_toolsystem_ref_properties_ensure_from_operator(tref, ot, r_ptr) \
WM_toolsystem_ref_properties_ensure_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
-#define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, ot, r_ptr) \
- WM_toolsystem_ref_properties_ensure_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
+#define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup, r_ptr) \
+ WM_toolsystem_ref_properties_ensure_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr)
+
+bool WM_toolsystem_ref_properties_get_ex(
+ struct bToolRef *tref, const char *idname, struct StructRNA *type, struct PointerRNA *r_ptr);
+#define WM_toolsystem_ref_properties_get_from_operator(tref, ot, r_ptr) \
+ WM_toolsystem_ref_properties_get_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
+#define WM_toolsystem_ref_properties_get_from_gizmo_group(tref, gzgroup, r_ptr) \
+ WM_toolsystem_ref_properties_get_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr)
void WM_toolsystem_ref_properties_init_for_keymap(
struct bToolRef *tref, struct PointerRNA *dst_ptr, struct PointerRNA *src_ptr, struct wmOperatorType *ot);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 0036ae7834d..0f799448561 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/WM_types.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#ifndef __WM_TYPES_H__
@@ -106,13 +99,13 @@
extern "C" {
#endif
+struct ID;
+struct ImBuf;
struct bContext;
struct wmEvent;
-struct wmWindowManager;
struct wmMsgBus;
struct wmOperator;
-struct ID;
-struct ImBuf;
+struct wmWindowManager;
#include "RNA_types.h"
#include "DNA_listBase.h"
@@ -165,7 +158,7 @@ enum {
WM_OP_EXEC_REGION_CHANNELS,
WM_OP_EXEC_REGION_PREVIEW,
WM_OP_EXEC_AREA,
- WM_OP_EXEC_SCREEN
+ WM_OP_EXEC_SCREEN,
};
/* property tags for RNA_OperatorProperties */
@@ -253,7 +246,7 @@ typedef struct wmNotifier {
#define NC_GEOM (16<<24)
#define NC_NODE (17<<24)
#define NC_ID (18<<24)
-#define NC_LOGIC (19<<24)
+#define NC_PAINTCURVE (19<<24)
#define NC_MOVIECLIP (20<<24)
#define NC_MASK (21<<24)
#define NC_GPENCIL (22<<24)
@@ -327,7 +320,7 @@ typedef struct wmNotifier {
#define ND_SHADING_LINKS (32<<16)
#define ND_SHADING_PREVIEW (33<<16)
- /* NC_LAMP Lamp */
+ /* NC_LAMP Light */
#define ND_LIGHTING (40<<16)
#define ND_LIGHTING_DRAW (41<<16)
#define ND_SKY (42<<16)
@@ -434,6 +427,8 @@ typedef struct wmGesture {
/* For modal operators which may be running idle, waiting for an event to activate the gesture.
* Typically this is set when the user is click-dragging the gesture (border and circle select for eg). */
uint is_active : 1;
+ /* Previous value of is-active (use to detect first run & edge cases). */
+ uint is_active_prev : 1;
/* Use for gestures that support both immediate or delayed activation. */
uint wait_for_input : 1;
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
index 4ceb78be227..b48f58cda7f 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/WM_gizmo_api.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \name Gizmo API
* \brief API for external use of wmGizmo types.
@@ -41,16 +35,16 @@ struct GHashIterator;
struct IDProperty;
struct Main;
struct PropertyRNA;
-struct wmKeyConfig;
struct wmGizmo;
-struct wmGizmoProperty;
-struct wmGizmoPropertyType;
-struct wmGizmoType;
struct wmGizmoGroup;
struct wmGizmoGroupType;
struct wmGizmoMap;
struct wmGizmoMapType;
struct wmGizmoMapType_Params;
+struct wmGizmoProperty;
+struct wmGizmoPropertyType;
+struct wmGizmoType;
+struct wmKeyConfig;
struct wmMsgSubscribeKey;
struct wmMsgSubscribeValue;
@@ -83,6 +77,8 @@ struct wmGizmoOpElem *WM_gizmo_operator_get(
struct PointerRNA *WM_gizmo_operator_set(
struct wmGizmo *gz, int part_index,
struct wmOperatorType *ot, struct IDProperty *properties);
+int WM_gizmo_operator_invoke(
+ struct bContext *C, struct wmGizmo *gz, struct wmGizmoOpElem *gzop);
/* callbacks */
void WM_gizmo_set_fn_custom_modal(struct wmGizmo *gz, wmGizmoFnModal fn);
@@ -238,6 +234,9 @@ struct wmKeyMap *WM_gizmogroup_keymap_common(
struct wmKeyMap *WM_gizmogroup_keymap_common_select(
const struct wmGizmoGroupType *gzgt, struct wmKeyConfig *config);
+void WM_gizmogroup_ensure_init(
+ const struct bContext *C, struct wmGizmoGroup *gzgroup);
+
/* Sort utilities for use with 'BLI_listbase_sort'. */
int WM_gizmo_cmp_temp_fl(const void *gz_a_ptr, const void *gz_b_ptr);
int WM_gizmo_cmp_temp_fl_reverse(const void *gz_a_ptr, const void *gz_b_ptr);
@@ -247,6 +246,7 @@ int WM_gizmo_cmp_temp_fl_reverse(const void *gz_a_ptr, const void *gz_b_ptr);
struct wmGizmoMap *WM_gizmomap_new_from_type(
const struct wmGizmoMapType_Params *gzmap_params);
+void WM_gizmomap_reinit(struct wmGizmoMap *gzmap);
const struct ListBase *WM_gizmomap_group_list(struct wmGizmoMap *gzmap);
struct wmGizmoGroup *WM_gizmomap_group_find(
struct wmGizmoMap *gzmap,
@@ -297,6 +297,9 @@ void WM_gizmomaptype_group_init_runtime_keymap(
void WM_gizmomaptype_group_init_runtime(
const struct Main *bmain, struct wmGizmoMapType *gzmap_type,
struct wmGizmoGroupType *gzgt);
+wmGizmoGroup *WM_gizmomaptype_group_init_runtime_with_region(
+ struct wmGizmoMapType *gzmap_type,
+ struct wmGizmoGroupType *gzgt, struct ARegion *ar);
void WM_gizmomaptype_group_unlink(
struct bContext *C, struct Main *bmain, struct wmGizmoMapType *gzmap_type,
const struct wmGizmoGroupType *gzgt);
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
index c92172dff15..2322d5fc448 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/WM_gizmo_types.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \name Gizmo Types
* \brief Gizmo defines for external use.
@@ -38,10 +32,10 @@
#include "BLI_compiler_attrs.h"
-struct wmGizmoMapType;
-struct wmGizmoGroupType;
-struct wmGizmoGroup;
struct wmGizmo;
+struct wmGizmoGroup;
+struct wmGizmoGroupType;
+struct wmGizmoMapType;
struct wmGizmoProperty;
struct wmKeyConfig;
@@ -56,8 +50,10 @@ struct wmKeyConfig;
* #wmGizmo.state
*/
typedef enum eWM_GizmoFlagState {
- WM_GIZMO_STATE_HIGHLIGHT = (1 << 0), /* while hovered */
- WM_GIZMO_STATE_MODAL = (1 << 1), /* while dragging */
+ /** While hovered. */
+ WM_GIZMO_STATE_HIGHLIGHT = (1 << 0),
+ /** While dragging. */
+ WM_GIZMO_STATE_MODAL = (1 << 1),
WM_GIZMO_STATE_SELECT = (1 << 2),
} eWM_GizmoFlagState;
@@ -67,9 +63,12 @@ typedef enum eWM_GizmoFlagState {
* Flags for individual gizmos.
*/
typedef enum eWM_GizmoFlag {
- WM_GIZMO_DRAW_HOVER = (1 << 0), /* draw *only* while hovering */
- WM_GIZMO_DRAW_MODAL = (1 << 1), /* draw while dragging */
- WM_GIZMO_DRAW_VALUE = (1 << 2), /* draw an indicator for the current value while dragging */
+ /** Draw *only* while hovering. */
+ WM_GIZMO_DRAW_HOVER = (1 << 0),
+ /** Draw while dragging. */
+ WM_GIZMO_DRAW_MODAL = (1 << 1),
+ /** Draw an indicator for the current value while dragging. */
+ WM_GIZMO_DRAW_VALUE = (1 << 2),
WM_GIZMO_HIDDEN = (1 << 3),
WM_GIZMO_HIDDEN_SELECT = (1 << 4),
/**
@@ -87,6 +86,9 @@ typedef enum eWM_GizmoFlag {
WM_GIZMO_MOVE_CURSOR = (1 << 7),
/** Don't write into the depth buffer when selecting. */
WM_GIZMO_SELECT_BACKGROUND = (1 << 8),
+
+ /** Use the active tools operator properties when running as an operator. */
+ WM_GIZMO_OPERATOR_TOOL_INIT = (1 << 9),
} eWM_GizmoFlag;
/**
@@ -101,7 +103,7 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
WM_GIZMOGROUPTYPE_SCALE = (1 << 1),
/** Gizmos can be depth culled with scene objects (covered by other geometry - TODO) */
WM_GIZMOGROUPTYPE_DEPTH_3D = (1 << 2),
- /** Gizmos can be selected */
+ /** Gizmos can be selected. */
WM_GIZMOGROUPTYPE_SELECT = (1 << 3),
/** The gizmo group is to be kept (not removed on loading a new file for eg). */
WM_GIZMOGROUPTYPE_PERSISTENT = (1 << 4),
@@ -116,7 +118,7 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
* The main issue is controlling how a gizmo is activated with a tool
* when a tool can activate multiple operators based on the key-map.
* We could even move the options into the key-map item.
- * ~ campbell */
+ * ~ campbell. */
WM_GIZMOGROUPTYPE_TOOL_INIT = (1 << 6),
} eWM_GizmoFlagGroupTypeFlag;
@@ -125,7 +127,7 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
* #wmGizmoGroup.init_flag
*/
typedef enum eWM_GizmoFlagGroupInitFlag {
- /* mgroup has been initialized */
+ /** Gizmo-group has been initialized. */
WM_GIZMOGROUP_INIT_SETUP = (1 << 0),
WM_GIZMOGROUP_INIT_REFRESH = (1 << 1),
} eWM_GizmoFlagGroupInitFlag;
@@ -135,11 +137,11 @@ typedef enum eWM_GizmoFlagGroupInitFlag {
* Gizmo-map type update flag
*/
typedef enum eWM_GizmoFlagMapTypeUpdateFlag {
- /* A new type has been added, needs to be initialized for all views. */
+ /** A new type has been added, needs to be initialized for all views. */
WM_GIZMOMAPTYPE_UPDATE_INIT = (1 << 0),
WM_GIZMOMAPTYPE_UPDATE_REMOVE = (1 << 1),
- /* Needed because keymap may be registered before and after window initialization.
+ /** Needed because keymap may be registered before and after window initialization.
* So we need to keep track of keymap initialization separately. */
WM_GIZMOMAPTYPE_KEYMAP_INIT = (1 << 2),
} eWM_GizmoFlagMapTypeUpdateFlag;
@@ -164,8 +166,8 @@ typedef enum {
typedef struct wmGizmoOpElem {
struct wmOperatorType *type;
- /* operator properties if gizmo spawns and controls an operator,
- * or owner pointer if gizmo spawns and controls a property */
+ /** Operator properties if gizmo spawns and controls an operator,
+ * or owner pointer if gizmo spawns and controls a property. */
PointerRNA ptr;
bool is_redo;
@@ -175,33 +177,34 @@ typedef struct wmGizmoOpElem {
struct wmGizmo {
struct wmGizmo *next, *prev;
- /* While we don't have a real type, use this to put type-like vars. */
+ /** While we don't have a real type, use this to put type-like vars. */
const struct wmGizmoType *type;
- /* Overrides 'type->modal' when set.
+ /** Overrides 'type->modal' when set.
* Note that this is a workaround, remove if we can. */
wmGizmoFnModal custom_modal;
- /* pointer back to group this gizmo is in (just for quick access) */
+ /** Pointer back to group this gizmo is in (just for quick access). */
struct wmGizmoGroup *parent_gzgroup;
void *py_instance;
- /* rna pointer to access properties */
+ /** Rna pointer to access properties. */
struct PointerRNA *ptr;
- /* flags that influence the behavior or how the gizmos are drawn */
+ /** Flags that influence the behavior or how the gizmos are drawn. */
eWM_GizmoFlag flag;
- /* state flags (active, highlighted, selected) */
+ /** State flags (active, highlighted, selected) */
eWM_GizmoFlagState state;
- /* Optional ID for highlighting different parts of this gizmo.
+ /** Optional ID for highlighting different parts of this gizmo.
* -1 when unset, otherwise a valid index. (Used as index to 'op_data'). */
int highlight_part;
- /* For single click button gizmos, use a different part as a fallback, -1 when unused. */
+ /** For single click button gizmos, use a different part as a fallback, -1 when unused. */
int drag_part;
- /* Transformation of the gizmo in 2d or 3d space.
+ /**
+ * Transformation of the gizmo in 2d or 3d space.
* - Matrix axis are expected to be unit length (scale is applied after).
* - Behavior when axis aren't orthogonal depends on each gizmo.
* - Typically the +Z is the primary axis for gizmos to use.
@@ -210,32 +213,32 @@ struct wmGizmo {
* rotation components are used for drawing and interaction.
*/
- /* The space this gizmo is being modified in. */
+ /** The space this gizmo is being modified in. */
float matrix_space[4][4];
- /* Transformation of this gizmo. */
+ /** Transformation of this gizmo. */
float matrix_basis[4][4];
- /* custom offset from origin */
+ /** Custom offset from origin. */
float matrix_offset[4][4];
- /* runtime property, set the scale while drawing on the viewport */
+ /** Runtime property, set the scale while drawing on the viewport. */
float scale_final;
- /* user defined scale, in addition to the original one */
+ /** User defined scale, in addition to the original one. */
float scale_basis;
- /* user defined width for line drawing */
+ /** User defined width for line drawing. */
float line_width;
- /* gizmo colors (uses default fallbacks if not defined) */
+ /** Gizmo colors (uses default fallbacks if not defined). */
float color[4], color_hi[4];
- /* data used during interaction */
+ /** Data used during interaction. */
void *interaction_data;
- /* Operator to spawn when activating the gizmo (overrides property editing),
+ /** Operator to spawn when activating the gizmo (overrides property editing),
* an array of items (aligned with #wmGizmo.highlight_part). */
wmGizmoOpElem *op_data;
int op_data_len;
struct IDProperty *properties;
- /* Temporary data (assume dirty). */
+ /** Temporary data (assume dirty). */
union {
float f;
} temp;
@@ -243,7 +246,7 @@ struct wmGizmo {
/* over alloc target_properties after 'wmGizmoType.struct_size' */
};
-/* Similar to PropertyElemRNA, but has an identifier. */
+/** Similar to #PropertyElemRNA, but has an identifier. */
typedef struct wmGizmoProperty {
const struct wmGizmoPropertyType *type;
@@ -264,14 +267,14 @@ typedef struct wmGizmoProperty {
typedef struct wmGizmoPropertyType {
struct wmGizmoPropertyType *next, *prev;
- /* PropertyType, typically 'PROP_FLOAT' */
+ /** #PropertyType, typically #PROP_FLOAT. */
int data_type;
int array_length;
/* index within 'wmGizmoType' */
int index_in_type;
- /* over alloc */
+ /** over alloc. */
char idname[0];
} wmGizmoPropertyType;
@@ -292,30 +295,30 @@ typedef struct wmGizmoType {
const char *idname; /* MAX_NAME */
- /* Set to 'sizeof(wmGizmo)' or larger for instances of this type,
+ /** Set to 'sizeof(wmGizmo)' or larger for instances of this type,
* use so we can cant to other types without the hassle of a custom-data pointer. */
uint struct_size;
- /* Initialize struct (calloc'd 'struct_size' region). */
+ /** Initialize struct (calloc'd 'struct_size' region). */
wmGizmoFnSetup setup;
- /* draw gizmo */
+ /** Draw gizmo. */
wmGizmoFnDraw draw;
- /* determines 3d intersection by rendering the gizmo in a selection routine. */
+ /** Determines 3d intersection by rendering the gizmo in a selection routine. */
wmGizmoFnDrawSelect draw_select;
- /* Determine if the mouse intersects with the gizmo.
+ /** Determine if the mouse intersects with the gizmo.
* The calculation should be done in the callback itself, -1 for no seleciton. */
wmGizmoFnTestSelect test_select;
- /* handler used by the gizmo. Usually handles interaction tied to a gizmo type */
+ /** Handler used by the gizmo. Usually handles interaction tied to a gizmo type. */
wmGizmoFnModal modal;
- /* gizmo-specific handler to update gizmo attributes based on the property value */
+ /** Gizmo-specific handler to update gizmo attributes based on the property value. */
wmGizmoFnPropertyUpdate property_update;
- /* Returns the final transformation which may be different from the 'matrix',
+ /** Returns the final transformation which may be different from the 'matrix',
* depending on the gizmo.
* Notes:
* - Scale isn't applied (wmGizmo.scale/user_scale).
@@ -323,24 +326,24 @@ typedef struct wmGizmoType {
*/
wmGizmoFnMatrixBasisGet matrix_basis_get;
- /* activate a gizmo state when the user clicks on it */
+ /** Activate a gizmo state when the user clicks on it. */
wmGizmoFnInvoke invoke;
- /* called when gizmo tweaking is done - used to free data and reset property when cancelling */
+ /** Called when gizmo tweaking is done - used to free data and reset property when cancelling. */
wmGizmoFnExit exit;
wmGizmoFnCursorGet cursor_get;
- /* called when gizmo selection state changes */
+ /** Called when gizmo selection state changes. */
wmGizmoFnSelectRefresh select_refresh;
- /* Free data (not the gizmo it's self), use when the gizmo allocates it's own members. */
+ /** Free data (not the gizmo it's self), use when the gizmo allocates it's own members. */
wmGizmoFnFree free;
- /* RNA for properties */
+ /** RNA for properties. */
struct StructRNA *srna;
- /* RNA integration */
+ /** RNA integration. */
ExtensionRNA ext;
ListBase target_property_defs;
@@ -352,7 +355,7 @@ typedef struct wmGizmoType {
/* -------------------------------------------------------------------- */
/* wmGizmoGroup */
-/* factory class for a gizmo-group type, gets called every time a new area is spawned */
+/** Factory class for a gizmo-group type, gets called every time a new area is spawned. */
typedef struct wmGizmoGroupTypeRef {
struct wmGizmoGroupTypeRef *next, *prev;
struct wmGizmoGroupType *type;
@@ -361,49 +364,50 @@ typedef struct wmGizmoGroupTypeRef {
/* factory class for a gizmo-group type, gets called every time a new area is spawned */
typedef struct wmGizmoGroupType {
const char *idname; /* MAX_NAME */
- const char *name; /* gizmo-group name - displayed in UI (keymap editor) */
+ /** Gizmo-group name - displayed in UI (keymap editor). */
+ const char *name;
char owner_id[64]; /* MAX_NAME */
- /* poll if gizmo-map should be visible */
+ /** Poll if gizmo-map should be visible. */
wmGizmoGroupFnPoll poll;
- /* initially create gizmos and set permanent data - stuff you only need to do once */
+ /** Initially create gizmos and set permanent data - stuff you only need to do once. */
wmGizmoGroupFnInit setup;
- /* refresh data, only called if recreate flag is set (WM_gizmomap_tag_refresh) */
+ /** Refresh data, only called if recreate flag is set (WM_gizmomap_tag_refresh). */
wmGizmoGroupFnRefresh refresh;
- /* refresh data for drawing, called before each redraw */
+ /** Refresh data for drawing, called before each redraw. */
wmGizmoGroupFnDrawPrepare draw_prepare;
- /* Initialize data for before invoke. */
+ /** Initialize data for before invoke. */
wmGizmoGroupFnInvokePrepare invoke_prepare;
- /* Keymap init callback for this gizmo-group (optional),
+ /** Keymap init callback for this gizmo-group (optional),
* will fall back to default tweak keymap when left NULL. */
wmGizmoGroupFnSetupKeymap setup_keymap;
- /* Optionally subscribe to wmMsgBus events,
+ /** Optionally subscribe to wmMsgBus events,
* these are calculated automatically from RNA properties,
* only needed if gizmos depend indirectly on properties. */
wmGizmoGroupFnMsgBusSubscribe message_subscribe;
- /* keymap created with callback from above */
+ /** Keymap created with callback from above. */
struct wmKeyMap *keymap;
- /* Only for convenient removal. */
+ /** Only for convenient removal. */
struct wmKeyConfig *keyconf;
/* Note: currently gizmo-group instances don't store properties,
* they're kept in the tool properties. */
- /* RNA for properties */
+ /** RNA for properties. */
struct StructRNA *srna;
- /* RNA integration */
+ /** RNA integration. */
ExtensionRNA ext;
eWM_GizmoFlagGroupTypeFlag flag;
- /* So we know which group type to update. */
+ /** So we know which group type to update. */
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag;
- /* same as gizmo-maps, so registering/unregistering goes to the correct region */
+ /** Same as gizmo-maps, so registering/unregistering goes to the correct region. */
struct wmGizmoMapType_Params gzmap_params;
} wmGizmoGroupType;
@@ -416,11 +420,14 @@ typedef struct wmGizmoGroup {
struct wmGizmoMap *parent_gzmap;
- void *py_instance; /* python stores the class instance here */
- struct ReportList *reports; /* errors and warnings storage */
+ /** Python stores the class instance here. */
+ void *py_instance;
+ /** Errors and warnings storage. */
+ struct ReportList *reports;
void *customdata;
- void (*customdata_free)(void *); /* for freeing customdata from above */
+ /** For freeing customdata from above. */
+ void (*customdata_free)(void *);
eWM_GizmoFlagGroupInitFlag init_flag;
} wmGizmoGroup;
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
index 0bef33a8855..7346fa31300 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,22 +15,16 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/intern/wm_gizmo.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
-#include "BLI_string.h"
-#include "BLI_string_utils.h"
#include "BKE_context.h"
@@ -48,6 +40,7 @@
#include "BKE_idprop.h"
#include "WM_api.h"
+#include "WM_toolsystem.h"
#include "WM_types.h"
#include "ED_screen.h"
@@ -271,6 +264,23 @@ PointerRNA *WM_gizmo_operator_set(
return &gzop->ptr;
}
+int WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop)
+{
+ if (gz->flag & WM_GIZMO_OPERATOR_TOOL_INIT) {
+ /* Merge toolsettings into the gizmo properties. */
+ PointerRNA tref_ptr;
+ bToolRef *tref = WM_toolsystem_ref_from_context(C);
+ if (tref && WM_toolsystem_ref_properties_get_from_operator(tref, gzop->type, &tref_ptr)) {
+ if (gzop->ptr.data == NULL) {
+ IDPropertyTemplate val = {0};
+ gzop->ptr.data = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
+ }
+ IDP_MergeGroup(gzop->ptr.data, tref_ptr.data, false);
+ }
+ }
+ return WM_operator_name_call_ptr(C, gzop->type, WM_OP_INVOKE_DEFAULT, &gzop->ptr);
+}
+
static void wm_gizmo_set_matrix_rotation_from_z_axis__internal(
float matrix[4][4], const float z_axis[3])
{
@@ -391,7 +401,6 @@ void WM_gizmo_set_fn_custom_modal(struct wmGizmo *gz, wmGizmoFnModal fn)
/* -------------------------------------------------------------------- */
-
/**
* Add/Remove \a gizmo to selection.
* Reallocates memory for selected gizmos so better not call for selecting multiple ones.
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 67b7149c0bd..e1eb735f074 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/intern/wm_gizmo_group.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \name Gizmo-Group
*
@@ -197,7 +191,7 @@ void wm_gizmogroup_intersectable_gizmos_to_list(const wmGizmoGroup *gzgroup, Lis
}
}
-void wm_gizmogroup_ensure_initialized(wmGizmoGroup *gzgroup, const bContext *C)
+void WM_gizmogroup_ensure_init(const bContext *C, wmGizmoGroup *gzgroup)
{
/* prepare for first draw */
if (UNLIKELY((gzgroup->init_flag & WM_GIZMOGROUP_INIT_SETUP) == 0)) {
@@ -404,7 +398,7 @@ static bool gizmo_tweak_start_and_finish(
gz->parent_gzgroup->type->invoke_prepare(C, gz->parent_gzgroup, gz);
}
/* Allow for 'button' gizmos, single click to run an action. */
- WM_operator_name_call_ptr(C, gzop->type, WM_OP_INVOKE_DEFAULT, &gzop->ptr);
+ WM_gizmo_operator_invoke(C, gz, gzop);
}
return true;
}
@@ -635,7 +629,7 @@ static wmKeyMap *gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf, const char
{TWEAK_MODAL_PRECISION_OFF, "PRECISION_OFF", 0, "Disable Precision", ""},
{TWEAK_MODAL_SNAP_ON, "SNAP_ON", 0, "Enable Snap", ""},
{TWEAK_MODAL_SNAP_OFF, "SNAP_OFF", 0, "Disable Snap", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -792,19 +786,20 @@ void WM_gizmomaptype_group_init_runtime(
const Main *bmain, wmGizmoMapType *gzmap_type,
wmGizmoGroupType *gzgt)
{
+ /* Tools add themselves. */
+ if (gzgt->flag & WM_GIZMOGROUPTYPE_TOOL_INIT) {
+ return;
+ }
+
/* now create a gizmo for all existing areas */
- for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
for (ARegion *ar = lb->first; ar; ar = ar->next) {
wmGizmoMap *gzmap = ar->gizmo_map;
if (gzmap && gzmap->type == gzmap_type) {
- wm_gizmogroup_new_from_type(gzmap, gzgt);
-
- /* just add here, drawing will occur on next update */
- wm_gizmomap_highlight_set(gzmap, NULL, NULL, 0);
- ED_region_tag_redraw(ar);
+ WM_gizmomaptype_group_init_runtime_with_region(gzmap_type, gzgt, ar);
}
}
}
@@ -812,6 +807,22 @@ void WM_gizmomaptype_group_init_runtime(
}
}
+wmGizmoGroup *WM_gizmomaptype_group_init_runtime_with_region(
+ wmGizmoMapType *gzmap_type,
+ wmGizmoGroupType *gzgt, ARegion *ar)
+{
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ BLI_assert(gzmap && gzmap->type == gzmap_type);
+ UNUSED_VARS_NDEBUG(gzmap_type);
+
+ wmGizmoGroup *gzgroup = wm_gizmogroup_new_from_type(gzmap, gzgt);
+
+ wm_gizmomap_highlight_set(gzmap, NULL, NULL, 0);
+
+ ED_region_tag_redraw(ar);
+
+ return gzgroup;
+}
/**
* Unlike #WM_gizmomaptype_group_unlink this doesn't maintain correct state, simply free.
@@ -826,7 +837,7 @@ void WM_gizmomaptype_group_unlink(
const wmGizmoGroupType *gzgt)
{
/* Free instances. */
- for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
index 655d38a5206..60377353182 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
-#include "BLI_string.h"
-#include "BLI_string_utils.h"
#include "BKE_context.h"
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
index a580a063aaf..6263bfaf58d 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,24 +12,20 @@
* 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): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#ifndef __WM_GIZMO_INTERN_H__
#define __WM_GIZMO_INTERN_H__
-struct wmKeyConfig;
-struct wmGizmoMap;
-struct GizmoGeomInfo;
struct GHashIterator;
+struct GizmoGeomInfo;
+struct wmGizmoMap;
+struct wmKeyConfig;
#include "wm_gizmo_fn.h"
@@ -74,7 +68,6 @@ struct wmGizmo *wm_gizmogroup_find_intersected_gizmo(
int *r_part);
void wm_gizmogroup_intersectable_gizmos_to_list(
const struct wmGizmoGroup *gzgroup, struct ListBase *listbase);
-void wm_gizmogroup_ensure_initialized(struct wmGizmoGroup *gzgroup, const struct bContext *C);
bool wm_gizmogroup_is_visible_in_drawstep(
const struct wmGizmoGroup *gzgroup, const eWM_GizmoFlagMapDrawStep drawstep);
@@ -98,6 +91,9 @@ struct wmGizmoMap {
/* private, update tagging (enum defined in C source). */
char update_flag[WM_GIZMOMAP_DRAWSTEP_MAX];
+ /** Private, true when not yet used. */
+ bool is_init;
+
/**
* \brief Gizmo map runtime context
*
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index 48e5ac5a072..194bd2b5449 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/intern/wm_gizmo_map.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#include <string.h>
@@ -32,11 +26,11 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_rect.h"
-#include "BLI_string.h"
#include "BLI_ghash.h"
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
@@ -163,17 +157,12 @@ void wm_gizmomap_select_array_remove(wmGizmoMap *gzmap, wmGizmo *gz)
*
* \{ */
-/**
- * Creates a gizmo-map with all registered gizmos for that type
- */
-wmGizmoMap *WM_gizmomap_new_from_type(
- const struct wmGizmoMapType_Params *gzmap_params)
+static wmGizmoMap *wm_gizmomap_new_from_type_ex(
+ struct wmGizmoMapType *gzmap_type,
+ wmGizmoMap *gzmap)
{
- wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(gzmap_params);
- wmGizmoMap *gzmap;
-
- gzmap = MEM_callocN(sizeof(wmGizmoMap), "GizmoMap");
gzmap->type = gzmap_type;
+ gzmap->is_init = true;
WM_gizmomap_tag_refresh(gzmap);
/* create all gizmo-groups for this gizmo-map. We may create an empty one
@@ -185,7 +174,19 @@ wmGizmoMap *WM_gizmomap_new_from_type(
return gzmap;
}
-void wm_gizmomap_remove(wmGizmoMap *gzmap)
+/**
+ * Creates a gizmo-map with all registered gizmos for that type
+ */
+wmGizmoMap *WM_gizmomap_new_from_type(
+ const struct wmGizmoMapType_Params *gzmap_params)
+{
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(gzmap_params);
+ wmGizmoMap *gzmap = MEM_callocN(sizeof(wmGizmoMap), "GizmoMap");
+ wm_gizmomap_new_from_type_ex(gzmap_type, gzmap);
+ return gzmap;
+}
+
+static void wm_gizmomap_free_data(wmGizmoMap *gzmap)
{
/* Clear first so further calls don't waste time trying to maintain correct array state. */
wm_gizmomap_select_array_clear(gzmap);
@@ -196,10 +197,22 @@ void wm_gizmomap_remove(wmGizmoMap *gzmap)
wm_gizmogroup_free(NULL, gzgroup);
}
BLI_assert(BLI_listbase_is_empty(&gzmap->groups));
+}
+void wm_gizmomap_remove(wmGizmoMap *gzmap)
+{
+ wm_gizmomap_free_data(gzmap);
MEM_freeN(gzmap);
}
+/** Re-create the gizmos (use when changing theme settings). */
+void WM_gizmomap_reinit(wmGizmoMap *gzmap)
+{
+ wmGizmoMapType *gzmap_type = gzmap->type;
+ wm_gizmomap_free_data(gzmap);
+ memset(gzmap, 0x0, sizeof(*gzmap));
+ wm_gizmomap_new_from_type_ex(gzmap_type, gzmap);
+}
wmGizmoGroup *WM_gizmomap_group_find(
struct wmGizmoMap *gzmap,
@@ -333,6 +346,9 @@ static void gizmomap_prepare_drawing(
{
if (!gzmap || BLI_listbase_is_empty(&gzmap->groups))
return;
+
+ gzmap->is_init = false;
+
wmGizmo *gz_modal = gzmap->gzmap_context.modal;
/* only active gizmo needs updating */
@@ -363,7 +379,7 @@ static void gizmomap_prepare_drawing(
gzgroup->init_flag &= ~WM_GIZMOGROUP_INIT_REFRESH;
}
/* Calls `setup`, `setup_keymap` and `refresh` if they're defined. */
- wm_gizmogroup_ensure_initialized(gzgroup, C);
+ WM_gizmogroup_ensure_init(C, gzgroup);
/* prepare drawing */
if (gzgroup->type->draw_prepare) {
@@ -520,22 +536,18 @@ static int gizmo_find_intersected_3d_intern(
/* Almost certainly overkill, but allow for many custom gizmos. */
GLuint buffer[MAXPICKBUF];
short hits;
- const bool do_passes = GPU_select_query_check_active();
BLI_rcti_init_pt_radius(&rect, co, hotspot);
ED_view3d_draw_setup_view(CTX_wm_window(C), CTX_data_depsgraph(C), CTX_data_scene(C), ar, v3d, NULL, NULL, &rect);
- if (do_passes)
- GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0);
- else
- GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_ALL, 0);
+ GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0);
/* do the drawing */
gizmo_draw_select_3D_loop(C, visible_gizmos, gz_stop);
hits = GPU_select_end();
- if (do_passes && (hits > 0)) {
+ if (hits > 0) {
GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits);
gizmo_draw_select_3D_loop(C, visible_gizmos, gz_stop);
GPU_select_end();
@@ -684,37 +696,38 @@ wmGizmo *wm_gizmomap_highlight_find(
void WM_gizmomap_add_handlers(ARegion *ar, wmGizmoMap *gzmap)
{
- wmEventHandler *handler;
-
- for (handler = ar->handlers.first; handler; handler = handler->next) {
- if (handler->gizmo_map == gzmap) {
- return;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, &ar->handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_GIZMO) {
+ wmEventHandler_Gizmo *handler = (wmEventHandler_Gizmo *)handler_base;
+ if (handler->gizmo_map == gzmap) {
+ return;
+ }
}
}
- handler = MEM_callocN(sizeof(wmEventHandler), "gizmo handler");
-
+ wmEventHandler_Gizmo *handler = MEM_callocN(sizeof(*handler), __func__);
+ handler->head.type = WM_HANDLER_TYPE_GIZMO;
BLI_assert(gzmap == ar->gizmo_map);
handler->gizmo_map = gzmap;
BLI_addtail(&ar->handlers, handler);
}
void wm_gizmomaps_handled_modal_update(
- bContext *C, wmEvent *event, wmEventHandler *handler)
+ bContext *C, wmEvent *event, wmEventHandler_Op *handler)
{
const bool modal_running = (handler->op != NULL);
/* happens on render or when joining areas */
- if (!handler->op_region || !handler->op_region->gizmo_map) {
+ if (!handler->context.region || !handler->context.region->gizmo_map) {
return;
}
- wmGizmoMap *gzmap = handler->op_region->gizmo_map;
+ wmGizmoMap *gzmap = handler->context.region->gizmo_map;
wmGizmo *gz = wm_gizmomap_modal_get(gzmap);
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
- wm_gizmomap_handler_context(C, handler);
+ wm_gizmomap_handler_context_op(C, handler);
/* regular update for running operator */
if (modal_running) {
@@ -840,40 +853,41 @@ bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *gzmap, const int action)
* Prepare context for gizmo handling (but only if area/region is
* part of screen). Version of #wm_handler_op_context for gizmos.
*/
-void wm_gizmomap_handler_context(bContext *C, wmEventHandler *handler)
+void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler)
{
bScreen *screen = CTX_wm_screen(C);
if (screen) {
- if (handler->op_area == NULL) {
- /* do nothing in this context */
+ ScrArea *sa;
+
+ for (sa = screen->areabase.first; sa; sa = sa->next) {
+ if (sa == handler->context.area) {
+ break;
+ }
+ }
+ if (sa == NULL) {
+ /* when changing screen layouts with running modal handlers (like render display), this
+ * is not an error to print */
+ printf("internal error: modal gizmo-map handler has invalid area\n");
}
else {
- ScrArea *sa;
-
- for (sa = screen->areabase.first; sa; sa = sa->next)
- if (sa == handler->op_area)
+ ARegion *ar;
+ CTX_wm_area_set(C, sa);
+ for (ar = sa->regionbase.first; ar; ar = ar->next)
+ if (ar == handler->context.region)
break;
- if (sa == NULL) {
- /* when changing screen layouts with running modal handlers (like render display), this
- * is not an error to print */
- if (handler->gizmo_map == NULL)
- printf("internal error: modal gizmo-map handler has invalid area\n");
- }
- else {
- ARegion *ar;
- CTX_wm_area_set(C, sa);
- 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)
- CTX_wm_region_set(C, ar);
- }
+ /* XXX no warning print here, after full-area and back regions are remade */
+ if (ar)
+ CTX_wm_region_set(C, ar);
}
}
}
+void wm_gizmomap_handler_context_gizmo(bContext *UNUSED(C), wmEventHandler_Gizmo *UNUSED(handler))
+{
+ /* pass */
+}
+
bool WM_gizmomap_cursor_set(const wmGizmoMap *gzmap, wmWindow *win)
{
wmGizmo *gz = gzmap->gzmap_context.highlight;
@@ -975,7 +989,7 @@ void wm_gizmomap_modal_set(
struct wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, gz->highlight_part);
if (gzop && gzop->type) {
- const int retval = WM_operator_name_call_ptr(C, gzop->type, WM_OP_INVOKE_DEFAULT, &gzop->ptr);
+ const int retval = WM_gizmo_operator_invoke(C, gz, gzop);
if ((retval & OPERATOR_RUNNING_MODAL) == 0) {
wm_gizmomap_modal_set(gzmap, C, gz, event, false);
}
@@ -1242,3 +1256,29 @@ void WM_gizmoconfig_update(struct Main *bmain)
}
/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Recreate All Gizmos
+ *
+ * Use when adjusting themes.
+ *
+ * \{ */
+
+void WM_reinit_gizmomap_all(Main *bmain)
+{
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+ for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ if ((gzmap != NULL) && (gzmap->is_init == false)) {
+ WM_gizmomap_reinit(gzmap);
+ }
+ }
+ }
+ }
+ }
+}
+
+/** \} */
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c
index 12f9b529c15..d3c07a02440 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,18 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#include "BLI_listbase.h"
#include "BLI_math.h"
-#include "BLI_string.h"
-#include "BLI_string_utils.h"
#include "BKE_context.h"
@@ -47,7 +41,6 @@
#include "wm_gizmo_intern.h"
/* -------------------------------------------------------------------- */
-
/** \name Property Definition
* \{ */
@@ -167,7 +160,6 @@ void WM_gizmo_target_property_clear_rna(
/* -------------------------------------------------------------------- */
-
/** \name Property Access
* \{ */
@@ -284,7 +276,6 @@ int WM_gizmo_target_property_array_length(
/* -------------------------------------------------------------------- */
-
/** \name Property Define
* \{ */
@@ -314,7 +305,6 @@ void WM_gizmotype_target_property_def(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Property Utilities
* \{ */
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
index 2ff0148044c..b164d4c549f 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,19 +12,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/intern/wm_gizmo_type.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
-#include "BLI_string_utils.h"
#include "BKE_context.h"
#include "BKE_main.h"
@@ -142,7 +136,7 @@ static void gizmotype_unlink(
bContext *C, Main *bmain, wmGizmoType *gzt)
{
/* Free instances. */
- for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h
index 3361932c6e3..e23c3d77b7f 100644
--- a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h
+++ b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/wm_gizmo_fn.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Callback function definitions, needed for both Types & API headers.
*/
diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h b/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h
index 414109e89e5..c7a6b816dd6 100644
--- a/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h
+++ b/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/gizmo/wm_gizmo_wmapi.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* \name Gizmos Window Manager API
* API for usage in window manager code only. It should contain all functionality
@@ -39,9 +33,11 @@
#define __WM_GIZMO_WMAPI_H__
struct wmEventHandler;
+struct wmEventHandler_Gizmo;
+struct wmEventHandler_Op;
struct wmGizmoMap;
-struct wmOperatorType;
struct wmOperator;
+struct wmOperatorType;
/* -------------------------------------------------------------------- */
@@ -71,8 +67,9 @@ void wm_gizmomap_remove(struct wmGizmoMap *gzmap);
void wm_gizmos_keymap(struct wmKeyConfig *keyconf);
void wm_gizmomaps_handled_modal_update(
- bContext *C, struct wmEvent *event, struct wmEventHandler *handler);
-void wm_gizmomap_handler_context(bContext *C, struct wmEventHandler *handler);
+ bContext *C, struct wmEvent *event, struct wmEventHandler_Op *handler);
+void wm_gizmomap_handler_context_op(bContext *C, struct wmEventHandler_Op *handler);
+void wm_gizmomap_handler_context_gizmo(bContext *C, struct wmEventHandler_Gizmo *handler);
struct wmGizmo *wm_gizmomap_highlight_find(
struct wmGizmoMap *gzmap, bContext *C, const struct wmEvent *event,
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 80deca46a24..2c6dcd56471 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Internal functions for managing UI registrable types (operator, UI and menu types)
*
@@ -43,7 +36,6 @@
#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
-#include "BLI_ghash.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -51,7 +43,6 @@
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
-#include "BKE_screen.h"
#include "BKE_workspace.h"
#include "WM_api.h"
@@ -206,17 +197,17 @@ void WM_operator_handlers_clear(wmWindowManager *wm, wmOperatorType *ot)
wmWindow *win;
for (win = wm->windows.first; win; win = win->next) {
ListBase *lb[2] = {&win->handlers, &win->modalhandlers};
- wmEventHandler *handler;
- int i;
-
- for (i = 0; i < 2; i++) {
- for (handler = lb[i]->first; handler; handler = handler->next) {
- if (handler->op && handler->op->type == ot) {
- /* don't run op->cancel because it needs the context,
- * assume whoever unregisters the operator will cleanup */
- handler->flag |= WM_HANDLER_DO_FREE;
- WM_operator_free(handler->op);
- handler->op = NULL;
+ for (int i = 0; i < ARRAY_SIZE(lb); i++) {
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, lb[i]) {
+ if (handler_base->type == WM_HANDLER_TYPE_OP) {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+ if (handler->op && handler->op->type == ot) {
+ /* don't run op->cancel because it needs the context,
+ * assume whoever unregisters the operator will cleanup */
+ handler->head.flag |= WM_HANDLER_DO_FREE;
+ WM_operator_free(handler->op);
+ handler->op = NULL;
+ }
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index b411d9a4957..de293373870 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2005-2007 Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Matt Ebb
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_cursors.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Cursor pixmap and cursor utility functions to change the cursor.
*/
@@ -306,7 +298,7 @@ void WM_cursor_time(wmWindow *win, int nr)
{0, 56, 4, 4, 60, 68, 68, 56},
{0, 124, 64, 32, 16, 8, 8, 8},
{0, 60, 66, 66, 60, 66, 66, 60},
- {0, 56, 68, 68, 120, 64, 68, 56}
+ {0, 56, 68, 68, 120, 64, 68, 56},
};
unsigned char mask[16][2];
unsigned char bitmap[16][2] = {{0}};
@@ -405,7 +397,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_NW_ARROWCURSOR] = &NWArrowCursor;
@@ -417,14 +409,14 @@ BEGIN_CURSOR_BLOCK
0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0x08, 0x08,
0x04, 0x10, 0x3c, 0x1e, 0x20, 0x02, 0x20, 0x02,
0x20, 0x02, 0x20, 0x02, 0x3c, 0x1e, 0x04, 0x10,
- 0x08, 0x08, 0x10, 0x04, 0x20, 0x02, 0x40, 0x01
+ 0x08, 0x08, 0x10, 0x04, 0x20, 0x02, 0x40, 0x01,
};
static char ns_smsk[] = {
0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f,
0xfc, 0x1f, 0xfc, 0x1f, 0xe0, 0x03, 0xe0, 0x03,
0xe0, 0x03, 0xe0, 0x03, 0xfc, 0x1f, 0xfc, 0x1f,
- 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01
+ 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01,
};
static BCursor NSArrowCursor = {
@@ -437,7 +429,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_NS_ARROWCURSOR] = &NSArrowCursor;
@@ -469,7 +461,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_EW_ARROWCURSOR] = &EWArrowCursor;
@@ -539,7 +531,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_WAITCURSOR] = &WaitCursor;
@@ -608,7 +600,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_CROSSCURSOR] = &CrossCursor;
@@ -640,7 +632,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_EDITCROSSCURSOR] = &EditCrossCursor;
@@ -660,7 +652,6 @@ BEGIN_CURSOR_BLOCK
0x63, 0x06, 0x7f, 0x06, 0x7f, 0x06, 0x00, 0x0f,
0xf0, 0xf9, 0xf0, 0xf9, 0x00, 0x0f, 0x00, 0x06,
0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06,
-
};
static BCursor BoxSelCursor = {
@@ -673,7 +664,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_BOXSELCURSOR] = &BoxSelCursor;
@@ -685,14 +676,14 @@ BEGIN_CURSOR_BLOCK
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x2c,
0x00, 0x5a, 0x00, 0x34, 0x00, 0x2a, 0x00, 0x17,
0x80, 0x06, 0x40, 0x03, 0xa0, 0x03, 0xd0, 0x01,
- 0x68, 0x00, 0x1c, 0x00, 0x06, 0x00, 0x00, 0x00
+ 0x68, 0x00, 0x1c, 0x00, 0x06, 0x00, 0x00, 0x00,
};
static char knife_smsk[] = {
0x00, 0x60, 0x00, 0xf0, 0x00, 0xfc, 0x00, 0xfe,
0x00, 0xfe, 0x00, 0x7e, 0x00, 0x7f, 0x80, 0x3f,
0xc0, 0x0e, 0x60, 0x07, 0xb0, 0x07, 0xd8, 0x03,
- 0xec, 0x01, 0x7e, 0x00, 0x1f, 0x00, 0x07, 0x00
+ 0xec, 0x01, 0x7e, 0x00, 0x1f, 0x00, 0x07, 0x00,
};
static char knife_lbm[] = {
@@ -712,7 +703,6 @@ BEGIN_CURSOR_BLOCK
0xc0, 0x03, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
};
static char knife_lmsk[] = {
@@ -732,7 +722,6 @@ BEGIN_CURSOR_BLOCK
0xe0, 0x1b, 0x00, 0x00, 0xf0, 0x06, 0x00, 0x00,
0xb8, 0x01, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
};
static BCursor KnifeCursor = {
@@ -745,7 +734,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
0, 31,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_KNIFECURSOR] = &KnifeCursor;
@@ -821,7 +810,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
0, 0,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_VLOOPCURSOR] = &VLoopCursor;
@@ -855,7 +844,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_TEXTEDITCURSOR] = &TextEditCursor;
@@ -870,9 +859,6 @@ BEGIN_CURSOR_BLOCK
0x00, 0x21, 0x80, 0x20, 0x40, 0x13, 0x40, 0x17,
0xa0, 0x0b, 0x98, 0x05, 0x04, 0x02, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x81, 0x00, 0x7f, 0x00,
-
-
-
};
static char paintbrush_smsk[] = {
@@ -880,8 +866,6 @@ BEGIN_CURSOR_BLOCK
0x00, 0x3f, 0x80, 0x3f, 0xc0, 0x1f, 0xc0, 0x1f,
0xe0, 0x0f, 0xf8, 0x07, 0xfc, 0x03, 0xfe, 0x01,
0xfe, 0x01, 0xfe, 0x01, 0xff, 0x00, 0x7f, 0x00,
-
-
};
static BCursor PaintBrushCursor = {
@@ -894,7 +878,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_PAINTBRUSHCURSOR] = &PaintBrushCursor;
@@ -929,7 +913,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_HANDCURSOR] = &HandCursor;
@@ -964,7 +948,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_NSEW_SCROLLCURSOR] = &NSEWScrollCursor;
@@ -1000,7 +984,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_NS_SCROLLCURSOR] = &NSScrollCursor;
@@ -1036,7 +1020,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_EW_SCROLLCURSOR] = &EWScrollCursor;
@@ -1071,7 +1055,7 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_BLACK, BC_WHITE
+ BC_BLACK, BC_WHITE,
};
BlenderCursor[BC_EYEDROPPER_CURSOR] = &EyedropperCursor;
@@ -1104,12 +1088,518 @@ BEGIN_CURSOR_BLOCK
32, 32,
15, 15,
/*color*/
- BC_YELLOW, BC_BLUE
+ BC_YELLOW, BC_BLUE,
};
BlenderCursor[BC_SWAPAREA_CURSOR] = &SwapCursor;
END_CURSOR_BLOCK
+
+/********************** Horizontal Split Cursor ***********************/
+BEGIN_CURSOR_BLOCK
+
+ static char hsplit_sbm[] = {
+ 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
+ 0x80, 0x00, 0x88, 0x08, 0x8C, 0x18, 0x8E, 0x38,
+ 0x8C, 0x18, 0x88, 0x08, 0x80, 0x00, 0x80, 0x00,
+ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char hsplit_smsk[] = {
+ 0xC0, 0x01, 0xC0, 0x01, 0xC0, 0x01, 0xD0, 0x05,
+ 0xD8, 0x0D, 0xDC, 0x1D, 0xDE, 0x3D, 0xDF, 0x7D,
+ 0xDE, 0x3D, 0xDC, 0x1D, 0xD8, 0x0D, 0xD0, 0x05,
+ 0xC0, 0x01, 0xC0, 0x01, 0xC0, 0x01, 0x00, 0x00
+ };
+
+ static char hsplit_lbm[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x84, 0x21, 0x00, 0x00, 0x86, 0x61, 0x00,
+ 0x00, 0x87, 0xE1, 0x00, 0x80, 0x87, 0xE1, 0x01,
+ 0xC0, 0x87, 0xE1, 0x03, 0xE0, 0x87, 0xE1, 0x07,
+ 0xF0, 0x87, 0xE1, 0x0F, 0xF8, 0x87, 0xE1, 0x1F,
+ 0xF0, 0x87, 0xE1, 0x0F, 0xE0, 0x87, 0xE1, 0x07,
+ 0xC0, 0x87, 0xE1, 0x03, 0x80, 0x87, 0xE1, 0x01,
+ 0x00, 0x87, 0xE1, 0x00, 0x00, 0x86, 0x61, 0x00,
+ 0x00, 0x84, 0x21, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char hsplit_lmsk[] = {
+ 0x00, 0xC0, 0x03, 0x00, 0x00, 0xC0, 0x03, 0x00,
+ 0x00, 0xC0, 0x03, 0x00, 0x00, 0xC0, 0x03, 0x00,
+ 0x00, 0xC0, 0x03, 0x00, 0x00, 0xC8, 0x13, 0x00,
+ 0x00, 0xCC, 0x33, 0x00, 0x00, 0xCE, 0x73, 0x00,
+ 0x00, 0xCF, 0xF3, 0x00, 0x80, 0xCF, 0xF3, 0x01,
+ 0xC0, 0xCF, 0xF3, 0x03, 0xE0, 0xCF, 0xF3, 0x07,
+ 0xF0, 0xCF, 0xF3, 0x0F, 0xF8, 0xCF, 0xF3, 0x1F,
+ 0xFC, 0xCF, 0xF3, 0x3F, 0xFE, 0xCF, 0xF3, 0x7F,
+ 0xFC, 0xCF, 0xF3, 0x3F, 0xF8, 0xCF, 0xF3, 0x1F,
+ 0xF0, 0xCF, 0xF3, 0x0F, 0xE0, 0xCF, 0xF3, 0x07,
+ 0xC0, 0xCF, 0xF3, 0x03, 0x80, 0xCF, 0xF3, 0x01,
+ 0x00, 0xCF, 0xF3, 0x00, 0x00, 0xCE, 0x73, 0x00,
+ 0x00, 0xCC, 0x33, 0x00, 0x00, 0xC8, 0x13, 0x00,
+ 0x00, 0xC8, 0x03, 0x00, 0x00, 0xC0, 0x03, 0x00,
+ 0x00, 0xC0, 0x03, 0x00, 0x00, 0xC0, 0x03, 0x00,
+ 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static BCursor HSplitCursor = {
+ /*small*/
+ hsplit_sbm, hsplit_smsk,
+ 16, 16,
+ 7, 7,
+ /*big*/
+ hsplit_lbm, hsplit_lmsk,
+ 32, 32,
+ 15, 15,
+ /*color*/
+ BC_BLACK, BC_WHITE
+ };
+
+ BlenderCursor[BC_H_SPLITCURSOR] = &HSplitCursor;
+
+END_CURSOR_BLOCK
+
+/********************** Vertical Split Cursor ***********************/
+BEGIN_CURSOR_BLOCK
+
+ static char vsplit_sbm[] = {
+ 0x00, 0x00, 0x80, 0x00, 0xC0, 0x01, 0xE0, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03,
+ 0xC0, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char vsplit_smsk[] = {
+ 0x80, 0x00, 0xC0, 0x01, 0xE0, 0x03, 0xF0, 0x07,
+ 0xF8, 0x0F, 0x00, 0x00, 0xFF, 0x7F, 0xFF, 0x7F,
+ 0xFF, 0x7F, 0x00, 0x00, 0xF8, 0x0F, 0xF0, 0x07,
+ 0xE0, 0x03, 0xC0, 0x01, 0x80, 0x00, 0x00, 0x00
+ };
+
+ static char vsplit_lbm[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x03, 0x00,
+ 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x3F,
+ 0xFE, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, 0x00,
+ 0x00, 0xE0, 0x03, 0x00, 0x00, 0xC0, 0x01, 0x00,
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char vsplit_lmsk[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x03, 0x00,
+ 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFF, 0x7F, 0x00, 0x80, 0xFF, 0xFF, 0x00,
+ 0xC0, 0xFF, 0xFF, 0x01, 0xE0, 0xFF, 0xFF, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0x7F,
+ 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0x7F,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xE0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x01,
+ 0x80, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x7F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, 0x00,
+ 0x00, 0xE0, 0x03, 0x00, 0x00, 0xC0, 0x01, 0x00,
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static BCursor VSplitCursor = {
+ /*small*/
+ vsplit_sbm, vsplit_smsk,
+ 16, 16,
+ 7, 7,
+ /*big*/
+ vsplit_lbm, vsplit_lmsk,
+ 32, 32,
+ 15, 15,
+ /*color*/
+ BC_BLACK, BC_WHITE
+ };
+
+ BlenderCursor[BC_V_SPLITCURSOR] = &VSplitCursor;
+
+END_CURSOR_BLOCK
+
+/********************** North Arrow Cursor ***********************/
+BEGIN_CURSOR_BLOCK
+
+ static char narrow_sbm[] = {
+ 0x00, 0x00, 0x80, 0x00, 0xC0, 0x01, 0xE0, 0x03,
+ 0xF0, 0x07, 0xF8, 0x0F, 0xFC, 0x1F, 0xE0, 0x03,
+ 0xE0, 0x03, 0xE0, 0x03, 0xE0, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char narrow_smsk[] = {
+ 0x80, 0x00, 0xC0, 0x01, 0xE0, 0x03, 0xF0, 0x07,
+ 0xF8, 0x0F, 0xFC, 0x1F, 0xFE, 0x3F, 0xFF, 0x7F,
+ 0xF0, 0x07, 0xF0, 0x07, 0xF0, 0x07, 0xF0, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char narrow_lbm[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00,
+ 0x00, 0xE0, 0x03, 0x00, 0x00, 0xF0, 0x07, 0x00,
+ 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFF, 0x7F, 0x00,
+ 0x80, 0xFF, 0xFF, 0x00, 0xC0, 0xFF, 0xFF, 0x01,
+ 0xE0, 0xFF, 0xFF, 0x03, 0xF0, 0xFF, 0xFF, 0x07,
+ 0xF8, 0xFF, 0xFF, 0x0F, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char narrow_lmsk[] = {
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00,
+ 0x00, 0xE0, 0x03, 0x00, 0x00, 0xF0, 0x07, 0x00,
+ 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFF, 0x7F, 0x00,
+ 0x80, 0xFF, 0xFF, 0x00, 0xC0, 0xFF, 0xFF, 0x01,
+ 0xE0, 0xFF, 0xFF, 0x03, 0xF0, 0xFF, 0xFF, 0x07,
+ 0xF8, 0xFF, 0xFF, 0x0F, 0xFC, 0xFF, 0xFF, 0x1F,
+ 0xFE, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0xFF, 0x7F,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static BCursor NArrowCursor = {
+ /*small*/
+ narrow_sbm, narrow_smsk,
+ 16, 16,
+ 7, 4,
+ /*big*/
+ narrow_lbm, narrow_lmsk,
+ 32, 32,
+ 15, 10,
+ /*color*/
+ BC_BLACK, BC_WHITE
+ };
+
+ BlenderCursor[BC_N_ARROWCURSOR] = &NArrowCursor;
+
+END_CURSOR_BLOCK
+
+/********************** South Arrow Cursor ***********************/
+BEGIN_CURSOR_BLOCK
+
+ static char sarrow_sbm[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xE0, 0x03, 0xE0, 0x03, 0xE0, 0x03,
+ 0xE0, 0x03, 0xFC, 0x1F, 0xF8, 0x0F, 0xF0, 0x07,
+ 0xE0, 0x03, 0xC0, 0x01, 0x80, 0x00, 0x00, 0x00
+ };
+
+ static char sarrow_smsk[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xF0, 0x07, 0xF0, 0x07, 0xF0, 0x07, 0xF0, 0x07,
+ 0xFF, 0x7F, 0xFE, 0x3F, 0xFC, 0x1F, 0xF8, 0x0F,
+ 0xF0, 0x07, 0xE0, 0x03, 0xC0, 0x01, 0x80, 0x00
+ };
+
+ static char sarrow_lbm[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xFC, 0x1F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0xF8, 0xFF, 0xFF, 0x0F,
+ 0xF0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x03,
+ 0xC0, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0x00,
+ 0x00, 0xFF, 0x7F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x0F, 0x00,
+ 0x00, 0xF0, 0x07, 0x00, 0x00, 0xE0, 0x03, 0x00,
+ 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char sarrow_lmsk[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0xFF, 0xFF, 0xFF, 0x7F, 0xFE, 0xFF, 0xFF, 0x3F,
+ 0xFC, 0xFF, 0xFF, 0x1F, 0xF8, 0xFF, 0xFF, 0x0F,
+ 0xF0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x03,
+ 0xC0, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0x00,
+ 0x00, 0xFF, 0x7F, 0x00, 0x00, 0xFE, 0x3F, 0x00,
+ 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x0F, 0x00,
+ 0x00, 0xF0, 0x07, 0x00, 0x00, 0xE0, 0x03, 0x00,
+ 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00
+ };
+
+ static BCursor SArrowCursor = {
+ /*small*/
+ sarrow_sbm, sarrow_smsk,
+ 16, 16,
+ 7, 11,
+ /*big*/
+ sarrow_lbm, sarrow_lmsk,
+ 32, 32,
+ 15, 21,
+ /*color*/
+ BC_BLACK, BC_WHITE
+ };
+
+ BlenderCursor[BC_S_ARROWCURSOR] = &SArrowCursor;
+
+END_CURSOR_BLOCK
+
+/********************** East Arrow Cursor ***********************/
+BEGIN_CURSOR_BLOCK
+
+ static char earrow_sbm[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06,
+ 0x00, 0x0E, 0xE0, 0x1F, 0xE0, 0x3F, 0xE0, 0x7F,
+ 0xE0, 0x3F, 0xE0, 0x1F, 0x00, 0x0E, 0x00, 0x06,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char earrow_smsk[] = {
+ 0x00, 0x01, 0x00, 0x03, 0x00, 0x07, 0x00, 0x0F,
+ 0xF0, 0x1F, 0xF0, 0x3F, 0xF0, 0x7F, 0xF0, 0xFF,
+ 0xF0, 0x7F, 0xF0, 0x3F, 0xF0, 0x1F, 0x00, 0x0F,
+ 0x00, 0x07, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00
+ };
+
+ static char earrow_lbm[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00,
+ 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x3E, 0x00,
+ 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xFE, 0x00,
+ 0x00, 0xFF, 0xFF, 0x01, 0x00, 0xFF, 0xFF, 0x03,
+ 0x00, 0xFF, 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0x0F,
+ 0x00, 0xFF, 0xFF, 0x1F, 0x00, 0xFF, 0xFF, 0x3F,
+ 0x00, 0xFF, 0xFF, 0x1F, 0x00, 0xFF, 0xFF, 0x0F,
+ 0x00, 0xFF, 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0x03,
+ 0x00, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0xFE, 0x00,
+ 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x3E, 0x00,
+ 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x0E, 0x00,
+ 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char earrow_lmsk[] = {
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00,
+ 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0F, 0x00,
+ 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x3F, 0x00,
+ 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0xFF, 0x00,
+ 0x00, 0x00, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0x03,
+ 0x80, 0xFF, 0xFF, 0x07, 0x80, 0xFF, 0xFF, 0x0F,
+ 0x80, 0xFF, 0xFF, 0x1F, 0x80, 0xFF, 0xFF, 0x3F,
+ 0x80, 0xFF, 0xFF, 0x7F, 0x80, 0xFF, 0xFF, 0xFF,
+ 0x80, 0xFF, 0xFF, 0x7F, 0x80, 0xFF, 0xFF, 0x3F,
+ 0x80, 0xFF, 0xFF, 0x1F, 0x80, 0xFF, 0xFF, 0x0F,
+ 0x80, 0xFF, 0xFF, 0x07, 0x80, 0xFF, 0xFF, 0x03,
+ 0x00, 0x00, 0xFF, 0x01, 0x00, 0x00, 0xFF, 0x00,
+ 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x3F, 0x00,
+ 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x00,
+ 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static BCursor EArrowCursor = {
+ /*small*/
+ earrow_sbm, earrow_smsk,
+ 16, 16,
+ 11, 7,
+ /*big*/
+ earrow_lbm, earrow_lmsk,
+ 32, 32,
+ 15, 22,
+ /*color*/
+ BC_BLACK, BC_WHITE
+ };
+
+ BlenderCursor[BC_E_ARROWCURSOR] = &EArrowCursor;
+
+END_CURSOR_BLOCK
+
+/********************** West Arrow Cursor ***********************/
+BEGIN_CURSOR_BLOCK
+
+ static char warrow_sbm[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x60, 0x00,
+ 0x70, 0x00, 0xF8, 0x07, 0xFC, 0x07, 0xFE, 0x07,
+ 0xFC, 0x07, 0xF8, 0x07, 0x70, 0x00, 0x60, 0x00,
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char warrow_smsk[] = {
+ 0x80, 0x00, 0xC0, 0x00, 0xE0, 0x00, 0xF0, 0x00,
+ 0xF8, 0x0F, 0xFC, 0x0F, 0xFE, 0x0F, 0xFF, 0x0F,
+ 0xFE, 0x0F, 0xFC, 0x0F, 0xF8, 0x0F, 0xF0, 0x00,
+ 0xE0, 0x00, 0xC0, 0x00, 0x80, 0x00, 0x00, 0x00
+ };
+
+ static char warrow_lbm[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
+ 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00,
+ 0x00, 0x78, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00,
+ 0x00, 0x7E, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00,
+ 0x80, 0xFF, 0xFF, 0x00, 0xC0, 0xFF, 0xFF, 0x00,
+ 0xE0, 0xFF, 0xFF, 0x00, 0xF0, 0xFF, 0xFF, 0x00,
+ 0xF8, 0xFF, 0xFF, 0x00, 0xFC, 0xFF, 0xFF, 0x00,
+ 0xF8, 0xFF, 0xFF, 0x00, 0xF0, 0xFF, 0xFF, 0x00,
+ 0xE0, 0xFF, 0xFF, 0x00, 0xC0, 0xFF, 0xFF, 0x00,
+ 0x80, 0xFF, 0xFF, 0x00, 0x00, 0x7F, 0x00, 0x00,
+ 0x00, 0x7E, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00,
+ 0x00, 0x78, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00,
+ 0x00, 0x60, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char warrow_lmsk[] = {
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00,
+ 0x00, 0xE0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00,
+ 0x00, 0xF8, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00,
+ 0x00, 0xFE, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00,
+ 0x80, 0xFF, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x01,
+ 0xE0, 0xFF, 0xFF, 0x01, 0xF0, 0xFF, 0xFF, 0x01,
+ 0xF8, 0xFF, 0xFF, 0x01, 0xFC, 0xFF, 0xFF, 0x01,
+ 0xFE, 0xFF, 0xFF, 0x01, 0xFF, 0xFF, 0xFF, 0x01,
+ 0xFE, 0xFF, 0xFF, 0x01, 0xFC, 0xFF, 0xFF, 0x01,
+ 0xF8, 0xFF, 0xFF, 0x01, 0xF0, 0xFF, 0xFF, 0x01,
+ 0xE0, 0xFF, 0xFF, 0x01, 0xC0, 0xFF, 0xFF, 0x01,
+ 0x80, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00,
+ 0x00, 0xFE, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00,
+ 0x00, 0xF8, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00,
+ 0x00, 0xE0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00,
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static BCursor WArrowCursor = {
+ /*small*/
+ warrow_sbm, warrow_smsk,
+ 16, 16,
+ 4, 7,
+ /*big*/
+ warrow_lbm, warrow_lmsk,
+ 32, 32,
+ 15, 15,
+ /*color*/
+ BC_BLACK, BC_WHITE
+ };
+
+ BlenderCursor[BC_W_ARROWCURSOR] = &WArrowCursor;
+
+END_CURSOR_BLOCK
+
+
+/********************** Stop Sign Cursor ***********************/
+BEGIN_CURSOR_BLOCK
+
+ static char stop_sbm[] = {
+ 0x00, 0x00, 0xE0, 0x07, 0x38, 0x1C, 0x1C, 0x30,
+ 0x3C, 0x20, 0x76, 0x60, 0xE2, 0x40, 0xC2, 0x41,
+ 0x82, 0x43, 0x02, 0x47, 0x06, 0x6E, 0x04, 0x3C,
+ 0x0C, 0x38, 0x38, 0x1C, 0xE0, 0x07, 0x00, 0x00
+ };
+
+ static char stop_smsk[] = {
+ 0xE0, 0x07, 0xF8, 0x1F, 0xFC, 0x3F, 0x3E, 0x7C,
+ 0x7E, 0x70, 0xFF, 0xF0, 0xF7, 0xE1, 0xE7, 0xE3,
+ 0xC7, 0xE7, 0x87, 0xEF, 0x0F, 0xFF, 0x0E, 0x7E,
+ 0x3E, 0x7C, 0xFC, 0x3F, 0xF8, 0x1F, 0xE0, 0x07
+ };
+
+ static char stop_lbm[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00,
+ 0x00, 0xFE, 0x7F, 0x00, 0x00, 0x0F, 0xF0, 0x00,
+ 0xC0, 0x03, 0xC0, 0x03, 0xE0, 0x01, 0x00, 0x07,
+ 0xF0, 0x01, 0x00, 0x0E, 0xF0, 0x01, 0x00, 0x0C,
+ 0xF8, 0x03, 0x00, 0x18, 0x1C, 0x07, 0x00, 0x38,
+ 0x0C, 0x0E, 0x00, 0x30, 0x0C, 0x1C, 0x00, 0x30,
+ 0x06, 0x38, 0x00, 0x60, 0x06, 0x70, 0x00, 0x60,
+ 0x06, 0xE0, 0x00, 0x60, 0x06, 0xC0, 0x01, 0x60,
+ 0x06, 0x80, 0x03, 0x60, 0x06, 0x00, 0x07, 0x60,
+ 0x06, 0x00, 0x0E, 0x60, 0x06, 0x00, 0x1C, 0x60,
+ 0x0C, 0x00, 0x38, 0x30, 0x0C, 0x00, 0x70, 0x30,
+ 0x1C, 0x00, 0xE0, 0x38, 0x18, 0x00, 0xC0, 0x1F,
+ 0x30, 0x00, 0x80, 0x0F, 0x70, 0x00, 0x80, 0x0F,
+ 0xE0, 0x00, 0x80, 0x07, 0xC0, 0x03, 0xC0, 0x03,
+ 0x00, 0x0F, 0xF0, 0x00, 0x00, 0xFE, 0x7F, 0x00,
+ 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ static char stop_lmsk[] = {
+ 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xFE, 0x7F, 0x00,
+ 0x80, 0xFF, 0xFF, 0x01, 0xC0, 0xFF, 0xFF, 0x03,
+ 0xE0, 0x1F, 0xF8, 0x07, 0xF0, 0x03, 0xC0, 0x0F,
+ 0xF8, 0x03, 0x80, 0x1F, 0xFC, 0x07, 0x00, 0x3F,
+ 0xFC, 0x0F, 0x00, 0x3E, 0xFE, 0x1F, 0x00, 0x7C,
+ 0x9E, 0x3F, 0x00, 0x78, 0x1E, 0x7F, 0x00, 0x78,
+ 0x1F, 0xFE, 0x00, 0xF8, 0x0F, 0xFC, 0x01, 0xF0,
+ 0x0F, 0xF8, 0x03, 0xF0, 0x0F, 0xF0, 0x07, 0xF0,
+ 0x0F, 0xE0, 0x0F, 0xF0, 0x0F, 0xC0, 0x1F, 0xF0,
+ 0x0F, 0x80, 0x3F, 0xF0, 0x1F, 0x00, 0x7F, 0xF8,
+ 0x1E, 0x00, 0xFE, 0x78, 0x1E, 0x00, 0xFC, 0x79,
+ 0x3E, 0x00, 0xF8, 0x7F, 0x7C, 0x00, 0xF0, 0x3F,
+ 0xFC, 0x00, 0xE0, 0x3F, 0xF8, 0x01, 0xC0, 0x1F,
+ 0xF0, 0x03, 0xC0, 0x0F, 0xE0, 0x1F, 0xF8, 0x07,
+ 0xC0, 0xFF, 0xFF, 0x03, 0x80, 0xFF, 0xFF, 0x01,
+ 0x00, 0xFE, 0x7F, 0x00, 0x00, 0xF0, 0x0F, 0x00
+ };
+
+ static BCursor StopCursor = {
+ /*small*/
+ stop_sbm, stop_smsk,
+ 16, 16,
+ 7, 7,
+ /*big*/
+ stop_lbm, stop_lmsk,
+ 32, 32,
+ 15, 15,
+ /*color*/
+ BC_BLACK, BC_WHITE
+ };
+
+ BlenderCursor[BC_STOPCURSOR] = &StopCursor;
+
+END_CURSOR_BLOCK
+
/********************** Put the cursors in the array ***********************/
}
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 77e2cd772db..fcfc9c8b0ae 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2010 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_dragdrop.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Our own drag-and-drop, drag state and drop boxes.
*/
@@ -201,16 +194,17 @@ void WM_drag_free_list(struct ListBase *lb)
static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, const wmEvent *event)
{
- wmEventHandler *handler = handlers->first;
- for (; handler; handler = handler->next) {
- if (handler->dropboxes) {
- wmDropBox *drop = handler->dropboxes->first;
- for (; drop; drop = drop->next) {
- const char *tooltip = NULL;
- if (drop->poll(C, drag, event, &tooltip)) {
- /* XXX Doing translation here might not be ideal, but later we have no more
- * access to ot (and hence op context)... */
- return (tooltip) ? tooltip : RNA_struct_ui_name(drop->ot->srna);
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_DROPBOX) {
+ wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base;
+ if (handler->dropboxes) {
+ for (wmDropBox *drop = handler->dropboxes->first; drop; drop = drop->next) {
+ const char *tooltip = NULL;
+ if (drop->poll(C, drag, event, &tooltip)) {
+ /* XXX Doing translation here might not be ideal, but later we have no more
+ * access to ot (and hence op context)... */
+ return (tooltip) ? tooltip : RNA_struct_ui_name(drop->ot->srna);
+ }
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index d6058ac0d28..c2488ed0992 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_draw.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Handle OpenGL buffers for windowing, also paint cursor.
*/
@@ -213,7 +206,7 @@ static void wm_region_test_render_do_draw(const Scene *scene, struct Depsgraph *
static bool wm_region_use_viewport(ScrArea *sa, ARegion *ar)
{
- return (sa->spacetype == SPACE_VIEW3D && ar->regiontype == RGN_TYPE_WINDOW);
+ return (ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_IMAGE) && ar->regiontype == RGN_TYPE_WINDOW);
}
/********************** draw all **************************/
@@ -488,9 +481,9 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend)
alpha = 1.0f;
}
- glUniform1i(GPU_shader_get_uniform(shader, "image"), 0);
- glUniform4f(GPU_shader_get_uniform(shader, "rect_icon"), rect_tex.xmin, rect_tex.ymin, rect_tex.xmax, rect_tex.ymax);
- glUniform4f(GPU_shader_get_uniform(shader, "rect_geom"), rect_geo.xmin, rect_geo.ymin, rect_geo.xmax, rect_geo.ymax);
+ glUniform1i(GPU_shader_get_uniform_ensure(shader, "image"), 0);
+ glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_icon"), rect_tex.xmin, rect_tex.ymin, rect_tex.xmax, rect_tex.ymax);
+ glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_geom"), rect_geo.xmin, rect_geo.ymin, rect_geo.xmax, rect_geo.ymax);
glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), alpha, alpha, alpha, alpha);
GPU_draw_primitive(GPU_PRIM_TRI_STRIP, 4);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index c4d537cace9..1ae3f7ffb79 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_event_system.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Handle events and notifiers from GHOST input (mouse, keyboard, tablet, ndof).
*
@@ -54,6 +47,7 @@
#include "BLI_timer.h"
#include "BKE_context.h"
+#include "BKE_customdata.h"
#include "BKE_idprop.h"
#include "BKE_global.h"
#include "BKE_layer.h"
@@ -134,6 +128,18 @@ wmEvent *wm_event_add(wmWindow *win, const wmEvent *event_to_add)
return wm_event_add_ex(win, event_to_add, NULL);
}
+wmEvent *WM_event_add_simulate(wmWindow *win, const wmEvent *event_to_add)
+{
+ if ((G.f & G_FLAG_EVENT_SIMULATE) == 0) {
+ BLI_assert(0);
+ return NULL;
+ }
+ wmEvent *event = wm_event_add(win, event_to_add);
+ win->eventstate->x = event->x;
+ win->eventstate->y = event->y;
+ return event;
+}
+
void wm_event_free(wmEvent *event)
{
if (event->customdata) {
@@ -268,7 +274,7 @@ void WM_main_remap_editor_id_reference(ID *old_id, ID *new_id)
Main *bmain = G_MAIN;
bScreen *sc;
- for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
ScrArea *sa;
for (sa = sc->areabase.first; sa; sa = sa->next) {
@@ -309,14 +315,14 @@ void wm_event_do_depsgraph(bContext *C)
return;
}
/* Combine datamasks so 1 win doesn't disable UV's in another [#26448]. */
- uint64_t win_combine_v3d_datamask = 0;
+ CustomData_MeshMasks win_combine_v3d_datamask = {0};
for (wmWindow *win = wm->windows.first; win; win = win->next) {
const Scene *scene = WM_window_get_active_scene(win);
const bScreen *screen = WM_window_get_active_screen(win);
- win_combine_v3d_datamask |= ED_view3d_screen_datamask(scene, screen);
+ ED_view3d_screen_datamask(C, scene, screen, &win_combine_v3d_datamask);
}
- /* Update all the dependency graphs of visible vew layers. */
+ /* Update all the dependency graphs of visible view layers. */
for (wmWindow *win = wm->windows.first; win; win = win->next) {
Scene *scene = WM_window_get_active_scene(win);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
@@ -324,7 +330,7 @@ void wm_event_do_depsgraph(bContext *C)
/* Copied to set's in scene_update_tagged_recursive() */
scene->customdata_mask = win_combine_v3d_datamask;
/* XXX, hack so operators can enforce datamasks [#26482], gl render */
- scene->customdata_mask |= scene->customdata_mask_modal;
+ CustomData_MeshMasks_update(&scene->customdata_mask, &scene->customdata_mask_modal);
/* TODO(sergey): For now all dependency graphs which are evaluated from
* workspace are considered active. This will work all fine with "locked"
* view layer and time across windows. This is to be granted separately,
@@ -538,7 +544,7 @@ static int wm_event_always_pass(const wmEvent *event)
/* ********************* ui handler ******************* */
-static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEvent *event, int always_pass)
+static int wm_handler_ui_call(bContext *C, wmEventHandler_UI *handler, const wmEvent *event, int always_pass)
{
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
@@ -549,7 +555,7 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEven
/* UI code doesn't handle return values - it just always returns break.
* to make the DBL_CLICK conversion work, we just don't send this to UI, except mouse clicks */
- if (((handler->flag & WM_HANDLER_ACCEPT_DBL_CLICK) == 0) &&
+ if (((handler->head.flag & WM_HANDLER_ACCEPT_DBL_CLICK) == 0) &&
!ISMOUSE_BUTTON(event->type) &&
(event->val == KM_DBL_CLICK))
{
@@ -566,11 +572,17 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEven
}
/* 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->context.area) {
+ CTX_wm_area_set(C, handler->context.area);
+ }
+ if (handler->context.region) {
+ CTX_wm_region_set(C, handler->context.region);
+ }
+ if (handler->context.menu) {
+ CTX_wm_menu_set(C, handler->context.menu);
+ }
- retval = handler->ui_handle(C, event, handler->ui_userdata);
+ retval = handler->handle_fn(C, event, handler->user_data);
/* putting back screen context */
if ((retval != WM_UI_HANDLER_BREAK) || always_pass) {
@@ -599,20 +611,18 @@ static void wm_handler_ui_cancel(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
ARegion *ar = CTX_wm_region(C);
- wmEventHandler *handler, *nexthandler;
if (!ar)
return;
- for (handler = ar->handlers.first; handler; handler = nexthandler) {
- nexthandler = handler->next;
-
- if (handler->ui_handle) {
+ LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, &ar->handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_UI) {
+ wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base;
+ BLI_assert(handler->handle_fn != NULL);
wmEvent event;
-
wm_event_init_from_window(win, &event);
event.type = EVT_BUT_CANCEL;
- handler->ui_handle(C, &event, handler->ui_userdata);
+ handler->handle_fn(C, &event, handler->user_data);
}
}
}
@@ -940,7 +950,9 @@ static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat,
}
/* if repeat is true, it doesn't register again, nor does it free */
-static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, const bool store)
+static int wm_operator_exec(
+ bContext *C, wmOperator *op,
+ const bool repeat, const bool use_repeat_op_flag, const bool store)
{
wmWindowManager *wm = CTX_wm_manager(C);
int retval = OPERATOR_CANCELLED;
@@ -958,12 +970,12 @@ static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, cons
wm->op_undo_depth++;
}
- if (repeat) {
+ if (repeat && use_repeat_op_flag) {
op->flag |= OP_IS_REPEAT;
}
retval = op->type->exec(C, op);
OPERATOR_RETVAL_CHECK(retval);
- if (repeat) {
+ if (repeat && use_repeat_op_flag) {
op->flag &= ~OP_IS_REPEAT;
}
@@ -1015,7 +1027,7 @@ static int wm_operator_exec_notest(bContext *C, wmOperator *op)
int WM_operator_call_ex(bContext *C, wmOperator *op,
const bool store)
{
- return wm_operator_exec(C, op, false, store);
+ return wm_operator_exec(C, op, false, false, store);
}
int WM_operator_call(bContext *C, wmOperator *op)
@@ -1038,7 +1050,11 @@ int WM_operator_call_notest(bContext *C, wmOperator *op)
*/
int WM_operator_repeat(bContext *C, wmOperator *op)
{
- return wm_operator_exec(C, op, true, true);
+ return wm_operator_exec(C, op, true, true, true);
+}
+int WM_operator_repeat_interactive(bContext *C, wmOperator *op)
+{
+ return wm_operator_exec(C, op, true, false, true);
}
/**
* \return true if #WM_operator_repeat can run
@@ -1662,19 +1678,19 @@ void wm_event_free_handler(wmEventHandler *handler)
}
/* only set context when area/region is part of screen */
-static void wm_handler_op_context(bContext *C, wmEventHandler *handler, const wmEvent *event)
+static void wm_handler_op_context(bContext *C, wmEventHandler_Op *handler, const wmEvent *event)
{
wmWindow *win = CTX_wm_window(C);
bScreen *screen = CTX_wm_screen(C);
if (screen && handler->op) {
- if (handler->op_area == NULL)
+ if (handler->context.area == NULL)
CTX_wm_area_set(C, NULL);
else {
ScrArea *sa = NULL;
ED_screen_areas_iter(win, screen, sa_iter) {
- if (sa_iter == handler->op_area) {
+ if (sa_iter == handler->context.area) {
sa = sa_iter;
break;
}
@@ -1693,9 +1709,9 @@ static void wm_handler_op_context(bContext *C, wmEventHandler *handler, const wm
CTX_wm_area_set(C, sa);
if (op && (op->flag & OP_IS_MODAL_CURSOR_REGION)) {
- ar = BKE_area_find_region_xy(sa, handler->op_region_type, event->x, event->y);
+ ar = BKE_area_find_region_xy(sa, handler->context.region_type, event->x, event->y);
if (ar) {
- handler->op_region = ar;
+ handler->context.region = ar;
}
}
else {
@@ -1704,7 +1720,7 @@ static void wm_handler_op_context(bContext *C, wmEventHandler *handler, const wm
if (ar == NULL) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar == handler->op_region) {
+ if (ar == handler->context.region) {
break;
}
}
@@ -1721,51 +1737,67 @@ static void wm_handler_op_context(bContext *C, wmEventHandler *handler, const wm
/* called on exit or remove area, only here call cancel callback */
void WM_event_remove_handlers(bContext *C, ListBase *handlers)
{
- wmEventHandler *handler;
+ wmEventHandler *handler_base;
wmWindowManager *wm = CTX_wm_manager(C);
/* C is zero on freeing database, modal handlers then already were freed */
- while ((handler = BLI_pophead(handlers))) {
- if (handler->op) {
- wmWindow *win = CTX_wm_window(C);
- if (handler->op->type->cancel) {
- ScrArea *area = CTX_wm_area(C);
- ARegion *region = CTX_wm_region(C);
+ while ((handler_base = BLI_pophead(handlers))) {
+ BLI_assert(handler_base->type != 0);
+ if (handler_base->type == WM_HANDLER_TYPE_OP) {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+ if (handler->op) {
+ wmWindow *win = CTX_wm_window(C);
+ if (handler->op->type->cancel) {
+ ScrArea *area = CTX_wm_area(C);
+ ARegion *region = CTX_wm_region(C);
- wm_handler_op_context(C, handler, win->eventstate);
+ wm_handler_op_context(C, handler, win->eventstate);
- if (handler->op->type->flag & OPTYPE_UNDO)
- wm->op_undo_depth++;
+ if (handler->op->type->flag & OPTYPE_UNDO) {
+ wm->op_undo_depth++;
+ }
- handler->op->type->cancel(C, handler->op);
+ handler->op->type->cancel(C, handler->op);
- if (handler->op->type->flag & OPTYPE_UNDO)
- wm->op_undo_depth--;
+ if (handler->op->type->flag & OPTYPE_UNDO) {
+ wm->op_undo_depth--;
+ }
- CTX_wm_area_set(C, area);
- CTX_wm_region_set(C, region);
- }
+ CTX_wm_area_set(C, area);
+ CTX_wm_region_set(C, region);
+ }
- WM_cursor_grab_disable(win, NULL);
- WM_operator_free(handler->op);
+ WM_cursor_grab_disable(win, NULL);
+ WM_operator_free(handler->op);
+ }
}
- else if (handler->ui_remove) {
- ScrArea *area = CTX_wm_area(C);
- ARegion *region = CTX_wm_region(C);
- ARegion *menu = CTX_wm_menu(C);
+ else if (handler_base->type == WM_HANDLER_TYPE_UI) {
+ wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base;
- 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->remove_fn) {
+ ScrArea *area = CTX_wm_area(C);
+ ARegion *region = CTX_wm_region(C);
+ ARegion *menu = CTX_wm_menu(C);
- handler->ui_remove(C, handler->ui_userdata);
+ if (handler->context.area) {
+ CTX_wm_area_set(C, handler->context.area);
+ }
+ if (handler->context.region) {
+ CTX_wm_region_set(C, handler->context.region);
+ }
+ if (handler->context.menu) {
+ CTX_wm_menu_set(C, handler->context.menu);
+ }
+
+ handler->remove_fn(C, handler->user_data);
- CTX_wm_area_set(C, area);
- CTX_wm_region_set(C, region);
- CTX_wm_menu_set(C, menu);
+ CTX_wm_area_set(C, area);
+ CTX_wm_region_set(C, region);
+ CTX_wm_menu_set(C, menu);
+ }
}
- wm_event_free_handler(handler);
+ wm_event_free_handler(handler_base);
}
}
@@ -1805,58 +1837,110 @@ int WM_userdef_event_type_from_keymap_type(int kmitype)
return kmitype;
}
-static int wm_eventmatch(const wmEvent *winevent, wmKeyMapItem *kmi)
+static bool wm_eventmatch(const wmEvent *winevent, const wmKeyMapItem *kmi)
{
- int kmitype = WM_userdef_event_map(kmi->type);
+ if (kmi->flag & KMI_INACTIVE) {
+ return false;
+ }
- if (kmi->flag & KMI_INACTIVE) return 0;
+ const int kmitype = WM_userdef_event_map(kmi->type);
/* the matching rules */
- if (kmitype == KM_TEXTINPUT)
+ if (kmitype == KM_TEXTINPUT) {
if (winevent->val == KM_PRESS) { /* prevent double clicks */
/* NOT using ISTEXTINPUT anymore because (at least on Windows) some key codes above 255
* could have printable ascii keys - BUG [#30479] */
- if (ISKEYBOARD(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1;
+ if (ISKEYBOARD(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) {
+ return true;
+ }
}
+ }
if (kmitype != KM_ANY) {
if (ELEM(kmitype, TABLET_STYLUS, TABLET_ERASER)) {
const wmTabletData *wmtab = winevent->tablet_data;
- if (wmtab == NULL)
- return 0;
- else if (winevent->type != LEFTMOUSE) /* tablet events can occur on hover + keypress */
- return 0;
- else if ((kmitype == TABLET_STYLUS) && (wmtab->Active != EVT_TABLET_STYLUS))
- return 0;
- else if ((kmitype == TABLET_ERASER) && (wmtab->Active != EVT_TABLET_ERASER))
- return 0;
+ if (wmtab == NULL) {
+ return false;
+ }
+ else if (winevent->type != LEFTMOUSE) {
+ /* tablet events can occur on hover + keypress */
+ return false;
+ }
+ else if ((kmitype == TABLET_STYLUS) && (wmtab->Active != EVT_TABLET_STYLUS)) {
+ return false;
+ }
+ else if ((kmitype == TABLET_ERASER) && (wmtab->Active != EVT_TABLET_ERASER)) {
+ return false;
+ }
}
else {
- if (winevent->type != kmitype)
- return 0;
+ if (winevent->type != kmitype) {
+ return false;
+ }
}
}
- if (kmi->val != KM_ANY)
- if (winevent->val != kmi->val) return 0;
+ if (kmi->val != KM_ANY) {
+ if (winevent->val != kmi->val) {
+ return false;
+ }
+ }
- /* 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;
+ /* Modifiers also check bits, so it allows modifier order.
+ * Account for rare case of when these keys are used as the 'type' not as modifiers. */
+ if (kmi->shift != KM_ANY) {
+ if ((winevent->shift != kmi->shift) && !(winevent->shift & kmi->shift) &&
+ !ELEM(winevent->type, LEFTSHIFTKEY, RIGHTSHIFTKEY))
+ {
+ return false;
+ }
+ }
+ if (kmi->ctrl != KM_ANY) {
+ if (winevent->ctrl != kmi->ctrl && !(winevent->ctrl & kmi->ctrl) &&
+ !ELEM(winevent->type, LEFTCTRLKEY, RIGHTCTRLKEY))
+ {
+ return false;
+ }
+ }
+ if (kmi->alt != KM_ANY) {
+ if (winevent->alt != kmi->alt && !(winevent->alt & kmi->alt) &&
+ !ELEM(winevent->type, LEFTALTKEY, RIGHTALTKEY))
+ {
+ return false;
+ }
+ }
+ if (kmi->oskey != KM_ANY) {
+ if (winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey) &&
+ (winevent->type != OSKEY))
+ {
+ return false;
+ }
+ }
/* only keymap entry with keymodifier is checked, means all keys without modifier get handled too. */
/* that is currently needed to make overlapping events work (when you press A - G fast or so). */
- if (kmi->keymodifier)
- if (winevent->keymodifier != kmi->keymodifier) return 0;
+ if (kmi->keymodifier) {
+ if (winevent->keymodifier != kmi->keymodifier) {
+ return false;
+ }
+ }
- return 1;
+ return true;
+}
+
+static wmKeyMapItem *wm_eventmatch_modal_keymap_items(const wmKeyMap *keymap, wmOperator *op, const wmEvent *event)
+{
+ for (wmKeyMapItem *kmi = keymap->items.first; kmi; kmi = kmi->next) {
+ if (wm_eventmatch(event, kmi)) {
+ if ((keymap->poll_modal_item == NULL) ||
+ (keymap->poll_modal_item(op, kmi->propvalue)))
+ {
+ return kmi;
+ }
+ }
+ }
+ return NULL;
}
@@ -1869,21 +1953,28 @@ static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *eve
if (op->type->modalkeymap) {
wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
- wmKeyMapItem *kmi;
+ wmKeyMapItem *kmi = NULL;
- for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
- if (wm_eventmatch(event, kmi)) {
- if ((keymap->poll_modal_item == NULL) ||
- (keymap->poll_modal_item(op, kmi->propvalue)))
- {
- event->prevtype = event->type;
- event->prevval = event->val;
- event->type = EVT_MODAL_MAP;
- event->val = kmi->propvalue;
- break;
- }
+ const wmEvent *event_match = NULL;
+ wmEvent event_no_dbl_click;
+
+ if ((kmi = wm_eventmatch_modal_keymap_items(keymap, op, event))) {
+ event_match = event;
+ }
+ else if (event->val == KM_DBL_CLICK) {
+ event_no_dbl_click = *event;
+ event_no_dbl_click.val = KM_PRESS;
+ if ((kmi = wm_eventmatch_modal_keymap_items(keymap, op, &event_no_dbl_click))) {
+ event_match = &event_no_dbl_click;
}
}
+
+ if (event_match != NULL) {
+ event->prevtype = event_match->type;
+ event->prevval = event_match->val;
+ event->type = EVT_MODAL_MAP;
+ event->val = kmi->propvalue;
+ }
}
else {
/* modal keymap checking returns handled events fine, but all hardcoded modal
@@ -1929,13 +2020,17 @@ static void wm_event_modalmap_end(wmEvent *event, bool dbl_click_disabled)
}
/* Warning: this function removes a modal handler, when finished */
-static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHandler *handler,
- wmEvent *event, PointerRNA *properties)
+static int wm_handler_operator_call(
+ bContext *C, ListBase *handlers, wmEventHandler *handler_base,
+ wmEvent *event, PointerRNA *properties)
{
int retval = OPERATOR_PASS_THROUGH;
/* derived, modal or blocking operator */
- if (handler->op) {
+ if ((handler_base->type == WM_HANDLER_TYPE_OP) &&
+ (((wmEventHandler_Op *)handler_base)->op != NULL))
+ {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
wmOperator *op = handler->op;
wmOperatorType *ot = op->type;
@@ -2016,7 +2111,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
WM_cursor_grab_disable(CTX_wm_window(C), NULL);
BLI_remlink(handlers, handler);
- wm_event_free_handler(handler);
+ wm_event_free_handler(&handler->head);
/* prevent silly errors from operator users */
//retval &= ~OPERATOR_PASS_THROUGH;
@@ -2033,11 +2128,15 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
if (ot && wm_operator_check_locked_interface(C, ot)) {
bool use_last_properties = true;
PointerRNA tool_properties = {{0}};
- const bool is_tool = (handler->keymap_tool != NULL);
+
+ bToolRef *keymap_tool = (
+ (handler_base->type == WM_HANDLER_TYPE_KEYMAP) ?
+ ((wmEventHandler_Keymap *)handler_base)->keymap_tool : NULL);
+ const bool is_tool = (keymap_tool != NULL);
const bool use_tool_properties = is_tool;
if (use_tool_properties) {
- WM_toolsystem_ref_properties_init_for_keymap(handler->keymap_tool, &tool_properties, properties, ot);
+ WM_toolsystem_ref_properties_init_for_keymap(keymap_tool, &tool_properties, properties, ot);
properties = &tool_properties;
use_last_properties = false;
}
@@ -2051,13 +2150,21 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
/* Link gizmo if 'WM_GIZMOGROUPTYPE_TOOL_INIT' is set. */
if (retval & OPERATOR_FINISHED) {
if (is_tool) {
- bToolRef_Runtime *tref_rt = handler->keymap_tool->runtime;
+ bToolRef_Runtime *tref_rt = keymap_tool->runtime;
if (tref_rt->gizmo_group[0]) {
const char *idname = tref_rt->gizmo_group;
wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
if (gzgt != NULL) {
if ((gzgt->flag & WM_GIZMOGROUPTYPE_TOOL_INIT) != 0) {
- WM_gizmo_group_type_ensure_ptr(gzgt);
+ ARegion *ar = CTX_wm_region(C);
+ if (ar != NULL) {
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&gzgt->gzmap_params);
+ WM_gizmo_group_type_ensure_ptr_ex(gzgt, gzmap_type);
+ wmGizmoGroup *gzgroup = WM_gizmomaptype_group_init_runtime_with_region(gzmap_type, gzgt, ar);
+ /* We can't rely on drawing to initialize gizmo's since disabling
+ * overlays/gizmos will prevent pre-drawing setup calls. (see T60905) */
+ WM_gizmogroup_ensure_init(C, gzgroup);
+ }
}
}
}
@@ -2083,7 +2190,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
}
/* fileselect handlers are only in the window queue, so it's safe to switch screens or area types */
-static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHandler *handler, int val)
+static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHandler_Op *handler, int val)
{
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile;
@@ -2097,12 +2204,12 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
/* sa can be null when window A is active, but mouse is over window B
* in this case, open file select in original window A. Also don't
* use global areas. */
- if (handler->op_area == NULL || ED_area_is_global(handler->op_area)) {
+ if (handler->context.area == NULL || ED_area_is_global(handler->context.area)) {
bScreen *screen = CTX_wm_screen(C);
sa = (ScrArea *)screen->areabase.first;
}
else {
- sa = handler->op_area;
+ sa = handler->context.area;
}
if (sa->full) {
@@ -2233,7 +2340,7 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
CTX_wm_area_set(C, NULL);
- wm_event_free_handler(handler);
+ wm_event_free_handler(&handler->head);
action = WM_HANDLER_BREAK;
break;
@@ -2243,7 +2350,8 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
return action;
}
-static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHandler *handler, const wmEvent *event)
+static int wm_handler_fileselect_call(
+ bContext *C, ListBase *handlers, wmEventHandler_Op *handler, const wmEvent *event)
{
int action = WM_HANDLER_CONTINUE;
@@ -2295,7 +2403,6 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
#define PRINT if (do_debug_handler) printf
wmWindowManager *wm = CTX_wm_manager(C);
- wmEventHandler *handler, *nexthandler;
int action = WM_HANDLER_CONTINUE;
int always_pass;
@@ -2309,48 +2416,56 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
* by the event that's called, for eg:
*
* Calling a python script which changes the area.type, see [#32232] */
- for (handler = handlers->first; handler && handlers->first; handler = nexthandler) {
-
- nexthandler = handler->next;
+ for (wmEventHandler *handler_base = handlers->first, *handler_base_next;
+ handler_base && handlers->first;
+ handler_base = handler_base_next)
+ {
+ handler_base_next = handler_base->next;
/* during this loop, ui handlers for nested menus can tag multiple handlers free */
- if (handler->flag & WM_HANDLER_DO_FREE) {
+ if (handler_base->flag & WM_HANDLER_DO_FREE) {
/* pass */
}
- else if (handler_boundbox_test(handler, event)) { /* optional boundbox */
+ else if (handler_boundbox_test(handler_base, event)) { /* optional boundbox */
/* 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)
+ /* modal+blocking handler_base */
+ if (handler_base->flag & WM_HANDLER_BLOCKING) {
action |= WM_HANDLER_BREAK;
+ }
- if (handler->keymap) {
- wmKeyMap *keymap = WM_keymap_active(wm, handler->keymap);
- wmKeyMapItem *kmi;
+ /* Handle all types here. */
+ if (handler_base->type == WM_HANDLER_TYPE_KEYMAP) {
+ wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base;
+ wmKeyMap *keymap = WM_event_get_keymap_from_handler(wm, handler);
PRINT("%s: checking '%s' ...", __func__, keymap->idname);
- if (WM_keymap_poll(C, keymap)) {
+ if (keymap == NULL) {
+ /* Only callback is allowed to have NULL keymaps. */
+ BLI_assert(handler->dynamic.keymap_fn);
+ }
+ else if (WM_keymap_poll(C, keymap)) {
PRINT("pass\n");
- for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+ for (wmKeyMapItem *kmi = keymap->items.first; kmi; kmi = kmi->next) {
if (wm_eventmatch(event, kmi)) {
- struct wmEventHandler_KeymapFn keymap_callback = handler->keymap_callback;
+ struct wmEventHandler_KeymapPost keymap_post = handler->post;
PRINT("%s: item matched '%s'\n", __func__, kmi->idname);
/* 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);
+ action |= wm_handler_operator_call(C, handlers, handler_base, event, kmi->ptr);
if (action & WM_HANDLER_BREAK) {
- /* not always_pass here, it denotes removed handler */
+ /* not always_pass here, it denotes removed handler_base */
CLOG_INFO(WM_LOG_HANDLERS, 2, "handled! '%s'", kmi->idname);
- if (keymap_callback.handle_post_fn != NULL) {
- keymap_callback.handle_post_fn(keymap, kmi, keymap_callback.user_data);
+ if (keymap_post.post_fn != NULL) {
+ keymap_post.post_fn(keymap, kmi, keymap_post.user_data);
}
break;
}
@@ -2369,18 +2484,15 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
PRINT("fail\n");
}
}
- else if (handler->ui_handle) {
+ else if (handler_base->type == WM_HANDLER_TYPE_UI) {
+ wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base;
+ BLI_assert(handler->handle_fn != NULL);
if (!wm->is_interface_locked) {
action |= wm_handler_ui_call(C, handler, event, always_pass);
}
}
- else if (handler->type == WM_HANDLER_FILESELECT) {
- if (!wm->is_interface_locked) {
- /* screen context changes here */
- action |= wm_handler_fileselect_call(C, handlers, handler, event);
- }
- }
- else if (handler->dropboxes) {
+ else if (handler_base->type == WM_HANDLER_TYPE_DROPBOX) {
+ wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base;
if (!wm->is_interface_locked && event->type == EVT_DROP) {
wmDropBox *drop = handler->dropboxes->first;
for (; drop; drop = drop->next) {
@@ -2424,17 +2536,19 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
}
}
}
- else if (handler->gizmo_map) {
+ else if (handler_base->type == WM_HANDLER_TYPE_GIZMO) {
+ wmEventHandler_Gizmo *handler = (wmEventHandler_Gizmo *)handler_base;
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
wmGizmoMap *gzmap = handler->gizmo_map;
+ BLI_assert(gzmap != NULL);
wmGizmo *gz = wm_gizmomap_highlight_get(gzmap);
if (region->gizmo_map != handler->gizmo_map) {
WM_gizmomap_tag_refresh(handler->gizmo_map);
}
- wm_gizmomap_handler_context(C, handler);
+ wm_gizmomap_handler_context_gizmo(C, handler);
wm_region_mouse_co(C, event);
/* handle gizmo highlighting */
@@ -2498,9 +2612,6 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
PRINT("pass\n");
for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
if (wm_eventmatch(event, kmi)) {
- struct wmEventHandler_KeymapFn keymap_callback = handler->keymap_callback;
- wmOperator *op = handler->op;
-
PRINT("%s: item matched '%s'\n", __func__, kmi->idname);
/* weak, but allows interactive callback to not use rawkey */
@@ -2509,17 +2620,11 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
CTX_wm_gizmo_group_set(C, gzgroup);
/* handler->op is called later, we want keymap op to be triggered here */
- handler->op = NULL;
- action |= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr);
- handler->op = op;
+ action |= wm_handler_operator_call(C, handlers, handler_base, event, kmi->ptr);
CTX_wm_gizmo_group_set(C, NULL);
if (action & WM_HANDLER_BREAK) {
- if (keymap_callback.handle_post_fn != NULL) {
- keymap_callback.handle_post_fn(keymap, kmi, keymap_callback.user_data);
- }
-
if (G.debug & (G_DEBUG_EVENTS | G_DEBUG_HANDLERS)) {
printf("%s: handled - and pass on! '%s'\n",
__func__, kmi->idname);
@@ -2558,14 +2663,22 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
/* restore the area */
CTX_wm_area_set(C, area);
CTX_wm_region_set(C, region);
-
- if (handler->op) {
- action |= wm_handler_operator_call(C, handlers, handler, event, NULL);
+ }
+ else if (handler_base->type == WM_HANDLER_TYPE_OP) {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+ if (handler->is_fileselect) {
+ if (!wm->is_interface_locked) {
+ /* screen context changes here */
+ action |= wm_handler_fileselect_call(C, handlers, handler, event);
+ }
+ }
+ else {
+ action |= wm_handler_operator_call(C, handlers, handler_base, event, NULL);
}
}
else {
- /* modal, swallows all */
- action |= wm_handler_operator_call(C, handlers, handler, event, NULL);
+ /* Unreachable (handle all types above). */
+ BLI_assert(0);
}
if (action & WM_HANDLER_BREAK) {
@@ -2585,10 +2698,10 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
/* 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) {
- BLI_remlink(handlers, handler);
- wm_event_free_handler(handler);
+ if (BLI_findindex(handlers, handler_base) != -1) { /* could be freed already by regular modal ops */
+ if (handler_base->flag & WM_HANDLER_DO_FREE) {
+ BLI_remlink(handlers, handler_base);
+ wm_event_free_handler(handler_base);
}
}
}
@@ -2853,45 +2966,6 @@ static bool wm_event_pie_filter(wmWindow *win, const wmEvent *event)
}
}
-#ifdef USE_WORKSPACE_TOOL
-static void wm_event_temp_tool_handler_apply(
- bContext *C, ScrArea *sa, ARegion *ar, wmEventHandler *sneaky_handler)
-{
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL;
- if (tref_rt && tref_rt->keymap[0]) {
- wmKeyMap *km = WM_keymap_find_all_spaceid_or_empty(
- C, tref_rt->keymap, sa->spacetype, RGN_TYPE_WINDOW);
- /* We shouldn't use keymaps from unrelated spaces. */
- if (km != NULL) {
- // printf("Keymap: '%s' -> '%s'\n", tref_rt->keymap, sa->runtime.tool->idname);
- sneaky_handler->keymap = km;
- sneaky_handler->keymap_tool = sa->runtime.tool;
-
- /* Handle widgets first. */
- wmEventHandler *handler_last = ar->handlers.last;
- while (handler_last && handler_last->gizmo_map == NULL) {
- handler_last = handler_last->prev;
- }
- /* Head of list or after last gizmo. */
- BLI_insertlinkafter(&ar->handlers, handler_last, sneaky_handler);
- }
- else {
- printf("Keymap: '%s' not found for tool '%s'\n", tref_rt->keymap, sa->runtime.tool->idname);
- }
- }
- }
-}
-
-static void wm_event_temp_tool_handler_clear(
- bContext *UNUSED(C), ScrArea *UNUSED(sa), ARegion *ar, wmEventHandler *sneaky_handler)
-{
- if (sneaky_handler->keymap) {
- BLI_remlink(&ar->handlers, sneaky_handler);
- }
-}
-#endif /* USE_WORKSPACE_TOOL */
-
/* called in main loop */
/* goes over entire hierarchy: events -> window -> screen -> area -> region */
void wm_event_do_handlers(bContext *C)
@@ -3064,27 +3138,8 @@ void wm_event_do_handlers(bContext *C)
}
}
-#ifdef USE_WORKSPACE_TOOL
- /* How to solve properly?
- *
- * Handlers are stored in each region,
- * however the tool-system swaps keymaps often and isn't stored
- * per region.
- *
- * Need to investigate how this could be done better.
- * We might need to add a more dynamic handler type that uses a callback
- * to fetch its current keymap.
- */
- wmEventHandler sneaky_handler = {NULL};
- wm_event_temp_tool_handler_apply(C, sa, ar, &sneaky_handler);
-#endif /* USE_WORKSPACE_TOOL */
-
action |= wm_handlers_do(C, event, &ar->handlers);
-#ifdef USE_WORKSPACE_TOOL
- wm_event_temp_tool_handler_clear(C, sa, ar, &sneaky_handler);
-#endif /* USE_WORKSPACE_TOOL */
-
/* fileread case (python), [#29489] */
if (CTX_wm_window(C) == NULL)
return;
@@ -3190,7 +3245,6 @@ void WM_event_fileselect_event(wmWindowManager *wm, void *ophandle, int eventval
*/
void WM_event_add_fileselect(bContext *C, wmOperator *op)
{
- wmEventHandler *handler, *handlernext;
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
@@ -3198,10 +3252,12 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
UI_popup_handlers_remove_all(C, &win->modalhandlers);
/* only allow 1 file selector open per window */
- for (handler = win->modalhandlers.first; handler; handler = handlernext) {
- handlernext = handler->next;
-
- if (handler->type == WM_HANDLER_FILESELECT) {
+ LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, &win->modalhandlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_OP) {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+ if (handler->is_fileselect == false) {
+ continue;
+ }
bScreen *screen = CTX_wm_screen(C);
bool cancel_handler = true;
@@ -3226,12 +3282,13 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
}
}
- handler = MEM_callocN(sizeof(wmEventHandler), "fileselect handler");
+ wmEventHandler_Op *handler = MEM_callocN(sizeof(*handler), __func__);
+ handler->head.type = WM_HANDLER_TYPE_OP;
- handler->type = WM_HANDLER_FILESELECT;
+ handler->is_fileselect = true;
handler->op = op;
- handler->op_area = CTX_wm_area(C);
- handler->op_region = CTX_wm_region(C);
+ handler->context.area = CTX_wm_area(C);
+ handler->context.region = CTX_wm_region(C);
BLI_addhead(&win->modalhandlers, handler);
@@ -3252,9 +3309,10 @@ static void WM_event_set_handler_flag(wmEventHandler *handler, int flag)
}
#endif
-wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
+wmEventHandler_Op *WM_event_add_modal_handler(bContext *C, wmOperator *op)
{
- wmEventHandler *handler = MEM_callocN(sizeof(wmEventHandler), "event modal handler");
+ wmEventHandler_Op *handler = MEM_callocN(sizeof(*handler), __func__);
+ handler->head.type = WM_HANDLER_TYPE_OP;
wmWindow *win = CTX_wm_window(C);
/* operator was part of macro */
@@ -3264,12 +3322,13 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
/* mother macro opm becomes the macro element */
handler->op->opm = op;
}
- else
+ else {
handler->op = op;
+ }
- handler->op_area = CTX_wm_area(C); /* means frozen screen context for modal handlers! */
- handler->op_region = CTX_wm_region(C);
- handler->op_region_type = handler->op_region ? handler->op_region->regiontype : -1;
+ handler->context.area = CTX_wm_area(C); /* means frozen screen context for modal handlers! */
+ handler->context.region = CTX_wm_region(C);
+ handler->context.region_type = handler->context.region ? handler->context.region->regiontype : -1;
BLI_addhead(&win->modalhandlers, handler);
@@ -3286,10 +3345,13 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
*/
void WM_event_modal_handler_area_replace(wmWindow *win, const ScrArea *old_area, ScrArea *new_area)
{
- for (wmEventHandler *handler = win->modalhandlers.first; handler; handler = handler->next) {
- /* fileselect handler is quite special... it needs to keep old area stored in handler, so don't change it */
- if ((handler->op_area == old_area) && (handler->type != WM_HANDLER_FILESELECT)) {
- handler->op_area = new_area;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_OP) {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+ /* fileselect handler is quite special... it needs to keep old area stored in handler, so don't change it */
+ if ((handler->context.area == old_area) && (handler->is_fileselect == false)) {
+ handler->context.area = new_area;
+ }
}
}
}
@@ -3300,104 +3362,163 @@ void WM_event_modal_handler_area_replace(wmWindow *win, const ScrArea *old_area,
*/
void WM_event_modal_handler_region_replace(wmWindow *win, const ARegion *old_region, ARegion *new_region)
{
- for (wmEventHandler *handler = win->modalhandlers.first; handler; handler = handler->next) {
- if (handler->op_region == old_region) {
- handler->op_region = new_region;
- handler->op_region_type = new_region ? new_region->regiontype : RGN_TYPE_WINDOW;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_OP) {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+ if (handler->context.region == old_region) {
+ handler->context.region = new_region;
+ handler->context.region_type = new_region ? new_region->regiontype : RGN_TYPE_WINDOW;
+ }
}
}
}
-wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
+wmEventHandler_Keymap *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
{
- wmEventHandler *handler;
-
if (!keymap) {
CLOG_WARN(WM_LOG_HANDLERS, "called with NULL keymap");
return NULL;
}
/* only allow same keymap once */
- for (handler = handlers->first; handler; handler = handler->next)
- if (handler->keymap == keymap)
- return handler;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_KEYMAP) {
+ wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base;
+ if (handler->keymap == keymap) {
+ return handler;
+ }
+ }
+ }
- handler = MEM_callocN(sizeof(wmEventHandler), "event keymap handler");
+ wmEventHandler_Keymap *handler = MEM_callocN(sizeof(*handler), __func__);
+ handler->head.type = WM_HANDLER_TYPE_KEYMAP;
BLI_addtail(handlers, handler);
handler->keymap = keymap;
return handler;
}
-/* priorities not implemented yet, for time being just insert in begin of list */
-wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int UNUSED(priority))
+/** Follow #wmEventHandler_KeymapDynamicFn signiture. */
+wmKeyMap *WM_event_get_keymap_from_toolsystem(wmWindowManager *wm, wmEventHandler_Keymap *handler)
{
- wmEventHandler *handler;
+ ScrArea *sa = handler->dynamic.user_data;
+ handler->keymap_tool = NULL;
+ bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL;
+ if (tref_rt && tref_rt->keymap[0]) {
+ wmKeyMap *km = WM_keymap_list_find_spaceid_or_empty(
+ &wm->userconf->keymaps, tref_rt->keymap, sa->spacetype, RGN_TYPE_WINDOW);
+ /* We shouldn't use keymaps from unrelated spaces. */
+ if (km != NULL) {
+ handler->keymap_tool = sa->runtime.tool;
+ return km;
+ }
+ else {
+ printf("Keymap: '%s' not found for tool '%s'\n", tref_rt->keymap, sa->runtime.tool->idname);
+ }
+ }
+ return NULL;
+}
+
+struct wmEventHandler_Keymap *WM_event_add_keymap_handler_dynamic(
+ ListBase *handlers, wmEventHandler_KeymapDynamicFn *keymap_fn, void *user_data)
+{
+ if (!keymap_fn) {
+ CLOG_WARN(WM_LOG_HANDLERS, "called with NULL keymap_fn");
+ return NULL;
+ }
+
+ /* only allow same keymap once */
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_KEYMAP) {
+ wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base;
+ if (handler->dynamic.keymap_fn == keymap_fn) {
+ /* Maximizing the view needs to update the area. */
+ handler->dynamic.user_data = user_data;
+ return handler;
+ }
+ }
+ }
+
+ wmEventHandler_Keymap *handler = MEM_callocN(sizeof(*handler), __func__);
+ handler->head.type = WM_HANDLER_TYPE_KEYMAP;
+ BLI_addtail(handlers, handler);
+ handler->dynamic.keymap_fn = keymap_fn;
+ handler->dynamic.user_data = user_data;
+
+ return handler;
+}
+/* priorities not implemented yet, for time being just insert in begin of list */
+wmEventHandler_Keymap *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int UNUSED(priority))
+{
WM_event_remove_keymap_handler(handlers, keymap);
- handler = MEM_callocN(sizeof(wmEventHandler), "event keymap handler");
+ wmEventHandler_Keymap *handler = MEM_callocN(sizeof(*handler), "event keymap handler");
+ handler->head.type = WM_HANDLER_TYPE_KEYMAP;
+
BLI_addhead(handlers, handler);
handler->keymap = keymap;
return handler;
}
-wmEventHandler *WM_event_add_keymap_handler_bb(ListBase *handlers, wmKeyMap *keymap, const rcti *bblocal, const rcti *bbwin)
+wmEventHandler_Keymap *WM_event_add_keymap_handler_bb(ListBase *handlers, wmKeyMap *keymap, const rcti *bblocal, const rcti *bbwin)
{
- wmEventHandler *handler = WM_event_add_keymap_handler(handlers, keymap);
+ wmEventHandler_Keymap *handler = WM_event_add_keymap_handler(handlers, keymap);
if (handler) {
- handler->bblocal = bblocal;
- handler->bbwin = bbwin;
+ handler->head.bblocal = bblocal;
+ handler->head.bbwin = bbwin;
}
return handler;
}
void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
{
- wmEventHandler *handler;
-
- for (handler = handlers->first; handler; handler = handler->next) {
- if (handler->keymap == keymap) {
- BLI_remlink(handlers, handler);
- wm_event_free_handler(handler);
- break;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_KEYMAP) {
+ wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base;
+ if (handler->keymap == keymap) {
+ BLI_remlink(handlers, handler);
+ wm_event_free_handler(&handler->head);
+ break;
+ }
}
}
}
-void WM_event_set_keymap_handler_callback(
- wmEventHandler *handler,
+void WM_event_set_keymap_handler_post_callback(
+ wmEventHandler_Keymap *handler,
void (keymap_tag)(wmKeyMap *keymap, wmKeyMapItem *kmi, void *user_data),
void *user_data)
{
- handler->keymap_callback.handle_post_fn = keymap_tag;
- handler->keymap_callback.user_data = user_data;
+ handler->post.post_fn = keymap_tag;
+ handler->post.user_data = user_data;
}
-wmEventHandler *WM_event_add_ui_handler(
+wmEventHandler_UI *WM_event_add_ui_handler(
const bContext *C, ListBase *handlers,
- wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
- void *userdata, const char flag)
+ wmUIHandlerFunc handle_fn, wmUIHandlerRemoveFunc remove_fn,
+ void *user_data, const char flag)
{
- wmEventHandler *handler = MEM_callocN(sizeof(wmEventHandler), "event ui handler");
- handler->ui_handle = ui_handle;
- handler->ui_remove = ui_remove;
- handler->ui_userdata = userdata;
+ wmEventHandler_UI *handler = MEM_callocN(sizeof(*handler), __func__);
+ handler->head.type = WM_HANDLER_TYPE_UI;
+ handler->handle_fn = handle_fn;
+ handler->remove_fn = remove_fn;
+ handler->user_data = user_data;
if (C) {
- handler->ui_area = CTX_wm_area(C);
- handler->ui_region = CTX_wm_region(C);
- handler->ui_menu = CTX_wm_menu(C);
+ handler->context.area = CTX_wm_area(C);
+ handler->context.region = CTX_wm_region(C);
+ handler->context.menu = CTX_wm_menu(C);
}
else {
- handler->ui_area = NULL;
- handler->ui_region = NULL;
- handler->ui_menu = NULL;
+ handler->context.area = NULL;
+ handler->context.region = NULL;
+ handler->context.menu = NULL;
}
BLI_assert((flag & WM_HANDLER_DO_FREE) == 0);
- handler->flag = flag;
+ handler->head.flag = flag;
BLI_addhead(handlers, handler);
@@ -3407,57 +3528,62 @@ wmEventHandler *WM_event_add_ui_handler(
/* 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 ui_handle, wmUIHandlerRemoveFunc ui_remove,
- void *userdata, const bool postpone)
+ wmUIHandlerFunc handle_fn, wmUIHandlerRemoveFunc remove_fn,
+ void *user_data, const bool postpone)
{
- wmEventHandler *handler;
-
- for (handler = handlers->first; handler; handler = handler->next) {
- if ((handler->ui_handle == ui_handle) &&
- (handler->ui_remove == ui_remove) &&
- (handler->ui_userdata == userdata))
- {
- /* handlers will be freed in wm_handlers_do() */
- if (postpone) {
- handler->flag |= WM_HANDLER_DO_FREE;
- }
- else {
- BLI_remlink(handlers, handler);
- wm_event_free_handler(handler);
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_UI) {
+ wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base;
+ if ((handler->handle_fn == handle_fn) &&
+ (handler->remove_fn == remove_fn) &&
+ (handler->user_data == user_data))
+ {
+ /* handlers will be freed in wm_handlers_do() */
+ if (postpone) {
+ handler->head.flag |= WM_HANDLER_DO_FREE;
+ }
+ else {
+ BLI_remlink(handlers, handler);
+ wm_event_free_handler(&handler->head);
+ }
+ break;
}
- break;
}
}
}
void WM_event_free_ui_handler_all(
bContext *C, ListBase *handlers,
- wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove)
+ wmUIHandlerFunc handle_fn, wmUIHandlerRemoveFunc remove_fn)
{
- wmEventHandler *handler, *handler_next;
-
- for (handler = handlers->first; handler; handler = handler_next) {
- handler_next = handler->next;
- if ((handler->ui_handle == ui_handle) &&
- (handler->ui_remove == ui_remove))
- {
- ui_remove(C, handler->ui_userdata);
- BLI_remlink(handlers, handler);
- wm_event_free_handler(handler);
+ LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_UI) {
+ wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base;
+ if ((handler->handle_fn == handle_fn) &&
+ (handler->remove_fn == remove_fn))
+ {
+ remove_fn(C, handler->user_data);
+ BLI_remlink(handlers, handler);
+ wm_event_free_handler(&handler->head);
+ }
}
}
}
-wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
+wmEventHandler_Dropbox *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
{
- wmEventHandler *handler;
-
/* only allow same dropbox once */
- for (handler = handlers->first; handler; handler = handler->next)
- if (handler->dropboxes == dropboxes)
- return handler;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_DROPBOX) {
+ wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base;
+ if (handler->dropboxes == dropboxes) {
+ return handler;
+ }
+ }
+ }
- handler = MEM_callocN(sizeof(wmEventHandler), "dropbox handler");
+ wmEventHandler_Dropbox *handler = MEM_callocN(sizeof(*handler), __func__);
+ handler->head.type = WM_HANDLER_TYPE_DROPBOX;
/* dropbox stored static, no free or copy */
handler->dropboxes = dropboxes;
@@ -3469,14 +3595,12 @@ wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropb
/* XXX solution works, still better check the real cause (ton) */
void WM_event_remove_area_handler(ListBase *handlers, void *area)
{
- wmEventHandler *handler, *nexthandler;
-
- for (handler = handlers->first; handler; handler = nexthandler) {
- nexthandler = handler->next;
- if (handler->type != WM_HANDLER_FILESELECT) {
- if (handler->ui_area == area) {
+ LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_UI) {
+ wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base;
+ if (handler->context.area == area) {
BLI_remlink(handlers, handler);
- wm_event_free_handler(handler);
+ wm_event_free_handler(handler_base);
}
}
}
@@ -3670,7 +3794,7 @@ static int convert_key(GHOST_TKey key)
}
}
-static void wm_eventemulation(wmEvent *event)
+static void wm_eventemulation(wmEvent *event, bool test_only)
{
/* Store last mmb/rmb event value to make emulation work when modifier keys
* are released first. This really should be in a data structure somewhere. */
@@ -3683,13 +3807,19 @@ static void wm_eventemulation(wmEvent *event)
if (event->val == KM_PRESS && event->alt) {
event->type = MIDDLEMOUSE;
event->alt = 0;
- emulating_event = MIDDLEMOUSE;
+
+ if (!test_only) {
+ emulating_event = MIDDLEMOUSE;
+ }
}
#ifdef __APPLE__
else if (event->val == KM_PRESS && event->oskey) {
event->type = RIGHTMOUSE;
event->oskey = 0;
- emulating_event = RIGHTMOUSE;
+
+ if (!test_only) {
+ emulating_event = RIGHTMOUSE;
+ }
}
#endif
else if (event->val == KM_RELEASE) {
@@ -3702,7 +3832,10 @@ static void wm_eventemulation(wmEvent *event)
event->type = RIGHTMOUSE;
event->oskey = 0;
}
- emulating_event = EVENT_NONE;
+
+ if (!test_only) {
+ emulating_event = EVENT_NONE;
+ }
}
}
@@ -3813,9 +3946,11 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
/* 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 (ELEM(handler->type, WM_HANDLER_TYPE_UI, WM_HANDLER_TYPE_OP)) {
return NULL;
+ }
+ }
/* to desktop space */
mx += (int) (U.pixelsize * win->posx);
@@ -3886,6 +4021,10 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
{
wmWindow *owin;
+ if (UNLIKELY(G.f & G_FLAG_EVENT_SIMULATE)) {
+ return;
+ }
+
/* Having both, event and evt, can be highly confusing to work with, but is necessary for
* our current event system, so let's clear things up a bit:
* - data added to event only will be handled immediately, but will not be copied to the next event
@@ -3985,7 +4124,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
else
event.type = MIDDLEMOUSE;
- wm_eventemulation(&event);
+ wm_eventemulation(&event, false);
/* copy previous state to prev event state (two old!) */
evt->prevval = evt->val;
@@ -4045,7 +4184,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
memcpy(event.utf8_buf, kd->utf8_buf, sizeof(event.utf8_buf)); /* might be not null terminated*/
event.val = (type == GHOST_kEventKeyDown) ? KM_PRESS : KM_RELEASE;
- wm_eventemulation(&event);
+ wm_eventemulation(&event, false);
/* copy previous state to prev event state (two old!) */
evt->prevval = evt->val;
@@ -4386,20 +4525,34 @@ bool WM_event_is_ime_switch(const struct wmEvent *event)
/** \} */
+wmKeyMap *WM_event_get_keymap_from_handler(wmWindowManager *wm, wmEventHandler_Keymap *handler)
+{
+ wmKeyMap *keymap;
+ if (handler->dynamic.keymap_fn != NULL) {
+ keymap = handler->dynamic.keymap_fn(wm, handler);
+ BLI_assert(handler->keymap == NULL);
+ }
+ else {
+ keymap = WM_keymap_active(wm, handler->keymap);
+ BLI_assert(keymap != NULL);
+ }
+ return keymap;
+}
static wmKeyMapItem *wm_kmi_from_event(
bContext *C, wmWindowManager *wm,
ListBase *handlers, const wmEvent *event)
{
- for (wmEventHandler *handler = handlers->first; handler; handler = handler->next) {
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
/* during this loop, ui handlers for nested menus can tag multiple handlers free */
- if (handler->flag & WM_HANDLER_DO_FREE) {
+ if (handler_base->flag & WM_HANDLER_DO_FREE) {
/* pass */
}
- else if (handler_boundbox_test(handler, event)) { /* optional boundbox */
- if (handler->keymap) {
- wmKeyMap *keymap = WM_keymap_active(wm, handler->keymap);
- if (WM_keymap_poll(C, keymap)) {
+ else if (handler_boundbox_test(handler_base, event)) { /* optional boundbox */
+ if (handler_base->type == WM_HANDLER_TYPE_KEYMAP) {
+ wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base;
+ wmKeyMap *keymap = WM_event_get_keymap_from_handler(wm, handler);
+ if (keymap && WM_keymap_poll(C, keymap)) {
for (wmKeyMapItem *kmi = keymap->items.first; kmi; kmi = kmi->next) {
if (wm_eventmatch(event, kmi)) {
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 0);
@@ -4602,11 +4755,6 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win)
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
-#ifdef USE_WORKSPACE_TOOL
- wmEventHandler sneaky_handler = {NULL};
- wm_event_temp_tool_handler_apply(C, sa, ar, &sneaky_handler);
-#endif
-
ListBase *handlers[] = {
&ar->handlers,
&sa->handlers,
@@ -4623,6 +4771,7 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win)
wmEvent test_event = *win->eventstate;
test_event.type = event_data[data_index].event_type;
test_event.val = event_data[data_index].event_value;
+ wm_eventemulation(&test_event, true);
wmKeyMapItem *kmi = NULL;
for (int handler_index = 0; handler_index < ARRAY_SIZE(handlers); handler_index++) {
kmi = wm_kmi_from_event(C, wm, handlers[handler_index], &test_event);
@@ -4636,10 +4785,6 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win)
}
}
-#ifdef USE_WORKSPACE_TOOL
- wm_event_temp_tool_handler_clear(C, sa, ar, &sneaky_handler);
-#endif
-
if (memcmp(&cd_prev.text, &cd->text, sizeof(cd_prev.text)) != 0) {
ED_area_tag_redraw(sa_statusbar);
}
@@ -4660,14 +4805,17 @@ bool WM_window_modal_keymap_status_draw(
{
wmKeyMap *keymap = NULL;
wmOperator *op = NULL;
- for (wmEventHandler *handler = win->modalhandlers.first; handler; handler = handler->next) {
- if (handler->op) {
- /* 'handler->keymap' could be checked too, seems not to be used. */
- wmKeyMap *keymap_test = handler->op->type->modalkeymap;
- if (keymap_test && keymap_test->modal_items) {
- keymap = keymap_test;
- op = handler->op;
- break;
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_OP) {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+ if (handler->op != NULL) {
+ /* 'handler->keymap' could be checked too, seems not to be used. */
+ wmKeyMap *keymap_test = handler->op->type->modalkeymap;
+ if (keymap_test && keymap_test->modal_items) {
+ keymap = keymap_test;
+ op = handler->op;
+ break;
+ }
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index cc3c4ed235d..acc680014f4 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation 2007
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_files.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* User level access for blend file read/write, file-history and userprefs (including relevant operators).
*/
@@ -40,12 +34,15 @@
#include "zlib.h" /* wm_read_exotic() */
#ifdef WIN32
-# include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
+ /* Need to include windows.h so _WIN32_IE is defined. */
+# include <windows.h>
# ifndef _WIN32_IE
-# define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
+ /* Minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already. */
+# define _WIN32_IE 0x0400
# endif
-# include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
- * because 'near' is disabled through BLI_windstuff */
+ /* For SHGetSpecialFolderPath, has to be done before BLI_winstuff
+ * because 'near' is disabled through BLI_windstuff */
+# include <shlobj.h>
# include "BLI_winstuff.h"
#endif
@@ -181,7 +178,7 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
* (see T47632), so for now just handling this specific case here. */
CTX_wm_menu_set(C, NULL);
- ED_editors_exit(C);
+ ED_editors_exit(G_MAIN, true);
}
static void wm_window_substitute_old(wmWindowManager *oldwm, wmWindowManager *wm, wmWindow *oldwin, wmWindow *win)
@@ -357,8 +354,8 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
/* 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) {
- SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC);
+ if ((G.f & G_FLAG_SCRIPT_OVERRIDE_PREF) == 0) {
+ SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_FLAG_SCRIPT_AUTOEXEC);
}
/* avoid re-saving for every small change to our prefs, allow overrides */
@@ -432,15 +429,15 @@ static int wm_read_exotic(const char *name)
void WM_file_autoexec_init(const char *filepath)
{
- if (G.f & G_SCRIPT_OVERRIDE_PREF) {
+ if (G.f & G_FLAG_SCRIPT_OVERRIDE_PREF) {
return;
}
- if (G.f & G_SCRIPT_AUTOEXEC) {
+ if (G.f & G_FLAG_SCRIPT_AUTOEXEC) {
char path[FILE_MAX];
BLI_split_dir_part(filepath, path, sizeof(path));
if (BKE_autoexec_match(path)) {
- G.f &= ~G_SCRIPT_AUTOEXEC;
+ G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
}
}
}
@@ -450,7 +447,7 @@ void wm_file_read_report(bContext *C, Main *bmain)
ReportList *reports = NULL;
Scene *sce;
- for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+ for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->r.engine[0] &&
BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL)
{
@@ -488,12 +485,6 @@ static void wm_file_read_post(
CTX_wm_window_set(C, wm->windows.first);
- Main *bmain = CTX_data_main(C);
- DEG_on_visible_update(bmain, true);
- wm_event_do_depsgraph(C);
-
- ED_editors_init(C);
-
#ifdef WITH_PYTHON
if (is_startup_file) {
/* possible python hasn't been initialized */
@@ -526,12 +517,20 @@ static void wm_file_read_post(
WM_operatortype_last_properties_clear_all();
/* important to do before NULL'ing the context */
+ Main *bmain = CTX_data_main(C);
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_VERSION_UPDATE);
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_POST);
if (is_factory_startup) {
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_FACTORY_STARTUP_POST);
}
+ /* After load post, so for example the driver namespace can be filled
+ * before evaluating the depsgraph. */
+ DEG_on_visible_update(bmain, true);
+ wm_event_do_depsgraph(C);
+
+ ED_editors_init(C);
+
#if 1
WM_event_add_notifier(C, NC_WM | ND_FILEREAD, NULL);
#else
@@ -589,7 +588,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* we didn't succeed, now try to read Blender file */
if (retval == BKE_READ_EXOTIC_OK_BLEND) {
- int G_f = G.f;
+ const int G_f_orig = G.f;
ListBase wmbase;
/* put aside screens to match with persistent windows later */
@@ -617,9 +616,10 @@ bool WM_file_read(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) {
- const int flags_keep = (G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
- G.f = (G.f & ~flags_keep) | (G_f & flags_keep);
+ if (G.f != G_f_orig) {
+ const int flags_keep = G_FLAG_ALL_RUNTIME;
+ G.f &= G_FLAG_ALL_READFILE;
+ G.f = (G.f & ~flags_keep) | (G_f_orig & flags_keep);
}
/* match the read WM with current WM */
@@ -774,8 +774,8 @@ void wm_homefile_read(
/* options exclude eachother */
BLI_assert((use_factory_settings && filepath_startup_override) == 0);
- if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
- SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC);
+ if ((G.f & G_FLAG_SCRIPT_OVERRIDE_PREF) == 0) {
+ SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_FLAG_SCRIPT_AUTOEXEC);
}
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE);
@@ -1266,7 +1266,7 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo
* its handy for scripts to save to a predefined name without blender editing it */
/* send the OnSave event */
- for (li = bmain->library.first; li; li = li->id.next) {
+ for (li = bmain->libraries.first; li; li = li->id.next) {
if (BLI_path_cmp(li->filepath, filepath) == 0) {
BKE_reportf(reports, RPT_ERROR, "Cannot overwrite used library '%.240s'", filepath);
return ok;
@@ -1286,14 +1286,14 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo
/* operator now handles overwrite checks */
- if (G.fileflags & G_AUTOPACK) {
+ if (G.fileflags & G_FILE_AUTOPACK) {
packAll(bmain, reports, false);
}
/* don't forget not to return without! */
WM_cursor_wait(1);
- ED_editors_flush_edits(C, false);
+ ED_editors_flush_edits(bmain, false);
fileflags |= G_FILE_HISTORY; /* write file history */
@@ -1395,21 +1395,22 @@ void WM_autosave_init(wmWindowManager *wm)
void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(wt))
{
- wmWindow *win;
- wmEventHandler *handler;
char filepath[FILE_MAX];
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) {
- wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0);
- if (G.debug) {
- printf("Skipping auto-save, modal operator running, retrying in ten seconds...\n");
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_OP) {
+ wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+ if (handler->op) {
+ wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0);
+ if (G.debug) {
+ printf("Skipping auto-save, modal operator running, retrying in ten seconds...\n");
+ }
+ return;
}
- return;
}
}
}
@@ -1425,12 +1426,13 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
}
else {
/* save as regular blend file */
+ Main *bmain = CTX_data_main(C);
int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY);
- ED_editors_flush_edits(C, false);
+ ED_editors_flush_edits(bmain, false);
/* Error reporting into console */
- BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL);
+ BLO_write_file(bmain, filepath, fileflags, NULL, NULL);
}
/* do timer after file write, just in case file write takes a long time */
wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime * 60.0);
@@ -1492,12 +1494,12 @@ void wm_open_init_use_scripts(wmOperator *op, bool use_prefs)
{
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_scripts");
if (!RNA_property_is_set(op->ptr, prop)) {
- /* use G_SCRIPT_AUTOEXEC rather than the userpref because this means if
+ /* use G_FLAG_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. */
bool value = use_prefs ?
((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) :
- ((G.f & G_SCRIPT_AUTOEXEC) != 0);
+ ((G.f & G_FLAG_SCRIPT_AUTOEXEC) != 0);
RNA_property_boolean_set(op->ptr, prop, value);
}
@@ -1551,7 +1553,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op)
printf("Writing homefile: '%s' ", filepath);
- ED_editors_flush_edits(C, false);
+ ED_editors_flush_edits(bmain, false);
/* force save as regular blend file */
fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY);
@@ -1917,11 +1919,11 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
G.fileflags |= G_FILE_NO_UI;
if (RNA_boolean_get(op->ptr, "use_scripts"))
- G.f |= G_SCRIPT_AUTOEXEC;
+ G.f |= G_FLAG_SCRIPT_AUTOEXEC;
else
- G.f &= ~G_SCRIPT_AUTOEXEC;
+ G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
- success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_SCRIPT_AUTOEXEC));
+ success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_FLAG_SCRIPT_AUTOEXEC));
/* for file open also popup for warnings, not only errors */
BKE_report_print_level_set(op->reports, RPT_WARNING);
@@ -2020,12 +2022,12 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
wm_open_init_use_scripts(op, false);
if (RNA_boolean_get(op->ptr, "use_scripts"))
- G.f |= G_SCRIPT_AUTOEXEC;
+ G.f |= G_FLAG_SCRIPT_AUTOEXEC;
else
- G.f &= ~G_SCRIPT_AUTOEXEC;
+ G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
- success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_SCRIPT_AUTOEXEC));
+ success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_FLAG_SCRIPT_AUTOEXEC));
if (success) {
return OPERATOR_FINISHED;
@@ -2327,14 +2329,9 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *U
char path[FILE_MAX];
RNA_string_get(op->ptr, "filepath", path);
- if (RNA_boolean_get(op->ptr, "check_existing") && BLI_exists(path)) {
- ret = WM_operator_confirm_message_ex(C, op, IFACE_("Save Over?"), ICON_QUESTION, path);
- }
- else {
- ret = wm_save_as_mainfile_exec(C, op);
- /* Without this there is no feedback the file was saved. */
- BKE_reportf(op->reports, RPT_INFO, "Saved \"%s\"", BLI_path_basename(path));
- }
+ ret = wm_save_as_mainfile_exec(C, op);
+ /* Without this there is no feedback the file was saved. */
+ BKE_reportf(op->reports, RPT_INFO, "Saved \"%s\"", BLI_path_basename(path));
}
else {
WM_event_add_fileselect(C, op);
@@ -2424,7 +2421,7 @@ static uiBlock *block_create_autorun_warning(struct bContext *C, struct ARegion
uiItemS(layout);
PointerRNA pref_ptr;
- RNA_pointer_create(NULL, &RNA_PreferencesSystem, &U, &pref_ptr);
+ RNA_pointer_create(NULL, &RNA_PreferencesFilePaths, &U, &pref_ptr);
uiItemR(layout, &pref_ptr, "use_scripts_auto_execute", 0, IFACE_("Permanently allow execution of scripts"), ICON_NONE);
uiItemS(layout);
@@ -2463,16 +2460,16 @@ static uiBlock *block_create_autorun_warning(struct bContext *C, struct ARegion
void wm_test_autorun_warning(bContext *C)
{
/* Test if any auto-execution of scripts failed. */
- if ((G.f & G_SCRIPT_AUTOEXEC_FAIL) == 0) {
+ if ((G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL) == 0) {
return;
}
/* Only show the warning once. */
- if (G.f & G_SCRIPT_AUTOEXEC_FAIL_QUIET) {
+ if (G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET) {
return;
}
- G.f |= G_SCRIPT_AUTOEXEC_FAIL_QUIET;
+ G.f |= G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET;
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = (wm->winactive) ? wm->winactive : wm->windows.first;
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index 07ed7a8f59e..3b27d2199b6 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,20 +15,14 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_files_link.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Functions for dealing with append/link operators and helpers.
*/
-
#include <float.h>
#include <string.h>
#include <ctype.h>
@@ -46,8 +38,6 @@
#include "DNA_scene_types.h"
#include "DNA_windowmanager_types.h"
-
-
#include "BLI_blenlib.h"
#include "BLI_bitmap.h"
#include "BLI_linklist.h"
@@ -263,9 +253,7 @@ static void wm_link_do(
continue;
}
- new_id = BLO_library_link_named_part_ex(
- mainl, &bh, item->idcode, item->name, flag, bmain,
- scene, view_layer, v3d);
+ new_id = BLO_library_link_named_part_ex(mainl, &bh, item->idcode, item->name, flag);
if (new_id) {
/* If the link is successful, clear item's libs 'todo' flags.
@@ -747,7 +735,7 @@ static void lib_relocate_do(
ID *old_id = item->customdata;
if (old_id->us == 0) {
- BKE_libblock_free(bmain, old_id);
+ BKE_id_free(bmain, old_id);
}
}
@@ -760,7 +748,7 @@ static void lib_relocate_do(
id_next = id->next;
/* XXX That check may be a bit to generic/permissive? */
if (id->lib && (id->flag & LIB_TAG_PRE_EXISTING) && id->us == 0) {
- BKE_libblock_free(bmain, id);
+ BKE_id_free(bmain, id);
}
}
}
@@ -782,7 +770,7 @@ static void lib_relocate_do(
if (lib->id.tag & LIB_TAG_DOIT) {
id_us_clear_real(&lib->id);
if (lib->id.us == 0) {
- BKE_libblock_free(bmain, (ID *)lib);
+ BKE_id_free(bmain, (ID *)lib);
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 77734a361c1..c9853776902 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_gesture.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Gestures (cursor motions) creating, evaluating and drawing, shared between operators.
*/
@@ -123,6 +116,13 @@ void WM_gestures_remove(bContext *C)
WM_gesture_end(C, win->gesture.first);
}
+bool WM_gesture_is_modal_first(const wmGesture *gesture)
+{
+ if (gesture == NULL) {
+ return true;
+ }
+ return (gesture->is_active_prev == false);
+}
/* tweak and line gestures */
int wm_gesture_evaluate(wmGesture *gesture)
@@ -314,7 +314,7 @@ static void draw_filled_lasso(wmGesture *gt)
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
GPU_shader_bind(state.shader);
- GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
+ GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform_ensure(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(&state, rect.xmin, rect.ymin, w, h, GL_RED, GL_UNSIGNED_BYTE, GL_NEAREST, pixel_buf, 1.0f, 1.0f, NULL);
diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c
index 9b5f3b9f738..030cf15adfb 100644
--- a/source/blender/windowmanager/intern/wm_gesture_ops.c
+++ b/source/blender/windowmanager/intern/wm_gesture_ops.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_gesture_ops.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Default operator callbacks for use with gestures (border/circle/lasso/straightline).
* Operators themselves are defined elsewhere.
@@ -257,6 +251,7 @@ int WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
#endif
+ gesture->is_active_prev = gesture->is_active;
return OPERATOR_RUNNING_MODAL;
}
@@ -389,8 +384,8 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
else {
/* apply first click */
- gesture_circle_apply(C, op);
gesture->is_active = true;
+ gesture_circle_apply(C, op);
wm_gesture_tag_redraw(C);
}
break;
@@ -428,7 +423,7 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
#endif
-
+ gesture->is_active_prev = gesture->is_active;
return OPERATOR_RUNNING_MODAL;
}
@@ -661,6 +656,8 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
gesture_modal_end(C, op);
return OPERATOR_CANCELLED;
}
+
+ gesture->is_active_prev = gesture->is_active;
return OPERATOR_RUNNING_MODAL;
}
@@ -847,6 +844,7 @@ int WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *ev
}
}
+ gesture->is_active_prev = gesture->is_active;
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index e4ae9495c61..946e7c4a856 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_init_exit.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Manage initializing resources and correctly shutting down.
*/
@@ -159,7 +152,12 @@ static void wm_free_reports(bContext *C)
BKE_reports_clear(reports);
}
-bool wm_start_with_console = false; /* used in creator.c */
+static bool wm_start_with_console = false;
+
+void WM_init_state_start_with_console_set(bool value)
+{
+ wm_start_with_console = value;
+}
/**
* Since we cannot know in advance if we will require the draw manager
@@ -187,7 +185,6 @@ void WM_init_opengl(Main *bmain)
GPU_set_mipmap(bmain, true);
GPU_set_linear_mipmap(true);
GPU_set_anisotropic(bmain, U.anisotropic_filter);
- GPU_set_gpu_mipmapping(bmain, U.use_gpu_mipmap);
GPU_pass_cache_init();
@@ -227,7 +224,6 @@ void WM_init(bContext *C, int argc, const char **argv)
BKE_region_callback_free_gizmomap_set(wm_gizmomap_remove); /* screen.c */
BKE_region_callback_refresh_tag_gizmomap_set(WM_gizmomap_tag_refresh);
BKE_library_callback_remap_editor_id_reference_set(WM_main_remap_editor_id_reference); /* library.c */
- BKE_blender_callback_test_break_set(wm_window_testbreak); /* blender.c */
BKE_spacedata_callback_id_remap_set(ED_spacedata_id_remap); /* screen.c */
DEG_editors_set_update_cb(ED_render_id_flush_update,
ED_render_scene_update);
@@ -272,9 +268,10 @@ void WM_init(bContext *C, int argc, const char **argv)
WM_init_opengl(G_MAIN);
UI_init();
- BKE_studiolight_init();
}
+ BKE_studiolight_init();
+
ED_spacemacros_init();
/* note: there is a bug where python needs initializing before loading the
@@ -320,12 +317,7 @@ void WM_init(bContext *C, int argc, const char **argv)
}
#endif
- /* load last session, uses regular file reading so it has to be in end (after init py etc) */
- if (U.uiflag2 & USER_KEEP_SESSION) {
- /* calling WM_recover_last_session(C, NULL) has been moved to creator.c */
- /* that prevents loading both the kept session, and the file on the command line */
- }
- else {
+ {
Main *bmain = CTX_data_main(C);
/* note, logic here is from wm_file_read_post,
* call functions that depend on Python being initialized. */
@@ -438,17 +430,18 @@ void WM_exit_ext(bContext *C, const bool do_python)
if (!G.background) {
struct MemFile *undo_memfile = wm->undo_stack ? ED_undosys_stack_memfile_get_active(wm->undo_stack) : NULL;
- if ((U.uiflag2 & USER_KEEP_SESSION) || (undo_memfile != NULL)) {
+ if (undo_memfile != NULL) {
/* save the undo state as quit.blend */
+ Main *bmain = CTX_data_main(C);
char filename[FILE_MAX];
bool has_edited;
int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY);
BLI_make_file_string("/", filename, BKE_tempdir_base(), BLENDER_QUIT_FILE);
- has_edited = ED_editors_flush_edits(C, false);
+ has_edited = ED_editors_flush_edits(bmain, false);
- if ((has_edited && BLO_write_file(CTX_data_main(C), filename, fileflags, NULL, NULL)) ||
+ if ((has_edited && BLO_write_file(bmain, filename, fileflags, NULL, NULL)) ||
(undo_memfile && BLO_memfile_write_file(undo_memfile, filename)))
{
printf("Saved session recovery to '%s'\n", filename);
@@ -480,8 +473,10 @@ void WM_exit_ext(bContext *C, const bool do_python)
WM_uilisttype_free();
/* all non-screen and non-space stuff editors did, like editmode */
- if (C)
- ED_editors_exit(C);
+ if (C) {
+ Main *bmain = CTX_data_main(C);
+ ED_editors_exit(bmain, true);
+ }
ED_undosys_type_free();
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index cb627b465f4..5db809bcb7d 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_jobs.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Threaded job manager (high level job access).
*/
@@ -73,7 +66,6 @@
*
* When job is done:
* - it puts timer to sleep (or removes?)
- *
*/
struct wmJob {
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 6048309980a..16e4913a206 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -1,7 +1,4 @@
/*
- *
- * ***** 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
@@ -18,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_keymap.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Configurable key-maps - add/remove/find/compare/patch...
*/
@@ -1147,100 +1139,111 @@ char *WM_modalkeymap_operator_items_to_string_buf(
return ret;
}
-static wmKeyMapItem *wm_keymap_item_find_handlers(
- const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext),
+static wmKeyMapItem *wm_keymap_item_find_in_keymap(
+ wmKeyMap *keymap, const char *opname,
IDProperty *properties, const bool is_strict,
- const struct wmKeyMapItemFind_Params *params,
- wmKeyMap **r_keymap)
+ const struct wmKeyMapItemFind_Params *params)
{
- wmWindowManager *wm = CTX_wm_manager(C);
- wmEventHandler *handler;
- wmKeyMap *keymap;
- wmKeyMapItem *kmi;
-
- /* find keymap item in handlers */
- for (handler = handlers->first; handler; handler = handler->next) {
- keymap = WM_keymap_active(wm, handler->keymap);
-
- if (keymap && WM_keymap_poll((bContext *)C, keymap)) {
- for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
- /* skip disabled keymap items [T38447] */
- if (kmi->flag & KMI_INACTIVE) {
- continue;
- }
+ for (wmKeyMapItem *kmi = keymap->items.first; kmi; kmi = kmi->next) {
+ /* skip disabled keymap items [T38447] */
+ if (kmi->flag & KMI_INACTIVE) {
+ continue;
+ }
- bool kmi_match = false;
+ bool kmi_match = false;
- if (STREQ(kmi->idname, opname)) {
- if (properties) {
- /* example of debugging keymaps */
+ if (STREQ(kmi->idname, opname)) {
+ if (properties) {
+ /* example of debugging keymaps */
#if 0
- if (kmi->ptr) {
- if (STREQ("MESH_OT_rip_move", opname)) {
- printf("OPERATOR\n");
- IDP_print(properties);
- printf("KEYMAP\n");
- IDP_print(kmi->ptr->data);
- }
- }
+ if (kmi->ptr) {
+ if (STREQ("MESH_OT_rip_move", opname)) {
+ printf("OPERATOR\n");
+ IDP_print(properties);
+ printf("KEYMAP\n");
+ IDP_print(kmi->ptr->data);
+ }
+ }
#endif
- if (kmi->ptr && IDP_EqualsProperties_ex(properties, kmi->ptr->data, is_strict)) {
- kmi_match = true;
- }
- /* Debug only, helps spotting mismatches between menu entries and shortcuts! */
- else if (G.debug & G_DEBUG_WM) {
- if (is_strict && kmi->ptr) {
- wmOperatorType *ot = WM_operatortype_find(opname, true);
- if (ot) {
- /* make a copy of the properties and set unset ones to their default values. */
- PointerRNA opptr;
- IDProperty *properties_default = IDP_CopyProperty(kmi->ptr->data);
-
- RNA_pointer_create(NULL, ot->srna, properties_default, &opptr);
- WM_operator_properties_default(&opptr, true);
-
- if (IDP_EqualsProperties_ex(properties, properties_default, is_strict)) {
- char kmi_str[128];
- WM_keymap_item_to_string(kmi, false, kmi_str, sizeof(kmi_str));
- /* Note gievn properties could come from other things than menu entry... */
- printf("%s: Some set values in menu entry match default op values, "
- "this might not be desired!\n", opname);
- printf("\tkm: '%s', kmi: '%s'\n", keymap->idname, kmi_str);
+ if (kmi->ptr && IDP_EqualsProperties_ex(properties, kmi->ptr->data, is_strict)) {
+ kmi_match = true;
+ }
+ /* Debug only, helps spotting mismatches between menu entries and shortcuts! */
+ else if (G.debug & G_DEBUG_WM) {
+ if (is_strict && kmi->ptr) {
+ wmOperatorType *ot = WM_operatortype_find(opname, true);
+ if (ot) {
+ /* make a copy of the properties and set unset ones to their default values. */
+ PointerRNA opptr;
+ IDProperty *properties_default = IDP_CopyProperty(kmi->ptr->data);
+
+ RNA_pointer_create(NULL, ot->srna, properties_default, &opptr);
+ WM_operator_properties_default(&opptr, true);
+
+ if (IDP_EqualsProperties_ex(properties, properties_default, is_strict)) {
+ char kmi_str[128];
+ WM_keymap_item_to_string(kmi, false, kmi_str, sizeof(kmi_str));
+ /* Note gievn properties could come from other things than menu entry... */
+ printf("%s: Some set values in menu entry match default op values, "
+ "this might not be desired!\n", opname);
+ printf("\tkm: '%s', kmi: '%s'\n", keymap->idname, kmi_str);
#ifndef NDEBUG
#ifdef WITH_PYTHON
- printf("OPERATOR\n");
- IDP_print(properties);
- printf("KEYMAP\n");
- IDP_print(kmi->ptr->data);
+ printf("OPERATOR\n");
+ IDP_print(properties);
+ printf("KEYMAP\n");
+ IDP_print(kmi->ptr->data);
#endif
#endif
- printf("\n");
- }
-
- IDP_FreeProperty(properties_default);
- MEM_freeN(properties_default);
- }
+ printf("\n");
}
- }
- }
- else {
- kmi_match = true;
- }
- if (kmi_match) {
- if ((params == NULL) || params->filter_fn(keymap, kmi, params->user_data)) {
- if (r_keymap) {
- *r_keymap = keymap;
- }
- return kmi;
+ IDP_FreeProperty(properties_default);
+ MEM_freeN(properties_default);
}
}
}
}
+ else {
+ kmi_match = true;
+ }
+
+ if (kmi_match) {
+ if ((params == NULL) || params->filter_fn(keymap, kmi, params->user_data)) {
+ return kmi;
+ }
+ }
}
}
+ return NULL;
+}
+
+static wmKeyMapItem *wm_keymap_item_find_handlers(
+ const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext),
+ IDProperty *properties, const bool is_strict,
+ const struct wmKeyMapItemFind_Params *params,
+ wmKeyMap **r_keymap)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ /* find keymap item in handlers */
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
+ if (handler_base->type == WM_HANDLER_TYPE_KEYMAP) {
+ wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base;
+ wmKeyMap *keymap = WM_event_get_keymap_from_handler(wm, handler);
+ if (keymap && WM_keymap_poll((bContext *)C, keymap)) {
+ wmKeyMapItem *kmi = wm_keymap_item_find_in_keymap(
+ keymap, opname, properties, is_strict, params);
+ if (kmi != NULL) {
+ if (r_keymap) {
+ *r_keymap = keymap;
+ }
+ return kmi;
+ }
+ }
+ }
+ }
/* ensure un-initialized keymap is never used */
if (r_keymap) *r_keymap = NULL;
return NULL;
@@ -1444,6 +1447,21 @@ wmKeyMapItem *WM_key_event_operator(
r_keymap);
}
+wmKeyMapItem *WM_key_event_operator_from_keymap(
+ wmKeyMap *keymap, const char *opname, IDProperty *properties,
+ const short include_mask, const short exclude_mask)
+{
+ short user_data_mask[2] = {include_mask, exclude_mask};
+ bool use_mask = (include_mask != EVT_TYPE_MASK_ALL) || (exclude_mask != 0);
+ return wm_keymap_item_find_in_keymap(
+ keymap, opname, properties, true,
+ &(struct wmKeyMapItemFind_Params){
+ .filter_fn = use_mask ? kmi_filter_is_visible_type_mask : kmi_filter_is_visible,
+ .user_data = use_mask ? user_data_mask : NULL,
+ });
+}
+
+
bool WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
{
int k1type, k2type;
@@ -1568,7 +1586,8 @@ void WM_keyconfig_update(wmWindowManager *wm)
&wm->userconf->keymaps,
&wm->defaultconf->keymaps,
&wm->addonconf->keymaps,
- NULL};
+ NULL,
+ };
int i;
diff --git a/source/blender/windowmanager/intern/wm_keymap_utils.c b/source/blender/windowmanager/intern/wm_keymap_utils.c
index 412a35f2daa..b387cd0cfa8 100644
--- a/source/blender/windowmanager/intern/wm_keymap_utils.c
+++ b/source/blender/windowmanager/intern/wm_keymap_utils.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_keymap_utils.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Utilities to help define keymaps.
*/
@@ -170,7 +166,9 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
SpaceLink *sl = CTX_wm_space_data(C);
/* Window */
- if (STRPREFIX(opname, "WM_OT")) {
+ if (STRPREFIX(opname, "WM_OT") ||
+ STRPREFIX(opname, "ED_OT_undo"))
+ {
if (STREQ(opname, "WM_OT_tool_set_by_name")) {
km = WM_keymap_guess_from_context(C);
}
@@ -385,7 +383,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
case SPACE_VIEW3D:
km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
break;
- case SPACE_IPO:
+ case SPACE_GRAPH:
km = WM_keymap_find_all(C, "Graph Editor", sl->spacetype, 0);
break;
case SPACE_ACTION:
diff --git a/source/blender/windowmanager/intern/wm_menu_type.c b/source/blender/windowmanager/intern/wm_menu_type.c
index 020d08f35fa..76bd36885fd 100644
--- a/source/blender/windowmanager/intern/wm_menu_type.c
+++ b/source/blender/windowmanager/intern/wm_menu_type.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_menu_type.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Menu Registry.
*/
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index 4026eb0f91c..820123621f7 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,12 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_operator_props.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Generic re-usable property definitions and accessors for operators to share.
* (`WM_operator_properties_*` functions).
@@ -65,7 +61,7 @@ void WM_operator_properties_filesel(
{FILE_SHORTDISPLAY, "LIST_SHORT", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
{FILE_LONGDISPLAY, "LIST_LONG", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
{FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
if (flag & WM_FILESEL_FILEPATH)
@@ -153,7 +149,7 @@ void WM_operator_properties_select_action(wmOperatorType *ot, int default_action
{SEL_SELECT, "SELECT", 0, "Select", "Select all elements"},
{SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"},
{SEL_INVERT, "INVERT", 0, "Invert", "Invert selection of all elements"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wm_operator_properties_select_action_ex(ot, default_action, select_actions);
@@ -167,7 +163,7 @@ void WM_operator_properties_select_action_simple(wmOperatorType *ot, int default
static const EnumPropertyItem select_actions[] = {
{SEL_SELECT, "SELECT", 0, "Select", "Select all elements"},
{SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wm_operator_properties_select_action_ex(ot, default_action, select_actions);
@@ -276,7 +272,7 @@ void WM_operator_properties_select_operation(wmOperatorType *ot)
{SEL_OP_SUB, "SUB", 0, "Subtract", ""},
{SEL_OP_XOR, "XOR", 0, "Difference", ""},
{SEL_OP_AND, "AND", 0, "Intersect", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop = RNA_def_enum(ot->srna, "mode", select_mode_items, SEL_OP_SET, "Mode", "");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
@@ -289,7 +285,7 @@ void WM_operator_properties_select_operation_simple(wmOperatorType *ot)
{SEL_OP_SET, "SET", 0, "New", ""},
{SEL_OP_ADD, "ADD", 0, "Add", ""},
{SEL_OP_SUB, "SUB", 0, "Subtract", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop = RNA_def_enum(ot->srna, "mode", select_mode_items, SEL_OP_SET, "Mode", "");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
@@ -307,28 +303,11 @@ void WM_operator_properties_gesture_box_zoom(wmOperatorType *ot)
/**
* Use with #WM_gesture_lasso_invoke
*/
-void WM_operator_properties_gesture_lasso_ex(wmOperatorType *ot, bool deselect, bool extend)
+void WM_operator_properties_gesture_lasso(wmOperatorType *ot)
{
PropertyRNA *prop;
prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
-
- if (deselect) {
- RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Deselect rather than select items");
- }
- if (extend) {
- RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection instead of deselecting everything first");
- }
-}
-
-void WM_operator_properties_gesture_lasso(wmOperatorType *ot)
-{
- WM_operator_properties_gesture_lasso_ex(ot, false, false);
-}
-
-void WM_operator_properties_gesture_lasso_select(wmOperatorType *ot)
-{
- WM_operator_properties_gesture_lasso_ex(ot, true, true);
}
/**
@@ -357,7 +336,7 @@ void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
/**
* Use with #WM_gesture_circle_invoke
*/
-void WM_operator_properties_gesture_circle_ex(wmOperatorType *ot, bool deselect)
+void WM_operator_properties_gesture_circle(wmOperatorType *ot)
{
PropertyRNA *prop;
const int radius_default = 25;
@@ -370,21 +349,6 @@ void WM_operator_properties_gesture_circle_ex(wmOperatorType *ot, bool deselect)
prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
-
- if (deselect) {
- prop = RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Deselect rather than select items");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- }
-}
-
-void WM_operator_properties_gesture_circle(wmOperatorType *ot)
-{
- WM_operator_properties_gesture_circle_ex(ot, false);
-}
-
-void WM_operator_properties_gesture_circle_select(wmOperatorType *ot)
-{
- WM_operator_properties_gesture_circle_ex(ot, true);
}
void WM_operator_properties_mouse_select(wmOperatorType *ot)
diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c
index 54a09f7ce9a..76586ee2a0b 100644
--- a/source/blender/windowmanager/intern/wm_operator_type.c
+++ b/source/blender/windowmanager/intern/wm_operator_type.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_operator_type.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Operator Registry.
*/
@@ -413,12 +409,12 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* if new operator is modal and also added its own handler */
if (retval & OPERATOR_RUNNING_MODAL && op->opm != opm) {
wmWindow *win = CTX_wm_window(C);
- wmEventHandler *handler;
+ wmEventHandler_Op *handler;
- handler = BLI_findptr(&win->modalhandlers, op, offsetof(wmEventHandler, op));
+ handler = BLI_findptr(&win->modalhandlers, op, offsetof(wmEventHandler_Op, op));
if (handler) {
BLI_remlink(&win->modalhandlers, handler);
- wm_event_free_handler(handler);
+ wm_event_free_handler(&handler->head);
}
/* if operator is blocking, grab cursor
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 60a26cc2f77..a6e0c86b5fd 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_operators.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Functions for dealing with wmOperator, adding, removing, calling
* as well as some generic operators and shared operator properties.
@@ -65,7 +58,6 @@
#include "BLI_dynstr.h" /*for WM_operator_pystring */
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
#include "BLO_readfile.h"
@@ -485,7 +477,7 @@ static const char *wm_context_member_from_ptr(bContext *C, const PointerRNA *ptr
CTX_TEST_SPACE_TYPE(SPACE_IMAGE, "space_data.uv_editor", space_data);
CTX_TEST_SPACE_TYPE(SPACE_VIEW3D, "space_data.fx_settings", &(CTX_wm_view3d(C)->fx_settings));
CTX_TEST_SPACE_TYPE(SPACE_NLA, "space_data.dopesheet", CTX_wm_space_nla(C)->ads);
- CTX_TEST_SPACE_TYPE(SPACE_IPO, "space_data.dopesheet", CTX_wm_space_graph(C)->ads);
+ CTX_TEST_SPACE_TYPE(SPACE_GRAPH, "space_data.dopesheet", CTX_wm_space_graph(C)->ads);
CTX_TEST_SPACE_TYPE(SPACE_ACTION, "space_data.dopesheet", &(CTX_wm_space_action(C)->ads));
CTX_TEST_SPACE_TYPE(SPACE_FILE, "space_data.params", CTX_wm_space_file(C)->params);
break;
@@ -1221,8 +1213,8 @@ int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
{
wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_ui_popup");
data->op = op;
- data->width = width;
- data->height = height;
+ data->width = width * U.dpi_fac;
+ data->height = height * U.dpi_fac;
data->free_op = true; /* if this runs and gets registered we may want not to free it */
UI_popup_block_ex(C, wm_operator_ui_create, NULL, wm_operator_ui_popup_cancel, data, op);
return OPERATOR_RUNNING_MODAL;
@@ -1812,18 +1804,19 @@ static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
static int wm_exit_blender_exec(bContext *C, wmOperator *UNUSED(op))
{
- wm_quit_with_optional_confirmation_prompt(C, CTX_wm_window(C));
+ wm_exit_schedule_delayed(C);
return OPERATOR_FINISHED;
}
-static int wm_exit_blender_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int wm_exit_blender_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
{
- if (U.uiflag & USER_QUIT_PROMPT) {
- return wm_exit_blender_exec(C, op);
+ if (U.uiflag & USER_SAVE_PROMPT) {
+ wm_quit_with_optional_confirmation_prompt(C, CTX_wm_window(C));
}
else {
- return WM_operator_confirm(C, op, event);
+ wm_exit_schedule_delayed(C);
}
+ return OPERATOR_FINISHED;
}
static void WM_OT_quit_blender(wmOperatorType *ot)
@@ -2192,14 +2185,14 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
GPU_matrix_push();
/* draw original angle line */
- GPU_matrix_rotate_2d(RAD2DEGF(rc->initial_value));
+ GPU_matrix_rotate_3f(RAD2DEGF(rc->initial_value), 0.0f, 0.0f, 1.0f);
immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
immEnd();
/* draw new angle line */
- GPU_matrix_rotate_2d(RAD2DEGF(rc->current_value - rc->initial_value));
+ GPU_matrix_rotate_3f(RAD2DEGF(rc->current_value - rc->initial_value), 0.0f, 0.0f, 1.0f);
immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
@@ -2797,7 +2790,7 @@ static const EnumPropertyItem redraw_timer_type_items[] = {
{eRTAnimationStep, "ANIM_STEP", 0, "Anim Step", "Animation Steps"},
{eRTAnimationPlay, "ANIM_PLAY", 0, "Anim Play", "Animation Playback"},
{eRTUndo, "UNDO", 0, "Undo/Redo", "Undo/Redo"},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
@@ -2991,7 +2984,7 @@ static int previews_id_ensure_callback(void *userdata, ID *UNUSED(self_id), ID *
static int previews_ensure_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
- ListBase *lb[] = {&bmain->mat, &bmain->tex, &bmain->image, &bmain->world, &bmain->lamp, NULL};
+ ListBase *lb[] = {&bmain->materials, &bmain->textures, &bmain->images, &bmain->worlds, &bmain->lights, NULL};
PreviewsIDEnsureData preview_id_data;
Scene *scene;
ID *id;
@@ -3004,7 +2997,7 @@ static int previews_ensure_exec(bContext *C, wmOperator *UNUSED(op))
}
preview_id_data.C = C;
- for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
preview_id_data.scene = scene;
id = (ID *)scene;
@@ -3050,14 +3043,14 @@ static const EnumPropertyItem preview_id_type_items[] = {
#if 0 /* XXX TODO */
{FILTER_ID_BR, "BRUSH", 0, "Brushes", ""},
#endif
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
static int previews_clear_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- ListBase *lb[] = {&bmain->object, &bmain->collection,
- &bmain->mat, &bmain->world, &bmain->lamp, &bmain->tex, &bmain->image, NULL};
+ ListBase *lb[] = {&bmain->objects, &bmain->collections,
+ &bmain->materials, &bmain->worlds, &bmain->lights, &bmain->textures, &bmain->images, NULL};
int i;
const int id_filters = RNA_enum_get(op->ptr, "id_type");
@@ -3225,7 +3218,7 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""},
{GESTURE_MODAL_NOP, "NOP", 0, "No Operation", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
/* WARNING - name is incorrect, use for non-3d views */
@@ -3254,7 +3247,7 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
{GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Straight Line");
@@ -3279,7 +3272,7 @@ static void gesture_box_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
{GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""},
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Box");
@@ -3310,7 +3303,7 @@ static void gesture_box_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_assign(keymap, "CLIP_OT_graph_select_box");
WM_modalkeymap_assign(keymap, "MASK_OT_select_box");
WM_modalkeymap_assign(keymap, "VIEW2D_OT_zoom_border");
-// WM_modalkeymap_assign(keymap, "VIEW3D_OT_clip_border"); /* TODO */
+ WM_modalkeymap_assign(keymap, "VIEW3D_OT_clip_border");
WM_modalkeymap_assign(keymap, "VIEW3D_OT_render_border");
WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_box");
WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom_border"); /* XXX TODO: zoom border should perhaps map rightmouse to zoom out instead of in+cancel */
@@ -3327,7 +3320,7 @@ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_IN, "IN", 0, "In", ""},
{GESTURE_MODAL_OUT, "OUT", 0, "Out", ""},
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
- {0, NULL, 0, NULL, NULL}
+ {0, NULL, 0, NULL, NULL},
};
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Zoom Border");
@@ -3397,7 +3390,7 @@ static const EnumPropertyItem *rna_id_itemf(
/* can add more as needed */
const EnumPropertyItem *RNA_action_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->action.first : NULL, false, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->actions.first : NULL, false, NULL, NULL);
}
#if 0 /* UNUSED */
const EnumPropertyItem *RNA_action_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
@@ -3408,51 +3401,51 @@ const EnumPropertyItem *RNA_action_local_itemf(bContext *C, PointerRNA *ptr, Pro
const EnumPropertyItem *RNA_collection_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->collection.first : NULL, false, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->collections.first : NULL, false, NULL, NULL);
}
const EnumPropertyItem *RNA_collection_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->collection.first : NULL, true, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->collections.first : NULL, true, NULL, NULL);
}
const EnumPropertyItem *RNA_image_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->image.first : NULL, false, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->images.first : NULL, false, NULL, NULL);
}
const EnumPropertyItem *RNA_image_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->image.first : NULL, true, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->images.first : NULL, true, NULL, NULL);
}
const EnumPropertyItem *RNA_scene_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, false, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->scenes.first : NULL, false, NULL, NULL);
}
const EnumPropertyItem *RNA_scene_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, true, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->scenes.first : NULL, true, NULL, NULL);
}
const EnumPropertyItem *RNA_scene_without_active_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
Scene *scene_active = C ? CTX_data_scene(C) : NULL;
return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, true,
+ C, ptr, r_free, C ? (ID *)CTX_data_main(C)->scenes.first : NULL, true,
rna_id_enum_filter_single, scene_active);
}
const EnumPropertyItem *RNA_movieclip_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->movieclip.first : NULL, false, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->movieclips.first : NULL, false, NULL, NULL);
}
const EnumPropertyItem *RNA_movieclip_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->movieclip.first : NULL, true, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->movieclips.first : NULL, true, NULL, NULL);
}
const EnumPropertyItem *RNA_mask_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->mask.first : NULL, false, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->masks.first : NULL, false, NULL, NULL);
}
const EnumPropertyItem *RNA_mask_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->mask.first : NULL, true, NULL, NULL);
+ return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->masks.first : NULL, true, NULL, NULL);
}
diff --git a/source/blender/windowmanager/intern/wm_panel_type.c b/source/blender/windowmanager/intern/wm_panel_type.c
index 2c541db55a6..5c0fd4ca520 100644
--- a/source/blender/windowmanager/intern/wm_panel_type.c
+++ b/source/blender/windowmanager/intern/wm_panel_type.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_panel_type.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Panel Registry.
*
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 6317cca8094..a8d75ac8fdb 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_playanim.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Animation player for image sequences & video's with sound support.
* Launched in a separate process from Blender's #RENDER_OT_play_rendered_anim
@@ -63,7 +55,6 @@
#include "BKE_image.h"
-#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "GPU_matrix.h"
@@ -181,7 +172,7 @@ typedef enum eWS_Qual {
WS_QUAL_LMOUSE = (1 << 16),
WS_QUAL_MMOUSE = (1 << 17),
WS_QUAL_RMOUSE = (1 << 18),
- WS_QUAL_MOUSE = (WS_QUAL_LMOUSE | WS_QUAL_MMOUSE | WS_QUAL_RMOUSE)
+ WS_QUAL_MOUSE = (WS_QUAL_LMOUSE | WS_QUAL_MMOUSE | WS_QUAL_RMOUSE),
} eWS_Qual;
static struct WindowStateGlobal {
@@ -215,30 +206,24 @@ static void playanim_event_qual_update(void)
/* Shift */
GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyLeftShift, &val);
- if (val) g_WS.qual |= WS_QUAL_LSHIFT;
- else g_WS.qual &= ~WS_QUAL_LSHIFT;
+ SET_FLAG_FROM_TEST(g_WS.qual, val, WS_QUAL_LSHIFT);
GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyRightShift, &val);
- if (val) g_WS.qual |= WS_QUAL_RSHIFT;
- else g_WS.qual &= ~WS_QUAL_RSHIFT;
+ SET_FLAG_FROM_TEST(g_WS.qual, val, WS_QUAL_RSHIFT);
/* Control */
GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyLeftControl, &val);
- if (val) g_WS.qual |= WS_QUAL_LCTRL;
- else g_WS.qual &= ~WS_QUAL_LCTRL;
+ SET_FLAG_FROM_TEST(g_WS.qual, val, WS_QUAL_LCTRL);
GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyRightControl, &val);
- if (val) g_WS.qual |= WS_QUAL_RCTRL;
- else g_WS.qual &= ~WS_QUAL_RCTRL;
+ SET_FLAG_FROM_TEST(g_WS.qual, val, WS_QUAL_RCTRL);
/* Alt */
GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyLeftAlt, &val);
- if (val) g_WS.qual |= WS_QUAL_LALT;
- else g_WS.qual &= ~WS_QUAL_LALT;
+ SET_FLAG_FROM_TEST(g_WS.qual, val, WS_QUAL_LALT);
GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyRightAlt, &val);
- if (val) g_WS.qual |= WS_QUAL_RALT;
- else g_WS.qual &= ~WS_QUAL_RALT;
+ SET_FLAG_FROM_TEST(g_WS.qual, val, WS_QUAL_RALT);
}
typedef struct PlayAnimPict {
@@ -930,7 +915,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
{
if (val == 0) break;
if (g_WS.qual & WS_QUAL_CTRL) {
- playanim_window_zoom(ps, 1.0f);
+ playanim_window_zoom(ps, 0.1f);
}
else {
if (swaptime > ps->fstep / 60.0) {
@@ -945,7 +930,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
{
if (val == 0) break;
if (g_WS.qual & WS_QUAL_CTRL) {
- playanim_window_zoom(ps, -1.0f);
+ playanim_window_zoom(ps, -0.1f);
}
else {
if (swaptime < ps->fstep / 5.0) {
@@ -1048,10 +1033,6 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
/* zoom always show entire image */
ps->zoom = MIN2(zoomx, zoomy);
- /* zoom steps of 2 for speed */
- ps->zoom = floor(ps->zoom + 0.5f);
- if (ps->zoom < 1.0f) ps->zoom = 1.0f;
-
glViewport(0, 0, ps->win_x, ps->win_y);
glScissor(0, 0, ps->win_x, ps->win_y);
@@ -1275,8 +1256,6 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
GHOST_AddEventConsumer(g_WS.ghost_system, consumer);
playanim_window_open("Blender:Anim", start_x, start_y, ibuf->x, ibuf->y);
-
- playanim_gl_matrix();
}
GHOST_GetMainDisplayDimensions(g_WS.ghost_system, &maxwinx, &maxwiny);
@@ -1306,6 +1285,12 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
glClearColor(0.1, 0.1, 0.1, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
+ int win_x, win_y;
+ playanim_window_get_size(&win_x, &win_y);
+ glViewport(0, 0, win_x, win_y);
+ glScissor(0, 0, win_x, win_y);
+ playanim_gl_matrix();
+
GHOST_SwapWindowBuffers(g_WS.ghost_window);
if (sfra == -1 || efra == -1) {
@@ -1555,6 +1540,8 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
GPU_shader_free_builtin_shaders();
+ immDeactivate();
+
if (g_WS.gpu_context) {
GPU_context_active_set(g_WS.gpu_context);
GPU_context_discard(g_WS.gpu_context);
@@ -1563,7 +1550,6 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
BLF_exit();
- immDeactivate();
GPU_exit();
GHOST_DisposeWindow(g_WS.ghost_system, g_WS.ghost_window);
diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index 6b6b3bc3cbb..68cbc9b59a7 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Dalai Felinto
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_stereo.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
@@ -39,7 +31,6 @@
#include "MEM_guardedalloc.h"
-#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "BIF_gl.h"
@@ -65,7 +56,7 @@
#include "UI_interface.h"
#include "UI_resources.h"
-static GPUInterlaceShader interlace_gpu_id_from_type(eStereo3dInterlaceType interlace_type)
+static eGPUInterlaceShader interlace_gpu_id_from_type(eStereo3dInterlaceType interlace_type)
{
switch (interlace_type) {
case S3D_INTERLACE_ROW:
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index ff3c712dae0..bf4288e549b 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,14 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * Contributor(s): 2007 Blender Foundation (refactor)
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_subwindow.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* OpenGL utilities for setting up 2D viewport for window and regions.
*/
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c
index 1d78e64cd0c..1c8bea19952 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_toolsystem.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Experimental tool-system>
*/
@@ -801,6 +797,8 @@ static const char *toolsystem_default_tool(const bToolKey *tkey)
case CTX_MODE_PARTICLE:
return "Comb";
+ case CTX_MODE_EDIT_TEXT:
+ return "Cursor";
}
break;
case SPACE_IMAGE:
@@ -884,6 +882,7 @@ void WM_toolsystem_do_msg_notify_tag_refresh(
.mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype),
};
WM_toolsystem_refresh(C, workspace, &tkey);
+ WM_toolsystem_refresh_screen_area(workspace, view_layer, sa);
}
IDProperty *WM_toolsystem_ref_properties_ensure_idprops(bToolRef *tref)
@@ -895,6 +894,13 @@ IDProperty *WM_toolsystem_ref_properties_ensure_idprops(bToolRef *tref)
return tref->properties;
}
+bool WM_toolsystem_ref_properties_get_ex(bToolRef *tref, const char *idname, StructRNA *type, PointerRNA *r_ptr)
+{
+ IDProperty *group = tref->properties;
+ IDProperty *prop = group ? IDP_GetPropertyFromGroup(group, idname) : NULL;
+ RNA_pointer_create(NULL, type, prop, r_ptr);
+ return (prop != NULL);
+}
void WM_toolsystem_ref_properties_ensure_ex(bToolRef *tref, const char *idname, StructRNA *type, PointerRNA *r_ptr)
{
diff --git a/source/blender/windowmanager/intern/wm_tooltip.c b/source/blender/windowmanager/intern/wm_tooltip.c
index b0d621c2e44..30332f57d8b 100644
--- a/source/blender/windowmanager/intern/wm_tooltip.c
+++ b/source/blender/windowmanager/intern/wm_tooltip.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_tooltip.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Manages a per-window tool-tip.
*/
diff --git a/source/blender/windowmanager/intern/wm_uilist_type.c b/source/blender/windowmanager/intern/wm_uilist_type.c
index f0ffa5905fc..c55f28e2d8d 100644
--- a/source/blender/windowmanager/intern/wm_uilist_type.c
+++ b/source/blender/windowmanager/intern/wm_uilist_type.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_uilist_type.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* UI List Registry.
*/
@@ -33,7 +29,6 @@
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
-#include "BKE_context.h"
#include "BKE_screen.h"
#include "WM_api.h"
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 281a556a62d..89b7e53a93a 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -18,14 +16,10 @@
* The Original Code is Copyright (C) 2007 Blender Foundation but based
* on ghostwinlay.c (C) 2001-2002 by NaN Holding BV
* All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2008
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_window.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*
* Window management, wrap GHOST.
*/
@@ -102,27 +96,37 @@
/* the global to talk to ghost */
static GHOST_SystemHandle g_system = NULL;
-typedef enum WinOverrideFlag {
+typedef enum eWinOverrideFlag {
WIN_OVERRIDE_GEOM = (1 << 0),
- WIN_OVERRIDE_WINSTATE = (1 << 1)
-} WinOverrideFlag;
+ WIN_OVERRIDE_WINSTATE = (1 << 1),
+} eWinOverrideFlag;
-/* set by commandline */
+#define GHOST_WINDOW_STATE_DEFAULT GHOST_kWindowStateMaximized
+
+/**
+ * Override defaults or startup file when #eWinOverrideFlag is set.
+ * These values are typically set by command line arguments.
+ */
static struct WMInitStruct {
/* window geometry */
int size_x, size_y;
int start_x, start_y;
int windowstate;
- WinOverrideFlag override_flag;
+ eWinOverrideFlag override_flag;
bool window_focus;
bool native_pixels;
-} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, true, true};
+} wm_init_state = {
+ .windowstate = GHOST_WINDOW_STATE_DEFAULT,
+ .window_focus = true,
+ .native_pixels = true,
+};
/* ******** win open & close ************ */
static void wm_window_set_drawable(wmWindowManager *wm, wmWindow *win, bool activate);
+static int wm_window_timer(const bContext *C);
/* XXX this one should correctly check for apple top header...
* done for Cocoa : returns window contents (and not frame) max size*/
@@ -469,8 +473,13 @@ void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win)
* here (this function gets called outside of normal event handling loop). */
CTX_wm_window_set(C, win);
- if ((U.uiflag & USER_QUIT_PROMPT) && !wm->file_saved && !G.background) {
- wm_confirm_quit(C);
+ if (U.uiflag & USER_SAVE_PROMPT) {
+ if (!wm->file_saved && !G.background) {
+ wm_confirm_quit(C);
+ }
+ else {
+ wm_exit_schedule_delayed(C);
+ }
}
else {
wm_exit_schedule_delayed(C);
@@ -599,9 +608,13 @@ void WM_window_set_dpi(wmWindow *win)
U.pixelsize = pixelsize;
U.dpi = dpi / pixelsize;
U.virtual_pixel = (pixelsize == 1) ? VIRTUAL_PIXEL_NATIVE : VIRTUAL_PIXEL_DOUBLE;
- U.widget_unit = (U.pixelsize * U.dpi * 20 + 36) / 72;
U.dpi_fac = ((U.pixelsize * (float)U.dpi) / 72.0f);
+ /* Set user preferences globals for drawing, and for forward compatibility. */
+ U.widget_unit = (U.pixelsize * U.dpi * 20 + 36) / 72;
+ /* If line thickness differs from scaling factor then adjustments need to be made */
+ U.widget_unit += 2 * ((int)U.pixelsize - (int)U.dpi_fac);
+
/* update font drawing */
BLF_default_dpi(U.pixelsize * U.dpi);
}
@@ -754,8 +767,13 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm)
win->sizex = wm_init_state.size_x;
win->sizey = wm_init_state.size_y;
- win->windowstate = GHOST_kWindowStateNormal;
- wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM;
+ if (wm_init_state.override_flag & WIN_OVERRIDE_GEOM) {
+ win->windowstate = GHOST_kWindowStateNormal;
+ wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM;
+ }
+ else {
+ win->windowstate = GHOST_WINDOW_STATE_DEFAULT;
+ }
}
if (wm_init_state.override_flag & WIN_OVERRIDE_WINSTATE) {
@@ -939,7 +957,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
ED_area_newspace(C, sa, SPACE_IMAGE, false);
}
else if (type == WM_WINDOW_DRIVERS) {
- ED_area_newspace(C, sa, SPACE_IPO, false);
+ ED_area_newspace(C, sa, SPACE_GRAPH, false);
}
else {
ED_area_newspace(C, sa, SPACE_USERPREF, false);
@@ -959,7 +977,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
title = IFACE_("Blender Preferences");
else if (sa->spacetype == SPACE_FILE)
title = IFACE_("Blender File View");
- else if (sa->spacetype == SPACE_IPO)
+ else if (sa->spacetype == SPACE_GRAPH)
title = IFACE_("Blender Drivers Editor");
else
title = "Blender";
@@ -1054,6 +1072,11 @@ void wm_cursor_position_to_ghost(wmWindow *win, int *x, int *y)
void wm_get_cursor_position(wmWindow *win, int *x, int *y)
{
+ if (UNLIKELY(G.f & G_FLAG_EVENT_SIMULATE)) {
+ *x = win->eventstate->x;
+ *y = win->eventstate->y;
+ return;
+ }
GHOST_GetCursorPosition(g_system, x, y);
wm_cursor_position_from_ghost(win, x, y);
}
@@ -1422,12 +1445,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
#if defined(__APPLE__) || defined(WIN32)
/* OSX and Win32 don't return to the mainloop while resize */
+ wm_window_timer(C);
+ wm_event_do_handlers(C);
wm_event_do_notifiers(C);
wm_draw_update(C);
-
- /* Warning! code above nulls 'C->wm.window', causing BGE to quit, see: T45699.
- * Further, its easier to match behavior across platforms, so restore the window. */
- CTX_wm_window_set(C, win);
#endif
}
}
@@ -1448,14 +1469,12 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
case GHOST_kEventOpenMainFile:
{
PointerRNA props_ptr;
- wmWindow *oldWindow;
const char *path = GHOST_GetEventData(evt);
if (path) {
wmOperatorType *ot = WM_operatortype_find("WM_OT_open_mainfile", false);
/* operator needs a valid window in context, ensures
* it is correctly set */
- oldWindow = CTX_wm_window(C);
CTX_wm_window_set(C, win);
WM_operator_properties_create_ptr(&props_ptr, ot);
@@ -1463,7 +1482,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &props_ptr);
WM_operator_properties_free(&props_ptr);
- CTX_wm_window_set(C, oldWindow);
+ CTX_wm_window_set(C, NULL);
}
break;
}
@@ -1532,10 +1551,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
// close all popups since they are positioned with the pixel
// size baked in and it's difficult to correct them
- wmWindow *oldWindow = CTX_wm_window(C);
CTX_wm_window_set(C, win);
UI_popup_handlers_remove_all(C, &win->modalhandlers);
- CTX_wm_window_set(C, oldWindow);
+ CTX_wm_window_set(C, NULL);
wm_window_make_drawable(wm, win);
@@ -1639,33 +1657,6 @@ void wm_window_process_events(const bContext *C)
PIL_sleep_ms(5);
}
-void wm_window_process_events_nosleep(void)
-{
- if (GHOST_ProcessEvents(g_system, 0))
- GHOST_DispatchEvents(g_system);
-}
-
-/* exported as handle callback to bke blender.c */
-void wm_window_testbreak(void)
-{
- static double ltime = 0;
- double curtime = PIL_check_seconds_timer();
-
- BLI_assert(BLI_thread_is_main());
-
- /* only check for breaks every 50 milliseconds
- * if we get called more often.
- */
- if ((curtime - ltime) > 0.05) {
- int hasevent = GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
-
- if (hasevent)
- GHOST_DispatchEvents(g_system);
-
- ltime = curtime;
- }
-}
-
/* **************** init ********************** */
/* bContext can be null in background mode because we don't
@@ -1690,6 +1681,8 @@ void wm_ghost_init(bContext *C)
}
GHOST_UseWindowFocus(wm_init_state.window_focus);
+
+ WM_init_tablet_api();
}
}
@@ -1969,6 +1962,12 @@ void WM_init_state_normal_set(void)
wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
}
+void WM_init_state_maximized_set(void)
+{
+ wm_init_state.windowstate = GHOST_kWindowStateMaximized;
+ wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
+}
+
void WM_init_window_focus_set(bool do_it)
{
wm_init_state.window_focus = do_it;
@@ -1979,6 +1978,24 @@ void WM_init_native_pixels(bool do_it)
wm_init_state.native_pixels = do_it;
}
+void WM_init_tablet_api(void)
+{
+ if (g_system) {
+ switch (U.tablet_api) {
+ case USER_TABLET_NATIVE:
+ GHOST_SetTabletAPI(g_system, GHOST_kTabletNative);
+ break;
+ case USER_TABLET_WINTAB:
+ GHOST_SetTabletAPI(g_system, GHOST_kTabletWintab);
+ break;
+ case USER_TABLET_AUTOMATIC:
+ default:
+ GHOST_SetTabletAPI(g_system, GHOST_kTabletAutomatic);
+ break;
+ }
+ }
+}
+
/* This function requires access to the GHOST_SystemHandle (g_system) */
void WM_cursor_warp(wmWindow *win, int x, int y)
{
diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus.c b/source/blender/windowmanager/message_bus/intern/wm_message_bus.c
index 63a897b2faf..3dab006defe 100644
--- a/source/blender/windowmanager/message_bus/intern/wm_message_bus.c
+++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/message_bus/intern/wm_message_bus.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#include <string.h>
@@ -245,6 +241,10 @@ void WM_msg_id_remove(struct wmMsgBus *mbus, const struct ID *id)
* \note While we could have a separate type for ID's, use RNA since there is enough overlap.
* \{ */
+
+/**
+ * \note #wmMsgBus.messages_tag_count isn't updated, caller must handle.
+ */
void wm_msg_subscribe_value_free(
wmMsgSubscribeKey *msg_key, wmMsgSubscribeValueLink *msg_lnk)
{
diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.h b/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.h
index db8b481a3c2..3b22d88a188 100644
--- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.h
+++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/message_bus/intern/wm_message_bus_intern.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#ifndef __WM_MESSAGE_BUS_INTERN_H__
diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c
index 619777fc671..02300128e9f 100644
--- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c
+++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/message_bus/intern/wm_message_bus_rna.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
-
#include <stdio.h>
#include "CLG_log.h"
@@ -40,7 +35,6 @@
#include "RNA_access.h"
-
/* -------------------------------------------------------------------------- */
BLI_INLINE uint void_hash_uint(const void *key)
@@ -120,10 +114,15 @@ static void wm_msg_rna_update_by_id(
/* Remove any non-persistent values, so a single persistent
* value doesn't modify behavior for the rest. */
- wmMsgSubscribeValueLink *msg_lnk_next;
- for (wmMsgSubscribeValueLink *msg_lnk = key->head.values.first; msg_lnk; msg_lnk = msg_lnk_next) {
+ for (wmMsgSubscribeValueLink *msg_lnk = key->head.values.first, *msg_lnk_next;
+ msg_lnk;
+ msg_lnk = msg_lnk_next)
+ {
msg_lnk_next = msg_lnk->next;
if (msg_lnk->params.is_persistent == false) {
+ if (msg_lnk->params.tag) {
+ mbus->messages_tag_count -= 1;
+ }
wm_msg_subscribe_value_free(&key->head, msg_lnk);
}
}
@@ -140,12 +139,14 @@ static void wm_msg_rna_update_by_id(
remove = false;
}
else {
- /* we need to resolve this from the */
+ /* We need to resolve this from the new ID pointer. */
PointerRNA idptr;
RNA_id_pointer_create(id_dst, &idptr);
PointerRNA ptr;
- PropertyRNA *prop;
- if (!RNA_path_resolve(&idptr, key->msg.params.data_path, &ptr, &prop)) {
+ PropertyRNA *prop = NULL;
+ if (RNA_path_resolve(&idptr, key->msg.params.data_path, &ptr, &prop) &&
+ (prop == NULL) == (key->msg.params.prop == NULL))
+ {
key->msg.params.ptr = ptr;
key->msg.params.prop = prop;
remove = false;
@@ -153,6 +154,18 @@ static void wm_msg_rna_update_by_id(
}
if (remove) {
+ for (wmMsgSubscribeValueLink *msg_lnk = key->head.values.first, *msg_lnk_next;
+ msg_lnk;
+ msg_lnk = msg_lnk_next)
+ {
+ msg_lnk_next = msg_lnk->next;
+ if (msg_lnk->params.is_persistent == false) {
+ if (msg_lnk->params.tag) {
+ mbus->messages_tag_count -= 1;
+ }
+ wm_msg_subscribe_value_free(&key->head, msg_lnk);
+ }
+ }
/* Failed to persist, remove the key. */
BLI_remlink(&mbus->messages, key);
wm_msg_rna_gset_key_free(key);
@@ -176,6 +189,18 @@ static void wm_msg_rna_remove_by_id(struct wmMsgBus *mbus, const ID *id)
wmMsgSubscribeKey_RNA *key = BLI_gsetIterator_getKey(&gs_iter);
BLI_gsetIterator_step(&gs_iter);
if (key->msg.params.ptr.id.data == id) {
+ /* Clear here so we can decrement 'messages_tag_count'. */
+ for (wmMsgSubscribeValueLink *msg_lnk = key->head.values.first, *msg_lnk_next;
+ msg_lnk;
+ msg_lnk = msg_lnk_next)
+ {
+ msg_lnk_next = msg_lnk->next;
+ if (msg_lnk->params.tag) {
+ mbus->messages_tag_count -= 1;
+ }
+ wm_msg_subscribe_value_free(&key->head, msg_lnk);
+ }
+
BLI_remlink(&mbus->messages, key);
BLI_gset_remove(gs, key, NULL);
wm_msg_rna_gset_key_free(key);
diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c b/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c
index 64894ae164d..29b59ebf9ae 100644
--- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c
+++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/message_bus/intern/wm_message_bus_static.c
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#include <stdio.h>
diff --git a/source/blender/windowmanager/message_bus/wm_message_bus.h b/source/blender/windowmanager/message_bus/wm_message_bus.h
index c1d6f1f6fb8..6d9a31ede6c 100644
--- a/source/blender/windowmanager/message_bus/wm_message_bus.h
+++ b/source/blender/windowmanager/message_bus/wm_message_bus.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/message_bus/wm_message_bus.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#ifndef __WM_MESSAGE_BUS_H__
@@ -269,7 +265,7 @@ void WM_msg_publish_ID(
WM_msg_subscribe_rna_params( \
mbus, \
&(const wmMsgParams_RNA){ \
- .ptr = (PointerRNA){.type = &RNA_##type_}, \
+ .ptr = (PointerRNA){ .type = &RNA_##type_, }, \
.prop = NULL, \
}, \
value, __func__); \
@@ -281,7 +277,7 @@ void WM_msg_publish_ID(
WM_msg_subscribe_rna_params( \
mbus, \
&(const wmMsgParams_RNA){ \
- .ptr = (PointerRNA){.type = &RNA_##type_}, \
+ .ptr = (PointerRNA){ .type = &RNA_##type_, }, \
.prop = &rna_##type_##_##prop_, \
}, \
value, __func__); \
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index 89fd2fdf557..3d8589f9ca8 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,23 +15,18 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/wm.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#ifndef __WM_H__
#define __WM_H__
struct ARegion;
-struct wmWindow;
struct ReportList;
+struct wmWindow;
#include "gizmo/wm_gizmo_wmapi.h"
diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h
index f863d8bfdd9..e42213bf362 100644
--- a/source/blender/windowmanager/wm_cursors.h
+++ b/source/blender/windowmanager/wm_cursors.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/wm_cursors.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#ifndef __WM_CURSORS_H__
@@ -47,7 +39,7 @@ enum {
CURSOR_STD,
CURSOR_NONE,
CURSOR_PENCIL,
- CURSOR_COPY
+ CURSOR_COPY,
};
@@ -94,7 +86,14 @@ enum {
BC_EW_SCROLLCURSOR,
BC_EYEDROPPER_CURSOR,
BC_SWAPAREA_CURSOR,
-/* --- ALWAYS LAST ----- */
+ BC_H_SPLITCURSOR,
+ BC_V_SPLITCURSOR,
+ BC_N_ARROWCURSOR,
+ BC_S_ARROWCURSOR,
+ BC_E_ARROWCURSOR,
+ BC_W_ARROWCURSOR,
+ BC_STOPCURSOR,
+ /* --- ALWAYS LAST ----- */
BC_NUMCURSORS,
};
@@ -105,11 +104,11 @@ enum {
BC_RED,
BC_BLUE,
BC_GREEN,
- BC_YELLOW
+ BC_YELLOW,
};
-struct wmWindow;
struct wmEvent;
+struct wmWindow;
bool wm_cursor_arrow_move(struct wmWindow *win, const struct wmEvent *event);
diff --git a/source/blender/windowmanager/wm_draw.h b/source/blender/windowmanager/wm_draw.h
index 1e0f3cd6b35..4bf55bcacea 100644
--- a/source/blender/windowmanager/wm_draw.h
+++ b/source/blender/windowmanager/wm_draw.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/wm_draw.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
@@ -35,8 +28,8 @@
#include "GPU_glew.h"
struct GPUOffScreen;
-struct GPUViewport;
struct GPUTexture;
+struct GPUViewport;
typedef struct wmDrawBuffer {
struct GPUOffScreen *offscreen[2];
@@ -45,9 +38,9 @@ typedef struct wmDrawBuffer {
int bound_view;
} wmDrawBuffer;
+struct ARegion;
struct bContext;
struct wmWindow;
-struct ARegion;
/* wm_draw.c */
void wm_draw_update(struct bContext *C);
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index fe28cbf9895..92ae4e0e2cf 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/wm_event_system.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#ifndef __WM_EVENT_SYSTEM_H__
@@ -37,55 +30,104 @@
#define WM_HANDLER_HANDLED 2
#define WM_HANDLER_MODAL 4 /* MODAL|BREAK means unhandled */
-struct ScrArea;
struct ARegion;
+struct ScrArea;
/* wmKeyMap is in DNA_windowmanager.h, it's saveable */
-struct wmEventHandler_KeymapFn {
- void (*handle_post_fn)(wmKeyMap *keymap, wmKeyMapItem *kmi, void *user_data);
- void *user_data;
+/** Custom types for handlers, for signaling, freeing */
+enum eWM_EventHandlerType {
+ WM_HANDLER_TYPE_GIZMO = 1,
+ WM_HANDLER_TYPE_UI,
+ WM_HANDLER_TYPE_OP,
+ WM_HANDLER_TYPE_DROPBOX,
+ WM_HANDLER_TYPE_KEYMAP,
};
typedef struct wmEventHandler {
struct wmEventHandler *next, *prev;
- char type; /* WM_HANDLER_DEFAULT, ... */
+ enum eWM_EventHandlerType type;
char flag; /* WM_HANDLER_BLOCKING, ... */
- /* keymap handler */
- wmKeyMap *keymap; /* pointer to builtin/custom keymaps */
- const rcti *bblocal, *bbwin; /* optional local and windowspace bb */
- /* Run after the keymap item runs. */
- struct wmEventHandler_KeymapFn keymap_callback;
+ /** Optional local and windowspace bb. */
+ const rcti *bblocal, *bbwin;
+} wmEventHandler;
+
+/** Run after the keymap item runs. */
+struct wmEventHandler_KeymapPost {
+ void (*post_fn)(wmKeyMap *keymap, wmKeyMapItem *kmi, void *user_data);
+ void *user_data;
+};
+
+/** Support for a getter function that looks up the keymap each access. */
+struct wmEventHandler_KeymapDynamic {
+ wmEventHandler_KeymapDynamicFn *keymap_fn;
+ void *user_data;
+};
+
+/** #WM_HANDLER_TYPE_KEYMAP */
+typedef struct wmEventHandler_Keymap {
+ wmEventHandler head;
+
+ /** Pointer to builtin/custom keymaps (never NULL). */
+ wmKeyMap *keymap;
+
+ struct wmEventHandler_KeymapPost post;
+ struct wmEventHandler_KeymapDynamic dynamic;
struct bToolRef *keymap_tool;
+} wmEventHandler_Keymap;
- /* modal operator handler */
- wmOperator *op; /* for derived/modal handlers */
- struct ScrArea *op_area; /* for derived/modal handlers */
- struct ARegion *op_region; /* for derived/modal handlers */
- short op_region_type; /* for derived/modal handlers */
-
- /* ui handler */
- wmUIHandlerFunc ui_handle; /* callback receiving events */
- wmUIHandlerRemoveFunc ui_remove; /* callback when handler is removed */
- void *ui_userdata; /* user data pointer */
- struct ScrArea *ui_area; /* for derived/modal handlers */
- struct ARegion *ui_region; /* for derived/modal handlers */
- struct ARegion *ui_menu; /* for derived/modal handlers */
-
- /* drop box handler */
- ListBase *dropboxes;
- /* gizmo handler */
- struct wmGizmoMap *gizmo_map;
-} wmEventHandler;
+/** #WM_HANDLER_TYPE_GIZMO */
+typedef struct wmEventHandler_Gizmo {
+ wmEventHandler head;
-/* custom types for handlers, for signaling, freeing */
-enum {
- WM_HANDLER_DEFAULT,
- WM_HANDLER_FILESELECT
-};
+ /** Gizmo handler (never NULL). */
+ struct wmGizmoMap *gizmo_map;
+} wmEventHandler_Gizmo;
+
+/** #WM_HANDLER_TYPE_UI */
+typedef struct wmEventHandler_UI {
+ wmEventHandler head;
+
+ wmUIHandlerFunc handle_fn; /* callback receiving events */
+ wmUIHandlerRemoveFunc remove_fn; /* callback when handler is removed */
+ void *user_data; /* user data pointer */
+
+ /** Store context for this handler for derived/modal handlers. */
+ struct {
+ struct ScrArea *area;
+ struct ARegion *region;
+ struct ARegion *menu;
+ } context;
+} wmEventHandler_UI;
+
+/** #WM_HANDLER_TYPE_OP */
+typedef struct wmEventHandler_Op {
+ wmEventHandler head;
+
+ /** Operator can be NULL. */
+ wmOperator *op;
+
+ /** Hack, special case for file-select. */
+ bool is_fileselect;
+
+ /** Store context for this handler for derived/modal handlers. */
+ struct {
+ struct ScrArea *area;
+ struct ARegion *region;
+ short region_type;
+ } context;
+} wmEventHandler_Op;
+
+/** #WM_HANDLER_TYPE_DROPBOX */
+typedef struct wmEventHandler_Dropbox {
+ wmEventHandler head;
+
+ /** Never NULL. */
+ ListBase *dropboxes;
+} wmEventHandler_Dropbox;
/* wm_event_system.c */
void wm_event_free_all (wmWindow *win);
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index fad55171292..f68d984afe3 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,14 +12,10 @@
* 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): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/wm_event_types.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
@@ -308,11 +302,10 @@ enum {
TIMERF = 0x011F, /* last timer */
/* Actionzones, tweak, gestures: 0x500x, 0x501x */
-#define EVT_ACTIONZONE_FIRST EVT_ACTIONZONE_AREA
+ /* Keep in sync with IS_EVENT_ACTIONZONE(...). */
EVT_ACTIONZONE_AREA = 0x5000,
EVT_ACTIONZONE_REGION = 0x5001,
EVT_ACTIONZONE_FULLSCREEN = 0x5011,
-#define EVT_ACTIONZONE_LAST (EVT_ACTIONZONE_FULLSCREEN + 1)
/* NOTE: these values are saved in keymap files, do not change them but just add new ones */
@@ -376,7 +369,8 @@ enum {
/* test whether the event is a NDOF event */
#define ISNDOF(event_type) ((event_type) >= NDOF_MOTION && (event_type) < NDOF_LAST)
-#define IS_EVENT_ACTIONZONE(event_type) ((event_type) >= EVT_ACTIONZONE_FIRST && (event_type) < EVT_ACTIONZONE_LAST)
+#define IS_EVENT_ACTIONZONE(event_type) \
+ ELEM(event_type, EVT_ACTIONZONE_AREA, EVT_ACTIONZONE_REGION, EVT_ACTIONZONE_FULLSCREEN)
/* test whether event type is acceptable as hotkey, excluding modifiers */
#define ISHOTKEY(event_type) \
diff --git a/source/blender/windowmanager/wm_files.h b/source/blender/windowmanager/wm_files.h
index f6f43c3d856..c3b4c19c0ef 100644
--- a/source/blender/windowmanager/wm_files.h
+++ b/source/blender/windowmanager/wm_files.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/wm_files.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
#ifndef __WM_FILES_H__
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index 5988c8dab17..9e7eb213070 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,15 +15,10 @@
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/wm_window.h
- * \ingroup wm
+/** \file
+ * \ingroup wm
*/
@@ -33,10 +26,10 @@
#define __WM_WINDOW_H__
struct EnumPropertyItem;
-struct wmEvent;
-struct wmOperator;
struct PointerRNA;
struct PropertyRNA;
+struct wmEvent;
+struct wmOperator;
/* *************** internal api ************** */
void wm_ghost_init (bContext *C);
@@ -55,7 +48,6 @@ void wm_window_title (wmWindowManager *wm, wmWindow *win);
void wm_window_ghostwindows_ensure(wmWindowManager *wm);
void wm_window_ghostwindows_remove_invalid(bContext *C, wmWindowManager *wm);
void wm_window_process_events (const bContext *C);
-void wm_window_process_events_nosleep(void);
void wm_window_clear_drawable(wmWindowManager *wm);
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win);
@@ -73,8 +65,6 @@ void wm_get_cursor_position (wmWindow *win, int *x, int *y);
void wm_cursor_position_from_ghost (wmWindow *win, int *x, int *y);
void wm_cursor_position_to_ghost (wmWindow *win, int *x, int *y);
-void wm_window_testbreak (void);
-
#ifdef WITH_INPUT_IME
void wm_window_IME_begin (wmWindow *win, int x, int y, int w, int h, bool complete);
void wm_window_IME_end (wmWindow *win);
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index c5bd0f8d88b..0959013c91d 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -16,11 +16,6 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
# ***** END GPL LICENSE BLOCK *****
setup_libdirs()
@@ -479,6 +474,7 @@ if(UNIX AND NOT APPLE)
FILES
${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
+ ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/symbolic/apps/blender-symbolic.svg
DESTINATION "."
)
@@ -509,21 +505,14 @@ if(UNIX AND NOT APPLE)
DESTINATION share/applications
)
install(
- DIRECTORY
- ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/16x16
- ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/22x22
- ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/24x24
- ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/32x32
- ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/48x48
- ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/256x256
- DESTINATION share/icons/hicolor
- PATTERN "*.svg" EXCLUDE
- )
- install(
FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
DESTINATION share/icons/hicolor/scalable/apps
)
install(
+ FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/symbolic/apps/blender-symbolic.svg
+ DESTINATION share/icons/hicolor/symbolic/apps
+ )
+ install(
PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
DESTINATION bin
)
@@ -777,13 +766,6 @@ elseif(WIN32)
endif()
endif()
- if(MSVC)
- install(
- FILES ${LIBDIR}/pthreads/lib/pthreadVC3.dll
- DESTINATION "."
- )
- endif()
-
if(WITH_CODEC_FFMPEG)
install(
FILES
@@ -908,6 +890,13 @@ elseif(APPLE)
blender.app/Contents/
)
+ if(WITH_OPENMP AND OPENMP_CUSTOM)
+ install(
+ FILES ${LIBDIR}/openmp/lib/libomp.dylib
+ DESTINATION blender.app/Contents/Resources/lib
+ )
+ endif()
+
if(WITH_LLVM AND NOT LLVM_STATIC)
install(
FILES ${LIBDIR}/llvm/lib/libLLVM-3.4.dylib
diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c
index 795eec0df40..6f3948ada55 100644
--- a/source/creator/buildinfo.c
+++ b/source/creator/buildinfo.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file creator/buildinfo.c
- * \ingroup creator
+/** \file
+ * \ingroup creator
*/
diff --git a/source/creator/creator.c b/source/creator/creator.c
index a32acc75248..ad768f13e71 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -17,16 +15,10 @@
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file creator/creator.c
- * \ingroup creator
+/** \file
+ * \ingroup creator
*/
#include <stdlib.h>
@@ -127,11 +119,10 @@ struct ApplicationState app_state = {
},
.exit_code_on_error = {
.python = 0,
- }
+ },
};
/* -------------------------------------------------------------------- */
-
/** \name Application Level Callbacks
*
* Initialize callbacks for the modules that need them.
@@ -187,9 +178,7 @@ static void callback_clg_fatal(void *fp)
/** \} */
-
/* -------------------------------------------------------------------- */
-
/** \name Main Function
* \{ */
@@ -249,7 +238,8 @@ int main(
_putenv_s("OMP_WAIT_POLICY", "PASSIVE");
# endif
- /* FMA3 support in the 2013 CRT is broken on Vista and Windows 7 RTM (fixed in SP1). Just disable it. */
+ /* FMA3 support in the 2013 CRT is broken on Vista and Windows 7 RTM
+ * (fixed in SP1). Just disable it. */
# if defined(_MSC_VER) && defined(_M_X64)
_set_FMA3_enable(0);
# endif
@@ -398,7 +388,8 @@ int main(
main_signal_setup();
#else
- G.factory_startup = true; /* using preferences or user startup makes no sense for py-as-module */
+ /* using preferences or user startup makes no sense for py-as-module */
+ G.factory_startup = true;
#endif
#ifdef WITH_FFMPEG
@@ -477,13 +468,6 @@ int main(
/* OK we are ready for it */
#ifndef WITH_PYTHON_MODULE
main_args_setup_post(C, ba);
-
- if (G.background == 0) {
- if (!G.file_loaded)
- if (U.uiflag2 & USER_KEEP_SESSION)
- WM_recover_last_session(C, NULL);
- }
-
#endif
/* Explicitly free data allocated for argument parsing:
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 5b976515dd8..4fe5371152d 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file creator/creator_args.c
- * \ingroup creator
+/** \file
+ * \ingroup creator
*/
#ifndef WITH_PYTHON_MODULE
@@ -94,7 +90,6 @@
/* -------------------------------------------------------------------- */
-
/** \name Utility String Parsing
* \{ */
@@ -406,7 +401,7 @@ static void arg_py_context_restore(
}
if ((c_py->scene == NULL) ||
- BLI_findindex(&G_MAIN->scene, c_py->scene) != -1)
+ BLI_findindex(&G_MAIN->scenes, c_py->scene) != -1)
{
CTX_data_scene_set(C, c_py->scene);
}
@@ -426,7 +421,6 @@ static void arg_py_context_restore(
/** \} */
/* -------------------------------------------------------------------- */
-
/** \name Handle Argument Callbacks
*
* \note Doc strings here are used in differently:
@@ -440,10 +434,7 @@ static void arg_py_context_restore(
*
* \{ */
-static const char arg_handle_print_version_doc[] =
-"\n\tPrint Blender version and exit."
-;
-static int arg_handle_print_version(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
+static void print_version_full(void)
{
printf(BLEND_VERSION_STRING_FMT);
#ifdef BUILD_DATE
@@ -459,8 +450,27 @@ static int arg_handle_print_version(int UNUSED(argc), const char **UNUSED(argv),
printf("\tbuild link flags: %s\n", build_linkflags);
printf("\tbuild system: %s\n", build_system);
#endif
- exit(0);
+}
+static void print_version_short(void)
+{
+#ifdef BUILD_DATE
+ /* NOTE: We include built time since sometimes we need to tell broken from
+ * working built of the same hash. */
+ printf(BLEND_VERSION_FMT " (hash %s built %s %s)\n",
+ BLEND_VERSION_ARG, build_hash, build_date, build_time);
+#else
+ printf(BLEND_VERSION_STRING_FMT);
+#endif
+}
+
+static const char arg_handle_print_version_doc[] =
+"\n\tPrint Blender version and exit."
+;
+static int arg_handle_print_version(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
+{
+ print_version_full();
+ exit(0);
return 0;
}
@@ -503,6 +513,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
BLI_argsPrintArgDoc(ba, "--window-border");
BLI_argsPrintArgDoc(ba, "--window-fullscreen");
BLI_argsPrintArgDoc(ba, "--window-geometry");
+ BLI_argsPrintArgDoc(ba, "--window-maximized");
BLI_argsPrintArgDoc(ba, "--start-console");
BLI_argsPrintArgDoc(ba, "--no-native-pixels");
BLI_argsPrintArgDoc(ba, "--no-window-focus");
@@ -527,6 +538,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
BLI_argsPrintArgDoc(ba, "--log-level");
BLI_argsPrintArgDoc(ba, "--log-show-basename");
BLI_argsPrintArgDoc(ba, "--log-show-backtrace");
+ BLI_argsPrintArgDoc(ba, "--log-show-timestamp");
BLI_argsPrintArgDoc(ba, "--log-file");
printf("\n");
@@ -570,6 +582,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
BLI_argsPrintArgDoc(ba, "--app-template");
BLI_argsPrintArgDoc(ba, "--factory-startup");
BLI_argsPrintArgDoc(ba, "--enable-static-override");
+ BLI_argsPrintArgDoc(ba, "--enable-event-simulate");
printf("\n");
BLI_argsPrintArgDoc(ba, "--env-system-datafiles");
BLI_argsPrintArgDoc(ba, "--env-system-scripts");
@@ -666,12 +679,12 @@ static const char arg_handle_python_set_doc_disable[] =
static int arg_handle_python_set(int UNUSED(argc), const char **UNUSED(argv), void *data)
{
if ((bool)data) {
- G.f |= G_SCRIPT_AUTOEXEC;
+ G.f |= G_FLAG_SCRIPT_AUTOEXEC;
}
else {
- G.f &= ~G_SCRIPT_AUTOEXEC;
+ G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
}
- G.f |= G_SCRIPT_OVERRIDE_PREF;
+ G.f |= G_FLAG_SCRIPT_OVERRIDE_PREF;
return 0;
}
@@ -698,6 +711,7 @@ static const char arg_handle_background_mode_set_doc[] =
;
static int arg_handle_background_mode_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
+ print_version_short();
G.background = 1;
return 0;
}
@@ -749,6 +763,15 @@ static int arg_handle_log_show_backtrace_set(int UNUSED(argc), const char **UNUS
return 0;
}
+static const char arg_handle_log_show_timestamp_set_doc[] =
+"\n\tShow a timestamp for each log message in seconds since start."
+;
+static int arg_handle_log_show_timestamp_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
+{
+ CLG_output_use_timestamp_set(true);
+ return 0;
+}
+
static const char arg_handle_log_file_set_doc[] =
"<filename>\n"
"\n"
@@ -1012,6 +1035,15 @@ static int arg_handle_enable_static_override(int UNUSED(argc), const char **UNUS
return 0;
}
+static const char arg_handle_enable_event_simulate_doc[] =
+"\n\tEnable event simulation testing feature 'bpy.types.Window.event_simulate'."
+;
+static int arg_handle_enable_event_simulate(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
+{
+ G.f |= G_FLAG_EVENT_SIMULATE;
+ return 0;
+}
+
static const char arg_handle_env_system_set_doc_datafiles[] =
"\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_DATAFILES)" environment variable.";
static const char arg_handle_env_system_set_doc_scripts[] =
@@ -1127,6 +1159,15 @@ static int arg_handle_without_borders(int UNUSED(argc), const char **UNUSED(argv
return 0;
}
+static const char arg_handle_window_maximized_doc[] =
+"\n\tForce opening maximized."
+;
+static int arg_handle_window_maximized(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
+{
+ WM_init_state_maximized_set();
+ return 0;
+}
+
static const char arg_handle_no_window_focus_doc[] =
"\n\tOpen behind other windows and without taking focus."
;
@@ -1136,14 +1177,12 @@ static int arg_handle_no_window_focus(int UNUSED(argc), const char **UNUSED(argv
return 0;
}
-extern bool wm_start_with_console; /* wm_init_exit.c */
-
static const char arg_handle_start_with_console_doc[] =
"\n\tStart with the console window open (ignored if -b is set), (Windows only)."
;
static int arg_handle_start_with_console(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
- wm_start_with_console = true;
+ WM_init_state_start_with_console_set(true);
return 0;
}
@@ -1615,6 +1654,7 @@ static int arg_handle_python_file_run(int argc, const char **argv, void *data)
BPY_CTX_SETUP(ok = BPY_execute_filepath(C, filename, NULL));
if (!ok && app_state.exit_code_on_error.python) {
printf("\nError: script failed, file: '%s', exiting.\n", argv[1]);
+ BPY_python_end();
exit(app_state.exit_code_on_error.python);
}
return 1;
@@ -1656,6 +1696,7 @@ static int arg_handle_python_text_run(int argc, const char **argv, void *data)
if (!ok && app_state.exit_code_on_error.python) {
printf("\nError: script failed, text: '%s', exiting.\n", argv[1]);
+ BPY_python_end();
exit(app_state.exit_code_on_error.python);
}
@@ -1687,6 +1728,7 @@ static int arg_handle_python_expr_run(int argc, const char **argv, void *data)
BPY_CTX_SETUP(ok = BPY_execute_string_ex(C, NULL, argv[1], false));
if (!ok && app_state.exit_code_on_error.python) {
printf("\nError: script failed, expr: '%s', exiting.\n", argv[1]);
+ BPY_python_end();
exit(app_state.exit_code_on_error.python);
}
return 1;
@@ -1821,7 +1863,8 @@ static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data)
}
if (BLO_has_bfile_extension(filename)) {
- /* Just pretend a file was loaded, so the user can press Save and it'll save at the filename from the CLI. */
+ /* Just pretend a file was loaded, so the user can press Save and it'll
+ * save at the filename from the CLI. */
BLI_strncpy(G_MAIN->name, filename, FILE_MAX);
G.relbase_valid = true;
G.save_over = true;
@@ -1872,6 +1915,7 @@ void main_args_setup(bContext *C, bArgs *ba)
BLI_argsAdd(ba, 1, NULL, "--log-level", CB(arg_handle_log_level_set), ba);
BLI_argsAdd(ba, 1, NULL, "--log-show-basename", CB(arg_handle_log_show_basename_set), ba);
BLI_argsAdd(ba, 1, NULL, "--log-show-backtrace", CB(arg_handle_log_show_backtrace_set), ba);
+ BLI_argsAdd(ba, 1, NULL, "--log-show-timestamp", CB(arg_handle_log_show_timestamp_set), ba);
BLI_argsAdd(ba, 1, NULL, "--log-file", CB(arg_handle_log_file_set), ba);
BLI_argsAdd(ba, 1, "-d", "--debug", CB(arg_handle_debug_mode_set), ba);
@@ -1941,6 +1985,7 @@ void main_args_setup(bContext *C, bArgs *ba)
BLI_argsAdd(ba, 1, NULL, "--app-template", CB(arg_handle_app_template), NULL);
BLI_argsAdd(ba, 1, NULL, "--factory-startup", CB(arg_handle_factory_startup_set), NULL);
BLI_argsAdd(ba, 1, NULL, "--enable-static-override", CB(arg_handle_enable_static_override), NULL);
+ BLI_argsAdd(ba, 1, NULL, "--enable-event-simulate", CB(arg_handle_enable_event_simulate), NULL);
/* TODO, add user env vars? */
BLI_argsAdd(ba, 1, NULL, "--env-system-datafiles", CB_EX(arg_handle_env_system_set, datafiles), NULL);
@@ -1951,6 +1996,7 @@ void main_args_setup(bContext *C, bArgs *ba)
BLI_argsAdd(ba, 2, "-p", "--window-geometry", CB(arg_handle_window_geometry), NULL);
BLI_argsAdd(ba, 2, "-w", "--window-border", CB(arg_handle_with_borders), NULL);
BLI_argsAdd(ba, 2, "-W", "--window-fullscreen", CB(arg_handle_without_borders), NULL);
+ BLI_argsAdd(ba, 2, "-M", "--window-maximized", CB(arg_handle_window_maximized), NULL);
BLI_argsAdd(ba, 2, NULL, "--no-window-focus", CB(arg_handle_no_window_focus), NULL);
BLI_argsAdd(ba, 2, "-con", "--start-console", CB(arg_handle_start_with_console), NULL);
BLI_argsAdd(ba, 2, "-R", NULL, CB(arg_handle_register_extension), NULL);
diff --git a/source/creator/creator_intern.h b/source/creator/creator_intern.h
index 311c8b74006..c2500c2ac06 100644
--- a/source/creator/creator_intern.h
+++ b/source/creator/creator_intern.h
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,15 +12,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
#ifndef __CREATOR_INTERN_H__
#define __CREATOR_INTERN_H__
-/** \file creator/creator_intern.h
- * \ingroup creator
+/** \file
+ * \ingroup creator
*
* Functionality for main() initialization.
*/
@@ -56,7 +52,6 @@ struct ApplicationState {
struct {
unsigned char python;
} exit_code_on_error;
-
};
extern struct ApplicationState app_state; /* creator.c */
diff --git a/source/creator/creator_signals.c b/source/creator/creator_signals.c
index 94e5874f71b..a3d3dc4b870 100644
--- a/source/creator/creator_signals.c
+++ b/source/creator/creator_signals.c
@@ -1,6 +1,4 @@
/*
- * ***** 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
@@ -14,12 +12,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
*/
-/** \file creator/creator_signals.c
- * \ingroup creator
+/** \file
+ * \ingroup creator
*/
#ifndef WITH_PYTHON_MODULE
@@ -64,7 +60,6 @@
#include "BKE_main.h"
#include "BKE_report.h"
-
#include <signal.h>
#include "creator_intern.h" /* own include */
@@ -335,8 +330,10 @@ void main_signal_setup_fpe(void)
(_MM_MASK_OVERFLOW | _MM_MASK_INVALID | _MM_MASK_DIV_ZERO));
# endif /* OSX_SSE_FPE */
# if defined(_WIN32) && defined(_MSC_VER)
- _controlfp_s(NULL, 0, _MCW_EM); /* enables all fp exceptions */
- _controlfp_s(NULL, _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM); /* hide the ones we don't care about */
+ /* enables all fp exceptions */
+ _controlfp_s(NULL, 0, _MCW_EM);
+ /* hide the ones we don't care about */
+ _controlfp_s(NULL, _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM);
# endif /* _WIN32 && _MSC_VER */
#endif
}